|
@@ -1,6 +1,18 @@
|
|
|
package com.yonge.cooleshow.biz.dal.service.impl;
|
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
@@ -22,7 +34,10 @@ import com.yonge.cooleshow.biz.dal.entity.PlatformCashAccountRecord;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.SysConfig;
|
|
|
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.constant.SysConfigConstant;
|
|
|
+import com.yonge.cooleshow.common.enums.PostStatusEnum;
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -47,6 +62,9 @@ public class PlatformCashAccountRecordServiceImpl extends ServiceImpl<PlatformCa
|
|
|
@Autowired
|
|
|
private SysConfigService sysConfigService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SysConfigService sysConfigService;
|
|
|
+
|
|
|
@Override
|
|
|
public PlatformCashAccountRecordDao getDao() {
|
|
|
return this.baseMapper;
|
|
@@ -65,11 +83,66 @@ public class PlatformCashAccountRecordServiceImpl extends ServiceImpl<PlatformCa
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean updateWaitRecord() {
|
|
|
+
|
|
|
+ List<String> paramNames = new ArrayList<String>();
|
|
|
+ paramNames.add(SysConfigConstant.MALL_ACCOUNT_PERIOD);
|
|
|
+ paramNames.add(SysConfigConstant.MUSIC_ACCOUNT_PERIOD);
|
|
|
+ paramNames.add(SysConfigConstant.VIP_ACCOUNT_PERIOD);
|
|
|
+ paramNames.add(SysConfigConstant.VIDEO_ACCOUNT_PERIOD);
|
|
|
+ paramNames.add(SysConfigConstant.LIVE_ACCOUNT_PERIOD);
|
|
|
+ //paramNames.add(SysConfigConstant.PRACTICE_ACCOUNT_PERIOD);
|
|
|
+
|
|
|
+ List<SysConfig> sysConfigs = sysConfigService.findByParamName(paramNames);
|
|
|
+
|
|
|
+ Map<String,String> configMap = sysConfigs.stream().collect(Collectors.toMap(SysConfig :: getParamName, SysConfig :: getParamValue));
|
|
|
+
|
|
|
+ List<PlatformCashAccountRecord> list = new ArrayList<PlatformCashAccountRecord>();
|
|
|
//根据不同类型(业务类型:PRACTICE、陪练课 LIVE、直播课 VIDEO、视频课 MUSIC、乐谱)查询超过账期待结算的记录
|
|
|
|
|
|
//getDao().queryByBizTypeAndPaymentDays(bizType, paymentDays);
|
|
|
|
|
|
return false;
|
|
|
+ List<PlatformCashAccountRecord> list1 = getDao().queryByBizTypeAndPaymentDays(AccountBizTypeEnum.MALL_SHARE.getCode(), Integer.parseInt(configMap.get(SysConfigConstant.MALL_ACCOUNT_PERIOD).toString()));
|
|
|
+ List<PlatformCashAccountRecord> list2 = getDao().queryByBizTypeAndPaymentDays(AccountBizTypeEnum.MUSIC_SHARE.getCode(), Integer.parseInt(configMap.get(SysConfigConstant.MUSIC_ACCOUNT_PERIOD).toString()));
|
|
|
+ List<PlatformCashAccountRecord> list3 = getDao().queryByBizTypeAndPaymentDays(AccountBizTypeEnum.VIP_SHARE.getCode(), Integer.parseInt(configMap.get(SysConfigConstant.VIP_ACCOUNT_PERIOD).toString()));
|
|
|
+ List<PlatformCashAccountRecord> list4 = getDao().queryByBizTypeAndPaymentDays(AccountBizTypeEnum.VIDEO_SHARE.getCode(), Integer.parseInt(configMap.get(SysConfigConstant.VIDEO_ACCOUNT_PERIOD).toString()));
|
|
|
+ List<PlatformCashAccountRecord> list5 = getDao().queryByBizTypeAndPaymentDays(AccountBizTypeEnum.LIVE_SHARE.getCode(), Integer.parseInt(configMap.get(SysConfigConstant.LIVE_ACCOUNT_PERIOD).toString()));
|
|
|
+ //List<PlatformCashAccountRecord> list6 = getDao().queryByBizTypeAndPaymentDays(AccountBizTypeEnum.PRACTICE.getCode(), Integer.parseInt(configMap.get(SysConfigConstant.PRACTICE_ACCOUNT_PERIOD).toString()));
|
|
|
+
|
|
|
+ if(list1.size() > 0){
|
|
|
+ list.addAll(list1);
|
|
|
+ }
|
|
|
+ if(list2.size() > 0){
|
|
|
+ list.addAll(list2);
|
|
|
+ }
|
|
|
+ if(list3.size() > 0){
|
|
|
+ list.addAll(list3);
|
|
|
+ }
|
|
|
+ if(list4.size() > 0){
|
|
|
+ list.addAll(list4);
|
|
|
+ }
|
|
|
+ if(list5.size() > 0){
|
|
|
+ list.addAll(list5);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(list.size() > 0){
|
|
|
+ Date date = new Date();
|
|
|
+ List<PlatformCashAccountRecord> batchUpdateList = new ArrayList<PlatformCashAccountRecord>();
|
|
|
+
|
|
|
+ for(PlatformCashAccountRecord pcar : list){
|
|
|
+ //预收改成实收
|
|
|
+ pcar.setPostStatus(PostStatusEnum.RECORDED);
|
|
|
+ pcar.setUpdateTime(date);
|
|
|
+ batchUpdateList.add(pcar);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(batchUpdateList.size() > 0){
|
|
|
+ getDao().batchUpdate(batchUpdateList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
@Override
|