yumeng %!s(int64=2) %!d(string=hai) anos
pai
achega
9d204f5845

+ 45 - 2
ruixuan-live/src/main/java/com/ruixuan/isc/controller/SupplyChainController.java

@@ -820,6 +820,13 @@ public class SupplyChainController extends BaseController {
         return getDataTable(list);
     }
 
+  @GetMapping("/getSupplyChainCourtshipUserList")
+    @ApiOperation(value = "获取供应链成员列表")
+    public TableDataInfo getSupplyChainCourtshipUserList() {
+        List<JSONObject> list = supplyChainService.getSupplyChainCourtshipUserList();
+        return getDataTable(list);
+    }
+
 
     /**
      * 获取商品绑定人员列表
@@ -944,6 +951,8 @@ public class SupplyChainController extends BaseController {
     public TableDataInfo adminReportList(
             @ApiParam("开始时间") @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
             @ApiParam("结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate,
+            @ApiParam("结束时间") @RequestParam(value = "bindStartDate", required = false) String bindStartDate,
+            @ApiParam("结束时间") @RequestParam(value = "bindEndDate", required = false) String bindEndDate,
             @ApiParam("用户ID") @RequestParam(value = "userId", required = false) Long userId
     ) {
         Map<String, Object> requestMap = new HashMap<>();
@@ -955,6 +964,17 @@ public class SupplyChainController extends BaseController {
             Long end = DateUtils.getEndLongTime(orderEndDate);
             requestMap.put("end", end);
         }
+
+        if (!Check.isNull(bindStartDate)) {
+            Long start = DateUtils.getStartLongTime(bindStartDate);
+            requestMap.put("start", start);
+        }
+
+        if (!Check.isNull(bindEndDate)) {
+            Long end = DateUtils.getEndLongTime(bindEndDate);
+            requestMap.put("end", end);
+        }
+
         if (!Check.isNull(userId)) {
             requestMap.put("userId", userId);
         }
@@ -965,8 +985,14 @@ public class SupplyChainController extends BaseController {
             dataInfo.setMsg("入参不能为空");
             return dataInfo;
         }
+        List<JSONObject> list = new ArrayList<>();
         startPage();
-        List<JSONObject> list = supplyChainService.adminReportList(requestMap);
+        if(!Check.isNull(orderStartDate) && !Check.isNull(orderEndDate)){
+            list = supplyChainService.adminReportList(requestMap);
+        } else if( !Check.isNull(bindStartDate) &&!Check.isNull(bindEndDate) ){
+            list = supplyChainService.adminReportListByBind(requestMap);
+        }
+
         return getDataTable(list);
     }
 
@@ -986,10 +1012,27 @@ public class SupplyChainController extends BaseController {
             Long end = DateUtils.getEndLongTime(requestJson.getString("orderEndDate"));
             requestMap.put("end", end);
         }
+
+        if (!Check.isNull(requestJson.getString("bindStartDate"))) {
+            Long start = DateUtils.getStartLongTime(requestJson.getString("bindStartDate"));
+            requestMap.put("start", start);
+        }
+
+        if (!Check.isNull(requestJson.getString("bindEndDate"))) {
+            Long end = DateUtils.getEndLongTime(requestJson.getString("bindEndDate"));
+            requestMap.put("end", end);
+        }
+
         if (!Check.isNull(requestJson.getString("userId"))) {
             requestMap.put("userId", requestJson.getString("userId"));
         }
-        List<JSONObject> list = supplyChainService.exportAdminReportList(requestMap);
+        List<JSONObject> list = new ArrayList<>();
+        if(!Check.isNull(requestJson.getString("orderStartDate")) && !Check.isNull(requestJson.getString("orderEndDate"))){
+            list = supplyChainService.exportAdminReportList(requestMap);
+        }else if(!Check.isNull(requestJson.getString("bindStartDate")) && !Check.isNull(requestJson.getString("bindEndDate"))){
+            list = supplyChainService.exportAdminReportListByBind(requestMap);
+        }
+
         List<List<Object>> exportList = new ArrayList<>();
         if (!Check.isNull(list)) {
             for (int i = 0; i < list.size(); i++) {

+ 6 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/SupplyChainMapper.java

@@ -102,4 +102,10 @@ public interface SupplyChainMapper {
     List<JSONObject> exportBdReportList(Map<String, Object> requestMap);
 
     List<JSONObject> exportAdminReportList(Map<String, Object> requestMap);
+
+    List<JSONObject> getSupplyChainCourtshipUserList();
+
+    List<JSONObject> adminReportListByBind(Map<String, Object> requestMap);
+
+    List<JSONObject> exportAdminReportListByBind(Map<String, Object> requestMap);
 }

+ 7 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/ISupplyChainService.java

@@ -123,4 +123,11 @@ public interface ISupplyChainService {
     List<JSONObject> exportBdReportList(Map<String, Object> requestMap);
 
     List<JSONObject> exportAdminReportList(Map<String, Object> requestMap);
+
+    List<JSONObject> getSupplyChainCourtshipUserList();
+
+    // 招商管理 绑定时间查询
+    List<JSONObject> adminReportListByBind(Map<String, Object> requestMap);
+    // 招商管理 绑定时间下载
+    List<JSONObject> exportAdminReportListByBind(Map<String, Object> requestMap);
 }

+ 15 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/SupplyChainServiceImpl.java

@@ -274,4 +274,19 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
     public List<JSONObject> exportAdminReportList(Map<String, Object> requestMap) {
         return supplyChainMapper.exportAdminReportList(requestMap);
     }
+
+    @Override
+    public List<JSONObject> getSupplyChainCourtshipUserList() {
+        return supplyChainMapper.getSupplyChainCourtshipUserList();
+    }
+
+    @Override
+    public List<JSONObject> adminReportListByBind(Map<String, Object> requestMap) {
+        return supplyChainMapper.adminReportListByBind(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> exportAdminReportListByBind(Map<String, Object> requestMap) {
+        return supplyChainMapper.exportAdminReportListByBind(requestMap);
+    }
 }

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

@@ -669,13 +669,10 @@
                  left join sys_user_role t2 on t1.role_id = t2.role_id
                  left join sys_user t3 on t2.user_id = t3.user_id
         where t1.role_key in (
-                              'supplyChainAdmin',
+                              'association',
                               'associationManager',
                               'bd',
-                              'bdManager',
-                              'association',
-                              'courtshipManager',
-                              'courtship'
+                              'bdManager'
             )
         group by t3.user_id
         order by t3.create_time asc
@@ -1616,14 +1613,14 @@
         count(distinct t2.item_id) as 'itemCount',
         count(t2.oid) as 'orderNum',
         sum(case when t2.order_status != 80 then 1 else 0 end) as 'validOrderNUm',
-        round(sum(case when t2.order_status != 80 then 1 else 0 end) / count(t2.oid),4) as 'validRadio',
+        round(sum(case when t2.order_status != 80 then 1 else 0 end) / count(t2.oid) * 100,2) as 'validRadio',
         sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) as 'deliveryNum',
         sum(case when t2.send_status = 0 and t2.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
         round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case
         when t2.order_status != 80
         then 1
-        else 0 end),
-        4) as 'deliveryRadio',
+        else 0 end) *  100,
+        2) as 'deliveryRadio',
         sum(case when t2.order_status = 80 then 1 else 0 end) as 'invalidOrderNUm',
         round(sum(case when t2.order_status != 80 then t2.pay_amount else 0 end) / 100 , 2) as 'payAmount',
         round(sum(case
@@ -1654,4 +1651,105 @@
         </if>
         order by t.orderNum desc
     </select>
+    <select id="getSupplyChainCourtshipUserList" resultType="com.alibaba.fastjson.JSONObject">
+         select t3.user_id as 'userId', t3.nick_name as 'nickMame', t1.role_name as 'roleName', t3.status
+        from sys_role t1
+                 left join sys_user_role t2 on t1.role_id = t2.role_id
+                 left join sys_user t3 on t2.user_id = t3.user_id
+        where t1.role_key in (
+                              'courtship',
+                              'courtshipManager'
+            )
+        group by t3.user_id
+        order by t3.create_time asc
+    </select>
+    <select id="adminReportListByBind" resultType="com.alibaba.fastjson.JSONObject">
+        select  *  from (
+        select t1.user_id                                                                             as 'userId',
+        t1.user_name                                                                           as 'userName',
+        count(distinct t1.item_id)                                                             as 'itemCount',
+        count(t2.oid)                                                                          as 'orderNum',
+        count(distinct t3.courier_number) as 'sendSampleCount',
+        sum(case when t2.order_status != 80 then 1 else 0 end)                                 as 'validOrderNUm',
+        round(sum(case when t2.order_status != 80 then 1 else 0 end) / count(t2.oid), 4)       as 'validRadio',
+        sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end)          as 'deliveryNum',
+        sum(case when t2.send_status = 0 and t2.order_status != 80 then 1 else 0 end)          as 'notDeliveryNum',
+        round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case
+        when t2.order_status != 80
+        then 1
+        else 0 end),
+        4)                                                                               as 'deliveryRadio',
+        sum(case when t2.order_status = 80 then 1 else 0 end)                                  as 'invalidOrderNUm',
+        sum(case when t2.order_status != 80 then t2.pay_amount else 0 end)                     as 'payAmount',
+        sum(case
+        when t2.order_status != 80 then t2.regimental_promotion_amount
+        else 0 end)                                                                    as 'regimentalPromotionAmount',
+        sum(case when t2.order_status != 80 then t2.total_regimental_settle_amount else 0 end) as
+        'totalRegimentalSettleAmount'
+        from kuaishou_item_list t1
+        left join (select item_id,
+        oid,
+        order_status,
+        send_status,
+        pay_amount,
+        regimental_promotion_amount,
+        total_regimental_settle_amount
+        from kuaishou_supply_chain
+        where order_create_time &gt;= #{start}) t2
+        on t1.item_id = t2.item_id
+        left join (select item_id, courier_number
+        from kuaishou_item_collect_samples
+        where courier_number_time >= from_unixtime(#{start}/1000,'%Y-%m-%d %H:%i:%s')) t3 on t1.item_id = t3.item_id
+        where t1.create_time >= from_unixtime(#{start}/1000,'%Y-%m-%d %H:%i:%s')
+        and t1.create_time &lt;= from_unixtime(#{end}/1000,'%Y-%m-%d %H:%i:%s')
+        <if test="userId != null and userId != ''">
+            and t1.userId = #{userId}
+        </if>
+        group by t1.user_id ) t order by t.orderNum desc
+    </select>
+    <select id="exportAdminReportListByBind" resultType="com.alibaba.fastjson.JSONObject">
+        select  *  from (
+        select t1.user_id                                                                             as 'userId',
+        t1.user_name                                                                           as 'userName',
+        count(distinct t1.item_id)                                                             as 'itemCount',
+        count(t2.oid)                                                                          as 'orderNum',
+        count(distinct t3.courier_number) as 'sendSampleCount',
+        sum(case when t2.order_status != 80 then 1 else 0 end) as 'validOrderNUm',
+        round(sum(case when t2.order_status != 80 then 1 else 0 end) / count(t2.oid) *  100,2) as 'validRadio',
+        sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) as 'deliveryNum',
+        sum(case when t2.send_status = 0 and t2.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
+        round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case
+        when t2.order_status != 80
+        then 1
+        else 0 end) * 100,
+        2) as 'deliveryRadio',
+        sum(case when t2.order_status = 80 then 1 else 0 end) as 'invalidOrderNUm',
+        round(sum(case when t2.order_status != 80 then t2.pay_amount else 0 end) / 100 , 2) as 'payAmount',
+        round(sum(case
+        when t2.order_status != 80 then t2.regimental_promotion_amount
+        else 0 end) / 100, 2 )as 'regimentalPromotionAmount',
+        round(sum(case when t2.order_status != 80 then t2.total_regimental_settle_amount else 0 end) / 100 , 2) as
+        'totalRegimentalSettleAmount'
+        from kuaishou_item_list t1
+        left join (select item_id,
+        oid,
+        order_status,
+        send_status,
+        pay_amount,
+        regimental_promotion_amount,
+        total_regimental_settle_amount
+        from kuaishou_supply_chain
+        where order_create_time &gt;= #{start}) t2
+        on t1.item_id = t2.item_id
+        left join (select item_id, courier_number
+        from kuaishou_item_collect_samples
+        where courier_number_time >= from_unixtime(#{start}/1000,'%Y-%m-%d %H:%i:%s')) t3 on t1.item_id = t3.item_id
+        where t1.create_time >= from_unixtime(#{start}/1000,'%Y-%m-%d %H:%i:%s')
+        and t1.create_time &lt;= from_unixtime(#{end}/1000,'%Y-%m-%d %H:%i:%s')
+        <if test="userId != null and userId != ''">
+            and t1.userId = #{userId}
+        </if>
+        group by t1.user_id ) t order by t.orderNum desc
+
+    </select>
 </mapper>