yangdamao il y a 1 an
Parent
commit
c7b8e0fc87

+ 33 - 0
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java

@@ -86,6 +86,13 @@ import java.math.BigDecimal;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.TemporalAdjusters;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
@@ -262,6 +269,32 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
 
     @Override
     public List<UserVo> dangAnList(UserQueryBo bo) {
+        if (ObjectUtils.isNotNull(bo.getApplyDateTime()) && bo.getApplyDateTime().length() == 6){
+            //根据月份筛选
+            String dateStr = String.format(bo.getApplyDateTime()); // 指定年月
+            LocalDate date = LocalDate.parse(dateStr + "01", DateTimeFormatter.BASIC_ISO_DATE);
+            LocalDate dateFirst = date.with(TemporalAdjusters.firstDayOfMonth()); // 指定年月的第一天
+            LocalDate dateEnd = date.with(TemporalAdjusters.lastDayOfMonth()); // 指定年月的最后一天
+            ZonedDateTime zonedDateTime1 = dateFirst.atStartOfDay(ZoneId.systemDefault());
+            Date date1 = Date.from(zonedDateTime1.toInstant());
+            ZonedDateTime zonedDateTime = dateEnd.atStartOfDay(ZoneId.systemDefault());
+            Date date2 = Date.from(zonedDateTime.toInstant());
+            Long startTime = date1.getTime()/1000;
+            Long endTime = (date2.getTime()/1000) + 86400;
+            bo.setMonthStartTime(startTime);
+            bo.setMonthEndTime(endTime);
+        }else if (ObjectUtils.isNotNull(bo.getApplyDateTime()) && bo.getApplyDateTime().length() > 6){
+            //根据某天筛选
+            String dateStr = String.format(bo.getApplyDateTime());
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+            try {
+                Date parse = sdf.parse(dateStr);
+                bo.setMonthStartTime(parse.getTime()/1000);
+                bo.setMonthEndTime(parse.getTime()/1000);
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+        }
         List<User> list = baseMapper.dangAnList(bo);
         return entity2UserVo(list);
     }

+ 22 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserQueryBo.java

@@ -227,4 +227,26 @@ public class UserQueryBo extends BaseEntity {
 	@ApiModelProperty("承诺书签名:1是 0否")
 	private Integer promiseSign;
 
+	/** 考试开始时间段 */
+	@ApiModelProperty("考试开始时间段")
+	private String applySiteStartTime;
+
+	/** 考试结束时间段 */
+	@ApiModelProperty("考试结束时间段")
+	private String applySiteEndTime;
+
+	/** 考试日期 */
+	@ApiModelProperty("考试日期")
+	private Long applySiteExamTime;
+
+	/** 月份 */
+	@ApiModelProperty("时间")
+	private String ApplyDateTime;
+
+	@ApiModelProperty("月份开始时间")
+	private Long monthStartTime;
+
+	@ApiModelProperty("月份结束时间")
+	private Long monthEndTime;
+
 }

+ 23 - 0
zhongzheng-system/src/main/resources/mapper/modules/user/UserMapper.xml

@@ -718,6 +718,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             AND (SELECT COUNT(up.id) FROM user_profile up WHERE up.user_id = u.user_id AND up.current_status = 1
             AND INSTR(up.key_value,'"fieldKey":"commitment_electr_signature","value":"oss/images/avatar')) = 0
         </if>
+        <if test="(applySiteExamTime != null and applySiteExamTime != '' ) or
+                        (monthStartTime != null and monthStartTime != '' ) or
+                        (monthEndTime != null and monthEndTime != '') or
+                        (applySiteStartTime != null and applySiteStartTime != '') or
+                        (applySiteEndTime != null and applySiteEndTime != '')">
+            AND (SELECT COUNT(us.subscribe_id) FROM user_subscribe us WHERE us.user_id = 1 AND us.subscribe_status = 1
+            <if test="applySiteExamTime != null and applySiteExamTime != '' ">
+                and us.apply_site_exam_time = #{applySiteExamTime}
+            </if>
+            <if test="monthStartTime != null and monthStartTime != '' ">
+                and us.apply_site_exam_time &gt;= #{monthStartTime}
+            </if>
+            <if test="monthEndTime != null and monthEndTime != '' ">
+                and us.apply_site_exam_time &lt;= #{monthEndTime}
+            </if>
+            <if test="applySiteStartTime != null and applySiteStartTime != '' ">
+                and us.apply_site_start_time = #{applySiteStartTime}
+            </if>
+            <if test="applySiteEndTime != null and applySiteEndTime != '' ">
+                and us.apply_site_end_time = #{applySiteEndTime}
+            </if>
+            ) > 0
+        </if>
         order by u.user_id desc
     </select>