ソースを参照

人群包bug修复

zhaoxian 4 年 前
コミット
fcbc78b802

+ 6 - 1
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/CrowdListQueryJob.java

@@ -3,7 +3,9 @@ package cn.com.ctop.job.kuaishou.handler;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouPopulationPackageRel;
 import cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouPopulationPackageMapper;
+import cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouPopulationPackageRelMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouPopulationService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -25,6 +27,8 @@ public class CrowdListQueryJob {
     private IKuaishouPopulationService iKuaishouPopulationService;
     @Autowired
     private KuaishouPopulationPackageMapper KuaishouPopulationPackageMapper;
+    @Autowired
+    private KuaishouPopulationPackageRelMapper relMapper;
     static ExecutorService executorService = Executors.newFixedThreadPool(3);
 
     @XxlJob("crowdListQueryJob")
@@ -48,7 +52,8 @@ public class CrowdListQueryJob {
                             if (details.size() > 0) {
                                 for (int j = 0; j < details.size(); j++) {
                                     JSONObject obj = details.getJSONObject(j);
-                                    KuaishouPopulationPackageMapper.updateStatus(obj.getLong("account_id"), obj.getLong("orientation_id"), obj.getInteger("status"));
+                                    KuaishouPopulationPackageRel rel = JSONObject.parseObject(obj.toJSONString(), KuaishouPopulationPackageRel.class);
+                                    relMapper.updateStatus(rel);
                                 }
                             }
                         }

+ 0 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaishouPopulationPackageMapper.java

@@ -26,5 +26,4 @@ public interface KuaishouPopulationPackageMapper extends BaseMapper<KuaishouPopu
 
     List<Long> queryListByStatus();
 
-    void updateStatus(@Param("accountId") Long accountId, @Param("orientationId") Long orientationId, @Param("status") Integer status);
 }

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/KuaishouPopulationPackageRelMapper.java

@@ -33,4 +33,6 @@ public interface KuaishouPopulationPackageRelMapper extends BaseMapper<KuaishouP
     KuaishouPopulationPackageRel queryEntity(@Param("accountId") Long accountId, @Param("id") Long id);
 
     List<JSONObject> getAccountByProjectId(@Param("projectId") Long projectId,@Param("id") String id);
+
+    void updateStatus(@Param("rel") KuaishouPopulationPackageRel rel);
 }

+ 0 - 7
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouPopulationPackageMapper.xml

@@ -85,11 +85,4 @@
         order by t1.create_time desc
     </select>
 
-    <update id="updateStatus">
-        update
-            ctop_kuaishou_population_package_rel
-        set status = #{status}
-        where orientation_id = #{orientationId}
-          and account_id = #{accountId}
-    </update>
 </mapper>

+ 27 - 12
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/KuaishouPopulationPackageRelMapper.xml

@@ -127,23 +127,38 @@
     </insert>
 
     <select id="getAccountByProjectId" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT
-            t1.account_id as 'accountId',
-            CONCAT(t1.auth_name,'(',t1.account_id,')') as 'authName',
-            CASE  WHEN
-                          t2.data_status = 0
-                          OR t2.data_status = 1
-                          OR t2.data_status = 3
-                          OR t2.data_status = 4
-                      THEN 1 ELSE 0 END
+        SELECT t1.account_id as 'accountId', CONCAT(t1.auth_name, '(', t1.account_id, ')') as 'authName', CASE
+                                                                                                              WHEN
+                                                                                                                      t2.status = 0
+                                                                                                                      OR
+                                                                                                                      t2.status = 1
+                                                                                                                      OR
+                                                                                                                      t2.status = 3
+                                                                                                                      OR
+                                                                                                                      t2.status = 4
+                                                                                                                  THEN 1
+                                                                                                              ELSE 0 END
             as 'state'
         FROM ctop_user_allocation t1
                  LEFT JOIN (
-            SELECT account_id,data_status FROM ctop_kuaishou_population_package_rel
-            WHERE  project_id = #{projectId}
+            SELECT account_id, status
+            FROM ctop_kuaishou_population_package_rel
+            WHERE project_id = #{projectId}
               AND pop_id = #{id}
         ) t2 ON t1.account_id = t2.account_id
         where t1.account_status = 0
-          AND t1.project_id =#{projectId}
+          AND t1.project_id = #{projectId}
     </select>
+
+    <update id="updateStatus">
+        update
+            ctop_kuaishou_population_package_rel
+        set status      = #{rel.status},
+            cover_num   =#{rel.coverNum},
+            record_size =#{rel.recordSize},
+            match_size  =#{rel.matchSize}
+            where orientation_id = #{rel.orientationId}
+                and account_id = #{rel.accountId}
+    </update>
+
 </mapper>

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IKuaishouPopulationPackageService.java

@@ -23,7 +23,7 @@ public interface IKuaishouPopulationPackageService extends IService<KuaishouPopu
 
     Result<Object> queryPushResults(Long id, JSONArray accountIds);
 
-    Result<Object> queryPushHistory(Long id);
+    Result<Object> queryPushHistory(Long  id);
 
     Result<Object> getRelatedAccounts(Long id);
 

+ 2 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouPopulationPackageServiceImpl.java

@@ -290,7 +290,8 @@ public class KuaishouPopulationPackageServiceImpl extends ServiceImpl<KuaishouPo
                                 if (details.size() > 0) {
                                     for (int j = 0; j < details.size(); j++) {
                                         JSONObject obj = details.getJSONObject(j);
-                                        KuaishouPopulationPackageMapper.updateStatus(obj.getLong("account_id"), obj.getLong("orientation_id"),obj.getInteger("status"));
+                                        KuaishouPopulationPackageRel rel = JSONObject.parseObject(obj.toJSONString(),KuaishouPopulationPackageRel.class);
+                                        relMapper.updateStatus(rel);
                                     }
                                 }
                             }