Browse Source

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	mec-web/src/test/java/com/ym/webApplicationTest.java
Joburgess 5 years ago
parent
commit
b085139595
87 changed files with 2646 additions and 384 deletions
  1. 3 5
      mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/client/SysUserFeignService.java
  2. 14 0
      mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/SysRole.java
  3. 9 1
      mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/SysRoleMenu.java
  4. 6 0
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/service/SysRoleService.java
  5. 23 5
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/service/impl/SysRoleServiceImpl.java
  6. 3 7
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/RoleController.java
  7. 3 6
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/UserController.java
  8. 1 1
      mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysRoleMapper.xml
  9. 8 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupStudentFeeDao.java
  10. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysConfigDao.java
  11. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysMessageDao.java
  12. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseListDto.java
  13. 26 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupStudentFee.java
  14. 86 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysConfig.java
  15. 4 4
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysMessage.java
  16. 12 6
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysMessageConfig.java
  17. 23 21
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/MessageSendMode.java
  18. 0 36
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/SendTypeEnum.java
  19. 65 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/SysMessageQueryInfo.java
  20. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/service/SysConfigService.java
  21. 7 7
      mec-biz/src/main/java/com/ym/mec/biz/service/SysMessageService.java
  22. 12 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java
  23. 23 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysConfigServiceImpl.java
  24. 9 12
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMessageServiceImpl.java
  25. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherServiceImpl.java
  26. 14 2
      mec-biz/src/main/resources/config/mybatis/MusicGroupStudentFeeMapper.xml
  27. 78 0
      mec-biz/src/main/resources/config/mybatis/SysConfigMapper.xml
  28. 1 2
      mec-biz/src/main/resources/config/mybatis/SysMessageConfigMapper.xml
  29. 6 6
      mec-biz/src/main/resources/config/mybatis/SysMessageMapper.xml
  30. 6 1
      mec-common/common-core/pom.xml
  31. 10 4
      mec-common/common-core/src/main/java/com/ym/mec/common/config/RequestHeaderConfiguration.java
  32. 0 8
      mec-education/pom.xml
  33. 10 1
      mec-education/src/main/java/com/ym/mec/education/base/BaseResponse.java
  34. 2 2
      mec-education/src/main/java/com/ym/mec/education/base/PageResponse.java
  35. 43 0
      mec-education/src/main/java/com/ym/mec/education/controller/ClassGroupController.java
  36. 31 54
      mec-education/src/main/java/com/ym/mec/education/controller/MusicGroupController.java
  37. 7 15
      mec-education/src/main/java/com/ym/mec/education/controller/StudentAttendanceController.java
  38. 36 0
      mec-education/src/main/java/com/ym/mec/education/controller/StudentRegistrationController.java
  39. 36 0
      mec-education/src/main/java/com/ym/mec/education/enums/ClassGroupStudentStatusEnum.java
  40. 36 0
      mec-education/src/main/java/com/ym/mec/education/enums/ClassGroupTypeEnum.java
  41. 12 12
      mec-education/src/main/java/com/ym/mec/education/enums/ReturnCodeEnum.java
  42. 40 0
      mec-education/src/main/java/com/ym/mec/education/enums/StudentAttendanceStatusEnum.java
  43. 33 0
      mec-education/src/main/java/com/ym/mec/education/enums/TeachModeEnum.java
  44. 35 0
      mec-education/src/main/java/com/ym/mec/education/enums/TeachTypeEnum.java
  45. 1 1
      mec-education/src/main/java/com/ym/mec/education/mapper/ClassGroupStudentMapperMapper.java
  46. 1 1
      mec-education/src/main/java/com/ym/mec/education/mapper/CourseScheduleMapper.java
  47. 1 1
      mec-education/src/main/java/com/ym/mec/education/mapper/CourseScheduleTeacherSalaryMapper.java
  48. 1 1
      mec-education/src/main/java/com/ym/mec/education/mapper/StudentRegistrationMapper.java
  49. 1 1
      mec-education/src/main/java/com/ym/mec/education/mapper/SysUserMapper.java
  50. 1 1
      mec-education/src/main/java/com/ym/mec/education/mapper/TeacherMapper.java
  51. 21 0
      mec-education/src/main/java/com/ym/mec/education/req/ClassGroupReq.java
  52. 0 1
      mec-education/src/main/java/com/ym/mec/education/req/MusicGroupReq.java
  53. 22 0
      mec-education/src/main/java/com/ym/mec/education/req/StudentAttendanceReq.java
  54. 77 0
      mec-education/src/main/java/com/ym/mec/education/resp/ClassGroupResp.java
  55. 33 2
      mec-education/src/main/java/com/ym/mec/education/resp/MusicGroupResp.java
  56. 37 0
      mec-education/src/main/java/com/ym/mec/education/resp/StudentAttendanceResq.java
  57. 25 0
      mec-education/src/main/java/com/ym/mec/education/resp/StudentRegistrationResp.java
  58. 4 0
      mec-education/src/main/java/com/ym/mec/education/service/IClassGroupService.java
  59. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/IClassGroupStudentMapperService.java
  60. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/ICourseScheduleService.java
  61. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/ICourseScheduleTeacherSalaryService.java
  62. 10 0
      mec-education/src/main/java/com/ym/mec/education/service/IMusicGroupService.java
  63. 4 0
      mec-education/src/main/java/com/ym/mec/education/service/IStudentAttendanceService.java
  64. 4 1
      mec-education/src/main/java/com/ym/mec/education/service/IStudentRegistrationService.java
  65. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/ISysUserService.java
  66. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/ITeacherService.java
  67. 44 0
      mec-education/src/main/java/com/ym/mec/education/service/impl/ClassGroupServiceImpl.java
  68. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/impl/ClassGroupStudentMapperServiceImpl.java
  69. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/impl/CourseScheduleServiceImpl.java
  70. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/impl/CourseScheduleTeacherSalaryServiceImpl.java
  71. 230 2
      mec-education/src/main/java/com/ym/mec/education/service/impl/MusicGroupServiceImpl.java
  72. 63 1
      mec-education/src/main/java/com/ym/mec/education/service/impl/StudentAttendanceServiceImpl.java
  73. 41 1
      mec-education/src/main/java/com/ym/mec/education/service/impl/StudentRegistrationServiceImpl.java
  74. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/impl/SysUserServiceImpl.java
  75. 1 1
      mec-education/src/main/java/com/ym/mec/education/service/impl/TeacherServiceImpl.java
  76. 14 0
      mec-student/src/main/java/com/ym/mec/student/StudentApplication.java
  77. 1 1
      mec-student/src/main/java/com/ym/mec/student/controller/CourseController.java
  78. 3 6
      mec-student/src/main/java/com/ym/mec/student/controller/RegisterController.java
  79. 130 0
      mec-student/src/main/java/com/ym/mec/student/controller/SysMessageController.java
  80. 874 0
      mec-util/src/main/java/com/ym/mec/util/date/DateUtil.java
  81. 97 0
      mec-util/src/main/java/com/ym/mec/util/validator/CommonValidator.java
  82. 14 0
      mec-web/src/main/java/com/ym/mec/web/WebApplication.java
  83. 0 1
      mec-web/src/main/java/com/ym/mec/web/controller/ClassGroupController.java
  84. 77 0
      mec-web/src/main/java/com/ym/mec/web/controller/SysConfigController.java
  85. 0 70
      mec-web/src/main/java/com/ym/mec/web/controller/SysMessageController.java
  86. 1 5
      mec-web/src/main/java/com/ym/mec/web/controller/TeacherController.java
  87. 0 53
      mec-web/src/test/java/com/ym/Test.java

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

@@ -1,10 +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.PostMapping;
-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;
@@ -20,7 +18,7 @@ public interface SysUserFeignService {
 	@GetMapping(value = "user/queryUserByPhone")
 	public SysUser getUserByMobile(@RequestParam("mobile") String mobile);
 
-	@PostMapping(value = "user/add")
+	@PostMapping(value = "user/add", consumes = MediaType.APPLICATION_JSON_VALUE)
 	public Object addUser(SysUser user);
 
 	@GetMapping(value = "task/test")

+ 14 - 0
mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/SysRole.java

@@ -1,8 +1,11 @@
 package com.ym.mec.auth.api.entity;
 
+import com.ym.mec.auth.api.enums.YesOrNoEnum;
 import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
+import java.util.List;
+
 /**
  * 对应数据库表(sys_role):
  */
@@ -35,6 +38,17 @@ public class SysRole {
 	
 	private Integer organId;
 
+	@ApiModelProperty(value = "菜单列表",required = false)
+	private List<Integer> menuIds;
+
+	public List<Integer> getMenuIds() {
+		return menuIds;
+	}
+
+	public void setMenuIds(List<Integer> menuIds) {
+		this.menuIds = menuIds;
+	}
+
 	public Integer getId() {
 		return id;
 	}

+ 9 - 1
mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/SysRoleMenu.java

@@ -15,7 +15,15 @@ public class SysRoleMenu {
 	/** 菜单ID */
 	@ApiModelProperty(value = "菜单ID",required = false)
 	private Integer menuId;
-	
+
+	public SysRoleMenu(Integer roleId, Integer menuId) {
+		this.roleId = roleId;
+		this.menuId = menuId;
+	}
+
+	public SysRoleMenu() {
+	}
+
 	public void setRoleId(Integer roleId){
 		this.roleId = roleId;
 	}

+ 6 - 0
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/service/SysRoleService.java

@@ -20,4 +20,10 @@ public interface SysRoleService extends BaseService<Integer, SysRole> {
      * @return
      */
     SysRole findRoleByCode(String code);
+
+    /**
+     * 添加角色
+     * @param sysRole
+     */
+    void addRole(SysRole sysRole);
 }

+ 23 - 5
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/service/impl/SysRoleServiceImpl.java

@@ -1,21 +1,25 @@
 package com.ym.mec.auth.service.impl;
 
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
 import com.ym.mec.auth.api.entity.SysRole;
+import com.ym.mec.auth.api.entity.SysRoleMenu;
 import com.ym.mec.auth.dal.dao.SysRoleDao;
+import com.ym.mec.auth.dal.dao.SysRoleMenuDao;
 import com.ym.mec.auth.service.SysRoleService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
 
 @Service
 public class SysRoleServiceImpl extends BaseServiceImpl<Integer, SysRole>  implements SysRoleService {
 	
 	@Autowired
 	private SysRoleDao sysRoleDao;
+	@Autowired
+	private SysRoleMenuDao sysRoleMenuDao;
 
 	@Override
 	public BaseDAO<Integer, SysRole> getDAO() {
@@ -32,4 +36,18 @@ public class SysRoleServiceImpl extends BaseServiceImpl<Integer, SysRole>  imple
 		return sysRoleDao.findRoleByCode(code);
 	}
 
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void addRole(SysRole sysRole) {
+		sysRoleDao.insert(sysRole);
+		List<Integer> menuIds = sysRole.getMenuIds();
+		if(menuIds != null && menuIds.size() > 0){
+			SysRoleMenu sysRoleMenu = new SysRoleMenu(sysRole.getId(),null);
+			menuIds.forEach(e->{
+				sysRoleMenu.setMenuId(e);
+				sysRoleMenuDao.insert(sysRoleMenu);
+			});
+		}
+	}
+
 }

+ 3 - 7
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/RoleController.java

@@ -52,13 +52,9 @@ public class RoleController extends BaseController {
     }
 
     @ApiOperation("新增角色")
-    @PostMapping(value = "/add",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
-    public Object addRole(SysRole sysRole) {
-        SysRole roleByCode = sysRoleService.findRoleByCode(sysRole.getRoleCode());
-        if(roleByCode != null){
-            return failed("权限标识已存在");
-        }
-        sysRoleService.insert(sysRole);
+    @PostMapping(value = "/add")
+    public Object addRole(@RequestBody SysRole sysRole) {
+        sysRoleService.addRole(sysRole);
         return succeed();
     }
 

+ 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) {
+	@PostMapping(value = "/add", 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());

+ 1 - 1
mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysRoleMapper.xml

@@ -36,7 +36,7 @@
         </selectKey>
         -->
         INSERT INTO sys_role (id_,role_name_,role_code_,role_desc_,create_time_,update_time_,organ_id_)
-        VALUES(#{id},#{roleName},#{roleCode},#{roleDesc},now(),now(),organId)
+        VALUES(#{id},#{roleName},#{roleCode},#{roleDesc},now(),now(),,#{organId})
     </insert>
 
     <!-- 根据主键查询一条记录 -->

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

@@ -2,8 +2,15 @@ package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
 import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
 
 public interface MusicGroupStudentFeeDao extends BaseDAO<Long, MusicGroupStudentFee> {
 
-	
+
+    /**
+     * 根据乐团编号和学员编号获取乐团费用信息
+     * @param userId
+     * @return
+     */
+    MusicGroupStudentFee findByUser(@Param("userId") Integer userId,@Param("musicGroupId") String musicGroupId);
 }

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysConfigDao.java

@@ -0,0 +1,9 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.biz.dal.entity.SysConfig;
+import com.ym.mec.common.dal.BaseDAO;
+
+public interface SysConfigDao extends BaseDAO<Long, SysConfig> {
+
+	
+}

+ 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);
 }

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseListDto.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.dto;
 
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.util.List;
@@ -33,6 +34,17 @@ public class CourseListDto {
     @ApiModelProperty(value = "单节课时",required = true)
     private Integer singleClassMinutes;
 
+    @ApiModelProperty(value = "0待续费,1已续费",required = true)
+    private Integer renewStatus = 0;
+
+    public Integer getRenewStatus() {
+        return renewStatus;
+    }
+
+    public void setRenewStatus(Integer renewStatus) {
+        this.renewStatus = renewStatus;
+    }
+
     public Integer getSingleClassMinutes() {
         return singleClassMinutes;
     }

+ 26 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupStudentFee.java

@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 import java.math.BigDecimal;
+import java.util.Date;
 
 /**
  * 对应数据库表(music_group_student_fee_):
@@ -24,13 +25,37 @@ public class MusicGroupStudentFee {
 	/** 课程费用 */
 	@ApiModelProperty(value = "课程费用",required = false)
 	private BigDecimal courseFee;
+
+	/** 课程费用 */
+	@ApiModelProperty(value = "下次缴费日期",required = false)
+	private Date nextPaymentDate;
+
+	/** 课程费用 */
+	@ApiModelProperty(value = "最近缴费时间",required = false)
+	private Date latestPaidTime;
 	
 	/**  */
 	private java.util.Date createTime;
 	
 	/**  */
 	private java.util.Date updateTime;
-	
+
+	public Date getNextPaymentDate() {
+		return nextPaymentDate;
+	}
+
+	public void setNextPaymentDate(Date nextPaymentDate) {
+		this.nextPaymentDate = nextPaymentDate;
+	}
+
+	public Date getLatestPaidTime() {
+		return latestPaidTime;
+	}
+
+	public void setLatestPaidTime(Date latestPaidTime) {
+		this.latestPaidTime = latestPaidTime;
+	}
+
 	public void setId(Long id){
 		this.id = id;
 	}

+ 86 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysConfig.java

@@ -0,0 +1,86 @@
+package com.ym.mec.biz.dal.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(sys_config):
+ */
+public class SysConfig {
+
+	/**  */
+	private Long id;
+	
+	/** 参数名称 */
+	@ApiModelProperty(value = "参数名称", required = true)
+	private String paramName;
+	
+	/** 参数值 */
+	@ApiModelProperty(value = "参数值", required = true)
+	private String paranValue;
+	
+	/** 描述 */
+	@ApiModelProperty(value = "描述", required = true)
+	private String description;
+	
+	/** 创建时间 */
+	private java.util.Date createOn;
+	
+	/** 修改时间 */
+	private java.util.Date modifyOn;
+	
+	public void setId(Long id){
+		this.id = id;
+	}
+	
+	public Long getId(){
+		return this.id;
+	}
+			
+	public void setParamName(String paramName){
+		this.paramName = paramName;
+	}
+	
+	public String getParamName(){
+		return this.paramName;
+	}
+			
+	public void setParanValue(String paranValue){
+		this.paranValue = paranValue;
+	}
+	
+	public String getParanValue(){
+		return this.paranValue;
+	}
+			
+	public void setDescription(String description){
+		this.description = description;
+	}
+	
+	public String getDescription(){
+		return this.description;
+	}
+			
+	public void setCreateOn(java.util.Date createOn){
+		this.createOn = createOn;
+	}
+	
+	public java.util.Date getCreateOn(){
+		return this.createOn;
+	}
+			
+	public void setModifyOn(java.util.Date modifyOn){
+		this.modifyOn = modifyOn;
+	}
+	
+	public java.util.Date getModifyOn(){
+		return this.modifyOn;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 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;
+	}
+
+}

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SysConfigService.java

@@ -0,0 +1,8 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.entity.SysConfig;
+import com.ym.mec.common.service.BaseService;
+
+public interface SysConfigService extends BaseService<Long, SysConfig> {
+
+}

+ 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);
 
 }

+ 12 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -2,6 +2,7 @@ package com.ym.mec.biz.service.impl;
 
 import com.ym.mec.biz.dal.dao.ClassGroupDao;
 import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
+import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
 import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
@@ -13,6 +14,7 @@ import com.ym.mec.common.entity.ImGroupModel;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.util.collection.MapUtil;
+import com.ym.mec.util.date.DateUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -46,6 +48,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     private StudentRegistrationService studentRegistrationService;
     @Autowired
     private ClassGroupTeacherSalaryService classGroupTeacherSalaryService;
+    @Autowired
+    private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
 
     @Override
     public BaseDAO<Integer, ClassGroup> getDAO() {
@@ -329,15 +333,21 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         List<CourseListDto> courseListDtos = classGroupDao.queryCoursePage(userId);
         courseListDtos.forEach(e->{
             if("VIP".equals(e.getTeachMode())){
+                //获取vip课的学生名称列表
                 e.setStudentNames(classGroupDao.findVipStuNames(e.getMusicGroupId()));
             }else {
-                List<MusicGroupPaymentCalender> musicGroupPaymentCalenders = musicGroupPaymentCalenderDao.findByMusicGroupId(e.getMusicGroupId());
-
+                //获取学员乐团课的续费状态
+                MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeDao.findByUser(userId,e.getMusicGroupId());
+                if(musicGroupStudentFee != null){
+                    int i = DateUtil.daysBetween(new Date(),musicGroupStudentFee.getNextPaymentDate());
+                    e.setRenewStatus(i < 8?0:1);
+                }
             }
         });
         return classGroupDao.queryCoursePage(userId);
     }
 
+
     @Override
     public List<ImGroupModel> queryUserGroups(Integer userId) {
         return classGroupDao.queryUserGroups(userId);

+ 23 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysConfigServiceImpl.java

@@ -0,0 +1,23 @@
+package com.ym.mec.biz.service.impl;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.ym.mec.biz.dal.dao.SysConfigDao;
+import com.ym.mec.biz.dal.entity.SysConfig;
+import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+
+@Service
+public class SysConfigServiceImpl extends BaseServiceImpl<Long, SysConfig>  implements SysConfigService {
+	
+	@Autowired
+	private SysConfigDao sysConfigDao;
+
+	@Override
+	public BaseDAO<Long, SysConfig> getDAO() {
+		return sysConfigDao;
+	}
+	
+}

+ 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 - 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("系统已存在该手机号的老师,请核查");
 		}
 		//保存用户表信息

+ 14 - 2
mec-biz/src/main/resources/config/mybatis/MusicGroupStudentFeeMapper.xml

@@ -11,6 +11,8 @@
         <result column="music_group_id_" property="musicGroupId"/>
         <result column="user_id_" property="userId"/>
         <result column="course_fee_" property="courseFee"/>
+        <result column="next_payment_date_" property="nextPaymentDate"/>
+        <result column="latest_paid_time_" property="latestPaidTime"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
     </resultMap>
@@ -28,8 +30,8 @@
     <!-- 向数据库增加一条记录 -->
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupStudentFee" useGeneratedKeys="true"
             keyColumn="id" keyProperty="id">
-		INSERT INTO music_group_student_fee_ (id_,music_group_id_,user_id_,course_fee_,create_time_,update_time_)
-		VALUES(#{id},#{musicGroupId},#{userId},#{courseFee},now(),now())
+		INSERT INTO music_group_student_fee_ (id_,music_group_id_,user_id_,course_fee_,create_time_,update_time_,next_payment_date_,latest_paid_time_)
+		VALUES(#{id},#{musicGroupId},#{userId},#{courseFee},now(),now(),#{nextPaymentDate},#{latestPaidTime})
 	</insert>
 
     <!-- 根据主键查询一条记录 -->
@@ -48,6 +50,12 @@
             <if test="musicGroupId != null">
                 music_group_id_ = #{musicGroupId},
             </if>
+            <if test="nextPaymentDate != null">
+                next_payment_date_ = #{nextPaymentDate},
+            </if>
+            <if test="latestPaidTime != null">
+                latest_paid_time_ = #{latestPaidTime},
+            </if>
         </set>
         WHERE id_ = #{id}
     </update>
@@ -67,4 +75,8 @@
     <select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM music_group_student_fee_
 	</select>
+
+    <select id="findByUser" resultMap="MusicGroupStudentFee">
+        SELECT * FROM music_group_student_fee_ WHERE music_group_id_ = #{musicGroupId} AND user_id_ = #{userId}
+    </select>
 </mapper>

+ 78 - 0
mec-biz/src/main/resources/config/mybatis/SysConfigMapper.xml

@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!-- 这个文件是自动生成的。 不要修改此文件。所有改动将在下次重新自动生成时丢失。 -->
+<mapper namespace="com.ym.mec.biz.dal.dao.SysConfigDao">
+
+	<resultMap type="com.ym.mec.biz.dal.entity.SysConfig" id="SysConfig">
+		<result column="id" property="id" />
+		<result column="param_name_" property="paramName" />
+		<result column="paran_value_" property="paranValue" />
+		<result column="description_" property="description" />
+		<result column="create_on_" property="createOn" />
+		<result column="modify_on_" property="modifyOn" />
+	</resultMap>
+
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="SysConfig">
+		SELECT * FROM sys_config WHERE id = #{id}
+	</select>
+
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="SysConfig">
+		SELECT * FROM sys_config ORDER BY
+		id
+	</select>
+
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.SysConfig"
+		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval 
+			AS ID FROM DUAL </selectKey> -->
+		INSERT INTO sys_config
+		(id,param_name_,paran_value_,description_,create_on_,modify_on_)
+		VALUES(#{id},#{paramName},#{paranValue},#{description},#{createOn},#{modifyOn})
+	</insert>
+
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.SysConfig">
+		UPDATE sys_config
+		<set>
+			<if test="modifyOn != null">
+				modify_on_ = #{modifyOn},
+			</if>
+			<if test="paranValue != null">
+				paran_value_ = #{paranValue},
+			</if>
+			<if test="description != null">
+				description_ = #{description},
+			</if>
+			<if test="id != null">
+				id = #{id},
+			</if>
+			<if test="createOn != null">
+				create_on_ = #{createOn},
+			</if>
+			<if test="paramName != null">
+				param_name_ = #{paramName},
+			</if>
+		</set>
+		WHERE id = #{id}
+	</update>
+
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete">
+		DELETE FROM sys_config WHERE id = #{id}
+	</delete>
+
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="SysConfig" parameterType="map">
+		SELECT * FROM sys_config ORDER BY id
+		<include refid="global.limit" />
+	</select>
+
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM
+		sys_config
+	</select>
+</mapper>

+ 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>

+ 10 - 4
mec-common/common-core/src/main/java/com/ym/mec/common/config/RequestHeaderConfiguration.java

@@ -1,9 +1,8 @@
 package com.ym.mec.common.config;
 
-import java.util.Enumeration;
-
 import javax.servlet.http.HttpServletRequest;
 
+import org.apache.commons.lang.StringUtils;
 import org.springframework.web.context.request.RequestContextHolder;
 import org.springframework.web.context.request.ServletRequestAttributes;
 
@@ -19,7 +18,14 @@ public class RequestHeaderConfiguration implements RequestInterceptor {
 			return;
 		}
 		HttpServletRequest request = attributes.getRequest();
-		Enumeration<String> headerNames = request.getHeaderNames();
+		
+		String authorization = request.getHeader("Authorization");
+
+		if (StringUtils.isNotBlank(authorization)) {
+			template.header("Authorization", authorization);
+		}
+		
+		/*Enumeration<String> headerNames = request.getHeaderNames();
 		if (headerNames != null) {
 			while (headerNames.hasMoreElements()) {
 				String name = headerNames.nextElement();
@@ -27,7 +33,7 @@ public class RequestHeaderConfiguration implements RequestInterceptor {
 				template.header(name, values);
 
 			}
-		}
+		}*/
 	}
 
 }

+ 0 - 8
mec-education/pom.xml

@@ -88,10 +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>common-core</artifactId>
 			<exclusions>
@@ -109,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>

+ 10 - 1
mec-education/src/main/java/com/ym/mec/education/base/BaseResponse.java

@@ -1,5 +1,6 @@
 package com.ym.mec.education.base;
 
+import com.ym.mec.education.enums.ReturnCodeEnum;
 import javax.persistence.MappedSuperclass;
 import java.io.Serializable;
 
@@ -28,4 +29,12 @@ public class BaseResponse<T> extends Response implements Serializable {
     public String toString() {
         return "BaseResponse(super=" + super.toString() + ", dataInfo=" + this.getDataInfo() + ")";
     }
-}
+
+    public static BaseResponse success(Object dataInfo) {
+        BaseResponse baseResponse = new BaseResponse<>();
+        baseResponse.setReturnCode(ReturnCodeEnum.CODE_200.getCode());
+        baseResponse.setMessage(ReturnCodeEnum.CODE_200.getValue());
+        baseResponse.setDataInfo(dataInfo);
+        return baseResponse;
+    }
+}

+ 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;

+ 43 - 0
mec-education/src/main/java/com/ym/mec/education/controller/ClassGroupController.java

@@ -0,0 +1,43 @@
+package com.ym.mec.education.controller;
+
+import com.ym.mec.education.base.BaseResponse;
+import com.ym.mec.education.enums.ReturnCodeEnum;
+import com.ym.mec.education.req.ClassGroupReq;
+import com.ym.mec.education.service.IClassGroupService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+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
+ * @description: 班级
+ * @author: xw
+ * @create: 2019-09-26 14:03
+ */
+@RestController
+@RequestMapping("api/ClassGroup")
+@Api(tags = "班级")
+@Slf4j
+public class ClassGroupController {
+
+    @Autowired
+    private IClassGroupService classGroupService;
+
+    @PostMapping("/info")
+    @ApiOperation("班级详情")
+    public BaseResponse getInfo(@RequestBody ClassGroupReq classGroupReq) {
+        if (Objects.nonNull(classGroupReq.getGroupId())) {
+            BaseResponse baseResponse = new BaseResponse();
+            baseResponse.setReturnCode(ReturnCodeEnum.CODE_206.getCode());
+            baseResponse.setMessage(ReturnCodeEnum.CODE_206.getValue());
+            return baseResponse;
+        }
+        return classGroupService.getInfo(classGroupReq);
+    }
+}

+ 31 - 54
mec-education/src/main/java/com/ym/mec/education/controller/MusicGroupController.java

@@ -1,30 +1,16 @@
 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.google.common.collect.Lists;
 import com.netflix.hystrix.contrib.javanica.annotation.DefaultProperties;
 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.MusicGroup;
 import com.ym.mec.education.enums.ReturnCodeEnum;
+import com.ym.mec.education.req.ClassGroupReq;
 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.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.List;
-
 
 /**
  * @author : chengp
@@ -41,11 +27,7 @@ public class MusicGroupController {
     @Autowired
     private IMusicGroupService musicGroupService;
 
-    @Autowired
-    private IClassGroupService classGroupService;
 
-    @Autowired
-    private IClassGroupTeacherMapperService classGroupTeacherMapperService;
     /**
      * 服务降级处理
      *
@@ -58,45 +40,40 @@ 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(@RequestParam("groupId") 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);
-            }
+        return musicGroupService.groupDetail(groupId);
+
+    }
+    @PostMapping(value = "/classGroupList")
+    public PageResponse classGroupList(@RequestBody ClassGroupReq req){
 
-            QueryWrapper<ClassGroupTeacherMapper> queryWrapper2 = new QueryWrapper<>();
-            queryWrapper2.eq("music_group_id_",g.getId());
-            List<ClassGroupTeacherMapper> classGroupTeacherMappers = classGroupTeacherMapperService.list(queryWrapper2);
+        return musicGroupService.classGroupList(req);
 
-            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;
     }
+
 }

+ 7 - 15
mec-education/src/main/java/com/ym/mec/education/controller/StudentAttendanceController.java

@@ -1,19 +1,16 @@
 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 io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 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
@@ -23,22 +20,17 @@ import java.util.Objects;
  */
 @RestController
 @RequestMapping("api/studentAttendance")
+@Api(tags = "学生考勤")
 @Slf4j
 public class StudentAttendanceController {
 
     @Autowired
     private IStudentAttendanceService studentAttendanceService;
 
-    @PostMapping("/page")
-    public PageResponse page(@RequestBody StudentAttendanceReq studentAttendanceReq) {
-        Page<StudentAttendance> page = new Page(studentAttendanceReq.getPageNo(), studentAttendanceReq.getPageSize());
-        QueryWrapper<StudentAttendance> queryWrapper = new QueryWrapper<>();
-        queryWrapper.lambda().eq(Objects.nonNull(studentAttendanceReq.getMusicGroupId()),
-                StudentAttendance::getMusicGroupId, studentAttendanceReq.getMusicGroupId())
-                .eq(Objects.nonNull(studentAttendanceReq.getClassGroupId()),
-                        StudentAttendance::getClassGroupId, studentAttendanceReq.getClassGroupId());
-        IPage<StudentAttendance> pageResult = studentAttendanceService.page(page, queryWrapper);
-        return PageResponse.success(pageResult);
+    @PostMapping("/list")
+    @ApiOperation("点名记录列表")
+    public PageResponse list(@RequestBody StudentAttendanceReq studentAttendanceReq) {
+        return studentAttendanceService.getPage(studentAttendanceReq);
     }
 
 }

+ 36 - 0
mec-education/src/main/java/com/ym/mec/education/controller/StudentRegistrationController.java

@@ -0,0 +1,36 @@
+package com.ym.mec.education.controller;
+
+import com.ym.mec.education.base.PageResponse;
+import com.ym.mec.education.req.ClassGroupReq;
+import com.ym.mec.education.service.IStudentRegistrationService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+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;
+
+/**
+ * @program: mec
+ * @description: 学员名单
+ * @author: xw
+ * @create: 2019-09-26 19:40
+ */
+@RestController
+@RequestMapping("api/studentRegistration")
+@Api(tags = "学员名单")
+@Slf4j
+public class StudentRegistrationController {
+
+    @Autowired
+    private IStudentRegistrationService studentRegistrationService;
+
+    @PostMapping("/list")
+    @ApiOperation("学员名单列表")
+    public PageResponse list(@RequestBody ClassGroupReq classGroupReq) {
+        return studentRegistrationService.getPage(classGroupReq);
+    }
+
+}

+ 36 - 0
mec-education/src/main/java/com/ym/mec/education/enums/ClassGroupStudentStatusEnum.java

@@ -0,0 +1,36 @@
+package com.ym.mec.education.enums;
+
+import com.ym.mec.common.enums.BaseEnum;
+
+/**
+ * 班级类型(普通班级、合奏班级)
+ */
+public enum ClassGroupStudentStatusEnum implements BaseEnum<String, ClassGroupStudentStatusEnum> {
+	NORMAL("NORMAL", "在读"), LEAVE("LEAVE", "请假"), QUIT("QUIT", "退学");
+
+	private String code;
+
+	private String msg;
+
+	ClassGroupStudentStatusEnum(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;
+	}
+}

+ 36 - 0
mec-education/src/main/java/com/ym/mec/education/enums/ClassGroupTypeEnum.java

@@ -0,0 +1,36 @@
+package com.ym.mec.education.enums;
+
+import com.ym.mec.common.enums.BaseEnum;
+
+/**
+ * 班级类型
+ */
+public enum ClassGroupTypeEnum implements BaseEnum<String, ClassGroupTypeEnum> {
+	NORMAL("NORMAL", "普通班级"), MIX("MIX", "合奏班级"), HIGH("HIGH", "提高班"), VIP("VIP", "vip课"), DEMO("demo", "试听课");
+
+	private String code;
+
+	private String msg;
+
+	ClassGroupTypeEnum(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;
+	}
+}

+ 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;

+ 40 - 0
mec-education/src/main/java/com/ym/mec/education/enums/StudentAttendanceStatusEnum.java

@@ -0,0 +1,40 @@
+package com.ym.mec.education.enums;
+
+import com.ym.mec.common.enums.BaseEnum;
+
+/**
+ * 学生考勤状态
+ */
+public enum StudentAttendanceStatusEnum implements BaseEnum<String,StudentAttendanceStatusEnum> {
+    NORMAL("NORMAL","正常"),
+    TRUANT("TRUANT","旷课"),
+    LEAVE("LEAVE","请假"),
+    QUIT_SCHOOL("QUIT_SCHOOL","休学"),
+    DROP_OUT("DROP_OUT","退学");
+
+    private String code;
+
+    private String msg;
+
+    StudentAttendanceStatusEnum(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;
+    }
+}

+ 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/ClassGroupStudentMapperMapper.java

@@ -1,6 +1,6 @@
 package com.ym.mec.education.mapper;
 
-import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ym.mec.education.entity.ClassGroupStudentMapper;
 
 /**

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

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

+ 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/StudentRegistrationMapper.java

@@ -1,7 +1,7 @@
 package com.ym.mec.education.mapper;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ym.mec.education.entity.StudentRegistration;
-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>

+ 21 - 0
mec-education/src/main/java/com/ym/mec/education/req/ClassGroupReq.java

@@ -0,0 +1,21 @@
+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;
+import java.io.Serializable;
+
+/**
+ * @author : chengp
+ * @version V1.0
+ * @Description: TODO
+ * @date Date : 2019年09月26日 15:43
+ */
+@Data
+@ApiModel(description = "班级入参")
+public class ClassGroupReq extends BaseQuery implements Serializable {
+
+    @ApiModelProperty(value = "班级id",required = true)
+    private Integer groupId;
+}

+ 0 - 1
mec-education/src/main/java/com/ym/mec/education/req/MusicGroupReq.java

@@ -2,7 +2,6 @@ package com.ym.mec.education.req;
 
 import com.ym.mec.education.base.BaseQuery;
 import lombok.Data;
-import java.io.Serializable;
 
 /**
  * @version V1.0

+ 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;
+}

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

@@ -0,0 +1,77 @@
+package com.ym.mec.education.resp;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+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
+@ApiModel(description = "班级出参")
+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;
+
+    @ApiModelProperty(value = "授课老师",required = true)
+    private String teacher;
+
+    @ApiModelProperty(value = "授课老师",required = true)
+    private String assistant;
+
+    @ApiModelProperty(value = "课程进度",required = true)
+    private String courseProgress;
+
+    @ApiModelProperty(value = "班级名称",required = true)
+    private String classGroupName;
+
+}

+ 33 - 2
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;
     /**
      * 收费类型
      */
@@ -89,8 +93,35 @@ public class MusicGroupResp implements Serializable {
      */
     private Date parentMeetingTime;
 
-    private Integer studentNum;
+    /**
+     * 学生数
+     */
+    private Integer studentNum = 0 ;
+
+    /**
+     * 老师数量
+     */
+    private Integer teacherNum = 0;
+
+
+    /**
+     * 合排
+     */
+    private Integer mergeClassNum = 0;
+
+    /**
+     * 单技能
+     */
+    private Integer unitClassNum = 0;
 
-    private Integer teacherNum;
+    /**
+     * 在读
+     */
+    private Integer liveStudNum = 0;
+
+    /**
+     * 退学
+     */
+    private Integer delStudNum = 0;
 
 }

+ 37 - 0
mec-education/src/main/java/com/ym/mec/education/resp/StudentAttendanceResq.java

@@ -0,0 +1,37 @@
+package com.ym.mec.education.resp;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @program: mec
+ * @description: 考勤出参
+ * @author: xw
+ * @create: 2019-09-26 15:24
+ */
+@Data
+@ApiModel(description = "考勤出参")
+@Accessors(chain = true)
+public class StudentAttendanceResq implements Serializable {
+
+    @ApiModelProperty(value = "上课日期",required = true)
+    @DateTimeFormat(pattern = "MM月dd日")
+    private Date classDate;
+
+    @ApiModelProperty(value = "上课时间",required = true)
+    private String classTime;
+
+    @ApiModelProperty(value = "班级名称",required = true)
+    private String classGroupName;
+
+    @ApiModelProperty(value = "到课比",required = true)
+    private String attendanceRate;
+
+    @ApiModelProperty(value = "请假人数",required = true)
+    private Integer leaveNum;
+}

+ 25 - 0
mec-education/src/main/java/com/ym/mec/education/resp/StudentRegistrationResp.java

@@ -0,0 +1,25 @@
+package com.ym.mec.education.resp;
+
+import com.ym.mec.education.base.BaseQuery;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * @program: mec
+ * @description: 学员名单出参
+ * @author: xw
+ * @create: 2019-09-26 19:42
+ */
+@Data
+@ApiModel(description = "学员名单出参")
+@Accessors(chain = true)
+public class StudentRegistrationResp extends BaseQuery {
+
+    @ApiModelProperty(value = "学员名称",required = true)
+    private String studentName;
+
+    @ApiModelProperty(value = "学员迟到情况",required = true)
+    private String studentAttendance;
+}

+ 4 - 0
mec-education/src/main/java/com/ym/mec/education/service/IClassGroupService.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.entity.ClassGroup;
+import com.ym.mec.education.req.ClassGroupReq;
+import com.ym.mec.education.resp.ClassGroupResp;
 
 /**
  * <p>
@@ -13,4 +16,5 @@ import com.ym.mec.education.entity.ClassGroup;
  */
 public interface IClassGroupService extends IService<ClassGroup> {
 
+    BaseResponse<ClassGroupResp> getInfo(ClassGroupReq classGroupReq);
 }

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

@@ -1,6 +1,6 @@
 package com.ym.mec.education.service;
 
-import com.baomidou.mybatisplus.service.IService;
+import com.baomidou.mybatisplus.extension.service.IService;
 import com.ym.mec.education.entity.ClassGroupStudentMapper;
 
 /**

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

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

+ 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>

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

@@ -1,7 +1,11 @@
 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.ClassGroupReq;
+import com.ym.mec.education.req.MusicGroupReq;
 
 /**
  * <p>
@@ -13,4 +17,10 @@ import com.ym.mec.education.entity.MusicGroup;
  */
 public interface IMusicGroupService extends IService<MusicGroup> {
 
+
+    PageResponse groupList(MusicGroupReq req);
+
+    BaseResponse groupDetail(Integer groupId);
+
+    PageResponse classGroupList(ClassGroupReq req);
 }

+ 4 - 0
mec-education/src/main/java/com/ym/mec/education/service/IStudentAttendanceService.java

@@ -1,7 +1,9 @@
 package com.ym.mec.education.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ym.mec.education.base.PageResponse;
 import com.ym.mec.education.entity.StudentAttendance;
+import com.ym.mec.education.req.StudentAttendanceReq;
 
 /**
  * <p>
@@ -13,4 +15,6 @@ import com.ym.mec.education.entity.StudentAttendance;
  */
 public interface IStudentAttendanceService extends IService<StudentAttendance> {
 
+    PageResponse getPage(StudentAttendanceReq studentAttendanceReq);
+
 }

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

@@ -1,7 +1,9 @@
 package com.ym.mec.education.service;
 
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ym.mec.education.base.PageResponse;
 import com.ym.mec.education.entity.StudentRegistration;
-import com.baomidou.mybatisplus.service.IService;
+import com.ym.mec.education.req.ClassGroupReq;
 
 /**
  * <p>
@@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.service.IService;
  */
 public interface IStudentRegistrationService extends IService<StudentRegistration> {
 
+     PageResponse getPage(ClassGroupReq classGroupReq);
 }

+ 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>

+ 44 - 0
mec-education/src/main/java/com/ym/mec/education/service/impl/ClassGroupServiceImpl.java

@@ -1,10 +1,23 @@
 package com.ym.mec.education.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ym.mec.education.base.BaseResponse;
 import com.ym.mec.education.entity.ClassGroup;
+import com.ym.mec.education.entity.ClassGroupTeacherMapper;
+import com.ym.mec.education.enums.ReturnCodeEnum;
+import com.ym.mec.education.enums.TeachTypeEnum;
 import com.ym.mec.education.mapper.ClassGroupMapper;
+import com.ym.mec.education.req.ClassGroupReq;
+import com.ym.mec.education.resp.ClassGroupResp;
 import com.ym.mec.education.service.IClassGroupService;
+import com.ym.mec.education.service.IClassGroupTeacherMapperService;
+import com.ym.mec.education.service.ISysUserService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+import java.util.List;
+import java.util.Objects;
 
 /**
  * <p>
@@ -17,4 +30,35 @@ import org.springframework.stereotype.Service;
 @Service
 public class ClassGroupServiceImpl extends ServiceImpl<ClassGroupMapper, ClassGroup> implements IClassGroupService {
 
+    @Autowired
+    private IClassGroupTeacherMapperService classGroupTeacherMapperService;
+    @Autowired
+    private ISysUserService userService;
+
+    @Override
+    public BaseResponse<ClassGroupResp> getInfo(ClassGroupReq classGroupReq) {
+        BaseResponse<ClassGroupResp> baseResponse = new BaseResponse<>();
+        ClassGroup classGroup = getById(classGroupReq.getGroupId());
+        if (Objects.isNull(classGroup)) {
+            baseResponse.setReturnCode(ReturnCodeEnum.CODE_207.getCode());
+            baseResponse.setMessage(ReturnCodeEnum.CODE_207.getValue());
+            return baseResponse;
+        }
+        QueryWrapper<ClassGroupTeacherMapper> teacherMapperQueryWrapper = new QueryWrapper<>();
+        teacherMapperQueryWrapper.lambda().eq(true, ClassGroupTeacherMapper::getClassGroupId, classGroupReq.getGroupId());
+        ClassGroupResp classGroupResp = new ClassGroupResp();
+        List<ClassGroupTeacherMapper> teacherMapperList = classGroupTeacherMapperService.list(teacherMapperQueryWrapper);
+        if (!CollectionUtils.isEmpty(teacherMapperList)) {
+            teacherMapperList.stream().filter(item -> TeachTypeEnum.TEACHING.getCode().equals(item.getTeacherRole())).findFirst().
+                    ifPresent(classGroupTeacherMapper -> classGroupResp.
+                            setTeacher(userService.getById(classGroupTeacherMapper.getUserId()).getUsername()));
+            teacherMapperList.stream().filter(item -> TeachTypeEnum.BISHOP.getCode().equals(item.getTeacherRole())).findFirst().
+                    ifPresent(classGroupTeacherMapper -> classGroupResp.
+                            setAssistant(userService.getById(classGroupTeacherMapper.getUserId()).getUsername()));
+        }
+        classGroupResp.setStudentNum(classGroup.getStudentNum());
+        classGroupResp.setCourseProgress(classGroup.getCurrentClassTimes() + "/" + classGroup.getTotalClassTimes());
+        classGroupResp.setClassGroupName(classGroup.getName());
+        return BaseResponse.success(classGroupResp);
+    }
 }

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

@@ -1,6 +1,6 @@
 package com.ym.mec.education.service.impl;
 
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ym.mec.education.entity.ClassGroupStudentMapper;
 import com.ym.mec.education.mapper.ClassGroupStudentMapperMapper;
 import com.ym.mec.education.service.IClassGroupStudentMapperService;

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/service/impl/CourseScheduleServiceImpl.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.CourseSchedule;
 import com.ym.mec.education.mapper.CourseScheduleMapper;
 import com.ym.mec.education.service.ICourseScheduleService;
-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/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;
 
 /**

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

@@ -1,10 +1,33 @@
 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.ClassGroupStudentStatusEnum;
+import com.ym.mec.education.enums.ClassGroupTypeEnum;
+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.ClassGroupReq;
+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 org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -17,4 +40,209 @@ 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;
+
+    @Autowired
+    private IClassGroupStudentMapperService classGroupStudentMapperService;
+
+
+    @Override
+    public PageResponse groupList(MusicGroupReq req) {
+        PageResponse response = new PageResponse();
+        IPage page = new Page(req.getPageNo()==null? 0: req.getPageNo(),req.getPageSize() == null ? 10:req.getPageSize());
+        QueryWrapper<MusicGroup> queryWrapper = new QueryWrapper<>();
+        if(req != null && !StringUtils.isEmpty(req.getName())){
+            queryWrapper.eq("name_",req.getName());
+        }
+
+        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);
+
+            Long mergeNum = classGroups.stream().filter(e -> ClassGroupTypeEnum.MIX.getCode().equalsIgnoreCase(e.getType())).count();
+
+            Long unitClassNum = classGroups.stream().filter(e -> ClassGroupTypeEnum.NORMAL.getCode().equalsIgnoreCase(e.getType())).count();
+            musicGroupResp.setMergeClassNum(Optional.ofNullable(mergeNum).orElse(0L).intValue());
+            musicGroupResp.setUnitClassNum(Optional.ofNullable(unitClassNum).orElse(0L).intValue());
+
+
+            List<Integer> classId = classGroups.stream().map(e ->e.getId()).collect(Collectors.toList());
+            QueryWrapper<ClassGroupStudentMapper> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.in("class_group_id_", classId);
+
+            List<ClassGroupStudentMapper> classGroupStudentMappers = classGroupStudentMapperService.list(queryWrapper2);
+
+            if(!CollectionUtils.isEmpty(classGroupStudentMappers)){
+
+                Long liveNum = classGroups.stream().filter(e -> ClassGroupStudentStatusEnum.NORMAL.getCode().equalsIgnoreCase(e.getType())).count();
+
+                Long delNum = classGroups.stream().filter(e -> ClassGroupStudentStatusEnum.QUIT.getCode().equalsIgnoreCase(e.getType())).count();
+                musicGroupResp.setLiveStudNum(Optional.ofNullable(liveNum).orElse(0L).intValue());
+                musicGroupResp.setDelStudNum(Optional.ofNullable(delNum).orElse(0L).intValue());
+
+            }
+        }
+        //老师
+        SysUser  sysUser1 = sysUserService.getById(musicGroup.getTeamTeacherId());
+
+        SysUser  sysUser2 = sysUserService.getById(musicGroup.getTeamTeacherId());
+        if(sysUser1 != null){
+            musicGroupResp.setTeamTeacherName(sysUser1.getUsername());
+        }
+        if(sysUser2 != null){
+            musicGroupResp.setEduTeacherName(sysUser2.getUsername());
+        }
+        baseResponse.setDataInfo(musicGroupResp);
+        baseResponse.setReturnCode(ReturnCodeEnum.CODE_200.getCode());
+        baseResponse.setMessage(ReturnCodeEnum.CODE_200.getValue());
+        return baseResponse;
+    }
+
+    /**
+     * 班级列表
+     * @param
+     * @return
+     */
+    @Override
+    public PageResponse classGroupList(ClassGroupReq req) {
+
+        PageResponse response = new PageResponse();
+        IPage page = new Page(req.getPageNo()==null? 0: req.getPageNo(),req.getPageSize() == null ? 10:req.getPageSize());
+        QueryWrapper<ClassGroup> queryWrapper1 = new QueryWrapper<>();
+        if(req != null && req.getGroupId() != null){
+            queryWrapper1.eq("music_group_id_", req.getGroupId());
+        }
+
+        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;
+    }
 }

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

@@ -1,10 +1,26 @@
 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.google.common.collect.Lists;
+import com.ym.mec.education.base.PageResponse;
+import com.ym.mec.education.entity.ClassGroup;
+import com.ym.mec.education.entity.CourseSchedule;
 import com.ym.mec.education.entity.StudentAttendance;
+import com.ym.mec.education.enums.StudentAttendanceStatusEnum;
 import com.ym.mec.education.mapper.StudentAttendanceMapper;
+import com.ym.mec.education.req.StudentAttendanceReq;
+import com.ym.mec.education.resp.StudentAttendanceResq;
+import com.ym.mec.education.service.IClassGroupService;
+import com.ym.mec.education.service.ICourseScheduleService;
 import com.ym.mec.education.service.IStudentAttendanceService;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import java.util.List;
+import java.util.Objects;
 
 /**
  * <p>
@@ -14,7 +30,53 @@ import org.springframework.stereotype.Service;
  * @author lemeng
  * @since 2019-09-25
  */
-@Service
+@Service("iStudentAttendanceService")
 public class StudentAttendanceServiceImpl extends ServiceImpl<StudentAttendanceMapper, StudentAttendance> implements IStudentAttendanceService {
 
+    @Autowired
+    private ICourseScheduleService courseScheduleService;
+    @Autowired
+    private IClassGroupService groupService;
+
+    @Override
+    public PageResponse getPage(StudentAttendanceReq studentAttendanceReq) {
+        Page<StudentAttendance> pageParam = new Page(studentAttendanceReq.getPageNo(), studentAttendanceReq.getPageSize());
+        QueryWrapper<StudentAttendance> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(Objects.nonNull(studentAttendanceReq.getMusicGroupId()),
+                StudentAttendance::getMusicGroupId, studentAttendanceReq.getMusicGroupId())
+                .eq(Objects.nonNull(studentAttendanceReq.getClassGroupId()),
+                        StudentAttendance::getClassGroupId, studentAttendanceReq.getClassGroupId());
+        IPage<StudentAttendance> page = page(pageParam, queryWrapper);
+        IPage<StudentAttendanceResq> pageResult = new Page<>();
+        BeanUtils.copyProperties(page, pageResult);
+        List<StudentAttendanceResq> list = Lists.newArrayList();
+        QueryWrapper<StudentAttendance> leaveWrapper = new QueryWrapper<>();
+        QueryWrapper<StudentAttendance> normalWrapper = new QueryWrapper<>();
+        //总人数
+        Integer totalCount = count();
+        //请假
+        leaveWrapper.lambda().eq(true, StudentAttendance::getMusicGroupId, studentAttendanceReq.getMusicGroupId())
+                .eq(true, StudentAttendance::getClassGroupId, studentAttendanceReq.getClassGroupId())
+                .eq(true, StudentAttendance::getStatus, StudentAttendanceStatusEnum.LEAVE.getCode());
+        Integer leaveCount = count(leaveWrapper);
+        //正常
+        normalWrapper.lambda().eq(true, StudentAttendance::getMusicGroupId, studentAttendanceReq.getMusicGroupId())
+                .eq(true, StudentAttendance::getClassGroupId, studentAttendanceReq.getClassGroupId())
+                .eq(true, StudentAttendance::getStatus, StudentAttendanceStatusEnum.NORMAL.getCode());
+        Integer normalCount = count(normalWrapper);
+        page.getRecords().forEach(item ->{
+            StudentAttendanceResq studentAttendanceResq = new StudentAttendanceResq();
+            QueryWrapper<CourseSchedule> courseScheduleQueryWrapper = new QueryWrapper<>();
+            courseScheduleQueryWrapper.lambda().eq(true, CourseSchedule::getClassGroupId, studentAttendanceReq.getClassGroupId());
+            CourseSchedule courseSchedule = courseScheduleService.getOne(courseScheduleQueryWrapper);
+            ClassGroup classGroup = groupService.getById(studentAttendanceReq.getClassGroupId());
+            studentAttendanceResq.setClassDate(courseSchedule.getClassDate())
+                    .setClassTime(courseSchedule.getStartClassTime() + "-" + courseSchedule.getEndClassTime())
+                    .setClassGroupName(classGroup.getName())
+                    .setLeaveNum(leaveCount).setAttendanceRate(normalCount + "/" + totalCount);
+            list.add(studentAttendanceResq);
+        });
+        pageResult.setRecords(list);
+        return PageResponse.success(pageResult);
+    }
 }

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

@@ -1,11 +1,25 @@
 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.google.common.collect.Lists;
+import com.ym.mec.education.base.PageResponse;
+import com.ym.mec.education.entity.StudentAttendance;
 import com.ym.mec.education.entity.StudentRegistration;
+import com.ym.mec.education.enums.StudentAttendanceStatusEnum;
 import com.ym.mec.education.mapper.StudentRegistrationMapper;
+import com.ym.mec.education.req.ClassGroupReq;
+import com.ym.mec.education.resp.StudentRegistrationResp;
+import com.ym.mec.education.service.IStudentAttendanceService;
 import com.ym.mec.education.service.IStudentRegistrationService;
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * 学生报名表 服务实现类
@@ -17,4 +31,30 @@ import org.springframework.stereotype.Service;
 @Service
 public class StudentRegistrationServiceImpl extends ServiceImpl<StudentRegistrationMapper, StudentRegistration> implements IStudentRegistrationService {
 
+    @Autowired
+    private IStudentAttendanceService studentAttendanceService;
+
+    @Override
+    public PageResponse getPage(ClassGroupReq classGroupReq) {
+        Page<StudentRegistration> studentRegistrationPage = new Page<>(classGroupReq.getPageNo(), classGroupReq.getPageSize());
+        QueryWrapper<StudentRegistration> studentRegistrationQueryWrapper = new QueryWrapper<>();
+        studentRegistrationQueryWrapper.lambda().eq(true, StudentRegistration::getClassGroupId, classGroupReq.getGroupId());
+        IPage<StudentRegistration> page = page(studentRegistrationPage, studentRegistrationQueryWrapper);
+        Page<StudentRegistrationResp> studentRegistrationRespPage = new Page<>();
+        BeanUtils.copyProperties(page, studentRegistrationRespPage);
+        List<StudentRegistrationResp> list = Lists.newArrayList();
+        page.getRecords().forEach(item -> {
+            QueryWrapper<StudentAttendance> queryWrapper = new QueryWrapper<>();
+            //请假 旷课正常上课次数
+            queryWrapper.lambda().eq(true, StudentAttendance::getUserId, item.getUserId())
+                    .in(true, StudentAttendance::getStatus, StudentAttendanceStatusEnum.TRUANT.getCode(),
+                            StudentAttendanceStatusEnum.LEAVE.getCode());
+            int count = studentAttendanceService.count(queryWrapper);
+            StudentRegistrationResp studentRegistrationResp = new StudentRegistrationResp()
+                    .setStudentName(item.getName()).setStudentAttendance("连续缺到" + count + "次");
+            list.add(studentRegistrationResp);
+        });
+        studentRegistrationRespPage.setRecords(list);
+        return PageResponse.success(studentRegistrationRespPage);
+    }
 }

+ 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);
+	}
 }

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

@@ -31,7 +31,7 @@ public class CourseController extends BaseController {
         return succeed(classGroupService.queryCoursePage(sysUser.getId()));
     }
 
-    @ApiOperation("获取学员所有群组")
+    @ApiOperation("获取学员所有聊天群组")
     @GetMapping(value = "/queryUserGroups")
     public Object queryUserGroups(){
         SysUser sysUser = sysUserFeignService.queryUserInfo();

+ 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();
+	}
+}

+ 874 - 0
mec-util/src/main/java/com/ym/mec/util/date/DateUtil.java

@@ -0,0 +1,874 @@
+package com.ym.mec.util.date;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Locale;
+import java.util.TimeZone;
+
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * 与日期、时间操作有关的工具类。
+ * <p>
+ * <strong>注意:某些方法会将输入时间转换成格林威治时间,时区默认为东八区。可以通过方法 <code>DateUtil#setTimeZone</code>改变默认时区。 </strong>
+ * </p>
+ */
+public class DateUtil {
+
+	public static final String DEFAULT_PATTERN = "yyyy-MM-dd";
+
+	/**
+	 * 默认使用的Locale。默认Locale为 US
+	 */
+	public static final Locale DEFAULT_LOCALE = Locale.US;
+	// ~ 静态属性及初始化 /////////////////////////////////////////////
+
+	/** 默认的时区,一般是使用东八区。即比标准的格林威治时间快8个小时。 */
+	public static TimeZone TIME_ZONE = TimeZone.getDefault();
+
+	/**
+	 * ISO8601基本日期格式 yyyyMMdd ,如:20021225 代表2002年12月25日。
+	 */
+	public static final String ISO_DATE_FORMAT = "yyyyMMdd";
+
+	/**
+	 * ISO8601扩展日期格式 yyyy-MM-dd ,如:2002-12-25 代表2002年12月25日。
+	 */
+	public static final String ISO_EXPANDED_DATE_FORMAT = "yyyy-MM-dd";
+
+	/**
+	 * ISO8601基本时间格式 HHmmssSSSzzz ,如:143212333-0500 代表西5区,14点32分12秒333毫秒 24小时制
+	 */
+	public static final String ISO_TIME_FORMAT = "HHmmssSSSzzz";
+
+	/**
+	 * ISO8601基本时间格式 HH:mm:ss,SSSzzz ,如:14:32:12,333-0500 代表西5区,14点32分12秒333毫秒 24小时制
+	 */
+	public static final String ISO_EXPANDED_TIME_FORMAT = "HH:mm:ss,SSSzzz";
+
+	/**
+	 * ISO8601基本日期格式 yyyyMMddTHHmmssSSSzzz ,如:20021225T143212333-0500 代表西5区 2002年12月25日 14点32分12秒333毫秒
+	 */
+	public static final String ISO_DATE_TIME_FORMAT = "yyyyMMdd'T'HHmmssSSSzzz";
+
+	/**
+	 * ISO8601基本日期格式 yyyy-MM-ddTHH:mm:ss,SSSzzz ,如:2002-12-25T14:32:12,333-0500 代表西5区 2002年12月25日 14点32分12秒333毫秒
+	 */
+	public static final String ISO_EXPANDED_DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss,SSSzzz";
+
+	/**
+	 * 基本时间格式 HHmmss ,如:143212 代表14点32分12秒 24小时制
+	 */
+	public static final String TIME_FORMAT = "HHmmss";
+
+	/**
+	 * 基本时间格式 HH:mm:ss ,如:14:32:12 代表14点32分12秒 24小时制
+	 */
+	public static final String EXPANDED_TIME_FORMAT = "HH:mm:ss";
+
+	/**
+	 * 日期格式 yyyyMMdd HHmmss ,如:20021225 143212 代表 2002年12月25日 14点32分12秒
+	 */
+	public static final String DATE_TIME_FORMAT = "yyyyMMdd HHmmss";
+
+	/**
+	 * 日期格式 yyyy-MM-dd HH:mm:ss ,如:2002-12-25 14:32:12 代表 2002年12月25日 14点32分12秒
+	 */
+	public static final String EXPANDED_DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
+
+	/**
+	 * 西方国家的日期格式 MMM dd, yyyy ,如:February 3, 1982 代表1982年2月3日
+	 */
+	public static final String ENGLISH_DATE = "MMM dd, yyyy";
+
+	/**
+	 * 西方国家的时间格式 MMM dd, yyyy H:mm:ss.SSS ,如:February 3, 1982 12:12:12.005 代表1982年2月3日 12点12分12秒5毫秒
+	 */
+	public static final String ENGLISH_DATE_TIME = "MMM dd, yyyy H:mm:ss.SSS";
+
+	/**
+	 * 美国日期格式 yyyy.MM.dd G 'at' HH:mm:ss z ,如:2001.07.04 AD at 12:08:56 PDT 代表2001年7月4日 12点8分56秒
+	 */
+	public static final String US_DATE_TIME_1 = "yyyy.MM.dd G 'at' HH:mm:ss z";
+
+	/**
+	 * 美国日期格式 yyyyy.MMMMM.dd GGG hh:mm aaa ,如:02001.July.04 AD 12:08 PM 代表2001年7月4日 12点8分
+	 */
+	public static final String US_DATE_TIME_2 = "yyyyy.MMMMM.dd GGG hh:mm aaa";
+
+	/**
+	 * 美国日期格式 EEE, d MMM yyyy HH:mm:ss Z ,如:Wed, 4 Jul 2001 12:08:56 -0700 代表2001年7月4日 12点8分56秒 星期三
+	 */
+	public static final String US_DATE_TIME_3 = "EEE, d MMM yyyy HH:mm:ss Z";
+
+	// 第1年1月1日 (格里高利历)
+	public static final int JAN_1_1_JULIAN_DAY = 1721426;
+
+	// 1970年1月1日 (格里高利历)
+	public static final int EPOCH_JULIAN_DAY = 2440588;
+
+	public static final int EPOCH_YEAR = 1970;
+
+	// 一周、一天、一小时、一分钟、一秒,换算成毫秒的全局变量。
+	public static final int ONE_SECOND = 1000;
+
+	public static final int ONE_MINUTE = 60 * ONE_SECOND;
+
+	public static final int ONE_HOUR = 60 * ONE_MINUTE;
+
+	public static final long ONE_DAY = 24 * ONE_HOUR;
+
+	public static final long ONE_WEEK = 7 * ONE_DAY;
+
+	// ~ 方法 ////////////////////////////////////////////////////////////////
+
+	/**
+	 * 设置系统默认的<code>java.util.TimeZone</code>
+	 * 
+	 * @param timeZone <code>java.util.TimeZone</code>
+	 */
+	public static void setTimeZone(TimeZone timeZone) {
+		TIME_ZONE = timeZone;
+	}
+
+	public static Date toDateTime(String isoDateString) {
+		return stringToDate(isoDateString, EXPANDED_DATE_TIME_FORMAT);
+	}
+
+	public static Date toDate(String isoDateString) {
+		return stringToDate(isoDateString, ISO_EXPANDED_DATE_FORMAT);
+	}
+
+	public static Date stringToDate(String isoDateString) {
+		return stringToDate(isoDateString, EXPANDED_DATE_TIME_FORMAT);
+	}
+
+	public static Date stringToDate(String isoDateString, String pattern) {
+		if (StringUtils.isBlank(pattern)) {
+			return null;
+			// throw new IllegalArgumentException("匹配模式不能为空!");
+		}
+
+		return stringToDate(isoDateString, new SimpleDateFormat(pattern));
+	}
+
+	public static Date stringToDate(String isoDateString, SimpleDateFormat simpleDateFormat) {
+		if (StringUtils.isBlank(isoDateString)) {
+			// throw new IllegalArgumentException("日期字符串不能为空!");
+			return null;
+		}
+		try {
+			return simpleDateFormat.parse(isoDateString);
+		} catch (ParseException e) {
+			// throw new RuntimeException(e);
+		}
+		return null;
+	}
+
+	public static String getDateTime(Date date) {
+		return format(date, EXPANDED_DATE_TIME_FORMAT);
+	}
+
+	public static String getDate(Date date) {
+		return format(date, ISO_EXPANDED_DATE_FORMAT);
+	}
+
+	public static String getDATEFORMAT(Date date) {
+		return format(date, ISO_DATE_FORMAT);
+	}
+
+	public static String format(Date date, String pattern) {
+		return format(date, new SimpleDateFormat(pattern));
+	}
+
+	/**
+	 * 将<code>java.util.Date</code>按照给定的模式转换成日期字符串。
+	 * 
+	 * @param date <code>java.util.Date</code>
+	 * @param formatter 给定的模式
+	 * @return 转换后的日期字符串
+	 */
+	public static String getDate(Date date, SimpleDateFormat formatter) {
+		if (date == null || formatter == null) {
+			return null;
+			// throw new RuntimeException("日期和模式不能为空!");
+		}
+		formatter.setTimeZone(TIME_ZONE);
+		return formatter.format(date);
+	}
+
+	/**
+	 * 将<code>java.util.Date</code>按照给定的模式转换成日期字符串。
+	 * 
+	 * @param date <code>java.util.Date</code>
+	 * @param formatter 给定的模式
+	 * @return 转换后的日期字符串
+	 */
+	public static String format(Date date, SimpleDateFormat formatter) {
+		return getDate(date, formatter);
+	}
+
+	// 获取年份
+	public static String getYear(Date date) {
+		return format(date, ISO_EXPANDED_DATE_FORMAT).split("-")[0];
+	}
+
+	// 获取月份
+	public static String getMonth(Date date) {
+		return format(date, ISO_EXPANDED_DATE_FORMAT).split("-")[1];
+	}
+
+	// 获取日期
+	public static String getDay(Date date) {
+		return format(date, ISO_EXPANDED_DATE_FORMAT).split("-")[2];
+	}
+
+	// 获取时分秒
+	public static String getTime(Date date) {
+		return format(date, EXPANDED_DATE_TIME_FORMAT).split(" ")[1];
+	}
+
+	/**
+	 * 确定给定的年份是否为闰年。
+	 * 
+	 * <pre>
+	 * </pre>
+	 * 
+	 * @param date <code>java.util.Date</code>
+	 * @return True 如果是闰年
+	 */
+	public static boolean isLeapYear(Date date) {
+		if (date == null) {
+			throw new RuntimeException("输入日期不能为空!");
+		}
+		GregorianCalendar cal = new GregorianCalendar();
+		cal.setTime(date);
+
+		return cal.isLeapYear(cal.get(Calendar.YEAR));
+	}
+
+	public static int getHour(Date date) {
+		if (date == null) {
+			return -1;
+		}
+
+		Calendar calendar = Calendar.getInstance();
+		calendar.setTime(date);
+		return calendar.get(Calendar.HOUR_OF_DAY);
+	}
+
+	public static int geMinute(Date date) {
+		if (date == null) {
+			return -1;
+		}
+
+		Calendar calendar = Calendar.getInstance();
+		calendar.setTime(date);
+		return calendar.get(Calendar.MINUTE);
+	}
+
+	/**
+	 * 根据日历的规则,为给定的日历字段添加或减去指定的时间量。
+	 * 
+	 * @param date <code>java.util.Date</code>
+	 * @param field 给定的日历字段
+	 * @param amount 数量
+	 * @return 运算后的 <code>java.util.Date</code>
+	 */
+	public static Date add(Date date, int field, int amount) {
+		if (date == null) {
+			throw new RuntimeException("日期不能为空!");
+		}
+		Calendar cal = GregorianCalendar.getInstance(TIME_ZONE);
+		cal.setTime(date);
+		cal.add(field, amount);
+
+		return cal.getTime();
+	}
+
+	/**
+	 * 增加或减少指定数量的年份。
+	 * 
+	 * @param date <code>java.util.Date</code>
+	 * @param amount 数量
+	 * @return 运算后的 <code>java.util.Date</code>
+	 */
+	public static Date addYears(Date date, int amount) {
+		return add(date, Calendar.YEAR, amount);
+	}
+
+	/**
+	 * 增加或减少指定数量的月份。
+	 * 
+	 * @param date <code>java.util.Date</code>
+	 * @param amount 数量
+	 * @return 运算后的 <code>java.util.Date</code>
+	 */
+	public static Date addMonths(Date date, int amount) {
+		return add(date, Calendar.MONTH, amount);
+	}
+
+	/**
+	 * 修改周,时间按周的量增加或减少。
+	 * 
+	 * @param date <code>java.util.Date</code>
+	 * @param amount 数量
+	 * @return 运算后的 <code>java.util.Date</code>
+	 */
+	public static Date addWeeks(Date date, int amount) {
+		return add(date, Calendar.WEEK_OF_YEAR, amount);
+	}
+
+	/**
+	 * 增加或减少指定数量的日数。
+	 * 
+	 * @param date <code>java.util.Date</code>
+	 * @param amount 数量
+	 * @return 运算后的 <code>java.util.Date</code>
+	 */
+	public static Date addDays(Date date, int amount) {
+		return add(date, Calendar.DAY_OF_MONTH, amount);
+	}
+
+	/**
+	 * 增加或减少指定数量的小时数。
+	 * 
+	 * @param date <code>java.util.Date</code>
+	 * @param amount 数量
+	 * @return 运算后的 <code>java.util.Date</code>
+	 */
+	public static Date addHours(Date date, int amount) {
+		return add(date, Calendar.HOUR_OF_DAY, amount);
+	}
+
+	/**
+	 * 增加或减少指定数量的分钟数。
+	 * 
+	 * @param date <code>java.util.Date</code>
+	 * @param amount 数量
+	 * @return 运算后的 <code>java.util.Date</code>
+	 */
+	public static Date addMinutes(Date date, int amount) {
+		return add(date, Calendar.MINUTE, amount);
+	}
+
+	/**
+	 * 增加或减少指定数量的秒钟数。
+	 * 
+	 * @param date <code>java.util.Date</code>
+	 * @param amount 数量
+	 * @return 运算后的 <code>java.util.Date</code>
+	 */
+	public static Date addSeconds(Date date, int amount) {
+		return add(date, Calendar.SECOND, amount);
+	}
+
+	/**
+	 * 增加或减少指定数量的毫秒数。
+	 * 
+	 * @param date <code>java.util.Date</code>
+	 * @param amount 数量
+	 * @return 运算后的 <code>java.util.Date</code>
+	 */
+	public static Date addMilliseconds(Date date, int amount) {
+		return add(date, Calendar.MILLISECOND, amount);
+	}
+
+	/**
+	 * 在给定的日历字段上添加或减去(上/下)单个时间单元,不更改更大的字段。
+	 * 
+	 * @param date <code>java.util.Date</code>
+	 * @param field 给定的日历字段
+	 * @param up 添加或减去(上/下)
+	 * @return 运算后的 <code>java.util.Date</code>
+	 */
+	public static Date roll(Date date, int field, boolean up) {
+		Calendar cal = GregorianCalendar.getInstance(TIME_ZONE);
+		cal.setTime(date);
+		cal.roll(field, up);
+
+		return cal.getTime();
+	}
+
+	/**
+	 * 向指定日历字段添加指定(有符号的)时间量,不更改更大的字段。
+	 * 
+	 * @param date <code>java.util.Date</code>
+	 * @param field 给定的日历字段
+	 * @param amount 数量
+	 * @return 运算后的 <code>java.util.Date</code>
+	 */
+	public static Date roll(Date date, int field, int amount) {
+		Calendar cal = GregorianCalendar.getInstance(TIME_ZONE);
+		cal.setTime(date);
+		cal.roll(field, amount);
+
+		return cal.getTime();
+	}
+
+	/**
+	 * 将毫秒时间戳转换成格里高利历的日数。日数是只从格里高利历第1年1月1日算起的日数。
+	 * 
+	 * @param millis 给定的毫秒时间戳
+	 * @return 格里高利历的日数
+	 */
+	public static int millisToJulianDay(long millis) {
+		return EPOCH_JULIAN_DAY - JAN_1_1_JULIAN_DAY + (int) (millis / ONE_DAY);
+	}
+
+	/**
+	 * 将<code>java.util.Date</code>转换成格里高利历的日数。 日数是只从格里高利历第1年1月1日算起的日数。
+	 * 
+	 * @param date <code>java.util.Date</code>
+	 * @return 格里高利历的日数
+	 */
+	public static int dateToJulianDay(Date date) {
+		return millisToJulianDay(date.getTime());
+	}
+
+	/**
+	 * 计算两个日期之间相差的秒钟数。如果第一个日期在第二个日期之前,则返回正,反之返回负。
+	 * 
+	 * @param early 第一个日期
+	 * @param late 第二个日期
+	 * @return 两个日期之间相差的秒钟数
+	 */
+	public static int secondsBetween(Date early, Date late) {
+		return (int) ((late.getTime() / ONE_SECOND) - (early.getTime() / ONE_SECOND));
+	}
+
+	/**
+	 * 计算两个日期之间相差的分钟数。如果第一个日期在第二个日期之前,则返回正,反之返回负。
+	 * 
+	 * @param early 第一个日期
+	 * @param late 第二个日期
+	 * @return 两个日期之间相差的分钟数
+	 */
+	public static int minutesBetween(Date early, Date late) {
+		Calendar c1 = Calendar.getInstance();
+		Calendar c2 = Calendar.getInstance();
+		c1.setTime(early);
+		c2.setTime(late);
+
+		return (int) ((late.getTime() / ONE_MINUTE) - (early.getTime() / ONE_MINUTE));
+	}
+
+	/**
+	 * 计算两个日期之间相差的小时数。如果第一个日期在第二个日期之前,则返回正,反之返回负。
+	 * 
+	 * @param early 第一个日期
+	 * @param late 第二个日期
+	 * @return 两个日期之间相差的小时数
+	 */
+	public static int hoursBetween(Date early, Date late) {
+		return (int) ((late.getTime() / ONE_HOUR) - (early.getTime() / ONE_HOUR));
+	}
+
+	/**
+	 * 计算两个日期之间相差的天数。如果第一个日期在第二个日期之前,则返回正,反之返回负。
+	 * 
+	 * @param early 第一个日期
+	 * @param late 第二个日期
+	 * @return 两个日期之间相差的天数
+	 */
+	public static int daysBetween(Date early, Date late) {
+		Calendar c1 = Calendar.getInstance();
+		Calendar c2 = Calendar.getInstance();
+		c1.setTime(early);
+		c2.setTime(late);
+		return dateToJulianDay(c2.getTime()) - dateToJulianDay(c1.getTime());
+	}
+
+	/**
+	 * 计算两个日期之间相差的月数。如果第一个日期在第二个日期之前,则返回正,反之返回负。
+	 * 
+	 * @param early 第一个日期
+	 * @param late 第二个日期
+	 * @return 两个日期之间相差的月数
+	 */
+	public static int monthsBetween(Date early, Date late) {
+		Calendar c1 = Calendar.getInstance();
+		Calendar c2 = Calendar.getInstance();
+		c1.setTime(early);
+		c2.setTime(late);
+		return ((c2.get(Calendar.YEAR) * 12) + c2.get(Calendar.MONTH)) - ((c1.get(Calendar.YEAR) * 12) + c1.get(Calendar.MONTH));
+	}
+
+	/**
+	 * 计算两个日期之间相差的年数。如果第一个日期在第二个日期之前,则返回正,反之返回负。
+	 * 
+	 * @param early 第一个日期
+	 * @param late 第二个日期
+	 * @return 两个日期之间相差的年数
+	 */
+	public static int yearsBetween(Date early, Date late) {
+		Calendar c1 = Calendar.getInstance();
+		Calendar c2 = Calendar.getInstance();
+		c1.setTime(early);
+		c2.setTime(late);
+		return c2.get(Calendar.YEAR) - c1.get(Calendar.YEAR);
+	}
+
+	/**
+	 * 将格里高利历日数转换成 <code>java.sql.Date</code>
+	 * 
+	 * @param julian 格里高利历日数
+	 * @return <code>java.sql.Date</code>
+	 */
+	public static java.sql.Date julianDayToSqlDate(long julian) {
+		return new java.sql.Date(julianDayToMillis(julian));
+	}
+
+	/**
+	 * 将格里高利历日数转换成 <code>java.util.Date</code>
+	 * 
+	 * @param julian 格里高利历日数
+	 * @return <code>java.util.Date</code>
+	 */
+	public static Date julianDayToDate(long julian) {
+		return new Date(julianDayToMillis(julian));
+	}
+
+	/**
+	 * 将格里高利历日数转换成毫秒时间戳。
+	 * 
+	 * @param julian 格里高利历日数
+	 * @return 毫秒时间戳
+	 */
+	public static long julianDayToMillis(long julian) {
+		return (julian - EPOCH_JULIAN_DAY + JAN_1_1_JULIAN_DAY) * ONE_DAY;
+	}
+
+	/**
+	 * 将日历转换成儒略历日期。算法参见: <a href="http://quasar.as.utexas.edu/BillInfo/JulianDatesG.html">Julian Day Calculations
+	 * (Gregorian Calendar)</a>, 由 Bill Jeffrys 提供。
+	 * 
+	 * @param c 日历实例
+	 * @return 儒略历日期
+	 */
+	public static float toJulian(Calendar c) {
+		int Y = c.get(Calendar.YEAR);
+		int M = c.get(Calendar.MONTH);
+		int D = c.get(Calendar.DATE);
+		int A = Y / 100;
+		int B = A / 4;
+		int C = 2 - A + B;
+		float E = (int) (365.25f * (Y + 4716));
+		float F = (int) (30.6001f * (M + 1));
+		float JD = (C + D + E + F) - 1524.5f;
+
+		return JD;
+	}
+
+	/**
+	 * 将日期转换成儒略历日期。算法参见: <a href="http://quasar.as.utexas.edu/BillInfo/JulianDatesG.html">Julian Day Calculations
+	 * (Gregorian Calendar)</a>, 由 Bill Jeffrys 提供。
+	 * 
+	 * @param date 日期
+	 * @return 儒略历日期
+	 */
+	public static float toJulian(Date date) {
+		Calendar c = Calendar.getInstance();
+		c.setTime(date);
+
+		return toJulian(c);
+	}
+
+	protected static float normalizedJulian(float JD) {
+		float f = Math.round(JD + 0.5f) - 0.5f;
+
+		return f;
+	}
+
+	/**
+	 * 给定此 <code>java.util.Date</code> 的时间值,返回指定日历字段可能拥有的最大值。
+	 * 
+	 * @param date <code>java.util.Date</code>
+	 * @param field 日历字段
+	 * @return 对于此 <code>java.util.Date</code> 的时间值而言,给定日历字段的最大值
+	 */
+	public static Date getActualMaximum(Date date, int field) {
+		Calendar c = Calendar.getInstance();
+		c.setTime(date);
+		c.set(field, c.getActualMaximum(field));
+
+		return c.getTime();
+	}
+
+	/**
+	 * 给定此 <code>java.util.Date</code> 的时间值,返回指定日历字段可能拥有的最小值。
+	 * 
+	 * @param date <code>java.util.Date</code>
+	 * @param field 日历字段
+	 * @return 对于此 <code>java.util.Date</code> 的时间值而言,给定日历字段的最小值
+	 */
+	public static Date getActualMinimum(Date date, int field) {
+		Calendar c = Calendar.getInstance();
+		c.setTime(date);
+		c.set(field, c.getActualMinimum(field));
+
+		return c.getTime();
+	}
+
+	/**
+	 * 截取日期,只保留年、月、日部分。
+	 * 
+	 * @param date <code>java.util.Date</code>
+	 * @return 截取后的<code>java.util.Date</code>
+	 */
+	public static Date trunc(Date date) {
+		if (date != null) {
+			Calendar c1 = Calendar.getInstance();
+			c1.setTime(date);
+			Calendar c2 = (Calendar) c1.clone();
+			c1.clear();
+			c1.set(Calendar.YEAR, c2.get(Calendar.YEAR));
+			c1.set(Calendar.MONTH, c2.get(Calendar.MONTH));
+			c1.set(Calendar.DAY_OF_MONTH, c2.get(Calendar.DAY_OF_MONTH));
+			return c1.getTime();
+		}
+		return null;
+	}
+
+	/**
+	 * 返回当天的最后一秒
+	 * 
+	 * @param date <code>java.util.Date</code>
+	 * @return 截取后的<code>java.util.Date</code>
+	 */
+	public static Date dayEnd(Date date) {
+		Calendar c1 = Calendar.getInstance();
+		c1.setTime(date);
+		Calendar c2 = (Calendar) c1.clone();
+		c1.clear();
+		c1.set(Calendar.YEAR, c2.get(Calendar.YEAR));
+		c1.set(Calendar.MONTH, c2.get(Calendar.MONTH));
+		c1.set(Calendar.DAY_OF_MONTH, c2.get(Calendar.DAY_OF_MONTH));
+		// 23:59:59
+		c1.set(Calendar.HOUR_OF_DAY, 23);
+		c1.set(Calendar.MINUTE, 59);
+		c1.set(Calendar.SECOND, 59);
+		return c1.getTime();
+	}
+
+	/**
+	 * 判断两个日期是否是同一天,精确到天。
+	 * 
+	 * @param date1 <code>java.util.Date</code>
+	 * @param date2 <code>java.util.Date</code>
+	 * @return true 如果两个日期是同一天
+	 */
+	public static boolean isSameDay(Date date1, Date date2) {
+		if (date1 == null || date2 == null) {
+			throw new RuntimeException("日期不能为空!");
+		}
+		Calendar cal1 = Calendar.getInstance();
+		cal1.setTime(date1);
+		Calendar cal2 = Calendar.getInstance();
+		cal2.setTime(date2);
+		return isSameDay(cal1, cal2);
+	}
+
+	/**
+	 * 判断两个日期是否是同一天,精确到天。
+	 * 
+	 * @param cal1 <code>java.util.Calendar</code>
+	 * @param cal2 <code>java.util.Calendar</code>
+	 * @return true 如果两个日期是同一天
+	 */
+	public static boolean isSameDay(Calendar cal1, Calendar cal2) {
+		if (cal1 == null || cal2 == null) {
+			throw new RuntimeException("日期不能为空!");
+		}
+		return (cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA) && cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && cal1.get(Calendar.DAY_OF_YEAR) == cal2
+				.get(Calendar.DAY_OF_YEAR));
+	}
+
+	/**
+	 * 判断两个时间是否完全相等,精确到毫秒。
+	 * 
+	 * @param date1 <code>java.util.Date</code>
+	 * @param date2 <code>java.util.Date</code>
+	 * @return true 如果两个时间完全相等
+	 */
+	public static boolean isSameLocalTime(Date date1, Date date2) {
+		if (date1 == null || date2 == null) {
+			throw new RuntimeException("日期不能为空!");
+		}
+		Calendar cal1 = Calendar.getInstance();
+		cal1.setTime(date1);
+		Calendar cal2 = Calendar.getInstance();
+		cal2.setTime(date2);
+		return isSameLocalTime(cal1, cal2);
+	}
+
+	/**
+	 * 判断两个时间是否完全相等,精确到毫秒。
+	 * 
+	 * @param cal1 <code>java.util.Calendar</code>
+	 * @param cal2 <code>java.util.Calendar</code>
+	 * @return true 如果两个时间完全相等
+	 */
+	public static boolean isSameLocalTime(Calendar cal1, Calendar cal2) {
+		if (cal1 == null || cal2 == null) {
+			throw new RuntimeException("日期不能为空!");
+		}
+		return (cal1.get(Calendar.MILLISECOND) == cal2.get(Calendar.MILLISECOND) && cal1.get(Calendar.SECOND) == cal2.get(Calendar.SECOND)
+				&& cal1.get(Calendar.MINUTE) == cal2.get(Calendar.MINUTE) && cal1.get(Calendar.HOUR) == cal2.get(Calendar.HOUR)
+				&& cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR) && cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR)
+				&& cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA) && cal1.getClass() == cal2.getClass());
+	}
+
+	public static String formatHuman(Date date) {
+		if (date != null) {
+			Long seconds = (System.currentTimeMillis() - date.getTime()) / 1000;
+
+			if (seconds <= 0) {
+				return "刚刚";
+			}
+
+			if (seconds < 60) {
+				return seconds + "秒前";
+			}
+
+			Long min = seconds / 60;
+			if (min < 60) {
+				return min + "分钟前";
+			}
+
+			Long hour = seconds / 3600;
+			if (hour < 12) {
+				return hour + "小时前";
+			}
+
+			return format(date, "yyyy-MM-dd HH:mm:ss");
+		} else {
+			return "";
+		}
+
+	}
+
+	public static String formatHumanShort(Date date) {
+
+		Long seconds = (System.currentTimeMillis() - date.getTime()) / 1000;
+
+		if (seconds <= 0) {
+			return "刚刚";
+		}
+
+		if (seconds < 60) {
+			return seconds + "秒前";
+		}
+
+		Long min = seconds / 60;
+		if (min < 60) {
+			return min + "分钟前";
+		}
+
+		Long hour = seconds / 3600;
+		if (hour < 12) {
+			return hour + "小时前";
+		}
+
+		return format(date, "yyyy-MM-dd");
+	}
+
+	/**
+	 * 解析毫秒时间格式
+	 * 
+	 * @param millis
+	 * @return
+	 */
+	public static Date parseMillis(Long millis) {
+		Calendar calendar = Calendar.getInstance();
+		calendar.setTimeInMillis(millis);
+		return calendar.getTime();
+	}
+
+	/**
+	 * 返回date所在月的第一天
+	 * 
+	 * @return
+	 */
+	public static Date getFirstDayOfMonth(Date date) {
+		String str = DateUtil.getYear(date) + "-" + DateUtil.getMonth(date) + "-01";
+		return DateUtil.stringToDate(str, DateUtil.ISO_EXPANDED_DATE_FORMAT);
+	}
+
+	// 取最近的时间
+	public static Date getMaxDate(Date lastDate, Date newDate) {
+		if (lastDate != null && newDate != null) {
+			if (newDate.after(lastDate)) {
+				return newDate;
+			} else {
+				return lastDate;
+			}
+		} else if (lastDate != null) {
+			return lastDate;
+		} else {
+			return newDate;
+		}
+	}
+
+	// 取最老的时间
+	public static Date getMinDate(Date lastDate, Date newDate) {
+		if (lastDate != null && newDate != null) {
+			if (newDate.before(lastDate)) {
+				return newDate;
+			} else {
+				return lastDate;
+			}
+		} else if (lastDate != null) {
+			return lastDate;
+		} else {
+			return newDate;
+		}
+	}
+
+	/**
+	 * 将字符串转换为指定格式的日期
+	 * 
+	 * @param dateStr
+	 * @param pattern
+	 * @return
+	 */
+	public static Date strToDate(String dateStr, String pattern) {
+		Date date = null;
+		try {
+			SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern, DEFAULT_LOCALE);
+			date = simpleDateFormat.parse(dateStr);
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+		return date; // null if parse faile
+	}
+
+	/**
+	 * 时间转字符串
+	 * @param date
+	 * @return
+	 */
+	public static String dateToString(Date date) {
+		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
+		return df.format(date);
+	}
+
+	/**
+	 * 时间转字符串
+	 * @param date
+	 * @return
+	 */
+	public static String dateToString(Date date, SimpleDateFormat df) {
+		return df.format(date);
+	}
+
+	public static void main(String[] args) throws ParseException {
+		DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
+		// DateFormat df1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		System.out.println(daysBetween(df.parse("2017-07-20 10:07:42"), df.parse(df.format(new Date()))));
+	}
+}

+ 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();
+	}
+
+}

+ 14 - 0
mec-web/src/main/java/com/ym/mec/web/WebApplication.java

@@ -1,17 +1,21 @@
 package com.ym.mec.web;
 
 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 WebApplication {
+
+	@Autowired
+	private RedisTemplate<String, Object> redisTemplate;
+	
 	public static void main(String[] args) {
 		SpringApplication.run(WebApplication.class, args);
 	}
@@ -30,4 +38,10 @@ public class WebApplication {
 	public RestTemplate restTemplate() {
 		return new RestTemplate();
 	}
+
+	@Bean
+	@ConditionalOnBean(RedisTemplate.class)
+	public RedisCache<String, Object> redisCache() {
+		return new RedisCache<String, Object>(redisTemplate);
+	}
 }

+ 0 - 1
mec-web/src/main/java/com/ym/mec/web/controller/ClassGroupController.java

@@ -1,7 +1,6 @@
 package com.ym.mec.web.controller;
 
 import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 

+ 77 - 0
mec-web/src/main/java/com/ym/mec/web/controller/SysConfigController.java

@@ -0,0 +1,77 @@
+package com.ym.mec.web.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+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 com.ym.mec.biz.dal.entity.SysConfig;
+import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.common.controller.BaseController;
+
+/** 
+ * 系统配置控制层
+ */
+@RestController
+@Api(tags = "系统参数设置")
+@RequestMapping(value = "sysConfig")
+public class SysConfigController extends BaseController {
+
+	@Autowired
+	private SysConfigService sysConfigService;
+
+	@ApiOperation(value = "参数列表")
+	@GetMapping(value = "list")
+	public Object configList() {
+		List<SysConfig> configs = sysConfigService.findAll(null);
+		Map<String, Object> map = new HashMap<String, Object>();
+		if (configs != null && configs.size() > 0) {
+			for (SysConfig config : configs) {
+				map.put(config.getParamName(), config.getParanValue());
+			}
+		}
+		return succeed(map);
+	}
+
+	@ApiOperation(value = "修改参数")
+	@PostMapping(value = "update")
+	public Object update(SysConfig config) {
+		config.setModifyOn(new Date());
+		sysConfigService.update(config);
+		return succeed();
+	}
+
+	@ApiOperation(value = "新增参数")
+	@PostMapping(value = "add")
+	public Object addConfig(SysConfig config) {
+		if (config == null)
+			return failed("参数无效");
+		if (StringUtils.isBlank(config.getParamName())) {
+			return failed("参数名称不能为空");
+		}
+		if (StringUtils.isBlank(config.getParanValue())) {
+			return failed("参数值不能为空");
+		}
+		config.setCreateOn(new Date());
+		config.setModifyOn(new Date());
+		return sysConfigService.insert(config) > 0 ? succeed() : failed("添加失败");
+	}
+
+	@ApiOperation(value = "查询参数")
+	@GetMapping(value = "get")
+	public Object getConfig(Long id) {
+		if (id == null || id <= 0)
+			return failed("请检查输入的ID");
+		return succeed(sysConfigService.get(id));
+	}
+}

+ 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));
-    }
-
-}

+ 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;

+ 0 - 53
mec-web/src/test/java/com/ym/Test.java

@@ -1,53 +0,0 @@
-package com.ym;
-
-import com.ym.mec.biz.dal.dto.ClassDateAdjustDto;
-import com.ym.mec.biz.dal.entity.CourseSchedule;
-import org.apache.commons.lang.StringUtils;
-import org.springframework.beans.BeanUtils;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-
-/**
- * @Author Joburgess
- * @Date 2019/9/24
- */
-public class Test {
-
-    @org.junit.Test
-    public void test1(){
-        ClassDateAdjustDto temp=new ClassDateAdjustDto();
-        temp.setClassDate(new Date());
-        temp.setWeekNum(1);
-        temp.setId(1L);
-        CourseSchedule courseSchedule=new CourseSchedule();
-//        courseSchedule=temp;
-        BeanUtils.copyProperties(temp,courseSchedule);
-        courseSchedule.setId(2L);
-        System.out.println(courseSchedule.getId());
-    }
-
-    @org.junit.Test
-    public void test2() throws IOException {
-        System.out.println(System.getProperty("java.io.tmpdir"));
-        File file=new File("E:\test.txt");
-        file.createNewFile();
-    }
-
-    @org.junit.Test
-    public void test3(){
-        List<Integer> list=new ArrayList<>();
-        list.add(1);
-        list.add(2);
-        list.add(3);
-        list.add(1);
-        HashSet<Integer> hashSet=new HashSet<>(list);
-        String join = StringUtils.join(hashSet, ",");
-        System.out.println(join);
-    }
-
-}