Sfoglia il codice sorgente

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

chengpeng 5 anni fa
parent
commit
90924e26f9

+ 4 - 5
mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/client/SysUserFeignService.java

@@ -1,9 +1,8 @@
 package com.ym.mec.auth.api.client;
 
 import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
 
 import com.ym.mec.auth.api.client.fallback.SysUserFeignServiceFallback;
 import com.ym.mec.auth.api.dto.SysUserInfo;
@@ -19,8 +18,8 @@ public interface SysUserFeignService {
 	@GetMapping(value = "user/queryUserByPhone")
 	public SysUser getUserByMobile(@RequestParam("mobile") String mobile);
 
-	@GetMapping(value = "user/add")
-	public Object addUser(SysUser user);
+	@RequestMapping(value = "user/add",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
+	public Object addUser(@RequestBody SysUser user);
 
 	@GetMapping(value = "task/test")
 	public Object test();

+ 3 - 6
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/UserController.java

@@ -18,10 +18,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.Date;
 
@@ -64,8 +61,8 @@ public class UserController extends BaseController {
 	}
 
 	@ApiOperation(value = "新增用户")
-	@PostMapping(value = "/add",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
-	public Object add(SysUser sysUser) {
+	@RequestMapping(value = "/add",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
+	public Object add(@RequestBody SysUser sysUser) {
 //		sysUser.setPassword(new BCryptPasswordEncoder().encode(sysUser.getPassword()));
 		sysUserService.insert(sysUser);
 		return succeed(sysUser.getId());

+ 7 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMessageServiceImpl.java

@@ -5,14 +5,12 @@ import java.util.Date;
 import java.util.List;
 import java.util.Random;
 
-import com.ym.mec.common.redis.service.RedisCache;
 import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.data.redis.core.ValueOperations;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
@@ -26,9 +24,9 @@ import com.ym.mec.biz.dal.enums.SendStatusEnum;
 import com.ym.mec.biz.dal.enums.SendTypeEnum;
 import com.ym.mec.biz.service.SysMessageConfigService;
 import com.ym.mec.biz.service.SysMessageService;
-import com.ym.mec.common.cache.Cache;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.redis.service.RedisCache;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
@@ -52,7 +50,9 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 	private SysUserFeignService sysUserFeignService;
 
 	@Autowired
-	private RedisTemplate redisTemplate;
+	private RedisTemplate<String,Object> redisTemplate;
+	
+	private RedisCache<String,Object> redisCache = new RedisCache<String, Object>(redisTemplate);
 
 	// 验证码有效期
 	public static final int CODE_EXPIRE = 60 * 5;
@@ -219,7 +219,6 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 	@Override
 	public boolean sendSecurityCode(MessageSender messageSender, Integer userId, SendTypeEnum mode, MessageType messageType, String receiver) {
 		String key1 = getVerificationCode1CacheKey(messageType, receiver);
-		ValueOperations redisCache = redisTemplate.opsForValue();
 		if (redisCache.get(key1) != null) {
 			throw new BizException("请勿频繁操作,获取验证码间隔时间为60秒");
 		}
@@ -230,8 +229,8 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 			code = getRandomCode(messageType, receiver);
 		}
 		sendMessage(messageSender, userId, mode, messageType, receiver, null, 1, "", code);
-		redisCache.set(key, code, CODE_EXPIRE);
-		redisCache.set(key1, code, CODE_INTERVAL_TIME);
+		redisCache.put(key, code, CODE_EXPIRE);
+		redisCache.put(key1, code, CODE_INTERVAL_TIME);
 		return true;
 	}
 
@@ -241,7 +240,6 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 			return DEFAULT_CODE + "";
 		}
 		String key = getVerificationCodeCacheKey(type, mobileNOOrEmailAddr);
-		ValueOperations redisCache = redisTemplate.opsForValue();
 		Object object = redisCache.get(key);
 		return object == null ? null : object.toString();
 	}
@@ -250,7 +248,7 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 	public void delSendedVerificationCode(MessageType type, String mobileNOOrEmailAddr) {
 		String key = getVerificationCodeCacheKey(type, mobileNOOrEmailAddr);
 		if (StringUtils.isNotBlank(key)) {
-			redisTemplate.delete(key);
+			redisCache.delete(key);
 		}
 	}
 

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherServiceImpl.java

@@ -48,7 +48,7 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 	@Transactional(rollbackFor = Exception.class)
 	public void add(Teacher teacher) throws Exception {
 		SysUser user = sysUserFeignService.getUserByMobile(teacher.getPhone());
-		if(user != null){
+		if(user != null && user.getId() != null){
 			throw new Exception("系统已存在该手机号的老师,请核查");
 		}
 		//保存用户表信息

+ 1 - 2
mec-biz/src/main/resources/config/mybatis/SysMessageConfigMapper.xml

@@ -99,8 +99,7 @@
 	</select>
 
 	<select id="queryByType" resultMap="SysMessageConfig">
-		select
-		<include refid="Base_Column_List" />
+		select *
 		from xjd_message_config
 		where message_type_ = #{messageType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 	</select>

+ 1 - 2
mec-biz/src/main/resources/config/mybatis/SysMessageMapper.xml

@@ -46,8 +46,7 @@
 	</sql>
 
     <select id="get" resultMap="message" parameterType="java.lang.Long">
-		select
-		<include refid="Base_Column_List" />
+		select *
 		from sys_message
 		where id_ = #{id,jdbcType=BIGINT}
 	</select>

+ 0 - 5
mec-common/common-core/pom.xml

@@ -43,10 +43,5 @@
 			<groupId>com.ym</groupId>
 			<artifactId>mec-thirdparty</artifactId>
 		</dependency>
-		<dependency>
-			<groupId>org.springframework.security.oauth</groupId>
-			<artifactId>spring-security-oauth2</artifactId>
-			<version>2.2.1.RELEASE</version>
-		</dependency>
 	</dependencies>
 </project>

+ 4 - 0
mec-education/pom.xml

@@ -93,6 +93,10 @@
 		</dependency>
 		<dependency>
 			<groupId>com.ym</groupId>
+			<artifactId>mec-biz</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>com.ym</groupId>
 			<artifactId>common-core</artifactId>
 			<exclusions>
 				<exclusion>

+ 2 - 11
mec-education/src/main/java/com/ym/mec/education/controller/StudentAttendanceController.java

@@ -1,19 +1,10 @@
 package com.ym.mec.education.controller;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ym.mec.education.base.PageResponse;
-import com.ym.mec.education.entity.StudentAttendance;
-import com.ym.mec.education.req.StudentAttendanceReq;
 import com.ym.mec.education.service.IStudentAttendanceService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
-import java.util.Objects;
 
 /**
  * @program: mec
@@ -29,7 +20,7 @@ public class StudentAttendanceController {
     @Autowired
     private IStudentAttendanceService studentAttendanceService;
 
-    @PostMapping("/page")
+    /*@PostMapping("/page")
     public PageResponse page(@RequestBody StudentAttendanceReq studentAttendanceReq) {
         Page<StudentAttendance> page = new Page(studentAttendanceReq.getPageNo(), studentAttendanceReq.getPageSize());
         QueryWrapper<StudentAttendance> queryWrapper = new QueryWrapper<>();
@@ -39,6 +30,6 @@ public class StudentAttendanceController {
                         StudentAttendance::getClassGroupId, studentAttendanceReq.getClassGroupId());
         IPage<StudentAttendance> pageResult = studentAttendanceService.page(page, queryWrapper);
         return PageResponse.success(pageResult);
-    }
+    }*/
 
 }

+ 2 - 2
mec-student/src/main/java/com/ym/mec/student/controller/CourseController.java

@@ -26,7 +26,7 @@ public class CourseController extends BaseController {
     public Object queryCoursePage(){
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if(sysUser == null){
-            return failed("请登录");
+            return failed("获取用户信息失败");
         }
         return succeed(classGroupService.queryCoursePage(sysUser.getId()));
     }
@@ -36,7 +36,7 @@ public class CourseController extends BaseController {
     public Object queryUserGroups(){
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if(sysUser == null){
-            return failed("请登录");
+            return failed("获取用户信息失败");
         }
         return succeed(classGroupService.queryUserGroups(sysUser.getId()));
     }

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

@@ -28,7 +28,7 @@ public class MusicGroupController extends BaseController {
     public Object queryUserMusicGroups(){
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if(sysUser == null){
-            return failed("请重新登录");
+            return failed("获取用户信息失败");
         }
         return succeed(musicGroupService.queryUserMusicGroups(sysUser.getId()));
     }
@@ -38,7 +38,7 @@ public class MusicGroupController extends BaseController {
     public Object queryPersonalMusicGroups(){
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if(sysUser == null){
-            return failed("请重新登录");
+            return failed("获取用户信息失败");
         }
         return succeed(musicGroupService.queryPersonalMusicGroups(sysUser.getId()));
     }
@@ -48,7 +48,7 @@ public class MusicGroupController extends BaseController {
     public Object findTeachersByStuId(){
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if(sysUser == null){
-            return failed("请重新登录");
+            return failed("获取用户信息失败");
         }
         return succeed(musicGroupService.findTeachersByStuId(sysUser.getId()));
     }

+ 1 - 1
mec-student/src/main/java/com/ym/mec/student/controller/RechargeController.java

@@ -39,7 +39,7 @@ public class RechargeController extends BaseController {
     public Object recharge(RechargeDto rechargeDto){
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if(sysUser == null){
-            return failed("请重新登录");
+            return failed("获取用户信息失败");
         }
         SysUserCashAccount userCashAccount = sysUserCashAccountService.get(sysUser.getId());
         if(userCashAccount == null || !userCashAccount.getStatus().equals(1)){

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

@@ -10,13 +10,10 @@ import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 @RequestMapping("register")
-@Api(tags = "乐团服务")
+@Api(tags = "乐团注册")
 @RestController
 public class RegisterController extends BaseController {
 
@@ -30,7 +27,7 @@ public class RegisterController extends BaseController {
     @PostMapping("/add")
     public Object add(StudentRegistration studentRegistration) {
         studentRegistrationService.insert(studentRegistration);
-        return succeed();
+        return succeed(studentRegistration);
     }
 
     @ApiOperation(value = "通过乐团编号获取声部列表")

+ 1 - 5
mec-web/src/main/java/com/ym/mec/web/controller/TeacherController.java

@@ -8,11 +8,7 @@ import io.swagger.annotations.ApiParam;
 import java.util.Date;
 
 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.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import com.ym.mec.biz.dal.entity.Teacher;
 import com.ym.mec.biz.dal.page.TeacherQueryInfo;