浏览代码

fix musicGroup reg

周箭河 5 年之前
父节点
当前提交
c373ff2ede

+ 6 - 0
mec-biz/pom.xml

@@ -34,5 +34,11 @@
 			<groupId>com.ym</groupId>
 			<artifactId>mec-thirdparty</artifactId>
 		</dependency>
+        <dependency>
+            <groupId>com.ym</groupId>
+            <artifactId>mec-auth-server</artifactId>
+            <version>1.0</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 </project>

+ 283 - 233
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentRegistration.java

@@ -12,265 +12,315 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
  */
 public class StudentRegistration {
 
-	/**  */
-	@ApiModelProperty(value = "报名id",hidden = true)
-	private Long id;
+    /**
+     *
+     */
+    @ApiModelProperty(value = "报名id", hidden = true)
+    private Long id;
+
+    /**
+     *
+     */
+    @ApiModelProperty(value = "机构id", hidden = true)
+    private Integer organId;
+    /**
+     *
+     */
+    @ApiModelProperty(value = "学生编号", hidden = true)
+    private Integer userId;
+
+    @ApiModelProperty(value = "学生姓名", required = true)
+    private String name;
+
+    @ApiModelProperty(value = "性别(0,女  1,男", required = true)
+    private Integer gender;
+
+    @ApiModelProperty(value = "身份证号", required = true)
+    private String idCardNo;
+
+    /**
+     * 所属乐团(对应 music_group 表id)
+     */
+    @ApiModelProperty(value = "所属乐团(对应 music_group 表id)", required = true)
+    private Integer musicGroupId;
+
+    /**
+     * 当前所在年级
+     */
+    @ApiModelProperty(value = "当前所在年级", required = true)
+    private String currentGrade;
+
+    /**
+     * 当前所在班级
+     */
+    @ApiModelProperty(value = "当前所在班级", required = true)
+    private String currentClass;
+
+    /**
+     * 报名科目
+     */
+    @ApiModelProperty(value = "报名科目", required = true)
+    private Integer subjectId;
+
+    /**
+     * 报名科目
+     */
+    @ApiModelProperty(value = "实际科目", hidden = true)
+    private Integer actualSubjectId;
+
+    /**
+     * 是否允许调剂
+     */
+    @ApiModelProperty(value = "是否允许调剂", required = true)
+    private YesOrNoEnum isAllowAdjust;
+
+    /**
+     * 器材购买方式(团购、自备)
+     */
+    @ApiModelProperty(value = "器材购买方式(GROUP:团购,OWNED:自备)", required = true)
+    private KitPurchaseMethodEnum kitPurchaseMethod;
+
+    /**
+     *
+     */
+    @ApiModelProperty(value = "备注", hidden = false)
+    private String remark;
+
+    /**
+     *
+     */
+    @ApiModelProperty(value = "添加时间", hidden = true)
+    private java.util.Date createTime;
+
+    /**
+     *
+     */
+    @ApiModelProperty(value = "更新时间", hidden = true)
+    private java.util.Date updateTime;
+
+    /**
+     * 家长姓名
+     */
+    @ApiModelProperty(value = "家长姓名", required = true)
+    private String parentsName;
+
+    /**
+     * 家长姓名
+     */
+    @ApiModelProperty(value = "家长电话", required = true)
+    private String parentsPhone;
+
+    /**
+     * 家长单位
+     */
+    @ApiModelProperty(value = "家长单位", required = false)
+    private String parentsCompany;
+
+    /**
+     * 缴费状态(1-已缴费 0-未交费)
+     */
+    @ApiModelProperty(value = "缴费状态(1-已缴费 0-未交费)", hidden = true)
+    private YesOrNoEnum paymentStatus;
+
+    @ApiModelProperty(value = "班级id", hidden = true)
+    private Integer ClassGroupId;
+
+    /**
+     * 最后缴费日期
+     */
+    @ApiModelProperty(value = "最后缴费日期", hidden = true)
+    private java.util.Date lastPaymentDate;
+
+    /**
+     * 预计下次缴费日期
+     */
+    @ApiModelProperty(value = "预计下次缴费日期", hidden = true)
+    private java.util.Date nextPaymentDate;
+
+    public Integer getActualSubjectId() {
+        return actualSubjectId;
+    }
+
+    public void setActualSubjectId(Integer actualSubjectId) {
+        this.actualSubjectId = actualSubjectId;
+    }
+
+    public String getParentsPhone() {
+        return parentsPhone;
+    }
+
+    public void setParentsPhone(String parentsPhone) {
+        this.parentsPhone = parentsPhone;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getId() {
+        return this.id;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public Integer getUserId() {
+        return this.userId;
+    }
+
+    public void setMusicGroupId(Integer musicGroupId) {
+        this.musicGroupId = musicGroupId;
+    }
+
+    public Integer getMusicGroupId() {
+        return this.musicGroupId;
+    }
+
+    public void setCurrentGrade(String currentGrade) {
+        this.currentGrade = currentGrade;
+    }
+
+    public String getCurrentGrade() {
+        return this.currentGrade;
+    }
+
+    public void setCurrentClass(String currentClass) {
+        this.currentClass = currentClass;
+    }
+
+    public String getCurrentClass() {
+        return this.currentClass;
+    }
+
+    public void setSubjectId(Integer subjectId) {
+        this.subjectId = subjectId;
+    }
+
+    public Integer getSubjectId() {
+        return this.subjectId;
+    }
+
+    public YesOrNoEnum getIsAllowAdjust() {
+        return isAllowAdjust;
+    }
+
+    public void setIsAllowAdjust(YesOrNoEnum isAllowAdjust) {
+        this.isAllowAdjust = isAllowAdjust;
+    }
+
+    public void setPaymentStatus(YesOrNoEnum paymentStatus) {
+        this.paymentStatus = paymentStatus;
+    }
+
+    public KitPurchaseMethodEnum getKitPurchaseMethod() {
+        return kitPurchaseMethod;
+    }
+
+    public void setKitPurchaseMethod(KitPurchaseMethodEnum kitPurchaseMethod) {
+        this.kitPurchaseMethod = kitPurchaseMethod;
+    }
 
-	/**  */
-	@ApiModelProperty(value = "学生编号",hidden = true)
-	private Integer userId;
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
 
-	@ApiModelProperty(value = "学生姓名",required = true)
-	private String name;
+    public String getRemark() {
+        return this.remark;
+    }
 
-	@ApiModelProperty(value = "性别(0,女  1,男",required = true)
-	private String gender;
+    public void setCreateTime(java.util.Date createTime) {
+        this.createTime = createTime;
+    }
 
-	@ApiModelProperty(value = "身份证号",required = true)
-	private String idCardNo;
+    public java.util.Date getCreateTime() {
+        return this.createTime;
+    }
 
-	/** 所属乐团(对应 music_group 表id) */
-	@ApiModelProperty(value = "所属乐团(对应 music_group 表id)",required = true)
-	private Integer musicGroupId;
+    public void setUpdateTime(java.util.Date updateTime) {
+        this.updateTime = updateTime;
+    }
 
-	/** 当前所在年级 */
-	@ApiModelProperty(value = "当前所在年级",required = true)
-	private String currentGrade;
+    public java.util.Date getUpdateTime() {
+        return this.updateTime;
+    }
 
-	/** 当前所在班级 */
-	@ApiModelProperty(value = "当前所在班级",required = true)
-	private String currentClass;
+    public void setParentsName(String parentsName) {
+        this.parentsName = parentsName;
+    }
 
-	/** 报名科目 */
-	@ApiModelProperty(value = "报名科目",required = true)
-	private Integer subjectId;
+    public String getParentsName() {
+        return this.parentsName;
+    }
 
-	/** 报名科目 */
-	@ApiModelProperty(value = "实际科目",hidden = true)
-	private Integer actualSubjectId;
+    public void setParentsCompany(String parentsCompany) {
+        this.parentsCompany = parentsCompany;
+    }
 
-	/** 是否允许调剂 */
-	@ApiModelProperty(value = "是否允许调剂",required = true)
-	private YesOrNoEnum isAllowAdjust;
+    public String getParentsCompany() {
+        return this.parentsCompany;
+    }
 
-	/** 器材购买方式(团购、自备) */
-	@ApiModelProperty(value = "器材购买方式(GROUP:团购,OWNED:自备)",required = true)
-	private KitPurchaseMethodEnum kitPurchaseMethod;
+    public YesOrNoEnum getPaymentStatus() {
+        return paymentStatus;
+    }
 
-	/**  */
-	@ApiModelProperty(value = "备注",hidden = false)
-	private String remark;
+    public void setLastPaymentDate(java.util.Date lastPaymentDate) {
+        this.lastPaymentDate = lastPaymentDate;
+    }
 
-	/**  */
-	@ApiModelProperty(value = "添加时间",hidden = true)
-	private java.util.Date createTime;
+    public java.util.Date getLastPaymentDate() {
+        return this.lastPaymentDate;
+    }
 
-	/**  */
-	@ApiModelProperty(value = "更新时间",hidden = true)
-	private java.util.Date updateTime;
+    public void setNextPaymentDate(java.util.Date nextPaymentDate) {
+        this.nextPaymentDate = nextPaymentDate;
+    }
 
-	/** 家长姓名 */
-	@ApiModelProperty(value = "家长姓名",required = true)
-	private String parentsName;
+    public java.util.Date getNextPaymentDate() {
+        return this.nextPaymentDate;
+    }
 
-	/** 家长姓名 */
-	@ApiModelProperty(value = "家长电话",required = true)
-	private String parentsPhone;
+    public Integer getClassGroupId() {
+        return ClassGroupId;
+    }
 
-	/** 家长单位 */
-	@ApiModelProperty(value = "家长单位",required = false)
-	private String parentsCompany;
+    public void setClassGroupId(Integer classGroupId) {
+        ClassGroupId = classGroupId;
+    }
 
-	/** 缴费状态(1-已缴费 0-未交费) */
-	@ApiModelProperty(value = "缴费状态(1-已缴费 0-未交费)",hidden = true)
-	private YesOrNoEnum paymentStatus;
+    public String getName() {
+        return name;
+    }
 
-	@ApiModelProperty(value = "班级id",hidden = true)
-	private Integer ClassGroupId;
+    public void setName(String name) {
+        this.name = name;
+    }
 
-	/** 最后缴费日期 */
-	@ApiModelProperty(value = "最后缴费日期",hidden = true)
-	private java.util.Date lastPaymentDate;
+    public String getIdCardNo() {
+        return idCardNo;
+    }
 
-	/** 预计下次缴费日期 */
-	@ApiModelProperty(value = "预计下次缴费日期",hidden = true)
-	private java.util.Date nextPaymentDate;
+    public void setIdCardNo(String idCardNo) {
+        this.idCardNo = idCardNo;
+    }
 
-	public Integer getActualSubjectId() {
-		return actualSubjectId;
-	}
-
-	public void setActualSubjectId(Integer actualSubjectId) {
-		this.actualSubjectId = actualSubjectId;
-	}
-
-	public String getParentsPhone() {
-		return parentsPhone;
-	}
-
-	public void setParentsPhone(String parentsPhone) {
-		this.parentsPhone = parentsPhone;
-	}
-
-	public void setId(Long id){
-		this.id = id;
-	}
-
-	public Long getId(){
-		return this.id;
-	}
-
-	public void setUserId(Integer userId){
-		this.userId = userId;
-	}
-
-	public Integer getUserId(){
-		return this.userId;
-	}
-
-	public void setMusicGroupId(Integer musicGroupId){
-		this.musicGroupId = musicGroupId;
-	}
-
-	public Integer getMusicGroupId(){
-		return this.musicGroupId;
-	}
-
-	public void setCurrentGrade(String currentGrade){
-		this.currentGrade = currentGrade;
-	}
+    public Integer getGender() {
+        return gender;
+    }
 
-	public String getCurrentGrade(){
-		return this.currentGrade;
-	}
-
-	public void setCurrentClass(String currentClass){
-		this.currentClass = currentClass;
-	}
+    public void setGender(Integer gender) {
+        this.gender = gender;
+    }
 
-	public String getCurrentClass(){
-		return this.currentClass;
-	}
-
-	public void setSubjectId(Integer subjectId){
-		this.subjectId = subjectId;
-	}
 
-	public Integer getSubjectId(){
-		return this.subjectId;
-	}
-
-	public YesOrNoEnum getIsAllowAdjust() {
-		return isAllowAdjust;
-	}
-
-	public void setIsAllowAdjust(YesOrNoEnum isAllowAdjust) {
-		this.isAllowAdjust = isAllowAdjust;
-	}
-
-	public void setPaymentStatus(YesOrNoEnum paymentStatus) {
-		this.paymentStatus = paymentStatus;
-	}
-
-	public KitPurchaseMethodEnum getKitPurchaseMethod() {
-		return kitPurchaseMethod;
-	}
-
-	public void setKitPurchaseMethod(KitPurchaseMethodEnum kitPurchaseMethod) {
-		this.kitPurchaseMethod = kitPurchaseMethod;
-	}
-
-	public void setRemark(String remark){
-		this.remark = remark;
-	}
-
-	public String getRemark(){
-		return this.remark;
-	}
+    public Integer getOrganId() {
+        return organId;
+    }
 
-	public void setCreateTime(java.util.Date createTime){
-		this.createTime = createTime;
-	}
-
-	public java.util.Date getCreateTime(){
-		return this.createTime;
-	}
-
-	public void setUpdateTime(java.util.Date updateTime){
-		this.updateTime = updateTime;
-	}
-
-	public java.util.Date getUpdateTime(){
-		return this.updateTime;
-	}
-
-	public void setParentsName(String parentsName){
-		this.parentsName = parentsName;
-	}
-
-	public String getParentsName(){
-		return this.parentsName;
-	}
-
-	public void setParentsCompany(String parentsCompany){
-		this.parentsCompany = parentsCompany;
-	}
-
-	public String getParentsCompany(){
-		return this.parentsCompany;
-	}
-
-	public YesOrNoEnum getPaymentStatus() {
-		return paymentStatus;
-	}
-
-	public void setLastPaymentDate(java.util.Date lastPaymentDate){
-		this.lastPaymentDate = lastPaymentDate;
-	}
-
-	public java.util.Date getLastPaymentDate(){
-		return this.lastPaymentDate;
-	}
-
-	public void setNextPaymentDate(java.util.Date nextPaymentDate){
-		this.nextPaymentDate = nextPaymentDate;
-	}
-
-	public java.util.Date getNextPaymentDate(){
-		return this.nextPaymentDate;
-	}
-
-	public Integer getClassGroupId() {
-		return ClassGroupId;
-	}
-
-	public void setClassGroupId(Integer classGroupId) {
-		ClassGroupId = classGroupId;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public String getIdCardNo() {
-		return idCardNo;
-	}
-
-	public void setIdCardNo(String idCardNo) {
-		this.idCardNo = idCardNo;
-	}
-
-	public String getGender() {
-		return gender;
-	}
-
-	public void setGender(String gender) {
-		this.gender = gender;
-	}
+    public void setOrganId(Integer organId) {
+        this.organId = organId;
+    }
 
 	@Override
 	public String toString() {

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

@@ -68,4 +68,11 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
      */
     Integer updateByUserIdAndMusicGroupId(StudentRegistration studentRegistration);
 
+    /**
+     * 添加学生报名信息
+     * @param studentRegistration
+     * @return
+     */
+    StudentRegistration addStudent(StudentRegistration studentRegistration);
+
 }

+ 35 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -1,5 +1,10 @@
 package com.ym.mec.biz.service.impl;
 
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.auth.api.enums.SysUserType;
+import com.ym.mec.auth.api.enums.UserLockFlag;
+import com.ym.mec.auth.service.SysUserService;
+import com.ym.mec.biz.dal.dao.StudentRechargeDao;
 import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
 import com.ym.mec.biz.dal.dto.StudentApplyDetailDto;
 import com.ym.mec.biz.dal.dto.StudentFeeDto;
@@ -14,14 +19,18 @@ import com.ym.mec.util.collection.MapUtil;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
+import javax.annotation.Resource;
 import java.util.*;
 
 @Service
 public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, StudentRegistration> implements StudentRegistrationService {
 
-    @Autowired
+    @Resource
     private StudentRegistrationDao studentRegistrationDao;
+    @Autowired
+    private SysUserService sysUserService;
 
     @Override
     public BaseDAO<Long, StudentRegistration> getDAO() {
@@ -77,11 +86,35 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
     @Override
     public Integer getNoClassStuCountBySubjectId(Integer musicGroupId, Integer actualSubjectId) {
-        return studentRegistrationDao.getNoClassStuCountBySubjectId(musicGroupId,actualSubjectId);
+        return studentRegistrationDao.getNoClassStuCountBySubjectId(musicGroupId, actualSubjectId);
     }
 
     @Override
     public Integer updateByUserIdAndMusicGroupId(StudentRegistration studentRegistration) {
         return studentRegistrationDao.updateByUserIdAndMusicGroupId(studentRegistration);
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public StudentRegistration addStudent(StudentRegistration studentRegistration) {
+        Date date = new Date();
+        SysUser sysUser = sysUserService.queryByPhone(studentRegistration.getParentsPhone());
+        if (sysUser == null) {
+            sysUser = new SysUser();
+            sysUser.setPhone(studentRegistration.getParentsPhone());
+            sysUser.setCreateTime(date);
+            sysUser.setUpdateTime(date);
+            sysUser.setLockFlag(UserLockFlag.NOACTIVATED);
+            sysUser.setDelFlag(com.ym.mec.auth.api.enums.YesOrNoEnum.NO);
+            sysUser.setUserType(SysUserType.STUDENT);
+            sysUser.setGender(studentRegistration.getGender());
+            sysUser.setOrganId(studentRegistration.getOrganId());
+            sysUser.setRealName(studentRegistration.getName());
+            sysUser.setIdCardNo(studentRegistration.getIdCardNo());
+            sysUserService.add(sysUser);
+        }
+        studentRegistration.setUserId(sysUser.getId());
+        studentRegistrationDao.insert(studentRegistration);
+        return studentRegistration;
+    }
 }

+ 7 - 1
mec-student/pom.xml

@@ -50,7 +50,13 @@
 			<groupId>com.ym</groupId>
 			<artifactId>mec-biz</artifactId>
 		</dependency>
-	</dependencies>
+        <dependency>
+            <groupId>com.ym</groupId>
+            <artifactId>mec-auth-server</artifactId>
+            <version>1.0</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
 	<build>
 		<plugins>
 			<plugin>

+ 7 - 5
mec-student/src/main/java/com/ym/mec/student/controller/RegisterController.java

@@ -1,11 +1,11 @@
 package com.ym.mec.student.controller;
 
-import com.alibaba.fastjson.JSON;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.auth.service.SysUserService;
 import com.ym.mec.biz.dal.dto.MusicGroupSubjectGoodsAndInfo;
 import com.ym.mec.biz.dal.entity.*;
-import com.ym.mec.biz.service.MusicGroupSubjectGoodsGroupService;
+import com.ym.mec.biz.service.MusicGroupService;
 import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
 import com.ym.mec.biz.service.StudentRegistrationService;
 import com.ym.mec.biz.service.SubjectService;
@@ -21,7 +21,6 @@ import org.springframework.web.bind.annotation.*;
 import javax.annotation.Resource;
 import java.util.Date;
 import java.util.LinkedHashMap;
-import java.util.List;
 import java.util.Map;
 
 @RequestMapping("register")
@@ -37,13 +36,16 @@ public class RegisterController extends BaseController {
     private MusicGroupSubjectPlanService musicGroupSubjectPlanService;
     @Resource
     private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private MusicGroupService musicGroupService;
 
 
     @ApiOperation(value = "新增学生报名信息")
     @PostMapping("/add")
     public Object add(StudentRegistration studentRegistration) {
-        studentRegistrationService.insert(studentRegistration);
-        return succeed(studentRegistration);
+        MusicGroup musicGroup = musicGroupService.get(studentRegistration.getMusicGroupId().toString());
+        studentRegistration.setOrganId(musicGroup.getOrganId());
+        return succeed(studentRegistrationService.addStudent(studentRegistration));
     }
 
     @ApiOperation(value = "获取乐团报名所需信息")