|
@@ -558,6 +558,17 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
|
|
|
cmPayShop.setPayTime(DateUtils.getDateTime());
|
|
|
cmPayShop.setStatus("1");
|
|
|
cmPayShopDao.update(cmPayShop);
|
|
|
+ Integer shopOrderId = Integer.valueOf(records.get(0).getShopOrderID());
|
|
|
+ if (3 == cmPayShop.getPaymentType()) {
|
|
|
+ //已付第三方金额
|
|
|
+ BigDecimal shopOtherFee = cmPayShopRecordDao.findPayShopOtherFee(shopOrderId);
|
|
|
+ BigDecimal totalFee = MathUtil.add(shopOtherFee, cmPayShop.getTotalAmount());
|
|
|
+ newShopOrderDao.updateByShopOtherFee(totalFee, shopOrderId);
|
|
|
+ } else if (2 == cmPayShop.getPaymentType()) {
|
|
|
+ NewShopOrder shopOrder = newShopOrderDao.get(shopOrderId.toString());
|
|
|
+ BigDecimal differencePrice = MathUtil.add(shopOrder.getDifferencePrice(), cmPayShop.getTotalAmount());
|
|
|
+ newShopOrderDao.updateByDifferencePrice(1, differencePrice, shopOrderId);
|
|
|
+ }
|
|
|
}
|
|
|
if (cmPayShop.getBalancePayFee() != null && cmPayShop.getBalancePayFee() > 0D) {
|
|
|
//如果使用了余额付款 往余额记录表里面写入记录的cm_rebate_record
|
|
@@ -718,6 +729,17 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
|
|
|
cmPayShop.setReviewTime(null);
|
|
|
cmPayShop.setPayType(null);
|
|
|
cmPayShopDao.update(cmPayShop);
|
|
|
+ Integer shopOrderId = Integer.valueOf(records.get(0).getShopOrderID());
|
|
|
+ if (3 == cmPayShop.getPaymentType()) {
|
|
|
+ //撤回付第三方
|
|
|
+ BigDecimal shopOtherFee = cmPayShopRecordDao.findPayShopOtherFee(shopOrderId);
|
|
|
+ BigDecimal totalFee = MathUtil.sub(shopOtherFee, cmPayShop.getTotalAmount());
|
|
|
+ newShopOrderDao.updateByShopOtherFee(totalFee, shopOrderId);
|
|
|
+ } else if (2 == cmPayShop.getPaymentType()) {
|
|
|
+ NewShopOrder shopOrder = newShopOrderDao.get(shopOrderId.toString());
|
|
|
+ BigDecimal differencePrice = MathUtil.sub(shopOrder.getDifferencePrice(), cmPayShop.getTotalAmount());
|
|
|
+ newShopOrderDao.updateByDifferencePrice(1, differencePrice, shopOrderId);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -768,8 +790,6 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
|
|
|
|
|
|
@Transactional(readOnly = false)
|
|
|
public void saveShopOtherFee(ChangePayShopOther payShopOther) {
|
|
|
- //已付第三方金额
|
|
|
- BigDecimal shopOtherFee = cmPayShopRecordDao.findPayShopOtherFee(payShopOther.getShopOrderId());
|
|
|
String[] remarkImages = payShopOther.getRemarkImages();
|
|
|
if (remarkImages != null && remarkImages.length > 0) {
|
|
|
StringBuilder remarkImage = new StringBuilder();
|
|
@@ -783,13 +803,11 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
|
|
|
}
|
|
|
payShopOther.setModifyUserId(Integer.parseInt(UserUtils.getUser().getId()));
|
|
|
cmPayShopRecordDao.insertShopOtherFee(payShopOther);
|
|
|
- newShopOrderDao.updateByShopOtherFee(payShopOther.getShopOtherFee(), payShopOther.getShopOrderId());
|
|
|
|
|
|
//保存付第三方付款记录
|
|
|
User currentUser = UserUtils.getUser();
|
|
|
String time = DateUtils.getDateTime();
|
|
|
NewShopOrder shopOrder = newShopOrderDao.findByShopOrderID(payShopOther.getShopOrderId());
|
|
|
- double payAmount = MathUtil.sub(payShopOther.getShopOtherFee(), shopOtherFee).doubleValue();
|
|
|
CmPayShop payShop = new CmPayShop();
|
|
|
payShop.setShopID(shopOrder.getShopID().toString());
|
|
|
payShop.setName(payShopOther.getName());
|
|
@@ -797,9 +815,9 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
|
|
|
payShop.setBankAccount(payShopOther.getBankAccount());
|
|
|
payShop.setBankName(payShopOther.getBankName());
|
|
|
payShop.setType(payShopOther.getType().toString());
|
|
|
- payShop.setTotalAmount(payAmount);
|
|
|
+ payShop.setTotalAmount(payShopOther.getShopOtherFee().doubleValue());
|
|
|
payShop.setBalancePayFee(0d);
|
|
|
- payShop.setTransferPayFee(payAmount);
|
|
|
+ payShop.setTransferPayFee(payShopOther.getShopOtherFee().doubleValue());
|
|
|
payShop.setWipePayment(0d);
|
|
|
payShop.setApplicant(currentUser.getId());
|
|
|
payShop.setApplyTime(time);
|
|
@@ -816,7 +834,7 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
|
|
|
payShopRecord.setShopID(shopOrder.getShopID().toString());
|
|
|
payShopRecord.setShopOrderID(payShopOther.getShopOrderId().toString());
|
|
|
payShopRecord.setShopOrderNo(shopOrder.getOrderNo());
|
|
|
- payShopRecord.setPayAmount(payAmount);
|
|
|
+ payShopRecord.setPayAmount(payShopOther.getShopOtherFee().doubleValue());
|
|
|
payShopRecord.setWipePayment(0d);
|
|
|
payShopRecord.setPaymentType(3);
|
|
|
payShopRecord.setPayShopID(payShop.getId());
|
|
@@ -847,6 +865,8 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
|
|
|
payShopDifference.setAbleRebateAmount(BigDecimal.valueOf(ableRebateAmount));
|
|
|
double rebateAmount = shop.getRebateAmount() == null ? 0D : shop.getRebateAmount();
|
|
|
payShopDifference.setRebateAmount(BigDecimal.valueOf(rebateAmount));
|
|
|
+ payShopDifference.setType(shopOrder.getDifferenceType());
|
|
|
+ payShopDifference.setDifferencePrice(shopOrder.getDifferencePrice());
|
|
|
}
|
|
|
payShopDifference.setWaitPayShop(waitPayShop);
|
|
|
return payShopDifference;
|
|
@@ -989,11 +1009,9 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
|
|
|
}
|
|
|
payShopDifference.setModifyUserId(Integer.parseInt(UserUtils.getUser().getId()));
|
|
|
cmPayShopRecordDao.insertDifference(payShopDifference);
|
|
|
- if ("3".equals(shopOrder.getPayStatus()) && 1 == payShopDifference.getType()) {
|
|
|
- //多次少付供应商,应加上差价
|
|
|
- differencePrice = MathUtil.add(shopOrder.getDifferencePrice(), differencePrice);
|
|
|
+ if (!"3".equals(shopOrder.getPayStatus())) {
|
|
|
+ newShopOrderDao.updateByDifferencePrice(payShopDifference.getType(), differencePrice, shopOrderId);
|
|
|
}
|
|
|
- newShopOrderDao.updateByDifferencePrice(payShopDifference.getType(), differencePrice, shopOrderId);
|
|
|
}
|
|
|
|
|
|
public ChangePayShopOther shopOtherApplyEdit(Integer payShopId) {
|