Merge remote-tracking branch 'origin/master'

This commit is contained in:
Tankaikai
2025-03-07 18:31:10 +08:00
61 changed files with 1170 additions and 173 deletions

View File

@@ -1,6 +1,7 @@
package com.czg.controller.admin;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONArray;
import com.czg.account.dto.print.PrinterAddDTO;
import com.czg.account.dto.print.PrinterDelDTO;
import com.czg.account.dto.print.PrinterEditDTO;
@@ -50,7 +51,13 @@ public class PrintMachineController {
queryWrapper.eq(PrintMachine::getSubType, subType);
}
queryWrapper.orderBy(PrintMachine::getSort, true).orderBy(PrintMachine::getId, false);
return CzgResult.success(printMachineService.page(PageUtil.buildPage(), queryWrapper));
Page<PrintMachine> page = printMachineService.page(PageUtil.buildPage(), queryWrapper);
page.getRecords().forEach(item -> {
if (StrUtil.isNotBlank(item.getCategoryIds())) {
item.setCategoryList(JSONArray.parse(item.getCategoryIds()));
}
});
return CzgResult.success(page);
}
/**
@@ -61,7 +68,11 @@ public class PrintMachineController {
@SaAdminCheckPermission(value = "printer:detail", name = "打印机详情获取")
@GetMapping("/detail")
public CzgResult<PrintMachine> detail(@RequestParam Integer id) {
return CzgResult.success(printMachineService.getOne(new QueryWrapper().eq(PrintMachine::getId, id).eq(PrintMachine::getShopId, StpKit.USER.getShopId())));
PrintMachine printMachine = printMachineService.getOne(new QueryWrapper().eq(PrintMachine::getId, id).eq(PrintMachine::getShopId, StpKit.USER.getShopId()));
if (printMachine != null && StrUtil.isNotBlank(printMachine.getCategoryIds())) {
printMachine.setCategoryList(JSONArray.parse(printMachine.getCategoryIds()));
}
return CzgResult.success(printMachine);
}

View File

@@ -1,35 +0,0 @@
package com.czg.controller.admin;
import com.czg.account.entity.ShopTableOrderStatistic;
import com.czg.account.service.ShopTableOrderStatisticService;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 桌台订单统计
* @author Administrator
*/
@RestController
@RequestMapping("/admin/tableOrderStatistic")
public class TableOrderStatisticController {
@Resource
private ShopTableOrderStatisticService orderStatisticService;
/**
* 桌台统计列表
* @param startTime 开始时间
* @param endTime 结束时间
* @return 统计信息
*/
@SaAdminCheckPermission(value = "tableOrderStatistic:list", name = "台桌订单统计列表")
@GetMapping
public CzgResult<Page<ShopTableOrderStatistic>> list(String startTime, String endTime) {
return CzgResult.success(orderStatisticService.summary(StpKit.USER.getShopId(), startTime, endTime));
}
}

View File

@@ -24,6 +24,9 @@ mybatis-flex:
wx:
appId: wxd88fffa983758a30
secrete: a34a61adc0602118b49400baa8812454
account:
appId: wx212769170d2c6b2a
secrete: 8492a7e8d55bbb1b57f5c8276ea1add0
alipay:
serverUrl: https://openapi.alipay.com/gateway.do
@@ -31,6 +34,12 @@ alipay:
privateKey: MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCAjDBuS8K/IJb9ui+KuNm/sTUdEiaji4BNpZ92avO1N5JpNlGmac6ec4p3tNFT950sBLcQkClcUpQxUHQzAT6DYNNXOKyvfI/EmcqwCw6PaMNLs/8cV//J2WWZBUhLaOsjKurpm9/3W5MnTh4BGxIfBoeBMA8f8K3BgKdmyKtvIEV2h2cyjsMskdn+g6oNZcmWcms0pvpPHyH46mRaGFhpp0v19wX3WsamGldh1L2VntmaDN3C2XbSrXv90XYp5bEUqwTbLwXpMAlzTibF56d/iqv9oYi8cpAKougUFLOymnbutLNs2tLrEDSFwHcmG2/wbZHybZyYcIgFgv4arf+tAgMBAAECggEAf7hKKlw1y6Z6vvAtalxNZUuRZSfyog3p1bwYWxTavZPQcZ7Zs0lvVDmiO1u5m/7q96BbryY9IhCeUv0H5uF2lhwu/3s9AEL3qTPQkeb6eXxyhhX6A9RfPdM1Qbtg4CQHdHKg4qjP9znSVHwmDZ0y/QaEvdPdQzPjv92u9c2tn4N4x6XyBYcU5gzxiJNnIugCmBgcJo/3H2fgV+XXEhORPvy5of9b4oATHEaLS/8dAS2wuOjhzaGS4MXp3VkXn3XaYjwSzaL03qYWA+xm+aO5sJv8bmqZW7sNVck5o3sPo7cQ4VkBFVzyrRdmJcxcSRJ9MsB9JsrhoKI8pgaXrVie4QKBgQDU2vai0lpBIK/0jzRpPNoqdT8lnafnnWni8nU4kfAh+gCLi+HBPhQRT0kv4unQc2q2/gALE7sgZVO00JGY5a3R0orsojPoUSZlpypGW7GGqKy576NHn0nw4o/PdfysT92VWgt1hlfTf6qfCDhfE9APU+RGvlSWXcT8nxVel3iUaQKBgQCamoJN6+4v+chJvL2nqV8NVVRLp0vDIHxs1QOtKwUodx8Qp1D6CJYtavCXn8aNUFVNQJPJ7TQPpJjXP2rI4SN01weDwx+I+wh8PBGHV6/234R+6TvFgY1PrYgCdfNP4i/E7B4uyEhAxdU73PB8qkqRAeJGok05p7oG71KCOBiYpQKBgEZfGflcuDAeAW5GRhqg3rP4zWa/R7qgZVh9tll8jjp9b96y4XFE99d9MgId8BVVgyt6sEL5Q/2C4ni+F9TH4n6jMADp42VkJuCmsqhOOlP9whU67+2G8Sgtj0QUivPg964f9ffl8XVgGOW5DwIIB9p5btggptCLscufQK5kP545AoGADBvf6tR4wl8w9b2HqTMV08iEIqzGvVC1Dh0c/Zop/EJgN4CzUfIMOSBwGaAVAApzs+pD6QPgGP2OTwWTioo/qa4R05sbxDHNN1XJFa2jhZV6HiqMWOrNs5jm1zJ/zRjtHuJTdtyO9CvKiLbESy9XScY4/8lEfSiK5HIoJzTXkFUCgYAkYkvkW6psJpWj05XWq44UN0n6QOU/Igl35Um/iuOMVhsTmIt09STQVTuzJzfH82+sCqoRsD1blE5unKNUC1DK77aNKTv3Z0dxN9R7FAyfZRiYQXTrbBPBqWjay6FCNxn8e8UsJN4Z6FIV2LGlQI114krSap1MALKLVvnld0NaUQ==
alipayPublicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiQkrz+emAuS1mB3KKDOMmAZRd/BlPbh7fAIHAqAj1+QCZNcV3o2BTLIIqnuKpSlFXDG3uDzp2VsBxcizXuBbFyPGylnD9CgCj5abyh3+FIHPAZ2IM3TtpqImZ0TSPGXrMli4Nir7MvZktgccCqQKCC4o6iaDGz+UwWwJUIPna8fm2tiTZ+KH150CZbKVj4ZGNpBh5XSV/1dRgyQIV9D/EwSbkZ0n6VgKQLJBi0C2UE3QB17aL1Ir6+gDXIDbknN8O7GUD3aMGdThYdSRUb5wp9CZ5qfV7vCS/CgaRo38nhH3NOzkTL+7v0m1ZDHPmqEkn9VzZN6sCQdL7PoAOjHOCwIDAQAB
encryptKey: Hp1TbhOqevbHCA5ji/VlqQ==
account:
appId: 2021004174605036
privateKey: MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQD48HaUoV7OH7os+9L01kHgxzwIhJick4OkFq4aHsntsXEJ J3gedhuEZtV8oHKZ30DPW12IJ4S8NXtpr8OWaqrAPFonf4wVaRY1d0yIAea57kfLEn9oOEEy4FzARgMNDkyxC+/3OUdGbLHpTjfVX3gusXsEhUDy1/WewihAkoNYF37+W3W/uVLzeWoPq0EcUbRv/G/t/p6gL69ltsMAiVFG4Q/Yk24YAN6lYgBPNLXUEwQ1Q+T+1omjfavHgvarKOp33z3JOUH+aGOmDsJ5Y9gyGtJzOCipAd8Zcv+T1ygsEzZYO1/gzcbPnfO1ShqStCHzssuw8FBVx2JdfQKXKMMNAgMBAAECggEAVTrO/pg5Q00titU1Jspsh67u6OOs9H605Ws2dI7yB8VmtAGlaJh7V1t14FN2qSP8poHbhhAxq9aLyGV7C3a9u09udnN+3J28EtYjh7VO732bavWMVXxdJjQWzWWrCb9JlpxFrlkYBA6W4w/6ob0sAqCVQ7jzwbEa0R4cde8ztOa5nysKSfr4YTSs0gqvoiC6fmg8eiRJraEQBoYz9VkKFtOhhh/4w5FhVcYQ2gQvZ3kK3QVuD1eJIQKlCtz8qaox9lXKDiZT4SCmnKshdUL0u5TYIcYeBjZmhJz0Q50KHcpZrCs5y7I0+vRBH3hU+TKSQt7ureymwhbwWMHScLV2gQKBgQD+58SHXhr5M8NGagAmTdsgmCnNv2kOYMd4STyPMY10SVwCv1Bk808ZuP+7e558J1b5/OuDLI5dLq6xrZ/1wLv1G++XqxI00hlFuWS5mUGJVcXotT1mw20rVeUILc7Qe3mLvbMGgfyKf4A7Qa5SSZ4bDeDTJYaFxyiQ281hMzDuPQKBgQD6AiL/Na2/uPH4CG6juwpjYvYVUcjK+7gbRwf3wWsWMpk90Z4ju2iUiP5c1J/oK9P+1T3PIr6M4Xjza8JJj+r9KC/PVB0gBv6vVM96cDpKUEy/UMpcn/T81vqj/Z+WEOODU8Ms6NiTTm+u9ldvpCjbu0u8M+9c0JeIyadJvSTFEQKBgQCsxmFyM3nq8YfpgU2qqNjfBeRH3faSVUy+nj1a/YZYjKS+A/i1BCnYUImeBVNN6chNV342ggvY4xxruDiU9Vcw8wd58O09Oi8BEIFSP6upL6cebUI6Fjo3xlegLJRiwV6INkNTJOYM5hD/mSxUACwXQFfkJipBINXBIgraWD1RLQKBgQCj49axWq0F6+WjZVOyPaD3uh37p9trRUxRhWTxw3fB23WdktaKMgbCqHOmwzP4bRLSEVQtf2dOz1gMqu14b8HqJvgAf/F/11YJ9hz09LEhmjZVjE68HZfqT7uK2W5OX8/lfXmK7TFcj6SjG5YB96lZMhTZ0WnufEd6QkdKDZYXIQKBgQD9GDTcIMbFwbEaKHnfZaTD3f876EGRgsgrCxwdEk7LBCRPwWo7yI929M4psIlpNwNeiyjBkBunWIVkpznp6qPtJqagIPUYesU4f5v6/okq5wcpaNKSkWbIvWVLaLGOiA1aeGJtbpMpyClbSr52puHpRRdvAiIEQ74yYh0JX8q96g==
publicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiQkrz+emAuS1mB3KKDOMmAZRd/BlPbh7fAIHAqAj1+QCZNcV3o2BTLIIqnuKpSlFXDG3uDzp2VsBxcizXuBbFyPGylnD9CgCj5abyh3+FIHPAZ2IM3TtpqImZ0TSPGXrMli4Nir7MvZktgccCqQKCC4o6iaDGz+UwWwJUIPna8fm2tiTZ+KH150CZbKVj4ZGNpBh5XSV/1dRgyQIV9D/EwSbkZ0n6VgKQLJBi0C2UE3QB17aL1Ir6+gDXIDbknN8O7GUD3aMGdThYdSRUb5wp9CZ5qfV7vCS/CgaRo38nhH3NOzkTL+7v0m1ZDHPmqEkn9VzZN6sCQdL7PoAOjHOCwIDAQAB
pagehelper:
helper-dialect: mysql

View File

@@ -2,9 +2,9 @@
<configuration scan="true" scanPeriod="30 seconds" debug="false">
<contextName>account-server</contextName>
<property name="log.charset" value="utf-8" />
<property name="log.pattern" value="[account-server] %yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %msg%n" />
<property name="log.pattern" value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %msg%n" />
<!--写入文件格式-->
<property name="p_file" value="[account-server] %d | [%thread] %-5level %c [%L] - %msg %n"/>
<property name="p_file" value="%d | [%thread] %-5level %c [%L] - %msg %n"/>
<!--输出到控制台-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>

View File

@@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSONObject;
import com.czg.CzgPayUtils;
import com.czg.entity.CzgBaseRespParams;
import com.czg.order.service.OrderInfoService;
import com.czg.task.StatisticTask;
import com.czg.utils.AssertUtil;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
@@ -24,6 +25,9 @@ public class NotifyController {
@Resource
private OrderInfoService orderInfoService;
@Resource
private StatisticTask statisticTask;
@RequestMapping("/payCallBack")
public String notifyCallBack(@RequestBody CzgBaseRespParams respParams){
@@ -42,4 +46,9 @@ public class NotifyController {
orderInfoService.refundCallBackOrder(czg.getString("mchOrderNo"), czg);
return SUCCESS;
}
@RequestMapping("/test")
public void test() {
statisticTask.run();
}
}

View File

@@ -146,8 +146,7 @@ public class OrderPayController {
* checkOrderPay.orderAmount 必填
*/
@PostMapping("/shopPayApi/js2Pay")
public CzgResult<Map<String, Object>> js2PayOrder(@RequestHeader Long shopId, HttpServletRequest request, @RequestBody OrderPayParamDTO payParam) {
payParam.setShopId(shopId);
public CzgResult<Map<String, Object>> js2PayOrder(HttpServletRequest request, @RequestBody OrderPayParamDTO payParam) {
return payService.js2PayOrder(ServletUtil.getClientIP(request), payParam);
}

View File

@@ -6,6 +6,7 @@ import com.czg.order.dto.OrderInfoQueryDTO;
import com.czg.order.dto.OrderInfoRefundDTO;
import com.czg.order.entity.OrderInfo;
import com.czg.order.service.OrderInfoService;
import com.czg.order.vo.HistoryOrderPrintVo;
import com.czg.order.vo.HistoryOrderVo;
import com.czg.order.vo.OrderInfoVo;
import com.czg.resp.CzgResult;
@@ -49,6 +50,11 @@ public class AdminOrderController {
return orderInfoService.getOrderDetails(orderId);
}
@GetMapping("/getOrderByIdPrint")
public CzgResult<HistoryOrderPrintVo> getOrderByIdPrint(Long orderId) {
return orderInfoService.getOrderByIdPrint(orderId);
}
@GetMapping("/historyOrder")
public CzgResult<HistoryOrderVo> historyOrder(
@RequestParam(required = false) Long orderId,
@@ -65,6 +71,16 @@ public class AdminOrderController {
return CzgResult.success(orderInfoService.createOrder(addDto));
}
// /**
// * 合单
// * @param refundDTO
// * @return
// */
// @PostMapping("/mergeOrder")
// public CzgResult<Object> mergeOrder(@Validated @RequestBody OrderInfoRefundDTO refundDTO) {
//
// }
/**
* 订单全额退款 只传订单id
* 部分退款 传参refundDetail

View File

@@ -12,6 +12,7 @@ import com.czg.utils.AssertUtil;
import com.czg.utils.ServletUtil;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@@ -23,6 +24,7 @@ import java.util.Map;
* @author ww
* @description
*/
@Slf4j
@RestController
@RequestMapping("/user/order")
public class UserOrderController {
@@ -58,7 +60,9 @@ public class UserOrderController {
@PostMapping("/createOrder")
public CzgResult<OrderInfo> createOrder(@RequestBody OrderInfoAddDTO addDto) {
addDto.setPlatformType(ServletUtil.getHeaderIgnoreCase(ServletUtil.getRequest(), "platformType"));
addDto.setUserId(StpKit.USER.getLoginIdAsLong());
long loginIdAsLong = StpKit.USER.getLoginIdAsLong();
log.info("获取到的用户Id为:{}", loginIdAsLong);
// addDto.setUserId(StpKit.USER.getLoginIdAsLong());
addDto.setShopId(StpKit.USER.getShopId());
addDto.setOrderType("miniapp");
return CzgResult.success(orderInfoService.createOrder(addDto));

View File

@@ -0,0 +1,24 @@
package com.czg.task;
import com.czg.order.service.ShopOrderStatisticService;
import com.czg.order.service.ShopProdStatisticService;
import com.czg.order.service.ShopTableOrderStatisticService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
/**
* @author Administrator
*/
@Component
public class StatisticTask {
@Resource
private ShopTableOrderStatisticService shopTableOrderStatisticService;
@Resource
private ShopProdStatisticService shopProdStatisticService;
@Resource
private ShopOrderStatisticService shopOrderStatisticService;
public void run() {
shopOrderStatisticService.statistic();
}
}

View File

@@ -2,9 +2,9 @@
<configuration scan="true" scanPeriod="30 seconds" debug="false">
<contextName>order-server</contextName>
<property name="log.charset" value="utf-8" />
<property name="log.pattern" value="[order-server] %yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %msg%n" />
<property name="log.pattern" value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %msg%n" />
<!--写入文件格式-->
<property name="p_file" value="[order-server] %d | [%thread] %-5level %c [%L] - %msg %n"/>
<property name="p_file" value="%d | [%thread] %-5level %c [%L] - %msg %n"/>
<!--输出到控制台-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>

View File

@@ -2,9 +2,9 @@
<configuration scan="true" scanPeriod="30 seconds" debug="false">
<contextName>product-server</contextName>
<property name="log.charset" value="utf-8" />
<property name="log.pattern" value="[product-server] %yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %msg%n" />
<property name="log.pattern" value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %msg%n" />
<!--写入文件格式-->
<property name="p_file" value="[product-server] %d | [%thread] %-5level %c [%L] - %msg %n"/>
<property name="p_file" value="%d | [%thread] %-5level %c [%L] - %msg %n"/>
<!--输出到控制台-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>

View File

@@ -2,9 +2,9 @@
<configuration scan="true" scanPeriod="30 seconds" debug="false">
<contextName>system-server</contextName>
<property name="log.charset" value="utf-8" />
<property name="log.pattern" value="[system-server] %yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %msg%n" />
<property name="log.pattern" value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %msg%n" />
<!--写入文件格式-->
<property name="p_file" value="[system-server] %d | [%thread] %-5level %c [%L] - %msg %n"/>
<property name="p_file" value="%d | [%thread] %-5level %c [%L] - %msg %n"/>
<!--输出到控制台-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>

View File

@@ -21,7 +21,7 @@ public class CorsFilter implements Filter {
response.setHeader("Access-Control-Allow-Origin", curOrigin == null ? "true" : curOrigin);
response.setHeader("Access-Control-Allow-Methods", "*");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Headers", "token");
response.setHeader("Access-Control-Allow-Headers", "token,Origin, X-Requested-With, Content-Type, Accept,shopId");
response.setHeader("Access-Control-Allow-Credentials", "true");
chain.doFilter(req, resp);
}

View File

@@ -63,7 +63,7 @@ public class SaTokenConfigure implements WebMvcConfigurer {
// 重置根路径防止satoken切割根路径导致匹配不到路径
ApplicationInfo.routePrefix = "";
SaRouter.match("/user/**").notMatch("/user/login", "/user/test", "/user/geo/**", "/user/home/**", "/user/home/**", "/user/dict/**")
SaRouter.match("/user/**").notMatch("/user/login", "/user/test", "/user/geo/**", "/user/home/**", "/user/home/**", "/user/dict/**", "/user/openId")
.notMatch("/pay/**")
.notMatch("/notify/**")
.check(r -> MyStpLogic.CLIENT_LOGIC.checkLogin())

View File

@@ -8,6 +8,7 @@ import java.io.Serializable;
import java.time.LocalDateTime;
import java.io.Serial;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -87,7 +88,7 @@ public class PrintMachine implements Serializable {
/**
* 分类
*/
private String categoryList;
private List<Object> categoryList;
/**
* 排序

View File

@@ -49,6 +49,14 @@ public class ShopTableOrderStatistic implements Serializable {
* 订单金额
*/
private BigDecimal orderAmount;
/**
* 退款金额
*/
private BigDecimal refundAmount;
/**
* 退款金额
*/
private Long refundCount;
/**
* 店铺id

View File

@@ -0,0 +1,120 @@
package com.czg.order.dto;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Date;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 实体类。
*
* @author zs
* @since 2025-03-07
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ShopOrderStatisticDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Integer id;
/**
* 销售额
*/
private BigDecimal saleAmount;
/**
* 销售数量
*/
private Long saleCount;
/**
* 优惠金额
*/
private BigDecimal discountAmount;
/**
* 优惠笔数
*/
private Long discountCount;
/**
* 退款金额
*/
private BigDecimal refundAmount;
/**
* 退款笔数
*/
private Long refundCount;
/**
* 微信支付笔数
*/
private Long wechatPayCount;
/**
* 位置支付金额
*/
private BigDecimal wechatPayAmount;
/**
* 支付宝支付笔数
*/
private Long aliPayCount;
/**
* 支付宝支付金额
*/
private BigDecimal aliPayAmount;
/**
* 挂账支付笔数
*/
private Long creditPayCount;
/**
* 挂账支付金额
*/
private BigDecimal creditPayAmount;
/**
* 会员支付笔数
*/
private Long memberPayCount;
/**
* 会员支付金额
*/
private BigDecimal memberPayAmount;
/**
* 主扫支付笔数
*/
private Long scanPayCount;
/**
* 主扫支付金额
*/
private BigDecimal scanPayAmount;
/**
* 店铺id
*/
private Long shopId;
/**
* 创建时间
*/
private Date createDay;
}

View File

@@ -0,0 +1,65 @@
package com.czg.order.dto;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Date;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 实体类。
*
* @author zs
* @since 2025-03-07
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ShopProdStatisticDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Long id;
/**
* 商品id
*/
private Long prodId;
/**
* 销售数量
*/
private Long saleNum;
/**
* 销售金额
*/
private BigDecimal saleAmount;
/**
* 退单量
*/
private Long refundNum;
/**
* 退单金额
*/
private BigDecimal refundAmount;
/**
* 店铺id
*/
private Long shopId;
/**
* 创建时间
*/
private Date createDay;
}

View File

@@ -0,0 +1,52 @@
package com.czg.order.dto;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Date;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 台桌订单统计表 实体类。
*
* @author zs
* @since 2025-03-07
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ShopTableOrderStatisticDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Long id;
private Long tableId;
/**
* 订单数量
*/
private Long orderCount;
/**
* 订单金额
*/
private BigDecimal orderAmount;
/**
* 店铺id
*/
private Long shopId;
/**
* 创建日期 年月日
*/
private Date createDay;
}

View File

@@ -0,0 +1,128 @@
package com.czg.order.entity;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Date;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 实体类。
*
* @author zs
* @since 2025-03-07
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("tb_shop_order_statistic")
public class ShopOrderStatistic implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Id(keyType = KeyType.Auto)
private Integer id;
/**
* 销售额
*/
private BigDecimal saleAmount = BigDecimal.ZERO;
/**
* 销售数量
*/
private Long saleCount = 0L;
/**
* 优惠金额
*/
private BigDecimal discountAmount = BigDecimal.ZERO;
/**
* 优惠笔数
*/
private Long discountCount = 0L;
/**
* 退款金额
*/
private BigDecimal refundAmount = BigDecimal.ZERO;
/**
* 退款笔数
*/
private Long refundCount = 0L;
/**
* 微信支付笔数
*/
private Long wechatPayCount = 0L;
/**
* 位置支付金额
*/
private BigDecimal wechatPayAmount = BigDecimal.ZERO;
/**
* 支付宝支付笔数
*/
private Long aliPayCount = 0L;
/**
* 支付宝支付金额
*/
private BigDecimal aliPayAmount = BigDecimal.ZERO;
/**
* 挂账支付笔数
*/
private Long creditPayCount = 0L;
/**
* 挂账支付金额
*/
private BigDecimal creditPayAmount = BigDecimal.ZERO;
/**
* 会员支付笔数
*/
private Long memberPayCount = 0L;
/**
* 会员支付金额
*/
private BigDecimal memberPayAmount = BigDecimal.ZERO;
/**
* 主扫支付笔数
*/
private Long scanPayCount = 0L;
/**
* 主扫支付金额
*/
private BigDecimal scanPayAmount = BigDecimal.ZERO;
private Long cashPayCount = 0L;
private BigDecimal cashPayAmount = BigDecimal.ZERO;
/**
* 店铺id
*/
private Long shopId;
/**
* 创建时间
*/
private Date createDay;
}

View File

@@ -0,0 +1,71 @@
package com.czg.order.entity;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Date;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 实体类。
*
* @author zs
* @since 2025-03-07
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("tb_shop_prod_statistic")
public class ShopProdStatistic implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 商品id
*/
private Long prodId;
/**
* 销售数量
*/
private BigDecimal saleCount;
/**
* 销售金额
*/
private BigDecimal saleAmount;
/**
* 退单量
*/
private BigDecimal refundCount;
/**
* 退单金额
*/
private BigDecimal refundAmount;
/**
* 店铺id
*/
private Long shopId;
/**
* 创建时间
*/
private Date createDay;
}

View File

@@ -0,0 +1,66 @@
package com.czg.order.entity;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Date;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 台桌订单统计表 实体类。
*
* @author zs
* @since 2025-03-07
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("tb_shop_table_order_statistic")
public class ShopTableOrderStatistic implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Id(keyType = KeyType.Auto)
private Long id;
private Long tableId;
/**
* 订单数量
*/
private Long orderCount;
/**
* 订单金额
*/
private BigDecimal orderAmount;
/**
* 店铺id
*/
private Long shopId;
/**
* 创建日期 年月日
*/
private Date createDay;
/**
* 退款数量
*/
private long refundCount;
/**
* 退款金额
*/
private BigDecimal refundAmount;
}

View File

@@ -1,5 +1,6 @@
package com.czg.order.service;
import com.czg.order.vo.OrderDetailPrintVo;
import com.mybatisflex.core.service.IService;
import com.czg.order.entity.OrderDetail;
@@ -14,5 +15,5 @@ import java.util.List;
public interface OrderDetailService extends IService<OrderDetail> {
void createOrderDetails(Long orderId, List<OrderDetail> orderDetails);
List<OrderDetailPrintVo> getOrderDetailPrint(Long orderId);
}

View File

@@ -5,6 +5,7 @@ import com.czg.order.dto.*;
import com.czg.order.entity.OrderDetail;
import com.czg.order.entity.OrderInfo;
import com.czg.order.enums.PayEnums;
import com.czg.order.vo.HistoryOrderPrintVo;
import com.czg.order.vo.HistoryOrderVo;
import com.czg.order.vo.OrderInfoVo;
import com.czg.resp.CzgResult;
@@ -29,6 +30,7 @@ public interface OrderInfoService extends IService<OrderInfo> {
Page<OrderInfoVo> getOrderByPage(OrderInfoQueryDTO param);
CzgResult<HistoryOrderVo> getOrderDetails(Long orderId);
CzgResult<HistoryOrderPrintVo> getOrderByIdPrint(Long orderId);
HistoryOrderVo historyOrder(Long orderId, String tableCode);

View File

@@ -0,0 +1,16 @@
package com.czg.order.service;
import com.mybatisflex.core.service.IService;
import com.czg.order.entity.ShopOrderStatistic;
/**
* 服务层。
*
* @author zs
* @since 2025-03-07
*/
public interface ShopOrderStatisticService extends IService<ShopOrderStatistic> {
void statistic();
}

View File

@@ -0,0 +1,16 @@
package com.czg.order.service;
import com.mybatisflex.core.service.IService;
import com.czg.order.entity.ShopProdStatistic;
/**
* 服务层。
*
* @author zs
* @since 2025-03-07
*/
public interface ShopProdStatisticService extends IService<ShopProdStatistic> {
void statistic();
}

View File

@@ -1,8 +1,8 @@
package com.czg.account.service;
package com.czg.order.service;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
import com.czg.account.entity.ShopTableOrderStatistic;
import com.czg.order.entity.ShopTableOrderStatistic;
import java.math.BigDecimal;
@@ -10,10 +10,9 @@ import java.math.BigDecimal;
* 台桌订单统计表 服务层
*
* @author zs
* @since 2025-03-03
* @since 2025-03-07
*/
public interface ShopTableOrderStatisticService extends IService<ShopTableOrderStatistic> {
Page<ShopTableOrderStatistic> summary(Long shopId, String startTime, String endTime);
/**
@@ -25,4 +24,6 @@ public interface ShopTableOrderStatisticService extends IService<ShopTableOrderS
* @return 是否成功
*/
boolean addInfo(long shopId, long tableId, long count, BigDecimal amount);
void statistic();
}

View File

@@ -0,0 +1,18 @@
package com.czg.order.vo;
import com.czg.order.entity.OrderInfo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
import java.util.Map;
/**
* @author ww
* @description
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class HistoryOrderPrintVo extends OrderInfo {
private Map<String, List<OrderDetailPrintVo>> detailMap;
}

View File

@@ -0,0 +1,23 @@
package com.czg.order.vo;
import com.czg.order.entity.OrderDetail;
import lombok.*;
import java.io.Serial;
import java.io.Serializable;
/**
* 订单详情 实体类。
*
* @author ww
* @since 2025-02-14
*/
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OrderDetailPrintVo extends OrderDetail implements Serializable{
private Long categoryId;
}

View File

@@ -171,6 +171,7 @@ public class CzgPayUtils {
// 获取响应体
String respStr = resp.body();
if (StrUtil.isNotEmpty(respStr)) {
log.info("超掌柜交易请求响应元数据,{}", respStr);
CzgBaseRespParams respParams = JSONObject.parseObject(respStr, CzgBaseRespParams.class);
log.info("超掌柜交易请求响应,{}", respParams);

View File

@@ -1,11 +1,10 @@
package com.czg.service.account.service.impl;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.CallQueue;
import com.czg.account.service.CallQueueService;
import com.czg.service.account.mapper.CallQueueMapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;
/**
* 叫号排号队列表 服务层实现。
@@ -13,7 +12,6 @@ import org.springframework.stereotype.Service;
* @author zs
* @since 2025-02-21
*/
@Service
@DubboService
public class CallQueueServiceImpl extends ServiceImpl<CallQueueMapper, CallQueue> implements CallQueueService{

View File

@@ -12,6 +12,7 @@ import com.czg.config.RedisCst;
import com.czg.exception.ApiNotPrintException;
import com.czg.resp.CzgResult;
import com.czg.service.account.mapper.CallQueueMapper;
import com.czg.service.account.mapper.CallTableMapper;
import com.czg.service.account.util.FunUtil;
import com.czg.system.dto.SysParamsDTO;
import com.czg.system.service.SysParamsService;
@@ -20,15 +21,16 @@ import com.czg.utils.PageUtil;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.service.account.mapper.CallTableMapper;
import jakarta.annotation.Resource;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import java.io.ByteArrayOutputStream;
import java.util.*;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@@ -38,10 +40,9 @@ import java.util.stream.Collectors;
* @author zs
* @since 2025-02-21
*/
@Service
@DubboService
public class CallTableServiceImpl extends ServiceImpl<CallTableMapper, CallTable> implements CallTableService {
// @DubboReference
@DubboReference
private SysParamsService sysParamsService;
@Resource

View File

@@ -1,11 +1,10 @@
package com.czg.service.account.service.impl;
import com.czg.service.account.mapper.PlatformDictTypeMapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.PlatformDictType;
import com.czg.account.service.PlatformDictTypeService;
import com.czg.service.account.mapper.PlatformDictTypeMapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;
/**
* 平台配置类型 服务层实现。
@@ -14,7 +13,6 @@ import org.springframework.stereotype.Service;
* @since 2025-02-28
*/
@DubboService
@Service
public class PlatformDictTypeServiceImpl extends ServiceImpl<PlatformDictTypeMapper, PlatformDictType> implements PlatformDictTypeService{
}

View File

@@ -5,7 +5,6 @@ import com.czg.account.service.PointsBasicSettingService;
import com.czg.service.account.mapper.PointsBasicSettingMapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;
/**
* 积分基本设置 服务层实现。
@@ -13,7 +12,6 @@ import org.springframework.stereotype.Service;
* @author ww
* @since 2025-02-20
*/
@Service
@DubboService
public class PointsBasicSettingServiceImpl extends ServiceImpl<PointsBasicSettingMapper, PointsBasicSetting> implements PointsBasicSettingService{

View File

@@ -5,14 +5,13 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.czg.account.dto.print.PrinterAddDTO;
import com.czg.account.dto.print.PrinterEditDTO;
import com.czg.exception.ApiNotPrintException;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.PrintMachine;
import com.czg.account.service.PrintMachineService;
import com.czg.exception.ApiNotPrintException;
import com.czg.service.account.mapper.PrintMachineMapper;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;
/**
* 打印机设备 服务层实现。
@@ -20,7 +19,6 @@ import org.springframework.stereotype.Service;
* @author zs
* @since 2025-02-20
*/
@Service
@DubboService
public class PrintMachineServiceImpl extends ServiceImpl<PrintMachineMapper, PrintMachine> implements PrintMachineService{

View File

@@ -49,7 +49,7 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
private ShopUserService shopUserService;
@Resource
private ShopInfoService shopInfoService;
@DubboReference
@Resource
private ProductService productService;
@Override

View File

@@ -28,7 +28,6 @@ import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
@@ -41,7 +40,6 @@ import java.util.stream.Collectors;
* @author Administrator
*/
@DubboService
@Service
@CacheConfig(cacheNames = "shopInfo")
public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> implements ShopInfoService {
@Resource

View File

@@ -1,57 +0,0 @@
package com.czg.service.account.service.impl;
import cn.hutool.core.date.DateUtil;
import com.czg.config.RedisCst;
import com.czg.service.account.util.FunUtil;
import com.czg.utils.PageUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.ShopTableOrderStatistic;
import com.czg.account.service.ShopTableOrderStatisticService;
import com.czg.service.account.mapper.ShopTableOrderStatisticMapper;
import jakarta.annotation.Resource;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Calendar;
/**
* 台桌订单统计表 服务层实现。
*
* @author zs
* @since 2025-03-03
*/
@Service
public class ShopTableOrderStatisticServiceImpl extends ServiceImpl<ShopTableOrderStatisticMapper, ShopTableOrderStatistic> implements ShopTableOrderStatisticService{
@Resource
private FunUtil funUtil;
@Override
public Page<ShopTableOrderStatistic> summary(Long shopId, String startTime, String endTime) {
Page<Object> page = PageUtil.buildPage();
PageHelper.startPage(Math.toIntExact(page.getPageNumber()),Math.toIntExact(page.getPageSize()));
return PageUtil.convert(new PageInfo<>(mapper.selectSummary(shopId, startTime, endTime)));
}
@Override
public boolean addInfo(long shopId, long tableId, long count, BigDecimal amount) {
return funUtil.runFunAndCheckKey(() -> {
ShopTableOrderStatistic statistic = getOne(new QueryWrapper().eq(ShopTableOrderStatistic::getShopId, shopId).eq(ShopTableOrderStatistic::getTableId, tableId)
.eq(ShopTableOrderStatistic::getCreateDay, DateUtil.date().toDateStr()));
if (statistic == null) {
statistic = new ShopTableOrderStatistic();
statistic.setShopId(shopId);
statistic.setTableId(tableId);
statistic.setCreateDay(DateUtil.date().toSqlDate());
statistic.setOrderCount(count);
statistic.setOrderAmount(amount);
save(statistic);
}
return mapper.incrInfo(shopId, tableId, count, amount, DateUtil.date().toDateStr());
}, RedisCst.getLockKey("add_table_order_statistic", shopId, tableId));
}
}

View File

@@ -6,7 +6,10 @@ import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.czg.account.dto.shopuser.*;
import com.czg.account.entity.*;
import com.czg.account.service.*;
import com.czg.account.service.ShopActivateCouponRecordService;
import com.czg.account.service.ShopUserFlowService;
import com.czg.account.service.ShopUserService;
import com.czg.account.service.UserInfoService;
import com.czg.config.RedisCst;
import com.czg.exception.ApiNotPrintException;
import com.czg.resp.CzgResult;
@@ -25,7 +28,6 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
@@ -39,7 +41,6 @@ import java.math.RoundingMode;
* @since 2025-02-08
*/
@DubboService
@Service
public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> implements ShopUserService {
@DubboReference
private SysParamsService sysParamsService;

View File

@@ -16,6 +16,7 @@ import com.czg.sa.MyStpLogic;
import com.czg.sa.StpKit;
import com.czg.service.account.util.AlipayUtil;
import com.czg.service.account.util.WechatAuthUtil;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.C;
import org.springframework.stereotype.Service;
@@ -25,6 +26,7 @@ import javax.annotation.Resource;
* @author Administrator
*/
@Service
@Slf4j
public class UserAuthorizationServiceImpl implements UserAuthorizationService {
@Resource
private WechatAuthUtil wechatAuthUtil;
@@ -35,11 +37,12 @@ public class UserAuthorizationServiceImpl implements UserAuthorizationService {
@Override
public String getOpenId(String code, String source) {
log.info(code);
String openId;
if (UserAuthSourceEnum.WECHAT.getValue().equals(source)) {
openId = wechatAuthUtil.getSessionKeyOrOpenId(code);
openId = wechatAuthUtil.getAccountOpenId(code);
}else {
openId = alipayUtil.getOpenId(code);
openId = alipayUtil.getOpenId(code, true);
}
return openId;
}
@@ -50,7 +53,7 @@ public class UserAuthorizationServiceImpl implements UserAuthorizationService {
UserInfo userInfo;
String openId;
if (UserAuthSourceEnum.WECHAT.getValue().equals(userAuthorizationLoginDTO.getSource())) {
openId = wechatAuthUtil.getSessionKeyOrOpenId(userAuthorizationLoginDTO.getCode());
openId = wechatAuthUtil.getSessionKeyOrOpenId(userAuthorizationLoginDTO.getCode(), false);
userInfo = userInfoService.queryChain().eq(UserInfo::getWechatOpenId, openId).one();
userInfo = userInfo == null ? new UserInfo() : userInfo;
if (StrUtil.isNotBlank(userAuthorizationLoginDTO.getRawData())) {
@@ -62,7 +65,7 @@ public class UserAuthorizationServiceImpl implements UserAuthorizationService {
}
userInfo.setWechatOpenId(openId);
} else {
openId = alipayUtil.getOpenId(userAuthorizationLoginDTO.getCode());
openId = alipayUtil.getOpenId(userAuthorizationLoginDTO.getCode(), false);
userInfo = userInfoService.queryChain().eq(UserInfo::getAlipayOpenId, openId).one();
userInfo = userInfo == null ? new UserInfo() : userInfo;
userInfo.setNickName("支付宝用户");

View File

@@ -32,6 +32,7 @@ public class AlipayUtil {
*/
@Value("${alipay.appId}")
private String appId;
/**
* 应用私钥
*/
@@ -48,30 +49,38 @@ public class AlipayUtil {
@Value("${alipay.encryptKey}")
private String encryptKey;
@Value("${alipay.account.appId}")
private String accountAppId;
@Value("${alipay.account.privateKey}")
private String accountPrivateKey;
@Value("${alipay.account.publicKey}")
private String accountPublicKey;
/**
* 创建支付宝客户端
* @return AlipayClient
*/
@SneakyThrows
public AlipayClient createClient() {
public AlipayClient createClient(boolean isAccount) {
AlipayConfig alipayConfig = new AlipayConfig();
//设置网关地址
alipayConfig.setServerUrl(serverUrl);
//设置应用ID
alipayConfig.setAppId(appId);
alipayConfig.setAppId(isAccount ? accountAppId : appId);
//设置应用私钥
alipayConfig.setPrivateKey(privateKey);
alipayConfig.setPrivateKey(isAccount ? accountPrivateKey : privateKey);
//设置支付宝公钥
alipayConfig.setAlipayPublicKey(alipayPublicKey);
alipayConfig.setAlipayPublicKey(isAccount ? accountPublicKey : alipayPublicKey);
return new DefaultAlipayClient(alipayConfig);
}
/**
* 获取支付宝用户的openId
* @param code 用户信息授权码
* @return openId
*/
public String getOpenId(String code){
public String getOpenId(String code, boolean isAccount){
AlipaySystemOauthTokenRequest req = new AlipaySystemOauthTokenRequest();
//SDK已经封装掉了公共参数这里只需要传入业务参数
req.setCode(code);
@@ -80,7 +89,7 @@ public class AlipayUtil {
//req.setBizContent(" {" + " \"primary_industry_name\":\"IT科技/IT软件与服务\"," + " \"primary_industry_code\":\"10001/20102\"," + " \"secondary_industry_code\":\"10001/20102\"," + " \"secondary_industry_name\":\"IT科技/IT软件与服务\"" + " }");
AlipaySystemOauthTokenResponse response;
try {
response = createClient().execute(req);
response = createClient(isAccount).execute(req);
}catch (Exception e){
log.error("获取支付宝用户信息失败", e);
throw new RuntimeException(e);

View File

@@ -21,10 +21,16 @@ public class WechatAuthUtil {
@Value("${wx.appId}")
private String appId;
@Value("${wx.secrete}")
private String secrete;
@Value("${wx.account.appId}")
private String accountAppId;
@Value("${wx.account.secrete}")
private String accountSecrete;
static LinkedHashMap<String,String> linkedHashMap=new LinkedHashMap<>();
static {
@@ -41,14 +47,33 @@ public class WechatAuthUtil {
}
public String getSessionKeyOrOpenId(String code) {
public String getAccountOpenId(String code) {
String requestUrl = "https://api.weixin.qq.com/sns/oauth2/access_token?";
Map<String, Object> requestUrlParam = new HashMap<>();
// https://mp.weixin.qq.com/wxopen/devprofile?action=get_profile&token=164113089&lang=zh_CN
//小程序appId
requestUrlParam.put("appid", accountAppId);
//小程序secret
requestUrlParam.put("secret", accountSecrete);
//小程序端返回的code
requestUrlParam.put("code", code);
//默认参数
requestUrlParam.put("grant_type", "authorization_code");
log.info("微信获取openid请求报文{}", requestUrlParam);
//发送post请求读取调用微信接口获取openid用户唯一标识
String resp = HttpUtil.post(requestUrl, requestUrlParam);
log.info("响应报文{}", resp);
return JSONObject.parseObject(resp).getString("openid");
}
public String getSessionKeyOrOpenId(String code, boolean isAccount) {
String requestUrl = "https://api.weixin.qq.com/sns/jscode2session";
Map<String, Object> requestUrlParam = new HashMap<>();
// https://mp.weixin.qq.com/wxopen/devprofile?action=get_profile&token=164113089&lang=zh_CN
//小程序appId
requestUrlParam.put("appid", appId);
requestUrlParam.put("appid", isAccount ? accountAppId : appId);
//小程序secret
requestUrlParam.put("secret", secrete);
requestUrlParam.put("secret", isAccount ? accountSecrete : secrete);
//小程序端返回的code
requestUrlParam.put("js_code", code);
//默认参数

View File

@@ -1,5 +1,6 @@
package com.czg.service.order.mapper;
import com.czg.order.vo.OrderDetailPrintVo;
import com.mybatisflex.core.BaseMapper;
import com.czg.order.entity.OrderDetail;
import org.apache.ibatis.annotations.Param;
@@ -14,4 +15,7 @@ import java.util.List;
*/
public interface OrderDetailMapper extends BaseMapper<OrderDetail> {
void createOrderDetails(@Param("orderId") Long orderId,@Param("orderDetails") List<OrderDetail> orderDetails);
List<OrderDetailPrintVo> getOrderDetailPrint(Long orderId);
}

View File

@@ -3,6 +3,7 @@ package com.czg.service.order.mapper;
import com.czg.account.vo.HandoverCategoryListVo;
import com.czg.account.vo.HandoverProductListVo;
import com.czg.order.entity.OrderInfo;
import com.czg.order.vo.OrderDetailPrintVo;
import com.mybatisflex.core.BaseMapper;
import java.math.BigDecimal;

View File

@@ -0,0 +1,14 @@
package com.czg.service.order.mapper;
import com.mybatisflex.core.BaseMapper;
import com.czg.order.entity.ShopOrderStatistic;
/**
* 映射层。
*
* @author zs
* @since 2025-03-07
*/
public interface ShopOrderStatisticMapper extends BaseMapper<ShopOrderStatistic> {
}

View File

@@ -0,0 +1,14 @@
package com.czg.service.order.mapper;
import com.mybatisflex.core.BaseMapper;
import com.czg.order.entity.ShopProdStatistic;
/**
* 映射层。
*
* @author zs
* @since 2025-03-07
*/
public interface ShopProdStatisticMapper extends BaseMapper<ShopProdStatistic> {
}

View File

@@ -0,0 +1,21 @@
package com.czg.service.order.mapper;
import com.mybatisflex.core.BaseMapper;
import com.czg.order.entity.ShopTableOrderStatistic;
import java.math.BigDecimal;
import java.util.List;
/**
* 台桌订单统计表 映射层。
*
* @author zs
* @since 2025-03-07
*/
public interface ShopTableOrderStatisticMapper extends BaseMapper<ShopTableOrderStatistic> {
List<ShopTableOrderStatistic> selectSummary(Long shopId, String startTime, String endTime);
boolean incrInfo(long shopId, long tableId, long count, BigDecimal amount, String dateStr);
}

View File

@@ -1,11 +1,11 @@
package com.czg.service.order.service.impl;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.order.entity.OrderDetail;
import com.czg.order.service.OrderDetailService;
import com.czg.order.vo.OrderDetailPrintVo;
import com.czg.service.order.mapper.OrderDetailMapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -15,12 +15,16 @@ import java.util.List;
* @author ww
* @since 2025-02-13
*/
@Service
@DubboService
public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailMapper, OrderDetail> implements OrderDetailService{
public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailMapper, OrderDetail> implements OrderDetailService {
@Override
public void createOrderDetails(Long orderId, List<OrderDetail> orderDetails) {
getMapper().createOrderDetails(orderId, orderDetails);
}
@Override
public List<OrderDetailPrintVo> getOrderDetailPrint(Long orderId) {
return getMapper().getOrderDetailPrint(orderId);
}
}

View File

@@ -20,7 +20,6 @@ import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
@@ -33,7 +32,6 @@ import java.util.*;
* @since 2025-02-28 11:29
*/
@DubboService
@Service
@Slf4j
public class OrderInfoRpcServiceImpl implements OrderInfoRpcService {

View File

@@ -26,9 +26,7 @@ import com.czg.order.service.CashierCartService;
import com.czg.order.service.OrderDetailService;
import com.czg.order.service.OrderInfoService;
import com.czg.order.service.OrderPaymentService;
import com.czg.order.vo.HistoryOrderVo;
import com.czg.order.vo.OrderDetailSmallVO;
import com.czg.order.vo.OrderInfoVo;
import com.czg.order.vo.*;
import com.czg.resp.CzgResult;
import com.czg.service.RedisService;
import com.czg.service.order.enums.OrderStatusEnums;
@@ -36,6 +34,7 @@ import com.czg.service.order.mapper.OrderInfoMapper;
import com.czg.utils.AssertUtil;
import com.czg.utils.CzgStrUtils;
import com.czg.utils.PageUtil;
import com.mybatisflex.core.BaseMapper;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.update.UpdateChain;
@@ -134,6 +133,24 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
return CzgResult.success(historyOrder(orderId, null));
}
@Override
public CzgResult<HistoryOrderPrintVo> getOrderByIdPrint(Long orderId) {
HistoryOrderPrintVo historyOrderVo = getOneAs(new QueryWrapper()
.eq(OrderInfo::getId, orderId), HistoryOrderPrintVo.class);
List<OrderDetailPrintVo> orderDetails = orderDetailService.getOrderDetailPrint(orderId);
Map<String, List<OrderDetailPrintVo>> resultMap = new HashMap<>();
// 遍历订单详情列表
for (OrderDetailPrintVo orderDetail : orderDetails) {
orderDetail.initGift();
// 获取当前订单详情的 placeNum
Integer placeNum = orderDetail.getPlaceNum();
// 检查 Map 中是否已经存在该 placeNum 对应的列表
resultMap.computeIfAbsent(placeNum.toString(), k -> new ArrayList<>()).add(orderDetail);
}
historyOrderVo.setDetailMap(resultMap);
return CzgResult.success(historyOrderVo);
}
@Override
public HistoryOrderVo historyOrder(Long orderId, String tableCode) {
if (orderId == null && StrUtil.isBlank(tableCode)) {
@@ -643,6 +660,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
private OrderInfo initOrderInfo(OrderInfoAddDTO param, ShopInfo shopInfo, ShopTable table) {
OrderInfo orderInfo = new OrderInfo();
if (param.getOrderId() != null) {
orderInfo.setUserId(param.getUserId());
orderInfo = getById(param.getOrderId());
if (!OrderStatusEnums.UNPAID.getCode().equals(orderInfo.getStatus())) {
throw new ValidateException("生成订单失败,订单已结束,请重新下单");
@@ -709,6 +727,9 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
} else {
orderInfo.setDiscountRatio(BigDecimal.ZERO);
}
if (orderInfo.getOrderAmount().compareTo(BigDecimal.ZERO) == 0) {
orderInfo.setStatus(OrderStatusEnums.DONE.getCode());
}
saveOrUpdate(orderInfo);
}

View File

@@ -42,6 +42,7 @@ import com.mybatisflex.core.update.UpdateChain;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotBlank;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -51,11 +52,15 @@ import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
/**
* @author ww
* @description
*/
@Slf4j
@Service
public class PayServiceImpl implements PayService {
@@ -99,9 +104,6 @@ public class PayServiceImpl implements PayService {
private OrderInfo checkPay(CheckOrderPay checkOrderPay) {
OrderInfo orderInfo = orderInfoService.checkOrderPay(checkOrderPay);
if (orderInfo.getOrderAmount().compareTo(BigDecimal.ZERO) == 0) {
orderInfoService.upOrderInfo(orderInfo, orderInfo.getOrderAmount(),
LocalDateTime.now(), null, PayEnums.CASH_PAY);
redisService.del(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId());
throw new PaySuccessException();
}
return orderInfo;
@@ -473,7 +475,7 @@ public class PayServiceImpl implements PayService {
shopUserService.updateMoney(shopUser.getShopId(), shopUserMoneyEditDTO);
userFlowService.updateRefund(inFlow.getId(), refPayParam.getRefAmount());
if (giftFlow != null) {
userFlowService.updateRefund( giftFlow.getId(), giftFlow.getAmount());
userFlowService.updateRefund(giftFlow.getId(), giftFlow.getAmount());
}
//移除优惠券
inRecordService.remove(QueryWrapper.create()

View File

@@ -0,0 +1,99 @@
package com.czg.service.order.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.czg.order.entity.OrderInfo;
import com.czg.order.service.OrderInfoService;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.order.entity.ShopOrderStatistic;
import com.czg.order.service.ShopOrderStatisticService;
import com.czg.service.order.mapper.ShopOrderStatisticMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
/**
* 服务层实现。
*
* @author zs
* @since 2025-03-07
*/
@Service
public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisticMapper, ShopOrderStatistic> implements ShopOrderStatisticService {
@Resource
private OrderInfoService orderInfoService;
@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<OrderInfo> orderInfos = orderInfoService.list(new QueryWrapper()
.ge(OrderInfo::getCreateTime, startOfDay)
.le(OrderInfo::getCreateTime, endOfDay)
.ne(OrderInfo::getStatus, "unpaid").ne(OrderInfo::getStatus, "cancelled"));
HashMap<Long, ShopOrderStatistic> countInfo = new HashMap<>();
for (OrderInfo item : orderInfos) {
ShopOrderStatistic statisticTask = countInfo.get(item.getShopId());
if (statisticTask == null) {
countInfo.put(item.getShopId(), statisticTask = new ShopOrderStatistic());
}
if ("refunding".equals(item.getStatus()) || "refund".equals(item.getStatus()) || "part-refund".equals(item.getStatus())) {
statisticTask.setRefundAmount(statisticTask.getRefundAmount().add(item.getRefundAmount()));
statisticTask.setRefundCount(statisticTask.getRefundCount() + 1);
if (item.getRefundAmount().compareTo(item.getPayAmount()) < 0) {
statisticTask.setSaleAmount(statisticTask.getSaleAmount().add(item.getPayAmount().subtract(item.getRefundAmount())));
}
} else {
statisticTask.setSaleCount(statisticTask.getSaleCount() + 1);
statisticTask.setSaleAmount(statisticTask.getSaleAmount().add(item.getPayAmount()));
}
switch (item.getPayType()) {
case "wechat-mini":
statisticTask.setWechatPayAmount(statisticTask.getWechatPayAmount().add(item.getPayAmount()));
statisticTask.setWechatPayCount(statisticTask.getWechatPayCount() + 1);
break;
case "main-scan", "back-scan":
statisticTask.setScanPayAmount(statisticTask.getScanPayAmount().add(item.getPayAmount()));
statisticTask.setScanPayCount(statisticTask.getScanPayCount() + 1);
break;
case "alipay-mini":
statisticTask.setAliPayAmount(statisticTask.getAliPayAmount().add(item.getPayAmount()));
statisticTask.setAliPayCount(statisticTask.getAliPayCount() + 1);
break;
case "vip-pay":
statisticTask.setMemberPayAmount(statisticTask.getMemberPayAmount().add(item.getPayAmount()));
statisticTask.setMemberPayCount(statisticTask.getMemberPayCount() + 1);
break;
case "credit-pay":
statisticTask.setCreditPayAmount(statisticTask.getCreditPayAmount().add(item.getPayAmount()));
statisticTask.setCreditPayCount(statisticTask.getCreditPayCount() + 1);
break;
case "cash-pay":
statisticTask.setCashPayAmount(statisticTask.getCashPayAmount().add(item.getPayAmount()));
statisticTask.setCashPayCount(statisticTask.getCashPayCount() + 1);
}
countInfo.forEach((shopId, info) -> {
ShopOrderStatistic statistic = getOne(new QueryWrapper().eq(ShopOrderStatistic::getShopId, shopId).eq(ShopOrderStatistic::getCreateDay, yesterday.toSqlDate()));
if (statistic == null) {
statistic = new ShopOrderStatistic();
}
BeanUtil.copyProperties(info, statistic);
saveOrUpdate(statistic);
});
}
}
}

View File

@@ -0,0 +1,91 @@
package com.czg.service.order.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.czg.order.entity.OrderDetail;
import com.czg.order.service.OrderDetailService;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.order.entity.ShopProdStatistic;
import com.czg.order.service.ShopProdStatisticService;
import com.czg.service.order.mapper.ShopProdStatisticMapper;
import jakarta.annotation.Resource;
import lombok.Data;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 服务层实现。
*
* @author zs
* @since 2025-03-07
*/
@Service
public class ShopProdStatisticServiceImpl extends ServiceImpl<ShopProdStatisticMapper, ShopProdStatistic> implements ShopProdStatisticService{
@Resource
private OrderDetailService orderDetailService;
@Data
private static class StatisticTask{
private BigDecimal successCount = BigDecimal.ZERO;
private BigDecimal successAmount = BigDecimal.ZERO;
private BigDecimal refundCount = BigDecimal.ZERO;
private BigDecimal refundAmount = BigDecimal.ZERO;
}
@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<OrderDetail> orderDetails = orderDetailService.list(new QueryWrapper()
.ge(OrderDetail::getCreateTime, startOfDay)
.le(OrderDetail::getCreateTime, endOfDay)
.ne(OrderDetail::getStatus, "wait-pay"));
HashMap<Long, Map<Long, StatisticTask>> countInfo = new HashMap<>();
for (OrderDetail item : orderDetails) {
Map<Long, StatisticTask> map = countInfo.computeIfAbsent(item.getShopId(), k -> new HashMap<>());
StatisticTask statisticTask = map.get(item.getProductId());
if (statisticTask == null) {
map.put(item.getProductId(), statisticTask = new StatisticTask());
}
if ("refunding".equals(item.getStatus()) || "refund".equals(item.getStatus()) || "part-refund".equals(item.getStatus())) {
statisticTask.setRefundAmount(statisticTask.getRefundAmount().add(item.getReturnAmount()));
statisticTask.setRefundCount(statisticTask.getRefundCount().add(item.getRefundNum()));
if (item.getReturnNum().compareTo(item.getNum()) < 0) {
statisticTask.setSuccessAmount(statisticTask.getSuccessAmount().add(item.getPayAmount().subtract(item.getReturnAmount())));
statisticTask.setSuccessCount(statisticTask.getSuccessCount().add(item.getNum().subtract(item.getReturnAmount())));
}
}else {
statisticTask.setSuccessCount(statisticTask.getSuccessCount().add(item.getNum()));
statisticTask.setSuccessAmount(statisticTask.getSuccessAmount().add(item.getPayAmount()));
}
}
countInfo.forEach((shopId, map) -> map.forEach((productId, statisticTask) -> {
ShopProdStatistic statistic = getOne(new QueryWrapper().eq(ShopProdStatistic::getShopId, shopId).eq(ShopProdStatistic::getCreateDay, yesterday.toSqlDate()));
if (statistic == null) {
statistic = new ShopProdStatistic();
statistic.setShopId(shopId);
statistic.setCreateDay(yesterday.toSqlDate());
}
statistic.setProdId(productId);
statistic.setSaleCount(statisticTask.getSuccessCount());
statistic.setSaleAmount(statisticTask.getSuccessAmount());
statistic.setRefundCount(statisticTask.getRefundCount());
statistic.setRefundAmount(statisticTask.getRefundAmount());
saveOrUpdate(statistic);
}));
}
}

View File

@@ -0,0 +1,116 @@
package com.czg.service.order.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.czg.config.RedisCst;
import com.czg.order.entity.OrderInfo;
import com.czg.order.service.OrderInfoService;
import com.czg.utils.PageUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.order.entity.ShopTableOrderStatistic;
import com.czg.order.service.ShopTableOrderStatisticService;
import com.czg.service.order.mapper.ShopTableOrderStatisticMapper;
import jakarta.annotation.Resource;
import lombok.Data;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
/**
* 台桌订单统计表 服务层实现。
*
* @author zs
* @since 2025-03-07
*/
@Service
public class ShopTableOrderStatisticServiceImpl extends ServiceImpl<ShopTableOrderStatisticMapper, ShopTableOrderStatistic> implements ShopTableOrderStatisticService{
@Resource
private OrderInfoService orderInfoService;
@Override
public Page<ShopTableOrderStatistic> summary(Long shopId, String startTime, String endTime) {
Page<Object> page = PageUtil.buildPage();
PageHelper.startPage(Math.toIntExact(page.getPageNumber()),Math.toIntExact(page.getPageSize()));
return PageUtil.convert(new PageInfo<>(mapper.selectSummary(shopId, startTime, endTime)));
}
@Override
public boolean addInfo(long shopId, long tableId, long count, BigDecimal amount) {
ShopTableOrderStatistic statistic = getOne(new QueryWrapper().eq(ShopTableOrderStatistic::getShopId, shopId).eq(ShopTableOrderStatistic::getTableId, tableId)
.eq(ShopTableOrderStatistic::getCreateDay, DateUtil.date().toDateStr()));
if (statistic == null) {
statistic = new ShopTableOrderStatistic();
statistic.setShopId(shopId);
statistic.setTableId(tableId);
statistic.setCreateDay(DateUtil.date().toSqlDate());
statistic.setOrderCount(count);
statistic.setOrderAmount(amount);
save(statistic);
}
return mapper.incrInfo(shopId, tableId, count, amount, DateUtil.date().toDateStr());
}
@Data
private static class StatisticTask{
private long successCount = 0;
private BigDecimal successAmount = BigDecimal.ZERO;
private long refundCount = 0;
private BigDecimal refundAmount = BigDecimal.ZERO;
}
@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<OrderInfo> orderInfos = orderInfoService.list(new QueryWrapper()
.ge(OrderInfo::getCreateTime, startOfDay)
.le(OrderInfo::getCreateTime, endOfDay)
.ne(OrderInfo::getStatus, "unpaid").ne(OrderInfo::getStatus, "cancelled"));
HashMap<Long, StatisticTask> countInfo = new HashMap<>();
for (OrderInfo item : orderInfos) {
StatisticTask statisticTask = countInfo.get(item.getShopId());
if (statisticTask == null) {
countInfo.put(item.getShopId(), statisticTask = new StatisticTask());
}
if ("refunding".equals(item.getStatus()) || "refund".equals(item.getStatus()) || "part-refund".equals(item.getStatus())) {
statisticTask.setRefundAmount(statisticTask.getRefundAmount().add(item.getRefundAmount()));
statisticTask.setRefundCount(statisticTask.getRefundCount() + 1);
if (item.getRefundAmount().compareTo(item.getPayAmount()) < 0) {
statisticTask.setSuccessAmount(statisticTask.getSuccessAmount().add(item.getPayAmount().subtract(item.getRefundAmount())));
}
}else {
statisticTask.setSuccessCount(statisticTask.getSuccessCount() + 1);
statisticTask.setSuccessAmount(statisticTask.getSuccessAmount().add(item.getPayAmount()));
}
}
countInfo.forEach((shopId, statisticTask) -> {
ShopTableOrderStatistic statistic = getOne(new QueryWrapper().eq(ShopTableOrderStatistic::getShopId, shopId).eq(ShopTableOrderStatistic::getCreateDay, yesterday.toSqlDate()));
if (statistic == null) {
statistic = new ShopTableOrderStatistic();
statistic.setShopId(shopId);
statistic.setTableId(0L);
statistic.setCreateDay(yesterday.toSqlDate());
}
statistic.setOrderCount(statisticTask.getSuccessCount());
statistic.setOrderAmount(statisticTask.getSuccessAmount());
statistic.setRefundCount(statisticTask.getRefundCount());
statistic.setRefundAmount(statisticTask.getRefundAmount());
saveOrUpdate(statistic);
});
}
}

View File

@@ -22,4 +22,10 @@
now(), now())
</foreach>
</insert>
<select id="getOrderDetailPrint" resultType="com.czg.order.vo.OrderDetailPrintVo">
select detail.*, product.category_id as categoryId
from tb_order_detail detail
left join tb_product product on product.id = detail.product_id
where order_id = #{orderId}
</select>
</mapper>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.czg.service.order.mapper.ShopOrderStatisticMapper">
</mapper>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.czg.service.order.mapper.ShopProdStatisticMapper">
</mapper>

View File

@@ -2,13 +2,13 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.czg.service.account.mapper.ShopTableOrderStatisticMapper">
<mapper namespace="com.czg.service.order.mapper.ShopTableOrderStatisticMapper">
<update id="incrInfo">
update tb_shop_table_order_statistic set order_count=order_count + #{count}, order_amount=order_amount + #{count}
where shop_id = #{shopId} and table_id = #{tableId} and create_day=#{date}
</update>
<select id="selectSummary" resultType="com.czg.account.entity.ShopTableOrderStatistic">
<select id="selectSummary" resultType="com.czg.order.entity.ShopTableOrderStatistic">
SELECT
a.table_id as tableId, b.name as name, sum(a.order_count) as orderCount, sum(a.order_amount) as orderAmount
FROM

View File

@@ -5,7 +5,6 @@ import com.czg.product.service.ProdSkuService;
import com.czg.service.product.mapper.ProdSkuMapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;
/**
* 商品SKU
@@ -13,7 +12,6 @@ import org.springframework.stereotype.Service;
* @author Tankaikai tankaikai@aliyun.com
* @since 1.0 2025-02-16
*/
@Service
@DubboService
public class ProdSkuServiceImpl extends ServiceImpl<ProdSkuMapper, ProdSku> implements ProdSkuService {

View File

@@ -25,7 +25,6 @@ import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
@@ -40,7 +39,6 @@ import java.util.Map;
* @since 2025-03-01 10:19
*/
@Slf4j
@Service
@DubboService
public class ProductRpcServiceImpl implements ProductRpcService {

View File

@@ -35,7 +35,6 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
@@ -57,7 +56,6 @@ import static com.czg.product.entity.table.ShopProdUnitTableDef.SHOP_PROD_UNIT;
*/
@Slf4j
@AllArgsConstructor
@Service
@DubboService
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements ProductService {