Forráskód Böngészése

拜访计划相关接口

zhouyy 5 hónapja
szülő
commit
3364005553
17 módosított fájl, 224 hozzáadás és 71 törlés
  1. 11 5
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ContactsController.java
  2. 6 12
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/UserCommonModuleController.java
  3. 27 27
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/VisitPlanController.java
  4. 6 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/VisitPlan.java
  5. 9 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/dto/QueryVisitPlanDTO.java
  6. 9 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/vo/UserCommonModuleVO.java
  7. 33 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/vo/VisitPlanVO.java
  8. 3 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/UserCommonModuleMapper.java
  9. 9 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/VisitPlanMapper.java
  10. 2 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ContactsService.java
  11. 1 1
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/UserCommonModuleService.java
  12. 1 1
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/VisitPlanService.java
  13. 21 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ContactsServiceImpl.java
  14. 34 16
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/UserCommonModuleServiceImpl.java
  15. 12 9
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/VisitPlanServiceImpl.java
  16. 6 0
      fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/UserCommonModuleMapper.xml
  17. 34 0
      fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/VisitPlanMapper.xml

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

@@ -12,11 +12,7 @@ import com.management.platform.service.ContactsService;
 import com.management.platform.util.HttpRespMsg;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestBody;
-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.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
@@ -47,6 +43,16 @@ public class ContactsController {
     @Autowired
     private ContactsMapper contactsMapper;
 
+    /***
+     * 获取常用联系人
+     * @param request
+     * @return
+     */
+    @PostMapping("/getFrequentContacts")
+    public HttpRespMsg getFrequentContacts(HttpServletRequest request) {
+        return contactsService.getFrequentContacts(request);
+    }
+
     /**
      * 添加联系人
      * @param contacts

+ 6 - 12
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/UserCommonModuleController.java

@@ -19,23 +19,17 @@ public class UserCommonModuleController {
 
     @PostMapping("/getCommonModules")
     private HttpRespMsg getCommonModules(HttpServletRequest request) {
-        HttpRespMsg httpRespMsg = new HttpRespMsg();
-        httpRespMsg = userCommonModuleService.getCommonModules(request);
-        return httpRespMsg;
+        return userCommonModuleService.getCommonModules(request);
     }
 
-    @PostMapping("/addCommonModule")
-    private HttpRespMsg addCommonModule(@RequestParam("moduleId")Integer moduleId,HttpServletRequest request) {
-        HttpRespMsg httpRespMsg = new HttpRespMsg();
-        httpRespMsg = userCommonModuleService.addCommonModule(moduleId,request);
-        return httpRespMsg;
+    @PostMapping("/addCommonModules")
+    private HttpRespMsg addCommonModules(@RequestParam("moduleIds")String moduleIds,HttpServletRequest request) {
+        return userCommonModuleService.addCommonModules(moduleIds,request);
     }
 
     @PostMapping("/delCommonModules")
-    private HttpRespMsg delCommonModules(@RequestParam("moduleId")String moduleIds,HttpServletRequest request) {
-        HttpRespMsg httpRespMsg = new HttpRespMsg();
-        httpRespMsg = userCommonModuleService.delCommonModules(moduleIds,request);
-        return httpRespMsg;
+    private HttpRespMsg delCommonModules(@RequestParam("moduleIds")String moduleIds,HttpServletRequest request) {
+        return userCommonModuleService.delCommonModules(moduleIds,request);
     }
 
 

+ 27 - 27
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/VisitPlanController.java

@@ -2,16 +2,16 @@ package com.management.platform.controller;
 
 import com.management.platform.entity.VisitPlan;
 import com.management.platform.service.VisitPlanService;
-import com.management.platform.time.VisitPlanDelayHandler;
-import com.management.platform.time.VisitPlanDelayItem;
 import com.management.platform.util.HttpRespMsg;
 import org.springframework.format.annotation.DateTimeFormat;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.util.Date;
-import java.util.concurrent.TimeUnit;
 
 @RestController
 @RequestMapping("/visitPlan")
@@ -35,13 +35,13 @@ public class VisitPlanController {
      * @return
      */
     @PostMapping("/addVisitPlan")
-    public HttpRespMsg testTask(
+    public HttpRespMsg addVisitPlan(
             @RequestParam("planName") String planName,
             @RequestParam("customId") Integer customId,
             @RequestParam("customName") String customName,
             @RequestParam("inchargerId") String inchargerId,
             @RequestParam("visitGoal") Integer visitGoal,
-            @RequestParam("visitTime") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")Date visitTime,
+            @RequestParam("visitTime") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")Date visitTime,
             @RequestParam("remark") String remark,
             @RequestParam("remindType") Integer remindType,
             @RequestParam(value = "remindTime",required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")Date remindTime
@@ -85,7 +85,7 @@ public class VisitPlanController {
      */
     @PostMapping("/delayVisitPlan")
     public HttpRespMsg delayVisitPlan(@RequestParam("planId") Long planId
-            ,@RequestParam("visitTime") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")Date visitTime
+            ,@RequestParam("visitTime") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")Date visitTime
             , HttpServletRequest request){
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         httpRespMsg=visitPlanService.delayVisitPlan(planId,visitTime,request);
@@ -115,30 +115,30 @@ public class VisitPlanController {
      * @return
      */
     @PostMapping("/getPageVisitPlan")
-    public HttpRespMsg getPageVisitPlan(@RequestParam Integer pageIndex
-            , @RequestParam Integer pageSize
-            ,@RequestParam("calenderTime") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")Date calenderTime
+    public HttpRespMsg getPageVisitPlan(@RequestParam(value = "pageIndex",required = false) Integer pageIndex
+            , @RequestParam(value = "pageSize",required = false) Integer pageSize
+            ,@RequestParam("calenderDate")String calenderDate
             ,HttpServletRequest request){
         HttpRespMsg httpRespMsg = new HttpRespMsg();
-        httpRespMsg = visitPlanService.getPageVisitPlan(pageIndex,pageSize,calenderTime,request);
+        httpRespMsg = visitPlanService.getPageVisitPlan(pageIndex,pageSize,calenderDate,request);
         return httpRespMsg;
     }
 
 
-    @GetMapping("/getDelayQueue")
-    public HttpRespMsg getDelayQueue(HttpServletRequest request) {
-        HttpRespMsg httpRespMsg = new HttpRespMsg();
-        VisitPlanDelayHandler tool = new VisitPlanDelayHandler();
-        httpRespMsg.setData(tool.getAll());
-        Object[] all =  tool.getAll();
-        for (Object obj : all) {
-            VisitPlanDelayItem item = (VisitPlanDelayItem) obj;
-            long delay = item.getDelay(TimeUnit.SECONDS);
-            System.out.println("item== "+item.getVisitPlan().getPlanName()
-                    +",delayTime=== "+item.getDelayTime()
-            +",delay=== "+delay
-            );
-        }
-        return httpRespMsg;
-    }
+//    @GetMapping("/getDelayQueue")
+//    public HttpRespMsg getDelayQueue(HttpServletRequest request) {
+//        HttpRespMsg httpRespMsg = new HttpRespMsg();
+//        VisitPlanDelayHandler tool = new VisitPlanDelayHandler();
+//        httpRespMsg.setData(tool.getAll());
+//        Object[] all =  tool.getAll();
+//        for (Object obj : all) {
+//            VisitPlanDelayItem item = (VisitPlanDelayItem) obj;
+//            long delay = item.getDelay(TimeUnit.SECONDS);
+//            System.out.println("item== "+item.getVisitPlan().getPlanName()
+//                    +",delayTime=== "+item.getDelayTime()
+//            +",delay=== "+delay
+//            );
+//        }
+//        return httpRespMsg;
+//    }
 }

+ 6 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/VisitPlan.java

@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.util.Date;
 
@@ -35,6 +37,8 @@ public class VisitPlan extends Model<VisitPlan> {
     private Integer visitGoal;
     /**拜访时间*/
     @TableField(value = "visit_time")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
     private Date visitTime;
     /**备注*/
     @TableField(value = "remark")
@@ -44,6 +48,8 @@ public class VisitPlan extends Model<VisitPlan> {
     private Integer remindType;
     /**提醒时间[自定义时间时再填充]*/
     @TableField(value = "remind_time")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date remindTime;
 
     /**是否达到提醒时间 0未到 1已到 2不需要提醒*/

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

@@ -0,0 +1,9 @@
+package com.management.platform.entity.dto;
+
+import lombok.Data;
+
+@Data
+public class QueryVisitPlanDTO {
+    private String calenderDate;
+    private String userId;
+}

+ 9 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/vo/UserCommonModuleVO.java

@@ -0,0 +1,9 @@
+package com.management.platform.entity.vo;
+
+import lombok.Data;
+
+@Data
+public class UserCommonModuleVO {
+    private Integer moduleId;
+    private String moduleName;
+}

+ 33 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/vo/VisitPlanVO.java

@@ -0,0 +1,33 @@
+package com.management.platform.entity.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+@Data
+public class VisitPlanVO {
+    private String planName;
+    private String customName;
+    /**负责人名称(user表)*/
+    private String inchargerName;
+    /**拜访目的 字典表id*/
+    private Integer visitGoal;
+//    private String visitGoalText;
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
+    private Date visitTime;
+    /**备注*/
+    private String remark;
+    /**提醒类型 字典表id,对应字典项name类型名称 ex1时间[秒]*/
+    private Integer remindType;
+    /**提醒时间[自定义时间时再填充]*/
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date remindTime;
+    /**是否达到提醒时间 0未到 1已到 2不需要提醒*/
+    private Integer remindState;
+    /**完成状态 0未完成 1已完成*/
+    private Integer finishState;
+}

+ 3 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/UserCommonModuleMapper.java

@@ -2,10 +2,13 @@ package com.management.platform.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.management.platform.entity.UserCommonModule;
+import com.management.platform.entity.vo.UserCommonModuleVO;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
 public interface UserCommonModuleMapper extends BaseMapper<UserCommonModule> {
     void insertBatch(@Param("toAddList") List<UserCommonModule> toAddList);
+
+    List<UserCommonModuleVO> getCommonModules(@Param("userId") String userId, @Param("companyId") Integer companyId);
 }

+ 9 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/VisitPlanMapper.java

@@ -1,7 +1,16 @@
 package com.management.platform.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.management.platform.entity.VisitPlan;
+import com.management.platform.entity.dto.QueryVisitPlanDTO;
+import com.management.platform.entity.vo.VisitPlanVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface VisitPlanMapper extends BaseMapper<VisitPlan> {
+    IPage<VisitPlanVO> getPageVisitPlan(IPage<VisitPlan> page, @Param("query") QueryVisitPlanDTO query);
+
+    List<VisitPlanVO> getListVisitPlan(@Param("query")QueryVisitPlanDTO query);
 }

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

@@ -49,4 +49,6 @@ public interface ContactsService extends IService<Contacts> {
     int claimContacts(Contacts contactsGet, User user);
 
     HttpRespMsg getAll(HttpServletRequest request);
+
+    HttpRespMsg getFrequentContacts(HttpServletRequest request);
 }

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

@@ -9,7 +9,7 @@ import javax.servlet.http.HttpServletRequest;
 public interface UserCommonModuleService extends IService<UserCommonModule> {
     HttpRespMsg getCommonModules(HttpServletRequest request);
 
-    HttpRespMsg addCommonModule(Integer moduleId,HttpServletRequest request);
+    HttpRespMsg addCommonModules(String moduleIds,HttpServletRequest request);
 
     HttpRespMsg delCommonModules(String moduleIds, HttpServletRequest request);
 }

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

@@ -16,5 +16,5 @@ public interface VisitPlanService extends IService<VisitPlan> {
 
     HttpRespMsg delVisitPlan(Long planId, HttpServletRequest request);
 
-    HttpRespMsg getPageVisitPlan(Integer pageIndex, Integer pageSize, Date calenderTime, HttpServletRequest request);
+    HttpRespMsg getPageVisitPlan(Integer pageIndex, Integer pageSize, String calenderDate, HttpServletRequest request);
 }

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

@@ -822,5 +822,26 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
         return httpRespMsg;
     }
 
+    @Override
+    public HttpRespMsg getFrequentContacts(HttpServletRequest request) {
+        HttpRespMsg msg = new HttpRespMsg();
+        String token = String.valueOf(request.getHeader("Token"));
+        User user = userMapper.selectById(token);
+        if(null == user){
+            msg.setError("用户不存在");
+            return msg;
+        }
+        List<Contacts> contactsList = contactsMapper.selectList(new LambdaQueryWrapper<Contacts>()
+                .select(Contacts::getCustomId,Contacts::getName,Contacts::getPhone,Contacts::getEmail)
+                .eq(Contacts::getCreatorId, user.getId())
+                .eq(Contacts::getCompanyId, user.getCompanyId())
+                .eq(Contacts::getIsDelete, 0)
+                .eq(Contacts::getIsFrequent,1)
+                .orderByDesc(Contacts::getCreateTime)
+        );
+        msg.setData(contactsList);
+        return msg;
+    }
+
 
 }

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

@@ -7,6 +7,7 @@ import com.management.platform.entity.SysModule;
 import com.management.platform.entity.SysRoleModule;
 import com.management.platform.entity.User;
 import com.management.platform.entity.UserCommonModule;
+import com.management.platform.entity.vo.UserCommonModuleVO;
 import com.management.platform.mapper.SysModuleMapper;
 import com.management.platform.mapper.SysRoleModuleMapper;
 import com.management.platform.mapper.UserCommonModuleMapper;
@@ -14,6 +15,7 @@ import com.management.platform.mapper.UserMapper;
 import com.management.platform.service.UserCommonModuleService;
 import com.management.platform.util.HttpRespMsg;
 import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -52,9 +54,14 @@ public class UserCommonModuleServiceImpl extends ServiceImpl<UserCommonModuleMap
             httpRespMsg.setError("用户不存在");
             return httpRespMsg;
         }
-        List<UserCommonModule> commonModules = userCommonModuleMapper.selectList(new LambdaQueryWrapper<UserCommonModule>()
-                .eq(UserCommonModule::getUserId, user.getId()).orderByAsc(UserCommonModule::getSeq)
-        );
+
+        List<UserCommonModuleVO> commonModules = userCommonModuleMapper.getCommonModules(user.getId(),user.getCompanyId());
+
+//        List<UserCommonModule> commonModules = userCommonModuleMapper
+//                .selectList(new LambdaQueryWrapper<UserCommonModule>()
+//                        .select(UserCommonModule::getModuleId)
+//                .eq(UserCommonModule::getUserId, user.getId()).orderByAsc(UserCommonModule::getSeq)
+//        );
         if(CollectionUtils.isEmpty(commonModules)){
             List<String> list = defaultCommonModuleConfig.getPath();
             List<SysModule> sysModules = sysModuleMapper.getModuleByRole(user.getRoleId());
@@ -85,29 +92,34 @@ public class UserCommonModuleServiceImpl extends ServiceImpl<UserCommonModuleMap
 
     @Override
     @Transactional
-    public HttpRespMsg addCommonModule(Integer moduleId,HttpServletRequest request) {
+    public HttpRespMsg addCommonModules(String moduleIds,HttpServletRequest request) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         User user= userMapper.selectById(request.getHeader("token"));
         if(null == user){
             httpRespMsg.setError("用户不存在");
             return httpRespMsg;
         }
+        if(StringUtils.isBlank(moduleIds)){
+            httpRespMsg.setError("模块id不能为空");
+            return httpRespMsg;
+        }
+        List<Integer> moduleIdList = Arrays.stream(moduleIds.split(",")).map(Integer::parseInt).collect(Collectors.toList());
         //是否已存在
         Integer count = userCommonModuleMapper.selectCount(new LambdaQueryWrapper<UserCommonModule>()
-                .eq(UserCommonModule::getModuleId, moduleId)
+                .in(UserCommonModule::getModuleId, moduleIdList)
                 .eq(UserCommonModule::getUserId, user.getId())
         );
         if(count > 0){
-            httpRespMsg.setError("已有该常用模块");
+            httpRespMsg.setError("已存在选中的常用模块");
             return httpRespMsg;
         }
         //是否有权限
         Integer roleModuleCount = sysRoleModuleMapper.selectCount(new LambdaQueryWrapper<SysRoleModule>()
-                .eq(SysRoleModule::getModuleId, moduleId)
-                .eq(SysRoleModule::getRoleId, user.getRole())
+                .in(SysRoleModule::getModuleId, moduleIdList)
+                .eq(SysRoleModule::getRoleId, user.getRoleId())
         );
-        if(roleModuleCount <= 0){
-            httpRespMsg.setError("无模块权限");
+        if(roleModuleCount <= moduleIdList.size()){
+            httpRespMsg.setError("无模块权限");
             return httpRespMsg;
         }
         //计算seq
@@ -116,12 +128,18 @@ public class UserCommonModuleServiceImpl extends ServiceImpl<UserCommonModuleMap
                 .orderByDesc(UserCommonModule::getSeq)
                 .last("limit 1")
         );
-        UserCommonModule entity = new UserCommonModule();
-        entity.setModuleId(moduleId);
-        entity.setUserId(user.getId());
-        entity.setCompanyId(user.getCompanyId());
-        entity.setSeq(null==lastModule?1:lastModule.getSeq()+1);
-        userCommonModuleMapper.insert(entity);
+        int index = null==lastModule?1:lastModule.getSeq()+1;
+        List<UserCommonModule> toAddList = new ArrayList<>();
+        for (Integer moduleId : moduleIdList) {
+            UserCommonModule entity = new UserCommonModule();
+            entity.setModuleId(moduleId);
+            entity.setUserId(user.getId());
+            entity.setCompanyId(user.getCompanyId());
+            entity.setSeq(index);
+            toAddList.add(entity);
+            index++;
+        }
+        userCommonModuleMapper.insertBatch(toAddList);
         return httpRespMsg;
     }
 

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

@@ -2,12 +2,12 @@ package com.management.platform.service.impl;
 
 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.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.entity.SysDict;
 import com.management.platform.entity.User;
 import com.management.platform.entity.VisitPlan;
+import com.management.platform.entity.dto.QueryVisitPlanDTO;
+import com.management.platform.entity.vo.VisitPlanVO;
 import com.management.platform.mapper.SysDictMapper;
 import com.management.platform.mapper.UserMapper;
 import com.management.platform.mapper.VisitPlanMapper;
@@ -224,19 +224,22 @@ public class VisitPlanServiceImpl extends ServiceImpl<VisitPlanMapper, VisitPlan
     }
 
     @Override
-    public HttpRespMsg getPageVisitPlan(Integer pageIndex, Integer pageSize, Date calenderTime, HttpServletRequest request) {
+    public HttpRespMsg getPageVisitPlan(Integer pageIndex, Integer pageSize, String calenderDate, HttpServletRequest request) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         User user= userMapper.selectById(request.getHeader("token"));
         if(null == user){
             httpRespMsg.setError("用户不存在");
             return httpRespMsg;
         }
-        IPage<VisitPlan> page = new Page<>(pageIndex,pageSize);
-        page = visitPlanMapper.selectPage(page, new LambdaQueryWrapper<VisitPlan>()
-                .eq(VisitPlan::getVisitTime, calenderTime)
-                .eq(VisitPlan::getCreateBy, user.getId())
-        );
-        httpRespMsg.setData(page);
+//        Page<VisitPlan> page = new Page<>(pageIndex,pageSize);
+        QueryVisitPlanDTO query = new QueryVisitPlanDTO();
+        query.setCalenderDate(calenderDate);
+        query.setUserId(user.getId());
+
+//        IPage<VisitPlanVO> resPage = visitPlanMapper.getPageVisitPlan(page,query);
+        List<VisitPlanVO> resPage = visitPlanMapper.getListVisitPlan(query);
+
+        httpRespMsg.setData(resPage);
         return httpRespMsg;
     }
 }

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

@@ -9,4 +9,10 @@
             (#{toAdd.userId},#{toAdd.companyId},#{toAdd.moduleId},#{toAdd.seq},now())
         </foreach>
     </insert>
+    <select id="getCommonModules" resultType="com.management.platform.entity.vo.UserCommonModuleVO">
+        select ucm.module_id,sm.name as moduleName
+        from user_common_module ucm
+                 left join sys_module sm on ucm.module_id = sm.id
+        where user_id = #{userId} and company_id = #{companyId}
+    </select>
 </mapper>

+ 34 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/VisitPlanMapper.xml

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.management.platform.mapper.VisitPlanMapper">
+
+    <select id="getPageVisitPlan" resultType="com.management.platform.entity.vo.VisitPlanVO">
+        select vs.id, vs.plan_name, vs.custom_id, vs.custom_name
+             , vs.incharger_id, u.name as inchargerName
+             , vs.visit_goal,sd1.name as visitGoalText
+             , vs.visit_time, vs.remark
+             , vs.remind_type, sd2.name as remindTypeText
+             ,vs.remind_time, vs.remind_state, vs.finish_state
+             , vs.create_by
+        from visit_plan vs
+                 left join user u on vs.incharger_id = u.id
+                 left join (select * from sys_dict where code = 'VisitGoal') sd1 on vs.visit_goal = sd1.id
+                 left join (select * from sys_dict where code = 'RemindType') sd2 on vs.remind_type = sd2.id
+        where vs.create_by = #{query.userId} and date_format(vs.visit_time,'%Y-%m-%d') = #{query.calenderDate}
+    </select>
+    <select id="getListVisitPlan" resultType="com.management.platform.entity.vo.VisitPlanVO">
+        select vs.id, vs.plan_name, vs.custom_id, vs.custom_name
+             , vs.incharger_id, u.name as inchargerName
+             , vs.visit_goal,sd1.name as visitGoalText
+             , vs.visit_time, vs.remark
+             , vs.remind_type, sd2.name as remindTypeText
+             ,vs.remind_time, vs.remind_state, vs.finish_state
+             , vs.create_by
+        from visit_plan vs
+                 left join user u on vs.incharger_id = u.id
+                 left join (select * from sys_dict where code = 'VisitGoal') sd1 on vs.visit_goal = sd1.id
+                 left join (select * from sys_dict where code = 'RemindType') sd2 on vs.remind_type = sd2.id
+        where vs.create_by = #{query.userId} and date_format(vs.visit_time,'%Y-%m-%d') = #{query.calenderDate}
+    </select>
+</mapper>