考勤机管理功能
This commit is contained in:
parent
f45029a18c
commit
d01e615e7f
|
|
@ -0,0 +1,215 @@
|
|||
package com.bonus.bmw.controller;
|
||||
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考勤机操作控制层
|
||||
*
|
||||
* @author fly
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/kqManager")
|
||||
public class KqCmdController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private KqCmdService service;
|
||||
|
||||
/**
|
||||
* 工程-考勤机树
|
||||
*
|
||||
* @param o 主键
|
||||
* @return 返回树
|
||||
*/
|
||||
@GetMapping("getProKqjTree")
|
||||
@SysLog(title = "工程考勤机树", businessType = OperaType.QUERY, logType = 0, module = "工程考勤机树", details = "工程考勤机树")
|
||||
public AjaxResult getProKqjTree(KqCmdBean o) {
|
||||
try {
|
||||
return service.getProKqjTree(o);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 考刷新考勤机
|
||||
*
|
||||
* @param o 主键
|
||||
* @return 返回考勤机人员存入数据库-延时
|
||||
*/
|
||||
@PostMapping("refreshDevice")
|
||||
@SysLog(title = "刷新考勤机", businessType = OperaType.FLASH, logType = 0, module = "刷新考勤机", details = "刷新考勤机")
|
||||
public AjaxResult refreshDevice(@RequestBody KqCmdBean o) {
|
||||
try {
|
||||
return service.refreshDevice(o);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getWorkerByDeviceId")
|
||||
@SysLog(title = "获取考勤机人员", businessType = OperaType.QUERY, logType = 0, module = "获取考勤机人员", details = "获取考勤机人员")
|
||||
public TableDataInfo getWorkerByDeviceId(KqCmdBean o) {
|
||||
try {
|
||||
startPage();
|
||||
List<KqCmdBean> list = service.getUserByDeviceId(o);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/getTaskList")
|
||||
@SysLog(title = "任务列表", businessType = OperaType.QUERY, logType = 0, module = "获取任务列表", details = "获取任务列表")
|
||||
public TableDataInfo getTaskList(KqCmdBean o) {
|
||||
try {
|
||||
startPage();
|
||||
List<KqCmdBean> list = service.getTaskList(o);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
@GetMapping("/getHisTaskList")
|
||||
@SysLog(title = "历史人任务列表", businessType = OperaType.QUERY, logType = 0, module = "获取任务列表", details = "获取任务列表")
|
||||
public TableDataInfo getHisTaskList(KqCmdBean o) {
|
||||
try {
|
||||
startPage();
|
||||
List<KqCmdBean> list = service.getHisTaskList(o);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
/**
|
||||
* 获取系统-工程考勤机-待下发人员列表
|
||||
*
|
||||
* @param o 考勤机编号
|
||||
* @return 人员列表
|
||||
*/
|
||||
@GetMapping("getProDeviceWorker")
|
||||
@SysLog(title = "获取系统-工程考勤机-待下发人员列表", businessType = OperaType.QUERY, logType = 0, module = "获取系统-工程考勤机-待下发人员列表", details = "获取系统-工程考勤机-待下发人员列表")
|
||||
public AjaxResult getProDeviceWorker(KqCmdBean o) {
|
||||
try {
|
||||
return service.getProDeviceWorker(o);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
@PostMapping("delTaskById")
|
||||
public AjaxResult delTaskById(@RequestBody KqCmdBean o) {
|
||||
try {
|
||||
return service.delTaskById(o);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
@PostMapping("delHisTaskById")
|
||||
public AjaxResult delHisTaskById(@RequestBody KqCmdBean o) {
|
||||
try {
|
||||
return service.delHisTaskById(o);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 下发人员
|
||||
*
|
||||
* @param o 人员,考勤机编号
|
||||
* @return 成功or失败
|
||||
*/
|
||||
@PostMapping("pushWorkerByDevice")
|
||||
@SysLog(title = "下发指定人员", businessType = OperaType.UPDATE, logType = 0, module = "下发人员", details = "下发指定人员")
|
||||
public AjaxResult pushWorkerByDevice(@RequestBody KqCmdBean o) {
|
||||
try {
|
||||
return service.pushWorkerByDevice(o);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 重启考勤机
|
||||
*
|
||||
* @param o 考勤机编号
|
||||
* @return 成功or失败
|
||||
*/
|
||||
@PostMapping("restartDevice")
|
||||
@SysLog(title = "重启考勤机", businessType = OperaType.FLASH, logType = 0, module = "重启考勤机", details = "重启考勤机")
|
||||
public AjaxResult restartDevice(@RequestBody KqCmdBean o) {
|
||||
try {
|
||||
return service.restartDevice(o);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除人员
|
||||
*
|
||||
* @param o 人员,考勤机编号
|
||||
* @return 成功or失败
|
||||
*/
|
||||
@PostMapping("delWorkerByDevice")
|
||||
@SysLog(title = "删除考勤机人员", businessType = OperaType.DELETE, logType = 0, module = "删除考勤机人员", details = "删除考勤机人员")
|
||||
public AjaxResult delWorkerByDevice(@RequestBody KqCmdBean o) {
|
||||
try {
|
||||
return service.delWorkerByDevice(o);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询正在执行的任务
|
||||
*
|
||||
* @param o 考勤机编号
|
||||
* @return 人员
|
||||
*/
|
||||
@GetMapping("getDeviceTask")
|
||||
@SysLog(title = "查询正在执行的任务", businessType = OperaType.QUERY, logType = 0, module = "查询正在执行的任务", details = "查询正在执行的任务")
|
||||
public AjaxResult getDeviceTask(KqCmdBean o) {
|
||||
try {
|
||||
return service.getDeviceTask(o);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -0,0 +1,160 @@
|
|||
package com.bonus.bmw.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 考勤任务信息表
|
||||
*/
|
||||
@Data
|
||||
public class KqCmdBean {
|
||||
/**
|
||||
* 任务id
|
||||
*/
|
||||
private String taskId;
|
||||
|
||||
|
||||
/**
|
||||
* 任务状态
|
||||
*/
|
||||
private String transStatus;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
/**
|
||||
* 执行时间
|
||||
*/
|
||||
private String exeTime;
|
||||
|
||||
private String cmdName;
|
||||
|
||||
private String statusName;
|
||||
/**
|
||||
* 执行消息
|
||||
*/
|
||||
private String msg;
|
||||
/**
|
||||
* 层级
|
||||
*/
|
||||
private String level;
|
||||
/**
|
||||
* 是否在线
|
||||
*/
|
||||
private String onLine;
|
||||
/**
|
||||
* 关键字
|
||||
*/
|
||||
private String keyWord;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private String updateTime;
|
||||
|
||||
private String userPhoto;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private String userId;
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
private String devCode;
|
||||
/**
|
||||
* 人员名称
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 是否在库
|
||||
*/
|
||||
private String isOnDataBase;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 指令编码
|
||||
*/
|
||||
private String cmdCode;
|
||||
|
||||
/**
|
||||
* 指令参数
|
||||
*/
|
||||
private String cmdParam;
|
||||
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
private String deviceCode;
|
||||
|
||||
/**
|
||||
* 任务状态 0 待执行 1已执行 2 完成 3执行失败 4 取消
|
||||
*/
|
||||
|
||||
/**
|
||||
* 任务执行更新时间
|
||||
*/
|
||||
private Date transStatusUpdateTime;
|
||||
|
||||
/**
|
||||
* 更新状态 默认 0 1 则是更新数据
|
||||
*/
|
||||
private Integer updateState;
|
||||
|
||||
|
||||
/**
|
||||
* 人脸图片
|
||||
*/
|
||||
private String faceImage;
|
||||
|
||||
/**
|
||||
* 工程id
|
||||
*/
|
||||
private Integer proId;
|
||||
private Integer subId;
|
||||
private Integer teamId;
|
||||
|
||||
private String proName;
|
||||
private String subName;
|
||||
private String teamName;
|
||||
|
||||
private String workerId;
|
||||
|
||||
private String[] workerIds;
|
||||
private String workerName;
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 是否在库
|
||||
*/
|
||||
private String isHand;
|
||||
/**
|
||||
* 是否下发
|
||||
*/
|
||||
private String isIssue;
|
||||
|
||||
public KqCmdBean() {
|
||||
}
|
||||
|
||||
public KqCmdBean(String deviceCode, String subName, String teamName, Integer proId, Integer subId, Integer teamId) {
|
||||
this.deviceCode = deviceCode;
|
||||
this.subName = subName;
|
||||
this.teamName = teamName;
|
||||
this.proId = proId;
|
||||
this.subId = subId;
|
||||
this.teamId = teamId;
|
||||
}
|
||||
|
||||
public KqCmdBean(String deviceCode, String subName, String teamName, Integer proId, Integer subId, Integer teamId, String onLine) {
|
||||
this.deviceCode = deviceCode;
|
||||
this.subName = subName;
|
||||
this.teamName = teamName;
|
||||
this.proId = proId;
|
||||
this.subId = subId;
|
||||
this.teamId = teamId;
|
||||
this.onLine = onLine;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.bonus.bmw.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class TreeNode {
|
||||
|
||||
private String level;
|
||||
|
||||
private String id;
|
||||
private String name;
|
||||
private String type;
|
||||
private Integer proId;
|
||||
private Integer subId;
|
||||
private Integer teamId;
|
||||
private List<TreeNode> children;
|
||||
|
||||
private String onLine;
|
||||
|
||||
public TreeNode(String id, String name, String type) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.children = new ArrayList<>();
|
||||
}
|
||||
|
||||
public TreeNode(String id, String name, String type, Integer proId, Integer subId, Integer teamId) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.proId = proId;
|
||||
this.subId = subId;
|
||||
this.teamId = teamId;
|
||||
this.children = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void addChild(TreeNode child) { this.children.add(child); }
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.bonus.bmw.mapper;
|
||||
|
||||
import com.bonus.bmw.domain.vo.KqCmdBean;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface KqCmdMapper {
|
||||
|
||||
List<KqCmdBean> getProKqjTree(KqCmdBean o);
|
||||
|
||||
/**
|
||||
* 查询考情机人员
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
List<KqCmdBean> getUserByDeviceId(KqCmdBean o);
|
||||
|
||||
List<KqCmdBean> getProDeviceWorker(KqCmdBean o);
|
||||
|
||||
List<KqCmdBean> getDeviceTask(KqCmdBean o);
|
||||
|
||||
/**
|
||||
* 查询任务列表
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
List<KqCmdBean> getTaskList(KqCmdBean o);
|
||||
|
||||
/**
|
||||
* 查询历史执行任务
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
List<KqCmdBean> getHisTaskList(KqCmdBean o);
|
||||
|
||||
/**
|
||||
* 删除任务
|
||||
* @param list
|
||||
*/
|
||||
int delTaskById(@Param("list") List<String> list);
|
||||
|
||||
int delHisTaskById(@Param("list") List<String> list);
|
||||
}
|
||||
|
|
@ -76,4 +76,6 @@ public interface PmProjectMapper {
|
|||
*/
|
||||
Integer getPeoNum(BmSubContract bmSubContract);
|
||||
|
||||
int proAttDataUpdateRemind(List<MapBeanPo> list);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
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);
|
||||
|
||||
List<KqCmdBean> getUserByDeviceId(KqCmdBean o);
|
||||
|
||||
AjaxResult restartDevice(KqCmdBean o);
|
||||
|
||||
AjaxResult getProDeviceWorker(KqCmdBean o);
|
||||
|
||||
AjaxResult pushWorkerByDevice(KqCmdBean o);
|
||||
|
||||
AjaxResult delWorkerByDevice(KqCmdBean o);
|
||||
|
||||
AjaxResult getDeviceTask(KqCmdBean o);
|
||||
|
||||
/**
|
||||
* 查询任务列表
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
List<KqCmdBean> getTaskList(KqCmdBean o);
|
||||
|
||||
/**
|
||||
* 查询历史人物列表
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
List<KqCmdBean> getHisTaskList(KqCmdBean o);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
AjaxResult delTaskById(KqCmdBean o);
|
||||
/**
|
||||
* 删除
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
AjaxResult delHisTaskById(KqCmdBean o);
|
||||
}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
package com.bonus.bmw.service;
|
||||
|
||||
import com.bonus.bmw.domain.vo.DeviceConfigVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -46,4 +48,48 @@ public interface UrkSendService {
|
|||
*/
|
||||
void delDevByProId(String deviceCode, int proId,int supId,int teamId) throws Exception;
|
||||
|
||||
/**
|
||||
* 获取考勤机当前人员数据
|
||||
* @param deviceCode
|
||||
* @throws Exception
|
||||
*/
|
||||
void getDevUserList(String deviceCode) throws Exception;
|
||||
|
||||
/**
|
||||
* 删除考情机人员
|
||||
* @param deviceCode
|
||||
* @throws Exception
|
||||
*/
|
||||
void delDevUser(String deviceCode,List<String> delUserId) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* 考勤机重启
|
||||
* @param deviceCode
|
||||
* @throws Exception
|
||||
*/
|
||||
void reloadDevice(String deviceCode) throws Exception;
|
||||
|
||||
/**
|
||||
* 下发指定人员
|
||||
* @param deviceCode
|
||||
* @throws Exception
|
||||
*/
|
||||
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;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,206 @@
|
|||
package com.bonus.bmw.service.impl;
|
||||
|
||||
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.utils.StringUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.system.api.RemoteUploadUtilsService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class KqCmdServiceImpl implements KqCmdService {
|
||||
|
||||
@Resource
|
||||
private KqCmdMapper mapper;
|
||||
|
||||
@Resource
|
||||
private UrkSendServiceImpl urkSendServiceImpl;
|
||||
|
||||
|
||||
@Resource
|
||||
private RemoteUploadUtilsService service;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult getProKqjTree(KqCmdBean o) {
|
||||
List<KqCmdBean> list = mapper.getProKqjTree(o);
|
||||
// 构建设备树
|
||||
List<TreeNode> deviceTree = buildDeviceTree(list);
|
||||
return AjaxResult.success(deviceTree);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult refreshDevice(KqCmdBean o) {
|
||||
try {
|
||||
urkSendServiceImpl.getDevUserList(o.getDeviceCode());
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KqCmdBean> getUserByDeviceId(KqCmdBean o) {
|
||||
List<KqCmdBean> list = mapper.getUserByDeviceId(o);
|
||||
for (KqCmdBean kqCmdBean : list) {
|
||||
kqCmdBean.setFaceImage(service.getFileUrl(kqCmdBean.getUserPhoto(),null, SecurityConstants.INNER).getData());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult restartDevice(KqCmdBean o) {
|
||||
try {
|
||||
urkSendServiceImpl.reloadDevice(o.getDeviceCode());
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getProDeviceWorker(KqCmdBean o) {
|
||||
List<KqCmdBean> list = mapper.getProDeviceWorker(o);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult pushWorkerByDevice(KqCmdBean o) {
|
||||
//先删除在下发
|
||||
try {
|
||||
urkSendServiceImpl.delDevUser(o.getDeviceCode(), Arrays.asList(o.getWorkerIds()));
|
||||
urkSendServiceImpl.addUserList(o.getDeviceCode(), Arrays.asList(o.getWorkerIds()));
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult delWorkerByDevice(KqCmdBean o) {
|
||||
try {
|
||||
urkSendServiceImpl.delDevUser(o.getDeviceCode(), Arrays.asList(o.getWorkerIds()));
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getDeviceTask(KqCmdBean o) {
|
||||
List<KqCmdBean> list = mapper.getDeviceTask(o);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KqCmdBean> getTaskList(KqCmdBean o) {
|
||||
|
||||
return mapper.getTaskList(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KqCmdBean> getHisTaskList(KqCmdBean o) {
|
||||
return mapper.getHisTaskList(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult delTaskById(KqCmdBean o) {
|
||||
try{
|
||||
if(StringUtils.isEmpty(o.getTaskId())){
|
||||
return AjaxResult.error("请先选择任务");
|
||||
}else{
|
||||
List<String> list=Arrays.asList(o.getTaskId().split(","));
|
||||
int num=mapper.delTaskById(list);
|
||||
if(num>0){
|
||||
return AjaxResult.success("删除成功");
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return AjaxResult.error("删除失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult delHisTaskById(KqCmdBean o) {
|
||||
try{
|
||||
if(StringUtils.isEmpty(o.getTaskId())){
|
||||
return AjaxResult.error("请先选择任务");
|
||||
}else{
|
||||
List<String> list=Arrays.asList(o.getTaskId().split(","));
|
||||
int num= mapper.delHisTaskById(list);
|
||||
if(num>0){
|
||||
return AjaxResult.success("删除成功");
|
||||
}
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return AjaxResult.error("删除失败");
|
||||
}
|
||||
/**
|
||||
* 构建设备树
|
||||
* @param data 包含pro_id和device_code的数据列表
|
||||
* @return 树形结构的根节点列表
|
||||
*/
|
||||
public static List<TreeNode> buildDeviceTree(List<KqCmdBean> data) {
|
||||
// 使用Map来存储pro_id到设备列表的映射
|
||||
Map<String, List<KqCmdBean>> proToDeviceMap = new HashMap<>();
|
||||
// 遍历数据,建立映射关系
|
||||
for (KqCmdBean item : data) {
|
||||
String proName = item.getProName();
|
||||
proToDeviceMap.computeIfAbsent(proName, k -> new ArrayList<>()).add(new KqCmdBean(item.getDeviceCode(), item.getSubName(), item.getTeamName(), item.getProId(), item.getSubId(), item.getTeamId(), item.getOnLine()));
|
||||
}
|
||||
// 构建树形结构
|
||||
List<TreeNode> result = new ArrayList<>();
|
||||
for (Map.Entry<String, List<KqCmdBean>> entry : proToDeviceMap.entrySet()) {
|
||||
String proName = entry.getKey();
|
||||
List<KqCmdBean> deviceCodes = entry.getValue();
|
||||
// 创建项目节点
|
||||
TreeNode projectNode = new TreeNode(proName, "工程-" + proName, "project");
|
||||
projectNode.setLevel("1");
|
||||
// 为每个设备码创建子节点
|
||||
for (KqCmdBean bean : deviceCodes) {
|
||||
TreeNode deviceNode = getTreeNode(bean);
|
||||
projectNode.setOnLine(deviceNode.getOnLine());
|
||||
|
||||
projectNode.addChild(deviceNode);
|
||||
}
|
||||
result.add(projectNode);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static TreeNode getTreeNode(KqCmdBean bean) {
|
||||
String deviceCode = bean.getDeviceCode();
|
||||
String deviceName = "设备-" + deviceCode;
|
||||
if(bean.getSubId()!= null && bean.getSubId() !=0){
|
||||
deviceName += "|分包-" + bean.getSubName();
|
||||
if(bean.getTeamId()!= null && bean.getTeamId() !=0){
|
||||
deviceName += "|班组-" + bean.getTeamName();
|
||||
}
|
||||
}
|
||||
TreeNode treeNode= new TreeNode(deviceCode, deviceName, "device", bean.getProId(), bean.getSubId(), bean.getTeamId());
|
||||
treeNode.setOnLine(bean.getOnLine());
|
||||
treeNode.setLevel("2");
|
||||
return treeNode;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
@ -17,7 +19,6 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -27,14 +28,16 @@ import java.util.Map;
|
|||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class UrkSendServiceImpl implements UrkSendService {
|
||||
public class UrkSendServiceImpl implements UrkSendService {
|
||||
|
||||
@Resource
|
||||
private UrkSendMapper mapper;
|
||||
/**
|
||||
* 默认分页数据
|
||||
*/
|
||||
public final static int PAGE_SIZE=10;
|
||||
public final static int SET_USER_INFO_SIZE=5;
|
||||
|
||||
public final static int PAGE_SIZE=25;
|
||||
/**
|
||||
* 考勤机 下发人员
|
||||
* @param deviceCode
|
||||
|
|
@ -198,12 +201,184 @@ public class UrkSendServiceImpl implements UrkSendService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDevUserList(String deviceCode) throws Exception {
|
||||
try{
|
||||
String createTime= DateUtils.getTime();
|
||||
BmwKqCmdTaskVo taskVo=new BmwKqCmdTaskVo();
|
||||
taskVo.setCreateTime(createTime);
|
||||
taskVo.setDeviceCode(deviceCode);
|
||||
taskVo.setCmdCode("GET_USER_INFO");
|
||||
//等待执行
|
||||
taskVo.setTransStatus(TaskStatusEnum.WAIT.ordinal());
|
||||
taskVo.setCmdParam("{}");
|
||||
//添加任务
|
||||
mapper.insertCmdTask(taskVo);
|
||||
//添加历史记录
|
||||
mapper.insertCmdTaskHistory(taskVo);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString());
|
||||
throw new Exception("获取人员信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delDevUser(String deviceCode, List<String> delUserId) throws Exception {
|
||||
try{
|
||||
String createTime= DateUtils.getTime();
|
||||
BmwKqCmdTaskVo taskVo=new BmwKqCmdTaskVo();
|
||||
taskVo.setDeviceCode(deviceCode);
|
||||
taskVo.setCreateTime(createTime);
|
||||
taskVo.setCmdCode("DELETE_USER");
|
||||
//等待执行
|
||||
taskVo.setTransStatus(TaskStatusEnum.WAIT.ordinal());
|
||||
String json= JSON.toJSONString(delUserId);
|
||||
taskVo.setCmdParam(json);
|
||||
//添加任务
|
||||
mapper.insertCmdTask(taskVo);
|
||||
//添加历史记录
|
||||
mapper.insertCmdTaskHistory(taskVo);
|
||||
//添加人员
|
||||
mapper.insertCmdTaskUser(delUserId,taskVo);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString());
|
||||
throw new Exception("删除人员下发失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadDevice(String deviceCode) throws Exception {
|
||||
try{
|
||||
String createTime= DateUtils.getTime();
|
||||
BmwKqCmdTaskVo taskVo=new BmwKqCmdTaskVo();
|
||||
taskVo.setDeviceCode(deviceCode);
|
||||
taskVo.setCreateTime(createTime);
|
||||
taskVo.setCmdCode("RESET_FK");
|
||||
//等待执行
|
||||
taskVo.setTransStatus(TaskStatusEnum.WAIT.ordinal());
|
||||
taskVo.setCmdParam("[]");
|
||||
//添加任务
|
||||
mapper.insertCmdTask(taskVo);
|
||||
//添加历史记录
|
||||
mapper.insertCmdTaskHistory(taskVo);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString());
|
||||
throw new Exception("重启添加失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addUserList(String deviceCode, List<String> delUserId) throws Exception {
|
||||
/**
|
||||
* 下发考情机人员
|
||||
*/
|
||||
try{
|
||||
int size=SET_USER_INFO_SIZE-1;
|
||||
String createTime= DateUtils.getTime();
|
||||
BmwKqCmdTaskVo taskVo=new BmwKqCmdTaskVo();
|
||||
taskVo.setDeviceCode(deviceCode);
|
||||
taskVo.setCreateTime(createTime);
|
||||
taskVo.setCmdCode("SET_USER_INFO");
|
||||
//等待执行
|
||||
taskVo.setTransStatus(TaskStatusEnum.WAIT.ordinal());
|
||||
List<String> list=new ArrayList<>();
|
||||
for (int i = 0; i <delUserId.size() ; i++) {
|
||||
list.add(delUserId.get(i));
|
||||
if(i%size==0){
|
||||
String json= JSON.toJSONString(list);
|
||||
taskVo.setCmdParam(json);
|
||||
//添加任务
|
||||
mapper.insertCmdTask(taskVo);
|
||||
//添加历史记录
|
||||
mapper.insertCmdTaskHistory(taskVo);
|
||||
//添加人员
|
||||
mapper.insertCmdTaskUser(list,taskVo);
|
||||
list.clear();
|
||||
|
||||
}
|
||||
}
|
||||
//如果还有数据则在最下面层级
|
||||
if(!list.isEmpty()){
|
||||
String json= JSON.toJSONString(list);
|
||||
taskVo.setCmdParam(json);
|
||||
//添加任务
|
||||
mapper.insertCmdTask(taskVo);
|
||||
//添加历史记录
|
||||
mapper.insertCmdTaskHistory(taskVo);
|
||||
//添加人员
|
||||
mapper.insertCmdTaskUser(list,taskVo);
|
||||
}
|
||||
}catch (Exception e){
|
||||
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 ;
|
||||
PageHelper.startPage(pageNum, PAGE_SIZE);
|
||||
PageHelper.startPage(pageNum, SET_USER_INFO_SIZE);
|
||||
String proId=key.split("-")[0];
|
||||
String teamId=key.split("-")[2];
|
||||
String supId=key.split("-")[1];
|
||||
|
|
@ -219,12 +394,12 @@ public class UrkSendServiceImpl implements UrkSendService {
|
|||
list=mapper.getDeviceVoByProId(Integer.parseInt(proId),Integer.parseInt(teamId),Integer.parseInt(supId));
|
||||
if(StringUtils.isEmpty(list)){
|
||||
type=2;
|
||||
PageHelper.startPage(pageNum, PAGE_SIZE);
|
||||
PageHelper.startPage(pageNum, SET_USER_INFO_SIZE);
|
||||
list=mapper.getDeviceVoByProId(Integer.parseInt(proId),Integer.parseInt(teamId),0);
|
||||
}
|
||||
if(StringUtils.isEmpty(list)) {
|
||||
type=3;
|
||||
PageHelper.startPage(pageNum, PAGE_SIZE);
|
||||
PageHelper.startPage(pageNum, SET_USER_INFO_SIZE);
|
||||
list=mapper.getDeviceVoByProId(Integer.parseInt(proId), 0, 0);
|
||||
}
|
||||
}
|
||||
|
|
@ -284,7 +459,7 @@ public class UrkSendServiceImpl implements UrkSendService {
|
|||
* @param taskVo
|
||||
*/
|
||||
public void getUserSendToDev(int proId,int subId,int teamId,int pageNum, BmwKqCmdTaskVo taskVo) {
|
||||
PageHelper.startPage(pageNum, PAGE_SIZE);
|
||||
PageHelper.startPage(pageNum, SET_USER_INFO_SIZE);
|
||||
//依据工程班组分包 查询在场人员
|
||||
List<String> list=mapper.getOnSiteUser(proId,subId,teamId);
|
||||
PageInfo<String> pageInfo =new PageInfo<String>(list);
|
||||
|
|
@ -315,7 +490,7 @@ public class UrkSendServiceImpl implements UrkSendService {
|
|||
*/
|
||||
public void sendUserToDevice(int userId,int proId,int supId,int teamId,int pageNum, int type,BmwKqCmdTaskVo taskVo){
|
||||
List<BmwDeviceVo> list;
|
||||
PageHelper.startPage(pageNum,PAGE_SIZE);
|
||||
PageHelper.startPage(pageNum,SET_USER_INFO_SIZE);
|
||||
if(type==1){
|
||||
list=mapper.getDeviceVoByProId(proId,supId,teamId);
|
||||
}else if(type==2){
|
||||
|
|
@ -328,12 +503,12 @@ public class UrkSendServiceImpl implements UrkSendService {
|
|||
list=mapper.getDeviceVoByProId(proId,supId,teamId);
|
||||
if(StringUtils.isEmpty(list)){
|
||||
type=2;
|
||||
PageHelper.startPage(pageNum,PAGE_SIZE);
|
||||
PageHelper.startPage(pageNum,SET_USER_INFO_SIZE);
|
||||
list=mapper.getDeviceVoByProId(proId,supId,0);
|
||||
}
|
||||
if(StringUtils.isEmpty(list)){
|
||||
type=3;
|
||||
PageHelper.startPage(pageNum,PAGE_SIZE);
|
||||
PageHelper.startPage(pageNum,SET_USER_INFO_SIZE);
|
||||
list=mapper.getDeviceVoByProId(proId,0,0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,175 @@
|
|||
<?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.bmw.mapper.KqCmdMapper">
|
||||
<delete id="delTaskById">
|
||||
delete from kq_cmd_task
|
||||
where id in
|
||||
<foreach collection="list" item="item" open="(" close=")" separator="," >
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
</delete>
|
||||
<delete id="delHisTaskById">
|
||||
delete from kq_cmd_task_history
|
||||
where id in
|
||||
<foreach collection="list" item="item" open="(" close=")" separator="," >
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="getUserByDeviceId" resultType="com.bonus.bmw.domain.vo.KqCmdBean">
|
||||
select
|
||||
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,kul.update_time updateTime
|
||||
from kq_user_list kul
|
||||
left join pm_worker pw on pw.id=kul.user_id
|
||||
where kul.dev_code = #{deviceCode}
|
||||
<if test="isOnDataBase!=null and isOnDataBase!=''">
|
||||
<if test='isOnDataBase=="1"' >
|
||||
and pw.id is not null
|
||||
</if>
|
||||
<if test='isOnDataBase=="0"' >
|
||||
and pw.id is null
|
||||
</if>
|
||||
</if>
|
||||
<if test="keyWord!=null and keyWord!=''">
|
||||
and kul.user_name like concat('%',#{keyWord},'%')
|
||||
</if>
|
||||
<if test="userId!=null and userId!=''">
|
||||
and kul.user_id=#{userId}
|
||||
</if>
|
||||
order by CAST(kul.user_id AS SIGNED) asc
|
||||
</select>
|
||||
|
||||
<select id="getProDeviceWorker" resultType="com.bonus.bmw.domain.vo.KqCmdBean">
|
||||
select
|
||||
bwem.worker_id,
|
||||
pw.name as workerName,
|
||||
bwem.pro_id,
|
||||
if(kul.id is null,0,1) as isIssue
|
||||
from bm_worker_ein_msg bwem
|
||||
left join pm_worker pw on pw.id = bwem.worker_id
|
||||
left join kq_user_list kul on kul.user_id = pw.id and kul.dev_code = #{deviceCode}
|
||||
where pro_id = #{proId}
|
||||
<if test="teamId != null">
|
||||
and team_id = #{teamId}
|
||||
</if>
|
||||
<if test="subId != null">
|
||||
and sub_id = #{subId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getDeviceTask" resultType="com.bonus.bmw.domain.vo.KqCmdBean">
|
||||
select
|
||||
cmd_code,
|
||||
cmd_param,
|
||||
trans_status,
|
||||
create_time,
|
||||
msg
|
||||
from kq_cmd_task
|
||||
where device_code = #{deviceCode}
|
||||
</select>
|
||||
|
||||
<select id="getProKqjTree" resultType="com.bonus.bmw.domain.vo.KqCmdBean">
|
||||
SELECT
|
||||
pp.id as pro_id,
|
||||
pp.pro_name,
|
||||
pad.device_code,
|
||||
ps.id as sub_id,
|
||||
ps.sub_name,
|
||||
pst.id as team_id
|
||||
,pst.team_name,
|
||||
pad.on_line onLine
|
||||
FROM
|
||||
pm_att_device pad
|
||||
INNER JOIN pm_project pp ON pad.pro_id = pp.id
|
||||
LEFT JOIN pm_sub ps ON ps.id = pad.sub_id
|
||||
LEFT JOIN pm_sub_team pst ON pst.id = pad.team_id
|
||||
order by pad.on_line desc
|
||||
</select>
|
||||
<select id="getTaskList" resultType="com.bonus.bmw.domain.vo.KqCmdBean">
|
||||
SELECT id taskId,cmd_code cmdCode,cmd_param cmdParam,trans_status transStatus,
|
||||
trans_status_update_time,create_time createTime,msg,
|
||||
CASE
|
||||
WHEN cmd_code = 'SET_USER_INFO' THEN '下发人员'
|
||||
WHEN cmd_code = 'DELETE_USER' THEN '删除人员'
|
||||
WHEN cmd_code = 'GET_USER_INFO' THEN '获取人员'
|
||||
WHEN cmd_code = 'RESET_FK' THEN '重启'
|
||||
WHEN cmd_code = 'GET_DEVICE_SETTING' THEN '获取配置'
|
||||
WHEN cmd_code = 'SET_DEVICE_SETTING' THEN '修改配置'
|
||||
ELSE cmd_code
|
||||
END AS cmdName ,
|
||||
CASE
|
||||
WHEN trans_status = '0' THEN '待执行'
|
||||
WHEN trans_status = '1' THEN '执行中'
|
||||
WHEN trans_status = '2' THEN '已完成'
|
||||
WHEN trans_status = '3' THEN '任务繁忙-人员占用'
|
||||
ELSE trans_status
|
||||
END AS statusName
|
||||
from kq_cmd_task
|
||||
where device_code=#{deviceCode}
|
||||
<if test="cmdCode!=null and cmdCode!=''">
|
||||
and cmd_code=#{cmdCode}
|
||||
</if>
|
||||
<if test="cmdName!=null and cmdName!=''">
|
||||
and CASE
|
||||
WHEN cmd_code = 'SET_USER_INFO' THEN '下发人员'
|
||||
WHEN cmd_code = 'DELETE_USER' THEN '删除人员'
|
||||
WHEN cmd_code = 'GET_USER_INFO' THEN '获取人员'
|
||||
WHEN cmd_code = 'RESET_FK' THEN '重启'
|
||||
WHEN cmd_code = 'GET_DEVICE_SETTING' THEN '获取配置'
|
||||
WHEN cmd_code = 'SET_DEVICE_SETTING' THEN '修改配置'
|
||||
ELSE cmd_code END
|
||||
like concat('%',#{cmdName},'%')
|
||||
</if>
|
||||
<if test="transStatus!=null and transStatus!=''">
|
||||
and trans_status=#{transStatus}
|
||||
</if>
|
||||
order by create_time desc
|
||||
</select>
|
||||
<select id="getHisTaskList" resultType="com.bonus.bmw.domain.vo.KqCmdBean">
|
||||
SELECT id taskId,cmd_code cmdCode,cmd_param cmdParam,trans_status transStatus,
|
||||
trans_status_update_time exeTime,create_time createTime,msg,
|
||||
CASE
|
||||
WHEN cmd_code = 'SET_USER_INFO' THEN '下发人员'
|
||||
WHEN cmd_code = 'DELETE_USER' THEN '删除人员'
|
||||
WHEN cmd_code = 'GET_USER_INFO' THEN '获取人员'
|
||||
WHEN cmd_code = 'RESET_FK' THEN '重启'
|
||||
WHEN cmd_code = 'GET_DEVICE_SETTING' THEN '获取配置'
|
||||
WHEN cmd_code = 'SET_DEVICE_SETTING' THEN '修改配置'
|
||||
ELSE cmd_code
|
||||
END AS cmdName ,
|
||||
CASE
|
||||
WHEN trans_status = '0' THEN '待执行'
|
||||
WHEN trans_status = '1' THEN '执行中'
|
||||
WHEN trans_status = '2' THEN '已完成'
|
||||
WHEN trans_status = '3' THEN '任务繁忙-人员占用'
|
||||
ELSE trans_status
|
||||
END AS statusName
|
||||
from kq_cmd_task_history
|
||||
where device_code=#{deviceCode}
|
||||
<if test="cmdCode!=null and cmdCode!=''">
|
||||
and cmd_code=#{cmdCode}
|
||||
</if>
|
||||
<if test="cmdName!=null and cmdName!=''">
|
||||
and CASE
|
||||
WHEN cmd_code = 'SET_USER_INFO' THEN '下发人员'
|
||||
WHEN cmd_code = 'DELETE_USER' THEN '删除人员'
|
||||
WHEN cmd_code = 'GET_USER_INFO' THEN '获取人员'
|
||||
WHEN cmd_code = 'RESET_FK' THEN '重启'
|
||||
WHEN cmd_code = 'GET_DEVICE_SETTING' THEN '获取配置'
|
||||
WHEN cmd_code = 'SET_DEVICE_SETTING' THEN '修改配置'
|
||||
ELSE cmd_code END
|
||||
like concat('%',#{cmdName},'%')
|
||||
</if>
|
||||
<if test="transStatus!=null and transStatus!=''">
|
||||
and trans_status=#{transStatus}
|
||||
</if>
|
||||
order by trans_status_update_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -204,4 +204,9 @@
|
|||
select count(1) from bm_worker_ein_pro_record where is_active='1' and pro_id = #{proId} and ein_status!=2
|
||||
</select>
|
||||
|
||||
<update id="proAttDataUpdateRemind">
|
||||
<foreach collection="list" item="item" separator=";">
|
||||
update tb_pro_month_table set is_update = '1' where pro_id = #{item.proId} and table_month = #{item.name}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue