Commit 4b54669e568b239b64b4f8fab3dfaebaecdd384f
1 parent
156e4063
fix: update object
Showing
8 changed files
with
87 additions
and
37 deletions
ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java
| ... | ... | @@ -2,6 +2,14 @@ package com.ruoyi; |
| 2 | 2 | |
| 3 | 3 | import org.springframework.boot.builder.SpringApplicationBuilder; |
| 4 | 4 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
| 5 | +import org.springframework.http.HttpEntity; | |
| 6 | +import org.springframework.http.HttpHeaders; | |
| 7 | +import org.springframework.http.HttpMethod; | |
| 8 | +import org.springframework.http.ResponseEntity; | |
| 9 | +import org.springframework.web.client.RestTemplate; | |
| 10 | + | |
| 11 | +import java.util.HashMap; | |
| 12 | +import java.util.Map; | |
| 5 | 13 | |
| 6 | 14 | /** |
| 7 | 15 | * web容器中进行部署 |
| ... | ... | @@ -15,4 +23,22 @@ public class RuoYiServletInitializer extends SpringBootServletInitializer |
| 15 | 23 | { |
| 16 | 24 | return application.sources(RuoYiApplication.class); |
| 17 | 25 | } |
| 26 | + | |
| 27 | + // 测试方法 | |
| 28 | + public static void main(String[] args) { | |
| 29 | + RestTemplate restTemplate = new RestTemplate(); | |
| 30 | + String url = "http://1.14.107.94:8100/driver/driver"; | |
| 31 | + HttpHeaders headers = new HttpHeaders(); | |
| 32 | + headers.set("Authorization", "Bearer eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImNhOGRhOGJlLWQ0ZjItNDhjMy05ZWU1LWJkMDQzYzY3YzQ0MyJ9.79b8JM31faxhLnIqu6xGtrx1JK019NoN26AwNfPzptYSriHSTABdYp16kzKD538wo2HfXhYoviSqy4qZfoEV5Q"); | |
| 33 | + Map<String, String> requestBody = new HashMap<>(); | |
| 34 | + requestBody.put("jobCode", "asdfasd"); | |
| 35 | + requestBody.put("personnelName", "asdfasdf"); | |
| 36 | + | |
| 37 | + HttpEntity<Map<String, String>> entity = new HttpEntity<>(requestBody, headers); | |
| 38 | + | |
| 39 | + ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.POST, entity, String.class); | |
| 40 | + | |
| 41 | + String responseBody = response.getBody(); | |
| 42 | + System.out.println(responseBody); | |
| 43 | + } | |
| 18 | 44 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/in/controller/SignInController.java
| ... | ... | @@ -2,9 +2,6 @@ package com.ruoyi.in.controller; |
| 2 | 2 | |
| 3 | 3 | import java.util.List; |
| 4 | 4 | import javax.servlet.http.HttpServletResponse; |
| 5 | - | |
| 6 | -import io.swagger.annotations.Api; | |
| 7 | -import io.swagger.annotations.ApiOperation; | |
| 8 | 5 | import org.springframework.security.access.prepost.PreAuthorize; |
| 9 | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | 7 | import org.springframework.web.bind.annotation.GetMapping; |
| ... | ... | @@ -28,11 +25,10 @@ import com.ruoyi.common.core.page.TableDataInfo; |
| 28 | 25 | * 签到Controller |
| 29 | 26 | * |
| 30 | 27 | * @author guzijian |
| 31 | - * @date 2023-07-04 | |
| 28 | + * @date 2023-07-05 | |
| 32 | 29 | */ |
| 33 | 30 | @RestController |
| 34 | 31 | @RequestMapping("/in/in") |
| 35 | -@Api(tags = "签到管理") | |
| 36 | 32 | public class SignInController extends BaseController |
| 37 | 33 | { |
| 38 | 34 | @Autowired |
| ... | ... | @@ -43,7 +39,6 @@ public class SignInController extends BaseController |
| 43 | 39 | */ |
| 44 | 40 | @PreAuthorize("@ss.hasPermi('in:in:list')") |
| 45 | 41 | @GetMapping("/list") |
| 46 | - @ApiOperation("查询签到列表") | |
| 47 | 42 | public TableDataInfo list(SignIn signIn) |
| 48 | 43 | { |
| 49 | 44 | startPage(); |
| ... | ... | @@ -57,7 +52,6 @@ public class SignInController extends BaseController |
| 57 | 52 | @PreAuthorize("@ss.hasPermi('in:in:export')") |
| 58 | 53 | @Log(title = "签到", businessType = BusinessType.EXPORT) |
| 59 | 54 | @PostMapping("/export") |
| 60 | - @ApiOperation("导出签到列表") | |
| 61 | 55 | public void export(HttpServletResponse response, SignIn signIn) |
| 62 | 56 | { |
| 63 | 57 | List<SignIn> list = signInService.selectSignInList(signIn); |
| ... | ... | @@ -70,7 +64,6 @@ public class SignInController extends BaseController |
| 70 | 64 | */ |
| 71 | 65 | @PreAuthorize("@ss.hasPermi('in:in:query')") |
| 72 | 66 | @GetMapping(value = "/{id}") |
| 73 | - @ApiOperation("获取签到详细信息") | |
| 74 | 67 | public AjaxResult getInfo(@PathVariable("id") Long id) |
| 75 | 68 | { |
| 76 | 69 | return success(signInService.selectSignInById(id)); |
| ... | ... | @@ -82,7 +75,6 @@ public class SignInController extends BaseController |
| 82 | 75 | @PreAuthorize("@ss.hasPermi('in:in:add')") |
| 83 | 76 | @Log(title = "签到", businessType = BusinessType.INSERT) |
| 84 | 77 | @PostMapping |
| 85 | - @ApiOperation("新增签到") | |
| 86 | 78 | public AjaxResult add(@RequestBody SignIn signIn) |
| 87 | 79 | { |
| 88 | 80 | return toAjax(signInService.insertSignIn(signIn)); |
| ... | ... | @@ -94,7 +86,6 @@ public class SignInController extends BaseController |
| 94 | 86 | @PreAuthorize("@ss.hasPermi('in:in:edit')") |
| 95 | 87 | @Log(title = "签到", businessType = BusinessType.UPDATE) |
| 96 | 88 | @PutMapping |
| 97 | - @ApiOperation("修改签到") | |
| 98 | 89 | public AjaxResult edit(@RequestBody SignIn signIn) |
| 99 | 90 | { |
| 100 | 91 | return toAjax(signInService.updateSignIn(signIn)); |
| ... | ... | @@ -106,7 +97,6 @@ public class SignInController extends BaseController |
| 106 | 97 | @PreAuthorize("@ss.hasPermi('in:in:remove')") |
| 107 | 98 | @Log(title = "签到", businessType = BusinessType.DELETE) |
| 108 | 99 | @DeleteMapping("/{ids}") |
| 109 | - @ApiOperation("删除签到") | |
| 110 | 100 | public AjaxResult remove(@PathVariable Long[] ids) |
| 111 | 101 | { |
| 112 | 102 | return toAjax(signInService.deleteSignInByIds(ids)); | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/in/domain/SignIn.java
| 1 | 1 | package com.ruoyi.in.domain; |
| 2 | 2 | |
| 3 | +import java.math.BigDecimal; | |
| 3 | 4 | import org.apache.commons.lang3.builder.ToStringBuilder; |
| 4 | 5 | import org.apache.commons.lang3.builder.ToStringStyle; |
| 5 | 6 | import com.ruoyi.common.annotation.Excel; |
| ... | ... | @@ -9,7 +10,7 @@ import com.ruoyi.common.core.domain.BaseEntity; |
| 9 | 10 | * 签到对象 sign_in |
| 10 | 11 | * |
| 11 | 12 | * @author guzijian |
| 12 | - * @date 2023-07-04 | |
| 13 | + * @date 2023-07-05 | |
| 13 | 14 | */ |
| 14 | 15 | public class SignIn extends BaseEntity |
| 15 | 16 | { |
| ... | ... | @@ -22,8 +23,8 @@ public class SignIn extends BaseEntity |
| 22 | 23 | @Excel(name = "工号") |
| 23 | 24 | private String jobCode; |
| 24 | 25 | |
| 25 | - /** 设备ip */ | |
| 26 | - @Excel(name = "设备ip") | |
| 26 | + /** 设备地址 */ | |
| 27 | + @Excel(name = "设备地址") | |
| 27 | 28 | private String ip; |
| 28 | 29 | |
| 29 | 30 | /** 图片 */ |
| ... | ... | @@ -42,10 +43,14 @@ public class SignIn extends BaseEntity |
| 42 | 43 | @Excel(name = "酒精测试") |
| 43 | 44 | private Integer alcoholFlag; |
| 44 | 45 | |
| 45 | - /** 签到类型 */ | |
| 46 | - @Excel(name = "签到类型") | |
| 46 | + /** 签到签退 */ | |
| 47 | + @Excel(name = "签到签退") | |
| 47 | 48 | private Integer type; |
| 48 | 49 | |
| 50 | + /** 酒精摄入量 */ | |
| 51 | + @Excel(name = "酒精摄入量") | |
| 52 | + private BigDecimal alcoholIntake; | |
| 53 | + | |
| 49 | 54 | public void setId(Long id) |
| 50 | 55 | { |
| 51 | 56 | this.id = id; |
| ... | ... | @@ -118,6 +123,15 @@ public class SignIn extends BaseEntity |
| 118 | 123 | { |
| 119 | 124 | return type; |
| 120 | 125 | } |
| 126 | + public void setAlcoholIntake(BigDecimal alcoholIntake) | |
| 127 | + { | |
| 128 | + this.alcoholIntake = alcoholIntake; | |
| 129 | + } | |
| 130 | + | |
| 131 | + public BigDecimal getAlcoholIntake() | |
| 132 | + { | |
| 133 | + return alcoholIntake; | |
| 134 | + } | |
| 121 | 135 | |
| 122 | 136 | @Override |
| 123 | 137 | public String toString() { |
| ... | ... | @@ -126,13 +140,14 @@ public class SignIn extends BaseEntity |
| 126 | 140 | .append("createTime", getCreateTime()) |
| 127 | 141 | .append("jobCode", getJobCode()) |
| 128 | 142 | .append("ip", getIp()) |
| 129 | - .append("updateTime", getUpdateTime()) | |
| 130 | 143 | .append("image", getImage()) |
| 131 | 144 | .append("status", getStatus()) |
| 132 | 145 | .append("updateBy", getUpdateBy()) |
| 133 | 146 | .append("singnIn", getSingnIn()) |
| 134 | 147 | .append("alcoholFlag", getAlcoholFlag()) |
| 135 | 148 | .append("type", getType()) |
| 149 | + .append("updateTime", getUpdateTime()) | |
| 150 | + .append("alcoholIntake", getAlcoholIntake()) | |
| 136 | 151 | .append("remark", getRemark()) |
| 137 | 152 | .toString(); |
| 138 | 153 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/in/mapper/SignInMapper.java
ruoyi-admin/src/main/java/com/ruoyi/in/service/ISignInService.java
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.util.List; |
| 4 | 4 | import com.ruoyi.common.utils.DateUtils; |
| 5 | 5 | import com.ruoyi.common.utils.SecurityUtils; |
| 6 | +import com.ruoyi.propertis.SignInEnum; | |
| 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | 8 | import org.springframework.stereotype.Service; |
| 8 | 9 | import com.ruoyi.in.mapper.SignInMapper; |
| ... | ... | @@ -13,7 +14,7 @@ import com.ruoyi.in.service.ISignInService; |
| 13 | 14 | * 签到Service业务层处理 |
| 14 | 15 | * |
| 15 | 16 | * @author guzijian |
| 16 | - * @date 2023-07-04 | |
| 17 | + * @date 2023-07-05 | |
| 17 | 18 | */ |
| 18 | 19 | @Service |
| 19 | 20 | public class SignInServiceImpl implements ISignInService |
| ... | ... | @@ -55,6 +56,7 @@ public class SignInServiceImpl implements ISignInService |
| 55 | 56 | public int insertSignIn(SignIn signIn) |
| 56 | 57 | { |
| 57 | 58 | signIn.setCreateTime(DateUtils.getNowDate()); |
| 59 | + signIn.setType(SignInEnum.SIGNIN); | |
| 58 | 60 | return signInMapper.insertSignIn(signIn); |
| 59 | 61 | } |
| 60 | 62 | |
| ... | ... | @@ -67,8 +69,8 @@ public class SignInServiceImpl implements ISignInService |
| 67 | 69 | @Override |
| 68 | 70 | public int updateSignIn(SignIn signIn) |
| 69 | 71 | { |
| 70 | - signIn.setUpdateTime(DateUtils.getNowDate()); | |
| 71 | 72 | signIn.setUpdateBy(SecurityUtils.getUsername()); |
| 73 | + signIn.setUpdateTime(DateUtils.getNowDate()); | |
| 72 | 74 | return signInMapper.updateSignIn(signIn); |
| 73 | 75 | } |
| 74 | 76 | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/propertis/SignInEnum.java
0 → 100644
ruoyi-admin/src/main/resources/mapper/in/SignInMapper.xml
| ... | ... | @@ -8,31 +8,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 8 | 8 | <result property="id" column="id" /> |
| 9 | 9 | <result property="createTime" column="create_time" /> |
| 10 | 10 | <result property="jobCode" column="jobCode" /> |
| 11 | - <result property="image" column="image" /> | |
| 12 | 11 | <result property="ip" column="ip" /> |
| 13 | - <result property="updateTime" column="update_time" /> | |
| 12 | + <result property="image" column="image" /> | |
| 14 | 13 | <result property="status" column="status" /> |
| 15 | 14 | <result property="updateBy" column="update_by" /> |
| 16 | 15 | <result property="singnIn" column="singn_in" /> |
| 17 | 16 | <result property="alcoholFlag" column="alcohol_flag" /> |
| 18 | 17 | <result property="type" column="type" /> |
| 18 | + <result property="updateTime" column="update_time" /> | |
| 19 | + <result property="alcoholIntake" column="alcohol_intake" /> | |
| 19 | 20 | <result property="remark" column="remark" /> |
| 20 | 21 | </resultMap> |
| 21 | 22 | |
| 22 | 23 | <sql id="selectSignInVo"> |
| 23 | - select id, create_time, jobCode, image, ip, update_time, status, update_by, singn_in, alcohol_flag, type, remark from sign_in | |
| 24 | + select id, create_time, jobCode, ip, image, status, update_by, singn_in, alcohol_flag, type, update_time, alcohol_intake, remark from sign_in | |
| 24 | 25 | </sql> |
| 25 | 26 | |
| 26 | 27 | <select id="selectSignInList" parameterType="SignIn" resultMap="SignInResult"> |
| 27 | 28 | <include refid="selectSignInVo"/> |
| 28 | 29 | <where> |
| 29 | 30 | <if test="jobCode != null and jobCode != ''"> and jobCode = #{jobCode}</if> |
| 30 | - <if test="image != null and image != ''"> and image = #{image}</if> | |
| 31 | 31 | <if test="ip != null and ip != ''"> and ip = #{ip}</if> |
| 32 | + <if test="image != null and image != ''"> and image = #{image}</if> | |
| 32 | 33 | <if test="status != null "> and status = #{status}</if> |
| 33 | 34 | <if test="singnIn != null and singnIn != ''"> and singn_in = #{singnIn}</if> |
| 34 | 35 | <if test="alcoholFlag != null "> and alcohol_flag = #{alcoholFlag}</if> |
| 35 | 36 | <if test="type != null "> and type = #{type}</if> |
| 37 | + <if test="alcoholIntake != null "> and alcohol_intake = #{alcoholIntake}</if> | |
| 36 | 38 | </where> |
| 37 | 39 | </select> |
| 38 | 40 | |
| ... | ... | @@ -45,28 +47,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 45 | 47 | insert into sign_in |
| 46 | 48 | <trim prefix="(" suffix=")" suffixOverrides=","> |
| 47 | 49 | <if test="createTime != null">create_time,</if> |
| 48 | - <if test="jobCode != null and jobCode != ''">jobCode,</if> | |
| 49 | - <if test="image != null and image != ''">image,</if> | |
| 50 | - <if test="ip != null and ip != ''">ip,</if> | |
| 51 | - <if test="updateTime != null">update_time,</if> | |
| 50 | + <if test="jobCode != null">jobCode,</if> | |
| 51 | + <if test="ip != null">ip,</if> | |
| 52 | + <if test="image != null">image,</if> | |
| 52 | 53 | <if test="status != null">status,</if> |
| 53 | 54 | <if test="updateBy != null">update_by,</if> |
| 54 | 55 | <if test="singnIn != null">singn_in,</if> |
| 55 | 56 | <if test="alcoholFlag != null">alcohol_flag,</if> |
| 56 | 57 | <if test="type != null">type,</if> |
| 58 | + <if test="updateTime != null">update_time,</if> | |
| 59 | + <if test="alcoholIntake != null">alcohol_intake,</if> | |
| 57 | 60 | <if test="remark != null">remark,</if> |
| 58 | 61 | </trim> |
| 59 | 62 | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| 60 | 63 | <if test="createTime != null">#{createTime},</if> |
| 61 | - <if test="jobCode != null and jobCode != ''">#{jobCode},</if> | |
| 62 | - <if test="image != null and image != ''">#{image},</if> | |
| 63 | - <if test="ip != null and ip != ''">#{ip},</if> | |
| 64 | - <if test="updateTime != null">#{updateTime},</if> | |
| 64 | + <if test="jobCode != null">#{jobCode},</if> | |
| 65 | + <if test="ip != null">#{ip},</if> | |
| 66 | + <if test="image != null">#{image},</if> | |
| 65 | 67 | <if test="status != null">#{status},</if> |
| 66 | 68 | <if test="updateBy != null">#{updateBy},</if> |
| 67 | 69 | <if test="singnIn != null">#{singnIn},</if> |
| 68 | 70 | <if test="alcoholFlag != null">#{alcoholFlag},</if> |
| 69 | 71 | <if test="type != null">#{type},</if> |
| 72 | + <if test="updateTime != null">#{updateTime},</if> | |
| 73 | + <if test="alcoholIntake != null">#{alcoholIntake},</if> | |
| 70 | 74 | <if test="remark != null">#{remark},</if> |
| 71 | 75 | </trim> |
| 72 | 76 | </insert> |
| ... | ... | @@ -75,15 +79,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 75 | 79 | update sign_in |
| 76 | 80 | <trim prefix="SET" suffixOverrides=","> |
| 77 | 81 | <if test="createTime != null">create_time = #{createTime},</if> |
| 78 | - <if test="jobCode != null and jobCode != ''">jobCode = #{jobCode},</if> | |
| 79 | - <if test="image != null and image != ''">image = #{image},</if> | |
| 80 | - <if test="ip != null and ip != ''">ip = #{ip},</if> | |
| 81 | - <if test="updateTime != null">update_time = #{updateTime},</if> | |
| 82 | + <if test="jobCode != null">jobCode = #{jobCode},</if> | |
| 83 | + <if test="ip != null">ip = #{ip},</if> | |
| 84 | + <if test="image != null">image = #{image},</if> | |
| 82 | 85 | <if test="status != null">status = #{status},</if> |
| 83 | 86 | <if test="updateBy != null">update_by = #{updateBy},</if> |
| 84 | 87 | <if test="singnIn != null">singn_in = #{singnIn},</if> |
| 85 | 88 | <if test="alcoholFlag != null">alcohol_flag = #{alcoholFlag},</if> |
| 86 | 89 | <if test="type != null">type = #{type},</if> |
| 90 | + <if test="updateTime != null">update_time = #{updateTime},</if> | |
| 91 | + <if test="alcoholIntake != null">alcohol_intake = #{alcoholIntake},</if> | |
| 87 | 92 | <if test="remark != null">remark = #{remark},</if> |
| 88 | 93 | </trim> |
| 89 | 94 | where id = #{id} | ... | ... |