Commit 8f878e38d8199c9cc1b238d2a580a0c285058675

Authored by guzijian
1 parent 2770af39

fix: 修改部分逻辑,追加设备号字段

ruoyi-admin/src/main/java/com/ruoyi/common/SignInEnum.java
@@ -19,7 +19,7 @@ public interface SignInEnum { @@ -19,7 +19,7 @@ public interface SignInEnum {
19 19
20 String SIGN_IN_SUCCESS_STRING = "签到成功"; 20 String SIGN_IN_SUCCESS_STRING = "签到成功";
21 Integer SIGN_IN_SUCCESS = 1; 21 Integer SIGN_IN_SUCCESS = 1;
22 - String SIGN_IN_FAIL_STRING = "签到失败"; 22 + String SIGN_IN_FAIL_STRING = "签到异常";
23 Integer SIGN_IN_FAIL = 2; 23 Integer SIGN_IN_FAIL = 2;
24 24
25 Integer ALCOHOL_FLAG_YES = 1; 25 Integer ALCOHOL_FLAG_YES = 1;
@@ -28,5 +28,4 @@ public interface SignInEnum { @@ -28,5 +28,4 @@ public interface SignInEnum {
28 String ALCOHOL_FLAG_NO_STRING = "未测试"; 28 String ALCOHOL_FLAG_NO_STRING = "未测试";
29 29
30 30
31 -  
32 } 31 }
ruoyi-admin/src/main/java/com/ruoyi/controller/ReportController.java
@@ -41,17 +41,17 @@ public class ReportController { @@ -41,17 +41,17 @@ public class ReportController {
41 41
42 @ApiOperation("签到报表导出") 42 @ApiOperation("签到报表导出")
43 @PostMapping("/export") 43 @PostMapping("/export")
44 - public void exportReport(@ApiParam ReportViewRequestVo requestVo, HttpServletResponse response){ 44 + public void exportReport(@ApiParam ReportViewRequestVo requestVo, HttpServletResponse response) {
45 List<ReportViewResponseVo> list = reportService.getReportScrollViewTable(requestVo); 45 List<ReportViewResponseVo> list = reportService.getReportScrollViewTable(requestVo);
46 ExcelUtil<ReportViewResponseVo> util = new ExcelUtil<ReportViewResponseVo>(ReportViewResponseVo.class); 46 ExcelUtil<ReportViewResponseVo> util = new ExcelUtil<ReportViewResponseVo>(ReportViewResponseVo.class);
47 - util.exportEasyExcel(response, list, "操作日志"); 47 + util.exportEasyExcel(response, list, "签到报表");
48 } 48 }
49 49
50 @ApiOperation("异常报表导出") 50 @ApiOperation("异常报表导出")
51 @PostMapping("/error/export") 51 @PostMapping("/error/export")
52 - public void exportErrorReport(@ApiParam ReportErrorRequestVo requestVo,HttpServletResponse response){ 52 + public void exportErrorReport(@ApiParam ReportErrorRequestVo requestVo, HttpServletResponse response) {
53 List<ReportErrorResponseVo> list = reportService.getErrorReportList(requestVo); 53 List<ReportErrorResponseVo> list = reportService.getErrorReportList(requestVo);
54 ExcelUtil<ReportErrorResponseVo> util = new ExcelUtil<ReportErrorResponseVo>(ReportErrorResponseVo.class); 54 ExcelUtil<ReportErrorResponseVo> util = new ExcelUtil<ReportErrorResponseVo>(ReportErrorResponseVo.class);
55 - util.exportEasyExcel(response, list, "操作日志"); 55 + util.exportEasyExcel(response, list, "异常报表");
56 } 56 }
57 } 57 }
ruoyi-admin/src/main/java/com/ruoyi/driver/controller/DriverController.java
@@ -9,14 +9,7 @@ import io.swagger.annotations.ApiOperation; @@ -9,14 +9,7 @@ import io.swagger.annotations.ApiOperation;
9 import io.swagger.annotations.ApiParam; 9 import io.swagger.annotations.ApiParam;
10 import org.springframework.security.access.prepost.PreAuthorize; 10 import org.springframework.security.access.prepost.PreAuthorize;
11 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
12 -import org.springframework.web.bind.annotation.GetMapping;  
13 -import org.springframework.web.bind.annotation.PostMapping;  
14 -import org.springframework.web.bind.annotation.PutMapping;  
15 -import org.springframework.web.bind.annotation.DeleteMapping;  
16 -import org.springframework.web.bind.annotation.PathVariable;  
17 -import org.springframework.web.bind.annotation.RequestBody;  
18 -import org.springframework.web.bind.annotation.RequestMapping;  
19 -import org.springframework.web.bind.annotation.RestController; 12 +import org.springframework.web.bind.annotation.*;
20 import com.ruoyi.common.annotation.Log; 13 import com.ruoyi.common.annotation.Log;
21 import com.ruoyi.common.core.controller.BaseController; 14 import com.ruoyi.common.core.controller.BaseController;
22 import com.ruoyi.common.core.domain.AjaxResult; 15 import com.ruoyi.common.core.domain.AjaxResult;
@@ -44,8 +37,8 @@ public class DriverController extends BaseController { @@ -44,8 +37,8 @@ public class DriverController extends BaseController {
44 */ 37 */
45 @GetMapping("/{schedulingDate}/{jobCode}") 38 @GetMapping("/{schedulingDate}/{jobCode}")
46 @ApiOperation("获取驾驶员排班信息") 39 @ApiOperation("获取驾驶员排班信息")
47 - public AjaxResult getDriverSchedulingInfo(@ApiParam(name = "date",value = "yyyyMMdd",type = "String") @PathVariable("schedulingDate") String schedulingDate, @PathVariable("jobCode") String jobCode) {  
48 - return driverService.getDriverSchedulingInfo(schedulingDate,jobCode); 40 + public AjaxResult getDriverSchedulingInfo(@ApiParam(name = "date", value = "yyyyMMdd", type = "String") @PathVariable("schedulingDate") String schedulingDate, @PathVariable("jobCode") String jobCode) {
  41 + return driverService.getDriverSchedulingInfo(schedulingDate, jobCode);
49 } 42 }
50 43
51 /** 44 /**
@@ -53,7 +46,7 @@ public class DriverController extends BaseController { @@ -53,7 +46,7 @@ public class DriverController extends BaseController {
53 */ 46 */
54 @GetMapping("/getDriverSchedulingAll") 47 @GetMapping("/getDriverSchedulingAll")
55 @ApiOperation("获取当前所有有班次信息的工号集合") 48 @ApiOperation("获取当前所有有班次信息的工号集合")
56 - public AjaxResult getDriverSchedulingAll(){ 49 + public AjaxResult getDriverSchedulingAll() {
57 return driverService.getDriverSchedulingAll(); 50 return driverService.getDriverSchedulingAll();
58 } 51 }
59 52
@@ -128,14 +121,16 @@ public class DriverController extends BaseController { @@ -128,14 +121,16 @@ public class DriverController extends BaseController {
128 121
129 /** 122 /**
130 * 校验工号 123 * 校验工号
  124 + *
131 * @param jobCode 125 * @param jobCode
132 * @return 126 * @return
133 */ 127 */
134 - @GetMapping("/check/{jobCode}")  
135 - @ApiOperation("校验jobCode是否存入当前系统")  
136 - public AjaxResult checkJobCode(@PathVariable("jobCode") String jobCode){  
137 - return driverService.checkJobCode(jobCode); 128 + @GetMapping("/check")
  129 + @ApiOperation("人事校验,是否为公司员工")
  130 + public AjaxResult checkJobCode(@ApiParam @ModelAttribute Driver driver) {
  131 + return driverService.checkJobCode(driver);
138 } 132 }
139 133
  134 +
140 // @ApiOperation("保存员工大头像") 135 // @ApiOperation("保存员工大头像")
141 } 136 }
ruoyi-admin/src/main/java/com/ruoyi/driver/domain/Driver.java
1 package com.ruoyi.driver.domain; 1 package com.ruoyi.driver.domain;
2 2
3 import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 3 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  4 +import io.swagger.annotations.ApiModel;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import lombok.Data;
4 import org.apache.commons.lang3.builder.ToStringBuilder; 7 import org.apache.commons.lang3.builder.ToStringBuilder;
5 import org.apache.commons.lang3.builder.ToStringStyle; 8 import org.apache.commons.lang3.builder.ToStringStyle;
6 import com.ruoyi.common.annotation.Excel; 9 import com.ruoyi.common.annotation.Excel;
@@ -8,257 +11,127 @@ import com.ruoyi.common.core.domain.BaseEntity; @@ -8,257 +11,127 @@ import com.ruoyi.common.core.domain.BaseEntity;
8 11
9 /** 12 /**
10 * 驾驶员信息对象 driver 13 * 驾驶员信息对象 driver
11 - * 14 + *
12 * @author 古自健 15 * @author 古自健
13 * @date 2023-07-04 16 * @date 2023-07-04
14 */ 17 */
15 -public class Driver extends BaseEntity  
16 -{ 18 +@Data
  19 +@ApiModel("驾驶员信息对象")
  20 +public class Driver extends BaseEntity {
17 private static final long serialVersionUID = 1L; 21 private static final long serialVersionUID = 1L;
18 22
19 - /** 主键 */ 23 + /**
  24 + * 主键
  25 + */
20 private Long id; 26 private Long id;
21 27
22 - /** 工号 */ 28 + /**
  29 + * 工号
  30 + */
23 @Excel(name = "工号") 31 @Excel(name = "工号")
24 @JsonIgnoreProperties(ignoreUnknown = true) 32 @JsonIgnoreProperties(ignoreUnknown = true)
25 private String jobCode; 33 private String jobCode;
26 34
27 - /** 公司编码 */ 35 + /**
  36 + * 公司编码
  37 + */
28 @Excel(name = "公司编码") 38 @Excel(name = "公司编码")
29 @JsonIgnoreProperties(ignoreUnknown = true) 39 @JsonIgnoreProperties(ignoreUnknown = true)
30 private String companyCode; 40 private String companyCode;
31 41
32 - /** 分公司编码 */ 42 + /**
  43 + * 分公司编码
  44 + */
33 @Excel(name = "分公司编码") 45 @Excel(name = "分公司编码")
34 @JsonIgnoreProperties(ignoreUnknown = true) 46 @JsonIgnoreProperties(ignoreUnknown = true)
35 private String brancheCompanyCode; 47 private String brancheCompanyCode;
36 48
37 - /** 姓名 */ 49 + /**
  50 + * 姓名
  51 + */
38 @Excel(name = "姓名") 52 @Excel(name = "姓名")
39 @JsonIgnoreProperties(ignoreUnknown = true) 53 @JsonIgnoreProperties(ignoreUnknown = true)
40 private String personnelName; 54 private String personnelName;
41 55
42 - /** 运营服务证书号 */ 56 + /**
  57 + * 运营服务证书号
  58 + */
43 @Excel(name = "运营服务证书号") 59 @Excel(name = "运营服务证书号")
44 @JsonIgnoreProperties(ignoreUnknown = true) 60 @JsonIgnoreProperties(ignoreUnknown = true)
45 private String papersCode; 61 private String papersCode;
46 62
47 - /** 一卡通工作卡号 */ 63 + /**
  64 + * 一卡通工作卡号
  65 + */
48 @Excel(name = "一卡通工作卡号") 66 @Excel(name = "一卡通工作卡号")
49 @JsonIgnoreProperties(ignoreUnknown = true) 67 @JsonIgnoreProperties(ignoreUnknown = true)
50 private String icCardCode; 68 private String icCardCode;
51 69
52 - /** 性别 */ 70 + /**
  71 + * 性别
  72 + */
53 @Excel(name = "性别") 73 @Excel(name = "性别")
54 @JsonIgnoreProperties(ignoreUnknown = true) 74 @JsonIgnoreProperties(ignoreUnknown = true)
55 private String personnelType; 75 private String personnelType;
56 76
57 - /** 所属岗位/工种 */ 77 + /**
  78 + * 所属岗位/工种
  79 + */
58 @Excel(name = "所属岗位/工种") 80 @Excel(name = "所属岗位/工种")
59 @JsonIgnoreProperties(ignoreUnknown = true) 81 @JsonIgnoreProperties(ignoreUnknown = true)
60 private String posts; 82 private String posts;
61 83
62 - /** 身份证 */ 84 + /**
  85 + * 身份证
  86 + */
63 @Excel(name = "身份证") 87 @Excel(name = "身份证")
64 @JsonIgnoreProperties(ignoreUnknown = true) 88 @JsonIgnoreProperties(ignoreUnknown = true)
65 private String card; 89 private String card;
66 90
67 - /** 联系电话 */ 91 + /**
  92 + * 联系电话
  93 + */
68 @Excel(name = "联系电话") 94 @Excel(name = "联系电话")
69 @JsonIgnoreProperties(ignoreUnknown = true) 95 @JsonIgnoreProperties(ignoreUnknown = true)
70 private String telphone; 96 private String telphone;
71 97
72 - /** RFID 人卡IC号 */ 98 + /**
  99 + * RFID 人卡IC号
  100 + */
73 @Excel(name = "RFID 人卡IC号") 101 @Excel(name = "RFID 人卡IC号")
74 @JsonIgnoreProperties(ignoreUnknown = true) 102 @JsonIgnoreProperties(ignoreUnknown = true)
75 private String icRfid; 103 private String icRfid;
76 104
77 - /** RFID 人卡ID号(10进制) */ 105 + /**
  106 + * RFID 人卡ID号(10进制)
  107 + */
78 @Excel(name = "RFID 人卡ID号", readConverterExp = "1=0进制") 108 @Excel(name = "RFID 人卡ID号", readConverterExp = "1=0进制")
79 @JsonIgnoreProperties(ignoreUnknown = true) 109 @JsonIgnoreProperties(ignoreUnknown = true)
80 private String idRfid; 110 private String idRfid;
81 111
82 - /** RFID 标签号 */ 112 + /**
  113 + * RFID 标签号
  114 + */
83 @Excel(name = "RFID 标签号") 115 @Excel(name = "RFID 标签号")
84 @JsonIgnoreProperties(ignoreUnknown = true) 116 @JsonIgnoreProperties(ignoreUnknown = true)
85 private String tagRfid; 117 private String tagRfid;
86 118
87 - /** 线路名称 */ 119 + /**
  120 + * 线路名称
  121 + */
88 @Excel(name = "线路名称") 122 @Excel(name = "线路名称")
89 @JsonIgnoreProperties(ignoreUnknown = true) 123 @JsonIgnoreProperties(ignoreUnknown = true)
90 private String lineName; 124 private String lineName;
91 125
92 - /** 线路编码 */ 126 + /**
  127 + * 线路编码
  128 + */
93 @Excel(name = "线路编码") 129 @Excel(name = "线路编码")
94 @JsonIgnoreProperties(ignoreUnknown = true) 130 @JsonIgnoreProperties(ignoreUnknown = true)
95 private String lineCode; 131 private String lineCode;
96 132
97 - public void setId(Long id)  
98 - {  
99 - this.id = id;  
100 - } 133 + @Excel(name = "人脸注册")
  134 + @ApiModelProperty("是否人脸注册 1 注册 2 未注册")
  135 + private Integer signIn;
101 136
102 - public Long getId()  
103 - {  
104 - return id;  
105 - }  
106 - public void setJobCode(String jobCode)  
107 - {  
108 - this.jobCode = jobCode;  
109 - }  
110 -  
111 - public String getJobCode()  
112 - {  
113 - return jobCode;  
114 - }  
115 - public void setCompanyCode(String companyCode)  
116 - {  
117 - this.companyCode = companyCode;  
118 - }  
119 -  
120 - public String getCompanyCode()  
121 - {  
122 - return companyCode;  
123 - }  
124 - public void setBrancheCompanyCode(String brancheCompanyCode)  
125 - {  
126 - this.brancheCompanyCode = brancheCompanyCode;  
127 - }  
128 -  
129 - public String getBrancheCompanyCode()  
130 - {  
131 - return brancheCompanyCode;  
132 - }  
133 - public void setPersonnelName(String personnelName)  
134 - {  
135 - this.personnelName = personnelName;  
136 - }  
137 -  
138 - public String getPersonnelName()  
139 - {  
140 - return personnelName;  
141 - }  
142 - public void setPapersCode(String papersCode)  
143 - {  
144 - this.papersCode = papersCode;  
145 - }  
146 -  
147 - public String getPapersCode()  
148 - {  
149 - return papersCode;  
150 - }  
151 - public void setIcCardCode(String icCardCode)  
152 - {  
153 - this.icCardCode = icCardCode;  
154 - }  
155 -  
156 - public String getIcCardCode()  
157 - {  
158 - return icCardCode;  
159 - }  
160 - public void setPersonnelType(String personnelType)  
161 - {  
162 - this.personnelType = personnelType;  
163 - }  
164 -  
165 - public String getPersonnelType()  
166 - {  
167 - return personnelType;  
168 - }  
169 - public void setPosts(String posts)  
170 - {  
171 - this.posts = posts;  
172 - }  
173 -  
174 - public String getPosts()  
175 - {  
176 - return posts;  
177 - }  
178 - public void setCard(String card)  
179 - {  
180 - this.card = card;  
181 - }  
182 -  
183 - public String getCard()  
184 - {  
185 - return card;  
186 - }  
187 - public void setTelphone(String telphone)  
188 - {  
189 - this.telphone = telphone;  
190 - }  
191 -  
192 - public String getTelphone()  
193 - {  
194 - return telphone;  
195 - }  
196 - public void setIcRfid(String icRfid)  
197 - {  
198 - this.icRfid = icRfid;  
199 - }  
200 -  
201 - public String getIcRfid()  
202 - {  
203 - return icRfid;  
204 - }  
205 - public void setIdRfid(String idRfid)  
206 - {  
207 - this.idRfid = idRfid;  
208 - }  
209 -  
210 - public String getIdRfid()  
211 - {  
212 - return idRfid;  
213 - }  
214 - public void setTagRfid(String tagRfid)  
215 - {  
216 - this.tagRfid = tagRfid;  
217 - }  
218 -  
219 - public String getTagRfid()  
220 - {  
221 - return tagRfid;  
222 - }  
223 - public void setLineName(String lineName)  
224 - {  
225 - this.lineName = lineName;  
226 - }  
227 -  
228 - public String getLineName()  
229 - {  
230 - return lineName;  
231 - }  
232 - public void setLineCode(String lineCode)  
233 - {  
234 - this.lineCode = lineCode;  
235 - }  
236 -  
237 - public String getLineCode()  
238 - {  
239 - return lineCode;  
240 - }  
241 -  
242 - @Override  
243 - public String toString() {  
244 - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)  
245 - .append("id", getId())  
246 - .append("jobCode", getJobCode())  
247 - .append("companyCode", getCompanyCode())  
248 - .append("brancheCompanyCode", getBrancheCompanyCode())  
249 - .append("personnelName", getPersonnelName())  
250 - .append("papersCode", getPapersCode())  
251 - .append("icCardCode", getIcCardCode())  
252 - .append("personnelType", getPersonnelType())  
253 - .append("posts", getPosts())  
254 - .append("card", getCard())  
255 - .append("telphone", getTelphone())  
256 - .append("icRfid", getIcRfid())  
257 - .append("idRfid", getIdRfid())  
258 - .append("tagRfid", getTagRfid())  
259 - .append("remark", getRemark())  
260 - .append("lineName", getLineName())  
261 - .append("lineCode", getLineCode())  
262 - .toString();  
263 - }  
264 } 137 }
ruoyi-admin/src/main/java/com/ruoyi/driver/service/IDriverService.java
@@ -75,5 +75,5 @@ public interface IDriverService @@ -75,5 +75,5 @@ public interface IDriverService
75 75
76 AjaxResult getDriverSchedulingAll(); 76 AjaxResult getDriverSchedulingAll();
77 77
78 - AjaxResult checkJobCode(String jobCode); 78 + AjaxResult checkJobCode(Driver jobCode);
79 } 79 }
ruoyi-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
@@ -133,8 +133,8 @@ public class DriverServiceImpl implements IDriverService { @@ -133,8 +133,8 @@ public class DriverServiceImpl implements IDriverService {
133 } 133 }
134 134
135 @Override 135 @Override
136 - public AjaxResult checkJobCode(String jobCode) {  
137 - Integer result = driverMapper.jobCodeIsEmpty(jobCode); 136 + public AjaxResult checkJobCode(Driver driver) {
  137 + Integer result = driverMapper.jobCodeIsEmpty(driver.getJobCode());
138 Map<String, Boolean> resultMap = new HashMap<>(); 138 Map<String, Boolean> resultMap = new HashMap<>();
139 if (result > 0) { 139 if (result > 0) {
140 resultMap.put("result", true); 140 resultMap.put("result", true);
ruoyi-admin/src/main/java/com/ruoyi/eexception/service/impl/EquipmentExceptionServiceImpl.java
@@ -3,6 +3,7 @@ package com.ruoyi.eexception.service.impl; @@ -3,6 +3,7 @@ package com.ruoyi.eexception.service.impl;
3 import java.util.List; 3 import java.util.List;
4 import com.ruoyi.common.utils.DateUtils; 4 import com.ruoyi.common.utils.DateUtils;
5 import com.ruoyi.common.utils.SecurityUtils; 5 import com.ruoyi.common.utils.SecurityUtils;
  6 +import com.ruoyi.common.utils.StringUtils;
6 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.stereotype.Service; 8 import org.springframework.stereotype.Service;
8 import com.ruoyi.eexception.mapper.EquipmentExceptionMapper; 9 import com.ruoyi.eexception.mapper.EquipmentExceptionMapper;
@@ -55,6 +56,9 @@ public class EquipmentExceptionServiceImpl implements IEquipmentExceptionService @@ -55,6 +56,9 @@ public class EquipmentExceptionServiceImpl implements IEquipmentExceptionService
55 public int insertEquipmentException(EquipmentException equipmentException) 56 public int insertEquipmentException(EquipmentException equipmentException)
56 { 57 {
57 equipmentException.setCreateTime(DateUtils.getNowDate()); 58 equipmentException.setCreateTime(DateUtils.getNowDate());
  59 + if (!StringUtils.isNotEmpty(equipmentException.getDeviceId())){
  60 + throw new RuntimeException("设备号不能为空");
  61 + }
58 return equipmentExceptionMapper.insertEquipmentException(equipmentException); 62 return equipmentExceptionMapper.insertEquipmentException(equipmentException);
59 } 63 }
60 64
ruoyi-admin/src/main/java/com/ruoyi/equipment/controller/EquipmentController.java
@@ -2,6 +2,7 @@ package com.ruoyi.equipment.controller; @@ -2,6 +2,7 @@ package com.ruoyi.equipment.controller;
2 2
3 import java.util.List; 3 import java.util.List;
4 import javax.servlet.http.HttpServletResponse; 4 import javax.servlet.http.HttpServletResponse;
  5 +
5 import org.springframework.security.access.prepost.PreAuthorize; 6 import org.springframework.security.access.prepost.PreAuthorize;
6 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.web.bind.annotation.GetMapping; 8 import org.springframework.web.bind.annotation.GetMapping;
@@ -23,14 +24,13 @@ import com.ruoyi.common.core.page.TableDataInfo; @@ -23,14 +24,13 @@ import com.ruoyi.common.core.page.TableDataInfo;
23 24
24 /** 25 /**
25 * 设备信息Controller 26 * 设备信息Controller
26 - * 27 + *
27 * @author guzijian 28 * @author guzijian
28 * @date 2023-07-05 29 * @date 2023-07-05
29 */ 30 */
30 @RestController 31 @RestController
31 @RequestMapping("/equipment/equipment") 32 @RequestMapping("/equipment/equipment")
32 -public class EquipmentController extends BaseController  
33 -{ 33 +public class EquipmentController extends BaseController {
34 @Autowired 34 @Autowired
35 private IEquipmentService equipmentService; 35 private IEquipmentService equipmentService;
36 36
@@ -39,8 +39,7 @@ public class EquipmentController extends BaseController @@ -39,8 +39,7 @@ public class EquipmentController extends BaseController
39 */ 39 */
40 // @PreAuthorize("@ss.hasPermi('equipment:equipment:list')") 40 // @PreAuthorize("@ss.hasPermi('equipment:equipment:list')")
41 @GetMapping("/list") 41 @GetMapping("/list")
42 - public TableDataInfo list(Equipment equipment)  
43 - { 42 + public TableDataInfo list(Equipment equipment) {
44 startPage(); 43 startPage();
45 List<Equipment> list = equipmentService.selectEquipmentList(equipment); 44 List<Equipment> list = equipmentService.selectEquipmentList(equipment);
46 return getDataTable(list); 45 return getDataTable(list);
@@ -52,8 +51,7 @@ public class EquipmentController extends BaseController @@ -52,8 +51,7 @@ public class EquipmentController extends BaseController
52 // @PreAuthorize("@ss.hasPermi('equipment:equipment:export')") 51 // @PreAuthorize("@ss.hasPermi('equipment:equipment:export')")
53 @Log(title = "设备信息", businessType = BusinessType.EXPORT) 52 @Log(title = "设备信息", businessType = BusinessType.EXPORT)
54 @PostMapping("/export") 53 @PostMapping("/export")
55 - public void export(HttpServletResponse response, Equipment equipment)  
56 - { 54 + public void export(HttpServletResponse response, Equipment equipment) {
57 List<Equipment> list = equipmentService.selectEquipmentList(equipment); 55 List<Equipment> list = equipmentService.selectEquipmentList(equipment);
58 ExcelUtil<Equipment> util = new ExcelUtil<Equipment>(Equipment.class); 56 ExcelUtil<Equipment> util = new ExcelUtil<Equipment>(Equipment.class);
59 util.exportExcel(response, list, "设备信息数据"); 57 util.exportExcel(response, list, "设备信息数据");
@@ -64,8 +62,7 @@ public class EquipmentController extends BaseController @@ -64,8 +62,7 @@ public class EquipmentController extends BaseController
64 */ 62 */
65 // @PreAuthorize("@ss.hasPermi('equipment:equipment:query')") 63 // @PreAuthorize("@ss.hasPermi('equipment:equipment:query')")
66 @GetMapping(value = "/{id}") 64 @GetMapping(value = "/{id}")
67 - public AjaxResult getInfo(@PathVariable("id") Long id)  
68 - { 65 + public AjaxResult getInfo(@PathVariable("id") Long id) {
69 return success(equipmentService.selectEquipmentById(id)); 66 return success(equipmentService.selectEquipmentById(id));
70 } 67 }
71 68
@@ -75,8 +72,7 @@ public class EquipmentController extends BaseController @@ -75,8 +72,7 @@ public class EquipmentController extends BaseController
75 // @PreAuthorize("@ss.hasPermi('equipment:equipment:add')") 72 // @PreAuthorize("@ss.hasPermi('equipment:equipment:add')")
76 @Log(title = "设备信息", businessType = BusinessType.INSERT) 73 @Log(title = "设备信息", businessType = BusinessType.INSERT)
77 @PostMapping 74 @PostMapping
78 - public AjaxResult add(@RequestBody Equipment equipment)  
79 - { 75 + public AjaxResult add(@RequestBody Equipment equipment) {
80 return toAjax(equipmentService.insertEquipment(equipment)); 76 return toAjax(equipmentService.insertEquipment(equipment));
81 } 77 }
82 78
@@ -86,8 +82,7 @@ public class EquipmentController extends BaseController @@ -86,8 +82,7 @@ public class EquipmentController extends BaseController
86 // @PreAuthorize("@ss.hasPermi('equipment:equipment:edit')") 82 // @PreAuthorize("@ss.hasPermi('equipment:equipment:edit')")
87 @Log(title = "设备信息", businessType = BusinessType.UPDATE) 83 @Log(title = "设备信息", businessType = BusinessType.UPDATE)
88 @PutMapping 84 @PutMapping
89 - public AjaxResult edit(@RequestBody Equipment equipment)  
90 - { 85 + public AjaxResult edit(@RequestBody Equipment equipment) {
91 return toAjax(equipmentService.updateEquipment(equipment)); 86 return toAjax(equipmentService.updateEquipment(equipment));
92 } 87 }
93 88
@@ -96,9 +91,8 @@ public class EquipmentController extends BaseController @@ -96,9 +91,8 @@ public class EquipmentController extends BaseController
96 */ 91 */
97 // @PreAuthorize("@ss.hasPermi('equipment:equipment:remove')") 92 // @PreAuthorize("@ss.hasPermi('equipment:equipment:remove')")
98 @Log(title = "设备信息", businessType = BusinessType.DELETE) 93 @Log(title = "设备信息", businessType = BusinessType.DELETE)
99 - @DeleteMapping("/{ids}")  
100 - public AjaxResult remove(@PathVariable Long[] ids)  
101 - { 94 + @DeleteMapping("/{ids}")
  95 + public AjaxResult remove(@PathVariable Long[] ids) {
102 return toAjax(equipmentService.deleteEquipmentByIds(ids)); 96 return toAjax(equipmentService.deleteEquipmentByIds(ids));
103 } 97 }
104 } 98 }
ruoyi-admin/src/main/java/com/ruoyi/equipment/service/impl/EquipmentServiceImpl.java
@@ -3,6 +3,7 @@ package com.ruoyi.equipment.service.impl; @@ -3,6 +3,7 @@ package com.ruoyi.equipment.service.impl;
3 import java.util.List; 3 import java.util.List;
4 import com.ruoyi.common.utils.DateUtils; 4 import com.ruoyi.common.utils.DateUtils;
5 import com.ruoyi.common.utils.SecurityUtils; 5 import com.ruoyi.common.utils.SecurityUtils;
  6 +import com.ruoyi.common.utils.StringUtils;
6 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.stereotype.Service; 8 import org.springframework.stereotype.Service;
8 import com.ruoyi.equipment.mapper.EquipmentMapper; 9 import com.ruoyi.equipment.mapper.EquipmentMapper;
@@ -55,7 +56,10 @@ public class EquipmentServiceImpl implements IEquipmentService @@ -55,7 +56,10 @@ public class EquipmentServiceImpl implements IEquipmentService
55 public int insertEquipment(Equipment equipment) 56 public int insertEquipment(Equipment equipment)
56 { 57 {
57 equipment.setCreateTime(DateUtils.getNowDate()); 58 equipment.setCreateTime(DateUtils.getNowDate());
58 - equipment.setCreateBy(SecurityUtils.getUsername()); 59 +// equipment.setCreateBy(SecurityUtils.getUsername());
  60 + if (!StringUtils.isNotEmpty(equipment.getDeviceId())){
  61 + throw new RuntimeException("设备号不能为空");
  62 + }
59 return equipmentMapper.insertEquipment(equipment); 63 return equipmentMapper.insertEquipment(equipment);
60 } 64 }
61 65
ruoyi-admin/src/main/java/com/ruoyi/in/controller/SignInController.java
@@ -100,7 +100,7 @@ public class SignInController extends BaseController @@ -100,7 +100,7 @@ public class SignInController extends BaseController
100 @PostMapping("/newAdd") 100 @PostMapping("/newAdd")
101 @ApiOperation("新增签到(设备传入)") 101 @ApiOperation("新增签到(设备传入)")
102 public AjaxResult addSignIn(@ApiParam @RequestBody SignIn signIn) throws FileUploadException, IOException { 102 public AjaxResult addSignIn(@ApiParam @RequestBody SignIn signIn) throws FileUploadException, IOException {
103 - return toAjax(signInService.addSignIn(signIn)); 103 + return signInService.addSignIn(signIn);
104 } 104 }
105 105
106 /** 106 /**
ruoyi-admin/src/main/java/com/ruoyi/in/service/ISignInService.java
@@ -3,6 +3,7 @@ package com.ruoyi.in.service; @@ -3,6 +3,7 @@ package com.ruoyi.in.service;
3 import java.io.IOException; 3 import java.io.IOException;
4 import java.util.List; 4 import java.util.List;
5 5
  6 +import com.ruoyi.common.core.domain.AjaxResult;
6 import com.ruoyi.common.exception.file.FileUploadException; 7 import com.ruoyi.common.exception.file.FileUploadException;
7 import com.ruoyi.in.domain.SignIn; 8 import com.ruoyi.in.domain.SignIn;
8 import com.ruoyi.pojo.request.ReportViewRequestVo; 9 import com.ruoyi.pojo.request.ReportViewRequestVo;
@@ -69,6 +70,6 @@ public interface ISignInService @@ -69,6 +70,6 @@ public interface ISignInService
69 * @param signIn 70 * @param signIn
70 * @return 71 * @return
71 */ 72 */
72 - int addSignIn(SignIn signIn) throws FileUploadException, IOException; 73 + AjaxResult addSignIn(SignIn signIn) throws FileUploadException, IOException;
73 74
74 } 75 }
ruoyi-admin/src/main/java/com/ruoyi/in/service/impl/SignInServiceImpl.java
@@ -3,6 +3,7 @@ package com.ruoyi.in.service.impl; @@ -3,6 +3,7 @@ package com.ruoyi.in.service.impl;
3 import java.io.File; 3 import java.io.File;
4 import java.io.FileOutputStream; 4 import java.io.FileOutputStream;
5 import java.io.IOException; 5 import java.io.IOException;
  6 +import java.math.BigDecimal;
6 import java.util.Base64; 7 import java.util.Base64;
7 import java.util.Date; 8 import java.util.Date;
8 import java.util.List; 9 import java.util.List;
@@ -10,6 +11,7 @@ import java.util.Objects; @@ -10,6 +11,7 @@ import java.util.Objects;
10 11
11 import com.ruoyi.common.config.RuoYiConfig; 12 import com.ruoyi.common.config.RuoYiConfig;
12 import com.ruoyi.common.constant.Constants; 13 import com.ruoyi.common.constant.Constants;
  14 +import com.ruoyi.common.core.domain.AjaxResult;
13 import com.ruoyi.common.exception.file.FileUploadException; 15 import com.ruoyi.common.exception.file.FileUploadException;
14 import com.ruoyi.common.utils.DateUtils; 16 import com.ruoyi.common.utils.DateUtils;
15 import com.ruoyi.common.SignInEnum; 17 import com.ruoyi.common.SignInEnum;
@@ -28,6 +30,8 @@ import sun.misc.BASE64Decoder; @@ -28,6 +30,8 @@ import sun.misc.BASE64Decoder;
28 30
29 import javax.annotation.Resource; 31 import javax.annotation.Resource;
30 32
  33 +import static com.ruoyi.common.SignInEnum.*;
  34 +
31 /** 35 /**
32 * 签到Service业务层处理 36 * 签到Service业务层处理
33 * 37 *
@@ -77,6 +81,10 @@ public class SignInServiceImpl implements ISignInService { @@ -77,6 +81,10 @@ public class SignInServiceImpl implements ISignInService {
77 if (signIn.getType() == null) { 81 if (signIn.getType() == null) {
78 signIn.setType(SignInEnum.SIGN_IN); 82 signIn.setType(SignInEnum.SIGN_IN);
79 } 83 }
  84 + if (ALCOHOL_FLAG_YES.equals(signIn.getAlcoholFlag())){
  85 + signIn.setStatus(signIn.getAlcoholIntake().compareTo(new BigDecimal(20)) < 0 ? SIGN_IN_SUCCESS : SIGN_IN_FAIL);
  86 + signIn.setRemark(signIn.getStatus().equals(SIGN_IN_FAIL)? "酒精测试不通过超标:" + signIn.getAlcoholIntake().floatValue() + "%" : "");
  87 + }
80 return signInMapper.insertSignIn(signIn); 88 return signInMapper.insertSignIn(signIn);
81 } 89 }
82 90
@@ -115,7 +123,14 @@ public class SignInServiceImpl implements ISignInService { @@ -115,7 +123,14 @@ public class SignInServiceImpl implements ISignInService {
115 } 123 }
116 124
117 @Override 125 @Override
118 - public int addSignIn(SignIn signIn) throws FileUploadException, IOException { 126 + public AjaxResult addSignIn(SignIn signIn) throws IOException {
  127 + if (!StringUtils.isNotEmpty(signIn.getDeviceId())){
  128 + throw new RuntimeException("设备号不能为空");
  129 + }
  130 + if (ALCOHOL_FLAG_YES.equals(signIn.getAlcoholFlag())){
  131 + signIn.setStatus(signIn.getAlcoholIntake().compareTo(new BigDecimal(20)) < 0 ? SIGN_IN_SUCCESS : SIGN_IN_FAIL);
  132 + signIn.setRemark(signIn.getStatus().equals(SIGN_IN_FAIL)? "酒精测试不通过超标:" + signIn.getAlcoholIntake().floatValue() + "%" : "");
  133 + }
119 // base64转图片 134 // base64转图片
120 signIn.setCreateTime(new Date()); 135 signIn.setCreateTime(new Date());
121 signIn.setIp(IpUtils.getIpAddr()); 136 signIn.setIp(IpUtils.getIpAddr());
@@ -135,7 +150,8 @@ public class SignInServiceImpl implements ISignInService { @@ -135,7 +150,8 @@ public class SignInServiceImpl implements ISignInService {
135 signIn.setImage(pathFileName); 150 signIn.setImage(pathFileName);
136 // 异步上传文件 151 // 异步上传文件
137 threadJobConfig.startUpload(absPath,base64); 152 threadJobConfig.startUpload(absPath,base64);
138 - return signInMapper.insertSignIn(signIn); 153 + signInMapper.insertSignIn(signIn);
  154 + return signIn.getStatus().equals(SIGN_IN_SUCCESS) ? AjaxResult.success("签到成功"): AjaxResult.error("签到失败酒精测试超标");
139 } 155 }
140 156
141 /** 157 /**
ruoyi-admin/src/main/java/com/ruoyi/pojo/request/ReportErrorRequestVo.java
@@ -11,6 +11,7 @@ import java.util.List; @@ -11,6 +11,7 @@ import java.util.List;
11 11
12 /** 12 /**
13 * 异常报表请求 13 * 异常报表请求
  14 + *
14 * @author 20412 15 * @author 20412
15 */ 16 */
16 @ApiModel("异常报表请求") 17 @ApiModel("异常报表请求")
ruoyi-admin/src/main/java/com/ruoyi/pojo/response/ReportViewResponseVo.java
1 package com.ruoyi.pojo.response; 1 package com.ruoyi.pojo.response;
2 2
  3 +import com.alibaba.excel.annotation.ExcelIgnore;
3 import com.alibaba.excel.annotation.ExcelProperty; 4 import com.alibaba.excel.annotation.ExcelProperty;
4 import com.fasterxml.jackson.annotation.JsonFormat; 5 import com.fasterxml.jackson.annotation.JsonFormat;
5 import com.ruoyi.pojo.converter.AlcoholFlagConverter; 6 import com.ruoyi.pojo.converter.AlcoholFlagConverter;
@@ -21,14 +22,15 @@ import java.util.Date; @@ -21,14 +22,15 @@ import java.util.Date;
21 @Data 22 @Data
22 public class ReportViewResponseVo { 23 public class ReportViewResponseVo {
23 @ApiModelProperty("id") 24 @ApiModelProperty("id")
  25 + @ExcelIgnore
24 private Long id; 26 private Long id;
25 27
26 @ExcelProperty(value = "工号") 28 @ExcelProperty(value = "工号")
27 @ApiModelProperty("工号") 29 @ApiModelProperty("工号")
28 private String jobCode; 30 private String jobCode;
29 31
30 - @ExcelProperty(value = "签到类型" ,converter = SignInTypeConverter.class)  
31 - @ApiModelProperty("签到类型" ) 32 + @ExcelProperty(value = "签到类型", converter = SignInTypeConverter.class)
  33 + @ApiModelProperty("签到类型")
32 private String singnIn; 34 private String singnIn;
33 35
34 @ExcelProperty(value = "姓名") 36 @ExcelProperty(value = "姓名")
@@ -41,20 +43,20 @@ public class ReportViewResponseVo { @@ -41,20 +43,20 @@ public class ReportViewResponseVo {
41 @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") 43 @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
42 private Date createTime; 44 private Date createTime;
43 45
44 - @ExcelProperty(value = "签到状态",converter = SignInStatusConverter.class) 46 + @ExcelProperty(value = "签到状态", converter = SignInStatusConverter.class)
45 @ApiModelProperty("签到状态1 成功2 异常") 47 @ApiModelProperty("签到状态1 成功2 异常")
46 private Integer status; 48 private Integer status;
47 /** 49 /**
48 * 签到签退 50 * 签到签退
49 */ 51 */
50 @ApiModelProperty("签到签退") 52 @ApiModelProperty("签到签退")
51 - @ExcelProperty(value = "签到签退",converter = SignInConvert.class) 53 + @ExcelProperty(value = "签到签退", converter = SignInConvert.class)
52 private Integer type; 54 private Integer type;
53 /** 55 /**
54 * 是否酒精检测 1 检查 2 未检 56 * 是否酒精检测 1 检查 2 未检
55 */ 57 */
56 @ApiModelProperty("是否酒精检测 1 检查 2 未检") 58 @ApiModelProperty("是否酒精检测 1 检查 2 未检")
57 - @ExcelProperty(value = "酒精检测",converter = AlcoholFlagConverter.class) 59 + @ExcelProperty(value = "酒精检测", converter = AlcoholFlagConverter.class)
58 private Integer alcoholFlag; 60 private Integer alcoholFlag;
59 /** 61 /**
60 * 酒精含量 62 * 酒精含量
ruoyi-admin/src/main/java/com/ruoyi/service/ReportService.java
@@ -58,9 +58,9 @@ public class ReportService { @@ -58,9 +58,9 @@ public class ReportService {
58 Map<String, String> names = driverMapper.getNameByJobCode(jobCodes).stream().collect(Collectors.toMap(Driver::getJobCode, Driver::getPersonnelName)); 58 Map<String, String> names = driverMapper.getNameByJobCode(jobCodes).stream().collect(Collectors.toMap(Driver::getJobCode, Driver::getPersonnelName));
59 if (SIGN_IN_ERROR.equals(request.getErrorType())) { 59 if (SIGN_IN_ERROR.equals(request.getErrorType())) {
60 copyToResponse(names, signInList, responses); 60 copyToResponse(names, signInList, responses);
61 - }else if (EQUIPMENT_ERROR.equals(request.getErrorType())) { 61 + } else if (EQUIPMENT_ERROR.equals(request.getErrorType())) {
62 copyToResponseByException(names, exceptionList, responses); 62 copyToResponseByException(names, exceptionList, responses);
63 - }else { 63 + } else {
64 copyToResponse(names, signInList, responses); 64 copyToResponse(names, signInList, responses);
65 copyToResponseByException(names, exceptionList, responses); 65 copyToResponseByException(names, exceptionList, responses);
66 } 66 }
ruoyi-admin/src/main/resources/mapper/driver/DriverMapper.xml
@@ -41,12 +41,13 @@ @@ -41,12 +41,13 @@
41 tag_rfid, 41 tag_rfid,
42 remark, 42 remark,
43 line_name, 43 line_name,
44 - line_code 44 + line_code,
  45 + sign_in
45 from driver 46 from driver
46 </sql> 47 </sql>
47 <sql id="insertDriverVo"> 48 <sql id="insertDriverVo">
48 job_code 49 job_code
49 - , company_code, branche_company_code, personnel_name, papers_code, ic_card_code, personnel_type, posts, card, telphone, ic_rfid, id_rfid, tag_rfid, remark, line_name, line_code 50 + , company_code, branche_company_code, personnel_name, papers_code, ic_card_code, personnel_type, posts, card, telphone, ic_rfid, id_rfid, tag_rfid, remark, line_name, line_code,sign_in
50 </sql> 51 </sql>
51 52
52 <select id="selectDriverList" parameterType="Driver" resultMap="DriverResult"> 53 <select id="selectDriverList" parameterType="Driver" resultMap="DriverResult">
@@ -166,6 +167,7 @@ @@ -166,6 +167,7 @@
166 <if test="remark != null">remark = #{remark},</if> 167 <if test="remark != null">remark = #{remark},</if>
167 <if test="lineName != null">line_name = #{lineName},</if> 168 <if test="lineName != null">line_name = #{lineName},</if>
168 <if test="lineCode != null">line_code = #{lineCode},</if> 169 <if test="lineCode != null">line_code = #{lineCode},</if>
  170 + <if test="signIn != null">sign_in = #{signIn}</if>
169 </trim> 171 </trim>
170 where id = #{id} 172 where id = #{id}
171 </update> 173 </update>
@@ -250,7 +252,8 @@ @@ -250,7 +252,8 @@
250 #{item.tagRfid,jdbcType=VARCHAR}, 252 #{item.tagRfid,jdbcType=VARCHAR},
251 #{item.remark,jdbcType=VARCHAR}, 253 #{item.remark,jdbcType=VARCHAR},
252 #{item.lineName,jdbcType=VARCHAR}, 254 #{item.lineName,jdbcType=VARCHAR},
253 - #{item.lineCode,jdbcType=VARCHAR} 255 + #{item.lineCode,jdbcType=VARCHAR},
  256 + #{item.signIn}
254 ) 257 )
255 </foreach> 258 </foreach>
256 on duplicate key update 259 on duplicate key update