提交 02724ad5 authored 作者: zhoushaopan's avatar zhoushaopan

feat(装备申请模块,配套设备模块): 配套设备进行解绑和绑定,装备申请新增校验接口

配套设备进行解绑和绑定,装备申请新增校验接口
上级 c35c8e1c
......@@ -469,7 +469,6 @@ public class DeviceApplyController {
}
if (uploadApplyFile.getApplyBillDetailVos() != null && uploadApplyFile.getApplyBillDetailVos().size() > 0) {
for (ApplyBillDetailVo a : uploadApplyFile.getApplyBillDetailVos()) {
// ResponseEntity responseEntity = packingController.seqsNotExist(a.getPackingId(), a.getStorageCount(), a.getSeqInterval());
// ResponseEntity responseEntity = packingController.seqsNotExist(a.getPackingId(), a.getWaitNum(), a.getSeqInterval());
ResponseEntity responseEntity = packingController.seqsNotExist(a.getPackingId(),
......@@ -519,13 +518,7 @@ public class DeviceApplyController {
deviceApplyBill.setAgent(uploadApplyFile.getAgent());
deviceApplyBill.setReplyUnit(uploadApplyFile.getReplyUnit());
DeviceApplyBill deviceApplyBill1 = deviceApplyBillService.update(deviceApplyBill);
//通过列装id查询列装
// List<ApplyBillDetailVo> applyBillDetailVos = uploadApplyFile.getApplyBillDetailVos();
// for (ApplyBillDetailVo applyBillDetailVo : applyBillDetailVos) {
// PackingLibrary packingLibrary = packingLibraryService.getOne(applyBillDetailVo.getPackingId());
// BeanUtils.copyProperties(applyBillDetailVo,packingLibrary);
// packingLibraryService.update(packingLibrary);
// }
if (deviceApplyBill.getApplyType() > 1) {
List<String> seqs = new ArrayList<>();
List<ReplyVo> replyVos = JacksonUtil.readValue(deviceApplyBill1.getReplyVos(), new TypeReference<List<ReplyVo>>() {
......@@ -720,6 +713,14 @@ public class DeviceApplyController {
return ResponseEntity.ok("申请任务完成");
}
@ApiOperation(value = "申请任务进行校验", notes = "申请任务进行校验")
@PostMapping("/checkNumAndSeqNumber")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity checkNumAndSeqNumber(@RequestBody List<ApplyTaskDeviceCheckVo> applyTaskDeviceCheckVos) {
List<StringBuffer> stringBufferList = deviceApplyBillService.checkNumAndSeqNumber(applyTaskDeviceCheckVos);
return ResponseEntity.ok(stringBufferList);
}
/**
* 转实体
......
......@@ -106,9 +106,6 @@ public class MatchingDeviceController {
@Autowired
private MessageService messageService;
@Autowired
private MatchingDeviceLibraryDao matchingDeviceLibraryDao;
@Autowired
private RfidService rfidService;
......@@ -164,6 +161,15 @@ public class MatchingDeviceController {
if (matchingDeviceLibraryListSeqNumberList.size()>0){
throw new ApiException("序列号"+matchingDeviceLibraryListSeqNumberList+"已存在");
}
//做校验 入库的配套设备的序列号不能一样
//先去重
List<String> distinctSeqNumList = seqNumList.stream().distinct().collect(Collectors.toList());
distinctSeqNumList.forEach(s -> {
int frequency = Collections.frequency(seqNumList, s);
if (frequency>1){
throw new ApiException("序列号不能相同");
}
});
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("x");
Integer userId = userUtils.getCurrentUserId();
......@@ -412,15 +418,19 @@ public class MatchingDeviceController {
@GetMapping("/feature/detail/{id}")
public ResponseEntity getDetail(@PathVariable("id") @Min(value = 1,message = "id不能小于1") int id) {
List<Object> list = new ArrayList<>();
Map<String,List<Object>> map = new HashMap<>();
//添加配套设备详情
MatchingDeviceLibrary m = matchingDeviceLibraryService.getOne(id);
list.add(m);
//添加关联装备详情
if(m.getDeviceId()!=null){
if (m.getDeviceId() != 0) {
list.add(deviceLibraryService.getOne(m.getDeviceId()));
List<Object> deviceLibraryList = new ArrayList<>();
DeviceLibrary deviceLibrary = deviceLibraryService.getOne(m.getDeviceId());
deviceLibraryList.add(deviceLibrary);
map.put("deviceLibrary",deviceLibraryList);
} else {
list.add(null);
map.put("deviceLibrary",new ArrayList<>());
}
}
......@@ -432,7 +442,8 @@ public class MatchingDeviceController {
Comparator.nullsLast(Date::compareTo).reversed()))
.collect(Collectors.toList());
list.add(deviceLogs);
return ResponseEntity.ok(list);
map.put("list",list);
return ResponseEntity.ok(map);
}
......@@ -497,6 +508,25 @@ public class MatchingDeviceController {
deviceLogService.addLog(deviceLogDto);
m.setType(matchingDeviceEditVo.getType());
}
//添加绑定和解绑装备
//添加
if (matchingDeviceEditVo.getAddDeviceId() != null && !matchingDeviceEditVo.getAddDeviceId().equals(m.getDeviceId())){
DeviceLibrary deviceLibrary = deviceLibraryService.getOne(matchingDeviceEditVo.getAddDeviceId());
String remark = "将序列号为" + m.getSeqNumber() + "的配套装备与序列号为" + deviceLibrary.getSeqNumber() + "的装备绑定";
DeviceLogDto deviceLogDto = new DeviceLogDto(1,m.getId(), remark, null,null);
deviceLogService.addLog(deviceLogDto);
m.setDeviceId(matchingDeviceEditVo.getAddDeviceId());
}
//删除
if (matchingDeviceEditVo.getDeleteDeviceId() != null){
DeviceLibrary deviceLibrary = deviceLibraryService.getOne(matchingDeviceEditVo.getDeleteDeviceId());
String remark = "将序列号为" + m.getSeqNumber() + "的配套装备与序列号为" + deviceLibrary.getSeqNumber() + "的装备进行解除绑定";
DeviceLogDto deviceLogDto = new DeviceLogDto(1,m.getId(), remark,null,null);
deviceLogService.addLog(deviceLogDto);
m.setDeviceId(0);
}
matchingDeviceLibraryService.update(m);
return ResponseEntity.ok("修改成功");
}
......
......@@ -7,6 +7,7 @@ import org.springframework.stereotype.Repository;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @author dengdiyi
......@@ -49,4 +50,10 @@ public class MatchingDeviceEditVo {
@ApiModelProperty(value = "生命状态", example = "1")
private Integer lifeStatus;
@ApiModelProperty(value = "新增装备信息列表")
private Integer addDeviceId;
@ApiModelProperty(value = "删除相关装备id")
private Integer deleteDeviceId;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论