mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-24 16:05:08 +08:00
CRM:code review excel 导出的重构
This commit is contained in:
@ -1 +1,2 @@
|
||||
// TODO @puhui999:在 framework 目录,保持 config 和 core 目录的风格哈;
|
||||
package cn.iocoder.yudao.module.crm.framework.excel;
|
@ -3,8 +3,6 @@ package cn.iocoder.yudao.module.crm.framework.excel.service;
|
||||
import cn.iocoder.yudao.framework.excel.core.service.ExcelColumnSelectDataService;
|
||||
import cn.iocoder.yudao.framework.ip.core.Area;
|
||||
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
|
||||
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@ -19,9 +17,6 @@ public class AreaExcelColumnSelectDataServiceImpl implements ExcelColumnSelectDa
|
||||
|
||||
public static final String FUNCTION_NAME = "getCrmAreaNameList"; // 防止和别的模块重名
|
||||
|
||||
@Resource
|
||||
private DictDataApi dictDataApi;
|
||||
|
||||
@Override
|
||||
public String getFunctionName() {
|
||||
return FUNCTION_NAME;
|
||||
@ -31,7 +26,7 @@ public class AreaExcelColumnSelectDataServiceImpl implements ExcelColumnSelectDa
|
||||
public List<String> getSelectDataList() {
|
||||
// 获取地区下拉数据
|
||||
// TODO @puhui999:嘿嘿,这里改成省份、城市、区域,三个选项,难度大么?
|
||||
Area area = AreaUtils.parseArea(Area.ID_CHINA);
|
||||
Area area = AreaUtils.getArea(Area.ID_CHINA);
|
||||
return AreaUtils.getAreaNodePathList(area.getChildren());
|
||||
}
|
||||
|
||||
|
@ -226,18 +226,19 @@ public class CrmContractServiceImpl implements CrmContractService {
|
||||
success = CRM_CONTRACT_DELETE_SUCCESS)
|
||||
@CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTRACT, bizId = "#id", level = CrmPermissionLevelEnum.OWNER)
|
||||
public void deleteContract(Long id) {
|
||||
// 校验存在
|
||||
// 1.1 校验存在
|
||||
CrmContractDO contract = validateContractExists(id);
|
||||
// 如果被 CrmReceivableDO 所使用,则不允许删除
|
||||
// 1.2 如果被 CrmReceivableDO 所使用,则不允许删除
|
||||
if (CollUtil.isNotEmpty(receivableService.getReceivableByContractId(contract.getId()))) {
|
||||
throw exception(CONTRACT_DELETE_FAIL);
|
||||
}
|
||||
// 删除
|
||||
|
||||
// 2.1 删除合同
|
||||
contractMapper.deleteById(id);
|
||||
// 删除数据权限
|
||||
// 2.2 删除数据权限
|
||||
crmPermissionService.deletePermission(CrmBizTypeEnum.CRM_CONTRACT.getType(), id);
|
||||
|
||||
// 记录操作日志上下文
|
||||
// 3. 记录操作日志上下文
|
||||
LogRecordContext.putVariable("contractName", contract.getName());
|
||||
}
|
||||
|
||||
|
@ -122,6 +122,7 @@ public interface CrmReceivableService {
|
||||
*/
|
||||
Map<Long, BigDecimal> getReceivablePriceMapByContractId(Collection<Long> contractIds);
|
||||
|
||||
// TODO @puhui999:这个搞成根据数量判断,会更好一点哈;
|
||||
/**
|
||||
* 更具合同编号查询回款列表
|
||||
*
|
||||
|
@ -224,12 +224,13 @@ public class CrmReceivableServiceImpl implements CrmReceivableService {
|
||||
if (ObjUtil.equal(receivable.getAuditStatus(), CrmAuditStatusEnum.APPROVE.getStatus())) {
|
||||
throw exception(RECEIVABLE_DELETE_FAIL_IS_APPROVE);
|
||||
}
|
||||
// 2. 删除
|
||||
|
||||
// 2.1 删除回款
|
||||
receivableMapper.deleteById(id);
|
||||
// 3. 删除数据权限
|
||||
// 2.2 删除数据权限
|
||||
permissionService.deletePermission(CrmBizTypeEnum.CRM_RECEIVABLE.getType(), id);
|
||||
|
||||
// 4. 记录操作日志上下文
|
||||
// 3. 记录操作日志上下文
|
||||
LogRecordContext.putVariable("receivable", receivable);
|
||||
LogRecordContext.putVariable("period", getReceivablePeriod(receivable.getPlanId()));
|
||||
}
|
||||
|
Reference in New Issue
Block a user