فهرست منبع

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

zouxuan 5 سال پیش
والد
کامیت
1023928dab

+ 8 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -323,7 +323,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             if(userCashAccount == null){
                 throw new BizException("用户账户找不到");
             }
-            if(userCashAccount.getBalance().subtract(amount).doubleValue() > 0){
+            if(userCashAccount.getBalance().subtract(amount).doubleValue() >= 0){
                 // 更新订单信息
                 studentPaymentOrder.setActualAmount(new BigDecimal(0));
                 studentPaymentOrder.setBalancePaymentAmount(amount);
@@ -512,7 +512,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         		studentPaymentOrder.setBalancePaymentAmount(amount);
         		studentPaymentOrder.setOrganId(musicGroup.getOrganId());
                 studentPaymentOrder.setUpdateTime(date);
-        		sysUserCashAccountService.updateBalance(userId, amount.negate(),PlatformCashAccountDetailTypeEnum.PAY_FEE,"乐团续费");
+        		sysUserCashAccountService.updateBalance(userId, amount.negate(),PlatformCashAccountDetailTypeEnum.PAY_FEE,"乐团报名");
                 amount = BigDecimal.ZERO;
         	}else{
 				if (userCashAccount.getBalance().doubleValue() > 0) {
@@ -710,7 +710,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         		studentPaymentOrder.setBalancePaymentAmount(amount);
         		studentPaymentOrder.setOrganId(musicGroup.getOrganId());
                 studentPaymentOrder.setUpdateTime(date);
-        		sysUserCashAccountService.updateBalance(userId, amount.negate(),PlatformCashAccountDetailTypeEnum.PAY_FEE,"乐团续费");
+        		sysUserCashAccountService.updateBalance(userId, amount.negate(),PlatformCashAccountDetailTypeEnum.PAY_FEE,"乐团报名");
         		amount = BigDecimal.ZERO;
         	}else{
 				if (userCashAccount.getBalance().doubleValue() > 0) {
@@ -1628,6 +1628,11 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             sysMessageService.batchSendMessage(MessageSender.YIMEI, MessageTypeEnum.STUDENT_SMS_MUSIC_GROUP_RENEW_SUCCESS, yimei, null, 0, "1",
                     studentRegistration.getParentsName(),studentPaymentOrder.getActualAmount());
             return true;
+		} else {
+			if (studentPaymentOrder.getBalancePaymentAmount().doubleValue() > 0) {
+				sysUserCashAccountService.updateBalance(userId, studentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS,
+						"乐团续费失败");
+			}
         }
         if(studentPaymentOrder.getStatus() == DealStatusEnum.CLOSE || studentPaymentOrder.getStatus() == DealStatusEnum.FAILED){
             String baseUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SporadicChargeInfoImpl.java

@@ -43,6 +43,8 @@ public class SporadicChargeInfoImpl extends BaseServiceImpl<Integer, SporadicCha
 	private OrganizationDao organizationDao;
 	@Autowired
 	private TeacherDao teacherDao;
+	@Autowired
+	private SysUserCashAccountService sysUserCashAccountService;
 
 	@Override
 	public BaseDAO<Integer, SporadicChargeInfo> getDAO() {
@@ -71,6 +73,10 @@ public class SporadicChargeInfoImpl extends BaseServiceImpl<Integer, SporadicCha
 			return true;
 		}
 		if(studentPaymentOrder.getStatus() == DealStatusEnum.CLOSE || studentPaymentOrder.getStatus() == DealStatusEnum.FAILED){
+			if(studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) >0 ){
+				sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(), studentPaymentOrder.getBalancePaymentAmount(),PlatformCashAccountDetailTypeEnum.REFUNDS,"支付失败退费");
+			}
+
 			sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_SPORADIC_PAYMENT_FAILED, map, null, 0,"",
 					studentPaymentOrder.getActualAmount(),info.getTitle());
 			sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.SMS_SPORADIC_PAYMENT_FAILED, yimei, null, 0, "",

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -883,6 +883,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                     throw new BizException("减去缴费人数失败");
                 }
             }
+            if(studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) >0 ){
+                sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(), studentPaymentOrder.getBalancePaymentAmount(),PlatformCashAccountDetailTypeEnum.REFUNDS,"支付失败退费");
+            }
+
             //发送缴费成功通知(短信 + push)
             String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + studentRegistration.getMusicGroupId();
 

+ 6 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -24,6 +24,7 @@ import com.ym.mec.im.ImFeignService;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
+
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -1092,7 +1093,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 				return result;
 			}else{
 				if (userCashAccount.getBalance().doubleValue() > 0) {
-					sysUserCashAccountService.updateBalance(user.getId(), userCashAccount.getBalance().negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "乐团续费");
+					sysUserCashAccountService.updateBalance(user.getId(), userCashAccount.getBalance().negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "VIP课购买");
 					amount = amount.subtract(userCashAccount.getBalance());
 					studentPaymentOrder.setActualAmount(amount);
 					studentPaymentOrder.setBalancePaymentAmount(userCashAccount.getBalance());
@@ -1168,6 +1169,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		if(!isOk){
 			updateVipGroupStudentNumAndStatus(vipGroupId,classGroup,-1,false);
 			classGroupStudentMapperDao.deleteStudentByMusicGroupId(vipGroupId.toString(),userId);
+			if (studentPaymentOrder.getBalancePaymentAmount().doubleValue() > 0) {
+				sysUserCashAccountService.updateBalance(userId, studentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS,
+						"VIP课购买失败");
+			}
 			return;
 		}