Commit 33ad5ee1335f227aaae78c65bbde0b17209444e9

Authored by guzijian
1 parent 5a9235bc

fix: 修改注释内容

ruoyi-admin/admin-dockerfile
@@ -11,6 +11,8 @@ ENV jar_name=$server_name @@ -11,6 +11,8 @@ ENV jar_name=$server_name
11 ENV env_file=$env_name 11 ENV env_file=$env_name
12 # 抽取常量 12 # 抽取常量
13 ENV jar_home=/home/ruoyi/ 13 ENV jar_home=/home/ruoyi/
  14 +#设置时区
  15 +RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
14 # 工作区 16 # 工作区
15 RUN mkdir -p ${jar_home} 17 RUN mkdir -p ${jar_home}
16 # 指定工作区 18 # 指定工作区
ruoyi-admin/src/main/java/com/ruoyi/common/ErrorTypeProperties.java
@@ -6,4 +6,7 @@ package com.ruoyi.common; @@ -6,4 +6,7 @@ package com.ruoyi.common;
6 public interface ErrorTypeProperties { 6 public interface ErrorTypeProperties {
7 String SIGN_IN_ERROR = "签到异常"; 7 String SIGN_IN_ERROR = "签到异常";
8 String EQUIPMENT_ERROR = "设备异常"; 8 String EQUIPMENT_ERROR = "设备异常";
  9 + String ALCOHOL_SIGN_IN_ERROR = "酒精测试超标";
  10 + String WORK_DAY_ERROR = "当天没有排班";
  11 + String SIGN_IN_TIMEOUT = "签到超时";
9 } 12 }
ruoyi-admin/src/main/java/com/ruoyi/common/SignInEnum.java
@@ -25,7 +25,9 @@ public interface SignInEnum { @@ -25,7 +25,9 @@ public interface SignInEnum {
25 Integer SIGN_IN_SUCCESS = 1; 25 Integer SIGN_IN_SUCCESS = 1;
26 String SIGN_IN_FAIL_STRING = "签到异常"; 26 String SIGN_IN_FAIL_STRING = "签到异常";
27 Integer SIGN_IN_FAIL = 2; 27 Integer SIGN_IN_FAIL = 2;
28 - 28 + /**
  29 + * 酒精测试开启
  30 + */
29 Integer ALCOHOL_FLAG_YES = 1; 31 Integer ALCOHOL_FLAG_YES = 1;
30 String ALCOHOL_FLAG_YES_STRING = "已测试"; 32 String ALCOHOL_FLAG_YES_STRING = "已测试";
31 Integer ALCOHOL_FLAG_NO = 2; 33 Integer ALCOHOL_FLAG_NO = 2;
ruoyi-admin/src/main/java/com/ruoyi/driver/controller/DriverController.java
@@ -156,6 +156,7 @@ public class DriverController extends BaseController { @@ -156,6 +156,7 @@ public class DriverController extends BaseController {
156 } 156 }
157 157
158 @PostMapping("/upload") 158 @PostMapping("/upload")
  159 + @ApiOperation("驾驶员人脸上传接口")
159 public AjaxResult uploadImage(MultipartFile file) { 160 public AjaxResult uploadImage(MultipartFile file) {
160 try { 161 try {
161 return driverService.uploadImage(file); 162 return driverService.uploadImage(file);
ruoyi-admin/src/main/java/com/ruoyi/driver/domain/Driver.java
@@ -3,11 +3,15 @@ package com.ruoyi.driver.domain; @@ -3,11 +3,15 @@ package com.ruoyi.driver.domain;
3 import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 3 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4 import io.swagger.annotations.ApiModel; 4 import io.swagger.annotations.ApiModel;
5 import io.swagger.annotations.ApiModelProperty; 5 import io.swagger.annotations.ApiModelProperty;
  6 +import io.swagger.annotations.ApiOperation;
6 import lombok.Data; 7 import lombok.Data;
7 import org.apache.commons.lang3.builder.ToStringBuilder; 8 import org.apache.commons.lang3.builder.ToStringBuilder;
8 import org.apache.commons.lang3.builder.ToStringStyle; 9 import org.apache.commons.lang3.builder.ToStringStyle;
9 import com.ruoyi.common.annotation.Excel; 10 import com.ruoyi.common.annotation.Excel;
10 import com.ruoyi.common.core.domain.BaseEntity; 11 import com.ruoyi.common.core.domain.BaseEntity;
  12 +import org.springframework.format.annotation.DateTimeFormat;
  13 +
  14 +import java.util.Date;
11 15
12 /** 16 /**
13 * 驾驶员信息对象 driver 17 * 驾驶员信息对象 driver
@@ -137,5 +141,8 @@ public class Driver extends BaseEntity { @@ -137,5 +141,8 @@ public class Driver extends BaseEntity {
137 */ 141 */
138 @ApiModelProperty("头像") 142 @ApiModelProperty("头像")
139 private String image; 143 private String image;
  144 + @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss")
  145 + @ApiModelProperty("更新时间")
  146 + private Date update_time;
140 147
141 } 148 }
ruoyi-admin/src/main/java/com/ruoyi/eexception/domain/EquipmentException.java
1 package com.ruoyi.eexception.domain; 1 package com.ruoyi.eexception.domain;
2 2
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.Data;
3 import org.apache.commons.lang3.builder.ToStringBuilder; 6 import org.apache.commons.lang3.builder.ToStringBuilder;
4 import org.apache.commons.lang3.builder.ToStringStyle; 7 import org.apache.commons.lang3.builder.ToStringStyle;
5 import com.ruoyi.common.annotation.Excel; 8 import com.ruoyi.common.annotation.Excel;
@@ -11,6 +14,8 @@ import com.ruoyi.common.core.domain.BaseEntity; @@ -11,6 +14,8 @@ import com.ruoyi.common.core.domain.BaseEntity;
11 * @author guzijian 14 * @author guzijian
12 * @date 2023-07-05 15 * @date 2023-07-05
13 */ 16 */
  17 +@ApiModel("设备异常记录对象")
  18 +@Data
14 public class EquipmentException extends BaseEntity 19 public class EquipmentException extends BaseEntity
15 { 20 {
16 private static final long serialVersionUID = 1L; 21 private static final long serialVersionUID = 1L;
@@ -20,91 +25,27 @@ public class EquipmentException extends BaseEntity @@ -20,91 +25,27 @@ public class EquipmentException extends BaseEntity
20 25
21 /** 标题 */ 26 /** 标题 */
22 @Excel(name = "标题") 27 @Excel(name = "标题")
  28 + @ApiModelProperty("标题")
23 private String title; 29 private String title;
24 -  
25 - public String getDeviceId() {  
26 - return deviceId;  
27 - }  
28 -  
29 - public void setDeviceId(String deviceId) {  
30 - this.deviceId = deviceId;  
31 - }  
32 -  
33 /** 设备id */ 30 /** 设备id */
34 @Excel(name = "设备id") 31 @Excel(name = "设备id")
  32 + @ApiModelProperty("设备号")
35 private String deviceId; 33 private String deviceId;
36 34
37 /** 上报人 */ 35 /** 上报人 */
38 @Excel(name = "上报人") 36 @Excel(name = "上报人")
  37 + @ApiModelProperty("上报人员工号")
39 private String jobCode; 38 private String jobCode;
40 39
41 /** 设备图片 */ 40 /** 设备图片 */
42 @Excel(name = "设备图片") 41 @Excel(name = "设备图片")
  42 + @ApiModelProperty("设备图片地址")
43 private String image; 43 private String image;
44 44
45 /** 处理状态 */ 45 /** 处理状态 */
46 @Excel(name = "处理状态") 46 @Excel(name = "处理状态")
  47 + @ApiModelProperty("处理状态")
47 private Integer status; 48 private Integer status;
48 49
49 - public void setId(Long id)  
50 - {  
51 - this.id = id;  
52 - }  
53 -  
54 - public Long getId()  
55 - {  
56 - return id;  
57 - }  
58 - public void setTitle(String title)  
59 - {  
60 - this.title = title;  
61 - }  
62 -  
63 - public String getTitle()  
64 - {  
65 - return title;  
66 - }  
67 -  
68 -  
69 - public void setJobCode(String jobCode)  
70 - {  
71 - this.jobCode = jobCode;  
72 - }  
73 -  
74 - public String getJobCode()  
75 - {  
76 - return jobCode;  
77 - }  
78 - public void setImage(String image)  
79 - {  
80 - this.image = image;  
81 - }  
82 -  
83 - public String getImage()  
84 - {  
85 - return image;  
86 - }  
87 - public void setStatus(Integer status)  
88 - {  
89 - this.status = status;  
90 - }  
91 -  
92 - public Integer getStatus()  
93 - {  
94 - return status;  
95 - }  
96 50
97 - @Override  
98 - public String toString() {  
99 - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)  
100 - .append("id", getId())  
101 - .append("title", getTitle())  
102 - .append("deviceId", getDeviceId())  
103 - .append("jobCode", getJobCode())  
104 - .append("image", getImage())  
105 - .append("status", getStatus())  
106 - .append("createTime", getCreateTime())  
107 - .append("remark", getRemark())  
108 - .toString();  
109 - }  
110 } 51 }
ruoyi-admin/src/main/java/com/ruoyi/equipment/controller/EquipmentController.java
@@ -3,6 +3,8 @@ package com.ruoyi.equipment.controller; @@ -3,6 +3,8 @@ package com.ruoyi.equipment.controller;
3 import java.util.List; 3 import java.util.List;
4 import javax.servlet.http.HttpServletResponse; 4 import javax.servlet.http.HttpServletResponse;
5 5
  6 +import io.swagger.annotations.Api;
  7 +import io.swagger.annotations.ApiOperation;
6 import org.springframework.security.access.prepost.PreAuthorize; 8 import org.springframework.security.access.prepost.PreAuthorize;
7 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.web.bind.annotation.GetMapping; 10 import org.springframework.web.bind.annotation.GetMapping;
@@ -30,6 +32,7 @@ import com.ruoyi.common.core.page.TableDataInfo; @@ -30,6 +32,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
30 */ 32 */
31 @RestController 33 @RestController
32 @RequestMapping("/equipment/equipment") 34 @RequestMapping("/equipment/equipment")
  35 +@Api(tags = "设备管理接口")
33 public class EquipmentController extends BaseController { 36 public class EquipmentController extends BaseController {
34 @Autowired 37 @Autowired
35 private IEquipmentService equipmentService; 38 private IEquipmentService equipmentService;
@@ -39,6 +42,7 @@ public class EquipmentController extends BaseController { @@ -39,6 +42,7 @@ public class EquipmentController extends BaseController {
39 */ 42 */
40 // @PreAuthorize("@ss.hasPermi('equipment:equipment:list')") 43 // @PreAuthorize("@ss.hasPermi('equipment:equipment:list')")
41 @GetMapping("/list") 44 @GetMapping("/list")
  45 + @ApiOperation("查询设备信息列表")
42 public TableDataInfo list(Equipment equipment) { 46 public TableDataInfo list(Equipment equipment) {
43 startPage(); 47 startPage();
44 List<Equipment> list = equipmentService.selectEquipmentList(equipment); 48 List<Equipment> list = equipmentService.selectEquipmentList(equipment);
@@ -51,6 +55,7 @@ public class EquipmentController extends BaseController { @@ -51,6 +55,7 @@ public class EquipmentController extends BaseController {
51 // @PreAuthorize("@ss.hasPermi('equipment:equipment:export')") 55 // @PreAuthorize("@ss.hasPermi('equipment:equipment:export')")
52 @Log(title = "设备信息", businessType = BusinessType.EXPORT) 56 @Log(title = "设备信息", businessType = BusinessType.EXPORT)
53 @PostMapping("/export") 57 @PostMapping("/export")
  58 + @ApiOperation("导出设备信息列表")
54 public void export(HttpServletResponse response, Equipment equipment) { 59 public void export(HttpServletResponse response, Equipment equipment) {
55 List<Equipment> list = equipmentService.selectEquipmentList(equipment); 60 List<Equipment> list = equipmentService.selectEquipmentList(equipment);
56 ExcelUtil<Equipment> util = new ExcelUtil<Equipment>(Equipment.class); 61 ExcelUtil<Equipment> util = new ExcelUtil<Equipment>(Equipment.class);
@@ -62,6 +67,7 @@ public class EquipmentController extends BaseController { @@ -62,6 +67,7 @@ public class EquipmentController extends BaseController {
62 */ 67 */
63 // @PreAuthorize("@ss.hasPermi('equipment:equipment:query')") 68 // @PreAuthorize("@ss.hasPermi('equipment:equipment:query')")
64 @GetMapping(value = "/{id}") 69 @GetMapping(value = "/{id}")
  70 + @ApiOperation("获取设备信息详细信息")
65 public AjaxResult getInfo(@PathVariable("id") Long id) { 71 public AjaxResult getInfo(@PathVariable("id") Long id) {
66 return success(equipmentService.selectEquipmentById(id)); 72 return success(equipmentService.selectEquipmentById(id));
67 } 73 }
@@ -72,6 +78,7 @@ public class EquipmentController extends BaseController { @@ -72,6 +78,7 @@ public class EquipmentController extends BaseController {
72 // @PreAuthorize("@ss.hasPermi('equipment:equipment:add')") 78 // @PreAuthorize("@ss.hasPermi('equipment:equipment:add')")
73 @Log(title = "设备信息", businessType = BusinessType.INSERT) 79 @Log(title = "设备信息", businessType = BusinessType.INSERT)
74 @PostMapping 80 @PostMapping
  81 + @ApiOperation("新增设备信息")
75 public AjaxResult add(@RequestBody Equipment equipment) { 82 public AjaxResult add(@RequestBody Equipment equipment) {
76 return toAjax(equipmentService.insertEquipment(equipment)); 83 return toAjax(equipmentService.insertEquipment(equipment));
77 } 84 }
@@ -82,6 +89,7 @@ public class EquipmentController extends BaseController { @@ -82,6 +89,7 @@ public class EquipmentController extends BaseController {
82 // @PreAuthorize("@ss.hasPermi('equipment:equipment:edit')") 89 // @PreAuthorize("@ss.hasPermi('equipment:equipment:edit')")
83 @Log(title = "设备信息", businessType = BusinessType.UPDATE) 90 @Log(title = "设备信息", businessType = BusinessType.UPDATE)
84 @PutMapping 91 @PutMapping
  92 + @ApiOperation("修改设备信息")
85 public AjaxResult edit(@RequestBody Equipment equipment) { 93 public AjaxResult edit(@RequestBody Equipment equipment) {
86 return toAjax(equipmentService.updateEquipment(equipment)); 94 return toAjax(equipmentService.updateEquipment(equipment));
87 } 95 }
@@ -92,6 +100,7 @@ public class EquipmentController extends BaseController { @@ -92,6 +100,7 @@ public class EquipmentController extends BaseController {
92 // @PreAuthorize("@ss.hasPermi('equipment:equipment:remove')") 100 // @PreAuthorize("@ss.hasPermi('equipment:equipment:remove')")
93 @Log(title = "设备信息", businessType = BusinessType.DELETE) 101 @Log(title = "设备信息", businessType = BusinessType.DELETE)
94 @DeleteMapping("/{ids}") 102 @DeleteMapping("/{ids}")
  103 + @ApiOperation("删除设备信息")
95 public AjaxResult remove(@PathVariable Long[] ids) { 104 public AjaxResult remove(@PathVariable Long[] ids) {
96 return toAjax(equipmentService.deleteEquipmentByIds(ids)); 105 return toAjax(equipmentService.deleteEquipmentByIds(ids));
97 } 106 }
ruoyi-admin/src/main/java/com/ruoyi/equipment/domain/Equipment.java
1 package com.ruoyi.equipment.domain; 1 package com.ruoyi.equipment.domain;
2 2
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import io.swagger.annotations.ApiOperation;
  6 +import lombok.Data;
3 import org.apache.commons.lang3.builder.ToStringBuilder; 7 import org.apache.commons.lang3.builder.ToStringBuilder;
4 import org.apache.commons.lang3.builder.ToStringStyle; 8 import org.apache.commons.lang3.builder.ToStringStyle;
5 import com.ruoyi.common.annotation.Excel; 9 import com.ruoyi.common.annotation.Excel;
@@ -11,6 +15,8 @@ import com.ruoyi.common.core.domain.BaseEntity; @@ -11,6 +15,8 @@ import com.ruoyi.common.core.domain.BaseEntity;
11 * @author guzijian 15 * @author guzijian
12 * @date 2023-07-05 16 * @date 2023-07-05
13 */ 17 */
  18 +@ApiModel("设备信息对象")
  19 +@Data
14 public class Equipment extends BaseEntity 20 public class Equipment extends BaseEntity
15 { 21 {
16 private static final long serialVersionUID = 1L; 22 private static final long serialVersionUID = 1L;
@@ -20,121 +26,37 @@ public class Equipment extends BaseEntity @@ -20,121 +26,37 @@ public class Equipment extends BaseEntity
20 26
21 /** 场地名称 */ 27 /** 场地名称 */
22 @Excel(name = "场地名称") 28 @Excel(name = "场地名称")
  29 + @ApiModelProperty("场地名称")
23 private String siteName; 30 private String siteName;
24 31
25 /** 安置地址 */ 32 /** 安置地址 */
26 @Excel(name = "安置地址") 33 @Excel(name = "安置地址")
  34 + @ApiModelProperty("安置地址")
27 private String address; 35 private String address;
28 36
29 /** 设备ip */ 37 /** 设备ip */
30 @Excel(name = "设备ip") 38 @Excel(name = "设备ip")
  39 + @ApiModelProperty("设备ip")
31 private String ip; 40 private String ip;
32 41
33 /** 设备状态 */ 42 /** 设备状态 */
34 @Excel(name = "设备状态") 43 @Excel(name = "设备状态")
  44 + @ApiModelProperty("设备状态")
35 private Integer status; 45 private Integer status;
36 46
37 /** 设备权限 */ 47 /** 设备权限 */
38 - @Excel(name = "设备权限 ") 48 + @Excel(name = "设备权限")
  49 + @ApiModelProperty("设备权限")
39 private String promise; 50 private String promise;
40 51
41 /** 设备图片 */ 52 /** 设备图片 */
42 @Excel(name = "设备图片") 53 @Excel(name = "设备图片")
  54 + @ApiModelProperty("设备图片")
43 private String image; 55 private String image;
44 56
45 /** 设备号 */ 57 /** 设备号 */
46 @Excel(name = "设备号") 58 @Excel(name = "设备号")
  59 + @ApiModelProperty("设备号")
47 private String deviceId; 60 private String deviceId;
48 61
49 - public void setId(Long id)  
50 - {  
51 - this.id = id;  
52 - }  
53 -  
54 - public Long getId()  
55 - {  
56 - return id;  
57 - }  
58 - public void setSiteName(String siteName)  
59 - {  
60 - this.siteName = siteName;  
61 - }  
62 -  
63 - public String getSiteName()  
64 - {  
65 - return siteName;  
66 - }  
67 - public void setAddress(String address)  
68 - {  
69 - this.address = address;  
70 - }  
71 -  
72 - public String getAddress()  
73 - {  
74 - return address;  
75 - }  
76 - public void setIp(String ip)  
77 - {  
78 - this.ip = ip;  
79 - }  
80 -  
81 - public String getIp()  
82 - {  
83 - return ip;  
84 - }  
85 - public void setStatus(Integer status)  
86 - {  
87 - this.status = status;  
88 - }  
89 -  
90 - public Integer getStatus()  
91 - {  
92 - return status;  
93 - }  
94 - public void setPromise(String promise)  
95 - {  
96 - this.promise = promise;  
97 - }  
98 -  
99 - public String getPromise()  
100 - {  
101 - return promise;  
102 - }  
103 - public void setImage(String image)  
104 - {  
105 - this.image = image;  
106 - }  
107 -  
108 - public String getImage()  
109 - {  
110 - return image;  
111 - }  
112 - public void setDeviceId(String deviceId)  
113 - {  
114 - this.deviceId = deviceId;  
115 - }  
116 -  
117 - public String getDeviceId()  
118 - {  
119 - return deviceId;  
120 - }  
121 -  
122 - @Override  
123 - public String toString() {  
124 - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)  
125 - .append("id", getId())  
126 - .append("siteName", getSiteName())  
127 - .append("address", getAddress())  
128 - .append("ip", getIp())  
129 - .append("status", getStatus())  
130 - .append("promise", getPromise())  
131 - .append("image", getImage())  
132 - .append("deviceId", getDeviceId())  
133 - .append("createTime", getCreateTime())  
134 - .append("updateTime", getUpdateTime())  
135 - .append("createBy", getCreateBy())  
136 - .append("updateBy", getUpdateBy())  
137 - .append("remark", getRemark())  
138 - .toString();  
139 - }  
140 } 62 }
ruoyi-admin/src/main/java/com/ruoyi/in/domain/SignIn.java
@@ -5,6 +5,7 @@ import java.math.BigDecimal; @@ -5,6 +5,7 @@ import java.math.BigDecimal;
5 5
6 import io.swagger.annotations.ApiModel; 6 import io.swagger.annotations.ApiModel;
7 import io.swagger.annotations.ApiModelProperty; 7 import io.swagger.annotations.ApiModelProperty;
  8 +import lombok.Data;
8 import org.apache.commons.lang3.builder.ToStringBuilder; 9 import org.apache.commons.lang3.builder.ToStringBuilder;
9 import org.apache.commons.lang3.builder.ToStringStyle; 10 import org.apache.commons.lang3.builder.ToStringStyle;
10 import com.ruoyi.common.annotation.Excel; 11 import com.ruoyi.common.annotation.Excel;
@@ -16,16 +17,20 @@ import com.ruoyi.common.core.domain.BaseEntity; @@ -16,16 +17,20 @@ import com.ruoyi.common.core.domain.BaseEntity;
16 * @author guzijian 17 * @author guzijian
17 * @date 2023-07-05 18 * @date 2023-07-05
18 */ 19 */
19 -@ApiModel(value = "signIn",description = "签到记录参数")  
20 -public class SignIn extends BaseEntity  
21 -{ 20 +@ApiModel(value = "签到对象",description = "签到记录参数")
  21 +@Data
  22 +public class SignIn extends BaseEntity {
22 private static final long serialVersionUID = 1L; 23 private static final long serialVersionUID = 1L;
23 24
24 - /** 主键 */ 25 + /**
  26 + * 主键
  27 + */
25 @ApiModelProperty("主键") 28 @ApiModelProperty("主键")
26 private Long id; 29 private Long id;
27 30
28 - /** 工号 */ 31 + /**
  32 + * 工号
  33 + */
29 @Excel(name = "工号") 34 @Excel(name = "工号")
30 @ApiModelProperty("工号") 35 @ApiModelProperty("工号")
31 private String jobCode; 36 private String jobCode;
@@ -33,147 +38,49 @@ public class SignIn extends BaseEntity @@ -33,147 +38,49 @@ public class SignIn extends BaseEntity
33 @Excel(name = "设备号") 38 @Excel(name = "设备号")
34 @ApiModelProperty("设备号") 39 @ApiModelProperty("设备号")
35 private String deviceId; 40 private String deviceId;
36 -  
37 - public String getDeviceId() {  
38 - return deviceId;  
39 - }  
40 -  
41 - public void setDeviceId(String deviceId) {  
42 - this.deviceId = deviceId;  
43 - }  
44 -  
45 - /** 设备地址 */ 41 + /**
  42 + * 设备地址
  43 + */
46 @Excel(name = "设备地址") 44 @Excel(name = "设备地址")
47 @ApiModelProperty("设备ip 不用填写") 45 @ApiModelProperty("设备ip 不用填写")
48 private String ip; 46 private String ip;
49 -  
50 - /** 图片 */ 47 + /**
  48 + * 图片
  49 + */
51 @Excel(name = "图片") 50 @Excel(name = "图片")
52 @ApiModelProperty("图片信息") 51 @ApiModelProperty("图片信息")
53 private String image; 52 private String image;
54 - /** 签到结果 */ 53 + /**
  54 + * 签到结果
  55 + */
55 @Excel(name = "签到结果") 56 @Excel(name = "签到结果")
56 @ApiModelProperty("签到结果 1 成功 2 异常") 57 @ApiModelProperty("签到结果 1 成功 2 异常")
57 private Integer status; 58 private Integer status;
58 -  
59 - /** 签到类型 */ 59 + /**
  60 + * 签到类型
  61 + */
60 @Excel(name = "签到类型") 62 @Excel(name = "签到类型")
61 @ApiModelProperty("签到类型 1 人脸 2 刷卡 3 其他 4 酒精 用可以多选 用,拼接 如 1,2,3,4") 63 @ApiModelProperty("签到类型 1 人脸 2 刷卡 3 其他 4 酒精 用可以多选 用,拼接 如 1,2,3,4")
62 private String singnIn; 64 private String singnIn;
63 -  
64 - /** 酒精测试 */ 65 + /**
  66 + * 酒精测试
  67 + */
65 @Excel(name = "酒精测试") 68 @Excel(name = "酒精测试")
66 @ApiModelProperty("酒精测试 1 已测试 2 未测试") 69 @ApiModelProperty("酒精测试 1 已测试 2 未测试")
67 private Integer alcoholFlag; 70 private Integer alcoholFlag;
68 71
69 - /** 签到签退 */ 72 + /**
  73 + * 签到签退
  74 + */
70 @Excel(name = "签到签退") 75 @Excel(name = "签到签退")
71 @ApiModelProperty("签到签退 1 签到成功 2 签退成功") 76 @ApiModelProperty("签到签退 1 签到成功 2 签退成功")
72 private Integer type; 77 private Integer type;
73 78
74 - /** 酒精摄入量 */ 79 + /**
  80 + * 酒精摄入量
  81 + */
75 @Excel(name = "酒精摄入量") 82 @Excel(name = "酒精摄入量")
76 @ApiModelProperty("酒精摄入量 52.12") 83 @ApiModelProperty("酒精摄入量 52.12")
77 private BigDecimal alcoholIntake; 84 private BigDecimal alcoholIntake;
78 -  
79 - public void setId(Long id)  
80 - {  
81 - this.id = id;  
82 - }  
83 -  
84 - public Long getId()  
85 - {  
86 - return id;  
87 - }  
88 - public void setJobCode(String jobCode)  
89 - {  
90 - this.jobCode = jobCode;  
91 - }  
92 -  
93 - public String getJobCode()  
94 - {  
95 - return jobCode;  
96 - }  
97 - public void setIp(String ip)  
98 - {  
99 - this.ip = ip;  
100 - }  
101 -  
102 - public String getIp()  
103 - {  
104 - return ip;  
105 - }  
106 - public void setImage(String image)  
107 - {  
108 - this.image = image;  
109 - }  
110 -  
111 - public String getImage()  
112 - {  
113 - return image;  
114 - }  
115 - public void setStatus(Integer status)  
116 - {  
117 - this.status = status;  
118 - }  
119 -  
120 - public Integer getStatus()  
121 - {  
122 - return status;  
123 - }  
124 - public void setSingnIn(String singnIn)  
125 - {  
126 - this.singnIn = singnIn;  
127 - }  
128 -  
129 - public String getSingnIn()  
130 - {  
131 - return singnIn;  
132 - }  
133 - public void setAlcoholFlag(Integer alcoholFlag)  
134 - {  
135 - this.alcoholFlag = alcoholFlag;  
136 - }  
137 -  
138 - public Integer getAlcoholFlag()  
139 - {  
140 - return alcoholFlag;  
141 - }  
142 - public void setType(Integer type)  
143 - {  
144 - this.type = type;  
145 - }  
146 -  
147 - public Integer getType()  
148 - {  
149 - return type;  
150 - }  
151 - public void setAlcoholIntake(BigDecimal alcoholIntake)  
152 - {  
153 - this.alcoholIntake = alcoholIntake;  
154 - }  
155 -  
156 - public BigDecimal getAlcoholIntake()  
157 - {  
158 - return alcoholIntake;  
159 - }  
160 -  
161 - @Override  
162 - public String toString() {  
163 - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)  
164 - .append("id", getId())  
165 - .append("createTime", getCreateTime())  
166 - .append("jobCode", getJobCode())  
167 - .append("ip", getIp())  
168 - .append("image", getImage())  
169 - .append("status", getStatus())  
170 - .append("updateBy", getUpdateBy())  
171 - .append("singnIn", getSingnIn())  
172 - .append("alcoholFlag", getAlcoholFlag())  
173 - .append("type", getType())  
174 - .append("updateTime", getUpdateTime())  
175 - .append("alcoholIntake", getAlcoholIntake())  
176 - .append("remark", getRemark())  
177 - .toString();  
178 - }  
179 } 85 }
  86 +
ruoyi-admin/src/main/java/com/ruoyi/in/service/impl/SignInServiceImpl.java
1 package com.ruoyi.in.service.impl; 1 package com.ruoyi.in.service.impl;
2 2
3 import java.io.File; 3 import java.io.File;
4 -import java.io.FileOutputStream;  
5 import java.io.IOException; 4 import java.io.IOException;
6 import java.math.BigDecimal; 5 import java.math.BigDecimal;
7 import java.util.Base64; 6 import java.util.Base64;
@@ -12,24 +11,27 @@ import java.util.Objects; @@ -12,24 +11,27 @@ import java.util.Objects;
12 import com.ruoyi.common.config.RuoYiConfig; 11 import com.ruoyi.common.config.RuoYiConfig;
13 import com.ruoyi.common.constant.Constants; 12 import com.ruoyi.common.constant.Constants;
14 import com.ruoyi.common.core.domain.AjaxResult; 13 import com.ruoyi.common.core.domain.AjaxResult;
15 -import com.ruoyi.common.exception.file.FileUploadException; 14 +import com.ruoyi.common.core.redis.RedisCache;
16 import com.ruoyi.common.utils.DateUtils; 15 import com.ruoyi.common.utils.DateUtils;
17 import com.ruoyi.common.SignInEnum; 16 import com.ruoyi.common.SignInEnum;
18 import com.ruoyi.common.utils.StringUtils; 17 import com.ruoyi.common.utils.StringUtils;
19 import com.ruoyi.common.utils.ip.IpUtils; 18 import com.ruoyi.common.utils.ip.IpUtils;
20 import com.ruoyi.common.utils.uuid.Seq; 19 import com.ruoyi.common.utils.uuid.Seq;
21 import com.ruoyi.common.utils.uuid.UUID; 20 import com.ruoyi.common.utils.uuid.UUID;
  21 +import com.ruoyi.driver.domain.Driver;
  22 +import com.ruoyi.pojo.response.ResponseScheduling;
22 import com.ruoyi.service.ThreadJobService; 23 import com.ruoyi.service.ThreadJobService;
  24 +import com.ruoyi.utils.ConstDateUtil;
23 import org.apache.commons.io.FilenameUtils; 25 import org.apache.commons.io.FilenameUtils;
24 import org.springframework.beans.factory.annotation.Autowired; 26 import org.springframework.beans.factory.annotation.Autowired;
25 import org.springframework.stereotype.Service; 27 import org.springframework.stereotype.Service;
26 import com.ruoyi.in.mapper.SignInMapper; 28 import com.ruoyi.in.mapper.SignInMapper;
27 import com.ruoyi.in.domain.SignIn; 29 import com.ruoyi.in.domain.SignIn;
28 import com.ruoyi.in.service.ISignInService; 30 import com.ruoyi.in.service.ISignInService;
29 -import sun.misc.BASE64Decoder;  
30 31
31 import javax.annotation.Resource; 32 import javax.annotation.Resource;
32 33
  34 +import static com.ruoyi.common.ErrorTypeProperties.*;
33 import static com.ruoyi.common.SignInEnum.*; 35 import static com.ruoyi.common.SignInEnum.*;
34 36
35 /** 37 /**
@@ -43,6 +45,9 @@ public class SignInServiceImpl implements ISignInService { @@ -43,6 +45,9 @@ public class SignInServiceImpl implements ISignInService {
43 @Autowired 45 @Autowired
44 private SignInMapper signInMapper; 46 private SignInMapper signInMapper;
45 47
  48 + @Autowired
  49 + private RedisCache redisCache;
  50 +
46 @Resource 51 @Resource
47 private ThreadJobService threadJobConfig; 52 private ThreadJobService threadJobConfig;
48 53
@@ -124,16 +129,63 @@ public class SignInServiceImpl implements ISignInService { @@ -124,16 +129,63 @@ public class SignInServiceImpl implements ISignInService {
124 129
125 @Override 130 @Override
126 public AjaxResult addSignIn(SignIn signIn) throws IOException { 131 public AjaxResult addSignIn(SignIn signIn) throws IOException {
  132 + String resultMsg = "签到成功";
127 if (!StringUtils.isNotEmpty(signIn.getDeviceId())){ 133 if (!StringUtils.isNotEmpty(signIn.getDeviceId())){
128 throw new RuntimeException("设备号不能为空"); 134 throw new RuntimeException("设备号不能为空");
129 } 135 }
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 - } 136 + // 签到检查
  137 +// checkSignIn(signIn);
134 // base64转图片 138 // base64转图片
135 signIn.setCreateTime(new Date()); 139 signIn.setCreateTime(new Date());
136 signIn.setIp(IpUtils.getIpAddr()); 140 signIn.setIp(IpUtils.getIpAddr());
  141 + uploadImage(signIn);
  142 + signInMapper.insertSignIn(signIn);
  143 + return signIn.getStatus().equals(SIGN_IN_SUCCESS) ? AjaxResult.success(SIGN_IN_SUCCESS_STRING): AjaxResult.error(SIGN_IN_ERROR + signIn.getRemark());
  144 + }
  145 +
  146 + private void checkSignIn(SignIn signIn) {
  147 + // TODO 更具工号获取人员信息
  148 + Driver driver = getDriverInfoByJobCode(signIn.getJobCode());
  149 + // TODO 排班校验 非司售未作
  150 + checkWorkDay(signIn,driver.getPersonnelType());
  151 + // TODO 超时校验
  152 + checkTimeOut(signIn,driver);
  153 + // 酒精测试校验
  154 + if (ALCOHOL_FLAG_YES.equals(signIn.getAlcoholFlag())){
  155 + signIn.setStatus(signIn.getAlcoholIntake().compareTo(new BigDecimal(20)) < 0 ? SIGN_IN_SUCCESS : SIGN_IN_FAIL);
  156 + signIn.setRemark(signIn.getStatus().equals(SIGN_IN_FAIL) ? ALCOHOL_SIGN_IN_ERROR : "");
  157 + }
  158 + }
  159 +
  160 + private Driver getDriverInfoByJobCode(String jobCode) {
  161 + return new Driver();
  162 + }
  163 +
  164 + private void checkWorkDay(SignIn signIn, String personnelType) {
  165 + switch (personnelType){
  166 + case "0":
  167 + // 查询工号对应的排班 司售人员
  168 + List<ResponseScheduling> jobs= redisCache.getCacheMapValue(ConstDateUtil.formatDate("yyyyMMdd"),signIn.getJobCode());
  169 + if (Objects.isNull(jobs)|| jobs.size() == 0){
  170 + signIn.setStatus(SIGN_IN_FAIL);
  171 + signIn.setRemark(WORK_DAY_ERROR);
  172 + }
  173 + break;
  174 + case "1":
  175 + // 查询工号对应的排班 非司售人员
  176 + // 查询数据库
  177 + break;
  178 + }
  179 +
  180 +
  181 + }
  182 +
  183 + private void checkTimeOut(SignIn signIn, Driver driver) {
  184 + // SIGN_IN_TIMEOUT 签到超时
  185 +
  186 + }
  187 +
  188 + private void uploadImage(SignIn signIn) throws IOException {
137 String base64 = signIn.getImage(); 189 String base64 = signIn.getImage();
138 // 图片路径 190 // 图片路径
139 String filePath = RuoYiConfig.getUploadPath(); 191 String filePath = RuoYiConfig.getUploadPath();
@@ -150,8 +202,6 @@ public class SignInServiceImpl implements ISignInService { @@ -150,8 +202,6 @@ public class SignInServiceImpl implements ISignInService {
150 signIn.setImage(pathFileName); 202 signIn.setImage(pathFileName);
151 // 异步上传文件 203 // 异步上传文件
152 threadJobConfig.startUpload(absPath,base64); 204 threadJobConfig.startUpload(absPath,base64);
153 - signInMapper.insertSignIn(signIn);  
154 - return signIn.getStatus().equals(SIGN_IN_SUCCESS) ? AjaxResult.success("签到成功"): AjaxResult.error("签到失败酒精测试超标");  
155 } 205 }
156 206
157 /** 207 /**
ruoyi-admin/src/main/resources/mapper/driver/DriverMapper.xml
@@ -22,6 +22,7 @@ @@ -22,6 +22,7 @@
22 <result property="remark" column="remark"/> 22 <result property="remark" column="remark"/>
23 <result property="lineName" column="line_name"/> 23 <result property="lineName" column="line_name"/>
24 <result property="lineCode" column="line_code"/> 24 <result property="lineCode" column="line_code"/>
  25 + <result property="updateTime" column="update_time"/>
25 </resultMap> 26 </resultMap>
26 27
27 <sql id="selectDriverVo"> 28 <sql id="selectDriverVo">
@@ -43,12 +44,13 @@ @@ -43,12 +44,13 @@
43 line_name, 44 line_name,
44 line_code, 45 line_code,
45 face_sign_in, 46 face_sign_in,
46 - image 47 + image,
  48 + update_time
47 from driver 49 from driver
48 </sql> 50 </sql>
49 <sql id="insertDriverVo"> 51 <sql id="insertDriverVo">
50 job_code 52 job_code
51 - , 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,face_sign_in,image 53 + , 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,face_sign_in,image,update_time
52 </sql> 54 </sql>
53 55
54 <select id="selectDriverList" parameterType="Driver" resultMap="DriverResult"> 56 <select id="selectDriverList" parameterType="Driver" resultMap="DriverResult">
@@ -290,7 +292,8 @@ @@ -290,7 +292,8 @@
290 #{item.lineName,jdbcType=VARCHAR}, 292 #{item.lineName,jdbcType=VARCHAR},
291 #{item.lineCode,jdbcType=VARCHAR}, 293 #{item.lineCode,jdbcType=VARCHAR},
292 #{item.faceSignIn}, 294 #{item.faceSignIn},
293 - #{item.image} 295 + #{item.image},
  296 + #{item.updateTime}
294 ) 297 )
295 </foreach> 298 </foreach>
296 on duplicate key update 299 on duplicate key update