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

供应链管理员权限和社群一致

zhaoxian 2 éve
szülő
commit
cbc70ca321

+ 51 - 49
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouItemCollectSamplesServiceImpl.java

@@ -359,10 +359,10 @@ 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)) {
+        if ("courtshipManager".equals(roleKey) || "bdManager".equals(roleKey) || "associationManager".equals(roleKey)) {
             Long deptId = deptService.getDeptIdByUserId(userId);
             userList = deptService.getDeptUserListByDeptId(deptId);
-        } else if (roleKey.contains("association") || "supplyChainAdmin".equals(roleKey)) {
+        } else if ("supplyChainAdmin".equals(roleKey)) {
             //社群查看所有 all
             userList = null;
         } else {
@@ -572,55 +572,57 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
     // 渠道—数据分析
     private JSONObject getDataAnalysisByChannel(List<Long> userList) {
         JSONObject data = new JSONObject();
-        List<Long> promoterIds = promoterService.selectPromoterIdList(userList);
-        if (Check.isNotNull(promoterIds)) {
-            //当天
-            String end = DateUtils.getNowDateStr();
-            //当前月份第一天
-            String start = DateUtils.getFirstDayByMonth();
-            Map<String, Object> map = new HashMap<>();
-            map.put("start", start);
-            map.put("end", end);
-            map.put("userList", userList);
-            map.put("promoterIds", promoterIds);
-            map.put("startLong", DateUtils.getStartLongTime(start));
-            map.put("endLong", DateUtils.getEndLongTime(end));
-            List<JSONObject> list = supplyChainService.getMonthOrderAmount(map);
-            List<String> allDates = DateUtils.getAllDatesOfTwoTimes(start, end);
-            if (Check.isNull(list) || list.size() != allDates.size()) {
-                String orderAmountStr = JSONObject.toJSONString(list);
-                for (String date : allDates) {
-                    if (!orderAmountStr.contains(date)) {
-                        JSONObject obj = new JSONObject();
-                        obj.put("date", date);
-                        obj.put("orderAmount", 0);
-                        obj.put("totalRegimentalSettleAmount", 0);
-                        obj.put("promoterCount", 0);
-                        list.add(obj);
-                    }
+        List<Long> promoterIds = null;
+        if (Check.isNotNull(userList)) {
+            promoterIds = promoterService.selectPromoterIdList(userList);
+        }
+
+        //当天
+        String end = DateUtils.getNowDateStr();
+        //当前月份第一天
+        String start = DateUtils.getFirstDayByMonth();
+        Map<String, Object> map = new HashMap<>();
+        map.put("start", start);
+        map.put("end", end);
+        map.put("userList", userList);
+        map.put("promoterIds", promoterIds);
+        map.put("startLong", DateUtils.getStartLongTime(start));
+        map.put("endLong", DateUtils.getEndLongTime(end));
+        List<JSONObject> list = supplyChainService.getMonthOrderAmount(map);
+        List<String> allDates = DateUtils.getAllDatesOfTwoTimes(start, end);
+        if (Check.isNull(list) || list.size() != allDates.size()) {
+            String orderAmountStr = JSONObject.toJSONString(list);
+            for (String date : allDates) {
+                if (!orderAmountStr.contains(date)) {
+                    JSONObject obj = new JSONObject();
+                    obj.put("date", date);
+                    obj.put("orderAmount", 0);
+                    obj.put("totalRegimentalSettleAmount", 0);
+                    obj.put("promoterCount", 0);
+                    list.add(obj);
                 }
-                //排序
-                Collections.sort(list, new Comparator<JSONObject>() {
-                    @Override
-                    public int compare(JSONObject o1, JSONObject o2) {
-                        return o1.getString("date").compareTo(o2.getString("date"));
-                    }
-                });
-            }
-            data.put("list", list);
-            map.put("toStartLong", DateUtils.getStartLongTime(end));
-            JSONObject amount = supplyChainService.getMonthOrderAmountTotal(map);
-            if (Check.isNotNull(amount)) {
-                data.put("orderAmount", amount.getInteger("orderAmount"));
-                data.put("totalRegimentalSettleAmount", amount.getInteger("totalRegimentalSettleAmount"));
-                data.put("orderAmountRate", amount.getString("orderAmountRate"));
-                data.put("totalRegimentalSettleAmountRate", amount.getString("totalRegimentalSettleAmountRate"));
-            }
-            JSONObject promoter = promoterService.getgetMonthPromoterTotal(userList, start, end);
-            if (Check.isNotNull(promoter)) {
-                data.put("promoterCount", promoter.getString("count"));
-                data.put("promoterRate", promoter.getString("rate"));
             }
+            //排序
+            Collections.sort(list, new Comparator<JSONObject>() {
+                @Override
+                public int compare(JSONObject o1, JSONObject o2) {
+                    return o1.getString("date").compareTo(o2.getString("date"));
+                }
+            });
+        }
+        data.put("list", list);
+        map.put("toStartLong", DateUtils.getStartLongTime(end));
+        JSONObject amount = supplyChainService.getMonthOrderAmountTotal(map);
+        if (Check.isNotNull(amount)) {
+            data.put("orderAmount", amount.getInteger("orderAmount"));
+            data.put("totalRegimentalSettleAmount", amount.getInteger("totalRegimentalSettleAmount"));
+            data.put("orderAmountRate", amount.getString("orderAmountRate"));
+            data.put("totalRegimentalSettleAmountRate", amount.getString("totalRegimentalSettleAmountRate"));
+        }
+        JSONObject promoter = promoterService.getgetMonthPromoterTotal(userList, start, end);
+        if (Check.isNotNull(promoter)) {
+            data.put("promoterCount", promoter.getString("count"));
+            data.put("promoterRate", promoter.getString("rate"));
         }
         return data;
     }