浏览代码

社群权限放开

zhaoxian 2 年之前
父节点
当前提交
0bb81f70fc

+ 6 - 6
ruixuan-admin/src/main/resources/application-dev.yml

@@ -47,12 +47,12 @@ spring:
     druid:
       # 主库数据源
       master:
-        #        url: jdbc:mysql://139.186.165.84:3306/ruixuan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
-        #        username: hcst
-        #        password: hcst@2020
-        url: jdbc:mysql://139.186.27.96:3390/ruixuan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
-        username: data
-        password: hcst@2021
+        url: jdbc:mysql://139.186.165.84:3306/ruixuan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+        username: hcst
+        password: hcst@2020
+      #        url: jdbc:mysql://139.186.27.96:3390/ruixuan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+      #        username: data
+      #        password: hcst@2021
       # 从库数据源
       slave:
         # 从数据源开关/默认关闭

+ 12 - 4
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouItemCollectSamplesServiceImpl.java

@@ -359,9 +359,12 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
     public JSONObject getPersonalInfo(Long userId, String type) {
         String roleKey = userService.getRoleKeyByUserId(String.valueOf(userId));
         List<Long> userList = null;
-        if ("courtshipManager".equals(roleKey) || "bdManager".equals(roleKey) || "associationManager".equals(roleKey)) {
+        if ("courtshipManager".equals(roleKey) || "bdManager".equals(roleKey)) {
             Long deptId = deptService.getDeptIdByUserId(userId);
             userList = deptService.getDeptUserListByDeptId(deptId);
+        } else if (roleKey.contains("association")) {
+            //社群查看所有 all
+            userList = null;
         } else {
             userList = Arrays.asList(userId);
         }
@@ -373,7 +376,6 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
                 userList = deptService.getDeptUserListByDeptId(150200L);
             }
         }
-
         JSONObject returnJson = new JSONObject();
         JSONObject data = new JSONObject();
         SysUser sysUser = userService.selectUserById(userId);
@@ -396,9 +398,12 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
     public JSONObject getOrderData(Long userId, String startDate, String endDate, String type) {
         String roleKey = userService.getRoleKeyByUserId(String.valueOf(userId));
         List<Long> userList = null;
-        if ("courtshipManager".equals(roleKey) || "bdManager".equals(roleKey) || "associationManager".equals(roleKey)) {
+        if ("courtshipManager".equals(roleKey) || "bdManager".equals(roleKey)) {
             Long deptId = deptService.getDeptIdByUserId(userId);
             userList = deptService.getDeptUserListByDeptId(deptId);
+        } else if (roleKey.contains("association")) {
+            //社群查看所有 all
+            userList = null;
         } else {
             userList = Arrays.asList(userId);
         }
@@ -541,9 +546,12 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
     public JSONObject getDataAnalysis(Long userId, String type) {
         String roleKey = userService.getRoleKeyByUserId(String.valueOf(userId));
         List<Long> userList = null;
-        if ("courtshipManager".equals(roleKey) || "bdManager".equals(roleKey) || "associationManager".equals(roleKey)) {
+        if ("courtshipManager".equals(roleKey) || "bdManager".equals(roleKey)) {
             Long deptId = deptService.getDeptIdByUserId(userId);
             userList = deptService.getDeptUserListByDeptId(deptId);
+        } else if (roleKey.contains("association")) {
+            //社群查看所有 all
+            userList = null;
         } else {
             userList = Arrays.asList(userId);
         }

+ 12 - 7
ruixuan-live/src/main/resources/mapper/isc/KuaishouItemCollectSamplesMapper.xml

@@ -484,14 +484,14 @@
         select count(1) as 'sampleCount'
         from kuaishou_item_collect_samples
         where collect_sample_status = #{status}
-        <if test="userType == 1">
+        <if test="userList!=null and userType == 1">
             AND collect_sample_id in
             <foreach collection="userList" item="item" separator=","
                      open="(" close=")">
                 #{item}
             </foreach>
         </if>
-        <if test="userType == 2">
+        <if test="userList!=null and userType == 2">
             AND item_create_id in
             <foreach collection="userList" item="item" separator=","
                      open="(" close=")">
@@ -542,11 +542,15 @@
     <select id="getItemIdsByCreateId" resultType="Long">
         select item_id
         from kuaishou_item_collect_samples
-        where item_create_id in
-        <foreach collection="userList" item="item" separator=","
-                 open="(" close=")">
-            #{item}
-        </foreach>
+        <where>
+            <if test="userList != null and userList.size() > 0 ">
+                AND item_create_id in
+                <foreach collection="userList" item="item" separator=","
+                         open="(" close=")">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
     </select>
 
     <select id="queryProductList" resultType="com.alibaba.fastjson.JSONObject">
@@ -583,6 +587,7 @@
             </if>
         </where>
         GROUP BY item_id
+        ORDER BY create_time DESC
         )t
         where 1=1
         <if test="validorderStart != null and validorderEnd != null">

+ 17 - 12
ruixuan-live/src/main/resources/mapper/isc/KuaishouPromoterMapper.xml

@@ -100,23 +100,28 @@
         (
         SELECT count(promoter_id) as 'count'
         FROM kuaishou_promoter
-        WHERE user_id in
-        <foreach collection="userList" item="item" separator=","
-                 open="(" close=")">
-            #{item}
-        </foreach>
-        AND DATE_FORMAT(create_time, '%Y-%m-%d') >= #{start}
+        WHERE DATE_FORMAT(create_time, '%Y-%m-%d') >= #{start}
         AND DATE_FORMAT(create_time, '%Y-%m-%d') &lt;= #{end}
+        <if test="userList != null and userList.size() > 0 ">
+            AND user_id in
+            <foreach collection="userList" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
         ) t1
         LEFT JOIN
         (SELECT count(promoter_id) as 'count'
         FROM kuaishou_promoter
-        WHERE user_id in
-        <foreach collection="userList" item="item" separator=","
-                 open="(" close=")">
-            #{item}
-        </foreach>
-        AND DATE_FORMAT(create_time, '%Y-%m-%d') = #{end}) t2 ON 1 = 1
+        WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = #{end}
+        <if test="userList != null and userList.size() > 0 ">
+            AND user_id in
+            <foreach collection="userList" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        ) t2 ON 1 = 1
     </select>
 
 

+ 8 - 6
ruixuan-live/src/main/resources/mapper/isc/SupplyChainMapper.xml

@@ -1134,13 +1134,15 @@
         LEFT JOIN (
         SELECT count(promoter_id) as 'promoterCount', DATE_FORMAT(create_time, '%Y-%m-%d') as 'date'
         FROM kuaishou_promoter
-        WHERE user_id in
-        <foreach collection="userList" item="item" separator=","
-                 open="(" close=")">
-            #{item}
-        </foreach>
-        AND DATE_FORMAT(create_time, '%Y-%m-%d') >= #{start}
+        WHERE DATE_FORMAT(create_time, '%Y-%m-%d') >= #{start}
         AND DATE_FORMAT(create_time, '%Y-%m-%d') &lt;= #{end}
+        <if test="userList != null and userList.size() > 0 ">
+            AND user_id in
+            <foreach collection="userList" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
         GROUP BY DATE_FORMAT(create_time, '%Y-%m-%d')
         ) t2 ON t1.FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d') = t2.date
         WHERE order_status != 80