Browse Source

激励添加导出,达人添加排序

zhaoxian 2 năm trước cách đây
mục cha
commit
d133a8eb8a

+ 58 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouItemCollectSamplesController.java

@@ -46,6 +46,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
@@ -640,6 +641,63 @@ public class KuaishouItemCollectSamplesController extends BaseController {
         }
         return null;
     }
+
+
+    /**
+     * 激励列表导出
+     *
+     * @return
+     */
+    @PostMapping("/exportProductList")
+    @ApiOperation(value = "激励列表导出")
+    @ResponseBody
+    public void exportProductList(HttpServletResponse response,
+                                  @ApiParam("商品ID") @RequestParam(value = "itemId", required = false) Long itemId,
+                                  @ApiParam("商品标题") @RequestParam(value = "itemTitle", required = false) String itemTitle,
+                                  @ApiParam("达人id") @RequestParam(value = "promoterId", required = false) Long promoterId,
+                                  @ApiParam("达人昵称") @RequestParam(value = "promoterNickName", required = false) String promoterNickName,
+                                  @ApiParam("商品单价起始价") @RequestParam(value = "reservePriceStart", required = false) Double reservePriceStart,
+                                  @ApiParam("商品单价结束价") @RequestParam(value = "reservePriceEnd", required = false) Double reservePriceEnd,
+                                  @ApiParam("有效订单数起始数") @RequestParam(value = "validorderStart", required = false) Double validorderStart,
+                                  @ApiParam("有效订单数结束数") @RequestParam(value = "validorderEnd", required = false) Double validorderEnd,
+                                  @ApiParam("起始时间") @RequestParam(value = "startDate", required = true) String startDate,
+                                  @ApiParam("结束时间") @RequestParam(value = "endDate", required = true) String endDate) throws IOException {
+        Map<String, Object> map = new HashMap<>();
+        map.put("itemId", itemId);
+        map.put("itemTitle", itemTitle);
+        map.put("promoterId", promoterId);
+        map.put("promoterNickName", promoterNickName);
+        map.put("reservePriceStart", reservePriceStart);
+        map.put("reservePriceEnd", reservePriceEnd);
+        map.put("validorderStart", validorderStart);
+        map.put("validorderEnd", validorderEnd);
+        map.put("startDate", startDate);
+        map.put("endDate", endDate);
+        List<JSONObject> list = kuaishouItemCollectSamplesService.exportProductList(map);
+        List<List<Object>> exportList = new ArrayList<>();
+        if (!Check.isNull(list)) {
+            for (int i = 0; i < list.size(); i++) {
+                JSONObject date = list.get(i);
+                List<Object> export = new ArrayList();
+                export.add(date.getString("promoterNickName") + "(" + date.getString("promoterId") + ")");
+                export.add(date.getString("itemTitle") + "(" + date.getString("itemId") + ")");
+                export.add(date.getBigDecimal("reservePrice").divide(new BigDecimal("100")));
+                export.add(date.getBigDecimal("orderAmount").divide(new BigDecimal("100")));
+                export.add(date.getString("validorder"));
+                export.add(date.getBigDecimal("regimentalPromotionAmount").divide(new BigDecimal("100")));
+                exportList.add(export);
+            }
+        }
+        String[] headers = {"达人名称", "商品名称", "商品单价", "销售额", "有效订单", "预估服务费"};
+        OutputStream os = response.getOutputStream();
+        ExportExcelUtils eeu = new ExportExcelUtils();
+        XSSFWorkbook workbook = new XSSFWorkbook();
+        eeu.exportExcel(workbook, 0, "激励列表", headers, exportList);
+        this.setResponseHeader(response, "激励列表.xls");
+        workbook.write(os);
+        os.flush();
+        os.close();
+    }
 }
 
 

+ 23 - 3
ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouPromoterController.java

@@ -38,6 +38,7 @@ public class KuaishouPromoterController extends BaseController {
 
     @Value("${tessdata.path}")
     private String path;
+
     /**
      * 查询快手达人 信息列表
      */
@@ -45,8 +46,27 @@ public class KuaishouPromoterController extends BaseController {
     @ApiOperation(value = "查询快手达人")
     public TableDataInfo list(@ApiParam("创建人ID") @RequestParam(value = "userId", required = true) Long userId,
                               @ApiParam("达人ID") @RequestParam(value = "promoterId", required = false) Long promoterId,
-                              @ApiParam("达人名称") @RequestParam(value = "promoterNickName", required = false) String promoterNickName) {
-        List<KuaishouPromoter> list = kuaishouPromoterService.selectKuaishouPromoterList(userId, promoterId, promoterNickName);
+                              @ApiParam("达人名称") @RequestParam(value = "promoterNickName", required = false) String promoterNickName,
+                              @ApiParam("排序参数") @RequestParam(value = "parameter", required = false) String parameter,
+                              @ApiParam("正序倒叙") @RequestParam(value = "orderBy", required = false) String orderBy
+
+    ) {
+        List<KuaishouPromoter> list = kuaishouPromoterService.selectKuaishouPromoterList(userId, promoterId, promoterNickName, parameter, orderBy);
+        return getDataTable(list);
+    }
+
+    /**
+     * 达人公海
+     */
+    @GetMapping("/list2")
+    @ApiOperation(value = "达人公海")
+    public TableDataInfo list2(@ApiParam("达人ID") @RequestParam(value = "promoterId", required = false) Long promoterId,
+                               @ApiParam("达人名称") @RequestParam(value = "promoterNickName", required = false) String promoterNickName,
+                               @ApiParam("排序参数") @RequestParam(value = "parameter", required = false) String parameter,
+                               @ApiParam("正序倒叙") @RequestParam(value = "orderBy", required = false) String orderBy
+
+    ) {
+        List<KuaishouPromoter> list = kuaishouPromoterService.selectKuaishouPromoterList2(promoterId, promoterNickName, parameter, orderBy);
         return getDataTable(list);
     }
 
@@ -118,7 +138,7 @@ public class KuaishouPromoterController extends BaseController {
         try {
             result.put("code", 0);
             result.put("message", "success");
-            result.put("data", Tess4jClient.getWords(file,path));
+            result.put("data", Tess4jClient.getWords(file, path));
             return result;
         } catch (Exception e) {
             e.printStackTrace();

+ 4 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouPromoterMapper.java

@@ -21,7 +21,8 @@ public interface KuaishouPromoterMapper {
      * @param kuaishouPromoter 快手达人 信息
      * @return 快手达人 信息集合
      */
-    public List<KuaishouPromoter> selectKuaishouPromoterList(@Param("userList") List<Long> userList, @Param("promoterId") Long promoterId, @Param("promoterNickName") String promoterNickName);
+    public List<KuaishouPromoter> selectKuaishouPromoterList(@Param("userList") List<Long> userList, @Param("promoterId") Long promoterId,
+                                                             @Param("promoterNickName") String promoterNickName, @Param("parameter") String parameter, @Param("orderBy") String orderBy);
 
     /**
      * 新增快手达人 信息
@@ -66,4 +67,6 @@ public interface KuaishouPromoterMapper {
     JSONObject getgetMonthPromoterTotal(@Param("userList") List<Long> userList, @Param("start") String start, @Param("end") String end);
 
     void updateKuaishouPromoterByPromoterId(KuaishouPromoter promoters);
+
+    List<KuaishouPromoter> selectAllPromoterList(@Param("promoterId") Long promoterId, @Param("promoterNickName") String promoterNickName, @Param("parameter") String parameter, @Param("orderBy") String orderBy);
 }

+ 2 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouItemCollectSamplesService.java

@@ -101,5 +101,7 @@ public interface IKuaishouItemCollectSamplesService {
     JSONObject getDataAnalysis(Long userId, String startDate, String endDate, String type);
 
     List<JSONObject> queryProductList(Map<String, Object> map);
+
+    List<JSONObject> exportProductList(Map<String, Object> map);
 }
 

+ 3 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouPromoterService.java

@@ -27,7 +27,7 @@ public interface IKuaishouPromoterService {
      * @param kuaishouPromoter 快手达人 信息
      * @return 快手达人 信息集合
      */
-    public List<KuaishouPromoter> selectKuaishouPromoterList(Long userId, Long promoterId, String promoterNickName);
+    public List<KuaishouPromoter> selectKuaishouPromoterList(Long userId, Long promoterId, String promoterNickName, String parameter, String orderBy);
 
     /**
      * 新增快手达人 信息
@@ -60,4 +60,6 @@ public interface IKuaishouPromoterService {
     List<Long> selectPromoterIdList(List<Long> userList);
 
     JSONObject getgetMonthPromoterTotal(List<Long> userList, String start, String end);
+
+    List<KuaishouPromoter> selectKuaishouPromoterList2(Long promoterId, String promoterNickName, String parameter, String orderBy);
 }

+ 5 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouItemCollectSamplesServiceImpl.java

@@ -606,6 +606,11 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
         return kuaishouItemCollectSamplesMapper.queryProductList(map);
     }
 
+    @Override
+    public List<JSONObject> exportProductList(Map<String, Object> map) {
+        return kuaishouItemCollectSamplesMapper.queryProductList(map);
+    }
+
     // 渠道—数据分析
     private JSONObject getDataAnalysisByChannel(List<Long> userList, String startDate, String endDate) {
         JSONObject data = new JSONObject();

+ 22 - 3
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouPromoterServiceImpl.java

@@ -63,7 +63,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
      * @return 快手达人 信息
      */
     @Override
-    public List<KuaishouPromoter> selectKuaishouPromoterList(Long userId, Long promoterId, String promoterNickName) {
+    public List<KuaishouPromoter> selectKuaishouPromoterList(Long userId, Long promoterId, String promoterNickName, String parameter, String orderBy) {
         String roleKey = sysUserService.getRoleKeyByUserId(userId + "");
         List<Long> userList = null;
         //角色:供应链管理员、招商、招商经理可以看到所有的达人信息
@@ -82,8 +82,27 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
         } else {
             return Collections.emptyList();
         }
+        if (Check.isNull(parameter)) {
+            parameter = "t1.create_time";
+        }
+        if (Check.isNull(orderBy)) {
+            orderBy = "desc";
+        }
+        PageUtils.startPage();
+        List<KuaishouPromoter> list = kuaishouPromoterMapper.selectKuaishouPromoterList(userList, promoterId, promoterNickName, parameter, orderBy);
+        return list;
+    }
+
+    @Override
+    public List<KuaishouPromoter> selectKuaishouPromoterList2(Long promoterId, String promoterNickName, String parameter, String orderBy) {
+        if (Check.isNull(parameter)) {
+            parameter = "t1.create_time";
+        }
+        if (Check.isNull(orderBy)) {
+            orderBy = "desc";
+        }
         PageUtils.startPage();
-        List<KuaishouPromoter> list = kuaishouPromoterMapper.selectKuaishouPromoterList(userList, promoterId, promoterNickName);
+        List<KuaishouPromoter> list = kuaishouPromoterMapper.selectAllPromoterList(promoterId, promoterNickName, parameter, orderBy);
         return list;
     }
 
@@ -158,7 +177,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
             String key = DateUtils.getDate() + "_" + id + "_" + promoterId;
             String value = (String) redisUtil.get(key);
             if (Check.isNotNull(value) && "1".equals(value)) {
-                return;
+//                return;
             }
             redisUtil.set(key, "1", 60 * 60 * 24);
 

+ 36 - 1
ruixuan-live/src/main/resources/mapper/isc/KuaishouPromoterMapper.xml

@@ -91,7 +91,42 @@
                 and t1.promoter_nick_name like concat('%', #{promoterNickName}, '%')
             </if>
         </where>
-        order by t1.create_time desc
+        order by ${parameter} ${orderBy}
+    </select>
+
+    <select id="selectAllPromoterList" resultMap="KuaishouPromoterResult">
+        SELECT
+        t1.id,
+        t1.user_id,
+        t1.user_name,
+        t1.promoter_id,
+        t1.promoter_nick_name,
+        t1.`state`,
+        t1.province,
+        t1.commission_requirement,
+        t1.category_requirement,
+        t1.promoter_url,
+        t1.phone,
+        t1.consignee,
+        t1.promoter_address,
+        t1.total_sale,
+        t1.fans_number,
+        t1.avg_video_sales,
+        t1.video_sales,
+        t1.create_time,
+        t2.30day_gmv,
+        t2.30day_order_num
+        FROM
+        kuaishou_promoter t1
+        LEFT JOIN promoter_oerder_amount t2 on t1.promoter_id = t2.promoter_id
+        where t2.30day_order_num > 0
+        <if test="promoterId != null ">
+            and t1.promoter_id = #{promoterId}
+        </if>
+        <if test="promoterNickName != null  and promoterNickName != ''">
+            and t1.promoter_nick_name like concat('%', #{promoterNickName}, '%')
+        </if>
+        order by ${parameter} ${orderBy}
     </select>
 
     <select id="selectKuaishouPromoterById" parameterType="Long" resultMap="KuaishouPromoterResult">