Browse Source

Merge branch 'dev_v1_1_20220720'

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

+ 5 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/PlatformCashAccountRecordDao.java

@@ -37,5 +37,10 @@ public interface PlatformCashAccountRecordDao extends BaseMapper<PlatformCashAcc
 
     Integer mallRecordedRecord(@Param("orderNo")String orderNo,@Param("bizType") String bizType, @Param("bizId") Long bizId);
 
+    /**
+     * 平台收益批量入账
+     * @param recordIds
+     */
+    void batchRecorded(@Param("recordIds") List<Long> recordIds);
 }
 

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

@@ -1,8 +1,8 @@
 package com.yonge.cooleshow.biz.dal.service.impl;
 
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 
 import com.yonge.cooleshow.biz.dal.service.UserAccountRecordService;
 import com.yonge.toolset.base.util.StringUtil;
@@ -21,8 +21,6 @@ import com.yonge.cooleshow.biz.dal.enums.AccountBizTypeEnum;
 import com.yonge.cooleshow.biz.dal.service.PlatformCashAccountRecordService;
 import com.yonge.cooleshow.biz.dal.service.SysConfigService;
 import com.yonge.cooleshow.biz.dal.vo.PlatformCashAccountRecordSummaryVo;
-import com.yonge.cooleshow.common.enums.PostStatusEnum;
-import org.springframework.util.CollectionUtils;
 
 /**
  * 平台账户流水表(PlatformCashAccountRecord)表服务实现类
@@ -76,16 +74,8 @@ public class PlatformCashAccountRecordServiceImpl extends ServiceImpl<PlatformCa
         paramNames.add(AccountBizTypeEnum.VIP_SHARE.getCode());
 
         List<PlatformCashAccountRecord> list = getDao().queryCanAccountByBizType(paramNames);
-        if(!CollectionUtils.isEmpty(list)){
-            for (PlatformCashAccountRecord pcar : list) {
-                //预收改成实收
-                pcar.setPostStatus(PostStatusEnum.RECORDED);
-                pcar.setUpdateTime(new Date());
-            }
-            getDao().batchUpdate(list);
-        }
-        //老师账户修改
-        userAccountRecordService.updateWaitRecord();
+        List<Long> recordIds = list.stream().map(PlatformCashAccountRecord::getId).collect(Collectors.toList());
+        getDao().batchRecorded(recordIds);
         return true;
     }
 

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

@@ -64,6 +64,21 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
         if (null == detail) {
             throw new BizException("用户没有开通账户");
         }
+        detail = dealUserAccountVo(detail);
+        return detail;
+    }
+
+    public UserAccountVo dealUserAccountVo(UserAccountVo detail){
+        detail.setAmountUnrecorded(
+                null == detail.getAmountUnrecorded() ? BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP) : detail.getAmountUnrecorded().setScale(2, RoundingMode.HALF_UP));
+        detail.setAmountRecorded(
+                null == detail.getAmountRecorded() ? BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP) : detail.getAmountRecorded().setScale(2, RoundingMode.HALF_UP));
+        detail.setAmountTotal(
+                null == detail.getAmountTotal() ? BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP) : detail.getAmountTotal().setScale(2, RoundingMode.HALF_UP));
+        detail.setAmountUsable(
+                null == detail.getAmountUsable() ? BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP) : detail.getAmountUsable().setScale(2, RoundingMode.HALF_UP));
+        detail.setAmountFrozen(
+                null == detail.getAmountFrozen() ? BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP) : detail.getAmountFrozen().setScale(2, RoundingMode.HALF_UP));
         return detail;
     }
 
@@ -286,16 +301,7 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
         BigDecimal mallShareAmount = 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.setVideoAmount(null == info.getVideoAmount() ? BigDecimal.ZERO : info.getVideoAmount());
-            info.setMusicAmount(null == info.getMusicAmount() ? BigDecimal.ZERO : info.getMusicAmount());
-
-            info.setLiveShareAmount(null == info.getLiveShareAmount() ? BigDecimal.ZERO : info.getLiveShareRate());
-            info.setVideoShareAmount(null == info.getVideoShareAmount() ? BigDecimal.ZERO : info.getVipShareAmount());
-            info.setMusicShareAmount(null == info.getMusicShareAmount() ? BigDecimal.ZERO : info.getMusicShareAmount());
-            info.setVipShareAmount(null == info.getVipShareAmount() ? BigDecimal.ZERO : info.getVipShareAmount());
-            info.setMallShareAmount(null == info.getMusicShareAmount() ? BigDecimal.ZERO : info.getMallShareAmount());
+            info = dealAccountTotal(info);
 
             practiceAmount = practiceAmount.add(info.getPracticeAmount());
             liveAmount = liveAmount.add(info.getLiveAmount());
@@ -488,4 +494,32 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
         }
     }
 
+    public AccountTotal dealAccountTotal(AccountTotal info){
+        if(null == info){
+            info = new AccountTotal();
+        }
+        info.setTotalInAmount(
+                null == info.getTotalInAmount() ? BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP) : info.getTotalInAmount().setScale(2, RoundingMode.HALF_UP));
+        info.setPracticeAmount(
+                null == info.getPracticeAmount() ? BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP) : info.getPracticeAmount().setScale(2, RoundingMode.HALF_UP));
+        info.setLiveAmount(
+                null == info.getLiveAmount() ? BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP) : info.getLiveAmount().setScale(2, RoundingMode.HALF_UP));
+        info.setVideoAmount(
+                null == info.getVideoAmount() ? BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP) : info.getVideoAmount().setScale(2, RoundingMode.HALF_UP));
+        info.setMusicAmount(
+                null == info.getMusicAmount() ? BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP) : info.getMusicAmount().setScale(2, RoundingMode.HALF_UP));
+
+        info.setLiveShareAmount(
+                null == info.getLiveShareAmount() ? BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP) : info.getLiveShareRate().setScale(2, RoundingMode.HALF_UP));
+        info.setVideoShareAmount(
+                null == info.getVideoShareAmount() ? BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP) : info.getVipShareAmount().setScale(2, RoundingMode.HALF_UP));
+        info.setMusicShareAmount(
+                null == info.getMusicShareAmount() ? BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP) : info.getMusicShareAmount().setScale(2, RoundingMode.HALF_UP));
+        info.setVipShareAmount(
+                null == info.getVipShareAmount() ? BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP) : info.getVipShareAmount().setScale(2, RoundingMode.HALF_UP));
+        info.setMallShareAmount(
+                null == info.getMusicShareAmount() ? BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP) : info.getMallShareAmount().setScale(2, RoundingMode.HALF_UP));
+        return info;
+    }
+
 }

+ 8 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/PlatformCashAccountRecordMapper.xml

@@ -69,6 +69,14 @@
         </foreach>
     </update>
 
+	<update id="batchRecorded">
+		update platform_cash_account_record set post_status_ = 'RECORDED'
+		where post_status_ = 'WAIT' and id_ IN
+		<foreach collection="recordIds" item="item" open="(" separator="," close=")">
+			#{item}
+		</foreach>
+	</update>
+
 	<sql id="selectSql">
 		select * from platform_cash_account_record
 		<where>