|
|
@@ -193,7 +193,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
public TradingBox add(TradingBox tradingBox) {
|
|
|
List<TradingBox> tradingBoxList = new ArrayList<>();
|
|
|
- if (ObjectUtils.isNotNull(tradingBox.getContractNo())){
|
|
|
+ if (ObjectUtils.isNotNull(tradingBox.getContractNo())) {
|
|
|
LambdaQueryWrapper<TradingBox> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
lambdaQueryWrapper.eq(TradingBox::getIsDeleted, 0)
|
|
|
.eq(TradingBox::getTenantId, AuthUtil.getTenantId())
|
|
|
@@ -236,17 +236,19 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
//箱号拼接字符串
|
|
|
List<String> codes = tradingBoxItemList.stream().map(TradingBoxItem::getCode).distinct().collect(Collectors.toList());
|
|
|
tradingBox.setCode(String.join(",", codes));
|
|
|
- /*StringBuilder boxTypeNumber = new StringBuilder();
|
|
|
- List<String> boxType = tradingBoxItemList.stream().map(TradingBoxItem::getBoxType).distinct().collect(Collectors.toList());
|
|
|
+ StringBuilder boxTypeNumber = new StringBuilder();
|
|
|
+ List<String> boxType = tradingBoxItemList.stream().filter(e -> ObjectUtils.isNotNull(e.getBoxType())).map(TradingBoxItem::getBoxType).distinct().collect(Collectors.toList());
|
|
|
for (String boxType_ : boxType) {
|
|
|
if (ObjectUtils.isNotNull(boxType) && boxType.size() > 0) {
|
|
|
List<TradingBoxItem> boxTypeSize = tradingBoxItemList.stream().filter(e -> ObjectUtils.isNotNull(e.getBoxType()) && e.getBoxType().equals(boxType_)).collect(Collectors.toList());
|
|
|
if (ObjectUtils.isNotNull(boxTypeSize) && boxTypeSize.size() > 0) {
|
|
|
- boxTypeNumber.append(boxType_).append("✖").append(boxTypeSize.size()).append(",");
|
|
|
+ boxTypeNumber.append(boxType_).append("X").append(boxTypeSize.size()).append(",");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- tradingBox.setBoxTypeNumber(boxTypeNumber.toString());*/
|
|
|
+ if (ObjectUtils.isNotNull(boxTypeNumber)){
|
|
|
+ tradingBox.setBoxTypeNumber(boxTypeNumber.substring(0, boxTypeNumber.length() - 1));
|
|
|
+ }
|
|
|
for (TradingBoxItem tradingBoxItem : tradingBoxItemList) {
|
|
|
if ("BUY".equals(tradingBox.getType())) {
|
|
|
tradingBoxItem.setBoxSource("购买");
|
|
|
@@ -373,6 +375,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
archivesTrajectory.setCreateUser(AuthUtil.getUserId());
|
|
|
archivesTrajectory.setCreateUserName(AuthUtil.getUserName());
|
|
|
archivesTrajectory.setTenantId(AuthUtil.getTenantId());
|
|
|
+ archivesTrajectory.setSrcId(tradingBox.getId());
|
|
|
archivesTrajectoryMapper.insert(archivesTrajectory);
|
|
|
} else {
|
|
|
throw new RuntimeException("箱号不能为空");
|
|
|
@@ -477,17 +480,19 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
//箱号拼接字符串
|
|
|
List<String> codes = tradingBoxItemList.stream().map(TradingBoxItem::getCode).distinct().collect(Collectors.toList());
|
|
|
tradingBox.setCode(String.join(",", codes));
|
|
|
- /*StringBuilder boxTypeNumber = new StringBuilder();
|
|
|
- List<String> boxType = tradingBoxItemList.stream().map(TradingBoxItem::getBoxType).distinct().collect(Collectors.toList());
|
|
|
+ StringBuilder boxTypeNumber = new StringBuilder();
|
|
|
+ List<String> boxType = tradingBoxItemList.stream().filter(e -> ObjectUtils.isNotNull(e.getBoxType())).map(TradingBoxItem::getBoxType).distinct().collect(Collectors.toList());
|
|
|
for (String boxType_ : boxType) {
|
|
|
if (ObjectUtils.isNotNull(boxType) && boxType.size() > 0) {
|
|
|
List<TradingBoxItem> boxTypeSize = tradingBoxItemList.stream().filter(e -> ObjectUtils.isNotNull(e.getBoxType()) && e.getBoxType().equals(boxType_)).collect(Collectors.toList());
|
|
|
if (ObjectUtils.isNotNull(boxTypeSize) && boxTypeSize.size() > 0) {
|
|
|
- boxTypeNumber.append(boxType_).append("✖").append(boxTypeSize.size()).append(",");
|
|
|
+ boxTypeNumber.append(boxType_).append("X").append(boxTypeSize.size()).append(",");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- tradingBox.setBoxTypeNumber(boxTypeNumber.toString());*/
|
|
|
+ if (ObjectUtils.isNotNull(boxTypeNumber)){
|
|
|
+ tradingBox.setBoxTypeNumber(boxTypeNumber.substring(0, boxTypeNumber.length() - 1));
|
|
|
+ }
|
|
|
for (TradingBoxItem tradingBoxItem : tradingBoxItemList) {
|
|
|
if (tradingBox.getType().equals("ZR")) {
|
|
|
tradingBoxItem.setBoxSource("租入");
|
|
|
@@ -511,7 +516,9 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
} else {
|
|
|
tradingBoxItem.setStatus("录入");
|
|
|
}
|
|
|
- transferService.stockpilingFee(codes);
|
|
|
+ List<String> codeList = new ArrayList<>();
|
|
|
+ codeList.add(tradingBoxItem.getCode());
|
|
|
+ transferService.stockpilingFee(codeList);
|
|
|
}
|
|
|
tradingBoxItem.setCreateUser(AuthUtil.getUserId());
|
|
|
tradingBoxItem.setCreateTime(new Date());
|
|
|
@@ -641,6 +648,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
archivesTrajectory.setCreateUser(AuthUtil.getUserId());
|
|
|
archivesTrajectory.setCreateUserName(AuthUtil.getUserName());
|
|
|
archivesTrajectory.setTenantId(AuthUtil.getTenantId());
|
|
|
+ archivesTrajectory.setSrcId(tradingBox.getId());
|
|
|
archivesTrajectoryMapper.insert(archivesTrajectory);
|
|
|
} else {
|
|
|
throw new RuntimeException("箱号不能为空");
|