Browse Source

车辆页面增加保险临期、保险到期、年审临期、年审到期

visual
汤建军 3 months ago
parent
commit
07f786015c
  1. 6
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/BasicdataVehicleDTO.java
  2. 33
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataVehicleMapper.java
  3. 351
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataVehicleMapper.xml
  4. 128
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataVehicleServiceImpl.java

6
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;
}

33
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataVehicleMapper.java

@ -70,4 +70,37 @@ public interface BasicdataVehicleMapper extends BaseMapper<BasicdataVehicleEntit
* @return
*/
BasicdataVehicleVO getVehicleDetail(@Param("id")Long id);
/**
* 保险临期车辆
* @param page
* @param basicdataVehicle
* @return
*/
IPage<BasicdataVehicleVO> selectInsuranceDeadlineBasicdataVehiclePage(IPage<BasicdataVehicleVO> page,@Param("param") BasicdataVehicleDTO basicdataVehicle);
/**
* 保险到期
* @param page
* @param basicdataVehicle
* @return
*/
IPage<BasicdataVehicleVO> selectInsuranceExpireBasicdataVehiclePage(IPage<BasicdataVehicleVO> page,@Param("param") BasicdataVehicleDTO basicdataVehicle);
/**
* 年审临期
* @param page
* @param basicdataVehicle
* @return
*/
IPage<BasicdataVehicleVO> selectAnnualDeadlineBasicdataVehiclePage(IPage<BasicdataVehicleVO> page,@Param("param") BasicdataVehicleDTO basicdataVehicle);
/**
* 年审到期
* @param page
* @param basicdataVehicle
* @return
*/
IPage<BasicdataVehicleVO> selectAnnualExpireBasicdataVehiclePage(IPage<BasicdataVehicleVO> page,@Param("param") BasicdataVehicleDTO basicdataVehicle);
}

351
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataVehicleMapper.xml

@ -331,6 +331,357 @@
lbv.id = #{id}
AND is_deleted = 0
</select>
<select id="selectInsuranceDeadlineBasicdataVehiclePage"
resultType="com.logpm.basicdata.vo.BasicdataVehicleVO">
SELECT
lbv.id id,
lbv.tenant_id tenantId,
lbv.create_user createUser,
lbv.create_time createTime,
lbv.update_user updateUser,
lbv.update_time updateTime,
lbv.STATUS STATUS,
lbv.create_dept createDept,
lbv.vehicle_nub vehicleNub,
lbv.vehicle_source vehicleSource,
lbv.is_head isHead,
lbv.trailer_type trailerType,
lbv.vehicle_model vehicleModel,
lbv.car_type carType,
lbv.carrier_name carrierName,
lbv.vehicle_commander vehicleCommander,
lbv.vehicle_height vehicleHeight,
lbv.payment_method paymentMethod,
lbv.approved_volume approvedVolume,
lbv.license_plate_color licensePlateColor,
lbv.vehicle_color vehicleColor,
lbv.energy_type energyType,
lbv.license_plate_type licensePlateType,
lbv.notes notes,
lbv.vehicle_owner vehicleOwner,
lbv.vehicle_brand vehicleBrand,
lbv.vehicle_code vehicleCode,
lbv.engine_code engineCode,
lbv.vehicle_quality vehicleQuality,
lbv.curb_weight curbWeight,
lbv.load_mass loadMass,
lbv.outer_width outerWidth,
lbv.expiration_time expirationTime,
lbv.road_transport roadTransport,
lbv.business_license businessLicense,
lbv.vehicle_unit vehicleUnit,
lbv.vehicle_unit_phone vehicleUnitPhone,
lbv.vehicle_owner_phone vehicleOwnerPhone,
lbv.vehicle_owner_card vehicleOwnerCard,
lbv.driving_license_photo drivingLicensePhoto,
lbv.driving_license_photo_back drivingLicensePhotoBack,
lbv.license_photo licensePhoto,
lbv.vehicle_photo vehiclePhoto,
lbv.vehicle_rear_photo vehicleRearPhoto,
lbv.road_transport_photo roadTransportPhoto,
lbv.vehicle_people_photo vehiclePeoplePhoto,
lbv.insurance_card_photo insuranceCardPhoto,
lbv.carrier_id carrierId,
lbv.review_time reviewTime,
lbv.review_validity reviewValidity,
lbv.insurance_start_time insuranceStartTime,
lbv.insurance_end_time insuranceEndTime,
lbv.body_advertising bodyAdvertising,
lbv.advertisements_new_times advertisementsNewTimes,
lbv.vehicle_parking_company vehicleParkingCompany,
lbv.with_gps withGps,
lbv.gps_service_provider gpsServiceProvider,
lbv.gps_model gpsModel,
(
SELECT
group_concat(lbvp.photo_url)
FROM
logpm_basicdata_vehicle_photo lbvp
where
lbvp.master_id = lbv.id
AND lbvp.create_time &lt;= DATE_SUB( CURDATE(), INTERVAL 1 YEAR )
ORDER BY
lbvp.create_time
LIMIT 3
) historicPhotos,
(SELECT GROUP_CONCAT(driver_id SEPARATOR ',') from logpm_basicdata_drivermiddle lbd WHERE lbd.brand_id = lbv.id and lbd.is_deleted = 0) vehicleOwners
FROM
logpm_basicdata_vehicle lbv
<where>
lbv.is_deleted = 0
AND lbv.insurance_end_time IS NOT null
AND DATEDIFF(DATE_FORMAT(lbv.insurance_end_time,'%y%m%d'),DATE_FORMAT(NOW(),'%y%m%d')) BETWEEN 1 AND 90
<if test="param.vehicleNub != null ">and lbv.vehicle_nub like concat('%',#{param.vehicleNub},'%')</if>
<if test="param.vehicleSource != null ">and lbv.vehicle_source = #{param.vehicleSource}</if>
<if test="param.trailerType != null ">and lbv.trailer_type = #{param.trailerType}</if>
<if test="param.vehicleModel != null ">and lbv.vehicle_model = #{param.vehicleModel}</if>
<if test="param.paymentMethod != null ">and lbv.payment_method = #{param.paymentMethod}</if>
<if test="param.carrierId != null ">and lbv.carrier_id = #{param.carrierId}</if>
</where>
</select>
<select id="selectInsuranceExpireBasicdataVehiclePage"
resultType="com.logpm.basicdata.vo.BasicdataVehicleVO">
SELECT
lbv.id id,
lbv.tenant_id tenantId,
lbv.create_user createUser,
lbv.create_time createTime,
lbv.update_user updateUser,
lbv.update_time updateTime,
lbv.STATUS STATUS,
lbv.create_dept createDept,
lbv.vehicle_nub vehicleNub,
lbv.vehicle_source vehicleSource,
lbv.is_head isHead,
lbv.trailer_type trailerType,
lbv.vehicle_model vehicleModel,
lbv.car_type carType,
lbv.carrier_name carrierName,
lbv.vehicle_commander vehicleCommander,
lbv.vehicle_height vehicleHeight,
lbv.payment_method paymentMethod,
lbv.approved_volume approvedVolume,
lbv.license_plate_color licensePlateColor,
lbv.vehicle_color vehicleColor,
lbv.energy_type energyType,
lbv.license_plate_type licensePlateType,
lbv.notes notes,
lbv.vehicle_owner vehicleOwner,
lbv.vehicle_brand vehicleBrand,
lbv.vehicle_code vehicleCode,
lbv.engine_code engineCode,
lbv.vehicle_quality vehicleQuality,
lbv.curb_weight curbWeight,
lbv.load_mass loadMass,
lbv.outer_width outerWidth,
lbv.expiration_time expirationTime,
lbv.road_transport roadTransport,
lbv.business_license businessLicense,
lbv.vehicle_unit vehicleUnit,
lbv.vehicle_unit_phone vehicleUnitPhone,
lbv.vehicle_owner_phone vehicleOwnerPhone,
lbv.vehicle_owner_card vehicleOwnerCard,
lbv.driving_license_photo drivingLicensePhoto,
lbv.driving_license_photo_back drivingLicensePhotoBack,
lbv.license_photo licensePhoto,
lbv.vehicle_photo vehiclePhoto,
lbv.vehicle_rear_photo vehicleRearPhoto,
lbv.road_transport_photo roadTransportPhoto,
lbv.vehicle_people_photo vehiclePeoplePhoto,
lbv.insurance_card_photo insuranceCardPhoto,
lbv.carrier_id carrierId,
lbv.review_time reviewTime,
lbv.review_validity reviewValidity,
lbv.insurance_start_time insuranceStartTime,
lbv.insurance_end_time insuranceEndTime,
lbv.body_advertising bodyAdvertising,
lbv.advertisements_new_times advertisementsNewTimes,
lbv.vehicle_parking_company vehicleParkingCompany,
lbv.with_gps withGps,
lbv.gps_service_provider gpsServiceProvider,
lbv.gps_model gpsModel,
(
SELECT
group_concat(lbvp.photo_url)
FROM
logpm_basicdata_vehicle_photo lbvp
where
lbvp.master_id = lbv.id
AND lbvp.create_time &lt;= DATE_SUB( CURDATE(), INTERVAL 1 YEAR )
ORDER BY
lbvp.create_time
LIMIT 3
) historicPhotos,
(SELECT GROUP_CONCAT(driver_id SEPARATOR ',') from logpm_basicdata_drivermiddle lbd WHERE lbd.brand_id = lbv.id and lbd.is_deleted = 0) vehicleOwners
FROM
logpm_basicdata_vehicle lbv
<where>
lbv.is_deleted = 0
AND lbv.insurance_end_time IS NOT null
AND DATEDIFF(DATE_FORMAT(lbv.insurance_end_time,'%y%m%d'),DATE_FORMAT(NOW(),'%y%m%d')) &lt;= 0
<if test="param.vehicleNub != null ">and lbv.vehicle_nub like concat('%',#{param.vehicleNub},'%')</if>
<if test="param.vehicleSource != null ">and lbv.vehicle_source = #{param.vehicleSource}</if>
<if test="param.trailerType != null ">and lbv.trailer_type = #{param.trailerType}</if>
<if test="param.vehicleModel != null ">and lbv.vehicle_model = #{param.vehicleModel}</if>
<if test="param.paymentMethod != null ">and lbv.payment_method = #{param.paymentMethod}</if>
<if test="param.carrierId != null ">and lbv.carrier_id = #{param.carrierId}</if>
</where>
</select>
<select id="selectAnnualDeadlineBasicdataVehiclePage"
resultType="com.logpm.basicdata.vo.BasicdataVehicleVO">
SELECT
lbv.id id,
lbv.tenant_id tenantId,
lbv.create_user createUser,
lbv.create_time createTime,
lbv.update_user updateUser,
lbv.update_time updateTime,
lbv.STATUS STATUS,
lbv.create_dept createDept,
lbv.vehicle_nub vehicleNub,
lbv.vehicle_source vehicleSource,
lbv.is_head isHead,
lbv.trailer_type trailerType,
lbv.vehicle_model vehicleModel,
lbv.car_type carType,
lbv.carrier_name carrierName,
lbv.vehicle_commander vehicleCommander,
lbv.vehicle_height vehicleHeight,
lbv.payment_method paymentMethod,
lbv.approved_volume approvedVolume,
lbv.license_plate_color licensePlateColor,
lbv.vehicle_color vehicleColor,
lbv.energy_type energyType,
lbv.license_plate_type licensePlateType,
lbv.notes notes,
lbv.vehicle_owner vehicleOwner,
lbv.vehicle_brand vehicleBrand,
lbv.vehicle_code vehicleCode,
lbv.engine_code engineCode,
lbv.vehicle_quality vehicleQuality,
lbv.curb_weight curbWeight,
lbv.load_mass loadMass,
lbv.outer_width outerWidth,
lbv.expiration_time expirationTime,
lbv.road_transport roadTransport,
lbv.business_license businessLicense,
lbv.vehicle_unit vehicleUnit,
lbv.vehicle_unit_phone vehicleUnitPhone,
lbv.vehicle_owner_phone vehicleOwnerPhone,
lbv.vehicle_owner_card vehicleOwnerCard,
lbv.driving_license_photo drivingLicensePhoto,
lbv.driving_license_photo_back drivingLicensePhotoBack,
lbv.license_photo licensePhoto,
lbv.vehicle_photo vehiclePhoto,
lbv.vehicle_rear_photo vehicleRearPhoto,
lbv.road_transport_photo roadTransportPhoto,
lbv.vehicle_people_photo vehiclePeoplePhoto,
lbv.insurance_card_photo insuranceCardPhoto,
lbv.carrier_id carrierId,
lbv.review_time reviewTime,
lbv.review_validity reviewValidity,
lbv.insurance_start_time insuranceStartTime,
lbv.insurance_end_time insuranceEndTime,
lbv.body_advertising bodyAdvertising,
lbv.advertisements_new_times advertisementsNewTimes,
lbv.vehicle_parking_company vehicleParkingCompany,
lbv.with_gps withGps,
lbv.gps_service_provider gpsServiceProvider,
lbv.gps_model gpsModel,
(
SELECT
group_concat(lbvp.photo_url)
FROM
logpm_basicdata_vehicle_photo lbvp
where
lbvp.master_id = lbv.id
AND lbvp.create_time &lt;= DATE_SUB( CURDATE(), INTERVAL 1 YEAR )
ORDER BY
lbvp.create_time
LIMIT 3
) historicPhotos,
(SELECT GROUP_CONCAT(driver_id SEPARATOR ',') from logpm_basicdata_drivermiddle lbd WHERE lbd.brand_id = lbv.id and lbd.is_deleted = 0) vehicleOwners
FROM
logpm_basicdata_vehicle lbv
<where>
lbv.is_deleted = 0
AND lbv.review_validity IS NOT null
AND DATEDIFF(DATE_FORMAT(lbv.review_validity,'%y%m%d'),DATE_FORMAT(NOW(),'%y%m%d')) BETWEEN 1 AND 90
<if test="param.vehicleNub != null ">and lbv.vehicle_nub like concat('%',#{param.vehicleNub},'%')</if>
<if test="param.vehicleSource != null ">and lbv.vehicle_source = #{param.vehicleSource}</if>
<if test="param.trailerType != null ">and lbv.trailer_type = #{param.trailerType}</if>
<if test="param.vehicleModel != null ">and lbv.vehicle_model = #{param.vehicleModel}</if>
<if test="param.paymentMethod != null ">and lbv.payment_method = #{param.paymentMethod}</if>
<if test="param.carrierId != null ">and lbv.carrier_id = #{param.carrierId}</if>
</where>
</select>
<select id="selectAnnualExpireBasicdataVehiclePage" resultType="com.logpm.basicdata.vo.BasicdataVehicleVO">
SELECT
lbv.id id,
lbv.tenant_id tenantId,
lbv.create_user createUser,
lbv.create_time createTime,
lbv.update_user updateUser,
lbv.update_time updateTime,
lbv.STATUS STATUS,
lbv.create_dept createDept,
lbv.vehicle_nub vehicleNub,
lbv.vehicle_source vehicleSource,
lbv.is_head isHead,
lbv.trailer_type trailerType,
lbv.vehicle_model vehicleModel,
lbv.car_type carType,
lbv.carrier_name carrierName,
lbv.vehicle_commander vehicleCommander,
lbv.vehicle_height vehicleHeight,
lbv.payment_method paymentMethod,
lbv.approved_volume approvedVolume,
lbv.license_plate_color licensePlateColor,
lbv.vehicle_color vehicleColor,
lbv.energy_type energyType,
lbv.license_plate_type licensePlateType,
lbv.notes notes,
lbv.vehicle_owner vehicleOwner,
lbv.vehicle_brand vehicleBrand,
lbv.vehicle_code vehicleCode,
lbv.engine_code engineCode,
lbv.vehicle_quality vehicleQuality,
lbv.curb_weight curbWeight,
lbv.load_mass loadMass,
lbv.outer_width outerWidth,
lbv.expiration_time expirationTime,
lbv.road_transport roadTransport,
lbv.business_license businessLicense,
lbv.vehicle_unit vehicleUnit,
lbv.vehicle_unit_phone vehicleUnitPhone,
lbv.vehicle_owner_phone vehicleOwnerPhone,
lbv.vehicle_owner_card vehicleOwnerCard,
lbv.driving_license_photo drivingLicensePhoto,
lbv.driving_license_photo_back drivingLicensePhotoBack,
lbv.license_photo licensePhoto,
lbv.vehicle_photo vehiclePhoto,
lbv.vehicle_rear_photo vehicleRearPhoto,
lbv.road_transport_photo roadTransportPhoto,
lbv.vehicle_people_photo vehiclePeoplePhoto,
lbv.insurance_card_photo insuranceCardPhoto,
lbv.carrier_id carrierId,
lbv.review_time reviewTime,
lbv.review_validity reviewValidity,
lbv.insurance_start_time insuranceStartTime,
lbv.insurance_end_time insuranceEndTime,
lbv.body_advertising bodyAdvertising,
lbv.advertisements_new_times advertisementsNewTimes,
lbv.vehicle_parking_company vehicleParkingCompany,
lbv.with_gps withGps,
lbv.gps_service_provider gpsServiceProvider,
lbv.gps_model gpsModel,
(
SELECT
group_concat(lbvp.photo_url)
FROM
logpm_basicdata_vehicle_photo lbvp
where
lbvp.master_id = lbv.id
AND lbvp.create_time &lt;= DATE_SUB( CURDATE(), INTERVAL 1 YEAR )
ORDER BY
lbvp.create_time
LIMIT 3
) historicPhotos,
(SELECT GROUP_CONCAT(driver_id SEPARATOR ',') from logpm_basicdata_drivermiddle lbd WHERE lbd.brand_id = lbv.id and lbd.is_deleted = 0) vehicleOwners
FROM
logpm_basicdata_vehicle lbv
<where>
lbv.is_deleted = 0
AND lbv.review_validity IS NOT null
AND DATEDIFF(DATE_FORMAT(lbv.review_validity,'%y%m%d'),DATE_FORMAT(NOW(),'%y%m%d')) &lt;= 0
<if test="param.vehicleNub != null ">and lbv.vehicle_nub like concat('%',#{param.vehicleNub},'%')</if>
<if test="param.vehicleSource != null ">and lbv.vehicle_source = #{param.vehicleSource}</if>
<if test="param.trailerType != null ">and lbv.trailer_type = #{param.trailerType}</if>
<if test="param.vehicleModel != null ">and lbv.vehicle_model = #{param.vehicleModel}</if>
<if test="param.paymentMethod != null ">and lbv.payment_method = #{param.paymentMethod}</if>
<if test="param.carrierId != null ">and lbv.carrier_id = #{param.carrierId}</if>
</where>
</select>
</mapper>

128
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<BasicdataVehicl
private final BasicdataDriverArteryMapper basicdataDriverArteryMapper;
private final IBasicdataCarrierService basicdataCarrierService;
@Override
public IPage<BasicdataVehicleVO> selectBasicdataVehiclePage(IPage<BasicdataVehicleVO> 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<BasicdataVehicleVO> basicdataVehicleVOS = baseMapper.selectBasicdataVehiclePage(page, basicdataVehicle);
return page.setRecords(basicdataVehicleVOS);
case 1:
//保险临期
IPage<BasicdataVehicleVO> insuranceDeadlineBasicdataVehicleVOS = baseMapper.selectInsuranceDeadlineBasicdataVehiclePage(page, basicdataVehicle);
return insuranceDeadlineBasicdataVehicleVOS;
case 2:
//保险到期
IPage<BasicdataVehicleVO> insuranceExpireBasicdataVehicleVOS = baseMapper.selectInsuranceExpireBasicdataVehiclePage(page, basicdataVehicle);
return insuranceExpireBasicdataVehicleVOS;
case 3:
//年审临期
IPage<BasicdataVehicleVO> annualDeadlineBasicdataVehicleVOS = baseMapper.selectAnnualDeadlineBasicdataVehiclePage(page, basicdataVehicle);
return annualDeadlineBasicdataVehicleVOS;
case 4:
//年审到期
IPage<BasicdataVehicleVO> expireDeadlineBasicdataVehicleVOS = baseMapper.selectAnnualExpireBasicdataVehiclePage(page, basicdataVehicle);
return expireDeadlineBasicdataVehicleVOS;
default:
log.error("未知的车辆类型>>>>>>>>>>>>>");
return null;
}
}
@Override
public List<BasicdataVehicleReadingFriendlyExcel> exportBasicdataVehicle(String ids) {
public List<BasicdataVehicleReadingFriendlyExcel> exportBasicdataVehicle(String ids) {
List<BasicdataVehicleReadingFriendlyExcel> basicdataVehicleList = baseMapper.exportBasicdataVehicle(ids.isEmpty() ? null : Func.toLongList(ids));
// List<BasicdataCarrierVO> basicdataCarrierVOS = basicdataCarrierService.selectBasicdataCarrierDictionary();
@ -106,7 +132,7 @@ public class BasicdataVehicleServiceImpl extends BaseServiceImpl<BasicdataVehicl
@Override
public List<BasicdataVehicleVO> 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<BasicdataVehicl
public Integer updateOwners(BasicdataVehicleDTO basicdataVehicle) {
//删除原有绑定关系
int delete = basicdataDrivermiddleMapper.delete(new QueryWrapper<BasicdataDrivermiddleEntity>().lambda().eq(BasicdataDrivermiddleEntity::getBrandId, basicdataVehicle.getId()));
if (basicdataVehicle.getVehicleOwners().isEmpty()){
if (basicdataVehicle.getVehicleOwners().isEmpty()) {
return delete;
}
//新增现有的数据
// if (delete>0){
List<String> bindOwners = Arrays.asList(basicdataVehicle.getVehicleOwners().split(","));
ArrayList<BasicdataDrivermiddleEntity> 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<String> bindOwners = Arrays.asList(basicdataVehicle.getVehicleOwners().split(","));
ArrayList<BasicdataDrivermiddleEntity> 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<BasicdataVehicl
List<BasicdataVehicleEntity> list = this.list();
List<BasicdataVehicleVO> basicdataVehicleVOS = new ArrayList<>();
if(Func.isEmpty(list)){
if (Func.isEmpty(list)) {
return null;
}
// 查询所有的iD
@ -168,22 +194,22 @@ public class BasicdataVehicleServiceImpl extends BaseServiceImpl<BasicdataVehicl
.collect(Collectors.groupingBy(BasicdataDrivermiddleEntity::getBrandId));
QueryWrapper queryWrapper1 = new QueryWrapper();
queryWrapper1.eq("is_deleted",0);
queryWrapper1.eq("is_deleted", 0);
List<BasicdataDriverArteryEntity> 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<BasicdataDrivermiddleEntity> basicdataDrivermiddleEntities = groupedEntities.get(vehicleVO.getId());
if(Func.isNotEmpty(basicdataDrivermiddleEntities)){
if (Func.isNotEmpty(basicdataDrivermiddleEntities)) {
List<Long> driverIds = basicdataDrivermiddleEntities.
stream().filter(f -> Func.isNotEmpty(f.getDriverId())).map(BasicdataDrivermiddleEntity::getDriverId).collect(Collectors.toList());
if (Func.isNotEmpty(driverIds)){
if (Func.isNotEmpty(driverIds)) {
List<BasicdataDriverArteryEntity> 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<BasicdataVehicl
@Transactional
public void importDriverArtery(List<BasicdataVehicleImportExcel> data) {
String method = "#############BasicdataVehicleServiceImpl.importDriverArtery";
log.info("车辆模板导入信息>>>>{}",data);
log.info("车辆模板导入信息>>>>{}", data);
try {
List<BasicdataDrivermiddleEntity>drivermiddleEntities = new ArrayList<>();
List<BasicdataDrivermiddleEntity> drivermiddleEntities = new ArrayList<>();
//对导入数据进行处理
for (BasicdataVehicleImportExcel datum : data) {
BasicdataDrivermiddleEntity basicdataDrivermiddleEntity = null;
BasicdataVehicleEntity entity = this.getOne(Wrappers.<BasicdataVehicleEntity>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<BasicdataCarrierEntity> basicdataCarrierEntities = basicdataCarrierService.list(Wrappers.<BasicdataCarrierEntity>lambdaQuery().eq(BasicdataCarrierEntity::getCarrierName, datum.getCarrierName()));
@ -279,16 +305,16 @@ public class BasicdataVehicleServiceImpl extends BaseServiceImpl<BasicdataVehicl
vehicleEntity.setInsuranceStartTime(datum.getInsuranceStartTime());
vehicleEntity.setInsuranceEndTime(datum.getInsuranceEndTime());
this.save(vehicleEntity);
if (Func.isNotEmpty(basicdataDrivermiddleEntity)){
if (Func.isNotEmpty(basicdataDrivermiddleEntity)) {
basicdataDrivermiddleEntity.setBrandId(vehicleEntity.getId());
drivermiddleEntities.add(basicdataDrivermiddleEntity);
}
}
if (!drivermiddleEntities.isEmpty()){
if (!drivermiddleEntities.isEmpty()) {
basicdataDrivermiddleService.saveBatch(drivermiddleEntities);
}
}catch (Exception e){
log.error("车辆导入失败",e);
} catch (Exception e) {
log.error("车辆导入失败", e);
throw new RuntimeException("导入失败");
}

Loading…
Cancel
Save