diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/BasicdataVehicleDTO.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/BasicdataVehicleDTO.java index b44dc7833..43637802c 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/BasicdataVehicleDTO.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/BasicdataVehicleDTO.java @@ -32,7 +32,11 @@ import lombok.EqualsAndHashCode; public class BasicdataVehicleDTO extends BasicdataVehicleEntity { private static final long serialVersionUID = 1L; - @ApiModelProperty(value = "车辆所属") private String vehicleOwners; + /** + * 页面类型 0-全部 1-保险临期 2-保险到期 3-年审临期 4-年审到期 + */ + private Integer pageType; + } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataVehicleMapper.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataVehicleMapper.java index bfddef518..ee1dc329c 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataVehicleMapper.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataVehicleMapper.java @@ -70,4 +70,37 @@ public interface BasicdataVehicleMapper extends BaseMapper selectInsuranceDeadlineBasicdataVehiclePage(IPage page,@Param("param") BasicdataVehicleDTO basicdataVehicle); + + /** + * 保险到期 + * @param page + * @param basicdataVehicle + * @return + */ + IPage selectInsuranceExpireBasicdataVehiclePage(IPage page,@Param("param") BasicdataVehicleDTO basicdataVehicle); + + /** + * 年审临期 + * @param page + * @param basicdataVehicle + * @return + */ + IPage selectAnnualDeadlineBasicdataVehiclePage(IPage page,@Param("param") BasicdataVehicleDTO basicdataVehicle); + + /** + * 年审到期 + * @param page + * @param basicdataVehicle + * @return + */ + IPage selectAnnualExpireBasicdataVehiclePage(IPage page,@Param("param") BasicdataVehicleDTO basicdataVehicle); + } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataVehicleMapper.xml b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataVehicleMapper.xml index 1d2a62b95..81d8c2815 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataVehicleMapper.xml +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataVehicleMapper.xml @@ -331,6 +331,357 @@ lbv.id = #{id} AND is_deleted = 0 + + + + diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataVehicleServiceImpl.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataVehicleServiceImpl.java index 0607d55f8..6605a31a0 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataVehicleServiceImpl.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataVehicleServiceImpl.java @@ -42,6 +42,7 @@ import com.logpm.basicdata.vo.BasicdataCarrierVO; import com.logpm.basicdata.vo.BasicdataVehicleVO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springblade.common.exception.CustomerException; import org.springblade.common.utils.PhoneCheckUtil; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseServiceImpl; @@ -51,10 +52,7 @@ import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -75,14 +73,42 @@ public class BasicdataVehicleServiceImpl extends BaseServiceImpl selectBasicdataVehiclePage(IPage page, BasicdataVehicleDTO basicdataVehicle) { - return page.setRecords(baseMapper.selectBasicdataVehiclePage(page, basicdataVehicle)); + if (Objects.isNull(basicdataVehicle.getPageType())) { + throw new CustomerException("pageType参数缺失!!!"); + } + switch (basicdataVehicle.getPageType()) { + case 0: + //全部 + List basicdataVehicleVOS = baseMapper.selectBasicdataVehiclePage(page, basicdataVehicle); + return page.setRecords(basicdataVehicleVOS); + case 1: + //保险临期 + IPage insuranceDeadlineBasicdataVehicleVOS = baseMapper.selectInsuranceDeadlineBasicdataVehiclePage(page, basicdataVehicle); + return insuranceDeadlineBasicdataVehicleVOS; + case 2: + //保险到期 + IPage insuranceExpireBasicdataVehicleVOS = baseMapper.selectInsuranceExpireBasicdataVehiclePage(page, basicdataVehicle); + return insuranceExpireBasicdataVehicleVOS; + case 3: + //年审临期 + IPage annualDeadlineBasicdataVehicleVOS = baseMapper.selectAnnualDeadlineBasicdataVehiclePage(page, basicdataVehicle); + return annualDeadlineBasicdataVehicleVOS; + case 4: + //年审到期 + IPage expireDeadlineBasicdataVehicleVOS = baseMapper.selectAnnualExpireBasicdataVehiclePage(page, basicdataVehicle); + return expireDeadlineBasicdataVehicleVOS; + default: + log.error("未知的车辆类型>>>>>>>>>>>>>"); + return null; + } } @Override - public List exportBasicdataVehicle(String ids) { + public List exportBasicdataVehicle(String ids) { List basicdataVehicleList = baseMapper.exportBasicdataVehicle(ids.isEmpty() ? null : Func.toLongList(ids)); // List basicdataCarrierVOS = basicdataCarrierService.selectBasicdataCarrierDictionary(); @@ -106,7 +132,7 @@ public class BasicdataVehicleServiceImpl extends BaseServiceImpl selectBasicdataVehicleDictionary(String vehicleNub) { - if(StringUtil.isBlank(vehicleNub)){ + if (StringUtil.isBlank(vehicleNub)) { vehicleNub = null; } return baseMapper.selectBasicdataDictionary(vehicleNub); @@ -116,30 +142,30 @@ public class BasicdataVehicleServiceImpl extends BaseServiceImpl().lambda().eq(BasicdataDrivermiddleEntity::getBrandId, basicdataVehicle.getId())); - if (basicdataVehicle.getVehicleOwners().isEmpty()){ + if (basicdataVehicle.getVehicleOwners().isEmpty()) { return delete; } //新增现有的数据 - // if (delete>0){ - List bindOwners = Arrays.asList(basicdataVehicle.getVehicleOwners().split(",")); - ArrayList basicdataDrivermiddleEntities = new ArrayList<>(); - bindOwners.forEach(e->{ - BasicdataDrivermiddleEntity basicdataDrivermiddleEntity = new BasicdataDrivermiddleEntity(); - basicdataDrivermiddleEntity.setBrandId(basicdataVehicle.getId()); - basicdataDrivermiddleEntity.setDriverId(Long.valueOf(e)); - basicdataDrivermiddleEntities.add(basicdataDrivermiddleEntity); - }); - - basicdataDrivermiddleService.saveBatch(basicdataDrivermiddleEntities); - // } + // if (delete>0){ + List bindOwners = Arrays.asList(basicdataVehicle.getVehicleOwners().split(",")); + ArrayList basicdataDrivermiddleEntities = new ArrayList<>(); + bindOwners.forEach(e -> { + BasicdataDrivermiddleEntity basicdataDrivermiddleEntity = new BasicdataDrivermiddleEntity(); + basicdataDrivermiddleEntity.setBrandId(basicdataVehicle.getId()); + basicdataDrivermiddleEntity.setDriverId(Long.valueOf(e)); + basicdataDrivermiddleEntities.add(basicdataDrivermiddleEntity); + }); + + basicdataDrivermiddleService.saveBatch(basicdataDrivermiddleEntities); + // } return delete; } @Override public boolean saveVehicle(BasicdataVehicleDTO basicdataVehicle) { - if (Func.isNotEmpty(basicdataVehicle.getCarrierId())){ + if (Func.isNotEmpty(basicdataVehicle.getCarrierId())) { BasicdataCarrierEntity carrierEntity = basicdataCarrierService.getById(basicdataVehicle.getCarrierId()); - if (Func.isNotEmpty(carrierEntity)){ + if (Func.isNotEmpty(carrierEntity)) { basicdataVehicle.setCarrierName(carrierEntity.getCarrierName()); } @@ -152,7 +178,7 @@ public class BasicdataVehicleServiceImpl extends BaseServiceImpl list = this.list(); List basicdataVehicleVOS = new ArrayList<>(); - if(Func.isEmpty(list)){ + if (Func.isEmpty(list)) { return null; } // 查询所有的iD @@ -168,22 +194,22 @@ public class BasicdataVehicleServiceImpl extends BaseServiceImpl basicdataDriverArteryEntities1 = basicdataDriverArteryMapper.selectList(queryWrapper1); - if (Func.isNotEmpty(list)){ - list.forEach(l->{ + if (Func.isNotEmpty(list)) { + list.forEach(l -> { BasicdataVehicleVO vehicleVO = Func.copy(l, BasicdataVehicleVO.class); List basicdataDrivermiddleEntities = groupedEntities.get(vehicleVO.getId()); - if(Func.isNotEmpty(basicdataDrivermiddleEntities)){ + if (Func.isNotEmpty(basicdataDrivermiddleEntities)) { List driverIds = basicdataDrivermiddleEntities. stream().filter(f -> Func.isNotEmpty(f.getDriverId())).map(BasicdataDrivermiddleEntity::getDriverId).collect(Collectors.toList()); - if (Func.isNotEmpty(driverIds)){ + if (Func.isNotEmpty(driverIds)) { List basicdataDriverArteryEntities = new ArrayList(); for (Long driverId : driverIds) { - basicdataDriverArteryEntities1.forEach(e->{ - if (driverId.equals(e.getId())){ + basicdataDriverArteryEntities1.forEach(e -> { + if (driverId.equals(e.getId())) { basicdataDriverArteryEntities.add(e); } }); @@ -210,56 +236,56 @@ public class BasicdataVehicleServiceImpl extends BaseServiceImpl data) { String method = "#############BasicdataVehicleServiceImpl.importDriverArtery"; - log.info("车辆模板导入信息>>>>{}",data); + log.info("车辆模板导入信息>>>>{}", data); try { - ListdrivermiddleEntities = new ArrayList<>(); + List drivermiddleEntities = new ArrayList<>(); //对导入数据进行处理 for (BasicdataVehicleImportExcel datum : data) { BasicdataDrivermiddleEntity basicdataDrivermiddleEntity = null; BasicdataVehicleEntity entity = this.getOne(Wrappers.query().lambda().eq(BasicdataVehicleEntity::getVehicleNub, datum.getVehicleNub())); - if (Func.isNotEmpty(entity)){ + if (Func.isNotEmpty(entity)) { continue; } //查询模板信息是否合法 //车牌号是否合法 - if (Func.isEmpty(datum.getVehicleNub())){ + if (Func.isEmpty(datum.getVehicleNub())) { //车牌号为空 throw new ServiceException("请填写车牌号!"); } //查看是否填写了电话号码,如果填写了电话号码进行校验号码是否有效 - if (Func.isNotEmpty(datum.getVehicleUnitPhone())){ + if (Func.isNotEmpty(datum.getVehicleUnitPhone())) { //车辆所属单位电话校验 boolean a = PhoneCheckUtil.checkPhone(datum.getVehicleUnitPhone()); - if (a){ + if (a) { throw new ServiceException("请填写正确手机号码!"); - } + } } - if (Func.isNotEmpty(datum.getVehicleOwnerPhone())){ + if (Func.isNotEmpty(datum.getVehicleOwnerPhone())) { //车辆所属人电话校验 - boolean b = PhoneCheckUtil.checkPhone(datum.getVehicleOwnerPhone()); - if (b){ + boolean b = PhoneCheckUtil.checkPhone(datum.getVehicleOwnerPhone()); + if (b) { throw new ServiceException("请填写正确手机号码!"); } - //进行关系司机绑定 + //进行关系司机绑定 //查询是否存在司机 - if (!StringUtil.isBlank(datum.getVehicleOwner())){ - BasicdataDriverArteryEntity driverArteryEntity = basicdataDriverArteryMapper.findDriverListByPhone(datum.getVehicleOwner().trim(),datum.getVehicleOwnerPhone().trim()); + if (!StringUtil.isBlank(datum.getVehicleOwner())) { + BasicdataDriverArteryEntity driverArteryEntity = basicdataDriverArteryMapper.findDriverListByPhone(datum.getVehicleOwner().trim(), datum.getVehicleOwnerPhone().trim()); if (BeanUtil.isEmpty(driverArteryEntity)) { - log.info(method+ "查询到司机信息,进行绑定!>>>:{}",driverArteryEntity.getName()); - log.info(method+ "查询到司机信息,进行绑定!>>>:{}",driverArteryEntity.getPhone()); + log.info(method + "查询到司机信息,进行绑定!>>>:{}", driverArteryEntity.getName()); + log.info(method + "查询到司机信息,进行绑定!>>>:{}", driverArteryEntity.getPhone()); //绑定用户 basicdataDrivermiddleEntity = new BasicdataDrivermiddleEntity(); basicdataDrivermiddleEntity.setDriverId(driverArteryEntity.getId()); - } + } } } - if (Func.isNotEmpty(datum.getCarrierName())){ + if (Func.isNotEmpty(datum.getCarrierName())) { //存在承运商,进行承运商的校验 //找到数据库内的承运商 List basicdataCarrierEntities = basicdataCarrierService.list(Wrappers.lambdaQuery().eq(BasicdataCarrierEntity::getCarrierName, datum.getCarrierName())); @@ -279,16 +305,16 @@ public class BasicdataVehicleServiceImpl extends BaseServiceImpl