Merge branch 'mod_security' into prod
This commit is contained in:
commit
38c35543a0
@ -118,9 +118,6 @@ public class QualityRegion implements Serializable {
|
||||
@ApiModelProperty(value = "安全风险排查责任人s")
|
||||
private java.lang.String securityRiskAssessors;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<QualityRegion> children;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "最外面的设置的责任单位")
|
||||
private List<EnterpriseInfo> enterpriseInfos;
|
||||
|
||||
@ -1,30 +1,33 @@
|
||||
package com.zhgd.xmgl.modules.quality.entity.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.zhgd.xmgl.modules.quality.entity.QualityRegion;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class QualityRegionVo extends QualityRegion {
|
||||
/**
|
||||
* 责任单位名称s
|
||||
* 安全责任单位名称s
|
||||
*/
|
||||
@ApiModelProperty(value = "责任单位名称s")
|
||||
@ApiModelProperty(value = "安全责任单位名称s")
|
||||
private java.lang.String enterpriseNames;
|
||||
/**
|
||||
* 整改人名称s
|
||||
* 安全整改人名称s
|
||||
*/
|
||||
@ApiModelProperty(value = "整改人名称s")
|
||||
@ApiModelProperty(value = "安全整改人名称s")
|
||||
private java.lang.String dutyNames;
|
||||
/**
|
||||
* 复查人名称s
|
||||
* 安全复查人名称s
|
||||
*/
|
||||
@ApiModelProperty(value = "复查人名称s")
|
||||
@ApiModelProperty(value = "安全复查人名称s")
|
||||
private java.lang.String reviewNames;
|
||||
/**
|
||||
* 风险排查责任人名称s
|
||||
* 安全风险排查责任人名称s
|
||||
*/
|
||||
@ApiModelProperty(value = "风险排查责任人名称s")
|
||||
@ApiModelProperty(value = "安全风险排查责任人名称s")
|
||||
private java.lang.String riskAssessorNames;
|
||||
/**
|
||||
* 全路径名(/划分)
|
||||
@ -42,4 +45,6 @@ public class QualityRegionVo extends QualityRegion {
|
||||
@ApiModelProperty(value = "管控清单风险点我的待办数量(落实或隐患都共用)")
|
||||
private java.lang.Integer riskListPointTodoNum;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<QualityRegionVo> children;
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.zhgd.xmgl.modules.quality.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zhgd.annotation.DataScope;
|
||||
import com.zhgd.xmgl.modules.quality.entity.QualityRegion;
|
||||
import com.zhgd.xmgl.modules.quality.entity.vo.QualityRegionVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@ -26,7 +25,7 @@ public interface QualityRegionMapper extends BaseMapper<QualityRegion> {
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@DataScope(includeTable = "enterprise_info")
|
||||
// @DataScope(includeTable = "enterprise_info")
|
||||
List<QualityRegionVo> queryList(Map<String, Object> map);
|
||||
|
||||
/**
|
||||
|
||||
@ -200,25 +200,6 @@ public class QualityRegionServiceImpl extends ServiceImpl<QualityRegionMapper, Q
|
||||
return list;
|
||||
}
|
||||
|
||||
private List<QualityRegion> groupList(List<QualityRegion> list, List<QualityRegion> childList) {
|
||||
for (QualityRegion map1 : list) {
|
||||
List<QualityRegion> tempList = new ArrayList<>();
|
||||
List<QualityRegion> list2 = new ArrayList<>();
|
||||
for (QualityRegion map2 : childList) {
|
||||
if (map1.getId().equals(map2.getParentRegion())) {
|
||||
tempList.add(map2);
|
||||
} else {
|
||||
list2.add(map2);
|
||||
}
|
||||
}
|
||||
if (list2.size() > 0) {
|
||||
tempList = groupList(tempList, list2);
|
||||
}
|
||||
map1.setChildren(tempList);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addQualityRegion(QualityRegion qualityRegion) {
|
||||
if (qualityRegion.getParentRegion() == null) {
|
||||
|
||||
@ -6,6 +6,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gexin.fastjson.serializer.SerializerFeature;
|
||||
@ -43,6 +44,7 @@ import org.simpleframework.xml.core.Validate;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
@ -335,4 +337,17 @@ public class RiskListPointController {
|
||||
return Result.success(vo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量从月度清单移除管控清单风险点", notes = "批量从月度清单移除管控清单风险点", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "ids", value = "管控清单风险点ID字符串(多个以,分割)", paramType = "body", required = true, dataType = "String")
|
||||
@PostMapping(value = "/delFromMonthlyBatch")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result delFromMonthlyBatch(@ApiIgnore @RequestBody HashMap<String, Object> param) {
|
||||
String ids = MapUtils.getString(param, "ids");
|
||||
if (StrUtil.isNotBlank(ids)) {
|
||||
riskListPointService.update(new LambdaUpdateWrapper<RiskListPoint>()
|
||||
.set(RiskListPoint::getMonthlyId, null)
|
||||
.in(RiskListPoint::getId, StrUtil.split(ids, ",")));
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,7 +11,6 @@ import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -505,7 +504,7 @@ public class RiskListSourceDataCenterController {
|
||||
return null;
|
||||
}
|
||||
Map<String, Map<Integer, Optional<RiskListSourceVo>>> collect = sourceVos.stream()
|
||||
.peek(vo -> vo.setRiskVal(getRiskVal(vo)))
|
||||
.peek(vo -> vo.setRiskVal(riskListSourceService.calRiskVal(vo)))
|
||||
.collect(Collectors.groupingBy(
|
||||
RiskListSourceVo::getListLibraryName,
|
||||
Collectors.groupingBy(
|
||||
@ -561,37 +560,6 @@ public class RiskListSourceDataCenterController {
|
||||
return Result.success(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取风险值
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
private BigDecimal getRiskVal(RiskListSourceVo vo) {
|
||||
if (vo.getRiskAssessmentCalculator() == null) {
|
||||
return null;
|
||||
}
|
||||
BigDecimal decimal = null;
|
||||
JSONObject jsonObject;
|
||||
switch (vo.getRiskAssessmentCalculator()) {
|
||||
case 1:
|
||||
jsonObject = JSON.parseObject(vo.getLecdData());
|
||||
decimal = NumberUtil.mul(jsonObject.getDouble("lNumber"), jsonObject.getDouble("eNumber"), jsonObject.getDouble("cNumber"));
|
||||
break;
|
||||
case 2:
|
||||
decimal = Convert.toBigDecimal(vo.getDirectDeterminationMethodData());
|
||||
break;
|
||||
case 3:
|
||||
jsonObject = JSON.parseObject(vo.getLcdData());
|
||||
decimal = NumberUtil.mul(jsonObject.getDouble("lNumber"), jsonObject.getDouble("cNumber"), 1);
|
||||
break;
|
||||
case 4:
|
||||
jsonObject = JSON.parseObject(vo.getLsrData());
|
||||
decimal = NumberUtil.mul(jsonObject.getDouble("lNumber"), jsonObject.getDouble("sNumber"), 1);
|
||||
break;
|
||||
}
|
||||
return decimal;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -121,14 +121,19 @@ public class RiskListPoint implements Serializable {
|
||||
@ApiModelProperty(value = "1动态风险2静态风险")
|
||||
private java.lang.Integer dynamicType;
|
||||
@ApiModelProperty(value = "设备设施属性")
|
||||
private java.lang.String equipmentFacilityAttribute;
|
||||
@ApiModelProperty(value = "所在位置")
|
||||
private java.lang.String location;
|
||||
@ApiModelProperty(value = "型号")
|
||||
private java.lang.String model;
|
||||
/**
|
||||
* 月度清单id
|
||||
*/
|
||||
@ApiModelProperty(value = "月度清单id")
|
||||
private java.lang.Long monthlyId;
|
||||
private java.lang.String equipmentFacilityAttribute;
|
||||
@ApiModelProperty(value = "所在位置")
|
||||
private java.lang.String location;
|
||||
@ApiModelProperty(value = "型号")
|
||||
private java.lang.String model;
|
||||
/**
|
||||
* 月度清单id
|
||||
*/
|
||||
@ApiModelProperty(value = "月度清单id")
|
||||
private java.lang.Long monthlyId;
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
private java.lang.String specificationsModel;
|
||||
}
|
||||
|
||||
@ -12,9 +12,9 @@ public class RiskListPointVo extends RiskListPoint {
|
||||
@ApiModelProperty(value = "危险源数")
|
||||
private java.lang.Integer hazardSourceNumber;
|
||||
/**
|
||||
* 我的待办的危险源数
|
||||
* 我的待办的危险源数(未排查)
|
||||
*/
|
||||
@ApiModelProperty(value = "我的待办的危险源数")
|
||||
@ApiModelProperty(value = "我的待办的危险源数(未排查)")
|
||||
private java.lang.Integer hazardSourceNumberTodo;
|
||||
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ public class RiskListSourceVo extends RiskListSource {
|
||||
/**
|
||||
* 风险值
|
||||
*/
|
||||
@JsonIgnore
|
||||
@ApiModelProperty(value = "风险值")
|
||||
private BigDecimal riskVal;
|
||||
/**
|
||||
* 应排查数量
|
||||
|
||||
@ -9,6 +9,7 @@ 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;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@ -77,4 +78,11 @@ public interface IRiskListSourceService extends IService<RiskListSource> {
|
||||
|
||||
List<SectorOneVo> countRisksByLibrary(HashMap<String, Object> map);
|
||||
|
||||
/**
|
||||
* 计算风险值
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
BigDecimal calRiskVal(RiskListSourceVo vo);
|
||||
}
|
||||
|
||||
@ -3,7 +3,10 @@ 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.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
@ -41,6 +44,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;
|
||||
@ -130,9 +134,12 @@ public class RiskListSourceServiceImpl extends ServiceImpl<RiskListSourceMapper,
|
||||
param.put("regionIdList", StrUtil.split(regionIds, ","));
|
||||
}
|
||||
Integer isMySourceToDo = MapUtils.getInteger(param, "isMySourceToDo");
|
||||
String today = DateUtil.today() + " 00:00:00";
|
||||
if (Objects.equals(isMySourceToDo, 1)) {
|
||||
param.put("checkWorkerId", SecurityUtils.getUser().getUserId());
|
||||
param.put("allowGenerateTask", 1);
|
||||
param.put("effectiveTimeBegin_end", today);
|
||||
param.put("effectiveTimeEnd_begin", today);
|
||||
}
|
||||
Integer isMySourceToDoForWorkable = MapUtils.getInteger(param, "isMySourceToDoForWorkable");
|
||||
if (Objects.equals(isMySourceToDoForWorkable, 1)) {
|
||||
@ -186,6 +193,7 @@ public class RiskListSourceServiceImpl extends ServiceImpl<RiskListSourceMapper,
|
||||
}
|
||||
sourceVo.setUnWorkableAreaIdList(unWorkableAreaIdList);
|
||||
sourceVo.setUnCheckAreaIdList(getUnCheckAreaIdList(securityList, unbuilts, sourceVo));
|
||||
sourceVo.setRiskVal(this.calRiskVal(sourceVo));
|
||||
}
|
||||
Integer isMySourceToDo = MapUtils.getInteger(param, "isMySourceToDo");
|
||||
Integer isMySourceToDoForWorkable = MapUtils.getInteger(param, "isMySourceToDoForWorkable");
|
||||
@ -443,4 +451,30 @@ public class RiskListSourceServiceImpl extends ServiceImpl<RiskListSourceMapper,
|
||||
return baseMapper.countRisksByLibrary(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal calRiskVal(RiskListSourceVo vo) {
|
||||
if (vo.getRiskAssessmentCalculator() == null) {
|
||||
return null;
|
||||
}
|
||||
BigDecimal decimal = null;
|
||||
JSONObject jsonObject;
|
||||
switch (vo.getRiskAssessmentCalculator()) {
|
||||
case 1:
|
||||
jsonObject = JSON.parseObject(vo.getLecdData());
|
||||
decimal = NumberUtil.mul(jsonObject.getDouble("lNumber"), jsonObject.getDouble("eNumber"), jsonObject.getDouble("cNumber"));
|
||||
break;
|
||||
case 2:
|
||||
decimal = Convert.toBigDecimal(vo.getDirectDeterminationMethodData());
|
||||
break;
|
||||
case 3:
|
||||
jsonObject = JSON.parseObject(vo.getLcdData());
|
||||
decimal = NumberUtil.mul(jsonObject.getDouble("lNumber"), jsonObject.getDouble("cNumber"), 1);
|
||||
break;
|
||||
case 4:
|
||||
jsonObject = JSON.parseObject(vo.getLsrData());
|
||||
decimal = NumberUtil.mul(jsonObject.getDouble("lNumber"), jsonObject.getDouble("sNumber"), 1);
|
||||
break;
|
||||
}
|
||||
return decimal;
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,10 +31,7 @@ import com.zhgd.xmgl.modules.worker.entity.vo.PresentDayByMonthVo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.vo.SafetyPerformanceAnalysisVo;
|
||||
import com.zhgd.xmgl.modules.worker.service.*;
|
||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
import com.zhgd.xmgl.util.EasyPoiUtil;
|
||||
import com.zhgd.xmgl.util.ExcelUtils;
|
||||
import com.zhgd.xmgl.util.Fileutils;
|
||||
import com.zhgd.xmgl.util.MapBuilder;
|
||||
import com.zhgd.xmgl.util.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
@ -563,6 +560,7 @@ public class WorkerAttendanceController {
|
||||
param.put("pageSize", -1);
|
||||
List<WorkerAttendanceVo> records = workerAttendanceService.selectWorkerAttendancePage(param).getRecords();
|
||||
List<Map<String, Object>> listMap = new ArrayList<>();
|
||||
ArrayList<byte[]> imageBytesList = new ArrayList<>();
|
||||
for (int i = 0; i < records.size(); i++) {
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
WorkerAttendanceVo vo = records.get(i);
|
||||
@ -573,7 +571,7 @@ public class WorkerAttendanceController {
|
||||
objectMap.put("createTime", vo.getCreateTime());
|
||||
objectMap.put("projectSn", vo.getProjectSn());
|
||||
objectMap.put("cardType", getType(vo.getCardType()));
|
||||
objectMap.put("imageUrl", EasyPoiUtil.getImageEntityByXls(vo.getImageUrl()));
|
||||
// objectMap.put("imageUrl", EasyPoiUtil.getImageEntityByXls(vo.getImageUrl()));
|
||||
objectMap.put("attendanceType", vo.getAttendanceType());
|
||||
objectMap.put("passagewayName", vo.getPassagewayName());
|
||||
objectMap.put("attendanceStatus", vo.getAttendanceStatus());
|
||||
@ -593,12 +591,20 @@ public class WorkerAttendanceController {
|
||||
objectMap.put("departmentTeamName", vo.getDepartmentTeamName());
|
||||
objectMap.put("mockTime", vo.getMockTime());
|
||||
objectMap.put("enterpriseName", vo.getEnterpriseName());
|
||||
byte[] bytes = new byte[0];
|
||||
try {
|
||||
bytes = cn.hutool.core.io.FileUtil.readBytes(PathUtil.getBasePath() + "/" + vo.getImageUrl());
|
||||
} catch (Exception e) {
|
||||
} finally {
|
||||
imageBytesList.add(bytes);
|
||||
}
|
||||
listMap.add(objectMap);
|
||||
}
|
||||
map.put("listMap", listMap);
|
||||
templateUrl = Fileutils.getExportTemplateFile("excel/人员考勤记录导出.xlsx").getAbsolutePath();
|
||||
TemplateExportParams params = new TemplateExportParams(templateUrl);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(params, map);
|
||||
ExcelUtils.exportPicture(workbook, 0, imageBytesList, 1, 8, 1);
|
||||
ExcelUtils.downLoadExcel("风险点清单导出模板.xlsx", response, workbook);
|
||||
} catch (IOException e) {
|
||||
log.error("", e);
|
||||
|
||||
@ -55,7 +55,6 @@ import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
@ -186,6 +185,7 @@ public class WorkerDailyAttendanceStatisticsV2Controller {
|
||||
@ApiImplicitParam(name = "month", value = "月份yyyy-MM", paramType = "query", required = false, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "startTime", value = "开始时间yyyy-MM-dd", paramType = "body", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "endTime", value = "结束时间yyyy-MM-dd", paramType = "body", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "containEnterpriseId", value = "包含下级的单位的人员的单位id", paramType = "body", required = false, dataType = "String"),
|
||||
})
|
||||
@GetMapping(value = "/countDailyAttendanceByDateRange")
|
||||
public Result<IPage<StatisticsListVo>> countDailyAttendanceByDateRange(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
@ -419,7 +419,7 @@ public class WorkerDailyAttendanceStatisticsV2Controller {
|
||||
workbook.getSheetAt(0).addMergedRegion(new CellRangeAddress(0, 0, 0, 4 + listVoList.get(0).getDailyHourMap().size()));
|
||||
workbook.getSheetAt(0).addMergedRegion(new CellRangeAddress(1, 1, 0, 4 + listVoList.get(0).getDailyHourMap().size()));
|
||||
ExcelUtils.downLoadExcel("考勤工时统计表.xlsx", response, workbook);
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
log.error("", e);
|
||||
throw new OpenAlertException("系统错误");
|
||||
} finally {
|
||||
@ -479,7 +479,7 @@ public class WorkerDailyAttendanceStatisticsV2Controller {
|
||||
params.setColForEach(true);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(params, map);
|
||||
ExcelUtils.downLoadExcel("考勤异常工时统计表.xlsx", response, workbook);
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
log.error("", e);
|
||||
throw new OpenAlertException("系统错误");
|
||||
} finally {
|
||||
@ -756,7 +756,7 @@ public class WorkerDailyAttendanceStatisticsV2Controller {
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(root, params);
|
||||
//设置下拉
|
||||
ExcelUtils.downLoadExcel(tempSheetName, response, workbook);
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
log.error("", e);
|
||||
throw new OpenAlertException("系统错误");
|
||||
} finally {
|
||||
@ -1184,7 +1184,7 @@ public class WorkerDailyAttendanceStatisticsV2Controller {
|
||||
}
|
||||
ExcelUtils.downLoadExcel(tempSheetName, response, workbook);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
log.error("", e);
|
||||
throw new OpenAlertException("系统错误");
|
||||
} finally {
|
||||
|
||||
@ -48,9 +48,9 @@
|
||||
and create_time>=current_date group by person_sn ) wa on wa.person_sn = a.person_sn
|
||||
</if>
|
||||
WHERE 1 = 1
|
||||
<if test="param.workerTypeId != null and param.workerTypeId != ''">
|
||||
and b.worker_type_id = #{param.workerTypeId}
|
||||
</if>
|
||||
<if test="param.workerTypeId != null and param.workerTypeId != ''">
|
||||
and b.worker_type_id = #{param.workerTypeId}
|
||||
</if>
|
||||
<if test="param.attendanceGroupV2Id != null and param.attendanceGroupV2Id != ''">
|
||||
and a.attendance_group_v2_id = #{param.attendanceGroupV2Id}
|
||||
</if>
|
||||
|
||||
@ -587,7 +587,7 @@ public class WorkerDailyAttendanceStatisticsV2ServiceImpl extends ServiceImpl<Wo
|
||||
.eq(ProjectEnterprise::getProjectSn, projectSn);
|
||||
List<Long> eids = projectEnterpriseService.list(peWrap).stream().filter(projectEnterprise -> {
|
||||
if (Objects.nonNull(parentEnterpriseId)) {
|
||||
return Objects.equals(parentEnterpriseId, projectEnterprise.getEnterpriseId());
|
||||
return Objects.equals(parentEnterpriseId, projectEnterprise.getParentEnterpriseId());
|
||||
}
|
||||
if (Objects.equals(isSecondLevel, 1)) {
|
||||
return StrUtil.split(projectEnterprise.getAncestors(), ",").size() == 2;
|
||||
@ -600,8 +600,9 @@ 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.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(ei.getId() + ""))).mapToInt(CountByEnterpriseVo::getWorkerCount).sum();
|
||||
CountByEnterpriseVo vo = new CountByEnterpriseVo();
|
||||
vo.setEnterpriseId(ei.getId());
|
||||
vo.setEnterpriseName(ei.getEnterpriseName());
|
||||
vo.setWorkerCount(workerCount);
|
||||
return vo;
|
||||
|
||||
@ -12,15 +12,16 @@ import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.basicdata.constant.DictionaryConstant;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.DictionaryItem;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.IDictionaryItemService;
|
||||
import com.zhgd.xmgl.modules.xz.security.entity.XzSecurityDangerItemRecord;
|
||||
import com.zhgd.xmgl.modules.xz.security.entity.XzSecurityDangerTypeRecord;
|
||||
import com.zhgd.xmgl.modules.xz.security.entity.XzSecurityDangerTypeRecordCollect;
|
||||
import com.zhgd.xmgl.modules.xz.security.entity.vo.TopProjectClassifyTypeRecordTreeVo;
|
||||
import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityDangerItemRecordService;
|
||||
import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityDangerTypeRecordCollectService;
|
||||
import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityDangerTypeRecordService;
|
||||
import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityProjectDangerTypeDisableService;
|
||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
import com.zhgd.xmgl.util.ListUtils;
|
||||
import com.zhgd.xmgl.util.MapBuilder;
|
||||
import com.zhgd.xmgl.util.MapUtil;
|
||||
import com.zhgd.xmgl.util.MessageUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -46,10 +47,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@ -75,6 +73,9 @@ public class XzSecurityDangerTypeRecordController {
|
||||
private IDictionaryItemService dictionaryItemService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IXzSecurityProjectDangerTypeDisableService xzSecurityProjectDangerTypeDisableService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IXzSecurityDangerItemRecordService dangerItemRecordService;
|
||||
|
||||
/**
|
||||
@ -184,8 +185,25 @@ public class XzSecurityDangerTypeRecordController {
|
||||
@ApiImplicitParam(name = "recordStatus", value = "记录状态,0 启用,1禁用", paramType = "body", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/updateDangerTypeRecordUsable")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result updateDangerTypeRecordUsable(@RequestBody Map<String, Object> map) {
|
||||
dangerTypeRecordService.updateDangerTypeRecordUsable(map);
|
||||
List<DictionaryItem> projectTypeList = dictionaryItemService.getDictList(DictionaryConstant.RISK_LIST_PROJECT_TYPE, null);
|
||||
String id = MapUtils.getString(map, "id");
|
||||
String projectSn = MapUtils.getString(map, "projectSn");
|
||||
Optional<DictionaryItem> first = projectTypeList.stream().filter(item -> Objects.equals(item.getData(), id)).findFirst();
|
||||
if (first.isPresent()) {
|
||||
List<XzSecurityDangerTypeRecord> typeRecords = dangerTypeRecordService.getEnableList(projectSn);
|
||||
String projectClassify = first.get().getData();
|
||||
typeRecords.stream().filter(r -> Objects.equals(r.getParentId(), 0L) && Objects.equals(r.getProjectClassify(), projectClassify)).forEach(record -> {
|
||||
dangerTypeRecordService.updateDangerTypeRecordUsable(new MapBuilder<String, Object>()
|
||||
.put("id", record.getId())
|
||||
.put("projectSn", projectSn)
|
||||
.put("recordStatus", map.get("recordStatus"))
|
||||
.build());
|
||||
});
|
||||
} else {
|
||||
dangerTypeRecordService.updateDangerTypeRecordUsable(map);
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ -267,7 +285,7 @@ public class XzSecurityDangerTypeRecordController {
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "sn", value = "总公司企业sn", paramType = "body", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "projectClassify", value = "工程类别(字典值)", paramType = "body", required = false, dataType = "String"),
|
||||
// @ApiImplicitParam(name = "name", value = "名称", paramType = "body", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "name", value = "名称", paramType = "body", required = false, dataType = "String"),
|
||||
})
|
||||
@GetMapping(value = "/getTopProjectClassifyTypeRecordTree")
|
||||
public Result<List<TopProjectClassifyTypeRecordTreeVo>> getTopProjectClassifyTypeRecordTree(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
@ -304,73 +322,45 @@ public class XzSecurityDangerTypeRecordController {
|
||||
@ApiOperation(value = "树形列表查询项目的安全库大项子项(工程类别(字典值)顶级)", notes = "树形列表查询项目的安全库大项子项(工程类别(字典值)顶级)", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目唯一标识", paramType = "body", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "content", value = "安全问题库子项内容", paramType = "body", required = false, dataType = "String"),
|
||||
})
|
||||
@GetMapping(value = "/getTopProjectClassifyTypeRecordDetailTree")
|
||||
public Result<List<TopProjectClassifyTypeRecordTreeVo>> getTopProjectClassifyTypeRecordDetailTree(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
String itemRecordContent = MapUtils.getString(param, "itemRecordContent");
|
||||
List<TopProjectClassifyTypeRecordTreeVo> records;
|
||||
if (StrUtil.isNotBlank(itemRecordContent)) {
|
||||
records = dangerItemRecordService.selectDangerItemRecordList(param).stream().map(r -> {
|
||||
TopProjectClassifyTypeRecordTreeVo vo = new TopProjectClassifyTypeRecordTreeVo();
|
||||
vo.setId(r.getId());
|
||||
vo.setParentId(r.getDangerTypeId());
|
||||
vo.setName(r.getPriorityName());
|
||||
vo.setLevel(r.getLevel());
|
||||
vo.setPriorityName(r.getPriorityName());
|
||||
vo.setChangeLimit(r.getChangeLimit());
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
} else {
|
||||
String projectClassify = MapUtils.getString(param, "projectClassify");
|
||||
String projectSn = MapUtils.getString(param, "projectSn");
|
||||
List<DictionaryItem> projectTypeList = dictionaryItemService.getDictList(DictionaryConstant.RISK_LIST_PROJECT_TYPE, null);
|
||||
if (StrUtil.isNotBlank(projectClassify)) {
|
||||
projectTypeList = projectTypeList.stream().filter(dictionaryItem -> Objects.equals(dictionaryItem.getData(), projectClassify)).collect(Collectors.toList());
|
||||
String projectClassify = MapUtils.getString(param, "projectClassify");
|
||||
String projectSn = MapUtils.getString(param, "projectSn");
|
||||
List<TopProjectClassifyTypeRecordTreeVo> records = new ArrayList<>();
|
||||
List<XzSecurityDangerTypeRecord> typeRecords = dangerTypeRecordService.getEnableList(projectSn);
|
||||
Map<String, List<XzSecurityDangerTypeRecord>> pcMap = typeRecords.stream().filter(r -> Objects.equals(r.getParentId(), 0L)).collect(Collectors.groupingBy(XzSecurityDangerTypeRecord::getProjectClassify));
|
||||
List<DictionaryItem> projectTypeList = dictionaryItemService.getDictList(DictionaryConstant.RISK_LIST_PROJECT_TYPE, null);
|
||||
List<TopProjectClassifyTypeRecordTreeVo> items = projectTypeList.stream().map(r -> {
|
||||
TopProjectClassifyTypeRecordTreeVo vo = new TopProjectClassifyTypeRecordTreeVo();
|
||||
vo.setId(Long.valueOf(r.getData()));
|
||||
vo.setParentId(0L);
|
||||
vo.setName(r.getName());
|
||||
vo.setProjectClassify(r.getData());
|
||||
vo.setRecordStatus(Optional.ofNullable(pcMap.get(r.getData())).map(m -> m.stream().allMatch(r1 -> Objects.equals(r1.getRecordStatus(), 1)) ? 1 : 0).orElse(0));
|
||||
vo.setOrderSort(0);
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
records.addAll(items);
|
||||
List<TopProjectClassifyTypeRecordTreeVo> recordVos = typeRecords.stream().map(r -> {
|
||||
TopProjectClassifyTypeRecordTreeVo vo = BeanUtil.toBean(r, TopProjectClassifyTypeRecordTreeVo.class);
|
||||
vo.setName(r.getDangerName());
|
||||
if (vo.getParentId() == 0L) {
|
||||
vo.setParentId(Convert.toLong(r.getProjectClassify()));
|
||||
}
|
||||
List<TopProjectClassifyTypeRecordTreeVo> items = projectTypeList.stream().map(r -> {
|
||||
TopProjectClassifyTypeRecordTreeVo vo = new TopProjectClassifyTypeRecordTreeVo();
|
||||
vo.setId(Long.valueOf(r.getData()));
|
||||
vo.setParentId(0L);
|
||||
vo.setName(r.getName());
|
||||
vo.setProjectClassify(r.getData());
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
records = dangerTypeRecordService.getEnableList(projectSn).stream().map(r -> {
|
||||
TopProjectClassifyTypeRecordTreeVo vo = BeanUtil.toBean(r, TopProjectClassifyTypeRecordTreeVo.class);
|
||||
vo.setName(r.getDangerName());
|
||||
if (vo.getParentId() == 0L) {
|
||||
vo.setParentId(Convert.toLong(r.getProjectClassify()));
|
||||
}
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
records.addAll(items);
|
||||
List<Long> typeIds = records.stream().map(TopProjectClassifyTypeRecordTreeVo::getId).collect(Collectors.toList());
|
||||
typeIds.add(0L);
|
||||
List<TopProjectClassifyTypeRecordTreeVo> itemRecords = dangerItemRecordService.list(new LambdaQueryWrapper<XzSecurityDangerItemRecord>()
|
||||
.in(XzSecurityDangerItemRecord::getDangerTypeId, typeIds)
|
||||
).stream().map(r -> {
|
||||
TopProjectClassifyTypeRecordTreeVo vo = new TopProjectClassifyTypeRecordTreeVo();
|
||||
vo.setId(r.getId());
|
||||
vo.setParentId(r.getDangerTypeId());
|
||||
vo.setName(r.getContent());
|
||||
vo.setLevel(r.getLevel());
|
||||
vo.setPriorityName(r.getPriorityName());
|
||||
vo.setChangeLimit(r.getChangeLimit());
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
records.addAll(itemRecords);
|
||||
vo.setRecordStatus(r.getRecordStatus());
|
||||
vo.setOrderSort(r.getOrderSort());
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
records.addAll(recordVos);
|
||||
if (StrUtil.isNotBlank(projectClassify)) {
|
||||
records = records.stream().filter(r -> Objects.equals(r.getProjectClassify(), projectClassify)).collect(Collectors.toList());
|
||||
}
|
||||
records = records.stream().sorted(Comparator.comparing(TopProjectClassifyTypeRecordTreeVo::getId)).collect(Collectors.toList());
|
||||
List<TopProjectClassifyTypeRecordTreeVo> vos = BeanUtil.copyToList(ListUtils.listToTree(JSONArray.parseArray(JSON.toJSONString(records)), "id", "parentId", "children"), TopProjectClassifyTypeRecordTreeVo.class);
|
||||
return Result.success(vos);
|
||||
}
|
||||
|
||||
// @ApiOperation(value = "查询我收藏的安全库(工程类别(字典值)顶级)", notes = "查询我收藏的安全库(工程类别(字典值)顶级)", httpMethod = "GET")
|
||||
// @GetMapping(value = "/getMyCollectProjectClassifyTypeRecords")
|
||||
// public Result<List<Long>> getMyCollectProjectClassifyTypeRecords(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
// return Result.success(null);
|
||||
// }
|
||||
|
||||
@ApiOperation(value = "收藏安全库", notes = "收藏安全库")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "idList", value = "安全库(工程类别(字典值)idList", paramType = "body", required = true, dataType = "String"),
|
||||
|
||||
@ -1,15 +1,23 @@
|
||||
package com.zhgd.xmgl.modules.xz.security.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.file.FileUtil;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.base.entity.vo.SectorVo;
|
||||
import com.zhgd.xmgl.base.entity.vo.TrendOneVo;
|
||||
import com.zhgd.xmgl.constant.Cts;
|
||||
import com.zhgd.xmgl.modules.basicdata.constant.DictionaryConstant;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.DictionaryItem;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.impl.DictionaryItemServiceImpl;
|
||||
import com.zhgd.xmgl.modules.dangerous.service.IDangerousEngineeringRecordService;
|
||||
import com.zhgd.xmgl.modules.risk.entity.RiskListSource;
|
||||
import com.zhgd.xmgl.modules.risk.entity.vo.RiskListSourceVo;
|
||||
@ -21,14 +29,14 @@ import com.zhgd.xmgl.modules.xz.security.entity.dto.XzSecurityDepartmentRectifie
|
||||
import com.zhgd.xmgl.modules.xz.security.entity.dto.XzSecurityQualityInspectionRecordSourceAddDto;
|
||||
import com.zhgd.xmgl.modules.xz.security.entity.vo.*;
|
||||
import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityQualityInspectionRecordService;
|
||||
import com.zhgd.xmgl.util.MapBuilder;
|
||||
import com.zhgd.xmgl.util.MessageUtil;
|
||||
import com.zhgd.xmgl.util.*;
|
||||
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.apache.commons.collections.MapUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
@ -37,12 +45,11 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
@ -68,6 +75,9 @@ public class XzSecurityQualityInspectionRecordController {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IRiskListSourceService riskListSourceService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private DictionaryItemServiceImpl dictionaryItemService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
@ -579,4 +589,163 @@ public class XzSecurityQualityInspectionRecordController {
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导出潮州项目隐患统计汇总excel表", notes = "导出潮州项目隐患统计汇总excel表", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/exportXls")
|
||||
public void exportXls(HttpServletResponse response, @RequestBody HashMap<String, Object> param) {
|
||||
String templateUrl = null;
|
||||
String projectSn = MapUtils.getString(param, "projectSn");
|
||||
Map<Integer, Map<String, Object>> root = new HashMap<>(4);
|
||||
Map<String, DictionaryItem> priorityNameDicNameMap = dictionaryItemService.getDictDataMapByProjectSn(DictionaryConstant.XZ_SECURITY_DANGER_ITEM_RECORD_PRIORITY_NAME_DIC, null);
|
||||
Map<String, DictionaryItem> dictDataMap = dictionaryItemService.getDictDataMapByProjectSn(DictionaryConstant.XZ_SECURITY_QUALITY_INSPECTION_RECORD_DUTY_MAJOR, projectSn);
|
||||
try {
|
||||
ArrayList<byte[]> imageBytesList = new ArrayList<>();
|
||||
ArrayList<byte[]> rectifyAfterImageBytesList = new ArrayList<>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
param.put("pageNo", 1);
|
||||
param.put("pageSize", -1);
|
||||
List<XzSecurityQualityInspectionRecordVo> records = qualityInspectionRecordService.selectQualityInspectionRecordPage(param).getPage().getRecords();
|
||||
List<Map<String, Object>> listMap = new ArrayList<>();
|
||||
for (int i = 0; i < records.size(); i++) {
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
XzSecurityQualityInspectionRecordVo vo = records.get(i);
|
||||
objectMap.put("inspectManName", vo.getInspectManName());
|
||||
objectMap.put("createEnterpriseName", vo.getCreateEnterpriseName());
|
||||
objectMap.put("verifyManName", vo.getVerifyManName());
|
||||
objectMap.put("notifyPersonName", vo.getNotifyPersonName());
|
||||
objectMap.put("enterpriseName", vo.getEnterpriseName());
|
||||
objectMap.put("fullName", vo.getFullName());
|
||||
objectMap.put("routineCheckName", vo.getRoutineCheckName());
|
||||
objectMap.put("changeName", vo.getChangeName());
|
||||
objectMap.put("reviewName", vo.getReviewName());
|
||||
objectMap.put("overTime", vo.getOverTime());
|
||||
objectMap.put("problemDescription", vo.getProblemDescription());
|
||||
objectMap.put("dangerName", vo.getDangerName());
|
||||
objectMap.put("dangerItemName", vo.getDangerItemName());
|
||||
objectMap.put("engineeringName", vo.getEngineeringName());
|
||||
objectMap.put("jobApplicationUnitName", vo.getJobApplicationUnitName());
|
||||
objectMap.put("workTicketCode", vo.getWorkTicketCode());
|
||||
objectMap.put("deductScore", vo.getDeductScore());
|
||||
objectMap.put("mainEnterpriseName", vo.getMainEnterpriseName());
|
||||
objectMap.put("id", vo.getId());
|
||||
objectMap.put("regionId", vo.getRegionId());
|
||||
objectMap.put("regionName", vo.getRegionName());
|
||||
objectMap.put("remark", vo.getRemark());
|
||||
objectMap.put("dangerDesc", vo.getDangerDesc());
|
||||
objectMap.put("dangerItemContent", vo.getDangerItemContent());
|
||||
objectMap.put("dangerItemId", vo.getDangerItemId());
|
||||
objectMap.put("dangerTypeId", vo.getDangerTypeId());
|
||||
objectMap.put("level", vo.getLevel());
|
||||
objectMap.put("measurePoints", vo.getMeasurePoints());
|
||||
objectMap.put("urgentLevel", vo.getUrgentLevel());
|
||||
//状态,2待整改,3待复查,4待核验,5合格,6已撤回
|
||||
objectMap.put("status", getStatusText(vo.getStatus()));
|
||||
objectMap.put("notifyPerson", vo.getNotifyPerson());
|
||||
objectMap.put("creatorId", vo.getCreatorId());
|
||||
objectMap.put("createTime", DateUtil.format(DateUtil.parseDateTime(vo.getCreateTime()), "yyyy.MM.dd"));
|
||||
objectMap.put("changeId", vo.getChangeId());
|
||||
objectMap.put("changeLimitTime", vo.getChangeLimitTime());
|
||||
objectMap.put("inspectManId", vo.getInspectManId());
|
||||
objectMap.put("inspectTime", vo.getInspectTime());
|
||||
objectMap.put("recordType", vo.getRecordType());
|
||||
objectMap.put("fileUrl", vo.getFileUrl());
|
||||
objectMap.put("routineId", vo.getRoutineId());
|
||||
objectMap.put("completeTime", vo.getCompleteTime());
|
||||
objectMap.put("isDele", vo.getIsDele());
|
||||
objectMap.put("projectSn", vo.getProjectSn());
|
||||
objectMap.put("taskId", vo.getTaskId());
|
||||
objectMap.put("itemId", vo.getItemId());
|
||||
objectMap.put("subsectionId", vo.getSubsectionId());
|
||||
objectMap.put("subentryId", vo.getSubentryId());
|
||||
objectMap.put("floor", vo.getFloor());
|
||||
objectMap.put("addedDescription", vo.getAddedDescription());
|
||||
objectMap.put("engineeringId", vo.getEngineeringId());
|
||||
objectMap.put("type", vo.getType());
|
||||
objectMap.put("dutyMajor", Optional.ofNullable(dictDataMap.get(vo.getDutyMajor())).map(m -> m.getName()).orElse(null));
|
||||
objectMap.put("detailPlace", vo.getDetailPlace());
|
||||
objectMap.put("priorityNameDic", Optional.ofNullable(priorityNameDicNameMap.get(vo.getPriorityNameDic())).map(m -> m.getName()).orElse(null));
|
||||
objectMap.put("subsectionName", vo.getSubsectionName());
|
||||
objectMap.put("subentryName", vo.getSubentryName());
|
||||
objectMap.put("safeWatchAlarmExceedMinute", vo.getSafeWatchAlarmExceedMinute());
|
||||
objectMap.put("zgRectifyTime", vo.getZgRectifyTime());
|
||||
objectMap.put("zgFileUrl", vo.getZgFileUrl());
|
||||
objectMap.put("zgAdditionalRemarks", vo.getZgAdditionalRemarks());
|
||||
objectMap.put("fcRectifyTime", vo.getFcRectifyTime());
|
||||
objectMap.put("fcFileUrl", vo.getFcFileUrl());
|
||||
objectMap.put("fcAdditionalRemarks", vo.getFcAdditionalRemarks());
|
||||
objectMap.put("hyRectifyTime", vo.getHyRectifyTime());
|
||||
objectMap.put("hyFileUrl", vo.getHyFileUrl());
|
||||
objectMap.put("hyAdditionalRemarks", vo.getHyAdditionalRemarks());
|
||||
objectMap.put("violatorId", vo.getViolatorId());
|
||||
objectMap.put("regionIds", vo.getRegionIds());
|
||||
objectMap.put("reviewIds", vo.getReviewIds());
|
||||
objectMap.put("verifyManIds", vo.getVerifyManIds());
|
||||
objectMap.put("enterpriseIds", vo.getEnterpriseIds());
|
||||
objectMap.put("enterpriseSns", vo.getEnterpriseSns());
|
||||
objectMap.put("regionNames", vo.getRegionNames());
|
||||
objectMap.put("reviewNames", vo.getReviewNames());
|
||||
objectMap.put("verifyManNames", vo.getVerifyManNames());
|
||||
objectMap.put("enterpriseNames", vo.getEnterpriseNames());
|
||||
objectMap.put("no", i + 1);
|
||||
byte[] bytes = new byte[0];
|
||||
try {
|
||||
bytes = cn.hutool.core.io.FileUtil.readBytes(PathUtil.getBasePath() + "/" + 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());
|
||||
} catch (Exception e) {
|
||||
} finally {
|
||||
rectifyAfterImageBytesList.add(bytes);
|
||||
}
|
||||
// objectMap.put("imageUrl", EasyPoiUtil.getImageEntityByXls(vo.getImageUrl()));
|
||||
// objectMap.put("rectifyAfterImage", EasyPoiUtil.getImageEntityByXls(vo.getRectifyAfterImage()));
|
||||
List<String> split = StrUtil.split(vo.getDangerItemContent(), "/");
|
||||
objectMap.put("yhdl", CollUtil.get(split, 0));
|
||||
objectMap.put("yhxl", CollUtil.get(split, 1));
|
||||
listMap.add(objectMap);
|
||||
}
|
||||
map.put("listMap", listMap);
|
||||
templateUrl = Fileutils.getExportTemplateFile("excel/潮州项目隐患统计汇总表.xlsx").getAbsolutePath();
|
||||
root.put(0, map);
|
||||
TemplateExportParams params = new TemplateExportParams(templateUrl, true);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(root, params);
|
||||
//隐患图片
|
||||
ExcelUtils.exportPicture(workbook, 0, imageBytesList, 1, 3, 1);
|
||||
//整改图片
|
||||
ExcelUtils.exportPicture(workbook, 0, rectifyAfterImageBytesList, 1, 9, 1);
|
||||
ExcelUtils.downLoadExcel("潮州项目隐患统计汇总表.xlsx", response, workbook);
|
||||
} catch (IOException e) {
|
||||
log.error("", e);
|
||||
throw new OpenAlertException("系统错误");
|
||||
} finally {
|
||||
if (templateUrl != null) {
|
||||
FileUtil.deleteFile(templateUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getStatusText(Integer status) {
|
||||
if (status == null) {
|
||||
return "";
|
||||
}
|
||||
if (status == 2) {
|
||||
return "待整改";
|
||||
} else if (status == 3) {
|
||||
return "待复查";
|
||||
} else if (status == 4) {
|
||||
return "待核验";
|
||||
} else if (status == 5) {
|
||||
return "合格";
|
||||
} else if (status == 6) {
|
||||
return "已撤回";
|
||||
} else {
|
||||
return "未知状态";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -352,4 +352,8 @@ public class XzSecurityQualityInspectionRecord implements Serializable {
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "合作单位名称s(多个,分隔)")
|
||||
private String enterpriseNames;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "草稿id")
|
||||
private String draftId;
|
||||
|
||||
}
|
||||
|
||||
@ -30,4 +30,15 @@ public class TopProjectClassifyTypeRecordTreeVo {
|
||||
*/
|
||||
@ApiModelProperty(value = "整改时限(天)")
|
||||
private Integer changeLimit;
|
||||
/**
|
||||
* 项目:记录状态,0 启用,1禁用
|
||||
*/
|
||||
@ApiModelProperty(value = "项目:记录状态,0 启用,1禁用")
|
||||
private java.lang.Integer recordStatus;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@ApiModelProperty(value = "排序")
|
||||
@Deprecated
|
||||
private Integer orderSort;
|
||||
}
|
||||
|
||||
@ -79,6 +79,7 @@
|
||||
a.parent_id,
|
||||
a.remark,
|
||||
IFNULL(b.record_status, 0) record_status
|
||||
,a.project_classify
|
||||
from xz_security_danger_type_record a
|
||||
INNER JOIN company p1 ON a.sn = p1.headquarters_sn
|
||||
INNER JOIN project p2 ON p2.company_sn = p1.company_sn
|
||||
|
||||
@ -66,7 +66,7 @@ public class XzSecurityDangerFieldServiceImpl extends ServiceImpl<XzSecurityDang
|
||||
|
||||
private QueryWrapper<XzSecurityDangerFieldVo> getQueryWrapper(HashMap<String, Object> param) {
|
||||
QueryWrapper<XzSecurityDangerFieldVo> queryWrapper = QueryGenerator.initPageQueryWrapper(XzSecurityDangerFieldVo.class, param, true);
|
||||
queryWrapper.orderByDesc(RefUtil.fieldNameUlc(XzSecurityDangerFieldVo::getId));
|
||||
queryWrapper.orderByAsc(RefUtil.fieldNameUlc(XzSecurityDangerFieldVo::getSort));
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ import cn.hutool.core.util.NumberUtil;
|
||||
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.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -181,6 +182,9 @@ public class XzSecurityQualityInspectionRecordServiceImpl extends ServiceImpl<Xz
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IDictionaryItemService dictionaryItemService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IXzSecurityQualityInspectionRecordDraftService xzSecurityQualityInspectionRecordDraftService;
|
||||
|
||||
private static List<Long> getChildrenByQualityRegionId(Long regionId, List<QualityRegion> all) {
|
||||
ArrayList<Long> list = new ArrayList<>();
|
||||
@ -490,6 +494,12 @@ public class XzSecurityQualityInspectionRecordServiceImpl extends ServiceImpl<Xz
|
||||
.in(EnterpriseInfo::getId, eids)).stream().map(EnterpriseInfo::getEnterpriseName).collect(Collectors.joining(","));
|
||||
record.setId(null);
|
||||
xzSecurityQualityInspectionRecordMapper.insert(record);
|
||||
if (record.getDraftId() != null) {
|
||||
xzSecurityQualityInspectionRecordDraftService.update(null, new LambdaUpdateWrapper<XzSecurityQualityInspectionRecordDraft>()
|
||||
.set(XzSecurityQualityInspectionRecordDraft::getIsGenerate, 1)
|
||||
.eq(XzSecurityQualityInspectionRecordDraft::getId, record.getDraftId())
|
||||
);
|
||||
}
|
||||
saveBindData(record);
|
||||
if (Objects.equals(record.getRecordType(), XzSecurityQualityInspectionRecordRecordTypeEnum.DANGER.getValue()) && Objects.equals(record.getStatus(), XzSecurityQualityInspectionRecordStatusEnum.NOT_RECTIFIED.getValue())) {
|
||||
noticeService.addUserNoticeAndApp(record.getChangeId(), "安全管理待整改", "您有一条安全检查待整改,问题:" + record.getDangerItemContent(), "10",
|
||||
|
||||
@ -12,13 +12,12 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.apache.poi.xssf.usermodel.*;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@ -871,6 +870,105 @@ public class ExcelUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出图片到excel
|
||||
*
|
||||
* @param workbook 工作簿
|
||||
* @param sheetIndex 工作表索引
|
||||
* @param bytesList 导出的图片字节数组列表
|
||||
* @param startRow 开始行
|
||||
* @param startCol 开始列
|
||||
* @param direction 方向:1纵向2横向
|
||||
*/
|
||||
public static void exportPicture(Workbook workbook, int sheetIndex, List<byte[]> bytesList,
|
||||
int startRow, int startCol, int direction) {
|
||||
if (workbook == null || bytesList == null || bytesList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Sheet sheet = workbook.getSheetAt(sheetIndex);
|
||||
if (sheet == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Drawing<?> drawing = sheet.createDrawingPatriarch();
|
||||
int rowIndex = startRow;
|
||||
int colIndex = startCol;
|
||||
|
||||
for (byte[] bytes : bytesList) {
|
||||
if (bytes == null || bytes.length == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try (ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes)) {
|
||||
// 获取图片格式(简单判断,实际可能需要更复杂的检测)
|
||||
int pictureType = getPictureType(bytes);
|
||||
|
||||
// 添加图片到工作簿
|
||||
int pictureIndex = workbook.addPicture(bytes, pictureType);
|
||||
|
||||
// 创建锚点定位图片
|
||||
ClientAnchor anchor;
|
||||
if (workbook instanceof XSSFWorkbook) {
|
||||
anchor = new XSSFClientAnchor();
|
||||
} else if (workbook instanceof HSSFWorkbook) {
|
||||
anchor = new HSSFClientAnchor();
|
||||
} else {
|
||||
anchor = workbook.getCreationHelper().createClientAnchor();
|
||||
}
|
||||
|
||||
// 设置图片位置
|
||||
anchor.setCol1(colIndex);
|
||||
anchor.setRow1(rowIndex);
|
||||
anchor.setCol2(colIndex + 1); // 默认占1列宽度
|
||||
anchor.setRow2(rowIndex + 1); // 默认占1行高度
|
||||
|
||||
// 插入图片
|
||||
drawing.createPicture(anchor, pictureIndex);
|
||||
|
||||
// 根据方向调整下一个图片的位置
|
||||
if (direction == 1) {
|
||||
// 纵向排列:向下移动一行
|
||||
rowIndex++;
|
||||
} else {
|
||||
// 横向排列:向右移动一列
|
||||
colIndex++;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据图片字节数组判断图片类型
|
||||
*/
|
||||
private static int getPictureType(byte[] bytes) {
|
||||
if (bytes.length < 4) {
|
||||
return Workbook.PICTURE_TYPE_PNG;
|
||||
}
|
||||
|
||||
// 检查文件头标识
|
||||
if (bytes[0] == (byte) 0xFF && bytes[1] == (byte) 0xD8) {
|
||||
return Workbook.PICTURE_TYPE_JPEG;
|
||||
} else if (bytes[0] == (byte) 0x89 && bytes[1] == (byte) 0x50 &&
|
||||
bytes[2] == (byte) 0x4E && bytes[3] == (byte) 0x47) {
|
||||
return Workbook.PICTURE_TYPE_PNG;
|
||||
} else if (bytes[0] == (byte) 0x42 && bytes[1] == (byte) 0x4D) {
|
||||
return Workbook.PICTURE_TYPE_DIB;
|
||||
} else if (bytes[0] == (byte) 0x00 && bytes[1] == (byte) 0x00 &&
|
||||
bytes[2] == (byte) 0x01 && bytes[3] == (byte) 0x00) {
|
||||
return Workbook.PICTURE_TYPE_EMF;
|
||||
} else if (bytes[0] == (byte) 0x00 && bytes[1] == (byte) 0x00 &&
|
||||
bytes[2] == (byte) 0x02 && bytes[3] == (byte) 0x00) {
|
||||
return Workbook.PICTURE_TYPE_WMF;
|
||||
}
|
||||
|
||||
// 默认返回PNG类型
|
||||
return Workbook.PICTURE_TYPE_PNG;
|
||||
}
|
||||
|
||||
// // 示例用法
|
||||
// public static void main(String[] args) {
|
||||
// try {
|
||||
|
||||
Binary file not shown.
BIN
src/main/resources/excel/潮州项目隐患统计汇总表.xlsx
Normal file
BIN
src/main/resources/excel/潮州项目隐患统计汇总表.xlsx
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user