Guo1B0 10 ヶ月 前
コミット
b4df288dab

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

@@ -94,10 +94,10 @@ public class CustomController {
         return customService.getInfo(custom, request);
     }
 
-    @RequestMapping("getLog")
-    public HttpRespMsg getLog(Custom custom, HttpServletRequest request) {
-        return customService.getInfo(custom, request);
-    }
+//    @RequestMapping("getLog")
+//    public HttpRespMsg getLog(Custom custom, HttpServletRequest request) {
+//        return customService.getInfo(custom, request);
+//    }
 
     @RequestMapping("/importData")
     public HttpRespMsg importData(MultipartFile multipartFile){
@@ -173,7 +173,7 @@ public class CustomController {
             }
             dataList.add(item);
         }
-        String fileName="商机表导出_"+ System.currentTimeMillis();
+        String fileName="客户表导出_"+ System.currentTimeMillis();
         return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName,dataList,path);
     }
 

+ 3 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Custom.java

@@ -257,6 +257,9 @@ public class Custom extends Model<Custom> {
     @TableField(exist = false)
     private Integer isDesc;
 
+    @TableField(exist = false)
+    private List<Task> tasks;
+
     @Override
     protected Serializable pkVal() {
         return this.id;

+ 1 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/dto/TaskDto.java

@@ -14,6 +14,7 @@ import java.time.LocalDate;
 @Accessors(chain = true)
 public class TaskDto extends Task {
     private Integer businessOpportunityId;
+    private Integer customerId;
     private Integer pageIndex;
     private Integer pageSize;
 

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

@@ -89,6 +89,9 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
     @Autowired
     private ContactsMapper contactsMapper;
 
+    @Autowired
+    private TaskMapper taskMapper;
+
     @Override
     public HttpRespMsg insertAndUpdate(Custom custom, HttpServletRequest request) {
         HttpRespMsg msg = new HttpRespMsg();
@@ -117,7 +120,7 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
             ActionLog actionLog = new ActionLog();
             actionLog.setCode("custom");
             actionLog.setCreatTime(new Date());
-            actionLog.setName("创建了客户");
+            actionLog.setName("编辑了客户");
             actionLog.setItemId(custom.getId());
             actionLog.setUserId(user.getId());
             actionLogMapper.insert(actionLog);
@@ -144,7 +147,7 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
             ActionLog actionLog = new ActionLog();
             actionLog.setCode("custom");
             actionLog.setCreatTime(new Date());
-            actionLog.setName("编辑了客户");
+            actionLog.setName("新建了客户");
             actionLog.setUserId(user.getId());
             actionLog.setItemId(custom.getId());
             actionLogMapper.insert(actionLog);
@@ -227,16 +230,19 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
         //商机列表
         custom1.setBusinessOpportunitys(businessOpportunityMapper.selectList(new QueryWrapper<BusinessOpportunity>().eq("customer_id",custom1.getId())));
         //操作记录
-        List<ActionLog> actionLogs = actionLogMapper.selectList(new QueryWrapper<ActionLog>().eq("code", "custom").eq("item_id", custom1.getId()));
-        List<String> userIds = actionLogs.stream().map(ActionLog::getUserId).collect(Collectors.toList());
-        List<User> ids = userMapper.selectList(new QueryWrapper<User>().in("id", userIds));
-        for (ActionLog actionLog : actionLogs) {
-            for (User id : ids) {
-                if(actionLog.getUserId().equals(id)){
-                    actionLog.setUserName(id.getName());
-                }
-            }
-        }
+        List<ActionLog> actionLogs = actionLogMapper.selectByInfoListCustom(custom.getId());
+//        List<String> userIds = actionLogs.stream().map(ActionLog::getUserId).collect(Collectors.toList());
+//        System.out.println(userIds.toString());
+//        List<User> ids = userMapper.selectList(new QueryWrapper<User>().in("id", userIds));
+//        for (ActionLog actionLog : actionLogs) {
+//            for (User id : ids) {
+//                if(actionLog.getUserId().equals(id)){
+//                    actionLog.setUserName(id.getName());
+//                }
+//            }
+//        }
+        List<Task> tasks = taskMapper.selectList(new QueryWrapper<Task>().in("custom_id", custom1.getId()));
+        custom1.setTasks(tasks);
         custom1.setActionLogs(actionLogs);
         //联系人
         custom1.setContacts(contactsMapper.selectList((new QueryWrapper<Contacts>().eq("custom_id",custom1.getId()))));

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

@@ -184,6 +184,15 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
             actionLog.setItemId(taskDto.getBusinessOpportunityId());
             logMapper.insert(actionLog);
         }
+        if (taskDto.getCustomId() != null){
+            ActionLog actionLog = new ActionLog();
+            actionLog.setCreatTime(new Date());
+            actionLog.setUserId(userId);
+            actionLog.setCode("custom");
+            actionLog.setName("新建了相关任务");
+            actionLog.setItemId(taskDto.getCustomId());
+            logMapper.insert(actionLog);
+        }
         return httpRespMsg;
     }
 

+ 6 - 6
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/CustomMapper.xml

@@ -71,10 +71,10 @@
             and c.create_time BETWEEN #{startTime} and #{endTime}
         </if>
         <if test="customName != null and customName != '' ">
-            and c.custom_name = #{customName}
+            and c.custom_name LIKE CONCAT('%', #{customName}, '%')
         </if>
         <if test="email != null and email != '' ">
-            and c.email = #{email}
+            and c.email LIKE CONCAT('%', #{email}, '%')
         </if>
         <if test="companyPhone != null ">
             and c.company_phone = #{companyPhone}
@@ -165,10 +165,10 @@
             and c.create_time BETWEEN #{startTime} and #{endTime}
         </if>
         <if test="customName != null and customName != '' ">
-            and c.custom_name = #{customName}
+            and c.custom_name LIKE CONCAT('%', #{customName}, '%')
         </if>
         <if test="email != null and email != '' ">
-            and c.email = #{email}
+            and c.email LIKE CONCAT('%', #{email}, '%')
         </if>
         <if test="companyPhone != null ">
             and c.company_phone = #{companyPhone}
@@ -260,10 +260,10 @@
             and create_time BETWEEN #{startTime} and #{endTime}
         </if>
         <if test="customName != null and customName != '' ">
-            and custom_name = #{customName}
+            and custom_name LIKE CONCAT('%', #{customName}, '%')
         </if>
         <if test="email != null and email != '' ">
-            and email = #{email}
+            and email LIKE CONCAT('%', #{email}, '%')
         </if>
         <if test="companyPhone != null ">
             and company_phone = #{companyPhone}