소스 검색

后端替换'商机'变成'项目'

yusm 2 달 전
부모
커밋
c44cd7c8ee

+ 17 - 3
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/BusinessOpportunityController.java

@@ -68,6 +68,8 @@ public class BusinessOpportunityController {
     private ActionLogMapper actionLogMapper;
     @Resource
     private BusinessOpportunityService businessOpportunityService;
+    @Resource
+    private CompanyMapper companyMapper;
     @Autowired
     private TaskMapper taskMapper;
 
@@ -104,6 +106,9 @@ public class BusinessOpportunityController {
         SysForm sysForm = sysFormMapper.selectOne(new LambdaQueryWrapper<SysForm>().eq(SysForm::getCompanyId, user.getCompanyId()).eq(SysForm::getCode, "business").eq(SysForm::getIsCurrent, 1));
         WxCorpInfo wxCorpInfo = wxCorpInfoService.getOne(new LambdaQueryWrapper<WxCorpInfo>().eq(WxCorpInfo::getCompanyId, user.getCompanyId()));
         String config = sysForm.getConfig();
+        Company company = companyMapper.selectById(user.getCompanyId());
+        String str = company.getIsExistBusiness() == 1 ? "商机" : "项目";
+
         JSONObject configOb = JSON.parseObject(config);
         JSONArray configObJSONArray = configOb.getJSONArray("list");
         List<List<String>> dataList=new ArrayList<>();
@@ -130,6 +135,13 @@ public class BusinessOpportunityController {
             }
         }
         dataList.add(titleList);
+        for (int i = 0; i < titleList.size(); i++) {
+            String s = titleList.get(i);
+            if (s.contains("商机")) {
+                s = s.replaceAll("商机", str);
+                titleList.set(i, s);
+            }
+        }
 
         HttpRespMsg respMsg = list(bo,request);
         Map<String, Object> msgData = (Map<String, Object>) respMsg.getData();
@@ -194,7 +206,7 @@ public class BusinessOpportunityController {
             }
             dataList.add(item);
         }
-        String fileName="商机表导出_"+ System.currentTimeMillis();
+        String fileName=str+"表导出_"+ System.currentTimeMillis();
         return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName,dataList,path);
     }
 
@@ -265,6 +277,8 @@ public class BusinessOpportunityController {
     public HttpRespMsg insertAndUpdate( BusinessOpportunity bo, HttpServletRequest request) {
         User user = userMapper.selectById(request.getHeader("Token"));
         HttpRespMsg msg = new HttpRespMsg();
+        Company company = companyMapper.selectById(user.getCompanyId());
+        String str= company.getIsExistBusiness()==1 ? "商机" :"项目";
         if (bo.getId() == null){
             //新增
             Integer count = businessOpportunityMapper.selectCount(new LambdaQueryWrapper<BusinessOpportunity>()
@@ -272,7 +286,7 @@ public class BusinessOpportunityController {
                     .eq(BusinessOpportunity::getCompanyId,user.getCompanyId())
             );
             if(count>0){
-                msg.setError("已存在同名商机");
+                msg.setError("已存在同名"+str);
                 return msg;
             }
             if (bo.getClueId()!= null ){
@@ -309,7 +323,7 @@ public class BusinessOpportunityController {
                     .ne(BusinessOpportunity::getId,bo.getId())
             );
             if(count>0){
-                msg.setError("已存在同名商机");
+                msg.setError("已存在同名"+str);
                 return msg;
             }
             bo.setEditTime(new Date());

+ 16 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/SysFormController.java

@@ -2,7 +2,9 @@ package com.management.platform.controller;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.management.platform.entity.Company;
 import com.management.platform.entity.SysForm;
+import com.management.platform.mapper.CompanyMapper;
 import com.management.platform.mapper.UserMapper;
 import com.management.platform.service.SysFormService;
 import com.management.platform.util.HttpRespMsg;
@@ -31,6 +33,9 @@ public class SysFormController {
     @Resource
     private UserMapper userMapper;
 
+    @Resource
+    private CompanyMapper companyMapper;
+
 
     @RequestMapping("/list")
     public HttpRespMsg list(){
@@ -45,7 +50,18 @@ public class SysFormController {
     public HttpRespMsg getListByCode(@PathVariable(name="code") String code){
         HttpRespMsg msg=new HttpRespMsg();
         Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
+        Company company = companyMapper.selectById(companyId);
         List<SysForm> sysFormList = sysFormService.list(new LambdaQueryWrapper<SysForm>().eq(SysForm::getCompanyId, companyId).eq(SysForm::getCode, code));
+        if (!sysFormList.isEmpty()&&company.getIsExistBusiness()==0){
+            for (SysForm sysForm : sysFormList) {
+                String config = sysForm.getConfig();
+                String replacedConfig = config.replaceAll("商机", "项目");
+                sysForm.setConfig(replacedConfig);
+                if (sysForm.getName().contains("商机")){
+                    sysForm.setName(sysForm.getName().replaceAll("商机","项目"));
+                }
+            }
+        }
         msg.setData(sysFormList);
         return msg;
     }

+ 16 - 4
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/BusinessOpportunityServiceImpl.java

@@ -89,6 +89,9 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
 
     @Resource
     private SysFunctionService sysFunctionService;
+
+    @Resource
+    private CompanyMapper companyMapper;
     @Autowired
     private BusinessOpportunityMapper businessOpportunityMapper;
 
@@ -193,6 +196,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void insert(BusinessOpportunity bo) {
+        String str = getString();
         setNull(bo);
         bOMapper.insert(bo);
         List<BusinessItemProduct> businessItemProducts = JSONArray.parseArray(bo.getBusinessItemProductList(), BusinessItemProduct.class);
@@ -205,13 +209,20 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
         actionLog.setItemId(bo.getId());
         actionLog.setCode("business");
         actionLog.setCreatTime(new Date());
-        actionLog.setName("创建了商机");
+        actionLog.setName("创建了"+str);
         actionLogMapper.insert(actionLog);
     }
 
+    private String getString() {
+        String userId = request.getHeader("Token");
+        Company company = companyMapper.selectById(userMapper.selectById(userId).getCompanyId());
+        return company.getIsExistBusiness()==1 ? "商机" :"项目";
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void update(BusinessOpportunity bo, String userId) {
+        String str = getString();
         setNull(bo);
         bOMapper.updateById(bo);
         bipMapper.delete(new QueryWrapper<BusinessItemProduct>().eq("business_id", bo.getId()));
@@ -222,7 +233,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
         }
         ActionLog log = new ActionLog();
         log.setItemId(bo.getId());
-        log.setName("编辑了商机");
+        log.setName("编辑了"+str);
         log.setCode("business");
         log.setUserId(userId);
         log.setCreatTime(new Date());
@@ -232,6 +243,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void getAndTransfer(BusinessOpportunity bo, User user) {
+        String str = getString();
         UpdateWrapper<BusinessOpportunity> updateWrapper = new UpdateWrapper<>();
         String ids1 = bo.getIds();
         List<Integer> ids = new ArrayList<>();
@@ -252,13 +264,13 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
         for (BusinessOpportunity clue1 : clues) {
             if (clue1.getInchargerId() == null) {
                 //认领
-                clueLog.setName("认领了商机");
+                clueLog.setName("认领了"+str);
                 clueLog.setUserId(user.getId());
                 bo.setInchargerId(user.getId());
                 actionLogMapper.insert(clueLog);
             } else {
                 //转移
-                clueLog.setName("转移了商机");
+                clueLog.setName("转移了"+str);
                 bo.setInchargerId(bo.getInchargerId());
                 actionLogMapper.insert(clueLog);
             }

+ 11 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/PermissionServiceImpl.java

@@ -306,6 +306,17 @@ public class PermissionServiceImpl extends ServiceImpl<PermissionMapper, Permiss
             module.setFunctionList(resultFunList.stream().filter(item -> item.getModuleId().equals(module.getId())).collect(Collectors.toList()));
         }
         for (SysModule mainMenu : menuList) {
+            if (company.getIsExistBusiness()==0){
+                if (mainMenu.getName().contains("商机")){
+                    mainMenu.setName(mainMenu.getName().replaceAll("商机","项目"));
+                }
+                List<SysFunction> list = mainMenu.getFunctionList();
+                for (SysFunction fun : list) {
+                    if (fun.getName().contains("商机")){
+                        fun.setName(fun.getName().replaceAll("商机","项目"));
+                    }
+                }
+            }
             List<SysModule> list = moduleList.stream().filter(mod -> mainMenu.getId().equals(mod.getParentId())).collect(Collectors.toList());
             if(timeType.getProjectCustom()==0){
                 Optional<SysModule> first = list.stream().filter(l -> l.getName().equals("项目表单设置")).findFirst();

+ 11 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/SysFormServiceImpl.java

@@ -62,6 +62,7 @@ public class SysFormServiceImpl extends ServiceImpl<SysFormMapper, SysForm> impl
         List<String> heads = new ArrayList<>();
         Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
         Company company = companyMapper.selectById(companyId);
+        String str = company.getIsExistBusiness() == 1 ? "商机" : "项目";
         //根据code获取当前公司配置的表单模板
         SysForm sysForm = sysFormMapper.selectOne(new LambdaQueryWrapper<SysForm>().eq(SysForm::getCompanyId, companyId).eq(SysForm::getCode, code).eq(SysForm::getIsCurrent, 1));
         if(sysForm==null){
@@ -88,6 +89,15 @@ public class SysFormServiceImpl extends ServiceImpl<SysFormMapper, SysForm> impl
                     heads.add(item.getString("label"));
                 }
             }
+            if (code.equals("Business")){
+                for (int i = 0; i < heads.size(); i++) {
+                    String s = heads.get(i);
+                    if (s.contains("商机")) {
+                        s = s.replaceAll("商机", str);
+                        heads.set(i, s);
+                    }
+                }
+            }
         }else {
             Collections.addAll(heads,"合同编号","合同名称","合同金额","合同类型","计划开始时间","计划结束时间","自定义字段","备注","是否已回款","回款日期","金额","是否已开票","开票日期","发票种类","税率","税额");
         }
@@ -107,7 +117,7 @@ public class SysFormServiceImpl extends ServiceImpl<SysFormMapper, SysForm> impl
                 break;
             case "Contacts":title = company.getCompanyName()+"_联系人导入模板";
                 break;
-            case "Business":title = company.getCompanyName()+"_商机导入模板";
+            case "Business":title = company.getCompanyName()+"_"+str+"导入模板";
                 break;
             case "Contract":title = company.getCompanyName()+"_合同导入模板";
                 break;

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 28 - 9
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/TaskServiceImpl.java