fix bug
This commit is contained in:
@@ -27,6 +27,7 @@ package org.springblade.system.excel;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnore;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.format.NumberFormat;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
@@ -80,9 +81,11 @@ public class AirportMasterExcel implements Serializable {
|
||||
private String detailAddress;
|
||||
|
||||
@ExcelProperty("经度")
|
||||
@NumberFormat("0.000000")
|
||||
private BigDecimal longitude;
|
||||
|
||||
@ExcelProperty("纬度")
|
||||
@NumberFormat("0.000000")
|
||||
private BigDecimal latitude;
|
||||
|
||||
@ExcelProperty("数据来源")
|
||||
|
||||
@@ -73,6 +73,12 @@ public class PortTerminalExcel implements Serializable {
|
||||
@ExcelProperty("城市")
|
||||
private String city;
|
||||
|
||||
@ExcelProperty("行政区划编码")
|
||||
private String regionCode;
|
||||
|
||||
@ExcelProperty("详细地址")
|
||||
private String detailAddress;
|
||||
|
||||
@ExcelProperty("经度")
|
||||
private BigDecimal longitude;
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ package org.springblade.system.excel;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnore;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.format.NumberFormat;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import cn.idev.excel.annotation.write.style.ContentRowHeight;
|
||||
import cn.idev.excel.annotation.write.style.HeadRowHeight;
|
||||
@@ -80,9 +81,11 @@ public class RailwayStationExcel implements Serializable {
|
||||
private String detailAddress;
|
||||
|
||||
@ExcelProperty("经度")
|
||||
@NumberFormat("0.000000")
|
||||
private BigDecimal longitude;
|
||||
|
||||
@ExcelProperty("纬度")
|
||||
@NumberFormat("0.000000")
|
||||
private BigDecimal latitude;
|
||||
|
||||
@ExcelProperty("数据来源")
|
||||
|
||||
@@ -76,6 +76,9 @@
|
||||
<if test="airportMaster.icaoCode != null and airportMaster.icaoCode != ''">
|
||||
AND am.icao_code = #{airportMaster.icaoCode}
|
||||
</if>
|
||||
<if test="airportMaster.regionCode != null and airportMaster.regionCode != ''">
|
||||
AND am.region_code = #{airportMaster.regionCode}
|
||||
</if>
|
||||
<if test="airportMaster.regionName != null and airportMaster.regionName != ''">
|
||||
<bind name="regionNameLike" value="'%' + airportMaster.regionName + '%'"/>
|
||||
AND am.region_name LIKE #{regionNameLike}
|
||||
|
||||
@@ -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"/>
|
||||
@@ -26,51 +27,71 @@
|
||||
|
||||
<select id="selectCurrencyPage" resultMap="currencyResultMap">
|
||||
SELECT
|
||||
*
|
||||
bc.id,
|
||||
bc.create_user,
|
||||
bc.create_dept,
|
||||
bc.create_time,
|
||||
bc.update_user,
|
||||
bu.real_name AS update_user_name,
|
||||
bc.update_time,
|
||||
bc.status,
|
||||
bc.is_deleted,
|
||||
bc.code,
|
||||
bc.name,
|
||||
bc.english_name,
|
||||
bc.symbol,
|
||||
bc.decimal_places,
|
||||
bc.exchange_rate,
|
||||
bc.effective_date,
|
||||
bc.expiry_date,
|
||||
bc.is_base_currency,
|
||||
bc.data_source,
|
||||
bc.remark
|
||||
FROM
|
||||
blade_currency
|
||||
blade_currency bc
|
||||
LEFT JOIN blade_user bu ON bu.id = bc.update_user
|
||||
WHERE
|
||||
is_deleted = 0
|
||||
bc.is_deleted = 0
|
||||
<if test="currency.code != null and currency.code != ''">
|
||||
<bind name="codeLike" value="'%' + currency.code + '%'"/>
|
||||
AND code LIKE #{codeLike}
|
||||
AND bc.code LIKE #{codeLike}
|
||||
</if>
|
||||
<if test="currency.name != null and currency.name != ''">
|
||||
<bind name="nameLike" value="'%' + currency.name + '%'"/>
|
||||
AND name LIKE #{nameLike}
|
||||
AND bc.name LIKE #{nameLike}
|
||||
</if>
|
||||
<if test="currency.englishName != null and currency.englishName != ''">
|
||||
<bind name="englishNameLike" value="'%' + currency.englishName + '%'"/>
|
||||
AND english_name LIKE #{englishNameLike}
|
||||
AND bc.english_name LIKE #{englishNameLike}
|
||||
</if>
|
||||
<if test="currency.status != null">
|
||||
AND status = #{currency.status}
|
||||
AND bc.status = #{currency.status}
|
||||
</if>
|
||||
<if test="currency.exchangeRate != null">
|
||||
AND exchange_rate = #{currency.exchangeRate}
|
||||
AND bc.exchange_rate = #{currency.exchangeRate}
|
||||
</if>
|
||||
<if test="currency.dataSource != null and currency.dataSource != ''">
|
||||
AND data_source = #{currency.dataSource}
|
||||
AND bc.data_source = #{currency.dataSource}
|
||||
</if>
|
||||
<if test="currency.effectiveDateStart != null">
|
||||
AND effective_date >= #{currency.effectiveDateStart}
|
||||
AND bc.effective_date >= #{currency.effectiveDateStart}
|
||||
</if>
|
||||
<if test="currency.effectiveDateEnd != null">
|
||||
AND effective_date <= #{currency.effectiveDateEnd}
|
||||
AND bc.effective_date <= #{currency.effectiveDateEnd}
|
||||
</if>
|
||||
<if test="currency.expiryDateStart != null">
|
||||
AND expiry_date >= #{currency.expiryDateStart}
|
||||
AND bc.expiry_date >= #{currency.expiryDateStart}
|
||||
</if>
|
||||
<if test="currency.expiryDateEnd != null">
|
||||
AND expiry_date <= #{currency.expiryDateEnd}
|
||||
AND bc.expiry_date <= #{currency.expiryDateEnd}
|
||||
</if>
|
||||
<if test="currency.updateTimeStart != null">
|
||||
AND update_time >= #{currency.updateTimeStart}
|
||||
AND bc.update_time >= #{currency.updateTimeStart}
|
||||
</if>
|
||||
<if test="currency.updateTimeEnd != null">
|
||||
AND update_time <= #{currency.updateTimeEnd}
|
||||
AND bc.update_time <= #{currency.updateTimeEnd}
|
||||
</if>
|
||||
ORDER BY code ASC, effective_date DESC, create_time DESC
|
||||
ORDER BY bc.code ASC, bc.effective_date DESC, bc.create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
<result column="parent_name" property="parentName"/>
|
||||
<result column="country" property="country"/>
|
||||
<result column="city" property="city"/>
|
||||
<result column="region_code" property="regionCode"/>
|
||||
<result column="detail_address" property="detailAddress"/>
|
||||
<result column="longitude" property="longitude"/>
|
||||
<result column="latitude" property="latitude"/>
|
||||
<result column="data_source" property="dataSource"/>
|
||||
@@ -45,6 +47,8 @@
|
||||
pt.parent_name,
|
||||
pt.country,
|
||||
pt.city,
|
||||
pt.region_code,
|
||||
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,
|
||||
@@ -78,6 +82,13 @@
|
||||
<if test="portTerminal.city != null and portTerminal.city != ''">
|
||||
AND pt.city = #{portTerminal.city}
|
||||
</if>
|
||||
<if test="portTerminal.regionCode != null and portTerminal.regionCode != ''">
|
||||
AND pt.region_code = #{portTerminal.regionCode}
|
||||
</if>
|
||||
<if test="portTerminal.detailAddress != null and portTerminal.detailAddress != ''">
|
||||
<bind name="detailAddressLike" value="'%' + portTerminal.detailAddress + '%'"/>
|
||||
AND pt.detail_address LIKE #{detailAddressLike}
|
||||
</if>
|
||||
<if test="portTerminal.country != null and portTerminal.country != ''">
|
||||
AND pt.country = #{portTerminal.country}
|
||||
</if>
|
||||
|
||||
@@ -81,6 +81,9 @@
|
||||
<if test="railwayStation.telegraphCode != null and railwayStation.telegraphCode != ''">
|
||||
AND rs.telegraph_code = #{railwayStation.telegraphCode}
|
||||
</if>
|
||||
<if test="railwayStation.regionCode != null and railwayStation.regionCode != ''">
|
||||
AND rs.region_code = #{railwayStation.regionCode}
|
||||
</if>
|
||||
<if test="railwayStation.regionName != null and railwayStation.regionName != ''">
|
||||
<bind name="regionNameLike" value="'%' + railwayStation.regionName + '%'"/>
|
||||
AND rs.region_name LIKE #{regionNameLike}
|
||||
|
||||
@@ -45,6 +45,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -147,12 +148,21 @@ public class AirportMasterServiceImpl extends BaseServiceImpl<AirportMasterMappe
|
||||
List<AirportMaster> airportMasterList = list(queryWrapper);
|
||||
return airportMasterList.stream().map(airportMaster -> {
|
||||
AirportMasterExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(airportMaster, AirportMasterExcel.class));
|
||||
excel.setLongitude(scaleCoordinate(airportMaster.getLongitude(), MIN_LONGITUDE, MAX_LONGITUDE));
|
||||
excel.setLatitude(scaleCoordinate(airportMaster.getLatitude(), MIN_LATITUDE, MAX_LATITUDE));
|
||||
excel.setDataSource(normalizeDataSource(airportMaster.getDataSource()));
|
||||
excel.setStatusName(Objects.equals(airportMaster.getStatus(), STATUS_ENABLED) ? "启用" : "停用");
|
||||
return excel;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
private BigDecimal scaleCoordinate(BigDecimal value, BigDecimal min, BigDecimal max) {
|
||||
if (Func.isEmpty(value)) {
|
||||
return null;
|
||||
}
|
||||
return validRange(value, min, max) ? value.setScale(6, RoundingMode.HALF_UP) : null;
|
||||
}
|
||||
|
||||
private void prepare(AirportMaster airportMaster, String defaultDataSource) {
|
||||
airportMaster.setIataCode(trimToEmpty(airportMaster.getIataCode()).toUpperCase(Locale.ROOT));
|
||||
airportMaster.setCode(CODE_PREFIX + airportMaster.getIataCode());
|
||||
@@ -244,6 +254,8 @@ public class AirportMasterServiceImpl extends BaseServiceImpl<AirportMasterMappe
|
||||
airportMaster.setProvinceName(province.getName());
|
||||
airportMaster.setCityCode(city.getCode());
|
||||
airportMaster.setCityName(city.getName());
|
||||
airportMaster.setRegionCode(city.getCode());
|
||||
airportMaster.setRegionName(city.getName());
|
||||
}
|
||||
|
||||
private void validateCoordinate(BigDecimal value, BigDecimal min, BigDecimal max, String name) {
|
||||
@@ -255,6 +267,10 @@ public class AirportMasterServiceImpl extends BaseServiceImpl<AirportMasterMappe
|
||||
}
|
||||
}
|
||||
|
||||
private boolean validRange(BigDecimal value, BigDecimal min, BigDecimal max) {
|
||||
return Func.isEmpty(value) || (value.compareTo(min) >= 0 && value.compareTo(max) <= 0);
|
||||
}
|
||||
|
||||
private void validateDataSource(String dataSource) {
|
||||
if (!SOURCE_INITIAL.equals(dataSource) && !SOURCE_BATCH.equals(dataSource) && !SOURCE_MANUAL.equals(dataSource)) {
|
||||
throw new ServiceException("数据来源不正确");
|
||||
|
||||
@@ -42,6 +42,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -67,6 +68,8 @@ public class PortTerminalServiceImpl extends BaseServiceImpl<PortTerminalMapper,
|
||||
private static final int CODE_MAX_LENGTH = 30;
|
||||
private static final int NAME_MAX_LENGTH = 100;
|
||||
private static final int REGION_MAX_LENGTH = 50;
|
||||
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 BigDecimal MIN_LONGITUDE = new BigDecimal("-180");
|
||||
private static final BigDecimal MAX_LONGITUDE = new BigDecimal("180");
|
||||
@@ -149,20 +152,29 @@ public class PortTerminalServiceImpl extends BaseServiceImpl<PortTerminalMapper,
|
||||
List<PortTerminal> portTerminalList = list(queryWrapper);
|
||||
return portTerminalList.stream().map(portTerminal -> {
|
||||
PortTerminalExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(portTerminal, PortTerminalExcel.class));
|
||||
excel.setLongitude(validRange(portTerminal.getLongitude(), MIN_LONGITUDE, MAX_LONGITUDE) ? portTerminal.getLongitude() : null);
|
||||
excel.setLatitude(validRange(portTerminal.getLatitude(), MIN_LATITUDE, MAX_LATITUDE) ? portTerminal.getLatitude() : null);
|
||||
excel.setLongitude(scaleCoordinate(portTerminal.getLongitude(), MIN_LONGITUDE, MAX_LONGITUDE));
|
||||
excel.setLatitude(scaleCoordinate(portTerminal.getLatitude(), MIN_LATITUDE, MAX_LATITUDE));
|
||||
excel.setDataSource(normalizeDataSource(portTerminal.getDataSource()));
|
||||
excel.setStatusName(Objects.equals(portTerminal.getStatus(), STATUS_ENABLED) ? "启用" : "停用");
|
||||
return excel;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
private BigDecimal scaleCoordinate(BigDecimal value, BigDecimal min, BigDecimal max) {
|
||||
if (Func.isEmpty(value)) {
|
||||
return null;
|
||||
}
|
||||
return validRange(value, min, max) ? value.setScale(6, RoundingMode.HALF_UP) : null;
|
||||
}
|
||||
|
||||
private void prepare(PortTerminal portTerminal, String defaultDataSource) {
|
||||
portTerminal.setCode(trimToEmpty(portTerminal.getCode()).toUpperCase(Locale.ROOT));
|
||||
portTerminal.setCategory(trimToEmpty(portTerminal.getCategory()));
|
||||
portTerminal.setName(trimToEmpty(portTerminal.getName()));
|
||||
portTerminal.setCountry(trimToEmpty(portTerminal.getCountry()));
|
||||
portTerminal.setCity(trimToEmpty(portTerminal.getCity()));
|
||||
portTerminal.setRegionCode(trimToNull(portTerminal.getRegionCode()));
|
||||
portTerminal.setDetailAddress(trimToNull(portTerminal.getDetailAddress()));
|
||||
portTerminal.setRemark(trimToNull(portTerminal.getRemark()));
|
||||
portTerminal.setDataSource(normalizeDataSource(Func.toStrWithEmpty(portTerminal.getDataSource(), defaultDataSource)));
|
||||
if (Func.isEmpty(portTerminal.getStatus())) {
|
||||
@@ -199,6 +211,7 @@ public class PortTerminalServiceImpl extends BaseServiceImpl<PortTerminalMapper,
|
||||
portTerminal.setParentName(parent.getName());
|
||||
portTerminal.setCountry(parent.getCountry());
|
||||
portTerminal.setCity(parent.getCity());
|
||||
portTerminal.setRegionCode(parent.getRegionCode());
|
||||
}
|
||||
|
||||
private void validate(PortTerminal portTerminal) {
|
||||
@@ -215,6 +228,8 @@ public class PortTerminalServiceImpl extends BaseServiceImpl<PortTerminalMapper,
|
||||
validateLength(portTerminal.getName(), NAME_MAX_LENGTH, "港口/码头名称不能超过100字");
|
||||
validateLength(portTerminal.getCountry(), REGION_MAX_LENGTH, "国家不能超过50字");
|
||||
validateLength(portTerminal.getCity(), REGION_MAX_LENGTH, "城市不能超过50字");
|
||||
validateLength(portTerminal.getRegionCode(), REGION_CODE_MAX_LENGTH, "行政区划编码不能超过32字");
|
||||
validateLength(portTerminal.getDetailAddress(), DETAIL_ADDRESS_MAX_LENGTH, "详细地址不能超过255字");
|
||||
validateLength(portTerminal.getRemark(), REMARK_MAX_LENGTH, "备注不能超过200个字");
|
||||
if (CATEGORY_PORT.equals(portTerminal.getCategory()) && !PORT_CODE_PATTERN.matcher(portTerminal.getCode()).matches()) {
|
||||
throw new ServiceException("港口编码为5位大写字母");
|
||||
|
||||
@@ -45,6 +45,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -150,12 +151,21 @@ public class RailwayStationServiceImpl extends BaseServiceImpl<RailwayStationMap
|
||||
List<RailwayStation> railwayStationList = list(queryWrapper);
|
||||
return railwayStationList.stream().map(railwayStation -> {
|
||||
RailwayStationExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(railwayStation, RailwayStationExcel.class));
|
||||
excel.setLongitude(scaleCoordinate(railwayStation.getLongitude(), MIN_LONGITUDE, MAX_LONGITUDE));
|
||||
excel.setLatitude(scaleCoordinate(railwayStation.getLatitude(), MIN_LATITUDE, MAX_LATITUDE));
|
||||
excel.setDataSource(normalizeDataSource(railwayStation.getDataSource()));
|
||||
excel.setStatusName(Objects.equals(railwayStation.getStatus(), STATUS_ENABLED) ? "启用" : "停用");
|
||||
return excel;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
private BigDecimal scaleCoordinate(BigDecimal value, BigDecimal min, BigDecimal max) {
|
||||
if (Func.isEmpty(value)) {
|
||||
return null;
|
||||
}
|
||||
return validRange(value, min, max) ? value.setScale(6, RoundingMode.HALF_UP) : null;
|
||||
}
|
||||
|
||||
private void prepare(RailwayStation railwayStation, String defaultDataSource) {
|
||||
railwayStation.setTmisCode(trimToEmpty(railwayStation.getTmisCode()));
|
||||
railwayStation.setCode(CODE_PREFIX + railwayStation.getTmisCode());
|
||||
@@ -247,6 +257,8 @@ public class RailwayStationServiceImpl extends BaseServiceImpl<RailwayStationMap
|
||||
railwayStation.setProvinceName(province.getName());
|
||||
railwayStation.setCityCode(city.getCode());
|
||||
railwayStation.setCityName(city.getName());
|
||||
railwayStation.setRegionCode(city.getCode());
|
||||
railwayStation.setRegionName(city.getName());
|
||||
}
|
||||
|
||||
private void validateCoordinate(BigDecimal value, BigDecimal min, BigDecimal max, String name) {
|
||||
@@ -258,6 +270,10 @@ public class RailwayStationServiceImpl extends BaseServiceImpl<RailwayStationMap
|
||||
}
|
||||
}
|
||||
|
||||
private boolean validRange(BigDecimal value, BigDecimal min, BigDecimal max) {
|
||||
return Func.isEmpty(value) || (value.compareTo(min) >= 0 && value.compareTo(max) <= 0);
|
||||
}
|
||||
|
||||
private void validateDataSource(String dataSource) {
|
||||
if (!SOURCE_INITIAL.equals(dataSource) && !SOURCE_BATCH.equals(dataSource) && !SOURCE_MANUAL.equals(dataSource)) {
|
||||
throw new ServiceException("数据来源不正确");
|
||||
|
||||
@@ -27,6 +27,7 @@ package org.springblade.system.wrapper;
|
||||
|
||||
import org.springblade.core.mp.support.BaseEntityWrapper;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.system.cache.UserCache;
|
||||
import org.springblade.system.pojo.entity.Currency;
|
||||
import org.springblade.system.pojo.vo.CurrencyVO;
|
||||
|
||||
@@ -45,7 +46,9 @@ public class CurrencyWrapper extends BaseEntityWrapper<Currency, CurrencyVO> {
|
||||
|
||||
@Override
|
||||
public CurrencyVO entityVO(Currency currency) {
|
||||
return Objects.requireNonNull(BeanUtil.copyProperties(currency, CurrencyVO.class));
|
||||
CurrencyVO currencyVO = Objects.requireNonNull(BeanUtil.copyProperties(currency, CurrencyVO.class));
|
||||
currencyVO.setUpdateUserName(UserCache.getUserRealName(currency.getUpdateUser()));
|
||||
return currencyVO;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user