Pārlūkot izejas kodu

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

Min 11 mēneši atpakaļ
vecāks
revīzija
5b1833610d
14 mainītis faili ar 177 papildinājumiem un 58 dzēšanām
  1. 2 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/PlatformStartApplication.java
  2. 8 6
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ContactsController.java
  3. 34 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/TaskController.java
  4. 2 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Clue.java
  5. 1 1
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Contacts.java
  6. 2 2
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ContactsService.java
  7. 6 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/BusinessOpportunityServiceImpl.java
  8. 7 4
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ClueServiceImpl.java
  9. 2 2
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ContactsDocumentServiceImpl.java
  10. 36 23
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ContactsServiceImpl.java
  11. 3 1
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/TaskServiceImpl.java
  12. 1 1
      fhKeeper/formulahousekeeper/management-crm/src/main/resources/application-dev.yml
  13. 61 17
      fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ClueMapper.xml
  14. 12 1
      fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ContactsMapper.xml

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

@@ -9,6 +9,7 @@ import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
 import org.springframework.data.redis.serializer.StringRedisSerializer;
 import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
 /**
  * Author: 吴涛涛
@@ -20,6 +21,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
 @MapperScan("com.management.platform.mapper")
 @EnableTransactionManagement //开启事务支持
 @EnableAsync
+@EnableScheduling
 public class PlatformStartApplication {
     public static void main(String[] args) {
         SpringApplication.run(PlatformStartApplication.class, args);

+ 8 - 6
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ContactsController.java

@@ -57,23 +57,25 @@ public class ContactsController {
         return contactsService.addContacts(contacts, request);
     }
     @RequestMapping("/getAllContacts")
-    public HttpRespMsg getAllContacts(Integer customerId,HttpServletRequest request){
-        return contactsService.getAllContacts(customerId,request);
+    public HttpRespMsg getAllContacts(Integer businessId,Integer salesId ,Integer customerId,HttpServletRequest request){
+        return contactsService.getAllContacts(businessId,salesId,customerId,request);
     }
 
     /**
      * 分页查询联系人
      * @param pageIndex
      * @param pageSize
-     * @param customName
+     * @param customId
      * @param name
+     * @param email
+     * @param creatorId
      * @param phone
-     * @param ownerName
+     * @param ownerId
      * @return
      */
     @RequestMapping("/pageContacts")
-    public HttpRespMsg pageContacts(@RequestParam Integer pageIndex, @RequestParam Integer pageSize,String customName, String name, String email,String creatorName, String phone, String ownerName){
-        return contactsService.pageContacts(pageIndex,pageSize,customName,name,email,creatorName,phone,ownerName,request);
+    public HttpRespMsg pageContacts(@RequestParam Integer pageIndex, @RequestParam Integer pageSize,Integer customId, String name, String email,String creatorId, String phone, String ownerId){
+        return contactsService.pageContacts(pageIndex,pageSize,customId,name,email,creatorId,phone,ownerId,request);
     }
 
     /**

+ 34 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/TaskController.java

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.pagehelper.IPage;
 import com.management.platform.entity.*;
@@ -16,7 +17,10 @@ import com.management.platform.service.*;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.MessageUtils;
 import com.taobao.api.internal.mapping.ApiField;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.ss.formula.functions.T;
 import org.assertj.core.util.Lists;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -27,6 +31,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import java.sql.Wrapper;
 import java.time.Duration;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
@@ -44,6 +49,7 @@ import java.util.stream.Collectors;
  */
 @RestController
 @RequestMapping("/tasks")
+@Slf4j
 public class TaskController {
     @Resource
     private HttpServletRequest request;
@@ -100,5 +106,33 @@ public class TaskController {
         return taskService.updateTaskStatus(taskDto,request);
     }
 
+    /**
+     * 定时修改过期的任务状态
+     */
+    @Scheduled(cron = "0 0/30 * * * ?")
+    public void updateTaskStatusByTiming(){
+        log.info("定时执行了===========>");
+        QueryWrapper<Task> taskQueryWrapper = new QueryWrapper<>();
+        taskQueryWrapper.eq("is_delete",0);
+        List<Task> list = taskService.list(taskQueryWrapper);
+        ArrayList<Integer> overtimeTaskIds = new ArrayList<>();
+        if (!list.isEmpty()){
+            for (Task task : list) {
+                if (task.getEndDate()!=null && task.getStatus()!=null && task.getStatus()<2 &&task.getEndDate().isBefore(LocalDateTime.now())){
+                    overtimeTaskIds.add(task.getId());
+                }
+            }
+        }
+        if (!overtimeTaskIds.isEmpty()){
+            UpdateWrapper<Task> updateWrapper = new UpdateWrapper<>();
+            updateWrapper.set("status",3).in("id",overtimeTaskIds);//设置推迟
+            taskService.update(updateWrapper);
+            log.info("修改了");
+        }else {
+            log.info("没修改");
+        }
+
+    }
+
 }
 

+ 2 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Clue.java

@@ -166,6 +166,8 @@ public class Clue extends Model<Clue> {
     private List<UploadFile> files;
     @TableField(exist = false)
     private List<Task> taskList;
+    @TableField(exist = false)
+    private Integer isDesc;
 
 
     @Override

+ 1 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Contacts.java

@@ -19,7 +19,7 @@ import org.springframework.format.annotation.DateTimeFormat;
  * </p>
  *
  * @author Seyason
- * @since 2024-03-12
+ * @since 2024-06-12
  */
 @Data
 @EqualsAndHashCode(callSuper = false)

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

@@ -22,7 +22,7 @@ public interface ContactsService extends IService<Contacts> {
 
     HttpRespMsg addContacts(Contacts contacts, HttpServletRequest request);
 
-    HttpRespMsg pageContacts(Integer pageIndex, Integer pageSize, String customName, String name,String email,String creatorName,  String phone, String ownerName, HttpServletRequest request);
+    HttpRespMsg pageContacts(Integer pageIndex, Integer pageSize, Integer customId, String name, String email, String creatorId, String phone, String ownerId, HttpServletRequest request);
 
     HttpRespMsg selectContactsByCustomId(Custom custom,HttpServletRequest request);
 
@@ -42,7 +42,7 @@ public interface ContactsService extends IService<Contacts> {
 
     HttpRespMsg exportData(String customName, String name, String email, String creatorName, String phone, String ownerName, HttpServletRequest request) throws Exception;
 
-    HttpRespMsg getAllContacts(Integer customerId, HttpServletRequest request);
+    HttpRespMsg getAllContacts(Integer businessId, Integer salesId, Integer customerId, HttpServletRequest request);
 
     int transferContacts(Contacts contactsGet, User user);
 

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

@@ -288,6 +288,12 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
                 // 文件上传成功的响应消息
                 HttpRespMsg msg = new HttpRespMsg();
                 msg.setMsg("上传成功");
+                ActionLog log = new ActionLog();
+                log.setItemId(bo.getId());
+                log.setCode("business");
+                log.setUserId(user.getId());
+                log.setName("上传了文件");
+                log.setCreatTime(new Date());
                 return msg;
             } catch (IOException e) {
                 e.printStackTrace();

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

@@ -187,7 +187,7 @@ public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements Cl
             String executorId = task.getExecutorId();
             List<String> ids1 = new ArrayList<>();
             List<String> userNames = new ArrayList<>();
-            if (!executorId.isEmpty()) {
+            if (executorId != null) {
                 for (String id : executorId.split(",")) {
                     ids1.add(id);
                 }
@@ -312,16 +312,19 @@ public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements Cl
                 uploadFileMapper.insert(uf);
                 // 构建上传文件的目标路径
                 String filePath1 = filePath + realName;
-
                 // 在服务器上创建文件
                 File dest = new File(filePath1);
-
                 // 将上传的文件保存到目标路径
                 file.transferTo(dest);
-
                 // 文件上传成功的响应消息
                 HttpRespMsg msg = new HttpRespMsg();
                 msg.setMsg("上传成功");
+                ActionLog log = new ActionLog();
+                log.setItemId(clue.getId());
+                log.setCode("clue");
+                log.setUserId(user.getId());
+                log.setName("上传了文件");
+                log.setCreatTime(new Date());
                 return msg;
             } catch (IOException e) {
                 e.printStackTrace();

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

@@ -113,7 +113,7 @@ public class ContactsDocumentServiceImpl extends ServiceImpl<ContactsDocumentMap
     public HttpRespMsg fileDown(HttpServletRequest request, HttpServletResponse response, Integer folderId, Integer contactsId, Integer fileId) {
         HttpRespMsg msg = new HttpRespMsg();
         User user = userMapper.selectById(request.getHeader("token"));
-        List<ContactsDocument> files = contactsDocumentMapper.selectList(new QueryWrapper<ContactsDocument>().eq("contacts_id", contactsId));
+        List<ContactsDocument> files = contactsDocumentMapper.selectList(new QueryWrapper<ContactsDocument>().eq("id", fileId));
         try {
             ServletOutputStream os = response.getOutputStream();
             for (ContactsDocument file : files) {
@@ -142,7 +142,7 @@ public class ContactsDocumentServiceImpl extends ServiceImpl<ContactsDocumentMap
         List<Integer> fileIds = contactsFileDto.getFileIds();
         List<ContactsDocument> contactsDocuments = contactsDocumentMapper.selectBatchIds(fileIds);
         for (ContactsDocument contactsDocument : contactsDocuments) {
-            contactsDocumentMapper.update(null,new UpdateWrapper<ContactsDocument>().eq("contacts_id", contactsDocument.getContactsId()).set("is_deleted", 1));
+            contactsDocumentMapper.update(null,new UpdateWrapper<ContactsDocument>().eq("id", contactsDocument.getId()).set("is_deleted", 1));
         }
         msg.setMsg("删除成功");
         return msg;

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

@@ -3,7 +3,6 @@ package com.management.platform.service.impl;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -17,10 +16,6 @@ import com.management.platform.service.WxCorpInfoService;
 import com.management.platform.util.ExcelUtil;
 import com.management.platform.util.HttpRespMsg;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.hssf.usermodel.HSSFCell;
-import org.apache.poi.hssf.usermodel.HSSFRow;
-import org.apache.poi.hssf.usermodel.HSSFSheet;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.usermodel.CellType;
 import org.apache.poi.xssf.usermodel.XSSFCell;
 import org.apache.poi.xssf.usermodel.XSSFRow;
@@ -64,6 +59,9 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
     @Resource
     private BusinessOpportunityMapper businessOpportunityMapper;
 
+    @Resource
+    private SalesOrderMapper salesOrderMapper;
+
     @Resource
     private CustomMapper customMapper;
 
@@ -112,13 +110,10 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
         }
 
         LambdaQueryWrapper<Contacts> lqw_contacts = new LambdaQueryWrapper<>();
-        lqw_contacts.eq(Contacts::getCustomId, contacts.getCustomId())
-                .eq(Contacts::getName, contacts.getName())
-                .eq(Contacts::getPhone,contacts.getPhone())
-                .eq(Contacts::getOwnerId,contacts.getOwnerId());
+        lqw_contacts.eq(Contacts::getPhone,contacts.getPhone());
         Contacts selectedOne = contactsMapper.selectOne(lqw_contacts);
         if (selectedOne != null) {
-            httpRespMsg.setError("已存在该联系人!");
+            httpRespMsg.setError("已存在该联系人,手机号重复!");
             return httpRespMsg;
         }
         contacts.setCompanyId(companyId)
@@ -141,19 +136,19 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
     }
 
     @Override
-    public HttpRespMsg pageContacts(Integer pageIndex, Integer pageSize, String customName, String name, String email, String creatorName, String phone, String ownerName, HttpServletRequest request) {
+    public HttpRespMsg pageContacts(Integer pageIndex, Integer pageSize, Integer customId, String name, String email, String creatorId, String phone, String ownerId, HttpServletRequest request) {
         Map<String, Object> map = new HashMap<>();
-        map.put("customName", customName);
+        map.put("customId", customId);
         map.put("name", name);
         map.put("phone", phone);
-        map.put("ownerName", ownerName);
+        map.put("ownerId", ownerId);
         map.put("email", email);
-        map.put("creatorName", creatorName);
+        map.put("creatorId", creatorId);
         String token = String.valueOf(request.getHeader("Token"));
         User user = userMapper.selectById(token);
         map.put("companyId", user.getCompanyId());
         map.put("isDelete", 0);
-        Page<ContactsVo> pageContacts = contactsMapper.pageContacts(new Page(pageIndex, pageSize), map);
+        Page<ContactsVo> pageContacts = contactsMapper.pageContacts(new Page((long) (pageIndex - 1) *pageSize, pageSize), map);
 
         List<ContactsVo> records = pageContacts.getRecords();
         long total = pageContacts.getTotal();
@@ -241,7 +236,7 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
         User user = userMapper.selectById(token);
         map.put("companyId", user.getCompanyId());
         map.put("isDelete", 1);
-        Page<ContactsVo> pageContacts = contactsMapper.pageContacts(new Page(pageIndex, pageSize), map);
+        Page<ContactsVo> pageContacts = contactsMapper.pageContacts(new Page((long) (pageIndex - 1) *pageSize, pageSize), map);
 
         List<ContactsVo> records = pageContacts.getRecords();
         long total = pageContacts.getTotal();
@@ -475,11 +470,6 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
                             userNameList.add(cell.getStringCellValue());
                         }
                     }
-                    if(modelName.equals("companySigner")){
-                        if(!org.springframework.util.StringUtils.isEmpty(cell.getStringCellValue())){
-                            userNameList.add(cell.getStringCellValue());
-                        }
-                    }
 
                 }
             }
@@ -508,6 +498,7 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
                 Contacts contacts=new Contacts();
                 contacts.setCompanyId(companyId);
                 contacts.setCreatorId(user.getId());
+                contacts.setIsDelete(0);
                 for (int i = 0; i < cellNum; i++) {
                     String modelName = modelNameList.get(i);
                     String className = modelName.substring(0, 1).toUpperCase() + modelName.substring(1);
@@ -684,10 +675,32 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
     }
 
     @Override
-    public HttpRespMsg getAllContacts(Integer customerId, HttpServletRequest request) {
+    public HttpRespMsg getAllContacts(Integer businessId, Integer salesId, Integer customerId, HttpServletRequest request) {
         User user = userMapper.selectById(request.getHeader("token"));
         HttpRespMsg mgs = new HttpRespMsg();
-        if (customerId!=null){
+        if (businessId!=null){
+            BusinessOpportunity businessOpportunity = businessOpportunityMapper.selectById(businessId);
+            if (businessOpportunity==null||businessOpportunity.getContactsId()==null){
+                mgs.setData(new ArrayList<Contacts>());
+            }else {
+                Integer contactsId = businessOpportunity.getContactsId();
+                mgs.setData(contactsMapper.selectList(new QueryWrapper<Contacts>()
+                        .eq("company_id",user.getCompanyId())
+                        .eq("id",contactsId)));
+            }
+        }else if(salesId!=null){
+            SalesOrder salesOrder = salesOrderMapper.selectById(salesId);
+            if (salesOrder==null||salesOrder.getContactsId()==null){
+                mgs.setData(new ArrayList<Contacts>());
+            }else {
+                Integer contactsId = salesOrder.getContactsId();
+                mgs.setData(contactsMapper.selectList(new QueryWrapper<Contacts>()
+                        .eq("company_id",user.getCompanyId())
+                        .eq("id",contactsId)));
+            }
+
+        }
+        else if (customerId!=null){
             mgs.setData(contactsMapper.selectList(new QueryWrapper<Contacts>()
                     .eq("company_id",user.getCompanyId())
                     .eq("custom_id",customerId)));

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

@@ -242,7 +242,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                 User selectedUser = userMapper.selectById(executorId);
                 taskExecutor.setExecutorId(executorId)
                         .setTaskId(task.getId())
-                        .setExecutorName(selectedUser.getName());
+                        .setExecutorName(selectedUser.getName())
+                        .setCompanyId(user.getCompanyId());
                 taskExecutorMapper.insert(taskExecutor);
             }
         }
@@ -402,6 +403,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                 task.setCreaterId(user.getId());
                 task.setCreateDate(LocalDateTime.now());
                 task.setStatus(0);
+                task.setIsDelete(0);
                 for (int i = 0; i < cellNum; i++) {
                     JSONObject item = configObJSONArray.getJSONObject(i);
                     String modelName = item.getString("model");

+ 1 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/resources/application-dev.yml

@@ -80,7 +80,7 @@ mybatis:
   mapper-locations: mappers/*Mapper.xml
 #####配置图片上传路径####
 upload:
-  path: /www/staticproject/timesheet/upload/
+  path: /www/staticproject/timesheet-crm/upload/
 
 
 

+ 61 - 17
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ClueMapper.xml

@@ -57,6 +57,7 @@
                (select name from sys_dict where c.customer_industry_id = id and code = 'CustomIndustry') customerIndustryValue,
                (select name from sys_dict where c.customer_level_id = id and code = 'CustomLevel') customerLevelValue
         from clue c
+        left join sys_dict sd on c.customer_level_id = sd.id
         where
             c.company_id = #{companyId} and is_delete = #{isDelete}
         <if test="inchargerId != null and inchargerId != ''  ">
@@ -83,7 +84,21 @@
         <if test="customerIndustryId != null">
         and  c.customer_industry_id =  #{customerIndustryId}
         </if>
-        ORDER BY c.id DESC
+        ORDER BY
+        <choose>
+            <when test="isDesc == null or isDesc == ''">
+                c.id DESC
+            </when>
+            <when test="isDesc == 0">
+                sd.seq ASC, c.id DESC
+            </when>
+            <when test="isDesc == 1">
+                sd.seq DESC, c.id DESC
+            </when>
+            <otherwise>
+                c.id DESC
+            </otherwise>
+        </choose>
         limit #{pageIndex},#{pageFrom}
     </select>
     <select id="list1" resultType="com.management.platform.entity.Clue">
@@ -113,6 +128,7 @@
         (select name from sys_dict where c.customer_industry_id = id and code = 'CustomIndustry') customerIndustryValue,
         (select name from sys_dict where c.customer_level_id = id and code = 'CustomLevel') customerLevelValue
         from clue c
+        left join sys_dict sd on c.customer_level_id = sd.id
         where
         c.company_id = #{clue.companyId} and is_delete = #{clue.isDelete}
         and (c.incharger_id in
@@ -142,13 +158,27 @@
         <if test="clue.customerIndustryId != null">
             and  c.customer_industry_id =  #{clue.customerIndustryId}
         </if>
-        ORDER BY c.id DESC
+        ORDER BY
+        <choose>
+            <when test="isDesc == null or isDesc == ''">
+                c.id DESC
+            </when>
+            <when test="isDesc == 0">
+                sd.seq ASC, c.id DESC
+            </when>
+            <when test="isDesc == 1">
+                sd.seq DESC, c.id DESC
+            </when>
+            <otherwise>
+                c.id DESC
+            </otherwise>
+        </choose>
         limit #{clue.pageIndex},#{clue.pageFrom}
     </select>
     <select id="list2" resultType="com.management.platform.entity.Clue">
         select c.id,
         c.company_id,
-        (select company_name from company where company_id = c.id) companyName,
+        (select company_name from company where c.company_id = c.id) companyName,
         c.clue_name,
         c.clue_source_id,
         c.phone,
@@ -172,8 +202,9 @@
         (select name from sys_dict where c.customer_industry_id = id and code = 'CustomIndustry') customerIndustryValue,
         (select name from sys_dict where c.customer_level_id = id and code = 'CustomLevel') customerLevelValue
         from clue c
+        left join sys_dict sd on c.customer_level_id = sd.id
         where
-        c.company_id = #{clue.companyId} and is_delete = #{clue.isDelete}
+        c.company_id = #{clue.companyId} and c.is_delete = #{clue.isDelete}
         and (c.incharger_id = #{userId} or c.incharger_id is null)
         <if test="clue.inchargerId != null and clue.inchargerId != ''  ">
           and c.incharger_id =#{clue.inchargerId}
@@ -199,7 +230,21 @@
         <if test="clue.customerIndustryId != null">
             and  c.customer_industry_id =  #{clue.customerIndustryId}
         </if>
-        ORDER BY c.id DESC
+        ORDER BY
+        <choose>
+            <when test="clue.isDesc == null or clue.isDesc == ''">
+                c.id DESC
+            </when>
+            <when test="clue.isDesc == 0">
+                sd.seq ASC, c.id DESC
+            </when>
+            <when test="clue.isDesc == 1">
+                sd.seq DESC, c.id DESC
+            </when>
+            <otherwise>
+                c.id DESC
+            </otherwise>
+        </choose>
         limit #{clue.pageIndex},#{clue.pageFrom}
     </select>
     <select id="getTotal" resultType="java.lang.Integer">
@@ -268,35 +313,34 @@
     </select>
     <select id="getTotal2" resultType="java.lang.Integer">
         select
-        COUNT(c.id)
+            count(c.id)
         from clue c
         where
-        c.company_id = #{clue.companyId} and is_delete = #{clue.isDelete}
+        c.company_id = #{clue.companyId} and c.is_delete = #{clue.isDelete}
+        and (c.incharger_id = #{userId} or c.incharger_id is null)
         <if test="clue.inchargerId != null and clue.inchargerId != ''  ">
-          and  c.incharger_id =#{clue.inchargerId}
+            and c.incharger_id =#{clue.inchargerId}
         </if>
-        and c.incharger_id = #{userId} and c.incharger_id is null
         <if test="clue.startTime != null and clue.endTime != null ">
-            and c.create_time BETWEEN #{clue.startTime} and #{clue.endTime}
+            and  c.create_time BETWEEN  #{clue.startTime} and #{clue.endTime}
         </if>
         <if test="clue.clueName != null and clue.clueName != '' ">
-            and c.clue_name LIKE CONCAT('%', #{clue.clueName}, '%')
+            and  c.clue_name  LIKE CONCAT('%', #{clue.clueName}, '%')
         </if>
         <if test="clue.phone != null and clue.phone != '' ">
             and  c.phone LIKE CONCAT('%', #{clue.phone}, '%')
         </if>
-        <if test="clue.email != null and clue.email != '' ">
-            and  c.email LIKE CONCAT('%', #{clue.email}, '%')
-        </if>
-
         <if test="clue.customerLevelId != null and clue.customerLevelId != '' ">
             and  c.customer_level_id =  #{clue.customerLevelId}
         </if>
+        <if test="clue.email != null and clue.email != '' ">
+            and  c.email LIKE CONCAT('%', #{clue.email}, '%')
+        </if>
         <if test="clue.clueSourceId != null">
-            and c.clue_source_id = #{clue.clueSourceId}
+            and  c.clue_source_id =  #{clue.clueSourceId}
         </if>
         <if test="clue.customerIndustryId != null">
-            and c.customer_industry_id = #{clue.customerIndustryId}
+            and  c.customer_industry_id =  #{clue.customerIndustryId}
         </if>
     </select>
 

+ 12 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ContactsMapper.xml

@@ -29,11 +29,13 @@
     <sql id="Base_Column_List">
         id, company_id, sex, name, custom_id, email, phone, owner_id, creator_id, address, remark, is_delete, create_time, position, plate1, plate2, plate3, plate4, plate5
     </sql>
+
     <select id="pageContacts" parameterType="java.util.Map"  resultType="com.management.platform.entity.vo.ContactsVo">
-        SELECT c.*, cust.custom_name as customName, own.name as ownerName
+        SELECT c.*, cust.custom_name as customName, own.name as ownerName,u.name as creatorName
         FROM contacts c
         LEFT JOIN custom cust ON c.custom_id = cust.id
         LEFT JOIN user own ON c.owner_id = own.id
+        LEFT JOIN user u ON c.creator_id = u.id
         <where>
             <if test="map.isDelete != null ">
                 AND c.is_delete =#{map.isDelete}
@@ -47,6 +49,15 @@
             <if test="map.creatorName != null and map.creatorName != ''">
                 AND own.name LIKE CONCAT('%', #{map.creatorName}, '%')
             </if>
+            <if test="map.customId != null and map.customId != ''">
+                AND cust.id =#{map.customId}
+            </if>
+            <if test="map.ownerId != null and map.ownerId != ''">
+                AND own.id =#{map.ownerId}
+            </if>
+            <if test="map.creatorId != null and map.creatorId != ''">
+                AND own.id =#{map.creatorId}
+            </if>
             <if test="map.phone != null and map.phone != ''">
                 AND c.phone LIKE CONCAT('%', #{map.phone}, '%')
             </if>