Jelajahi Sumber

添加账单和结算功能,加导出功能

Yangzw 9 bulan lalu
induk
melakukan
bad3ac72c3
53 mengubah file dengan 2083 tambahan dan 29 penghapusan
  1. 4 0
      feifan-module-distri/feifan-module-distri-api/src/main/java/cn/newfeifan/mall/module/distri/constant/DistriConstants.java
  2. 3 1
      feifan-module-distri/feifan-module-distri-api/src/main/java/cn/newfeifan/mall/module/distri/enums/ErrorCodeConstants.java
  3. 11 9
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/dailybill/DailyBillController.java
  4. 59 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/dailybill/excelvo/DailyBillExcelRespVO.java
  5. 10 3
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/dailybill/vo/DailyBillRespVO.java
  6. 93 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ordersettlement/OrderSettlementController.java
  7. 30 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ordersettlement/vo/OrderSettlementPageReqVO.java
  8. 31 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ordersettlement/vo/OrderSettlementRespVO.java
  9. 23 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ordersettlement/vo/OrderSettlementSaveReqVO.java
  10. 93 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ptsettlement/PtSettlementController.java
  11. 37 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ptsettlement/vo/PtSettlementPageReqVO.java
  12. 40 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ptsettlement/vo/PtSettlementRespVO.java
  13. 30 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ptsettlement/vo/PtSettlementSaveReqVO.java
  14. 95 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/shopsettlement/ShopSettlementController.java
  15. 42 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/shopsettlement/excelvo/ShopSettlementExcelRespVO.java
  16. 46 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/shopsettlement/vo/ShopSettlementPageReqVO.java
  17. 55 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/shopsettlement/vo/ShopSettlementRespVO.java
  18. 42 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/shopsettlement/vo/ShopSettlementSaveReqVO.java
  19. 29 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/convert/dailybill/DailyBillConvert.java
  20. 25 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/convert/shopsettlement/ShopSettlementConvert.java
  21. 38 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/dataobject/ordersettlement/OrderSettlementDO.java
  22. 48 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/dataobject/ptsettlement/PtSettlementDO.java
  23. 60 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/dataobject/shopsettlement/ShopSettlementDO.java
  24. 4 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/mysql/dailybill/DailyBillMapper.java
  25. 32 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/mysql/ordersettlement/OrderSettlementMapper.java
  26. 1 1
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/mysql/ptprofit/PtProfitMapper.java
  27. 1 1
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/mysql/ptprofitlog/PtProfitLogMapper.java
  28. 28 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/mysql/ptsettlement/PtSettlementMapper.java
  29. 41 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/mysql/shopsettlement/ShopSettlementMapper.java
  30. 2 1
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/dailybill/DailyBillService.java
  31. 12 2
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/dailybill/DailyBillServiceImpl.java
  32. 1 1
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/integral/IntegralServiceImpl.java
  33. 55 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/ordersettlement/OrderSettlementService.java
  34. 71 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/ordersettlement/OrderSettlementServiceImpl.java
  35. 1 1
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/ptprofitlog/PtProfitLogServiceImpl.java
  36. 55 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/ptsettlement/PtSettlementService.java
  37. 71 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/ptsettlement/PtSettlementServiceImpl.java
  38. 60 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/shopsettlement/ShopSettlementService.java
  39. 227 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/shopsettlement/ShopSettlementServiceImpl.java
  40. 8 0
      feifan-module-distri/feifan-module-distri-biz/src/main/resources/mapper/dailybill/DailyBillMapper.xml
  41. 1 1
      feifan-module-distri/feifan-module-distri-biz/src/main/resources/mapper/ptprofit/PtProfitMapper.xml
  42. 1 1
      feifan-module-distri/feifan-module-distri-biz/src/main/resources/mapper/ptprofitlog/PtProfitLogMapper.xml
  43. 12 0
      feifan-module-distri/feifan-module-distri-biz/src/main/resources/mapper/ptsettlement/PtSettlementMapper.xml
  44. 47 0
      feifan-module-distri/feifan-module-distri-biz/src/main/resources/mapper/shopsettlement/ShopSettlementMapper.xml
  45. 2 0
      feifan-module-mall/feifan-module-trade-api/src/main/java/cn/newfeifan/mall/module/trade/enums/DictTypeConstants.java
  46. 47 2
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/TradeOrderController.java
  47. 37 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/excelVO/DailyBillOrderRespVO.java
  48. 38 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/excelVO/SettlementOrderRespVO.java
  49. 3 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/vo/TradeOrderPageReqVO.java
  50. 220 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/vo/TradeOrderRespVO.java
  51. 49 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/convert/order/TradeOrderConvert.java
  52. 2 1
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/dal/mysql/order/TradeOrderMapper.java
  53. 10 4
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/order/TradeOrderQueryServiceImpl.java

+ 4 - 0
feifan-module-distri/feifan-module-distri-api/src/main/java/cn/newfeifan/mall/module/distri/constant/DistriConstants.java

@@ -6,6 +6,10 @@ public class DistriConstants {
     // ========== 分销信息商户信息 1-002-029-000 ==========
     public static final Integer PERCENT = 10000;//积分数据库中的值,比页面显示的值,大了此倍数
 
+    public static final Integer ONE_HUNDRED = 100;
+
+    public static final Integer MILLION = 1000000;      //百万倍
+
     // 数据库中,积分比金钱大的倍数,即钱转成积分要乘于此参数
     public static final Integer MONEY2INTEGRAL = PERCENT/100;
     // MONEY2INTEGRAL的BigDecimal版本

+ 3 - 1
feifan-module-distri/feifan-module-distri-api/src/main/java/cn/newfeifan/mall/module/distri/enums/ErrorCodeConstants.java

@@ -25,6 +25,8 @@ public interface ErrorCodeConstants {
     ErrorCode SHARE_LINK_NOT_EXISTS = new ErrorCode(1_003_031_001, "分享链接不存在");
     ErrorCode SHARE_LINK_REGISTER_NOT_EXISTS = new ErrorCode(1_003_031_002, "通过分享链接,新注册用户不存在");
     ErrorCode DAILY_BILL_NOT_EXISTS = new ErrorCode(1_003_031_003, "每日账单详细不存在");
-
+    ErrorCode SHOP_SETTLEMENT_NOT_EXISTS = new ErrorCode(1_003_031_004, "该结算单记录不存在");
+    ErrorCode PT_SETTLEMENT_NOT_EXISTS = new ErrorCode(1_003_031_005, "平台结算记录不存在");
+    ErrorCode ORDER_SETTLEMENT_NOT_EXISTS = new ErrorCode(1_003_031_005, "该结算订单二级表记录不存在");
 
 }

+ 11 - 9
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/dailybill/DailyBillController.java

@@ -6,9 +6,11 @@ import cn.newfeifan.mall.framework.common.pojo.PageResult;
 import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
 import cn.newfeifan.mall.framework.excel.core.util.ExcelUtils;
 import cn.newfeifan.mall.framework.operatelog.core.annotations.OperateLog;
+import cn.newfeifan.mall.module.distri.controller.admin.dailybill.excelvo.DailyBillExcelRespVO;
 import cn.newfeifan.mall.module.distri.controller.admin.dailybill.vo.DailyBillPageReqVO;
 import cn.newfeifan.mall.module.distri.controller.admin.dailybill.vo.DailyBillRespVO;
 import cn.newfeifan.mall.module.distri.controller.admin.dailybill.vo.DailyBillSaveReqVO;
+import cn.newfeifan.mall.module.distri.convert.dailybill.DailyBillConvert;
 import cn.newfeifan.mall.module.distri.dal.dataobject.dailybill.DailyBillDO;
 import cn.newfeifan.mall.module.distri.service.dailybill.DailyBillService;
 import io.swagger.v3.oas.annotations.Operation;
@@ -71,10 +73,10 @@ public class DailyBillController {
 
     @GetMapping("/page")
     @Operation(summary = "获得每日账单分页")
-//    @PreAuthorize("@ss.hasPermission('distri:daily-bill:query')")
+    @PreAuthorize("@ss.hasPermission('distri:daily-bill:query')")
     public CommonResult<PageResult<DailyBillRespVO>> getDailyBillPage(@Valid DailyBillPageReqVO pageReqVO) {
-        PageResult<DailyBillDO> pageResult = dailyBillService.getDailyBillPage(pageReqVO);
-        return success(BeanUtils.toBean(pageResult, DailyBillRespVO.class));
+        PageResult<DailyBillRespVO> pageResult = dailyBillService.getDailyBillPage(pageReqVO);
+        return success(pageResult);
     }
 
     @GetMapping("/export-excel")
@@ -82,16 +84,16 @@ public class DailyBillController {
     @PreAuthorize("@ss.hasPermission('distri:daily-bill:export')")
     @OperateLog(type = EXPORT)
     public void exportDailyBillExcel(@Valid DailyBillPageReqVO pageReqVO,
-              HttpServletResponse response) throws IOException {
+                                     HttpServletResponse response) throws IOException {
         pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
-        List<DailyBillDO> list = dailyBillService.getDailyBillPage(pageReqVO).getList();
+        List<DailyBillExcelRespVO> list = DailyBillConvert.INSTANCE.convertList(dailyBillService.getDailyBillPage(pageReqVO).getList());
         // 导出 Excel
-        ExcelUtils.write(response, "每日账单.xls", "数据", DailyBillRespVO.class,
-                        BeanUtils.toBean(list, DailyBillRespVO.class));
+        ExcelUtils.write(response, "每日账单.xls", "数据", DailyBillExcelRespVO.class,
+                list);
     }
 
-    @GetMapping("/getMerchant")
-    @Operation(summary = "获取商户每日账单")
+    @GetMapping("/CalcDailyBill")
+    @Operation(summary = "计算每日账单")
     @PreAuthorize("@ss.hasPermission('distri:daily-bill:delete')")
     public CommonResult<String> getMerchantDailyBill() {
         dailyBillService.caleDailyBill();

+ 59 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/dailybill/excelvo/DailyBillExcelRespVO.java

@@ -0,0 +1,59 @@
+package cn.newfeifan.mall.module.distri.controller.admin.dailybill.excelvo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDate;
+
+@Schema(description = "管理后台 - 每日账单 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class DailyBillExcelRespVO {
+    @Schema(description = "账单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "27497")
+    @ExcelProperty("账单编号")
+    private Long id;
+
+    @Schema(description = "金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "30486")
+    @ExcelProperty("金额")
+    private Double price;
+
+    @Schema(description = "确收金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "29815")
+    @ExcelProperty("确收金额")
+    private Double receivedPrice;
+
+    @Schema(description = "退款金额, 单位: 分", requiredMode = Schema.RequiredMode.REQUIRED, example = "11962")
+    @ExcelProperty("退款金额")
+    private Double refundPrice;
+
+    @Schema(description = "积分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("积分")
+    private Double integral;
+
+    @Schema(description = "确收积分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("确收积分")
+    private Double receivedIntegral;
+
+    @Schema(description = "退款积分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("退款积分")
+    private Double refundIntegral;
+
+    @Schema(description = "订单数,默认为0", requiredMode = Schema.RequiredMode.REQUIRED, example = "27164")
+    @ExcelProperty("订单数")
+    private Long orderCount;
+
+    @Schema(description = "店铺名称")
+    @ExcelProperty("店铺名称")
+    private String shopName;
+
+    @Schema(description = "商户名称")
+    @ExcelProperty("商户名称")
+    private String merchantName;
+
+    @Schema(description = "订单所属日期", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("账单日期")
+    private LocalDate orderCalcTime;
+    
+    
+}

+ 10 - 3
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/dailybill/vo/DailyBillRespVO.java

@@ -1,12 +1,11 @@
 package cn.newfeifan.mall.module.distri.controller.admin.dailybill.vo;
 
-import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
-import com.alibaba.excel.annotation.ExcelProperty;
 import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
+import lombok.*;
 
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import com.alibaba.excel.annotation.*;
 
 @Schema(description = "管理后台 - 每日账单 Response VO")
 @Data
@@ -33,6 +32,14 @@ public class DailyBillRespVO {
     @ExcelProperty("店铺ID")
     private Long shopId;
 
+    @Schema(description = "店铺名称")
+    @ExcelProperty("店铺名称")
+    private String shopName;
+
+    @Schema(description = "商户名称")
+    @ExcelProperty("商户名称")
+    private String merchantName;
+
     @Schema(description = "商户ID", example = "22961")
     @ExcelProperty("商户ID")
     private Long merchantId;

+ 93 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ordersettlement/OrderSettlementController.java

@@ -0,0 +1,93 @@
+package cn.newfeifan.mall.module.distri.controller.admin.ordersettlement;
+
+import cn.newfeifan.mall.framework.common.pojo.CommonResult;
+import cn.newfeifan.mall.framework.common.pojo.PageParam;
+import cn.newfeifan.mall.framework.common.pojo.PageResult;
+import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
+import cn.newfeifan.mall.framework.excel.core.util.ExcelUtils;
+import cn.newfeifan.mall.framework.operatelog.core.annotations.OperateLog;
+import cn.newfeifan.mall.module.distri.controller.admin.ordersettlement.vo.OrderSettlementPageReqVO;
+import cn.newfeifan.mall.module.distri.controller.admin.ordersettlement.vo.OrderSettlementRespVO;
+import cn.newfeifan.mall.module.distri.controller.admin.ordersettlement.vo.OrderSettlementSaveReqVO;
+import cn.newfeifan.mall.module.distri.dal.dataobject.ordersettlement.OrderSettlementDO;
+import cn.newfeifan.mall.module.distri.service.ordersettlement.OrderSettlementService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.io.IOException;
+import java.util.List;
+
+import static cn.newfeifan.mall.framework.common.pojo.CommonResult.success;
+import static cn.newfeifan.mall.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
+
+@Tag(name = "管理后台 - 订单结算表,记录有那些订单参与了本次结算")
+@RestController
+@RequestMapping("/distri/order-settlement")
+@Validated
+public class OrderSettlementController {
+
+    @Resource
+    private OrderSettlementService orderSettlementService;
+
+    @PostMapping("/create")
+    @Operation(summary = "创建订单结算表,记录有那些订单参与了本次结算")
+    @PreAuthorize("@ss.hasPermission('distri:order-settlement:create')")
+    public CommonResult<Long> createOrderSettlement(@Valid @RequestBody OrderSettlementSaveReqVO createReqVO) {
+        return success(orderSettlementService.createOrderSettlement(createReqVO));
+    }
+
+    @PutMapping("/update")
+    @Operation(summary = "更新订单结算表,记录有那些订单参与了本次结算")
+    @PreAuthorize("@ss.hasPermission('distri:order-settlement:update')")
+    public CommonResult<Boolean> updateOrderSettlement(@Valid @RequestBody OrderSettlementSaveReqVO updateReqVO) {
+        orderSettlementService.updateOrderSettlement(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/delete")
+    @Operation(summary = "删除订单结算表,记录有那些订单参与了本次结算")
+    @Parameter(name = "id", description = "编号", required = true)
+    @PreAuthorize("@ss.hasPermission('distri:order-settlement:delete')")
+    public CommonResult<Boolean> deleteOrderSettlement(@RequestParam("id") Long id) {
+        orderSettlementService.deleteOrderSettlement(id);
+        return success(true);
+    }
+
+    @GetMapping("/get")
+    @Operation(summary = "获得订单结算表,记录有那些订单参与了本次结算")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('distri:order-settlement:query')")
+    public CommonResult<OrderSettlementRespVO> getOrderSettlement(@RequestParam("id") Long id) {
+        OrderSettlementDO orderSettlement = orderSettlementService.getOrderSettlement(id);
+        return success(BeanUtils.toBean(orderSettlement, OrderSettlementRespVO.class));
+    }
+
+    @GetMapping("/page")
+    @Operation(summary = "获得订单结算表,记录有那些订单参与了本次结算分页")
+    @PreAuthorize("@ss.hasPermission('distri:order-settlement:query')")
+    public CommonResult<PageResult<OrderSettlementRespVO>> getOrderSettlementPage(@Valid OrderSettlementPageReqVO pageReqVO) {
+        PageResult<OrderSettlementDO> pageResult = orderSettlementService.getOrderSettlementPage(pageReqVO);
+        return success(BeanUtils.toBean(pageResult, OrderSettlementRespVO.class));
+    }
+
+    @GetMapping("/export-excel")
+    @Operation(summary = "导出订单结算表,记录有那些订单参与了本次结算 Excel")
+    @PreAuthorize("@ss.hasPermission('distri:order-settlement:export')")
+    @OperateLog(type = EXPORT)
+    public void exportOrderSettlementExcel(@Valid OrderSettlementPageReqVO pageReqVO,
+              HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        List<OrderSettlementDO> list = orderSettlementService.getOrderSettlementPage(pageReqVO).getList();
+        // 导出 Excel
+        ExcelUtils.write(response, "订单结算表,记录有那些订单参与了本次结算.xls", "数据", OrderSettlementRespVO.class,
+                        BeanUtils.toBean(list, OrderSettlementRespVO.class));
+    }
+
+}

+ 30 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ordersettlement/vo/OrderSettlementPageReqVO.java

@@ -0,0 +1,30 @@
+package cn.newfeifan.mall.module.distri.controller.admin.ordersettlement.vo;
+
+import cn.newfeifan.mall.framework.common.pojo.PageParam;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDateTime;
+
+import static cn.newfeifan.mall.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - 订单结算表,记录有那些订单参与了本次结算分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class OrderSettlementPageReqVO extends PageParam {
+
+    @Schema(description = "结算表ID", example = "3067")
+    private Long tradeShopSettlementId;
+
+    @Schema(description = "订单ID", example = "16254")
+    private Long tradeOrderId;
+
+    @Schema(description = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] createTime;
+
+}

+ 31 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ordersettlement/vo/OrderSettlementRespVO.java

@@ -0,0 +1,31 @@
+package cn.newfeifan.mall.module.distri.controller.admin.ordersettlement.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Schema(description = "管理后台 - 订单结算表,记录有那些订单参与了本次结算 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class OrderSettlementRespVO {
+
+    @Schema(description = "结算二级表ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14003")
+    @ExcelProperty("结算二级表ID")
+    private Long id;
+
+    @Schema(description = "结算表ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "3067")
+    @ExcelProperty("结算表ID")
+    private Long tradeShopSettlementId;
+
+    @Schema(description = "订单ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16254")
+    @ExcelProperty("订单ID")
+    private Long tradeOrderId;
+
+    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("创建时间")
+    private LocalDateTime createTime;
+
+}

+ 23 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ordersettlement/vo/OrderSettlementSaveReqVO.java

@@ -0,0 +1,23 @@
+package cn.newfeifan.mall.module.distri.controller.admin.ordersettlement.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+@Schema(description = "管理后台 - 订单结算表,记录有那些订单参与了本次结算新增/修改 Request VO")
+@Data
+public class OrderSettlementSaveReqVO {
+
+    @Schema(description = "结算二级表ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14003")
+    private Long id;
+
+    @Schema(description = "结算表ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "3067")
+    @NotNull(message = "结算表ID不能为空")
+    private Long tradeShopSettlementId;
+
+    @Schema(description = "订单ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16254")
+    @NotNull(message = "订单ID不能为空")
+    private Long tradeOrderId;
+
+}

+ 93 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ptsettlement/PtSettlementController.java

@@ -0,0 +1,93 @@
+package cn.newfeifan.mall.module.distri.controller.admin.ptsettlement;
+
+import cn.newfeifan.mall.framework.common.pojo.CommonResult;
+import cn.newfeifan.mall.framework.common.pojo.PageParam;
+import cn.newfeifan.mall.framework.common.pojo.PageResult;
+import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
+import cn.newfeifan.mall.framework.excel.core.util.ExcelUtils;
+import cn.newfeifan.mall.framework.operatelog.core.annotations.OperateLog;
+import cn.newfeifan.mall.module.distri.controller.admin.ptsettlement.vo.PtSettlementPageReqVO;
+import cn.newfeifan.mall.module.distri.controller.admin.ptsettlement.vo.PtSettlementRespVO;
+import cn.newfeifan.mall.module.distri.controller.admin.ptsettlement.vo.PtSettlementSaveReqVO;
+import cn.newfeifan.mall.module.distri.dal.dataobject.ptsettlement.PtSettlementDO;
+import cn.newfeifan.mall.module.distri.service.ptsettlement.PtSettlementService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.io.IOException;
+import java.util.List;
+
+import static cn.newfeifan.mall.framework.common.pojo.CommonResult.success;
+import static cn.newfeifan.mall.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
+
+@Tag(name = "管理后台 - 平台每日结算信息表,记录店铺的结算信息")
+@RestController
+@RequestMapping("/distri/pt-settlement")
+@Validated
+public class PtSettlementController {
+
+    @Resource
+    private PtSettlementService ptSettlementService;
+
+    @PostMapping("/create")
+    @Operation(summary = "创建平台每日结算信息表,记录店铺的结算信息")
+    @PreAuthorize("@ss.hasPermission('distri:pt-settlement:create')")
+    public CommonResult<Long> createPtSettlement(@Valid @RequestBody PtSettlementSaveReqVO createReqVO) {
+        return success(ptSettlementService.createPtSettlement(createReqVO));
+    }
+
+    @PutMapping("/update")
+    @Operation(summary = "更新平台每日结算信息表,记录店铺的结算信息")
+    @PreAuthorize("@ss.hasPermission('distri:pt-settlement:update')")
+    public CommonResult<Boolean> updatePtSettlement(@Valid @RequestBody PtSettlementSaveReqVO updateReqVO) {
+        ptSettlementService.updatePtSettlement(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/delete")
+    @Operation(summary = "删除平台每日结算信息表,记录店铺的结算信息")
+    @Parameter(name = "id", description = "编号", required = true)
+    @PreAuthorize("@ss.hasPermission('distri:pt-settlement:delete')")
+    public CommonResult<Boolean> deletePtSettlement(@RequestParam("id") Long id) {
+        ptSettlementService.deletePtSettlement(id);
+        return success(true);
+    }
+
+    @GetMapping("/get")
+    @Operation(summary = "获得平台每日结算信息表,记录店铺的结算信息")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('distri:pt-settlement:query')")
+    public CommonResult<PtSettlementRespVO> getPtSettlement(@RequestParam("id") Long id) {
+        PtSettlementDO ptSettlement = ptSettlementService.getPtSettlement(id);
+        return success(BeanUtils.toBean(ptSettlement, PtSettlementRespVO.class));
+    }
+
+    @GetMapping("/page")
+    @Operation(summary = "获得平台每日结算信息表,记录店铺的结算信息分页")
+    @PreAuthorize("@ss.hasPermission('distri:pt-settlement:query')")
+    public CommonResult<PageResult<PtSettlementRespVO>> getPtSettlementPage(@Valid PtSettlementPageReqVO pageReqVO) {
+        PageResult<PtSettlementDO> pageResult = ptSettlementService.getPtSettlementPage(pageReqVO);
+        return success(BeanUtils.toBean(pageResult, PtSettlementRespVO.class));
+    }
+
+    @GetMapping("/export-excel")
+    @Operation(summary = "导出平台每日结算信息表,记录店铺的结算信息 Excel")
+    @PreAuthorize("@ss.hasPermission('distri:pt-settlement:export')")
+    @OperateLog(type = EXPORT)
+    public void exportPtSettlementExcel(@Valid PtSettlementPageReqVO pageReqVO,
+              HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        List<PtSettlementDO> list = ptSettlementService.getPtSettlementPage(pageReqVO).getList();
+        // 导出 Excel
+        ExcelUtils.write(response, "平台每日结算信息表,记录店铺的结算信息.xls", "数据", PtSettlementRespVO.class,
+                        BeanUtils.toBean(list, PtSettlementRespVO.class));
+    }
+
+}

+ 37 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ptsettlement/vo/PtSettlementPageReqVO.java

@@ -0,0 +1,37 @@
+package cn.newfeifan.mall.module.distri.controller.admin.ptsettlement.vo;
+
+import cn.newfeifan.mall.framework.common.pojo.PageParam;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+import static cn.newfeifan.mall.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - 平台每日结算信息表,记录店铺的结算信息分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class PtSettlementPageReqVO extends PageParam {
+
+    @Schema(description = "销售额(积分 + 支付金额)")
+    private Integer platformCollectionAmount;
+
+    @Schema(description = "抵扣积分")
+    private Long shopAmount;
+
+    @Schema(description = "共计成本价格(高精度 + 成本)")
+    private BigDecimal shopTotalHighAmount;
+
+    @Schema(description = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] createTime;
+
+    @Schema(description = "是否结账")
+    private Boolean platformTransferConfirm;
+
+}

+ 40 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ptsettlement/vo/PtSettlementRespVO.java

@@ -0,0 +1,40 @@
+package cn.newfeifan.mall.module.distri.controller.admin.ptsettlement.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@Schema(description = "管理后台 - 平台每日结算信息表,记录店铺的结算信息 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class PtSettlementRespVO {
+
+    @Schema(description = "结算id", requiredMode = Schema.RequiredMode.REQUIRED, example = "2104")
+    @ExcelProperty("结算id")
+    private Long id;
+
+    @Schema(description = "销售额(积分 + 支付金额)", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("销售额(积分 + 支付金额)")
+    private Integer platformCollectionAmount;
+
+    @Schema(description = "抵扣积分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("抵扣积分")
+    private Long shopAmount;
+
+    @Schema(description = "共计成本价格(高精度 + 成本)")
+    @ExcelProperty("共计成本价格(高精度 + 成本)")
+    private BigDecimal shopTotalHighAmount;
+
+    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("创建时间")
+    private LocalDateTime createTime;
+
+    @Schema(description = "是否结账")
+    @ExcelProperty("是否结账")
+    private Boolean platformTransferConfirm;
+
+}

+ 30 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ptsettlement/vo/PtSettlementSaveReqVO.java

@@ -0,0 +1,30 @@
+package cn.newfeifan.mall.module.distri.controller.admin.ptsettlement.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+
+@Schema(description = "管理后台 - 平台每日结算信息表,记录店铺的结算信息新增/修改 Request VO")
+@Data
+public class PtSettlementSaveReqVO {
+
+    @Schema(description = "结算id", requiredMode = Schema.RequiredMode.REQUIRED, example = "2104")
+    private Long id;
+
+    @Schema(description = "销售额(积分 + 支付金额)", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotNull(message = "销售额(积分 + 支付金额)不能为空")
+    private Integer platformCollectionAmount;
+
+    @Schema(description = "抵扣积分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotNull(message = "抵扣积分不能为空")
+    private Long shopAmount;
+
+    @Schema(description = "共计成本价格(高精度 + 成本)")
+    private BigDecimal shopTotalHighAmount;
+
+    @Schema(description = "是否结账")
+    private Boolean platformTransferConfirm;
+
+}

+ 95 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/shopsettlement/ShopSettlementController.java

@@ -0,0 +1,95 @@
+package cn.newfeifan.mall.module.distri.controller.admin.shopsettlement;
+
+import cn.newfeifan.mall.framework.common.pojo.CommonResult;
+import cn.newfeifan.mall.framework.common.pojo.PageParam;
+import cn.newfeifan.mall.framework.common.pojo.PageResult;
+import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
+import cn.newfeifan.mall.framework.excel.core.util.ExcelUtils;
+import cn.newfeifan.mall.framework.operatelog.core.annotations.OperateLog;
+import cn.newfeifan.mall.module.distri.controller.admin.shopsettlement.excelvo.ShopSettlementExcelRespVO;
+import cn.newfeifan.mall.module.distri.controller.admin.shopsettlement.vo.ShopSettlementPageReqVO;
+import cn.newfeifan.mall.module.distri.controller.admin.shopsettlement.vo.ShopSettlementRespVO;
+import cn.newfeifan.mall.module.distri.controller.admin.shopsettlement.vo.ShopSettlementSaveReqVO;
+import cn.newfeifan.mall.module.distri.convert.shopsettlement.ShopSettlementConvert;
+import cn.newfeifan.mall.module.distri.dal.dataobject.shopsettlement.ShopSettlementDO;
+import cn.newfeifan.mall.module.distri.service.shopsettlement.ShopSettlementService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.io.IOException;
+import java.util.List;
+
+import static cn.newfeifan.mall.framework.common.pojo.CommonResult.success;
+import static cn.newfeifan.mall.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
+
+@Tag(name = "管理后台 - 订单结算信息表,记录店铺的结算信息")
+@RestController
+@RequestMapping("/distri/shop-settlement")
+@Validated
+public class ShopSettlementController {
+
+    @Resource
+    private ShopSettlementService shopSettlementService;
+
+    @PostMapping("/create")
+    @Operation(summary = "创建订单结算信息表,记录店铺的结算信息")
+    @PreAuthorize("@ss.hasPermission('trade:shop-settlement:create')")
+    public CommonResult<Long> createShopSettlement(@Valid @RequestBody ShopSettlementSaveReqVO createReqVO) {
+        return success(shopSettlementService.createShopSettlement(createReqVO));
+    }
+
+    @PutMapping("/update")
+    @Operation(summary = "更新订单结算信息表,记录店铺的结算信息")
+    @PreAuthorize("@ss.hasPermission('trade:shop-settlement:update')")
+    public CommonResult<Boolean> updateShopSettlement(@Valid @RequestBody ShopSettlementSaveReqVO updateReqVO) {
+        shopSettlementService.updateShopSettlement(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/delete")
+    @Operation(summary = "删除订单结算信息表,记录店铺的结算信息")
+    @Parameter(name = "id", description = "编号", required = true)
+    @PreAuthorize("@ss.hasPermission('trade:shop-settlement:delete')")
+    public CommonResult<Boolean> deleteShopSettlement(@RequestParam("id") Long id) {
+        shopSettlementService.deleteShopSettlement(id);
+        return success(true);
+    }
+
+    @GetMapping("/get")
+    @Operation(summary = "获得订单结算信息表,记录店铺的结算信息")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('trade:shop-settlement:query')")
+    public CommonResult<ShopSettlementRespVO> getShopSettlement(@RequestParam("id") Long id) {
+        ShopSettlementDO shopSettlement = shopSettlementService.getShopSettlement(id);
+        return success(BeanUtils.toBean(shopSettlement, ShopSettlementRespVO.class));
+    }
+
+    @GetMapping("/page")
+    @Operation(summary = "获得订单结算信息表,记录店铺的结算信息分页")
+    @PreAuthorize("@ss.hasPermission('trade:shop-settlement:query')")
+    public CommonResult<PageResult<ShopSettlementRespVO>> getShopSettlementPage(@Valid ShopSettlementPageReqVO pageReqVO) {
+        PageResult<ShopSettlementRespVO> pageResult = shopSettlementService.getShopSettlementPage(pageReqVO);
+        return success(pageResult);
+    }
+
+    @GetMapping("/export-excel")
+    @Operation(summary = "导出订单结算信息表,记录店铺的结算信息 Excel")
+    @PreAuthorize("@ss.hasPermission('trade:shop-settlement:export')")
+    @OperateLog(type = EXPORT)
+    public void exportShopSettlementExcel(@Valid ShopSettlementPageReqVO pageReqVO,
+              HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        List<ShopSettlementExcelRespVO> list = ShopSettlementConvert.INSTANCE.convertList(shopSettlementService.getShopSettlementPage(pageReqVO).getList());
+        // 导出 Excel
+        ExcelUtils.write(response, "订单结算信息表,记录店铺的结算信息.xls", "数据", ShopSettlementExcelRespVO.class,
+                        list);
+    }
+
+}

+ 42 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/shopsettlement/excelvo/ShopSettlementExcelRespVO.java

@@ -0,0 +1,42 @@
+package cn.newfeifan.mall.module.distri.controller.admin.shopsettlement.excelvo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Schema(description = "管理后台 - 订单结算信息表,记录店铺的结算信息 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class ShopSettlementExcelRespVO {
+
+    @Schema(description = "结算id", requiredMode = Schema.RequiredMode.REQUIRED, example = "15576")
+    @ExcelProperty("序号")
+    private Long id;
+
+    @Schema(description = "店铺名称")
+    @ExcelProperty("店铺名称")
+    private String shopName;
+
+    @Schema(description = "销售额(积分 + 支付金额)", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("销售额")
+    private Double platformCollectionAmount;
+
+    @Schema(description = "抵扣积分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("抵扣积分")
+    private Double shopAmount;
+
+    @Schema(description = "共计成本价格(高精度 + 成本)")
+    @ExcelProperty("应结(成本)")
+    private Double shopTotalHighAmount;
+
+    @Schema(description = "转账凭证附件")
+    @ExcelProperty("转账凭证附件")
+    private String attachment;
+
+    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("创建时间")
+    private LocalDateTime createTime;
+}

+ 46 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/shopsettlement/vo/ShopSettlementPageReqVO.java

@@ -0,0 +1,46 @@
+package cn.newfeifan.mall.module.distri.controller.admin.shopsettlement.vo;
+
+import cn.newfeifan.mall.framework.common.pojo.PageParam;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+import static cn.newfeifan.mall.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - 订单结算信息表,记录店铺的结算信息分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class ShopSettlementPageReqVO extends PageParam {
+
+    @Schema(description = "店铺id", example = "14984")
+    private Long shopId;
+
+    @Schema(description = "商户id", example = "21578")
+    private Long merchantId;
+
+    @Schema(description = "销售额(积分 + 支付金额)")
+    private Integer platformCollectionAmount;
+
+    @Schema(description = "抵扣积分")
+    private Long shopAmount;
+
+    @Schema(description = "共计成本价格(高精度 + 成本)")
+    private BigDecimal shopTotalHighAmount;
+
+    @Schema(description = "平台结算ID", example = "3176")
+    private Long ptSettlementId;
+
+    @Schema(description = "转账凭证附件")
+    private String attachment;
+
+    @Schema(description = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] createTime;
+
+}

+ 55 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/shopsettlement/vo/ShopSettlementRespVO.java

@@ -0,0 +1,55 @@
+package cn.newfeifan.mall.module.distri.controller.admin.shopsettlement.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@Schema(description = "管理后台 - 订单结算信息表,记录店铺的结算信息 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class ShopSettlementRespVO {
+
+    @Schema(description = "结算id", requiredMode = Schema.RequiredMode.REQUIRED, example = "27950")
+    @ExcelProperty("结算id")
+    private Long id;
+
+    @Schema(description = "店铺id", requiredMode = Schema.RequiredMode.REQUIRED, example = "14984")
+    @ExcelProperty("店铺id")
+    private Long shopId;
+
+    @Schema(description = "店铺名称")
+    private String shopName;
+
+    @Schema(description = "商户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "21578")
+    @ExcelProperty("商户id")
+    private Long merchantId;
+
+    @Schema(description = "销售额(积分 + 支付金额)", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("销售额(积分 + 支付金额)")
+    private Integer platformCollectionAmount;
+
+    @Schema(description = "抵扣积分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("抵扣积分")
+    private Long shopAmount;
+
+    @Schema(description = "共计成本价格(高精度 + 成本)")
+    @ExcelProperty("共计成本价格(高精度 + 成本)")
+    private BigDecimal shopTotalHighAmount;
+
+    @Schema(description = "平台结算ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "3176")
+    @ExcelProperty("平台结算ID")
+    private Long ptSettlementId;
+
+    @Schema(description = "转账凭证附件")
+    @ExcelProperty("转账凭证附件")
+    private String attachment;
+
+    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("创建时间")
+    private LocalDateTime createTime;
+
+}

+ 42 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/shopsettlement/vo/ShopSettlementSaveReqVO.java

@@ -0,0 +1,42 @@
+package cn.newfeifan.mall.module.distri.controller.admin.shopsettlement.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+
+@Schema(description = "管理后台 - 订单结算信息表,记录店铺的结算信息新增/修改 Request VO")
+@Data
+public class ShopSettlementSaveReqVO {
+
+    @Schema(description = "结算id", requiredMode = Schema.RequiredMode.REQUIRED, example = "27950")
+    private Long id;
+
+    @Schema(description = "店铺id", requiredMode = Schema.RequiredMode.REQUIRED, example = "14984")
+    @NotNull(message = "店铺id不能为空")
+    private Long shopId;
+
+    @Schema(description = "商户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "21578")
+    @NotNull(message = "商户id不能为空")
+    private Long merchantId;
+
+    @Schema(description = "销售额(积分 + 支付金额)", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotNull(message = "销售额(积分 + 支付金额)不能为空")
+    private Integer platformCollectionAmount;
+
+    @Schema(description = "抵扣积分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotNull(message = "抵扣积分不能为空")
+    private Long shopAmount;
+
+    @Schema(description = "共计成本价格(高精度 + 成本)")
+    private BigDecimal shopTotalHighAmount;
+
+    @Schema(description = "平台结算ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "3176")
+    @NotNull(message = "平台结算ID不能为空")
+    private Long ptSettlementId;
+
+    @Schema(description = "转账凭证附件")
+    private String attachment;
+
+}

+ 29 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/convert/dailybill/DailyBillConvert.java

@@ -0,0 +1,29 @@
+package cn.newfeifan.mall.module.distri.convert.dailybill;
+
+import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
+import cn.newfeifan.mall.module.distri.controller.admin.dailybill.excelvo.DailyBillExcelRespVO;
+import cn.newfeifan.mall.module.distri.controller.admin.dailybill.vo.DailyBillRespVO;
+import org.mapstruct.Mapper;
+
+import java.util.List;
+
+import static cn.newfeifan.mall.module.distri.constant.DistriConstants.*;
+
+@Mapper
+public interface DailyBillConvert {
+    DailyBillConvert INSTANCE = org.mapstruct.factory.Mappers.getMapper(DailyBillConvert.class);
+
+    default List<DailyBillExcelRespVO> convertList(List<DailyBillRespVO> list) {
+        List<DailyBillExcelRespVO> respVOList = BeanUtils.toBean(list, DailyBillExcelRespVO.class);
+        for (DailyBillExcelRespVO respVO : respVOList) {
+            respVO.setPrice(respVO.getPrice() / ONE_HUNDRED);
+            respVO.setReceivedPrice(respVO.getReceivedPrice() / ONE_HUNDRED);
+            respVO.setRefundPrice(respVO.getRefundPrice() / ONE_HUNDRED);
+            respVO.setIntegral(respVO.getIntegral() / MILLION);
+            respVO.setReceivedIntegral(respVO.getReceivedIntegral() / MILLION);
+            respVO.setRefundIntegral(respVO.getRefundIntegral() / MILLION);
+        }
+
+        return respVOList;
+    }
+}

+ 25 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/convert/shopsettlement/ShopSettlementConvert.java

@@ -0,0 +1,25 @@
+package cn.newfeifan.mall.module.distri.convert.shopsettlement;
+
+import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
+import cn.newfeifan.mall.module.distri.controller.admin.shopsettlement.excelvo.ShopSettlementExcelRespVO;
+import cn.newfeifan.mall.module.distri.controller.admin.shopsettlement.vo.ShopSettlementRespVO;
+import org.mapstruct.Mapper;
+
+import java.util.List;
+
+import static cn.newfeifan.mall.module.distri.constant.DistriConstants.*;
+
+@Mapper
+public interface ShopSettlementConvert {
+    ShopSettlementConvert INSTANCE = org.mapstruct.factory.Mappers.getMapper(ShopSettlementConvert.class);
+
+    default List<ShopSettlementExcelRespVO> convertList(List<ShopSettlementRespVO> list){
+        List<ShopSettlementExcelRespVO> respVOList = BeanUtils.toBean(list, ShopSettlementExcelRespVO.class);
+        for (ShopSettlementExcelRespVO respVO : respVOList) {
+            respVO.setPlatformCollectionAmount(respVO.getPlatformCollectionAmount() / ONE_HUNDRED);
+            respVO.setShopAmount(respVO.getShopAmount() / MILLION);
+            respVO.setShopTotalHighAmount(Math.floor(respVO.getShopTotalHighAmount() / ONE_HUNDRED * ONE_HUNDRED) / ONE_HUNDRED);       // 将小数点后的位数截断,保留两位但不进行四舍五入
+        }
+        return respVOList;
+    }
+}

+ 38 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/dataobject/ordersettlement/OrderSettlementDO.java

@@ -0,0 +1,38 @@
+package cn.newfeifan.mall.module.distri.dal.dataobject.ordersettlement;
+
+import cn.newfeifan.mall.framework.mybatis.core.dataobject.BaseDO;
+import com.baomidou.mybatisplus.annotation.KeySequence;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.*;
+
+/**
+ * 订单结算表,记录有那些订单参与了本次结算 DO
+ *
+ * @author 非繁人
+ */
+@TableName("trade_order_settlement")
+@KeySequence("trade_order_settlement_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class OrderSettlementDO extends BaseDO {
+
+    /**
+     * 结算二级表ID
+     */
+    @TableId
+    private Long id;
+    /**
+     * 结算表ID
+     */
+    private Long tradeShopSettlementId;
+    /**
+     * 订单ID
+     */
+    private Long tradeOrderId;
+
+}

+ 48 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/dataobject/ptsettlement/PtSettlementDO.java

@@ -0,0 +1,48 @@
+package cn.newfeifan.mall.module.distri.dal.dataobject.ptsettlement;
+
+import cn.newfeifan.mall.framework.mybatis.core.dataobject.BaseDO;
+import com.baomidou.mybatisplus.annotation.KeySequence;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.*;
+
+import java.math.BigDecimal;
+
+/**
+ * 平台每日结算信息表,记录店铺的结算信息 DO
+ *
+ * @author 非繁人
+ */
+@TableName("trade_pt_settlement")
+@KeySequence("trade_pt_settlement_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class PtSettlementDO extends BaseDO {
+
+    /**
+     * 结算id
+     */
+    @TableId
+    private Long id;
+    /**
+     * 销售额(积分 + 支付金额)
+     */
+    private Integer platformCollectionAmount;
+    /**
+     * 抵扣积分
+     */
+    private Long shopAmount;
+    /**
+     * 共计成本价格(高精度 + 成本)
+     */
+    private BigDecimal shopTotalHighAmount;
+    /**
+     * 是否结账
+     */
+    private Boolean platformTransferConfirm;
+
+}

+ 60 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/dataobject/shopsettlement/ShopSettlementDO.java

@@ -0,0 +1,60 @@
+package cn.newfeifan.mall.module.distri.dal.dataobject.shopsettlement;
+
+import cn.newfeifan.mall.framework.mybatis.core.dataobject.BaseDO;
+import com.baomidou.mybatisplus.annotation.KeySequence;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.*;
+
+import java.math.BigDecimal;
+
+/**
+ * 订单结算信息表,记录店铺的结算信息 DO
+ *
+ * @author 非繁人
+ */
+@TableName("trade_shop_settlement")
+@KeySequence("trade_shop_settlement_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class ShopSettlementDO extends BaseDO {
+
+    /**
+     * 结算id
+     */
+    @TableId
+    private Long id;
+    /**
+     * 店铺id
+     */
+    private Long shopId;
+    /**
+     * 商户id
+     */
+    private Long merchantId;
+    /**
+     * 销售额(积分 + 支付金额)
+     */
+    private Integer platformCollectionAmount;
+    /**
+     * 抵扣积分
+     */
+    private Long shopAmount;
+    /**
+     * 共计成本价格(高精度 + 成本)
+     */
+    private BigDecimal shopTotalHighAmount;
+    /**
+     * 平台结算ID
+     */
+    private Long ptSettlementId;
+    /**
+     * 转账凭证附件
+     */
+    private String attachment;
+
+}

+ 4 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/mysql/dailybill/DailyBillMapper.java

@@ -29,6 +29,7 @@ public interface DailyBillMapper extends BaseMapperX<DailyBillDO> {
                 .eqIfPresent(DailyBillDO::getMerchantId, reqVO.getMerchantId())
                 .eqIfPresent(DailyBillDO::getOrderIds, reqVO.getOrderIds())
                 .betweenIfPresent(DailyBillDO::getCreateTime, reqVO.getCreateTime())
+                .betweenIfPresent(DailyBillDO::getOrderCalcTime, reqVO.getOrderCalcTime())
                 .orderByDesc(DailyBillDO::getId));
     }
 
@@ -38,4 +39,7 @@ public interface DailyBillMapper extends BaseMapperX<DailyBillDO> {
 
     void updateOrderItemByOrderId(List<Long> orderIds);
 
+    String getMerchantName(Long merchantId);
+
+    String getShopName(Long shopId);
 }

+ 32 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/mysql/ordersettlement/OrderSettlementMapper.java

@@ -0,0 +1,32 @@
+package cn.newfeifan.mall.module.distri.dal.mysql.ordersettlement;
+
+import cn.newfeifan.mall.framework.common.pojo.PageResult;
+import cn.newfeifan.mall.framework.mybatis.core.mapper.BaseMapperX;
+import cn.newfeifan.mall.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.newfeifan.mall.module.distri.controller.admin.ordersettlement.vo.*;
+import cn.newfeifan.mall.module.distri.dal.dataobject.ordersettlement.OrderSettlementDO;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 订单结算表,记录有那些订单参与了本次结算 Mapper
+ *
+ * @author 非繁人
+ */
+@Mapper
+public interface OrderSettlementMapper extends BaseMapperX<OrderSettlementDO> {
+
+    default PageResult<OrderSettlementDO> selectPage(OrderSettlementPageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<OrderSettlementDO>()
+                .eqIfPresent(OrderSettlementDO::getTradeShopSettlementId, reqVO.getTradeShopSettlementId())
+                .eqIfPresent(OrderSettlementDO::getTradeOrderId, reqVO.getTradeOrderId())
+                .betweenIfPresent(OrderSettlementDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(OrderSettlementDO::getId));
+    }
+
+    default List<Long> selectOrderIdsByShopSettlementId(Long shopSettlementId){
+        return selectList(OrderSettlementDO::getTradeShopSettlementId, shopSettlementId).stream().map(OrderSettlementDO::getTradeOrderId).collect(Collectors.toList());
+    }
+}

+ 1 - 1
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/ptprofit/PtProfitMapper.java → feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/mysql/ptprofit/PtProfitMapper.java

@@ -1,4 +1,4 @@
-package cn.newfeifan.mall.module.distri.dal.ptprofit;
+package cn.newfeifan.mall.module.distri.dal.mysql.ptprofit;
 
 import cn.newfeifan.mall.framework.mybatis.core.mapper.BaseMapperX;
 import cn.newfeifan.mall.module.distri.dal.dataobject.ptprofit.PtProfitDO;

+ 1 - 1
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/ptprofitlog/PtProfitLogMapper.java → feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/mysql/ptprofitlog/PtProfitLogMapper.java

@@ -1,4 +1,4 @@
-package cn.newfeifan.mall.module.distri.dal.ptprofitlog;
+package cn.newfeifan.mall.module.distri.dal.mysql.ptprofitlog;
 
 
 import cn.newfeifan.mall.framework.mybatis.core.mapper.BaseMapperX;

+ 28 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/mysql/ptsettlement/PtSettlementMapper.java

@@ -0,0 +1,28 @@
+package cn.newfeifan.mall.module.distri.dal.mysql.ptsettlement;
+
+import cn.newfeifan.mall.framework.common.pojo.PageResult;
+import cn.newfeifan.mall.framework.mybatis.core.mapper.BaseMapperX;
+import cn.newfeifan.mall.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.newfeifan.mall.module.distri.controller.admin.ptsettlement.vo.PtSettlementPageReqVO;
+import cn.newfeifan.mall.module.distri.dal.dataobject.ptsettlement.PtSettlementDO;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 平台每日结算信息表,记录店铺的结算信息 Mapper
+ *
+ * @author 非繁人
+ */
+@Mapper
+public interface PtSettlementMapper extends BaseMapperX<PtSettlementDO> {
+
+    default PageResult<PtSettlementDO> selectPage(PtSettlementPageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<PtSettlementDO>()
+                .eqIfPresent(PtSettlementDO::getPlatformCollectionAmount, reqVO.getPlatformCollectionAmount())
+                .eqIfPresent(PtSettlementDO::getShopAmount, reqVO.getShopAmount())
+                .eqIfPresent(PtSettlementDO::getPlatformTransferConfirm, reqVO.getPlatformTransferConfirm())
+                .eqIfPresent(PtSettlementDO::getShopTotalHighAmount, reqVO.getShopTotalHighAmount())
+                .betweenIfPresent(PtSettlementDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(PtSettlementDO::getId));
+    }
+
+}

+ 41 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/mysql/shopsettlement/ShopSettlementMapper.java

@@ -0,0 +1,41 @@
+package cn.newfeifan.mall.module.distri.dal.mysql.shopsettlement;
+
+import cn.newfeifan.mall.framework.common.pojo.PageResult;
+import cn.newfeifan.mall.framework.mybatis.core.mapper.BaseMapperX;
+import cn.newfeifan.mall.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.newfeifan.mall.module.distri.controller.admin.shopsettlement.vo.ShopSettlementPageReqVO;
+import cn.newfeifan.mall.module.distri.dal.dataobject.shopsettlement.ShopSettlementDO;
+import cn.newfeifan.mall.module.distri.service.dailybill.dto.OrderDTO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 订单结算信息表,记录店铺的结算信息 Mapper
+ *
+ * @author 非繁人
+ */
+@Mapper
+public interface ShopSettlementMapper extends BaseMapperX<ShopSettlementDO> {
+
+    default PageResult<ShopSettlementDO> selectPage(ShopSettlementPageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<ShopSettlementDO>()
+                .eqIfPresent(ShopSettlementDO::getPlatformCollectionAmount, reqVO.getPlatformCollectionAmount())
+                .eqIfPresent(ShopSettlementDO::getShopAmount, reqVO.getShopAmount())
+                .eqIfPresent(ShopSettlementDO::getAttachment, reqVO.getAttachment())
+                .betweenIfPresent(ShopSettlementDO::getCreateTime, reqVO.getCreateTime())
+                .eqIfPresent(ShopSettlementDO::getShopId, reqVO.getShopId())
+                .eqIfPresent(ShopSettlementDO::getMerchantId, reqVO.getMerchantId())
+                .eqIfPresent(ShopSettlementDO::getShopTotalHighAmount, reqVO.getShopTotalHighAmount())
+                .eqIfPresent(ShopSettlementDO::getPtSettlementId, reqVO.getPtSettlementId())
+                .orderByDesc(ShopSettlementDO::getId));
+    }
+
+    List<OrderDTO> getOrderByMerchantIdWithsShopId(@Param("shopId") Long shopId, @Param("merchantId") Long merchantId);
+
+    void setOrderItemById(@Param("ids") List<Long> ids);
+
+    String getShopName(@Param("shopId") Long shopId);
+
+}

+ 2 - 1
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/dailybill/DailyBillService.java

@@ -2,6 +2,7 @@ package cn.newfeifan.mall.module.distri.service.dailybill;
 
 import cn.newfeifan.mall.framework.common.pojo.PageResult;
 import cn.newfeifan.mall.module.distri.controller.admin.dailybill.vo.DailyBillPageReqVO;
+import cn.newfeifan.mall.module.distri.controller.admin.dailybill.vo.DailyBillRespVO;
 import cn.newfeifan.mall.module.distri.controller.admin.dailybill.vo.DailyBillSaveReqVO;
 import cn.newfeifan.mall.module.distri.dal.dataobject.dailybill.DailyBillDO;
 
@@ -51,7 +52,7 @@ public interface DailyBillService {
      * @param pageReqVO 分页查询
      * @return 每日账单分页
      */
-    PageResult<DailyBillDO> getDailyBillPage(DailyBillPageReqVO pageReqVO);
+    PageResult<DailyBillRespVO> getDailyBillPage(DailyBillPageReqVO pageReqVO);
 
     /**
      * 计算每家店铺每日的订单

+ 12 - 2
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/dailybill/DailyBillServiceImpl.java

@@ -3,6 +3,7 @@ package cn.newfeifan.mall.module.distri.service.dailybill;
 import cn.newfeifan.mall.framework.common.pojo.PageResult;
 import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
 import cn.newfeifan.mall.module.distri.controller.admin.dailybill.vo.DailyBillPageReqVO;
+import cn.newfeifan.mall.module.distri.controller.admin.dailybill.vo.DailyBillRespVO;
 import cn.newfeifan.mall.module.distri.controller.admin.dailybill.vo.DailyBillSaveReqVO;
 import cn.newfeifan.mall.module.distri.dal.dataobject.dailybill.DailyBillDO;
 import cn.newfeifan.mall.module.distri.dal.mysql.dailybill.DailyBillMapper;
@@ -77,11 +78,20 @@ public class DailyBillServiceImpl implements DailyBillService {
     }
 
     @Override
-    public PageResult<DailyBillDO> getDailyBillPage(DailyBillPageReqVO pageReqVO) {
+    public PageResult<DailyBillRespVO> getDailyBillPage(DailyBillPageReqVO pageReqVO) {
+
         UserShopDetailsVO userShopDetails = userService.getUserShopDetails();
+
         pageReqVO.setMerchantId(userShopDetails.getMerId());
         pageReqVO.setShopId(userShopDetails.getShopId());
-        return dailyBillMapper.selectPage(pageReqVO);
+
+        PageResult<DailyBillDO> dailyBillDOPageResult = dailyBillMapper.selectPage(pageReqVO);
+        PageResult<DailyBillRespVO> result = BeanUtils.toBean(dailyBillDOPageResult, DailyBillRespVO.class);
+        for (DailyBillRespVO dailyBillRespVO : result.getList()) {
+            dailyBillRespVO.setMerchantName(dailyBillMapper.getMerchantName(dailyBillRespVO.getMerchantId()));
+            dailyBillRespVO.setShopName(dailyBillMapper.getShopName(dailyBillRespVO.getShopId()));
+        }
+        return result;
     }
 
     @Override

+ 1 - 1
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/integral/IntegralServiceImpl.java

@@ -3,7 +3,7 @@ package cn.newfeifan.mall.module.distri.service.integral;
 import cn.newfeifan.mall.module.distri.controller.admin.ptprofitlog.vo.PtProfitLogSaveReqVO;
 import cn.newfeifan.mall.module.distri.dal.dataobject.integral.IntegralDO;
 import cn.newfeifan.mall.module.distri.dal.integral.IntegralMapper;
-import cn.newfeifan.mall.module.distri.dal.ptprofit.PtProfitMapper;
+import cn.newfeifan.mall.module.distri.dal.mysql.ptprofit.PtProfitMapper;
 import cn.newfeifan.mall.module.distri.enums.CaclEnum;
 import cn.newfeifan.mall.module.distri.service.ptprofitlog.PtProfitLogService;
 import org.springframework.stereotype.Service;

+ 55 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/ordersettlement/OrderSettlementService.java

@@ -0,0 +1,55 @@
+package cn.newfeifan.mall.module.distri.service.ordersettlement;
+
+import cn.newfeifan.mall.framework.common.pojo.PageResult;
+import cn.newfeifan.mall.module.distri.controller.admin.ordersettlement.vo.OrderSettlementPageReqVO;
+import cn.newfeifan.mall.module.distri.controller.admin.ordersettlement.vo.OrderSettlementSaveReqVO;
+import cn.newfeifan.mall.module.distri.dal.dataobject.ordersettlement.OrderSettlementDO;
+
+import javax.validation.Valid;
+
+/**
+ * 订单结算表,记录有那些订单参与了本次结算 Service 接口
+ *
+ * @author 非繁人
+ */
+public interface OrderSettlementService {
+
+    /**
+     * 创建订单结算表,记录有那些订单参与了本次结算
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createOrderSettlement(@Valid OrderSettlementSaveReqVO createReqVO);
+
+    /**
+     * 更新订单结算表,记录有那些订单参与了本次结算
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updateOrderSettlement(@Valid OrderSettlementSaveReqVO updateReqVO);
+
+    /**
+     * 删除订单结算表,记录有那些订单参与了本次结算
+     *
+     * @param id 编号
+     */
+    void deleteOrderSettlement(Long id);
+
+    /**
+     * 获得订单结算表,记录有那些订单参与了本次结算
+     *
+     * @param id 编号
+     * @return 订单结算表,记录有那些订单参与了本次结算
+     */
+    OrderSettlementDO getOrderSettlement(Long id);
+
+    /**
+     * 获得订单结算表,记录有那些订单参与了本次结算分页
+     *
+     * @param pageReqVO 分页查询
+     * @return 订单结算表,记录有那些订单参与了本次结算分页
+     */
+    PageResult<OrderSettlementDO> getOrderSettlementPage(OrderSettlementPageReqVO pageReqVO);
+
+}

+ 71 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/ordersettlement/OrderSettlementServiceImpl.java

@@ -0,0 +1,71 @@
+package cn.newfeifan.mall.module.distri.service.ordersettlement;
+
+import cn.newfeifan.mall.framework.common.pojo.PageResult;
+import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
+import cn.newfeifan.mall.module.distri.controller.admin.ordersettlement.vo.OrderSettlementPageReqVO;
+import cn.newfeifan.mall.module.distri.controller.admin.ordersettlement.vo.OrderSettlementSaveReqVO;
+import cn.newfeifan.mall.module.distri.dal.dataobject.ordersettlement.OrderSettlementDO;
+import cn.newfeifan.mall.module.distri.dal.mysql.ordersettlement.OrderSettlementMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import javax.annotation.Resource;
+
+import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.newfeifan.mall.module.distri.enums.ErrorCodeConstants.ORDER_SETTLEMENT_NOT_EXISTS;
+
+/**
+ * 订单结算表,记录有那些订单参与了本次结算 Service 实现类
+ *
+ * @author 非繁人
+ */
+@Service
+@Validated
+public class OrderSettlementServiceImpl implements OrderSettlementService {
+
+    @Resource
+    private OrderSettlementMapper orderSettlementMapper;
+
+    @Override
+    public Long createOrderSettlement(OrderSettlementSaveReqVO createReqVO) {
+        // 插入
+        OrderSettlementDO orderSettlement = BeanUtils.toBean(createReqVO, OrderSettlementDO.class);
+        orderSettlementMapper.insert(orderSettlement);
+        // 返回
+        return orderSettlement.getId();
+    }
+
+    @Override
+    public void updateOrderSettlement(OrderSettlementSaveReqVO updateReqVO) {
+        // 校验存在
+        validateOrderSettlementExists(updateReqVO.getId());
+        // 更新
+        OrderSettlementDO updateObj = BeanUtils.toBean(updateReqVO, OrderSettlementDO.class);
+        orderSettlementMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteOrderSettlement(Long id) {
+        // 校验存在
+        validateOrderSettlementExists(id);
+        // 删除
+        orderSettlementMapper.deleteById(id);
+    }
+
+    private void validateOrderSettlementExists(Long id) {
+        if (orderSettlementMapper.selectById(id) == null) {
+            throw exception(ORDER_SETTLEMENT_NOT_EXISTS);
+        }
+    }
+
+    @Override
+    public OrderSettlementDO getOrderSettlement(Long id) {
+        return orderSettlementMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<OrderSettlementDO> getOrderSettlementPage(OrderSettlementPageReqVO pageReqVO) {
+        return orderSettlementMapper.selectPage(pageReqVO);
+    }
+
+}

+ 1 - 1
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/ptprofitlog/PtProfitLogServiceImpl.java

@@ -7,7 +7,7 @@ import cn.newfeifan.mall.module.distri.controller.admin.ptprofitlog.vo.PtProfitL
 import cn.newfeifan.mall.module.distri.controller.admin.ptprofitlog.vo.PtProfitLogRespVO;
 import cn.newfeifan.mall.module.distri.controller.admin.ptprofitlog.vo.PtProfitLogSaveReqVO;
 import cn.newfeifan.mall.module.distri.dal.dataobject.ptprofitlog.PtProfitLogDO;
-import cn.newfeifan.mall.module.distri.dal.ptprofitlog.PtProfitLogMapper;
+import cn.newfeifan.mall.module.distri.dal.mysql.ptprofitlog.PtProfitLogMapper;
 import cn.newfeifan.mall.module.distri.enums.CaclEnum;
 import org.springframework.stereotype.Service;
 import org.springframework.validation.annotation.Validated;

+ 55 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/ptsettlement/PtSettlementService.java

@@ -0,0 +1,55 @@
+package cn.newfeifan.mall.module.distri.service.ptsettlement;
+
+import cn.newfeifan.mall.framework.common.pojo.PageResult;
+import cn.newfeifan.mall.module.distri.controller.admin.ptsettlement.vo.PtSettlementPageReqVO;
+import cn.newfeifan.mall.module.distri.controller.admin.ptsettlement.vo.PtSettlementSaveReqVO;
+import cn.newfeifan.mall.module.distri.dal.dataobject.ptsettlement.PtSettlementDO;
+
+import javax.validation.Valid;
+
+/**
+ * 平台每日结算信息表,记录店铺的结算信息 Service 接口
+ *
+ * @author 非繁人
+ */
+public interface PtSettlementService {
+
+    /**
+     * 创建平台每日结算信息表,记录店铺的结算信息
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createPtSettlement(@Valid PtSettlementSaveReqVO createReqVO);
+
+    /**
+     * 更新平台每日结算信息表,记录店铺的结算信息
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updatePtSettlement(@Valid PtSettlementSaveReqVO updateReqVO);
+
+    /**
+     * 删除平台每日结算信息表,记录店铺的结算信息
+     *
+     * @param id 编号
+     */
+    void deletePtSettlement(Long id);
+
+    /**
+     * 获得平台每日结算信息表,记录店铺的结算信息
+     *
+     * @param id 编号
+     * @return 平台每日结算信息表,记录店铺的结算信息
+     */
+    PtSettlementDO getPtSettlement(Long id);
+
+    /**
+     * 获得平台每日结算信息表,记录店铺的结算信息分页
+     *
+     * @param pageReqVO 分页查询
+     * @return 平台每日结算信息表,记录店铺的结算信息分页
+     */
+    PageResult<PtSettlementDO> getPtSettlementPage(PtSettlementPageReqVO pageReqVO);
+
+}

+ 71 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/ptsettlement/PtSettlementServiceImpl.java

@@ -0,0 +1,71 @@
+package cn.newfeifan.mall.module.distri.service.ptsettlement;
+
+import cn.newfeifan.mall.framework.common.pojo.PageResult;
+import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
+import cn.newfeifan.mall.module.distri.controller.admin.ptsettlement.vo.PtSettlementPageReqVO;
+import cn.newfeifan.mall.module.distri.controller.admin.ptsettlement.vo.PtSettlementSaveReqVO;
+import cn.newfeifan.mall.module.distri.dal.dataobject.ptsettlement.PtSettlementDO;
+import cn.newfeifan.mall.module.distri.dal.mysql.ptsettlement.PtSettlementMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import javax.annotation.Resource;
+
+import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.newfeifan.mall.module.distri.enums.ErrorCodeConstants.PT_SETTLEMENT_NOT_EXISTS;
+
+/**
+ * 平台每日结算信息表,记录店铺的结算信息 Service 实现类
+ *
+ * @author 非繁人
+ */
+@Service
+@Validated
+public class PtSettlementServiceImpl implements PtSettlementService {
+
+    @Resource
+    private PtSettlementMapper ptSettlementMapper;
+
+    @Override
+    public Long createPtSettlement(PtSettlementSaveReqVO createReqVO) {
+        // 插入
+        PtSettlementDO ptSettlement = BeanUtils.toBean(createReqVO, PtSettlementDO.class);
+        ptSettlementMapper.insert(ptSettlement);
+        // 返回
+        return ptSettlement.getId();
+    }
+
+    @Override
+    public void updatePtSettlement(PtSettlementSaveReqVO updateReqVO) {
+        // 校验存在
+        validatePtSettlementExists(updateReqVO.getId());
+        // 更新
+        PtSettlementDO updateObj = BeanUtils.toBean(updateReqVO, PtSettlementDO.class);
+        ptSettlementMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deletePtSettlement(Long id) {
+        // 校验存在
+        validatePtSettlementExists(id);
+        // 删除
+        ptSettlementMapper.deleteById(id);
+    }
+
+    private void validatePtSettlementExists(Long id) {
+        if (ptSettlementMapper.selectById(id) == null) {
+            throw exception(PT_SETTLEMENT_NOT_EXISTS);
+        }
+    }
+
+    @Override
+    public PtSettlementDO getPtSettlement(Long id) {
+        return ptSettlementMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<PtSettlementDO> getPtSettlementPage(PtSettlementPageReqVO pageReqVO) {
+        return ptSettlementMapper.selectPage(pageReqVO);
+    }
+
+}

+ 60 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/shopsettlement/ShopSettlementService.java

@@ -0,0 +1,60 @@
+package cn.newfeifan.mall.module.distri.service.shopsettlement;
+
+import cn.newfeifan.mall.framework.common.pojo.PageResult;
+import cn.newfeifan.mall.module.distri.controller.admin.shopsettlement.vo.ShopSettlementPageReqVO;
+import cn.newfeifan.mall.module.distri.controller.admin.shopsettlement.vo.ShopSettlementRespVO;
+import cn.newfeifan.mall.module.distri.controller.admin.shopsettlement.vo.ShopSettlementSaveReqVO;
+import cn.newfeifan.mall.module.distri.dal.dataobject.shopsettlement.ShopSettlementDO;
+
+import javax.validation.Valid;
+
+/**
+ * 订单结算信息表,记录店铺的结算信息 Service 接口
+ *
+ * @author 非繁人
+ */
+public interface ShopSettlementService {
+
+    /**
+     * 创建订单结算信息表,记录店铺的结算信息
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createShopSettlement(@Valid ShopSettlementSaveReqVO createReqVO);
+
+    /**
+     * 更新订单结算信息表,记录店铺的结算信息
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updateShopSettlement(@Valid ShopSettlementSaveReqVO updateReqVO);
+
+    /**
+     * 删除订单结算信息表,记录店铺的结算信息
+     *
+     * @param id 编号
+     */
+    void deleteShopSettlement(Long id);
+
+    /**
+     * 获得订单结算信息表,记录店铺的结算信息
+     *
+     * @param id 编号
+     * @return 订单结算信息表,记录店铺的结算信息
+     */
+    ShopSettlementDO getShopSettlement(Long id);
+
+    /**
+     * 获得订单结算信息表,记录店铺的结算信息分页
+     *
+     * @param pageReqVO 分页查询
+     * @return 订单结算信息表,记录店铺的结算信息分页
+     */
+    PageResult<ShopSettlementRespVO> getShopSettlementPage(ShopSettlementPageReqVO pageReqVO);
+
+//    /**
+//     * 结算已确权订单(也是按照每个店铺)
+//     */
+//    void settlementOrder();
+}

+ 227 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/shopsettlement/ShopSettlementServiceImpl.java

@@ -0,0 +1,227 @@
+package cn.newfeifan.mall.module.distri.service.shopsettlement;
+
+import cn.newfeifan.mall.framework.common.pojo.PageResult;
+import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
+import cn.newfeifan.mall.module.distri.constant.DistriConstants;
+import cn.newfeifan.mall.module.distri.controller.admin.shopsettlement.vo.ShopSettlementPageReqVO;
+import cn.newfeifan.mall.module.distri.controller.admin.shopsettlement.vo.ShopSettlementRespVO;
+import cn.newfeifan.mall.module.distri.controller.admin.shopsettlement.vo.ShopSettlementSaveReqVO;
+import cn.newfeifan.mall.module.distri.dal.dataobject.shopsettlement.ShopSettlementDO;
+import cn.newfeifan.mall.module.distri.dal.mysql.shopsettlement.ShopSettlementMapper;
+import cn.newfeifan.mall.module.system.controller.admin.user.vo.user.UserShopDetailsVO;
+import cn.newfeifan.mall.module.system.service.user.AdminUserService;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import javax.annotation.Resource;
+
+import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.newfeifan.mall.module.distri.enums.ErrorCodeConstants.SHOP_SETTLEMENT_NOT_EXISTS;
+
+/**
+ * 订单结算信息表,记录店铺的结算信息 Service 实现类
+ *
+ * @author 非繁人
+ */
+@Service
+@Validated
+public class ShopSettlementServiceImpl implements ShopSettlementService {
+
+    @Resource
+    private ShopSettlementMapper shopSettlementMapper;
+
+    @Resource
+    private AdminUserService userService;
+
+    @Override
+    public Long createShopSettlement(ShopSettlementSaveReqVO createReqVO) {
+        // 插入
+        ShopSettlementDO shopSettlement = BeanUtils.toBean(createReqVO, ShopSettlementDO.class);
+        shopSettlementMapper.insert(shopSettlement);
+        // 返回
+        return shopSettlement.getId();
+    }
+
+    @Override
+    public void updateShopSettlement(ShopSettlementSaveReqVO updateReqVO) {
+        // 校验存在
+        validateShopSettlementExists(updateReqVO.getId());
+        // 更新
+        ShopSettlementDO updateObj = BeanUtils.toBean(updateReqVO, ShopSettlementDO.class);
+        shopSettlementMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteShopSettlement(Long id) {
+        // 校验存在
+        validateShopSettlementExists(id);
+        // 删除
+        shopSettlementMapper.deleteById(id);
+    }
+
+    private void validateShopSettlementExists(Long id) {
+        if (shopSettlementMapper.selectById(id) == null) {
+            throw exception(SHOP_SETTLEMENT_NOT_EXISTS);
+        }
+    }
+
+    @Override
+    public ShopSettlementDO getShopSettlement(Long id) {
+        return shopSettlementMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<ShopSettlementRespVO> getShopSettlementPage(ShopSettlementPageReqVO pageReqVO) {
+
+        UserShopDetailsVO userShopDetails = userService.getUserShopDetails();
+
+        pageReqVO.setMerchantId(userShopDetails.getMerId());
+        pageReqVO.setShopId(userShopDetails.getShopId());
+
+        PageResult<ShopSettlementDO> shopSettlementDOPageResult = shopSettlementMapper.selectPage(pageReqVO);
+        PageResult<ShopSettlementRespVO> result = BeanUtils.toBean(shopSettlementDOPageResult, ShopSettlementRespVO.class);
+        for (ShopSettlementRespVO shopSettlementRespVO : result.getList()) {
+            shopSettlementRespVO.setShopName(shopSettlementMapper.getShopName(shopSettlementRespVO.getShopId()));
+        }
+        return result;
+    }
+
+    /**
+     * 把数据库的积分转换为数据库的钱
+     *
+     * @param integral 积分
+     * @return 钱
+     */
+    public static Integer integral2Money(Long integral) {
+        Long l = (integral / DistriConstants.MONEY2INTEGRAL);
+        return l.intValue();
+    }
+
+//    @Override
+//    public void settlementOrder() {
+//        //先获取所用的商户,再获取旗下的店铺,再获取店铺的订单,再计算
+//        List<MerchantDTO> merchantDTOS = dailyBillMapper.getMerchantDTO();
+//
+//        // 订单项ids
+//        Map<Long, List<Long>> shopOrderIds = new HashMap<>();
+//        Map<Long, List<Long>> shopOrderItemIds = new HashMap<>();
+//        List<ShopSettlementDO> shopSettlementDOS = new ArrayList<>();
+//
+//        Integer ptPlatformCollectionAmount = 0;
+//        // 代收积分
+//        Long ptPayIntegral = 0L;
+//        // 店铺应得金额(成本 * 数量)
+//        Integer ptShopAmount = 0;
+//        BigDecimal ptShopHighAmount = BigDecimal.ZERO;
+//
+//        for (MerchantDTO merchant : merchantDTOS) {
+//            for (Long shopId : merchant.getShopIds()) {
+//                List<OrderDTO> orders = shopSettlementMapper.getOrderByMerchantIdWithsShopId(shopId, merchant.getMerchantId());
+//                // 当前店铺没有订单,则跳过
+//                if (orders.isEmpty()) {
+//                    continue;
+//                }
+//
+//                List<Long> orderIds = new ArrayList<>();
+//                List<Long> orderItemIds = new ArrayList<>();
+//
+//                // pt代收金额
+//                Integer platformCollectionAmount = 0;
+//                // 代收积分
+//                Long payIntegral = 0L;
+//                // 店铺应得金额(成本 * 数量)
+//                Integer shopAmount = 0;
+//                BigDecimal shopHighAmount = BigDecimal.ZERO;
+//
+//                //获取该店铺下的订单
+//                for (OrderDTO order : orders) {
+//                    // 获取所有的订单id
+//                    orderIds.add(order.getId());
+//                    for (OrderItemDTO item : order.getItems()) {
+//
+//                        if(order.getId() == 246){
+//                            System.out.println("1");
+//                        }
+//
+//                        //拿到该店铺下的所有订单项id
+//                        orderItemIds.add(item.getId());
+//                        //计算订单的收入金额(pt)
+//                        platformCollectionAmount += item.getPayRmb();
+//                        ptPlatformCollectionAmount += item.getPayRmb();
+//                        //计算订单的收入积分(pt)
+//                        payIntegral += item.getPayIntegral();
+//                        ptPayIntegral += item.getPayIntegral();
+//                        // 商品的成本价(成本 * 数量)
+//                        shopAmount += item.getCostPrice() * item.getCount();
+//                        ptShopAmount += item.getCostPrice() * item.getCount();
+//                        // 商品的高精度成本价(成本 * 数量)
+//                        shopHighAmount = shopHighAmount.add(BigDecimal.valueOf(item.getHighPrecisionPrice().doubleValue() * item.getCount()));
+//                        ptShopHighAmount = ptShopHighAmount.add(BigDecimal.valueOf(item.getHighPrecisionPrice().doubleValue() * item.getCount()));
+//
+//                    }
+//                }
+//
+//                shopOrderIds.put(shopId, orderIds);
+//                shopOrderItemIds.put(shopId, orderItemIds);
+//
+//                /*
+//                  积分也是pt代收
+//                  积分要转换才能变为钱
+//                 */
+//                platformCollectionAmount += integral2Money(payIntegral);
+//
+//
+//                // 店铺共计成本金额
+//                BigDecimal totalHighAmount = shopHighAmount.add(BigDecimal.valueOf(shopAmount));
+//
+//                // 插入店铺结算信息
+//                ShopSettlementDO shopSett = ShopSettlementDO.builder()
+//                        .shopId(shopId)
+//                        .merchantId(merchant.getMerchantId())
+//                        .platformCollectionAmount(platformCollectionAmount)
+//                        .shopAmount(payIntegral)
+//                        .shopTotalHighAmount(totalHighAmount.setScale(6, RoundingMode.HALF_UP))
+//                        .build();
+//                shopSettlementDOS.add(shopSett);
+//            }
+//        }
+//
+//        ptPlatformCollectionAmount += integral2Money(ptPayIntegral);
+//        // 平台共计成本金额
+//        BigDecimal totalHighAmount = ptShopHighAmount.add(BigDecimal.valueOf(ptShopAmount));
+//
+//        // 平台每日记录
+//        PtSettlementDO ptSettlementDO = PtSettlementDO.builder()
+//                .platformCollectionAmount(ptPlatformCollectionAmount)
+//                .shopAmount(ptPayIntegral)
+//                .shopTotalHighAmount(totalHighAmount.setScale(6, RoundingMode.HALF_UP))
+//                .build();
+//        ptSettlementMapper.insert(ptSettlementDO);
+//
+//        shopSettlementDOS.forEach(shopSett -> {
+//            shopSett.setPtSettlementId(ptSettlementDO.getId());
+//            shopSettlementMapper.insert(shopSett);
+//
+//            // 插入订单结算信息(订单二级)
+//            List<Long> orderIds = shopOrderIds.get(shopSett.getShopId());
+//            orderIds.forEach(orderId -> {
+//                orderSettlementMapper.insert(OrderSettlementDO.builder()
+//                        .tradeShopSettlementId(shopSett.getId())
+//                        .tradeOrderId(orderId)
+//                        .build());
+//            });
+//
+//            // 插入订单项结算信息(订单项二级)
+//            List<Long> orderItemIds = shopOrderItemIds.get(shopSett.getShopId());
+//            orderItemIds.forEach(orderItemId -> {
+//                orderItemSettlementMapper.insert(OrderItemSettlementDO.builder()
+//                        .tradeShopSettlementId(shopSett.getId())
+//                        .tradeOrderItemId(orderItemId)
+//                        .build());
+//            });
+//            // 更新订单项的结算时间
+//            shopSettlementMapper.setOrderItemById(orderItemIds);
+//        });
+//
+//    }
+}

+ 8 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/resources/mapper/dailybill/DailyBillMapper.xml

@@ -33,4 +33,12 @@
                join trade_order_item item on item.order_id = o.id
         where shop_id = #{shopId} and merchant_id = #{merchantId} and pay_status = 1 and date(o.create_time) &lt; date(now()) and item.computation_bill = 0
     </select>
+
+    <select id="getMerchantName" resultType="java.lang.String">
+        select name from sale_merchant where id = #{merchantId}
+    </select>
+
+    <select id="getShopName" resultType="java.lang.String">
+        select name from sale_shop where id = #{shopId}
+    </select>
 </mapper>

+ 1 - 1
feifan-module-distri/feifan-module-distri-biz/src/main/resources/mapper/ptprofit/PtProfitMapper.xml

@@ -1,6 +1,6 @@
 <?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="cn.newfeifan.mall.module.distri.dal.ptprofit.PtProfitMapper">
+<mapper namespace="cn.newfeifan.mall.module.distri.dal.mysql.ptprofit.PtProfitMapper">
 
     <!--
         一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。

+ 1 - 1
feifan-module-distri/feifan-module-distri-biz/src/main/resources/mapper/ptprofitlog/PtProfitLogMapper.xml

@@ -1,6 +1,6 @@
 <?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="cn.newfeifan.mall.module.distri.dal.ptprofitlog.PtProfitLogMapper">
+<mapper namespace="cn.newfeifan.mall.module.distri.dal.mysql.ptprofitlog.PtProfitLogMapper">
 
     <!--
         一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。

+ 12 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/resources/mapper/ptsettlement/PtSettlementMapper.xml

@@ -0,0 +1,12 @@
+<?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="cn.newfeifan.mall.module.distri.dal.mysql.ptsettlement.PtSettlementMapper">
+
+    <!--
+        一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
+        无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
+        代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
+        文档可见:https://www.zhongxing.cn/MyBatis/x-plugins/
+     -->
+
+</mapper>

+ 47 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/resources/mapper/shopsettlement/ShopSettlementMapper.xml

@@ -0,0 +1,47 @@
+<?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="cn.newfeifan.mall.module.distri.dal.mysql.shopsettlement.ShopSettlementMapper">
+
+    <!--
+        一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
+        无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
+        代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
+        文档可见:https://www.zhongxing.cn/MyBatis/x-plugins/
+     -->
+
+    <resultMap id="BaseResultMap" type="cn.newfeifan.mall.module.distri.service.dailybill.dto.OrderDTO">
+        <id column="id" property="id" />
+        <collection ofType="list" property="items" select="getOrderItem" column="id">
+        </collection>
+    </resultMap>
+    <update id="setOrderItemById">
+        update trade_order_item
+        set settlement_time = now()
+        where id in
+            <foreach item="ids" collection="ids" open="(" separator="," close=")">
+                #{ids}
+            </foreach>
+    </update>
+
+    <select id="getOrderByMerchantIdWithsShopId"
+            resultMap="BaseResultMap">
+        select id,no from trade_order
+        where pay_status = 1
+        and deleted = 0
+        and status = 30
+        and shop_id = #{shopId}
+        and merchant_id = #{merchantId}
+        and date(receiving_time) <![CDATA[ <= ]]> DATE_SUB(now(),INTERVAL 7 DAY)
+    </select>
+
+    <select id="getOrderItem" resultType="cn.newfeifan.mall.module.distri.service.dailybill.dto.OrderItemDTO">
+        select id,order_id,count,price,delivery_price,pay_price,high_precision_price,promotion_fee,cost_price,pay_integral,pay_rmb from trade_order_item
+        where deleted = 0
+          and settlement_time is null
+          and after_sale_status = 0
+          and order_id = #{id}
+    </select>
+    <select id="getShopName" resultType="java.lang.String">
+            select name from sale_shop where id = #{shopId}
+    </select>
+</mapper>

+ 2 - 0
feifan-module-mall/feifan-module-trade-api/src/main/java/cn/newfeifan/mall/module/trade/enums/DictTypeConstants.java

@@ -8,5 +8,7 @@ package cn.newfeifan.mall.module.trade.enums;
 public interface DictTypeConstants {
 
     String BROKERAGE_WITHDRAW_STATUS = "brokerage_withdraw_status"; // 佣金提现状态
+    Integer ONE_HUNDRED = 100;      //百倍
+    Integer MILLION = 1000000;      //百万倍
 
 }

+ 47 - 2
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/TradeOrderController.java

@@ -3,7 +3,10 @@ package cn.newfeifan.mall.module.trade.controller.admin.order;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.newfeifan.mall.framework.common.pojo.CommonResult;
+import cn.newfeifan.mall.framework.common.pojo.PageParam;
 import cn.newfeifan.mall.framework.common.pojo.PageResult;
+import cn.newfeifan.mall.framework.excel.core.util.ExcelUtils;
+import cn.newfeifan.mall.framework.operatelog.core.annotations.OperateLog;
 import cn.newfeifan.mall.module.member.api.user.MemberUserApi;
 import cn.newfeifan.mall.module.member.api.user.dto.MemberUserRespDTO;
 import cn.newfeifan.mall.module.pay.controller.admin.order.vo.PayOrderPageItemRespVO;
@@ -13,6 +16,8 @@ import cn.newfeifan.mall.module.pay.dal.dataobject.app.PayAppDO;
 import cn.newfeifan.mall.module.pay.dal.dataobject.order.PayOrderDO;
 import cn.newfeifan.mall.module.pay.service.app.PayAppService;
 import cn.newfeifan.mall.module.pay.service.order.PayOrderService;
+import cn.newfeifan.mall.module.trade.controller.admin.order.excelVO.DailyBillOrderRespVO;
+import cn.newfeifan.mall.module.trade.controller.admin.order.excelVO.SettlementOrderRespVO;
 import cn.newfeifan.mall.module.trade.controller.admin.order.vo.*;
 import cn.newfeifan.mall.module.trade.convert.order.TradeOrderConvert;
 import cn.newfeifan.mall.module.trade.dal.dataobject.order.TradeOrderDO;
@@ -42,7 +47,9 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
+import java.io.IOException;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
@@ -52,6 +59,7 @@ import static cn.newfeifan.mall.framework.common.pojo.CommonResult.success;
 import static cn.newfeifan.mall.framework.common.util.collection.CollectionUtils.convertList;
 import static cn.newfeifan.mall.framework.common.util.collection.CollectionUtils.convertSet;
 import static cn.newfeifan.mall.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+import static cn.newfeifan.mall.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
 import static cn.newfeifan.mall.module.trade.enums.ErrorCodeConstants.CALLBACK_PARAMETER_ERROR;
 
 @Tag(name = "管理后台 - 交易订单")
@@ -70,8 +78,6 @@ public class TradeOrderController {
     @Resource
     private MemberUserApi memberUserApi;
     @Resource
-    private AfterSaleService afterSaleService;
-    @Resource
     private PayOrderService orderService;
     @Resource
     private PayAppService appService;
@@ -308,5 +314,44 @@ public class TradeOrderController {
         return success(data);
     }
 
+    @GetMapping("/export-excel/shopSettlement")
+    @Operation(summary = "导出每日结算单 Excel")
+    @PreAuthorize("@ss.hasPermission('trade:order:export')")
+    @OperateLog(type = EXPORT)
+    public void exportOrderExcelShopSettlement(@Valid TradeOrderPageReqVO pageReqVO, HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+
+        List<SettlementOrderRespVO> list = TradeOrderConvert.INSTANCE.convertSettOrder(tradeOrderQueryService.getOrderPage(pageReqVO).getList());
+        // 导出 Excel
+        ExcelUtils.write(response, "每日账单.xls", "数据", SettlementOrderRespVO.class,
+                list);
+    }
+
+    @GetMapping("/export-excel/dailyBill")
+    @Operation(summary = "导出每日账单下的订单 Excel")
+    @PreAuthorize("@ss.hasPermission('trade:order:export')")
+    @OperateLog(type = EXPORT)
+    public void exportOrderExcelByDailyBill(@Valid TradeOrderPageReqVO pageReqVO, HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+
+        List<DailyBillOrderRespVO> list = TradeOrderConvert.INSTANCE.convertDailyBillOrder(tradeOrderQueryService.getOrderPage(pageReqVO).getList());
+        // 导出 Excel
+        ExcelUtils.write(response, "每日账单下的订单.xls", "数据", DailyBillOrderRespVO.class,
+                list);
+    }
+
+    @GetMapping("/export-excel")
+    @Operation(summary = "导出订单 Excel")
+    @PreAuthorize("@ss.hasPermission('trade:order:export')")
+    @OperateLog(type = EXPORT)
+    public void exportOrderExcel(@Valid TradeOrderPageReqVO pageReqVO, HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+
+        List<TradeOrderRespVO> list = TradeOrderConvert.INSTANCE.convertOrderList(tradeOrderQueryService.getOrderPage(pageReqVO).getList());
+        // 导出 Excel
+        ExcelUtils.write(response, "每日账单下的订单.xls", "数据", TradeOrderRespVO.class,
+                list);
+    }
+
 
 }

+ 37 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/excelVO/DailyBillOrderRespVO.java

@@ -0,0 +1,37 @@
+package cn.newfeifan.mall.module.trade.controller.admin.order.excelVO;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Schema(description = "管理后台 - 账单订单 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class DailyBillOrderRespVO {
+    @Schema(description = "订单流水号", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("订单号")
+    private String no;
+
+    @Schema(description = "应付金额(总),单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "26217")
+    @ExcelProperty("金额")
+    private Double payPrice;
+
+    @Schema(description = "应付金额(总),单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "26217")
+    @ExcelProperty("确收金额")
+    private Double payCash;
+
+    @Schema(description = "退款金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "23373")
+    @ExcelProperty("退款金额")
+    private Double refundPrice;
+
+    @Schema(description = "支付积分")
+    @ExcelProperty("积分抵扣")
+    private Double payIntegral;
+
+    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("下单时间")
+    private LocalDateTime createTime;
+}

+ 38 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/excelVO/SettlementOrderRespVO.java

@@ -0,0 +1,38 @@
+package cn.newfeifan.mall.module.trade.controller.admin.order.excelVO;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Schema(description = "管理后台 - 结算订单 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class SettlementOrderRespVO {
+    @Schema(description = "订单号", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("订单号")
+    private String no;
+
+    @Schema(description = "应付金额(总)", requiredMode = Schema.RequiredMode.REQUIRED, example = "26217")
+    @ExcelProperty("销售额")
+    private Double payPrice;
+
+    @Schema(description = "确收现金")
+    @ExcelProperty("确收现金")
+    private Double payCash;
+
+    @Schema(description = "退款金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "23373")
+    @ExcelProperty("退款金额")
+    private Double refundPrice;
+
+    @Schema(description = "支付积分")
+    @ExcelProperty("确收积分")
+    private Double payIntegral;
+
+    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("下单时间")
+    private LocalDateTime createTime;
+
+}

+ 3 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/vo/TradeOrderPageReqVO.java

@@ -103,4 +103,7 @@ public class TradeOrderPageReqVO extends PageParam {
 
     @Schema(description = "支付状态")
     private Integer payStatus;
+
+    @Schema(description = "店铺结算单ID")
+    private Long shopSettlementId;
 }

+ 220 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/vo/TradeOrderRespVO.java

@@ -0,0 +1,220 @@
+package cn.newfeifan.mall.module.trade.controller.admin.order.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Schema(description = "管理后台 - 交易订单 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class TradeOrderRespVO {
+
+    @Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12286")
+    private Long id;
+
+    @Schema(description = "订单流水号", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("订单号")
+    private String no;
+
+    @Schema(description = "订单类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
+    private Integer type;
+
+    @Schema(description = "订单来源终端", requiredMode = Schema.RequiredMode.REQUIRED)
+    private Integer terminal;
+
+    @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "29815")
+    private Long userId;
+
+    @Schema(description = "用户 IP", requiredMode = Schema.RequiredMode.REQUIRED)
+    private String userIp;
+
+    @Schema(description = "用户备注", example = "你说的对")
+    @ExcelProperty("用户备注")
+    private String userRemark;
+
+    @Schema(description = "订单状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+    private Integer status;
+
+    @Schema(description = "购买的商品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "2870")
+    @ExcelProperty("购买的商品数量")
+    private Integer productCount;
+
+    @Schema(description = "取消类型", example = "2")
+    private Integer cancelType;
+
+    @Schema(description = "商家备注", example = "随便")
+    @ExcelProperty("商家备注")
+    private String remark;
+
+    @Schema(description = "是否评价", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+    private Boolean commentStatus;
+
+    @Schema(description = "推广人编号", example = "29343")
+    private Long brokerageUserId;
+
+    @Schema(description = "支付订单编号", example = "4697")
+    private Long payOrderId;
+
+    @Schema(description = "是否已支付:[0:未支付 1:已经支付过]", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+    private Boolean payStatus;
+
+
+    @Schema(description = "支付成功的支付渠道")
+    private String payChannelCode;
+
+    @Schema(description = "商品原价(总),单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1317")
+    @ExcelProperty("商品原价(总)")
+    private Double totalPrice;
+
+    @Schema(description = "订单优惠(总),单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "6113")
+    private Integer discountPrice;
+
+    @Schema(description = "运费金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "29782")
+    @ExcelProperty("运费金额")
+    private Double deliveryPrice;
+
+    @Schema(description = "订单调价(总),单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "25923")
+    private Integer adjustPrice;
+
+    @Schema(description = "应付金额(总),单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "26217")
+    @ExcelProperty("应付金额(总)")
+    private Double payPrice;
+
+    @Schema(description = "配送类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
+    private Integer deliveryType;
+
+    @Schema(description = "发货物流公司编号", example = "9174")
+    private Long logisticsId;
+
+    @Schema(description = "物流公司单号")
+    @ExcelProperty("物流公司单号")
+    private String logisticsNo;
+
+    @Schema(description = "发货时间")
+    @ExcelProperty("发货时间")
+    private LocalDateTime deliveryTime;
+
+    @Schema(description = "收货时间")
+    @ExcelProperty("收货时间")
+    private LocalDateTime receiveTime;
+
+    @Schema(description = "收件人名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
+    @ExcelProperty("收件人名称")
+    private String receiverName;
+
+    @Schema(description = "收件人手机", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("收件人手机")
+    private String receiverMobile;
+
+    @Schema(description = "收件人地区编号", example = "6830")
+    private Integer receiverAreaId;
+
+    @Schema(description = "收件人详细地址")
+    @ExcelProperty("收件人详细地址")
+    private String receiverDetailAddress;
+
+    @Schema(description = "自提门店编号", example = "24448")
+    private Long pickUpStoreId;
+
+    @Schema(description = "自提核销码")
+    private String pickUpVerifyCode;
+
+    @Schema(description = "售后状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+    private Integer refundStatus;
+
+    @Schema(description = "退款金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "23373")
+    @ExcelProperty("退款金额")
+    private Double refundPrice;
+
+    @Schema(description = "优惠劵编号", example = "20033")
+    private Long couponId;
+
+    @Schema(description = "优惠劵减免金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "14111")
+    private Integer couponPrice;
+
+    @Schema(description = "使用的积分", requiredMode = Schema.RequiredMode.REQUIRED)
+    private Integer usePoint;
+
+    @Schema(description = "积分抵扣的金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048")
+    private Integer pointPrice;
+
+    @Schema(description = "赠送的积分", requiredMode = Schema.RequiredMode.REQUIRED)
+    private Integer givePoint;
+
+    @Schema(description = "退还的使用的积分", requiredMode = Schema.RequiredMode.REQUIRED)
+    private Integer refundPoint;
+
+    @Schema(description = "VIP 减免金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "15488")
+    private Integer vipPrice;
+
+    @Schema(description = "秒杀活动编号", example = "9127")
+    private Long seckillActivityId;
+
+    @Schema(description = "砍价活动编号", example = "4171")
+    private Long bargainActivityId;
+
+    @Schema(description = "砍价记录编号", example = "11074")
+    private Long bargainRecordId;
+
+    private Long combinationActivityId;
+
+    @Schema(description = "拼团团长编号", example = "23766")
+    private Long combinationHeadId;
+
+    @Schema(description = "拼团记录编号", example = "17475")
+    private Long combinationRecordId;
+
+    @Schema(description = "店铺id", example = "21281")
+    private Long shopId;
+
+    @Schema(description = "商户id", example = "25201")
+    private Long merchantId;
+
+    @Schema(description = "支付积分")
+    @ExcelProperty("支付积分")
+    private Double payIntegral;
+
+    @Schema(description = "用户获得积分")
+    private Long increaseIntegral;
+
+    @Schema(description = "退还的使用的积分")
+    @ExcelProperty("退还的使用的积分")
+    private Double refundIntegral;
+
+    @Schema(description = "实付人民币,单位:分")
+    private Integer payRmb;
+
+    @Schema(description = "订阅物流信息,未订阅是0,已订阅是1", requiredMode = Schema.RequiredMode.REQUIRED)
+    private Integer subscriptionLogisticsInfo;
+
+    @Schema(description = "发货备注", example = "你猜")
+    @ExcelProperty("发货备注")
+    private String deliveryRemark;
+
+    @Schema(description = "物流签收时间")
+    @ExcelProperty("物流签收时间")
+    private LocalDateTime receivingTime;
+
+    @Schema(description = "发货信息附件")
+    private String attachment;
+
+    @Schema(description = "订单支付时间")
+    @ExcelProperty("订单支付时间")
+    private LocalDateTime payTime;
+
+    @Schema(description = "订单完成时间")
+    @ExcelProperty("订单完成时间")
+    private LocalDateTime finishTime;
+
+    @Schema(description = "订单取消时间")
+    @ExcelProperty("订单取消时间")
+    private LocalDateTime cancelTime;
+
+    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("创建时间")
+    private LocalDateTime createTime;
+
+}

+ 49 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/convert/order/TradeOrderConvert.java

@@ -4,6 +4,7 @@ import cn.hutool.core.util.BooleanUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.newfeifan.mall.framework.common.pojo.PageResult;
 import cn.newfeifan.mall.framework.common.util.collection.CollectionUtils;
+import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
 import cn.newfeifan.mall.framework.common.util.string.StrUtils;
 import cn.newfeifan.mall.framework.dict.core.util.DictFrameworkUtils;
 import cn.newfeifan.mall.framework.ip.core.utils.AreaUtils;
@@ -20,6 +21,8 @@ import cn.newfeifan.mall.module.promotion.api.combination.dto.CombinationRecordC
 import cn.newfeifan.mall.module.trade.api.order.dto.TradeOrderRespDTO;
 import cn.newfeifan.mall.module.trade.controller.admin.base.member.user.MemberUserRespVO;
 import cn.newfeifan.mall.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO;
+import cn.newfeifan.mall.module.trade.controller.admin.order.excelVO.DailyBillOrderRespVO;
+import cn.newfeifan.mall.module.trade.controller.admin.order.excelVO.SettlementOrderRespVO;
 import cn.newfeifan.mall.module.trade.controller.admin.order.vo.*;
 import cn.newfeifan.mall.module.trade.controller.app.base.property.AppProductPropertyValueDetailRespVO;
 import cn.newfeifan.mall.module.trade.controller.app.order.vo.*;
@@ -49,6 +52,8 @@ import java.util.Map;
 import static cn.newfeifan.mall.framework.common.util.collection.CollectionUtils.convertMap;
 import static cn.newfeifan.mall.framework.common.util.collection.CollectionUtils.convertMultiMap;
 import static cn.newfeifan.mall.framework.common.util.date.LocalDateTimeUtils.addTime;
+import static cn.newfeifan.mall.module.trade.enums.DictTypeConstants.MILLION;
+import static cn.newfeifan.mall.module.trade.enums.DictTypeConstants.ONE_HUNDRED;
 
 @Mapper
 public interface TradeOrderConvert {
@@ -290,4 +295,48 @@ public interface TradeOrderConvert {
 
     Object convert(TradeOrderDO order, List<TradeOrderItemDO> orderItems, List<TradeOrderLogDO> orderLogs, MemberUserRespDTO user, MemberUserRespDTO brokerageUser, TradeOrderProperties tradeOrderProperties, DeliveryExpressDO express);
 
+    default List<SettlementOrderRespVO> convertSettOrder(List<TradeOrderDO> list) {
+        List<SettlementOrderRespVO> respVOS = BeanUtils.toBean(list, SettlementOrderRespVO.class);
+        for (SettlementOrderRespVO respVO : respVOS) {
+            respVO.setPayPrice(respVO.getPayPrice() / ONE_HUNDRED);
+            respVO.setRefundPrice(respVO.getRefundPrice() / ONE_HUNDRED);
+            respVO.setPayIntegral(respVO.getPayIntegral() / MILLION);
+
+            respVO.setPayCash(respVO.getPayPrice() - respVO.getRefundPrice());
+
+        }
+        return respVOS;
+    }
+
+    default List<DailyBillOrderRespVO> convertDailyBillOrder(List<TradeOrderDO> list) {
+        List<DailyBillOrderRespVO> respVOS = BeanUtils.toBean(list, DailyBillOrderRespVO.class);
+        for (DailyBillOrderRespVO respVO : respVOS) {
+            respVO.setPayPrice(respVO.getPayPrice() / ONE_HUNDRED);
+            respVO.setRefundPrice(respVO.getRefundPrice() / ONE_HUNDRED);
+            respVO.setPayIntegral(respVO.getPayIntegral() / MILLION);
+            respVO.setPayCash(respVO.getPayPrice() - respVO.getRefundPrice());
+        }
+        return respVOS;
+    }
+
+    default List<TradeOrderRespVO> convertOrderList(List<TradeOrderDO> list) {
+        List<TradeOrderRespVO> respVOS = BeanUtils.toBean(list, TradeOrderRespVO.class);
+
+        for (TradeOrderRespVO respVO : respVOS) {
+            respVO.setTotalPrice(respVO.getTotalPrice() / ONE_HUNDRED);
+            respVO.setDeliveryPrice(respVO.getDeliveryPrice() / ONE_HUNDRED);
+            respVO.setPayPrice(respVO.getPayPrice() / ONE_HUNDRED);
+            respVO.setRefundPrice(respVO.getRefundPrice() / ONE_HUNDRED);
+            respVO.setPayIntegral(respVO.getPayIntegral() / MILLION);
+
+            if (respVO.getRefundIntegral() == null) {
+                respVO.setRefundIntegral(0.0);
+            } else {
+                respVO.setRefundIntegral(respVO.getRefundIntegral() / MILLION);
+            }
+
+        }
+
+        return respVOS;
+    }
 }

+ 2 - 1
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/dal/mysql/order/TradeOrderMapper.java

@@ -34,7 +34,7 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
         return selectOne(TradeOrderDO::getId, id, TradeOrderDO::getUserId, userId);
     }
 
-    default PageResult<TradeOrderDO> selectPage(TradeOrderPageReqVO reqVO, Set<Long> userIds) {
+    default PageResult<TradeOrderDO> selectPage(TradeOrderPageReqVO reqVO, Set<Long> userIds, List<Long> orderIds) {
         LambdaQueryWrapperX<TradeOrderDO> queryWrapper = new LambdaQueryWrapperX<TradeOrderDO>()
                 .likeIfPresent(TradeOrderDO::getNo, reqVO.getNo())
                 .eqIfPresent(TradeOrderDO::getUserId, reqVO.getUserId())
@@ -48,6 +48,7 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
                 .eqIfPresent(TradeOrderDO::getShopId, reqVO.getShopId())
                 .eqIfPresent(TradeOrderDO::getPayStatus, reqVO.getPayStatus())
                 .inIfPresent(TradeOrderDO::getPickUpStoreId, reqVO.getPickUpStoreIds())
+                .inIfPresent(TradeOrderDO::getId, orderIds)
                 .likeIfPresent(TradeOrderDO::getPickUpVerifyCode, reqVO.getPickUpVerifyCode())
                 .betweenIfPresent(TradeOrderDO::getCreateTime, reqVO.getCreateTime())
                 .orderByDesc(TradeOrderDO::getId);

+ 10 - 4
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/order/TradeOrderQueryServiceImpl.java

@@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.extra.spring.SpringUtil;
 import cn.newfeifan.mall.framework.common.pojo.PageResult;
+import cn.newfeifan.mall.module.distri.dal.mysql.ordersettlement.OrderSettlementMapper;
 import cn.newfeifan.mall.module.member.api.user.MemberUserApi;
 import cn.newfeifan.mall.module.member.api.user.dto.MemberUserRespDTO;
 import cn.newfeifan.mall.module.pay.controller.admin.order.vo.PayOrderPageItemRespVO;
@@ -69,9 +70,6 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
     @Resource
     private MemberUserApi memberUserApi;
 
-    @Resource
-    private ProductSkuApi productSkuApi;
-
     @Resource
     private AdminUserService userService;
 
@@ -82,6 +80,9 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
     @Resource
     private ProductSpuService productSpuService;
 
+    @Resource
+    private OrderSettlementMapper orderSettlementMapper;
+
 
     // =================== Order ===================
 
@@ -125,8 +126,13 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
         reqVO.setMerchantId(userShopDetails.getMerId());
         reqVO.setShopId(userShopDetails.getShopId());
 
+        List<Long> orderIds = null;
+        if (reqVO.getShopSettlementId() != null) {
+            orderIds = orderSettlementMapper.selectOrderIdsByShopSettlementId(reqVO.getShopSettlementId());
+        }
+
         // 分页查询
-        PageResult<TradeOrderDO> tradeOrderDOPageResult = tradeOrderMapper.selectPage(reqVO, userIds);
+        PageResult<TradeOrderDO> tradeOrderDOPageResult = tradeOrderMapper.selectPage(reqVO, userIds,orderIds);
         if (reqVO.getStatus() != null && reqVO.getStatus().equals(TradeOrderStatusEnum.AFTER_SALE.getStatus())) {
             for (TradeOrderDO tradeOrderDO : tradeOrderDOPageResult.getList()) {
                 tradeOrderDO.setStatus(TradeOrderStatusEnum.AFTER_SALE.getStatus());