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 19  
20 20 String SIGN_IN_SUCCESS_STRING = "签到成功";
21 21 Integer SIGN_IN_SUCCESS = 1;
22   - String SIGN_IN_FAIL_STRING = "签到失败";
  22 + String SIGN_IN_FAIL_STRING = "签到异常";
23 23 Integer SIGN_IN_FAIL = 2;
24 24  
25 25 Integer ALCOHOL_FLAG_YES = 1;
... ... @@ -28,5 +28,4 @@ public interface SignInEnum {
28 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 41  
42 42 @ApiOperation("签到报表导出")
43 43 @PostMapping("/export")
44   - public void exportReport(@ApiParam ReportViewRequestVo requestVo, HttpServletResponse response){
  44 + public void exportReport(@ApiParam ReportViewRequestVo requestVo, HttpServletResponse response) {
45 45 List<ReportViewResponseVo> list = reportService.getReportScrollViewTable(requestVo);
46 46 ExcelUtil<ReportViewResponseVo> util = new ExcelUtil<ReportViewResponseVo>(ReportViewResponseVo.class);
47   - util.exportEasyExcel(response, list, "操作日志");
  47 + util.exportEasyExcel(response, list, "签到报表");
48 48 }
49 49  
50 50 @ApiOperation("异常报表导出")
51 51 @PostMapping("/error/export")
52   - public void exportErrorReport(@ApiParam ReportErrorRequestVo requestVo,HttpServletResponse response){
  52 + public void exportErrorReport(@ApiParam ReportErrorRequestVo requestVo, HttpServletResponse response) {
53 53 List<ReportErrorResponseVo> list = reportService.getErrorReportList(requestVo);
54 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 9 import io.swagger.annotations.ApiParam;
10 10 import org.springframework.security.access.prepost.PreAuthorize;
11 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 13 import com.ruoyi.common.annotation.Log;
21 14 import com.ruoyi.common.core.controller.BaseController;
22 15 import com.ruoyi.common.core.domain.AjaxResult;
... ... @@ -44,8 +37,8 @@ public class DriverController extends BaseController {
44 37 */
45 38 @GetMapping("/{schedulingDate}/{jobCode}")
46 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 46 */
54 47 @GetMapping("/getDriverSchedulingAll")
55 48 @ApiOperation("获取当前所有有班次信息的工号集合")
56   - public AjaxResult getDriverSchedulingAll(){
  49 + public AjaxResult getDriverSchedulingAll() {
57 50 return driverService.getDriverSchedulingAll();
58 51 }
59 52  
... ... @@ -128,14 +121,16 @@ public class DriverController extends BaseController {
128 121  
129 122 /**
130 123 * 校验工号
  124 + *
131 125 * @param jobCode
132 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 135 // @ApiOperation("保存员工大头像")
141 136 }
... ...
ruoyi-admin/src/main/java/com/ruoyi/driver/domain/Driver.java
1 1 package com.ruoyi.driver.domain;
2 2  
3 3 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  4 +import io.swagger.annotations.ApiModel;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import lombok.Data;
4 7 import org.apache.commons.lang3.builder.ToStringBuilder;
5 8 import org.apache.commons.lang3.builder.ToStringStyle;
6 9 import com.ruoyi.common.annotation.Excel;
... ... @@ -8,257 +11,127 @@ import com.ruoyi.common.core.domain.BaseEntity;
8 11  
9 12 /**
10 13 * 驾驶员信息对象 driver
11   - *
  14 + *
12 15 * @author 古自健
13 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 21 private static final long serialVersionUID = 1L;
18 22  
19   - /** 主键 */
  23 + /**
  24 + * 主键
  25 + */
20 26 private Long id;
21 27  
22   - /** 工号 */
  28 + /**
  29 + * 工号
  30 + */
23 31 @Excel(name = "工号")
24 32 @JsonIgnoreProperties(ignoreUnknown = true)
25 33 private String jobCode;
26 34  
27   - /** 公司编码 */
  35 + /**
  36 + * 公司编码
  37 + */
28 38 @Excel(name = "公司编码")
29 39 @JsonIgnoreProperties(ignoreUnknown = true)
30 40 private String companyCode;
31 41  
32   - /** 分公司编码 */
  42 + /**
  43 + * 分公司编码
  44 + */
33 45 @Excel(name = "分公司编码")
34 46 @JsonIgnoreProperties(ignoreUnknown = true)
35 47 private String brancheCompanyCode;
36 48  
37   - /** 姓名 */
  49 + /**
  50 + * 姓名
  51 + */
38 52 @Excel(name = "姓名")
39 53 @JsonIgnoreProperties(ignoreUnknown = true)
40 54 private String personnelName;
41 55  
42   - /** 运营服务证书号 */
  56 + /**
  57 + * 运营服务证书号
  58 + */
43 59 @Excel(name = "运营服务证书号")
44 60 @JsonIgnoreProperties(ignoreUnknown = true)
45 61 private String papersCode;
46 62  
47   - /** 一卡通工作卡号 */
  63 + /**
  64 + * 一卡通工作卡号
  65 + */
48 66 @Excel(name = "一卡通工作卡号")
49 67 @JsonIgnoreProperties(ignoreUnknown = true)
50 68 private String icCardCode;
51 69  
52   - /** 性别 */
  70 + /**
  71 + * 性别
  72 + */
53 73 @Excel(name = "性别")
54 74 @JsonIgnoreProperties(ignoreUnknown = true)
55 75 private String personnelType;
56 76  
57   - /** 所属岗位/工种 */
  77 + /**
  78 + * 所属岗位/工种
  79 + */
58 80 @Excel(name = "所属岗位/工种")
59 81 @JsonIgnoreProperties(ignoreUnknown = true)
60 82 private String posts;
61 83  
62   - /** 身份证 */
  84 + /**
  85 + * 身份证
  86 + */
63 87 @Excel(name = "身份证")
64 88 @JsonIgnoreProperties(ignoreUnknown = true)
65 89 private String card;
66 90  
67   - /** 联系电话 */
  91 + /**
  92 + * 联系电话
  93 + */
68 94 @Excel(name = "联系电话")
69 95 @JsonIgnoreProperties(ignoreUnknown = true)
70 96 private String telphone;
71 97  
72   - /** RFID 人卡IC号 */
  98 + /**
  99 + * RFID 人卡IC号
  100 + */
73 101 @Excel(name = "RFID 人卡IC号")
74 102 @JsonIgnoreProperties(ignoreUnknown = true)
75 103 private String icRfid;
76 104  
77   - /** RFID 人卡ID号(10进制) */
  105 + /**
  106 + * RFID 人卡ID号(10进制)
  107 + */
78 108 @Excel(name = "RFID 人卡ID号", readConverterExp = "1=0进制")
79 109 @JsonIgnoreProperties(ignoreUnknown = true)
80 110 private String idRfid;
81 111  
82   - /** RFID 标签号 */
  112 + /**
  113 + * RFID 标签号
  114 + */
83 115 @Excel(name = "RFID 标签号")
84 116 @JsonIgnoreProperties(ignoreUnknown = true)
85 117 private String tagRfid;
86 118  
87   - /** 线路名称 */
  119 + /**
  120 + * 线路名称
  121 + */
88 122 @Excel(name = "线路名称")
89 123 @JsonIgnoreProperties(ignoreUnknown = true)
90 124 private String lineName;
91 125  
92   - /** 线路编码 */
  126 + /**
  127 + * 线路编码
  128 + */
93 129 @Excel(name = "线路编码")
94 130 @JsonIgnoreProperties(ignoreUnknown = true)
95 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 75  
76 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 133 }
134 134  
135 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 138 Map<String, Boolean> resultMap = new HashMap<>();
139 139 if (result > 0) {
140 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 3 import java.util.List;
4 4 import com.ruoyi.common.utils.DateUtils;
5 5 import com.ruoyi.common.utils.SecurityUtils;
  6 +import com.ruoyi.common.utils.StringUtils;
6 7 import org.springframework.beans.factory.annotation.Autowired;
7 8 import org.springframework.stereotype.Service;
8 9 import com.ruoyi.eexception.mapper.EquipmentExceptionMapper;
... ... @@ -55,6 +56,9 @@ public class EquipmentExceptionServiceImpl implements IEquipmentExceptionService
55 56 public int insertEquipmentException(EquipmentException equipmentException)
56 57 {
57 58 equipmentException.setCreateTime(DateUtils.getNowDate());
  59 + if (!StringUtils.isNotEmpty(equipmentException.getDeviceId())){
  60 + throw new RuntimeException("设备号不能为空");
  61 + }
58 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 2  
3 3 import java.util.List;
4 4 import javax.servlet.http.HttpServletResponse;
  5 +
5 6 import org.springframework.security.access.prepost.PreAuthorize;
6 7 import org.springframework.beans.factory.annotation.Autowired;
7 8 import org.springframework.web.bind.annotation.GetMapping;
... ... @@ -23,14 +24,13 @@ import com.ruoyi.common.core.page.TableDataInfo;
23 24  
24 25 /**
25 26 * 设备信息Controller
26   - *
  27 + *
27 28 * @author guzijian
28 29 * @date 2023-07-05
29 30 */
30 31 @RestController
31 32 @RequestMapping("/equipment/equipment")
32   -public class EquipmentController extends BaseController
33   -{
  33 +public class EquipmentController extends BaseController {
34 34 @Autowired
35 35 private IEquipmentService equipmentService;
36 36  
... ... @@ -39,8 +39,7 @@ public class EquipmentController extends BaseController
39 39 */
40 40 // @PreAuthorize("@ss.hasPermi('equipment:equipment:list')")
41 41 @GetMapping("/list")
42   - public TableDataInfo list(Equipment equipment)
43   - {
  42 + public TableDataInfo list(Equipment equipment) {
44 43 startPage();
45 44 List<Equipment> list = equipmentService.selectEquipmentList(equipment);
46 45 return getDataTable(list);
... ... @@ -52,8 +51,7 @@ public class EquipmentController extends BaseController
52 51 // @PreAuthorize("@ss.hasPermi('equipment:equipment:export')")
53 52 @Log(title = "设备信息", businessType = BusinessType.EXPORT)
54 53 @PostMapping("/export")
55   - public void export(HttpServletResponse response, Equipment equipment)
56   - {
  54 + public void export(HttpServletResponse response, Equipment equipment) {
57 55 List<Equipment> list = equipmentService.selectEquipmentList(equipment);
58 56 ExcelUtil<Equipment> util = new ExcelUtil<Equipment>(Equipment.class);
59 57 util.exportExcel(response, list, "设备信息数据");
... ... @@ -64,8 +62,7 @@ public class EquipmentController extends BaseController
64 62 */
65 63 // @PreAuthorize("@ss.hasPermi('equipment:equipment:query')")
66 64 @GetMapping(value = "/{id}")
67   - public AjaxResult getInfo(@PathVariable("id") Long id)
68   - {
  65 + public AjaxResult getInfo(@PathVariable("id") Long id) {
69 66 return success(equipmentService.selectEquipmentById(id));
70 67 }
71 68  
... ... @@ -75,8 +72,7 @@ public class EquipmentController extends BaseController
75 72 // @PreAuthorize("@ss.hasPermi('equipment:equipment:add')")
76 73 @Log(title = "设备信息", businessType = BusinessType.INSERT)
77 74 @PostMapping
78   - public AjaxResult add(@RequestBody Equipment equipment)
79   - {
  75 + public AjaxResult add(@RequestBody Equipment equipment) {
80 76 return toAjax(equipmentService.insertEquipment(equipment));
81 77 }
82 78  
... ... @@ -86,8 +82,7 @@ public class EquipmentController extends BaseController
86 82 // @PreAuthorize("@ss.hasPermi('equipment:equipment:edit')")
87 83 @Log(title = "设备信息", businessType = BusinessType.UPDATE)
88 84 @PutMapping
89   - public AjaxResult edit(@RequestBody Equipment equipment)
90   - {
  85 + public AjaxResult edit(@RequestBody Equipment equipment) {
91 86 return toAjax(equipmentService.updateEquipment(equipment));
92 87 }
93 88  
... ... @@ -96,9 +91,8 @@ public class EquipmentController extends BaseController
96 91 */
97 92 // @PreAuthorize("@ss.hasPermi('equipment:equipment:remove')")
98 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 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 3 import java.util.List;
4 4 import com.ruoyi.common.utils.DateUtils;
5 5 import com.ruoyi.common.utils.SecurityUtils;
  6 +import com.ruoyi.common.utils.StringUtils;
6 7 import org.springframework.beans.factory.annotation.Autowired;
7 8 import org.springframework.stereotype.Service;
8 9 import com.ruoyi.equipment.mapper.EquipmentMapper;
... ... @@ -55,7 +56,10 @@ public class EquipmentServiceImpl implements IEquipmentService
55 56 public int insertEquipment(Equipment equipment)
56 57 {
57 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 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 100 @PostMapping("/newAdd")
101 101 @ApiOperation("新增签到(设备传入)")
102 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 3 import java.io.IOException;
4 4 import java.util.List;
5 5  
  6 +import com.ruoyi.common.core.domain.AjaxResult;
6 7 import com.ruoyi.common.exception.file.FileUploadException;
7 8 import com.ruoyi.in.domain.SignIn;
8 9 import com.ruoyi.pojo.request.ReportViewRequestVo;
... ... @@ -69,6 +70,6 @@ public interface ISignInService
69 70 * @param signIn
70 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 3 import java.io.File;
4 4 import java.io.FileOutputStream;
5 5 import java.io.IOException;
  6 +import java.math.BigDecimal;
6 7 import java.util.Base64;
7 8 import java.util.Date;
8 9 import java.util.List;
... ... @@ -10,6 +11,7 @@ import java.util.Objects;
10 11  
11 12 import com.ruoyi.common.config.RuoYiConfig;
12 13 import com.ruoyi.common.constant.Constants;
  14 +import com.ruoyi.common.core.domain.AjaxResult;
13 15 import com.ruoyi.common.exception.file.FileUploadException;
14 16 import com.ruoyi.common.utils.DateUtils;
15 17 import com.ruoyi.common.SignInEnum;
... ... @@ -28,6 +30,8 @@ import sun.misc.BASE64Decoder;
28 30  
29 31 import javax.annotation.Resource;
30 32  
  33 +import static com.ruoyi.common.SignInEnum.*;
  34 +
31 35 /**
32 36 * 签到Service业务层处理
33 37 *
... ... @@ -77,6 +81,10 @@ public class SignInServiceImpl implements ISignInService {
77 81 if (signIn.getType() == null) {
78 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 88 return signInMapper.insertSignIn(signIn);
81 89 }
82 90  
... ... @@ -115,7 +123,14 @@ public class SignInServiceImpl implements ISignInService {
115 123 }
116 124  
117 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 134 // base64转图片
120 135 signIn.setCreateTime(new Date());
121 136 signIn.setIp(IpUtils.getIpAddr());
... ... @@ -135,7 +150,8 @@ public class SignInServiceImpl implements ISignInService {
135 150 signIn.setImage(pathFileName);
136 151 // 异步上传文件
137 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 11  
12 12 /**
13 13 * 异常报表请求
  14 + *
14 15 * @author 20412
15 16 */
16 17 @ApiModel("异常报表请求")
... ...
ruoyi-admin/src/main/java/com/ruoyi/pojo/response/ReportViewResponseVo.java
1 1 package com.ruoyi.pojo.response;
2 2  
  3 +import com.alibaba.excel.annotation.ExcelIgnore;
3 4 import com.alibaba.excel.annotation.ExcelProperty;
4 5 import com.fasterxml.jackson.annotation.JsonFormat;
5 6 import com.ruoyi.pojo.converter.AlcoholFlagConverter;
... ... @@ -21,14 +22,15 @@ import java.util.Date;
21 22 @Data
22 23 public class ReportViewResponseVo {
23 24 @ApiModelProperty("id")
  25 + @ExcelIgnore
24 26 private Long id;
25 27  
26 28 @ExcelProperty(value = "工号")
27 29 @ApiModelProperty("工号")
28 30 private String jobCode;
29 31  
30   - @ExcelProperty(value = "签到类型" ,converter = SignInTypeConverter.class)
31   - @ApiModelProperty("签到类型" )
  32 + @ExcelProperty(value = "签到类型", converter = SignInTypeConverter.class)
  33 + @ApiModelProperty("签到类型")
32 34 private String singnIn;
33 35  
34 36 @ExcelProperty(value = "姓名")
... ... @@ -41,20 +43,20 @@ public class ReportViewResponseVo {
41 43 @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
42 44 private Date createTime;
43 45  
44   - @ExcelProperty(value = "签到状态",converter = SignInStatusConverter.class)
  46 + @ExcelProperty(value = "签到状态", converter = SignInStatusConverter.class)
45 47 @ApiModelProperty("签到状态1 成功2 异常")
46 48 private Integer status;
47 49 /**
48 50 * 签到签退
49 51 */
50 52 @ApiModelProperty("签到签退")
51   - @ExcelProperty(value = "签到签退",converter = SignInConvert.class)
  53 + @ExcelProperty(value = "签到签退", converter = SignInConvert.class)
52 54 private Integer type;
53 55 /**
54 56 * 是否酒精检测 1 检查 2 未检
55 57 */
56 58 @ApiModelProperty("是否酒精检测 1 检查 2 未检")
57   - @ExcelProperty(value = "酒精检测",converter = AlcoholFlagConverter.class)
  59 + @ExcelProperty(value = "酒精检测", converter = AlcoholFlagConverter.class)
58 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 58 Map<String, String> names = driverMapper.getNameByJobCode(jobCodes).stream().collect(Collectors.toMap(Driver::getJobCode, Driver::getPersonnelName));
59 59 if (SIGN_IN_ERROR.equals(request.getErrorType())) {
60 60 copyToResponse(names, signInList, responses);
61   - }else if (EQUIPMENT_ERROR.equals(request.getErrorType())) {
  61 + } else if (EQUIPMENT_ERROR.equals(request.getErrorType())) {
62 62 copyToResponseByException(names, exceptionList, responses);
63   - }else {
  63 + } else {
64 64 copyToResponse(names, signInList, responses);
65 65 copyToResponseByException(names, exceptionList, responses);
66 66 }
... ...
ruoyi-admin/src/main/resources/mapper/driver/DriverMapper.xml
... ... @@ -41,12 +41,13 @@
41 41 tag_rfid,
42 42 remark,
43 43 line_name,
44   - line_code
  44 + line_code,
  45 + sign_in
45 46 from driver
46 47 </sql>
47 48 <sql id="insertDriverVo">
48 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 51 </sql>
51 52  
52 53 <select id="selectDriverList" parameterType="Driver" resultMap="DriverResult">
... ... @@ -166,6 +167,7 @@
166 167 <if test="remark != null">remark = #{remark},</if>
167 168 <if test="lineName != null">line_name = #{lineName},</if>
168 169 <if test="lineCode != null">line_code = #{lineCode},</if>
  170 + <if test="signIn != null">sign_in = #{signIn}</if>
169 171 </trim>
170 172 where id = #{id}
171 173 </update>
... ... @@ -250,7 +252,8 @@
250 252 #{item.tagRfid,jdbcType=VARCHAR},
251 253 #{item.remark,jdbcType=VARCHAR},
252 254 #{item.lineName,jdbcType=VARCHAR},
253   - #{item.lineCode,jdbcType=VARCHAR}
  255 + #{item.lineCode,jdbcType=VARCHAR},
  256 + #{item.signIn}
254 257 )
255 258 </foreach>
256 259 on duplicate key update
... ...