Browse Source

完善水电生成报告详情数据

zhongwei
段飞宇 2 years ago
parent
commit
096099b9cf
  1. 13
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/entity/OperAccessTaskEntity.java
  2. 22
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperPhenomenonEntity.java
  3. 17
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/feign/TaskFeignClient.java
  4. 13
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/feign/fallback/TaskFeignClientFallback.java
  5. 2
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/TaskListQuery.java
  6. 3
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/CheckCompanyFeignClient.java
  7. 4
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/SafeproductFeignClient.java
  8. 2
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CheckMonthEntity.java
  9. 17
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java
  10. 8
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml
  11. 11
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/ITaskService.java
  12. 1812
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java
  13. 2
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskListQuery.java
  14. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessStatisticsDTO.java
  15. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml
  16. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessTaskService.java
  17. 801
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java
  18. 226
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperPhenomenonController.java
  19. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectServiceImpl.java
  20. 81
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java
  21. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/AreaMonthlyDetailsService.java
  22. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthlyDetailsServiceImpl.java
  23. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java
  24. 2
      hzims-service/operational/src/main/resources/application-dev.yml
  25. 6
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CheckMonthMapper.java
  26. 5
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CheckMonthMapper.xml
  27. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/serviceimpl/MaintenanceTempleServiceImpl.java

13
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/entity/OperAccessTaskEntity.java

@ -13,6 +13,7 @@ import org.springblade.core.tenant.mp.TenantEntity;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.time.YearMonth;
import java.util.Date;
/**
@ -147,4 +148,16 @@ public class OperAccessTaskEntity extends TenantEntity {
@ApiModelProperty("票据是否作废,仅当两票作废更新状态时使用")
@TableField(exist = false)
private boolean isInvalid;
@ApiModelProperty("区域Id")
@TableField(exist = false)
private String areaId;
@ApiModelProperty("年月")
@TableField(exist = false)
private YearMonth yearMonth;
}

22
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperPhenomenonEntity.java

@ -1,6 +1,7 @@
package com.hnac.hzims.operational.defect.entity;
import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@ -14,6 +15,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.YearMonth;
import java.util.Date;
import java.time.LocalDateTime;
@ -286,4 +288,24 @@ public class OperPhenomenonEntity extends TenantEntity {
@ApiModelProperty(value = "核算工时")
private Integer checkHours;
@ApiModelProperty(value = "年月")
@TableField(exist = false)
private YearMonth yearMonth;
@ApiModelProperty(value = "年月")
@TableField(exist = false)
private String areaId;
@ApiModelProperty(value = "是否为缺陷 直接传0")
@TableField(exist = false)
private Integer defect;
@ApiModelProperty(value = "已定论1")
@TableField(exist = false)
private Integer conclusionStatusNum;
}

17
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/feign/TaskFeignClient.java

@ -5,11 +5,14 @@ import com.hnac.hzinfo.inspect.areamonthly.vo.TaskListQuery;
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskVo;
import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import static com.hnac.hzinfo.inspect.Constants.APP_NAME;
@ -26,9 +29,21 @@ public interface TaskFeignClient {
@GetMapping("/task/list")
@ApiOperation(value = "分页显示任务列表", notes = "传入task")
public R<BladePage<TaskVo>> list(TaskListQuery task, Query query);
public R<BladePage<TaskVo>> list(@SpringQueryMap TaskListQuery task,@SpringQueryMap Query query);
@GetMapping(value = "/task/detail")
@ApiOperation(value = "查看,下面列表再调用eventController.list", notes = "传入taskid")
public R<TaskEntity> detail(@RequestParam Long id);
/**
* 巡检任务分页
*/
@GetMapping("/task/pageList/{page}/{size}")
@ApiOperation(value = "分页显示任务列表", notes = "传入task")
public R<BladePage<TaskVo>> pageList(
@ApiParam(name = "page", value = "当前页", required = true) @PathVariable("page") Long page,
@ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size,
@SpringQueryMap TaskListQuery task);
}

13
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/feign/fallback/TaskFeignClientFallback.java

@ -30,4 +30,17 @@ public class TaskFeignClientFallback implements TaskFeignClient {
public R<TaskEntity> detail(Long id) {
return R.fail("远程调用失败");
}
/**
* 巡检任务分页
*
* @param page
* @param size
* @param task
*/
@Override
public R<BladePage<TaskVo>> pageList(Long page, Long size, TaskListQuery task) {
return R.fail("远程调用失败");
}
}

2
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/TaskListQuery.java

@ -127,7 +127,7 @@ public class TaskListQuery implements Serializable {
* 月份
*/
@ApiModelProperty("月份")
private YearMonth yearmonth;
private YearMonth yearMonth;
/**
* 区域Id

3
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/CheckCompanyFeignClient.java

@ -11,6 +11,7 @@ import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -33,7 +34,7 @@ public interface CheckCompanyFeignClient {
@GetMapping("/CheckCompany/list")
@ApiOperationSupport(order = 50)
@ApiOperation(value = "分页", notes = "查询条件:startDate,endDate,status")
R<BladePage<CheckCompanyVo>> list(CheckCompanyEntity req, Query query);
R<BladePage<CheckCompanyVo>> list(@SpringQueryMap CheckCompanyEntity req,@SpringQueryMap Query query);
/**

4
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/SafeproductFeignClient.java

@ -13,6 +13,7 @@ import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
@ -32,7 +33,8 @@ public interface SafeproductFeignClient {
@GetMapping("/checkMonth/listconferenceScope/{page}/{size}")
@ApiOperationSupport(order = 50)
@ApiOperation(value = "分页", notes = "查询条件:month,status,createDept")
public R<BladePage<CheckMonthVo>> listconferenceScope(@PathVariable Long page, @PathVariable Long size, CheckMonthEntity req);
public R<BladePage<CheckMonthVo>> listconferenceScope(@PathVariable Long page, @PathVariable Long size,
@SpringQueryMap CheckMonthEntity req);
/**

2
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CheckMonthEntity.java

@ -48,7 +48,7 @@ public class CheckMonthEntity extends TenantEntity implements Serializable {
*/
@TableField(exist = false)
@ApiModelProperty("月份")
private YearMonth yearMonth;
private String yearMonth;

17
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.annotation.JsonRawValue;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.google.common.collect.Lists;
import com.hnac.hzinfo.core.push.enums.PushAudienceType;
@ -331,4 +332,20 @@ public class TaskController extends BladeController {
}
/**
* 巡检任务分页
*/
@GetMapping("/pageList/{page}/{size}")
@ApiOperation(value = "分页显示任务列表", notes = "传入task")
public R<BladePage<TaskVo>> pageList(
@ApiParam(name = "page", value = "当前页", required = true) @PathVariable("page") Long page,
@ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size,
TaskListQuery task){
Page<TaskEntity> pageInfo = new Page<>();
BladePage<TaskVo> pageList = taskService.selectPage(pageInfo,task);
return R.data(pageList);
}
}

8
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml

@ -162,11 +162,11 @@
<if test="task.taskIds != null and task.taskIds != ''">
and FIND_IN_SET(t.ID,#{task.taskIds})
</if>
<if test="task.areaId != null and task.areaId != ''">
and t.CREATE_DEPT = #{task.areaId})
<if test="task.areaId != null">
and t.CREATE_DEPT = #{task.areaId}
</if>
<if test="task.yearmonth != null and task.yearmonth != ''">
and date_format(t.PLAN_START_TIME,'%Y-%m')= #{task.yearmonth})
<if test="task.yearMonth != null">
and date_format(t.PLAN_START_TIME,'%Y-%m')= #{task.yearMonth}
</if>
order by t.UPDATE_TIME desc
</select>

11
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/ITaskService.java

@ -1,11 +1,13 @@
package com.hnac.hzinfo.inspect.task.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.vo.SafeCheckStatisticVO;
import com.hnac.hzinfo.inspect.task.entity.InspectionTaskSMS;
import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
import com.hnac.hzinfo.inspect.task.vo.*;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.RequestParam;
@ -174,4 +176,13 @@ public interface ITaskService extends BaseService<TaskEntity> {
* @return
*/
boolean collectingTask(List<Long> taskIds);
/**
* 巡检任务分页
* @param pageInfo
* @param task
* @return
*/
BladePage<TaskVo> selectPage(Page<TaskEntity> pageInfo, TaskListQuery task);
}

1812
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java

File diff suppressed because it is too large Load Diff

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskListQuery.java

@ -119,7 +119,7 @@ public class TaskListQuery implements Serializable {
/**
* 月份
*/
private YearMonth yearmonth;
private YearMonth yearMonth;
/**
* 区域Id

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessStatisticsDTO.java

@ -30,7 +30,7 @@ public class OperAccessStatisticsDTO extends OperAccessStatisticsEntity {
* 月份
*/
@ApiModelProperty("月份")
private YearMonth yearmonth;
private YearMonth yearMonth;
/**
* 区域Id

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml

@ -38,10 +38,10 @@
and OS.PLAN_END_TIME &lt;= #{dto.planEndTime}
</if>
<if test="dto.areaId != null and dto.areaId != ''">
and OS.CREATE_DEPT = #{dto.areaId}
and OT.CREATE_DEPT = #{dto.areaId}
</if>
<if test="dto.yearMonth != null">
and date_format(os.CREATE_TIME,'%Y-%m') = #{dto.yearMonth}
and date_format(OT.PLAN_START_TIME,'%Y-%m') = #{dto.yearMonth}
</if>
ORDER BY OS.CREATE_TIME DESC
</select>

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessTaskService.java

@ -1,8 +1,11 @@
package com.hnac.hzims.operational.access.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.operational.access.dto.OperAccessStatisticsDTO;
import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import com.hnac.hzims.operational.access.vo.OperAccessStatisticsVO;
import com.hnac.hzims.operational.access.vo.OperAccessTaskVO;
import com.hnac.hzims.operational.report.vo.AccessReportVO;
import com.hnac.hzims.vo.SafeCheckStatisticVO;
@ -64,4 +67,11 @@ public interface IOperAccessTaskService extends BaseService<OperAccessTaskEntity
*/
SafeCheckStatisticVO getAccessTaskCheck(String startDate,String endDate,Long dept);
/**
* 根据区域和月份分页查询检修任务
* @param dbPage
* @param result
*/
IPage<OperAccessTaskEntity> selectPage(Page<OperAccessTaskEntity> dbPage, OperAccessTaskEntity result);
}

801
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java

@ -4,9 +4,11 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.message.fegin.IMessagePushClient;
import com.hnac.hzims.message.req.PushExtrasReq;
import com.hnac.hzims.operational.OperationalConstants;
@ -37,6 +39,7 @@ import com.hnac.hzims.vo.SafeCheckStatisticVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
@ -71,427 +74,433 @@ import java.util.stream.Collectors;
@Slf4j
@AllArgsConstructor
public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMapper, OperAccessTaskEntity> implements IOperAccessTaskService {
private final IFlowClient flowClient;
private final IDangerSourceClient dangerSourceClient;
private final IOperAccessTaskDetailService detailService;
private final IOperAccessStatisticsService statisticsService;
private final IOperAccessContentService contentService;
private final OperAccessTaskMapper mapper;
private final IMessagePushClient messagePushClient;
private final OperPhenomenonMapper operPhenomenonMapper;
private final IUserClient userClient;
private final ISpareClient assetsClient;
private final IOperAccessMaterialService materialService;
private final IOperDefectService defectService;
private final IOperDefectStatisticsService defectStatisticsService;
private final IFlowClient flowClient;
private final IDangerSourceClient dangerSourceClient;
private final IOperAccessTaskDetailService detailService;
private final IOperAccessStatisticsService statisticsService;
private final IOperAccessContentService contentService;
private final OperAccessTaskMapper mapper;
private final IMessagePushClient messagePushClient;
private final OperPhenomenonMapper operPhenomenonMapper;
private final IUserClient userClient;
private final ISpareClient assetsClient;
private final IOperAccessMaterialService materialService;
private final IOperDefectService defectService;
private final IOperDefectStatisticsService defectStatisticsService;
@Transactional
@Override
public R doSave(OperAccessTaskDTO req) {
req.setCode("TASK" + DateUtil.format(DateUtil.now(), DateUtil.PATTERN_DATETIME_MINI) + new DecimalFormat("###").format(RandomUtils.nextInt(0, 999)));
List<OperAccessMaterialEntity> materialEntityList = JSONObject.parseArray(JSON.toJSONString(req.getAccessMaterials()),OperAccessMaterialEntity.class);
if(super.save(req)){
if(CollectionUtil.isNotEmpty(materialEntityList)) {
materialEntityList.stream().map(material->{
material.setPlanId(null);
material.setId(null);
material.setTaskId(req.getId());
return material;
}).collect(Collectors.toList());
materialService.saveOrUpdateBatch(materialEntityList);
}
this.updateDetails(req.getId(), req.getAccessTaskDetails());
//开启检修任务流程
R<BladeFlow> bladeFlowR = flowClient.startProcessInstanceContainNameByKey(
"access_task_execute",
FlowUtil.getBusinessKey("hzims_oper_access_task",String.valueOf(req.getId())),
req.getName(),
new HashMap<String, Object>() {{
put("taskId", req.getId());
put("handler", TaskUtil.getTaskUser(req.getHandler().toString()));
put("creator", TaskUtil.getTaskUser(AuthUtil.getUserId().toString()));
}});
Assert.isTrue(bladeFlowR.isSuccess() && ObjectUtil.isNotEmpty(bladeFlowR.getData()),()->{
throw new ServiceException("保存检修任务失败,开启检修任务流程失败!");
});
String processInstanceId = bladeFlowR.getData().getProcessInstanceId();
req.setProcessInstanceId(processInstanceId);
super.updateById(new OperAccessTaskEntity() {{
setId(req.getId());
setProcessInstanceId(processInstanceId);
}});
}
return R.success("OK");
}
@Transactional
@Override
public R doSave(OperAccessTaskDTO req) {
req.setCode("TASK" + DateUtil.format(DateUtil.now(), DateUtil.PATTERN_DATETIME_MINI) + new DecimalFormat("###").format(RandomUtils.nextInt(0, 999)));
List<OperAccessMaterialEntity> materialEntityList = JSONObject.parseArray(JSON.toJSONString(req.getAccessMaterials()), OperAccessMaterialEntity.class);
if (super.save(req)) {
if (CollectionUtil.isNotEmpty(materialEntityList)) {
materialEntityList.stream().map(material -> {
material.setPlanId(null);
material.setId(null);
material.setTaskId(req.getId());
return material;
}).collect(Collectors.toList());
materialService.saveOrUpdateBatch(materialEntityList);
}
this.updateDetails(req.getId(), req.getAccessTaskDetails());
//开启检修任务流程
R<BladeFlow> bladeFlowR = flowClient.startProcessInstanceContainNameByKey("access_task_execute", FlowUtil.getBusinessKey("hzims_oper_access_task", String.valueOf(req.getId())), req.getName(), new HashMap<String, Object>() {{
put("taskId", req.getId());
put("handler", TaskUtil.getTaskUser(req.getHandler().toString()));
put("creator", TaskUtil.getTaskUser(AuthUtil.getUserId().toString()));
}});
Assert.isTrue(bladeFlowR.isSuccess() && ObjectUtil.isNotEmpty(bladeFlowR.getData()), () -> {
throw new ServiceException("保存检修任务失败,开启检修任务流程失败!");
});
String processInstanceId = bladeFlowR.getData().getProcessInstanceId();
req.setProcessInstanceId(processInstanceId);
super.updateById(new OperAccessTaskEntity() {{
setId(req.getId());
setProcessInstanceId(processInstanceId);
}});
}
return R.success("OK");
}
@Override
public R doUpdateById(OperAccessTaskDTO req, ComleteTask comleteTask, Long handler) {
super.updateById(req);
OperAccessTaskEntity entity = super.getById(req.getId());
@Override
public R doUpdateById(OperAccessTaskDTO req, ComleteTask comleteTask, Long handler) {
super.updateById(req);
OperAccessTaskEntity entity = super.getById(req.getId());
if (req.getStatus() == AccessConstants.ACCESS_TASK_STATUS_4) {
List<OperAccessStatisticsEntity> statisticsList = statisticsService.list(new LambdaQueryWrapper<OperAccessStatisticsEntity>() {{
eq(OperAccessStatisticsEntity::getTaskId, req.getId());
}});
//台账
if (CollectionUtil.isEmpty(statisticsList)) {
OperAccessStatisticsDTO statisticsDTO = BeanUtil.copy(entity, OperAccessStatisticsDTO.class);
statisticsDTO.setId(null);
statisticsDTO.setTaskId(entity.getId());
statisticsDTO.setManager(entity.getHandler());
OperAccessContentEntity accessContentEntity = contentService.getById(req.getId());
if(ObjectUtil.isNotEmpty(accessContentEntity)){
statisticsDTO.setPid(accessContentEntity.getLibraryId());
}
statisticsService.doSave(statisticsDTO);
}
if (req.getStatus() == AccessConstants.ACCESS_TASK_STATUS_4) {
List<OperAccessStatisticsEntity> statisticsList = statisticsService.list(new LambdaQueryWrapper<OperAccessStatisticsEntity>() {{
eq(OperAccessStatisticsEntity::getTaskId, req.getId());
}});
//台账
if (CollectionUtil.isEmpty(statisticsList)) {
OperAccessStatisticsDTO statisticsDTO = BeanUtil.copy(entity, OperAccessStatisticsDTO.class);
statisticsDTO.setId(null);
statisticsDTO.setTaskId(entity.getId());
statisticsDTO.setManager(entity.getHandler());
OperAccessContentEntity accessContentEntity = contentService.getById(req.getId());
if (ObjectUtil.isNotEmpty(accessContentEntity)) {
statisticsDTO.setPid(accessContentEntity.getLibraryId());
}
statisticsService.doSave(statisticsDTO);
}
//材料库出库
if(CollectionUtil.isNotEmpty(req.getAccessMaterials())){
List<OperAccessMaterialDTO> materialDTOList = req.getAccessMaterials();
for (OperAccessMaterialDTO materialDTO : materialDTOList) {
SpRecordEntity recordEntity = new SpRecordEntity();
recordEntity.setSpBasicId(materialDTO.getSpBasicId());
recordEntity.setAmount(materialDTO.getNumber());
recordEntity.setWarehouseId(materialDTO.getWarehouseId());
recordEntity.setHandler(req.getHandler());
recordEntity.setCreateDept(req.getCreateDept());
recordEntity.setCreateUser(req.getCreateUser());
Boolean result = assetsClient.warehouseOut(recordEntity);
if(!result) {
return R.fail("出库失败");
}
materialDTO.setTaskId(entity.getId());
materialDTO.setPlanId(entity.getPlanId());
}
}
//审核完成 关闭工作流
R flowResult = flowClient.completeTask(comleteTask);
this.finishDefectFlow(entity);
//材料库出库
if (CollectionUtil.isNotEmpty(req.getAccessMaterials())) {
List<OperAccessMaterialDTO> materialDTOList = req.getAccessMaterials();
for (OperAccessMaterialDTO materialDTO : materialDTOList) {
SpRecordEntity recordEntity = new SpRecordEntity();
recordEntity.setSpBasicId(materialDTO.getSpBasicId());
recordEntity.setAmount(materialDTO.getNumber());
recordEntity.setWarehouseId(materialDTO.getWarehouseId());
recordEntity.setHandler(req.getHandler());
recordEntity.setCreateDept(req.getCreateDept());
recordEntity.setCreateUser(req.getCreateUser());
Boolean result = assetsClient.warehouseOut(recordEntity);
if (!result) {
return R.fail("出库失败");
}
materialDTO.setTaskId(entity.getId());
materialDTO.setPlanId(entity.getPlanId());
}
}
//审核完成 关闭工作流
R flowResult = flowClient.completeTask(comleteTask);
this.finishDefectFlow(entity);
if(!flowResult.isSuccess()) {
throw new ServiceException(flowResult.getMsg());
}
}
if (!flowResult.isSuccess()) {
throw new ServiceException(flowResult.getMsg());
}
} else if (req.getStatus() == AccessConstants.ACCESS_TASK_STATUS_2) {
updateMaterials(entity.getPlanId(), entity.getId(), req.getAccessMaterials());
//工作流下一步
completeTask(comleteTask, handler, entity.getProcessInstanceId(), entity.getCreateDept());
}
else if (req.getStatus() == AccessConstants.ACCESS_TASK_STATUS_2) {
updateMaterials(entity.getPlanId(), entity.getId(), req.getAccessMaterials());
//工作流下一步
completeTask(comleteTask, handler, entity.getProcessInstanceId(), entity.getCreateDept());
}
//如果任务审批未通过 需重新开票 将任务ticketId置空
else if (req.getStatus() == AccessConstants.ACCESS_TASK_STATUS_3) {
LambdaUpdateWrapper<OperAccessTaskEntity> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(OperAccessTaskEntity::getTicketId, null);
updateWrapper.eq(OperAccessTaskEntity::getId, entity.getId());
super.update(updateWrapper);
R result = flowClient.completeTask(comleteTask);
if (!result.isSuccess()) {
throw new ServiceException(result.getMsg());
}
//如果任务审批未通过 需重新开票 将任务ticketId置空
else if(req.getStatus() == AccessConstants.ACCESS_TASK_STATUS_3) {
LambdaUpdateWrapper<OperAccessTaskEntity> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(OperAccessTaskEntity::getTicketId, null);
updateWrapper.eq(OperAccessTaskEntity::getId, entity.getId());
super.update(updateWrapper);
R result = flowClient.completeTask(comleteTask);
if(!result.isSuccess()){
throw new ServiceException(result.getMsg());
}
}
return R.data("操作成功!");
}
}
return R.data("操作成功!");
}
@Override
public R<OperAccessTaskVO> detail(Long id) {
OperAccessTaskVO detail = OperAccessTaskWrapper.build().entityVO(super.getById(id));
detail.setDangerSources(dangerSourceClient.details(detail.getSafeInfos().split(",")));
detail.setDetails(OperAccessTaskDetailWrapper.build().listVO(detailService.list(new LambdaQueryWrapper<OperAccessTaskDetailEntity>() {{
eq(OperAccessTaskDetailEntity::getTaskId, id);
}})));
detail.setAccessMaterials(materialService.getList(null, String.valueOf(id)));
if (Func.isNotEmpty(id)) {
OperAccessTaskVO operAccessTaskVO = mapper.getAccessPlanByTaskId(id.toString());
if (ObjectUtil.isNotEmpty(operAccessTaskVO)) {
detail.setPlanName(operAccessTaskVO.getPlanName());
}
}
return R.data(detail);
}
@Override
public R<OperAccessTaskVO> detail(Long id) {
OperAccessTaskVO detail = OperAccessTaskWrapper.build().entityVO(super.getById(id));
detail.setDangerSources(dangerSourceClient.details(detail.getSafeInfos().split(",")));
detail.setDetails(
OperAccessTaskDetailWrapper.build().listVO(
detailService.list(new LambdaQueryWrapper<OperAccessTaskDetailEntity>() {{
eq(OperAccessTaskDetailEntity::getTaskId, id);
}})
)
);
detail.setAccessMaterials(materialService.getList(null, String.valueOf(id)));
if(Func.isNotEmpty(id)){
OperAccessTaskVO operAccessTaskVO = mapper.getAccessPlanByTaskId(id.toString());
if(ObjectUtil.isNotEmpty(operAccessTaskVO)){
detail.setPlanName(operAccessTaskVO.getPlanName());
}
}
return R.data(detail);
}
@Override
public R<IPage<OperAccessTaskVO>> list(OperAccessTaskDTO req, Query query) {
IPage<OperAccessTaskVO> page = Condition.getPage(query);
List<OperAccessTaskVO> data = mapper.pageCondition(page, req);
page.setRecords(OperAccessTaskWrapper.build().listVOExtras(data));
return R.data(page);
}
@Override
public R<IPage<OperAccessTaskVO>> list(OperAccessTaskDTO req, Query query) {
IPage<OperAccessTaskVO> page = Condition.getPage(query);
List<OperAccessTaskVO> data = mapper.pageCondition(page, req);
page.setRecords(OperAccessTaskWrapper.build().listVOExtras(data));
return R.data(page);
}
@Override
public List<OperAccessTaskEntity> getByEmCode(String emCode, List<String> list) {
return this.baseMapper.selectByEmCode(emCode, list);
}
@Override
public List<OperAccessTaskEntity> getByEmCode(String emCode, List<String> list) {
return this.baseMapper.selectByEmCode(emCode,list);
}
@Override
public List<AccessReportVO> getAccessTaskByDisposer(LocalDate startDate, LocalDate endDate, List<Long> deptIdList) {
List<AccessReportVO> inspectOrAccessReportVOList = new ArrayList<>();
//获取月份内的检修任务
List<OperAccessTaskEntity> operAccessTaskEntityList = this.list(new LambdaQueryWrapper<OperAccessTaskEntity>() {{
ge(OperAccessTaskEntity::getPlanStartTime, startDate);
le(OperAccessTaskEntity::getPlanStartTime, endDate);
in(OperAccessTaskEntity::getCreateDept, deptIdList);
}});
//组合处理人
Map<Long, List<OperAccessTaskEntity>> mapByDisposer = operAccessTaskEntityList.stream().collect(Collectors.groupingBy(OperAccessTaskEntity::getHandler));
@Override
public List<AccessReportVO> getAccessTaskByDisposer(LocalDate startDate, LocalDate endDate, List<Long> deptIdList) {
List<AccessReportVO> inspectOrAccessReportVOList = new ArrayList<>();
//获取月份内的检修任务
List<OperAccessTaskEntity> operAccessTaskEntityList = this.list(new LambdaQueryWrapper<OperAccessTaskEntity>(){{
ge(OperAccessTaskEntity::getPlanStartTime,startDate);
le(OperAccessTaskEntity::getPlanStartTime,endDate);
in(OperAccessTaskEntity::getCreateDept,deptIdList);
}});
//组合处理人
Map<Long,List<OperAccessTaskEntity>> mapByDisposer = operAccessTaskEntityList.stream().collect(Collectors.groupingBy(OperAccessTaskEntity::getHandler));
mapByDisposer.forEach((userId, list) -> {
AccessReportVO accessReportVO = new AccessReportVO();
accessReportVO.setUserName(UserCache.getUser(userId).getName());
accessReportVO.setData(list);
//已完成情况
List<OperAccessTaskEntity> finishList = list.stream().filter(o -> AccessConstants.ACCESS_TASK_STATUS_4 == o.getStatus()).collect(Collectors.toList());
accessReportVO.setCompleteNum(finishList.size());
accessReportVO.setCompleteSituation(finishList.size() + "");
//未完成情况
List<OperAccessTaskEntity> immatureList = list.stream().filter(o -> AccessConstants.ACCESS_TASK_STATUS_4 != o.getStatus()).collect(Collectors.toList());
accessReportVO.setIncompleteNum(immatureList.size());
accessReportVO.setIncompleteSituation(immatureList.size() + "");
//工时
int hours = list.stream().filter(o -> o.getActHours() != null).collect(Collectors.summingInt(OperAccessTaskEntity::getActHours));
accessReportVO.setHours(hours);
//发现问题数量
List<OperPhenomenonEntity> operPhenomenonEntityList = operPhenomenonMapper.selectList(new LambdaQueryWrapper<OperPhenomenonEntity>() {{
eq(OperPhenomenonEntity::getFinder, userId);
ge(OperPhenomenonEntity::getFindTime, startDate);
le(OperPhenomenonEntity::getFindTime, endDate);
eq(OperPhenomenonEntity::getSourceCode, DefectConstant.DefectSourceEnum.JX.getStatus());
}});
accessReportVO.setFindProblemCount(operPhenomenonEntityList.size());
inspectOrAccessReportVOList.add(accessReportVO);
});
return inspectOrAccessReportVOList;
}
mapByDisposer.forEach((userId,list)->{
AccessReportVO accessReportVO = new AccessReportVO();
accessReportVO.setUserName(UserCache.getUser(userId).getName());
accessReportVO.setData(list);
//已完成情况
List<OperAccessTaskEntity> finishList = list.stream().filter(o-> AccessConstants.ACCESS_TASK_STATUS_4 == o.getStatus()).collect(Collectors.toList());
accessReportVO.setCompleteNum(finishList.size());
accessReportVO.setCompleteSituation(finishList.size()+"");
//未完成情况
List<OperAccessTaskEntity> immatureList = list.stream().filter(o-> AccessConstants.ACCESS_TASK_STATUS_4 != o.getStatus()).collect(Collectors.toList());
accessReportVO.setIncompleteNum(immatureList.size());
accessReportVO.setIncompleteSituation(immatureList.size()+"");
//工时
int hours = list.stream().filter(o->o.getActHours() != null).collect(Collectors.summingInt(OperAccessTaskEntity::getActHours));
accessReportVO.setHours(hours);
//发现问题数量
List<OperPhenomenonEntity> operPhenomenonEntityList = operPhenomenonMapper.selectList(new LambdaQueryWrapper<OperPhenomenonEntity>(){{
eq(OperPhenomenonEntity::getFinder,userId);
ge(OperPhenomenonEntity::getFindTime,startDate);
le(OperPhenomenonEntity::getFindTime,endDate);
eq(OperPhenomenonEntity::getSourceCode, DefectConstant.DefectSourceEnum.JX.getStatus());
}});
accessReportVO.setFindProblemCount(operPhenomenonEntityList.size());
inspectOrAccessReportVOList.add(accessReportVO);
});
return inspectOrAccessReportVOList;
}
@Override
public List<AccessReportVO> getAccessTaskByDisposer(Map<String, Object> params) {
LocalDate startDate = LocalDate.parse(params.get("startDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
LocalDate endDate = LocalDate.parse(params.get("endDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
List<Long> deptIdList = (List<Long>) params.get("deptId");
return getAccessTaskByDisposer(startDate, endDate, deptIdList);
}
@Override
public List<AccessReportVO> getAccessTaskByDisposer(Map<String,Object> params) {
LocalDate startDate = LocalDate.parse(params.get("startDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
LocalDate endDate = LocalDate.parse(params.get("endDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
List<Long> deptIdList = (List<Long>)params.get("deptId");
return getAccessTaskByDisposer(startDate,endDate,deptIdList);
}
@Override
public List<Map<String, Object>> getAccessConclusion(Map<String, Object> params) {
return mapper.getAccessConclusion(params);
}
@Override
public List<Map<String, Object>> getAccessConclusion(Map<String, Object> params) {
return mapper.getAccessConclusion(params);
}
@Override
public List<OperAccessTaskEntity> getAccessTask(String startTime, String endTime, List<Long> list) {
return this.baseMapper.selectAccessTask(startTime, endTime, list);
}
@Override
public List<OperAccessTaskEntity> getAccessTask(String startTime,String endTime,List<Long> list) {
return this.baseMapper.selectAccessTask(startTime,endTime,list);
}
/**
* 调整明细
*
* @author xiashandong
**/
@Transactional(rollbackFor = Exception.class)
public void updateDetails(long taskId, List<OperAccessTaskDetailDTO> details) {
if (CollectionUtils.isEmpty(details)) {
return;
}
/**
* 调整明细
*
* @author xiashandong
**/
@Transactional(rollbackFor = Exception.class)
public void updateDetails(long taskId, List<OperAccessTaskDetailDTO> details) {
if (CollectionUtils.isEmpty(details)) {
return;
}
//查询已经存在的明细,并删除部分需要删除的
List<OperAccessTaskDetailEntity> existsDetails = detailService.list(new LambdaQueryWrapper<OperAccessTaskDetailEntity>() {{
eq(OperAccessTaskDetailEntity::getTaskId, taskId);
eq(OperAccessTaskDetailEntity::getIsDeleted, 0L);
}});
Set<Long> detailIds = details.stream().filter(o -> o.getId() != null).map(OperAccessTaskDetailDTO::getId).collect(Collectors.toSet());
List<Long> ids = existsDetails.stream().filter(o -> !detailIds.contains(o.getId())).map(OperAccessTaskDetailEntity::getId).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(ids)) {
detailService.deleteLogic(ids);
}
//查询已经存在的明细,并删除部分需要删除的
List<OperAccessTaskDetailEntity> existsDetails = detailService.list(new LambdaQueryWrapper<OperAccessTaskDetailEntity>() {{
eq(OperAccessTaskDetailEntity::getTaskId, taskId);
eq(OperAccessTaskDetailEntity::getIsDeleted, 0L);
}});
Set<Long> detailIds = details.stream().filter(o -> o.getId() != null).map(OperAccessTaskDetailDTO::getId).collect(Collectors.toSet());
List<Long> ids = existsDetails.stream().filter(o -> !detailIds.contains(o.getId())).map(OperAccessTaskDetailEntity::getId).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(ids)) {
detailService.deleteLogic(ids);
}
//新增或修改操作
Set<Long> existsIds = existsDetails.stream().map(OperAccessTaskDetailEntity::getId).collect(Collectors.toSet());
for (OperAccessTaskDetailDTO req : details) {
req.setTaskId(taskId);
if (req.getId() == null) {
detailService.doSave(req);
} else if (req.getId() != null && existsIds.contains(req.getId())) {
detailService.updateById(req);
} else {
detailService.doSave(req);
}
}
}
//新增或修改操作
Set<Long> existsIds = existsDetails.stream().map(OperAccessTaskDetailEntity::getId).collect(Collectors.toSet());
for (OperAccessTaskDetailDTO req : details) {
req.setTaskId(taskId);
if (req.getId() == null) {
detailService.doSave(req);
} else if (req.getId() != null && existsIds.contains(req.getId())) {
detailService.updateById(req);
} else {
detailService.doSave(req);
}
}
}
/**
* 调整检修材料
*
* @author xiashandong
**/
@Transactional(rollbackFor = Exception.class)
public void updateMaterials(long planId, long taskId, List<OperAccessMaterialDTO> materials) {
if (CollectionUtils.isEmpty(materials)) {
materials = new ArrayList<>();
}
//查询已经存在的检修库明细,并删除部分需要删除的
List<OperAccessMaterialEntity> existsDetails = materialService.list(new LambdaQueryWrapper<OperAccessMaterialEntity>() {{
eq(OperAccessMaterialEntity::getPlanId, planId);
eq(OperAccessMaterialEntity::getTaskId, taskId);
eq(OperAccessMaterialEntity::getIsDeleted, 0L);
}});
Set<Long> detailIds = materials.stream().filter(o -> o.getId() != null).map(OperAccessMaterialDTO::getId).collect(Collectors.toSet());
List<Long> ids = existsDetails.stream().filter(o -> !detailIds.contains(o.getId())).map(OperAccessMaterialEntity::getId).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(ids)) {
materialService.deleteLogic(ids);
}
if (CollectionUtil.isNotEmpty(materials)) {
List<OperAccessMaterialEntity> materialEntityList = JSONArray.parseArray(JSON.toJSONString(materials), OperAccessMaterialEntity.class);
materialService.saveOrUpdateBatch(materialEntityList);
}
}
/**
* 调整检修材料
*
* @author xiashandong
**/
@Transactional(rollbackFor = Exception.class)
public void updateMaterials(long planId,long taskId, List<OperAccessMaterialDTO> materials) {
if (CollectionUtils.isEmpty(materials)) {
materials = new ArrayList<>();
}
//查询已经存在的检修库明细,并删除部分需要删除的
List<OperAccessMaterialEntity> existsDetails = materialService.list(new LambdaQueryWrapper<OperAccessMaterialEntity>() {{
eq(OperAccessMaterialEntity::getPlanId, planId);
eq(OperAccessMaterialEntity::getTaskId, taskId);
eq(OperAccessMaterialEntity::getIsDeleted, 0L);
}});
Set<Long> detailIds = materials.stream().filter(o -> o.getId() != null).map(OperAccessMaterialDTO::getId).collect(Collectors.toSet());
List<Long> ids = existsDetails.stream().filter(o -> !detailIds.contains(o.getId())).map(OperAccessMaterialEntity::getId).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(ids)) {
materialService.deleteLogic(ids);
}
if(CollectionUtil.isNotEmpty(materials)){
List<OperAccessMaterialEntity> materialEntityList = JSONArray.parseArray(JSON.toJSONString(materials),OperAccessMaterialEntity.class);
materialService.saveOrUpdateBatch(materialEntityList);
}
}
/**
* 执行检修任务
*
* @param accessTaskDTO
* @return
*/
@Override
public R finishAccessTask(OperAccessTaskDTO accessTaskDTO) {
OperAccessTaskEntity taskEntity = getById(accessTaskDTO.getId());
//TODO 更新任务状态以及 填入数据(待确认)
taskEntity.setStatus(AccessConstants.ACCESS_TASK_STATUS_2);
taskEntity.setActHours(accessTaskDTO.getActHours());
if (updateById(taskEntity)) {
//更新材料
updateMaterials(taskEntity.getPlanId(), taskEntity.getId(), accessTaskDTO.getAccessMaterials());
//终结工作流
ComleteTask comleteTask = new ComleteTask();
comleteTask.setProcessInstanceId(taskEntity.getProcessInstanceId());
comleteTask.setFlag("ok");
comleteTask.setPass(true);
comleteTask.setComment("执行任务完成,进行下一步流程");
this.completeTask(comleteTask, AuthUtil.getUserId(), taskEntity.getProcessInstanceId(), taskEntity.getCreateDept());
}
return R.success("操作成功");
}
/**
* 执行检修任务
* @param accessTaskDTO
* @return
*/
@Override
public R finishAccessTask(OperAccessTaskDTO accessTaskDTO) {
OperAccessTaskEntity taskEntity = getById(accessTaskDTO.getId());
//TODO 更新任务状态以及 填入数据(待确认)
taskEntity.setStatus(AccessConstants.ACCESS_TASK_STATUS_2);
taskEntity.setActHours(accessTaskDTO.getActHours());
if(updateById(taskEntity)) {
//更新材料
updateMaterials(taskEntity.getPlanId(), taskEntity.getId(), accessTaskDTO.getAccessMaterials());
//终结工作流
ComleteTask comleteTask = new ComleteTask();
comleteTask.setProcessInstanceId(taskEntity.getProcessInstanceId());
comleteTask.setFlag("ok");
comleteTask.setPass(true);
comleteTask.setComment("执行任务完成,进行下一步流程");
this.completeTask(comleteTask,AuthUtil.getUserId(),taskEntity.getProcessInstanceId(),taskEntity.getCreateDept());
}
return R.success("操作成功");
}
/**
* 获取安全检查定期检修项统计
*
* @param startDate 开始时间
* @param endDate 结束时间
* @param dept 机构ID
* @return SafeCheckStatisticVO对象
*/
@Override
public SafeCheckStatisticVO getAccessTaskCheck(String startDate, String endDate, Long dept) {
SafeCheckStatisticVO vo = new SafeCheckStatisticVO();
List<OperAccessTaskEntity> taskEntityList = this.list(Wrappers.<OperAccessTaskEntity>lambdaQuery().eq(OperAccessTaskEntity::getStatus, AccessConstants.ACCESS_TASK_STATUS_4).ge(OperAccessTaskEntity::getCreateTime, startDate).le(OperAccessTaskEntity::getCreateTime, endDate).eq(OperAccessTaskEntity::getCreateDept, dept));
vo.setProjectType(Constants.SafeCheckProjectEnum.ACCESS_TASK.getType());
vo.setProjectTypeName(Constants.SafeCheckProjectEnum.ACCESS_TASK.getName());
vo.setTotal(taskEntityList.size());
return vo;
}
/**
* 获取安全检查定期检修项统计
* @param startDate 开始时间
* @param endDate 结束时间
* @param dept 机构ID
* @return SafeCheckStatisticVO对象
*/
@Override
public SafeCheckStatisticVO getAccessTaskCheck(String startDate, String endDate, Long dept) {
SafeCheckStatisticVO vo = new SafeCheckStatisticVO();
List<OperAccessTaskEntity> taskEntityList = this.list(Wrappers.<OperAccessTaskEntity>lambdaQuery()
.eq(OperAccessTaskEntity::getStatus,AccessConstants.ACCESS_TASK_STATUS_4)
.ge(OperAccessTaskEntity::getCreateTime,startDate)
.le(OperAccessTaskEntity::getCreateTime,endDate)
.eq(OperAccessTaskEntity::getCreateDept,dept)
);
vo.setProjectType(Constants.SafeCheckProjectEnum.ACCESS_TASK.getType());
vo.setProjectTypeName(Constants.SafeCheckProjectEnum.ACCESS_TASK.getName());
vo.setTotal(taskEntityList.size());
return vo;
}
/**
* 根据区域和月份分页查询检修任务
*
* @param dbPage
* @param result
*/
@Override
public IPage<OperAccessTaskEntity> selectPage(Page<OperAccessTaskEntity> dbPage, OperAccessTaskEntity result) {
QueryWrapper<OperAccessTaskEntity> queryWrapper = new QueryWrapper<>();
//区域
queryWrapper.eq(StringUtils.isNotBlank(result.getAreaId()), "CREATE_DEPT", result.getAreaId());
//月份
queryWrapper.eq(result.getYearMonth() != null, "date_format(PLAN_START_TIME, '%Y-%m')", result.getYearMonth());
//任务名称
queryWrapper.eq(StringUtils.isNotBlank(result.getName()), "name", result.getName());
//状态
queryWrapper.eq(result.getStatus() != null, "STATUS", result.getStatus());
/***
* 根据流程ID和处理人完成任务
* @param comleteTask
* @param handler
* @param processInstanceId
*/
private void completeTask(ComleteTask comleteTask, Long handler, String processInstanceId, Long deptId) {
if(ObjectUtil.isNotEmpty(handler)){
String taskUser = StringUtil.format("{}_{}",new String[]{"taskUser",String.valueOf(handler)});
R<BladeFlow> bladeFlowR = flowClient.getTaskByProcessInstanceIdAndUserId(processInstanceId,taskUser);
if(!bladeFlowR.isSuccess() || ObjectUtil.isEmpty(bladeFlowR.getData())){
throw new ServiceException("获取检修任务工作流任务失败");
}
//若成功则封装CompleteTask 执行任务
comleteTask.setProcessInstanceId(processInstanceId);
comleteTask.setTaskId(bladeFlowR.getData().getTaskId());
}
//获取检修任务审批人角色下的审批人列表
R<List<User>> userListR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), deptId, AccessConstants.TASK_REVIEWER);
if(!userListR.isSuccess()){
throw new ServiceException(userListR.getMsg());
}
if(ObjectUtil.isNotEmpty(userListR.getData())) {
String reviewer = userListR.getData().stream().map(user->StringUtil.format("{}_{}","taskUser",String.valueOf(user.getId())))
.collect(Collectors.joining(","));
Map<String,Object> variables = new HashMap<>(1);
variables.put("reviewer",reviewer);
comleteTask.setVariables(variables);
}
return baseMapper.selectPage(dbPage, queryWrapper);
}
R result = flowClient.completeTask(comleteTask);
if(!result.isSuccess()){
throw new ServiceException(result.getMsg());
}
}
/***
* 根据流程ID和处理人完成任务
* @param comleteTask
* @param handler
* @param processInstanceId
*/
private void completeTask(ComleteTask comleteTask, Long handler, String processInstanceId, Long deptId) {
if (ObjectUtil.isNotEmpty(handler)) {
String taskUser = StringUtil.format("{}_{}", new String[]{"taskUser", String.valueOf(handler)});
R<BladeFlow> bladeFlowR = flowClient.getTaskByProcessInstanceIdAndUserId(processInstanceId, taskUser);
if (!bladeFlowR.isSuccess() || ObjectUtil.isEmpty(bladeFlowR.getData())) {
throw new ServiceException("获取检修任务工作流任务失败");
}
//若成功则封装CompleteTask 执行任务
comleteTask.setProcessInstanceId(processInstanceId);
comleteTask.setTaskId(bladeFlowR.getData().getTaskId());
}
//获取检修任务审批人角色下的审批人列表
R<List<User>> userListR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), deptId, AccessConstants.TASK_REVIEWER);
if (!userListR.isSuccess()) {
throw new ServiceException(userListR.getMsg());
}
if (ObjectUtil.isNotEmpty(userListR.getData())) {
String reviewer = userListR.getData().stream().map(user -> StringUtil.format("{}_{}", "taskUser", String.valueOf(user.getId()))).collect(Collectors.joining(","));
Map<String, Object> variables = new HashMap<>(1);
variables.put("reviewer", reviewer);
comleteTask.setVariables(variables);
}
/**
* 根据检修任务完成缺陷处理流程
* @param accessTaskEntity
*/
private void finishDefectFlow(OperAccessTaskEntity accessTaskEntity) {
if(Func.isNotEmpty(accessTaskEntity.getPhenomenonId())) {
OperPhenomenonEntity operPhenomenonEntity = operPhenomenonMapper.selectById(accessTaskEntity.getPhenomenonId());
operPhenomenonEntity.setHandleStatus(RepairConstant.CONCLUSION_PROBLEM);
//operPhenomenonEntity.setCheckHours(accessTaskEntity.getActHours());
operPhenomenonMapper.updateById(operPhenomenonEntity);
String processInstanceId = operPhenomenonEntity.getCheckProcessInstanceId();
//获取缺陷
OperDefectEntity operDefectEntity = defectService.getOne(Wrappers.<OperDefectEntity>lambdaQuery()
.eq(OperDefectEntity::getDefectCode, operPhenomenonEntity.getDefectCode())
.last("limit 1;")
);
if(ObjectUtil.isNotEmpty(operDefectEntity)) {
operDefectEntity.setActEndTime(new Date());
operDefectEntity.setActHours(ObjectUtil.isNotEmpty(accessTaskEntity.getActHours()) ? accessTaskEntity.getActHours().toString() : null);
operDefectEntity.setHandleStatus(RepairConstant.CONCLUSION_PROBLEM);
operDefectEntity.setDisposeDesc(accessTaskEntity.getDescripiton());
defectService.updateById(operDefectEntity);
}
R result = flowClient.completeTask(comleteTask);
if (!result.isSuccess()) {
throw new ServiceException(result.getMsg());
}
}
ComleteTask comleteTask = new ComleteTask();
comleteTask.setProcessInstanceId(processInstanceId);
//获取当前环节taskId
R<BladeFlow> bladeFlowR = flowClient.getTaskByProcessInstanceIdAndUserId(processInstanceId, "taskUser_"+AuthUtil.getUserId());
Assert.isTrue(bladeFlowR.isSuccess() && ObjectUtil.isNotEmpty(bladeFlowR.getData()),()->{
throw new ServiceException("当前操作人获取消缺任务失败");
});
comleteTask.setTaskId(bladeFlowR.getData().getTaskId());
comleteTask.setComment("审批通过工作流结束");
comleteTask.setFlag("ok");
comleteTask.setPass(true);
Map<String,Object> variables = new HashMap<>(1);
R<List<User>> listR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), operDefectEntity.getCreateDept(), DefectConstant.PROCESS_VARIABLE_CONCLUSION);
Assert.isTrue(listR.isSuccess() && ObjectUtil.isNotEmpty(listR.getData()),()->{
throw new ServiceException("获取问题定论人失败");
});
String conclusion = listR.getData().stream().map(user->"taskUser_"+user.getId()).collect(Collectors.joining(","));
variables.put("conclusion",conclusion);
comleteTask.setVariables(variables);
flowClient.completeTask(comleteTask);
}
}
/**
* 根据检修任务完成缺陷处理流程
*
* @param accessTaskEntity
*/
private void finishDefectFlow(OperAccessTaskEntity accessTaskEntity) {
if (Func.isNotEmpty(accessTaskEntity.getPhenomenonId())) {
OperPhenomenonEntity operPhenomenonEntity = operPhenomenonMapper.selectById(accessTaskEntity.getPhenomenonId());
operPhenomenonEntity.setHandleStatus(RepairConstant.CONCLUSION_PROBLEM);
//operPhenomenonEntity.setCheckHours(accessTaskEntity.getActHours());
operPhenomenonMapper.updateById(operPhenomenonEntity);
String processInstanceId = operPhenomenonEntity.getCheckProcessInstanceId();
//获取缺陷
OperDefectEntity operDefectEntity = defectService.getOne(Wrappers.<OperDefectEntity>lambdaQuery().eq(OperDefectEntity::getDefectCode, operPhenomenonEntity.getDefectCode()).last("limit 1;"));
if (ObjectUtil.isNotEmpty(operDefectEntity)) {
operDefectEntity.setActEndTime(new Date());
operDefectEntity.setActHours(ObjectUtil.isNotEmpty(accessTaskEntity.getActHours()) ? accessTaskEntity.getActHours().toString() : null);
operDefectEntity.setHandleStatus(RepairConstant.CONCLUSION_PROBLEM);
operDefectEntity.setDisposeDesc(accessTaskEntity.getDescripiton());
defectService.updateById(operDefectEntity);
}
/**
* 巡检任务生成后待办消息提示
* @param req
*/
private void pushHandleMessage(OperAccessTaskDTO operAccessTaskDTO,PushExtrasReq req){
req.setTitle(AccessConstants.MESSAGE_TITLE);
req.setType(AccessConstants.MESSAGE_ACCESS_TYPE);
req.setBusinessClassify(OperationalConstants.MessageClassifyEnum.MESSAGE_REMINDSY.getVal());
req.setPushAlert(AccessConstants.AccessProcessEnum.ACCESS_BACKLOG.getMsg());
log.info("--------消息推送开始----------");
messagePushClient.sendMessage(operAccessTaskDTO.getHandler().toString(), req,operAccessTaskDTO.getTenantId(),operAccessTaskDTO.getCreateDept(),operAccessTaskDTO.getCreateUser());
log.info("消息推送人为:{},推送消息为:{}",operAccessTaskDTO.getHandler().toString(),AccessConstants.AccessProcessEnum.ACCESS_BACKLOG.getMsg());
log.info("--------消息推送成功----------");
}
ComleteTask comleteTask = new ComleteTask();
comleteTask.setProcessInstanceId(processInstanceId);
//获取当前环节taskId
R<BladeFlow> bladeFlowR = flowClient.getTaskByProcessInstanceIdAndUserId(processInstanceId, "taskUser_" + AuthUtil.getUserId());
Assert.isTrue(bladeFlowR.isSuccess() && ObjectUtil.isNotEmpty(bladeFlowR.getData()), () -> {
throw new ServiceException("当前操作人获取消缺任务失败");
});
comleteTask.setTaskId(bladeFlowR.getData().getTaskId());
comleteTask.setComment("审批通过工作流结束");
comleteTask.setFlag("ok");
comleteTask.setPass(true);
Map<String, Object> variables = new HashMap<>(1);
R<List<User>> listR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), operDefectEntity.getCreateDept(), DefectConstant.PROCESS_VARIABLE_CONCLUSION);
Assert.isTrue(listR.isSuccess() && ObjectUtil.isNotEmpty(listR.getData()), () -> {
throw new ServiceException("获取问题定论人失败");
});
String conclusion = listR.getData().stream().map(user -> "taskUser_" + user.getId()).collect(Collectors.joining(","));
variables.put("conclusion", conclusion);
comleteTask.setVariables(variables);
flowClient.completeTask(comleteTask);
}
}
/**
* 巡检任务生成后待办消息提示
*
* @param req
*/
private void pushHandleMessage(OperAccessTaskDTO operAccessTaskDTO, PushExtrasReq req) {
req.setTitle(AccessConstants.MESSAGE_TITLE);
req.setType(AccessConstants.MESSAGE_ACCESS_TYPE);
req.setBusinessClassify(OperationalConstants.MessageClassifyEnum.MESSAGE_REMINDSY.getVal());
req.setPushAlert(AccessConstants.AccessProcessEnum.ACCESS_BACKLOG.getMsg());
log.info("--------消息推送开始----------");
messagePushClient.sendMessage(operAccessTaskDTO.getHandler().toString(), req, operAccessTaskDTO.getTenantId(), operAccessTaskDTO.getCreateDept(), operAccessTaskDTO.getCreateUser());
log.info("消息推送人为:{},推送消息为:{}", operAccessTaskDTO.getHandler().toString(), AccessConstants.AccessProcessEnum.ACCESS_BACKLOG.getMsg());
log.info("--------消息推送成功----------");
}
}

226
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperPhenomenonController.java

@ -45,107 +45,127 @@ import java.util.Date;
@Validated
public class OperPhenomenonController extends BladeController {
private final IOperPhenomenonService phenomenonService;
/**
* 详情
*/
@ApiLog
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入phenomenon")
public R<OperPhenomenonVO> detail(OperPhenomenonEntity phenomenon) {
OperPhenomenonEntity detail = phenomenonService.getOne(Condition.getQueryWrapper(phenomenon));
OperPhenomenonVO vo = OperPhenomenonWrapper.build().entityVO(detail);
return R.data(vo);
}
/**
* 分页 代码自定义代号
*/
@ApiLog
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入phenomenon")
@ApiImplicitParams({
})
@OperationAnnotation(moduleName = "缺陷管理",title = "现象库",operatorType = OperatorType.MOBILE,businessType =
BusinessType.GENCODE,action
= "分页")
public R<IPage<OperPhenomenonVO>> list(OperPhenomenonEntity entity,String taskIds, Query query, Date findTimeEnd) {
LambdaQueryWrapper<OperPhenomenonEntity> queryWrapper = Condition.getQueryWrapper(new OperPhenomenonEntity(), entity);
if (StringUtil.isNotBlank(taskIds)){
queryWrapper.in(OperPhenomenonEntity::getId, Lists.newArrayList(taskIds.split(",")));
}
if (Func.isNotEmpty(entity.getFindTime())) {
queryWrapper.ge(OperPhenomenonEntity::getFindTime, entity.getFindTime());
}
if (Func.isNotEmpty(findTimeEnd)) {
queryWrapper.le(OperPhenomenonEntity::getFindTime, findTimeEnd);
}
if (Func.isNotEmpty(entity.getDiscriminateStatus())) {
queryWrapper.eq(OperPhenomenonEntity::getDiscriminateStatus, entity.getDiscriminateStatus());
}
queryWrapper.orderByDesc(OperPhenomenonEntity::getUpdateTime);
IPage<OperPhenomenonEntity> pages = phenomenonService.page(Condition.getPage(query), queryWrapper);
IPage<OperPhenomenonVO> vos = OperPhenomenonWrapper.build().pageVO(pages);
return R.data(vos);
}
/**
* 新增 代码自定义代号
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "提交现象,现象提交后不能修改", notes = "传入phenomenon")
public R save(@Valid @RequestBody OperPhenomenonEntity phenomenon) {
return R.data(phenomenonService.submit(phenomenon));
}
/* *//**
* 修改 代码自定义代号
*//*
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入phenomenon")
public R update(@Valid @RequestBody OperPhenomenonEntity phenomenon) {
return R.status(phenomenonService.updateById(phenomenon));
}
*//**
* 新增或修改 代码自定义代号
*//*
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "新增或修改", notes = "传入phenomenon")
public R submit(@Valid @RequestBody OperPhenomenonEntity phenomenon) {
return R.status(phenomenonService.saveOrUpdate(phenomenon));
}*/
/**
* 删除 代码自定义代号
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(phenomenonService.deleteLogic(Func.toLongList(ids)));
}
@PostMapping("/handleCheckProcess")
@ApiOperation(value = "处理问题甄别流程", notes = "处理问题甄别流程")
public R<Void> handleCheckProcess(@RequestBody @ObjectRequiredInvalid(attributes = {"taskId", "processInstanceId", "comment", "flag",
"variables.pass"}, message = "参数不能为空") BladeFlow flow) {
//@DictInvalid(dictKey = "")
return R.status(phenomenonService.handleCheckProcess(flow));
}
@GetMapping("/getFdpTaskByDefectCode")
@ApiOperationSupport(order = 9)
@ApiOperation(value = "根据缺陷编码获取智能诊断任务", notes = "传入defectCode")
public R<FdpTaskEntity> getFdpTaskByDefectCode(@RequestParam("defectCode") String defectCode) {
return R.data(phenomenonService.getFdpTaskByDefectCode(defectCode));
}
private final IOperPhenomenonService phenomenonService;
/**
* 详情
*/
@ApiLog
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入phenomenon")
public R<OperPhenomenonVO> detail(OperPhenomenonEntity phenomenon) {
OperPhenomenonEntity detail = phenomenonService.getOne(Condition.getQueryWrapper(phenomenon));
OperPhenomenonVO vo = OperPhenomenonWrapper.build().entityVO(detail);
return R.data(vo);
}
/**
* 分页 代码自定义代号
*/
@ApiLog
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入phenomenon")
@ApiImplicitParams({
})
@OperationAnnotation(moduleName = "缺陷管理", title = "现象库", operatorType = OperatorType.MOBILE, businessType =
BusinessType.GENCODE, action
= "分页")
public R<IPage<OperPhenomenonVO>> list(OperPhenomenonEntity entity, String taskIds, Query query, Date findTimeEnd) {
LambdaQueryWrapper<OperPhenomenonEntity> queryWrapper = Condition.getQueryWrapper(new OperPhenomenonEntity(), entity);
if (StringUtil.isNotBlank(taskIds)) {
queryWrapper.in(OperPhenomenonEntity::getId, Lists.newArrayList(taskIds.split(",")));
}
if (Func.isNotEmpty(entity.getFindTime())) {
queryWrapper.ge(OperPhenomenonEntity::getFindTime, entity.getFindTime());
}
if (Func.isNotEmpty(findTimeEnd)) {
queryWrapper.le(OperPhenomenonEntity::getFindTime, findTimeEnd);
}
if (Func.isNotEmpty(entity.getDiscriminateStatus())) {
queryWrapper.eq(OperPhenomenonEntity::getDiscriminateStatus, entity.getDiscriminateStatus());
}
// // 区域Id
// if (Func.isNotEmpty(entity.getAreaId())) {
// queryWrapper.eq(OperPhenomenonEntity::getCreateDept, entity.getAreaId());
// }
//
// // 年份
// if (Func.isNotEmpty(entity.getYearMonth())) {
// queryWrapper.apply("date_format(t.CREATE_TIME, '%Y-%m') = '"
// + (entity.getYearMonth() + "'"));
// }
//
//
// // 是否为缺陷 已定论1
// if (Func.isNotEmpty(entity.getDefect()) && Func.isNotEmpty(entity.getConclusionStatusNum())) {
// queryWrapper.eq(OperPhenomenonEntity::getIsDefect, entity.getDefect());
// queryWrapper.or().eq(OperPhenomenonEntity::getConclusionStatus, entity.getConclusionStatusNum());
// }
queryWrapper.orderByDesc(OperPhenomenonEntity::getUpdateTime);
IPage<OperPhenomenonEntity> pages = phenomenonService.page(Condition.getPage(query), queryWrapper);
IPage<OperPhenomenonVO> vos = OperPhenomenonWrapper.build().pageVO(pages);
return R.data(vos);
}
/**
* 新增 代码自定义代号
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "提交现象,现象提交后不能修改", notes = "传入phenomenon")
public R save(@Valid @RequestBody OperPhenomenonEntity phenomenon) {
return R.data(phenomenonService.submit(phenomenon));
}
/* */ /**
* 修改 代码自定义代号
*/ /*
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入phenomenon")
public R update(@Valid @RequestBody OperPhenomenonEntity phenomenon) {
return R.status(phenomenonService.updateById(phenomenon));
}
*/ /**
* 新增或修改 代码自定义代号
*/ /*
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "新增或修改", notes = "传入phenomenon")
public R submit(@Valid @RequestBody OperPhenomenonEntity phenomenon) {
return R.status(phenomenonService.saveOrUpdate(phenomenon));
}*/
/**
* 删除 代码自定义代号
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(phenomenonService.deleteLogic(Func.toLongList(ids)));
}
@PostMapping("/handleCheckProcess")
@ApiOperation(value = "处理问题甄别流程", notes = "处理问题甄别流程")
public R<Void> handleCheckProcess(@RequestBody @ObjectRequiredInvalid(attributes = {"taskId", "processInstanceId", "comment", "flag",
"variables.pass"}, message = "参数不能为空") BladeFlow flow) {
//@DictInvalid(dictKey = "")
return R.status(phenomenonService.handleCheckProcess(flow));
}
@GetMapping("/getFdpTaskByDefectCode")
@ApiOperationSupport(order = 9)
@ApiOperation(value = "根据缺陷编码获取智能诊断任务", notes = "传入defectCode")
public R<FdpTaskEntity> getFdpTaskByDefectCode(@RequestParam("defectCode") String defectCode) {
return R.data(phenomenonService.getFdpTaskByDefectCode(defectCode));
}
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectServiceImpl.java

@ -923,7 +923,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
queryWrapper.le(defect.getEndTime() != null, OperDefectEntity::getCreateTime, defect.getEndTime());
//区域Id
queryWrapper.eq(BaseEntity::getCreateDept, defect.getCreateDept());
queryWrapper.eq(BaseEntity::getCreateDept, defect.getAreaId());
//年月查询
queryWrapper.apply(defect.getYearMonth() != null, "date_format(CREATE_TIME,'%Y-%m') = '" +
defect.getYearMonth() + "'");

81
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java

@ -1,15 +1,21 @@
package com.hnac.hzims.operational.main.controller.web;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.access.dto.OperAccessStatisticsDTO;
import com.google.common.collect.Lists;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import com.hnac.hzims.operational.access.service.IOperAccessStatisticsService;
import com.hnac.hzims.operational.access.service.IOperAccessTaskService;
import com.hnac.hzims.operational.access.vo.OperAccessStatisticsVO;
import com.hnac.hzims.operational.defect.entity.OperDefectEntity;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.service.IOperDefectService;
import com.hnac.hzims.operational.defect.service.IOperPhenomenonService;
import com.hnac.hzims.operational.defect.vo.OperDefectVO;
import com.hnac.hzims.operational.defect.wrapper.OperDefectWrapper;
import com.hnac.hzims.operational.defect.vo.OperPhenomenonVO;
import com.hnac.hzims.operational.defect.wrapper.OperPhenomenonWrapper;
import com.hnac.hzims.operational.main.service.AreaMonthlyDetailsService;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;
@ -32,11 +38,14 @@ import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
/**
@ -64,6 +73,12 @@ public class AreaMonthlyDetailsController {
private final IOperAccessStatisticsService accessStatisticsService;
private final IOperPhenomenonService phenomenonService;
private final IOperAccessTaskService takeAccessTaskService;
/**
* 操作票 根据月份区域 获取操作详情数据
*
@ -164,10 +179,7 @@ public class AreaMonthlyDetailsController {
@ApiParam(name = "page", value = "当前页", required = true) @PathVariable("page") Long page,
@ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size,
TaskListQuery task) {
Query query = new Query();
query.setCurrent(page.intValue());
query.setSize(size.intValue());
BladePage<TaskVo> taskVoIPage = areaMonthlyDetailsService.queryCheckTaskPageList(task, query);
BladePage<TaskVo> taskVoIPage = areaMonthlyDetailsService.queryCheckTaskPageList(task, page,size);
return R.data(taskVoIPage);
}
@ -190,13 +202,42 @@ public class AreaMonthlyDetailsController {
@ApiOperationSupport(order = 70)
@ApiOperation(value = "根据区域和月份分页查询缺陷库")
@GetMapping("/queryDefectPageList/{page}/{size}")
public R<IPage<OperDefectVO>> queryDefectPageList(
public R<IPage<OperPhenomenonVO>> queryDefectPageList(
@ApiParam(name = "page", value = "当前页", required = true) @PathVariable("page") Long page,
@ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size,
OperDefectEntity defect) {
Page<OperDefectEntity> operDefectEntityPage = new Page<>(page, size);
IPage<OperDefectEntity> pages = defectService.selectPage(operDefectEntityPage, defect);
IPage<OperDefectVO> vos = OperDefectWrapper.build().pageVO(pages);
OperPhenomenonEntity entity, String taskIds, Date findTimeEnd) {
Page<OperPhenomenonEntity> operDefectEntityPage = new Page<>(page, size);
LambdaQueryWrapper<OperPhenomenonEntity> queryWrapper = Condition.getQueryWrapper(new OperPhenomenonEntity(), entity);
if (StringUtil.isNotBlank(taskIds)) {
queryWrapper.in(OperPhenomenonEntity::getId, Lists.newArrayList(taskIds.split(",")));
}
if (Func.isNotEmpty(entity.getFindTime())) {
queryWrapper.ge(OperPhenomenonEntity::getFindTime, entity.getFindTime());
}
if (Func.isNotEmpty(findTimeEnd)) {
queryWrapper.le(OperPhenomenonEntity::getFindTime, findTimeEnd);
}
if (Func.isNotEmpty(entity.getDiscriminateStatus())) {
queryWrapper.eq(OperPhenomenonEntity::getDiscriminateStatus, entity.getDiscriminateStatus());
}
// 区域Id
if (Func.isNotEmpty(entity.getAreaId())) {
queryWrapper.eq(OperPhenomenonEntity::getCreateDept, entity.getAreaId());
}
// 年份
if (Func.isNotEmpty(entity.getYearMonth())) {
queryWrapper.apply("date_format(CREATE_TIME, '%Y-%m') = '"
+ entity.getYearMonth() + "'");
}
// 是否为缺陷 已定论1
if (Func.isNotEmpty(entity.getDefect()) && Func.isNotEmpty(entity.getConclusionStatusNum())) {
queryWrapper.eq(OperPhenomenonEntity::getIsDefect, entity.getDefect());
queryWrapper.or().eq(OperPhenomenonEntity::getConclusionStatus, entity.getConclusionStatusNum());
}
queryWrapper.orderByDesc(OperPhenomenonEntity::getUpdateTime);
IPage<OperPhenomenonEntity> pages = phenomenonService.page(operDefectEntityPage, queryWrapper);
IPage<OperPhenomenonVO> vos = OperPhenomenonWrapper.build().pageVO(pages);
return R.data(vos);
}
@ -218,13 +259,13 @@ public class AreaMonthlyDetailsController {
@ApiOperationSupport(order = 80)
@ApiOperation(value = "根据区域和月份分页查询检修任务")
@GetMapping("/queryReconditionPageList/{page}/{size}")
public R<IPage<OperAccessStatisticsVO>> queryReconditionPageList(
public R<IPage<OperAccessTaskEntity>> queryReconditionPageList(
@ApiParam(name = "page", value = "当前页", required = true) @PathVariable("page") Long page,
@ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size,
OperAccessStatisticsDTO result) {
Page<OperAccessStatisticsVO> dbPage = new Page<>(page, size);
R<IPage<OperAccessStatisticsVO>> r = accessStatisticsService.list(result, dbPage);
return r;
OperAccessTaskEntity result) {
Page<OperAccessTaskEntity> dbPage = new Page<>(page, size);
IPage<OperAccessTaskEntity> list = takeAccessTaskService.selectPage(dbPage, result);
return R.data(list);
}
@ -278,7 +319,7 @@ public class AreaMonthlyDetailsController {
*/
@GetMapping("/queryProduceByAreaCode/{page}/{size}")
@ApiOperationSupport(order = 100)
@ApiOperation(value = "根据区域编号查询技能培训")
@ApiOperation(value = "根据区域编号查询月度自查")
public R<BladePage<CheckMonthVo>> queryProduceByAreaCode(
@ApiParam(name = "page", value = "当前页", required = true) @PathVariable("page") Long page,
@ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size,
@ -336,8 +377,8 @@ public class AreaMonthlyDetailsController {
@ApiOperationSupport(order = 100)
@ApiOperation(value = "根据区域编号查询设备试验")
public R<BladePage<SafeEquipmentTrialVO>> queryEquipmentAreaCode(
@ApiParam(name = "page",value = "当前页",required = true) @PathVariable("page") Long page,
@ApiParam(name = "size",value = "每页记录数",required = true) @PathVariable("size") Long size,
@ApiParam(name = "page", value = "当前页", required = true) @PathVariable("page") Long page,
@ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size,
SafeEquipmentTrialDTO safeEquipmentTrialDTO) {
BladePage<SafeEquipmentTrialVO> checkMonthVoBladePage = areaMonthlyDetailsService.queryEquipmentAreaCode(page
, size, safeEquipmentTrialDTO);

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/AreaMonthlyDetailsService.java

@ -73,7 +73,7 @@ public interface AreaMonthlyDetailsService {
* @param query
* @return
*/
BladePage<TaskVo> queryCheckTaskPageList(TaskListQuery task, Query query);
BladePage<TaskVo> queryCheckTaskPageList(TaskListQuery task,Long page, Long size);
/**
* 根据id查询巡检任务
@ -122,4 +122,5 @@ public interface AreaMonthlyDetailsService {
*/
BladePage<SafeEquipmentTrialVO> queryEquipmentAreaCode(Long page, Long size, SafeEquipmentTrialDTO safeEquipmentTrialDTO);
}

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthlyDetailsServiceImpl.java

@ -147,12 +147,11 @@ public class AreaMonthlyDetailsServiceImpl implements AreaMonthlyDetailsService
* 根据区域和月份分页查询巡检任务
*
* @param task
* @param query
* @return
*/
@Override
public BladePage<TaskVo> queryCheckTaskPageList(TaskListQuery task, Query query) {
R<BladePage<TaskVo>> list = taskFeignClient.list(task, query);
public BladePage<TaskVo> queryCheckTaskPageList(TaskListQuery task, Long page, Long size) {
R<BladePage<TaskVo>> list = taskFeignClient.pageList(page,size,task);
if (list.isSuccess()) {
log.info("获取巡检检查任务列表成功");
return list.getData();

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java

@ -341,8 +341,7 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
* @return
*/
@Override
public IPage<MaintenanceTaskVo>
queryLogMaintenancePageList(Page<OperMaintenanceTaskEntity> pageParam, MaintenanceTaskWithAreaVo areaMonthlyVo) {
public IPage<MaintenanceTaskVo> queryLogMaintenancePageList(Page<OperMaintenanceTaskEntity> pageParam, MaintenanceTaskWithAreaVo areaMonthlyVo) {
//1.根据区域查询
QueryWrapper<OperMaintenanceTaskEntity> queryWrapper = new QueryWrapper<>();
//维护内容
@ -360,7 +359,8 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
//区域编号必传
queryWrapper.eq("CREATE_DEPT", areaMonthlyVo.getAreaId());
queryWrapper.eq(areaMonthlyVo.getYearMonth() != null, "date_format(create_time,'%Y-%m')", areaMonthlyVo.getYearMonth());
queryWrapper.eq(areaMonthlyVo.getYearMonth() != null, "date_format(dispose_time,'%Y-%m')",
areaMonthlyVo.getYearMonth());
//queryWrapper.lambda().eq(OperMaintenanceTaskEntity::getStatus,5);
Page<OperMaintenanceTaskEntity> operMaintenanceTaskEntityPage = baseMapper.selectPage(pageParam, queryWrapper);
//数据转换

2
hzims-service/operational/src/main/resources/application-dev.yml

@ -53,6 +53,8 @@ mybatis-plus:
mapper-locations: classpath:com/hnac/hzims/**/mapper/*Mapper.xml
#实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage: com.hnac.hzims.**.entity
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#swagger扫描路径配置
swagger:

6
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CheckMonthMapper.java

@ -1,15 +1,9 @@
package com.hnac.hzims.safeproduct.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.safeproduct.entity.CheckMonthEntity;
import com.hnac.hzims.safeproduct.vo.CheckMonthVo;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import org.springblade.core.mp.support.Query;
import java.util.List;
/**
* Created by Sam Huang 2022/5/6 8:23

5
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CheckMonthMapper.xml

@ -17,12 +17,15 @@
</select>
<!-- 分页查询安全生产会议次数-->
<select id="listconferenceScope" resultType="com.hnac.hzims.safeproduct.entity.CheckMonthEntity">
select p.* from hzims_safe_check_month p LEFT JOIN
select distinct p.* from hzims_safe_check_month p LEFT JOIN
hzims_safe_check_item_instance c
on p.id = c.CHECK_ID
<where>
and p.IS_DELETED = 0
<if test="req.itemName!=null and req.itemName!=''">
and
c.item = #{req.itemName}
and (c.SYSTEM_SITUATION is not null and c.SYSTEM_SITUATION != '')
</if>
<if test="req.month!=null and req.month!=''">
AND p.MONTH = #{req.month}

3
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/template/serviceimpl/MaintenanceTempleServiceImpl.java

@ -38,7 +38,8 @@ public class MaintenanceTempleServiceImpl extends TemplateAbstractService {
Map<String, Object> map = new HashMap<>();
map.put("one", Optional.ofNullable(UserCache.getUser(planMsgRecord.getReceiver())).map(User::getName).orElse(""));
map.put("two", planMsgRecord.getPlanTime());
planMsgRecord.setContent(JSON.toJSONString(map));
// planMsgRecord.setContent(JSON.toJSONString(map));
planMsgRecord.setSmsParam(JSON.toJSONString(map));
planMsgRecord.setResourceCode("aliyun-safeTool-push");
return planMsgRecord;
}

Loading…
Cancel
Save