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/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealStationVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealStationVo.java index 515d623..81ed1b8 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealStationVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealStationVo.java @@ -43,6 +43,9 @@ public class RealStationVo implements Serializable { @ApiModelProperty("站点状态 : 0-正常 1-数据中断") private Integer status; + @ApiModelProperty("铃铛展示: 0-不展示 1-展示") + private Integer bell; + @ApiModelProperty("排序") private Integer sort; } 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/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfig.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfig.java index d6bfe52..01e2a01 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfig.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfig.java @@ -46,7 +46,7 @@ public class MqttConfig { // private String mqtt_system_topname; @PostConstruct public void registerMqtt(){ -try { + try{ com.hnac.hzinfo.subscribe.MqttConfig mqttConfig = new com.hnac.hzinfo.subscribe.MqttConfig(); mqttConfig.setUrl(mqtt_fdp_url); mqttConfig.setGroup(mqtt_fdp_group); diff --git a/hzims-service/hzims-scheduled/pom.xml b/hzims-service/hzims-scheduled/pom.xml index e1a0e7d..3e004f3 100644 --- a/hzims-service/hzims-scheduled/pom.xml +++ b/hzims-service/hzims-scheduled/pom.xml @@ -47,6 +47,11 @@ inspect-api + com.hnac.hzims + alarm-api + 4.0.0-SNAPSHOT + + org.springblade blade-core-test test diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/alarm/AlarmQueryMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/alarm/AlarmQueryMapper.java new file mode 100644 index 0000000..a2f4840 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/alarm/AlarmQueryMapper.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.scheduled.mapper.alarm; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.alarm.entity.AlarmEntity; + +/** + * @author ysj + */ +public interface AlarmQueryMapper extends BaseMapper { + + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java new file mode 100644 index 0000000..b0b2ad2 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.scheduled.service.alarm; + +import com.hnac.hzims.alarm.entity.AlarmEntity; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; + +/** + * @author ysj + */ +public interface AlarmQueryService extends BaseService { + + List bells(List codes); + + List aborts(List codes); +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java new file mode 100644 index 0000000..c65ebcb --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java @@ -0,0 +1,74 @@ +package com.hnac.hzims.scheduled.service.alarm.impl; + +import cn.hutool.core.stream.CollectorUtil; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.alarm.constants.AlarmConstants; +import com.hnac.hzims.alarm.entity.AlarmEntity; +import com.hnac.hzims.scheduled.mapper.alarm.AlarmQueryMapper; +import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.StringUtil; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author ysj + */ +@AllArgsConstructor +@Service +@Slf4j +@DS("alarm") +public class AlarmQueryServiceImpl extends BaseServiceImpl implements AlarmQueryService { + + /** + * 查询站点铃铛 + * @param codes + * @return + */ + @Override + public List bells(List codes) { + List alarms = this.list(Wrappers.lambdaQuery() + .in(AlarmEntity::getStationId,codes) + .eq(AlarmEntity::getIsSmallBell,0) + ); + if(CollectionUtil.isEmpty(alarms)){ + return new ArrayList<>(); + } + return alarms.stream().map(AlarmEntity::getStationId).distinct().collect(Collectors.toList()); + } + + /** + * 查询站点数据中断 + * @param codes + * @return + */ + @Override + public List aborts(List codes) { + List alarms = this.list(Wrappers.lambdaQuery() + .in(AlarmEntity::getStationId,codes) + .eq(AlarmEntity::getAlarmSource, AlarmConstants.HZ3000_ALARM) + .in(AlarmEntity::getAlarmType, Arrays.asList(AlarmConstants.INTERRUPT,AlarmConstants.ABNORMAL)) + ); + if(CollectionUtil.isEmpty(alarms)){ + return new ArrayList<>(); + } + return alarms.stream().collect(Collectors.groupingBy(AlarmEntity::getStationId)).entrySet().stream().map(entry->{ + // 站点最近的一条数据中断、数据异常告警 + AlarmEntity alarm = entry.getValue().stream().sorted(Comparator.comparing(AlarmEntity::getCreateTime).reversed()).collect(Collectors.toList()).get(0); + // 状态为中断 + if(alarm.getAlarmStatus().equals(0)){ + return alarm.getStationId(); + } + return ""; + }).filter(StringUtil::isBlank).distinct().collect(Collectors.toList()); + } +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java index 831dade..21cff8b 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; import com.google.common.util.concurrent.ThreadFactoryBuilder; +import com.hnac.hzims.alarm.entity.AlarmEntity; import com.hnac.hzims.equipment.entity.WorkshopInfoEntity; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.fdp.vo.FdpFaultStatusVo; @@ -18,6 +19,7 @@ import com.hnac.hzims.operational.main.vo.RealDeviceVo; import com.hnac.hzims.operational.main.vo.RealStationVo; import com.hnac.hzims.operational.station.entity.StationAttributeEntity; import com.hnac.hzims.operational.station.entity.StationEntity; +import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService; import com.hnac.hzims.scheduled.service.equipment.WorkshopInfoService; import com.hnac.hzims.scheduled.service.operation.alarm.AbnormalAlarmService; import com.hnac.hzims.scheduled.service.operation.alarm.RecordService; @@ -57,6 +59,7 @@ public class MonitorServiceImpl implements MonitorService { private final RecordService alertService; private final StationService stationService; + private final AlarmQueryService alarmQueryService; private final StationAttributeService attbtService; private final WorkshopInfoService workshopInfoService; private final AbnormalAlarmService abnormalAlarmService; @@ -278,7 +281,6 @@ public class MonitorServiceImpl implements MonitorService { List alertList = alertService.list(new LambdaQueryWrapper() {{ orderByDesc(StAlarmRecordEntity::getCreateTime); }}); - List alarmList = abnormalAlarmService.abnormalAlarms(); // 获取所有故障记录 List faultList = this.getFdpFaultAll(); // 所有设备分类 @@ -290,6 +292,10 @@ public class MonitorServiceImpl implements MonitorService { // 获取站点列表 List stationEntityList = stationService.list(Wrappers.lambdaQuery() .in(StationEntity::getCode,new ArrayList<>(stationAttbtMap.keySet()))); + // 铃铛 + List bells = alarmQueryService.bells(stationEntityList.stream().map(StationEntity::getCode).collect(Collectors.toList())); + // 数据中断 + List aborts = alarmQueryService.aborts(stationEntityList.stream().map(StationEntity::getCode).collect(Collectors.toList())); // 隐藏设备列表 List hideList = attrConfigService.getHideList(); // 分割,每个map限制10个长度 @@ -328,8 +334,10 @@ public class MonitorServiceImpl implements MonitorService { this.getDeviceParam(devices, deviceClassifyMap, deviceList); // 运行设备状态设置 this.deviceState(deviceList); - // 设置站点状态 - this.setStationStatus(alarmList,station,key,deviceList); + // 设置站点状态:数据中断 + this.setStationStatus(aborts,station,key,deviceList); + // 铃铛 + this.stationBell(station,bells); station.setDeviceList(deviceList.stream().sorted(Comparator.comparing((RealDeviceVo::getDeviceName))).collect(Collectors.toList())); stationList.add(station); }); @@ -348,6 +356,21 @@ public class MonitorServiceImpl implements MonitorService { } /** + * 站点铃铛设置 + * @param station + * @param bells + */ + private void stationBell(RealStationVo station, List bells) { + station.setBell(0); + if(CollectionUtil.isEmpty(bells)){ + return; + } + if(bells.contains(station.getStationCode())){ + station.setBell(1); + } + } + + /** * 设备处理 * * @param list @@ -674,11 +697,10 @@ public class MonitorServiceImpl implements MonitorService { /** * 设置站点状态 - * @param alarmList * @param station * @param key */ - private void setStationStatus(List alarmList, RealStationVo station, String key,List deviceList) { + private void setStationStatus(List aborts,RealStationVo station, String key,List deviceList) { // 站点功率大于0为正常上送数据 for(RealDeviceVo item : deviceList){ if(!CollectionUtil.isEmpty(item.getAttbtList())){ @@ -693,9 +715,9 @@ public class MonitorServiceImpl implements MonitorService { } } } + } } - } - if(alarmList.contains(key)){ + if(aborts.contains(key)){ station.setStatus(1); } } diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/alarm/AlarmQueryMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/alarm/AlarmQueryMapper.xml new file mode 100644 index 0000000..3fd4b39 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/alarm/AlarmQueryMapper.xml @@ -0,0 +1,5 @@ + + + + + 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/controller/WorkTicketInfoController.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/controller/WorkTicketInfoController.java index 8b728ee..f8a2d3a 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/controller/WorkTicketInfoController.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/controller/WorkTicketInfoController.java @@ -262,5 +262,13 @@ public class WorkTicketInfoController { return R.data(workTicketInfoService.work(Condition.getPage(query),work)); } + @ApiLog + @PostMapping("/cancel") + @ApiOperationSupport(order = 50) + @ApiOperation(value = "线下工作票作废") + public R cancel(@RequestBody WorkTicketInfoEntity entity) { + return R.status(workTicketInfoService.cancel(entity)); + } + } 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/IWorkTicketInfoService.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketInfoService.java index 54bf7f9..0e1603b 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketInfoService.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketInfoService.java @@ -185,4 +185,6 @@ public interface IWorkTicketInfoService extends BaseService work(IPage page, WorkVO work); List exportWorkTicket(WorkTicketInfoDto req); + + Boolean cancel(WorkTicketInfoEntity entity); } 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 f1d0032..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; } + + @Override + public Boolean cancel(WorkTicketInfoEntity entity) { + entity.setFlowTaskName("线下作废"); + return this.updateById(entity); + } } 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