管控bug修改

This commit is contained in:
guoshengxiong 2025-07-17 16:02:12 +08:00
parent aeee70e7a5
commit 19df573b88
12 changed files with 97 additions and 33 deletions

View File

@ -1,11 +1,13 @@
package com.zhgd.xmgl.modules.risk.entity.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.zhgd.xmgl.modules.risk.entity.RiskListDetail;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class RiskListDetailVo extends RiskListDetail {
@TableField(exist = false)
@ApiModelProperty(value = "全路径名(/划分)")
private java.lang.String fullPath;
@ApiModelProperty(value = "总企业sn")

View File

@ -77,4 +77,20 @@ public class RiskListSourceVo extends RiskListSource {
@ApiModelProperty(value = "排查责任人名称(多个,分割)")
private java.lang.String checkWorkerNames;
/**
* 管控责任人单位名称s多个,分割
*/
@ApiModelProperty(value = "管控责任人单位名称s多个,分割)")
private java.lang.String controlWorkerEnterpriseNames;
/**
* 管控责任人名称s多个,分割
*/
@ApiModelProperty(value = "管控责任人名称s多个,分割)")
private java.lang.String controlWorkerNames;
/**
* 排查责任人单位名称s多个,分割
*/
@ApiModelProperty(value = "排查责任人单位名称s多个,分割)")
private java.lang.String checkWorkerEnterpriseNames;
}

View File

@ -41,12 +41,4 @@ public interface RiskListPointMapper extends BaseMapper<RiskListPoint> {
*/
List<RiskListPointVo> queryList(@Param(Constants.WRAPPER) QueryWrapper<RiskListPointVo> queryWrapper, @Param("param") HashMap<String, Object> param);
/**
* 通过id查询管控清单风险点信息
*
* @param id
* @return
*/
RiskListPoint queryById(String id);
}

View File

@ -8,6 +8,9 @@
from risk_list_detail t
join risk_list_library rll on t.library_id = rll.id
where 1=1
<if test="param.id != null and param.id != ''">
and t.id = #{param.id}
</if>
<if test="param.containLibraryId != null and param.containLibraryId != ''">
and t.library_id in (select id from risk_list_library where find_in_set(#{param.containLibraryId},ancestors)
or id=#{param.containLibraryId})

View File

@ -7,6 +7,9 @@
from risk_list_point t
left join risk_list_library rll on rll.id=t.risk_list_library_id
where 1=1
<if test="param.id != null and param.id != ''">
and t.id = #{param.id}
</if>
<if test="param.projectType != null and param.projectType != ''">
and rll.project_type = #{param.projectType}
</if>
@ -26,11 +29,4 @@
)t
${ew.customSqlSegment}
</select>
<select id="queryById" resultType="com.zhgd.xmgl.modules.risk.entity.RiskListPoint">
select * from (
select t.*
from risk_list_point t
)t
where t.id = #{id}
</select>
</mapper>

View File

@ -14,6 +14,9 @@
left join risk_list_library rll on rll.id=rlp.risk_list_library_id
left join risk_list_potential_accident_type rlpat on rlpat.id=t.accident_type_id
where 1=1
<if test="param.id != null and param.id != ''">
and t.id = #{param.id}
</if>
<if test="param.workable == '1'.toString()">
and EXISTS (
SELECT 1

View File

@ -15,8 +15,10 @@ import com.zhgd.xmgl.modules.risk.entity.vo.RiskListDetailVo;
import com.zhgd.xmgl.modules.risk.mapper.RiskListDetailMapper;
import com.zhgd.xmgl.modules.risk.service.IRiskListDetailService;
import com.zhgd.xmgl.modules.risk.service.IRiskListLibraryService;
import com.zhgd.xmgl.util.MapBuilder;
import com.zhgd.xmgl.util.PageUtil;
import com.zhgd.xmgl.util.RefUtil;
import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@ -43,12 +45,26 @@ public class RiskListDetailServiceImpl extends ServiceImpl<RiskListDetailMapper,
@Override
public IPage<RiskListDetailVo> queryPageList(HashMap<String, Object> param) {
String fullPath = MapUtils.getString(param, "fullPath");
Integer pageNo = MapUtils.getInteger(param, "pageNo");
Integer pageSize = MapUtils.getInteger(param, "pageSize");
if (StrUtil.isNotBlank(fullPath)) {
List<RiskListDetailVo> vos = queryList(param).stream().filter(riskListDetailVo -> riskListDetailVo.getFullPath() != null && riskListDetailVo.getFullPath().contains(fullPath)).collect(Collectors.toList());
IPage<RiskListDetailVo> p = new Page<>();
int i = cn.hutool.core.util.PageUtil.getStart(pageNo - 1, pageSize);
p.setTotal(vos.size());
p.setRecords(CollUtil.sub(vos, i, i + pageSize));
p.setCurrent(pageNo);
p.setSize(pageSize);
return p;
} else {
QueryWrapper<RiskListDetailVo> queryWrapper = this.getQueryWrapper(param);
Page<RiskListDetailVo> page = PageUtil.getPage(param);
IPage<RiskListDetailVo> pageList = baseMapper.queryList(page, queryWrapper, param);
pageList.setRecords(this.dealList(pageList.getRecords()));
return pageList;
}
}
@Override
public List<RiskListDetailVo> queryList(HashMap<String, Object> param) {
@ -57,7 +73,7 @@ public class RiskListDetailServiceImpl extends ServiceImpl<RiskListDetailMapper,
}
private QueryWrapper<RiskListDetailVo> getQueryWrapper(HashMap<String, Object> param) {
QueryWrapper<RiskListDetailVo> queryWrapper = QueryGenerator.initPageQueryWrapper(RiskListDetailVo.class, param, true);
QueryWrapper<RiskListDetailVo> queryWrapper = QueryGenerator.initPageQueryWrapper(RiskListDetailVo.class, param);
queryWrapper.orderByDesc(RefUtil.fieldNameUlc(RiskListDetailVo::getId));
return queryWrapper;
}
@ -109,11 +125,13 @@ public class RiskListDetailServiceImpl extends ServiceImpl<RiskListDetailMapper,
@Override
public RiskListDetail queryById(String id) {
RiskListDetail entity = baseMapper.queryById(id);
if (entity == null) {
List<RiskListDetailVo> detailVoList = this.queryList(new MapBuilder<String, Object>()
.put("id", id)
.build());
if (CollUtil.isEmpty(detailVoList)) {
throw new OpenAlertException("未找到对应实体");
}
return entity;
return detailVoList.get(0);
}
}

View File

@ -133,11 +133,13 @@ public class RiskListPointServiceImpl extends ServiceImpl<RiskListPointMapper, R
@Override
public RiskListPoint queryById(String id) {
RiskListPoint entity = baseMapper.queryById(id);
if (entity == null) {
List<RiskListPointVo> pointVos = this.queryList(new MapBuilder<String, Object>()
.put("id", id)
.build());
if (CollUtil.isEmpty(pointVos)) {
throw new OpenAlertException("未找到对应实体");
}
return entity;
return pointVos.get(0);
}
}

View File

@ -23,6 +23,8 @@ import com.zhgd.xmgl.modules.risk.entity.RiskListWorkable;
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.worker.entity.EnterpriseInfo;
import com.zhgd.xmgl.modules.worker.service.impl.EnterpriseInfoServiceImpl;
import com.zhgd.xmgl.modules.xz.security.entity.XzSecurityQualityInspectionRecord;
import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityQualityInspectionRecordService;
import com.zhgd.xmgl.util.MapBuilder;
@ -71,6 +73,9 @@ public class RiskListSourceServiceImpl extends ServiceImpl<RiskListSourceMapper,
@Lazy
@Autowired
private ISystemUserService systemUserService;
@Lazy
@Autowired
private EnterpriseInfoServiceImpl enterpriseInfoService;
@Override
public IPage<RiskListSourceVo> queryPageList(HashMap<String, Object> param) {
@ -115,10 +120,12 @@ public class RiskListSourceServiceImpl extends ServiceImpl<RiskListSourceMapper,
String today = DateUtil.today();
Date date = new Date();
String year = DateUtil.format(date, "yyyy");
String projectSn = list.get(0).getProjectSn();
Map<Long, SystemUser> userMap = systemUserService.list(new LambdaQueryWrapper<SystemUser>()
.eq(SystemUser::getAccountType, 6)
.eq(SystemUser::getSn, list.get(0).getProjectSn())
.eq(SystemUser::getSn, projectSn)
).stream().collect(Collectors.toMap(SystemUser::getUserId, Function.identity(), (o1, o2) -> o1));
Map<Long, EnterpriseInfo> enterpriseInfoMap = enterpriseInfoService.getEnterpriseMapByProjectSn(projectSn);
for (RiskListSourceVo sourceVo : list) {
sourceVo.setCheckWorkerNames(StrUtil.split(sourceVo.getCheckWorkerIds(), ",").stream().map(s -> userMap.get(Convert.toLong(s))).filter(Objects::nonNull).map(SystemUser::getRealName).collect(Collectors.joining(",")));
sourceVo.setCheckedNum((int) securityList.stream().filter(r -> Objects.equals(r.getEngineeringId(), sourceVo.getId())).count());
@ -153,6 +160,9 @@ public class RiskListSourceServiceImpl extends ServiceImpl<RiskListSourceMapper,
sourceVo.setRemainingNum(remainingNum);
sourceVo.setHiddenDangerNum((int) securityList.stream().filter(r -> Objects.equals(r.getEngineeringId(), sourceVo.getId()) && r.getRecordType() == 2).count());
sourceVo.setUnsoldNum((int) securityList.stream().filter(r -> Objects.equals(r.getEngineeringId(), sourceVo.getId()) && r.getRecordType() == 2 && r.getStatus() != 5 && r.getStatus() != 6).count());
sourceVo.setControlWorkerEnterpriseNames(StrUtil.split(sourceVo.getControlWorkerEnterpriseIds(), ",").stream().map(s -> enterpriseInfoMap.get(Convert.toLong(s))).filter(Objects::nonNull).map(EnterpriseInfo::getEnterpriseName).collect(Collectors.joining(",")));
sourceVo.setControlWorkerNames(StrUtil.split(sourceVo.getControlWorkerIds(), ",").stream().map(s -> userMap.get(Convert.toLong(s))).filter(Objects::nonNull).map(SystemUser::getRealName).collect(Collectors.joining(",")));
sourceVo.setCheckWorkerEnterpriseNames(StrUtil.split(sourceVo.getCheckWorkerEnterpriseIds(), ",").stream().map(s -> enterpriseInfoMap.get(Convert.toLong(s))).filter(Objects::nonNull).map(EnterpriseInfo::getEnterpriseName).collect(Collectors.joining(",")));
}
}
return list;
@ -197,11 +207,13 @@ public class RiskListSourceServiceImpl extends ServiceImpl<RiskListSourceMapper,
@Override
public RiskListSourceVo queryById(String id) {
RiskListSourceVo entity = baseMapper.queryById(id);
if (entity == null) {
List<RiskListSourceVo> sourceVos = this.queryList(new MapBuilder<String, Object>()
.put("id", id)
.build());
if (CollUtil.isEmpty(sourceVos)) {
throw new OpenAlertException("未找到对应实体");
}
return entity;
return sourceVos.get(0);
}
@Override

View File

@ -141,8 +141,17 @@ public interface IEnterpriseInfoService extends IService<EnterpriseInfo> {
/**
* 总包企业本周数据统计
*
* @param param
* @return
*/
StatsEnterpriseWeekVo statsEnterpriseWeek(Map<String, Object> param);
/**
* 通过projectSn获取企业map
*
* @param projectSn
* @return
*/
Map<Long, EnterpriseInfo> getEnterpriseMapByProjectSn(String projectSn);
}

View File

@ -1,5 +1,6 @@
package com.zhgd.xmgl.modules.worker.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
@ -65,6 +66,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@ -594,6 +596,15 @@ public class EnterpriseInfoServiceImpl extends ServiceImpl<EnterpriseInfoMapper,
return vo;
}
@Override
public Map<Long, EnterpriseInfo> getEnterpriseMapByProjectSn(String projectSn) {
List<EntityMap> infoList = this.getEnterpriseInfoList(new MapBuilder<String, Object>()
.put("projectSn", projectSn)
.build());
List<EnterpriseInfo> enterpriseInfos = BeanUtil.copyToList(infoList, EnterpriseInfo.class);
return enterpriseInfos.stream().collect(Collectors.toMap(EnterpriseInfo::getId, Function.identity(), (o1, o2) -> o1));
}
/**
* 获取总包下面分包和总包自己的企业ids
*

View File

@ -1,6 +1,6 @@
#http.port=30250
http.port=23912
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.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.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.db1.username=ENC(XR4C/hvTYCUqudS49Wh/jA==)
spring.datasource.db1.password=ENC(LsKaVL2ycDu+uUNoPndYLA==)