소스 검색

客户修改

Guo1B0 10 달 전
부모
커밋
823a4f063f

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

@@ -78,6 +78,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
 
     @Resource
     private SysDictMapper sysDictMapper;
+
     @Override
     public List<BusinessOpportunity> getAll(BusinessOpportunity bo) {
         return bOMapper.selectAllList(bo);
@@ -92,10 +93,10 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
     public BusinessOpportunity getInfo(BusinessOpportunity bo, User user) {
         BusinessOpportunity businessOpportunity = bOMapper.selectByIdToInfo(bo.getId());
         businessOpportunity.setActionLogList(actionLogMapper.selectByInfoListBusiness(bo.getId()));
-        businessOpportunity.setUploadFilePList(uploadFileMapper.selectByInfoList("business",bo.getId()));
-        businessOpportunity.setTaskList(taskMapper.selectList(new QueryWrapper<Task>().eq("business_opportunity_id",bo.getId())));
+        businessOpportunity.setUploadFilePList(uploadFileMapper.selectByInfoList("business", bo.getId()));
+        businessOpportunity.setTaskList(taskMapper.selectList(new QueryWrapper<Task>().eq("business_opportunity_id", bo.getId())));
         List<BusinessItemProduct> businessItemProducts = bipMapper.selectList(new QueryWrapper<BusinessItemProduct>().eq("business_id", bo.getId()));
-        if (businessItemProducts.size() > 0){
+        if (businessItemProducts.size() > 0) {
             BigDecimal finalPrice = new BigDecimal(0);
             BigDecimal discountedPrice = new BigDecimal(0);
             for (BusinessItemProduct businessItemProduct : businessItemProducts) {
@@ -107,7 +108,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
                 // 折后价格
                 discountedPrice = discountedPrice.add(price.multiply(divide));
             }
-            BigDecimal divide = discountedPrice.divide(finalPrice,2,BigDecimal.ROUND_UP);
+            BigDecimal divide = discountedPrice.divide(finalPrice, 2, BigDecimal.ROUND_UP);
             // 整单折扣率
             businessOpportunity.setFinalPrice(divide.multiply(new BigDecimal(100)));
         }
@@ -160,7 +161,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
     public void update(BusinessOpportunity bo, String userId) {
         setNull(bo);
         bOMapper.updateById(bo);
-        bipMapper.delete(new QueryWrapper<BusinessItemProduct>().eq("business_id",bo.getId()));
+        bipMapper.delete(new QueryWrapper<BusinessItemProduct>().eq("business_id", bo.getId()));
         List<BusinessItemProduct> businessItemProducts = JSONArray.parseArray(bo.getBusinessItemProductList(), BusinessItemProduct.class);
         for (BusinessItemProduct businessItemProduct : businessItemProducts) {
             businessItemProduct.setBusinessId(bo.getId());
@@ -218,13 +219,12 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
     private String path;
 
 
-
     @Override
     @Transactional(rollbackFor = Exception.class)
     public HttpRespMsg saveProduct(BusinessOpportunity bo, User user) {
         HttpRespMsg msg = new HttpRespMsg();
         msg.setMsg("操作成功");
-        biMapper.delete(new QueryWrapper<BusinessItemProduct>().eq("business_id",bo.getId()));
+        biMapper.delete(new QueryWrapper<BusinessItemProduct>().eq("business_id", bo.getId()));
         List<BusinessItemProduct> businessItemProducts = JSONArray.parseArray(bo.getBusinessItemProductList(), BusinessItemProduct.class);
         for (BusinessItemProduct businessItemProduct : businessItemProducts) {
             biMapper.insert(businessItemProduct);
@@ -240,6 +240,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
 
     @Value(value = "${upload.file}")
     private String filePath;
+
     @Override
     public Object uploadFile(BusinessOpportunity bo, HttpServletRequest request, MultipartFile file) {
         User user = userMapper.selectById(request.getHeader("token"));
@@ -315,7 +316,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
         try {
             ServletOutputStream os = response.getOutputStream();
             UploadFile uploadFile = uploadFileMapper.selectById(file.getId());
-            if (uploadFile == null ){
+            if (uploadFile == null) {
                 msg.setError("文件未找到");
                 return msg;
             }
@@ -353,7 +354,10 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
 
     @Override
     public Object reFileName(UploadFile uploadFile, HttpServletRequest request) {
-        return uploadFileMapper.update(null, new UpdateWrapper<UploadFile>().eq("id", uploadFile.getId()).set("name", uploadFile.getName()));
+        uploadFileMapper.update(null, new UpdateWrapper<UploadFile>().eq("item_id", uploadFile.getId()).eq("code", "business").set("name", uploadFile.getName()));
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        httpRespMsg.setMsg("操作成功");
+        return httpRespMsg;
     }
 
     @Override
@@ -377,12 +381,12 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
 
     @Override
     public Map<String, Object> getDataSummary(Integer companyId, String startDate, String endDate, String userId, List<String> targetUserIds) {
-        return bOMapper.getDataSummary(companyId,startDate,endDate,userId,targetUserIds);
+        return bOMapper.getDataSummary(companyId, startDate, endDate, userId, targetUserIds);
     }
 
     @Override
     public List<Map<String, Object>> getDataStage(Integer companyId, String startDate, String endDate, String userId, List<String> targetUserIds) {
-        return bOMapper.getDataStage(companyId,startDate,endDate,userId,targetUserIds);
+        return bOMapper.getDataStage(companyId, startDate, endDate, userId, targetUserIds);
     }
 
     @Override
@@ -392,7 +396,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
 
     @Override
     public HttpRespMsg importData(MultipartFile multipartFile) {
-        HttpRespMsg msg=new HttpRespMsg();
+        HttpRespMsg msg = new HttpRespMsg();
         String fileName = multipartFile.getOriginalFilename();
         File file = new File(fileName == null ? "file" : fileName);
         User user = userMapper.selectById(request.getHeader("token"));
@@ -420,15 +424,15 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
             int rowNum = sheet.getLastRowNum();
             //获取当前表单模板 校验规则
             SysForm sysForm = sysFormMapper.selectOne(new LambdaQueryWrapper<SysForm>().eq(SysForm::getCode, "Thread").eq(SysForm::getCompanyId, companyId).eq(SysForm::getIsCurrent, 1));
-            if(sysForm==null){
+            if (sysForm == null) {
                 msg.setError("当前模块未配置自定义模板,需先完成配置");
                 return msg;
             }
             String config = sysForm.getConfig();
             JSONObject configOb = JSON.parseObject(config);
             JSONArray configObJSONArray = configOb.getJSONArray("list");
-            List<String> userNameList=new ArrayList<>();
-            HttpRespMsg respMsg=new HttpRespMsg();
+            List<String> userNameList = new ArrayList<>();
+            HttpRespMsg respMsg = new HttpRespMsg();
             for (int rowIndex = 0; rowIndex <= rowNum; rowIndex++) {
                 XSSFRow row = sheet.getRow(rowIndex);
                 if (row == null) {
@@ -444,33 +448,34 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
                     JSONObject item = configObJSONArray.getJSONObject(i);
                     String modelName = item.getString("model");
                     XSSFCell cell = row.getCell(i);
-                    if(cell!=null){
-                        switch (item.getString("type")){
+                    if (cell != null) {
+                        switch (item.getString("type")) {
 //                            case "time":cell.setCellType(CellType.NUMERIC);
 //                                break;
-                            default:cell.setCellType(CellType.STRING);
+                            default:
+                                cell.setCellType(CellType.STRING);
                         }
                     }
-                    if(modelName.equals("inchargerId")){
+                    if (modelName.equals("inchargerId")) {
                         System.out.println("=====");
                         System.out.println(modelName);
                         System.out.println(cell.toString());
-                        if(!StringUtils.isEmpty(cell.getStringCellValue())){
+                        if (!StringUtils.isEmpty(cell.getStringCellValue())) {
                             userNameList.add(cell.getStringCellValue());
                         }
                     }
 
                 }
             }
-            System.out.println("参与搜索的人员列表"+userNameList + userNameList.size());
-            if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1&&userNameList.size()>0){
-                respMsg = wxCorpInfoService.getBatchSearchUserInfo(wxCorpInfo, userNameList,null);
-                if(respMsg.code.equals("0")){
-                    msg.setError("姓名为["+String.valueOf(respMsg.data)+"]的人员存在重复,请使用工号!");
+            System.out.println("参与搜索的人员列表" + userNameList + userNameList.size());
+            if (wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1 && userNameList.size() > 0) {
+                respMsg = wxCorpInfoService.getBatchSearchUserInfo(wxCorpInfo, userNameList, null);
+                if (respMsg.code.equals("0")) {
+                    msg.setError("姓名为[" + String.valueOf(respMsg.data) + "]的人员存在重复,请使用工号!");
                     return msg;
                 }
             }
-            List<User> targetUserList= (List<User>) respMsg.data;
+            List<User> targetUserList = (List<User>) respMsg.data;
             //直接忽略空行 从row1开始
             for (int rowIndex = 1; rowIndex <= rowNum; rowIndex++) {
                 XSSFRow row = sheet.getRow(rowIndex);
@@ -483,7 +488,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
                 }
                 //获取到当前行的列数据
                 int cellNum = row.getLastCellNum();
-                BusinessOpportunity bo =new BusinessOpportunity();
+                BusinessOpportunity bo = new BusinessOpportunity();
                 bo.setCompanyId(companyId);
                 bo.setCreateTime(new Date());
                 bo.setCreatorId(user.getId());
@@ -491,65 +496,66 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
                     JSONObject item = configObJSONArray.getJSONObject(i);
                     String modelName = item.getString("model");
                     String className = modelName.substring(0, 1).toUpperCase() + modelName.substring(1);
-                    String getter="get"+className;
-                    String setter="set"+className;
+                    String getter = "get" + className;
+                    String setter = "set" + className;
                     XSSFCell cell = row.getCell(i);
-                    if(cell!=null){
-                        switch (item.getString("type")){
+                    if (cell != null) {
+                        switch (item.getString("type")) {
 //                            case "time":cell.setCellType(CellType.NUMERIC);
 //                                break;
-                            default:cell.setCellType(CellType.STRING);
+                            default:
+                                cell.setCellType(CellType.STRING);
                         }
                     }
                     //校验当前列是否为必填
                     JSONObject options = item.getJSONObject("options");
                     JSONObject rules = options.getJSONObject("rules");
                     Boolean required = rules.getBoolean("required");
-                    if(required){
-                        if(StringUtils.isEmpty(cell.getStringCellValue())){
-                            msg.setError(item.getString("label")+"值不能为空值");
+                    if (required) {
+                        if (StringUtils.isEmpty(cell.getStringCellValue())) {
+                            msg.setError(item.getString("label") + "值不能为空值");
                             return msg;
                         }
                     }
-                    if(modelName.equals("inchargerId")){
-                        if(!StringUtils.isEmpty(cell.getStringCellValue())){
+                    if (modelName.equals("inchargerId")) {
+                        if (!StringUtils.isEmpty(cell.getStringCellValue())) {
                             String userName = cell.getStringCellValue();
                             Optional<User> first;
-                            if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                            if (wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1) {
                                 Optional<User> optional = targetUserList.stream().filter(tl -> tl.getName().equals(userName)).findFirst();
-                                first= userList.stream().filter(u ->(u.getJobNumber()!=null&&u.getJobNumber().equals(userName))||(optional.isPresent()&&u.getCorpwxUserid()!=null&&u.getCorpwxUserid().equals(optional.get().getCorpwxUserid()))).findFirst();
-                            }else {
-                                first= userList.stream().filter(u -> u.getName().equals(userName)||(u.getJobNumber()!=null&&u.getJobNumber().equals(userName))).findFirst();
+                                first = userList.stream().filter(u -> (u.getJobNumber() != null && u.getJobNumber().equals(userName)) || (optional.isPresent() && u.getCorpwxUserid() != null && u.getCorpwxUserid().equals(optional.get().getCorpwxUserid()))).findFirst();
+                            } else {
+                                first = userList.stream().filter(u -> u.getName().equals(userName) || (u.getJobNumber() != null && u.getJobNumber().equals(userName))).findFirst();
                             }
                             if (first.isPresent()) {
                                 bo.setInchargerId(first.get().getId());
                             } else {
-                                msg.setError("负责人["+userName+"]在系统中不存在");
+                                msg.setError("负责人[" + userName + "]在系统中不存在");
                                 return msg;
                             }
                         }
-                    }else if(modelName.equals("contactsId")){
-                        if(!StringUtils.isEmpty(cell.getStringCellValue())){
+                    } else if (modelName.equals("contactsId")) {
+                        if (!StringUtils.isEmpty(cell.getStringCellValue())) {
                             String userName = cell.getStringCellValue();
                             Optional<User> first;
-                            if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                            if (wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1) {
                                 Optional<User> optional = targetUserList.stream().filter(tl -> tl.getName().equals(userName)).findFirst();
-                                first= userList.stream().filter(u ->(u.getJobNumber()!=null&&u.getJobNumber().equals(userName))||(optional.isPresent()&&u.getCorpwxUserid()!=null&&u.getCorpwxUserid().equals(optional.get().getCorpwxUserid()))).findFirst();
-                            }else {
-                                first= userList.stream().filter(u -> u.getName().equals(userName)||(u.getJobNumber()!=null&&u.getJobNumber().equals(userName))).findFirst();
+                                first = userList.stream().filter(u -> (u.getJobNumber() != null && u.getJobNumber().equals(userName)) || (optional.isPresent() && u.getCorpwxUserid() != null && u.getCorpwxUserid().equals(optional.get().getCorpwxUserid()))).findFirst();
+                            } else {
+                                first = userList.stream().filter(u -> u.getName().equals(userName) || (u.getJobNumber() != null && u.getJobNumber().equals(userName))).findFirst();
                             }
                             if (first.isPresent()) {
                                 bo.setContactsId(Integer.parseInt(first.get().getId()));
                             } else {
-                                msg.setError("负责人["+userName+"]在系统中不存在");
+                                msg.setError("负责人[" + userName + "]在系统中不存在");
                                 return msg;
                             }
                         }
-                    }else {
-                        if(!StringUtils.isEmpty(cell.getStringCellValue())){
+                    } else {
+                        if (!StringUtils.isEmpty(cell.getStringCellValue())) {
                             Class<Clue> clueClass = Clue.class;
-                            Method method = clueClass.getMethod(setter,String.class);
-                            method.invoke(bo,cell.getStringCellValue());
+                            Method method = clueClass.getMethod(setter, String.class);
+                            method.invoke(bo, cell.getStringCellValue());
                         }
                     }
 
@@ -599,7 +605,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
         bOMapper.update(bo, new UpdateWrapper<BusinessOpportunity>().eq("id", bo.getId()).set("Stage_Id", bo.getStageId()));
         ActionLog al = new ActionLog();
         al.setCode("business");
-        al.setName("推进了阶段至"+bo.getStageValue());
+        al.setName("推进了阶段至" + bo.getStageValue());
         al.setUserId(user.getId());
         al.setItemId(bo.getId());
         actionLogMapper.insert(al);

+ 3 - 2
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ClueServiceImpl.java

@@ -366,9 +366,10 @@ public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements Cl
 
     @Override
     public Object reFileName(UploadFile uploadFile, HttpServletRequest request) {
-        uploadFileMapper.update(null, new UpdateWrapper<UploadFile>().eq("item_id", uploadFile.getId()).eq("code", uploadFile.getId()).set("clue", uploadFile.getName()));
+        uploadFileMapper.update(null, new UpdateWrapper<UploadFile>().eq("item_id", uploadFile.getId()).eq("code", "clue").set("name", uploadFile.getName()));
         HttpRespMsg httpRespMsg = new HttpRespMsg();
-        return httpRespMsg.getCode();
+        httpRespMsg.setMsg("操作成功");
+        return httpRespMsg;
     }
 
     @Override