Commit 33ad5ee1335f227aaae78c65bbde0b17209444e9
1 parent
5a9235bc
fix: 修改注释内容
Showing
11 changed files
with
146 additions
and
299 deletions
ruoyi-admin/admin-dockerfile
ruoyi-admin/src/main/java/com/ruoyi/common/ErrorTypeProperties.java
| ... | ... | @@ -6,4 +6,7 @@ package com.ruoyi.common; |
| 6 | 6 | public interface ErrorTypeProperties { |
| 7 | 7 | String SIGN_IN_ERROR = "签到异常"; |
| 8 | 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 | 25 | Integer SIGN_IN_SUCCESS = 1; |
| 26 | 26 | String SIGN_IN_FAIL_STRING = "签到异常"; |
| 27 | 27 | Integer SIGN_IN_FAIL = 2; |
| 28 | - | |
| 28 | + /** | |
| 29 | + * 酒精测试开启 | |
| 30 | + */ | |
| 29 | 31 | Integer ALCOHOL_FLAG_YES = 1; |
| 30 | 32 | String ALCOHOL_FLAG_YES_STRING = "已测试"; |
| 31 | 33 | Integer ALCOHOL_FLAG_NO = 2; | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/driver/controller/DriverController.java
ruoyi-admin/src/main/java/com/ruoyi/driver/domain/Driver.java
| ... | ... | @@ -3,11 +3,15 @@ package com.ruoyi.driver.domain; |
| 3 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| 4 | 4 | import io.swagger.annotations.ApiModel; |
| 5 | 5 | import io.swagger.annotations.ApiModelProperty; |
| 6 | +import io.swagger.annotations.ApiOperation; | |
| 6 | 7 | import lombok.Data; |
| 7 | 8 | import org.apache.commons.lang3.builder.ToStringBuilder; |
| 8 | 9 | import org.apache.commons.lang3.builder.ToStringStyle; |
| 9 | 10 | import com.ruoyi.common.annotation.Excel; |
| 10 | 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 | 17 | * 驾驶员信息对象 driver |
| ... | ... | @@ -137,5 +141,8 @@ public class Driver extends BaseEntity { |
| 137 | 141 | */ |
| 138 | 142 | @ApiModelProperty("头像") |
| 139 | 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 | 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 | 6 | import org.apache.commons.lang3.builder.ToStringBuilder; |
| 4 | 7 | import org.apache.commons.lang3.builder.ToStringStyle; |
| 5 | 8 | import com.ruoyi.common.annotation.Excel; |
| ... | ... | @@ -11,6 +14,8 @@ import com.ruoyi.common.core.domain.BaseEntity; |
| 11 | 14 | * @author guzijian |
| 12 | 15 | * @date 2023-07-05 |
| 13 | 16 | */ |
| 17 | +@ApiModel("设备异常记录对象") | |
| 18 | +@Data | |
| 14 | 19 | public class EquipmentException extends BaseEntity |
| 15 | 20 | { |
| 16 | 21 | private static final long serialVersionUID = 1L; |
| ... | ... | @@ -20,91 +25,27 @@ public class EquipmentException extends BaseEntity |
| 20 | 25 | |
| 21 | 26 | /** 标题 */ |
| 22 | 27 | @Excel(name = "标题") |
| 28 | + @ApiModelProperty("标题") | |
| 23 | 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 | 30 | /** 设备id */ |
| 34 | 31 | @Excel(name = "设备id") |
| 32 | + @ApiModelProperty("设备号") | |
| 35 | 33 | private String deviceId; |
| 36 | 34 | |
| 37 | 35 | /** 上报人 */ |
| 38 | 36 | @Excel(name = "上报人") |
| 37 | + @ApiModelProperty("上报人员工号") | |
| 39 | 38 | private String jobCode; |
| 40 | 39 | |
| 41 | 40 | /** 设备图片 */ |
| 42 | 41 | @Excel(name = "设备图片") |
| 42 | + @ApiModelProperty("设备图片地址") | |
| 43 | 43 | private String image; |
| 44 | 44 | |
| 45 | 45 | /** 处理状态 */ |
| 46 | 46 | @Excel(name = "处理状态") |
| 47 | + @ApiModelProperty("处理状态") | |
| 47 | 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 | 3 | import java.util.List; |
| 4 | 4 | import javax.servlet.http.HttpServletResponse; |
| 5 | 5 | |
| 6 | +import io.swagger.annotations.Api; | |
| 7 | +import io.swagger.annotations.ApiOperation; | |
| 6 | 8 | import org.springframework.security.access.prepost.PreAuthorize; |
| 7 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | 10 | import org.springframework.web.bind.annotation.GetMapping; |
| ... | ... | @@ -30,6 +32,7 @@ import com.ruoyi.common.core.page.TableDataInfo; |
| 30 | 32 | */ |
| 31 | 33 | @RestController |
| 32 | 34 | @RequestMapping("/equipment/equipment") |
| 35 | +@Api(tags = "设备管理接口") | |
| 33 | 36 | public class EquipmentController extends BaseController { |
| 34 | 37 | @Autowired |
| 35 | 38 | private IEquipmentService equipmentService; |
| ... | ... | @@ -39,6 +42,7 @@ public class EquipmentController extends BaseController { |
| 39 | 42 | */ |
| 40 | 43 | // @PreAuthorize("@ss.hasPermi('equipment:equipment:list')") |
| 41 | 44 | @GetMapping("/list") |
| 45 | + @ApiOperation("查询设备信息列表") | |
| 42 | 46 | public TableDataInfo list(Equipment equipment) { |
| 43 | 47 | startPage(); |
| 44 | 48 | List<Equipment> list = equipmentService.selectEquipmentList(equipment); |
| ... | ... | @@ -51,6 +55,7 @@ public class EquipmentController extends BaseController { |
| 51 | 55 | // @PreAuthorize("@ss.hasPermi('equipment:equipment:export')") |
| 52 | 56 | @Log(title = "设备信息", businessType = BusinessType.EXPORT) |
| 53 | 57 | @PostMapping("/export") |
| 58 | + @ApiOperation("导出设备信息列表") | |
| 54 | 59 | public void export(HttpServletResponse response, Equipment equipment) { |
| 55 | 60 | List<Equipment> list = equipmentService.selectEquipmentList(equipment); |
| 56 | 61 | ExcelUtil<Equipment> util = new ExcelUtil<Equipment>(Equipment.class); |
| ... | ... | @@ -62,6 +67,7 @@ public class EquipmentController extends BaseController { |
| 62 | 67 | */ |
| 63 | 68 | // @PreAuthorize("@ss.hasPermi('equipment:equipment:query')") |
| 64 | 69 | @GetMapping(value = "/{id}") |
| 70 | + @ApiOperation("获取设备信息详细信息") | |
| 65 | 71 | public AjaxResult getInfo(@PathVariable("id") Long id) { |
| 66 | 72 | return success(equipmentService.selectEquipmentById(id)); |
| 67 | 73 | } |
| ... | ... | @@ -72,6 +78,7 @@ public class EquipmentController extends BaseController { |
| 72 | 78 | // @PreAuthorize("@ss.hasPermi('equipment:equipment:add')") |
| 73 | 79 | @Log(title = "设备信息", businessType = BusinessType.INSERT) |
| 74 | 80 | @PostMapping |
| 81 | + @ApiOperation("新增设备信息") | |
| 75 | 82 | public AjaxResult add(@RequestBody Equipment equipment) { |
| 76 | 83 | return toAjax(equipmentService.insertEquipment(equipment)); |
| 77 | 84 | } |
| ... | ... | @@ -82,6 +89,7 @@ public class EquipmentController extends BaseController { |
| 82 | 89 | // @PreAuthorize("@ss.hasPermi('equipment:equipment:edit')") |
| 83 | 90 | @Log(title = "设备信息", businessType = BusinessType.UPDATE) |
| 84 | 91 | @PutMapping |
| 92 | + @ApiOperation("修改设备信息") | |
| 85 | 93 | public AjaxResult edit(@RequestBody Equipment equipment) { |
| 86 | 94 | return toAjax(equipmentService.updateEquipment(equipment)); |
| 87 | 95 | } |
| ... | ... | @@ -92,6 +100,7 @@ public class EquipmentController extends BaseController { |
| 92 | 100 | // @PreAuthorize("@ss.hasPermi('equipment:equipment:remove')") |
| 93 | 101 | @Log(title = "设备信息", businessType = BusinessType.DELETE) |
| 94 | 102 | @DeleteMapping("/{ids}") |
| 103 | + @ApiOperation("删除设备信息") | |
| 95 | 104 | public AjaxResult remove(@PathVariable Long[] ids) { |
| 96 | 105 | return toAjax(equipmentService.deleteEquipmentByIds(ids)); |
| 97 | 106 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/equipment/domain/Equipment.java
| 1 | 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 | 7 | import org.apache.commons.lang3.builder.ToStringBuilder; |
| 4 | 8 | import org.apache.commons.lang3.builder.ToStringStyle; |
| 5 | 9 | import com.ruoyi.common.annotation.Excel; |
| ... | ... | @@ -11,6 +15,8 @@ import com.ruoyi.common.core.domain.BaseEntity; |
| 11 | 15 | * @author guzijian |
| 12 | 16 | * @date 2023-07-05 |
| 13 | 17 | */ |
| 18 | +@ApiModel("设备信息对象") | |
| 19 | +@Data | |
| 14 | 20 | public class Equipment extends BaseEntity |
| 15 | 21 | { |
| 16 | 22 | private static final long serialVersionUID = 1L; |
| ... | ... | @@ -20,121 +26,37 @@ public class Equipment extends BaseEntity |
| 20 | 26 | |
| 21 | 27 | /** 场地名称 */ |
| 22 | 28 | @Excel(name = "场地名称") |
| 29 | + @ApiModelProperty("场地名称") | |
| 23 | 30 | private String siteName; |
| 24 | 31 | |
| 25 | 32 | /** 安置地址 */ |
| 26 | 33 | @Excel(name = "安置地址") |
| 34 | + @ApiModelProperty("安置地址") | |
| 27 | 35 | private String address; |
| 28 | 36 | |
| 29 | 37 | /** 设备ip */ |
| 30 | 38 | @Excel(name = "设备ip") |
| 39 | + @ApiModelProperty("设备ip") | |
| 31 | 40 | private String ip; |
| 32 | 41 | |
| 33 | 42 | /** 设备状态 */ |
| 34 | 43 | @Excel(name = "设备状态") |
| 44 | + @ApiModelProperty("设备状态") | |
| 35 | 45 | private Integer status; |
| 36 | 46 | |
| 37 | 47 | /** 设备权限 */ |
| 38 | - @Excel(name = "设备权限 ") | |
| 48 | + @Excel(name = "设备权限") | |
| 49 | + @ApiModelProperty("设备权限") | |
| 39 | 50 | private String promise; |
| 40 | 51 | |
| 41 | 52 | /** 设备图片 */ |
| 42 | 53 | @Excel(name = "设备图片") |
| 54 | + @ApiModelProperty("设备图片") | |
| 43 | 55 | private String image; |
| 44 | 56 | |
| 45 | 57 | /** 设备号 */ |
| 46 | 58 | @Excel(name = "设备号") |
| 59 | + @ApiModelProperty("设备号") | |
| 47 | 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 | 5 | |
| 6 | 6 | import io.swagger.annotations.ApiModel; |
| 7 | 7 | import io.swagger.annotations.ApiModelProperty; |
| 8 | +import lombok.Data; | |
| 8 | 9 | import org.apache.commons.lang3.builder.ToStringBuilder; |
| 9 | 10 | import org.apache.commons.lang3.builder.ToStringStyle; |
| 10 | 11 | import com.ruoyi.common.annotation.Excel; |
| ... | ... | @@ -16,16 +17,20 @@ import com.ruoyi.common.core.domain.BaseEntity; |
| 16 | 17 | * @author guzijian |
| 17 | 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 | 23 | private static final long serialVersionUID = 1L; |
| 23 | 24 | |
| 24 | - /** 主键 */ | |
| 25 | + /** | |
| 26 | + * 主键 | |
| 27 | + */ | |
| 25 | 28 | @ApiModelProperty("主键") |
| 26 | 29 | private Long id; |
| 27 | 30 | |
| 28 | - /** 工号 */ | |
| 31 | + /** | |
| 32 | + * 工号 | |
| 33 | + */ | |
| 29 | 34 | @Excel(name = "工号") |
| 30 | 35 | @ApiModelProperty("工号") |
| 31 | 36 | private String jobCode; |
| ... | ... | @@ -33,147 +38,49 @@ public class SignIn extends BaseEntity |
| 33 | 38 | @Excel(name = "设备号") |
| 34 | 39 | @ApiModelProperty("设备号") |
| 35 | 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 | 44 | @Excel(name = "设备地址") |
| 47 | 45 | @ApiModelProperty("设备ip 不用填写") |
| 48 | 46 | private String ip; |
| 49 | - | |
| 50 | - /** 图片 */ | |
| 47 | + /** | |
| 48 | + * 图片 | |
| 49 | + */ | |
| 51 | 50 | @Excel(name = "图片") |
| 52 | 51 | @ApiModelProperty("图片信息") |
| 53 | 52 | private String image; |
| 54 | - /** 签到结果 */ | |
| 53 | + /** | |
| 54 | + * 签到结果 | |
| 55 | + */ | |
| 55 | 56 | @Excel(name = "签到结果") |
| 56 | 57 | @ApiModelProperty("签到结果 1 成功 2 异常") |
| 57 | 58 | private Integer status; |
| 58 | - | |
| 59 | - /** 签到类型 */ | |
| 59 | + /** | |
| 60 | + * 签到类型 | |
| 61 | + */ | |
| 60 | 62 | @Excel(name = "签到类型") |
| 61 | 63 | @ApiModelProperty("签到类型 1 人脸 2 刷卡 3 其他 4 酒精 用可以多选 用,拼接 如 1,2,3,4") |
| 62 | 64 | private String singnIn; |
| 63 | - | |
| 64 | - /** 酒精测试 */ | |
| 65 | + /** | |
| 66 | + * 酒精测试 | |
| 67 | + */ | |
| 65 | 68 | @Excel(name = "酒精测试") |
| 66 | 69 | @ApiModelProperty("酒精测试 1 已测试 2 未测试") |
| 67 | 70 | private Integer alcoholFlag; |
| 68 | 71 | |
| 69 | - /** 签到签退 */ | |
| 72 | + /** | |
| 73 | + * 签到签退 | |
| 74 | + */ | |
| 70 | 75 | @Excel(name = "签到签退") |
| 71 | 76 | @ApiModelProperty("签到签退 1 签到成功 2 签退成功") |
| 72 | 77 | private Integer type; |
| 73 | 78 | |
| 74 | - /** 酒精摄入量 */ | |
| 79 | + /** | |
| 80 | + * 酒精摄入量 | |
| 81 | + */ | |
| 75 | 82 | @Excel(name = "酒精摄入量") |
| 76 | 83 | @ApiModelProperty("酒精摄入量 52.12") |
| 77 | 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 | 1 | package com.ruoyi.in.service.impl; |
| 2 | 2 | |
| 3 | 3 | import java.io.File; |
| 4 | -import java.io.FileOutputStream; | |
| 5 | 4 | import java.io.IOException; |
| 6 | 5 | import java.math.BigDecimal; |
| 7 | 6 | import java.util.Base64; |
| ... | ... | @@ -12,24 +11,27 @@ import java.util.Objects; |
| 12 | 11 | import com.ruoyi.common.config.RuoYiConfig; |
| 13 | 12 | import com.ruoyi.common.constant.Constants; |
| 14 | 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 | 15 | import com.ruoyi.common.utils.DateUtils; |
| 17 | 16 | import com.ruoyi.common.SignInEnum; |
| 18 | 17 | import com.ruoyi.common.utils.StringUtils; |
| 19 | 18 | import com.ruoyi.common.utils.ip.IpUtils; |
| 20 | 19 | import com.ruoyi.common.utils.uuid.Seq; |
| 21 | 20 | import com.ruoyi.common.utils.uuid.UUID; |
| 21 | +import com.ruoyi.driver.domain.Driver; | |
| 22 | +import com.ruoyi.pojo.response.ResponseScheduling; | |
| 22 | 23 | import com.ruoyi.service.ThreadJobService; |
| 24 | +import com.ruoyi.utils.ConstDateUtil; | |
| 23 | 25 | import org.apache.commons.io.FilenameUtils; |
| 24 | 26 | import org.springframework.beans.factory.annotation.Autowired; |
| 25 | 27 | import org.springframework.stereotype.Service; |
| 26 | 28 | import com.ruoyi.in.mapper.SignInMapper; |
| 27 | 29 | import com.ruoyi.in.domain.SignIn; |
| 28 | 30 | import com.ruoyi.in.service.ISignInService; |
| 29 | -import sun.misc.BASE64Decoder; | |
| 30 | 31 | |
| 31 | 32 | import javax.annotation.Resource; |
| 32 | 33 | |
| 34 | +import static com.ruoyi.common.ErrorTypeProperties.*; | |
| 33 | 35 | import static com.ruoyi.common.SignInEnum.*; |
| 34 | 36 | |
| 35 | 37 | /** |
| ... | ... | @@ -43,6 +45,9 @@ public class SignInServiceImpl implements ISignInService { |
| 43 | 45 | @Autowired |
| 44 | 46 | private SignInMapper signInMapper; |
| 45 | 47 | |
| 48 | + @Autowired | |
| 49 | + private RedisCache redisCache; | |
| 50 | + | |
| 46 | 51 | @Resource |
| 47 | 52 | private ThreadJobService threadJobConfig; |
| 48 | 53 | |
| ... | ... | @@ -124,16 +129,63 @@ public class SignInServiceImpl implements ISignInService { |
| 124 | 129 | |
| 125 | 130 | @Override |
| 126 | 131 | public AjaxResult addSignIn(SignIn signIn) throws IOException { |
| 132 | + String resultMsg = "签到成功"; | |
| 127 | 133 | if (!StringUtils.isNotEmpty(signIn.getDeviceId())){ |
| 128 | 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 | 138 | // base64转图片 |
| 135 | 139 | signIn.setCreateTime(new Date()); |
| 136 | 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 | 189 | String base64 = signIn.getImage(); |
| 138 | 190 | // 图片路径 |
| 139 | 191 | String filePath = RuoYiConfig.getUploadPath(); |
| ... | ... | @@ -150,8 +202,6 @@ public class SignInServiceImpl implements ISignInService { |
| 150 | 202 | signIn.setImage(pathFileName); |
| 151 | 203 | // 异步上传文件 |
| 152 | 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 | 22 | <result property="remark" column="remark"/> |
| 23 | 23 | <result property="lineName" column="line_name"/> |
| 24 | 24 | <result property="lineCode" column="line_code"/> |
| 25 | + <result property="updateTime" column="update_time"/> | |
| 25 | 26 | </resultMap> |
| 26 | 27 | |
| 27 | 28 | <sql id="selectDriverVo"> |
| ... | ... | @@ -43,12 +44,13 @@ |
| 43 | 44 | line_name, |
| 44 | 45 | line_code, |
| 45 | 46 | face_sign_in, |
| 46 | - image | |
| 47 | + image, | |
| 48 | + update_time | |
| 47 | 49 | from driver |
| 48 | 50 | </sql> |
| 49 | 51 | <sql id="insertDriverVo"> |
| 50 | 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 | 54 | </sql> |
| 53 | 55 | |
| 54 | 56 | <select id="selectDriverList" parameterType="Driver" resultMap="DriverResult"> |
| ... | ... | @@ -290,7 +292,8 @@ |
| 290 | 292 | #{item.lineName,jdbcType=VARCHAR}, |
| 291 | 293 | #{item.lineCode,jdbcType=VARCHAR}, |
| 292 | 294 | #{item.faceSignIn}, |
| 293 | - #{item.image} | |
| 295 | + #{item.image}, | |
| 296 | + #{item.updateTime} | |
| 294 | 297 | ) |
| 295 | 298 | </foreach> |
| 296 | 299 | on duplicate key update | ... | ... |