Selaa lähdekoodia

核酸数据导出

LIVE_YE 3 vuotta sitten
vanhempi
commit
eacdfa63b7

+ 22 - 6
boman-web-core/src/main/java/com/boman/web/core/controller/AccountingDataController.java

@@ -72,18 +72,34 @@ public class AccountingDataController extends BaseController {
     }
 
     /**
-     *  核酸数据导出
+     *  核酸数据导出(户籍)
      * @param response
      * @param accountingData
      * @throws IOException
      */
     @Log(title = "核酸数据", businessType = BusinessType.EXPORT)
-    @PreAuthorize(hasPermi = "system:accountingData:export")
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, @RequestBody AccountingData accountingData) throws IOException
+    @PreAuthorize(hasPermi = "system:accountingData:exportHj")
+    @PostMapping("/exportHj")
+    public void exportHj(HttpServletResponse response, @RequestBody AccountingDataVo accountingData) throws IOException
     {
-        List<AccountingData> accountingDataList = accountingDataService.getExport(accountingData);
-        ExcelUtil<AccountingData> util = new ExcelUtil<>(AccountingData.class);
+        List<AccountingDataVo> accountingDataList = accountingDataService.getExportHj(accountingData);
+        ExcelUtil<AccountingDataVo> util = new ExcelUtil<>(AccountingDataVo.class);
+        util.exportExcel(response, accountingDataList, "核酸数据");
+    }
+
+    /**
+     *  核酸数据导出(常住)
+     * @param response
+     * @param accountingData
+     * @throws IOException
+     */
+    @Log(title = "核酸数据", businessType = BusinessType.EXPORT)
+    @PreAuthorize(hasPermi = "system:accountingData:exportCz")
+    @PostMapping("/exportCz")
+    public void exportCz(HttpServletResponse response, @RequestBody AccountingDataVo accountingData) throws IOException
+    {
+        List<AccountingDataVo> accountingDataList = accountingDataService.exportCz(accountingData);
+        ExcelUtil<AccountingDataVo> util = new ExcelUtil<>(AccountingDataVo.class);
         util.exportExcel(response, accountingDataList, "核酸数据");
     }
 

+ 16 - 0
boman-web-core/src/main/java/com/boman/web/core/domain/vo/AccountingDataVo.java

@@ -25,6 +25,7 @@ public class AccountingDataVo extends BaseEntity {
     /**
      * 联系电话
      */
+    @Excel(name = "联系电话")
     private String lxdh;
     /**
      *
@@ -66,10 +67,12 @@ public class AccountingDataVo extends BaseEntity {
     /**
      * 身份证
      */
+    @Excel(name = "身份证号")
     private String zjhm;
     /**
      * 采集时间
      */
+    @Excel(name = "核酸时间")
     private String cjsj;
     /**
      * 证件类型
@@ -78,6 +81,7 @@ public class AccountingDataVo extends BaseEntity {
     /**
      * 姓名
      */
+    @Excel(name = "姓名")
     private String xm;
     /**
      * 交通工具
@@ -109,6 +113,7 @@ public class AccountingDataVo extends BaseEntity {
     /**
      * 是否核酸
      */
+    @Excel(name = "是否核酸")
     private String isNucleicAcid;
     /**
      * 时间段
@@ -117,10 +122,13 @@ public class AccountingDataVo extends BaseEntity {
     /**
      * 人口信息登记的联系电话
      */
+    @Excel(name = "联系电话")
     private String phoneNum;
 
 
 
+    @Excel(name = "户籍号")
+    private String hjh;
 
 
     /**
@@ -602,4 +610,12 @@ public class AccountingDataVo extends BaseEntity {
     public void setIsDel(String isDel) {
         this.isDel = isDel;
     }
+
+    public void setHjh(String hjh) {
+        this.hjh = hjh;
+    }
+
+    public String getHjh() {
+        return hjh;
+    }
 }

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

@@ -18,38 +18,45 @@ import java.util.List;
  */
 public interface AccountingDataMapper {
     /**
-     *潜山核酸数据列表页(根据户籍地)
+     * 潜山核酸数据列表页(根据户籍地)
+     *
      * @param accountingData
      * @return
      */
-   List<AccountingDataVo> selectAccountingDataHjList(AccountingDataVo accountingData);
+    List<AccountingDataVo> selectAccountingDataHjList(AccountingDataVo accountingData);
 
     /**
      * 潜山核酸数据列表页(根据居住地址)
+     *
      * @param accountingData
      * @return
      */
-   List<AccountingDataVo> selectAccountingDataJzdzList(AccountingDataVo accountingData);
+    List<AccountingDataVo> selectAccountingDataJzdzList(AccountingDataVo accountingData);
+
+    List<AccountingDataVo> getExportHj(AccountingDataVo accountingData);
 
-    List<AccountingData> getExport(AccountingData accountingData);
+    List<AccountingDataVo> exportCz(AccountingDataVo accountingData);
 
     /**
      * 新增
+     *
      * @param accountingData
      * @return
      */
-   int insertAccountingData(AccountingDataVo accountingData);
+    int insertAccountingData(AccountingDataVo accountingData);
 
-    /**根据id查询
+    /**
+     * 根据id查询
      *
      * @param id
      * @return
      */
-   int selectById(@Param("id") String id);
+    int selectById(@Param("id") String id);
 
     AccountingDataVo getAccountingDataOne();
 
     List<AccountingDataVo> getAllData();
 
-    List<AccountingDataVo> thirdNucleicAcid(@Param("startTime")String startTime,@Param("endTime")String endTime);
+    List<AccountingDataVo> thirdNucleicAcid(@Param("startTime") String startTime, @Param("endTime") String endTime);
+
 }

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

@@ -966,6 +966,41 @@ public class TaskService {
     /***
      * 来宜数据匹配
      */
+    public void toQianshanData() {
+        String token = getToken();
+        if (StringUtils.isNotBlank(token)) {
+
+            String startTime = redisService.getCacheObject("toQianShanStartTime");
+            if (StringUtils.isEmpty(startTime)) {
+                startTime = "2022-05-14 00:00:00";
+            }
+
+            Map<String, String> paramMap = new HashMap<>();
+            paramMap.put("client_id", "acdf50bd13be4901b64c62b1fee862c0");
+            paramMap.put("access_token", token);
+            paramMap.put("rc", "潜山");
 
+            String endTime = DateUtils.formatString(new Date());
+            redisService.setCacheObject("toQianShanStartTime", endTime);
+            endTime = endTime.replace(" ", "%20");
+            startTime = startTime.replace(" ", "%20");
+            paramMap.put("djsjqs", startTime);
+            paramMap.put("djsjjs", endTime);
+            String http = "http://60.171.171.235:9090/service/api/rkk/qslyrysj";
+            try {
+                String data = HttpClientUtils.doGet(http, paramMap);
+
+                if (StringUtils.isNotBlank(data)) {
+                    List<AccountingDataVo> list = JSONObject.parseArray(data, AccountingDataVo.class);
+                    if (list != null && list.size() > 0) {
+                        //插入数据
+                        //accountingDataService.insertAccountingData(list);
+                    }
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
 
 }

+ 24 - 15
boman-web-core/src/main/java/com/boman/web/core/service/accounting/AccountingDataServiceImpl.java

@@ -146,32 +146,41 @@ public class AccountingDataServiceImpl implements IAccountingDataService {
     }
 
     /**
-     * 核酸数据导出
+     * 核酸数据导出(户籍)
      *
      * @param accountingData
      * @throws IOException
      */
     @Override
-    public List<AccountingData> getExport(AccountingData accountingData) {
-
-        //SysUser sysUser = AuthUtils.getLoginUser().getSysUser();
-        //setQueryRole(czrk,sysUser, Czrk.HJ);
-        //setAgeScope(czrk);
-        List<AccountingData> accountingDataList = accountingDataMapper.getExport(accountingData);
+    public List<AccountingDataVo> getExportHj(AccountingDataVo accountingData) {
+        SysUser sysUser = AuthUtils.getLoginUser().getSysUser();
+        //设置查询列表权限
+        setQueryRole(accountingData, sysUser, Czrk.HJ);
+        List<AccountingDataVo> accountingDataList = accountingDataMapper.getExportHj(accountingData);
 
-       /* List<Czrk> czrkListp = czrkList.stream().sorted(
-                //以户籍号排序
-                Comparator.comparing(Czrk::getCode, Comparator.reverseOrder())
-                        //户主排序
-                        .thenComparing(Czrk::getHouseType, Comparator.reverseOrder())
+        CzrkUtils.packAddrNucleicAcid(accountingDataList);
+        if (accountingDataList == null || accountingDataList.size() <= 0) {
+            throw new BaseException("请下载属于本乡镇数据");
+        }
+        return accountingDataList;
+    }
 
-        ).collect(Collectors.toList());*/
+    /***
+     * 核酸数据导出(常住)
+     * @param accountingData
+     * @return
+     */
+    @Override
+    public List<AccountingDataVo> exportCz(AccountingDataVo accountingData) {
+        SysUser sysUser = AuthUtils.getLoginUser().getSysUser();
+        //设置查询列表权限
+        setQueryRole(accountingData, sysUser, Czrk.CZ);
+        List<AccountingDataVo> accountingDataList = accountingDataMapper.exportCz(accountingData);
 
-        //CzrkUtils.packAddr(accountingDataList);
+        CzrkUtils.packAddrNucleicAcid(accountingDataList);
         if (accountingDataList == null || accountingDataList.size() <= 0) {
             throw new BaseException("请下载属于本乡镇数据");
         }
-        //packAddr(czrkList);
         return accountingDataList;
     }
 

+ 3 - 1
boman-web-core/src/main/java/com/boman/web/core/service/accounting/IAccountingDataService.java

@@ -32,7 +32,7 @@ public interface IAccountingDataService {
      * @param accountingData
      * @throws IOException
      */
-    List<AccountingData> getExport(AccountingData accountingData);
+    List<AccountingDataVo> getExportHj(AccountingDataVo accountingData);
 
     AjaxResult toQianshan(String rc, String djsjqs, String djsjjs, String name, String sfzhm);
 
@@ -55,4 +55,6 @@ public interface IAccountingDataService {
      * 从第三方库获取核酸数据
      */
     void thirdNucleicAcid(String startTime,String endTime);
+
+    List<AccountingDataVo> exportCz(AccountingDataVo accountingData);
 }

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

@@ -31,6 +31,8 @@
         <result property="updateBy" column="update_by"/>
         <result property="updateTime" column="update_time"/>
         <result property="isDel" column="is_del"/>
+        <result property="hjh" column="hjh"/>
+
 
         <!--以下是返回是需要使用-->
         <result property="phoneNum" column="phone_num"/>
@@ -192,8 +194,67 @@
         where id = #{id}
     </select>
 
-    <select id="getExport" resultMap="AccountingDataResult">
+    <select id="getExportHj" resultMap="AccountingDataResult">
+        SELECT
+        r.id,r.user_name as xm,r.id_card as zjhm,r.code as hjh,r.is_nucleicAcid as isNucleicAcid,
+        r.province,r.city,r.region,r.village_towns,r.village,r.now_in,r.phone_num,
+        d.lxdh,d.jcsj,d.jcdd,d.cjdd,d.cjsj,
+        z.province as provinceXjd , z.city as cityXjd,z.region as regionXjd , z.town as villageTownsXjd, z.village as
+        villageXjd,z.now_in
+        FROM czrk r
+        left join czrk_jzdz z on r.id =z.czrk_id
+        left join `accounting_data` d on r.id_card = d.zjhm
+        <where>
+            r.is_del = 'N'
+            and r.status = '1'
+            <if test="zjhm != null  and zjhm != ''">and r.id_card = #{zjhm}</if>
+            <if test="xm != null  and xm != ''">and r.user_name like concat(#{xm}, '%')</if>
+            <if test="params.startTime != null  and params.startTime != '' and params.startTime != 'null'">and
+                DATE_FORMAT(d.cjsj,'%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{params.startTime},'%Y-%m-%d %H:%i:%s')
+            </if>
+            <if test="params.endTime != null  and params.endTime != ''  and params.endTime != 'null'">and
+                DATE_FORMAT(d.cjsj,'%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{params.endTime},'%Y-%m-%d %H:%i:%s')
+            </if>
+            <if test="isNucleicAcid != null  and isNucleicAcid != ''">and r.is_nucleicAcid = #{isNucleicAcid}</if>
+            <if test="provinceId != null  and provinceId != ''">and r.province_id = #{provinceId}</if>
+            <if test="cityId != null  and cityId != ''">and r.city_id = #{cityId}</if>
+            <if test="regionId != null  and regionId != ''">and r.region_id = #{regionId}</if>
+            <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.cjsj DESC,r.create_time DESC
+    </select>
+
 
+    <select id="exportCz" resultMap="AccountingDataResult">
+        select
+        r.id,r.user_name as xm,r.id_card as zjhm,r.code as hjh,r.is_nucleicAcid as isNucleicAcid,
+        r.province,r.city,r.region,r.village_towns,r.village,r.now_in,r.phone_num,
+        d.lxdh,d.jcsj,d.jcdd,d.cjdd,d.cjsj,
+        z.province as provinceXjd , z.city as cityXjd,z.region as regionXjd , z.town as villageTownsXjd, z.village as
+        villageXjd,z.now_in
+        from czrk r
+        left join czrk_jzdz z on r.id =z.czrk_id
+        left join `accounting_data` d on r.id_card = d.zjhm
+        <where>
+            r.is_del = 'N'
+            and r.status = '1'
+            <if test="zjhm != null  and zjhm != ''">and r.id_card = #{zjhm}</if>
+            <if test="xm != null  and xm != ''">and r.user_name like concat(#{xm}, '%')</if>
+            <if test="params.startTime != null  and params.startTime != '' and params.startTime != 'null'">and
+                DATE_FORMAT(d.cjsj,'%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{params.startTime},'%Y-%m-%d %H:%i:%s')
+            </if>
+            <if test="params.endTime != null  and params.endTime != '' and params.endTime != 'null'">and
+                DATE_FORMAT(d.cjsj,'%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{params.endTime},'%Y-%m-%d %H:%i:%s')
+            </if>
+            <if test="isNucleicAcid != null  and isNucleicAcid != ''">and r.is_nucleicAcid = #{isNucleicAcid}</if>
+            <if test="provinceIdXjd != null and provinceIdXjd != ''">and z.province_id = #{provinceIdXjd}</if>
+            <if test="cityIdXjd != null and cityIdXjd != ''">and z.city_id = #{cityIdXjd}</if>
+            <if test="regionIdXjd != null and regionIdXjd != ''">and z.region_id = #{regionIdXjd}</if>
+            <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.cjsj DESC,r.create_time DESC
     </select>
 
     <select id="getAccountingDataOne" resultMap="AccountingDataResult">