Merge branch 'mod_security' into prod
This commit is contained in:
commit
a2ed0c329d
@ -194,6 +194,8 @@ public class SystemUserController {
|
||||
@ApiImplicitParam(name = "qualityRegionBindType", required = false, value = "1区域绑定的人2区域绑定单位", paramType = "body"),
|
||||
@ApiImplicitParam(name = "userId", required = false, value = "用户id", paramType = "body"),
|
||||
@ApiImplicitParam(name = "isSupervisingRoleName", required = false, value = "1监理角色名称的人", paramType = "body"),
|
||||
@ApiImplicitParam(name = "teamIdList", required = false, value = "班组idList", paramType = "body"),
|
||||
@ApiImplicitParam(name = "departmentIdList", required = false, value = "部门idList", paramType = "body"),
|
||||
})
|
||||
@PostMapping(value = "/getProjectChilderSystemUserPageList")
|
||||
public Result<IPage<SystemUser>> getProjectChilderSystemUserPageList(@RequestBody Map<String, Object> map) {
|
||||
|
||||
@ -109,6 +109,9 @@
|
||||
<if test="param.roleName != null and param.roleName != ''">
|
||||
and c.role_name = #{param.roleName}
|
||||
</if>
|
||||
<if test="param.roleId != null and param.roleId != ''">
|
||||
and c.role_id = #{param.roleId}
|
||||
</if>
|
||||
<if test="param.isSupervisingRoleName == '1'.toString()">
|
||||
and c.role_name = '监理'
|
||||
</if>
|
||||
|
||||
@ -759,8 +759,9 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
||||
listRuleItems.forEach(riskListRuleItem -> riskListRuleItem.setSn(company.getHeadquartersSn()));
|
||||
riskListRuleItemService.saveBatch(listRuleItems);
|
||||
|
||||
List<XzSecurityDangerFieldVo> fieldVos = JSON.parseArray(ResourceUtil.readUtf8Str("init/data/xzSecurityDangerField.json"), XzSecurityDangerFieldVo.class);
|
||||
xzSecurityDangerFieldService.saveBatch(fieldVos.stream().map(o -> {
|
||||
//初始化安全值
|
||||
List<XzSecurityDangerFieldVo> dangerFieldVos = JSON.parseArray(ResourceUtil.readUtf8Str("init/data/xzSecurityDangerField.json"), XzSecurityDangerFieldVo.class);
|
||||
xzSecurityDangerFieldService.saveBatch(dangerFieldVos.stream().map(o -> {
|
||||
XzSecurityDangerField bean = BeanUtil.toBean(o, XzSecurityDangerField.class);
|
||||
bean.setSn(company.getHeadquartersSn());
|
||||
bean.setCompanyProjectType(1);
|
||||
|
||||
@ -1,15 +1,11 @@
|
||||
package com.zhgd.xmgl.modules.car.controller;
|
||||
|
||||
import cn.xuyanwu.spring.file.storage.FileInfo;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
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.basicdata.service.UploadFileService;
|
||||
import com.zhgd.xmgl.modules.car.entity.CarMeasureSpeedData;
|
||||
import com.zhgd.xmgl.modules.car.entity.CarMeasureSpeedDev;
|
||||
import com.zhgd.xmgl.modules.car.service.ICarMeasureSpeedDataService;
|
||||
import com.zhgd.xmgl.modules.car.service.ICarMeasureSpeedDevService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -18,7 +14,6 @@ import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.simpleframework.xml.core.Validate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
@ -89,17 +84,6 @@ public class CarMeasureSpeedDataController {
|
||||
@PostMapping(value = "/add")
|
||||
public Result<CarMeasureSpeedData> add(@RequestBody @Validate CarMeasureSpeedData carMeasureSpeedData) {
|
||||
log.info("添加车辆测速数据信息:{}", JSON.toJSONString(carMeasureSpeedData));
|
||||
CarMeasureSpeedDev speedDev = carMeasureSpeedDevService.getOne(new LambdaQueryWrapper<CarMeasureSpeedDev>()
|
||||
.eq(CarMeasureSpeedDev::getDevSn, carMeasureSpeedData.getDevSn()));
|
||||
if (speedDev == null) {
|
||||
throw new OpenAlertException("设备编号不正确");
|
||||
}
|
||||
carMeasureSpeedData.setProjectSn(speedDev.getProjectSn());
|
||||
FileInfo fileInfo = null;
|
||||
if (StringUtils.isNotBlank(carMeasureSpeedData.getSnapshotImageBase64())) {
|
||||
fileInfo = uploadFileService.uploadFileBase64Image(carMeasureSpeedData.getSnapshotImageBase64());
|
||||
carMeasureSpeedData.setSnapshotImage(fileInfo.getUrl());
|
||||
}
|
||||
carMeasureSpeedDataService.add(carMeasureSpeedData);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ -1,28 +1,36 @@
|
||||
package com.zhgd.xmgl.modules.car.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.xmgl.base.entity.vo.TrendOneVo;
|
||||
import com.zhgd.xmgl.modules.car.entity.CarMeasureSpeedData;
|
||||
import com.zhgd.xmgl.modules.car.mapper.CarMeasureSpeedDataMapper;
|
||||
import com.zhgd.xmgl.modules.car.service.ICarMeasureSpeedDataService;
|
||||
import com.zhgd.xmgl.util.DateUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.xuyanwu.spring.file.storage.FileInfo;
|
||||
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.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
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.TrendOneVo;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.UploadFileService;
|
||||
import com.zhgd.xmgl.modules.car.entity.CarMeasureSpeedData;
|
||||
import com.zhgd.xmgl.modules.car.entity.CarMeasureSpeedDev;
|
||||
import com.zhgd.xmgl.modules.car.mapper.CarMeasureSpeedDataMapper;
|
||||
import com.zhgd.xmgl.modules.car.service.ICarMeasureSpeedDataService;
|
||||
import com.zhgd.xmgl.modules.car.service.ICarMeasureSpeedDevService;
|
||||
import com.zhgd.xmgl.util.DateUtils;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import org.apache.commons.lang.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;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Description: 车辆测速数据
|
||||
@ -31,9 +39,16 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class CarMeasureSpeedDataServiceImpl extends ServiceImpl<CarMeasureSpeedDataMapper, CarMeasureSpeedData> implements ICarMeasureSpeedDataService {
|
||||
@Autowired
|
||||
private CarMeasureSpeedDataMapper carMeasureSpeedDataMapper;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ICarMeasureSpeedDevService carMeasureSpeedDevService;
|
||||
@Lazy
|
||||
@Resource
|
||||
private UploadFileService uploadFileService;
|
||||
|
||||
@Override
|
||||
public IPage<CarMeasureSpeedData> queryPageList(HashMap<String, Object> param) {
|
||||
@ -62,6 +77,21 @@ public class CarMeasureSpeedDataServiceImpl extends ServiceImpl<CarMeasureSpeedD
|
||||
|
||||
@Override
|
||||
public void add(CarMeasureSpeedData carMeasureSpeedData) {
|
||||
CarMeasureSpeedDev speedDev = carMeasureSpeedDevService.getOne(new LambdaQueryWrapper<CarMeasureSpeedDev>()
|
||||
.eq(CarMeasureSpeedDev::getDevSn, carMeasureSpeedData.getDevSn()));
|
||||
if (speedDev == null) {
|
||||
throw new OpenAlertException("设备编号不正确");
|
||||
}
|
||||
carMeasureSpeedData.setProjectSn(speedDev.getProjectSn());
|
||||
FileInfo fileInfo = null;
|
||||
if (StringUtils.isNotBlank(carMeasureSpeedData.getSnapshotImageBase64())) {
|
||||
fileInfo = uploadFileService.uploadFileBase64Image(carMeasureSpeedData.getSnapshotImageBase64());
|
||||
carMeasureSpeedData.setSnapshotImage(fileInfo.getUrl());
|
||||
}
|
||||
if (Objects.equals(carMeasureSpeedData.getIsExceed(), 1) && Objects.nonNull(speedDev.getThreshold())
|
||||
&& Objects.nonNull(carMeasureSpeedData.getCurrentSpeed()) && NumberUtil.isGreater(carMeasureSpeedData.getCurrentSpeed(), speedDev.getThreshold())) {
|
||||
carMeasureSpeedData.setExceedingThreshold(NumberUtil.sub(carMeasureSpeedData.getCurrentSpeed(), speedDev.getThreshold()));
|
||||
}
|
||||
carMeasureSpeedData.setId(null);
|
||||
baseMapper.insert(carMeasureSpeedData);
|
||||
}
|
||||
@ -72,7 +102,21 @@ public class CarMeasureSpeedDataServiceImpl extends ServiceImpl<CarMeasureSpeedD
|
||||
if (oldCarMeasureSpeedData == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
CarMeasureSpeedDev speedDev = carMeasureSpeedDevService.getOne(new LambdaQueryWrapper<CarMeasureSpeedDev>()
|
||||
.eq(CarMeasureSpeedDev::getDevSn, carMeasureSpeedData.getDevSn()));
|
||||
if (speedDev == null) {
|
||||
throw new OpenAlertException("设备编号不正确");
|
||||
}
|
||||
if (Objects.equals(carMeasureSpeedData.getIsExceed(), 1) && Objects.nonNull(speedDev.getThreshold())
|
||||
&& Objects.nonNull(carMeasureSpeedData.getCurrentSpeed()) && NumberUtil.isGreater(carMeasureSpeedData.getCurrentSpeed(), speedDev.getThreshold())) {
|
||||
carMeasureSpeedData.setExceedingThreshold(NumberUtil.sub(carMeasureSpeedData.getCurrentSpeed(), speedDev.getThreshold()));
|
||||
} else {
|
||||
carMeasureSpeedData.setExceedingThreshold(null);
|
||||
}
|
||||
baseMapper.updateById(carMeasureSpeedData);
|
||||
this.update(new LambdaUpdateWrapper<CarMeasureSpeedData>()
|
||||
.set(CarMeasureSpeedData::getExceedingThreshold, carMeasureSpeedData.getExceedingThreshold())
|
||||
.eq(CarMeasureSpeedData::getId, carMeasureSpeedData.getId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -82,6 +82,9 @@ import com.zhgd.xmgl.modules.video.mapper.VideoItemMapper;
|
||||
import com.zhgd.xmgl.modules.video.service.IAiAnalyseHardWareRecordService;
|
||||
import com.zhgd.xmgl.modules.worker.entity.UfaceDev;
|
||||
import com.zhgd.xmgl.modules.worker.service.*;
|
||||
import com.zhgd.xmgl.modules.xz.security.entity.XzSecurityDangerField;
|
||||
import com.zhgd.xmgl.modules.xz.security.entity.vo.XzSecurityDangerFieldVo;
|
||||
import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityDangerFieldService;
|
||||
import com.zhgd.xmgl.util.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
@ -221,6 +224,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
||||
@Autowired
|
||||
@Qualifier("doubleCarbonExecutor")
|
||||
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IXzSecurityDangerFieldService xzSecurityDangerFieldService;
|
||||
|
||||
@Override
|
||||
public List<String> getProjectSnList(String sn) {
|
||||
@ -317,6 +323,25 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
||||
BimfaceConfig bimfaceConfig = new BimfaceConfig();
|
||||
bimfaceConfig.setProjectSn(project.getProjectSn());
|
||||
bimfaceConfigMapper.insert(bimfaceConfig);
|
||||
|
||||
//初始化安全值
|
||||
List<XzSecurityDangerFieldVo> dangerFieldVos = xzSecurityDangerFieldService.getEffectiveConfig(new MapBuilder<String, Object>()
|
||||
.put("sn", project.getProjectSn())
|
||||
.put("companyProjectType", 2)
|
||||
.put("recordType", 1)
|
||||
.build());
|
||||
dangerFieldVos.addAll(xzSecurityDangerFieldService.getEffectiveConfig(new MapBuilder<String, Object>()
|
||||
.put("sn", project.getProjectSn())
|
||||
.put("companyProjectType", 2)
|
||||
.put("recordType", 2)
|
||||
.build()));
|
||||
xzSecurityDangerFieldService.saveBatch(dangerFieldVos.stream().map(o -> {
|
||||
XzSecurityDangerField bean = BeanUtil.toBean(o, XzSecurityDangerField.class);
|
||||
bean.setId(null);
|
||||
bean.setSn(project.getProjectSn());
|
||||
bean.setCompanyProjectType(2);
|
||||
return bean;
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -178,11 +178,11 @@ public class QualityRegionServiceImpl extends ServiceImpl<QualityRegionMapper, Q
|
||||
}
|
||||
map.put("regionIds", StrUtil.join(",", regionDbIds));
|
||||
for (RiskListSourceVo sourceVo : sourceVos) {
|
||||
if (StrUtil.isNotBlank(sourceVo.getSpecificResponsibilityAreaIds())) {
|
||||
for (String regionId : StrUtil.split(sourceVo.getSpecificResponsibilityAreaIds(), ",")) {
|
||||
if (CollUtil.isNotEmpty(sourceVo.getUnCheckAreaIdList())) {
|
||||
for (Long regionId : sourceVo.getUnCheckAreaIdList()) {
|
||||
HashSet<Long> set = new HashSet<>();
|
||||
set.add(sourceVo.getPointId());
|
||||
regionIdMap.merge(Long.valueOf(regionId), set, (old, n) -> {
|
||||
regionIdMap.merge(regionId, set, (old, n) -> {
|
||||
old.addAll(n);
|
||||
return old;
|
||||
});
|
||||
|
||||
@ -106,7 +106,7 @@ public class RiskListSourceDataCenterController {
|
||||
endTime = DateUtil.formatDateTime(DateUtil.endOfMonth(DateUtil.parseDate(endTime + "-01")));
|
||||
startTime = DateUtil.formatDateTime(DateUtil.beginOfMonth(DateUtil.parseDate(startTime + "-01")));
|
||||
List<RiskListSource> sources = riskListSourceService.list(new LambdaQueryWrapper<RiskListSource>()
|
||||
.select(RiskListSource::getId, RiskListSource::getEffectiveTimeBegin, RiskListSource::getEffectiveTimeEnd)
|
||||
.select(RiskListSource::getId, RiskListSource::getEffectiveTimeBegin, RiskListSource::getEffectiveTimeEnd, RiskListSource::getRiskLevel)
|
||||
.eq(RiskListSource::getProjectSn, MapUtils.getString(param, "projectSn"))
|
||||
.le(RiskListSource::getEffectiveTimeBegin, endTime)
|
||||
.ge(RiskListSource::getEffectiveTimeEnd, startTime)
|
||||
@ -134,10 +134,10 @@ public class RiskListSourceDataCenterController {
|
||||
@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"),
|
||||
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", 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 = "/countRisksByLibrary")
|
||||
public Result<SectorVo> countRisksByLibrary(@RequestParam @ApiIgnore HashMap<String, Object> map) {
|
||||
@ -162,9 +162,9 @@ public class RiskListSourceDataCenterController {
|
||||
@ApiOperation(value = "隐患排查类别执行率TOP10", notes = "隐患排查类别执行率TOP10", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "effectiveTimeEnd_begin", value = "开始日期", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "effectiveTimeBegin_end", value = "结束日期", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "isInConstruction", value = "1在施", paramType = "query", required = false, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "effectiveTimeEnd_begin", value = "开始日期", paramType = "query", required = false, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "effectiveTimeBegin_end", value = "结束日期", paramType = "query", required = false, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "projectType", value = "工程类别(字典值)", paramType = "query", required = false, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "checkPeriod", value = "排查周期:1日2周3月4季度5半年", paramType = "query", required = false, dataType = "String"),
|
||||
})
|
||||
@ -173,10 +173,10 @@ public class RiskListSourceDataCenterController {
|
||||
param.put("allowGenerateTask", 1);
|
||||
List<RiskListSourceVo> sourceVos = riskListSourceService.queryList(param).stream().filter(o -> StrUtil.isNotBlank(o.getListLibraryName()) && o.getEffectiveTimeBegin() != null && o.getEffectiveTimeEnd() != null).collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(sourceVos)) {
|
||||
return null;
|
||||
return Result.ok();
|
||||
}
|
||||
Date begin = StrUtil.isNotBlank(MapUtils.getString(param, "effectiveTimeEnd_begin")) ? DateUtil.parseDateTime(MapUtils.getString(param, "effectiveTimeEnd_begin")) : null;
|
||||
Date end = StrUtil.isNotBlank(MapUtils.getString(param, "effectiveTimeBegin_end")) ? DateUtil.parseDateTime(MapUtils.getString(param, "effectiveTimeBegin_end")) : null;
|
||||
Date begin = DateUtil.parseDateTime(MapUtils.getString(param, "effectiveTimeEnd_begin"));
|
||||
Date end = DateUtil.parseDateTime(MapUtils.getString(param, "effectiveTimeBegin_end"));
|
||||
List<SourceCheckNumBo> checkNumBos = getSourceCheckNumBo(sourceVos);
|
||||
//1. 计算有效期内的source的应排查、(未施工+已排查)数量
|
||||
for (RiskListSourceVo sourceVo : sourceVos) {
|
||||
@ -347,19 +347,19 @@ public class RiskListSourceDataCenterController {
|
||||
@ApiOperation(value = "风险类别占比图", notes = "风险类别占比图", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "effectiveTimeEnd_begin", value = "开始日期", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "effectiveTimeBegin_end", value = "结束日期", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "checkPeriod", value = "排查周期:1日2周3月4季度5半年", paramType = "query", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "effectiveTimeEnd_begin", value = "开始日期", paramType = "query", required = false, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "effectiveTimeBegin_end", value = "结束日期", paramType = "query", required = false, dataType = "Integer"),
|
||||
})
|
||||
@GetMapping(value = "/getRiskByDate")
|
||||
public Result<List<TrendOneVo>> getRiskByDate(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
param.put("allowGenerateTask", 1);
|
||||
List<RiskListSourceVo> sourceVos = riskListSourceService.queryList(param).stream().filter(o -> StrUtil.isNotBlank(o.getListLibraryName()) && o.getEffectiveTimeBegin() != null && o.getEffectiveTimeEnd() != null).collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(sourceVos)) {
|
||||
return null;
|
||||
return Result.ok();
|
||||
}
|
||||
Date begin = StrUtil.isNotBlank(MapUtils.getString(param, "effectiveTimeEnd_begin")) ? DateUtil.parseDateTime(MapUtils.getString(param, "effectiveTimeEnd_begin")) : null;
|
||||
Date end = StrUtil.isNotBlank(MapUtils.getString(param, "effectiveTimeBegin_end")) ? DateUtil.parseDateTime(MapUtils.getString(param, "effectiveTimeBegin_end")) : null;
|
||||
Date begin = DateUtil.parseDate(MapUtils.getString(param, "effectiveTimeEnd_begin"));
|
||||
Date end = DateUtil.parseDate(MapUtils.getString(param, "effectiveTimeBegin_end"));
|
||||
List<SourceCheckNumBo> checkNumBos = getSourceCheckNumBo(sourceVos);
|
||||
//1. 计算有效期内的source的每天的应排查、(未施工+已排查)数量
|
||||
List<RiskByDateBo> sourceDateVos = new ArrayList<>();
|
||||
@ -454,7 +454,7 @@ public class RiskListSourceDataCenterController {
|
||||
return vo;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
return Result.success(null);
|
||||
return Result.success(voList);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -489,19 +489,24 @@ public class RiskListSourceDataCenterController {
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "effectiveTimeEnd_begin", value = "开始日期", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "effectiveTimeBegin_end", value = "结束日期", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "checkPeriod", value = "排查周期:1日2周3月4季度5半年", paramType = "query", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "riskAssessmentCalculator", value = "风险评估计算器1:LECD;2:直接判定法;3:LCD;4:LSR;", paramType = "query", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "projectType", value = "工程类别(字典值)", paramType = "query", required = false, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "libraryId", value = "风险清单库id", paramType = "query", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "effectiveTimeEnd_begin", value = "开始日期", paramType = "query", required = false, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "effectiveTimeBegin_end", value = "结束日期", paramType = "query", required = false, dataType = "Integer"),
|
||||
})
|
||||
@GetMapping(value = "/getHighRiskValByType")
|
||||
public Result<IPage<HighRiskValByType>> getHighRiskValByType(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
param.put("allowGenerateTask", 1);
|
||||
List<RiskListSourceVo> sourceVos = riskListSourceService.queryList(param).stream().filter(o -> StrUtil.isNotBlank(o.getListLibraryName()) && o.getEffectiveTimeBegin() != null && o.getEffectiveTimeEnd() != null).collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(sourceVos)) {
|
||||
return null;
|
||||
IPage<HighRiskValByType> p = new Page<>();
|
||||
p.setTotal(0);
|
||||
p.setRecords(null);
|
||||
p.setCurrent(MapUtils.getIntValue(param, "pageNo"));
|
||||
p.setSize(MapUtils.getIntValue(param, "pageSize"));
|
||||
return Result.success(p);
|
||||
}
|
||||
Map<String, Map<Integer, Optional<RiskListSourceVo>>> collect = sourceVos.stream()
|
||||
.peek(vo -> vo.setRiskVal(riskListSourceService.calRiskVal(vo)))
|
||||
|
||||
@ -144,10 +144,11 @@ public class RiskListSourceUnbuiltController {
|
||||
RiskListSourceUnbuiltDto add = new RiskListSourceUnbuiltDto();
|
||||
BeanUtils.copyProperties(addDto, add);
|
||||
add.setSourceId(Long.valueOf(sourceId));
|
||||
add.setInspectionTime(new Date());
|
||||
add.setInspectionResult("未施工");
|
||||
riskListSourceUnbuiltService.add(add);
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(addDto.getRegionPointList())) {
|
||||
} else if (CollUtil.isNotEmpty(addDto.getRegionPointList())) {
|
||||
for (RiskListSourceUnbuiltAddDto.RegionPoint regionPoint : addDto.getRegionPointList()) {
|
||||
List<RiskListSourceVo> sourceVos = riskListSourceService.queryList(new MapBuilder<String, Object>()
|
||||
.put("pointId", regionPoint.getPointId())
|
||||
@ -156,8 +157,8 @@ public class RiskListSourceUnbuiltController {
|
||||
for (RiskListSourceVo sourceVo : sourceVos) {
|
||||
RiskListSourceUnbuiltDto add = new RiskListSourceUnbuiltDto();
|
||||
BeanUtils.copyProperties(addDto, add);
|
||||
add.setInspectionTime(new Date());
|
||||
add.setSourceId(sourceVo.getId());
|
||||
add.setInspectionTime(new Date());
|
||||
add.setResponsibleRegionId(regionPoint.getRegionId());
|
||||
add.setInspectionResult("未施工");
|
||||
riskListSourceUnbuiltService.add(add);
|
||||
|
||||
@ -14,14 +14,14 @@ public class RiskListPointVo extends RiskListPoint {
|
||||
@ApiModelProperty(value = "危险源数")
|
||||
private java.lang.Integer hazardSourceNumber;
|
||||
/**
|
||||
* 我的待办的危险源数(未排查)
|
||||
* 我的待办的危险源数(未排查或未落实)
|
||||
*/
|
||||
@ApiModelProperty(value = "我的待办的危险源数(未排查)")
|
||||
@ApiModelProperty(value = "我的待办的危险源数(未排查或未落实)")
|
||||
private java.lang.Integer hazardSourceNumberTodo;
|
||||
/**
|
||||
* 我的待办的危险源idList(未排查)
|
||||
*/
|
||||
@ApiModelProperty(value = "我的待办的危险源idList(未排查)")
|
||||
@ApiModelProperty(value = "我的待办的危险源idList(未排查或未落实)")
|
||||
private List<Long> hazardSourceNumberTodoIdList;
|
||||
|
||||
}
|
||||
|
||||
@ -99,15 +99,13 @@ public class RiskListPointServiceImpl extends ServiceImpl<RiskListPointMapper, R
|
||||
List<Long> pointIds = list.stream().map(RiskListPoint::getId).collect(Collectors.toList());
|
||||
List<RiskListSource> sources = riskListSourceService.list(new LambdaQueryWrapper<RiskListSource>()
|
||||
.in(RiskListSource::getPointId, pointIds));
|
||||
for (RiskListPointVo pointVo : list) {
|
||||
pointVo.setHazardSourceNumber((int) sources.stream().filter(riskListSource -> Objects.equals(riskListSource.getPointId(), pointVo.getId())).count());
|
||||
}
|
||||
Integer isMySourceToDoForWorkable = MapUtils.getInteger(param, "isMySourceToDoForWorkable");
|
||||
Integer isMySourceToDo = MapUtils.getInteger(param, "isMySourceToDo");
|
||||
if (Objects.equals(isMySourceToDo, 1) || Objects.equals(isMySourceToDoForWorkable, 1)) {
|
||||
Long regionIds = MapUtils.getLong(param, "regionIds");
|
||||
List<RiskListSourceVo> sourceVos = riskListSourceService.queryList(new MapBuilder<String, Object>()
|
||||
.put("specificResponsibilityAreaIds", regionIds)
|
||||
.put("regionIds", regionIds)
|
||||
.put("checkPeriod", MapUtils.getInteger(param, "checkPeriod"))
|
||||
.put("isMySourceToDo", MapUtils.getInteger(param, "isMySourceToDo"))
|
||||
.put("isMySourceToDoForWorkable", MapUtils.getInteger(param, "isMySourceToDoForWorkable"))
|
||||
@ -123,6 +121,7 @@ public class RiskListPointServiceImpl extends ServiceImpl<RiskListPointMapper, R
|
||||
return areaIdList.contains(regionIds);
|
||||
}).collect(Collectors.groupingBy(RiskListSource::getPointId));
|
||||
list = list.stream().filter(p -> pointIdMap.containsKey(p.getId())).peek(p -> {
|
||||
p.setHazardSourceNumber((int) sources.stream().filter(riskListSource -> Objects.equals(riskListSource.getPointId(), p.getId())).count());
|
||||
p.setHazardSourceNumberTodo(Optional.ofNullable(pointIdMap.get(p.getId())).map(m -> m.size()).orElse(null));
|
||||
p.setHazardSourceNumberTodoIdList(Optional.ofNullable(pointIdMap.get(p.getId())).map(m -> m.stream().map(RiskListSource::getId).collect(Collectors.toList())).orElse(null));
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
@ -33,8 +33,10 @@ 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.entity.XzSecurityQualityInspectionRegion;
|
||||
import com.zhgd.xmgl.modules.xz.security.entity.vo.XzSecurityQualityInspectionRecordVo;
|
||||
import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityQualityInspectionRecordService;
|
||||
import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityQualityInspectionRegionService;
|
||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
import com.zhgd.xmgl.util.MapBuilder;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
@ -43,6 +45,7 @@ import org.apache.commons.collections.MapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
@ -56,6 +59,7 @@ import java.util.stream.Collectors;
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class RiskListSourceServiceImpl extends ServiceImpl<RiskListSourceMapper, RiskListSource> implements IRiskListSourceService {
|
||||
@Autowired
|
||||
private RiskListSourceMapper riskListSourceMapper;
|
||||
@ -90,6 +94,9 @@ public class RiskListSourceServiceImpl extends ServiceImpl<RiskListSourceMapper,
|
||||
@Lazy
|
||||
@Autowired
|
||||
private EnterpriseInfoServiceImpl enterpriseInfoService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IXzSecurityQualityInspectionRegionService xzSecurityQualityInspectionRegionService;
|
||||
|
||||
@Override
|
||||
public IPage<RiskListSourceVo> queryPageList(HashMap<String, Object> param) {
|
||||
@ -151,21 +158,29 @@ public class RiskListSourceServiceImpl extends ServiceImpl<RiskListSourceMapper,
|
||||
}
|
||||
|
||||
private List<RiskListSourceVo> dealList(List<RiskListSourceVo> list, HashMap<String, Object> param) {
|
||||
String regionIds = MapUtils.getString(param, "regionIds");
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
List<Long> sourceIds = list.stream().map(RiskListSourceVo::getId).collect(Collectors.toList());
|
||||
List<XzSecurityQualityInspectionRecord> securityList = xzSecurityQualityInspectionRecordService.list(new LambdaQueryWrapper<XzSecurityQualityInspectionRecord>()
|
||||
.eq(XzSecurityQualityInspectionRecord::getType, 10)
|
||||
.in(XzSecurityQualityInspectionRecord::getEngineeringId, sourceIds)
|
||||
);
|
||||
if (CollUtil.isNotEmpty(securityList)) {
|
||||
Map<Long, String> rid2RegionsMap = xzSecurityQualityInspectionRegionService.list(new LambdaQueryWrapper<XzSecurityQualityInspectionRegion>()
|
||||
.in(XzSecurityQualityInspectionRegion::getInspectionId, securityList.stream().map(XzSecurityQualityInspectionRecord::getId).collect(Collectors.toList())))
|
||||
.stream()
|
||||
.collect(Collectors.groupingBy(XzSecurityQualityInspectionRegion::getInspectionId,
|
||||
Collectors.collectingAndThen(Collectors.mapping(item -> String.valueOf(item.getRegionId()), Collectors.toList()), list1 -> String.join(",", list1))));
|
||||
for (XzSecurityQualityInspectionRecord record : securityList) {
|
||||
record.setRegionIds(rid2RegionsMap.get(record.getId()));
|
||||
}
|
||||
}
|
||||
List<RiskListSourceUnbuilt> unbuilts = riskListSourceUnbuiltService.list(new LambdaQueryWrapper<RiskListSourceUnbuilt>()
|
||||
.in(RiskListSourceUnbuilt::getSourceId, sourceIds));
|
||||
List<RiskListWorkable> workables = riskListWorkableService.list(new LambdaQueryWrapper<RiskListWorkable>()
|
||||
.in(RiskListWorkable::getSourceId, sourceIds));
|
||||
Map<Long, List<Long>> sourceId2WorkableMap = workables.stream().collect(Collectors.groupingBy(RiskListWorkable::getSourceId,
|
||||
Collectors.mapping( // 下游收集器:映射
|
||||
RiskListWorkable::getResponsibleArea, // 获取每个 RiskListWorkable 的 responsibleArea 列表
|
||||
Collectors.toList() // 将这些列表收集成一个 List
|
||||
)));
|
||||
Collectors.mapping(RiskListWorkable::getResponsibleArea, Collectors.toList())));
|
||||
Set<Long> workableSet = workables.stream().map(RiskListWorkable::getSourceId).collect(Collectors.toSet());
|
||||
String projectSn = list.get(0).getProjectSn();
|
||||
Map<Long, SystemUser> userMap = systemUserService.list(new LambdaQueryWrapper<SystemUser>()
|
||||
@ -179,8 +194,8 @@ public class RiskListSourceServiceImpl extends ServiceImpl<RiskListSourceMapper,
|
||||
sourceVo.setNotUnderConstructionNum((int) unbuilts.stream().filter(r -> Objects.equals(r.getSourceId(), sourceVo.getId())).count());
|
||||
sourceVo.setWorkable(workableSet.contains(sourceVo.getId()) ? 1 : 0);
|
||||
sourceVo.setRemainingNum(getRemainingNum(securityList, unbuilts, sourceVo));
|
||||
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.setHiddenDangerNum((int) securityList.stream().filter(r -> Objects.equals(r.getEngineeringId(), sourceVo.getId()) && r.getRecordType() == 1).count());
|
||||
sourceVo.setUnsoldNum((int) securityList.stream().filter(r -> Objects.equals(r.getEngineeringId(), sourceVo.getId()) && r.getRecordType() == 1 && 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(",")));
|
||||
@ -201,7 +216,8 @@ public class RiskListSourceServiceImpl extends ServiceImpl<RiskListSourceMapper,
|
||||
list = list.stream().filter(riskListSourceVo -> riskListSourceVo.getRemainingNum() != null && riskListSourceVo.getRemainingNum() > 0).collect(Collectors.toList());
|
||||
}
|
||||
if (Objects.equals(isMySourceToDoForWorkable, 1)) {
|
||||
list = list.stream().filter(riskListSourceVo -> riskListSourceVo.getRemainingNum() != null && riskListSourceVo.getRemainingNum() > 0).collect(Collectors.toList());
|
||||
list = list.stream().filter(sourceVo -> sourceVo.getUnWorkableAreaIdList().size() > 0
|
||||
&& (StrUtil.isBlank(regionIds) || sourceVo.getUnWorkableAreaIdList().contains(Convert.toLong(regionIds)))).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
@ -224,11 +240,11 @@ public class RiskListSourceServiceImpl extends ServiceImpl<RiskListSourceMapper,
|
||||
List<XzSecurityQualityInspectionRecord> securityList1 = securityList.stream().filter(r -> StrUtil.isNotBlank(r.getInspectTime()) && Objects.equals(r.getEngineeringId(), sourceVo.getId())).collect(Collectors.toList());
|
||||
List<RiskListSourceUnbuilt> unbuilts1 = unbuilts.stream().filter(r -> r.getInspectionTime() != null && Objects.equals(r.getSourceId(), sourceVo.getId())).collect(Collectors.toList());
|
||||
return StrUtil.split(sourceVo.getSpecificResponsibilityAreaIds(), ",").stream().map(Convert::toLong).filter(areaId -> {
|
||||
List<XzSecurityQualityInspectionRecord> finalSecurityList1 = securityList1.stream().filter(r -> Objects.equals(r.getEngineeringId(), areaId)).collect(Collectors.toList());
|
||||
List<XzSecurityQualityInspectionRecord> finalSecurityList1 = securityList1.stream().filter(r -> StrUtil.contains(r.getRegionIds(), areaId + "")).collect(Collectors.toList());
|
||||
List<RiskListSourceUnbuilt> finalUnbuilts1 = unbuilts1.stream().filter(r -> Objects.equals(r.getResponsibleRegionId(), areaId)).collect(Collectors.toList());
|
||||
int remainingNum = 0;
|
||||
if (Objects.equals(sourceVo.getCheckPeriod(), 1)) {
|
||||
int count = (int) finalSecurityList1.stream().filter(r -> r.getInspectTime().startsWith(today)).count();
|
||||
int count = (int) finalSecurityList1.stream().filter(r -> DateUtil.isSameDay(DateUtil.parseDate(r.getInspectTime()), date)).count();
|
||||
int count1 = (int) finalUnbuilts1.stream().filter(r -> DateUtil.formatDate(r.getInspectionTime()).startsWith(today)).count();
|
||||
remainingNum = sourceVo.getCheckNum() - count - count1;
|
||||
} else if (Objects.equals(sourceVo.getCheckPeriod(), 2)) {
|
||||
@ -274,31 +290,57 @@ public class RiskListSourceServiceImpl extends ServiceImpl<RiskListSourceMapper,
|
||||
if (StrUtil.isNotBlank(sourceVo.getSpecificResponsibilityAreaIds()) && sourceVo.getCheckNum() != null) {
|
||||
//计算剩余数量
|
||||
int totalNum = sourceVo.getSpecificResponsibilityAreaIds().split(",").length * sourceVo.getCheckNum();
|
||||
if (Objects.equals(sourceVo.getCheckPeriod(), 1)) {
|
||||
int count = (int) securityList1.stream().filter(r -> r.getInspectTime().startsWith(today)).count();
|
||||
int count1 = (int) unbuilts1.stream().filter(r -> DateUtil.formatDate(r.getInspectionTime()).startsWith(today)).count();
|
||||
remainingNum = totalNum - count - count1;
|
||||
} else if (Objects.equals(sourceVo.getCheckPeriod(), 2)) {
|
||||
int count = (int) securityList1.stream().filter(r -> DateUtil.isSameWeek(DateUtil.parseDate(r.getInspectTime()), date, true)).count();
|
||||
int count1 = (int) unbuilts1.stream().filter(r -> DateUtil.isSameWeek(r.getInspectionTime(), date, true)).count();
|
||||
remainingNum = totalNum - count - count1;
|
||||
} else if (Objects.equals(sourceVo.getCheckPeriod(), 3)) {
|
||||
int count = (int) securityList1.stream().filter(r -> DateUtil.isSameMonth(DateUtil.parseDate(r.getInspectTime()), date)).count();
|
||||
int count1 = (int) unbuilts1.stream().filter(r -> DateUtil.isSameMonth(r.getInspectionTime(), date)).count();
|
||||
remainingNum = totalNum - count - count1;
|
||||
} else if (Objects.equals(sourceVo.getCheckPeriod(), 4)) {
|
||||
int count = (int) securityList1.stream().filter(r -> r.getInspectTime().startsWith(year) && Objects.equals(DateUtil.quarter(DateUtil.parseDate(r.getInspectTime())), DateUtil.quarter(date))).count();
|
||||
int count1 = (int) unbuilts1.stream().filter(r -> DateUtil.formatDate(r.getInspectionTime()).startsWith(year) && Objects.equals(DateUtil.quarter(r.getInspectionTime()), DateUtil.quarter(date))).count();
|
||||
remainingNum = totalNum - count - count1;
|
||||
} else if (Objects.equals(sourceVo.getCheckPeriod(), 5)) {
|
||||
int count = (int) securityList1.stream().filter(r -> r.getInspectTime().startsWith(year) && Objects.equals(DateUtil.month(DateUtil.parseDate(r.getInspectTime())) < 6, DateUtil.month(date) < 6)).count();
|
||||
int count1 = (int) unbuilts1.stream().filter(r -> DateUtil.formatDate(r.getInspectionTime()).startsWith(year) && Objects.equals(DateUtil.month(r.getInspectionTime()) < 6, DateUtil.month(date) < 6)).count();
|
||||
remainingNum = totalNum - count - count1;
|
||||
int totalCalNum = 0;
|
||||
for (String regionId : sourceVo.getSpecificResponsibilityAreaIds().split(",")) {
|
||||
if (Objects.equals(sourceVo.getCheckPeriod(), 1)) {
|
||||
int count = (int) securityList1.stream().filter(r -> DateUtil.isSameDay(DateUtil.parseDate(r.getInspectTime()), date) && isContainRegion(r, regionId)).count();
|
||||
int count1 = (int) unbuilts1.stream().filter(r -> DateUtil.formatDate(r.getInspectionTime()).startsWith(today) && isEqualRegion(regionId, r)).count();
|
||||
totalCalNum += Math.min(count + count1, sourceVo.getCheckNum());
|
||||
} else if (Objects.equals(sourceVo.getCheckPeriod(), 2)) {
|
||||
int count = (int) securityList1.stream().filter(r -> DateUtil.isSameWeek(DateUtil.parseDate(r.getInspectTime()), date, true) && isContainRegion(r, regionId)).count();
|
||||
int count1 = (int) unbuilts1.stream().filter(r -> DateUtil.isSameWeek(r.getInspectionTime(), date, true) && isEqualRegion(regionId, r)).count();
|
||||
totalCalNum += Math.min(count + count1, sourceVo.getCheckNum());
|
||||
} else if (Objects.equals(sourceVo.getCheckPeriod(), 3)) {
|
||||
int count = (int) securityList1.stream().filter(r -> DateUtil.isSameMonth(DateUtil.parseDate(r.getInspectTime()), date) && isContainRegion(r, regionId)).count();
|
||||
int count1 = (int) unbuilts1.stream().filter(r -> DateUtil.isSameMonth(r.getInspectionTime(), date) && isEqualRegion(regionId, r)).count();
|
||||
totalCalNum += Math.min(count + count1, sourceVo.getCheckNum());
|
||||
} else if (Objects.equals(sourceVo.getCheckPeriod(), 4)) {
|
||||
int count = (int) securityList1.stream().filter(r -> r.getInspectTime().startsWith(year) && Objects.equals(DateUtil.quarter(DateUtil.parseDate(r.getInspectTime())), DateUtil.quarter(date)) && isContainRegion(r, regionId)).count();
|
||||
int count1 = (int) unbuilts1.stream().filter(r -> DateUtil.formatDate(r.getInspectionTime()).startsWith(year) && Objects.equals(DateUtil.quarter(r.getInspectionTime()), DateUtil.quarter(date)) && isEqualRegion(regionId, r)).count();
|
||||
totalCalNum += Math.min(count + count1, sourceVo.getCheckNum());
|
||||
} else if (Objects.equals(sourceVo.getCheckPeriod(), 5)) {
|
||||
int count = (int) securityList1.stream().filter(r -> r.getInspectTime().startsWith(year) && Objects.equals(DateUtil.month(DateUtil.parseDate(r.getInspectTime())) < 6, DateUtil.month(date) < 6) && isContainRegion(r, regionId)).count();
|
||||
int count1 = (int) unbuilts1.stream().filter(r -> DateUtil.formatDate(r.getInspectionTime()).startsWith(year) && Objects.equals(DateUtil.month(r.getInspectionTime()) < 6, DateUtil.month(date) < 6) && isEqualRegion(regionId, r)).count();
|
||||
totalCalNum += Math.min(count + count1, sourceVo.getCheckNum());
|
||||
}
|
||||
}
|
||||
remainingNum = totalNum - totalCalNum;
|
||||
}
|
||||
return remainingNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否相同regionId
|
||||
*
|
||||
* @param regionId
|
||||
* @param r
|
||||
* @return
|
||||
*/
|
||||
private boolean isEqualRegion(String regionId, RiskListSourceUnbuilt r) {
|
||||
return Objects.equals(Convert.toStr(r.getResponsibleRegionId()), regionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否包含regionId
|
||||
*
|
||||
* @param r
|
||||
* @param regionId
|
||||
* @return
|
||||
*/
|
||||
private boolean isContainRegion(XzSecurityQualityInspectionRecord r, String regionId) {
|
||||
return StrUtil.contains(r.getRegionIds(), regionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(RiskListSourceDto riskListSource) {
|
||||
riskListSource.setId(null);
|
||||
@ -399,7 +441,7 @@ public class RiskListSourceServiceImpl extends ServiceImpl<RiskListSourceMapper,
|
||||
Long rid = Long.valueOf(regionId);
|
||||
int remainingNum = 0;
|
||||
if (Objects.equals(source.getCheckPeriod(), 1)) {
|
||||
int count = (int) securityList.stream().filter(r -> Objects.equals(r.getEngineeringId(), source.getId()) && r.getInspectTime().startsWith(today) && Objects.nonNull(r.getRegionIds()) && r.getRegionIds().contains(rid + "")).count();
|
||||
int count = (int) securityList.stream().filter(r -> Objects.equals(r.getEngineeringId(), source.getId()) && DateUtil.isSameDay(DateUtil.parseDate(r.getInspectTime()), date) && Objects.nonNull(r.getRegionIds()) && r.getRegionIds().contains(rid + "")).count();
|
||||
int count1 = (int) unbuilts.stream().filter(r -> Objects.equals(r.getSourceId(), source.getId()) && DateUtil.formatDate(r.getInspectionTime()).startsWith(today) && Objects.equals(r.getResponsibleRegionId(), rid)).count();
|
||||
remainingNum = checkNum - count - count1;
|
||||
} else if (Objects.equals(source.getCheckPeriod(), 2)) {
|
||||
|
||||
@ -5,11 +5,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.modules.gt.entity.GtMaterialInOutWarehouse;
|
||||
import com.zhgd.xmgl.modules.worker.entity.DepartmentInfo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.TeamInfo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.vo.DepartmentAndTeamVo;
|
||||
import com.zhgd.xmgl.modules.worker.service.IDepartmentInfoService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@ -135,7 +134,7 @@ public class DepartmentInfoController {
|
||||
return Result.success(departmentInfoService.selectDepartmentDetailsList(map));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "列表查询项目下所有部门和班组信息", notes = "列表查询项目下所有部门和班组信息", httpMethod = "GET")
|
||||
@ApiOperation(value = "(不常用)列表查询项目下所有部门和班组信息", notes = "(不常用)列表查询项目下所有部门和班组信息", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "enterpriseId", value = "所属企业", paramType = "query", required = false, dataType = "String"),
|
||||
@ -151,9 +150,10 @@ public class DepartmentInfoController {
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "enterpriseId", value = "所属企业", paramType = "query", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "departmentTeamName", value = "部门或班组名称", paramType = "query", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "enterpriseIds", value = "所属企业ids(多个,分割)", paramType = "query", required = false, dataType = "String"),
|
||||
})
|
||||
@GetMapping(value = "/getDepartmentAndTeamList")
|
||||
public Result<List<Map<String, Object>>> getDepartmentAndTeamList(@RequestParam Map<String, Object> map) {
|
||||
public Result<List<DepartmentAndTeamVo>> getDepartmentAndTeamList(@RequestParam Map<String, Object> map) {
|
||||
return Result.success(departmentInfoService.getDepartmentAndTeamList(map));
|
||||
}
|
||||
}
|
||||
|
||||
@ -807,7 +807,7 @@ public class WorkerDailyAttendanceStatisticsV2Controller {
|
||||
return Result.success(workerDailyAttendanceStatisticsV2Service.countWorkerDailyAttendanceByDate(param));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "按分包单位统计人员出勤", notes = "按分包单位统计人员出勤", httpMethod = "POST")
|
||||
@ApiOperation(value = "按分包单位统计人员出勤(统计所有下级的)", notes = "按分包单位统计人员出勤(统计所有下级的)", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "startDate", value = "开始日期(yyyy-MM-dd)", paramType = "body", required = true, dataType = "String"),
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
package com.zhgd.xmgl.modules.worker.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DepartmentAndTeamVo {
|
||||
private String name;
|
||||
private String id;
|
||||
private String personNum;
|
||||
private Integer type;
|
||||
private String enterpriseName;
|
||||
|
||||
|
||||
}
|
||||
@ -82,6 +82,12 @@
|
||||
<if test="enterpriseId != null and enterpriseId != ''">
|
||||
and ti.enterprise_id=#{enterpriseId}
|
||||
</if>
|
||||
<if test="enterpriseIdList != null and enterpriseIdList.size() > 0">
|
||||
and ti.enterprise_id in
|
||||
<foreach collection="enterpriseIdList" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
)t
|
||||
</select>
|
||||
|
||||
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.gt.entity.GtMaterialInOutWarehouse;
|
||||
import com.zhgd.xmgl.modules.worker.entity.DepartmentInfo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.vo.DepartmentAndTeamVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -83,7 +84,7 @@ public interface IDepartmentInfoService extends IService<DepartmentInfo> {
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getDepartmentAndTeamList(Map<String, Object> map);
|
||||
List<DepartmentAndTeamVo> getDepartmentAndTeamList(Map<String, Object> map);
|
||||
|
||||
/**
|
||||
* 通过id查询劳务人员部门信息
|
||||
|
||||
@ -14,6 +14,7 @@ import com.zhgd.xmgl.modules.worker.entity.DepartmentInfo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.vo.AllProjectDeptVo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.vo.AllProjectTeamVo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.vo.DepartmentAndTeamVo;
|
||||
import com.zhgd.xmgl.modules.worker.mapper.DepartmentInfoMapper;
|
||||
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper;
|
||||
import com.zhgd.xmgl.modules.worker.service.IDepartmentInfoService;
|
||||
@ -76,7 +77,7 @@ public class DepartmentInfoServiceImpl extends ServiceImpl<DepartmentInfoMapper,
|
||||
if (workerManufacturer != null) {
|
||||
CompletableFuture.runAsync(() -> {
|
||||
workerManufacturer.deleteDepartmentInfo(departmentInfo);
|
||||
},threadPoolTaskExecutor);
|
||||
}, threadPoolTaskExecutor);
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,29 +172,36 @@ public class DepartmentInfoServiceImpl extends ServiceImpl<DepartmentInfoMapper,
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getDepartmentAndTeamList(Map<String, Object> map) {
|
||||
public List<DepartmentAndTeamVo> getDepartmentAndTeamList(Map<String, Object> map) {
|
||||
List<AllProjectTeamVo> allProjectTeamVoList = workerInfoMapper.selectAllProjectTeamList(map);
|
||||
List<AllProjectDeptVo> allProjectDeptVoList = workerInfoMapper.selectAllProjectDeptList(map);
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
List<DepartmentAndTeamVo> resultList = new ArrayList<>();
|
||||
for (AllProjectTeamVo allProjectTeamVo : allProjectTeamVoList) {
|
||||
Map<String, Object> map1 = new HashMap<>(16);
|
||||
map1.put("id", allProjectTeamVo.getTeamId());
|
||||
map1.put("name", allProjectTeamVo.getTeamName());
|
||||
map1.put("enterpriseName", allProjectTeamVo.getEnterpriseName());
|
||||
map1.put("personNum", allProjectTeamVo.getTotalPersonNum());
|
||||
map1.put("type", 1);
|
||||
resultList.add(map1);
|
||||
DepartmentAndTeamVo vo = new DepartmentAndTeamVo();
|
||||
vo.setName(allProjectTeamVo.getTeamName());
|
||||
vo.setId(allProjectTeamVo.getTeamId());
|
||||
vo.setPersonNum(allProjectTeamVo.getTotalPersonNum());
|
||||
vo.setType(1);
|
||||
vo.setEnterpriseName(allProjectTeamVo.getEnterpriseName());
|
||||
resultList.add(vo);
|
||||
}
|
||||
for (AllProjectDeptVo allProjectDeptVo : allProjectDeptVoList) {
|
||||
Map<String, Object> map2 = new HashMap<>(16);
|
||||
map2.put("id", allProjectDeptVo.getDeptId());
|
||||
map2.put("name", allProjectDeptVo.getDepartmentName());
|
||||
map2.put("enterpriseName", allProjectDeptVo.getEnterpriseName());
|
||||
map2.put("personNum", allProjectDeptVo.getTotalPersonNum());
|
||||
map2.put("type", 2);
|
||||
resultList.add(map2);
|
||||
DepartmentAndTeamVo vo = new DepartmentAndTeamVo();
|
||||
vo.setName(allProjectDeptVo.getDepartmentName());
|
||||
vo.setId(allProjectDeptVo.getDeptId());
|
||||
vo.setPersonNum(allProjectDeptVo.getTotalPersonNum());
|
||||
vo.setType(2);
|
||||
vo.setEnterpriseName(allProjectDeptVo.getEnterpriseName());
|
||||
resultList.add(vo);
|
||||
}
|
||||
Collections.sort(resultList, new MapComparatorAsc());
|
||||
Collections.sort(resultList, (o1, o2) -> {
|
||||
// 处理 null 值
|
||||
if (o1.getPersonNum() == null && o2.getPersonNum() == null) return 0;
|
||||
if (o1.getPersonNum() == null) return 1;
|
||||
if (o2.getPersonNum() == null) return -1;
|
||||
// 降序排序
|
||||
return o2.getPersonNum().compareTo(o1.getPersonNum());
|
||||
});
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@ -211,16 +219,4 @@ public class DepartmentInfoServiceImpl extends ServiceImpl<DepartmentInfoMapper,
|
||||
public Map<String, Object> getDepartmentInfoMapBySn(String projectSn) {
|
||||
return departmentInfoMapper.getDepartmentInfoMapBySn(projectSn);
|
||||
}
|
||||
|
||||
static class MapComparatorAsc implements Comparator<Map<String, Object>> {
|
||||
@Override
|
||||
public int compare(Map<String, Object> m1, Map<String, Object> m2) {
|
||||
Integer v1 = Integer.valueOf(m1.get("personNum").toString());
|
||||
Integer v2 = Integer.valueOf(m2.get("personNum").toString());
|
||||
if (v2 != null) {
|
||||
return v2.compareTo(v1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.zhgd.xmgl.modules.worker.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.*;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
@ -585,7 +586,9 @@ public class WorkerDailyAttendanceStatisticsV2ServiceImpl extends ServiceImpl<Wo
|
||||
Integer isSecondLevel = MapUtils.getInteger(param, "isSecondLevel");
|
||||
LambdaQueryWrapper<ProjectEnterprise> peWrap = new LambdaQueryWrapper<ProjectEnterprise>()
|
||||
.eq(ProjectEnterprise::getProjectSn, projectSn);
|
||||
List<Long> eids = projectEnterpriseService.list(peWrap).stream().filter(projectEnterprise -> {
|
||||
List<ProjectEnterprise> projectEnterprises = projectEnterpriseService.list(peWrap);
|
||||
Map<Long, Long> eid2peidMap = projectEnterprises.stream().collect(Collectors.toMap(ProjectEnterprise::getEnterpriseId, ProjectEnterprise::getId, (o1, o2) -> o1));
|
||||
List<Long> eids = projectEnterprises.stream().filter(projectEnterprise -> {
|
||||
if (Objects.nonNull(parentEnterpriseId)) {
|
||||
return Objects.equals(parentEnterpriseId, projectEnterprise.getParentEnterpriseId());
|
||||
}
|
||||
@ -600,7 +603,7 @@ public class WorkerDailyAttendanceStatisticsV2ServiceImpl extends ServiceImpl<Wo
|
||||
List<EnterpriseInfo> enterpriseInfos = enterpriseInfoService.list(queryWrapper);
|
||||
List<CountByEnterpriseVo> vos = baseMapper.countNumByEnterprise(param);
|
||||
return enterpriseInfos.stream().map(ei -> {
|
||||
int workerCount = vos.stream().filter(v -> Objects.equals(ei.getId(), v.getEnterpriseId()) || (Objects.nonNull(v.getAncestors()) && v.getAncestors().contains(ei.getId() + ""))).mapToInt(CountByEnterpriseVo::getWorkerCount).sum();
|
||||
int workerCount = vos.stream().filter(v -> Objects.equals(ei.getId(), v.getEnterpriseId()) || (Objects.nonNull(v.getAncestors()) && v.getAncestors().contains(Convert.toStr(eid2peidMap.get(ei.getId()))))).mapToInt(CountByEnterpriseVo::getWorkerCount).sum();
|
||||
CountByEnterpriseVo vo = new CountByEnterpriseVo();
|
||||
vo.setEnterpriseId(ei.getId());
|
||||
vo.setEnterpriseName(ei.getEnterpriseName());
|
||||
|
||||
@ -369,5 +369,14 @@ public class XzSecurityDangerTypeRecordController {
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询我的收藏安全库idList", notes = "查询我的收藏安全库idList")
|
||||
@PostMapping(value = "/getCollectProjectClassifyTypeRecords")
|
||||
public Result<List<Long>> getCollectProjectClassifyTypeRecords(@ApiIgnore @RequestBody HashMap<String, Object> param) throws Exception {
|
||||
Long userId = SecurityUtils.getUser().getUserId();
|
||||
List<Long> idList = xzSecurityDangerTypeRecordCollectService.list(new LambdaQueryWrapper<XzSecurityDangerTypeRecordCollect>()
|
||||
.eq(XzSecurityDangerTypeRecordCollect::getUserId, userId)).stream().map(XzSecurityDangerTypeRecordCollect::getXzSecurityDangerTypeRecordId).collect(Collectors.toList());
|
||||
return Result.success(idList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -559,8 +559,7 @@ public class XzSecurityQualityInspectionRecordController {
|
||||
add.setType(10);
|
||||
qualityInspectionRecordService.saveQualityInspectionRecord(add);
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(addDto.getRegionPointList())) {
|
||||
} else if (CollUtil.isNotEmpty(addDto.getRegionPointList())) {
|
||||
for (XzSecurityQualityInspectionRecordSourceAddDto.RegionPoint regionPoint : addDto.getRegionPointList()) {
|
||||
List<RiskListSourceVo> sourceVos = riskListSourceService.queryList(new MapBuilder<String, Object>()
|
||||
.put("pointId", regionPoint.getPointId())
|
||||
@ -690,14 +689,14 @@ public class XzSecurityQualityInspectionRecordController {
|
||||
objectMap.put("no", i + 1);
|
||||
byte[] bytes = new byte[0];
|
||||
try {
|
||||
bytes = cn.hutool.core.io.FileUtil.readBytes(PathUtil.getBasePath() + "/" + vo.getImageUrl());
|
||||
bytes = cn.hutool.core.io.FileUtil.readBytes(FileUtils.urlToFilePath(vo.getImageUrl()));
|
||||
} catch (Exception e) {
|
||||
} finally {
|
||||
imageBytesList.add(bytes);
|
||||
}
|
||||
bytes = new byte[0];
|
||||
try {
|
||||
bytes = cn.hutool.core.io.FileUtil.readBytes(PathUtil.getBasePath() + "/" + vo.getRectifyAfterImage());
|
||||
bytes = cn.hutool.core.io.FileUtil.readBytes(FileUtils.urlToFilePath(vo.getRectifyAfterImage()));
|
||||
} catch (Exception e) {
|
||||
} finally {
|
||||
rectifyAfterImageBytesList.add(bytes);
|
||||
|
||||
@ -138,6 +138,9 @@ public class XzSecurityDangerFieldServiceImpl extends ServiceImpl<XzSecurityDang
|
||||
if (Objects.equals(companyProjectType, 2) && CollUtil.isEmpty(list)) {
|
||||
//项目不存在,查询企业配置
|
||||
list = this.getCompanyConfigs(sn);
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
list = JSON.parseArray(ResourceUtil.readUtf8Str("init/data/xzSecurityDangerField.json"), XzSecurityDangerFieldVo.class);
|
||||
}
|
||||
list = list.stream().filter(o -> Objects.equals(o.getRecordType(), recordType)).collect(Collectors.toList());
|
||||
for (XzSecurityDangerFieldVo fieldVo : list) {
|
||||
fieldVo.setCompanyProjectType(companyProjectType);
|
||||
@ -191,8 +194,8 @@ public class XzSecurityDangerFieldServiceImpl extends ServiceImpl<XzSecurityDang
|
||||
reviewVerify.setSn(sn);
|
||||
reviewVerify.setCompanyProjectType(companyProjectType);
|
||||
}
|
||||
reviewVerify.setEnableReview(fieldReview.getIsEnabled());
|
||||
reviewVerify.setEnableVerify(fieldVerify.getIsEnabled());
|
||||
reviewVerify.setEnableReview(Objects.nonNull(fieldReview) ? fieldReview.getIsEnabled() : 1);
|
||||
reviewVerify.setEnableVerify(Objects.nonNull(fieldVerify) ? fieldVerify.getIsEnabled() : 1);
|
||||
if (reviewVerify.getId() == null) {
|
||||
xzSecurityDangerReviewVerifyService.save(reviewVerify);
|
||||
} else {
|
||||
|
||||
@ -2,7 +2,6 @@ package com.zhgd.xmgl.util;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import lombok.Data;
|
||||
@ -26,11 +25,6 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
public class FileUtils {
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
log.info(JSONUtil.toJsonStr(getFileNameList("D:/itbgpImage/", "2021-12-20 00:00:00", "2021-12-25 00:00:00")));
|
||||
}
|
||||
|
||||
public static List<String> getFileNameList(String path, String statrTIme, String endTime) {
|
||||
List<File> newfileList = new ArrayList<>();
|
||||
List<File> filesList = getFilesList(path, newfileList);
|
||||
@ -162,6 +156,31 @@ public class FileUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* url(如:xxx*xxxx,xxx*xxxx,[],xxx.jpg等等)转换成本地路径
|
||||
*
|
||||
* @param fileUrl
|
||||
* @return
|
||||
*/
|
||||
public static String urlToFilePath(String fileUrl) {
|
||||
List<FileObj> fileObjs = parseUrlString(fileUrl);
|
||||
if (CollUtil.isEmpty(fileObjs)) {
|
||||
return null;
|
||||
}
|
||||
String fileUrl1 = fileObjs.get(0).getFileUrl();
|
||||
if (fileUrl1.contains("http") || fileUrl1.contains("https")) {
|
||||
fileUrl1 = StringUtils.substringAfter(fileUrl1, "/image/");
|
||||
}
|
||||
return PathUtil.getBasePath() + "/" + fileUrl1;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(urlToFilePath("图片2.png*http://jxj.zhgdyun.com:21000/image/68afb689e6ca0a85c0ef03dd.png"));
|
||||
System.out.println(urlToFilePath("68afb8b6e6ca0a85c0ef03de.png*68afb8b6e6ca0a85c0ef03de.png"));
|
||||
System.out.println(urlToFilePath("68afb8b6e6ca0a85c0ef03de.png"));
|
||||
System.out.println(urlToFilePath("68afb8b6e6ca0a85c0ef03de.png,123.png"));
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class FileJsonObj {
|
||||
private String name;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user