|
@@ -128,13 +128,13 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
@Autowired
|
|
|
private CourseScheduleTeacherSalaryDao courseScheduleTeacherSalaryDao;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
|
|
|
|
|
|
@Autowired
|
|
|
private CooperationOrganDao cooperationOrganDao;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private TeacherAttendanceDao teacherAttendanceDao;
|
|
|
|
|
@@ -152,19 +152,19 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
@Autowired
|
|
|
private EmployeeDao employeeDao;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private SysMessageService sysMessageService;
|
|
|
|
|
|
@Autowired
|
|
|
private SysConfigDao sysConfigDao;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private ClassGroupService classGroupService;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private MusicGroupSubjectPlanService musicGroupSubjectPlanService;
|
|
|
@Autowired
|
|
@@ -175,12 +175,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
private MusicGroupSubjectGoodsGroupService musicGroupSubjectGoodsGroupService;
|
|
|
@Autowired
|
|
|
private GoodsService goodsService;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private ImFeignService imFeignService;
|
|
|
-
|
|
|
+
|
|
|
private SimpleDateFormat sdf_ymd = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
-
|
|
|
+
|
|
|
private SimpleDateFormat sdf_hms=new SimpleDateFormat("HH:mm:ss");
|
|
|
|
|
|
@Override
|
|
@@ -358,6 +358,13 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
studentPaymentOrder.setVersion(studentPaymentOrder.getVersion()+1);
|
|
|
|
|
|
String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
|
|
|
+
|
|
|
+ Map<String, BigDecimal> classFee = new HashMap<>();
|
|
|
+ classFee.put("course",BigDecimal.ZERO);
|
|
|
+ classFee.put("instrument",BigDecimal.ZERO);
|
|
|
+ classFee.put("accessories",BigDecimal.ZERO);
|
|
|
+ classFee.put("other",amount);
|
|
|
+
|
|
|
Map payMap = payService.getPayMap(
|
|
|
amount,
|
|
|
orderNo,
|
|
@@ -365,8 +372,15 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
baseApiUrl+"/#/paymentresult?orderNo=" + orderNo,
|
|
|
chargeInfo.getTitle(),
|
|
|
chargeInfo.getTitle(),
|
|
|
- userId);
|
|
|
-
|
|
|
+ userId,
|
|
|
+ classFee,
|
|
|
+ chargeInfo.getOrganId()
|
|
|
+ );
|
|
|
+
|
|
|
+ Map<String,BigDecimal> routingFee = (Map<String,BigDecimal>)payMap.get("routingFee");
|
|
|
+ studentPaymentOrder.setComAmount(routingFee.get("COM"));
|
|
|
+ studentPaymentOrder.setPerAmount(routingFee.get("PER"));
|
|
|
+ studentPaymentOrder.setMerNos((String) payMap.get("routingMerNos"));
|
|
|
studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
|
|
|
studentPaymentOrder.setUpdateTime(date);
|
|
|
studentPaymentOrderService.update(studentPaymentOrder);
|
|
@@ -395,10 +409,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
|
orderAmount = orderAmount.add(courseFee);
|
|
|
|
|
|
+ BigDecimal instrumentFee = BigDecimal.ZERO;
|
|
|
+ BigDecimal accessoriesFee = BigDecimal.ZERO;
|
|
|
+ BigDecimal otherFee = BigDecimal.ZERO;
|
|
|
|
|
|
//乐器及打包辅件
|
|
|
List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
|
|
|
-
|
|
|
if (studentRegistration.getTemporaryCourseFee() != null) {
|
|
|
List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailService.findUserApplyOrder(studentRegistration.getUserId(), DealStatusEnum.WAIT_PAY);
|
|
|
for (StudentPaymentOrderDetail orderDetail : orderDetails) {
|
|
@@ -415,6 +431,13 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
musicGroupSubjectGoodsGroup.setPrice(orderDetail.getPrice());
|
|
|
|
|
|
goodsGroups.add(musicGroupSubjectGoodsGroup);
|
|
|
+ if(musicGroupSubjectGoodsGroup.getType().equals(GoodsType.INSTRUMENT)){
|
|
|
+ instrumentFee = instrumentFee.add(orderDetail.getPrice());
|
|
|
+ }else if(musicGroupSubjectGoodsGroup.getType().equals(GoodsType.ACCESSORIES)) {
|
|
|
+ accessoriesFee = accessoriesFee.add(orderDetail.getPrice());
|
|
|
+ }else {
|
|
|
+ otherFee = otherFee.add(orderDetail.getPrice());
|
|
|
+ }
|
|
|
|
|
|
orderAmount = orderAmount.add(orderDetail.getPrice());
|
|
|
}
|
|
@@ -422,18 +445,23 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
goodsGroups = musicGroupSubjectGoodsGroupService.findGoodsGroupByIds(registerPayDto.getGoodsGroupIds());
|
|
|
for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
|
|
|
if (goodsGroup.getType().equals(GoodsType.INSTRUMENT) && musicOneSubjectClassPlan.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.LEASE)) {
|
|
|
- orderAmount = orderAmount.add(musicOneSubjectClassPlan.getDepositFee());
|
|
|
goodsGroup.setPrice(musicOneSubjectClassPlan.getDepositFee());
|
|
|
- continue;
|
|
|
}
|
|
|
if (goodsGroup.getType().equals(GoodsType.INSTRUMENT) && musicOneSubjectClassPlan.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.FREE)) {
|
|
|
goodsGroup.setPrice(new BigDecimal(0));
|
|
|
- continue;
|
|
|
}
|
|
|
orderAmount = orderAmount.add(goodsGroup.getPrice());
|
|
|
+ if(goodsGroup.getType().equals(GoodsType.INSTRUMENT)){
|
|
|
+ instrumentFee = instrumentFee.add(goodsGroup.getPrice());
|
|
|
+ }else if(goodsGroup.getType().equals(GoodsType.ACCESSORIES)) {
|
|
|
+ accessoriesFee = accessoriesFee.add(goodsGroup.getPrice());
|
|
|
+ }else {
|
|
|
+ otherFee = otherFee.add(goodsGroup.getPrice());
|
|
|
+ }
|
|
|
//团购乐器减免课程费用
|
|
|
if (goodsGroup.getType().equals(GoodsType.INSTRUMENT) && goodsGroup.getRemissionCourseFee() != null && musicOneSubjectClassPlan.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.GROUP)) {//团购
|
|
|
orderAmount = orderAmount.subtract(goodsGroup.getRemissionCourseFee());
|
|
|
+ courseFee.subtract(goodsGroup.getRemissionCourseFee());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -444,6 +472,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
goodsList = goodsService.findGoodsByIds(registerPayDto.getGoodsIds());
|
|
|
for (Goods goods : goodsList) {
|
|
|
orderAmount = orderAmount.add(goods.getGroupPurchasePrice());
|
|
|
+ accessoriesFee = accessoriesFee.add(goods.getGroupPurchasePrice());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -453,14 +482,14 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
otherGoodsList = goodsService.findGoodsByIds(registerPayDto.getOtherGoodsIds());
|
|
|
for (Goods goods : otherGoodsList) {
|
|
|
orderAmount = orderAmount.add(goods.getGroupPurchasePrice());
|
|
|
+ otherFee = otherFee.add(goods.getGroupPurchasePrice());
|
|
|
}
|
|
|
}
|
|
|
if (amount.compareTo(orderAmount) != 0) {
|
|
|
throw new BizException("商品价格不符");
|
|
|
}
|
|
|
-
|
|
|
String orderNo = idGeneratorService.generatorId("payment") + "";
|
|
|
-
|
|
|
+
|
|
|
String channelType = "";
|
|
|
|
|
|
StudentPaymentOrder studentPaymentOrder = studentRegistrationService.addOrder(studentRegistration, amount, orderNo, channelType, courseFee, goodsGroups, goodsList, otherGoodsList);
|
|
@@ -504,6 +533,28 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
studentPaymentOrder.setVersion(studentPaymentOrder.getVersion()+1);
|
|
|
|
|
|
+ MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
|
|
|
+ //分类费用 course,instrument,accessories,other
|
|
|
+ Map<String, BigDecimal> classFee = new HashMap<>();
|
|
|
+ classFee.put("course",courseFee);
|
|
|
+ classFee.put("instrument",instrumentFee);
|
|
|
+ classFee.put("accessories",accessoriesFee);
|
|
|
+ classFee.put("other",otherFee);
|
|
|
+ BigDecimal classFeeAmount = courseFee.add(instrumentFee).add(accessoriesFee).add(otherFee);
|
|
|
+
|
|
|
+ if(amount.compareTo(classFeeAmount) < 0){
|
|
|
+ BigDecimal subAmount = classFeeAmount.subtract(amount);
|
|
|
+ for (Map.Entry<String, BigDecimal> feeEntry : classFee.entrySet()) {
|
|
|
+ if(subAmount.compareTo(feeEntry.getValue()) > 0){
|
|
|
+ classFee.put(feeEntry.getKey(),BigDecimal.ZERO);
|
|
|
+ subAmount = subAmount.subtract(feeEntry.getValue());
|
|
|
+ }else {
|
|
|
+ classFee.put(feeEntry.getKey(),feeEntry.getValue().subtract(subAmount));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
|
|
|
Map payMap = payService.getPayMap(
|
|
|
amount,
|
|
@@ -512,8 +563,15 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
baseApiUrl+"/#/paymentresult?orderNo=" + orderNo,
|
|
|
"乐团报名缴费",
|
|
|
"乐团报名缴费",
|
|
|
- userId);
|
|
|
-
|
|
|
+ userId,
|
|
|
+ classFee,
|
|
|
+ musicGroup.getOrganId()
|
|
|
+ );
|
|
|
+
|
|
|
+ Map<String,BigDecimal> routingFee = (Map<String,BigDecimal>)payMap.get("routingFee");
|
|
|
+ studentPaymentOrder.setComAmount(routingFee.get("COM"));
|
|
|
+ studentPaymentOrder.setPerAmount(routingFee.get("PER"));
|
|
|
+ studentPaymentOrder.setMerNos((String) payMap.get("routingMerNos"));
|
|
|
studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
|
|
|
studentPaymentOrder.setUpdateTime(date);
|
|
|
studentPaymentOrderService.update(studentPaymentOrder);
|
|
@@ -529,7 +587,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
|
|
|
|
Integer userId = studentRegistration.getUserId();
|
|
|
-
|
|
|
+
|
|
|
StudentPaymentOrder ApplyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.ING);
|
|
|
if (ApplyOrder == null) {
|
|
|
throw new BizException("没有支付中的订单,请勿非法请求");
|
|
@@ -546,6 +604,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
|
orderAmount = orderAmount.add(courseFee);
|
|
|
|
|
|
+ BigDecimal instrumentFee = BigDecimal.ZERO;
|
|
|
+ BigDecimal accessoriesFee = BigDecimal.ZERO;
|
|
|
+ BigDecimal otherFee = BigDecimal.ZERO;
|
|
|
+
|
|
|
|
|
|
//乐器及打包辅件
|
|
|
List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
|
|
@@ -564,23 +626,38 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
musicGroupSubjectGoodsGroup.setGoodsIdList(orderDetail.getGoodsIdList());
|
|
|
musicGroupSubjectGoodsGroup.setPrice(orderDetail.getPrice());
|
|
|
goodsGroups.add(musicGroupSubjectGoodsGroup);
|
|
|
+
|
|
|
+ if(musicGroupSubjectGoodsGroup.getType().equals(GoodsType.INSTRUMENT)){
|
|
|
+ instrumentFee = instrumentFee.add(orderDetail.getPrice());
|
|
|
+ }else if(musicGroupSubjectGoodsGroup.getType().equals(GoodsType.ACCESSORIES)) {
|
|
|
+ accessoriesFee = accessoriesFee.add(orderDetail.getPrice());
|
|
|
+ }else {
|
|
|
+ otherFee = otherFee.add(orderDetail.getPrice());
|
|
|
+ }
|
|
|
orderAmount = orderAmount.add(orderDetail.getPrice());
|
|
|
}
|
|
|
} else if (studentRegistration.getTemporaryCourseFee() == null && !registerPayDto.getGoodsGroupIds().equals("")) {
|
|
|
goodsGroups = musicGroupSubjectGoodsGroupService.findGoodsGroupByIds(registerPayDto.getGoodsGroupIds());
|
|
|
for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
|
|
|
if (goodsGroup.getType().equals(GoodsType.INSTRUMENT) && musicOneSubjectClassPlan.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.LEASE)) {
|
|
|
- orderAmount = orderAmount.add(musicOneSubjectClassPlan.getDepositFee());
|
|
|
- continue;
|
|
|
+ goodsGroup.setPrice(musicOneSubjectClassPlan.getDepositFee());
|
|
|
}
|
|
|
if (goodsGroup.getType().equals(GoodsType.INSTRUMENT) && musicOneSubjectClassPlan.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.FREE)) {
|
|
|
- continue;
|
|
|
+ goodsGroup.setPrice(new BigDecimal(0));
|
|
|
}
|
|
|
|
|
|
orderAmount = orderAmount.add(goodsGroup.getPrice());
|
|
|
+ if(goodsGroup.getType().equals(GoodsType.INSTRUMENT)){
|
|
|
+ instrumentFee = instrumentFee.add(goodsGroup.getPrice());
|
|
|
+ }else if(goodsGroup.getType().equals(GoodsType.ACCESSORIES)) {
|
|
|
+ accessoriesFee = accessoriesFee.add(goodsGroup.getPrice());
|
|
|
+ }else {
|
|
|
+ otherFee = otherFee.add(goodsGroup.getPrice());
|
|
|
+ }
|
|
|
//团购乐器减免课程费用
|
|
|
if (goodsGroup.getType().equals(GoodsType.INSTRUMENT) && goodsGroup.getRemissionCourseFee() != null && musicOneSubjectClassPlan.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.GROUP)) {//团购
|
|
|
orderAmount = orderAmount.subtract(goodsGroup.getRemissionCourseFee());
|
|
|
+ courseFee.subtract(goodsGroup.getRemissionCourseFee());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -591,6 +668,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
goodsList = goodsService.findGoodsByIds(registerPayDto.getGoodsIds());
|
|
|
for (Goods goods : goodsList) {
|
|
|
orderAmount = orderAmount.add(goods.getGroupPurchasePrice());
|
|
|
+ accessoriesFee = accessoriesFee.add(goods.getGroupPurchasePrice());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -600,6 +678,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
otherGoodsList = goodsService.findGoodsByIds(registerPayDto.getOtherGoodsIds());
|
|
|
for (Goods goods : otherGoodsList) {
|
|
|
orderAmount = orderAmount.add(goods.getGroupPurchasePrice());
|
|
|
+ otherFee = otherFee.add(goods.getGroupPurchasePrice());
|
|
|
}
|
|
|
}
|
|
|
if (amount.compareTo(orderAmount) != 0) {
|
|
@@ -607,13 +686,13 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
|
|
|
|
String orderNo = idGeneratorService.generatorId("payment") + "";
|
|
|
-
|
|
|
+
|
|
|
String channelType = "";
|
|
|
|
|
|
StudentPaymentOrder studentPaymentOrder = studentRegistrationService.reAddOrder(userId, amount, orderNo, channelType, courseFee, goodsGroups, goodsList, otherGoodsList, studentRegistration.getMusicGroupId(), ApplyOrder);
|
|
|
studentPaymentOrder.setVersion(0);
|
|
|
Date date = new Date();
|
|
|
-
|
|
|
+
|
|
|
if(registerPayDto.getIsUseBalancePayment() || amount.doubleValue() == 0){
|
|
|
SysUserCashAccount userCashAccount = sysUserCashAccountService.getLocked(userId);
|
|
|
if(userCashAccount == null){
|
|
@@ -648,6 +727,28 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
|
studentPaymentOrder.setVersion(studentPaymentOrder.getVersion()+1);
|
|
|
|
|
|
+ MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
|
|
|
+ //分类费用 course,instrument,accessories,other
|
|
|
+ Map<String, BigDecimal> classFee = new HashMap<>();
|
|
|
+ classFee.put("course",courseFee);
|
|
|
+ classFee.put("instrument",instrumentFee);
|
|
|
+ classFee.put("accessories",accessoriesFee);
|
|
|
+ classFee.put("other",otherFee);
|
|
|
+ BigDecimal classFeeAmount = courseFee.add(instrumentFee).add(accessoriesFee).add(otherFee);
|
|
|
+
|
|
|
+ if(amount.compareTo(classFeeAmount) < 0){
|
|
|
+ BigDecimal subAmount = classFeeAmount.subtract(amount);
|
|
|
+ for (Map.Entry<String, BigDecimal> feeEntry : classFee.entrySet()) {
|
|
|
+ if(subAmount.compareTo(feeEntry.getValue()) > 0){
|
|
|
+ classFee.put(feeEntry.getKey(),BigDecimal.ZERO);
|
|
|
+ subAmount = subAmount.subtract(feeEntry.getValue());
|
|
|
+ }else {
|
|
|
+ classFee.put(feeEntry.getKey(),feeEntry.getValue().subtract(subAmount));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
|
|
|
Map payMap = payService.getPayMap(
|
|
|
amount,
|
|
@@ -656,12 +757,18 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
baseApiUrl+"/#/paymentresult?orderNo=" + orderNo,
|
|
|
"乐团报名缴费",
|
|
|
"乐团报名缴费",
|
|
|
- userId);
|
|
|
-
|
|
|
+ userId,
|
|
|
+ classFee,
|
|
|
+ musicGroup.getOrganId()
|
|
|
+ );
|
|
|
+
|
|
|
+ Map<String,BigDecimal> routingFee = (Map<String,BigDecimal>)payMap.get("routingFee");
|
|
|
+ studentPaymentOrder.setComAmount(routingFee.get("COM"));
|
|
|
+ studentPaymentOrder.setPerAmount(routingFee.get("PER"));
|
|
|
+ studentPaymentOrder.setMerNos((String) payMap.get("routingMerNos"));
|
|
|
studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
|
|
|
studentPaymentOrder.setUpdateTime(date);
|
|
|
studentPaymentOrderService.update(studentPaymentOrder);
|
|
|
-
|
|
|
return payMap;
|
|
|
}
|
|
|
|
|
@@ -926,7 +1033,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
if (studentPaymentOrders != null && studentPaymentOrders.size() > 0) {
|
|
|
throw new BizException("缴费存在交易中的数据,不能取消乐团");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//删除续费记录
|
|
|
musicGroupStudentFeeDao.deleteByMusicGroupId(musicGroupId);
|
|
|
|
|
@@ -935,7 +1042,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
// 删除每节课的课酬
|
|
|
courseScheduleStudentPaymentDao.deleteByMusicGroupId(musicGroupId, GroupType.MUSIC);
|
|
|
courseScheduleTeacherSalaryDao.deleteByMusicGroupId(musicGroupId, GroupType.MUSIC);
|
|
|
-
|
|
|
+
|
|
|
//删除考勤
|
|
|
teacherAttendanceDao.deleteByMusicGroupId(musicGroupId, GroupType.MUSIC);
|
|
|
|
|
@@ -992,10 +1099,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
// 清除下次缴费时间
|
|
|
musicGroupStudentFeeDao.updateNextPaymentDate(musicGroupId, null);
|
|
|
musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId,"暂停乐团",sysUser.getId(),""));
|
|
|
-
|
|
|
+
|
|
|
//删除课表
|
|
|
courseScheduleDao.logicDeleteCourseSchedulesByMusicGroupID(musicGroup.getId());
|
|
|
-
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -1022,10 +1129,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
// 重新设置下次缴费时间
|
|
|
musicGroupStudentFeeDao.updateNextPaymentDate(musicGroupId, musicGroupPaymentCalenderService.getNextPaymentDate(musicGroupId));
|
|
|
musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId,"恢复乐团",sysUser.getId(),""));
|
|
|
-
|
|
|
+
|
|
|
//恢复课表
|
|
|
courseScheduleDao.resumeCourseScheduleByMusicGroupId(musicGroup.getId());
|
|
|
-
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -1121,7 +1228,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
|
//更新学员在班级的状态
|
|
|
classGroupStudentMapperDao.deleteStudentByMusicGroupId(musicGroupId, userId);
|
|
|
-
|
|
|
+
|
|
|
List<Integer> classGroupIdList = classGroupStudentMapperDao.queryClassGroupIdList(musicGroupId, userId, GroupType.MUSIC);
|
|
|
if (classGroupIdList != null && classGroupIdList.size() > 0) {
|
|
|
//更新班级人数
|
|
@@ -1134,21 +1241,21 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
|
imFeignService.groupBatchQuit(imGroupModels);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
List<CourseSchedule> musicGroupCourseSchedules = courseScheduleDao.findMusicGroupCourseSchedulesWithStudent(musicGroupId,GroupType.MUSIC.getCode(), CourseStatusEnum.NOT_START.getCode(),userId);
|
|
|
if(!CollectionUtils.isEmpty(musicGroupCourseSchedules)){
|
|
|
List<Long> courseScheduleIds = musicGroupCourseSchedules.stream().map(courseSchedule -> courseSchedule.getId()).collect(Collectors.toList());
|
|
|
|
|
|
// 删除未上课
|
|
|
courseScheduleDao.deleteMusicGroupCourseSchedulesWithStudent(courseScheduleIds,userId);
|
|
|
-
|
|
|
+
|
|
|
//删除学生缴费表
|
|
|
courseScheduleStudentPaymentDao.deleteStudentCourseSchedule(userId, musicGroupCourseSchedules);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//删除续费周期
|
|
|
musicGroupStudentFeeDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
|
|
|
-
|
|
|
+
|
|
|
// 退团
|
|
|
studentRegistration.setMusicGroupStatus(ClassGroupStudentStatusEnum.QUIT);
|
|
|
studentRegistration.setUpdateTime(date);
|
|
@@ -1229,7 +1336,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
|
//更新学员在班级的状态
|
|
|
classGroupStudentMapperDao.deleteStudentByMusicGroupId(musicGroupId, userId);
|
|
|
-
|
|
|
+
|
|
|
List<Integer> classGroupIdList = classGroupStudentMapperDao.queryClassGroupIdList(musicGroupId, userId, GroupType.MUSIC);
|
|
|
if (classGroupIdList != null && classGroupIdList.size() > 0) {
|
|
|
//更新班级人数
|
|
@@ -1243,21 +1350,21 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
|
imFeignService.groupBatchQuit(imGroupModels);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
List<CourseSchedule> musicGroupCourseSchedules = courseScheduleDao.findMusicGroupCourseSchedulesWithStudent(musicGroupId,GroupType.MUSIC.getCode(), CourseStatusEnum.NOT_START.getCode(),userId);
|
|
|
if(!CollectionUtils.isEmpty(musicGroupCourseSchedules)){
|
|
|
List<Long> courseScheduleIds = musicGroupCourseSchedules.stream().map(courseSchedule -> courseSchedule.getId()).collect(Collectors.toList());
|
|
|
|
|
|
// 删除未上课
|
|
|
courseScheduleDao.deleteMusicGroupCourseSchedulesWithStudent(courseScheduleIds,userId);
|
|
|
-
|
|
|
+
|
|
|
// 删除学生缴费表
|
|
|
courseScheduleStudentPaymentDao.deleteStudentCourseSchedule(userId, musicGroupCourseSchedules);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//删除续费周期
|
|
|
musicGroupStudentFeeDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
|
|
|
-
|
|
|
+
|
|
|
// 退团
|
|
|
studentRegistration.setMusicGroupStatus(ClassGroupStudentStatusEnum.QUIT);
|
|
|
studentRegistration.setUpdateTime(date);
|
|
@@ -1356,7 +1463,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
|
|
|
|
|
|
studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
|
|
|
-
|
|
|
+
|
|
|
if(isUseBalancePayment || amount.doubleValue() == 0){
|
|
|
SysUserCashAccount userCashAccount = sysUserCashAccountService.getLocked(userId);
|
|
|
if(userCashAccount == null){
|
|
@@ -1369,9 +1476,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
|
|
|
studentPaymentOrder.setUpdateTime(date);
|
|
|
studentPaymentOrderService.update(studentPaymentOrder);
|
|
|
-
|
|
|
+
|
|
|
sysUserCashAccountService.updateBalance(userId, amount.negate(),PlatformCashAccountDetailTypeEnum.PAY_FEE,"乐团续费");
|
|
|
-
|
|
|
+
|
|
|
//更新下次续费时间
|
|
|
musicGroupStudentFee.setUpdateTime(date);
|
|
|
musicGroupStudentFee.setLatestPaidTime(date);
|
|
@@ -1392,12 +1499,29 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
|
String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
|
|
|
|
|
|
+ //分类费用 course,instrument,accessories,other
|
|
|
+ Map<String, BigDecimal> classFee = new HashMap<>();
|
|
|
+ classFee.put("course",amount);
|
|
|
+ classFee.put("instrument",BigDecimal.ZERO);
|
|
|
+ classFee.put("accessories",BigDecimal.ZERO);
|
|
|
+ classFee.put("other",BigDecimal.ZERO);
|
|
|
+
|
|
|
try {
|
|
|
|
|
|
Map<String, Object> payMap = payService.getPayMap(amount, studentPaymentOrder.getOrderNo(),
|
|
|
baseApiUrl+"/api-student/studentOrder/notify",
|
|
|
baseApiUrl+"/#/paymentresult?orderNo=" + studentPaymentOrder.getOrderNo(),
|
|
|
- "续费", "乐团续费",userId);
|
|
|
+ "续费",
|
|
|
+ "乐团续费",
|
|
|
+ userId,
|
|
|
+ classFee,
|
|
|
+ musicGroup.getOrganId()
|
|
|
+ );
|
|
|
+
|
|
|
+ Map<String,BigDecimal> routingFee = (Map<String,BigDecimal>)payMap.get("routingFee");
|
|
|
+ studentPaymentOrder.setComAmount(routingFee.get("COM"));
|
|
|
+ studentPaymentOrder.setPerAmount(routingFee.get("PER"));
|
|
|
+ studentPaymentOrder.setMerNos((String) payMap.get("routingMerNos"));
|
|
|
studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
|
|
|
studentPaymentOrder.setUpdateTime(date);
|
|
|
studentPaymentOrderService.update(studentPaymentOrder);
|
|
@@ -1412,7 +1536,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
public boolean renewForCallback(StudentPaymentOrder studentPaymentOrder) throws IOException {
|
|
|
|
|
|
- studentPaymentOrderDao.update(studentPaymentOrder);
|
|
|
+ studentPaymentOrderService.update(studentPaymentOrder);
|
|
|
|
|
|
Integer userId = studentPaymentOrder.getUserId();
|
|
|
String musicGroupId = studentPaymentOrder.getMusicGroupId();
|
|
@@ -1436,7 +1560,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
musicGroupStudentFee.setTemporaryCourseFee(new BigDecimal(0));
|
|
|
musicGroupStudentFee.setNextPaymentDate(musicGroupPaymentCalenderService.getNextPaymentDate(musicGroupId));
|
|
|
musicGroupStudentFeeDao.update(musicGroupStudentFee);
|
|
|
-
|
|
|
+
|
|
|
//插入交易明细
|
|
|
SysUserCashAccount cashAccount = sysUserCashAccountService.get(userId);
|
|
|
BigDecimal amount = studentPaymentOrder.getActualAmount();
|
|
@@ -1451,21 +1575,27 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
rechargeDetail.setType(PlatformCashAccountDetailTypeEnum.RECHARGE);
|
|
|
rechargeDetail.setUpdateTime(date);
|
|
|
rechargeDetail.setUserId(userId);
|
|
|
+ rechargeDetail.setChannel(studentPaymentOrder.getPaymentChannel());
|
|
|
+ rechargeDetail.setComAmount(studentPaymentOrder.getComAmount());
|
|
|
+ rechargeDetail.setPerAmount(studentPaymentOrder.getPerAmount());
|
|
|
sysUserCashAccountDetailService.insert(rechargeDetail);
|
|
|
-
|
|
|
+
|
|
|
//缴费
|
|
|
SysUserCashAccountDetail paymentDetail = new SysUserCashAccountDetail();
|
|
|
- paymentDetail.setAmount(amount);
|
|
|
+ paymentDetail.setAmount(amount.negate());
|
|
|
paymentDetail.setBalance(cashAccount.getBalance());
|
|
|
- paymentDetail.setComment("缴费");
|
|
|
+ paymentDetail.setComment("续费");
|
|
|
paymentDetail.setCreateTime(date);
|
|
|
paymentDetail.setStatus(DealStatusEnum.SUCCESS);
|
|
|
paymentDetail.setTransNo(studentPaymentOrder.getTransNo());
|
|
|
paymentDetail.setType(PlatformCashAccountDetailTypeEnum.PAY_FEE);
|
|
|
paymentDetail.setUpdateTime(date);
|
|
|
paymentDetail.setUserId(userId);
|
|
|
+ rechargeDetail.setChannel(studentPaymentOrder.getPaymentChannel());
|
|
|
+ rechargeDetail.setComAmount(studentPaymentOrder.getComAmount().negate());
|
|
|
+ rechargeDetail.setPerAmount(studentPaymentOrder.getPerAmount().negate());
|
|
|
sysUserCashAccountDetailService.insert(paymentDetail);
|
|
|
-
|
|
|
+
|
|
|
// 发送续费结果通知
|
|
|
sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.STUDENT_SMS_MUSIC_GROUP_RENEW_SUCCESS, push, null, 0, "1",
|
|
|
studentRegistration.getParentsName(),studentPaymentOrder.getActualAmount());
|