fix bug
This commit is contained in:
+1
-1
@@ -158,7 +158,7 @@ public class AirportMasterController extends BladeController {
|
||||
}
|
||||
List<AirportMasterExcel> failureList = airportMasterService.importAirportMaster(ExcelUtil.read(file, AirportMasterExcel.class));
|
||||
if (Func.isNotEmpty(failureList)) {
|
||||
org.springblade.common.excel.ImportFailureExcelUtil.export(response, "空港机场主数据导入失败明细" + DateUtil.time(), "导入失败明细", failureList, AirportMasterExcel.class);
|
||||
org.springblade.common.excel.ImportFailureExcelUtil.exportFailureReasonOnly(response, "空港机场主数据导入失败明细" + DateUtil.time(), "导入失败明细", failureList, AirportMasterExcel.class);
|
||||
return null;
|
||||
}
|
||||
return R.success("操作成功");
|
||||
|
||||
+20
-4
@@ -77,7 +77,11 @@ public class PortTerminalController 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 SOURCE_INITIAL = "初始化导入";
|
||||
private static final String SOURCE_INITIAL = "初始化录入";
|
||||
private static final String SOURCE_INITIAL_IMPORT = "初始化导入";
|
||||
private static final String SOURCE_INITIAL_OLD = "初始导入";
|
||||
private static final String SOURCE_MANUAL = "手动录入";
|
||||
private static final String SOURCE_MANUAL_OLD = "手工导入";
|
||||
|
||||
private final IPortTerminalService portTerminalService;
|
||||
|
||||
@@ -95,6 +99,7 @@ public class PortTerminalController extends BladeController {
|
||||
if (Func.isEmpty(detail)) {
|
||||
return R.fail("港口码头不存在");
|
||||
}
|
||||
detail.setDataSource(normalizeDataSource(detail.getDataSource()));
|
||||
return R.data(PortTerminalWrapper.build().entityVO(detail));
|
||||
}
|
||||
|
||||
@@ -150,7 +155,9 @@ public class PortTerminalController extends BladeController {
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "上级港口下拉数据源")
|
||||
public R<List<PortTerminal>> portSelect() {
|
||||
return R.data(portTerminalService.selectEnabledPorts());
|
||||
List<PortTerminal> ports = portTerminalService.selectEnabledPorts();
|
||||
ports.forEach(port -> port.setDataSource(normalizeDataSource(port.getDataSource())));
|
||||
return R.data(ports);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,7 +176,7 @@ public class PortTerminalController extends BladeController {
|
||||
}
|
||||
List<PortTerminalExcel> failureList = portTerminalService.importPortTerminal(ExcelUtil.read(file, PortTerminalExcel.class));
|
||||
if (Func.isNotEmpty(failureList)) {
|
||||
org.springblade.common.excel.ImportFailureExcelUtil.export(response, "港口码头主数据导入失败明细" + DateUtil.time(), "导入失败明细", failureList, PortTerminalExcel.class);
|
||||
org.springblade.common.excel.ImportFailureExcelUtil.exportFailureReasonOnly(response, "港口码头主数据导入失败明细" + DateUtil.time(), "导入失败明细", failureList, PortTerminalExcel.class);
|
||||
return null;
|
||||
}
|
||||
return R.success("操作成功");
|
||||
@@ -237,10 +244,19 @@ public class PortTerminalController extends BladeController {
|
||||
return;
|
||||
}
|
||||
if (SOURCE_INITIAL.equals(value)) {
|
||||
queryWrapper.in("data_source", SOURCE_INITIAL, "初始导入");
|
||||
queryWrapper.in("data_source", SOURCE_INITIAL, SOURCE_INITIAL_IMPORT, SOURCE_INITIAL_OLD);
|
||||
} else if (SOURCE_MANUAL.equals(value)) {
|
||||
queryWrapper.in("data_source", SOURCE_MANUAL, SOURCE_MANUAL_OLD);
|
||||
} else {
|
||||
queryWrapper.eq("data_source", value);
|
||||
}
|
||||
}
|
||||
|
||||
private String normalizeDataSource(String dataSource) {
|
||||
if (SOURCE_INITIAL_IMPORT.equals(dataSource) || SOURCE_INITIAL_OLD.equals(dataSource)) {
|
||||
return SOURCE_INITIAL;
|
||||
}
|
||||
return SOURCE_MANUAL_OLD.equals(dataSource) ? SOURCE_MANUAL : dataSource;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -161,7 +161,7 @@ public class RailwayStationController extends BladeController {
|
||||
}
|
||||
List<RailwayStationExcel> failureList = railwayStationService.importRailwayStation(ExcelUtil.read(file, RailwayStationExcel.class));
|
||||
if (Func.isNotEmpty(failureList)) {
|
||||
org.springblade.common.excel.ImportFailureExcelUtil.export(response, "铁路车站主数据导入失败明细" + DateUtil.time(), "导入失败明细", failureList, RailwayStationExcel.class);
|
||||
org.springblade.common.excel.ImportFailureExcelUtil.exportFailureReasonOnly(response, "铁路车站主数据导入失败明细" + DateUtil.time(), "导入失败明细", failureList, RailwayStationExcel.class);
|
||||
return null;
|
||||
}
|
||||
return R.success("操作成功");
|
||||
|
||||
+1
@@ -16,6 +16,7 @@
|
||||
<result column="fee_category" property="feeCategory"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="english_name" property="englishName"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectFeeItemPage" resultMap="feeItemResultMap">
|
||||
|
||||
+10
-3
@@ -54,7 +54,11 @@
|
||||
pt.detail_address,
|
||||
CASE WHEN pt.longitude BETWEEN -180 AND 180 THEN pt.longitude ELSE NULL END AS longitude,
|
||||
CASE WHEN pt.latitude BETWEEN -90 AND 90 THEN pt.latitude ELSE NULL END AS latitude,
|
||||
CASE WHEN pt.data_source = '初始导入' THEN '初始化导入' ELSE pt.data_source END AS data_source,
|
||||
CASE
|
||||
WHEN pt.data_source IN ('初始化导入', '初始导入') THEN '初始化录入'
|
||||
WHEN pt.data_source = '手工导入' THEN '手动录入'
|
||||
ELSE pt.data_source
|
||||
END AS data_source,
|
||||
pt.remark
|
||||
FROM
|
||||
blade_port_terminal pt
|
||||
@@ -77,8 +81,11 @@
|
||||
</if>
|
||||
<if test="portTerminal.dataSource != null and portTerminal.dataSource != ''">
|
||||
<choose>
|
||||
<when test="portTerminal.dataSource == '初始化导入'">
|
||||
AND pt.data_source IN ('初始化导入', '初始导入')
|
||||
<when test="portTerminal.dataSource == '初始化录入'">
|
||||
AND pt.data_source IN ('初始化录入', '初始化导入', '初始导入')
|
||||
</when>
|
||||
<when test="portTerminal.dataSource == '手动录入'">
|
||||
AND pt.data_source IN ('手动录入', '手工导入')
|
||||
</when>
|
||||
<otherwise>
|
||||
AND pt.data_source = #{portTerminal.dataSource}
|
||||
|
||||
+18
-9
@@ -181,7 +181,7 @@ public class AirportMasterServiceImpl extends BaseServiceImpl<AirportMasterMappe
|
||||
private void normalizeImportAirportMaster(AirportMaster airportMaster) {
|
||||
airportMaster.setIataCode(trimToEmpty(airportMaster.getIataCode()).toUpperCase(Locale.ROOT));
|
||||
airportMaster.setCode(CODE_PREFIX + airportMaster.getIataCode());
|
||||
airportMaster.setIcaoCode(trimToEmpty(airportMaster.getIcaoCode()).toUpperCase(Locale.ROOT));
|
||||
airportMaster.setIcaoCode(normalizeOptionalCode(airportMaster.getIcaoCode()));
|
||||
airportMaster.setName(trimToEmpty(airportMaster.getName()));
|
||||
airportMaster.setShortName(trimToNull(airportMaster.getShortName()));
|
||||
airportMaster.setProvinceCode(trimToNull(airportMaster.getProvinceCode()));
|
||||
@@ -213,9 +213,7 @@ public class AirportMasterServiceImpl extends BaseServiceImpl<AirportMasterMappe
|
||||
validateImportUnique(AirportMaster::getIataCode, airportMaster.getIataCode(), "该IATA编码已存在", validationErrors);
|
||||
validateImportUnique(AirportMaster::getCode, airportMaster.getCode(), "该编码已存在", validationErrors);
|
||||
}
|
||||
if (Func.isEmpty(airportMaster.getIcaoCode())) {
|
||||
addValidationError(validationErrors, "ICAO代码不能为空");
|
||||
} else {
|
||||
if (Func.isNotEmpty(airportMaster.getIcaoCode())) {
|
||||
if (!ICAO_CODE_PATTERN.matcher(airportMaster.getIcaoCode()).matches()) {
|
||||
addValidationError(validationErrors, "ICAO代码为4位大写字母");
|
||||
}
|
||||
@@ -234,6 +232,9 @@ public class AirportMasterServiceImpl extends BaseServiceImpl<AirportMasterMappe
|
||||
validateImportLength(airportMaster.getCityName(), REGION_NAME_MAX_LENGTH, "所属城市不能超过128字", validationErrors);
|
||||
validateImportLength(airportMaster.getDistrictName(), REGION_NAME_MAX_LENGTH, "所属区县不能超过128字", validationErrors);
|
||||
validateImportLength(airportMaster.getRegionCode(), REGION_CODE_MAX_LENGTH, "行政区划编号不能超过32字", validationErrors);
|
||||
if (Func.isEmpty(airportMaster.getDetailAddress())) {
|
||||
addValidationError(validationErrors, "详细地址不能为空");
|
||||
}
|
||||
validateImportLength(airportMaster.getDetailAddress(), DETAIL_ADDRESS_MAX_LENGTH, "详细地址不能超过255字", validationErrors);
|
||||
validateImportLength(airportMaster.getRemark(), REMARK_MAX_LENGTH, "备注不能超过200字", validationErrors);
|
||||
if (Func.isEmpty(airportMaster.getLongitude())) {
|
||||
@@ -328,7 +329,7 @@ public class AirportMasterServiceImpl extends BaseServiceImpl<AirportMasterMappe
|
||||
private void prepare(AirportMaster airportMaster, String defaultDataSource) {
|
||||
airportMaster.setIataCode(trimToEmpty(airportMaster.getIataCode()).toUpperCase(Locale.ROOT));
|
||||
airportMaster.setCode(CODE_PREFIX + airportMaster.getIataCode());
|
||||
airportMaster.setIcaoCode(trimToEmpty(airportMaster.getIcaoCode()).toUpperCase(Locale.ROOT));
|
||||
airportMaster.setIcaoCode(normalizeOptionalCode(airportMaster.getIcaoCode()));
|
||||
airportMaster.setName(trimToEmpty(airportMaster.getName()));
|
||||
airportMaster.setShortName(trimToNull(airportMaster.getShortName()));
|
||||
airportMaster.setProvinceCode(trimToNull(airportMaster.getProvinceCode()));
|
||||
@@ -361,10 +362,7 @@ public class AirportMasterServiceImpl extends BaseServiceImpl<AirportMasterMappe
|
||||
if (!IATA_CODE_PATTERN.matcher(airportMaster.getIataCode()).matches()) {
|
||||
throw new ServiceException("IATA编码为3位大写字母");
|
||||
}
|
||||
if (Func.isEmpty(airportMaster.getIcaoCode())) {
|
||||
throw new ServiceException("ICAO代码不能为空");
|
||||
}
|
||||
if (!ICAO_CODE_PATTERN.matcher(airportMaster.getIcaoCode()).matches()) {
|
||||
if (Func.isNotEmpty(airportMaster.getIcaoCode()) && !ICAO_CODE_PATTERN.matcher(airportMaster.getIcaoCode()).matches()) {
|
||||
throw new ServiceException("ICAO代码为4位大写字母");
|
||||
}
|
||||
if (Func.isEmpty(airportMaster.getName())) {
|
||||
@@ -383,6 +381,9 @@ public class AirportMasterServiceImpl extends BaseServiceImpl<AirportMasterMappe
|
||||
if (Func.isEmpty(airportMaster.getProvinceCode()) || Func.isEmpty(airportMaster.getCityCode()) || Func.isEmpty(airportMaster.getDistrictCode())) {
|
||||
throw new ServiceException("请选择省份、城市和区县");
|
||||
}
|
||||
if (Func.isEmpty(airportMaster.getDetailAddress())) {
|
||||
throw new ServiceException("详细地址不能为空");
|
||||
}
|
||||
validateCoordinate(airportMaster.getLongitude(), MIN_LONGITUDE, MAX_LONGITUDE, "经度");
|
||||
validateCoordinate(airportMaster.getLatitude(), MIN_LATITUDE, MAX_LATITUDE, "纬度");
|
||||
validateDataSource(airportMaster.getDataSource());
|
||||
@@ -479,6 +480,9 @@ public class AirportMasterServiceImpl extends BaseServiceImpl<AirportMasterMappe
|
||||
}
|
||||
|
||||
private void validateUnique(AirportMaster airportMaster, com.baomidou.mybatisplus.core.toolkit.support.SFunction<AirportMaster, ?> column, String value, String message) {
|
||||
if (Func.isEmpty(value)) {
|
||||
return;
|
||||
}
|
||||
LambdaQueryWrapper<AirportMaster> queryWrapper = Wrappers.<AirportMaster>lambdaQuery()
|
||||
.eq(column, value)
|
||||
.eq(AirportMaster::getIsDeleted, 0);
|
||||
@@ -499,6 +503,11 @@ public class AirportMasterServiceImpl extends BaseServiceImpl<AirportMasterMappe
|
||||
return trimValue.isEmpty() ? null : trimValue;
|
||||
}
|
||||
|
||||
private String normalizeOptionalCode(String value) {
|
||||
String normalizedValue = trimToNull(value);
|
||||
return normalizedValue == null ? null : normalizedValue.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
private String normalizeDataSource(String dataSource) {
|
||||
String value = trimToEmpty(dataSource);
|
||||
return SOURCE_MANUAL_OLD.equals(value) ? SOURCE_MANUAL : value;
|
||||
|
||||
+5
@@ -62,6 +62,7 @@ public class FeeItemServiceImpl extends BaseServiceImpl<FeeItemMapper, FeeItem>
|
||||
private static final int FEE_CATEGORY_MAX_LENGTH = 50;
|
||||
private static final int NAME_MAX_LENGTH = 50;
|
||||
private static final int ENGLISH_NAME_MAX_LENGTH = 100;
|
||||
private static final int REMARK_MAX_LENGTH = 200;
|
||||
|
||||
@Override
|
||||
public IPage<FeeItemVO> selectFeeItemPage(IPage<FeeItemVO> page, FeeItemVO feeItem) {
|
||||
@@ -126,6 +127,7 @@ public class FeeItemServiceImpl extends BaseServiceImpl<FeeItemMapper, FeeItem>
|
||||
feeItem.setFeeCategory(trimToEmpty(feeItem.getFeeCategory()));
|
||||
feeItem.setName(trimToEmpty(feeItem.getName()));
|
||||
feeItem.setEnglishName(trimToNull(feeItem.getEnglishName()));
|
||||
feeItem.setRemark(trimToNull(feeItem.getRemark()));
|
||||
appendFeeCategoryPrefix(feeItem);
|
||||
if (Func.isEmpty(feeItem.getStatus())) {
|
||||
feeItem.setStatus(STATUS_ENABLED);
|
||||
@@ -151,6 +153,9 @@ public class FeeItemServiceImpl extends BaseServiceImpl<FeeItemMapper, FeeItem>
|
||||
if (Func.isNotEmpty(feeItem.getEnglishName()) && feeItem.getEnglishName().length() > ENGLISH_NAME_MAX_LENGTH) {
|
||||
throw new ServiceException("费用项代码不能超过100字");
|
||||
}
|
||||
if (Func.isNotEmpty(feeItem.getRemark()) && feeItem.getRemark().length() > REMARK_MAX_LENGTH) {
|
||||
throw new ServiceException("备注不能超过200个字");
|
||||
}
|
||||
validateUniqueName(feeItem);
|
||||
}
|
||||
|
||||
|
||||
+14
-3
@@ -66,10 +66,12 @@ public class PortTerminalServiceImpl extends BaseServiceImpl<PortTerminalMapper,
|
||||
|
||||
private static final String CATEGORY_PORT = "港口";
|
||||
private static final String CATEGORY_TERMINAL = "码头";
|
||||
private static final String SOURCE_INITIAL = "初始化导入";
|
||||
private static final String SOURCE_INITIAL = "初始化录入";
|
||||
private static final String SOURCE_INITIAL_IMPORT = "初始化导入";
|
||||
private static final String SOURCE_INITIAL_OLD = "初始导入";
|
||||
private static final String SOURCE_BATCH = "批量导入";
|
||||
private static final String SOURCE_MANUAL = "手工导入";
|
||||
private static final String SOURCE_MANUAL = "手动录入";
|
||||
private static final String SOURCE_MANUAL_OLD = "手工导入";
|
||||
private static final int STATUS_ENABLED = 1;
|
||||
private static final int STATUS_DISABLED = 2;
|
||||
private static final int CODE_MAX_LENGTH = 30;
|
||||
@@ -248,6 +250,9 @@ public class PortTerminalServiceImpl extends BaseServiceImpl<PortTerminalMapper,
|
||||
validateImportLength(portTerminal.getCity(), REGION_MAX_LENGTH, "城市不能超过50字", validationErrors);
|
||||
validateImportLength(portTerminal.getDistrictName(), REGION_MAX_LENGTH, "区县不能超过50字", validationErrors);
|
||||
validateImportLength(portTerminal.getRegionCode(), REGION_CODE_MAX_LENGTH, "行政区划编码不能超过32字", validationErrors);
|
||||
if (Func.isEmpty(portTerminal.getDetailAddress())) {
|
||||
addValidationError(validationErrors, "详细地址不能为空");
|
||||
}
|
||||
validateImportLength(portTerminal.getDetailAddress(), DETAIL_ADDRESS_MAX_LENGTH, "详细地址不能超过255字", validationErrors);
|
||||
validateImportLength(portTerminal.getRemark(), REMARK_MAX_LENGTH, "备注不能超过200个字", validationErrors);
|
||||
if (Func.isEmpty(portTerminal.getLongitude())) {
|
||||
@@ -471,6 +476,9 @@ public class PortTerminalServiceImpl extends BaseServiceImpl<PortTerminalMapper,
|
||||
if (Func.isEmpty(portTerminal.getDistrictCode())) {
|
||||
throw new ServiceException("区县不能为空");
|
||||
}
|
||||
if (Func.isEmpty(portTerminal.getDetailAddress())) {
|
||||
throw new ServiceException("详细地址不能为空");
|
||||
}
|
||||
validateDataSource(portTerminal.getDataSource());
|
||||
validateStatus(portTerminal.getStatus());
|
||||
validateRange(portTerminal.getLongitude(), MIN_LONGITUDE, MAX_LONGITUDE, "经度范围为 -180 到 180");
|
||||
@@ -523,7 +531,10 @@ public class PortTerminalServiceImpl extends BaseServiceImpl<PortTerminalMapper,
|
||||
|
||||
private String normalizeDataSource(String dataSource) {
|
||||
String value = trimToEmpty(dataSource);
|
||||
return SOURCE_INITIAL_OLD.equals(value) ? SOURCE_INITIAL : value;
|
||||
if (SOURCE_INITIAL_IMPORT.equals(value) || SOURCE_INITIAL_OLD.equals(value)) {
|
||||
return SOURCE_INITIAL;
|
||||
}
|
||||
return SOURCE_MANUAL_OLD.equals(value) ? SOURCE_MANUAL : value;
|
||||
}
|
||||
|
||||
private void validateEnabledTerminal(Long parentId) {
|
||||
|
||||
+6
@@ -251,6 +251,9 @@ public class RailwayStationServiceImpl extends BaseServiceImpl<RailwayStationMap
|
||||
validateImportLength(railwayStation.getCityName(), REGION_NAME_MAX_LENGTH, "所属城市不能超过128字", validationErrors);
|
||||
validateImportLength(railwayStation.getDistrictName(), REGION_NAME_MAX_LENGTH, "所属区县不能超过128字", validationErrors);
|
||||
validateImportLength(railwayStation.getRegionCode(), REGION_CODE_MAX_LENGTH, "行政区划编号不能超过32字", validationErrors);
|
||||
if (Func.isEmpty(railwayStation.getDetailAddress())) {
|
||||
addValidationError(validationErrors, "详细地址不能为空");
|
||||
}
|
||||
validateImportLength(railwayStation.getDetailAddress(), DETAIL_ADDRESS_MAX_LENGTH, "详细地址不能超过255字", validationErrors);
|
||||
validateImportLength(railwayStation.getRemark(), REMARK_MAX_LENGTH, "备注不能超过200字", validationErrors);
|
||||
validateImportCoordinate(railwayStation.getLongitude(), MIN_LONGITUDE, MAX_LONGITUDE, "经度", validationErrors);
|
||||
@@ -416,6 +419,9 @@ public class RailwayStationServiceImpl extends BaseServiceImpl<RailwayStationMap
|
||||
if (Func.isEmpty(railwayStation.getDistrictCode())) {
|
||||
throw new ServiceException("请选择所属区县");
|
||||
}
|
||||
if (Func.isEmpty(railwayStation.getDetailAddress())) {
|
||||
throw new ServiceException("详细地址不能为空");
|
||||
}
|
||||
validateCoordinate(railwayStation.getLongitude(), MIN_LONGITUDE, MAX_LONGITUDE, "经度");
|
||||
validateCoordinate(railwayStation.getLatitude(), MIN_LATITUDE, MAX_LATITUDE, "纬度");
|
||||
validateDataSource(railwayStation.getDataSource());
|
||||
|
||||
Reference in New Issue
Block a user