Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
yang_shj 7 months ago
parent
commit
fb24ce9497
  1. 3
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/SpecialDeviceInspectionEntity.java
  2. 22
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/SpecialDeviceInspectionServiceImpl.java

3
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/SpecialDeviceInspectionEntity.java

@ -1,8 +1,6 @@
package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -21,7 +19,6 @@ public class SpecialDeviceInspectionEntity extends BaseEntity {
@ApiModelProperty("设备id")
private Long deviceId;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("检验时间")
private Date inspectionTime;

22
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/SpecialDeviceInspectionServiceImpl.java

@ -48,15 +48,19 @@ public class SpecialDeviceInspectionServiceImpl extends ServiceImpl<SpecialDevic
specialDeviceInspectionEntity.setNextInspectionTime(nextInspectDate);
specialDeviceEntity.setInspectionNextTime(nextInspectDate);
// 获取上一次检验时间
QueryWrapper<SpecialDeviceInspectionEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SpecialDeviceInspectionEntity::getDeviceId, deviceId)
.orderByDesc(SpecialDeviceInspectionEntity::getInspectionTime);
List<SpecialDeviceInspectionEntity> list = this.list(queryWrapper);
if (CollectionUtil.isNotEmpty(list)) {
SpecialDeviceInspectionEntity lastDeviceInspection = list.get(0);
Date lastInspectionTime = lastDeviceInspection.getInspectionTime();
specialDeviceInspectionEntity.setLastInspectionTime(lastInspectionTime);
specialDeviceEntity.setInspectionLastTime(lastInspectionTime);
if (specialDeviceInspectionEntity.getLastInspectionTime() != null) {
specialDeviceEntity.setInspectionLastTime(specialDeviceInspectionEntity.getLastInspectionTime());
} else {
QueryWrapper<SpecialDeviceInspectionEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SpecialDeviceInspectionEntity::getDeviceId, deviceId)
.orderByDesc(SpecialDeviceInspectionEntity::getInspectionTime);
List<SpecialDeviceInspectionEntity> list = this.list(queryWrapper);
if (CollectionUtil.isNotEmpty(list)) {
SpecialDeviceInspectionEntity lastDeviceInspection = list.get(0);
Date lastInspectionTime = lastDeviceInspection.getInspectionTime();
specialDeviceInspectionEntity.setLastInspectionTime(lastInspectionTime);
specialDeviceEntity.setInspectionLastTime(lastInspectionTime);
}
}
// 本次检验时间
specialDeviceEntity.setInspectionCurrentTime(specialDeviceInspectionEntity.getInspectionTime());

Loading…
Cancel
Save