Browse Source

运维公司第二版导出代码提交

zhongwei
tyty 12 months ago
parent
commit
26fb50b5a6
  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. 90
      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. 49
      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. 106
      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
public class MaintenanceExportVO {
@ExcelProperty(value = "序号", index = 0)
@ColumnWidth(value = 20)
@ApiModelProperty(value = "序号")
private Integer number;
// @ExcelProperty(value = "序号", index = 0)
// @ColumnWidth(value = 20)
// @ApiModelProperty(value = "序号")
// private Integer number;
@ExcelProperty(value = "单位", index = 1)
@ExcelProperty(value = "单位", index = 0)
@ColumnWidth(value = 20)
@ApiModelProperty(value = "单位")
private String company;
@ExcelProperty(value = "维护类型", index = 2)
@ExcelProperty(value = "维护类型", index =1)
@ColumnWidth(value = 20)
@ApiModelProperty(value = "维护类型")
private String typeCode;
@ExcelProperty(value = "维护设备", index = 3)
@ExcelProperty(value = "维护设备", index = 2)
@ColumnWidth(value = 20)
@ApiModelProperty(value = "维护设备")
private String refLibraryId;
@ApiModelProperty("维护内容")
@ExcelProperty(value = "维护内容", index = 4)
@ExcelProperty(value = "维护内容", index = 3)
@ColumnWidth(value = 20)
private String title;
@ExcelProperty(value = "计划执行时间", index = 5)
@ExcelProperty(value = "计划执行时间", index = 4)
@ColumnWidth(value = 20)
@ApiModelProperty("计划执行时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String planEndTime;
@ExcelProperty(value = "实际执行时间", index = 6)
@ExcelProperty(value = "实际执行时间", index = 5)
@ColumnWidth(value = 20)
@ApiModelProperty("实际执行时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ -55,14 +55,14 @@ public class MaintenanceExportVO {
private String executeTime;
@ExcelProperty(value = "执行人", index = 7)
@ExcelProperty(value = "执行人", index = 6)
@ColumnWidth(value = 20)
@ApiModelProperty(value = "执行人")
private String disposer;
@ExcelProperty(value = "执行情况", index = 8)
@ExcelProperty(value = "操作规范", index = 7)
@ColumnWidth(value = 20)
@ApiModelProperty(value = "执行情况")
@ApiModelProperty(value = "操作规范")
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
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)
@ApiModelProperty(value = "单位")
private String company;
@ExcelProperty(value = "巡检名称", index = 2)
@ExcelProperty(value = "巡检名称", index = 1)
@ColumnWidth(value = 20)
@ApiModelProperty(value = "巡检名称")
private String planName;
@ExcelProperty(value = "计划开始时间", index = 3)
@ExcelProperty(value = "计划开始时间", index = 2)
@ColumnWidth(value = 20)
@ApiModelProperty("计划开始时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String planStartTime;
@ExcelProperty(value = "计划结束时间", index = 4)
@ExcelProperty(value = "计划结束时间", index = 3)
@ColumnWidth(value = 20)
@ApiModelProperty("计划结束时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String planEndTime;
@ExcelProperty(value = "实际开始时间", index = 5)
@ExcelProperty(value = "实际开始时间", index =4)
@ColumnWidth(value = 20)
@ApiModelProperty("实际开始时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String startTime;
@ExcelProperty(value = "实际结束时间", index = 6)
@ExcelProperty(value = "实际结束时间", index = 5)
@ColumnWidth(value = 20)
@ApiModelProperty("实际结束时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ -58,21 +54,21 @@ public class InspectTaskExportVO {
private String endTime;
@ApiModelProperty("巡检时长(分钟)")
@ExcelProperty(value = "巡检时长(分钟)", index = 7)
@ExcelProperty(value = "巡检时长(分钟)", index = 6)
@ColumnWidth(value = 20)
private Long inspectTime;
@ApiModelProperty("巡检人")
@ExcelProperty(value = "巡检人", index = 8)
@ExcelProperty(value = "巡检人", index = 7)
@ColumnWidth(value = 20)
private String userName;
@ApiModelProperty("巡检情况")
@ExcelProperty(value = "巡检情况", index = 9)
@ExcelProperty(value = "巡检情况", index = 8)
@ColumnWidth(value = 20)
private String content;
@ApiModelProperty("巡检状态")
@ExcelProperty(value = "巡检状态", index = 10)
@ExcelProperty(value = "巡检状态", index = 9)
@ColumnWidth(value = 20)
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.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.time.temporal.TemporalAdjusters;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@ -152,6 +155,12 @@ public class TaskController extends BladeController {
@ApiOperation(value = "巡检任务导出", notes = "传入计划id")
public void exportTaskList(HttpServletResponse response,@RequestBody TaskDTO task) {
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.setCharacterEncoding("UTF-8");
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系

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

@ -1025,48 +1025,64 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
List<TaskEntity> taskEntities = super.baseMapper.selectList(queryWrapper);
List<InspectTaskExportVO> list=new ArrayList<>();
if (CollectionUtils.isNotEmpty(taskEntities)){
List<TaskVo> taskVos = getTaskVos(taskEntities);
for (int i = 0; i < taskVos.size(); i++) {
list=taskEntities.parallelStream().map(taskVo -> {
InspectTaskExportVO resEntity=new InspectTaskExportVO();
TaskVo taskVo = taskVos.get(i);
resEntity.setNumber(i+1);
if (ObjectUtil.isNotEmpty(taskVo.getCreateDept())){
R<Dept> dept = sysClient.getDept(taskVo.getCreateDept());
if (dept.isSuccess()&&ObjectUtil.isNotEmpty(dept.getData())){
resEntity.setCompany(Optional.ofNullable(dept.getData().getDeptName()).orElse(""));
try {
if (ObjectUtil.isNotEmpty(taskVo.getCreateDept())) {
R<Dept> dept = sysClient.getDept(taskVo.getCreateDept());
if (dept.isSuccess() && ObjectUtil.isNotEmpty(dept.getData())) {
resEntity.setCompany(Optional.ofNullable(dept.getData().getDeptName()).orElse(""));
}
}
resEntity.setPlanName(Optional.ofNullable(taskVo.getPlanName().toString()).orElse(""));
if (ObjectUtil.isNotEmpty(taskVo.getPlanStartTime())) {
resEntity.setPlanStartTime(Optional.ofNullable(DateUtil.format(taskVo.getPlanStartTime(), TaskContants.INSPECT_DATE_PATTERN)).orElse(""));
}
if (ObjectUtil.isNotEmpty(taskVo.getPlanEndTime())) {
resEntity.setPlanEndTime(Optional.ofNullable(DateUtil.format(taskVo.getPlanEndTime(), TaskContants.INSPECT_DATE_PATTERN)).orElse(""));
}
if (ObjectUtil.isNotEmpty(taskVo.getStartTime())) {
resEntity.setStartTime(Optional.ofNullable(DateUtil.format(taskVo.getStartTime(), TaskContants.INSPECT_DATE_PATTERN)).orElse(""));
}
if (ObjectUtil.isNotEmpty(taskVo.getEndTime())) {
resEntity.setEndTime(Optional.ofNullable(DateUtil.format(taskVo.getEndTime(), TaskContants.INSPECT_DATE_PATTERN)).orElse(""));
}
}
resEntity.setPlanName(Optional.ofNullable( taskVo.getPlanName().toString()).orElse(""));
if (ObjectUtil.isNotEmpty(taskVo.getPlanStartTime())){
resEntity.setPlanStartTime(Optional.ofNullable(DateUtil.format(taskVo.getPlanStartTime(),TaskContants.INSPECT_DATE_PATTERN)).orElse(""));
}
if (ObjectUtil.isNotEmpty(taskVo.getPlanEndTime())){
resEntity.setPlanEndTime(Optional.ofNullable(DateUtil.format(taskVo.getPlanEndTime(),TaskContants.INSPECT_DATE_PATTERN)).orElse(""));
}
if (ObjectUtil.isNotEmpty(taskVo.getStartTime())){
resEntity.setStartTime(Optional.ofNullable(DateUtil.format(taskVo.getStartTime(),TaskContants.INSPECT_DATE_PATTERN)).orElse(""));
}
if (ObjectUtil.isNotEmpty(taskVo.getEndTime())){
resEntity.setEndTime(Optional.ofNullable(DateUtil.format(taskVo.getEndTime(),TaskContants.INSPECT_DATE_PATTERN)).orElse(""));
}
if (ObjectUtil.isNotEmpty(taskVo.getStartTime())&&ObjectUtil.isNotEmpty(taskVo.getEndTime())) {
long l = DateUtil.between(taskVo.getStartTime(), taskVo.getEndTime()).toMinutes();
resEntity.setInspectTime(Optional.ofNullable(l).orElse(0L));
}
if (ObjectUtil.isNotEmpty(taskVo.getStartTime()) && ObjectUtil.isNotEmpty(taskVo.getEndTime())) {
long l = DateUtil.between(taskVo.getStartTime(), taskVo.getEndTime()).toMinutes();
resEntity.setInspectTime(Optional.ofNullable(l).orElse(0L));
}
LambdaQueryWrapper<EventEntity> queryWrapper2 = Wrappers.<EventEntity>lambdaQuery().eq(EventEntity::getTaskId,taskVo.getId()).orderByDesc(EventEntity::getCreateTime);
List<EventEntity> eventEntities = eventService.list(queryWrapper2 );
List<String> collect = eventEntities.stream().map(EventEntity::getIsProblem).collect(Collectors.toList());
if (collect.contains("1")) {
resEntity.setContent("不正常");
}else {
resEntity.setContent("正常");
LambdaQueryWrapper<EventEntity> queryWrapper2 = Wrappers.<EventEntity>lambdaQuery().eq(EventEntity::getTaskId, taskVo.getId()).orderByDesc(EventEntity::getCreateTime);
List<EventEntity> eventEntities = eventService.list(queryWrapper2);
List<String> collect = eventEntities.stream().map(EventEntity::getIsProblem).collect(Collectors.toList());
if (collect.contains("1")) {
resEntity.setContent("不正常");
} else {
resEntity.setContent("正常");
}
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(""));
return resEntity;
}catch (Exception e){
log.error("巡检导出失败---》param"+taskVo+"报错信息:"+e.getStackTrace());
return resEntity;
}
resEntity.setUserName(Optional.ofNullable( taskVo.getUserNames()).orElse(""));
resEntity.setStatus(Optional.ofNullable(DictCache.getValue(TaskContants.TASK_STATUS, taskVo.getStatus())).orElse(""));
list.add(resEntity);
}
}).collect(Collectors.toList());
}
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.ObjectUtil;
import org.springblade.flow.core.vo.ComleteTask;
import org.springframework.util.ObjectUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -41,6 +42,9 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
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.HashMap;
import java.util.List;
@ -130,6 +134,14 @@ public class OperMaintenanceTaskController extends BladeController {
= "日常维护记录导出")
public void exportMaintenance(HttpServletResponse response,@RequestBody OperMaintenanceTaskDTO req) {
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.setCharacterEncoding("UTF-8");
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系

49
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.extension.plugins.pagination.Page;
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.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.mapper.OperPhenomenonMapper;
@ -75,7 +77,7 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
private final OperPhenomenonMapper operPhenomenonMapper;
private final IFlowClient flowClient;
private final IUserClient userClient;
private final IEmInfoClient emInfoClient;
private final ISysClient sysClient;
@Override
@ -460,11 +462,9 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
List<OperMaintenanceTaskEntity> maintenanceTaskEntities = super.baseMapper.selectList(queryWrapper);
List<MaintenanceExportVO> list=new ArrayList<>();
if (CollectionUtil.isNotEmpty(maintenanceTaskEntities)){
List<OperMaintenanceTaskVO> operMaintenanceTaskVOS = OperMaintenanceTaskWrapper.build().listVO(maintenanceTaskEntities);
for (int i = 0; i < operMaintenanceTaskVOS.size(); i++) {
list = maintenanceTaskEntities.parallelStream().map(maintenanceTaskVO -> {
MaintenanceExportVO resEntity=new MaintenanceExportVO();
OperMaintenanceTaskVO maintenanceTaskVO = operMaintenanceTaskVOS.get(i);
resEntity.setNumber(i+1);
try {
if (ObjectUtil.isNotEmpty(maintenanceTaskVO.getCreateDept())){
R<Dept> dept = sysClient.getDept(maintenanceTaskVO.getCreateDept());
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.setRefLibraryId(Optional.ofNullable( maintenanceTaskVO.getRefLibraryId().toString()).orElse(""));
resEntity.setTitle(Optional.ofNullable( maintenanceTaskVO.getTitle()).orElse(""));
if (StringUtil.isNotBlank(maintenanceTaskVO.getEmCode())){
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())) {
resEntity.setPlanEndTime(Optional.ofNullable(DateUtil.format(maintenanceTaskVO.getPlanEndTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse(""));
}
if (ObjectUtil.isNotEmpty(maintenanceTaskVO.getExecuteTime())) {
resEntity.setExecuteTime(Optional.ofNullable(DateUtil.format(maintenanceTaskVO.getExecuteTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse(""));
if (ObjectUtil.isNotEmpty(maintenanceTaskVO.getDisposeTime())) {
resEntity.setExecuteTime(Optional.ofNullable(DateUtil.format(maintenanceTaskVO.getDisposeTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse(""));
}
resEntity.setDisposer(Optional.ofNullable(maintenanceTaskVO.getDisposerName()).orElse(""));
resEntity.setPrincipal(Optional.ofNullable(maintenanceTaskVO.getContent()).orElse(""));
list.add(resEntity);
}
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.setPrincipal(Optional.ofNullable(maintenanceTaskVO.getWorkStandards()).orElse(""));
return resEntity;
}catch (Exception e){
log.error("日常维护导出失败---》param"+maintenanceTaskVO+"报错信息:"+e.getStackTrace());
return resEntity;
}
}).collect(Collectors.toList());
}
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.vo.DoublePassRateVO;
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.areamonthly.feign.TicketFeignClient;
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.setIsEvaluate("未评价");
if (ObjectUtils.isNotEmpty(standardTicketInfoEntity.getIsEvaluate())) {
if (standardTicketInfoEntity.getIsEvaluate() == 1) {
TicketInfoEvaluateEntity ticketInfoEvaluateEntity = new TicketInfoEvaluateEntity();
ticketInfoEvaluateEntity.setTicketId(standardTicketInfoEntity.getId());
R<List<TicketInfoEvaluateVO>> ticketList = ticketFeignClient.list(ticketInfoEvaluateEntity);
if (ticketList.isSuccess() && CollectionUtil.isNotEmpty(ticketList.getData())) {
exportVO.setIsEvaluate(ticketList.getData().get(0).getStatus() == 1 ? "合格" : "不合格");
if (1==standardTicketInfoEntity.getIsEvaluate() ) {
TicketInfoEvaluateEntity evaluateEntity = ticketInfoEvaluateService.getOne(new LambdaQueryWrapper<TicketInfoEvaluateEntity>() {{
eq(TicketInfoEvaluateEntity::getTicketId, standardTicketInfoEntity.getId());
}}.last(" limit 1"));
if ( ObjectUtil.isNotEmpty(evaluateEntity)) {
exportVO.setIsEvaluate(evaluateEntity.getStatus() == 1 ? "合格" : "不合格");
}
}
}
}catch (Exception e){
}}catch (Exception e){
log.error("转换失败----》"+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.StringUtil;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.util.ObjectUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -42,6 +43,9 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
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.List;
import java.util.Map;
@ -134,6 +138,14 @@ public class WorkTicketInfoController {
= "工作票导出")
public void exportWorkTicket(HttpServletResponse response,@RequestBody WorkTicketInfoDto req) {
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.setCharacterEncoding("UTF-8");
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系

106
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.ticket.allTicket.entity.TicketInfoEvaluateEntity;
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.vo.StandardTicketWithAreaVo;
import com.hnac.hzims.ticket.areamonthly.vo.StandardWorkVo;
@ -116,10 +115,14 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
private final TicketInfoDangerService ticketInfoDangerService;
private final IEmInfoClient emInfoClient;
/** 生成两票编号锁 **/
/**
* 生成两票编号锁
**/
private Lock lock = new ReentrantLock();
/** word模板预览导出保存路径 **/
/**
* word模板预览导出保存路径
**/
@Value("${hzims.ticket.path.xlsx.savePath}")
private String xlsSavePath;
@ -1033,7 +1036,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
}
}
workTicketInfo.setClassGroupMembersName(Optional.ofNullable(workTicketInfo.getClassGroupMembersManual()).filter(StringUtil::isNotBlank).orElse(workTicketInfo.getClassGroupMembersName()));
if(Func.isNotEmpty(workTicketInfo.getClassGroupMembersManual())) {
if (Func.isNotEmpty(workTicketInfo.getClassGroupMembersManual())) {
workTicketInfo.setTotalPerson(workTicketInfo.getClassGroupMembersManual().split(",").length);
}
//负责人名称
@ -1218,6 +1221,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
/**
* 工作票-关联数据
*
* @param page
* @param business
* @return
@ -1227,17 +1231,18 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
QueryWrapper<WorkTicketInfoEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.ge(Func.isNotEmpty(business.getStartTime()), "works.create_time", business.getStartTime());
queryWrapper.le(Func.isNotEmpty(business.getEndTime()), "works.create_time", business.getEndTime());
queryWrapper.in(Func.isNotEmpty(business.getDeptIds()), "works.create_dept",Func.toLongList(",",business.getDeptIds()));
queryWrapper.in(Func.isNotEmpty(business.getDeptIds()), "works.create_dept", Func.toLongList(",", business.getDeptIds()));
queryWrapper.like(Func.isNotEmpty(business.getCode()), "works.code", business.getCode());
queryWrapper.eq(Func.isNotEmpty(business.getType()), "works.type", business.getType());
queryWrapper.eq(Func.isNotEmpty(business.getStatus()), "eva.status", business.getStatus());
IPage pages = this.baseMapper.pageCondition(page,queryWrapper);
IPage pages = this.baseMapper.pageCondition(page, queryWrapper);
pages.setRecords(WorkTicketInfoWrapper.build().listVO(pages.getRecords()));
return pages;
}
@Override
public List<WorkTicketExportVO> exportWorkTicket(WorkTicketInfoDto req) {
LambdaQueryWrapper<WorkTicketInfoEntity> lqw = this.getQueryWrapper(req);
if (ObjectUtil.isNotEmpty(req.getCreateDept())) {
lqw.eq(WorkTicketInfoEntity::getCreateDept, req.getCreateDept());
@ -1251,53 +1256,60 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
List<WorkTicketExportVO> list = new ArrayList<>();
if (CollectionUtils.isNotEmpty(res)) {
// List<WorkTicketInfoVO> workTicketInfoVOS = WorkTicketInfoWrapper.build().listVO(res);
list= res.parallelStream().map(workTicketInfoVO -> {
WorkTicketExportVO resEntity = new WorkTicketExportVO();
list = res.parallelStream().map(workTicketInfoVO -> {
try {
WorkTicketExportVO resEntity = new WorkTicketExportVO();
// resEntity.setNumber(i + 1);
resEntity.setCompany(Optional.ofNullable(workTicketInfoVO.getCompany()).orElse(""));
resEntity.setType(Optional.ofNullable(DictCache.getValue(TicketConstants.TICKET_TYPE, workTicketInfoVO.getType())).orElse(""));
resEntity.setCode(Optional.ofNullable(workTicketInfoVO.getCode()).orElse(""));
resEntity.setWorkContent(Optional.ofNullable(workTicketInfoVO.getWorkContent()).orElse(""));
if (ObjectUtil.isNotEmpty(workTicketInfoVO.getSigner())) {
User user = UserCache.getUser(workTicketInfoVO.getSigner());
if (ObjectUtil.isNotEmpty(user)) {
resEntity.setSigner(user.getName());
resEntity.setCompany(Optional.ofNullable(workTicketInfoVO.getCompany()).orElse(""));
resEntity.setType(Optional.ofNullable(DictCache.getValue(TicketConstants.TICKET_TYPE, workTicketInfoVO.getType())).orElse(""));
resEntity.setCode(Optional.ofNullable(workTicketInfoVO.getCode()).orElse(""));
resEntity.setWorkContent(Optional.ofNullable(workTicketInfoVO.getWorkContent()).orElse(""));
if (ObjectUtil.isNotEmpty(workTicketInfoVO.getSigner())) {
User user = UserCache.getUser(workTicketInfoVO.getSigner());
if (ObjectUtil.isNotEmpty(user)) {
resEntity.setSigner(user.getName());
}
}
}
//负责人-线上和线下
if (Func.isEmpty(workTicketInfoVO.getPrincipal())) {
resEntity.setPrincipal(workTicketInfoVO.getPrincipalManual());
} else {
User principal = UserCache.getUser(workTicketInfoVO.getPrincipal());
if (ObjectUtil.isNotEmpty(principal)) {
resEntity.setPrincipal(principal.getName());
//负责人-线上和线下
if (Func.isEmpty(workTicketInfoVO.getPrincipal())) {
resEntity.setPrincipal(workTicketInfoVO.getPrincipalManual());
} else {
User principal = UserCache.getUser(workTicketInfoVO.getPrincipal());
if (ObjectUtil.isNotEmpty(principal)) {
resEntity.setPrincipal(principal.getName());
}
}
}
if (ObjectUtil.isNotEmpty(workTicketInfoVO.getLicensor())) {
User user = UserCache.getUser(workTicketInfoVO.getLicensor());
if (ObjectUtil.isNotEmpty(user)) {
resEntity.setLicensor(user.getName());
if (ObjectUtil.isNotEmpty(workTicketInfoVO.getLicensor())) {
User user = UserCache.getUser(workTicketInfoVO.getLicensor());
if (ObjectUtil.isNotEmpty(user)) {
resEntity.setLicensor(user.getName());
}
}
}
workTicketInfoVO.setClassGroupMembersName(workTicketInfoVO.getClassGroupMembers());
if(Func.isNotEmpty(workTicketInfoVO.getClassGroupMembersManual())){
workTicketInfoVO.setClassGroupMembersName(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(""));
if (ObjectUtil.isNotEmpty(workTicketInfoVO.getConfirmWorkTime())) {
resEntity.setConfirmWorkTime(Optional.ofNullable(DateUtil.format(workTicketInfoVO.getConfirmWorkTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse(""));
}
resEntity.setIsEvaluate("未评价");
if (workTicketInfoVO.getIsEvaluate() == 1) {
TicketInfoEvaluateEntity ticketInfoEvaluateEntity = new TicketInfoEvaluateEntity();
ticketInfoEvaluateEntity.setTicketId(workTicketInfoVO.getId());
R<List<TicketInfoEvaluateVO>> ticketList = ticketFeignClient.list(ticketInfoEvaluateEntity);
if (ticketList.isSuccess() && CollectionUtil.isNotEmpty(ticketList.getData())) {
resEntity.setIsEvaluate(ticketList.getData().get(0).getStatus() == 1 ? "合格" : "不合格");
workTicketInfoVO.setClassGroupMembersName(workTicketInfoVO.getClassGroupMembers());
if (Func.isNotEmpty(workTicketInfoVO.getClassGroupMembersManual())) {
workTicketInfoVO.setClassGroupMembersName(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(""));
if (ObjectUtil.isNotEmpty(workTicketInfoVO.getConfirmWorkTime())) {
resEntity.setConfirmWorkTime(Optional.ofNullable(DateUtil.format(workTicketInfoVO.getPlanEndTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse(""));
}
resEntity.setIsEvaluate("未评价");
if (ObjectUtil.isNotEmpty(workTicketInfoVO.getIsEvaluate())&&1==workTicketInfoVO.getIsEvaluate()) {
TicketInfoEvaluateEntity ticketInfoEvaluateEntity = new TicketInfoEvaluateEntity();
TicketInfoEvaluateEntity evaluateEntity = ticketInfoEvaluateService.getOne(new LambdaQueryWrapper<TicketInfoEvaluateEntity>() {{
eq(TicketInfoEvaluateEntity::getTicketId, workTicketInfoVO.getId());
}}.last(" limit 1"));
if ( ObjectUtil.isNotEmpty(evaluateEntity)) {
resEntity.setIsEvaluate(evaluateEntity.getStatus() == 1 ? "合格" : "不合格");
}
}
return resEntity;
} catch (Exception e) {
System.out.println(e);
log.error("数据转换失败,参数:"+workTicketInfoVO+"报错信息:"+e);
return new WorkTicketExportVO();
}
return resEntity;
}).collect(Collectors.toList());
}
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")
private String createTime;
@ExcelProperty(value = "工作票结束时间", index = 9)
@ExcelProperty(value = "计划结束时间", index = 9)
@ColumnWidth(value = 20)
@ApiModelProperty("工作票结束时间")
@ApiModelProperty("计划结束时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String confirmWorkTime;

Loading…
Cancel
Save