|
|
@@ -22,11 +22,11 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import io.seata.spring.annotation.GlobalTransactional;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
-import org.springblade.client.feign.ISerialClient;
|
|
|
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.los.basic.cur.service.IBCurrencyService;
|
|
|
import org.springblade.los.billno.entity.BusinessBillNo;
|
|
|
import org.springblade.los.billno.service.IBusinessBillNoService;
|
|
|
import org.springblade.los.business.files.entity.FilesCenter;
|
|
|
@@ -75,10 +75,8 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
|
|
|
private final IBusinessBillNoService businessBillNoService;
|
|
|
|
|
|
- /**
|
|
|
- * 生成系统编号
|
|
|
- */
|
|
|
- private ISerialClient serialClient;
|
|
|
+ private final IBCurrencyService bCurrencyService;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public IPage<BillsVO> selectBillsPage(IPage<BillsVO> page, BillsVO bills) {
|
|
|
@@ -183,6 +181,9 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
amountCrUsd = amountDrUsd.add(item.getAmount());
|
|
|
} else if ("CNY".equals(item.getCurCode())) {
|
|
|
amountCr = amountDrUsd.add(item.getAmount());
|
|
|
+ } else {
|
|
|
+ BigDecimal usd = bCurrencyService.converter(item.getCurCode(), item.getAmount());
|
|
|
+ amountCrUsd = amountCrUsd.add(usd);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -192,6 +193,9 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
amountDrUsd = amountDrUsd.add(item.getAmount());
|
|
|
} else if ("CNY".equals(item.getCurCode())) {
|
|
|
amountDrUsd = amountDrUsd.add(item.getAmount());
|
|
|
+ } else {
|
|
|
+ BigDecimal usd = bCurrencyService.converter(item.getCurCode(), item.getAmount());
|
|
|
+ amountDrUsd = amountCrUsd.add(usd);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -214,6 +218,9 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
//利润 = 收 - 付
|
|
|
amountProfit = amountDr.subtract(amountCr);
|
|
|
amountProfitUsd = amountDrUsd.subtract(amountCrUsd);
|
|
|
+
|
|
|
+ amountDrLoc = amountDrLoc.add(bCurrencyService.converterCny("USD", amountDrUsd));
|
|
|
+ amountCrLoc = amountDrLoc.add(bCurrencyService.converterCny("USD", amountCrUsd));
|
|
|
amountProfitLoc = amountDrLoc.subtract(amountCrLoc);
|
|
|
|
|
|
bills.setAmountDr(amountDr);
|
|
|
@@ -266,6 +273,10 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
if ("DD".equals(detail.getBillType())) {
|
|
|
WaitingBox waitingBox = new WaitingBox();
|
|
|
BeanUtil.copyProperties(detail, waitingBox);
|
|
|
+ waitingBox.setQuantity(detail.getCfsQuantity());
|
|
|
+ waitingBox.setGrossWeight(detail.getCfsGrossWeight());
|
|
|
+ waitingBox.setNetWeight(detail.getNetWeight());
|
|
|
+ waitingBox.setMeasurement(detail.getCfsMeasurement());
|
|
|
waitingBoxList.add(waitingBox);
|
|
|
} else if ("MM".equals(detail.getBillType())) {
|
|
|
List<Bills> billsList = baseMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
@@ -273,7 +284,15 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
.eq(Bills::getIsDeleted, 0)
|
|
|
.eq(Bills::getMasterId, detail.getId())
|
|
|
.eq(Bills::getMasterBillNo, detail.getBillNo()));
|
|
|
- waitingBoxList = BeanUtil.copy(billsList, WaitingBox.class);
|
|
|
+ for (Bills item : billsList) {
|
|
|
+ WaitingBox waitingBox = new WaitingBox();
|
|
|
+ BeanUtil.copyProperties(item, waitingBox);
|
|
|
+ waitingBox.setQuantity(detail.getCfsQuantity());
|
|
|
+ waitingBox.setGrossWeight(detail.getCfsGrossWeight());
|
|
|
+ waitingBox.setNetWeight(detail.getNetWeight());
|
|
|
+ waitingBox.setMeasurement(detail.getCfsMeasurement());
|
|
|
+ waitingBoxList.add(waitingBox);
|
|
|
+ }
|
|
|
}
|
|
|
detail.setWaitingBoxList(waitingBoxList);
|
|
|
detail.setFeeCenterListC(feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
@@ -345,11 +364,23 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
Bills bills = baseMapper.selectById(id);
|
|
|
List<Long> idArr = Func.toLongList(ids);
|
|
|
if (idArr.size() > 0 && bills != null) {
|
|
|
+ if (ObjectUtils.isNull(bills.getMblno())) {
|
|
|
+ throw new RuntimeException("主单提单号不能为空,操作失败");
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNull(bills.getPodId())) {
|
|
|
+ throw new RuntimeException("卸货港不能为空,操作失败");
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNull(bills.getPolId())) {
|
|
|
+ throw new RuntimeException("装货港不能为空,操作失败");
|
|
|
+ }
|
|
|
List<Bills> billsList = baseMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
.eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(Bills::getIsDeleted, 0)
|
|
|
.in(Bills::getId, idArr));
|
|
|
for (Bills item : billsList) {
|
|
|
+ if (ObjectUtils.isNull(item.getMblno())) {
|
|
|
+ throw new RuntimeException(item.getBillNo() + "分单提单号不能为空,操作失败");
|
|
|
+ }
|
|
|
item.setMasterId(bills.getId());
|
|
|
item.setMasterBillNo(bills.getBillNo());
|
|
|
item.setUpdateTime(new Date());
|