瀏覽代碼

update:平台收入

yonge 3 年之前
父節點
當前提交
d8de457a0d

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

@@ -19,13 +19,13 @@ import java.util.List;
 public interface PlatformCashAccountRecordDao extends BaseMapper<PlatformCashAccountRecord> {
 
     int insertBatch(@Param("entities") List<PlatformCashAccountRecord> entities);
-    
-    int batchUpdate(List<PlatformCashAccountRecord> list);
-    
+
     IPage<PlatformCashAccountRecord> queryPage(@Param("page") IPage<PlatformCashAccountRecord> page, @Param("param") PlatformCashAccountRecordSearch query);
-    
+
     PlatformCashAccountRecordSummaryVo querySummary(@Param("param") PlatformCashAccountRecordSearch query);
-    
+
     List<PlatformCashAccountRecord> queryByBizTypeAndPaymentDays(@Param("bizType")String bizType, @Param("paymentDays")int paymentDays);
+
+    int batchUpdate(List<PlatformCashAccountRecord> list);
 }
 

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

@@ -1,6 +1,7 @@
 package com.yonge.cooleshow.biz.dal.service.impl;
 
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -21,6 +22,12 @@ 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.vo.PlatformCashAccountRecordSummaryVo;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import com.yonge.cooleshow.biz.dal.service.SysConfigService;
 import com.yonge.cooleshow.biz.dal.vo.PlatformCashAccountRecordSummaryVo;
 import com.yonge.cooleshow.common.constant.SysConfigConstant;
@@ -36,7 +43,7 @@ import com.yonge.cooleshow.common.enums.PostStatusEnum;
 public class PlatformCashAccountRecordServiceImpl extends ServiceImpl<PlatformCashAccountRecordDao, PlatformCashAccountRecord> implements PlatformCashAccountRecordService {
 
     private final static Logger log = LoggerFactory.getLogger(PlatformCashAccountRecordServiceImpl.class);
-    
+
     @Autowired
     private SysConfigService sysConfigService;
 
@@ -58,7 +65,27 @@ public class PlatformCashAccountRecordServiceImpl extends ServiceImpl<PlatformCa
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public boolean updateWaitRecord() {
-		
+		//根据不同类型(业务类型:PRACTICE、陪练课 LIVE、直播课 VIDEO、视频课 MUSIC、乐谱)查询超过账期待结算的记录
+
+		//getDao().queryByBizTypeAndPaymentDays(bizType, paymentDays);
+
+		return false;
+	}
+
+	@Override
+	public IPage<PlatformCashAccountRecord> queryPage(IPage<PlatformCashAccountRecord> page, PlatformCashAccountRecordSearch query) {
+		return getDao().queryPage(page, query);
+	}
+
+	@Override
+	public PlatformCashAccountRecordSummaryVo querySummary(PlatformCashAccountRecordSearch query) {
+		return getDao().querySummary(query);
+	}
+
+	@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);
@@ -66,11 +93,11 @@ public class PlatformCashAccountRecordServiceImpl extends ServiceImpl<PlatformCa
 		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、乐谱)查询超过账期待结算的记录
 		List<PlatformCashAccountRecord> list1 = getDao().queryByBizTypeAndPaymentDays(AccountBizTypeEnum.MALL_SHARE.getCode(), Integer.parseInt(configMap.get(SysConfigConstant.MALL_ACCOUNT_PERIOD).toString()));
@@ -95,24 +122,24 @@ public class PlatformCashAccountRecordServiceImpl extends ServiceImpl<PlatformCa
 		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;
 	}
 

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

@@ -30,6 +30,69 @@
             #{entity.bizId}, #{entity.memo}, #{entity.orderNo}, #{entity.createTime}, #{entity.updateTime})
         </foreach>
     </insert>
+    
+    <select id="queryPage" resultType="com.yonge.cooleshow.biz.dal.entity.PlatformCashAccountRecord">
+    	select * from platform_cash_account_record
+    	<where>
+    		<if test="param.orderNo">
+    			and order_no_ = #{param.orderNo}
+    		</if>
+    		<if test="param.bizId">
+    			and biz_id_ = #{param.bizId}
+    		</if>
+    		<if test="param.inOrOut">
+    			and in_or_out_ = #{param.inOrOut}
+    		</if>
+    		<if test="param.bizType">
+    			and biz_type_ = #{param.bizType}
+    		</if>
+    		<if test="param.status">
+    			and post_status_ = #{param.status}
+    		</if>
+    		<if test="param.startDate">
+    			and update_time_ &gt;= #{param.startDate}
+    		</if>
+    		<if test="param.endDate">
+    			and update_time_ &lt;= #{param.endDate}
+    		</if>
+    	</where>
+    </select>
+    
+    <select id="querySummary" resultType="com.yonge.cooleshow.biz.dal.vo.PlatformCashAccountRecordSummaryVo">
+    	select 
+    		sum(case when in_or_out_ = 'IN' and post_status_ = 'WAIT' then trans_amount_ else 0 end) advancesReceived,
+    		sum(case when in_or_out_ = 'IN' and post_status_ = 'RECORDED' then trans_amount_ else 0 end) settledReceived,
+    		sum(case when in_or_out_ = 'OUT' and post_status_ = 'WAIT' then trans_amount_ else 0 end) advancePayment,
+    		sum(case when in_or_out_ = 'OUT' and post_status_ = 'RECORDED' then trans_amount_ else 0 end) settledPayment 
+    	from platform_cash_account_record
+    	<where>
+    		<if test="param.orderNo">
+    			and order_no_ = #{param.orderNo}
+    		</if>
+    		<if test="param.bizId">
+    			and biz_id_ = #{param.bizId}
+    		</if>
+    		<if test="param.inOrOut">
+    			and in_or_out_ = #{param.inOrOut}
+    		</if>
+    		<if test="param.bizType">
+    			and biz_type_ = #{param.bizType}
+    		</if>
+    		<if test="param.status">
+    			and post_status_ = #{param.status}
+    		</if>
+    		<if test="param.startDate">
+    			and update_time_ &gt;= #{param.startDate}
+    		</if>
+    		<if test="param.endDate">
+    			and update_time_ &lt;= #{param.endDate}
+    		</if>
+    	</where>
+    </select>
+    
+    <select id="queryByBizTypeAndPaymentDays" resultType="com.yonge.cooleshow.biz.dal.entity.PlatformCashAccountRecord">
+    	select * from platform_cash_account_record where biz_type_ = #{bizType} and TIMESTAMPDIFF(HOUR, create_time_, now()) &gt;= ${24 * paymentDays}
+    </select>
 
     <update id="batchUpdate">
         <foreach collection="list" item="param" separator=";">