Commit 6f68ee6f13abc0f550229e4481fc0d6f2fe5d33b
1 parent
e2edbcbe
feat: 新增获取签到报表接口给人事系统提供
Showing
5 changed files
with
108 additions
and
10 deletions
Bsth-admin/src/main/java/com/ruoyi/common/global/Result.java
| @@ -81,7 +81,7 @@ public class Result<T extends Object> { | @@ -81,7 +81,7 @@ public class Result<T extends Object> { | ||
| 81 | Result r = new Result(); | 81 | Result r = new Result(); |
| 82 | r.setSuccess(false); | 82 | r.setSuccess(false); |
| 83 | r.setCode(code.getCode()); | 83 | r.setCode(code.getCode()); |
| 84 | - r.setMsg("失败"); | 84 | + r.setMsg(msg); |
| 85 | return r; | 85 | return r; |
| 86 | } | 86 | } |
| 87 | 87 |
Bsth-admin/src/main/java/com/ruoyi/controller/ReportController.java
| @@ -16,6 +16,7 @@ import org.springframework.validation.annotation.Validated; | @@ -16,6 +16,7 @@ import org.springframework.validation.annotation.Validated; | ||
| 16 | import org.springframework.web.bind.annotation.*; | 16 | import org.springframework.web.bind.annotation.*; |
| 17 | 17 | ||
| 18 | import javax.annotation.Resource; | 18 | import javax.annotation.Resource; |
| 19 | +import javax.servlet.http.HttpServletRequest; | ||
| 19 | import javax.servlet.http.HttpServletResponse; | 20 | import javax.servlet.http.HttpServletResponse; |
| 20 | import java.util.List; | 21 | import java.util.List; |
| 21 | 22 | ||
| @@ -65,14 +66,14 @@ public class ReportController { | @@ -65,14 +66,14 @@ public class ReportController { | ||
| 65 | 66 | ||
| 66 | @ApiOperation("告警通知") | 67 | @ApiOperation("告警通知") |
| 67 | @GetMapping("/alarm/notice") | 68 | @GetMapping("/alarm/notice") |
| 68 | - public Result<?> getAlarmNotice(@RequestParam(value = "type",required = false) Integer type){ | 69 | + public Result<?> getAlarmNotice(@RequestParam(value = "type", required = false) Integer type) { |
| 69 | return Result.OK(reportService.getAlarmNoticeByType(type)); | 70 | return Result.OK(reportService.getAlarmNoticeByType(type)); |
| 70 | } | 71 | } |
| 71 | 72 | ||
| 72 | 73 | ||
| 73 | @ApiOperation("确认通知") | 74 | @ApiOperation("确认通知") |
| 74 | @PostMapping("/sureNotice") | 75 | @PostMapping("/sureNotice") |
| 75 | - public Result<?> sureNotice(@Validated @RequestBody SysNotice notice){ | 76 | + public Result<?> sureNotice(@Validated @RequestBody SysNotice notice) { |
| 76 | return Result.OK(reportService.sureNotice(notice)); | 77 | return Result.OK(reportService.sureNotice(notice)); |
| 77 | } | 78 | } |
| 78 | 79 | ||
| @@ -83,4 +84,11 @@ public class ReportController { | @@ -83,4 +84,11 @@ public class ReportController { | ||
| 83 | ExcelUtil<ReportErrorResponseVo> util = new ExcelUtil<ReportErrorResponseVo>(ReportErrorResponseVo.class); | 84 | ExcelUtil<ReportErrorResponseVo> util = new ExcelUtil<ReportErrorResponseVo>(ReportErrorResponseVo.class); |
| 84 | util.exportEasyExcel(response, list, "异常报表"); | 85 | util.exportEasyExcel(response, list, "异常报表"); |
| 85 | } | 86 | } |
| 87 | + | ||
| 88 | + | ||
| 89 | + @ApiOperation("提供给人事用接口(获取当月所有签到记录)") | ||
| 90 | + @GetMapping("/list/{month}") | ||
| 91 | + public Result<?> listReportMonth(@PathVariable("month") String month, HttpServletRequest request) { | ||
| 92 | + return reportService.listReportMonth(month, request); | ||
| 93 | + } | ||
| 86 | } | 94 | } |
Bsth-admin/src/main/java/com/ruoyi/pojo/response/ExportReportViewResponseVo.java
| @@ -25,13 +25,17 @@ import static com.ruoyi.common.ConstSignInConstSignInProperties.*; | @@ -25,13 +25,17 @@ import static com.ruoyi.common.ConstSignInConstSignInProperties.*; | ||
| 25 | @HeadRowHeight(25) | 25 | @HeadRowHeight(25) |
| 26 | @HeadFontStyle(fontHeightInPoints = 10,fontName = "黑体") | 26 | @HeadFontStyle(fontHeightInPoints = 10,fontName = "黑体") |
| 27 | public class ExportReportViewResponseVo { | 27 | public class ExportReportViewResponseVo { |
| 28 | + @ApiModelProperty("工号") | ||
| 28 | @ExcelProperty(value = "工号") | 29 | @ExcelProperty(value = "工号") |
| 29 | private String jobCode; | 30 | private String jobCode; |
| 31 | + @ApiModelProperty("姓名") | ||
| 30 | @ExcelProperty(value = "姓名") | 32 | @ExcelProperty(value = "姓名") |
| 31 | private String name; | 33 | private String name; |
| 34 | + @ApiModelProperty("工种") | ||
| 32 | @ExcelProperty(value = "工种") | 35 | @ExcelProperty(value = "工种") |
| 33 | private String posts; | 36 | private String posts; |
| 34 | 37 | ||
| 38 | + @ApiModelProperty("线路") | ||
| 35 | @ExcelProperty(value = "线路") | 39 | @ExcelProperty(value = "线路") |
| 36 | private String lineName; | 40 | private String lineName; |
| 37 | 41 | ||
| @@ -40,76 +44,113 @@ public class ExportReportViewResponseVo { | @@ -40,76 +44,113 @@ public class ExportReportViewResponseVo { | ||
| 40 | @ColumnWidth(12) | 44 | @ColumnWidth(12) |
| 41 | private String fleetName; | 45 | private String fleetName; |
| 42 | 46 | ||
| 47 | + @ApiModelProperty("车辆自编号") | ||
| 43 | @ExcelProperty(value = "车辆自编号") | 48 | @ExcelProperty(value = "车辆自编号") |
| 44 | @ColumnWidth(12) | 49 | @ColumnWidth(12) |
| 45 | private String nbbm; | 50 | private String nbbm; |
| 46 | 51 | ||
| 52 | + @ApiModelProperty("计划签到时间") | ||
| 47 | @ExcelProperty(value = "计划签到时间") | 53 | @ExcelProperty(value = "计划签到时间") |
| 48 | @ColumnWidth(20) | 54 | @ColumnWidth(20) |
| 49 | private Date planSignInTime; | 55 | private Date planSignInTime; |
| 56 | + | ||
| 57 | + @ApiModelProperty("实际签到时间") | ||
| 50 | @ExcelProperty(value = "实际签到时间") | 58 | @ExcelProperty(value = "实际签到时间") |
| 51 | @ColumnWidth(20) | 59 | @ColumnWidth(20) |
| 52 | private Date actualSignInTime; | 60 | private Date actualSignInTime; |
| 61 | + | ||
| 62 | + @ApiModelProperty("是否酒精测试") | ||
| 53 | @ExcelProperty(value = "是否酒精测试") | 63 | @ExcelProperty(value = "是否酒精测试") |
| 54 | @ColumnWidth(12) | 64 | @ColumnWidth(12) |
| 55 | private String alcoholStringIn; | 65 | private String alcoholStringIn; |
| 66 | + | ||
| 67 | + @ApiModelProperty("酒精测试含量") | ||
| 56 | @ExcelProperty(value = "酒精测试含量") | 68 | @ExcelProperty(value = "酒精测试含量") |
| 57 | @ColumnWidth(12) | 69 | @ColumnWidth(12) |
| 58 | private BigDecimal alcoholIntakeIn; | 70 | private BigDecimal alcoholIntakeIn; |
| 71 | + | ||
| 72 | + @ApiModelProperty("签到结果") | ||
| 59 | @ExcelProperty(value = "签到结果") | 73 | @ExcelProperty(value = "签到结果") |
| 60 | @ColumnWidth(12) | 74 | @ColumnWidth(12) |
| 61 | private String signInResultString; | 75 | private String signInResultString; |
| 76 | + @ApiModelProperty("计划签退时间") | ||
| 62 | @ExcelProperty(value = "计划签退时间") | 77 | @ExcelProperty(value = "计划签退时间") |
| 63 | @ColumnWidth(20) | 78 | @ColumnWidth(20) |
| 64 | private Date planSignOutTime; | 79 | private Date planSignOutTime; |
| 80 | + @ApiModelProperty("实际签退时间") | ||
| 65 | @ExcelProperty(value = "实际签退时间") | 81 | @ExcelProperty(value = "实际签退时间") |
| 66 | @ColumnWidth(20) | 82 | @ColumnWidth(20) |
| 67 | private Date actualSignOutTime; | 83 | private Date actualSignOutTime; |
| 84 | + | ||
| 85 | + @ApiModelProperty("是否酒精测试") | ||
| 68 | @ExcelProperty(value = "是否酒精测试") | 86 | @ExcelProperty(value = "是否酒精测试") |
| 69 | @ColumnWidth(12) | 87 | @ColumnWidth(12) |
| 70 | private String alcoholStringOut; | 88 | private String alcoholStringOut; |
| 89 | + | ||
| 90 | + @ApiModelProperty("酒精测试含量") | ||
| 71 | @ExcelProperty(value = "酒精测试含量") | 91 | @ExcelProperty(value = "酒精测试含量") |
| 72 | @ColumnWidth(12) | 92 | @ColumnWidth(12) |
| 73 | private BigDecimal alcoholIntakeOut; | 93 | private BigDecimal alcoholIntakeOut; |
| 94 | + | ||
| 95 | + @ApiModelProperty("签退结果") | ||
| 74 | @ExcelProperty(value = "签退结果") | 96 | @ExcelProperty(value = "签退结果") |
| 75 | private String signOutResultString; | 97 | private String signOutResultString; |
| 76 | 98 | ||
| 99 | + @ApiModelProperty("有无分班") | ||
| 77 | @ExcelProperty(value = "有无分班") | 100 | @ExcelProperty(value = "有无分班") |
| 78 | private String haveSecondFlagString; | 101 | private String haveSecondFlagString; |
| 79 | 102 | ||
| 103 | + @ApiModelProperty("分班计划签到时间") | ||
| 80 | @ExcelProperty(value = "分班计划签到时间") | 104 | @ExcelProperty(value = "分班计划签到时间") |
| 81 | @ColumnWidth(20) | 105 | @ColumnWidth(20) |
| 82 | private Date secondPlanSignInTime; | 106 | private Date secondPlanSignInTime; |
| 107 | + | ||
| 108 | + @ApiModelProperty("分班实际签到时间") | ||
| 83 | @ExcelProperty(value = "分班实际签到时间") | 109 | @ExcelProperty(value = "分班实际签到时间") |
| 84 | @ColumnWidth(20) | 110 | @ColumnWidth(20) |
| 85 | private Date secondActualSignInTime; | 111 | private Date secondActualSignInTime; |
| 86 | 112 | ||
| 113 | + @ApiModelProperty("是否酒精测试") | ||
| 87 | @ExcelProperty(value = "是否酒精测试") | 114 | @ExcelProperty(value = "是否酒精测试") |
| 88 | @ColumnWidth(12) | 115 | @ColumnWidth(12) |
| 89 | private String secondAlcoholStringIn; | 116 | private String secondAlcoholStringIn; |
| 117 | + | ||
| 118 | + @ApiModelProperty("酒精测试含量") | ||
| 90 | @ExcelProperty(value = "酒精测试含量") | 119 | @ExcelProperty(value = "酒精测试含量") |
| 91 | @ColumnWidth(12) | 120 | @ColumnWidth(12) |
| 92 | private BigDecimal secondAlcoholIntakeIn; | 121 | private BigDecimal secondAlcoholIntakeIn; |
| 122 | + | ||
| 123 | + @ApiModelProperty("分班签到结果") | ||
| 93 | @ExcelProperty(value = "分班签到结果") | 124 | @ExcelProperty(value = "分班签到结果") |
| 94 | @ColumnWidth(12) | 125 | @ColumnWidth(12) |
| 95 | private String secondSignInResultString; | 126 | private String secondSignInResultString; |
| 127 | + | ||
| 128 | + @ApiModelProperty("分班计划签退时间") | ||
| 96 | @ExcelProperty(value = "分班计划签退时间") | 129 | @ExcelProperty(value = "分班计划签退时间") |
| 97 | @ColumnWidth(20) | 130 | @ColumnWidth(20) |
| 98 | private Date secondPlanSignOutTime; | 131 | private Date secondPlanSignOutTime; |
| 132 | + | ||
| 133 | + @ApiModelProperty("分班实际签退时间") | ||
| 99 | @ExcelProperty(value = "分班实际签退时间") | 134 | @ExcelProperty(value = "分班实际签退时间") |
| 100 | @ColumnWidth(20) | 135 | @ColumnWidth(20) |
| 101 | private Date secondActualSignOutTime; | 136 | private Date secondActualSignOutTime; |
| 102 | 137 | ||
| 138 | + @ApiModelProperty("是否酒精测试") | ||
| 103 | @ExcelProperty(value = "是否酒精测试") | 139 | @ExcelProperty(value = "是否酒精测试") |
| 104 | @ColumnWidth(12) | 140 | @ColumnWidth(12) |
| 105 | private String secondAlcoholStringOut; | 141 | private String secondAlcoholStringOut; |
| 142 | + | ||
| 143 | + @ApiModelProperty("酒精测试含量") | ||
| 106 | @ExcelProperty(value = "酒精测试含量") | 144 | @ExcelProperty(value = "酒精测试含量") |
| 107 | @ColumnWidth(12) | 145 | @ColumnWidth(12) |
| 108 | private BigDecimal secondAlcoholIntakeOut; | 146 | private BigDecimal secondAlcoholIntakeOut; |
| 147 | + | ||
| 148 | + @ApiModelProperty("分班签退结果") | ||
| 109 | @ExcelProperty(value = "分班签退结果") | 149 | @ExcelProperty(value = "分班签退结果") |
| 110 | @ColumnWidth(12) | 150 | @ColumnWidth(12) |
| 111 | private String secondSignOutResultString; | 151 | private String secondSignOutResultString; |
| 112 | 152 | ||
| 153 | + @ApiModelProperty("排班日期") | ||
| 113 | @ExcelProperty(value = "排班日期") | 154 | @ExcelProperty(value = "排班日期") |
| 114 | @ColumnWidth(20) | 155 | @ColumnWidth(20) |
| 115 | private Date scheduleDate; | 156 | private Date scheduleDate; |
Bsth-admin/src/main/java/com/ruoyi/service/ReportService.java
| 1 | package com.ruoyi.service; | 1 | package com.ruoyi.service; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.collection.CollectionUtil; | ||
| 4 | +import com.ruoyi.common.global.Result; | ||
| 5 | +import com.ruoyi.common.global.ResultCode; | ||
| 3 | import com.ruoyi.common.utils.SecurityUtils; | 6 | import com.ruoyi.common.utils.SecurityUtils; |
| 4 | import com.ruoyi.driver.mapper.DriverMapper; | 7 | import com.ruoyi.driver.mapper.DriverMapper; |
| 5 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; | 8 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; |
| @@ -11,19 +14,24 @@ import com.ruoyi.pojo.request.ReportErrorRequestVo; | @@ -11,19 +14,24 @@ import com.ruoyi.pojo.request.ReportErrorRequestVo; | ||
| 11 | import com.ruoyi.pojo.response.*; | 14 | import com.ruoyi.pojo.response.*; |
| 12 | import com.ruoyi.system.domain.SysNotice; | 15 | import com.ruoyi.system.domain.SysNotice; |
| 13 | import com.ruoyi.system.service.ISysNoticeService; | 16 | import com.ruoyi.system.service.ISysNoticeService; |
| 17 | +import com.ruoyi.utils.ConstDateUtil; | ||
| 14 | import org.springframework.beans.BeanUtils; | 18 | import org.springframework.beans.BeanUtils; |
| 15 | import org.springframework.beans.factory.annotation.Autowired; | 19 | import org.springframework.beans.factory.annotation.Autowired; |
| 16 | import org.springframework.stereotype.Service; | 20 | import org.springframework.stereotype.Service; |
| 17 | 21 | ||
| 18 | import javax.annotation.Resource; | 22 | import javax.annotation.Resource; |
| 23 | +import javax.servlet.http.HttpServletRequest; | ||
| 19 | import javax.servlet.http.HttpServletResponse; | 24 | import javax.servlet.http.HttpServletResponse; |
| 20 | import javax.validation.constraints.NotBlank; | 25 | import javax.validation.constraints.NotBlank; |
| 21 | import java.time.LocalDate; | 26 | import java.time.LocalDate; |
| 22 | import java.time.YearMonth; | 27 | import java.time.YearMonth; |
| 23 | import java.time.format.DateTimeFormatter; | 28 | import java.time.format.DateTimeFormatter; |
| 24 | import java.util.*; | 29 | import java.util.*; |
| 30 | +import java.util.regex.Matcher; | ||
| 31 | +import java.util.regex.Pattern; | ||
| 25 | import java.util.stream.Collectors; | 32 | import java.util.stream.Collectors; |
| 26 | 33 | ||
| 34 | +import static com.ruoyi.common.ApiProperties.PERSONNEL_API_KEY; | ||
| 27 | import static com.ruoyi.common.ConstDriverProperties.BC_TYPE_OUT; | 35 | import static com.ruoyi.common.ConstDriverProperties.BC_TYPE_OUT; |
| 28 | import static com.ruoyi.common.ConstSignInConstSignInProperties.*; | 36 | import static com.ruoyi.common.ConstSignInConstSignInProperties.*; |
| 29 | import static com.ruoyi.common.ReportProperties.DAY; | 37 | import static com.ruoyi.common.ReportProperties.DAY; |
| @@ -86,16 +94,16 @@ public class ReportService { | @@ -86,16 +94,16 @@ public class ReportService { | ||
| 86 | public List<ExportReportViewResponseVo> exportReportList(ReportViewRequestVo requestVo, HttpServletResponse response) { | 94 | public List<ExportReportViewResponseVo> exportReportList(ReportViewRequestVo requestVo, HttpServletResponse response) { |
| 87 | // 处理天 | 95 | // 处理天 |
| 88 | if (requestVo.getExportFlag().equals(DAY)) { | 96 | if (requestVo.getExportFlag().equals(DAY)) { |
| 89 | - return getDayReportTableResponseVo(requestVo.getDate(), response); | 97 | + return getDayReportTableResponseVo(requestVo.getDate()); |
| 90 | } | 98 | } |
| 91 | // 处理月 | 99 | // 处理月 |
| 92 | else if (requestVo.getExportFlag().equals(MONTH)) { | 100 | else if (requestVo.getExportFlag().equals(MONTH)) { |
| 93 | - return getMonthReportTableResponseVo(requestVo, response); | 101 | + return getMonthReportTableResponseVo(requestVo); |
| 94 | } | 102 | } |
| 95 | return null; | 103 | return null; |
| 96 | } | 104 | } |
| 97 | 105 | ||
| 98 | - private List<ExportReportViewResponseVo> getDayReportTableResponseVo(String date, HttpServletResponse response) { | 106 | + private List<ExportReportViewResponseVo> getDayReportTableResponseVo(String date) { |
| 99 | List<DriverScheduling> schedulingList = schedulingMapper.queryToDay(date, null, null, null); | 107 | List<DriverScheduling> schedulingList = schedulingMapper.queryToDay(date, null, null, null); |
| 100 | Map<String, List<DriverScheduling>> resultMap = new HashMap<>(800); | 108 | Map<String, List<DriverScheduling>> resultMap = new HashMap<>(800); |
| 101 | List<ExportReportViewResponseVo> vo = new ArrayList<>(800); | 109 | List<ExportReportViewResponseVo> vo = new ArrayList<>(800); |
| @@ -122,11 +130,11 @@ public class ReportService { | @@ -122,11 +130,11 @@ public class ReportService { | ||
| 122 | } | 130 | } |
| 123 | } | 131 | } |
| 124 | 132 | ||
| 125 | - private List<ExportReportViewResponseVo> getMonthReportTableResponseVo(ReportViewRequestVo requestVo, HttpServletResponse response) { | 133 | + private List<ExportReportViewResponseVo> getMonthReportTableResponseVo(ReportViewRequestVo requestVo) { |
| 126 | List<ExportReportViewResponseVo> responseVos = new ArrayList<>(10000); | 134 | List<ExportReportViewResponseVo> responseVos = new ArrayList<>(10000); |
| 127 | List<String> days = getNowMonthAllDay(requestVo.getDate()); | 135 | List<String> days = getNowMonthAllDay(requestVo.getDate()); |
| 128 | for (String day : days) { | 136 | for (String day : days) { |
| 129 | - List<ExportReportViewResponseVo> dayReportTableResponseVo = getDayReportTableResponseVo(day, response); | 137 | + List<ExportReportViewResponseVo> dayReportTableResponseVo = getDayReportTableResponseVo(day); |
| 130 | responseVos.addAll(dayReportTableResponseVo); | 138 | responseVos.addAll(dayReportTableResponseVo); |
| 131 | } | 139 | } |
| 132 | return responseVos; | 140 | return responseVos; |
| @@ -197,7 +205,7 @@ public class ReportService { | @@ -197,7 +205,7 @@ public class ReportService { | ||
| 197 | 205 | ||
| 198 | public SysNotice getAlarmNoticeByType(Integer type) { | 206 | public SysNotice getAlarmNoticeByType(Integer type) { |
| 199 | String username = SecurityUtils.getUsername(); | 207 | String username = SecurityUtils.getUsername(); |
| 200 | - return noticeService.getAlarmNotice(username,type); | 208 | + return noticeService.getAlarmNotice(username, type); |
| 201 | } | 209 | } |
| 202 | 210 | ||
| 203 | public Object sureNotice(SysNotice notice) { | 211 | public Object sureNotice(SysNotice notice) { |
| @@ -206,4 +214,45 @@ public class ReportService { | @@ -206,4 +214,45 @@ public class ReportService { | ||
| 206 | noticeService.updateNotice(notice); | 214 | noticeService.updateNotice(notice); |
| 207 | return null; | 215 | return null; |
| 208 | } | 216 | } |
| 217 | + | ||
| 218 | + public Result listReportMonth(String month, HttpServletRequest request) { | ||
| 219 | + boolean validateDate = validateDate(month); | ||
| 220 | + String header = request.getHeader("X-TOKEN-AUTHORIZATION"); | ||
| 221 | + if (!PERSONNEL_API_KEY.equals(header)) { | ||
| 222 | + return Result.ERROR(ResultCode.CODE_401, "X-TOKEN-AUTHORIZATION value error"); | ||
| 223 | + } | ||
| 224 | + if (!validateDate) { | ||
| 225 | + return Result.ERROR(ResultCode.CODE_400, "Parameter format error"); | ||
| 226 | + } | ||
| 227 | + ReportViewRequestVo vo = new ReportViewRequestVo(); | ||
| 228 | + vo.setDate(month + "-01"); | ||
| 229 | + List<ExportReportViewResponseVo> responseVoList = getMonthReportTableResponseVo(vo); | ||
| 230 | + Map<String, List<ExportReportViewResponseVo>> map = new HashMap<>(responseVoList.size() / 30); | ||
| 231 | + handleResponseByDay(responseVoList, map, vo.getDate()); | ||
| 232 | + return Result.OK(map); | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + private void handleResponseByDay(List<ExportReportViewResponseVo> responseVoList, Map<String, List<ExportReportViewResponseVo>> map, @NotBlank String date) { | ||
| 236 | + for (ExportReportViewResponseVo vo : responseVoList) { | ||
| 237 | + String key = ConstDateUtil.formatDate("yyyy-MM-dd", vo.getScheduleDate()); | ||
| 238 | + List<ExportReportViewResponseVo> vos = map.get(key); | ||
| 239 | + if (CollectionUtil.isEmpty(vos)){ | ||
| 240 | + map.put(key,new ArrayList<>(Arrays.asList(vo))); | ||
| 241 | + }else { | ||
| 242 | + map.get(key).add(vo); | ||
| 243 | + } | ||
| 244 | + } | ||
| 245 | + } | ||
| 246 | + | ||
| 247 | + /** | ||
| 248 | + * yyyy-MM 格式的正则表达式 | ||
| 249 | + */ | ||
| 250 | + public static boolean validateDate(String input) { | ||
| 251 | + String regex = "^(\\d{4})-(0[1-9]|1[0-2])$"; | ||
| 252 | + | ||
| 253 | + Pattern pattern = Pattern.compile(regex); | ||
| 254 | + Matcher matcher = pattern.matcher(input); | ||
| 255 | + | ||
| 256 | + return matcher.matches(); | ||
| 257 | + } | ||
| 209 | } | 258 | } |
Bsth-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
| @@ -111,7 +111,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter | @@ -111,7 +111,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter | ||
| 111 | // 过滤请求 | 111 | // 过滤请求 |
| 112 | .authorizeRequests() | 112 | .authorizeRequests() |
| 113 | // 对于登录login 注册register 验证码captchaImage 允许匿名访问 | 113 | // 对于登录login 注册register 验证码captchaImage 允许匿名访问 |
| 114 | - .antMatchers("/system/dict/data/**","/app/version/check/**","/app/checkDeviceHeart","/app/download","/driver/**","/in/**","/eexception/**","/equipment/**","/report/**","/login", "/register", "/captchaImage").permitAll() | 114 | + .antMatchers("/report/list/**","/system/dict/data/**","/app/version/check/**","/app/checkDeviceHeart","/app/download","/driver/**","/in/**","/eexception/**","/equipment/**","/report/**","/login", "/register", "/captchaImage").permitAll() |
| 115 | // 静态资源,可匿名访问 | 115 | // 静态资源,可匿名访问 |
| 116 | .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() | 116 | .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() |
| 117 | .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() | 117 | .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() |