Commit 4bff8076 authored by 韩桐桐's avatar 韩桐桐

fix(jg):使用登记,使用地点丢失问题

parent 460c787f
......@@ -64,14 +64,7 @@ import java.util.*;
@Service
public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationDto, JgUseRegistration, JgUseRegistrationMapper> implements IJgUseRegistrationService {
@Autowired
private IdxBizJgUseInfoMapper useInfoMapper;
@Autowired
private InspectionDetectionInfoMapper inspectionDetectionInfoMapper;
@Autowired
private IdxBizJgOtherInfoMapper otherInfoMapper;
@Autowired
private JgUseRegistrationEqMapper jgRelationEquipMapper;
private static final String DEFINITION_KEY = "useRegistration";
@Autowired
WorkFlowFeignService workFlowFeginService;
@Autowired
......@@ -83,12 +76,6 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
@Autowired
IdxBizJgRegisterInfoMapper idxBizJgRegisterInfoMapper;
@Autowired
private IdxBizJgRegisterInfoServiceImpl idxBizJgRegisterInfoService;
@Autowired
private IdxBizJgUseInfoServiceImpl idxBizJgUseInfoService;
@Autowired
private IdxBizJgFactoryInfoServiceImpl idxBizJgFactoryInfoService;
@Autowired
ICommonService commonService;
@Autowired
CommonServiceImpl commonServiceImpl;
......@@ -98,8 +85,20 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
IdxBizJgSupervisionInfoMapper idxBizJgSupervisionInfoMapper;
@Autowired
DataDictionaryServiceImpl iDataDictionaryService;
private static final String DEFINITION_KEY = "useRegistration";
@Autowired
private IdxBizJgUseInfoMapper useInfoMapper;
@Autowired
private InspectionDetectionInfoMapper inspectionDetectionInfoMapper;
@Autowired
private IdxBizJgOtherInfoMapper otherInfoMapper;
@Autowired
private JgUseRegistrationEqMapper jgRelationEquipMapper;
@Autowired
private IdxBizJgRegisterInfoServiceImpl idxBizJgRegisterInfoService;
@Autowired
private IdxBizJgUseInfoServiceImpl idxBizJgUseInfoService;
@Autowired
private IdxBizJgFactoryInfoServiceImpl idxBizJgFactoryInfoService;
public Page<Map<String, Object>> getList(JgUseRegistrationDto dto, Page<Map<String, Object>> page, List<String> roleIds) {
Page<Map<String, Object>> listPage = this.baseMapper.getListPage(page, dto, roleIds);
......@@ -110,7 +109,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
return this.baseMapper.getEquipListPage(page, factoryNum, equList, equCategory);
}
public void updateEquipMessage(String currentDocumentId, JgUseRegistration jgUseRegistration,JSONObject map,IdxBizJgRegisterInfo registerInfo,IdxBizJgOtherInfo otherInfo) {
public void updateEquipMessage(String currentDocumentId, JgUseRegistration jgUseRegistration, JSONObject map, IdxBizJgRegisterInfo registerInfo, IdxBizJgOtherInfo otherInfo) {
String useOrgCode = jgUseRegistration.getUseRegistrationCode();
// 市
List<LinkedHashMap> city = (List<LinkedHashMap>) redisUtils.get("CITY");
......@@ -129,7 +128,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
IdxBizJgUseInfo useInfo = new IdxBizJgUseInfo();
BeanUtil.copyProperties(map, useInfo);
if(map.containsKey("isXixian")){
if (map.containsKey("isXixian")) {
useInfo.setIsNotXiXian(map.get("isXixian").toString());
}
// 城市
......@@ -179,7 +178,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
inspectionDetectionInfoMapper.update(inspectionDetectionInfo, inspectionLambda);
// 更新注册登记信息表
LambdaQueryWrapper<JgUseRegistrationEq> jgUseRegEqWrapper = new QueryWrapper<JgUseRegistrationEq>().lambda();
jgUseRegEqWrapper.eq(JgUseRegistrationEq::getEquipTransferId,currentDocumentId);
jgUseRegEqWrapper.eq(JgUseRegistrationEq::getEquipTransferId, currentDocumentId);
jgUseRegEqWrapper.eq(JgUseRegistrationEq::getIsDelete, false);
JgUseRegistrationEq jgUseRegistrationEq = jgRelationEquipMapper.selectOne(jgUseRegEqWrapper);
LambdaUpdateWrapper<IdxBizJgRegisterInfo> IdxBizJgRegLambda = new UpdateWrapper<IdxBizJgRegisterInfo>().lambda();
......@@ -200,11 +199,12 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 更新设备使用登记证
idxBizJgRegisterInfoMapper.updateUseOrgCodeByEquip(String.valueOf(map.get("equipId")), useOrgCode);
// 生成监管码、96333码
createCode( map, jgUseRegistration, registerInfo, useInfo, otherInfo);
createCode(map, jgUseRegistration, registerInfo, useInfo, otherInfo);
}
/**
* 递归属地监管部门树匹配监管部门
*
* @param tree 监管树
* @param orgBranchCode 监管部门companyCode
* @return 监管部门orgCode
......@@ -229,9 +229,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
/**
* 获取类型为ZC的“已注册”的字典值
*
* @return code
*/
private String getRegCode(){
private String getRegCode() {
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", "ZC");
queryWrapper.eq("name", "已注册");
......@@ -291,7 +292,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 安全管理员
if (map.containsKey("safetyManager")) {
String[] data = String.valueOf(map.getString("safetyManager")).split("_");
map.put("safetyManagerId",data[0]);
map.put("safetyManagerId", data[0]);
map.put("safetyManagerName", data[1]);
}
// 使用单位提交
......@@ -509,25 +510,25 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
LambdaQueryWrapper<IdxBizJgOtherInfo> lambdaOth = new QueryWrapper<IdxBizJgOtherInfo>().lambda();
lambdaOth.eq(IdxBizJgOtherInfo::getRecord, String.valueOf(mapData.get("equipId")));
IdxBizJgOtherInfo otherInfo = otherInfoMapper.selectOne(lambdaOth);
// 使用信息
LambdaQueryWrapper<IdxBizJgUseInfo> lambda = new QueryWrapper<IdxBizJgUseInfo>().lambda();
lambda.eq(IdxBizJgUseInfo::getRecord, String.valueOf(mapData.get("equipId")));
IdxBizJgUseInfo useInfo = useInfoMapper.selectOne(lambda);
// 注册信息
LambdaQueryWrapper<IdxBizJgRegisterInfo> lambdaReg = new QueryWrapper<IdxBizJgRegisterInfo>().lambda();
lambdaReg.eq(IdxBizJgRegisterInfo::getRecord, String.valueOf(mapData.get("equipId")));
IdxBizJgRegisterInfo registerInfo = idxBizJgRegisterInfoMapper.selectOne(lambdaReg);
// 更新设备信息
updateEquipMessage(String.valueOf(sequenceNbr), jgUseRegistration,mapData, registerInfo, otherInfo);
updateEquipMessage(String.valueOf(sequenceNbr), jgUseRegistration, mapData, registerInfo, otherInfo);
// 生成使用登记证编号
if (!ObjectUtils.isEmpty(jgUseRegistration.getSupervisoryCode())) {
String code = commonServiceImpl.generateRegistrationCode(jgUseRegistration.getSupervisoryCode(), jgUseRegistration.getReceiveCompanyCode());
jgUseRegistration.setUseRegistrationCode(code);
jgUseRegistration.setAuditPassDate(new Date());
}
// 使用信息
LambdaQueryWrapper<IdxBizJgUseInfo> lambda = new QueryWrapper<IdxBizJgUseInfo>().lambda();
lambda.eq(IdxBizJgUseInfo::getRecord, String.valueOf(mapData.get("equipId")));
IdxBizJgUseInfo useInfo = useInfoMapper.selectOne(lambda);
String usePlace = useInfo.getProvinceName() + "/" + useInfo.getCityName() + "/" + useInfo.getCountyName() + useInfo.getStreetName();
// 更新es
updateEsData(useInfo.getProvinceName() + "/" + useInfo.getCityName() + "/" + useInfo.getCountyName() + useInfo.getStreetName(),
mapData,otherInfo,jgUseRegistration);
updateEsData(usePlace, mapData, otherInfo, jgUseRegistration);
// 更新代办状态
HashMap<String, Object> params = new HashMap<>();
params.put("relationId", jgUseRegistration.getInstanceId());
......@@ -546,7 +547,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
public void updateEsData(String usePlace,JSONObject dataMap,IdxBizJgOtherInfo otherInfo,JgUseRegistration jgUseRegistration){
public void updateEsData(String usePlace, JSONObject dataMap, IdxBizJgOtherInfo otherInfo, JgUseRegistration jgUseRegistration) {
// 属地监管部门拆分
String orgBranch = (String) dataMap.getOrDefault("orgBranchCode", "_");
String[] split = orgBranch.split("_");
......@@ -607,7 +608,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
public void flowExecute(Long id, String instanceId, String operate, String comment) {
JgUseRegistration jgUseRegistration = this.getBaseMapper().selectById(id);
//组装信息
// 组装信息
TaskResultDTO dto = new TaskResultDTO();
dto.setResultCode("approvalStatus");
dto.setTaskId(jgUseRegistration.getNextTaskId());
......@@ -695,7 +696,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
JgUseRegistration jgUseRegistration = this.getBaseMapper().selectById(sequenceNbr);
LambdaQueryWrapper<JgRegistrationHistory> lambda = new QueryWrapper<JgRegistrationHistory>().lambda();
lambda.eq(JgRegistrationHistory::getCurrentDocumentId, sequenceNbr);
//lambda.eq(JgRegistrationHistory::getEquId, id);
// lambda.eq(JgRegistrationHistory::getEquId, id);
JgRegistrationHistory jgRegistrationHistory = jgRegistrationHistoryService.getBaseMapper().selectOne(lambda);
JSONObject jsonObject = JSONObject.parseObject(jgRegistrationHistory.getChangeData());
jsonObject.put("receiveOrgCode", jgUseRegistration.getReceiveCompanyCode() + "_" + jgUseRegistration.getReceiveOrgName());
......@@ -750,7 +751,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
public void exportUseRegistrationCertificate(String sequenceNbr, HttpServletResponse response, String printType) {
Map<String, Object> exportParamsMap = new HashMap<>();
//查询使用登记详情
// 查询使用登记详情
JgUseRegistration useRegistration = this.getById(sequenceNbr);
LambdaQueryWrapper<JgUseRegistrationEq> useEqLambda = new QueryWrapper<JgUseRegistrationEq>().lambda();
useEqLambda.eq(JgUseRegistrationEq::getEquipTransferId, sequenceNbr);
......@@ -759,39 +760,39 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if (ValidationUtil.isEmpty(useRegistration) || ValidationUtil.isEmpty(useRegistrationEq)) {
throw new BadRequest("使用登记证导出失败,请稍后重试!");
}
//登记机关
// 登记机关
if (ValidationUtil.isEmpty(useRegistration.getReceiveOrgName())) {
throw new BadRequest("使用登记证导出失败,登记机关为空!");
}
exportParamsMap.put("receiveOrgName", useRegistration.getReceiveOrgName());
//使用登记证编号
// 使用登记证编号
if (ValidationUtil.isEmpty(useRegistration.getUseRegistrationCode())) {
throw new BadRequest("使用登记证导出失败,使用登记证编号为空!");
}
exportParamsMap.put("useRegistrationCode", useRegistration.getUseRegistrationCode());
//使用单位名称
// 使用单位名称
if (ValidationUtil.isEmpty(useRegistration.getUseUnitName())) {
throw new BadRequest("使用登记证导出失败,使用单位名称为空!");
}
exportParamsMap.put("useUnitName", useRegistration.getUseUnitName());
//监管码
// 监管码
if (ValidationUtil.isEmpty(useRegistration.getSupervisoryCode())) {
throw new BadRequest("使用登记证导出失败,监管码为空!");
}
exportParamsMap.put("supervisoryCode", useRegistration.getSupervisoryCode());
//发证日期(当前时间)
// 发证日期(当前时间)
LocalDate today = LocalDate.now();
exportParamsMap.put("giveOutYear", today.getYear());
exportParamsMap.put("giveOutMonth", today.getMonthValue());
exportParamsMap.put("giveOutDay", today.getDayOfMonth());
//查询设备注册信息
// 查询设备注册信息
IdxBizJgRegisterInfo registerInfo = idxBizJgRegisterInfoService.getOne(new QueryWrapper<IdxBizJgRegisterInfo>().eq("RECORD", useRegistrationEq.getEquId()));
if (!ValidationUtil.isEmpty(registerInfo)) {
//设备种类、类别、品种
String equList = registerInfo.getEquList();//设备种类
String equCategory = registerInfo.getEquCategory();//设备类别
String equDefine = registerInfo.getEquDefine();//设备品种
// 设备种类、类别、品种
String equList = registerInfo.getEquList();// 设备种类
String equCategory = registerInfo.getEquCategory();// 设备类别
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);
......@@ -813,7 +814,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
exportParamsMap.put("equDefine", categoryList2.get(0).getName());
}
//设备代码
// 设备代码
if (ValidationUtil.isEmpty(registerInfo.getEquCode())) {
throw new BadRequest("使用登记证导出失败,设备代码为空!");
}
......@@ -825,9 +826,9 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if (ValidationUtil.isEmpty(useInfo.getUseInnerCode())) {
throw new BadRequest("使用登记证导出失败,设备单位内部编码为空!");
}
//单位内部编码
// 单位内部编码
exportParamsMap.put("useInnerCode", useInfo.getUseInnerCode());
//设备使用地址
// 设备使用地址
String fullAddress = "";
if (!ObjectUtils.isEmpty(useInfo.getProvinceName())) {
fullAddress += useInfo.getProvinceName();
......@@ -850,7 +851,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
exportParamsMap.put("fullAddress", fullAddress);
}
IdxBizJgFactoryInfo factoryInfo = idxBizJgFactoryInfoService.getOneData(useRegistrationEq.getEquId());
//产品编号(出厂编号)
// 产品编号(出厂编号)
if (!ValidationUtil.isEmpty(factoryInfo)) {
if (ValidationUtil.isEmpty(factoryInfo.getFactoryNum())) {
throw new BadRequest("使用登记证导出失败,产品编号为空!");
......@@ -859,19 +860,18 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
exportParamsMap.put("applyNo", useRegistration.getApplyNo());
if ("0".equals(printType)) {
//调用生成使用登记证
// 调用生成使用登记证
commonService.generateCertificateReport(exportParamsMap, response);
}else{
//套打
} else {
// 套打
commonService.generatePdfPrint(exportParamsMap, response);
}
}
/**
* 生成监管码、96333码
*
*/
public void createCode(JSONObject dataMap,JgUseRegistration jgUseRegistration,IdxBizJgRegisterInfo registerInfo,IdxBizJgUseInfo useInfo,IdxBizJgOtherInfo otherInfo) {
public void createCode(JSONObject dataMap, JgUseRegistration jgUseRegistration, IdxBizJgRegisterInfo registerInfo, IdxBizJgUseInfo useInfo, IdxBizJgOtherInfo otherInfo) {
if (ObjectUtils.isEmpty(otherInfo.getSupervisoryCode())) {
// 生成监管码、96333码
Map<String, Object> map = new HashMap<>();
......
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