提交 8bf077a4 authored 作者: 邓砥奕's avatar 邓砥奕

更新

上级 853c2536
......@@ -154,7 +154,9 @@ public class AllotBillController {
}
//1.添加配发单
AllotBill a = allotBillSaveVo.toDo();
a.setSendUseraId(userUtils.getCurrentUserId());
if (allotBillSaveVo.getTaskId()==null) {
a.setSendUseraId(userUtils.getCurrentUserId());
}
AllotBill allotBillEntity;
if (allotBillSaveVo.getTaskId()==null){
allotBillEntity = allotBillService.addEntity(a);
......
......@@ -93,7 +93,9 @@ public class BackController {
}
//1.添加配发单
AllotBackBill a = allotBillSaveVo.toBackDo();
a.setSendUseraId(userUtils.getCurrentUserId());
if (allotBillSaveVo.getTaskId()==null) {
a.setSendUseraId(userUtils.getCurrentUserId());
}
AllotBackBill allotBackBill = allotBackBillService.addEntity(a);
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
......
......@@ -20,6 +20,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
......@@ -85,11 +86,11 @@ public class DeviceLibraryController {
}
@ApiOperation(value = "根据装备id查询装备详情", notes = "根据装备id查询装备详情")
@PostMapping("/selectByIds")
public ResponseEntity selectByIds(@RequestBody List<Integer> ids){
@PostMapping("/selectByIds/{page}/{size}")
public ResponseEntity selectByIds(@RequestBody List<Integer> ids,@PathVariable("page") int page,@PathVariable("size") int size){
List<DeviceLibrary> deviceLibraries = new ArrayList<>();
ids.forEach(integer -> deviceLibraries.add(deviceLibraryService.getOne(integer).setConfigName()));
return ResponseEntity.ok(deviceLibraries);
return ResponseEntity.ok(PageUtil.getPerPage(page,size,deviceLibraries, PageRequest.of(page, size)));
}
@ApiOperation(value = "根据装备id查询装备详情", notes = "根据装备id查询装备详情")
......@@ -479,7 +480,7 @@ public class DeviceLibraryController {
d.setPartParentId(deviceEditVo.getDeviceId());
deviceLibraryService.update(d);
//添加装备日志
String remark = "将表面号为" + d.getRfidSurfaceId() + "的配件与表面号为" + deviceLibraryEntity.getRfidSurfaceId() + "的装备绑定";
String remark = "将序列号为" + d.getSeqNumber() + "的配件与表面号为" + deviceLibraryEntity.getSeqNumber() + "的装备绑定";
DeviceLogDto deviceLogDto = new DeviceLogDto(deviceEditVo.getDeviceId(), remark, null);
DeviceLogDto deviceLogDto2 = new DeviceLogDto(id, remark, null);
deviceLogService.addLog(deviceLogDto);
......@@ -489,7 +490,7 @@ public class DeviceLibraryController {
deviceLibraryEntity.setPartParentId(id);
deviceLibraryService.update(deviceLibraryEntity);
//添加装备日志
String remark = "将表面号为" + deviceLibraryEntity.getRfidSurfaceId() + "的配件与表面号为" + d.getRfidSurfaceId() + "的装备绑定";
String remark = "将序列号为" + deviceLibraryEntity.getSeqNumber() + "的配件与序列号为" + d.getSeqNumber() + "的装备绑定";
DeviceLogDto deviceLogDto = new DeviceLogDto(deviceEditVo.getDeviceId(), remark, null);
DeviceLogDto deviceLogDto2 = new DeviceLogDto(id, remark, null);
deviceLogService.addLog(deviceLogDto);
......@@ -529,19 +530,19 @@ public class DeviceLibraryController {
return ResultUtil.success("更新成功");
}
@ApiOperation(value = "通过表面号查询配件", notes = "通过表面号查询配件")
@ApiOperation(value = "通过序列号查询配件", notes = "通过表面号查询配件")
@GetMapping("/selectPart/{rfid}")
public ResponseEntity selectPart(@PathVariable("rfid") String rfid) {
List<DeviceLibrary> libraryEntities = deviceLibraryDao.getAllByRfidSurfaceId(rfid);
List<DeviceLibrary> libraryEntities = deviceLibraryDao.getAllBySeqNumber(rfid);
libraryEntities.forEach(DeviceLibrary::setConfigName);
List<DeviceLibrary> deviceLibraryEntityList = libraryEntities.stream().filter(deviceLibraryEntity -> deviceLibraryEntity.getIsPart() == 1).collect(Collectors.toList());
return ResultUtil.success(deviceLibraryEntityList);
}
@ApiOperation(value = "通过表面号查询装备", notes = "通过表面号查询装备")
@ApiOperation(value = "通过序列号查询装备", notes = "通过表面号查询装备")
@GetMapping("/selectDevice/{rfid}")
public ResponseEntity selectDevice(@PathVariable("rfid") String rfid) {
List<DeviceLibrary> libraryEntities = deviceLibraryDao.getAllByRfidSurfaceId(rfid);
List<DeviceLibrary> libraryEntities = deviceLibraryDao.getAllBySeqNumber(rfid);
libraryEntities.forEach(DeviceLibrary::setConfigName);
List<DeviceLibrary> deviceLibraryEntityList = libraryEntities.stream().filter(deviceLibraryEntity -> deviceLibraryEntity.getIsPart() == 0).collect(Collectors.toList());
return ResultUtil.success(deviceLibraryEntityList);
......
......@@ -13,6 +13,8 @@ public interface PackingLibraryDao extends JpaRepository<PackingLibrary, Integer
List<PackingLibrary> findAllByPartParentId(Integer id);
List<PackingLibrary> findAllByPartParentIdAndPackingStatus(Integer id,Integer packingId);
List<PackingLibrary> findAllByIdIn(List<Integer> ids);
PackingLibrary findByShowOrder(Integer showOrder);
......
......@@ -291,7 +291,7 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
throw new ApiException(ResponseEntity.status(303).body("该列装型号已有装备,请进行退装操作"));
}
if (packingLibrary.getIsRoot()==1) {
if (packingLibraryDao.findAllByPartParentId(id).size()>0){
if (packingLibraryDao.findAllByPartParentIdAndPackingStatus(id,2).size()>0){
throw new ApiException(ResponseEntity.status(303).body("该列装型号目录下存在列装装备"));
}
Integer order = packingLibrary.getShowOrder();
......
......@@ -40,5 +40,8 @@ public class FileUploadVo {
private Integer startUserbId;
@ApiModelProperty(value = "接收单位B岗")
private Integer repairUserbId;
private Integer receiveUserbId;
@ApiModelProperty(value = "接收单位A岗")
private Integer repairUseraId;
}
......@@ -27,10 +27,7 @@ import com.tykj.dev.device.user.util.AuthenticationUtils;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.utils.ListUtil;
import com.tykj.dev.misc.utils.ResultUtil;
import com.tykj.dev.misc.utils.StringSplitUtil;
import com.tykj.dev.misc.utils.TaskDisposeUtil;
import com.tykj.dev.misc.utils.*;
import com.tykj.dev.socket.MyWebSocket;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -42,10 +39,7 @@ import org.springframework.web.bind.annotation.*;
import javax.transaction.Transactional;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -108,11 +102,19 @@ public class DeviceRetiredController {
BeanUtils.copyProperties(canRetiredDeviceSelectVo, packingLibrarySelectVo);
List<PackingLibrary> list = packingLibraryService.getList(packingLibrarySelectVo);
//循环获取列装主体的数量,并生成VO
list.forEach(packingLibrary -> {
for(PackingLibrary packingLibrary : list) {
DeviceRetiredResultVo deviceRetiredResultVo = calcDeviceRetiredResultVo(packingLibrary);
deviceRetiredResultVos.add(deviceRetiredResultVo);
});
return ResultUtil.success(deviceRetiredResultVos.stream().filter(DeviceRetiredResultVo::devNumIsZero).collect(Collectors.toList()));
}
Map<Integer, DeviceRetiredResultVo> nodeCollect =
deviceRetiredResultVos.stream().collect(Collectors.toMap(DeviceRetiredResultVo::getId, deviceRetiredResultVo -> deviceRetiredResultVo));
List<DeviceRetiredResultVo> containList = GetTreeUtils.parseTreeFromDown(
deviceRetiredResultVos,
DeviceRetiredResultVo::getId,
d -> Optional.ofNullable(nodeCollect.get(d.getPartParentId())),
DeviceRetiredResultVo::addChildNode
).stream().filter(DeviceRetiredResultVo::devNumIsZero).collect(Collectors.toList());
return ResultUtil.success(containList);
}
@ApiOperation(value = "提交退装表单", notes = "可以通过这个接口提交销毁表单发起退装流程")
......@@ -230,18 +232,23 @@ public class DeviceRetiredController {
DeviceRetiredResultVo deviceRetiredResultVo = new DeviceRetiredResultVo();
BeanUtils.copyProperties(packingLibraryEntity, deviceRetiredResultVo);
deviceRetiredResultVo.setCount(deviceRetiredBillService.getCantPackingCount(packingLibraryEntity.getId()));
List<PackingLibrary> PackingChildren = packingLibraryEntity.getChilds();
for (PackingLibrary p : PackingChildren) {
DeviceRetiredResultVo childDeviceRetiredResultVo = new DeviceRetiredResultVo();
BeanUtils.copyProperties(p, childDeviceRetiredResultVo);
childDeviceRetiredResultVo.setCount(deviceRetiredBillService.getCantPackingCount(p.getId()));
if (!p.getChilds().isEmpty()){
for (PackingLibrary pack:p.getChilds()) {
childDeviceRetiredResultVo.getChilds().add(calcDeviceRetiredResultVo(pack));
}
}
deviceRetiredResultVo.getChilds().add(childDeviceRetiredResultVo);
}
deviceRetiredResultVo.setChilds(new ArrayList<>());
// List<PackingLibrary> PackingChildren = packingLibraryEntity.getChilds();
// for (PackingLibrary p : PackingChildren) {
// DeviceRetiredResultVo childDeviceRetiredResultVo = new DeviceRetiredResultVo();
// BeanUtils.copyProperties(p, childDeviceRetiredResultVo);
// childDeviceRetiredResultVo.setCount(deviceRetiredBillService.getCantPackingCount(p.getId()));
// if (p.getChilds()!=null&&!p.getChilds().isEmpty()){
// for (PackingLibrary pack:p.getChilds()) {
// List<DeviceRetiredResultVo> d = childDeviceRetiredResultVo.getChilds();
// d.add(calcDeviceRetiredResultVo(pack));
// childDeviceRetiredResultVo.setChilds(d);
// }
// }
// List<DeviceRetiredResultVo> d = childDeviceRetiredResultVo.getChilds();
// d.add(childDeviceRetiredResultVo);
// childDeviceRetiredResultVo.setChilds(d);
// }
return deviceRetiredResultVo;
}
......
......@@ -20,6 +20,9 @@ public class DeviceRetiredResultVo {
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "id")
private Integer partParentId;
@ApiModelProperty(value = "名称")
private String name;
......@@ -67,4 +70,8 @@ public class DeviceRetiredResultVo {
return false;
}
}
public void addChildNode(DeviceRetiredResultVo deviceRetiredResultVo) {
childs.add(deviceRetiredResultVo);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论