fix bug
This commit is contained in:
@@ -121,9 +121,9 @@ public class RegionController extends BladeController {
|
||||
})
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "懒加载列表", description = "传入menu")
|
||||
public R<List<RegionVO>> lazyTree(String parentCode, @Parameter(hidden = true) @RequestParam Map<String, Object> menu) {
|
||||
List<RegionVO> list = regionService.lazyTree(parentCode, menu);
|
||||
return R.data(RegionWrapper.build().listNodeLazyVO(list));
|
||||
public R<List<Map<String, Object>>> lazyTree(String parentCode, @Parameter(hidden = true) @RequestParam Map<String, Object> menu) {
|
||||
List<Map<String, Object>> list = regionService.lazyTree(parentCode, menu);
|
||||
return R.data(list);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -173,7 +173,7 @@ public class RegionController extends BladeController {
|
||||
@GetMapping("/select")
|
||||
@ApiOperationSupport(order = 9)
|
||||
@Operation(summary = "下拉数据源", description = "传入tenant")
|
||||
public R<List<Region>> select(@RequestParam(required = false, defaultValue = "00") String code) {
|
||||
public R<List<Region>> select(@RequestParam(required = false, defaultValue = "+86") String code) {
|
||||
List<Region> list = regionService.list(Wrappers.<Region>query().lambda().eq(Region::getParentCode, code));
|
||||
return R.data(list);
|
||||
}
|
||||
|
||||
@@ -73,6 +73,12 @@ public class AirportMasterExcel implements Serializable {
|
||||
@ExcelProperty("所属城市")
|
||||
private String cityName;
|
||||
|
||||
@ExcelProperty("行政区划")
|
||||
private String regionName;
|
||||
|
||||
@ExcelProperty("详细地址")
|
||||
private String detailAddress;
|
||||
|
||||
@ExcelProperty("经度")
|
||||
private BigDecimal longitude;
|
||||
|
||||
|
||||
@@ -64,8 +64,8 @@ public class RailwayStationExcel implements Serializable {
|
||||
@ExcelProperty("车站名称")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("所属铁路线路")
|
||||
private String railwayLine;
|
||||
// @ExcelProperty("所属铁路线路")
|
||||
// private String railwayLine;
|
||||
|
||||
@ExcelProperty("所属省份")
|
||||
private String provinceName;
|
||||
@@ -73,6 +73,12 @@ public class RailwayStationExcel implements Serializable {
|
||||
@ExcelProperty("所属城市")
|
||||
private String cityName;
|
||||
|
||||
@ExcelProperty("行政区划")
|
||||
private String regionName;
|
||||
|
||||
@ExcelProperty("详细地址")
|
||||
private String detailAddress;
|
||||
|
||||
@ExcelProperty("经度")
|
||||
private BigDecimal longitude;
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_user_name" property="updateUserName"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
@@ -20,6 +21,9 @@
|
||||
<result column="province_name" property="provinceName"/>
|
||||
<result column="city_code" property="cityCode"/>
|
||||
<result column="city_name" property="cityName"/>
|
||||
<result column="region_code" property="regionCode"/>
|
||||
<result column="region_name" property="regionName"/>
|
||||
<result column="detail_address" property="detailAddress"/>
|
||||
<result column="longitude" property="longitude"/>
|
||||
<result column="latitude" property="latitude"/>
|
||||
<result column="data_source" property="dataSource"/>
|
||||
@@ -28,59 +32,72 @@
|
||||
|
||||
<select id="selectAirportMasterPage" resultMap="airportMasterResultMap">
|
||||
SELECT
|
||||
id,
|
||||
create_user,
|
||||
create_dept,
|
||||
create_time,
|
||||
update_user,
|
||||
update_time,
|
||||
status,
|
||||
is_deleted,
|
||||
code,
|
||||
iata_code,
|
||||
icao_code,
|
||||
name,
|
||||
short_name,
|
||||
province_code,
|
||||
province_name,
|
||||
city_code,
|
||||
city_name,
|
||||
longitude,
|
||||
latitude,
|
||||
CASE WHEN data_source = '手工导入' THEN '手动录入' ELSE data_source END AS data_source,
|
||||
remark
|
||||
am.id,
|
||||
am.create_user,
|
||||
am.create_dept,
|
||||
am.create_time,
|
||||
am.update_user,
|
||||
bu.real_name AS update_user_name,
|
||||
am.update_time,
|
||||
am.status,
|
||||
am.is_deleted,
|
||||
am.code,
|
||||
am.iata_code,
|
||||
am.icao_code,
|
||||
am.name,
|
||||
am.short_name,
|
||||
am.province_code,
|
||||
am.province_name,
|
||||
am.city_code,
|
||||
am.city_name,
|
||||
am.region_code,
|
||||
am.region_name,
|
||||
am.detail_address,
|
||||
am.longitude,
|
||||
am.latitude,
|
||||
CASE WHEN am.data_source = '手工导入' THEN '手动录入' ELSE am.data_source END AS data_source,
|
||||
am.remark
|
||||
FROM
|
||||
blade_airport_master
|
||||
blade_airport_master am
|
||||
LEFT JOIN blade_user bu ON bu.id = am.update_user
|
||||
WHERE
|
||||
is_deleted = 0
|
||||
am.is_deleted = 0
|
||||
<if test="airportMaster.code != null and airportMaster.code != ''">
|
||||
<bind name="codeLike" value="'%' + airportMaster.code + '%'"/>
|
||||
AND code LIKE #{codeLike}
|
||||
AND am.code LIKE #{codeLike}
|
||||
</if>
|
||||
<if test="airportMaster.name != null and airportMaster.name != ''">
|
||||
<bind name="nameLike" value="'%' + airportMaster.name + '%'"/>
|
||||
AND name LIKE #{nameLike}
|
||||
AND am.name LIKE #{nameLike}
|
||||
</if>
|
||||
<if test="airportMaster.iataCode != null and airportMaster.iataCode != ''">
|
||||
AND iata_code = #{airportMaster.iataCode}
|
||||
AND am.iata_code = #{airportMaster.iataCode}
|
||||
</if>
|
||||
<if test="airportMaster.icaoCode != null and airportMaster.icaoCode != ''">
|
||||
AND icao_code = #{airportMaster.icaoCode}
|
||||
AND am.icao_code = #{airportMaster.icaoCode}
|
||||
</if>
|
||||
<if test="airportMaster.regionName != null and airportMaster.regionName != ''">
|
||||
<bind name="regionNameLike" value="'%' + airportMaster.regionName + '%'"/>
|
||||
AND am.region_name LIKE #{regionNameLike}
|
||||
</if>
|
||||
<if test="airportMaster.detailAddress != null and airportMaster.detailAddress != ''">
|
||||
<bind name="detailAddressLike" value="'%' + airportMaster.detailAddress + '%'"/>
|
||||
AND am.detail_address LIKE #{detailAddressLike}
|
||||
</if>
|
||||
<if test="airportMaster.dataSource != null and airportMaster.dataSource != ''">
|
||||
<choose>
|
||||
<when test="airportMaster.dataSource == '手动录入'">
|
||||
AND data_source IN ('手动录入', '手工导入')
|
||||
AND am.data_source IN ('手动录入', '手工导入')
|
||||
</when>
|
||||
<otherwise>
|
||||
AND data_source = #{airportMaster.dataSource}
|
||||
AND am.data_source = #{airportMaster.dataSource}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="airportMaster.status != null">
|
||||
AND status = #{airportMaster.status}
|
||||
AND am.status = #{airportMaster.status}
|
||||
</if>
|
||||
ORDER BY update_time DESC, create_time DESC
|
||||
ORDER BY am.update_time DESC, am.create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_user_name" property="updateUserName"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
@@ -27,61 +28,63 @@
|
||||
|
||||
<select id="selectPortTerminalPage" resultMap="portTerminalResultMap">
|
||||
SELECT
|
||||
id,
|
||||
create_user,
|
||||
create_dept,
|
||||
create_time,
|
||||
update_user,
|
||||
update_time,
|
||||
status,
|
||||
is_deleted,
|
||||
code,
|
||||
name,
|
||||
category,
|
||||
parent_id,
|
||||
parent_code,
|
||||
parent_name,
|
||||
country,
|
||||
city,
|
||||
CASE WHEN longitude BETWEEN -180 AND 180 THEN longitude ELSE NULL END AS longitude,
|
||||
CASE WHEN latitude BETWEEN -90 AND 90 THEN latitude ELSE NULL END AS latitude,
|
||||
CASE WHEN data_source = '初始导入' THEN '初始化导入' ELSE data_source END AS data_source,
|
||||
remark
|
||||
pt.id,
|
||||
pt.create_user,
|
||||
pt.create_dept,
|
||||
pt.create_time,
|
||||
pt.update_user,
|
||||
bu.real_name AS update_user_name,
|
||||
pt.update_time,
|
||||
pt.status,
|
||||
pt.is_deleted,
|
||||
pt.code,
|
||||
pt.name,
|
||||
pt.category,
|
||||
pt.parent_id,
|
||||
pt.parent_code,
|
||||
pt.parent_name,
|
||||
pt.country,
|
||||
pt.city,
|
||||
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,
|
||||
pt.remark
|
||||
FROM
|
||||
blade_port_terminal
|
||||
blade_port_terminal pt
|
||||
LEFT JOIN blade_user bu ON bu.id = pt.update_user
|
||||
WHERE
|
||||
is_deleted = 0
|
||||
pt.is_deleted = 0
|
||||
<if test="portTerminal.code != null and portTerminal.code != ''">
|
||||
<bind name="codeLike" value="'%' + portTerminal.code + '%'"/>
|
||||
AND code LIKE #{codeLike}
|
||||
AND pt.code LIKE #{codeLike}
|
||||
</if>
|
||||
<if test="portTerminal.name != null and portTerminal.name != ''">
|
||||
<bind name="nameLike" value="'%' + portTerminal.name + '%'"/>
|
||||
AND name LIKE #{nameLike}
|
||||
AND pt.name LIKE #{nameLike}
|
||||
</if>
|
||||
<if test="portTerminal.category != null and portTerminal.category != ''">
|
||||
AND category = #{portTerminal.category}
|
||||
AND pt.category = #{portTerminal.category}
|
||||
</if>
|
||||
<if test="portTerminal.dataSource != null and portTerminal.dataSource != ''">
|
||||
<choose>
|
||||
<when test="portTerminal.dataSource == '初始化导入'">
|
||||
AND data_source IN ('初始化导入', '初始导入')
|
||||
AND pt.data_source IN ('初始化导入', '初始导入')
|
||||
</when>
|
||||
<otherwise>
|
||||
AND data_source = #{portTerminal.dataSource}
|
||||
AND pt.data_source = #{portTerminal.dataSource}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="portTerminal.city != null and portTerminal.city != ''">
|
||||
AND city = #{portTerminal.city}
|
||||
AND pt.city = #{portTerminal.city}
|
||||
</if>
|
||||
<if test="portTerminal.country != null and portTerminal.country != ''">
|
||||
AND country = #{portTerminal.country}
|
||||
AND pt.country = #{portTerminal.country}
|
||||
</if>
|
||||
<if test="portTerminal.status != null">
|
||||
AND status = #{portTerminal.status}
|
||||
AND pt.status = #{portTerminal.status}
|
||||
</if>
|
||||
ORDER BY update_time DESC, create_time DESC
|
||||
ORDER BY pt.update_time DESC, pt.create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_user_name" property="updateUserName"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
@@ -20,6 +21,9 @@
|
||||
<result column="province_name" property="provinceName"/>
|
||||
<result column="city_code" property="cityCode"/>
|
||||
<result column="city_name" property="cityName"/>
|
||||
<result column="region_code" property="regionCode"/>
|
||||
<result column="region_name" property="regionName"/>
|
||||
<result column="detail_address" property="detailAddress"/>
|
||||
<result column="longitude" property="longitude"/>
|
||||
<result column="latitude" property="latitude"/>
|
||||
<result column="data_source" property="dataSource"/>
|
||||
@@ -28,70 +32,83 @@
|
||||
|
||||
<select id="selectRailwayStationPage" resultMap="railwayStationResultMap">
|
||||
SELECT
|
||||
id,
|
||||
create_user,
|
||||
create_dept,
|
||||
create_time,
|
||||
update_user,
|
||||
update_time,
|
||||
status,
|
||||
is_deleted,
|
||||
code,
|
||||
tmis_code,
|
||||
telegraph_code,
|
||||
name,
|
||||
railway_line,
|
||||
province_code,
|
||||
province_name,
|
||||
city_code,
|
||||
city_name,
|
||||
longitude,
|
||||
latitude,
|
||||
rs.id,
|
||||
rs.create_user,
|
||||
rs.create_dept,
|
||||
rs.create_time,
|
||||
rs.update_user,
|
||||
bu.real_name AS update_user_name,
|
||||
rs.update_time,
|
||||
rs.status,
|
||||
rs.is_deleted,
|
||||
rs.code,
|
||||
rs.tmis_code,
|
||||
rs.telegraph_code,
|
||||
rs.name,
|
||||
rs.railway_line,
|
||||
rs.province_code,
|
||||
rs.province_name,
|
||||
rs.city_code,
|
||||
rs.city_name,
|
||||
rs.region_code,
|
||||
rs.region_name,
|
||||
rs.detail_address,
|
||||
rs.longitude,
|
||||
rs.latitude,
|
||||
CASE
|
||||
WHEN data_source = '初始导入' THEN '初始化导入'
|
||||
WHEN data_source = '批量导入' THEN '批量'
|
||||
WHEN data_source IN ('手工导入', '手动录入') THEN '手动'
|
||||
ELSE data_source
|
||||
WHEN rs.data_source = '初始导入' THEN '初始化导入'
|
||||
WHEN rs.data_source = '批量导入' THEN '批量'
|
||||
WHEN rs.data_source IN ('手工导入', '手动录入') THEN '手动'
|
||||
ELSE rs.data_source
|
||||
END AS data_source,
|
||||
remark
|
||||
rs.remark
|
||||
FROM
|
||||
blade_railway_station
|
||||
blade_railway_station rs
|
||||
LEFT JOIN blade_user bu ON bu.id = rs.update_user
|
||||
WHERE
|
||||
is_deleted = 0
|
||||
rs.is_deleted = 0
|
||||
<if test="railwayStation.code != null and railwayStation.code != ''">
|
||||
<bind name="codeLike" value="'%' + railwayStation.code + '%'"/>
|
||||
AND code LIKE #{codeLike}
|
||||
AND rs.code LIKE #{codeLike}
|
||||
</if>
|
||||
<if test="railwayStation.name != null and railwayStation.name != ''">
|
||||
<bind name="nameLike" value="'%' + railwayStation.name + '%'"/>
|
||||
AND name LIKE #{nameLike}
|
||||
AND rs.name LIKE #{nameLike}
|
||||
</if>
|
||||
<if test="railwayStation.tmisCode != null and railwayStation.tmisCode != ''">
|
||||
AND tmis_code = #{railwayStation.tmisCode}
|
||||
AND rs.tmis_code = #{railwayStation.tmisCode}
|
||||
</if>
|
||||
<if test="railwayStation.telegraphCode != null and railwayStation.telegraphCode != ''">
|
||||
AND telegraph_code = #{railwayStation.telegraphCode}
|
||||
AND rs.telegraph_code = #{railwayStation.telegraphCode}
|
||||
</if>
|
||||
<if test="railwayStation.regionName != null and railwayStation.regionName != ''">
|
||||
<bind name="regionNameLike" value="'%' + railwayStation.regionName + '%'"/>
|
||||
AND rs.region_name LIKE #{regionNameLike}
|
||||
</if>
|
||||
<if test="railwayStation.detailAddress != null and railwayStation.detailAddress != ''">
|
||||
<bind name="detailAddressLike" value="'%' + railwayStation.detailAddress + '%'"/>
|
||||
AND rs.detail_address LIKE #{detailAddressLike}
|
||||
</if>
|
||||
<if test="railwayStation.dataSource != null and railwayStation.dataSource != ''">
|
||||
<choose>
|
||||
<when test="railwayStation.dataSource == '初始化导入'">
|
||||
AND data_source IN ('初始化导入', '初始导入')
|
||||
AND rs.data_source IN ('初始化导入', '初始导入')
|
||||
</when>
|
||||
<when test="railwayStation.dataSource == '批量'">
|
||||
AND data_source IN ('批量', '批量导入')
|
||||
AND rs.data_source IN ('批量', '批量导入')
|
||||
</when>
|
||||
<when test="railwayStation.dataSource == '手动'">
|
||||
AND data_source IN ('手动', '手动录入', '手工导入')
|
||||
AND rs.data_source IN ('手动', '手动录入', '手工导入')
|
||||
</when>
|
||||
<otherwise>
|
||||
AND data_source = #{railwayStation.dataSource}
|
||||
AND rs.data_source = #{railwayStation.dataSource}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="railwayStation.status != null">
|
||||
AND status = #{railwayStation.status}
|
||||
AND rs.status = #{railwayStation.status}
|
||||
</if>
|
||||
ORDER BY update_time DESC, create_time DESC
|
||||
ORDER BY rs.update_time DESC, rs.create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -58,7 +58,7 @@ public interface RegionMapper extends BaseMapper<Region> {
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RegionVO> lazyTree(String parentCode, Map<String, Object> param);
|
||||
List<Map<String, Object>> lazyTree(String parentCode, Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* 导出区划数据
|
||||
|
||||
@@ -74,14 +74,14 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="lazyTree" resultMap="treeNodeResultMap">
|
||||
<select id="lazyTree" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
region.code AS "id",
|
||||
region.parent_code AS "parent_id",
|
||||
region.name AS "title",
|
||||
region.code AS "value",
|
||||
region.code AS "key",
|
||||
( SELECT CASE WHEN count( 1 ) > 0 THEN 1 ELSE 0 END FROM blade_region WHERE parent_code = region.code ) AS "has_children"
|
||||
region.code AS id,
|
||||
region.parent_code AS parentId,
|
||||
region.name AS title,
|
||||
region.code AS value,
|
||||
region.code AS `key`,
|
||||
( SELECT CASE WHEN count( 1 ) > 0 THEN 1 ELSE 0 END FROM blade_region WHERE parent_code = region.code ) AS hasChildren
|
||||
FROM
|
||||
blade_region region
|
||||
<where>
|
||||
|
||||
@@ -73,7 +73,7 @@ public interface IRegionService extends IService<Region> {
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RegionVO> lazyTree(String parentCode, Map<String, Object> param);
|
||||
List<Map<String, Object>> lazyTree(String parentCode, Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* 导入区划数据
|
||||
|
||||
@@ -65,12 +65,15 @@ public class AirportMasterServiceImpl extends BaseServiceImpl<AirportMasterMappe
|
||||
private static final String SOURCE_BATCH = "批量导入";
|
||||
private static final String SOURCE_MANUAL = "手动录入";
|
||||
private static final String SOURCE_MANUAL_OLD = "手工导入";
|
||||
private static final String DEFAULT_COUNTRY_CODE = "+86";
|
||||
private static final int STATUS_ENABLED = 1;
|
||||
private static final int STATUS_DISABLED = 2;
|
||||
private static final int CODE_MAX_LENGTH = 20;
|
||||
private static final int NAME_MAX_LENGTH = 100;
|
||||
private static final int SHORT_NAME_MAX_LENGTH = 100;
|
||||
private static final int REGION_NAME_MAX_LENGTH = 128;
|
||||
private static final int REGION_CODE_MAX_LENGTH = 32;
|
||||
private static final int DETAIL_ADDRESS_MAX_LENGTH = 255;
|
||||
private static final int REMARK_MAX_LENGTH = 200;
|
||||
private static final Pattern IATA_CODE_PATTERN = Pattern.compile("^[A-Z]{3}$");
|
||||
private static final Pattern ICAO_CODE_PATTERN = Pattern.compile("^[A-Z]{4}$");
|
||||
@@ -160,6 +163,9 @@ public class AirportMasterServiceImpl extends BaseServiceImpl<AirportMasterMappe
|
||||
airportMaster.setProvinceName(trimToNull(airportMaster.getProvinceName()));
|
||||
airportMaster.setCityCode(trimToNull(airportMaster.getCityCode()));
|
||||
airportMaster.setCityName(trimToNull(airportMaster.getCityName()));
|
||||
airportMaster.setRegionCode(trimToNull(airportMaster.getRegionCode()));
|
||||
airportMaster.setRegionName(trimToNull(airportMaster.getRegionName()));
|
||||
airportMaster.setDetailAddress(trimToNull(airportMaster.getDetailAddress()));
|
||||
airportMaster.setRemark(trimToNull(airportMaster.getRemark()));
|
||||
airportMaster.setDataSource(normalizeDataSource(Func.toStrWithEmpty(airportMaster.getDataSource(), defaultDataSource)));
|
||||
if (Func.isEmpty(airportMaster.getStatus())) {
|
||||
@@ -189,6 +195,9 @@ public class AirportMasterServiceImpl extends BaseServiceImpl<AirportMasterMappe
|
||||
validateLength(airportMaster.getShortName(), SHORT_NAME_MAX_LENGTH, "机场简称不能超过100字");
|
||||
validateLength(airportMaster.getProvinceName(), REGION_NAME_MAX_LENGTH, "所属省份不能超过128字");
|
||||
validateLength(airportMaster.getCityName(), REGION_NAME_MAX_LENGTH, "所属城市不能超过128字");
|
||||
validateLength(airportMaster.getRegionCode(), REGION_CODE_MAX_LENGTH, "行政区划编码不能超过32字");
|
||||
validateLength(airportMaster.getRegionName(), REGION_NAME_MAX_LENGTH, "行政区划不能超过128字");
|
||||
validateLength(airportMaster.getDetailAddress(), DETAIL_ADDRESS_MAX_LENGTH, "详细地址不能超过255字");
|
||||
validateLength(airportMaster.getRemark(), REMARK_MAX_LENGTH, "备注不能超过200字");
|
||||
if (Func.isEmpty(airportMaster.getProvinceCode()) || Func.isEmpty(airportMaster.getCityCode())) {
|
||||
throw new ServiceException("请选择省份和城市");
|
||||
@@ -209,7 +218,7 @@ public class AirportMasterServiceImpl extends BaseServiceImpl<AirportMasterMappe
|
||||
}
|
||||
if (Func.isEmpty(province) && Func.isNotEmpty(airportMaster.getProvinceName())) {
|
||||
province = regionService.getOne(Wrappers.<Region>lambdaQuery()
|
||||
.eq(Region::getParentCode, "00")
|
||||
.eq(Region::getParentCode, DEFAULT_COUNTRY_CODE)
|
||||
.eq(Region::getName, airportMaster.getProvinceName()), false);
|
||||
}
|
||||
if (Func.isEmpty(province)) {
|
||||
|
||||
@@ -68,12 +68,15 @@ public class RailwayStationServiceImpl extends BaseServiceImpl<RailwayStationMap
|
||||
private static final String SOURCE_MANUAL = "手动";
|
||||
private static final String SOURCE_MANUAL_RECORD = "手动录入";
|
||||
private static final String SOURCE_MANUAL_OLD = "手工导入";
|
||||
private static final String DEFAULT_COUNTRY_CODE = "+86";
|
||||
private static final int STATUS_ENABLED = 1;
|
||||
private static final int STATUS_DISABLED = 2;
|
||||
private static final int CODE_MAX_LENGTH = 20;
|
||||
private static final int NAME_MAX_LENGTH = 100;
|
||||
private static final int RAILWAY_LINE_MAX_LENGTH = 100;
|
||||
private static final int REGION_NAME_MAX_LENGTH = 128;
|
||||
private static final int REGION_CODE_MAX_LENGTH = 32;
|
||||
private static final int DETAIL_ADDRESS_MAX_LENGTH = 255;
|
||||
private static final int REMARK_MAX_LENGTH = 200;
|
||||
private static final Pattern TMIS_CODE_PATTERN = Pattern.compile("^\\d{5}$");
|
||||
private static final Pattern TELEGRAPH_CODE_PATTERN = Pattern.compile("^[A-Z]{3}$");
|
||||
@@ -163,6 +166,9 @@ public class RailwayStationServiceImpl extends BaseServiceImpl<RailwayStationMap
|
||||
railwayStation.setProvinceName(trimToNull(railwayStation.getProvinceName()));
|
||||
railwayStation.setCityCode(trimToNull(railwayStation.getCityCode()));
|
||||
railwayStation.setCityName(trimToNull(railwayStation.getCityName()));
|
||||
railwayStation.setRegionCode(trimToNull(railwayStation.getRegionCode()));
|
||||
railwayStation.setRegionName(trimToNull(railwayStation.getRegionName()));
|
||||
railwayStation.setDetailAddress(trimToNull(railwayStation.getDetailAddress()));
|
||||
railwayStation.setRemark(trimToNull(railwayStation.getRemark()));
|
||||
railwayStation.setDataSource(normalizeDataSource(Func.toStrWithEmpty(railwayStation.getDataSource(), defaultDataSource)));
|
||||
if (Func.isEmpty(railwayStation.getStatus())) {
|
||||
@@ -189,9 +195,12 @@ public class RailwayStationServiceImpl extends BaseServiceImpl<RailwayStationMap
|
||||
}
|
||||
validateLength(railwayStation.getCode(), CODE_MAX_LENGTH, "编码不能超过20字");
|
||||
validateLength(railwayStation.getName(), NAME_MAX_LENGTH, "车站名称不能超过100字");
|
||||
validateLength(railwayStation.getRailwayLine(), RAILWAY_LINE_MAX_LENGTH, "所属铁路线路不能超过100字");
|
||||
// validateLength(railwayStation.getRailwayLine(), RAILWAY_LINE_MAX_LENGTH, "所属铁路线路不能超过100字");
|
||||
validateLength(railwayStation.getProvinceName(), REGION_NAME_MAX_LENGTH, "所属省份不能超过128字");
|
||||
validateLength(railwayStation.getCityName(), REGION_NAME_MAX_LENGTH, "所属城市不能超过128字");
|
||||
validateLength(railwayStation.getRegionCode(), REGION_CODE_MAX_LENGTH, "行政区划编码不能超过32字");
|
||||
validateLength(railwayStation.getRegionName(), REGION_NAME_MAX_LENGTH, "行政区划不能超过128字");
|
||||
validateLength(railwayStation.getDetailAddress(), DETAIL_ADDRESS_MAX_LENGTH, "详细地址不能超过255字");
|
||||
validateLength(railwayStation.getRemark(), REMARK_MAX_LENGTH, "备注不能超过200字");
|
||||
if (Func.isEmpty(railwayStation.getProvinceCode()) || Func.isEmpty(railwayStation.getCityCode())) {
|
||||
throw new ServiceException("请选择省份和城市");
|
||||
@@ -212,7 +221,7 @@ public class RailwayStationServiceImpl extends BaseServiceImpl<RailwayStationMap
|
||||
}
|
||||
if (Func.isEmpty(province) && Func.isNotEmpty(railwayStation.getProvinceName())) {
|
||||
province = regionService.getOne(Wrappers.<Region>lambdaQuery()
|
||||
.eq(Region::getParentCode, "00")
|
||||
.eq(Region::getParentCode, DEFAULT_COUNTRY_CODE)
|
||||
.eq(Region::getName, railwayStation.getProvinceName()), false);
|
||||
}
|
||||
if (Func.isEmpty(province)) {
|
||||
|
||||
@@ -57,14 +57,24 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
||||
|
||||
@Override
|
||||
public boolean submit(Region region) {
|
||||
// 设置市级编号格式
|
||||
String regionCode = region.getCode();
|
||||
String regionParentCode = region.getParentCode();
|
||||
if (regionCode.startsWith(MAIN_CODE)) {
|
||||
region.setCode(StringUtil.removePrefix(regionCode, MAIN_CODE));
|
||||
}
|
||||
if (regionParentCode.startsWith(MAIN_CODE)) {
|
||||
region.setParentCode(StringUtil.removePrefix(regionParentCode, MAIN_CODE));
|
||||
Integer level = region.getRegionLevel();
|
||||
if (level != null && level == COUNTRY_LEVEL) {
|
||||
region.setParentCode(ROOT_PARENT_CODE);
|
||||
region.setAncestors(ROOT_PARENT_CODE);
|
||||
} else {
|
||||
if (LEGACY_MAIN_CODE.equals(regionParentCode)) {
|
||||
region.setParentCode(MAIN_CODE);
|
||||
}
|
||||
if (StringUtil.isNotBlank(regionCode) && regionCode.startsWith(LEGACY_MAIN_CODE)) {
|
||||
region.setCode(StringUtil.removePrefix(regionCode, LEGACY_MAIN_CODE));
|
||||
}
|
||||
if (MAIN_CODE.equals(region.getParentCode())
|
||||
&& StringUtil.isNotBlank(region.getCode())
|
||||
&& region.getCode().startsWith(MAIN_CODE)) {
|
||||
region.setCode(StringUtil.removePrefix(region.getCode(), MAIN_CODE));
|
||||
}
|
||||
}
|
||||
// 查询是否已存在
|
||||
Long cnt = baseMapper.selectCount(Wrappers.<Region>query().lambda().eq(Region::getCode, region.getCode()));
|
||||
@@ -74,11 +84,14 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
||||
// 设置祖区划编号
|
||||
Region parent = getByCode(region.getParentCode());
|
||||
if (Func.isNotEmpty(parent) && Func.isNotEmpty(parent.getCode())) {
|
||||
String ancestors = parent.getAncestors() + StringPool.COMMA + parent.getCode();
|
||||
String ancestors = parent.getRegionLevel() != null && parent.getRegionLevel() == COUNTRY_LEVEL
|
||||
? parent.getCode()
|
||||
: parent.getAncestors() + StringPool.COMMA + parent.getCode();
|
||||
region.setAncestors(ancestors);
|
||||
} else if (MAIN_CODE.equals(region.getParentCode())) {
|
||||
region.setAncestors(MAIN_CODE);
|
||||
}
|
||||
// 设置省、市、区、镇、村
|
||||
Integer level = region.getRegionLevel();
|
||||
String code = region.getCode();
|
||||
String name = region.getName();
|
||||
if (level == PROVINCE_LEVEL) {
|
||||
@@ -115,7 +128,7 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RegionVO> lazyTree(String parentCode, Map<String, Object> param) {
|
||||
public List<Map<String, Object>> lazyTree(String parentCode, Map<String, Object> param) {
|
||||
return baseMapper.lazyTree(parentCode, param);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@ import org.springblade.system.pojo.vo.RegionVO;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static org.springblade.system.cache.RegionCache.ROOT_PARENT_CODE;
|
||||
|
||||
/**
|
||||
* 包装类,返回视图层所需的字段
|
||||
*
|
||||
@@ -50,7 +52,11 @@ public class RegionWrapper extends BaseEntityWrapper<Region, RegionVO> {
|
||||
public RegionVO entityVO(Region region) {
|
||||
RegionVO regionVO = Objects.requireNonNull(BeanUtil.copyProperties(region, RegionVO.class));
|
||||
Region parentRegion = RegionCache.getByCode(region.getParentCode());
|
||||
regionVO.setParentName(parentRegion.getName());
|
||||
if (Objects.nonNull(parentRegion)) {
|
||||
regionVO.setParentName(parentRegion.getName());
|
||||
} else if (ROOT_PARENT_CODE.equals(region.getParentCode())) {
|
||||
regionVO.setParentName("根节点");
|
||||
}
|
||||
return regionVO;
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,8 @@ public class CustomerArchiveController extends BladeController {
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "新增或修改", description = "传入customerArchive")
|
||||
public R submit(@RequestBody CustomerArchiveVO customerArchive) {
|
||||
return R.status(customerArchiveService.submit(customerArchive));
|
||||
boolean result = customerArchiveService.submit(customerArchive);
|
||||
return result ? R.data(customerArchive.getId()) : R.status(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -129,6 +129,12 @@ public class AccidentRecordServiceImpl extends BaseServiceImpl<AccidentRecordMap
|
||||
if (Func.isEmpty(accidentRecord.getAccidentDate())) {
|
||||
throw new ServiceException("事故发生日期不能为空");
|
||||
}
|
||||
if (Func.isEmpty(accidentRecord.getAccidentNature())) {
|
||||
throw new ServiceException("事故性质不能为空");
|
||||
}
|
||||
if (Func.isEmpty(accidentRecord.getAccidentResponsibility())) {
|
||||
throw new ServiceException("事故责任不能为空");
|
||||
}
|
||||
validateLength(accidentRecord.getVehicleNo(), VEHICLE_NO_MAX_LENGTH, "车牌号/船号不能超过30字");
|
||||
validateLength(accidentRecord.getAccidentLocation(), LOCATION_MAX_LENGTH, "事故发生地点不能超过100字");
|
||||
validateLength(accidentRecord.getAccidentReasonDamage(), REASON_DAMAGE_MAX_LENGTH, "事故原因及损坏情况不能超过500字");
|
||||
|
||||
@@ -73,12 +73,14 @@ import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -99,6 +101,8 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
||||
private static final String APPROVAL_APPROVED = "approved";
|
||||
private static final String APPROVAL_REJECTED = "rejected";
|
||||
private static final String CUSTOMER_CODE_PREFIX = "KS";
|
||||
private static final Set<String> CUSTOMER_NATURES = Set.of("有限公司", "个体工商户");
|
||||
private static final Set<String> CUSTOMER_TYPES = Set.of("客户", "承运商");
|
||||
|
||||
private final CustomerContactMapper contactMapper;
|
||||
private final CustomerReceiptAccountMapper receiptAccountMapper;
|
||||
@@ -146,6 +150,7 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
||||
}
|
||||
CustomerArchive entity = Objects.requireNonNull(BeanUtil.copyProperties(customer, CustomerArchive.class));
|
||||
boolean result = saveOrUpdate(entity);
|
||||
customer.setId(entity.getId());
|
||||
replaceDetail(entity.getId(), customer);
|
||||
addChangeRecord(entity.getId(), created ? "新增客商档案" : "修改客商档案");
|
||||
return result;
|
||||
@@ -274,6 +279,9 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
||||
if (Func.isEmpty(customer.getCustomerNature())) {
|
||||
throw new ServiceException("客商性质不能为空");
|
||||
}
|
||||
if (!CUSTOMER_NATURES.contains(customer.getCustomerNature())) {
|
||||
throw new ServiceException("客商性质只能选择有限公司或个体工商户");
|
||||
}
|
||||
if (Func.isEmpty(customer.getUnifiedCreditCode())) {
|
||||
throw new ServiceException("统一社会信用代码不能为空");
|
||||
}
|
||||
@@ -283,6 +291,7 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
||||
if (Func.isEmpty(customer.getCustomerType())) {
|
||||
throw new ServiceException("客商类型不能为空");
|
||||
}
|
||||
validateCustomerType(customer.getCustomerType());
|
||||
if (Func.isEmpty(customer.getLegalPerson())) {
|
||||
throw new ServiceException("法人/负责人不能为空");
|
||||
}
|
||||
@@ -295,8 +304,13 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
||||
if (Func.isEmpty(customer.getDeptName())) {
|
||||
throw new ServiceException("所属组织不能为空");
|
||||
}
|
||||
if (Objects.equals(customer.getBusinessTermType(), "固定期限") && Func.isEmpty(customer.getBusinessEndDate())) {
|
||||
throw new ServiceException("固定营业期限必须填写营业期限截止日");
|
||||
}
|
||||
validateLength(customer.getShortName(), 20, "客商简称最多20个汉字");
|
||||
validateLength(customer.getFullName(), 100, "客商全称最多100个字符");
|
||||
validateLength(customer.getLegalPerson(), 10, "法人/负责人最多10个汉字");
|
||||
validateLength(customer.getContactPhone(), 11, "联系电话必须为11位手机号");
|
||||
validateLength(customer.getRegisteredAddress(), 200, "地址最多200个字符");
|
||||
validateLength(customer.getBusinessScope(), 500, "经营范围最多500个字符");
|
||||
validateLength(customer.getRemark(), 500, "备注最多500个字符");
|
||||
@@ -307,6 +321,21 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
||||
validateUnique(customer);
|
||||
}
|
||||
|
||||
private void validateCustomerType(String customerType) {
|
||||
List<String> typeList = Arrays.stream(customerType.replace(",", ",").split(","))
|
||||
.map(String::trim)
|
||||
.filter(Func::isNotEmpty)
|
||||
.toList();
|
||||
if (Func.isEmpty(typeList)) {
|
||||
throw new ServiceException("客商类型不能为空");
|
||||
}
|
||||
for (String type : typeList) {
|
||||
if (!CUSTOMER_TYPES.contains(type)) {
|
||||
throw new ServiceException("客商类型只能选择客户或承运商");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void validateApproval(CustomerArchiveVO customer) {
|
||||
if (Objects.equals(customer.getAccessType(), ACCESS_FORMAL)) {
|
||||
if (Func.isEmpty(customer.getQualificationAttachments())) {
|
||||
|
||||
@@ -249,7 +249,7 @@ public class ViolationRecordServiceImpl extends BaseServiceImpl<ViolationRecordM
|
||||
|
||||
private String normalizeProcessStatus(String processStatus) {
|
||||
String value = trimToEmpty(processStatus);
|
||||
return value.isEmpty() ? PROCESSED : value;
|
||||
return value.isEmpty() ? UNPROCESSED : value;
|
||||
}
|
||||
|
||||
private String trimToEmpty(String value) {
|
||||
|
||||
Reference in New Issue
Block a user