修改下发班组任务信息
This commit is contained in:
parent
3316f1e66f
commit
81d02195d2
|
|
@ -1,15 +1,22 @@
|
|||
package com.bonus.bmw.controller;
|
||||
|
||||
import com.bonus.bmw.domain.vo.BmWorkerWageCard;
|
||||
import com.bonus.bmw.domain.vo.KqCmdBean;
|
||||
import com.bonus.bmw.service.KqCmdService;
|
||||
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.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.annotation.InnerAuth;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.common.security.annotation.RequiresPermissionsOrInnerAuth;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考勤机操作控制层
|
||||
|
|
@ -60,23 +67,19 @@ public class KqCmdController extends BaseController {
|
|||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取考勤机人员
|
||||
*
|
||||
* @param o 主键
|
||||
* @return 人员
|
||||
*/
|
||||
@GetMapping("getWorkerByDeviceId")
|
||||
|
||||
@GetMapping("/getWorkerByDeviceId")
|
||||
@SysLog(title = "获取考勤机人员", businessType = OperaType.QUERY, logType = 0, module = "获取考勤机人员", details = "获取考勤机人员")
|
||||
public AjaxResult getWorkerByDeviceId(KqCmdBean o) {
|
||||
public TableDataInfo getWorkerByDeviceId(KqCmdBean o) {
|
||||
try {
|
||||
return service.getUserByDeviceId(o);
|
||||
startPage();
|
||||
List<KqCmdBean> list = service.getUserByDeviceId(o);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工程考勤机人员列表
|
||||
*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
package com.bonus.bmw.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DeviceConfigVo {
|
||||
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
private String devCode;
|
||||
/**
|
||||
* 服务地址
|
||||
*/
|
||||
private String serverHost;
|
||||
/**
|
||||
* 服务端口
|
||||
*/
|
||||
private String serverPort;
|
||||
|
||||
/**
|
||||
* 心跳
|
||||
*/
|
||||
private String interval;
|
||||
/**
|
||||
* 推送地址
|
||||
*/
|
||||
private String pushServerHost;
|
||||
/**
|
||||
* 推送端口
|
||||
*/
|
||||
private String pushServerPort;
|
||||
/**
|
||||
* 是否开启推送 yes/no
|
||||
*/
|
||||
private String pushEnable;
|
||||
|
||||
|
||||
private String json;
|
||||
}
|
||||
|
|
@ -9,10 +9,29 @@ import java.util.Date;
|
|||
*/
|
||||
@Data
|
||||
public class KqCmdBean {
|
||||
|
||||
private String userPhoto;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private String userId;
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
private String devCode;
|
||||
/**
|
||||
* 人员名称
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 是否在库
|
||||
*/
|
||||
private String isOnDataBase;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer id;
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 指令编码
|
||||
|
|
@ -48,6 +67,10 @@ public class KqCmdBean {
|
|||
* 消息内容
|
||||
*/
|
||||
private String msg;
|
||||
/**
|
||||
* 人脸图片
|
||||
*/
|
||||
private String faceImage;
|
||||
|
||||
/**
|
||||
* 工程id
|
||||
|
|
|
|||
|
|
@ -10,6 +10,11 @@ public interface KqCmdMapper {
|
|||
|
||||
List<KqCmdBean> getProKqjTree(KqCmdBean o);
|
||||
|
||||
/**
|
||||
* 查询考情机人员
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
List<KqCmdBean> getUserByDeviceId(KqCmdBean o);
|
||||
|
||||
List<KqCmdBean> getProDeviceWorker(KqCmdBean o);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.bmw.mapper;
|
|||
|
||||
import com.bonus.bmw.domain.vo.BmwDeviceVo;
|
||||
import com.bonus.bmw.domain.vo.BmwKqCmdTaskVo;
|
||||
import com.bonus.bmw.domain.vo.DeviceConfigVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
|
@ -98,4 +99,11 @@ public interface UrkSendMapper {
|
|||
* @return
|
||||
*/
|
||||
List<String> getDevUserId(@Param("deviceCode") String deviceCode);
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
String getConfig(DeviceConfigVo vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,15 @@ package com.bonus.bmw.service;
|
|||
import com.bonus.bmw.domain.vo.KqCmdBean;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface KqCmdService{
|
||||
|
||||
AjaxResult getProKqjTree(KqCmdBean o);
|
||||
|
||||
AjaxResult refreshDevice(KqCmdBean o);
|
||||
|
||||
AjaxResult getUserByDeviceId(KqCmdBean o);
|
||||
List<KqCmdBean> getUserByDeviceId(KqCmdBean o);
|
||||
|
||||
AjaxResult restartDevice(KqCmdBean o);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.bonus.bmw.service;
|
||||
|
||||
import com.bonus.bmw.domain.vo.DeviceConfigVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -75,4 +77,19 @@ public interface UrkSendService {
|
|||
*/
|
||||
void addUserList(String deviceCode,List<String> addUserId) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* 下发指定人员
|
||||
* @param deviceCode
|
||||
* @throws Exception
|
||||
*/
|
||||
void getDeviceConfig(String deviceCode) throws Exception;
|
||||
|
||||
/**
|
||||
* 设置设备配置
|
||||
* @param vo
|
||||
* @throws Exception
|
||||
*/
|
||||
void setDeviceConfig(DeviceConfigVo vo) throws Exception;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ import com.bonus.bmw.domain.vo.KqCmdBean;
|
|||
import com.bonus.bmw.domain.vo.TreeNode;
|
||||
import com.bonus.bmw.mapper.KqCmdMapper;
|
||||
import com.bonus.bmw.service.KqCmdService;
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.system.api.RemoteUploadUtilsService;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
@ -21,6 +23,12 @@ public class KqCmdServiceImpl implements KqCmdService {
|
|||
private UrkSendServiceImpl urkSendServiceImpl;
|
||||
|
||||
|
||||
@Resource
|
||||
private RemoteUploadUtilsService service;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult getProKqjTree(KqCmdBean o) {
|
||||
List<KqCmdBean> list = mapper.getProKqjTree(o);
|
||||
|
|
@ -40,9 +48,12 @@ public class KqCmdServiceImpl implements KqCmdService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getUserByDeviceId(KqCmdBean o) {
|
||||
public List<KqCmdBean> getUserByDeviceId(KqCmdBean o) {
|
||||
List<KqCmdBean> list = mapper.getUserByDeviceId(o);
|
||||
return AjaxResult.success(list);
|
||||
for (KqCmdBean kqCmdBean : list) {
|
||||
kqCmdBean.setFaceImage(service.getFileUrl(kqCmdBean.getUserPhoto(),null, SecurityConstants.INNER).getData());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,11 @@ package com.bonus.bmw.service.impl;
|
|||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.nacos.shaded.com.google.common.collect.Maps;
|
||||
import com.bonus.bmw.domain.vo.BmwDeviceVo;
|
||||
import com.bonus.bmw.domain.vo.BmwKqCmdTaskVo;
|
||||
import com.bonus.bmw.domain.vo.DeviceConfigVo;
|
||||
import com.bonus.bmw.mapper.UrkSendMapper;
|
||||
import com.bonus.bmw.service.UrkSendService;
|
||||
import com.bonus.common.core.urk.TaskStatusEnum;
|
||||
|
|
@ -13,6 +15,7 @@ import com.bonus.common.core.utils.StringUtils;
|
|||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.ValueOperations;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
|
@ -294,6 +297,7 @@ public class UrkSendServiceImpl implements UrkSendService {
|
|||
//添加人员
|
||||
mapper.insertCmdTaskUser(list,taskVo);
|
||||
list.clear();
|
||||
|
||||
}
|
||||
}
|
||||
//如果还有数据则在最下面层级
|
||||
|
|
@ -308,13 +312,71 @@ public class UrkSendServiceImpl implements UrkSendService {
|
|||
mapper.insertCmdTaskUser(list,taskVo);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error(e.toString());
|
||||
log.error(e.toString(),e);
|
||||
throw new Exception("重启添加失败");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDeviceConfig(String deviceCode) throws Exception {
|
||||
try{
|
||||
String createTime= DateUtils.getTime();
|
||||
BmwKqCmdTaskVo taskVo=new BmwKqCmdTaskVo();
|
||||
taskVo.setDeviceCode(deviceCode);
|
||||
taskVo.setCreateTime(createTime);
|
||||
taskVo.setCmdCode("GET_DEVICE_SETTING");
|
||||
//等待执行
|
||||
taskVo.setTransStatus(TaskStatusEnum.WAIT.ordinal());
|
||||
taskVo.setCmdParam("[]");
|
||||
//添加任务
|
||||
mapper.insertCmdTask(taskVo);
|
||||
//添加历史记录
|
||||
mapper.insertCmdTaskHistory(taskVo);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
throw new Exception("获取配置添加失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeviceConfig(DeviceConfigVo vo) throws Exception {
|
||||
try{
|
||||
String jsondata=mapper.getConfig(vo);
|
||||
if(StringUtils.isEmpty(jsondata)){
|
||||
throw new RuntimeException("先获取配置信息");
|
||||
}
|
||||
String createTime= DateUtils.getTime();
|
||||
BmwKqCmdTaskVo taskVo=new BmwKqCmdTaskVo();
|
||||
taskVo.setDeviceCode(vo.getDevCode());
|
||||
taskVo.setCreateTime(createTime);
|
||||
taskVo.setCmdCode("SET_DEVICE_SETTING");
|
||||
|
||||
JSONObject json= JSON.parseObject(jsondata);
|
||||
//是否推送
|
||||
json.put("pushEnable",vo.getPushEnable());
|
||||
//心跳时间
|
||||
json.put("interval",vo.getInterval());
|
||||
json.put("cmdParam",jsondata);
|
||||
//考勤上传端端口及地址
|
||||
json.put("pushServerHost",vo.getPushServerHost());
|
||||
json.put("pushServerPort", vo.getPushServerPort());
|
||||
String cmdParam=JSON.toJSONString(json);
|
||||
//等待执行
|
||||
taskVo.setTransStatus(TaskStatusEnum.WAIT.ordinal());
|
||||
taskVo.setCmdParam(cmdParam);
|
||||
//添加任务
|
||||
mapper.insertCmdTask(taskVo);
|
||||
//添加历史记录
|
||||
mapper.insertCmdTaskHistory(taskVo);
|
||||
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
throw new RuntimeException("配置下发失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void sendUserToDeviceList(List<Integer> userId,String key,int pageNum, int type,BmwKqCmdTaskVo taskVo){
|
||||
List<BmwDeviceVo> list ;
|
||||
|
|
|
|||
|
|
@ -4,14 +4,15 @@
|
|||
|
||||
<select id="getUserByDeviceId" resultType="com.bonus.bmw.domain.vo.KqCmdBean">
|
||||
select
|
||||
kul.user_id as worker_id,
|
||||
kul.user_name as worker_name,
|
||||
kul.user_phone as phone,
|
||||
kul.dev_code as device_code,
|
||||
if(bwem.worker_id is null,1,0) as isHand
|
||||
kul.id,
|
||||
IF(pw.id is null, 0, 1) AS isOnDataBase,
|
||||
kul.user_id as userId,
|
||||
kul.user_name as userName,
|
||||
kul.user_phone as userPhoto,
|
||||
kul.dev_code as devCode
|
||||
from kq_user_list kul
|
||||
LEFT JOIN bm_worker_ein_msg bwem ON kul.user_id = bwem.worker_id and bwem.pro_id = #{proId}
|
||||
where dev_code = #{deviceCode}
|
||||
left join pm_worker pw on pw.id=kul.user_id
|
||||
where kul.dev_code = #{deviceCode}
|
||||
</select>
|
||||
|
||||
<select id="getProDeviceWorker" resultType="com.bonus.bmw.domain.vo.KqCmdBean">
|
||||
|
|
|
|||
|
|
@ -133,5 +133,10 @@
|
|||
from kq_dev_user_id
|
||||
WHERE dev_code=#{deviceCode}
|
||||
</select>
|
||||
<select id="getConfig" resultType="java.lang.String">
|
||||
select json
|
||||
from kq_device_config
|
||||
where dev_code=#{devCode}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@ public class ResultHandle {
|
|||
}else{
|
||||
String cmdCode = taskVo.getCmdCode();
|
||||
if (Constant.noResList.contains(cmdCode)) {
|
||||
//更新 ,再进行删除任务记录
|
||||
taskVo.setUpdateTime(DateUtils.getTime());
|
||||
taskVo.setTransStatus(TaskStatusEnum.COMPLETED.ordinal());
|
||||
service.updateCmdTaskStatus(taskVo);
|
||||
log.info("cmdCode:{}", cmdCode);
|
||||
try {
|
||||
String jsonStr = null;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.urk.mapper;
|
||||
|
||||
import com.bonus.urk.vo.DevConfigVo;
|
||||
import com.bonus.urk.vo.DevUserVo;
|
||||
import com.bonus.urk.vo.KqCmdTaskVo;
|
||||
import com.bonus.urk.vo.KqDevUserIdVo;
|
||||
|
|
@ -77,4 +78,17 @@ public interface ResultMapper {
|
|||
* @param deviceCode
|
||||
*/
|
||||
void delAllDeviceUserId(@Param("deviceCode") String deviceCode);
|
||||
|
||||
/**
|
||||
* 查询人员数据集合
|
||||
* @param deviceCode
|
||||
* @return
|
||||
*/
|
||||
List<String> getFaceList(@Param("deviceCode") String deviceCode);
|
||||
|
||||
/**
|
||||
* 新增配置信息
|
||||
* @param vo
|
||||
*/
|
||||
void addDevConfig(DevConfigVo vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,9 +43,9 @@ public class UrkMinioService {
|
|||
prefix=floor;
|
||||
}
|
||||
String originFileName = "bast64";
|
||||
String day= DateUtils.getCurrentYear();
|
||||
String year= DateUtils.getCurrentYear();
|
||||
String month=DateUtils.getCurrentMonth();
|
||||
String year=DateUtils.getCurrentYear();
|
||||
String day=DateUtils.getCurrentDay();
|
||||
String uuid = StringUtils.randomUUID();
|
||||
String suffix=getBase64Type(bast64);
|
||||
// String suffix=StringUtils.substringAfterLast(originFileName, ".");
|
||||
|
|
@ -69,8 +69,8 @@ public class UrkMinioService {
|
|||
}
|
||||
minioUtils.uploadImage(bucketName, bast64,filePath);
|
||||
vo.setBucketName(bucketName);
|
||||
String path="/"+bucketName+"/"+filePath;
|
||||
vo.setPath(path);
|
||||
// String path="/"+bucketName+"/"+filePath;
|
||||
vo.setPath(filePath);
|
||||
vo.setUrl(minioConfig.getEndpoint());
|
||||
int num=mapper.insertUploadFile(vo);
|
||||
if(num>0){
|
||||
|
|
@ -337,7 +337,10 @@ public class UrkMinioService {
|
|||
}
|
||||
|
||||
|
||||
public void remoteFile( String path) throws Exception {
|
||||
minioUtils.deleteObject(path);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断图片base64字符串的文件格式(支持格式:BMP/PNG/JPG/JPEG/GIF/TIFF/WEBP)
|
||||
|
|
|
|||
|
|
@ -373,7 +373,7 @@ public class UrkMinioUtil {
|
|||
public static InputStream base64ToInputStream(String base64) {
|
||||
ByteArrayInputStream stream = null;
|
||||
try {
|
||||
byte[] bytes = Base64.getEncoder().encode(base64.trim().getBytes());
|
||||
byte[] bytes = Base64.getDecoder().decode(base64.trim().getBytes());
|
||||
stream = new ByteArrayInputStream(bytes);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -9,10 +9,7 @@ import com.bonus.common.core.urk.Constant;
|
|||
import com.bonus.system.api.model.UploadFileVo;
|
||||
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.KqDevUserIdVo;
|
||||
import com.bonus.urk.vo.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
|
|
@ -145,6 +142,15 @@ public class ResultService {
|
|||
String jsonStr = getRequestBody(req);
|
||||
log.info("设备配置信息:{}", jsonStr);
|
||||
if(StringUtils.isNotBlank(jsonStr)) {
|
||||
JSONObject json=JSON.parseObject(jsonStr);
|
||||
String serverHost=json.getString("serverHost");
|
||||
String serverPort=json.getString("serverPort");
|
||||
String pushServerHost=json.getString("pushServerHost");
|
||||
String pushServerPort=json.getString("pushServerPort");
|
||||
String pushEnable=json.getString("pushEnable");
|
||||
String interval=json.getString("interval");
|
||||
DevConfigVo vo=new DevConfigVo(taskVo.getDeviceCode(),serverHost,serverPort,interval,pushServerHost,pushServerPort,pushEnable,jsonStr);
|
||||
mapper.addDevConfig(vo);
|
||||
//数据处理
|
||||
}
|
||||
resp.addHeader(Constant.DEVICE_HEADER_RESPONSE_CODE, Constant.OK);
|
||||
|
|
@ -176,15 +182,21 @@ public class ResultService {
|
|||
JSONArray users=json.getJSONArray("users");
|
||||
packageId=json.getString("packageId");
|
||||
if("1".equals(packageId)){
|
||||
List<String> faceList=mapper.getFaceList(taskVo.getDeviceCode());
|
||||
if(faceList!=null&& !faceList.isEmpty()){
|
||||
for (String face : faceList) {
|
||||
fileService.remoteFile(face);
|
||||
}
|
||||
}
|
||||
mapper.delAllDeviceUserId(taskVo.getDeviceCode());
|
||||
}
|
||||
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 face=users.getJSONObject(i).getString("photo");
|
||||
String id=deviceCode+"-"+userId;
|
||||
UploadFileVo uploadFileVo=fileService.upload("dev_face",id,"考勤机照片","face",face,null);
|
||||
UploadFileVo uploadFileVo=fileService.upload("kq_user_list",id,"考勤机照片","face",face,null);
|
||||
if(uploadFileVo!=null){
|
||||
dto.setImagePath(uploadFileVo.getPath());
|
||||
}
|
||||
|
|
@ -274,4 +286,25 @@ public class ResultService {
|
|||
}
|
||||
return jsonStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置设备参数
|
||||
* @param taskVo
|
||||
* @param req
|
||||
* @param resp
|
||||
*/
|
||||
public void setDerviceString(KqCmdTaskVo taskVo, HttpServletRequest req, HttpServletResponse resp) {
|
||||
try {
|
||||
// 解析request输入流
|
||||
String jsonStr = getRequestBody(req);
|
||||
log.info("设备信息:{}", jsonStr);
|
||||
resp.addHeader(Constant.DEVICE_HEADER_RESPONSE_CODE, Constant.OK);
|
||||
resp.addHeader(Constant.DEVICE_HEADER_TRANS_ID, taskVo.getId());
|
||||
resp.getWriter().write("");
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import com.bonus.common.core.urk.TaskStatusEnum;
|
|||
import com.bonus.urk.mapper.TaskMapper;
|
||||
import com.bonus.urk.minio.UrkMinioService;
|
||||
import com.bonus.urk.vo.DeviceTaskVo;
|
||||
import com.bonus.urk.vo.KqCmdTaskVo;
|
||||
import com.bonus.urk.vo.TaskUserVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.hibernate.validator.internal.util.StringHelper;
|
||||
|
|
@ -70,7 +71,8 @@ public class TaskService {
|
|||
service.logServerResponseLog(taskVo, resp, body);
|
||||
log.info("设备:{}, 更新时间指令下达", taskVo.getDeviceCode());
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ResultService resultService;
|
||||
/**
|
||||
* 设备重启指令
|
||||
* @param task
|
||||
|
|
@ -89,6 +91,12 @@ public class TaskService {
|
|||
task.setTransStatus(TaskStatusEnum.COMPLETED.ordinal());
|
||||
|
||||
mapper.updateById(task);
|
||||
KqCmdTaskVo cmdTaskVo = new KqCmdTaskVo();
|
||||
cmdTaskVo.setId(task.getId());
|
||||
//更新 ,再进行删除任务记录
|
||||
cmdTaskVo.setUpdateTime(DateUtils.getTime());
|
||||
cmdTaskVo.setTransStatus(TaskStatusEnum.COMPLETED.ordinal());
|
||||
resultService.updateCmdTaskStatus(cmdTaskVo);
|
||||
service.logServerResponseLog(task, resp, body);
|
||||
log.info("设备:{}, 重启指令下达", task.getDeviceCode());
|
||||
}
|
||||
|
|
@ -307,19 +315,23 @@ public class TaskService {
|
|||
JSONObject body=JSONObject.parseObject(cmdParam);
|
||||
|
||||
try {
|
||||
// body
|
||||
/* JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put(userSend.getParamsKey(), userSend.getParamsVal());*/
|
||||
// body = userSend.getParamsVal();//jsonObject.toString();
|
||||
|
||||
resp.addHeader(Constant.DEVICE_HEADER_RESPONSE_CODE, Constant.OK);
|
||||
resp.setCharacterEncoding(Constant.CHART_SET);
|
||||
resp.setContentType("application/octet-stream");
|
||||
|
||||
// resp.addHeader("Content-Length", String.valueOf(body.length()));
|
||||
resp.addHeader(Constant.DEVICE_HEADER_TRANS_ID, task.getId());
|
||||
resp.addHeader("cmd_code", task.getCmdCode());
|
||||
resp.getWriter().write(cmdParam);
|
||||
// log.info("设备设置参数:{}", jsonStr);
|
||||
resp.addHeader("Content-Length", String.valueOf(body.getBytes(Constant.CHART_SET).length));
|
||||
InputStream in = new ByteArrayInputStream(body.getBytes(Constant.CHART_SET));
|
||||
byte[] bytEmpty = new byte[body.getBytes(Constant.CHART_SET).length];
|
||||
int len = 0;
|
||||
while ((len = in.read(bytEmpty)) > 0) {
|
||||
resp.getOutputStream().write(bytEmpty, 0, bytEmpty.length);
|
||||
}
|
||||
in.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
@ -396,7 +408,6 @@ public class TaskService {
|
|||
}
|
||||
in.close();
|
||||
log.info("jsonStr.length:{}, jsonStr.getBytes.length:{}", body.length(), body.getBytes(Constant.CHART_SET).length);
|
||||
// log.info("新增用户同步参数:{}", jsonStr);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
package com.bonus.urk.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DevConfigVo {
|
||||
|
||||
private String devCode;
|
||||
/**
|
||||
* 服务地址
|
||||
*/
|
||||
private String serverHost;
|
||||
/**
|
||||
* 服务端口
|
||||
*/
|
||||
private String serverPort;
|
||||
|
||||
/**
|
||||
* 心跳
|
||||
*/
|
||||
private String interval;
|
||||
/**
|
||||
* 推送地址
|
||||
*/
|
||||
private String pushServerHost;
|
||||
/**
|
||||
* 推送端口
|
||||
*/
|
||||
private String pushServerPort;
|
||||
/**
|
||||
* 是否开启推送
|
||||
*/
|
||||
private String pushEnable;
|
||||
|
||||
|
||||
private String json;
|
||||
|
||||
public DevConfigVo() {
|
||||
}
|
||||
|
||||
public DevConfigVo(String devCode,String serverHost, String serverPort, String interval, String pushServerHost, String pushServerPort, String pushEnable, String jsonStr) {
|
||||
this.devCode=devCode;
|
||||
this.serverHost = serverHost;
|
||||
this.serverPort = serverPort;
|
||||
this.interval = interval;
|
||||
this.pushServerHost = pushServerHost;
|
||||
this.pushServerPort = pushServerPort;
|
||||
this.pushEnable = pushEnable;
|
||||
this.json = jsonStr;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 38085
|
||||
port: 20000
|
||||
# Spring
|
||||
spring:
|
||||
cloud:
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ spring:
|
|||
name: bonus-urk
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: prod
|
||||
active: dev
|
||||
task:
|
||||
scheduling:
|
||||
pool:
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@
|
|||
(#{item.id},#{item.userId},#{item.name},#{item.imagePath},#{item.card},#{item.vaildStart},#{item.vaildEnd},#{item.deviceCode})
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="addDevConfig">
|
||||
replace into kq_device_config( dev_code, service_ip, service_port,push_service, push_port, servrt_interval,json, push_enable
|
||||
)values (#{devCode},#{serverHost},#{serverPort},#{pushServerHost},#{pushServerPort},#{interval},#{json},#{pushEnable})
|
||||
</insert>
|
||||
<update id="updateTaskById">
|
||||
update kq_cmd_task set trans_status_update_time=#{updateTime},trans_status=#{transStatus}
|
||||
where id=#{id}
|
||||
|
|
@ -70,4 +74,8 @@
|
|||
from kq_task_user_list
|
||||
where task_id=#{id}
|
||||
</select>
|
||||
<select id="getFaceList" resultType="java.lang.String">
|
||||
select user_phone from kq_user_list
|
||||
where dev_code=#{deviceCode}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue