Browse Source

fix 新增每10分钟抓取一次核酸数据

tjf 3 năm trước cách đây
mục cha
commit
74808cbdd0

+ 43 - 8
boman-common/boman-common-core/src/main/java/com/boman/common/core/utils/DateUtils.java

@@ -59,13 +59,19 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
         return null;
     }
 
+    public static String formatString(Date date) {
+        SimpleDateFormat format = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS);
+        return format.format(date);
+    }
+
     /**
      * 根据时间+多少天
+     *
      * @param date
      * @param i
      * @return
      */
-    public static Date addDayOfDate(Date date,int i){
+    public static Date addDayOfDate(Date date, int i) {
         Calendar c = Calendar.getInstance();
         c.setTime(date);
         c.add(Calendar.DATE, i);
@@ -75,15 +81,41 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
 
     /**
      * 根据时间-日期
+     *
      * @param i
      * @return
      */
-    public static String minusDayOfDate(int i){
+    public static String minusDayOfDate(int i) {
         LocalDateTime today = LocalDateTime.now();
         LocalDateTime localDateTime = today.minusDays(i);
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         return localDateTime.format(formatter);
     }
+
+    /**
+     * 根据时间+10分钟
+     *
+     * @return
+     */
+    public static String plusSeconds(String dateTime, int seconds) {
+        LocalDateTime parse = parse(dateTime, "yyyy-MM-dd HH:mm:ss");
+        LocalDateTime localDateTime = parse.plusMinutes(seconds);
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        return localDateTime.format(formatter);
+    }
+
+    /**
+     * String转LocalDateTime
+     *
+     * @param str
+     * @param format
+     * @return
+     */
+    public static LocalDateTime parse(String str, String format) {
+        DateTimeFormatter df = DateTimeFormatter.ofPattern(format);
+        return LocalDateTime.parse(str, df);
+    }
+
     /**
      * 当天的开始时间
      */
@@ -109,7 +141,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
     }
 
 
-
     /**
      * 当天的开始时间
      */
@@ -125,7 +156,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
     }
 
 
-
     /**
      * 指定日期的的开始时间
      */
@@ -294,6 +324,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
 
     /**
      * 时间转月-日
+     *
      * @param date
      * @return
      */
@@ -491,11 +522,12 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
 
     /**
      * 根据日期计算年龄
+     *
      * @param birthDay
      * @return
      * @throws Exception
      */
-    public static  int getAge(Date birthDay) throws Exception {
+    public static int getAge(Date birthDay) throws Exception {
         Calendar cal = Calendar.getInstance();
         if (cal.before(birthDay)) { //出生日期晚于当前时间,无法计算
             throw new IllegalArgumentException(
@@ -512,12 +544,15 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
         if (monthNow <= monthBirth) {
             if (monthNow == monthBirth) {
                 if (dayOfMonthNow < dayOfMonthBirth) age--;//当前日期在生日之前,年龄减一
-            }else{
+            } else {
                 age--;//当前月份在生日之前,年龄减一
-            } } return age; }
+            }
+        }
+        return age;
+    }
 
 
-    public static String checkDate(String str){
+    public static String checkDate(String str) {
         String format1 = null;
         try {
             SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");

+ 10 - 1
boman-web-core/src/main/java/com/boman/web/core/controller/AccountingDataController.java

@@ -1,8 +1,10 @@
 package com.boman.web.core.controller;
+
 import com.boman.common.core.web.controller.BaseController;
 import com.boman.domain.TableDataInfo;
 import com.boman.web.core.domain.AccountingData;
 import com.boman.web.core.domain.vo.AccountingDataVo;
+import com.boman.web.core.service.TaskService;
 import com.boman.web.core.service.accounting.IAccountingDataService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
@@ -23,6 +25,10 @@ public class AccountingDataController extends BaseController {
 
     @Resource
     private IAccountingDataService accountingDataService;
+
+    @Resource
+    private TaskService taskService;
+
     /***
      *  潜山核酸数据列表页(根据户籍地)
      * @return
@@ -45,5 +51,8 @@ public class AccountingDataController extends BaseController {
         return getDataTable(list);
     }
 
-
+    @GetMapping("/nucleicAcid/zz")
+    public void nucleicAci() {
+        taskService.insertAccountingData();
+    }
 }

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

@@ -7,6 +7,7 @@ package com.boman.web.core.mapper;
 import com.boman.web.core.domain.AccountingData;
 import com.boman.web.core.domain.vo.AccountingDataVo;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -37,4 +38,11 @@ public interface AccountingDataMapper {
      * @return
      */
    int insertAccountingData(AccountingData accountingData);
+
+    /**根据id查询
+     *
+     * @param id
+     * @return
+     */
+   int selectById(@Param("id") String id);
 }

+ 86 - 75
boman-web-core/src/main/java/com/boman/web/core/service/TaskService.java

@@ -33,14 +33,13 @@ import org.apache.commons.lang3.BooleanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.GetMapping;
 
 import javax.annotation.Resource;
 import java.io.IOException;
 import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.text.SimpleDateFormat;
+import java.util.*;
 import java.util.concurrent.TimeUnit;
 
 import static com.boman.common.core.utils.obj.ObjectUtils.isEmpty;
@@ -79,7 +78,7 @@ public class TaskService {
 
     @Resource
     private IAccountingDataService accountingDataService;
-    private static final String tableName= "attendance_table";
+    private static final String tableName = "attendance_table";
 
     /**
      * 每月1号往考勤记录表根据用户插入当月的数据 每月一号00:00分
@@ -90,15 +89,15 @@ public class TaskService {
         List<String> monthEveryDays = DateUtils.getMonthEveryDays(date);
         //获取所有用户
         List<SysUser> sysUsers = remoteUserService.selectUserListAll();
-        if (sysUsers != null && sysUsers.size() > 0){
+        if (sysUsers != null && sysUsers.size() > 0) {
             if (monthEveryDays != null) {
                 JSONObject condition = new JSONObject();
                 //需要ATTENDANCE_TABLE_TODAYTIME字段是查询可见
-                condition.put(ATTENDANCE_TABLE_TODAYTIME,monthEveryDays);
-                condition.put(IS_DEL,"N");
+                condition.put(ATTENDANCE_TABLE_TODAYTIME, monthEveryDays);
+                condition.put(IS_DEL, "N");
                 //先去查询是否已经存在当前日期的记录
                 List<JSONObject> byMap = commonService.getByMap(tableName, condition);
-                if (byMap != null){
+                if (byMap != null) {
                     List<String> days = new ArrayList<>();
                     for (JSONObject jsonObject : byMap) {
                         String day = jsonObject.get(ATTENDANCE_TABLE_TODAYTIME).toString();
@@ -109,12 +108,12 @@ public class TaskService {
                 for (String monthEveryDay : monthEveryDays) {
                     for (SysUser sysUser : sysUsers) {
                         JSONObject commitData = new JSONObject();
-                        commitData.put(ATTENDANCE_USER_NAME,sysUser.getUserName());
+                        commitData.put(ATTENDANCE_USER_NAME, sysUser.getUserName());
                         commitData.put(ATTENDANCE_USER_ID, sysUser.getId());
-                        commitData.put(ATTENDANCE_DEPT_ID,sysUser.getDeptId());
-                        commitData.put(ATTENDANCE_TABLE_TODAYTIME,monthEveryDay);
-                        commitData.put(ATTENDANCE_TABLE_CREATE_TIME,DateUtils.getNowDate());
-                        commitData.put(ATTENDANCE_TABLE_CREATE_BY,"admin");
+                        commitData.put(ATTENDANCE_DEPT_ID, sysUser.getDeptId());
+                        commitData.put(ATTENDANCE_TABLE_TODAYTIME, monthEveryDay);
+                        commitData.put(ATTENDANCE_TABLE_CREATE_TIME, DateUtils.getNowDate());
+                        commitData.put(ATTENDANCE_TABLE_CREATE_BY, "admin");
                         FormDataDto dto = new FormDataDto();
                         dto.setObjId(-1L);
                         dto.setTable(tableName);
@@ -148,7 +147,7 @@ public class TaskService {
         List<SysDept> townsDepts = new ArrayList<>(16);
 
         for (SysDept allDept : allDepts) {
-            if (isEmpty(allDept.getParentId())){
+            if (isEmpty(allDept.getParentId())) {
                 continue;
             }
             if (allDept.getParentId() == (1L)) {
@@ -170,7 +169,7 @@ public class TaskService {
         results.put("cun", isEmpty(cunDepts) ? 0 : cunDepts.size());
         //查找潜山市户籍人口总数
         List<Czrk> czrkList = czrkMapper.getAllCzrkRegionId("340882000000");
-        if(czrkList==null){
+        if (czrkList == null) {
             czrkList = new ArrayList<>();
         }
         //潜山市户籍人口总数
@@ -183,14 +182,14 @@ public class TaskService {
 
         //循环所有人判断当前总人数,该镇 户籍人口今日新增,该镇 户籍人口今日减少
         for (Czrk czrk : czrkList) {
-            if(!"1".equals(czrk.getStatus())){
+            if (!"1".equals(czrk.getStatus())) {
                 hjzrs--;
             }
             //判断是否是在今天操作的人员信息
-            if(s.before(czrk.getUpdateTime()) && czrk.getUpdateTime().before(e)){
-                if(!"1".equals(czrk.getStatus())){
+            if (s.before(czrk.getUpdateTime()) && czrk.getUpdateTime().before(e)) {
+                if (!"1".equals(czrk.getStatus())) {
                     hjjs++;
-                }else{
+                } else {
                     hjxz++;
                 }
             }
@@ -206,7 +205,7 @@ public class TaskService {
 
         //查找潜山市常驻人口信息
         List<CzrkJzdz> czrkJzdzList = czrkJzdzService.selectCzrkJzdzListByRegionId("340882000000");
-        if(czrkJzdzList==null){
+        if (czrkJzdzList == null) {
             czrkJzdzList = new ArrayList<>();
         }
         //潜山市居住人口总数
@@ -219,14 +218,14 @@ public class TaskService {
 
         //循环所有人判断当前总人数,该镇 户籍人口今日新增,该镇 户籍人口今日减少
         for (CzrkJzdz czrkJzdz : czrkJzdzList) {
-            if("N".equals(czrkJzdz.getStatus())){
+            if ("N".equals(czrkJzdz.getStatus())) {
                 czzrs--;
             }
             //判断是否是在今天操作的人员信息
-            if(s.before(czrkJzdz.getUpdateTime()) && czrkJzdz.getUpdateTime().before(e)){
-                if("N".equals(czrkJzdz.getStatus())){
+            if (s.before(czrkJzdz.getUpdateTime()) && czrkJzdz.getUpdateTime().before(e)) {
+                if ("N".equals(czrkJzdz.getStatus())) {
                     czjs++;
-                }else{
+                } else {
                     czxz++;
                 }
             }
@@ -266,7 +265,7 @@ public class TaskService {
         //czrkList  czrkJzdzList
         for (SysDept townsDept : townsDepts) {
             JSONObject townsResult = new JSONObject(16);
-            townSts(townsResult, townsDept, czrkList, czrkJzdzList,hjzrs, czzrs);
+            townSts(townsResult, townsDept, czrkList, czrkJzdzList, hjzrs, czzrs);
             towsDataList.add(townsResult);
         }
 
@@ -278,7 +277,7 @@ public class TaskService {
 
         //镇数据存入redis
         for (SysDept townsDept : townsDepts) {
-            townSts(resultz, townsDept, czrkList, czrkJzdzList,hjzrs, czzrs);
+            townSts(resultz, townsDept, czrkList, czrkJzdzList, hjzrs, czzrs);
 //                redisService.setCacheObject(packRedisKey("town:" + deptId), result, 1L, TimeUnit.DAYS);
             setIntoRedis(packRedisKey("town:" + townsDept.getId()), resultz);
         }
@@ -291,7 +290,7 @@ public class TaskService {
             resultc.put("dqdw", deptName);
 
             //查找村的数据
-            if(czrkList==null){
+            if (czrkList == null) {
                 czrkList = new ArrayList<>();
             }
             //该村户籍人口总数
@@ -304,15 +303,15 @@ public class TaskService {
 
             //循环所有人判断当前总人数,该村 户籍人口今日新增,该镇 户籍人口今日减少
             for (Czrk czrk : czrkList) {
-                if(StringUtils.isNotEmpty(czrk.getVillageId()) && czrk.getVillageId().equals(areaId)){
-                    if("1".equals(czrk.getStatus())){
+                if (StringUtils.isNotEmpty(czrk.getVillageId()) && czrk.getVillageId().equals(areaId)) {
+                    if ("1".equals(czrk.getStatus())) {
                         hjzrsc++;
                     }
                     //判断是否是在今天操作的人员信息
-                    if(s.before(czrk.getUpdateTime()) && czrk.getUpdateTime().before(e)){
-                        if(!"1".equals(czrk.getStatus())){
+                    if (s.before(czrk.getUpdateTime()) && czrk.getUpdateTime().before(e)) {
+                        if (!"1".equals(czrk.getStatus())) {
                             hjjsc++;
-                        }else{
+                        } else {
                             hjxzc++;
                         }
                     }
@@ -324,7 +323,7 @@ public class TaskService {
             resultc.put("hjbfb", NumberUtils.percent(hjzrs, czzrs));
 
 
-            if(czrkJzdzList==null){
+            if (czrkJzdzList == null) {
                 czrkJzdzList = new ArrayList<>();
             }
             //该镇户籍人口总数
@@ -337,15 +336,15 @@ public class TaskService {
 
             //循环所有人判断当前总人数,该镇 户籍人口今日新增,该镇 户籍人口今日减少
             for (CzrkJzdz czrkJzdz : czrkJzdzList) {
-                if(StringUtils.isNotEmpty(czrkJzdz.getVillageId()) && czrkJzdz.getVillageId().equals(areaId)){
-                    if("Y".equals(czrkJzdz.getStatus())){
+                if (StringUtils.isNotEmpty(czrkJzdz.getVillageId()) && czrkJzdz.getVillageId().equals(areaId)) {
+                    if ("Y".equals(czrkJzdz.getStatus())) {
                         czzrsc++;
                     }
                     //判断是否是在今天操作的人员信息
-                    if(s.before(czrkJzdz.getUpdateTime()) && czrkJzdz.getUpdateTime().before(e)){
-                        if("N".equals(czrkJzdz.getStatus())){
+                    if (s.before(czrkJzdz.getUpdateTime()) && czrkJzdz.getUpdateTime().before(e)) {
+                        if ("N".equals(czrkJzdz.getStatus())) {
                             czjsc++;
-                        }else{
+                        } else {
                             czxzc++;
                         }
                     }
@@ -385,7 +384,7 @@ public class TaskService {
         System.out.println("定时任务");
     }
 
-    private void townSts(JSONObject result, SysDept sysDept, List<Czrk> czrkList, List<CzrkJzdz> czrkJzdzList ,int shjzrs, int sczzrs) {
+    private void townSts(JSONObject result, SysDept sysDept, List<Czrk> czrkList, List<CzrkJzdz> czrkJzdzList, int shjzrs, int sczzrs) {
         String startTime = DateUtils.getTodayStartStr();
         String endTime = DateUtils.getTodayEndStr();
         Timestamp s = Timestamp.valueOf(startTime);
@@ -421,7 +420,7 @@ public class TaskService {
             zrs = czrkMapper.countAll();
         }*/
 
-        if(czrkList==null){
+        if (czrkList == null) {
             czrkList = new ArrayList<>();
         }
         //该镇户籍人口总数
@@ -434,15 +433,15 @@ public class TaskService {
 
         //循环所有人判断当前总人数,该镇 户籍人口今日新增,该镇 户籍人口今日减少
         for (Czrk czrk : czrkList) {
-            if(StringUtils.isNotEmpty(czrk.getVillageTownsId()) && String.valueOf(czrk.getVillageTownsId()).equals(areaId)){
-                if("1".equals(czrk.getStatus())){
+            if (StringUtils.isNotEmpty(czrk.getVillageTownsId()) && String.valueOf(czrk.getVillageTownsId()).equals(areaId)) {
+                if ("1".equals(czrk.getStatus())) {
                     hjzrs++;
                 }
                 //判断是否是在今天操作的人员信息
-                if(s.before(czrk.getUpdateTime()) && czrk.getUpdateTime().before(e)){
-                    if(!"1".equals(czrk.getStatus())){
+                if (s.before(czrk.getUpdateTime()) && czrk.getUpdateTime().before(e)) {
+                    if (!"1".equals(czrk.getStatus())) {
                         hjjs++;
-                    }else{
+                    } else {
                         hjxz++;
                     }
                 }
@@ -454,7 +453,7 @@ public class TaskService {
         result.put("hjbfb", NumberUtils.percent(hjzrs, shjzrs));
 
 
-        if(czrkJzdzList==null){
+        if (czrkJzdzList == null) {
             czrkJzdzList = new ArrayList<>();
         }
         //该镇户籍人口总数
@@ -467,15 +466,15 @@ public class TaskService {
 
         //循环所有人判断当前总人数,该镇 户籍人口今日新增,该镇 户籍人口今日减少
         for (CzrkJzdz czrkJzdz : czrkJzdzList) {
-            if(StringUtils.isNotEmpty(czrkJzdz.getTownId()) && czrkJzdz.getTownId().equals(areaId)){
-                if("Y".equals(czrkJzdz.getStatus())){
+            if (StringUtils.isNotEmpty(czrkJzdz.getTownId()) && czrkJzdz.getTownId().equals(areaId)) {
+                if ("Y".equals(czrkJzdz.getStatus())) {
                     czzrs++;
                 }
                 //判断是否是在今天操作的人员信息
-                if(s.before(czrkJzdz.getUpdateTime()) && czrkJzdz.getUpdateTime().before(e)){
-                    if("N".equals(czrkJzdz.getStatus())){
+                if (s.before(czrkJzdz.getUpdateTime()) && czrkJzdz.getUpdateTime().before(e)) {
+                    if ("N".equals(czrkJzdz.getStatus())) {
                         czjs++;
-                    }else{
+                    } else {
                         czxz++;
                     }
                 }
@@ -543,15 +542,15 @@ public class TaskService {
         return STS_CZRK_ + deptId + ":" + DateUtils.getDate();
     }
 
-    public void getNewborn(){
+    public void getNewborn() {
         Map<String, String> paramMap = new HashMap<>();
-        paramMap.put("client_id","acdf50bd13be4901b64c62b1fee862c0");
-        paramMap.put("client_secret","a3650d67fc034b2d8ea259182b3d99f3");
+        paramMap.put("client_id", "acdf50bd13be4901b64c62b1fee862c0");
+        paramMap.put("client_secret", "a3650d67fc034b2d8ea259182b3d99f3");
         String http = "http://172.27.189.244:9090/oauth/tocken";
         try {
-            String data = HttpClientUtils.doGet(http,paramMap);
+            String data = HttpClientUtils.doGet(http, paramMap);
 
-            List<BirthRecords> birthRecordsList = JSONObject.parseArray(data,BirthRecords.class);
+            List<BirthRecords> birthRecordsList = JSONObject.parseArray(data, BirthRecords.class);
             for (BirthRecords birthRecords : birthRecordsList) {
                 birthRecords.setIsDel("N");
                 birthRecords.setCreateBy("系统");
@@ -567,18 +566,17 @@ public class TaskService {
     }
 
 
-
     /**
      * 获取政务网token
      */
-    public  String getToken(){
+    public String getToken() {
         String token = "";
         Map<String, String> paramMap = new HashMap<>();
-        paramMap.put("client_id","acdf50bd13be4901b64c62b1fee862c0");
-        paramMap.put("client_secret","a3650d67fc034b2d8ea259182b3d99f3");
-        String http = "http://60.171.171.235:9090/oauth/tocken";
+        paramMap.put("client_id", "acdf50bd13be4901b64c62b1fee862c0");
+        paramMap.put("client_secret", "a3650d67fc034b2d8ea259182b3d99f3");
+        String http = "http://60.171.171.235:9090/oauth/token";
         try {
-            String data = HttpClientUtils.doGet(http,paramMap);
+            String data = HttpClientUtils.doGet(http, paramMap);
             JSONObject jsonObject = JSONObject.parseObject(data);
             token = jsonObject.getString("access_token");
         } catch (IOException e) {
@@ -586,26 +584,39 @@ public class TaskService {
         }
         return token;
     }
-    /***
-     * 抓取核酸数据每10分钟抓取一次
-     */
-    @Scheduled(cron = "0 0/10 * * * ? ")
+
     /**
      * 抓取核酸数据每10分钟抓取一次,新增到accounting_data
      */
-    public void insertAccountingData(){
+    @Scheduled(cron = "0 0/10 * * * ? ")
+    public void insertAccountingData() {
         String token = getToken();
-        if (StringUtils.isNotBlank(token)){
+        if (StringUtils.isNotBlank(token)) {
+            String startTime = redisService.getCacheObject("startTime");
             Map<String, String> paramMap = new HashMap<>();
-            paramMap.put("client_id","acdf50bd13be4901b64c62b1fee862c0");
-            paramMap.put("access_token",token);
-            paramMap.put("sfzhm","");
+            paramMap.put("client_id", "acdf50bd13be4901b64c62b1fee862c0");
+            paramMap.put("access_token", token);
+            paramMap.put("sfzhm", "");
+            if (StringUtils.isBlank(startTime)) {
+                //第一次抓取当前时间到之前的10分钟的数据
+                Date nowDate = DateUtils.getNowDate();
+                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                String endTime = format.format(nowDate);
+                startTime = DateUtils.plusSeconds(endTime, 10);
+                redisService.setCacheObject("startTime", endTime);
+            }
+            String endTime = DateUtils.formatString(new Date());
+            redisService.setCacheObject("startTime", endTime);
+            endTime = endTime.replace(" ", "%20");
+            startTime = startTime.replace(" ", "%20");
+            paramMap.put("start_time", startTime);
+            paramMap.put("end_time", endTime);
             String http = "http://60.171.171.235:9090/service/api/wjw/qshssjsjc";
             try {
-                String data = HttpClientUtils.doGet(http,paramMap);
-                if (StringUtils.isNotBlank(data)){
+                String data = HttpClientUtils.doGet(http, paramMap);
+                if (StringUtils.isNotBlank(data)) {
                     List<AccountingData> list = JSONObject.parseArray(data, AccountingData.class);
-                    if (list != null && list.size() > 0){
+                    if (list != null && list.size() > 0) {
                         //插入数据
                         accountingDataService.insertAccountingData(list);
                     }

+ 5 - 12
boman-web-core/src/main/java/com/boman/web/core/service/accounting/AccountingDataServiceImpl.java

@@ -60,11 +60,6 @@ public class AccountingDataServiceImpl implements IAccountingDataService{
         //设置查询列表权限
         setQueryRole(accountingData, sysUser, Czrk.HJ);
         List<AccountingDataVo> list = accountingDataMapper.selectAccountingDataHjList(accountingData);
-        list.forEach(e ->{
-            if (StringUtils.isNotBlank(e.getJcsj())){
-                e.setIsNucleicAcid("Y");
-            }
-        });
         CzrkUtils.packAddrNucleicAcid(list);
         return list;
     }
@@ -82,11 +77,6 @@ public class AccountingDataServiceImpl implements IAccountingDataService{
         //设置查询列表权限
         setQueryRole(accountingData, sysUser, Czrk.CZ);
         List<AccountingDataVo> list = accountingDataMapper.selectAccountingDataJzdzList(accountingData);
-        list.forEach(e ->{
-            if (StringUtils.isNotBlank(e.getJcsj())){
-                e.setIsNucleicAcid("Y");
-            }
-        });
         CzrkUtils.packAddrNucleicAcid(list);
         return list;
     }
@@ -115,11 +105,14 @@ public class AccountingDataServiceImpl implements IAccountingDataService{
             }
             String mainKey = accountingData.getMainKey();
             accountingData.setId(mainKey);
-            mapper.insertAccountingData(accountingData);
+            int result = mapper.selectById(mainKey);
+            if (result == 0){
+                mapper.insertAccountingData(accountingData);
+            }
         }
         sqlSession.flushStatements();
         long end = System.currentTimeMillis();
-        System.out.println("---------------插入核酸数据耗时" + (start - end) + "---------------");
+        System.out.println("---------------插入核酸数据耗时" + (end - start) + "---------------");
         return 0;
     }
 }

+ 1 - 0
boman-web-core/src/main/java/com/boman/web/core/utils/HttpClientUtils.java

@@ -12,6 +12,7 @@ import org.apache.http.message.BasicNameValuePair;
 import org.apache.http.util.EntityUtils;
 
 import java.io.IOException;
+import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;

+ 6 - 3
boman-web-core/src/main/resources/mapper/AccountingDateMapper.xml

@@ -77,7 +77,7 @@
             <if test="villageTownsId != null  and villageTownsId != ''">and r.village_towns_id = #{villageTownsId}</if>
             <if test="villageId != null  and villageId != ''">and r.village_id = #{villageId}</if>
         </where>
-        order by d.jcsj DESC
+        order by d.cjsj DESC
     </select>
 
     <select id="selectAccountingDataJzdzList" parameterType="com.boman.web.core.domain.vo.AccountingDataVo"
@@ -101,7 +101,7 @@
             <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and z.town_id = #{villageTownsIdXjd}</if>
             <if test="villageIdXjd != null and villageIdXjd != ''">and z.village_id = #{villageIdXjd}</if>
         </where>
-        order by d.jcsj DESC
+        order by d.cjsj DESC
     </select>
 
 
@@ -144,7 +144,6 @@
             <if test="zjhm != null">#{zjhm},</if>
             <if test="cjsj != null">#{cjsj},</if>
             <if test="certificateNoType != null">#{certificateNoType},</if>
-            <if test="workUnit != null">#{workUnit},</if>
             <if test="xm != null">#{xm},</if>
             <if test="collectorName != null">#{collectorName},</if>
             <if test="cjssxq != null">#{cjssxq},</if>
@@ -152,4 +151,8 @@
             sysdate()
         </trim>
     </insert>
+
+    <select id="selectById" parameterType="String" resultType="int">
+        select count(1) from accounting_data where id = #{id}
+    </select>
 </mapper>