瀏覽代碼

申样达人单品出单大于等于50单 定时任务直接审核通过,无需上传作业

zhaoxian 2 年之前
父節點
當前提交
00dcc9d6ed

+ 11 - 3
ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouItemCollectSamplesController.java

@@ -604,7 +604,7 @@ public class KuaishouItemCollectSamplesController extends BaseController {
                 export.add(date.getString("promoterNickName"));
                 export.add(date.getString("status"));
                 JSONObject copyJson = kuaishouItemCollectSamplesService.getCopyInfo(date.getLong("promoterId"));
-                if(!Check.isNull(copyJson)){
+                if (!Check.isNull(copyJson)) {
                     export.add(copyJson.getString("fansNumber"));
                     export.add(copyJson.getString("totalSale"));
                 }
@@ -842,7 +842,7 @@ public class KuaishouItemCollectSamplesController extends BaseController {
                 throw new Exception("该商品已下架或失效");
             }
 
-            KuaishouPromoter onlyPromoterInfo = promoterService.getOnlyPromoterInfoByUserId(promoterId,userId);
+            KuaishouPromoter onlyPromoterInfo = promoterService.getOnlyPromoterInfoByUserId(promoterId, userId);
             if (Check.isNull(onlyPromoterInfo)) {
                 throw new Exception("该达人未录入");
             }
@@ -856,7 +856,7 @@ public class KuaishouItemCollectSamplesController extends BaseController {
             }*/
             returnJson.put("code", 0);
             returnJson.put("message", "校验通过");
-            returnJson.put("id",  onlyPromoterInfo.getId());
+            returnJson.put("id", onlyPromoterInfo.getId());
         } catch (Exception e) {
             returnJson.put("code", 500);
             returnJson.put("message", e.getMessage());
@@ -865,6 +865,14 @@ public class KuaishouItemCollectSamplesController extends BaseController {
 
     }
 
+    /**
+     * 定时改变状态:
+     * 达人出单量超过50, 状态:待上传作业 -> 审核通过
+     */
+    @GetMapping("/updateStatusToApproved")
+    public void updateStatusToApproved() {
+        kuaishouItemCollectSamplesService.checkAndUpdateStatus();
+    }
 
 }
 

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

@@ -101,9 +101,9 @@ public interface KuaishouItemCollectSamplesMapper {
 
     Long getItemIdById(@Param("id") Long id);
 
-    Integer getSampleCountByUserId(@Param("userList")  List<Long> userList, @Param("userType") Integer userType, @Param("status") Integer status);
+    Integer getSampleCountByUserId(@Param("userList") List<Long> userList, @Param("userType") Integer userType, @Param("status") Integer status);
 
-    JSONObject queryTheNumberOfCompletedJobs(@Param("promoterIds") List<Long> promoterIds, @Param("startDate") String startDate,@Param("endDate")  String endDate);
+    JSONObject queryTheNumberOfCompletedJobs(@Param("promoterIds") List<Long> promoterIds, @Param("startDate") String startDate, @Param("endDate") String endDate);
 
     List<JSONObject> selectPromoterInfo(@Param("map") Map<Long, Long> map);
 
@@ -111,10 +111,14 @@ public interface KuaishouItemCollectSamplesMapper {
 
     List<JSONObject> queryProductList(Map<String, Object> map);
 
-    void batchProcess(@Param("ids") JSONArray ids,@Param("status") Integer status);
+    void batchProcess(@Param("ids") JSONArray ids, @Param("status") Integer status);
 
-    List<KuaishouItemCollectSamples> getListByPromoterId(@Param("promoterId") Long promoterId,@Param("userId") Long userId);
+    List<KuaishouItemCollectSamples> getListByPromoterId(@Param("promoterId") Long promoterId, @Param("userId") Long userId);
 
     Integer checkByRelateIdAndPromoterId(@Param("relateId") Long relateId, @Param("promoterId") Long promoterId);
+
+    List<Long> getAccordWithOrderQuantityList();
+
+    void updateByIds(@Param("ids") List<Long> ids);
 }
 

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

@@ -104,10 +104,12 @@ public interface IKuaishouItemCollectSamplesService {
 
     List<JSONObject> exportProductList(Map<String, Object> map);
 
-    void batchProcess(JSONArray ids,Integer status);
+    void batchProcess(JSONArray ids, Integer status);
 
     void batchAddLogs(List<KuaishouItemCollectSampleLog> logs);
 
-    List<KuaishouItemCollectSamples> getListByPromoterId(Long promoterId,Long userId);
+    List<KuaishouItemCollectSamples> getListByPromoterId(Long promoterId, Long userId);
+
+    void checkAndUpdateStatus();
 }
 

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

@@ -675,6 +675,14 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
         return kuaishouItemCollectSamplesMapper.getListByPromoterId(promoterId, userId);
     }
 
+    @Override
+    public void checkAndUpdateStatus() {
+        List<Long> ids = kuaishouItemCollectSamplesMapper.getAccordWithOrderQuantityList();
+        if (Check.isNotNull(ids)) {
+            kuaishouItemCollectSamplesMapper.updateByIds(ids);
+        }
+    }
+
     // 渠道—数据分析
     private JSONObject getDataAnalysisByChannel(List<Long> userList, String startDate, String endDate) {
         JSONObject data = new JSONObject();

+ 26 - 4
ruixuan-live/src/main/resources/mapper/isc/KuaishouItemCollectSamplesMapper.xml

@@ -693,17 +693,39 @@
             AND validorder &lt;= #{validorderEnd}
         </if>
     </select>
+
     <select id="checkByRelateIdAndPromoterId" resultType="java.lang.Integer">
         select count(1)
         from kuaishou_item_collect_samples
-        where item_id in(
-        select  item_id  from kuaishou_item_list
-        where relate_id = #{relateId}
-        group by item_id
+        where item_id in (
+            select item_id
+            from kuaishou_item_list
+            where relate_id = #{relateId}
+            group by item_id
         )
           and promoter_id = #{promoterId}
           and collect_sample_status != 2
 
     </select>
 
+    <!--    出单量 >= 50 且 状态为5已签收待上传作业 的数据-->
+    <select id="getAccordWithOrderQuantityList" resultType="java.lang.Long">
+        SELECT t1.id
+        FROM kuaishou_item_collect_samples t1
+                 LEFT JOIN promoter_iterm_oerder_amount t2 ON t1.item_id = t2.item_id
+        WHERE t2.valid_order_num >= 50
+    </select>
+
+    <!--    出单量 >= 50 且 状态为5已签收待上传作业 的数据 改为 状态 7(审核通过)并备注-->
+    <update id="updateByIds" parameterType="com.ruixuan.isc.entity.KuaishouItemCollectSamples">
+        update kuaishou_item_collect_samples
+        SET
+        collect_sample_status = 7,
+        collect_sample_desc = '出单量大于等于50单,自动审核通过'
+        WHERE id IN
+        <foreach collection="ids" item="id" separator=","
+                 open="(" close=")">
+            #{id}
+        </foreach>
+    </update>
 </mapper>