This commit is contained in:
2026-07-21 13:16:10 +08:00
parent f13963f5b8
commit af06f725fa
28 changed files with 406 additions and 135 deletions

View File

@@ -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);
}
/**

View File

@@ -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字");

View File

@@ -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())) {

View File

@@ -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) {