diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperDefectStatisticsExportVO.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperDefectStatisticsExportVO.java index c547c00..6289fed 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperDefectStatisticsExportVO.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperDefectStatisticsExportVO.java @@ -18,30 +18,30 @@ import java.util.Date; public class OperDefectStatisticsExportVO { private static final long serialVersionUID = 8239436726489738763L; - @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 deptName; - @ExcelProperty(value = "缺陷编码", index = 2) + @ExcelProperty(value = "缺陷编码", index = 1) @ColumnWidth(value = 20) @ApiModelProperty(value = "缺陷编码") private String defectCode; - @ExcelProperty(value = "记录人", index = 3) + @ExcelProperty(value = "发现人", index = 2) @ColumnWidth(value = 20) @ApiModelProperty(value = "缺陷发现人") private String finderName; - @ApiModelProperty("记录时间") - @ExcelProperty(value = "记录时间", index = 4) + @ApiModelProperty("创建时间") + @ExcelProperty(value = "创建时间", index = 3) @ColumnWidth(value = 20) @DateTimeFormat( pattern = "yyyy-MM-dd HH:mm:ss" @@ -52,18 +52,18 @@ public class OperDefectStatisticsExportVO { private Date findTime; - @ExcelProperty(value = "缺陷描述", index = 5) + @ExcelProperty(value = "缺陷名称", index = 4) @ColumnWidth(value = 20) - @ApiModelProperty(value = "现象描述") - private String descripiton; + @ApiModelProperty(value = "缺陷名称") + private String faultName; - @ExcelProperty(value = "缺陷等级", index = 6) + @ExcelProperty(value = "缺陷等级", index = 5) @ColumnWidth(value = 20) @ApiModelProperty(value = "缺陷等级, 字段key: defectLevel") private String defectLevel; - @ExcelProperty(value = "处理时间", index = 7) + @ExcelProperty(value = "处理时间", index = 6) @ColumnWidth(value = 20) @DateTimeFormat( pattern = "yyyy-MM-dd HH:mm:ss" @@ -74,7 +74,7 @@ public class OperDefectStatisticsExportVO { @ApiModelProperty(value = "处理时间") private Date actStartTime; - @ExcelProperty(value = "处理人", index = 8) + @ExcelProperty(value = "处理人", index = 7) @ColumnWidth(value = 20) @ApiModelProperty(value = "消缺处理人") private String planHandler; @@ -84,13 +84,13 @@ public class OperDefectStatisticsExportVO { // @ApiModelProperty(value = "消缺处理人") // private String planHandlerId; - @ExcelProperty(value = "处理结果", index = 9) + @ExcelProperty(value = "处理描述", index = 8) @ColumnWidth(value = 20) @ApiModelProperty(value = "处理描述") private String disposeDesc; - @ExcelProperty(value = "关联工作票编码", index = 10) + @ExcelProperty(value = "关联工作票编码", index = 9) @ColumnWidth(value = 20) @ApiModelProperty(value = "操作票") private String ticketId; diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/feign/ITicketInfoClient.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/feign/ITicketInfoClient.java index d19f1d0..96f07b1 100644 --- a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/feign/ITicketInfoClient.java +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/feign/ITicketInfoClient.java @@ -29,6 +29,7 @@ public interface ITicketInfoClient { String UPDATE_UNDONE_STATUS = API_PREFIX + "/updateUndoneStatus"; String GET_WORK_TICKET_BY_TIME = API_PREFIX + "/getWorkTicketByTime"; String GET_OPERATE_TICKET_BY_TIME = API_PREFIX + "/getOperateTicketByTime"; + String GET_OPERATE_TICKET_INFO_BY_IDS = API_PREFIX + "/getWorkTicketInfoById"; String GET_TICKET_PASS_BY_IDS = API_PREFIX + "/getTicketPassByIds"; String GET_WORK_TICKET_TRANSFER = API_PREFIX + "/getWorkTicketTransfer"; String GET_WORK_TICKET_STATISTIC = API_PREFIX + "/getWorkTicketStatistic"; @@ -62,6 +63,9 @@ public interface ITicketInfoClient { @GetMapping(GET_OPERATE_TICKET_BY_TIME) R> getOperateTicketByTime(@RequestParam String startDate, @RequestParam String endDate); + @GetMapping(GET_OPERATE_TICKET_INFO_BY_IDS) + R> getWorkTicketInfoById(@RequestParam List ticekeIds); + /** * 获取操作票的合格率 * @param ticekeIds diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/feign/TicketInfoClientFallback.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/feign/TicketInfoClientFallback.java index a9f2c50..aa58b72 100644 --- a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/feign/TicketInfoClientFallback.java +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/feign/TicketInfoClientFallback.java @@ -32,7 +32,10 @@ public class TicketInfoClientFallback implements ITicketInfoClient { public R> getOperateTicketByTime(String startDate, String endDate) { return R.fail("查询失败!"); } - + @Override + public R> getWorkTicketInfoById(List ticekeIds) { + return R.fail("查询失败!"); + } @Override public R getTicketPassByIds(@RequestParam List ticekeIds) { return R.fail("查询失败!"); diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java index b03f678..ecb676c 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java @@ -2,6 +2,7 @@ package com.hnac.hzims.message.controller; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.hzims.common.logs.annotation.OperationAnnotation; @@ -97,7 +98,7 @@ public class MessagePushRecordController extends BladeController { .eq(MessagePushRecordEntity::getPusher, AuthUtil.getUserId()) .eq(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS) .eq(Func.isNotEmpty(businessClassify),MessagePushRecordEntity::getBusinessClassify,businessClassify) - .eq(Func.isNotEmpty(type),MessagePushRecordEntity::getType,type); + .eq(StringUtils.isNotBlank(type),MessagePushRecordEntity::getType,type); return R.status(messagePushRecordService.update(eq)); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java index 3d9f70c..84011b6 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java @@ -35,6 +35,10 @@ 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.ZoneId; +import java.time.temporal.TemporalAdjusters; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -110,6 +114,13 @@ public class OperDefectStatisticsController extends BladeController { = "缺陷数据导出") public void exportDefectList(HttpServletResponse response,@RequestBody OperDefectStatisticsVO entity) { try { + long timeMillis = System.currentTimeMillis(); + if(ObjectUtil.isEmpty(entity.getCreateTime())&&ObjectUtil.isEmpty(entity.getCreateEndTime())){ + LocalDateTime date = LocalDateTime.now(); + LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0); + entity.setCreateTime(Date.from(firstDay.atZone(ZoneId.systemDefault()).toInstant())); + entity.setCreateEndTime(new Date()); + } response.setContentType("application/vnd.ms-excel"); response.setCharacterEncoding("UTF-8"); // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 @@ -117,7 +128,11 @@ public class OperDefectStatisticsController extends BladeController { response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); LambdaQueryWrapper queryWrapper = statisticsService.getQueryWrapper(entity); List list = statisticsService.list(queryWrapper); + long timeMillis1 =System.currentTimeMillis()- timeMillis; + System.out.println("查询对应实例类耗时============================"+ timeMillis1); List defectStatisticsExportVO = statisticsService.getDefectStatisticsExportVO(list); + long timeMillis2 =System.currentTimeMillis()- timeMillis; + System.out.println("参数转换耗时============================"+ timeMillis2); if(defectStatisticsExportVO!=null && defectStatisticsExportVO.size()>0){ System.out.println("---------------- size = " + defectStatisticsExportVO.size()); // 这里需要设置不关闭流 diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectStatisticsServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectStatisticsServiceImpl.java index 8f07eea..ba001b9 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectStatisticsServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectStatisticsServiceImpl.java @@ -12,20 +12,25 @@ import com.hnac.hzims.operational.defect.vo.OperDefectStatisticsExportVO; import com.hnac.hzims.operational.defect.vo.OperDefectStatisticsVO; import com.hnac.hzims.operational.defect.vo.StatistictCount; import com.hnac.hzims.operational.defect.vo.StatistictCountVo; +import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; +import com.hnac.hzims.ticket.workTicket.feign.ITicketInfoClient; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.support.Condition; import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.Func; import org.springblade.system.cache.DictCache; -import org.springblade.system.entity.Dept; import org.springblade.system.feign.ISysClient; +import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; import org.springblade.system.user.feign.IUserClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; /** * 服务实现类 @@ -40,6 +45,8 @@ public class OperDefectStatisticsServiceImpl extends BaseServiceImpl getDefectStatisticsExportVO(List list) { - List res=new ArrayList<>(); - if(list!=null && list.size()>0){ - for (int i = 0; i < list.size(); i++) { - OperDefectStatisticsExportVO operDefectStatisticsExportVO = new OperDefectStatisticsExportVO(); - operDefectStatisticsExportVO.setNumber(i+1); - OperDefectStatisticsEntity entity = list.get(i); - Long createDept = entity.getCreateDept(); - R dept = sysClient.getDept(createDept); - if (dept.isSuccess()&& ObjectUtils.isNotEmpty(dept.getData())){ - operDefectStatisticsExportVO.setDeptName(dept.getData().getDeptName()); - } - operDefectStatisticsExportVO.setDefectCode(entity.getDefectCode()); - if (ObjectUtils.isNotEmpty(entity.getFinder())) { - R finderUser = userClient.userInfoById(entity.getFinder()); - if (finderUser.isSuccess() && ObjectUtils.isNotEmpty(finderUser.getData())) { - operDefectStatisticsExportVO.setFinderName(finderUser.getData().getName()); - } - } - if (StringUtils.isNotBlank(entity.getPlanHandler())) { - R planHandlerUser = userClient.userInfoById(Long.valueOf(entity.getPlanHandler())); - if (planHandlerUser.isSuccess() && ObjectUtils.isNotEmpty(planHandlerUser.getData())) { - operDefectStatisticsExportVO.setPlanHandler(planHandlerUser.getData().getName()); + if (list != null && list.size() > 0) { + List defectLevel = list.parallelStream().map(entity -> { + OperDefectStatisticsExportVO operDefectStatisticsExportVO = new OperDefectStatisticsExportVO(); + Long createDept = entity.getCreateDept(); + R deptName = sysClient.getDeptName(createDept); + if (deptName.isSuccess() && ObjectUtils.isNotEmpty(deptName.getData())) { + operDefectStatisticsExportVO.setDeptName(deptName.getData()); + } + operDefectStatisticsExportVO.setDefectCode(entity.getDefectCode()); + if (ObjectUtils.isNotEmpty(entity.getFinder())) { + User user = UserCache.getUser(entity.getFinder()); + if (ObjectUtils.isNotEmpty(user)) { + operDefectStatisticsExportVO.setFinderName(user.getName()); + } +// R finderUser = userClient.userInfoById(entity.getFinder()); +// if (finderUser.isSuccess() && ObjectUtils.isNotEmpty(finderUser.getData())) { +// operDefectStatisticsExportVO.setFinderName(finderUser.getData().getName()); +// } + } + if (StringUtils.isNotBlank(entity.getPlanHandler())) { + User user = UserCache.getUser(Long.valueOf(entity.getPlanHandler())); + if (ObjectUtils.isNotEmpty(user)) { + operDefectStatisticsExportVO.setPlanHandler(user.getName()); + } +// R planHandlerUser = userClient.userInfoById(Long.valueOf(entity.getPlanHandler())); +// if (planHandlerUser.isSuccess() && ObjectUtils.isNotEmpty(planHandlerUser.getData())) { +// operDefectStatisticsExportVO.setPlanHandler(planHandlerUser.getData().getName()); +// } + } + if (ObjectUtils.isNotEmpty(entity.getFindTime())) { + operDefectStatisticsExportVO.setFindTime(entity.getFindTime()); + } + if (StringUtils.isNotBlank(entity.getFaultName())) { + operDefectStatisticsExportVO.setFaultName(entity.getFaultName()); + } + if (StringUtils.isNotBlank(entity.getDefectLevel())) { + String level = DictCache.getValue("defectLevel", entity.getDefectLevel()); + operDefectStatisticsExportVO.setDefectLevel(level); + } + if (ObjectUtils.isNotEmpty(entity.getActStartTime())) { + operDefectStatisticsExportVO.setActStartTime(entity.getActStartTime()); + } + if (StringUtils.isNotBlank(entity.getDisposeDesc())) { + operDefectStatisticsExportVO.setDisposeDesc(entity.getDisposeDesc()); + } + if (StringUtils.isNotBlank(entity.getTicketId())) { + R> workTicketInfoById = iTicketInfoClient.getWorkTicketInfoById(Arrays.asList(Long.valueOf(entity.getTicketId()))); + if (workTicketInfoById.isSuccess()&&CollectionUtil.isNotEmpty(workTicketInfoById.getData())) { + //获取工作票的编码Id + operDefectStatisticsExportVO.setTicketId(workTicketInfoById.getData().get(0).getCode()); + } + } + return operDefectStatisticsExportVO; } - } - if (ObjectUtils.isNotEmpty(entity.getFindTime())) { - operDefectStatisticsExportVO.setFindTime(entity.getFindTime()); - } - if (StringUtils.isNotBlank(entity.getDescripiton())) { - operDefectStatisticsExportVO.setDescripiton(entity.getDescripiton()); - } - if (StringUtils.isNotBlank(entity.getDefectLevel())) { - String level = DictCache.getValue("defectLevel",entity.getDefectLevel()); - operDefectStatisticsExportVO.setDefectLevel(level); - } - if (ObjectUtils.isNotEmpty(entity.getActStartTime())) { - operDefectStatisticsExportVO.setActStartTime(entity.getActStartTime()); - } - if (StringUtils.isNotBlank(entity.getDisposeDesc())) { - operDefectStatisticsExportVO.setDisposeDesc(entity.getDisposeDesc()); - } - if (StringUtils.isNotBlank(entity.getTicketId())) { - operDefectStatisticsExportVO.setTicketId(entity.getTicketId()); - } - res.add(operDefectStatisticsExportVO); - } + ).collect(Collectors.toList()); + return defectLevel; + } else { + return new ArrayList<>(); } - return res; } } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java index c646aa8..4f79472 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java @@ -33,12 +33,15 @@ import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.flow.core.vo.ComleteTask; import org.springframework.cloud.openfeign.SpringQueryMap; +import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.io.IOException; import java.net.URLEncoder; +import java.time.LocalDateTime; +import java.time.temporal.TemporalAdjusters; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -103,6 +106,12 @@ public class StandardTicketInfoController extends BladeController { = "操作票导出") public void exportStandardTicket(HttpServletResponse response,@RequestBody StandardTicketInfoDto req) { try { + if(ObjectUtils.isEmpty(req.getStartTime())&&ObjectUtils.isEmpty(req.getEndTime())){ + LocalDateTime date = LocalDateTime.now(); + LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0); + req.setStartTime(firstDay); + req.setEndTime(date); + } response.setContentType("application/vnd.ms-excel"); response.setCharacterEncoding("UTF-8"); // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java index 9456767..6e34475 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java @@ -12,7 +12,9 @@ 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; import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo; import com.hnac.hzims.ticket.constants.DictConstants; @@ -82,6 +84,9 @@ import java.util.stream.Collectors; public class StandardTicketInfoServiceImpl extends BaseServiceImpl implements IStandardTicketInfoService { private final IStandardTicketMeasureService standardTicketMeasureService; + + private final TicketFeignClient ticketFeignClient; + private final IFlowClient flowClient; private final IStandardTicketMeasureService measureService; private final IWorkTicketInfoService iWorkTicketInfoService; @@ -807,27 +812,59 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl standardTicketInfoEntities = super.baseMapper.selectList(queryWrapper); List list=new ArrayList<>(); if (CollectionUtils.isNotEmpty(standardTicketInfoEntities)){ - List standardTicketInfoVOS = StandardTicketInfoWrapper.build().listVO(standardTicketInfoEntities); - for (int i = 0; i < standardTicketInfoVOS.size(); i++) { - StandardTicketExportVO exportVO=new StandardTicketExportVO(); - StandardTicketInfoVO standardTicketInfoEntity = standardTicketInfoVOS.get(i); - exportVO.setNumber(i+1); - exportVO.setCompany( Optional.ofNullable(standardTicketInfoEntity.getCompany()).orElse(null)); - exportVO.setTicketType(Optional.ofNullable(DictCache.getValue(TicketConstants.TICKET_TYPE,standardTicketInfoEntity.getTicketType())).orElse(null)); - exportVO.setCode(Optional.ofNullable(standardTicketInfoEntity.getCode()).orElse(null)); - exportVO.setTitle(Optional.ofNullable(standardTicketInfoEntity.getTitle()).orElse(null)); - exportVO.setIssueOrderPerson(Optional.ofNullable(standardTicketInfoEntity.getIssueOrderPersonName()).orElse(null)); - exportVO.setAccessOrderPerson(Optional.ofNullable(standardTicketInfoEntity.getAccessOrderPersonName()).orElse(null)); - exportVO.setGuardian(Optional.ofNullable(standardTicketInfoEntity.getGuardianName()).orElse(null)); - exportVO.setPrincipal(Optional.ofNullable(standardTicketInfoEntity.getPrincipalName()).orElse(null)); - exportVO.setStartTime(Optional.ofNullable(DateUtil.format(standardTicketInfoEntity.getStartTime(),TicketConstants.TICKET_DATE_PATTERN)).orElse("")); - exportVO.setEndTime(Optional.ofNullable(DateUtil.format(standardTicketInfoEntity.getEndTime(),TicketConstants.TICKET_DATE_PATTERN)).orElse("")); - if (ObjectUtils.isNotEmpty(standardTicketInfoEntity.getIsEvaluate())){ - exportVO.setIsEvaluate(standardTicketInfoEntity.getIsEvaluate()==0?"不合格":"合格"); - } - list.add(exportVO); - } + List standardTicketInfoVOS = standardTicketInfoEntities.parallelStream().map(standardTicketInfoEntity -> { + StandardTicketExportVO exportVO = new StandardTicketExportVO(); + try { + exportVO.setCompany(Optional.ofNullable(standardTicketInfoEntity.getCompany()).orElse(null)); + exportVO.setTicketType(Optional.ofNullable(DictCache.getValue(TicketConstants.TICKET_TYPE, standardTicketInfoEntity.getTicketType())).orElse(null)); + exportVO.setCode(Optional.ofNullable(standardTicketInfoEntity.getCode()).orElse(null)); + exportVO.setTitle(Optional.ofNullable(standardTicketInfoEntity.getTitle()).orElse(null)); + if (ObjectUtil.isNotEmpty(standardTicketInfoEntity.getIssueOrderPerson())) { + User issueOrderPerson = UserCache.getUser(standardTicketInfoEntity.getIssueOrderPerson()); + if (ObjectUtil.isNotEmpty(issueOrderPerson)) { + exportVO.setIssueOrderPerson(issueOrderPerson.getName()); + } + } + if (ObjectUtil.isNotEmpty(standardTicketInfoEntity.getAccessOrderPerson())) { + User accessOrderPerson = UserCache.getUser(standardTicketInfoEntity.getAccessOrderPerson()); + if (ObjectUtil.isNotEmpty(accessOrderPerson)) { + exportVO.setAccessOrderPerson(accessOrderPerson.getName()); + } + } + if (ObjectUtil.isNotEmpty(standardTicketInfoEntity.getGuardian())) { + User guardian = UserCache.getUser(standardTicketInfoEntity.getGuardian()); + if (ObjectUtil.isNotEmpty(guardian)) { + exportVO.setGuardian(guardian.getName()); + } + } + if (ObjectUtil.isNotEmpty(standardTicketInfoEntity.getPrincipal())) { + User principal = UserCache.getUser(standardTicketInfoEntity.getPrincipal()); + if (ObjectUtil.isNotEmpty(principal)) { + exportVO.setPrincipal(principal.getName()); + } + } + exportVO.setStartTime(Optional.ofNullable(DateUtil.format(standardTicketInfoEntity.getStartTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse("")); + 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> ticketList = ticketFeignClient.list(ticketInfoEvaluateEntity); + if (ticketList.isSuccess() && CollectionUtil.isNotEmpty(ticketList.getData())) { + exportVO.setIsEvaluate(ticketList.getData().get(0).getStatus() == 1 ? "合格" : "不合格"); + } + } + } + }catch (Exception e){ + log.error("转换失败----》"+e.toString()+standardTicketInfoEntity.toString()); + System.out.println("转换失败----》"+e.toString()+standardTicketInfoEntity.toString()); + } + return exportVO; + }).collect(Collectors.toList()); + return standardTicketInfoVOS; + }else { + return list; } - return list; } } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/vo/StandardTicketExportVO.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/vo/StandardTicketExportVO.java index 9969053..5d61888 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/vo/StandardTicketExportVO.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/vo/StandardTicketExportVO.java @@ -13,65 +13,65 @@ import org.springframework.format.annotation.DateTimeFormat; @Data public class StandardTicketExportVO { private static final long serialVersionUID = 8239436726489738763L; - @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 ticketType; - @ExcelProperty(value = "操作票编号", index = 3) + @ExcelProperty(value = "操作票编号", index = 2) @ColumnWidth(value = 20) @ApiModelProperty(value = "操作票编号") private String code; @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(value = "发令人") private String issueOrderPerson; - @ExcelProperty(value = "受令人", index = 6) + @ExcelProperty(value = "受令人", index = 5) @ColumnWidth(value = 20) @ApiModelProperty(value = "受令人") private String accessOrderPerson; - @ExcelProperty(value = "监护人", index = 7) + @ExcelProperty(value = "监护人", index = 6) @ColumnWidth(value = 20) @ApiModelProperty(value = "监护人") private String guardian; - @ExcelProperty(value = "值班负责人", index = 8) + @ExcelProperty(value = "值班负责人", index = 7) @ColumnWidth(value = 20) @ApiModelProperty(value = "值班负责人") private String principal; - @ExcelProperty(value = "操作开始时间", index = 9) + @ExcelProperty(value = "操作开始时间", index = 8) @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 = 10) + @ExcelProperty(value = "操作结束时间", index = 9) @ColumnWidth(value = 20) @ApiModelProperty("操作结束时间") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @@ -79,7 +79,7 @@ public class StandardTicketExportVO { private String endTime; - @ExcelProperty(value = "评价", index = 11) + @ExcelProperty(value = "评价", index = 10) @ColumnWidth(value = 20) @ApiModelProperty("是否评价") private String isEvaluate; diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/wrapper/StandardTicketInfoWrapper.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/wrapper/StandardTicketInfoWrapper.java index 46887af..0416c2a 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/wrapper/StandardTicketInfoWrapper.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/wrapper/StandardTicketInfoWrapper.java @@ -5,6 +5,7 @@ import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity; import com.hnac.hzims.ticket.standardTicket.vo.StandardTicketInfoVO; import org.springblade.core.mp.support.BaseEntityWrapper; import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.system.cache.DictCache; import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; @@ -30,12 +31,24 @@ public class StandardTicketInfoWrapper extends BaseEntityWrapper DictCache.getValue(DictConstants.TICKET_SOURCE_TYPE,t)).orElse(null)); return standardTicketInfoVO; diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/feign/TicketInfoClient.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/feign/TicketInfoClient.java index 608080c..bf60416 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/feign/TicketInfoClient.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/feign/TicketInfoClient.java @@ -87,7 +87,14 @@ public class TicketInfoClient implements ITicketInfoClient { }}); return R.data(infoList); } - + @Override + @GetMapping("/getWorkTicketInfoById") + public R> getWorkTicketInfoById(@RequestParam List ticekeIds) { + List infoList = infoService.list(new LambdaQueryWrapper() {{ + in(WorkTicketInfoEntity::getId, ticekeIds); + }}); + return R.data(infoList); + } @Override @GetMapping("/getOperateTicketByTime") public R> getOperateTicketByTime(@RequestParam String startDate, @RequestParam String endDate) { diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/OfflineTicketServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/OfflineTicketServiceImpl.java index a0de5f3..eed59a0 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/OfflineTicketServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/OfflineTicketServiceImpl.java @@ -8,7 +8,6 @@ import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.feign.IStationClient; import com.hnac.hzims.ticket.constants.TicketConstants; import com.hnac.hzims.ticket.constants.WorkTicketConstants; -import com.hnac.hzims.ticket.twoTicket.constant.TicketConstant; import com.hnac.hzims.ticket.workTicket.dto.WorkTicketInfoDto; import com.hnac.hzims.ticket.workTicket.entity.WorkTicketContentEntity; import com.hnac.hzims.ticket.workTicket.entity.WorkTicketFlowEntity; @@ -40,7 +39,6 @@ import java.time.YearMonth; import java.time.format.DateTimeFormatter; import java.time.temporal.TemporalAdjusters; import java.util.List; -import java.util.Optional; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.stream.Collectors; diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java index acaca81..fca6fb7 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java @@ -22,6 +22,8 @@ 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; import com.hnac.hzims.ticket.aspect.AroundFlow; @@ -103,6 +105,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl res = super.baseMapper.selectList(lqw); - List list=new ArrayList<>(); - if (CollectionUtils.isNotEmpty(res)){ - List workTicketInfoVOS = WorkTicketInfoWrapper.build().listVO(res); - for (int i = 0; i < workTicketInfoVOS.size(); i++) { - WorkTicketExportVO resEntity=new WorkTicketExportVO(); - WorkTicketInfoVO workTicketInfoVO = workTicketInfoVOS.get(i); - resEntity.setNumber(i+1); - resEntity.setCompany( Optional.ofNullable(workTicketInfoVO.getCompany()).orElse("")); + List list = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(res)) { +// List workTicketInfoVOS = WorkTicketInfoWrapper.build().listVO(res); + list= res.parallelStream().map(workTicketInfoVO -> { + 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("")); - resEntity.setSigner(Optional.ofNullable(workTicketInfoVO.getSignerName()).orElse("")); - resEntity.setPrincipal(Optional.ofNullable(workTicketInfoVO.getPrincipalName()).orElse("")); - resEntity.setLicensor(Optional.ofNullable(workTicketInfoVO.getLicensorName()).orElse("")); - 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("")); + if (ObjectUtil.isNotEmpty(workTicketInfoVO.getSigner())) { + User user = UserCache.getUser(workTicketInfoVO.getSigner()); + if (ObjectUtil.isNotEmpty(user)) { + resEntity.setSigner(user.getName()); + } } - if (ObjectUtils.isNotEmpty(workTicketInfoVO.getIsEvaluate())){ - resEntity.setIsEvaluate(workTicketInfoVO.getIsEvaluate()==0?"不合格":"合格"); + //负责人-线上和线下 + if (Func.isEmpty(workTicketInfoVO.getPrincipal())) { + resEntity.setPrincipal(workTicketInfoVO.getPrincipalManual()); + } else { + User principal = UserCache.getUser(workTicketInfoVO.getPrincipal()); + if (ObjectUtil.isNotEmpty(principal)) { + resEntity.setPrincipal(principal.getName()); + } } - list.add(resEntity); - } + 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> ticketList = ticketFeignClient.list(ticketInfoEvaluateEntity); + if (ticketList.isSuccess() && CollectionUtil.isNotEmpty(ticketList.getData())) { + resEntity.setIsEvaluate(ticketList.getData().get(0).getStatus() == 1 ? "合格" : "不合格"); + } + } + return resEntity; + }).collect(Collectors.toList()); } return list; } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/vo/WorkTicketExportVO.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/vo/WorkTicketExportVO.java index 1af5e15..f1720d6 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/vo/WorkTicketExportVO.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/vo/WorkTicketExportVO.java @@ -13,65 +13,65 @@ import org.springframework.format.annotation.DateTimeFormat; @Data public class WorkTicketExportVO { - @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 type; - @ExcelProperty(value = "工作票编号", index = 3) + @ExcelProperty(value = "工作票编号", index = 2) @ColumnWidth(value = 20) @ApiModelProperty(value = "工作票编号") private String code; @ApiModelProperty("工作票任务") - @ExcelProperty(value = "工作票任务", index = 4) + @ExcelProperty(value = "工作票任务", index = 3) @ColumnWidth(value = 20) private String workContent; - @ExcelProperty(value = "签发人", index = 5) + @ExcelProperty(value = "签发人", index = 4) @ColumnWidth(value = 20) @ApiModelProperty(value = "签发人") private String signer; - @ExcelProperty(value = "工作负责人", index = 6) + @ExcelProperty(value = "工作负责人", index = 5) @ColumnWidth(value = 20) @ApiModelProperty(value = "工作负责人") private String principal; - @ExcelProperty(value = "工作许可人", index = 7) + @ExcelProperty(value = "工作许可人", index = 6) @ColumnWidth(value = 20) @ApiModelProperty(value = "工作许可人") private String licensor; - @ExcelProperty(value = "工作班成员", index = 8) + @ExcelProperty(value = "工作班成员", index = 7) @ColumnWidth(value = 20) @ApiModelProperty(value = "工作班成员") private String classGroupMembers; - @ExcelProperty(value = "工作票开始时间", index = 9) + @ExcelProperty(value = "工作票开始时间", index = 8) @ColumnWidth(value = 20) @ApiModelProperty("工作票开始时间") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private String createTime; - @ExcelProperty(value = "工作票结束时间", index = 10) + @ExcelProperty(value = "工作票结束时间", index = 9) @ColumnWidth(value = 20) @ApiModelProperty("工作票结束时间") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @@ -79,7 +79,7 @@ public class WorkTicketExportVO { private String confirmWorkTime; - @ExcelProperty(value = "评价", index = 11) + @ExcelProperty(value = "评价", index = 10) @ColumnWidth(value = 20) @ApiModelProperty("是否评价") private String isEvaluate; diff --git a/pom.xml b/pom.xml index 8593c9c..38bf367 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,7 @@ 5.0.1.RELEASE - 5.1.0-SNAPSHOT + 5.0.3.RELEASE UTF-8 1.8