双屏消费机参数配置修改、查询接口
This commit is contained in:
parent
5d1ca83851
commit
1050a759d4
|
|
@ -0,0 +1,42 @@
|
|||
package com.bonus.canteen.core.device.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.db.handler.StringHandler;
|
||||
import com.bonus.canteen.core.device.service.ParamSettingService;
|
||||
import com.bonus.canteen.core.device.vo.ParamSettingVO;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.codehaus.groovy.tools.StringHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Api(tags = "后台-参数设置")
|
||||
@RestController
|
||||
@RequestMapping("/paramSetting")
|
||||
public class ParamSettingController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ParamSettingService service;
|
||||
|
||||
@ApiOperation("更新参数设置")
|
||||
@PostMapping({"/update"})
|
||||
public AjaxResult updateDevice(@RequestBody @Valid ParamSettingVO dto) {
|
||||
if (ObjectUtil.isNull(dto.getId()) || ObjectUtil.isEmpty(dto.getId())){
|
||||
throw new ServiceException("参数id不能为空");
|
||||
}
|
||||
this.service.update(dto);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取参数")
|
||||
@PostMapping(value = "/getInfo")
|
||||
public AjaxResult getInfo() {
|
||||
return success(service.getInfo());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.bonus.canteen.core.device.mapper;
|
||||
|
||||
import com.bonus.canteen.core.device.vo.ParamSettingVO;
|
||||
|
||||
public interface ParamSettingMapper {
|
||||
void update(ParamSettingVO dto);
|
||||
|
||||
ParamSettingVO getInfo();
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.bonus.canteen.core.device.service;
|
||||
|
||||
import com.bonus.canteen.core.device.vo.ParamSettingVO;
|
||||
|
||||
public interface ParamSettingService {
|
||||
void update(ParamSettingVO dto);
|
||||
|
||||
ParamSettingVO getInfo();
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.bonus.canteen.core.device.service.impl;
|
||||
|
||||
import com.bonus.canteen.core.device.mapper.ParamSettingMapper;
|
||||
import com.bonus.canteen.core.device.service.ParamSettingService;
|
||||
import com.bonus.canteen.core.device.vo.ParamSettingVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ParamSettingServiceImpl implements ParamSettingService {
|
||||
@Autowired
|
||||
private ParamSettingMapper mapper;
|
||||
@Override
|
||||
public void update(ParamSettingVO dto) {
|
||||
mapper.update(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParamSettingVO getInfo() {
|
||||
return mapper.getInfo();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.bonus.canteen.core.device.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class ParamSettingVO {
|
||||
@ApiModelProperty("参数id")
|
||||
private Integer id;
|
||||
@ApiModelProperty("IP地址")
|
||||
@NotBlank(message = "IP地址不能为空")
|
||||
private String ipAddress;
|
||||
@ApiModelProperty("人脸识别通过率")
|
||||
@NotBlank(message = "人脸识别通过率不能为空")
|
||||
private String facePassRate;
|
||||
@ApiModelProperty("MQTT地址")
|
||||
@NotBlank(message = "MQTT地址不能为空")
|
||||
private String mqttAddress;
|
||||
@ApiModelProperty("MQTT用户名")
|
||||
@NotBlank(message = "MQTT用户名不能为空")
|
||||
private String mqttUserName;
|
||||
@ApiModelProperty("MQTT密码")
|
||||
@NotBlank(message = "MQTT密码不能为空")
|
||||
private String mqttPassword;
|
||||
@ApiModelProperty("APP_ID")
|
||||
@NotBlank(message = "人脸引擎APP_ID不能为空")
|
||||
private String appId;
|
||||
@ApiModelProperty("APP_KEY")
|
||||
@NotBlank(message = "人脸引擎APP_KEY不能为空")
|
||||
private String appKey;
|
||||
@ApiModelProperty("PHOTO_PREFIXES")
|
||||
@NotBlank(message = "照片前缀不能为空")
|
||||
private String photoPrefixes;
|
||||
@ApiModelProperty("version")
|
||||
private String version;
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.canteen.core.device.mapper.ParamSettingMapper">
|
||||
<update id="update">
|
||||
update param_setting
|
||||
set ip_address = #{ipAddress},
|
||||
face_pass_rate = #{facePassRate},
|
||||
mqtt_address = #{mqttAddress},
|
||||
mqtt_user_name = #{mqttUserName},
|
||||
mqtt_pass_word = #{mqttPassword},
|
||||
app_id = #{appId},
|
||||
app_key = #{appKey},
|
||||
photo_prefixes = #{photoPrefixes},
|
||||
version = #{version} + 1
|
||||
where id = #{id}
|
||||
</update>
|
||||
<select id="getInfo" resultType="com.bonus.canteen.core.device.vo.ParamSettingVO">
|
||||
select id,
|
||||
ip_address as ipAddress,
|
||||
face_pass_rate as facePassRate,
|
||||
mqtt_address as mqttAddress,
|
||||
mqtt_user_name as mqttUserName,
|
||||
mqtt_pass_word as mqttPassword,
|
||||
app_id as appId,
|
||||
app_key as appKey,
|
||||
photo_prefixes as photoPrefixes,
|
||||
version
|
||||
from param_setting
|
||||
limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue