Commit 8fa79fab authored by 韩桐桐's avatar 韩桐桐

补证登记相关

parent 9c4edd9e
......@@ -126,6 +126,9 @@ public class JgCertificateReplenishDto extends BaseDto {
private String dataType;
private List<Map<String, Object>> equLists;
@ApiModelProperty("使用登记证补证申请表URL")
private String applicationFormFileUrl;
@ApiModelProperty("设备使用地址")
private String equUseAddress;
......
......@@ -237,6 +237,12 @@ public class JgCertificateReplenish extends BaseEntity {
@TableField("equ_use_address")
private String equUseAddress;
/**
* 使用登记证补证申请表URL
*/
@TableField("application_form_file_url")
private String applicationFormFileUrl;
@TableField(exist = false)
private String processAdvice;
}
......@@ -13,7 +13,7 @@ import java.util.Map;
*/
public interface IJgCertificateReplenishService {
Map<String, Object> getCertReplenishFormUrl(JSONObject map);
Map<String, Object> getCertReplenishFormUrl(JSONObject map, String applyNo);
void getCertReplenishFormStream(JSONObject jsonObject, HttpServletResponse response);
}
......@@ -101,7 +101,10 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
public static final String PROCESS_ADVICE = "processAdvice";
public static final String IS_COMPANY = "isCompany";
public static final String APPLY_STATUS = "applyStatus";
public static final String APPLY_NO = "applyNo";
public static final String APPLICATION_FORM_FILE_URL = "applicationFormFileUrl";
private final List<String> NOT_FLOWING_STATE = Arrays.asList("6610", "6614", "6615", "6617", "6616");
private final List<String> ATTACHMENT_FIELD = Arrays.asList(APPLICATION_FORM_FILE, OTHER_ACCESSORIES);
private static final String EQUIP_TRANSFER_PROCESS_KEY = "certReplenish";
private final Map<String, Function<JSONObject, Object>> actionMap = new HashMap<>();
/**
......@@ -187,6 +190,7 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
updateTaskModel(certRep);
createTaskModel(certRep, processTaskDTO, nextUserIds);
}
certRep.setApplicationFormFileUrl(Objects.toString(this.getCertReplenishFormUrl(jsonObject, certRep.getApplyNo()).get(APPLICATION_FORM_FILE_URL)));
this.updateById(certRep);
this.updateCertRepEqs(jsonObject);
return certRep;
......@@ -241,6 +245,7 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
public Object updateNotsubmit(JSONObject jsonObject) {
JgCertificateReplenish certRep = this.buildUpdateCertRep(jsonObject, FlowStatusEnum.TO_BE_SUBMITTED);
certRep.setApplicationFormFileUrl(Objects.toString(this.getCertReplenishFormUrl(jsonObject, certRep.getApplyNo()).get(APPLICATION_FORM_FILE_URL)));
this.updateById(certRep);
this.updateCertRepEqs(jsonObject);
return certRep;
......@@ -258,8 +263,8 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
String[] safetyManager = Objects.toString(jsonObject.get(SAFETY_MANAGER_ID)).split("_");
this.setEquClassification(certRep);
certRep.setApplyStatus(Objects.toString(flowStatusEnum.getCode()));
certRep.setApplicationFormFile(JSONObject.toJSONString(jsonObject.get(APPLICATION_FORM_FILE)));
certRep.setOtherAccessories(!ValidationUtil.isEmpty(jsonObject.get(OTHER_ACCESSORIES)) ? JSONObject.toJSONString(jsonObject.get(OTHER_ACCESSORIES)) : null);
Optional.ofNullable(jsonObject.get(APPLICATION_FORM_FILE)).ifPresent(x -> certRep.setApplicationFormFile(JSONObject.toJSONString(x)));
Optional.ofNullable(jsonObject.get(OTHER_ACCESSORIES)).ifPresent(x -> certRep.setOtherAccessories(JSONObject.toJSONString(x)));
certRep.setSafetyManagerName(safetyManager[1]);
return certRep;
}
......@@ -342,9 +347,10 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
Long sequenceNbr = sequence.nextId();
JSONArray equLists = jsonObj.getJSONArray(EQU_LISTS);
this.saveCertRepEqs(sequenceNbr, equLists);
JgCertificateReplenish certificateReplenish = this.buildCertRep(sequenceNbr, jsonObj, new WorkflowResultDto());
this.save(certificateReplenish);
return certificateReplenish;
JgCertificateReplenish certRep = this.buildCertRep(sequenceNbr, jsonObj, new WorkflowResultDto());
certRep.setApplicationFormFileUrl(Objects.toString(this.getCertReplenishFormUrl(jsonObj, certRep.getApplyNo()).get(APPLICATION_FORM_FILE_URL)));
this.save(certRep);
return certRep;
}
public void saveOrUpdateHisDataBatch(JSONObject jsonObj, String sequenceNbr) {
......@@ -377,8 +383,8 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
certRep.setReceiveOrgName(receiveOrg[1]);
certRep.setUseUnitCode(getSelectedOrgInfo().getCompany().getCompanyCode());
certRep.setUseUnitName(getSelectedOrgInfo().getCompany().getCompanyName());
certRep.setApplicationFormFile(JSONObject.toJSONString(jsonObj.get(APPLICATION_FORM_FILE)));
certRep.setOtherAccessories(!ValidationUtil.isEmpty(jsonObj.get(OTHER_ACCESSORIES)) ? JSONObject.toJSONString(jsonObj.get(OTHER_ACCESSORIES)) : null);
Optional.ofNullable(jsonObj.get(APPLICATION_FORM_FILE)).ifPresent(x -> certRep.setApplicationFormFile(JSONObject.toJSONString(x)));
Optional.ofNullable(jsonObj.get(OTHER_ACCESSORIES)).ifPresent(x -> certRep.setOtherAccessories(JSONObject.toJSONString(x)));
certRep.setSafetyManagerName(safetyManager[1]);
certRep.setIsDelete(Boolean.FALSE);
certRep.setCreateDate(date);
......@@ -423,6 +429,7 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
commonService.saveExecuteFlowData2Redis(workflowResultDto.getInstanceId(), buildInstanceRuntimeData(certRep));
// 代办
this.buildTask(certRep, workflowResultList);
certRep.setApplicationFormFileUrl(Objects.toString(this.getCertReplenishFormUrl(jsonObj, certRep.getApplyNo()).get(APPLICATION_FORM_FILE_URL)));
this.save(certRep);
this.saveCertRepEqs(certRep.getSequenceNbr(), jsonObj.getJSONArray(EQU_LISTS));
return certRep;
......@@ -624,20 +631,20 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
* @return
*/
@Override
public Map<String, Object> getCertReplenishFormUrl(JSONObject jsonObject) {
// 生成申请编号
String applyNo = "";
ResponseModel<List<String>> listResponseModel = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.BZDJ.getCode(), 1);
if (!listResponseModel.getResult().isEmpty()) {
applyNo = listResponseModel.getResult().get(0);
public Map<String, Object> getCertReplenishFormUrl(JSONObject jsonObject, String applyNo) {
if (StringUtils.isEmpty(applyNo)) {
ResponseModel<List<String>> listResponseModel = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.BZDJ.getCode(), 1);
if (!listResponseModel.getResult().isEmpty()) {
applyNo = listResponseModel.getResult().get(0);
}
}
JSONObject formData = this.writeCertReplenishFormData(jsonObject.getJSONObject(FORM_DATA), applyNo);
JSONObject formData = this.writeCertReplenishFormData(jsonObject, applyNo);
String wordPath = "CertificateReplenish.ftl";
String fileName = "使用登记证补证申请表_";
File pdfFile = null;
try {
pdfFile = commonService.wordToPdf(fileName, wordPath, formData);
return MapBuilder.<String, Object>create().put("certReplenishFormUrl", commonService.uploadFile(pdfFile, "certificateReplenishFiles")).put("applyNo", applyNo).build();
return MapBuilder.<String, Object>create().put(APPLICATION_FORM_FILE_URL, commonService.uploadFile(pdfFile, "certificateReplenishFiles")).put("applyNo", applyNo).build();
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
......@@ -658,7 +665,8 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
*/
@Override
public void getCertReplenishFormStream(JSONObject jsonObject, HttpServletResponse response) {
JSONObject formData = this.writeCertReplenishFormData(jsonObject, "");
JSONObject jsonObj = jsonObject.getJSONObject(FORM_DATA);
JSONObject formData = this.writeCertReplenishFormData(jsonObj, jsonObj.getString(APPLY_NO));
String wordPath = "CertificateReplenish.ftl";
String fileName = "使用登记证补证申请表_";
File pdfFile;
......@@ -689,7 +697,7 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
result.put("useUnitName", jsonObject.getString("useUnitName"));
result.put("equUseAddress", jsonObject.getString("equUseAddress"));
result.put("applicationReason", jsonObject.getString("applicationReason"));
result.put("lossDamageTime", jsonObject.getString("lossDamageTime"));
result.put("lossDamageTime", jsonObject.getString("lossDamageTime").substring(0, 10));
result.put("safetyManagerName", jsonObject.getString("safetyManagerId").split("_")[1]);
result.put("safetyManagerPhone", jsonObject.getString("safetyManagerPhone"));
JSONArray equListsAfterAssembly = new JSONArray();
......@@ -824,6 +832,8 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
JSONObject jsonObject = commonService.queryHistoryData(sequenceNbr);
jsonObject.put(IS_COMPANY, isCompany);
jsonObject.put(APPLY_STATUS, FlowStatusEnum.TO_BE_FINISHED.getCode());
ATTACHMENT_FIELD.forEach(item -> jsonObject.put(item, JSONObject.parse(jsonObject.getString(item))));
jsonObject.put(APPLICATION_FORM_FILE_URL, certRep.getApplicationFormFileUrl());
return jsonObject;
} else {
ObjectMapper mapper = new ObjectMapper();
......@@ -834,6 +844,8 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
JSONObject jsonObject = commonService.queryHistoryData(sequenceNbr);
result.put(SAFETY_MANAGER_ID, jsonObject.get(SAFETY_MANAGER_ID));
result.put(IS_COMPANY, isCompany);
ATTACHMENT_FIELD.forEach(item -> result.put(item, JSONObject.parse(jsonObject.getString(item))));
result.put(APPLICATION_FORM_FILE_URL, certRep.getApplicationFormFileUrl());
return result;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment