LIVE_YE преди 2 години
родител
ревизия
c86dbe09d9

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/info/SchedulingConfig.java

@@ -26,7 +26,7 @@ public class SchedulingConfig {
     /**
      * 10分钟执行一次刷新首页数据
      */
-    @Scheduled(cron="* 0/10 * * * ? ")    // 10分钟执行一次
+    @Scheduled(cron="0 0/10 * * * ? ")    // 10分钟执行一次
     public void scheduler() {
         //获取首页数据
         userNucleicTimeService.getIndexData();

+ 1 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/info/UserInfoController.java

@@ -49,6 +49,7 @@ public class UserInfoController extends BaseController
         return getDataTable(list);
     }
 
+
     /**
      * 导出导入人员信息列表
      */

+ 14 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/info/UserNucleicTimeController.java

@@ -2,6 +2,8 @@ package com.ruoyi.web.controller.info;
 
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+
+import com.ruoyi.system.domain.UserInfo;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -46,6 +48,18 @@ public class UserNucleicTimeController extends BaseController
         return getDataTable(list);
     }
 
+
+    /**
+     * 查询首页本周核酸人员列表
+     */
+    @GetMapping("/homeList")
+    public TableDataInfo homeList()
+    {
+        startPage();
+        List<UserNucleicTime> list = userNucleicTimeService.homeList();
+        return getDataTable(list);
+    }
+
     /**
      * 导出导入人员核酸时间记录列表
      */

+ 33 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java

@@ -8,7 +8,10 @@ import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.ZoneId;
 import java.time.ZonedDateTime;
+import java.util.Calendar;
 import java.util.Date;
+import java.util.GregorianCalendar;
+
 import org.apache.commons.lang3.time.DateFormatUtils;
 
 /**
@@ -184,4 +187,34 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
         return Date.from(zdt.toInstant());
     }
+
+    /**
+     * 获取本周一的日期
+     */
+    public static String getCurrentMonday() {
+        SimpleDateFormat dateFormat = new SimpleDateFormat(YYYY_MM_DD);
+        int mondayPlus = getMondayPlus();
+        GregorianCalendar currentDate = new GregorianCalendar();
+        currentDate.add(GregorianCalendar.DATE, mondayPlus);
+        Date monday = currentDate.getTime();
+
+        return dateFormat.format(monday);
+    }
+
+    /**
+     * 获取当前日期与本周一相差的天数
+     */
+    private static int getMondayPlus() {
+        Calendar cd = Calendar.getInstance();
+        // 默认:星期日是第一天
+        int dayOfWeek = cd.get(Calendar.DAY_OF_WEEK);
+
+        if (dayOfWeek == 1) {
+            return -6;
+        } else {
+            return 2 - dayOfWeek;
+        }
+    }
+
+
 }

+ 31 - 6
ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpClientUtils.java

@@ -1,5 +1,6 @@
 package com.ruoyi.common.utils.http;
 
+import org.apache.http.HttpEntity;
 import org.apache.http.NameValuePair;
 import org.apache.http.client.config.RequestConfig;
 import org.apache.http.client.entity.UrlEncodedFormEntity;
@@ -12,9 +13,12 @@ import org.apache.http.message.BasicNameValuePair;
 import org.apache.http.util.EntityUtils;
 
 import java.io.IOException;
+import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 public class HttpClientUtils {
 
@@ -63,12 +67,12 @@ public class HttpClientUtils {
         //url += "?appid=" + paramMap.get("appid") + "&secret=" + paramMap.get("secret") + "&js_code=" + paramMap.get("js_code") + "&grant_type=" + paramMap.get("grant_type");
 
         int i = 1;
-        if(!paramMap.isEmpty()){
+        if (!paramMap.isEmpty()) {
             for (Map.Entry<String, String> stringStringEntry : paramMap.entrySet()) {
-                if(i==1){
-                    url = url + "?" + stringStringEntry.getKey() +"="+ stringStringEntry.getValue();
-                }else{
-                    url = url + "&" + stringStringEntry.getKey() +"="+ stringStringEntry.getValue();
+                if (i == 1) {
+                    url = url + "?" + stringStringEntry.getKey() + "=" + stringStringEntry.getValue();
+                } else {
+                    url = url + "&" + stringStringEntry.getKey() + "=" + stringStringEntry.getValue();
                 }
                 i++;
             }
@@ -80,10 +84,14 @@ public class HttpClientUtils {
         String resultString = "";
         try {
             // 创建Http get请求
+            url = encode(url);
             HttpGet httpGet = new HttpGet(url);
             // 执行http请求
             response = httpClient.execute(httpGet);
-            resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
+            HttpEntity entity = response.getEntity(); //请求类型
+            resultString = EntityUtils.toString(entity, "UTF-8");
+            System.out.println(resultString);
+
         } catch (Exception e) {
             throw e;
         } finally {
@@ -122,4 +130,21 @@ public class HttpClientUtils {
                 .setConnectionRequestTimeout(TIMEOUT_MSEC)
                 .setSocketTimeout(TIMEOUT_MSEC).build();
     }
+
+
+    public static String encode(String url) {
+        try {
+            Matcher matcher = Pattern.compile("[\\u4e00-\\u9fa5]").matcher(url);
+            int count = 0;
+            while (matcher.find()) {
+                String tmp = matcher.group();
+                url = url.replaceAll(tmp, java.net.URLEncoder.encode(tmp, "UTF-8"));
+            }
+// System.out.println(count);
+//url = java.net.URLEncoder.encode(url,"gbk");
+        } catch (UnsupportedEncodingException e) {
+// TODO Auto-generated catch block              e.printStackTrace();
+        }
+        return url;
+    }
 }

+ 1 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java

@@ -75,6 +75,7 @@ public class HttpUtils
             connection.setRequestProperty("accept", "*/*");
             connection.setRequestProperty("connection", "Keep-Alive");
             connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+            connection.setRequestProperty("maxHttpHeaderSize", "202400");
             connection.connect();
             in = new BufferedReader(new InputStreamReader(connection.getInputStream(), contentType));
             String line;

+ 40 - 1
ruoyi-system/src/main/java/com/ruoyi/system/domain/UserNucleicTime.java

@@ -42,7 +42,27 @@ public class UserNucleicTime extends BaseEntity
     /** 重点人群分类 */
     private String focusCrowdStyle;
 
-    public void setId(Long id) 
+    /** 姓名 */
+    @Excel(name = "姓名")
+    private String name;
+
+    /** 联系号码 */
+    @Excel(name = "联系号码")
+    private String phoneNum;
+
+    /** 部门id */
+    @Excel(name = "部门id")
+    private String deptId;
+
+    public String getDeptId() {
+        return deptId;
+    }
+
+    public void setDeptId(String deptId) {
+        this.deptId = deptId;
+    }
+
+    public void setId(Long id)
     {
         this.id = id;
     }
@@ -121,6 +141,22 @@ public class UserNucleicTime extends BaseEntity
         this.focusCrowdStyle = focusCrowdStyle;
     }
 
+    public String getName() {
+        return name;
+    }
+
+    public String getPhoneNum() {
+        return phoneNum;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void setPhoneNum(String phoneNum) {
+        this.phoneNum = phoneNum;
+    }
+
     @Override
     public String toString() {
         return "UserNucleicTime{" +
@@ -133,6 +169,9 @@ public class UserNucleicTime extends BaseEntity
                 ", nucleicResult='" + nucleicResult + '\'' +
                 ", jobStyle='" + jobStyle + '\'' +
                 ", focusCrowdStyle='" + focusCrowdStyle + '\'' +
+                ", name='" + name + '\'' +
+                ", phoneNum='" + phoneNum + '\'' +
+                ", deptId='" + deptId + '\'' +
                 '}';
     }
 }

+ 5 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserNucleicTimeMapper.java

@@ -2,7 +2,10 @@ package com.ruoyi.system.mapper;
 
 import java.util.Date;
 import java.util.List;
+
+import com.ruoyi.system.domain.UserInfo;
 import com.ruoyi.system.domain.UserNucleicTime;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 导入人员核酸时间记录Mapper接口
@@ -81,6 +84,8 @@ public interface UserNucleicTimeMapper
      */
     public int getIndexDataLastWeek(Date weekTime);
 
+    List<UserNucleicTime> selectHomeList(@Param("startTime") String startTime, @Param("endTime")String endTime);
+
     /**
      * 获取首页折线图/柱状图,本周所有人群数据
      * @param weekTime

+ 4 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IUserNucleicTimeService.java

@@ -1,6 +1,8 @@
 package com.ruoyi.system.service;
 
 import java.util.List;
+
+import com.ruoyi.system.domain.UserInfo;
 import com.ruoyi.system.domain.UserNucleicTime;
 
 /**
@@ -70,4 +72,6 @@ public interface IUserNucleicTimeService
      * @return
      */
     public List<UserNucleicTime> getJobStyle();
+
+    List<UserNucleicTime> homeList();
 }

+ 27 - 21
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserInfoServiceImpl.java

@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.io.IOException;
+import java.net.URLDecoder;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -61,6 +62,7 @@ public class UserInfoServiceImpl implements IUserInfoService
         return userInfoMapper.selectUserInfoList(userInfo);
     }
 
+
     /**
      * 新增导入人员信息
      * 
@@ -135,45 +137,44 @@ public class UserInfoServiceImpl implements IUserInfoService
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
         Date date1 = simpleDateFormat.parse(startTime);
         Date date2 = simpleDateFormat.parse(endTime);
-        int dNum = DateUtils.differentDaysByMillisecond(date1,date2);
+        int dNum = DateUtils.differentDaysByMillisecond(date1,date2)+1;
 
-        if(dNum<=Integer.getInteger(detectionScope)){
+        /*if(dNum<=Integer.getInteger(detectionScope)){
 
 
         }else{
 
-        }
+        }*/
 
         String token = getToken();
         String http = "http://60.171.171.235:9090/service/api/wjw/qsyyhsdbfx";
-        Map<String, String> paramMap = new HashMap<>();
-        paramMap.put("client_id", "066676ef5f7947e794b879550078cfb8");
-        paramMap.put("access_token", token);
-        paramMap.put("sfzhm", "340323200806306216");
+       /* String http = "http://60.171.171.235:9090/service/api/wjw/qsyyhsdbfx";
+        StringBuilder params = new StringBuilder();
+        params.append("client_id=066676ef5f7947e794b879550078cfb8").append("&access_token=").append(token);
+        params.append("&sfzhm=340323200806306216").append("&sjhm=13585154184");
+        params.append("&xm=陶建筑").append("&beginTime=2022-01-01%2010:00:59").append("&endTime=2022-08-14%2010:00:59");
 
-        paramMap.put("sjhm", "13585154184");
-        paramMap.put("xm", "陶建筑");
+        String url = HttpClientUtils.encode(params.toString());
 
-        paramMap.put("start_time", "2022-01-01 10:00:59");
-        paramMap.put("end_time", "2022-08-14 10:00:59");
-        String data = HttpClientUtils.doGet(http, paramMap);
-        List<Map<String,Object>> list = JSON.parseObject(data,new TypeReference<ArrayList<Map<String,Object>>>(){});
+        String data = HttpUtils.sendGet(http, url);
+        List<Map<String,Object>> list = JSON.parseObject(data,new TypeReference<ArrayList<Map<String,Object>>>(){});*/
 
 
 
         //todo 向医院查询上传名单人员核酸数据(将时间段内所有人员数据查询出来),之后与上传人员名单比较,提取身份证号相同的数据
-        /*List<Map<String,Object>> yyMap = new ArrayList<>();
+        List<Map<String,Object>> yyMap = new ArrayList<>();
         StringBuilder params = new StringBuilder();
         for (UserInfo userInfo : userList) {
             params.append("client_id=066676ef5f7947e794b879550078cfb8").append("&access_token=").append(token);
             params.append("&sfzhm=").append(userInfo.getIdCard()).append("&sjhm=").append(userInfo.getPhoneNum());
             params.append("&xm=").append(userInfo.getName()).append("&beginTime=").append(startTime).append("&endTime=").append(endTime);
-            String data = HttpUtils.sendGet(http, params.toString());
+            String url = HttpClientUtils.encode(params.toString());
+            String data = HttpUtils.sendGet(http, url);
             List<Map<String,Object>> list = JSON.parseObject(data,new TypeReference<ArrayList<Map<String,Object>>>(){});
-
+            yyMap.addAll(list);
             //释放StringBuilder资源,重置params长度
             params.setLength(0);
-        }*/
+        }
         return "操作成功";
     }
 
@@ -181,12 +182,17 @@ public class UserInfoServiceImpl implements IUserInfoService
     /**
      * 获取政务网token
      */
-    public String getToken() {
+    public String getToken() throws Exception{
         String token = "";
-        StringBuilder params = new StringBuilder();
-        params.append("client_id=066676ef5f7947e794b879550078cfb8&client_secret=r9jCwdTO");
+
+        Map<String, String> paramMap = new HashMap<>();
+        paramMap.put("client_id", "066676ef5f7947e794b879550078cfb8");
+        paramMap.put("client_secret", "r9jCwdTO");
+
+        //StringBuilder params = new StringBuilder();
+        //params.append("client_id=066676ef5f7947e794b879550078cfb8&client_secret=r9jCwdTO");
         String http = "http://60.171.171.235:9090/oauth/token";
-        String data = HttpUtils.sendGet(http, params.toString());
+        String data = HttpClientUtils.doGet(http, paramMap);
         JSONObject jsonObject = JSONObject.parseObject(data);
         token = jsonObject.getString("access_token");
         return token;

+ 14 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserNucleicTimeServiceImpl.java

@@ -8,8 +8,11 @@ import java.util.List;
 import java.util.Map;
 
 import com.ruoyi.common.constant.CacheConstants;
+import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.system.domain.UserInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.system.mapper.UserNucleicTimeMapper;
@@ -55,6 +58,16 @@ public class UserNucleicTimeServiceImpl implements IUserNucleicTimeService
         return userNucleicTimeMapper.selectUserNucleicTimeList(userNucleicTime);
     }
 
+    @Override
+    public List<UserNucleicTime> homeList() {
+
+        //获取本周周一时间
+        String startTime = DateUtils.getCurrentMonday()+" 00:00:00";
+        String endTime = DateUtils.getTime();
+
+        return userNucleicTimeMapper.selectHomeList(startTime,endTime);
+    }
+
     /**
      * 新增导入人员核酸时间记录
      * 
@@ -147,4 +160,5 @@ public class UserNucleicTimeServiceImpl implements IUserNucleicTimeService
         List<UserNucleicTime> jobStyle = userNucleicTimeMapper.getJobStyle(nowDate);
         return jobStyle;
     }
+
 }

+ 24 - 1
ruoyi-system/src/main/resources/mapper/system/UserNucleicTimeMapper.xml

@@ -8,16 +8,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="id"    column="id"    />
         <result property="infoId"    column="info_id"    />
         <result property="idCard"    column="id_card"    />
+        <result property="deptId"    column="dept_id"    />
         <result property="collectPlace"    column="collect_place"    />
         <result property="nucleicCollectTime"    column="nucleic_collect_time"    />
         <result property="nucleicResultsTime"    column="nucleic_results_time"    />
         <result property="nucleicResult"    column="nucleic_result"    />
         <result property="jobStyle"    column="job_style"    />
         <result property="focusCrowdStyle"    column="focus_crowd_style"    />
+        <result property="name"    column="name"    />
+        <result property="phoneNum"    column="phone_num"    />
     </resultMap>
 
     <sql id="selectUserNucleicTimeVo">
-        select id, info_id, id_card, collect_place, nucleic_collect_time, nucleic_results_time, nucleic_result, job_style, focus_crowd_style from user_nucleic_time
+        select id, info_id, id_card,dept_id, collect_place, nucleic_collect_time, nucleic_results_time, nucleic_result, job_style, focus_crowd_style,name, phone_num  from user_nucleic_time
     </sql>
 
     <select id="selectUserNucleicTimeList" parameterType="UserNucleicTime" resultMap="UserNucleicTimeResult">
@@ -39,6 +42,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="nucleicCollectTime != null">nucleic_collect_time,</if>
             <if test="nucleicResultsTime != null">nucleic_results_time,</if>
             <if test="nucleicResult != null">nucleic_result,</if>
+
+            <if test="idCard != null">id_card,</if>
+            <if test="jobStyle != null">job_style,</if>
+            <if test="focusCrowdStyle != null">focus_crowd_style,</if>
+            <if test="name != null">name,</if>
+            <if test="phoneNum != null">phone_num,</if>
+            <if test="deptId != null">dept_id,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="infoId != null">#{infoId},</if>
@@ -46,6 +56,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="nucleicCollectTime != null">#{nucleicCollectTime},</if>
             <if test="nucleicResultsTime != null">#{nucleicResultsTime},</if>
             <if test="nucleicResult != null">#{nucleicResult},</if>
+            <if test="idCard != null">#{idCard},</if>
+            <if test="jobStyle != null">#{jobStyle},</if>
+            <if test="focusCrowdStyle != null">#{focusCrowdStyle},</if>
+            <if test="name != null">#{name},</if>
+            <if test="phoneNum != null">#{phoneNum},</if>
+            <if test="deptId != null">#{deptId},</if>
+
          </trim>
     </insert>
 
@@ -89,4 +106,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectUserNucleicTimeVo"/>
         where DATE_FORMAT(nucleic_collect_time,'%x-%v') = DATE_FORMAT(now(),'%x-%v')
     </select>
+
+    <select id="selectHomeList" resultMap="UserNucleicTimeResult">
+        select id_card, collect_place, nucleic_collect_time, nucleic_results_time, nucleic_result, job_style, focus_crowd_style,name, phone_num
+        from user_nucleic_time
+        where nucleic_collect_time > #{startTime} and #{endTime}>=nucleic_collect_time
+    </select>
 </mapper>