Browse Source

将categoryCode 改成categoryId

2507040827 6 giờ trước cách đây
mục cha
commit
b90743ae8b

+ 10 - 0
server/yusp-tagging-core/src/main/java/cn/com/yusys/yusp/controller/AitagTagLogController.java

@@ -163,4 +163,14 @@ public class AitagTagLogController {
         return stringBuilder.toString();
     }
 
+
+    @Autowired
+    private DistributedScheduledTask distributedScheduledTask;
+
+        @GetMapping("/syncDataTask")
+    public ResultDto<AitagTagLogEntity> test() {
+        distributedScheduledTask.syncDataTask();
+        return ResultDto.success();
+    }
+
 }

+ 1 - 1
server/yusp-tagging-core/src/main/java/cn/com/yusys/yusp/domain/entity/AitagTagDailyAggEntity.java

@@ -36,7 +36,7 @@ public class AitagTagDailyAggEntity {
      * 类别名称
      **/
     @ApiModelProperty(value = "标签类别")
-    private String categoryCode;
+    private String categoryId;
 
     /**
      * 标签名称

+ 3 - 3
server/yusp-tagging-core/src/main/java/cn/com/yusys/yusp/domain/entity/AitagTagLogEntity.java

@@ -127,10 +127,10 @@ passr: true/false
     private String consumingTime;
 
     /**
-     * 标签类别
+     * 标签类别Id
      **/
-    @ApiModelProperty(value = "标签类别")
-    private String categoryCode;
+    @ApiModelProperty(value = "标签类别Id")
+    private String categoryId;
 
     /**
      * 合同编号

+ 17 - 12
server/yusp-tagging-core/src/main/java/cn/com/yusys/yusp/service/DistributedScheduledTask.java

@@ -6,6 +6,7 @@ import cn.com.yusys.yusp.domain.entity.AitagTagDailyAggEntity;
 import cn.com.yusys.yusp.domain.entity.AitagTagLogEntity;
 import cn.com.yusys.yusp.mapper.AitagTagDailyAggDao;
 import cn.com.yusys.yusp.mapper.AitagTagLogDao;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import lombok.extern.slf4j.Slf4j;
@@ -23,6 +24,7 @@ import java.util.UUID;
 import java.util.concurrent.TimeUnit;
 
 import static cn.com.yusys.yusp.config.DataDictionary.FEEDBACK_RESULT_AGREE;
+import static cn.com.yusys.yusp.config.DataDictionary.FEEDBACK_RESULT_REJECT;
 
 @Component
 @Slf4j
@@ -74,13 +76,13 @@ public class DistributedScheduledTask {
             for (AitagTagLogEntity aitagTagLog:aitagTagLogEntities){
                 String feedback = aitagTagLog.getFeedback();
                 String categoryCode = aitagTagLog.getCategoryCode();
-                if(FEEDBACK_RESULT_AGREE.equals(feedback)){
-                    String result = aitagTagLog.getResult();
-                    duCount(result, count,categoryCode);
+                String result = null;
+                if(FEEDBACK_RESULT_REJECT.equals(feedback)){
+                    result = aitagTagLog.getFeedbackResult();
                 }else{
-                    String result = aitagTagLog.getFeedbackResult();
-                    duCount(result, count,categoryCode);
+                    result = aitagTagLog.getResult();
                 }
+                duCount(result, count,categoryCode);
             }
             AitagTagDailyAggEntity aitagTagLog = new AitagTagDailyAggEntity();
             for (String key : count.keySet()){
@@ -97,13 +99,16 @@ public class DistributedScheduledTask {
     }
 
     private static void duCount(String result, Map<String, Integer> count,String categoryCode) {
-        JSONObject resultMap = JSONObject.parseObject(result);
-        String labe = resultMap.getString("labe")+":"+categoryCode;
-        if(count.containsKey(labe)){
-            Integer integer = count.get(labe);
-            count.put(labe,integer+1);
-        }else{
-            count.put(labe,1);
+        List<Map> results = JSONArray.parseArray(result, Map.class);
+        for (int i = 0 ;i<results.size();i++){
+            Map resultMap = results.get(i);
+            String labe = resultMap.getOrDefault("tag_name","").toString()+":"+categoryCode;
+            if(count.containsKey(labe)){
+                Integer integer = count.get(labe);
+                count.put(labe,integer+1);
+            }else{
+                count.put(labe,1);
+            }
         }
     }
 

+ 3 - 3
server/yusp-tagging-core/src/main/resources/mapper/AitagTagDailyAggMapper.xml

@@ -4,7 +4,7 @@
     <resultMap id="aitagTagDailyAgg" type="cn.com.yusys.yusp.domain.entity.AitagTagDailyAggEntity">
         <id column="id" jdbcType="VARCHAR" property="id"/>
         <result column="agg_date" jdbcType="VARCHAR" property="aggDate"/>
-        <result column="category_code" jdbcType="VARCHAR" property="categoryCode"/>
+        <result column="category_id" jdbcType="VARCHAR" property="categoryId"/>
         <result column="tag_nm" jdbcType="VARCHAR" property="tagNm"/>
         <result column="tag_count" jdbcType="INTEGER" property="tagCount"/>
     </resultMap>
@@ -22,8 +22,8 @@
             <if test="endTaggingTime != null and endTaggingTime != ''">
                 AND #{endTaggingTime} >= agg_date
             </if>
-            <if test="categoryCode != null and categoryCode != '' ">
-                AND #{categoryCode} = category_code
+            <if test="categoryId != null and categoryId != '' ">
+                AND #{categoryId} = category_id
             </if>
             <if test="sort == 'ase'">
                 order by tag_count

+ 10 - 10
server/yusp-tagging-core/src/main/resources/mapper/AitagTagLogMapper.xml

@@ -17,7 +17,7 @@
         <result column="feedback_result" jdbcType="VARCHAR" property="feedbackResult"/>
         <result column="state" jdbcType="INTEGER" property="state"/>
         <result column="consuming_time" jdbcType="LONGVARCHAR" property="consumingTime"/>
-        <result column="category_code" jdbcType="VARCHAR" property="categoryCode"/>
+        <result column="category_id" jdbcType="VARCHAR" property="categoryId"/>
         <result column="reg_result" jdbcType="VARCHAR" property="regResult"/>
         <result column="feedback_user_org" jdbcType="VARCHAR" property="feedbackUserOrg"/>
         <result column="feedback_user_endpoint" jdbcType="VARCHAR" property="feedbackUserEndpoint"/>
@@ -36,8 +36,8 @@
             <if test="endTaggingTime != null and endTaggingTime != ''">
                 AND #{endTaggingTime} >= insert_time
             </if>
-            <if test="categoryCode != null and categoryCode != ''">
-                AND #{categoryCode} = category_code
+            <if test="categoryId != null and categoryId != ''">
+                AND #{categoryId} = category_id
             </if>
     </select>
 
@@ -54,8 +54,8 @@
             <if test="endTaggingTime != null and endTaggingTime != ''">
                 AND #{endTaggingTime} >= insert_time
             </if>
-            <if test="categoryCode != null and categoryCode != ''">
-                AND #{categoryCode} = category_code
+            <if test="categoryId != null and categoryId != ''">
+                AND #{categoryId} = category_id
             </if>
         GROUP BY DATE_FORMAT(insert_time, '%Y年%m月%d日')
         ORDER BY stat;
@@ -74,8 +74,8 @@
             <if test="endTaggingTime != null and endTaggingTime != ''">
                 AND #{endTaggingTime} >= insert_time
             </if>
-            <if test="categoryCode != null and categoryCode != ''">
-                AND #{categoryCode} = category_code
+            <if test="categoryId != null and categoryId != ''">
+                AND #{categoryId} = category_id
             </if>
         GROUP BY DATE_FORMAT(insert_time, '%Y年%m月')
         ORDER BY stat;
@@ -94,15 +94,15 @@
             <if test="endTaggingTime != null and  endTaggingTime != ''">
                 AND #{endTaggingTime} >= insert_time
             </if>
-            <if test="categoryCode != null and categoryCode != ''">
-                AND #{categoryCode} = category_code
+            <if test="categoryId != null and categoryId != ''">
+                AND #{categoryId} = category_id
             </if>
         GROUP BY YEARWEEK(insert_time, 1)
         ORDER BY stat;
     </select>
 
     <select id="selectByInsertTime" resultType="cn.com.yusys.yusp.domain.entity.AitagTagLogEntity">
-        SELECT id, app_id, insert_time, business_attr, phrase, attachment, attachment_url, `result`, feedback_user_id, feedback_user_nm, feedback_time, feedback, feedback_result, state, consuming_time, category_code
+        SELECT id, app_id, insert_time, business_attr, phrase, attachment, attachment_url, `result`, feedback_user_id, feedback_user_nm, feedback_time, feedback, feedback_result, state, consuming_time, category_id
         FROM aitag_tag_log
         WHERE
             tag_scope = 0