Commit 3ffac992 authored by 韩桐桐's avatar 韩桐桐

fix(jg):新增设备,历史设备,历史设备登记限制原三环系统数据登记上来

parent 9a716017
......@@ -4,16 +4,21 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.ShCarDto;
import com.yeejoin.amos.boot.module.jg.api.entity.ShCar;
import com.yeejoin.amos.boot.module.jg.api.entity.ShCarEqu;
import com.yeejoin.amos.boot.module.jg.api.service.IShCarService;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.ShCarEquServiceImpl;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.ShCarServiceImpl;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
......@@ -21,6 +26,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import java.util.List;
import java.util.Optional;
/**
*
......@@ -35,6 +41,9 @@ public class ShCarController extends BaseController {
@Autowired
ShCarServiceImpl shCarServiceImpl;
@Resource
ShCarEquServiceImpl shCarEquServiceImpl;
@Autowired
IShCarService iShCarService;
/**
......@@ -139,7 +148,34 @@ public class ShCarController extends BaseController {
@ApiOperation(httpMethod = "GET",value = "数据查询,校验是否是三环系统数据", notes = "数据查询,校验是否是三环系统数据")
@GetMapping(value = "/searchForSanHan")
public ResponseModel<ShCar> searchForSanHan(@RequestParam(value = "sanHuanInputValue") String sanHuanInputValue) {
return ResponseHelper.buildResponse(shCarServiceImpl.getBaseMapper().selectOne(new LambdaQueryWrapper<ShCar>()
.eq(ShCar::getSequenceNbr,"DJ1309111615548356CAE8B77CBA2")));
// sanHuanInputValue 可能是 使用登记证号,车牌号,车辆VIN码(车架号) 和 设备代码
ShCar shCar = shCarServiceImpl.getBaseMapper()
.selectList(new LambdaQueryWrapper<ShCar>()
.eq(ShCar::getClaimedFlag, Boolean.FALSE)
.and(w -> w
.eq(ShCar::getCarNumber, sanHuanInputValue)
.or()
.eq(ShCar::getUseRegistrationCode, sanHuanInputValue)
.or()
.eq(ShCar::getFrameNumber, sanHuanInputValue)
)
).stream().findFirst().orElse(new ShCar());
if (!ValidationUtil.isEmpty(shCar.getSequenceNbr())) {
return ResponseHelper.buildResponse(shCar);
}
Optional<ShCarEqu> carEqu = shCarEquServiceImpl.getBaseMapper()
.selectList(new LambdaQueryWrapper<ShCarEqu>()
.eq(ShCarEqu::getEquCode, sanHuanInputValue))
.stream().findFirst();
shCar = carEqu.map(equ -> shCarServiceImpl.getBaseMapper()
.selectList(new LambdaQueryWrapper<ShCar>()
.eq(ShCar::getClaimedFlag, Boolean.FALSE)
.eq(ShCar::getSequenceNbr, equ.getCarId())
).stream().findFirst().orElse(new ShCar()))
.orElse(shCar);
return ResponseHelper.buildResponse(shCar);
}
}
......@@ -283,6 +283,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
private TzBaseEnterpriseInfoMapper baseEnterpriseInfoMapper;
@Autowired
private TzsUserInfoMapper tzsUserInfoMapper;
@Autowired
private ShCarEquServiceImpl shCarEquService;
@Autowired
private ShCarServiceImpl shCarService;
/**
* 将对象的属性由驼峰转为纯大写下划线格式
......@@ -394,6 +398,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
check96333Code(equipmentInfoForm);
// 气瓶 校验制造单位统一信用代码与出场编码唯一
checkFactoryNumUniqueWithGasCylinder(equipmentInfoForm, record);
// 检测是否三环系统中的车用气瓶数据 不让三环系统数据通过设备新增方式进来
checkIsSanHanData(equipmentInfoForm);
} catch (Exception e) {
handleError(e, null);
}
......@@ -442,6 +448,39 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
}
/**
* 检测是否三环系统中的车用气瓶数据 不让三环系统数据通过设备新增方式进来
* @param equipmentInfoForm 入参
*/
private void checkIsSanHanData(LinkedHashMap<?, ?> equipmentInfoForm) {
// 是否车用气瓶
if ("2000".equals(equipmentInfoForm.get(EQU_LIST)) && "2300".equals(equipmentInfoForm.get(EQU_CATEGORY))
&& "23T0".equals(equipmentInfoForm.get(EQU_DEFINE))
&& "1".equals(equipmentInfoForm.get(WHETHER_VEHICLE_CYLINDER))) {
String carNum = (String) equipmentInfoForm.get("USE_INNER_CODE");
String equCode = (String) equipmentInfoForm.get("EQU_CODE");
// 判断 设备代码EQU_CODE 和 单位内编号(车牌号)USE_INNER_CODE
Integer carCount = shCarService.getBaseMapper()
.selectCount(new LambdaQueryWrapper<ShCar>()
.eq(ShCar::getCarNumber, carNum)
.eq(ShCar::getClaimedFlag, Boolean.FALSE));
Integer equCount = shCarEquService.getBaseMapper()
.selectList(new LambdaQueryWrapper<ShCarEqu>()
.eq(ShCarEqu::getEquCode, equCode))
.stream()
.findFirst()
.map(equ -> shCarService.getBaseMapper().selectList(new LambdaQueryWrapper<ShCar>()
.eq(ShCar::getSequenceNbr, equ.getCarId())
.eq(ShCar::getClaimedFlag, Boolean.FALSE))
.size()
).orElse(0);
if (carCount > 0 || equCount > 0) {
throw new BadRequest("原三环系统数据,请直接认领!");
}
}
}
private void check96333Code(LinkedHashMap equipmentInfoForm) {
if (!ObjectUtils.isEmpty(equipmentInfoForm.get(CODE96333))) {
// 根据96333码检查唯一性
......
......@@ -168,6 +168,8 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
private WorkFlowFeignService workFlowFeignService;
@Autowired
private JgUseRegistrationManageMapper jgUseRegistrationManageMapper;
@Autowired
private ShCarServiceImpl shCarServiceImpl;
private Map<String, Object> fillingMediumMap;
......@@ -1756,6 +1758,8 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
if (used){
throw new BadRequest("使用登记证编号已存在!");
}
// 检测是否三环系统中的车用气瓶数据 不让三环系统数据通过设备新增方式进来
this.checkIsSanSystemHanData(map);
//使用登记证编号判断是否使用未来系统生成编号
idxBizJgRegisterInfoService.checkUseRegistrationCode(useRegistrationCode1,"vehicle");
......@@ -1996,6 +2000,32 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
}
/**
* 检测是否三环系统中的车用气瓶数据 不让三环系统数据通过设备新增方式进来
* @param map 入参
*/
private void checkIsSanSystemHanData(JSONObject map) {
// 使用登记证号,车牌号,车辆VIN码(车架号)
String useRegistrationCode = (String) map.get("useRegistrationCode");
String carNumber = (String) map.get("carNumber");
String identificationCode = (String) map.get("identificationCode");
ShCar shCar = shCarServiceImpl.getBaseMapper()
.selectList(new LambdaQueryWrapper<ShCar>()
.eq(ShCar::getClaimedFlag, Boolean.FALSE)
.and(w -> w
.eq(ShCar::getCarNumber, carNumber)
.or()
.eq(ShCar::getUseRegistrationCode, useRegistrationCode)
.or()
.eq(ShCar::getFrameNumber, identificationCode)
)
).stream().findFirst().orElse(new ShCar());
if (!ValidationUtil.isEmpty(shCar.getSequenceNbr())) {
throw new BadRequest("原三环系统数据,请直接认领!");
}
}
/**
* 车用气瓶保存历史数据
*
* @param map map
......
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