Commit a82001d54fdbf6c68b02bedf6cfd21e981a52d57
1 parent
54f9339e
fix: add report api
Showing
20 changed files
with
381 additions
and
37 deletions
ruoyi-admin/src/main/java/com/ruoyi/common/ErrorTypeProperties.java
0 → 100644
ruoyi-admin/src/main/java/com/ruoyi/controller/ReportController.java
0 → 100644
| 1 | +package com.ruoyi.controller; | ||
| 2 | + | ||
| 3 | +import com.ruoyi.common.core.domain.AjaxResult; | ||
| 4 | +import com.ruoyi.pojo.request.ReportViewRequestVo; | ||
| 5 | +import com.ruoyi.pojo.request.ReportErrorRequestVo; | ||
| 6 | +import com.ruoyi.service.ReportService; | ||
| 7 | +import io.swagger.annotations.Api; | ||
| 8 | +import io.swagger.annotations.ApiOperation; | ||
| 9 | +import io.swagger.annotations.ApiParam; | ||
| 10 | +import org.springframework.web.bind.annotation.*; | ||
| 11 | + | ||
| 12 | +import javax.annotation.Resource; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @author 20412 | ||
| 16 | + */ | ||
| 17 | +@RestController | ||
| 18 | +@RequestMapping("/report") | ||
| 19 | +@Api(tags = "报表管理") | ||
| 20 | +public class ReportController { | ||
| 21 | + | ||
| 22 | + @Resource | ||
| 23 | + private ReportService reportService; | ||
| 24 | + | ||
| 25 | + @ApiOperation("签到报表集合查询") | ||
| 26 | + @GetMapping("/list") | ||
| 27 | + public AjaxResult getList(@ApiParam @ModelAttribute ReportViewRequestVo requestVo) { | ||
| 28 | + return AjaxResult.success(reportService.getReportScrollViewTable(requestVo)); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + @ApiOperation("异常报表集合查询") | ||
| 32 | + @GetMapping("/error/list") | ||
| 33 | + public AjaxResult getErrorList(@ApiParam @ModelAttribute ReportErrorRequestVo request) { | ||
| 34 | + return AjaxResult.success(reportService.getErrorReportList(request)); | ||
| 35 | + } | ||
| 36 | +} |
ruoyi-admin/src/main/java/com/ruoyi/driver/mapper/DriverMapper.java
| 1 | package com.ruoyi.driver.mapper; | 1 | package com.ruoyi.driver.mapper; |
| 2 | 2 | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | +import java.util.Set; | ||
| 5 | + | ||
| 4 | import com.ruoyi.driver.domain.Driver; | 6 | import com.ruoyi.driver.domain.Driver; |
| 5 | import com.ruoyi.pojo.response.ResponseScheduling; | 7 | import com.ruoyi.pojo.response.ResponseScheduling; |
| 6 | import org.apache.ibatis.annotations.Param; | 8 | import org.apache.ibatis.annotations.Param; |
| @@ -76,4 +78,11 @@ public interface DriverMapper | @@ -76,4 +78,11 @@ public interface DriverMapper | ||
| 76 | * @return | 78 | * @return |
| 77 | */ | 79 | */ |
| 78 | List<ResponseScheduling> getDriverSchedulingList(@Param("date") String date,@Param("jobCode") String jobCode); | 80 | List<ResponseScheduling> getDriverSchedulingList(@Param("date") String date,@Param("jobCode") String jobCode); |
| 81 | + | ||
| 82 | + /** | ||
| 83 | + * | ||
| 84 | + * @param jobCodes | ||
| 85 | + * @return | ||
| 86 | + */ | ||
| 87 | + List<Driver> getNameByJobCode(@Param("jobCodes") Set<String> jobCodes); | ||
| 79 | } | 88 | } |
ruoyi-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
| @@ -60,6 +60,11 @@ public class DriverServiceImpl implements IDriverService { | @@ -60,6 +60,11 @@ public class DriverServiceImpl implements IDriverService { | ||
| 60 | */ | 60 | */ |
| 61 | @Override | 61 | @Override |
| 62 | public int insertDriver(Driver driver) { | 62 | public int insertDriver(Driver driver) { |
| 63 | + // 判断是否存在相同的工号数据 存在既更新 | ||
| 64 | +// Driver driverById = driverMapper.selectDriverById(driver.getId()); | ||
| 65 | +// if (driverById == null){ | ||
| 66 | +// | ||
| 67 | +// } | ||
| 63 | return driverMapper.insertDriver(driver); | 68 | return driverMapper.insertDriver(driver); |
| 64 | } | 69 | } |
| 65 | 70 | ||
| @@ -111,7 +116,6 @@ public class DriverServiceImpl implements IDriverService { | @@ -111,7 +116,6 @@ public class DriverServiceImpl implements IDriverService { | ||
| 111 | } | 116 | } |
| 112 | // 数据库中读取所有接收到的排班信息 | 117 | // 数据库中读取所有接收到的排班信息 |
| 113 | List<ResponseScheduling> responseSchedulings = driverMapper.getDriverSchedulingList(schedulingDate, jobCode); | 118 | List<ResponseScheduling> responseSchedulings = driverMapper.getDriverSchedulingList(schedulingDate, jobCode); |
| 114 | - // 缓存中读取当天的排班信息 | ||
| 115 | return AjaxResult.success(responseSchedulings); | 119 | return AjaxResult.success(responseSchedulings); |
| 116 | } | 120 | } |
| 117 | 121 |
ruoyi-admin/src/main/java/com/ruoyi/eexception/domain/EquipmentException.java
| @@ -22,9 +22,17 @@ public class EquipmentException extends BaseEntity | @@ -22,9 +22,17 @@ public class EquipmentException extends BaseEntity | ||
| 22 | @Excel(name = "标题") | 22 | @Excel(name = "标题") |
| 23 | private String title; | 23 | private String title; |
| 24 | 24 | ||
| 25 | + public String getDeviceId() { | ||
| 26 | + return deviceId; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + public void setDeviceId(String deviceId) { | ||
| 30 | + this.deviceId = deviceId; | ||
| 31 | + } | ||
| 32 | + | ||
| 25 | /** 设备id */ | 33 | /** 设备id */ |
| 26 | @Excel(name = "设备id") | 34 | @Excel(name = "设备id") |
| 27 | - private Long deviceId; | 35 | + private String deviceId; |
| 28 | 36 | ||
| 29 | /** 上报人 */ | 37 | /** 上报人 */ |
| 30 | @Excel(name = "上报人") | 38 | @Excel(name = "上报人") |
| @@ -56,15 +64,8 @@ public class EquipmentException extends BaseEntity | @@ -56,15 +64,8 @@ public class EquipmentException extends BaseEntity | ||
| 56 | { | 64 | { |
| 57 | return title; | 65 | return title; |
| 58 | } | 66 | } |
| 59 | - public void setDeviceId(Long deviceId) | ||
| 60 | - { | ||
| 61 | - this.deviceId = deviceId; | ||
| 62 | - } | ||
| 63 | 67 | ||
| 64 | - public Long getDeviceId() | ||
| 65 | - { | ||
| 66 | - return deviceId; | ||
| 67 | - } | 68 | + |
| 68 | public void setJobCode(String jobCode) | 69 | public void setJobCode(String jobCode) |
| 69 | { | 70 | { |
| 70 | this.jobCode = jobCode; | 71 | this.jobCode = jobCode; |
ruoyi-admin/src/main/java/com/ruoyi/eexception/mapper/EquipmentExceptionMapper.java
| @@ -2,6 +2,7 @@ package com.ruoyi.eexception.mapper; | @@ -2,6 +2,7 @@ package com.ruoyi.eexception.mapper; | ||
| 2 | 2 | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | import com.ruoyi.eexception.domain.EquipmentException; | 4 | import com.ruoyi.eexception.domain.EquipmentException; |
| 5 | +import com.ruoyi.pojo.request.ReportErrorRequestVo; | ||
| 5 | 6 | ||
| 6 | /** | 7 | /** |
| 7 | * 设备异常记录Mapper接口 | 8 | * 设备异常记录Mapper接口 |
| @@ -58,4 +59,6 @@ public interface EquipmentExceptionMapper | @@ -58,4 +59,6 @@ public interface EquipmentExceptionMapper | ||
| 58 | * @return 结果 | 59 | * @return 结果 |
| 59 | */ | 60 | */ |
| 60 | public int deleteEquipmentExceptionByIds(Long[] ids); | 61 | public int deleteEquipmentExceptionByIds(Long[] ids); |
| 62 | + | ||
| 63 | + List<EquipmentException> getEquipmentErrorList(ReportErrorRequestVo request); | ||
| 61 | } | 64 | } |
ruoyi-admin/src/main/java/com/ruoyi/equipment/mapper/EquipmentMapper.java
ruoyi-admin/src/main/java/com/ruoyi/in/mapper/SignInMapper.java
| @@ -2,6 +2,9 @@ package com.ruoyi.in.mapper; | @@ -2,6 +2,9 @@ package com.ruoyi.in.mapper; | ||
| 2 | 2 | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | import com.ruoyi.in.domain.SignIn; | 4 | import com.ruoyi.in.domain.SignIn; |
| 5 | +import com.ruoyi.pojo.request.ReportViewRequestVo; | ||
| 6 | +import com.ruoyi.pojo.request.ReportErrorRequestVo; | ||
| 7 | +import com.ruoyi.pojo.response.ReportViewResponseVo; | ||
| 5 | 8 | ||
| 6 | /** | 9 | /** |
| 7 | * 签到Mapper接口 | 10 | * 签到Mapper接口 |
| @@ -59,4 +62,12 @@ public interface SignInMapper | @@ -59,4 +62,12 @@ public interface SignInMapper | ||
| 59 | */ | 62 | */ |
| 60 | public int deleteSignInByIds(Long[] ids); | 63 | public int deleteSignInByIds(Long[] ids); |
| 61 | 64 | ||
| 65 | + /** | ||
| 66 | + * 获取签到数据 | ||
| 67 | + * @param requestVo | ||
| 68 | + * @return | ||
| 69 | + */ | ||
| 70 | + List<ReportViewResponseVo> getReportScrollViewTable(ReportViewRequestVo requestVo); | ||
| 71 | + | ||
| 72 | + List<SignIn> getSignErrorList(ReportErrorRequestVo request); | ||
| 62 | } | 73 | } |
ruoyi-admin/src/main/java/com/ruoyi/in/service/ISignInService.java
| @@ -5,6 +5,8 @@ import java.util.List; | @@ -5,6 +5,8 @@ import java.util.List; | ||
| 5 | 5 | ||
| 6 | import com.ruoyi.common.exception.file.FileUploadException; | 6 | import com.ruoyi.common.exception.file.FileUploadException; |
| 7 | import com.ruoyi.in.domain.SignIn; | 7 | import com.ruoyi.in.domain.SignIn; |
| 8 | +import com.ruoyi.pojo.request.ReportViewRequestVo; | ||
| 9 | +import com.ruoyi.pojo.response.ReportViewResponseVo; | ||
| 8 | 10 | ||
| 9 | /** | 11 | /** |
| 10 | * 签到Service接口 | 12 | * 签到Service接口 |
| @@ -68,4 +70,5 @@ public interface ISignInService | @@ -68,4 +70,5 @@ public interface ISignInService | ||
| 68 | * @return | 70 | * @return |
| 69 | */ | 71 | */ |
| 70 | int addSignIn(SignIn signIn) throws FileUploadException, IOException; | 72 | int addSignIn(SignIn signIn) throws FileUploadException, IOException; |
| 73 | + | ||
| 71 | } | 74 | } |
ruoyi-admin/src/main/java/com/ruoyi/in/service/impl/SignInServiceImpl.java
| @@ -111,7 +111,6 @@ public class SignInServiceImpl implements ISignInService { | @@ -111,7 +111,6 @@ public class SignInServiceImpl implements ISignInService { | ||
| 111 | @Override | 111 | @Override |
| 112 | public int addSignIn(SignIn signIn) throws FileUploadException, IOException { | 112 | public int addSignIn(SignIn signIn) throws FileUploadException, IOException { |
| 113 | // base64转图片 | 113 | // base64转图片 |
| 114 | - System.out.println(signIn.getSingnIn()); | ||
| 115 | signIn.setCreateTime(new Date()); | 114 | signIn.setCreateTime(new Date()); |
| 116 | signIn.setIp(IpUtils.getIpAddr()); | 115 | signIn.setIp(IpUtils.getIpAddr()); |
| 117 | String base64 = signIn.getImage(); | 116 | String base64 = signIn.getImage(); |
ruoyi-admin/src/main/java/com/ruoyi/pojo/request/ReportErrorRequestVo.java
0 → 100644
| 1 | +package com.ruoyi.pojo.request; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 4 | +import io.swagger.annotations.ApiModel; | ||
| 5 | +import io.swagger.annotations.ApiModelProperty; | ||
| 6 | +import lombok.Data; | ||
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 8 | + | ||
| 9 | +import java.util.Date; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 异常报表请求 | ||
| 13 | + * @author 20412 | ||
| 14 | + */ | ||
| 15 | +@ApiModel("异常报表请求") | ||
| 16 | +@Data | ||
| 17 | +public class ReportErrorRequestVo { | ||
| 18 | + /** | ||
| 19 | + * 错误类型 | ||
| 20 | + */ | ||
| 21 | + @ApiModelProperty("错误类型") | ||
| 22 | + private String errorType; | ||
| 23 | + /** | ||
| 24 | + * 开始时间 | ||
| 25 | + */ | ||
| 26 | + @ApiModelProperty("开始时间") | ||
| 27 | + private String startTime; | ||
| 28 | + /** | ||
| 29 | + * 结束时间 | ||
| 30 | + */ | ||
| 31 | + @ApiModelProperty("结束时间") | ||
| 32 | + private String endTime; | ||
| 33 | +} |
ruoyi-admin/src/main/java/com/ruoyi/pojo/response/ReportErrorResponseVo.java
0 → 100644
| 1 | +package com.ruoyi.pojo.response; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 4 | +import io.swagger.annotations.ApiModel; | ||
| 5 | +import io.swagger.annotations.ApiModelProperty; | ||
| 6 | +import lombok.Data; | ||
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 8 | + | ||
| 9 | +import java.util.Date; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 异常报表对象 | ||
| 13 | + * @author 20412 | ||
| 14 | + */ | ||
| 15 | +@Data | ||
| 16 | +@ApiModel("异常报表对象") | ||
| 17 | +public class ReportErrorResponseVo { | ||
| 18 | + @ApiModelProperty("异常类型") | ||
| 19 | + private String errorType; | ||
| 20 | + @ApiModelProperty("姓名") | ||
| 21 | + private String name; | ||
| 22 | + @ApiModelProperty("工号") | ||
| 23 | + private String jobCode; | ||
| 24 | + @ApiModelProperty("图片") | ||
| 25 | + private String image; | ||
| 26 | + @ApiModelProperty("设备id") | ||
| 27 | + private String deviceId; | ||
| 28 | + @ApiModelProperty("时间") | ||
| 29 | + @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss") | ||
| 30 | + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss" , timezone = "GMT+8") | ||
| 31 | + private Date createTime; | ||
| 32 | + @ApiModelProperty("备注") | ||
| 33 | + @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss") | ||
| 34 | + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss" , timezone = "GMT+8") | ||
| 35 | + private String remark; | ||
| 36 | +} |
ruoyi-admin/src/main/java/com/ruoyi/pojo/response/ReportViewResponseVo.java
0 → 100644
| 1 | +package com.ruoyi.pojo.response; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 4 | +import com.ruoyi.common.annotation.Excel; | ||
| 5 | +import io.swagger.annotations.ApiModel; | ||
| 6 | +import io.swagger.annotations.ApiModelProperty; | ||
| 7 | +import lombok.Data; | ||
| 8 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 9 | + | ||
| 10 | +import java.math.BigDecimal; | ||
| 11 | +import java.util.Date; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * @author 20412 | ||
| 15 | + */ | ||
| 16 | +@ApiModel("滚动大屏响应体数据") | ||
| 17 | +@Data | ||
| 18 | +public class ReportViewResponseVo { | ||
| 19 | + @ApiModelProperty("id") | ||
| 20 | + private Long id; | ||
| 21 | + @ApiModelProperty("工号") | ||
| 22 | + private String jobCode; | ||
| 23 | + @ApiModelProperty("签到类型") | ||
| 24 | + private String singnIn; | ||
| 25 | + @ApiModelProperty("姓名") | ||
| 26 | + private String name; | ||
| 27 | + @ApiModelProperty("签到时间") | ||
| 28 | + @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss") | ||
| 29 | + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") | ||
| 30 | + private Date createTime; | ||
| 31 | + @ApiModelProperty("签到状态1 成功2 异常") | ||
| 32 | + private Integer status; | ||
| 33 | + /** | ||
| 34 | + * 签到签退 | ||
| 35 | + */ | ||
| 36 | + @ApiModelProperty("签到签退") | ||
| 37 | + private Integer type; | ||
| 38 | + /** | ||
| 39 | + * 是否酒精检测 1 检查 2 未检 | ||
| 40 | + */ | ||
| 41 | + @ApiModelProperty("是否酒精检测 1 检查 2 未检") | ||
| 42 | + private Integer alcoholFlag; | ||
| 43 | + /** | ||
| 44 | + * 酒精含量 | ||
| 45 | + */ | ||
| 46 | + @ApiModelProperty("酒精含量") | ||
| 47 | + private BigDecimal alcoholIntake; | ||
| 48 | + @ApiModelProperty("头像") | ||
| 49 | + private String image; | ||
| 50 | + @ApiModelProperty("备注") | ||
| 51 | + private String remark; | ||
| 52 | +} |
ruoyi-admin/src/main/java/com/ruoyi/report/ReportController.java deleted
100644 → 0
| 1 | -package com.ruoyi.report; | ||
| 2 | - | ||
| 3 | -import io.swagger.annotations.Api; | ||
| 4 | -import io.swagger.annotations.ApiOperation; | ||
| 5 | -import org.springframework.web.bind.annotation.GetMapping; | ||
| 6 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 7 | -import org.springframework.web.bind.annotation.RestController; | ||
| 8 | - | ||
| 9 | -/** | ||
| 10 | - * @author 20412 | ||
| 11 | - */ | ||
| 12 | -@RestController | ||
| 13 | -@RequestMapping("/report") | ||
| 14 | -@Api(tags = "报表管理") | ||
| 15 | -public class ReportController { | ||
| 16 | - | ||
| 17 | - @ApiOperation("签到报表集合查询") | ||
| 18 | - @GetMapping("/list" ) | ||
| 19 | - public String getList() { | ||
| 20 | - return "暂未开发"; | ||
| 21 | - } | ||
| 22 | -} |
ruoyi-admin/src/main/java/com/ruoyi/service/ReportService.java
0 → 100644
| 1 | +package com.ruoyi.service; | ||
| 2 | + | ||
| 3 | +import com.ruoyi.driver.domain.Driver; | ||
| 4 | +import com.ruoyi.driver.mapper.DriverMapper; | ||
| 5 | +import com.ruoyi.eexception.domain.EquipmentException; | ||
| 6 | +import com.ruoyi.eexception.mapper.EquipmentExceptionMapper; | ||
| 7 | +import com.ruoyi.in.domain.SignIn; | ||
| 8 | +import com.ruoyi.in.mapper.SignInMapper; | ||
| 9 | +import com.ruoyi.pojo.request.ReportViewRequestVo; | ||
| 10 | +import com.ruoyi.pojo.request.ReportErrorRequestVo; | ||
| 11 | +import com.ruoyi.pojo.response.ReportErrorResponseVo; | ||
| 12 | +import com.ruoyi.pojo.response.ReportViewResponseVo; | ||
| 13 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 14 | +import org.springframework.stereotype.Service; | ||
| 15 | + | ||
| 16 | +import java.util.*; | ||
| 17 | +import java.util.stream.Collectors; | ||
| 18 | + | ||
| 19 | +import static com.ruoyi.common.ErrorTypeProperties.EQUIPMENT_ERROR; | ||
| 20 | +import static com.ruoyi.common.ErrorTypeProperties.SIGN_IN_ERROR; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * @author 20412 | ||
| 24 | + */ | ||
| 25 | +@Service | ||
| 26 | +public class ReportService { | ||
| 27 | + | ||
| 28 | + @Autowired | ||
| 29 | + private SignInMapper signInMapper; | ||
| 30 | + | ||
| 31 | + @Autowired | ||
| 32 | + private EquipmentExceptionMapper exceptionMapper; | ||
| 33 | + | ||
| 34 | + @Autowired | ||
| 35 | + private DriverMapper driverMapper; | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 查询报表信息 | ||
| 39 | + */ | ||
| 40 | + public List<ReportViewResponseVo> getReportScrollViewTable(ReportViewRequestVo requestVo) { | ||
| 41 | + return signInMapper.getReportScrollViewTable(requestVo); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + public List<ReportErrorResponseVo> getErrorReportList(ReportErrorRequestVo request) { | ||
| 45 | + // 获取基础报表信息 | ||
| 46 | + List<SignIn> signInList = signInMapper.getSignErrorList(request); | ||
| 47 | + List<EquipmentException> exceptionList = exceptionMapper.getEquipmentErrorList(request); | ||
| 48 | + // 封装到集合返回前端 | ||
| 49 | + List<ReportErrorResponseVo> responses = new ArrayList<>(); | ||
| 50 | + // 获取对应名称 | ||
| 51 | + Set<String> jobCodes = new HashSet<>(); | ||
| 52 | + signInList.stream().forEach(item -> { | ||
| 53 | + jobCodes.add(item.getJobCode()); | ||
| 54 | + }); | ||
| 55 | + exceptionList.stream().forEach(item -> { | ||
| 56 | + jobCodes.add(item.getJobCode()); | ||
| 57 | + }); | ||
| 58 | + Map<String, String> names = driverMapper.getNameByJobCode(jobCodes).stream().collect(Collectors.toMap(Driver::getJobCode, Driver::getPersonnelName)); | ||
| 59 | + if (SIGN_IN_ERROR.equals(request.getErrorType())) { | ||
| 60 | + copyToResponse(names, signInList, responses); | ||
| 61 | + }else if (EQUIPMENT_ERROR.equals(request.getErrorType())) { | ||
| 62 | + copyToResponseByException(names, exceptionList, responses); | ||
| 63 | + }else { | ||
| 64 | + copyToResponse(names, signInList, responses); | ||
| 65 | + copyToResponseByException(names, exceptionList, responses); | ||
| 66 | + } | ||
| 67 | + responses = sortListByCreateTime(responses); | ||
| 68 | + | ||
| 69 | + // 清除缓存 | ||
| 70 | + jobCodes.clear(); | ||
| 71 | + signInList.clear(); | ||
| 72 | + exceptionList.clear(); | ||
| 73 | + return responses; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + private List<ReportErrorResponseVo> sortListByCreateTime(List<ReportErrorResponseVo> responses) { | ||
| 77 | + responses = responses.stream().sorted(Comparator.comparing(ReportErrorResponseVo::getCreateTime, Comparator.reverseOrder())).collect(Collectors.toList()); | ||
| 78 | + return responses; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + private void copyToResponseByException(Map<String, String> names, List<EquipmentException> exceptionList, List<ReportErrorResponseVo> responses) { | ||
| 82 | + exceptionList.forEach(item -> { | ||
| 83 | + ReportErrorResponseVo vo = new ReportErrorResponseVo(); | ||
| 84 | + vo.setName(names.get(item.getJobCode())); | ||
| 85 | + vo.setImage(item.getImage()); | ||
| 86 | + vo.setRemark(item.getRemark()); | ||
| 87 | + vo.setCreateTime(item.getCreateTime()); | ||
| 88 | + vo.setDeviceId(item.getDeviceId()); | ||
| 89 | + vo.setErrorType(EQUIPMENT_ERROR); | ||
| 90 | + responses.add(vo); | ||
| 91 | + }); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + private void copyToResponse(Map<String, String> names, List<SignIn> signInList, List<ReportErrorResponseVo> responses) { | ||
| 95 | + signInList.forEach(item -> { | ||
| 96 | + ReportErrorResponseVo vo = new ReportErrorResponseVo(); | ||
| 97 | + vo.setName(names.get(item.getJobCode())); | ||
| 98 | + vo.setImage(item.getImage()); | ||
| 99 | + vo.setRemark(item.getRemark()); | ||
| 100 | + vo.setCreateTime(item.getCreateTime()); | ||
| 101 | + vo.setJobCode(item.getJobCode()); | ||
| 102 | +// vo.setDeviceId(); | ||
| 103 | + vo.setErrorType(SIGN_IN_ERROR); | ||
| 104 | + responses.add(vo); | ||
| 105 | + }); | ||
| 106 | + } | ||
| 107 | +} |
ruoyi-admin/src/main/resources/mapper/driver/DriverMapper.xml
| @@ -88,6 +88,17 @@ | @@ -88,6 +88,17 @@ | ||
| 88 | from driver_scheduling | 88 | from driver_scheduling |
| 89 | where scheduleDate = #{date} and job_code = #{jobCode} | 89 | where scheduleDate = #{date} and job_code = #{jobCode} |
| 90 | </select> | 90 | </select> |
| 91 | + <select id="getNameByJobCode" resultMap="DriverResult"> | ||
| 92 | + select personnel_name,job_code | ||
| 93 | + from driver | ||
| 94 | + <where> | ||
| 95 | + job_code IN | ||
| 96 | + <foreach collection="jobCodes" item="item" open="(" separator="," close=")" > | ||
| 97 | + #{item} | ||
| 98 | + </foreach> | ||
| 99 | + | ||
| 100 | + </where> | ||
| 101 | + </select> | ||
| 91 | 102 | ||
| 92 | <insert id="insertDriver" parameterType="Driver" useGeneratedKeys="true" keyProperty="id"> | 103 | <insert id="insertDriver" parameterType="Driver" useGeneratedKeys="true" keyProperty="id"> |
| 93 | insert into driver | 104 | insert into driver |
| @@ -236,7 +247,7 @@ | @@ -236,7 +247,7 @@ | ||
| 236 | ) | 247 | ) |
| 237 | </foreach> | 248 | </foreach> |
| 238 | on duplicate key update | 249 | on duplicate key update |
| 239 | - personnel_name = values(personnel_name) | 250 | + job_code = values(job_code) |
| 240 | </insert> | 251 | </insert> |
| 241 | 252 | ||
| 242 | </mapper> | 253 | </mapper> |
| 243 | \ No newline at end of file | 254 | \ No newline at end of file |
ruoyi-admin/src/main/resources/mapper/eexception/EquipmentExceptionMapper.xml
| @@ -35,7 +35,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -35,7 +35,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 35 | <include refid="selectEquipmentExceptionVo"/> | 35 | <include refid="selectEquipmentExceptionVo"/> |
| 36 | where id = #{id} | 36 | where id = #{id} |
| 37 | </select> | 37 | </select> |
| 38 | - | 38 | + <select id="getEquipmentErrorList" resultType="com.ruoyi.eexception.domain.EquipmentException"> |
| 39 | + <include refid="selectEquipmentExceptionVo"></include> | ||
| 40 | + where 1=1 | ||
| 41 | + <if test="endTime != '' and endTime != null"> | ||
| 42 | + and DATE_FORMAT(create_time,'%Y-%m-%d') >= #{startTime} | ||
| 43 | + and DATE_FORMAT(create_time,'%Y-%m-%d') <= #{endTime} | ||
| 44 | + </if> | ||
| 45 | + </select> | ||
| 46 | + | ||
| 39 | <insert id="insertEquipmentException" parameterType="EquipmentException" useGeneratedKeys="true" keyProperty="id"> | 47 | <insert id="insertEquipmentException" parameterType="EquipmentException" useGeneratedKeys="true" keyProperty="id"> |
| 40 | insert into equipment_exception | 48 | insert into equipment_exception |
| 41 | <trim prefix="(" suffix=")" suffixOverrides=","> | 49 | <trim prefix="(" suffix=")" suffixOverrides=","> |
ruoyi-admin/src/main/resources/mapper/equipment/EquipmentMapper.xml
| @@ -42,7 +42,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -42,7 +42,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 42 | <include refid="selectEquipmentVo"/> | 42 | <include refid="selectEquipmentVo"/> |
| 43 | where id = #{id} | 43 | where id = #{id} |
| 44 | </select> | 44 | </select> |
| 45 | - | 45 | + |
| 46 | + | ||
| 46 | <insert id="insertEquipment" parameterType="Equipment" useGeneratedKeys="true" keyProperty="id"> | 47 | <insert id="insertEquipment" parameterType="Equipment" useGeneratedKeys="true" keyProperty="id"> |
| 47 | insert into equipment | 48 | insert into equipment |
| 48 | <trim prefix="(" suffix=")" suffixOverrides=","> | 49 | <trim prefix="(" suffix=")" suffixOverrides=","> |
ruoyi-admin/src/main/resources/mapper/in/SignInMapper.xml
| @@ -43,6 +43,48 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -43,6 +43,48 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 43 | <include refid="selectSignInVo"/> | 43 | <include refid="selectSignInVo"/> |
| 44 | where id = #{id} | 44 | where id = #{id} |
| 45 | </select> | 45 | </select> |
| 46 | + <select id="getReportScrollViewTable" resultType="com.ruoyi.pojo.response.ReportViewResponseVo"> | ||
| 47 | + SELECT | ||
| 48 | + sign_in.id, | ||
| 49 | + sign_in.singn_in singnIn, | ||
| 50 | + driver.job_code jobCode, | ||
| 51 | + personnel_name `name`, | ||
| 52 | + sign_in.create_time createTime, | ||
| 53 | + `status`, | ||
| 54 | + type, | ||
| 55 | + alcohol_flag alcoholFlag, | ||
| 56 | + alcohol_intake alcoholIntake, | ||
| 57 | + sign_in.image, | ||
| 58 | + sign_in.remark | ||
| 59 | + FROM | ||
| 60 | + sign_in, | ||
| 61 | + driver | ||
| 62 | + WHERE | ||
| 63 | + sign_in.jobCode = driver.job_code | ||
| 64 | + <if test="jobCode != '' and jobCode != null"> | ||
| 65 | + and sign_in.jobCode = #{jobCode} | ||
| 66 | + </if> | ||
| 67 | + <if test="startTime != '' and startTime != null"> | ||
| 68 | + and DATE_FORMAT(sign_in.create_time,'%Y-%m-%d') >= #{startTime} | ||
| 69 | + and DATE_FORMAT(sign_in.create_time,'%Y-%m-%d') <= #{endTime} | ||
| 70 | + </if> | ||
| 71 | + <if test="status != '' and status != null"> | ||
| 72 | + and sign_in.status = #{status} | ||
| 73 | + </if> | ||
| 74 | + <if test="name != '' and name != null"> | ||
| 75 | + and driver.personnel_name = #{name} | ||
| 76 | + </if> | ||
| 77 | + order by sign_in.create_time desc | ||
| 78 | + </select> | ||
| 79 | + <select id="getSignErrorList" resultType="com.ruoyi.in.domain.SignIn"> | ||
| 80 | + <include refid="selectSignInVo"></include> | ||
| 81 | + where `status` = 2 | ||
| 82 | + <if test="endTime != '' and endTime != null"> | ||
| 83 | + and DATE_FORMAT(create_time,'%Y-%m-%d') >= #{startTime} | ||
| 84 | + and DATE_FORMAT(create_time,'%Y-%m-%d') <= #{endTime} | ||
| 85 | + </if> | ||
| 86 | + | ||
| 87 | + </select> | ||
| 46 | 88 | ||
| 47 | <insert id="insertSignIn" parameterType="SignIn" useGeneratedKeys="true" keyProperty="id"> | 89 | <insert id="insertSignIn" parameterType="SignIn" useGeneratedKeys="true" keyProperty="id"> |
| 48 | insert into sign_in | 90 | insert into sign_in |
ruoyi-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("/driver/**","/in/**","/eexception/**","/equipment/**","/login", "/register", "/captchaImage").permitAll() | 114 | + .antMatchers("/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() |