Merge branch 'guoshengxiong' into uat
This commit is contained in:
commit
db2ff0124f
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
import com.zhgd.xmgl.modules.video.entity.AiAnalyseHardWareRecord;
|
||||
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.UfaceDev;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@ -124,4 +125,12 @@ public class QualityRegion implements Serializable {
|
||||
@ApiModelProperty(value = "区域设备")
|
||||
private List<RegionDev> regionDevList;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "人脸设备")
|
||||
private List<UfaceDev> ufaceDevList;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "人脸设备(逗号分割)")
|
||||
private java.lang.String ufaceDevName;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
package com.zhgd.xmgl.modules.quality.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: pds
|
||||
* @date: 2025-06-12
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("quality_region_to_uface_dev")
|
||||
@ApiModel(value = "QualityRegionToUfaceDev实体类", description = "QualityRegionToUfaceDev")
|
||||
public class QualityRegionToUfaceDev implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
/**
|
||||
* 区域id
|
||||
*/
|
||||
@ApiModelProperty(value = "区域id")
|
||||
private Long qualityRegionId;
|
||||
/**
|
||||
* 人脸设备id
|
||||
*/
|
||||
@ApiModelProperty(value = "人脸设备id")
|
||||
private Long ufaceDevId;
|
||||
/**
|
||||
* 创建时间 yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新时间 yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.zhgd.xmgl.modules.quality.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zhgd.xmgl.modules.quality.entity.QualityRegionToUfaceDev;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Description: 区域和人脸设备中间表
|
||||
* @author: pds
|
||||
* @date: 2025-06-12
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface QualityRegionToUfaceDevMapper extends BaseMapper<QualityRegionToUfaceDev> {
|
||||
}
|
||||
@ -35,11 +35,26 @@
|
||||
<id property="hardwareName" column="hardware_name"/>
|
||||
<id property="hardwareId" column="hardware_id"/>
|
||||
</collection>
|
||||
<collection property="ufaceDevList"
|
||||
ofType="com.zhgd.xmgl.modules.worker.entity.UfaceDev"
|
||||
notNullColumn="uface_dev_id">
|
||||
<id property="id" column="uface_dev_id"/>
|
||||
<id property="devName" column="dev_name"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectQualityRegionList" resultMap="selectQualityRegionListRm">
|
||||
SELECT qr.*,ei.id as enterprise_info_id,ei.enterprise_name as
|
||||
enterpriseName,su.user_id,su.real_name,ei.enterprise_sn,qrtaah.ai_analyse_hard_ware_record_id,aahwr.hardware_name,aahwr.hardware_id
|
||||
SELECT qr.*
|
||||
,ei.id as enterprise_info_id
|
||||
,ei.enterprise_name as enterpriseName
|
||||
,su.user_id
|
||||
,su.real_name
|
||||
,ei.enterprise_sn
|
||||
,qrtaah.ai_analyse_hard_ware_record_id
|
||||
,aahwr.hardware_name
|
||||
,aahwr.hardware_id
|
||||
,ud.dev_name
|
||||
,qrtud.uface_dev_id
|
||||
from quality_region qr
|
||||
LEFT JOIN quality_region_to_enterprise te ON te.quality_region_id=qr.id
|
||||
LEFT JOIN enterprise_info ei on ei.id=te.enterprise_id
|
||||
@ -48,6 +63,8 @@
|
||||
LEFT JOIN system_user su ON su.user_id = qrtu.user_id
|
||||
left join quality_region_to_ai_analyse_hard qrtaah on qr.id = qrtaah.quality_region_id
|
||||
left join ai_analyse_hard_ware_record aahwr on aahwr.id=qrtaah.ai_analyse_hard_ware_record_id
|
||||
LEFT JOIN quality_region_to_uface_dev qrtud on qr.id = qrtud.quality_region_id
|
||||
left join uface_dev ud on ud.id = qrtud.uface_dev_id
|
||||
left join project_enterprise pe on pe.enterprise_id = ei.id and pe.project_sn = qr.project_sn
|
||||
left join enterprise_type et on et.id = pe.enterprise_type_id
|
||||
WHERE qr.project_sn = #{projectSn}
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
<?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.quality.mapper.QualityRegionToUfaceDevMapper">
|
||||
</mapper>
|
||||
@ -0,0 +1,14 @@
|
||||
package com.zhgd.xmgl.modules.quality.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.xmgl.modules.quality.entity.QualityRegionToUfaceDev;
|
||||
|
||||
/**
|
||||
* @Description: 区域和人脸设备中间表
|
||||
* @author: pds
|
||||
* @date: 2025-06-12
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface IQualityRegionToUfaceDevService extends IService<QualityRegionToUfaceDev> {
|
||||
|
||||
}
|
||||
@ -20,11 +20,14 @@ import com.zhgd.xmgl.modules.quality.mapper.QualityRegionToAiAnalyseHardMapper;
|
||||
import com.zhgd.xmgl.modules.quality.mapper.QualityRegionToEnterpriseMapper;
|
||||
import com.zhgd.xmgl.modules.quality.mapper.QualityRegionToUserMapper;
|
||||
import com.zhgd.xmgl.modules.quality.service.IQualityRegionService;
|
||||
import com.zhgd.xmgl.modules.quality.service.IQualityRegionToUfaceDevService;
|
||||
import com.zhgd.xmgl.modules.quality.service.IRegionDevService;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatData;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatFence;
|
||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatDataMapper;
|
||||
import com.zhgd.xmgl.modules.video.entity.AiAnalyseHardWareRecord;
|
||||
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.UfaceDev;
|
||||
import com.zhgd.xmgl.modules.worker.service.impl.EnterpriseInfoServiceImpl;
|
||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
import com.zhgd.xmgl.util.ListUtils;
|
||||
@ -33,6 +36,7 @@ import com.zhgd.xmgl.util.RegionUtil;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -66,6 +70,9 @@ public class QualityRegionServiceImpl extends ServiceImpl<QualityRegionMapper, Q
|
||||
|
||||
@Autowired
|
||||
private SafetyHatDataMapper safetyHatDataMapper;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IQualityRegionToUfaceDevService qualityRegionToUfaceDevService;
|
||||
|
||||
@Override
|
||||
public List<QualityRegion> selectQualityRegionList(Map<String, Object> map) {
|
||||
@ -92,6 +99,11 @@ public class QualityRegionServiceImpl extends ServiceImpl<QualityRegionMapper, Q
|
||||
if (CollUtil.isNotEmpty(aiAnalyseHardWareRecords)) {
|
||||
qualityRegion.setAiAnalyseHardName(StrUtil.join(",", aiAnalyseHardWareRecords.stream().map(AiAnalyseHardWareRecord::getHardwareName).collect(Collectors.toList())));
|
||||
}
|
||||
List<UfaceDev> ufaceDevList = qualityRegion.getUfaceDevList();
|
||||
if (CollUtil.isNotEmpty(ufaceDevList)) {
|
||||
qualityRegion.setUfaceDevName(StrUtil.join(",", ufaceDevList.stream().map(UfaceDev::getDevName).collect(Collectors.toList())));
|
||||
}
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@ -185,10 +197,12 @@ public class QualityRegionServiceImpl extends ServiceImpl<QualityRegionMapper, Q
|
||||
.eq(QualityRegionToUser::getQualityRegionId, qualityRegion.getId()));
|
||||
toAiAnalyseHardMapper.delete(new LambdaQueryWrapper<QualityRegionToAiAnalyseHard>()
|
||||
.eq(QualityRegionToAiAnalyseHard::getQualityRegionId, qualityRegion.getId()));
|
||||
|
||||
qualityRegionToUfaceDevService.remove(new LambdaQueryWrapper<QualityRegionToUfaceDev>()
|
||||
.eq(QualityRegionToUfaceDev::getQualityRegionId, qualityRegion.getId()));
|
||||
List<SystemUser> systemUsers = qualityRegion.getSystemUsers();
|
||||
List<EnterpriseInfo> enterpriseInfos = qualityRegion.getEnterpriseInfos();
|
||||
List<AiAnalyseHardWareRecord> aiAnalyseHardWareRecords = qualityRegion.getAiAnalyseHardWareRecords();
|
||||
List<UfaceDev> ufaceDevs = qualityRegion.getUfaceDevList();
|
||||
if (CollUtil.isNotEmpty(enterpriseInfos)) {
|
||||
for (EnterpriseInfo systemUser : enterpriseInfos) {
|
||||
Long userId = systemUser.getId();
|
||||
@ -237,8 +251,20 @@ public class QualityRegionServiceImpl extends ServiceImpl<QualityRegionMapper, Q
|
||||
toAiAnalyseHardMapper.insert(entity);
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(ufaceDevs)) {
|
||||
for (UfaceDev ufaceDev : ufaceDevs) {
|
||||
Long id = ufaceDev.getId();
|
||||
if (id == null) {
|
||||
throw new OpenAlertException("ufaceDevs[i].id不能为空");
|
||||
}
|
||||
QualityRegionToUfaceDev entity = new QualityRegionToUfaceDev();
|
||||
entity.setQualityRegionId(qualityRegion.getId());
|
||||
entity.setUfaceDevId(id);
|
||||
qualityRegionToUfaceDevService.save(entity);
|
||||
}
|
||||
}
|
||||
regionDevService.remove(Wrappers.<RegionDev>lambdaQuery().eq(RegionDev::getQualityRegionId, qualityRegion.getId()));
|
||||
if(qualityRegion.getRegionDevList() != null) {
|
||||
if (qualityRegion.getRegionDevList() != null) {
|
||||
List<RegionDev> regionDevList = qualityRegion.getRegionDevList();
|
||||
for (RegionDev regionDev : regionDevList) {
|
||||
regionDev.setQualityRegionId(qualityRegion.getId());
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
package com.zhgd.xmgl.modules.quality.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.xmgl.modules.quality.entity.QualityRegionToUfaceDev;
|
||||
import com.zhgd.xmgl.modules.quality.mapper.QualityRegionToUfaceDevMapper;
|
||||
import com.zhgd.xmgl.modules.quality.service.IQualityRegionToUfaceDevService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Description: 区域和人脸设备中间表
|
||||
* @author: pds
|
||||
* @date: 2025-06-12
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class QualityRegionToUfaceDevServiceImpl extends ServiceImpl<QualityRegionToUfaceDevMapper, QualityRegionToUfaceDev> implements IQualityRegionToUfaceDevService {
|
||||
|
||||
}
|
||||
@ -5,10 +5,10 @@ import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gexin.fastjson.serializer.SerializerFeature;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.file.FileUtil;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
@ -93,8 +93,8 @@ public class RiskListPointController {
|
||||
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "projectType", value = "工程类别(字典值)", paramType = "query", required = false, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "containLibraryId", value = "查询下级的风险清单库id", paramType = "query", required = false, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "regionId", value = "区域id", paramType = "query", required = false, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "containLibraryIds", value = "查询下级的风险清单库id(多个,分割)", paramType = "query", required = false, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "regionIds", value = "区域ids(多个,分割)", paramType = "query", required = false, dataType = "Integer"),
|
||||
})
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<RiskListPointVo>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
@ -203,7 +203,7 @@ public class RiskListPointController {
|
||||
})
|
||||
@PostMapping(value = "/batchSetField")
|
||||
public Result batchSetField(@RequestBody Map<String, Object> param) {
|
||||
List<Map<String, Object>> updates = com.gexin.fastjson.JSON.parseObject(JSON.toJSONString(param.get("updates")), new com.gexin.fastjson.TypeReference<List<Map<String, Object>>>() {
|
||||
List<Map<String, Object>> updates = com.gexin.fastjson.JSON.parseObject(com.gexin.fastjson.JSON.toJSONString(param.get("updates"), SerializerFeature.WriteMapNullValue), new com.gexin.fastjson.TypeReference<List<Map<String, Object>>>() {
|
||||
});
|
||||
List<String> fieldNames = new ArrayList<>();
|
||||
Field[] fields = RiskListPoint.class.getDeclaredFields(); // getFields() 只返回公共字段(包括继承的)
|
||||
|
||||
@ -12,22 +12,20 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||
import cn.hutool.extra.qrcode.QrConfig;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gexin.fastjson.serializer.SerializerFeature;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListDetail;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListPoint;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListSource;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RegionV2Vo;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RiskListSourceVo;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RiskUndoneVo;
|
||||
import com.zhgd.xmgl.modules.risk.service.IRegionV2Service;
|
||||
import com.zhgd.xmgl.modules.risk.service.IRiskListDetailService;
|
||||
import com.zhgd.xmgl.modules.risk.service.IRiskListPotentialAccidentTypeService;
|
||||
import com.zhgd.xmgl.modules.risk.service.IRiskListSourceService;
|
||||
import com.zhgd.xmgl.modules.risk.service.*;
|
||||
import com.zhgd.xmgl.util.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@ -80,6 +78,9 @@ public class RiskListSourceController {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IRiskListPotentialAccidentTypeService riskListPotentialAccidentTypeService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IRiskListPointService riskListPointService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
@ -97,6 +98,7 @@ public class RiskListSourceController {
|
||||
@ApiImplicitParam(name = "monthlyId", value = "月度清单id", paramType = "query", required = false, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "duringTheTask", value = "1是开启任务期间", paramType = "query", required = false, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "workable", value = "1已落实0未落实", paramType = "query", required = false, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "isInConstruction", value = "1在施", paramType = "query", required = false, dataType = "Integer"),
|
||||
})
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<RiskListSourceVo>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
@ -205,7 +207,7 @@ public class RiskListSourceController {
|
||||
})
|
||||
@PostMapping(value = "/batchSetField")
|
||||
public Result batchSetField(@RequestBody Map<String, Object> param) {
|
||||
List<Map<String, Object>> updates = com.gexin.fastjson.JSON.parseObject(JSON.toJSONString(param.get("updates")), new com.gexin.fastjson.TypeReference<List<Map<String, Object>>>() {
|
||||
List<Map<String, Object>> updates = com.gexin.fastjson.JSON.parseObject(com.gexin.fastjson.JSON.toJSONString(param.get("updates"), SerializerFeature.WriteMapNullValue), new com.gexin.fastjson.TypeReference<List<Map<String, Object>>>() {
|
||||
});
|
||||
List<String> fieldNames = new ArrayList<>();
|
||||
Field[] fields = RiskListSource.class.getDeclaredFields(); // getFields() 只返回公共字段(包括继承的)
|
||||
@ -367,17 +369,23 @@ public class RiskListSourceController {
|
||||
List<RiskListSource> addList = new ArrayList<>();
|
||||
List<RiskListDetail> details = riskListDetailService.list(new LambdaQueryWrapper<RiskListDetail>()
|
||||
.in(RiskListDetail::getId, StrUtil.split(MapUtils.getString(param, "detailIds"), ",")));
|
||||
Long pointId = MapUtils.getLong(param, "pointId");
|
||||
RiskListPoint point = riskListPointService.getById(pointId);
|
||||
if (point == null) {
|
||||
throw new OpenAlertException("管控清单风险点不存在");
|
||||
}
|
||||
for (RiskListDetail detail : details) {
|
||||
RiskListSource source = new RiskListSource();
|
||||
BeanUtils.copyProperties(detail, source);
|
||||
source.setId(null);
|
||||
source.setDetailId(detail.getId());
|
||||
source.setPointId(MapUtils.getLong(param, "pointId"));
|
||||
source.setPointId(pointId);
|
||||
source.setCreateTime(new Date());
|
||||
source.setUpdateTime(new Date());
|
||||
source.setEffectiveTimeBegin(source.getEffectiveTimeBegin());
|
||||
source.setEffectiveTimeEnd(source.getEffectiveTimeEnd());
|
||||
source.setIdentificationTime(new Date());
|
||||
source.setProjectSn(point.getProjectSn());
|
||||
addList.add(source);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(addList)) {
|
||||
@ -441,12 +449,13 @@ public class RiskListSourceController {
|
||||
objectMap.put("no", i + 1);
|
||||
objectMap.put("subProjectWorkTask", sourceVo.getSubProjectWorkTask());
|
||||
objectMap.put("accidentTypeName", sourceVo.getAccidentTypeName());
|
||||
objectMap.put("activityFrequency", sourceVo.getActivityFrequency());
|
||||
objectMap.put("areaLocation", sourceVo.getAreaLocation());
|
||||
if (StrUtil.isNotBlank(sourceVo.getSpecificResponsibilityAreaNames())) {
|
||||
List<String> areas = new ArrayList<>();
|
||||
List<String> split = StrUtil.split(sourceVo.getSpecificResponsibilityAreaNames(), ",");
|
||||
for (int j = 0; j < split.size(); j++) {
|
||||
areas.add("区域:" + (j + 1) + split.get(j));
|
||||
areas.add("区域" + (j + 1) + ":" + split.get(j));
|
||||
}
|
||||
objectMap.put("specificResponsibilityAreaNames", StrUtil.join("\n", areas));
|
||||
}
|
||||
|
||||
@ -0,0 +1,85 @@
|
||||
package com.zhgd.xmgl.modules.risk.controller;
|
||||
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.xmgl.base.entity.vo.SectorVo;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.CountRisksByLevelVo;
|
||||
import com.zhgd.xmgl.modules.risk.service.IRegionV2Service;
|
||||
import com.zhgd.xmgl.modules.risk.service.IRiskListDetailService;
|
||||
import com.zhgd.xmgl.modules.risk.service.IRiskListPotentialAccidentTypeService;
|
||||
import com.zhgd.xmgl.modules.risk.service.IRiskListSourceService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 管控清单危险源数据中心
|
||||
* @author: pds
|
||||
* @date: 2025-06-09
|
||||
* @version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/xmgl/riskListSourceDataCenter")
|
||||
@Slf4j
|
||||
@Api(tags = "管控清单危险源数据中心相关Api")
|
||||
public class RiskListSourceDataCenterController {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IRiskListSourceService riskListSourceService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IRegionV2Service regionV2Service;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IRiskListDetailService riskListDetailService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IRiskListPotentialAccidentTypeService riskListPotentialAccidentTypeService;
|
||||
|
||||
@ApiOperation(value = "统计风险等级数量", notes = "统计风险等级数量", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "isInConstruction", value = "1在施", paramType = "query", required = false, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "projectType", value = "工程类别(字典值)", paramType = "query", required = false, dataType = "Integer"),
|
||||
})
|
||||
@GetMapping(value = "/countRisksByLevel")
|
||||
public Result<CountRisksByLevelVo> countRisksByLevel(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(riskListSourceService.countRisksByLevel(param));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "风险走势图(按月统计)", notes = "风险走势图(按月统计)", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "startTime", value = "开始时间(yyyy-MM)", paramType = "body", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "endTime", value = "结束时间(yyyy-MM)", paramType = "body", required = true, dataType = "String"),
|
||||
})
|
||||
@GetMapping(value = "/getRiskTrendChart")
|
||||
public Result<List<CountRisksByLevelVo>> getRiskTrendChart(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(riskListSourceService.getRiskTrendChart(param));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "(在施)风险类型占比", notes = "(在施)风险类型占比", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "isInConstruction", value = "1在施", paramType = "query", required = false, dataType = "Integer"),
|
||||
})
|
||||
@GetMapping(value = "/countRisksByLibrary")
|
||||
public Result<SectorVo> countRisksByLibrary(@RequestParam @ApiIgnore HashMap<String, Object> map) {
|
||||
return Result.success(riskListSourceService.countRisksByLibrary(map));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
package com.zhgd.xmgl.modules.risk.entity.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class CountRisksByLevelVo {
|
||||
/**
|
||||
* 重大风险数量
|
||||
*/
|
||||
@ApiModelProperty(value = "重大风险数量")
|
||||
private java.lang.Integer zdNum;
|
||||
/**
|
||||
* 较大风险数量
|
||||
*/
|
||||
@ApiModelProperty(value = "较大风险数量")
|
||||
private java.lang.Integer jdNum;
|
||||
/**
|
||||
* 一般风险数量
|
||||
*/
|
||||
@ApiModelProperty(value = "一般风险数量")
|
||||
private java.lang.Integer ybNum;
|
||||
/**
|
||||
* 低风险数量
|
||||
*/
|
||||
@ApiModelProperty(value = "低风险数量")
|
||||
private java.lang.Integer dNum;
|
||||
/**
|
||||
* 危险源总数
|
||||
*/
|
||||
@ApiModelProperty(value = "危险源总数")
|
||||
private java.lang.Integer total;
|
||||
/**
|
||||
* 年-月
|
||||
*/
|
||||
@ApiModelProperty(value = "年-月")
|
||||
private java.lang.String yearMonth;
|
||||
/**
|
||||
* 月度环比%
|
||||
*/
|
||||
@ApiModelProperty(value = "月度环比%")
|
||||
private BigDecimal moMChange;
|
||||
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package com.zhgd.xmgl.modules.risk.entity.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListSource;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.xmgl.base.entity.vo.SectorOneVo;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListSource;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.CountRisksByLevelVo;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RiskListSourceVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -49,4 +51,8 @@ public interface RiskListSourceMapper extends BaseMapper<RiskListSource> {
|
||||
* @return
|
||||
*/
|
||||
RiskListSourceVo queryById(String id);
|
||||
|
||||
CountRisksByLevelVo countRisksByLevel(HashMap<String, Object> param);
|
||||
|
||||
List<SectorOneVo> countRisksByLibrary(HashMap<String, Object> map);
|
||||
}
|
||||
|
||||
@ -10,12 +10,18 @@
|
||||
<if test="param.projectType != null and param.projectType != ''">
|
||||
and rll.project_type = #{param.projectType}
|
||||
</if>
|
||||
<if test="param.containLibraryId != null and param.containLibraryId != ''">
|
||||
and rll.id in (select id from risk_list_library where find_in_set(#{param.containLibraryId},ancestors) or
|
||||
id=#{param.containLibraryId})
|
||||
<if test="param.containLibraryIdList != null and param.containLibraryIdList != ''">
|
||||
and rll.id in (select id from risk_list_library where
|
||||
<foreach collection="param.containLibraryIdList" item="libraryId" separator="OR" open="(" close=")">
|
||||
FIND_IN_SET(#{libraryId}, ancestors) OR id = #{libraryId}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="param.regionId != null and param.regionId != ''">
|
||||
and find_in_set(#{param.regionId},t.specific_responsibility_area_ids)
|
||||
<if test="param.regionIdList != null and param.regionIdList != ''">
|
||||
and
|
||||
<foreach collection="param.regionIdList" item="regionId" separator="OR" open="(" close=")">
|
||||
find_in_set(#{regionId},t.specific_responsibility_area_ids)
|
||||
</foreach>
|
||||
</if>
|
||||
)t
|
||||
${ew.customSqlSegment}
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
,rlp.risk_point_name
|
||||
,rlpat.type as accident_type_name
|
||||
,rll.node_name as list_library_name
|
||||
,#{param.workable} as workable
|
||||
from risk_list_source t
|
||||
join risk_list_point rlp on rlp.id=t.point_id
|
||||
left join risk_list_library rll on rll.id=rlp.risk_list_library_id
|
||||
@ -45,11 +46,15 @@
|
||||
<if test="param.regionIdList != null and param.regionIdList != ''">
|
||||
and
|
||||
<foreach collection="param.regionIdList" item="regionId" separator="OR" open="(" close=")">
|
||||
find_in_set(#{regionId},rlp.specific_responsibility_area_ids)
|
||||
find_in_set(#{regionId},t.specific_responsibility_area_ids)
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.duringTheTask == '1'.toString()">
|
||||
and t.allow_generate_task=1 and t.effective_time_begin <= now() and t.effective_time_end >= now()
|
||||
and t.allow_generate_task=1 and t.effective_time_begin <= current_date and t.effective_time_end >=
|
||||
current_date
|
||||
</if>
|
||||
<if test="param.isInConstruction == '1'.toString()">
|
||||
and t.effective_time_begin <= current_date and t.effective_time_end >= current_date
|
||||
</if>
|
||||
)t
|
||||
${ew.customSqlSegment}
|
||||
@ -61,4 +66,40 @@
|
||||
)t
|
||||
where t.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="countRisksByLevel" resultType="com.zhgd.xmgl.modules.risk.entity.vo.CountRisksByLevelVo">
|
||||
select
|
||||
count(*) total
|
||||
,ifnull(sum(if(t.risk_level=1,1,0)),0) as zdNum
|
||||
,ifnull(sum(if(t.risk_level=2,1,0)),0) as jdNum
|
||||
,ifnull(sum(if(t.risk_level=3,1,0)),0) as ybNum
|
||||
,ifnull(sum(if(t.risk_level=4,1,0)),0) as dNum
|
||||
from risk_list_source t
|
||||
join risk_list_point rlp on rlp.id=t.point_id
|
||||
left join risk_list_library rll on rll.id=rlp.risk_list_library_id
|
||||
where t.project_sn = #{projectSn}
|
||||
<if test="isInConstruction == '1'.toString()">
|
||||
and t.effective_time_begin <= current_date and t.effective_time_end >= current_date
|
||||
</if>
|
||||
<if test="projectType != null and projectType != ''">
|
||||
and rll.project_type = #{projectType}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="countRisksByLibrary" resultType="com.zhgd.xmgl.base.entity.vo.SectorOneVo">
|
||||
select
|
||||
rll.node_name as name
|
||||
,count(*) count
|
||||
from risk_list_source t
|
||||
join risk_list_point rlp on rlp.id=t.point_id
|
||||
join risk_list_library rll on rll.id=rlp.risk_list_library_id
|
||||
where t.project_sn = #{projectSn}
|
||||
<if test="isInConstruction == '1'.toString()">
|
||||
and t.effective_time_begin <= current_date and t.effective_time_end >= current_date
|
||||
</if>
|
||||
<if test="projectType != null and projectType != ''">
|
||||
and rll.project_type = #{projectType}
|
||||
</if>
|
||||
group by rll.id
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -2,8 +2,10 @@ package com.zhgd.xmgl.modules.risk.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.xmgl.base.entity.vo.SectorOneVo;
|
||||
import com.zhgd.xmgl.base.entity.vo.SectorVo;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListSource;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RegionV2Vo;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.CountRisksByLevelVo;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RiskListSourceVo;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RiskUndoneVo;
|
||||
|
||||
@ -68,4 +70,10 @@ public interface IRiskListSourceService extends IService<RiskListSource> {
|
||||
List<RiskUndoneVo> getUndoneList(HashMap<String, Object> param);
|
||||
|
||||
void addUsersNotice(List<RiskListSourceVo> sourceVos);
|
||||
|
||||
CountRisksByLevelVo countRisksByLevel(HashMap<String, Object> param);
|
||||
|
||||
List<CountRisksByLevelVo> getRiskTrendChart(HashMap<String, Object> param);
|
||||
|
||||
SectorVo countRisksByLibrary(HashMap<String, Object> map);
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
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.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -20,6 +21,7 @@ import com.zhgd.xmgl.modules.risk.service.IRiskListSourceService;
|
||||
import com.zhgd.xmgl.util.MapBuilder;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -48,6 +50,14 @@ public class RiskListPointServiceImpl extends ServiceImpl<RiskListPointMapper, R
|
||||
|
||||
@Override
|
||||
public IPage<RiskListPointVo> queryPageList(HashMap<String, Object> param) {
|
||||
String containLibraryIds = MapUtils.getString(param, "containLibraryIds");
|
||||
if (StrUtil.isNotBlank(containLibraryIds)) {
|
||||
param.put("containLibraryIdList", StrUtil.split(containLibraryIds, ","));
|
||||
}
|
||||
String regionIds = MapUtils.getString(param, "regionIds");
|
||||
if (StrUtil.isNotBlank(regionIds)) {
|
||||
param.put("regionIdList", StrUtil.split(regionIds, ","));
|
||||
}
|
||||
QueryWrapper<RiskListPointVo> queryWrapper = this.getQueryWrapper(param);
|
||||
Page<RiskListPointVo> page = PageUtil.getPage(param);
|
||||
IPage<RiskListPointVo> pageList = baseMapper.queryList(page, queryWrapper, param);
|
||||
@ -99,6 +109,12 @@ public class RiskListPointServiceImpl extends ServiceImpl<RiskListPointMapper, R
|
||||
point.setSpecificResponsibilityAreaNames(areaNames);
|
||||
}
|
||||
baseMapper.updateById(point);
|
||||
this.update(null, new LambdaUpdateWrapper<RiskListPoint>()
|
||||
.set(RiskListPoint::getActivityFrequency, point.getActivityFrequency())
|
||||
.set(RiskListPoint::getEffectiveTimeBegin, point.getEffectiveTimeBegin())
|
||||
.set(RiskListPoint::getEffectiveTimeEnd, point.getEffectiveTimeEnd())
|
||||
.eq(RiskListPoint::getId, point.getId())
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -107,6 +123,11 @@ public class RiskListPointServiceImpl extends ServiceImpl<RiskListPointMapper, R
|
||||
if (riskListPoint == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
int count = riskListSourceService.count(new LambdaQueryWrapper<RiskListSource>()
|
||||
.eq(RiskListSource::getPointId, id));
|
||||
if (count > 0) {
|
||||
throw new OpenAlertException("请先删除辨识的危险源");
|
||||
}
|
||||
baseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
@ -2,15 +2,20 @@ package com.zhgd.xmgl.modules.risk.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
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.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.base.entity.vo.SectorOneVo;
|
||||
import com.zhgd.xmgl.base.entity.vo.SectorVo;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.INoticeService;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
|
||||
@ -18,10 +23,7 @@ import com.zhgd.xmgl.modules.risk.entity.RiskListPoint;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListSource;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListSourceUnbuilt;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListWorkable;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RegionV2Vo;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RiskListLibraryVo;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RiskListSourceVo;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RiskUndoneVo;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.*;
|
||||
import com.zhgd.xmgl.modules.risk.mapper.RiskListSourceMapper;
|
||||
import com.zhgd.xmgl.modules.risk.service.*;
|
||||
import com.zhgd.xmgl.modules.xz.security.entity.XzSecurityQualityInspectionRecord;
|
||||
@ -34,6 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@ -179,6 +182,12 @@ public class RiskListSourceServiceImpl extends ServiceImpl<RiskListSourceMapper,
|
||||
source.setSpecificResponsibilityAreaNames(areaNames);
|
||||
}
|
||||
baseMapper.updateById(source);
|
||||
this.update(null, new LambdaUpdateWrapper<RiskListSource>()
|
||||
.set(RiskListSource::getActivityFrequency, source.getActivityFrequency())
|
||||
.set(RiskListSource::getEffectiveTimeBegin, source.getEffectiveTimeBegin())
|
||||
.set(RiskListSource::getEffectiveTimeEnd, source.getEffectiveTimeEnd())
|
||||
.eq(RiskListSource::getId, source.getId())
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -270,4 +279,43 @@ public class RiskListSourceServiceImpl extends ServiceImpl<RiskListSourceMapper,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CountRisksByLevelVo countRisksByLevel(HashMap<String, Object> param) {
|
||||
return baseMapper.countRisksByLevel(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CountRisksByLevelVo> getRiskTrendChart(HashMap<String, Object> param) {
|
||||
List<RiskListSource> sources = this.list(new LambdaQueryWrapper<RiskListSource>()
|
||||
.select(RiskListSource::getId, RiskListSource::getEffectiveTimeBegin, RiskListSource::getEffectiveTimeEnd)
|
||||
.eq(RiskListSource::getProjectSn, MapUtils.getString(param, "projectSn"))
|
||||
.le(RiskListSource::getEffectiveTimeBegin, MapUtils.getString(param, "endTime") + "-31 23:59:59")
|
||||
.ge(RiskListSource::getEffectiveTimeEnd, MapUtils.getString(param, "startTime") + "-01 00:00:00")
|
||||
).stream().sorted(Comparator.comparing(RiskListSource::getEffectiveTimeBegin)).collect(Collectors.toList());
|
||||
List<DateTime> months = DateUtil.rangeToList(DateUtil.parse(MapUtils.getString(param, "startTime")), DateUtil.parse(MapUtils.getString(param, "endTime")), DateField.MONTH);
|
||||
ArrayList<CountRisksByLevelVo> vos = new ArrayList<>();
|
||||
Integer lastTotal = null;
|
||||
for (DateTime month : months) {
|
||||
CountRisksByLevelVo vo = new CountRisksByLevelVo();
|
||||
vo.setZdNum((int) sources.stream().filter(s -> Objects.equals(s.getRiskLevel(), 1) && DateUtil.compare(s.getEffectiveTimeBegin(), month) <= 0 && DateUtil.compare(s.getEffectiveTimeEnd(), month) >= 0).count());
|
||||
vo.setJdNum((int) sources.stream().filter(s -> Objects.equals(s.getRiskLevel(), 2) && DateUtil.compare(s.getEffectiveTimeBegin(), month) <= 0 && DateUtil.compare(s.getEffectiveTimeEnd(), month) >= 0).count());
|
||||
vo.setYbNum((int) sources.stream().filter(s -> Objects.equals(s.getRiskLevel(), 3) && DateUtil.compare(s.getEffectiveTimeBegin(), month) <= 0 && DateUtil.compare(s.getEffectiveTimeEnd(), month) >= 0).count());
|
||||
vo.setDNum((int) sources.stream().filter(s -> Objects.equals(s.getRiskLevel(), 4) && DateUtil.compare(s.getEffectiveTimeBegin(), month) <= 0 && DateUtil.compare(s.getEffectiveTimeEnd(), month) >= 0).count());
|
||||
vo.setTotal((int) sources.stream().filter(s -> DateUtil.compare(s.getEffectiveTimeBegin(), month) <= 0 && DateUtil.compare(s.getEffectiveTimeEnd(), month) >= 0).count());
|
||||
vo.setYearMonth(DateUtil.format(month, "yyyy-MM"));
|
||||
if (lastTotal != null) {
|
||||
vo.setMoMChange(lastTotal != 0 ? new BigDecimal((vo.getTotal() * 1.0 / lastTotal - 1) * 100).setScale(2, BigDecimal.ROUND_HALF_UP) : null);
|
||||
}
|
||||
lastTotal = vo.getTotal();
|
||||
vos.add(vo);
|
||||
}
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SectorVo countRisksByLibrary(HashMap<String, Object> map) {
|
||||
List<SectorOneVo> list = baseMapper.countRisksByLibrary(map);
|
||||
return SectorVo.getSectorVo(list);
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,10 +19,7 @@ import com.zhgd.xmgl.modules.worker.entity.WorkerAttendance;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.dto.WorkerAttendanceDto;
|
||||
import com.zhgd.xmgl.modules.worker.entity.vo.SafetyPerformanceAnalysisVo;
|
||||
import com.zhgd.xmgl.modules.worker.service.IMockWorkerAttendanceConfigService;
|
||||
import com.zhgd.xmgl.modules.worker.service.IUfaceDevService;
|
||||
import com.zhgd.xmgl.modules.worker.service.IWorkerAttendanceService;
|
||||
import com.zhgd.xmgl.modules.worker.service.IWorkerInfoService;
|
||||
import com.zhgd.xmgl.modules.worker.service.*;
|
||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
import com.zhgd.xmgl.util.ExcelUtils;
|
||||
import com.zhgd.xmgl.util.MapBuilder;
|
||||
@ -76,6 +73,9 @@ public class WorkerAttendanceController {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private INoticeService noticeService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IWorkerAttendancePresenceService workerAttendancePresenceService;
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
@ -131,7 +131,9 @@ public class WorkerAttendanceController {
|
||||
@ApiImplicitParam(name = "endTime", value = "结束时间", dataType = "String", paramType = "body", required = false),
|
||||
@ApiImplicitParam(name = "workerName", value = "人员姓名", dataType = "String", paramType = "body", required = false),
|
||||
@ApiImplicitParam(name = "passType", value = "考勤类型 1:进 2出", dataType = "Integer", paramType = "body", required = false),
|
||||
@ApiImplicitParam(name = "devSn", value = "设备SN", dataType = "String", paramType = "body", required = false)
|
||||
@ApiImplicitParam(name = "devSn", value = "设备SN", dataType = "String", paramType = "body", required = false),
|
||||
@ApiImplicitParam(name = "groupId", value = "门禁设备分组id", paramType = "body", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "devSnList", value = "门禁设备sn列表", paramType = "body", required = false, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/list")
|
||||
public Result<IPage<EntityMap>> queryPageList(@RequestBody Map<String, Object> map) {
|
||||
@ -456,4 +458,13 @@ public class WorkerAttendanceController {
|
||||
return Result.ok("后台生成数据中");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询各个区域下在场人数", notes = "查询各个区域下在场人数", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/getPresentByRegion")
|
||||
public Result<List<Map<String, Object>>> getPresentByRegion(@ApiIgnore @RequestBody Map<String, Object> paramMap) {
|
||||
return Result.success(workerAttendancePresenceService.getPresentByRegion(paramMap));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -180,7 +180,8 @@ public class WorkerInfoController {
|
||||
@ApiImplicitParam(name = "isFilterQualityRegionEnterprise", value = "是否查询过滤区域管理下的企业,1是", paramType = "body", required = false, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "letter", value = "首字母", paramType = "body", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "safeScoreLevel", value = "安全得分风险(1高风险2中风险3低风险)", paramType = "body", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "qualityRegionId", value = "区域ID", paramType = "body", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "qualityRegionId", value = "区域ID(查安全帽划定区域)", paramType = "body", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "regionIdForUface", value = "区域ID(查绑定人脸机的区域)", paramType = "body", required = false, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/selectWorkerInfoList")
|
||||
public Result<IPage<WorkerInfo>> selectWorkerInfoList(@RequestBody Map<String, Object> map) {
|
||||
|
||||
@ -101,4 +101,6 @@ public interface UfaceDevMapper extends BaseMapper<UfaceDev> {
|
||||
* @return
|
||||
*/
|
||||
List<UfaceDev> getUfaceDevListForIscNotExist(@Param("list") List<String> groupIdList, @Param("projectSn") String projectSn);
|
||||
|
||||
List<UfaceDev> getDevSnListByGroupId(@Param("groupId") String groupId);
|
||||
}
|
||||
|
||||
@ -5,6 +5,9 @@ import com.zhgd.xmgl.modules.worker.entity.WorkerAttendancePresence;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 考勤当前在场的人
|
||||
* @author: pds
|
||||
@ -31,4 +34,13 @@ public interface WorkerAttendancePresenceMapper extends BaseMapper<WorkerAttenda
|
||||
* @param projectSn
|
||||
*/
|
||||
void deleteAllNowWorkerAttendancePresenceData(@Param("projectSn") String projectSn);
|
||||
|
||||
List<Map<String, Object>> getPresentByRegion(Map<String, Object> paramMap);
|
||||
|
||||
/**
|
||||
* 查询区域在场人员id列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Long> getPresentWorkerIdListByRegion(@Param("regionId") Long regionId);
|
||||
}
|
||||
|
||||
@ -151,4 +151,11 @@
|
||||
</if>
|
||||
and ud.project_sn =#{projectSn}
|
||||
</select>
|
||||
|
||||
<select id="getDevSnListByGroupId" resultType="com.zhgd.xmgl.modules.worker.entity.UfaceDev">
|
||||
select distinct ud.* from
|
||||
uface_dev ud
|
||||
join uface_dev_to_group udtg on ud.id = udtg.uface_dev_id
|
||||
where udtg.uface_dev_group_id=#{groupId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -91,6 +91,12 @@
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.devSnList != null and param.devSnList.size() != 0">
|
||||
and a.dev_sn in
|
||||
<foreach collection="param.devSnList" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.userEnterpriseId != null and param.userEnterpriseId != ''">
|
||||
and FIND_IN_SET(b.enterprise_id, #{param.userEnterpriseId})
|
||||
</if>
|
||||
|
||||
@ -26,10 +26,52 @@
|
||||
<![CDATA[
|
||||
create_time < DATE_ADD(NOW(),INTERVAL -24 HOUR)
|
||||
]]>
|
||||
|
||||
</delete>
|
||||
<delete id="deleteAllNowWorkerAttendancePresenceData">
|
||||
delete from worker_attendance_presence
|
||||
where project_sn=#{projectSn}
|
||||
</delete>
|
||||
|
||||
<select id="getPresentByRegion" resultType="java.util.Map">
|
||||
SELECT
|
||||
qr.id,
|
||||
qr.region_name as regionName,
|
||||
qr.project_sn as projectSn,
|
||||
COUNT(DISTINCT wap.person_sn) AS present
|
||||
from
|
||||
quality_region qr
|
||||
join quality_region_to_uface_dev qrtud on qr.id = qrtud.quality_region_id
|
||||
join uface_dev ud on ud.id = qrtud.uface_dev_id
|
||||
left JOIN worker_attendance a ON a.dev_sn=ud.dev_sn AND a.project_sn = ud.project_sn AND a.pass_type = 1 AND
|
||||
a.create_time = (
|
||||
SELECT MAX(create_time)
|
||||
FROM worker_attendance
|
||||
WHERE person_sn = a.person_sn
|
||||
AND project_sn = a.project_sn
|
||||
AND pass_type = 1
|
||||
)
|
||||
left join worker_attendance_presence wap on wap.person_sn = a.person_sn
|
||||
WHERE qr.project_sn = #{projectSn}
|
||||
GROUP BY qr.id
|
||||
</select>
|
||||
|
||||
<select id="getPresentWorkerIdListByRegion" resultType="java.lang.Long">
|
||||
SELECT
|
||||
distinct wi.id
|
||||
from
|
||||
quality_region qr
|
||||
join quality_region_to_uface_dev qrtud on qr.id = qrtud.quality_region_id
|
||||
join uface_dev ud on ud.id = qrtud.uface_dev_id
|
||||
JOIN worker_attendance a ON a.dev_sn=ud.dev_sn AND a.project_sn = ud.project_sn AND a.pass_type = 1 AND
|
||||
a.create_time = (
|
||||
SELECT MAX(create_time)
|
||||
FROM worker_attendance
|
||||
WHERE person_sn = a.person_sn
|
||||
AND project_sn = a.project_sn
|
||||
AND pass_type = 1
|
||||
)
|
||||
join worker_attendance_presence wap on wap.person_sn = a.person_sn
|
||||
join worker_info wi on wi.person_sn=a.person_sn
|
||||
WHERE qr.id=#{regionId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -108,4 +108,12 @@ public interface IUfaceDevService extends IService<UfaceDev> {
|
||||
* @return
|
||||
*/
|
||||
List<UfaceDev> getAllDevsByProjectSn(String projectSn);
|
||||
|
||||
/**
|
||||
* 查询设备列表通过门禁设备分组id
|
||||
*
|
||||
* @param groupId
|
||||
* @return
|
||||
*/
|
||||
List<UfaceDev> getDevSnListByGroupId(String groupId);
|
||||
}
|
||||
|
||||
@ -5,6 +5,8 @@ import com.zhgd.xmgl.modules.worker.entity.WorkerAttendance;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerAttendancePresence;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 考勤当前在场的人
|
||||
@ -33,4 +35,8 @@ public interface IWorkerAttendancePresenceService extends IService<WorkerAttenda
|
||||
* @param paramMap
|
||||
*/
|
||||
void updateWorkerAttendanceZero(HashMap<String, Object> paramMap);
|
||||
|
||||
List<Map<String, Object>> getPresentByRegion(Map<String, Object> paramMap);
|
||||
|
||||
List<Long> getPresentWorkerIdListByRegion(Long regionId);
|
||||
}
|
||||
|
||||
@ -279,4 +279,5 @@ public interface IWorkerAttendanceService extends IService<WorkerAttendance> {
|
||||
void edit(WorkerAttendance attendance);
|
||||
|
||||
Map<String, Object> buildAttendanceMap(WorkerAttendance workerAttendance);
|
||||
|
||||
}
|
||||
|
||||
@ -275,4 +275,8 @@ public class UfaceDevServiceImpl extends ServiceImpl<UfaceDevMapper, UfaceDev> i
|
||||
return ufaceDevMapper.selectList(qw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UfaceDev> getDevSnListByGroupId(String groupId) {
|
||||
return ufaceDevMapper.getDevSnListByGroupId(groupId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 考勤当前在场的人
|
||||
@ -71,5 +72,14 @@ public class WorkerAttendancePresenceServiceImpl extends ServiceImpl<WorkerAtten
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getPresentByRegion(Map<String, Object> paramMap) {
|
||||
return workerAttendancePresenceMapper.getPresentByRegion(paramMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getPresentWorkerIdListByRegion(Long regionId) {
|
||||
return workerAttendancePresenceMapper.getPresentWorkerIdListByRegion(regionId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -249,6 +249,14 @@ public class WorkerAttendanceServiceImpl extends ServiceImpl<WorkerAttendanceMap
|
||||
|
||||
@Override
|
||||
public IPage<EntityMap> selectWorkerAttendancePage(Map<String, Object> map) {
|
||||
String groupId = MapUtils.getString(map, "groupId");
|
||||
if (StrUtil.isNotBlank(groupId)) {
|
||||
List<String> devSnList = ufaceDevService.getDevSnListByGroupId(groupId).stream().map(UfaceDev::getDevSn).collect(Collectors.toList());
|
||||
if (devSnList.size() == 0) {
|
||||
devSnList.add("-114514");
|
||||
}
|
||||
map.put("devSnList", devSnList);
|
||||
}
|
||||
int pageNo = Integer.parseInt(map.getOrDefault("pageNo", 1).toString());
|
||||
int pageSize = Integer.parseInt(map.getOrDefault("pageSize", 10).toString());
|
||||
Page<EntityMap> page = new Page<>(pageNo, pageSize);
|
||||
|
||||
@ -290,6 +290,14 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
|
||||
*/
|
||||
@Override
|
||||
public IPage<WorkerInfo> selectWorkerInfoList(Map<String, Object> map) {
|
||||
String regionIdForUface = MapUtils.getString(map, "regionIdForUface");
|
||||
if (StrUtil.isNotBlank(regionIdForUface)) {
|
||||
List<Long> workerIds = workerAttendancePresenceService.getPresentWorkerIdListByRegion(Long.valueOf(regionIdForUface));
|
||||
if (workerIds.size() == 0) {
|
||||
workerIds.add(-100L);
|
||||
}
|
||||
map.put("workerInfos", StrUtil.join(",", workerIds));
|
||||
}
|
||||
// 区域人员
|
||||
String qualityRegionId = MapUtils.getString(map, "qualityRegionId");
|
||||
if (StringUtils.isNotEmpty(qualityRegionId)) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
http.port=23913
|
||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/wisdomsite_hl_new_init?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false
|
||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/wisdomsite_prod?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false
|
||||
spring.datasource.username=ENC(XR4C/hvTYCUqudS49Wh/jA==)
|
||||
spring.datasource.password=ENC(LsKaVL2ycDu+uUNoPndYLA==)
|
||||
server.port=23912
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#http.port=30250
|
||||
http.port=23912
|
||||
spring.datasource.db1.jdbc-url=jdbc:mysql://192.168.34.221:3306/wisdomsite_other_env_show?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false
|
||||
spring.datasource.db1.jdbc-url=jdbc:mysql://192.168.34.221:3306/wisdomsite_prod?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false
|
||||
spring.datasource.db1.driver-class-name=com.mysql.jdbc.Driver
|
||||
spring.datasource.db1.username=ENC(XR4C/hvTYCUqudS49Wh/jA==)
|
||||
spring.datasource.db1.password=ENC(LsKaVL2ycDu+uUNoPndYLA==)
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user