Lijy 4 months ago
parent
commit
2e91242c80
30 changed files with 1281 additions and 144 deletions
  1. 25 10
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ClueController.java
  2. 17 4
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ContractController.java
  3. 18 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ProductController.java
  4. 18 3
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/SalesOrderController.java
  5. 26 23
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/TaskController.java
  6. 24 6
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Clue.java
  7. 17 6
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Contract.java
  8. 18 6
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Product.java
  9. 24 8
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/SalesOrder.java
  10. 23 8
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Task.java
  11. 7 3
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/ClueMapper.java
  12. 2 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/ContractMapper.java
  13. 2 2
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/TaskMapper.java
  14. 7 2
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ClueService.java
  15. 7 4
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ContractService.java
  16. 8 2
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ProductService.java
  17. 8 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/SalesOrderService.java
  18. 6 3
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/TaskService.java
  19. 58 16
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ClueServiceImpl.java
  20. 163 10
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ContractServiceImpl.java
  21. 0 1
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/InformationServiceImpl.java
  22. 125 9
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ProductServiceImpl.java
  23. 176 10
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/SalesOrderServiceImpl.java
  24. 77 2
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/TaskServiceImpl.java
  25. 3 3
      fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/BusinessOpportunityMapper.xml
  26. 217 0
      fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ClueMapper.xml
  27. 1 1
      fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ContactsMapper.xml
  28. 46 1
      fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ContractMapper.xml
  29. 29 1
      fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/CustomMapper.xml
  30. 129 0
      fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/TaskMapper.xml

+ 25 - 10
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ClueController.java

@@ -5,26 +5,25 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.management.platform.entity.*;
 import com.management.platform.entity.*;
-import com.management.platform.entity.vo.ContactsVo;
-import com.management.platform.mapper.*;
-import com.management.platform.service.*;
+import com.management.platform.mapper.ClueMapper;
+import com.management.platform.mapper.SysDictMapper;
+import com.management.platform.mapper.SysFormMapper;
+import com.management.platform.mapper.UserMapper;
+import com.management.platform.service.ClueService;
+import com.management.platform.service.ExcelExportService;
+import com.management.platform.service.SysFunctionService;
+import com.management.platform.service.WxCorpInfoService;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.HttpRespMsg;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
@@ -56,6 +55,22 @@ public class ClueController {
     @Autowired
     @Autowired
     private ExcelExportService excelExportService;
     private ExcelExportService excelExportService;
 
 
+    @PostMapping("/pageClueByPin")
+    public HttpRespMsg pageClueByPin(Clue clue, HttpServletRequest request) {
+        return clueService.pageClueByPin(clue,request);
+    }
+
+    @PostMapping("/pinClue")
+    public HttpRespMsg pinClue(Clue clue, HttpServletRequest request) {
+        return clueService.pinClue(clue,request);
+    }
+
+    @PostMapping("/undoPin")
+    public HttpRespMsg undoPin(Clue clue,HttpServletRequest request) {
+        return clueService.undoPin(clue,request);
+    }
+
+
     @RequestMapping("getAll")
     @RequestMapping("getAll")
     public Object getAll(HttpServletRequest request) {
     public Object getAll(HttpServletRequest request) {
         User user = userMapper.selectById(request.getHeader("Token"));
         User user = userMapper.selectById(request.getHeader("Token"));

+ 17 - 4
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ContractController.java

@@ -6,18 +6,15 @@ import com.management.platform.entity.*;
 import com.management.platform.mapper.ProjectMapper;
 import com.management.platform.mapper.ProjectMapper;
 import com.management.platform.mapper.UserMapper;
 import com.management.platform.mapper.UserMapper;
 import com.management.platform.service.ContractService;
 import com.management.platform.service.ContractService;
-import com.management.platform.service.ContractTypeService;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.HttpRespMsg;
-import org.springframework.http.HttpRequest;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -38,6 +35,22 @@ public class ContractController {
     @Resource
     @Resource
     private ProjectMapper projectMapper;
     private ProjectMapper projectMapper;
 
 
+    @PostMapping("/pageContractByPin")
+    public HttpRespMsg pageContractByPin(HttpServletRequest request, @RequestParam Integer pageIndex, @RequestParam Integer pageSize, String number,String name,String typeName,Integer status,
+                                         String startDate,String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId,@RequestParam(required = false) String customerOrg,@RequestParam(required = false) Integer finishStatus) {
+        return contractService.pageContractByPin(request,pageIndex,pageSize,number,name,typeName,status,startDate,endDate, paymentStartDate, paymentEndDate, secTypeId,customerOrg,finishStatus);
+    }
+
+    @PostMapping("/pinContract")
+    public HttpRespMsg pinContract(Contract contract, HttpServletRequest request) {
+        return contractService.pinContract(contract,request);
+    }
+
+    @PostMapping("/undoPin")
+    public HttpRespMsg undoPin(Contract contract,HttpServletRequest request) {
+        return contractService.undoPin(contract,request);
+    }
+
     /**
     /**
      * 分页查询合同
      * 分页查询合同
      */
      */

+ 18 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ProductController.java

@@ -9,6 +9,7 @@ import com.management.platform.util.BeanChangeUtil;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.HttpRespMsg;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
@@ -61,6 +62,23 @@ public class ProductController {
     @Resource
     @Resource
     private ContactsService contactsService;
     private ContactsService contactsService;
 
 
+    @PostMapping("/pageProductByPin")
+    public HttpRespMsg pageProductByPin(String userId,String productName,String productCode,Integer productType,Integer status,String startTime,String endTime,Integer pageIndex,Integer pageSize) {
+        Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
+        return productService.pageProductByPin(companyId,userId,productName,productCode,productType,status,startTime,endTime,pageIndex,pageSize,request);
+    }
+
+    @PostMapping("/pinProduct")
+    public HttpRespMsg pinProduct(Product product, HttpServletRequest request) {
+        return productService.pinProduct(product,request);
+    }
+
+    @PostMapping("/undoPin")
+    public HttpRespMsg undoPin(Product product, HttpServletRequest request) {
+        return productService.undoPin(product,request);
+    }
+
+
 
 
     /**
     /**
     * @Description:获取产品列表数据
     * @Description:获取产品列表数据

+ 18 - 3
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/SalesOrderController.java

@@ -4,16 +4,14 @@ package com.management.platform.controller;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.management.platform.entity.*;
 import com.management.platform.entity.*;
-import com.management.platform.mapper.ProductMapper;
 import com.management.platform.mapper.UserMapper;
 import com.management.platform.mapper.UserMapper;
 import com.management.platform.service.*;
 import com.management.platform.service.*;
 import com.management.platform.util.BeanChangeUtil;
 import com.management.platform.util.BeanChangeUtil;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.HttpRespMsg;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
@@ -55,6 +53,23 @@ public class SalesOrderController {
     @Resource
     @Resource
     private ProductService productService;
     private ProductService productService;
 
 
+    @PostMapping("/pageOrderByPin")
+    public HttpRespMsg pageOrderByPin(String inchargerId,Integer orderType, String orderName,
+                                      String orderCode,Integer customId,String businessName,
+                                      Integer receivedStatus,String startTime,String endTime, String productCode, Integer pageIndex, Integer pageSize,Integer isDelete) {
+        return salesOrderService.pageOrderByPin(inchargerId,orderType,orderName,orderCode,customId,businessName,receivedStatus,startTime,endTime,productCode,pageIndex,pageSize,isDelete);
+    }
+
+    @PostMapping("/pinOrder")
+    public HttpRespMsg pinOrder(SalesOrder order, HttpServletRequest request) {
+        return salesOrderService.pinOrder(order,request);
+    }
+
+    @PostMapping("/undoPin")
+    public HttpRespMsg undoPin(SalesOrder order,HttpServletRequest request) {
+        return salesOrderService.undoPin(order,request);
+    }
+
 
 
     /**
     /**
      * 获取列表数据 ps:分页参数(-1,-1)获取全部数据
      * 获取列表数据 ps:分页参数(-1,-1)获取全部数据

+ 26 - 23
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/TaskController.java

@@ -1,47 +1,35 @@
 package com.management.platform.controller;
 package com.management.platform.controller;
 
 
 
 
-import com.alibaba.fastjson.JSONArray;
-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.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 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.*;
 import com.management.platform.entity.*;
 import com.management.platform.entity.dto.TaskDto;
 import com.management.platform.entity.dto.TaskDto;
-import com.management.platform.entity.vo.SysRichFunction;
-import com.management.platform.mapper.*;
-import com.management.platform.service.*;
+import com.management.platform.mapper.UserMapper;
+import com.management.platform.mapper.WxCorpInfoMapper;
+import com.management.platform.service.InformationService;
+import com.management.platform.service.TaskInformationService;
+import com.management.platform.service.TaskService;
+import com.management.platform.service.WxCorpInfoService;
 import com.management.platform.service.impl.WxCorpInfoServiceImpl;
 import com.management.platform.service.impl.WxCorpInfoServiceImpl;
-import com.management.platform.util.DateTimeUtil;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.HttpRespMsg;
-import com.management.platform.util.MessageUtils;
-import com.management.platform.util.WorkDayCalculateUtils;
-import com.taobao.api.internal.mapping.ApiField;
 import lombok.extern.slf4j.Slf4j;
 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.scheduling.annotation.Scheduled;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 import org.springframework.util.StringUtils;
-import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
-import java.sql.Wrapper;
-import java.time.Duration;
-import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
 import java.time.temporal.ChronoUnit;
 import java.time.temporal.ChronoUnit;
-import java.util.*;
-import java.util.stream.Collectors;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -71,6 +59,21 @@ public class TaskController {
     UserMapper userMapper;
     UserMapper userMapper;
 
 
 
 
+    @PostMapping("/pageTasksByPin")
+    public HttpRespMsg pageTasksByPin(TaskDto taskDto) {
+        return taskService.pageTasksByPin(taskDto,request);
+    }
+
+    @PostMapping("/pinTasks")
+    public HttpRespMsg pinTasks(Task task) {
+        return taskService.pinTasks(task,request);
+    }
+
+    @PostMapping("/undoPin")
+    public HttpRespMsg undoPin(Task task) {
+        return taskService.undoPin(task,request);
+    }
+
 
 
     @RequestMapping("addTask")
     @RequestMapping("addTask")
     public HttpRespMsg addTask(TaskDto taskDto){
     public HttpRespMsg addTask(TaskDto taskDto){

+ 24 - 6
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Clue.java

@@ -1,18 +1,20 @@
 package com.management.platform.entity;
 package com.management.platform.entity;
 
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
-import java.io.Serializable;
-import java.util.Date;
-import java.util.List;
-
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.EqualsAndHashCode;
 import lombok.Getter;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.Setter;
 import lombok.experimental.Accessors;
 import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -160,6 +162,22 @@ public class Clue extends Model<Clue> {
      */
      */
     @TableField("create_time")
     @TableField("create_time")
     private Date createTime;
     private Date createTime;
+
+    /**
+     * 是否需要置顶 0/Flase 1/True
+     */
+    @TableField("need_pin")
+    private Boolean needPin;
+
+    /**
+     * 被置顶时间
+     */
+    @TableField("pin_time")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date pinTime;
+
+
     @TableField(exist = false)
     @TableField(exist = false)
     private String startTime;
     private String startTime;
     @TableField(exist = false)
     @TableField(exist = false)

+ 17 - 6
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Contract.java

@@ -1,19 +1,20 @@
 package com.management.platform.entity;
 package com.management.platform.entity;
 
 
-import java.math.BigDecimal;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import java.time.LocalDate;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
-import java.io.Serializable;
-
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import lombok.experimental.Accessors;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.format.annotation.DateTimeFormat;
 
 
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.Date;
+
 /**
 /**
  * <p>
  * <p>
  * 
  * 
@@ -208,6 +209,16 @@ public class Contract extends Model<Contract> {
     @TableField(exist = false)
     @TableField(exist = false)
     private String secTypeName;
     private String secTypeName;
 
 
+    /**是否需要置顶 0/Flase 1/True*/
+    @TableField("need_pin")
+    private Boolean needPin;
+
+    /**被置顶时间*/
+    @TableField("pin_time")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+    private Date pinTime;
+
 
 
     @Override
     @Override
     protected Serializable pkVal() {
     protected Serializable pkVal() {

+ 18 - 6
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Product.java

@@ -1,13 +1,9 @@
 package com.management.platform.entity;
 package com.management.platform.entity;
 
 
-import java.math.BigDecimal;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import com.baomidou.mybatisplus.annotation.TableId;
-import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
-import java.io.Serializable;
-
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.management.platform.config.PropertyMsg;
 import com.management.platform.config.PropertyMsg;
 import lombok.Data;
 import lombok.Data;
@@ -15,6 +11,11 @@ import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import lombok.experimental.Accessors;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.format.annotation.DateTimeFormat;
 
 
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.Date;
+
 /**
 /**
  * <p>
  * <p>
  * 
  * 
@@ -170,6 +171,17 @@ public class Product extends Model<Product> {
     private OrderProductDetail orderProductDetail;
     private OrderProductDetail orderProductDetail;
 
 
 
 
+    /**是否需要置顶 0/Flase 1/True*/
+    @TableField("need_pin")
+    private Boolean needPin;
+
+    /**被置顶时间*/
+    @TableField("pin_time")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+    private Date pinTime;
+
+
     @Override
     @Override
     protected Serializable pkVal() {
     protected Serializable pkVal() {
         return this.id;
         return this.id;

+ 24 - 8
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/SalesOrder.java

@@ -1,15 +1,9 @@
 package com.management.platform.entity;
 package com.management.platform.entity;
 
 
-import java.math.BigDecimal;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import java.time.LocalDate;
-import com.baomidou.mybatisplus.annotation.TableId;
-import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
-import java.io.Serializable;
-import java.util.List;
-
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.management.platform.config.PropertyMsg;
 import com.management.platform.config.PropertyMsg;
 import lombok.Data;
 import lombok.Data;
@@ -17,6 +11,13 @@ import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import lombok.experimental.Accessors;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.format.annotation.DateTimeFormat;
 
 
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.Date;
+import java.util.List;
+
 /**
 /**
  * <p>
  * <p>
  * 
  * 
@@ -217,6 +218,21 @@ public class SalesOrder extends Model<SalesOrder> {
     private LocalDateTime updateTime;
     private LocalDateTime updateTime;
 
 
 
 
+    /**
+     * 是否需要置顶 0/Flase 1/True
+     */
+    @TableField("need_pin")
+    private Boolean needPin;
+
+    /**
+     * 被置顶时间
+     */
+    @TableField("pin_time")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date pinTime;
+
+
     @TableField(exist = false)
     @TableField(exist = false)
     private String orderProductDetailString;
     private String orderProductDetailString;
 
 

+ 23 - 8
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Task.java

@@ -1,21 +1,21 @@
 package com.management.platform.entity;
 package com.management.platform.entity;
 
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import com.baomidou.mybatisplus.annotation.TableId;
-
-import java.time.LocalDate;
-import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
-import java.io.Serializable;
-import java.util.List;
-
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import lombok.experimental.Accessors;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.format.annotation.DateTimeFormat;
 
 
+import java.io.Serializable;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.Date;
+import java.util.List;
+
 /**
 /**
  * <p>
  * <p>
  * 
  * 
@@ -250,6 +250,21 @@ public class Task extends Model<Task> {
      */
      */
     @TableField("plate5")
     @TableField("plate5")
     private String plate5;
     private String plate5;
+
+    /**
+     * 是否需要置顶 0/Flase 1/True
+     */
+    @TableField("need_pin")
+    private Boolean needPin;
+
+    /**
+     * 被置顶时间
+     */
+    @TableField("pin_time")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date pinTime;
+
     @TableField(exist = false)
     @TableField(exist = false)
     private List<String> executorNames;
     private List<String> executorNames;
 
 

+ 7 - 3
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/ClueMapper.java

@@ -1,12 +1,10 @@
 package com.management.platform.mapper;
 package com.management.platform.mapper;
 
 
-import com.management.platform.entity.Clue;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.management.platform.util.HttpRespMsg;
+import com.management.platform.entity.Clue;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Select;
 
 
-import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
@@ -45,4 +43,10 @@ public interface ClueMapper extends BaseMapper<Clue> {
     List<Clue> getAlllist1(Clue clue);
     List<Clue> getAlllist1(Clue clue);
 
 
     List<Clue> getAllList2(Clue clue);
     List<Clue> getAllList2(Clue clue);
+
+    List<Clue> listByPin(Clue clue);
+
+    List<Clue> list1ByPin(@Param("clue") Clue clue ,@Param("userId") String userId);
+
+    List<Clue> list2ByPin(@Param("clue") Clue clue ,@Param("userId") String userId);
 }
 }

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

@@ -16,4 +16,6 @@ import java.util.List;
 public interface ContractMapper extends BaseMapper<Contract> {
 public interface ContractMapper extends BaseMapper<Contract> {
     List<Contract> selectContract(Integer companyId, Integer pageStart, Integer pageSize, String number, String name, String typeName, Integer status, String startDate,String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId,String customerOrg,Integer finishStatus);
     List<Contract> selectContract(Integer companyId, Integer pageStart, Integer pageSize, String number, String name, String typeName, Integer status, String startDate,String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId,String customerOrg,Integer finishStatus);
     Long selectContractCnt(Integer companyId, String number, String name, String typeName, Integer status, String startDate,String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId,String customerOrg,Integer finishStatus);
     Long selectContractCnt(Integer companyId, String number, String name, String typeName, Integer status, String startDate,String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId,String customerOrg,Integer finishStatus);
+
+    List<Contract> selectContractByPin(Integer companyId, Integer pageStart, Integer pageSize, String number, String name, String typeName, Integer status, String startDate, String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId, String customerOrg, Integer finishStatus);
 }
 }

+ 2 - 2
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/TaskMapper.java

@@ -1,10 +1,8 @@
 package com.management.platform.mapper;
 package com.management.platform.mapper;
 
 
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.toolkit.Constants;
 import com.baomidou.mybatisplus.core.toolkit.Constants;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.management.platform.entity.Clue;
 import com.management.platform.entity.Clue;
 import com.management.platform.entity.Task;
 import com.management.platform.entity.Task;
 import com.management.platform.entity.TimeTask;
 import com.management.platform.entity.TimeTask;
@@ -68,4 +66,6 @@ public interface TaskMapper extends BaseMapper<Task> {
     List<Task> selectByInfoList(Clue clue1);
     List<Task> selectByInfoList(Clue clue1);
 
 
     List<TasKVo> getListByTaskIds(@Param("taskIdArray") String[] taskIdArray);
     List<TasKVo> getListByTaskIds(@Param("taskIdArray") String[] taskIdArray);
+
+    List<TasKVo> getPageListTaskByPin(TaskDto taskDto);
 }
 }

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

@@ -1,7 +1,7 @@
 package com.management.platform.service;
 package com.management.platform.service;
 
 
-import com.management.platform.entity.Clue;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.management.platform.entity.Clue;
 import com.management.platform.entity.UploadFile;
 import com.management.platform.entity.UploadFile;
 import com.management.platform.entity.User;
 import com.management.platform.entity.User;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.HttpRespMsg;
@@ -9,7 +9,6 @@ import org.springframework.web.multipart.MultipartFile;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
-import java.lang.reflect.InvocationTargetException;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -61,4 +60,10 @@ public interface ClueService extends IService<Clue> {
     List<Clue> getAllList(Clue clue);
     List<Clue> getAllList(Clue clue);
 
 
     List<Clue> getAllList2(Clue clue, User user);
     List<Clue> getAllList2(Clue clue, User user);
+
+    HttpRespMsg pageClueByPin(Clue clue, HttpServletRequest request);
+
+    HttpRespMsg pinClue(Clue clue, HttpServletRequest request);
+
+    HttpRespMsg undoPin(Clue clue, HttpServletRequest request);
 }
 }

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

@@ -1,15 +1,12 @@
 package com.management.platform.service;
 package com.management.platform.service;
 
 
-import com.management.platform.entity.Contract;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.management.platform.entity.Contract;
 import com.management.platform.entity.ContractCustom;
 import com.management.platform.entity.ContractCustom;
-import com.management.platform.entity.ContractPayCustomized;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.HttpRespMsg;
-import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
-import java.util.List;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -41,4 +38,10 @@ public interface ContractService extends IService<Contract> {
 
 
     HttpRespMsg exportContractOneToMany(HttpServletRequest request, String number, String name, String typeName, Integer status, String startDate,
     HttpRespMsg exportContractOneToMany(HttpServletRequest request, String number, String name, String typeName, Integer status, String startDate,
                                         String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId,String customerOrg,Integer finishStatus);
                                         String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId,String customerOrg,Integer finishStatus);
+
+    HttpRespMsg pageContractByPin(HttpServletRequest request, Integer pageIndex, Integer pageSize, String number, String name, String typeName, Integer status, String startDate, String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId, String customerOrg, Integer finishStatus);
+
+    HttpRespMsg pinContract(Contract contract, HttpServletRequest request);
+
+    HttpRespMsg undoPin(Contract contract, HttpServletRequest request);
 }
 }

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

@@ -1,11 +1,11 @@
 package com.management.platform.service;
 package com.management.platform.service;
 
 
-import com.management.platform.entity.Product;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.management.platform.entity.Product;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.HttpRespMsg;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
-import java.lang.reflect.InvocationTargetException;
+import javax.servlet.http.HttpServletRequest;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -28,4 +28,10 @@ public interface ProductService extends IService<Product> {
     HttpRespMsg recycleList(Integer pageIndex, Integer pageSize);
     HttpRespMsg recycleList(Integer pageIndex, Integer pageSize);
 
 
     HttpRespMsg attachmentList(Integer moduleId, String moduleCode);
     HttpRespMsg attachmentList(Integer moduleId, String moduleCode);
+
+    HttpRespMsg pageProductByPin(Integer companyId, String userId, String productName, String productCode, Integer productType, Integer status, String startTime, String endTime, Integer pageIndex, Integer pageSize, HttpServletRequest request);
+
+    HttpRespMsg pinProduct(Product product, HttpServletRequest request);
+
+    HttpRespMsg undoPin(Product product, HttpServletRequest request);
 }
 }

+ 8 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/SalesOrderService.java

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.HttpRespMsg;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
+import javax.servlet.http.HttpServletRequest;
+
 /**
 /**
  * <p>
  * <p>
  *  服务类
  *  服务类
@@ -32,4 +34,10 @@ public interface SalesOrderService extends IService<SalesOrder> {
     HttpRespMsg productWithOrder(Integer id);
     HttpRespMsg productWithOrder(Integer id);
 
 
     HttpRespMsg getDetail(Integer id);
     HttpRespMsg getDetail(Integer id);
+
+    HttpRespMsg pageOrderByPin(String inchargerId, Integer orderType, String orderName, String orderCode, Integer customId, String businessName, Integer receivedStatus, String startTime, String endTime, String productCode, Integer pageIndex, Integer pageSize, Integer isDelete);
+
+    HttpRespMsg pinOrder(SalesOrder order, HttpServletRequest request);
+
+    HttpRespMsg undoPin(SalesOrder order, HttpServletRequest request);
 }
 }

+ 6 - 3
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/TaskService.java

@@ -1,10 +1,7 @@
 package com.management.platform.service;
 package com.management.platform.service;
 
 
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.management.platform.entity.Task;
 import com.management.platform.entity.Task;
-import com.management.platform.entity.TaskGroup;
 import com.management.platform.entity.dto.TaskDto;
 import com.management.platform.entity.dto.TaskDto;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.HttpRespMsg;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
@@ -37,4 +34,10 @@ public interface TaskService extends IService<Task> {
     HttpRespMsg updateTaskStatus(TaskDto taskDto, HttpServletRequest request);
     HttpRespMsg updateTaskStatus(TaskDto taskDto, HttpServletRequest request);
 
 
     HttpRespMsg exportDataByTaskIds(String taskIds, HttpServletRequest request) throws Exception;
     HttpRespMsg exportDataByTaskIds(String taskIds, HttpServletRequest request) throws Exception;
+
+    HttpRespMsg pageTasksByPin(TaskDto taskDto, HttpServletRequest request);
+
+    HttpRespMsg pinTasks(Task task, HttpServletRequest request);
+
+    HttpRespMsg undoPin(Task task, HttpServletRequest request);
 }
 }

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

@@ -5,20 +5,17 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 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.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.entity.*;
 import com.management.platform.entity.*;
-import com.management.platform.entity.vo.TasKVo;
 import com.management.platform.mapper.*;
 import com.management.platform.mapper.*;
 import com.management.platform.service.ClueService;
 import com.management.platform.service.ClueService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.service.SysFunctionService;
 import com.management.platform.service.SysFunctionService;
 import com.management.platform.service.UserService;
 import com.management.platform.service.UserService;
 import com.management.platform.service.WxCorpInfoService;
 import com.management.platform.service.WxCorpInfoService;
 import com.management.platform.util.ExcelUtil;
 import com.management.platform.util.ExcelUtil;
-import com.management.platform.util.FileUtil;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.HttpRespMsg;
-import com.management.platform.util.MessageUtils;
-import org.apache.poi.ss.formula.functions.T;
 import org.apache.poi.ss.usermodel.CellType;
 import org.apache.poi.ss.usermodel.CellType;
 import org.apache.poi.xssf.usermodel.XSSFCell;
 import org.apache.poi.xssf.usermodel.XSSFCell;
 import org.apache.poi.xssf.usermodel.XSSFRow;
 import org.apache.poi.xssf.usermodel.XSSFRow;
@@ -32,23 +29,12 @@ import org.springframework.util.StringUtils;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
-import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
-import java.beans.Transient;
 import java.io.*;
 import java.io.*;
-import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Method;
-import java.math.BigDecimal;
-import java.net.URLEncoder;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.*;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -646,5 +632,61 @@ public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements Cl
 
 
     }
     }
 
 
+    @Override
+    public HttpRespMsg pageClueByPin(Clue clue, HttpServletRequest request) {
+        User user = userMapper.selectById(request.getHeader("Token"));
+        clue.setCompanyId(user.getCompanyId());
+        clue.setIsDelete(0);
+        clue.setEndTime(clue.getEndTime() + " 23:59:59");
+        clue.setPageIndex((clue.getPageIndex() - 1) * clue.getPageFrom());
+        boolean isAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看全部线索");
+        boolean isNotAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看负责部门线索");
+        List<Clue> list = new ArrayList<>();
+        int i = 0;
+        if (isAll) {
+            //查看全部线索
+            list = clueMapper.listByPin(clue);
+            i = clueMapper.getTotal(clue);
+        } else if (isNotAll) {
+            //查看负责部门线索 找出所处部门下所有的负责人
+            list = clueMapper.list1ByPin(clue, user.getId());
+            i = clueMapper.getTotal1(clue, user.getId());
+        } else {
+            // 查看负责人为 自己 和 null的数据
+            list = clueMapper.list2ByPin(clue, user.getId());
+            i = clueMapper.getTotal2(clue, user.getId());
+        }
+        HashMap<Object, Object> map = new HashMap<>();
+        map.put("data", list);
+        map.put("total", i);
+        HttpRespMsg msg = new HttpRespMsg();
+        msg.setData(map);
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg pinClue(Clue clue, HttpServletRequest request) {
+        HttpRespMsg respMsg = new HttpRespMsg();
+//        User user = userMapper.selectById(request.getHeader("Token"));
+        clueMapper.update(null,new LambdaUpdateWrapper<Clue>()
+                .set(Clue::getNeedPin,Boolean.TRUE)
+                .set(Clue::getPinTime,new Date())
+                .eq(Clue::getId,clue.getId())
+        );
+        return respMsg;
+    }
+
+    @Override
+    public HttpRespMsg undoPin(Clue clue, HttpServletRequest request) {
+        HttpRespMsg respMsg = new HttpRespMsg();
+//        User user = userMapper.selectById(request.getHeader("Token"));
+        clueMapper.update(null,new LambdaUpdateWrapper<Clue>()
+                .set(Clue::getNeedPin,Boolean.FALSE)
+                .set(Clue::getPinTime,null)
+                .eq(Clue::getId,clue.getId())
+        );
+        return respMsg;
+    }
+
 
 
 }
 }

+ 163 - 10
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ContractServiceImpl.java

@@ -1,23 +1,22 @@
 package com.management.platform.service.impl;
 package com.management.platform.service.impl;
 
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 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.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.entity.*;
 import com.management.platform.entity.*;
 import com.management.platform.entity.vo.ContractPageVO;
 import com.management.platform.entity.vo.ContractPageVO;
 import com.management.platform.entity.vo.SysRichFunction;
 import com.management.platform.entity.vo.SysRichFunction;
 import com.management.platform.mapper.*;
 import com.management.platform.mapper.*;
-import com.management.platform.service.ContractDocumentService;
-import com.management.platform.service.ContractPayCustomizedService;
 import com.management.platform.service.ContractService;
 import com.management.platform.service.ContractService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.service.ExcelExportService;
 import com.management.platform.service.ExcelExportService;
-import com.management.platform.util.*;
+import com.management.platform.util.ExcelUtil;
+import com.management.platform.util.HttpRespMsg;
+import com.management.platform.util.MessageUtils;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.ibatis.annotations.Select;
 import org.apache.poi.EncryptedDocumentException;
 import org.apache.poi.EncryptedDocumentException;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.usermodel.*;
@@ -25,7 +24,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
@@ -35,11 +33,8 @@ import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
-import java.time.ZoneId;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.*;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
 /**
 /**
@@ -1519,4 +1514,162 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
         }
         }
         return httpRespMsg;
         return httpRespMsg;
     }
     }
+
+    @Override
+    public HttpRespMsg pageContractByPin(HttpServletRequest request, Integer pageIndex, Integer pageSize, String number, String name, String typeName, Integer status, String startDate, String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId, String customerOrg, Integer finishStatus) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        try {
+            String token = request.getHeader("token");
+            User user = userMapper.selectById(token);
+            WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
+            List<SysRichFunction> functionContractList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看全部合同");
+            if(functionContractList.size() <= 0){
+                httpRespMsg.setError(MessageUtils.message("access.viewError"));
+                return httpRespMsg;
+            }
+            List<ContractType> types = contractTypeMapper.selectList(new QueryWrapper<ContractType>().eq("company_id", user.getCompanyId()));
+            if (types.size() == 0){
+                //String[] typeNames = {"买卖合同","赠与合同","租赁合同","借款合同","仓储合同","委托合同"};
+                String[] typeNames = {MessageUtils.message("contract.business"),MessageUtils.message("contract.gift"),MessageUtils.message("contract.lease"),MessageUtils.message("contract.loan"),MessageUtils.message("contract.warehousing"),MessageUtils.message("contract.entrust")};
+                for (String s : typeNames) {
+                    ContractType contractType = new ContractType();
+                    contractType.setCompanyId(user.getCompanyId());
+                    contractType.setTypeName(s);
+                    contractTypeMapper.insert(contractType);
+                }
+            }
+            Integer pageStart = null;
+            if (pageIndex!=null){
+                pageStart = (pageIndex -1) * pageSize;
+            }
+//            if (StringUtils.isNotBlank(number)){
+//                number = "%" + number + "%";
+//            }
+//            if (StringUtils.isNotBlank(name)){
+//                name = "%" + name + "%";
+//            }
+            List<Contract> contracts = contractMapper.selectContractByPin(user.getCompanyId(), pageStart, pageSize, number, name , typeName , status, startDate,endDate, paymentStartDate, paymentEndDate, secTypeId,customerOrg,finishStatus);
+            Long totalCnt = contractMapper.selectContractCnt(user.getCompanyId(), number, name, typeName, status, startDate, endDate, paymentStartDate, paymentEndDate, secTypeId,customerOrg,finishStatus);
+            for (Contract contract : contracts) {
+                if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                    contract.setCreatorName(contract.getCreatorWxCorpId());
+                }
+            }
+            //首先获取所有合同的Id
+            List<Integer> contractCollect = contracts.stream().map(c -> c.getId()).collect(Collectors.toList());
+            contractCollect.add(-1);
+            //查询所有合同的所有附件
+            List<ContractDocument> fileList = contractDocumentMapper.selectList(new QueryWrapper<ContractDocument>().in("contract_id", contractCollect).eq("is_deleted",0));
+            //获取所有附件的上传者id
+            List<String> userCollect = fileList.stream().map(c -> c.getCreatorId()).distinct().collect(Collectors.toList());
+            userCollect.add("-1");
+            List<User> userList = userMapper.selectList(new QueryWrapper<User>().in("id", userCollect));
+            for (ContractDocument contractDocument : fileList) {
+                if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                    for (User item : userList) {
+                        if (item.getId().equals(contractDocument.getCreatorId())){
+                            contractDocument.setCreatorName(item.getCorpwxUserid());
+                            break;
+                        }
+                    }
+                }
+            }
+            ArrayList<ContractPageVO> contractPageVOS = new ArrayList<>();
+            List<Map<String, Object>> contractLogs = contractLogMapper.selectMsg(user.getCompanyId());
+            List<ContractCustom> customList = contractCustomMapper.selectList(new QueryWrapper<ContractCustom>().in("contract_id", contractCollect));
+            List<ContractTypeSec> secTypeList = contractTypeSecMapper.selectList(new QueryWrapper<ContractTypeSec>().eq("company_id", user.getCompanyId()));
+            for (Contract contract : contracts) {
+                ContractPageVO contractPageVO = new ContractPageVO();
+                List<ContractDocument> files = new ArrayList<>();
+                contractPageVO.setId(contract.getId());
+                contractPageVO.setCompanyId(contract.getCompanyId());
+                contractPageVO.setCreatorId(contract.getCreatorId());
+                contractPageVO.setCreatorName(contract.getCreatorName());
+                contractPageVO.setCreatorWxCorpId(contract.getCreatorWxCorpId());
+                contractPageVO.setStartDate(contract.getStartDate());
+                contractPageVO.setEndDate(contract.getEndDate());
+                contractPageVO.setIndate(contract.getIndate());
+                contractPageVO.setNumber(contract.getNumber());
+                contractPageVO.setName(contract.getName());
+                contractPageVO.setStatus(contract.getStatus());
+                contractPageVO.setTypeId(contract.getTypeId());
+                contractPageVO.setTypeName(contract.getTypeName());
+                contractPageVO.setSecTypeId(contract.getSecTypeId());
+                contractPageVO.setSecTypeName(contract.getSecTypeName());
+                contractPageVO.setCheckerId(contract.getCheckerId());
+                contractPageVO.setRemarks(contract.getRemarks());
+                contractPageVO.setAmounts(contract.getAmounts());
+                contractPageVO.setProjectId(contract.getProjectId());
+                contractPageVO.setPayment(contract.getPayment());
+                contractPageVO.setNextPaymentDate(contract.getNextPaymentDate());
+                contractPageVO.setNextPaymentAmount(contract.getNextPaymentAmount());
+                contractPageVO.setPlate1(contract.getPlate1());
+                contractPageVO.setPlate2(contract.getPlate2());
+                contractPageVO.setPlate3(contract.getPlate3());
+                contractPageVO.setPlate4(contract.getPlate4());
+                contractPageVO.setPlate5(contract.getPlate5());
+                contractPageVO.setNeedPin(contract.getNeedPin());
+                contractPageVO.setPinTime(contract.getPinTime());
+                if (contract.getStatus().equals(2)){
+                    for (Map<String, Object> contractLog : contractLogs) {
+                        if (contractLog.get("contractId").toString().equals(contract.getId().toString())){
+                            String msg = "";
+                            if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                                msg = "$userName=" + contractLog.get("operateCorpWxId") + "$" + contractLog.get("msg");
+                            }else {
+                                msg = contractLog.get("operateName") + "" + contractLog.get("msg");
+                            }
+                            contractPageVO.setMsg(msg);
+                        }
+                    }
+                }
+                for (ContractDocument contractDocument : fileList) {
+                    if (contract.getId().equals(contractDocument.getContractId())){
+                        files.add(contractDocument);
+                    }
+                }
+                contractPageVO.setFiles(files);
+                for (ContractCustom custom : customList) {
+                    if (contract.getId().equals(custom.getContractId())){
+                        contractPageVO.setCustomData(custom);
+                    }
+                }
+                contractPageVOS.add(contractPageVO);
+            }
+            HashMap<String, Object> map = new HashMap<>();
+            map.put("data",contractPageVOS);
+            map.put("total",totalCnt);
+            httpRespMsg.data = map;
+            return httpRespMsg;
+        }catch (NullPointerException e) {
+            //httpRespMsg.setError("验证失败");
+            System.err.println(e);
+            httpRespMsg.setError(MessageUtils.message("access.verificationError"));
+            return httpRespMsg;
+        }
+    }
+
+    @Override
+    public HttpRespMsg pinContract(Contract contract, HttpServletRequest request) {
+        HttpRespMsg respMsg = new HttpRespMsg();
+//        User user = userMapper.selectById(request.getHeader("Token"));
+        contractMapper.update(null,new LambdaUpdateWrapper<Contract>()
+                .set(Contract::getNeedPin,Boolean.TRUE)
+                .set(Contract::getPinTime,new Date())
+                .eq(Contract::getId,contract.getId())
+        );
+        return respMsg;
+    }
+
+    @Override
+    public HttpRespMsg undoPin(Contract contract, HttpServletRequest request) {
+        HttpRespMsg respMsg = new HttpRespMsg();
+//        User user = userMapper.selectById(request.getHeader("Token"));
+        contractMapper.update(null,new LambdaUpdateWrapper<Contract>()
+                .set(Contract::getNeedPin,Boolean.FALSE)
+                .set(Contract::getPinTime,null)
+                .eq(Contract::getId,contract.getId())
+        );
+        return respMsg;
+    }
 }
 }

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

@@ -3,7 +3,6 @@ package com.management.platform.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.entity.Information;
 import com.management.platform.entity.Information;
-import com.management.platform.entity.TaskComment;
 import com.management.platform.entity.User;
 import com.management.platform.entity.User;
 import com.management.platform.entity.WxCorpInfo;
 import com.management.platform.entity.WxCorpInfo;
 import com.management.platform.mapper.InformationMapper;
 import com.management.platform.mapper.InformationMapper;

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

@@ -4,22 +4,18 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.entity.*;
 import com.management.platform.entity.*;
 import com.management.platform.mapper.*;
 import com.management.platform.mapper.*;
 import com.management.platform.service.ProductService;
 import com.management.platform.service.ProductService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.service.SysFunctionService;
 import com.management.platform.service.SysFunctionService;
 import com.management.platform.service.WxCorpInfoService;
 import com.management.platform.service.WxCorpInfoService;
 import com.management.platform.util.ExcelUtil;
 import com.management.platform.util.ExcelUtil;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.HttpRespMsg;
-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.ss.usermodel.CellType;
-import org.apache.poi.xssf.streaming.SXSSFWorkbook;
 import org.apache.poi.xssf.usermodel.XSSFCell;
 import org.apache.poi.xssf.usermodel.XSSFCell;
 import org.apache.poi.xssf.usermodel.XSSFRow;
 import org.apache.poi.xssf.usermodel.XSSFRow;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
@@ -27,7 +23,6 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 import org.springframework.util.StringUtils;
-import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
@@ -36,14 +31,12 @@ import java.io.*;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Method;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
-import java.time.DateTimeException;
 import java.time.LocalDate;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.LocalTime;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
-import java.util.zip.DataFormatException;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -628,4 +621,127 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
         msg.setData(attachmentCenterList);
         msg.setData(attachmentCenterList);
         return msg;
         return msg;
     }
     }
+
+    @Override
+    public HttpRespMsg pageProductByPin(Integer companyId, String userId, String productName, String productCode, Integer productType
+            , Integer status, String startTime, String endTime, Integer pageIndex, Integer pageSize, HttpServletRequest request) {
+        HttpRespMsg msg=new HttpRespMsg();
+        User targetUsr = userMapper.selectById(request.getHeader("token"));
+        List<Department> departments = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, companyId));
+        LambdaQueryWrapper<Product> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(Product::getCompanyId,companyId);
+        queryWrapper.eq(Product::getIsDelete,0);
+        List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getCompanyId, companyId));
+        List<SysDict> sysDictOfProductType = sysDictMapper.selectList(new LambdaQueryWrapper<SysDict>().eq(SysDict::getCompanyId, companyId).eq(SysDict::getCode, "ProductType"));
+        List<SysDict> sysDictOfProductUnit = sysDictMapper.selectList(new LambdaQueryWrapper<SysDict>().eq(SysDict::getCompanyId, companyId).eq(SysDict::getCode, "ProductUnit"));
+        boolean hasPriviledgeAll = sysFunctionService.hasPriviledge(targetUsr.getRoleId(), "查看全部产品数据");
+        boolean hasPriviledgeDept = sysFunctionService.hasPriviledge(targetUsr.getRoleId(), "查看负责部门产品数据");
+        //判断查看全部的权限
+        if(!hasPriviledgeAll){
+            //判断查看负责部门的权限
+            if(!hasPriviledgeDept){
+                //都没有就只能看自己创建的或者负责的
+                queryWrapper.and(wrapper->wrapper.eq(Product::getCreatorId,targetUsr.getId()).or().eq(Product::getInchargerId,targetUsr.getId()));
+            }else {
+                List<Department> departmentList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getManagerId, targetUsr.getId()));
+                List<DepartmentOtherManager> otherManagerList = departmentOtherManagerMapper.selectList(new LambdaQueryWrapper<DepartmentOtherManager>().eq(DepartmentOtherManager::getOtherManagerId, targetUsr.getId()));
+                List<Integer> deptIds=new ArrayList<>();
+                deptIds.add(-1);
+                List<Integer> managerDeptIds = departmentList.stream().map(Department::getDepartmentId).distinct().collect(Collectors.toList());
+                List<Integer> otherManagerDeptIds = otherManagerList.stream().map(DepartmentOtherManager::getDepartmentId).distinct().collect(Collectors.toList());
+                deptIds.addAll(managerDeptIds);
+                List<Integer> finalDeptIds1 = deptIds;
+                managerDeptIds.forEach(m->{
+                    List<Integer> branchDepartment = getBranchDepartment(m, departments);
+                    finalDeptIds1.addAll(branchDepartment);
+                });
+                deptIds.addAll(otherManagerDeptIds);
+                List<Integer> finalDeptIds = deptIds;
+                otherManagerDeptIds.forEach(o->{
+                    List<Integer> branchDepartment = getBranchDepartment(o, departments);
+                    finalDeptIds.addAll(branchDepartment);
+                });
+                deptIds=deptIds.stream().distinct().collect(Collectors.toList());
+                List<Integer> finalDeptIds2 = deptIds;
+                List<String> userIds = userList.stream().filter(u -> finalDeptIds2.contains(u.getDepartmentId())).map(User::getId).collect(Collectors.toList());
+                userIds.add(targetUsr.getId());
+                queryWrapper.and(wrapper->wrapper.in(Product::getCreatorId,userIds).or().in(Product::getInchargerId,userIds));
+            }
+        }
+        if(!StringUtils.isEmpty(userId)){
+            queryWrapper.eq(Product::getInchargerId,userId);
+        }
+        if(!StringUtils.isEmpty(productName)){
+            queryWrapper.like(Product::getProductName,productName);
+        }
+        if(!StringUtils.isEmpty(productCode)){
+            queryWrapper.like(Product::getProductCode,productCode);
+        }
+        if(productType!=null){
+            queryWrapper.eq(Product::getType,productType);
+        }
+        if(status!=null){
+            queryWrapper.eq(Product::getStatus,status);
+        }
+        if(startTime!=null && endTime!=null){
+            DateTimeFormatter df=DateTimeFormatter.ofPattern("yyyy-MM-dd");
+            LocalDateTime start = LocalDate.parse(startTime, df).atTime(LocalTime.MIN);
+            LocalDateTime end = LocalDate.parse(endTime, df).atTime(LocalTime.MAX);
+            queryWrapper.between(Product::getCreateTime,start,end);
+        }
+        if(pageIndex==null&&pageSize==null){
+            pageIndex=-1;
+            pageSize=-1;
+        }
+        queryWrapper.orderByDesc(Product::getNeedPin).orderByDesc(Product::getPinTime).orderByDesc(Product::getCreateTime);
+        IPage<Product> productIPage = productMapper.selectPage(new Page<>(pageIndex, pageSize,true), queryWrapper);
+        List<Product> records = productIPage.getRecords();
+        records.forEach(r->{
+            Optional<User> user = userList.stream().filter(u -> u.getId().equals(r.getInchargerId())).findFirst();
+            if(user.isPresent()){
+                r.setInchargerName(user.get().getName());
+            }
+            Optional<User> creator = userList.stream().filter(u -> u.getId().equals(r.getCreatorId())).findFirst();
+            if(creator.isPresent()){
+                r.setCreatorName(creator.get().getName());
+            }
+            Optional<SysDict> unit = sysDictOfProductUnit.stream().filter(u -> u.getId().equals(r.getUnit())).findFirst();
+            if(unit.isPresent()){
+                r.setUnitName(unit.get().getName());
+            }
+            Optional<SysDict> type = sysDictOfProductType.stream().filter(u -> u.getId().equals(r.getType())).findFirst();
+            if(type.isPresent()){
+                r.setTypeName(type.get().getName());
+            }
+        });
+        Map map=new HashMap();
+        map.put("record",records);
+        map.put("total",productIPage.getTotal());
+        msg.setData(map);
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg pinProduct(Product product, HttpServletRequest request) {
+        HttpRespMsg respMsg = new HttpRespMsg();
+//        User user = userMapper.selectById(request.getHeader("Token"));
+        productMapper.update(null,new LambdaUpdateWrapper<Product>()
+                .set(Product::getNeedPin,Boolean.TRUE)
+                .set(Product::getPinTime,new Date())
+                .eq(Product::getId,product.getId())
+        );
+        return respMsg;
+    }
+
+    @Override
+    public HttpRespMsg undoPin(Product product, HttpServletRequest request) {
+        HttpRespMsg respMsg = new HttpRespMsg();
+//        User user = userMapper.selectById(request.getHeader("Token"));
+        productMapper.update(null,new LambdaUpdateWrapper<Product>()
+                .set(Product::getNeedPin,Boolean.FALSE)
+                .set(Product::getPinTime,null)
+                .eq(Product::getId,product.getId())
+        );
+        return respMsg;
+    }
 }
 }

+ 176 - 10
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/SalesOrderServiceImpl.java

@@ -4,18 +4,15 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.entity.*;
 import com.management.platform.entity.*;
 import com.management.platform.mapper.*;
 import com.management.platform.mapper.*;
 import com.management.platform.service.*;
 import com.management.platform.service.*;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.util.ExcelUtil;
 import com.management.platform.util.ExcelUtil;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.HttpRespMsg;
-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.ss.usermodel.CellType;
 import org.apache.poi.xssf.usermodel.XSSFCell;
 import org.apache.poi.xssf.usermodel.XSSFCell;
 import org.apache.poi.xssf.usermodel.XSSFRow;
 import org.apache.poi.xssf.usermodel.XSSFRow;
@@ -25,11 +22,9 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 import org.springframework.util.StringUtils;
-import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
-import javax.print.DocFlavor;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import java.io.*;
 import java.io.*;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.InvocationTargetException;
@@ -37,7 +32,6 @@ import java.lang.reflect.Method;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.math.RoundingMode;
 import java.text.NumberFormat;
 import java.text.NumberFormat;
-import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
 import java.time.Year;
 import java.time.Year;
@@ -46,8 +40,6 @@ import java.time.temporal.TemporalAdjusters;
 import java.util.*;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
-import static java.text.NumberFormat.getPercentInstance;
-
 /**
 /**
  * <p>
  * <p>
  *  服务实现类
  *  服务实现类
@@ -291,6 +283,180 @@ public class SalesOrderServiceImpl extends ServiceImpl<SalesOrderMapper, SalesOr
         return msg;
         return msg;
     }
     }
 
 
+    @Override
+    public HttpRespMsg pageOrderByPin(String inchargerId, Integer orderType, String orderName, String orderCode, Integer customId, String businessName, Integer receivedStatus, String startTime, String endTime, String productCode, Integer pageIndex, Integer pageSize, Integer isDelete) {
+        HttpRespMsg msg=new HttpRespMsg();
+        User user = userMapper.selectById(request.getHeader("token"));
+        List<Department> departments = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, user.getCompanyId()));
+        boolean viewAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看全部订单");
+        boolean viewDept = sysFunctionService.hasPriviledge(user.getRoleId(), "查看负责部门订单");
+        List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getCompanyId, user.getCompanyId()));
+        List<SysDict> sysDictOfOrderType = sysDictMapper.selectList(new LambdaQueryWrapper<SysDict>().eq(SysDict::getCompanyId, user.getCompanyId()).eq(SysDict::getCode, "OrderType"));
+        LambdaQueryWrapper<SalesOrder> orderLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        List<Custom> customList = customService.list(new LambdaQueryWrapper<Custom>().eq(Custom::getCompanyId, user.getCompanyId()));
+        List<BusinessOpportunity> businessOpportunityList = businessOpportunityService.list(new LambdaQueryWrapper<BusinessOpportunity>().eq(BusinessOpportunity::getCompanyId, user.getCompanyId()));
+        orderLambdaQueryWrapper.eq(SalesOrder::getCompanyId,user.getCompanyId());
+        if(isDelete!=null){
+            orderLambdaQueryWrapper.eq(SalesOrder::getIsDelete,isDelete);
+        }else {
+            orderLambdaQueryWrapper.eq(SalesOrder::getIsDelete,0);
+        }
+        orderLambdaQueryWrapper.eq(SalesOrder::getStatus,1);
+        //判断查看全部的权限
+        if(!viewAll){
+            //判断查看负责部门的权限
+            if(!viewDept){
+                //都没有就只能看自己创建的或者负责的
+                orderLambdaQueryWrapper.and(wrapper->wrapper.eq(SalesOrder::getCreatorId,user.getId()).or().eq(SalesOrder::getInchargerId,user.getId()));
+            }else {
+                List<Department> departmentList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getManagerId, user.getId()));
+                List<DepartmentOtherManager> otherManagerList = departmentOtherManagerMapper.selectList(new LambdaQueryWrapper<DepartmentOtherManager>().eq(DepartmentOtherManager::getOtherManagerId, user.getId()));
+                List<Integer> deptIds=new ArrayList<>();
+                deptIds.add(-1);
+                List<Integer> managerDeptIds = departmentList.stream().map(Department::getDepartmentId).distinct().collect(Collectors.toList());
+                List<Integer> otherManagerDeptIds = otherManagerList.stream().map(DepartmentOtherManager::getDepartmentId).distinct().collect(Collectors.toList());
+                deptIds.addAll(managerDeptIds);
+                List<Integer> finalDeptIds1 = deptIds;
+                managerDeptIds.forEach(m->{
+                    List<Integer> branchDepartment = getBranchDepartment(m, departments);
+                    finalDeptIds1.addAll(branchDepartment);
+                });
+                deptIds.addAll(otherManagerDeptIds);
+                List<Integer> finalDeptIds = deptIds;
+                otherManagerDeptIds.forEach(o->{
+                    List<Integer> branchDepartment = getBranchDepartment(o, departments);
+                    finalDeptIds.addAll(branchDepartment);
+                });
+                deptIds=deptIds.stream().distinct().collect(Collectors.toList());
+                List<Integer> finalDeptIds2 = deptIds;
+                List<String> userIds = userList.stream().filter(u -> finalDeptIds2.contains(u.getDepartmentId())).map(User::getId).collect(Collectors.toList());
+                //加上本人
+                userIds.add(user.getId());
+                orderLambdaQueryWrapper.and(wrapper->wrapper.in(SalesOrder::getCreatorId,userIds).or().in(SalesOrder::getInchargerId,userIds));
+            }
+        }
+        if (!StringUtils.isEmpty(inchargerId)){
+            orderLambdaQueryWrapper.eq(SalesOrder::getInchargerId,inchargerId);
+        }
+        if(orderType!=null){
+            orderLambdaQueryWrapper.eq(SalesOrder::getType,orderType);
+        }
+        if(customId!=null){
+            orderLambdaQueryWrapper.eq(SalesOrder::getCustomId,customId);
+        }
+        if(!StringUtils.isEmpty(businessName)){
+            orderLambdaQueryWrapper.inSql(SalesOrder::getBusinessOpportunityId,"select id from business_opportunity where name like '%"+businessName+"%'");
+        }
+        if(receivedStatus!=null){
+//            if(receivedStatus==1){
+//                //回款金额不为空 切大于0 作为已回款状态
+//                orderLambdaQueryWrapper.and(wrapper->wrapper.isNotNull(SalesOrder::getReceivedPayment).gt(SalesOrder::getReceivedPayment,0));
+//            }else {
+//                //回款金额为空 或者等于0 作为未回款状态
+//                orderLambdaQueryWrapper.and(wrapper->wrapper.isNull(SalesOrder::getReceivedPayment).or().eq(SalesOrder::getReceivedPayment,0));
+//            }
+            orderLambdaQueryWrapper.eq(SalesOrder::getReceivedStatus,receivedStatus);
+        }
+        if(!StringUtils.isEmpty(startTime)&&!StringUtils.isEmpty(endTime)){
+//            orderLambdaQueryWrapper.lt(SalesOrder::getOrderStartDate,endTime).gt(SalesOrder::getOrderEndDate,startTime);
+            orderLambdaQueryWrapper.between(SalesOrder::getPlaceTime,startTime,endTime);
+        }
+        if(!StringUtils.isEmpty(orderName)){
+            orderLambdaQueryWrapper.like(SalesOrder::getOrderName,orderName);
+        }
+        if(!StringUtils.isEmpty(orderCode)){
+            orderLambdaQueryWrapper.like(SalesOrder::getOrderCode,orderCode);
+        }
+        if(!StringUtils.isEmpty(productCode)){
+            orderLambdaQueryWrapper.inSql(SalesOrder::getId,
+                    "select o.order_id from order_product_detail o left join product p on o.product_id=p.id " +
+                            "where p.company_id="+user.getCompanyId()+" and p.product_code like '%"+productCode+"%'");
+        }
+        if(pageIndex==null||pageSize==null){
+            pageIndex=-1;
+            pageSize=-1;
+        }
+        if(isDelete!=null){
+            orderLambdaQueryWrapper.eq(SalesOrder::getIsDelete,isDelete);
+            orderLambdaQueryWrapper
+                    .orderByDesc(SalesOrder::getNeedPin)
+                    .orderByDesc(SalesOrder::getPinTime)
+                    .orderByDesc(SalesOrder::getUpdateTime);
+        }else {
+            orderLambdaQueryWrapper.eq(SalesOrder::getIsDelete,0);
+            orderLambdaQueryWrapper
+                    .orderByDesc(SalesOrder::getNeedPin)
+                    .orderByDesc(SalesOrder::getPinTime)
+                    .orderByDesc(SalesOrder::getCreateTime);
+        }
+        IPage<SalesOrder> orderIPage = salesOrderMapper.selectPage(new Page<>(pageIndex, pageSize), orderLambdaQueryWrapper);
+        List<SalesOrder> records = orderIPage.getRecords();
+        List<Integer> orderIds = records.stream().map(SalesOrder::getId).distinct().collect(Collectors.toList());
+        orderIds.add(-1);
+        List<OrderProductDetail> orderProductDetails = orderProductDetailService.list(new LambdaQueryWrapper<OrderProductDetail>().in(OrderProductDetail::getOrderId, orderIds));
+        records.forEach(r->{
+            Optional<User> item = userList.stream().filter(u -> u.getId().equals(r.getCreatorId())).findFirst();
+            if(item.isPresent()){
+                r.setCreatorName(item.get().getName());
+            }
+            Optional<User> incharger = userList.stream().filter(u -> u.getId().equals(r.getInchargerId())).findFirst();
+            if(incharger.isPresent()){
+                r.setInchargerName(incharger.get().getName());
+            }
+            Optional<User> companySigner = userList.stream().filter(u -> u.getId().equals(r.getCompanySigner())).findFirst();
+            if(companySigner.isPresent()){
+                r.setCompanySignerName(companySigner.get().getName());
+            }
+            Optional<User> customSigner = userList.stream().filter(u -> u.getId().equals(r.getCustomSigner())).findFirst();
+            if(customSigner.isPresent()){
+                r.setCustomSignerName(customSigner.get().getName());
+            }
+            Optional<SysDict> type = sysDictOfOrderType.stream().filter(s -> s.getId().equals(r.getType())).findFirst();
+            if(type.isPresent()){
+                r.setTypeName(type.get().getName());
+            }
+            Optional<Custom> custom = customList.stream().filter(c -> c.getId().equals(r.getCustomId())).findFirst();
+            if(custom.isPresent()){
+                r.setCustomName(custom.get().getCustomName());
+            }
+            Optional<BusinessOpportunity> businessOpportunity = businessOpportunityList.stream().filter(b -> r.getBusinessOpportunityId() != null && b.getId().equals(r.getBusinessOpportunityId())).findFirst();
+            if(businessOpportunity.isPresent()){
+                r.setBusinessOpportunityName(businessOpportunity.get().getName());
+            }
+            List<OrderProductDetail> details = orderProductDetails.stream().filter(o -> o.getOrderId().equals(r.getId())).collect(Collectors.toList());
+            r.setOrderProductDetailList(details);
+        });
+        Map map=new HashMap();
+        map.put("record",records);
+        map.put("total",orderIPage.getTotal());
+        msg.setData(map);
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg pinOrder(SalesOrder order, HttpServletRequest request) {
+        HttpRespMsg respMsg = new HttpRespMsg();
+//        User user = userMapper.selectById(request.getHeader("Token"));
+        salesOrderMapper.update(null,new LambdaUpdateWrapper<SalesOrder>()
+                .set(SalesOrder::getNeedPin,Boolean.TRUE)
+                .set(SalesOrder::getPinTime,new Date())
+                .eq(SalesOrder::getId,order.getId())
+        );
+        return respMsg;
+    }
+
+    @Override
+    public HttpRespMsg undoPin(SalesOrder order, HttpServletRequest request) {
+        HttpRespMsg respMsg = new HttpRespMsg();
+//        User user = userMapper.selectById(request.getHeader("Token"));
+        salesOrderMapper.update(null,new LambdaUpdateWrapper<SalesOrder>()
+                .set(SalesOrder::getNeedPin,Boolean.FALSE)
+                .set(SalesOrder::getPinTime,null)
+                .eq(SalesOrder::getId,order.getId())
+        );
+        return respMsg;
+    }
+
     @Override
     @Override
     @Transactional
     @Transactional
     public HttpRespMsg importData(MultipartFile multipartFile) {
     public HttpRespMsg importData(MultipartFile multipartFile) {

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

@@ -15,7 +15,6 @@ import com.management.platform.service.*;
 import com.management.platform.util.ExcelUtil;
 import com.management.platform.util.ExcelUtil;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.HttpRespMsg;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.hssf.usermodel.*;
 import org.apache.poi.ss.usermodel.CellType;
 import org.apache.poi.ss.usermodel.CellType;
 import org.apache.poi.xssf.usermodel.XSSFCell;
 import org.apache.poi.xssf.usermodel.XSSFCell;
 import org.apache.poi.xssf.usermodel.XSSFRow;
 import org.apache.poi.xssf.usermodel.XSSFRow;
@@ -33,7 +32,6 @@ import javax.servlet.http.HttpServletRequest;
 import java.io.*;
 import java.io.*;
 import java.lang.reflect.Field;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.Method;
-import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatter;
@@ -1216,6 +1214,83 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
 
 
     }
     }
 
 
+    @Override
+    public HttpRespMsg pageTasksByPin(TaskDto taskDto, HttpServletRequest request) {
+        String token = String.valueOf(request.getHeader("Token"));
+        User user = userMapper.selectById(token);
+        taskDto.setCompanyId(user.getCompanyId());
+        List<TaskExecutor> taskExecutorList = taskExecutorMapper.selectList(new LambdaQueryWrapper<TaskExecutor>().eq(TaskExecutor::getCompanyId,user.getCompanyId()));
+        List<TaskLog> taskLogList = taskLogMapper.selectList(new LambdaQueryWrapper<TaskLog>().eq(TaskLog::getCompanyId,user.getCompanyId()).orderByDesc(TaskLog::getModTime));
+        taskDto.setPageIndex((taskDto.getPageIndex()-1)*taskDto.getPageSize());
+
+        boolean isAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看全部任务");
+        boolean isNotAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看负责部门任务");
+
+        if (isAll){
+            System.out.println("do nothing");
+        }else if (isNotAll){
+            Integer departmentId = user.getDepartmentId();//找出对应的部门id
+            taskDto.setDepartmentId(departmentId);
+        }else {
+            //查看负责人为自己和null的数据
+            taskDto.setDepartmentIdByMyselfOrNull(user.getId());
+
+        }
+
+        List<TasKVo> taskVoList =taskMapper.getPageListTaskByPin(taskDto);
+        for (TasKVo tasKVo : taskVoList) {
+            if (!taskExecutorList.isEmpty()){
+                List<TaskExecutor> collect = taskExecutorList.stream().
+                        filter(taskExecutor -> taskExecutor.getTaskId().equals(tasKVo.getId())).
+                        filter(taskExecutor -> taskExecutor.getCompanyId().equals(user.getCompanyId()))
+                        .collect(Collectors.toList());
+                if (!collect.isEmpty()){
+                    List<String> collect1 = collect.stream().map(TaskExecutor::getExecutorName).collect(Collectors.toList());
+                    tasKVo.setTaskExecutors(collect1);
+                }
+            }
+            if (!taskLogList.isEmpty()){
+                List<TaskLog> collect = taskLogList.stream().filter(taskLog -> taskLog.getTaskId().equals(tasKVo.getId()))
+                        .filter(taskLog -> taskLog.getCompanyId().equals(user.getCompanyId())).collect(Collectors.toList());
+                if (!collect.isEmpty()){
+                    tasKVo.setTaskLogs(collect);
+                }
+            }
+
+        }
+        List<TasKVo> taskVoTotalList= taskMapper.getPageListTotalTask(taskDto);
+        HttpRespMsg msg = new HttpRespMsg();
+        HashMap<String, Object> map = new HashMap<>();
+        map.put("record",taskVoList);
+        map.put("total",taskVoTotalList.size());
+        msg.setData(map);
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg pinTasks(Task task, HttpServletRequest request) {
+        HttpRespMsg respMsg = new HttpRespMsg();
+//        User user = userMapper.selectById(request.getHeader("Token"));
+        taskMapper.update(null,new LambdaUpdateWrapper<Task>()
+                .set(Task::getNeedPin,Boolean.TRUE)
+                .set(Task::getPinTime,new Date())
+                .eq(Task::getId,task.getId())
+        );
+        return respMsg;
+    }
+
+    @Override
+    public HttpRespMsg undoPin(Task task, HttpServletRequest request) {
+        HttpRespMsg respMsg = new HttpRespMsg();
+//        User user = userMapper.selectById(request.getHeader("Token"));
+        taskMapper.update(null,new LambdaUpdateWrapper<Task>()
+                .set(Task::getNeedPin,Boolean.FALSE)
+                .set(Task::getPinTime,null)
+                .eq(Task::getId,task.getId())
+        );
+        return respMsg;
+    }
+
     public void updateTaskRepeatConfigure(Task task){
     public void updateTaskRepeatConfigure(Task task){
         task.setRepeatType(null).setRepeatEndNever(null).setRepeatEndCount(null)
         task.setRepeatType(null).setRepeatEndNever(null).setRepeatEndCount(null)
                 .setRepeatEndDate(null).setRepeatDesignDay(null).setRepeatDesignSameday(null)
                 .setRepeatEndDate(null).setRepeatDesignDay(null).setRepeatDesignSameday(null)

+ 3 - 3
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/BusinessOpportunityMapper.xml

@@ -342,7 +342,7 @@
         <if test="productId != null ">
         <if test="productId != null ">
             and id in (select business_id from business_item_product where product_id = #{productId})
             and id in (select business_id from business_item_product where product_id = #{productId})
         </if>
         </if>
-        ORDER BY need_pin desc,pin_time desc
+        ORDER BY need_pin desc,pin_time desc,id DESC
         <if test="pageIndex!=null and pageFrom !=null">
         <if test="pageIndex!=null and pageFrom !=null">
             limit #{pageIndex},#{pageFrom}
             limit #{pageIndex},#{pageFrom}
         </if>
         </if>
@@ -383,7 +383,7 @@
         <if test="bo.productId != null ">
         <if test="bo.productId != null ">
             and id in (select business_id from business_item_product where product_id = #{bo.productId})
             and id in (select business_id from business_item_product where product_id = #{bo.productId})
         </if>
         </if>
-        ORDER BY need_pin desc,pin_time desc
+        ORDER BY need_pin desc,pin_time desc,id DESC
         <if test="bo.pageIndex!=null and bo.pageFrom !=null">
         <if test="bo.pageIndex!=null and bo.pageFrom !=null">
             limit #{bo.pageIndex},#{bo.pageFrom}
             limit #{bo.pageIndex},#{bo.pageFrom}
         </if>
         </if>
@@ -421,7 +421,7 @@
         <if test="bo.productId != null ">
         <if test="bo.productId != null ">
             and id in (select business_id from business_item_product where product_id =#{bo.productId})
             and id in (select business_id from business_item_product where product_id =#{bo.productId})
         </if>
         </if>
-        ORDER BY need_pin desc,pin_time desc
+        ORDER BY need_pin desc,pin_time desc,id DESC
         <if test="bo.pageIndex!=null and bo.pageFrom !=null">
         <if test="bo.pageIndex!=null and bo.pageFrom !=null">
             limit #{bo.pageIndex},#{bo.pageFrom}
             limit #{bo.pageIndex},#{bo.pageFrom}
         </if>
         </if>

+ 217 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ClueMapper.xml

@@ -388,5 +388,222 @@
             c.company_id = #{companyId} and c.is_delete = #{isDelete}
             c.company_id = #{companyId} and c.is_delete = #{isDelete}
           and (c.incharger_id = #{userId} or c.incharger_id is null)
           and (c.incharger_id = #{userId} or c.incharger_id is null)
     </select>
     </select>
+    <select id="listByPin" resultType="com.management.platform.entity.Clue">
+        select c.id,
+        c.company_id,
+        c.clue_name,
+        c.clue_source_id,
+        c.phone,
+        c.email,
+        c.customer_industry_id,
+        c.customer_level_id,
+        c.address,
+        c.incharger_id,
+        c.remark,
+        c.is_delete,
+        c.plate1,
+        c.plate2,
+        c.plate3,
+        c.plate4,
+        c.plate5,
+        c.create_time,
+        c.create_id,
+        (select company_name from company where c.company_id = id) companyName,
+        (select name from `user` where id = c.incharger_id) inchargerName,
+        (select name from `user` where id = c.create_id) createName,
+        (select name from sys_dict where c.clue_source_id = id and code = 'ClueSources') clueSourceValue,
+        (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} and c.is_bo = 0
+        <if test="inchargerId != null and inchargerId != ''  ">
+            and c.incharger_id =#{inchargerId}
+        </if>
+        <if test="startTime != null and endTime != null ">
+            and  c.create_time BETWEEN  #{startTime} and #{endTime}
+        </if>
+        <if test="clueName != null and clueName != '' ">
+            and  c.clue_name LIKE CONCAT('%', #{clueName}, '%')
+        </if>
+        <if test="phone != null and phone != '' ">
+            and  c.phone LIKE CONCAT('%', #{phone}, '%')
+        </if>
+        <if test="customerLevelId != null and customerLevelId != '' ">
+            and  c.customer_level_id =  #{customerLevelId}
+        </if>
+        <if test="email != null and email != '' ">
+            and  c.email LIKE CONCAT('%', #{email}, '%')
+        </if>
+        <if test="clueSourceId != null">
+            and  c.clue_source_id =  #{clueSourceId}
+        </if>
+        <if test="customerIndustryId != null">
+            and  c.customer_industry_id =  #{customerIndustryId}
+        </if>
+        order by c.need_pin desc,c.pin_time desc
+        <choose>
+            <when test="isDesc == null ">
+                ,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="list1ByPin" resultType="com.management.platform.entity.Clue">
+        select c.id,
+        c.company_id,
+        (select company_name from company where company_id = c.id) companyName,
+        c.clue_name,
+        c.clue_source_id,
+        c.phone,
+        c.email,
+        c.customer_industry_id,
+        c.customer_level_id,
+        c.address,
+        c.incharger_id,
+        c.remark,
+        c.is_delete,
+        c.plate1,
+        c.plate2,
+        c.plate3,
+        c.plate4,
+        c.plate5,
+        c.create_time,
+        c.create_id,
+        (select name from `user` where id = c.incharger_id) inchargerName,
+        (select name from `user` where id = c.create_id) createName,
+        (select name from sys_dict where c.clue_source_id = id and code = 'ClueSources') clueSourceValue,
+        (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 c.is_delete = #{clue.isDelete} and c.is_bo = 0
+        and (c.incharger_id in
+        (SELECT id from `user` WHERE department_id = (SELECT department_id from `user` WHERe id = #{userId}))
+        or c.incharger_id is null)
+        <if test="clue.inchargerId != null and clue.inchargerId != ''  ">
+            and  c.incharger_id =#{clue.inchargerId}
+        </if>
+        <if test="clue.startTime != null and clue.endTime != null ">
+            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}, '%')
+        </if>
+        <if test="clue.clueSourceId != null">
+            and  c.clue_source_id =  #{clue.clueSourceId}
+        </if>
+        <if test="clue.phone != null and clue.phone != '' ">
+            and  c.phone LIKE CONCAT('%', #{clue.phone}, '%')
+        </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.customerIndustryId != null">
+            and  c.customer_industry_id =  #{clue.customerIndustryId}
+        </if>
+        order by c.need_pin desc,c.pin_time desc
+        <choose>
+            <when test="isDesc == null">
+                ,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="list2ByPin" resultType="com.management.platform.entity.Clue">
+        select c.id,
+        c.company_id,
+        (select company_name from company where c.company_id = c.id) companyName,
+        c.clue_name,
+        c.clue_source_id,
+        c.phone,
+        c.email,
+        c.customer_industry_id,
+        c.customer_level_id,
+        c.address,
+        c.incharger_id,
+        c.remark,
+        c.is_delete,
+        c.plate1,
+        c.plate2,
+        c.plate3,
+        c.plate4,
+        c.plate5,
+        c.create_time,
+        c.create_id,
+        (select name from `user` where id = c.incharger_id) inchargerName,
+        (select name from `user` where id = c.create_id) createName,
+        (select name from sys_dict where c.clue_source_id = id and code = 'ClueSources') clueSourceValue,
+        (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 c.is_delete = #{clue.isDelete} and c.is_bo = 0
+        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}
+        </if>
+        <if test="clue.startTime != null and clue.endTime != null ">
+            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}, '%')
+        </if>
+        <if test="clue.phone != null and clue.phone != '' ">
+            and  c.phone LIKE CONCAT('%', #{clue.phone}, '%')
+        </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}
+        </if>
+        <if test="clue.customerIndustryId != null">
+            and  c.customer_industry_id =  #{clue.customerIndustryId}
+        </if>
+        order by c.need_pin desc,c.pin_time desc
+        <choose>
+            <when test="clue.isDesc == null ">
+                ,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>
 
 
 </mapper>
 </mapper>

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

@@ -149,7 +149,7 @@
                 AND ( own.id=#{map.ownerIdByMyselfAndNull} or own.id is null )
                 AND ( own.id=#{map.ownerIdByMyselfAndNull} or own.id is null )
             </if>
             </if>
         </where>
         </where>
-        ORDER BY need_pin desc,pin_time desc
+        ORDER BY c.need_pin desc,c.pin_time desc ,ccreate_time desc
     </select>
     </select>
 
 
 
 

+ 46 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ContractMapper.xml

@@ -30,7 +30,7 @@
         select contract.id,contract.company_id,contract.creator_id,contract.number,contract.name,contract.amounts,contract.type_id,sys_dict.name typeName,contract.status,contract.indate,contract.remarks,
         select contract.id,contract.company_id,contract.creator_id,contract.number,contract.name,contract.amounts,contract.type_id,sys_dict.name typeName,contract.status,contract.indate,contract.remarks,
         contract.start_date as startDate,contract.end_date as endDate,contract_type_sec.sec_type_name,contract.sec_type_id,
         contract.start_date as startDate,contract.end_date as endDate,contract_type_sec.sec_type_name,contract.sec_type_id,
         user.name as creatorName,user.corpwx_userid as creatorWxCorpId, contract.project_id, contract.payment, cp.pay_date AS next_payment_date, cp.amount AS next_payment_amount,
         user.name as creatorName,user.corpwx_userid as creatorWxCorpId, contract.project_id, contract.payment, cp.pay_date AS next_payment_date, cp.amount AS next_payment_amount,
-        contract.plate1,contract.plate2,contract.plate3,contract.plate4,contract.plate5
+        contract.plate1,contract.plate2,contract.plate3,contract.plate4,contract.plate5,contract.need_pin,contract.pin_time
         from contract
         from contract
         left join sys_dict on contract.type_id = sys_dict.id
         left join sys_dict on contract.type_id = sys_dict.id
         left join contract_type_sec on contract.sec_type_id = contract_type_sec.id
         left join contract_type_sec on contract.sec_type_id = contract_type_sec.id
@@ -109,4 +109,49 @@
             and cc.customer_org like  CONCAT('%', #{customerOrg}, '%')
             and cc.customer_org like  CONCAT('%', #{customerOrg}, '%')
         </if>
         </if>
     </select>
     </select>
+    <select id="selectContractByPin" resultType="com.management.platform.entity.Contract">
+        select contract.id,contract.company_id,contract.creator_id,contract.number,contract.name,contract.amounts,contract.type_id,sys_dict.name typeName,contract.status,contract.indate,contract.remarks,
+        contract.start_date as startDate,contract.end_date as endDate,contract_type_sec.sec_type_name,contract.sec_type_id,
+        user.name as creatorName,user.corpwx_userid as creatorWxCorpId, contract.project_id, contract.payment, cp.pay_date AS next_payment_date, cp.amount AS next_payment_amount,
+        contract.plate1,contract.plate2,contract.plate3,contract.plate4,contract.plate5,contract.need_pin,contract.pin_time
+        from contract
+        left join sys_dict on contract.type_id = sys_dict.id
+        left join contract_type_sec on contract.sec_type_id = contract_type_sec.id
+        LEFT JOIN (SELECT contract_id, pay_date, amount FROM contract_payment WHERE is_payed = 0 GROUP BY contract_id) cp ON cp.contract_id=contract.id
+        left join user
+        on contract.creator_id = user.id
+        left join contract_custom cc on cc.contract_id=contract.id
+        where contract.company_id = #{companyId}
+        <if test="number!=null">
+            and number like CONCAT('%', #{number}, '%')
+        </if>
+        <if test="name!=null">
+            and contract.name like CONCAT('%', #{name}, '%')
+        </if>
+        <if test="typeName!=null">
+            and sys_dict.name = #{typeName}
+        </if>
+        <if test="secTypeId!=null">
+            and contract.sec_type_id = #{secTypeId}
+        </if>
+        <if test="status!=null">
+            and status = #{status}
+        </if>
+        <if test="startDate!=null and endDate !=null">
+            and indate between #{startDate} and #{endDate}
+        </if>
+        <if test="paymentStartDate != null and paymentEndDate != null">
+            and cp.pay_date between #{paymentStartDate} and #{paymentEndDate}
+        </if>
+        <if test="finishStatus!=null">
+            and cc.finish_status = #{finishStatus}
+        </if>
+        <if test="customerOrg!=null">
+            and cc.customer_org like  CONCAT('%', #{customerOrg}, '%')
+        </if>
+        order by contract.need_pin desc,contract.pin_time desc,contract.id desc
+        <if test="pageStart!=null and pageSize!=null">
+            limit #{pageStart},#{pageSize}
+        </if>
+    </select>
 </mapper>
 </mapper>

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

@@ -436,6 +436,20 @@
             and c.customer_industry_id = #{customerIndustryId}
             and c.customer_industry_id = #{customerIndustryId}
         </if>
         </if>
         ORDER BY c.need_pin desc,c.pin_time desc
         ORDER BY c.need_pin desc,c.pin_time desc
+        <choose>
+            <when test="isDesc == null ">
+                ,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>
         <if test="pageFrom != null ">
         <if test="pageFrom != null ">
             Limit #{pageIndex},#{pageFrom}
             Limit #{pageIndex},#{pageFrom}
         </if>
         </if>
@@ -494,6 +508,20 @@
             and c.customer_industry_id = #{customerIndustryId}
             and c.customer_industry_id = #{customerIndustryId}
         </if>
         </if>
         ORDER BY c.need_pin desc,c.pin_time desc
         ORDER BY c.need_pin desc,c.pin_time desc
+        <choose>
+            <when test="isDesc == null ">
+                ,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>
         <if test="pageFrom != null ">
         <if test="pageFrom != null ">
             Limit #{pageIndex},#{pageFrom}
             Limit #{pageIndex},#{pageFrom}
         </if>
         </if>
@@ -549,7 +577,7 @@
         <if test="customerIndustryId != null ">
         <if test="customerIndustryId != null ">
             and customer_industry_id = #{customerIndustryId}
             and customer_industry_id = #{customerIndustryId}
         </if>
         </if>
-        ORDER BY c.need_pin desc,c.pin_time desc
+        ORDER BY need_pin desc,pin_time desc.id desc
         <if test="pageFrom != null ">
         <if test="pageFrom != null ">
             Limit #{pageIndex},#{pageFrom}
             Limit #{pageIndex},#{pageFrom}
         </if>
         </if>

+ 129 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/TaskMapper.xml

@@ -91,6 +91,53 @@
         <result column="contacts_phone" property="contactsPhone"/>
         <result column="contacts_phone" property="contactsPhone"/>
     </resultMap>
     </resultMap>
 
 
+    <resultMap id="TaskPinVoMap" type="com.management.platform.entity.vo.TasKVo">
+        <id column="id" property="id" />
+        <result column="task_name" property="taskName" />
+        <result column="company_id" property="companyId" />
+        <result column="owner_id" property="ownerId" />
+        <result column="contacts_id" property="contactsId" />
+        <result column="executor_id" property="executorId" />
+        <result column="clue_id" property="clueId" />
+        <result column="custom_id" property="customId" />
+        <result column="business_opportunity_id" property="businessOpportunityId" />
+        <result column="order_id" property="orderId" />
+        <result column="product_id" property="productId" />
+        <result column="status" property="status" />
+        <result column="priority" property="priority" />
+        <result column="is_repeat" property="isRepeat" />
+        <result column="repeat_type" property="repeatType" />
+        <result column="repeat_end_never" property="repeatEndNever" />
+        <result column="repeat_end_count" property="repeatEndCount" />
+        <result column="repeat_end_date" property="repeatEndDate"  />
+        <result column="repeat_design_day" property="repeatDesignDay" />
+        <result column="repeat_design_sameday" property="repeatDesignSameday" />
+        <result column="task_desc" property="taskDesc" />
+        <result column="creater_id" property="createrId" />
+        <result column="creater_name" property="createrName" />
+        <result column="create_date" property="createDate"  />
+        <result column="end_date" property="endDate" />
+        <result column="start_date" property="startDate" />
+        <result column="finish_date" property="finishDate" />
+        <result column="is_delete" property="isDelete" />
+        <result column="task_type" property="taskType" />
+        <result column="end_type" property="endType" />
+        <result column="plate1" property="plate1" />
+        <result column="plate2" property="plate2" />
+        <result column="plate3" property="plate3" />
+        <result column="plate4" property="plate4" />
+        <result column="plate5" property="plate5" />
+        <result column="need_pin" property="needPin"></result>
+        <result column="pin_time" property="pinTime"></result>
+
+        <result column="custom_name" property="customName"/>
+        <result column="businessName" property="businessName"/>
+        <result column="order_name" property="orderName"/>
+        <result column="clue_name" property="clueName"/>
+        <result column="contacts_name" property="contactsName"/>
+        <result column="contacts_phone" property="contactsPhone"/>
+    </resultMap>
+
     <select id="getPageListTask" resultMap="TaskVoMap">
     <select id="getPageListTask" resultMap="TaskVoMap">
         select DISTINCT task.* ,
         select DISTINCT task.* ,
                custom.custom_name,
                custom.custom_name,
@@ -266,6 +313,88 @@
             #{taskId}
             #{taskId}
         </foreach>
         </foreach>
     </select>
     </select>
+    <select id="getPageListTaskByPin" resultMap="TaskPinVoMap">
+        select DISTINCT task.* ,
+        custom.custom_name,
+        business_opportunity.name businessName,
+        `sales_order`.order_name ,
+        clue.clue_name,
+        contacts.name contacts_name ,contacts.phone contacts_phone
+        from task
+        left join  custom on task.custom_id=custom.id
+        left join  business_opportunity on task.business_opportunity_id=business_opportunity.id
+        left join  `sales_order` on task.order_id=`sales_order`.id
+        left join  clue on task.clue_id=clue.id
+        left join  contacts on task.contacts_id=contacts.id
+        <if test=" executorName!= null and executorName != '' " >
+            inner join task_executor te on task.id=te.task_id
+        </if>
+        <if test=" departmentId!= null " >
+            inner join task_executor on task.id=task_executor.task_id
+        </if>
+        <if test=" departmentIdByMyselfOrNull!= null and departmentIdByMyselfOrNull != '' " >
+            inner join task_executor on task.id=task_executor.task_id
+        </if>
+        <where>
+            and 1=1 and task.is_delete=0
+
+            <if test=" taskName!= null and taskName != ''">
+                AND task.task_name LIKE CONCAT('%', #{taskName}, '%')
+            </if>
+            <if test=" priority!= null ">
+                AND task.priority =#{priority}
+            </if>
+            <if test=" customName!= null and customName != ''">
+                AND custom.custom_name LIKE CONCAT('%', #{customName}, '%')
+            </if>
+            <if test=" contactsName!= null and contactsName != ''">
+                AND contacts.name LIKE CONCAT('%', #{contactsName}, '%')
+            </if>
+            <if test=" businessName!= null and businessName != ''">
+                AND business_opportunity.name LIKE CONCAT('%', #{businessName}, '%')
+            </if>
+            <if test=" orderName!= null and orderName != ''">
+                AND `sales_order`.order_name LIKE CONCAT('%', #{orderName}, '%')
+            </if>
+            <if test=" clueName!= null and clueName != ''">
+                AND clue.clue_name LIKE CONCAT('%', #{clueName}, '%')
+            </if>
+            <if test=" phone!= null and phone != ''">
+                AND contacts.phone LIKE CONCAT('%', #{phone}, '%')
+            </if>
+            <if test=" status!= null ">
+                AND task.status = #{status}
+            </if>
+            <if test=" executorName!= null and executorName != '' ">
+                AND te.executor_name LIKE CONCAT('%', #{executorName}, '%')
+            </if>
+            <if test=" startDate!= null">
+                AND task.start_date &gt; #{startDate}
+            </if>
+            <if test=" endDate!= null">
+                AND task.end_date &lt; #{endDate}
+            </if>
+            <if test=" companyId!= null ">
+                AND task.company_id = #{companyId}
+            </if>
+            <if test=" departmentId!= null " >
+                AND task_executor.task_id in ( SELECT DISTINCT te.task_id FROM task_executor te
+                LEFT JOIN `user` u ON u.id=te.executor_id
+                where u.department_id = #{departmentId} )
+            </if>
+            <if test=" departmentIdByMyselfOrNull!= null and departmentIdByMyselfOrNull != '' " >
+                AND task_executor.task_id in ( SELECT DISTINCT te.task_id FROM task_executor te
+                where te.executor_id= #{departmentIdByMyselfOrNull } or te.executor_id is null )
+            </if>
+
+        </where>
+        order by task.need_pin desc,task.pin_time desc,task.create_date desc
+
+        <if test="pageIndex != null and pageSize != null">
+            LIMIT #{pageIndex}, #{pageSize}
+        </if>
+
+    </select>
 
 
     <update id="updateRepeatConfig">
     <update id="updateRepeatConfig">
         update task
         update task