|
@@ -50,6 +50,7 @@ import com.ym.mec.biz.dal.entity.StudentRegistration;
|
|
|
import com.ym.mec.biz.dal.entity.SubjectChange;
|
|
|
import com.ym.mec.biz.dal.entity.SysUserCashAccount;
|
|
|
import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
|
|
|
+import com.ym.mec.biz.dal.entity.SysUserCashAccountLog;
|
|
|
import com.ym.mec.biz.dal.enums.AccountType;
|
|
|
import com.ym.mec.biz.dal.enums.CouponDetailTypeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.DealStatusEnum;
|
|
@@ -61,6 +62,7 @@ import com.ym.mec.biz.dal.enums.OrderTypeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.PayStatus;
|
|
|
import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
|
|
|
import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
|
|
|
+import com.ym.mec.biz.dal.enums.ReturnFeeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.SellTypeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
|
|
|
import com.ym.mec.biz.dal.enums.SubjectChangeStatusEnum;
|
|
@@ -380,12 +382,15 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
|
|
|
spod.setCreateTime(date);
|
|
|
spod.setUpdateTime(date);
|
|
|
spod.setPaymentOrderId(studentPaymentOrder.getId());
|
|
|
+ spod.setTenantId(tenantId);
|
|
|
studentPaymentOrderDetailList.add(spod);
|
|
|
|
|
|
totalPrice = totalPrice.add(spod.getPrice());
|
|
|
}
|
|
|
|
|
|
+ int i = 0;
|
|
|
for(String goodsIdStr : goodsIdsStr.split(",")){
|
|
|
+ i++;
|
|
|
if(StringUtils.isBlank(goodsIdStr)){
|
|
|
continue;
|
|
|
}
|
|
@@ -406,7 +411,7 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
|
|
|
|
|
|
BigDecimal tempPrice = studentPaymentOrder.getExpectAmount().multiply(goods.getGroupPurchasePrice()).divide(goodsTotalGroupPurchasePrice, BigDecimal.ROUND_DOWN).setScale(2, BigDecimal.ROUND_DOWN);
|
|
|
|
|
|
- if(totalPrice.add(tempPrice).compareTo(studentPaymentOrder.getExpectAmount()) > 0 || goodsIdsStr.split(",").length == studentPaymentOrderDetailList.size() + 1){
|
|
|
+ if(totalPrice.add(tempPrice).compareTo(studentPaymentOrder.getExpectAmount()) > 0 || goodsIdsStr.split(",").length == i){
|
|
|
studentPaymentOrderDetail.setPrice(studentPaymentOrder.getExpectAmount().subtract(totalPrice));
|
|
|
}else{
|
|
|
studentPaymentOrderDetail.setPrice(tempPrice);
|
|
@@ -555,6 +560,18 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
|
|
|
subjectChangeDao.insert(subjectChange);
|
|
|
//差价小于0退到余额
|
|
|
if (amountMargin.compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
+ //sysUserCashAccountService.updateBalance(subjectChange.getStudentId(), amountMargin.negate(), PlatformCashAccountDetailTypeEnum.REFUNDS, "声部更换退还");
|
|
|
+ if (amountMargin.compareTo(BigDecimal.ZERO) < 0) {
|
|
|
+ SysUserCashAccountLog sysUserCashAccountLog = new SysUserCashAccountLog();
|
|
|
+ sysUserCashAccountLog.setUserId(subjectChange.getStudentId());
|
|
|
+ sysUserCashAccountLog.setGroupType(SUBJECT_CHANGE);
|
|
|
+ sysUserCashAccountLog.setOrganId(subjectChange.getOrganId());
|
|
|
+ sysUserCashAccountLog.setGroupId(subjectChange.getId().toString());
|
|
|
+ sysUserCashAccountLog.setAmount(amountMargin.negate());
|
|
|
+ sysUserCashAccountLog.setReturnFeeType(ReturnFeeEnum.SUBJECT_CHANGE);
|
|
|
+ sysUserCashAccountLog.setComment("声部更换退还");
|
|
|
+ sysUserCashAccountLogDao.insert(sysUserCashAccountLog);
|
|
|
+ }
|
|
|
studentRegistrationService.changeStudentSubject(subjectChange.getStudentId(), subjectChange.getMusicGroupId(), subjectChange.getOriginalSubjectId(), subjectChange.getChangeSubjectId());
|
|
|
}
|
|
|
|
|
@@ -712,6 +729,7 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
|
|
|
spod.setCreateTime(nowDate);
|
|
|
spod.setUpdateTime(nowDate);
|
|
|
spod.setPaymentOrderId(studentPaymentOrder.getId());
|
|
|
+ spod.setTenantId(studentPaymentOrder.getTenantId());
|
|
|
studentPaymentOrderDetailList.add(spod);
|
|
|
}
|
|
|
}
|