提交 a8ea4361 authored 作者: zhoushaopan's avatar zhoushaopan

fix(设备模块): 新增更换时间字段,新增设置更换时间接口

新增更换时间字段,新增设置更换时间接口
上级 fced1f3f
......@@ -1372,6 +1372,13 @@ public class DeviceLibraryController {
return ResponseEntity.ok(deviceLibraryService.queryByOwnUniName(devNameVO.getName()));
}
@PostMapping("/deviceLibraryChangeTime")
@ApiOperation(value = "设备设置更换时间")
public ResponseEntity<String> deviceChangeTime(@RequestBody ChangeDeviceVo changeDeviceVo){
deviceLibraryService.deviceLibraryChangeTime(changeDeviceVo);
return ResponseEntity.ok("success");
}
// @ApiOperation(value = "修改单位名称", notes = "修改单位名称")
// @PostMapping("/updateDeviceLocationAndOwnUnit")
......
......@@ -599,5 +599,9 @@ public interface DeviceLibraryService {
*/
List<DeviceLibrary> queryByOwnUniName(String ownUniName);
/**
* 装备设置更换时间vo
* @param changeDeviceVo
*/
void deviceLibraryChangeTime(ChangeDeviceVo changeDeviceVo);
}
......@@ -43,6 +43,7 @@ import org.springframework.data.jpa.domain.Specification;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StopWatch;
......@@ -50,6 +51,7 @@ import javax.annotation.Resource;
import javax.persistence.Transient;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
......@@ -1765,6 +1767,23 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
return deviceLibraryList;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deviceLibraryChangeTime(ChangeDeviceVo changeDeviceVo) {
List<Integer> devIdsList = changeDeviceVo.getDevIdsList();
LocalDateTime changeTime = changeDeviceVo.getChangeTime();
if (devIdsList.size() >0){
List<DeviceLibrary> deviceLibraries = new ArrayList<>();
List<DeviceLibrary> deviceLibraryList = deviceLibraryDao.findAllByIdIn(devIdsList);
deviceLibraryList.forEach(deviceLibrary -> {
deviceLibrary.setChangeTime(changeTime);
deviceLibraries.add(deviceLibrary);
});
deviceLibraryDao.saveAll(deviceLibraries);
log.info("装备更换时间更新成功,共有:{}条",deviceLibraries.size());
}
}
private Specification<DeviceLibrary> getSelectSpecification(DeviceLibrarySelectVo deviceLibrarySelectVo) {
PredicateBuilder<DeviceLibrary> predicateBuilder = getPredicateBuilder(deviceLibrarySelectVo);
//unitId为空,默认查询当前单位
......
package com.tykj.dev.device.library.subject.domin;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tykj.dev.config.cache.ConfigCache;
import com.tykj.dev.device.library.subject.vo.DeviceExcel;
import com.tykj.dev.device.library.subject.vo.DeviceExcelVo;
......@@ -20,9 +21,11 @@ import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -199,6 +202,11 @@ public class DeviceLibrary implements Serializable {
@ApiModelProperty(value = "是否是试用装备",notes = "0 是正式 1 是测试")
private Integer tryOutDevice = 0;
@ApiModelProperty(name = "changeTime",value="更换时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime changeTime;
@ApiModelProperty(value = "入库操作人")
@Transient
private String storageProcessingUser;
......
package com.tykj.dev.device.library.subject.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("装备更换的vo")
public class ChangeDeviceVo {
@ApiModelProperty(value = "装备id的集合")
private List<Integer> devIdsList;
@ApiModelProperty(name = "changeTime",value="更换时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime changeTime;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论