Browse Source

#检修计划导出

zhongwei
yang_shj 10 months ago
parent
commit
a9ca5248cc
  1. 29
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/tabulate/vo/TabulateLevelVo.java
  2. 8
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/constants/AccessConstants.java
  3. 57
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/entity/OperAccessTaskEntity.java
  4. 20
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/vo/AccessExportVo.java
  5. 39
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/vo/AccessTaskExportVo.java
  6. 8
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/tabulate/controller/AlarmTabulateController.java
  7. 3
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/tabulate/service/AlarmTabulateService.java
  8. 17
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/tabulate/service/impl/AlarmTabulateServiceImpl.java
  9. 36
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/AccessPlanV4Controller.java
  10. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessPlanListDTO.java
  11. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskDetailMapper.java
  12. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java
  13. 25
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml
  14. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/AccessPlanV4Service.java
  15. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessTaskService.java
  16. 283
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java
  17. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessPlanServiceImpl.java
  18. 20
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java

29
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/tabulate/vo/TabulateLevelVo.java

@ -0,0 +1,29 @@
package com.hnac.hzims.alarm.tabulate.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class TabulateLevelVo {
@ApiModelProperty(value = "站点编码")
private String projectId;
@ApiModelProperty(value = "开始时间")
private String startTime;
@ApiModelProperty(value = "结束时间")
private String endTime;
@ApiModelProperty(value = "")
private Integer dimension;
@ApiModelProperty(value = "")
private String id;
@ApiModelProperty(value = "")
private Integer soeType;
}

8
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/constants/AccessConstants.java

@ -51,6 +51,14 @@ public interface AccessConstants {
/**未完成**/
int ACCESS_TASK_STATUS_5 = 5;
/**
* 检修计划流程状态0-完成 1=未完成
*/
String PROCESS_STEP_COMPLETE = "0";
String PROCESS_STEP_INCOMPLETE = "1";
/**
* 延期状态
*/

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

@ -30,102 +30,63 @@ public class OperAccessTaskEntity extends TenantEntity {
private static final long serialVersionUID = 1L;
/**
* 设备编码
*/
@ApiModelProperty("站点编码")
private String stationCode;
@ApiModelProperty("站点名称")
private String stationName;
@ApiModelProperty("设备名称")
private String emName;
@ApiModelProperty("设备编码")
private String emCode;
/**
* 工作流实例
*/
@ApiModelProperty(value = "工作流实例")
private String processInstanceId;
/**
* 任务编码
*/
@ApiModelProperty(value = "任务编码")
private String code;
/**
* 任务名称
*/
@ApiModelProperty(value = "任务名称")
private String name;
/**
* 操作规范
*/
@ApiModelProperty(value = "操作规范")
private String workStandards;
/**
* 安全警告
*/
@ApiModelProperty(value = "安全警告")
private String safeInfos;
/**
* 计划开始时间
*/
@ApiModelProperty(value = "计划开始时间")
private Date planStartTime;
/**
* 计划结束时间
*/
@ApiModelProperty(value = "计划结束时间")
private Date planEndTime;
/**
* 计划结束时间
*/
@ApiModelProperty(value = "计划工时")
private Integer planHours;
/**
* 实际开始时间
*/
@ApiModelProperty(value = "实际开始时间")
private Date actStartTime;
/**
* 实际结束时间
*/
@ApiModelProperty(value = "实际结束时间")
private Date actEndTime;
/**
* 实际工时
*/
@ApiModelProperty(value = "实际工时")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer actHours;
/**
* 任务执行人
*/
@ApiModelProperty(value = "任务执行人")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long handler;
/**
* 描述
*/
@ApiModelProperty(value = "描述")
private String descripiton;
/**
* 计划ID
*/
@ApiModelProperty("计划ID")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long planId;
/**
* 检修库ID
*/
@ApiModelProperty("检修库ID")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long contentId;

20
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/vo/AccessExportVo.java

@ -0,0 +1,20 @@
package com.hnac.hzims.operational.access.vo;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
*/
@Data
public class AccessExportVo {
@ApiModelProperty(value = "计划名称")
private String planName;
@ApiModelProperty(value = "计划名称")
private List<AccessTaskExportVo> tasks;
}

39
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/vo/AccessTaskExportVo.java

@ -0,0 +1,39 @@
package com.hnac.hzims.operational.access.vo;
import com.hnac.hzims.operational.access.entity.OperAccessTaskDetailEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author ysj
*/
@Data
public class AccessTaskExportVo {
@ApiModelProperty(value = "任务ID")
private Long taskId;
@ApiModelProperty(value = "设备名称")
private String emName;
@ApiModelProperty(value = "计划开始时间")
private Date planStartTime;
@ApiModelProperty(value = "计划结束时间")
private Date planEndTime;
@ApiModelProperty(value = "计划工时")
private Integer planHours;
@ApiModelProperty(value = "负责人id")
private Long headId;
@ApiModelProperty(value = "负责人")
private String headName;
@ApiModelProperty(value = "检修项目集合")
private List<OperAccessTaskDetailEntity> details;
}

8
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/tabulate/controller/AlarmTabulateController.java

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.alarm.tabulate.service.AlarmTabulateService;
import com.hnac.hzims.alarm.tabulate.vo.TabulateEarlyVo;
import com.hnac.hzims.alarm.tabulate.vo.TabulateLevelVo;
import com.hnac.hzinfo.sdk.v5.soe.vo.StbAnalysisVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -34,4 +35,11 @@ public class AlarmTabulateController extends BladeController {
public R<IPage<StbAnalysisVO>> early(TabulateEarlyVo param, Query query) {
return R.data(tabulateService.early(Condition.getPage(query), param));
}
@GetMapping("/level")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "等级告警(设备实例)", notes = "等级告警(设备实例)")
public R<IPage<StbAnalysisVO>> level(TabulateLevelVo param, Query query) {
return R.data(tabulateService.level(Condition.getPage(query), param));
}
}

3
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/tabulate/service/AlarmTabulateService.java

@ -3,6 +3,7 @@ package com.hnac.hzims.alarm.tabulate.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.alarm.config.vo.AlarmHandleVo;
import com.hnac.hzims.alarm.tabulate.vo.TabulateEarlyVo;
import com.hnac.hzims.alarm.tabulate.vo.TabulateLevelVo;
import com.hnac.hzinfo.sdk.v5.soe.vo.StbAnalysisVO;
import org.springblade.core.mp.support.Query;
@ -12,4 +13,6 @@ import org.springblade.core.mp.support.Query;
public interface AlarmTabulateService {
IPage<StbAnalysisVO> early(IPage<StbAnalysisVO> page, TabulateEarlyVo param);
IPage<StbAnalysisVO> level(IPage<Object> page, TabulateLevelVo param);
}

17
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/tabulate/service/impl/AlarmTabulateServiceImpl.java

@ -3,8 +3,11 @@ package com.hnac.hzims.alarm.tabulate.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.alarm.tabulate.service.AlarmTabulateService;
import com.hnac.hzims.alarm.tabulate.vo.TabulateEarlyVo;
import com.hnac.hzims.alarm.tabulate.vo.TabulateLevelVo;
import com.hnac.hzinfo.sdk.core.response.HzPage;
import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient;
import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient;
import com.hnac.hzinfo.sdk.v5.soe.SoeDataClient;
import com.hnac.hzinfo.sdk.v5.soe.dto.StbAnalysisDTO;
import com.hnac.hzinfo.sdk.v5.soe.vo.StbAnalysisVO;
@ -28,6 +31,8 @@ public class AlarmTabulateServiceImpl implements AlarmTabulateService {
private final SoeDataClient soeDataClient;
private final DeviceDataClient deviceDataClient;
/**
* 智能预警
* @param page
@ -56,4 +61,16 @@ public class AlarmTabulateServiceImpl implements AlarmTabulateService {
page.setRecords(result.getData().getRecords());
return page;
}
/**
* 等级告警
* @param page
* @param param
* @return
*/
@Override
public IPage<StbAnalysisVO> level(IPage<Object> page, TabulateLevelVo param) {
deviceDataClient.getDeviceSoeData(param.getProjectId(),param.getDimension(),param.getId(),param.getSoeType(),param.getStartTime(),param.getEndTime());
return null;
}
}

36
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/AccessPlanV4Controller.java

@ -1,17 +1,22 @@
package com.hnac.hzims.operational.access.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.access.dto.AccessPlanV4DTO;
import com.hnac.hzims.operational.access.dto.OperAccessPlanListDTO;
import com.hnac.hzims.operational.access.service.AccessPlanV4Service;
import com.hnac.hzims.operational.access.vo.OperAccessPlanVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
/**
@ -26,14 +31,29 @@ public class AccessPlanV4Controller extends BladeController {
private final AccessPlanV4Service service;
/**
* v4检修计划流程开启
* @return
*/
@PostMapping("/overhaul_start_v4")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "v4检修计划流程开启")
public R startV4(@RequestBody AccessPlanV4DTO entity) {
return R.status(service.startProcessV4(entity));
}
@ApiLog
@GetMapping("/pages")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "检修计划分页查询")
public R<IPage<OperAccessPlanVO>> list(OperAccessPlanListDTO param, Query query) {
return R.data(service.pages(Condition.getPage(query),param));
}
@ApiLog
@GetMapping("/export")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "检修计划导出")
public void export(@RequestParam("id") Long id) {
service.export(id);
}
}

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessPlanListDTO.java

@ -18,9 +18,12 @@ public class OperAccessPlanListDTO extends OperAccessPlanEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "开始时间")
private String startDate;
private String startTime;
@ApiModelProperty(value = "结束时间")
private String endDate;
private String endTime;
@ApiModelProperty(value = "流程步骤 : 0-完成 1-未完成")
private String processStep;
}

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskDetailMapper.java

@ -17,4 +17,5 @@ import java.util.List;
public interface OperAccessTaskDetailMapper extends BaseMapper<OperAccessTaskDetailEntity> {
List<OperAccessTaskDetailEntity> selectByTaskId(@Param("taskId") Long taskId);
}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java

@ -1,6 +1,7 @@
package com.hnac.hzims.operational.access.mapper;
import com.baomidou.mybatisplus.annotation.SqlParser;
import com.hnac.hzims.operational.access.vo.AccessTaskExportVo;
import com.hnac.hzims.operational.access.vo.RepairBillVO;
import org.springblade.core.datascope.annotation.UserDataAuth;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -42,4 +43,6 @@ public interface OperAccessTaskMapper extends UserDataScopeBaseMapper<OperAccess
List<OperAccessTaskEntity> selectAccessTask(@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("list")List<Long> list);
List<RepairBillVO> getRepairBill(@Param("deviceCodes") List<String> deviceCodes,@Param("startTime") String startTime, @Param("endTime") String endTime);
List<AccessTaskExportVo> accessTasks(@Param("planId") Long id);
}

25
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml

@ -5,20 +5,16 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.hnac.hzims.operational.access.entity.OperAccessTaskEntity">
<result column="ID" property="id"/>
<result column="PID" property="pid"/>
<result column="CONTENT_ID" property="contentId"/>
<result column="CODE" property="code"/>
<result column="NAME" property="name"/>
<result column="CONTENT" property="content"/>
<result column="WORK_STANDARDS" property="workStandards"/>
<result column="SAFE_INFOS" property="safeInfos"/>
<result column="PLAN_START_TIME" property="planStartTime"/>
<result column="PLAN_END_TIME" property="planEndTime"/>
<result column="ACT_START_TIME" property="actStartTime"/>
<result column="ACT_END_TIME" property="actEndTime"/>
<result column="HOURS" property="hours"/>
<result column="ACT_HOURS" property="actHours"/>
<result column="HANDLE_STATUS" property="handleStatus"/>
<result column="HANDLER" property="handler"/>
<result column="DESCRIPITON" property="descripiton"/>
<result column="TENANT_ID" property="tenantId"/>
@ -31,6 +27,21 @@
<result column="UPDATE_TIME" property="updateTime"/>
</resultMap>
<resultMap id="AccessTaskMap" type="com.hnac.hzims.operational.access.vo.AccessTaskExportVo">
<result column="TASK_ID" property="taskId"/>
<result column="EM_NAME" property="emName"/>
<result column="HEAD_ID" property="headId"/>
<result column="PLAN_START_TIME" property="planStartTime"/>
<result column="PLAN_END_TIME" property="planEndTime"/>
<result column="PLAN_HOURS" property="planHours"/>
<collection property="details"
select="com.hnac.hzims.operational.access.mapper.OperAccessTaskDetailMapper.selectByTaskId"
column="TASK_ID">
</collection>
</resultMap>
<select id="getAccessPlanByTaskId" resultType="com.hnac.hzims.operational.access.vo.OperAccessTaskVO">
SELECT
t1.*, t3.`NAME` as planName
@ -228,4 +239,10 @@
</where>
GROUP BY t.EM_CODE,p.`GRADE_CODE`
</select>
<select id="accessTasks" resultMap="AccessTaskMap">
SELECT ID AS TASK_ID,EM_NAME,PLAN_START_TIME,PLAN_END_TIME,PLAN_HOURS,`HANDLER` AS HEAD_ID
FROM HZIMS_OPER_ACCESS_TASK
WHERE PLAN_ID = #{planId}
</select>
</mapper>

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/AccessPlanV4Service.java

@ -1,7 +1,15 @@
package com.hnac.hzims.operational.access.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.access.dto.AccessPlanV4DTO;
import com.hnac.hzims.operational.access.dto.OperAccessPlanListDTO;
import com.hnac.hzims.operational.access.entity.OperAccessPlanEntity;
import com.hnac.hzims.operational.access.vo.OperAccessPlanVO;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import javax.servlet.http.HttpServletResponse;
/**
* @author ysj
@ -11,4 +19,8 @@ public interface AccessPlanV4Service{
boolean startProcessV4(AccessPlanV4DTO entity);
boolean listener(ProcessWorkFlowResponse processWorkFlowResponse);
IPage<OperAccessPlanVO> pages(IPage<OperAccessPlanEntity> page, OperAccessPlanListDTO param);
void export(Long id);
}

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

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import com.hnac.hzims.operational.access.vo.AccessTaskExportVo;
import com.hnac.hzims.operational.access.vo.OperAccessTaskVO;
import com.hnac.hzims.operational.access.vo.RepairBillVO;
import com.hnac.hzims.operational.report.vo.AccessReportVO;
@ -78,4 +79,6 @@ public interface IOperAccessTaskService extends BaseService<OperAccessTaskEntity
List<RepairBillVO> getRepairBill(String emCode, String startTime, String endTime);
List<VoteChartVo> getAccessListStatistics(String startTime, String endTime,Long deptId);
List<AccessTaskExportVo> accessTasks(Long id);
}

283
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java

@ -3,16 +3,30 @@ package com.hnac.hzims.operational.access.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.dto.BusinessMessageDTO;
import com.hnac.hzims.message.fegin.IMessageClient;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.access.constants.AccessConstants;
import com.hnac.hzims.operational.access.dto.*;
import com.hnac.hzims.operational.access.entity.*;
import com.hnac.hzims.operational.access.service.*;
import com.hnac.hzims.operational.access.vo.AccessExportVo;
import com.hnac.hzims.operational.access.vo.AccessTaskExportVo;
import com.hnac.hzims.operational.access.vo.OperAccessPlanVO;
import com.hnac.hzims.operational.access.wrapper.OperAccessPlanWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomUtils;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.ss.util.CellRangeAddress;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
@ -30,12 +44,21 @@ import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.text.DecimalFormat;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -48,6 +71,8 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{
private final IOperAccessPlanService planService;
private final IOperAccessTaskService taskService;
private final IOperAccessMaterialService materialService;
private final IOperAccessContentService contentService;
@ -222,6 +247,7 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{
return true;
}
/**
* 开启检修任务
* @param entity
@ -296,4 +322,259 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{
message.setUserIds(userId);
messageClient.sendAppAndWsMsgByUsers(message);
}
/**
* 检修计划分页查询
* @param page
* @param param
* @return
*/
@Override
public IPage<OperAccessPlanVO> pages(IPage<OperAccessPlanEntity> page, OperAccessPlanListDTO param) {
QueryWrapper<OperAccessPlanEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().orderByDesc(OperAccessPlanEntity::getCreateTime);
if(ObjectUtil.isNotEmpty(param.getStartTime())){
queryWrapper.lambda().ge(OperAccessPlanEntity::getActStartTime,param.getStartTime());
}
if(ObjectUtil.isNotEmpty(param.getEndTime())){
queryWrapper.lambda().le(OperAccessPlanEntity::getActStartTime,param.getEndTime());
}
if(ObjectUtil.isNotEmpty(param.getName())){
queryWrapper.lambda().like(OperAccessPlanEntity::getName,param.getName());
}
if(ObjectUtil.isNotEmpty(param.getGradeCode())){
String[] gradeCodes = param.getGradeCode().split(",");
queryWrapper.lambda().in(OperAccessPlanEntity::getGradeCode,Arrays.asList(gradeCodes));
}
if(ObjectUtil.isNotEmpty(param.getProcessStep())){
if(AccessConstants.PROCESS_STEP_COMPLETE.equals(param.getProcessStep())){
queryWrapper.lambda().eq(OperAccessPlanEntity::getTaskName,"流程结束");
}else if(AccessConstants.PROCESS_STEP_INCOMPLETE.equals(param.getProcessStep())){
queryWrapper.lambda().ne(OperAccessPlanEntity::getTaskName,"流程结束");
}
}
IPage pages = this.planService.page(page,queryWrapper);
pages.setRecords(OperAccessPlanWrapper.build().listVO(pages.getRecords()));
return pages;
}
/**
* 检修任务导出
* @param id
*/
@Override
public void export(Long id) {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletResponse response = servletRequestAttributes.getResponse();
// 查询检修计划内容
AccessExportVo access = this.accessExport(id);
// 创建Excel文件
HSSFWorkbook hssWB = new HSSFWorkbook();
// 添加sheet页
HSSFSheet sheet = hssWB.createSheet(access.getPlanName());
// 行高
sheet.setDefaultRowHeight((short) (20 * 25));
// 列宽
sheet.setDefaultColumnWidth(20);
this.setFirstHeader(hssWB, sheet,access.getPlanName());
// 第二行/三行 表头格式设置
this.setWorkHeader(hssWB, sheet);
if (!CollectionUtil.isEmpty(access.getTasks())) {
// 数据填充
this.setWorkData(hssWB, sheet, access.getTasks());
}
// 下载导出
String filename = access.getPlanName();
// 设置头信息
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-excel");
ServletOutputStream outputStream;
try {
//设置xlsx格式
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename + ".xls", "UTF-8"));
//创建一个输出流
outputStream = response.getOutputStream();
//写入数据
hssWB.write(outputStream);
// 关闭
outputStream.close();
hssWB.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 查询检修任务导出数据
* @param id
* @return
*/
private AccessExportVo accessExport(Long id) {
// 检修计划查询
OperAccessPlanEntity plan = this.planService.getById(id);
AccessExportVo access = new AccessExportVo();
access.setPlanName(plan.getName());
access.setTasks(this.taskService.accessTasks(id));
return access;
}
/**
* 设置表头
* @param hssWB
* @param sheet
*/
private void setFirstHeader(HSSFWorkbook hssWB, HSSFSheet sheet,String planName) {
// 第一行
HSSFRow fisrtRow = sheet.createRow(0);
this.setTitileStyle(hssWB, fisrtRow, 7, true);
// 第一个单元格
HSSFCell headCell = fisrtRow.getCell(0);
headCell.setCellValue(planName);
// 首行合并情况
CellRangeAddress region1 = new CellRangeAddress(0, 0, (short) 0, (short) 7);
sheet.addMergedRegion(region1);
}
/**
* 第一行条目名称设置
* @param hssWB
* @param sheet
*/
private void setWorkHeader(HSSFWorkbook hssWB, HSSFSheet sheet) {
// 创建行
HSSFRow row_1 = sheet.createRow(1);
this.setTitileStyle(hssWB, row_1, 7, true);
// 第一行
HSSFCell header_row_1_cell_1 = row_1.getCell(0);
header_row_1_cell_1.setCellValue("序号");
HSSFCell header_row_1_cell_2 = row_1.getCell(1);
header_row_1_cell_2.setCellValue("设备名称");
HSSFCell header_row_1_cell_3 = row_1.getCell(2);
header_row_1_cell_3.setCellValue("计划开始时间");
HSSFCell header_row_1_cell_4 = row_1.getCell(3);
header_row_1_cell_4.setCellValue("计划结束时间");
HSSFCell header_row_1_cell_5 = row_1.getCell(4);
header_row_1_cell_5.setCellValue("计划工时");
HSSFCell header_row_1_cell_6 = row_1.getCell(5);
header_row_1_cell_6.setCellValue("检修项目");
HSSFCell header_row_1_cell_7 = row_1.getCell(6);
header_row_1_cell_7.setCellValue("检修内容");
HSSFCell header_row_1_cell_8 = row_1.getCell(7);
header_row_1_cell_8.setCellValue("检修负责人");
}
/**
* 内容填充
* @param hssWB
* @param sheet
* @param tasks
*/
private void setWorkData(HSSFWorkbook hssWB, HSSFSheet sheet, List<AccessTaskExportVo> tasks) {
int size = tasks.size();
int row = 2;
for (int i = 0; i < size; i++) {
AccessTaskExportVo task = tasks.get(i);
List<OperAccessTaskDetailEntity> details = tasks.get(i).getDetails();
int detail_size = details.size();
for (int j = 0; j < detail_size ; j++){
HSSFRow detail_row = sheet.createRow(row + j);
this.setTitileStyle(hssWB, detail_row, 7, false);
if(j == 0){
// 序号
HSSFCell header_row_cell_0 = detail_row.getCell(0);
header_row_cell_0.setCellValue(i + 1);
// 设备名称
HSSFCell header_row_cell_1 = detail_row.getCell(1);
header_row_cell_1.setCellValue(task.getEmName());
// 计划开始时间
HSSFCell header_row_cell_2 = detail_row.getCell(2);
header_row_cell_2.setCellValue(DateUtil.format(task.getPlanStartTime(),DateUtil.PATTERN_DATETIME));
// 计划结束时间
HSSFCell header_row_cell_3 = detail_row.getCell(3);
header_row_cell_3.setCellValue(DateUtil.format(task.getPlanEndTime(),DateUtil.PATTERN_DATETIME));
// 计划工时
HSSFCell header_row_cell_4 = detail_row.getCell(4);
header_row_cell_4.setCellValue(task.getPlanHours());
// 检修负责人
HSSFCell header_row_cell_7 = detail_row.getCell(7);
header_row_cell_7.setCellValue(task.getHeadName());
}
// 检修项目
HSSFCell header_row_cell_5 = detail_row.getCell(5);
header_row_cell_5.setCellValue(details.get(j).getName());
// 检修内容
HSSFCell header_row_cell_6 = detail_row.getCell(6);
header_row_cell_6.setCellValue(details.get(j).getContent());
}
CellRangeAddress header_region_0 = new CellRangeAddress((short) row, (short) row + detail_size - 1, (short) 0, (short) 0);
CellRangeAddress header_region_1 = new CellRangeAddress((short) row, (short) row + detail_size - 1, (short) 1, (short) 1);
CellRangeAddress header_region_2 = new CellRangeAddress((short) row, (short) row + detail_size - 1, (short) 2, (short) 2);
CellRangeAddress header_region_3 = new CellRangeAddress((short) row, (short) row + detail_size - 1, (short) 3, (short) 3);
CellRangeAddress header_region_4 = new CellRangeAddress((short) row,(short) row + detail_size - 1, (short) 4, (short) 4);
CellRangeAddress header_region_7 = new CellRangeAddress((short) row, (short) row + detail_size - 1, (short) 7, (short) 7);
sheet.addMergedRegion(header_region_0);
sheet.addMergedRegion(header_region_1);
sheet.addMergedRegion(header_region_2);
sheet.addMergedRegion(header_region_3);
sheet.addMergedRegion(header_region_4);
sheet.addMergedRegion(header_region_7);
// 累计合并结束行号
row += detail_size;
}
}
/**
* 设置Titile单元格样式
*
* @param hssWB
* @param row
* @param len
*/
private void setTitileStyle(HSSFWorkbook hssWB, HSSFRow row, int len, boolean isHead) {
HSSFCellStyle cellStyle = getHeadStyle(hssWB, isHead);
for (int i = 0; i <= len; i++) {
HSSFCell hssfcell = row.createCell(i);
hssfcell.setCellStyle(cellStyle);
}
}
/**
* 获取表头样式
*
* @param hssWB
* @return
*/
private HSSFCellStyle getHeadStyle(HSSFWorkbook hssWB, boolean isHead) {
HSSFCellStyle headStyle = hssWB.createCellStyle();
//边框
headStyle.setBorderLeft(BorderStyle.THIN);
headStyle.setBorderRight(BorderStyle.THIN);
headStyle.setBorderTop(BorderStyle.THIN);
headStyle.setBorderBottom(BorderStyle.THIN);
//居中:
headStyle.setAlignment(HorizontalAlignment.CENTER); // 居中
headStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
//字体:
HSSFFont font = hssWB.createFont();
font.setFontName("黑体");
if (isHead) {
//设置字体大小
font.setFontHeightInPoints((short) 12);
//背景颜色
headStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
headStyle.setFillForegroundColor(HSSFColor.SKY_BLUE.index);
} else {
//设置字体大小
font.setFontHeightInPoints((short) 8);
//背景颜色
headStyle.setFillPattern(FillPatternType.NO_FILL);
headStyle.setFillForegroundColor(HSSFColor.WHITE.index);
}
//字体格式
headStyle.setFont(font);
return headStyle;
}
}

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessPlanServiceImpl.java

@ -438,11 +438,11 @@ public class OperAccessPlanServiceImpl extends BaseServiceImpl<OperAccessPlanMap
if (StringUtils.isNotBlank(req.getHandleStatus())) {
eq(OperAccessPlanEntity::getHandleStatus, req.getHandleStatus());
}
if (StringUtils.isNotEmpty(req.getStartDate())) {
ge(OperAccessPlanEntity::getActStartTime, req.getStartDate());
if (StringUtils.isNotEmpty(req.getStartTime())) {
ge(OperAccessPlanEntity::getActStartTime, req.getStartTime());
}
if (StringUtils.isNotBlank(req.getEndDate())) {
le(OperAccessPlanEntity::getActStartTime, req.getEndDate());
if (StringUtils.isNotBlank(req.getEndTime())) {
le(OperAccessPlanEntity::getActStartTime, req.getEndTime());
}
}};

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

@ -23,6 +23,7 @@ import com.hnac.hzims.operational.access.dto.OperAccessTaskDetailDTO;
import com.hnac.hzims.operational.access.entity.*;
import com.hnac.hzims.operational.access.mapper.OperAccessTaskMapper;
import com.hnac.hzims.operational.access.service.*;
import com.hnac.hzims.operational.access.vo.AccessTaskExportVo;
import com.hnac.hzims.operational.access.vo.OperAccessTaskVO;
import com.hnac.hzims.operational.access.vo.RepairBillVO;
import com.hnac.hzims.operational.access.wrapper.OperAccessTaskDetailWrapper;
@ -499,6 +500,7 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
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());
@ -607,4 +609,22 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
log.info("消息推送人为:{},推送消息为:{}", operAccessTaskDTO.getHandler().toString(), AccessConstants.AccessProcessEnum.ACCESS_BACKLOG.getMsg());
log.info("--------消息推送成功----------");
}
/**
* 查询导出检修任务记录
* @param id
* @return
*/
@Override
public List<AccessTaskExportVo> accessTasks(Long id) {
List<AccessTaskExportVo> tasks = this.baseMapper.accessTasks(id);
return tasks.stream().peek(task -> {
log.error("access_task_headId : {}",task.getHeadId());
R<User> user = userClient.userInfoById(task.getHeadId());
if(user.isSuccess() && ObjectUtil.isNotEmpty(user.getData())){
task.setHeadName(user.getData().getName());
}
}).collect(Collectors.toList());
}
}

Loading…
Cancel
Save