Bläddra i källkod

定时核算数据

LIVE_YE 2 år sedan
förälder
incheckning
8cbf48ccd4

+ 7 - 0
boman-web-core/src/main/java/com/boman/web/core/controller/TaskController.java

@@ -57,6 +57,13 @@ public class TaskController {
     }
 
 
+    @GetMapping("/supplement")
+    private void supplement() {
+        taskService.supplement();
+    }
+
+
+
     @GetMapping("/pphshj")
     private void pphshj() {
         taskService.pphshj();

+ 2 - 0
boman-web-core/src/main/java/com/boman/web/core/mapper/AccountingDataMapper.java

@@ -87,4 +87,6 @@ public interface AccountingDataMapper {
     AccountingDataVo detailedJcd(@Param("id")String id);
 
     List<AccountingDataVo> nucleicAcidZd(AccountingDataVo accountingData);
+
+    int selectRepeat(AccountingDataVo accountingData);
 }

+ 21 - 0
boman-web-core/src/main/java/com/boman/web/core/service/TaskService.java

@@ -707,6 +707,22 @@ public class TaskService {
     }
 
 
+    /***
+     * 核酸补充数据定时任务(每天3点执行)
+     */
+    @Scheduled(cron = "0 0 3 * * ? ")
+    public void supplement() {
+        //获取当前时间
+        Date data = DateUtils.getNowDate();
+        String endTime = DateUtils.formatString(data);
+        //当前时间往前推一个星期(10080分钟)
+        String startTime = DateUtils.plusSeconds(endTime, -10080);
+
+        accountingDataService.thirdNucleicAcid(startTime, endTime);
+
+    }
+
+
     /***
      *  匹配核酸和户籍数据
      */
@@ -1067,6 +1083,11 @@ public class TaskService {
                 //去更新常住人口表中数据
                 czrkMapper.updateCzrkByNucleicAcid(czrk);
             }
+            //先查询库里是否有相同数据
+            int num = accountingDataMapper.selectRepeat(accountingData);
+            if(num>0){
+                continue;
+            }
             int result = mapper.selectById(accountingData);
             if (result == 0) {
                 if (accountingData.getCjssxq().contains("梅城镇")) {

+ 14 - 1
boman-web-core/src/main/resources/mapper/AccountingDateMapper.xml

@@ -552,7 +552,7 @@
         LEFT JOIN tb_whole_testing_result_921 r ON s.id = r.id
         LEFT JOIN tb_whole_collect_site_city c ON s.collect_site_code = c.id
         LEFT JOIN tb_testing_site_921 t ON t.testing_site_code = r.testing_site_code
-        where s.collect_datetime > #{startTime}  and #{endTime}>=s.collect_datetime
+        where s.create_datetime > #{startTime}  and #{endTime}>=s.create_datetime
 
     </select>
 
@@ -654,5 +654,18 @@
         <include refid="selectAccountingDataVo"/>
         where id = #{id}
     </select>
+    <select id="selectRepeat" resultType="java.lang.Integer"
+            parameterType="com.boman.web.core.domain.vo.AccountingDataVo">
+        select count(1) from  accounting_data
+        <where>
+            1=1
+            <if test="zjhm != null  and zjhm != ''">and zjhm = #{zjhm}</if>
+            <if test="xm != null  and xm != ''">and xm = #{xm}</if>
+            <if test="lxdh != null  and lxdh != ''">and lxdh = #{lxdh}</if>
+            <if test="cjsj != null  and cjsj != '' and cjsj != 'null'">and
+                cjsj = #{cjsj}
+            </if>
+        </where>
+    </select>
 
 </mapper>