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 org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.YearMonth;
import java.util.Date; import java.util.Date;
/** /**
@ -147,4 +148,16 @@ public class OperAccessTaskEntity extends TenantEntity {
@ApiModelProperty("票据是否作废,仅当两票作废更新状态时使用") @ApiModelProperty("票据是否作废,仅当两票作废更新状态时使用")
@TableField(exist = false) @TableField(exist = false)
private boolean isInvalid; 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; package com.hnac.hzims.operational.defect.entity;
import com.baomidou.mybatisplus.annotation.SqlCondition; import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@ -14,6 +15,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.time.YearMonth;
import java.util.Date; import java.util.Date;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -286,4 +288,24 @@ public class OperPhenomenonEntity extends TenantEntity {
@ApiModelProperty(value = "核算工时") @ApiModelProperty(value = "核算工时")
private Integer checkHours; 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.areamonthly.vo.TaskVo;
import com.hnac.hzinfo.inspect.task.entity.TaskEntity; import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springblade.core.mp.support.BladePage; import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient; 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.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import static com.hnac.hzinfo.inspect.Constants.APP_NAME; import static com.hnac.hzinfo.inspect.Constants.APP_NAME;
@ -26,9 +29,21 @@ public interface TaskFeignClient {
@GetMapping("/task/list") @GetMapping("/task/list")
@ApiOperation(value = "分页显示任务列表", notes = "传入task") @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") @GetMapping(value = "/task/detail")
@ApiOperation(value = "查看,下面列表再调用eventController.list", notes = "传入taskid") @ApiOperation(value = "查看,下面列表再调用eventController.list", notes = "传入taskid")
public R<TaskEntity> detail(@RequestParam Long id); 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) { public R<TaskEntity> detail(Long id) {
return R.fail("远程调用失败"); 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("月份") @ApiModelProperty("月份")
private YearMonth yearmonth; private YearMonth yearMonth;
/** /**
* 区域Id * 区域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.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient; 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.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -33,7 +34,7 @@ public interface CheckCompanyFeignClient {
@GetMapping("/CheckCompany/list") @GetMapping("/CheckCompany/list")
@ApiOperationSupport(order = 50) @ApiOperationSupport(order = 50)
@ApiOperation(value = "分页", notes = "查询条件:startDate,endDate,status") @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.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient; 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.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -32,7 +33,8 @@ public interface SafeproductFeignClient {
@GetMapping("/checkMonth/listconferenceScope/{page}/{size}") @GetMapping("/checkMonth/listconferenceScope/{page}/{size}")
@ApiOperationSupport(order = 50) @ApiOperationSupport(order = 50)
@ApiOperation(value = "分页", notes = "查询条件:month,status,createDept") @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) @TableField(exist = false)
@ApiModelProperty("月份") @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.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.annotation.JsonRawValue;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzinfo.core.push.enums.PushAudienceType; 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 != ''"> <if test="task.taskIds != null and task.taskIds != ''">
and FIND_IN_SET(t.ID,#{task.taskIds}) and FIND_IN_SET(t.ID,#{task.taskIds})
</if> </if>
<if test="task.areaId != null and task.areaId != ''"> <if test="task.areaId != null">
and t.CREATE_DEPT = #{task.areaId}) and t.CREATE_DEPT = #{task.areaId}
</if> </if>
<if test="task.yearmonth != null and task.yearmonth != ''"> <if test="task.yearMonth != null">
and date_format(t.PLAN_START_TIME,'%Y-%m')= #{task.yearmonth}) and date_format(t.PLAN_START_TIME,'%Y-%m')= #{task.yearMonth}
</if> </if>
order by t.UPDATE_TIME desc order by t.UPDATE_TIME desc
</select> </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; package com.hnac.hzinfo.inspect.task.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.vo.SafeCheckStatisticVO; import com.hnac.hzims.vo.SafeCheckStatisticVO;
import com.hnac.hzinfo.inspect.task.entity.InspectionTaskSMS; import com.hnac.hzinfo.inspect.task.entity.InspectionTaskSMS;
import com.hnac.hzinfo.inspect.task.entity.TaskEntity; import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
import com.hnac.hzinfo.inspect.task.vo.*; import com.hnac.hzinfo.inspect.task.vo.*;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -174,4 +176,13 @@ public interface ITaskService extends BaseService<TaskEntity> {
* @return * @return
*/ */
boolean collectingTask(List<Long> taskIds); 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 * 区域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("月份") @ApiModelProperty("月份")
private YearMonth yearmonth; private YearMonth yearMonth;
/** /**
* 区域Id * 区域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} and OS.PLAN_END_TIME &lt;= #{dto.planEndTime}
</if> </if>
<if test="dto.areaId != null and dto.areaId != ''"> <if test="dto.areaId != null and dto.areaId != ''">
and OS.CREATE_DEPT = #{dto.areaId} and OT.CREATE_DEPT = #{dto.areaId}
</if> </if>
<if test="dto.yearMonth != null"> <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> </if>
ORDER BY OS.CREATE_TIME DESC ORDER BY OS.CREATE_TIME DESC
</select> </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; package com.hnac.hzims.operational.access.service;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.dto.OperAccessTaskDTO;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; 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.access.vo.OperAccessTaskVO;
import com.hnac.hzims.operational.report.vo.AccessReportVO; import com.hnac.hzims.operational.report.vo.AccessReportVO;
import com.hnac.hzims.vo.SafeCheckStatisticVO; import com.hnac.hzims.vo.SafeCheckStatisticVO;
@ -64,4 +67,11 @@ public interface IOperAccessTaskService extends BaseService<OperAccessTaskEntity
*/ */
SafeCheckStatisticVO getAccessTaskCheck(String startDate,String endDate,Long dept); 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.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; 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.fegin.IMessagePushClient;
import com.hnac.hzims.message.req.PushExtrasReq; import com.hnac.hzims.message.req.PushExtrasReq;
import com.hnac.hzims.operational.OperationalConstants; import com.hnac.hzims.operational.OperationalConstants;
@ -37,6 +39,7 @@ import com.hnac.hzims.vo.SafeCheckStatisticVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
@ -71,427 +74,433 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
@AllArgsConstructor @AllArgsConstructor
public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMapper, OperAccessTaskEntity> implements IOperAccessTaskService { public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMapper, OperAccessTaskEntity> implements IOperAccessTaskService {
private final IFlowClient flowClient; private final IFlowClient flowClient;
private final IDangerSourceClient dangerSourceClient; private final IDangerSourceClient dangerSourceClient;
private final IOperAccessTaskDetailService detailService; private final IOperAccessTaskDetailService detailService;
private final IOperAccessStatisticsService statisticsService; private final IOperAccessStatisticsService statisticsService;
private final IOperAccessContentService contentService; private final IOperAccessContentService contentService;
private final OperAccessTaskMapper mapper; private final OperAccessTaskMapper mapper;
private final IMessagePushClient messagePushClient; private final IMessagePushClient messagePushClient;
private final OperPhenomenonMapper operPhenomenonMapper; private final OperPhenomenonMapper operPhenomenonMapper;
private final IUserClient userClient; private final IUserClient userClient;
private final ISpareClient assetsClient; private final ISpareClient assetsClient;
private final IOperAccessMaterialService materialService; private final IOperAccessMaterialService materialService;
private final IOperDefectService defectService; private final IOperDefectService defectService;
private final IOperDefectStatisticsService defectStatisticsService; private final IOperDefectStatisticsService defectStatisticsService;
@Transactional @Transactional
@Override @Override
public R doSave(OperAccessTaskDTO req) { public R doSave(OperAccessTaskDTO req) {
req.setCode("TASK" + DateUtil.format(DateUtil.now(), DateUtil.PATTERN_DATETIME_MINI) + new DecimalFormat("###").format(RandomUtils.nextInt(0, 999))); 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); List<OperAccessMaterialEntity> materialEntityList = JSONObject.parseArray(JSON.toJSONString(req.getAccessMaterials()), OperAccessMaterialEntity.class);
if(super.save(req)){ if (super.save(req)) {
if(CollectionUtil.isNotEmpty(materialEntityList)) { if (CollectionUtil.isNotEmpty(materialEntityList)) {
materialEntityList.stream().map(material->{ materialEntityList.stream().map(material -> {
material.setPlanId(null); material.setPlanId(null);
material.setId(null); material.setId(null);
material.setTaskId(req.getId()); material.setTaskId(req.getId());
return material; return material;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
materialService.saveOrUpdateBatch(materialEntityList); materialService.saveOrUpdateBatch(materialEntityList);
} }
this.updateDetails(req.getId(), req.getAccessTaskDetails()); this.updateDetails(req.getId(), req.getAccessTaskDetails());
//开启检修任务流程 //开启检修任务流程
R<BladeFlow> bladeFlowR = flowClient.startProcessInstanceContainNameByKey( R<BladeFlow> bladeFlowR = flowClient.startProcessInstanceContainNameByKey("access_task_execute", FlowUtil.getBusinessKey("hzims_oper_access_task", String.valueOf(req.getId())), req.getName(), new HashMap<String, Object>() {{
"access_task_execute", put("taskId", req.getId());
FlowUtil.getBusinessKey("hzims_oper_access_task",String.valueOf(req.getId())), put("handler", TaskUtil.getTaskUser(req.getHandler().toString()));
req.getName(), put("creator", TaskUtil.getTaskUser(AuthUtil.getUserId().toString()));
new HashMap<String, Object>() {{ }});
put("taskId", req.getId()); Assert.isTrue(bladeFlowR.isSuccess() && ObjectUtil.isNotEmpty(bladeFlowR.getData()), () -> {
put("handler", TaskUtil.getTaskUser(req.getHandler().toString())); throw new ServiceException("保存检修任务失败,开启检修任务流程失败!");
put("creator", TaskUtil.getTaskUser(AuthUtil.getUserId().toString())); });
}}); String processInstanceId = bladeFlowR.getData().getProcessInstanceId();
Assert.isTrue(bladeFlowR.isSuccess() && ObjectUtil.isNotEmpty(bladeFlowR.getData()),()->{ req.setProcessInstanceId(processInstanceId);
throw new ServiceException("保存检修任务失败,开启检修任务流程失败!"); super.updateById(new OperAccessTaskEntity() {{
}); setId(req.getId());
String processInstanceId = bladeFlowR.getData().getProcessInstanceId(); setProcessInstanceId(processInstanceId);
req.setProcessInstanceId(processInstanceId); }});
super.updateById(new OperAccessTaskEntity() {{ }
setId(req.getId()); return R.success("OK");
setProcessInstanceId(processInstanceId); }
}});
}
return R.success("OK");
}
@Override @Override
public R doUpdateById(OperAccessTaskDTO req, ComleteTask comleteTask, Long handler) { public R doUpdateById(OperAccessTaskDTO req, ComleteTask comleteTask, Long handler) {
super.updateById(req); super.updateById(req);
OperAccessTaskEntity entity = super.getById(req.getId()); OperAccessTaskEntity entity = super.getById(req.getId());
if (req.getStatus() == AccessConstants.ACCESS_TASK_STATUS_4) { if (req.getStatus() == AccessConstants.ACCESS_TASK_STATUS_4) {
List<OperAccessStatisticsEntity> statisticsList = statisticsService.list(new LambdaQueryWrapper<OperAccessStatisticsEntity>() {{ List<OperAccessStatisticsEntity> statisticsList = statisticsService.list(new LambdaQueryWrapper<OperAccessStatisticsEntity>() {{
eq(OperAccessStatisticsEntity::getTaskId, req.getId()); eq(OperAccessStatisticsEntity::getTaskId, req.getId());
}}); }});
//台账 //台账
if (CollectionUtil.isEmpty(statisticsList)) { if (CollectionUtil.isEmpty(statisticsList)) {
OperAccessStatisticsDTO statisticsDTO = BeanUtil.copy(entity, OperAccessStatisticsDTO.class); OperAccessStatisticsDTO statisticsDTO = BeanUtil.copy(entity, OperAccessStatisticsDTO.class);
statisticsDTO.setId(null); statisticsDTO.setId(null);
statisticsDTO.setTaskId(entity.getId()); statisticsDTO.setTaskId(entity.getId());
statisticsDTO.setManager(entity.getHandler()); statisticsDTO.setManager(entity.getHandler());
OperAccessContentEntity accessContentEntity = contentService.getById(req.getId()); OperAccessContentEntity accessContentEntity = contentService.getById(req.getId());
if(ObjectUtil.isNotEmpty(accessContentEntity)){ if (ObjectUtil.isNotEmpty(accessContentEntity)) {
statisticsDTO.setPid(accessContentEntity.getLibraryId()); statisticsDTO.setPid(accessContentEntity.getLibraryId());
} }
statisticsService.doSave(statisticsDTO); statisticsService.doSave(statisticsDTO);
} }
//材料库出库 //材料库出库
if(CollectionUtil.isNotEmpty(req.getAccessMaterials())){ if (CollectionUtil.isNotEmpty(req.getAccessMaterials())) {
List<OperAccessMaterialDTO> materialDTOList = req.getAccessMaterials(); List<OperAccessMaterialDTO> materialDTOList = req.getAccessMaterials();
for (OperAccessMaterialDTO materialDTO : materialDTOList) { for (OperAccessMaterialDTO materialDTO : materialDTOList) {
SpRecordEntity recordEntity = new SpRecordEntity(); SpRecordEntity recordEntity = new SpRecordEntity();
recordEntity.setSpBasicId(materialDTO.getSpBasicId()); recordEntity.setSpBasicId(materialDTO.getSpBasicId());
recordEntity.setAmount(materialDTO.getNumber()); recordEntity.setAmount(materialDTO.getNumber());
recordEntity.setWarehouseId(materialDTO.getWarehouseId()); recordEntity.setWarehouseId(materialDTO.getWarehouseId());
recordEntity.setHandler(req.getHandler()); recordEntity.setHandler(req.getHandler());
recordEntity.setCreateDept(req.getCreateDept()); recordEntity.setCreateDept(req.getCreateDept());
recordEntity.setCreateUser(req.getCreateUser()); recordEntity.setCreateUser(req.getCreateUser());
Boolean result = assetsClient.warehouseOut(recordEntity); Boolean result = assetsClient.warehouseOut(recordEntity);
if(!result) { if (!result) {
return R.fail("出库失败"); return R.fail("出库失败");
} }
materialDTO.setTaskId(entity.getId()); materialDTO.setTaskId(entity.getId());
materialDTO.setPlanId(entity.getPlanId()); materialDTO.setPlanId(entity.getPlanId());
} }
} }
//审核完成 关闭工作流 //审核完成 关闭工作流
R flowResult = flowClient.completeTask(comleteTask); R flowResult = flowClient.completeTask(comleteTask);
this.finishDefectFlow(entity); this.finishDefectFlow(entity);
if(!flowResult.isSuccess()) { if (!flowResult.isSuccess()) {
throw new ServiceException(flowResult.getMsg()); 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) { //如果任务审批未通过 需重新开票 将任务ticketId置空
updateMaterials(entity.getPlanId(), entity.getId(), req.getAccessMaterials()); else if (req.getStatus() == AccessConstants.ACCESS_TASK_STATUS_3) {
//工作流下一步 LambdaUpdateWrapper<OperAccessTaskEntity> updateWrapper = new LambdaUpdateWrapper<>();
completeTask(comleteTask, handler, entity.getProcessInstanceId(), entity.getCreateDept()); 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) { return R.data("操作成功!");
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());
}
} @Override
return R.data("操作成功!"); 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 @Override
public R<OperAccessTaskVO> detail(Long id) { public R<IPage<OperAccessTaskVO>> list(OperAccessTaskDTO req, Query query) {
OperAccessTaskVO detail = OperAccessTaskWrapper.build().entityVO(super.getById(id)); IPage<OperAccessTaskVO> page = Condition.getPage(query);
detail.setDangerSources(dangerSourceClient.details(detail.getSafeInfos().split(","))); List<OperAccessTaskVO> data = mapper.pageCondition(page, req);
detail.setDetails( page.setRecords(OperAccessTaskWrapper.build().listVOExtras(data));
OperAccessTaskDetailWrapper.build().listVO( return R.data(page);
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 @Override
public R<IPage<OperAccessTaskVO>> list(OperAccessTaskDTO req, Query query) { public List<OperAccessTaskEntity> getByEmCode(String emCode, List<String> list) {
IPage<OperAccessTaskVO> page = Condition.getPage(query); return this.baseMapper.selectByEmCode(emCode, list);
List<OperAccessTaskVO> data = mapper.pageCondition(page, req); }
page.setRecords(OperAccessTaskWrapper.build().listVOExtras(data));
return R.data(page);
}
@Override @Override
public List<OperAccessTaskEntity> getByEmCode(String emCode, List<String> list) { public List<AccessReportVO> getAccessTaskByDisposer(LocalDate startDate, LocalDate endDate, List<Long> deptIdList) {
return this.baseMapper.selectByEmCode(emCode,list); 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 mapByDisposer.forEach((userId, list) -> {
public List<AccessReportVO> getAccessTaskByDisposer(LocalDate startDate, LocalDate endDate, List<Long> deptIdList) { AccessReportVO accessReportVO = new AccessReportVO();
List<AccessReportVO> inspectOrAccessReportVOList = new ArrayList<>(); accessReportVO.setUserName(UserCache.getUser(userId).getName());
//获取月份内的检修任务 accessReportVO.setData(list);
List<OperAccessTaskEntity> operAccessTaskEntityList = this.list(new LambdaQueryWrapper<OperAccessTaskEntity>(){{ //已完成情况
ge(OperAccessTaskEntity::getPlanStartTime,startDate); List<OperAccessTaskEntity> finishList = list.stream().filter(o -> AccessConstants.ACCESS_TASK_STATUS_4 == o.getStatus()).collect(Collectors.toList());
le(OperAccessTaskEntity::getPlanStartTime,endDate); accessReportVO.setCompleteNum(finishList.size());
in(OperAccessTaskEntity::getCreateDept,deptIdList); accessReportVO.setCompleteSituation(finishList.size() + "");
}}); //未完成情况
//组合处理人 List<OperAccessTaskEntity> immatureList = list.stream().filter(o -> AccessConstants.ACCESS_TASK_STATUS_4 != o.getStatus()).collect(Collectors.toList());
Map<Long,List<OperAccessTaskEntity>> mapByDisposer = operAccessTaskEntityList.stream().collect(Collectors.groupingBy(OperAccessTaskEntity::getHandler)); 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)->{ @Override
AccessReportVO accessReportVO = new AccessReportVO(); public List<AccessReportVO> getAccessTaskByDisposer(Map<String, Object> params) {
accessReportVO.setUserName(UserCache.getUser(userId).getName()); LocalDate startDate = LocalDate.parse(params.get("startDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
accessReportVO.setData(list); LocalDate endDate = LocalDate.parse(params.get("endDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
//已完成情况 List<Long> deptIdList = (List<Long>) params.get("deptId");
List<OperAccessTaskEntity> finishList = list.stream().filter(o-> AccessConstants.ACCESS_TASK_STATUS_4 == o.getStatus()).collect(Collectors.toList()); return getAccessTaskByDisposer(startDate, endDate, deptIdList);
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 @Override
public List<AccessReportVO> getAccessTaskByDisposer(Map<String,Object> params) { public List<Map<String, Object>> getAccessConclusion(Map<String, Object> params) {
LocalDate startDate = LocalDate.parse(params.get("startDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); return mapper.getAccessConclusion(params);
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 @Override
public List<Map<String, Object>> getAccessConclusion(Map<String, Object> params) { public List<OperAccessTaskEntity> getAccessTask(String startTime, String endTime, List<Long> list) {
return mapper.getAccessConclusion(params); 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;
}
/** //查询已经存在的明细,并删除部分需要删除的
* 调整明细 List<OperAccessTaskDetailEntity> existsDetails = detailService.list(new LambdaQueryWrapper<OperAccessTaskDetailEntity>() {{
* eq(OperAccessTaskDetailEntity::getTaskId, taskId);
* @author xiashandong eq(OperAccessTaskDetailEntity::getIsDeleted, 0L);
**/ }});
@Transactional(rollbackFor = Exception.class) Set<Long> detailIds = details.stream().filter(o -> o.getId() != null).map(OperAccessTaskDetailDTO::getId).collect(Collectors.toSet());
public void updateDetails(long taskId, List<OperAccessTaskDetailDTO> details) { List<Long> ids = existsDetails.stream().filter(o -> !detailIds.contains(o.getId())).map(OperAccessTaskDetailEntity::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(details)) { if (!CollectionUtils.isEmpty(ids)) {
return; detailService.deleteLogic(ids);
} }
//查询已经存在的明细,并删除部分需要删除的 //新增或修改操作
List<OperAccessTaskDetailEntity> existsDetails = detailService.list(new LambdaQueryWrapper<OperAccessTaskDetailEntity>() {{ Set<Long> existsIds = existsDetails.stream().map(OperAccessTaskDetailEntity::getId).collect(Collectors.toSet());
eq(OperAccessTaskDetailEntity::getTaskId, taskId); for (OperAccessTaskDetailDTO req : details) {
eq(OperAccessTaskDetailEntity::getIsDeleted, 0L); req.setTaskId(taskId);
}}); if (req.getId() == null) {
Set<Long> detailIds = details.stream().filter(o -> o.getId() != null).map(OperAccessTaskDetailDTO::getId).collect(Collectors.toSet()); detailService.doSave(req);
List<Long> ids = existsDetails.stream().filter(o -> !detailIds.contains(o.getId())).map(OperAccessTaskDetailEntity::getId).collect(Collectors.toList()); } else if (req.getId() != null && existsIds.contains(req.getId())) {
if (!CollectionUtils.isEmpty(ids)) { detailService.updateById(req);
detailService.deleteLogic(ids); } else {
} detailService.doSave(req);
}
}
}
//新增或修改操作 /**
Set<Long> existsIds = existsDetails.stream().map(OperAccessTaskDetailEntity::getId).collect(Collectors.toSet()); * 调整检修材料
for (OperAccessTaskDetailDTO req : details) { *
req.setTaskId(taskId); * @author xiashandong
if (req.getId() == null) { **/
detailService.doSave(req); @Transactional(rollbackFor = Exception.class)
} else if (req.getId() != null && existsIds.contains(req.getId())) { public void updateMaterials(long planId, long taskId, List<OperAccessMaterialDTO> materials) {
detailService.updateById(req); if (CollectionUtils.isEmpty(materials)) {
} else { materials = new ArrayList<>();
detailService.doSave(req); }
} //查询已经存在的检修库明细,并删除部分需要删除的
} 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 * @param accessTaskDTO
**/ * @return
@Transactional(rollbackFor = Exception.class) */
public void updateMaterials(long planId,long taskId, List<OperAccessMaterialDTO> materials) { @Override
if (CollectionUtils.isEmpty(materials)) { public R finishAccessTask(OperAccessTaskDTO accessTaskDTO) {
materials = new ArrayList<>(); OperAccessTaskEntity taskEntity = getById(accessTaskDTO.getId());
} //TODO 更新任务状态以及 填入数据(待确认)
//查询已经存在的检修库明细,并删除部分需要删除的 taskEntity.setStatus(AccessConstants.ACCESS_TASK_STATUS_2);
List<OperAccessMaterialEntity> existsDetails = materialService.list(new LambdaQueryWrapper<OperAccessMaterialEntity>() {{ taskEntity.setActHours(accessTaskDTO.getActHours());
eq(OperAccessMaterialEntity::getPlanId, planId); if (updateById(taskEntity)) {
eq(OperAccessMaterialEntity::getTaskId, taskId); //更新材料
eq(OperAccessMaterialEntity::getIsDeleted, 0L); updateMaterials(taskEntity.getPlanId(), taskEntity.getId(), accessTaskDTO.getAccessMaterials());
}}); //终结工作流
Set<Long> detailIds = materials.stream().filter(o -> o.getId() != null).map(OperAccessMaterialDTO::getId).collect(Collectors.toSet()); ComleteTask comleteTask = new ComleteTask();
List<Long> ids = existsDetails.stream().filter(o -> !detailIds.contains(o.getId())).map(OperAccessMaterialEntity::getId).collect(Collectors.toList()); comleteTask.setProcessInstanceId(taskEntity.getProcessInstanceId());
if (!CollectionUtils.isEmpty(ids)) { comleteTask.setFlag("ok");
materialService.deleteLogic(ids); comleteTask.setPass(true);
} comleteTask.setComment("执行任务完成,进行下一步流程");
if(CollectionUtil.isNotEmpty(materials)){ this.completeTask(comleteTask, AuthUtil.getUserId(), taskEntity.getProcessInstanceId(), taskEntity.getCreateDept());
List<OperAccessMaterialEntity> materialEntityList = JSONArray.parseArray(JSON.toJSONString(materials),OperAccessMaterialEntity.class); }
materialService.saveOrUpdateBatch(materialEntityList); return R.success("操作成功");
} }
}
/** /**
* 执行检修任务 * 获取安全检查定期检修项统计
* @param accessTaskDTO *
* @return * @param startDate 开始时间
*/ * @param endDate 结束时间
@Override * @param dept 机构ID
public R finishAccessTask(OperAccessTaskDTO accessTaskDTO) { * @return SafeCheckStatisticVO对象
OperAccessTaskEntity taskEntity = getById(accessTaskDTO.getId()); */
//TODO 更新任务状态以及 填入数据(待确认) @Override
taskEntity.setStatus(AccessConstants.ACCESS_TASK_STATUS_2); public SafeCheckStatisticVO getAccessTaskCheck(String startDate, String endDate, Long dept) {
taskEntity.setActHours(accessTaskDTO.getActHours()); SafeCheckStatisticVO vo = new SafeCheckStatisticVO();
if(updateById(taskEntity)) { 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());
updateMaterials(taskEntity.getPlanId(), taskEntity.getId(), accessTaskDTO.getAccessMaterials()); vo.setProjectTypeName(Constants.SafeCheckProjectEnum.ACCESS_TASK.getName());
//终结工作流 vo.setTotal(taskEntityList.size());
ComleteTask comleteTask = new ComleteTask(); return vo;
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 dbPage
* @param dept 机构ID * @param result
* @return SafeCheckStatisticVO对象 */
*/ @Override
@Override public IPage<OperAccessTaskEntity> selectPage(Page<OperAccessTaskEntity> dbPage, OperAccessTaskEntity result) {
public SafeCheckStatisticVO getAccessTaskCheck(String startDate, String endDate, Long dept) { QueryWrapper<OperAccessTaskEntity> queryWrapper = new QueryWrapper<>();
SafeCheckStatisticVO vo = new SafeCheckStatisticVO(); //区域
List<OperAccessTaskEntity> taskEntityList = this.list(Wrappers.<OperAccessTaskEntity>lambdaQuery() queryWrapper.eq(StringUtils.isNotBlank(result.getAreaId()), "CREATE_DEPT", result.getAreaId());
.eq(OperAccessTaskEntity::getStatus,AccessConstants.ACCESS_TASK_STATUS_4) //月份
.ge(OperAccessTaskEntity::getCreateTime,startDate) queryWrapper.eq(result.getYearMonth() != null, "date_format(PLAN_START_TIME, '%Y-%m')", result.getYearMonth());
.le(OperAccessTaskEntity::getCreateTime,endDate) //任务名称
.eq(OperAccessTaskEntity::getCreateDept,dept) queryWrapper.eq(StringUtils.isNotBlank(result.getName()), "name", result.getName());
); //状态
vo.setProjectType(Constants.SafeCheckProjectEnum.ACCESS_TASK.getType()); queryWrapper.eq(result.getStatus() != null, "STATUS", result.getStatus());
vo.setProjectTypeName(Constants.SafeCheckProjectEnum.ACCESS_TASK.getName());
vo.setTotal(taskEntityList.size());
return vo;
}
/*** return baseMapper.selectPage(dbPage, queryWrapper);
* 根据流程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);
}
R result = flowClient.completeTask(comleteTask); /***
if(!result.isSuccess()){ * 根据流程ID和处理人完成任务
throw new ServiceException(result.getMsg()); * @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);
}
/** R result = flowClient.completeTask(comleteTask);
* 根据检修任务完成缺陷处理流程 if (!result.isSuccess()) {
* @param accessTaskEntity throw new ServiceException(result.getMsg());
*/ }
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);
}
ComleteTask comleteTask = new ComleteTask(); /**
comleteTask.setProcessInstanceId(processInstanceId); * 根据检修任务完成缺陷处理流程
//获取当前环节taskId *
R<BladeFlow> bladeFlowR = flowClient.getTaskByProcessInstanceIdAndUserId(processInstanceId, "taskUser_"+AuthUtil.getUserId()); * @param accessTaskEntity
Assert.isTrue(bladeFlowR.isSuccess() && ObjectUtil.isNotEmpty(bladeFlowR.getData()),()->{ */
throw new ServiceException("当前操作人获取消缺任务失败"); private void finishDefectFlow(OperAccessTaskEntity accessTaskEntity) {
}); if (Func.isNotEmpty(accessTaskEntity.getPhenomenonId())) {
comleteTask.setTaskId(bladeFlowR.getData().getTaskId()); OperPhenomenonEntity operPhenomenonEntity = operPhenomenonMapper.selectById(accessTaskEntity.getPhenomenonId());
comleteTask.setComment("审批通过工作流结束"); operPhenomenonEntity.setHandleStatus(RepairConstant.CONCLUSION_PROBLEM);
comleteTask.setFlag("ok"); //operPhenomenonEntity.setCheckHours(accessTaskEntity.getActHours());
comleteTask.setPass(true); operPhenomenonMapper.updateById(operPhenomenonEntity);
Map<String,Object> variables = new HashMap<>(1); String processInstanceId = operPhenomenonEntity.getCheckProcessInstanceId();
R<List<User>> listR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), operDefectEntity.getCreateDept(), DefectConstant.PROCESS_VARIABLE_CONCLUSION); //获取缺陷
Assert.isTrue(listR.isSuccess() && ObjectUtil.isNotEmpty(listR.getData()),()->{ OperDefectEntity operDefectEntity = defectService.getOne(Wrappers.<OperDefectEntity>lambdaQuery().eq(OperDefectEntity::getDefectCode, operPhenomenonEntity.getDefectCode()).last("limit 1;"));
throw new ServiceException("获取问题定论人失败"); if (ObjectUtil.isNotEmpty(operDefectEntity)) {
}); operDefectEntity.setActEndTime(new Date());
String conclusion = listR.getData().stream().map(user->"taskUser_"+user.getId()).collect(Collectors.joining(",")); operDefectEntity.setActHours(ObjectUtil.isNotEmpty(accessTaskEntity.getActHours()) ? accessTaskEntity.getActHours().toString() : null);
variables.put("conclusion",conclusion); operDefectEntity.setHandleStatus(RepairConstant.CONCLUSION_PROBLEM);
comleteTask.setVariables(variables); operDefectEntity.setDisposeDesc(accessTaskEntity.getDescripiton());
flowClient.completeTask(comleteTask); defectService.updateById(operDefectEntity);
} }
}
/** ComleteTask comleteTask = new ComleteTask();
* 巡检任务生成后待办消息提示 comleteTask.setProcessInstanceId(processInstanceId);
* @param req //获取当前环节taskId
*/ R<BladeFlow> bladeFlowR = flowClient.getTaskByProcessInstanceIdAndUserId(processInstanceId, "taskUser_" + AuthUtil.getUserId());
private void pushHandleMessage(OperAccessTaskDTO operAccessTaskDTO,PushExtrasReq req){ Assert.isTrue(bladeFlowR.isSuccess() && ObjectUtil.isNotEmpty(bladeFlowR.getData()), () -> {
req.setTitle(AccessConstants.MESSAGE_TITLE); throw new ServiceException("当前操作人获取消缺任务失败");
req.setType(AccessConstants.MESSAGE_ACCESS_TYPE); });
req.setBusinessClassify(OperationalConstants.MessageClassifyEnum.MESSAGE_REMINDSY.getVal()); comleteTask.setTaskId(bladeFlowR.getData().getTaskId());
req.setPushAlert(AccessConstants.AccessProcessEnum.ACCESS_BACKLOG.getMsg()); comleteTask.setComment("审批通过工作流结束");
log.info("--------消息推送开始----------"); comleteTask.setFlag("ok");
messagePushClient.sendMessage(operAccessTaskDTO.getHandler().toString(), req,operAccessTaskDTO.getTenantId(),operAccessTaskDTO.getCreateDept(),operAccessTaskDTO.getCreateUser()); comleteTask.setPass(true);
log.info("消息推送人为:{},推送消息为:{}",operAccessTaskDTO.getHandler().toString(),AccessConstants.AccessProcessEnum.ACCESS_BACKLOG.getMsg()); Map<String, Object> variables = new HashMap<>(1);
log.info("--------消息推送成功----------"); 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 @Validated
public class OperPhenomenonController extends BladeController { public class OperPhenomenonController extends BladeController {
private final IOperPhenomenonService phenomenonService; private final IOperPhenomenonService phenomenonService;
/** /**
* 详情 * 详情
*/ */
@ApiLog @ApiLog
@GetMapping("/detail") @GetMapping("/detail")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入phenomenon") @ApiOperation(value = "详情", notes = "传入phenomenon")
public R<OperPhenomenonVO> detail(OperPhenomenonEntity phenomenon) { public R<OperPhenomenonVO> detail(OperPhenomenonEntity phenomenon) {
OperPhenomenonEntity detail = phenomenonService.getOne(Condition.getQueryWrapper(phenomenon)); OperPhenomenonEntity detail = phenomenonService.getOne(Condition.getQueryWrapper(phenomenon));
OperPhenomenonVO vo = OperPhenomenonWrapper.build().entityVO(detail); OperPhenomenonVO vo = OperPhenomenonWrapper.build().entityVO(detail);
return R.data(vo); return R.data(vo);
} }
/** /**
* 分页 代码自定义代号 * 分页 代码自定义代号
*/ */
@ApiLog @ApiLog
@GetMapping("/list") @GetMapping("/list")
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入phenomenon") @ApiOperation(value = "分页", notes = "传入phenomenon")
@ApiImplicitParams({ @ApiImplicitParams({
}) })
@OperationAnnotation(moduleName = "缺陷管理",title = "现象库",operatorType = OperatorType.MOBILE,businessType = @OperationAnnotation(moduleName = "缺陷管理", title = "现象库", operatorType = OperatorType.MOBILE, businessType =
BusinessType.GENCODE,action BusinessType.GENCODE, action
= "分页") = "分页")
public R<IPage<OperPhenomenonVO>> list(OperPhenomenonEntity entity,String taskIds, Query query, Date findTimeEnd) { public R<IPage<OperPhenomenonVO>> list(OperPhenomenonEntity entity, String taskIds, Query query, Date findTimeEnd) {
LambdaQueryWrapper<OperPhenomenonEntity> queryWrapper = Condition.getQueryWrapper(new OperPhenomenonEntity(), entity); LambdaQueryWrapper<OperPhenomenonEntity> queryWrapper = Condition.getQueryWrapper(new OperPhenomenonEntity(), entity);
if (StringUtil.isNotBlank(taskIds)){ if (StringUtil.isNotBlank(taskIds)) {
queryWrapper.in(OperPhenomenonEntity::getId, Lists.newArrayList(taskIds.split(","))); queryWrapper.in(OperPhenomenonEntity::getId, Lists.newArrayList(taskIds.split(",")));
} }
if (Func.isNotEmpty(entity.getFindTime())) { if (Func.isNotEmpty(entity.getFindTime())) {
queryWrapper.ge(OperPhenomenonEntity::getFindTime, entity.getFindTime()); queryWrapper.ge(OperPhenomenonEntity::getFindTime, entity.getFindTime());
} }
if (Func.isNotEmpty(findTimeEnd)) { if (Func.isNotEmpty(findTimeEnd)) {
queryWrapper.le(OperPhenomenonEntity::getFindTime, findTimeEnd); queryWrapper.le(OperPhenomenonEntity::getFindTime, findTimeEnd);
} }
if (Func.isNotEmpty(entity.getDiscriminateStatus())) { if (Func.isNotEmpty(entity.getDiscriminateStatus())) {
queryWrapper.eq(OperPhenomenonEntity::getDiscriminateStatus, entity.getDiscriminateStatus()); queryWrapper.eq(OperPhenomenonEntity::getDiscriminateStatus, entity.getDiscriminateStatus());
} }
queryWrapper.orderByDesc(OperPhenomenonEntity::getUpdateTime);
IPage<OperPhenomenonEntity> pages = phenomenonService.page(Condition.getPage(query), queryWrapper); // // 区域Id
IPage<OperPhenomenonVO> vos = OperPhenomenonWrapper.build().pageVO(pages); // if (Func.isNotEmpty(entity.getAreaId())) {
return R.data(vos); // queryWrapper.eq(OperPhenomenonEntity::getCreateDept, entity.getAreaId());
} // }
//
/** // // 年份
* 新增 代码自定义代号 // if (Func.isNotEmpty(entity.getYearMonth())) {
*/ // queryWrapper.apply("date_format(t.CREATE_TIME, '%Y-%m') = '"
@PostMapping("/save") // + (entity.getYearMonth() + "'"));
@ApiOperationSupport(order = 4) // }
@ApiOperation(value = "提交现象,现象提交后不能修改", notes = "传入phenomenon") //
public R save(@Valid @RequestBody OperPhenomenonEntity phenomenon) { //
return R.data(phenomenonService.submit(phenomenon)); // // 是否为缺陷 已定论1
} // if (Func.isNotEmpty(entity.getDefect()) && Func.isNotEmpty(entity.getConclusionStatusNum())) {
// queryWrapper.eq(OperPhenomenonEntity::getIsDefect, entity.getDefect());
/* *//** // queryWrapper.or().eq(OperPhenomenonEntity::getConclusionStatus, entity.getConclusionStatusNum());
* 修改 代码自定义代号 // }
*//*
@PostMapping("/update")
@ApiOperationSupport(order = 5) queryWrapper.orderByDesc(OperPhenomenonEntity::getUpdateTime);
@ApiOperation(value = "修改", notes = "传入phenomenon") IPage<OperPhenomenonEntity> pages = phenomenonService.page(Condition.getPage(query), queryWrapper);
public R update(@Valid @RequestBody OperPhenomenonEntity phenomenon) { IPage<OperPhenomenonVO> vos = OperPhenomenonWrapper.build().pageVO(pages);
return R.status(phenomenonService.updateById(phenomenon)); return R.data(vos);
} }
*//** /**
* 新增或修改 代码自定义代号 * 新增 代码自定义代号
*//* */
@PostMapping("/submit") @PostMapping("/save")
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 4)
@ApiOperation(value = "新增或修改", notes = "传入phenomenon") @ApiOperation(value = "提交现象,现象提交后不能修改", notes = "传入phenomenon")
public R submit(@Valid @RequestBody OperPhenomenonEntity phenomenon) { public R save(@Valid @RequestBody OperPhenomenonEntity phenomenon) {
return R.status(phenomenonService.saveOrUpdate(phenomenon)); return R.data(phenomenonService.submit(phenomenon));
}*/ }
/* */ /**
/** * 修改 代码自定义代号
* 删除 代码自定义代号 */ /*
*/ @PostMapping("/update")
@PostMapping("/remove") @ApiOperationSupport(order = 5)
@ApiOperationSupport(order = 7) @ApiOperation(value = "修改", notes = "传入phenomenon")
@ApiOperation(value = "逻辑删除", notes = "传入ids") public R update(@Valid @RequestBody OperPhenomenonEntity phenomenon) {
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { return R.status(phenomenonService.updateById(phenomenon));
return R.status(phenomenonService.deleteLogic(Func.toLongList(ids))); }
}
*/ /**
* 新增或修改 代码自定义代号
@PostMapping("/handleCheckProcess") */ /*
@ApiOperation(value = "处理问题甄别流程", notes = "处理问题甄别流程") @PostMapping("/submit")
public R<Void> handleCheckProcess(@RequestBody @ObjectRequiredInvalid(attributes = {"taskId", "processInstanceId", "comment", "flag", @ApiOperationSupport(order = 6)
"variables.pass"}, message = "参数不能为空") BladeFlow flow) { @ApiOperation(value = "新增或修改", notes = "传入phenomenon")
//@DictInvalid(dictKey = "") public R submit(@Valid @RequestBody OperPhenomenonEntity phenomenon) {
return R.status(phenomenonService.handleCheckProcess(flow)); return R.status(phenomenonService.saveOrUpdate(phenomenon));
} }*/
@GetMapping("/getFdpTaskByDefectCode")
@ApiOperationSupport(order = 9) /**
@ApiOperation(value = "根据缺陷编码获取智能诊断任务", notes = "传入defectCode") * 删除 代码自定义代号
public R<FdpTaskEntity> getFdpTaskByDefectCode(@RequestParam("defectCode") String defectCode) { */
return R.data(phenomenonService.getFdpTaskByDefectCode(defectCode)); @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()); queryWrapper.le(defect.getEndTime() != null, OperDefectEntity::getCreateTime, defect.getEndTime());
//区域Id //区域Id
queryWrapper.eq(BaseEntity::getCreateDept, defect.getCreateDept()); queryWrapper.eq(BaseEntity::getCreateDept, defect.getAreaId());
//年月查询 //年月查询
queryWrapper.apply(defect.getYearMonth() != null, "date_format(CREATE_TIME,'%Y-%m') = '" + queryWrapper.apply(defect.getYearMonth() != null, "date_format(CREATE_TIME,'%Y-%m') = '" +
defect.getYearMonth() + "'"); 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; 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.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; 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.IOperAccessStatisticsService;
import com.hnac.hzims.operational.access.service.IOperAccessTaskService;
import com.hnac.hzims.operational.access.vo.OperAccessStatisticsVO; import com.hnac.hzims.operational.access.vo.OperAccessStatisticsVO;
import com.hnac.hzims.operational.defect.entity.OperDefectEntity; 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.IOperDefectService;
import com.hnac.hzims.operational.defect.service.IOperPhenomenonService;
import com.hnac.hzims.operational.defect.vo.OperDefectVO; 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.main.service.AreaMonthlyDetailsService;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService; import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;
@ -32,11 +38,14 @@ import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.support.BladePage; 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.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.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -64,6 +73,12 @@ public class AreaMonthlyDetailsController {
private final IOperAccessStatisticsService accessStatisticsService; 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 = "page", value = "当前页", required = true) @PathVariable("page") Long page,
@ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size, @ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size,
TaskListQuery task) { TaskListQuery task) {
Query query = new Query(); BladePage<TaskVo> taskVoIPage = areaMonthlyDetailsService.queryCheckTaskPageList(task, page,size);
query.setCurrent(page.intValue());
query.setSize(size.intValue());
BladePage<TaskVo> taskVoIPage = areaMonthlyDetailsService.queryCheckTaskPageList(task, query);
return R.data(taskVoIPage); return R.data(taskVoIPage);
} }
@ -190,13 +202,42 @@ public class AreaMonthlyDetailsController {
@ApiOperationSupport(order = 70) @ApiOperationSupport(order = 70)
@ApiOperation(value = "根据区域和月份分页查询缺陷库") @ApiOperation(value = "根据区域和月份分页查询缺陷库")
@GetMapping("/queryDefectPageList/{page}/{size}") @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 = "page", value = "当前页", required = true) @PathVariable("page") Long page,
@ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size, @ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size,
OperDefectEntity defect) { OperPhenomenonEntity entity, String taskIds, Date findTimeEnd) {
Page<OperDefectEntity> operDefectEntityPage = new Page<>(page, size); Page<OperPhenomenonEntity> operDefectEntityPage = new Page<>(page, size);
IPage<OperDefectEntity> pages = defectService.selectPage(operDefectEntityPage, defect); LambdaQueryWrapper<OperPhenomenonEntity> queryWrapper = Condition.getQueryWrapper(new OperPhenomenonEntity(), entity);
IPage<OperDefectVO> vos = OperDefectWrapper.build().pageVO(pages); 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); return R.data(vos);
} }
@ -218,13 +259,13 @@ public class AreaMonthlyDetailsController {
@ApiOperationSupport(order = 80) @ApiOperationSupport(order = 80)
@ApiOperation(value = "根据区域和月份分页查询检修任务") @ApiOperation(value = "根据区域和月份分页查询检修任务")
@GetMapping("/queryReconditionPageList/{page}/{size}") @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 = "page", value = "当前页", required = true) @PathVariable("page") Long page,
@ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size, @ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size,
OperAccessStatisticsDTO result) { OperAccessTaskEntity result) {
Page<OperAccessStatisticsVO> dbPage = new Page<>(page, size); Page<OperAccessTaskEntity> dbPage = new Page<>(page, size);
R<IPage<OperAccessStatisticsVO>> r = accessStatisticsService.list(result, dbPage); IPage<OperAccessTaskEntity> list = takeAccessTaskService.selectPage(dbPage, result);
return r; return R.data(list);
} }
@ -278,7 +319,7 @@ public class AreaMonthlyDetailsController {
*/ */
@GetMapping("/queryProduceByAreaCode/{page}/{size}") @GetMapping("/queryProduceByAreaCode/{page}/{size}")
@ApiOperationSupport(order = 100) @ApiOperationSupport(order = 100)
@ApiOperation(value = "根据区域编号查询技能培训") @ApiOperation(value = "根据区域编号查询月度自查")
public R<BladePage<CheckMonthVo>> queryProduceByAreaCode( public R<BladePage<CheckMonthVo>> queryProduceByAreaCode(
@ApiParam(name = "page", value = "当前页", required = true) @PathVariable("page") Long page, @ApiParam(name = "page", value = "当前页", required = true) @PathVariable("page") Long page,
@ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size, @ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size,
@ -336,8 +377,8 @@ public class AreaMonthlyDetailsController {
@ApiOperationSupport(order = 100) @ApiOperationSupport(order = 100)
@ApiOperation(value = "根据区域编号查询设备试验") @ApiOperation(value = "根据区域编号查询设备试验")
public R<BladePage<SafeEquipmentTrialVO>> queryEquipmentAreaCode( public R<BladePage<SafeEquipmentTrialVO>> queryEquipmentAreaCode(
@ApiParam(name = "page",value = "当前页",required = true) @PathVariable("page") Long page, @ApiParam(name = "page", value = "当前页", required = true) @PathVariable("page") Long page,
@ApiParam(name = "size",value = "每页记录数",required = true) @PathVariable("size") Long size, @ApiParam(name = "size", value = "每页记录数", required = true) @PathVariable("size") Long size,
SafeEquipmentTrialDTO safeEquipmentTrialDTO) { SafeEquipmentTrialDTO safeEquipmentTrialDTO) {
BladePage<SafeEquipmentTrialVO> checkMonthVoBladePage = areaMonthlyDetailsService.queryEquipmentAreaCode(page BladePage<SafeEquipmentTrialVO> checkMonthVoBladePage = areaMonthlyDetailsService.queryEquipmentAreaCode(page
, size, safeEquipmentTrialDTO); , 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 * @param query
* @return * @return
*/ */
BladePage<TaskVo> queryCheckTaskPageList(TaskListQuery task, Query query); BladePage<TaskVo> queryCheckTaskPageList(TaskListQuery task,Long page, Long size);
/** /**
* 根据id查询巡检任务 * 根据id查询巡检任务
@ -122,4 +122,5 @@ public interface AreaMonthlyDetailsService {
*/ */
BladePage<SafeEquipmentTrialVO> queryEquipmentAreaCode(Long page, Long size, SafeEquipmentTrialDTO safeEquipmentTrialDTO); 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 task
* @param query
* @return * @return
*/ */
@Override @Override
public BladePage<TaskVo> queryCheckTaskPageList(TaskListQuery task, Query query) { public BladePage<TaskVo> queryCheckTaskPageList(TaskListQuery task, Long page, Long size) {
R<BladePage<TaskVo>> list = taskFeignClient.list(task, query); R<BladePage<TaskVo>> list = taskFeignClient.pageList(page,size,task);
if (list.isSuccess()) { if (list.isSuccess()) {
log.info("获取巡检检查任务列表成功"); log.info("获取巡检检查任务列表成功");
return list.getData(); 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 * @return
*/ */
@Override @Override
public IPage<MaintenanceTaskVo> public IPage<MaintenanceTaskVo> queryLogMaintenancePageList(Page<OperMaintenanceTaskEntity> pageParam, MaintenanceTaskWithAreaVo areaMonthlyVo) {
queryLogMaintenancePageList(Page<OperMaintenanceTaskEntity> pageParam, MaintenanceTaskWithAreaVo areaMonthlyVo) {
//1.根据区域查询 //1.根据区域查询
QueryWrapper<OperMaintenanceTaskEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<OperMaintenanceTaskEntity> queryWrapper = new QueryWrapper<>();
//维护内容 //维护内容
@ -360,7 +359,8 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
//区域编号必传 //区域编号必传
queryWrapper.eq("CREATE_DEPT", areaMonthlyVo.getAreaId()); 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); //queryWrapper.lambda().eq(OperMaintenanceTaskEntity::getStatus,5);
Page<OperMaintenanceTaskEntity> operMaintenanceTaskEntityPage = baseMapper.selectPage(pageParam, queryWrapper); 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 mapper-locations: classpath:com/hnac/hzims/**/mapper/*Mapper.xml
#实体扫描,多个package用逗号或者分号分隔 #实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage: com.hnac.hzims.**.entity typeAliasesPackage: com.hnac.hzims.**.entity
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#swagger扫描路径配置 #swagger扫描路径配置
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; package com.hnac.hzims.safeproduct.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.entity.CheckMonthEntity;
import com.hnac.hzims.safeproduct.vo.CheckMonthVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; 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 * 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>
<!-- 分页查询安全生产会议次数--> <!-- 分页查询安全生产会议次数-->
<select id="listconferenceScope" resultType="com.hnac.hzims.safeproduct.entity.CheckMonthEntity"> <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 hzims_safe_check_item_instance c
on p.id = c.CHECK_ID on p.id = c.CHECK_ID
<where> <where>
and p.IS_DELETED = 0
<if test="req.itemName!=null and req.itemName!=''"> <if test="req.itemName!=null and req.itemName!=''">
and
c.item = #{req.itemName} c.item = #{req.itemName}
and (c.SYSTEM_SITUATION is not null and c.SYSTEM_SITUATION != '')
</if> </if>
<if test="req.month!=null and req.month!=''"> <if test="req.month!=null and req.month!=''">
AND p.MONTH = #{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<String, Object> map = new HashMap<>();
map.put("one", Optional.ofNullable(UserCache.getUser(planMsgRecord.getReceiver())).map(User::getName).orElse("")); map.put("one", Optional.ofNullable(UserCache.getUser(planMsgRecord.getReceiver())).map(User::getName).orElse(""));
map.put("two", planMsgRecord.getPlanTime()); 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"); planMsgRecord.setResourceCode("aliyun-safeTool-push");
return planMsgRecord; return planMsgRecord;
} }

Loading…
Cancel
Save