Ver Fonte

bug单修改

zhouyy há 4 meses atrás
pai
commit
1bfb9e95a0

+ 1 - 41
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/CustomController.java

@@ -209,47 +209,7 @@ public class CustomController {
     @RequestMapping("deleter")
     public Object delete(Custom custom) {
         HttpRespMsg msg = new HttpRespMsg();
-        String ids1 = custom.getIds();
-        List<Integer> ids = new ArrayList<>();
-        if (!ids1.isEmpty()) {
-            for (String id : ids1.split(",")) {
-                ids.add(Integer.parseInt(id));
-            }
-            //任务
-            Integer taskCount = taskMapper.selectCount(new LambdaQueryWrapper<Task>()
-                            .ne(Task::getStatus,2)
-                            .eq(Task::getIsDelete,0)
-                    .in(Task::getCustomId, ids));
-            if(null!=taskCount&&taskCount>0){
-                msg.setError("选中客户仍有任务,无法删除");
-                return msg;
-            }
-            //商机
-            Integer boCount = businessOpportunityMapper.selectCount(new LambdaQueryWrapper<BusinessOpportunity>()
-                            .eq(BusinessOpportunity::getIsDelete,0)
-                    .in(BusinessOpportunity::getCustomerId, ids)
-            );
-            if(null!=boCount&&boCount>0){
-                msg.setError("选中客户仍有商机,无法删除");
-                return msg;
-            }
-
-            //销售订单
-            Integer salesCount = salesOrderMapper.selectCount(new LambdaQueryWrapper<SalesOrder>()
-                            .eq(SalesOrder::getIsDelete,0)
-                    .in(SalesOrder::getCustomId, ids));
-            if(null!=salesCount&&salesCount>0){
-                msg.setError("选中客户仍有销售订单,无法删除");
-                return msg;
-            }
-
-
-            customService.isDelete(ids);
-            msg.setMsg("操作成功");
-        } else {
-            msg.setError("请选择客户");
-
-        }
+        msg = customService.delete(custom);
         return msg;
     }
 

+ 2 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/CustomService.java

@@ -68,4 +68,6 @@ public interface CustomService extends IService<Custom> {
     HttpRespMsg undoPin(Custom custom, HttpServletRequest request);
 
     HttpRespMsg getPrivilegedCustom(HttpServletRequest request);
+
+    HttpRespMsg delete(Custom custom);
 }

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

@@ -871,7 +871,7 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
         }
         List<Contacts> contactsList = contactsMapper.selectList(new LambdaQueryWrapper<Contacts>()
 //                .select(Contacts::getCustomId,Contacts::getName,Contacts::getPhone,Contacts::getEmail)
-                .eq(Contacts::getCreatorId, user.getId())
+                .eq(Contacts::getOwnerId, user.getId())
                 .eq(Contacts::getCompanyId, user.getCompanyId())
                 .eq(Contacts::getIsDelete, 0)
                 .eq(Contacts::getIsFrequent,1)

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

@@ -7,12 +7,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.entity.*;
 import com.management.platform.entity.vo.DepartmentVO;
 import com.management.platform.entity.vo.UserVO;
 import com.management.platform.mapper.*;
 import com.management.platform.service.CustomService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.service.SysFunctionService;
 import com.management.platform.service.WxCorpInfoService;
 import com.management.platform.util.ExcelUtil;
@@ -26,6 +26,7 @@ import org.apache.poi.xssf.usermodel.XSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.ApplicationContext;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
@@ -100,6 +101,9 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
     @Resource
     private CompanyDingdingMapper companyDingdingMapper;
 
+    @Autowired
+    private ApplicationContext applicationContext;
+
     @Override
     public HttpRespMsg insertAndUpdate(Custom custom, HttpServletRequest request) {
         HttpRespMsg msg = new HttpRespMsg();
@@ -999,6 +1003,58 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
         return msg;
     }
 
+    @Override
+    public HttpRespMsg delete(Custom custom) {
+        HttpRespMsg msg = new HttpRespMsg();
+        String ids1 = custom.getIds();
+        List<Integer> ids = new ArrayList<>();
+        if (!ids1.isEmpty()) {
+            for (String id : ids1.split(",")) {
+                ids.add(Integer.parseInt(id));
+            }
+            Integer contactsCount = contactsMapper.selectCount(new LambdaQueryWrapper<Contacts>()
+                    .eq(Contacts::getIsDelete, 0)
+                    .in(Contacts::getCustomId, ids));
+            if(null!=contactsCount&&contactsCount>0){
+                msg.setError("选中客户仍有关联联系人,无法删除");
+                return msg;
+            }
+            //任务
+            Integer taskCount = taskMapper.selectCount(new LambdaQueryWrapper<Task>()
+                    .ne(Task::getStatus,2)
+                    .eq(Task::getIsDelete,0)
+                    .in(Task::getCustomId, ids));
+            if(null!=taskCount&&taskCount>0){
+                msg.setError("选中客户仍有任务,无法删除");
+                return msg;
+            }
+            //商机
+            Integer boCount = businessOpportunityMapper.selectCount(new LambdaQueryWrapper<BusinessOpportunity>()
+                    .eq(BusinessOpportunity::getIsDelete,0)
+                    .in(BusinessOpportunity::getCustomerId, ids)
+            );
+            if(null!=boCount&&boCount>0){
+                msg.setError("选中客户仍有商机,无法删除");
+                return msg;
+            }
+
+            //销售订单
+            Integer salesCount = salesOrderMapper.selectCount(new LambdaQueryWrapper<SalesOrder>()
+                    .eq(SalesOrder::getIsDelete,0)
+                    .in(SalesOrder::getCustomId, ids));
+            if(null!=salesCount&&salesCount>0){
+                msg.setError("选中客户仍有销售订单,无法删除");
+                return msg;
+            }
+            CustomService proxy = applicationContext.getBean(CustomService.class);
+            proxy.isDelete(ids);
+            msg.setMsg("操作成功");
+        } else {
+            msg.setError("请选择客户");
+        }
+        return msg;
+    }
+
 
     private Custom setNull(Custom clue) {
         if (clue.getPlate1() == "") {