考勤机下发管理
This commit is contained in:
parent
36310b51aa
commit
b2b954ed46
|
|
@ -7,9 +7,7 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
|||
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.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
|
@ -32,7 +30,7 @@ public class KqCmdController extends BaseController {
|
|||
* 工程-考勤机树
|
||||
*
|
||||
* @param o 主键
|
||||
* @return 单条数据
|
||||
* @return 返回树
|
||||
*/
|
||||
@GetMapping("getProKqjTree")
|
||||
@SysLog(title = "工程考勤机树", businessType = OperaType.QUERY, logType = 0, module = "工程考勤机树", details = "工程考勤机树")
|
||||
|
|
@ -45,6 +43,126 @@ public class KqCmdController extends BaseController {
|
|||
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("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取考勤机人员
|
||||
*
|
||||
* @param o 主键
|
||||
* @return 人员
|
||||
*/
|
||||
@GetMapping("getWorkerByDeviceId")
|
||||
@SysLog(title = "获取考勤机人员", businessType = OperaType.QUERY, logType = 0, module = "获取考勤机人员", details = "获取考勤机人员")
|
||||
public AjaxResult getWorkerByDeviceId(KqCmdBean o) {
|
||||
try {
|
||||
return service.getUserByDeviceId(o);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工程考勤机人员列表
|
||||
*
|
||||
* @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("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 下发人员
|
||||
*
|
||||
* @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("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -88,11 +88,11 @@ public class PmWorkerDto {
|
|||
* 权限相关
|
||||
* 组织编号
|
||||
*/
|
||||
private Integer orgId;
|
||||
private String orgId;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String photoIds;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class ProDto {
|
|||
/**
|
||||
* 项目部id
|
||||
*/
|
||||
private Integer orgId;
|
||||
private String orgId;
|
||||
|
||||
/**
|
||||
* 工程简称
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class BmSubContract {
|
|||
/**
|
||||
* 项目部id
|
||||
*/
|
||||
private Integer orgId;
|
||||
private String orgId;
|
||||
|
||||
/**
|
||||
* 分包合同编码
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ public class PmSubTeamContract {
|
|||
/**
|
||||
* 项目部id
|
||||
*/
|
||||
private Integer orgId;
|
||||
private String orgId;
|
||||
|
||||
/**
|
||||
* 是否上海项目 1 是 0 不是
|
||||
|
|
|
|||
|
|
@ -169,6 +169,6 @@ public class BmWorkerAtt {
|
|||
*/
|
||||
private Integer teamEinStatus;
|
||||
|
||||
private Integer orgId;
|
||||
private String orgId;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ public class BmWorkerContract {
|
|||
private Integer teamId;
|
||||
private Integer subId;
|
||||
private Integer subComId;
|
||||
private Integer orgId;
|
||||
private String orgId;
|
||||
|
||||
private String photoIds;
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,22 @@ public class KqCmdBean {
|
|||
* 工程id
|
||||
*/
|
||||
private Integer proId;
|
||||
private Integer subId;
|
||||
private Integer teamId;
|
||||
|
||||
private String proName;
|
||||
private String subName;
|
||||
private String teamName;
|
||||
|
||||
private String workerId;
|
||||
private String workerName;
|
||||
private String phone;
|
||||
|
||||
private String createTime;
|
||||
|
||||
public KqCmdBean(String deviceCode, String subName, String teamName) {
|
||||
this.deviceCode = deviceCode;
|
||||
this.subName = subName;
|
||||
this.teamName = teamName;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,4 +9,10 @@ import java.util.List;
|
|||
public interface KqCmdMapper {
|
||||
|
||||
List<KqCmdBean> getProKqjTree(KqCmdBean o);
|
||||
|
||||
List<KqCmdBean> getUserByDeviceId(KqCmdBean o);
|
||||
|
||||
List<KqCmdBean> getProDeviceWorker(KqCmdBean o);
|
||||
|
||||
List<KqCmdBean> getDeviceTask(KqCmdBean o);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ public interface PmWorkerMapper {
|
|||
|
||||
Integer getSubIdBySubName(String subName);
|
||||
|
||||
Integer getTeamIdByTeamName(String teamName);
|
||||
Integer getTeamIdByTeamName(@Param("teamName") String teamName, @Param("subId") Integer subId);
|
||||
|
||||
Integer getPostIdByPostName(String postName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,4 +6,18 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
|||
public interface KqCmdService{
|
||||
|
||||
AjaxResult getProKqjTree(KqCmdBean o);
|
||||
|
||||
AjaxResult refreshDevice(KqCmdBean o);
|
||||
|
||||
AjaxResult getUserByDeviceId(KqCmdBean o);
|
||||
|
||||
AjaxResult restartDevice(KqCmdBean o);
|
||||
|
||||
AjaxResult getProDeviceWorker(KqCmdBean o);
|
||||
|
||||
AjaxResult pushWorkerByDevice(KqCmdBean o);
|
||||
|
||||
AjaxResult delWorkerByDevice(KqCmdBean o);
|
||||
|
||||
AjaxResult getDeviceTask(KqCmdBean o);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ 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.utils.StringUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
@ -19,6 +20,9 @@ public class KqCmdServiceImpl implements KqCmdService {
|
|||
@Resource
|
||||
private KqCmdMapper mapper;
|
||||
|
||||
@Resource
|
||||
private UrkSendServiceImpl urkSendServiceImpl;
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult getProKqjTree(KqCmdBean o) {
|
||||
|
|
@ -28,6 +32,52 @@ public class KqCmdServiceImpl implements KqCmdService {
|
|||
return AjaxResult.success(deviceTree);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult refreshDevice(KqCmdBean o) {
|
||||
// urkSendServiceImpl.refreshDevice(o.getDeviceCode(),o.getProId(),o.getSupId(),o.getTeamId());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getUserByDeviceId(KqCmdBean o) {
|
||||
List<KqCmdBean> list = mapper.getUserByDeviceId(o);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult restartDevice(KqCmdBean o) {
|
||||
// urkSendServiceImpl.refreshDevice(o.getDeviceCode(),o.getProId(),o.getSupId(),o.getTeamId());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getProDeviceWorker(KqCmdBean o) {
|
||||
List<KqCmdBean> list = mapper.getProDeviceWorker(o);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult pushWorkerByDevice(KqCmdBean o) {
|
||||
//先删除在下发
|
||||
//deviceCode,workerId(可以多个),pro_id
|
||||
// urkSendServiceImpl.refreshDevice(o.getDeviceCode(),o.getProId(),o.getSupId(),o.getTeamId());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult delWorkerByDevice(KqCmdBean o) {
|
||||
//deviceCode,workerId(可以多个),pro_id
|
||||
// urkSendServiceImpl.refreshDevice(o.getDeviceCode(),o.getProId(),o.getSupId(),o.getTeamId());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getDeviceTask(KqCmdBean o) {
|
||||
List<KqCmdBean> list = mapper.getDeviceTask(o);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建设备树
|
||||
* @param data 包含pro_id和device_code的数据列表
|
||||
|
|
@ -35,28 +85,37 @@ public class KqCmdServiceImpl implements KqCmdService {
|
|||
*/
|
||||
public static List<TreeNode> buildDeviceTree(List<KqCmdBean> data) {
|
||||
// 使用Map来存储pro_id到设备列表的映射
|
||||
Map<String, List<String>> proToDeviceMap = new HashMap<>();
|
||||
Map<String, List<KqCmdBean>> proToDeviceMap = new HashMap<>();
|
||||
// 遍历数据,建立映射关系
|
||||
for (KqCmdBean item : data) {
|
||||
String proName = item.getProName();
|
||||
String deviceCode = item.getDeviceCode();
|
||||
proToDeviceMap.computeIfAbsent(proName, k -> new ArrayList<>()).add(deviceCode);
|
||||
String subName = item.getSubName();
|
||||
String teamName = item.getTeamName();
|
||||
proToDeviceMap.computeIfAbsent(proName, k -> new ArrayList<>()).add(new KqCmdBean(deviceCode, subName, teamName));
|
||||
}
|
||||
// 构建树形结构
|
||||
List<TreeNode> result = new ArrayList<>();
|
||||
for (Map.Entry<String, List<String>> entry : proToDeviceMap.entrySet()) {
|
||||
for (Map.Entry<String, List<KqCmdBean>> entry : proToDeviceMap.entrySet()) {
|
||||
String proName = entry.getKey();
|
||||
List<String> deviceCodes = entry.getValue();
|
||||
List<KqCmdBean> deviceCodes = entry.getValue();
|
||||
// 创建项目节点
|
||||
TreeNode projectNode = new TreeNode(proName, "项目" + proName, "project");
|
||||
TreeNode projectNode = new TreeNode(proName, "工程-" + proName, "project");
|
||||
// 为每个设备码创建子节点
|
||||
for (String deviceCode : deviceCodes) {
|
||||
TreeNode deviceNode = new TreeNode(deviceCode, "设备" + deviceCode, "device");
|
||||
for (KqCmdBean bean : deviceCodes) {
|
||||
String deviceCode = bean.getDeviceCode();
|
||||
String deviceName = "设备-" + deviceCode;
|
||||
if(StringUtils.isNotEmpty(bean.getSubName())){
|
||||
deviceName += "|分包-" + bean.getSubName();
|
||||
if(StringUtils.isNotEmpty(bean.getTeamName())){
|
||||
deviceName += "|班组-" + bean.getTeamName();
|
||||
}
|
||||
}
|
||||
TreeNode deviceNode = new TreeNode(deviceCode, deviceName, "device");
|
||||
projectNode.addChild(deviceNode);
|
||||
}
|
||||
result.add(projectNode);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ public class PmWorkerServiceImpl implements PmWorkerService{
|
|||
private void importEinData(PmWorker worker) {
|
||||
Integer a = mapper.getProIdByProName(worker.getProName());
|
||||
Integer b = mapper.getSubIdBySubName(worker.getSubName());
|
||||
Integer c = mapper.getTeamIdByTeamName(worker.getTeamName());
|
||||
Integer c = mapper.getTeamIdByTeamName(worker.getTeamName(),b);
|
||||
Integer d = mapper.getPostIdByPostName(worker.getPostName());
|
||||
if(a !=null && a > 0 && b !=null && b > 0 && c !=null && c > 0 && d !=null && d > 0){
|
||||
//入场关联数据新增
|
||||
|
|
@ -521,6 +521,7 @@ public class PmWorkerServiceImpl implements PmWorkerService{
|
|||
// 添加员工时,判断员工编号是否已存在
|
||||
if(StringUtils.isEmpty(worker.getIdNumber())){
|
||||
failureMsg.insert(0, "导入失败!第 " + (workerList.indexOf(worker) + 1) + " 行数据缺少关键信息!");
|
||||
failureNum++;
|
||||
continue;
|
||||
}
|
||||
PmWorker w = mapper.getWorkerByNumber(worker.getIdNumber(),1);
|
||||
|
|
|
|||
|
|
@ -2,21 +2,62 @@
|
|||
<!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">
|
||||
<resultMap id="BaseResultMap" type="com.bonus.bmw.domain.vo.KqCmdBean">
|
||||
<id column="id" property="id" />
|
||||
<result column="cmd_code" property="cmdCode" />
|
||||
<result column="cmd_param" property="cmdParam" />
|
||||
<result column="device_code" property="deviceCode" />
|
||||
<result column="trans_status" property="transStatus" />
|
||||
<result column="trans_status_update_time" property="transStatusUpdateTime" />
|
||||
<result column="update_state" property="updateState" />
|
||||
<result column="msg" property="msg" />
|
||||
<result column="pro_id" property="proId" />
|
||||
<result column="device_code" property="deviceCode"/>
|
||||
<result column="phone" property="phone"/>
|
||||
<result column="worker_id" property="workerId"/>
|
||||
<result column="worker_name" property="workerName"/>
|
||||
<result column="pro_id" property="proId"/>
|
||||
<result column="workerName" property="workerName"/>
|
||||
<result column="cmd_code" property="cmdCode"/>
|
||||
<result column="cmd_param" property="cmdParam"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="msg" property="msg"/>
|
||||
<result column="trans_status" property="transStatus"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getProKqjTree" resultType="com.bonus.bmw.domain.vo.KqCmdBean">
|
||||
select
|
||||
pp.pro_name,device_code
|
||||
pp.pro_name,device_code,ps.sub_name,pst.team_name,pp.id as proId,ps.id as subId,pst.id as teamId
|
||||
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
|
||||
</select>
|
||||
|
||||
<select id="getUserByDeviceId" resultMap="BaseResultMap">
|
||||
select
|
||||
user_id as worker_id,
|
||||
user_name as worker_name,
|
||||
user_phone as phone,
|
||||
dev_code as device_code
|
||||
from kq_user_list
|
||||
where dev_code = #{deviceCode}
|
||||
</select>
|
||||
|
||||
<select id="getProDeviceWorker" resultMap="BaseResultMap">
|
||||
select
|
||||
bwem.worker_id,
|
||||
pw.name as workerName,
|
||||
bwem.pro_id
|
||||
from bm_worker_ein_msg bwem
|
||||
left join pm_worker pw on pw.id = bwem.worker_id
|
||||
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" resultMap="BaseResultMap">
|
||||
select
|
||||
cmd_code,
|
||||
cmd_param,
|
||||
trans_status,
|
||||
create_time,
|
||||
msg
|
||||
from kq_cmd_task
|
||||
where device_code = #{deviceCode}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -378,7 +378,7 @@
|
|||
</select>
|
||||
|
||||
<select id="getTeamIdByTeamName" resultType="java.lang.Integer">
|
||||
select id from pm_sub_team where team_name = #{teamName}
|
||||
select id from pm_sub_team where team_name = #{teamName} and sub_id = #{subId}
|
||||
</select>
|
||||
|
||||
<select id="getPostIdByPostName" resultType="java.lang.Integer">
|
||||
|
|
|
|||
Loading…
Reference in New Issue