瀏覽代碼

Merge branch 'zhangxin' into lihao

shuiqilin
lihao 1 年之前
父節點
當前提交
98ee97e9d6

+ 2
- 2
src/main/java/com/qtzl/alterSales/dao/repo/jpa/primary/FssPaccountPayRepo.java 查看文件



@Query(value = "select " + @Query(value = "select " +
" DATE_FORMAT(insert_time, '%Y-%m-%d') as accountDate,agent_id as agentId , COUNT(1) as numberTotal ,SUM(receipt_Amt) as moneyTotal ,SUM(CASE WHEN `status` = 1 THEN receipt_Amt ELSE 0 END) as collectMoney ,0 as refundMoney " + " DATE_FORMAT(insert_time, '%Y-%m-%d') as accountDate,agent_id as agentId , COUNT(1) as numberTotal ,SUM(receipt_Amt) as moneyTotal ,SUM(CASE WHEN `status` = 1 THEN receipt_Amt ELSE 0 END) as collectMoney ,0 as refundMoney " +
" from fss_paccount_pay where Date(insert_time) = DATE_SUB(CURDATE(),INTERVAL 1 DAY) GROUP BY DATE_FORMAT(insert_time, '%Y-%m-%d'),agent_id ",nativeQuery = true )
List<Map<String,Object>> findCountTotal();
" from fss_paccount_pay where insert_time = ?1 GROUP BY DATE_FORMAT(insert_time, '%Y-%m-%d'),agent_id ",nativeQuery = true )
List<Map<String,Object>> findCountTotal(String yesterday);


} }

+ 2
- 2
src/main/java/com/qtzl/alterSales/dao/repo/jpa/second/AflPaccountRefundCountRepo.java 查看文件

JpaRepository<AflPaccountRefundCount, String> , JpaRepository<AflPaccountRefundCount, String> ,
JpaSpecificationExecutor<AflPaccountRefundCount> { JpaSpecificationExecutor<AflPaccountRefundCount> {


@Query(value = " SELECT COUNT(1) FROM AFL_PACCOUNT_REFUND_COUNT GROUP BY ACCOUNT_DATE having ACCOUNT_DATE = DATE_SUB(CURDATE(),INTERVAL 1 DAY) ",nativeQuery = true)
Integer findByToDay();
@Query(value = " SELECT COUNT(1) FROM AFL_PACCOUNT_REFUND_COUNT GROUP BY ACCOUNT_DATE having ACCOUNT_DATE = ?1 ",nativeQuery = true)
Integer findByToDay(String yesterday);




@Query(" from AflPaccountRefundCount where agentId = ?1 and accountDate=?2") @Query(" from AflPaccountRefundCount where agentId = ?1 and accountDate=?2")

+ 7
- 3
src/main/java/com/qtzl/alterSales/manager/service/FssPaccountPayServiceImpl.java 查看文件

import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;


import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;


@Override @Override
public void count() throws ServiceHandleException { public void count() throws ServiceHandleException {

Integer i= aflPaccountRefundCountRepo.findByToDay();
// 获取当前日期前一天的日期
LocalDate localDate = LocalDate.now().minusDays(1);//1代表提前多少天
String yesterday = localDate.toString();
Integer i= aflPaccountRefundCountRepo.findByToDay(yesterday);
if (i!=null&&i>0){ if (i!=null&&i>0){
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("当前n+1天记录已存在"); throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("当前n+1天记录已存在");
} }
List<Map<String, Object>> countTotal = paccountPayRepo.findCountTotal();

List<Map<String, Object>> countTotal = paccountPayRepo.findCountTotal(yesterday+" 00:00:00");
List<AflPaccountRefundCount> list = new ArrayList<AflPaccountRefundCount>(); List<AflPaccountRefundCount> list = new ArrayList<AflPaccountRefundCount>();
for (Map<String, Object> stringObjectMap : countTotal) { for (Map<String, Object> stringObjectMap : countTotal) {
AflPaccountRefundCount aflPaccountRefundCount = new AflPaccountRefundCount(); AflPaccountRefundCount aflPaccountRefundCount = new AflPaccountRefundCount();

Loading…
取消
儲存