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

补证登记相关

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