From bbe0a2fd03063316e50cf141986bda984599bbda Mon Sep 17 00:00:00 2001
From: 935090232@qq.com <ak473600000>
Date: Tue, 22 Feb 2022 23:41:42 +0800
Subject: [PATCH] Merge branch 'developer'

---
 zq-erp/src/main/java/com/matrix/system/app/action/ApiFollowupAction.java |   92 +++++++++++++++++++++++++++++++--------------
 1 files changed, 63 insertions(+), 29 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/app/action/ApiFollowupAction.java b/zq-erp/src/main/java/com/matrix/system/app/action/ApiFollowupAction.java
index c059963..25fa419 100644
--- a/zq-erp/src/main/java/com/matrix/system/app/action/ApiFollowupAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/app/action/ApiFollowupAction.java
@@ -1,28 +1,16 @@
 package com.matrix.system.app.action;
 
 import com.matrix.core.constance.MatrixConstance;
-import com.matrix.core.exception.GlobleException;
 import com.matrix.core.pojo.AjaxResult;
-import com.matrix.core.pojo.PaginationVO;
 import com.matrix.core.tools.StringUtils;
 import com.matrix.core.tools.WebUtil;
 import com.matrix.system.app.dto.*;
-import com.matrix.system.app.vo.OrderDetailVo;
-import com.matrix.system.app.vo.ShoppingGoodsDetailVo;
-import com.matrix.system.app.vo.ShoppingGoodsListVo;
 import com.matrix.system.common.bean.SysUsers;
 import com.matrix.system.common.tools.DataAuthUtil;
+import com.matrix.system.hive.action.util.QueryUtil;
 import com.matrix.system.hive.bean.*;
-import com.matrix.system.hive.dao.SysFollowupCommentDao;
-import com.matrix.system.hive.dao.SysFollowupDao;
-import com.matrix.system.hive.dao.SysVipAlbumDao;
-import com.matrix.system.hive.dao.SysVipInfoDao;
+import com.matrix.system.hive.dao.*;
 import com.matrix.system.hive.plugin.util.CollectionUtils;
-import com.matrix.system.hive.pojo.ShoppingCarItem;
-import com.matrix.system.hive.pojo.ShoppingCarItemsVo;
-import com.matrix.system.hive.service.ShoppingGoodsCategoryService;
-import com.matrix.system.hive.service.ShoppingGoodsService;
-import com.matrix.system.hive.service.SysOrderService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiResponse;
@@ -56,6 +44,14 @@
     private SysFollowupCommentDao followupCommentDao;
 
 
+
+    @Autowired
+    private SysOrderItemDao orderItemDao;
+
+    @Autowired
+    private SysBeauticianStateDao beauticianStateDao;
+
+
     @ApiOperation(value = "新增跟进记录", notes = "新增跟进记录")
     @ApiResponses({
             @ApiResponse(code = 200, message = "ok", response = SysFollowup.class)
@@ -68,19 +64,45 @@
         followup.setStaffId(user.getSuId());
         followup.setCompanyId(user.getCompanyId());
         followup.setShopId(user.getShopId());
+        //处理订单摘要
+        if(followup.getOrderId()!=null){
+            List<SysOrderItem> sysOrderItems = orderItemDao.selectByOrderId(followup.getOrderId());
+            String abs="";
+            if(sysOrderItems.size()>1){
+                abs= sysOrderItems.get(0).getShoppingGoods().getName()+"等"+sysOrderItems.size()+"件商品";
+            }else{
+                abs= sysOrderItems.get(0).getShoppingGoods().getName();
+            }
+           followup.setOrderAbstract(abs);
+        }
+        //服务单摘要
+        if(followup.getServiceId()!=null){
+            List<SysBeauticianState> sysBeauticianStates = beauticianStateDao.selectBySerIds(followup.getServiceId());
+            String abs="";
+            if(sysBeauticianStates.size()>1){
+                abs= sysBeauticianStates.get(0).getProjInfo().getName()+"等"+sysBeauticianStates.size()+"项服务";
+            }else{
+                abs= sysBeauticianStates.get(0).getProjInfo().getName();
+            }
+            followup.setOrderAbstract(abs);
+        }
+
         followupDao.insert(followup);
         //插入图片
         List<SysVipAlbum> albums=followup.getAlbums();
-        for (SysVipAlbum vipAlbum:albums){
-            if(StringUtils.isNotBlank(vipAlbum.getImg())){
-                vipAlbum.setCreateBy(user.getSuName());
-                vipAlbum.setUpdateBy(user.getSuName());
-                vipAlbum.setSource(SysVipAlbum.SOURCE_FOLLOW);
-                vipAlbum.setVipId(followup.getVipId());
-                vipAlbum.setSourceId(followup.getId());
-                vipAlbumDao.insert(vipAlbum);
+        if(CollectionUtils.isNotEmpty(albums)){
+            for (SysVipAlbum vipAlbum:albums){
+                if(StringUtils.isNotBlank(vipAlbum.getImg())){
+                    vipAlbum.setCreateBy(user.getSuName());
+                    vipAlbum.setUpdateBy(user.getSuName());
+                    vipAlbum.setSource(SysVipAlbum.SOURCE_FOLLOW);
+                    vipAlbum.setVipId(followup.getVipId());
+                    vipAlbum.setSourceId(followup.getId());
+                    vipAlbumDao.insert(vipAlbum);
+                }
             }
         }
+
         return AjaxResult.buildSuccessInstance("保存成功");
     }
 
@@ -103,8 +125,8 @@
 
             }else{
                 //点赞
-                zaned.add(user.getSuId());
-                zans=StringUtils.collToStr(zaned,",");
+                zanIds.add(user.getSuId());
+                zans=StringUtils.collToStr(zanIds,",");
             }
         }else{
             //直接点赞
@@ -135,16 +157,28 @@
             @ApiResponse(code = 200, message = "ok", response = SysFollowup.class)
     })
     @PostMapping(value = "/findFollowup")
-    public AjaxResult findFollowup(@RequestBody @Validated FollowupCommonetListDto followupCommonetListDto) {
+    public AjaxResult findFollowup(@RequestBody @Validated FollowupListDto followupListDto) {
         SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
-        followupCommonetListDto.setShopId(user.getShopId());
-        followupCommonetListDto.setCompanyId(user.getCompanyId());
-        followupCommonetListDto.setSelfStaff(user.getSuId());
+        if(!DataAuthUtil.hasAllShopAuth()){
+            followupListDto.setShopId(user.getShopId());
+        }
+        followupListDto.setCompanyId(user.getCompanyId());
+        followupListDto.setSelfStaff(user.getSuId());
         //TODO 需要设置跨店数据权限
-        List<SysFollowup> rows= followupDao.selectByAppDto(followupCommonetListDto);
+        List<SysFollowup> rows= followupDao.selectByAppDto(followupListDto);
         return AjaxResult.buildSuccessInstance(rows,"查询成功");
     }
 
 
 
+
+
+
+
+
+
+
+    
+    
+
 }
\ No newline at end of file

--
Gitblit v1.9.1