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. 208
      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. 179
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java
  18. 36
      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);
} }

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

@ -1,8 +1,12 @@
package com.hnac.hzinfo.inspect.task.service.impl; package com.hnac.hzinfo.inspect.task.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzims.safeproduct.Constants; import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.safeproduct.entity.ImsMonCameraInfoEntity; import com.hnac.hzims.safeproduct.entity.ImsMonCameraInfoEntity;
@ -26,8 +30,10 @@ import com.hnac.hzinfo.inspect.task.vo.*;
import com.hnac.hzinfo.inspect.utils.HiKUtil; import com.hnac.hzinfo.inspect.utils.HiKUtil;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
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.BladePage;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tenant.mp.TenantEntity; import org.springblade.core.tenant.mp.TenantEntity;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -37,6 +43,7 @@ import org.springblade.system.cache.DictCache;
import org.springblade.system.feign.ISysClient; import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -130,10 +137,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
*/ */
@Override @Override
public void checkProjectFinish(EventAddVO eventAddVO) { public void checkProjectFinish(EventAddVO eventAddVO) {
List<TaskObjectProjectContentEntity> topcList = taskObjectProjectContentService.list(Wrappers.<TaskObjectProjectContentEntity>lambdaQuery() List<TaskObjectProjectContentEntity> topcList = taskObjectProjectContentService.list(Wrappers.<TaskObjectProjectContentEntity>lambdaQuery().eq(TaskObjectProjectContentEntity::getTaskId, eventAddVO.getTaskId()).eq(TaskObjectProjectContentEntity::getObjectId, eventAddVO.getObjId()).eq(TaskObjectProjectContentEntity::getProjectId, eventAddVO.getProjectId()));
.eq(TaskObjectProjectContentEntity::getTaskId, eventAddVO.getTaskId())
.eq(TaskObjectProjectContentEntity::getObjectId, eventAddVO.getObjId())
.eq(TaskObjectProjectContentEntity::getProjectId, eventAddVO.getProjectId()));
if (Func.isNotEmpty(topcList)) { if (Func.isNotEmpty(topcList)) {
for (TaskObjectProjectContentEntity content : topcList) { for (TaskObjectProjectContentEntity content : topcList) {
@ -144,11 +148,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
} }
/** 任务项目状态设置为已完成*/ /** 任务项目状态设置为已完成*/
taskObjectProjectService.update(Wrappers.<TaskObjectProjectEntity>lambdaUpdate() taskObjectProjectService.update(Wrappers.<TaskObjectProjectEntity>lambdaUpdate().set(TaskObjectProjectEntity::getStatus, TaskContants.StatusEnum.FINISH_STATUS.getStatus()).eq(TaskObjectProjectEntity::getTaskId, eventAddVO.getTaskId()).eq(TaskObjectProjectEntity::getObjectId, eventAddVO.getObjId()).eq(TaskObjectProjectEntity::getProjectId, eventAddVO.getProjectId()));
.set(TaskObjectProjectEntity::getStatus, TaskContants.StatusEnum.FINISH_STATUS.getStatus())
.eq(TaskObjectProjectEntity::getTaskId, eventAddVO.getTaskId())
.eq(TaskObjectProjectEntity::getObjectId, eventAddVO.getObjId())
.eq(TaskObjectProjectEntity::getProjectId, eventAddVO.getProjectId()));
checkObjFinish(eventAddVO); checkObjFinish(eventAddVO);
} }
@ -159,9 +159,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
* @param eventAddVO * @param eventAddVO
*/ */
private void checkObjFinish(EventAddVO eventAddVO) { private void checkObjFinish(EventAddVO eventAddVO) {
List<TaskObjectProjectEntity> topList = taskObjectProjectService.list(Wrappers.<TaskObjectProjectEntity>lambdaQuery() List<TaskObjectProjectEntity> topList = taskObjectProjectService.list(Wrappers.<TaskObjectProjectEntity>lambdaQuery().eq(TaskObjectProjectEntity::getTaskId, eventAddVO.getTaskId()).eq(TaskObjectProjectEntity::getObjectId, eventAddVO.getObjId()));
.eq(TaskObjectProjectEntity::getTaskId, eventAddVO.getTaskId())
.eq(TaskObjectProjectEntity::getObjectId, eventAddVO.getObjId()));
if (Func.isNotEmpty(topList)) { if (Func.isNotEmpty(topList)) {
@ -173,10 +171,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
} }
/** 任务项目状态设置为已完成*/ /** 任务项目状态设置为已完成*/
taskObjectService.update(Wrappers.<TaskObjectEntity>lambdaUpdate() taskObjectService.update(Wrappers.<TaskObjectEntity>lambdaUpdate().set(TaskObjectEntity::getStatus, TaskContants.StatusEnum.FINISH_STATUS.getStatus()).eq(TaskObjectEntity::getTaskId, eventAddVO.getTaskId()).eq(TaskObjectEntity::getObjectId, eventAddVO.getObjId()));
.set(TaskObjectEntity::getStatus, TaskContants.StatusEnum.FINISH_STATUS.getStatus())
.eq(TaskObjectEntity::getTaskId, eventAddVO.getTaskId())
.eq(TaskObjectEntity::getObjectId, eventAddVO.getObjId()));
checkTaskFinish(eventAddVO); checkTaskFinish(eventAddVO);
} }
@ -188,8 +183,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
*/ */
@Override @Override
public void checkTaskFinish(EventAddVO eventAddVO) { public void checkTaskFinish(EventAddVO eventAddVO) {
List<TaskObjectEntity> topList = taskObjectService.list(Wrappers.<TaskObjectEntity>lambdaQuery() List<TaskObjectEntity> topList = taskObjectService.list(Wrappers.<TaskObjectEntity>lambdaQuery().eq(TaskObjectEntity::getTaskId, eventAddVO.getTaskId()));
.eq(TaskObjectEntity::getTaskId, eventAddVO.getTaskId()));
if (Func.isNotEmpty(topList)) { if (Func.isNotEmpty(topList)) {
for (TaskObjectEntity obj : topList) { for (TaskObjectEntity obj : topList) {
@ -236,26 +230,17 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
} }
//检查任务 //检查任务
checkOpenMutipleTask(AuthUtil.getUserId()); checkOpenMutipleTask(AuthUtil.getUserId());
TaskUserEntity userEntity = taskUserService.getOne(Wrappers.<TaskUserEntity>lambdaQuery() TaskUserEntity userEntity = taskUserService.getOne(Wrappers.<TaskUserEntity>lambdaQuery().eq(TaskUserEntity::getClaimStatus, ClaimStatusEnum.COLLECT.getStatus()).eq(TaskUserEntity::getTaskId, task.getId()));
.eq(TaskUserEntity::getClaimStatus, ClaimStatusEnum.COLLECT.getStatus())
.eq(TaskUserEntity::getTaskId, task.getId()));
if (Func.isNotEmpty(userEntity)) { if (Func.isNotEmpty(userEntity)) {
removeStartTaskId(id); removeStartTaskId(id);
throw new ServiceException("该任务已被领用,请刷新页面"); throw new ServiceException("该任务已被领用,请刷新页面");
} }
//给当前人领取任务 //给当前人领取任务
taskUserService.update(Wrappers.<TaskUserEntity>lambdaUpdate() taskUserService.update(Wrappers.<TaskUserEntity>lambdaUpdate().set(TaskUserEntity::getClaimStatus, ClaimStatusEnum.COLLECT.getStatus()).set(TaskUserEntity::getClaimTime, LocalDateTime.now()).eq(TaskUserEntity::getTaskId, task.getId()).eq(TaskUserEntity::getUserId, AuthUtil.getUserId()));
.set(TaskUserEntity::getClaimStatus, ClaimStatusEnum.COLLECT.getStatus())
.set(TaskUserEntity::getClaimTime, LocalDateTime.now())
.eq(TaskUserEntity::getTaskId, task.getId())
.eq(TaskUserEntity::getUserId, AuthUtil.getUserId()));
//如果是抢占任务,删除能够抢占此任务的其他人 //如果是抢占任务,删除能够抢占此任务的其他人
if (PlanContants.PlanMethodEnum.SEIZE.getMethod().equals(task.getMethod())) { if (PlanContants.PlanMethodEnum.SEIZE.getMethod().equals(task.getMethod())) {
taskUserService.remove(Wrappers.<TaskUserEntity>lambdaQuery() taskUserService.remove(Wrappers.<TaskUserEntity>lambdaQuery().eq(TaskUserEntity::getTaskId, task.getId()).ne(TaskUserEntity::getClaimStatus, ClaimStatusEnum.COLLECT.getStatus()).ne(TaskUserEntity::getUserId, AuthUtil.getUserId()));
.eq(TaskUserEntity::getTaskId, task.getId())
.ne(TaskUserEntity::getClaimStatus, ClaimStatusEnum.COLLECT.getStatus())
.ne(TaskUserEntity::getUserId, AuthUtil.getUserId()));
} }
task.setStatus(Integer.valueOf(TaskStatusEnum.UNDERWAY_STATUS.getStatus())); task.setStatus(Integer.valueOf(TaskStatusEnum.UNDERWAY_STATUS.getStatus()));
task.setStartTime(LocalDateTime.now()); task.setStartTime(LocalDateTime.now());
@ -288,11 +273,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
//检查任务 //检查任务
checkOpenMutipleTask(userId); checkOpenMutipleTask(userId);
//给当前人领取任务 //给当前人领取任务
taskUserService.update(Wrappers.<TaskUserEntity>lambdaUpdate() taskUserService.update(Wrappers.<TaskUserEntity>lambdaUpdate().set(TaskUserEntity::getClaimStatus, ClaimStatusEnum.COLLECT.getStatus()).set(TaskUserEntity::getClaimTime, LocalDateTime.now()).eq(TaskUserEntity::getTaskId, task.getId()).eq(TaskUserEntity::getUserId, userId));
.set(TaskUserEntity::getClaimStatus, ClaimStatusEnum.COLLECT.getStatus())
.set(TaskUserEntity::getClaimTime, LocalDateTime.now())
.eq(TaskUserEntity::getTaskId, task.getId())
.eq(TaskUserEntity::getUserId, userId));
//如果是抢占任务,删除能够抢占此任务的其他人 //如果是抢占任务,删除能够抢占此任务的其他人
if (PlanContants.PlanMethodEnum.SEIZE.getMethod().equals(task.getMethod())) { if (PlanContants.PlanMethodEnum.SEIZE.getMethod().equals(task.getMethod())) {
taskUserService.remove(Wrappers.<TaskUserEntity>lambdaQuery().eq(TaskUserEntity::getTaskId, task.getId()).ne(TaskUserEntity::getId, userId)); taskUserService.remove(Wrappers.<TaskUserEntity>lambdaQuery().eq(TaskUserEntity::getTaskId, task.getId()).ne(TaskUserEntity::getId, userId));
@ -314,29 +295,17 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
List<TaskObjectVO> result = Lists.newArrayList(); List<TaskObjectVO> result = Lists.newArrayList();
for (TaskObjectEntity taskObject : list) { for (TaskObjectEntity taskObject : list) {
TaskObjectVO vo = TaskObjectVO.builder().objId(taskObject.getObjectId()).taskId(taskObject.getTaskId()).objName(taskObject.getName()).build(); TaskObjectVO vo = TaskObjectVO.builder().objId(taskObject.getObjectId()).taskId(taskObject.getTaskId()).objName(taskObject.getName()).build();
List<TaskObjectProjectEntity> taskObjectProjectList = taskObjectProjectService.list(Wrappers.<TaskObjectProjectEntity>lambdaQuery() List<TaskObjectProjectEntity> taskObjectProjectList = taskObjectProjectService.list(Wrappers.<TaskObjectProjectEntity>lambdaQuery().eq(TaskObjectProjectEntity::getTaskId, taskObject.getTaskId()).eq(TaskObjectProjectEntity::getObjectId, taskObject.getObjectId()));
.eq(TaskObjectProjectEntity::getTaskId, taskObject.getTaskId())
.eq(TaskObjectProjectEntity::getObjectId, taskObject.getObjectId()));
List<TaskObjectProjectVO> projectVOList = Lists.newArrayList(); List<TaskObjectProjectVO> projectVOList = Lists.newArrayList();
for (TaskObjectProjectEntity taskObjectProject : taskObjectProjectList) { for (TaskObjectProjectEntity taskObjectProject : taskObjectProjectList) {
TaskObjectProjectVO projectVO = TaskObjectProjectVO.builder().projectId(taskObjectProject.getProjectId()).projectName(taskObjectProject.getName()).build(); TaskObjectProjectVO projectVO = TaskObjectProjectVO.builder().projectId(taskObjectProject.getProjectId()).projectName(taskObjectProject.getName()).build();
List<TaskObjectProjectContentEntity> taskObjectProjectContentList = taskObjectProjectContentService.list(Wrappers.<TaskObjectProjectContentEntity>lambdaQuery() List<TaskObjectProjectContentEntity> taskObjectProjectContentList = taskObjectProjectContentService.list(Wrappers.<TaskObjectProjectContentEntity>lambdaQuery().eq(TaskObjectProjectContentEntity::getTaskId, taskObjectProject.getTaskId()).eq(TaskObjectProjectContentEntity::getObjectId, taskObjectProject.getObjectId()).eq(TaskObjectProjectContentEntity::getProjectId, taskObjectProject.getProjectId()));
.eq(TaskObjectProjectContentEntity::getTaskId, taskObjectProject.getTaskId()) List<Long> eventIds = eventService.list(Wrappers.<EventEntity>lambdaQuery().eq(EventEntity::getTaskId, taskId).eq(EventEntity::getObjectId, taskObject.getObjectId()).eq(EventEntity::getProjectId, taskObjectProject.getProjectId())).stream().map(entity -> entity.getId()).collect(Collectors.toList());
.eq(TaskObjectProjectContentEntity::getObjectId, taskObjectProject.getObjectId())
.eq(TaskObjectProjectContentEntity::getProjectId, taskObjectProject.getProjectId()));
List<Long> eventIds = eventService.list(Wrappers.<EventEntity>lambdaQuery()
.eq(EventEntity::getTaskId, taskId)
.eq(EventEntity::getObjectId, taskObject.getObjectId())
.eq(EventEntity::getProjectId, taskObjectProject.getProjectId())).stream().map(entity -> entity.getId()).collect(Collectors.toList());
List<TaskObjectProjectContentVO> contentVOList = Lists.newArrayList(); List<TaskObjectProjectContentVO> contentVOList = Lists.newArrayList();
for (TaskObjectProjectContentEntity entity : taskObjectProjectContentList) { for (TaskObjectProjectContentEntity entity : taskObjectProjectContentList) {
TaskObjectProjectContentVO contentVO = BeanUtil.copy(entity, TaskObjectProjectContentVO.class); TaskObjectProjectContentVO contentVO = BeanUtil.copy(entity, TaskObjectProjectContentVO.class);
if ("0".equals(contentVO.getAvailable()) && eventIds.size() > 0) {//不可重复记录时,需要显示之前记录的值 if ("0".equals(contentVO.getAvailable()) && eventIds.size() > 0) {//不可重复记录时,需要显示之前记录的值
EventRecordEntity ere = eventRecordService.getOne(Wrappers.<EventRecordEntity>lambdaQuery() EventRecordEntity ere = eventRecordService.getOne(Wrappers.<EventRecordEntity>lambdaQuery().in(EventRecordEntity::getEventId, eventIds).eq(EventRecordEntity::getObjectId, taskObject.getObjectId()).eq(EventRecordEntity::getProjectId, taskObjectProject.getProjectId()).eq(EventRecordEntity::getContentId, contentVO.getContentId()).last("LIMIT 1"));
.in(EventRecordEntity::getEventId, eventIds)
.eq(EventRecordEntity::getObjectId, taskObject.getObjectId())
.eq(EventRecordEntity::getProjectId, taskObjectProject.getProjectId())
.eq(EventRecordEntity::getContentId, contentVO.getContentId()).last("LIMIT 1"));
contentVO.setCurrentStatus(ere.getCurrentStatus()); contentVO.setCurrentStatus(ere.getCurrentStatus());
contentVO.setCurrentValue(ere.getCurrentValue()); contentVO.setCurrentValue(ere.getCurrentValue());
contentVO.setFileUrl(ere.getFileUrl()); contentVO.setFileUrl(ere.getFileUrl());
@ -380,11 +349,9 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
taskReportVO.setUserId(userId); taskReportVO.setUserId(userId);
taskReportVO.setHours(list.stream().mapToLong(TaskCountVO::getHours).sum()); taskReportVO.setHours(list.stream().mapToLong(TaskCountVO::getHours).sum());
//巡检任务完成情况 //巡检任务完成情况
String finishSituation = list.stream().filter(vo -> StringUtil.isNotBlank(DictCache.getValue(TaskContants.INSPECT_TASK_TYPE, vo.getAutoVideo()))) String finishSituation = list.stream().filter(vo -> StringUtil.isNotBlank(DictCache.getValue(TaskContants.INSPECT_TASK_TYPE, vo.getAutoVideo()))).map(vo -> DictCache.getValue(TaskContants.INSPECT_TASK_TYPE, vo.getAutoVideo()).concat(":").concat(String.valueOf(Optional.ofNullable(vo.getFinishTask()).orElse(0)))).collect(Collectors.joining("\r\n"));
.map(vo -> DictCache.getValue(TaskContants.INSPECT_TASK_TYPE, vo.getAutoVideo()).concat(":").concat(String.valueOf(Optional.ofNullable(vo.getFinishTask()).orElse(0)))).collect(Collectors.joining("\r\n"));
//巡检任务未完成情况 //巡检任务未完成情况
String undoSituation = list.stream().filter(vo -> StringUtil.isNotBlank(DictCache.getValue(TaskContants.INSPECT_TASK_TYPE, vo.getAutoVideo()))) String undoSituation = list.stream().filter(vo -> StringUtil.isNotBlank(DictCache.getValue(TaskContants.INSPECT_TASK_TYPE, vo.getAutoVideo()))).map(vo -> DictCache.getValue(TaskContants.INSPECT_TASK_TYPE, vo.getAutoVideo()).concat(":").concat(String.valueOf(Optional.ofNullable(vo.getUndoneTask()).orElse(0)))).collect(Collectors.joining("\r\n"));
.map(vo -> DictCache.getValue(TaskContants.INSPECT_TASK_TYPE, vo.getAutoVideo()).concat(":").concat(String.valueOf(Optional.ofNullable(vo.getUndoneTask()).orElse(0)))).collect(Collectors.joining("\r\n"));
taskReportVO.setCompleteNum(list.stream().filter(taskCountVO -> Func.isNotEmpty(taskCountVO.getFinishTask())).collect(Collectors.summingInt(TaskCountVO::getFinishTask))); taskReportVO.setCompleteNum(list.stream().filter(taskCountVO -> Func.isNotEmpty(taskCountVO.getFinishTask())).collect(Collectors.summingInt(TaskCountVO::getFinishTask)));
taskReportVO.setCompleteSituation(finishSituation); taskReportVO.setCompleteSituation(finishSituation);
taskReportVO.setIncompleteNum(list.stream().filter(taskCountVO -> Func.isNotEmpty(taskCountVO.getUndoneTask())).collect(Collectors.summingInt(TaskCountVO::getUndoneTask))); taskReportVO.setIncompleteNum(list.stream().filter(taskCountVO -> Func.isNotEmpty(taskCountVO.getUndoneTask())).collect(Collectors.summingInt(TaskCountVO::getUndoneTask)));
@ -494,18 +461,13 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
eventQuery.setTaskId(id); eventQuery.setTaskId(id);
eventQuery.setObjectId(taskObject.getObjectId()); eventQuery.setObjectId(taskObject.getObjectId());
eventQuery.setProjectId(taskObjectProject.getProjectId()); eventQuery.setProjectId(taskObjectProject.getProjectId());
List<Long> eventIds = eventService.getEventList(eventQuery) List<Long> eventIds = eventService.getEventList(eventQuery).stream().map(entity -> entity.getId()).collect(Collectors.toList());
.stream().map(entity -> entity.getId()).collect(Collectors.toList());
List<TaskObjectProjectContentVO> contentVOList = Lists.newArrayList(); List<TaskObjectProjectContentVO> contentVOList = Lists.newArrayList();
for (TaskObjectProjectContentEntity entity : taskObjectProjectContentList) { for (TaskObjectProjectContentEntity entity : taskObjectProjectContentList) {
TaskObjectProjectContentVO contentVO = BeanUtil.copy(entity, TaskObjectProjectContentVO.class); TaskObjectProjectContentVO contentVO = BeanUtil.copy(entity, TaskObjectProjectContentVO.class);
if ("0".equals(contentVO.getAvailable()) && eventIds.size() > 0) {//不可重复记录时,需要显示之前记录的值 if ("0".equals(contentVO.getAvailable()) && eventIds.size() > 0) {//不可重复记录时,需要显示之前记录的值
EventRecordEntity ere = eventRecordService.getOne(Wrappers.<EventRecordEntity>lambdaQuery() EventRecordEntity ere = eventRecordService.getOne(Wrappers.<EventRecordEntity>lambdaQuery().in(EventRecordEntity::getEventId, eventIds).eq(EventRecordEntity::getObjectId, taskObject.getObjectId()).eq(EventRecordEntity::getProjectId, taskObjectProject.getProjectId()).eq(EventRecordEntity::getContentId, contentVO.getContentId()).last("LIMIT 1"));
.in(EventRecordEntity::getEventId, eventIds)
.eq(EventRecordEntity::getObjectId, taskObject.getObjectId())
.eq(EventRecordEntity::getProjectId, taskObjectProject.getProjectId())
.eq(EventRecordEntity::getContentId, contentVO.getContentId()).last("LIMIT 1"));
contentVO.setCurrentStatus(ere.getCurrentStatus()); contentVO.setCurrentStatus(ere.getCurrentStatus());
contentVO.setCurrentValue(ere.getCurrentValue()); contentVO.setCurrentValue(ere.getCurrentValue());
contentVO.setFileUrl(ere.getFileUrl()); contentVO.setFileUrl(ere.getFileUrl());
@ -611,15 +573,9 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
if (entity != null) { if (entity != null) {
throw new ServiceException("该任务已有历史记录,不能撤销领用"); throw new ServiceException("该任务已有历史记录,不能撤销领用");
} }
taskUserService.update(Wrappers.lambdaUpdate(TaskUserEntity.class) taskUserService.update(Wrappers.lambdaUpdate(TaskUserEntity.class).eq(TaskUserEntity::getUserId, AuthUtil.getUserId()).eq(TaskUserEntity::getTaskId, taskId).set(TaskUserEntity::getClaimStatus, ClaimStatusEnum.UN_COLLECT.getStatus()).set(TaskUserEntity::getClaimTime, null));
.eq(TaskUserEntity::getUserId, AuthUtil.getUserId())
.eq(TaskUserEntity::getTaskId, taskId)
.set(TaskUserEntity::getClaimStatus, ClaimStatusEnum.UN_COLLECT.getStatus())
.set(TaskUserEntity::getClaimTime, null));
taskUserService.updateDeleteStatus(taskId); taskUserService.updateDeleteStatus(taskId);
this.update(Wrappers.lambdaUpdate(TaskEntity.class) this.update(Wrappers.lambdaUpdate(TaskEntity.class).eq(TaskEntity::getId, taskId).set(TenantEntity::getStatus, TaskStatusEnum.INIT_STATUS.ordinal()));
.eq(TaskEntity::getId, taskId)
.set(TenantEntity::getStatus, TaskStatusEnum.INIT_STATUS.ordinal()));
return true; return true;
} }
@ -663,8 +619,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
} }
if (vo.getAutoVideo().equals(PlanContants.InspectTypeEnum.ROBOT.getVal())) { if (vo.getAutoVideo().equals(PlanContants.InspectTypeEnum.ROBOT.getVal())) {
//任务执行人 //任务执行人
TaskUserEntity query = taskUserService.getOne(Wrappers.<TaskUserEntity>lambdaQuery() TaskUserEntity query = taskUserService.getOne(Wrappers.<TaskUserEntity>lambdaQuery().eq(TaskUserEntity::getTaskId, vo.getId()));
.eq(TaskUserEntity::getTaskId, vo.getId()));
if (Func.isNotEmpty(query)) { if (Func.isNotEmpty(query)) {
vo.setRobot(robotService.getDetailByUserId(query.getUserId())); vo.setRobot(robotService.getDetailByUserId(query.getUserId()));
} }
@ -774,7 +729,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
/** /**
* 立即生成任务 发送短信通知提醒 * 立即生成任务 发送短信通知提醒
* @param it * @param it
*//* */ /*
@Override @Override
public void taskGenerateSMSNoticeNew(TaskEntity it){ public void taskGenerateSMSNoticeNew(TaskEntity it){
@ -807,7 +762,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
* TODO 巡检通知 * TODO 巡检通知
* 向通知表添加任务结束记录 * 向通知表添加任务结束记录
* @param taskSMS * @param taskSMS
*//* */ /*
private void addNotice (InspectionTaskSMS taskSMS,String type){ private void addNotice (InspectionTaskSMS taskSMS,String type){
Notify notify = new Notify(); Notify notify = new Notify();
@ -838,7 +793,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
*/ */
/** /**
* 另开线程发送短信 * 另开线程发送短信
*//* */ /*
private void otherThreadSendSMS(InspectionTaskSMS taskSMS,String templateCode){ private void otherThreadSendSMS(InspectionTaskSMS taskSMS,String templateCode){
HzimsThreadPool.getFixedThreadExecutor().execute(new Runnable() { HzimsThreadPool.getFixedThreadExecutor().execute(new Runnable() {
@ -854,7 +809,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
/** /**
* TODO * TODO
* 发送短信 * 发送短信
*//* */ /*
private int sendSMS(InspectionTaskSMS taskSMS,String templateCode){ private int sendSMS(InspectionTaskSMS taskSMS,String templateCode){
int re = 0; int re = 0;
@ -918,46 +873,35 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
Date currentDate = DateUtil.parse(DateUtil.formatDate(DateUtil.now()), DateUtil.PATTERN_DATE); Date currentDate = DateUtil.parse(DateUtil.formatDate(DateUtil.now()), DateUtil.PATTERN_DATE);
String startDate = DateUtil.formatDate(currentDate); String startDate = DateUtil.formatDate(currentDate);
String endDate = DateUtil.formatDate(DateUtil.plusDays(currentDate, 1)); String endDate = DateUtil.formatDate(DateUtil.plusDays(currentDate, 1));
if(CollectionUtil.isEmpty(taskIds)){ if (CollectionUtil.isEmpty(taskIds)) {
// 查询当天可操作任务 // 查询当天可操作任务
List<TaskEntity> sameDayTasks = this.getSameDayTask(null,TaskStatusEnum.UNDERWAY_STATUS.getStatus(),startDate,endDate); List<TaskEntity> sameDayTasks = this.getSameDayTask(null, TaskStatusEnum.UNDERWAY_STATUS.getStatus(), startDate, endDate);
if(CollectionUtil.isNotEmpty(sameDayTasks)){ if (CollectionUtil.isNotEmpty(sameDayTasks)) {
return true; return true;
} }
throw new ServiceException("当前没有可领用的巡检任务!"); throw new ServiceException("当前没有可领用的巡检任务!");
} }
// 查询可领用任务 // 查询可领用任务
List<TaskEntity> tasks = this.getSameDayTask(taskIds,TaskStatusEnum.INIT_STATUS.getStatus(),startDate,endDate); List<TaskEntity> tasks = this.getSameDayTask(taskIds, TaskStatusEnum.INIT_STATUS.getStatus(), startDate, endDate);
if(CollectionUtil.isEmpty(tasks)){ if (CollectionUtil.isEmpty(tasks)) {
throw new ServiceException("选择巡检任务已被领用完成!"); throw new ServiceException("选择巡检任务已被领用完成!");
} }
if(taskIds.size() != taskIds.size()){ if (taskIds.size() != taskIds.size()) {
throw new ServiceException("选择巡检任务中存在已被领用任务,请重新选择!"); throw new ServiceException("选择巡检任务中存在已被领用任务,请重新选择!");
} }
tasks.forEach(task -> { tasks.forEach(task -> {
if (hasExistStartId(task.getId()) || !addStartTaskId(task.getId())) { if (hasExistStartId(task.getId()) || !addStartTaskId(task.getId())) {
throw new ServiceException("任务"+ task.getPlanName() +"["+ task.getPlanId() +"]有人在领用,请稍后重试!"); throw new ServiceException("任务" + task.getPlanName() + "[" + task.getPlanId() + "]有人在领用,请稍后重试!");
} }
// 任务归属人设置 // 任务归属人设置
taskUserService.update(Wrappers.<TaskUserEntity>lambdaUpdate() taskUserService.update(Wrappers.<TaskUserEntity>lambdaUpdate().set(TaskUserEntity::getClaimStatus, ClaimStatusEnum.COLLECT.getStatus()).set(TaskUserEntity::getClaimTime, LocalDateTime.now()).eq(TaskUserEntity::getTaskId, task.getId()).eq(TaskUserEntity::getUserId, AuthUtil.getUserId()));
.set(TaskUserEntity::getClaimStatus, ClaimStatusEnum.COLLECT.getStatus())
.set(TaskUserEntity::getClaimTime, LocalDateTime.now())
.eq(TaskUserEntity::getTaskId, task.getId())
.eq(TaskUserEntity::getUserId, AuthUtil.getUserId()));
// 其他候选任务抢占人移除(抢占模式) // 其他候选任务抢占人移除(抢占模式)
if (PlanContants.PlanMethodEnum.SEIZE.getMethod().equals(task.getMethod())) { if (PlanContants.PlanMethodEnum.SEIZE.getMethod().equals(task.getMethod())) {
taskUserService.remove(Wrappers.<TaskUserEntity>lambdaQuery() taskUserService.remove(Wrappers.<TaskUserEntity>lambdaQuery().eq(TaskUserEntity::getTaskId, task.getId()).ne(TaskUserEntity::getClaimStatus, ClaimStatusEnum.COLLECT.getStatus()).ne(TaskUserEntity::getUserId, AuthUtil.getUserId()));
.eq(TaskUserEntity::getTaskId, task.getId()) }
.ne(TaskUserEntity::getClaimStatus, ClaimStatusEnum.COLLECT.getStatus()) boolean flag = this.update(Wrappers.<TaskEntity>lambdaUpdate().set(TaskEntity::getStatus, TaskStatusEnum.UNDERWAY_STATUS.getStatus()).set(TaskEntity::getStartTime, LocalDateTime.now()).eq(TaskEntity::getId, task.getId()));
.ne(TaskUserEntity::getUserId, AuthUtil.getUserId())); if (!flag) {
}
boolean flag = this.update(Wrappers.<TaskEntity>lambdaUpdate()
.set(TaskEntity::getStatus, TaskStatusEnum.UNDERWAY_STATUS.getStatus())
.set(TaskEntity::getStartTime, LocalDateTime.now())
.eq(TaskEntity::getId, task.getId())
);
if(!flag){
throw new ServiceException("任务领取异常,请稍后重试!"); throw new ServiceException("任务领取异常,请稍后重试!");
} }
// 任务开始列表中移除已进行领用任务 // 任务开始列表中移除已进行领用任务
@ -967,8 +911,72 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
} }
private List<TaskEntity> getSameDayTask(List<Long> taskIds, String status, String startDate, String endDate) { private List<TaskEntity> getSameDayTask(List<Long> taskIds, String status, String startDate, String endDate) {
return this.baseMapper.getSameDayTask(taskIds,status,startDate,endDate); return this.baseMapper.getSameDayTask(taskIds, status, startDate, endDate);
} }
/**
* 巡检任务分页
*
* @param pageInfo
* @param task
* @return
*/
@Override
public BladePage<TaskVo> selectPage(Page<TaskEntity> pageInfo, TaskListQuery task) {
QueryWrapper<TaskEntity> queryWrapper = new QueryWrapper<>();
//值班id
queryWrapper.eq(ObjectUtils.isNotNull(task.getDutyId()), "DUTY_ID", task.getDutyId());
//当前登录的用户
queryWrapper.eq(ObjectUtils.isNotNull(task.getCurUserId()), "USER_ID", task.getCurUserId());
//计划名称
queryWrapper.like(StringUtils.isNotBlank(task.getPlanName()), "PLAN_NAME", task.getPlanName());
//任务批次号
queryWrapper.like(StringUtils.isNotBlank(task.getBatchNumber()), "BATCH_NUMBER", task.getBatchNumber());
//任务计划开始时间
queryWrapper.lt(ObjectUtils.isNotNull(task.getPlanStartTime()), "PLAN_START_TIME", task.getBatchNumber());
//任务计划结束时间
queryWrapper.le(ObjectUtils.isNotNull(task.getPlanEndTime()), "PLAN_END_TIME", task.getPlanEndTime());
//任务实际开始时间
queryWrapper.le(ObjectUtils.isNotNull(task.getStartTime()), "PLAN_END_TIME", task.getStartTime());
//巡检周期 0: 每次 1:每天 2:每月 3:每季度 4:每年 5:每周
queryWrapper.eq(StringUtils.isNotBlank(task.getCycle()), "CYCLE", task.getCycle());
//任务状态 0未开始 1进行中 2暂停 3已完成 4未完成
queryWrapper.eq(ObjectUtils.isNotNull(task.getStatus()), "STATUS", task.getStatus());
// 任务报备 0 未报备 1已报备
queryWrapper.eq(ObjectUtils.isNotNull(task.getKeepOnRecord()), "KEEP_ON_RECORD", task.getKeepOnRecord());
//租户id
queryWrapper.eq(StringUtils.isNotBlank(task.getTenantId()), "TENANT_ID", task.getTenantId());
//巡检类型标识: 0普通巡检,1视频自动巡检,2机器人巡检
queryWrapper.eq(StringUtils.isNotBlank(task.getAutoVideo()), "AUTO_VIDEO", task.getAutoVideo());
//巡检任务 按逗号分隔
queryWrapper.apply(StringUtils.isNotBlank(task.getTaskIds()), "FIND_IN_SET(t.ID,'" + task.getTaskIds() + "'");
//区域Id
queryWrapper.eq(StringUtils.isNotBlank(task.getAreaId()), "CREATE_DEPT", task.getAreaId());
//月份
queryWrapper.eq(ObjectUtils.isNotNull(task.getYearMonth()), "date_format(PLAN_START_TIME, '%Y-%m')", task.getYearMonth());
Page<TaskEntity> taskEntityPage = baseMapper.selectPage(pageInfo, queryWrapper);
List<TaskEntity> records = taskEntityPage.getRecords();
if (CollectionUtils.isNotEmpty(records)) {
List<TaskVo> collect = records.stream().map(item -> {
TaskVo taskVo = new TaskVo();
BeanUtils.copyProperties(item, taskVo);
return taskVo;
}).collect(Collectors.toList());
Page<TaskVo> taskVoList = new Page<>();
taskVoList.setRecords(collect);
taskVoList.setPages(taskEntityPage.getPages());
taskVoList.setSize(taskEntityPage.getSize());
taskVoList.setTotal(taskEntityPage.getTotal());
taskVoList.setCurrent(taskEntityPage.getCurrent());
BladePage<TaskVo> bladePage = BladePage.of(taskVoList);
return bladePage;
}
return null;
}
} }

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);
} }

179
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;
@ -89,10 +92,10 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
@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());
@ -102,16 +105,12 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
} }
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",
FlowUtil.getBusinessKey("hzims_oper_access_task",String.valueOf(req.getId())),
req.getName(),
new HashMap<String, Object>() {{
put("taskId", req.getId()); put("taskId", req.getId());
put("handler", TaskUtil.getTaskUser(req.getHandler().toString())); put("handler", TaskUtil.getTaskUser(req.getHandler().toString()));
put("creator", TaskUtil.getTaskUser(AuthUtil.getUserId().toString())); put("creator", TaskUtil.getTaskUser(AuthUtil.getUserId().toString()));
}}); }});
Assert.isTrue(bladeFlowR.isSuccess() && ObjectUtil.isNotEmpty(bladeFlowR.getData()),()->{ Assert.isTrue(bladeFlowR.isSuccess() && ObjectUtil.isNotEmpty(bladeFlowR.getData()), () -> {
throw new ServiceException("保存检修任务失败,开启检修任务流程失败!"); throw new ServiceException("保存检修任务失败,开启检修任务流程失败!");
}); });
String processInstanceId = bladeFlowR.getData().getProcessInstanceId(); String processInstanceId = bladeFlowR.getData().getProcessInstanceId();
@ -140,14 +139,14 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
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();
@ -158,7 +157,7 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
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());
@ -169,25 +168,23 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
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) {
else if (req.getStatus() == AccessConstants.ACCESS_TASK_STATUS_2) {
updateMaterials(entity.getPlanId(), entity.getId(), req.getAccessMaterials()); updateMaterials(entity.getPlanId(), entity.getId(), req.getAccessMaterials());
//工作流下一步 //工作流下一步
completeTask(comleteTask, handler, entity.getProcessInstanceId(), entity.getCreateDept()); completeTask(comleteTask, handler, entity.getProcessInstanceId(), entity.getCreateDept());
} }
//如果任务审批未通过 需重新开票 将任务ticketId置空 //如果任务审批未通过 需重新开票 将任务ticketId置空
else if(req.getStatus() == AccessConstants.ACCESS_TASK_STATUS_3) { else if (req.getStatus() == AccessConstants.ACCESS_TASK_STATUS_3) {
LambdaUpdateWrapper<OperAccessTaskEntity> updateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<OperAccessTaskEntity> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(OperAccessTaskEntity::getTicketId, null); updateWrapper.set(OperAccessTaskEntity::getTicketId, null);
updateWrapper.eq(OperAccessTaskEntity::getId, entity.getId()); updateWrapper.eq(OperAccessTaskEntity::getId, entity.getId());
super.update(updateWrapper); super.update(updateWrapper);
R result = flowClient.completeTask(comleteTask); R result = flowClient.completeTask(comleteTask);
if(!result.isSuccess()){ if (!result.isSuccess()) {
throw new ServiceException(result.getMsg()); throw new ServiceException(result.getMsg());
} }
@ -199,17 +196,13 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
public R<OperAccessTaskVO> detail(Long id) { public R<OperAccessTaskVO> detail(Long id) {
OperAccessTaskVO detail = OperAccessTaskWrapper.build().entityVO(super.getById(id)); OperAccessTaskVO detail = OperAccessTaskWrapper.build().entityVO(super.getById(id));
detail.setDangerSources(dangerSourceClient.details(detail.getSafeInfos().split(","))); detail.setDangerSources(dangerSourceClient.details(detail.getSafeInfos().split(",")));
detail.setDetails( detail.setDetails(OperAccessTaskDetailWrapper.build().listVO(detailService.list(new LambdaQueryWrapper<OperAccessTaskDetailEntity>() {{
OperAccessTaskDetailWrapper.build().listVO(
detailService.list(new LambdaQueryWrapper<OperAccessTaskDetailEntity>() {{
eq(OperAccessTaskDetailEntity::getTaskId, id); eq(OperAccessTaskDetailEntity::getTaskId, id);
}}) }})));
)
);
detail.setAccessMaterials(materialService.getList(null, String.valueOf(id))); detail.setAccessMaterials(materialService.getList(null, String.valueOf(id)));
if(Func.isNotEmpty(id)){ if (Func.isNotEmpty(id)) {
OperAccessTaskVO operAccessTaskVO = mapper.getAccessPlanByTaskId(id.toString()); OperAccessTaskVO operAccessTaskVO = mapper.getAccessPlanByTaskId(id.toString());
if(ObjectUtil.isNotEmpty(operAccessTaskVO)){ if (ObjectUtil.isNotEmpty(operAccessTaskVO)) {
detail.setPlanName(operAccessTaskVO.getPlanName()); detail.setPlanName(operAccessTaskVO.getPlanName());
} }
} }
@ -226,41 +219,41 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
@Override @Override
public List<OperAccessTaskEntity> getByEmCode(String emCode, List<String> list) { public List<OperAccessTaskEntity> getByEmCode(String emCode, List<String> list) {
return this.baseMapper.selectByEmCode(emCode,list); return this.baseMapper.selectByEmCode(emCode, list);
} }
@Override @Override
public List<AccessReportVO> getAccessTaskByDisposer(LocalDate startDate, LocalDate endDate, List<Long> deptIdList) { public List<AccessReportVO> getAccessTaskByDisposer(LocalDate startDate, LocalDate endDate, List<Long> deptIdList) {
List<AccessReportVO> inspectOrAccessReportVOList = new ArrayList<>(); List<AccessReportVO> inspectOrAccessReportVOList = new ArrayList<>();
//获取月份内的检修任务 //获取月份内的检修任务
List<OperAccessTaskEntity> operAccessTaskEntityList = this.list(new LambdaQueryWrapper<OperAccessTaskEntity>(){{ List<OperAccessTaskEntity> operAccessTaskEntityList = this.list(new LambdaQueryWrapper<OperAccessTaskEntity>() {{
ge(OperAccessTaskEntity::getPlanStartTime,startDate); ge(OperAccessTaskEntity::getPlanStartTime, startDate);
le(OperAccessTaskEntity::getPlanStartTime,endDate); le(OperAccessTaskEntity::getPlanStartTime, endDate);
in(OperAccessTaskEntity::getCreateDept,deptIdList); in(OperAccessTaskEntity::getCreateDept, deptIdList);
}}); }});
//组合处理人 //组合处理人
Map<Long,List<OperAccessTaskEntity>> mapByDisposer = operAccessTaskEntityList.stream().collect(Collectors.groupingBy(OperAccessTaskEntity::getHandler)); Map<Long, List<OperAccessTaskEntity>> mapByDisposer = operAccessTaskEntityList.stream().collect(Collectors.groupingBy(OperAccessTaskEntity::getHandler));
mapByDisposer.forEach((userId,list)->{ mapByDisposer.forEach((userId, list) -> {
AccessReportVO accessReportVO = new AccessReportVO(); AccessReportVO accessReportVO = new AccessReportVO();
accessReportVO.setUserName(UserCache.getUser(userId).getName()); accessReportVO.setUserName(UserCache.getUser(userId).getName());
accessReportVO.setData(list); accessReportVO.setData(list);
//已完成情况 //已完成情况
List<OperAccessTaskEntity> finishList = list.stream().filter(o-> AccessConstants.ACCESS_TASK_STATUS_4 == o.getStatus()).collect(Collectors.toList()); List<OperAccessTaskEntity> finishList = list.stream().filter(o -> AccessConstants.ACCESS_TASK_STATUS_4 == o.getStatus()).collect(Collectors.toList());
accessReportVO.setCompleteNum(finishList.size()); accessReportVO.setCompleteNum(finishList.size());
accessReportVO.setCompleteSituation(finishList.size()+""); accessReportVO.setCompleteSituation(finishList.size() + "");
//未完成情况 //未完成情况
List<OperAccessTaskEntity> immatureList = list.stream().filter(o-> AccessConstants.ACCESS_TASK_STATUS_4 != o.getStatus()).collect(Collectors.toList()); List<OperAccessTaskEntity> immatureList = list.stream().filter(o -> AccessConstants.ACCESS_TASK_STATUS_4 != o.getStatus()).collect(Collectors.toList());
accessReportVO.setIncompleteNum(immatureList.size()); accessReportVO.setIncompleteNum(immatureList.size());
accessReportVO.setIncompleteSituation(immatureList.size()+""); accessReportVO.setIncompleteSituation(immatureList.size() + "");
//工时 //工时
int hours = list.stream().filter(o->o.getActHours() != null).collect(Collectors.summingInt(OperAccessTaskEntity::getActHours)); int hours = list.stream().filter(o -> o.getActHours() != null).collect(Collectors.summingInt(OperAccessTaskEntity::getActHours));
accessReportVO.setHours(hours); accessReportVO.setHours(hours);
//发现问题数量 //发现问题数量
List<OperPhenomenonEntity> operPhenomenonEntityList = operPhenomenonMapper.selectList(new LambdaQueryWrapper<OperPhenomenonEntity>(){{ List<OperPhenomenonEntity> operPhenomenonEntityList = operPhenomenonMapper.selectList(new LambdaQueryWrapper<OperPhenomenonEntity>() {{
eq(OperPhenomenonEntity::getFinder,userId); eq(OperPhenomenonEntity::getFinder, userId);
ge(OperPhenomenonEntity::getFindTime,startDate); ge(OperPhenomenonEntity::getFindTime, startDate);
le(OperPhenomenonEntity::getFindTime,endDate); le(OperPhenomenonEntity::getFindTime, endDate);
eq(OperPhenomenonEntity::getSourceCode, DefectConstant.DefectSourceEnum.JX.getStatus()); eq(OperPhenomenonEntity::getSourceCode, DefectConstant.DefectSourceEnum.JX.getStatus());
}}); }});
accessReportVO.setFindProblemCount(operPhenomenonEntityList.size()); accessReportVO.setFindProblemCount(operPhenomenonEntityList.size());
@ -270,11 +263,11 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
} }
@Override @Override
public List<AccessReportVO> getAccessTaskByDisposer(Map<String,Object> params) { public List<AccessReportVO> getAccessTaskByDisposer(Map<String, Object> params) {
LocalDate startDate = LocalDate.parse(params.get("startDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); 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)); LocalDate endDate = LocalDate.parse(params.get("endDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
List<Long> deptIdList = (List<Long>)params.get("deptId"); List<Long> deptIdList = (List<Long>) params.get("deptId");
return getAccessTaskByDisposer(startDate,endDate,deptIdList); return getAccessTaskByDisposer(startDate, endDate, deptIdList);
} }
@Override @Override
@ -283,8 +276,8 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
} }
@Override @Override
public List<OperAccessTaskEntity> getAccessTask(String startTime,String endTime,List<Long> list) { public List<OperAccessTaskEntity> getAccessTask(String startTime, String endTime, List<Long> list) {
return this.baseMapper.selectAccessTask(startTime,endTime,list); return this.baseMapper.selectAccessTask(startTime, endTime, list);
} }
/** /**
@ -329,7 +322,7 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
* @author xiashandong * @author xiashandong
**/ **/
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateMaterials(long planId,long taskId, List<OperAccessMaterialDTO> materials) { public void updateMaterials(long planId, long taskId, List<OperAccessMaterialDTO> materials) {
if (CollectionUtils.isEmpty(materials)) { if (CollectionUtils.isEmpty(materials)) {
materials = new ArrayList<>(); materials = new ArrayList<>();
} }
@ -344,14 +337,15 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
if (!CollectionUtils.isEmpty(ids)) { if (!CollectionUtils.isEmpty(ids)) {
materialService.deleteLogic(ids); materialService.deleteLogic(ids);
} }
if(CollectionUtil.isNotEmpty(materials)){ if (CollectionUtil.isNotEmpty(materials)) {
List<OperAccessMaterialEntity> materialEntityList = JSONArray.parseArray(JSON.toJSONString(materials),OperAccessMaterialEntity.class); List<OperAccessMaterialEntity> materialEntityList = JSONArray.parseArray(JSON.toJSONString(materials), OperAccessMaterialEntity.class);
materialService.saveOrUpdateBatch(materialEntityList); materialService.saveOrUpdateBatch(materialEntityList);
} }
} }
/** /**
* 执行检修任务 * 执行检修任务
*
* @param accessTaskDTO * @param accessTaskDTO
* @return * @return
*/ */
@ -361,7 +355,7 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
//TODO 更新任务状态以及 填入数据(待确认) //TODO 更新任务状态以及 填入数据(待确认)
taskEntity.setStatus(AccessConstants.ACCESS_TASK_STATUS_2); taskEntity.setStatus(AccessConstants.ACCESS_TASK_STATUS_2);
taskEntity.setActHours(accessTaskDTO.getActHours()); taskEntity.setActHours(accessTaskDTO.getActHours());
if(updateById(taskEntity)) { if (updateById(taskEntity)) {
//更新材料 //更新材料
updateMaterials(taskEntity.getPlanId(), taskEntity.getId(), accessTaskDTO.getAccessMaterials()); updateMaterials(taskEntity.getPlanId(), taskEntity.getId(), accessTaskDTO.getAccessMaterials());
//终结工作流 //终结工作流
@ -370,13 +364,14 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
comleteTask.setFlag("ok"); comleteTask.setFlag("ok");
comleteTask.setPass(true); comleteTask.setPass(true);
comleteTask.setComment("执行任务完成,进行下一步流程"); comleteTask.setComment("执行任务完成,进行下一步流程");
this.completeTask(comleteTask,AuthUtil.getUserId(),taskEntity.getProcessInstanceId(),taskEntity.getCreateDept()); this.completeTask(comleteTask, AuthUtil.getUserId(), taskEntity.getProcessInstanceId(), taskEntity.getCreateDept());
} }
return R.success("操作成功"); return R.success("操作成功");
} }
/** /**
* 获取安全检查定期检修项统计 * 获取安全检查定期检修项统计
*
* @param startDate 开始时间 * @param startDate 开始时间
* @param endDate 结束时间 * @param endDate 结束时间
* @param dept 机构ID * @param dept 机构ID
@ -385,18 +380,34 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
@Override @Override
public SafeCheckStatisticVO getAccessTaskCheck(String startDate, String endDate, Long dept) { public SafeCheckStatisticVO getAccessTaskCheck(String startDate, String endDate, Long dept) {
SafeCheckStatisticVO vo = new SafeCheckStatisticVO(); SafeCheckStatisticVO vo = new SafeCheckStatisticVO();
List<OperAccessTaskEntity> taskEntityList = this.list(Wrappers.<OperAccessTaskEntity>lambdaQuery() 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));
.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.setProjectType(Constants.SafeCheckProjectEnum.ACCESS_TASK.getType());
vo.setProjectTypeName(Constants.SafeCheckProjectEnum.ACCESS_TASK.getName()); vo.setProjectTypeName(Constants.SafeCheckProjectEnum.ACCESS_TASK.getName());
vo.setTotal(taskEntityList.size()); vo.setTotal(taskEntityList.size());
return vo; 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());
return baseMapper.selectPage(dbPage, queryWrapper);
}
/*** /***
* 根据流程ID和处理人完成任务 * 根据流程ID和处理人完成任务
* @param comleteTask * @param comleteTask
@ -404,10 +415,10 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
* @param processInstanceId * @param processInstanceId
*/ */
private void completeTask(ComleteTask comleteTask, Long handler, String processInstanceId, Long deptId) { private void completeTask(ComleteTask comleteTask, Long handler, String processInstanceId, Long deptId) {
if(ObjectUtil.isNotEmpty(handler)){ if (ObjectUtil.isNotEmpty(handler)) {
String taskUser = StringUtil.format("{}_{}",new String[]{"taskUser",String.valueOf(handler)}); String taskUser = StringUtil.format("{}_{}", new String[]{"taskUser", String.valueOf(handler)});
R<BladeFlow> bladeFlowR = flowClient.getTaskByProcessInstanceIdAndUserId(processInstanceId,taskUser); R<BladeFlow> bladeFlowR = flowClient.getTaskByProcessInstanceIdAndUserId(processInstanceId, taskUser);
if(!bladeFlowR.isSuccess() || ObjectUtil.isEmpty(bladeFlowR.getData())){ if (!bladeFlowR.isSuccess() || ObjectUtil.isEmpty(bladeFlowR.getData())) {
throw new ServiceException("获取检修任务工作流任务失败"); throw new ServiceException("获取检修任务工作流任务失败");
} }
//若成功则封装CompleteTask 执行任务 //若成功则封装CompleteTask 执行任务
@ -416,40 +427,37 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
} }
//获取检修任务审批人角色下的审批人列表 //获取检修任务审批人角色下的审批人列表
R<List<User>> userListR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), deptId, AccessConstants.TASK_REVIEWER); R<List<User>> userListR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), deptId, AccessConstants.TASK_REVIEWER);
if(!userListR.isSuccess()){ if (!userListR.isSuccess()) {
throw new ServiceException(userListR.getMsg()); throw new ServiceException(userListR.getMsg());
} }
if(ObjectUtil.isNotEmpty(userListR.getData())) { if (ObjectUtil.isNotEmpty(userListR.getData())) {
String reviewer = userListR.getData().stream().map(user->StringUtil.format("{}_{}","taskUser",String.valueOf(user.getId()))) String reviewer = userListR.getData().stream().map(user -> StringUtil.format("{}_{}", "taskUser", String.valueOf(user.getId()))).collect(Collectors.joining(","));
.collect(Collectors.joining(",")); Map<String, Object> variables = new HashMap<>(1);
Map<String,Object> variables = new HashMap<>(1); variables.put("reviewer", reviewer);
variables.put("reviewer",reviewer);
comleteTask.setVariables(variables); comleteTask.setVariables(variables);
} }
R result = flowClient.completeTask(comleteTask); R result = flowClient.completeTask(comleteTask);
if(!result.isSuccess()){ if (!result.isSuccess()) {
throw new ServiceException(result.getMsg()); throw new ServiceException(result.getMsg());
} }
} }
/** /**
* 根据检修任务完成缺陷处理流程 * 根据检修任务完成缺陷处理流程
*
* @param accessTaskEntity * @param accessTaskEntity
*/ */
private void finishDefectFlow(OperAccessTaskEntity accessTaskEntity) { private void finishDefectFlow(OperAccessTaskEntity accessTaskEntity) {
if(Func.isNotEmpty(accessTaskEntity.getPhenomenonId())) { if (Func.isNotEmpty(accessTaskEntity.getPhenomenonId())) {
OperPhenomenonEntity operPhenomenonEntity = operPhenomenonMapper.selectById(accessTaskEntity.getPhenomenonId()); OperPhenomenonEntity operPhenomenonEntity = operPhenomenonMapper.selectById(accessTaskEntity.getPhenomenonId());
operPhenomenonEntity.setHandleStatus(RepairConstant.CONCLUSION_PROBLEM); operPhenomenonEntity.setHandleStatus(RepairConstant.CONCLUSION_PROBLEM);
//operPhenomenonEntity.setCheckHours(accessTaskEntity.getActHours()); //operPhenomenonEntity.setCheckHours(accessTaskEntity.getActHours());
operPhenomenonMapper.updateById(operPhenomenonEntity); operPhenomenonMapper.updateById(operPhenomenonEntity);
String processInstanceId = operPhenomenonEntity.getCheckProcessInstanceId(); String processInstanceId = operPhenomenonEntity.getCheckProcessInstanceId();
//获取缺陷 //获取缺陷
OperDefectEntity operDefectEntity = defectService.getOne(Wrappers.<OperDefectEntity>lambdaQuery() OperDefectEntity operDefectEntity = defectService.getOne(Wrappers.<OperDefectEntity>lambdaQuery().eq(OperDefectEntity::getDefectCode, operPhenomenonEntity.getDefectCode()).last("limit 1;"));
.eq(OperDefectEntity::getDefectCode, operPhenomenonEntity.getDefectCode()) if (ObjectUtil.isNotEmpty(operDefectEntity)) {
.last("limit 1;")
);
if(ObjectUtil.isNotEmpty(operDefectEntity)) {
operDefectEntity.setActEndTime(new Date()); operDefectEntity.setActEndTime(new Date());
operDefectEntity.setActHours(ObjectUtil.isNotEmpty(accessTaskEntity.getActHours()) ? accessTaskEntity.getActHours().toString() : null); operDefectEntity.setActHours(ObjectUtil.isNotEmpty(accessTaskEntity.getActHours()) ? accessTaskEntity.getActHours().toString() : null);
operDefectEntity.setHandleStatus(RepairConstant.CONCLUSION_PROBLEM); operDefectEntity.setHandleStatus(RepairConstant.CONCLUSION_PROBLEM);
@ -460,21 +468,21 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
ComleteTask comleteTask = new ComleteTask(); ComleteTask comleteTask = new ComleteTask();
comleteTask.setProcessInstanceId(processInstanceId); comleteTask.setProcessInstanceId(processInstanceId);
//获取当前环节taskId //获取当前环节taskId
R<BladeFlow> bladeFlowR = flowClient.getTaskByProcessInstanceIdAndUserId(processInstanceId, "taskUser_"+AuthUtil.getUserId()); R<BladeFlow> bladeFlowR = flowClient.getTaskByProcessInstanceIdAndUserId(processInstanceId, "taskUser_" + AuthUtil.getUserId());
Assert.isTrue(bladeFlowR.isSuccess() && ObjectUtil.isNotEmpty(bladeFlowR.getData()),()->{ Assert.isTrue(bladeFlowR.isSuccess() && ObjectUtil.isNotEmpty(bladeFlowR.getData()), () -> {
throw new ServiceException("当前操作人获取消缺任务失败"); throw new ServiceException("当前操作人获取消缺任务失败");
}); });
comleteTask.setTaskId(bladeFlowR.getData().getTaskId()); comleteTask.setTaskId(bladeFlowR.getData().getTaskId());
comleteTask.setComment("审批通过工作流结束"); comleteTask.setComment("审批通过工作流结束");
comleteTask.setFlag("ok"); comleteTask.setFlag("ok");
comleteTask.setPass(true); comleteTask.setPass(true);
Map<String,Object> variables = new HashMap<>(1); Map<String, Object> variables = new HashMap<>(1);
R<List<User>> listR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), operDefectEntity.getCreateDept(), DefectConstant.PROCESS_VARIABLE_CONCLUSION); R<List<User>> listR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), operDefectEntity.getCreateDept(), DefectConstant.PROCESS_VARIABLE_CONCLUSION);
Assert.isTrue(listR.isSuccess() && ObjectUtil.isNotEmpty(listR.getData()),()->{ Assert.isTrue(listR.isSuccess() && ObjectUtil.isNotEmpty(listR.getData()), () -> {
throw new ServiceException("获取问题定论人失败"); throw new ServiceException("获取问题定论人失败");
}); });
String conclusion = listR.getData().stream().map(user->"taskUser_"+user.getId()).collect(Collectors.joining(",")); String conclusion = listR.getData().stream().map(user -> "taskUser_" + user.getId()).collect(Collectors.joining(","));
variables.put("conclusion",conclusion); variables.put("conclusion", conclusion);
comleteTask.setVariables(variables); comleteTask.setVariables(variables);
flowClient.completeTask(comleteTask); flowClient.completeTask(comleteTask);
} }
@ -482,16 +490,17 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
/** /**
* 巡检任务生成后待办消息提示 * 巡检任务生成后待办消息提示
*
* @param req * @param req
*/ */
private void pushHandleMessage(OperAccessTaskDTO operAccessTaskDTO,PushExtrasReq req){ private void pushHandleMessage(OperAccessTaskDTO operAccessTaskDTO, PushExtrasReq req) {
req.setTitle(AccessConstants.MESSAGE_TITLE); req.setTitle(AccessConstants.MESSAGE_TITLE);
req.setType(AccessConstants.MESSAGE_ACCESS_TYPE); req.setType(AccessConstants.MESSAGE_ACCESS_TYPE);
req.setBusinessClassify(OperationalConstants.MessageClassifyEnum.MESSAGE_REMINDSY.getVal()); req.setBusinessClassify(OperationalConstants.MessageClassifyEnum.MESSAGE_REMINDSY.getVal());
req.setPushAlert(AccessConstants.AccessProcessEnum.ACCESS_BACKLOG.getMsg()); req.setPushAlert(AccessConstants.AccessProcessEnum.ACCESS_BACKLOG.getMsg());
log.info("--------消息推送开始----------"); log.info("--------消息推送开始----------");
messagePushClient.sendMessage(operAccessTaskDTO.getHandler().toString(), req,operAccessTaskDTO.getTenantId(),operAccessTaskDTO.getCreateDept(),operAccessTaskDTO.getCreateUser()); messagePushClient.sendMessage(operAccessTaskDTO.getHandler().toString(), req, operAccessTaskDTO.getTenantId(), operAccessTaskDTO.getCreateDept(), operAccessTaskDTO.getCreateUser());
log.info("消息推送人为:{},推送消息为:{}",operAccessTaskDTO.getHandler().toString(),AccessConstants.AccessProcessEnum.ACCESS_BACKLOG.getMsg()); log.info("消息推送人为:{},推送消息为:{}", operAccessTaskDTO.getHandler().toString(), AccessConstants.AccessProcessEnum.ACCESS_BACKLOG.getMsg());
log.info("--------消息推送成功----------"); log.info("--------消息推送成功----------");
} }
} }

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

@ -69,12 +69,12 @@ public class OperPhenomenonController extends BladeController {
@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())) {
@ -86,6 +86,26 @@ public class OperPhenomenonController extends BladeController {
if (Func.isNotEmpty(entity.getDiscriminateStatus())) { if (Func.isNotEmpty(entity.getDiscriminateStatus())) {
queryWrapper.eq(OperPhenomenonEntity::getDiscriminateStatus, 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); queryWrapper.orderByDesc(OperPhenomenonEntity::getUpdateTime);
IPage<OperPhenomenonEntity> pages = phenomenonService.page(Condition.getPage(query), queryWrapper); IPage<OperPhenomenonEntity> pages = phenomenonService.page(Condition.getPage(query), queryWrapper);
IPage<OperPhenomenonVO> vos = OperPhenomenonWrapper.build().pageVO(pages); IPage<OperPhenomenonVO> vos = OperPhenomenonWrapper.build().pageVO(pages);
@ -102,9 +122,9 @@ public class OperPhenomenonController extends BladeController {
return R.data(phenomenonService.submit(phenomenon)); return R.data(phenomenonService.submit(phenomenon));
} }
/* *//** /* */ /**
* 修改 代码自定义代号 * 修改 代码自定义代号
*//* */ /*
@PostMapping("/update") @PostMapping("/update")
@ApiOperationSupport(order = 5) @ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入phenomenon") @ApiOperation(value = "修改", notes = "传入phenomenon")
@ -112,9 +132,9 @@ public class OperPhenomenonController extends BladeController {
return R.status(phenomenonService.updateById(phenomenon)); return R.status(phenomenonService.updateById(phenomenon));
} }
*//** */ /**
* 新增或修改 代码自定义代号 * 新增或修改 代码自定义代号
*//* */ /*
@PostMapping("/submit") @PostMapping("/submit")
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@ApiOperation(value = "新增或修改", notes = "传入phenomenon") @ApiOperation(value = "新增或修改", notes = "传入phenomenon")

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