Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 1 year ago
parent
commit
64859eae37
  1. 26
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/vo/MaintenanceExportVO.java
  2. 24
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/vo/InspectTaskExportVO.java
  3. 9
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java
  4. 28
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java
  5. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceTaskController.java
  6. 47
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java
  7. 16
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java
  8. 12
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/controller/WorkTicketInfoController.java
  9. 30
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java
  10. 4
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/vo/WorkTicketExportVO.java

26
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/vo/MaintenanceExportVO.java

@ -13,41 +13,41 @@ import org.springframework.format.annotation.DateTimeFormat;
@Data @Data
public class MaintenanceExportVO { public class MaintenanceExportVO {
@ExcelProperty(value = "序号", index = 0) // @ExcelProperty(value = "序号", index = 0)
@ColumnWidth(value = 20) // @ColumnWidth(value = 20)
@ApiModelProperty(value = "序号") // @ApiModelProperty(value = "序号")
private Integer number; // private Integer number;
@ExcelProperty(value = "单位", index = 1) @ExcelProperty(value = "单位", index = 0)
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
@ApiModelProperty(value = "单位") @ApiModelProperty(value = "单位")
private String company; private String company;
@ExcelProperty(value = "维护类型", index = 2) @ExcelProperty(value = "维护类型", index =1)
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
@ApiModelProperty(value = "维护类型") @ApiModelProperty(value = "维护类型")
private String typeCode; private String typeCode;
@ExcelProperty(value = "维护设备", index = 3) @ExcelProperty(value = "维护设备", index = 2)
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
@ApiModelProperty(value = "维护设备") @ApiModelProperty(value = "维护设备")
private String refLibraryId; private String refLibraryId;
@ApiModelProperty("维护内容") @ApiModelProperty("维护内容")
@ExcelProperty(value = "维护内容", index = 4) @ExcelProperty(value = "维护内容", index = 3)
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
private String title; private String title;
@ExcelProperty(value = "计划执行时间", index = 5) @ExcelProperty(value = "计划执行时间", index = 4)
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
@ApiModelProperty("计划执行时间") @ApiModelProperty("计划执行时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String planEndTime; private String planEndTime;
@ExcelProperty(value = "实际执行时间", index = 6) @ExcelProperty(value = "实际执行时间", index = 5)
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
@ApiModelProperty("实际执行时间") @ApiModelProperty("实际执行时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ -55,14 +55,14 @@ public class MaintenanceExportVO {
private String executeTime; private String executeTime;
@ExcelProperty(value = "执行人", index = 7) @ExcelProperty(value = "执行人", index = 6)
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
@ApiModelProperty(value = "执行人") @ApiModelProperty(value = "执行人")
private String disposer; private String disposer;
@ExcelProperty(value = "执行情况", index = 8) @ExcelProperty(value = "操作规范", index = 7)
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
@ApiModelProperty(value = "执行情况") @ApiModelProperty(value = "操作规范")
private String principal; private String principal;
} }

24
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/vo/InspectTaskExportVO.java

@ -13,44 +13,40 @@ import org.springframework.format.annotation.DateTimeFormat;
@Data @Data
public class InspectTaskExportVO { public class InspectTaskExportVO {
@ExcelProperty(value = "序号", index = 0)
@ColumnWidth(value = 20)
@ApiModelProperty(value = "序号")
private Integer number;
@ExcelProperty(value = "单位", index = 1) @ExcelProperty(value = "单位", index = 0)
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
@ApiModelProperty(value = "单位") @ApiModelProperty(value = "单位")
private String company; private String company;
@ExcelProperty(value = "巡检名称", index = 2) @ExcelProperty(value = "巡检名称", index = 1)
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
@ApiModelProperty(value = "巡检名称") @ApiModelProperty(value = "巡检名称")
private String planName; private String planName;
@ExcelProperty(value = "计划开始时间", index = 3) @ExcelProperty(value = "计划开始时间", index = 2)
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
@ApiModelProperty("计划开始时间") @ApiModelProperty("计划开始时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String planStartTime; private String planStartTime;
@ExcelProperty(value = "计划结束时间", index = 4) @ExcelProperty(value = "计划结束时间", index = 3)
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
@ApiModelProperty("计划结束时间") @ApiModelProperty("计划结束时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String planEndTime; private String planEndTime;
@ExcelProperty(value = "实际开始时间", index = 5) @ExcelProperty(value = "实际开始时间", index =4)
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
@ApiModelProperty("实际开始时间") @ApiModelProperty("实际开始时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String startTime; private String startTime;
@ExcelProperty(value = "实际结束时间", index = 6) @ExcelProperty(value = "实际结束时间", index = 5)
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
@ApiModelProperty("实际结束时间") @ApiModelProperty("实际结束时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ -58,21 +54,21 @@ public class InspectTaskExportVO {
private String endTime; private String endTime;
@ApiModelProperty("巡检时长(分钟)") @ApiModelProperty("巡检时长(分钟)")
@ExcelProperty(value = "巡检时长(分钟)", index = 7) @ExcelProperty(value = "巡检时长(分钟)", index = 6)
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
private Long inspectTime; private Long inspectTime;
@ApiModelProperty("巡检人") @ApiModelProperty("巡检人")
@ExcelProperty(value = "巡检人", index = 8) @ExcelProperty(value = "巡检人", index = 7)
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
private String userName; private String userName;
@ApiModelProperty("巡检情况") @ApiModelProperty("巡检情况")
@ExcelProperty(value = "巡检情况", index = 9) @ExcelProperty(value = "巡检情况", index = 8)
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
private String content; private String content;
@ApiModelProperty("巡检状态") @ApiModelProperty("巡检状态")
@ExcelProperty(value = "巡检状态", index = 10) @ExcelProperty(value = "巡检状态", index = 9)
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
private String status; private String status;

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

@ -45,11 +45,14 @@ import org.springblade.resource.vo.PushInfoVO;
import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.time.temporal.TemporalAdjusters;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -152,6 +155,12 @@ public class TaskController extends BladeController {
@ApiOperation(value = "巡检任务导出", notes = "传入计划id") @ApiOperation(value = "巡检任务导出", notes = "传入计划id")
public void exportTaskList(HttpServletResponse response,@RequestBody TaskDTO task) { public void exportTaskList(HttpServletResponse response,@RequestBody TaskDTO task) {
try { try {
if(ObjectUtils.isEmpty(task.getStartTime())&&ObjectUtils.isEmpty(task.getEndTime())){
LocalDateTime date = LocalDateTime.now();
LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
task.setStartTime(firstDay);
task.setEndTime(date);
}
response.setContentType("application/vnd.ms-excel"); response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系

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

@ -1025,11 +1025,9 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
List<TaskEntity> taskEntities = super.baseMapper.selectList(queryWrapper); List<TaskEntity> taskEntities = super.baseMapper.selectList(queryWrapper);
List<InspectTaskExportVO> list=new ArrayList<>(); List<InspectTaskExportVO> list=new ArrayList<>();
if (CollectionUtils.isNotEmpty(taskEntities)){ if (CollectionUtils.isNotEmpty(taskEntities)){
List<TaskVo> taskVos = getTaskVos(taskEntities); list=taskEntities.parallelStream().map(taskVo -> {
for (int i = 0; i < taskVos.size(); i++) {
InspectTaskExportVO resEntity=new InspectTaskExportVO(); InspectTaskExportVO resEntity=new InspectTaskExportVO();
TaskVo taskVo = taskVos.get(i); try {
resEntity.setNumber(i+1);
if (ObjectUtil.isNotEmpty(taskVo.getCreateDept())) { if (ObjectUtil.isNotEmpty(taskVo.getCreateDept())) {
R<Dept> dept = sysClient.getDept(taskVo.getCreateDept()); R<Dept> dept = sysClient.getDept(taskVo.getCreateDept());
if (dept.isSuccess() && ObjectUtil.isNotEmpty(dept.getData())) { if (dept.isSuccess() && ObjectUtil.isNotEmpty(dept.getData())) {
@ -1063,10 +1061,28 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
} else { } else {
resEntity.setContent("正常"); resEntity.setContent("正常");
} }
resEntity.setUserName(Optional.ofNullable( taskVo.getUserNames()).orElse("")); if(ObjectUtil.isNotEmpty(taskVo.getId())) {
List<TaskUserEntity> taskUserList = taskUserService.list(Wrappers.<TaskUserEntity>lambdaQuery().eq(TaskUserEntity::getTaskId, taskVo.getId()));
if (CollectionUtil.isNotEmpty(taskUserList)) {
// 获取巡检任务人员名称
String userNames = taskUserList.stream().filter(Func::isNotEmpty).map(TaskUserEntity::getUserId).filter(Func::isNotEmpty)
.map(userId -> {
User user = UserCache.getUser(userId);
if (ObjectUtil.isEmpty(user)) {
return "";
}
return user.getName();
}).collect(Collectors.joining(","));
resEntity.setUserName(userNames);
}
}
resEntity.setStatus(Optional.ofNullable(DictCache.getValue(TaskContants.TASK_STATUS, taskVo.getStatus())).orElse("")); resEntity.setStatus(Optional.ofNullable(DictCache.getValue(TaskContants.TASK_STATUS, taskVo.getStatus())).orElse(""));
list.add(resEntity); return resEntity;
}catch (Exception e){
log.error("巡检导出失败---》param"+taskVo+"报错信息:"+e.getStackTrace());
return resEntity;
} }
}).collect(Collectors.toList());
} }
return list; return list;
} }

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

@ -34,6 +34,7 @@ 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.util.ObjectUtils;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -41,6 +42,9 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -130,6 +134,14 @@ public class OperMaintenanceTaskController extends BladeController {
= "日常维护记录导出") = "日常维护记录导出")
public void exportMaintenance(HttpServletResponse response,@RequestBody OperMaintenanceTaskDTO req) { public void exportMaintenance(HttpServletResponse response,@RequestBody OperMaintenanceTaskDTO req) {
try { try {
if(ObjectUtils.isEmpty(req.getStartTime())&&ObjectUtils.isEmpty(req.getEndTime())){
LocalDateTime date = LocalDateTime.now();
String nowDate = date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
String firstDate = firstDay.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
req.setStartTime(firstDate);
req.setEndTime(nowDate);
}
response.setContentType("application/vnd.ms-excel"); response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系

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

@ -8,6 +8,8 @@ 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;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.operational.defect.constants.DefectConstant; import com.hnac.hzims.operational.defect.constants.DefectConstant;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.mapper.OperPhenomenonMapper; import com.hnac.hzims.operational.defect.mapper.OperPhenomenonMapper;
@ -75,7 +77,7 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
private final OperPhenomenonMapper operPhenomenonMapper; private final OperPhenomenonMapper operPhenomenonMapper;
private final IFlowClient flowClient; private final IFlowClient flowClient;
private final IUserClient userClient; private final IUserClient userClient;
private final IEmInfoClient emInfoClient;
private final ISysClient sysClient; private final ISysClient sysClient;
@Override @Override
@ -460,11 +462,9 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
List<OperMaintenanceTaskEntity> maintenanceTaskEntities = super.baseMapper.selectList(queryWrapper); List<OperMaintenanceTaskEntity> maintenanceTaskEntities = super.baseMapper.selectList(queryWrapper);
List<MaintenanceExportVO> list=new ArrayList<>(); List<MaintenanceExportVO> list=new ArrayList<>();
if (CollectionUtil.isNotEmpty(maintenanceTaskEntities)){ if (CollectionUtil.isNotEmpty(maintenanceTaskEntities)){
List<OperMaintenanceTaskVO> operMaintenanceTaskVOS = OperMaintenanceTaskWrapper.build().listVO(maintenanceTaskEntities); list = maintenanceTaskEntities.parallelStream().map(maintenanceTaskVO -> {
for (int i = 0; i < operMaintenanceTaskVOS.size(); i++) {
MaintenanceExportVO resEntity=new MaintenanceExportVO(); MaintenanceExportVO resEntity=new MaintenanceExportVO();
OperMaintenanceTaskVO maintenanceTaskVO = operMaintenanceTaskVOS.get(i); try {
resEntity.setNumber(i+1);
if (ObjectUtil.isNotEmpty(maintenanceTaskVO.getCreateDept())){ if (ObjectUtil.isNotEmpty(maintenanceTaskVO.getCreateDept())){
R<Dept> dept = sysClient.getDept(maintenanceTaskVO.getCreateDept()); R<Dept> dept = sysClient.getDept(maintenanceTaskVO.getCreateDept());
if (dept.isSuccess()&&ObjectUtil.isNotEmpty(dept.getData())){ if (dept.isSuccess()&&ObjectUtil.isNotEmpty(dept.getData())){
@ -472,18 +472,41 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
} }
} }
resEntity.setTypeCode(Optional.ofNullable(DictCache.getValue(DictConstant.MAINTENANCE_TYPE_CODE, maintenanceTaskVO.getTypeCode())).orElse("")); resEntity.setTypeCode(Optional.ofNullable(DictCache.getValue(DictConstant.MAINTENANCE_TYPE_CODE, maintenanceTaskVO.getTypeCode())).orElse(""));
resEntity.setRefLibraryId(Optional.ofNullable( maintenanceTaskVO.getRefLibraryId().toString()).orElse("")); if (StringUtil.isNotBlank(maintenanceTaskVO.getEmCode())){
resEntity.setTitle(Optional.ofNullable( maintenanceTaskVO.getTitle()).orElse("")); EmInfoEntity emInfoEntity = emInfoClient.getByCode(maintenanceTaskVO.getEmCode());
if (ObjectUtil.isNotEmpty(emInfoEntity)&&StringUtil.isNotBlank(emInfoEntity.getName())){
resEntity.setRefLibraryId(emInfoEntity.getName());
}else {
resEntity.setRefLibraryId(maintenanceTaskVO.getEmCode());
}
}
resEntity.setTitle(Optional.ofNullable( maintenanceTaskVO.getContent()).orElse(""));
if (ObjectUtil.isNotEmpty(maintenanceTaskVO.getPlanEndTime())) { if (ObjectUtil.isNotEmpty(maintenanceTaskVO.getPlanEndTime())) {
resEntity.setPlanEndTime(Optional.ofNullable(DateUtil.format(maintenanceTaskVO.getPlanEndTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse("")); resEntity.setPlanEndTime(Optional.ofNullable(DateUtil.format(maintenanceTaskVO.getPlanEndTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse(""));
} }
if (ObjectUtil.isNotEmpty(maintenanceTaskVO.getExecuteTime())) { if (ObjectUtil.isNotEmpty(maintenanceTaskVO.getDisposeTime())) {
resEntity.setExecuteTime(Optional.ofNullable(DateUtil.format(maintenanceTaskVO.getExecuteTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse("")); resEntity.setExecuteTime(Optional.ofNullable(DateUtil.format(maintenanceTaskVO.getDisposeTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse(""));
}
if (ObjectUtil.isNotEmpty(maintenanceTaskVO.getDisposer())) {
String disposerName = Optional.ofNullable(maintenanceTaskVO.getDisposer()).map(s->{
List<String> disposerList = Arrays.stream(s.split(",")).collect(Collectors.toList());
return disposerList.stream().map(d ->{
User user = UserCache.getUser(Long.parseLong(d));
return Optional.ofNullable(user).map(User::getName).orElse("");
}).collect(Collectors.joining(","));
}).orElse("");
if (StringUtil.isNotBlank(disposerName)) {
resEntity.setDisposer(disposerName);
}
} }
resEntity.setDisposer(Optional.ofNullable(maintenanceTaskVO.getDisposerName()).orElse("")); // resEntity.setDisposer(Optional.ofNullable(maintenanceTaskVO.getDisposerName()).orElse(""));
resEntity.setPrincipal(Optional.ofNullable(maintenanceTaskVO.getContent()).orElse("")); resEntity.setPrincipal(Optional.ofNullable(maintenanceTaskVO.getWorkStandards()).orElse(""));
list.add(resEntity); return resEntity;
}catch (Exception e){
log.error("日常维护导出失败---》param"+maintenanceTaskVO+"报错信息:"+e.getStackTrace());
return resEntity;
} }
}).collect(Collectors.toList());
} }
return list; return list;
} }

16
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java

@ -12,7 +12,6 @@ import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity;
import com.hnac.hzims.ticket.allTicket.service.TicketInfoEvaluateService; import com.hnac.hzims.ticket.allTicket.service.TicketInfoEvaluateService;
import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO; import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO;
import com.hnac.hzims.ticket.allTicket.vo.DoublePassVO; import com.hnac.hzims.ticket.allTicket.vo.DoublePassVO;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO; import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO;
import com.hnac.hzims.ticket.areamonthly.feign.TicketFeignClient; import com.hnac.hzims.ticket.areamonthly.feign.TicketFeignClient;
import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketVo; import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketVo;
@ -847,16 +846,15 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
exportVO.setEndTime(Optional.ofNullable(DateUtil.format(standardTicketInfoEntity.getEndTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse("")); exportVO.setEndTime(Optional.ofNullable(DateUtil.format(standardTicketInfoEntity.getEndTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse(""));
exportVO.setIsEvaluate("未评价"); exportVO.setIsEvaluate("未评价");
if (ObjectUtils.isNotEmpty(standardTicketInfoEntity.getIsEvaluate())) { if (ObjectUtils.isNotEmpty(standardTicketInfoEntity.getIsEvaluate())) {
if (standardTicketInfoEntity.getIsEvaluate() == 1) { if (1==standardTicketInfoEntity.getIsEvaluate() ) {
TicketInfoEvaluateEntity ticketInfoEvaluateEntity = new TicketInfoEvaluateEntity(); TicketInfoEvaluateEntity evaluateEntity = ticketInfoEvaluateService.getOne(new LambdaQueryWrapper<TicketInfoEvaluateEntity>() {{
ticketInfoEvaluateEntity.setTicketId(standardTicketInfoEntity.getId()); eq(TicketInfoEvaluateEntity::getTicketId, standardTicketInfoEntity.getId());
R<List<TicketInfoEvaluateVO>> ticketList = ticketFeignClient.list(ticketInfoEvaluateEntity); }}.last(" limit 1"));
if (ticketList.isSuccess() && CollectionUtil.isNotEmpty(ticketList.getData())) { if ( ObjectUtil.isNotEmpty(evaluateEntity)) {
exportVO.setIsEvaluate(ticketList.getData().get(0).getStatus() == 1 ? "合格" : "不合格"); exportVO.setIsEvaluate(evaluateEntity.getStatus() == 1 ? "合格" : "不合格");
} }
} }
} }}catch (Exception e){
}catch (Exception e){
log.error("转换失败----》"+e.toString()+standardTicketInfoEntity.toString()); log.error("转换失败----》"+e.toString()+standardTicketInfoEntity.toString());
System.out.println("转换失败----》"+e.toString()+standardTicketInfoEntity.toString()); System.out.println("转换失败----》"+e.toString()+standardTicketInfoEntity.toString());
} }

12
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/controller/WorkTicketInfoController.java

@ -35,6 +35,7 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.SpringUtil; import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
import org.springframework.util.ObjectUtils;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -42,6 +43,9 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -134,6 +138,14 @@ public class WorkTicketInfoController {
= "工作票导出") = "工作票导出")
public void exportWorkTicket(HttpServletResponse response,@RequestBody WorkTicketInfoDto req) { public void exportWorkTicket(HttpServletResponse response,@RequestBody WorkTicketInfoDto req) {
try { try {
if(ObjectUtils.isEmpty(req.getStartTime())&&ObjectUtils.isEmpty(req.getEndTime())){
LocalDateTime date = LocalDateTime.now();
String nowDate = date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
String firstDate = firstDay.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
req.setStartTime(firstDate);
req.setEndTime(nowDate);
}
response.setContentType("application/vnd.ms-excel"); response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系

30
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java

@ -22,7 +22,6 @@ import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO;
import com.hnac.hzims.operational.maintenance.feign.ITaskClient; import com.hnac.hzims.operational.maintenance.feign.ITaskClient;
import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity; import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity;
import com.hnac.hzims.ticket.allTicket.service.TicketInfoEvaluateService; import com.hnac.hzims.ticket.allTicket.service.TicketInfoEvaluateService;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO;
import com.hnac.hzims.ticket.areamonthly.feign.TicketFeignClient; import com.hnac.hzims.ticket.areamonthly.feign.TicketFeignClient;
import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo; import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo;
import com.hnac.hzims.ticket.areamonthly.vo.StandardWorkVo; import com.hnac.hzims.ticket.areamonthly.vo.StandardWorkVo;
@ -116,10 +115,14 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
private final TicketInfoDangerService ticketInfoDangerService; private final TicketInfoDangerService ticketInfoDangerService;
private final IEmInfoClient emInfoClient; private final IEmInfoClient emInfoClient;
/** 生成两票编号锁 **/ /**
* 生成两票编号锁
**/
private Lock lock = new ReentrantLock(); private Lock lock = new ReentrantLock();
/** word模板预览导出保存路径 **/ /**
* word模板预览导出保存路径
**/
@Value("${hzims.ticket.path.xlsx.savePath}") @Value("${hzims.ticket.path.xlsx.savePath}")
private String xlsSavePath; private String xlsSavePath;
@ -1218,6 +1221,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
/** /**
* 工作票-关联数据 * 工作票-关联数据
*
* @param page * @param page
* @param business * @param business
* @return * @return
@ -1238,6 +1242,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
@Override @Override
public List<WorkTicketExportVO> exportWorkTicket(WorkTicketInfoDto req) { public List<WorkTicketExportVO> exportWorkTicket(WorkTicketInfoDto req) {
LambdaQueryWrapper<WorkTicketInfoEntity> lqw = this.getQueryWrapper(req); LambdaQueryWrapper<WorkTicketInfoEntity> lqw = this.getQueryWrapper(req);
if (ObjectUtil.isNotEmpty(req.getCreateDept())) { if (ObjectUtil.isNotEmpty(req.getCreateDept())) {
lqw.eq(WorkTicketInfoEntity::getCreateDept, req.getCreateDept()); lqw.eq(WorkTicketInfoEntity::getCreateDept, req.getCreateDept());
@ -1252,6 +1257,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
if (CollectionUtils.isNotEmpty(res)) { if (CollectionUtils.isNotEmpty(res)) {
// List<WorkTicketInfoVO> workTicketInfoVOS = WorkTicketInfoWrapper.build().listVO(res); // List<WorkTicketInfoVO> workTicketInfoVOS = WorkTicketInfoWrapper.build().listVO(res);
list = res.parallelStream().map(workTicketInfoVO -> { list = res.parallelStream().map(workTicketInfoVO -> {
try {
WorkTicketExportVO resEntity = new WorkTicketExportVO(); WorkTicketExportVO resEntity = new WorkTicketExportVO();
// resEntity.setNumber(i + 1); // resEntity.setNumber(i + 1);
resEntity.setCompany(Optional.ofNullable(workTicketInfoVO.getCompany()).orElse("")); resEntity.setCompany(Optional.ofNullable(workTicketInfoVO.getCompany()).orElse(""));
@ -1286,18 +1292,24 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
resEntity.setClassGroupMembers(Optional.ofNullable(workTicketInfoVO.getClassGroupMembersName()).orElse(workTicketInfoVO.getClassGroupMembersManual() == null ? "" : workTicketInfoVO.getClassGroupMembersManual())); resEntity.setClassGroupMembers(Optional.ofNullable(workTicketInfoVO.getClassGroupMembersName()).orElse(workTicketInfoVO.getClassGroupMembersManual() == null ? "" : workTicketInfoVO.getClassGroupMembersManual()));
resEntity.setCreateTime(Optional.ofNullable(DateUtil.format(workTicketInfoVO.getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse("")); resEntity.setCreateTime(Optional.ofNullable(DateUtil.format(workTicketInfoVO.getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse(""));
if (ObjectUtil.isNotEmpty(workTicketInfoVO.getConfirmWorkTime())) { if (ObjectUtil.isNotEmpty(workTicketInfoVO.getConfirmWorkTime())) {
resEntity.setConfirmWorkTime(Optional.ofNullable(DateUtil.format(workTicketInfoVO.getConfirmWorkTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse("")); resEntity.setConfirmWorkTime(Optional.ofNullable(DateUtil.format(workTicketInfoVO.getPlanEndTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse(""));
} }
resEntity.setIsEvaluate("未评价"); resEntity.setIsEvaluate("未评价");
if (workTicketInfoVO.getIsEvaluate() == 1) { if (ObjectUtil.isNotEmpty(workTicketInfoVO.getIsEvaluate())&&1==workTicketInfoVO.getIsEvaluate()) {
TicketInfoEvaluateEntity ticketInfoEvaluateEntity = new TicketInfoEvaluateEntity(); TicketInfoEvaluateEntity ticketInfoEvaluateEntity = new TicketInfoEvaluateEntity();
ticketInfoEvaluateEntity.setTicketId(workTicketInfoVO.getId()); TicketInfoEvaluateEntity evaluateEntity = ticketInfoEvaluateService.getOne(new LambdaQueryWrapper<TicketInfoEvaluateEntity>() {{
R<List<TicketInfoEvaluateVO>> ticketList = ticketFeignClient.list(ticketInfoEvaluateEntity); eq(TicketInfoEvaluateEntity::getTicketId, workTicketInfoVO.getId());
if (ticketList.isSuccess() && CollectionUtil.isNotEmpty(ticketList.getData())) { }}.last(" limit 1"));
resEntity.setIsEvaluate(ticketList.getData().get(0).getStatus() == 1 ? "合格" : "不合格"); if ( ObjectUtil.isNotEmpty(evaluateEntity)) {
resEntity.setIsEvaluate(evaluateEntity.getStatus() == 1 ? "合格" : "不合格");
} }
} }
return resEntity; return resEntity;
} catch (Exception e) {
System.out.println(e);
log.error("数据转换失败,参数:"+workTicketInfoVO+"报错信息:"+e);
return new WorkTicketExportVO();
}
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
return list; return list;

4
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/vo/WorkTicketExportVO.java

@ -71,9 +71,9 @@ public class WorkTicketExportVO {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String createTime; private String createTime;
@ExcelProperty(value = "工作票结束时间", index = 9) @ExcelProperty(value = "计划结束时间", index = 9)
@ColumnWidth(value = 20) @ColumnWidth(value = 20)
@ApiModelProperty("工作票结束时间") @ApiModelProperty("计划结束时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String confirmWorkTime; private String confirmWorkTime;

Loading…
Cancel
Save