Commit 4be4070b authored by 刘林's avatar 刘林

fix(JG):车用气瓶-监管码功能开发

parent 7974d794
......@@ -14,28 +14,34 @@ public enum VehicleApanageEnum {
/**
* 属性机构枚举
*/
XIAN("陕A","XIAN"),
TONG_CHUAN("陕B","TONG_CHUAN"),
BAO_JI("陕C","BAO_JI"),
XIAN_YANG("陕D","XIAN_YANG"),
WEI_NAN("陕E","WEI_NAN"),
YAN_AN("陕J","YAN_AN"),
HAN_ZHONG("陕F","HAN_ZHONG"),
YU_LIN("陕K","YU_LIN"),
AN_KANG("陕G","AN_KANG"),
SHANG_LUO("陕H","SHANG_LUO"),
XI_XIAN("陕U","XI_XIAN"),
YANG_LING("陕V","YANG_LING"),
HAN_CHENG("陕Y","HAN_CHENG");
private final String code;
XIAN("陕A","610100"),
TONG_CHUAN("陕B","610200"),
BAO_JI("陕C","610300"),
XIAN_YANG("陕D","610400"),
WEI_NAN("陕E","610500"),
YAN_AN("陕J","610600"),
HAN_ZHONG("陕F","610700"),
YU_LIN("陕K","610800"),
AN_KANG("陕G","610900"),
SHANG_LUO("陕H","611000"),
XI_XIAN("陕U","617000"),
YANG_LING("陕V","610403"),
SHEN_MU("陕K","610881"),
FU_GU("陕K","610822"),
HAN_CHENG("陕Y","610581");
private final String city;
private final String code;
public static String of(String city){
/**
* 根据机构代码返回属地前缀
* @param code 属地代码
* @return 属地前缀
*/
public static String of(String code){
for(VehicleApanageEnum e : VehicleApanageEnum.values()){
if(e.getCity().equals(city)){
return e.getCode();
if(e.getCity().equals(code)){
return e.getCity();
}
}
return null;
......
......@@ -58,6 +58,7 @@ import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum.*;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationServiceImpl.getAuditPassedDate;
/**
......@@ -105,6 +106,8 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
private JgVehicleInformationEqServiceImpl jgVehicleInformationEqService;
@Autowired
private IdxBizJgFactoryInfoMapper idxBizJgFactoryInfoMapper;
@Autowired
private IdxBizJgOtherInfoMapper otherInfoMapper;
/**
* 新增(提交)车用气瓶
......@@ -637,8 +640,13 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
updateRegisterWrapper.set(IdxBizJgRegisterInfo::getRegisterState, this.getRegCode());
idxBizJgRegisterInfoService.update(updateRegisterWrapper);
// 查询其他信息
LambdaQueryWrapper<IdxBizJgOtherInfo> otherInfoWrapper = new QueryWrapper<IdxBizJgOtherInfo>().lambda();
otherInfoWrapper.eq(IdxBizJgOtherInfo::getRecord, String.valueOf(mapData.get("record")));
IdxBizJgOtherInfo otherInfo = otherInfoMapper.selectOne(otherInfoWrapper);
// 更新设备信息
this.updateEquipMessage(jgVehicleInformation, mapData);
this.updateEquipMessage(jgVehicleInformation, mapData, registerInfo, otherInfo);
// 使用信息
LambdaQueryWrapper<IdxBizJgUseInfo> lambdaUseInfo = new QueryWrapper<IdxBizJgUseInfo>().lambda();
......@@ -646,7 +654,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
IdxBizJgUseInfo useInfo = useInfoMapper.selectOne(lambdaUseInfo);
String usePlace = useInfo.getProvinceName() + "/" + useInfo.getCityName() + "/" + useInfo.getCountyName() + useInfo.getStreetName();
// 更新es
updateEsData(usePlace, mapData, jgVehicleInformation);
updateEsData(usePlace, mapData, jgVehicleInformation, otherInfo);
}
// 更新代办状态
......@@ -665,10 +673,11 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
this.getBaseMapper().updateById(jgVehicleInformation);
}
public void updateEsData(String usePlace, JSONObject dataMap, JgVehicleInformation jgVehicleInformation) {
public void updateEsData(String usePlace, JSONObject dataMap, JgVehicleInformation jgVehicleInformation, IdxBizJgOtherInfo otherInfo) {
// 更新es
HashMap<String, Map<String, Object>> objMap = new HashMap<>();
HashMap<String, Object> param = new HashMap<>();
param.put("SUPERVISORY_CODE", otherInfo.getSupervisoryCode());
param.put("USE_UNIT_CREDIT_CODE", dataMap.get("useUnitCreditCode"));
param.put("USE_UNIT_NAME", dataMap.get("useUnitName"));
param.put("ADDRESS", dataMap.getOrDefault("address", ""));
......@@ -733,16 +742,17 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
return this.baseMapper.getListPage(page, dto, roleIds);
}
public void updateEquipMessage(JgVehicleInformation jgVehicleInformation, JSONObject map) {
public void updateEquipMessage(JgVehicleInformation jgVehicleInformation, JSONObject map, IdxBizJgRegisterInfo registerInfo, IdxBizJgOtherInfo otherInfo) {
String useOrgCode = jgVehicleInformation.getUseRegistrationCode();
map.remove("status");
map.remove("instanceId");
map.remove("REC_DATE");
IdxBizJgUseInfo useInfo = new IdxBizJgUseInfo();
BeanUtil.copyProperties(map, useInfo);
if (map.containsKey("isXixian")) {
useInfo.setIsNotXiXian(map.get("isXixian") + "");
}
// 判断是否为西咸
String isXiXian = XI_XIAN.getCode().equals(jgVehicleInformation.getVehicleApanage()) ? "1" : "0";
jgVehicleInformation.setIsXixian(isXiXian);
useInfo.setIsNotXiXian(isXiXian);
useInfo.setProvince("610000");
useInfo.setProvinceName("陕西省");
LambdaQueryWrapper<IdxBizJgUseInfo> lambda = new QueryWrapper<IdxBizJgUseInfo>().lambda();
......@@ -778,6 +788,31 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
}
// 更新设备使用登记证
idxBizJgRegisterInfoMapper.updateUseOrgCodeByEquip(String.valueOf(map.get("record")), useOrgCode);
// 车用气瓶生成监管码
this.createCode(jgVehicleInformation, registerInfo, otherInfo);
}
/**
* 生成监管码
*/
public void createCode(JgVehicleInformation jgVehicleInformation, IdxBizJgRegisterInfo registerInfo, IdxBizJgOtherInfo otherInfo) {
// 创建参数映射
Map<String, Object> map = new HashMap<>();
map.put("cityCode", XI_XIAN.getCode().equals(jgVehicleInformation.getVehicleApanage()) ? XIAN_YANG.getCode() : jgVehicleInformation.getVehicleApanage());
map.put("isXiXian", jgVehicleInformation.getIsXixian());
map.put("equCategory", registerInfo.getEquCategory());
// 调用服务创建代码
ResponseModel<Map<String, Object>> code = tzsServiceFeignClient.createCode(map);
Map<String, Object> result = code.getResult();
// 更新其他信息
if (result != null && !result.isEmpty()) {
otherInfo.setSupervisoryCode(String.valueOf(result.get("superviseCode")));
otherInfo.setClaimStatus("已认领");
otherInfoMapper.updateById(otherInfo);
}
}
/**
......
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