|
|
@@ -23,6 +23,7 @@ import lombok.AllArgsConstructor;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
|
+import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.core.tool.utils.StringUtil;
|
|
|
import org.springblade.los.Util.BoxNumUtils;
|
|
|
import org.springblade.los.Util.CurrencyUtils;
|
|
|
@@ -1282,6 +1283,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public R generateBill(TradingBox tradingBoxs) {
|
|
|
if (tradingBoxs.getId() == null) {
|
|
|
throw new RuntimeException("缺少必要参数");
|
|
|
@@ -1599,11 +1601,9 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
putBox.setPodEname(detail.getPodEname());
|
|
|
putBox.setPodCode(detail.getPodCode());
|
|
|
putBox.setBoxCondition(tradingBox.getBoxCondition());
|
|
|
-
|
|
|
putBox.setTotalNum(tradingBox.getBoxNumber());
|
|
|
putBox.setRemainingNum(putBox.getTotalNum());
|
|
|
putBox.setNotSuitcaseNum(putBox.getTotalNum());
|
|
|
-
|
|
|
putBox.setEffectiveEndDate(tradingBox.getExpiryDate());
|
|
|
putBox.setEffectiveStartDate(tradingBox.getEffectiveDate());
|
|
|
putBox.setBoxType(tradingBox.getBoxTypeQuantityOne());
|
|
|
@@ -1629,6 +1629,14 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
putBox.setPodStationEname(detail.getPodStationEname());
|
|
|
putBox.setLoloPod(tradingBox.getLoloPod());
|
|
|
putBox.setLoloPol(tradingBox.getLoloPol());
|
|
|
+ putBox.setPodCyAddress(tradingBox.getPodCyAddress());
|
|
|
+ putBox.setPodCyContact(tradingBox.getPodCyContact());
|
|
|
+ putBox.setPodCyEmail(tradingBox.getPodCyEmail());
|
|
|
+ putBox.setPodCyTel(tradingBox.getPodCyTel());
|
|
|
+ putBox.setPolCyAddress(tradingBox.getPolCyAddress());
|
|
|
+ putBox.setPolCyContact(tradingBox.getPolCyContact());
|
|
|
+ putBox.setPolCyEmail(tradingBox.getPolCyEmail());
|
|
|
+ putBox.setPolCyTel(tradingBox.getPolCyTel());
|
|
|
putBoxService.save(putBox);
|
|
|
}
|
|
|
return R.data(putBox);
|
|
|
@@ -2357,6 +2365,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public R revokeCountRent(TradingBox tradingBox) {
|
|
|
TradingBox detail = baseMapper.selectById(tradingBox.getId());
|
|
|
List<TradingBoxItem> tradingBoxItemList = tradingBoxItemService.list(new LambdaQueryWrapper<TradingBoxItem>()
|
|
|
@@ -2475,6 +2484,11 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
if (putBox == null) {
|
|
|
throw new RuntimeException("未查到放箱号");
|
|
|
}
|
|
|
+ putBox.setPodCyAddress(tradingBox.getPodCyAddress());
|
|
|
+ putBox.setPodCyContact(tradingBox.getPodCyContact());
|
|
|
+ putBox.setPodCyEmail(tradingBox.getPodCyEmail());
|
|
|
+ putBox.setPodCyTel(tradingBox.getPodCyTel());
|
|
|
+ putBoxService.updateById(putBox);
|
|
|
List<PutBoxItems> putBoxItemsList = putBoxItemsService.list(new LambdaQueryWrapper<PutBoxItems>()
|
|
|
.eq(PutBoxItems::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(PutBoxItems::getIsDeleted, 0)
|
|
|
@@ -2549,6 +2563,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public R synchronousPutBoxData(TradingBox tradingBox) {
|
|
|
Long id = tradingBox.getId();
|
|
|
baseMapper.updateById(tradingBox);
|
|
|
@@ -2611,6 +2626,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public R batchImportPickUpCost(Long id, Date accountDate) {
|
|
|
if (id == null || ObjectUtils.isNull(accountDate)) {
|
|
|
throw new RuntimeException("缺少必要参数");
|
|
|
@@ -2619,10 +2635,17 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
if (tradingBox == null) {
|
|
|
throw new RuntimeException("未查到单据信息");
|
|
|
}
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(accountDate);
|
|
|
+ int year = calendar.get(Calendar.YEAR); // 获取年份
|
|
|
+ int month = calendar.get(Calendar.MONTH) + 1; // 获取月份(注意需加上1,因为月份从0开始计数)
|
|
|
+ int day = calendar.get(Calendar.DATE);
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
|
|
|
List<TradingBoxItem> tradingBoxItemList = tradingBoxItemService.list(new LambdaQueryWrapper<TradingBoxItem>()
|
|
|
.eq(TradingBoxItem::getIsDeleted, 0)
|
|
|
.eq(TradingBoxItem::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(TradingBoxItem::getPid, id)
|
|
|
+ .apply("DATE_FORMAT(pol_pick_up_date,'%Y-%m') <= '" + formatter.format(tradingBox.getEffectiveDate()) + "'")
|
|
|
.eq(TradingBoxItem::getWhetherGeneratePickUpCost, "0"));
|
|
|
if (tradingBoxItemList.isEmpty()) {
|
|
|
throw new RuntimeException("箱明细已全部生成PickUp费");
|
|
|
@@ -2635,11 +2658,6 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
throw new RuntimeException("请先维护'Pickup'费用基础信息");
|
|
|
}
|
|
|
List<FeeCenterItems> feeCenterItemsList = new ArrayList<>();
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.setTime(accountDate);
|
|
|
- int year = calendar.get(Calendar.YEAR); // 获取年份
|
|
|
- int month = calendar.get(Calendar.MONTH) + 1; // 获取月份(注意需加上1,因为月份从0开始计数)
|
|
|
- int day = calendar.get(Calendar.DATE);
|
|
|
List<BCurExrate> bCurExrateList = currencyUtils.obtainRate(accountDate, "1", AuthUtil.getDeptId());
|
|
|
BigDecimal exrate = new BigDecimal("0.00");
|
|
|
if ("OW-F".equals(tradingBox.getType())) {
|
|
|
@@ -2875,7 +2893,11 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
feeCenterItems.setExrate(currencyUtils.obtainExrate("C", curExrateList, feeCenterItems.getCurCode(), "1"));
|
|
|
}
|
|
|
feeCenterItems.setAmount(amount.add(detail.getGateInFee()));
|
|
|
- feeCenterItems.setPrice(price);
|
|
|
+ if (ObjectUtils.isNotNull(price) && price.length() > 1) {
|
|
|
+ feeCenterItems.setPrice(price.substring(0, price.length() - 1));
|
|
|
+ } else {
|
|
|
+ feeCenterItems.setPrice(price);
|
|
|
+ }
|
|
|
feeCenterItems.setGateInFee(detail.getGateInFee());
|
|
|
feeCenterItems.setRemarks(text);
|
|
|
feeCenterItems.setOutboundDate(endDate);
|
|
|
@@ -3091,6 +3113,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public R revokeMergeGenerateCost(TradingBox tradingBox) {
|
|
|
if (tradingBox.getId() == null || ObjectUtils.isNull(tradingBox.getFeeCenterItemsList()) || tradingBox.getFeeCenterItemsList().isEmpty()) {
|
|
|
throw new RuntimeException("缺少必要参数");
|
|
|
@@ -3098,7 +3121,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
TradingBox detail = baseMapper.selectById(tradingBox.getId());
|
|
|
List<Long> idList = tradingBox.getFeeCenterItemsList().stream().map(FeeCenterItems::getFeeCenterId)
|
|
|
.distinct().filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
- if (!idList.isEmpty()){
|
|
|
+ if (!idList.isEmpty()) {
|
|
|
List<FeeCenter> feeCenters = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(FeeCenter::getIsDeleted, 0)
|
|
|
@@ -3151,7 +3174,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
List<FeeCenterItems> feeCenterItems = feeCenterItemsService.list(new LambdaQueryWrapper<FeeCenterItems>()
|
|
|
.eq(FeeCenterItems::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(FeeCenterItems::getIsDeleted, 0)
|
|
|
- .in(!idList.isEmpty(),FeeCenterItems::getFeeCenterId, idList)
|
|
|
+ .in(!idList.isEmpty(), FeeCenterItems::getFeeCenterId, idList)
|
|
|
.eq(FeeCenterItems::getWhetherGenerateCost, "1"));
|
|
|
for (FeeCenterItems centerItems : feeCenterItems) {
|
|
|
centerItems.setUpdateTime(new Date());
|
|
|
@@ -3168,6 +3191,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public R revokEnable(TradingBox detail) {
|
|
|
if (ObjectUtils.isNull(detail.getId())) {
|
|
|
throw new RuntimeException("必要参数未填写");
|
|
|
@@ -3192,8 +3216,8 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
.eq(PutBox::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(PutBox::getIsDeleted, 0)
|
|
|
.eq(PutBox::getSrcContainerNumber, tradingBox.getContainerNumber())
|
|
|
- .eq(PutBox::getSrcNo, tradingBox.getId())
|
|
|
- .eq(PutBox::getSrcId, tradingBox.getSysNo())
|
|
|
+ .eq(PutBox::getSrcNo, tradingBox.getSysNo())
|
|
|
+ .eq(PutBox::getSrcId, tradingBox.getId())
|
|
|
.eq(PutBox::getWhetherManuallyCreate, "1")
|
|
|
);
|
|
|
if (putBox != null) {
|
|
|
@@ -3225,7 +3249,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
if ("1".equals(boxReminderExcel.getType())) {
|
|
|
|
|
|
} else if ("2".equals(boxReminderExcel.getType())) {
|
|
|
- String status = sysClient.getParamServiceDWT("box.usage.reminder",AuthUtil.getTenantId());
|
|
|
+ String status = sysClient.getParamServiceDWT("box.usage.reminder", AuthUtil.getTenantId());
|
|
|
if (ObjectUtils.isNull(status) || "获取数据失败".equals(status)) {
|
|
|
throw new RuntimeException("请先维护用箱提醒系统参数");
|
|
|
}
|
|
|
@@ -3237,7 +3261,8 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
.eq(TradingBox::getIsDeleted, 0)
|
|
|
.eq(TradingBox::getWhetherEnable, "是")
|
|
|
.lt(TradingBox::getEffectiveDate, calendar.getTime())
|
|
|
- .apply("find_in_set(type,'OW-N,OW-F') and suitcase_num = 0"));
|
|
|
+ .apply("find_in_set(type,'OW-N,OW-F') and suitcase_num = 0")
|
|
|
+ .orderByAsc(TradingBox::getEffectiveDate));
|
|
|
for (TradingBox item : tradingBoxList) {
|
|
|
BoxReminderExcel excel = new BoxReminderExcel();
|
|
|
excel.setProvider(item.getPurchaseCompanyName());
|
|
|
@@ -3263,7 +3288,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
list.add(excel);
|
|
|
}
|
|
|
} else if ("3".equals(boxReminderExcel.getType())) {
|
|
|
- String status = sysClient.getParamServiceDWT("postponement.reminder",AuthUtil.getTenantId());
|
|
|
+ String status = sysClient.getParamServiceDWT("postponement.reminder", AuthUtil.getTenantId());
|
|
|
if (ObjectUtils.isNull(status) || "获取数据失败".equals(status)) {
|
|
|
throw new RuntimeException("请先维护延期提醒系统参数");
|
|
|
}
|
|
|
@@ -3279,7 +3304,8 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
.eq(TradingBox::getWhetherEnable, "是")
|
|
|
.ge(TradingBox::getExpiryDate, calendar.getTime())
|
|
|
.le(TradingBox::getExpiryDate, calendar1.getTime())
|
|
|
- .apply("find_in_set(type,'OW-N,OW-F') and suitcase_num != 0"));
|
|
|
+ .apply("find_in_set(type,'OW-N,OW-F') and suitcase_num != 0")
|
|
|
+ .orderByAsc(TradingBox::getExpiryDate));
|
|
|
for (TradingBox item : tradingBoxList) {
|
|
|
BoxReminderExcel excel = new BoxReminderExcel();
|
|
|
excel.setProvider(item.getPurchaseCompanyName());
|
|
|
@@ -3310,4 +3336,40 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public R revokePickUpCost(Long id, String itemIds) {
|
|
|
+ TradingBox detail = baseMapper.selectById(id);
|
|
|
+ //获取订单费用信息
|
|
|
+ LambdaQueryWrapper<FeeCenterItems> tradingBoxFeesLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ tradingBoxFeesLambdaQueryWrapper.eq(FeeCenterItems::getIsDeleted, 0)
|
|
|
+ .eq(FeeCenterItems::getPid, id)
|
|
|
+ .eq(FeeCenterItems::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .in(FeeCenterItems::getId, Func.toLongList(itemIds));
|
|
|
+ List<FeeCenterItems> feeCenterItems = feeCenterItemsService.list(tradingBoxFeesLambdaQueryWrapper);
|
|
|
+ if (feeCenterItems.isEmpty()) {
|
|
|
+ throw new RuntimeException("未查到Pickup明细");
|
|
|
+ }
|
|
|
+ for (FeeCenterItems item : feeCenterItems) {
|
|
|
+ if ("1".equals(item.getWhetherGenerateCost())) {
|
|
|
+ throw new RuntimeException("箱号:" + item.getCntrNo() + "已生费用明细,撤销失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ feeCenterItemsService.removeByIds(feeCenterItems.stream().map(FeeCenterItems::getId).collect(Collectors.toList()));
|
|
|
+ List<TradingBoxItem> tradingBoxItemList = tradingBoxItemService.list(new LambdaQueryWrapper<TradingBoxItem>()
|
|
|
+ .eq(TradingBoxItem::getIsDeleted, 0)
|
|
|
+ .eq(TradingBoxItem::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(TradingBoxItem::getPid, id)
|
|
|
+ .in(TradingBoxItem::getId, feeCenterItems.stream().map(FeeCenterItems::getSrcItemId).collect(Collectors.toList()))
|
|
|
+ .eq(TradingBoxItem::getWhetherGeneratePickUpCost, "1"));
|
|
|
+ if (tradingBoxItemList.isEmpty()) {
|
|
|
+ throw new RuntimeException("未查到箱号明细");
|
|
|
+ }
|
|
|
+ for (TradingBoxItem item : tradingBoxItemList) {
|
|
|
+ item.setWhetherGeneratePickUpCost("0");
|
|
|
+ }
|
|
|
+ tradingBoxItemService.updateBatchById(tradingBoxItemList);
|
|
|
+ return R.data(detail);
|
|
|
+ }
|
|
|
+
|
|
|
}
|