mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 18:28:43 +08:00 
			
		
		
		
	CRM:完善 excel 导出 review 提到的问题
This commit is contained in:
		| @@ -4,10 +4,7 @@ import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||||
| import cn.iocoder.yudao.framework.excel.core.annotations.ExcelColumnSelect; | ||||
| import cn.iocoder.yudao.framework.excel.core.convert.AreaConvert; | ||||
| import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ||||
| import cn.iocoder.yudao.module.crm.framework.excel.service.AreaExcelColumnSelectDataServiceImpl; | ||||
| import cn.iocoder.yudao.module.crm.framework.excel.service.CrmCustomerIndustryExcelColumnSelectDataServiceImpl; | ||||
| import cn.iocoder.yudao.module.crm.framework.excel.service.CrmCustomerLevelExcelColumnSelectDataServiceImpl; | ||||
| import cn.iocoder.yudao.module.crm.framework.excel.service.CrmCustomerSourceExcelColumnSelectDataServiceImpl; | ||||
| import cn.iocoder.yudao.module.crm.framework.excel.core.AreaExcelColumnSelectFunctionImpl; | ||||
| import com.alibaba.excel.annotation.ExcelProperty; | ||||
| import lombok.AllArgsConstructor; | ||||
| import lombok.Builder; | ||||
| @@ -46,7 +43,7 @@ public class CrmCustomerImportExcelVO { | ||||
|     private String email; | ||||
|  | ||||
|     @ExcelProperty(value = "地区", converter = AreaConvert.class) | ||||
|     @ExcelColumnSelect(AreaExcelColumnSelectDataServiceImpl.FUNCTION_NAME) | ||||
|     @ExcelColumnSelect(functionName = AreaExcelColumnSelectFunctionImpl.NAME) | ||||
|     private Integer areaId; | ||||
|  | ||||
|     @ExcelProperty("详细地址") | ||||
| @@ -54,17 +51,17 @@ public class CrmCustomerImportExcelVO { | ||||
|  | ||||
|     @ExcelProperty(value = "所属行业", converter = DictConvert.class) | ||||
|     @DictFormat(CRM_CUSTOMER_INDUSTRY) | ||||
|     @ExcelColumnSelect(CrmCustomerIndustryExcelColumnSelectDataServiceImpl.FUNCTION_NAME) | ||||
|     @ExcelColumnSelect(dictType = CRM_CUSTOMER_INDUSTRY) | ||||
|     private Integer industryId; | ||||
|  | ||||
|     @ExcelProperty(value = "客户等级", converter = DictConvert.class) | ||||
|     @DictFormat(CRM_CUSTOMER_LEVEL) | ||||
|     @ExcelColumnSelect(CrmCustomerLevelExcelColumnSelectDataServiceImpl.FUNCTION_NAME) | ||||
|     @ExcelColumnSelect(dictType = CRM_CUSTOMER_LEVEL) | ||||
|     private Integer level; | ||||
|  | ||||
|     @ExcelProperty(value = "客户来源", converter = DictConvert.class) | ||||
|     @DictFormat(CRM_CUSTOMER_SOURCE) | ||||
|     @ExcelColumnSelect(CrmCustomerSourceExcelColumnSelectDataServiceImpl.FUNCTION_NAME) | ||||
|     @ExcelColumnSelect(dictType = CRM_CUSTOMER_SOURCE) | ||||
|     private Integer source; | ||||
|  | ||||
|     @ExcelProperty("备注") | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| package cn.iocoder.yudao.module.crm.framework.excel.service; | ||||
| package cn.iocoder.yudao.module.crm.framework.excel.core; | ||||
| 
 | ||||
| import cn.iocoder.yudao.framework.excel.core.service.ExcelColumnSelectDataService; | ||||
| import cn.iocoder.yudao.framework.excel.core.function.ExcelColumnSelectFunction; | ||||
| import cn.iocoder.yudao.framework.ip.core.Area; | ||||
| import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; | ||||
| import org.springframework.stereotype.Service; | ||||
| @@ -13,17 +13,17 @@ import java.util.List; | ||||
|  * @author HUIHUI | ||||
|  */ | ||||
| @Service | ||||
| public class AreaExcelColumnSelectDataServiceImpl implements ExcelColumnSelectDataService { | ||||
| public class AreaExcelColumnSelectFunctionImpl implements ExcelColumnSelectFunction { | ||||
| 
 | ||||
|     public static final String FUNCTION_NAME = "getCrmAreaNameList"; // 防止和别的模块重名 | ||||
|     public static final String NAME = "getCrmAreaNameList"; // 防止和别的模块重名 | ||||
| 
 | ||||
|     @Override | ||||
|     public String getFunctionName() { | ||||
|         return FUNCTION_NAME; | ||||
|     public String getName() { | ||||
|         return NAME; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public List<String> getSelectDataList() { | ||||
|     public List<String> getOptions() { | ||||
|         // 获取地区下拉数据 | ||||
|         // TODO @puhui999:嘿嘿,这里改成省份、城市、区域,三个选项,难度大么? | ||||
|         Area area = AreaUtils.getArea(Area.ID_CHINA); | ||||
| @@ -1,2 +1 @@ | ||||
| // TODO @puhui999:在 framework 目录,保持 config 和 core 目录的风格哈; | ||||
| package cn.iocoder.yudao.module.crm.framework.excel; | ||||
| @@ -1,35 +0,0 @@ | ||||
| package cn.iocoder.yudao.module.crm.framework.excel.service; | ||||
|  | ||||
| import cn.iocoder.yudao.framework.excel.core.service.ExcelColumnSelectDataService; | ||||
| import cn.iocoder.yudao.module.system.api.dict.DictDataApi; | ||||
| import jakarta.annotation.Resource; | ||||
| import org.springframework.stereotype.Service; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_INDUSTRY; | ||||
|  | ||||
| /** | ||||
|  * Excel 客户所属行业列下拉数据源获取接口实现类 | ||||
|  * | ||||
|  * @author HUIHUI | ||||
|  */ | ||||
| @Service | ||||
| public class CrmCustomerIndustryExcelColumnSelectDataServiceImpl implements ExcelColumnSelectDataService { | ||||
|  | ||||
|     public static final String FUNCTION_NAME = "getCrmCustomerIndustryList"; | ||||
|  | ||||
|     @Resource | ||||
|     private DictDataApi dictDataApi; | ||||
|  | ||||
|     @Override | ||||
|     public String getFunctionName() { | ||||
|         return FUNCTION_NAME; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<String> getSelectDataList() { | ||||
|         return dictDataApi.getDictDataLabelList(CRM_CUSTOMER_INDUSTRY); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -1,35 +0,0 @@ | ||||
| package cn.iocoder.yudao.module.crm.framework.excel.service; | ||||
|  | ||||
| import cn.iocoder.yudao.framework.excel.core.service.ExcelColumnSelectDataService; | ||||
| import cn.iocoder.yudao.module.system.api.dict.DictDataApi; | ||||
| import jakarta.annotation.Resource; | ||||
| import org.springframework.stereotype.Service; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_LEVEL; | ||||
|  | ||||
| /** | ||||
|  * Excel 客户等级列下拉数据源获取接口实现类 | ||||
|  * | ||||
|  * @author HUIHUI | ||||
|  */ | ||||
| @Service | ||||
| public class CrmCustomerLevelExcelColumnSelectDataServiceImpl implements ExcelColumnSelectDataService { | ||||
|  | ||||
|     public static final String FUNCTION_NAME = "getCrmCustomerLevelList"; | ||||
|  | ||||
|     @Resource | ||||
|     private DictDataApi dictDataApi; | ||||
|  | ||||
|     @Override | ||||
|     public String getFunctionName() { | ||||
|         return FUNCTION_NAME; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<String> getSelectDataList() { | ||||
|         return dictDataApi.getDictDataLabelList(CRM_CUSTOMER_LEVEL); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -1,35 +0,0 @@ | ||||
| package cn.iocoder.yudao.module.crm.framework.excel.service; | ||||
|  | ||||
| import cn.iocoder.yudao.framework.excel.core.service.ExcelColumnSelectDataService; | ||||
| import cn.iocoder.yudao.module.system.api.dict.DictDataApi; | ||||
| import jakarta.annotation.Resource; | ||||
| import org.springframework.stereotype.Service; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_SOURCE; | ||||
|  | ||||
| /** | ||||
|  * Excel 客户来源列下拉数据源获取接口实现类 | ||||
|  * | ||||
|  * @author HUIHUI | ||||
|  */ | ||||
| @Service | ||||
| public class CrmCustomerSourceExcelColumnSelectDataServiceImpl implements ExcelColumnSelectDataService { | ||||
|  | ||||
|     public static final String FUNCTION_NAME = "getCrmCustomerSourceList"; | ||||
|  | ||||
|     @Resource | ||||
|     private DictDataApi dictDataApi; | ||||
|  | ||||
|     @Override | ||||
|     public String getFunctionName() { | ||||
|         return FUNCTION_NAME; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<String> getSelectDataList() { | ||||
|         return dictDataApi.getDictDataLabelList(CRM_CUSTOMER_SOURCE); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -229,7 +229,7 @@ public class CrmContractServiceImpl implements CrmContractService { | ||||
|         // 1.1 校验存在 | ||||
|         CrmContractDO contract = validateContractExists(id); | ||||
|         // 1.2 如果被 CrmReceivableDO 所使用,则不允许删除 | ||||
|         if (CollUtil.isNotEmpty(receivableService.getReceivableByContractId(contract.getId()))) { | ||||
|         if (receivableService.getReceivableByContractId(contract.getId()) != 0) { | ||||
|             throw exception(CONTRACT_DELETE_FAIL); | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -122,13 +122,12 @@ public interface CrmReceivableService { | ||||
|      */ | ||||
|     Map<Long, BigDecimal> getReceivablePriceMapByContractId(Collection<Long> contractIds); | ||||
|  | ||||
|     // TODO @puhui999:这个搞成根据数量判断,会更好一点哈; | ||||
|     /** | ||||
|      * 更具合同编号查询回款列表 | ||||
|      * | ||||
|      * @param contractId 合同编号 | ||||
|      * @return 回款 | ||||
|      */ | ||||
|     List<CrmReceivableDO> getReceivableByContractId(Long contractId); | ||||
|     Long getReceivableByContractId(Long contractId); | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -302,8 +302,8 @@ public class CrmReceivableServiceImpl implements CrmReceivableService { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<CrmReceivableDO> getReceivableByContractId(Long contractId) { | ||||
|         return receivableMapper.selectList(CrmReceivableDO::getContractId, contractId); | ||||
|     public Long getReceivableByContractId(Long contractId) { | ||||
|         return receivableMapper.selectCount(CrmReceivableDO::getContractId, contractId); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 puhui999
					puhui999