From 5fe3c85e1d270b3a7fb747fbe13711d7dff807c8 Mon Sep 17 00:00:00 2001
From: huangdeliang <huangdeliang@skieer.com>
Date: Thu, 15 Apr 2021 11:59:14 +0800
Subject: [PATCH 1/7] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=90=88=E4=BD=9C?=
 =?UTF-8?q?=E6=96=B9=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../controller/custom/SysOrderController.java |  29 ++-
 .../com/stdiet/custom/domain/SysOrder.java    |   2 +
 .../mapper/custom/SysOrderMapper.xml          | 187 ++++++++++--------
 stdiet-ui/src/store/getters.js                |   1 +
 stdiet-ui/src/store/modules/user.js           | 127 ++++++------
 stdiet-ui/src/views/custom/order/index.vue    |  44 +++--
 6 files changed, 227 insertions(+), 163 deletions(-)

diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderController.java
index b37066e62..eb600ec82 100644
--- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderController.java
+++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderController.java
@@ -5,7 +5,7 @@ import com.stdiet.common.annotation.Log;
 import com.stdiet.common.core.domain.AjaxResult;
 import com.stdiet.common.core.domain.entity.SysUser;
 import com.stdiet.common.enums.BusinessType;
-import com.stdiet.common.utils.DateUtils;
+import com.stdiet.common.utils.SecurityUtils;
 import com.stdiet.common.utils.StringUtils;
 import com.stdiet.common.utils.poi.ExcelUtil;
 import com.stdiet.custom.controller.OrderBaseController;
@@ -21,7 +21,6 @@ import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
 import java.net.URLDecoder;
-import java.time.temporal.ChronoUnit;
 import java.util.List;
 
 /**
@@ -50,6 +49,11 @@ public class SysOrderController extends OrderBaseController {
     public OrderTableDataInfo list(SysOrder sysOrder) {
         startPage();
         dealOrderType(sysOrder);
+        String remark = SecurityUtils.getLoginUser().getUser().getRemark();
+        if (StringUtils.isNotEmpty(remark) && remark.contains("|") && StringUtils.isEmpty(sysOrder.getAccount())) {
+            sysOrder.setAccRange(remark.split("\\|"));
+        }
+
         List<SysOrder> list = sysOrderService.selectSysOrderList(sysOrder);
         List<SysUser> userList = userService.selectAllUser();
         BigDecimal totalAmount = sysOrderService.selectAllOrderAmount(sysOrder);
@@ -57,30 +61,25 @@ public class SysOrderController extends OrderBaseController {
             totalAmount = new BigDecimal(0);
         }
         for (SysOrder order : list) {
-            initUserNickNameAndOrderType(userList,order);
+            initUserNickNameAndOrderType(userList, order);
             if (StringUtils.isNotEmpty(order.getPhone())) {
                 order.setPhone(StringUtils.hiddenPhoneNumber(order.getPhone()));
             }
-            /*//根据服务时长、赠送天数计算服务天数
-            int month = order.getServeTimeId() != null ? order.getServeTimeId().intValue() / 30 : 0;
-            if (order.getStartTime() != null && order.getServerEndTime() != null && order.getServeTimeId() != null && month > 0) {
-                long serverDay = ChronoUnit.DAYS.between(DateUtils.dateToLocalDate(order.getStartTime()), DateUtils.dateToLocalDate(order.getStartTime()).plusMonths(month).plusDays(order.getGiveServeDay() == null ? 0 : order.getGiveServeDay())) + 1;
-                order.setServerDay(Integer.parseInt(serverDay + ""));
-            }*/
         }
         return getOrderDataTable(list, totalAmount);
     }
 
     /**
      * 处理订单类型
+     *
      * @param sysOrder
      */
     private void dealOrderType(SysOrder sysOrder) {
-        if(StringUtils.isNotEmpty(sysOrder.getOrderType())){
+        if (StringUtils.isNotEmpty(sysOrder.getOrderType())) {
             try {
-                JSONArray array = JSONArray.parseArray(URLDecoder.decode(sysOrder.getOrderType(),"UTF-8"));
+                JSONArray array = JSONArray.parseArray(URLDecoder.decode(sysOrder.getOrderType(), "UTF-8"));
                 sysOrder.setSearchOrderTypeArray(array.size() > 0 ? array : null);
-            }catch (Exception e){
+            } catch (Exception e) {
                 e.printStackTrace();
             }
         }
@@ -96,7 +95,7 @@ public class SysOrderController extends OrderBaseController {
         List<SysOrder> list = sysOrderService.selectSysOrderList(sysOrder);
         List<SysUser> userList = userService.selectAllUser();
         for (SysOrder order : list) {
-            initUserNickNameAndOrderType(userList,order);
+            initUserNickNameAndOrderType(userList, order);
             if (StringUtils.isNotEmpty(order.getPhone())) {
                 order.setPhone(StringUtils.hiddenPhoneNumber(order.getPhone()));
             }
@@ -123,12 +122,12 @@ public class SysOrderController extends OrderBaseController {
         SysOrder order = sysOrderService.selectSysOrderById(orderId);
         if (order != null) {
             List<SysUser> userList = userService.selectAllUser();
-            initUserNickNameAndOrderType(userList,order);
+            initUserNickNameAndOrderType(userList, order);
         }
         return AjaxResult.success(order);
     }
 
-    private void initUserNickNameAndOrderType(List<SysUser> userList, SysOrder order){
+    private void initUserNickNameAndOrderType(List<SysUser> userList, SysOrder order) {
         for (SysUser user : userList) {
             if (user.getUserId().equals(order.getPreSaleId())) {
                 order.setPreSale(user.getNickName());
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysOrder.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysOrder.java
index f9a1d712f..82cd80faf 100644
--- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysOrder.java
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysOrder.java
@@ -134,6 +134,8 @@ public class SysOrder extends BaseEntity {
     @Excel(name = "账号")
     private String account;
 
+    private String[] accRange;
+
     /**
      * 策划
      */
diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml
index ca57a9eff..3ecbb19ed 100644
--- a/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml
+++ b/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml
@@ -41,14 +41,14 @@
         <result property="serverEndTime" column="server_end_time"/>
         <result property="becomeFanTime" column="become_fan_time"/>
 
-        <result property="onSaleId"    column="on_sale_id"    />
-        <result property="orderType"    column="order_type"    />
-        <result property="orderCountType"    column="order_count_type"    />
-        <result property="orderMoneyType"    column="order_money_type"    />
-        <result property="mainOrderId"    column="main_order_id"    />
-        <result property="afterSaleCommissOrder"    column="after_sale_commiss_order"    />
-        <result property="commissStartTime"    column="commiss_start_time"    />
-        <result property="delFlag"    column="del_flag"    />
+        <result property="onSaleId" column="on_sale_id"/>
+        <result property="orderType" column="order_type"/>
+        <result property="orderCountType" column="order_count_type"/>
+        <result property="orderMoneyType" column="order_money_type"/>
+        <result property="mainOrderId" column="main_order_id"/>
+        <result property="afterSaleCommissOrder" column="after_sale_commiss_order"/>
+        <result property="commissStartTime" column="commiss_start_time"/>
+        <result property="delFlag" column="del_flag"/>
 
         <!-- 非持久化字段 -->
         <result property="afterSale" column="afterSale_name"></result><!-- 售后名称  -->
@@ -73,7 +73,7 @@
     <sql id="searchOrderType">
         <if test="searchOrderTypeArray != null">
             <trim prefix="AND (" suffix=")" suffixOverrides="or">
-                <foreach collection="searchOrderTypeArray"  separator="or" item="typeArray" index="i">
+                <foreach collection="searchOrderTypeArray" separator="or" item="typeArray" index="i">
                     (
                     <foreach collection="typeArray" separator="and" item="type" index="j">
                         <if test="j == 0">
@@ -99,8 +99,14 @@
             <if test="customer != null  and customer != ''">
                 and (customer like concat('%',#{customer},'%') or phone like concat('%',#{customer},'%'))
             </if>
+            <if test="accRange != null">
+                and account_id in
+                <foreach collection="accRange" separator="," item="acc" open="(" close=")" >
+                    #{acc}
+                </foreach>
+            </if>
             <if test="cusId != null  and cusId != ''">and cus_id = #{cusId}</if>
-           <!-- <if test="phone != null  and phone != ''">and phone = #{phone}</if>-->
+            <!-- <if test="phone != null  and phone != ''">and phone = #{phone}</if>-->
             <if test="status != null ">and status = #{status}</if>
             <if test="payTypeId != null ">and pay_type_id = #{payTypeId}</if>
             <if test="preSaleId != null ">and pre_sale_id = #{preSaleId}</if>
@@ -113,8 +119,12 @@
             <if test="operatorId != null ">and operator_id = #{operatorId}</if>
             <if test="operatorAssisId != null ">and operator_assis_id = #{operatorAssisId}</if>
             <if test="recommender != null  and recommender != ''">and recommender = #{recommender}</if>
-            <if test="beginTime != null and beginTime != ''">and date_format(order_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')</if>
-            <if test="endTime != null and endTime != ''">and date_format(order_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')</if>
+            <if test="beginTime != null and beginTime != ''">and date_format(order_time,'%y%m%d') &gt;=
+                date_format(#{beginTime},'%y%m%d')
+            </if>
+            <if test="endTime != null and endTime != ''">and date_format(order_time,'%y%m%d') &lt;=
+                date_format(#{endTime},'%y%m%d')
+            </if>
             <if test="serveTimeId != null ">and serve_time_id = #{serveTimeId}</if>
             <if test="reviewStatus != null ">and review_status = #{reviewStatus}</if>
             <if test="amountFlag != null">
@@ -141,7 +151,13 @@
             <if test="customer != null  and customer != ''">
                 and (sc.name like concat('%',#{customer},'%') or sc.phone like concat('%',#{customer},'%'))
             </if>
-             <if test="cusId != null  and cusId != ''">and cus_id = #{cusId}</if>
+            <if test="accRange != null">
+                and account_id in
+                <foreach collection="accRange" separator="," item="acc" open="(" close=")">
+                    #{acc}
+                </foreach>
+            </if>
+            <if test="cusId != null  and cusId != ''">and cus_id = #{cusId}</if>
             <if test="phone != null  and phone != ''">and sc.phone = #{phone}</if>
             <if test="status != null ">and status = #{status}</if>
             <if test="payTypeId != null ">and pay_type_id = #{payTypeId}</if>
@@ -155,8 +171,12 @@
             <if test="operatorId != null ">and operator_id = #{operatorId}</if>
             <if test="operatorAssisId != null ">and operator_assis_id = #{operatorAssisId}</if>
             <if test="recommender != null  and recommender != ''">and recommender = #{recommender}</if>
-            <if test="beginTime != null and beginTime != ''">and date_format(order_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')</if>
-            <if test="endTime != null and endTime != ''">and date_format(order_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')</if>
+            <if test="beginTime != null and beginTime != ''">and date_format(order_time,'%y%m%d') &gt;=
+                date_format(#{beginTime},'%y%m%d')
+            </if>
+            <if test="endTime != null and endTime != ''">and date_format(order_time,'%y%m%d') &lt;=
+                date_format(#{endTime},'%y%m%d')
+            </if>
             <if test="serveTimeId != null ">and serve_time_id = #{serveTimeId}</if>
             <if test="reviewStatus != null ">and review_status = #{reviewStatus}</if>
             <if test="amountFlag != null">
@@ -319,10 +339,10 @@
     </delete>
 
     <delete id="deleteSysOrderByIds" parameterType="String">
-<!--        delete from sys_order where order_id in-->
-<!--        <foreach item="orderId" collection="array" open="(" separator="," close=")">-->
-<!--            #{orderId}-->
-<!--        </foreach>-->
+        <!--        delete from sys_order where order_id in-->
+        <!--        <foreach item="orderId" collection="array" open="(" separator="," close=")">-->
+        <!--            #{orderId}-->
+        <!--        </foreach>-->
     </delete>
 
     <resultMap type="SysOrder" id="SysOrderResultExtended">
@@ -362,14 +382,14 @@
         <result property="serverEndTime" column="server_end_time"/>
         <result property="becomeFanTime" column="become_fan_time"/>
 
-        <result property="onSaleId"    column="on_sale_id"    />
-        <result property="orderType"    column="order_type"    />
-        <result property="orderCountType"    column="order_count_type"    />
-        <result property="orderMoneyType"    column="order_money_type"    />
-        <result property="mainOrderId"    column="main_order_id"    />
-        <result property="afterSaleCommissOrder"    column="after_sale_commiss_order"    />
-        <result property="commissStartTime"    column="commiss_start_time"    />
-        <result property="delFlag"    column="del_flag"    />
+        <result property="onSaleId" column="on_sale_id"/>
+        <result property="orderType" column="order_type"/>
+        <result property="orderCountType" column="order_count_type"/>
+        <result property="orderMoneyType" column="order_money_type"/>
+        <result property="mainOrderId" column="main_order_id"/>
+        <result property="afterSaleCommissOrder" column="after_sale_commiss_order"/>
+        <result property="commissStartTime" column="commiss_start_time"/>
+        <result property="delFlag" column="del_flag"/>
 
         <!-- 非持久化字段 -->
         <result property="afterSale" column="afterSale_name"></result><!-- 售后名称  -->
@@ -378,17 +398,17 @@
     </resultMap>
 
     <resultMap type="SysOrderPause" id="SysOrderPauseResult">
-        <result property="id"    column="id"    />
-        <result property="orderId"    column="order_id"    />
-        <result property="pauseStartDate"    column="pause_start_date"    />
-        <result property="pauseEndDate"    column="pause_end_date"    />
-        <result property="reason"    column="reason"    />
-        <result property="remarks"    column="remarks"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="createBy"    column="create_by"    />
-        <result property="updateTime"    column="update_time"    />
-        <result property="updateBy"    column="update_by"    />
-        <result property="delFlag"    column="del_flag"    />
+        <result property="id" column="id"/>
+        <result property="orderId" column="order_id"/>
+        <result property="pauseStartDate" column="pause_start_date"/>
+        <result property="pauseEndDate" column="pause_end_date"/>
+        <result property="reason" column="reason"/>
+        <result property="remarks" column="remarks"/>
+        <result property="createTime" column="create_time"/>
+        <result property="createBy" column="create_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="delFlag" column="del_flag"/>
     </resultMap>
 
     <select id="getOrderPauseByOrderId" parameterType="Long" resultMap="SysOrderPauseResult">
@@ -398,34 +418,15 @@
 
     <!-- 查询2021年开始的已审核的订单信息(用于计算提成,请勿随意改动) -->
     <select id="selectSimpleOrderMessage" resultMap="SysOrderResultExtended" parameterType="SysCommision">
-      select o.order_id,o.order_time,o.commiss_start_time,o.server_end_time,o.customer,o.review_status,o.amount,o.serve_time_id,o.give_serve_day,o.after_sale_id,su_sale.nick_name as afterSale_name,o.nutritionist_id,su_nutritionist.nick_name as nutritionist_name
-      from sys_order o
-      left join sys_user su_sale on su_sale.user_id = o.after_sale_id and su_sale.del_flag = 0
-      left join sys_user su_nutritionist on su_nutritionist.user_id = o.nutritionist_id and su_nutritionist.del_flag = 0
-      where o.order_time >= '2021-01-01' and o.del_flag = 0 and (su_sale.user_id is not null OR su_nutritionist.user_id is not null)
-      and o.amount is not null
-        <if test="reviewStatus != null and reviewStatus != ''">
-            and review_status = #{reviewStatus}
-        </if>
-      <if test="userId != null"><!-- 限于营养师、售后不可能同一个的情况下 -->
-          and (su_sale.user_id = #{userId} or su_nutritionist.user_id = #{userId})
-      </if>
-      <if test="endTime != null and endTime != ''">
-          AND DATE_FORMAT(o.order_time,'%Y-%m-%d') &lt;= #{endTime}
-      </if>
-        <if test="serverScopeEndTime != null and serverScopeEndTime != ''">
-            AND  #{serverScopeEndTime} >= DATE_FORMAT(o.commiss_start_time,'%Y-%m-%d')
-        </if>
-      order by o.order_time desc
-    </select>
-
-    <!-- 查询2021年开始的已审核的订单信息的总条数(用于计算提成,请勿随意改动) -->
-    <select id="selectSimpleOrderMessageCount" resultType="int" parameterType="SysCommision">
-        select count(o.order_id) as orderCount
+        select
+        o.order_id,o.order_time,o.commiss_start_time,o.server_end_time,o.customer,o.review_status,o.amount,o.serve_time_id,o.give_serve_day,o.after_sale_id,su_sale.nick_name
+        as afterSale_name,o.nutritionist_id,su_nutritionist.nick_name as nutritionist_name
         from sys_order o
         left join sys_user su_sale on su_sale.user_id = o.after_sale_id and su_sale.del_flag = 0
-        left join sys_user su_nutritionist on su_nutritionist.user_id = o.nutritionist_id and su_nutritionist.del_flag = 0
-        where o.order_time >= '2021-01-01' and o.del_flag = 0 and (su_sale.user_id is not null OR su_nutritionist.user_id is not null)
+        left join sys_user su_nutritionist on su_nutritionist.user_id = o.nutritionist_id and su_nutritionist.del_flag =
+        0
+        where o.order_time >= '2021-01-01' and o.del_flag = 0 and (su_sale.user_id is not null OR
+        su_nutritionist.user_id is not null)
         and o.amount is not null
         <if test="reviewStatus != null and reviewStatus != ''">
             and review_status = #{reviewStatus}
@@ -437,31 +438,59 @@
             AND DATE_FORMAT(o.order_time,'%Y-%m-%d') &lt;= #{endTime}
         </if>
         <if test="serverScopeEndTime != null and serverScopeEndTime != ''">
-            AND  #{serverScopeEndTime} >= DATE_FORMAT(o.commiss_start_time,'%Y-%m-%d')
+            AND #{serverScopeEndTime} >= DATE_FORMAT(o.commiss_start_time,'%Y-%m-%d')
+        </if>
+        order by o.order_time desc
+    </select>
+
+    <!-- 查询2021年开始的已审核的订单信息的总条数(用于计算提成,请勿随意改动) -->
+    <select id="selectSimpleOrderMessageCount" resultType="int" parameterType="SysCommision">
+        select count(o.order_id) as orderCount
+        from sys_order o
+        left join sys_user su_sale on su_sale.user_id = o.after_sale_id and su_sale.del_flag = 0
+        left join sys_user su_nutritionist on su_nutritionist.user_id = o.nutritionist_id and su_nutritionist.del_flag =
+        0
+        where o.order_time >= '2021-01-01' and o.del_flag = 0 and (su_sale.user_id is not null OR
+        su_nutritionist.user_id is not null)
+        and o.amount is not null
+        <if test="reviewStatus != null and reviewStatus != ''">
+            and review_status = #{reviewStatus}
+        </if>
+        <if test="userId != null"><!-- 限于营养师、售后不可能同一个的情况下 -->
+            and (su_sale.user_id = #{userId} or su_nutritionist.user_id = #{userId})
+        </if>
+        <if test="endTime != null and endTime != ''">
+            AND DATE_FORMAT(o.order_time,'%Y-%m-%d') &lt;= #{endTime}
+        </if>
+        <if test="serverScopeEndTime != null and serverScopeEndTime != ''">
+            AND #{serverScopeEndTime} >= DATE_FORMAT(o.commiss_start_time,'%Y-%m-%d')
         </if>
         order by o.order_time desc
     </select>
 
     <!-- 查询售后、营养师的每个月服务总金额 -->
-    <select id="getTotalAmountByUserId" parameterType="SysCommision" resultType="com.stdiet.custom.dto.response.EveryMonthTotalAmount">
+    <select id="getTotalAmountByUserId" parameterType="SysCommision"
+            resultType="com.stdiet.custom.dto.response.EveryMonthTotalAmount">
         SELECT s.yearMonth,SUM(s.amount) AS totalAmount FROM
         (
-          SELECT CONCAT(YEAR(o.order_time),'',MONTH(o.order_time)) AS yearMonth,o.amount
-          FROM sys_order o
-          LEFT JOIN sys_user su_sale ON su_sale.user_id = o.after_sale_id AND su_sale.del_flag = 0
-          LEFT JOIN sys_user su_nutritionist ON su_nutritionist.user_id = o.nutritionist_id AND su_nutritionist.del_flag = 0
-          where o.order_time >= '2021-01-01' and o.del_flag = 0 and (su_sale.user_id is not null OR su_nutritionist.user_id is not null)
-          and o.amount is not null
-          <if test="reviewStatus != null and reviewStatus != ''">
+        SELECT CONCAT(YEAR(o.order_time),'',MONTH(o.order_time)) AS yearMonth,o.amount
+        FROM sys_order o
+        LEFT JOIN sys_user su_sale ON su_sale.user_id = o.after_sale_id AND su_sale.del_flag = 0
+        LEFT JOIN sys_user su_nutritionist ON su_nutritionist.user_id = o.nutritionist_id AND su_nutritionist.del_flag =
+        0
+        where o.order_time >= '2021-01-01' and o.del_flag = 0 and (su_sale.user_id is not null OR
+        su_nutritionist.user_id is not null)
+        and o.amount is not null
+        <if test="reviewStatus != null and reviewStatus != ''">
             and o.review_status = #{reviewStatus}
-          </if>
-          <if test="userId != null"><!-- 限于营养师、售后不可能同一个的情况下 -->
+        </if>
+        <if test="userId != null"><!-- 限于营养师、售后不可能同一个的情况下 -->
             and (su_sale.user_id = #{userId} or su_nutritionist.user_id = #{userId})
-          </if>
-          <if test="endTime != null and endTime != ''">
+        </if>
+        <if test="endTime != null and endTime != ''">
             AND DATE_FORMAT(o.order_time,'%Y-%m-%d') &lt;= #{endTime}
-          </if>
-          ORDER BY o.order_time ASC
+        </if>
+        ORDER BY o.order_time ASC
         ) s
         GROUP BY s.yearMonth
     </select>
diff --git a/stdiet-ui/src/store/getters.js b/stdiet-ui/src/store/getters.js
index 9b1577285..8550c09d2 100644
--- a/stdiet-ui/src/store/getters.js
+++ b/stdiet-ui/src/store/getters.js
@@ -11,6 +11,7 @@ const getters = {
   roles: state => state.user.roles,
   permissions: state => state.user.permissions,
   userId: state => state.user.userId,
+  userRemark: state => state.user.remark,
   permission_routes: state => state.permission.routes,
   //
   nutritionistIdOptions: state => state.global.nutritionistIdOptions,
diff --git a/stdiet-ui/src/store/modules/user.js b/stdiet-ui/src/store/modules/user.js
index 2ec9804d5..e84c27d88 100644
--- a/stdiet-ui/src/store/modules/user.js
+++ b/stdiet-ui/src/store/modules/user.js
@@ -1,100 +1,117 @@
-import { login, logout, getInfo } from '@/api/login'
-import { getToken, setToken, removeToken } from '@/utils/auth'
+import { login, logout, getInfo } from "@/api/login";
+import { getToken, setToken, removeToken } from "@/utils/auth";
 
 const user = {
   state: {
     token: getToken(),
-    name: '',
-    avatar: '',
+    name: "",
+    avatar: "",
+    remark: "",
     roles: [],
     permissions: []
   },
 
   mutations: {
     SET_TOKEN: (state, token) => {
-      state.token = token
+      state.token = token;
     },
     SET_NAME: (state, name) => {
-      state.name = name
+      state.name = name;
     },
     SET_AVATAR: (state, avatar) => {
-      state.avatar = avatar
+      state.avatar = avatar;
     },
     SET_ROLES: (state, roles) => {
-      state.roles = roles
+      state.roles = roles;
     },
     SET_PERMISSIONS: (state, permissions) => {
-      state.permissions = permissions
+      state.permissions = permissions;
     },
     SET_USERID: (state, userId) => {
-      state.userId = userId
+      state.userId = userId;
+    },
+    SET_REMARK: (state, remark) => {
+      state.remark = remark;
     }
   },
 
   actions: {
     // 登录
     Login({ commit }, userInfo) {
-      const username = userInfo.username.trim()
-      const password = userInfo.password
-      const code = userInfo.code
-      const uuid = userInfo.uuid
+      const username = userInfo.username.trim();
+      const password = userInfo.password;
+      const code = userInfo.code;
+      const uuid = userInfo.uuid;
       return new Promise((resolve, reject) => {
-        login(username, password, code, uuid).then(res => {
-          setToken(res.token)
-          commit('SET_TOKEN', res.token)
-          resolve()
-        }).catch(error => {
-          reject(error)
-        })
-      })
+        login(username, password, code, uuid)
+          .then(res => {
+            setToken(res.token);
+            commit("SET_TOKEN", res.token);
+            resolve();
+          })
+          .catch(error => {
+            reject(error);
+          });
+      });
     },
 
     // 获取用户信息
     GetInfo({ commit, state }) {
       return new Promise((resolve, reject) => {
-        getInfo(state.token).then(res => {
-          const user = res.user
-          const avatar = user.avatar == "" ? require("@/assets/image/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar;
-          if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
-            commit('SET_ROLES', res.roles)
-            commit('SET_PERMISSIONS', res.permissions)
-          } else {
-            commit('SET_ROLES', ['ROLE_DEFAULT'])
-          }
-          commit('SET_NAME', user.userName)
-          commit('SET_AVATAR', avatar)
-          commit('SET_USERID', user.userId)
-          resolve(res)
-        }).catch(error => {
-          reject(error)
-        })
-      })
+        getInfo(state.token)
+          .then(res => {
+            const user = res.user;
+            const avatar =
+              user.avatar == ""
+                ? require("@/assets/image/profile.jpg")
+                : process.env.VUE_APP_BASE_API + user.avatar;
+            if (res.roles && res.roles.length > 0) {
+              // 验证返回的roles是否是一个非空数组
+              commit("SET_ROLES", res.roles);
+              commit("SET_PERMISSIONS", res.permissions);
+            } else {
+              commit("SET_ROLES", ["ROLE_DEFAULT"]);
+            }
+            commit("SET_NAME", user.userName);
+            commit("SET_AVATAR", avatar);
+            commit("SET_USERID", user.userId);
+            commit("SET_REMARK", user.remark);
+            resolve(res);
+          })
+          .catch(error => {
+            reject(error);
+          });
+      });
     },
 
     // 退出系统
     LogOut({ commit, state }) {
       return new Promise((resolve, reject) => {
-        logout(state.token).then(() => {
-          commit('SET_TOKEN', '')
-          commit('SET_ROLES', [])
-          commit('SET_PERMISSIONS', [])
-          removeToken()
-          resolve()
-        }).catch(error => {
-          reject(error)
-        })
-      })
+        logout(state.token)
+          .then(() => {
+            commit("SET_TOKEN", "");
+            commit("SET_ROLES", []);
+            commit("SET_PERMISSIONS", []);
+            commit("SET_USERID", "");
+            commit("SET_REMARK", "");
+            removeToken();
+            resolve();
+          })
+          .catch(error => {
+            reject(error);
+          });
+      });
     },
 
     // 前端 登出
     FedLogOut({ commit }) {
       return new Promise(resolve => {
-        commit('SET_TOKEN', '')
-        removeToken()
-        resolve()
-      })
+        commit("SET_TOKEN", "");
+        removeToken();
+        resolve();
+      });
     }
   }
-}
+};
 
-export default user
+export default user;
diff --git a/stdiet-ui/src/views/custom/order/index.vue b/stdiet-ui/src/views/custom/order/index.vue
index b5f513682..c6785c06c 100644
--- a/stdiet-ui/src/views/custom/order/index.vue
+++ b/stdiet-ui/src/views/custom/order/index.vue
@@ -19,7 +19,7 @@
             />
           </el-form-item>
         </el-col>
-        <el-col :span="6">
+        <el-col :span="6" v-if="!isPartner">
           <el-form-item label="收款方式" prop="payTypeId">
             <el-select
               v-model="queryParams.payTypeId"
@@ -37,10 +37,10 @@
           </el-form-item>
         </el-col>
         <el-col :span="6">
-          <el-form-item label="收款账号" prop="accountId">
+          <el-form-item label="进粉渠道" prop="accountId">
             <el-select
               v-model="queryParams.accountId"
-              placeholder="请选择账号"
+              placeholder="请选择渠道"
               clearable
               size="small"
             >
@@ -70,7 +70,7 @@
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col :span="6">
+        <el-col :span="6" v-if="!isPartner">
           <el-form-item label="销售" prop="preSaleId">
             <el-select
               v-model="queryParams.preSaleId"
@@ -88,7 +88,7 @@
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col :span="6">
+        <el-col :span="6" v-if="!isPartner">
           <el-form-item label="售后" prop="afterSaleId">
             <el-select
               v-model="queryParams.afterSaleId"
@@ -106,7 +106,7 @@
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col :span="6">
+        <el-col :span="6" v-if="!isPartner">
           <el-form-item label="主营养师" prop="nutritionistId">
             <el-select
               v-model="queryParams.nutritionistId"
@@ -124,7 +124,7 @@
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col :span="6">
+        <el-col :span="6" v-if="!isPartner">
           <el-form-item
             label="营养师助理"
             prop="nutriAssisId"
@@ -147,7 +147,7 @@
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col :span="6">
+        <el-col :span="6" v-if="!isPartner">
           <el-form-item label="策划" prop="plannerId">
             <el-select
               v-model="queryParams.plannerId"
@@ -165,7 +165,7 @@
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col :span="6">
+        <el-col :span="6" v-if="!isPartner">
           <el-form-item label="策划助理" prop="plannerAssisId">
             <el-select
               v-model="queryParams.plannerAssisId"
@@ -183,7 +183,7 @@
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col :span="6">
+        <el-col :span="6" v-if="!isPartner">
           <el-form-item label="运营" prop="operatorId">
             <el-select
               v-model="queryParams.operatorId"
@@ -201,7 +201,7 @@
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col :span="6">
+        <el-col :span="6" v-if="!isPartner">
           <el-form-item label="运营助理" prop="operatorAssisId">
             <el-select
               v-model="queryParams.operatorAssisId"
@@ -235,7 +235,7 @@
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col :span="6">
+        <el-col :span="6" v-if="!isPartner">
           <el-form-item label="订单金额" prop="amountFlag">
             <el-select
               v-model="queryParams.amountFlag"
@@ -356,7 +356,7 @@
         </template>
       </el-table-column>
       <el-table-column
-        label="收款账号"
+        label="进粉渠道"
         align="center"
         prop="account"
         width="90"
@@ -586,6 +586,9 @@ export default {
     isMobile() {
       return this.device === "mobile";
     },
+    isPartner() {
+      return this.userRemark && this.userRemark.includes("|");
+    },
     ...mapGetters([
       // 售前字典
       "preSaleIdOptions",
@@ -606,6 +609,8 @@ export default {
       //
       "userId",
       //
+      "userRemark",
+      //
       "device",
     ]),
   },
@@ -615,7 +620,18 @@ export default {
       this.payTypeIdOptions = response.data;
     });
     this.getDicts("cus_account").then((response) => {
-      this.accountIdOptions = response.data;
+      if (this.userRemark && this.userRemark.includes("|")) {
+        const accRange = this.userRemark.split("|");
+        this.accountIdOptions = accRange.reduce((arr, accId) => {
+          const tarObj = response.data.find((obj) => obj.dictValue === accId);
+          if (tarObj) {
+            arr.push(tarObj);
+          }
+          return arr;
+        }, []);
+      } else {
+        this.accountIdOptions = response.data;
+      }
     });
     this.getDicts("cus_serve_time").then((response) => {
       this.serveTimeIdOption = response.data;

From fe7c44d1733097c75f4b9dc5c0e91503800cbf52 Mon Sep 17 00:00:00 2001
From: huangdeliang <huangdeliang@skieer.com>
Date: Thu, 15 Apr 2021 15:34:40 +0800
Subject: [PATCH 2/7] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=AE=A2=E6=88=B7?=
 =?UTF-8?q?=E6=A1=A3=E6=A1=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../custom/SysCustomerController.java         |  6 ++
 .../com/stdiet/custom/domain/SysCustomer.java |  5 ++
 .../mapper/custom/SysCustomerMapper.xml       | 13 +++-
 .../src/components/OrderDrawer/index.vue      |  1 +
 stdiet-ui/src/views/custom/customer/index.vue | 67 +++++++++++++++----
 5 files changed, 77 insertions(+), 15 deletions(-)

diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java
index 7accfb8b6..38508596e 100644
--- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java
+++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java
@@ -5,6 +5,7 @@ import com.stdiet.common.core.controller.BaseController;
 import com.stdiet.common.core.domain.AjaxResult;
 import com.stdiet.common.core.page.TableDataInfo;
 import com.stdiet.common.enums.BusinessType;
+import com.stdiet.common.utils.SecurityUtils;
 import com.stdiet.common.utils.StringUtils;
 import com.stdiet.common.utils.poi.ExcelUtil;
 import com.stdiet.common.utils.sign.AesUtils;
@@ -14,6 +15,7 @@ import com.stdiet.custom.service.ISysCustomerHealthyService;
 import com.stdiet.custom.service.ISysCustomerPhysicalSignsService;
 import com.stdiet.custom.service.ISysCustomerService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.SecurityConfig;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
@@ -44,6 +46,10 @@ public class SysCustomerController extends BaseController {
     @GetMapping("/list")
     public TableDataInfo list(SysCustomer sysCustomer) {
         startPage();
+        String remark = SecurityUtils.getLoginUser().getUser().getRemark();
+        if (StringUtils.isNotEmpty(remark) && remark.contains("|") && sysCustomer.getChannelId() == null) {
+            sysCustomer.setChannels(remark.split("\\|"));
+        }
         List<SysCustomer> list = sysCustomerService.selectSysCustomerList(sysCustomer);
         if (list != null && list.size() > 0) {
             for (SysCustomer sysCus : list) {
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomer.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomer.java
index 6ec60aca3..a99cd9447 100644
--- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomer.java
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomer.java
@@ -97,4 +97,9 @@ public class SysCustomer extends BaseEntity
     /** 体征数据,非持久化字段 */
     private SysCustomerPhysicalSigns sign;
 
+    @Excel(name = "进粉渠道")
+    private Long channelId;
+
+    private String[] channels;
+
 }
\ No newline at end of file
diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml
index 4c14602a2..1847b6535 100644
--- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml
+++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml
@@ -26,10 +26,11 @@
         <result property="createBy"    column="create_by"    />
         <result property="updateTime"    column="update_time"    />
         <result property="updateBy"    column="update_by"    />
+        <result property="channelId"    column="channel_id"    />
     </resultMap>
 
     <sql id="selectSysCustomerVo">
-        select id, name, phone, email, fans_time, fans_channel, address, pay_date, start_date, purchase_num, pay_total, main_dietitian, assistant_dietitian, after_dietitian, salesman, charge_person, follow_status, create_time, create_by, update_time, update_by from sys_customer
+        select id, name, phone, email, fans_time, fans_channel, address, pay_date, start_date, purchase_num, pay_total, main_dietitian, assistant_dietitian, after_dietitian, salesman, charge_person, follow_status, create_time, create_by, update_time, update_by, channel_id from sys_customer
     </sql>
 
     <select id="selectSysCustomerList" parameterType="SysCustomer" resultMap="SysCustomerResult">
@@ -45,6 +46,13 @@
         <if test="assistantDietitian != null  and assistantDietitian != ''"> and assistant_dietitian = #{assistantDietitian}</if>
         <if test="assistantDietitian == 0"> and (isnull(assistant_dietitian) or assistant_dietitian=0)</if>
         <if test="fansChannel != null "> and fans_channel = #{fansChannel}</if>
+        <if test="channelId != null "> and channel_id = #{channelId}</if>
+        <if test="channels != null">
+            and channel_id in
+            <foreach collection="channels" item="cn" separator="," open="(" close=")">
+                #{cn}
+            </foreach>
+        </if>
         order by create_time desc
     </select>
 
@@ -76,6 +84,7 @@
             <if test="createBy != null">create_by,</if>
             <if test="updateTime != null">update_time,</if>
             <if test="updateBy != null">update_by,</if>
+            <if test="channelId != null">channel_id,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="name != null">#{name},</if>
@@ -98,6 +107,7 @@
             <if test="createBy != null">#{createBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
+            <if test="channelId != null">#{channelId},</if>
         </trim>
     </insert>
 
@@ -124,6 +134,7 @@
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="channelId != null">channel_id = #{channelId},</if>
         </trim>
         where id = #{id}
     </update>
diff --git a/stdiet-ui/src/components/OrderDrawer/index.vue b/stdiet-ui/src/components/OrderDrawer/index.vue
index d50e0d286..2d8237515 100644
--- a/stdiet-ui/src/components/OrderDrawer/index.vue
+++ b/stdiet-ui/src/components/OrderDrawer/index.vue
@@ -212,6 +212,7 @@ export default {
       this.$refs.cusCreateOrderDialogRef.showDialog(
         {
           customer: this.data.name,
+          accountId: this.data.channelId,
           cusId: this.data.id,
           preSaleId: this.data.salesman,
           afterSaleId: this.data.afterDietitian,
diff --git a/stdiet-ui/src/views/custom/customer/index.vue b/stdiet-ui/src/views/custom/customer/index.vue
index 535ac2ec2..8a52153d7 100644
--- a/stdiet-ui/src/views/custom/customer/index.vue
+++ b/stdiet-ui/src/views/custom/customer/index.vue
@@ -16,8 +16,7 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-
-      <el-form-item label="进粉渠道" prop="fansChannel">
+      <!-- <el-form-item label="进粉方式" prop="fansChannel">
         <el-select v-model="queryParams.fansChannel" placeholder="请选择">
           <el-option
             v-for="dict in fansChannelOptions"
@@ -26,6 +25,16 @@
             :value="parseInt(dict.dictValue)"
           />
         </el-select>
+      </el-form-item> -->
+      <el-form-item label="进粉渠道" prop="channelId">
+        <el-select v-model="queryParams.channelId" placeholder="请选择">
+          <el-option
+            v-for="dict in accountIdOptions"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="parseInt(dict.dictValue)"
+          />
+        </el-select>
       </el-form-item>
       <el-form-item label="营养师" prop="mainDietitian">
         <el-select v-model="queryParams.mainDietitian" placeholder="请选择">
@@ -132,13 +141,18 @@
           <span>{{ parseTime(scope.row.fansTime, "{y}-{m}-{d}") }}</span>
         </template>
       </el-table-column>
-      <el-table-column
-        label="进粉渠道"
+      <!-- <el-table-column
+        label="进粉方式"
         align="center"
         prop="fansChannel"
         :formatter="fansChannelFormat"
-      >
-      </el-table-column>
+      /> -->
+      <el-table-column
+        label="进粉渠道"
+        align="center"
+        prop="channelId"
+        :formatter="channelFormat"
+      />
       <el-table-column label="客户姓名" align="center" prop="name" />
       <el-table-column label="手机号" align="center" prop="phone" />
       <el-table-column
@@ -250,7 +264,6 @@
         </template>
       </el-table-column>
 
-
       <el-table-column
         label="操作"
         align="center"
@@ -363,10 +376,10 @@
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="进粉渠道" prop="fansChannel">
-              <el-select v-model="form.fansChannel" placeholder="请选择">
+            <el-form-item label="进粉渠道" prop="channelId">
+              <el-select v-model="form.channelId" placeholder="请选择">
                 <el-option
-                  v-for="dict in fansChannelOptions"
+                  v-for="dict in accountIdOptions"
                   :key="dict.dictValue"
                   :label="dict.dictLabel"
                   :value="parseInt(dict.dictValue)"
@@ -393,7 +406,9 @@
     <!-- 食谱计划抽屉 -->
     <RecipesPlanDrawer ref="recipesPlanDrawerRef" />
     <!-- 客户打卡记录 -->
-    <CustomerPunchLogDrawer ref="customerPunchLogDrawerRef"></CustomerPunchLogDrawer>
+    <CustomerPunchLogDrawer
+      ref="customerPunchLogDrawerRef"
+    ></CustomerPunchLogDrawer>
   </div>
 </template>
 
@@ -413,7 +428,7 @@ import PhysicalSignsDialog from "@/components/PhysicalSignsDialog";
 import ContractDrawer from "@/components/ContractDrawer";
 import HeatStatisticsDrawer from "@/components/HeatStatisticsDrawer";
 import RecipesPlanDrawer from "@/components/RecipesPlanDrawer";
-import CustomerPunchLogDrawer  from "@/components/PunchLog/CustomerPunchLog";
+import CustomerPunchLogDrawer from "@/components/PunchLog/CustomerPunchLog";
 import { mapGetters } from "vuex";
 
 export default {
@@ -424,7 +439,7 @@ export default {
     "contract-drawer": ContractDrawer,
     heatStatisticsDrawer: HeatStatisticsDrawer,
     RecipesPlanDrawer,
-    CustomerPunchLogDrawer
+    CustomerPunchLogDrawer,
   },
   data() {
     const userId = store.getters && store.getters.userId;
@@ -446,6 +461,8 @@ export default {
       customerCenterList: [],
       //
       fansChannelOptions: [],
+      //
+      accountIdOptions: [],
       // 弹出层标题
       title: "",
       // 是否显示弹出层
@@ -493,6 +510,9 @@ export default {
         fansTime: [
           { required: true, message: "进粉时间不能为空", trigger: "blur" },
         ],
+        channelId: [
+          { required: true, message: "进粉渠道不能为空", trigger: "blur" },
+        ],
       },
       fanPickerOptions: {
         disabledDate(time) {
@@ -505,6 +525,20 @@ export default {
     this.getDicts("customer_fans_channel").then((response) => {
       this.fansChannelOptions = response.data;
     });
+    this.getDicts("cus_account").then((response) => {
+      if (this.userRemark && this.userRemark.includes("|")) {
+        const accRange = this.userRemark.split("|");
+        this.accountIdOptions = accRange.reduce((arr, accId) => {
+          const tarObj = response.data.find((obj) => obj.dictValue === accId);
+          if (tarObj) {
+            arr.push(tarObj);
+          }
+          return arr;
+        }, []);
+      } else {
+        this.accountIdOptions = response.data;
+      }
+    });
     this.getList();
   },
   computed: {
@@ -517,6 +551,8 @@ export default {
       "nutritionistIdOptions",
       // 助理营养师字典
       "nutriAssisIdOptions",
+      //
+      "userRemark",
     ]),
   },
   methods: {
@@ -554,6 +590,9 @@ export default {
     fansChannelFormat(row, column) {
       return this.selectDictLabel(this.fansChannelOptions, row.fansChannel);
     },
+    channelFormat(row, column) {
+      return this.selectDictLabel(this.accountIdOptions, row.channelId);
+    },
     handleOnOrderClick(row) {
       this.$refs["cusOrderDrawerRef"].showDrawer(row);
     },
@@ -576,7 +615,7 @@ export default {
     handleClickCustomerPunchLog(row) {
       this.$refs["customerPunchLogDrawerRef"].showDrawer(row);
     },
-    
+
     // 取消按钮
     cancel() {
       this.open = false;

From 8b2141437195c7ba97e0e84c366456eb41356ca3 Mon Sep 17 00:00:00 2001
From: huangdeliang <huangdeliang@skieer.com>
Date: Thu, 15 Apr 2021 16:13:23 +0800
Subject: [PATCH 3/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=90=88=E4=BD=9C?=
 =?UTF-8?q?=E6=96=B9bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../controller/custom/SysCustomerController.java | 16 +++++++++++-----
 .../controller/custom/SysOrderController.java    | 14 ++++++++++----
 stdiet-ui/src/views/custom/customer/index.vue    |  7 ++++++-
 stdiet-ui/src/views/custom/order/index.vue       |  6 ++++--
 4 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java
index 38508596e..a4660d826 100644
--- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java
+++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java
@@ -3,6 +3,7 @@ package com.stdiet.web.controller.custom;
 import com.stdiet.common.annotation.Log;
 import com.stdiet.common.core.controller.BaseController;
 import com.stdiet.common.core.domain.AjaxResult;
+import com.stdiet.common.core.domain.entity.SysUser;
 import com.stdiet.common.core.page.TableDataInfo;
 import com.stdiet.common.enums.BusinessType;
 import com.stdiet.common.utils.SecurityUtils;
@@ -15,10 +16,10 @@ import com.stdiet.custom.service.ISysCustomerHealthyService;
 import com.stdiet.custom.service.ISysCustomerPhysicalSignsService;
 import com.stdiet.custom.service.ISysCustomerService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.SecurityConfig;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -46,11 +47,16 @@ public class SysCustomerController extends BaseController {
     @GetMapping("/list")
     public TableDataInfo list(SysCustomer sysCustomer) {
         startPage();
-        String remark = SecurityUtils.getLoginUser().getUser().getRemark();
-        if (StringUtils.isNotEmpty(remark) && remark.contains("|") && sysCustomer.getChannelId() == null) {
-            sysCustomer.setChannels(remark.split("\\|"));
+        List<SysCustomer> list = new ArrayList<>();
+        if (SecurityUtils.getLoginUser().getUser().getRoles().get(0).getRoleKey().equals("partner")) {
+            String remark = SecurityUtils.getLoginUser().getUser().getRemark();
+            if (StringUtils.isEmpty(remark)) {
+                return getDataTable(list);
+            } else if (remark.contains("|") && sysCustomer.getChannelId() == null) {
+                sysCustomer.setChannels(remark.split("\\|"));
+            }
         }
-        List<SysCustomer> list = sysCustomerService.selectSysCustomerList(sysCustomer);
+        list = sysCustomerService.selectSysCustomerList(sysCustomer);
         if (list != null && list.size() > 0) {
             for (SysCustomer sysCus : list) {
                 if (StringUtils.isNotEmpty(sysCus.getPhone())) {
diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderController.java
index eb600ec82..c28140ea9 100644
--- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderController.java
+++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderController.java
@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
 import java.net.URLDecoder;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -49,12 +50,17 @@ public class SysOrderController extends OrderBaseController {
     public OrderTableDataInfo list(SysOrder sysOrder) {
         startPage();
         dealOrderType(sysOrder);
-        String remark = SecurityUtils.getLoginUser().getUser().getRemark();
-        if (StringUtils.isNotEmpty(remark) && remark.contains("|") && StringUtils.isEmpty(sysOrder.getAccount())) {
-            sysOrder.setAccRange(remark.split("\\|"));
+        List<SysOrder> list = new ArrayList<>();
+        if (SecurityUtils.getLoginUser().getUser().getRoles().get(0).getRoleKey().equals("partner")) {
+            String remark = SecurityUtils.getLoginUser().getUser().getRemark();
+            if (StringUtils.isEmpty(remark)) {
+                return getOrderDataTable(list, new BigDecimal(0));
+            } else if (remark.contains("|") && StringUtils.isEmpty(sysOrder.getAccount())) {
+                sysOrder.setAccRange(remark.split("\\|"));
+            }
         }
 
-        List<SysOrder> list = sysOrderService.selectSysOrderList(sysOrder);
+        list = sysOrderService.selectSysOrderList(sysOrder);
         List<SysUser> userList = userService.selectAllUser();
         BigDecimal totalAmount = sysOrderService.selectAllOrderAmount(sysOrder);
         if (totalAmount == null) {
diff --git a/stdiet-ui/src/views/custom/customer/index.vue b/stdiet-ui/src/views/custom/customer/index.vue
index 8a52153d7..a88be58b6 100644
--- a/stdiet-ui/src/views/custom/customer/index.vue
+++ b/stdiet-ui/src/views/custom/customer/index.vue
@@ -526,7 +526,7 @@ export default {
       this.fansChannelOptions = response.data;
     });
     this.getDicts("cus_account").then((response) => {
-      if (this.userRemark && this.userRemark.includes("|")) {
+      if (this.isPartner) {
         const accRange = this.userRemark.split("|");
         this.accountIdOptions = accRange.reduce((arr, accId) => {
           const tarObj = response.data.find((obj) => obj.dictValue === accId);
@@ -542,6 +542,9 @@ export default {
     this.getList();
   },
   computed: {
+    isPartner() {
+      return this.roles && this.roles.includes("partner");
+    },
     ...mapGetters([
       // 售前字典
       "preSaleIdOptions",
@@ -553,6 +556,8 @@ export default {
       "nutriAssisIdOptions",
       //
       "userRemark",
+      //
+      "roles",
     ]),
   },
   methods: {
diff --git a/stdiet-ui/src/views/custom/order/index.vue b/stdiet-ui/src/views/custom/order/index.vue
index c6785c06c..16581d1f1 100644
--- a/stdiet-ui/src/views/custom/order/index.vue
+++ b/stdiet-ui/src/views/custom/order/index.vue
@@ -587,7 +587,7 @@ export default {
       return this.device === "mobile";
     },
     isPartner() {
-      return this.userRemark && this.userRemark.includes("|");
+      return this.roles && this.roles.includes("partner");
     },
     ...mapGetters([
       // 售前字典
@@ -611,6 +611,8 @@ export default {
       //
       "userRemark",
       //
+      "roles",
+      //
       "device",
     ]),
   },
@@ -620,7 +622,7 @@ export default {
       this.payTypeIdOptions = response.data;
     });
     this.getDicts("cus_account").then((response) => {
-      if (this.userRemark && this.userRemark.includes("|")) {
+      if (this.isPartner) {
         const accRange = this.userRemark.split("|");
         this.accountIdOptions = accRange.reduce((arr, accId) => {
           const tarObj = response.data.find((obj) => obj.dictValue === accId);

From ca1a5727d55248dfe05e02e51e2ab0b2c2022fc5 Mon Sep 17 00:00:00 2001
From: huangdeliang <huangdeliang@skieer.com>
Date: Thu, 15 Apr 2021 18:26:43 +0800
Subject: [PATCH 4/7] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=A1=B5=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 stdiet-ui/src/views/custom/customer/index.vue | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/stdiet-ui/src/views/custom/customer/index.vue b/stdiet-ui/src/views/custom/customer/index.vue
index a88be58b6..cd87b904b 100644
--- a/stdiet-ui/src/views/custom/customer/index.vue
+++ b/stdiet-ui/src/views/custom/customer/index.vue
@@ -36,7 +36,7 @@
           />
         </el-select>
       </el-form-item>
-      <el-form-item label="营养师" prop="mainDietitian">
+      <el-form-item label="营养师" prop="mainDietitian" v-if="!isPartner">
         <el-select v-model="queryParams.mainDietitian" placeholder="请选择">
           <el-option
             v-for="dict in nutritionistIdOptions"
@@ -46,7 +46,11 @@
           />
         </el-select>
       </el-form-item>
-      <el-form-item label="营养师助理" prop="assistantDietitian">
+      <el-form-item
+        label="营养师助理"
+        prop="assistantDietitian"
+        v-if="!isPartner"
+      >
         <el-select
           v-model="queryParams.assistantDietitian"
           placeholder="请选择"
@@ -59,7 +63,7 @@
           />
         </el-select>
       </el-form-item>
-      <el-form-item label="销售人员" prop="salesman">
+      <el-form-item label="销售人员" prop="salesman" v-if="!isPartner">
         <el-select v-model="queryParams.salesman" placeholder="请选择">
           <el-option
             v-for="dict in preSaleIdOptions"
@@ -69,7 +73,7 @@
           />
         </el-select>
       </el-form-item>
-      <el-form-item label="售后营养师" prop="afterDietitian">
+      <el-form-item label="售后营养师" prop="afterDietitian" v-if="!isPartner">
         <el-select v-model="queryParams.afterDietitian" placeholder="请选择">
           <el-option
             v-for="dict in afterSaleIdOptions"
@@ -270,6 +274,7 @@
         fixed="right"
         width="120"
         class-name="small-padding fixed-width"
+        v-if="!isPartner"
       >
         <template slot-scope="scope">
           <el-button

From ef882b2154f55ec24a6f664aeffa0734be8e52f0 Mon Sep 17 00:00:00 2001
From: huangdeliang <huangdeliang@skieer.com>
Date: Sat, 17 Apr 2021 18:00:45 +0800
Subject: [PATCH 5/7] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AE=A2=E5=8D=95?=
 =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../src/main/filters/local/application.yml    |  5 +--
 stdiet-ui/src/components/OrderAdd/index.vue   | 32 +++++++++--------
 stdiet-ui/src/components/OrderEdit/index.vue  | 34 +++++++++++++------
 3 files changed, 44 insertions(+), 27 deletions(-)

diff --git a/stdiet-admin/src/main/filters/local/application.yml b/stdiet-admin/src/main/filters/local/application.yml
index 34330d88c..b3bead739 100644
--- a/stdiet-admin/src/main/filters/local/application.yml
+++ b/stdiet-admin/src/main/filters/local/application.yml
@@ -19,7 +19,7 @@ stdiet:
 # 开发环境配置
 server:
   # 服务器的HTTP端口,默认为8080
-  port: 8091
+  port: 8090
   servlet:
     # 应用的访问路径
     context-path: /
@@ -186,5 +186,6 @@ aliyun:
 
 lucene:
   index:
-    nutritionQuestion: D:\develop\LuceneIndex\nutritionQuestion
+#    nutritionQuestion: D:\develop\LuceneIndex\nutritionQuestion
+    nutritionQuestion: /Users/wonder/Documents/Workspaces/java/ShengtangManage/running/uploadPath/nutritionQuestion
 
diff --git a/stdiet-ui/src/components/OrderAdd/index.vue b/stdiet-ui/src/components/OrderAdd/index.vue
index da1379a3d..62ffd7962 100644
--- a/stdiet-ui/src/components/OrderAdd/index.vue
+++ b/stdiet-ui/src/components/OrderAdd/index.vue
@@ -53,8 +53,12 @@
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item label="收款账号" prop="accountId">
-            <el-select v-model="form.accountId" placeholder="请选择">
+          <el-form-item label="进粉渠道" prop="accountId">
+            <el-select
+              v-model="form.accountId"
+              placeholder="请选择"
+              @change="handleOnChanelIdChange"
+            >
               <el-option
                 v-for="dict in accountIdOptions"
                 :key="dict.dictValue"
@@ -157,10 +161,7 @@
         </el-col>
         <el-col :span="8" v-show="orderRateOptionsShow">
           <el-form-item label="拆分比例" prop="nutritionistRate">
-            <el-select
-              v-model="form.nutritionistRate"
-              placeholder="请选择"
-            >
+            <el-select v-model="form.nutritionistRate" placeholder="请选择">
               <el-option
                 v-for="dict in orderRateOptions"
                 :key="dict.dictValue"
@@ -672,12 +673,15 @@ export default {
     handleOrderTypeChange() {
       // console.log(this.form.orderTypeList);
     },
+    handleOnChanelIdChange(val) {
+      this.initPlanningAndOperation();
+    },
   },
   watch: {
     // 监听收款账号的变化
-    "form.accountId": function (newVal, oldVal) {
-      this.initPlanningAndOperation();
-    },
+    // "form.accountId": function (newVal, oldVal) {
+    //   this.initPlanningAndOperation();
+    // },
     "form.orderTypeList": function (newVal, oldVal) {
       //判断订单类型是否选择了二开
       if (newVal[1] == 1) {
@@ -697,11 +701,11 @@ export default {
       }
       //判断是否选择了体验单
       if (newVal[0] == 2) {
-         this.afterNutiShow = false;
-         this.form.onSaleId = parseInt(this.onSaleIdOptions[1].dictValue);
-         this.form.serveTimeId = 7;
-         this.form.conditioningProjectId = 12;
-      }else{
+        this.afterNutiShow = false;
+        this.form.onSaleId = parseInt(this.onSaleIdOptions[1].dictValue);
+        this.form.serveTimeId = 7;
+        this.form.conditioningProjectId = 12;
+      } else {
         this.form.onSaleId = null;
         this.form.serveTimeId = 90;
         this.afterNutiShow = true;
diff --git a/stdiet-ui/src/components/OrderEdit/index.vue b/stdiet-ui/src/components/OrderEdit/index.vue
index b4d3bb8c5..746c58d91 100644
--- a/stdiet-ui/src/components/OrderEdit/index.vue
+++ b/stdiet-ui/src/components/OrderEdit/index.vue
@@ -11,7 +11,11 @@
       <el-form ref="form" :model="form" :rules="rules" label-width="90px">
         <el-col :span="16">
           <el-form-item label="订单类型" prop="orderTypeName">
-            <el-input v-model="form.orderTypeName" placeholder="" :disabled="true"/>
+            <el-input
+              v-model="form.orderTypeName"
+              placeholder=""
+              :disabled="true"
+            />
           </el-form-item>
         </el-col>
         <el-col :span="8">
@@ -32,8 +36,12 @@
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item label="收款账号" prop="accountId">
-            <el-select v-model="form.accountId" placeholder="请选择">
+          <el-form-item label="进粉渠道" prop="accountId">
+            <el-select
+              v-model="form.accountId"
+              placeholder="请选择"
+              @change="handleOnChannelIdChange"
+            >
               <el-option
                 v-for="dict in accountIdOptions"
                 :key="dict.dictValue"
@@ -389,7 +397,7 @@ export default {
       //是否显示售后、营养师、营养师助理
       afterSaleNutriAssShow: true,
       //是否显示策划、策划助理、运营、运营助理
-      planOperatorShow: true
+      planOperatorShow: true,
     };
   },
   created() {
@@ -571,9 +579,9 @@ export default {
       this.resetForm("form");
       // console.log("--"+obj.orderType);
       this.onSaleShow = this.form.orderType == "2";
-      this.afterSaleNutriAssShow = this.form.orderType != "2" && this.form.afterSaleCommissOrder == 0;
+      this.afterSaleNutriAssShow =
+        this.form.orderType != "2" && this.form.afterSaleCommissOrder == 0;
       this.planOperatorShow = this.form.afterSaleCommissOrder == 0;
-
     },
     handleOnClosed() {
       this.reset();
@@ -609,13 +617,17 @@ export default {
         };
       }
     },
-  },
-  watch: {
-    // 监听收款账号的变化
-    "form.accountId": function (newVal, oldVal) {
-      // console.log("updte");
+    handleOnChannelIdChange(val) {
+      console.log(val);
       this.initPlanningAndOperation();
     },
   },
+  watch: {
+    // 监听收款账号的变化
+    // "form.accountId": function (newVal, oldVal) {
+    //   // console.log("updte");
+    //   this.initPlanningAndOperation();
+    // },
+  },
 };
 </script>

From 91f880bd8dcabe23a01a4243fd30888666f995dc Mon Sep 17 00:00:00 2001
From: huangdeliang <huangdeliang@skieer.com>
Date: Mon, 19 Apr 2021 16:39:34 +0800
Subject: [PATCH 6/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=BB=84=E7=93=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../src/views/custom/recipesShow/utils.js     | 31 ++++++++++---------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/stdiet-ui/src/views/custom/recipesShow/utils.js b/stdiet-ui/src/views/custom/recipesShow/utils.js
index 2ded2c2b6..ee7112c3d 100644
--- a/stdiet-ui/src/views/custom/recipesShow/utils.js
+++ b/stdiet-ui/src/views/custom/recipesShow/utils.js
@@ -19,21 +19,22 @@ export function getProcessMenuData(menuData) {
         igdList: cur.igdList.reduce((igdArr, igdData) => {
           if (igdData.id > 0) {
             const tarDetail = cur.detail.find(obj => obj.id === igdData.id);
-            if (tarDetail) {
-              igdArr.push({
-                id: igdData.id,
-                name: igdData.name,
-                carbonRatio: igdData.carbonRatio,
-                fatRatio: igdData.fatRatio,
-                proteinRatio: igdData.proteinRatio,
-                cusUnit: tarDetail.cus_unit,
-                cusWeight: tarDetail.cus_weight,
-                weight: parseFloat(tarDetail.weight),
-                notRec: igdData.notRec,
-                rec: igdData.rec,
-                type: igdData.type
-              });
-            }
+
+            igdArr.push({
+              id: igdData.id,
+              name: igdData.name,
+              carbonRatio: igdData.carbonRatio,
+              fatRatio: igdData.fatRatio,
+              proteinRatio: igdData.proteinRatio,
+              cusUnit: tarDetail ? tarDetail.cus_unit : igdData.cusUnit,
+              cusWeight: tarDetail ? tarDetail.cus_weight : igdData.cusWeight,
+              weight: tarDetail
+                ? parseFloat(tarDetail.weight)
+                : parseFloat(igdData.weight),
+              notRec: igdData.notRec,
+              rec: igdData.rec,
+              type: igdData.type
+            });
           }
           return igdArr;
         }, [])

From 7358392d891f6c9ca7a981af6c1f89fe7d9fc8a0 Mon Sep 17 00:00:00 2001
From: huangdeliang <huangdeliang@skieer.com>
Date: Mon, 19 Apr 2021 16:49:26 +0800
Subject: [PATCH 7/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 stdiet-ui/src/views/custom/recipesShow/utils.js | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/stdiet-ui/src/views/custom/recipesShow/utils.js b/stdiet-ui/src/views/custom/recipesShow/utils.js
index ee7112c3d..70aa98554 100644
--- a/stdiet-ui/src/views/custom/recipesShow/utils.js
+++ b/stdiet-ui/src/views/custom/recipesShow/utils.js
@@ -20,6 +20,10 @@ export function getProcessMenuData(menuData) {
           if (igdData.id > 0) {
             const tarDetail = cur.detail.find(obj => obj.id === igdData.id);
 
+            if (tarDetail && tarDetail.weight === -1) {
+              return igdArr;
+            }
+
             igdArr.push({
               id: igdData.id,
               name: igdData.name,