✨ 优化主数据校验与运单导入空值处理
电报略码改为选填且填写时唯一;用户支持账号姓名手机模糊查询;合同名称允许重复;项目情况说明扩至1000字;导入运单未填里程费用不再落库-1。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+2
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
package org.springblade.system.pojo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -63,6 +64,7 @@ public class RailwayStation extends BaseEntity {
|
||||
* 电报略码
|
||||
*/
|
||||
@Schema(description = "电报略码")
|
||||
@TableField(updateStrategy = FieldStrategy.ALWAYS)
|
||||
private String telegraphCode;
|
||||
/**
|
||||
* 车站名称
|
||||
|
||||
+8
-6
@@ -112,11 +112,12 @@ public class UserController {
|
||||
@GetMapping("/list")
|
||||
@BladeView(Views.Admin.class)
|
||||
@Parameters({
|
||||
@Parameter(name = "account", description = "账号名", in = ParameterIn.QUERY, schema = @Schema(type = "string")),
|
||||
@Parameter(name = "realName", description = "姓名", in = ParameterIn.QUERY, schema = @Schema(type = "string"))
|
||||
@Parameter(name = "account", description = "账号名(模糊)", in = ParameterIn.QUERY, schema = @Schema(type = "string")),
|
||||
@Parameter(name = "realName", description = "姓名(模糊)", in = ParameterIn.QUERY, schema = @Schema(type = "string")),
|
||||
@Parameter(name = "phone", description = "手机号(模糊)", in = ParameterIn.QUERY, schema = @Schema(type = "string"))
|
||||
})
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "列表", description = "传入account和realName")
|
||||
@Operation(summary = "列表", description = "传入account、realName、phone,支持模糊搜索")
|
||||
public R<IPage<UserVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> user, Query query) {
|
||||
return R.data(userService.selectPage(user, query));
|
||||
}
|
||||
@@ -128,11 +129,12 @@ public class UserController {
|
||||
@GetMapping("/page")
|
||||
@BladeView(Views.Admin.class)
|
||||
@Parameters({
|
||||
@Parameter(name = "account", description = "账号名", in = ParameterIn.QUERY, schema = @Schema(type = "string")),
|
||||
@Parameter(name = "realName", description = "姓名", in = ParameterIn.QUERY, schema = @Schema(type = "string"))
|
||||
@Parameter(name = "account", description = "账号名(模糊)", in = ParameterIn.QUERY, schema = @Schema(type = "string")),
|
||||
@Parameter(name = "realName", description = "姓名(模糊)", in = ParameterIn.QUERY, schema = @Schema(type = "string")),
|
||||
@Parameter(name = "phone", description = "手机号(模糊)", in = ParameterIn.QUERY, schema = @Schema(type = "string"))
|
||||
})
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "列表", description = "传入account和realName")
|
||||
@Operation(summary = "列表", description = "传入account、realName、phone,支持模糊搜索")
|
||||
public R<IPage<UserVO>> page(@Parameter(hidden = true) User user, Query query, Long deptId, BladeUser bladeUser) {
|
||||
IPage<User> pages = userService.selectUserPage(Condition.getPage(query), user, deptId, (AuthUtil.isAdministrator() ? StringPool.EMPTY : bladeUser.getTenantId()));
|
||||
return R.data(UserWrapper.build().pageVO(pages));
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ public class RailwayStationExcel implements Serializable {
|
||||
@ExcelProperty("TMIS国标编码*")
|
||||
private String tmisCode;
|
||||
|
||||
@ExcelProperty("电报略码*")
|
||||
@ExcelProperty("电报略码")
|
||||
private String telegraphCode;
|
||||
|
||||
@ExcelProperty("车站名称*")
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ public class RailwayStationExportExcel implements Serializable {
|
||||
@ExcelProperty("TMIS国标编码*")
|
||||
private String tmisCode;
|
||||
|
||||
@ExcelProperty("电报略码*")
|
||||
@ExcelProperty("电报略码")
|
||||
private String telegraphCode;
|
||||
|
||||
@ExcelProperty("车站名称*")
|
||||
|
||||
+6
-6
@@ -44,16 +44,16 @@
|
||||
and bu.tenant_id = #{user.tenantId}
|
||||
</if>
|
||||
<if test="user.account!=null and user.account != ''">
|
||||
and bu.account like concat(concat('%', #{user.account}), '%')
|
||||
and bu.account like concat('%', #{user.account}, '%')
|
||||
</if>
|
||||
<if test="user.realName!=null and user.realName != ''">
|
||||
and bu.real_name like concat(concat('%', #{user.realName}), '%')
|
||||
and (
|
||||
bu.real_name like concat('%', #{user.realName}, '%')
|
||||
or bu.name like concat('%', #{user.realName}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="user.phone!=null and user.phone != ''">
|
||||
and (
|
||||
bu.phone like concat(concat('%', #{user.phone}), '%')
|
||||
or bu.account like concat(concat('%', #{user.phone}), '%')
|
||||
)
|
||||
and bu.phone like concat('%', #{user.phone}, '%')
|
||||
</if>
|
||||
<if test="user.userType!=null and user.userType != ''">
|
||||
and bu.user_type = #{user.userType}
|
||||
|
||||
+13
-10
@@ -207,7 +207,7 @@ public class RailwayStationServiceImpl extends BaseServiceImpl<RailwayStationMap
|
||||
private void normalizeImportRailwayStation(RailwayStation railwayStation) {
|
||||
railwayStation.setTmisCode(trimToEmpty(railwayStation.getTmisCode()));
|
||||
railwayStation.setCode(CODE_PREFIX + railwayStation.getTmisCode());
|
||||
railwayStation.setTelegraphCode(trimToEmpty(railwayStation.getTelegraphCode()).toUpperCase(Locale.ROOT));
|
||||
railwayStation.setTelegraphCode(normalizeTelegraphCode(railwayStation.getTelegraphCode()));
|
||||
railwayStation.setName(trimToEmpty(railwayStation.getName()));
|
||||
railwayStation.setProvinceCode(trimToNull(railwayStation.getProvinceCode()));
|
||||
railwayStation.setProvinceName(trimToNull(railwayStation.getProvinceName()));
|
||||
@@ -247,9 +247,7 @@ public class RailwayStationServiceImpl extends BaseServiceImpl<RailwayStationMap
|
||||
validateImportUnique(RailwayStation::getTmisCode, railwayStation.getTmisCode(), "该TMIS国标编码已存在", validationErrors);
|
||||
validateImportUnique(RailwayStation::getCode, railwayStation.getCode(), "该编码已存在", validationErrors);
|
||||
}
|
||||
if (Func.isEmpty(railwayStation.getTelegraphCode())) {
|
||||
addValidationError(validationErrors, "电报略码不能为空");
|
||||
} else {
|
||||
if (Func.isNotEmpty(railwayStation.getTelegraphCode())) {
|
||||
if (!TELEGRAPH_CODE_PATTERN.matcher(railwayStation.getTelegraphCode()).matches()) {
|
||||
addValidationError(validationErrors, "电报略码为3位大写字母");
|
||||
}
|
||||
@@ -377,7 +375,7 @@ public class RailwayStationServiceImpl extends BaseServiceImpl<RailwayStationMap
|
||||
private void prepare(RailwayStation railwayStation, String defaultDataSource) {
|
||||
railwayStation.setTmisCode(trimToEmpty(railwayStation.getTmisCode()));
|
||||
railwayStation.setCode(CODE_PREFIX + railwayStation.getTmisCode());
|
||||
railwayStation.setTelegraphCode(trimToEmpty(railwayStation.getTelegraphCode()).toUpperCase(Locale.ROOT));
|
||||
railwayStation.setTelegraphCode(normalizeTelegraphCode(railwayStation.getTelegraphCode()));
|
||||
railwayStation.setName(trimToEmpty(railwayStation.getName()));
|
||||
railwayStation.setRailwayLine(trimToNull(railwayStation.getRailwayLine()));
|
||||
railwayStation.setProvinceCode(trimToNull(railwayStation.getProvinceCode()));
|
||||
@@ -410,10 +408,8 @@ public class RailwayStationServiceImpl extends BaseServiceImpl<RailwayStationMap
|
||||
if (!TMIS_CODE_PATTERN.matcher(railwayStation.getTmisCode()).matches()) {
|
||||
throw new ServiceException("TMIS国标编码为5位数字");
|
||||
}
|
||||
if (Func.isEmpty(railwayStation.getTelegraphCode())) {
|
||||
throw new ServiceException("电报略码格式不正确或已存在");
|
||||
}
|
||||
if (!TELEGRAPH_CODE_PATTERN.matcher(railwayStation.getTelegraphCode()).matches()) {
|
||||
if (Func.isNotEmpty(railwayStation.getTelegraphCode())
|
||||
&& !TELEGRAPH_CODE_PATTERN.matcher(railwayStation.getTelegraphCode()).matches()) {
|
||||
throw new ServiceException("电报略码格式不正确或已存在");
|
||||
}
|
||||
if (Func.isEmpty(railwayStation.getName())) {
|
||||
@@ -446,7 +442,9 @@ public class RailwayStationServiceImpl extends BaseServiceImpl<RailwayStationMap
|
||||
validateDataSource(railwayStation.getDataSource());
|
||||
validateStatus(railwayStation.getStatus());
|
||||
validateUnique(railwayStation, RailwayStation::getTmisCode, railwayStation.getTmisCode(), "该TMIS编码已存在");
|
||||
validateUnique(railwayStation, RailwayStation::getTelegraphCode, railwayStation.getTelegraphCode(), "电报略码格式不正确或已存在");
|
||||
if (Func.isNotEmpty(railwayStation.getTelegraphCode())) {
|
||||
validateUnique(railwayStation, RailwayStation::getTelegraphCode, railwayStation.getTelegraphCode(), "电报略码格式不正确或已存在");
|
||||
}
|
||||
validateUnique(railwayStation, RailwayStation::getCode, railwayStation.getCode(), "该编码已存在");
|
||||
}
|
||||
|
||||
@@ -562,6 +560,11 @@ public class RailwayStationServiceImpl extends BaseServiceImpl<RailwayStationMap
|
||||
return trimValue.isEmpty() ? null : trimValue;
|
||||
}
|
||||
|
||||
private String normalizeTelegraphCode(String value) {
|
||||
String telegraphCode = trimToNull(value);
|
||||
return telegraphCode == null ? null : telegraphCode.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
private String normalizeDataSource(String dataSource) {
|
||||
String value = trimToEmpty(dataSource);
|
||||
if (SOURCE_INITIAL_OLD.equals(value)) {
|
||||
|
||||
+38
@@ -133,8 +133,12 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
||||
|
||||
@Override
|
||||
public IPage<UserVO> selectPage(Map<String, Object> user, Query query) {
|
||||
String account = Func.toStr(user.remove("account")).trim();
|
||||
String realName = Func.toStr(user.remove("realName")).trim();
|
||||
String phone = Func.toStr(user.remove("phone")).trim();
|
||||
QueryWrapper<User> queryWrapper = Condition.getQueryWrapper(user, User.class);
|
||||
applyTenantScope(queryWrapper);
|
||||
applyUserFuzzyFilters(queryWrapper, account, realName, phone);
|
||||
return UserWrapper.build().pageVO(page(Condition.getPage(query), queryWrapper));
|
||||
}
|
||||
|
||||
@@ -378,6 +382,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
||||
|
||||
@Override
|
||||
public IPage<User> selectUserPage(IPage<User> page, User user, Long deptId, String tenantId) {
|
||||
normalizeUserSearch(user);
|
||||
List<Long> deptIdList = SysCache.getDeptChildIds(deptId);
|
||||
return page.setRecords(baseMapper.selectUserPage(page, user, deptIdList, tenantId));
|
||||
}
|
||||
@@ -713,8 +718,12 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
||||
|
||||
@Override
|
||||
public List<UserExcel> exportUser(Map<String, Object> user) {
|
||||
String account = Func.toStr(user.remove("account")).trim();
|
||||
String realName = Func.toStr(user.remove("realName")).trim();
|
||||
String phone = Func.toStr(user.remove("phone")).trim();
|
||||
QueryWrapper<User> queryWrapper = Condition.getQueryWrapper(user, User.class);
|
||||
applyTenantScope(queryWrapper);
|
||||
applyUserFuzzyFilters(queryWrapper, account, realName, phone);
|
||||
queryWrapper.lambda().eq(User::getIsDeleted, BladeConstant.DB_NOT_DELETED);
|
||||
return exportUser(queryWrapper);
|
||||
}
|
||||
@@ -1127,6 +1136,35 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 归一化用户列表搜索条件,避免首尾空格导致模糊匹配失效。
|
||||
*/
|
||||
private void normalizeUserSearch(User user) {
|
||||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
if (user.getAccount() != null) {
|
||||
user.setAccount(user.getAccount().trim());
|
||||
}
|
||||
if (user.getRealName() != null) {
|
||||
user.setRealName(user.getRealName().trim());
|
||||
}
|
||||
if (user.getPhone() != null) {
|
||||
user.setPhone(user.getPhone().trim());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 账号名、姓名、手机号统一按模糊匹配过滤。
|
||||
*/
|
||||
private void applyUserFuzzyFilters(QueryWrapper<User> queryWrapper, String account, String realName, String phone) {
|
||||
queryWrapper.lambda().like(StringUtil.isNotBlank(account), User::getAccount, account);
|
||||
if (StringUtil.isNotBlank(realName)) {
|
||||
queryWrapper.lambda().and(wrapper -> wrapper.like(User::getRealName, realName).or().like(User::getName, realName));
|
||||
}
|
||||
queryWrapper.lambda().like(StringUtil.isNotBlank(phone), User::getPhone, phone);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void decryptPhone(IPhone user) {
|
||||
|
||||
+1
-11
@@ -670,7 +670,7 @@ public class ContractManageServiceImpl extends BaseServiceImpl<ContractManageMap
|
||||
private void validateDraft(ContractManage contractManage) {
|
||||
TransportBusinessSupport.validateRequired(contractManage.getContractName(), "请输入合同名称");
|
||||
TransportBusinessSupport.validateRequired(contractManage.getContractCategory(), "请选择合同类别");
|
||||
validateContractNameUnique(contractManage);
|
||||
// 合同名称允许重复,唯一性由合同编号保证。
|
||||
TransportBusinessSupport.validateLength(contractManage.getRemark(), 2000, "备注不能超过2000字");
|
||||
}
|
||||
|
||||
@@ -787,16 +787,6 @@ public class ContractManageServiceImpl extends BaseServiceImpl<ContractManageMap
|
||||
}
|
||||
}
|
||||
|
||||
private void validateContractNameUnique(ContractManage contractManage) {
|
||||
Long count = count(Wrappers.<ContractManage>lambdaQuery()
|
||||
.eq(ContractManage::getIsDeleted, 0)
|
||||
.eq(ContractManage::getContractName, contractManage.getContractName())
|
||||
.ne(Func.isNotEmpty(contractManage.getId()), ContractManage::getId, contractManage.getId()));
|
||||
if (count > 0) {
|
||||
throw new ServiceException("合同名称已存在");
|
||||
}
|
||||
}
|
||||
|
||||
private void validateContractPartyCombinationUnique(ContractManage contractManage) {
|
||||
if (Func.isEmpty(contractManage.getContractCategory())
|
||||
|| Func.isEmpty(contractManage.getPartyA())
|
||||
|
||||
+28
@@ -770,6 +770,34 @@ public class ProjectApplyServiceImpl extends BaseServiceImpl<ProjectApplyMapper,
|
||||
TransportBusinessSupport.validateLength(projectApply.getSourceRemark(), 300, "项目由来说明不能超过300个字");
|
||||
TransportBusinessSupport.validateLength(projectApply.getCargoQuantity(), 100, "预估货物数量不能超过100个字");
|
||||
TransportBusinessSupport.validateLength(projectApply.getTransportRoute(), 100, "运输线路不能超过100个字");
|
||||
validateSituationRemarkLength(projectApply.getSituationRemark());
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验项目情况说明各字段长度(JSON:项目简介/盈利模式/风险点/应急预案)。
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private void validateSituationRemarkLength(String situationRemark) {
|
||||
if (Func.isBlank(situationRemark)) {
|
||||
return;
|
||||
}
|
||||
Object parsed;
|
||||
try {
|
||||
parsed = JsonUtil.parse(situationRemark, Object.class);
|
||||
} catch (Exception exception) {
|
||||
// 历史纯文本按整段校验。
|
||||
TransportBusinessSupport.validateLength(situationRemark, 1000, "项目情况说明不能超过1000个字");
|
||||
return;
|
||||
}
|
||||
if (!(parsed instanceof Map<?, ?> situationMap)) {
|
||||
TransportBusinessSupport.validateLength(situationRemark, 1000, "项目情况说明不能超过1000个字");
|
||||
return;
|
||||
}
|
||||
Map<String, Object> data = (Map<String, Object>) situationMap;
|
||||
TransportBusinessSupport.validateLength(Func.toStr(data.get("projectIntro")), 1000, "项目简介不能超过1000个字");
|
||||
TransportBusinessSupport.validateLength(Func.toStr(data.get("profitRemark")), 1000, "盈利模式及利润测算情况说明不能超过1000个字");
|
||||
TransportBusinessSupport.validateLength(Func.toStr(data.get("riskPoint")), 1000, "项目风险点不能超过1000个字");
|
||||
TransportBusinessSupport.validateLength(Func.toStr(data.get("emergencyPlan")), 1000, "风险防范措施及应急预案不能超过1000个字");
|
||||
}
|
||||
|
||||
private void validateChange(ProjectApply projectApply, String changeType) {
|
||||
|
||||
+38
-10
@@ -455,12 +455,12 @@ public class WaybillImportBatchServiceImpl extends BaseServiceImpl<WaybillImport
|
||||
waybill.setTrailerVehicleNo(stringValue(row, "trailerVehicleNo"));
|
||||
waybill.setEscortName(stringValue(row, "escortName"));
|
||||
waybill.setEscortPhone(stringValue(row, "escortPhone"));
|
||||
waybill.setMileage(normalizeImportMileage(decimalValue(
|
||||
waybill.setMileage(normalizeImportOptionalDecimal(decimalValue(
|
||||
row, "mileage", "里程", "里程(km)", "里程(公里)"
|
||||
)));
|
||||
waybill.setUnitPrice(decimalValue(row, "unitPrice", "单价"));
|
||||
waybill.setUnitPrice(normalizeImportOptionalDecimal(decimalValue(row, "unitPrice", "单价")));
|
||||
waybill.setPriceUnit(stringValue(row, "priceUnit"));
|
||||
waybill.setOtherFeeTotal(decimalValue(row, "otherFeeTotal", "其他费用合计"));
|
||||
waybill.setOtherFeeTotal(normalizeImportOptionalDecimal(decimalValue(row, "otherFeeTotal", "其他费用合计")));
|
||||
waybill.setRemark(stringValue(row, "remark"));
|
||||
waybill.setRelationNo(stringValue(row, "waybillIdentifier", "同一运单标识号"));
|
||||
waybill.setProjectId(batch.getProjectId());
|
||||
@@ -516,7 +516,9 @@ public class WaybillImportBatchServiceImpl extends BaseServiceImpl<WaybillImport
|
||||
|
||||
private BigDecimal decimalValue(Map<String, Object> row, String field, String fieldName, String... aliases) {
|
||||
String value = stringValue(row, field, aliases);
|
||||
if (Func.isEmpty(value)) return null;
|
||||
if (Func.isEmpty(value) || isImportOptionalNumberEmpty(value)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return new BigDecimal(value);
|
||||
} catch (NumberFormatException exception) {
|
||||
@@ -524,8 +526,32 @@ public class WaybillImportBatchServiceImpl extends BaseServiceImpl<WaybillImport
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal normalizeImportMileage(BigDecimal mileage) {
|
||||
return mileage != null && mileage.compareTo(BigDecimal.ONE.negate()) == 0 ? null : mileage;
|
||||
/**
|
||||
* BladeX 数字 null 常被序列化为 -1;导入未填的可选金额/里程不得按 -1 落库。
|
||||
*/
|
||||
private BigDecimal normalizeImportOptionalDecimal(BigDecimal value) {
|
||||
return isImportOptionalNumberEmpty(value) ? null : value;
|
||||
}
|
||||
|
||||
private boolean isImportOptionalNumberEmpty(Object value) {
|
||||
if (value == null) {
|
||||
return true;
|
||||
}
|
||||
if (value instanceof BigDecimal bigDecimal) {
|
||||
return bigDecimal.compareTo(BigDecimal.ONE.negate()) == 0;
|
||||
}
|
||||
if (value instanceof Number number) {
|
||||
return Double.compare(number.doubleValue(), -1D) == 0;
|
||||
}
|
||||
String text = String.valueOf(value).trim();
|
||||
if (Func.isEmpty(text)) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
return new BigDecimal(text).compareTo(BigDecimal.ONE.negate()) == 0;
|
||||
} catch (NumberFormatException exception) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private LocalDate parseDate(Object value, String fieldName, boolean required, String... aliases) {
|
||||
@@ -809,7 +835,7 @@ public class WaybillImportBatchServiceImpl extends BaseServiceImpl<WaybillImport
|
||||
|
||||
private void validatePositiveNumber(Map<String, Object> row, String field, String fieldName, List<String> errors) {
|
||||
String value = stringValue(row, field, fieldName);
|
||||
if (Func.isEmpty(value)) {
|
||||
if (Func.isEmpty(value) || isImportOptionalNumberEmpty(value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -836,7 +862,7 @@ public class WaybillImportBatchServiceImpl extends BaseServiceImpl<WaybillImport
|
||||
|
||||
private void validateFreightTotal(Map<String, Object> row, List<String> errors) {
|
||||
String freightTotalStr = stringValue(row, "freightTotal", "运费合计");
|
||||
if (Func.isEmpty(freightTotalStr)) {
|
||||
if (Func.isEmpty(freightTotalStr) || isImportOptionalNumberEmpty(freightTotalStr)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -845,8 +871,10 @@ public class WaybillImportBatchServiceImpl extends BaseServiceImpl<WaybillImport
|
||||
String freightStr = stringValue(row, "freight", "运费");
|
||||
String otherFeeTotalStr = stringValue(row, "otherFeeTotal", "其他费用合计");
|
||||
|
||||
BigDecimal freight = Func.isNotEmpty(freightStr) ? new BigDecimal(freightStr) : BigDecimal.ZERO;
|
||||
BigDecimal otherFeeTotal = Func.isNotEmpty(otherFeeTotalStr) ? new BigDecimal(otherFeeTotalStr) : BigDecimal.ZERO;
|
||||
BigDecimal freight = Func.isNotEmpty(freightStr) && !isImportOptionalNumberEmpty(freightStr)
|
||||
? new BigDecimal(freightStr) : BigDecimal.ZERO;
|
||||
BigDecimal otherFeeTotal = Func.isNotEmpty(otherFeeTotalStr) && !isImportOptionalNumberEmpty(otherFeeTotalStr)
|
||||
? new BigDecimal(otherFeeTotalStr) : BigDecimal.ZERO;
|
||||
|
||||
BigDecimal calculatedTotal = freight.add(otherFeeTotal);
|
||||
if (freightTotal.compareTo(calculatedTotal) != 0) {
|
||||
|
||||
+13
-2
@@ -2211,9 +2211,20 @@ public class WaybillServiceImpl extends BaseServiceImpl<WaybillMapper, Waybill>
|
||||
}
|
||||
|
||||
private void putIfNotEmpty(Map<String, Object> map, String key, Object value) {
|
||||
if (Func.isNotEmpty(value)) {
|
||||
map.put(key, value);
|
||||
if (Func.isEmpty(value) || isSentinelMinusOneValue(value)) {
|
||||
return;
|
||||
}
|
||||
map.put(key, value);
|
||||
}
|
||||
|
||||
private boolean isSentinelMinusOneValue(Object value) {
|
||||
if (value instanceof BigDecimal bigDecimal) {
|
||||
return isSentinelMinusOne(bigDecimal);
|
||||
}
|
||||
if (value instanceof Number number) {
|
||||
return Double.compare(number.doubleValue(), -1D) == 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private synchronized String nextCode() {
|
||||
|
||||
+4
-1
@@ -62,7 +62,7 @@ public class WaybillWrapper extends BaseEntityWrapper<Waybill, WaybillVO> {
|
||||
waybillVO.setBusinessStatusName(businessStatusName(displayStatus));
|
||||
waybillVO.setTransportTypeName(transportTypeName(waybill.getTransportType()));
|
||||
waybillVO.setRequireAccept(WaybillProcessSupport.requiresDriverAcceptConfirmation(waybill.getProcessJson()));
|
||||
// 未维护里程等占位值 -1 对外展示为空
|
||||
// 未维护里程/费用等占位值 -1 对外展示为空
|
||||
if (isSentinelMinusOne(waybillVO.getMileage())) {
|
||||
waybillVO.setMileage(null);
|
||||
}
|
||||
@@ -72,6 +72,9 @@ public class WaybillWrapper extends BaseEntityWrapper<Waybill, WaybillVO> {
|
||||
if (isSentinelMinusOne(waybillVO.getUnitPrice())) {
|
||||
waybillVO.setUnitPrice(null);
|
||||
}
|
||||
if (isSentinelMinusOne(waybillVO.getOtherFeeTotal())) {
|
||||
waybillVO.setOtherFeeTotal(null);
|
||||
}
|
||||
// 计划未选时 planId 可能为库内 -1 或序列化占位,统一清空避免前端回显 -1
|
||||
if (waybillVO.getPlanId() != null && waybillVO.getPlanId() <= 0L) {
|
||||
waybillVO.setPlanId(null);
|
||||
|
||||
@@ -2442,7 +2442,7 @@ CREATE TABLE "blade_railway_station" (
|
||||
"id" int8 NOT NULL,
|
||||
"code" varchar(20) NOT NULL,
|
||||
"tmis_code" varchar(5) NOT NULL,
|
||||
"telegraph_code" varchar(3) NOT NULL,
|
||||
"telegraph_code" varchar(3) NULL,
|
||||
"name" varchar(100) NOT NULL,
|
||||
"railway_line" varchar(100),
|
||||
"province_code" varchar(12),
|
||||
|
||||
@@ -1550,7 +1550,7 @@ CREATE TABLE `blade_railway_station` (
|
||||
`id` bigint NOT NULL COMMENT '主键',
|
||||
`code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编码',
|
||||
`tmis_code` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'TMIS国标编码',
|
||||
`telegraph_code` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '电报码',
|
||||
`telegraph_code` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '电报码',
|
||||
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '车站名称',
|
||||
`railway_line` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属铁路线路',
|
||||
`province_code` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属省份编码',
|
||||
|
||||
@@ -2442,7 +2442,7 @@ CREATE TABLE "blade_railway_station" (
|
||||
"id" int8 NOT NULL,
|
||||
"code" varchar(20) NOT NULL,
|
||||
"tmis_code" varchar(5) NOT NULL,
|
||||
"telegraph_code" varchar(3) NOT NULL,
|
||||
"telegraph_code" varchar(3) NULL,
|
||||
"name" varchar(100) NOT NULL,
|
||||
"railway_line" varchar(100),
|
||||
"province_code" varchar(12),
|
||||
|
||||
@@ -7592,7 +7592,7 @@ CREATE TABLE [dbo].[blade_railway_station] (
|
||||
[id] bigint NOT NULL,
|
||||
[code] nvarchar(20) NOT NULL,
|
||||
[tmis_code] nvarchar(5) NOT NULL,
|
||||
[telegraph_code] nvarchar(3) NOT NULL,
|
||||
[telegraph_code] nvarchar(3) NULL,
|
||||
[name] nvarchar(100) NOT NULL,
|
||||
[railway_line] nvarchar(100) NULL,
|
||||
[province_code] nvarchar(12) NULL,
|
||||
|
||||
@@ -6,7 +6,7 @@ CREATE TABLE `blade_railway_station` (
|
||||
`id` bigint NOT NULL COMMENT '主键',
|
||||
`code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编码',
|
||||
`tmis_code` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'TMIS国标编码',
|
||||
`telegraph_code` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '电报码',
|
||||
`telegraph_code` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '电报码',
|
||||
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '车站名称',
|
||||
`railway_line` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属铁路线路',
|
||||
`province_code` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属省份编码',
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
-- 铁路车站电报略码改为非必填(有值时仍保持唯一)
|
||||
-- 执行前请先备份数据库;如字段已是可空,可跳过本脚本。
|
||||
|
||||
ALTER TABLE `blade_railway_station`
|
||||
MODIFY COLUMN `telegraph_code` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '电报码';
|
||||
@@ -1420,7 +1420,7 @@ CREATE TABLE `blade_railway_station` (
|
||||
`id` bigint(20) NOT NULL COMMENT '主键',
|
||||
`code` varchar(20) NOT NULL COMMENT '编码',
|
||||
`tmis_code` varchar(5) NOT NULL COMMENT 'TMIS国标编码',
|
||||
`telegraph_code` varchar(3) NOT NULL COMMENT '电报码',
|
||||
`telegraph_code` varchar(3) DEFAULT NULL COMMENT '电报码',
|
||||
`name` varchar(100) NOT NULL COMMENT '车站名称',
|
||||
`railway_line` varchar(100) DEFAULT NULL COMMENT '所属铁路线路',
|
||||
`province_code` varchar(12) DEFAULT NULL COMMENT '所属省份编码',
|
||||
|
||||
Reference in New Issue
Block a user