Browse Source

Merge remote-tracking branch 'origin/master'

Joburgess 5 years ago
parent
commit
9a6aa1cf5e

+ 3 - 0
cms/src/main/java/com/ym/mec/cms/service/impl/SysNewsInformationServiceImpl.java

@@ -42,12 +42,15 @@ public class SysNewsInformationServiceImpl extends BaseServiceImpl<Long, SysNews
 	public Map<String,PageInfo<SysNewsInformation>> getHomeList(NewsInformationQueryInfo queryInfo) {
 		//1精彩活动,2热门资讯,3banner类型
 		Map<String,PageInfo<SysNewsInformation>> homeList = new HashMap<>();
+		queryInfo.setStatus(NewsStatusEnum.SHOW);
 		queryInfo.setType(1);
 		homeList.put("active",queryPage(queryInfo));
 		queryInfo.setType(2);
 		homeList.put("hot",queryPage(queryInfo));
 		queryInfo.setType(3);
 		homeList.put("banner",queryPage(queryInfo));
+		queryInfo.setType(5);
+		homeList.put("flash",queryPage(queryInfo));
 		return homeList;
 	}
 

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleTeacherSalaryDao.java

@@ -334,4 +334,18 @@ public interface CourseScheduleTeacherSalaryDao extends BaseDAO<Long, CourseSche
 	 * @return
 	 */
 	List<Long> querySettlementScheduleId(String courseScheduleIds);
+	
+	/**
+	 * 获取所有线上课
+	 * @param groupType
+	 * @return
+	 */
+	List<CourseScheduleTeacherSalary> queryOnlineCourseByGroupType(GroupType groupType);
+	/**
+	 * 该用户是不是这个群组的老师
+	 * @param groupId
+	 * @param userId
+	 * @return
+	 */
+    Boolean isTeacher(@Param("groupId") Integer groupId, @Param("userId") Integer userId);
 }

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/VipGroupDao.java

@@ -335,4 +335,10 @@ public interface VipGroupDao extends BaseDAO<Long, VipGroup> {
      * @return
      */
     List<Map<Integer,String>> queryUserVipStatus(@Param("userIds") Set<Integer> userIds);
+    
+    /**
+     * 临时用
+     * @return
+     */
+    List<VipCourseStudentInfoDto> queryVipCourseStudentInfo();
 }

+ 46 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/VipCourseStudentInfoDto.java

@@ -0,0 +1,46 @@
+package com.ym.mec.biz.dal.dto;
+
+import java.math.BigDecimal;
+
+public class VipCourseStudentInfoDto {
+
+	private BigDecimal totalAmount;
+
+	private Integer studentNum;
+
+	private Long musicGroupId;
+
+	private Integer totalCourseTimes;
+
+	public BigDecimal getTotalAmount() {
+		return totalAmount;
+	}
+
+	public void setTotalAmount(BigDecimal totalAmount) {
+		this.totalAmount = totalAmount;
+	}
+
+	public Integer getStudentNum() {
+		return studentNum;
+	}
+
+	public void setStudentNum(Integer studentNum) {
+		this.studentNum = studentNum;
+	}
+
+	public Long getMusicGroupId() {
+		return musicGroupId;
+	}
+
+	public void setMusicGroupId(Long musicGroupId) {
+		this.musicGroupId = musicGroupId;
+	}
+
+	public Integer getTotalCourseTimes() {
+		return totalCourseTimes;
+	}
+
+	public void setTotalCourseTimes(Integer totalCourseTimes) {
+		this.totalCourseTimes = totalCourseTimes;
+	}
+}

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysUserContracts.java

@@ -11,7 +11,7 @@ public class SysUserContracts {
 
 	public enum ContractType implements BaseEnum<String, ContractType> {
 
-		REGISTER("注册"), INSTRUMENT("乐器借用"), COURSES("课程购买"), PRACTICE("网管课购买");
+		REGISTER("注册"), INSTRUMENT("乐器借用"), COURSES("课程购买"), VIP_COURSES("VIP课程购买"), PRACTICE("网管课购买");
 
 		private String desc;
 

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

@@ -12,7 +12,9 @@ import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.BaseService;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 public interface ClassGroupService extends BaseService<Integer, ClassGroup> {
 
@@ -404,4 +406,11 @@ public interface ClassGroupService extends BaseService<Integer, ClassGroup> {
      */
     PageInfo endFindClassGroups(EndCourseScheduleQueryInfo queryInfo);
 
+    /**
+     *
+     * @param groupId
+     * @param userId
+     * @return
+     */
+    Map<String,Object> getUserInfoWithUserId(Integer groupId, Integer userId);
 }

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/VipGroupService.java

@@ -392,4 +392,9 @@ public interface VipGroupService extends BaseService<Long, VipGroup> {
      */
     List<TeacherBasicDto> findTeacherWithVipGroupOrganAndSubject(Long vipGroupId);
 
+    /**
+     * 更新线上课老师的课酬
+     * @return
+     */
+    boolean updateHistoryTeacherSalaryOfOnline();
 }

+ 51 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -729,8 +729,25 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         }
         //获取相关老师
         teacherIds.addAll(classGroupDao.findGroupTeacher(groupId));
+
         if(teacherIds.size() > 0){
-            students.addAll(teacherDao.queryTeacherImModel(teacherIds));
+            List<ImUserModel> userModels = teacherDao.queryTeacherImModel(teacherIds);
+            userModels.forEach(e->{
+                if(musicGroup != null){
+                    if(musicGroup.getTeamTeacherId() != null && Integer.parseInt(e.getId()) == musicGroup.getTeamTeacherId()){
+                        e.setTitle("运营主管");
+                    }else if(musicGroup.getEducationalTeacherId() != null && Integer.parseInt(e.getId()) == musicGroup.getEducationalTeacherId()){
+                        e.setTitle("教务老师");
+                    }else if(musicGroup.getDirectorUserId() != null && Integer.parseInt(e.getId()) == musicGroup.getDirectorUserId()){
+                        e.setTitle("乐队指导");
+                    }else if(courseScheduleTeacherSalaryDao.isTeacher(groupId,Integer.parseInt(e.getId()))){
+                        e.setTitle("指导老师");
+                    }
+                }else if(courseScheduleTeacherSalaryDao.isTeacher(groupId,Integer.parseInt(e.getId()))){
+                    e.setTitle("指导老师");
+                }
+            });
+            students.addAll(userModels);
         }
         return students;
     }
@@ -2478,6 +2495,39 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         return pageInfo;
     }
 
+    @Override
+    public Map<String, Object> getUserInfoWithUserId(Integer groupId, Integer userId) {
+        MusicGroup musicGroup = musicGroupDao.findByClassId(groupId);
+        SysUser user = teacherDao.getUser(userId);
+        Map<String,Object> map = new HashMap<>(4);
+        if(musicGroup != null){
+            if(musicGroup.getTeamTeacherId() != null && userId.equals(musicGroup.getTeamTeacherId())){
+                map.put("name",user.getRealName() + "(运营主管)");
+            }else if(musicGroup.getEducationalTeacherId() != null && userId.equals(musicGroup.getEducationalTeacherId())){
+                map.put("name",user.getRealName() + "(教务老师)");
+            }else if(musicGroup.getDirectorUserId() != null && userId.equals(musicGroup.getDirectorUserId())){
+                map.put("name",user.getRealName() + "(乐队指导)");
+            }else if(courseScheduleTeacherSalaryDao.isTeacher(groupId,userId)){
+                map.put("name",user.getRealName() + "(指导老师)");
+            }else {
+                map.put("name",user.getUsername());
+            }
+        }else {
+            if(courseScheduleTeacherSalaryDao.isTeacher(groupId,userId)){
+                map.put("name",user.getRealName() + "(指导老师)");
+            }else {
+                map.put("name",user.getUsername());
+            }
+        }
+        map.put("userId",userId);
+        if(StringUtils.isEmpty(user.getAvatar())){
+            map.put("avatar","https://daya-online.oss-cn-beijing.aliyuncs.com/201912/RkoZBNq.jpeg");
+        }else {
+            map.put("avatar",user.getAvatar());
+        }
+        return map;
+    }
+
 
     @Override
     public ClassGroup findGroupById(Integer groupId) {

+ 7 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ContractServiceImpl.java

@@ -382,7 +382,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 
 		SysUserContracts sysUserContracts = new SysUserContracts();
 		sysUserContracts.setCreateTime(date);
-		sysUserContracts.setType(ContractType.REGISTER);
+		sysUserContracts.setType(ContractType.COURSES);
 		sysUserContracts.setUrl(pdfFilePath);
 		sysUserContracts.setUserId(userId);
 
@@ -483,7 +483,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 		Date date = new Date();
 
 		// 合成freemarker
-		String srcPdfPath = contractBaseDir + "/courses/" + dateFormat1.format(date) + "/" + userId + ".pdf";
+		String srcPdfPath = contractBaseDir + "/vipCourses/" + dateFormat1.format(date) + "/" + userId + ".pdf";
 
 		File srcFile = new File(srcPdfPath);
 
@@ -545,7 +545,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 
 		SysUserContracts sysUserContracts = new SysUserContracts();
 		sysUserContracts.setCreateTime(date);
-		sysUserContracts.setType(ContractType.REGISTER);
+		sysUserContracts.setType(ContractType.VIP_COURSES);
 		sysUserContracts.setUrl(pdfFilePath);
 		sysUserContracts.setUserId(userId);
 
@@ -622,7 +622,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 		Date date = new Date();
 
 		// 合成freemarker
-		String srcPdfPath = contractBaseDir + "/courses/" + dateFormat1.format(date) + "/" + userId + ".pdf";
+		String srcPdfPath = contractBaseDir + "/goods/" + dateFormat1.format(date) + "/" + userId + ".pdf";
 
 		File srcFile = new File(srcPdfPath);
 
@@ -712,7 +712,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 
 		SysUserContracts sysUserContracts = new SysUserContracts();
 		sysUserContracts.setCreateTime(date);
-		sysUserContracts.setType(ContractType.REGISTER);
+		sysUserContracts.setType(ContractType.INSTRUMENT);
 		sysUserContracts.setUrl(pdfFilePath);
 		sysUserContracts.setUserId(userId);
 
@@ -876,7 +876,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 		} catch (IOException e) {
 			throw new BizException("生成pdf协议失败", e);
 		}
-		String organCode = "91440300326364429H";
+		/*String organCode = "91440300326364429H";
 		SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
 		if (organTsign == null) {
 			throw new BizException("甲方未创建签章");
@@ -886,7 +886,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 
 		if (sysUserTsign != null) {
 			eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
-		}
+		}*/
 
 		// 上传到oss
 		String dateStrOss = dateFormatOss.format(date);

+ 26 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -24,10 +24,12 @@ import com.ym.mec.im.ImFeignService;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
+
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
@@ -2726,4 +2728,28 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         }
 		return teacherByOrganAndSubject;
 	}
+
+	@Override
+	@Async
+	public boolean updateHistoryTeacherSalaryOfOnline() {
+		// 查询所有含有线上课的课程组,线上课节数,实付金额
+		List<VipCourseStudentInfoDto> list = vipGroupDao.queryVipCourseStudentInfo();
+		Map<Long, VipCourseStudentInfoDto> map = list.stream().collect(Collectors.toMap(VipCourseStudentInfoDto::getMusicGroupId, e -> e));
+
+		VipCourseStudentInfoDto dto = null;
+		// 查询需要修改的课酬记录
+		List<CourseScheduleTeacherSalary> teacherSalaryList = courseScheduleTeacherSalaryDao.queryOnlineCourseByGroupType(GroupType.VIP);
+		for (CourseScheduleTeacherSalary ts : teacherSalaryList) {
+			dto = map.get(ts.getCourseScheduleId());
+			if (dto != null) {
+				ts.setExpectSalary(dto.getTotalAmount().divide(new BigDecimal((dto.getTotalCourseTimes() / dto.getStudentNum()))));
+			}
+		}
+		
+		if(teacherSalaryList.size() > 0){
+			courseScheduleTeacherSalaryDao.batchUpdateTeacherExpectSalarys(teacherSalaryList);
+		}
+
+		return true;
+	}
 }

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

@@ -229,7 +229,7 @@
 		<if test="days!=null">
 			AND cs.class_date_ &lt;= DATE_FORMAT(DATE_ADD( NOW( ), INTERVAL - #{days} DAY ),'%Y-%m-%d')
 		</if>
-		AND cs.type_='VIP'
+		AND cs.type_ IN ('VIP','PRACTICE')
 		AND csts.settlement_time_ IS NULL
 		AND (cs.del_flag_ IS NULL OR cs.del_flag_=0)
     </select>
@@ -602,4 +602,14 @@
 		WHERE cs.class_date_ BETWEEN #{firstDayOfMonth} AND #{lastDayOfMonth} AND cs.`del_flag_` != 1 AND cs.group_type_ = 'PRACTICE' AND ts.settlement_time_ IS NOT NULL
 		GROUP BY ts.id_,ta.id_
 	</select>
+	
+	<select id="queryOnlineCourseByGroupType" resultMap="CourseScheduleTeacherSalary">
+		SELECT csts.*  FROM `course_schedule_teacher_salary` csts LEFT JOIN `course_schedule` cs on csts.`course_schedule_id_` = cs.`id_` 
+		WHERE cs.`group_type_` = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} and cs.`teach_mode_` = 'ONLINE'
+	</select>
+
+    <select id="isTeacher" resultType="java.lang.Boolean">
+		SELECT COUNT(DISTINCT csts.user_id_) FROM class_group_teacher_mapper csts
+		WHERE csts.class_group_id_ = #{groupId} AND csts.user_id_ = #{userId}
+	</select>
 </mapper>

+ 14 - 0
mec-biz/src/main/resources/config/mybatis/VipGroupMapper.xml

@@ -71,6 +71,13 @@
         <result property="courseStatus" column="course_status_"/>
     </resultMap>
 
+    <resultMap id="vipCourseStudentInfoDto" type="com.ym.mec.biz.dal.dto.VipCourseStudentInfoDto">
+        <result property="totalAmount" column="total_amount_"/>
+        <result property="studentNum" column="student_num_"/>
+        <result property="musicGroupId" column="music_group_id_"/>
+        <result property="totalCourseTimes" column="total_times_"/>
+    </resultMap>
+
     <resultMap id="vipGroupManageDetailDto" type="com.ym.mec.biz.dal.dto.VipGroupManageDetailDto" extends="VipGroup">
         <result property="studentNum" column="student_num_"/>
         <result property="subjectIdList" column="subject_id_list_"/>
@@ -912,4 +919,11 @@
         </foreach>
         GROUP BY cgsm.user_id_
     </select>
+    
+    <select id="queryVipCourseStudentInfo" resultMap="vipCourseStudentInfoDto">
+        SELECT cssp.music_group_id_,sum(cssp.expect_price_) total_amount_,count(DISTINCT(cssp.user_id_)) student_num_,count(cssp.id_) total_times_   
+		FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs on cs.id_ = cssp.course_schedule_id_
+		WHERE cs.group_type_ = 'VIP' and cs.teach_mode_ = 'ONLINE'
+		GROUP BY cssp.music_group_id_
+    </select>
 </mapper>

+ 10 - 0
mec-common/common-core/src/main/java/com/ym/mec/common/entity/ImUserModel.java

@@ -7,6 +7,8 @@ public class ImUserModel {
 
     public String name;
 
+    private String title;
+
     public String portrait;
 
     private Integer minute;
@@ -26,6 +28,14 @@ public class ImUserModel {
     public ImUserModel() {
     }
 
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
     public String getId() {
         return id;
     }

+ 9 - 1
mec-student/src/main/java/com/ym/mec/student/controller/StudentManageController.java

@@ -72,7 +72,6 @@ public class StudentManageController extends BaseController {
         return succeed();
     }
 
-
     @ApiOperation(value = "根据群编号,获取群组所有成员基本信息")
     @GetMapping("classGroup/findGroupUsers")
     public Object findGroupUsers(Integer groupId) {
@@ -82,6 +81,15 @@ public class StudentManageController extends BaseController {
         return succeed(classGroupService.findGroupUsers(groupId));
     }
 
+    @ApiOperation(value = "根据群编号,获取用户群名片")
+    @GetMapping("classGroup/getUserInfoWithUserId")
+    public Object getUserInfoWithUserId(Integer groupId,Integer userId) {
+        if (groupId == null || userId == null) {
+            return failed("参数校验错误");
+        }
+        return succeed(classGroupService.getUserInfoWithUserId(groupId,userId));
+    }
+
     @ApiOperation(value = "获取用户账户信息")
     @GetMapping("userCashAccount/get")
     public Object add() {

+ 9 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/ClassGroupController.java

@@ -68,4 +68,13 @@ public class ClassGroupController extends BaseController {
         return succeed(courseScheduleEvaluateService.addStudyReport(courseScheduleEvaluate));
     }
 
+    @ApiOperation(value = "根据群编号,获取用户群名片")
+    @GetMapping("/getUserInfoWithUserId")
+    public Object getUserInfoWithUserId(Integer groupId,Integer userId) {
+        if (groupId == null || userId == null) {
+            return failed("参数校验错误");
+        }
+        return succeed(classGroupService.getUserInfoWithUserId(groupId,userId));
+    }
+
 }

+ 12 - 0
mec-web/src/main/java/com/ym/mec/web/controller/CourseScheduleTeacherSalaryController.java

@@ -2,9 +2,12 @@ package com.ym.mec.web.controller;
 
 import com.ym.mec.biz.dal.page.CourseScheduleTeacherSalaryQueryInfo;
 import com.ym.mec.biz.service.CourseScheduleTeacherSalaryService;
+import com.ym.mec.biz.service.VipGroupService;
 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.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -18,6 +21,9 @@ public class CourseScheduleTeacherSalaryController extends BaseController {
 
     @Autowired
     private CourseScheduleTeacherSalaryService courseScheduleTeacherSalaryService;
+    
+    @Autowired
+    private VipGroupService vipGroupService;
 
     @ApiOperation(value = "分页查询教师薪酬列表")
     @GetMapping("/queryPage")
@@ -25,4 +31,10 @@ public class CourseScheduleTeacherSalaryController extends BaseController {
     public Object queryPage(CourseScheduleTeacherSalaryQueryInfo queryInfo) {
         return succeed(courseScheduleTeacherSalaryService.querySalaries(queryInfo));
     }
+    
+    @GetMapping("/updateHistoryTeacherSalaryOfOnline")
+    public Object updateHistoryTeacherSalaryOfOnline() {
+    	vipGroupService.updateHistoryTeacherSalaryOfOnline();
+        return succeed();
+    }
 }

+ 9 - 0
mec-web/src/main/java/com/ym/mec/web/controller/education/ImController.java

@@ -67,4 +67,13 @@ public class ImController extends BaseController {
         return succeed(classGroupService.findGroupUsers(groupId));
     }
 
+    @ApiOperation(value = "根据群编号,获取用户群名片")
+    @GetMapping("/getUserInfoWithUserId")
+    public Object getUserInfoWithUserId(Integer groupId,Integer userId) {
+        if (groupId == null || userId == null) {
+            return failed("参数校验错误");
+        }
+        return succeed(classGroupService.getUserInfoWithUserId(groupId,userId));
+    }
+
 }