Bladeren bron

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

zouxuan 5 jaren geleden
bovenliggende
commit
494b885a53
36 gewijzigde bestanden met toevoegingen van 789 en 251 verwijderingen
  1. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysMessageDao.java
  2. 4 4
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysMessage.java
  3. 12 6
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysMessageConfig.java
  4. 23 21
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/MessageSendMode.java
  5. 0 36
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/SendTypeEnum.java
  6. 65 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/SysMessageQueryInfo.java
  7. 7 7
      mec-biz/src/main/java/com/ym/mec/biz/service/SysMessageService.java
  8. 9 12
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMessageServiceImpl.java
  9. 1 2
      mec-biz/src/main/resources/config/mybatis/SysMessageConfigMapper.xml
  10. 6 6
      mec-biz/src/main/resources/config/mybatis/SysMessageMapper.xml
  11. 6 1
      mec-common/common-core/pom.xml
  12. 0 12
      mec-education/pom.xml
  13. 2 2
      mec-education/src/main/java/com/ym/mec/education/base/PageResponse.java
  14. 40 42
      mec-education/src/main/java/com/ym/mec/education/controller/MusicGroupController.java
  15. 12 12
      mec-education/src/main/java/com/ym/mec/education/enums/ReturnCodeEnum.java
  16. 33 0
      mec-education/src/main/java/com/ym/mec/education/enums/TeachModeEnum.java
  17. 35 0
      mec-education/src/main/java/com/ym/mec/education/enums/TeachTypeEnum.java
  18. 1 1
      mec-education/src/main/java/com/ym/mec/education/mapper/CourseScheduleTeacherSalaryMapper.java
  19. 1 1
      mec-education/src/main/java/com/ym/mec/education/mapper/SysUserMapper.java
  20. 1 1
      mec-education/src/main/java/com/ym/mec/education/mapper/TeacherMapper.java
  21. 22 0
      mec-education/src/main/java/com/ym/mec/education/req/StudentAttendanceReq.java
  22. 62 0
      mec-education/src/main/java/com/ym/mec/education/resp/ClassGroupResp.java
  23. 8 0
      mec-education/src/main/java/com/ym/mec/education/resp/MusicGroupResp.java
  24. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/ICourseScheduleTeacherSalaryService.java
  25. 9 0
      mec-education/src/main/java/com/ym/mec/education/service/IMusicGroupService.java
  26. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/ISysUserService.java
  27. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/ITeacherService.java
  28. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/impl/CourseScheduleTeacherSalaryServiceImpl.java
  29. 179 2
      mec-education/src/main/java/com/ym/mec/education/service/impl/MusicGroupServiceImpl.java
  30. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/impl/SysUserServiceImpl.java
  31. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/impl/TeacherServiceImpl.java
  32. 14 0
      mec-student/src/main/java/com/ym/mec/student/StudentApplication.java
  33. 3 6
      mec-student/src/main/java/com/ym/mec/student/controller/RegisterController.java
  34. 130 0
      mec-student/src/main/java/com/ym/mec/student/controller/SysMessageController.java
  35. 97 0
      mec-util/src/main/java/com/ym/mec/util/validator/CommonValidator.java
  36. 0 70
      mec-web/src/main/java/com/ym/mec/web/controller/SysMessageController.java

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysMessageDao.java

@@ -39,5 +39,5 @@ public interface SysMessageDao extends BaseDAO<Long, SysMessage> {
 	/**
 	 * 修改单个消息状态
 	 */
-	public int updateOneStatus(@Param("id") Integer id, @Param("status") int status);
+	public int updateOneStatus(@Param("id") Long id, @Param("status") int status);
 }

+ 4 - 4
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysMessage.java

@@ -5,7 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 import com.ym.mec.biz.dal.enums.SendStatusEnum;
-import com.ym.mec.biz.dal.enums.SendTypeEnum;
+import com.ym.mec.biz.dal.enums.MessageSendMode;
 
 /**
  * 对应数据库表(sys_message):
@@ -25,7 +25,7 @@ public class SysMessage {
 	
 	/** 消息类型;1,表示短信;2,表示邮件; 3,app推送消息 */
 	@ApiModelProperty(value = "消息类型",required = false)
-	private SendTypeEnum type;
+	private MessageSendMode type;
 	
 	/** 状态,-1,发送失败;0,待发送;1,发送中;2,发送完成 */
 	@ApiModelProperty(value = "状态",required = false)
@@ -141,11 +141,11 @@ public class SysMessage {
 		return this.memo;
 	}
 
-	public SendTypeEnum getType() {
+	public MessageSendMode getType() {
 		return type;
 	}
 
-	public void setType(SendTypeEnum type) {
+	public void setType(MessageSendMode type) {
 		this.type = type;
 	}
 

+ 12 - 6
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysMessageConfig.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.entity;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 import com.ym.mec.common.enums.BaseEnum;
@@ -10,18 +11,23 @@ import com.ym.mec.common.enums.BaseEnum;
 public class SysMessageConfig {
 
 	public enum MessageType implements BaseEnum<String, MessageType> {
-
-		;
-
-		private String code;
+		USER_REGISTER("用户注册");
 
 		private MessageType(String code) {
-			this.code = code;
 		}
 
 		@Override
 		public String getCode() {
-			return code;
+			return name();
+		}
+
+		public static MessageType getMessageType(String name) {
+			for (MessageType type : MessageType.values()) {
+				if (StringUtils.equals(type.name(), name)) {
+					return type;
+				}
+			}
+			return null;
 		}
 
 	}

+ 23 - 21
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/MessageSendMode.java

@@ -1,34 +1,36 @@
 package com.ym.mec.biz.dal.enums;
 
-public enum MessageSendMode {
+import com.ym.mec.common.enums.BaseEnum;
 
-	// 短信
-	SMS(1),
-	// 邮件
-	EMAIL(2),
-	// app推送
-	PUSH(3);
+/**
+ 状态,1,表示短信;2,表示邮件; 3,app推送消息
+ */
+public enum MessageSendMode implements BaseEnum<Integer, MessageSendMode> {
+	SMS(1, "短信"), EMAIL(2, "邮件"), PUSH(3, "app推送消息");
 
-	private int index;
+	private Integer code;
 
-	private MessageSendMode(int index) {
-		this.index = index;
+	private String msg;
+
+	MessageSendMode(Integer code, String msg) {
+		this.code = code;
+		this.msg = msg;
+	}
+
+	public void setCode(Integer code) {
+		this.code = code;
 	}
 
-	public int getIndex() {
-		return index;
+	public String getMsg() {
+		return msg;
 	}
 
-	public void setIndex(int index) {
-		this.index = index;
+	public void setMsg(String msg) {
+		this.msg = msg;
 	}
 
-	public static MessageSendMode getMessageSendMode(int index) {
-		for (MessageSendMode mode : values()) {
-			if (mode.getIndex() == index) {
-				return mode;
-			}
-		}
-		return null;
+	@Override
+	public Integer getCode() {
+		return this.code;
 	}
 }

+ 0 - 36
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/SendTypeEnum.java

@@ -1,36 +0,0 @@
-package com.ym.mec.biz.dal.enums;
-
-import com.ym.mec.common.enums.BaseEnum;
-
-/**
- 状态,1,表示短信;2,表示邮件; 3,app推送消息
- */
-public enum SendTypeEnum implements BaseEnum<Integer, SendTypeEnum> {
-	SMS(1, "短信"), EMAIL(2, "邮件"), PUSH(3, "app推送消息");
-
-	private Integer code;
-
-	private String msg;
-
-	SendTypeEnum(Integer code, String msg) {
-		this.code = code;
-		this.msg = msg;
-	}
-
-	public void setCode(Integer code) {
-		this.code = code;
-	}
-
-	public String getMsg() {
-		return msg;
-	}
-
-	public void setMsg(String msg) {
-		this.msg = msg;
-	}
-
-	@Override
-	public Integer getCode() {
-		return this.code;
-	}
-}

+ 65 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/SysMessageQueryInfo.java

@@ -0,0 +1,65 @@
+package com.ym.mec.biz.dal.page;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import com.ym.mec.common.page.QueryInfo;
+
+public class SysMessageQueryInfo extends QueryInfo {
+
+	/** 状态,0,待发送;1,发送中;2,发送完成 */
+	@ApiModelProperty(value = "状态,0,待发送;1,发送中;2,发送完成 ",required = false)
+	private Integer status;
+
+	@ApiModelProperty(value = "接收人编号",required = false)
+	private String receiver;
+
+	@ApiModelProperty(value = "发送人编号",required = false)
+	private Integer userId;
+
+	@ApiModelProperty(value = "标题",required = false)
+	private String title;
+
+	@ApiModelProperty(value = "消息类型;1,表示短信;2,表示邮件; 3,app推送消息",required = false)
+	private Integer type;
+
+	public Integer getStatus() {
+		return status;
+	}
+
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
+
+	public String getReceiver() {
+		return receiver;
+	}
+
+	public void setReceiver(String receiver) {
+		this.receiver = receiver;
+	}
+
+	public Integer getUserId() {
+		return userId;
+	}
+
+	public void setUserId(Integer userId) {
+		this.userId = userId;
+	}
+
+	public String getTitle() {
+		return title;
+	}
+
+	public void setTitle(String title) {
+		this.title = title;
+	}
+
+	public Integer getType() {
+		return type;
+	}
+
+	public void setType(Integer type) {
+		this.type = type;
+	}
+
+}

+ 7 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/SysMessageService.java

@@ -5,7 +5,7 @@ import java.util.Date;
 import com.ym.mec.biz.dal.entity.SysMessage;
 import com.ym.mec.biz.dal.entity.SysMessageConfig.MessageType;
 import com.ym.mec.biz.dal.enums.SendStatusEnum;
-import com.ym.mec.biz.dal.enums.SendTypeEnum;
+import com.ym.mec.biz.dal.enums.MessageSendMode;
 import com.ym.mec.common.service.BaseService;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
 
@@ -25,7 +25,7 @@ public interface SysMessageService extends BaseService<Long, SysMessage> {
 	 * @param memo 备注
 	 * @return
 	 */
-	public int addMessage(Integer userId, String subject, String content, String receivers, Date triggerTime, SendTypeEnum mode, SendStatusEnum status,
+	public int addMessage(Integer userId, String subject, String content, String receivers, Date triggerTime, MessageSendMode mode, SendStatusEnum status,
 			String errorMsg, Integer readStatus, String memo);
 
 	/**
@@ -45,7 +45,7 @@ public interface SysMessageService extends BaseService<Long, SysMessage> {
 	 * @param triggerTime 触发时间
 	 * @return
 	 */
-	public boolean batchSendMessage(MessageSender messageSender, SendTypeEnum mode, String subject, String content, String receivers, Date triggerTime,
+	public boolean batchSendMessage(MessageSender messageSender, MessageSendMode mode, String subject, String content, String receivers, Date triggerTime,
 			Integer readStatus, String memo);
 
 	/**
@@ -61,7 +61,7 @@ public interface SysMessageService extends BaseService<Long, SysMessage> {
 	 * @param args 参数
 	 * @return
 	 */
-	public void sendMessage(MessageSender messageSender, Integer userId, SendTypeEnum mode, MessageType messageType, String receiver, Date triggerTime,
+	public void sendMessage(MessageSender messageSender, Integer userId, MessageSendMode mode, MessageType messageType, String receiver, Date triggerTime,
 			Integer readStatus, String url, Object... args);
 
 	/**
@@ -77,7 +77,7 @@ public interface SysMessageService extends BaseService<Long, SysMessage> {
 	 * @param url 超链接地址
 	 * @return
 	 */
-	public void sendMessage(MessageSender messageSender, Integer userId, SendTypeEnum mode, String title, String content, String receiver, Date triggerTime,
+	public void sendMessage(MessageSender messageSender, Integer userId, MessageSendMode mode, String title, String content, String receiver, Date triggerTime,
 			Integer readStatus, String url);
 
 	/**
@@ -89,7 +89,7 @@ public interface SysMessageService extends BaseService<Long, SysMessage> {
 	 * @param receiver 消息接受者
 	 * @return
 	 */
-	public boolean sendSecurityCode(MessageSender messageSender, Integer userId, SendTypeEnum mode, MessageType messageType, String receiver);
+	public boolean sendSecurityCode(MessageSender messageSender, Integer userId, MessageSendMode mode, MessageType messageType, String receiver);
 
 	/**
 	 * 获取已经发送的验证码
@@ -124,6 +124,6 @@ public interface SysMessageService extends BaseService<Long, SysMessage> {
 	/**
 	 * 修改单条消息状态
 	 */
-	public int updateOneStatus(Integer id, int status);
+	public int updateOneStatus(Long id, int status);
 
 }

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

@@ -10,7 +10,6 @@ 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.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
@@ -20,8 +19,8 @@ import com.ym.mec.biz.dal.dao.SysMessageDao;
 import com.ym.mec.biz.dal.entity.SysMessage;
 import com.ym.mec.biz.dal.entity.SysMessageConfig;
 import com.ym.mec.biz.dal.entity.SysMessageConfig.MessageType;
+import com.ym.mec.biz.dal.enums.MessageSendMode;
 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.dal.BaseDAO;
@@ -48,11 +47,9 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 
 	@Autowired
 	private SysUserFeignService sysUserFeignService;
-
-	@Autowired
-	private RedisTemplate<String,Object> redisTemplate;
 	
-	private RedisCache<String,Object> redisCache = new RedisCache<String, Object>(redisTemplate);
+	@Autowired
+	private RedisCache<String,Object> redisCache;
 
 	// 验证码有效期
 	public static final int CODE_EXPIRE = 60 * 5;
@@ -71,7 +68,7 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 	}
 
 	@Override
-	public int addMessage(Integer userId, String subject, String content, String receivers, Date triggerTime, SendTypeEnum mode, SendStatusEnum status,
+	public int addMessage(Integer userId, String subject, String content, String receivers, Date triggerTime, MessageSendMode mode, SendStatusEnum status,
 			String errorMsg, Integer readStatus, String memo) {
 		SysMessage message = null;
 		Date date = new Date();
@@ -116,7 +113,7 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 
 	@Override
 	@Async
-	public boolean batchSendMessage(MessageSender messageSender, SendTypeEnum mode, String subject, String content, String receivers, Date triggerTime,
+	public boolean batchSendMessage(MessageSender messageSender, MessageSendMode mode, String subject, String content, String receivers, Date triggerTime,
 			Integer readStatus, String memo) {
 
 		if (StringUtils.isBlank(receivers)) {
@@ -154,7 +151,7 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 
 	@Override
 	@Async
-	public void sendMessage(MessageSender messageSender, Integer userId, SendTypeEnum mode, MessageType type, String receiver, Date triggerTime,
+	public void sendMessage(MessageSender messageSender, Integer userId, MessageSendMode mode, MessageType type, String receiver, Date triggerTime,
 			Integer readStatus, String url, Object... args) {
 
 		if (StringUtils.isBlank(receiver)) {
@@ -190,7 +187,7 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 
 	@Override
 	@Async
-	public void sendMessage(MessageSender messageSender, Integer userId, SendTypeEnum mode, String title, String content, String receiver, Date triggerTime,
+	public void sendMessage(MessageSender messageSender, Integer userId, MessageSendMode mode, String title, String content, String receiver, Date triggerTime,
 			Integer readStatus, String url) {
 		if (StringUtils.isBlank(receiver)) {
 			throw new BizException("接收地址不能为空");
@@ -217,7 +214,7 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 	}
 
 	@Override
-	public boolean sendSecurityCode(MessageSender messageSender, Integer userId, SendTypeEnum mode, MessageType messageType, String receiver) {
+	public boolean sendSecurityCode(MessageSender messageSender, Integer userId, MessageSendMode mode, MessageType messageType, String receiver) {
 		String key1 = getVerificationCode1CacheKey(messageType, receiver);
 		if (redisCache.get(key1) != null) {
 			throw new BizException("请勿频繁操作,获取验证码间隔时间为60秒");
@@ -289,7 +286,7 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 	}
 
 	@Override
-	public int updateOneStatus(Integer id, int status) {
+	public int updateOneStatus(Long id, int status) {
 		return sysMessageDao.updateOneStatus(id, status);
 	}
 }

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

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

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

@@ -66,8 +66,8 @@
 		modify_on_)
 		values (#{id,jdbcType=BIGINT},#{userId,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR},
 		#{content,jdbcType=VARCHAR},
-		#{type,jdbcType=TINYINT},
-		#{status,jdbcType=TINYINT}, #{receiver,jdbcType=VARCHAR},
+		#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+		#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{receiver,jdbcType=VARCHAR},
 		#{sendTime},#{errorMsg,jdbcType=VARCHAR},#{readStatus},#{memo},
 		#{createOn},
 		#{modifyOn})
@@ -85,8 +85,8 @@
 			(
 			#{item.id,jdbcType=BIGINT},#{item.userId,jdbcType=BIGINT}, #{item.title,jdbcType=VARCHAR},
 			#{item.content,jdbcType=VARCHAR},
-			#{item.type,jdbcType=TINYINT},
-			#{item.status,jdbcType=TINYINT}, #{item.receiver,jdbcType=VARCHAR},
+			#{item.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+			#{item.status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{item.receiver,jdbcType=VARCHAR},
 			#{item.sendTime},#{item.errorMsg,jdbcType=VARCHAR},#{item.readStatus},#{item.memo},
 			#{item.createOn},
 			#{item.modifyOn}
@@ -107,10 +107,10 @@
 				content_ = #{content,jdbcType=VARCHAR},
 			</if>
 			<if test="type != null">
-				type_ = #{type,jdbcType=TINYINT},
+				type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 			</if>
 			<if test="status != null">
-				status_ = #{status,jdbcType=TINYINT},
+				status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 			</if>
 			<if test="receiver != null">
 				receiver_ = #{receiver,jdbcType=VARCHAR},

+ 6 - 1
mec-common/common-core/pom.xml

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

+ 0 - 12
mec-education/pom.xml

@@ -88,14 +88,6 @@
             <artifactId>javax.persistence-api</artifactId>
         </dependency>
 		<dependency>
-			<groupId>javax.persistence</groupId>
-			<artifactId>javax.persistence-api</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>com.ym</groupId>
-			<artifactId>mec-biz</artifactId>
-		</dependency>
-		<dependency>
 			<groupId>com.ym</groupId>
 			<artifactId>common-core</artifactId>
 			<exclusions>
@@ -113,10 +105,6 @@
 				<groupId>org.springframework.boot</groupId>
 				<artifactId>spring-boot-maven-plugin</artifactId>
 			</plugin>
-			<plugin>
-				<groupId>com.spotify</groupId>
-				<artifactId>docker-maven-plugin</artifactId>
-			</plugin>
 		</plugins>
 	</build>
 </project>

+ 2 - 2
mec-education/src/main/java/com/ym/mec/education/base/PageResponse.java

@@ -35,8 +35,8 @@ public class PageResponse<T> extends Response implements Serializable {
 
     public static PageResponse success(IPage page) {
         PageResponse pageResponse = new PageResponse(Math.toIntExact(page.getCurrent()), Math.toIntExact(page.getSize()));
-        pageResponse.setReturnCode(ReturnCodeEnum.CODE_1000.getCode());
-        pageResponse.setMessage(ReturnCodeEnum.CODE_1000.getValue());
+        pageResponse.setReturnCode(ReturnCodeEnum.CODE_200.getCode());
+        pageResponse.setMessage(ReturnCodeEnum.CODE_200.getValue());
         pageResponse.setRecords(page.getRecords());
         pageResponse.setTotal(Math.toIntExact(page.getTotal()));
         return pageResponse;

+ 40 - 42
mec-education/src/main/java/com/ym/mec/education/controller/MusicGroupController.java

@@ -9,21 +9,25 @@ import com.ym.mec.education.base.BaseResponse;
 import com.ym.mec.education.base.PageResponse;
 import com.ym.mec.education.entity.ClassGroup;
 import com.ym.mec.education.entity.ClassGroupTeacherMapper;
+import com.ym.mec.education.entity.CourseScheduleTeacherSalary;
 import com.ym.mec.education.entity.MusicGroup;
 import com.ym.mec.education.enums.ReturnCodeEnum;
 import com.ym.mec.education.req.MusicGroupReq;
 import com.ym.mec.education.resp.MusicGroupResp;
 import com.ym.mec.education.service.IClassGroupService;
 import com.ym.mec.education.service.IClassGroupTeacherMapperService;
+import com.ym.mec.education.service.ICourseScheduleTeacherSalaryService;
 import com.ym.mec.education.service.IMusicGroupService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
 
 
 /**
@@ -41,11 +45,7 @@ public class MusicGroupController {
     @Autowired
     private IMusicGroupService musicGroupService;
 
-    @Autowired
-    private IClassGroupService classGroupService;
 
-    @Autowired
-    private IClassGroupTeacherMapperService classGroupTeacherMapperService;
     /**
      * 服务降级处理
      *
@@ -58,45 +58,43 @@ public class MusicGroupController {
         return response;
     }
 
+    /**
+     * 乐团列表
+     * @param req
+     * @return
+     */
     @PostMapping(value = "/groupList")
-    public PageResponse groupList(@RequestBody MusicGroupReq req){
-        PageResponse response = new PageResponse();
-        IPage page = new Page();
-        QueryWrapper<MusicGroup> queryWrapper = new QueryWrapper<>();
-        IPage<MusicGroup> queryPage =  musicGroupService.page(page,queryWrapper);
-        if(queryPage.getRecords() == null && queryPage.getRecords().isEmpty()){
-            response.setReturnCode(ReturnCodeEnum.CODE_1005.getCode());
-            return response;
+    public PageResponse groupList(@RequestBody MusicGroupReq req) {
+
+        return musicGroupService.groupList(req);
+    }
+
+    /**
+     * 乐团详情
+     * @param groupId
+     * @return
+     */
+    @GetMapping(value = "/groupDetail")
+    public BaseResponse groupDetail(@RequestBody Integer groupId) {
+
+        BaseResponse baseResponse = new BaseResponse();
+        if (groupId == null) {
+            baseResponse.setReturnCode(ReturnCodeEnum.CODE_206.getCode());
+            baseResponse.setMessage(ReturnCodeEnum.CODE_206.getValue());
+            return baseResponse;
         }
 
-        List<MusicGroup> musicGroupList  = queryPage.getRecords();
-        List<MusicGroupResp> musicGroupResps = Lists.newArrayList();
-        musicGroupList.forEach(g ->{
-            MusicGroupResp musicGroupResp = new MusicGroupResp();
-            BeanUtils.copyProperties(g,musicGroupResp);
-            QueryWrapper<ClassGroup> queryWrapper1 = new QueryWrapper<>();
-            queryWrapper1.eq("music_group_id_",g.getId());
-            List<ClassGroup> classGroups = classGroupService.list(queryWrapper1);
-            if(!CollectionUtils.isEmpty(classGroups)){
-                int studNum = classGroups.stream().mapToInt(ClassGroup::getStudentNum).sum();
-                musicGroupResp.setStudentNum(studNum);
-            }
-
-            QueryWrapper<ClassGroupTeacherMapper> queryWrapper2 = new QueryWrapper<>();
-            queryWrapper2.eq("music_group_id_",g.getId());
-            List<ClassGroupTeacherMapper> classGroupTeacherMappers = classGroupTeacherMapperService.list(queryWrapper2);
-
-            if(!CollectionUtils.isEmpty(classGroupTeacherMappers)){
-                int teachNum = classGroupTeacherMappers.size();
-                musicGroupResp.setStudentNum(teachNum);
-            }
-            musicGroupResps.add(musicGroupResp);
-        });
-        int count = musicGroupService.count(queryWrapper);
-        response.setRecords(musicGroupResps);
-        response.setReturnCode(ReturnCodeEnum.CODE_1000.getCode());
-        response.setMessage(ReturnCodeEnum.CODE_1000.getValue());
-        response.setTotal(count);
-        return  response;
+        return musicGroupService.groupDetail(groupId);
+
+    }
+    @GetMapping(value = "/classGroupList")
+    public PageResponse classGroupList(@RequestBody Integer groupId){
+
+
+
+
+        return null;
+
     }
+
 }

+ 12 - 12
mec-education/src/main/java/com/ym/mec/education/enums/ReturnCodeEnum.java

@@ -6,18 +6,18 @@ package com.ym.mec.education.enums;
  * @date Date : 2019年09月25日 21:15
  */
 public enum ReturnCodeEnum {
-    CODE_1000(1000, "message.common.success"),
-    CODE_1001(1001, "message.security.unauthorized"),
-    CODE_1002(1002, "message.common.information.nonexistence"),
-    CODE_1003(1003, "message.payment.type.error"),
-    CODE_1004(1004, "message.common.server.error"),
-    CODE_1005(1005, "message.common.failed"),
-    CODE_1006(1006, "message.common.parameters.missing"),
-    CODE_1007(1007, "message.common.timeout"),
-    CODE_1008(1008, "message.common.information.already.exists"),
-    CODE_1009(1009, "message.common.session.expired"),
-    CODE_1010(1010, "message.security.authfailed"),
-    CODE_1011(1011, "message.app.sign.authfailed");
+    CODE_200(200, "操作成功"),
+    CODE_201(201, "message.security.unauthorized"),
+    CODE_202(202, "message.common.information.nonexistence"),
+    CODE_203(203, "message.payment.type.error"),
+    CODE_204(204, "服务异常"),
+    CODE_205(205, "请求失败"),
+    CODE_206(206, "参数不合法"),
+    CODE_207(207, "数据不存在"),
+    CODE_208(208, "message.common.information.already.exists"),
+    CODE_209(209, "message.common.session.expired"),
+    CODE_210(210, "message.security.authfailed"),
+    CODE_211(211, "message.app.sign.authfailed");
 
     private Integer code;
     private String value;

+ 33 - 0
mec-education/src/main/java/com/ym/mec/education/enums/TeachModeEnum.java

@@ -0,0 +1,33 @@
+package com.ym.mec.education.enums;
+
+import com.ym.mec.common.enums.BaseEnum;
+
+public enum TeachModeEnum implements BaseEnum<String, TeachModeEnum> {
+	ONLINE("ONLINE", "线上"), OFFLINE("OFFLINE", "线下");
+
+	private String code;
+
+	private String msg;
+
+	TeachModeEnum(String code, String msg) {
+		this.code = code;
+		this.msg = msg;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public String getMsg() {
+		return msg;
+	}
+
+	public void setMsg(String msg) {
+		this.msg = msg;
+	}
+
+	@Override
+	public String getCode() {
+		return this.code;
+	}
+}

+ 35 - 0
mec-education/src/main/java/com/ym/mec/education/enums/TeachTypeEnum.java

@@ -0,0 +1,35 @@
+package com.ym.mec.education.enums;
+
+import com.ym.mec.common.enums.BaseEnum;
+
+//职务类型(助教、主教)
+public enum TeachTypeEnum implements BaseEnum<String, TeachTypeEnum> {
+    TEACHING("TEACHING","助教"),
+    BISHOP("BISHOP","主教");
+
+    private String code;
+
+    private String msg;
+
+    TeachTypeEnum(String code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    @Override
+    public String getCode() {
+        return this.code;
+    }
+}

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/mapper/CourseScheduleTeacherSalaryMapper.java

@@ -1,7 +1,7 @@
 package com.ym.mec.education.mapper;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ym.mec.education.entity.CourseScheduleTeacherSalary;
-import com.baomidou.mybatisplus.mapper.BaseMapper;
 
 /**
  * <p>

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/mapper/SysUserMapper.java

@@ -1,7 +1,7 @@
 package com.ym.mec.education.mapper;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ym.mec.education.entity.SysUser;
-import com.baomidou.mybatisplus.mapper.BaseMapper;
 
 /**
  * <p>

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/mapper/TeacherMapper.java

@@ -1,7 +1,7 @@
 package com.ym.mec.education.mapper;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ym.mec.education.entity.Teacher;
-import com.baomidou.mybatisplus.mapper.BaseMapper;
 
 /**
  * <p>

+ 22 - 0
mec-education/src/main/java/com/ym/mec/education/req/StudentAttendanceReq.java

@@ -0,0 +1,22 @@
+package com.ym.mec.education.req;
+
+import com.ym.mec.education.base.BaseQuery;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @program: mec
+ * @description: 考勤记录请求参数
+ * @author: xw
+ * @create: 2019-09-25 21:53
+ */
+@Data
+@ApiModel(description = "考勤入参")
+public class StudentAttendanceReq extends BaseQuery {
+
+    @ApiModelProperty(value = "乐团id",required = true)
+    private Integer musicGroupId;
+    @ApiModelProperty(value = "班级id",required = true)
+    private Integer classGroupId;
+}

+ 62 - 0
mec-education/src/main/java/com/ym/mec/education/resp/ClassGroupResp.java

@@ -0,0 +1,62 @@
+package com.ym.mec.education.resp;
+
+import lombok.Data;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author : chengp
+ * @version V1.0
+ * @Description: TODO
+ * @date Date : 2019年09月26日 14:13
+ */
+
+@Data
+@ToString
+public class ClassGroupResp implements Serializable {
+    private Integer id;
+    private Integer musicGroupId;
+    /**
+     * 科目列表(用逗号分隔)
+     */
+    private String subjectIdList;
+    /**
+     * 班级名称
+     */
+    private String name;
+    /**
+     * 预计招生人数
+     */
+    private Integer expectStudentNum;
+    /**
+     * 实际学生数
+     */
+    private Integer studentNum;
+    private Date createTime;
+    private Date updateTime;
+    /**
+     * 班级类型(普通班级、合奏班级、提高课班级、VIP班级、试听课)
+     */
+    private String type;
+    /**
+     * 班级状态()
+     */
+    private String delFlag;
+    /**
+     * 教学形式(线上、线下)
+     */
+    private String teachMode;
+    /**
+     * 总课次
+     */
+    private Integer totalClassTimes;
+    private Integer currentClassTimes;
+
+    private List<String> firstTehNameList;
+
+    private List<String> secdTehNameList;
+
+}

+ 8 - 0
mec-education/src/main/java/com/ym/mec/education/resp/MusicGroupResp.java

@@ -3,6 +3,7 @@ package com.ym.mec.education.resp;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.Date;
 
 /**
@@ -38,10 +39,13 @@ public class MusicGroupResp implements Serializable {
      * 运营主管
      */
     private Integer teamTeacherId;
+    private String teamTeacherName;
     /**
      * 教务老师
      */
     private Integer educationalTeacherId;
+
+    private String eduTeacherName;
     /**
      * 收费类型
      */
@@ -93,4 +97,8 @@ public class MusicGroupResp implements Serializable {
 
     private Integer teacherNum;
 
+    private BigDecimal payments;
+
+    private BigDecimal income;
+
 }

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/service/ICourseScheduleTeacherSalaryService.java

@@ -1,7 +1,7 @@
 package com.ym.mec.education.service;
 
+import com.baomidou.mybatisplus.extension.service.IService;
 import com.ym.mec.education.entity.CourseScheduleTeacherSalary;
-import com.baomidou.mybatisplus.service.IService;
 
 /**
  * <p>

+ 9 - 0
mec-education/src/main/java/com/ym/mec/education/service/IMusicGroupService.java

@@ -1,7 +1,10 @@
 package com.ym.mec.education.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ym.mec.education.base.BaseResponse;
+import com.ym.mec.education.base.PageResponse;
 import com.ym.mec.education.entity.MusicGroup;
+import com.ym.mec.education.req.MusicGroupReq;
 
 /**
  * <p>
@@ -13,4 +16,10 @@ import com.ym.mec.education.entity.MusicGroup;
  */
 public interface IMusicGroupService extends IService<MusicGroup> {
 
+
+    PageResponse groupList(MusicGroupReq req);
+
+    BaseResponse groupDetail(Integer groupId);
+
+    PageResponse classGroupList(Integer groupId);
 }

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/service/ISysUserService.java

@@ -1,7 +1,7 @@
 package com.ym.mec.education.service;
 
+import com.baomidou.mybatisplus.extension.service.IService;
 import com.ym.mec.education.entity.SysUser;
-import com.baomidou.mybatisplus.service.IService;
 
 /**
  * <p>

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/service/ITeacherService.java

@@ -1,7 +1,7 @@
 package com.ym.mec.education.service;
 
+import com.baomidou.mybatisplus.extension.service.IService;
 import com.ym.mec.education.entity.Teacher;
-import com.baomidou.mybatisplus.service.IService;
 
 /**
  * <p>

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/service/impl/CourseScheduleTeacherSalaryServiceImpl.java

@@ -1,9 +1,9 @@
 package com.ym.mec.education.service.impl;
 
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ym.mec.education.entity.CourseScheduleTeacherSalary;
 import com.ym.mec.education.mapper.CourseScheduleTeacherSalaryMapper;
 import com.ym.mec.education.service.ICourseScheduleTeacherSalaryService;
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
 /**

+ 179 - 2
mec-education/src/main/java/com/ym/mec/education/service/impl/MusicGroupServiceImpl.java

@@ -1,10 +1,29 @@
 package com.ym.mec.education.service.impl;
 
+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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ym.mec.education.entity.MusicGroup;
+import com.google.common.collect.Lists;
+import com.ym.mec.education.base.BaseResponse;
+import com.ym.mec.education.base.PageResponse;
+import com.ym.mec.education.entity.*;
+import com.ym.mec.education.enums.ReturnCodeEnum;
+import com.ym.mec.education.enums.TeachTypeEnum;
 import com.ym.mec.education.mapper.MusicGroupMapper;
-import com.ym.mec.education.service.IMusicGroupService;
+import com.ym.mec.education.req.MusicGroupReq;
+import com.ym.mec.education.resp.ClassGroupResp;
+import com.ym.mec.education.resp.MusicGroupResp;
+import com.ym.mec.education.service.*;
+import io.swagger.models.auth.In;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -17,4 +36,162 @@ import org.springframework.stereotype.Service;
 @Service
 public class MusicGroupServiceImpl extends ServiceImpl<MusicGroupMapper, MusicGroup> implements IMusicGroupService {
 
+    @Autowired
+    private IClassGroupService classGroupService;
+
+    @Autowired
+    private IClassGroupTeacherMapperService classGroupTeacherMapperService;
+
+    @Autowired
+    private ICourseScheduleTeacherSalaryService courseScheduleTeacherSalaryService;
+
+    @Autowired
+    private ITeacherService teacherService;
+
+    @Autowired
+    private ISysUserService sysUserService;
+    @Override
+    public PageResponse groupList(MusicGroupReq req) {
+        PageResponse response = new PageResponse();
+        IPage page = new Page();
+        QueryWrapper<MusicGroup> queryWrapper = new QueryWrapper<>();
+        IPage<MusicGroup> queryPage = this.page(page, queryWrapper);
+        if (queryPage.getRecords() == null && queryPage.getRecords().isEmpty()) {
+            response.setReturnCode(ReturnCodeEnum.CODE_206.getCode());
+            return response;
+        }
+
+        List<MusicGroup> musicGroupList = queryPage.getRecords();
+        List<MusicGroupResp> musicGroupResps = Lists.newArrayList();
+        musicGroupList.forEach(g -> {
+            MusicGroupResp musicGroupResp = new MusicGroupResp();
+            BeanUtils.copyProperties(g, musicGroupResp);
+            QueryWrapper<ClassGroup> queryWrapper1 = new QueryWrapper<>();
+            queryWrapper1.eq("music_group_id_", g.getId());
+            List<ClassGroup> classGroups = classGroupService.list(queryWrapper1);
+            if (!CollectionUtils.isEmpty(classGroups)) {
+                int studNum = classGroups.stream().mapToInt(ClassGroup::getStudentNum).sum();
+                musicGroupResp.setStudentNum(studNum);
+            }else{
+                musicGroupResp.setStudentNum(0);
+            }
+
+            QueryWrapper<ClassGroupTeacherMapper> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.eq("music_group_id_", g.getId());
+            List<ClassGroupTeacherMapper> classGroupTeacherMappers = classGroupTeacherMapperService.list(queryWrapper2);
+
+            if (!CollectionUtils.isEmpty(classGroupTeacherMappers)) {
+                int teachNum = classGroupTeacherMappers.size();
+                musicGroupResp.setTeacherNum(teachNum);
+            }else{
+                musicGroupResp.setTeacherNum(0);
+            }
+
+            //老师
+            SysUser  sysUser1 = sysUserService.getById(g.getTeamTeacherId());
+
+            SysUser  sysUser2 = sysUserService.getById(g.getTeamTeacherId());
+            if(sysUser1 != null){
+                musicGroupResp.setTeamTeacherName(sysUser1.getUsername());
+            }
+            if(sysUser2 != null){
+                musicGroupResp.setEduTeacherName(sysUser2.getUsername());
+            }
+            musicGroupResps.add(musicGroupResp);
+        });
+        int count = this.count(queryWrapper);
+        response.setRecords(musicGroupResps);
+        response.setReturnCode(ReturnCodeEnum.CODE_200.getCode());
+        response.setMessage(ReturnCodeEnum.CODE_200.getValue());
+        response.setTotal(count);
+        return response;
+    }
+
+    @Override
+    public BaseResponse groupDetail(Integer groupId) {
+        BaseResponse baseResponse = new BaseResponse();
+
+        MusicGroup musicGroup = this.getById(groupId);
+        if (musicGroup == null) {
+            baseResponse.setReturnCode(ReturnCodeEnum.CODE_207.getCode());
+            baseResponse.setMessage(ReturnCodeEnum.CODE_207.getValue());
+            return baseResponse;
+        }
+        MusicGroupResp musicGroupResp = new MusicGroupResp();
+        BeanUtils.copyProperties(musicGroup, musicGroupResp);
+        QueryWrapper<ClassGroup> queryWrapper1 = new QueryWrapper<>();
+        queryWrapper1.eq("music_group_id_", groupId);
+        List<ClassGroup> classGroups = classGroupService.list(queryWrapper1);
+        if (!CollectionUtils.isEmpty(classGroups)) {
+            int studNum = classGroups.stream().mapToInt(ClassGroup::getStudentNum).sum();
+            musicGroupResp.setStudentNum(studNum);
+        }
+
+        return baseResponse;
+    }
+
+    /**
+     * 班级列表
+     * @param groupId
+     * @return
+     */
+    @Override
+    public PageResponse classGroupList(Integer groupId) {
+
+        PageResponse response = new PageResponse();
+        IPage page = new Page();
+        QueryWrapper<ClassGroup> queryWrapper1 = new QueryWrapper<>();
+        queryWrapper1.eq("music_group_id_", groupId);
+        IPage<ClassGroup> classGroupPage = classGroupService.page(page,queryWrapper1);
+        int count = classGroupService.count(queryWrapper1);
+        if (classGroupPage.getRecords() == null && classGroupPage.getRecords().isEmpty()) {
+            response.setReturnCode(ReturnCodeEnum.CODE_206.getCode());
+            return response;
+        }
+
+        List<ClassGroup> classGroups = classGroupPage.getRecords();
+
+        List<ClassGroupResp> groupRespList = new ArrayList<>();
+        if(!CollectionUtils.isEmpty(classGroups)){
+            classGroups.forEach(e ->{
+
+                ClassGroupResp classGroupResp = new ClassGroupResp();
+                //查询班级老师
+                BeanUtils.copyProperties(e,classGroupResp);
+                QueryWrapper<ClassGroupTeacherMapper> queryWrapper2 = new QueryWrapper<>();
+                queryWrapper2.eq("music_group_id_",e.getId()).eq("teacher_role_", TeachTypeEnum.BISHOP.getCode());
+                List<ClassGroupTeacherMapper> list = classGroupTeacherMapperService.list();
+
+                if(!CollectionUtils.isEmpty(list)){
+                   List<Integer> firstId = list.stream().map(ClassGroupTeacherMapper::getUserId).collect(Collectors.toList());
+                   QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
+                   queryWrapper.in("id_",firstId);
+                   List<SysUser> sysUserList = sysUserService.list(queryWrapper);
+                   if(!CollectionUtils.isEmpty(sysUserList)){
+                       classGroupResp.setFirstTehNameList(sysUserList.stream().map(SysUser::getUsername).collect(Collectors.toList()));
+                   }
+                }
+
+                queryWrapper2.eq("music_group_id_",e.getId()).eq("teacher_role_", TeachTypeEnum.TEACHING.getCode());
+                List<ClassGroupTeacherMapper> list2 = classGroupTeacherMapperService.list();
+                if(!CollectionUtils.isEmpty(list2)){
+                    List<Integer> secdId = list2.stream().map(ClassGroupTeacherMapper::getUserId).collect(Collectors.toList());
+                    QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
+                    queryWrapper.in("id_",secdId);
+                    List<SysUser> sysUserList = sysUserService.list(queryWrapper);
+                    if(!CollectionUtils.isEmpty(sysUserList)){
+                        classGroupResp.setSecdTehNameList(sysUserList.stream().map(SysUser::getUsername).collect(Collectors.toList()));
+                    }
+                }
+                groupRespList.add(classGroupResp);
+
+            });
+        }
+
+        response.setRecords(groupRespList);
+        response.setReturnCode(ReturnCodeEnum.CODE_200.getCode());
+        response.setMessage(ReturnCodeEnum.CODE_200.getValue());
+        response.setTotal(count);
+        return null;
+    }
 }

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/service/impl/SysUserServiceImpl.java

@@ -1,9 +1,9 @@
 package com.ym.mec.education.service.impl;
 
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ym.mec.education.entity.SysUser;
 import com.ym.mec.education.mapper.SysUserMapper;
 import com.ym.mec.education.service.ISysUserService;
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
 /**

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

@@ -1,9 +1,9 @@
 package com.ym.mec.education.service.impl;
 
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ym.mec.education.entity.Teacher;
 import com.ym.mec.education.mapper.TeacherMapper;
 import com.ym.mec.education.service.ITeacherService;
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
 /**

+ 14 - 0
mec-student/src/main/java/com/ym/mec/student/StudentApplication.java

@@ -1,17 +1,21 @@
 package com.ym.mec.student;
 
 import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
 import org.springframework.cloud.client.loadbalancer.LoadBalanced;
 import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.web.client.RestTemplate;
 
 import com.spring4all.swagger.EnableSwagger2Doc;
+import com.ym.mec.common.redis.service.RedisCache;
 
 @SpringBootApplication
 @EnableDiscoveryClient
@@ -21,6 +25,10 @@ import com.spring4all.swagger.EnableSwagger2Doc;
 @Configuration
 @EnableSwagger2Doc
 public class StudentApplication {
+
+	@Autowired
+	private RedisTemplate<String, Object> redisTemplate;
+
 	public static void main(String[] args) {
 		SpringApplication.run(StudentApplication.class, args);
 	}
@@ -30,4 +38,10 @@ public class StudentApplication {
 	public RestTemplate restTemplate() {
 		return new RestTemplate();
 	}
+
+	@Bean
+	@ConditionalOnBean(RedisTemplate.class)
+	public RedisCache<String, Object> redisCache() {
+		return new RedisCache<String, Object>(redisTemplate);
+	}
 }

+ 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 = "通过乐团编号获取声部列表")

+ 130 - 0
mec-student/src/main/java/com/ym/mec/student/controller/SysMessageController.java

@@ -0,0 +1,130 @@
+package com.ym.mec.student.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+import java.io.IOException;
+
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+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 com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.entity.SysMessage;
+import com.ym.mec.biz.dal.entity.SysMessageConfig.MessageType;
+import com.ym.mec.biz.dal.enums.MessageSendMode;
+import com.ym.mec.biz.dal.page.SysMessageQueryInfo;
+import com.ym.mec.biz.service.SysMessageService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
+import com.ym.mec.util.validator.CommonValidator;
+
+@RestController
+@Api(tags = "消息服务")
+@RequestMapping("sysMessage")
+public class SysMessageController extends BaseController {
+
+	@Autowired
+	private SysMessageService sysMessageService;
+
+	@Autowired
+	private SysUserFeignService sysUserFeignService;
+
+	@ApiOperation("获取所有消息列表")
+	@GetMapping(value = "list")
+	public Object list(SysMessageQueryInfo queryInfo) throws IOException {
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if (sysUser == null) {
+			return failed(HttpStatus.FORBIDDEN, "请登录");
+		}
+		queryInfo.setUserId(sysUser.getId());
+		queryInfo.setType(3);
+		PageInfo<SysMessage> pageInfo = sysMessageService.queryPage(queryInfo);
+		return succeed(pageInfo);
+	}
+
+	@ApiOperation("一键已读")
+	@PostMapping("batchSetRead")
+	public Object batchSetRead() {
+		int status = 1;
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if (sysUser == null) {
+			return failed(HttpStatus.FORBIDDEN, "请登录");
+		}
+		return sysMessageService.updateStatus(sysUser.getId(), status) > 0 ? succeed() : failed();
+	}
+
+	@ApiOperation("设置已读")
+	@PostMapping("setRead")
+	public Object setRead(Long id) {
+		int status = 1;
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if (sysUser == null) {
+			return failed(HttpStatus.FORBIDDEN, "请登录");
+		}
+		return sysMessageService.updateOneStatus(id, status) > 0 ? succeed() : failed();
+	}
+
+	@ApiOperation(value = "查询用户未读消息条数")
+	@GetMapping("/queryCountOfUnread")
+	public Object queryCountOfUnread() {
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if (sysUser == null) {
+			return failed("请重新登录");
+		}
+		return succeed(sysMessageService.queryCountOfUnread(sysUser.getId()));
+	}
+
+	@ApiOperation(value = "发送短信验证码")
+	@PostMapping("/sendSmsCode")
+	public Object sendSmsCode(String sendCodeType, String mobileNo) {
+
+		SysUser sysUser;
+
+		if (StringUtils.isBlank(mobileNo)) {
+			sysUser = sysUserFeignService.queryUserInfo();
+		} else {
+			sysUser = sysUserFeignService.getUserByMobile(mobileNo);
+		}
+		if (sysUser == null) {
+			return failed(HttpStatus.FORBIDDEN, "请登录");
+		}
+		Integer userId = sysUser.getId();
+
+		mobileNo = sysUser.getPhone();
+
+		MessageType messageType = MessageType.getMessageType(sendCodeType);
+		if (messageType == null) {
+			throw new BizException("消息类型参数错误");
+		}
+		if (StringUtils.isBlank(mobileNo) || !CommonValidator.isMobileNo(mobileNo)) {
+			throw new BizException("请输入正确的手机号");
+		}
+		sysMessageService.sendSecurityCode(MessageSender.MOXINGTONG, userId, MessageSendMode.SMS, messageType, mobileNo);
+		return succeed();
+	}
+
+	@ApiOperation(value = "发送消息")
+	@PostMapping("/sendMessage")
+	public Object sendMessage(MessageSender messageSender, MessageSendMode sendMode, String content, String receiver, int readStatus, String url) {
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if (sysUser == null) {
+			return failed(HttpStatus.FORBIDDEN, "请登录");
+		}
+		Integer userId = sysUser.getId();
+
+		String mobileNo = sysUser.getPhone();
+		if (StringUtils.isBlank(mobileNo) || !CommonValidator.isMobileNo(mobileNo)) {
+			throw new BizException("请输入正确的手机号");
+		}
+		sysMessageService.sendMessage(messageSender, userId, sendMode, "", content, receiver, null, readStatus, url);
+		return succeed();
+	}
+}

+ 97 - 0
mec-util/src/main/java/com/ym/mec/util/validator/CommonValidator.java

@@ -0,0 +1,97 @@
+package com.ym.mec.util.validator;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * 常用验证类,如邮箱,手机格式验证
+ * @author pengdc
+ */
+public class CommonValidator {
+
+	private final static String MOBILE_NO = "^((13[0-9])|(14[5|7|9])|(15[^4,\\D])|(166)|(18[0-9])|(17[0|1|3|5|6|7|8])|(19[8|9]))\\d{8}$";
+
+	private static final String TELEPHONE_NO = "((\\d{10})|(\\d{11})|^((\\d{7,8})|(\\d{4}|\\d{3})-(\\d{7,8})|(\\d{4}|\\d{3})-(\\d{7,8})-(\\d{4}|\\d{3}"
+			+ "|\\d{2}|\\d{1})|(\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1}))$)";
+
+	private static final String EMAIL_ADDR = "^([a-z0-9A-Z]+[-|_|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
+
+	private static final String PWD_CHECK_REGEX = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$";
+
+	private static Pattern mobileNoPattern = Pattern.compile(MOBILE_NO);
+	private static Pattern telephoneNoPattern = Pattern.compile(TELEPHONE_NO);
+	private static Pattern emailAddrPattern = Pattern.compile(EMAIL_ADDR);
+	private static Pattern pwdCheckPattern = Pattern.compile(PWD_CHECK_REGEX);
+
+	/**
+	 * 是否邮箱地址
+	 * @param emailAddr
+	 * @return
+	 */
+	public static boolean isEmailAddr(String emailAddr) {
+		if (StringUtils.isBlank(emailAddr)) {
+			return false;
+		}
+		Matcher matcher = emailAddrPattern.matcher(emailAddr);
+		return matcher.matches();
+	}
+
+	/**
+	 * 是否手机
+	 * @param mobileNo
+	 * @return boolean
+	 */
+	public static boolean isMobileNo(String mobileNo) {
+		if (StringUtils.isBlank(mobileNo)) {
+			return false;
+		}
+		Matcher matcher = mobileNoPattern.matcher(mobileNo);
+		return matcher.matches();
+	}
+
+	/**
+	 * 是否座机
+	 * @param telephoneNo
+	 * @return boolean
+	 */
+	public static boolean isTelephoneNo(String telephoneNo) {
+		if (StringUtils.isBlank(telephoneNo)) {
+			return false;
+		}
+		Matcher matcher = telephoneNoPattern.matcher(telephoneNo);
+		return matcher.matches();
+	}
+
+	/**
+	 * 是否是座机或手机号码
+	 * @param teleOrMobileNo
+	 * @return boolean
+	 */
+	public static boolean isTelephoneOrMobileNo(String teleOrMobileNo) {
+		if (StringUtils.isBlank(teleOrMobileNo)) {
+			return false;
+		}
+		Matcher matcher1 = telephoneNoPattern.matcher(teleOrMobileNo);
+		if (matcher1.matches()) {
+			return true;
+		}
+		Matcher matcher2 = mobileNoPattern.matcher(teleOrMobileNo);
+		return matcher2.matches();
+	}
+
+	/**
+	 * 是否至少包含数字、字母,长度在6-16位的字符串
+	 * @param telephoneNo
+	 * @return boolean
+	 */
+	public static boolean isComplexityOfPwd(String password) {
+		if (StringUtils.isBlank(password)) {
+			return false;
+		}
+		Matcher matcher = pwdCheckPattern.matcher(password);
+		return matcher.matches();
+	}
+
+}

+ 0 - 70
mec-web/src/main/java/com/ym/mec/web/controller/SysMessageController.java

@@ -1,70 +0,0 @@
-package com.ym.mec.web.controller;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-
-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 com.ym.mec.auth.api.client.SysUserFeignService;
-import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.biz.dal.entity.SysMessage;
-import com.ym.mec.biz.service.SysMessageService;
-import com.ym.mec.common.controller.BaseController;
-import com.ym.mec.common.page.QueryInfo;
-
-@RequestMapping("message")
-@Api(tags = "消息提醒服务")
-@RestController
-public class SysMessageController extends BaseController {
-
-    @Autowired
-    private SysMessageService sysMessageService;
-    @Autowired
-    private SysUserFeignService sysUserFeignService;
-
-    @ApiOperation(value = "新增消息提醒")
-    @PostMapping("/add")
-    public Object add(SysMessage sysMessage) {
-        sysMessageService.insert(sysMessage);
-        return succeed();
-    }
-
-    @ApiOperation(value = "删除消息提醒")
-    @PostMapping("/del/{id}")
-    @ApiParam(value = "消息提醒编号", required = true)
-    public Object del( @PathVariable("id") Long id) {
-        sysMessageService.delete(id);
-        return succeed();
-    }
-
-    @ApiOperation(value = "修改消息提醒")
-    @PostMapping("/update")
-    public Object update(SysMessage sysMessage) {
-//        sysMessage.setUpdateTime(new Date());
-        sysMessageService.update(sysMessage);
-        return succeed();
-    }
-
-    @ApiOperation(value = "获取用户未读消息条数")
-    @GetMapping("/findNewMessageNum")
-    public Object findNewMessageNum(){
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if(sysUser == null){
-            return failed("请重新登录");
-        }
-        return succeed(sysMessageService.queryCountOfUnread(sysUser.getId()));
-    }
-
-    @ApiOperation(value = "分页查询消息提醒列表")
-    @GetMapping("/queryPage")
-    public Object queryPage(QueryInfo queryInfo) {
-        return succeed(sysMessageService.queryPage(queryInfo));
-    }
-
-}