diff --git a/pom.xml b/pom.xml index 1b1832541..557107c0c 100644 --- a/pom.xml +++ b/pom.xml @@ -366,17 +366,23 @@ cn.afterturn easypoi-base - 4.0.0 + 4.4.0 cn.afterturn easypoi-annotation - 4.0.0 + 4.4.0 cn.afterturn easypoi-web - 4.0.0 + 4.4.0 + + + + org.apache.poi + ooxml-schemas + 1.4 @@ -987,7 +993,7 @@ <!–CustomClassLoader;WisdomSiteApplication;LicenseUtil;MyBootJarLauncher;MyJarClassLoader–> --> - + + <!–鞍钢–> B67960E5E329F6DD23AFFA354E12732BD41D8CD98F00B204E9800998ECF8427ED41D8CD98F00B204E9800998ECF8427E - - + <!–中科安信–> + <!–A6F449ECD7E1024F703F37F2294AC8F2D41D8CD98F00B204E9800998ECF8427ED41D8CD98F00B204E9800998ECF8427E–> @@ -1014,7 +1020,7 @@ - + --> diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/ModelDownloadController.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/ModelDownloadController.java new file mode 100644 index 000000000..939deec82 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/ModelDownloadController.java @@ -0,0 +1,1027 @@ +package com.zhgd.xmgl.modules.basicdata.controller; + + +import cn.afterturn.easypoi.word.WordExportUtil; +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.zhgd.jeecg.common.mybatis.EntityMap; +import com.zhgd.xmgl.base.entity.vo.SectorOneVo; +import com.zhgd.xmgl.base.entity.vo.TrendOneVo; +import com.zhgd.xmgl.modules.basicdata.constant.DictionaryConstant; +import com.zhgd.xmgl.modules.basicdata.entity.DictionaryItem; +import com.zhgd.xmgl.modules.basicdata.entity.SystemUser; +import com.zhgd.xmgl.modules.basicdata.service.IDictionaryItemService; +import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService; +import com.zhgd.xmgl.modules.car.entity.CarInfo; +import com.zhgd.xmgl.modules.car.entity.CarPassRecord; +import com.zhgd.xmgl.modules.car.entity.CarType; +import com.zhgd.xmgl.modules.car.entity.vo.CountCarModuleTypeVo; +import com.zhgd.xmgl.modules.car.entity.vo.TodayOutInNumber; +import com.zhgd.xmgl.modules.car.mapper.CarTypeMapper; +import com.zhgd.xmgl.modules.car.service.ICarInfoService; +import com.zhgd.xmgl.modules.car.service.ICarPassRecordService; +import com.zhgd.xmgl.modules.car.service.ICarTypeService; +import com.zhgd.xmgl.modules.environment.entity.*; +import com.zhgd.xmgl.modules.environment.service.*; +import com.zhgd.xmgl.modules.inspection.entity.vo.InspectTaskRecordVo; +import com.zhgd.xmgl.modules.inspection.service.IInspectTaskItemRecordService; +import com.zhgd.xmgl.modules.inspection.service.IInspectTaskRecordService; +import com.zhgd.xmgl.modules.project.entity.ProjectEnterprise; +import com.zhgd.xmgl.modules.project.entity.ProjectExtend; +import com.zhgd.xmgl.modules.project.entity.vo.ProjectInfoExtVo; +import com.zhgd.xmgl.modules.project.service.IProjectEnterpriseService; +import com.zhgd.xmgl.modules.project.service.IProjectExtendService; +import com.zhgd.xmgl.modules.project.service.IProjectService; +import com.zhgd.xmgl.modules.quality.entity.QualityRegion; +import com.zhgd.xmgl.modules.quality.entity.vo.RecordVo; +import com.zhgd.xmgl.modules.quality.service.IQualityInspectionRecordService; +import com.zhgd.xmgl.modules.quality.service.IQualityRegionService; +import com.zhgd.xmgl.modules.sprayrt.entity.SprayRtData; +import com.zhgd.xmgl.modules.sprayrt.entity.SprayRtDev; +import com.zhgd.xmgl.modules.sprayrt.service.ISprayRtDataService; +import com.zhgd.xmgl.modules.sprayrt.service.ISprayRtDevService; +import com.zhgd.xmgl.modules.taskprogress.entity.TaskProgress; +import com.zhgd.xmgl.modules.taskprogress.entity.TaskProgressAlarm; +import com.zhgd.xmgl.modules.taskprogress.entity.TaskProgressContent; +import com.zhgd.xmgl.modules.taskprogress.entity.TaskProgressMaterialRel; +import com.zhgd.xmgl.modules.taskprogress.service.ITaskProgressAlarmService; +import com.zhgd.xmgl.modules.taskprogress.service.ITaskProgressContentService; +import com.zhgd.xmgl.modules.taskprogress.service.ITaskProgressService; +import com.zhgd.xmgl.modules.video.entity.AiAnalyseHardWareAlarmRecord; +import com.zhgd.xmgl.modules.video.entity.AiAnalyseHardWareRecord; +import com.zhgd.xmgl.modules.video.service.IAiAnalyseHardWareAlarmRecordService; +import com.zhgd.xmgl.modules.video.service.IAiAnalyseHardWareRecordService; +import com.zhgd.xmgl.modules.worker.entity.*; +import com.zhgd.xmgl.modules.worker.entity.vo.TrainRecordVo; +import com.zhgd.xmgl.modules.worker.service.*; +import com.zhgd.xmgl.modules.xz.entity.XzAiDeductRule; +import com.zhgd.xmgl.modules.xz.entity.XzDeductScoreRecord; +import com.zhgd.xmgl.modules.xz.security.entity.vo.StatsByEnterpriseVo; +import com.zhgd.xmgl.modules.xz.security.entity.vo.XzSecurityInspectTaskRecordVo; +import com.zhgd.xmgl.modules.xz.security.entity.vo.XzSecurityQualityInspectionRecordTotalVo; +import com.zhgd.xmgl.modules.xz.security.entity.vo.XzSecurityRecordVo; +import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityInspectTaskItemRecordService; +import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityInspectTaskRecordService; +import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityQualityInspectionRecordService; +import com.zhgd.xmgl.modules.xz.service.IXzAiDeductRuleService; +import com.zhgd.xmgl.modules.xz.service.IXzDeductScoreRecordService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.MapUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.xwpf.usermodel.XWPFDocument; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.math.BigDecimal; +import java.net.URLEncoder; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @program: wisdomSite + * @description: 下载 + * @author: Mr.Peng + * @create: 2020-12-21 09:33 + **/ +@RestController +@RequestMapping("/xmgl/modelDownload") +@Slf4j +@Api(tags = "下载") +public class ModelDownloadController { + + @Autowired + private IEnterpriseInfoService enterpriseInfoService; + + @Autowired + private IEnterpriseTypeService enterpriseTypeService; + + @Autowired + private IProjectEnterpriseService projectEnterpriseService; + + @Autowired + private IProjectEnterpriseSupplierInfoService projectEnterpriseSupplierInfoService; + + @Autowired + private IProjectService projectService; + + @Autowired + private ISystemUserService systemUserService; + + @Autowired + private ICarInfoService carInfoService; + + @Autowired + private ICarTypeService carTypeService; + + @Autowired + private CarTypeMapper carTypeMapper; + + @Autowired + private ICarPassRecordService carPassRecordService; + + @Autowired + private IXzSecurityQualityInspectionRecordService xzSecurityQualityInspectionRecordService; + + @Autowired + private IQualityInspectionRecordService qualityInspectionRecordService; + + @Autowired + private IXzSecurityInspectTaskRecordService xzSecurityInspectTaskRecordService; + + @Autowired + private IXzSecurityInspectTaskItemRecordService xzSecurityInspectTaskItemRecordService; + + @Autowired + private IInspectTaskRecordService inspectTaskRecordService; + + @Autowired + private IInspectTaskItemRecordService inspectTaskItemRecordService; + + @Autowired + private IDictionaryItemService dictionaryItemService; + + @Autowired + private IProjectExtendService projectExtendService; + + @Autowired + private ITaskProgressContentService taskProgressContentService; + + @Autowired + private ITaskProgressService taskProgressService; + + @Autowired + private ITaskProgressAlarmService taskProgressAlarmService; + + @Autowired + private IEnvironmentDevService environmentDevService; + + @Autowired + private IAiAnalyseHardWareRecordService aiAnalyseHardWareRecordService; + + @Autowired + private IAiAnalyseHardWareAlarmRecordService aiAnalyseHardWareAlarmRecordService; + + @Autowired + private IQualityRegionService qualityRegionService; + + @Autowired + private IWorkerInfoService workerInfoService; + + @Autowired + private IWorkerEvaluateService workerEvaluateService; + + @Autowired + private IXzDeductScoreRecordService xzDeductScoreRecordService; + + @Autowired + private IWorkerTypeService workerTypeService; + + @Autowired + private ITeamInfoService teamInfoService; + + @Autowired + private IDepartmentInfoService departmentInfoService; + + @Autowired + private IWorkerContractService workerContractService; + + @Autowired + private IWorkerCertificateService workerCertificateService; + + @Autowired + private IWorkerPhysicalsService workerPhysicalsService; + + @Autowired + private IWorkerInsuranceService workerInsuranceService; + + @Autowired + private IXzAiDeductRuleService xzAiDeductRuleService; + + @Autowired + private ISprayRtDevService sprayRtDevService; + + @Autowired + private IEnvironmentWarningService environmentWarningService; + + @Autowired + private IDustNoiseDataService dustNoiseDataService; + + @Autowired + private IEnvironmentAlarmService environmentAlarmService; + + @Autowired + private IEnvironmentAlarmTypeService environmentAlarmTypeService; + + @Autowired + private ISprayRtDataService sprayRtDataService; + + @Autowired + private IEnterpriseQualificationService enterpriseQualificationService; + + @Autowired + private IEnterpriseBadRecordService enterpriseBadRecordService; + + @ApiOperation(value = "按模版导出项目信息", notes = "按模版导出项目信息", httpMethod = "GET") + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String") + @GetMapping(value = "/exportProjectInfo/{projectSn}") + public void exportProjectInfo(HttpServletResponse response, @PathVariable("projectSn")String projectSn) { + ProjectInfoExtVo projectInfoBySn = projectService.getProjectInfoBySn(projectSn); + ProjectExtend projectExtend = projectExtendService.getOne(Wrappers.lambdaQuery().eq(ProjectExtend::getProjectSn, projectSn)); + Map infoMap = getProjectInfo(projectInfoBySn); + Map extendMap = BeanUtil.beanToMap(projectExtend); + infoMap.putAll(extendMap); + try { + // 读取Word模板文件 +// ClassPathResource classPathResource = new ClassPathResource("word/项目基本信息.docx"); +// InputStream fis = classPathResource.getInputStream(); +// XWPFDocument doc = new XWPFDocument(fis); + XWPFDocument doc = WordExportUtil.exportWord07("word/项目基本信息.docx", infoMap); + response.setCharacterEncoding("UTF-8"); + response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(projectInfoBySn.getProjectName() + "信息.docx", "UTF-8")); + doc.write(response.getOutputStream()); +// // 获取所有段落 +// List paragraphs = doc.getParagraphs(); +// // 替换文本数据 +// for (XWPFParagraph p : paragraphs) { +// List runs = p.getRuns(); +// for (XWPFRun r : runs) { +// String text = r.getText(0); +// for (String s : infoMap.keySet()) { +// if (text != null && text.contains("{{" + s + "}}")) { +// text = text.replace("{{" + s +"}}", infoMap.get(s).toString()); +// r.setText(text, 0); +// } +// } +// } +// } +// response.setCharacterEncoding("UTF-8"); +// response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); +// response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(projectInfoBySn.getProjectName() + "信息.docx", "UTF-8")); +// doc.write(response.getOutputStream()); + } catch (FileNotFoundException e) { + throw new RuntimeException(e); + } catch (IOException e) { + throw new RuntimeException(e); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @ApiOperation(value = "按模版导出分包单位信息", notes = "按模版导出分包单位信息", httpMethod = "GET") + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String") + @GetMapping(value = "/exportEnterprise/{projectSn}") + public void exportEnterprise(HttpServletResponse response, @PathVariable("projectSn")String projectSn) { + ProjectInfoExtVo projectInfoBySn = projectService.getProjectInfoBySn(projectSn); + List enterpriseId = projectEnterpriseService.list(Wrappers.lambdaQuery().eq(ProjectEnterprise::getProjectSn, projectSn)) + .stream().map(p -> p.getEnterpriseId()).collect(Collectors.toList()); + List enterpriseInfoList = enterpriseInfoService.listByIds(enterpriseId); + List enterpriseTypeList = enterpriseTypeService.list(); + Map resultMap = new HashMap<>(); + resultMap.put("projectName", projectInfoBySn.getProjectName()); + resultMap.put("total", enterpriseInfoList.size()); + for (EnterpriseType enterpriseType : enterpriseTypeList) { + resultMap.put("enterpriseType" + enterpriseType.getId(), enterpriseInfoList.stream().filter(e -> + e.getEnterpriseTypeId().toString().equals(enterpriseType.getId().toString())).count()); + } + resultMap.put("enterpriseList", getEnterpriseInfo(enterpriseInfoList, enterpriseTypeList)); + + List list = projectEnterpriseSupplierInfoService.list(Wrappers.lambdaQuery() + .eq(ProjectEnterpriseSupplierInfo::getProjectSn, projectSn)); + resultMap.put("supplierList", getEnterpriseSupplierInfo(list, enterpriseInfoList)); + + List qualificationList = enterpriseQualificationService.list(Wrappers.lambdaQuery() + .in(EnterpriseQualification::getEnterpriseId, enterpriseId)); + List> qualityList = new ArrayList<>(); + for (EnterpriseQualification enterpriseQualification : qualificationList) { + Map infoMap = BeanUtil.beanToMap(enterpriseQualification); + List itemList = enterpriseInfoList.stream().filter(p -> p.getId().toString().equals(enterpriseQualification.getEnterpriseId().toString())).collect(Collectors.toList()); + infoMap.put("enterpriseName", itemList.size() > 0 ? itemList.get(0).getEnterpriseName() : ""); + qualityList.add(infoMap); + } + resultMap.put("qualificationList", qualityList); + + List enterpriseBadRecordList = enterpriseBadRecordService.list(Wrappers.lambdaQuery() + .in(EnterpriseBadRecord::getEnterpriseId, enterpriseId)); + List> badRecordList = new ArrayList<>(); + for (EnterpriseBadRecord enterpriseBadRecord : enterpriseBadRecordList) { + Map infoMap = BeanUtil.beanToMap(enterpriseBadRecord); + List itemList = enterpriseInfoList.stream().filter(p -> p.getId().toString().equals(enterpriseBadRecord.getEnterpriseId().toString())).collect(Collectors.toList()); + infoMap.put("enterpriseName", itemList.size() > 0 ? itemList.get(0).getEnterpriseName() : ""); + badRecordList.add(infoMap); + } + resultMap.put("badRecord", badRecordList); + try { + XWPFDocument doc = WordExportUtil.exportWord07("word/分包单位信息.docx", resultMap); + response.setCharacterEncoding("UTF-8"); + response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(projectInfoBySn.getProjectName() + "分包单位信息.docx", "UTF-8")); + doc.write(response.getOutputStream()); + } catch (FileNotFoundException e) { + throw new RuntimeException(e); + } catch (IOException e) { + throw new RuntimeException(e); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + + @ApiOperation(value = "按模版导出环境监测信息", notes = "按模版导出环境监测信息", httpMethod = "GET") + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String") + @GetMapping(value = "/exportEnvironment/{projectSn}") + public void exportEnvironment(HttpServletResponse response, @PathVariable("projectSn")String projectSn) { + List enterpriseInfoList = enterpriseInfoService.list(); + List environmentAlarmTypeList = environmentAlarmTypeService.list(); + ProjectInfoExtVo projectInfoBySn = projectService.getProjectInfoBySn(projectSn); + // 扬尘设备 + List environmentDevList = environmentDevService.list(Wrappers.lambdaQuery().eq(EnvironmentDev::getProjectSn, projectSn)); + List> devMap = new ArrayList<>(); + for (EnvironmentDev environmentDev : environmentDevList) { + Map map = BeanUtil.beanToMap(environmentDev); + if (StringUtils.isNotBlank(environmentDev.getEnterpriseIds())) { + List list = Arrays.asList(environmentDev.getEnterpriseIds().split(",")); + map.put("enterpriseIds", enterpriseInfoList.stream().filter(e -> list.contains(e.getId().toString())).map(e -> e.getEnterpriseName()).collect(Collectors.joining(","))); + } + map.put("isEnable", environmentDev.getIsEnable() == 1 ? "在线" : "不在线"); + devMap.add(map); + } + Map infoMap = new HashMap<>(); + infoMap.put("projectName", projectInfoBySn.getProjectName()); + infoMap.put("environmentDev", devMap); + + // 喷淋设备 + List sprayDevList = sprayRtDevService.list(Wrappers.lambdaQuery().eq(SprayRtDev::getProjectSn, projectSn)); + List> devMap1 = new ArrayList<>(); + for (SprayRtDev sprayRtDev : sprayDevList) { + Map map = BeanUtil.beanToMap(sprayRtDev); + map.put("sprayMode", sprayRtDev.getSprayMode() == 1 ? "手动模式" : "自动模式"); + map.put("switchStatus", sprayRtDev.getSwitchStatus() == 1 ? "关" : "开"); + devMap1.add(map); + } + infoMap.put("sprayDev", devMap1); + + // 预警值设置 + List environmentWarningList = environmentWarningService.list(Wrappers.lambdaQuery() + .eq(EnvironmentWarning::getWarningType, 2) + .eq(EnvironmentWarning::getProjectSn, projectSn)); + List> devMap2 = new ArrayList<>(); + for (EnvironmentWarning warning : environmentWarningList) { + Map map = BeanUtil.beanToMap(warning); + List collect = environmentDevList.stream().filter(e -> e.getDeviceId().toString().equals(warning.getDeviceId().toString())).collect(Collectors.toList()); + if (collect.size() > 0) { + map.put("devName", collect.get(0).getDeviceName()); + map.put("devSn", collect.get(0).getDeviceId()); + } + if (warning.getIsNotPush() != null) { + map.put("isNotPush", warning.getIsNotPush() == 1 ? "推送" : "不推送"); + } + devMap2.add(map); + } + infoMap.put("warning", devMap2); + + // 报警值设置 + List environmentAlarmList = environmentWarningService.list(Wrappers.lambdaQuery() + .eq(EnvironmentWarning::getWarningType, 1) + .eq(EnvironmentWarning::getProjectSn, projectSn)); + List> devMap3 = new ArrayList<>(); + for (EnvironmentWarning warning : environmentAlarmList) { + Map map = BeanUtil.beanToMap(warning); + List collect = environmentDevList.stream().filter(e -> e.getDeviceId().toString().equals(warning.getDeviceId().toString())).collect(Collectors.toList()); + if (collect.size() > 0) { + map.put("devName", collect.get(0).getDeviceName()); + map.put("devSn", collect.get(0).getDeviceId()); + } + if (warning.getIsNotPush() != null) { + map.put("isNotPush", warning.getIsNotPush() == 1 ? "推送" : "不推送"); + } + devMap3.add(map); + } + infoMap.put("alarm", devMap3); + + // 环境监测数据 + List dustNoiseDataList = dustNoiseDataService.list(Wrappers.lambdaQuery() + .eq(DustNoiseData::getProjectSn, projectSn)); + List> devMap4 = new ArrayList<>(); + for (DustNoiseData dustNoiseData : dustNoiseDataList) { + Map map = BeanUtil.beanToMap(dustNoiseData); + List collect = environmentDevList.stream().filter(e -> e.getDeviceId().toString().equals(dustNoiseData.getDeviceId().toString())).collect(Collectors.toList()); + if (collect.size() > 0) { + map.put("devName", collect.get(0).getDeviceName()); + } + devMap4.add(map); + } + infoMap.put("dustNoiseDataList", devMap4); + + // 报警记录设置 + List environmentAlarms = environmentAlarmService.list(Wrappers.lambdaQuery() + .eq(EnvironmentAlarm::getProjectSn, projectSn)); + List> devMap5 = new ArrayList<>(); + for (EnvironmentAlarm alarm : environmentAlarms) { + Map map = BeanUtil.beanToMap(alarm); + List collect = environmentDevList.stream().filter(e -> e.getDeviceId().toString().equals(alarm.getDeviceId().toString())).collect(Collectors.toList()); + if (collect.size() > 0) { + map.put("devName", collect.get(0).getDeviceName()); + } + if (alarm.getAlarmTypeId() != null) { + List collect1 = environmentAlarmTypeList.stream().filter(e -> e.getId().toString().equals(alarm.getAlarmTypeId().toString())).collect(Collectors.toList()); + map.put("alarmTypeName", collect1.size() > 0 ? collect1.get(0).getAlarmType() : ""); + } + if (alarm.getType() != null) { + map.put("type", alarm.getType() == 1 ? "预警" : "报警"); + } + devMap5.add(map); + } + infoMap.put("environmentAlarms", devMap5); + + // 喷淋台账设置 + List sprayRtDataList = sprayRtDataService.list(Wrappers.lambdaQuery() + .eq(SprayRtData::getProjectSn, projectSn)); + List> devMap6 = new ArrayList<>(); + for (SprayRtData sprayRtData : sprayRtDataList) { + Map map = BeanUtil.beanToMap(sprayRtData); + List collect = sprayDevList.stream().filter(e -> e.getDevSn().toString().equals(sprayRtData.getDevSn().toString())).collect(Collectors.toList()); + if (collect.size() > 0) { + map.put("devName", collect.get(0).getDevName()); + } + devMap6.add(map); + } + infoMap.put("sprayRtData", devMap6); + try { + // 读取Word模板文件 + XWPFDocument doc = WordExportUtil.exportWord07("word/环境监测数据.docx", infoMap); + response.setCharacterEncoding("UTF-8"); + response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(projectInfoBySn.getProjectName() + "环境监测信息.docx", "UTF-8")); + doc.write(response.getOutputStream()); + } catch (FileNotFoundException e) { + throw new RuntimeException(e); + } catch (IOException e) { + throw new RuntimeException(e); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @ApiOperation(value = "按模版导出AI识别信息", notes = "按模版导出AI识别信息", httpMethod = "GET") + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String") + @GetMapping(value = "/exportAi/{projectSn}") + public void exportAi(HttpServletResponse response, @PathVariable("projectSn")String projectSn) { + ProjectInfoExtVo projectInfoBySn = projectService.getProjectInfoBySn(projectSn); + // AI设备 + List aiAnalyseHardWareRecordList = aiAnalyseHardWareRecordService.list(Wrappers.lambdaQuery() + .eq(AiAnalyseHardWareRecord::getProjectSn, projectSn)); + Map infoMap = new HashMap<>(); + infoMap.put("projectName", projectInfoBySn.getProjectName()); + infoMap.put("aiDev", aiAnalyseHardWareRecordList); + //扣分规则 + List deductRuleList = xzAiDeductRuleService.list(Wrappers.lambdaQuery().eq(XzAiDeductRule::getProjectSn, projectSn)); + List dict = dictionaryItemService.getDictList(DictionaryConstant.AI_ANALYSE_HARD_WARE_ALARM_RECORD_TYPE, projectSn); + List> deductMapList = new ArrayList<>(); + for (XzAiDeductRule xzAiDeductRule : deductRuleList) { + Map map = BeanUtil.beanToMap(xzAiDeductRule); + List collect = dict.stream().filter(d -> d.getId().toString().equals(xzAiDeductRule.getDictionaryItemId().toString())).collect(Collectors.toList()); + if (collect.size() > 0) { + map.put("typeName", collect.get(0).getName()); + } + deductMapList.add(map); + } + infoMap.put("ruleList", deductMapList); + // AI预警记录 + List alarmList = aiAnalyseHardWareAlarmRecordService.list(Wrappers.lambdaQuery() + .eq(AiAnalyseHardWareAlarmRecord::getProjectSn, projectSn)); + List regionList = qualityRegionService.list(Wrappers.lambdaQuery() + .eq(QualityRegion::getProjectSn, projectSn)); + // 待处理的预警类型统计 + List> list1 = new ArrayList<>(); + for (DictionaryItem dictionaryItem : dict) { + Map map = new HashMap<>(); + map.put("name", dictionaryItem.getName()); + map.put("count", alarmList.stream().filter(a -> !a.getIsPushed() && a.getAlarmType().toString().equals(dictionaryItem.getData())).count()); + list1.add(map); + } + infoMap.put("list1", list1); + // 待处理的预警记录 + List unPushList = alarmList.stream().filter(a -> !a.getIsPushed()).collect(Collectors.toList()); + List> list2 = new ArrayList<>(); + for (AiAnalyseHardWareAlarmRecord aiAnalyseHardWareAlarmRecord : unPushList) { + Map map = BeanUtil.beanToMap(aiAnalyseHardWareAlarmRecord); + List collect = dict.stream().filter(d -> d.getData().toString().equals(aiAnalyseHardWareAlarmRecord.getAlarmType().toString())).collect(Collectors.toList()); + map.put("alarmTypeName", collect.size() > 0 ? collect.get(0).getName() : ""); + List collect1 = regionList.stream().filter(a -> a.getId().toString().equals(aiAnalyseHardWareAlarmRecord.getQualityRegionId().toString())).collect(Collectors.toList()); + map.put("qualityRegionName", collect1.size() > 0 ? collect1.get(0).getRegionName() : ""); + list2.add(map); + } + infoMap.put("list2", list2); + // 按区域划分未处理的预警 + List> list3 = new ArrayList<>(); + for (QualityRegion qualityRegion : regionList) { + Map map = new HashMap<>(); + map.put("name", qualityRegion.getRegionName()); + map.put("count", alarmList.stream().filter(a -> !a.getIsPushed() && a.getQualityRegionId().toString().equals(qualityRegion.getId().toString())).count()); + list3.add(map); + } + infoMap.put("list3", list3); + // 已处理的预警类型统计 + List> list4 = new ArrayList<>(); + for (DictionaryItem dictionaryItem : dict) { + Map map = new HashMap<>(); + map.put("name", dictionaryItem.getName()); + map.put("count", alarmList.stream().filter(a -> a.getIsPushed() && a.getAlarmType().toString().equals(dictionaryItem.getData())).count()); + list4.add(map); + } + infoMap.put("list4", list4); + // 已处理的预警记录 + Map paramMap = new HashMap<>(); + paramMap.put("pageNo", -1); + paramMap.put("pageSize", -1); + paramMap.put("projectSn", projectSn); + paramMap.put("isPushed", 1); + List pushList = aiAnalyseHardWareAlarmRecordService.queryAiAnalyseHardWareAlarmPageList(paramMap).getRecords(); + List> list5 = new ArrayList<>(); + for (AiAnalyseHardWareAlarmRecord aiAnalyseHardWareAlarmRecord : pushList) { + Map map = BeanUtil.beanToMap(aiAnalyseHardWareAlarmRecord); + List collect = dict.stream().filter(d -> d.getData().toString().equals(aiAnalyseHardWareAlarmRecord.getAlarmType().toString())).collect(Collectors.toList()); + map.put("alarmTypeName", collect.size() > 0 ? collect.get(0).getName() : ""); + List collect1 = regionList.stream().filter(a -> a.getId().toString().equals(aiAnalyseHardWareAlarmRecord.getQualityRegionId().toString())).collect(Collectors.toList()); + map.put("qualityRegionName", collect1.size() > 0 ? collect1.get(0).getRegionName() : ""); + list5.add(map); + } + infoMap.put("list5", list5); + // 按区域划分已处理的预警 + List> list6 = new ArrayList<>(); + for (QualityRegion qualityRegion : regionList) { + Map map = new HashMap<>(); + map.put("name", qualityRegion.getRegionName()); + map.put("count", alarmList.stream().filter(a -> a.getIsPushed() && a.getQualityRegionId().toString().equals(qualityRegion.getId().toString())).count()); + list6.add(map); + } + infoMap.put("list6", list6); + try { + // 读取Word模板文件 + XWPFDocument doc = WordExportUtil.exportWord07("word/AI预警.docx", infoMap); + response.setCharacterEncoding("UTF-8"); + response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(projectInfoBySn.getProjectName() + "AI预警信息.docx", "UTF-8")); + doc.write(response.getOutputStream()); + } catch (FileNotFoundException e) { + throw new RuntimeException(e); + } catch (IOException e) { + throw new RuntimeException(e); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @ApiOperation(value = "按模版导出进度信息", notes = "按模版导出进度信息", httpMethod = "GET") + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String") + @GetMapping(value = "/exportProgressInfo/{projectSn}") + public void exportProgressInfo(HttpServletResponse response, HttpServletRequest req, @PathVariable("projectSn")String projectSn) { + ProjectInfoExtVo projectInfoBySn = projectService.getProjectInfoBySn(projectSn); + Map infoMap = new HashMap<>(); + infoMap.put("projectName", projectInfoBySn.getProjectName()); + + HashMap paramMap = new HashMap<>(); + paramMap.put("projectSn", projectSn); + TaskProgressContent taskProgressContent = new TaskProgressContent(); + taskProgressContent.setProjectSn(projectSn); + List taskProgressContents = taskProgressContentService.queryList(taskProgressContent, req); + List taskProgresses = taskProgressService.list(Wrappers.lambdaQuery().eq(TaskProgress::getProjectSn, projectSn)); + List> taskList = new ArrayList<>(); + for (TaskProgressContent taskProgressContent1 : taskProgressContents) { + List collect = taskProgresses.stream().filter(t -> t.getId().toString().equals(taskProgressContent1.getTaskProgressId().toString())).collect(Collectors.toList()); + Map map = new HashMap<>(); + map.put("uploadDate", taskProgressContent1.getUploadDate()); + map.put("uploadUserName", taskProgressContent1.getUploadUserName()); + map.put("taskName", collect.size() > 0 ? collect.get(0).getTaskName() : ""); + map.put("progressRatio", taskProgressContent1.getProgressRatio()); + StringBuilder builder = new StringBuilder(); + for (TaskProgressMaterialRel taskProgressMaterialRel : taskProgressContent1.getTypeDataList()) { + builder.append(taskProgressMaterialRel.getName()).append(":").append(taskProgressMaterialRel.getActualUsage()).append(taskProgressMaterialRel.getUnit()).append(";"); + } + map.put("desc", builder.toString()); + taskList.add(map); + } + infoMap.put("taskList", taskList); + List alarmList = taskProgressAlarmService.list(Wrappers.lambdaQuery().eq(TaskProgressAlarm::getProjectSn, projectSn)); + infoMap.put("alarmList", alarmList); + try { + XWPFDocument doc = WordExportUtil.exportWord07("word/进度管理.docx", infoMap); + response.setCharacterEncoding("UTF-8"); + response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(projectInfoBySn.getProjectName() + "进度信息.docx", "UTF-8")); + doc.write(response.getOutputStream()); + } catch (FileNotFoundException e) { + throw new RuntimeException(e); + } catch (IOException e) { + throw new RuntimeException(e); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @ApiOperation(value = "按模版导出安全质量信息", notes = "按模版导出安全质量信息", httpMethod = "GET") + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String") + @GetMapping(value = "/exportSafetyInfo/{projectSn}") + public void exportSafetyInfo(HttpServletResponse response, HttpServletRequest req, @PathVariable("projectSn")String projectSn) { + String [] carModuleType = {"", "固定车", "预约车辆(长期)", "预约车辆(临时)"}; + ProjectInfoExtVo projectInfoBySn = projectService.getProjectInfoBySn(projectSn); + Map infoMap = new HashMap<>(); + infoMap.put("projectName", projectInfoBySn.getProjectName()); + Map paramMap = new HashMap<>(); + paramMap.put("projectSn", projectInfoBySn.getProjectSn()); + List carInfos = carInfoService.selectCarList(paramMap); + List> carList = new ArrayList<>(); + for (CarInfo carInfo : carInfos) { + Map map = BeanUtil.beanToMap(carInfo); + map.put("isBackName", carInfo.getIsBlack() == 0 ? "否" : "是"); + map.put("carModuleTypeName", carModuleType[carInfo.getCarModuleType()]); + if (carInfo.getEntryAndExitPermit() != null) { + map.put("entryAndExitPermitName", carInfo.getEntryAndExitPermit() == 0 ? "单次" : "多次"); + } + carList.add(map); + } + infoMap.put("carInfos", carList); + List carTypeList = carTypeService.list(Wrappers.lambdaQuery().eq(CarType::getProjectSn, projectSn)); + infoMap.put("carTypeList", carTypeList); + TodayOutInNumber todayOutInNumber = carPassRecordService.getTodayOutInNumber(projectSn, null); + Map map = BeanUtil.beanToMap(todayOutInNumber); + infoMap.putAll(map); + CountCarModuleTypeVo countCarModuleTypeVo = carInfoService.countCarModuleType(paramMap); + Integer totalNum = countCarModuleTypeVo.getCqcNum() + countCarModuleTypeVo.getGdcNum() + countCarModuleTypeVo.getLscNum(); + List> carModuleTypeList = new ArrayList<>(); + Map map1 = new HashMap<>(); + map1.put("name", "固定车"); + map1.put("num", countCarModuleTypeVo.getGdcNum()); + map1.put("ratio", new BigDecimal(countCarModuleTypeVo.getGdcNum()).divide(new BigDecimal(totalNum), 2 , BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100))); + carModuleTypeList.add(map1); + Map map2 = new HashMap<>(); + map2.put("name", "长期车"); + map2.put("num", countCarModuleTypeVo.getCqcNum()); + map2.put("ratio", new BigDecimal(countCarModuleTypeVo.getCqcNum()).divide(new BigDecimal(totalNum), 2 , BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100))); + carModuleTypeList.add(map2); + Map map3 = new HashMap<>(); + map3.put("name", "临时车"); + map3.put("num", countCarModuleTypeVo.getLscNum()); + map3.put("ratio", new BigDecimal(countCarModuleTypeVo.getLscNum()).divide(new BigDecimal(totalNum), 2 , BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100))); + carModuleTypeList.add(map3); + infoMap.put("carModuleTypeList", carModuleTypeList); + List carTypeStat = carTypeMapper.selectCarTypeTotalByCameraId(map); + List> carTypePass = new ArrayList<>(); + for (EntityMap entityMap : carTypeStat) { + Map passMap1 = new HashMap<>(); + map1.put("carTypeName", entityMap.get("carTypeName")); + map1.put("type", "进"); + map1.put("num", entityMap.get("innum")); + carTypePass.add(passMap1); + Map passMap2 = new HashMap<>(); + map1.put("carTypeName", entityMap.get("carTypeName")); + map1.put("type", "出"); + map1.put("num", entityMap.get("outnum")); + carTypePass.add(passMap2); + } + infoMap.put("carTypePass", carTypePass); + List carPassRecordList = carPassRecordService.getCarPassRecordList(paramMap); + List> passRecordList = new ArrayList<>(); + for (CarPassRecord carPassRecord : carPassRecordList) { + Map recordMap = BeanUtil.beanToMap(carPassRecord); + recordMap.put("carModuleTypeName", carModuleType[carPassRecord.getCarModuleType()]); + recordMap.put("typeName", carPassRecord.getType() == 0 ? "进" : "出"); + passRecordList.add(map); + } + paramMap.put("pageNo", 1); + paramMap.put("pageSize", 9999); + infoMap.put("passRecordList", passRecordList); + XzSecurityRecordVo xzSecurityRecordVo = xzSecurityQualityInspectionRecordService.selectQualityInspectionRecordPage(paramMap); + infoMap.putAll(BeanUtil.beanToMap(xzSecurityRecordVo.getTotal())); + infoMap.put("securityList", xzSecurityRecordVo.getPage().getRecords()); + List statsByEnterpriseVoPage = xzSecurityQualityInspectionRecordService.statsByEnterprise(paramMap).getRecords(); + infoMap.put("quality", statsByEnterpriseVoPage); + List xzSecurityQualityInspectionRecordTotalVos = xzSecurityQualityInspectionRecordService.riskChart(paramMap); + infoMap.put("yearMonth", xzSecurityQualityInspectionRecordTotalVos); + Map paramMap1 = new HashMap<>(); + paramMap1.put("projectSn", projectSn); + paramMap1.put("isNotQualified", 0); + paramMap1.put("isOverdueRectification", 1); + List data = xzSecurityQualityInspectionRecordService.countDangerLevel(paramMap1).getData(); + infoMap.put("data", data); + Map paramMap2 = new HashMap<>(); + paramMap2.put("projectSn", projectSn); + paramMap2.put("isNotQualified", 1); + paramMap2.put("isOverdueRectification", 0); + List data1 = xzSecurityQualityInspectionRecordService.countDangerLevel(paramMap2).getData(); + infoMap.put("data1", data1); + + HashMap paramMap3 = new HashMap<>(); + paramMap3.put("projectSn", projectSn); + paramMap3.put("enumType", ""); + List trendOne = xzSecurityQualityInspectionRecordService.countQualityInspectionRecordRegion(paramMap3); + paramMap3.put("enumType", "1"); + List trendOne1 = xzSecurityQualityInspectionRecordService.countQualityInspectionRecordRegion(paramMap3); + paramMap3.put("enumType", "2"); + List trendOne2 = xzSecurityQualityInspectionRecordService.countQualityInspectionRecordRegion(paramMap3); + paramMap3.put("enumType", "3"); + List trendOne3 = xzSecurityQualityInspectionRecordService.countQualityInspectionRecordRegion(paramMap3); + paramMap3.put("enumType", "4"); + List trendOne4 = xzSecurityQualityInspectionRecordService.countQualityInspectionRecordRegion(paramMap3); + List> trendOneList = new ArrayList<>(); + for (TrendOneVo trendOneVo : trendOne) { + Map map4 = new HashMap<>(); + String name = trendOneVo.getX(); + map4.put("name", name); + map4.put("all", trendOneVo.getY()); + List collect = trendOne1.stream().filter(t -> t.getX().equals(name)).collect(Collectors.toList()); + map4.put("enumType1", collect.size() > 0 ? collect.get(0).getY() : "0"); + List collect1 = trendOne2.stream().filter(t -> t.getX().equals(name)).collect(Collectors.toList()); + map4.put("enumType2", collect1.size() > 0 ? collect1.get(0).getY() : "0"); + List collect2 = trendOne3.stream().filter(t -> t.getX().equals(name)).collect(Collectors.toList()); + map4.put("enumType3", collect2.size() > 0 ? collect2.get(0).getY() : "0"); + List collect3 = trendOne4.stream().filter(t -> t.getX().equals(name)).collect(Collectors.toList()); + map4.put("enumType4", collect3.size() > 0 ? collect3.get(0).getY() : "0"); + trendOneList.add(map4); + } + infoMap.put("trendOneList", trendOneList); + String [] status = {"", "未开始", "进行中", "已完成", "已逾期"}; + HashMap paramMap4 = new HashMap<>(); + paramMap4.put("sn", projectSn); + paramMap4.put("type", 2); + paramMap4.put("pageNo", 1); + paramMap4.put("pageSize", 9999); + List records = xzSecurityInspectTaskRecordService.selectInspectTaskRecordPage(paramMap4).getRecords(); + List> taskList = new ArrayList<>(); + for (XzSecurityInspectTaskRecordVo inspectTaskRecordVo : records) { + Map map4 = BeanUtil.beanToMap(inspectTaskRecordVo); + map4.put("statusName", status[inspectTaskRecordVo.getTaskStatus()]); + taskList.add(map4); + } + infoMap.put("taskList", taskList); + List taskIds = records.stream().map(r -> r.getId().toString()).collect(Collectors.toList()); + List taskItem = xzSecurityInspectTaskItemRecordService.selectInspectTaskItemRecordPage(paramMap4).getRecords(); + taskItem = taskItem.stream().filter(t -> taskIds.contains(t.get("taskId").toString())).collect(Collectors.toList()); + for (EntityMap entityMap : taskItem) { + String [] userList = entityMap.get("userlist"); + entityMap.put("users", String.join(",", userList)); + } + infoMap.put("taskItem", taskItem); + try { + XWPFDocument doc = WordExportUtil.exportWord07("word/安全.docx", infoMap); + response.setCharacterEncoding("UTF-8"); + response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(projectInfoBySn.getProjectName() + "安全信息.docx", "UTF-8")); + doc.write(response.getOutputStream()); + } catch (FileNotFoundException e) { + throw new RuntimeException(e); + } catch (IOException e) { + throw new RuntimeException(e); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @ApiOperation(value = "按模版导出质量信息", notes = "按模版导出质量信息", httpMethod = "GET") + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String") + @GetMapping(value = "/exportQualityInfo/{projectSn}") + public void exportQualityInfo(HttpServletResponse response, HttpServletRequest req, @PathVariable("projectSn")String projectSn) { + ProjectInfoExtVo projectInfoBySn = projectService.getProjectInfoBySn(projectSn); + Map infoMap = new HashMap<>(); + infoMap.put("projectName", projectInfoBySn.getProjectName()); + Map paramMap = new HashMap<>(); + paramMap.put("projectSn", projectInfoBySn.getProjectSn()); + paramMap.put("pageNo", 1); + paramMap.put("pageSize", 9999); + RecordVo recordVo = qualityInspectionRecordService.selectQualityInspectionRecordPage(paramMap); + infoMap.putAll(BeanUtil.beanToMap(recordVo.getTotal())); + infoMap.put("securityList", recordVo.getPage().getRecords()); + List statsByEnterpriseVoPage = qualityInspectionRecordService.statsByEnterprise(paramMap).getRecords(); + infoMap.put("quality", statsByEnterpriseVoPage); + List xzSecurityQualityInspectionRecordTotalVos = qualityInspectionRecordService.riskChart(paramMap); + infoMap.put("yearMonth", xzSecurityQualityInspectionRecordTotalVos); + Map paramMap1 = new HashMap<>(); + paramMap1.put("projectSn", projectSn); + paramMap1.put("isNotQualified", 0); + paramMap1.put("isOverdueRectification", 1); + List data = qualityInspectionRecordService.countDangerLevel(paramMap1).getData(); + infoMap.put("data", data); + Map paramMap2 = new HashMap<>(); + paramMap2.put("projectSn", projectSn); + paramMap2.put("isNotQualified", 1); + paramMap2.put("isOverdueRectification", 0); + List data1 = qualityInspectionRecordService.countDangerLevel(paramMap2).getData(); + infoMap.put("data1", data1); + + HashMap paramMap3 = new HashMap<>(); + paramMap3.put("projectSn", projectSn); + paramMap3.put("enumType", ""); + List trendOne = qualityInspectionRecordService.countQualityInspectionRecordRegion(paramMap3); + paramMap3.put("enumType", "1"); + List trendOne1 = qualityInspectionRecordService.countQualityInspectionRecordRegion(paramMap3); + paramMap3.put("enumType", "2"); + List trendOne2 = qualityInspectionRecordService.countQualityInspectionRecordRegion(paramMap3); + paramMap3.put("enumType", "3"); + List trendOne3 = qualityInspectionRecordService.countQualityInspectionRecordRegion(paramMap3); + paramMap3.put("enumType", "4"); + List trendOne4 = qualityInspectionRecordService.countQualityInspectionRecordRegion(paramMap3); + List> trendOneList = new ArrayList<>(); + for (TrendOneVo trendOneVo : trendOne) { + Map map4 = new HashMap<>(); + String name = trendOneVo.getX(); + map4.put("name", name); + map4.put("all", trendOneVo.getY()); + List collect = trendOne1.stream().filter(t -> t.getX().equals(name)).collect(Collectors.toList()); + map4.put("enumType1", collect.size() > 0 ? collect.get(0).getY() : "0"); + List collect1 = trendOne2.stream().filter(t -> t.getX().equals(name)).collect(Collectors.toList()); + map4.put("enumType2", collect1.size() > 0 ? collect1.get(0).getY() : "0"); + List collect2 = trendOne3.stream().filter(t -> t.getX().equals(name)).collect(Collectors.toList()); + map4.put("enumType3", collect2.size() > 0 ? collect2.get(0).getY() : "0"); + List collect3 = trendOne4.stream().filter(t -> t.getX().equals(name)).collect(Collectors.toList()); + map4.put("enumType4", collect3.size() > 0 ? collect3.get(0).getY() : "0"); + trendOneList.add(map4); + } + infoMap.put("trendOneList", trendOneList); + String [] status = {"", "未开始", "进行中", "已完成", "已逾期"}; + HashMap paramMap4 = new HashMap<>(); + paramMap4.put("sn", projectSn); + paramMap4.put("type", 2); + paramMap4.put("pageNo", 1); + paramMap4.put("pageSize", 9999); + List records = inspectTaskRecordService.selectInspectTaskRecordPage(paramMap4).getRecords(); + List> taskList = new ArrayList<>(); + for (InspectTaskRecordVo inspectTaskRecordVo : records) { + Map map4 = BeanUtil.beanToMap(inspectTaskRecordVo); + map4.put("statusName", status[inspectTaskRecordVo.getTaskStatus()]); + taskList.add(map4); + } + infoMap.put("taskList", taskList); + List taskIds = records.stream().map(r -> r.getId().toString()).collect(Collectors.toList()); + List taskItem = inspectTaskItemRecordService.selectInspectTaskItemRecordPage(paramMap4).getRecords(); + taskItem = taskItem.stream().filter(t -> taskIds.contains(t.get("taskId").toString())).collect(Collectors.toList()); + for (EntityMap entityMap : taskItem) { + String [] userList = entityMap.get("userlist"); + entityMap.put("users", String.join(",", userList)); + } + infoMap.put("taskItem", taskItem); + try { + XWPFDocument doc = WordExportUtil.exportWord07("word/质量.docx", infoMap); + response.setCharacterEncoding("UTF-8"); + response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(projectInfoBySn.getProjectName() + "安全信息.docx", "UTF-8")); + doc.write(response.getOutputStream()); + } catch (FileNotFoundException e) { + throw new RuntimeException(e); + } catch (IOException e) { + throw new RuntimeException(e); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @ApiOperation(value = "按模版导出劳务信息", notes = "按模版导出劳务信息", httpMethod = "GET") + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String") + @GetMapping(value = "/exportWorkerInfo/{projectSn}") + public void exportWorkerInfo(HttpServletResponse response, HttpServletRequest req, @PathVariable("projectSn")String projectSn) { + ProjectInfoExtVo projectInfoBySn = projectService.getProjectInfoBySn(projectSn); + Map infoMap = new HashMap<>(); + infoMap.put("projectName", projectInfoBySn.getProjectName()); + Map paramMap = new HashMap<>(); + paramMap.put("projectSn", projectInfoBySn.getProjectSn()); + List systemUser = systemUserService.getProjectChildernSystemUserList(paramMap); + infoMap.put("systemUser", systemUser); + List qualityRegions = qualityRegionService.selectQualityRegionList(paramMap); + infoMap.put("qualityRegions", qualityRegions); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(WorkerType::getProjectSn, projectSn); + List workerTypes = workerTypeService.list(queryWrapper); + infoMap.put("workerTypes", workerTypes); + List teamInfoList = teamInfoService.selectTeamDetailsList(paramMap); + infoMap.put("teamInfoList", teamInfoList); + List departmentInfos = departmentInfoService.selectDepartmentDetailsList(paramMap); + infoMap.put("departmentInfos", departmentInfos); + paramMap.put("pageNo", 1); + paramMap.put("pageSize", 9999); + List workerList = workerInfoService.selectWorkerInfoList(paramMap).getRecords(); + infoMap.put("workerList", workerList); + List workerIds = workerList.stream().map(w -> w.getId()).collect(Collectors.toList()); + List workerContracts = workerContractService.list(Wrappers.lambdaQuery().in(WorkerContract::getWorkerId, workerIds)); + List> workerContractList = new ArrayList<>(); + for (WorkerContract workerContract : workerContracts) { + Map map = BeanUtil.beanToMap(workerContract); + List collect = workerList.stream().filter(w -> w.getId().toString().equals(workerContract.getWorkerId().toString())).collect(Collectors.toList()); + map.put("workerName", collect.size() > 0 ? collect.get(0).getWorkerName() : ""); + workerContractList.add(map); + } + infoMap.put("workerContractList", workerContractList); + List workerCertificates = workerCertificateService.list(Wrappers.lambdaQuery().in(WorkerCertificate::getWorkerId, workerIds)); + infoMap.put("workerCertificates", workerCertificates); + List workerPhysicals = workerPhysicalsService.list(Wrappers.lambdaQuery().in(WorkerPhysicals::getWorkerId, workerIds)); + infoMap.put("workerPhysicals", workerPhysicals); + List workerInsurances = workerInsuranceService.list(Wrappers.lambdaQuery().in(WorkerInsurance::getWorkerId, workerIds)); + infoMap.put("workerInsurances", workerInsurances); + List trainRecordVos = workerInfoService.getTrainRecordsByWorkerId(paramMap); + infoMap.put("trainRecordVos", trainRecordVos); + List evaluateList = workerEvaluateService.selectWorkerEvaluatePageList(paramMap).getRecords(); + List eventType1 = evaluateList.stream().filter(e -> e.get("eventType").toString().equals("1")).collect(Collectors.toList()); + infoMap.put("eventType1", eventType1); + List eventType2 = evaluateList.stream().filter(e -> e.get("eventType").toString().equals("2")).collect(Collectors.toList()); + infoMap.put("eventType2", eventType2); + HashMap paramMap1 = new HashMap<>(); + paramMap.put("projectSn", projectInfoBySn.getProjectSn()); + List xzDeductScoreRecords = xzDeductScoreRecordService.queryList(paramMap1); + infoMap.put("xzDeductScoreRecords", xzDeductScoreRecords); + try { + XWPFDocument doc = WordExportUtil.exportWord07("word/劳务.docx", infoMap); + response.setCharacterEncoding("UTF-8"); + response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(projectInfoBySn.getProjectName() + "劳务信息.docx", "UTF-8")); + doc.write(response.getOutputStream()); + } catch (FileNotFoundException e) { + throw new RuntimeException(e); + } catch (IOException e) { + throw new RuntimeException(e); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private Map getProjectInfo(ProjectInfoExtVo projectInfoExtVo) { + List projectType = dictionaryItemService.getDictList("project_type", projectInfoExtVo.getProjectSn()); + List projectStructureType = dictionaryItemService.getDictList("project_structure_type", projectInfoExtVo.getProjectSn()); + List projectConstructionStage = dictionaryItemService.getDictList("project_construction_stage", projectInfoExtVo.getProjectSn()); + Map infoMap = BeanUtil.beanToMap(projectInfoExtVo); + List itemList = projectType.stream().filter(p -> p.getData().equals(projectInfoExtVo.getProjectType().toString())).collect(Collectors.toList()); + infoMap.put("projectTypeName", itemList.size() > 0 ? itemList.get(0).getName() : ""); + List itemList1 = projectStructureType.stream().filter(p -> p.getData().equals(projectInfoExtVo.getStructureType().toString())).collect(Collectors.toList()); + infoMap.put("structureTypeName", itemList1.size() > 0 ? itemList1.get(0).getName() : ""); + List itemList2 = projectConstructionStage.stream().filter(p -> p.getData().equals(projectInfoExtVo.getConstructionStage().toString())).collect(Collectors.toList()); + infoMap.put("constructionStageName", itemList2.size() > 0 ? itemList2.get(0).getName() : ""); + infoMap.put("majorProjectTypeName", projectInfoExtVo.getMajorProjectType() == 1 ? "是" : "否"); + infoMap.put("bulidStatusName", getProjectState(projectInfoExtVo.getBulidStatus())); + return infoMap; + } + + private List> getEnterpriseSupplierInfo(List list, List enterpriseInfoList) { + List> list1 = new ArrayList<>(); + String projectSn = list.get(0).getProjectSn(); + List projectType = dictionaryItemService.getDictList("project_type", projectSn); + List projectStructureType = dictionaryItemService.getDictList("project_structure_type", projectSn); + List projectConstructionStage = dictionaryItemService.getDictList("project_construction_stage", projectSn); + for (ProjectEnterpriseSupplierInfo projectEnterpriseSupplierInfo : list) { + Map infoMap = BeanUtil.beanToMap(projectEnterpriseSupplierInfo); + List itemList = projectType.stream().filter(p -> p.getData().equals(projectEnterpriseSupplierInfo.getProjectType().toString())).collect(Collectors.toList()); + infoMap.put("projectTypeName", itemList.size() > 0 ? itemList.get(0).getName() : ""); + List itemList1 = projectStructureType.stream().filter(p -> p.getData().equals(projectEnterpriseSupplierInfo.getStructureType().toString())).collect(Collectors.toList()); + infoMap.put("structureTypeName", itemList1.size() > 0 ? itemList1.get(0).getName() : ""); + List itemList2 = projectConstructionStage.stream().filter(p -> p.getData().equals(projectEnterpriseSupplierInfo.getConstructionStage().toString())).collect(Collectors.toList()); + infoMap.put("constructionStageName", itemList2.size() > 0 ? itemList2.get(0).getName() : ""); + infoMap.put("bulidStatusName", getProjectState(projectEnterpriseSupplierInfo.getBulidStatus())); + List itemList3 = enterpriseInfoList.stream().filter(p -> p.getId().toString().equals(projectEnterpriseSupplierInfo.getEnterpriseId().toString())).collect(Collectors.toList()); + infoMap.put("enterpriseName", itemList3.size() > 0 ? itemList3.get(0).getEnterpriseName() : ""); + list1.add(infoMap); + } + return list1; + } + + private List> getEnterpriseInfo(List enterpriseInfoList, List enterpriseTypeList) { + String [] nature = {"国有企业", "三资企业", "集体企业", "私营企业"}; + List> enterpriseMapList = new ArrayList<>(); + for (EnterpriseInfo enterpriseInfo : enterpriseInfoList) { + List collect = enterpriseTypeList.stream().filter(e -> e.getId().toString().equals(enterpriseInfo.getEnterpriseTypeId().toString())).collect(Collectors.toList()); + enterpriseInfo.setEnterpriseTypeName(collect.size() > 0 ? collect.get(0).getCompanyTypeName() : ""); + Map map = BeanUtil.beanToMap(enterpriseInfo); + map.put("enterpriseProperty", nature[enterpriseInfo.getEnterpriseProperty() + 1]); + enterpriseMapList.add(map); + } + return enterpriseMapList; + } + + private String getProjectState(int state) { + String name = ""; + switch (state) { + case 0 : + name = "未开工"; + break; + case 1 : + name = "在建"; + break; + case 2 : + name = "停工"; + break; + case 3 : + name = "验收"; + break; + case 4 : + name = "完工"; + break; + } + return name; + } +} diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/ModuleTalkController.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/ModuleTalkController.java new file mode 100644 index 000000000..6db688eb7 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/ModuleTalkController.java @@ -0,0 +1,169 @@ +package com.zhgd.xmgl.modules.basicdata.controller; + +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zhgd.jeecg.common.api.vo.Result; +import com.zhgd.xmgl.modules.project.entity.ProjectExtend; +import com.zhgd.xmgl.modules.project.entity.vo.ProjectInfoExtVo; +import com.zhgd.xmgl.modules.project.service.IProjectExtendService; +import com.zhgd.xmgl.modules.project.service.IProjectService; +import com.zhgd.xmgl.util.PageUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.MapUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.*; + +/** + * @program: wisdomSite + * @description: dift接口 + * @author: Mr.Peng + * @create: 2020-12-21 09:33 + **/ +@RestController +@RequestMapping("/xmgl/modelDify") +@Slf4j +@Api(tags = "dify对话接口") +public class ModuleTalkController { + @Resource + private IProjectExtendService projectExtendService; + + @ApiOperation(value = "发起对话", notes = "对话", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "chatId", value = "对话ID(新对话无需传)", dataType = "String"), + @ApiImplicitParam(name = "content", value = "对话内容", required = true, dataType = "String"), + @ApiImplicitParam(name = "projectSn", value = "项目SN", required = true, dataType = "String") + }) + @PostMapping(value = "/chat") + public Result chat(@RequestBody @ApiIgnore Map map) { + ProjectExtend config = getConfig(map); + String url = "https://cloud.fastgpt.cn/api/v1/chat/completions"; + String chatId = MapUtils.getString(map, "chatId"); + String content = MapUtils.getString(map, "content"); + if (StringUtils.isBlank(chatId)) { + chatId = UUID.randomUUID().toString().replace("-", "").toUpperCase(); + } + Map param = new HashMap<>(16); + Map message = new HashMap<>(16); + message.put("role", "user"); + message.put("content", content); + List> messages = new ArrayList<>(); + messages.add(message); + param.put("chatId", chatId); + param.put("stream", false); + param.put("detail", false); + param.put("messages", messages); + String body = JSONUtil.toJsonStr(param); + String post = HttpUtil.createPost(url) + .addHeaders(buildHeader(config.getModelKey())).body(body).timeout(5000).execute().body(); + return Result.success(post); + } + + @ApiOperation(value = "对话列表", notes = "查询对话列表", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "pageNo", value = "偏移量,即从第几条数据开始取", paramType = "query", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "pageSize", value = "记录数量", paramType = "query", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "projectSn", value = "项目SN", required = true, dataType = "String") + }) + @PostMapping(value = "/chatList") + public Result chatList(@RequestBody @ApiIgnore Map map) { + ProjectExtend config = getConfig(map); + String url = "https://cloud.fastgpt.cn/api/core/chat/getHistories"; + Page page = PageUtil.getPage(map); + Map param = new HashMap<>(16); + param.put("appId", config.getModelUrl()); + param.put("offset", page.getCurrent()); + param.put("pageSize", page.getSize()); + param.put("source", "api"); + String body = JSONUtil.toJsonStr(param); + String post = HttpUtil.createPost(url) + .addHeaders(buildHeader(config.getModelKey())).body(body).timeout(5000).execute().body(); + return Result.success(post); + } + + @ApiOperation(value = "对话列表", notes = "修改对话标题", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "chatId", value = "对话ID", paramType = "query", required = true, dataType = "String"), + @ApiImplicitParam(name = "customTitle", value = "对话标题", paramType = "query", required = true, dataType = "String"), + @ApiImplicitParam(name = "projectSn", value = "项目SN", required = true, dataType = "String") + }) + @PostMapping(value = "/updateChatTitle") + public Result updateChatTitle(@RequestBody @ApiIgnore Map map) { + ProjectExtend config = getConfig(map); + String url = "https://cloud.fastgpt.cn/api/core/chat/updateHistory"; + Map param = new HashMap<>(16); + param.put("appId", config.getModelUrl()); + param.put("chatId", MapUtils.getString(map, "chatId")); + param.put("customTitle", MapUtils.getString(map, "customTitle")); + String body = JSONUtil.toJsonStr(param); + String post = HttpUtil.createPost(url) + .addHeaders(buildHeader(config.getModelKey())).body(body).timeout(5000).execute().body(); + return Result.success(post); + } + + @ApiOperation(value = "对话列表", notes = "置顶/取消置顶对话", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "chatId", value = "对话ID", paramType = "query", required = true, dataType = "String"), + @ApiImplicitParam(name = "top", value = "true/false", paramType = "query", required = true, dataType = "Boolean"), + @ApiImplicitParam(name = "projectSn", value = "项目SN", required = true, dataType = "String") + }) + @PostMapping(value = "/chatTop") + public Result chatTop(@RequestBody @ApiIgnore Map map) { + ProjectExtend config = getConfig(map); + String url = "https://cloud.fastgpt.cn/api/core/chat/updateHistory"; + Map param = new HashMap<>(16); + param.put("appId", config.getModelUrl()); + param.put("chatId", MapUtils.getString(map, "chatId")); + param.put("top", MapUtils.getString(map, "top")); + String body = JSONUtil.toJsonStr(param); + String post = HttpUtil.createPost(url) + .addHeaders(buildHeader(config.getModelKey())).body(body).timeout(5000).execute().body(); + return Result.success(post); + } + + @ApiOperation(value = "对话内容列表", notes = "查询对话内容", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "pageNo", value = "偏移量,即从第几条数据开始取", paramType = "query", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "pageSize", value = "记录数量", paramType = "query", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "chatId", value = "对话ID", paramType = "query", required = true, dataType = "String"), + @ApiImplicitParam(name = "projectSn", value = "项目SN", required = true, dataType = "String") + }) + @PostMapping(value = "/chatContentList") + public Result chatContentList(@RequestBody @ApiIgnore Map map) { + ProjectExtend config = getConfig(map); + String url = "https://cloud.fastgpt.cn/api/core/chat/getPaginationRecords"; + Page page = PageUtil.getPage(map); + Map param = new HashMap<>(16); + param.put("appId", config.getModelUrl()); + param.put("offset", page.getCurrent()); + param.put("pageSize", page.getSize()); + param.put("chatId", MapUtils.getString(map, "chatId")); + String body = JSONUtil.toJsonStr(param); + String post = HttpUtil.createPost(url) + .addHeaders(buildHeader(config.getModelKey())).body(body).timeout(5000).execute().body(); + return Result.success(post); + } + + private ProjectExtend getConfig(Map map) { + String projectSn = MapUtils.getString(map, "projectSn"); + ProjectExtend projectExtend = projectExtendService.getOne(Wrappers.lambdaQuery().eq(ProjectExtend::getProjectSn, projectSn)); + return projectExtend; + } + + private Map buildHeader(String apiKey) { + Map header = new HashMap<>(); + header.put("Authorization", "Bearer " + apiKey); + return header; + } +} diff --git a/src/main/java/com/zhgd/xmgl/modules/car/controller/CarPassRecordController.java b/src/main/java/com/zhgd/xmgl/modules/car/controller/CarPassRecordController.java index 08486665b..32a1dd191 100644 --- a/src/main/java/com/zhgd/xmgl/modules/car/controller/CarPassRecordController.java +++ b/src/main/java/com/zhgd/xmgl/modules/car/controller/CarPassRecordController.java @@ -196,17 +196,6 @@ public class CarPassRecordController { map.put("closeup_pic", closeupPic); map.put("type", type); log.info("saveCarPassRecord:{}", JSON.toJSONString(map)); - if (EnvironmentUtil.getActiveEnvironment().equals("baise") && Objects.equals(parkId, "F20D19C31C5140C585185BAB10E8D9A2")) { - CompletableFuture.runAsync(() -> { - //木垒转发 - String result2 = HttpRequest.post(PathUtil.getMlTranspondUrl() + "/xmgl/carPassRecord/saveCarPassRecord") - .form(map) - .timeout(2000)//超时,毫秒 - .execute().body(); - log.info("木垒转发车牌识别结果:{}", result2); - }); - } - Map data = new HashMap<>(16); String online = "online"; String offline = "offline"; diff --git a/src/main/java/com/zhgd/xmgl/modules/video/service/impl/AiAnalyseHardWareAlarmRecordServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/video/service/impl/AiAnalyseHardWareAlarmRecordServiceImpl.java index e15869a43..2d24a0584 100644 --- a/src/main/java/com/zhgd/xmgl/modules/video/service/impl/AiAnalyseHardWareAlarmRecordServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/video/service/impl/AiAnalyseHardWareAlarmRecordServiceImpl.java @@ -187,16 +187,16 @@ public class AiAnalyseHardWareAlarmRecordServiceImpl extends ServiceImpl { - //木垒转发 - String result2 = HttpRequest.post(PathUtil.getMlTranspondUrl() + "/xmgl/api/saveHardWareAlarm") - .body(JSON.toJSONString(body)) - .timeout(2000)//超时,毫秒 - .execute().body(); - log.info("木垒AI预警转发结果:{}", result2); - }); - } +// if (EnvironmentUtil.getActiveEnvironment().equals("baise")) { +// CompletableFuture.runAsync(() -> { +// //木垒转发 +// String result2 = HttpRequest.post(PathUtil.getMlTranspondUrl() + "/xmgl/api/saveHardWareAlarm") +// .body(JSON.toJSONString(body)) +// .timeout(2000)//超时,毫秒 +// .execute().body(); +// log.info("木垒AI预警转发结果:{}", result2); +// }); +// } QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.lambda().eq(AiAnalyseHardWareRecord::getHardwareId, body.getString("hardwareId")); AiAnalyseHardWareRecord aiAnalyseHardWareRecord = aiAnalyseHardWareRecordMapper.selectOne(queryWrapper); diff --git a/src/main/java/com/zhgd/xmgl/security/WebSecurityConfig.java b/src/main/java/com/zhgd/xmgl/security/WebSecurityConfig.java index 62b8f3dec..7873861de 100644 --- a/src/main/java/com/zhgd/xmgl/security/WebSecurityConfig.java +++ b/src/main/java/com/zhgd/xmgl/security/WebSecurityConfig.java @@ -428,6 +428,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { .antMatchers("/xmgl/workerAttendance/viewDayAttendanceList").permitAll() .antMatchers("/xmgl/workerAttendanceRule/queryById").permitAll() .antMatchers("/xmgl/tunnelBoringMachineCurrentData/add").permitAll() + .antMatchers("/xmgl/modelDownload/**").permitAll() .antMatchers(HttpMethod.OPTIONS, "/**").anonymous() .anyRequest().authenticated() // 剩下所有的验证都需要验证. .and() diff --git a/src/main/resources/word/AI预警.docx b/src/main/resources/word/AI预警.docx new file mode 100644 index 000000000..cc93883b3 --- /dev/null +++ b/src/main/resources/word/AI预警.docx @@ -0,0 +1,76 @@ + + {{projectName}}数据汇总 + + AI预警管理: + +AI预警设备管理: +设备名称 +设备编号 +{{fe:$aiDev t.hardwareName +t.hardwareId}} + +扣分规则: +AI预警类型 +扣分分值 +{{fe:$ruleList t.typeName +t.deductScore +}} + +待管理员处置的AI违章: +AI预警类型 +总数量(条数) +{{fe:$list1 t.name +t.count +}} + +待管理员处置的AI违章记录: +AI预警类型 +违章区域 +抓拍时间 +{{fe:$list2 t.alarmTypeName + +t.qualityRegionName + +t.createTime +}} + +各个区域下面待处置的AI违章抓拍统计: +区域名称 +数量(条数) +{{fe:$list3 t.name +t.count +}} + +管理员已处置的AI违章: +AI预警类型 +总数量(条数) +{{fe:$list4 t.name +t.count +}} + +管理员已处置的AI违章记录: +AI预警类型 +违章区域 +抓拍时间 +扣分分值 +违章人员 +{{fe:$list5 t.alarmTypeName + +t.qualityRegionName + +t.createTime + + +t.deductScore + + +t.worker_info_str +}} + +各个区域下面已处置的AI违章抓拍统计: +区域名称 +数量(条数) +{{fe:$list6 t.name +t.count +}} + diff --git a/src/main/resources/word/分包单位信息.docx b/src/main/resources/word/分包单位信息.docx new file mode 100644 index 000000000..f84fe8b4c --- /dev/null +++ b/src/main/resources/word/分包单位信息.docx @@ -0,0 +1,154 @@ + + {{projectName}}数据汇总 + +2、合作单位:承包商总数量:{{total}}个 +专业分包:{{total}}个 +设备分包:{{total}}个 +材料分包:{{total}}个 +后勤服务:{{enterpriseType4}}个 +特殊设备:{{enterpriseType5}}个 +劳务分包:{{enterpriseType6}}个 +监理单位:{{enterpriseType7}}个 +建设单位:{{enterpriseType8}}个 +总承包单位:{{enterpriseType9}}个 +勘查单位:{{enterpriseType10}}个 +设计单位:{{enterpriseType11}}个 +其它:{{enterpriseType12}}个 + + 承包商信息: + 企业名称 + 企业类型 + 法定代表人 + 开户行 + 统一社会信用代码 + + 注册人申请电话 + 注册资金(万元) + + 法人电话 + 银行账号 + 营业执照截止日期 + 营业执照注册号 + 企业邮箱 + 企业地址 + 劳资证书号 + 安全生产许可证 + 单位性质 + + 项目负责人 + + 项目负责人电话 + + {{fe:$enterpriseList t.enterpriseName + t.enterpriseTypeName + + t.enterpriseLegalPerson + + t.bankname + + t.socialCode + + t.registerPersonPhoneTel + + t.registeredCapital + + t.legalPersonTel + + t.bankcardnumber + + t.businessLicenseEndDate + + t.businessNumber + + t.enterpriseEmail + + t.enterpriseAddress + + t.qualificationNumber + + t.enterpriseSafeAllow + + t.enterpriseProperty + + t.projectDirectorName + + t.projectDirectorPhone + }} + + 承包商项目信息: + 承包商名称 + 承包项目名称 + 项目施工区域 + 项目经理 + 项目类型 + 项目编号 + 施工阶段 + 经度位置 + 纬度位置 + 工程类别 + 结构类型 + 项目面积(m²) + 工程状态 + 开工日期 + 竣工日期 + 联系电话 + {{fe:$supplierList + t.enterpriseName + t.cbsName + + t.projectBuildArea + + t.projectManage + + t.projectTypeName + + t.projectNumber + + t.constructionStageName + + t.longitude + + t.latitude + + t.projectTypeName + + t.structureTypeName + + t.projectAcreage + + t.bulidStatusName + + t.startWorkDate + + t.completionDate + + t.projectTel}} + + + 5、承包商的企业资质: +承包商名称 +资质类型 +资质文件编号 +资质文件名称 + {{fe:$qualificationList + t.enterpriseName + t.qualificationTypeName + + t.fileNumber + + t.fileName}} + + + 6、承包商的不良记录: +承包商名称 +发生时间 +发生事项 +发生原因 + {{fe:$badRecord + t.enterpriseName + t.ariseTime + + t.ariseMatter + + t.ariseReason}} + diff --git a/src/main/resources/word/劳务.docx b/src/main/resources/word/劳务.docx new file mode 100644 index 000000000..5351a9473 --- /dev/null +++ b/src/main/resources/word/劳务.docx @@ -0,0 +1,465 @@ + + {{projectName}}数据汇总 + + 1、系统权限: + 姓名 + 组织名称 + 角色 + {{fe:$systemUser + t.realName + t.projectOrgName + + t.roleName + }} + + 区域名称 + 责任单位 + 责任人 + {{fe:$qualityRegions + t.regionName + t.enterpriseName + + t.dutyUserName + }} + + 2、劳务人员管理系统: +工种类型包含:3个 + 工种名称 + {{fe:$workerTypes + t.typeName}} + +劳务管理设备数量:5个 +劳务管理出口设备数量:5个 +劳务管理入口设备数量:5个 +当前在册总人数:1000人 +当前在册管理人员总数:500人 +当前在册劳务人员总数:500人 +当前在册临时人员总数:500人 + +当前出勤总人数:1000人 +当前出勤管理人员总数:500人 +当前出勤劳务人员总数:500人 + +当前实时在场总人数:1000人 +当前工地实时在场管理人员总数:500人 +当前工地实时在场劳务人员总数:500人 + +今日新入场人数:60人 +今日新入场管理人员总数:500人 +今日新入场劳务人员总数:500人 +今日新入场临时人员总数:500人 + +今日新离职人数:60人 +今日新离职管理人员总数:500人 +今日新离职劳务人员总数:500人 +班组统计: + 公司名称 + 班组名称 + {{fe:$teamInfoList + t.enterpriseName + + t.teamName + }} + +部门统计: + 公司名称 + 部门名称 + {{fe:$departmentInfos + t.enterpriseName + + t.departmentName + }} + +人员基本信息: +( +$fe:workerList [workerName] +) + 姓名 + 杨杰 + 性别 + 女 + 身份证号码 + 520221200303120466 + 开户行 + + 银行卡号 + + 登记日期 + + 退场日期 + + 班组 + 电工 + 工号 + + 出生日期 + + 民族 + + 籍贯 + + 发证机关 + + 身份证有效日期 + + 电话 + + 紧急联系人 + + 紧急联系人电话 + + 进场日期 + + 在职状态 + + 婚姻状态 + + 银行卡发卡行 + + 学历 + + 邮箱 + + 人员性质 + + 血型 + + 政治面貌 + + 考勤规则 + + 人员定位标签号 + + 人脸设备 + + 当前安全评分分值 + +劳动合同: + +姓名 +劳动合同签订状态 +已签订编号 +签订合同类型 +合同期限 +合同开始日期 +失效日期 +工资核定方式 +工资核定标准(单位:元) + {{fe:$workerContractList + t.workerName + + t.signStateName + t.contractNumber + t.contractType + t.laboCcontractType + t.contractBeginDate + + t.contractEndDate + + t.wagesVerificationType + + t.wagesVerificationStandard + }} + +资格证书: + +姓名 +证书类型 +证书编号 +技能等级 +发证日期 +截止有效期 +发证机关 +备注 + {{fe:$workerCertificates + t.workerName + + t.certificateType + t.certificateNumber + t.skillLevel + t.issueTime + t.effectTime + + t.issueCompany + + t.remarks}} + +体检信息: + +姓名 +人员身高(cm) +人员体重(kg) +血型 +体检时间 +状态 +结论 + {{fe:$workerPhysicals t.workerName + + t.personHeight + t.personWeight + t.bloodType + t.physicalsTime + t.state + + t.conclusion}} + + +工伤保险: + +姓名 +保险购买日期 +保险到期日期 +状态 +险种 +是否是城乡居民医疗保险 +是否是城乡居民养老保险 + {{fe:$workerInsurances + t.workerName + + t.insuranceTime + t.expireTime + t.state + t.insuranceType + t.medicalInsurance + + t.endowmentInsurance}} + + +安全教育: + +姓名 +培训日期 +培训主题 +考试分数 +是否及格 + {{fe:$trainRecordVos + t.workerName + + t.date + t.subject + t.score + t.isPass}} + +从业信息: + +姓名 +参与项目 +进场日期 +退场日期 +工种 +班组 +杨杰 +Xxx +2025-03-04 +2025-03-04 +Xxx +xxx + +不良记录: + +姓名 +发生时间 +事件/发生原因 +奖项 +备注 +{{fe:$eventType1 +t.workerName + +t.eventTime +t.eventTitle / t.reason +t.awardName +t.remarks}} + +奖励记录: + +姓名 +发生时间 +事件/发生原因 +严重程度 +备注 +{{fe:$eventType2 +t.workerName + +t.eventTime +t.eventTitle / t.reason +t.seriousGrade +t.remarks}} + +安全分详情: + +姓名 +时间 +原因 +加/扣分值 +当前安全评分分值 +{{fe:$xzDeductScoreRecords +t.workerName + +t.createDate + +t.deductReason +t.deductScore + +t.curScore +}} + +考勤明细: +企业名称 +所属班组/部门 +人员类型 +姓名 +在职状态 +进入/出 +出入时间 +进出位置 +进出方式 +佳信捷 +电工 +劳务人员 +杨杰 +在职 +进入 +2025-03-04 12:30:30 +正门闸机1 +人脸识别 + +人员出勤统计: +企业名称 +总包/分包 +人员类型 +工地总人数 +今日出勤人数 +今日在场人数 +企业出勤排名 +今日未履职人数 +今日项目经理未履职人数 +今日安全员未履职人数 +今日质量员未履职人数 +今日监理未履职人数 +佳信捷 +总包 +劳务人员 +100 +进入 +2025-03-04 12:30:30 +0 +20 +5 +5 +5 +5 +佳信捷2 +分包 +劳务人员 +100 +进入 +2025-03-04 12:30:30 +1 +12 +5 +5 +5 +5 + +班组/部门出勤统计: +班组名称 +在册人数 +出勤人数 +在场人数 +电工 +1 +11 +1 +瓦工 +1 +1 +2 + +安全培训管理: +培训日期 +教育类型 +培训主题 +培训课时 +培训人 +人数 +2025-03-04 12:30:30 +入场安全教育 +电工安全 +12 +xx +12 + +证书逾期预警列表: +人员类型 +企业名称 +班组、部门 +姓名 +证书类型 +到期时间 +预警提示时间 +管理人员 +佳信捷 +电工 +杨杰 +电工证 +2025-03-04 12:30:30 +2025-03-04 12:30:30 + +处罚单: +单据类型 +项目名称 +编号 +被罚款单位 +违章性质 +违章时间 +罚款内容 +罚款金额 +创建时间 +罚款单 +尾矿固废资源综合利用项目 +1231 +中恒建设集团有限公司 +Xx +2025-03-04 12:30:30 +Xxxx +1111 +2025-03-04 12:30:30 + +人员风险概览: +企业名称 +低风险人员数量 +中等风险数量 +高风险数量 +佳信捷 +11 +11 +11 + +企业安全评分汇总表: +企业名称 +企业安全评分分值 +佳信捷 +95 + +企业人员安全评分考核明细表: +企业名称 +姓名 +安全评分分值 +人员加/扣分记录 +佳信捷 +杨杰 +12 +xxxxx + +人脸设备管理: +设备名称 +设备唯一标识 +所属单位 +是否是进场方向设备 +是否是出场方向设备 +111 +1212 +佳信捷 +是 +x + diff --git a/src/main/resources/word/安全.docx b/src/main/resources/word/安全.docx new file mode 100644 index 000000000..c31cc9ee8 --- /dev/null +++ b/src/main/resources/word/安全.docx @@ -0,0 +1,274 @@ + + {{projectName}}数据汇总 + + 车辆管理: + + 车辆黑白名单管理台账记录: + 企业名称 + 车牌号 + 车种类型 + 司机姓名 + 司机电话 + 是否黑名单 + 车辆类型 + 预约时间 + 允许进出次数 + {{fe:$carInfos + t.enterpriseName + t.carNumber + t.carTypeName + t.driverWorkerName + t.driverTelephone + t.isBackName + + + t.carModuleTypeName + t.reserveStartTime 至 t.reserveEndTime + t.entryAndExitPermitName}} + + + 项目所含车种类型: + 类型名称 + 轿车 + {{fe:$carTypeList + + t.carTypeName + }} + + 今日车辆出入记录统计: + 今日总进场车次:{{innum}} + 外来车辆进场车次:{{wlcInNum}} + 固定车进场车次:{{gdcInNum}} + 今日总出场车次:{{outnum}} + 长期车进场车次:{{cqcInNum}} + 临时车进场车次:{{lscInNum}} + + 车辆数量统计: + 车辆类型 + 数量 + 占车辆数量之比 + {{fe:$carModuleTypeList + t.name + + t.num + t.ratio + }} + + + 车种进出次数统计: + 车种类型 + 进出方向 + 次数 + {{fe:$carTypePass + t.carTypeName + + + t.type + + t.num + }} + + + 实时数据: + 企业名称 + 司机姓名 + 车辆类型 + 车牌号 + 进出时间 + 进出标识 + 进出位置 + 进出场图片 + 全景图照片 + {{fe:$passRecordList + t.enterpriseName + t.driverWorkerName + + t.carModuleTypeName + + + t.carNumber + + t.passTime + + t.typeName + + + t.location + + t.imageUrl + + t.panoramaUrl + }} + + + + + 安全管理: + 安全检查隐患总数:{{totalNum}} + 已闭合安全检查隐患总数:{{closeNum}} + 未闭合安全检查隐患总数:{{notCloseNum}} + 超期未关闭安全检查隐患总数:{{overdueNotCloseNum}} + 待整改安全检查隐患总数:{{rectificationNum}} + 待复查安全检查隐患总数:{{reviewNum}} + 待核验安全检查隐患总数:{{verificationNum}} + + 安全检查结果 + 安全检查人 + 安全检查时间 + 安全检查部位 + 安全问题描述 + 补充说明 + 整改要求 + 问题等级 + 紧急程度 + 安全整改人 + 安全整改时限 + 安全复查人 + 安全核验人 + 安全检查类型 + 分包单位 + 现场整改是否已完成 + 安全隐患事件描述 + 安全隐患问题描述 + {{fe:$passRecordList t.enterpriseName + t.inspectManName + t.inspectTime + t.regionName + t.dangerItemContent + t.dangerDesc + + t.remark + + t.level + + t.urgentLevel + + t.changeName + t.changeLimitTime + t.reviewName + t.verifyManName + 安全问题 + t.enterpriseName + 未完成 + t.addedDescription + t.problemDescription}} +安全整改检查记录: + +安全风险分析: +安全管理记录总条数=安全隐患记录+排查记录 + 安全管理记录总条数:{{totalNum}} + 安全隐患记录总条数:{{dangerNum}} + 排查记录总条数:{{investigateNum}} + 重大安全隐患总条数:{{greatFaultLevelNum}} + 超期未闭合安全隐患总条数:{{overdueNotCloseNum}} + +分包单位安全隐患统计: + 企业名称 + 企业类型 + 安全隐患记录数量 + {{fe:$quality t.enterpriseName + 总包 + t.totalNum}} + +安全风险统计: + 安全风险总数:{{dangerNum}} + 重大安全风险:{{greatFaultLevelNum}} + 较大安全风险:{{largerRiskNum}} + 一般安全风险:{{generalRiskNum}} + 低安全风险:{{lowRiskNum}} + +近一年检查到的安全隐患级别风险统计: + 月份 + 重大风险安全隐患数量 + 较大风险安全隐患数量 + 一般风险安全隐患数量 + 低风险安全隐患数量 + {{fe:$yearMonth t.yearMonth + t.greatFaultLevelNum + t.largerRiskNum + t.generalRiskNum + t.lowRiskNum}} + +安全隐患超期未整改统计: + 隐患严重程度 + 数量 + 占比 + {{fe:$data + t.name + t.count + t.percent}} + + +安全隐患未销项统计: + 隐患严重程度 + 数量 + 占比 + {{fe:$data1 + t.name + t.count + t.percent}} + +责任区域安全隐患问题统计: + 区域名称 + 区域下全部安全隐患数量 + 区域下重大安全隐患数量 + 区域下较大安全隐患数量 + 区域下一般安全隐患数量 + 区域下低安全隐患数量 + {{fe:$trendOneList + t.name + t.all + + t.enumType1 + + t.enumType2 + + t.enumType3 + + t.enumType4 + }} + +项目安全自检任务完成统计: + 安全检查任务名称 + 创建人 + 计划检查时间 + 子任务完成度 + 子任务完成状态 + 执行任务过程中发现的安全隐患总数 + 未闭合安全隐患数量 + 检查说明 + {{fe:$taskList + t.taskName + t.createUserName + + t.startTime - t.endTime + t.taskCompleteNum/t.taskNum + + t.statusName + + t.count.inspectNum + + t.count.notEndNum + t.inspectRemark}} + + +安全检查任务下的子任务完成统计: + 检查任务名称 + 子任务名称 + 检查人 + 检查时间 + 安全隐患总数 + 未闭合安全隐患数 + {{fe:$taskItem + t.taskName + t.itemName + + t.users + + t.startTime - t.endTime + + t.count.inspectNum + + t.count.notEndNum}} + + diff --git a/src/main/resources/word/环境监测数据.docx b/src/main/resources/word/环境监测数据.docx new file mode 100644 index 000000000..c6fa4540a --- /dev/null +++ b/src/main/resources/word/环境监测数据.docx @@ -0,0 +1,130 @@ + + {{projectName}}数据汇总 + + 环境监测: + 扬尘设备管理: + 设备名称 + 设备编号 + 设备状态 + 分包单位 + 设备地址 + 备案时间 + {{$fe:environmentDev t.deviceName + t.deviceId + t.isEnable + t.enterpriseIds + t.address + t.createTime}} + + 喷淋设备管理: + 设备名称 + 设备编号 + 喷淋模式 + 开关状态 + {{$fe:sprayDev t.devName + t.devSn + t.sprayMode + t.switchStatus}} + + 预警值设置: + 设备名称 + 设备编号 + PM2.5阈值 + PM10阈值 + Tsp阈值 + 风速阈值 + 噪音阈值 + 湿度阈值 + 最低温度阈值 + 最高温度阈值 + pm2.5预警是否推送 + {{$fe:warning t.devName + t.devSn + t.pm25Warning + t.pm10Warning + t.realTimeTsp + t.windSpeed + t.noiseWarning + t.realTimeHumidity + t.minTemperature + t.maxTemperature + t.isNotPush}} + + 报警值设置: + 设备名称 + 设备编号 + PM2.5阈值 + PM10阈值 + Tsp阈值 + 风速阈值 + 噪音阈值 + 湿度阈值 + 最低温度阈值 + 最高温度阈值 + pm2.5预警是否推送 + {{$fe:alarm t.devName + t.devSn + t.pm25Warning + t.pm10Warning + t.realTimeTsp + t.windSpeed + t.noiseWarning + t.realTimeHumidity + t.minTemperature + t.maxTemperature + t.isNotPush}} + + 环境监测数据台账记录: + 设备名称 + 温度 + 噪声 + 板载湿度 + 板载温度 + Pm10 + Pm25 + 大气压 + 温度 + tsp测试值 + 电压 + 风向 + 风速 + 监测时间 + {{$fe:dustNoiseDataList t.devName + t.temperature + t.noise + t.plateHumidity + t.plateTemperature + t.pm10 + t.pm25 + t.pressure + t.temperature + t.tsp + t.voltage + t.winddirection + t.windspeed + t.uploadDate}} + + 环境报警预警数据台账记录: + 设备名称 + 报警类型 + 报警名称 + 报警值 + 阈值 + 超标时间 + 超标量 + {{$fe:envieronmentAlarms t.devName + t.alarmTypeName + t.alarmCause + t.avgData + t.alarmValue + t.alarmTime + t.exceed}} + + 喷淋运行台账记录: + 设备名称 + 开始时间 + 结束时间 + {{$fe:sprayRtData t.devName + t.beginTime + t.endTime}} + diff --git a/src/main/resources/word/质量.docx b/src/main/resources/word/质量.docx new file mode 100644 index 000000000..7cf391080 --- /dev/null +++ b/src/main/resources/word/质量.docx @@ -0,0 +1,171 @@ + + {{projectName}}数据汇总 + + 质量管理: + 质量检查隐患总数:{{totalNum}} + 已闭合质量检查隐患总数:{{closeNum}} + 未闭合质量检查隐患总数:{{notCloseNum}} + 超期未关闭质量检查隐患总数:{{overdueNotCloseNum}} + 待整改质量检查隐患总数:{{rectificationNum}} + 待复查质量检查隐患总数:{{reviewNum}} + 待核验质量检查隐患总数:{{verificationNum}} + + 质量检查结果 + 质量检查人 + 质量检查时间 + 质量检查部位 + 质量问题描述 + 补充说明 + 整改要求 + 问题等级 + 紧急程度 + 质量整改人 + 质量整改时限 + 质量复查人 + 质量核验人 + 质量检查类型 + 分包单位 + 现场整改是否已完成 + 质量隐患事件描述 + 质量隐患问题描述 + {{fe:$passRecordList t.enterpriseName + t.inspectManName + t.inspectTime + t.regionName + t.dangerItemContent + t.dangerDesc + + t.remark + + t.level + + t.urgentLevel + + t.changeName + t.changeLimitTime + t.reviewName + t.verifyManName + 安全问题 + t.enterpriseName + 未完成 + t.addedDescription + t.problemDescription}} +质量整改检查记录: + +质量风险分析: +质量管理记录总条数=质量隐患记录+排查记录 + 质量管理记录总条数:{{totalNum}} + 质量隐患记录总条数:{{dangerNum}} + 排查记录总条数:{{investigateNum}} + 重大质量隐患总条数:{{greatFaultLevelNum}} + 超期未闭合质量隐患总条数:{{overdueNotCloseNum}} + +分包单位质量隐患统计: + 企业名称 + 企业类型 + 质量隐患记录数量 + {{fe:$quality t.enterpriseName + 总包 + t.totalNum}} + +质量风险统计: + 质量风险总数:{{dangerNum}} +重大质量风险:{{greatFaultLevelNum}} +较大质量风险:{{largerRiskNum}} +一般质量风险:{{generalRiskNum}} +低质量风险:{{lowRiskNum}} + +近一年检查到的质量隐患级别风险统计: + 月份 + 重大风险质量隐患数量 + 较大风险质量隐患数量 + 一般风险质量隐患数量 + 低风险质量隐患数量 + {{fe:$yearMonth t.yearMonth + t.greatFaultLevelNum + t.largerRiskNum + t.generalRiskNum + t.lowRiskNum}} + +质量隐患超期未整改统计: + 隐患严重程度 + 数量 + 占比 + {{fe:$data + t.name + t.count + t.percent}} + +质量隐患未销项统计: + 隐患严重程度 + 数量 + 占比 + {{fe:$data1 + t.name + t.count + t.percent}} + +责任区域质量隐患问题统计: + 区域名称 + 区域下全部质量隐患数量 + 区域下重大质量隐患数量 + 区域下较大质量隐患数量 + 区域下一般质量隐患数量 + 区域下低质量隐患数量 + {{fe:$trendOneList + t.name + t.all + + t.enumType1 + + t.enumType2 + + t.enumType3 + + t.enumType4 + }} + +项目质量自检任务完成统计: + 质量检查任务名称 + 创建人 + 计划检查时间 + 子任务完成度 + 子任务完成状态 + 执行任务过程中发现的质量隐患总数 + 未闭合质量隐患数量 + 检查说明 + {{fe:$taskList + t.taskName + t.createUserName + + t.startTime - t.endTime + t.taskCompleteNum/t.taskNum + + t.statusName + + t.count.inspectNum + + t.count.notEndNum + t.inspectRemark}} + + +质量检查任务下的子任务完成统计: + 检查任务名称 + 子任务名称 + 检查人 + 检查时间 + 质量隐患总数 + 未闭合质量隐患数 + {{fe:$taskItem + t.taskName + t.itemName + + t.users + + t.startTime - t.endTime + + t.count.inspectNum + + t.count.notEndNum}} + + diff --git a/src/main/resources/word/进度管理.docx b/src/main/resources/word/进度管理.docx new file mode 100644 index 000000000..7f33ce20c --- /dev/null +++ b/src/main/resources/word/进度管理.docx @@ -0,0 +1,35 @@ + + {{projectName}}数据汇总 + + 进度管理: + +每日施工进度及人力物料设备等用量记录: + 时间 + 上报人 + 分部分项工程名称 + 今日完成进度 + 人力物料设备等用量 + {{fe:$taskList t.uploadDate + + t.uploadUserName + + t.taskName + + t.progressRatio + + t.desc + }} + + +进度预警记录记录: + 任务名称 + 报警详情 + 报警时间 + {{fe:$alarmList + t.taskName + + t.alarmDetails + + t.createDate + }} + diff --git a/src/main/resources/word/项目基本信息.docx b/src/main/resources/word/项目基本信息.docx new file mode 100644 index 000000000..cbfd55885 --- /dev/null +++ b/src/main/resources/word/项目基本信息.docx @@ -0,0 +1,34 @@ + + {{projectName}}项目数据汇总 +1、项目基础信息: +项目名称 {{projectName}} +项目所在省市 {{projectAddress}} +项目地址 {{projectAddress}} +项目经理 {{projectManage}} +联系电话 {{projectTel}} +经度位置 {{longitude}} +纬度位置 {{latitude}} +项目编号 {{projectNumber}} +工程类别 {{projectTypeName}} +结构类型 {{structureTypeName}} +项目面积(m²) {{projectAcreage}} +工程状态 {{bulidStatusName}} +开工日期 {{startWorkDate}} +施工阶段 {{constructionStageName}} +可售面积(m²) {{saleAcreage}} +户数 {{households}} +楼栋数 {{buildingNum}} +是否重点工程 {{majorProjectTypeName}} + +2、项目拓展信息: +施工合同额(万元) {{contractPrice}} +总投资额(万元) {{investmentPrice}} +合同签订 {{contractSignTime}} +合同工期 {{contractPeriodStartTime}} / {{contractPeriodEndTime}} +实际工期 {{realPeriodStartTime}} / {{realPeriodEndTime}} +中标单位 {{bidWinner}} +建设单位 {{constructionUnit}} +设计单位 {{designUnit}} +监理单位 {{supervisorUnit}} +业主单位 {{ownerUnit}} +工程概况 {{projectOverview}}