瀏覽代碼

来宜人员

LIVE_YE 3 年之前
父節點
當前提交
67d102c183

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

@@ -80,5 +80,11 @@ public class TaskController {
         taskService.nucleicAcidStatistics();
     }
 
+    @GetMapping("/toQianshanData")
+    private void toQianshanData() {
+        taskService.toQianshanData();
+    }
+
+
 
 }

+ 23 - 0
boman-web-core/src/main/java/com/boman/web/core/controller/ToQianshanPersonnerController.java

@@ -0,0 +1,23 @@
+package com.boman.web.core.controller;
+
+import com.boman.common.core.web.controller.BaseController;
+import com.boman.web.core.service.toQianShan.ToQianshanPersonnerService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+
+@RestController
+@RequestMapping("/core/toQianshan")
+@Slf4j
+public class ToQianshanPersonnerController extends BaseController {
+
+    @Resource
+    private ToQianshanPersonnerService toQianshanPersonnerService;
+
+
+
+
+}

+ 229 - 0
boman-web-core/src/main/java/com/boman/web/core/domain/ToQianshanPersonner.java

@@ -0,0 +1,229 @@
+package com.boman.web.core.domain;
+
+
+import com.boman.domain.BaseEntity;
+
+public class ToQianshanPersonner  extends BaseEntity {
+
+  /***
+   * id
+   */
+  private long id;
+
+  /***
+   * 详细地址
+   */
+  private String hiAdress;
+
+  /***
+   * 风险等级
+   */
+  private String riskLv;
+
+  /***
+   * 目的地
+   */
+  private String address;
+
+  /***
+   * 来源地 区县
+   */
+  private String qu;
+
+  /***
+   * 性别
+   */
+  private String sex;
+
+  /***
+   * 姓名
+   */
+  private String hiName;
+
+  /***
+   * 目的地--街道
+   */
+  private String hiDestinationStreet;
+
+  /***
+   * 来源地-风险等级
+   */
+  private String fxdjLy;
+
+  /***
+   * 目的地--居委会
+   */
+  private String hiDestinationRc;
+
+  /***
+   * 电话
+   */
+  private String hiPhone;
+
+  /***
+   * 登记时间
+   */
+  private String hiDate;
+
+  /***
+   * 身份证
+   */
+  private String hiIcd;
+
+  /***
+   * 来源地 城市
+   */
+  private String shi;
+
+  /***
+   * 来源地 省份
+   */
+  private String sheng;
+
+  /***
+   * 目的地---区县
+   */
+  private String hiDestinationArea;
+
+
+
+  public long getId() {
+    return id;
+  }
+
+  public void setId(long id) {
+    this.id = id;
+  }
+
+
+  public String getHiAdress() {
+    return hiAdress;
+  }
+
+  public void setHiAdress(String hiAdress) {
+    this.hiAdress = hiAdress;
+  }
+
+
+  public String getRiskLv() {
+    return riskLv;
+  }
+
+  public void setRiskLv(String riskLv) {
+    this.riskLv = riskLv;
+  }
+
+
+  public String getAddress() {
+    return address;
+  }
+
+  public void setAddress(String address) {
+    this.address = address;
+  }
+
+
+  public String getQu() {
+    return qu;
+  }
+
+  public void setQu(String qu) {
+    this.qu = qu;
+  }
+
+
+  public String getSex() {
+    return sex;
+  }
+
+  public void setSex(String sex) {
+    this.sex = sex;
+  }
+
+
+  public String getHiDestinationStreet() {
+    return hiDestinationStreet;
+  }
+
+  public void setHiDestinationStreet(String hiDestinationStreet) {
+    this.hiDestinationStreet = hiDestinationStreet;
+  }
+
+
+  public String getFxdjLy() {
+    return fxdjLy;
+  }
+
+  public void setFxdjLy(String fxdjLy) {
+    this.fxdjLy = fxdjLy;
+  }
+
+
+  public String getHiDestinationRc() {
+    return hiDestinationRc;
+  }
+
+  public void setHiDestinationRc(String hiDestinationRc) {
+    this.hiDestinationRc = hiDestinationRc;
+  }
+
+
+  public String getHiPhone() {
+    return hiPhone;
+  }
+
+  public void setHiPhone(String hiPhone) {
+    this.hiPhone = hiPhone;
+  }
+
+
+  public String getHiDate() {
+    return hiDate;
+  }
+
+  public void setHiDate(String hiDate) {
+    this.hiDate = hiDate;
+  }
+
+  public void setHiIcd(String hiIcd) {
+    this.hiIcd = hiIcd;
+  }
+
+  public String getHiIcd() {
+    return hiIcd;
+  }
+
+  public String getShi() {
+    return shi;
+  }
+
+  public void setShi(String shi) {
+    this.shi = shi;
+  }
+
+
+  public String getSheng() {
+    return sheng;
+  }
+
+  public void setSheng(String sheng) {
+    this.sheng = sheng;
+  }
+
+
+  public String getHiDestinationArea() {
+    return hiDestinationArea;
+  }
+
+  public void setHiDestinationArea(String hiDestinationArea) {
+    this.hiDestinationArea = hiDestinationArea;
+  }
+
+  public String getHiName() {
+    return hiName;
+  }
+
+  public void setHiName(String hiName) {
+    this.hiName = hiName;
+  }
+}

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

@@ -250,4 +250,6 @@ public interface CzrkMapper {
     List<Czrk> getAllCzrkHjVillage(Czrk czrk);
 
     int setNoRl(Czrk czrk);
+
+    void updateCzrkByToQianshanPersonner(Czrk czrk);
 }

+ 9 - 0
boman-web-core/src/main/java/com/boman/web/core/mapper/ToQianshanPersonnerMapper.java

@@ -0,0 +1,9 @@
+package com.boman.web.core.mapper;
+
+
+import com.boman.web.core.domain.ToQianshanPersonner;
+
+public interface ToQianshanPersonnerMapper {
+
+    void insertToQianshanPersonner(ToQianshanPersonner toQianshanPersonner);
+}

+ 15 - 3
boman-web-core/src/main/java/com/boman/web/core/service/TaskService.java

@@ -21,6 +21,7 @@ import com.boman.system.api.RemoteUserService;
 import com.boman.web.core.domain.AccountingData;
 import com.boman.web.core.domain.BirthRecords;
 import com.boman.web.core.domain.TSampling514;
+import com.boman.web.core.domain.ToQianshanPersonner;
 import com.boman.web.core.domain.vo.AccountingDataVo;
 import com.boman.web.core.mapper.AccountingDataMapper;
 import com.boman.web.core.mapper.CzrkMapper;
@@ -31,6 +32,7 @@ import com.boman.web.core.service.common.ICommonService;
 import com.boman.web.core.service.czrk.CzrkServiceImpl;
 import com.boman.web.core.service.czrk.ICzrkJzdzService;
 import com.boman.web.core.service.ip.IpTimesService;
+import com.boman.web.core.service.toQianShan.ToQianshanPersonnerService;
 import com.boman.web.core.utils.AuthUtils;
 import com.boman.web.core.utils.HttpClientUtils;
 import org.apache.commons.lang3.BooleanUtils;
@@ -89,6 +91,9 @@ public class TaskService {
     @Resource
     private IAccountingDataService accountingDataService;
 
+    @Resource
+    private ToQianshanPersonnerService toQianshanPersonnerService;
+
     @Resource
     private SqlSessionFactory sqlSessionFactory;
     private static final String tableName = "attendance_table";
@@ -964,9 +969,13 @@ public class TaskService {
 
 
     /***
-     * 来宜数据匹配
+     * 来宜数据匹配(每个小时的35分开始跑数据)
      */
+    @Scheduled(cron = "0 35 * * * ? ")
     public void toQianshanData() {
+        System.out.println("batchInsert 来宜人员插入开始========");
+        long start = System.currentTimeMillis();
+
         String token = getToken();
         if (StringUtils.isNotBlank(token)) {
 
@@ -991,16 +1000,19 @@ public class TaskService {
                 String data = HttpClientUtils.doGet(http, paramMap);
 
                 if (StringUtils.isNotBlank(data)) {
-                    List<AccountingDataVo> list = JSONObject.parseArray(data, AccountingDataVo.class);
+                    List<ToQianshanPersonner> list = JSONObject.parseArray(data, ToQianshanPersonner.class);
                     if (list != null && list.size() > 0) {
                         //插入数据
-                        //accountingDataService.insertAccountingData(list);
+                        toQianshanPersonnerService.insertToQianshanPersonner(list);
                     }
                 }
             } catch (IOException e) {
                 e.printStackTrace();
             }
         }
+
+        long end = System.currentTimeMillis();
+        System.out.println("---------------插入来宜人员数据耗时" + (end - start) + "---------------");
     }
 
 }

+ 11 - 0
boman-web-core/src/main/java/com/boman/web/core/service/toQianShan/ToQianshanPersonnerService.java

@@ -0,0 +1,11 @@
+package com.boman.web.core.service.toQianShan;
+
+import com.boman.web.core.domain.ToQianshanPersonner;
+
+import java.util.List;
+
+public interface ToQianshanPersonnerService {
+
+
+    void insertToQianshanPersonner(List<ToQianshanPersonner> list);
+}

+ 57 - 0
boman-web-core/src/main/java/com/boman/web/core/service/toQianShan/ToQianshanPersonnerServiceImpl.java

@@ -0,0 +1,57 @@
+package com.boman.web.core.service.toQianShan;
+
+import com.boman.common.core.utils.StringUtils;
+import com.boman.domain.Czrk;
+import com.boman.web.core.domain.ToQianshanPersonner;
+import com.boman.web.core.domain.vo.AccountingDataVo;
+import com.boman.web.core.mapper.AccountingDataMapper;
+import com.boman.web.core.mapper.CzrkMapper;
+import com.boman.web.core.mapper.StandardlyMapper;
+import com.boman.web.core.mapper.ToQianshanPersonnerMapper;
+import org.apache.ibatis.session.ExecutorType;
+import org.apache.ibatis.session.SqlSession;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+
+@Service
+public class ToQianshanPersonnerServiceImpl implements ToQianshanPersonnerService {
+
+    @Resource
+    private SqlSessionFactory sqlSessionFactory;
+
+    @Autowired
+    private ToQianshanPersonnerMapper toQianshanPersonnerMapper;
+
+    @Resource
+    private CzrkMapper czrkMapper;
+
+    @Override
+    public void insertToQianshanPersonner(List<ToQianshanPersonner> list) {
+        SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
+        ToQianshanPersonnerMapper mapper = sqlSession.getMapper(ToQianshanPersonnerMapper.class);
+
+
+        Czrk czrk = new Czrk();
+
+        for (ToQianshanPersonner toQianshanPersonner : list) {
+            String zjhm = toQianshanPersonner.getHiIcd();
+            if (StringUtils.isNotBlank(zjhm)) {
+                czrk.setIdCard(zjhm);
+                czrk.setToAppropriatePhone(toQianshanPersonner.getHiPhone());
+                czrk.setToAppropriateTime(toQianshanPersonner.getHiDate());
+                //去更新常住人口表中数据
+                czrkMapper.updateCzrkByToQianshanPersonner(czrk);
+            }
+
+            mapper.insertToQianshanPersonner(toQianshanPersonner);
+
+        }
+        sqlSession.flushStatements();
+
+    }
+}

+ 6 - 0
boman-web-core/src/main/resources/mapper/CzrkMapper.xml

@@ -1575,4 +1575,10 @@
             <if test="villageId != null  and villageId != ''">and village_id = #{villageId}</if>
         </where>
     </update>
+
+    <update id="updateCzrkByToQianshanPersonner">
+        update czrk
+        set to_appropriate_phone = #{toAppropriatePhone},to_appropriate_time = #{toAppropriateTime}
+        where id_card = #{idCard}
+    </update>
 </mapper>

+ 71 - 0
boman-web-core/src/main/resources/mapper/ToQianshanPersonnerMapper.xml

@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.boman.web.core.mapper.ToQianshanPersonnerMapper">
+
+    <resultMap type="com.boman.web.core.domain.ToQianshanPersonner" id="ToQianshanPersonnerResult">
+        <result property="id" column="id"/>
+        <result property="hiAdress" column="hi_adress"/>
+        <result property="riskLv" column="risk_lv"/>
+        <result property="address" column="address"/>
+        <result property="qu" column="QU"/>
+        <result property="sex" column="sex"/>
+        <result property="hiName" column="hi_name"/>
+        <result property="hiDestinationStreet" column="hi_destination_street"/>
+        <result property="fxdjLy" column="FXDJ_LY"/>
+        <result property="hiDestinationRc" column="hi_destination_rc"/>
+        <result property="hiPhone" column="hi_phone"/>
+        <result property="hiDate" column="hi_date"/>
+        <result property="hiIcd" column="hi_icd"/>
+        <result property="shi" column="SHI"/>
+        <result property="sheng" column="SHENG"/>
+        <result property="hiDestinationArea" column="hi_destination_area"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <insert id="insertToQianshanPersonner">
+        insert into to_qianshan_personner
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="hiAdress != null">hi_adress,</if>
+            <if test="riskLv != null">risk_lv,</if>
+            <if test="address != null">address,</if>
+            <if test="qu != null">QU,</if>
+            <if test="sex != null">sex,</if>
+            <if test="hiName != null">hi_name,</if>
+            <if test="hiDestinationStreet != null">hi_destination_street,</if>
+            <if test="fxdjLy != null">FXDJ_LY,</if>
+            <if test="hiDestinationRc != null">hi_destination_rc,</if>
+            <if test="hiIcd != null">hi_icd,</if>
+            <if test="hiPhone != null">hi_phone,</if>
+            <if test="hiDate != null">hi_date,</if>
+            <if test="shi != null">SHI,</if>
+            <if test="sheng != null">SHENG,</if>
+            <if test="hiDestinationArea != null">hi_destination_area,</if>
+            create_time
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="hiAdress != null">#{hiAdress},</if>
+            <if test="riskLv != null">#{riskLv},</if>
+            <if test="address != null">#{address},</if>
+            <if test="qu != null">#{qu},</if>
+            <if test="sex != null">#{sex},</if>
+            <if test="hiName != null">#{hiName},</if>
+            <if test="hiDestinationStreet != null">#{hiDestinationStreet},</if>
+            <if test="fxdjLy != null">#{fxdjLy},</if>
+            <if test="hiDestinationRc != null">#{hiDestinationRc},</if>
+            <if test="hiIcd != null">#{hiIcd},</if>
+            <if test="hiPhone != null">#{hiPhone},</if>
+            <if test="hiDate != null">#{hiDate},</if>
+            <if test="shi != null">#{shi},</if>
+            <if test="sheng != null">#{sheng},</if>
+            <if test="hiDestinationArea != null">#{hiDestinationArea},</if>
+            sysdate()
+        </trim>
+    </insert>
+
+
+</mapper>