shangke 2 years ago
parent
commit
f09ac26422

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TeacherDefaultVipGroupSalary.java

@@ -33,6 +33,9 @@ public class TeacherDefaultVipGroupSalary extends BaseEntity {
 	/** 线下课薪酬 */
 	@ApiModelProperty(value = "线下课薪酬", required = false)
 	private java.math.BigDecimal offlineClassesSalary;
+
+	@ApiModelProperty("课程类型")
+	private String groupType;
 	
 	/**  */
 	private java.util.Date createTime;
@@ -104,6 +107,14 @@ public class TeacherDefaultVipGroupSalary extends BaseEntity {
 		this.musicTheory = musicTheory;
 	}
 
+	public String getGroupType() {
+		return groupType;
+	}
+
+	public void setGroupType(String groupType) {
+		this.groupType = groupType;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

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

@@ -16,6 +16,7 @@
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
         <result column="tenant_id_" property="tenantId"/>
+        <result column="group_type_" property="groupType" />
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -79,7 +80,9 @@
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="TeacherDefaultVipGroupSalary" parameterType="map">
-        SELECT tdvgs.*,vgc.name_ vip_group_category_name_,vgc.music_theory_ FROM teacher_default_vip_group_salary tdvgs
+        SELECT tdvgs.*,vgc.name_ vip_group_category_name_,vgc.music_theory_
+             , vgc.group_type_
+        FROM teacher_default_vip_group_salary tdvgs
         LEFT JOIN  vip_group_category vgc ON tdvgs.vip_group_category_id_ = vgc.id_
         <where>
         	tdvgs.tenant_id_ = #{tenantId}

+ 19 - 7
mec-web/src/main/java/com/ym/mec/web/controller/TeacherDefaultVipGroupSalaryController.java

@@ -1,19 +1,19 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.common.page.PageInfo;
 import com.yonge.log.model.AuditLogAnnotation;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 
 import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.GetMapping;
-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;
+import org.springframework.web.bind.annotation.*;
 
 import com.ym.mec.biz.dal.entity.TeacherDefaultVipGroupSalary;
 import com.ym.mec.biz.service.TeacherDefaultVipGroupSalaryService;
@@ -40,10 +40,22 @@ public class TeacherDefaultVipGroupSalaryController extends BaseController {
     }
 
     @ApiOperation(value = "获取教师的vip课酬列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "search", value = "关键字匹配", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "groupType", value = "课程类型", dataType = "String", paramType = "query"),
+    })
     @GetMapping("/queryPageByTeacherId")
     @PreAuthorize("@pcs.hasPermissions('teacherDefaultVipGroupSalary/queryPageByTeacherId')")
-    public Object queryPageByTeacherId(QueryInfo queryInfo){
-        return succeed(teacherDefaultVipGroupSalaryService.queryPage(queryInfo));
+    public Object queryPageByTeacherId(QueryInfo queryInfo, @RequestParam(defaultValue = "VIP") String groupType){
+
+        PageInfo<TeacherDefaultVipGroupSalary> salaryPageInfo = teacherDefaultVipGroupSalaryService.queryPage(queryInfo);
+
+        List<TeacherDefaultVipGroupSalary> collect = salaryPageInfo.getRows().stream()
+                .filter(x -> x.getGroupType().equals(groupType)).collect(Collectors.toList());
+        // 重置过滤后的数据
+        salaryPageInfo.setRows(collect);
+
+        return succeed(salaryPageInfo);
     }
 
     @ApiOperation(value = "批量新增、修改教师vip课酬")

+ 13 - 2
mec-web/src/main/java/com/ym/mec/web/controller/VipGroupCategoryController.java

@@ -19,7 +19,9 @@ import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
 import java.util.Optional;
+import java.util.stream.Collectors;
 
 @Api(tags = "vip课类别")
 @RequestMapping("vipGroupCategory")
@@ -57,10 +59,19 @@ public class VipGroupCategoryController extends BaseController {
 	}
 
 	@ApiOperation("获取教师课酬")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "userId", value = "教师id", dataType = "Integer", paramType = "query"),
+			@ApiImplicitParam(name = "groupType", value = "课程类型", dataType = "String", paramType = "query", defaultValue = "VIP"),
+	})
 	@PostMapping(value = "/findTeacherDefaultSalary")
 	@PreAuthorize("@pcs.hasPermissions('vipGroupCategory/findTeacherDefaultSalary')")
-	public Object findTeacherDefaultSalary(Integer userId) {
-		return succeed(vipGroupCategoryService.findTeacherSalary(userId));
+	public Object findTeacherDefaultSalary(Integer userId, @RequestParam(defaultValue = "VIP") String groupType) {
+
+		// 返回LIVE, VIP课薪资设置
+		List<VipGroupCategory> teacherSalary = vipGroupCategoryService.findTeacherSalary(userId).stream()
+				.filter(x -> x.getGroupType().equals(groupType)).collect(Collectors.toList());
+		
+		return succeed(teacherSalary);
 	}
 
 	@ApiOperation("新增")