فهرست منبع

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

zouxuan 5 سال پیش
والد
کامیت
32ac7edc26

+ 42 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentCourseHomeworkServiceImpl.java

@@ -32,6 +32,7 @@ import org.springframework.util.CollectionUtils;
 import java.time.DayOfWeek;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.time.temporal.ChronoUnit;
 import java.util.*;
 import java.util.stream.Collectors;
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
@@ -116,7 +117,26 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
         LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
         LocalDate createDateTime = LocalDateTime.ofInstant(courseSchedule.getClassDate().toInstant(), DateUtil.zoneId).toLocalDate();
         LocalDate createMonday = createDateTime.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
-        if(createDateTime.isBefore(monDayDate)){
+        LocalDate homeworkCreateDateTime = LocalDateTime.ofInstant(existHomework.getCreateTime().toInstant(), DateUtil.zoneId).toLocalDate();
+        boolean isOk=false;
+        switch (createDateTime.getDayOfWeek()){
+            case SATURDAY:
+                if(createDateTime.until(homeworkCreateDateTime, ChronoUnit.DAYS)<4){
+                    isOk=true;
+                }
+                break;
+            case SUNDAY:
+                if(createDateTime.until(homeworkCreateDateTime, ChronoUnit.DAYS)<3){
+                    isOk=true;
+                }
+                break;
+            default:
+                if(createDateTime.get(DateUtil.weekFields.weekOfYear())==homeworkCreateDateTime.get(DateUtil.weekFields.weekOfYear())){
+                    isOk=true;
+                }
+                break;
+        }
+        if(createDateTime.isBefore(monDayDate)&&isOk){
             StudentExtracurricularExercisesSituation studentExercisesSituation = studentExtracurricularExercisesSituationDao.findStudentExercisesSituationsWithMonDay(createMonday.toString(), existHomework.getUserId());
             if(Objects.nonNull(studentExercisesSituation)){
                 studentExercisesSituation.setExercisesReplyNum(1);
@@ -202,7 +222,27 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
             LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
             LocalDate createDateTime = LocalDateTime.ofInstant(courseSchedule.getClassDate().toInstant(), DateUtil.zoneId).toLocalDate();
             LocalDate createMonday = createDateTime.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
-            if(createDateTime.isBefore(monDayDate)){
+
+            LocalDate homeworkCreateDateTime = LocalDateTime.ofInstant(byStudentAndCourseHomewok.getCreateTime().toInstant(), DateUtil.zoneId).toLocalDate();
+            boolean isOk=false;
+            switch (createDateTime.getDayOfWeek()){
+                case SATURDAY:
+                    if(createDateTime.until(homeworkCreateDateTime, ChronoUnit.DAYS)<4){
+                        isOk=true;
+                    }
+                    break;
+                case SUNDAY:
+                    if(createDateTime.until(homeworkCreateDateTime, ChronoUnit.DAYS)<3){
+                        isOk=true;
+                    }
+                    break;
+                default:
+                    if(createDateTime.get(DateUtil.weekFields.weekOfYear())==homeworkCreateDateTime.get(DateUtil.weekFields.weekOfYear())){
+                        isOk=true;
+                    }
+                    break;
+            }
+            if(createDateTime.isBefore(monDayDate)&&isOk){
                 StudentExtracurricularExercisesSituation studentExercisesSituation = studentExtracurricularExercisesSituationDao.findStudentExercisesSituationsWithMonDay(createMonday.toString(), byStudentAndCourseHomewok.getUserId());
                 if(Objects.nonNull(studentExercisesSituation)){
                     if(YesOrNoEnum.YES.equals(byStudentAndCourseHomewok.getIsReplied())){

+ 14 - 10
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -2769,16 +2769,20 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 			for (StudentPaymentOrder studentPaymentOrder:studentPaymentOrders){
 				//生成账户资金明细
-				sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(),studentPaymentOrder.getActualAmount());
-				SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(studentPaymentOrder.getUserId());
-				SysUserCashAccountDetail sysUserIncomeCashAccountDetail = new SysUserCashAccountDetail();
-				sysUserIncomeCashAccountDetail.setUserId(studentPaymentOrder.getUserId());
-				sysUserIncomeCashAccountDetail.setType(PlatformCashAccountDetailTypeEnum.REFUNDS);
-				sysUserIncomeCashAccountDetail.setStatus(DealStatusEnum.SUCCESS);
-				sysUserIncomeCashAccountDetail.setAmount(studentPaymentOrder.getActualAmount());
-				sysUserIncomeCashAccountDetail.setBalance(sysUserCashAccount.getBalance());
-				sysUserIncomeCashAccountDetail.setAttribute(studentPaymentOrder.getTransNo());
-				userCashAccountDetails.add(sysUserIncomeCashAccountDetail);
+				if(studentPaymentOrder.getExpectAmount().compareTo(BigDecimal.ZERO)>0){
+					sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(),studentPaymentOrder.getExpectAmount());
+					SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(studentPaymentOrder.getUserId());
+					SysUserCashAccountDetail sysUserIncomeCashAccountDetail = new SysUserCashAccountDetail();
+					sysUserIncomeCashAccountDetail.setUserId(studentPaymentOrder.getUserId());
+					sysUserIncomeCashAccountDetail.setType(PlatformCashAccountDetailTypeEnum.REFUNDS);
+					sysUserIncomeCashAccountDetail.setStatus(DealStatusEnum.SUCCESS);
+					sysUserIncomeCashAccountDetail.setAmount(studentPaymentOrder.getExpectAmount());
+					sysUserIncomeCashAccountDetail.setBalance(sysUserCashAccount.getBalance());
+					sysUserIncomeCashAccountDetail.setAttribute(studentPaymentOrder.getTransNo());
+					sysUserIncomeCashAccountDetail.setDescription("达到报名截止时间,未满员系统自动取消课程组,并退费");
+					sysUserIncomeCashAccountDetail.setComment("达到报名截止时间,未满员系统自动取消课程组,并退费");
+					userCashAccountDetails.add(sysUserIncomeCashAccountDetail);
+				}
 			}
 			classGroupStudentMapperDao.updateVipGroupStudentStatus(noCreateSuccessVipGroup.getId().toString(),GroupType.VIP.getCode(),ClassGroupStudentStatusEnum.QUIT.getCode());
 		}

+ 3 - 3
mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -151,8 +151,8 @@ public class StudentOrderController extends BaseController {
             @ApiImplicitParam(name = "payChannel", value = "支付方式(alipay-支付宝app支付)", required = true, dataType = "String"),
     })
     public Object executePayment(BigDecimal amount, String orderNo, String payChannel, String notifyUrl, String returnUrl, String orderSubject, String orderBody, String sign, String code) throws Exception {
-        String appId = "wxcf8e8b33a9477845";
-        String appSecret = "1286452b9c68b13325dece7cdf892645";
+        String appId = "wx80f175c0eb6836e9";
+        String appSecret = "f817dc79e4149aaa4fafd6f8279b3593";
         String wxMpOAuth2AccessTokenUrl = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=%s&secret=%s&code=%s&grant_type=authorization_code";
         //payChannel = PayChannelEnum.ALIPAY_QR.getCode();
 //        if (!new Pay().verifySign(amount, orderNo, notifyUrl, orderSubject, orderBody,sign)) {
@@ -177,7 +177,7 @@ public class StudentOrderController extends BaseController {
             return failed("订单不存在");
         }
 
-        Payment payment = new Pay().executePayment(amount, orderNo, payChannel, orderSubject, orderBody, code);
+        Payment payment = new Pay().executePayment(amount, orderNo, payChannel, orderSubject, orderBody, openid);
         order.setTransNo(payment.getId());
         studentPaymentOrderService.update(order);