diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/controller/HomePageController.java b/src/main/java/com/zhgd/xmgl/modules/baotou/controller/HomePageController.java index 51338a629..decbe4956 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/controller/HomePageController.java +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/controller/HomePageController.java @@ -1,16 +1,17 @@ package com.zhgd.xmgl.modules.baotou.controller; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DateUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.wflow.workflow.service.ProcessTaskService; import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.xmgl.base.entity.vo.SectorVo; import com.zhgd.xmgl.base.entity.vo.TrendOneVo; -import com.zhgd.xmgl.modules.baotou.entity.DeviceMasterScheduleDetail; -import com.zhgd.xmgl.modules.baotou.entity.DeviceMasterScheduleYear; -import com.zhgd.xmgl.modules.baotou.entity.DeviceUnit; -import com.zhgd.xmgl.modules.baotou.entity.ProjectScheduleDeviceUnit; +import com.zhgd.xmgl.modules.baotou.entity.*; import com.zhgd.xmgl.modules.baotou.entity.vo.CountConstructionStateVo; +import com.zhgd.xmgl.modules.baotou.entity.vo.CountFlowVO; +import com.zhgd.xmgl.modules.baotou.entity.vo.RankEnterpriseVo; import com.zhgd.xmgl.modules.baotou.security.service.IXzSecurityQualityInspectionRecordService; import com.zhgd.xmgl.modules.baotou.service.*; import com.zhgd.xmgl.modules.basicdata.entity.BaseModule; @@ -21,16 +22,18 @@ import com.zhgd.xmgl.modules.dangerous.entity.vo.ProjectInspectRecordCountVo; import com.zhgd.xmgl.modules.dangerous.service.IDangerousEngineeringRecordService; import com.zhgd.xmgl.modules.environment.service.IAirQualityAnalysisService; import com.zhgd.xmgl.modules.video.service.IVideoItemService; -import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo; import com.zhgd.xmgl.modules.worker.entity.vo.PersonTypeAndEduStatisticsVo; import com.zhgd.xmgl.modules.worker.entity.vo.ProjectCompanyWorkTotal; import com.zhgd.xmgl.modules.worker.service.IWorkerInfoService; import com.zhgd.xmgl.security.util.SecurityUtils; +import com.zhgd.xmgl.util.FlowSeviceUtil; +import com.zhgd.xmgl.util.MapUtil; 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.simpleframework.xml.core.Validate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; @@ -38,10 +41,7 @@ import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; @RestController @RequestMapping("/xmgl/homePage") @@ -55,6 +55,8 @@ public class HomePageController { @Lazy IPipelineWeldingRecordService pipelineWeldingRecordService; @Autowired + FlowSeviceUtil flowSeviceUtil; + @Autowired private IContractorAssessmentService contractorAssessmentService; @Autowired private IAirQualityAnalysisService airQualityAnalysisService; @@ -88,6 +90,8 @@ public class HomePageController { private IBaseModuleService baseModuleService; @Autowired private IUserModuleService userModuleService; + @Autowired + private ProcessTaskService taskService; @ApiOperation(value = "查询天气", notes = "查询天气", httpMethod = "POST") @ApiImplicitParams({ @@ -139,6 +143,7 @@ public class HomePageController { } @ApiOperation(value = "常用功能列表查询账号常用模块信息", notes = "常用功能列表查询账号常用模块信息", httpMethod = "GET") + @ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = false, dataType = "String") @GetMapping(value = "/queryUserModuleList") public Result> queryUserModuleList(@ApiIgnore @RequestParam HashMap param) { return Result.success(baseModuleService.queryUserModuleList(param)); @@ -157,7 +162,7 @@ public class HomePageController { @ApiOperation(value = "常用功能保存账号常用模块信息", notes = "常用功能保存账号常用模块信息", httpMethod = "POST") @PostMapping(value = "/saveUserModules") - public Result saveUserModules(@RequestBody @Validate List moduleIdList) { + public Result saveUserModules(@RequestBody @ApiIgnore List moduleIdList) { userModuleService.saveUserModules(moduleIdList); return Result.ok(); } @@ -198,6 +203,15 @@ public class HomePageController { @ApiOperation(value = "进度预览列表查询各装置主进度计划详情信息", notes = "进度预览列表查询各装置主进度计划详情信息", httpMethod = "GET") @GetMapping(value = "/queryScheduleDetailList") public Result> queryDeviceMasterScheduleDetailList(@ApiIgnore @RequestParam HashMap param) { + List unitList = projectScheduleDeviceUnitService.list(new LambdaQueryWrapper() + .eq(ProjectScheduleDeviceUnit::getDeviceUnitName, "全部装置")); + Long deviceUnitId; + if (CollUtil.isNotEmpty(unitList)) { + deviceUnitId = unitList.get(0).getId(); + } else { + deviceUnitId = -1L; + } + param.put("deviceUnitId", deviceUnitId); return Result.success(deviceMasterScheduleDetailService.queryList(param)); } @@ -213,9 +227,16 @@ public class HomePageController { // @ApiImplicitParam(name = "status", value = "状态,1无需整改,2待整改,3待复查,4合格", paramType = "body", required = false, dataType = "String"), @ApiImplicitParam(name = "inspectStartTime", value = "检查开始时间", paramType = "body", required = false, dataType = "String"), @ApiImplicitParam(name = "inspectEndTime", value = "检查结束时间", paramType = "body", required = false, dataType = "String"), + @ApiImplicitParam(name = "queryType", value = "1近7天,2近30天,3指定开始结束时间", paramType = "body", required = true, dataType = "Integer"), }) @PostMapping(value = "/countSafe") public Result getProjectInspectRecordCount(@RequestBody Map map) { + String queryType = MapUtils.getString(map, "queryType"); + if (Objects.equals("1",queryType)) { + map.put("inspectStartTime", DateUtil.formatDateTime(DateUtil.offsetDay(new Date(), -7))); + } else if (Objects.equals("2", queryType)) { + map.put("inspectStartTime", DateUtil.formatDateTime(DateUtil.offsetDay(new Date(), -30))); + } return Result.success(xzSecurityQualityInspectionRecordService.getProjectInspectRecordCount(map)); } @@ -234,6 +255,9 @@ public class HomePageController { @ApiOperation(value = "安全管理EPC责任单位统计", notes = "安全管理EPC责任单位统计", httpMethod = "POST") @ApiImplicitParams({ @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "queryType", value = "1近7天,2近30天,3指定开始结束时间", paramType = "body", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "inspectTime_begin", value = "检查开始时间", paramType = "body", required = false, dataType = "String"), + @ApiImplicitParam(name = "inspectTime_end", value = "检查结束时间", paramType = "body", required = false, dataType = "String"), }) @PostMapping(value = "/countSafeResponsibleUnit") public Result> countResponsibleUnit(@RequestBody Map map) { @@ -243,6 +267,9 @@ public class HomePageController { @ApiOperation(value = "质量管理EPC责任单位分析", notes = "质量管理EPC责任单位分析", httpMethod = "POST") @ApiImplicitParams({ @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "queryType", value = "1近7天,2近30天,3指定开始结束时间", paramType = "body", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "inspectTime_begin", value = "检查开始时间", paramType = "body", required = false, dataType = "String"), + @ApiImplicitParam(name = "inspectTime_end", value = "检查结束时间", paramType = "body", required = false, dataType = "String"), }) @PostMapping(value = "/countQualityResponsibleUnit") public Result> countQualityResponsibleUnit(@RequestBody Map map) { @@ -261,9 +288,16 @@ public class HomePageController { // @ApiImplicitParam(name = "status", value = "状态,1无需整改,2待整改,3待复查,4合格", paramType = "body", required = false, dataType = "String"), @ApiImplicitParam(name = "inspectStartTime", value = "检查开始时间", paramType = "body", required = false, dataType = "String"), @ApiImplicitParam(name = "inspectEndTime", value = "检查结束时间", paramType = "body", required = false, dataType = "String"), + @ApiImplicitParam(name = "queryType", value = "1近7天,2近30天,3指定开始结束时间", paramType = "body", required = true, dataType = "Integer"), }) @PostMapping(value = "/countQuality") public Result countQuality(@RequestBody Map map) { + String queryType = MapUtils.getString(map, "queryType"); + if (Objects.equals("1",queryType)) { + map.put("inspectStartTime", DateUtil.formatDateTime(DateUtil.offsetDay(new Date(), -7))); + } else if (Objects.equals("2", queryType)) { + map.put("inspectStartTime", DateUtil.formatDateTime(DateUtil.offsetDay(new Date(), -30))); + } return Result.success(problemService.getProjectInspectRecordCount(map)); } @@ -285,7 +319,7 @@ public class HomePageController { @ApiImplicitParam(name = "type", value = "1本月,2上月", paramType = "body", required = true, dataType = "Integer"), }) @PostMapping(value = "/rankEnterprise") - public Result> rankEnterprise(@RequestBody Map map) { + public Result rankEnterprise(@RequestBody Map map) { return Result.success(contractorAssessmentDetailService.rankEnterprise(map)); } @@ -294,7 +328,7 @@ public class HomePageController { @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"), }) @PostMapping(value = "/rankWeldingPassRate") - public Result> rankWeldingPassRate(@RequestBody Map map) { + public Result> rankWeldingPassRate(@RequestBody Map map) { return Result.success(pipelineWeldingRecordService.rankWeldingPassRate(map)); } @@ -321,5 +355,28 @@ public class HomePageController { return Result.success(workerInfoService.selectProjectComapnyWorkTotalList(map)); } + @ApiOperation(value = "待办事项查询待办事项列表", notes = "待办事项查询待办事项列表") + @ApiImplicitParams({ + @ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "param", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "param", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "TenantId", value = "项目sn", paramType = "header", required = true, dataType = "String"), + }) + @GetMapping("/flow/todoList") + public Result getUserTodoList(@RequestParam(defaultValue = "20") Integer pageSize, + @RequestParam(defaultValue = "1") Integer pageNo, + @RequestParam(required = false) String code, + @RequestParam(required = false) String[] startTimes, + @RequestParam(required = false) String startUser, + @RequestParam(required = false) String key) { + return Result.success(taskService.getUserTodoList(pageSize, pageNo, code, startTimes, startUser, key)); + } + + @ApiOperation(value = "待办事项统计", notes = "待办事项统计") + @ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "param", required = true, dataType = "String") + @GetMapping("/flow/count") + public Result countFlow(@ApiIgnore @RequestParam Map map) { + return Result.success(flowSeviceUtil.countFlow(map)); + } + } diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/entity/ContractorAssessmentDetail.java b/src/main/java/com/zhgd/xmgl/modules/baotou/entity/ContractorAssessmentDetail.java index 4bba59cb9..cf2fec073 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/entity/ContractorAssessmentDetail.java +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/entity/ContractorAssessmentDetail.java @@ -65,4 +65,8 @@ public class ContractorAssessmentDetail implements Serializable { @TableField(exist = false) @ApiModelProperty(value="单位名称") private java.lang.String enterpriseName ; + @TableField(exist = false) + @ApiModelProperty(value = "1:监理单位考核;2:EPC承包商考核;3:施工单位考核;") + private java.lang.Integer type; + } diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/entity/vo/CountFlowVO.java b/src/main/java/com/zhgd/xmgl/modules/baotou/entity/vo/CountFlowVO.java new file mode 100644 index 000000000..4fdf68515 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/entity/vo/CountFlowVO.java @@ -0,0 +1,10 @@ +package com.zhgd.xmgl.modules.baotou.entity.vo; + +import lombok.Data; + +@Data +public class CountFlowVO { + private Integer total; + private Integer quality; + private Integer safe; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/entity/vo/RankEnterpriseVo.java b/src/main/java/com/zhgd/xmgl/modules/baotou/entity/vo/RankEnterpriseVo.java new file mode 100644 index 000000000..8e3e7b772 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/entity/vo/RankEnterpriseVo.java @@ -0,0 +1,11 @@ +package com.zhgd.xmgl.modules.baotou.entity.vo; + +import com.zhgd.xmgl.modules.baotou.entity.ContractorAssessmentDetail; +import lombok.Data; + +@Data +public class RankEnterpriseVo { + private ContractorAssessmentDetail epc; + private ContractorAssessmentDetail supervisor; + private ContractorAssessmentDetail construction; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/ContractorAssessmentDetailMapper.java b/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/ContractorAssessmentDetailMapper.java index 632efb5e9..f564ad73b 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/ContractorAssessmentDetailMapper.java +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/ContractorAssessmentDetailMapper.java @@ -51,5 +51,5 @@ public interface ContractorAssessmentDetailMapper extends BaseMapper rankEnterprise(Map map); + List rankEnterprise(Map map); } diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/PipelineWeldingRecordMapper.java b/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/PipelineWeldingRecordMapper.java index dc5b9aa8a..5fd7fc4a3 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/PipelineWeldingRecordMapper.java +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/PipelineWeldingRecordMapper.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.zhgd.xmgl.modules.baotou.entity.DeviceUnit; +import com.zhgd.xmgl.modules.baotou.entity.PipelineWelder; import com.zhgd.xmgl.modules.baotou.entity.PipelineWeldingRecord; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -49,5 +50,5 @@ public interface PipelineWeldingRecordMapper extends BaseMapper rankWeldingPassRate(Map map); + List rankWeldingPassRate(Map map); } diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/ContractorAssessmentDetailMapper.xml b/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/ContractorAssessmentDetailMapper.xml index 83a43045a..4f58124f1 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/ContractorAssessmentDetailMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/ContractorAssessmentDetailMapper.xml @@ -21,11 +21,12 @@ where t.id = #{id} - + select t.*,ei1.enterprise_name,ca.type + from contractor_assessment_detail t + join (select max(t.id) as id,ca.type from contractor_assessment_detail t join contractor_assessment ca on ca.id=t.assessment_id - join enterprise_info ei1 on ei1.id=t.enterprise_id where t.project_sn = #{projectSn} and ca.`year_month` = DATE_FORMAT(now(), '%Y-%m') @@ -33,6 +34,9 @@ and ca.`year_month` = DATE_FORMAT(DATE_SUB(now(), interval 1 month), '%Y-%m') - order by t.score desc + group by ca.type + )t1 on t.id=t1.id + join contractor_assessment ca on ca.id=t.assessment_id + join enterprise_info ei1 on ei1.id=t.enterprise_id diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/PipelineWeldingRecordMapper.xml b/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/PipelineWeldingRecordMapper.xml index a5ab48476..8c4af00de 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/PipelineWeldingRecordMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/PipelineWeldingRecordMapper.xml @@ -55,7 +55,7 @@ where t.id = #{id} - select ifnull(round(ifnull(sum(if(t.testing_qualified=1,1,0)),0)/count(*)*100,2),0) as welding_pass_rate, du.device_unit_name diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/QualityProblemMapper.xml b/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/QualityProblemMapper.xml index 083c022a3..fbc525f00 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/QualityProblemMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/QualityProblemMapper.xml @@ -78,6 +78,20 @@ and r.project_sn = #{projectSn} + + and r.inspect_time >= date_sub(current_date, interval 7 day) + + + and r.inspect_time >= date_sub(current_date, interval 30 day) + + + and r.inspect_time >= #{inspectTime_begin} + + + and r.inspect_time + if(LENGTH(#{inspectTime_end}) = 10, CONCAT(DATE_FORMAT(#{inspectTime_end}, '%Y-%m-%d'), ' 23:59:59'), + #{inspectTime_end}) + group by r.epc_contractor_id order by y desc diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/security/mapper/xml/XzSecurityQualityInspectionRecordMapper.xml b/src/main/java/com/zhgd/xmgl/modules/baotou/security/mapper/xml/XzSecurityQualityInspectionRecordMapper.xml index 48670e739..f9cc26872 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/security/mapper/xml/XzSecurityQualityInspectionRecordMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/security/mapper/xml/XzSecurityQualityInspectionRecordMapper.xml @@ -1081,6 +1081,20 @@ and r.project_sn = #{projectSn} + + and r.inspect_time >= date_sub(current_date, interval 7 day) + + + and r.inspect_time >= date_sub(current_date, interval 30 day) + + + and r.inspect_time >= #{inspectTime_begin} + + + and r.inspect_time + if(LENGTH(#{inspectTime_end}) = 10, CONCAT(DATE_FORMAT(#{inspectTime_end}, '%Y-%m-%d'), ' 23:59:59'), + #{inspectTime_end}) + group by r.epc_contractor_id order by y desc diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/service/IContractorAssessmentDetailService.java b/src/main/java/com/zhgd/xmgl/modules/baotou/service/IContractorAssessmentDetailService.java index c815c2764..e9f6bc19e 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/service/IContractorAssessmentDetailService.java +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/service/IContractorAssessmentDetailService.java @@ -3,6 +3,7 @@ package com.zhgd.xmgl.modules.baotou.service; import com.zhgd.xmgl.modules.baotou.entity.ContractorAssessmentDetail; import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.zhgd.xmgl.modules.baotou.entity.vo.RankEnterpriseVo; import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo; import java.util.HashMap; @@ -53,5 +54,5 @@ public interface IContractorAssessmentDetailService extends IService rankEnterprise(Map map); + RankEnterpriseVo rankEnterprise(Map map); } diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/service/IPipelineWeldingRecordService.java b/src/main/java/com/zhgd/xmgl/modules/baotou/service/IPipelineWeldingRecordService.java index 909e1b38c..8a3307e1e 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/service/IPipelineWeldingRecordService.java +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/service/IPipelineWeldingRecordService.java @@ -1,6 +1,7 @@ package com.zhgd.xmgl.modules.baotou.service; import com.zhgd.xmgl.modules.baotou.entity.DeviceUnit; +import com.zhgd.xmgl.modules.baotou.entity.PipelineWelder; import com.zhgd.xmgl.modules.baotou.entity.PipelineWeldingRecord; import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -52,5 +53,5 @@ public interface IPipelineWeldingRecordService extends IService rankWeldingPassRate(Map map); + List rankWeldingPassRate(Map map); } diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/ContractorAssessmentDetailServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/ContractorAssessmentDetailServiceImpl.java index 5834356cf..0e594ead1 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/ContractorAssessmentDetailServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/ContractorAssessmentDetailServiceImpl.java @@ -1,44 +1,42 @@ package com.zhgd.xmgl.modules.baotou.service.impl; -import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; -import com.zhgd.jeecg.common.execption.OpenAlertException; -import com.zhgd.xmgl.modules.baotou.entity.ContractorAssessmentDetail; -import com.zhgd.xmgl.modules.baotou.mapper.ContractorAssessmentDetailMapper; -import com.zhgd.xmgl.modules.baotou.service.IContractorAssessmentDetailService; -import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo; -import com.zhgd.xmgl.util.MapUtil; -import org.apache.commons.collections.MapUtils; -import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.zhgd.jeecg.common.system.query.QueryGenerator; -import com.zhgd.xmgl.util.PageUtil; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zhgd.jeecg.common.execption.OpenAlertException; +import com.zhgd.jeecg.common.system.query.QueryGenerator; +import com.zhgd.xmgl.modules.baotou.entity.ContractorAssessmentDetail; +import com.zhgd.xmgl.modules.baotou.entity.vo.RankEnterpriseVo; +import com.zhgd.xmgl.modules.baotou.mapper.ContractorAssessmentDetailMapper; +import com.zhgd.xmgl.modules.baotou.service.IContractorAssessmentDetailService; +import com.zhgd.xmgl.util.PageUtil; +import com.zhgd.xmgl.util.RefUtil; +import org.apache.commons.collections.MapUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + import java.util.HashMap; import java.util.List; import java.util.Map; -import com.zhgd.xmgl.util.RefUtil; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.beans.factory.annotation.Autowired; - /** * @Description: 承包商考核详情 * @author: pds - * @date: 2024-10-16 + * @date: 2024-10-16 * @version: V1.0 */ @Service public class ContractorAssessmentDetailServiceImpl extends ServiceImpl implements IContractorAssessmentDetailService { @Autowired private ContractorAssessmentDetailMapper contractorAssessmentDetailMapper; + @Override public IPage queryPageList(HashMap param) { QueryWrapper queryWrapper = this.getQueryWrapper(param); Page page = PageUtil.getPage(param); - IPage pageList = baseMapper.queryList(page, queryWrapper,param); + IPage pageList = baseMapper.queryList(page, queryWrapper, param); pageList.setRecords(this.dealList(pageList.getRecords())); return pageList; } @@ -46,12 +44,12 @@ public class ContractorAssessmentDetailServiceImpl extends ServiceImpl queryList(HashMap param) { QueryWrapper queryWrapper = getQueryWrapper(param); - return dealList(baseMapper.queryList(queryWrapper,param)); + return dealList(baseMapper.queryList(queryWrapper, param)); } private QueryWrapper getQueryWrapper(HashMap param) { QueryWrapper queryWrapper = QueryGenerator.initPageQueryWrapper(ContractorAssessmentDetail.class, param, true); - String orderBy = MapUtils.getString(param,"orderBy"); + String orderBy = MapUtils.getString(param, "orderBy"); if (StrUtil.isNotBlank(orderBy)) { queryWrapper.orderByDesc(orderBy); } else { @@ -73,7 +71,7 @@ public class ContractorAssessmentDetailServiceImpl extends ServiceImpl rankEnterprise(Map map) { - return baseMapper.rankEnterprise(map); + public RankEnterpriseVo rankEnterprise(Map map) { + List details = baseMapper.rankEnterprise(map); + RankEnterpriseVo vo = new RankEnterpriseVo(); + for (ContractorAssessmentDetail detail : details) { + if (detail.getType() == 1) { + vo.setSupervisor(detail); + } else if (detail.getType() == 2) { + vo.setEpc(detail); + } else { + vo.setConstruction(detail); + } + } + return vo; } } diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/PipelineWeldingRecordServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/PipelineWeldingRecordServiceImpl.java index 38805fdd1..39cb17e7b 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/PipelineWeldingRecordServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/PipelineWeldingRecordServiceImpl.java @@ -2,6 +2,7 @@ package com.zhgd.xmgl.modules.baotou.service.impl; import com.zhgd.jeecg.common.execption.OpenAlertException; import com.zhgd.xmgl.modules.baotou.entity.DeviceUnit; +import com.zhgd.xmgl.modules.baotou.entity.PipelineWelder; import com.zhgd.xmgl.modules.baotou.entity.PipelineWeldingRecord; import com.zhgd.xmgl.modules.baotou.mapper.PipelineWeldingRecordMapper; import com.zhgd.xmgl.modules.baotou.service.IPipelineWeldingRecordService; @@ -89,7 +90,7 @@ public class PipelineWeldingRecordServiceImpl extends ServiceImpl rankWeldingPassRate(Map map) { + public List rankWeldingPassRate(Map map) { return baseMapper.rankWeldingPassRate(map); } diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/WorkerAdmissionDetailServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/WorkerAdmissionDetailServiceImpl.java index 0eef7dfee..1395b7bb6 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/WorkerAdmissionDetailServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/WorkerAdmissionDetailServiceImpl.java @@ -203,7 +203,6 @@ public class WorkerAdmissionDetailServiceImpl extends ServiceImpl find = detailList.stream().filter(o -> Objects.equals(o.getId(), certificateDetail.getWorkerAdmissionDetailId())).findFirst(); find.ifPresent(workerAdmissionDetail -> certificate.setIdCard(workerAdmissionDetail.getIdCard())); addCertificates.add(certificate); diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/WorkerAdmissionServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/WorkerAdmissionServiceImpl.java index f3ffdd300..e843ffc73 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/WorkerAdmissionServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/WorkerAdmissionServiceImpl.java @@ -226,8 +226,6 @@ public class WorkerAdmissionServiceImpl extends ServiceImpl getCompanyModuleList(Map map) { @@ -119,7 +121,7 @@ public class BaseModuleServiceImpl extends ServiceImpl queryUserModuleList(HashMap param) { param.put("userId", SecurityUtils.getUser().getUserId()); - return baseModuleMapper.queryUserModuleList(param); + param.put("moduleType", 2); + Map map = baseModuleService.getModuleAndMenuList(param); + List moduleList = (List) map.get("moduleList"); + if (CollUtil.isEmpty(moduleList)) { + return new ArrayList<>(); + } + Map userModuleMap = baseModuleMapper.queryUserModuleList(param).stream().collect(Collectors.toMap(BaseModule::getModuleId, Function.identity())); + return moduleList.stream().filter(o->userModuleMap.containsKey(o.getModuleId())).collect(Collectors.toList()); } + } diff --git a/src/main/java/com/zhgd/xmgl/modules/exam/controller/ExamQuestionBankController.java b/src/main/java/com/zhgd/xmgl/modules/exam/controller/ExamQuestionBankController.java index 3765eefef..33ec376fa 100644 --- a/src/main/java/com/zhgd/xmgl/modules/exam/controller/ExamQuestionBankController.java +++ b/src/main/java/com/zhgd/xmgl/modules/exam/controller/ExamQuestionBankController.java @@ -1,5 +1,6 @@ package com.zhgd.xmgl.modules.exam.controller; +import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -104,6 +105,20 @@ public class ExamQuestionBankController { Page page = PageUtil.getPage(map); queryWrapper.lambda().orderByDesc(ExamQuestionBank::getCreateTime,ExamQuestionBank::getId); IPage pageList = examQuestionBankService.page(page, queryWrapper); +// List records = pageList.getRecords(); +// if (CollUtil.isNotEmpty(records)) { +// List ids = records.stream().map(ExamQuestionBank::getId).collect(Collectors.toList()); +// List questionOptions = examQuestionOptionService.list(new LambdaQueryWrapper() +// .in(ExamQuestionOption::getQuestionId, ids)); +// for (ExamQuestionBank record : records) { +// if (Objects.equals(record.getType(),3)) { +// Optional op = questionOptions.stream().filter(o -> Objects.equals(o.getQuestionId(), record.getId()) && Objects.equals(o.getOptionCode(), record.getOptions())).findFirst(); +// if (op.isPresent()) { +// record.setOptions(op.get().getOptionDesc()); +// } +// } +// } +// } return Result.success(pageList); } @@ -116,7 +131,7 @@ public class ExamQuestionBankController { @OperLog(operModul = "题目管理", operType = "列表查询", operDesc = "列表查询题目管理信息") @ApiOperation(value = " 列表查询题目管理信息", notes = "列表查询题目管理信息", httpMethod = "POST") @ApiImplicitParams({ - @ApiImplicitParam(name = "type", value = "试题类型(1:单选题;2:多选题;3:填空题;)", paramType = "body"), + @ApiImplicitParam(name = "type", value = "试题类型(1:单选题;2:多选题;3:判断题;)", paramType = "body"), @ApiImplicitParam(name = "difficulty", value = "难易程度", paramType = "body") }) @PostMapping(value = "/list") @@ -437,7 +452,7 @@ public class ExamQuestionBankController { typeName = "多选题"; break; case 3 : - typeName = "填空题"; + typeName = "判断题"; break; default: } @@ -448,7 +463,7 @@ public class ExamQuestionBankController { Integer type = 0; String single = "单选题"; String many = "多选题"; - String fill = "填空题"; + String fill = "判断题"; if (single.equals(typeName)) { type = 1; } else if (many.equals(typeName)) { diff --git a/src/main/java/com/zhgd/xmgl/modules/exam/entity/ExamAnswerQuestion.java b/src/main/java/com/zhgd/xmgl/modules/exam/entity/ExamAnswerQuestion.java index f8c9fa0e1..7e448158f 100644 --- a/src/main/java/com/zhgd/xmgl/modules/exam/entity/ExamAnswerQuestion.java +++ b/src/main/java/com/zhgd/xmgl/modules/exam/entity/ExamAnswerQuestion.java @@ -52,10 +52,10 @@ public class ExamAnswerQuestion implements Serializable { @ApiModelProperty(value = "试题名称") private String questionName; /** - * 试题类型(1:单选题;2:多选题;3:填空题;) + * 试题类型(1:单选题;2:多选题;3:判断题;) */ - @Excel(name = "试题类型(1:单选题;2:多选题;3:填空题;)", width = 15) - @ApiModelProperty(value = "试题类型(1:单选题;2:多选题;3:填空题;)") + @Excel(name = "试题类型(1:单选题;2:多选题;3:判断题;)", width = 15) + @ApiModelProperty(value = "试题类型(1:单选题;2:多选题;3:判断题;)") private Integer type; /** * 难易程度 diff --git a/src/main/java/com/zhgd/xmgl/modules/sewage/service/impl/SewageAlarmServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/sewage/service/impl/SewageAlarmServiceImpl.java index 374de648a..3637b7d47 100644 --- a/src/main/java/com/zhgd/xmgl/modules/sewage/service/impl/SewageAlarmServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/sewage/service/impl/SewageAlarmServiceImpl.java @@ -61,6 +61,8 @@ public class SewageAlarmServiceImpl extends ServiceImpl() .eq(SewageWarnThreshold::getDevSn, devSn)); if (threshold != null) { diff --git a/src/main/java/com/zhgd/xmgl/task/WorkerTask.java b/src/main/java/com/zhgd/xmgl/task/WorkerTask.java index 33e699f6f..d56a80719 100644 --- a/src/main/java/com/zhgd/xmgl/task/WorkerTask.java +++ b/src/main/java/com/zhgd/xmgl/task/WorkerTask.java @@ -272,7 +272,7 @@ public class WorkerTask { @RequestMapping("/alarmWorkerBlack") public void alarmWorkerBlack() { log.info("任务开始,对人员的合同信息、资格证书、保险信息到期进行预警,预警后发送消息提示项目管理员账号"); - List pushList = xzEmergencyPushService.list(new LambdaQueryWrapper().eq(XzEmergencyPush::getType,2)); + List pushList = xzEmergencyPushService.list(new LambdaQueryWrapper().eq(XzEmergencyPush::getType, 2)); Map>> projectMap = pushList.stream().collect(Collectors.groupingBy(XzEmergencyPush::getProjectSn, Collectors.groupingBy(XzEmergencyPush::getEnterpriseId))); //资格证书预警 List list1 = workerCertificateMapper.getAlarmWorkerCertificateWithHeadquarter(); @@ -681,29 +681,29 @@ public class WorkerTask { } private String getSafeType(Integer level, Integer status) { - if (level == 1 && status == 2) { + if (Objects.equals(level, 1) && Objects.equals(status, 2)) { return "6"; - } else if (level == 1 && status == 3) { + } else if (Objects.equals(level, 1) && Objects.equals(status, 3)) { return "7"; - } else if (level == 1 && status == 4) { + } else if (Objects.equals(level, 1) && Objects.equals(status, 4)) { return "8"; - } else if (level == 2 && status == 2) { + } else if (Objects.equals(level, 2) && Objects.equals(status, 2)) { return "9"; - } else if (level == 2 && status == 3) { + } else if (Objects.equals(level, 2) && Objects.equals(status, 3)) { return "10"; - } else if (level == 2 && status == 4) { + } else if (Objects.equals(level, 2) && Objects.equals(status, 4)) { return "11"; - } else if (level == 3 && status == 2) { + } else if (Objects.equals(level, 3) && Objects.equals(status, 2)) { return "12"; - } else if (level == 3 && status == 3) { + } else if (Objects.equals(level, 3) && Objects.equals(status, 3)) { return "13"; - } else if (level == 3 && status == 4) { + } else if (Objects.equals(level, 3) && Objects.equals(status, 4)) { return "14"; - } else if (level == 4 && status == 2) { + } else if (Objects.equals(level, 4) && Objects.equals(status, 2)) { return "15"; - } else if (level == 4 && status == 3) { + } else if (Objects.equals(level, 4) && Objects.equals(status, 3)) { return "16"; - } else if (level == 4 && status == 4) { + } else if (Objects.equals(level, 4) && Objects.equals(status, 4)) { return "17"; } return ""; diff --git a/src/main/java/com/zhgd/xmgl/util/FlowSeviceUtil.java b/src/main/java/com/zhgd/xmgl/util/FlowSeviceUtil.java index 19ad5f7c1..e69197e08 100644 --- a/src/main/java/com/zhgd/xmgl/util/FlowSeviceUtil.java +++ b/src/main/java/com/zhgd/xmgl/util/FlowSeviceUtil.java @@ -4,14 +4,19 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.gexin.fastjson.JSON; import com.gexin.fastjson.JSONArray; import com.gexin.fastjson.JSONObject; import com.wflow.bean.do_.UserDeptDo; +import com.wflow.bean.entity.WflowFormData; import com.wflow.bean.entity.WflowModelHistorys; +import com.wflow.bean.entity.WflowModels; import com.wflow.bean.entity.WflowSubProcess; +import com.wflow.mapper.WflowFormDataMapper; import com.wflow.mapper.WflowModelHistorysMapper; +import com.wflow.mapper.WflowModelsMapper; import com.wflow.mapper.WflowSubProcessMapper; import com.wflow.service.OrgRepositoryService; import com.wflow.workflow.UELTools; @@ -28,14 +33,18 @@ import com.wflow.workflow.bean.vo.ProcessTaskVo; import com.wflow.workflow.config.WflowGlobalVarDef; import com.wflow.workflow.service.*; import com.wflow.workflow.service.impl.ProcessTaskServiceImpl; +import com.wflow.workflow.utils.FlowableUtils; import com.zhgd.jeecg.common.execption.OpenAlertException; +import com.zhgd.xmgl.modules.baotou.entity.vo.CountFlowVO; import com.zhgd.xmgl.security.util.SecurityUtils; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.MapUtils; import org.flowable.engine.HistoryService; import org.flowable.engine.RepositoryService; import org.flowable.engine.RuntimeService; import org.flowable.engine.TaskService; import org.flowable.engine.history.HistoricProcessInstance; +import org.flowable.engine.runtime.ProcessInstance; import org.flowable.engine.runtime.ProcessInstanceQuery; import org.flowable.task.api.Task; import org.flowable.task.api.TaskInfo; @@ -47,13 +56,15 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; @Component @Slf4j public class FlowSeviceUtil { private final static OrgUser UNKNOW_USER = OrgUser.builder().id("5201314").name("人员待定").build(); - + @Autowired + private WflowModelsMapper wflowModelsMapper; @Lazy @Autowired private TaskService taskService; @@ -96,6 +107,10 @@ public class FlowSeviceUtil { @Lazy @Autowired private ProcessNodeCatchService nodeCatchService; + @Autowired + private WflowModelHistorysMapper wflowModelHistorysMapper; + @Autowired + private ProcessModelService modelService; /** * 获取下一个待处理的审批节点 @@ -366,5 +381,55 @@ public class FlowSeviceUtil { foreachNode(node.getChildren(), idSet, progressNodes, instance, vars, tenantId); } + public CountFlowVO countFlow(Map map) { + String projectSn = MapUtils.getString(map, "projectSn"); + String userId = SecurityUtils.getUser().getUserId() + ""; + TaskQuery taskQuery = taskService.createTaskQuery(); + ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery(); + Set stringSet = processInstanceQuery.list().stream().map(p -> p.getProcessInstanceId()).collect(Collectors.toSet()); + taskQuery.active().taskTenantId(projectSn) + .processInstanceIdIn(stringSet) + .taskCandidateOrAssigned(userId) + .orderByTaskCreateTime().desc(); + List taskList = taskQuery.list(); + Set staterUsers = new HashSet<>(); + Set instanceIds = taskList.stream().map(Task::getProcessInstanceId).collect(Collectors.toSet()); + Map startDept = FlowableUtils.getProcessVars(instanceIds, "startDept"); + //把待办任务流程实例一次性取出来,减少查询次数 + Map instanceMap = CollectionUtil.isNotEmpty(taskList) ? + runtimeService.createProcessInstanceQuery().processInstanceIds(taskList.stream() + .map(Task::getProcessInstanceId).collect(Collectors.toSet())) + .list().stream().collect(Collectors.toMap(ProcessInstance::getId, v -> v)) : new HashMap<>(); + List formIds = taskList.stream().map(task -> { + ProcessInstance instance = instanceMap.get(task.getProcessInstanceId()); + //构造用户id -> 部门id + staterUsers.add(instance.getStartUserId() + "_" + startDept.getOrDefault(task.getProcessInstanceId(), + //如果没有就从流程变量 owner 里取(之前是存owner变量) + FlowableUtils.getOwnerDept(task.getProcessInstanceId(), true))); + return instance.getProcessDefinitionKey(); + }).filter(Objects::nonNull).collect(Collectors.toList()); + //取用户信息,减少数据库查询,一次构建 + if (CollectionUtil.isEmpty(staterUsers)) { + formIds = new ArrayList<>(); + } + Map safeMap = wflowModelsMapper.selectList(Wrappers.lambdaQuery() + .eq(WflowModels::getGroupId, 135)).stream().collect(Collectors.toMap(WflowModels::getFormId, Function.identity())); + Map qualityMap = wflowModelsMapper.selectList(Wrappers.lambdaQuery() + .eq(WflowModels::getGroupId, 136)).stream().collect(Collectors.toMap(WflowModels::getFormId, Function.identity())); + Integer safe = 0; + Integer quality = 0; + for (String formId : formIds) { + if (safeMap.containsKey(formId)) { + safe++; + } else if (qualityMap.containsKey(formId)) { + quality++; + } + } + CountFlowVO vo = new CountFlowVO(); + vo.setTotal(formIds.size()); + vo.setSafe(safe); + vo.setQuality(quality); + return vo; + } } diff --git a/src/main/java/com/zhgd/xmgl/util/FlowUtil.java b/src/main/java/com/zhgd/xmgl/util/FlowUtil.java index d60cca94c..fd29ea1f8 100644 --- a/src/main/java/com/zhgd/xmgl/util/FlowUtil.java +++ b/src/main/java/com/zhgd/xmgl/util/FlowUtil.java @@ -11,6 +11,7 @@ import java.util.Date; import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.stream.Collectors; public class FlowUtil { @@ -26,6 +27,25 @@ public class FlowUtil { return Optional.ofNullable(map.get(key)).map(o -> "".equals(o) ? null : ((Map) ((List) o).get(0)).get("url").toString()).orElse(null); } + /** + * 获取文件url + * + * @param map + * @param key + * @return + */ + public static String getFileWithStar(Map map, String key) { + Object o2 = map.get(key); + if (o2 == null || "".equals(o2)) { + return null; + } + List l = (List) o2; + List collect = l.stream().map(o1 -> { + return o1.get("name").toString() + "*" + o1.get("url").toString(); + }).collect(Collectors.toList()); + return StrUtil.join(",", collect); + } + /** * 获取文件url完整链接 * diff --git a/src/main/resources/excel/题库导入模版.xlsx b/src/main/resources/excel/题库导入模版.xlsx index 41be3ba16..bd81d62b6 100644 Binary files a/src/main/resources/excel/题库导入模版.xlsx and b/src/main/resources/excel/题库导入模版.xlsx differ