Browse Source

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

zouxuan 5 years ago
parent
commit
609a9194e3

+ 33 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentCompetitionDao.java

@@ -0,0 +1,33 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.biz.dal.entity.StudentCompetition;
+import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+public interface StudentCompetitionDao extends BaseDAO<Long, StudentCompetition> {
+
+    List<StudentCompetition> queryStudentCompetitions(Map<String, Object> params);
+
+    int countStudentCompetitions(Map<String, Object> params);
+
+    /**
+     * @describe 获取指定用户的参赛作品
+     * @author Joburgess
+     * @date 2020.11.10
+     * @param userId:
+     * @return com.ym.mec.biz.dal.entity.StudentCompetition
+     */
+    StudentCompetition getCompetitionWithUser(@Param("userId") Integer userId);
+
+    /**
+     * @describe 获取获奖名单
+     * @author Joburgess
+     * @date 2020.11.10
+     * @return java.util.List<com.ym.mec.biz.dal.dto.StudentCompetitionRankingDto>
+     */
+    List<StudentCompetition> getWinnerList();
+	
+}

+ 47 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentCompetitionRankingDto.java

@@ -0,0 +1,47 @@
+package com.ym.mec.biz.dal.dto;
+
+/**
+ * @Author Joburgess
+ * @Date 2020.11.10
+ */
+public class StudentCompetitionRankingDto {
+
+    private Long competitionId;
+
+    private String username;
+
+    private String pictureUrl;
+
+    public StudentCompetitionRankingDto() {
+    }
+
+    public StudentCompetitionRankingDto(Long competitionId, String username, String pictureUrl) {
+        this.competitionId = competitionId;
+        this.username = username;
+        this.pictureUrl = pictureUrl;
+    }
+
+    public Long getCompetitionId() {
+        return competitionId;
+    }
+
+    public void setCompetitionId(Long competitionId) {
+        this.competitionId = competitionId;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getPictureUrl() {
+        return pictureUrl;
+    }
+
+    public void setPictureUrl(String pictureUrl) {
+        this.pictureUrl = pictureUrl;
+    }
+}

+ 210 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentCompetition.java

@@ -0,0 +1,210 @@
+package com.ym.mec.biz.dal.entity;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import io.swagger.annotations.ApiModelProperty;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(student_competition):
+ */
+public class StudentCompetition {
+
+	private Long id;
+
+	@ApiModelProperty(value = "用户编号")
+	private Integer userId;
+
+	@ApiModelProperty(value = "姓名")
+	private String username;
+
+	@ApiModelProperty(value = "身份证号")
+	private String idCardNo;
+
+	@ApiModelProperty(value = "年龄")
+	private Integer age;
+
+	@ApiModelProperty(value = "性别")
+	private boolean gender;
+
+	@ApiModelProperty(value = "年级")
+	private String grade;
+
+	@ApiModelProperty(value = "专业")
+	private String subject;
+
+	@ApiModelProperty(value = "曲目")
+	private String chapter;
+
+	@ApiModelProperty(value = "头像")
+	private String pictureUrl;
+
+	@ApiModelProperty(value = "作品")
+	private String videoUrl;
+
+	@ApiModelProperty(value = "分数")
+	private java.math.BigDecimal score;
+
+	@ApiModelProperty(value = "获奖等级")
+	private java.math.BigDecimal prizeLevel;
+
+	@ApiModelProperty(value = "是否展示")
+	private boolean isShow;
+
+	@ApiModelProperty(value = "评价")
+	private String comment;
+
+	private java.util.Date createTime;
+
+	private java.util.Date updateTime;
+	
+	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 setUsername(String username){
+		this.username = username;
+	}
+	
+	public String getUsername(){
+		return this.username;
+	}
+			
+	public void setIdCardNo(String idCardNo){
+		this.idCardNo = idCardNo;
+	}
+	
+	public String getIdCardNo(){
+		return this.idCardNo;
+	}
+			
+	public void setAge(Integer age){
+		this.age = age;
+	}
+	
+	public Integer getAge(){
+		return this.age;
+	}
+			
+	public void setGender(boolean gender){
+		this.gender = gender;
+	}
+	
+	public boolean isGender(){
+		return this.gender;
+	}
+			
+	public void setGrade(String grade){
+		this.grade = grade;
+	}
+	
+	public String getGrade(){
+		return this.grade;
+	}
+			
+	public void setSubject(String subject){
+		this.subject = subject;
+	}
+	
+	public String getSubject(){
+		return this.subject;
+	}
+			
+	public void setChapter(String chapter){
+		this.chapter = chapter;
+	}
+	
+	public String getChapter(){
+		return this.chapter;
+	}
+			
+	public void setPictureUrl(String pictureUrl){
+		this.pictureUrl = pictureUrl;
+	}
+	
+	public String getPictureUrl(){
+		return this.pictureUrl;
+	}
+
+	public String getVideoUrl() {
+		return videoUrl;
+	}
+
+	public void setVideoUrl(String videoUrl) {
+		this.videoUrl = videoUrl;
+	}
+
+	public boolean isShow() {
+		return isShow;
+	}
+
+	public void setShow(boolean show) {
+		isShow = show;
+	}
+
+	public void setScore(java.math.BigDecimal score){
+		this.score = score;
+	}
+	
+	public java.math.BigDecimal getScore(){
+		return this.score;
+	}
+			
+	public void setPrizeLevel(java.math.BigDecimal prizeLevel){
+		this.prizeLevel = prizeLevel;
+	}
+	
+	public java.math.BigDecimal getPrizeLevel(){
+		return this.prizeLevel;
+	}
+			
+	public void setIsShow(boolean isShow){
+		this.isShow = isShow;
+	}
+	
+	public boolean isIsShow(){
+		return this.isShow;
+	}
+			
+	public void setComment(String comment){
+		this.comment = comment;
+	}
+	
+	public String getComment(){
+		return this.comment;
+	}
+			
+	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;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 101 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentCompetitionQueryInfo.java

@@ -0,0 +1,101 @@
+package com.ym.mec.biz.dal.page;
+
+import com.ym.mec.common.page.QueryInfo;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @Author Joburgess
+ * @Date 2020.11.10
+ */
+public class StudentCompetitionQueryInfo extends QueryInfo {
+
+    @ApiModelProperty(value = "性别")
+    private boolean gender;
+
+    @ApiModelProperty(value = "年级")
+    private String grade;
+
+    @ApiModelProperty(value = "专业")
+    private String subject;
+
+    @ApiModelProperty(value = "分数")
+    private java.math.BigDecimal score;
+
+    @ApiModelProperty(value = "获奖等级")
+    private Integer prizeLevel;
+
+    @ApiModelProperty(value = "是否展示")
+    private boolean isShow;
+
+    @ApiModelProperty(value = "评价")
+    private String comment;
+
+    private java.util.Date createTime;
+
+    public boolean isGender() {
+        return gender;
+    }
+
+    public void setGender(boolean gender) {
+        this.gender = gender;
+    }
+
+    public String getGrade() {
+        return grade;
+    }
+
+    public void setGrade(String grade) {
+        this.grade = grade;
+    }
+
+    public String getSubject() {
+        return subject;
+    }
+
+    public void setSubject(String subject) {
+        this.subject = subject;
+    }
+
+    public BigDecimal getScore() {
+        return score;
+    }
+
+    public void setScore(BigDecimal score) {
+        this.score = score;
+    }
+
+    public Integer getPrizeLevel() {
+        return prizeLevel;
+    }
+
+    public void setPrizeLevel(Integer prizeLevel) {
+        this.prizeLevel = prizeLevel;
+    }
+
+    public boolean isShow() {
+        return isShow;
+    }
+
+    public void setShow(boolean show) {
+        isShow = show;
+    }
+
+    public String getComment() {
+        return comment;
+    }
+
+    public void setComment(String comment) {
+        this.comment = comment;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+}

+ 33 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentCompetitionService.java

@@ -0,0 +1,33 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.dto.StudentCompetitionRankingDto;
+import com.ym.mec.biz.dal.entity.StudentCompetition;
+import com.ym.mec.biz.dal.page.StudentCompetitionQueryInfo;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.service.BaseService;
+
+import java.util.List;
+
+public interface StudentCompetitionService extends BaseService<Long, StudentCompetition> {
+
+    /**
+     * @describe 新增选手参赛作品
+     * @author Joburgess
+     * @date 2020.11.10
+     * @param studentCompetition:
+     * @return void
+     */
+    void addStudentCompetition(StudentCompetition studentCompetition);
+
+    PageInfo<StudentCompetition> queryPage(StudentCompetitionQueryInfo queryInfo);
+
+    /**
+     * @describe
+     * @author Joburgess
+     * @date 2020.11.10
+     * @return void
+     */
+    List<StudentCompetitionRankingDto> getWinnerList();
+
+    StudentCompetition checkIsUpload(Integer userId);
+}

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

@@ -1739,6 +1739,10 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                     .toMinutes();
             classGroup4MixDto.setCourseTimes(totalMinutes/(int)courseDuration);
 
+            if(classGroup4MixDto.getCourseTimes()<=0){
+                throw new BizException("{}课程类型剩余课程时长不足", classGroup4MixDto.getCourseType().getMsg());
+            }
+
             int times = 0;
 
             Set<String> holidayDays = new HashSet<>();
@@ -2022,6 +2026,10 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                     .toMinutes();
             classGroup4MixDto.setCourseTimes(totalMinutes/(int)courseDuration);
 
+            if(classGroup4MixDto.getCourseTimes()<=0){
+                throw new BizException("{}课程类型剩余课程时长不足", classGroup4MixDto.getCourseType().getMsg());
+            }
+
             int times = 0;
             Set<String> holidayDays = new HashSet<>();
             if (classGroup4MixDto.getHoliday()) {
@@ -2308,6 +2316,10 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                     .toMinutes();
             classGroup4MixDto.setCourseTimes(totalMinutes/(int)courseDuration);
 
+            if(classGroup4MixDto.getCourseTimes()<=0){
+                throw new BizException("{}课程类型剩余课程时长不足", classGroup4MixDto.getCourseType().getMsg());
+            }
+
             int times = 0;
             Set<String> holidayDays = new HashSet<>();
             if (classGroup4MixDto.getHoliday()) {

+ 31 - 17
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -161,7 +161,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     private SimpleDateFormat sdf_ymd = new SimpleDateFormat("yyyy-MM-dd");
 
     private SimpleDateFormat sdf_hms = new SimpleDateFormat("HH:mm:ss");
-    
+
     private SimpleDateFormat sdf_ymdhms = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
     @Override
@@ -313,20 +313,20 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         }
 
         Date date = new Date();
-        
+
         OrderTypeEnum type = OrderTypeEnum.SPORADIC;
         if (chargeInfo.getChargeType().equals(SporadicChargeTypeEnum.DOUBLE_ELEVEN2020)) {
             type = OrderTypeEnum.DOUBLE_ELEVEN2020;
-            
+
             String startTimeStr = sysConfigDao.findConfigValue(SysConfigService.START_TIME_OF_1111);
             String endTimeStr = sysConfigDao.findConfigValue(SysConfigService.END_TIME_OF_1111);
             Date startTime = sdf_ymdhms.parse(startTimeStr);
             Date endTime = sdf_ymdhms.parse(endTimeStr);
-            if(date.before(startTime)){
-            	throw new Exception("活动暂未开始,请您耐心等待!");
+            if (date.before(startTime)) {
+                throw new Exception("活动暂未开始,请您耐心等待!");
             }
-            if(date.after(endTime)){
-            	throw new Exception("活动已结束,谢谢您的支持!");
+            if (date.after(endTime)) {
+                throw new Exception("活动已结束,谢谢您的支持!");
             }
         }
 
@@ -498,7 +498,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                     }
                     goodsGroup.setKitGroupPurchaseType(KitGroupPurchaseTypeEnum.valueOf(kitGroupPurchaseType));
                     remitFee = groupType.get(kitGroupPurchaseType) == null ? BigDecimal.ZERO : groupType.get(kitGroupPurchaseType);
-                    if (coursePurchase != null){
+                    if (coursePurchase != null) {
                         courseRemitFee = coursePurchase.get(kitGroupPurchaseType) == null ? BigDecimal.ZERO : coursePurchase.get(kitGroupPurchaseType);
                     }
                 }
@@ -1046,7 +1046,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         musicGroupDao.update(musicGroup);
         //获取报名缴费项目
         MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroupId);
-        if(regCalender != null && regCalender.getPayUserType().equals(MusicGroupPaymentCalender.PayUserType.STUDENT)){
+        if (regCalender != null && regCalender.getPayUserType().equals(MusicGroupPaymentCalender.PayUserType.STUDENT)) {
             regCalender.setStatus(MusicGroupPaymentCalender.PaymentCalenderStatusEnum.OPEN);
             regCalender.setUpdateTime(new Date());
             musicGroupPaymentCalenderDao.update(regCalender);
@@ -1393,7 +1393,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         musicGroupDao.update(musicGroup);
 
         MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderService.findByMusicGroupRegCalender(musicGroup.getId());
-        if (regCalender != null&& regCalender.getPayUserType().equals(MusicGroupPaymentCalender.PayUserType.STUDENT)) {
+        if (regCalender != null && regCalender.getPayUserType().equals(MusicGroupPaymentCalender.PayUserType.STUDENT)) {
             regCalender.setDeadlinePaymentDate(expireDate);
             regCalender.setStatus(MusicGroupPaymentCalender.PaymentCalenderStatusEnum.OPEN);
             regCalender.setUpdateTime(date);
@@ -1683,10 +1683,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         Integer organId = studentRegistration.getOrganId();
         MusicGroupPaymentCalenderDetail calenderDetail = musicGroupPaymentCalenderDetailDao.findByCalenderIdAndUserId(calenderId, userId);
         //关闭之前的订单
-        if(calenderDetail.getPaymentOrderId() != null){
+        if (calenderDetail.getPaymentOrderId() != null) {
             StudentPaymentOrder oldStudentPaymentOrder = studentPaymentOrderDao.get(calenderDetail.getPaymentOrderId());
-            if(oldStudentPaymentOrder != null){
-                if(oldStudentPaymentOrder.getStatus() == SUCCESS){
+            if (oldStudentPaymentOrder != null) {
+                if (oldStudentPaymentOrder.getStatus() == SUCCESS) {
                     throw new BizException("您已支付请勿重复提交");
                 }
                 oldStudentPaymentOrder.setStatus(CLOSE);
@@ -1760,7 +1760,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
 
         if (amount.compareTo(BigDecimal.ZERO) == 0) {
-            studentPaymentRouteOrderService.addRouteOrder(orderNo,organId, balance);
+            studentPaymentRouteOrderService.addRouteOrder(orderNo, organId, balance);
             Map<String, String> notifyMap = new HashMap<>(4);
             notifyMap.put("tradeState", "1");
             notifyMap.put("merOrderNo", studentPaymentOrder.getOrderNo());
@@ -1811,7 +1811,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (studentPaymentOrder.getStatus() == SUCCESS) {
             //当前乐团报名是否赠送乐团网管课
             MusicGroupPaymentCalenderDetail calenderDetail = musicGroupPaymentCalenderDetailDao.findByOrderId(studentPaymentOrder.getId());
-            MusicGroupStudentFee musicGroupStudentFee = musicGroupPaymentCalenderService.updateCalender(calenderDetail.getId(),studentRegistration.getUserId());
+            MusicGroupStudentFee musicGroupStudentFee = musicGroupPaymentCalenderService.updateCalender(calenderDetail.getId(), studentRegistration.getUserId());
 
             musicGroupStudentFee.setUpdateTime(date);
             musicGroupStudentFee.setLatestPaidTime(date);
@@ -2080,6 +2080,20 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 //        List<Integer> months = subFeeSettingDto.getMonths();
 
         Date date = new Date();
+        //缴费方式不同
+        if ((group.getStatus().equals(MusicGroupStatusEnum.AUDIT_FAILED) || group.getStatus().equals(MusicGroupStatusEnum.DRAFT))
+                && !group.getChargeTypeId().equals(musicGroup.getChargeTypeId())) {
+            //删除原有的乐团声部规划
+            musicGroupSubjectPlanDao.delByMusicGroupId(musicGroupId);
+            //删除原有的声部商品组合
+            musicGroupSubjectGoodsGroupDao.delByMusicGroupId(musicGroupId);
+            //删除原有的缴费项目
+            MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroupId);
+            if (regCalender != null) {
+                musicGroupPaymentCalenderDao.delByGroupId(musicGroupId);
+                musicGroupPaymentCalenderCourseSettingsDao.deleteByMusicGroupPaymentCalenderId(regCalender.getId());
+            }
+        }
 
         //判断缴费日历是否修改
         /*boolean isModifiedOfCalender = false;
@@ -2126,7 +2140,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         musicGroup.setUpdateTime(date);
         musicGroupDao.update(musicGroup);
         //修改课程里面的教学点
-        if (!musicGroup.getSchoolId().equals(musicGroup.getSchoolId())) {
+        if (!group.getSchoolId().equals(musicGroup.getSchoolId())) {
             courseScheduleDao.updateByMusicGroupId(musicGroupId, musicGroup.getSchoolId());
         }
         // 删除乐团付费主体列表
@@ -2195,7 +2209,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         //所有人开启缴费
         studentRegistrationDao.musicGroupOpenPay(musicGroupId, PaymentStatusEnum.OPEN);
         MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroupId);
-        if(regCalender != null && regCalender.getPayUserType().equals(MusicGroupPaymentCalender.PayUserType.STUDENT)){
+        if (regCalender != null && regCalender.getPayUserType().equals(MusicGroupPaymentCalender.PayUserType.STUDENT)) {
             regCalender.setStatus(MusicGroupPaymentCalender.PaymentCalenderStatusEnum.OPEN);
             regCalender.setUpdateTime(new Date());
             musicGroupPaymentCalenderDao.update(regCalender);

+ 89 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentCompetitionServiceImpl.java

@@ -0,0 +1,89 @@
+package com.ym.mec.biz.service.impl;
+
+import cfca.sadk.org.bouncycastle.apache.bzip2.BZip2Constants;
+import com.ym.mec.biz.dal.dto.StudentCompetitionRankingDto;
+import com.ym.mec.biz.dal.page.StudentCompetitionQueryInfo;
+import com.ym.mec.biz.service.ContractService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.util.collection.MapUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.formula.functions.T;
+import org.springframework.beans.factory.annotation.Autowired;
+import com.ym.mec.biz.dal.entity.StudentCompetition;
+import com.ym.mec.biz.service.StudentCompetitionService;
+import com.ym.mec.biz.dal.dao.StudentCompetitionDao;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+
+@Service
+public class StudentCompetitionServiceImpl extends BaseServiceImpl<Long, StudentCompetition> implements StudentCompetitionService {
+	
+	@Autowired
+	private StudentCompetitionDao studentCompetitionDao;
+
+	@Override
+	public BaseDAO<Long, StudentCompetition> getDAO() {
+		return studentCompetitionDao;
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
+	public void addStudentCompetition(StudentCompetition studentCompetition) {
+		StudentCompetition userCompetition = studentCompetitionDao.getCompetitionWithUser(studentCompetition.getUserId());
+		if(Objects.nonNull(userCompetition)){
+			throw new BizException("您已有正在审核中的参赛作品");
+		}
+		if(StringUtils.isBlank(studentCompetition.getSubject())){
+			throw new BizException("请选择参赛专业");
+		}
+		if(StringUtils.isBlank(studentCompetition.getChapter())){
+			throw new BizException("请选择参赛曲目");
+		}
+		if(StringUtils.isBlank(studentCompetition.getVideoUrl())){
+			throw new BizException("请指定参赛作品");
+		}
+		studentCompetitionDao.insert(studentCompetition);
+	}
+
+	@Override
+	public PageInfo<StudentCompetition> queryPage(StudentCompetitionQueryInfo queryInfo) {
+		PageInfo<StudentCompetition> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+		Map<String, Object> params = new HashMap<String, Object>();
+		MapUtil.populateMap(params, queryInfo);
+
+		List<StudentCompetition> dataList = null;
+		int count = studentCompetitionDao.countStudentCompetitions(params);
+		if (count > 0) {
+			pageInfo.setTotal(count);
+			params.put("offset", pageInfo.getOffset());
+			dataList = studentCompetitionDao.queryStudentCompetitions(params);
+		}
+		if (count == 0) {
+			dataList = new ArrayList<>();
+		}
+		pageInfo.setRows(dataList);
+		return pageInfo;
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
+	public StudentCompetition checkIsUpload(Integer userId) {
+		return studentCompetitionDao.getCompetitionWithUser(userId);
+	}
+
+	@Override
+	public List<StudentCompetitionRankingDto> getWinnerList() {
+		List<StudentCompetition> winnerList = studentCompetitionDao.getWinnerList();
+		List<StudentCompetitionRankingDto> winnerSimpleInfoList = new ArrayList<>();
+		for (StudentCompetition studentCompetition : winnerList) {
+			winnerSimpleInfoList.add(new StudentCompetitionRankingDto(studentCompetition.getId(), studentCompetition.getUsername(), studentCompetition.getPictureUrl()));
+		}
+		return winnerSimpleInfoList;
+	}
+}

+ 0 - 1
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml

@@ -478,7 +478,6 @@
         WHERE music_group_id_ = #{musicGroupId}
         AND payment_type_ = 'MUSIC_APPLY'
         AND pay_user_type_='STUDENT'
-        AND status_='OPEN'
     </select>
     <select id="queryUserPaymentStatus" resultType="java.util.Map">
         SELECT mg.id_ 'key',CASE WHEN COUNT(mgpc.id_) = 0 OR COUNT(DISTINCT mgpcd.id_) > 0 THEN 'NON_PAYMENT' ELSE 'PAID_COMPLETED' END 'value'

+ 158 - 0
mec-biz/src/main/resources/config/mybatis/StudentCompetitionMapper.xml

@@ -0,0 +1,158 @@
+<?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.StudentCompetitionDao">
+	
+	<resultMap type="com.ym.mec.biz.dal.entity.StudentCompetition" id="StudentCompetition">
+		<result column="id_" property="id" />
+		<result column="user_id_" property="userId" />
+		<result column="username_" property="username" />
+		<result column="id_card_no_" property="idCardNo" />
+		<result column="age_" property="age" />
+		<result column="gender_" property="gender" />
+		<result column="grade_" property="grade" />
+		<result column="subject_" property="subject" />
+		<result column="chapter_" property="chapter" />
+		<result column="picture_url_" property="pictureUrl" />
+		<result column="vedio_url_" property="vedioUrl" />
+		<result column="score_" property="score" />
+		<result column="prize_level_" property="prizeLevel" />
+		<result column="is_show_" property="isShow" />
+		<result column="comment_" property="comment" />
+		<result column="create_time_" property="createTime" />
+		<result column="update_time_" property="updateTime" />
+	</resultMap>
+	
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="StudentCompetition" >
+		SELECT * FROM student_competition WHERE id_ = #{id} FOR UPDATE
+	</select>
+	
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="StudentCompetition">
+		SELECT * FROM student_competition ORDER BY id_
+	</select>
+	
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentCompetition" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		<!--
+		<selectKey resultClass="int" keyProperty="id" > 
+		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
+		</selectKey>
+		-->
+		INSERT INTO student_competition (id_,user_id_,username_,id_card_no_,age_,gender_,grade_,subject_,chapter_,picture_url_,vedio_url_,score_,prize_level_,is_show_,comment_,create_time_,update_time_)
+		VALUES(#{id},#{userId},#{username},#{idCardNo},#{age},#{gender},#{grade},#{subject},#{chapter},#{pictureUrl},#{vedioUrl},#{score},#{prizeLevel},#{isShow},#{comment},NOW(),NOW())
+	</insert>
+	
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentCompetition">
+		UPDATE student_competition <set>
+		<if test="isShow != null">
+			is_show_ = #{isShow},
+		</if>
+		<if test="id != null">
+			id_ = #{id},
+		</if>
+		<if test="gender != null">
+			gender_ = #{gender},
+		</if>
+		<if test="score != null">
+			score_ = #{score},
+		</if>
+		<if test="prizeLevel != null">
+			prize_level_ = #{prizeLevel},
+		</if>
+		<if test="age != null">
+			age_ = #{age},
+		</if>
+		<if test="vedioUrl != null">
+			vedio_url_ = #{vedioUrl},
+		</if>
+		<if test="username != null">
+			username_ = #{username},
+		</if>
+		<if test="chapter != null">
+			chapter_ = #{chapter},
+		</if>
+		<if test="userId != null">
+			user_id_ = #{userId},
+		</if>
+		<if test="subject != null">
+			subject_ = #{subject},
+		</if>
+		<if test="comment != null">
+			comment_ = #{comment},
+		</if>
+		<if test="pictureUrl != null">
+			picture_url_ = #{pictureUrl},
+		</if>
+		<if test="idCardNo != null">
+			id_card_no_ = #{idCardNo},
+		</if>
+		<if test="grade != null">
+			grade_ = #{grade},
+		</if>
+			update_time_ = NOW()
+	</set> WHERE id_ = #{id}
+	</update>
+	
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete" >
+		DELETE FROM student_competition WHERE id_ = #{id} 
+	</delete>
+	
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="StudentCompetition" parameterType="map">
+		SELECT * FROM student_competition ORDER BY id_ <include refid="global.limit"/>
+	</select>
+	
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM student_competition
+	</select>
+
+	<sql id="queryStudentCondition">
+		<where>
+			<if test="grade!=null">
+				AND grade_=#{grade}
+			</if>
+			<if test="gender!=null">
+				AND gender_=#{gender}
+			</if>
+			<if test="subject != null and subject != ''">
+				AND subject_=#{subject}
+			</if>
+			<if test="prizeLevel!=null">
+				AND prize_level_=#{prizeLevel}
+			</if>
+			<if test="isShow!=null">
+				AND is_show_=#{isShow}
+			</if>
+			<if test="search!=null and search!=''">
+				AND (age_=#{search} OR username_ LIKE CONCAT('%', #search), '%') OR id_card_no_ LIKE CONCAT('%', #search), '%')
+			</if>
+		</where>
+	</sql>
+
+	<select id="queryStudentCompetitions" resultMap="StudentCompetition">
+		SELECT * FROM student_competition
+		<include refid="queryStudentCondition"/>
+		ORDER BY id_ DESC
+		<include refid="global.limit"/>
+	</select>
+	<select id="countStudentCompetitions" resultType="int">
+		SELECT COUNT(*) FROM student_competition
+		<include refid="queryStudentCondition"/>
+	</select>
+
+	<select id="getWinnerList" resultMap="StudentCompetition">
+		SELECT * FROM student_competition WHERE is_show_ = 1 AND prize_level_ IS NOT NULL ORDER BY prize_level_
+	</select>
+
+	<select id="getCompetitionWithUser" resultMap="StudentCompetition">
+		SELECT * FROM student_competition WHERE user_id_ = #{userId}
+	</select>
+</mapper>

+ 3 - 1
mec-student/src/main/java/com/ym/mec/student/config/ResourceServerConfig.java

@@ -42,7 +42,9 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
                 "/subjectChange/getChangeInfo",
                 "/subjectChange/payChange",
                 "/contracts/queryProduceContract",
-                "/repair/studentPaymentGoodsOrder").permitAll().anyRequest().authenticated().and().httpBasic();
+                "/repair/studentPaymentGoodsOrder",
+                "/studentCompetition/getWinnerList",
+                "/studentCompetition/get").permitAll().anyRequest().authenticated().and().httpBasic();
     }
 
     @Override

+ 79 - 0
mec-student/src/main/java/com/ym/mec/student/controller/StudentCompetitionController.java

@@ -0,0 +1,79 @@
+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.StudentCompetitionRankingDto;
+import com.ym.mec.biz.dal.entity.StudentCompetition;
+import com.ym.mec.biz.service.ContractService;
+import com.ym.mec.biz.service.StudentCompetitionService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * @Author Joburgess
+ * @Date 2020.11.10
+ */
+@RestController
+@RequestMapping("studentCompetition")
+@Api(tags = "长三角比赛服务")
+public class StudentCompetitionController extends BaseController {
+
+    @Autowired
+    private StudentCompetitionService studentCompetitionService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private ContractService contractService;
+
+    @ApiOperation(value = "新增参赛作品")
+    @PostMapping("/add")
+    public HttpResponseResult add(@RequestBody StudentCompetition studentCompetition){
+        if(StringUtils.isBlank(studentCompetition.getUsername())||StringUtils.isBlank(studentCompetition.getIdCardNo())){
+            return failed("参赛选手身份信息不完整");
+        }
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("请登录");
+        }
+        contractService.register(studentCompetition.getUserId(), studentCompetition.getUsername(), studentCompetition.getIdCardNo(),sysUser.getPhone());
+        studentCompetition.setUserId(sysUser.getId());
+        studentCompetitionService.addStudentCompetition(studentCompetition);
+        return succeed();
+    }
+
+    @ApiOperation(value = "新增参赛作品")
+    @GetMapping("/checkIsUpload")
+    public HttpResponseResult<StudentCompetition> checkIsUpload(){
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("请登录");
+        }
+        return succeed(studentCompetitionService.checkIsUpload(sysUser.getId()));
+    }
+
+    @ApiOperation(value = "获取获奖名单")
+    @GetMapping("/getWinnerList")
+    public HttpResponseResult<List<StudentCompetitionRankingDto>> getWinnerList(){
+        return succeed(studentCompetitionService.getWinnerList());
+    }
+
+    @ApiOperation(value = "获取指定参赛作品详情")
+    @GetMapping("/get")
+    public HttpResponseResult<StudentCompetition> get(Long competitionId){
+        StudentCompetition studentCompetition = studentCompetitionService.get(competitionId);
+        if(Objects.isNull(studentCompetition)||!studentCompetition.isShow()){
+            return succeed();
+        }
+        return succeed(studentCompetition);
+    }
+
+}

+ 44 - 0
mec-web/src/main/java/com/ym/mec/web/controller/StudentCompetitionController.java

@@ -0,0 +1,44 @@
+package com.ym.mec.web.controller;
+
+import com.ym.mec.biz.dal.entity.StudentCompetition;
+import com.ym.mec.biz.dal.page.StudentCompetitionQueryInfo;
+import com.ym.mec.biz.service.StudentCompetitionService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.common.page.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+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;
+
+/**
+ * @Author Joburgess
+ * @Date 2020.11.10
+ */
+@RestController
+@RequestMapping("studentCompetition")
+@Api(tags = "长三角比赛服务")
+public class StudentCompetitionController extends BaseController {
+
+    @Autowired
+    private StudentCompetitionService studentCompetitionService;
+
+    @ApiOperation(value = "查询报名记录")
+    @PostMapping("/queryPage")
+    @PreAuthorize("@pcs.hasPermissions('studentCompetition/queryPage')")
+    public HttpResponseResult<PageInfo<StudentCompetition>> queryPage(@RequestBody StudentCompetitionQueryInfo queryInfo){
+        return succeed(studentCompetitionService.queryPage(queryInfo));
+    }
+    @ApiOperation(value = "更新报名记录")
+    @PostMapping("/update")
+    @PreAuthorize("@pcs.hasPermissions('studentCompetition/update')")
+    public HttpResponseResult update(@RequestBody StudentCompetition studentCompetition){
+        studentCompetitionService.update(studentCompetition);
+        return succeed();
+    }
+
+}