台桌统计报表
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
server:
|
||||
port: 9100
|
||||
servlet:
|
||||
context-path: /account
|
||||
|
||||
spring:
|
||||
application:
|
||||
|
||||
@@ -2,17 +2,17 @@ package com.czg.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.CzgPayUtils;
|
||||
import com.czg.account.service.MemberPointsService;
|
||||
import com.czg.entity.CzgBaseRespParams;
|
||||
import com.czg.mq.PrintMqListener;
|
||||
import com.czg.order.service.OrderInfoService;
|
||||
import com.czg.order.service.ShopOrderStatisticService;
|
||||
import com.czg.task.StatisticTask;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
@@ -30,26 +30,18 @@ public class NotifyController {
|
||||
@Resource
|
||||
private StatisticTask statisticTask;
|
||||
|
||||
@DubboReference
|
||||
private MemberPointsService pointsService;
|
||||
|
||||
@Resource
|
||||
private ShopOrderStatisticService shopOrderStatisticService;
|
||||
|
||||
|
||||
@GetMapping("/payCallBack")
|
||||
public String notifyCallBack() {
|
||||
|
||||
shopOrderStatisticService.statistic();
|
||||
//JSONObject czg = CzgPayUtils.getCzg(respParams);
|
||||
//AssertUtil.isNull(czg, "支付回调数据为空");
|
||||
//log.info("支付回调数据为:{}", czg);
|
||||
//orderInfoService.payCallBackOrder(czg.getString("mchOrderNo"), czg);
|
||||
@RequestMapping("/payCallBack")
|
||||
public String notifyCallBack(@RequestBody CzgBaseRespParams respParams){
|
||||
JSONObject czg = CzgPayUtils.getCzg(respParams);
|
||||
AssertUtil.isNull(czg, "支付回调数据为空");
|
||||
log.info("支付回调数据为:{}", czg);
|
||||
orderInfoService.payCallBackOrder(czg.getString("mchOrderNo"), czg);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@RequestMapping("/refundCallBack")
|
||||
public String refundCallBack(@RequestBody CzgBaseRespParams respParams) {
|
||||
public String refundCallBack(@RequestBody CzgBaseRespParams respParams){
|
||||
JSONObject czg = CzgPayUtils.getCzg(respParams);
|
||||
AssertUtil.isNull(czg, "退款回调数据为空");
|
||||
log.info("退款回调数据为:{}", czg);
|
||||
@@ -59,7 +51,6 @@ public class NotifyController {
|
||||
|
||||
@Resource
|
||||
private PrintMqListener printMqListener;
|
||||
|
||||
@RequestMapping("/test")
|
||||
public void test(@RequestParam String id) {
|
||||
printMqListener.orderPrint(id);
|
||||
|
||||
@@ -27,8 +27,8 @@ public class StatisticTask {
|
||||
long start = System.currentTimeMillis();
|
||||
log.info("定时任务执行,开始统计数据");
|
||||
shopOrderStatisticService.statistic();
|
||||
//shopProdStatisticService.statistic();
|
||||
//shopTableOrderStatisticService.statistic();
|
||||
shopProdStatisticService.statistic();
|
||||
shopTableOrderStatisticService.statistic();
|
||||
log.info("定时任务执行完毕,耗时:{}ms", start - System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
server:
|
||||
port: 9200
|
||||
servlet:
|
||||
context-path: /order
|
||||
|
||||
spring:
|
||||
application:
|
||||
|
||||
@@ -18,7 +18,6 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
public class ProductApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
SpringApplication.run(ProductApplication.class, args);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
server:
|
||||
port: 9300
|
||||
servlet:
|
||||
context-path: /product
|
||||
|
||||
spring:
|
||||
application:
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
server:
|
||||
port: 9400
|
||||
servlet:
|
||||
context-path: /system
|
||||
|
||||
spring:
|
||||
application:
|
||||
|
||||
@@ -61,17 +61,15 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
||||
|
||||
SaRouter.match("/user/**").notMatch("/user/login", "/user/test", "/user/geo/**", "/user/home/**", "/user/home/**", "/user/dict/**", "/user/openId")
|
||||
.notMatch("/pay/**")
|
||||
.notMatch("/order/notify/**")
|
||||
.notMatch("/user/product/**")
|
||||
.notMatch("/notify/**")
|
||||
.check(r -> MyStpLogic.CLIENT_LOGIC.checkLogin())
|
||||
.setHit(true)
|
||||
// .match("/**")
|
||||
.notMatch("/user/**")
|
||||
.notMatch("/pay/**")
|
||||
.notMatch("/order/notify/**")
|
||||
.notMatch("/account/admin/auth/**")
|
||||
.notMatch("/user/product/**")
|
||||
.notMatch("/account/admin/shopMsgPush/subscribe/**")
|
||||
.notMatch("/notify/**")
|
||||
.notMatch("/admin/auth/**")
|
||||
.notMatch("/admin/shopMsgPush/subscribe/**")
|
||||
.check(r -> MyStpLogic.ADMIN_LOGIC.checkLogin());
|
||||
|
||||
})).addPathPatterns("/**");
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package com.czg.service.order.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.czg.order.entity.ShopOrderStatistic;
|
||||
import com.czg.order.param.DataSummaryTradeParam;
|
||||
import com.czg.order.service.DataSummaryService;
|
||||
@@ -11,11 +12,9 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 服务层实现。
|
||||
@@ -31,52 +30,27 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
|
||||
|
||||
@Override
|
||||
public void statistic() {
|
||||
// 获取前一天
|
||||
DateTime yesterday = DateUtil.yesterday();
|
||||
// 获取前一天的开始时间(00:00:00)
|
||||
DateTime startOfDay = DateUtil.beginOfDay(yesterday);
|
||||
// 获取前一天的结束时间(23:59:59)
|
||||
DateTime endOfDay = DateUtil.endOfDay(yesterday);
|
||||
List<Long> shopIdList = dataSummaryService.getShopIdList();
|
||||
if (CollUtil.isEmpty(shopIdList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
LocalDate startDate = LocalDate.of(2024, 3, 12);
|
||||
LocalDate endDate = LocalDate.of(2025, 3, 25);
|
||||
|
||||
// 生成日期流
|
||||
Stream<LocalDate> dateStream = startDate.datesUntil(endDate);
|
||||
|
||||
// 遍历日期流
|
||||
dateStream.forEach(date -> {
|
||||
String cur = date.toString();
|
||||
String a = cur + " 00:00:00";
|
||||
String b = cur + " 23:59:59";
|
||||
shopIdList.parallelStream().forEach(shopId -> {
|
||||
DataSummaryTradeParam param = new DataSummaryTradeParam();
|
||||
param.setShopId(shopId);
|
||||
param.setBeginDate(a);
|
||||
param.setEndDate(b);
|
||||
ShopOrderStatistic statistic = dataSummaryService.getTradeData(param);
|
||||
if (NumberUtil.isGreater(statistic.getSaleAmount(), BigDecimal.ZERO)) {
|
||||
statistic.setShopId(shopId);
|
||||
statistic.setCreateDay(LocalDate.now());
|
||||
statistic.setUpdateTime(LocalDateTime.now());
|
||||
saveOrUpdate(statistic);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
LocalDate startDate = LocalDate.of(2024, 3, 12);
|
||||
LocalDate endDate = LocalDate.of(2025, 3, 25);
|
||||
|
||||
// 生成日期流
|
||||
Stream<LocalDate> dateStream = startDate.datesUntil(endDate);
|
||||
|
||||
// 遍历日期流
|
||||
dateStream.forEach(date -> {
|
||||
String cur = date.toString();
|
||||
String a = cur + "00:00:00";
|
||||
String b = cur + "23:59:59";
|
||||
System.out.println(date.toString());
|
||||
shopIdList.parallelStream().forEach(shopId -> {
|
||||
DataSummaryTradeParam param = new DataSummaryTradeParam();
|
||||
param.setShopId(shopId);
|
||||
param.setBeginDate(startOfDay.toStringDefaultTimeZone());
|
||||
param.setEndDate(endOfDay.toStringDefaultTimeZone());
|
||||
ShopOrderStatistic statistic = dataSummaryService.getTradeData(param);
|
||||
statistic.setShopId(shopId);
|
||||
statistic.setCreateDay(LocalDate.now());
|
||||
statistic.setUpdateTime(LocalDateTime.now());
|
||||
saveOrUpdate(statistic);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user