提交 75cb624c authored 作者: zhoushaopan's avatar zhoushaopan

feat(装备模块,配套设备库模块): 装备的绑定和解除,配套设备库生成序列号和入库

装备的绑定和解除,配套设备库生成序列号和入库
上级 40d13d6b
...@@ -840,6 +840,7 @@ public class DeviceLibraryController { ...@@ -840,6 +840,7 @@ public class DeviceLibraryController {
@ApiOperation(value = "通过序列号查询配件", notes = "通过表面号查询配件") @ApiOperation(value = "通过序列号查询配件", notes = "通过表面号查询配件")
@GetMapping("/selectPart/{rfid}") @GetMapping("/selectPart/{rfid}")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity selectPart(@PathVariable("rfid") String rfid) { public ResponseEntity selectPart(@PathVariable("rfid") String rfid) {
List<DeviceLibrary> libraryEntities = deviceLibraryDao.getAllBySeqNumber(rfid); List<DeviceLibrary> libraryEntities = deviceLibraryDao.getAllBySeqNumber(rfid);
libraryEntities.forEach(DeviceLibrary::setConfigName); libraryEntities.forEach(DeviceLibrary::setConfigName);
...@@ -847,6 +848,20 @@ public class DeviceLibraryController { ...@@ -847,6 +848,20 @@ public class DeviceLibraryController {
return ResultUtil.success(deviceLibraryEntityList); return ResultUtil.success(deviceLibraryEntityList);
} }
// @ApiOperation(value = "通过序列号查询配件", notes = "通过表面号查询配件")
// @PostMapping("/selectPart/rfIds")
// public ResponseEntity selectPart(@RequestBody List<String> rfid) {
// if (rfid.size()>0){
// for (String s : rfid) {
// List<DeviceLibrary> libraryEntities = deviceLibraryDao.getAllBySeqNumber(s);
// 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}") @GetMapping("/selectDevice/{rfid}")
public ResponseEntity selectDevice(@PathVariable("rfid") String rfid) { public ResponseEntity selectDevice(@PathVariable("rfid") String rfid) {
...@@ -953,18 +968,116 @@ public class DeviceLibraryController { ...@@ -953,18 +968,116 @@ public class DeviceLibraryController {
return deviceLibraries; return deviceLibraries;
} }
// @ApiOperation(value = "解除装备绑定", notes = "解除装备绑定")
// @GetMapping("/relieveDevice/{deviceId}")
// public ResponseEntity relieveDevice(@PathVariable("deviceId") Integer deviceId){
// deviceLibraryService.relieveDevice(deviceId);
// return ResponseEntity.ok("解除成功");
// }
// @ApiOperation(value = "进行装备绑定", notes = "进行装备绑定")
// @PostMapping("/bindingDevice")
// public ResponseEntity bindingDevice(BindingDeviceVo bindingDeviceVo){
// deviceLibraryService.bindingDevice(bindingDeviceVo);
// return ResponseEntity.ok("绑定成功");
// }
@ApiOperation(value = "进行装备绑定", notes = "进行装备绑定")
@PostMapping("/boundDevice")
public ResponseEntity boundDevice(@RequestBody BindingDeviceVo bindingDeviceVo){
deviceLibraryService.boundDevice(bindingDeviceVo);
return ResponseEntity.ok("绑定成功");
}
@ApiOperation(value = "解除装备绑定", notes = "解除装备绑定") @ApiOperation(value = "解除装备绑定", notes = "解除装备绑定")
@GetMapping("/relieveDevice/{deviceId}") @PostMapping("/unboundDevice")
public ResponseEntity relieveDevice(@PathVariable("deviceId") Integer deviceId){ public ResponseEntity unboundDevice(@RequestBody List<DeviceLibrary> deviceLibraries){
deviceLibraryService.relieveDevice(deviceId); deviceLibraryService.unboundDevice(deviceLibraries);
return ResponseEntity.ok("解除成功"); return ResponseEntity.ok("解除成功");
} }
@ApiOperation(value = "进行装备绑定", notes = "进行装备绑定")
@PostMapping("/bindingDevice") @ApiOperation(value = "查询可绑定的附件", notes = "查询可绑定的附件")
public ResponseEntity bindingDevice(BindingDeviceVo bindingDeviceVo){ @PostMapping("/selectPartDevice")
deviceLibraryService.bindingDevice(bindingDeviceVo); public ResponseEntity selectPartDevice(@RequestBody DeviceLibrarySelectVo deviceLibrarySelectVo){
return ResponseEntity.ok("绑定成功"); Boolean hasModelDim = deviceLibrarySelectVo.getModelDim()!=null;
Boolean hasNameDim = deviceLibrarySelectVo.getNameDim()!=null;
Boolean hasSeqDim = deviceLibrarySelectVo.getSeqDim()!=null;
Boolean hasLocationUnitDim = deviceLibrarySelectVo.getLocationUnitDim()!=null;
Boolean hasOwnUnitDim = deviceLibrarySelectVo.getOwnUnitDim()!=null;
Boolean hasLifeStatusDim = deviceLibrarySelectVo.getLifeStatusDim()!=null;
Boolean hasUpdateTimeDim = deviceLibrarySelectVo.getUpdateTimeDim()!=null;
Boolean hasRfidCardDim = deviceLibrarySelectVo.getRfidCardDim()!=null;
//库存位置
Boolean hasStorageLocationDim = deviceLibrarySelectVo.getRfidCardDim()!=null;
//形态
// Boolean hasTypeDim = deviceLibrarySelectVo.getTypeDim()!=null;
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
List<DeviceLibrary> resultList = deviceLibraryService.getCoreDevicePage(deviceLibrarySelectVo);
resultList = resultList.stream().filter(deviceLibrary -> deviceLibrary.getIsPart() == 1).collect(Collectors.toList());
//根据装备id查询附件 然后过滤
List<DeviceLibrary> allByPartParentId = deviceLibraryService.findAllByPartParentId(deviceLibrarySelectVo.getDeviceId());
List<Integer> ids = allByPartParentId.stream().map(DeviceLibrary::getId).collect(Collectors.toList());
resultList = resultList.stream().filter(deviceLibrary -> !ids.contains(deviceLibrary.getId())).collect(Collectors.toList());
if (hasModelDim||hasLifeStatusDim||hasLocationUnitDim||hasNameDim||hasOwnUnitDim||hasSeqDim) {
resultList = resultList.stream().filter(deviceLibrary -> {
Boolean containModelDim = !hasModelDim||deviceLibrary.getModel().contains(deviceLibrarySelectVo.getModelDim());
Boolean containNameDim = !hasNameDim||deviceLibrary.getName().contains(deviceLibrarySelectVo.getNameDim());
Boolean containSeqDim = !hasSeqDim||deviceLibrary.getSeqNumber().contains(deviceLibrarySelectVo.getSeqDim());
Boolean containLocationUnitDim = !hasLocationUnitDim||deviceLibrary.getLocationUnit().contains(deviceLibrarySelectVo.getLocationUnitDim());
Boolean containOwnUnitDim = !hasOwnUnitDim||deviceLibrary.getOwnUnit().contains(deviceLibrarySelectVo.getOwnUnitDim());
Boolean containLifeStatusDim = !hasLifeStatusDim||deviceLibrary.getLifeStatusName().contains(deviceLibrarySelectVo.getLifeStatusDim());
Boolean containUpdateTimeDim = !hasUpdateTimeDim||sdf.format(deviceLibrary.getUpdateTime()).contains(deviceLibrarySelectVo.getUpdateTimeDim());
Boolean containRfidCardDim = !hasRfidCardDim||(deviceLibrary.getRfidCardId()!=null&&deviceLibrary.getRfidCardId().contains(deviceLibrarySelectVo.getRfidCardDim()));
Boolean containStorageLocationDim = !hasStorageLocationDim||deviceLibrary.getStorageLocation().contains(deviceLibrarySelectVo.getStorageLocationDim());
// Boolean containTypeDim = !hasTypeDim||deviceLibrary.getType().contains(deviceLibrarySelectVo.getTypeDim());
return containModelDim&&containNameDim&&containSeqDim&&containLocationUnitDim&&containOwnUnitDim&&containLifeStatusDim&&containUpdateTimeDim&&containRfidCardDim&&containStorageLocationDim;
}).collect(Collectors.toList());
}
// List<DeviceVo> deviceVos = resultList.stream().map(DeviceLibrary::parseVo).collect(Collectors.toList());
Page<DeviceLibrary> deviceLibraryEntities = PageUtil.getPerPage(deviceLibrarySelectVo.getPage(), deviceLibrarySelectVo.getSize(), resultList, deviceLibrarySelectVo.getPageable());
Map<String,Object> map = new HashMap<>();
Map<Integer,String> lifeStatusMap = configCache.getLifeStatusMap();
//
Map<Integer, String> styleMap = configCache.getStyleMap();
Set<Integer> status = new HashSet<>();
List<String> models = new ArrayList<>();
List<String> names = new ArrayList<>();
List<String> ownUnits = new ArrayList<>();
List<String> locationUnits = new ArrayList<>();
Set<String> storageLocation = new HashSet<>();
//形态
List<Integer> types = new ArrayList<>();
resultList.forEach(deviceVo -> {
deviceVo.setConfigName();
status.add(deviceVo.getLifeStatus());
models.add(deviceVo.getModel());
names.add(deviceVo.getName());
ownUnits.add(deviceVo.getOwnUnit());
locationUnits.add(deviceVo.getLocationUnit());
storageLocation.add(deviceVo.getStorageLocation());
types.add(deviceVo.getType());
});
map.put("pages",deviceLibraryEntities);
//修改 增加排序
//做一下去重
List<String> finalModels = models.stream().distinct().collect(Collectors.toList());
List<String> modelToSort = DeviceModelSort.modelToSort(finalModels);
map.put("models",modelToSort);
List<String> nameList = names.stream().distinct().sorted(Comparator.comparing(s -> s)).collect(Collectors.toList());
map.put("names",nameList);
List<String> finalOwnUnits = DeviceModelSort.unitToSort(ownUnits);
map.put("ownUnits",finalOwnUnits.stream().distinct().collect(Collectors.toList()));
List<String> finalLocationUnits = DeviceModelSort.unitToSort(locationUnits);
map.put("locationUnits",finalLocationUnits.stream().distinct().collect(Collectors.toList()));
map.put("lifeStatus",status.stream().map(integer -> new LifeStatusVo(integer,lifeStatusMap.get(integer))).collect(Collectors.toList()));
map.put("storageLocation",storageLocation);
//形态
List<TypeVo> typeVoList = types.stream().distinct().map(integer -> new TypeVo(integer, styleMap.get(integer))).sorted(Comparator.comparing(TypeVo::getType)).collect(Collectors.toList());
map.put("types",typeVoList);
return ResultUtil.success(map);
} }
/** /**
......
...@@ -218,6 +218,12 @@ public interface DeviceLibraryService { ...@@ -218,6 +218,12 @@ public interface DeviceLibraryService {
*/ */
List<DeviceLibrary> findAllByPackingId(Integer packingId); List<DeviceLibrary> findAllByPackingId(Integer packingId);
/**
* 根据partParentId查询附件
* @param id 装备的id
*/
List<DeviceLibrary> findAllByPartParentId(Integer id);
/** /**
* 通过列装id查询所有装备 * 通过列装id查询所有装备
*/ */
...@@ -275,13 +281,13 @@ public interface DeviceLibraryService { ...@@ -275,13 +281,13 @@ public interface DeviceLibraryService {
* 装备的解除 * 装备的解除
* @param deviceId 装备id * @param deviceId 装备id
*/ */
void relieveDevice(int deviceId); // void relieveDevice(int deviceId);
/** // /**
* 装备的绑定 // * 装备的绑定
* @param // * @param
*/ // */
void bindingDevice(BindingDeviceVo bindingDeviceVo); // void bindingDevice(BindingDeviceVo bindingDeviceVo);
/** /**
* 以下接口都为缓存做铺垫 * 以下接口都为缓存做铺垫
...@@ -441,4 +447,23 @@ public interface DeviceLibraryService { ...@@ -441,4 +447,23 @@ public interface DeviceLibraryService {
// * @return 影响行数 // * @return 影响行数
// */ // */
// int updatePartParentId(List<Integer> deviceIds); // int updatePartParentId(List<Integer> deviceIds);
/**
* 装备进行解绑
* @param deviceLibraries 装备附件的集合
*/
void unboundDevice(List<DeviceLibrary> deviceLibraries);
/**
* 装备绑定
* @param bindingDeviceVo 装备绑定的vo
*/
void boundDevice(BindingDeviceVo bindingDeviceVo);
/**
* 根据rfid查询装备
* @return 装备的集合
*/
List<DeviceLibrary> getAllBySeqNumber(String rfid);
} }
...@@ -656,6 +656,11 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -656,6 +656,11 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
return deviceLibraryDao.findAllByPackingId(packingId); return deviceLibraryDao.findAllByPackingId(packingId);
} }
@Override
public List<DeviceLibrary> findAllByPartParentId(Integer id) {
return deviceLibraryDao.findAllByPartParentId(id);
}
// @Override // @Override
// public List<DeviceLibrary> findAllByPackingId2(List<Integer> packingIds) { // public List<DeviceLibrary> findAllByPackingId2(List<Integer> packingIds) {
// //查询可以使用并且在库 是所在或者所属是自己的 // //查询可以使用并且在库 是所在或者所属是自己的
...@@ -817,48 +822,48 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -817,48 +822,48 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
} }
@Override // @Override
@UpdateCache // @UpdateCache
public void relieveDevice(int deviceId) { // public void relieveDevice(int deviceId) {
Integer currentUserId = userUtils.getCurrentUserId(); // Integer currentUserId = userUtils.getCurrentUserId();
//根据装备id查询附件 // //根据装备id查询附件
List<DeviceLibrary> deviceLibraries = deviceLibraryDao.findAllByPartParentId(deviceId); // List<DeviceLibrary> deviceLibraries = deviceLibraryDao.findAllByPartParentId(deviceId);
deviceLibraries.forEach(deviceLibrary -> { // deviceLibraries.forEach(deviceLibrary -> {
deviceLibrary.setPartParentId(null); // deviceLibrary.setPartParentId(null);
update(deviceLibrary); // update(deviceLibrary);
//添加日志 // //添加日志
String remark = "该装备进行解绑"; // String remark = "该装备进行解绑";
DeviceLogDto deviceLogDto = new DeviceLogDto(deviceId, remark, null,currentUserId,null); // DeviceLogDto deviceLogDto = new DeviceLogDto(deviceId, remark, null,currentUserId,null);
deviceLogService.addLog(deviceLogDto); // deviceLogService.addLog(deviceLogDto);
}); // });
} // }
@Override // @Override
@UpdateCache // @UpdateCache
public void bindingDevice(BindingDeviceVo bindingDeviceVo) { // public void bindingDevice(BindingDeviceVo bindingDeviceVo) {
Integer currentUserId = userUtils.getCurrentUserId(); // Integer currentUserId = userUtils.getCurrentUserId();
//查询需要绑定的装备的型号和被绑定的装备的型号 // //查询需要绑定的装备的型号和被绑定的装备的型号
DeviceLibrary originDev = deviceLibraryDao.findById(bindingDeviceVo.getOriginDeviceId()).get(); // DeviceLibrary originDev = deviceLibraryDao.findById(bindingDeviceVo.getOriginDeviceId()).get();
DeviceLibrary toDev = deviceLibraryDao.findById(bindingDeviceVo.getToDeviceId()).get(); // DeviceLibrary toDev = deviceLibraryDao.findById(bindingDeviceVo.getToDeviceId()).get();
if (!originDev.getModel().equals(toDev.getModel())){ // if (!originDev.getModel().equals(toDev.getModel())){
//型号进行修改 // //型号进行修改
List<DeviceLibrary> libraries = deviceLibraryDao.findAllByPartParentId(originDev.getId()); // List<DeviceLibrary> libraries = deviceLibraryDao.findAllByPartParentId(originDev.getId());
libraries.forEach(deviceLibrary -> { // libraries.forEach(deviceLibrary -> {
deviceLibrary.setModel(toDev.getModel()); // deviceLibrary.setModel(toDev.getModel());
update(deviceLibrary); // update(deviceLibrary);
}); // });
String remark = "由于需要进行装备的绑定,原来型号修改为"+toDev.getModel(); // String remark = "由于需要进行装备的绑定,原来型号修改为"+toDev.getModel();
DeviceLogDto deviceLogDto = new DeviceLogDto(toDev.getId(), remark, null,currentUserId,null); // DeviceLogDto deviceLogDto = new DeviceLogDto(toDev.getId(), remark, null,currentUserId,null);
deviceLogService.addLog(deviceLogDto); // deviceLogService.addLog(deviceLogDto);
} // }
originDev.setModel(toDev.getModel()); // originDev.setModel(toDev.getModel());
originDev.setPartParentId(toDev.getId()); // originDev.setPartParentId(toDev.getId());
update(originDev); // update(originDev);
//添加日志 // //添加日志
String remark = "原装备和"+toDev.getName()+"的装备进行绑定"; // String remark = "原装备和"+toDev.getName()+"的装备进行绑定";
DeviceLogDto deviceLogDto = new DeviceLogDto(toDev.getId(), remark, null,currentUserId,null); // DeviceLogDto deviceLogDto = new DeviceLogDto(toDev.getId(), remark, null,currentUserId,null);
deviceLogService.addLog(deviceLogDto); // deviceLogService.addLog(deviceLogDto);
} // }
@Override @Override
@UpdateCache @UpdateCache
...@@ -977,6 +982,40 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -977,6 +982,40 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
return cacheLibraryService.getAllDeviceLibraryList(); return cacheLibraryService.getAllDeviceLibraryList();
} }
@Override
@UpdateCache
public void unboundDevice(List<DeviceLibrary> deviceLibraries) {
//将附件的父id设置为null
if (deviceLibraries.size()>0){
deviceLibraries.forEach(deviceLibrary -> {
deviceLibrary.setPartParentId(null);
update(deviceLibrary);
});
}else {
throw new ApiException("请选择解绑的装备");
}
}
@Override
@UpdateCache
public void boundDevice(BindingDeviceVo bindingDeviceVo) {
//取出装备的id
DeviceLibrary orginDeviceLibrary = bindingDeviceVo.getOrginDeviceLibrary();
Integer id = orginDeviceLibrary.getId();
//将附件的父id设置为装备的id
List<DeviceLibrary> deviceLibraries = bindingDeviceVo.getDeviceLibraries();
deviceLibraries.forEach(deviceLibrary -> {
deviceLibrary.setPartParentId(id);
deviceLibrary.setModel(orginDeviceLibrary.getModel());
update(deviceLibrary);
});
}
@Override
public List<DeviceLibrary> getAllBySeqNumber(String rfid) {
return deviceLibraryDao.getAllBySeqNumber(rfid);
}
// @Override // @Override
// @UpdateCache // @UpdateCache
// public int updatePartParentId(List<Integer> deviceIds) { // public int updatePartParentId(List<Integer> deviceIds) {
......
package com.tykj.dev.device.library.subject.vo; package com.tykj.dev.device.library.subject.vo;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.List;
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@ApiModel("装备绑定的vo") @ApiModel("装备绑定的vo")
public class BindingDeviceVo { public class BindingDeviceVo {
@ApiModelProperty(value = "要绑定的装备id") @ApiModelProperty(value = "装备")
private Integer originDeviceId; private DeviceLibrary orginDeviceLibrary;
@ApiModelProperty(value = "需要绑定到的装备id") @ApiModelProperty(value = "附件集合")
private Integer toDeviceId; private List<DeviceLibrary> deviceLibraries;
} }
...@@ -15,6 +15,9 @@ import java.util.List; ...@@ -15,6 +15,9 @@ import java.util.List;
@ApiModel("装备查询类") @ApiModel("装备查询类")
public class DeviceLibrarySelectVo extends CustomPage { public class DeviceLibrarySelectVo extends CustomPage {
@ApiModelProperty(value = "装备id", example = "1")
public Integer deviceId;
@ApiModelProperty(value = "操作人", example = "1") @ApiModelProperty(value = "操作人", example = "1")
public Integer UserAId; public Integer UserAId;
......
package com.tykj.dev.device.matching.controller; package com.tykj.dev.device.matching.controller;
import com.lowagie.text.pdf.SequenceList;
import com.tykj.dev.config.cache.ConfigCache; import com.tykj.dev.config.cache.ConfigCache;
import com.tykj.dev.config.swagger.AutoDocument; import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.file.entity.FileRet; import com.tykj.dev.device.file.entity.FileRet;
...@@ -16,19 +17,24 @@ import com.tykj.dev.device.matching.repository.MatchingDeviceLibraryDao; ...@@ -16,19 +17,24 @@ import com.tykj.dev.device.matching.repository.MatchingDeviceLibraryDao;
import com.tykj.dev.device.matching.repository.MatchingRepairBillDao; import com.tykj.dev.device.matching.repository.MatchingRepairBillDao;
import com.tykj.dev.device.matching.service.MatchingDeviceBillService; import com.tykj.dev.device.matching.service.MatchingDeviceBillService;
import com.tykj.dev.device.matching.service.MatchingDeviceLibraryService; import com.tykj.dev.device.matching.service.MatchingDeviceLibraryService;
import com.tykj.dev.device.matching.service.MatchingDeviceModelService;
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceBill; import com.tykj.dev.device.matching.subject.domin.MatchingDeviceBill;
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary; import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary;
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceModel;
import com.tykj.dev.device.matching.subject.domin.MatchingRepairBill; import com.tykj.dev.device.matching.subject.domin.MatchingRepairBill;
import com.tykj.dev.device.matching.subject.vo.*; import com.tykj.dev.device.matching.subject.vo.*;
import com.tykj.dev.device.task.service.TaskLogService; import com.tykj.dev.device.task.service.TaskLogService;
import com.tykj.dev.device.task.service.TaskService; import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto; import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.user.read.service.MessageService; import com.tykj.dev.device.user.read.service.MessageService;
import com.tykj.dev.device.user.read.subject.bto.MessageBto; import com.tykj.dev.device.user.read.subject.bto.MessageBto;
import com.tykj.dev.device.user.subject.service.UserPublicService; import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils; import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.BusinessEnum; import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.StatusEnum; import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.utils.DeviceSeqUtil;
import com.tykj.dev.misc.utils.MapperUtils;
import com.tykj.dev.misc.utils.StringSplitUtil; import com.tykj.dev.misc.utils.StringSplitUtil;
import com.tykj.dev.rfid.entity.vo.PrintVo; import com.tykj.dev.rfid.entity.vo.PrintVo;
import com.tykj.dev.rfid.service.RfidService; import com.tykj.dev.rfid.service.RfidService;
...@@ -41,11 +47,13 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -41,11 +47,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.Min; import javax.validation.constraints.Min;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -103,55 +111,107 @@ public class MatchingDeviceController { ...@@ -103,55 +111,107 @@ public class MatchingDeviceController {
@Autowired @Autowired
private RfidService rfidService; private RfidService rfidService;
@Autowired
private MatchingDeviceModelService matchingDeviceModelService;
@ApiOperation(value = "将设备进行拆分", notes = "将设备进行拆分")
@PostMapping(value = "/matchingDeviceSplit")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity matchingDeviceSplit(@RequestBody List<MatchingDeviceSaveVo> matchingDeviceSaveVos) {
List<MatchingDeviceSaveVo> matchingDeviceSaveVoList = new ArrayList<>();
for (MatchingDeviceSaveVo matchingDeviceSaveVo : matchingDeviceSaveVos) {
List<String> seqList = matchingDeviceSaveVo.getSeqList();
for (int i = 0; i < seqList.size(); i++) {
MatchingDeviceSaveVo matchingDeviceSaveVo1 = new MatchingDeviceSaveVo();
BeanUtils.copyProperties(matchingDeviceSaveVo,matchingDeviceSaveVo1);
matchingDeviceSaveVo1.setSeqNumber(seqList.get(i));
matchingDeviceSaveVoList.add(matchingDeviceSaveVo1);
}
}
return ResponseEntity.ok(matchingDeviceSaveVoList);
}
@ApiOperation(value = "添加配套设备", notes = "可以通过这个接口添加配套设备") @ApiOperation(value = "添加配套设备", notes = "可以通过这个接口添加配套设备")
@PostMapping(value = "/add") @PostMapping(value = "/add")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity addStorageBill(@RequestBody @Validated MatchingDeviceBillSaveVo matchingDeviceBillSaveVo) { public ResponseEntity addStorageBill(@RequestBody @Validated MatchingDeviceBillSaveVo matchingDeviceBillSaveVo) {
List<String> existSeqs = matchingDeviceLibraryDao.findAll().stream().map(MatchingDeviceLibrary::getSeqNumber).collect(Collectors.toList()); Boolean isPrint = matchingDeviceBillSaveVo.getIsPrint() != 0;
List<String> addSeqs = matchingDeviceBillSaveVo.getMatchingDeviceSaveVoList().stream().map(MatchingDeviceSaveVo::getSeqNumber).collect(Collectors.toList());
existSeqs.retainAll(addSeqs);
if (existSeqs.size()>0){
return ResponseEntity.ok(StringSplitUtil.stringListToString(existSeqs));
}
//添加账单 //添加账单
MatchingDeviceBill matchingDeviceBillEntity = matchingDeviceBillSaveVo.toDo(); // MatchingDeviceBill matchingDeviceBillEntity = matchingDeviceBillSaveVo.toDo();
matchingDeviceBillEntity.setFileRets(FilesUtil.stringFileToList(matchingDeviceBillSaveVo.getFileRets())); // matchingDeviceBillEntity.setFileRets(FilesUtil.stringFileToList(matchingDeviceBillSaveVo.getFileRets()));
MatchingDeviceBill m = matchingDeviceBillService.addEntity(matchingDeviceBillEntity); // MatchingDeviceBill m = matchingDeviceBillService.addEntity(matchingDeviceBillEntity);
StringBuffer stringBuffer = new StringBuffer(); StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("x"); stringBuffer.append("x");
Integer userId = userUtils.getCurrentUserId(); Integer userId = userUtils.getCurrentUserId();
//发起任务 //发起任务
List<Integer> userIds = new ArrayList<>(); List<Integer> userIds = new ArrayList<>();
userIds.add(userId); userIds.add(userId);
// userIds.add(matchingDeviceBillSaveVo.getUserbId()); //保存后的task
TaskBto taskBto = new TaskBto(StatusEnum.END.id, "新增配套", null, ".", m.getId(), 19, userUtils.getCurrentUnitId(), 0, null, userIds); TaskBto taskBto1;
TaskBto taskBto1 = taskService.start(taskBto); //更新后的MatchingDeviceBill
MatchingDeviceBill updateMatchingDeviceBill;
//处理账单
if (matchingDeviceBillSaveVo.getTaskId() != null){
//从草稿进来的
taskBto1 = taskService.get(matchingDeviceBillSaveVo.getTaskId());
MatchingDeviceBill matchingDeviceBill = matchingDeviceBillService.getOne(taskBto1.getBillId());
MatchingDeviceBill matchingDeviceBill1 = matchingDeviceBillSaveVo.toDo();
matchingDeviceBill.setFileRets(FilesUtil.stringFileToList(matchingDeviceBillSaveVo.getFileRets()));
BeanUtils.copyProperties(matchingDeviceBill1,matchingDeviceBill);
updateMatchingDeviceBill = matchingDeviceBillService.update(matchingDeviceBill);
//结束Task
taskService.addInvolveUser(taskBto1,userId);
taskService.moveToEnd(taskBto1);
}else {
//发起新的任务
updateMatchingDeviceBill = matchingDeviceBillService.addEntity(matchingDeviceBillSaveVo.toDo());
TaskBto taskBto = new TaskBto(StatusEnum.END.id, "新增配套", null, ".",
updateMatchingDeviceBill.getId(), 19, userUtils.getCurrentUnitId(),
0, null, userIds);
taskBto1 = taskService.start(taskBto);
}
//日志文件 //日志文件
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("新增确认单", matchingDeviceBillEntity.getFileName(), matchingDeviceBillEntity.getFileUrl())); fileVoList.add(new FileVo("新增确认单", updateMatchingDeviceBill.getFileName(), updateMatchingDeviceBill.getFileUrl()));
//添加业务日志
// TaskLogBto taskLogBto2 = new TaskLogBto(taskBto1.getId(), "发起新增配套", fileVoList);
// taskLogService.addLog(taskLogBto2);
List<PrintVo> printVos = new ArrayList<>(); List<PrintVo> printVos = new ArrayList<>();
List<MatchingDeviceLibrary> matchingDeviceLibraries = new ArrayList<>();
String logMessage;
if (isPrint){
logMessage = "新增配套设备入库(打印标签)";
}
else {
logMessage = "新增配套设备入库(未打印标签)";
}
//存储配套设备
for (MatchingDeviceSaveVo matchingDeviceSaveVo : matchingDeviceBillSaveVo.getMatchingDeviceSaveVoList()) { for (MatchingDeviceSaveVo matchingDeviceSaveVo : matchingDeviceBillSaveVo.getMatchingDeviceSaveVoList()) {
MatchingDeviceLibrary matchingDeviceLibraryEntity = matchingDeviceSaveVo.toDo(); MatchingDeviceLibrary matchingDeviceLibraryEntity = matchingDeviceSaveVo.toDo();
MatchingDeviceLibrary d = matchingDeviceLibraryService.addEntity(matchingDeviceLibraryEntity); MatchingDeviceLibrary matchingDeviceLibrary = matchingDeviceLibraryService.addEntity(matchingDeviceLibraryEntity);
printVos.add(new PrintVo(String.valueOf(d.getId()), d.getModel(), d.getName(),d.getSeqNumber())); matchingDeviceLibraries.add(matchingDeviceLibrary);
d.setRfidCardId(RfidServiceImpl.completeRfidStr2(String.valueOf(d.getId()))); matchingDeviceLibraryService.update(matchingDeviceLibrary);
matchingDeviceLibraryService.update(d); stringBuffer.append(matchingDeviceLibrary.getId());
stringBuffer.append(d.getId());
stringBuffer.append("x"); stringBuffer.append("x");
//存装备日志 //存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(1, d.getId(), "发起新增配套", fileVoList,taskBto1.getId()); DeviceLogDto deviceLogDto = new DeviceLogDto(1, matchingDeviceLibrary.getId(), logMessage, fileVoList,taskBto1.getId());
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
} }
// rfidService.printString(printVos); //是否打印标签
if (matchingDeviceBillSaveVo.getIsPrint() == 1){
for (MatchingDeviceLibrary matchingDeviceLibrary : matchingDeviceLibraries) {
printVos.add(new PrintVo(String.valueOf(matchingDeviceLibrary.getId()), matchingDeviceLibrary.getModel(),
matchingDeviceLibrary.getName(),matchingDeviceLibrary.getSeqNumber()));
matchingDeviceLibrary.setRfidCardId(RfidServiceImpl.completeRfidStr2(String.valueOf(matchingDeviceLibrary.getId())));
matchingDeviceLibraryService.update(matchingDeviceLibrary);
}
rfidService.printString(printVos);
}
//set账单新增设备详情 //set账单新增设备详情
m.setDeviceDetail(stringBuffer.toString()); updateMatchingDeviceBill.setDeviceDetail(stringBuffer.toString());
matchingDeviceBillService.update(m); matchingDeviceBillService.update(updateMatchingDeviceBill);
//发送阅知信息 //发送阅知信息
List<Integer> ids = userPublicService.findOtherUser(userId); List<Integer> ids = userPublicService.findOtherUser(userId);
MessageBto messageBto = new MessageBto(taskBto1.getId(),taskBto1.getBusinessType(),"业务办结",ids,1); MessageBto messageBto = new MessageBto(taskBto1.getId(),taskBto1.getBusinessType(),"业务办结",ids,1);
...@@ -160,6 +220,60 @@ public class MatchingDeviceController { ...@@ -160,6 +220,60 @@ public class MatchingDeviceController {
return ResponseEntity.ok("ok"); return ResponseEntity.ok("ok");
} }
// @ApiOperation(value = "添加配套设备", notes = "可以通过这个接口添加配套设备")
// @PostMapping(value = "/add")
// @Transactional(rollbackFor = Exception.class)
// public ResponseEntity addStorageBill(@RequestBody @Validated MatchingDeviceBillSaveVo matchingDeviceBillSaveVo) {
// List<String> existSeqs = matchingDeviceLibraryDao.findAll().stream().map(MatchingDeviceLibrary::getSeqNumber).collect(Collectors.toList());
// List<String> addSeqs = matchingDeviceBillSaveVo.getMatchingDeviceSaveVoList().stream().map(MatchingDeviceSaveVo::getSeqNumber).collect(Collectors.toList());
// existSeqs.retainAll(addSeqs);
// if (existSeqs.size()>0){
// return ResponseEntity.ok(StringSplitUtil.stringListToString(existSeqs));
// }
// //添加账单
// MatchingDeviceBill matchingDeviceBillEntity = matchingDeviceBillSaveVo.toDo();
// matchingDeviceBillEntity.setFileRets(FilesUtil.stringFileToList(matchingDeviceBillSaveVo.getFileRets()));
// MatchingDeviceBill m = matchingDeviceBillService.addEntity(matchingDeviceBillEntity);
// StringBuffer stringBuffer = new StringBuffer();
// stringBuffer.append("x");
// Integer userId = userUtils.getCurrentUserId();
// //发起任务
// List<Integer> userIds = new ArrayList<>();
// userIds.add(userId);
//// userIds.add(matchingDeviceBillSaveVo.getUserbId());
// TaskBto taskBto = new TaskBto(StatusEnum.END.id, "新增配套", null, ".", m.getId(), 19, userUtils.getCurrentUnitId(), 0, null, userIds);
// TaskBto taskBto1 = taskService.start(taskBto);
// //日志文件
// List<FileVo> fileVoList = new ArrayList<>();
// fileVoList.add(new FileVo("新增确认单", matchingDeviceBillEntity.getFileName(), matchingDeviceBillEntity.getFileUrl()));
// //添加业务日志
//// TaskLogBto taskLogBto2 = new TaskLogBto(taskBto1.getId(), "发起新增配套", fileVoList);
//// taskLogService.addLog(taskLogBto2);
// List<PrintVo> printVos = new ArrayList<>();
// for (MatchingDeviceSaveVo matchingDeviceSaveVo : matchingDeviceBillSaveVo.getMatchingDeviceSaveVoList()) {
// MatchingDeviceLibrary matchingDeviceLibraryEntity = matchingDeviceSaveVo.toDo();
// MatchingDeviceLibrary d = matchingDeviceLibraryService.addEntity(matchingDeviceLibraryEntity);
// printVos.add(new PrintVo(String.valueOf(d.getId()), d.getModel(), d.getName(),d.getSeqNumber()));
// d.setRfidCardId(RfidServiceImpl.completeRfidStr2(String.valueOf(d.getId())));
// matchingDeviceLibraryService.update(d);
// stringBuffer.append(d.getId());
// stringBuffer.append("x");
// //存装备日志
// DeviceLogDto deviceLogDto = new DeviceLogDto(1, d.getId(), "发起新增配套", fileVoList,taskBto1.getId());
// deviceLogService.addLog(deviceLogDto);
// }
//// rfidService.printString(printVos);
// //set账单新增设备详情
// m.setDeviceDetail(stringBuffer.toString());
// matchingDeviceBillService.update(m);
// //发送阅知信息
// List<Integer> ids = userPublicService.findOtherUser(userId);
// MessageBto messageBto = new MessageBto(taskBto1.getId(),taskBto1.getBusinessType(),"业务办结",ids,1);
// messageService.add(messageBto);
// myWebSocket.sendMessage1();
// return ResponseEntity.ok("ok");
// }
@ApiOperation(value = "添加配套设备审核", notes = "可以通过这个接口添加配套设备审核") @ApiOperation(value = "添加配套设备审核", notes = "可以通过这个接口添加配套设备审核")
@PostMapping(value = "/confirm")//不用了 @PostMapping(value = "/confirm")//不用了
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -249,7 +363,6 @@ public class MatchingDeviceController { ...@@ -249,7 +363,6 @@ public class MatchingDeviceController {
} }
@ApiOperation(value = "更新配套设备", notes = "可以通过这个接口更新配套设备") @ApiOperation(value = "更新配套设备", notes = "可以通过这个接口更新配套设备")
@PostMapping("/update") @PostMapping("/update")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -369,4 +482,112 @@ public class MatchingDeviceController { ...@@ -369,4 +482,112 @@ public class MatchingDeviceController {
BeanUtils.copyProperties(matchingRepairVo,matchingRepairBill); BeanUtils.copyProperties(matchingRepairVo,matchingRepairBill);
return ResponseEntity.ok(matchingRepairBillDao.save(matchingRepairBill)); return ResponseEntity.ok(matchingRepairBillDao.save(matchingRepairBill));
} }
@ApiOperation(value = "自动生成配套设备的序列号", notes = "可以通过这个接口自动生成配套设备序列号")
@PostMapping(value = "/autoCreateForMatchingDevice")
public ResponseEntity autoCreateForMatchingDevice(@RequestBody MatchingDeviceCreateSeqVo createSeqVo){
Integer num = createSeqVo.getNum();
//查询该型号是否是第一次生成(需要保证后4位数唯一)
List<String> byModelForSeqNumber = matchingDeviceLibraryService.findByModelForSeqNumber(createSeqVo.getModel());
int start =0;
if (!CollectionUtils.isEmpty(byModelForSeqNumber)){
//说明数据库中存有该集合中的数字 取出最大的
String s = byModelForSeqNumber.get(0);
start = Integer.parseInt(s);
}
List<String> seq2 = createSeq(start+1, start+1+num);
String model = createSeqVo.getModel();
//通过型号查询对应的id
MatchingDeviceModel matchingDeviceModel = matchingDeviceModelService.findByModel(model);
String idString;
if (matchingDeviceModel != null){
idString = matchingDeviceModel.getId().toString();
}else {
MatchingDeviceModel matchingDeviceModel1 = new MatchingDeviceModel();
matchingDeviceModel1.setModel(model);
MatchingDeviceModel addEntity = matchingDeviceModelService.addEntity(matchingDeviceModel1);
idString = addEntity.getId().toString();
}
switch (idString.length()){
case 1:
idString = "000"+idString;
break;
case 2:
idString = "00"+idString;
break;
case 3:
idString = "0"+idString;
break;
default:
break;
}
String type = "02";
String style = createSeqVo.getStyle();
if (style.length()<2){
style = "0"+style;
}
StringBuilder stringBuilder = new StringBuilder();
String modelTypeStyle = idString+type+style;
stringBuilder
.append(modelTypeStyle)
.append(seq2.get(0))
.append("-")
.append(modelTypeStyle)
.append(seq2.get(seq2.size()-1));
List<String> updateSeq2 = seq2.stream().map(str -> modelTypeStyle + str).collect(Collectors.toList());
MatchingDeviceSeqVo matchingDeviceSeqVo = new MatchingDeviceSeqVo(model, createSeqVo.getName(),
style,num,stringBuilder.toString(),updateSeq2);
return ResponseEntity.ok(matchingDeviceSeqVo);
}
@ApiOperation(value = "保存配套设备单", notes = "可以通过这个接口保存配套设备单")
@PostMapping(value = "/saveMatchingDeviceBill")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity saveStorageBill(@RequestBody MatchingDeviceBillSaveVo matchingDeviceBillSaveVo) {
//第一次保存
if (matchingDeviceBillSaveVo.getTaskId()==null){
//保存入库单
Integer userId = userUtils.getCurrentUserId();
List<Integer> userIds = new ArrayList<>();
userIds.add(userId);
MatchingDeviceBill matchingDeviceBill = matchingDeviceBillSaveVo.toDo();
matchingDeviceBill.setBillStatus(0);
MatchingDeviceBill matchingDeviceBill1 = matchingDeviceBillService.addEntity(matchingDeviceBill);
//发起任务
TaskBto taskBto = new TaskBto(StatusEnum.WAIT_STORAGE.id,
matchingDeviceBillSaveVo.getUseraId()+"进行了新增配套设备业务", null,
".", matchingDeviceBill.getId(), 19,
userUtils.getCurrentUnitId(), 0, null, userIds);
TaskBto taskBto1 = taskService.start(taskBto);
myWebSocket.sendMessage1();
return ResponseEntity.ok("保存成功"+taskBto1.getId());
}
else {
//更新账单
TaskBto taskBto = taskService.get(matchingDeviceBillSaveVo.getTaskId());
MatchingDeviceBill matchingDeviceBill = matchingDeviceBillService.getOne(taskBto.getBillId());
MatchingDeviceBill matchingDeviceBill1 = matchingDeviceBillSaveVo.toDo();
matchingDeviceBill1.setBillStatus(0);
MapperUtils.copyNoNullProperties(matchingDeviceBill1,matchingDeviceBill);
matchingDeviceBillService.update(matchingDeviceBill);
return ResponseEntity.ok("更新成功"+taskBto.getId());
}
}
/**
* @return 生成配套设备附件的序列号
*/
private List<String> createSeq(int start,int num) {
List<String> list = new ArrayList<>();
for (int i = start; i < num; i++) {
String s = String.format("%04d", i);
list.add(s);
}
return list;
}
} }
...@@ -4,8 +4,13 @@ import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary; ...@@ -4,8 +4,13 @@ import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
public interface MatchingDeviceLibraryDao extends JpaRepository<MatchingDeviceLibrary, Integer>, JpaSpecificationExecutor<MatchingDeviceLibrary> { public interface MatchingDeviceLibraryDao extends JpaRepository<MatchingDeviceLibrary, Integer>, JpaSpecificationExecutor<MatchingDeviceLibrary> {
List<MatchingDeviceLibrary> findAllByModel(String model);
} }
package com.tykj.dev.device.matching.repository;
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceModel;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author zsp
*/
public interface MatchingDeviceModelDao extends JpaRepository<MatchingDeviceModel, Integer>, JpaSpecificationExecutor<MatchingDeviceModel> {
MatchingDeviceModel findByModel(String model);
}
...@@ -52,4 +52,12 @@ public interface MatchingDeviceLibraryService { ...@@ -52,4 +52,12 @@ public interface MatchingDeviceLibraryService {
* @return 所有名称 * @return 所有名称
*/ */
List<String> getAllName(); List<String> getAllName();
/**
* 根据型号查询序列号是否是第一次生成
* @param model 型号
* @return 返回值是序列号列表
*/
List<String> findByModelForSeqNumber(String model);
} }
package com.tykj.dev.device.matching.service;
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceModel;
public interface MatchingDeviceModelService {
/**
* 新增
*/
MatchingDeviceModel addEntity(MatchingDeviceModel matchingDeviceModel);
/**
* 通过型号查询
*/
MatchingDeviceModel findByModel(String model);
}
...@@ -155,6 +155,16 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe ...@@ -155,6 +155,16 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
return new ArrayList<>(names); return new ArrayList<>(names);
} }
@Override
public List<String> findByModelForSeqNumber(String model) {
//根据型号查询是否是第一次生成 如果不是取出来最大值
List<MatchingDeviceLibrary> matchingDeviceLibraryList = matchingDeviceLibraryDao.findAllByModel(model);
return matchingDeviceLibraryList.stream().filter(matchingDeviceLibrary -> matchingDeviceLibrary.getSeqNumber().contains(model))
.map(matchingDeviceLibrary -> matchingDeviceLibrary.getSeqNumber().substring(matchingDeviceLibrary.getSeqNumber().length()-4))
.sorted(Comparator.comparing(String::toString).reversed())
.collect(Collectors.toList());
}
/** /**
* @param matchingDeviceSelectVo 配套设备查询vo * @param matchingDeviceSelectVo 配套设备查询vo
* 创建通用查询条件筛选器 * 创建通用查询条件筛选器
......
package com.tykj.dev.device.matching.service.impl;
import com.tykj.dev.device.matching.repository.MatchingDeviceModelDao;
import com.tykj.dev.device.matching.service.MatchingDeviceModelService;
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class MatchingDeviceModelServiceImpl implements MatchingDeviceModelService {
@Autowired
private MatchingDeviceModelDao matchingDeviceModelDao;
@Override
public MatchingDeviceModel addEntity(MatchingDeviceModel matchingDeviceModel) {
return matchingDeviceModelDao.save(matchingDeviceModel);
}
@Override
public MatchingDeviceModel findByModel(String model) {
return matchingDeviceModelDao.findByModel(model);
}
}
...@@ -104,6 +104,8 @@ public class MatchingDeviceBill { ...@@ -104,6 +104,8 @@ public class MatchingDeviceBill {
@Column(name = "file_rets",columnDefinition = "TEXT") @Column(name = "file_rets",columnDefinition = "TEXT")
private String fileRets; private String fileRets;
@Transient @Transient
@ApiModelProperty(value = "配发文件集合对象") @ApiModelProperty(value = "配发文件集合对象")
private List<FileRet> fileRetList ; private List<FileRet> fileRetList ;
......
package com.tykj.dev.device.matching.subject.domin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
/**
* zsp
*/
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@SQLDelete(sql = "update matching_device_model set delete_tag = 1 where id = ?")
@Where(clause = "delete_tag = 0")
@ApiModel("配套设备型号")
public class MatchingDeviceModel {
/**
* 主键id
*/
@Id
@GeneratedValue
@ApiModelProperty(name = "主键id")
@Column(columnDefinition = "integer NOT NULL AUTO_INCREMENT")
private Integer id;
/**
* 型号
*/
@ApiModelProperty(value = "型号")
private String model;
/**
* delete_tag
*/
@ApiModelProperty(value = "删除标志位")
private Integer delete_tag = 0;
}
...@@ -40,6 +40,12 @@ public class MatchingDeviceBillSaveVo { ...@@ -40,6 +40,12 @@ public class MatchingDeviceBillSaveVo {
private List<FileRet> fileRets; private List<FileRet> fileRets;
@ApiModelProperty(value = "是否打印rfid标签(1:是,0:否)")
private Integer isPrint = 0;
@ApiModelProperty(value = "任务id")
private Integer taskId = 0;
@Valid @Valid
@NotEmpty(message = "matchingDeviceSaveVoList不能为空") @NotEmpty(message = "matchingDeviceSaveVoList不能为空")
@ApiModelProperty(value = "配套设备列表") @ApiModelProperty(value = "配套设备列表")
......
package com.tykj.dev.device.matching.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zsp
*/
@Data
@ApiModel("配套设备的装备序列号")
public class MatchingDeviceCreateSeqVo {
@ApiModelProperty(name = "型号")
private String model;
@ApiModelProperty(name = "名称")
private String name;
@ApiModelProperty(name = "形态",example = "1")
private String style;
@ApiModelProperty(name = "数量")
private Integer num;
}
...@@ -7,6 +7,7 @@ import lombok.Data; ...@@ -7,6 +7,7 @@ import lombok.Data;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.List;
/** /**
* @author dengdiyi * @author dengdiyi
...@@ -27,6 +28,10 @@ public class MatchingDeviceSaveVo { ...@@ -27,6 +28,10 @@ public class MatchingDeviceSaveVo {
@ApiModelProperty(value = "设备名称") @ApiModelProperty(value = "设备名称")
private String name; private String name;
@NotNull(message = "name不能为空")
@ApiModelProperty(value = "形态")
private String style;
@NotNull(message = "createUnit不能为空") @NotNull(message = "createUnit不能为空")
@ApiModelProperty(value = "创建单位") @ApiModelProperty(value = "创建单位")
private String createUnit; private String createUnit;
...@@ -43,6 +48,12 @@ public class MatchingDeviceSaveVo { ...@@ -43,6 +48,12 @@ public class MatchingDeviceSaveVo {
@ApiModelProperty(value = "rfid卡号") @ApiModelProperty(value = "rfid卡号")
private String rfidCardId; private String rfidCardId;
@ApiModelProperty(value = "入库的数量")
private Integer storageCount;
@ApiModelProperty(value = "序列号集合")
private List<String> seqList;
public MatchingDeviceLibrary toDo() { public MatchingDeviceLibrary toDo() {
MatchingDeviceLibrary matchingDeviceLibraryEntity = new MatchingDeviceLibrary(); MatchingDeviceLibrary matchingDeviceLibraryEntity = new MatchingDeviceLibrary();
BeanUtils.copyProperties(this, matchingDeviceLibraryEntity); BeanUtils.copyProperties(this, matchingDeviceLibraryEntity);
......
package com.tykj.dev.device.matching.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* zsp
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("配套设备序列号vo")
public class MatchingDeviceSeqVo {
@ApiModelProperty(value = "型号")
private String model;
@ApiModelProperty(name = "名称")
private String name;
@ApiModelProperty(name = "形态",example = "1")
private String style;
@ApiModelProperty(value = "入库数量")
private Integer storageCount;
@ApiModelProperty(value = "序列号区间")
private String seqInterval;
@ApiModelProperty(value = "序列号集合")
private List<String> seqList;
}
package com.tykj.dev.device.matching.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* zsp
*/
@Data
@ApiModel("新增配套详情返回类")
public class MatchingDeviceSplitVo {
@ApiModelProperty(value = "配套设备的vo")
private List<MatchingDeviceSaveVo> matchingDeviceSaveVos;
}
package com.tykj.dev.device.storage.subject.vo; package com.tykj.dev.device.storage.subject.vo;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.storage.subject.domin.StorageBill;
import com.tykj.dev.device.task.subject.vo.TaskLogUserVo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.List;
/** /**
* @author dengdiyi * @author zsp
*/ */
@Data @Data
@ApiModel("生成附件的装备序列号") @ApiModel("生成附件的装备序列号")
...@@ -20,8 +14,11 @@ public class CreateSeqVo { ...@@ -20,8 +14,11 @@ public class CreateSeqVo {
@ApiModelProperty(name = "型号") @ApiModelProperty(name = "型号")
private String model; private String model;
@ApiModelProperty(name = "形态") @ApiModelProperty(name = "类型",example = "1")
private Integer style; private String type;
@ApiModelProperty(name = "形态",example = "1")
private String style;
@ApiModelProperty(name = "数量") @ApiModelProperty(name = "数量")
private Integer num; private Integer num;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论