|
|
@@ -29,7 +29,9 @@ import org.springblade.client.entity.CorpsDesc;
|
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.deliver.goods.entity.Delivery;
|
|
|
+import org.springblade.deliver.goods.entity.DeliveryFees;
|
|
|
import org.springblade.deliver.goods.entity.DeliveryItems;
|
|
|
+import org.springblade.deliver.goods.feign.IDeliveryClient;
|
|
|
import org.springblade.finance.dto.SettlementDTO;
|
|
|
import org.springblade.finance.enums.SettlementEnum;
|
|
|
import org.springblade.finance.vojo.*;
|
|
|
@@ -95,6 +97,8 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
|
|
|
private final IBusinessOverpaymentClient businessOverpaymentClient; //溢付款对外访问接口
|
|
|
|
|
|
+ private IDeliveryClient deliveryClient;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public IPage<SettlementVO> selectSettlementPage(IPage<SettlementVO> page, SettlementVO settlement) {
|
|
|
@@ -414,6 +418,29 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
orderFees.setSettlmentAmount(decimal);
|
|
|
orderFeesClient.submit(orderFees);
|
|
|
}
|
|
|
+ else if(type ==3)
|
|
|
+ {
|
|
|
+ Long srcFeesId = acc.getSrcFeesId();
|
|
|
+ if (srcFeesId == null) {
|
|
|
+ throw new SecurityException("撤销账单失败,未获取到原业务信息");
|
|
|
+ }
|
|
|
+
|
|
|
+ R<DeliveryFees> feesR = deliveryClient.getFeesById(srcFeesId);
|
|
|
+ if (feesR.getData() == null) {
|
|
|
+ throw new SecurityException("修改原单据失败");
|
|
|
+ }
|
|
|
+ //回退原业务表数据
|
|
|
+ DeliveryFees deliveryFees = feesR.getData();
|
|
|
+ if (deliveryFees.getSettlmentAmount() == null) {
|
|
|
+ throw new SecurityException("撤销账单失败,原业务表已收金额为空");
|
|
|
+ }
|
|
|
+ BigDecimal decimal = deliveryFees.getSettlmentAmount().subtract(items.getThisAmount());
|
|
|
+ if (decimal.compareTo(BigDecimal.ZERO) == -1) {
|
|
|
+ throw new SecurityException("撤销账单失败,剩余已收金额不够本次扣款");
|
|
|
+ }
|
|
|
+ deliveryFees.setSettlmentAmount(decimal);
|
|
|
+ deliveryClient.submitFees(deliveryFees);
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -535,10 +562,31 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
orderFees.setSettlmentAmount(orderFees.getSettlmentAmount() != null ? orderFees.getSettlmentAmount().add(items.getThisAmount()) : new BigDecimal("0").add(items.getThisAmount()));
|
|
|
accMapper.updateById(acc);
|
|
|
orderFeesClient.submit(orderFees);
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else if(type==3)
|
|
|
+ {
|
|
|
+ Long srcFeesId = acc.getSrcFeesId();
|
|
|
+ if (srcFeesId == null)
|
|
|
+ {
|
|
|
+ throw new SecurityException("操作失败,未获取到原业务信息");
|
|
|
+ }
|
|
|
+ R<DeliveryFees> feesById = deliveryClient.getFeesById(srcFeesId);
|
|
|
+ if(!feesById.isSuccess()&&feesById.getData()==null)
|
|
|
+ {
|
|
|
+ throw new SecurityException("修改原单据失败");
|
|
|
+ }
|
|
|
+ DeliveryFees deliveryFees = feesById.getData();
|
|
|
+ acc.setSettlementAmount(acc.getSettlementAmount() != null ? acc.getSettlementAmount().add(items.getThisAmount()) : new BigDecimal("0").add(items.getThisAmount()));
|
|
|
+ deliveryFees.setSettlmentAmount(deliveryFees.getSettlmentAmount() != null ? deliveryFees.getSettlmentAmount().add(items.getThisAmount()) : new BigDecimal("0").add(items.getThisAmount()));
|
|
|
+ accMapper.updateById(acc);
|
|
|
+ deliveryClient.submitFees(deliveryFees);
|
|
|
+ }
|
|
|
+
|
|
|
+ else {
|
|
|
throw new SecurityException("操作失败,财务类型为空无法结算");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
//验证结算总金额是否超限
|
|
|
|
|
|
/*BigDecimal orderAmount = client.getSettlmentAmount();
|
|
|
@@ -592,6 +640,22 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
throw new SecurityException("财务-修改原单据的费用明细错误");
|
|
|
}
|
|
|
}
|
|
|
+ else if(e.getSrcType() == 3)
|
|
|
+ {
|
|
|
+ R<DeliveryFees> fees = deliveryClient.getFeesById(e.getSrcFeesId());
|
|
|
+ DeliveryFees feesData = fees.getData();
|
|
|
+ if (feesData == null)
|
|
|
+ {
|
|
|
+ throw new SecurityException("未查到原单据的费用明细,无法修改状态");
|
|
|
+ }
|
|
|
+ feesData.setIsCheck(1);
|
|
|
+ R submit = deliveryClient.submitFees(feesData);
|
|
|
+ if (!submit.isSuccess()) {
|
|
|
+ throw new SecurityException("财务-修改原单据的费用明细错误");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
e.setId(null);
|
|
|
e.setPid(settlement.getId());
|
|
|
e.setCreateTime(new Date());
|