yonge 3 years ago
parent
commit
c225cd0793

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentService.java

@@ -83,6 +83,8 @@ public interface StudentService extends BaseService<Integer, Student> {
      * 更新学员会员信息
      */
     void updateMemberRank(CloudTeacherOrder cloudTeacherOrder, PeriodEnum periodEnum);
+    
+    void updateMemberRank(Integer userId, PeriodEnum periodEnum, int times);
 
     /**
      * 更新服务指标

+ 41 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java

@@ -179,6 +179,10 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
         student.setCurrentClass(studentPreRegistration.getCurrentClass());
         studentDao.insert(student);
         
+        if(user.getOrganId() == 59){
+        	updateMemberRank(userId, PeriodEnum.MONTH, 1);
+        }
+        
         return true;
 	}
 
@@ -481,6 +485,43 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
+	public void updateMemberRank(Integer userId, PeriodEnum periodEnum, int times) {
+    	Student student = this.get(userId);
+        if (student == null) {
+            throw new BizException("学员信息不存在");
+        }
+        
+        Date nowDate = new Date();
+        
+        if(student.getMembershipStartTime() == null){
+            student.setMembershipStartTime(nowDate);
+        }
+        
+        if(student.getMembershipEndTime().after(nowDate)){
+        	nowDate = student.getMembershipEndTime();
+        }
+        
+        switch (periodEnum) {
+		case DAY:
+            student.setMembershipEndTime(DateUtil.addDays(nowDate, times));
+			break;
+		case MONTH:
+		case QUARTERLY:
+		case YEAR_HALF:
+            student.setMembershipEndTime(DateUtil.addMonths(nowDate, times));
+			break;
+		case YEAR:
+            student.setMembershipEndTime(DateUtil.addYears(nowDate, times));
+			break;
+
+		default:
+			break;
+		}
+        this.update(student);
+	}
+
+	@Override
     public void updateStudentServiceTag(Integer studentId,List<Integer> studentIds,Integer serviceTag) {
         studentDao.updateStudentServiceTag(studentId, studentIds, serviceTag);
     }

+ 1 - 1
mec-student/src/main/java/com/ym/mec/student/config/ResourceServerConfig.java

@@ -24,7 +24,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
     @Override
     public void configure(HttpSecurity http) throws Exception {
         http.csrf().disable().exceptionHandling().accessDeniedHandler(baseAccessDeniedHandler).authenticationEntryPoint(baseAuthenticationEntryPoint).and()
-                .authorizeRequests().antMatchers("/wechat/*","/v2/api-docs", "/code/*", "/register/*", "/studentOrder/*", "/musicGroup/getSubjectGoodsAndInfo",
+                .authorizeRequests().antMatchers("/wechat/*","/v2/api-docs", "/code/*", "/student/registering", "/register/*", "/studentOrder/*", "/musicGroup/getSubjectGoodsAndInfo",
                 "/musicGroup/getMusicGroupStatus", "/musicGroup/getOrderStatus","/sysCouponCode/queryPage",
                 "/musicGroup/pay",
                 "/musicGroup/rePay",