Browse Source

bug修改

yumeng 2 years ago
parent
commit
564491432a

+ 43 - 5
ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouItemCollectSamplesController.java

@@ -24,13 +24,13 @@ import com.ruixuan.common.core.domain.entity.SysUser;
 import com.ruixuan.common.core.page.TableDataInfo;
 import com.ruixuan.common.core.page.TableDataInfo;
 import com.ruixuan.common.enums.BusinessType;
 import com.ruixuan.common.enums.BusinessType;
 import com.ruixuan.common.utils.Check;
 import com.ruixuan.common.utils.Check;
-import com.ruixuan.common.utils.DateUtils;
 import com.ruixuan.data.utils.ExportExcelUtils;
 import com.ruixuan.data.utils.ExportExcelUtils;
 import com.ruixuan.isc.entity.KuaishouItemCollectSampleExpress;
 import com.ruixuan.isc.entity.KuaishouItemCollectSampleExpress;
 import com.ruixuan.isc.entity.KuaishouItemCollectSamples;
 import com.ruixuan.isc.entity.KuaishouItemCollectSamples;
 import com.ruixuan.isc.entity.KuaishouItemCollectSampleLog;
 import com.ruixuan.isc.entity.KuaishouItemCollectSampleLog;
 import com.ruixuan.isc.enums.CompanyEnum;
 import com.ruixuan.isc.enums.CompanyEnum;
 import com.ruixuan.isc.service.IKuaishouItemCollectSamplesService;
 import com.ruixuan.isc.service.IKuaishouItemCollectSamplesService;
+import com.ruixuan.isc.service.IKuaishouItemListService;
 import com.ruixuan.system.service.ISysDeptService;
 import com.ruixuan.system.service.ISysDeptService;
 import com.ruixuan.system.service.ISysRoleService;
 import com.ruixuan.system.service.ISysRoleService;
 import com.ruixuan.system.service.ISysUserService;
 import com.ruixuan.system.service.ISysUserService;
@@ -54,19 +54,20 @@ import org.springframework.web.bind.annotation.*;
 public class KuaishouItemCollectSamplesController extends BaseController {
 public class KuaishouItemCollectSamplesController extends BaseController {
     @Autowired
     @Autowired
     private IKuaishouItemCollectSamplesService kuaishouItemCollectSamplesService;
     private IKuaishouItemCollectSamplesService kuaishouItemCollectSamplesService;
-
     @Autowired
     @Autowired
     private ISysRoleService sysRoleService;
     private ISysRoleService sysRoleService;
     @Autowired
     @Autowired
     private ISysDeptService sysDeptService;
     private ISysDeptService sysDeptService;
     @Autowired
     @Autowired
     private ISysUserService sysUserService;
     private ISysUserService sysUserService;
+    @Autowired
+    private IKuaishouItemListService itemListService;
 
 
     /**
     /**
      * 查询【请填写功能名称】列表
      * 查询【请填写功能名称】列表
      */
      */
     @GetMapping("/list")
     @GetMapping("/list")
-    public TableDataInfo list(Long itemId, Long promoterId, Long userId, Integer collectSampleStatus) {
+    public TableDataInfo list(Long itemId, Long promoterId, Long userId, Integer collectSampleStatus, String itemTitle, String promoterNickName, String promoterPhone) {
         TableDataInfo tableDataInfo = new TableDataInfo();
         TableDataInfo tableDataInfo = new TableDataInfo();
         try {
         try {
             Map<String, Object> requestMap = new HashMap<>();
             Map<String, Object> requestMap = new HashMap<>();
@@ -86,7 +87,6 @@ public class KuaishouItemCollectSamplesController extends BaseController {
                     requestMap.put("itemCreateId", userId);
                     requestMap.put("itemCreateId", userId);
                 }
                 }
             }
             }
-
             if (!Check.isNull(itemId)) {
             if (!Check.isNull(itemId)) {
                 requestMap.put("itemId", itemId);
                 requestMap.put("itemId", itemId);
             }
             }
@@ -96,6 +96,15 @@ public class KuaishouItemCollectSamplesController extends BaseController {
             if (!Check.isNull(collectSampleStatus)) {
             if (!Check.isNull(collectSampleStatus)) {
                 requestMap.put("collectSampleStatus", collectSampleStatus);
                 requestMap.put("collectSampleStatus", collectSampleStatus);
             }
             }
+            if (!Check.isNull(itemTitle)) {
+                requestMap.put("itemTitle", itemTitle);
+            }
+            if (!Check.isNull(promoterNickName)) {
+                requestMap.put("promoterNickName", promoterNickName);
+            }
+            if (!Check.isNull(promoterPhone)) {
+                requestMap.put("promoterPhone", promoterPhone);
+            }
             startPage();
             startPage();
             List<KuaishouItemCollectSamples> list = kuaishouItemCollectSamplesService.selectKuaishouItemCollectSamplesList(requestMap);
             List<KuaishouItemCollectSamples> list = kuaishouItemCollectSamplesService.selectKuaishouItemCollectSamplesList(requestMap);
             return getDataTable(list);
             return getDataTable(list);
@@ -236,6 +245,11 @@ public class KuaishouItemCollectSamplesController extends BaseController {
                 sampleLog.setCreateTime(new Date());
                 sampleLog.setCreateTime(new Date());
                 sampleLog.setUpdateTime(new Date());
                 sampleLog.setUpdateTime(new Date());
                 kuaishouItemCollectSamplesService.insertLog(sampleLog);
                 kuaishouItemCollectSamplesService.insertLog(sampleLog);
+
+                if (!Check.isNull(kuaishouItemCollectSamples.getItemId())) {
+                    JSONObject info = kuaishouItemCollectSamplesService.getCollectSampleInfo(kuaishouItemCollectSamples.getItemId());
+                    itemListService.updateCount(kuaishouItemCollectSamples.getItemId(), info.getInteger("sampleCount"), info.getInteger("userCount"));
+                }
             }
             }
             returnJson.put("code", 0);
             returnJson.put("code", 0);
             returnJson.put("message", "修改成功");
             returnJson.put("message", "修改成功");
@@ -363,6 +377,26 @@ public class KuaishouItemCollectSamplesController extends BaseController {
     }
     }
 
 
 
 
+    @GetMapping("/copyInfo")
+    public JSONObject copyInfo(Long promoterId) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(promoterId)) {
+                throw new Exception("请传入达人ID");
+            }
+            JSONObject copyJson = kuaishouItemCollectSamplesService.getCopyInfo(promoterId);
+            returnJson.put("code", 0);
+            returnJson.put("message", "调用成功");
+            returnJson.put("data", copyJson);
+        } catch (Exception e) {
+            e.printStackTrace();
+            returnJson.put("code", -1);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+    }
+
+
     /**
     /**
      * 删除【请填写功能名称】
      * 删除【请填写功能名称】
      */
      */
@@ -397,6 +431,9 @@ public class KuaishouItemCollectSamplesController extends BaseController {
                 export.add(date.getString("itemTitle"));
                 export.add(date.getString("itemTitle"));
                 export.add(date.getString("promoterId"));
                 export.add(date.getString("promoterId"));
                 export.add(date.getString("promoterNickName"));
                 export.add(date.getString("promoterNickName"));
+                JSONObject copyJson = kuaishouItemCollectSamplesService.getCopyInfo(date.getLong("promoterId"));
+                export.add(copyJson.getString("fansNumber"));
+                export.add(copyJson.getString("totalSale"));
                 export.add(date.getString("sampleCount"));
                 export.add(date.getString("sampleCount"));
                 export.add(date.getString("sampleRequirement"));
                 export.add(date.getString("sampleRequirement"));
                 export.add(date.getString("consignee"));
                 export.add(date.getString("consignee"));
@@ -405,7 +442,7 @@ public class KuaishouItemCollectSamplesController extends BaseController {
                 exportList.add(export);
                 exportList.add(export);
             }
             }
         }
         }
-        String[] headers = {"id","商品ID", "商品名称", "达人ID", "达人昵称", "领样数量", "领样规则", "收件人", "收件人手机号码", "收件人地址"};
+        String[] headers = {"id", "商品ID", "商品名称", "达人ID", "达人昵称", "粉丝数", "销售额", "领样数量", "领样规则", "收件人", "收件人手机号码", "收件人地址"};
         OutputStream os = response.getOutputStream();
         OutputStream os = response.getOutputStream();
         ExportExcelUtils eeu = new ExportExcelUtils();
         ExportExcelUtils eeu = new ExportExcelUtils();
         XSSFWorkbook workbook = new XSSFWorkbook();
         XSSFWorkbook workbook = new XSSFWorkbook();
@@ -416,6 +453,7 @@ public class KuaishouItemCollectSamplesController extends BaseController {
         os.close();
         os.close();
     }
     }
 
 
+
     //发送响应流方法
     //发送响应流方法
     public void setResponseHeader(HttpServletResponse response, String fileName) {
     public void setResponseHeader(HttpServletResponse response, String fileName) {
         try {
         try {

+ 22 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouItemListController.java

@@ -83,7 +83,11 @@ public class KuaishouItemListController extends BaseController {
     @ApiOperation(value = "商品列表")
     @ApiOperation(value = "商品列表")
     public TableDataInfo orderList(
     public TableDataInfo orderList(
             @ApiParam("用户id") @RequestParam(value = "userId", required = false) Long userId,
             @ApiParam("用户id") @RequestParam(value = "userId", required = false) Long userId,
-            @ApiParam("审核状态") @RequestParam(value = "examineStatus", required = false) Long examineStatus) {
+            @ApiParam("审核状态") @RequestParam(value = "examineStatus", required = false) Long examineStatus,
+            @ApiParam("商品ID") @RequestParam(value = "itemId", required = false) Long itemId,
+            @ApiParam("商品名称") @RequestParam(value = "itemTitle", required = false) Long itemTitle,
+            @ApiParam("品类ID") @RequestParam(value = "categoryId", required = false) Long categoryId
+    ) {
         TableDataInfo dataInfo = new TableDataInfo();
         TableDataInfo dataInfo = new TableDataInfo();
         try {
         try {
             Map<String, Object> requestMap = new HashMap<>();
             Map<String, Object> requestMap = new HashMap<>();
@@ -103,6 +107,16 @@ public class KuaishouItemListController extends BaseController {
             if (!Check.isNull(examineStatus)) {
             if (!Check.isNull(examineStatus)) {
                 requestMap.put("examineStatus", examineStatus);
                 requestMap.put("examineStatus", examineStatus);
             }
             }
+            if (!Check.isNull(itemId)) {
+                requestMap.put("itemId", itemId);
+            }
+            if (!Check.isNull(itemTitle)) {
+                requestMap.put("itemTitle", itemTitle);
+            }
+            if (!Check.isNull(categoryId)) {
+                requestMap.put("categoryId", categoryId);
+            }
+
             startPage();
             startPage();
             List<KuaishouItemList> list = kuaishouItemListService.getItemList(requestMap);
             List<KuaishouItemList> list = kuaishouItemListService.getItemList(requestMap);
             dataInfo = getDataTable(list);
             dataInfo = getDataTable(list);
@@ -205,5 +219,12 @@ public class KuaishouItemListController extends BaseController {
         kuaishouItemListService.addCategoryId();
         kuaishouItemListService.addCategoryId();
     }
     }
 
 
+    @GetMapping("/getCategoryIds")
+    public List<JSONObject> getCategoryIds() {
+        List<JSONObject> array = kuaishouItemListService.getCategoryIds();
+        return array;
+    }
+
+
 }
 }
 
 

+ 42 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/entity/KuaishouItemList.java

@@ -218,6 +218,12 @@ public class KuaishouItemList extends BaseEntity {
     @Excel(name = "商品相信信息")
     @Excel(name = "商品相信信息")
     private String detailUrl;
     private String detailUrl;
 
 
+
+    private Long validOrderNum;
+    private Long validAmount;
+    private Integer samplesReceived;
+    private Integer samplesPeoples;
+
     public static long getSerialVersionUID() {
     public static long getSerialVersionUID() {
         return serialVersionUID;
         return serialVersionUID;
     }
     }
@@ -510,6 +516,38 @@ public class KuaishouItemList extends BaseEntity {
         this.detailUrl = detailUrl;
         this.detailUrl = detailUrl;
     }
     }
 
 
+    public Long getValidOrderNum() {
+        return validOrderNum;
+    }
+
+    public void setValidOrderNum(Long validOrderNum) {
+        this.validOrderNum = validOrderNum;
+    }
+
+    public Long getValidAmount() {
+        return validAmount;
+    }
+
+    public void setValidAmount(Long validAmount) {
+        this.validAmount = validAmount;
+    }
+
+    public Integer getSamplesReceived() {
+        return samplesReceived;
+    }
+
+    public void setSamplesReceived(Integer samplesReceived) {
+        this.samplesReceived = samplesReceived;
+    }
+
+    public Integer getSamplesPeoples() {
+        return samplesPeoples;
+    }
+
+    public void setSamplesPeoples(Integer samplesPeoples) {
+        this.samplesPeoples = samplesPeoples;
+    }
+
     @Override
     @Override
     public String toString() {
     public String toString() {
         return "KuaishouItemList{" +
         return "KuaishouItemList{" +
@@ -549,6 +587,10 @@ public class KuaishouItemList extends BaseEntity {
                 ", deliveryRate='" + deliveryRate + '\'' +
                 ", deliveryRate='" + deliveryRate + '\'' +
                 ", partnerRecommendText='" + partnerRecommendText + '\'' +
                 ", partnerRecommendText='" + partnerRecommendText + '\'' +
                 ", detailUrl='" + detailUrl + '\'' +
                 ", detailUrl='" + detailUrl + '\'' +
+                ", validOrderNum=" + validOrderNum +
+                ", validAmount=" + validAmount +
+                ", samplesReceived=" + samplesReceived +
+                ", samplesPeoples=" + samplesPeoples +
                 '}';
                 '}';
     }
     }
 }
 }

+ 4 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouItemCollectSamplesMapper.java

@@ -95,5 +95,9 @@ public interface KuaishouItemCollectSamplesMapper
     void cleanLogs(@Param("sampleId") Long sampleId, @Param("status") Integer status);
     void cleanLogs(@Param("sampleId") Long sampleId, @Param("status") Integer status);
 
 
     List<JSONObject> exportCollectSamples(Map<String, Object> requestMap);
     List<JSONObject> exportCollectSamples(Map<String, Object> requestMap);
+
+    JSONObject getCollectSampleInfo(Long itemId);
+
+    JSONObject promoterInfo(@Param("itemId") Long itemId);
 }
 }
 
 

+ 7 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouItemListMapper.java

@@ -1,6 +1,7 @@
 package com.ruixuan.isc.mapper;
 package com.ruixuan.isc.mapper;
 
 
 
 
+import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.isc.entity.KuaishouItemCategory;
 import com.ruixuan.isc.entity.KuaishouItemCategory;
 import com.ruixuan.isc.entity.KuaishouItemList;
 import com.ruixuan.isc.entity.KuaishouItemList;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
@@ -31,5 +32,11 @@ public interface KuaishouItemListMapper {
     KuaishouItemCategory getCategoryInfo(@Param("categoryId") Long categoryId);
     KuaishouItemCategory getCategoryInfo(@Param("categoryId") Long categoryId);
 
 
     void insertItemBindUser(@Param("itemId") Long itemId,@Param("userId") Long userId,@Param("userName") String userName);
     void insertItemBindUser(@Param("itemId") Long itemId,@Param("userId") Long userId,@Param("userName") String userName);
+
+    Long getIdByName(@Param("categoryName") String categoryName);
+
+    List<JSONObject> getCategoryIds();
+
+    void updateCount(@Param("itemId") Long itemId,@Param("sampleCount") Integer sampleCount, @Param("userCount") Integer userCount);
 }
 }
 
 

+ 12 - 10
ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouItemCollectSamplesService.java

@@ -1,7 +1,6 @@
 package com.ruixuan.isc.service;
 package com.ruixuan.isc.service;
 
 
 
 
-
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.isc.entity.KuaishouItemCollectSampleExpress;
 import com.ruixuan.isc.entity.KuaishouItemCollectSampleExpress;
@@ -18,22 +17,21 @@ import java.util.Map;
  * @author ruoyi
  * @author ruoyi
  * @date 2023-02-08
  * @date 2023-02-08
  */
  */
-public interface IKuaishouItemCollectSamplesService
-{
+public interface IKuaishouItemCollectSamplesService {
     /**
     /**
      * 查询【请填写功能名称】
      * 查询【请填写功能名称】
      *
      *
      * @param id 【请填写功能名称】主键
      * @param id 【请填写功能名称】主键
      * @return 【请填写功能名称】
      * @return 【请填写功能名称】
      */
      */
-     KuaishouItemCollectSamples selectKuaishouItemCollectSamplesById(Long id);
+    KuaishouItemCollectSamples selectKuaishouItemCollectSamplesById(Long id);
 
 
     /**
     /**
      * 查询【请填写功能名称】列表
      * 查询【请填写功能名称】列表
      *
      *
      * @return 【请填写功能名称】集合
      * @return 【请填写功能名称】集合
      */
      */
-     List<KuaishouItemCollectSamples> selectKuaishouItemCollectSamplesList(Map<String,Object> requestMap);
+    List<KuaishouItemCollectSamples> selectKuaishouItemCollectSamplesList(Map<String, Object> requestMap);
 
 
     /**
     /**
      * 新增【请填写功能名称】
      * 新增【请填写功能名称】
@@ -41,7 +39,7 @@ public interface IKuaishouItemCollectSamplesService
      * @param kuaishouItemCollectSamples 【请填写功能名称】
      * @param kuaishouItemCollectSamples 【请填写功能名称】
      * @return 结果
      * @return 结果
      */
      */
-     int insertKuaishouItemCollectSamples(KuaishouItemCollectSamples kuaishouItemCollectSamples);
+    int insertKuaishouItemCollectSamples(KuaishouItemCollectSamples kuaishouItemCollectSamples);
 
 
     /**
     /**
      * 修改【请填写功能名称】
      * 修改【请填写功能名称】
@@ -49,7 +47,7 @@ public interface IKuaishouItemCollectSamplesService
      * @param kuaishouItemCollectSamples 【请填写功能名称】
      * @param kuaishouItemCollectSamples 【请填写功能名称】
      * @return 结果
      * @return 结果
      */
      */
-     int updateKuaishouItemCollectSamples(KuaishouItemCollectSamples kuaishouItemCollectSamples);
+    int updateKuaishouItemCollectSamples(KuaishouItemCollectSamples kuaishouItemCollectSamples);
 
 
     /**
     /**
      * 批量删除【请填写功能名称】
      * 批量删除【请填写功能名称】
@@ -57,7 +55,7 @@ public interface IKuaishouItemCollectSamplesService
      * @param ids 需要删除的【请填写功能名称】主键集合
      * @param ids 需要删除的【请填写功能名称】主键集合
      * @return 结果
      * @return 结果
      */
      */
-     int deleteKuaishouItemCollectSamplesByIds(Long[] ids);
+    int deleteKuaishouItemCollectSamplesByIds(Long[] ids);
 
 
     /**
     /**
      * 删除【请填写功能名称】信息
      * 删除【请填写功能名称】信息
@@ -65,14 +63,14 @@ public interface IKuaishouItemCollectSamplesService
      * @param id 【请填写功能名称】主键
      * @param id 【请填写功能名称】主键
      * @return 结果
      * @return 结果
      */
      */
-     int deleteKuaishouItemCollectSamplesById(Long id);
+    int deleteKuaishouItemCollectSamplesById(Long id);
 
 
 
 
     JSONObject preview(Long userId, String nickName, JSONArray itemIds, JSONArray promoterIds);
     JSONObject preview(Long userId, String nickName, JSONArray itemIds, JSONArray promoterIds);
 
 
     void batchAdd(JSONArray temCollectSamples);
     void batchAdd(JSONArray temCollectSamples);
 
 
-    void subscribe(Long id, String courierNumber,String code) throws Exception;
+    void subscribe(Long id, String courierNumber, String code) throws Exception;
 
 
     void updateByNum(KuaishouItemCollectSamples updateSample);
     void updateByNum(KuaishouItemCollectSamples updateSample);
 
 
@@ -89,5 +87,9 @@ public interface IKuaishouItemCollectSamplesService
     void cleanLogs(Long id, Integer status);
     void cleanLogs(Long id, Integer status);
 
 
     List<JSONObject> exportCollectSamples(Map<String, Object> requestMap);
     List<JSONObject> exportCollectSamples(Map<String, Object> requestMap);
+
+    JSONObject getCollectSampleInfo(Long itemId);
+
+    JSONObject getCopyInfo(Long promoterId);
 }
 }
 
 

+ 4 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouItemListService.java

@@ -31,5 +31,9 @@ public interface IKuaishouItemListService {
     int deleteKuaishouItemListByItemIds(Long[] itemIds);
     int deleteKuaishouItemListByItemIds(Long[] itemIds);
 
 
     int addCategoryId() throws KsMerchantApiException;
     int addCategoryId() throws KsMerchantApiException;
+
+    List<JSONObject> getCategoryIds();
+
+    void updateCount(Long itemId, Integer sampleCount, Integer userCount);
 }
 }
 
 

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

@@ -6,9 +6,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.google.gson.Gson;
 import com.google.gson.Gson;
 import com.kuaidi100.sdk.api.Subscribe;
 import com.kuaidi100.sdk.api.Subscribe;
 import com.kuaidi100.sdk.contant.ApiInfoConstant;
 import com.kuaidi100.sdk.contant.ApiInfoConstant;
-import com.kuaidi100.sdk.contant.CompanyConstant;
 import com.kuaidi100.sdk.core.IBaseClient;
 import com.kuaidi100.sdk.core.IBaseClient;
-import com.kuaidi100.sdk.pojo.HttpResult;
 import com.kuaidi100.sdk.request.SubscribeParam;
 import com.kuaidi100.sdk.request.SubscribeParam;
 import com.kuaidi100.sdk.request.SubscribeParameters;
 import com.kuaidi100.sdk.request.SubscribeParameters;
 import com.kuaidi100.sdk.request.SubscribeReq;
 import com.kuaidi100.sdk.request.SubscribeReq;
@@ -22,7 +20,6 @@ import com.ruixuan.isc.service.IKuaishouItemCollectSamplesService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
-import javax.security.auth.callback.CallbackHandler;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
@@ -285,7 +282,7 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
 
 
     @Override
     @Override
     public void cleanLogs(Long id, Integer status) {
     public void cleanLogs(Long id, Integer status) {
-        kuaishouItemCollectSamplesMapper.cleanLogs(id,status);
+        kuaishouItemCollectSamplesMapper.cleanLogs(id, status);
     }
     }
 
 
     @Override
     @Override
@@ -294,6 +291,17 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
 
 
     }
     }
 
 
+    @Override
+    public JSONObject getCollectSampleInfo(Long itemId) {
+        return kuaishouItemCollectSamplesMapper.getCollectSampleInfo(itemId);
+    }
+
+    @Override
+    public JSONObject getCopyInfo(Long promoterId) {
+        JSONObject returnJson = kuaishouItemCollectSamplesMapper.promoterInfo(promoterId);
+        return returnJson;
+    }
+
 
 
 }
 }
 
 

+ 92 - 55
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouItemListServiceImpl.java

@@ -39,6 +39,9 @@ import org.springframework.stereotype.Service;
 public class KuaishouItemListServiceImpl implements IKuaishouItemListService {
 public class KuaishouItemListServiceImpl implements IKuaishouItemListService {
     @Autowired
     @Autowired
     private KuaishouItemListMapper kuaishouItemListMapper;
     private KuaishouItemListMapper kuaishouItemListMapper;
+    private static List<JSONObject> categoryIds;
+    @Autowired
+    private SupplyChainMapper supplyChainMapper;
 
 
 
 
     @Override
     @Override
@@ -74,18 +77,16 @@ public class KuaishouItemListServiceImpl implements IKuaishouItemListService {
             }
             }
             JSONObject itemJson = data.getJSONObject(0);
             JSONObject itemJson = data.getJSONObject(0);
             Long categoryId = itemJson.getLong("categoryId");
             Long categoryId = itemJson.getLong("categoryId");
-            String categoryInfo = getCategoryInfo(categoryId);
+            JSONObject categoryInfo = getCategoryInfo(categoryId);
             if (!Check.isNull(categoryInfo)) {
             if (!Check.isNull(categoryInfo)) {
-                itemJson.put("categoryName", categoryInfo);
+                itemJson.put("categoryName", categoryInfo.getString("categoryName"));
+                itemJson.put("categoryId", categoryInfo.getString("categoryId"));
             }
             }
             itemJson.put("detailUrl", "https://app.kwaixiaodian.com/merchant/shop/detail?id=" + itemId);
             itemJson.put("detailUrl", "https://app.kwaixiaodian.com/merchant/shop/detail?id=" + itemId);
-
             returnJson.put("judgeStatus", 1);
             returnJson.put("judgeStatus", 1);
             returnJson.put("itemJson", itemJson);
             returnJson.put("itemJson", itemJson);
             returnJson.put("code", 0);
             returnJson.put("code", 0);
             returnJson.put("message", "查询成功");
             returnJson.put("message", "查询成功");
-
-
         } else if (code == 807000 && (subCode == 24101 || subCode == 24214)) { // 商品下线
         } else if (code == 807000 && (subCode == 24101 || subCode == 24214)) { // 商品下线
             returnJson = getInvaliItemDetail(activityId, itemId, accessToken);
             returnJson = getInvaliItemDetail(activityId, itemId, accessToken);
         } else {
         } else {
@@ -96,37 +97,109 @@ public class KuaishouItemListServiceImpl implements IKuaishouItemListService {
         return returnJson;
         return returnJson;
     }
     }
 
 
-    private String getCategoryInfo(Long categoryId) {
+
+    private JSONObject getInvaliItemDetail(Long activityId, Long itemId, String accessToken) throws Exception {
+        JSONObject returnJson = new JSONObject();
+        String cookie = supplyChainMapper.getCookie();
+        Map<String, Object> params = new HashMap<>();
+        params.put("limit", 20);
+        params.put("offset", 0);
+        params.put("activityId", activityId);
+        params.put("itemId", itemId);
+
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Cookie", cookie);
+        String resultStr = KsHttpUtils.KuaiShouttpGetRequest("https://cps.kwaixiaodian.com/distribute/pc/investment/activity/item/list", params, headers);
+        JSONObject result = JSONObject.parseObject(resultStr);
+        if (Check.isNull(result)) {
+            log.error("快分销招商商品数据返回为空");
+            returnJson.put("code", -1);
+            returnJson.put("message", "获取商品信息为空");
+            return returnJson;
+        }
+        Integer code = result.getInteger("result");
+        if (code != 1) {
+            log.info("快分销招商商品数据返回异常:", resultStr);
+            //   sendMessageService.sendMessage("113dee46c7df464da78c07a985e92cd1", "快手供应链cookie失效,请及时更新。媒体返回信息:" + resultStr);
+            returnJson.put("code", -1);
+            returnJson.put("message", "增加快手商品信息抓取失败,请联系技术人员");
+            return returnJson;
+        }
+        JSONArray dataArray = result.getJSONArray("data");
+        if (Check.isNull(dataArray)) {
+            log.error("快分销招商商品数据返回为data数据为空");
+            returnJson.put("code", -1);
+            returnJson.put("message", "快分销招商商品数据返回为data数据为空");
+            return returnJson;
+        }
+        JSONObject itemJson = dataArray.getJSONObject(0);
+        itemJson.put("detailUrl", "https://app.kwaixiaodian.com/merchant/shop/detail?id=" + itemId);
+        String itemCategoryName = itemJson.getString("itemCategoryName");
+        if (!Check.isNull(itemCategoryName)) {
+            String[] split = itemCategoryName.split(">");
+            if (!Check.isNull(split)) {
+                String categoryName = split[0];
+                Long categoryId = kuaishouItemListMapper.getIdByName(categoryName);
+                if (!Check.isNull(categoryId)) {
+                    itemJson.put("categoryId", categoryId);
+                }
+            }
+        }
+
+
+        returnJson.put("judgeStatus", 2);
+        returnJson.put("itemJson", itemJson);
+        returnJson.put("code", 0);
+        returnJson.put("message", "查询成功");
+
+        return returnJson;
+    }
+
+
+    public static void main(String[] args) {
+        String a = "家居生活>厨具/杯具>刀剪菜板>菜刀";
+        String[] split = a.split(">");
+        String b = split[0];
+        System.err.println(b);
+    }
+
+    private JSONObject getCategoryInfo(Long categoryId) {
         if (Check.isNull(categoryId)) {
         if (Check.isNull(categoryId)) {
             return null;
             return null;
         }
         }
+        JSONObject returnJson = new JSONObject();
         StringBuffer stringBuffer = new StringBuffer();
         StringBuffer stringBuffer = new StringBuffer();
-
         KuaishouItemCategory category = kuaishouItemListMapper.getCategoryInfo(categoryId);
         KuaishouItemCategory category = kuaishouItemListMapper.getCategoryInfo(categoryId);
-
         if (Check.isNull(category)) {
         if (Check.isNull(category)) {
             return null;
             return null;
         }
         }
         KuaishouItemCategory secondCategory = new KuaishouItemCategory();
         KuaishouItemCategory secondCategory = new KuaishouItemCategory();
         KuaishouItemCategory thirdCategory = new KuaishouItemCategory();
         KuaishouItemCategory thirdCategory = new KuaishouItemCategory();
         KuaishouItemCategory fourthCategory = new KuaishouItemCategory();
         KuaishouItemCategory fourthCategory = new KuaishouItemCategory();
+        Long id = null;
         if (category.getCategorySort() == 1) {
         if (category.getCategorySort() == 1) {
+            id = categoryId;
             stringBuffer.append(category.getCategoryName());
             stringBuffer.append(category.getCategoryName());
         } else if (category.getCategorySort() == 2) {
         } else if (category.getCategorySort() == 2) {
             secondCategory = kuaishouItemListMapper.getCategoryInfo(category.getParentId());
             secondCategory = kuaishouItemListMapper.getCategoryInfo(category.getParentId());
             stringBuffer.append(secondCategory.getCategoryName()).append(">").append(category.getCategoryName());
             stringBuffer.append(secondCategory.getCategoryName()).append(">").append(category.getCategoryName());
+            id = secondCategory.getCategoryId();
         } else if (category.getCategorySort() == 3) {
         } else if (category.getCategorySort() == 3) {
             secondCategory = kuaishouItemListMapper.getCategoryInfo(category.getParentId());
             secondCategory = kuaishouItemListMapper.getCategoryInfo(category.getParentId());
             thirdCategory = kuaishouItemListMapper.getCategoryInfo(secondCategory.getParentId());
             thirdCategory = kuaishouItemListMapper.getCategoryInfo(secondCategory.getParentId());
             stringBuffer.append(thirdCategory.getCategoryName()).append(">").append(secondCategory.getCategoryName()).append(">").append(category.getCategoryName());
             stringBuffer.append(thirdCategory.getCategoryName()).append(">").append(secondCategory.getCategoryName()).append(">").append(category.getCategoryName());
+            id = thirdCategory.getCategoryId();
         } else if (category.getCategorySort() == 4) {
         } else if (category.getCategorySort() == 4) {
             secondCategory = kuaishouItemListMapper.getCategoryInfo(category.getParentId());
             secondCategory = kuaishouItemListMapper.getCategoryInfo(category.getParentId());
             thirdCategory = kuaishouItemListMapper.getCategoryInfo(secondCategory.getParentId());
             thirdCategory = kuaishouItemListMapper.getCategoryInfo(secondCategory.getParentId());
             fourthCategory = kuaishouItemListMapper.getCategoryInfo(thirdCategory.getParentId());
             fourthCategory = kuaishouItemListMapper.getCategoryInfo(thirdCategory.getParentId());
             stringBuffer.append(fourthCategory.getCategoryName()).append(">").append(thirdCategory.getCategoryName()).append(">").append(secondCategory.getCategoryName()).append(">").append(category.getCategoryName());
             stringBuffer.append(fourthCategory.getCategoryName()).append(">").append(thirdCategory.getCategoryName()).append(">").append(secondCategory.getCategoryName()).append(">").append(category.getCategoryName());
+            id = fourthCategory.getCategoryId();
         }
         }
 
 
-        return stringBuffer.toString();
+        returnJson.put("categoryName", stringBuffer.toString());
+        returnJson.put("categoryId", id);
+        return returnJson;
 
 
 
 
     }
     }
@@ -219,59 +292,23 @@ public class KuaishouItemListServiceImpl implements IKuaishouItemListService {
 
 
         }
         }
         kuaishouItemListMapper.batchCategory(adds);
         kuaishouItemListMapper.batchCategory(adds);
-
         System.err.println(jsonObject);
         System.err.println(jsonObject);
-
-
         return 0;
         return 0;
     }
     }
 
 
-    @Autowired
-    private SupplyChainMapper supplyChainMapper;
-
-    private JSONObject getInvaliItemDetail(Long activityId, Long itemId, String accessToken) throws Exception {
-        JSONObject returnJson = new JSONObject();
-        String cookie = supplyChainMapper.getCookie();
-        Map<String, Object> params = new HashMap<>();
-        params.put("limit", 20);
-        params.put("offset", 0);
-        params.put("activityId", activityId);
-        params.put("itemId", itemId);
-
-        Map<String, String> headers = new HashMap<>();
-        headers.put("Cookie", cookie);
-        String resultStr = KsHttpUtils.KuaiShouttpGetRequest("https://cps.kwaixiaodian.com/distribute/pc/investment/activity/item/list", params, headers);
-        JSONObject result = JSONObject.parseObject(resultStr);
-        if (Check.isNull(result)) {
-            log.error("快分销招商商品数据返回为空");
-            returnJson.put("code", -1);
-            returnJson.put("message", "获取商品信息为空");
-            return returnJson;
-        }
-        Integer code = result.getInteger("result");
-        if (code != 1) {
-            log.info("快分销招商商品数据返回异常:", resultStr);
-            //   sendMessageService.sendMessage("113dee46c7df464da78c07a985e92cd1", "快手供应链cookie失效,请及时更新。媒体返回信息:" + resultStr);
-            returnJson.put("code", -1);
-            returnJson.put("message", "增加快手商品信息抓取失败,请联系技术人员");
-            return returnJson;
-        }
-        JSONArray dataArray = result.getJSONArray("data");
-        if (Check.isNull(dataArray)) {
-            log.error("快分销招商商品数据返回为data数据为空");
-            returnJson.put("code", -1);
-            returnJson.put("message", "快分销招商商品数据返回为data数据为空");
-            return returnJson;
+    @Override
+    public List<JSONObject> getCategoryIds() {
+        if (Check.isNull(categoryIds)) {
+            categoryIds = kuaishouItemListMapper.getCategoryIds();
         }
         }
-        JSONObject itemJson = dataArray.getJSONObject(0);
-        itemJson.put("detailUrl", "https://app.kwaixiaodian.com/merchant/shop/detail?id=" + itemId);
-        returnJson.put("judgeStatus", 2);
-        returnJson.put("itemJson", itemJson);
-        returnJson.put("code", 0);
-        returnJson.put("message", "查询成功");
+        return categoryIds;
+    }
 
 
-        return returnJson;
+    @Override
+    public void updateCount(Long itemId, Integer sampleCount, Integer userCount) {
+        kuaishouItemListMapper.updateCount(itemId, sampleCount, userCount);
     }
     }
 
 
+
 }
 }
 
 

+ 21 - 0
ruixuan-live/src/main/resources/mapper/isc/KuaishouItemCollectSamplesMapper.xml

@@ -65,6 +65,15 @@
                     #{item}
                     #{item}
                 </foreach>
                 </foreach>
             </if>
             </if>
+            <if test="itemTitle != null and itemTitle != ''">
+                and item_title like concat('%', #{itemTitle}, '%')
+            </if>
+            <if test="promoterNickName != null and promoterNickName != ''">
+                and promoter_nick_name like concat('%', #{promoterNickName}, '%')
+            </if>
+            <if test="promoterPhone != null and promoterPhone != ''">
+                and promoter_phone = #{promoterPhone}
+            </if>
         </where>
         </where>
         order by create_time desc
         order by create_time desc
     </select>
     </select>
@@ -167,6 +176,18 @@
         </if>
         </if>
 
 
     </select>
     </select>
+    <select id="getCollectSampleInfo" resultType="com.alibaba.fastjson.JSONObject"
+            parameterType="java.lang.Long">
+        select
+          count(id) as 'sampleCount',
+          count(distinct collect_sample_id) as 'userCount'
+          from kuaishou_item_collect_samples where item_id = #{itemId} and collect_sample_status >= 3
+    </select>
+    <select id="promoterInfo" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.lang.Long">
+         select  total_sale as 'totalSale'
+                 fans_number as 'fansNumber'
+          from kuaishou_promoter where promoter_id = #{promoterId}
+    </select>
 
 
 
 
     <insert id="insertKuaishouItemCollectSamples" parameterType="com.ruixuan.isc.entity.KuaishouItemCollectSamples">
     <insert id="insertKuaishouItemCollectSamples" parameterType="com.ruixuan.isc.entity.KuaishouItemCollectSamples">

File diff suppressed because it is too large
+ 43 - 2
ruixuan-live/src/main/resources/mapper/isc/KuaishouItemListMapper.xml