|
@@ -17,6 +17,7 @@ import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
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;
|
|
@@ -88,6 +89,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
@Autowired
|
|
|
private SysUserCashAccountDetailService sysUserCashAccountDetailService;
|
|
|
@Autowired
|
|
|
+ private SysMessageService sysMessageService;
|
|
|
+ @Autowired
|
|
|
private VipGroupDefaultClassesCycleDao vipGroupDefaultClassesCycleDao;
|
|
|
|
|
|
@Override
|
|
@@ -726,20 +729,21 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
throw new BizException("该课程已结束报名!");
|
|
|
}
|
|
|
|
|
|
- StudentPaymentOrder byStudentVipGroup = studentPaymentOrderDao.findByStudentVipGroup(vipGroupBuyParams.getVipGroupId(), user.getId());
|
|
|
+ StudentPaymentOrder successOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupBuyParams.getVipGroupId(),
|
|
|
+ user.getId(),
|
|
|
+ DealStatusEnum.SUCCESS.getMsg());
|
|
|
|
|
|
- if(Objects.nonNull(byStudentVipGroup)){
|
|
|
+ if(Objects.nonNull(successOrder)){
|
|
|
+ throw new BizException("您已购买过此课程");
|
|
|
+ }
|
|
|
|
|
|
- //生成回调地址
|
|
|
- Map payMap = payService.getPayMap(
|
|
|
- vipGroup.getTotalPrice(),
|
|
|
- byStudentVipGroup.getOrderNo(),
|
|
|
- "https://47.99.212.176:8000/api-student/studentOrder/notify",
|
|
|
- "http://mstudev.dayaedu.com/#/paymentResult",
|
|
|
- "vip课购买",
|
|
|
- vipGroup.getName());
|
|
|
+ StudentPaymentOrder byStudentVipGroup = studentPaymentOrderDao.findByStudentVipGroup(vipGroupBuyParams.getVipGroupId(),
|
|
|
+ user.getId(),
|
|
|
+ DealStatusEnum.ING.getMsg());
|
|
|
|
|
|
- return payMap;
|
|
|
+ if(Objects.nonNull(byStudentVipGroup)){
|
|
|
+ byStudentVipGroup.setStatus(DealStatusEnum.CLOSE);
|
|
|
+ studentPaymentOrderDao.update(byStudentVipGroup);
|
|
|
}
|
|
|
|
|
|
VipGroupClassGroupMapper vipGroupClassGroupMapper = vipGroupClassGroupMapperDao.findByVipGroupId(vipGroup.getId());
|
|
@@ -788,8 +792,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
Map payMap = payService.getPayMap(
|
|
|
vipGroup.getTotalPrice(),
|
|
|
orderNo,
|
|
|
- "https://dyme.utools.club/api-student/studentOrder/notify",
|
|
|
- "https://dyme.utools.club/paymentresult",
|
|
|
+ "http://mstudev.dayaedu.com/api-student/studentOrder/notify",
|
|
|
+ "http://mstudev.dayaedu.com/#/paymentresult?orderNo="+orderNo,
|
|
|
"vip课购买",
|
|
|
vipGroup.getName());
|
|
|
//将学员加入vip班级群组
|
|
@@ -810,6 +814,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
Integer userId = order.getUserId();
|
|
|
boolean isOk=order.getStatus().equals(DealStatusEnum.SUCCESS);
|
|
|
|
|
|
+ VipGroup vipGroup = vipGroupDao.get(vipGroupId);
|
|
|
studentPaymentOrderDao.update(order);
|
|
|
|
|
|
//将学生加入到班级,更新班级报名状态及人数信息
|
|
@@ -839,10 +844,12 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
sysUserCashAccountDetailService.insert(sysUserIncomeCashAccountDetail);
|
|
|
sysUserCashAccountDetailService.insert(sysUserExpendCashAccountDetail);
|
|
|
+ Map<Integer,String> map = new HashMap<>(1);
|
|
|
+ map.put(userId,userId.toString());
|
|
|
+ sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_VIP_BUY, map, null, 0, "",
|
|
|
+ vipGroup.getName());
|
|
|
}
|
|
|
|
|
|
- VipGroup vipGroup = vipGroupDao.get(vipGroupId);
|
|
|
-
|
|
|
//生成学生单课缴费信息
|
|
|
courseScheduleStudentPaymentService.createCourseScheduleStudentPaymentForVipGroup(vipGroupId,userId);
|
|
|
|
|
@@ -866,7 +873,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
public void applyRefund(Long vipGroupId,Integer studentId) {
|
|
|
|
|
|
StudentApplyRefunds studentApplyRefunds=new StudentApplyRefunds();
|
|
|
- StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId,studentId);
|
|
|
+ StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId,studentId,DealStatusEnum.SUCCESS.getMsg());
|
|
|
if(null==studentPaymentOrder){
|
|
|
throw new BizException("未找到相关订单信息!");
|
|
|
}
|
|
@@ -885,9 +892,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
studentApplyRefunds.setOrigPaymentOrderId(studentPaymentOrder.getId());
|
|
|
studentApplyRefunds.setUserId(studentId.intValue());
|
|
|
studentApplyRefundsDao.insert(studentApplyRefunds);
|
|
|
- //学员退出班级群
|
|
|
-// ImGroupMember[] imGroupMembers = new ImGroupMember[]{new ImGroupMember(studentId.toString())};
|
|
|
-// imFeignService.groupJoin(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, classGroup.getName()));
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -913,30 +917,33 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
studentApplyRefunds.setRemark(remark);
|
|
|
studentApplyRefundsDao.update(studentApplyRefunds);
|
|
|
switch (studentApplyRefunds.getStatus()) {
|
|
|
- case PASS:
|
|
|
- sysUserCashAccountService.updateBalance(studentApplyRefunds.getUserId(), studentApplyRefunds.getActualAmount());
|
|
|
- SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(studentApplyRefunds.getUserId().intValue());
|
|
|
- SysUserCashAccountDetail sysUserCashAccountDetail = new SysUserCashAccountDetail();
|
|
|
- sysUserCashAccountDetail.setUserId(studentApplyRefunds.getUserId());
|
|
|
- sysUserCashAccountDetail.setType(PlatformCashAccountDetailTypeEnum.REFUNDS);
|
|
|
- sysUserCashAccountDetail.setStatus(DealStatusEnum.SUCCESS);
|
|
|
- sysUserCashAccountDetail.setAmount(amount);
|
|
|
- sysUserCashAccountDetail.setBalance(sysUserCashAccount.getBalance());
|
|
|
- sysUserCashAccountDetail.setAttribute(studentApplyRefunds.getId().toString());
|
|
|
- sysUserCashAccountDetailDao.insert(sysUserCashAccountDetail);
|
|
|
-
|
|
|
- ClassGroupStudentMapper classStudentMapperByUserIdAndClassGroupId = classGroupStudentMapperDao.findClassStudentMapperByUserIdAndClassGroupId(studentPaymentOrder.getUserId(),
|
|
|
- studentPaymentOrder.getClassGroupId());
|
|
|
-
|
|
|
- classStudentMapperByUserIdAndClassGroupId.setStatus(ClassGroupStudentStatusEnum.LEAVE);
|
|
|
- classGroupStudentMapperDao.update(classStudentMapperByUserIdAndClassGroupId);
|
|
|
-
|
|
|
- break;
|
|
|
- case REJECT:
|
|
|
-
|
|
|
- break;
|
|
|
- default:
|
|
|
- throw new BizException("审核状态错误!");
|
|
|
+ case PASS:
|
|
|
+ sysUserCashAccountService.updateBalance(studentApplyRefunds.getUserId(), studentApplyRefunds.getActualAmount());
|
|
|
+ SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(studentApplyRefunds.getUserId().intValue());
|
|
|
+ SysUserCashAccountDetail sysUserCashAccountDetail = new SysUserCashAccountDetail();
|
|
|
+ sysUserCashAccountDetail.setUserId(studentApplyRefunds.getUserId());
|
|
|
+ sysUserCashAccountDetail.setType(PlatformCashAccountDetailTypeEnum.REFUNDS);
|
|
|
+ sysUserCashAccountDetail.setStatus(DealStatusEnum.SUCCESS);
|
|
|
+ sysUserCashAccountDetail.setAmount(amount);
|
|
|
+ sysUserCashAccountDetail.setBalance(sysUserCashAccount.getBalance());
|
|
|
+ sysUserCashAccountDetail.setAttribute(studentApplyRefunds.getId().toString());
|
|
|
+ sysUserCashAccountDetailDao.insert(sysUserCashAccountDetail);
|
|
|
+
|
|
|
+ ClassGroupStudentMapper classStudentMapperByUserIdAndClassGroupId = classGroupStudentMapperDao.findClassStudentMapperByUserIdAndClassGroupId(studentPaymentOrder.getUserId(),
|
|
|
+ studentPaymentOrder.getClassGroupId());
|
|
|
+
|
|
|
+ classStudentMapperByUserIdAndClassGroupId.setStatus(ClassGroupStudentStatusEnum.LEAVE);
|
|
|
+ classGroupStudentMapperDao.update(classStudentMapperByUserIdAndClassGroupId);
|
|
|
+
|
|
|
+ //学员退出班级群
|
|
|
+ ImGroupMember[] imGroupMembers = new ImGroupMember[]{new ImGroupMember(studentApplyRefunds.getUserId().toString())};
|
|
|
+ imFeignService.groupJoin(new ImGroupModel(studentPaymentOrder.getClassGroupId().toString(), imGroupMembers, null));
|
|
|
+ break;
|
|
|
+ case REJECT:
|
|
|
+
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new BizException("审核状态错误!");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1028,7 +1035,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
}
|
|
|
Map<Integer, BigDecimal> studentSurplusClassFees = MapUtil.convertMybatisMap(maps);
|
|
|
for(Integer userId:studentSurplusClassFees.keySet()){
|
|
|
- StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId,userId);
|
|
|
+ StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId,userId,DealStatusEnum.SUCCESS.getMsg());
|
|
|
if(null==studentPaymentOrder){
|
|
|
throw new BizException("未找到相关订单信息!");
|
|
|
}
|