|
|
@ -43,10 +43,10 @@ public class BusVehicleInformationHandoverService extends MybatisBaseService<Bus |
|
|
|
private BusVehicleInformationService busVehicleInformationService; |
|
|
|
@Autowired |
|
|
|
private BaseVehicleFeign baseVehicleFeign; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private BaseVehicleModelFeign baseVehicleModelFeign; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 新增或修改 |
|
|
|
* |
|
|
@ -61,39 +61,66 @@ public class BusVehicleInformationHandoverService extends MybatisBaseService<Bus |
|
|
|
BusVehicleInformationHandover entity = fetchBySid(sid); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
BusVehicleInformationDto informationDto = dto.getBusVehicleInformation(); |
|
|
|
if (null != informationDto) { |
|
|
|
BusVehicleInformation informationByHandoverSid = busVehicleInformationService.getByHandoverSid(sid); |
|
|
|
if (null != informationByHandoverSid) { |
|
|
|
BeanUtil.copyProperties(informationDto, informationByHandoverSid, "id", "sid"); |
|
|
|
informationByHandoverSid.setHandoverSid(sid); |
|
|
|
busVehicleInformationService.updateById(informationByHandoverSid); |
|
|
|
} else { |
|
|
|
if (null != informationDto.getManual() || |
|
|
|
null != informationDto.getVehicleKeyNum() || |
|
|
|
null != informationDto.getCertificate() || |
|
|
|
null != informationDto.getDirverCard() || |
|
|
|
null != informationDto.getApplyForm() || |
|
|
|
null != informationDto.getEnvironmentalList() || |
|
|
|
null != informationDto.getGasCertificate() |
|
|
|
) { |
|
|
|
BusVehicleInformation vehicleInformation = new BusVehicleInformation(); |
|
|
|
BeanUtil.copyProperties(informationDto, vehicleInformation, "id", "sid"); |
|
|
|
vehicleInformation.setHandoverSid(sid); |
|
|
|
vehicleInformation.setCreateBySid(dto.getCreateBySid()); |
|
|
|
busVehicleInformationService.insert(vehicleInformation); |
|
|
|
//判断是不是一次交接还是二次
|
|
|
|
List<BusVehicleInformation> informations = busVehicleInformationService.getByHandoverSid(sid); |
|
|
|
if (null != informations && !informations.isEmpty() && informations.size() < 2) { |
|
|
|
for (BusVehicleInformation information : informations) { |
|
|
|
BusVehicleInformation twiceInformation = new BusVehicleInformation(); |
|
|
|
if ("001".equals(information.getHandoverNum())) { |
|
|
|
BeanUtil.copyProperties(information, twiceInformation, "id", "sid"); |
|
|
|
if (null != informationDto.getRecTime()) { |
|
|
|
twiceInformation.setRecTime(informationDto.getRecTime()); |
|
|
|
} |
|
|
|
if (null != information.getVehicleKeyNum() && information.getVehicleKeyNum() != 0) { |
|
|
|
twiceInformation.setVehicleKeyNum(information.getVehicleKeyNum()); |
|
|
|
} |
|
|
|
if (information.getIsFuelVehicle() == 1) { |
|
|
|
twiceInformation.setGasCertificate(1); |
|
|
|
} else { |
|
|
|
twiceInformation.setGasCertificate(0); |
|
|
|
} |
|
|
|
twiceInformation.setCertificate(1); |
|
|
|
twiceInformation.setApplyForm(1); |
|
|
|
twiceInformation.setManual(1); |
|
|
|
twiceInformation.setEnvironmentalList(1); |
|
|
|
twiceInformation.setDirverCard(1); |
|
|
|
twiceInformation.setHandoverNum("002"); |
|
|
|
busVehicleInformationService.insert(twiceInformation); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (informations.size() != 2) { |
|
|
|
//一次交接
|
|
|
|
BusVehicleInformation newInformation = new BusVehicleInformation(); |
|
|
|
BeanUtil.copyProperties(informationDto, newInformation, "id", "sid"); |
|
|
|
newInformation.setHandoverNum("001"); |
|
|
|
newInformation.setRecName(dto.getRecName()); |
|
|
|
newInformation.setHandoverSid(sid); |
|
|
|
if (null != fetchBySid(sid).getIsFuelVehicle()) { |
|
|
|
newInformation.setIsFuelVehicle(fetchBySid(sid).getIsFuelVehicle()); |
|
|
|
} |
|
|
|
busVehicleInformationService.insert(newInformation); |
|
|
|
} |
|
|
|
BusVehicleInformation information = busVehicleInformationService.getByHandoverSid(sid); |
|
|
|
if (null != information) { |
|
|
|
List<BusVehicleInformation> informationList = busVehicleInformationService.getByHandoverSid(sid); |
|
|
|
if (null != informationList) { |
|
|
|
entity.setHandoverState(1); |
|
|
|
entity.setRecTime(new Date()); |
|
|
|
} |
|
|
|
baseMapper.updateById(entity); |
|
|
|
return rb.success().setData(sid); |
|
|
|
} else { |
|
|
|
BusVehicleInformationHandover entity = new BusVehicleInformationHandover(); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
if (StringUtils.isNotBlank(dto.getModelSid())) { |
|
|
|
BaseVehicleModel model = baseVehicleModelFeign.selectDetails(dto.getModelSid()).getData(); |
|
|
|
if (null != model) { |
|
|
|
if (StringUtils.isNotBlank(model.getFuelType())) { |
|
|
|
if ("004".equals(model.getFuelType()) || "04".equals(model.getFuelType())) { |
|
|
|
entity.setIsFuelVehicle(0); |
|
|
|
} else { |
|
|
|
entity.setIsFuelVehicle(1); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
baseMapper.insert(entity); |
|
|
|
return rb.success().setData(entity.getSid()); |
|
|
|
} |
|
|
@ -116,7 +143,11 @@ public class BusVehicleInformationHandoverService extends MybatisBaseService<Bus |
|
|
|
qw.and(wrapper -> wrapper.like("contractNo", query.getName()).or().like("vinNo", query.getName()).or().like("customerName", query.getName())); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getHandoverState())) { |
|
|
|
qw.eq("handoverState", query.getHandoverState()); |
|
|
|
if ("0".equals(query.getHandoverState())) { |
|
|
|
qw.eq("handoverState", 0); |
|
|
|
} else { |
|
|
|
qw.ne("handoverState", 0); |
|
|
|
} |
|
|
|
} |
|
|
|
qw.eq("useOrgSid", query.getUseOrgSid()); |
|
|
|
qw.eq("isDelete", 0); |
|
|
@ -136,90 +167,6 @@ public class BusVehicleInformationHandoverService extends MybatisBaseService<Bus |
|
|
|
QueryWrapper<BusVehicleInformationHandover> qw = createQueryWrapper(query); |
|
|
|
IPage<BusVehicleInformationHandover> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<BusVehicleInformationHandoverVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
|
List<BusVehicleInformationHandoverVo> records = pagging.getRecords(); |
|
|
|
if (null != records) { |
|
|
|
for (BusVehicleInformationHandoverVo vo : records) { |
|
|
|
if (null != vo) { |
|
|
|
if (StringUtils.isNotBlank(vo.getHandoverState())) { |
|
|
|
if ("待交接".equals(vo.getHandoverState())) { |
|
|
|
vo.setShowHandoverState(true); |
|
|
|
} else if ("已交接".equals(vo.getHandoverState())) { |
|
|
|
vo.setShowReplenish(false); |
|
|
|
} |
|
|
|
if ("已交接".equals(vo.getHandoverState())) { |
|
|
|
vo.setShowHandoverState(false); |
|
|
|
//得到sid 查询随车资料
|
|
|
|
BusVehicleInformation information = busVehicleInformationService.getByHandoverSid(vo.getSid()); |
|
|
|
if (null != information) { |
|
|
|
if (information.getCertificate() != null && |
|
|
|
information.getApplyForm() != null && |
|
|
|
information.getDirverCard() != null && |
|
|
|
information.getEnvironmentalList() != null && |
|
|
|
information.getManual() != null && |
|
|
|
information.getVehicleKeyNum() != null) { |
|
|
|
if (information.getCertificate() != 1 || |
|
|
|
information.getApplyForm() != 1 || |
|
|
|
information.getDirverCard() != 1 || |
|
|
|
information.getEnvironmentalList() != 1 || |
|
|
|
information.getManual() != 1 || |
|
|
|
information.getVehicleKeyNum() < 1) { |
|
|
|
vo.setShowReplenish(true); |
|
|
|
} else { |
|
|
|
if (null != information.getGasCertificate()) { |
|
|
|
if (information.getGasCertificate() != 1) { |
|
|
|
//判断是否为燃气车 通过车辆sid查询
|
|
|
|
if (StringUtils.isNotBlank(vo.getVehicleSid())) { |
|
|
|
String vehicleSid = vo.getVehicleSid(); |
|
|
|
BaseVehicleSelectVo vehicleVo = baseVehicleFeign.details(vehicleSid).getData(); |
|
|
|
if (null != vehicleVo) { |
|
|
|
if (StringUtils.isNotBlank(vehicleVo.getModelSid())) { |
|
|
|
BaseVehicleModel model = baseVehicleModelFeign.selectDetails(vehicleVo.getModelSid()).getData(); |
|
|
|
if (null != model) { |
|
|
|
if (StringUtils.isNotBlank(model.getFuelType())) { |
|
|
|
if ("04".equals(model.getFuelType())) { |
|
|
|
vo.setShowReplenish(false); |
|
|
|
} else if ("002".equals(model.getFuelType())) { |
|
|
|
vo.setShowReplenish(true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
vo.setShowReplenish(false); |
|
|
|
} |
|
|
|
} else { |
|
|
|
//判断是否为燃气车 通过车架号查询
|
|
|
|
if (StringUtils.isNotBlank(vo.getVehicleSid())) { |
|
|
|
String vehicleSid = vo.getVehicleSid(); |
|
|
|
BaseVehicleSelectVo vehicleVo = baseVehicleFeign.details(vehicleSid).getData(); |
|
|
|
if (null != vehicleVo) { |
|
|
|
if (StringUtils.isNotBlank(vehicleVo.getModelSid())) { |
|
|
|
BaseVehicleModel model = baseVehicleModelFeign.selectDetails(vehicleVo.getModelSid()).getData(); |
|
|
|
if (null != model) { |
|
|
|
if (StringUtils.isNotBlank(model.getFuelType())) { |
|
|
|
if ("04".equals(model.getFuelType())) { |
|
|
|
vo.setShowReplenish(false); |
|
|
|
} else if ("002".equals(model.getFuelType())) { |
|
|
|
vo.setShowReplenish(true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
vo.setShowReplenish(true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
PagerVo<BusVehicleInformationHandoverVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return rb.success().setData(p); |
|
|
|
} |
|
|
@ -236,32 +183,35 @@ public class BusVehicleInformationHandoverService extends MybatisBaseService<Bus |
|
|
|
BusVehicleInformationHandoverDetailsVo vo = new BusVehicleInformationHandoverDetailsVo(); |
|
|
|
BeanUtil.copyProperties(informationHandover, vo, "id", "sid"); |
|
|
|
vo.setSid(sid); |
|
|
|
BusVehicleInformation informationServiceByHandoverSid = busVehicleInformationService.getByHandoverSid(sid); |
|
|
|
if (null != informationServiceByHandoverSid) { |
|
|
|
BusVehicleInformationVo informationVo = new BusVehicleInformationVo(); |
|
|
|
BeanUtil.copyProperties(informationServiceByHandoverSid, informationVo, "id", "sid"); |
|
|
|
if (null == informationServiceByHandoverSid.getApplyForm()) { |
|
|
|
informationVo.setApplyForm(""); |
|
|
|
} |
|
|
|
if (null == informationServiceByHandoverSid.getCertificate()) { |
|
|
|
informationVo.setCertificate(""); |
|
|
|
} |
|
|
|
if (null == informationServiceByHandoverSid.getVehicleKeyNum()) { |
|
|
|
informationVo.setVehicleKeyNum(""); |
|
|
|
} |
|
|
|
if (null == informationServiceByHandoverSid.getManual()) { |
|
|
|
informationVo.setManual(""); |
|
|
|
} |
|
|
|
if (null == informationServiceByHandoverSid.getEnvironmentalList()) { |
|
|
|
informationVo.setEnvironmentalList(""); |
|
|
|
} |
|
|
|
if (null == informationServiceByHandoverSid.getDirverCard()) { |
|
|
|
informationVo.setDirverCard(""); |
|
|
|
} |
|
|
|
if (null == informationServiceByHandoverSid.getGasCertificate()) { |
|
|
|
informationVo.setGasCertificate(""); |
|
|
|
List<BusVehicleInformation> busVehicleInformations = busVehicleInformationService.getByHandoverSid(sid); |
|
|
|
|
|
|
|
if (null != busVehicleInformations) { |
|
|
|
for (BusVehicleInformation informationServiceByHandoverSid : busVehicleInformations) { |
|
|
|
BusVehicleInformationVo informationVo = new BusVehicleInformationVo(); |
|
|
|
BeanUtil.copyProperties(informationServiceByHandoverSid, informationVo, "id", "sid"); |
|
|
|
if (null == informationServiceByHandoverSid.getApplyForm()) { |
|
|
|
informationVo.setApplyForm(""); |
|
|
|
} |
|
|
|
if (null == informationServiceByHandoverSid.getCertificate()) { |
|
|
|
informationVo.setCertificate(""); |
|
|
|
} |
|
|
|
if (null == informationServiceByHandoverSid.getVehicleKeyNum()) { |
|
|
|
informationVo.setVehicleKeyNum(""); |
|
|
|
} |
|
|
|
if (null == informationServiceByHandoverSid.getManual()) { |
|
|
|
informationVo.setManual(""); |
|
|
|
} |
|
|
|
if (null == informationServiceByHandoverSid.getEnvironmentalList()) { |
|
|
|
informationVo.setEnvironmentalList(""); |
|
|
|
} |
|
|
|
if (null == informationServiceByHandoverSid.getDirverCard()) { |
|
|
|
informationVo.setDirverCard(""); |
|
|
|
} |
|
|
|
if (null == informationServiceByHandoverSid.getGasCertificate()) { |
|
|
|
informationVo.setGasCertificate(""); |
|
|
|
} |
|
|
|
vo.setBusVehicleInformation(informationVo); |
|
|
|
} |
|
|
|
vo.setBusVehicleInformation(informationVo); |
|
|
|
} else { |
|
|
|
BusVehicleInformationVo informationVo = new BusVehicleInformationVo(); |
|
|
|
informationVo.setApplyForm(""); |
|
|
@ -277,13 +227,13 @@ public class BusVehicleInformationHandoverService extends MybatisBaseService<Bus |
|
|
|
} |
|
|
|
|
|
|
|
public void delAllBySids(String[] sids) { |
|
|
|
for (String sid : sids) { |
|
|
|
deleteBySid(sid); |
|
|
|
BusVehicleInformation vehicleInformation = busVehicleInformationService.getByHandoverSid(sid); |
|
|
|
if (null != vehicleInformation) { |
|
|
|
busVehicleInformationService.deleteBySid(vehicleInformation.getSid()); |
|
|
|
} |
|
|
|
} |
|
|
|
// for (String sid : sids) {
|
|
|
|
// deleteBySid(sid);
|
|
|
|
// BusVehicleInformation vehicleInformation = busVehicleInformationService.getByHandoverSid(sid);
|
|
|
|
// if (null != vehicleInformation) {
|
|
|
|
// busVehicleInformationService.deleteBySid(vehicleInformation.getSid());
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -292,4 +242,46 @@ public class BusVehicleInformationHandoverService extends MybatisBaseService<Bus |
|
|
|
BusVehicleInformationHandover busVehicleInformationHandover = baseMapper.selectByVehicleSid(vehicleSid); |
|
|
|
return rb.success().setData(busVehicleInformationHandover); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 交车准备随车资料交接确认修改状态 |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean<String> updateHandoverState(BusVehicleInformationHandoverDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
BusVehicleInformationHandover entity = fetchBySid(dto.getSid()); |
|
|
|
List<BusVehicleInformation> informationList = busVehicleInformationService.getByHandoverSid(dto.getSid()); |
|
|
|
if (null != informationList) { |
|
|
|
for (BusVehicleInformation busVehicleInformation : informationList) { |
|
|
|
if ("001".equals(busVehicleInformation.getHandoverNum())) { |
|
|
|
if (busVehicleInformation.getVehicleKeyNum() < 1 |
|
|
|
|| busVehicleInformation.getCertificate() < 1 |
|
|
|
|| busVehicleInformation.getApplyForm() < 1 |
|
|
|
|| busVehicleInformation.getManual() < 1 |
|
|
|
|| busVehicleInformation.getEnvironmentalList() < 1 |
|
|
|
|| busVehicleInformation.getDirverCard() < 1 |
|
|
|
) { |
|
|
|
entity.setHandoverState(1); |
|
|
|
} else { |
|
|
|
if (busVehicleInformation.getGasCertificate() < 1) { |
|
|
|
if (busVehicleInformation.getIsFuelVehicle() == 0) { |
|
|
|
entity.setHandoverState(2); |
|
|
|
} else { |
|
|
|
entity.setHandoverState(1); |
|
|
|
} |
|
|
|
} else { |
|
|
|
entity.setHandoverState(2); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if ("002".equals(busVehicleInformation.getHandoverNum())) { |
|
|
|
entity.setHandoverState(2); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
baseMapper.updateById(entity); |
|
|
|
return rb.success().setData(dto.getSid()); |
|
|
|
} |
|
|
|
} |
|
|
|