修改下发班组任务信息
This commit is contained in:
parent
ac55f5d5f3
commit
b8232f69dd
|
|
@ -5,7 +5,7 @@ spring:
|
||||||
name: bonus-auth
|
name: bonus-auth
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: local
|
active: prod
|
||||||
|
|
||||||
#加密组件
|
#加密组件
|
||||||
jasypt:
|
jasypt:
|
||||||
|
|
|
||||||
|
|
@ -1,47 +1,43 @@
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
port: 38080
|
port: 18080
|
||||||
servlet:
|
servlet:
|
||||||
context-path: hd-real-name
|
context-path: hd-real-name
|
||||||
|
|
||||||
# Spring
|
|
||||||
spring:
|
spring:
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
|
username: nacos
|
||||||
|
password: nacos
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 192.168.0.14:8848
|
server-addr: 192.168.0.14:8848
|
||||||
namespace: huadong_realname_dev
|
namespace: huadong_realname_local
|
||||||
|
username: nacos
|
||||||
|
password: nacos
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 192.168.0.14:8848
|
server-addr: 192.168.0.14:8848
|
||||||
namespace: huadong_realname_dev
|
namespace: huadong_realname_local
|
||||||
|
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
shared-configs:
|
shared-configs:
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
username: nacos
|
|
||||||
password: nacos
|
|
||||||
sentinel:
|
sentinel:
|
||||||
# 取消控制台懒加载
|
# 取消控制台懒加载
|
||||||
eager: true
|
eager: true
|
||||||
transport:
|
transport:
|
||||||
# 控制台地址
|
# 控制台地址
|
||||||
dashboard: 127.0.0.1:18858
|
dashboard: 192.168.0.16:18858
|
||||||
# nacos配置持久化
|
# nacos配置持久化
|
||||||
datasource:
|
datasource:
|
||||||
ds1:
|
ds1:
|
||||||
nacos:
|
nacos:
|
||||||
server-addr: 127.0.0.1:18848
|
server-addr: 192.168.0.16:18848
|
||||||
namespace: rela_name_system
|
namespace: bonus-ai
|
||||||
dataId: sentinel-bonus-gateway
|
dataId: sentinel-bonus-gateway
|
||||||
groupId: DEFAULT_GROUP
|
groupId: DEFAULT_GROUP
|
||||||
data-type: json
|
data-type: json
|
||||||
rule-type: gw-flow
|
rule-type: gw-flow
|
||||||
|
|
||||||
#加密组件
|
|
||||||
jasypt:
|
|
||||||
encryptor:
|
|
||||||
password: Encrypt
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,6 @@ spring:
|
||||||
jasypt:
|
jasypt:
|
||||||
encryptor:
|
encryptor:
|
||||||
password: Encrypt
|
password: Encrypt
|
||||||
|
#人脸
|
||||||
face:
|
face:
|
||||||
path: http://112.29.103.165:1616/faceIdentification
|
path: http://112.29.103.165:1616/faceIdentification
|
||||||
|
|
@ -5,7 +5,7 @@ spring:
|
||||||
name: bonus-bmw
|
name: bonus-bmw
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: local
|
active: dev
|
||||||
task:
|
task:
|
||||||
scheduling:
|
scheduling:
|
||||||
pool:
|
pool:
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ spring:
|
||||||
name: bonus-job
|
name: bonus-job
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: local
|
active: prod
|
||||||
|
|
||||||
#加密组件
|
#加密组件
|
||||||
jasypt:
|
jasypt:
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.urk.handle;
|
package com.bonus.urk.handle;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.bonus.common.core.urk.Constant;
|
import com.bonus.common.core.urk.Constant;
|
||||||
import com.bonus.common.core.urk.TaskStatusEnum;
|
import com.bonus.common.core.urk.TaskStatusEnum;
|
||||||
|
|
@ -35,7 +36,7 @@ public class ReceiveCmd {
|
||||||
try{
|
try{
|
||||||
//查询是否有任务处于未下发状态
|
//查询是否有任务处于未下发状态
|
||||||
List<DeviceTaskVo> taskList = service.selectCmdTaskList(deviceVo.getDevCode());
|
List<DeviceTaskVo> taskList = service.selectCmdTaskList(deviceVo.getDevCode());
|
||||||
if (CollectionUtil.isEmpty(taskList)) {
|
if (CollUtil.isEmpty(taskList)) {
|
||||||
log.info("设备:{}, 没有执行任务", deviceVo.getDevCode());
|
log.info("设备:{}, 没有执行任务", deviceVo.getDevCode());
|
||||||
resp.addHeader(Constant.DEVICE_HEADER_RESPONSE_CODE, Constant.ERROR_NO_CMD);
|
resp.addHeader(Constant.DEVICE_HEADER_RESPONSE_CODE, Constant.ERROR_NO_CMD);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.urk.mapper;
|
package com.bonus.urk.mapper;
|
||||||
|
|
||||||
|
import com.bonus.urk.vo.DevUserVo;
|
||||||
import com.bonus.urk.vo.KqCmdTaskVo;
|
import com.bonus.urk.vo.KqCmdTaskVo;
|
||||||
import com.bonus.urk.vo.KqDevUserIdVo;
|
import com.bonus.urk.vo.KqDevUserIdVo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
@ -64,4 +65,10 @@ public interface ResultMapper {
|
||||||
void delKqDevUser(@Param("list") List<String> userIds, @Param("deviceCode") String deviceCode);
|
void delKqDevUser(@Param("list") List<String> userIds, @Param("deviceCode") String deviceCode);
|
||||||
|
|
||||||
void insertKqDevUserList2(@Param("list") List<KqDevUserIdVo> userIds, @Param("deviceCode") String deviceCode);
|
void insertKqDevUserList2(@Param("list") List<KqDevUserIdVo> userIds, @Param("deviceCode") String deviceCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考情机人员数据
|
||||||
|
* @param list
|
||||||
|
*/
|
||||||
|
void addDeviceUserInfo(@Param("list")List<DevUserVo> list);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ import java.util.List;
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface TaskMapper {
|
public interface TaskMapper {
|
||||||
|
|
||||||
|
|
||||||
|
List<DeviceTaskVo> selectDelCmdTaskList(@Param("devCode") String devCode);
|
||||||
/**
|
/**
|
||||||
* 查询待执行的设备指令
|
* 查询待执行的设备指令
|
||||||
* @param devCode
|
* @param devCode
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,11 @@ import com.alibaba.fastjson.JSONObject;
|
||||||
import com.bonus.common.core.utils.StringUtils;
|
import com.bonus.common.core.utils.StringUtils;
|
||||||
import com.bonus.common.core.urk.CommonUtils;
|
import com.bonus.common.core.urk.CommonUtils;
|
||||||
import com.bonus.common.core.urk.Constant;
|
import com.bonus.common.core.urk.Constant;
|
||||||
|
import com.bonus.system.api.model.UploadFileVo;
|
||||||
import com.bonus.urk.mapper.ResultMapper;
|
import com.bonus.urk.mapper.ResultMapper;
|
||||||
|
import com.bonus.urk.minio.UrkMinioService;
|
||||||
|
import com.bonus.urk.vo.DevUserVo;
|
||||||
|
import com.bonus.urk.vo.DeviceUserDto;
|
||||||
import com.bonus.urk.vo.KqCmdTaskVo;
|
import com.bonus.urk.vo.KqCmdTaskVo;
|
||||||
import com.bonus.urk.vo.KqDevUserIdVo;
|
import com.bonus.urk.vo.KqDevUserIdVo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
@ -14,9 +18,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -30,6 +36,9 @@ public class ResultService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ResultMapper mapper;
|
private ResultMapper mapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UrkMinioService fileService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询任务 记录
|
* 查询任务 记录
|
||||||
* @param asTransId
|
* @param asTransId
|
||||||
|
|
@ -161,6 +170,27 @@ public class ResultService {
|
||||||
log.info("获取设备用户信息:{}", jsonStr);
|
log.info("获取设备用户信息:{}", jsonStr);
|
||||||
if(StringUtils.isNotBlank(jsonStr)) {
|
if(StringUtils.isNotBlank(jsonStr)) {
|
||||||
//数据处理
|
//数据处理
|
||||||
|
JSONObject json=JSON.parseObject(jsonStr);
|
||||||
|
List<DevUserVo> list=new ArrayList<>();
|
||||||
|
JSONArray users=json.getJSONArray("users");
|
||||||
|
for (int i=0;i<users.size();i++) {
|
||||||
|
String deviceCode=taskVo.getDeviceCode();
|
||||||
|
String userId=users.getJSONObject(i).getString("userId");
|
||||||
|
DevUserVo dto=new DevUserVo();
|
||||||
|
String face=users.getJSONObject(i).getString("face");
|
||||||
|
String id=deviceCode+"-"+userId;
|
||||||
|
UploadFileVo uploadFileVo=fileService.upload("dev_face",id,"考勤机照片","face",face,null);
|
||||||
|
if(uploadFileVo!=null){
|
||||||
|
dto.setImagePath(uploadFileVo.getPath());
|
||||||
|
}
|
||||||
|
String name=users.getJSONObject(i).getString("name");
|
||||||
|
dto.setUserId(userId);
|
||||||
|
dto.setName(name);
|
||||||
|
dto.setDeviceCode(deviceCode);
|
||||||
|
dto.setId(id);
|
||||||
|
list.add(dto);
|
||||||
|
}
|
||||||
|
mapper.addDeviceUserInfo(list);
|
||||||
}
|
}
|
||||||
resp.addHeader(Constant.DEVICE_HEADER_RESPONSE_CODE, Constant.OK);
|
resp.addHeader(Constant.DEVICE_HEADER_RESPONSE_CODE, Constant.OK);
|
||||||
resp.addHeader(Constant.DEVICE_HEADER_TRANS_ID, taskVo.getId());
|
resp.addHeader(Constant.DEVICE_HEADER_TRANS_ID, taskVo.getId());
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.urk.service;
|
package com.bonus.urk.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
|
@ -409,16 +410,10 @@ public class TaskService {
|
||||||
// body
|
// body
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
List<String> userSends = mapper.getTaskUserList(task.getId());
|
List<String> userSends = mapper.getTaskUserList(task.getId());
|
||||||
if(CollectionUtil.isEmpty(userSends)) {
|
if(!CollUtil.isEmpty(userSends)) {
|
||||||
String msg = "获取设备用户信息用户发送请求数据为空,不能处理";
|
|
||||||
log.error(msg);
|
|
||||||
task.setTransStatus(TaskStatusEnum.ERROR.ordinal());
|
|
||||||
task.setMsg(msg);
|
|
||||||
mapper.updateById(task);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String[] userIds = userSends.toArray(new String[0]);
|
String[] userIds = userSends.toArray(new String[0]);
|
||||||
jsonObject.put("usersId", userIds);
|
jsonObject.put("usersId", userIds);
|
||||||
|
}
|
||||||
body = jsonObject.toString();
|
body = jsonObject.toString();
|
||||||
try {
|
try {
|
||||||
// head
|
// head
|
||||||
|
|
@ -487,10 +482,16 @@ public class TaskService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DeviceTaskVo> selectCmdTaskList(String devCode) {
|
public List<DeviceTaskVo> selectCmdTaskList(String devCode) {
|
||||||
List<DeviceTaskVo> list= mapper.selectCmdTaskList(devCode);
|
//优先查询删除的
|
||||||
|
List<DeviceTaskVo> list= mapper.selectDelCmdTaskList(devCode);
|
||||||
|
if(list==null || list.isEmpty()){
|
||||||
|
list= mapper.selectCmdTaskList(devCode);
|
||||||
if(StringUtils.isEmpty(list)){
|
if(StringUtils.isEmpty(list)){
|
||||||
list= mapper.selectCmdBlockTask(devCode);
|
list= mapper.selectCmdBlockTask(devCode);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.bonus.urk.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DevUserVo {
|
||||||
|
/**
|
||||||
|
* 设备编码
|
||||||
|
*/
|
||||||
|
private String deviceCode;
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private String userId;
|
||||||
|
/**
|
||||||
|
* 图片路径
|
||||||
|
*/
|
||||||
|
private String imagePath;
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡号
|
||||||
|
*/
|
||||||
|
private String card;
|
||||||
|
/**
|
||||||
|
* 校验开始时间
|
||||||
|
*/
|
||||||
|
private String vaildStart;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验结束时间
|
||||||
|
*/
|
||||||
|
private String vaildEnd;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -47,6 +47,7 @@ public class DeviceUserDto implements Serializable {
|
||||||
private String vaildTimeStart;
|
private String vaildTimeStart;
|
||||||
//HHmmss
|
//HHmmss
|
||||||
private String vaildTimeEnd;
|
private String vaildTimeEnd;
|
||||||
|
|
||||||
private Integer photoEnroll;
|
private Integer photoEnroll;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
port: 38085
|
port: 38086
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
cloud:
|
cloud:
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,14 @@
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
servlet:
|
||||||
|
s
|
||||||
application:
|
application:
|
||||||
|
|
||||||
# 应用名称
|
# 应用名称
|
||||||
name: bonus-urk
|
name: bonus-urk
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: local
|
active: prod
|
||||||
task:
|
task:
|
||||||
scheduling:
|
scheduling:
|
||||||
pool:
|
pool:
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,14 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|
||||||
</insert>
|
</insert>
|
||||||
|
<insert id="addDeviceUserInfo">
|
||||||
|
replace into kq_user_list(
|
||||||
|
id, user_id,user_name, user_phone, card, vaild_start, vaild_end,dev_code
|
||||||
|
)values
|
||||||
|
<foreach collection="list" item="item" separator=",">
|
||||||
|
(#{item.id},#{item.userId},#{item.name},#{item.imagePath},#{item.card},#{item.vaildStart},#{item.vaildEnd},#{item.deviceCode})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
<update id="updateTaskById">
|
<update id="updateTaskById">
|
||||||
update kq_cmd_task set trans_status_update_time=#{updateTime},trans_status=#{transStatus}
|
update kq_cmd_task set trans_status_update_time=#{updateTime},trans_status=#{transStatus}
|
||||||
where id=#{id}
|
where id=#{id}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,19 @@
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
<select id="selectDelCmdTaskList" resultType="com.bonus.urk.vo.DeviceTaskVo">
|
||||||
|
select id, cmd_code cmdCode,
|
||||||
|
cmd_param cmdParam,
|
||||||
|
device_code deviceCode,
|
||||||
|
trans_status transStatus,
|
||||||
|
trans_status_update_time transStatus,
|
||||||
|
create_time createTime,
|
||||||
|
update_state
|
||||||
|
from kq_cmd_task
|
||||||
|
where device_code=#{devCode} and trans_status in (0,3) and cmd_code='DELETE_USER'
|
||||||
|
ORDER BY RAND()
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectCmdTaskList" resultType="com.bonus.urk.vo.DeviceTaskVo">
|
<select id="selectCmdTaskList" resultType="com.bonus.urk.vo.DeviceTaskVo">
|
||||||
select id, cmd_code cmdCode,
|
select id, cmd_code cmdCode,
|
||||||
cmd_param cmdParam,
|
cmd_param cmdParam,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue