Commit 5dc1dbb3b21707ee14c19d4ea3667ee1d0bebffe

Authored by puhui999
1 parent e53a0ca8

完善 Excel 导入模版下拉选择生成实现

yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/enums/ExcelColumn.java 0 → 100644
  1 +package cn.iocoder.yudao.framework.excel.core.enums;
  2 +
  3 +import lombok.AllArgsConstructor;
  4 +import lombok.Getter;
  5 +
  6 +/**
  7 + * Excel 列名枚举
  8 + * 默认枚举 26 列列名如果有需求更多的列名请自行补充
  9 + *
  10 + * @author HUIHUI
  11 + */
  12 +@Getter
  13 +@AllArgsConstructor
  14 +public enum ExcelColumn {
  15 + A(0), B(1), C(2), D(3), E(4), F(5), G(6), H(7), I(8),
  16 + J(9), K(10), L(11), M(12), N(13), O(14), P(15), Q(16),
  17 + R(17), S(18), T(19), U(20), V(21), W(22), X(23), Y(24),
  18 + Z(25);
  19 +
  20 + /**
  21 + * 列索引
  22 + */
  23 + private final int colNum;
  24 +
  25 +}
yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/handler/SelectSheetWriteHandler.java
1 package cn.iocoder.yudao.framework.excel.core.handler; 1 package cn.iocoder.yudao.framework.excel.core.handler;
2 2
3 import cn.hutool.core.collection.CollUtil; 3 import cn.hutool.core.collection.CollUtil;
  4 +import cn.hutool.core.lang.Assert;
4 import cn.iocoder.yudao.framework.common.core.KeyValue; 5 import cn.iocoder.yudao.framework.common.core.KeyValue;
  6 +import cn.iocoder.yudao.framework.excel.core.enums.ExcelColumn;
5 import com.alibaba.excel.write.handler.SheetWriteHandler; 7 import com.alibaba.excel.write.handler.SheetWriteHandler;
6 import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; 8 import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
7 import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder; 9 import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
@@ -11,6 +13,8 @@ import org.apache.poi.ss.util.CellRangeAddressList; @@ -11,6 +13,8 @@ import org.apache.poi.ss.util.CellRangeAddressList;
11 13
12 import java.util.Comparator; 14 import java.util.Comparator;
13 import java.util.List; 15 import java.util.List;
  16 +import java.util.Map;
  17 +import java.util.stream.Collectors;
14 18
15 /** 19 /**
16 * 基于固定 sheet 实现下拉框 20 * 基于固定 sheet 实现下拉框
@@ -20,18 +24,20 @@ import java.util.List; @@ -20,18 +24,20 @@ import java.util.List;
20 public class SelectSheetWriteHandler implements SheetWriteHandler { 24 public class SelectSheetWriteHandler implements SheetWriteHandler {
21 25
22 private static final String DICT_SHEET_NAME = "字典sheet"; 26 private static final String DICT_SHEET_NAME = "字典sheet";
  27 + public static final int FIRST_ROW = 1; // 数据起始行从 0 开始,本项目第一行有标题所以从 1 开始如果您的 Excel 有多行标题请自行更改
  28 + public static final int LAST_ROW = 2000; // 下拉列需要创建下拉框的行数,默认两千行如需更多请自行调整
  29 + private final List<KeyValue<ExcelColumn, List<String>>> selectMap;
23 30
24 - // TODO @puhui999:key 不使用 int 值么?感觉不是很优雅哈。  
25 - private final List<KeyValue<Integer, List<String>>> selectMap;  
26 -  
27 - private static final char[] ALPHABET = new char[]{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',  
28 - 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};  
29 -  
30 - public SelectSheetWriteHandler(List<KeyValue<Integer, List<String>>> selectMap) { 31 + public SelectSheetWriteHandler(List<KeyValue<ExcelColumn, List<String>>> selectMap) {
31 if (CollUtil.isEmpty(selectMap)) { 32 if (CollUtil.isEmpty(selectMap)) {
32 this.selectMap = null; 33 this.selectMap = null;
33 return; 34 return;
34 } 35 }
  36 + // 校验一下 key 是否唯一
  37 + Map<String, Long> nameCounts = selectMap.stream()
  38 + .collect(Collectors.groupingBy(item -> item.getKey().name(), Collectors.counting()));
  39 + Assert.isFalse(nameCounts.entrySet().stream().allMatch(entry -> entry.getValue() > 1), "下拉数据 key 重复请排查!!!");
  40 +
35 selectMap.sort(Comparator.comparing(item -> item.getValue().size())); // 升序不然创建下拉会报错 41 selectMap.sort(Comparator.comparing(item -> item.getValue().size())); // 升序不然创建下拉会报错
36 this.selectMap = selectMap; 42 this.selectMap = selectMap;
37 } 43 }
@@ -41,16 +47,14 @@ public class SelectSheetWriteHandler implements SheetWriteHandler { @@ -41,16 +47,14 @@ public class SelectSheetWriteHandler implements SheetWriteHandler {
41 if (CollUtil.isEmpty(selectMap)) { 47 if (CollUtil.isEmpty(selectMap)) {
42 return; 48 return;
43 } 49 }
44 - // 需要设置下拉框的 sheet 页  
45 - Sheet currentSheet = writeSheetHolder.getSheet();  
46 - DataValidationHelper helper = currentSheet.getDataValidationHelper();  
47 - Workbook workbook = writeWorkbookHolder.getWorkbook();  
48 50
49 - // 数据字典的 sheet 页 51 + // 1.1 获取相应操作对象
  52 + DataValidationHelper helper = writeSheetHolder.getSheet().getDataValidationHelper(); // 需要设置下拉框的 sheet 页的数据验证助手
  53 + Workbook workbook = writeWorkbookHolder.getWorkbook(); // 获得工作簿
  54 +
  55 + // 1.2 创建数据字典的 sheet 页
50 Sheet dictSheet = workbook.createSheet(DICT_SHEET_NAME); 56 Sheet dictSheet = workbook.createSheet(DICT_SHEET_NAME);
51 - for (KeyValue<Integer, List<String>> keyValue : selectMap) {  
52 - // 设置下拉单元格的首行、末行、首列、末列  
53 - CellRangeAddressList rangeAddressList = new CellRangeAddressList(1, 65533, keyValue.getKey(), keyValue.getKey()); 57 + for (KeyValue<ExcelColumn, List<String>> keyValue : selectMap) {
54 int rowLen = keyValue.getValue().size(); 58 int rowLen = keyValue.getValue().size();
55 // 设置字典 sheet 页的值 每一列一个字典项 59 // 设置字典 sheet 页的值 每一列一个字典项
56 for (int i = 0; i < rowLen; i++) { 60 for (int i = 0; i < rowLen; i++) {
@@ -58,58 +62,42 @@ public class SelectSheetWriteHandler implements SheetWriteHandler { @@ -58,58 +62,42 @@ public class SelectSheetWriteHandler implements SheetWriteHandler {
58 if (row == null) { 62 if (row == null) {
59 row = dictSheet.createRow(i); 63 row = dictSheet.createRow(i);
60 } 64 }
61 - row.createCell(keyValue.getKey()).setCellValue(keyValue.getValue().get(i)); 65 + row.createCell(keyValue.getKey().getColNum()).setCellValue(keyValue.getValue().get(i));
62 } 66 }
63 -  
64 - // TODO @puhui999:下面 1. 2.1 2.2 2.3 我是按照已经理解的,调整了下格式;这样可读性更好;在 52 到 62 行,你可以看看,是不是也弄下序号;  
65 - // 1. 创建可被其他单元格引用的名称  
66 - Name name = workbook.createName();  
67 - // TODO @puhui999:下面的 excelColumn 和 refers 两行,是不是可以封装成一个方法,替代 getExcelColumn;  
68 - String excelColumn = getExcelColumn(keyValue.getKey());  
69 - String refers = DICT_SHEET_NAME + "!$" + excelColumn + "$1:$" + excelColumn + "$" + rowLen; // 下拉框数据来源 eg:字典sheet!$B1:$B2  
70 - name.setNameName("dict" + keyValue.getKey()); // 设置名称的名字  
71 - name.setRefersToFormula(refers); // 设置公式  
72 -  
73 - // 2.1 设置约束  
74 - DataValidationConstraint constraint = helper.createFormulaListConstraint("dict" + keyValue.getKey()); // 设置引用约束  
75 - DataValidation validation = helper.createValidation(constraint, rangeAddressList);  
76 - if (validation instanceof HSSFDataValidation) {  
77 - validation.setSuppressDropDownArrow(false);  
78 - } else {  
79 - validation.setSuppressDropDownArrow(true);  
80 - validation.setShowErrorBox(true);  
81 - }  
82 - // 2.2 阻止输入非下拉框的值  
83 - validation.setErrorStyle(DataValidation.ErrorStyle.STOP);  
84 - validation.createErrorBox("提示", "此值不存在于下拉选择中!");  
85 - // 2.3 添加下拉框约束  
86 - writeSheetHolder.getSheet().addValidationData(validation); 67 + // 1.3 设置单元格下拉选择
  68 + setColSelect(writeSheetHolder, workbook, helper, keyValue);
87 } 69 }
88 } 70 }
89 71
90 /** 72 /**
91 - * 将数字列转化成为字母列  
92 - *  
93 - * @param num 数字  
94 - * @return 字母 73 + * 设置单元格下拉选择
95 */ 74 */
96 - // TODO @puhui999:这个是必须字母列哇?还是数字其实也可以哈?主要想看看,怎么能把这个逻辑,进一步简化  
97 - private String getExcelColumn(int num) {  
98 - String column;  
99 - int len = ALPHABET.length - 1;  
100 - int first = num / len;  
101 - int second = num % len;  
102 - if (num <= len) {  
103 - column = ALPHABET[num] + ""; 75 + private static void setColSelect(WriteSheetHolder writeSheetHolder, Workbook workbook, DataValidationHelper helper,
  76 + KeyValue<ExcelColumn, List<String>> keyValue) {
  77 + // 1.1 创建可被其他单元格引用的名称
  78 + Name name = workbook.createName();
  79 + String excelColumn = keyValue.getKey().name();
  80 + // 1.2 下拉框数据来源 eg:字典sheet!$B1:$B2
  81 + String refers = DICT_SHEET_NAME + "!$" + excelColumn + "$1:$" + excelColumn + "$" + keyValue.getValue().size();
  82 + name.setNameName("dict" + keyValue.getKey()); // 设置名称的名字
  83 + name.setRefersToFormula(refers); // 设置公式
  84 + // 2.1 设置约束
  85 + DataValidationConstraint constraint = helper.createFormulaListConstraint("dict" + keyValue.getKey()); // 设置引用约束
  86 + // 设置下拉单元格的首行、末行、首列、末列
  87 + CellRangeAddressList rangeAddressList = new CellRangeAddressList(FIRST_ROW, LAST_ROW,
  88 + keyValue.getKey().getColNum(), keyValue.getKey().getColNum());
  89 + DataValidation validation = helper.createValidation(constraint, rangeAddressList);
  90 + if (validation instanceof HSSFDataValidation) {
  91 + validation.setSuppressDropDownArrow(false);
104 } else { 92 } else {
105 - column = ALPHABET[first - 1] + "";  
106 - if (second == 0) {  
107 - column = column + ALPHABET[len];  
108 - } else {  
109 - column = column + ALPHABET[second - 1];  
110 - } 93 + validation.setSuppressDropDownArrow(true);
  94 + validation.setShowErrorBox(true);
111 } 95 }
112 - return column; 96 + // 2.2 阻止输入非下拉框的值
  97 + validation.setErrorStyle(DataValidation.ErrorStyle.STOP);
  98 + validation.createErrorBox("提示", "此值不存在于下拉选择中!");
  99 + // 2.3 添加下拉框约束
  100 + writeSheetHolder.getSheet().addValidationData(validation);
113 } 101 }
114 102
115 } 103 }
116 \ No newline at end of file 104 \ No newline at end of file
yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/util/ExcelUtils.java
1 package cn.iocoder.yudao.framework.excel.core.util; 1 package cn.iocoder.yudao.framework.excel.core.util;
2 2
3 import cn.iocoder.yudao.framework.common.core.KeyValue; 3 import cn.iocoder.yudao.framework.common.core.KeyValue;
  4 +import cn.iocoder.yudao.framework.excel.core.enums.ExcelColumn;
4 import cn.iocoder.yudao.framework.excel.core.handler.SelectSheetWriteHandler; 5 import cn.iocoder.yudao.framework.excel.core.handler.SelectSheetWriteHandler;
5 import com.alibaba.excel.EasyExcel; 6 import com.alibaba.excel.EasyExcel;
6 import com.alibaba.excel.converters.longconverter.LongStringConverter; 7 import com.alibaba.excel.converters.longconverter.LongStringConverter;
@@ -44,11 +45,11 @@ public class ExcelUtils { @@ -44,11 +45,11 @@ public class ExcelUtils {
44 * @param sheetName Excel sheet 名 45 * @param sheetName Excel sheet 名
45 * @param head Excel head 头 46 * @param head Excel head 头
46 * @param data 数据列表哦 47 * @param data 数据列表哦
47 - * @param selectMap 下拉选择数据 Map 48 + * @param selectMap 下拉选择数据 Map<下拉所对应的列表名,下拉数据>
48 * @throws IOException 写入失败的情况 49 * @throws IOException 写入失败的情况
49 */ 50 */
50 public static <T> void write(HttpServletResponse response, String filename, String sheetName, 51 public static <T> void write(HttpServletResponse response, String filename, String sheetName,
51 - Class<T> head, List<T> data, List<KeyValue<Integer, List<String>>> selectMap) throws IOException { 52 + Class<T> head, List<T> data, List<KeyValue<ExcelColumn, List<String>>> selectMap) throws IOException {
52 // 输出 Excel 53 // 输出 Excel
53 EasyExcel.write(response.getOutputStream(), head) 54 EasyExcel.write(response.getOutputStream(), head)
54 .autoCloseStream(false) // 不要自动关闭,交给 Servlet 自己处理 55 .autoCloseStream(false) // 不要自动关闭,交给 Servlet 自己处理
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java
@@ -10,6 +10,7 @@ import cn.iocoder.yudao.framework.common.util.collection.MapUtils; @@ -10,6 +10,7 @@ import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
10 import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; 10 import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
11 import cn.iocoder.yudao.framework.common.util.number.NumberUtils; 11 import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
12 import cn.iocoder.yudao.framework.common.util.object.BeanUtils; 12 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
  13 +import cn.iocoder.yudao.framework.excel.core.enums.ExcelColumn;
13 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; 14 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
14 import cn.iocoder.yudao.framework.ip.core.Area; 15 import cn.iocoder.yudao.framework.ip.core.Area;
15 import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; 16 import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
@@ -268,21 +269,21 @@ public class CrmCustomerController { @@ -268,21 +269,21 @@ public class CrmCustomerController {
268 ExcelUtils.write(response, "客户导入模板.xls", "客户列表", CrmCustomerImportExcelVO.class, list, builderSelectMap()); 269 ExcelUtils.write(response, "客户导入模板.xls", "客户列表", CrmCustomerImportExcelVO.class, list, builderSelectMap());
269 } 270 }
270 271
271 - private List<KeyValue<Integer, List<String>>> builderSelectMap() {  
272 - List<KeyValue<Integer, List<String>>> selectMap = new ArrayList<>(); 272 + private List<KeyValue<ExcelColumn, List<String>>> builderSelectMap() {
  273 + List<KeyValue<ExcelColumn, List<String>>> selectMap = new ArrayList<>();
273 // 获取地区下拉数据 274 // 获取地区下拉数据
274 // TODO @puhui999:嘿嘿,这里改成省份、城市、区域,三个选项,难度大么? 275 // TODO @puhui999:嘿嘿,这里改成省份、城市、区域,三个选项,难度大么?
275 Area area = AreaUtils.parseArea(Area.ID_CHINA); 276 Area area = AreaUtils.parseArea(Area.ID_CHINA);
276 - selectMap.add(new KeyValue<>(6, AreaUtils.getAreaNodePathList(area.getChildren()))); 277 + selectMap.add(new KeyValue<>(ExcelColumn.G, AreaUtils.getAreaNodePathList(area.getChildren())));
277 // 获取客户所属行业 278 // 获取客户所属行业
278 List<String> customerIndustries = dictDataApi.getDictDataLabelList(CRM_CUSTOMER_INDUSTRY); 279 List<String> customerIndustries = dictDataApi.getDictDataLabelList(CRM_CUSTOMER_INDUSTRY);
279 - selectMap.add(new KeyValue<>(8, customerIndustries)); 280 + selectMap.add(new KeyValue<>(ExcelColumn.I, customerIndustries));
280 // 获取客户等级 281 // 获取客户等级
281 List<String> customerLevels = dictDataApi.getDictDataLabelList(CRM_CUSTOMER_LEVEL); 282 List<String> customerLevels = dictDataApi.getDictDataLabelList(CRM_CUSTOMER_LEVEL);
282 - selectMap.add(new KeyValue<>(9, customerLevels)); 283 + selectMap.add(new KeyValue<>(ExcelColumn.J, customerLevels));
283 // 获取客户来源 284 // 获取客户来源
284 List<String> customerSources = dictDataApi.getDictDataLabelList(CRM_CUSTOMER_SOURCE); 285 List<String> customerSources = dictDataApi.getDictDataLabelList(CRM_CUSTOMER_SOURCE);
285 - selectMap.add(new KeyValue<>(10, customerSources)); 286 + selectMap.add(new KeyValue<>(ExcelColumn.K, customerSources));
286 return selectMap; 287 return selectMap;
287 } 288 }
288 289
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java
@@ -41,6 +41,7 @@ import java.time.LocalDateTime; @@ -41,6 +41,7 @@ import java.time.LocalDateTime;
41 import java.util.*; 41 import java.util.*;
42 42
43 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; 43 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
  44 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.filterList;
44 import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*; 45 import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
45 import static cn.iocoder.yudao.module.crm.enums.LogRecordConstants.*; 46 import static cn.iocoder.yudao.module.crm.enums.LogRecordConstants.*;
46 import static cn.iocoder.yudao.module.crm.enums.customer.CrmCustomerLimitConfigTypeEnum.CUSTOMER_LOCK_LIMIT; 47 import static cn.iocoder.yudao.module.crm.enums.customer.CrmCustomerLimitConfigTypeEnum.CUSTOMER_LOCK_LIMIT;
@@ -203,7 +204,7 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { @@ -203,7 +204,7 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
203 204
204 // 2.1 数据权限转移 205 // 2.1 数据权限转移
205 permissionService.transferPermission(new CrmPermissionTransferReqBO(userId, CrmBizTypeEnum.CRM_CUSTOMER.getType(), 206 permissionService.transferPermission(new CrmPermissionTransferReqBO(userId, CrmBizTypeEnum.CRM_CUSTOMER.getType(),
206 - reqVO.getId(), reqVO.getNewOwnerUserId(), reqVO.getOldOwnerPermissionLevel())); 207 + reqVO.getId(), reqVO.getNewOwnerUserId(), reqVO.getOldOwnerPermissionLevel()));
207 // 2.2 转移后重新设置负责人 208 // 2.2 转移后重新设置负责人
208 customerMapper.updateById(new CrmCustomerDO().setId(reqVO.getId()) 209 customerMapper.updateById(new CrmCustomerDO().setId(reqVO.getId())
209 .setOwnerUserId(reqVO.getNewOwnerUserId()).setOwnerTime(LocalDateTime.now())); 210 .setOwnerUserId(reqVO.getNewOwnerUserId()).setOwnerTime(LocalDateTime.now()));
@@ -260,6 +261,8 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { @@ -260,6 +261,8 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
260 if (CollUtil.isEmpty(importCustomers)) { 261 if (CollUtil.isEmpty(importCustomers)) {
261 throw exception(CUSTOMER_IMPORT_LIST_IS_EMPTY); 262 throw exception(CUSTOMER_IMPORT_LIST_IS_EMPTY);
262 } 263 }
  264 + // 因为有下拉所以需要过滤掉空行
  265 + importCustomers = filterList(importCustomers, item -> Objects.nonNull(item.getName()));
263 CrmCustomerImportRespVO respVO = CrmCustomerImportRespVO.builder().createCustomerNames(new ArrayList<>()) 266 CrmCustomerImportRespVO respVO = CrmCustomerImportRespVO.builder().createCustomerNames(new ArrayList<>())
264 .updateCustomerNames(new ArrayList<>()).failureCustomerNames(new LinkedHashMap<>()).build(); 267 .updateCustomerNames(new ArrayList<>()).failureCustomerNames(new LinkedHashMap<>()).build();
265 importCustomers.forEach(importCustomer -> { 268 importCustomers.forEach(importCustomer -> {
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivablePlanServiceImpl.java
@@ -70,11 +70,10 @@ public class CrmReceivablePlanServiceImpl implements CrmReceivablePlanService { @@ -70,11 +70,10 @@ public class CrmReceivablePlanServiceImpl implements CrmReceivablePlanService {
70 validateRelationDataExists(createReqVO); 70 validateRelationDataExists(createReqVO);
71 // 1.2 查验关联合同回款数量 71 // 1.2 查验关联合同回款数量
72 Long count = receivableService.getReceivableCountByContractId(createReqVO.getContractId()); 72 Long count = receivableService.getReceivableCountByContractId(createReqVO.getContractId());
73 - int period = (int) (count + 1);  
74 - createReqVO.setPeriod(createReqVO.getPeriod() != period ? period : createReqVO.getPeriod()); // 如果期数不对则纠正  
75 73
76 // 2. 插入还款计划 74 // 2. 插入还款计划
77 - CrmReceivablePlanDO receivablePlan = BeanUtils.toBean(createReqVO, CrmReceivablePlanDO.class).setId(null).setFinishStatus(false); 75 + CrmReceivablePlanDO receivablePlan = BeanUtils.toBean(createReqVO, CrmReceivablePlanDO.class).setId(null)
  76 + .setPeriod((int) (count + 1)).setFinishStatus(false);
78 receivablePlanMapper.insert(receivablePlan); 77 receivablePlanMapper.insert(receivablePlan);
79 78
80 // 3. 创建数据权限 79 // 3. 创建数据权限
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/receivable/CrmReceivableServiceImpl.java
@@ -67,7 +67,7 @@ public class CrmReceivableServiceImpl implements CrmReceivableService { @@ -67,7 +67,7 @@ public class CrmReceivableServiceImpl implements CrmReceivableService {
67 private CrmContractService contractService; 67 private CrmContractService contractService;
68 @Resource 68 @Resource
69 private CrmCustomerService customerService; 69 private CrmCustomerService customerService;
70 -// @Resource 70 + @Resource
71 @Lazy // 延迟加载,避免循环依赖 71 @Lazy // 延迟加载,避免循环依赖
72 private CrmReceivablePlanService receivablePlanService; 72 private CrmReceivablePlanService receivablePlanService;
73 @Resource 73 @Resource
yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/enums/ErrorCodeConstants.java
@@ -33,19 +33,19 @@ public interface ErrorCodeConstants { @@ -33,19 +33,19 @@ public interface ErrorCodeConstants {
33 ErrorCode FILE_IS_EMPTY = new ErrorCode(1_001_003_002, "文件为空"); 33 ErrorCode FILE_IS_EMPTY = new ErrorCode(1_001_003_002, "文件为空");
34 34
35 // ========== 代码生成器 1-001-004-000 ========== 35 // ========== 代码生成器 1-001-004-000 ==========
36 - ErrorCode CODEGEN_TABLE_EXISTS = new ErrorCode(1_003_001_000, "表定义已经存在");  
37 - ErrorCode CODEGEN_IMPORT_TABLE_NULL = new ErrorCode(1_003_001_001, "导入的表不存在");  
38 - ErrorCode CODEGEN_IMPORT_COLUMNS_NULL = new ErrorCode(1_003_001_002, "导入的字段不存在");  
39 - ErrorCode CODEGEN_TABLE_NOT_EXISTS = new ErrorCode(1_003_001_004, "表定义不存在");  
40 - ErrorCode CODEGEN_COLUMN_NOT_EXISTS = new ErrorCode(1_003_001_005, "字段义不存在");  
41 - ErrorCode CODEGEN_SYNC_COLUMNS_NULL = new ErrorCode(1_003_001_006, "同步的字段不存在");  
42 - ErrorCode CODEGEN_SYNC_NONE_CHANGE = new ErrorCode(1_003_001_007, "同步失败,不存在改变");  
43 - ErrorCode CODEGEN_TABLE_INFO_TABLE_COMMENT_IS_NULL = new ErrorCode(1_003_001_008, "数据库的表注释未填写");  
44 - ErrorCode CODEGEN_TABLE_INFO_COLUMN_COMMENT_IS_NULL = new ErrorCode(1_003_001_009, "数据库的表字段({})注释未填写");  
45 - ErrorCode CODEGEN_MASTER_TABLE_NOT_EXISTS = new ErrorCode(1_003_001_010, "主表(id={})定义不存在,请检查");  
46 - ErrorCode CODEGEN_SUB_COLUMN_NOT_EXISTS = new ErrorCode(1_003_001_011, "子表的字段(id={})不存在,请检查");  
47 - ErrorCode CODEGEN_MASTER_GENERATION_FAIL_NO_SUB_TABLE = new ErrorCode(1_003_001_012, "主表生成代码失败,原因:它没有子表");  
48 - ErrorCode CODEGEN_MASTER_GENERATION_FAIL_NO_SUB_COLUMN = new ErrorCode(1_003_001_013, "主表生成代码失败,原因:它的子表({})没有字段"); 36 + ErrorCode CODEGEN_TABLE_EXISTS = new ErrorCode(1_001_004_002, "表定义已经存在");
  37 + ErrorCode CODEGEN_IMPORT_TABLE_NULL = new ErrorCode(1_001_004_001, "导入的表不存在");
  38 + ErrorCode CODEGEN_IMPORT_COLUMNS_NULL = new ErrorCode(1_001_004_002, "导入的字段不存在");
  39 + ErrorCode CODEGEN_TABLE_NOT_EXISTS = new ErrorCode(1_001_004_004, "表定义不存在");
  40 + ErrorCode CODEGEN_COLUMN_NOT_EXISTS = new ErrorCode(1_001_004_005, "字段义不存在");
  41 + ErrorCode CODEGEN_SYNC_COLUMNS_NULL = new ErrorCode(1_001_004_006, "同步的字段不存在");
  42 + ErrorCode CODEGEN_SYNC_NONE_CHANGE = new ErrorCode(1_001_004_007, "同步失败,不存在改变");
  43 + ErrorCode CODEGEN_TABLE_INFO_TABLE_COMMENT_IS_NULL = new ErrorCode(1_001_004_008, "数据库的表注释未填写");
  44 + ErrorCode CODEGEN_TABLE_INFO_COLUMN_COMMENT_IS_NULL = new ErrorCode(1_001_004_009, "数据库的表字段({})注释未填写");
  45 + ErrorCode CODEGEN_MASTER_TABLE_NOT_EXISTS = new ErrorCode(1_001_004_010, "主表(id={})定义不存在,请检查");
  46 + ErrorCode CODEGEN_SUB_COLUMN_NOT_EXISTS = new ErrorCode(1_001_004_011, "子表的字段(id={})不存在,请检查");
  47 + ErrorCode CODEGEN_MASTER_GENERATION_FAIL_NO_SUB_TABLE = new ErrorCode(1_001_004_012, "主表生成代码失败,原因:它没有子表");
  48 + ErrorCode CODEGEN_MASTER_GENERATION_FAIL_NO_SUB_COLUMN = new ErrorCode(1_001_004_013, "主表生成代码失败,原因:它的子表({})没有字段");
49 49
50 // ========== 文件配置 1-001-006-000 ========== 50 // ========== 文件配置 1-001-006-000 ==========
51 ErrorCode FILE_CONFIG_NOT_EXISTS = new ErrorCode(1_001_006_000, "文件配置不存在"); 51 ErrorCode FILE_CONFIG_NOT_EXISTS = new ErrorCode(1_001_006_000, "文件配置不存在");