ソースを参照

Merge remote-tracking branch 'origin/master'

zouxuan 4 年 前
コミット
48838199f9

+ 42 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/IndexDao.java

@@ -0,0 +1,42 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.biz.dal.dto.IndexBaseMonthDto;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @Author Joburgess
+ * @Date 2021/1/7 0007
+ **/
+public interface IndexDao {
+
+    /**
+     * @describe 统计系统中指定时间段的学员注册数据
+     * @author Joburgess
+     * @date 2021/1/7 0007
+     * @param organIds:
+     * @param startMonth:
+     * @param endMonth:
+     * @return java.util.List<com.ym.mec.biz.dal.dto.IndexBaseMonthDto>
+     */
+    List<IndexBaseMonthDto> getStudentSignUpData(@Param("organIds") Set<Integer> organIds,
+                                                 @Param("startMonth") String startMonth,
+                                                 @Param("endMonth") String endMonth);
+
+    /**
+     * @describe 统计作业布置数据
+     * @author Joburgess
+     * @date 2021/1/7 0007
+     * @param organIds:
+     * @param startMonth:
+     * @param endMonth:
+     * @return java.util.List<com.ym.mec.biz.dal.dto.IndexBaseMonthDto>
+     */
+    List<IndexBaseMonthDto> getHomeworkDate(@Param("organIds") Set<Integer> organIds,
+                                                  @Param("startMonth") String startMonth,
+                                                  @Param("endMonth") String endMonth,
+                                                  @Param("type") String type);
+
+}

+ 62 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/IndexBaseDto.java

@@ -0,0 +1,62 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.ym.mec.common.constant.CommonConstants;
+import org.springframework.util.CollectionUtils;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * @Author Joburgess
+ * @Date 2021/1/7 0007
+ */
+public class IndexBaseDto {
+
+    private String title;
+
+    private BigDecimal percent;
+
+    private List<IndexBaseMonthDto> indexMonthData;
+
+    public IndexBaseDto() {
+    }
+
+    public IndexBaseDto(String title) {
+        this.title = title;
+    }
+
+    public IndexBaseDto(String title, BigDecimal percent, List<IndexBaseMonthDto> indexMonthData) {
+        this.title = title;
+        this.percent = percent;
+        this.indexMonthData = indexMonthData;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public BigDecimal getPercent() {
+        return percent;
+    }
+
+    public void setPercent(BigDecimal percent) {
+        this.percent = percent;
+    }
+
+    public List<IndexBaseMonthDto> getIndexMonthData() {
+        return indexMonthData;
+    }
+
+    public void setIndexMonthData(List<IndexBaseMonthDto> indexMonthData) {
+        this.indexMonthData = indexMonthData;
+        if(!CollectionUtils.isEmpty(indexMonthData)){
+            BigDecimal total = indexMonthData.stream().map(IndexBaseMonthDto::getTotal).reduce(BigDecimal.ZERO, BigDecimal::add);
+            BigDecimal activateNum = indexMonthData.stream().map(IndexBaseMonthDto::getActivateNum).reduce(BigDecimal.ZERO, BigDecimal::add);
+            this.percent = activateNum.divide(total, CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN);
+        }
+    }
+}

+ 55 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/IndexBaseMonthDto.java

@@ -0,0 +1,55 @@
+package com.ym.mec.biz.dal.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
+
+/**
+ * @Author Joburgess
+ * @Date 2021/1/7 0007
+ */
+public class IndexBaseMonthDto {
+
+    private String title;
+
+    //总数
+    private BigDecimal total;
+
+    //有效数量
+    private BigDecimal activateNum;
+
+    //最终结果
+    private BigDecimal percent;
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public BigDecimal getTotal() {
+        return total;
+    }
+
+    public void setTotal(BigDecimal total) {
+        this.total = total;
+    }
+
+    public BigDecimal getActivateNum() {
+        return activateNum;
+    }
+
+    public void setActivateNum(BigDecimal activateNum) {
+        this.activateNum = activateNum;
+    }
+
+    public BigDecimal getPercent() {
+        return percent;
+    }
+
+    public void setPercent(BigDecimal percent) {
+        this.percent = percent;
+    }
+}

+ 30 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupRegsDto.java

@@ -0,0 +1,30 @@
+package com.ym.mec.biz.dal.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.List;
+
+public class MusicGroupRegsDto {
+
+    @ApiModelProperty(value = "乐团编号", required = true)
+    private String musicGroupId;
+
+    @ApiModelProperty(value = "学员注册ids", required = true)
+    private List<Long> registerIds;
+
+    public String getMusicGroupId() {
+        return musicGroupId;
+    }
+
+    public void setMusicGroupId(String musicGroupId) {
+        this.musicGroupId = musicGroupId;
+    }
+
+    public List<Long> getRegisterIds() {
+        return registerIds;
+    }
+
+    public void setRegisterIds(List<Long> registerIds) {
+        this.registerIds = registerIds;
+    }
+}

+ 17 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/IndexService.java

@@ -0,0 +1,17 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.dto.IndexBaseDto;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @Author Joburgess
+ * @Date 2021/1/7 0007
+ **/
+public interface IndexService {
+
+    Map<String, List<IndexBaseDto>> getIndexBaseData(Set<String> dataType, String organIds, String startMonth, String endMonth);
+
+}

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupService.java

@@ -17,6 +17,7 @@ import com.ym.mec.biz.dal.dto.UpdateExpectedNumDto;
 import com.ym.mec.biz.dal.entity.ApprovalStatus;
 import com.ym.mec.biz.dal.entity.MusicGroup;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.page.MusicGroupQueryInfo;
 import com.ym.mec.common.entity.ImGroupMember;
 import com.ym.mec.common.page.PageInfo;
@@ -316,4 +317,12 @@ public interface MusicGroupService extends BaseService<String, MusicGroup> {
 	 * @param musicGroupIds
 	 */
 //	void musicGroupStudentFeePatch(List<String> musicGroupIds);
+
+	/**
+	 * 给乐团添加报名学生
+	 * @param musicGroupId
+	 * @param registerIds
+	 * @return
+	 */
+	List<StudentRegistration> addMusicGroupRegs(String musicGroupId,List<Long> registerIds);
 }

+ 113 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexServiceImpl.java

@@ -0,0 +1,113 @@
+package com.ym.mec.biz.service.impl;
+
+import com.sun.org.apache.xerces.internal.xs.StringList;
+import com.ym.mec.biz.dal.dao.IndexDao;
+import com.ym.mec.biz.dal.dto.IndexBaseDto;
+import com.ym.mec.biz.dal.dto.IndexBaseMonthDto;
+import com.ym.mec.biz.service.IndexService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @Author Joburgess
+ * @Date 2021/1/7 0007
+ */
+@Service
+public class IndexServiceImpl implements IndexService {
+    
+    @Autowired
+    private IndexDao indexDao;
+
+    @Override
+    public Map<String, List<IndexBaseDto>> getIndexBaseData(Set<String> dataTypes, String organIdsStr, String startMonth, String endMonth) {
+        Map<String, List<IndexBaseDto>> result = new HashMap<>();
+
+        if(StringUtils.isBlank(startMonth)){
+            LocalDateTime nowDateTime = LocalDateTime.now();
+            startMonth = nowDateTime.getYear() + "-01";
+            endMonth = null;
+        }
+        Set<Integer> organIds = null;
+        if(StringUtils.isNotBlank(organIdsStr)){
+            organIds = Arrays.stream(organIdsStr.split(",")).map(Integer::new).collect(Collectors.toSet());
+        }
+
+        if(dataTypes.contains("ALL") || dataTypes.contains("OPERATION_DATA")){
+            //运营数据
+            List<IndexBaseDto> operationData = new LinkedList<>();
+            operationData.add(new IndexBaseDto("合作单位"));
+            operationData.add(new IndexBaseDto("乐团数量"));
+            operationData.add(new IndexBaseDto("乐团学员"));
+            operationData.add(new IndexBaseDto("其他学员"));
+            result.put("OPERATION_DATA", operationData);
+        }
+
+        if(dataTypes.contains("ALL") || dataTypes.contains("BUSINESS_DATA")){
+            //业务数据
+            List<IndexBaseDto> businessData = new LinkedList<>();
+            businessData.add(getUserSignUpDate(new IndexBaseDto("激活率"), organIds, startMonth, endMonth));
+            businessData.add(getHomeworkDate(new IndexBaseDto("作业布置率"), organIds, startMonth, endMonth, "assign"));
+            businessData.add(getHomeworkDate(new IndexBaseDto("作业提交率"), organIds, startMonth, endMonth, "submit"));
+            businessData.add(getHomeworkDate(new IndexBaseDto("作业点评率"), organIds, startMonth, endMonth, "comment"));
+            result.put("BUSINESS_DATA", businessData);
+        }
+
+        if(dataTypes.contains("ALL") || dataTypes.contains("FINANCE_DATA")){
+            //财务数据
+            List<IndexBaseDto> financeData = new LinkedList<>();
+            financeData.add(new IndexBaseDto("应收金额"));
+            financeData.add(new IndexBaseDto("预收金额"));
+            financeData.add(new IndexBaseDto("预付金额"));
+            financeData.add(new IndexBaseDto("应付金额"));
+            financeData.add(new IndexBaseDto("营收金额"));
+            result.put("FINANCE_DATA", financeData);
+        }
+
+        if(dataTypes.contains("ALL") || dataTypes.contains("PERSONNEL_DATA")){
+            //人事数据
+            List<IndexBaseDto> personnelData = new LinkedList<>();
+            personnelData.add(new IndexBaseDto("老师总数"));
+            personnelData.add(new IndexBaseDto("全职人数"));
+            personnelData.add(new IndexBaseDto("兼职人数"));
+            personnelData.add(new IndexBaseDto("离职人数"));
+            result.put("PERSONNEL_DATA", personnelData);
+        }
+
+        if(dataTypes.contains("ALL") || dataTypes.contains("STUDENT_VARIATION")){
+            //学员变动
+            List<IndexBaseDto> studentVariation = new LinkedList<>();
+            studentVariation.add(new IndexBaseDto("新增学员"));
+            studentVariation.add(new IndexBaseDto("退团学员"));
+            studentVariation.add(new IndexBaseDto("学员转化"));
+            result.put("STUDENT_VARIATION", studentVariation);
+        }
+
+        if(dataTypes.contains("ALL") || dataTypes.contains("COURSE_DATA")){
+            //本月课程
+            List<IndexBaseDto> courseData = new LinkedList<>();
+            courseData.add(new IndexBaseDto("乐团课"));
+            courseData.add(new IndexBaseDto("VIP课"));
+            courseData.add(new IndexBaseDto("网管课"));
+            result.put("COURSE_DATA", courseData);
+        }
+
+        return result;
+    }
+
+    private IndexBaseDto getUserSignUpDate(IndexBaseDto indexBaseData, Set<Integer> organIds, String startMonth, String endMonth){
+        indexBaseData.setIndexMonthData(indexDao.getStudentSignUpData(organIds, startMonth, endMonth));
+        return indexBaseData;
+    }
+
+    private IndexBaseDto getHomeworkDate(IndexBaseDto indexBaseData, Set<Integer> organIds, String startMonth, String endMonth, String type){
+        indexBaseData.setIndexMonthData(indexDao.getHomeworkDate(organIds, startMonth, endMonth, type));
+        return indexBaseData;
+    }
+}

+ 107 - 103
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -18,6 +18,8 @@ import java.util.Objects;
 import java.util.Set;
 import java.util.stream.Collectors;
 
+import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.entity.*;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -30,38 +32,6 @@ import com.alibaba.fastjson.TypeReference;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.entity.SysUserRole;
-import com.ym.mec.biz.dal.dao.ChargeTypeDao;
-import com.ym.mec.biz.dal.dao.ClassGroupDao;
-import com.ym.mec.biz.dal.dao.ClassGroupStudentMapperDao;
-import com.ym.mec.biz.dal.dao.CooperationOrganDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao;
-import com.ym.mec.biz.dal.dao.EmployeeDao;
-import com.ym.mec.biz.dal.dao.MusicGroupBuildLogDao;
-import com.ym.mec.biz.dal.dao.MusicGroupDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentEntitiesDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentStudentCourseDetailDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPurchaseListDao;
-import com.ym.mec.biz.dal.dao.MusicGroupQuitDao;
-import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
-import com.ym.mec.biz.dal.dao.MusicGroupSubjectGoodsGroupDao;
-import com.ym.mec.biz.dal.dao.MusicGroupSubjectPlanDao;
-import com.ym.mec.biz.dal.dao.OrganizationDao;
-import com.ym.mec.biz.dal.dao.SchoolDao;
-import com.ym.mec.biz.dal.dao.SporadicChargeInfoDao;
-import com.ym.mec.biz.dal.dao.StudentDao;
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
-import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
-import com.ym.mec.biz.dal.dao.StudentVisitDao;
-import com.ym.mec.biz.dal.dao.SubjectChangeDao;
-import com.ym.mec.biz.dal.dao.SysConfigDao;
-import com.ym.mec.biz.dal.dao.TeacherAttendanceDao;
-import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.dto.CourseFormDto;
 import com.ym.mec.biz.dal.dto.CourseScheduleTeachersDto;
@@ -72,34 +42,7 @@ import com.ym.mec.biz.dal.dto.SporadicPayDto;
 import com.ym.mec.biz.dal.dto.SubFeeSettingDto;
 import com.ym.mec.biz.dal.dto.SubjectRegisterDto;
 import com.ym.mec.biz.dal.dto.UpdateExpectedNumDto;
-import com.ym.mec.biz.dal.entity.ApprovalStatus;
-import com.ym.mec.biz.dal.entity.ChargeType;
-import com.ym.mec.biz.dal.entity.ClassGroup;
-import com.ym.mec.biz.dal.entity.CooperationOrgan;
-import com.ym.mec.biz.dal.entity.CourseSchedule;
-import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
-import com.ym.mec.biz.dal.entity.Goods;
-import com.ym.mec.biz.dal.entity.MusicGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupBuildLog;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
-import com.ym.mec.biz.dal.entity.MusicGroupPurchaseList;
-import com.ym.mec.biz.dal.entity.MusicGroupQuit;
-import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
-import com.ym.mec.biz.dal.entity.Organization;
-import com.ym.mec.biz.dal.entity.School;
-import com.ym.mec.biz.dal.entity.SporadicChargeInfo;
-import com.ym.mec.biz.dal.entity.Student;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
-import com.ym.mec.biz.dal.entity.StudentRegistration;
-import com.ym.mec.biz.dal.entity.SubjectChange;
-import com.ym.mec.biz.dal.entity.SysUserCashAccount;
-import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
 import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.GoodsType;
@@ -271,6 +214,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     private SubjectChangeDao subjectChangeDao;
     @Autowired
     private StudentVisitDao studentVisitDao;
+    @Autowired
+    private SubjectDao subjectDao;
 
     private SimpleDateFormat sdf_ymd = new SimpleDateFormat("yyyy-MM-dd");
 
@@ -390,7 +335,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                         || musicGroupSubjectGoodsGroup.getKitGroupPurchaseTypeJson().equals("{}"))) {
                     throw new BizException(musicGroupSubjectGoodsGroup.getName() + " 请选择提供方式");
                 }
-                if(musicGroupSubjectGoodsGroup.getGroupRemissionCourseFee() == null){
+                if (musicGroupSubjectGoodsGroup.getGroupRemissionCourseFee() == null) {
                     musicGroupSubjectGoodsGroup.setGroupRemissionCourseFee(0);
                 }
             }
@@ -611,8 +556,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                     }
                     if (!kitGroupPurchaseType.equals("GROUP")) {
                         goodsGroup.setPrice(kitGroupPurchaseType.equals("FREE") ? new BigDecimal(0) : goodsGroup.getDepositFee());
-                    }else{
-                        remitCourseRFeeFlag  = goodsGroup.getGroupRemissionCourseFee().equals(1);
+                    } else {
+                        remitCourseRFeeFlag = goodsGroup.getGroupRemissionCourseFee().equals(1);
                     }
                     goodsGroup.setKitGroupPurchaseType(KitGroupPurchaseTypeEnum.valueOf(kitGroupPurchaseType));
                     remitFee = groupType.get(kitGroupPurchaseType) == null ? BigDecimal.ZERO : groupType.get(kitGroupPurchaseType);
@@ -666,7 +611,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (registerPayDto.getNewCourse() != null && registerPayDto.getNewCourse().size() > 0) {
             newCourses = musicGroupPaymentCalenderCourseSettingsDao.getCalenderCourseSettings(registerPayDto.getNewCourse());
             for (MusicGroupPaymentCalenderCourseSettings calenderCourseSetting : newCourses) {
-                if(remitCourseRFeeFlag && !calenderCourseSetting.getIsStudentOptional()){
+                if (remitCourseRFeeFlag && !calenderCourseSetting.getIsStudentOptional()) {
                     courseRemitFee = courseRemitFee.add(calenderCourseSetting.getCourseCurrentPrice());
                     continue;
                 }
@@ -831,7 +776,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                     }
                     if (!kitGroupPurchaseType.equals("GROUP")) {
                         goodsGroup.setPrice(kitGroupPurchaseType.equals("FREE") ? new BigDecimal(0) : goodsGroup.getDepositFee());
-                    }else {
+                    } else {
                         remitCourseRFeeFlag = goodsGroup.getGroupRemissionCourseFee().equals(1);
                     }
                     goodsGroup.setKitGroupPurchaseType(KitGroupPurchaseTypeEnum.valueOf(kitGroupPurchaseType));
@@ -886,7 +831,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (registerPayDto.getNewCourse() != null && registerPayDto.getNewCourse().size() > 0) {
             newCourses = musicGroupPaymentCalenderCourseSettingsDao.getCalenderCourseSettings(registerPayDto.getNewCourse());
             for (MusicGroupPaymentCalenderCourseSettings calenderCourseSetting : newCourses) {
-                if(remitCourseRFeeFlag && !calenderCourseSetting.getIsStudentOptional()){
+                if (remitCourseRFeeFlag && !calenderCourseSetting.getIsStudentOptional()) {
                     courseRemitFee = courseRemitFee.add(calenderCourseSetting.getCourseCurrentPrice());
                     continue;
                 }
@@ -1020,7 +965,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                             || musicGroupSubjectGoodsGroup.getKitGroupPurchaseTypeJson().equals("{}"))) {
                         throw new BizException(musicGroupSubjectGoodsGroup.getName() + " 请选择提供方式");
                     }
-                    if(musicGroupSubjectGoodsGroup.getGroupRemissionCourseFee()==null){
+                    if (musicGroupSubjectGoodsGroup.getGroupRemissionCourseFee() == null) {
                         musicGroupSubjectGoodsGroup.setGroupRemissionCourseFee(0);
                     }
                 }
@@ -1561,23 +1506,23 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (musicGroup == null) {
             throw new BizException("乐团不存在");
         }
-        
-        if(musicGroup.getStatus() == MusicGroupStatusEnum.CANCELED || musicGroup.getStatus() == MusicGroupStatusEnum.PAUSE){
-        	throw new BizException("申请失败,乐团状态[已取消]或[已暂停]");
+
+        if (musicGroup.getStatus() == MusicGroupStatusEnum.CANCELED || musicGroup.getStatus() == MusicGroupStatusEnum.PAUSE) {
+            throw new BizException("申请失败,乐团状态[已取消]或[已暂停]");
         }
         Integer userId = sysUser.getId();
-        
+
         StudentRegistration studentRegistration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
         if (studentRegistration == null) {
             throw new BizException("用户注册信息不存在");
         }
-        
+
         MusicGroupQuit musicGroupQuit = musicGroupQuitDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
-    	if(musicGroupQuit != null){
-    		if(musicGroupQuit.getStatus() == ApprovalStatus.PROCESSING){
-    			throw new BizException("申请失败,存在[申请中]的记录");
-    		}
-    	}
+        if (musicGroupQuit != null) {
+            if (musicGroupQuit.getStatus() == ApprovalStatus.PROCESSING) {
+                throw new BizException("申请失败,存在[申请中]的记录");
+            }
+        }
 
         musicGroupQuit = new MusicGroupQuit();
         musicGroupQuit.setCreateTime(new Date());
@@ -1597,18 +1542,18 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds, musicGroup.getOrganId()),
                 MessageTypeEnum.BACKSTAGE_STUDENT_APPLY_QUIT_GROUP, JSONObject.toJSONString(memo), sysUser.getUsername());
         Map<Integer, String> receivers = new HashMap<>(1);
-        receivers.put(musicGroup.getEducationalTeacherId(),musicGroup.getEducationalTeacherId().toString());
-        sysMessageService.batchSendMessage(MessageSender.JIGUANG,MessageTypeEnum.PUSH_STUDENT_COMMIT_QUIT_MUSIC_APPLY,
-                receivers,null,0,null,"SYSTEM",musicGroup.getName(),sysUser.getUsername());
+        receivers.put(musicGroup.getEducationalTeacherId(), musicGroup.getEducationalTeacherId().toString());
+        sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.PUSH_STUDENT_COMMIT_QUIT_MUSIC_APPLY,
+                receivers, null, 0, null, "SYSTEM", musicGroup.getName(), sysUser.getUsername());
         return true;
     }
 
     @Override
-	public boolean cancelQuitMusicGroup(Integer userId, String musicGroupId, String reason) {
-    	MusicGroupQuit musicGroupQuit = musicGroupQuitDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
-    	if(musicGroupQuit == null){
-    		throw new BizException("操作失败,没有查询到退团记录");
-    	}
+    public boolean cancelQuitMusicGroup(Integer userId, String musicGroupId, String reason) {
+        MusicGroupQuit musicGroupQuit = musicGroupQuitDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
+        if (musicGroupQuit == null) {
+            throw new BizException("操作失败,没有查询到退团记录");
+        }
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if (sysUser == null) {
             throw new BizException("用户信息获取失败");
@@ -1617,19 +1562,19 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (musicGroup == null) {
             throw new BizException("乐团不存在");
         }
-    	musicGroupQuit.setStatus(ApprovalStatus.CANCELED);
+        musicGroupQuit.setStatus(ApprovalStatus.CANCELED);
         musicGroupQuit.setReason(reason);
         musicGroupQuit.setQuitDate(new Date());
         musicGroupQuitDao.update(musicGroupQuit);
 
         Map<Integer, String> receivers = new HashMap<>(1);
-        receivers.put(musicGroup.getEducationalTeacherId(),musicGroup.getEducationalTeacherId().toString());
-        sysMessageService.batchSendMessage(MessageSender.JIGUANG,MessageTypeEnum.PUSH_STUDENT_REVOKE_QUIT_MUSIC_APPLY,
-                receivers,null,0,null,"SYSTEM",musicGroup.getName(),sysUser.getUsername());
-    	return true;
-	}
+        receivers.put(musicGroup.getEducationalTeacherId(), musicGroup.getEducationalTeacherId().toString());
+        sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.PUSH_STUDENT_REVOKE_QUIT_MUSIC_APPLY,
+                receivers, null, 0, null, "SYSTEM", musicGroup.getName(), sysUser.getUsername());
+        return true;
+    }
 
-	@Override
+    @Override
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
     public boolean approveQuitMusicGroup(Long id, ApprovalStatus status, String reason, boolean isRefundCourseFee, boolean isRefundInstrumentFee,
                                          boolean isRefundTeachingAssistantsFee) {
@@ -1641,14 +1586,14 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         String musicGroupId = musicGroupQuit.getMusicGroupId();
         Integer userId = musicGroupQuit.getUserId();
-        
+
         MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
         if (musicGroup == null) {
             throw new BizException("乐团不存在");
         }
-        
-        if(musicGroup.getStatus() == MusicGroupStatusEnum.CANCELED || musicGroup.getStatus() == MusicGroupStatusEnum.PAUSE){
-        	throw new BizException("申请失败,乐团状态[已取消]或[已暂停]");
+
+        if (musicGroup.getStatus() == MusicGroupStatusEnum.CANCELED || musicGroup.getStatus() == MusicGroupStatusEnum.PAUSE) {
+            throw new BizException("申请失败,乐团状态[已取消]或[已暂停]");
         }
 
         musicGroupQuit.setStatus(status);
@@ -1739,7 +1684,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
             if (isRefundCourseFee) {
                 // 退课程费用
-            	amount = amount.add(studentRegistration.getSurplusCourseFee());
+                amount = amount.add(studentRegistration.getSurplusCourseFee());
             }
 
             SubjectChange studentLastChange = null;
@@ -1796,9 +1741,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (musicGroup == null) {
             throw new BizException("乐团不存在");
         }
-        
-        if(musicGroup.getStatus() == MusicGroupStatusEnum.CANCELED || musicGroup.getStatus() == MusicGroupStatusEnum.PAUSE){
-        	throw new BizException("申请失败,乐团状态[已取消]或[已暂停]");
+
+        if (musicGroup.getStatus() == MusicGroupStatusEnum.CANCELED || musicGroup.getStatus() == MusicGroupStatusEnum.PAUSE) {
+            throw new BizException("申请失败,乐团状态[已取消]或[已暂停]");
         }
 
         // 判断乐器是否是租赁
@@ -1806,7 +1751,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (studentRegistration == null) {
             throw new BizException("用户注册信息不存在");
         }
-        
+
         Date date = new Date();
 
         MusicGroupQuit musicGroupQuit = new MusicGroupQuit();
@@ -1895,7 +1840,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         if (isRefundCourseFee) {
             // 退课程费用
-        	amount = amount.add(studentRegistration.getSurplusCourseFee());
+            amount = amount.add(studentRegistration.getSurplusCourseFee());
         }
 
         SubjectChange studentLastChange = null;
@@ -1935,7 +1880,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             sysUserCashAccountDetailService.addCashAccountDetail(userId, amount, SysUserCashAccountDetailService.MUSIC_GROUP + musicGroupId, "",
                     PlatformCashAccountDetailTypeEnum.REFUNDS, null, SUCCESS, "退出乐团", null);
         }
-        
+
         return true;
     }
 
@@ -2084,7 +2029,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             //当前乐团报名是否赠送乐团网管课
             MusicGroupPaymentCalenderDetail calenderDetail = musicGroupPaymentCalenderDetailDao.findByOrderId(studentPaymentOrder.getId());
             MusicGroupStudentFee musicGroupStudentFee = musicGroupPaymentCalenderService.updateCalender(calenderDetail.getId(), studentRegistration.getUserId());
-            if(musicGroupStudentFee != null){
+            if (musicGroupStudentFee != null) {
                 musicGroupStudentFee.setUpdateTime(date);
                 musicGroupStudentFee.setLatestPaidTime(date);
                 musicGroupStudentFee.setPaymentStatus(PaymentStatus.PAID_COMPLETED);
@@ -2628,4 +2573,63 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         roleIds.add(SysUserRole.SECTION_MANAGER);
         sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds, musicGroup.getOrganId()), MessageTypeEnum.BACKSTAGE_MUSIC_GROUP_MARKING, "", musicGroup.getName());
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public List<StudentRegistration> addMusicGroupRegs(String musicGroupId, List<Long> registerIds) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null || sysUser.getId() == null) {
+            throw new BizException("获取用户信息失败");
+        }
+        List<StudentRegistration> studentRegistrations = studentRegistrationDao.findStudentListByIdList(registerIds);
+        List<Integer> subjectIds = studentRegistrations.stream().map(StudentRegistration::getActualSubjectId).collect(Collectors.toList());
+        List<Subject> subjects = subjectDao.findBySubjectIds(subjectIds);
+        Map<Integer, List<Subject>> subjectMap = subjects.stream().collect(Collectors.groupingBy(Subject::getId));
+        List<MusicGroupSubjectPlan> musicSubjectClassPlans = musicGroupSubjectPlanDao.getMusicSubjectClassPlan(musicGroupId);
+
+        Map<Integer, List<StudentRegistration>> regsMap = studentRegistrations.stream().collect(Collectors.groupingBy(StudentRegistration::getActualSubjectId));
+        List<StudentRegistration> studentRegistrationList = new ArrayList<>();
+        regsMap.forEach((subjectId, regs) -> {
+            boolean hasSubject = false;
+            MusicGroupSubjectPlan subjectPlan = null;
+            for (MusicGroupSubjectPlan musicGroupSubjectPlan : musicSubjectClassPlans) {
+                if (!subjectId.equals(musicGroupSubjectPlan.getSubjectId())) continue;
+                hasSubject = true;
+                musicGroupSubjectPlan.setApplyStudentNum(regs.size());
+                subjectPlan = musicGroupSubjectPlan;
+            }
+            if (!hasSubject) {
+                String name = subjectMap.get(subjectId).get(0).getName();
+                throw new BizException("当前乐团没有学员包含的声部(" + name + ")");
+            }
+            //更新乐团声部计划信息
+            musicGroupSubjectPlanDao.update(subjectPlan);
+
+            for (StudentRegistration studentRegistration : regs) {
+                studentRegistration.setId(null);
+                studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.APPLY);
+                studentRegistration.setPaymentStatus(PaymentStatusEnum.NO);
+                studentRegistration.setMusicGroupId(musicGroupId);
+                studentRegistration.setSubjectId(subjectId);
+                studentRegistration.setActualSubjectId(subjectId);
+                studentRegistration.setTemporaryCourseFee(null);
+            }
+            studentRegistrationList.addAll(regs);
+        });
+
+        //添加的学生
+        if (studentRegistrationList.size() > 0) {
+            studentRegistrationDao.batchInsert(studentRegistrationList);
+        }
+
+        //修改乐团信息
+        MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
+        musicGroup.setIsExtraClass(YesOrNoEnum.YES);
+        musicGroupDao.update(musicGroup);
+
+        musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "添加报名学员", sysUser.getId(), ""));
+
+        return studentRegistrationList;
+    }
+
 }

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

@@ -130,11 +130,11 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
     @Override
     @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
     public StudentPaymentRouteOrder addOutOrder(StudentPaymentRouteOrder studentPaymentRouteOrder) {
-        Map<String, Object> params = new HashMap<>();
-        params.put("transNo", studentPaymentRouteOrder.getTransNo());
-        if (studentPaymentRouteOrderDao.queryAuditCount(params) > 0) {
-            throw new BizException("流水号不能重复");
-        }
+//        Map<String, Object> params = new HashMap<>();
+//        params.put("transNo", studentPaymentRouteOrder.getTransNo());
+//        if (studentPaymentRouteOrderDao.queryAuditCount(params) > 0) {
+//            throw new BizException("流水号不能重复");
+//        }
         if (studentPaymentRouteOrder.getCalenderId() != null) {
             MusicGroupPaymentCalender musicGroupPaymentCalender = musicGroupPaymentCalenderDao.getSchoolCalender(studentPaymentRouteOrder.getCalenderId());
             if (musicGroupPaymentCalender == null) {

+ 77 - 0
mec-biz/src/main/resources/config/mybatis/IndexMapper.xml

@@ -0,0 +1,77 @@
+<?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.IndexDao">
+
+    <select id="getStudentSignUpData" resultType="com.ym.mec.biz.dal.dto.IndexBaseMonthDto">
+        SELECT
+            DATE_FORMAT( create_time_, '%Y-%m' ) title,
+            COUNT( id_ ) total,
+            COUNT(CASE WHEN password_ IS NOT NULL THEN id_ ELSE NULL END) activateNum,
+            TRUNCATE(COUNT(CASE WHEN password_ IS NOT NULL THEN id_ ELSE NULL END)/COUNT( id_ )*100, 2) percent
+        FROM
+            sys_user
+        WHERE
+            del_flag_=0
+            AND user_type_ LIKE '%STUDENT%'
+            <if test="organIds!=null and organIds.size()>0">
+                AND organ_id_ IN
+                <foreach collection="organIds" item="organId" open="(" close=")" separator=",">
+                    #{organIds}
+                </foreach>
+            </if>
+            <if test="startMonth!=null and startMonth!=''">
+                AND DATE_FORMAT(create_time_, '%Y-%m')&gt;=#{startMonth}
+            </if>
+            <if test="endMonth!=null and endMonth!=''">
+                AND DATE_FORMAT(create_time_, '%Y-%m')&lt;=#{endMonth}
+            </if>
+        GROUP BY
+            title
+        ORDER BY
+            title;
+    </select>
+
+    <select id="getHomeworkDate" resultType="com.ym.mec.biz.dal.dto.IndexBaseMonthDto">
+        SELECT
+            DATE_FORMAT(sees.monday_, '%Y-%m') title,
+            <choose>
+                <when test="type == 'submit'">
+                    SUM(sees.expect_exercises_num_) total,
+                    SUM(sees.exercises_reply_num_) activateNum,
+                    TRUNCATE(SUM(sees.exercises_reply_num_)/SUM(sees.expect_exercises_num_)*100, 2) percent
+                </when>
+                <when test="type == 'comment'">
+                    SUM(sees.expect_exercises_num_) total,
+                    SUM(sees.exercises_reply_num_) activateNum,
+                    TRUNCATE(SUM(sees.exercises_reply_num_)/SUM(sees.expect_exercises_num_)*100, 2) percent
+                </when>
+                <otherwise>
+                    SUM(sees.expect_exercises_num_) total,
+                    SUM(sees.actual_exercises_num_) activateNum,
+                    TRUNCATE(SUM(sees.actual_exercises_num_)/SUM(sees.expect_exercises_num_)*100, 2) percent
+                </otherwise>
+            </choose>
+        FROM student_extracurricular_exercises_situation_ sees
+                 LEFT JOIN sys_user su ON sees.student_id_=su.id_
+        WHERE su.del_flag_=0
+            <if test="organIds!=null and organIds.size()>0">
+                AND su.organ_id_ IN
+                <foreach collection="organIds" item="organId" open="(" close=")" separator=",">
+                    #{organIds}
+                </foreach>
+            </if>
+            <if test="startMonth!=null and startMonth!=''">
+                AND DATE_FORMAT(sees.monday_, '%Y-%m')&gt;=#{startMonth}
+            </if>
+            <if test="endMonth!=null and endMonth!=''">
+                AND DATE_FORMAT(sees.monday_, '%Y-%m')&lt;=#{endMonth}
+            </if>
+        GROUP BY title
+        ORDER BY title
+    </select>
+
+</mapper>

+ 36 - 0
mec-web/src/main/java/com/ym/mec/web/controller/IndexController.java

@@ -2,10 +2,16 @@ package com.ym.mec.web.controller;
 
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.entity.Employee;
+import com.ym.mec.biz.service.EmployeeService;
+import com.ym.mec.biz.service.IndexService;
+import com.ym.mec.common.entity.HttpResponseResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
+import java.util.Arrays;
+import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -44,6 +50,9 @@ public class IndexController extends BaseController {
 
 	@Autowired
 	private EmployeeDao employeeDao;
+
+	@Autowired
+	private EmployeeService employeeService;
 	
 	@Autowired
 	private SysUserCashAccountDetailDao sysUserCashAccountDetailDao;
@@ -51,6 +60,9 @@ public class IndexController extends BaseController {
 	@Autowired
 	private StudentPaymentOrderDao studentPaymentOrderDao;
 
+	@Autowired
+	private IndexService indexService;
+
 	@ApiOperation(value = "获取首页数据")
 	@GetMapping("/index")
 	public Object index() {
@@ -103,4 +115,28 @@ public class IndexController extends BaseController {
 		return succeed(model);
 	}
 
+	@GetMapping("/newIndex")
+	public HttpResponseResult newIndex(String dataTypes, String organIds, String startMonth, String endMonth){
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if (sysUser == null) {
+			return failed("用户信息获取失败");
+		}
+		if (!sysUser.getIsSuperAdmin()) {
+			Employee employee = employeeService.get(sysUser.getId());
+			if (StringUtils.isBlank(organIds)) {
+				organIds = employee.getOrganIdList();
+			}else if(StringUtils.isEmpty(employee.getOrganIdList())){
+				return failed("用户所在分部异常");
+			}else {
+				List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+				if(!list.containsAll(Arrays.asList(organIds.split(",")))){
+					return failed("非法请求");
+				}
+			}
+		}
+		if(StringUtils.isBlank(dataTypes)){
+			dataTypes = "ALL";
+		}
+		return succeed(indexService.getIndexBaseData(Arrays.stream(dataTypes.split(",")).collect(Collectors.toSet()), organIds, startMonth, endMonth));
+	}
 }

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

@@ -1,5 +1,8 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.biz.dal.dto.MusicGroupRegsDto;
+import com.ym.mec.biz.dal.entity.StudentRegistration;
+import com.ym.mec.common.entity.HttpResponseResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -276,4 +279,15 @@ public class MusicGroupController extends BaseController {
 		return succeed(musicGroupService.queryOrganMusicInfos(organId));
 	}
 
+
+	@ApiOperation(value = "乐团添加报名学员")
+	@PostMapping("/addMusicGroupRegs")
+	@PreAuthorize("@pcs.hasPermissions('musicGroup/addMusicGroupRegs')")
+	public HttpResponseResult<List<StudentRegistration>> addMusicGroupRegs(@RequestBody MusicGroupRegsDto musicGroupRegsDto) throws Exception {
+		if(musicGroupRegsDto.getRegisterIds().size() <=0){
+			return failed("请选择要添加的学员");
+		}
+		return succeed(musicGroupService.addMusicGroupRegs(musicGroupRegsDto.getMusicGroupId(),musicGroupRegsDto.getRegisterIds()));
+	}
+
 }