Browse Source

Merge remote-tracking branch 'origin/master'

Joburgess 5 years ago
parent
commit
ffd49106ea
37 changed files with 609 additions and 104 deletions
  1. 1 2
      mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/client/SysUserFeignService.java
  2. 0 1
      mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/client/fallback/SysUserFeignServiceFallback.java
  3. 0 60
      mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/BasicUser.java
  4. 1 1
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/core/filter/PhoneLoginAuthenticationFilter.java
  5. 1 9
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/core/filter/UsernameAuthenticationFilter.java
  6. 8 6
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/core/handler/BaseAuthenticationSuccessEventHandler.java
  7. 3 0
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/SmsCodeController.java
  8. 5 10
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/UserController.java
  9. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupDao.java
  10. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupTeacherMapperDao.java
  11. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java
  12. 10 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysUserCashAccountDao.java
  13. 24 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ClassGroupTeachers.java
  14. 52 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/RechargeDto.java
  15. 12 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ClassGroupTeacherMapper.java
  16. 20 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/School.java
  17. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/service/ClassGroupService.java
  18. 19 0
      mec-biz/src/main/java/com/ym/mec/biz/service/ClassGroupTeacherMapperService.java
  19. 6 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentRechargeService.java
  20. 16 3
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java
  21. 28 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java
  22. 16 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupTeacherMapperServiceImpl.java
  23. 46 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRechargeServiceImpl.java
  24. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  25. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysUserCashAccountServiceImpl.java
  26. 21 1
      mec-biz/src/main/resources/config/mybatis/ClassGroupMapper.xml
  27. 12 0
      mec-biz/src/main/resources/config/mybatis/ClassGroupTeacherMapperMapper.xml
  28. 13 3
      mec-biz/src/main/resources/config/mybatis/CooperationOrganMapper.xml
  29. 10 2
      mec-biz/src/main/resources/config/mybatis/SchoolMapper.xml
  30. 4 0
      mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml
  31. 4 0
      mec-biz/src/main/resources/config/mybatis/SysUserCashAccountMapper.xml
  32. 2 1
      mec-client-api/src/main/java/com/ym/im/ImFeignService.java
  33. 5 0
      mec-client-api/src/main/java/com/ym/im/fallback/ImFeignServiceFallback.java
  34. 55 0
      mec-student/src/main/java/com/ym/mec/student/controller/RechargeController.java
  35. 150 0
      mec-util/src/main/java/com/ym/mec/util/string/IdWorker.java
  36. 15 0
      mec-web/src/main/java/com/ym/mec/web/controller/ClassGroupController.java
  37. 2 0
      mec-web/src/main/java/com/ym/mec/web/controller/CooperationOrganController.java

+ 1 - 2
mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/client/SysUserFeignService.java

@@ -3,13 +3,12 @@ package com.ym.mec.auth.api.client;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestParam;
 
 import com.ym.mec.auth.api.client.fallback.SysUserFeignServiceFallback;
 import com.ym.mec.auth.api.dto.SysUserInfo;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.common.config.FeignConfiguration;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestParam;
 
 @FeignClient(name = "auth-server", configuration = FeignConfiguration.class, fallback = SysUserFeignServiceFallback.class)
 public interface SysUserFeignService {

+ 0 - 1
mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/client/fallback/SysUserFeignServiceFallback.java

@@ -5,7 +5,6 @@ import org.springframework.stereotype.Component;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.dto.SysUserInfo;
 import com.ym.mec.auth.api.entity.SysUser;
-import org.springframework.web.bind.annotation.RequestBody;
 
 @Component
 public class SysUserFeignServiceFallback implements SysUserFeignService {

+ 0 - 60
mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/BasicUser.java

@@ -1,60 +0,0 @@
-package com.ym.mec.auth.api.entity;
-
-import org.springframework.security.oauth2.common.OAuth2AccessToken;
-import org.springframework.security.oauth2.common.OAuth2RefreshToken;
-
-import java.util.Date;
-import java.util.Map;
-import java.util.Set;
-
-public class BasicUser implements OAuth2AccessToken {
-    private String password;
-
-    public String getPassword() {
-        return password;
-    }
-
-    public void setPassword(String password) {
-        this.password = password;
-    }
-
-    @Override
-    public Map<String, Object> getAdditionalInformation() {
-        return null;
-    }
-
-    @Override
-    public Set<String> getScope() {
-        return null;
-    }
-
-    @Override
-    public OAuth2RefreshToken getRefreshToken() {
-        return null;
-    }
-
-    @Override
-    public String getTokenType() {
-        return null;
-    }
-
-    @Override
-    public boolean isExpired() {
-        return false;
-    }
-
-    @Override
-    public Date getExpiration() {
-        return null;
-    }
-
-    @Override
-    public int getExpiresIn() {
-        return 0;
-    }
-
-    @Override
-    public String getValue() {
-        return null;
-    }
-}

+ 1 - 1
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/core/filter/PhoneLoginAuthenticationFilter.java

@@ -51,7 +51,7 @@ public class PhoneLoginAuthenticationFilter extends AbstractAuthenticationProces
 		principal = obtainParameter(request, SPRING_SECURITY_RESTFUL_PHONE_KEY);
 		credentials = obtainParameter(request, SPRING_SECURITY_RESTFUL_VERIFY_CODE_KEY);
 
-		SysUserInfo userInfo = sysUserService.queryUserInfoByPhone(StringUtils.substringAfter(principal, SecurityConstants.PHONE_PRINCIPAL_PREFIX));
+		SysUserInfo userInfo = sysUserService.queryUserInfoByPhone(principal);
 
 		String clientId = request.getParameter(clientIdParameter);
 

+ 1 - 9
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/core/filter/UsernameAuthenticationFilter.java

@@ -62,15 +62,7 @@ public class UsernameAuthenticationFilter extends AbstractAuthenticationProcessi
 		username = username.trim();
 		password = password.trim();
 
-		SysUserInfo userInfo = null;
-
-		if (StringUtils.startsWith(username, SecurityConstants.PHONE_PRINCIPAL_PREFIX)) {
-			userInfo = sysUserService.queryUserInfoByPhone(StringUtils.substringAfter(username, SecurityConstants.PHONE_PRINCIPAL_PREFIX));
-		} else if (StringUtils.startsWith(username, SecurityConstants.USERNAME_PRINCIPAL_PREFIX)) {
-			userInfo = sysUserService.queryUserInfoByUsername(StringUtils.substringAfter(username, SecurityConstants.USERNAME_PRINCIPAL_PREFIX));
-		} else {
-			userInfo = sysUserService.queryUserInfoByUsername(username);
-		}
+		SysUserInfo userInfo = sysUserService.queryUserInfoByUsername(username);
 
 		String clientId = request.getParameter(clientIdParameter);
 

+ 8 - 6
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/core/handler/BaseAuthenticationSuccessEventHandler.java

@@ -4,12 +4,13 @@ import java.io.IOException;
 import java.util.Base64;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import com.ym.mec.auth.api.entity.BasicUser;
 import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -18,6 +19,7 @@ import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
 import org.springframework.security.authentication.BadCredentialsException;
 import org.springframework.security.core.Authentication;
+import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken;
 import org.springframework.security.oauth2.common.OAuth2AccessToken;
 import org.springframework.security.oauth2.common.exceptions.UnapprovedClientAuthenticationException;
 import org.springframework.security.oauth2.provider.ClientDetails;
@@ -107,13 +109,13 @@ public class BaseAuthenticationSuccessEventHandler extends SavedRequestAwareAuth
 			OAuth2Request oAuth2Request = tokenRequest.createOAuth2Request(clientDetails);
 
 			OAuth2Authentication oAuth2Authentication = new OAuth2Authentication(oAuth2Request, authentication);
-			BasicUser oAuth2AccessToken = (BasicUser)defaultAuthorizationServerTokenServices.createAccessToken(oAuth2Authentication);
+			OAuth2AccessToken oAuth2AccessToken = defaultAuthorizationServerTokenServices.createAccessToken(oAuth2Authentication);
 			logger.info("获取token 成功:{}", oAuth2AccessToken.getValue());
-			oAuth2AccessToken.setPassword(sysUser.getPassword());
-
+			Map<String,Object> map = new HashMap<>(3);
+			map.put("password", StringUtils.isEmpty(sysUser.getPassword())?false:true);
+			map.put("authentication",oAuth2AccessToken);
 			response.setContentType("application/json; charset=utf-8");
-
-			HttpResponseResult result = new HttpResponseResult(true, HttpStatus.OK.value(), oAuth2AccessToken, "");
+			HttpResponseResult result = new HttpResponseResult(true, HttpStatus.OK.value(), map, "");
 			response.getWriter().write(objectMapper.writeValueAsString(result));
 		} catch (IOException e) {
 			throw new BadCredentialsException("Failed to decode basic authentication token");

+ 3 - 0
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/SmsCodeController.java

@@ -2,6 +2,7 @@ package com.ym.mec.auth.web.controller;
 
 import com.google.code.kaptcha.Constants;
 import com.google.code.kaptcha.Producer;
+import com.google.code.kaptcha.servlet.KaptchaServlet;
 import com.ym.mec.auth.config.constant.SecurityConstants;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.validcode.SmsCodeService;
@@ -97,6 +98,8 @@ public class SmsCodeController extends BaseController {
         redisTemplate.opsForValue().set(Constants.KAPTCHA_SESSION_KEY + phone,capText,3, TimeUnit.MINUTES);
         // create the image with the text
         BufferedImage bi = captchaProducer.createImage(capText);
+        KaptchaServlet kaptchaServlet = new KaptchaServlet();
+        kaptchaServlet.init();
         ServletOutputStream out = response.getOutputStream();
         // write the data out
         ImageIO.write(bi, "jpg", out);

+ 5 - 10
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/UserController.java

@@ -74,23 +74,18 @@ public class UserController extends BaseController {
 	@ApiOperation(value = "设置密码")
 	@PostMapping(value = "/setPassword",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
 	@ApiImplicitParams({ @ApiImplicitParam(name = "mobile", value = "手机号", required = true, dataType = "String"),
-			@ApiImplicitParam(name = "authCode", value = "验证码", required = true, dataType = "String"),
 			@ApiImplicitParam(name = "password", value = "密码", required = true, dataType = "String") })
-	public Object setPassword(String mobile,String authCode,String password) {
-		if(StringUtils.isEmpty(mobile) || StringUtils.isEmpty(authCode) || StringUtils.isEmpty(password)){
+	public Object setPassword(String mobile,String password) {
+		if(StringUtils.isEmpty(mobile) || StringUtils.isEmpty(password)){
 			return failed();
 		}
 		SysUser sysUser = sysUserService.queryByPhone(mobile);
 		if(sysUser == null){
 			return failed("用户不存在");
 		}
-		if(smsCodeService.verifyValidCode(mobile, authCode)){
-			password = new BCryptPasswordEncoder().encode(password);
-			sysUserService.updatePassword(mobile,password);
-			return succeed();
-		}else {
-			return failed("验证码错误");
-		}
+		password = new BCryptPasswordEncoder().encode(password);
+		sysUserService.updatePassword(mobile,password);
+		return succeed();
 	}
 
 	@ApiOperation(value = "修改密码")

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupDao.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.dao;
 
+import com.ym.mec.biz.dal.dto.ClassGroupTeachers;
 import com.ym.mec.biz.dal.dto.TeacherMusicClassInfoDto;
 import com.ym.mec.biz.dal.dto.TeacherVipClassInfoDto;
 import com.ym.mec.biz.dal.entity.ClassGroup;
@@ -54,6 +55,7 @@ public interface ClassGroupDao extends BaseDAO<Integer, ClassGroup> {
 
     /**
      * 跟班级ids查询班级信息
+     *
      * @param ids
      * @return
      */
@@ -61,6 +63,7 @@ public interface ClassGroupDao extends BaseDAO<Integer, ClassGroup> {
 
     /**
      * 根据教师编号获取教师所在乐团,带了哪些班级
+     *
      * @param userId
      * @return
      */
@@ -68,6 +71,7 @@ public interface ClassGroupDao extends BaseDAO<Integer, ClassGroup> {
 
     /**
      * 获取老师VIP课程信息列表
+     *
      * @param params
      * @return
      */
@@ -75,8 +79,16 @@ public interface ClassGroupDao extends BaseDAO<Integer, ClassGroup> {
 
     /**
      * count老师VIP课程信息列表
+     *
      * @param params
      * @return
      */
     int countTeacherVipClass(Map<String, Object> params);
+
+    /**
+     * 获取乐团所有班级列表
+     * @param musicGroupId
+     * @return
+     */
+    List<ClassGroupTeachers> findClassGroupByMusicGroupId(@Param("musicGroupId") int musicGroupId);
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupTeacherMapperDao.java

@@ -1,5 +1,7 @@
 package com.ym.mec.biz.dal.dao;
 
+import com.ym.mec.biz.dal.dto.ClassGroupTeachers;
+import com.ym.mec.biz.dal.entity.ClassGroup;
 import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
 import com.ym.mec.common.dal.BaseDAO;
 
@@ -12,8 +14,17 @@ public interface ClassGroupTeacherMapperDao extends BaseDAO<Long, ClassGroupTeac
 
     /**
      * 批量插入班级老师
+     *
      * @param classGroupTeacherMapperList
      * @return
      */
     int classGroupTeachersInsert(@Param("classGroupTeacherMapperList") List<ClassGroupTeacherMapper> classGroupTeacherMapperList);
+
+    /**
+     * 查询班级老师
+     *
+     * @param ClassGroupList
+     * @return
+     */
+    List<ClassGroupTeacherMapper> findClassGroupTeachers(@Param("classGroupList") List<ClassGroup> ClassGroupList);
 }

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

@@ -58,9 +58,17 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
 
     /**
      * 获取乐团声部未分配学生数
+     *
      * @param musicGroupId
      * @param actualSubjectId
      * @return
      */
     Integer getNoClassStuCountBySubjectId(@Param("musicGroupId") Integer musicGroupId, @Param("actualSubjectId") Integer actualSubjectId);
+
+    /**
+     * 根据乐团id和user_id 更新
+     * @param studentRegistration
+     * @return
+     */
+    Integer updateByUserIdAndMusicGroupId(@Param("studentRegistration") StudentRegistration studentRegistration);
 }

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

@@ -2,8 +2,17 @@ package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.entity.SysUserCashAccount;
 import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
 
 public interface SysUserCashAccountDao extends BaseDAO<Integer, SysUserCashAccount> {
 
-	
+    /**
+     * 账户余额加
+     * @param userId
+     * @param amount
+     * @return
+     */
+    int incrAccount(@Param("userId") Integer userId, @Param("amount") BigDecimal amount);
 }

+ 24 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ClassGroupTeachers.java

@@ -0,0 +1,24 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.ym.mec.biz.dal.entity.ClassGroup;
+import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
+
+import java.util.List;
+
+/**
+ * 班级老师
+ */
+public class ClassGroupTeachers extends ClassGroup {
+
+	/** 班级老师 **/
+	private List<ClassGroupTeacherMapper> classGroupTeacherMapperList;
+
+
+	public List<ClassGroupTeacherMapper> getClassGroupTeacherMapperList() {
+		return classGroupTeacherMapperList;
+	}
+
+	public void setClassGroupTeacherMapperList(List<ClassGroupTeacherMapper> classGroupTeacherMapperList) {
+		this.classGroupTeacherMapperList = classGroupTeacherMapperList;
+	}
+}

+ 52 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/RechargeDto.java

@@ -0,0 +1,52 @@
+package com.ym.mec.biz.dal.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
+
+public class RechargeDto {
+
+    @ApiModelProperty(value = "充值金额",required = false)
+    private BigDecimal rechargeAmount;
+
+    @ApiModelProperty(value = "用户id",required = false)
+    private Integer userId;
+
+    @ApiModelProperty(value = "银行卡",required = false)
+    private String  bankNo;
+
+    @ApiModelProperty(value = "银行名",required = false)
+    private String bankName;
+
+    public BigDecimal getRechargeAmount() {
+        return rechargeAmount;
+    }
+
+    public void setRechargeAmount(BigDecimal rechargeAmount) {
+        this.rechargeAmount = rechargeAmount;
+    }
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public String getBankNo() {
+        return bankNo;
+    }
+
+    public void setBankNo(String bankNo) {
+        this.bankNo = bankNo;
+    }
+
+    public String getBankName() {
+        return bankName;
+    }
+
+    public void setBankName(String bankName) {
+        this.bankName = bankName;
+    }
+}

+ 12 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ClassGroupTeacherMapper.java

@@ -31,7 +31,10 @@ public class ClassGroupTeacherMapper {
 	/**  */
 	@ApiModelProperty(value = "用户编号",required = false)
 	private Integer userId;
-	
+
+	@ApiModelProperty(value = "用户名",required = false)
+	private Integer userName;
+
 	/** 薪酬 */
 	@ApiModelProperty(value = "薪酬",required = false)
 	private BigDecimal salary;
@@ -105,6 +108,14 @@ public class ClassGroupTeacherMapper {
 	public java.util.Date getUpdateTime(){
 		return this.updateTime;
 	}
+
+	public Integer getUserName() {
+		return userName;
+	}
+
+	public void setUserName(Integer userName) {
+		this.userName = userName;
+	}
 			
 	@Override
 	public String toString() {

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/School.java

@@ -51,6 +51,10 @@ public class School {
 	
 	@ApiModelProperty(value = "补贴", required = false)
 	private BigDecimal subsidy;
+	
+	private Integer cooperationOrganId;
+	
+	private String remark;
 
 	public void setId(Integer id) {
 		this.id = id;
@@ -140,6 +144,22 @@ public class School {
 		this.subsidy = subsidy;
 	}
 
+	public Integer getCooperationOrganId() {
+		return cooperationOrganId;
+	}
+
+	public void setCooperationOrganId(Integer cooperationOrganId) {
+		this.cooperationOrganId = cooperationOrganId;
+	}
+
+	public String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/ClassGroupService.java

@@ -2,6 +2,7 @@ package com.ym.mec.biz.service;
 
 import java.util.List;
 
+import com.ym.mec.biz.dal.dto.ClassGroupTeachers;
 import com.ym.mec.biz.dal.dto.HighClassGroup;
 import com.ym.mec.biz.dal.dto.TeacherMusicClassInfoDto;
 import com.ym.mec.biz.dal.dto.TeacherVipClassInfoDto;
@@ -9,6 +10,7 @@ import com.ym.mec.biz.dal.entity.ClassGroup;
 import com.ym.mec.biz.dal.page.VipClassQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
+import org.apache.ibatis.annotations.Param;
 
 public interface ClassGroupService extends BaseService<Integer, ClassGroup> {
 
@@ -92,4 +94,13 @@ public interface ClassGroupService extends BaseService<Integer, ClassGroup> {
      * @return
      */
     PageInfo<TeacherVipClassInfoDto> getTeacherVipClass(VipClassQueryInfo queryInfo);
+
+
+    /**
+     * 获取乐团班级老师课酬
+     * @param musicGroupId
+     * @return
+     */
+    List<ClassGroupTeachers> getClassGroupAndTeachers(Integer musicGroupId);
+
 }

+ 19 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/ClassGroupTeacherMapperService.java

@@ -1,5 +1,7 @@
 package com.ym.mec.biz.service;
 
+import com.ym.mec.biz.dal.dto.ClassGroupTeachers;
+import com.ym.mec.biz.dal.entity.ClassGroup;
 import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
 import com.ym.mec.common.service.BaseService;
 
@@ -15,4 +17,21 @@ public interface ClassGroupTeacherMapperService extends BaseService<Long, ClassG
      * @return
      */
     int classGroupTeachersInsert(List<ClassGroupTeacherMapper> classGroupTeacherMapperList);
+
+
+    /**
+     * 查询班级老师
+     *
+     * @param classGroupList
+     * @return
+     */
+    List<ClassGroupTeacherMapper> findClassGroupTeachers(List<ClassGroup> classGroupList);
+
+    /**
+     * 批量更新教师薪酬
+     * @param classGroupTeacherMapperList
+     * @return
+     */
+    boolean classGroupTeacherMapperUpdate(List<ClassGroupTeacherMapper> classGroupTeacherMapperList) throws Exception;
+
 }

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentRechargeService.java

@@ -1,8 +1,14 @@
 package com.ym.mec.biz.service;
 
+import com.ym.mec.biz.dal.dto.RechargeDto;
 import com.ym.mec.biz.dal.entity.StudentRecharge;
 import com.ym.mec.common.service.BaseService;
 
 public interface StudentRechargeService extends BaseService<String, StudentRecharge> {
 
+    /**
+     * 账户充值
+     * @param rechargeDto
+     */
+    Boolean recharge(RechargeDto rechargeDto);
 }

+ 16 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java

@@ -17,6 +17,7 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
 
     /**
      * 获取乐团学员报名详情
+     *
      * @param queryInfo
      * @return
      */
@@ -24,6 +25,7 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
 
     /**
      * 批量调剂
+     *
      * @param userId
      * @param subId
      * @return
@@ -32,15 +34,17 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
 
     /**
      * 学生报名缴费金额详情
+     *
      * @param studentId
      * @param musicGroupId
      * @return
      */
-    StudentFeeDto queryFeeDetail(Integer studentId,String musicGroupId);
+    StudentFeeDto queryFeeDetail(Integer studentId, String musicGroupId);
 
     /**
      * 获取未分配的班级的学生
-     * @param musicGroupId 乐团id
+     *
+     * @param musicGroupId    乐团id
      * @param actualSubjectId 科目id
      * @return
      */
@@ -48,11 +52,20 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
 
     /**
      * 获取乐团声部未分配学生统计
+     *
      * @param musicGroupId
      * @param actualSubjectId
      * @return
      */
-    Integer getNoClassStuCountBySubjectId(@Param("musicGroupId") Integer musicGroupId, @Param("actualSubjectId") Integer actualSubjectId);
+    Integer getNoClassStuCountBySubjectId(Integer musicGroupId, Integer actualSubjectId);
 
 
+    /**
+     * 根据user_id 和 乐团id更新
+     *
+     * @param studentRegistration
+     * @return
+     */
+    Integer updateByUserIdAndMusicGroupId(StudentRegistration studentRegistration);
+
 }

+ 28 - 0
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.TeacherDao;
+import com.ym.mec.biz.dal.dto.ClassGroupTeachers;
 import com.ym.mec.biz.dal.dto.HighClassGroup;
 import com.ym.mec.biz.dal.dto.TeacherMusicClassInfoDto;
 import com.ym.mec.biz.dal.dto.TeacherVipClassInfoDto;
@@ -41,6 +42,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     private TeacherDefaultMusicGroupSalaryService teacherDefaultMusicGroupSalaryService;
     @Autowired
     private CourseScheduleService courseScheduleService;
+    @Autowired
+    private StudentRegistrationService studentRegistrationService;
 
     @Override
     public BaseDAO<Integer, ClassGroup> getDAO() {
@@ -98,7 +101,13 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             classGroupStudentMapper.setCreateTime(date);
             classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
             classGroupStudentList.add(classGroupStudentMapper);
+            StudentRegistration studentRegistration = new StudentRegistration();
+            studentRegistration.setClassGroupId(classGroupId.intValue());
+            studentRegistration.setUserId(Integer.getInteger(userId));
+            studentRegistration.setMusicGroupId(classGroup.getMusicGroupId());
+            studentRegistrationService.updateByUserIdAndMusicGroupId(studentRegistration);
         }
+
         classGroupStudentMapperService.classGroupStudentsInsert(classGroupStudentList);
 
         return classGroup;
@@ -236,4 +245,23 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         pageInfo.setRows(dataList);
         return pageInfo;
     }
+
+    @Override
+    public List<ClassGroupTeachers> getClassGroupAndTeachers(Integer musicGroupId) {
+        List<ClassGroupTeachers> classGroupAndTeachersList = classGroupDao.findClassGroupByMusicGroupId(musicGroupId);
+        List<ClassGroup> classGroupList = Collections.unmodifiableList(classGroupAndTeachersList);
+
+        List<ClassGroupTeacherMapper> classGroupTeacherMapperList = classGroupTeacherMapperService.findClassGroupTeachers(classGroupList);
+
+        for (ClassGroupTeachers classGroupAndTeachers : classGroupAndTeachersList) {
+            List<ClassGroupTeacherMapper> oneClassGroupTeacherMapperList = new ArrayList<>();
+            for (ClassGroupTeacherMapper classGroupTeacherMapper : classGroupTeacherMapperList) {
+                if (classGroupTeacherMapper.getClassGroupId().equals(classGroupAndTeachers.getId())) {
+                    oneClassGroupTeacherMapperList.add(classGroupTeacherMapper);
+                }
+            }
+            classGroupAndTeachers.setClassGroupTeacherMapperList(oneClassGroupTeacherMapperList);
+        }
+        return classGroupAndTeachersList;
+    }
 }

+ 16 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupTeacherMapperServiceImpl.java

@@ -1,5 +1,7 @@
 package com.ym.mec.biz.service.impl;
 
+import com.ym.mec.biz.dal.dto.ClassGroupTeachers;
+import com.ym.mec.biz.dal.entity.ClassGroup;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -26,4 +28,18 @@ public class ClassGroupTeacherMapperServiceImpl extends BaseServiceImpl<Long, Cl
     public int classGroupTeachersInsert(List<ClassGroupTeacherMapper> classGroupTeacherMapperList) {
         return classGroupTeacherMapperDao.classGroupTeachersInsert(classGroupTeacherMapperList);
     }
+
+
+    @Override
+    public List<ClassGroupTeacherMapper> findClassGroupTeachers(List<ClassGroup> ClassGroupList) {
+        return classGroupTeacherMapperDao.findClassGroupTeachers(ClassGroupList);
+    }
+
+    public boolean classGroupTeacherMapperUpdate(List<ClassGroupTeacherMapper> classGroupTeacherMapperList) throws Exception {
+        for (ClassGroupTeacherMapper classGroupTeacherMapper : classGroupTeacherMapperList) {
+            classGroupTeacherMapperDao.update(classGroupTeacherMapper);
+        }
+        return true;
+    }
+
 }

+ 46 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRechargeServiceImpl.java

@@ -1,23 +1,67 @@
 package com.ym.mec.biz.service.impl;
 
+import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
+import com.ym.mec.biz.dal.entity.StudentRegistration;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.ym.mec.biz.dal.dao.StudentRechargeDao;
+import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
+import com.ym.mec.biz.dal.dao.SysUserCashAccountDetailDao;
+import com.ym.mec.biz.dal.dto.RechargeDto;
 import com.ym.mec.biz.dal.entity.StudentRecharge;
+import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
+import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
 import com.ym.mec.biz.service.StudentRechargeService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 
+import javax.annotation.Resource;
+import java.util.Date;
+
 @Service
 public class StudentRechargeServiceImpl extends BaseServiceImpl<String, StudentRecharge>  implements StudentRechargeService {
 	
-	@Autowired
+	@Resource
 	private StudentRechargeDao studentRechargeDao;
+    @Autowired
+    private StudentRegistrationDao studentRegistrationDao;
+
+	@Resource
+	private SysUserCashAccountDao sysUserCashAccountDao;
 
+	@Resource
+	private SysUserCashAccountDetailDao sysUserCashAccountDetailDao;
 	@Override
 	public BaseDAO<String, StudentRecharge> getDAO() {
 		return studentRechargeDao;
 	}
-	
+
+	@Override
+	public Boolean recharge(RechargeDto rechargeDto) {
+
+		//TODO ???????????????
+		Date now  = new Date();
+
+		//?????????
+        StudentRecharge studentRecharge = new StudentRecharge();
+        studentRecharge.setAmount(rechargeDto.getRechargeAmount());
+		studentRecharge.setCreateTime(now);
+		studentRecharge.setUserId(rechargeDto.getUserId().longValue());
+		studentRecharge.setTransNo(null);
+		studentRechargeDao.insert(studentRecharge);
+		//??????
+		SysUserCashAccountDetail cashAccount = new SysUserCashAccountDetail();
+		cashAccount.setAmount(rechargeDto.getRechargeAmount());
+		cashAccount.setBalance(null);
+		cashAccount.setTransNo(null);
+		cashAccount.setType(PlatformCashAccountDetailTypeEnum.RECHARGE);
+		cashAccount.setUserId(rechargeDto.getUserId());
+		cashAccount.setCreateTime(now);
+		sysUserCashAccountDetailDao.insert(cashAccount);
+		//??????????
+		sysUserCashAccountDao.incrAccount(rechargeDto.getUserId(),rechargeDto.getRechargeAmount());
+
+		return true;
+	}
 }

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -79,4 +79,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     public Integer getNoClassStuCountBySubjectId(Integer musicGroupId, Integer actualSubjectId) {
         return studentRegistrationDao.getNoClassStuCountBySubjectId(musicGroupId,actualSubjectId);
     }
+
+    @Override
+    public Integer updateByUserIdAndMusicGroupId(StudentRegistration studentRegistration) {
+        return studentRegistrationDao.updateByUserIdAndMusicGroupId(studentRegistration);
+    }
 }

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

@@ -19,5 +19,5 @@ public class SysUserCashAccountServiceImpl extends BaseServiceImpl<Integer, SysU
 	public BaseDAO<Integer, SysUserCashAccount> getDAO() {
 		return sysUserCashAccountDao;
 	}
-	
+
 }

+ 21 - 1
mec-biz/src/main/resources/config/mybatis/ClassGroupMapper.xml

@@ -211,7 +211,8 @@
         <result column="current_class_times_" property="currentClassTimes"/>
         <result column="total_class_times_" property="totalClassTimes"/>
         <result column="vip_group_name_" property="vipClassName"/>
-        <result column="audit_status_" property="auditStatus" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="audit_status_" property="auditStatus"
+                typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="status_" property="status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
     </resultMap>
     <select id="getTeacherVipClass" resultMap="getTeacherVipClassMap">
@@ -230,4 +231,23 @@
         SELECT COUNT(vg.id_) FROM vip_group vg
         WHERE vg.user_id_ = #{teacherId}
     </select>
+
+
+    <resultMap type="com.ym.mec.biz.dal.dto.ClassGroupTeachers" id="ClassGroupTeachers">
+        <result column="id_" property="id"/>
+        <result column="music_group_id_" property="musicGroupId"/>
+        <result column="subject_id_list_" property="subjectIdList"/>
+        <result column="name_" property="name"/>
+        <result column="student_num_" property="studentNum"/>
+        <result column="create_time_" property="createTime"/>
+        <result column="update_time_" property="updateTime"/>
+        <result column="type_" property="type" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="del_flag_" property="delFlag" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="expect_student_num_" property="expectStudentNum"/>
+        <result column="total_class_times_" property="totalClassTimes"/>
+    </resultMap>
+    <!-- 根据乐团id获取乐团下所有班级 -->
+    <select id="findClassGroupByMusicGroupId" resultMap="ClassGroupTeachers">
+        SELECT * FROM class_group WHERE music_group_id_ = #{musicGroupId} AND del_flag_ = 0;
+    </select>
 </mapper>

+ 12 - 0
mec-biz/src/main/resources/config/mybatis/ClassGroupTeacherMapperMapper.xml

@@ -9,6 +9,7 @@
         <result column="music_group_id_" property="musicGroupId"/>
         <result column="class_group_id_" property="classGroupId"/>
         <result column="teacher_role_" property="teacherRole"/>
+        <result column="username_" property="userName"/>
         <result column="user_id_" property="userId"/>
         <result column="salary_" property="salary"/>
         <result column="create_time_" property="createTime"/>
@@ -97,4 +98,15 @@
             (#{item.id},#{item.musicGroupId},#{item.classGroupId},#{item.teacherRole},#{item.userId},#{item.salary},#{item.createTime},#{item.updateTime})
         </foreach>
     </insert>
+
+    <!-- 获取乐团班级的老师 -->
+    <select id="findClassGroupTeachers" resultMap="ClassGroupTeacherMapper">
+        SELECT u.username_, ct.*
+        FROM sys_user u,
+        class_group_teacher_mapper ct
+        WHERE class_group_id_ IN
+        <foreach collection="classGroupList" item="classGroup" index="index" open="(" close=")" separator=",">
+            #{classGroup.id}
+        </foreach>
+    </select>
 </mapper>

+ 13 - 3
mec-biz/src/main/resources/config/mybatis/CooperationOrganMapper.xml

@@ -76,14 +76,24 @@
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="CooperationOrgan"
             parameterType="map">
-        SELECT * FROM cooperation_organ ORDER BY id_
+        SELECT * FROM cooperation_organ
+        <where>
+            <if test="search != null">
+                organ_id_ = #{search}
+            </if>
+        </where>
+        ORDER BY id_
         <include refid="global.limit"/>
     </select>
 
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM
-		cooperation_organ
+		SELECT COUNT(*) FROM cooperation_organ
+        <where>
+            <if test="search != null">
+                organ_id_ = #{search}
+            </if>
+        </where>
 	</select>
     <select id="queryByOrganId" resultMap="CooperationOrgan">
         SELECT * FROM cooperation_organ WHERE organ_id_ = #{organId}

+ 10 - 2
mec-biz/src/main/resources/config/mybatis/SchoolMapper.xml

@@ -18,6 +18,8 @@
         <result column="contact_name_" property="contactName"/>
         <result column="longitude_latitude_" property="longitudeLatitude"/>
         <result column="subsidy_" property="subsidy"/>
+        <result column="cooperation_organ_id_" property="cooperationOrganId"/>
+        <result column="remark_" property="remark"/>
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -39,8 +41,8 @@
         </selectKey>
         -->
         INSERT INTO school
-        (id_,name_,organ_id_,address_,contact_phone_,create_time_,update_time_,contact_name_,longitude_latitude_,subsidy_)
-        VALUES(#{id},#{name},#{organId},#{address},#{contactPhone},now(),now(),#{contactName},#{longitudeLatitude},#{subsidy})
+        (id_,name_,organ_id_,address_,contact_phone_,create_time_,update_time_,contact_name_,longitude_latitude_,subsidy_,cooperation_organ_id_,remark_)
+        VALUES(#{id},#{name},#{organId},#{address},#{contactPhone},now(),now(),#{contactName},#{longitudeLatitude},#{subsidy},#{cooperationOrganId},#{remark})
     </insert>
 
     <!-- 根据主键查询一条记录 -->
@@ -74,6 +76,12 @@
             <if test="subsidy != null">
                 subsidy_ = #{subsidy},
             </if>
+            <if test="cooperationOrganId != null">
+                cooperation_organ_id_ = #{cooperationOrganId},
+            </if>
+            <if test="remark != null">
+                remark_ = #{remark},
+            </if>
         </set>
         WHERE id_ = #{id}
     </update>

+ 4 - 0
mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml

@@ -212,4 +212,8 @@
         SELECT count(*) FROM student_registration WHERE music_group_id_ = #{musicGroupId} AND actual_subject_id_ =
         #{actualSubjectId} AND class_group_id_ >=1
     </select>
+
+    <update id="updateByUserIdAndMusicGroupId" parameterType="com.ym.mec.biz.dal.entity.StudentRegistration">
+        UPDATE student_registration SET class_group_id_ = #{classGroupId} WHERE user_id_ = #{userId} AND music_group_id_ = #{musicGroupId}
+    </update>
 </mapper>

+ 4 - 0
mec-biz/src/main/resources/config/mybatis/SysUserCashAccountMapper.xml

@@ -84,4 +84,8 @@
     <select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM sys_user_cash_account
 	</select>
+
+    <update id="incrAccount">
+        update sys_user_cash_account set balance_ = balance_ + #{amount} where  user_id_ = #{userId}
+    </update>
 </mapper>

+ 2 - 1
mec-client-api/src/main/java/com/ym/im/ImFeignService.java

@@ -2,6 +2,7 @@ package com.ym.im;
 
 import com.ym.im.fallback.ImFeignServiceFallback;
 import com.ym.mec.common.config.FeignConfiguration;
+import com.ym.mec.common.entity.ImUserModel;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -10,5 +11,5 @@ import org.springframework.web.bind.annotation.RequestBody;
 public interface ImFeignService {
 
     @PostMapping(value = "user/register")
-    Object getUser(@RequestBody String username);
+    Object getUser(@RequestBody ImUserModel userModel);
 }

+ 5 - 0
mec-client-api/src/main/java/com/ym/im/fallback/ImFeignServiceFallback.java

@@ -1,8 +1,13 @@
 package com.ym.im.fallback;
 
 import com.ym.im.ImFeignService;
+import com.ym.mec.common.entity.ImUserModel;
 import org.springframework.stereotype.Component;
 
 @Component
 public class ImFeignServiceFallback implements ImFeignService {
+    @Override
+    public Object getUser(ImUserModel userModel) {
+        return null;
+    }
 }

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

@@ -0,0 +1,55 @@
+package com.ym.mec.student.controller;
+
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dto.RechargeDto;
+import com.ym.mec.biz.dal.entity.SysUserCashAccount;
+import com.ym.mec.biz.service.StudentRechargeService;
+import com.ym.mec.biz.service.SysUserCashAccountService;
+import com.ym.mec.common.controller.BaseController;
+import io.swagger.annotations.Api;
+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.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+/**
+ * @version V1.0
+ * @Description: 充值
+ * @date Date : 2019年09月23日 16:56
+ */
+
+@RequestMapping("recharge")
+@Api(tags = "账户充值")
+@RestController
+public class RechargeController extends BaseController {
+    @Resource
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private StudentRechargeService rechargeService;
+
+    @Autowired
+    private SysUserCashAccountService sysUserCashAccountService;
+
+    @ApiOperation("充值")
+    @GetMapping(value = "/recharge")
+    private Object recharge(RechargeDto rechargeDto){
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if(sysUser == null){
+            return failed("请重新登录");
+        }
+        SysUserCashAccount userCashAccount = sysUserCashAccountService.get(sysUser.getId());
+        if(userCashAccount == null || !userCashAccount.getStatus().equals(1)){
+            return failed("账户不存在");
+        }
+
+        if(!userCashAccount.getStatus().equals(1)){
+            return failed("账户已冻结");
+        }
+
+        return succeed(rechargeService.recharge(rechargeDto));
+    }
+}

+ 150 - 0
mec-util/src/main/java/com/ym/mec/util/string/IdWorker.java

@@ -0,0 +1,150 @@
+package com.ym.mec.util.string;
+
+import java.text.SimpleDateFormat;
+
+/**
+ * Twitter_Snowflake<br>
+ * SnowFlake的结构如下(每部分用-分开):<br>
+ * 0 - 0000000000 0000000000 0000000000 0000000000 0 - 00000 - 00000 - 000000000000 <br>
+ * 1位标识,由于long基本类型在Java中是带符号的,最高位是符号位,正数是0,负数是1,所以id一般是正数,最高位是0<br>
+ * 41位时间截(毫秒级),注意,41位时间截不是存储当前时间的时间截,而是存储时间截的差值(当前时间截 - 开始时间截)
+ * 得到的值),这里的的开始时间截,一般是我们的id生成器开始使用的时间,由我们程序来指定的(如下下面程序IdWorker类的startTime属性)。41位的时间截,可以使用69年,年T = (1L << 41) / (1000L * 60 * 60 * 24 * 365) = 69<br>
+ * 10位的数据机器位,可以部署在1024个节点,包括5位datacenterId和5位workerId<br>
+ * 12位序列,毫秒内的计数,12位的计数顺序号支持每个节点每毫秒(同一机器,同一时间截)产生4096个ID序号<br>
+ * 加起来刚好64位,为一个Long型。<br>
+ * SnowFlake的优点是,整体上按照时间自增排序,并且整个分布式系统内不会产生ID碰撞(由数据中心ID和机器ID作区分),并且效率较高,经测试,SnowFlake每秒能够产生26万ID左右。
+ */
+public class IdWorker {
+
+    // ==============================Fields===========================================
+    private static SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
+
+    /** 开始时间截 (2019-09-23) */
+    private final long twepoch = 1569242822135L;
+
+    /** 机器id所占的位数 */
+    private final long workerIdBits = 5L;
+
+    /** 数据标识id所占的位数 */
+    private final long datacenterIdBits = 5L;
+
+    /** 支持的最大机器id,结果是31 (这个移位算法可以很快的计算出几位二进制数所能表示的最大十进制数) */
+    private final long maxWorkerId = -1L ^ (-1L << workerIdBits);
+
+    /** 支持的最大数据标识id,结果是31 */
+    private final long maxDatacenterId = -1L ^ (-1L << datacenterIdBits);
+
+    /** 序列在id中占的位数 */
+    private final long sequenceBits = 12L;
+
+    /** 机器ID向左移12位 */
+    private final long workerIdShift = sequenceBits;
+
+    /** 数据标识id向左移17位(12+5) */
+    private final long datacenterIdShift = sequenceBits + workerIdBits;
+
+    /** 时间截向左移22位(5+5+12) */
+    private final long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
+
+    /** 生成序列的掩码,这里为4095 (0b111111111111=0xfff=4095) */
+    private final long sequenceMask = -1L ^ (-1L << sequenceBits);
+
+    /** 工作机器ID(0~31) */
+    private long workerId;
+
+    /** 数据中心ID(0~31) */
+    private long datacenterId;
+
+    /** 毫秒内序列(0~4095) */
+    private long sequence = 0L;
+
+    /** 上次生成ID的时间截 */
+    private long lastTimestamp = -1L;
+
+    //==============================Constructors=====================================
+    /**
+     * 构造函数
+     * @param workerId 工作ID (0~31)
+     * @param datacenterId 数据中心ID (0~31)
+     */
+    public IdWorker(long workerId, long datacenterId) {
+        if (workerId > maxWorkerId || workerId < 0) {
+            throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId));
+        }
+        if (datacenterId > maxDatacenterId || datacenterId < 0) {
+            throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId));
+        }
+        this.workerId = workerId;
+        this.datacenterId = datacenterId;
+    }
+
+    // ==============================Methods==========================================
+    /**
+     * 获得下一个ID (该方法是线程安全的)
+     * @return SnowflakeId
+     */
+    public synchronized String   nextId() {
+        long timestamp = timeGen();
+
+        //获取时间部分字符串
+        String nowStr = sdf.format(timestamp);
+        //如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常
+        if (timestamp < lastTimestamp) {
+            throw new RuntimeException(
+                    String.format("Clock moved backwards.  Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
+        }
+
+        //如果是同一时间生成的,则进行毫秒内序列
+        if (lastTimestamp == timestamp) {
+            sequence = (sequence + 1) & sequenceMask;
+            //毫秒内序列溢出
+            if (sequence == 0) {
+                //阻塞到下一个毫秒,获得新的时间戳
+                timestamp = tilNextMillis(lastTimestamp);
+            }
+        }
+        //时间戳改变,毫秒内序列重置
+        else {
+            sequence = 0L;
+        }
+
+        //上次生成ID的时间截
+        lastTimestamp = timestamp;
+
+        //移位并通过或运算拼到一起组成64位的ID
+        long id = ((timestamp - twepoch) << timestampLeftShift) | (datacenterId << datacenterIdShift) | (workerId << workerIdShift)| sequence;
+        return nowStr + id;
+    }
+
+    /**
+     * 阻塞到下一个毫秒,直到获得新的时间戳
+     * @param lastTimestamp 上次生成ID的时间截
+     * @return 当前时间戳
+     */
+    protected long tilNextMillis(long lastTimestamp) {
+        long timestamp = timeGen();
+        while (timestamp <= lastTimestamp) {
+            timestamp = timeGen();
+        }
+        return timestamp;
+    }
+
+    /**
+     * 返回以毫秒为单位的当前时间
+     * @return 当前时间(毫秒)
+     */
+    protected long timeGen() {
+        return System.currentTimeMillis();
+    }
+
+    //==============================Test=============================================
+    /** 测试 */
+    public static void main(String[] args) {
+        IdWorker idWorker = new IdWorker(0, 0);
+
+        for (int i = 0; i < 100; i++) {
+            String  id = idWorker.nextId();
+            System.out.println(id);
+        }
+    }
+}

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

@@ -106,5 +106,20 @@ public class ClassGroupController extends BaseController {
         return succeed(classGroupTeacherMapperService.classGroupTeachersInsert(classGroupTeacherMapperList));
     }
 
+    @ApiOperation(value = "获取乐团班级老师课酬")
+    @GetMapping("/findMusicGroupClassTeacher")
+    public Object findMusicGroupClassTeacher(@ApiParam(value = "乐团编号", required = true) @RequestParam Integer musicGroupId) {
+        return succeed(classGroupService.getClassGroupAndTeachers(musicGroupId));
+    }
+
+    @ApiOperation(value = "乐团班级老师课酬确认")
+    @GetMapping("/setClassGroupTeacherSalary")
+    public Object setClassGroupTeacherSalary(@ApiParam(value = "乐团班级老师json", required = true) @RequestParam List<ClassGroupTeacherMapper> classGroupTeacherMapperList) throws Exception {
+        if (classGroupTeacherMapperList.size() <= 0) {
+            return failed("参数不合法");
+        }
+        return succeed(classGroupTeacherMapperService.classGroupTeacherMapperUpdate(classGroupTeacherMapperList));
+    }
+
 
 }

+ 2 - 0
mec-web/src/main/java/com/ym/mec/web/controller/CooperationOrganController.java

@@ -1,5 +1,7 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.common.security.AuthUser;
+import com.ym.mec.common.security.SecurityUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;