|
@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
+import io.seata.spring.annotation.GlobalTransactional;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.api.R;
|
|
@@ -53,6 +54,7 @@ import org.springblade.los.finance.fee.service.IFinAccBillsService;
|
|
|
import org.springblade.system.entity.Dept;
|
|
import org.springblade.system.entity.Dept;
|
|
|
import org.springblade.system.feign.ISysClient;
|
|
import org.springblade.system.feign.ISysClient;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
@@ -104,6 +106,8 @@ public class AeaBillsServiceImpl extends ServiceImpl<AeaBillsMapper, AeaBills> i
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
public R submit(AeaBills aeaBills) {
|
|
public R submit(AeaBills aeaBills) {
|
|
|
String deptId = "";
|
|
String deptId = "";
|
|
|
String deptName = "";
|
|
String deptName = "";
|
|
@@ -515,13 +519,15 @@ public class AeaBillsServiceImpl extends ServiceImpl<AeaBillsMapper, AeaBills> i
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
public R increaseReinsurancePolicy(String ids, String id) {
|
|
public R increaseReinsurancePolicy(String ids, String id) {
|
|
|
if (ObjectUtils.isNull(ids) || ObjectUtils.isNull(id)) {
|
|
if (ObjectUtils.isNull(ids) || ObjectUtils.isNull(id)) {
|
|
|
throw new RuntimeException("缺少必要参数");
|
|
throw new RuntimeException("缺少必要参数");
|
|
|
}
|
|
}
|
|
|
AeaBills bills = baseMapper.selectById(id);
|
|
AeaBills bills = baseMapper.selectById(id);
|
|
|
List<Long> idArr = Func.toLongList(ids);
|
|
List<Long> idArr = Func.toLongList(ids);
|
|
|
- if (idArr.size() > 0 && bills != null) {
|
|
|
|
|
|
|
+ if (!idArr.isEmpty() && bills != null) {
|
|
|
if (ObjectUtils.isNull(bills.getMblno())) {
|
|
if (ObjectUtils.isNull(bills.getMblno())) {
|
|
|
throw new RuntimeException("主单提单号不能为空,操作失败");
|
|
throw new RuntimeException("主单提单号不能为空,操作失败");
|
|
|
}
|
|
}
|
|
@@ -570,7 +576,7 @@ public class AeaBillsServiceImpl extends ServiceImpl<AeaBillsMapper, AeaBills> i
|
|
|
BigDecimal quantity = bills.getQuantity();
|
|
BigDecimal quantity = bills.getQuantity();
|
|
|
BigDecimal grossWeight = bills.getGrossWeight();
|
|
BigDecimal grossWeight = bills.getGrossWeight();
|
|
|
BigDecimal measurement = bills.getMeasurement();
|
|
BigDecimal measurement = bills.getMeasurement();
|
|
|
- if (billsList.size() > 0) {
|
|
|
|
|
|
|
+ if (!billsList.isEmpty()) {
|
|
|
amountDr = amountDr.add(billsList.stream().map(AeaBills::getAmountDr).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
amountDr = amountDr.add(billsList.stream().map(AeaBills::getAmountDr).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
amountCr = amountCr.add(billsList.stream().map(AeaBills::getAmountCr).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
amountCr = amountCr.add(billsList.stream().map(AeaBills::getAmountCr).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
amountProfit = amountProfit.add(billsList.stream().map(AeaBills::getAmountProfit).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
amountProfit = amountProfit.add(billsList.stream().map(AeaBills::getAmountProfit).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
@@ -602,13 +608,15 @@ public class AeaBillsServiceImpl extends ServiceImpl<AeaBillsMapper, AeaBills> i
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
public R revokeReinsurancePolicy(String ids, String id) {
|
|
public R revokeReinsurancePolicy(String ids, String id) {
|
|
|
if (ObjectUtils.isNull(ids) || ObjectUtils.isNull(id)) {
|
|
if (ObjectUtils.isNull(ids) || ObjectUtils.isNull(id)) {
|
|
|
throw new RuntimeException("缺少必要参数");
|
|
throw new RuntimeException("缺少必要参数");
|
|
|
}
|
|
}
|
|
|
AeaBills bills = baseMapper.selectById(id);
|
|
AeaBills bills = baseMapper.selectById(id);
|
|
|
List<Long> idArr = Func.toLongList(ids);
|
|
List<Long> idArr = Func.toLongList(ids);
|
|
|
- if (idArr.size() > 0 && bills != null) {
|
|
|
|
|
|
|
+ if (!idArr.isEmpty() && bills != null) {
|
|
|
List<AeaBills> billsList = baseMapper.selectList(new LambdaQueryWrapper<AeaBills>()
|
|
List<AeaBills> billsList = baseMapper.selectList(new LambdaQueryWrapper<AeaBills>()
|
|
|
.eq(AeaBills::getTenantId, AuthUtil.getTenantId())
|
|
.eq(AeaBills::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(AeaBills::getIsDeleted, 0)
|
|
.eq(AeaBills::getIsDeleted, 0)
|
|
@@ -633,7 +641,7 @@ public class AeaBillsServiceImpl extends ServiceImpl<AeaBillsMapper, AeaBills> i
|
|
|
BigDecimal quantity = bills.getQuantity();
|
|
BigDecimal quantity = bills.getQuantity();
|
|
|
BigDecimal grossWeight = bills.getGrossWeight();
|
|
BigDecimal grossWeight = bills.getGrossWeight();
|
|
|
BigDecimal measurement = bills.getMeasurement();
|
|
BigDecimal measurement = bills.getMeasurement();
|
|
|
- if (billsList.size() > 0) {
|
|
|
|
|
|
|
+ if (!billsList.isEmpty()) {
|
|
|
amountDr = amountDr.subtract(billsList.stream().map(AeaBills::getAmountDr).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
amountDr = amountDr.subtract(billsList.stream().map(AeaBills::getAmountDr).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
amountCr = amountCr.subtract(billsList.stream().map(AeaBills::getAmountCr).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
amountCr = amountCr.subtract(billsList.stream().map(AeaBills::getAmountCr).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
amountProfit = amountProfit.subtract(billsList.stream().map(AeaBills::getAmountProfit).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
amountProfit = amountProfit.subtract(billsList.stream().map(AeaBills::getAmountProfit).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
@@ -685,6 +693,8 @@ public class AeaBillsServiceImpl extends ServiceImpl<AeaBillsMapper, AeaBills> i
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
public AeaBills checkBills(AeaBills bills) {
|
|
public AeaBills checkBills(AeaBills bills) {
|
|
|
AeaBills declare = baseMapper.selectById(bills.getId());
|
|
AeaBills declare = baseMapper.selectById(bills.getId());
|
|
|
Integer actId = null;
|
|
Integer actId = null;
|
|
@@ -733,7 +743,8 @@ public class AeaBillsServiceImpl extends ServiceImpl<AeaBillsMapper, AeaBills> i
|
|
|
throw new RuntimeException("请维护费用信息");
|
|
throw new RuntimeException("请维护费用信息");
|
|
|
}
|
|
}
|
|
|
List<FeeCenter> feeCenterListPS = feeCenterList.stream().filter(e -> e.getFeeCnName().equals("PS")).collect(Collectors.toList());
|
|
List<FeeCenter> feeCenterListPS = feeCenterList.stream().filter(e -> e.getFeeCnName().equals("PS")).collect(Collectors.toList());
|
|
|
- if (!feeCenterListPS.isEmpty()) {
|
|
|
|
|
|
|
+ List<FeeCenter> feeCenterListKY = feeCenterList.stream().filter(e -> e.getFeeCnName().equals("空运费")).collect(Collectors.toList());
|
|
|
|
|
+ if (!feeCenterListPS.isEmpty()&& !feeCenterListKY.isEmpty()) {
|
|
|
BigDecimal amountHYD = feeCenterList.stream()
|
|
BigDecimal amountHYD = feeCenterList.stream()
|
|
|
.filter(e -> e.getFeeCnName().equals("空运费") && "USD".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
.filter(e -> e.getFeeCnName().equals("空运费") && "USD".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
.map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
.map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
@@ -766,6 +777,10 @@ public class AeaBillsServiceImpl extends ServiceImpl<AeaBillsMapper, AeaBills> i
|
|
|
} else {
|
|
} else {
|
|
|
throw new RuntimeException("只有预付、直单和主单,或分单和到付才可以输入PS");
|
|
throw new RuntimeException("只有预付、直单和主单,或分单和到付才可以输入PS");
|
|
|
}
|
|
}
|
|
|
|
|
+ }else if (feeCenterListPS.isEmpty() && !feeCenterListKY.isEmpty()) {
|
|
|
|
|
+ throw new RuntimeException("PS费与海运费需同时存在,当前缺少PS费用信息");
|
|
|
|
|
+ } else if (!feeCenterListPS.isEmpty()) {
|
|
|
|
|
+ throw new RuntimeException("PS费与海运费需同时存在,当前缺少海运费用信息");
|
|
|
}
|
|
}
|
|
|
// 没开启审批流直接走 通过流程
|
|
// 没开启审批流直接走 通过流程
|
|
|
if (pathsActs == null || pathsActs.getIsEnable() == 2) {
|
|
if (pathsActs == null || pathsActs.getIsEnable() == 2) {
|
|
@@ -810,6 +825,8 @@ public class AeaBillsServiceImpl extends ServiceImpl<AeaBillsMapper, AeaBills> i
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
public AeaBills revokeCheckOrder(AeaBills bills) {
|
|
public AeaBills revokeCheckOrder(AeaBills bills) {
|
|
|
AeaBills declare = baseMapper.selectById(bills.getId());
|
|
AeaBills declare = baseMapper.selectById(bills.getId());
|
|
|
if (3 == declare.getStatus()) {
|
|
if (3 == declare.getStatus()) {
|
|
@@ -825,6 +842,8 @@ public class AeaBillsServiceImpl extends ServiceImpl<AeaBillsMapper, AeaBills> i
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
public R passCheck(Long id) {
|
|
public R passCheck(Long id) {
|
|
|
AeaBills bills = baseMapper.selectById(id);
|
|
AeaBills bills = baseMapper.selectById(id);
|
|
|
if (bills == null) {
|
|
if (bills == null) {
|
|
@@ -845,9 +864,9 @@ public class AeaBillsServiceImpl extends ServiceImpl<AeaBillsMapper, AeaBills> i
|
|
|
.eq(AeaBills::getIsDeleted, 0)
|
|
.eq(AeaBills::getIsDeleted, 0)
|
|
|
.eq(AeaBills::getMasterId, bills.getId())
|
|
.eq(AeaBills::getMasterId, bills.getId())
|
|
|
.eq(AeaBills::getMasterBillNo, bills.getMasterBillNo()));
|
|
.eq(AeaBills::getMasterBillNo, bills.getMasterBillNo()));
|
|
|
- if (billsList.size() > 0) {
|
|
|
|
|
|
|
+ if (!billsList.isEmpty()) {
|
|
|
List<Long> ids = billsList.stream().map(AeaBills::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
|
List<Long> ids = billsList.stream().map(AeaBills::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
- if (ids.size() > 0) {
|
|
|
|
|
|
|
+ if (!ids.isEmpty()) {
|
|
|
List<FeeCenter> feeCenters = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
List<FeeCenter> feeCenters = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(FeeCenter::getIsDeleted, 0)
|
|
.eq(FeeCenter::getIsDeleted, 0)
|
|
@@ -863,7 +882,7 @@ public class AeaBillsServiceImpl extends ServiceImpl<AeaBillsMapper, AeaBills> i
|
|
|
item.setApproveTime(new Date());
|
|
item.setApproveTime(new Date());
|
|
|
}
|
|
}
|
|
|
feeCenterService.saveOrUpdateBatch(feeCenterList);
|
|
feeCenterService.saveOrUpdateBatch(feeCenterList);
|
|
|
- if (feeCenterList.size() != 0) {
|
|
|
|
|
|
|
+ if (!feeCenterList.isEmpty()) {
|
|
|
FinAccBills finAccBills = new FinAccBills();
|
|
FinAccBills finAccBills = new FinAccBills();
|
|
|
finAccBills.setFeeCenterList(feeCenterList);
|
|
finAccBills.setFeeCenterList(feeCenterList);
|
|
|
finAccBills.setBusinessTypeCode("HYZD");
|
|
finAccBills.setBusinessTypeCode("HYZD");
|
|
@@ -1132,17 +1151,19 @@ public class AeaBillsServiceImpl extends ServiceImpl<AeaBillsMapper, AeaBills> i
|
|
|
copyBills.setAccountStatus(0);
|
|
copyBills.setAccountStatus(0);
|
|
|
copyBills.setFeeCenterListC(feeCenterListC);
|
|
copyBills.setFeeCenterListC(feeCenterListC);
|
|
|
copyBills.setFeeCenterListD(feeCenterListD);
|
|
copyBills.setFeeCenterListD(feeCenterListD);
|
|
|
- copyBills.setQuantity(new BigDecimal("0.00"));
|
|
|
|
|
|
|
+ /*copyBills.setQuantity(new BigDecimal("0.00"));
|
|
|
copyBills.setGrossWeight(new BigDecimal("0.00"));
|
|
copyBills.setGrossWeight(new BigDecimal("0.00"));
|
|
|
copyBills.setMeasurement(new BigDecimal("0.00"));
|
|
copyBills.setMeasurement(new BigDecimal("0.00"));
|
|
|
copyBills.setLength(new BigDecimal("0.00"));
|
|
copyBills.setLength(new BigDecimal("0.00"));
|
|
|
copyBills.setWidth(new BigDecimal("0.00"));
|
|
copyBills.setWidth(new BigDecimal("0.00"));
|
|
|
- copyBills.setHeight(new BigDecimal("0.00"));
|
|
|
|
|
|
|
+ copyBills.setHeight(new BigDecimal("0.00"));*/
|
|
|
copyBills.setFilesList(filesList);
|
|
copyBills.setFilesList(filesList);
|
|
|
return copyBills;
|
|
return copyBills;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
public R disembarking(String ids) {
|
|
public R disembarking(String ids) {
|
|
|
List<AeaBills> billsList = baseMapper.selectList(new LambdaQueryWrapper<AeaBills>()
|
|
List<AeaBills> billsList = baseMapper.selectList(new LambdaQueryWrapper<AeaBills>()
|
|
|
.eq(AeaBills::getTenantId, AuthUtil.getTenantId())
|
|
.eq(AeaBills::getTenantId, AuthUtil.getTenantId())
|
|
@@ -1162,6 +1183,8 @@ public class AeaBillsServiceImpl extends ServiceImpl<AeaBillsMapper, AeaBills> i
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
public R revokeDisembarking(String ids) {
|
|
public R revokeDisembarking(String ids) {
|
|
|
List<AeaBills> billsList = baseMapper.selectList(new LambdaQueryWrapper<AeaBills>()
|
|
List<AeaBills> billsList = baseMapper.selectList(new LambdaQueryWrapper<AeaBills>()
|
|
|
.eq(AeaBills::getTenantId, AuthUtil.getTenantId())
|
|
.eq(AeaBills::getTenantId, AuthUtil.getTenantId())
|
|
@@ -1193,6 +1216,7 @@ public class AeaBillsServiceImpl extends ServiceImpl<AeaBillsMapper, AeaBills> i
|
|
|
.like(ObjectUtils.isNotNull(bills.getMblno()), AeaBills::getMblno, bills.getMblno())
|
|
.like(ObjectUtils.isNotNull(bills.getMblno()), AeaBills::getMblno, bills.getMblno())
|
|
|
.like(ObjectUtils.isNotNull(bills.getHblno()), AeaBills::getHblno, bills.getHblno())
|
|
.like(ObjectUtils.isNotNull(bills.getHblno()), AeaBills::getHblno, bills.getHblno())
|
|
|
.like(ObjectUtils.isNotNull(bills.getRefno()), AeaBills::getRefno, bills.getRefno())
|
|
.like(ObjectUtils.isNotNull(bills.getRefno()), AeaBills::getRefno, bills.getRefno())
|
|
|
|
|
+ .eq(ObjectUtils.isNotNull(bills.getType()), AeaBills::getBusinessType, bills.getType())
|
|
|
.eq(AeaBills::getIsDeleted, 0)
|
|
.eq(AeaBills::getIsDeleted, 0)
|
|
|
.eq(AeaBills::getTenantId, AuthUtil.getTenantId())
|
|
.eq(AeaBills::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(AeaBills::getStatus, 3);
|
|
.eq(AeaBills::getStatus, 3);
|
|
@@ -1203,7 +1227,7 @@ public class AeaBillsServiceImpl extends ServiceImpl<AeaBillsMapper, AeaBills> i
|
|
|
lambdaQueryWrapper.eq(AeaBills::getBranchId, deptUtils.getDeptPid());
|
|
lambdaQueryWrapper.eq(AeaBills::getBranchId, deptUtils.getDeptPid());
|
|
|
}
|
|
}
|
|
|
List<AeaBills> billsList = baseMapper.selectList(lambdaQueryWrapper);
|
|
List<AeaBills> billsList = baseMapper.selectList(lambdaQueryWrapper);
|
|
|
- if (billsList.size() == 0) {
|
|
|
|
|
|
|
+ if (billsList.isEmpty()) {
|
|
|
throw new RuntimeException("未查到单据信息");
|
|
throw new RuntimeException("未查到单据信息");
|
|
|
}
|
|
}
|
|
|
for (AeaBills detail : billsList) {
|
|
for (AeaBills detail : billsList) {
|