提交 84f77a31 authored 作者: huningning's avatar huningning

Merge remote-tracking branch 'origin/v5.5_settlement_20231011' into v5.5_settlement_20231011

......@@ -49,7 +49,15 @@ public class OrderChildFreightInfoVO {
@ApiModelProperty(value = "总运费(元)", example = "1.23")
private BigDecimal totalFreight;
public BigDecimal getTotalFreight() {
return freightPrice.multiply(weight).setScale(2, RoundingMode.HALF_UP);
BigDecimal totalFreight = freightPrice.multiply(weight);
if (unloadNet != null){
totalFreight = freightPrice.multiply(unloadNet.compareTo(loadNet) < 0? unloadNet : loadNet);
BigDecimal dif = unloadNet.subtract(weight);
if (dif.compareTo(BigDecimal.ZERO) < 0){
totalFreight = totalFreight.add(lossPrice.multiply(dif));
}
}
return totalFreight.setScale(2, RoundingMode.HALF_UP);
}
@ApiModelProperty(value = "亏吨扣款(元)", example = "1.23")
......
......@@ -154,7 +154,15 @@ public class OrderChildVO {
@ApiModelProperty(value = "总运费(元)", example = "1.23")
private BigDecimal totalFreight;
public BigDecimal getTotalFreight() {
return freightPrice.multiply(weight).setScale(2, RoundingMode.HALF_UP);
BigDecimal totalFreight = freightPrice.multiply(weight);
if (unloadNet != null){
totalFreight = freightPrice.multiply(unloadNet.compareTo(loadNet) < 0? unloadNet : loadNet);
BigDecimal dif = unloadNet.subtract(weight);
if (dif.compareTo(BigDecimal.ZERO) < 0){
totalFreight = totalFreight.add(lossPrice.multiply(dif));
}
}
return totalFreight.setScale(2, RoundingMode.HALF_UP);
}
}
\ No newline at end of file
......@@ -64,6 +64,7 @@ public class OrderChildDaoImpl extends BaseDaoImpl<OrderChildMapper, OrderChild,
.set(OrderChild::getUnloadTime, item.getUnloadTime())
.set(OrderChild::getPoundStatus, item.getPoundStatus())
.set(OrderChild::getWeight, item.getWeight())
.set(OrderChild::getFreight, item.getFreight())
.set(OrderChild::getStatus, item.getStatus())
);
......
......@@ -40,7 +40,7 @@ public interface OwnerAccountMapper extends BaseMapper<OwnerAccount> {
)
Integer subAccount(@Param("account") OwnerAccount account, @Param("now") String now);
@Update("update owner_account set frozen_balance = frozen_balance - #{account.frozenBalance}," +
@Update("update owner_account set frozen_balance = frozen_balance - #{account.frozenBalance}, account_balance = account_balance - #{account.accountBalance}," +
"modified_time=#{now}"
+ "where id = #{account.id} and modified_time = #{account.modifiedTime}"
)
......
......@@ -156,20 +156,17 @@ public class OrderChildPoundAuditServiceImpl implements OrderChildPoundAuditSer
* 运单拉运吨数计算
*/
public BigDecimal orderChildWeightCalc(OrderChild orderChild){
if (orderChild.getLoadNet() == null) {return orderChild.getTruckLoad();}
else {return orderChild.getLoadNet();}
return orderChild.getUnloadNet().compareTo(orderChild.getLoadNet()) < 0? orderChild.getUnloadNet() : orderChild.getLoadNet();
}
/**
* 运费计算
*/
public BigDecimal orderChildFreightCalc(OrderChild orderChild){
BigDecimal totalFreight = orderChild.getFreightPrice().multiply(orderChild.getWeight());
if (orderChild.getUnloadNet() != null){
BigDecimal dif = orderChild.getUnloadNet().subtract(orderChild.getWeight());
if (dif.compareTo(BigDecimal.ZERO) < 0){
totalFreight = totalFreight.add(orderChild.getLossPrice().multiply(dif));
}
BigDecimal totalFreight = orderChild.getFreightPrice().multiply(orderChild.getUnloadNet().compareTo(orderChild.getLoadNet()) < 0? orderChild.getUnloadNet() : orderChild.getLoadNet());
BigDecimal dif = orderChild.getUnloadNet().subtract(orderChild.getLoadNet());
if (dif.compareTo(BigDecimal.ZERO) < 0){
totalFreight = totalFreight.add(orderChild.getLossPrice().multiply(dif));
}
return totalFreight.setScale(0, RoundingMode.HALF_UP);
......
......@@ -1281,13 +1281,15 @@ public class OrderChildServiceImpl implements OrderChildService {
carrierOrderChildDetailVO.setChildLogs(orderChildLogStruct.convert(orderChildLog));
//应付运费
BigDecimal payableFreight=BigDecimal.ZERO;
if(Objects.nonNull(orderChild.getLoadNet())){
payableFreight = orderChild.getLoadNet()
.multiply(orderChild.getFreightPrice())
BigDecimal payableFreight = orderChild.getFreightPrice().multiply(orderChild.getWeight());
if (orderChild.getUnloadNet() != null){
payableFreight = orderChild.getFreightPrice()
.multiply(orderChild.getUnloadNet().compareTo(orderChild.getLoadNet()) < 0? orderChild.getUnloadNet() : orderChild.getLoadNet())
.setScale(0,BigDecimal.ROUND_HALF_UP);
}
//亏吨扣款(元)
BigDecimal lossDeduction=BigDecimal.ZERO;
if(Objects.nonNull(orderChild.getLoadNet()) && Objects.nonNull(orderChild.getUnloadNet())){
......
......@@ -183,11 +183,11 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
//账户余额
runningWaterRecord.setAccountBalance(account.getAccountBalance());
//冻结金额
runningWaterRecord.setFrozenBalance(account.getFrozenBalance().add(caseOutBalance));
runningWaterRecord.setFrozenBalance(account.getFrozenBalance());
//扣除金额
runningWaterRecord.setTakeOutBalance(BigDecimal.ZERO);
//可用余额
runningWaterRecord.setUsableBalance(account.getUsableBalance().subtract(caseOutBalance));
runningWaterRecord.setUsableBalance(account.getUsableBalance());
runningWaterRecord.setOwnerUserNo(param.getOwnerUserNo());
runningWaterRecord.setAccountType(param.getAccountType());
......@@ -363,10 +363,11 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
OwnerAccount account = ownerAccountDao.getAccountByOwnerUserNoAndAccountType(ownerCaseOut.getOwnerUserNo(), ownerCaseOut.getAccountType());
OwnerAccount update = new OwnerAccount();
update.setFrozenBalance(caseOutBalance);
update.setAccountBalance(caseOutBalance);
update.setId(account.getId());
update.setModifiedTime(account.getModifiedTime());
Integer flag = ownerAccountDao.updateOwnerAccountForConfirm(update);
if (flag > 0) {
if (flag != null && flag > 0) {
account = ownerAccountDao.getAccountByOwnerUserNoAndAccountType(ownerCaseOut.getOwnerUserNo(), ownerCaseOut.getAccountType());
//插入提现成功流水
OwnerRunningWaterRecord runningWaterRecord = new OwnerRunningWaterRecord();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论