|
@@ -224,6 +224,47 @@ public class SparePartInfoServiceImpl extends BaseServiceImpl<SparePartInfoMappe
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<SparePartInfo> getByIds(List<String> ids) {
|
|
|
+ Weekend<SparePartInfo> weekend = new Weekend<>(SparePartInfo.class);
|
|
|
+ weekend.weekendCriteria().andIn(SparePartInfo::getId, ids);
|
|
|
+ List<SparePartInfo> list = mapper.selectByExample(weekend);
|
|
|
+ List<SpareType> spareTypes = spareTypeMapper.selectAll();
|
|
|
+ for (SparePartInfo vo : list) {
|
|
|
+ if (StringUtils.isBlank(vo.getQrCode())) {
|
|
|
+ // 保存二维码
|
|
|
+ String path = CommonConstants.RESOURCE_PREFIX + "/png/" + DateUtil.formatDate(new Date()) + "/" + IdGeneratorUtils.getObjectId() + "/";
|
|
|
+ String rootPath = environment.getProperty("upload.root-dir");
|
|
|
+ String filePath = rootPath + path;
|
|
|
+ String codePath = path + vo.getId() + ".png";
|
|
|
+ CodeFileUtils.uploadFileECode(vo.getId(), rootPath, filePath, vo.getId() + ".png");
|
|
|
+ // 修改二维码
|
|
|
+ SparePartInfoDTO sbInfoDTO = new SparePartInfoDTO();
|
|
|
+ sbInfoDTO.setId(vo.getId());
|
|
|
+ sbInfoDTO.setQrCode(codePath);
|
|
|
+ vo.setQrCode(codePath);
|
|
|
+ this.updateQrCode(sbInfoDTO);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (vo.getTypeId() != null) {
|
|
|
+ spareTypes.forEach(spareType -> {
|
|
|
+ if (spareType.getId().equals(vo.getTypeId())) {
|
|
|
+ vo.setTypeName(spareType.getName());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Collections.sort(list, new Comparator<SparePartInfo>() {
|
|
|
+ @Override
|
|
|
+ public int compare(SparePartInfo o1, SparePartInfo o2) {
|
|
|
+ return o1.getNo().compareTo(o2.getNo());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
public static void main(String[] args) {
|
|
|
String ss = "TYPJ-CC-00002";
|
|
|
String newStr = ss.substring(ss.length() - 5);
|
|
@@ -373,7 +414,7 @@ public class SparePartInfoServiceImpl extends BaseServiceImpl<SparePartInfoMappe
|
|
|
model.setChildNo(type.getNo());
|
|
|
}
|
|
|
}
|
|
|
- Weekend<SysFile> weekendFile = new Weekend<>(SysFile.class);
|
|
|
+ /* Weekend<SysFile> weekendFile = new Weekend<>(SysFile.class);
|
|
|
weekendFile.weekendCriteria().andEqualTo(SysFile::getTargetId, model.getId());
|
|
|
List<SysFile> sysFiles = sysFileMapper.selectByExample(weekendFile);
|
|
|
List<SysFile> s = ListUtils.newArrayList();
|
|
@@ -383,7 +424,7 @@ public class SparePartInfoServiceImpl extends BaseServiceImpl<SparePartInfoMappe
|
|
|
applicationFileList.add(item);
|
|
|
}
|
|
|
});
|
|
|
- model.setApplicationFileList(applicationFileList);
|
|
|
+ model.setApplicationFileList(applicationFileList);*/
|
|
|
|
|
|
return model;
|
|
|
}
|
|
@@ -465,7 +506,7 @@ public class SparePartInfoServiceImpl extends BaseServiceImpl<SparePartInfoMappe
|
|
|
bom.setUpdateUserId(userInfo.getUserId());
|
|
|
sbModelSpareBomMapper.insert(bom);
|
|
|
}
|
|
|
- this.saveFile(model);
|
|
|
+ //this.saveFile(model);
|
|
|
|
|
|
// 如果初始化数量有了,就需要更新库存
|
|
|
if (model.getInitStock() == null) {
|
|
@@ -631,7 +672,7 @@ public class SparePartInfoServiceImpl extends BaseServiceImpl<SparePartInfoMappe
|
|
|
sbModelSpareBomMapper.updateBatchAll(BeanConverterUtil.copyListProperties(updateList, SbModelSpareBom.class));
|
|
|
}
|
|
|
}
|
|
|
- this.saveFile(model);
|
|
|
+ // this.saveFile(model);
|
|
|
super.modModelByDTO(model);
|
|
|
}
|
|
|
|
|
@@ -1095,4 +1136,23 @@ public class SparePartInfoServiceImpl extends BaseServiceImpl<SparePartInfoMappe
|
|
|
sbInfo.setQrCode(model.getQrCode());
|
|
|
mapper.updateByPrimaryKeySelective(sbInfo);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void generateQrCodeAll() {
|
|
|
+ List<SparePartInfo> list = mapper.selectAll();
|
|
|
+ for (SparePartInfo vo : list) {
|
|
|
+ // 保存二维码
|
|
|
+ String path = CommonConstants.RESOURCE_PREFIX + "/png/" + DateUtil.formatDate(new Date()) + "/" + vo.getId() + "/";
|
|
|
+ String rootPath = environment.getProperty("upload.root-dir");
|
|
|
+ String filePath = rootPath + path;
|
|
|
+ String codePath = path + vo.getId() + ".png";
|
|
|
+ CodeFileUtils.uploadFileECode(vo.getId(), rootPath, filePath, vo.getId() + ".png");
|
|
|
+ // 修改二维码
|
|
|
+ SparePartInfoDTO sbInfoDTO = new SparePartInfoDTO();
|
|
|
+ sbInfoDTO.setId(vo.getId());
|
|
|
+ sbInfoDTO.setQrCode(codePath);
|
|
|
+ vo.setQrCode(codePath);
|
|
|
+ this.updateQrCode(sbInfoDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|