|
|
@@ -173,52 +173,46 @@ public class RouteCostServiceImpl extends ServiceImpl<RouteCostMapper, RouteCost
|
|
|
int days = routeCost.getNavigateDay() + routeCost.getExistStationDay();
|
|
|
List<RouteCostFee> costFeeList = routeCost.getCostFeeList();
|
|
|
for (RouteCostItem routeCostItem : routeCost.getCostItemList()) {
|
|
|
- if ("SOC".equals(routeCost.getBusinessType())) {
|
|
|
- //一程POL杂费成本
|
|
|
- routeCostItem.setPolCost(computationalCost(costFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
- //一程POL杂费收入
|
|
|
- routeCostItem.setPolIncome(computationalIncome(costFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
- //一程POD杂费成本
|
|
|
- routeCostItem.setPodCost(computationalCost(costFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
- //一程POD杂费收入
|
|
|
- routeCostItem.setPodIncome(computationalIncome(costFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
- //一程用箱成本
|
|
|
- if (0 != days && ObjectUtils.isNotNull(routeCostItem.getBoxCost()) &&
|
|
|
- routeCostItem.getBoxCost().compareTo(new BigDecimal("0.00")) != 0) {
|
|
|
- BigDecimal boxCost = new BigDecimal(days).multiply(routeCostItem.getBoxCost());
|
|
|
- routeCostItem.setUseBoxCost(boxCost);
|
|
|
- } else {
|
|
|
- routeCostItem.setUseBoxCost(new BigDecimal("0.00"));
|
|
|
- }
|
|
|
- // 一程成本价 = 一程海运费+一程用箱成本+一程pol杂费+一程pod成本
|
|
|
- routeCostItem.setCostPrice(routeCostItem.getOceanFreight().add(routeCostItem.getPodCost()).add(routeCostItem.getPolCost())
|
|
|
- .add(routeCostItem.getUseBoxCost()));
|
|
|
- //一程合计利润
|
|
|
- routeCostItem.setTotalProfit(routeCostItem.getSalesPrice().add(routeCostItem.getPolIncome())
|
|
|
- .add(routeCostItem.getPodIncome()).subtract(routeCostItem.getCostPrice()));
|
|
|
- if ("转船".equals(routeCost.getFlightType()) && "自转".equals(routeCost.getChangeShipType())) {
|
|
|
- //二程POL杂费成本
|
|
|
- routeCostItem.setPolCostTwo(computationalCost(costFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
- //二程POL杂费收入
|
|
|
- routeCostItem.setPolIncomeTwo(computationalIncome(costFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
- //二程POD杂费成本
|
|
|
- routeCostItem.setPodCostTwo(computationalCost(costFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
- //二程POD杂费收入
|
|
|
- routeCostItem.setPodIncomeTwo(computationalIncome(costFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
- // 二程成本价 = 二程海运费+二程pol杂费+二程pod成本
|
|
|
- routeCostItem.setCostPriceTwo(routeCostItem.getOceanFreightTwo().add(routeCostItem.getPodCostTwo()).add(routeCostItem.getPolCostTwo()));
|
|
|
- //二程合计利润
|
|
|
- routeCostItem.setTotalProfitTwo(routeCostItem.getSalesPriceTwo().add(routeCostItem.getPolIncomeTwo())
|
|
|
- .add(routeCostItem.getPodIncomeTwo()).subtract(routeCostItem.getCostPriceTwo()));
|
|
|
- }
|
|
|
- //合计利润
|
|
|
- routeCostItem.setProfit(routeCostItem.getTotalProfit().add(routeCostItem.getTotalProfitTwo()));
|
|
|
+ //一程POL杂费成本
|
|
|
+ routeCostItem.setPolCost(computationalCost(costFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
+ //一程POL杂费收入
|
|
|
+ routeCostItem.setPolIncome(computationalIncome(costFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
+ //一程POD杂费成本
|
|
|
+ routeCostItem.setPodCost(computationalCost(costFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
+ //一程POD杂费收入
|
|
|
+ routeCostItem.setPodIncome(computationalIncome(costFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
+ //一程用箱成本
|
|
|
+ if (0 != days && ObjectUtils.isNotNull(routeCostItem.getBoxCost()) &&
|
|
|
+ routeCostItem.getBoxCost().compareTo(new BigDecimal("0.00")) != 0) {
|
|
|
+ BigDecimal boxCost = new BigDecimal(days).multiply(routeCostItem.getBoxCost());
|
|
|
+ routeCostItem.setUseBoxCost(boxCost);
|
|
|
} else {
|
|
|
- //一程合计利润
|
|
|
- routeCostItem.setTotalProfit(routeCostItem.getSalesPrice().subtract(routeCostItem.getCostPrice()));
|
|
|
- //合计利润
|
|
|
- routeCostItem.setProfit(routeCostItem.getTotalProfit());
|
|
|
+ routeCostItem.setUseBoxCost(new BigDecimal("0.00"));
|
|
|
+ }
|
|
|
+ // 一程成本价 = 一程海运费+一程用箱成本+一程pol杂费+一程pod成本
|
|
|
+ routeCostItem.setCostPrice(routeCostItem.getOceanFreight().add(routeCostItem.getPodCost()).add(routeCostItem.getPolCost())
|
|
|
+ .add(routeCostItem.getUseBoxCost()));
|
|
|
+ //一程合计利润
|
|
|
+ routeCostItem.setTotalProfit(routeCostItem.getSalesPrice().add(routeCostItem.getPolIncome())
|
|
|
+ .add(routeCostItem.getPodIncome()).subtract(routeCostItem.getCostPrice()));
|
|
|
+ if ("转船".equals(routeCost.getFlightType()) && "自转".equals(routeCost.getChangeShipType())) {
|
|
|
+ //二程POL杂费成本
|
|
|
+ routeCostItem.setPolCostTwo(computationalCost(costFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
+ //二程POL杂费收入
|
|
|
+ routeCostItem.setPolIncomeTwo(computationalIncome(costFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
+ //二程POD杂费成本
|
|
|
+ routeCostItem.setPodCostTwo(computationalCost(costFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
+ //二程POD杂费收入
|
|
|
+ routeCostItem.setPodIncomeTwo(computationalIncome(costFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
+ // 二程成本价 = 二程海运费+二程pol杂费+二程pod成本
|
|
|
+ routeCostItem.setCostPriceTwo(routeCostItem.getOceanFreightTwo().add(routeCostItem.getPodCostTwo()).add(routeCostItem.getPolCostTwo()));
|
|
|
+ //二程合计利润
|
|
|
+ routeCostItem.setTotalProfitTwo(routeCostItem.getSalesPriceTwo().add(routeCostItem.getPolIncomeTwo())
|
|
|
+ .add(routeCostItem.getPodIncomeTwo()).subtract(routeCostItem.getCostPriceTwo()));
|
|
|
}
|
|
|
+ //合计利润
|
|
|
+ routeCostItem.setProfit(routeCostItem.getTotalProfit().add(routeCostItem.getTotalProfitTwo()));
|
|
|
+
|
|
|
if (routeCostItem.getId() == null) {
|
|
|
routeCostItem.setPid(routeCost.getId());
|
|
|
routeCostItem.setCreateTime(new Date());
|
|
|
@@ -509,52 +503,45 @@ public class RouteCostServiceImpl extends ServiceImpl<RouteCostMapper, RouteCost
|
|
|
if (ObjectUtils.isNotNull(routeCostItemList)) {
|
|
|
int days = routeCost.getNavigateDay() + routeCost.getExistStationDay();
|
|
|
for (RouteCostItem routeCostItem : routeCostItemList) {
|
|
|
- if ("SOC".equals(routeCost.getBusinessType())) {
|
|
|
- //一程POL杂费成本
|
|
|
- routeCostItem.setPolCost(computationalCost(routeCostFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
- //一程POL杂费收入
|
|
|
- routeCostItem.setPolIncome(computationalIncome(routeCostFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
- //一程POD杂费成本
|
|
|
- routeCostItem.setPodCost(computationalCost(routeCostFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
- //一程POD杂费收入
|
|
|
- routeCostItem.setPodIncome(computationalIncome(routeCostFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
- //一程用箱成本
|
|
|
- if (0 != days && ObjectUtils.isNotNull(routeCostItem.getBoxCost()) &&
|
|
|
- routeCostItem.getBoxCost().compareTo(new BigDecimal("0.00")) != 0) {
|
|
|
- BigDecimal boxCost = new BigDecimal(days).multiply(routeCostItem.getBoxCost());
|
|
|
- routeCostItem.setUseBoxCost(boxCost);
|
|
|
- } else {
|
|
|
- routeCostItem.setUseBoxCost(new BigDecimal("0.00"));
|
|
|
- }
|
|
|
- // 一程成本价 = 一程海运费+一程用箱成本+一程pol杂费+一程pod成本
|
|
|
- routeCostItem.setCostPrice(routeCostItem.getOceanFreight().add(routeCostItem.getPodCost()).add(routeCostItem.getPolCost())
|
|
|
- .add(routeCostItem.getUseBoxCost()));
|
|
|
- //一程合计利润
|
|
|
- routeCostItem.setTotalProfit(routeCostItem.getSalesPrice().add(routeCostItem.getPolIncome())
|
|
|
- .add(routeCostItem.getPodIncome()).subtract(routeCostItem.getCostPrice()));
|
|
|
- if ("转船".equals(routeCost.getFlightType()) && "自转".equals(routeCost.getChangeShipType())) {
|
|
|
- //二程POL杂费成本
|
|
|
- routeCostItem.setPolCostTwo(computationalCost(routeCostFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
- //二程POL杂费收入
|
|
|
- routeCostItem.setPolIncomeTwo(computationalIncome(routeCostFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
- //二程POD杂费成本
|
|
|
- routeCostItem.setPodCostTwo(computationalCost(routeCostFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
- //二程POD杂费收入
|
|
|
- routeCostItem.setPodIncomeTwo(computationalIncome(routeCostFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
- // 二程成本价 = 二程海运费+二程pol杂费+二程pod成本
|
|
|
- routeCostItem.setCostPriceTwo(routeCostItem.getOceanFreightTwo().add(routeCostItem.getPodCostTwo()).add(routeCostItem.getPolCostTwo()));
|
|
|
- //二程合计利润
|
|
|
- routeCostItem.setTotalProfitTwo(routeCostItem.getSalesPriceTwo().add(routeCostItem.getPolIncomeTwo())
|
|
|
- .add(routeCostItem.getPodIncomeTwo()).subtract(routeCostItem.getCostPriceTwo()));
|
|
|
- }
|
|
|
- //合计利润
|
|
|
- routeCostItem.setProfit(routeCostItem.getTotalProfit().add(routeCostItem.getTotalProfitTwo()));
|
|
|
+ //一程POL杂费成本
|
|
|
+ routeCostItem.setPolCost(computationalCost(routeCostFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
+ //一程POL杂费收入
|
|
|
+ routeCostItem.setPolIncome(computationalIncome(routeCostFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
+ //一程POD杂费成本
|
|
|
+ routeCostItem.setPodCost(computationalCost(routeCostFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
+ //一程POD杂费收入
|
|
|
+ routeCostItem.setPodIncome(computationalIncome(routeCostFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
+ //一程用箱成本
|
|
|
+ if (0 != days && ObjectUtils.isNotNull(routeCostItem.getBoxCost()) &&
|
|
|
+ routeCostItem.getBoxCost().compareTo(new BigDecimal("0.00")) != 0) {
|
|
|
+ BigDecimal boxCost = new BigDecimal(days).multiply(routeCostItem.getBoxCost());
|
|
|
+ routeCostItem.setUseBoxCost(boxCost);
|
|
|
} else {
|
|
|
- //一程合计利润
|
|
|
- routeCostItem.setTotalProfit(routeCostItem.getSalesPrice().subtract(routeCostItem.getCostPrice()));
|
|
|
- //合计利润
|
|
|
- routeCostItem.setProfit(routeCostItem.getTotalProfit());
|
|
|
+ routeCostItem.setUseBoxCost(new BigDecimal("0.00"));
|
|
|
}
|
|
|
+ // 一程成本价 = 一程海运费+一程用箱成本+一程pol杂费+一程pod成本
|
|
|
+ routeCostItem.setCostPrice(routeCostItem.getOceanFreight().add(routeCostItem.getPodCost()).add(routeCostItem.getPolCost())
|
|
|
+ .add(routeCostItem.getUseBoxCost()));
|
|
|
+ //一程合计利润
|
|
|
+ routeCostItem.setTotalProfit(routeCostItem.getSalesPrice().add(routeCostItem.getPolIncome())
|
|
|
+ .add(routeCostItem.getPodIncome()).subtract(routeCostItem.getCostPrice()));
|
|
|
+ if ("转船".equals(routeCost.getFlightType()) && "自转".equals(routeCost.getChangeShipType())) {
|
|
|
+ //二程POL杂费成本
|
|
|
+ routeCostItem.setPolCostTwo(computationalCost(routeCostFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
+ //二程POL杂费收入
|
|
|
+ routeCostItem.setPolIncomeTwo(computationalIncome(routeCostFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
+ //二程POD杂费成本
|
|
|
+ routeCostItem.setPodCostTwo(computationalCost(routeCostFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
+ //二程POD杂费收入
|
|
|
+ routeCostItem.setPodIncomeTwo(computationalIncome(routeCostFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
+ // 二程成本价 = 二程海运费+二程pol杂费+二程pod成本
|
|
|
+ routeCostItem.setCostPriceTwo(routeCostItem.getOceanFreightTwo().add(routeCostItem.getPodCostTwo()).add(routeCostItem.getPolCostTwo()));
|
|
|
+ //二程合计利润
|
|
|
+ routeCostItem.setTotalProfitTwo(routeCostItem.getSalesPriceTwo().add(routeCostItem.getPolIncomeTwo())
|
|
|
+ .add(routeCostItem.getPodIncomeTwo()).subtract(routeCostItem.getCostPriceTwo()));
|
|
|
+ }
|
|
|
+ //合计利润
|
|
|
+ routeCostItem.setProfit(routeCostItem.getTotalProfit().add(routeCostItem.getTotalProfitTwo()));
|
|
|
if (routeCostItem.getId() == null) {
|
|
|
routeCostItem.setPid(routeCost.getId());
|
|
|
routeCostItem.setCreateTime(new Date());
|
|
|
@@ -595,89 +582,6 @@ public class RouteCostServiceImpl extends ServiceImpl<RouteCostMapper, RouteCost
|
|
|
if (ObjectUtils.isNotNull(routeCostItemList)) {
|
|
|
int days = routeCost.getNavigateDay() + routeCost.getExistStationDay();
|
|
|
for (RouteCostItem routeCostItem : routeCostItemList) {
|
|
|
- if ("SOC".equals(routeCost.getBusinessType())) {
|
|
|
- //一程POL杂费成本
|
|
|
- routeCostItem.setPolCost(computationalCost(routeCostFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
- //一程POL杂费收入
|
|
|
- routeCostItem.setPolIncome(computationalIncome(routeCostFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
- //一程POD杂费成本
|
|
|
- routeCostItem.setPodCost(computationalCost(routeCostFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
- //一程POD杂费收入
|
|
|
- routeCostItem.setPodIncome(computationalIncome(routeCostFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
- //一程用箱成本
|
|
|
- if (0 != days && ObjectUtils.isNotNull(routeCostItem.getBoxCost()) &&
|
|
|
- routeCostItem.getBoxCost().compareTo(new BigDecimal("0.00")) != 0) {
|
|
|
- BigDecimal boxCost = new BigDecimal(days).multiply(routeCostItem.getBoxCost());
|
|
|
- routeCostItem.setUseBoxCost(boxCost);
|
|
|
-
|
|
|
- } else {
|
|
|
- routeCostItem.setUseBoxCost(new BigDecimal("0.00"));
|
|
|
- }
|
|
|
- // 一程成本价 = 一程海运费+一程用箱成本+一程pol杂费+一程pod成本
|
|
|
- routeCostItem.setCostPrice(routeCostItem.getOceanFreight().add(routeCostItem.getPodCost()).add(routeCostItem.getPolCost())
|
|
|
- .add(routeCostItem.getUseBoxCost()));
|
|
|
- //一程合计利润
|
|
|
- routeCostItem.setTotalProfit(routeCostItem.getSalesPrice().add(routeCostItem.getPolIncome())
|
|
|
- .add(routeCostItem.getPodIncome()).subtract(routeCostItem.getCostPrice()));
|
|
|
- if ("转船".equals(routeCost.getFlightType()) && "自转".equals(routeCost.getChangeShipType())) {
|
|
|
- //二程POL杂费成本
|
|
|
- routeCostItem.setPolCostTwo(computationalCost(routeCostFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
- //二程POL杂费收入
|
|
|
- routeCostItem.setPolIncomeTwo(computationalIncome(routeCostFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
- //二程POD杂费成本
|
|
|
- routeCostItem.setPodCostTwo(computationalCost(routeCostFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
- //二程POD杂费收入
|
|
|
- routeCostItem.setPodIncomeTwo(computationalIncome(routeCostFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
- // 二程成本价 = 二程海运费+二程pol杂费+二程pod成本
|
|
|
- routeCostItem.setCostPriceTwo(routeCostItem.getOceanFreightTwo().add(routeCostItem.getPodCostTwo()).add(routeCostItem.getPolCostTwo()));
|
|
|
- //二程合计利润
|
|
|
- routeCostItem.setTotalProfitTwo(routeCostItem.getSalesPriceTwo().add(routeCostItem.getPolIncomeTwo())
|
|
|
- .add(routeCostItem.getPodIncomeTwo()).subtract(routeCostItem.getCostPriceTwo()));
|
|
|
- }
|
|
|
- //合计利润
|
|
|
- routeCostItem.setProfit(routeCostItem.getTotalProfit().add(routeCostItem.getTotalProfitTwo()));
|
|
|
- } else {
|
|
|
- //一程合计利润
|
|
|
- routeCostItem.setTotalProfit(routeCostItem.getSalesPrice().subtract(routeCostItem.getCostPrice()));
|
|
|
- //合计利润
|
|
|
- routeCostItem.setProfit(routeCostItem.getTotalProfit());
|
|
|
- }
|
|
|
- if (routeCostItem.getId() == null) {
|
|
|
- routeCostItem.setPid(routeCost.getId());
|
|
|
- routeCostItem.setCreateTime(new Date());
|
|
|
- routeCostItem.setCreateUser(AuthUtil.getUserId());
|
|
|
- routeCostItem.setCreateUserName(AuthUtil.getUserName());
|
|
|
- } else {
|
|
|
- routeCostItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
- routeCostItem.setUpdateTime(new Date());
|
|
|
- routeCostItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
- }
|
|
|
- }
|
|
|
- routeCostItemService.updateBatchById(routeCostItemList);
|
|
|
- routeCost.setProfit20(totalProfit(routeCostItemList, "20"));
|
|
|
- routeCost.setProfit40(totalProfit(routeCostItemList, "40"));
|
|
|
- routeCost.setProfitHc(totalProfit(routeCostItemList, "40HC"));
|
|
|
- routeCost.setOtherProfit(totalProfit(routeCostItemList, "other"));
|
|
|
- routeCost.setTotalProfit(routeCost.getProfit20().add(routeCost.getProfit40()).add(routeCost.getProfitHc()).add(routeCost.getOtherProfit()));
|
|
|
- baseMapper.updateById(routeCost);
|
|
|
- }
|
|
|
- routeCostFeeService.removeByIds(longList);
|
|
|
- }
|
|
|
- return R.success("操作成功");
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public R submitItemList(List<RouteCostItem> routeCostItemList) {
|
|
|
- if (!routeCostItemList.isEmpty()) {
|
|
|
- RouteCost routeCost = baseMapper.selectById(routeCostItemList.get(0).getPid());
|
|
|
- List<RouteCostFee> routeCostFeeList = routeCostFeeService.list(new LambdaQueryWrapper<RouteCostFee>()
|
|
|
- .eq(RouteCostFee::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(RouteCostFee::getIsDeleted, 0)
|
|
|
- .eq(RouteCostFee::getPid, routeCostItemList.get(0).getPid()));
|
|
|
- int days = routeCost.getNavigateDay() + routeCost.getExistStationDay();
|
|
|
- for (RouteCostItem routeCostItem : routeCostItemList) {
|
|
|
- if ("SOC".equals(routeCost.getBusinessType())) {
|
|
|
//一程POL杂费成本
|
|
|
routeCostItem.setPolCost(computationalCost(routeCostFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
//一程POL杂费收入
|
|
|
@@ -691,6 +595,7 @@ public class RouteCostServiceImpl extends ServiceImpl<RouteCostMapper, RouteCost
|
|
|
routeCostItem.getBoxCost().compareTo(new BigDecimal("0.00")) != 0) {
|
|
|
BigDecimal boxCost = new BigDecimal(days).multiply(routeCostItem.getBoxCost());
|
|
|
routeCostItem.setUseBoxCost(boxCost);
|
|
|
+
|
|
|
} else {
|
|
|
routeCostItem.setUseBoxCost(new BigDecimal("0.00"));
|
|
|
}
|
|
|
@@ -717,12 +622,80 @@ public class RouteCostServiceImpl extends ServiceImpl<RouteCostMapper, RouteCost
|
|
|
}
|
|
|
//合计利润
|
|
|
routeCostItem.setProfit(routeCostItem.getTotalProfit().add(routeCostItem.getTotalProfitTwo()));
|
|
|
+ if (routeCostItem.getId() == null) {
|
|
|
+ routeCostItem.setPid(routeCost.getId());
|
|
|
+ routeCostItem.setCreateTime(new Date());
|
|
|
+ routeCostItem.setCreateUser(AuthUtil.getUserId());
|
|
|
+ routeCostItem.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ } else {
|
|
|
+ routeCostItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ routeCostItem.setUpdateTime(new Date());
|
|
|
+ routeCostItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ routeCostItemService.updateBatchById(routeCostItemList);
|
|
|
+ routeCost.setProfit20(totalProfit(routeCostItemList, "20"));
|
|
|
+ routeCost.setProfit40(totalProfit(routeCostItemList, "40"));
|
|
|
+ routeCost.setProfitHc(totalProfit(routeCostItemList, "40HC"));
|
|
|
+ routeCost.setOtherProfit(totalProfit(routeCostItemList, "other"));
|
|
|
+ routeCost.setTotalProfit(routeCost.getProfit20().add(routeCost.getProfit40()).add(routeCost.getProfitHc()).add(routeCost.getOtherProfit()));
|
|
|
+ baseMapper.updateById(routeCost);
|
|
|
+ }
|
|
|
+ routeCostFeeService.removeByIds(longList);
|
|
|
+ }
|
|
|
+ return R.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public R submitItemList(List<RouteCostItem> routeCostItemList) {
|
|
|
+ if (!routeCostItemList.isEmpty()) {
|
|
|
+ RouteCost routeCost = baseMapper.selectById(routeCostItemList.get(0).getPid());
|
|
|
+ List<RouteCostFee> routeCostFeeList = routeCostFeeService.list(new LambdaQueryWrapper<RouteCostFee>()
|
|
|
+ .eq(RouteCostFee::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(RouteCostFee::getIsDeleted, 0)
|
|
|
+ .eq(RouteCostFee::getPid, routeCostItemList.get(0).getPid()));
|
|
|
+ int days = routeCost.getNavigateDay() + routeCost.getExistStationDay();
|
|
|
+ for (RouteCostItem routeCostItem : routeCostItemList) {
|
|
|
+ //一程POL杂费成本
|
|
|
+ routeCostItem.setPolCost(computationalCost(routeCostFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
+ //一程POL杂费收入
|
|
|
+ routeCostItem.setPolIncome(computationalIncome(routeCostFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
+ //一程POD杂费成本
|
|
|
+ routeCostItem.setPodCost(computationalCost(routeCostFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
+ //一程POD杂费收入
|
|
|
+ routeCostItem.setPodIncome(computationalIncome(routeCostFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
|
|
|
+ //一程用箱成本
|
|
|
+ if (0 != days && ObjectUtils.isNotNull(routeCostItem.getBoxCost()) &&
|
|
|
+ routeCostItem.getBoxCost().compareTo(new BigDecimal("0.00")) != 0) {
|
|
|
+ BigDecimal boxCost = new BigDecimal(days).multiply(routeCostItem.getBoxCost());
|
|
|
+ routeCostItem.setUseBoxCost(boxCost);
|
|
|
} else {
|
|
|
- //一程合计利润
|
|
|
- routeCostItem.setTotalProfit(routeCostItem.getSalesPrice().subtract(routeCostItem.getCostPrice()));
|
|
|
- //合计利润
|
|
|
- routeCostItem.setProfit(routeCostItem.getTotalProfit());
|
|
|
+ routeCostItem.setUseBoxCost(new BigDecimal("0.00"));
|
|
|
+ }
|
|
|
+ // 一程成本价 = 一程海运费+一程用箱成本+一程pol杂费+一程pod成本
|
|
|
+ routeCostItem.setCostPrice(routeCostItem.getOceanFreight().add(routeCostItem.getPodCost()).add(routeCostItem.getPolCost())
|
|
|
+ .add(routeCostItem.getUseBoxCost()));
|
|
|
+ //一程合计利润
|
|
|
+ routeCostItem.setTotalProfit(routeCostItem.getSalesPrice().add(routeCostItem.getPolIncome())
|
|
|
+ .add(routeCostItem.getPodIncome()).subtract(routeCostItem.getCostPrice()));
|
|
|
+ if ("转船".equals(routeCost.getFlightType()) && "自转".equals(routeCost.getChangeShipType())) {
|
|
|
+ //二程POL杂费成本
|
|
|
+ routeCostItem.setPolCostTwo(computationalCost(routeCostFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
+ //二程POL杂费收入
|
|
|
+ routeCostItem.setPolIncomeTwo(computationalIncome(routeCostFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
+ //二程POD杂费成本
|
|
|
+ routeCostItem.setPodCostTwo(computationalCost(routeCostFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
+ //二程POD杂费收入
|
|
|
+ routeCostItem.setPodIncomeTwo(computationalIncome(routeCostFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
|
|
|
+ // 二程成本价 = 二程海运费+二程pol杂费+二程pod成本
|
|
|
+ routeCostItem.setCostPriceTwo(routeCostItem.getOceanFreightTwo().add(routeCostItem.getPodCostTwo()).add(routeCostItem.getPolCostTwo()));
|
|
|
+ //二程合计利润
|
|
|
+ routeCostItem.setTotalProfitTwo(routeCostItem.getSalesPriceTwo().add(routeCostItem.getPolIncomeTwo())
|
|
|
+ .add(routeCostItem.getPodIncomeTwo()).subtract(routeCostItem.getCostPriceTwo()));
|
|
|
}
|
|
|
+ //合计利润
|
|
|
+ routeCostItem.setProfit(routeCostItem.getTotalProfit().add(routeCostItem.getTotalProfitTwo()));
|
|
|
if (routeCostItem.getId() == null) {
|
|
|
routeCostItem.setPid(routeCost.getId());
|
|
|
routeCostItem.setCreateTime(new Date());
|