Jelajahi Sumber

Merge remote-tracking branch 'origin/master'

周箭河 5 tahun lalu
induk
melakukan
f845499f27

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysUserCashAccountDetailDao.java

@@ -29,4 +29,12 @@ public interface SysUserCashAccountDetailDao extends BaseDAO<Long, SysUserCashAc
      * @return
      */
     Integer countByTypeAndTime(@Param("currentMonth") String currentMonth,@Param("teacherId")Integer teacherId,@Param("activeId")Integer activeId);
+
+    /**
+     * 流水明细查询-包含账户余额与课程余额
+     * @param params
+     * @return
+     */
+    List<SysUserCashAccountDetail> queryAccountDetail(Map<String, Object> params);
+    int countAccountDetails(Map<String, Object> params);
 }

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SysUserCashAccountDetailService.java

@@ -2,10 +2,13 @@ package com.ym.mec.biz.service;
 
 import java.math.BigDecimal;
 
+import com.ym.mec.biz.dal.dto.CashAccountDetail;
 import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
 import com.ym.mec.biz.dal.enums.TransTypeEnum;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.BaseService;
 
 public interface SysUserCashAccountDetailService extends BaseService<Long, SysUserCashAccountDetail> {
@@ -34,4 +37,11 @@ public interface SysUserCashAccountDetailService extends BaseService<Long, SysUs
 	boolean addCashAccountDetail(Integer userId, BigDecimal amount, String origOrderId, String transNo, PlatformCashAccountDetailTypeEnum type,
 			TransTypeEnum transType, DealStatusEnum status, String comment,String description);
 
+	/**
+	 * 流水明细查询-包含账户余额与课程余额
+	 * @param queryInfo
+	 * @return
+	 */
+	PageInfo<SysUserCashAccountDetail> queryAccountDetail(CashAccountDetail queryInfo);
+
 }

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

@@ -1588,6 +1588,10 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                     //线上小班课
                     if(classGroup4MixDto.getCourseType().equals(CourseSchedule.CourseScheduleType.HIGH_ONLINE)){
                         Integer studentNum = classGroupStudentMapperDao.countClassGroupNormalStudentNum(classGroupTeacherMapper.getClassGroupId());
+                        if (studentNum < 3 || studentNum > 5) {
+                            String numWaring = studentNum < 3 ? "人数不能小于3," : "人数不能大于5,";
+                            throw new BizException(classGroup.getName() + numWaring + "请调整");
+                        }
                         salary = JSON.parseObject(teacherDefaultMusicGroupSalary.getSalaryRuleJson()).getBigDecimal(studentNum.toString());
                     }
 
@@ -1878,6 +1882,10 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                     //线上小班课
                     if(classGroup4MixDto.getCourseType().equals(CourseSchedule.CourseScheduleType.HIGH_ONLINE)){
                         Integer studentNum = classGroupStudentMapperDao.countClassGroupNormalStudentNum(classGroupTeacherMapper.getClassGroupId());
+                        if (studentNum < 3 || studentNum > 5) {
+                            String numWaring = studentNum < 3 ? "人数不能小于3," : "人数不能大于5,";
+                            throw new BizException(classGroup.getName() + numWaring + "请调整");
+                        }
                         salary = JSON.parseObject(teacherDefaultMusicGroupSalary.getSalaryRuleJson()).getBigDecimal(studentNum.toString());
                     }
 
@@ -2140,6 +2148,10 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                     //线上小班课
                     if(classGroup4MixDto.getCourseType().equals(CourseSchedule.CourseScheduleType.HIGH_ONLINE)){
                         Integer studentNum = classGroupStudentMapperDao.countClassGroupNormalStudentNum(classGroupTeacherMapper.getClassGroupId());
+                        if (studentNum < 3 || studentNum > 5) {
+                            String numWaring = studentNum < 3 ? "人数不能小于3," : "人数不能大于5,";
+                            throw new BizException(classGroup.getName() + numWaring + "请调整");
+                        }
                         salary = JSON.parseObject(teacherDefaultMusicGroupSalary.getSalaryRuleJson()).getBigDecimal(studentNum.toString());
                     }
 

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupTeacherMapperServiceImpl.java

@@ -358,6 +358,11 @@ public class ClassGroupTeacherMapperServiceImpl extends BaseServiceImpl<Long, Cl
                 //线上小班课
                 if (classGroupNoStartCourseSchedule.getType().equals(CourseSchedule.CourseScheduleType.HIGH_ONLINE)) {
                     Integer studentNum = classGroupStudentMapperDao.countClassGroupNormalStudentNum(classGroupTeacherMapper.getClassGroupId());
+                    if (studentNum < 3 || studentNum > 5) {
+                        ClassGroup classGroup = classGroupService.get(classGroupTeacherMapper.getClassGroupId());
+                        String numWaring = studentNum < 3 ? "人数不能小于3," : "人数不能大于5,";
+                        throw new BizException(classGroup.getName() + numWaring + "请调整");
+                    }
                     salary = JSON.parseObject(teacherDefaultMusicGroupSalary.getSalaryRuleJson()).getBigDecimal(studentNum.toString());
                 }
 
@@ -565,6 +570,11 @@ public class ClassGroupTeacherMapperServiceImpl extends BaseServiceImpl<Long, Cl
         //线上小班课
         if (courseSchedule.getType().equals(CourseSchedule.CourseScheduleType.HIGH_ONLINE)) {
             Integer studentNum = classGroupStudentMapperDao.countClassGroupNormalStudentNum(courseSchedule.getClassGroupId());
+            if (studentNum < 3 || studentNum > 5) {
+                ClassGroup classGroup = classGroupService.get(courseSchedule.getClassGroupId());
+                String numWaring = studentNum < 3 ? "人数不能小于3," : "人数不能大于5,";
+                throw new BizException(classGroup.getName() + numWaring + "请调整");
+            }
             teacherSalary = JSON.parseObject(teacherDefaultMusicGroupSalaryWithTeacherId.getSalaryRuleJson()).getBigDecimal(studentNum.toString());
         }
 

+ 24 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysUserCashAccountDetailServiceImpl.java

@@ -1,8 +1,11 @@
 package com.ym.mec.biz.service.impl;
 
 import java.math.BigDecimal;
-import java.util.Date;
+import java.util.*;
 
+import com.ym.mec.biz.dal.dto.CashAccountDetail;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.util.collection.MapUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
@@ -77,4 +80,24 @@ public class SysUserCashAccountDetailServiceImpl extends BaseServiceImpl<Long, S
 
 		return true;
 	}
+
+	@Override
+	public PageInfo<SysUserCashAccountDetail> queryAccountDetail(CashAccountDetail queryInfo) {
+		PageInfo<SysUserCashAccountDetail> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+		Map<String, Object> params = new HashMap<>();
+		MapUtil.populateMap(params, queryInfo);
+
+		List<SysUserCashAccountDetail> dataList = null;
+		int count = sysUserCashAccountDetailDao.countAccountDetails(params);
+		if (count > 0) {
+			pageInfo.setTotal(count);
+			params.put("offset", pageInfo.getOffset());
+			dataList = sysUserCashAccountDetailDao.queryAccountDetail(params);
+		}
+		if (count == 0) {
+			dataList = new ArrayList<>();
+		}
+		pageInfo.setRows(dataList);
+		return pageInfo;
+	}
 }

+ 27 - 0
mec-biz/src/main/resources/config/mybatis/SysUserCashAccountDetailMapper.xml

@@ -204,4 +204,31 @@
       WHERE s.type_ = 'REWARDS' AND DATE_FORMAT(s.create_time_,'%Y-%m') = #{currentMonth}
       AND s.user_id_ = #{teacherId} AND s.description_ = #{activeId}
     </select>
+
+    <sql id="queryAccountDetailCondition">
+        <where>
+            <if test="userId!=null">
+                user_id_=#{userId}
+            </if>
+        </where>
+    </sql>
+    <select id="queryAccountDetail" resultMap="SysUserCashAccountDetail">
+        SELECT * FROM (
+            SELECT create_time_,amount_,balance_,status_,type_,description_,comment_ FROM	sys_user_cash_account_detail
+            <include refid="queryAccountDetailCondition"/>
+            UNION ALL
+            SELECT create_time_,amount_,balance_,status_,type_,description_,comment_ FROM sys_user_courses_account_detail
+            <include refid="queryAccountDetailCondition"/>
+        ) t ORDER BY t.create_time_
+        <include refid="global.limit"/>
+    </select>
+    <select id="countAccountDetails" resultType="int">
+        SELECT COUNT(t.id_) FROM (
+            SELECT id_,create_time_,amount_,balance_,status_,type_,description_,comment_ FROM	sys_user_cash_account_detail
+            <include refid="queryAccountDetailCondition"/>
+            UNION ALL
+            SELECT id_,create_time_,amount_,balance_,status_,type_,description_,comment_ FROM sys_user_courses_account_detail
+            <include refid="queryAccountDetailCondition"/>
+        ) t
+    </select>
 </mapper>

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

@@ -97,14 +97,25 @@
 	<delete id="delete" >
 		DELETE FROM sys_user_courses_account_detail WHERE id_ = #{id} 
 	</delete>
+
+	<sql id="queryPageCondition">
+		<where>
+			<if test="userId!=null">
+				user_id_=#{userId}
+			</if>
+		</where>
+	</sql>
 	
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="SysUserCoursesAccountDetail" parameterType="map">
-		SELECT * FROM sys_user_courses_account_detail ORDER BY id_ <include refid="global.limit"/>
+		SELECT * FROM sys_user_courses_account_detail
+		<include refid="queryPageCondition" />
+		ORDER BY id_ <include refid="global.limit"/>
 	</select>
 	
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM sys_user_courses_account_detail
+		<include refid="queryPageCondition" />
 	</select>
 </mapper>

+ 11 - 0
mec-web/src/main/java/com/ym/mec/web/controller/SysUserCashAccountDetailController.java

@@ -1,5 +1,6 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.auth.api.entity.SysUser;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
@@ -55,4 +56,14 @@ public class SysUserCashAccountDetailController extends BaseController {
         return succeed(sysUserCashAccountDetailPageInfo);
     }
 
+    @ApiOperation(value = "流水明细查询-包含账户余额与课程余额")
+    @GetMapping("/queryAccountDetail")
+    public Object queryAccountDetail(CashAccountDetail queryInfo) {
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if(user == null || user.getId() != null){
+            return failed("请重新登录");
+        }
+        return succeed(sysUserCashAccountDetailService.queryAccountDetail(queryInfo));
+    }
+
 }

+ 33 - 0
mec-web/src/main/java/com/ym/mec/web/controller/SysUserCoursesAccountDetailController.java

@@ -0,0 +1,33 @@
+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.CashAccountDetail;
+import com.ym.mec.biz.service.SysUserCoursesAccountDetailService;
+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.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RequestMapping("userCoursesAccount")
+@Api(tags = "用户课程余额服务")
+@RestController
+public class SysUserCoursesAccountDetailController extends BaseController {
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private SysUserCoursesAccountDetailService sysUserCoursesAccountDetailService;
+
+    @ApiOperation(value = "分页查询用户交易明细")
+    @GetMapping("userCashAccountDetail/queryPage")
+    public Object queryPage(CashAccountDetail queryInfo) {
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if(user == null || user.getId() != null){
+            return failed("请重新登录");
+        }
+        return succeed(sysUserCoursesAccountDetailService.queryPage(queryInfo));
+    }
+}