|
|
@@ -278,7 +278,7 @@ public class InstallmentServiceImpl implements InstallmentService{
|
|
|
Double total = purchase.getEnsurePrice();
|
|
|
Double installTotal = installment.getPrice();
|
|
|
Double dvalue = 0d;
|
|
|
-
|
|
|
+ installment.setPrice(purchase.getEnsurePrice());
|
|
|
if (NumberUtil.compare(total, installTotal) == 1) {
|
|
|
InstallmentDetail installmentDetail = installmentDetailDao.findByInstallmentIdAndDetno(installment.getId(), installment.getCount().shortValue());
|
|
|
if (installmentDetail != null) {
|
|
|
@@ -287,20 +287,17 @@ public class InstallmentServiceImpl implements InstallmentService{
|
|
|
installmentDetail.setPrice(NumberUtil.pricesScaleTwo(result));
|
|
|
installmentDetailDao.save(installmentDetail);
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if (NumberUtil.compare(total, installTotal) == -1) {
|
|
|
+ return installmentDao.save(installment);
|
|
|
+ } else if (NumberUtil.compare(total, installTotal) == -1) {
|
|
|
for (short i = 1; i < installment.getCount() + 1; i++) {
|
|
|
InstallmentDetail installmentDetail = installmentDetailDao.findByInstallmentIdAndDetno(installment.getId(), i);
|
|
|
if (installmentDetail == null) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- dvalue = total - installmentDetail.getPrice();
|
|
|
+ dvalue = NumberUtil.sub(total, installmentDetail.getPrice());
|
|
|
|
|
|
- if (dvalue <= 0) {
|
|
|
+ if (NumberUtil.compare(dvalue, 0.0d) <= 0) {
|
|
|
installmentDetail.setPrice(NumberUtil.pricesScaleTwo(total));
|
|
|
installmentDetailDao.save(installmentDetail);
|
|
|
installmentDetailDao.deleteGtDetno(installment.getId(), i);
|
|
|
@@ -318,12 +315,11 @@ public class InstallmentServiceImpl implements InstallmentService{
|
|
|
total = dvalue;
|
|
|
}
|
|
|
}
|
|
|
+ installment.setCount(installment.getInstallmentDetails().size());
|
|
|
+ return installmentDao.save(installment);
|
|
|
+ } else {
|
|
|
+ return installment;
|
|
|
}
|
|
|
-
|
|
|
- installment.setPrice(purchase.getEnsurePrice());
|
|
|
- installment.setCount(installment.getInstallmentDetails().size());
|
|
|
-
|
|
|
- return installmentDao.save(installment);
|
|
|
}
|
|
|
|
|
|
@Override
|