Sfoglia il codice sorgente

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

zouxuan 5 anni fa
parent
commit
b8199a7aa2

+ 1 - 1
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/AuthServerApplication.java

@@ -16,7 +16,7 @@ import com.spring4all.swagger.EnableSwagger2Doc;
 
 @SpringBootApplication
 @EnableDiscoveryClient
-@EnableFeignClients({"com.ym.mec.im"})
+@EnableFeignClients({"com.ym.mec"})
 @MapperScan("com.ym.mec.auth.dal.dao")
 @ComponentScan(basePackages="com.ym.mec")
 @Configuration

+ 15 - 8
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/service/impl/SysUserServiceImpl.java

@@ -1,5 +1,14 @@
 package com.ym.mec.auth.service.impl;
 
+import java.util.Date;
+import java.util.List;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+import org.springframework.stereotype.Service;
+
 import com.ym.mec.auth.api.dto.SysUserInfo;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.enums.SysUserType;
@@ -14,14 +23,7 @@ import com.ym.mec.common.entity.ImUserModel;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.im.ImFeignService;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.security.core.userdetails.UsernameNotFoundException;
-import org.springframework.stereotype.Service;
-
-import java.util.Date;
-import java.util.List;
+import com.ym.mec.user.UserFeignService;
 
 @Service
 public class SysUserServiceImpl extends BaseServiceImpl<Integer, SysUser> implements SysUserService {
@@ -37,6 +39,9 @@ public class SysUserServiceImpl extends BaseServiceImpl<Integer, SysUser> implem
 
 	@Autowired
 	private ImFeignService imFeignService;
+	
+	@Autowired
+	private UserFeignService userFeignService;
 
 	@Value("${message.autoRegister}")
 	private boolean autoRegister;
@@ -166,7 +171,9 @@ public class SysUserServiceImpl extends BaseServiceImpl<Integer, SysUser> implem
 			sysUser.setPhone(phone);
 			sysUser.setUserType(SysUserType.STUDENT);
 			sysUserDao.insert(sysUser);
+            //添加用户现金账户
 			imFeignService.register(new ImUserModel(sysUser.getId().toString(),phone,null));
+			userFeignService.createCashAccount(sysUser.getId());
 			return queryUserInfoByPhone(phone);
 		}
 		throw new UsernameNotFoundException("404.9");

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/VipGroupDao.java

@@ -309,4 +309,12 @@ public interface VipGroupDao extends BaseDAO<Long, VipGroup> {
 	 * @return
 	 */
 	List<VipGroup> queryRequiredOverList();
+
+	/**
+	 * @describe 获取正常状态的vip课
+	 * @author Joburgess
+	 * @date 2019/12/3
+	 * @return java.util.List<com.ym.mec.biz.dal.entity.VipGroup>
+	 */
+	List<VipGroup> queryNormalStatusList();
 }

+ 6 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/VipGroupStatusEnum.java

@@ -8,7 +8,12 @@ import com.ym.mec.common.enums.BaseEnum;
  */
 public enum VipGroupStatusEnum implements BaseEnum<Integer, VipGroupStatusEnum> {
 
-	NOT_START(0, "未开始"), APPLYING(1, "报名中"), PROGRESS(2, "进行中"), FINISHED(4, "已结束"), CANCEL(3, "取消");
+	NOT_START(0, "未开始"),
+	APPLYING(1, "报名中"),
+	APPLYING_END(5,"报名结束"),
+	PROGRESS(2, "进行中"),
+	FINISHED(4, "已结束"),
+	CANCEL(3, "取消");
 
 	private Integer code;
 

+ 11 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -226,8 +226,16 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             }
             ImResult register = imFeignService.register(new ImUserModel(userId.toString(), sysUser.getUsername(), sysUser.getAvatar()));
             sysUser.setImToken(register.getToken());
-            teacherDao.updateUser(sysUser);
         }
+        sysUser.setUserType(SysUserType.STUDENT);
+        sysUser.setOrganId(studentRegistration.getOrganId());
+        sysUser.setRealName(studentRegistration.getParentsName());
+        sysUser.setUsername(studentRegistration.getName());
+        sysUser.setGender(studentRegistration.getGender());
+        sysUser.setCreateTime(date);
+        sysUser.setUpdateTime(date);
+        teacherDao.updateUser(sysUser);
+
         studentRegistration.setActualSubjectId(studentRegistration.getSubjectId());
         studentRegistration.setCreateTime(date);
         studentRegistration.setUpdateTime(date);
@@ -443,9 +451,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     @Transactional(rollbackFor = Exception.class)
     public StudentRegistration queryByUserIdAndMusicGroupId(Integer userId, String musicGroupId) {
         StudentRegistration registration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
-        SysUserCashAccount account = sysUserCashAccountDao.getLocked(userId);
+        /*SysUserCashAccount account = sysUserCashAccountDao.getLocked(userId);
         registration.setBalance(account.getBalance());
-        registration.setTransferStudent(registration.getTemporaryCourseFee() == null ? 0 : 1);
+        registration.setTransferStudent(registration.getTemporaryCourseFee() == null ? 0 : 1);*/
         return registration;
     }
 

+ 26 - 25
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java

@@ -80,10 +80,6 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 
 		TeacherAttendance teacherAttendance=teacherAttendanceDao.findByTeacherAttendanceInfo(user.getId().longValue(),teacherSignOutDto.getTeacherAttendanceInfo().getCourseScheduleId());
 
-		if(StringUtils.isBlank(teacherSignOutDto.getTeacherAttendanceInfo().getSignInLongitudeLatitude())){
-			throw new BizException("未获取到您的位置");
-		}
-
 		Date date = new Date();
 		if(Objects.isNull(teacherAttendance)){
 			teacherAttendance=teacherSignOutDto.getTeacherAttendanceInfo();
@@ -115,27 +111,6 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 			throw new BizException("明天的课程不能进行签到");
 		}
 
-		School school = schoolDao.get(courseSchedule.getSchoolId());
-
-		//是否在范围内
-		boolean isInScore = true;
-		if(StringUtils.isBlank(school.getLongitudeLatitude())){
-			if(teacherSignOutDto.getTeacherAttendanceInfo().getUpdate().equals(YesOrNoEnum.YES.getCode())){
-				school.setLongitudeLatitude(teacherSignOutDto.getTeacherAttendanceInfo().getSignInLongitudeLatitude());
-				schoolDao.update(school);
-			}else{
-				isInScore = false;
-			}
-		}else{
-			SysConfig sysConfig = sysConfigService.findByParamName(SysConfigService.ATTENDANCE_RANGE);
-			double attendanceRange = Double.valueOf(sysConfig.getParanValue());
-			double distance = MapUtil.distance(teacherSignOutDto.getTeacherAttendanceInfo().getSignInLongitudeLatitude(),
-					school.getLongitudeLatitude());
-			if(distance>attendanceRange){
-				isInScore=false;
-			}
-		}
-
 		String classDate = DateUtil.format(courseSchedule.getClassDate(), DateUtil.DEFAULT_PATTERN);
 		String startClassTime = DateUtil.format(courseSchedule.getStartClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
 		String endClassTime = DateUtil.format(courseSchedule.getEndClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
@@ -145,6 +120,32 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 		Date classEndDateAdd60Minutes = DateUtil.addMinutes(classEndDateTime, 60);
 		Date add20Minutes = DateUtil.addMinutes(classStartDateTime, advanceSignMinutes * -1);
 		if(teacherAttendance.getSignInTime() == null && teacherSignOutDto.getTeacherAttendanceInfo().getStatus().equals(SignStatusEnum.SIGN_IN.getCode())){
+
+			if(StringUtils.isBlank(teacherSignOutDto.getTeacherAttendanceInfo().getSignInLongitudeLatitude())){
+				throw new BizException("未获取到您的位置");
+			}
+
+			School school = schoolDao.get(courseSchedule.getSchoolId());
+
+			//是否在范围内
+			boolean isInScore = true;
+			if(StringUtils.isBlank(school.getLongitudeLatitude())){
+				if(teacherSignOutDto.getTeacherAttendanceInfo().getUpdate().equals(YesOrNoEnum.YES.getCode())){
+					school.setLongitudeLatitude(teacherSignOutDto.getTeacherAttendanceInfo().getSignInLongitudeLatitude());
+					schoolDao.update(school);
+				}else{
+					isInScore = false;
+				}
+			}else{
+				SysConfig sysConfig = sysConfigService.findByParamName(SysConfigService.ATTENDANCE_RANGE);
+				double attendanceRange = Double.valueOf(sysConfig.getParanValue());
+				double distance = MapUtil.distance(teacherSignOutDto.getTeacherAttendanceInfo().getSignInLongitudeLatitude(),
+						school.getLongitudeLatitude());
+				if(distance>attendanceRange){
+					isInScore=false;
+				}
+			}
+
 			teacherAttendance.setCurrentClassTimes(courseScheduleDao.countCurrentTimes(teacherAttendance.getClassGroupId(),courseSchedule.getStartClassTime()) + 1);
 			teacherAttendance.setSignInLongitudeLatitude(teacherSignOutDto.getTeacherAttendanceInfo().getSignInLongitudeLatitude());
 			if (currentCourseDetail.getEndClassTime().before(date)){

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -1702,6 +1702,26 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			}
 			vipGroupDao.batchUpdate(vipGroupList);
 		}
+		List<VipGroup> normalVipGroupList = vipGroupDao.queryNormalStatusList();
+		if (!CollectionUtils.isEmpty(normalVipGroupList)){
+            Date now = new Date();
+            for (VipGroup vipGroup : normalVipGroupList) {
+                if(now.before(vipGroup.getRegistrationStartTime())){
+                    vipGroup.setStatus(VipGroupStatusEnum.NOT_START);
+                }
+                if(vipGroup.getRegistrationStartTime().before(now)&&vipGroup.getCoursesExpireDate().after(now)){
+                    vipGroup.setStatus(VipGroupStatusEnum.APPLYING);
+                }
+                if(vipGroup.getCoursesExpireDate().before(now)&&vipGroup.getCourseStartDate().after(now)){
+                    vipGroup.setStatus(VipGroupStatusEnum.APPLYING_END);
+                }
+                if(vipGroup.getCourseStartDate().before(now)&&vipGroup.getCoursesExpireDate().after(now)){
+                    vipGroup.setStatus(VipGroupStatusEnum.PROGRESS);
+                }
+                vipGroup.setUpdateTime(now);
+            }
+            vipGroupDao.batchUpdate(normalVipGroupList);
+        }
 	}
 
 	@Override

+ 3 - 0
mec-biz/src/main/resources/config/mybatis/VipGroupMapper.xml

@@ -869,4 +869,7 @@
     <select id="queryRequiredOverList" resultMap="VipGroup">
     	select vg.* from vip_group vg left join class_group cg on vg.id_ = cg.music_group_id_ where vg.status_ = 2 and cg.total_class_times_ = cg.current_class_times_ and cg.total_class_times_ &gt; 0
     </select>
+    <select id="queryNormalStatusList" resultMap="VipGroup">
+        SELECT * FROM vip_group WHERE status_!=3 AND status_!=4
+    </select>
 </mapper>

+ 1 - 1
mec-client-api/src/main/java/com/ym/mec/task/TaskRemoteService.java

@@ -6,7 +6,7 @@ import org.springframework.web.bind.annotation.GetMapping;
 import com.ym.mec.common.config.FeignConfiguration;
 import com.ym.mec.task.fallback.TaskRemoteServiceFallback;
 
-@FeignClient(name = "web-server", configuration = { FeignConfiguration.class }, fallback = TaskRemoteServiceFallback.class)
+@FeignClient(name = "web-server", contextId = "TaskRemoteService", configuration = { FeignConfiguration.class }, fallback = TaskRemoteServiceFallback.class)
 public interface TaskRemoteService {
 
 	@GetMapping(value = "task/refreshPaymentFeeStatus")

+ 15 - 0
mec-client-api/src/main/java/com/ym/mec/user/UserFeignService.java

@@ -0,0 +1,15 @@
+package com.ym.mec.user;
+
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+
+import com.ym.mec.common.config.FeignConfiguration;
+import com.ym.mec.user.fallback.UserFeignServiceFallback;
+
+@FeignClient(name = "web-server", contextId = "UserFeignService", configuration = FeignConfiguration.class, fallback = UserFeignServiceFallback.class)
+public interface UserFeignService {
+
+	@GetMapping(value = "api/createCashAccount/{userId}")
+	public Boolean createCashAccount(@PathVariable("userId") Integer userId);
+}

+ 13 - 0
mec-client-api/src/main/java/com/ym/mec/user/fallback/UserFeignServiceFallback.java

@@ -0,0 +1,13 @@
+package com.ym.mec.user.fallback;
+
+import org.springframework.stereotype.Component;
+
+import com.ym.mec.user.UserFeignService;
+
+@Component
+public class UserFeignServiceFallback implements UserFeignService {
+
+	@Override
+	public Boolean createCashAccount(Integer userId) {
+		return false;
+	}}

+ 31 - 0
mec-web/src/main/java/com/ym/mec/web/controller/APIController.java

@@ -0,0 +1,31 @@
+package com.ym.mec.web.controller;
+
+import io.swagger.annotations.Api;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
+import com.ym.mec.biz.dal.entity.SysUserCashAccount;
+import com.ym.mec.common.controller.BaseController;
+
+@RequestMapping("api")
+@Api(tags = "对外接口")
+@RestController
+public class APIController extends BaseController {
+
+	@Autowired
+	private SysUserCashAccountDao sysUserCashAccountDao;
+
+	@GetMapping("/createCashAccount/{userId}")
+	public Boolean createCashAccount(@PathVariable("userId") Integer userId) {
+		// 添加用户现金账户
+		sysUserCashAccountDao.insert(new SysUserCashAccount(userId, "CNY"));
+
+		return true;
+	}
+
+}