Browse Source

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

yonge 5 years ago
parent
commit
5175becec8

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -874,10 +874,10 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     /**
      * 根据班级编号count剩余课时(未上)
      * @param classGroupIds
-     * @param classDate
+     * @param teacherId
      * @return
      */
-    List<Map<Integer, Long>> countCurrentNumByClassGroupId(@Param("classGroupIds") List<Integer> classGroupIds, @Param("classDate") Date classDate);
+    List<Map<Integer, Long>> countCurrentNumByClassGroupId(@Param("classGroupIds") List<Integer> classGroupIds, @Param("teacherId") Integer teacherId);
 
     /**
      * @describe 获取乐团下剩余课程计划

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

@@ -882,15 +882,13 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         List<Map<Long, Integer>> vipGroupOverCourses = vipGroupDao.countVipGroupOverCourse(musicGroupIds);
         Map<Long, Integer> vipGroupOverCourseMaps = MapUtil.convertIntegerMap(vipGroupOverCourses);
 
-        List<ClassGroup> byClassGroupIds = classGroupDao.findByClassGroupIds(classGroupIds);
-        Map<Integer, ClassGroup> classGorupIdMap = byClassGroupIds.stream().collect(Collectors.toMap(ClassGroup::getId, classGroup -> classGroup));
-
-
+//        List<ClassGroup> byClassGroupIds = classGroupDao.findByClassGroupIds(classGroupIds);
+//        Map<Integer, ClassGroup> classGorupIdMap = byClassGroupIds.stream().collect(Collectors.toMap(ClassGroup::getId, classGroup -> classGroup));
 
         //统计班级人数
         List<Map<Integer, Integer>> classGroupStudentNumMaps = classGroupStudentMapperDao.countClassGroupsStudentNum(classGroupIds);
         Map<Integer, Long> classGroupStudentNumMap = MapUtil.convertIntegerMap(classGroupStudentNumMaps);
-        Map<Integer, Long> currentClassTimes = MapUtil.convertIntegerMap(courseScheduleDao.countCurrentNumByClassGroupId(classGroupIds,null));
+        Map<Integer, Long> currentClassTimes = MapUtil.convertIntegerMap(courseScheduleDao.countCurrentNumByClassGroupId(classGroupIds,user.getId()));
         teacherMusicClassGroup.forEach(teacherClassGroupDto -> {
 
             if (teacherClassGroupDto.getType() == ClassGroupTypeEnum.VIP) {

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

@@ -257,7 +257,7 @@
         <result column="group_name_" property="groupName"/>
     </resultMap>
     <select id="queryUserGroups" resultMap="imGroupModel">
-        SELECT cg.id_,cg.name_,cg.student_num_,cg.img_,mg.group_name_ FROM class_group_student_mapper cgsm
+        SELECT cg.id_,cg.name_,cg.student_num_,cg.img_,mg.name_ group_name_ FROM class_group_student_mapper cgsm
         LEFT JOIN class_group cg ON cgsm.class_group_id_ = cg.id_
         LEFT JOIN music_group mg ON mg.id_ = cg.music_group_id_ AND cg.group_type_ = 'MUSIC'
         <where>
@@ -442,6 +442,7 @@
             csts.user_id_ = #{teacherId}
             AND cg.group_type_='MUSIC'
             AND cg.del_flag_ = 0
+            AND cs.del_flag_ = 0
             AND mg.status_ = 'PROGRESS'
         GROUP BY cg.id_
     </select>

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

@@ -1696,8 +1696,8 @@
         <foreach collection="classGroupIds" item="item" separator="," open="(" close=")">
             #{item}
         </foreach>
-        <if test="classDate != null">
-            AND cs.class_date_ = DATE_FORMAT(#{classDate}, '%Y%m%d')
+        <if test="teacherId != null">
+            AND cs.actual_teacher_id_ = #{teacherId}
         </if>
         AND cs.status_ = 'NOT_START' AND cs.del_flag_ = 0
         GROUP BY cs.class_group_id_

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

@@ -187,7 +187,7 @@
     <sql id="queryPaymentOrder">
         <where>
             <if test="organId != null">
-                AND FIND_IN_SET(su.organ_id_,#{organId})
+                AND FIND_IN_SET(spo.organ_id_,#{organId})
             </if>
             <if test="orderStartDate != null">
                 AND DATE_FORMAT(spo.create_time_,'%Y-%m-%d') &gt;= #{orderStartDate}

+ 61 - 46
mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -68,15 +68,15 @@ public class ExportController extends BaseController {
     @ApiOperation(value = "导出学员是否有课")
     @PostMapping("export/studentHasCourse")
     @PreAuthorize("@pcs.hasPermissions('export/studentHasCourse')")
-    public void studentHasCourse(HttpServletResponse response){
+    public void studentHasCourse(HttpServletResponse response) {
         SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if(sysUser == null){
+        if (sysUser == null) {
             throw new BizException("获取用户信息失败");
         }
-        List<StudentHasCourseDto> hasCourseDtos =  studentManageService.queryHasCourseStudent(sysUser.getOrganId());
+        List<StudentHasCourseDto> hasCourseDtos = studentManageService.queryHasCourseStudent(sysUser.getOrganId());
         try {
-            HSSFWorkbook workbook = POIUtil.exportExcel(new String[] {"学员编号", "姓名","分部","所在乐团","乐团所属声部","所在vip课"}, new String[] {
-                    "userId","userName","organName","musicGroupName","subjectName","vipGroupName"}, hasCourseDtos);
+            HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"学员编号", "姓名", "分部", "所在乐团", "乐团所属声部", "所在vip课"}, new String[]{
+                    "userId", "userName", "organName", "musicGroupName", "subjectName", "vipGroupName"}, hasCourseDtos);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
             response.flushBuffer();
@@ -91,11 +91,11 @@ public class ExportController extends BaseController {
     @ApiOperation(value = "导出乐器采购清单")
     @PostMapping("order/musicalListExport")
     @PreAuthorize("@pcs.hasPermissions('order/musicalListExport')")
-    public void musicalListExport(HttpServletResponse response, String musicGroupId){
+    public void musicalListExport(HttpServletResponse response, String musicGroupId) {
         List<Goods> musicalList = studentPaymentOrderDetailService.getMusicalList(musicGroupId);
         try {
-            HSSFWorkbook workbook = POIUtil.exportExcel(new String[] {"分部","乐团","商品类型", "商品名称", "型号", "数量"}, new String[] {
-                    "brief","memo","type.desc","name","specification","sellCount"}, musicalList);
+            HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"分部", "乐团", "商品类型", "商品名称", "型号", "数量"}, new String[]{
+                    "brief", "memo", "type.desc", "name", "specification", "sellCount"}, musicalList);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
             response.flushBuffer();
@@ -109,11 +109,11 @@ public class ExportController extends BaseController {
     @ApiOperation(value = "导出学员采购清单明细")
     @PostMapping("order/musicalListDetailExport")
     @PreAuthorize("@pcs.hasPermissions('order/musicalListDetailExport')")
-    public void musicalListDetailExport(HttpServletResponse response, String musicGroupId){
+    public void musicalListDetailExport(HttpServletResponse response, String musicGroupId) {
         List<musicalListDetailDto> musicalList = studentPaymentOrderDetailService.getMusicalListDetail(musicGroupId);
         try {
-            HSSFWorkbook workbook = POIUtil.exportExcel(new String[] {"分部", "乐团","学员编号","学员姓名","购买商品", "采购方式", "乐器金额", "教辅金额", "课程金额", "订单总价"}, new String[] {
-                    "organName","musicGroupName","userId","username","goodsNames","kitGroupPurchaseTypeEnum.msg","musicalAmount","accessoriesAmount","courseAmount","orderAmount"}, musicalList);
+            HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"分部", "乐团", "学员编号", "学员姓名", "购买商品", "采购方式", "乐器金额", "教辅金额", "课程金额", "订单总价"}, new String[]{
+                    "organName", "musicGroupName", "userId", "username", "goodsNames", "kitGroupPurchaseTypeEnum.msg", "musicalAmount", "accessoriesAmount", "courseAmount", "orderAmount"}, musicalList);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
             response.flushBuffer();
@@ -130,8 +130,8 @@ public class ExportController extends BaseController {
     public void queryStudentApplyDetailExport(StudentRegistrationQueryInfo queryInfo, HttpServletResponse response) {
         List<StudentApplyDetailDto> studentApplyDetail = studentRegistrationService.queryStudentDetailPage(queryInfo).getRows();
         try {
-            HSSFWorkbook workbook = POIUtil.exportExcel(new String[] { "学生姓名","家长姓名", "年级", "班级", "性别", "服从调剂","报名专业", "实际专业","联系电话", "学员缴费状态", "乐器购买方式"}, new String[] {
-                    "studentName","parentsName", "currentGrade", "currentClass", "gender.description", "isAllowAdjust.msg", "subjectName", "actualSubjectName", "parentsPhone","paymentStatus.desc","kitGroupPurchaseTypeEnum.msg"}, studentApplyDetail);
+            HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"学生姓名", "家长姓名", "年级", "班级", "性别", "服从调剂", "报名专业", "实际专业", "联系电话", "学员缴费状态", "乐器购买方式"}, new String[]{
+                    "studentName", "parentsName", "currentGrade", "currentClass", "gender.description", "isAllowAdjust.msg", "subjectName", "actualSubjectName", "parentsPhone", "paymentStatus.desc", "kitGroupPurchaseTypeEnum.msg"}, studentApplyDetail);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
             response.flushBuffer();
@@ -148,8 +148,8 @@ public class ExportController extends BaseController {
     public void export(CourseScheduleTeacherSalaryQueryInfo queryInfo, HttpServletResponse response) {
         List<TeacherSalaryDto> teacherSalaries = courseScheduleTeacherSalaryService.querySalaries(queryInfo).getRows();
         try {
-            HSSFWorkbook workbook = POIUtil.exportExcel(new String[] { "用户编号","用户名", "手机号", "课程类型", "实际薪水", "补助", "结算时间", "教师角色"}, new String[] {
-                    "userId","username", "phone", "type.msg", "name", "actualSalary", "subsidy", "settlementTime", "teacherRole.msg"}, teacherSalaries);
+            HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"用户编号", "用户名", "手机号", "课程类型", "实际薪水", "补助", "结算时间", "教师角色"}, new String[]{
+                    "userId", "username", "phone", "type.msg", "name", "actualSalary", "subsidy", "settlementTime", "teacherRole.msg"}, teacherSalaries);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
             response.flushBuffer();
@@ -180,62 +180,77 @@ public class ExportController extends BaseController {
             if (queryInfo.getOrderType().equals("1")) {
                 BigDecimal comAmount = row.getComAmount() == null ? BigDecimal.ZERO : row.getComAmount();
                 row.setActualAmount(comAmount);
-            }else {
+            } else if (queryInfo.getOrderType().equals("2")) {
                 BigDecimal perAmount = row.getPerAmount() == null ? BigDecimal.ZERO : row.getPerAmount();
                 row.setActualAmount(perAmount);
             }
+            if (row.getActualAmount() == null) {
+                row.setActualAmount(BigDecimal.ZERO);
+            }
             BigDecimal transferFee = (row.getActualAmount().multiply(new BigDecimal(0.28)).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_UP);
             row.setTransferFee(transferFee);
             List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailDao.findApplyOrderGoods(row.getId());
             BigDecimal musicalFee = BigDecimal.ZERO;
             BigDecimal teachingFee = BigDecimal.ZERO;
-            if(orderDetails.size() > 0) {
+            if (orderDetails.size() > 0) {
                 for (StudentPaymentOrderDetail orderDetail : orderDetails) {
                     if (orderDetail.getType().equals(OrderDetailTypeEnum.MUSICAL)) {
-                        musicalFee =  musicalFee.add(orderDetail.getPrice());
+                        musicalFee = musicalFee.add(orderDetail.getPrice());
                     } else if (orderDetail.getType().equals(OrderDetailTypeEnum.ACCESSORIES) || orderDetail.getType().equals(OrderDetailTypeEnum.TEACHING)) {
-                        teachingFee =  teachingFee.add(orderDetail.getPrice());
+                        teachingFee = teachingFee.add(orderDetail.getPrice());
                     }
                 }
             }
             row.setMusicalFee(musicalFee);
             row.setTeachingFee(teachingFee);
             //专业
-            if(row.getGroupType().equals(GroupType.MUSIC)) {
-                StudentRegistration studentRegistration = studentRegistrationDao.findStudentByMusicGroupIdAndUserId(row.getMusicGroupId(),row.getUserId());
-                row.setSubjectName(studentRegistration.getSubjectName());
-                row.setOrganName(studentRegistration.getOrganName());
-                row.setSchoolName(studentRegistration.getSchoolName());
-                if(studentRegistration.getKitType()!= null && studentRegistration.getKitType().equals(KitPurchaseMethodEnum.LEASE)){
-                    row.setLeaseFee(musicalFee);
-                    row.setMusicalFee(BigDecimal.ZERO);
+            if (row.getGroupType().equals(GroupType.MUSIC)) {
+                StudentRegistration studentRegistration = studentRegistrationDao.findStudentByMusicGroupIdAndUserId(row.getMusicGroupId(), row.getUserId());
+                if (studentRegistration != null) {
+                    row.setSubjectName(studentRegistration.getSubjectName());
+                    row.setOrganName(studentRegistration.getOrganName());
+                    row.setSchoolName(studentRegistration.getSchoolName());
+                    if (studentRegistration.getKitType() != null && studentRegistration.getKitType().equals(KitPurchaseMethodEnum.LEASE)) {
+                        row.setLeaseFee(musicalFee);
+                        row.setMusicalFee(BigDecimal.ZERO);
+                    }
                 }
-            }else if (row.getGroupType().equals(GroupType.VIP)){
+            } else if (row.getGroupType().equals(GroupType.VIP)) {
                 VipGroup vipGroupInfo = vipGroupDao.findVipGroupInfo(Integer.parseInt(row.getMusicGroupId()), row.getClassGroupId());
-                if(vipGroupInfo != null) {
+                if (vipGroupInfo != null) {
                     row.setOrganName(vipGroupInfo.getOrganName());
                     row.setSchoolName(vipGroupInfo.getSchoolName());
                     row.setSubjectName(vipGroupInfo.getSubjectName());
                 }
 
-            }else if(row.getGroupType().equals(GroupType.SPORADIC)){
+            } else if (row.getGroupType().equals(GroupType.SPORADIC)) {
                 SporadicChargeInfo sporadicChargeInfo = sporadicChargeInfoDao.findInfoById(Integer.parseInt(row.getMusicGroupId()));
-                row.setSporadicAmount(row.getActualAmount());
-                row.setMusicalFee(BigDecimal.ZERO);
-                row.setTeachingFee(BigDecimal.ZERO);
-                row.setTeachingFee(BigDecimal.ZERO);
-                if(sporadicChargeInfo.getChargeType().equals("1")){
-                    row.setSporadicType("考级");
-                }else if(sporadicChargeInfo.getChargeType().equals("2")){
-                    row.setSporadicType("缴费");
-                }else if(sporadicChargeInfo.getChargeType().equals("3")){
-                    row.setSporadicType("声部更改");
-                }else if(sporadicChargeInfo.getChargeType().equals("4")){
-                    row.setSporadicType("乐器更换");
+                if(sporadicChargeInfo != null) {
+                    row.setSporadicAmount(row.getActualAmount());
+                    row.setMusicalFee(BigDecimal.ZERO);
+                    row.setTeachingFee(BigDecimal.ZERO);
+                    row.setTeachingFee(BigDecimal.ZERO);
+                    if (sporadicChargeInfo.getChargeType().equals("1")) {
+                        row.setSporadicType("考级");
+                    } else if (sporadicChargeInfo.getChargeType().equals("2")) {
+                        row.setSporadicType("缴费");
+                    } else if (sporadicChargeInfo.getChargeType().equals("3")) {
+                        row.setSporadicType("声部更改");
+                    } else if (sporadicChargeInfo.getChargeType().equals("4")) {
+                        row.setSporadicType("乐器更换");
+                    }
+                    row.setOrganName(sporadicChargeInfo.getOrganName());
                 }
-                row.setOrganName(sporadicChargeInfo.getOrganName());
             }
-            String paymentChannel = row.getPaymentChannel().equals("YQPAY") ? "双乾" : "汇付";
+            String paymentChannel = "";
+            if (row.getPaymentChannel() == null) {
+            } else if (row.getPaymentChannel().equals("YQPAY")) {
+                paymentChannel = "双乾";
+            } else if (row.getPaymentChannel().equals("ADAPAY")) {
+                paymentChannel = "汇付";
+            } else if (row.getPaymentChannel().equals("BALANCE")) {
+                paymentChannel = "余额";
+            }
             row.setPaymentChannel(paymentChannel);
             row.setId(i);
             i++;
@@ -243,9 +258,9 @@ public class ExportController extends BaseController {
 
         try {
             String[] header = {"序号", "学生姓名", "交易流水号", "订单编号", "收款渠道", "收款账户", "支付金额", "到账时间",
-            "关联乐团ID/VIP课ID","课程形态","押金","乐器","教辅费用","零星收款费用","零星收款类别","手续费","专业","分部","单位/学校","备注"};
+                    "关联乐团ID/VIP课ID", "课程形态", "押金", "乐器", "教辅费用", "零星收款费用", "零星收款类别", "手续费", "专业", "分部", "单位/学校", "备注"};
             String[] body = {"id", "user.username", "transNo", "orderNo", "paymentChannel", "merNos", "actualAmount", "payTime", "musicGroupId",
-            "groupType.desc","leaseFee","musicalFee","teachingFee","sporadicAmount","sporadicType","transferFee","subjectName","organName","schoolName","memo"};
+                    "groupType.desc", "leaseFee", "musicalFee", "teachingFee", "sporadicAmount", "sporadicType", "transferFee", "subjectName", "organName", "schoolName", "memo"};
             HSSFWorkbook workbook = POIUtil.exportExcel(header, body, studentPaymentOrderPageInfo.getRows());
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");