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. 182
      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. 61
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java
  18. 20
      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. 77
      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);
} }

182
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()));
} }
@ -939,24 +894,13 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
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()));
}
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) { if (!flag) {
throw new ServiceException("任务领取异常,请稍后重试!"); throw new ServiceException("任务领取异常,请稍后重试!");
} }
@ -971,4 +915,68 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
} }
/**
* 巡检任务分页
*
* @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);
} }

61
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;
@ -102,11 +105,7 @@ 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()));
@ -172,9 +171,7 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
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());
@ -199,13 +196,9 @@ 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());
@ -352,6 +345,7 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
/** /**
* 执行检修任务 * 执行检修任务
*
* @param accessTaskDTO * @param accessTaskDTO
* @return * @return
*/ */
@ -377,6 +371,7 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
/** /**
* 获取安全检查定期检修项统计 * 获取安全检查定期检修项统计
*
* @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
@ -420,8 +431,7 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
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);
@ -435,6 +445,7 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
/** /**
* 根据检修任务完成缺陷处理流程 * 根据检修任务完成缺陷处理流程
*
* @param accessTaskEntity * @param accessTaskEntity
*/ */
private void finishDefectFlow(OperAccessTaskEntity accessTaskEntity) { private void finishDefectFlow(OperAccessTaskEntity accessTaskEntity) {
@ -445,10 +456,7 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
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())
.last("limit 1;")
);
if (ObjectUtil.isNotEmpty(operDefectEntity)) { 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);
@ -482,6 +490,7 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
/** /**
* 巡检任务生成后待办消息提示 * 巡检任务生成后待办消息提示
*
* @param req * @param req
*/ */
private void pushHandleMessage(OperAccessTaskDTO operAccessTaskDTO, PushExtrasReq req) { private void pushHandleMessage(OperAccessTaskDTO operAccessTaskDTO, PushExtrasReq req) {

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

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

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() + "'");

77
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,

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