Joburgess 5 vuotta sitten
vanhempi
commit
f8467f61c5

+ 14 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentApplyRefundsDao.java

@@ -2,8 +2,21 @@ package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.entity.StudentApplyRefunds;
 import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
 
 public interface StudentApplyRefundsDao extends BaseDAO<Long, StudentApplyRefunds> {
 
+    /**
+     * @describe 检测对应课程是否存在退课申请
+     * @author Joburgess
+     * @date 2019/11/10
+     * @param musicGroupIds: 乐团编号列表
+     * @return java.util.List<java.util.Map<java.lang.String,java.lang.Integer>>
+     */
+    List<Map<String,Integer>> checkIsApplyRefund(@Param("musicGroupIds") List<String> musicGroupIds,
+                                                 @Param("userId") Integer userId);
 	
-}
+}

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseListDto.java

@@ -57,6 +57,16 @@ public class CourseListDto {
     //续费状态
     private MusicGroupStudentFee.PaymentStatus paymentStatus;
 
+    private Integer isApply;
+
+    public Integer getIsApply() {
+        return isApply;
+    }
+
+    public void setIsApply(Integer isApply) {
+        this.isApply = isApply;
+    }
+
     public Integer getClassGroupId() {
         return classGroupId;
     }

+ 18 - 10
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseSchedule.java

@@ -1,6 +1,13 @@
 package com.ym.mec.biz.dal.entity;
 
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.enums.CourseStatusEnum;
+import com.ym.mec.biz.dal.enums.TeachModeEnum;
+import com.ym.mec.common.enums.BaseEnum;
 import io.swagger.annotations.ApiModelProperty;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.builder.ToStringBuilder;
 
 import java.math.BigDecimal;
 import java.text.ParseException;
@@ -8,15 +15,6 @@ import java.text.SimpleDateFormat;
 import java.util.List;
 import java.util.Objects;
 
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.biz.dal.enums.CourseStatusEnum;
-import com.ym.mec.biz.dal.enums.TeachModeEnum;
-import com.ym.mec.common.enums.BaseEnum;
-
 /**
  * 对应数据库表(course_schedule):
  */
@@ -117,7 +115,17 @@ public class CourseSchedule {
 
 	/** 主教是否不需要重新生成课酬 */
 	private boolean bishopTeacherSalaryNotCreate;
-	
+
+	private String classGroupName;
+
+	public String getClassGroupName() {
+		return classGroupName;
+	}
+
+	public void setClassGroupName(String classGroupName) {
+		this.classGroupName = classGroupName;
+	}
+
 	private SysUser teacher = new SysUser();
 
 	public boolean isBishopTeacherSalaryNotCreate() {

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/TeacherLeaveRecordService.java

@@ -15,7 +15,7 @@ public interface TeacherLeaveRecordService extends BaseService<Long, TeacherLeav
 	 * @param teacherLeaveRecord
 	 * @return
 	 */
-	public boolean askForLeave(Integer userId, TeacherLeaveRecord teacherLeaveRecord);
+	boolean askForLeave(Integer userId, TeacherLeaveRecord teacherLeaveRecord);
 
 	/**
 	 * 审批
@@ -25,7 +25,7 @@ public interface TeacherLeaveRecordService extends BaseService<Long, TeacherLeav
 	 * @param remark 备注
 	 * @return
 	 */
-	public boolean approve(Long id, Integer userId, AuditStatusEnum status, String remark);
+	boolean approve(Long id, Integer userId, AuditStatusEnum status, String remark);
 
 	/**
 	 * @describe 检测课程安排是否与老师的请假时间存在冲突

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

@@ -98,6 +98,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     private CourseScheduleService courseScheduleService;
     @Autowired
     private CourseScheduleStudentPaymentService courseScheduleStudentPaymentService;
+    @Autowired
+    private StudentApplyRefundsDao studentApplyRefundsDao;
 
 
     @Override
@@ -498,12 +500,16 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         //获取学员的乐团列表详情
         courseListDtos.addAll(classGroupDao.queryStudentMusicGroupCourses(StringUtils.join(musicGroupIds, ",")));
         courseListDtos.addAll(vipCourses);
+        //检测对应乐团是否已申请退费
+        List<Map<String, Integer>> isApplyMaps = studentApplyRefundsDao.checkIsApplyRefund(musicGroupIds, userId);
+        Map<String, Integer> isApplyMap= MapUtil.convertMybatisMap(isApplyMaps);
         //获取所有教学点名称列表
         Set<Integer> schoolIds = courseListDtos.stream().map(CourseListDto::getTeacherSchoolId).collect(Collectors.toSet());
         Map<Integer, String> schoolNames = MapUtil.convertMybatisMap(schoolDao.queryNameByIds(StringUtils.join(schoolIds, ",")));
 
         courseListDtos.forEach(e -> {
             e.setAddress(schoolNames.get(e.getTeacherSchoolId()));
+            e.setIsApply(isApplyMap.get(e.getMusicGroupId()));
             if (ClassGroupTypeEnum.VIP == e.getType()) {
                 e.setStudentNames(vipStuNames.get(e.getMusicGroupId()));
                 if (e.getOffLineClassesNum() > 0 && e.getOffLineClassesNum() <= 0) {

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

@@ -26,6 +26,7 @@
         <result column="student_num_" property="studentNum"/>
         <result column="leave_student_num_" property="leaveStudentNum"/>
         <result column="schoole_id_" property="schoolId"/>
+        <result column="class_group_name_" property="classGroupName"/>
     </resultMap>
     
     <resultMap type="com.ym.mec.biz.dal.dto.Mapper" id="Mapper">
@@ -1223,9 +1224,11 @@
             cs.name_,
             cs.student_num_,
             cs.leave_student_num_,
-            cs.schoole_id_
+            cs.schoole_id_,
+            cg.name_ class_group_name_
         from  course_schedule cs
           LEFT JOIN course_schedule_teacher_salary csts ON cs.id_=csts.course_schedule_id_
+          LEFT JOIN class_group cg ON cs.class_group_id_=cg.id_
         where cs.class_group_id_ IN
         <foreach collection="classGroupIds" item="classGroupId" open="(" close=")" separator=",">
             #{classGroupId}

+ 16 - 0
mec-biz/src/main/resources/config/mybatis/StudentApplyRefundsMapper.xml

@@ -109,4 +109,20 @@
             and sar.create_time_ &lt;= #{endTime}
         </if>
 	</select>
+
+    <select id="checkIsApplyRefund" resultType="java.util.Map">
+        SELECT
+            DISTINCT spo.music_group_id_ AS 'key',
+            sar.id_ IS NOT NULL AS 'value'
+        FROM
+            student_payment_order spo
+            LEFT JOIN student_apply_refunds sar ON sar.orig_payment_order_id_ = spo.id_
+        WHERE
+            spo.status_ = 'SUCCESS'
+            AND spo.user_id_=#{userId}
+            AND spo.music_group_id_ IN
+            <foreach collection="musicGroupIds" item="musicGroupId" open="(" close=")" separator=",">
+                #{musicGroupId}
+            </foreach>
+    </select>
 </mapper>

+ 20 - 7
mec-web/src/main/java/com/ym/mec/web/controller/TeacherLeaveRecordController.java

@@ -1,20 +1,22 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dto.TeacherLeaveRecordDto;
+import com.ym.mec.biz.dal.entity.TeacherLeaveRecord;
+import com.ym.mec.biz.dal.enums.AuditStatusEnum;
+import com.ym.mec.biz.service.TeacherLeaveRecordService;
+import com.ym.mec.common.controller.BaseController;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import com.ym.mec.auth.api.client.SysUserFeignService;
-import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.biz.dal.dto.TeacherLeaveRecordDto;
-import com.ym.mec.biz.dal.entity.TeacherLeaveRecord;
-import com.ym.mec.biz.service.TeacherLeaveRecordService;
-import com.ym.mec.common.controller.BaseController;
+import java.util.Objects;
 
 @RequestMapping("teacherLeaveRecord")
 @Api(tags = "教师请假记录服务")
@@ -55,4 +57,15 @@ public class TeacherLeaveRecordController extends BaseController {
     	
         return succeed(teacherLeaveRecord);
     }
+
+    @ApiOperation(value = "请假审核")
+    @PostMapping("/approve")
+    public Object approve(Long id, Integer userId, AuditStatusEnum status, String remark) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (Objects.isNull(sysUser)) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        teacherLeaveRecordService.approve(id,userId,status,remark);
+        return succeed();
+    }
 }