Commit 41a31617 authored by lisong's avatar lisong

使用登记添加监管码生成逻辑

parent 9ec5067d
package com.yeejoin.amos.boot.module.jg.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
......@@ -103,4 +104,6 @@ public class JgUseRegistrationDto extends BaseDto {
private String dataType ;
private String unitCode;
private String isXixian;
}
......@@ -183,4 +183,7 @@ public class JgUseRegistration extends BaseEntity {
@TableField(value = "next_execute_user_ids")
private String nextExecuteUserIds;
@TableField(value = "is_xixian")
private String isXixian;
}
......@@ -26,19 +26,10 @@ import com.yeejoin.amos.boot.module.jg.api.service.IJgUseRegistrationService;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService;
import com.yeejoin.amos.boot.module.jg.flc.api.fegin.WorkFlowFeignService;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgFactoryInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgRegisterInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.InspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.OtherInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.UseInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.InspectionDetectionInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.OtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.UseInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import com.yeejoin.amos.feign.workflow.Workflow;
......@@ -74,7 +65,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
@Autowired
private InspectionDetectionInfoMapper inspectionDetectionInfoMapper;
@Autowired
private OtherInfoMapper otherInfoMapper;
private IdxBizJgOtherInfoMapper otherInfoMapper;
@Autowired
private JgUseRegistrationEqMapper jgRelationEquipMapper;
@Autowired
......@@ -129,6 +120,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
inspectionDetectionInfoMapper.update(inspectionDetectionInfo, inspectionLambda);
// 更新设备使用登记证
idxBizJgRegisterInfoMapper.updateUseOrgCodeByEquip(String.valueOf(map.get("equipId")), useOrgCode);
// 更新es
createCode(String.valueOf(map.get("equipId")), map);
}
public void updateHistory(JSONObject map, String equipId, String currentDocumentId, String supervisoryCode) {
......@@ -159,9 +152,9 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 使用登记信息
JgUseRegistration jgUseRegistration = new JgUseRegistration();
jgUseRegistration.setRegDate(new Date());
LambdaQueryWrapper<OtherInfo> otherLambda = new QueryWrapper<OtherInfo>().lambda();
otherLambda.eq(OtherInfo::getRecord, map.get("equipId"));
OtherInfo otherInfo = otherInfoMapper.selectOne(otherLambda);
LambdaQueryWrapper<IdxBizJgOtherInfo> otherLambda = new QueryWrapper<IdxBizJgOtherInfo>().lambda();
otherLambda.eq(IdxBizJgOtherInfo::getRecord, map.get("equipId"));
IdxBizJgOtherInfo otherInfo = otherInfoMapper.selectOne(otherLambda);
String supervisoryCode = otherInfo.getSupervisoryCode();
jgUseRegistration.setSupervisoryCode(supervisoryCode);
jgUseRegistration.setUseUnitName(String.valueOf(map.get("useUnitName")));
......@@ -182,6 +175,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if (!ObjectUtils.isEmpty(map.get("inspectOrgName"))) {
jgUseRegistration.setInspectUnitName(map.get("inspectOrgName").toString());
}
// 是否西咸
if (!ObjectUtils.isEmpty(map.get("isXixian"))){
jgUseRegistration.setIsXixian(String.valueOf(map.get("isXixian")));
}
if (map.containsKey("type") && "edit".equals(String.valueOf(map.get("type")))) {
......@@ -648,4 +645,51 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
//调用生成使用登记证
commonService.generateCertificateReport(exportParamsMap, response);
}
/**
* 生成监管码、96333码
*
* @param record
*/
public void createCode(String record, JSONObject dataMap) {
// 其他信息
LambdaQueryWrapper<IdxBizJgOtherInfo> lambdaOth = new QueryWrapper<IdxBizJgOtherInfo>().lambda();
lambdaOth.eq(IdxBizJgOtherInfo::getRecord, record);
IdxBizJgOtherInfo otherInfo = otherInfoMapper.selectOne(lambdaOth);
if (ObjectUtils.isEmpty(otherInfo.getCode96333()) || ObjectUtils.isEmpty(otherInfo.getSupervisoryCode())) {
// 使用信息
LambdaQueryWrapper<UseInfo> lambda = new QueryWrapper<UseInfo>().lambda();
lambda.eq(UseInfo::getRecord, record);
UseInfo useInfo = useInfoMapper.selectOne(lambda);
// 注册信息
LambdaQueryWrapper<IdxBizJgRegisterInfo> lambdaReg = new QueryWrapper<IdxBizJgRegisterInfo>().lambda();
lambdaReg.eq(IdxBizJgRegisterInfo::getRecord, record);
IdxBizJgRegisterInfo registerInfo = idxBizJgRegisterInfoMapper.selectOne(lambdaReg);
// 生成监管码、96333码
Map<String, Object> map = new HashMap<>();
map.put("cityCode", useInfo.getCity());
map.put("countyCode", useInfo.getCounty());
map.put("equCategory", registerInfo.getEquCategory());
map.put("isXiXian", dataMap.get("isXixian"));
ResponseModel<Map<String, Object>> code = tzsServiceFeignClient.createCode(map);
Map<String, Object> result = code.getResult();
if (!ObjectUtils.isEmpty(result)) {
otherInfo.setSupervisoryCode(String.valueOf(result.get("superviseCode")));
otherInfo.setCode96333(ObjectUtils.isEmpty(result.get("code96333")) ? null : String.valueOf(result.get("code96333")));
otherInfo.setClaimStatus("已认领");
otherInfoMapper.updateById(otherInfo);
}
}
// 更新es
HashMap<String, Map<String, Object>> objMap = new HashMap<>();
HashMap<String, Object> param = new HashMap<>();
param.put("SUPERVISORY_CODE", otherInfo.getSupervisoryCode());
param.put("CODE96333", otherInfo.getCode96333());
param.put("USE_UNIT_CREDIT_CODE", dataMap.get("useUnitCreditCode"));
param.put("USE_UNIT_NAME", dataMap.get("useUnitName"));
param.put("CITY", dataMap.get("city"));
param.put("COUNTY", dataMap.get("county"));
objMap.put(record, param);
tzsServiceFeignClient.commonUpdateEsDataByIds(objMap);
}
}
\ No newline at end of file
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