LIVE_YE преди 3 години
родител
ревизия
9ac4dfe36f

+ 38 - 0
boman-web-core/src/main/java/com/boman/web/core/controller/AccountingDataController.java

@@ -1,7 +1,13 @@
 package com.boman.web.core.controller;
+import com.boman.common.core.utils.poi.ExcelUtil;
 
 import com.boman.common.core.web.controller.BaseController;
+import com.boman.common.log.annotation.Log;
+import com.boman.common.log.enums.BusinessType;
+import com.boman.common.security.annotation.PreAuthorize;
+import com.boman.domain.Czrk;
 import com.boman.domain.TableDataInfo;
+import com.boman.domain.dto.AjaxResult;
 import com.boman.web.core.domain.AccountingData;
 import com.boman.web.core.domain.vo.AccountingDataVo;
 import com.boman.web.core.service.TaskService;
@@ -10,6 +16,8 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
 import java.util.List;
 
 /**
@@ -40,6 +48,36 @@ public class AccountingDataController extends BaseController {
         return getDataTable(list);
     }
 
+    /***
+     * 潜山来宜人员数据
+     * @param rc
+     * @param djsjqs
+     * @param djsjjs
+     * @param name
+     * @param sfzhm
+     * @return
+     */
+    @GetMapping("/toQianshan")
+    public AjaxResult toQianshan(String rc, String djsjqs, String djsjjs, String name, String sfzhm) {
+        return accountingDataService.toQianshan(rc,djsjqs,djsjjs,name,sfzhm);
+    }
+
+    /**
+     *  核酸数据导出
+     * @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
+    {
+        List<AccountingData> accountingDataList = accountingDataService.getExport(accountingData);
+        ExcelUtil<AccountingData> util = new ExcelUtil<>(AccountingData.class);
+        util.exportExcel(response, accountingDataList, "核酸数据");
+    }
+
     /***
      *  潜山核酸数据列表页(根据居住地址)
      * @return

+ 271 - 0
boman-web-core/src/main/java/com/boman/web/core/domain/AccountingData.java

@@ -5,6 +5,7 @@ package com.boman.web.core.domain;
  */
 
 import com.boman.domain.BaseEntity;
+import com.boman.domain.annotation.Excel;
 
 /**
  * @author tjf
@@ -114,6 +115,56 @@ public class AccountingData extends BaseEntity {
      */
     private String timeSlot;
 
+
+    private String provinceIdXjz;
+    private String cityIdXjz;
+    private String regionIdXjz;
+    private String villageTownsIdXjz;
+    private String villageIdXjz;
+
+    private String provinceXjz;
+    private String cityXjz;
+    private String regionXjz;
+    private String villageTownsXjz;
+    private String villageXjz;
+    @Excel(name = "居住详细地址")
+    private String nowXjz;
+    /** 现居地列表展示 安徽省安庆市潜山市xx乡xx村xx组 */
+    @Excel(name = "居住地址")
+    private String nowInSelect;
+
+
+
+
+    private String provinceIdXhj;
+    private String cityIdXhj;
+    private String regionIdXhj;
+    private String villageTownsIdXhj;
+    private String villageIdXhj;
+    private String villagerGroupIdXhj;
+
+    private String provinceXhj;
+    private String cityXhj;
+    private String regionXhj;
+    private String villageTownsXhj;
+    private String villageXhj;
+    private String villagerGroupXhj;
+    /**
+     * 户籍地的详细地址
+     */
+    @Excel(name = "户籍详细地址")
+    private String nowInXhj;
+    /** 户籍地列表展示 安徽省安庆市潜山市xx乡xx村xx组 */
+    @Excel(name = "户籍地址")
+    private String domicileSelect;
+
+    /**
+     * 户籍号码
+     */
+    @Excel(name = "人口信息登记的联系电话")
+    private String phoneNum;
+
+
     public String getId() {
         return id;
     }
@@ -307,4 +358,224 @@ public class AccountingData extends BaseEntity {
     public void setIsDel(String isDel) {
         this.isDel = isDel;
     }
+
+    public void setProvinceIdXjz(String provinceIdXjz) {
+        this.provinceIdXjz = provinceIdXjz;
+    }
+
+    public void setCityIdXjz(String cityIdXjz) {
+        this.cityIdXjz = cityIdXjz;
+    }
+
+    public void setRegionIdXjz(String regionIdXjz) {
+        this.regionIdXjz = regionIdXjz;
+    }
+
+    public void setVillageTownsIdXjz(String villageTownsIdXjz) {
+        this.villageTownsIdXjz = villageTownsIdXjz;
+    }
+
+    public void setVillageIdXjz(String villageIdXjz) {
+        this.villageIdXjz = villageIdXjz;
+    }
+
+    public void setProvinceXjz(String provinceXjz) {
+        this.provinceXjz = provinceXjz;
+    }
+
+    public void setCityXjz(String cityXjz) {
+        this.cityXjz = cityXjz;
+    }
+
+    public void setRegionXjz(String regionXjz) {
+        this.regionXjz = regionXjz;
+    }
+
+    public void setVillageTownsXjz(String villageTownsXjz) {
+        this.villageTownsXjz = villageTownsXjz;
+    }
+
+    public void setVillageXjz(String villageXjz) {
+        this.villageXjz = villageXjz;
+    }
+
+    public void setNowXjz(String nowXjz) {
+        this.nowXjz = nowXjz;
+    }
+
+    public void setNowInSelect(String nowInSelect) {
+        this.nowInSelect = nowInSelect;
+    }
+
+    public void setProvinceIdXhj(String provinceIdXhj) {
+        this.provinceIdXhj = provinceIdXhj;
+    }
+
+    public void setCityIdXhj(String cityIdXhj) {
+        this.cityIdXhj = cityIdXhj;
+    }
+
+    public void setRegionIdXhj(String regionIdXhj) {
+        this.regionIdXhj = regionIdXhj;
+    }
+
+    public void setVillageTownsIdXhj(String villageTownsIdXhj) {
+        this.villageTownsIdXhj = villageTownsIdXhj;
+    }
+
+    public void setVillageIdXhj(String villageIdXhj) {
+        this.villageIdXhj = villageIdXhj;
+    }
+
+    public void setVillagerGroupIdXhj(String villagerGroupIdXhj) {
+        this.villagerGroupIdXhj = villagerGroupIdXhj;
+    }
+
+    public void setProvinceXhj(String provinceXhj) {
+        this.provinceXhj = provinceXhj;
+    }
+
+    public void setCityXhj(String cityXhj) {
+        this.cityXhj = cityXhj;
+    }
+
+    public void setRegionXhj(String regionXhj) {
+        this.regionXhj = regionXhj;
+    }
+
+    public void setVillageTownsXhj(String villageTownsXhj) {
+        this.villageTownsXhj = villageTownsXhj;
+    }
+
+    public void setVillageXhj(String villageXhj) {
+        this.villageXhj = villageXhj;
+    }
+
+    public void setVillagerGroupXhj(String villagerGroupXhj) {
+        this.villagerGroupXhj = villagerGroupXhj;
+    }
+
+    public void setNowInXhj(String nowInXhj) {
+        this.nowInXhj = nowInXhj;
+    }
+
+    public void setDomicileSelect(String domicileSelect) {
+        this.domicileSelect = domicileSelect;
+    }
+
+    public void setPhoneNum(String phoneNum) {
+        this.phoneNum = phoneNum;
+    }
+
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public String getProvinceIdXjz() {
+        return provinceIdXjz;
+    }
+
+    public String getCityIdXjz() {
+        return cityIdXjz;
+    }
+
+    public String getRegionIdXjz() {
+        return regionIdXjz;
+    }
+
+    public String getVillageTownsIdXjz() {
+        return villageTownsIdXjz;
+    }
+
+    public String getVillageIdXjz() {
+        return villageIdXjz;
+    }
+
+    public String getProvinceXjz() {
+        return provinceXjz;
+    }
+
+    public String getCityXjz() {
+        return cityXjz;
+    }
+
+    public String getRegionXjz() {
+        return regionXjz;
+    }
+
+    public String getVillageTownsXjz() {
+        return villageTownsXjz;
+    }
+
+    public String getVillageXjz() {
+        return villageXjz;
+    }
+
+    public String getNowXjz() {
+        return nowXjz;
+    }
+
+    public String getNowInSelect() {
+        return nowInSelect;
+    }
+
+    public String getProvinceIdXhj() {
+        return provinceIdXhj;
+    }
+
+    public String getCityIdXhj() {
+        return cityIdXhj;
+    }
+
+    public String getRegionIdXhj() {
+        return regionIdXhj;
+    }
+
+    public String getVillageTownsIdXhj() {
+        return villageTownsIdXhj;
+    }
+
+    public String getVillageIdXhj() {
+        return villageIdXhj;
+    }
+
+    public String getVillagerGroupIdXhj() {
+        return villagerGroupIdXhj;
+    }
+
+    public String getProvinceXhj() {
+        return provinceXhj;
+    }
+
+    public String getCityXhj() {
+        return cityXhj;
+    }
+
+    public String getRegionXhj() {
+        return regionXhj;
+    }
+
+    public String getVillageTownsXhj() {
+        return villageTownsXhj;
+    }
+
+    public String getVillageXhj() {
+        return villageXhj;
+    }
+
+    public String getVillagerGroupXhj() {
+        return villagerGroupXhj;
+    }
+
+    public String getNowInXhj() {
+        return nowInXhj;
+    }
+
+    public String getDomicileSelect() {
+        return domicileSelect;
+    }
+
+    public String getPhoneNum() {
+        return phoneNum;
+    }
 }

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

@@ -32,6 +32,8 @@ public interface AccountingDataMapper {
      */
    List<AccountingDataVo> selectAccountingDataJzdzList(AccountingDataVo accountingData);
 
+    List<AccountingData> getExport(AccountingData accountingData);
+
     /**
      * 新增
      * @param accountingData

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

@@ -626,4 +626,12 @@ public class TaskService {
             }
         }
     }
+
+    /***
+     * 核酸统计
+     */
+    @Scheduled(cron = "0 0 1 * * ?")
+    public void nucleicAcidStatistics() {
+
+    }
 }

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

@@ -4,15 +4,22 @@ package com.boman.web.core.service.accounting;
  * @Date: 2022/05/13/11:14
  */
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.boman.common.core.exception.BaseException;
+import com.boman.domain.*;
 import com.alibaba.fastjson.JSON;
 import com.boman.common.core.utils.DateUtils;
 import com.boman.common.core.utils.StringUtils;
 import com.boman.domain.Czrk;
 import com.boman.domain.SysUser;
+import com.boman.domain.dto.AjaxResult;
+import com.boman.system.api.RemoteDeptService;
 import com.boman.web.core.domain.AccountingData;
 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.utils.*;
 import com.boman.web.core.utils.AuthUtils;
 import com.boman.web.core.utils.CzrkUtils;
 import lombok.extern.slf4j.Slf4j;
@@ -22,11 +29,13 @@ import org.apache.ibatis.session.SqlSessionFactory;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.io.IOException;
+import java.util.*;
 
+import static com.boman.common.core.utils.obj.ObjectUtils.map;
+import static com.boman.web.core.utils.CzrkUtils.setQueryRole;
+
+import static com.boman.web.core.utils.CzrkUtils.setAgeScope;
 import static com.boman.web.core.utils.CzrkUtils.setQueryRole;
 
 /**
@@ -35,10 +44,12 @@ import static com.boman.web.core.utils.CzrkUtils.setQueryRole;
  */
 @Service
 @Slf4j
-public class AccountingDataServiceImpl implements IAccountingDataService{
+public class AccountingDataServiceImpl implements IAccountingDataService {
 
     @Resource
     private AccountingDataMapper accountingDataMapper;
+    @Resource
+    private RemoteDeptService remoteDeptService;
 
     @Resource
     private SqlSessionFactory sqlSessionFactory;
@@ -48,6 +59,7 @@ public class AccountingDataServiceImpl implements IAccountingDataService{
 
     /**
      * 潜山核酸数据列表页(户籍地址)
+     *
      * @param accountingData
      * @return
      */
@@ -56,16 +68,33 @@ public class AccountingDataServiceImpl implements IAccountingDataService{
         SysUser sysUser = AuthUtils.getLoginUser().getSysUser();
         log.info("{}于{}查询核酸户籍人口列表,查询条件:{}"
                 , sysUser.getUserName(), DateUtils.dateTimeNow(), JSON.toJSONString(accountingData));
+        //获取时段
+        String timeSlot = accountingData.getTimeSlot();
+        if (StringUtils.isNotBlank(timeSlot)) {
+            //开始时间
+            String startTime = DateUtils.minusDayOfDate(Integer.parseInt(timeSlot));
+            Date endTime = DateUtils.getNowDate();
+            Map<String, Object> map = new HashMap<>();
+            map.put("startTime", startTime);
+            map.put("endTime", endTime);
+            accountingData.setParams(map);
+        }
 
         //设置查询列表权限
         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;
     }
 
     /**
      * 潜山核酸数据列表页(居住地址)
+     *
      * @param accountingData
      * @return
      */
@@ -74,6 +103,17 @@ public class AccountingDataServiceImpl implements IAccountingDataService{
         SysUser sysUser = AuthUtils.getLoginUser().getSysUser();
         log.info("{}于{}查询核酸居住人口列表,查询条件:{}"
                 , sysUser.getUserName(), DateUtils.dateTimeNow(), JSON.toJSONString(accountingData));
+        //获取时段
+        String timeSlot = accountingData.getTimeSlot();
+        if (StringUtils.isNotBlank(timeSlot)) {
+            //开始时间
+            String startTime = DateUtils.minusDayOfDate(Integer.parseInt(timeSlot));
+            Date endTime = DateUtils.getNowDate();
+            Map<String, Object> map = new HashMap<>();
+            map.put("startTime", startTime);
+            map.put("endTime", endTime);
+            accountingData.setParams(map);
+        }
         //设置查询列表权限
         setQueryRole(accountingData, sysUser, Czrk.CZ);
         List<AccountingDataVo> list = accountingDataMapper.selectAccountingDataJzdzList(accountingData);
@@ -81,6 +121,142 @@ public class AccountingDataServiceImpl implements IAccountingDataService{
         return list;
     }
 
+    /**
+     * 核酸数据导出
+     *
+     * @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);
+
+       /* List<Czrk> czrkListp = czrkList.stream().sorted(
+                //以户籍号排序
+                Comparator.comparing(Czrk::getCode, Comparator.reverseOrder())
+                        //户主排序
+                        .thenComparing(Czrk::getHouseType, Comparator.reverseOrder())
+
+        ).collect(Collectors.toList());*/
+
+        //CzrkUtils.packAddr(accountingDataList);
+        if (accountingDataList == null || accountingDataList.size() <= 0) {
+            throw new BaseException("请下载属于本乡镇数据");
+        }
+        //packAddr(czrkList);
+        return accountingDataList;
+    }
+
+    @Override
+    public AjaxResult toQianshan(String rc, String djsjqs, String djsjjs, String name, String sfzhm) {
+
+        //判断传入的地区在不在账号权限内
+        //获取账号区划权限
+        /*SysUser sysUser = AuthUtils.getLoginUser().getSysUser();
+        SysDept dept = sysUser.getDept();
+        if (StringUtils.isEmpty(rc) && StringUtils.isEmpty(sfzhm)) {
+            rc = dept.getDeptName();
+        }
+        if (StringUtils.isNotEmpty(rc)) {
+            //判断账号权限
+            List<String> roleKeySets = map(sysUser.getRoles(), SysRole::getRoleKey);
+            if (roleKeySets.contains("province") || roleKeySets.contains("city") || roleKeySets.contains("region") || roleKeySets.contains("admin") || roleKeySets.contains("yanshi")) {
+                // 市领导可查看所有人员,不做处理
+
+            } else if (roleKeySets.contains("villageTowns")) {
+                // 镇领导,只能查看本镇下人员
+                //获取本镇下所有乡村
+                List<SysDept> allDepts = remoteDeptService.listChildrenDepts(dept.getId());
+                List<String> qhList = Arrays.asList(rc.split(","));
+                //取最后一级区划
+                String qu = qhList.get(allDepts.size() - 1);
+                boolean b = false;
+                if (qu.equals(dept.getAreaName())) {
+                    b = true;
+                } else {
+                    for (SysDept allDept : allDepts) {
+                        if (qu.equals(allDept.getAreaName())) {
+                            b = true;
+                            break;
+                        }
+                    }
+                }
+                if (!b) {
+                    return AjaxResult.error("无权限查询该地区数据");
+                }
+            } else if (roleKeySets.contains("village")) {
+                // 村领导
+            }
+
+        }*/
+
+        djsjqs = djsjqs.replace(" ","%20");
+        djsjjs = djsjjs.replace(" ","%20");
+
+        //查询前先获取tocken
+        String access_token =null;
+        Map<String, String> paramMapT = new HashMap<>();
+        paramMapT.put("client_id", "acdf50bd13be4901b64c62b1fee862c0");
+        paramMapT.put("client_secret", "a3650d67fc034b2d8ea259182b3d99f3");
+        String httpt = "http://60.171.171.235:9090/oauth/token";
+        try {
+            String datas = HttpClientUtils.doGet(httpt, paramMapT);
+            JSONObject jsonT = JSON.parseObject(datas);
+            access_token = (String) jsonT.get("access_token");
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+
+        Map<String, String> paramMap = new HashMap<>();
+        String http = null;
+        //当区划为空的时候根据姓名,身份证查询
+        if(StringUtils.isNotEmpty(sfzhm)){
+            //潜山来宜人员数据(姓名 身份证 时间段)
+            paramMap.put("client_id", "acdf50bd13be4901b64c62b1fee862c0");
+            paramMap.put("access_token", access_token);
+            paramMap.put("name", name);
+            paramMap.put("sfzhm", sfzhm);
+            paramMap.put("djsjqs", djsjqs);
+            paramMap.put("djsjjs", djsjjs);
+
+            http = "http://60.171.171.235:9090/service/api/rkk/qslyrysjcx";
+        }else{
+            //潜山来宜人员数据(区划 时间段)
+            paramMap.put("client_id", "acdf50bd13be4901b64c62b1fee862c0");
+            paramMap.put("access_token", access_token);
+            if(StringUtils.isEmpty(rc)){
+                rc = "潜山市";
+            }
+            paramMap.put("rc", rc);
+            paramMap.put("djsjqs", djsjqs);
+            paramMap.put("djsjjs", djsjjs);
+
+            http = "http://60.171.171.235:9090/service/api/rkk/qslyrysj";
+        }
+
+        try {
+            if (StringUtils.isEmpty(http)) {
+                return AjaxResult.error("参数错误");
+            }
+            String data = HttpClientUtils.doGet(http, paramMap);
+
+            //List list = new ArrayList();
+            List<JSONObject> list= JSON.parseArray(data, JSONObject.class);
+
+
+
+            return AjaxResult.success("数据返回成功", list);
+        } catch (IOException e) {
+            e.printStackTrace();
+            return AjaxResult.error("数据返回失败");
+        }
+    }
+
     /**
      * 新增
      * @param accountingDataList

+ 11 - 0
boman-web-core/src/main/java/com/boman/web/core/service/accounting/IAccountingDataService.java

@@ -1,8 +1,10 @@
 package com.boman.web.core.service.accounting;
 
+import com.boman.domain.dto.AjaxResult;
 import com.boman.web.core.domain.AccountingData;
 import com.boman.web.core.domain.vo.AccountingDataVo;
 
+import java.io.IOException;
 import java.util.List;
 
 /**
@@ -24,6 +26,15 @@ public interface IAccountingDataService {
      */
     List<AccountingDataVo> nucleicAcidJzdzList(AccountingDataVo accountingData);
 
+    /**
+     *  核酸数据导出
+     * @param accountingData
+     * @throws IOException
+     */
+    List<AccountingData> getExport(AccountingData accountingData);
+
+    AjaxResult toQianshan(String rc, String djsjqs, String djsjjs, String name, String sfzhm);
+
     /**
      * 插入数据
      * @param accountingDataVoList

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

@@ -80,7 +80,7 @@ public class HttpClientUtils {
         CloseableHttpResponse response = null;
         String resultString = "";
         try {
-            // 创建Http Post请求
+            // 创建Http get请求
             HttpGet httpGet = new HttpGet(url);
             // 执行http请求
             response = httpClient.execute(httpGet);