Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
7e967d099e
|
|
@ -135,4 +135,8 @@ public class AppParamsDto {
|
|||
* 结束时间
|
||||
*/
|
||||
private String endTime;
|
||||
|
||||
private String file;
|
||||
|
||||
private String params;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,16 @@ package com.bonus.app.controller;
|
|||
import com.bonus.app.entity.BoxEntity;
|
||||
import com.bonus.app.entity.BraceletEntity;
|
||||
import com.bonus.app.service.BraceletService;
|
||||
import com.bonus.common.core.utils.BASE64DecodedMultipartFile;
|
||||
import com.bonus.common.core.utils.UploadCheckUtils;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.entity.app.AppParamsDto;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -23,7 +27,7 @@ import java.util.List;
|
|||
@RestController
|
||||
@RequestMapping("/bracelet/")
|
||||
@Slf4j
|
||||
public class BraceletController extends BaseController{
|
||||
public class BraceletController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
|
|
@ -32,13 +36,14 @@ public class BraceletController extends BaseController{
|
|||
/**
|
||||
* 查询班组
|
||||
* 所领取的手环箱
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getBoxListById")
|
||||
@SysLog(title = "手环管理", businessType = OperaType.QUERY, module = "基础管理->手环管理", details = "查询手环列表")
|
||||
@SysLog(title = "手环管理", businessType = OperaType.QUERY, module = "基础管理->手环管理", details = "查询手环列表")
|
||||
public AjaxResult getBoxListById(BoxEntity entity) {
|
||||
return service.getBoxListById(entity);
|
||||
return service.getBoxListById(entity);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -46,11 +51,12 @@ public class BraceletController extends BaseController{
|
|||
/**
|
||||
* 查询相关手环箱
|
||||
* 分配信息
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getBoxInfo")
|
||||
@SysLog(title = "手环管理", businessType = OperaType.QUERY, module = "基础管理->手环管理", details = "查询手环列表")
|
||||
@SysLog(title = "手环管理", businessType = OperaType.QUERY, module = "基础管理->手环管理", details = "查询手环列表")
|
||||
public AjaxResult getBoxInfo(BoxEntity entity) {
|
||||
return service.getBoxInfo(entity);
|
||||
}
|
||||
|
|
@ -58,11 +64,12 @@ public class BraceletController extends BaseController{
|
|||
/**
|
||||
* 发放手环查询接口
|
||||
* 分配信息
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getBoxToUser")
|
||||
@SysLog(title = "app->手环管理", businessType = OperaType.QUERY, module = "app->手环管理->手环管理", details = "查看手环发放信息")
|
||||
@SysLog(title = "app->手环管理", businessType = OperaType.QUERY, module = "app->手环管理->手环管理", details = "查看手环发放信息")
|
||||
public AjaxResult getBoxToUser(BoxEntity entity) {
|
||||
return service.getBoxToUser(entity);
|
||||
}
|
||||
|
|
@ -70,46 +77,55 @@ public class BraceletController extends BaseController{
|
|||
/**
|
||||
* 发放手环查询接口
|
||||
* 分配信息
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("sendBoxBracelet")
|
||||
@SysLog(title = "app->手环管理", businessType = OperaType.QUERY, module = "app->手环管理->发放手环", details = "发放手环")
|
||||
@SysLog(title = "app->手环管理", businessType = OperaType.QUERY, module = "app->手环管理->发放手环", details = "发放手环")
|
||||
public AjaxResult sendBoxBracelet(@RequestBody BoxEntity entity) {
|
||||
return service.sendBoxBracelet(entity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 归还手环箱查询
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getBoxBraceletUsed")
|
||||
@SysLog(title = "app->手环管理", businessType = OperaType.QUERY, module = "app->手环管理->归还手环", details = "查询手环使用信息")
|
||||
@SysLog(title = "app->手环管理", businessType = OperaType.QUERY, module = "app->手环管理->归还手环", details = "查询手环使用信息")
|
||||
public AjaxResult getBoxBraceletUsed(BoxEntity entity) {
|
||||
return service.getBoxBraceletUsed(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 归还手环箱查询
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("returnBoxBracelet")
|
||||
@SysLog(title = "app->手环管理", businessType = OperaType.QUERY, module = "app->手环管理->归还手环", details = "归还手环")
|
||||
@SysLog(title = "app->手环管理", businessType = OperaType.QUERY, module = "app->手环管理->归还手环", details = "归还手环")
|
||||
public AjaxResult returnBoxBracelet(@RequestBody BoxEntity entity) {
|
||||
return service.returnBoxBracelet(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 归还手环箱查询
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("addLsUser")
|
||||
@SysLog(title = "app->手环管理", businessType = OperaType.QUERY, module = "app->手环管理->新增临时人员", details = "新增临时人员")
|
||||
public AjaxResult addLsUser(@RequestParam(value = "file", required = false) MultipartFile file, String params) {
|
||||
return service.addLsUser(file,params);
|
||||
@SysLog(title = "app->手环管理", businessType = OperaType.QUERY, module = "app->手环管理->新增临时人员", details = "新增临时人员")
|
||||
public AjaxResult addLsUser(@RequestBody AppParamsDto dto) {
|
||||
MultipartFile fileData = BASE64DecodedMultipartFile.base64ToMultipart2(dto.getFile());
|
||||
String result = UploadCheckUtils.uploadImgVerify(fileData);
|
||||
if (StringUtils.isNotBlank(result)) {
|
||||
return AjaxResult.error(result);
|
||||
}
|
||||
return service.addLsUser(fileData, dto.getParams());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,11 @@ import com.bonus.app.entity.BraceletEntity;
|
|||
import com.bonus.app.entity.BraceletInfoEntity;
|
||||
import com.bonus.app.entity.LsUserEntity;
|
||||
import com.bonus.app.mapper.BraceletMapper;
|
||||
import com.bonus.common.core.constant.BusinessConstants;
|
||||
import com.bonus.common.core.constant.HttpStatus;
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.*;
|
||||
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||
import com.bonus.common.core.utils.uuid.IdUtils;
|
||||
|
|
@ -30,12 +32,11 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
|
@ -236,6 +237,7 @@ public class BraceletServiceImpl implements BraceletService{
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult addLsUser(MultipartFile file, String params) {
|
||||
try {
|
||||
if(ObjectUtils.isEmpty(file)){
|
||||
|
|
@ -293,14 +295,24 @@ public class BraceletServiceImpl implements BraceletService{
|
|||
R<Boolean> r= sourceService.addFileSource(fileVo, SecurityConstants.INNER);
|
||||
if(r.getData()){
|
||||
AjaxResult ajaxResult = addFaceToLibrary(BytesToMultipartFileUtil.multipartFileToBase64(file), FaceCodeUtil.ADD, "rs-" + user.getId());
|
||||
return ajaxResult;
|
||||
JSONObject data = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")));
|
||||
Integer code = data.getInteger("code");
|
||||
String msg = data.getString("msg");
|
||||
if (Objects.equals(code, BusinessConstants.SUCCESS_CODE)) {
|
||||
return AjaxResult.success("添加成功");
|
||||
}else{
|
||||
throw new ServiceException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return AjaxResult.error("添加失败");
|
||||
}catch (ServiceException e){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}catch (Exception e){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return AjaxResult.error("系统异常");
|
||||
|
|
|
|||
|
|
@ -3,7 +3,11 @@ server:
|
|||
port: 18089
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
spring:
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: -1
|
||||
max-request-size: -1
|
||||
application:
|
||||
# 应用名称
|
||||
name: bonus-app
|
||||
|
|
@ -13,7 +17,7 @@ spring:
|
|||
cloud:
|
||||
nacos:
|
||||
username: nacos
|
||||
password: Jjsp@nacos2023
|
||||
password: nacos
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
|
|
@ -27,3 +31,13 @@ spring:
|
|||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
logging:
|
||||
config: classpath:logback.xml
|
||||
log:
|
||||
level:
|
||||
root: info
|
||||
my: debug
|
||||
file: logs/sys-back.log
|
||||
maxsize: 30MB
|
||||
face:
|
||||
path: http://192.168.0.14:18017/
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ public interface PersonMgeMapper {
|
|||
* @author cwchen
|
||||
* @date 2024/8/12 13:12
|
||||
*/
|
||||
void updatePeoplePushStatus(Long id);
|
||||
void updatePeoplePushStatus(@Param("id") Long id,@Param("isPush")Integer isPush);
|
||||
|
||||
/**
|
||||
* 判断人员是否绑定了设备
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ public class ConsControlServiceImpl implements IConsControlService {
|
|||
@Override
|
||||
public AjaxResult getBallDeviceLists(BraceletParamsDto dto) {
|
||||
JSONArray resultTree = new JSONArray();
|
||||
JSONArray dataTree = new JSONArray();
|
||||
try {
|
||||
List<BallTreeVo> list = new ArrayList<>();
|
||||
list = mapper.getBallDeviceLists(dto);
|
||||
|
|
@ -74,10 +75,19 @@ public class ConsControlServiceImpl implements IConsControlService {
|
|||
}
|
||||
//构建球机树
|
||||
resultTree = BuildTreeUtil.listInfoToTree(JSONArray.parseArray(JSON.toJSONString(list)), "id", "parentId", "children");
|
||||
if (CollectionUtils.isNotEmpty(resultTree)) {
|
||||
for (int i = 0; i < resultTree.size(); i++) {
|
||||
JSONObject jsonObject = resultTree.getJSONObject(i);
|
||||
JSONArray children = jsonObject.getJSONArray("children");
|
||||
if (CollectionUtils.isNotEmpty(children)) {
|
||||
dataTree.add(jsonObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return AjaxResult.success(resultTree);
|
||||
return AjaxResult.success(dataTree);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -172,6 +182,7 @@ public class ConsControlServiceImpl implements IConsControlService {
|
|||
@Override
|
||||
public AjaxResult getPersonsTree(BraceletParamsDto dto) {
|
||||
JSONArray resultTree = new JSONArray();
|
||||
JSONArray dataTree = new JSONArray();
|
||||
try {
|
||||
List<PersonTreeVo> list = new ArrayList<>();
|
||||
list = mapper.getPersonsTree(dto);
|
||||
|
|
@ -190,10 +201,49 @@ public class ConsControlServiceImpl implements IConsControlService {
|
|||
}
|
||||
//构建人员树
|
||||
resultTree = BuildTreeUtil.listInfoToTree(JSONArray.parseArray(JSON.toJSONString(list)), "id", "parentId", "children");
|
||||
if (CollectionUtils.isNotEmpty(resultTree)) {
|
||||
for (int i = 0; i < resultTree.size(); i++) {
|
||||
JSONObject jsonObject = resultTree.getJSONObject(i);
|
||||
PersonTreeVo personTreeVo = jsonObject.toJavaObject(PersonTreeVo.class);
|
||||
// 检查第三层是否有子节点
|
||||
boolean hasChildren = hasChildrenAtLevel(personTreeVo, 2);
|
||||
if(hasChildren){
|
||||
dataTree.add(jsonObject);
|
||||
}
|
||||
// System.out.println("第四层是否有子节点: " + hasChildren); // 应输出 true,因为第二层有节点 4 和 5
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return AjaxResult.success(resultTree);
|
||||
return AjaxResult.success(dataTree);
|
||||
}
|
||||
|
||||
// 递归方法判断在特定层级下是否包含子节点
|
||||
public static boolean hasChildrenAtLevel(PersonTreeVo node, int level) {
|
||||
if (node == null) {
|
||||
return false;
|
||||
}
|
||||
if (level == 0) {
|
||||
return !node.getChildren().isEmpty();
|
||||
}
|
||||
return hasChildrenAtLevelInChildren(node.getChildren(), level - 1);
|
||||
}
|
||||
|
||||
// 递归子节点集合,查看在特定层级下是否有子节点
|
||||
private static boolean hasChildrenAtLevelInChildren(List<PersonTreeVo> nodes, int level) {
|
||||
for (PersonTreeVo child : nodes) {
|
||||
if (level == 0) {
|
||||
if (!child.getChildren().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (hasChildrenAtLevelInChildren(child.getChildren(), level - 1)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -334,16 +384,19 @@ public class ConsControlServiceImpl implements IConsControlService {
|
|||
mapper.delConfig();
|
||||
mapper.delConfigItems();
|
||||
if (Objects.equals(vo.getConfigType(), BusinessConstants.CONFIG_TYPE)) {
|
||||
if (StringUtils.isEmpty(vo.getTime())) {
|
||||
return AjaxResult.error("固定时间不能为空");
|
||||
}
|
||||
// 固定时间验证
|
||||
String[] timeArr = vo.getTime().split(",");
|
||||
if (timeArr.length > 10) {
|
||||
return AjaxResult.error("固定时间验证不能超过十个配置项");
|
||||
}
|
||||
for (String time : timeArr) {
|
||||
if (!TimeValidator.isValidTime(time)) {
|
||||
return AjaxResult.error("时间格式错误(HH:MM)");
|
||||
}
|
||||
}
|
||||
if (timeArr.length > 0) {
|
||||
return AjaxResult.error("固定时间验证不能超过时间配置项");
|
||||
}
|
||||
} else if (Objects.equals(vo.getConfigType(), BusinessConstants.CONFIG_TYPE2)) {
|
||||
// 间隔时间验证
|
||||
if (!TimeValidator.isValidTime2(vo.getTime())) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,181 @@
|
|||
package com.bonus.bracelet.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.nacos.shaded.com.google.common.collect.Maps;
|
||||
import com.bonus.common.core.utils.FaceCodeUtil;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.http.HttpUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class FaceInterUtilService {
|
||||
|
||||
/**
|
||||
* 新增人脸库
|
||||
*/
|
||||
public final static String addFace="updatedb";
|
||||
|
||||
@Value("${face.path}")
|
||||
public String faceUrl;
|
||||
|
||||
/**
|
||||
* 刷新人脸库
|
||||
*/
|
||||
public final static String refresh="refreshdb";
|
||||
/**
|
||||
* 识别人脸库
|
||||
*/
|
||||
public final static String sbface="facerecognition";
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
public AjaxResult addFace2(String image, String type, String id) {
|
||||
Map<String,Object> result= Maps.newHashMap();
|
||||
try{
|
||||
Map<String,Object> map= Maps.newHashMap();
|
||||
map.put("img",image);
|
||||
map.put("optMode",type);
|
||||
map.put("uniqueKey",id);
|
||||
String msg= HttpUtils.sendRequest(faceUrl+addFace,JSON.toJSONString(map),true);
|
||||
if(StringUtils.isNotEmpty(msg)){
|
||||
JSONObject json=JSON.parseObject(msg);
|
||||
String code=json.getString("code");
|
||||
String eMsg=json.getString("msg");
|
||||
if("30002".equals(code)){
|
||||
result.put("code",200);
|
||||
}else {
|
||||
result.put("code",201);
|
||||
}
|
||||
String msgCN= FaceCodeUtil.getCodeString(code);
|
||||
result.put("msg",msgCN);
|
||||
result.put("eMsg",eMsg);
|
||||
}else{
|
||||
result.put("code",201);
|
||||
result.put("msg","人脸识别接口异常!请检查人脸服务!");
|
||||
}
|
||||
AjaxResult.success(result);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return AjaxResult.error("人脸识别接口异常!请检查人脸服务!");
|
||||
|
||||
}
|
||||
/**
|
||||
* 人脸信进行修改
|
||||
* @param image
|
||||
* @param type
|
||||
* @param id ls-
|
||||
* bz-
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult addFace(String image, String type, String id) {
|
||||
Map<String,Object> result= Maps.newHashMap();
|
||||
try{
|
||||
Map<String,Object> map= Maps.newHashMap();
|
||||
map.put("img",image);
|
||||
map.put("optMode",type);
|
||||
map.put("uniqueKey",id);
|
||||
String msg= HttpUtils.sendRequest(faceUrl+addFace,JSON.toJSONString(map),true);
|
||||
if(StringUtils.isNotEmpty(msg)){
|
||||
JSONObject json=JSON.parseObject(msg);
|
||||
String code=json.getString("code");
|
||||
String eMsg=json.getString("msg");
|
||||
if("30002".equals(code)){
|
||||
result.put("code",200);
|
||||
}else {
|
||||
result.put("code",201);
|
||||
}
|
||||
String msgCN= FaceCodeUtil.getCodeString(code);
|
||||
result.put("msg",msgCN);
|
||||
result.put("eMsg",eMsg);
|
||||
}else{
|
||||
result.put("code",201);
|
||||
result.put("msg","人脸识别接口异常!请检查人脸服务!");
|
||||
}
|
||||
return AjaxResult.success(result);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return AjaxResult.error("人脸识别接口异常!请检查人脸服务!");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新图像库
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult refreshFace() {
|
||||
Map<String,Object> result= Maps.newHashMap();
|
||||
try{
|
||||
Map<String,Object> map= Maps.newHashMap();
|
||||
String msg= HttpUtils.sendRequest(faceUrl+refresh,JSON.toJSONString(map),true);
|
||||
if(StringUtils.isNotEmpty(msg)){
|
||||
JSONObject json=JSON.parseObject(msg);
|
||||
String code=json.getString("code");
|
||||
String eMsg=json.getString("msg");
|
||||
if("30002".equals(code)){
|
||||
result.put("code",200);
|
||||
result.put("msg","操作成功");
|
||||
}else {
|
||||
String msgCN= FaceCodeUtil.getCodeString(code);
|
||||
result.put("msg",msgCN);
|
||||
result.put("code",201);
|
||||
}
|
||||
result.put("eMsg",eMsg);
|
||||
}else{
|
||||
result.put("code",201);
|
||||
result.put("msg","人脸识别接口异常!请检查人脸服务!");
|
||||
}
|
||||
AjaxResult.success(result);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return AjaxResult.error("人脸识别接口异常!请检查人脸服务!");
|
||||
}
|
||||
|
||||
public AjaxResult verifyFace(String image) {
|
||||
Map<String,Object> result= Maps.newHashMap();
|
||||
try{
|
||||
Map<String,Object> map= Maps.newHashMap();
|
||||
map.put("img",image);
|
||||
String msg= HttpUtils.sendRequest(faceUrl+sbface,JSON.toJSONString(map),true);
|
||||
if(StringUtils.isNotEmpty(msg)){
|
||||
JSONObject json=JSON.parseObject(msg);
|
||||
String code=json.getString("code");
|
||||
String eMsg=json.getString("msg");
|
||||
//识别成功返回的数据
|
||||
if("30000".equals(code)){
|
||||
JSONArray jsonArray=json.getJSONArray("data");
|
||||
Object key= jsonArray.get(0);
|
||||
result.put("code",201);
|
||||
result.put("userId",key);
|
||||
result.put("msg","人脸识别成功");
|
||||
}else{
|
||||
result.put("code",201);
|
||||
String msgCN= FaceCodeUtil.getCodeString(code);
|
||||
result.put("msg",msgCN);
|
||||
result.put("eMsg",eMsg);
|
||||
result.put("userId","-9999");
|
||||
}
|
||||
}else{
|
||||
result.put("code",201);
|
||||
result.put("msg","人脸识别接口异常!请检查人脸服务!");
|
||||
}
|
||||
AjaxResult.success(result);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return AjaxResult.error("人脸识别接口异常!请检查人脸服务!");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
|
|||
private RemoteFileService remoteFileService;
|
||||
|
||||
@Autowired
|
||||
private FaceInterService faceInterService;
|
||||
private FaceInterUtilService faceInterService;
|
||||
|
||||
@Value("${file.temp_file_path}")
|
||||
private String tempFilePath;
|
||||
|
|
@ -182,10 +182,15 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
|
|||
mapper.addPerson(vo);
|
||||
delFileId = uploadFile(file, vo);
|
||||
// 添加人脸照片至人脸库
|
||||
AjaxResult ajaxResult = addFaceToLibrary(BytesToMultipartFileUtil.multipartFileToBase64(file), FaceCodeUtil.ADD, "rs-" + vo.getId());
|
||||
if (ajaxResult != null && Objects.equals((Integer) ajaxResult.get("code"), BusinessConstants.SUCCESS_CODE)) {
|
||||
AjaxResult ajaxResult = addFaceToLibrary(BytesToMultipartFileUtil.multipartFileToBase64(file), FaceCodeUtil.ADD, "bz-" + vo.getId());
|
||||
JSONObject data = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")));
|
||||
Integer code = data.getInteger("code");
|
||||
String msg = data.getString("msg");
|
||||
if (Objects.equals(code, BusinessConstants.SUCCESS_CODE)) {
|
||||
// 更新人脸库推送状态
|
||||
mapper.updatePeoplePushStatus(vo.getId());
|
||||
mapper.updatePeoplePushStatus(vo.getId(),1);
|
||||
}else{
|
||||
mapper.updatePeoplePushStatus(vo.getId(),0);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("新增人员", e);
|
||||
|
|
@ -249,19 +254,24 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
|
|||
mapper.editPerson(vo);
|
||||
delFileId = uploadFile(file, vo);
|
||||
if (StringUtils.isNotEmpty(vo.getDelFiles())) {
|
||||
String personImgBase64 = getPersonImgBase64(vo.getDelFiles());
|
||||
// 删除人脸库,添加人脸照片至人脸库
|
||||
AjaxResult delAjax = delFaceToLibrary(personImgBase64, FaceCodeUtil.DEL, "bz-" + vo.getId());
|
||||
AjaxResult ajaxResult = addFaceToLibrary(BytesToMultipartFileUtil.multipartFileToBase64(file), FaceCodeUtil.ADD, "bz-" + vo.getId());
|
||||
JSONObject data = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")));
|
||||
Integer code = data.getInteger("code");
|
||||
String msg = data.getString("msg");
|
||||
if (Objects.equals(code, BusinessConstants.SUCCESS_CODE)) {
|
||||
// 更新人脸库推送状态
|
||||
mapper.updatePeoplePushStatus(vo.getId(),1);
|
||||
}else{
|
||||
mapper.updatePeoplePushStatus(vo.getId(),0);
|
||||
}
|
||||
String[] delFiles = vo.getDelFiles().split(",");
|
||||
for (String fileId : delFiles) {
|
||||
resourceFileMapper.delResourceFile(vo.getFileId());
|
||||
remoteFileService.delFile(fileId, SecurityConstants.INNER);
|
||||
}
|
||||
String personImgBase64 = getPersonImgBase64(vo.getDelFiles());
|
||||
// 删除人脸库,添加人脸照片至人脸库
|
||||
delFaceToLibrary(personImgBase64, FaceCodeUtil.DEL, "rs-" + vo.getId());
|
||||
AjaxResult ajaxResult = addFaceToLibrary(BytesToMultipartFileUtil.multipartFileToBase64(file), FaceCodeUtil.ADD, "rs-" + vo.getId());
|
||||
if (ajaxResult != null && Objects.equals((Integer) ajaxResult.get("code"), BusinessConstants.SUCCESS_CODE)) {
|
||||
// 更新人脸库推送状态
|
||||
mapper.updatePeoplePushStatus(vo.getId());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("修改人员", e);
|
||||
|
|
@ -353,11 +363,11 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
|
|||
}
|
||||
}
|
||||
mapper.delCertificate(dto);
|
||||
resourceFileMapper.delResourceFile(dto.getFileId());
|
||||
remoteFileService.delFile(dto.getFilePath(), SecurityConstants.INNER);
|
||||
// 删除人脸库
|
||||
String base64Data = getPersonImgBase64(dto.getFilePath());
|
||||
delFaceToLibrary(base64Data, FaceCodeUtil.DEL, "rs-" + dto.getId());
|
||||
AjaxResult delAjax = delFaceToLibrary(base64Data, FaceCodeUtil.DEL, "bz-" + dto.getId());
|
||||
resourceFileMapper.delResourceFile(dto.getFileId());
|
||||
remoteFileService.delFile(dto.getFilePath(), SecurityConstants.INNER);
|
||||
return AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
log.error("删除人员", e);
|
||||
|
|
@ -375,13 +385,16 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
|
|||
return AjaxResult.error("未上传人脸照片");
|
||||
}
|
||||
// 删除人脸库,添加人脸照片至人脸库
|
||||
delFaceToLibrary(base64Data, FaceCodeUtil.DEL, "rs-" + dto.getId());
|
||||
AjaxResult ajaxResult = addFaceToLibrary(base64Data, FaceCodeUtil.ADD, "rs-" + dto.getId());
|
||||
if (ajaxResult != null && Objects.equals((Integer) ajaxResult.get("code"), BusinessConstants.SUCCESS_CODE)) {
|
||||
delFaceToLibrary(base64Data, FaceCodeUtil.DEL, "bz-" + dto.getId());
|
||||
AjaxResult ajaxResult = addFaceToLibrary(base64Data, FaceCodeUtil.ADD, "bz-" + dto.getId());
|
||||
JSONObject data = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")));
|
||||
Integer code = data.getInteger("code");
|
||||
String msg = data.getString("msg");
|
||||
if (Objects.equals(code, BusinessConstants.SUCCESS_CODE)) {
|
||||
// 更新人脸库推送状态
|
||||
mapper.updatePeoplePushStatus(dto.getId());
|
||||
} else {
|
||||
return AjaxResult.error((String) ajaxResult.get("msg"));
|
||||
mapper.updatePeoplePushStatus(dto.getId(),1);
|
||||
}else{
|
||||
return AjaxResult.error(msg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
|
|
@ -488,13 +501,19 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
|
|||
vo.setPhone(Sm4Utils.encode(vo.getPhone()));
|
||||
mapper.addPerson(vo);
|
||||
// 推送人脸照片到人脸库,并更新推送状态
|
||||
AjaxResult ajaxResult = addFaceToLibrary(BytesToMultipartFileUtil.multipartFileToBase64(vo.getFile()), FaceCodeUtil.ADD, "rs-" + vo.getId());
|
||||
if (ajaxResult != null && Objects.equals((Integer) ajaxResult.get("code"), BusinessConstants.SUCCESS_CODE)) {
|
||||
mapper.updatePeoplePushStatus(vo.getId());
|
||||
AjaxResult ajaxResult = addFaceToLibrary(BytesToMultipartFileUtil.multipartFileToBase64(vo.getFile()), FaceCodeUtil.ADD, "bz-" + vo.getId());
|
||||
JSONObject data = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")));
|
||||
Integer code = data.getInteger("code");
|
||||
String msg = data.getString("msg");
|
||||
if (Objects.equals(code, BusinessConstants.SUCCESS_CODE)) {
|
||||
// 更新人脸库推送状态
|
||||
mapper.updatePeoplePushStatus(vo.getId(),1);
|
||||
}else{
|
||||
mapper.updatePeoplePushStatus(vo.getId(),0);
|
||||
}
|
||||
String delFileId = uploadFile(vo.getFile(), vo);
|
||||
errorFileLists.add(delFileId);
|
||||
errorIdLists.add("rs-" + vo.getId());
|
||||
errorIdLists.add("bz-" + vo.getId());
|
||||
}
|
||||
} catch (RuntimeException runtimeException) {
|
||||
if (runtimeException.getMessage() == null) {
|
||||
|
|
@ -519,10 +538,10 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
|
|||
@Override
|
||||
public AjaxResult getPersonFace(BraceletParamsDto dto) {
|
||||
if (StringUtils.isBlank(dto.getFilePath())) {
|
||||
return AjaxResult.success("查询成功",null);
|
||||
return AjaxResult.success("查询成功", null);
|
||||
}
|
||||
String imgBase64 = getPersonImgBase64(dto.getFilePath());
|
||||
return AjaxResult.success("查询成功",imgBase64);
|
||||
return AjaxResult.success("查询成功", imgBase64);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -58,23 +58,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
tp.create_time AS orderTime
|
||||
FROM tb_project tp
|
||||
WHERE tp.del_flag = 0
|
||||
UNION ALL
|
||||
UNION ALL
|
||||
SELECT
|
||||
tdu.id,
|
||||
td.id,
|
||||
CONCAT(tpe.name,'-',tpe.phone) AS label,
|
||||
td.dev_code AS devCode,
|
||||
IFNULL(td.dev_index,0) AS devIndex,
|
||||
tdu.pro_id AS parentId,
|
||||
tdl.pro_id AS parentId,
|
||||
tp.depart_id AS departId,
|
||||
IFNULL(td.dev_status,0) AS devStatus,
|
||||
tdub.ly_time AS orderTime
|
||||
FROM tb_dev_use tdu
|
||||
LEFT JOIN tb_dev_use_bid tdub ON tdu.id = tdub.id
|
||||
LEFT JOIN tb_project tp ON tp.id = tdu.pro_id AND tp.del_flag = 0
|
||||
LEFT JOIN tb_device td ON tdub.dev_id = td.id AND td.del_flag = 0
|
||||
LEFT JOIN tb_dev_ly tdl ON tdub.dev_id = tdl.dev_id
|
||||
tdl.ly_time AS orderTime
|
||||
FROM tb_device td
|
||||
LEFT JOIN tb_dev_ly tdl ON td.id = tdl.dev_id
|
||||
LEFT JOIN tb_people tpe ON tpe.id = tdl.ly_user AND tpe.del_flag = 0
|
||||
WHERE tdub.dev_type = 'ball' AND tdu.del_flag = 0 AND tdub.gh_time IS NULL
|
||||
LEFT JOIN tb_project tp ON tdl.pro_id = tp.id AND tp.del_flag = 0
|
||||
WHERE td.dev_type = 'ball' AND td.del_flag = 0 AND tdl.ly_user IS NOT NULL
|
||||
) a
|
||||
<where>
|
||||
<if test="roleCode!='administrators' and roleCode!='depart'">
|
||||
|
|
|
|||
|
|
@ -284,6 +284,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
<!--更新人脸库推送状态-->
|
||||
<update id="updatePeoplePushStatus">
|
||||
UPDATE tb_people SET is_push = 1 WHERE id = #{id}
|
||||
UPDATE tb_people SET is_push = #{isPush} WHERE id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue