鞍钢再次修改
This commit is contained in:
parent
e1a5b68d64
commit
c009e106c0
@ -1246,7 +1246,7 @@ public class ParamEnum {
|
||||
/**
|
||||
* 围栏报警1 离开工作区域
|
||||
*/
|
||||
WLBJ1(2, "围栏报警1 离开工作区域"),
|
||||
WLBJ1(2, "人员在考勤时间段内离岗报警"),
|
||||
/**
|
||||
* 温度报警
|
||||
*/
|
||||
@ -1258,7 +1258,7 @@ public class ParamEnum {
|
||||
/**
|
||||
* 围栏报警2 进入禁区
|
||||
*/
|
||||
WLBJ2(5, "围栏报警2 进入禁区"),
|
||||
WLBJ2(5, "人员非法闯入区域报警"),
|
||||
/**
|
||||
* 静默报警
|
||||
*/
|
||||
@ -1315,6 +1315,10 @@ public class ParamEnum {
|
||||
* 血压报警
|
||||
*/
|
||||
XYBJ(22, "血压报警"),
|
||||
/**
|
||||
* 区域超员报警
|
||||
*/
|
||||
CYBJ(23, "区域超员报警"),
|
||||
;
|
||||
|
||||
private Integer value;
|
||||
|
||||
@ -8,6 +8,7 @@ import com.zhgd.xmgl.modules.dangerous.service.IHiddenDangerInspectRecordService
|
||||
import com.zhgd.xmgl.modules.exam.service.IExamQuestionBankService;
|
||||
import com.zhgd.xmgl.modules.massrebound.service.IMassReboundSurveyAreaService;
|
||||
import com.zhgd.xmgl.modules.quality.service.IQualityInspectionRecordService;
|
||||
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatDevService;
|
||||
import com.zhgd.xmgl.modules.standard.service.IStandardAlarmService;
|
||||
import com.zhgd.xmgl.modules.worker.service.IWorkerAttendanceService;
|
||||
import com.zhgd.xmgl.modules.worker.service.IWorkerInfoService;
|
||||
@ -22,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -45,6 +47,8 @@ public class DownloadController {
|
||||
@Autowired
|
||||
private IWorkerInfoService workerInfoService;
|
||||
@Autowired
|
||||
private ISafetyHatDevService safetyHatDevService;
|
||||
@Autowired
|
||||
private IExamQuestionBankService examQuestionBankService;
|
||||
@Autowired
|
||||
private IWorkerMonthAttendanceStatisticsService workerMonthAttendanceStatisticsService;
|
||||
@ -333,6 +337,15 @@ public class DownloadController {
|
||||
examQuestionBankService.exporExcelTemplate(response, projectSn);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "人员安全帽导入模板下载", notes = "人员安全帽导入模板下载", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
|
||||
})
|
||||
@GetMapping(value = "/exporExcelSafeDevTemplate")
|
||||
public ModelAndView exporExcelSafeDevTemplate(HttpServletResponse response, String projectSn) {
|
||||
return safetyHatDevService.exporExcelSafeDevTemplate(response, projectSn);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "列表查询隐患检查记录信息下载", notes = "列表查询隐患检查记录信息下载", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
|
||||
|
||||
@ -1,6 +1,11 @@
|
||||
package com.zhgd.xmgl.modules.exam.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDev;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper;
|
||||
import com.zhgd.xmgl.modules.worker.service.IWorkerInfoService;
|
||||
import com.zhgd.xmgl.security.entity.UserInfo;
|
||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
@ -9,12 +14,11 @@ import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@ -59,6 +63,9 @@ public class ExamRegulationController {
|
||||
@Autowired
|
||||
private IExamRegulationService examRegulationService;
|
||||
|
||||
@Autowired
|
||||
private WorkerInfoMapper workerInfoMapper;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
@ -68,11 +75,17 @@ public class ExamRegulationController {
|
||||
@ApiOperation(value = " 分页列表查询规章制度信息", notes = "分页列表查询规章制度信息", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "workerId", value = "劳务ID", paramType = "body", required = true, defaultValue = "10", dataType = "String")
|
||||
})
|
||||
@PostMapping(value = "/page")
|
||||
public Result<IPage<ExamRegulation>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
|
||||
String workerId = MapUtils.getString(map, "workerId");
|
||||
map.remove("workerId");
|
||||
QueryWrapper<ExamRegulation> queryWrapper = QueryGenerator.initPageQueryWrapper(ExamRegulation.class, map);
|
||||
if (StringUtils.isNotBlank(workerId)) {
|
||||
queryWrapper.lambda().like(ExamRegulation::getWorkerId, workerId);
|
||||
}
|
||||
Page<ExamRegulation> page = PageUtil.getPage(map);
|
||||
IPage<ExamRegulation> pageList = examRegulationService.page(page, queryWrapper);
|
||||
return Result.success(pageList);
|
||||
@ -204,4 +217,56 @@ public class ExamRegulationController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定人员
|
||||
* @param examRegulation
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "规章制度管理", operType = "编辑", operDesc = "绑定人员")
|
||||
@ApiOperation(value = "绑定人员", notes = "绑定人员", httpMethod = "POST")
|
||||
@PostMapping(value = "/bind")
|
||||
public Result<ExamRegulation> bind(@RequestBody ExamRegulation examRegulation) {
|
||||
examRegulationService.bind(examRegulation);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消绑定
|
||||
* @param examRegulation
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "规章制度管理", operType = "编辑", operDesc = "取消绑定")
|
||||
@ApiOperation(value = "取消绑定", notes = "取消绑定", httpMethod = "POST")
|
||||
@PostMapping(value = "/unBind")
|
||||
public Result<ExamRegulation> unBind(@RequestBody ExamRegulation examRegulation) {
|
||||
examRegulationService.unBind(examRegulation);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询绑定权限人员列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "规章制度管理", operType = "分页查询", operDesc = "查询绑定权限人员列表")
|
||||
@ApiOperation(value = " 查询绑定权限人员列表", notes = "查询绑定权限人员列表", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "id", value = "规章制度ID", paramType = "body", required = true, dataType = "String")
|
||||
})
|
||||
@PostMapping(value = "/queryPageById")
|
||||
public Result<IPage<WorkerInfo>> queryPageById(@ApiIgnore @RequestBody Map<String, Object> map) {
|
||||
String id = MapUtils.getString(map, "id");
|
||||
Page<WorkerInfo> page = PageUtil.getPage(map);
|
||||
ExamRegulation byId = examRegulationService.getById(id);
|
||||
if (byId != null && byId.getWorkerId() != null) {
|
||||
map.remove("id");
|
||||
map.put("workerIdList", new ArrayList<>(Arrays.asList(byId.getWorkerId().split(","))));
|
||||
List<WorkerInfo> workerInfoList = workerInfoMapper.selectWorkerInfoList(page, map);
|
||||
page.setRecords(workerInfoList);
|
||||
}
|
||||
return Result.success(page);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,11 @@
|
||||
package com.zhgd.xmgl.modules.exam.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.xmgl.modules.exam.entity.ExamRegulation;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDev;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper;
|
||||
import com.zhgd.xmgl.security.entity.UserInfo;
|
||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
@ -9,12 +14,11 @@ import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@ -59,6 +63,9 @@ public class ExamSafetyManualController {
|
||||
@Autowired
|
||||
private IExamSafetyManualService examSafetyManualService;
|
||||
|
||||
@Autowired
|
||||
private WorkerInfoMapper workerInfoMapper;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
@ -68,11 +75,17 @@ public class ExamSafetyManualController {
|
||||
@ApiOperation(value = " 分页列表查询安全手册信息", notes = "分页列表查询安全手册信息", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "workerId", value = "劳务ID", paramType = "body", required = true, defaultValue = "10", dataType = "String")
|
||||
})
|
||||
@PostMapping(value = "/page")
|
||||
public Result<IPage<ExamSafetyManual>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
|
||||
String workerId = MapUtils.getString(map, "workerId");
|
||||
map.remove("workerId");
|
||||
QueryWrapper<ExamSafetyManual> queryWrapper = QueryGenerator.initPageQueryWrapper(ExamSafetyManual.class, map);
|
||||
if (StringUtils.isNotBlank(workerId)) {
|
||||
queryWrapper.lambda().like(ExamSafetyManual::getWorkerId, workerId);
|
||||
}
|
||||
Page<ExamSafetyManual> page = PageUtil.getPage(map);
|
||||
IPage<ExamSafetyManual> pageList = examSafetyManualService.page(page, queryWrapper);
|
||||
return Result.success(pageList);
|
||||
@ -204,4 +217,56 @@ public class ExamSafetyManualController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定人员
|
||||
* @param examSafetyManual
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "安全手册管理", operType = "编辑", operDesc = "绑定人员")
|
||||
@ApiOperation(value = "绑定人员", notes = "绑定人员", httpMethod = "POST")
|
||||
@PostMapping(value = "/bind")
|
||||
public Result<ExamSafetyManual> bind(@RequestBody ExamSafetyManual examSafetyManual) {
|
||||
examSafetyManualService.bind(examSafetyManual);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消绑定
|
||||
* @param examSafetyManual
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "安全手册管理", operType = "编辑", operDesc = "取消绑定")
|
||||
@ApiOperation(value = "取消绑定", notes = "取消绑定", httpMethod = "POST")
|
||||
@PostMapping(value = "/unBind")
|
||||
public Result<ExamSafetyManual> unBind(@RequestBody ExamSafetyManual examSafetyManual) {
|
||||
examSafetyManualService.unBind(examSafetyManual);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询绑定权限人员列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "安全手册管理", operType = "分页查询", operDesc = "查询绑定权限人员列表")
|
||||
@ApiOperation(value = " 查询绑定权限人员列表", notes = "查询绑定权限人员列表", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "id", value = "规章制度ID", paramType = "body", required = true, dataType = "String")
|
||||
})
|
||||
@PostMapping(value = "/queryPageById")
|
||||
public Result<IPage<WorkerInfo>> queryPageById(@ApiIgnore @RequestBody Map<String, Object> map) {
|
||||
String id = MapUtils.getString(map, "id");
|
||||
Page<WorkerInfo> page = PageUtil.getPage(map);
|
||||
ExamSafetyManual byId = examSafetyManualService.getById(id);
|
||||
if (byId != null && byId.getWorkerId() != null) {
|
||||
map.remove("id");
|
||||
map.put("workerIdList", new ArrayList<>(Arrays.asList(byId.getWorkerId().split(","))));
|
||||
List<WorkerInfo> workerInfoList = workerInfoMapper.selectWorkerInfoList(page, map);
|
||||
page.setRecords(workerInfoList);
|
||||
}
|
||||
return Result.success(page);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,10 +2,13 @@ package com.zhgd.xmgl.modules.exam.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
@ -79,4 +82,9 @@ public class ExamRegulation implements Serializable {
|
||||
@Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 权限劳务人员ID
|
||||
*/
|
||||
@ApiModelProperty(value = "权限劳务人员ID")
|
||||
private String workerId;
|
||||
}
|
||||
|
||||
@ -2,10 +2,13 @@ package com.zhgd.xmgl.modules.exam.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
@ -79,4 +82,14 @@ public class ExamSafetyManual implements Serializable {
|
||||
@Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 权限劳务人员ID
|
||||
*/
|
||||
@Excel(name = "权限劳务人员ID", width = 20)
|
||||
@ApiModelProperty(value = "权限劳务人员ID")
|
||||
private String workerId;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "有权限的劳务人员列表")
|
||||
private List<WorkerInfo> workerInfoList;
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.zhgd.xmgl.modules.exam.service;
|
||||
|
||||
import com.zhgd.xmgl.modules.exam.entity.ExamRegulation;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDev;
|
||||
|
||||
/**
|
||||
* @Description: 规章制度
|
||||
@ -11,4 +12,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface IExamRegulationService extends IService<ExamRegulation> {
|
||||
|
||||
void bind(ExamRegulation examRegulation);
|
||||
|
||||
void unBind(ExamRegulation examRegulation);
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.zhgd.xmgl.modules.exam.service;
|
||||
|
||||
import com.zhgd.xmgl.modules.exam.entity.ExamRegulation;
|
||||
import com.zhgd.xmgl.modules.exam.entity.ExamSafetyManual;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
@ -11,4 +12,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface IExamSafetyManualService extends IService<ExamSafetyManual> {
|
||||
|
||||
void bind(ExamSafetyManual examSafetyManual);
|
||||
|
||||
void unBind(ExamSafetyManual examSafetyManual);
|
||||
}
|
||||
|
||||
@ -1,12 +1,18 @@
|
||||
package com.zhgd.xmgl.modules.exam.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.zhgd.xmgl.modules.exam.entity.ExamRegulation;
|
||||
import com.zhgd.xmgl.modules.exam.mapper.ExamRegulationMapper;
|
||||
import com.zhgd.xmgl.modules.exam.service.IExamRegulationService;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDev;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 规章制度
|
||||
* @author: pengj
|
||||
@ -16,4 +22,27 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@Service
|
||||
public class ExamRegulationServiceImpl extends ServiceImpl<ExamRegulationMapper, ExamRegulation> implements IExamRegulationService {
|
||||
|
||||
@Override
|
||||
public void bind(ExamRegulation examRegulation) {
|
||||
ExamRegulation byId = this.getById(examRegulation.getId());
|
||||
if (StringUtils.isNotBlank(byId.getWorkerId())) {
|
||||
Set<String> split = new HashSet<String>(Arrays.asList(byId.getWorkerId().split(",")));
|
||||
split.addAll(new HashSet<String>(Arrays.asList(examRegulation.getWorkerId().split(","))));
|
||||
byId.setWorkerId(split.stream().collect(Collectors.joining(",")));
|
||||
} else {
|
||||
byId.setWorkerId(examRegulation.getWorkerId());
|
||||
}
|
||||
this.updateById(byId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unBind(ExamRegulation examRegulation) {
|
||||
ExamRegulation byId = this.getById(examRegulation.getId());
|
||||
if (StringUtils.isNotBlank(byId.getWorkerId())) {
|
||||
Set<String> split = new HashSet<String>(Arrays.asList(byId.getWorkerId().split(",")));
|
||||
split.removeAll(new HashSet<String>(Arrays.asList(examRegulation.getWorkerId().split(","))));
|
||||
byId.setWorkerId(split.stream().collect(Collectors.joining(",")));
|
||||
}
|
||||
this.updateById(byId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.zhgd.xmgl.modules.exam.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.zhgd.xmgl.modules.exam.entity.ExamRegulation;
|
||||
import com.zhgd.xmgl.modules.exam.entity.ExamSafetyManual;
|
||||
import com.zhgd.xmgl.modules.exam.mapper.ExamSafetyManualMapper;
|
||||
import com.zhgd.xmgl.modules.exam.service.IExamSafetyManualService;
|
||||
@ -7,6 +9,11 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 安全手册
|
||||
* @author: pengj
|
||||
@ -16,4 +23,27 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@Service
|
||||
public class ExamSafetyManualServiceImpl extends ServiceImpl<ExamSafetyManualMapper, ExamSafetyManual> implements IExamSafetyManualService {
|
||||
|
||||
@Override
|
||||
public void bind(ExamSafetyManual examSafetyManual) {
|
||||
ExamSafetyManual byId = this.getById(examSafetyManual.getId());
|
||||
if (StringUtils.isNotBlank(byId.getWorkerId())) {
|
||||
Set<String> split = new HashSet<String>(Arrays.asList(byId.getWorkerId().split(",")));
|
||||
split.addAll(new HashSet<String>(Arrays.asList(examSafetyManual.getWorkerId().split(","))));
|
||||
byId.setWorkerId(split.stream().collect(Collectors.joining(",")));
|
||||
} else {
|
||||
byId.setWorkerId(examSafetyManual.getWorkerId());
|
||||
}
|
||||
this.updateById(byId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unBind(ExamSafetyManual examSafetyManual) {
|
||||
ExamSafetyManual byId = this.getById(examSafetyManual.getId());
|
||||
if (StringUtils.isNotBlank(byId.getWorkerId())) {
|
||||
Set<String> split = new HashSet<String>(Arrays.asList(byId.getWorkerId().split(",")));
|
||||
split.removeAll(new HashSet<String>(Arrays.asList(examSafetyManual.getWorkerId().split(","))));
|
||||
byId.setWorkerId(split.stream().collect(Collectors.joining(",")));
|
||||
}
|
||||
this.updateById(byId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,181 @@
|
||||
package com.zhgd.xmgl.modules.safetyhat.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.jeecg.common.util.oConvertUtils;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatAlarmConfig;
|
||||
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatAlarmConfigService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 安全帽报警配置
|
||||
* @author: pengj
|
||||
* @date: 2025-05-13
|
||||
* @version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/xmgl/safetyHatAlarmConfig")
|
||||
@Slf4j
|
||||
@Api(tags = "安全帽报警配置管理")
|
||||
public class SafetyHatAlarmConfigController {
|
||||
@Autowired
|
||||
private ISafetyHatAlarmConfigService safetyHatAlarmConfigService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "安全帽报警配置管理", operType = "分页查询", operDesc = "分页列表查询安全帽报警配置信息")
|
||||
@ApiOperation(value = " 分页列表查询安全帽报警配置信息", notes = "分页列表查询安全帽报警配置信息", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")
|
||||
})
|
||||
@PostMapping(value = "/page")
|
||||
public Result<IPage<SafetyHatAlarmConfig>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
|
||||
QueryWrapper<SafetyHatAlarmConfig> queryWrapper = QueryGenerator.initPageQueryWrapper(SafetyHatAlarmConfig.class, map);
|
||||
Page<SafetyHatAlarmConfig> page = PageUtil.getPage(map);
|
||||
IPage<SafetyHatAlarmConfig> pageList = safetyHatAlarmConfigService.page(page, queryWrapper);
|
||||
return Result.success(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @param safetyHatAlarmConfig
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "安全帽报警配置管理", operType = "列表查询", operDesc = "列表查询安全帽报警配置信息")
|
||||
@ApiOperation(value = " 列表查询安全帽报警配置信息", notes = "列表查询安全帽报警配置信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/list")
|
||||
public Result<List<SafetyHatAlarmConfig>> queryList(@RequestBody SafetyHatAlarmConfig safetyHatAlarmConfig) {
|
||||
QueryWrapper<SafetyHatAlarmConfig> queryWrapper = QueryGenerator.initQueryWrapper(safetyHatAlarmConfig);
|
||||
List<SafetyHatAlarmConfig> list = safetyHatAlarmConfigService.list(queryWrapper);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param safetyHatAlarmConfig
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "安全帽报警配置管理", operType = "新增", operDesc = "添加安全帽报警配置信息")
|
||||
@ApiOperation(value = " 添加安全帽报警配置信息", notes = "添加安全帽报警配置信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<Object> add(@RequestBody SafetyHatAlarmConfig safetyHatAlarmConfig) {
|
||||
Result<SafetyHatAlarmConfig> result = new Result<SafetyHatAlarmConfig>();
|
||||
safetyHatAlarmConfigService.save(safetyHatAlarmConfig);
|
||||
return Result.success("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param safetyHatAlarmConfig
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "安全帽报警配置管理", operType = "修改", operDesc = "编辑安全帽报警配置信息")
|
||||
@ApiOperation(value = "编辑安全帽报警配置信息", notes = "编辑安全帽报警配置信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<SafetyHatAlarmConfig> edit(@RequestBody SafetyHatAlarmConfig safetyHatAlarmConfig) {
|
||||
Result<SafetyHatAlarmConfig> result = new Result<SafetyHatAlarmConfig>();
|
||||
SafetyHatAlarmConfig safetyHatAlarmConfigEntity = safetyHatAlarmConfigService.getById(safetyHatAlarmConfig.getId());
|
||||
if (safetyHatAlarmConfigEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = safetyHatAlarmConfigService.updateById(safetyHatAlarmConfig);
|
||||
if (ok) {
|
||||
result.success("修改成功!");
|
||||
} else {
|
||||
result.success("操作失败!");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "安全帽报警配置管理", operType = "查询", operDesc = "通过id查询安全帽报警配置信息")
|
||||
@ApiOperation(value = "通过id查询安全帽报警配置信息", notes = "通过id查询安全帽报警配置信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "id", value = "安全帽报警配置ID", paramType = "body", required = true, dataType = "Integer")
|
||||
@PostMapping(value = "/queryById")
|
||||
public Result<SafetyHatAlarmConfig> queryById(@ApiIgnore @RequestBody Map<String, Object> map) {
|
||||
Result<SafetyHatAlarmConfig> result = new Result<SafetyHatAlarmConfig>();
|
||||
SafetyHatAlarmConfig safetyHatAlarmConfig = safetyHatAlarmConfigService.getById(MapUtils.getString(map, "id"));
|
||||
if (safetyHatAlarmConfig == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
result.setResult(safetyHatAlarmConfig);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过SN查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "安全帽报警配置管理", operType = "查询", operDesc = "通过SN查询")
|
||||
@ApiOperation(value = "通过SN查询", notes = "通过id查询安全帽报警配置信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "Integer")
|
||||
@PostMapping(value = "/queryBySn")
|
||||
public Result<SafetyHatAlarmConfig> queryBySn(@ApiIgnore @RequestBody Map<String, Object> map) {
|
||||
Result<SafetyHatAlarmConfig> result = new Result<SafetyHatAlarmConfig>();
|
||||
SafetyHatAlarmConfig safetyHatAlarmConfig = safetyHatAlarmConfigService.getOne(Wrappers.<SafetyHatAlarmConfig>lambdaQuery()
|
||||
.eq(SafetyHatAlarmConfig::getProjectSn, MapUtils.getString(map, "projectSn")));
|
||||
if (safetyHatAlarmConfig == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
result.setResult(safetyHatAlarmConfig);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -8,6 +8,7 @@ import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatData;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDev;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.vo.WorkerListyByRegionVo;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.vo.WorkerNumByRegionVo;
|
||||
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatDataService;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
@ -18,6 +19,7 @@ import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.simpleframework.xml.core.Validate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -210,4 +212,15 @@ public class SafetyHatDataController {
|
||||
return Result.success(safetyHatDataService.countWorkerNumByRegion(param));
|
||||
}
|
||||
|
||||
|
||||
@OperLog(operModul = "智能安全帽实时数据管理", operType = "查询", operDesc = "区域人员列表")
|
||||
@ApiOperation(value = "区域人员列表", notes = "区域人员列表", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "regionId", value = "区域ID", paramType = "body", required = true, dataType = "String")
|
||||
})
|
||||
@PostMapping(value = "/getWorkerListByRegion")
|
||||
public Result<WorkerListyByRegionVo> getWorkerListByRegion(@ApiIgnore @RequestBody Map<String, Object> param) {
|
||||
return Result.success(safetyHatDataService.getWorkerListByRegion(param));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.zhgd.xmgl.modules.safetyhat.controller;
|
||||
package com.zhgd.xmgl.modules.safetyhat.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
@ -177,4 +177,30 @@ public class SafetyHatDevController {
|
||||
safetyHatDevService.importExcelTemplate(file, projectSn);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备绑定围栏
|
||||
* @param safetyHatDev
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "智能安全帽设备管理", operType = "编辑", operDesc = "设备绑定围栏")
|
||||
@ApiOperation(value = "设备绑定围栏", notes = "设备绑定围栏", httpMethod = "POST")
|
||||
@PostMapping(value = "/bind")
|
||||
public Result<SafetyHatDev> bind(@RequestBody SafetyHatDev safetyHatDev) {
|
||||
safetyHatDevService.bind(safetyHatDev);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消绑定
|
||||
* @param safetyHatDev
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "智能安全帽设备管理", operType = "编辑", operDesc = "取消绑定")
|
||||
@ApiOperation(value = "取消绑定", notes = "取消绑定", httpMethod = "POST")
|
||||
@PostMapping(value = "/unBind")
|
||||
public Result<SafetyHatDev> unBind(@RequestBody SafetyHatDev safetyHatDev) {
|
||||
safetyHatDevService.unBind(safetyHatDev);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,52 @@
|
||||
package com.zhgd.xmgl.modules.safetyhat.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @Description: 安全帽报警配置
|
||||
* @author: pengj
|
||||
* @date: 2025-05-13
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("safety_hat_alarm_config")
|
||||
@ApiModel(value = "SafetyHatAlarmConfig实体类", description = "SafetyHatAlarmConfig")
|
||||
public class SafetyHatAlarmConfig implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "SOS是否启用(0:未启用;1:已启用)")
|
||||
private Integer sosEnable;
|
||||
|
||||
@ApiModelProperty(value = "离开工作区域(0:未启用;1:已启用)")
|
||||
private Integer leaveEnable;
|
||||
|
||||
@ApiModelProperty(value = "报警人员非法闯入区域报警是否启用(0:未启用;1:已启用)")
|
||||
private Integer illegalEnable;
|
||||
|
||||
@ApiModelProperty(value = "区域超员999人报警是否启用(0:未启用;1:已启用)")
|
||||
private Integer numEnable;
|
||||
|
||||
@ApiModelProperty(value = "区域超员999人报警人员数量")
|
||||
private Integer numCount;
|
||||
|
||||
@ApiModelProperty(value = "项目SN")
|
||||
private String projectSn;
|
||||
}
|
||||
@ -98,4 +98,56 @@ public class SafetyHatDev implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private java.lang.String workerName;
|
||||
|
||||
/**
|
||||
* 围栏名称
|
||||
*/
|
||||
@Excel(name = "围栏名称", width = 15)
|
||||
@ApiModelProperty(value = "围栏名称")
|
||||
@TableField(exist = false)
|
||||
private java.lang.String fenceName;
|
||||
|
||||
/**
|
||||
* 围栏ID
|
||||
*/
|
||||
@Excel(name = "围栏ID", width = 15)
|
||||
@ApiModelProperty(value = "围栏ID")
|
||||
private java.lang.String fenceId;
|
||||
|
||||
/**
|
||||
* 班组ID
|
||||
*/
|
||||
@Excel(name = "班组ID", width = 15)
|
||||
@ApiModelProperty(value = "班组ID")
|
||||
@TableField(exist = false)
|
||||
private java.lang.String teamId;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
@Excel(name = "部门ID", width = 15)
|
||||
@ApiModelProperty(value = "部门ID")
|
||||
@TableField(exist = false)
|
||||
private java.lang.String deptId;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "身份证号")
|
||||
private java.lang.String idCard;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "班组")
|
||||
private java.lang.String teamName;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "部门")
|
||||
private java.lang.String departmentName;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "工种")
|
||||
private java.lang.String typeName;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "进场日期")
|
||||
private java.lang.String enterDate;
|
||||
|
||||
}
|
||||
|
||||
@ -97,6 +97,10 @@ public class SafetyHatFence implements Serializable {
|
||||
@ApiModelProperty(value = "围栏内人数")
|
||||
private Integer workerNum;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "围栏内违法人数")
|
||||
private Integer illegalNum;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "围栏内人员列表")
|
||||
private List<WorkerInfo> workerListInFence;
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
package com.zhgd.xmgl.modules.safetyhat.entity.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
@Data
|
||||
public class SafetyHatDevExport {
|
||||
|
||||
|
||||
@Excel(name = "人员名称", width = 15)
|
||||
@ApiModelProperty(value = "人员名称")
|
||||
private String workerName;
|
||||
|
||||
@Excel(name = "设备序号", width = 15)
|
||||
@ApiModelProperty(value = "设备序号")
|
||||
private String devSn;
|
||||
|
||||
@Excel(name = "分包单位", width = 15)
|
||||
@ApiModelProperty(value = "分包单位")
|
||||
private String enterpriseName;
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.zhgd.xmgl.modules.safetyhat.entity.vo;
|
||||
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class WorkerListyByRegionVo {
|
||||
|
||||
@ApiModelProperty(value = "合法人员信息")
|
||||
private List<WorkerInfo> list;
|
||||
|
||||
@ApiModelProperty(value = "非法人员信息")
|
||||
private List<WorkerInfo> list1;
|
||||
}
|
||||
@ -1,11 +1,16 @@
|
||||
package com.zhgd.xmgl.modules.safetyhat.entity.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class WorkerNumAndRegionName {
|
||||
private String date;
|
||||
private Integer workerNum;
|
||||
private Integer illegalNum;
|
||||
private String regionName;
|
||||
private Long regionId;
|
||||
private String fenceShape;
|
||||
private String fenceShapeArr;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
package com.zhgd.xmgl.modules.safetyhat.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatAlarmConfig;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 安全帽报警配置
|
||||
* @author: pengj
|
||||
* @date: 2025-05-13
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface SafetyHatAlarmConfigMapper extends BaseMapper<SafetyHatAlarmConfig> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
<?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.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatAlarmConfigMapper">
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,19 @@
|
||||
package com.zhgd.xmgl.modules.safetyhat.mapper.xml;
|
||||
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatAlarmConfig;
|
||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatAlarmConfigMapper;
|
||||
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatAlarmConfigService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 安全帽报警配置
|
||||
* @author: pengj
|
||||
* @date: 2025-05-13
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class SafetyHatAlarmConfigServiceImpl extends ServiceImpl<SafetyHatAlarmConfigMapper, SafetyHatAlarmConfig> implements ISafetyHatAlarmConfigService {
|
||||
|
||||
}
|
||||
@ -2,9 +2,13 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatDevMapper">
|
||||
<select id="queryList" resultType="com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDev">
|
||||
select shd.*,wi.worker_name
|
||||
select shd.*,wi.worker_name, b.team_name, c.department_name, wt.type_name, wi.id_card, wi.enter_date, b.id teamId, c.id deptId
|
||||
from safety_hat_dev shd
|
||||
left join worker_info wi on wi.id = shd.worker_info_id
|
||||
LEFT JOIN team_info b ON wi.team_id = b.id
|
||||
LEFT JOIN department_info c ON wi.department_id = c.id
|
||||
LEFT JOIN worker_type wt ON b.worker_type_id = wt.id
|
||||
LEFT JOIN enterprise_info en ON en.id = wi.enterprise_id
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
package com.zhgd.xmgl.modules.safetyhat.service;
|
||||
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatAlarmConfig;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 安全帽报警配置
|
||||
* @author: pengj
|
||||
* @date: 2025-05-13
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface ISafetyHatAlarmConfigService extends IService<SafetyHatAlarmConfig> {
|
||||
|
||||
}
|
||||
@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatData;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDev;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.vo.WorkerListyByRegionVo;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.vo.WorkerNumByRegionVo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -96,4 +98,6 @@ public interface ISafetyHatDataService extends IService<SafetyHatData> {
|
||||
* @return
|
||||
*/
|
||||
List<WorkerNumByRegionVo> countWorkerNumByRegion(Map<String, Object> param);
|
||||
|
||||
WorkerListyByRegionVo getWorkerListByRegion(Map<String, Object> param);
|
||||
}
|
||||
|
||||
@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDev;
|
||||
import com.zhgd.xmgl.modules.vehicleposition.entity.vo.CountVehiclePositionDevVo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@ -66,4 +68,11 @@ public interface ISafetyHatDevService extends IService<SafetyHatDev> {
|
||||
* @throws Exception
|
||||
*/
|
||||
void importExcelTemplate(MultipartFile excelFile, String projectSn) throws Exception;
|
||||
|
||||
|
||||
ModelAndView exporExcelSafeDevTemplate(HttpServletResponse response, String projectSn);
|
||||
|
||||
void bind(SafetyHatDev safetyHatDev);
|
||||
|
||||
void unBind(SafetyHatDev safetyHatDev);
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
@ -12,9 +13,12 @@ import com.zhgd.xmgl.base.entity.vo.TrendOneVo;
|
||||
import com.zhgd.xmgl.base.entity.vo.TrendVo;
|
||||
import com.zhgd.xmgl.enums.ParamEnum;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatAlarm;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatAlarmConfig;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDev;
|
||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatAlarmConfigMapper;
|
||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatAlarmMapper;
|
||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatDevMapper;
|
||||
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatAlarmConfigService;
|
||||
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatAlarmService;
|
||||
import com.zhgd.xmgl.util.DateUtils;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
@ -44,6 +48,9 @@ public class SafetyHatAlarmServiceImpl extends ServiceImpl<SafetyHatAlarmMapper,
|
||||
@Autowired
|
||||
private SafetyHatDevMapper safetyHatDevMapper;
|
||||
|
||||
@Autowired
|
||||
private SafetyHatAlarmConfigMapper safetyHatAlarmConfigMapper;
|
||||
|
||||
@Override
|
||||
public IPage<SafetyHatAlarm> queryPageList(HashMap<String, Object> paramMap) {
|
||||
QueryWrapper<SafetyHatAlarm> queryWrapper = getQueryWrapper(paramMap);
|
||||
@ -82,6 +89,13 @@ public class SafetyHatAlarmServiceImpl extends ServiceImpl<SafetyHatAlarmMapper,
|
||||
if (dev == null) {
|
||||
throw new OpenAlertException("设备编号不正确");
|
||||
}
|
||||
// 如果未配置,则不进行SOS报警
|
||||
SafetyHatAlarmConfig safetyHatAlarmConfig = safetyHatAlarmConfigMapper.selectOne(Wrappers.<SafetyHatAlarmConfig>lambdaQuery()
|
||||
.eq(SafetyHatAlarmConfig::getProjectSn, dev.getProjectSn()));
|
||||
if (safetyHatAlarm.getAlarmType() == ParamEnum.SafetyHatAlarmAlarmType.SOSBJ.getValue() &&
|
||||
safetyHatAlarmConfig != null && safetyHatAlarmConfig.getSosEnable() == 0) {
|
||||
return;
|
||||
}
|
||||
String str = ParamEnum.getStr(ParamEnum.SafetyHatAlarmAlarmType.values(), safetyHatAlarm.getAlarmType());
|
||||
safetyHatAlarm.setAlarmInfo(str);
|
||||
safetyHatAlarm.setWorkerInfoId(dev.getWorkerInfoId());
|
||||
|
||||
@ -10,24 +10,32 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.constant.Cts;
|
||||
import com.zhgd.xmgl.enums.ParamEnum;
|
||||
import com.zhgd.xmgl.modules.project.entity.Project;
|
||||
import com.zhgd.xmgl.modules.project.mapper.ProjectMapper;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.*;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.vo.WorkerListyByRegionVo;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.vo.WorkerNumAndRegionName;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.vo.WorkerNumByRegionVo;
|
||||
import com.zhgd.xmgl.modules.safetyhat.mapper.*;
|
||||
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatAlarmService;
|
||||
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatDataService;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerAttendanceRule;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import com.zhgd.xmgl.modules.worker.mapper.WorkerAttendanceRuleMapper;
|
||||
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper;
|
||||
import com.zhgd.xmgl.util.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -61,6 +69,12 @@ public class SafetyHatDataServiceImpl extends ServiceImpl<SafetyHatDataMapper, S
|
||||
private ISafetyHatAlarmService safetyHatAlarmService;
|
||||
@Autowired
|
||||
private ProjectMapper projectMapper;
|
||||
@Autowired
|
||||
private SafetyHatAlarmConfigMapper safetyHatAlarmConfigMapper;
|
||||
@Autowired
|
||||
private WorkerInfoMapper workerInfoMapper;
|
||||
@Autowired
|
||||
private WorkerAttendanceRuleMapper workerAttendanceRuleMapper;
|
||||
|
||||
@Override
|
||||
public IPage<SafetyHatData> queryPageList(HashMap<String, Object> paramMap) {
|
||||
@ -126,6 +140,10 @@ public class SafetyHatDataServiceImpl extends ServiceImpl<SafetyHatDataMapper, S
|
||||
//超过围栏报警,只要在一个围栏内就不报警
|
||||
List<SafetyHatFence> fenceList = safetyHatFenceMapper.selectList(new LambdaQueryWrapper<SafetyHatFence>()
|
||||
.eq(SafetyHatFence::getProjectSn, dev.getProjectSn()));
|
||||
|
||||
SafetyHatAlarmConfig safetyHatAlarmConfig = safetyHatAlarmConfigMapper.selectOne(Wrappers.<SafetyHatAlarmConfig>lambdaQuery()
|
||||
.eq(SafetyHatAlarmConfig::getProjectSn, dev.getProjectSn()));
|
||||
|
||||
if (CollUtil.isNotEmpty(fenceList)) {
|
||||
boolean isInFence = false;
|
||||
boolean inFence = false;
|
||||
@ -150,16 +168,47 @@ public class SafetyHatDataServiceImpl extends ServiceImpl<SafetyHatDataMapper, S
|
||||
}
|
||||
if (isInFence) {
|
||||
inFence = true;
|
||||
// 人员非法闯入区域报警
|
||||
if (!Arrays.asList(dev.getFenceId().split(",")).contains(fence.getId().toString())) {
|
||||
if (safetyHatAlarmConfig != null && safetyHatAlarmConfig.getIllegalEnable() == 1) {
|
||||
SafetyHatAlarm alarm = new SafetyHatAlarm();
|
||||
alarm.setDevSn(dev.getDevSn());
|
||||
alarm.setAlarmTime(new Date());
|
||||
alarm.setAlarmType(5);
|
||||
alarm.setLatitude(safetyHatData.getLatitude());
|
||||
alarm.setLongitude(safetyHatData.getLongitude());
|
||||
safetyHatAlarmService.add(alarm);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 人员在考勤时间段内离岗报警
|
||||
if (!inFence) {
|
||||
SafetyHatAlarm alarm = new SafetyHatAlarm();
|
||||
alarm.setDevSn(dev.getDevSn());
|
||||
alarm.setAlarmTime(new Date());
|
||||
alarm.setAlarmType(2);
|
||||
alarm.setLatitude(safetyHatData.getLatitude());
|
||||
alarm.setLongitude(safetyHatData.getLongitude());
|
||||
safetyHatAlarmService.add(alarm);
|
||||
if (safetyHatAlarmConfig != null && safetyHatAlarmConfig.getLeaveEnable() == 0) {
|
||||
return;
|
||||
}
|
||||
WorkerInfo workerInfo = workerInfoMapper.selectById(dev.getWorkerInfoId());
|
||||
Long ruleId = workerInfo.getRuleId();
|
||||
String startTime = null;
|
||||
String endTime = null;
|
||||
if (ruleId != null) {
|
||||
WorkerAttendanceRule workerAttendanceRule = workerAttendanceRuleMapper.selectById(ruleId);
|
||||
startTime = workerAttendanceRule.getStartTime();
|
||||
endTime = workerAttendanceRule.getEndTime();
|
||||
} else {
|
||||
startTime = "09:00:00";
|
||||
endTime = "18:00:00";
|
||||
}
|
||||
if (DateUtil.parseTime(startTime).compareTo(DateUtil.parseTime(DateUtil.format(new Date(), "HH:mm:ss"))) < 0
|
||||
&& DateUtil.parseTime(endTime).compareTo(DateUtil.parseTime(DateUtil.format(new Date(), "HH:mm:ss"))) > 0) {
|
||||
SafetyHatAlarm alarm = new SafetyHatAlarm();
|
||||
alarm.setDevSn(dev.getDevSn());
|
||||
alarm.setAlarmTime(new Date());
|
||||
alarm.setAlarmType(2);
|
||||
alarm.setLatitude(safetyHatData.getLatitude());
|
||||
alarm.setLongitude(safetyHatData.getLongitude());
|
||||
safetyHatAlarmService.add(alarm);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -294,16 +343,28 @@ public class SafetyHatDataServiceImpl extends ServiceImpl<SafetyHatDataMapper, S
|
||||
.put("projectSn", projectSn)
|
||||
.build());
|
||||
List<String> dateList = DateUtils.getDateTimeStrList(60, "yyyy-MM-dd");
|
||||
List<SafetyHatDev> safetyHatDevs = safetyHatDevMapper.selectList(Wrappers.<SafetyHatDev>lambdaQuery().eq(SafetyHatDev::getProjectSn, projectSn));
|
||||
for (String date : dateList) {
|
||||
List<WorkerNumAndRegionName> list = new ArrayList<>();
|
||||
for (SafetyHatFence region : regions) {
|
||||
List<SafetyHatData> datas1 = datas.stream().filter(safetyHatData -> DateUtil.compare(safetyHatData.getUploadTime(), DateUtil.beginOfDay(DateUtil.parse(date))) >= 0
|
||||
&& DateUtil.compare(safetyHatData.getUploadTime(), DateUtil.endOfDay(DateUtil.parse(date))) <= 0).collect(Collectors.toList());
|
||||
int workerNum = getWorkerNumInFence(region, datas1);
|
||||
Set<Long> workerSet = getWorkerNumInFence(region, datas1);
|
||||
int illegalNum = 0;
|
||||
for (Long workerId : workerSet) {
|
||||
List<SafetyHatDev> collect = safetyHatDevs.stream().filter(s -> s.getWorkerInfoId().toString().equals(workerId.toString())).collect(Collectors.toList());
|
||||
if (collect.size() == 0 || !Arrays.asList(collect.get(0).getFenceId().split(",")).contains(region.getId().toString())) {
|
||||
illegalNum = illegalNum + 1;
|
||||
}
|
||||
}
|
||||
WorkerNumAndRegionName workerNumAndRegionName = new WorkerNumAndRegionName();
|
||||
workerNumAndRegionName.setWorkerNum(workerNum);
|
||||
workerNumAndRegionName.setWorkerNum(workerSet.size());
|
||||
workerNumAndRegionName.setIllegalNum(illegalNum);
|
||||
workerNumAndRegionName.setDate(date);
|
||||
workerNumAndRegionName.setRegionName(region.getRegionName());
|
||||
workerNumAndRegionName.setRegionId(region.getId());
|
||||
workerNumAndRegionName.setFenceShape(region.getFenceShape());
|
||||
workerNumAndRegionName.setFenceShapeArr(region.getFenceShapeArr());
|
||||
list.add(workerNumAndRegionName);
|
||||
}
|
||||
WorkerNumByRegionVo oneVo = new WorkerNumByRegionVo();
|
||||
@ -315,8 +376,40 @@ public class SafetyHatDataServiceImpl extends ServiceImpl<SafetyHatDataMapper, S
|
||||
return vos;
|
||||
}
|
||||
|
||||
private int getWorkerNumInFence(SafetyHatFence fence, List<SafetyHatData> datas) {
|
||||
int workerNum = 0;
|
||||
@Override
|
||||
public WorkerListyByRegionVo getWorkerListByRegion(Map<String, Object> param) {
|
||||
String projectSn = MapUtils.getString(param, "projectSn");
|
||||
String regionId = MapUtils.getString(param, "regionId");
|
||||
SafetyHatFence safetyHatFence = safetyHatFenceMapper.selectById(regionId);
|
||||
List<SafetyHatDev> safetyHatDevs = safetyHatDevMapper.selectList(Wrappers.<SafetyHatDev>lambdaQuery().like(SafetyHatDev::getFenceId, regionId));
|
||||
// 区域绑定的人员
|
||||
List<Long> bindWorkerIds = safetyHatDevs.stream().map(s -> s.getWorkerInfoId()).collect(Collectors.toList());
|
||||
// 今天进入区域人员
|
||||
List<SafetyHatData> datas = safetyHatDataMapper.getNewestDataGroupByProjectSn(projectSn);
|
||||
// 在区域中的人员
|
||||
Set<Long> workerSet = getWorkerNumInFence(safetyHatFence, datas);
|
||||
Set<Long> allWorker = new HashSet<>();
|
||||
allWorker.addAll(workerSet);
|
||||
allWorker.addAll(bindWorkerIds);
|
||||
allWorker.add(-1L);
|
||||
param.put("workerIdList", allWorker);
|
||||
List<WorkerInfo> workerInfoList = workerInfoMapper.selectWorkerInfoList(new Page<>(-1, -1), param);
|
||||
WorkerListyByRegionVo vo = new WorkerListyByRegionVo();
|
||||
List<WorkerInfo> collect = workerInfoList.stream().filter(w -> bindWorkerIds.contains(w.getId())).collect(Collectors.toList());
|
||||
for (WorkerInfo workerInfo : collect) {
|
||||
workerInfo.setInserviceType(workerSet.contains(workerInfo.getId()) ? 1 : 2);
|
||||
}
|
||||
collect.sort((a,b) -> a.getInserviceType().compareTo(b.getInserviceType()));
|
||||
vo.setList(collect);
|
||||
List<WorkerInfo> collect1 = workerInfoList.stream().filter(w -> !bindWorkerIds.contains(w.getId()) && workerSet.contains(w.getId())).collect(Collectors.toList());
|
||||
for (WorkerInfo workerInfo : collect1) {
|
||||
workerInfo.setInserviceType(1);
|
||||
}
|
||||
vo.setList1(collect1);
|
||||
return vo;
|
||||
}
|
||||
|
||||
private Set<Long> getWorkerNumInFence(SafetyHatFence fence, List<SafetyHatData> datas) {
|
||||
Set<Long> inWorkerSet = new HashSet<>();
|
||||
for (SafetyHatData d : datas) {
|
||||
boolean inFence = false;
|
||||
@ -339,12 +432,10 @@ public class SafetyHatDataServiceImpl extends ServiceImpl<SafetyHatDataMapper, S
|
||||
}
|
||||
}
|
||||
if (inFence) {
|
||||
if (inWorkerSet.add(d.getWorkerInfoId())) {
|
||||
workerNum++;
|
||||
}
|
||||
inWorkerSet.add(d.getWorkerInfoId());
|
||||
}
|
||||
}
|
||||
return workerNum;
|
||||
return inWorkerSet;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,35 +5,46 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.exception.CustomException;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.execption.OpenPromptException;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatAlarm;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatData;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDev;
|
||||
import com.zhgd.jeecg.common.util.oConvertUtils;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.*;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.vo.SafetyHatDevExport;
|
||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatAlarmMapper;
|
||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatDataMapper;
|
||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatDevMapper;
|
||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatFenceMapper;
|
||||
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatDevService;
|
||||
import com.zhgd.xmgl.modules.vehicleposition.entity.vo.CountVehiclePositionDevVo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import com.zhgd.xmgl.modules.worker.mapper.EnterpriseInfoMapper;
|
||||
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper;
|
||||
import com.zhgd.xmgl.util.ExcelUtils;
|
||||
import com.zhgd.xmgl.util.MessageUtil;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -56,11 +67,34 @@ public class SafetyHatDevServiceImpl extends ServiceImpl<SafetyHatDevMapper, Saf
|
||||
private SafetyHatFenceMapper safetyHatFenceMapper;
|
||||
@Autowired
|
||||
private WorkerInfoMapper workerInfoMapper;
|
||||
@Autowired
|
||||
private EnterpriseInfoMapper enterpriseInfoMapper;
|
||||
|
||||
@Override
|
||||
public IPage<SafetyHatDev> queryPageList(HashMap<String, Object> paramMap) {
|
||||
String fenceId = MapUtils.getString(paramMap, "fenceId");
|
||||
String workerName = MapUtils.getString(paramMap, "workerName");
|
||||
String enterpriseId = MapUtils.getString(paramMap, "enterpriseId");
|
||||
String teamId = MapUtils.getString(paramMap, "teamId");
|
||||
String departmentId = MapUtils.getString(paramMap, "departmentId");
|
||||
paramMap.remove("fenceId");
|
||||
QueryWrapper<SafetyHatDev> queryWrapper = getQueryWrapper(paramMap);
|
||||
Page<SafetyHatDev> page = PageUtil.getPage(paramMap);
|
||||
if (StringUtils.isNotBlank(fenceId)) {
|
||||
queryWrapper.like("shd.fence_id", fenceId);
|
||||
}
|
||||
if (StringUtils.isNotBlank(workerName)) {
|
||||
queryWrapper.like("wi.worker_name", workerName);
|
||||
}
|
||||
if (StringUtils.isNotBlank(enterpriseId)) {
|
||||
queryWrapper.in("en.id", new ArrayList<>(Arrays.asList(enterpriseId.split(","))));
|
||||
}
|
||||
if (StringUtils.isNotBlank(teamId)) {
|
||||
queryWrapper.in("b.id", new ArrayList<>(Arrays.asList(teamId.split(","))));
|
||||
}
|
||||
if (StringUtils.isNotBlank(departmentId)) {
|
||||
queryWrapper.in("c.id", new ArrayList<>(Arrays.asList(departmentId.split(","))));
|
||||
}
|
||||
IPage<SafetyHatDev> pageList = baseMapper.queryList(page, queryWrapper);
|
||||
pageList.setRecords(dealList(pageList.getRecords()));
|
||||
return pageList;
|
||||
@ -169,5 +203,60 @@ public class SafetyHatDevServiceImpl extends ServiceImpl<SafetyHatDevMapper, Saf
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAndView exporExcelSafeDevTemplate(HttpServletResponse response, String projectSn) {
|
||||
// List<SafetyHatFence> fenceList = safetyHatFenceMapper.selectList(Wrappers.<SafetyHatFence>lambdaQuery()
|
||||
// .eq(SafetyHatFence::getProjectSn, projectSn));
|
||||
// List<EnterpriseInfo> enterpriseInfoList = enterpriseInfoMapper.selectBySnAndNumberOneList(projectSn, null);
|
||||
// List<WorkerInfo> workerInfoList = workerInfoMapper.selectOnJobWorkInfoList(projectSn);
|
||||
// ExcelUtils.exporExcelSafeDevTemplate(response, enterpriseInfoList, workerInfoList);
|
||||
// Step.1 组装查询条件
|
||||
//Step.2 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("projectSn", projectSn);
|
||||
List<WorkerInfo> workerInfoList = workerInfoMapper.selectWorkerInfoList(new Page<>(-1, -1), map);
|
||||
List<SafetyHatDevExport> list = new ArrayList<>();
|
||||
for (WorkerInfo workerInfo : workerInfoList) {
|
||||
SafetyHatDevExport export = new SafetyHatDevExport();
|
||||
export.setWorkerName(workerInfo.getWorkerName());
|
||||
export.setDevSn(workerInfo.getIdCard());
|
||||
export.setEnterpriseName(workerInfo.getEnterpriseName());
|
||||
list.add(export);
|
||||
}
|
||||
//导出文件名称
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "安全帽设备");
|
||||
mv.addObject(NormalExcelConstants.CLASS, SafetyHatDevExport.class);
|
||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams());
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, list);
|
||||
return mv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bind(SafetyHatDev safetyHatDev) {
|
||||
List<String> snList = Arrays.asList(safetyHatDev.getDevSn().split(","));
|
||||
List<SafetyHatDev> hatDevs = this.list(Wrappers.<SafetyHatDev>lambdaQuery().in(SafetyHatDev::getDevSn, snList));
|
||||
for (SafetyHatDev hatDev : hatDevs) {
|
||||
if (StringUtils.isNotBlank(hatDev.getFenceId())) {
|
||||
Set<String> split = new HashSet<String>(Arrays.asList(hatDev.getFenceId().split(",")));
|
||||
split.add(safetyHatDev.getFenceId());
|
||||
hatDev.setFenceId(split.stream().collect(Collectors.joining(",")));
|
||||
} else {
|
||||
hatDev.setFenceId(safetyHatDev.getFenceId());
|
||||
}
|
||||
}
|
||||
this.updateBatchById(hatDevs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unBind(SafetyHatDev safetyHatDev) {
|
||||
List<String> snList = Arrays.asList(safetyHatDev.getDevSn().split(","));
|
||||
List<SafetyHatDev> hatDevs = this.list(Wrappers.<SafetyHatDev>lambdaQuery().in(SafetyHatDev::getDevSn, snList));
|
||||
for (SafetyHatDev hatDev : hatDevs) {
|
||||
List<String> split = new ArrayList<String>(Arrays.asList(hatDev.getFenceId().split(",")));
|
||||
split.remove(safetyHatDev.getFenceId());
|
||||
hatDev.setFenceId(split.stream().collect(Collectors.joining(",")));
|
||||
}
|
||||
this.updateBatchById(hatDevs);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,12 +4,15 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatData;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDev;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatFence;
|
||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatDataMapper;
|
||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatDevMapper;
|
||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatFenceMapper;
|
||||
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatFenceService;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
@ -21,10 +24,8 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 智能安全帽-围栏
|
||||
@ -37,6 +38,9 @@ public class SafetyHatFenceServiceImpl extends ServiceImpl<SafetyHatFenceMapper,
|
||||
@Autowired
|
||||
private SafetyHatDataMapper safetyHatDataMapper;
|
||||
|
||||
@Autowired
|
||||
private SafetyHatDevMapper safetyHatDevMapper;
|
||||
|
||||
@Override
|
||||
public IPage<SafetyHatFence> queryPageList(HashMap<String, Object> paramMap) {
|
||||
QueryWrapper<SafetyHatFence> queryWrapper = getQueryWrapper(paramMap);
|
||||
@ -62,10 +66,12 @@ public class SafetyHatFenceServiceImpl extends ServiceImpl<SafetyHatFenceMapper,
|
||||
private List<SafetyHatFence> dealList(List<SafetyHatFence> list, HashMap<String, Object> paramMap) {
|
||||
String projectSn = MapUtils.getString(paramMap, "projectSn");
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
List<SafetyHatDev> safetyHatDevs = safetyHatDevMapper.selectList(Wrappers.<SafetyHatDev>lambdaQuery().eq(SafetyHatDev::getProjectSn, projectSn));
|
||||
List<SafetyHatData> dataList = safetyHatDataMapper.getNewestDataGroupByProjectSn(projectSn);
|
||||
for (SafetyHatFence fence : list) {
|
||||
ArrayList<WorkerInfo> workerInfos = new ArrayList<>();
|
||||
int workerNum = 0;
|
||||
int illegalNum = 0;
|
||||
if (CollUtil.isNotEmpty(dataList)) {
|
||||
for (SafetyHatData d : dataList) {
|
||||
boolean inFence = false;
|
||||
@ -93,10 +99,17 @@ public class SafetyHatFenceServiceImpl extends ServiceImpl<SafetyHatFenceMapper,
|
||||
workerInfo.setWorkerName(d.getWorkerName());
|
||||
workerInfo.setIdCard(d.getIdCard());
|
||||
workerInfos.add(workerInfo);
|
||||
List<SafetyHatDev> collect = safetyHatDevs.stream().filter(s -> s.getDevSn().equals(d.getDevSn())).collect(Collectors.toList());
|
||||
if (collect.size() > 0) {
|
||||
if (!Arrays.asList(collect.get(0).getFenceId().split(",")).contains(fence.getId().toString())) {
|
||||
illegalNum++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fence.setWorkerNum(workerNum);
|
||||
fence.setIllegalNum(illegalNum);
|
||||
fence.setWorkerListInFence(workerInfos);
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,6 +22,9 @@
|
||||
<if test="enterpriseId != null and enterpriseId != ''">
|
||||
and a.enterprise_id=#{enterpriseId}
|
||||
</if>
|
||||
<if test="enterpriseIds != null and enterpriseIds != ''">
|
||||
and FIND_IN_SET(a.enterprise_id,#{enterpriseIds})
|
||||
</if>
|
||||
<if test="userEnterpriseId != null and userEnterpriseId != ''">
|
||||
and FIND_IN_SET(a.enterprise_id,#{userEnterpriseId})
|
||||
</if>
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
and FIND_IN_SET(a.enterprise_id,#{userEnterpriseId})
|
||||
</if>
|
||||
<if test="enterpriseIds != null and enterpriseIds.size() != 0">
|
||||
and a.id in
|
||||
and a.enterprise_id in
|
||||
<foreach collection="enterpriseIds" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
@ -113,6 +113,13 @@
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.workerIdList != null and param.workerIdList != ''">
|
||||
and a.id in
|
||||
<foreach collection="param.workerIdList" item="item" index="index"
|
||||
separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.workerName != null and param.workerName != ''">
|
||||
and a.worker_name like CONCAT(CONCAT('%', #{param.workerName}), '%')
|
||||
</if>
|
||||
@ -134,6 +141,12 @@
|
||||
<if test="param.departmentId != null and param.departmentId != ''">
|
||||
and a.department_id = #{param.departmentId} and a.person_type = 2
|
||||
</if>
|
||||
<if test="param.teamIds != null and param.teamIds != ''">
|
||||
and find_in_set(a.team_id, #{param.teamIds}) and a.person_type = 1
|
||||
</if>
|
||||
<if test="param.departmentIds != null and param.departmentIds != ''">
|
||||
and find_in_set(a.department_id, #{param.departmentId}) and a.person_type = 2
|
||||
</if>
|
||||
<if test="param.personType != null and param.personType != ''">
|
||||
and a.person_type = #{param.personType}
|
||||
</if>
|
||||
|
||||
@ -15,6 +15,8 @@ import com.zhgd.xmgl.modules.worker.mapper.DepartmentInfoMapper;
|
||||
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper;
|
||||
import com.zhgd.xmgl.modules.worker.service.IDepartmentInfoService;
|
||||
import com.zhgd.xmgl.util.MessageUtil;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -71,6 +73,11 @@ public class DepartmentInfoServiceImpl extends ServiceImpl<DepartmentInfoMapper,
|
||||
@Override
|
||||
public Map<String, Object> getDepartmentInfoList(Map<String, Object> map) {
|
||||
Map<String, Object> data = new HashMap<>(16);
|
||||
String enterpriseId = MapUtils.getString(map, "enterpriseId");
|
||||
if (StringUtils.isNotBlank(enterpriseId)) {
|
||||
map.remove("enterpriseId");
|
||||
map.put("enterpriseIds", enterpriseId);
|
||||
}
|
||||
List<DepartmentInfo> list = departmentInfoMapper.getDepartmentInfoList(map);
|
||||
data.put("list", list);
|
||||
int totalWorkerNum = 0;
|
||||
|
||||
@ -99,10 +99,16 @@ public class TeamInfoServiceImpl extends ServiceImpl<TeamInfoMapper, TeamInfo> i
|
||||
if (systemUserService.isSupplier()) {
|
||||
List<EntityMap> enterprises = enterpriseInfoService.getSupplierEnterprises(map);
|
||||
if (CollUtil.isNotEmpty(enterprises)) {
|
||||
map.remove("enterpriseId");
|
||||
map.put("enterpriseIds", enterprises.stream().map(entityMap -> entityMap.get("id")).collect(Collectors.toList()));
|
||||
list = teamInfoMapper.getTeamInfoList(map);
|
||||
}
|
||||
} else {
|
||||
String enterpriseId = MapUtils.getString(map, "enterpriseId");
|
||||
if (StringUtils.isNotBlank(enterpriseId)) {
|
||||
map.remove("enterpriseId");
|
||||
map.put("enterpriseIds", new ArrayList<>(Arrays.asList(enterpriseId.split(","))));
|
||||
}
|
||||
list = teamInfoMapper.getTeamInfoList(map);
|
||||
}
|
||||
data.put("list", list);
|
||||
|
||||
@ -11,18 +11,27 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.config.SafetyHatWSClient;
|
||||
import com.zhgd.xmgl.modules.project.entity.Project;
|
||||
import com.zhgd.xmgl.modules.project.service.IProjectService;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatData;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDev;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.*;
|
||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatAlarmConfigMapper;
|
||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatDataMapper;
|
||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatDevMapper;
|
||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatFenceMapper;
|
||||
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatAlarmService;
|
||||
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatDataService;
|
||||
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatDevService;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import com.zhgd.xmgl.util.RegionUtil;
|
||||
import com.zhgd.xmgl.util.RundeSafeyHatUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.javacrumbs.shedlock.core.SchedulerLock;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
@ -35,9 +44,9 @@ import javax.websocket.WebSocketContainer;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 智能安全帽task
|
||||
@ -55,9 +64,17 @@ public class SafetyHatTask {
|
||||
@Autowired
|
||||
ISafetyHatDevService safetyHatDevService;
|
||||
@Autowired
|
||||
SafetyHatDataMapper safetyHatDataMapper;
|
||||
ISafetyHatDataService safetyHatDataService;
|
||||
@Autowired
|
||||
WebSocketContainer webSocketContainer;
|
||||
@Autowired
|
||||
SafetyHatFenceMapper safetyHatFenceMapper;
|
||||
@Autowired
|
||||
SafetyHatDataMapper safetyHatDataMapper;
|
||||
@Autowired
|
||||
SafetyHatAlarmConfigMapper safetyHatAlarmConfigMapper;
|
||||
@Autowired
|
||||
ISafetyHatAlarmService safetyHatAlarmService;
|
||||
|
||||
/**
|
||||
* 获取安全帽心跳
|
||||
@ -116,7 +133,7 @@ public class SafetyHatTask {
|
||||
log.info("定时2分钟获取安全帽数据任务,安全帽外部user_id没有设置,devSn:{}", dev.getDevSn());
|
||||
continue;
|
||||
}
|
||||
SafetyHatData lastData = safetyHatDataMapper.selectOne(new LambdaQueryWrapper<SafetyHatData>()
|
||||
SafetyHatData lastData = safetyHatDataService.getOne(new LambdaQueryWrapper<SafetyHatData>()
|
||||
.eq(SafetyHatData::getDevSn, dev.getDevSn()).orderByDesc(SafetyHatData::getUploadTime).last("limit 1"));
|
||||
String start;
|
||||
if (lastData != null) {
|
||||
@ -158,7 +175,7 @@ public class SafetyHatTask {
|
||||
data.setUploadTime(new Date(time * 1000L));
|
||||
data.setProjectSn(dev.getProjectSn());
|
||||
data.setIsPlatformData(1);
|
||||
safetyHatDataMapper.insert(data);
|
||||
safetyHatDataService.add(data);
|
||||
}
|
||||
} else {
|
||||
log.error("定时2分钟获取安全帽数据任务失败:devSn:{}", dev.getDevSn());
|
||||
@ -169,6 +186,98 @@ public class SafetyHatTask {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 区域超员报警
|
||||
*/
|
||||
@Scheduled(cron = "*/30 * * * * ?")
|
||||
@RequestMapping("overcrowding")
|
||||
public void overcrowding() {
|
||||
List<Project> projectList = projectService.list();
|
||||
HashMap<String, Object> paramMap = new HashMap();
|
||||
List<SafetyHatAlarm> list = new ArrayList<>();
|
||||
for (Project project : projectList) {
|
||||
SafetyHatAlarmConfig safetyHatAlarmConfig = safetyHatAlarmConfigMapper.selectOne(Wrappers.<SafetyHatAlarmConfig>lambdaQuery()
|
||||
.eq(SafetyHatAlarmConfig::getProjectSn, project.getProjectSn()));
|
||||
if (safetyHatAlarmConfig == null || safetyHatAlarmConfig.getNumEnable() == 0) {
|
||||
continue;
|
||||
}
|
||||
paramMap.put("projectSn", project.getProjectSn());
|
||||
QueryWrapper<SafetyHatFence> queryWrapper = getQueryWrapper(paramMap);
|
||||
List<SafetyHatFence> safetyHatFenceList = dealList(safetyHatFenceMapper.queryList(queryWrapper), paramMap);
|
||||
for (SafetyHatFence safetyHatFence : safetyHatFenceList) {
|
||||
if (safetyHatFence.getWorkerNum() > safetyHatAlarmConfig.getNumCount()) {
|
||||
SafetyHatAlarm alarm = new SafetyHatAlarm();
|
||||
alarm.setAlarmTime(new Date());
|
||||
alarm.setAlarmType(23);
|
||||
alarm.setAlarmInfo("围栏:" + safetyHatFence.getFenceName() + "发生区域超员报警,实际人数为" + safetyHatFence.getWorkerNum()
|
||||
+ "人员限制数为" + safetyHatAlarmConfig.getNumCount());
|
||||
list.add(alarm);
|
||||
}
|
||||
}
|
||||
}
|
||||
safetyHatAlarmService.saveBatch(list);
|
||||
}
|
||||
|
||||
private List<SafetyHatFence> dealList(List<SafetyHatFence> list, HashMap<String, Object> paramMap) {
|
||||
String projectSn = MapUtils.getString(paramMap, "projectSn");
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
List<SafetyHatDev> safetyHatDevs = safetyHatDevMapper.selectList(Wrappers.<SafetyHatDev>lambdaQuery().eq(SafetyHatDev::getProjectSn, projectSn));
|
||||
List<SafetyHatData> dataList = safetyHatDataMapper.getNewestDataGroupByProjectSn(projectSn);
|
||||
for (SafetyHatFence fence : list) {
|
||||
ArrayList<WorkerInfo> workerInfos = new ArrayList<>();
|
||||
int workerNum = 0;
|
||||
int illegalNum = 0;
|
||||
if (CollUtil.isNotEmpty(dataList)) {
|
||||
for (SafetyHatData d : dataList) {
|
||||
boolean inFence = false;
|
||||
//判断是否在围栏范围内
|
||||
if (Objects.equals(fence.getRangeType(), 1)) {
|
||||
inFence = RegionUtil.isInCircle(d.getLongitude(), d.getLatitude(), fence.getLongitude(), fence.getLatitude(), fence.getAreaRadius());
|
||||
} else if (Objects.equals(fence.getRangeType(), 2)) {
|
||||
String fenceShape = fence.getFenceShape();
|
||||
if (StrUtil.isNotBlank(fenceShape)) {
|
||||
String[] couples = StringUtils.split(fenceShape, ",");
|
||||
Double[] lon = new Double[couples.length];
|
||||
Double[] lat = new Double[couples.length];
|
||||
for (int i = 0; i < couples.length; i++) {
|
||||
String couple = couples[i];
|
||||
String[] two = StringUtils.split(couple, "|");
|
||||
lon[i] = Double.valueOf(two[0]);
|
||||
lat[i] = Double.valueOf(two[1]);
|
||||
}
|
||||
inFence = RegionUtil.isInPolygon(d.getLongitude(), d.getLatitude(), lon, lat);
|
||||
}
|
||||
}
|
||||
if (inFence) {
|
||||
workerNum++;
|
||||
WorkerInfo workerInfo = new WorkerInfo();
|
||||
workerInfo.setWorkerName(d.getWorkerName());
|
||||
workerInfo.setIdCard(d.getIdCard());
|
||||
workerInfos.add(workerInfo);
|
||||
List<SafetyHatDev> collect = safetyHatDevs.stream().filter(s -> s.getDevSn().equals(d.getDevSn())).collect(Collectors.toList());
|
||||
if (collect.size() > 0) {
|
||||
if (!Arrays.asList(collect.get(0).getFenceId().split(",")).contains(fence.getId().toString())) {
|
||||
illegalNum++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fence.setWorkerNum(workerNum);
|
||||
fence.setIllegalNum(illegalNum);
|
||||
fence.setWorkerListInFence(workerInfos);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private QueryWrapper<SafetyHatFence> getQueryWrapper(HashMap<String, Object> paramMap) {
|
||||
String alias = "t.";
|
||||
QueryWrapper<SafetyHatFence> queryWrapper = QueryGenerator.initPageQueryWrapper(SafetyHatFence.class, paramMap, alias);
|
||||
queryWrapper.orderByDesc(alias + RefUtil.fieldNameUlc(SafetyHatFence::getId));
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时设置昨天的轨迹到数据库
|
||||
*/
|
||||
@ -208,7 +317,7 @@ public class SafetyHatTask {
|
||||
if (rsJo.getBoolean("status")) {
|
||||
JSONArray dataJa = rsJo.getJSONArray("data");
|
||||
//删除昨日的数据
|
||||
safetyHatDataMapper.delete(new LambdaQueryWrapper<SafetyHatData>()
|
||||
safetyHatDataService.remove(new LambdaQueryWrapper<SafetyHatData>()
|
||||
.eq(SafetyHatData::getDevSn, dev.getDevSn())
|
||||
.eq(SafetyHatData::getIsPlatformData, 1)
|
||||
.ge(SafetyHatData::getUploadTime, yB)
|
||||
@ -230,7 +339,7 @@ public class SafetyHatTask {
|
||||
data.setUploadTime(new Date(time * 1000L));
|
||||
data.setProjectSn(dev.getProjectSn());
|
||||
data.setIsPlatformData(1);
|
||||
safetyHatDataMapper.insert(data);
|
||||
safetyHatDataService.add(data);
|
||||
}
|
||||
} else {
|
||||
log.error("定时设置昨天的轨迹到数据库任务失败:devSn:{}", dev.getDevSn());
|
||||
|
||||
@ -2,6 +2,9 @@ package com.zhgd.xmgl.util;
|
||||
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.exam.entity.ExamSubject;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatFence;
|
||||
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerSafeEducationWorker;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerType;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -298,6 +301,38 @@ public class ExcelUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void exporExcelSafeDevTemplate(HttpServletResponse response, List<EnterpriseInfo> enterpriseInfoList
|
||||
,List<WorkerInfo> workerInfoList) {
|
||||
try {
|
||||
ClassPathResource classPathResource = new ClassPathResource("excel/安全帽设备导入模板.xlsx");
|
||||
InputStream inputStream = classPathResource.getInputStream();
|
||||
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
|
||||
//分包单位下拉列
|
||||
XSSFSheet sheet3 = workbook.getSheet("分包单位");
|
||||
if (enterpriseInfoList.size() > 0) {
|
||||
for (int i = 0; i < enterpriseInfoList.size(); i++) {
|
||||
XSSFRow row1 = sheet3.createRow(i);
|
||||
XSSFCell cell1 = row1.createCell(0);
|
||||
cell1.setCellType(CellType.STRING);
|
||||
cell1.setCellValue(enterpriseInfoList.get(i).getEnterpriseName());
|
||||
}
|
||||
}
|
||||
//人员下拉列
|
||||
XSSFSheet sheet4 = workbook.getSheet("人员");
|
||||
if (workerInfoList.size() > 0) {
|
||||
for (int i = 0; i < workerInfoList.size(); i++) {
|
||||
XSSFRow row1 = sheet4.createRow(i);
|
||||
XSSFCell cell1 = row1.createCell(0);
|
||||
cell1.setCellType(CellType.STRING);
|
||||
cell1.setCellValue(workerInfoList.get(i).getWorkerName());
|
||||
}
|
||||
}
|
||||
downLoadExcel("安全帽设备导入模板.xlsx", response, workbook);
|
||||
} catch (IOException e) {
|
||||
log.error("error:", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void picture(String path, XSSFSheet sheet, int startRow, int endRow, int startCol, int endCol) {
|
||||
try {
|
||||
InputStream inputStreamPic = new FileInputStream(path);
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user