Browse Source

Merge branch 'dev_v1_1_20220720'

liweifan 3 năm trước cách đây
mục cha
commit
04cfc3fb07

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

@@ -410,7 +410,6 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
     }
 
     public void mallTeacherRecordState(MallOrderItemDto shareDto) {
-
         // 平台修改收入状态
         if (shareDto.getStatus().equals(PostStatusEnum.RECORDED)) {
             platformCashAccountRecordService.mallRecordedRecord(shareDto.getProductSkuId(),shareDto.getOrderSn(),GoodTypeEnum.MALL.getCode());

+ 7 - 2
cooleshow-user/user-biz/src/main/resources/config/mybatis/UserAccountMapper.xml

@@ -81,6 +81,8 @@
             (select sum(a.trans_amount_) from user_cash_account_record a where a.account_id_ = t.user_id_
                 and a.post_status_ = 'WAIT' and a.in_or_out_ = 'IN') as amountUnrecorded,
             (select sum(a.trans_amount_) from user_cash_account_record a where a.account_id_ = t.user_id_
+                and a.post_status_ = 'RECORDED' and a.in_or_out_ = 'IN') as amountRecorded,
+            (select sum(a.trans_amount_) from user_cash_account_record a where a.account_id_ = t.user_id_
                 and a.post_status_ = 'RECORDED' and a.in_or_out_ = 'IN'
                 and a.biz_type_ in ('LIVE_SHARE','VIDEO_SHARE','MUSIC_SHARE','VIP_SHARE','MALL_SHARE')) as amountShare
         FROM user_cash_account t
@@ -125,6 +127,8 @@
                 sum(if(t.biz_type_ = 'MALL_SHARE',t.trans_amount_,0)) as mallShareAmount
         from user_cash_account_record t
             <where>
+                and t.post_status_ = 'RECORDED'
+                and t.in_or_out_ = 'IN' and t.err_flag_ != 1
                 <if test="param.startTime !=null">
                     <![CDATA[AND t.create_time_ >= #{param.startTime} ]]>
                 </if>
@@ -156,7 +160,7 @@
 
     <select id="totalTransAmountByOrderNo" resultType="java.math.BigDecimal">
         select sum(trans_amount_) from user_cash_account_record
-        where post_status_ in ('WAIT','FROZEN','RECORDED') and in_or_out_ = 'IN' and err_flag_ = 0
+        where post_status_ in ('WAIT','FROZEN','RECORDED') and in_or_out_ = 'IN' and err_flag_ != 1
             and order_no_ = #{orderNo}
     </select>
 
@@ -168,7 +172,8 @@
             sum(if(t.post_status_ = 'CANCEL',t.trans_amount_,0)) as cancelAmount,
             count(distinct t.buy_user_) as studentNum
         from user_cash_account_record t
-        where t.account_id_ = #{param.userId}
+        where t.in_or_out_ = 'IN' and t.err_flag_ != 1
+          and t.account_id_ = #{param.userId}
           and t.biz_type_ in ('LIVE_SHARE','VIDEO_SHARE','MUSIC_SHARE','VIP_SHARE','MALL_SHARE')
     </select>
 </mapper>

+ 15 - 0
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/UserAccountController.java

@@ -120,6 +120,21 @@ public class UserAccountController extends BaseController {
             return failed(HttpStatus.FORBIDDEN, "请登录");
         }
         query.setUserId(user.getId());
+        if (StringUtil.isEmpty(query.getSearchDate())) {
+            query.setSearchDate(DateUtil.format(new Date(), "yyyy-MM"));
+        }
+        String[] classDateSp = query.getSearchDate().split("-");
+        try {
+            LocalDate date = LocalDate.of(Integer.parseInt(classDateSp[0]), Integer.parseInt(classDateSp[1]), 1);
+
+            LocalDateTime firstDay = LocalDateTime.of(date.with(TemporalAdjusters.firstDayOfMonth()), LocalTime.MIN);
+            LocalDateTime lastDay = LocalDateTime.of(date.with(TemporalAdjusters.lastDayOfMonth()), LocalTime.MAX);
+
+            query.setStartTime(firstDay);
+            query.setEndTime(lastDay);
+        } catch (Exception e) {
+            throw new BizException("查询时间格式不正确 [" + query.getSearchDate() + "]");
+        }
         IPage<UserAccountRecordVo> pages = userAccountRecordService.sharePage(PageUtil.getPage(query), query);
         return succeed(PageUtil.pageInfo(pages));
     }