问题修改
This commit is contained in:
parent
b9ab775fab
commit
ac7e7c9811
|
|
@ -3,6 +3,7 @@ package com.bonus.system.api;
|
|||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.constant.ServiceNameConstants;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.system.api.domain.BraceletImageVo;
|
||||
import com.bonus.system.api.domain.SysFile;
|
||||
import com.bonus.system.api.domain.SysTcpMessage;
|
||||
import com.bonus.system.api.factory.RemoteFileFallbackFactory;
|
||||
|
|
@ -20,8 +21,11 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
@FeignClient(contextId = "RemoteTcpService", value = ServiceNameConstants.TCP_SERVICE, fallbackFactory = RemoteTcpFallbackFactory.class)
|
||||
public interface RemoteTcpService {
|
||||
|
||||
@GetMapping(value = "/netty/setMessage")
|
||||
@PostMapping(value = "/netty/setMessage")
|
||||
public R setMessage(@RequestBody SysTcpMessage sysTcpMessage, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
@PostMapping(value = "/bracelet/openCamera")
|
||||
public R openCamera(@RequestBody BraceletImageVo vo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
package com.bonus.system.api.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 图片上传绑定业务逻辑
|
||||
*/
|
||||
@Data
|
||||
public class BraceletImageVo {
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
private String devCode;
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String image;
|
||||
/**
|
||||
* 维度
|
||||
*/
|
||||
private String lat;
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private String lon;
|
||||
/**
|
||||
* 心率
|
||||
*/
|
||||
private String heartRate;
|
||||
/**
|
||||
* 血压
|
||||
*/
|
||||
private String bloodPressure;
|
||||
/**
|
||||
* 温度
|
||||
*/
|
||||
private String temperature;
|
||||
/**
|
||||
* 电量
|
||||
*/
|
||||
private String quantity;
|
||||
|
||||
/**
|
||||
* 海拔
|
||||
*/
|
||||
private String altitude;
|
||||
|
||||
private String dataCode;
|
||||
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 设备id
|
||||
*/
|
||||
private String devId;
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.bonus.system.api.factory;
|
|||
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.system.api.RemoteTcpService;
|
||||
import com.bonus.system.api.domain.BraceletImageVo;
|
||||
import com.bonus.system.api.domain.SysTcpMessage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -25,6 +26,11 @@ public class RemoteTcpFallbackFactory implements FallbackFactory<RemoteTcpServic
|
|||
public R setMessage(SysTcpMessage sysTcpMessage, String source) {
|
||||
return R.fail("近电感应设备设置失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R openCamera(BraceletImageVo vo, String source) {
|
||||
return R.fail("人脸验证抽检失败:" + throwable.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import com.bonus.common.entity.bracelet.vo.*;
|
|||
import com.bonus.common.security.utils.ValidatorsUtils;
|
||||
import com.bonus.system.api.RemoteFileService;
|
||||
import com.bonus.system.api.RemoteTcpService;
|
||||
import com.bonus.system.api.domain.BraceletImageVo;
|
||||
import com.bonus.system.api.domain.SysFile;
|
||||
import com.bonus.system.api.domain.SysTcpMessage;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
|
@ -356,48 +357,33 @@ public class ConsControlServiceImpl implements IConsControlService {
|
|||
if (CollectionUtils.isEmpty(dto.getSpotCheckList())) {
|
||||
return AjaxResult.error("未选择班组人员,进行手环人脸验证");
|
||||
}
|
||||
for (BraceletParamsDto.SpotCheckInfo info : dto.getSpotCheckList()) {
|
||||
if (info.getUserId() == null) {
|
||||
return AjaxResult.error("人员ID不能为空");
|
||||
}
|
||||
if (info.getUserType() == null) {
|
||||
return AjaxResult.error("人员类型不能为空");
|
||||
}
|
||||
if (StringUtils.isBlank(info.getDevCode())) {
|
||||
return AjaxResult.error("设备级联编码不能为空");
|
||||
}
|
||||
if (StringUtils.isBlank(info.getShCode())) {
|
||||
return AjaxResult.error("手环编码不能为空");
|
||||
}
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
List<BraceletParamsDto.SpotCheckInfo> spotCheckList = dto.getSpotCheckList();
|
||||
for (BraceletParamsDto.SpotCheckInfo spotCheckInfo : spotCheckList) {
|
||||
if(StringUtils.isNotBlank(spotCheckInfo.getShCode())){
|
||||
sb.append(spotCheckInfo.getShCode()).append("@");
|
||||
if(StringUtils.isNotBlank(spotCheckInfo.getDevCode())){
|
||||
sb.append(spotCheckInfo.getDevCode()).append("@");
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(sb) && (sb.lastIndexOf("@") == sb.length() - 1)){
|
||||
sb.delete(sb.lastIndexOf("@"),sb.length());
|
||||
}
|
||||
// 批量下发手环人脸验证指令
|
||||
if(StringUtils.isNotBlank(sb.toString())){
|
||||
// 批量下发手环人脸验证指令
|
||||
BraceletImageVo vo = new BraceletImageVo();
|
||||
vo.setDevCode(sb.toString());
|
||||
R result = remoteTcpService.openCamera(vo, SecurityConstants.INNER);
|
||||
log.info("调用结果:code:{},msg:{}", result.getCode(),result.getMsg());
|
||||
if (result != null && result.getCode() == HttpStatus.SUCCESS) {
|
||||
return AjaxResult.success(result.getMsg());
|
||||
} else {
|
||||
return AjaxResult.error(result.getMsg());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return AjaxResult.success("已下达手环人脸验证抽检指令");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("str").append("@").append("bstr").append("@");
|
||||
System.out.println(sb.lastIndexOf("@"));
|
||||
System.out.println(sb.length() - 1);
|
||||
if(sb.lastIndexOf("@") == sb.length() - 1){
|
||||
sb.delete(sb.lastIndexOf("@"),sb.length());
|
||||
}
|
||||
System.err.println(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult checkConfig(CheckConfigVo vo) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue