Procházet zdrojové kódy

需求修改,增加进度字段

LIVE_YE před 2 roky
rodič
revize
33d759692c

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

@@ -53,8 +53,7 @@ public class UserInfoController extends BaseController
      * 查询导入人员信息列表
      */
     @GetMapping("/oneDate")
-    public AjaxResult oneDate(UserInfo userInfo)
-    {
+    public AjaxResult oneDate(UserInfo userInfo) throws Exception {
         return userInfoService.oneDate(userInfo);
     }
 

+ 15 - 2
ruoyi-system/src/main/java/com/ruoyi/system/domain/UserInfo.java

@@ -73,6 +73,10 @@ public class UserInfo extends BaseEntity
     /** 检测频次(时间范围) */
     private String detectionScope;
 
+    /** 检测进度 */
+    @Excel(name = "进度(已做核酸次数/频次)")
+    private String detectionProgress;
+
     /** 部门名称 */
     private String deptName;
 
@@ -93,7 +97,11 @@ public class UserInfo extends BaseEntity
         this.id = id;
     }
 
-    public Long getId() 
+    public String getDetectionProgress() {
+        return detectionProgress;
+    }
+
+    public Long getId()
     {
         return id;
     }
@@ -253,11 +261,16 @@ public class UserInfo extends BaseEntity
         this.detectionResult = detectionResult;
     }
 
+    public void setDetectionProgress(String detectionProgress) {
+        this.detectionProgress = detectionProgress;
+    }
+
     @Override
     public String toString() {
         return "UserInfo{" +
                 "id=" + id +
                 ", name='" + name + '\'' +
+                ", detectionResult='" + detectionResult + '\'' +
                 ", gender='" + gender + '\'' +
                 ", age=" + age +
                 ", idCard='" + idCard + '\'' +
@@ -271,8 +284,8 @@ public class UserInfo extends BaseEntity
                 ", detectionFrequency='" + detectionFrequency + '\'' +
                 ", detectionNumber='" + detectionNumber + '\'' +
                 ", detectionScope='" + detectionScope + '\'' +
+                ", detectionProgress='" + detectionProgress + '\'' +
                 ", deptName='" + deptName + '\'' +
-                ", detectionResult='" + detectionResult + '\'' +
                 ", startTime='" + startTime + '\'' +
                 ", endTime='" + endTime + '\'' +
                 '}';

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/IUserInfoService.java

@@ -63,5 +63,5 @@ public interface IUserInfoService
 
     String importUser(List<UserInfo> userList, String jobStyle, String focusCrowdStyle, String detectionNumber, String detectionScope, String startTime, String endTime) throws Exception;
 
-    AjaxResult oneDate(UserInfo userInfo);
+    AjaxResult oneDate(UserInfo userInfo) throws Exception;
 }

+ 78 - 164
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserInfoServiceImpl.java

@@ -135,7 +135,7 @@ public class UserInfoServiceImpl implements IUserInfoService {
     public String importUser(List<UserInfo> userList, String jobStyle, String focusCrowdStyle, String detectionNumber,
                              String detectionScope, String startTime, String endTime) throws Exception {
 
-        if(userList == null){
+        if (userList == null) {
             return "表格格式错误,请按照表格模板格式上传人员名单";
         }
 
@@ -144,19 +144,26 @@ public class UserInfoServiceImpl implements IUserInfoService {
 
         StringBuilder sb = new StringBuilder();
         for (UserInfo userInfo : userList) {
-            if(userInfo == null){
+            if (userInfo == null) {
                 return "表格格式错误,请按照表格模板格式上传人员名单";
             }
 
-            if(userInfo.getIdCard().length()!=18){
+            if (userInfo.getIdCard().length() != 18) {
                 sb.append(userInfo.getName()).append(",");
             }
         }
 
-        if(StringUtils.isNotEmpty(sb.toString())){
-            return "操作失败,以下人员身份证格式错误【"+sb.toString()+"】";
+        if (StringUtils.isNotEmpty(sb.toString())) {
+            return "操作失败,以下人员身份证格式错误【" + sb.toString() + "】";
         }
 
+        //计算开始时间结束时间相隔天数
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Date date1 = simpleDateFormat.parse(startTime);
+        Date date2 = simpleDateFormat.parse(endTime);
+        detectionScope = String.valueOf(DateUtils.differentDaysByMillisecond(date1, date2));
+
+
         //todo 获取当前上传人员部门id
         SysUser user = SecurityUtils.getLoginUser().getUser();
         String deptId = String.valueOf(user.getDeptId());
@@ -171,9 +178,6 @@ public class UserInfoServiceImpl implements IUserInfoService {
         List<UserNucleicTime> UserNucleicTimeList = new ArrayList<>();
 
         int index = 0;
-        int res1 = 0;
-        int res2 = 0;
-        String date = null;
         for (UserInfo userInfo : userList) {
 
             userInfo.setDeptId(deptId);
@@ -195,87 +199,40 @@ public class UserInfoServiceImpl implements IUserInfoService {
             userInfo.setUpdateBy(user.getUserName());
             //判断结果是否合格,默认合格
             Boolean bl = true;
-            //创建一个死循环
-            for (int i = 2; i > 1; i++) {
-                //计算开始时间加上检测频次(时间范围)后的时间
-                date = DateUtils.getAddDate(startTime, Integer.parseInt(detectionScope));
-                int res = endTime.compareTo(date);//res>0(endTime>date),res=0(endTime=date),res<0(endTime<date)
-                if (res > 0) {
-                    index = 0;
-                    for (OdsQssHsjcxx odsQssHsjcxx : OdsQssHsjcxxList) {
-                        //判断 核酸采集时间是不是在 startTime和date之间
-                        res1 = odsQssHsjcxx.getCjsj().compareTo(startTime);
-                        res2 = date.compareTo(odsQssHsjcxx.getCjsj());
-                        if (userInfo.getIdCard().equals(odsQssHsjcxx.getSfzhm()) && res1 >= 0 && res2 >= 0) {
-
-                            if (StringUtils.isNotEmpty(collectPlace.toString())) {
-                                collectPlace.append("/");
-                            }
-                            collectPlace.append(odsQssHsjcxx.getJcdd());
-
-                            if (StringUtils.isNotEmpty(nucleicCollectTime.toString())) {
-                                nucleicCollectTime.append("/");
-                            }
-                            nucleicCollectTime.append(odsQssHsjcxx.getCjsj());
-
-                            if (StringUtils.isNotEmpty(nucleicResultsTime.toString())) {
-                                nucleicResultsTime.append("/");
-                            }
-                            nucleicResultsTime.append(odsQssHsjcxx.getJgcjss());
-
-                            index++;
-                            //当index与detectionNumber相等时,满足条件,跳出当前循环
-                            if (index == Integer.parseInt(detectionNumber)) {
-                                startTime = date;
-                                break;
-                            }
-                        }
-                    }
-                    if (index < Integer.parseInt(detectionNumber)) {
-                        bl = false;
+
+            index = 0;
+            for (OdsQssHsjcxx odsQssHsjcxx : OdsQssHsjcxxList) {
+                //判断 核酸采集时间是不是在 startTime和date之间
+                if (userInfo.getIdCard().equals(odsQssHsjcxx.getSfzhm())) {
+
+                    if (StringUtils.isNotEmpty(collectPlace.toString())) {
+                        collectPlace.append("/");
                     }
-                } else {
-                    index = 0;
-                    for (OdsQssHsjcxx odsQssHsjcxx : OdsQssHsjcxxList) {
-                        //判断 核酸采集时间是不是在 startTime和date之间
-                        res1 = odsQssHsjcxx.getCjsj().compareTo(startTime);
-                        res2 = date.compareTo(odsQssHsjcxx.getCjsj());
-                        if (userInfo.getIdCard().equals(odsQssHsjcxx.getSfzhm()) && res1 >= 0 && res2 >= 0) {
-
-                            if (StringUtils.isNotEmpty(collectPlace.toString())) {
-                                collectPlace.append("/");
-                            }
-                            collectPlace.append(odsQssHsjcxx.getJcdd());
-
-                            if (StringUtils.isNotEmpty(nucleicCollectTime.toString())) {
-                                nucleicCollectTime.append("/");
-                            }
-                            nucleicCollectTime.append(odsQssHsjcxx.getCjsj());
-
-                            if (StringUtils.isNotEmpty(nucleicResultsTime.toString())) {
-                                nucleicResultsTime.append("/");
-                            }
-                            nucleicResultsTime.append(odsQssHsjcxx.getJgcjss());
-
-                            index++;
-                            //当index与detectionNumber相等时,满足条件,跳出当前循环
-                            if (index == Integer.parseInt(detectionNumber)) {
-                                //跳出死循环
-                                i = -1;
-                                break;
-                            }
-                        }
+                    collectPlace.append(odsQssHsjcxx.getJcdd());
+
+                    if (StringUtils.isNotEmpty(nucleicCollectTime.toString())) {
+                        nucleicCollectTime.append("/");
                     }
-                    if (index < Integer.parseInt(detectionNumber)) {
-                        bl = false;
-                        //跳出死循环
-                        i = -1;
+                    nucleicCollectTime.append(odsQssHsjcxx.getCjsj());
+
+                    if (StringUtils.isNotEmpty(nucleicResultsTime.toString())) {
+                        nucleicResultsTime.append("/");
                     }
+                    nucleicResultsTime.append(odsQssHsjcxx.getJgcjss());
+
+                    index++;
                 }
             }
+            if (index < Integer.parseInt(detectionNumber)) {
+                bl = false;
+            }
+
             userInfo.setCollectPlace(collectPlace.toString());
             userInfo.setNucleicCollectTime(nucleicCollectTime.toString());
             userInfo.setNucleicResultsTime(nucleicResultsTime.toString());
+            userInfo.setDetectionProgress(index + "/" + detectionNumber);
+
+
             if (bl) {
                 userInfo.setDetectionResult("正常");
             } else {
@@ -314,25 +271,34 @@ public class UserInfoServiceImpl implements IUserInfoService {
     }
 
     @Override
-    public AjaxResult oneDate(UserInfo userInfo) {
-        if(StringUtils.isEmpty(userInfo.getIdCard())){
+    public AjaxResult oneDate(UserInfo userInfo) throws Exception {
+        if (StringUtils.isEmpty(userInfo.getIdCard())) {
             return AjaxResult.error("请填写身份证号");
         }
-        if(StringUtils.isEmpty(userInfo.getStartTime()) || StringUtils.isEmpty(userInfo.getEndTime()) ||
-                StringUtils.isEmpty(userInfo.getDetectionScope()) || StringUtils.isEmpty(userInfo.getDetectionNumber())  ){
+        if (StringUtils.isEmpty(userInfo.getStartTime()) || StringUtils.isEmpty(userInfo.getEndTime()) ||
+                StringUtils.isEmpty(userInfo.getDetectionNumber())) {
             return AjaxResult.error("请将参数填写完整后查询");
         }
 
+
         String startTime = userInfo.getStartTime();
         String endTime = userInfo.getEndTime();
-        String detectionScope = userInfo.getDetectionScope();
         String detectionNumber = userInfo.getDetectionNumber();
 
+
+        //计算开始时间结束时间相隔天数
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Date date1 = simpleDateFormat.parse(startTime);
+        Date date2 = simpleDateFormat.parse(endTime);
+        String detectionScope = String.valueOf(DateUtils.differentDaysByMillisecond(date1, date2));
+        userInfo.setDetectionScope(detectionScope);
+
+
         List<String> idCardList = new ArrayList<>();
         idCardList.add(userInfo.getIdCard());
         //从第三方数据库查询人员核酸计录
         List<OdsQssHsjcxx> OdsQssHsjcxxList = qdsQssHsjcxxService.thirdNucleicAcid(userInfo.getStartTime(), userInfo.getEndTime(), idCardList);
-        if(OdsQssHsjcxxList==null || OdsQssHsjcxxList.size()<=0){
+        if (OdsQssHsjcxxList == null || OdsQssHsjcxxList.size() <= 0) {
             return AjaxResult.success("暂无数据");
         }
 
@@ -341,9 +307,6 @@ public class UserInfoServiceImpl implements IUserInfoService {
         userInfo.setDetectionFrequency(detectionNumber + "/" + detectionScope);
 
         int index = 0;
-        int res1 = 0;
-        int res2 = 0;
-        String date = null;
 
         //采集地点
         StringBuilder collectPlace = new StringBuilder();
@@ -354,87 +317,38 @@ public class UserInfoServiceImpl implements IUserInfoService {
 
         //判断结果是否合格,默认合格
         Boolean bl = true;
-        //创建一个死循环
-        for (int i = 2; i > 1; i++) {
-            //计算开始时间加上检测频次(时间范围)后的时间
-            date = DateUtils.getAddDate(startTime, Integer.parseInt(detectionScope));
-            int res = endTime.compareTo(date);//res>0(endTime>date),res=0(endTime=date),res<0(endTime<date)
-            if (res > 0) {
-                index = 0;
-                for (OdsQssHsjcxx odsQssHsjcxx : OdsQssHsjcxxList) {
-                    //判断 核酸采集时间是不是在 startTime和date之间
-                    res1 = odsQssHsjcxx.getCjsj().compareTo(startTime);
-                    res2 = date.compareTo(odsQssHsjcxx.getCjsj());
-                    if (userInfo.getIdCard().equals(odsQssHsjcxx.getSfzhm()) && res1 >= 0 && res2 >= 0) {
-
-                        if (StringUtils.isNotEmpty(collectPlace.toString())) {
-                            collectPlace.append("/");
-                        }
-                        collectPlace.append(odsQssHsjcxx.getJcdd());
-
-                        if (StringUtils.isNotEmpty(nucleicCollectTime.toString())) {
-                            nucleicCollectTime.append("/");
-                        }
-                        nucleicCollectTime.append(odsQssHsjcxx.getCjsj());
-
-                        if (StringUtils.isNotEmpty(nucleicResultsTime.toString())) {
-                            nucleicResultsTime.append("/");
-                        }
-                        nucleicResultsTime.append(odsQssHsjcxx.getJgcjss());
-
-                        index++;
-                        //当index与detectionNumber相等时,满足条件,跳出当前循环
-                        if (index == Integer.parseInt(detectionNumber)) {
-                            startTime = date;
-                            break;
-                        }
-                    }
-                }
-                if (index < Integer.parseInt(detectionNumber)) {
-                    bl = false;
+
+
+        index = 0;
+        for (OdsQssHsjcxx odsQssHsjcxx : OdsQssHsjcxxList) {
+            //判断 核酸采集时间是不是在 startTime和date之间
+            if (userInfo.getIdCard().equals(odsQssHsjcxx.getSfzhm())) {
+
+                if (StringUtils.isNotEmpty(collectPlace.toString())) {
+                    collectPlace.append("/");
                 }
-            } else {
-                index = 0;
-                for (OdsQssHsjcxx odsQssHsjcxx : OdsQssHsjcxxList) {
-                    //判断 核酸采集时间是不是在 startTime和date之间
-                    res1 = odsQssHsjcxx.getCjsj().compareTo(startTime);
-                    res2 = date.compareTo(odsQssHsjcxx.getCjsj());
-                    if (userInfo.getIdCard().equals(odsQssHsjcxx.getSfzhm()) && res1 >= 0 && res2 >= 0) {
-
-                        if (StringUtils.isNotEmpty(collectPlace.toString())) {
-                            collectPlace.append("/");
-                        }
-                        collectPlace.append(odsQssHsjcxx.getJcdd());
-
-                        if (StringUtils.isNotEmpty(nucleicCollectTime.toString())) {
-                            nucleicCollectTime.append("/");
-                        }
-                        nucleicCollectTime.append(odsQssHsjcxx.getCjsj());
-
-                        if (StringUtils.isNotEmpty(nucleicResultsTime.toString())) {
-                            nucleicResultsTime.append("/");
-                        }
-                        nucleicResultsTime.append(odsQssHsjcxx.getJgcjss());
-
-                        index++;
-                        //当index与detectionNumber相等时,满足条件,跳出当前循环
-                        if (index == Integer.parseInt(detectionNumber)) {
-                            //跳出死循环
-                            i = -1;
-                            break;
-                        }
-                    }
+                collectPlace.append(odsQssHsjcxx.getJcdd());
+
+                if (StringUtils.isNotEmpty(nucleicCollectTime.toString())) {
+                    nucleicCollectTime.append("/");
                 }
-                if (index < Integer.parseInt(detectionNumber)) {
-                    bl = false;
-                    //跳出死循环
-                    i = -1;
+                nucleicCollectTime.append(odsQssHsjcxx.getCjsj());
+
+                if (StringUtils.isNotEmpty(nucleicResultsTime.toString())) {
+                    nucleicResultsTime.append("/");
                 }
+                nucleicResultsTime.append(odsQssHsjcxx.getJgcjss());
+
+                index++;
             }
         }
+        if (index < Integer.parseInt(detectionNumber)) {
+            bl = false;
+        }
         userInfo.setCollectPlace(collectPlace.toString());
         userInfo.setNucleicCollectTime(nucleicCollectTime.toString());
         userInfo.setNucleicResultsTime(nucleicResultsTime.toString());
+        userInfo.setDetectionProgress(index + "/" + detectionNumber);
         if (bl) {
             userInfo.setDetectionResult("正常");
         } else {
@@ -443,7 +357,7 @@ public class UserInfoServiceImpl implements IUserInfoService {
         List<UserInfo> userList = new ArrayList<>();
 
         userList.add(userInfo);
-        return AjaxResult.success("操作成功",userList);
+        return AjaxResult.success("操作成功", userList);
     }
 
 

+ 6 - 1
ruoyi-system/src/main/resources/mapper/system/UserInfoMapper.xml

@@ -20,6 +20,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="detectionFrequency"    column="detection_frequency"    />
         <result property="detectionNumber"    column="detection_number"    />
         <result property="detectionScope"    column="detection_scope"    />
+
+        <result property="detectionProgress"    column="detection_progress"    />
+
         <result property="deptName"    column="dept_name"    />
         <result property="startTime"    column="start_time"    />
         <result property="endTime"    column="end_time"    />
@@ -32,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectUserInfoVo">
-        select id, name, gender, age, id_card, phone_num, dept_id, collect_place, nucleic_collect_time, nucleic_results_time, job_style, focus_crowd_style, detection_frequency, detection_number, detection_scope, dept_name, start_time, end_time,detection_result, create_by, create_time, update_by, update_time, remark from user_info
+        select id, name, gender, age, id_card, phone_num, dept_id, collect_place, nucleic_collect_time, nucleic_results_time,detection_progress, job_style, focus_crowd_style, detection_frequency, detection_number, detection_scope, dept_name, start_time, end_time,detection_result, create_by, create_time, update_by, update_time, remark from user_info
     </sql>
 
     <select id="selectUserInfoList" parameterType="UserInfo" resultMap="UserInfoResult">
@@ -119,6 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                                detection_frequency,
                                detection_number,
                                detection_scope,
+                               detection_progress,
                                start_time,
                                end_time,
                                detection_result,
@@ -140,6 +144,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{user.detectionFrequency},
             #{user.detectionNumber},
             #{user.detectionScope},
+            #{user.detectionProgress},
             #{user.startTime},
             #{user.endTime},
             #{user.detectionResult},