Commit fa487e63 authored by 刘林's avatar 刘林

fix(JG):使用登记证添加气瓶类别

parent 12f6294c
......@@ -7,8 +7,19 @@ import lombok.Getter;
@AllArgsConstructor
public enum CylinderTypeEnum {
CYLINDER("瓶", "2300"),
SPECIAL_CYLINDER("特种气瓶", "23T0");
SEAMLESS_CYLINDER("无缝气瓶(车用)", "2310"),
WELDED_CYLINDER("焊接气瓶(车用)", "2320"),
SPECIAL_CYLINDER("特种气瓶(车用)", "23T0");
private final String name;
private final String code;
public static String of(String code) {
for (CylinderTypeEnum constants : values()) {
if (constants.getCode().equals(code)) {
return constants.getName();
}
}
return null;
}
}
......@@ -62,7 +62,8 @@ public class JgVehicleInformationController extends BaseController {
String.valueOf(map.get("instanceId")),
String.valueOf(map.get("operate")),
String.valueOf(map.get("comment")),
String.valueOf(map.get("nextTaskId")));
String.valueOf(map.get("nextTaskId")),
String.valueOf(map.get("EQU_DEFINE_CODE")));
return ResponseHelper.buildResponse("ok");
}
......
......@@ -928,14 +928,14 @@ public class CommonServiceImpl implements ICommonService {
JSONObject jsonObject = new JSONObject(provideMap);
return jgTransferNoticeService.saveNotice(submitType, jsonObject, reginParams);
} else if (type.equals(ApplicationFormTypeEnum.SYDJ.getBusinessCode())) {
String code = (String) basicObj.get("equDefineCode");
String code = (String) basicObj.get("businessScenarios");
noticeObj.put("receiveOrgCode", !ObjectUtils.isEmpty(basicObj.get("receiveOrgCreditCode")) ? String.valueOf(basicObj.get("receiveOrgCreditCode")) : String.valueOf(basicObj.get("receiveOrgCreditCode1")));
JSONObject jsonObject = new JSONObject(noticeObj);
if (submitType.equals("1")) {
jsonObject.put("submit", Boolean.TRUE);
}
//判断是否为车用气瓶使用登记或者设备使用登记
return code != null && code.equals("23T0") ? jgVehicleInformationService.save(submitType, jsonObject) : jgUseRegistrationServiceImpl.save(jsonObject);
return code != null && code.equals("1") ? jgVehicleInformationService.save(submitType, jsonObject) : jgUseRegistrationServiceImpl.save(jsonObject);
} else if (type.equals(ApplicationFormTypeEnum.GZBG.getBusinessCode())) {
// 兼容业务逻辑代码
if (submitType.equals("1")) {
......
......@@ -520,8 +520,11 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
CompanyBo company = reginParams.getCompany();
List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) map.get("equipmentLists");
if (CollectionUtils.isEmpty(equipmentLists)) {
throw new BadRequest("请先选择设备信息!");
if (org.springframework.util.CollectionUtils.isEmpty(equipmentLists) || equipmentLists.stream()
.map(v -> (String) v.get("EQU_DEFINE_CODE"))
.distinct()
.count() != 1) {
throw new BadRequest(CollectionUtils.isEmpty(equipmentLists) ? "请选择设备信息!" : "请选择相同设备种类!");
}
List<IdxBizJgInspectionDetectionInfo> inspectionDetectionInfoList = idxBizJgInspectionDetectionInfoService.checkInspectionInfo(
equipmentLists.stream()
......
......@@ -16,9 +16,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.*;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgVehicleInformationService;
......@@ -127,8 +125,11 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
JgVehicleInformationDto vehicleInfoDto = JSON.parseObject(JSON.toJSONString(map), JgVehicleInformationDto.class);
List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) map.get("equipmentLists");
if (CollectionUtils.isEmpty(equipmentLists)) {
throw new BadRequest("请选择设备");
if (CollectionUtils.isEmpty(equipmentLists) || equipmentLists.stream()
.map(v -> (String) v.get("EQU_DEFINE_CODE"))
.distinct()
.count() != 1) {
throw new BadRequest(CollectionUtils.isEmpty(equipmentLists) ? "请选择设备信息!" : "请选择相同设备种类!");
}
CompanyBo company = reginParams.getCompany();
......@@ -236,11 +237,11 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
List<WorkflowResultDto> workflowResultDtoList = commonService.buildWorkFlowInfo(processTasks);
if (!ObjectUtils.isEmpty(workflowResultDtoList) && !ObjectUtils.isEmpty(workflowResultDtoList.get(0))) {
WorkflowResultDto workflowResultDto = workflowResultDtoList.get(0);
this.updateData(vehicleInformation.getSequenceNbr(), "0", workflowResultDto, Boolean.TRUE);
this.updateData(vehicleInformation.getSequenceNbr(), "0", workflowResultDto, Boolean.TRUE, String.valueOf(map.get("EQU_DEFINE_CODE")));
}
} else {
// 执行流程
flowExecute(vehicleInformation.getSequenceNbr(), vehicleInformation.getInstanceId(), "0", "", String.valueOf(map.get("nextTaskId")));
flowExecute(vehicleInformation.getSequenceNbr(), vehicleInformation.getInstanceId(), "0", "", String.valueOf(map.get("nextTaskId")), String.valueOf(map.get("EQU_DEFINE_CODE")));
}
} else {
ArrayList<TaskModelDto> list = new ArrayList<>();
......@@ -399,7 +400,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
* @param comment 意见
* @param nextTaskId nextTaskId
*/
public void flowExecute(Long sequenceNbr, String instanceId, String operate, String comment, String nextTaskId) {
public void flowExecute(Long sequenceNbr, String instanceId, String operate, String comment, String nextTaskId, String equDefineCode) {
String lockKey = CommonServiceImpl.buildJgExecuteLockKey(instanceId);
RLock lock = redissonClient.getLock(lockKey);
try {
......@@ -436,7 +437,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
List<WorkflowResultDto> resultDto = commonService.buildWorkFlowInfo(processTaskDTOS);
if (!ObjectUtils.isEmpty(resultDto) && !ObjectUtils.isEmpty(resultDto.get(0))) {
WorkflowResultDto workflowResultDto = resultDto.get(0);
this.updateData(jgVehicleInformation.getSequenceNbr(), operate, workflowResultDto, Boolean.FALSE);
this.updateData(jgVehicleInformation.getSequenceNbr(), operate, workflowResultDto, Boolean.FALSE, equDefineCode);
}
} catch (InterruptedException e) {
e.printStackTrace();
......@@ -455,7 +456,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
* @param workflowResultDto workflowResultDto
* @param isFirst isFirst
*/
public void updateData(Long sequenceNbr, String operate, WorkflowResultDto workflowResultDto, Boolean isFirst) {
public void updateData(Long sequenceNbr, String operate, WorkflowResultDto workflowResultDto, Boolean isFirst, String equDefineCode) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())) + "", ReginParams.class);
String role = workflowResultDto.getNextExecutorRoleIds();
String taskCode = FlowStatusEnum.TO_BE_FINISHED.getName();
......@@ -534,7 +535,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
CompanyModel receiveParentResult = Privilege.companyClient.seleteOne(receiveCompanyResult.getParentId()).getResult();
receiveCompanyCode = receiveParentResult.getCompanyCode();
}
String code = this.generateVehicleUseRegistrationCode(receiveCompanyCode);
String code = this.generateVehicleUseRegistrationCode(receiveCompanyCode, equDefineCode);
jgVehicleInformation.setUseRegistrationCode(code);
jgVehicleInformation.setAuditPassDate(new Date());
......@@ -780,14 +781,13 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
* @param receiveCompanyCode 车辆属地
* @return String
*/
private String generateVehicleUseRegistrationCode(String receiveCompanyCode) {
StringBuilder useRegistration = new StringBuilder("瓶3T");
if (!ObjectUtils.isEmpty(receiveCompanyCode)) {
ResponseModel<String> stringResponseModel = tzsServiceFeignClient.useRegistrationCode(useRegistration.append(VehicleApanageEnum.of(receiveCompanyCode)) + "");
private String generateVehicleUseRegistrationCode(String receiveCompanyCode, String equDefineCode) {
// 构建设备种类简称
String useRegistration = String.format("瓶%s%s", equDefineCode.substring(1, 3), VehicleApanageEnum.of(receiveCompanyCode));
// 调用服务端获取注册码
ResponseModel<String> stringResponseModel = tzsServiceFeignClient.useRegistrationCode(useRegistration);
return stringResponseModel.getResult();
}
return null;
}
/**
* 打印车用气瓶登记证
......@@ -877,16 +877,13 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
String equDefine = registerInfo.getEquDefine();
List<EquipmentCategory> categoryList0 = commonService.getEquipmentCategoryList(equList, null);
List<EquipmentCategory> categoryList1 = commonService.getEquipmentCategoryList(equCategory, null);
List<EquipmentCategory> categoryList2 = commonService.getEquipmentCategoryList(equDefine, null);
if (notEmptyAndHasName(categoryList0)) {
exportParamsMap.put("equList", categoryList0.get(0).getName());
}
if (notEmptyAndHasName(categoryList1)) {
exportParamsMap.put("equCategory", categoryList1.get(0).getName());
}
if (notEmptyAndHasName(categoryList2)) {
exportParamsMap.put("equDefine", "特种气瓶(车用)");
}
exportParamsMap.put("equDefine", CylinderTypeEnum.of(equDefine));
if (registerInfoList.stream().anyMatch(r -> r.getEquCode() == null)) {
throw new BadRequest("使用登记证导出失败,设备代码为空!");
}
......
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