yumeng преди 2 години
родител
ревизия
e721cc52c8

+ 19 - 4
ruixuan-live/src/main/java/com/ruixuan/isc/controller/SupplyChainController.java

@@ -13,6 +13,7 @@ import lombok.SneakyThrows;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.OutputStream;
@@ -174,7 +175,11 @@ public class SupplyChainController extends BaseController {
             @ApiParam("商品Id") @RequestParam(value = "itemId", required = false) String itemId,
             @ApiParam("商品名称") @RequestParam(value = "itemTitle", required = false) String itemTitle,
             @ApiParam("开始时间") @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
-            @ApiParam("结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate) {
+            @ApiParam("结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate,
+            @ApiParam("排序字段") @RequestParam(value = "fieId", required = false) String fieId,
+            @ApiParam("排序方式") @RequestParam(value = "sort", required = false) String sort
+
+    ) {
         Map<String, Object> requestMap = new HashMap<>();
         if (!Check.isNull(orderStartDate)) {
             Long start = DateUtils.getStartLongTime(orderStartDate);
@@ -190,6 +195,10 @@ public class SupplyChainController extends BaseController {
         if (!Check.isNull(itemTitle)) {
             requestMap.put("itemTitle", itemTitle);
         }
+
+        requestMap.put("fieId", fieId);
+        requestMap.put("sort", sort);
+
         TableDataInfo dataInfo = new TableDataInfo();
         if (Check.isNullMap(requestMap)) {
             dataInfo.setCode(-1);
@@ -910,7 +919,9 @@ public class SupplyChainController extends BaseController {
     @ApiOperation(value = "供应链管理员统计列表")
     public TableDataInfo adminReportList(
             @ApiParam("开始时间") @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
-            @ApiParam("结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate) {
+            @ApiParam("结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate,
+            @ApiParam("用户ID") @RequestParam(value = "userId", required = false) Long userId
+    ) {
         Map<String, Object> requestMap = new HashMap<>();
         if (!Check.isNull(orderStartDate)) {
             Long start = DateUtils.getStartLongTime(orderStartDate);
@@ -920,6 +931,10 @@ public class SupplyChainController extends BaseController {
             Long end = DateUtils.getEndLongTime(orderEndDate);
             requestMap.put("end", end);
         }
+        if (!Check.isNull(userId)) {
+            requestMap.put("userId", userId);
+        }
+
         TableDataInfo dataInfo = new TableDataInfo();
         if (Check.isNullMap(requestMap)) {
             dataInfo.setCode(-1);
@@ -948,8 +963,8 @@ public class SupplyChainController extends BaseController {
             @ApiParam("userId") @RequestParam(value = "userId", required = false) Long userId,
             @ApiParam("开始时间") @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
             @ApiParam("结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate,
-            @ApiParam("商品Id") @RequestParam(value = "itemId", required = false) String itemId,
-            @ApiParam("商品名称") @RequestParam(value = "itemTitle", required = false) Long itemTitle) {
+            @ApiParam("商品Id") @RequestParam(value = "itemId", required = false) Long itemId,
+            @ApiParam("商品名称") @RequestParam(value = "itemTitle", required = false) String itemTitle) {
         Map<String, Object> requestMap = new HashMap<>();
         if (!Check.isNull(userId)) {
             requestMap.put("userId", userId);

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

@@ -146,7 +146,7 @@
             and item_title like concat(concat('%',#{itemTitle}),'%')
         </if>
         group by item_id) t
-        order by t.orderNum desc
+        order by ${fieId} ${sort}
     </select>
 
     <select id="getTopPromoterByItemId" resultType="com.alibaba.fastjson.JSONObject">
@@ -634,6 +634,9 @@
         left join kuaishou_supply_chain t2
         on t1.item_id = t2.item_id
         where 1= 1
+        <if test="userId != null and userId != ''">
+            and t1.user_id = #{userId}
+        </if>
         <if test="start != null and start != ''">
             and t2.order_create_time &gt;= #{start}
         </if>
@@ -677,10 +680,10 @@
             and t2.order_create_time &lt;= #{end}
         </if>
         <if test="itemId != null and itemId != ''">
-            and item_id = #{itemId}
+            and t1.item_id = #{itemId}
         </if>
         <if test="itemTitle != null and itemTitle != ''">
-            and item_title like concat(concat('%',#{itemTitle}),'%')
+            and t1.item_title like concat(concat('%',#{itemTitle}),'%')
         </if>
         group by t1.item_id) t
         order by t.orderNum desc
@@ -721,7 +724,7 @@
             count(t.oid) as 'orderNum'
         </if>
         <if test="type == 'validOrderNum' ">
-            sum(case when t.order_status = 80 then 1 else 0 end) as 'invalidOrderNum'
+            sum(case when t.order_status = 80 then 1 else 0 end) as 'validOrderNum'
         </if>
         <if test="type == 'orderAmount' ">
             sum(t.order_amount) as 'orderAmount'
@@ -749,7 +752,7 @@
         </if>
         ) t
         group by FROM_UNIXTIME(t.order_create_time / 1000, '%y-%m-%d')
-        order by FROM_UNIXTIME(t.order_create_time / 1000, '%y-%m-%d') desc
+        order by FROM_UNIXTIME(t.order_create_time / 1000, '%y-%m-%d') asc
     </select>