Browse Source

巡检-日常-检修-消缺统计代码上传

zhongwei
tyty 1 year ago
parent
commit
895c450b9e
  1. 4
      hzims-service-api/common-api/pom.xml
  2. 39
      hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/VoteChartVo.java
  3. 11
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperDefectStatisticsVO.java
  4. 8
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/dto/OperMaintenanceTaskDTO.java
  5. 45
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/CheckVoteChartVo.java
  6. 7
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/dto/TaskDTO.java
  7. 68
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java
  8. 7
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/ITaskService.java
  9. 65
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java
  10. 6
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskListQuery.java
  11. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessStatisticsController.java
  12. 51
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessTaskController.java
  13. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessStatisticsDTO.java
  14. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml
  15. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessTaskService.java
  16. 64
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java
  17. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java
  18. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java
  19. 50
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperPhenomenonController.java
  20. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperPhenomenonService.java
  21. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectStatisticsServiceImpl.java
  22. 72
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperPhenomenonServiceImpl.java
  23. 67
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceTaskController.java
  24. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceTaskService.java
  25. 73
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java

4
hzims-service-api/common-api/pom.xml

@ -22,6 +22,10 @@
<dependencies> <dependencies>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

39
hzims-service-api/common-api/src/main/java/com/hnac/hzims/vo/VoteChartVo.java

@ -0,0 +1,39 @@
package com.hnac.hzims.vo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author hx
*/
@Data
@ApiModel("各个票种统计表")
public class VoteChartVo {
@ApiModelProperty(value = "站点名称")
@ExcelProperty(value = "站点名称", index = 0)
private String name;
@ApiModelProperty(value = "总数量")
@ExcelProperty(value = "总数量", index = 1)
private int sumNum;
@ApiModelProperty(value = "总数量id")
@ExcelIgnore
private List<Long> sumIds;
@ApiModelProperty(value = "未完成数量")
@ExcelProperty(value = "未完成数量", index = 2)
private int undoneNum;
@ApiModelProperty(value = "未完成id")
@ExcelIgnore
private List<Long> undoneIds;
@ApiModelProperty(value = "完成数量")
@ExcelProperty(value = "完成数量", index = 3)
private int finishNum;
@ApiModelProperty(value = "完成id")
@ExcelIgnore
private List<Long> finishIds;
}

11
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperDefectStatisticsVO.java

@ -1,13 +1,14 @@
package com.hnac.hzims.operational.defect.vo; package com.hnac.hzims.operational.defect.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.hnac.hzims.operational.defect.entity.OperDefectStatisticsEntity;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import com.hnac.hzims.operational.defect.entity.OperDefectStatisticsEntity;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* 模型VO * 模型VO
@ -22,7 +23,8 @@ public class OperDefectStatisticsVO extends OperDefectStatisticsEntity {
@ApiModelProperty(value = "问题发现人名称") @ApiModelProperty(value = "问题发现人名称")
private String finderName; private String finderName;
@ApiModelProperty(value = "现象Ids")
private List<String> defectCodeList;
@ApiModelProperty(value = "甄别人名称") @ApiModelProperty(value = "甄别人名称")
private String discriminatorName; private String discriminatorName;
@ -69,4 +71,9 @@ public class OperDefectStatisticsVO extends OperDefectStatisticsEntity {
) )
@ApiModelProperty(value = "定论时间范围-最晚") @ApiModelProperty(value = "定论时间范围-最晚")
private Date createEndTime; private Date createEndTime;
@ApiModelProperty("当前页")
private Integer current;
@ApiModelProperty("每页的数量")
private Integer size;
} }

8
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/dto/OperMaintenanceTaskDTO.java

@ -1,6 +1,5 @@
package com.hnac.hzims.operational.maintenance.dto; package com.hnac.hzims.operational.maintenance.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -24,6 +23,8 @@ public class OperMaintenanceTaskDTO extends OperMaintenanceTaskEntity {
@ApiModelProperty("任务Id 多个按逗号分隔") @ApiModelProperty("任务Id 多个按逗号分隔")
private String taskIds; private String taskIds;
@ApiModelProperty("任务Id 多个按逗号分隔")
private List<Long> taskList;
@ApiModelProperty("任务Id 多个按逗号分隔") @ApiModelProperty("任务Id 多个按逗号分隔")
private List<Long> deptIds; private List<Long> deptIds;
@ -33,4 +34,9 @@ public class OperMaintenanceTaskDTO extends OperMaintenanceTaskEntity {
@ApiModelProperty("结束时间") @ApiModelProperty("结束时间")
private String endTime; private String endTime;
@ApiModelProperty("当前页")
private Integer current;
@ApiModelProperty("每页的数量")
private Integer size;
} }

45
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/CheckVoteChartVo.java

@ -0,0 +1,45 @@
package com.hnac.hzims.operational.report.vo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author hx
*/
@Data
@ApiModel("缺陷统计表")
public class CheckVoteChartVo {
@ApiModelProperty(value = "站点名称")
@ExcelProperty(value = "站点名称", index = 0)
private String name;
@ApiModelProperty(value = "现象数量")
@ExcelProperty(value = "现象数量", index = 1)
private int phenomenonNum;
@ApiModelProperty(value = "现象数量id")
@ExcelIgnore
private List<Long> phenomenonIds;
@ApiModelProperty(value = "缺陷数量")
@ExcelProperty(value = "缺陷数量", index = 2)
private int defectNum;
@ApiModelProperty(value = "缺陷code")
@ExcelIgnore
private List<String> defectIds;
@ApiModelProperty(value = "处理数量")
@ExcelProperty(value = "处理数量", index = 3)
private int handleNum;
@ApiModelProperty(value = "处理code")
@ExcelIgnore
private List<String> handleIds;
@ApiModelProperty(value = "定论数量")
@ExcelProperty(value = "定论数量", index = 4)
private int conclusionNum;
@ApiModelProperty(value = "定论code")
@ExcelIgnore
private List<String> conclusionIds;
}

7
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/dto/TaskDTO.java

@ -11,6 +11,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
/** /**
* @ClassName TaskDTO * @ClassName TaskDTO
@ -34,4 +35,10 @@ public class TaskDTO extends TaskEntity implements Serializable {
@ApiModelProperty(value = "任务计划开始时间-止") @ApiModelProperty(value = "任务计划开始时间-止")
private LocalDateTime planStartTimeEnd; private LocalDateTime planStartTimeEnd;
@ApiModelProperty(value = "id集合")
private List<Long> ids;
@ApiModelProperty("当前页")
private Integer current;
@ApiModelProperty("每页的数量")
private Integer size;
} }

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

@ -1,16 +1,15 @@
package com.hnac.hzinfo.inspect.task.controller; package com.hnac.hzinfo.inspect.task.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.alibaba.excel.EasyExcel;
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.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.hzims.common.logs.annotation.OperationAnnotation; import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType; import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType; import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.vo.VoteChartVo;
import com.hnac.hzinfo.core.push.enums.PushAudienceType; import com.hnac.hzinfo.core.push.enums.PushAudienceType;
import com.hnac.hzinfo.core.push.model.PushAudience; import com.hnac.hzinfo.core.push.model.PushAudience;
import com.hnac.hzinfo.core.push.model.PushInfo; import com.hnac.hzinfo.core.push.model.PushInfo;
@ -31,14 +30,14 @@ import com.hnac.hzinfo.inspect.utils.Condition;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.cache.utils.CacheUtil; import org.springblade.core.log.exception.ServiceException;
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.secure.annotation.PreAuth; import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.resource.feign.IPushClient; import org.springblade.resource.feign.IPushClient;
import org.springblade.resource.vo.PushInfoVO; import org.springblade.resource.vo.PushInfoVO;
import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.cache.UserCache;
@ -46,7 +45,13 @@ import org.springblade.system.user.entity.User;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.*; import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
@ -104,26 +109,29 @@ public class TaskController extends BladeController {
return R.data(detail); return R.data(detail);
} }
@GetMapping("/listPage") @PostMapping("/listPage")
@ApiOperation(value = "巡检任务分页查询-站长级", notes = "传入task") @ApiOperation(value = "巡检任务分页查询-站长级", notes = "传入task")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
public R<IPage<TaskVo>> listPage(TaskDTO taskDTO, Query query) { public R<IPage<TaskVo>> listPage(@RequestBody TaskDTO taskDTO) {
return R.data(taskService.page(taskDTO,query)); return R.data(taskService.page(taskDTO));
} }
/** /**
* PC端分页显示任务列表 * PC端分页显示任务列表
*/ */
@GetMapping("/list") @PostMapping("/list")
@ApiOperation(value = "分页显示任务列表", notes = "传入task") @ApiOperation(value = "分页显示任务列表", notes = "传入task")
@OperationAnnotation(moduleName = "巡检管理",title = "我的巡检任务",operatorType = OperatorType.MOBILE,businessType = @OperationAnnotation(moduleName = "巡检管理",title = "我的巡检任务",operatorType = OperatorType.MOBILE,businessType =
BusinessType.GENCODE, BusinessType.GENCODE,
action = "分页显示任务列表") action = "分页显示任务列表")
public R<BladePage<TaskVo>> list(TaskListQuery task, Query query) { public R<BladePage<TaskVo>> list(@RequestBody TaskListQuery task) {
//CacheUtil.put("test#2","inspect","test","12"); //CacheUtil.put("test#2","inspect","test","12");
// LambdaQueryWrapper<TaskEntity> queryWrapper = Condition.getQueryWrapper(new TaskEntity(),task); // LambdaQueryWrapper<TaskEntity> queryWrapper = Condition.getQueryWrapper(new TaskEntity(),task);
// queryWrapper.orderByDesc(TaskEntity::getUpdateTime); // queryWrapper.orderByDesc(TaskEntity::getUpdateTime);
// IPage<TaskEntity> pages = taskService.page(Condition.getPage(query), queryWrapper); // IPage<TaskEntity> pages = taskService.page(Condition.getPage(query), queryWrapper);
Query query = new Query();
query.setSize(task.getSize());
query.setCurrent(task.getCurrent());
IPage<TaskVo> pages = Condition.getPage(query); IPage<TaskVo> pages = Condition.getPage(query);
if(!AuthUtil.isAdministrator()){ if(!AuthUtil.isAdministrator()){
task.setCurUserId(AuthUtil.getUserId()); task.setCurUserId(AuthUtil.getUserId());
@ -370,5 +378,43 @@ public class TaskController extends BladeController {
return R.data(pageList); return R.data(pageList);
} }
/**
* 巡检计划统计
*/
@GetMapping("/getTaskListStatistics")
@ApiOperation(value = "巡检计划统计", notes = "传入计划id")
public R<List<VoteChartVo>> getTaskListStatistics(String startTime,String endTime,Long deptId) {
if(ObjectUtil.isEmpty(AuthUtil.getUser())||ObjectUtil.isEmpty(AuthUtil.getUser().getUserId())){
return R.fail("暂无权限查看,请稍后重试");
}
List<VoteChartVo> list=taskService.getTaskListStatistics(startTime,endTime,deptId);
return R.data(list);
}
/**
* 巡检计划统计
*/
@GetMapping("/importTaskListStatistics")
@ApiOperation(value = "导出", notes = "传入计划id")
public void importTaskListStatistics(HttpServletResponse response, String startTime, String endTime,Long deptId) {
if(ObjectUtil.isEmpty(AuthUtil.getUser())||ObjectUtil.isEmpty(AuthUtil.getUser().getUserId())){
throw new ServiceException ("暂无权限查看,请稍后重试");
}
List<VoteChartVo> list=taskService.getTaskListStatistics(startTime,endTime,deptId);
// 下载导出
String filename = "(" + startTime+"-"+endTime + ")巡检统计表";
// 设置头信息
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-excel");
try {
//设置xlsx格式
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename + ".xlsx", "UTF-8"));
//创建一个输出流
EasyExcel.write(response.getOutputStream(), VoteChartVo.class).autoCloseStream(Boolean.TRUE).sheet(1,"巡检计划统计表")
.doWrite(list);
response.getOutputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
} }

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

@ -3,15 +3,14 @@ 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.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.vo.SafeCheckStatisticVO; import com.hnac.hzims.vo.SafeCheckStatisticVO;
import com.hnac.hzims.vo.VoteChartVo;
import com.hnac.hzinfo.inspect.task.dto.TaskDTO; import com.hnac.hzinfo.inspect.task.dto.TaskDTO;
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.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -65,7 +64,7 @@ public interface ITaskService extends BaseService<TaskEntity> {
*/ */
List<TaskObjectVO> getTaskById(Long id); List<TaskObjectVO> getTaskById(Long id);
IPage<TaskVo> page(TaskDTO taskDTO, Query query); IPage<TaskVo> page(TaskDTO taskDTO);
/** /**
* PC端任务列表 * PC端任务列表
@ -189,4 +188,6 @@ public interface ITaskService extends BaseService<TaskEntity> {
* @return * @return
*/ */
BladePage<TaskVo> selectPage(Page<TaskEntity> pageInfo, TaskListQuery task); BladePage<TaskVo> selectPage(Page<TaskEntity> pageInfo, TaskListQuery task);
List<VoteChartVo> getTaskListStatistics(String startTime, String endTime,Long deptId);
} }

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

@ -14,6 +14,7 @@ import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.safeproduct.entity.ImsMonCameraInfoEntity; import com.hnac.hzims.safeproduct.entity.ImsMonCameraInfoEntity;
import com.hnac.hzims.safeproduct.feign.IImsMonCameraInfoClient; import com.hnac.hzims.safeproduct.feign.IImsMonCameraInfoClient;
import com.hnac.hzims.vo.SafeCheckStatisticVO; import com.hnac.hzims.vo.SafeCheckStatisticVO;
import com.hnac.hzims.vo.VoteChartVo;
import com.hnac.hzinfo.inspect.ai.service.IRobotService; import com.hnac.hzinfo.inspect.ai.service.IRobotService;
import com.hnac.hzinfo.inspect.obj.ObjContants; import com.hnac.hzinfo.inspect.obj.ObjContants;
import com.hnac.hzinfo.inspect.obj.services.IObjectDangerService; import com.hnac.hzinfo.inspect.obj.services.IObjectDangerService;
@ -44,6 +45,7 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.jackson.JsonUtil; import org.springblade.core.tool.jackson.JsonUtil;
import org.springblade.core.tool.utils.*; import org.springblade.core.tool.utils.*;
import org.springblade.system.cache.DictCache; import org.springblade.system.cache.DictCache;
import org.springblade.system.entity.Dept;
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;
@ -521,13 +523,17 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
} }
@Override @Override
public IPage<TaskVo> page(TaskDTO taskDTO, Query query) { public IPage<TaskVo> page(TaskDTO taskDTO) {
Query query = new Query();
query.setSize(taskDTO.getSize());
query.setCurrent(taskDTO.getCurrent());
TaskEntity request = BeanUtil.copy(taskDTO,TaskEntity.class); TaskEntity request = BeanUtil.copy(taskDTO,TaskEntity.class);
LambdaQueryWrapper<TaskEntity> queryWrapper = Condition.getQueryWrapper(TaskEntity.class,request); LambdaQueryWrapper<TaskEntity> queryWrapper = Condition.getQueryWrapper(TaskEntity.class,request);
queryWrapper.ge(Func.isNotEmpty(taskDTO.getPlanStartTime()),TaskEntity::getPlanStartTime,taskDTO.getPlanStartTime()); queryWrapper.ge(Func.isNotEmpty(taskDTO.getPlanStartTime()),TaskEntity::getPlanStartTime,taskDTO.getPlanStartTime());
queryWrapper.le(Func.isNotEmpty(taskDTO.getPlanStartTimeEnd()),TaskEntity::getPlanStartTime,taskDTO.getPlanStartTimeEnd()); queryWrapper.le(Func.isNotEmpty(taskDTO.getPlanStartTimeEnd()),TaskEntity::getPlanStartTime,taskDTO.getPlanStartTimeEnd());
queryWrapper.eq(Func.isNotEmpty(taskDTO.getCreateDept()),TaskEntity::getCreateDept,taskDTO.getCreateDept()); queryWrapper.eq(Func.isNotEmpty(taskDTO.getCreateDept()),TaskEntity::getCreateDept,taskDTO.getCreateDept());
queryWrapper.eq(Func.isNotEmpty(taskDTO.getStatus()),TaskEntity::getStatus,taskDTO.getStatus()); queryWrapper.eq(Func.isNotEmpty(taskDTO.getStatus()),TaskEntity::getStatus,taskDTO.getStatus());
queryWrapper.in(Func.isNotEmpty(taskDTO.getIds()),TaskEntity::getId,taskDTO.getIds());
queryWrapper.orderByDesc(TaskEntity::getCreateTime); queryWrapper.orderByDesc(TaskEntity::getCreateTime);
IPage page = this.page(Condition.getPage(query), queryWrapper); IPage page = this.page(Condition.getPage(query), queryWrapper);
List<TaskEntity> records = page.getRecords(); List<TaskEntity> records = page.getRecords();
@ -954,6 +960,49 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
} }
@Override
public List<VoteChartVo> getTaskListStatistics(String startTime, String endTime,Long deptId) {
List<TaskEntity> taskEntities=new ArrayList<>();
R<List<Dept>> deptByCurrentUser = sysClient.getDeptByCurrentUser();
List<Long> deptIds;
if (deptByCurrentUser.isSuccess() && CollectionUtil.isNotEmpty(deptByCurrentUser.getData())) {
deptIds = deptByCurrentUser.getData().stream().map(s -> s.getId()).collect(Collectors.toList());
} else {
throw new ServiceException("暂无机构权限");
}
QueryWrapper<TaskEntity> queryWrapper = new QueryWrapper<>();
if (ObjectUtil.isNotEmpty(deptId)) {
if (deptIds.contains(deptId)) {
queryWrapper.in(ObjectUtils.isNotNull(deptIds), "CREATE_DEPT", deptId);
} else {
throw new ServiceException("暂无该机构权限");
}
} else {
queryWrapper.in(ObjectUtils.isNotNull(deptIds), "CREATE_DEPT", deptIds);
}
queryWrapper.ge(ObjectUtils.isNotNull(startTime), "CREATE_TIME",startTime);
queryWrapper.le(ObjectUtils.isNotNull(endTime), "CREATE_TIME",endTime);
taskEntities= baseMapper.selectList(queryWrapper);
List<VoteChartVo> res=new ArrayList<>();
if (CollectionUtil.isNotEmpty(taskEntities)) {
VoteChartVo all = getVoteChartVo(taskEntities);
all.setName("总计");
res.add(all);
Map<Long, List<TaskEntity>> collect = Optional.ofNullable(taskEntities).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(TaskEntity::getCreateDept));
for (Map.Entry<Long, List<TaskEntity>> longListEntry : collect.entrySet()) {
VoteChartVo voteChartVo = getVoteChartVo(longListEntry.getValue());
R<String> deptName = sysClient.getDeptName(longListEntry.getKey());
voteChartVo.setName(deptName.isSuccess() ? deptName.getData() : "");
res.add(voteChartVo);
}
}else {
VoteChartVo all = new VoteChartVo();
all.setName("总计");
res.add(all);
}
return res;
}
/** /**
* 巡检任务分页 * 巡检任务分页
* *
@ -1018,4 +1067,18 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
} }
return null; return null;
} }
private VoteChartVo getVoteChartVo(List<TaskEntity> list) {
VoteChartVo voteChartVo = new VoteChartVo();
List<Long> finishIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getStatus() == 3).map(s -> s.getId()).collect(Collectors.toList());
List<Long> undoneIds =Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getStatus() != 3).map(s -> s.getId()).collect(Collectors.toList());
voteChartVo.setSumNum(list.size());
voteChartVo.setSumIds(list.stream().map(s -> s.getId()).collect(Collectors.toList()));
voteChartVo.setFinishNum(finishIds.size());
voteChartVo.setFinishIds(finishIds);
voteChartVo.setUndoneNum(undoneIds.size());
voteChartVo.setUndoneIds(undoneIds);
return voteChartVo;
}
} }

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

@ -8,7 +8,6 @@ import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.YearMonth; import java.time.YearMonth;
@ -130,4 +129,9 @@ public class TaskListQuery implements Serializable {
* 创建机构 * 创建机构
*/ */
private Long createDept; private Long createDept;
@ApiModelProperty("当前页")
private Integer current;
@ApiModelProperty("每页的数量")
private Integer size;
} }

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessStatisticsController.java

@ -20,7 +20,6 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
/** /**
@ -87,7 +86,7 @@ public class OperAccessStatisticsController extends BladeController {
@OperationAnnotation(moduleName = "检修管理",title = "检修记录",operatorType = OperatorType.MOBILE,businessType = @OperationAnnotation(moduleName = "检修管理",title = "检修记录",operatorType = OperatorType.MOBILE,businessType =
BusinessType.GENCODE, BusinessType.GENCODE,
action = "分页查询检修记录列表") action = "分页查询检修记录列表")
public R<IPage<OperAccessStatisticsVO>> list(OperAccessStatisticsDTO req, Query query) { public R<IPage<OperAccessStatisticsVO>> list(@RequestBody OperAccessStatisticsDTO req, Query query) {
return service.list(req, Condition.getPage(query)); return service.list(req, Condition.getPage(query));
} }

51
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessTaskController.java

@ -1,5 +1,6 @@
package com.hnac.hzims.operational.access.controller; package com.hnac.hzims.operational.access.controller;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation; import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
@ -10,18 +11,25 @@ import com.hnac.hzims.operational.access.dto.OperAccessTaskFlowDTO;
import com.hnac.hzims.operational.access.service.IOperAccessTaskService; import com.hnac.hzims.operational.access.service.IOperAccessTaskService;
import com.hnac.hzims.operational.access.vo.OperAccessTaskVO; import com.hnac.hzims.operational.access.vo.OperAccessTaskVO;
import com.hnac.hzims.operational.access.vo.RepairBillVO; import com.hnac.hzims.operational.access.vo.RepairBillVO;
import com.hnac.hzims.vo.VoteChartVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.annotation.ApiLog; import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
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.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.List; import java.util.List;
/** /**
@ -104,4 +112,47 @@ public class OperAccessTaskController extends BladeController {
public R<List<RepairBillVO>> getAccessTaskByEmCode(String emCode, String startTime, String endTime) { public R<List<RepairBillVO>> getAccessTaskByEmCode(String emCode, String startTime, String endTime) {
return R.data(service.getRepairBill(emCode, startTime, endTime)); return R.data(service.getRepairBill(emCode, startTime, endTime));
} }
/**
* 检修计划统计
*/
@GetMapping("/getAccessListStatistics")
@ApiOperation(value = "检修计划统计", notes = "传入时间")
public R<List<VoteChartVo>> getAccessListStatistics(String startTime, String endTime,Long deptId) {
if(ObjectUtil.isEmpty(AuthUtil.getUser())||ObjectUtil.isEmpty(AuthUtil.getUser().getUserId())){
return R.fail("暂无权限查看,请稍后重试");
}
List<VoteChartVo> list=service.getAccessListStatistics(startTime,endTime,deptId);
return R.data(list);
}
/**
* 检修计划统计
*/
@GetMapping("/importAccessListStatistics")
@ApiOperation(value = "导出", notes = "传入时间")
public void importAccessListStatistics(HttpServletResponse response, String startTime, String endTime,Long deptId) {
if(ObjectUtil.isEmpty(AuthUtil.getUser())||ObjectUtil.isEmpty(AuthUtil.getUser().getUserId())){
throw new ServiceException("暂无权限查看,请稍后重试");
}
List<VoteChartVo> list=service.getAccessListStatistics(startTime,endTime,deptId);
// 下载导出
String filename = "(" + startTime+"-"+endTime + ")检修计划统计表";
// 设置头信息
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-excel");
try {
//设置xlsx格式
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename + ".xlsx", "UTF-8"));
//创建一个输出流
EasyExcel.write(response.getOutputStream(), VoteChartVo.class).autoCloseStream(Boolean.TRUE).sheet(1,"检修计划统计表")
.doWrite(list);
response.getOutputStream().close();
// 关闭
response.getOutputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
} }

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

@ -25,7 +25,8 @@ public class OperAccessStatisticsDTO extends OperAccessStatisticsEntity {
@ApiModelProperty(value = "创建机构集合") @ApiModelProperty(value = "创建机构集合")
private List<Long> deptIds; private List<Long> deptIds;
@ApiModelProperty(value = "id集合")
private List<Long> ids;
/** /**
* 月份 * 月份
*/ */

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

@ -28,6 +28,12 @@
JOIN hzims_oper_access_task OT JOIN hzims_oper_access_task OT
ON OS.`TASK_ID` = OT.`ID` ON OS.`TASK_ID` = OT.`ID`
WHERE OS.IS_DELETED = 0 WHERE OS.IS_DELETED = 0
<if test="dto.ids != null">
and OS.id in
<foreach collection="dto.ids" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="dto.taskName != null"> <if test="dto.taskName != null">
and OT.`NAME` like concat('%',#{dto.taskName},'%') and OT.`NAME` like concat('%',#{dto.taskName},'%')
</if> </if>

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

@ -2,14 +2,13 @@ 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.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.access.vo.RepairBillVO; import com.hnac.hzims.operational.access.vo.RepairBillVO;
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;
import com.hnac.hzims.vo.VoteChartVo;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
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;
@ -76,4 +75,6 @@ public interface IOperAccessTaskService extends BaseService<OperAccessTaskEntity
IPage<OperAccessTaskEntity> selectPage(Page<OperAccessTaskEntity> dbPage, OperAccessTaskEntity result); IPage<OperAccessTaskEntity> selectPage(Page<OperAccessTaskEntity> dbPage, OperAccessTaskEntity result);
List<RepairBillVO> getRepairBill(String emCode, String startTime, String endTime); List<RepairBillVO> getRepairBill(String emCode, String startTime, String endTime);
List<VoteChartVo> getAccessListStatistics(String startTime, String endTime,Long deptId);
} }

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

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.ObjectUtils;
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.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.entity.EmInfoEntity;
@ -39,6 +40,7 @@ import com.hnac.hzims.safeproduct.feign.IDangerSourceClient;
import com.hnac.hzims.spare.entity.SpRecordEntity; import com.hnac.hzims.spare.entity.SpRecordEntity;
import com.hnac.hzims.spare.feign.ISpareClient; import com.hnac.hzims.spare.feign.ISpareClient;
import com.hnac.hzims.vo.SafeCheckStatisticVO; import com.hnac.hzims.vo.SafeCheckStatisticVO;
import com.hnac.hzims.vo.VoteChartVo;
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;
@ -55,6 +57,8 @@ import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.flow.core.utils.FlowUtil; import org.springblade.flow.core.utils.FlowUtil;
import org.springblade.flow.core.utils.TaskUtil; import org.springblade.flow.core.utils.TaskUtil;
import org.springblade.flow.core.vo.ComleteTask; import org.springblade.flow.core.vo.ComleteTask;
import org.springblade.system.entity.Dept;
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.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
@ -86,6 +90,8 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
private final IMessagePushClient messagePushClient; private final IMessagePushClient messagePushClient;
private final OperPhenomenonMapper operPhenomenonMapper; private final OperPhenomenonMapper operPhenomenonMapper;
private final IUserClient userClient; private final IUserClient userClient;
private final ISysClient sysClient;
private final ISpareClient assetsClient; private final ISpareClient assetsClient;
private final IOperAccessMaterialService materialService; private final IOperAccessMaterialService materialService;
private final IOperDefectService defectService; private final IOperDefectService defectService;
@ -419,6 +425,64 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
return repairBillList; return repairBillList;
} }
@Override
public List<VoteChartVo> getAccessListStatistics(String startTime, String endTime,Long deptId) {
List<OperAccessTaskEntity> operAccessTaskEntityList;
R<List<Dept>> deptByCurrentUser = sysClient.getDeptByCurrentUser();
List<Long> deptIds;
if (deptByCurrentUser.isSuccess()&&CollectionUtil.isNotEmpty(deptByCurrentUser.getData())) {
deptIds = deptByCurrentUser.getData().stream().map(s -> s.getId()).collect(Collectors.toList());
}else {
throw new ServiceException("暂无机构权限");
}
QueryWrapper<OperAccessTaskEntity> queryWrapper = new QueryWrapper<>();
if (ObjectUtil.isNotEmpty(deptId)){
if (deptIds.contains(deptId)) {
queryWrapper.in(ObjectUtils.isNotNull(deptIds), "CREATE_DEPT", deptId);
}else {
throw new ServiceException("暂无该机构权限");
}
}else {
queryWrapper.in(ObjectUtils.isNotNull(deptIds), "CREATE_DEPT", deptIds);
}
queryWrapper.ge(ObjectUtils.isNotNull(startTime), "CREATE_TIME",startTime);
queryWrapper.le(ObjectUtils.isNotNull(endTime), "CREATE_TIME",endTime);
operAccessTaskEntityList= baseMapper.selectList(queryWrapper);
List<VoteChartVo> res=new ArrayList<>();
if (CollectionUtil.isNotEmpty(operAccessTaskEntityList)) {
VoteChartVo all = getVoteChartVo(operAccessTaskEntityList);
all.setName("总计");
res.add(all);
Map<Long, List<OperAccessTaskEntity>> collect = Optional.ofNullable(operAccessTaskEntityList).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(OperAccessTaskEntity::getCreateDept));
for (Map.Entry<Long, List<OperAccessTaskEntity>> longListEntry : collect.entrySet()) {
VoteChartVo voteChartVo = getVoteChartVo(longListEntry.getValue());
R<String> deptName = sysClient.getDeptName(longListEntry.getKey());
voteChartVo.setName(deptName.isSuccess() ? deptName.getData() : "");
res.add(voteChartVo);
}
}else {
VoteChartVo all = new VoteChartVo();
all.setName("总计");
res.add(all);
}
return res;
}
private VoteChartVo getVoteChartVo(List<OperAccessTaskEntity> list) {
VoteChartVo voteChartVo = new VoteChartVo();
List<Long> finishIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getStatus() == 4).map(s -> s.getId()).collect(Collectors.toList());
List<Long> undoneIds =Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getStatus() != 4).map(s -> s.getId()).collect(Collectors.toList());
voteChartVo.setSumNum(list.size());
voteChartVo.setSumIds(list.stream().map(s -> s.getId()).collect(Collectors.toList()));
voteChartVo.setFinishNum(finishIds.size());
voteChartVo.setFinishIds(finishIds);
voteChartVo.setUndoneNum(undoneIds.size());
voteChartVo.setUndoneIds(undoneIds);
return voteChartVo;
}
/*** /***
* 根据流程ID和处理人完成任务 * 根据流程ID和处理人完成任务
* @param comleteTask * @param comleteTask

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java

@ -730,7 +730,9 @@ public class TargetServiceImpl implements TargetService {
} }
// 查询日常维护任务 // 查询日常维护任务
params.setDeptIds(areas.keySet().stream().map(Dept::getId).collect(Collectors.toList())); params.setDeptIds(areas.keySet().stream().map(Dept::getId).collect(Collectors.toList()));
return maintenanceTaskService.list(params,query); params.setCurrent(query.getCurrent());
params.setSize(query.getSize());
return maintenanceTaskService.list(params);
} }
/** /**

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java

@ -25,10 +25,7 @@ import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.entity.Dept; import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient; import org.springblade.system.feign.ISysClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -64,14 +61,17 @@ public class OperDefectStatisticsController extends BladeController {
* 分页 代码自定义代号 * 分页 代码自定义代号
*/ */
@ApiLog @ApiLog
@GetMapping("/list") @PostMapping("/list")
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入statistics") @ApiOperation(value = "分页", notes = "传入statistics")
@ApiImplicitParams({ @ApiImplicitParams({
}) })
@OperationAnnotation(moduleName = "缺陷管理",title = "缺陷记录",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE,action @OperationAnnotation(moduleName = "缺陷管理",title = "缺陷记录",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE,action
= "分页查询缺陷记录列表") = "分页查询缺陷记录列表")
public R<IPage<OperDefectStatisticsVO>> list( OperDefectStatisticsVO entity, Query query) { public R<IPage<OperDefectStatisticsVO>> list(@RequestBody OperDefectStatisticsVO entity) {
Query query=new Query();
query.setCurrent(entity.getCurrent());
query.setSize(entity.getSize());
LambdaQueryWrapper<OperDefectStatisticsEntity> queryWrapper = statisticsService.getQueryWrapper(entity); LambdaQueryWrapper<OperDefectStatisticsEntity> queryWrapper = statisticsService.getQueryWrapper(entity);
IPage<OperDefectStatisticsEntity> pages = statisticsService.page(Condition.getPage(query), queryWrapper); IPage<OperDefectStatisticsEntity> pages = statisticsService.page(Condition.getPage(query), queryWrapper);
IPage<OperDefectStatisticsVO> vos = OperDefectStatisticsWrapper.build().pageVO(pages); IPage<OperDefectStatisticsVO> vos = OperDefectStatisticsWrapper.build().pageVO(pages);

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

@ -1,5 +1,6 @@
package com.hnac.hzims.operational.defect.controller; package com.hnac.hzims.operational.defect.controller;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
@ -12,6 +13,7 @@ import com.hnac.hzims.operational.defect.entity.OperAppearanceEntity;
import com.hnac.hzims.operational.defect.service.IOperAppearanceService; import com.hnac.hzims.operational.defect.service.IOperAppearanceService;
import com.hnac.hzims.operational.defect.service.IOperPhenomenonService; import com.hnac.hzims.operational.defect.service.IOperPhenomenonService;
import com.hnac.hzims.operational.defect.vo.OperAppearanceVO; import com.hnac.hzims.operational.defect.vo.OperAppearanceVO;
import com.hnac.hzims.operational.report.vo.CheckVoteChartVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -19,14 +21,22 @@ import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.annotation.ApiLog; import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
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.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.flow.core.entity.BladeFlow; import org.springblade.flow.core.entity.BladeFlow;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.List;
/** /**
* 控制器 * 控制器
* *
@ -131,4 +141,44 @@ public class OperPhenomenonController extends BladeController {
public R<FdpTaskEntity> getFdpTaskByDefectCode(@RequestParam("defectCode") String defectCode) { public R<FdpTaskEntity> getFdpTaskByDefectCode(@RequestParam("defectCode") String defectCode) {
return R.data(phenomenonService.getFdpTaskByDefectCode(defectCode)); return R.data(phenomenonService.getFdpTaskByDefectCode(defectCode));
} }
/**
* 缺陷记录统计
*/
@GetMapping("/getDefectListStatistics")
@ApiOperation(value = "缺陷记录统计", notes = "传入时间")
public R<List<CheckVoteChartVo>> getDefectListStatistics(String startTime, String endTime, Long deptId) {
if(ObjectUtil.isEmpty(AuthUtil.getUser())||ObjectUtil.isEmpty(AuthUtil.getUser().getUserId())){
return R.fail("暂无权限查看,请稍后重试");
}
List<CheckVoteChartVo> list=phenomenonService.getDefectListStatistics(startTime,endTime,deptId);
return R.data(list);
}
/**
* 缺陷记录统计
*/
@GetMapping("/importDefectListStatistics")
@ApiOperation(value = "导出", notes = "传入时间")
public void importDefectListStatistics(HttpServletResponse response, String startTime, String endTime, Long deptId) {
if(ObjectUtil.isEmpty(AuthUtil.getUser())||ObjectUtil.isEmpty(AuthUtil.getUser().getUserId())){
throw new ServiceException ("暂无权限查看,请稍后重试");
}
List<CheckVoteChartVo> list=phenomenonService.getDefectListStatistics(startTime,endTime,deptId);
// 下载导出
String filename = "(" + startTime+"-"+endTime + ")缺陷统计表";
// 设置头信息
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-excel");
try {
//设置xlsx格式
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename + ".xlsx", "UTF-8"));
//创建一个输出流
EasyExcel.write(response.getOutputStream(), CheckVoteChartVo.class).autoCloseStream(Boolean.TRUE).sheet(1,"缺陷统计表")
.doWrite(list);
response.getOutputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
} }

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperPhenomenonService.java

@ -4,14 +4,12 @@ import com.hnac.hzims.fdp.entity.FdpTaskEntity;
import com.hnac.hzims.operational.defect.dto.OperMainDefectDTO; import com.hnac.hzims.operational.defect.dto.OperMainDefectDTO;
import com.hnac.hzims.operational.defect.dto.OperPhenomenonDTO; import com.hnac.hzims.operational.defect.dto.OperPhenomenonDTO;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.vo.OperPhenomenonVO;
import com.hnac.hzims.operational.duty.vo.MainOperPhenomenonVo; import com.hnac.hzims.operational.duty.vo.MainOperPhenomenonVo;
import com.hnac.hzims.operational.report.vo.CheckVoteChartVo;
import com.hnac.hzims.operational.report.vo.DutyDefectVO; import com.hnac.hzims.operational.report.vo.DutyDefectVO;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R;
import org.springblade.flow.core.entity.BladeFlow; import org.springblade.flow.core.entity.BladeFlow;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -95,4 +93,6 @@ public interface IOperPhenomenonService extends BaseService<OperPhenomenonEntity
* @return * @return
*/ */
boolean updatePhenomenonHandleStatus(OperPhenomenonEntity phenomenon); boolean updatePhenomenonHandleStatus(OperPhenomenonEntity phenomenon);
List<CheckVoteChartVo> getDefectListStatistics(String startTime, String endTime, Long deptId);
} }

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectStatisticsServiceImpl.java

@ -41,6 +41,9 @@ public class OperDefectStatisticsServiceImpl extends BaseServiceImpl<OperDefectS
public LambdaQueryWrapper<OperDefectStatisticsEntity> getQueryWrapper(OperDefectStatisticsVO statistics) { public LambdaQueryWrapper<OperDefectStatisticsEntity> getQueryWrapper(OperDefectStatisticsVO statistics) {
LambdaQueryWrapper<OperDefectStatisticsEntity> queryWrapper = Condition.getQueryWrapper(new OperDefectStatisticsEntity(),statistics); LambdaQueryWrapper<OperDefectStatisticsEntity> queryWrapper = Condition.getQueryWrapper(new OperDefectStatisticsEntity(),statistics);
if(Func.isNotEmpty(statistics)) { if(Func.isNotEmpty(statistics)) {
if (Func.isNotEmpty(statistics.getDefectCodeList())) {
queryWrapper.in(OperDefectStatisticsEntity::getDefectCode, statistics.getDefectCodeList());
}
if (statistics.getActStartTime() != null) { if (statistics.getActStartTime() != null) {
queryWrapper.ge(OperDefectStatisticsEntity::getActStartTime, statistics.getActStartTime()); queryWrapper.ge(OperDefectStatisticsEntity::getActStartTime, statistics.getActStartTime());
} }

72
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperPhenomenonServiceImpl.java

@ -3,12 +3,12 @@ package com.hnac.hzims.operational.defect.service.impl;
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.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.fdp.entity.FdpTaskEntity; import com.hnac.hzims.fdp.entity.FdpTaskEntity;
import com.hnac.hzims.fdp.feign.IFdpTaskClient; import com.hnac.hzims.fdp.feign.IFdpTaskClient;
import com.hnac.hzims.operational.defect.config.DefectConfiguration; import com.hnac.hzims.operational.defect.config.DefectConfiguration;
import com.hnac.hzims.operational.defect.constants.DefectConstant; import com.hnac.hzims.operational.defect.constants.DefectConstant;
import com.hnac.hzims.operational.defect.constants.RepairConstant;
import com.hnac.hzims.operational.defect.dto.OperMainDefectDTO; import com.hnac.hzims.operational.defect.dto.OperMainDefectDTO;
import com.hnac.hzims.operational.defect.dto.OperPhenomenonDTO; import com.hnac.hzims.operational.defect.dto.OperPhenomenonDTO;
import com.hnac.hzims.operational.defect.entity.OperDefectEntity; import com.hnac.hzims.operational.defect.entity.OperDefectEntity;
@ -20,16 +20,13 @@ import com.hnac.hzims.operational.defect.service.IOperDefectService;
import com.hnac.hzims.operational.defect.service.IOperDefectStatisticsService; import com.hnac.hzims.operational.defect.service.IOperDefectStatisticsService;
import com.hnac.hzims.operational.defect.service.IOperPhenomenonService; import com.hnac.hzims.operational.defect.service.IOperPhenomenonService;
import com.hnac.hzims.operational.defect.vo.OperPhenomenonVO; import com.hnac.hzims.operational.defect.vo.OperPhenomenonVO;
import com.hnac.hzims.operational.defect.wrapper.OperPhenomenonWrapper;
import com.hnac.hzims.operational.duty.vo.MainOperPhenomenonVo; import com.hnac.hzims.operational.duty.vo.MainOperPhenomenonVo;
import com.hnac.hzims.operational.report.vo.CheckVoteChartVo;
import com.hnac.hzims.operational.report.vo.DutyDefectVO; import com.hnac.hzims.operational.report.vo.DutyDefectVO;
import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity;
import com.hnac.hzims.operational.util.GenerateCode; import com.hnac.hzims.operational.util.GenerateCode;
import com.hnac.hzims.ticket.repair.entity.RepairEntity;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
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.redis.lock.LockType; import org.springblade.core.redis.lock.LockType;
import org.springblade.core.redis.lock.RedisLock; import org.springblade.core.redis.lock.RedisLock;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
@ -43,6 +40,8 @@ import org.springblade.flow.core.utils.FlowUtil;
import org.springblade.flow.core.utils.TaskUtil; import org.springblade.flow.core.utils.TaskUtil;
import org.springblade.flow.core.vo.ComleteTask; import org.springblade.flow.core.vo.ComleteTask;
import org.springblade.system.cache.DictCache; import org.springblade.system.cache.DictCache;
import org.springblade.system.entity.Dept;
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.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
@ -67,6 +66,8 @@ import java.util.stream.Collectors;
public class OperPhenomenonServiceImpl extends BaseServiceImpl<OperPhenomenonMapper, OperPhenomenonEntity> implements IOperPhenomenonService,GenerateCode{ public class OperPhenomenonServiceImpl extends BaseServiceImpl<OperPhenomenonMapper, OperPhenomenonEntity> implements IOperPhenomenonService,GenerateCode{
@Autowired @Autowired
private ISysClient sysClient;
@Autowired
private IFlowClient flowClient; private IFlowClient flowClient;
@Autowired @Autowired
@ -582,4 +583,65 @@ public class OperPhenomenonServiceImpl extends BaseServiceImpl<OperPhenomenonMap
.eq(OperPhenomenonEntity::getId,phenomenon.getId()) .eq(OperPhenomenonEntity::getId,phenomenon.getId())
); );
} }
@Override
public List<CheckVoteChartVo> getDefectListStatistics(String startTime, String endTime, Long deptId) {
List<OperPhenomenonEntity> operPhenomenonEntities;
R<List<Dept>> deptByCurrentUser = sysClient.getDeptByCurrentUser();
List<Long> deptIds;
if (deptByCurrentUser.isSuccess() && CollectionUtil.isNotEmpty(deptByCurrentUser.getData())) {
deptIds = deptByCurrentUser.getData().stream().map(s -> s.getId()).collect(Collectors.toList());
} else {
throw new ServiceException("暂无机构权限");
}
QueryWrapper<OperPhenomenonEntity> queryWrapper = new QueryWrapper<>();
if (ObjectUtil.isNotEmpty(deptId)) {
if (deptIds.contains(deptId)) {
queryWrapper.in(ObjectUtils.isNotNull(deptIds), "CREATE_DEPT", deptId);
} else {
throw new ServiceException("暂无该机构权限");
}
} else {
queryWrapper.in(ObjectUtils.isNotNull(deptIds), "CREATE_DEPT", deptIds);
}
queryWrapper.ge(ObjectUtils.isNotNull(startTime), "CREATE_TIME", startTime);
queryWrapper.le(ObjectUtils.isNotNull(endTime), "CREATE_TIME", endTime);
operPhenomenonEntities = baseMapper.selectList(queryWrapper);
List<CheckVoteChartVo> res = new ArrayList<>();
if (CollectionUtil.isNotEmpty(operPhenomenonEntities)) {
CheckVoteChartVo all = getCheckVoteChartVo(operPhenomenonEntities);
all.setName("总计");
res.add(all);
Map<Long, List<OperPhenomenonEntity>> collect = Optional.ofNullable(operPhenomenonEntities).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(OperPhenomenonEntity::getCreateDept));
for (Map.Entry<Long, List<OperPhenomenonEntity>> longListEntry : collect.entrySet()) {
CheckVoteChartVo chartVo= getCheckVoteChartVo(longListEntry.getValue());
R<String> deptName = sysClient.getDeptName(longListEntry.getKey());
chartVo.setName(deptName.isSuccess() ? deptName.getData() : "");
res.add(chartVo);
}
} else {
CheckVoteChartVo all = new CheckVoteChartVo();
all.setName("总计");
res.add(all);
}
return res;
}
private CheckVoteChartVo getCheckVoteChartVo(List<OperPhenomenonEntity> list) {
CheckVoteChartVo voteChartVo = new CheckVoteChartVo();
List<String> checkIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getIsDefect() !=null).filter(s -> s.getIsDefect() == 1).map(s -> s.getDefectCode()).collect(Collectors.toList());
List<String> handerIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getIsDefect() !=null).filter(s -> "1".equals(s.getHandleStatus())).map(s -> s.getDefectCode()).collect(Collectors.toList());
List<String> conclusionIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getIsDefect() !=null).filter(s -> "1".equals(s.getConclusionStatus())).map(s -> s.getDefectCode()).collect(Collectors.toList());
voteChartVo.setPhenomenonNum(list.size());
voteChartVo.setPhenomenonIds(list.stream().map(s -> s.getId()).collect(Collectors.toList()));
voteChartVo.setDefectNum(checkIds.size());
voteChartVo.setDefectIds(checkIds);
voteChartVo.setHandleNum(handerIds.size());
voteChartVo.setHandleIds(handerIds);
voteChartVo.setConclusionNum(conclusionIds.size());
voteChartVo.setConclusionIds(conclusionIds);
return voteChartVo;
}
} }

67
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceTaskController.java

@ -1,42 +1,44 @@
package com.hnac.hzims.operational.maintenance.controller; package com.hnac.hzims.operational.maintenance.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
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.common.invalid.DictInvalid; import com.hnac.hzims.common.invalid.DictInvalid;
import com.hnac.hzims.common.invalid.ObjectRequiredInvalid; import com.hnac.hzims.common.invalid.ObjectRequiredInvalid;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation; import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType; import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType; import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.operational.maintenance.constants.MaintenanceConstant;
import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO; import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.scheduled.MaintenanceTaskCreateTask; import com.hnac.hzims.operational.maintenance.scheduled.MaintenanceTaskCreateTask;
import com.hnac.hzims.operational.maintenance.scheduled.MaintenanceTaskPushMsg; import com.hnac.hzims.operational.maintenance.scheduled.MaintenanceTaskPushMsg;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService; import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO; import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo; import com.hnac.hzims.vo.VoteChartVo;
import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskVo; import io.swagger.annotations.Api;
import io.swagger.annotations.*; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.annotation.ApiLog; import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.mp.support.Query; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.flow.core.vo.ComleteTask; import org.springblade.flow.core.vo.ComleteTask;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.SortDefault;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -105,15 +107,15 @@ public class OperMaintenanceTaskController extends BladeController {
* 分页 * 分页
*/ */
@ApiLog @ApiLog
@GetMapping("/list") @PostMapping("/list")
@ApiOperationSupport(order = 50) @ApiOperationSupport(order = 50)
@ApiOperation(value = "分页 查询参数:refLibraryId,processInstanceId,disposer,content,status") @ApiOperation(value = "分页 查询参数:refLibraryId,processInstanceId,disposer,content,status")
@ApiImplicitParams({ @ApiImplicitParams({
}) })
@OperationAnnotation(moduleName = "日常维护", title = "日常维护记录", operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE, @OperationAnnotation(moduleName = "日常维护", title = "日常维护记录", operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE,
action = "分页查询日常维护记录列表") action = "分页查询日常维护记录列表")
public R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req, Query query) { public R<IPage<OperMaintenanceTaskVO>> list(@RequestBody OperMaintenanceTaskDTO req) {
return taskService.list(req, query); return taskService.list(req);
} }
@ -161,6 +163,47 @@ public class OperMaintenanceTaskController extends BladeController {
return taskService.deleteTaskBatch(taskIdList); return taskService.deleteTaskBatch(taskIdList);
} }
/**
* 日常计划统计
*/
@GetMapping("/getMaintenanceListStatistics")
@ApiOperation(value = "日常计划统计", notes = "传入时间")
public R<List<VoteChartVo>> getMaintenanceListStatistics(String startTime, String endTime,Long deptId) {
if(ObjectUtil.isEmpty(AuthUtil.getUser())||ObjectUtil.isEmpty(AuthUtil.getUser().getUserId())){
return R.fail("暂无权限查看,请稍后重试");
}
List<VoteChartVo> list=taskService.getMaintenanceListStatistics(startTime,endTime,deptId);
return R.data(list);
}
/**
* 日常计划统计
*/
@GetMapping("/importMaintenanceListStatistics")
@ApiOperation(value = "导出", notes = "传入时间")
public void importMaintenanceListStatistics(HttpServletResponse response, String startTime, String endTime,Long deptId) {
if(ObjectUtil.isEmpty(AuthUtil.getUser())||ObjectUtil.isEmpty(AuthUtil.getUser().getUserId())){
throw new ServiceException("暂无权限查看,请稍后重试");
}
List<VoteChartVo> list=taskService.getMaintenanceListStatistics(startTime,endTime,deptId);
// 下载导出
String filename = "(" + startTime+"-"+endTime + ")日常维护计划统计表";
// 设置头信息
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-excel");
try {
//设置xlsx格式
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename + ".xlsx", "UTF-8"));
//创建一个输出流
EasyExcel.write(response.getOutputStream(), VoteChartVo.class).autoCloseStream(Boolean.TRUE).sheet(1,"日常计划统计")
.doWrite(list);
response.getOutputStream().close();
// 关闭
response.getOutputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
} }

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceTaskService.java

@ -2,16 +2,16 @@ package com.hnac.hzims.operational.maintenance.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.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.operational.main.vo.RegularWorkVO;
import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO; import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO; import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO;
import com.hnac.hzims.operational.main.vo.RegularWorkVO;
import com.hnac.hzims.operational.report.vo.MaintenanceReportVO; import com.hnac.hzims.operational.report.vo.MaintenanceReportVO;
import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskVo; import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskVo;
import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskWithAreaVo; import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskWithAreaVo;
import com.hnac.hzims.vo.SafeCheckStatisticVO; import com.hnac.hzims.vo.SafeCheckStatisticVO;
import com.hnac.hzims.vo.VoteChartVo;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.flow.core.vo.ComleteTask; import org.springblade.flow.core.vo.ComleteTask;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -31,7 +31,7 @@ public interface IOperMaintenanceTaskService extends BaseService<OperMaintenance
R<OperMaintenanceTaskEntity> detail(@RequestParam Long id); R<OperMaintenanceTaskEntity> detail(@RequestParam Long id);
R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req, Query query); R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req);
String genTaskCode(Integer num); String genTaskCode(Integer num);
@ -96,4 +96,5 @@ public interface IOperMaintenanceTaskService extends BaseService<OperMaintenance
IPage<MaintenanceTaskVo> queryLogMaintenancePageList(Page<OperMaintenanceTaskEntity> pageParam, MaintenanceTaskWithAreaVo areaMonthlyVo); IPage<MaintenanceTaskVo> queryLogMaintenancePageList(Page<OperMaintenanceTaskEntity> pageParam, MaintenanceTaskWithAreaVo areaMonthlyVo);
List<VoteChartVo> getMaintenanceListStatistics(String startTime, String endTime,Long deptId);
} }

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

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
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.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.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.google.common.collect.Lists; import com.google.common.collect.Lists;
@ -25,6 +26,7 @@ import com.hnac.hzims.safeproduct.feign.IDangerSourceClient;
import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskVo; import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskVo;
import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskWithAreaVo; import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskWithAreaVo;
import com.hnac.hzims.vo.SafeCheckStatisticVO; import com.hnac.hzims.vo.SafeCheckStatisticVO;
import com.hnac.hzims.vo.VoteChartVo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
@ -40,6 +42,8 @@ import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.flow.core.vo.ComleteTask; import org.springblade.flow.core.vo.ComleteTask;
import org.springblade.flow.core.vo.EndVo; import org.springblade.flow.core.vo.EndVo;
import org.springblade.system.cache.DictCache; import org.springblade.system.cache.DictCache;
import org.springblade.system.entity.Dept;
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.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
@ -70,6 +74,8 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
private final IFlowClient flowClient; private final IFlowClient flowClient;
private final IUserClient userClient; private final IUserClient userClient;
private final ISysClient sysClient;
@Override @Override
public R doSave(OperMaintenanceTaskDTO req) { public R doSave(OperMaintenanceTaskDTO req) {
req.setTaskCode(this.genTaskCode(RandomUtils.nextInt(0, 999))); req.setTaskCode(this.genTaskCode(RandomUtils.nextInt(0, 999)));
@ -85,12 +91,18 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
} }
@Override @Override
public R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req, Query query) { public R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req) {
Query query=new Query();
query.setSize(req.getSize());
query.setCurrent(req.getCurrent());
Wrapper<OperMaintenanceTaskEntity> queryWrapper = new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{ Wrapper<OperMaintenanceTaskEntity> queryWrapper = new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{
orderByDesc(OperMaintenanceTaskEntity::getDisposeTime); orderByDesc(OperMaintenanceTaskEntity::getDisposeTime);
if (StringUtil.isNotBlank(req.getTaskIds())) { if (StringUtil.isNotBlank(req.getTaskIds())) {
in(OperMaintenanceTaskEntity::getId, Lists.newArrayList(req.getTaskIds().split(","))); in(OperMaintenanceTaskEntity::getId, Lists.newArrayList(req.getTaskIds().split(",")));
} }
if (CollectionUtil.isNotEmpty(req.getTaskList())) {
in(OperMaintenanceTaskEntity::getId, req.getTaskList());
}
if (req.getRefLibraryId() != null) { if (req.getRefLibraryId() != null) {
eq(OperMaintenanceTaskEntity::getRefLibraryId, req.getRefLibraryId()); eq(OperMaintenanceTaskEntity::getRefLibraryId, req.getRefLibraryId());
} }
@ -126,7 +138,7 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
} }
if (StringUtil.isNoneBlank(req.getFlowTaskName())) { if (StringUtil.isNoneBlank(req.getFlowTaskName())) {
eq(OperMaintenanceTaskEntity::getFlowTaskName,req.getFlowTaskName()); eq(OperMaintenanceTaskEntity::getFlowTaskName, req.getFlowTaskName());
} }
}}; }};
@ -389,4 +401,61 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
} }
return null; return null;
} }
@Override
public List<VoteChartVo> getMaintenanceListStatistics(String startTime, String endTime,Long deptId) {
List<OperMaintenanceTaskEntity> maintenanceTaskEntities = new ArrayList<>();
R<List<Dept>> deptByCurrentUser = sysClient.getDeptByCurrentUser();
List<Long> deptIds;
if (deptByCurrentUser.isSuccess() && CollectionUtil.isNotEmpty(deptByCurrentUser.getData())) {
deptIds = deptByCurrentUser.getData().stream().map(s -> s.getId()).collect(Collectors.toList());
} else {
throw new ServiceException("暂无机构权限");
}
QueryWrapper<OperMaintenanceTaskEntity> queryWrapper = new QueryWrapper<>();
if (ObjectUtil.isNotEmpty(deptId)) {
if (deptIds.contains(deptId)) {
queryWrapper.in(ObjectUtils.isNotNull(deptIds), "CREATE_DEPT", deptId);
} else {
throw new ServiceException("暂无该机构权限");
}
} else {
queryWrapper.in(ObjectUtils.isNotNull(deptIds), "CREATE_DEPT", deptIds);
}
queryWrapper.ge(ObjectUtils.isNotNull(startTime), "CREATE_TIME", startTime);
queryWrapper.le(ObjectUtils.isNotNull(endTime), "CREATE_TIME", endTime);
maintenanceTaskEntities = baseMapper.selectList(queryWrapper);
List<VoteChartVo> res = new ArrayList<>();
if (CollectionUtil.isNotEmpty(maintenanceTaskEntities)) {
VoteChartVo all = getVoteChartVo(maintenanceTaskEntities);
all.setName("总计");
res.add(all);
Map<Long, List<OperMaintenanceTaskEntity>> collect = Optional.ofNullable(maintenanceTaskEntities).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getCreateDept));
for (Map.Entry<Long, List<OperMaintenanceTaskEntity>> longListEntry : collect.entrySet()) {
VoteChartVo voteChartVo = getVoteChartVo(longListEntry.getValue());
R<String> deptName = sysClient.getDeptName(longListEntry.getKey());
voteChartVo.setName(deptName.isSuccess() ? deptName.getData() : "");
res.add(voteChartVo);
}
} else {
VoteChartVo all = new VoteChartVo();
all.setName("总计");
res.add(all);
}
return res;
}
private VoteChartVo getVoteChartVo(List<OperMaintenanceTaskEntity> list) {
VoteChartVo voteChartVo = new VoteChartVo();
List<Long> finishIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getStatus() == 3).map(s -> s.getId()).collect(Collectors.toList());
List<Long> undoneIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getStatus() != 3).map(s -> s.getId()).collect(Collectors.toList());
voteChartVo.setSumNum(list.size());
voteChartVo.setSumIds(list.stream().map(s -> s.getId()).collect(Collectors.toList()));
voteChartVo.setFinishNum(finishIds.size());
voteChartVo.setFinishIds(finishIds);
voteChartVo.setUndoneNum(undoneIds.size());
voteChartVo.setUndoneIds(undoneIds);
return voteChartVo;
}
} }

Loading…
Cancel
Save