Commit cb4315f042e5a7e3d2980e37ef295656bd49e516

Authored by fengliang
1 parent 48c1b921

update:交易流水后端接口迁移

etrade-order/src/main/java/com/diligrp/etrade/order/api/OrderQueryController.java
... ... @@ -4,11 +4,13 @@ import cn.hutool.core.util.StrUtil;
4 4 import com.diligrp.etrade.core.domain.Message;
5 5 import com.diligrp.etrade.core.domain.PageMessage;
6 6 import com.diligrp.etrade.order.domain.*;
  7 +import com.diligrp.etrade.order.domain.xreport.BusinessFlowCO;
  8 +import com.diligrp.etrade.order.domain.xreport.BusinessFlowPageMessage;
  9 +import com.diligrp.etrade.order.domain.xreport.BusinessFlowVO;
7 10 import com.diligrp.etrade.order.exception.OrderErrorCode;
8 11 import com.diligrp.etrade.order.exception.OrderException;
9 12 import com.diligrp.etrade.order.service.OrderQueryService;
10 13 import com.diligrp.etrade.order.type.OrderState;
11   -import com.diligrp.etrade.order.type.OrderVerifyState;
12 14 import com.diligrp.etrade.order.util.ParameterDetection;
13 15 import com.github.pagehelper.Page;
14 16 import jakarta.annotation.Resource;
... ... @@ -16,10 +18,8 @@ import jakarta.validation.Valid;
16 18 import org.slf4j.Logger;
17 19 import org.slf4j.LoggerFactory;
18 20 import org.springframework.validation.BindingResult;
19   -import org.springframework.web.bind.annotation.RequestBody;
20   -import org.springframework.web.bind.annotation.RequestMapping;
21   -import org.springframework.web.bind.annotation.RequestMethod;
22   -import org.springframework.web.bind.annotation.RestController;
  21 +import org.springframework.validation.annotation.Validated;
  22 +import org.springframework.web.bind.annotation.*;
23 23  
24 24 import java.time.LocalDateTime;
25 25 import java.time.LocalTime;
... ... @@ -204,5 +204,14 @@ public class OrderQueryController {
204 204 LOGGER.info("查询支付时间段,{}:{}",orderQueryDto.getPayStartTime(),orderQueryDto.getPayEndTime());
205 205 LOGGER.info("查询创建时间段,{}:{}",orderQueryDto.getStartTime(),orderQueryDto.getEndTime());
206 206 }
  207 + /**
  208 + * 交易流水
  209 + *
  210 + * @param co
  211 + */
  212 + @PostMapping("businessFlow")
  213 + public BusinessFlowPageMessage<BusinessFlowVO> businessFlow(@Validated @RequestBody BusinessFlowCO co) {
  214 + return orderQueryService.businessFlow(co);
  215 + }
207 216  
208 217 }
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/configuration/Cent2KiloJsonSerializer.java 0 → 100644
  1 +package com.diligrp.etrade.order.configuration;
  2 +
  3 +import com.fasterxml.jackson.core.JsonGenerator;
  4 +import com.fasterxml.jackson.databind.JsonSerializer;
  5 +import com.fasterxml.jackson.databind.SerializerProvider;
  6 +
  7 +import java.io.IOException;
  8 +import java.math.BigDecimal;
  9 +import java.math.MathContext;
  10 +import java.math.RoundingMode;
  11 +import java.text.DecimalFormat;
  12 +
  13 +/**
  14 + * 克/分 - 斤/元
  15 + */
  16 +public class Cent2KiloJsonSerializer extends JsonSerializer<Long> {
  17 +
  18 + @Override
  19 + public void serialize(Long value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
  20 + if(null == value){
  21 + return;
  22 + }
  23 + BigDecimal ans = new BigDecimal(value).divide(new BigDecimal(200),new MathContext(20,RoundingMode.HALF_UP));
  24 +
  25 + DecimalFormat df = new DecimalFormat("#0.00");
  26 + gen.writeString(df.format(ans.doubleValue()));
  27 + }
  28 +}
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/dao/OrderQueryMapper.java
... ... @@ -2,6 +2,9 @@ package com.diligrp.etrade.order.dao;
2 2  
3 3 import com.diligrp.etrade.core.mybatis.MybatisMapperSupport;
4 4 import com.diligrp.etrade.order.domain.*;
  5 +import com.diligrp.etrade.order.domain.xreport.BusinessFlowCO;
  6 +import com.diligrp.etrade.order.domain.xreport.BusinessFlowSumVO;
  7 +import com.diligrp.etrade.order.domain.xreport.BusinessFlowVO;
5 8 import com.diligrp.etrade.order.model.Order;
6 9 import com.github.pagehelper.Page;
7 10 import org.apache.ibatis.annotations.Param;
... ... @@ -47,4 +50,18 @@ public interface OrderQueryMapper extends MybatisMapperSupport {
47 50 * @return
48 51 */
49 52 Integer queryOrderVerifyNumber(OrderQueryDto orderQueryDto);
  53 +
  54 + /**
  55 + * 查询流水
  56 + * @param co
  57 + * @return
  58 + */
  59 + List<BusinessFlowVO> queryBusinessFlow(BusinessFlowCO co);
  60 +
  61 + /**
  62 + * 查询流水总计
  63 + * @param co
  64 + * @return
  65 + */
  66 + BusinessFlowSumVO querySumBusinessFlow(BusinessFlowCO co);
50 67 }
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/domain/xreport/BusinessFlowCO.java 0 → 100644
  1 +package com.diligrp.etrade.order.domain.xreport;
  2 +
  3 +import jakarta.validation.constraints.NotNull;
  4 +
  5 +import java.io.Serializable;
  6 +import java.time.LocalDateTime;
  7 +import java.util.List;
  8 +
  9 +public class BusinessFlowCO extends ClientPageQueryCO implements Serializable {
  10 + /**
  11 + *商品
  12 + */
  13 + private List<Long> products;
  14 +
  15 + /**
  16 + *订单号
  17 + */
  18 + private String code;
  19 +
  20 + /**
  21 + *买方id
  22 + */
  23 + private Long buyerId;
  24 +
  25 + /**
  26 + *卖方id
  27 + */
  28 + private Long sellerId;
  29 +
  30 + /**
  31 + *货款区间起始
  32 + */
  33 + private Long lowLevel;
  34 +
  35 + /**
  36 + *货款区间结束
  37 + */
  38 + private Long highLevel;
  39 +
  40 + /**
  41 + *来源
  42 + */
  43 + private Long source;
  44 +
  45 + /**
  46 + * 开始时间
  47 + */
  48 + private LocalDateTime endSettleDateTime;
  49 +
  50 + /**
  51 + * 结束时间
  52 + */
  53 + private LocalDateTime startSettleDateTime;
  54 +
  55 + /**
  56 + *市场id
  57 + */
  58 + @NotNull
  59 + private Long marketId;
  60 +
  61 + public List<Long> getProducts() {
  62 + return products;
  63 + }
  64 +
  65 + public void setProducts(List<Long> products) {
  66 + this.products = products;
  67 + }
  68 +
  69 + public String getCode() {
  70 + return code;
  71 + }
  72 +
  73 + public void setCode(String code) {
  74 + this.code = code;
  75 + }
  76 +
  77 + public Long getBuyerId() {
  78 + return buyerId;
  79 + }
  80 +
  81 + public void setBuyerId(Long buyerId) {
  82 + this.buyerId = buyerId;
  83 + }
  84 +
  85 + public Long getSellerId() {
  86 + return sellerId;
  87 + }
  88 +
  89 + public void setSellerId(Long sellerId) {
  90 + this.sellerId = sellerId;
  91 + }
  92 +
  93 + public Long getLowLevel() {
  94 + return lowLevel;
  95 + }
  96 +
  97 + public void setLowLevel(Long lowLevel) {
  98 + this.lowLevel = lowLevel;
  99 + }
  100 +
  101 + public Long getHighLevel() {
  102 + return highLevel;
  103 + }
  104 +
  105 + public void setHighLevel(Long highLevel) {
  106 + this.highLevel = highLevel;
  107 + }
  108 +
  109 + public Long getSource() {
  110 + return source;
  111 + }
  112 +
  113 + public void setSource(Long source) {
  114 + this.source = source;
  115 + }
  116 +
  117 + public LocalDateTime getEndSettleDateTime() {
  118 + return endSettleDateTime;
  119 + }
  120 +
  121 + public void setEndSettleDateTime(LocalDateTime endSettleDateTime) {
  122 + this.endSettleDateTime = endSettleDateTime;
  123 + }
  124 +
  125 + public LocalDateTime getStartSettleDateTime() {
  126 + return startSettleDateTime;
  127 + }
  128 +
  129 + public void setStartSettleDateTime(LocalDateTime startSettleDateTime) {
  130 + this.startSettleDateTime = startSettleDateTime;
  131 + }
  132 +
  133 + public Long getMarketId() {
  134 + return marketId;
  135 + }
  136 +
  137 + public void setMarketId(Long marketId) {
  138 + this.marketId = marketId;
  139 + }
  140 +}
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/domain/xreport/BusinessFlowPageMessage.java 0 → 100644
  1 +package com.diligrp.etrade.order.domain.xreport;
  2 +
  3 +import com.diligrp.etrade.core.domain.PageMessage;
  4 +import com.diligrp.etrade.core.jackson.serializer.MoneyF2YJsonSerializer;
  5 +import com.diligrp.etrade.core.jackson.serializer.WeightK2JJsonSerializer;
  6 +import com.fasterxml.jackson.databind.annotation.JsonSerialize;
  7 +import com.github.pagehelper.PageInfo;
  8 +
  9 +import java.util.List;
  10 +
  11 +public class BusinessFlowPageMessage<T> extends PageMessage<T> {
  12 + /**
  13 + *订单商品总重量 单位斤
  14 + */
  15 + @JsonSerialize(using = WeightK2JJsonSerializer.class)
  16 + private Long totalProductWeight;
  17 +
  18 + /**
  19 + *订单商品件数 单位件
  20 + */
  21 + @JsonSerialize(using = MoneyF2YJsonSerializer.class)
  22 + private Long totalProductPieces;
  23 +
  24 + /**
  25 + * 产品总价
  26 + */
  27 + @JsonSerialize(using = MoneyF2YJsonSerializer.class)
  28 + private Long totalProductTotalPrice;
  29 +
  30 + /**
  31 + * 产品卖家总费用
  32 + */
  33 + @JsonSerialize(using = MoneyF2YJsonSerializer.class)
  34 + private Long totalProductSellerFee;
  35 +
  36 + public Long getTotalProductWeight() {
  37 + return totalProductWeight;
  38 + }
  39 +
  40 + public void setTotalProductWeight(Long totalProductWeight) {
  41 + this.totalProductWeight = totalProductWeight;
  42 + }
  43 +
  44 + public Long getTotalProductPieces() {
  45 + return totalProductPieces;
  46 + }
  47 +
  48 + public void setTotalProductPieces(Long totalProductPieces) {
  49 + this.totalProductPieces = totalProductPieces;
  50 + }
  51 +
  52 + public Long getTotalProductTotalPrice() {
  53 + return totalProductTotalPrice;
  54 + }
  55 +
  56 + public void setTotalProductTotalPrice(Long totalProductTotalPrice) {
  57 + this.totalProductTotalPrice = totalProductTotalPrice;
  58 + }
  59 +
  60 + public Long getTotalProductSellerFee() {
  61 + return totalProductSellerFee;
  62 + }
  63 +
  64 + public void setTotalProductSellerFee(Long totalProductSellerFee) {
  65 + this.totalProductSellerFee = totalProductSellerFee;
  66 + }
  67 +
  68 + public static <T> BusinessFlowPageMessage<T> success(PageInfo<?> pageInfo, List<T> data) {
  69 + BusinessFlowPageMessage<T> page = new BusinessFlowPageMessage<>();
  70 + page.setCode(CODE_SUCCESS);
  71 + page.setTotal(pageInfo.getTotal());
  72 + page.setData(data);
  73 + page.setMessage(MSG_SUCCESS);
  74 + return page;
  75 + }
  76 +}
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/domain/xreport/BusinessFlowSumVO.java 0 → 100644
  1 +package com.diligrp.etrade.order.domain.xreport;
  2 +
  3 +import java.io.Serializable;
  4 +
  5 +public class BusinessFlowSumVO implements Serializable {
  6 + /**
  7 + *订单商品总重量 单位斤
  8 + */
  9 + private Long totalProductWeight;
  10 +
  11 + /**
  12 + *订单商品件数 单位件
  13 + */
  14 + private Long totalProductPieces;
  15 +
  16 + /**
  17 + * 产品总价
  18 + */
  19 + private Long totalProductTotalPrice;
  20 + /**
  21 + * 产品卖家总费用
  22 + */
  23 + private Long totalProductSellerFee;
  24 +
  25 + public Long getTotalProductWeight() {
  26 + return totalProductWeight;
  27 + }
  28 +
  29 + public void setTotalProductWeight(Long totalProductWeight) {
  30 + this.totalProductWeight = totalProductWeight;
  31 + }
  32 +
  33 + public Long getTotalProductPieces() {
  34 + return totalProductPieces;
  35 + }
  36 +
  37 + public void setTotalProductPieces(Long totalProductPieces) {
  38 + this.totalProductPieces = totalProductPieces;
  39 + }
  40 +
  41 + public Long getTotalProductTotalPrice() {
  42 + return totalProductTotalPrice;
  43 + }
  44 +
  45 + public void setTotalProductTotalPrice(Long totalProductTotalPrice) {
  46 + this.totalProductTotalPrice = totalProductTotalPrice;
  47 + }
  48 +
  49 + public Long getTotalProductSellerFee() {
  50 + return totalProductSellerFee;
  51 + }
  52 +
  53 + public void setTotalProductSellerFee(Long totalProductSellerFee) {
  54 + this.totalProductSellerFee = totalProductSellerFee;
  55 + }
  56 +}
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/domain/xreport/BusinessFlowVO.java 0 → 100644
  1 +package com.diligrp.etrade.order.domain.xreport;
  2 +
  3 +import com.diligrp.etrade.core.jackson.serializer.MoneyF2YJsonSerializer;
  4 +import com.diligrp.etrade.core.jackson.serializer.WeightK2JJsonSerializer;
  5 +import com.diligrp.etrade.order.configuration.Cent2KiloJsonSerializer;
  6 +import com.fasterxml.jackson.databind.annotation.JsonSerialize;
  7 +
  8 +import java.io.Serializable;
  9 +import java.time.LocalDateTime;
  10 +
  11 +public class BusinessFlowVO implements Serializable {
  12 + /**
  13 + * 自增主键
  14 + */
  15 + private Long id;
  16 +
  17 + /**
  18 + * 订单编码(全局唯一)
  19 + */
  20 + private String code;
  21 + /**
  22 + * 买家客户编码
  23 + */
  24 + private String buyerCode;
  25 + /**
  26 + * 买家编号
  27 + */
  28 + private Long buyerId;
  29 +
  30 + /**
  31 + * 买方名称
  32 + */
  33 + private String buyerName;
  34 +
  35 + /**
  36 + * 买方卡号
  37 + */
  38 + private String buyerCardNo;
  39 +
  40 + /**
  41 + * 店铺收益卡号
  42 + */
  43 + private String shopCardNo;
  44 + /**
  45 + * 商店客户id
  46 + */
  47 + private Long shopCustomerId;
  48 +
  49 + /** 商品名称 */
  50 + private String productName;
  51 +
  52 + /**
  53 + *订单商品总重量 单位斤
  54 + */
  55 + @JsonSerialize(using = WeightK2JJsonSerializer.class)
  56 + private Long productWeight;
  57 +
  58 + /**
  59 + *订单商品件数 单位件
  60 + */
  61 + @JsonSerialize(using = MoneyF2YJsonSerializer.class)
  62 + private Long productPieces;
  63 +
  64 + /**
  65 + *订单商品件重单位 斤
  66 + */
  67 + @JsonSerialize(using = WeightK2JJsonSerializer.class)
  68 + private Long productPieceWeight;
  69 +
  70 + /**
  71 + * 产品单件价格
  72 + */
  73 + @JsonSerialize(using = MoneyF2YJsonSerializer.class)
  74 + private Long productPiecePrice;
  75 +
  76 + /**
  77 + * 订单商品交易类型(1、按重方式,2、按件方式)
  78 + *
  79 + */
  80 + private Integer productTradeType;
  81 +
  82 + /**
  83 + * 商品重量单价 元/斤
  84 + *
  85 + */
  86 + @JsonSerialize(using = Cent2KiloJsonSerializer.class)
  87 + private Long productPrice;
  88 +
  89 + /**
  90 + * 支付完成时间
  91 + */
  92 + private LocalDateTime payTime;
  93 +
  94 + /**
  95 + * 产品总价
  96 + */
  97 + @JsonSerialize(using = MoneyF2YJsonSerializer.class)
  98 + private Long productTotalPrice;
  99 +
  100 + /**
  101 + * 产品销售商费用
  102 + */
  103 + @JsonSerialize(using = MoneyF2YJsonSerializer.class)
  104 + private Long productSellerFee;
  105 +
  106 + /**
  107 + * 卖家代码
  108 + */
  109 + private String sellerCode;
  110 + /**
  111 + * 卖家卡号
  112 + */
  113 + private String sellerCardNo;
  114 +
  115 + /**
  116 + * 卖方店员名称
  117 + */
  118 + private String sellerName;
  119 +
  120 + public Long getId() {
  121 + return id;
  122 + }
  123 +
  124 + public void setId(Long id) {
  125 + this.id = id;
  126 + }
  127 +
  128 + public String getCode() {
  129 + return code;
  130 + }
  131 +
  132 + public void setCode(String code) {
  133 + this.code = code;
  134 + }
  135 +
  136 + public String getBuyerCode() {
  137 + return buyerCode;
  138 + }
  139 +
  140 + public void setBuyerCode(String buyerCode) {
  141 + this.buyerCode = buyerCode;
  142 + }
  143 +
  144 + public String getBuyerName() {
  145 + return buyerName;
  146 + }
  147 +
  148 + public void setBuyerName(String buyerName) {
  149 + this.buyerName = buyerName;
  150 + }
  151 +
  152 + public String getBuyerCardNo() {
  153 + return buyerCardNo;
  154 + }
  155 +
  156 + public void setBuyerCardNo(String buyerCardNo) {
  157 + this.buyerCardNo = buyerCardNo;
  158 + }
  159 +
  160 + public String getSellerName() {
  161 + return sellerName;
  162 + }
  163 +
  164 + public void setSellerName(String sellerName) {
  165 + this.sellerName = sellerName;
  166 + }
  167 +
  168 + public String getShopCardNo() {
  169 + return shopCardNo;
  170 + }
  171 +
  172 + public void setShopCardNo(String shopCardNo) {
  173 + this.shopCardNo = shopCardNo;
  174 + }
  175 +
  176 + public Long getShopCustomerId() {
  177 + return shopCustomerId;
  178 + }
  179 +
  180 + public void setShopCustomerId(Long shopCustomerId) {
  181 + this.shopCustomerId = shopCustomerId;
  182 + }
  183 +
  184 + public String getProductName() {
  185 + return productName;
  186 + }
  187 +
  188 + public void setProductName(String productName) {
  189 + this.productName = productName;
  190 + }
  191 +
  192 + public Long getProductWeight() {
  193 + return productWeight;
  194 + }
  195 +
  196 + public void setProductWeight(Long productWeight) {
  197 + this.productWeight = productWeight;
  198 + }
  199 +
  200 + public Long getProductPieces() {
  201 + return productPieces;
  202 + }
  203 +
  204 + public void setProductPieces(Long productPieces) {
  205 + this.productPieces = productPieces;
  206 + }
  207 +
  208 + public Long getProductPieceWeight() {
  209 + return productPieceWeight;
  210 + }
  211 +
  212 + public void setProductPieceWeight(Long productPieceWeight) {
  213 + this.productPieceWeight = productPieceWeight;
  214 + }
  215 +
  216 + public Long getProductPiecePrice() {
  217 + return productPiecePrice;
  218 + }
  219 +
  220 + public void setProductPiecePrice(Long productPiecePrice) {
  221 + this.productPiecePrice = productPiecePrice;
  222 + }
  223 +
  224 + public Integer getProductTradeType() {
  225 + return productTradeType;
  226 + }
  227 +
  228 + public void setProductTradeType(Integer productTradeType) {
  229 + this.productTradeType = productTradeType;
  230 + }
  231 +
  232 + public Long getProductPrice() {
  233 + return productPrice;
  234 + }
  235 +
  236 + public void setProductPrice(Long productPrice) {
  237 + this.productPrice = productPrice;
  238 + }
  239 +
  240 + public LocalDateTime getPayTime() {
  241 + return payTime;
  242 + }
  243 +
  244 + public void setPayTime(LocalDateTime payTime) {
  245 + this.payTime = payTime;
  246 + }
  247 +
  248 + public Long getProductTotalPrice() {
  249 + return productTotalPrice;
  250 + }
  251 +
  252 + public void setProductTotalPrice(Long productTotalPrice) {
  253 + this.productTotalPrice = productTotalPrice;
  254 + }
  255 +
  256 + public String getSellerCode() {
  257 + return sellerCode;
  258 + }
  259 +
  260 + public void setSellerCode(String sellerCode) {
  261 + this.sellerCode = sellerCode;
  262 + }
  263 +
  264 + public String getSellerCardNo() {
  265 + return sellerCardNo;
  266 + }
  267 +
  268 + public void setSellerCardNo(String sellerCardNo) {
  269 + this.sellerCardNo = sellerCardNo;
  270 + }
  271 +
  272 + public Long getBuyerId() {
  273 + return buyerId;
  274 + }
  275 +
  276 + public void setBuyerId(Long buyerId) {
  277 + this.buyerId = buyerId;
  278 + }
  279 +
  280 + public Long getProductSellerFee() {
  281 + return productSellerFee;
  282 + }
  283 +
  284 + public void setProductSellerFee(Long productSellerFee) {
  285 + this.productSellerFee = productSellerFee;
  286 + }
  287 +}
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/domain/xreport/ClientPageQueryCO.java 0 → 100644
  1 +package com.diligrp.etrade.order.domain.xreport;
  2 +
  3 +import com.diligrp.etrade.core.domain.BasePageQuery;
  4 +
  5 +import java.io.Serializable;
  6 +
  7 +public abstract class ClientPageQueryCO extends BasePageQuery implements Serializable {
  8 +
  9 + /**
  10 + * 排序
  11 + */
  12 + private String sort;
  13 + /**
  14 + * 排序顺序
  15 + */
  16 + private String sortOrder;
  17 +
  18 +
  19 + public String getSort() {
  20 + return sort;
  21 + }
  22 +
  23 + public void setSort(String sort) {
  24 + this.sort = sort;
  25 + }
  26 +
  27 + public String getSortOrder() {
  28 + return sortOrder;
  29 + }
  30 +
  31 + public void setSortOrder(String sortOrder) {
  32 + this.sortOrder = sortOrder;
  33 + }
  34 +}
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/service/OrderQueryService.java
1 1 package com.diligrp.etrade.order.service;
2 2  
3 3 import com.diligrp.etrade.order.domain.*;
  4 +import com.diligrp.etrade.order.domain.xreport.BusinessFlowCO;
  5 +import com.diligrp.etrade.order.domain.xreport.BusinessFlowPageMessage;
  6 +import com.diligrp.etrade.order.domain.xreport.BusinessFlowVO;
4 7 import com.github.pagehelper.Page;
5 8  
6 9 import java.util.List;
... ... @@ -57,4 +60,11 @@ public interface OrderQueryService {
57 60 * @return
58 61 */
59 62 Integer queryOrderVerifyNumber(OrderQueryDto orderQueryDto);
  63 +
  64 + /**
  65 + * 订单流水查询
  66 + * @param co
  67 + * @return
  68 + */
  69 + BusinessFlowPageMessage<BusinessFlowVO> businessFlow(BusinessFlowCO co);
60 70 }
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/OrderQueryServiceImpl.java
... ... @@ -3,12 +3,18 @@ package com.diligrp.etrade.order.service.impl;
3 3 import cn.hutool.core.util.StrUtil;
4 4 import com.diligrp.etrade.order.dao.OrderQueryMapper;
5 5 import com.diligrp.etrade.order.domain.*;
  6 +import com.diligrp.etrade.order.domain.xreport.BusinessFlowCO;
  7 +import com.diligrp.etrade.order.domain.xreport.BusinessFlowPageMessage;
  8 +import com.diligrp.etrade.order.domain.xreport.BusinessFlowSumVO;
  9 +import com.diligrp.etrade.order.domain.xreport.BusinessFlowVO;
6 10 import com.diligrp.etrade.order.exception.OrderErrorCode;
7 11 import com.diligrp.etrade.order.exception.OrderException;
8 12 import com.diligrp.etrade.order.service.*;
9 13 import com.diligrp.etrade.order.type.*;
  14 +import com.diligrp.etrade.order.util.NumberTransform;
10 15 import com.github.pagehelper.Page;
11 16 import com.github.pagehelper.PageHelper;
  17 +import com.github.pagehelper.PageInfo;
12 18 import jakarta.annotation.Resource;
13 19 import org.apache.commons.lang3.ObjectUtils;
14 20 import org.slf4j.Logger;
... ... @@ -114,4 +120,37 @@ public class OrderQueryServiceImpl implements OrderQueryService {
114 120 }
115 121 return orderQueryMapper.queryOrderVerifyNumber(orderQueryDto);
116 122 }
  123 +
  124 + @Override
  125 + public BusinessFlowPageMessage<BusinessFlowVO> businessFlow(BusinessFlowCO co) {
  126 + PageHelper.startPage(co.getPageNo(), co.getPageSize());
  127 + List<BusinessFlowVO> list = orderQueryMapper.queryBusinessFlow(co);
  128 + BusinessFlowSumVO sumFlowVO = orderQueryMapper.querySumBusinessFlow(co);
  129 +// list.forEach(e->{
  130 +// CustomerDto customerDto = rpcExecutor.getByCustomerId(e.getShopCustomerId());
  131 +// e.setSellerName(customerDto.getName());
  132 +// e.setSellerCode(customerDto.getCode());
  133 +// e.setSellerCardNo(e.getShopCardNo());
  134 +// if (!org.springframework.util.ObjectUtils.isEmpty(e.getBuyerId())){
  135 +// CustomerDto buyer = rpcExecutor.getByCustomerId(e.getBuyerId());
  136 +// e.setBuyerName(buyer.getName());
  137 +// e.setBuyerCode(buyer.getCode());
  138 +// }
  139 +// });
  140 + PageInfo<BusinessFlowVO> pageInfo = new PageInfo<>(list);
  141 + BusinessFlowPageMessage<BusinessFlowVO> success = BusinessFlowPageMessage.success(pageInfo, list);
  142 + if (!org.springframework.util.ObjectUtils.isEmpty(sumFlowVO)) {
  143 + success.setTotalProductPieces(org.springframework.util.ObjectUtils.isEmpty(sumFlowVO.getTotalProductPieces()) ? NumberTransform.NUMBER_ZERO_LONG : sumFlowVO.getTotalProductPieces());
  144 + success.setTotalProductWeight(org.springframework.util.ObjectUtils.isEmpty(sumFlowVO.getTotalProductWeight()) ? NumberTransform.NUMBER_ZERO_LONG : sumFlowVO.getTotalProductWeight());
  145 + success.setTotalProductTotalPrice(org.springframework.util.ObjectUtils.isEmpty(sumFlowVO.getTotalProductTotalPrice()) ? NumberTransform.NUMBER_ZERO_LONG : sumFlowVO.getTotalProductTotalPrice());
  146 + success.setTotalProductSellerFee(org.springframework.util.ObjectUtils.isEmpty(sumFlowVO.getTotalProductSellerFee()) ? NumberTransform.NUMBER_ZERO_LONG : sumFlowVO.getTotalProductSellerFee());
  147 + } else {
  148 + success.setTotalProductPieces(NumberTransform.NUMBER_ZERO_LONG);
  149 + success.setTotalProductWeight(NumberTransform.NUMBER_ZERO_LONG);
  150 + success.setTotalProductTotalPrice(NumberTransform.NUMBER_ZERO_LONG);
  151 + success.setTotalProductSellerFee(NumberTransform.NUMBER_ZERO_LONG);
  152 + }
  153 +
  154 + return success;
  155 + }
117 156 }
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/util/NumberTransform.java
... ... @@ -27,4 +27,12 @@ public class NumberTransform {
27 27  
28 28 /** 版本号步长 */
29 29 public static Integer DEFAULT_VERSION_STEP = 1;
  30 +
  31 + public static final int NUMBER_ZERO = 0;
  32 + public static final long NUMBER_ZERO_LONG = 0;
  33 + public static final int NUMBER_ONE = 1;
  34 + public static final int NUMBER_TWO = 2;
  35 +
  36 + public static final int NUMBER_ONE_HUNDRED = 100;
  37 + public static final int NUMBER_ONE_THOUSAND = 1000;
30 38 }
... ...
etrade-order/src/main/resources/com/diligrp/etrade/dao/mapper/order/OrderQueryMapper.xml
... ... @@ -340,4 +340,146 @@
340 340 </if>
341 341 </where>
342 342 </select>
  343 + <select id="queryBusinessFlow" resultType="com.diligrp.etrade.order.domain.xreport.BusinessFlowVO"
  344 + parameterType="com.diligrp.etrade.order.domain.xreport.BusinessFlowCO">
  345 + SELECT
  346 + `code`
  347 + ,productPieces
  348 + ,payTime
  349 + ,productWeight
  350 + ,buyerName
  351 + ,buyerCode
  352 + ,sellerName
  353 + ,sellerCode
  354 + ,buyerId
  355 + ,productName
  356 + ,shopCardNo
  357 + ,shopCustomerId
  358 + ,productTradeType
  359 + ,buyerCardNo
  360 + ,id
  361 + ,productPieceWeight
  362 + ,productPiecePrice
  363 + ,productPrice
  364 + ,productTotalPrice
  365 + ,productSellerFee
  366 + FROM (
  367 + SELECT
  368 + o.code AS code
  369 + , og.product_pieces AS productPieces
  370 + , o.pay_time AS payTime
  371 + , og.product_weight AS productWeight
  372 + , o.buyer_name AS buyerName
  373 + , o.buyer_code AS buyerCode
  374 + , o.seller_name AS sellerName
  375 + , s.customer_code AS sellerCode
  376 + , o.buyer_id AS buyerId
  377 + , p.`alias` AS productName
  378 + , o.shop_card_no AS shopCardNo
  379 + , o.shop_customer_id AS shopCustomerId
  380 + , og.product_trade_type AS productTradeType
  381 + , o.buyer_card_no AS buyerCardNo
  382 + , og.id AS id
  383 + , og.product_piece_weight AS productPieceWeight
  384 + , og.product_piece_price AS productPiecePrice
  385 + , og.product_price AS productPrice
  386 + , og.product_total_price AS productTotalPrice
  387 + , og.product_seller_fee AS productSellerFee
  388 + FROM
  389 + `order_goods` og
  390 + LEFT JOIN `order` o ON o.id = og.order_id
  391 + LEFT JOIN `product` p ON og.product_id = p.id
  392 + LEFT JOIN `shop` s ON s.id = o.shop_id
  393 + WHERE
  394 + o.state = 3
  395 + AND og.state = 1
  396 + AND o.market_id = #{marketId}
  397 + <if test="products !=null and products.size() > 0 ">
  398 + and p.category_id in
  399 + <foreach item="item" index="index" collection="products" open="(" separator="," close=")">
  400 + #{item}
  401 + </foreach>
  402 + </if>
  403 + <if test="code !=null and code != ''">
  404 + and o.code = #{code}
  405 + </if>
  406 + <if test="buyerId !=null">
  407 + and o.buyer_id = #{buyerId}
  408 + </if>
  409 + <if test="sellerId !=null">
  410 + and o.shop_customer_id = #{sellerId}
  411 + </if>
  412 + <if test="source !=null">
  413 + and o.source = #{source}
  414 + </if>
  415 + <if test="lowLevel !=null">
  416 + and og.product_total_price <![CDATA[>= #{lowLevel}]]>
  417 + </if>
  418 + <if test="highLevel !=null">
  419 + and og.product_total_price <![CDATA[<= #{highLevel}]]>
  420 + </if>
  421 + <if test="startSettleDateTime !=null">
  422 + and o.pay_time <![CDATA[>= #{startSettleDateTime}]]>
  423 + </if>
  424 + <if test="endSettleDateTime !=null">
  425 + and o.pay_time <![CDATA[<= #{endSettleDateTime}]]>
  426 + </if>
  427 + ) t
  428 + <if test="sort != null and sort != '' and sortOrder != null and sortOrder != ''">
  429 + ORDER BY ${sort} ${sortOrder}
  430 + </if>
  431 + </select>
  432 + <select id="querySumBusinessFlow" resultType="com.diligrp.etrade.order.domain.xreport.BusinessFlowSumVO"
  433 + parameterType="com.diligrp.etrade.order.domain.xreport.BusinessFlowCO">
  434 + SELECT
  435 + SUM(IFNULL(productWeight,0)) AS totalProductWeight
  436 + ,SUM(IFNULL(productPieces,0)) AS totalProductPieces
  437 + ,SUM(IFNULL(productTotalPrice,0)) AS totalProductTotalPrice
  438 + ,SUM(IFNULL(productSellerFee,0)) AS totalProductSellerFee
  439 + FROM (
  440 + SELECT
  441 + og.product_weight AS productWeight
  442 + , og.product_pieces AS productPieces
  443 + , og.product_total_price AS productTotalPrice
  444 + , og.product_seller_fee AS productSellerFee
  445 + FROM
  446 + `order_goods` og
  447 + LEFT JOIN `order` o ON o.id = og.order_id
  448 + LEFT JOIN `product` p ON og.product_id = p.id
  449 + WHERE
  450 + o.state = 3
  451 + AND og.state = 1
  452 + AND o.market_id = #{marketId}
  453 + <if test="products !=null and products.size() > 0 ">
  454 + and p.category_id in
  455 + <foreach item="item" index="index" collection="products" open="(" separator="," close=")">
  456 + #{item}
  457 + </foreach>
  458 + </if>
  459 + <if test="code !=null and code != ''">
  460 + and o.code = #{code}
  461 + </if>
  462 + <if test="buyerId !=null">
  463 + and o.buyer_id = #{buyerId}
  464 + </if>
  465 + <if test="sellerId !=null">
  466 + and o.shop_customer_id = #{sellerId}
  467 + </if>
  468 + <if test="source !=null">
  469 + and o.source = #{source}
  470 + </if>
  471 + <if test="lowLevel !=null">
  472 + and og.product_total_price <![CDATA[>= #{lowLevel}]]>
  473 + </if>
  474 + <if test="highLevel !=null">
  475 + and og.product_total_price <![CDATA[<= #{highLevel}]]>
  476 + </if>
  477 + <if test="startSettleDateTime !=null">
  478 + and o.pay_time <![CDATA[>= #{startSettleDateTime}]]>
  479 + </if>
  480 + <if test="endSettleDateTime !=null">
  481 + and o.pay_time <![CDATA[<= #{endSettleDateTime}]]>
  482 + </if>
  483 + ) t
  484 + </select>
343 485 </mapper>
344 486 \ No newline at end of file
... ...