🐛 修复客商类型无法保存的问题
This commit is contained in:
+3
@@ -58,6 +58,9 @@ public class CustomerArchive extends TenantEntity {
|
|||||||
@Schema(description = "客商全称")
|
@Schema(description = "客商全称")
|
||||||
private String fullName;
|
private String fullName;
|
||||||
|
|
||||||
|
@Schema(description = "客商类型:external外部客商,internal内部组织")
|
||||||
|
private String customerKind;
|
||||||
|
|
||||||
@Schema(description = "客商性质")
|
@Schema(description = "客商性质")
|
||||||
private String customerNature;
|
private String customerNature;
|
||||||
|
|
||||||
|
|||||||
-4
@@ -82,10 +82,6 @@ public class CustomerArchiveVO extends CustomerArchive {
|
|||||||
@Schema(description = "是否保存变更记录(仅提交时为 true,保存时不记录)")
|
@Schema(description = "是否保存变更记录(仅提交时为 true,保存时不记录)")
|
||||||
private Boolean recordChange;
|
private Boolean recordChange;
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
@Schema(description = "客商类型:external外部客商,internal内部组织")
|
|
||||||
private String customerKind;
|
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@Schema(description = "资金使用风险等级:high、medium、none")
|
@Schema(description = "资金使用风险等级:high、medium、none")
|
||||||
private String fundUseRisk;
|
private String fundUseRisk;
|
||||||
|
|||||||
+3
@@ -58,6 +58,9 @@ public class CustomerArchiveExcel implements Serializable {
|
|||||||
private String fullName;
|
private String fullName;
|
||||||
|
|
||||||
@ExcelProperty("客商类型")
|
@ExcelProperty("客商类型")
|
||||||
|
private String customerKind;
|
||||||
|
|
||||||
|
@ExcelProperty("客商分类")
|
||||||
private String customerType;
|
private String customerType;
|
||||||
|
|
||||||
@ExcelProperty("客商性质")
|
@ExcelProperty("客商性质")
|
||||||
|
|||||||
+5
@@ -15,6 +15,7 @@
|
|||||||
<result column="customer_code" property="customerCode"/>
|
<result column="customer_code" property="customerCode"/>
|
||||||
<result column="short_name" property="shortName"/>
|
<result column="short_name" property="shortName"/>
|
||||||
<result column="full_name" property="fullName"/>
|
<result column="full_name" property="fullName"/>
|
||||||
|
<result column="customer_kind" property="customerKind"/>
|
||||||
<result column="customer_nature" property="customerNature"/>
|
<result column="customer_nature" property="customerNature"/>
|
||||||
<result column="guangxi_top100" property="guangxiTop100"/>
|
<result column="guangxi_top100" property="guangxiTop100"/>
|
||||||
<result column="unified_credit_code" property="unifiedCreditCode"/>
|
<result column="unified_credit_code" property="unifiedCreditCode"/>
|
||||||
@@ -63,6 +64,7 @@
|
|||||||
customer_code,
|
customer_code,
|
||||||
short_name,
|
short_name,
|
||||||
full_name,
|
full_name,
|
||||||
|
customer_kind,
|
||||||
customer_nature,
|
customer_nature,
|
||||||
guangxi_top100,
|
guangxi_top100,
|
||||||
unified_credit_code,
|
unified_credit_code,
|
||||||
@@ -128,6 +130,9 @@
|
|||||||
<bind name="creditCodeLike" value="'%' + customer.unifiedCreditCode + '%'"/>
|
<bind name="creditCodeLike" value="'%' + customer.unifiedCreditCode + '%'"/>
|
||||||
AND unified_credit_code LIKE #{creditCodeLike}
|
AND unified_credit_code LIKE #{creditCodeLike}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="customer.customerKind != null and customer.customerKind != ''">
|
||||||
|
AND customer_kind = #{customer.customerKind}
|
||||||
|
</if>
|
||||||
<if test="customer.customerNature != null and customer.customerNature != ''">
|
<if test="customer.customerNature != null and customer.customerNature != ''">
|
||||||
AND customer_nature = #{customer.customerNature}
|
AND customer_nature = #{customer.customerNature}
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
+30
-3
@@ -461,6 +461,7 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
|||||||
private void prepare(CustomerArchiveVO customer) {
|
private void prepare(CustomerArchiveVO customer) {
|
||||||
customer.setShortName(trimToNull(customer.getShortName()));
|
customer.setShortName(trimToNull(customer.getShortName()));
|
||||||
customer.setFullName(trimToEmpty(customer.getFullName()));
|
customer.setFullName(trimToEmpty(customer.getFullName()));
|
||||||
|
customer.setCustomerKind(normalizeCustomerKind(customer.getCustomerKind()));
|
||||||
customer.setCustomerNature(trimToEmpty(customer.getCustomerNature()));
|
customer.setCustomerNature(trimToEmpty(customer.getCustomerNature()));
|
||||||
customer.setGuangxiTop100(normalizeYesNoFlag(customer.getGuangxiTop100()));
|
customer.setGuangxiTop100(normalizeYesNoFlag(customer.getGuangxiTop100()));
|
||||||
customer.setUnifiedCreditCode(trimToEmpty(customer.getUnifiedCreditCode()));
|
customer.setUnifiedCreditCode(trimToEmpty(customer.getUnifiedCreditCode()));
|
||||||
@@ -499,6 +500,12 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
|||||||
if (Func.isEmpty(customer.getFullName())) {
|
if (Func.isEmpty(customer.getFullName())) {
|
||||||
throw new ServiceException("客商全称不能为空");
|
throw new ServiceException("客商全称不能为空");
|
||||||
}
|
}
|
||||||
|
if (Func.isEmpty(customer.getCustomerKind())) {
|
||||||
|
throw new ServiceException("客商类型不能为空");
|
||||||
|
}
|
||||||
|
if (!"external".equals(customer.getCustomerKind()) && !"internal".equals(customer.getCustomerKind())) {
|
||||||
|
throw new ServiceException("客商类型只能是外部客商或内部组织");
|
||||||
|
}
|
||||||
if (Func.isEmpty(customer.getCustomerNature())) {
|
if (Func.isEmpty(customer.getCustomerNature())) {
|
||||||
throw new ServiceException("客商性质不能为空");
|
throw new ServiceException("客商性质不能为空");
|
||||||
}
|
}
|
||||||
@@ -509,7 +516,7 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
|||||||
throw new ServiceException("统一社会信用代码必须为18位大写字母或数字");
|
throw new ServiceException("统一社会信用代码必须为18位大写字母或数字");
|
||||||
}
|
}
|
||||||
if (Func.isEmpty(customer.getCustomerType())) {
|
if (Func.isEmpty(customer.getCustomerType())) {
|
||||||
throw new ServiceException("客商类型不能为空");
|
throw new ServiceException("客商分类不能为空");
|
||||||
}
|
}
|
||||||
validateCustomerType(customer.getCustomerType());
|
validateCustomerType(customer.getCustomerType());
|
||||||
if (Func.isEmpty(customer.getLegalPerson())) {
|
if (Func.isEmpty(customer.getLegalPerson())) {
|
||||||
@@ -551,7 +558,7 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
|||||||
.filter(Func::isNotEmpty)
|
.filter(Func::isNotEmpty)
|
||||||
.toList();
|
.toList();
|
||||||
if (Func.isEmpty(typeList)) {
|
if (Func.isEmpty(typeList)) {
|
||||||
throw new ServiceException("客商类型不能为空");
|
throw new ServiceException("客商分类不能为空");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -939,6 +946,24 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
|||||||
throw new ServiceException("是否广西百强只能选择是或否");
|
throw new ServiceException("是否广西百强只能选择是或否");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String normalizeCustomerKind(String customerKind) {
|
||||||
|
String value = trimToEmpty(customerKind);
|
||||||
|
if (Func.isEmpty(value) || "外部客商".equals(value) || "external".equals(value)) {
|
||||||
|
return "external";
|
||||||
|
}
|
||||||
|
if ("内部组织".equals(value) || "internal".equals(value)) {
|
||||||
|
return "internal";
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String customerKindName(String customerKind) {
|
||||||
|
if ("internal".equals(customerKind) || "内部组织".equals(customerKind)) {
|
||||||
|
return "内部组织";
|
||||||
|
}
|
||||||
|
return "外部客商";
|
||||||
|
}
|
||||||
|
|
||||||
private Object parseScoreAttachments(String value) {
|
private Object parseScoreAttachments(String value) {
|
||||||
if (Func.isEmpty(value)) {
|
if (Func.isEmpty(value)) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
@@ -1423,10 +1448,11 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
|||||||
snapshot.put("客商编号", customer.getCustomerCode());
|
snapshot.put("客商编号", customer.getCustomerCode());
|
||||||
snapshot.put("客商简称", customer.getShortName());
|
snapshot.put("客商简称", customer.getShortName());
|
||||||
snapshot.put("客商全称", customer.getFullName());
|
snapshot.put("客商全称", customer.getFullName());
|
||||||
|
snapshot.put("客商类型(内外部)", customer.getCustomerKind());
|
||||||
snapshot.put("客商性质", customer.getCustomerNature());
|
snapshot.put("客商性质", customer.getCustomerNature());
|
||||||
snapshot.put("是否广西百强", customer.getGuangxiTop100());
|
snapshot.put("是否广西百强", customer.getGuangxiTop100());
|
||||||
snapshot.put("统一社会信用代码", customer.getUnifiedCreditCode());
|
snapshot.put("统一社会信用代码", customer.getUnifiedCreditCode());
|
||||||
snapshot.put("客商类型", customer.getCustomerType());
|
snapshot.put("客商分类", customer.getCustomerType());
|
||||||
snapshot.put("所属项目", customer.getProjectName());
|
snapshot.put("所属项目", customer.getProjectName());
|
||||||
snapshot.put("注册/实际经营地址", customer.getRegisteredAddress());
|
snapshot.put("注册/实际经营地址", customer.getRegisteredAddress());
|
||||||
snapshot.put("注册地址行政区划", customer.getRegisteredRegionName());
|
snapshot.put("注册地址行政区划", customer.getRegisteredRegionName());
|
||||||
@@ -1521,6 +1547,7 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
|||||||
excel.setCustomerCode(customer.getCustomerCode());
|
excel.setCustomerCode(customer.getCustomerCode());
|
||||||
excel.setShortName(customer.getShortName());
|
excel.setShortName(customer.getShortName());
|
||||||
excel.setFullName(customer.getFullName());
|
excel.setFullName(customer.getFullName());
|
||||||
|
excel.setCustomerKind(customerKindName(customer.getCustomerKind()));
|
||||||
excel.setCustomerType(customer.getCustomerType());
|
excel.setCustomerType(customer.getCustomerType());
|
||||||
excel.setCustomerNature(customer.getCustomerNature());
|
excel.setCustomerNature(customer.getCustomerNature());
|
||||||
excel.setUnifiedCreditCode(customer.getUnifiedCreditCode());
|
excel.setUnifiedCreditCode(customer.getUnifiedCreditCode());
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ CREATE TABLE `blade_customer_archive` (
|
|||||||
`customer_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客商编号',
|
`customer_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客商编号',
|
||||||
`short_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客商简称',
|
`short_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客商简称',
|
||||||
`full_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客商全称',
|
`full_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客商全称',
|
||||||
|
`customer_kind` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'external' COMMENT '客商类型:external外部客商,internal内部组织',
|
||||||
`customer_nature` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客商性质',
|
`customer_nature` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客商性质',
|
||||||
`guangxi_top100` tinyint NULL DEFAULT NULL COMMENT '是否广西百强:0否,1是',
|
`guangxi_top100` tinyint NULL DEFAULT NULL COMMENT '是否广西百强:0否,1是',
|
||||||
`unified_credit_code` varchar(18) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '统一社会信用代码',
|
`unified_credit_code` varchar(18) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '统一社会信用代码',
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
-- 客商档案:新增「客商类型」字段(external外部客商,internal内部组织)
|
||||||
|
-- 历史数据默认外部客商;重复执行不会报重复列错误。
|
||||||
|
|
||||||
|
SET @customer_archive_schema = DATABASE();
|
||||||
|
|
||||||
|
SET @customer_archive_sql = (
|
||||||
|
SELECT IF(
|
||||||
|
COUNT(*) = 0,
|
||||||
|
'ALTER TABLE `blade_customer_archive` ADD COLUMN `customer_kind` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT ''external'' COMMENT ''客商类型:external外部客商,internal内部组织'' AFTER `full_name`',
|
||||||
|
'SELECT 1'
|
||||||
|
)
|
||||||
|
FROM information_schema.columns
|
||||||
|
WHERE table_schema = @customer_archive_schema
|
||||||
|
AND table_name = 'blade_customer_archive'
|
||||||
|
AND column_name = 'customer_kind'
|
||||||
|
);
|
||||||
|
PREPARE customer_archive_stmt FROM @customer_archive_sql;
|
||||||
|
EXECUTE customer_archive_stmt;
|
||||||
|
DEALLOCATE PREPARE customer_archive_stmt;
|
||||||
Reference in New Issue
Block a user