fix bug
This commit is contained in:
@@ -75,6 +75,24 @@ public class DriverController extends BladeController {
|
||||
private static final int DEFAULT_CURRENT = 1;
|
||||
private static final int DEFAULT_SIZE = 10;
|
||||
private static final int MAX_SIZE = 100;
|
||||
private static final String EXPIRY_EXPIRED_SQL = """
|
||||
(
|
||||
((driving_license_long_term IS NULL OR driving_license_long_term != 1) AND driving_license_end_date < {0})
|
||||
OR ((qualification_long_term IS NULL OR qualification_long_term != 1) AND qualification_end_date < {0})
|
||||
)
|
||||
""";
|
||||
private static final String EXPIRY_WITHIN_30_SQL = """
|
||||
(
|
||||
NOT (
|
||||
((driving_license_long_term IS NULL OR driving_license_long_term != 1) AND driving_license_end_date < {0})
|
||||
OR ((qualification_long_term IS NULL OR qualification_long_term != 1) AND qualification_end_date < {0})
|
||||
)
|
||||
AND (
|
||||
((driving_license_long_term IS NULL OR driving_license_long_term != 1) AND driving_license_end_date BETWEEN {0} AND {1})
|
||||
OR ((qualification_long_term IS NULL OR qualification_long_term != 1) AND qualification_end_date BETWEEN {0} AND {1})
|
||||
)
|
||||
)
|
||||
""";
|
||||
|
||||
private final IDriverService driverService;
|
||||
|
||||
@@ -222,18 +240,10 @@ public class DriverController extends BladeController {
|
||||
queryWrapper.eq(Driver::getStatus, driver.getStatus());
|
||||
}
|
||||
if ("within30".equals(driver.getExpireStatus())) {
|
||||
queryWrapper.and(wrapper -> wrapper
|
||||
.and(item -> item.ne(Driver::getDrivingLicenseLongTerm, 1)
|
||||
.between(Driver::getDrivingLicenseEndDate, driver.getToday(), driver.getWarningDate()))
|
||||
.or(item -> item.ne(Driver::getQualificationLongTerm, 1)
|
||||
.between(Driver::getQualificationEndDate, driver.getToday(), driver.getWarningDate())));
|
||||
queryWrapper.apply(EXPIRY_WITHIN_30_SQL, driver.getToday(), driver.getWarningDate());
|
||||
}
|
||||
if ("expired".equals(driver.getExpireStatus())) {
|
||||
queryWrapper.and(wrapper -> wrapper
|
||||
.and(item -> item.ne(Driver::getDrivingLicenseLongTerm, 1)
|
||||
.lt(Driver::getDrivingLicenseEndDate, driver.getToday()))
|
||||
.or(item -> item.ne(Driver::getQualificationLongTerm, 1)
|
||||
.lt(Driver::getQualificationEndDate, driver.getToday())));
|
||||
queryWrapper.apply(EXPIRY_EXPIRED_SQL, driver.getToday());
|
||||
}
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
@@ -62,36 +63,102 @@ public class TransportShipExcel implements Serializable {
|
||||
@ExcelProperty("所属组织")
|
||||
private String organizationName;
|
||||
|
||||
@ExcelProperty("安放龙骨日期")
|
||||
private LocalDate keelLayingDate;
|
||||
|
||||
@ExcelProperty("建造完工日期")
|
||||
private LocalDate buildCompletionDate;
|
||||
|
||||
@ExcelProperty("总长")
|
||||
private BigDecimal totalLength;
|
||||
|
||||
@ExcelProperty("船宽")
|
||||
private BigDecimal shipWidth;
|
||||
|
||||
@ExcelProperty("型深")
|
||||
private BigDecimal moldedDepth;
|
||||
|
||||
@ExcelProperty("最大船高")
|
||||
private BigDecimal maxShipHeight;
|
||||
|
||||
@ExcelProperty("空载吃水")
|
||||
private BigDecimal lightDraft;
|
||||
|
||||
@ExcelProperty("满载吃水")
|
||||
private BigDecimal fullLoadDraft;
|
||||
|
||||
@ExcelProperty("航区")
|
||||
private String navigationArea;
|
||||
|
||||
@ExcelProperty("登记号码")
|
||||
private String ownershipRegistrationNo;
|
||||
|
||||
@ExcelProperty("初次登记号码")
|
||||
private String initialRegistrationNo;
|
||||
|
||||
@ExcelProperty("船舶所有人")
|
||||
private String shipOwner;
|
||||
|
||||
@ExcelProperty("取得所有权日期")
|
||||
private LocalDate ownershipAcquisitionDate;
|
||||
|
||||
@ExcelProperty("船检登记号")
|
||||
private String shipInspectionNo;
|
||||
|
||||
@ExcelProperty("船舶类型")
|
||||
private String shipType;
|
||||
|
||||
@ExcelProperty("总吨")
|
||||
private BigDecimal grossTonnage;
|
||||
|
||||
@ExcelProperty("净吨")
|
||||
private BigDecimal netTonnage;
|
||||
|
||||
@ExcelProperty("国籍证有效期自")
|
||||
private LocalDate nationalityCertStartDate;
|
||||
|
||||
@ExcelProperty("国籍证有效期至")
|
||||
private LocalDate nationalityCertEndDate;
|
||||
|
||||
@ExcelProperty("国籍证长期有效")
|
||||
private String nationalityCertLongTermName;
|
||||
|
||||
@ExcelProperty("最低安全配员证书有效期自")
|
||||
private LocalDate safeManningCertStartDate;
|
||||
|
||||
@ExcelProperty("最低安全配员证书有效期至")
|
||||
private LocalDate safeManningCertEndDate;
|
||||
|
||||
@ExcelProperty("最低安全配员证书长期有效")
|
||||
private String safeManningCertLongTermName;
|
||||
|
||||
@ExcelProperty("营业运输证证书编号")
|
||||
private String businessTransportCertNo;
|
||||
|
||||
@ExcelProperty("营业运输证发证日期")
|
||||
private LocalDate businessTransportCertIssueDate;
|
||||
|
||||
@ExcelProperty("营业运输证有效期至")
|
||||
private LocalDate businessTransportCertEndDate;
|
||||
|
||||
@ExcelProperty("营业运输证长期有效")
|
||||
private String businessTransportCertLongTermName;
|
||||
|
||||
@ExcelProperty("起租日期")
|
||||
private LocalDate leaseStartDate;
|
||||
|
||||
@ExcelProperty("承租有效期至")
|
||||
private LocalDate leaseEndDate;
|
||||
|
||||
@ExcelProperty("承租长期有效")
|
||||
private String leaseLongTermName;
|
||||
|
||||
@ExcelProperty("船舶承租人")
|
||||
private String shipLessee;
|
||||
|
||||
@ExcelProperty("船舶经营人")
|
||||
private String shipOperator;
|
||||
|
||||
@ExcelProperty("状态")
|
||||
private String statusName;
|
||||
|
||||
|
||||
@@ -59,6 +59,9 @@ public class TransportVehicleExcel implements Serializable {
|
||||
@ExcelProperty("车牌号")
|
||||
private String plateNo;
|
||||
|
||||
@ExcelProperty("车牌颜色")
|
||||
private String plateColor;
|
||||
|
||||
@ExcelProperty("车辆类型")
|
||||
private String vehicleType;
|
||||
|
||||
|
||||
@@ -90,6 +90,23 @@
|
||||
remark
|
||||
</sql>
|
||||
|
||||
<sql id="ExpiryExpiredCondition">
|
||||
(
|
||||
((driving_license_long_term IS NULL OR driving_license_long_term != 1) AND driving_license_end_date < #{driver.today})
|
||||
OR ((qualification_long_term IS NULL OR qualification_long_term != 1) AND qualification_end_date < #{driver.today})
|
||||
)
|
||||
</sql>
|
||||
|
||||
<sql id="ExpiryWithin30Condition">
|
||||
(
|
||||
NOT <include refid="ExpiryExpiredCondition"/>
|
||||
AND (
|
||||
((driving_license_long_term IS NULL OR driving_license_long_term != 1) AND driving_license_end_date BETWEEN #{driver.today} AND #{driver.warningDate})
|
||||
OR ((qualification_long_term IS NULL OR qualification_long_term != 1) AND qualification_end_date BETWEEN #{driver.today} AND #{driver.warningDate})
|
||||
)
|
||||
)
|
||||
</sql>
|
||||
|
||||
<sql id="QueryCondition">
|
||||
is_deleted = 0
|
||||
<if test="driver.driverName != null and driver.driverName != ''">
|
||||
@@ -118,16 +135,10 @@
|
||||
AND status = #{driver.status}
|
||||
</if>
|
||||
<if test="driver.expireStatus != null and driver.expireStatus == 'within30'">
|
||||
AND (
|
||||
(driving_license_long_term != 1 AND driving_license_end_date BETWEEN #{driver.today} AND #{driver.warningDate})
|
||||
OR (qualification_long_term != 1 AND qualification_end_date BETWEEN #{driver.today} AND #{driver.warningDate})
|
||||
)
|
||||
AND <include refid="ExpiryWithin30Condition"/>
|
||||
</if>
|
||||
<if test="driver.expireStatus != null and driver.expireStatus == 'expired'">
|
||||
AND (
|
||||
(driving_license_long_term != 1 AND driving_license_end_date < #{driver.today})
|
||||
OR (qualification_long_term != 1 AND qualification_end_date < #{driver.today})
|
||||
)
|
||||
AND <include refid="ExpiryExpiredCondition"/>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
@@ -144,14 +155,8 @@
|
||||
<select id="selectExpiryStat" resultType="org.springblade.transport.pojo.vo.DriverExpiryStatVO">
|
||||
SELECT
|
||||
COUNT(1) AS total,
|
||||
SUM(CASE WHEN (
|
||||
(driving_license_long_term != 1 AND driving_license_end_date BETWEEN #{driver.today} AND #{driver.warningDate})
|
||||
OR (qualification_long_term != 1 AND qualification_end_date BETWEEN #{driver.today} AND #{driver.warningDate})
|
||||
) THEN 1 ELSE 0 END) AS within30,
|
||||
SUM(CASE WHEN (
|
||||
(driving_license_long_term != 1 AND driving_license_end_date < #{driver.today})
|
||||
OR (qualification_long_term != 1 AND qualification_end_date < #{driver.today})
|
||||
) THEN 1 ELSE 0 END) AS expired
|
||||
SUM(CASE WHEN <include refid="ExpiryWithin30Condition"/> THEN 1 ELSE 0 END) AS within30,
|
||||
SUM(CASE WHEN <include refid="ExpiryExpiredCondition"/> THEN 1 ELSE 0 END) AS expired
|
||||
FROM
|
||||
blade_transport_driver
|
||||
WHERE
|
||||
|
||||
@@ -15,20 +15,44 @@
|
||||
<result column="ship_name" property="shipName"/>
|
||||
<result column="ship_identifier_no" property="shipIdentifierNo"/>
|
||||
<result column="organization_name" property="organizationName"/>
|
||||
<result column="keel_laying_date" property="keelLayingDate"/>
|
||||
<result column="build_completion_date" property="buildCompletionDate"/>
|
||||
<result column="total_length" property="totalLength"/>
|
||||
<result column="ship_width" property="shipWidth"/>
|
||||
<result column="molded_depth" property="moldedDepth"/>
|
||||
<result column="max_ship_height" property="maxShipHeight"/>
|
||||
<result column="light_draft" property="lightDraft"/>
|
||||
<result column="full_load_draft" property="fullLoadDraft"/>
|
||||
<result column="navigation_area" property="navigationArea"/>
|
||||
<result column="ownership_registration_no" property="ownershipRegistrationNo"/>
|
||||
<result column="initial_registration_no" property="initialRegistrationNo"/>
|
||||
<result column="ship_owner" property="shipOwner"/>
|
||||
<result column="ownership_acquisition_date" property="ownershipAcquisitionDate"/>
|
||||
<result column="ship_inspection_no" property="shipInspectionNo"/>
|
||||
<result column="ship_type" property="shipType"/>
|
||||
<result column="gross_tonnage" property="grossTonnage"/>
|
||||
<result column="net_tonnage" property="netTonnage"/>
|
||||
<result column="ownership_cert_image" property="ownershipCertImage"/>
|
||||
<result column="safety_cert_image" property="safetyCertImage"/>
|
||||
<result column="nationality_cert_start_date" property="nationalityCertStartDate"/>
|
||||
<result column="nationality_cert_end_date" property="nationalityCertEndDate"/>
|
||||
<result column="nationality_cert_long_term" property="nationalityCertLongTerm"/>
|
||||
<result column="nationality_cert_image" property="nationalityCertImage"/>
|
||||
<result column="safe_manning_cert_start_date" property="safeManningCertStartDate"/>
|
||||
<result column="safe_manning_cert_end_date" property="safeManningCertEndDate"/>
|
||||
<result column="safe_manning_cert_long_term" property="safeManningCertLongTerm"/>
|
||||
<result column="safe_manning_cert_image" property="safeManningCertImage"/>
|
||||
<result column="business_transport_cert_no" property="businessTransportCertNo"/>
|
||||
<result column="business_transport_cert_issue_date" property="businessTransportCertIssueDate"/>
|
||||
<result column="business_transport_cert_end_date" property="businessTransportCertEndDate"/>
|
||||
<result column="business_transport_cert_long_term" property="businessTransportCertLongTerm"/>
|
||||
<result column="business_transport_cert_image" property="businessTransportCertImage"/>
|
||||
<result column="lease_start_date" property="leaseStartDate"/>
|
||||
<result column="lease_end_date" property="leaseEndDate"/>
|
||||
<result column="lease_long_term" property="leaseLongTerm"/>
|
||||
<result column="lease_contract_image" property="leaseContractImage"/>
|
||||
<result column="ship_lessee" property="shipLessee"/>
|
||||
<result column="ship_operator" property="shipOperator"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
@@ -45,20 +69,44 @@
|
||||
ship_name,
|
||||
ship_identifier_no,
|
||||
organization_name,
|
||||
keel_laying_date,
|
||||
build_completion_date,
|
||||
total_length,
|
||||
ship_width,
|
||||
molded_depth,
|
||||
max_ship_height,
|
||||
light_draft,
|
||||
full_load_draft,
|
||||
navigation_area,
|
||||
ownership_registration_no,
|
||||
initial_registration_no,
|
||||
ship_owner,
|
||||
ownership_acquisition_date,
|
||||
ship_inspection_no,
|
||||
ship_type,
|
||||
gross_tonnage,
|
||||
net_tonnage,
|
||||
ownership_cert_image,
|
||||
safety_cert_image,
|
||||
nationality_cert_start_date,
|
||||
nationality_cert_end_date,
|
||||
nationality_cert_long_term,
|
||||
nationality_cert_image,
|
||||
safe_manning_cert_start_date,
|
||||
safe_manning_cert_end_date,
|
||||
safe_manning_cert_long_term,
|
||||
safe_manning_cert_image,
|
||||
business_transport_cert_no,
|
||||
business_transport_cert_issue_date,
|
||||
business_transport_cert_end_date,
|
||||
business_transport_cert_long_term,
|
||||
business_transport_cert_image,
|
||||
lease_start_date,
|
||||
lease_end_date,
|
||||
lease_long_term,
|
||||
lease_contract_image,
|
||||
ship_lessee,
|
||||
ship_operator,
|
||||
remark
|
||||
</sql>
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
<result column="organization_name" property="organizationName"/>
|
||||
<result column="plate_no" property="plateNo"/>
|
||||
<result column="plate_color" property="plateColor"/>
|
||||
<result column="vehicle_type" property="vehicleType"/>
|
||||
<result column="outer_length" property="outerLength"/>
|
||||
<result column="outer_width" property="outerWidth"/>
|
||||
@@ -30,6 +31,9 @@
|
||||
<result column="driving_license_end_date" property="drivingLicenseEndDate"/>
|
||||
<result column="driving_license_long_term" property="drivingLicenseLongTerm"/>
|
||||
<result column="driving_license_image" property="drivingLicenseImage"/>
|
||||
<result column="driving_license_main_back" property="drivingLicenseMainBack"/>
|
||||
<result column="driving_license_vice_front" property="drivingLicenseViceFront"/>
|
||||
<result column="driving_license_vice_back" property="drivingLicenseViceBack"/>
|
||||
<result column="road_transport_cert_no" property="roadTransportCertNo"/>
|
||||
<result column="road_transport_cert_start_date" property="roadTransportCertStartDate"/>
|
||||
<result column="road_transport_cert_end_date" property="roadTransportCertEndDate"/>
|
||||
@@ -55,6 +59,7 @@
|
||||
is_deleted,
|
||||
organization_name,
|
||||
plate_no,
|
||||
plate_color,
|
||||
vehicle_type,
|
||||
outer_length,
|
||||
outer_width,
|
||||
@@ -71,6 +76,9 @@
|
||||
driving_license_end_date,
|
||||
driving_license_long_term,
|
||||
driving_license_image,
|
||||
driving_license_main_back,
|
||||
driving_license_vice_front,
|
||||
driving_license_vice_back,
|
||||
road_transport_cert_no,
|
||||
road_transport_cert_start_date,
|
||||
road_transport_cert_end_date,
|
||||
|
||||
@@ -171,9 +171,33 @@ public class DriverServiceImpl extends BaseServiceImpl<DriverMapper, Driver> imp
|
||||
if (Func.isEmpty(driver.getIdCardNo())) {
|
||||
throw new ServiceException("身份证号不能为空");
|
||||
}
|
||||
if (Func.isEmpty(driver.getGender())) {
|
||||
throw new ServiceException("性别不能为空");
|
||||
}
|
||||
if (Func.isEmpty(driver.getPosts())) {
|
||||
throw new ServiceException("岗位不能为空");
|
||||
}
|
||||
if (Func.isEmpty(driver.getDrivingType())) {
|
||||
throw new ServiceException("准驾车型不能为空");
|
||||
}
|
||||
if (Func.isEmpty(driver.getDrivingLicenseNo())) {
|
||||
throw new ServiceException("驾驶证档案编号不能为空");
|
||||
}
|
||||
if (Func.isEmpty(driver.getDrivingLicenseStartDate())) {
|
||||
throw new ServiceException("驾驶证有效期起不能为空");
|
||||
}
|
||||
if (driver.getDrivingLicenseLongTerm() != 1 && Func.isEmpty(driver.getDrivingLicenseEndDate())) {
|
||||
throw new ServiceException("驾驶证有效期止不能为空");
|
||||
}
|
||||
if (Func.isEmpty(driver.getQualificationType())) {
|
||||
throw new ServiceException("从业资格认证类型不能为空");
|
||||
}
|
||||
if (Func.isEmpty(driver.getQualificationNo())) {
|
||||
throw new ServiceException("资格证号不能为空");
|
||||
}
|
||||
if (driver.getQualificationLongTerm() != 1 && Func.isEmpty(driver.getQualificationEndDate())) {
|
||||
throw new ServiceException("从业资格证有效期不能为空");
|
||||
}
|
||||
if (Func.isEmpty(driver.getDriverType())) {
|
||||
throw new ServiceException("司机类型不能为空");
|
||||
}
|
||||
@@ -195,12 +219,6 @@ public class DriverServiceImpl extends BaseServiceImpl<DriverMapper, Driver> imp
|
||||
if (Func.isEmpty(driver.getDrivingLicenseFront()) || Func.isEmpty(driver.getDrivingLicenseBack())) {
|
||||
throw new ServiceException("驾驶证主页和副页不能为空");
|
||||
}
|
||||
if (driver.getDrivingLicenseLongTerm() != 1 && Func.isEmpty(driver.getDrivingLicenseEndDate())) {
|
||||
throw new ServiceException("驾驶证有效期止不能为空");
|
||||
}
|
||||
if (driver.getQualificationLongTerm() != 1 && Func.isNotEmpty(driver.getQualificationNo()) && Func.isEmpty(driver.getQualificationEndDate())) {
|
||||
throw new ServiceException("从业资格证有效期止不能为空");
|
||||
}
|
||||
validateLength(driver.getDriverName(), NAME_MAX_LENGTH, "司机姓名不能超过20字");
|
||||
validateLength(driver.getIdCardNo(), ID_CARD_MAX_LENGTH, "身份证号不能超过18字");
|
||||
validateLength(driver.getMobile(), MOBILE_MAX_LENGTH, "手机号不能超过20字");
|
||||
|
||||
@@ -41,6 +41,7 @@ import org.springblade.transport.service.ITransportShipService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@@ -58,6 +59,7 @@ public class TransportShipServiceImpl extends BaseServiceImpl<TransportShipMappe
|
||||
private static final int REMARK_MAX_LENGTH = 200;
|
||||
private static final int DEFAULT_ENABLED_STATUS = 1;
|
||||
private static final int DEFAULT_FALSE = 0;
|
||||
private static final BigDecimal ZERO = BigDecimal.ZERO;
|
||||
|
||||
@Override
|
||||
public IPage<TransportShipVO> selectTransportShipPage(IPage<TransportShipVO> page, TransportShipVO ship) {
|
||||
@@ -129,12 +131,21 @@ public class TransportShipServiceImpl extends BaseServiceImpl<TransportShipMappe
|
||||
ship.setShipName(trimToEmpty(ship.getShipName()));
|
||||
ship.setShipIdentifierNo(trimToEmpty(ship.getShipIdentifierNo()).toUpperCase());
|
||||
ship.setOrganizationName(trimToEmpty(ship.getOrganizationName()));
|
||||
ship.setNavigationArea(trimToEmpty(ship.getNavigationArea()));
|
||||
ship.setOwnershipRegistrationNo(trimToEmpty(ship.getOwnershipRegistrationNo()));
|
||||
ship.setInitialRegistrationNo(trimToEmpty(ship.getInitialRegistrationNo()));
|
||||
ship.setShipOwner(trimToNull(ship.getShipOwner()));
|
||||
ship.setShipInspectionNo(trimToNull(ship.getShipInspectionNo()));
|
||||
ship.setShipType(trimToEmpty(ship.getShipType()));
|
||||
ship.setOwnershipCertImage(trimToNull(ship.getOwnershipCertImage()));
|
||||
ship.setSafetyCertImage(trimToNull(ship.getSafetyCertImage()));
|
||||
ship.setNationalityCertImage(trimToNull(ship.getNationalityCertImage()));
|
||||
ship.setSafeManningCertImage(trimToNull(ship.getSafeManningCertImage()));
|
||||
ship.setBusinessTransportCertNo(trimToEmpty(ship.getBusinessTransportCertNo()));
|
||||
ship.setBusinessTransportCertImage(trimToNull(ship.getBusinessTransportCertImage()));
|
||||
ship.setLeaseContractImage(trimToNull(ship.getLeaseContractImage()));
|
||||
ship.setShipLessee(trimToNull(ship.getShipLessee()));
|
||||
ship.setShipOperator(trimToNull(ship.getShipOperator()));
|
||||
ship.setRemark(trimToNull(ship.getRemark()));
|
||||
if (ship.getNationalityCertLongTerm() == null) {
|
||||
ship.setNationalityCertLongTerm(DEFAULT_FALSE);
|
||||
@@ -163,14 +174,43 @@ public class TransportShipServiceImpl extends BaseServiceImpl<TransportShipMappe
|
||||
if (Func.isEmpty(ship.getOrganizationName())) {
|
||||
throw new ServiceException("所属组织不能为空");
|
||||
}
|
||||
if (Func.isEmpty(ship.getNavigationArea())) {
|
||||
throw new ServiceException("航区不能为空");
|
||||
}
|
||||
if (!"A级".equals(ship.getNavigationArea()) && !"B级".equals(ship.getNavigationArea())) {
|
||||
throw new ServiceException("航区只能选择A级或B级");
|
||||
}
|
||||
if (Func.isEmpty(ship.getOwnershipRegistrationNo())) {
|
||||
throw new ServiceException("登记号码不能为空");
|
||||
}
|
||||
if (Func.isEmpty(ship.getInitialRegistrationNo())) {
|
||||
throw new ServiceException("初次登记号码不能为空");
|
||||
}
|
||||
if (Func.isEmpty(ship.getGrossTonnage())) {
|
||||
throw new ServiceException("总吨不能为空");
|
||||
}
|
||||
if (Func.isEmpty(ship.getNetTonnage())) {
|
||||
throw new ServiceException("净吨不能为空");
|
||||
}
|
||||
if (Func.isEmpty(ship.getShipInspectionNo())) {
|
||||
throw new ServiceException("船检登记号不能为空");
|
||||
}
|
||||
if (Func.isEmpty(ship.getShipType())) {
|
||||
throw new ServiceException("船舶类型不能为空");
|
||||
}
|
||||
if (ship.getNationalityCertLongTerm() != 1 && Func.isEmpty(ship.getNationalityCertEndDate())) {
|
||||
throw new ServiceException("国籍证有效期至不能为空");
|
||||
if (ship.getNationalityCertLongTerm() != 1
|
||||
&& (Func.isEmpty(ship.getNationalityCertStartDate()) || Func.isEmpty(ship.getNationalityCertEndDate()))) {
|
||||
throw new ServiceException("船舶国籍证书有效期不能为空");
|
||||
}
|
||||
if (ship.getSafeManningCertLongTerm() != 1 && Func.isEmpty(ship.getSafeManningCertEndDate())) {
|
||||
throw new ServiceException("最低安全配员证书有效期至不能为空");
|
||||
if (ship.getSafeManningCertLongTerm() != 1
|
||||
&& (Func.isEmpty(ship.getSafeManningCertStartDate()) || Func.isEmpty(ship.getSafeManningCertEndDate()))) {
|
||||
throw new ServiceException("最低安全配员证书有效期不能为空");
|
||||
}
|
||||
if (Func.isEmpty(ship.getBusinessTransportCertNo())) {
|
||||
throw new ServiceException("营业运输证证书编号不能为空");
|
||||
}
|
||||
if (Func.isEmpty(ship.getBusinessTransportCertIssueDate())) {
|
||||
throw new ServiceException("营业运输证发证日期不能为空");
|
||||
}
|
||||
if (ship.getBusinessTransportCertLongTerm() != 1 && Func.isEmpty(ship.getBusinessTransportCertEndDate())) {
|
||||
throw new ServiceException("营业运输证有效期至不能为空");
|
||||
@@ -178,9 +218,29 @@ public class TransportShipServiceImpl extends BaseServiceImpl<TransportShipMappe
|
||||
validateLength(ship.getShipName(), NAME_MAX_LENGTH, "船舶名不能超过50字");
|
||||
validateLength(ship.getShipIdentifierNo(), SHORT_TEXT_MAX_LENGTH, "船舶识别号不能超过50字");
|
||||
validateLength(ship.getOrganizationName(), NAME_MAX_LENGTH, "所属组织不能超过50字");
|
||||
validateLength(ship.getNavigationArea(), SHORT_TEXT_MAX_LENGTH, "航区不能超过50字");
|
||||
validateLength(ship.getOwnershipRegistrationNo(), SHORT_TEXT_MAX_LENGTH, "登记号码不能超过50字");
|
||||
validateLength(ship.getInitialRegistrationNo(), SHORT_TEXT_MAX_LENGTH, "初次登记号码不能超过50字");
|
||||
validateLength(ship.getShipOwner(), NAME_MAX_LENGTH, "船舶所有人不能超过50字");
|
||||
validateLength(ship.getShipInspectionNo(), SHORT_TEXT_MAX_LENGTH, "船检登记号不能超过50字");
|
||||
validateLength(ship.getShipType(), SHORT_TEXT_MAX_LENGTH, "船舶类型不能超过50字");
|
||||
validateLength(ship.getBusinessTransportCertNo(), SHORT_TEXT_MAX_LENGTH, "营业运输证证书编号不能超过50字");
|
||||
validateLength(ship.getShipLessee(), NAME_MAX_LENGTH, "船舶承租人不能超过50字");
|
||||
validateLength(ship.getShipOperator(), NAME_MAX_LENGTH, "船舶经营人不能超过50字");
|
||||
validateLength(ship.getRemark(), REMARK_MAX_LENGTH, "备注不能超过200字");
|
||||
validateNonNegative(ship.getTotalLength(), "总长不能小于0");
|
||||
validateNonNegative(ship.getShipWidth(), "船宽不能小于0");
|
||||
validateNonNegative(ship.getMoldedDepth(), "型深不能小于0");
|
||||
validateNonNegative(ship.getMaxShipHeight(), "最大船高不能小于0");
|
||||
validateNonNegative(ship.getLightDraft(), "空载吃水不能小于0");
|
||||
validateNonNegative(ship.getFullLoadDraft(), "满载吃水不能小于0");
|
||||
validateNonNegative(ship.getGrossTonnage(), "总吨不能小于0");
|
||||
validateNonNegative(ship.getNetTonnage(), "净吨不能小于0");
|
||||
validateDateRange(ship.getKeelLayingDate(), ship.getBuildCompletionDate(), "建造完工日期不能早于安放龙骨日期");
|
||||
validateDateRange(ship.getNationalityCertStartDate(), ship.getNationalityCertEndDate(), "国籍证结束日期不能早于开始日期");
|
||||
validateDateRange(ship.getSafeManningCertStartDate(), ship.getSafeManningCertEndDate(), "最低安全配员证书结束日期不能早于开始日期");
|
||||
validateDateRange(ship.getLeaseStartDate(), ship.getLeaseEndDate(), "终止日期不能早于起租日期");
|
||||
validateDateRange(ship.getBusinessTransportCertIssueDate(), ship.getBusinessTransportCertEndDate(), "营业运输证有效期至不能早于发证日期");
|
||||
}
|
||||
|
||||
private void checkUniqueIdentifier(TransportShip ship) {
|
||||
@@ -199,6 +259,18 @@ public class TransportShipServiceImpl extends BaseServiceImpl<TransportShipMappe
|
||||
}
|
||||
}
|
||||
|
||||
private void validateNonNegative(BigDecimal value, String message) {
|
||||
if (value != null && value.compareTo(ZERO) < 0) {
|
||||
throw new ServiceException(message);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateDateRange(LocalDate startDate, LocalDate endDate, String message) {
|
||||
if (startDate != null && endDate != null && endDate.isBefore(startDate)) {
|
||||
throw new ServiceException(message);
|
||||
}
|
||||
}
|
||||
|
||||
private Long defaultZero(Long value) {
|
||||
return value == null ? 0L : value;
|
||||
}
|
||||
|
||||
@@ -130,6 +130,7 @@ public class TransportVehicleServiceImpl extends BaseServiceImpl<TransportVehicl
|
||||
private void prepare(TransportVehicle vehicle) {
|
||||
vehicle.setOrganizationName(trimToEmpty(vehicle.getOrganizationName()));
|
||||
vehicle.setPlateNo(trimToEmpty(vehicle.getPlateNo()).toUpperCase());
|
||||
vehicle.setPlateColor(trimToNull(vehicle.getPlateColor()));
|
||||
vehicle.setVehicleType(trimToEmpty(vehicle.getVehicleType()));
|
||||
vehicle.setBusinessRelation(trimToEmpty(vehicle.getBusinessRelation()));
|
||||
vehicle.setEnergyType(trimToEmpty(vehicle.getEnergyType()));
|
||||
@@ -138,6 +139,9 @@ public class TransportVehicleServiceImpl extends BaseServiceImpl<TransportVehicl
|
||||
vehicle.setRoadTransportCertNo(trimToEmpty(vehicle.getRoadTransportCertNo()));
|
||||
vehicle.setRegistrationNo(trimToEmpty(vehicle.getRegistrationNo()));
|
||||
vehicle.setDrivingLicenseImage(trimToNull(vehicle.getDrivingLicenseImage()));
|
||||
vehicle.setDrivingLicenseMainBack(trimToNull(vehicle.getDrivingLicenseMainBack()));
|
||||
vehicle.setDrivingLicenseViceFront(trimToNull(vehicle.getDrivingLicenseViceFront()));
|
||||
vehicle.setDrivingLicenseViceBack(trimToNull(vehicle.getDrivingLicenseViceBack()));
|
||||
vehicle.setRoadTransportCertImage(trimToNull(vehicle.getRoadTransportCertImage()));
|
||||
vehicle.setRegistrationImage(trimToNull(vehicle.getRegistrationImage()));
|
||||
vehicle.setRemark(trimToNull(vehicle.getRemark()));
|
||||
@@ -168,6 +172,9 @@ public class TransportVehicleServiceImpl extends BaseServiceImpl<TransportVehicl
|
||||
if (!PLATE_NO_PATTERN.matcher(vehicle.getPlateNo()).matches()) {
|
||||
throw new ServiceException("车牌号格式不正确");
|
||||
}
|
||||
if (Func.isEmpty(vehicle.getPlateColor())) {
|
||||
throw new ServiceException("车牌颜色不能为空");
|
||||
}
|
||||
if (Func.isEmpty(vehicle.getVehicleType())) {
|
||||
throw new ServiceException("车辆类型不能为空");
|
||||
}
|
||||
@@ -183,14 +190,14 @@ public class TransportVehicleServiceImpl extends BaseServiceImpl<TransportVehicl
|
||||
if (Func.isEmpty(vehicle.getDrivingLicenseNo())) {
|
||||
throw new ServiceException("行驶证档案编号不能为空");
|
||||
}
|
||||
if (vehicle.getDrivingLicenseLongTerm() != 1 && Func.isEmpty(vehicle.getDrivingLicenseEndDate())) {
|
||||
throw new ServiceException("行驶证有效期止不能为空");
|
||||
if (Func.isEmpty(vehicle.getDrivingLicenseEndDate())) {
|
||||
throw new ServiceException("行驶证有效期不能为空");
|
||||
}
|
||||
if (Func.isEmpty(vehicle.getRoadTransportCertNo())) {
|
||||
throw new ServiceException("道路运输证号不能为空");
|
||||
}
|
||||
if (vehicle.getRoadTransportCertLongTerm() != 1 && Func.isEmpty(vehicle.getRoadTransportCertEndDate())) {
|
||||
throw new ServiceException("道路运输证有效期止不能为空");
|
||||
if (Func.isEmpty(vehicle.getRoadTransportCertEndDate())) {
|
||||
throw new ServiceException("道路运输证有效期不能为空");
|
||||
}
|
||||
if (vehicle.getAnnualReviewLongTerm() != 1 && Func.isEmpty(vehicle.getAnnualReviewEndDate())) {
|
||||
throw new ServiceException("道路运输年审有效期不能为空");
|
||||
@@ -204,6 +211,7 @@ public class TransportVehicleServiceImpl extends BaseServiceImpl<TransportVehicl
|
||||
validateNonNegative(vehicle.getApprovedLoadKg(), "核定载质量不能小于0");
|
||||
validateNonNegative(vehicle.getTractionMassKg(), "准牵引总质量不能小于0");
|
||||
validateLength(vehicle.getOrganizationName(), ORG_MAX_LENGTH, "所属组织不能超过50字");
|
||||
validateLength(vehicle.getPlateColor(), SHORT_TEXT_MAX_LENGTH, "车牌颜色不能超过50字");
|
||||
validateLength(vehicle.getVehicleType(), SHORT_TEXT_MAX_LENGTH, "车辆类型不能超过50字");
|
||||
validateLength(vehicle.getBusinessRelation(), SHORT_TEXT_MAX_LENGTH, "业务关系不能超过50字");
|
||||
validateLength(vehicle.getEnergyType(), SHORT_TEXT_MAX_LENGTH, "能源类型不能超过50字");
|
||||
|
||||
Reference in New Issue
Block a user