Browse Source

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

liujunchi 2 years ago
parent
commit
a886b6dfb7
23 changed files with 309 additions and 232 deletions
  1. 9 0
      cooleshow-auth/auth-api/src/main/java/com/yonge/cooleshow/auth/api/dto/RealnameAuthReq.java
  2. 9 3
      cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/web/controller/UserController.java
  3. 2 2
      cooleshow-auth/auth-server/src/main/resources/config/mybatis/SysUserMapper.xml
  4. 4 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/constant/CourseConstant.java
  5. 10 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/UserAccountDao.java
  6. 10 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/req/TotalReq.java
  7. 1 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/UserAccountRecord.java
  8. 1 10
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/CourseGroupService.java
  9. 17 61
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseGroupServiceImpl.java
  10. 5 30
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseScheduleServiceImpl.java
  11. 14 6
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TeacherAuthEntryRecordServiceImpl.java
  12. 38 16
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserAccountServiceImpl.java
  13. 33 3
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderServiceImpl.java
  14. 32 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/support/WrapperUtil.java
  15. 40 30
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/res/AccountTotal.java
  16. 0 59
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/res/TotalInfoData.java
  17. 1 1
      cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml
  18. 5 2
      cooleshow-user/user-biz/src/main/resources/config/mybatis/HomeMapper.xml
  19. 49 0
      cooleshow-user/user-biz/src/main/resources/config/mybatis/UserAccountMapper.xml
  20. 4 3
      cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/controller/UserOrderController.java
  21. 1 1
      cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/TeacherFreeTimeController.java
  22. 23 1
      cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/UserAccountController.java
  23. 1 2
      toolset/thirdparty-component/src/main/java/com/yonge/toolset/thirdparty/user/realname/provider/LinkfaceRealnameAuthenticationPlugin.java

+ 9 - 0
cooleshow-auth/auth-api/src/main/java/com/yonge/cooleshow/auth/api/dto/RealnameAuthReq.java

@@ -29,6 +29,7 @@ public class RealnameAuthReq implements Serializable {
     @ApiModelProperty(value = "是否修改用户信息", required = true)
     private Boolean isSave;
 
+    private Long userId;
     // 性别(1,男 0,女)
     private int gender;
     // 出生日期
@@ -36,6 +37,14 @@ public class RealnameAuthReq implements Serializable {
     // 头像
     private String avatar;
 
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
     public String getRealName() {
         return realName;
     }

+ 9 - 3
cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/web/controller/UserController.java

@@ -56,7 +56,6 @@ import com.yonge.toolset.utils.string.StringUtil;
 @RequestMapping("user")
 @Api(tags = "会员服务")
 public class UserController extends BaseController {
-
     @Autowired
     private SysUserService sysUserService;
     @Autowired
@@ -480,16 +479,23 @@ public class UserController extends BaseController {
         //通过身份证号获取身份信息
         IdcardInfoExtractor idcardInfoExtractor = new IdcardInfoExtractor(realNameAuthDto.getIdCardNo(), validatedAllIdcard);
         //todo 通过环境,不做实名判断
-        boolean verify = realnameAuthenticationPlugin.verify(realNameAuthDto.getRealName(), realNameAuthDto.getIdCardNo());
-        if (!verify) {
+        try {
+            boolean verify = realnameAuthenticationPlugin.verify(realNameAuthDto.getRealName(), realNameAuthDto.getIdCardNo());
+            if (!verify) {
+                return failed("未通过实名认证");
+            }
+        }catch (Exception e){
+            e.printStackTrace();
             return failed("未通过实名认证");
         }
+
         if (realNameAuthDto.getSave()) {
             String defaultHeard = sysConfigService.findConfigValue(SysConfigConstant.DEFAULT_HEARD);
             if (StringUtil.isEmpty(user.getAvatar()) || user.getAvatar().equals(defaultHeard)) {
                 user.setAvatar(
                         0 == idcardInfoExtractor.getGender() ? sysConfigService.findConfigValue(SysConfigConstant.DEFAULT_HEARD_GIRL) : sysConfigService.findConfigValue(SysConfigConstant.DEFAULT_HEARD_BOY));
             }
+            realNameAuthDto.setUserId(user.getId());
             realNameAuthDto.setGender(idcardInfoExtractor.getGender());
             realNameAuthDto.setBirthday(idcardInfoExtractor.getBirthday());
             realNameAuthDto.setAvatar(user.getAvatar());

+ 2 - 2
cooleshow-auth/auth-server/src/main/resources/config/mybatis/SysUserMapper.xml

@@ -217,8 +217,8 @@
             <if test="param.gender != null">
                 gender_ = #{param.gender},
             </if>
-            <if test="param.birthdate != null and param.birthdate != ''">
-                birthdate_ = #{param.birthdate},
+            <if test="param.birthday != null">
+                birthdate_ = #{param.birthday},
             </if>
             <if test="param.avatar != null and param.avatar != ''">
                 avatar_ = #{param.avatar},

+ 4 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/constant/CourseConstant.java

@@ -1,10 +1,13 @@
 package com.yonge.cooleshow.biz.dal.constant;
 
 public interface CourseConstant {
+
+    String TEACHER_ID = "${teacherId}";
+
     /**
      * 未正式写入数据库的排课时间临时数据
      * <p>用途将未写入数据库的排课数据写入缓存,然后生成日历及陪练课买课时校验课时将缓存时间拿出来比对
      * <p>返回结果 List<CourseTimeEntity>
      */
-    String LOCK_COURSE_TIME_INFO = "LOCK_COURSE_TIME_INFO";
+    String LOCK_COURSE_TIME_INFO = String.join(":", LiveRoomConstant.COOLESHOW, CourseConstant.LOCK_COURSE_TIME_INFO, TEACHER_ID);
 }

+ 10 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/UserAccountDao.java

@@ -5,7 +5,9 @@ import java.util.List;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.yonge.cooleshow.biz.dal.dto.req.TotalReq;
 import com.yonge.cooleshow.biz.dal.enums.InOrOutEnum;
+import com.yonge.cooleshow.biz.dal.vo.res.AccountTotal;
 import org.apache.ibatis.annotations.Param;
 import com.yonge.cooleshow.biz.dal.entity.UserAccount;
 import com.yonge.cooleshow.biz.dal.vo.UserAccountVo;
@@ -55,4 +57,12 @@ public interface UserAccountDao extends BaseMapper<UserAccount>{
 	 * @return: java.lang.Integer
 	 */
 	Integer changeAccount(@Param("userId") Long userId, @Param("transAmount") BigDecimal transAmount,@Param("inOrOut") String inOrOut);
+	/***
+	 * 收入统计
+	 * @author liweifan
+	 * @param: totalReq
+	 * @updateTime 2022/4/24 13:53
+	 * @return: java.util.List<com.yonge.cooleshow.biz.dal.vo.res.AccountTotal>
+	 */
+    List<AccountTotal> accountTotal(@Param("param")TotalReq totalReq);
 }

+ 10 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/req/TotalReq.java

@@ -16,6 +16,8 @@ import java.util.Date;
  */
 @ApiModel(value = "TotalReq对象", description = "统计查询对象")
 public class TotalReq {
+    @ApiModelProperty("用户id ")
+    private Long userId;
     @NotNull(message = "时间类型不能为空")
     @ApiModelProperty("时间类型 MONTH、月度  YEAR、年度")
     private TimeTypeEnum timeType;
@@ -32,6 +34,14 @@ public class TotalReq {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date endTime;
 
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
     public TimeTypeEnum getTimeType() {
         return timeType;
     }

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/UserAccountRecord.java

@@ -37,7 +37,7 @@ public class UserAccountRecord implements Serializable {
     @ApiModelProperty("收支类型:IN、收入 OUT、支出 ")
     @TableField(value = "in_or_out_")
     private InOrOutEnum inOrOut;
-    @ApiModelProperty("业务类型:PRACTICE、陪练课 LIVE、直播课  MUSIC、乐谱 WITHDRAWAL、提现 ")
+    @ApiModelProperty("业务类型:PRACTICE、陪练课 LIVE、直播课  MUSIC、乐谱  WITHDRAWAL、提现 ")
     @TableField(value = "biz_type_")
     private AccountBizTypeEnum bizType;
     @ApiModelProperty("业务id ")

+ 1 - 10
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/CourseGroupService.java

@@ -18,6 +18,7 @@ import com.yonge.cooleshow.common.page.PageInfo;
 import org.redisson.api.RMap;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 
@@ -122,16 +123,6 @@ public interface CourseGroupService extends IService<CourseGroup> {
     HttpResponseResult<OrderCreateRes> buyLiveCourse(OrderReq.OrderReqInfo orderReqInfo);
 
     /**
-     * 待订单创建完毕后继续后续操作
-     *
-     * @param afterParam 传入参数
-     *                   <p> - courseList    课程列表
-     *                   <p> - studentId    学员id
-     *                   <p> - courseGroup   直播课程组信息
-     */
-    void buyLiveCourseAfter(UserOrderDetailVo afterParam);
-
-    /**
      * 学生购买直播课程-成功-回调
      */
     void buyLiveCourseSuccess(UserOrderDetailVo orderParam);

+ 17 - 61
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseGroupServiceImpl.java

@@ -454,7 +454,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
      * @return 缓存 key teacherId value List<CourseTimeEntity>
      */
     public RMap<Long, List<CourseTimeEntity>> getLiveLockTimeCache(Long teacherId) {
-        String key = String.join(":", LiveRoomConstant.COOLESHOW, CourseConstant.LOCK_COURSE_TIME_INFO, teacherId.toString());
+        String key = CourseConstant.LOCK_COURSE_TIME_INFO.replace(CourseConstant.TEACHER_ID, teacherId.toString());
         return redissonClient.getMap(key);
     }
 
@@ -525,7 +525,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
     @Transactional(rollbackFor = Exception.class)
     @Override
     public HttpResponseResult<OrderCreateRes> buyLiveCourse(OrderReq.OrderReqInfo orderReqInfo) {
-        log.info("学生购买直播课程组,请求参数:{}", JSON.toJSONString(orderReqInfo));
+        log.info("buyLiveCourse  param:{}", JSON.toJSONString(orderReqInfo));
         Map<String, Object> param = WrapperUtil.toMap(orderReqInfo.getBizContent());
         Long groupId = WrapperUtil.toLong(param, "groupId", "课程组id不能为空!");
         Long studentId = orderReqInfo.getUserId();
@@ -547,46 +547,36 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
         }
         //校验购买的课程组每节课时间是否和自己的课时冲突
         batchCheckStudentCourseTime(studentId, courseList, CourseSchedule::getStartTime, CourseSchedule::getEndTime);
-        //返回的数据 有用后面aftet的方法使用
-        Map<String, Object> bizContent = new HashMap<>();
-        bizContent.put("courseGroup", courseGroup);
-        bizContent.put("courseList", courseList);
-        bizContent.put("studentId", studentId);
+        //写入学生购买课程记录
+        buyLiveCourseAfter(orderReqInfo.getOrderNo(), studentId, courseList, courseGroup);
+
         OrderCreateRes orderCreateRes = new OrderCreateRes();
         orderCreateRes.setRes(true);
         orderCreateRes.setMerchId(courseGroup.getTeacherId());
         orderCreateRes.setBizId(courseGroup.getId());
         orderCreateRes.setOriginalPrice(courseGroup.getCoursePrice());
         orderCreateRes.setExpectPrice(courseGroup.getCoursePrice());
-        orderCreateRes.setBizParam(bizContent);
         orderCreateRes.setGoodNum(courseGroup.getCourseNum());
         orderCreateRes.setGoodType(GoodTypeEnum.LIVE);
 
         HttpResponseResult<OrderCreateRes> httpResponseResult = new HttpResponseResult<>();
         httpResponseResult.setData(orderCreateRes);
+        log.info("buyLiveCourse  return {}", httpResponseResult);
         return httpResponseResult;
     }
 
     /**
      * 待订单创建完毕后继续后续操作
      *
-     * @param afterParam 传入参数
-     *                   <p> - courseList    课程列表
-     *                   <p> - studentId    学员id
-     *                   <p> - courseGroup   直播课程组信息
+     * @param orderNo     订单号
+     * @param courseList  课程列表
+     * @param studentId   学员id
+     * @param courseGroup 直播课程组信息
      */
-    @Transactional(rollbackFor = Exception.class)
-    @Override
-    public void buyLiveCourseAfter(UserOrderDetailVo afterParam) {
-        log.info("学生购买直播课程组 after ,请求参数:{}", JSON.toJSONString(afterParam));
-        Map<String, Object> param = WrapperUtil.toMap(afterParam.getBizParam());
-        String orderNo = afterParam.getOrderNo();
-        Long studentId = (Long) param.get("studentId");
-        List<CourseSchedule> courseList = JSONArray.parseArray(JSON.toJSONString(param.get("courseList")), CourseSchedule.class);
-        CourseGroup courseGroup = (CourseGroup) param.get("courseGroup");
-
+    private void buyLiveCourseAfter(String orderNo, Long studentId, List<CourseSchedule> courseList, CourseGroup courseGroup) {
+        log.info("buyLiveCourse buyLiveCourseAfter -> order {} studentId {} courseList {} courseGroup {}", orderNo, studentId, JSON.toJSONString(courseList), JSON.toJSONString(courseGroup));
         //获取每节课购买的价格
-        Map<Integer, BigDecimal> courseAveragePrice = getCourseAveragePrice(courseGroup.getCourseNum(), courseGroup.getCoursePrice());
+        Map<Integer, BigDecimal> courseAveragePrice = WrapperUtil.getAveragePrice(courseGroup.getCourseNum(), courseGroup.getCoursePrice());
         //写course_schedule_student_payment表 作为记录锁定时间用,防止重复购买,如果支付失败则删除该数据
         List<CourseScheduleStudentPayment> studentPaymentList = new ArrayList<>();
         Date now = new Date();
@@ -615,7 +605,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
     @Transactional(rollbackFor = Exception.class)
     @Override
     public void buyLiveCourseSuccess(UserOrderDetailVo orderParam) {
-        log.info("学生购买直播课程-成功-回调,请求参数:{}", JSON.toJSONString(orderParam));
+        log.info("buyLiveCourseSuccess param :{}", JSON.toJSONString(orderParam));
         String orderNo = orderParam.getOrderNo();
         //更新课程组的购买人数+1
         CourseScheduleStudentPayment studentPayment = courseScheduleStudentPaymentService.getOne(Wrappers.<CourseScheduleStudentPayment>lambdaQuery()
@@ -640,7 +630,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
         //总课酬  1 - (1 * 手续费率)
         BigDecimal totalRatePrice = expectPrice.subtract(expectPrice.multiply(liveServiceRate)).setScale(2, RoundingMode.HALF_UP);
         //获取每节课的课酬 key 课堂数  value 课酬
-        Map<Integer, BigDecimal> singerCourseSalary = getCourseAveragePrice(courseGroup.getCourseNum(), totalRatePrice);
+        Map<Integer, BigDecimal> singerCourseSalary = WrapperUtil.getAveragePrice(courseGroup.getCourseNum(), totalRatePrice);
         //写入课酬表计算-根据课程组总金额计算分配到每节课的金额
         Date now = new Date();
         List<CourseScheduleTeacherSalary> teacherSalaryList = new ArrayList<>();
@@ -659,41 +649,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
             teacherSalaryList.add(teacherSalary);
         });
         courseScheduleTeacherSalaryService.getDao().insertBatch(teacherSalaryList);
-    }
-
-    /**
-     * 计算课堂每节课价格
-     *
-     * @param totalCourseNum 总课程数
-     * @param totalRatePrice 总金额
-     * @return key 课堂数 value 课酬
-     */
-    private Map<Integer, BigDecimal> getCourseAveragePrice(Integer totalCourseNum, BigDecimal totalRatePrice) {
-        //每节课的单价 四舍五入
-        BigDecimal singerSalary = totalRatePrice.divide(BigDecimal.valueOf(totalCourseNum), 2, RoundingMode.HALF_UP);
-        //单价累计总额
-        BigDecimal cumulativeAmount = BigDecimal.ZERO;
-        Map<Integer, BigDecimal> map = new HashMap<>();
-        for (int i = 1; i <= totalCourseNum; i++) {
-            //最后一节课,直接用总课酬减去累计总额
-            if (i == totalCourseNum) {
-                singerSalary = totalRatePrice.subtract(cumulativeAmount);
-            }
-            cumulativeAmount = cumulativeAmount.add(singerSalary);
-            map.put(i, singerSalary);
-        }
-        return map;
-    }
-
-    /**
-     * 学生购买直播课-失败-回调
-     */
-    @Transactional(rollbackFor = Exception.class)
-    public void buyLiveCourseFailed(String orderNo) {
-        //删除 course_schedule_student_payment表 数据
-
-
-        //修改订单为失败
+        log.info("buyLiveCourseSuccess ok");
     }
 
     private SysUser getSysUser(Long userId) {
@@ -723,7 +679,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
         courseGroupList.forEach(courseGroup -> {
             courseGroup.setStatus(CourseGroupEnum.APPLY.getCode());
             this.updateById(courseGroup);
-        })  ;
+        });
     }
 
 }

+ 5 - 30
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseScheduleServiceImpl.java

@@ -9,9 +9,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
+import com.yonge.cooleshow.biz.dal.dao.CourseScheduleDao;
 import com.yonge.cooleshow.biz.dal.dao.CourseScheduleRepliedDao;
 import com.yonge.cooleshow.biz.dal.dao.CourseScheduleStudentPaymentDao;
-import com.yonge.cooleshow.biz.dal.dao.CourseScheduleDao;
 import com.yonge.cooleshow.biz.dal.dto.PracticeScheduleDto;
 import com.yonge.cooleshow.biz.dal.dto.req.OrderReq;
 import com.yonge.cooleshow.biz.dal.dto.search.HomeworkSearch;
@@ -42,7 +42,6 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
-import java.math.RoundingMode;
 import java.time.LocalDate;
 import java.time.temporal.TemporalAdjusters;
 import java.util.*;
@@ -805,30 +804,6 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
     }
 
     /**
-     * 计算课堂每节课价格
-     *
-     * @param totalCourseNum 总课程数
-     * @param totalRatePrice 总金额
-     * @return key 课堂数 value 课酬
-     */
-    private Map<Integer, BigDecimal> getCourseAveragePrice(Integer totalCourseNum, BigDecimal totalRatePrice) {
-        //每节课的单价 四舍五入
-        BigDecimal singerSalary = totalRatePrice.divide(BigDecimal.valueOf(totalCourseNum), 2, RoundingMode.HALF_UP);
-        //单价累计总额
-        BigDecimal cumulativeAmount = BigDecimal.ZERO;
-        Map<Integer, BigDecimal> map = new HashMap<>();
-        for (int i = 1; i <= totalCourseNum; i++) {
-            //最后一节课,直接用总课酬减去累计总额
-            if (i == totalCourseNum) {
-                singerSalary = totalRatePrice.subtract(cumulativeAmount);
-            }
-            cumulativeAmount = cumulativeAmount.add(singerSalary);
-            map.put(i, singerSalary);
-        }
-        return map;
-    }
-
-    /**
      * @Description: 学生购买陪练课
      * @Author: cy
      * @Date: 2022/4/21
@@ -855,7 +830,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         Long groupId = scheduleDto.getGroupId();
 
         //获取每节课购买的价格
-        Map<Integer, BigDecimal> courseAveragePrice = getCourseAveragePrice(scheduleDto.getCourseNum(), scheduleDto.getCoursePrice());
+        Map<Integer, BigDecimal> courseAveragePrice = WrapperUtil.getAveragePrice(scheduleDto.getCourseNum(), scheduleDto.getCoursePrice());
 
         List<CourseScheduleDate> classTime = scheduleDto.getClassTime();
         for (int i = 0; i < classTime.size(); i++) {
@@ -881,9 +856,9 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
             payment.setCourseGroupId(groupId);
             payment.setCourseType(CourseScheduleEnum.PRACTICE.getCode());
             payment.setOrderNo(orderNo);
-            payment.setOriginalPrice(courseAveragePrice.get(i+1));
-            payment.setExpectPrice(courseAveragePrice.get(i+1));
-            payment.setActualPrice(courseAveragePrice.get(i+1));
+            payment.setOriginalPrice(courseAveragePrice.get(i + 1));
+            payment.setExpectPrice(courseAveragePrice.get(i + 1));
+            payment.setActualPrice(courseAveragePrice.get(i + 1));
             //写入course_schedule_student_payment
             courseScheduleStudentPaymentService.save(payment);
         }

+ 14 - 6
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TeacherAuthEntryRecordServiceImpl.java

@@ -13,6 +13,7 @@ import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
 import com.yonge.cooleshow.biz.dal.enums.YesOrNoEnum;
 import com.yonge.cooleshow.biz.dal.vo.TeacherAuthEntryRecordVo;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import com.yonge.toolset.utils.string.StringUtil;
 import org.apache.commons.beanutils.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -21,10 +22,8 @@ import com.yonge.cooleshow.biz.dal.dao.TeacherAuthEntryRecordDao;
 import com.yonge.cooleshow.biz.dal.service.TeacherAuthEntryRecordService;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.lang.reflect.InvocationTargetException;
 import java.util.Date;
 
-
 @Service
 public class TeacherAuthEntryRecordServiceImpl extends ServiceImpl<TeacherAuthEntryRecordDao, TeacherAuthEntryRecord> implements TeacherAuthEntryRecordService {
 
@@ -50,12 +49,21 @@ public class TeacherAuthEntryRecordServiceImpl extends ServiceImpl<TeacherAuthEn
         build.setVerifyUserId(sysUser.getId());
 
         //修改teacher表
-        Teacher teacher = new Teacher();
-        BeanUtils.copyProperties(teacher,build);
-
+        Teacher teacher = teacherDao.selectById(build.getUserId());
+        if (null == teacher) {
+            return HttpResponseResult.failed("未找到用户信息");
+        }
+        if (AuthStatusEnum.PASS.equals(authOperaReq.getPass())) {
+            teacher.setSubjectId(StringUtil.isEmpty(teacher.getSubjectId()) ? build.getSubjectId() : teacher.getSubjectId());
+            teacher.setIntroduction(StringUtil.isEmpty(teacher.getIntroduction()) ? build.getIntroduction() : teacher.getIntroduction());
+            teacher.setGraduateSchool(StringUtil.isEmpty(teacher.getGraduateSchool()) ? build.getGraduateSchool() : teacher.getGraduateSchool());
+            teacher.setSubject(StringUtil.isEmpty(teacher.getSubject()) ? build.getSubject() : teacher.getSubject());
+            teacher.setGradCertificate(StringUtil.isEmpty(teacher.getGradCertificate()) ? build.getGradCertificate() : teacher.getGradCertificate());
+            teacher.setDegreeCertificate(StringUtil.isEmpty(teacher.getDegreeCertificate()) ? build.getDegreeCertificate() : teacher.getDegreeCertificate());
+            teacher.setTeacherCertificate(StringUtil.isEmpty(teacher.getTeacherCertificate())? build.getTeacherCertificate():teacher.getTeacherCertificate());
+        }
         teacher.setEntryFlag(authOperaReq.getPass() ? YesOrNoEnum.YES : YesOrNoEnum.NO);
         teacher.setEntryAuthDate(new Date());
-
         teacherDao.updateById(teacher);
         return HttpResponseResult.succeed(baseMapper.updateById(build) > 0);
     }

+ 38 - 16
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserAccountServiceImpl.java

@@ -11,6 +11,7 @@ import com.yonge.cooleshow.biz.dal.enums.TimeTypeEnum;
 import com.yonge.cooleshow.biz.dal.service.UserAccountRecordService;
 import com.yonge.cooleshow.biz.dal.support.DistributedLock;
 import com.yonge.cooleshow.biz.dal.vo.res.AccountTotal;
+import com.yonge.cooleshow.biz.dal.vo.res.HomeTotalTeacher;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.common.exception.BizException;
 import com.yonge.toolset.utils.date.DateUtil;
@@ -23,7 +24,10 @@ import com.yonge.cooleshow.biz.dal.dto.search.UserAccountSearch;
 import com.yonge.cooleshow.biz.dal.dao.UserAccountDao;
 import com.yonge.cooleshow.biz.dal.service.UserAccountService;
 
+import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.Calendar;
+import java.util.List;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 
@@ -59,6 +63,7 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
         Future<HttpResponseResult<UserAccountRecord>> httpResponseResultFuture = DistributedLock.of(redissonClient)
                 .callIfLockCanGet(CacheNameEnum.LOCK_CHANGE_ACCOUNT.getRedisKey(accountRecordDto.getUserId())
                         , () -> doAccountChange(accountRecordDto), 60L, TimeUnit.SECONDS);
+
         try {
             return httpResponseResultFuture.get();
         } catch (Exception e) {
@@ -69,24 +74,41 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
 
     @Override
     public HttpResponseResult<AccountTotal> accountTotal(TotalReq totalReq) {
-        //参数处理
-        Calendar calendar = Calendar.getInstance();
-        if (TimeTypeEnum.MONTH.equals(totalReq.getTimeType())) {
-            String[] classDateSp = totalReq.getDateTime().split("-");
-            calendar.set(Integer.parseInt(classDateSp[0]), Integer.parseInt(classDateSp[1]), 1, 0, 0, 0);
-            totalReq.setStartTime(calendar.getTime());
-            totalReq.setEndTime(DateUtil.dayEnd(DateUtil.getLastDayOfMonth(calendar.getTime())));
-        } else if (TimeTypeEnum.YEAR.equals(totalReq.getTimeType())) {
-            calendar.set(Integer.parseInt(totalReq.getDateTime()), 1, 1, 0, 0, 0);
-            totalReq.setStartTime(calendar.getTime());
-
-            calendar.set(Integer.parseInt(totalReq.getDateTime()), 12, 1, 0, 0, 0);
-            totalReq.setEndTime(DateUtil.dayEnd(DateUtil.getLastDayOfMonth(calendar.getTime())));
-        } else {
-            return HttpResponseResult.failed("参数异常");
+        List<AccountTotal> infoList= baseMapper.accountTotal(totalReq);
+
+        BigDecimal practiceAmount = BigDecimal.ZERO;
+        BigDecimal liveAmount = BigDecimal.ZERO;
+        BigDecimal musicAmount = BigDecimal.ZERO;
+        for (AccountTotal info : infoList) {
+            info.setPracticeAmount(null == info.getPracticeAmount() ? BigDecimal.ZERO : info.getPracticeAmount());
+            info.setLiveAmount(null == info.getLiveAmount() ? BigDecimal.ZERO  : info.getLiveAmount());
+            info.setMusicAmount(null == info.getMusicAmount() ? BigDecimal.ZERO  : info.getMusicAmount());
+
+            practiceAmount = practiceAmount.add(info.getPracticeAmount());
+            liveAmount = liveAmount.add(info.getLiveAmount());
+            musicAmount = musicAmount.add(info.getMusicAmount());
         }
+        AccountTotal total = new AccountTotal();
+
+        total.setTotalInAmount(practiceAmount.add(liveAmount).add(musicAmount));
+        total.setPracticeAmount(practiceAmount);
+        BigDecimal practiceRate = total.getPracticeAmount()
+                .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
+        total.setPracticeRate(practiceRate);
+
+        total.setLiveAmount(liveAmount);
+        BigDecimal liveRate = total.getLiveAmount()
+                .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
+        total.setLiveRate(liveRate);
+
+        total.setMusicAmount(musicAmount);
+        BigDecimal musicRate = total.getMusicAmount()
+                .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
+        total.setMusicRate(musicRate);
+
+        total.setInfoList(infoList);
 
-        return null;
+        return HttpResponseResult.succeed(total);
     }
 
     private HttpResponseResult<UserAccountRecord> doAccountChange(UserAccountRecordDto accountRecordDto) {

+ 33 - 3
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderServiceImpl.java

@@ -57,6 +57,8 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
     private CourseGroupService courseGroupService;
     @Autowired
     private CourseScheduleService scheduleService;
+    @Autowired
+    private VideoLessonPurchaseRecordService recordService;
 
     //验证订单是否可以下单
     private static final Map<GoodTypeEnum, Function<OrderReq.OrderReqInfo, HttpResponseResult<OrderCreateRes>>> orderCreate = new HashMap<>();
@@ -77,10 +79,10 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
         orderCreate.put(GoodTypeEnum.LIVE, courseGroupService::buyLiveCourse);
         //陪练课购买
         orderCreate.put(GoodTypeEnum.PRACTICE, scheduleService::buyPracticeCourse);
+        //视频课购买
+        orderCreate.put(GoodTypeEnum.VIDEO, recordService::buyVideoCourse);
 
         /**********订单生成后******************/
-        //直播课程购买after
-        orderAfter.put(GoodTypeEnum.LIVE, courseGroupService::buyLiveCourseAfter);
 
         /**********订单完成后******************/
         //vip开通缴费
@@ -89,9 +91,14 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
         orderSuccess.put(GoodTypeEnum.LIVE, courseGroupService::buyLiveCourseSuccess);
         //陪练课购买
         orderSuccess.put(GoodTypeEnum.PRACTICE, scheduleService::buyPracticeCourseSuccess);
+        //视频课购买
+        orderSuccess.put(GoodTypeEnum.VIDEO, recordService::buyVideoCourseSuccess);
 
         /**********订单取消后******************/
+        //陪练课购买
         orderCancel.put(GoodTypeEnum.PRACTICE, scheduleService::buyPracticeCourseFailed);
+        //视频课购买
+        orderCancel.put(GoodTypeEnum.VIDEO, recordService::buyVideoCourseFailed);
     }
 
     @Override
@@ -334,7 +341,7 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
         } else {
             //入订单付款表,同时修改订单状态
             orderCancel(detail);
-            insertOrderPayment(responseResult, payReq);
+            errOrderPayment(responseResult, payReq);
             baseMapper.updateStatusByOrderNo(payReq.getOrderNo(), OrderStatusEnum.FAIL.getCode());
             return HttpResponseResult.failed(responseResult.getMsg());
         }
@@ -371,6 +378,29 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
     }
 
     /***
+     * 处理付款请求失败
+     * @author liweifan
+     * @param: res
+     * @param: payReq
+     * @updateTime 2022/4/13 17:56
+     * @return: com.yonge.cooleshow.biz.dal.entity.UserOrderPayment
+     */
+    private UserOrderPayment errOrderPayment(HttpResponseResult<Map<String, Object>> responseResult, OrderPayReq payReq) {
+        //查询
+        UserOrderPayment orderPayment = orderPaymentService.detailByOrderNo(payReq.getOrderNo());
+        if(null == orderPayment){
+            orderPayment = new UserOrderPayment();
+            orderPayment.setOrderNo(payReq.getOrderNo());
+            orderPayment.setPayChannel(payReq.getPayChannel());
+        }
+        orderPayment.setPayFailMsg(responseResult.getMsg());
+        orderPayment.setStatus(PayStatusEnum.failed);
+
+        orderPaymentService.saveOrUpdate(orderPayment);
+        return orderPayment;
+    }
+
+    /***
      * 处理待支付中订单
      * @author liweifan
      * @param: payReq

+ 32 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/support/WrapperUtil.java

@@ -6,6 +6,7 @@ import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.*;
 import java.util.function.Function;
 import java.util.function.Predicate;
@@ -236,4 +237,35 @@ public class WrapperUtil {
         }
     }
 
+    /**
+     * 计算平均价格,保留2位
+     * <p> 例如:总数3  总金额10
+     * <p> 返回:
+     * <p> key   value
+     * <p> 1 :3.33
+     * <p> 2 :3.33
+     * <p> 3 :3.34
+     * <p> 最后1 ,2,3的的金额总数还是为10
+     *
+     * @param totalNum   总数
+     * @param totalPrice 总金额
+     * @return key 数 value 平均金额
+     */
+    public static Map<Integer, BigDecimal> getAveragePrice(Integer totalNum, BigDecimal totalPrice) {
+        //单价 四舍五入
+        BigDecimal unitPrice = totalPrice.divide(BigDecimal.valueOf(totalNum), 2, RoundingMode.HALF_UP);
+        //累计总额
+        BigDecimal cumulativeAmount = BigDecimal.ZERO;
+        Map<Integer, BigDecimal> map = new HashMap<>();
+        for (int i = 1; i <= totalNum; i++) {
+            //最后一个数,直接用总金额减去累计总额
+            if (i == totalNum) {
+                unitPrice = totalPrice.subtract(cumulativeAmount).setScale(2, RoundingMode.HALF_UP);
+            }
+            cumulativeAmount = cumulativeAmount.add(unitPrice);
+            map.put(i, unitPrice);
+        }
+        return map;
+    }
+
 }

+ 40 - 30
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/res/AccountTotal.java

@@ -12,38 +12,40 @@ import java.util.List;
  */
 @ApiModel(value = "AccountTotal", description = "用户账户统计对象")
 public class AccountTotal {
-    @ApiModelProperty("总收入 ")
-    private BigDecimal amountTotalIn;
-    @ApiModelProperty("陪练课 ")
-    private BigDecimal practiceTotal;
-    @ApiModelProperty("陪练课-百分比 ")
+    @ApiModelProperty("总收入")
+    private BigDecimal totalInAmount;
+    @ApiModelProperty("陪练课")
+    private BigDecimal practiceAmount;
+    @ApiModelProperty("陪练课-百分比")
     private BigDecimal practiceRate;
-    @ApiModelProperty("直播课 ")
-    private BigDecimal liveTotal;
+    @ApiModelProperty("直播课")
+    private BigDecimal liveAmount;
     @ApiModelProperty("直播课-百分比")
     private BigDecimal liveRate;
-    @ApiModelProperty("乐谱 ")
-    private BigDecimal musicTotal;
-    @ApiModelProperty("乐谱-百分比 ")
+    @ApiModelProperty("乐谱")
+    private BigDecimal musicAmount;
+    @ApiModelProperty("乐谱-百分比")
     private BigDecimal musicRate;
 
-    @ApiModelProperty("详情数据 ")
-    private List<TotalInfoData> infoList;
+    @ApiModelProperty("时间(详情数据中使用)")
+    private String timeStr;
+    @ApiModelProperty("详情数据")
+    private List<AccountTotal> infoList;
 
-    public BigDecimal getAmountTotalIn() {
-        return amountTotalIn;
+    public BigDecimal getTotalInAmount() {
+        return totalInAmount;
     }
 
-    public void setAmountTotalIn(BigDecimal amountTotalIn) {
-        this.amountTotalIn = amountTotalIn;
+    public void setTotalInAmount(BigDecimal totalInAmount) {
+        this.totalInAmount = totalInAmount;
     }
 
-    public BigDecimal getPracticeTotal() {
-        return practiceTotal;
+    public BigDecimal getPracticeAmount() {
+        return practiceAmount;
     }
 
-    public void setPracticeTotal(BigDecimal practiceTotal) {
-        this.practiceTotal = practiceTotal;
+    public void setPracticeAmount(BigDecimal practiceAmount) {
+        this.practiceAmount = practiceAmount;
     }
 
     public BigDecimal getPracticeRate() {
@@ -54,12 +56,12 @@ public class AccountTotal {
         this.practiceRate = practiceRate;
     }
 
-    public BigDecimal getLiveTotal() {
-        return liveTotal;
+    public BigDecimal getLiveAmount() {
+        return liveAmount;
     }
 
-    public void setLiveTotal(BigDecimal liveTotal) {
-        this.liveTotal = liveTotal;
+    public void setLiveAmount(BigDecimal liveAmount) {
+        this.liveAmount = liveAmount;
     }
 
     public BigDecimal getLiveRate() {
@@ -70,12 +72,12 @@ public class AccountTotal {
         this.liveRate = liveRate;
     }
 
-    public BigDecimal getMusicTotal() {
-        return musicTotal;
+    public BigDecimal getMusicAmount() {
+        return musicAmount;
     }
 
-    public void setMusicTotal(BigDecimal musicTotal) {
-        this.musicTotal = musicTotal;
+    public void setMusicAmount(BigDecimal musicAmount) {
+        this.musicAmount = musicAmount;
     }
 
     public BigDecimal getMusicRate() {
@@ -86,11 +88,19 @@ public class AccountTotal {
         this.musicRate = musicRate;
     }
 
-    public List<TotalInfoData> getInfoList() {
+    public String getTimeStr() {
+        return timeStr;
+    }
+
+    public void setTimeStr(String timeStr) {
+        this.timeStr = timeStr;
+    }
+
+    public List<AccountTotal> getInfoList() {
         return infoList;
     }
 
-    public void setInfoList(List<TotalInfoData> infoList) {
+    public void setInfoList(List<AccountTotal> infoList) {
         this.infoList = infoList;
     }
 }

+ 0 - 59
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/res/TotalInfoData.java

@@ -1,59 +0,0 @@
-package com.yonge.cooleshow.biz.dal.vo.res;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.math.BigDecimal;
-import java.util.Date;
-
-/**
- * @Author: liweifan
- * @Data: 2022/4/24 10:41
- */
-@ApiModel(value = "TotalInfoData", description = "统计数据详情对象")
-public class TotalInfoData {
-    @ApiModelProperty(value = "统计时间")
-    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    private Date totalTime;
-    @ApiModelProperty(value = "统计时间(yyyy-MM)")
-    private String totalMonth;
-    @ApiModelProperty(value = "统计时间(yyyy-MM-dd)")
-    private String totalDay;
-    @ApiModelProperty("数值 ")
-    private BigDecimal value;
-
-    public Date getTotalTime() {
-        return totalTime;
-    }
-
-    public void setTotalTime(Date totalTime) {
-        this.totalTime = totalTime;
-    }
-
-    public String getTotalMonth() {
-        return totalMonth;
-    }
-
-    public void setTotalMonth(String totalMonth) {
-        this.totalMonth = totalMonth;
-    }
-
-    public String getTotalDay() {
-        return totalDay;
-    }
-
-    public void setTotalDay(String totalDay) {
-        this.totalDay = totalDay;
-    }
-
-    public BigDecimal getValue() {
-        return value;
-    }
-
-    public void setValue(BigDecimal value) {
-        this.value = value;
-    }
-}

+ 1 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml

@@ -45,7 +45,7 @@
     </select>
 
     <select id="queryStudentInfoByGroupId" resultType="com.yonge.cooleshow.biz.dal.vo.LiveCourseInfoVo$CourseBuyStudentVo">
-        select a.user_id_      as studentId,
+        select distinct a.user_id_      as studentId,
                b.real_name_    as studentName,
                b.avatar_ as avatar,
                a.created_time_ as createTime

+ 5 - 2
cooleshow-user/user-biz/src/main/resources/config/mybatis/HomeMapper.xml

@@ -4,11 +4,12 @@
 <mapper namespace="com.yonge.cooleshow.biz.dal.dao.HomeDao">
 	<select id="getUserToDoNum" resultType="com.yonge.cooleshow.biz.dal.vo.res.HomeUserToDoNum">
 		select
-			(select count(1) from teacher_auth_entry_record where teacher_auth_status_ = 1) as entryNum,
-			(select count(1) from teacher_auth_musician_record where teacher_auth_status_ = 1) as musicianNum,
+			(select count(1) from teacher_auth_entry_record where teacher_auth_status_ = 'DOING') as entryNum,
+			(select count(1) from teacher_auth_musician_record where teacher_auth_status_ = 'DOING') as musicianNum,
         	(select count(1) from music_sheet where del_flag_ = 0 and audit_status_ = 'DOING') as musicNum
         from dual
 	</select>
+
     <select id="totalTeacher" resultType="com.yonge.cooleshow.biz.dal.vo.res.HomeTotalTeacher">
 		select
 			<if test="timeType != null and timeType == 'MONTH'">
@@ -90,6 +91,7 @@
 				<![CDATA[AND t.sys_day_ <= #{param.endTime} ]]>
 			</if>
 		</where>
+		order by t.sys_day_ desc
 		<if test="timeType != null and timeType == 'MONTH'">
 			group by t.sys_day_ymd_
 		</if>
@@ -175,6 +177,7 @@
 				<![CDATA[AND t.sys_day_ <= #{param.endTime} ]]>
 			</if>
 		</where>
+		order by t.sys_day_ desc
 		<if test="timeType != null and timeType == 'MONTH'">
 			group by t.sys_day_ymd_
 		</if>

+ 49 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/UserAccountMapper.xml

@@ -71,4 +71,53 @@
         <include refid="baseColumns"/>
         FROM user_cash_account t
     </select>
+
+    <select id="accountTotal" resultType="com.yonge.cooleshow.biz.dal.vo.res.AccountTotal">
+        select
+            <if test="timeType != null and timeType == 'MONTH'">
+                t.sys_day_ymd_ as timeStr,
+            </if>
+            <if test="timeType != null and timeType == 'YEAR'">
+                t.sys_day_ym_ as timeStr,
+            </if>
+            sum(a.practiceAmount) as practiceAmount,
+            sum(a.liveAmount) as liveAmount,
+            sum(a.musicAmount) as musicAmount
+        from sys_day t
+        left join (
+            select
+                DATE_FORMAT(t.create_time_, '%Y-%m-%d') as timeStr,
+                sum(if(t.biz_type_ = 'PRACTICE',1,0)) as practiceAmount,
+                sum(if(t.biz_type_ = 'LIVE',1,0)) as liveAmount,
+                sum(if(t.biz_type_ = 'MUSIC',1,0)) as musicAmount
+            from user_cash_account_record t
+            <where>
+                <if test="param.startTime !=null">
+                    <![CDATA[AND t.create_time_ >= #{param.startTime} ]]>
+                </if>
+                <if test="param.endTime !=null">
+                    <![CDATA[AND t.create_time_ <= #{param.endTime} ]]>
+                </if>
+                <if test="param.userId !=null">
+                    t.account_id_ = #{userId}
+                </if>
+            </where>
+            group by DATE_FORMAT(t.create_time_,'%Y-%m-%d')
+        ) a on t.sys_day_ymd_ = a.timeStr
+        <where>
+            <if test="param.startTime !=null">
+                <![CDATA[AND t.sys_day_ >= #{param.startTime} ]]>
+            </if>
+            <if test="param.endTime !=null">
+                <![CDATA[AND t.sys_day_ <= #{param.endTime} ]]>
+            </if>
+        </where>
+        order by t.sys_day_ desc
+        <if test="timeType != null and timeType == 'MONTH'">
+            group by t.sys_day_ymd_
+        </if>
+        <if test="timeType != null and timeType == 'YEAR'">
+            group by t.sys_day_ym_
+        </if>
+    </select>
 </mapper>

+ 4 - 3
cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/controller/UserOrderController.java

@@ -19,7 +19,6 @@ import com.yonge.cooleshow.common.exception.BizException;
 import com.yonge.cooleshow.common.page.PageInfo;
 import com.yonge.toolset.utils.date.DateUtil;
 import com.yonge.toolset.utils.string.StringUtil;
-import com.yonge.toolset.utils.string.ValueUtil;
 import com.yonge.toolset.utils.web.WebUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -67,6 +66,8 @@ public class UserOrderController extends BaseController {
 
         try {
             return httpResponseResultFuture.get();
+        } catch (BizException e) {
+            return HttpResponseResult.failed(e.getMessage());
         } catch (Exception e) {
             e.printStackTrace();
             return HttpResponseResult.failed("下单失败");
@@ -80,7 +81,7 @@ public class UserOrderController extends BaseController {
         if (user == null || null == user.getId()) {
             return failed(HttpStatus.FORBIDDEN, "请登录");
         }
-        if(StringUtil.isEmpty(payReq.getOrderNo())){
+        if (StringUtil.isEmpty(payReq.getOrderNo())) {
             return failed("订单号不能为空");
         }
         payReq.setUserId(user.getId());
@@ -108,7 +109,7 @@ public class UserOrderController extends BaseController {
         if (user == null || null == user.getId()) {
             return failed(HttpStatus.FORBIDDEN, "请登录");
         }
-        if(StringUtil.isEmpty(payReq.getOrderNo())){
+        if (StringUtil.isEmpty(payReq.getOrderNo())) {
             return failed("订单号不能为空");
         }
         payReq.setUserId(user.getId());

+ 1 - 1
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/TeacherFreeTimeController.java

@@ -51,7 +51,7 @@ public class TeacherFreeTimeController extends BaseController {
 
     @ApiOperation(value = "获取老师陪练课设置")
     @PostMapping("/getDetail")
-    public HttpResponseResult<TeacherFreeTimeVo> getDetail(@Valid @RequestBody PracticeTimesSetting practiceTimesSetting){
+    public HttpResponseResult<TeacherFreeTimeVo> getDetail(@RequestBody PracticeTimesSetting practiceTimesSetting){
         SysUser user = sysUserFeignService.queryUserInfo();
         if (user == null || null == user.getId()) {
             return failed(HttpStatus.FORBIDDEN, "请登录");

+ 23 - 1
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/UserAccountController.java

@@ -6,6 +6,7 @@ import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.dto.req.TotalReq;
 import com.yonge.cooleshow.biz.dal.dto.search.UserAccountRecordSearch;
 import com.yonge.cooleshow.biz.dal.enums.InOrOutEnum;
+import com.yonge.cooleshow.biz.dal.enums.TimeTypeEnum;
 import com.yonge.cooleshow.biz.dal.service.UserAccountRecordService;
 import com.yonge.cooleshow.biz.dal.service.UserAccountService;
 import com.yonge.cooleshow.biz.dal.support.PageUtil;
@@ -40,6 +41,7 @@ public class UserAccountController extends BaseController {
     private UserAccountRecordService userAccountRecordService;
     @Autowired
     private SysUserFeignService sysUserFeignService;
+
 	/**
      * 查询单条
      */
@@ -81,10 +83,30 @@ public class UserAccountController extends BaseController {
         return succeed(PageUtil.pageInfo(pages));
     }
 
-
     @ApiOperation(value = "收入数据统计")
     @PostMapping("/accountTotal")
     public HttpResponseResult<AccountTotal> accountTotal(@Valid @RequestBody TotalReq totalReq) {
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || null == user.getId()) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        totalReq.setUserId(user.getId());
+        //参数处理
+        Calendar calendar = Calendar.getInstance();
+        if (TimeTypeEnum.MONTH.equals(totalReq.getTimeType())) {
+            String[] classDateSp = totalReq.getDateTime().split("-");
+            calendar.set(Integer.parseInt(classDateSp[0]), Integer.parseInt(classDateSp[1]), 1, 0, 0, 0);
+            totalReq.setStartTime(calendar.getTime());
+            totalReq.setEndTime(DateUtil.dayEnd(DateUtil.getLastDayOfMonth(calendar.getTime())));
+        } else if (TimeTypeEnum.YEAR.equals(totalReq.getTimeType())) {
+            calendar.set(Integer.parseInt(totalReq.getDateTime()), 1, 1, 0, 0, 0);
+            totalReq.setStartTime(calendar.getTime());
+
+            calendar.set(Integer.parseInt(totalReq.getDateTime()), 12, 1, 0, 0, 0);
+            totalReq.setEndTime(DateUtil.dayEnd(DateUtil.getLastDayOfMonth(calendar.getTime())));
+        } else {
+            return HttpResponseResult.failed("参数异常");
+        }
         return userAccountService.accountTotal(totalReq);
     }
 

+ 1 - 2
toolset/thirdparty-component/src/main/java/com/yonge/toolset/thirdparty/user/realname/provider/LinkfaceRealnameAuthenticationPlugin.java

@@ -92,8 +92,7 @@ public class LinkfaceRealnameAuthenticationPlugin implements RealnameAuthenticat
 					msg = "查无此身份证号";
 				}
 			} else {
-				//msg = reason.get(status);
-				msg = reason.get("身份证号和姓名不一致");
+				msg = reason.get(status);
 			}
 			throw new ThirdpartyException("实名认证失败,原因:{}", msg);
 		}