diff --git a/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/AuthController.java b/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/AuthController.java
index 331a1ee1..4aa63024 100644
--- a/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/AuthController.java
+++ b/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/AuthController.java
@@ -6,6 +6,7 @@ import cc.hiver.base.vo.RegisterShopVo;
import cc.hiver.core.common.annotation.RateLimiter;
import cc.hiver.core.common.annotation.SystemLog;
import cc.hiver.core.common.constant.AppToBConstant;
+import cc.hiver.core.common.constant.CommonConstant;
import cc.hiver.core.common.constant.SecurityConstant;
import cc.hiver.core.common.constant.UserConstant;
import cc.hiver.core.common.enums.LogType;
@@ -22,12 +23,14 @@ import cc.hiver.core.service.UserRoleService;
import cc.hiver.core.service.UserService;
import cc.hiver.mall.entity.Shop;
import cc.hiver.mall.entity.ShopUser;
+import cc.hiver.mall.entity.Supplier;
import cc.hiver.mall.invitelog.constant.InviteLogConstant;
import cc.hiver.mall.invitelog.entity.InviteLog;
import cc.hiver.mall.invitelog.service.InviteLogService;
import cc.hiver.mall.pojo.vo.ShopVo;
import cc.hiver.mall.service.ShopService;
import cc.hiver.mall.service.ShopUserService;
+import cc.hiver.mall.service.SupplierService;
import cc.hiver.mall.service.mybatis.ProductCategoryService;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.IdUtil;
@@ -105,6 +108,9 @@ public class AuthController {
@Autowired
private InviteLogService inviteLogService;
+ @Autowired
+ private SupplierService supplierService;
+
@RequestMapping(value = "/login", method = RequestMethod.POST)
@SystemLog(description = "账号登录", type = LogType.LOGIN)
@ApiOperation("账号/手机/邮箱登录")
@@ -417,6 +423,15 @@ public class AuthController {
final String categoryId = productCategoryService.addCategoryOfShop();
shop.setAttrId(categoryId);
shopService.save(shop);
+ // 20240625新增默认供应商
+ final Supplier supplier = new Supplier();
+ supplier.setShopId(shop.getId());
+ supplier.setConsigneeName("默认供应商");
+ supplier.setCreateBy(user.getId());
+ supplier.setCreateTime(new Date());
+ supplier.setConsigneeMobile("");
+ supplier.setDelFlag(CommonConstant.DEL_FLAG_FALSE);
+ supplierService.save(supplier);
return ResultUtil.data(user);
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/controller/BillController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/controller/BillController.java
new file mode 100644
index 00000000..b306aeab
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/controller/BillController.java
@@ -0,0 +1,51 @@
+package cc.hiver.mall.bill.controller;
+
+import cc.hiver.core.common.utils.ResultUtil;
+import cc.hiver.core.common.vo.Result;
+import cc.hiver.mall.bill.service.BillService;
+import cc.hiver.mall.bill.vo.CustomerBillDataVo;
+import cc.hiver.mall.bill.vo.CustomerBillQueryVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 对账单
+ *
+ * @author 王富康
+ * @date 2024/6/26
+ */
+@Slf4j
+@RestController
+@Api(tags = "盘点接口")
+@RequestMapping("/hiver/app/bill/")
+public class BillController {
+
+ @Autowired
+ private BillService billService;
+
+ /**
+ * 获取客户对账单
+ *
+ * @param customerBillQueryVo
+ * @return Result
+ * @author 王富康
+ * @date 2024/6/26
+ */
+ @PostMapping("/getCustomerBill")
+ @ApiOperation("获取客户对账单")
+ public Result getCustomerBill(@RequestBody CustomerBillQueryVo customerBillQueryVo) {
+ try {
+ final CustomerBillDataVo customerBill = billService.getCustomerBill(customerBillQueryVo);
+ return new ResultUtil<>().setData(customerBill);
+ } catch (Exception e) {
+ log.error("获取客户对账单异常", e);
+ return ResultUtil.error("获取客户对账单异常");
+ }
+ }
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/service/BillService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/service/BillService.java
new file mode 100644
index 00000000..dc19ba52
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/service/BillService.java
@@ -0,0 +1,17 @@
+package cc.hiver.mall.bill.service;
+
+import cc.hiver.mall.bill.vo.CustomerBillDataVo;
+import cc.hiver.mall.bill.vo.CustomerBillQueryVo;
+
+public interface BillService {
+
+ /**
+ * 获取客户对账单
+ *
+ * @param customerBillQueryVo
+ * @return Result
+ * @author 王富康
+ * @date 2024/6/26
+ */
+ CustomerBillDataVo getCustomerBill(CustomerBillQueryVo customerBillQueryVo);
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/service/impl/BillServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/service/impl/BillServiceImpl.java
new file mode 100644
index 00000000..102d1ab6
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/service/impl/BillServiceImpl.java
@@ -0,0 +1,210 @@
+package cc.hiver.mall.bill.service.impl;
+
+import cc.hiver.mall.bill.service.BillService;
+import cc.hiver.mall.bill.vo.*;
+import cc.hiver.mall.entity.Customer;
+import cc.hiver.mall.entity.ReturnDetail;
+import cc.hiver.mall.entity.SaleDetail;
+import cc.hiver.mall.service.mybatis.*;
+import cc.hiver.mall.utils.DateUtil;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.*;
+
+@Service
+public class BillServiceImpl implements BillService {
+
+ @Autowired
+ private SaleService saleService;
+
+ @Autowired
+ private CustomerService customerService;
+
+ @Autowired
+ private SaleDetailService saleDetailService;
+
+ @Autowired
+ private ReturnSaleService returnSaleService;
+
+ @Autowired
+ private ReturnDetailService returnDetailService;
+
+ /**
+ * 获取客户对账单
+ *
+ * @param customerBillQueryVo
+ * @return Result
+ * @author 王富康
+ * @date 2024/6/26
+ */
+ @Override
+ public CustomerBillDataVo getCustomerBill(CustomerBillQueryVo customerBillQueryVo) {
+ final CustomerBillDataVo customerBillDataVo = new CustomerBillDataVo();
+ customerBillDataVo.setUserId(customerBillQueryVo.getCustomerId());
+ // 获取客户信息
+ final Customer customer = customerService.getById(customerBillQueryVo.getCustomerId());
+ customerBillDataVo.setUserName(customer.getName());
+ customerBillDataVo.setQueryDate(DateUtil.COMMON_FULL.getDateText(new Date()));
+ // 获取本期全部欠款及拿货总金额
+ final ArrearsVo saleArrearsVo = saleService.getArrearsAndTotalSale(customerBillQueryVo);
+ if (saleArrearsVo != null) {
+ customerBillDataVo.setArrears(saleArrearsVo.getArrears());
+ customerBillDataVo.setTotalSale(saleArrearsVo.getTotalSale());
+ }
+
+ // 获取退货总金额
+ final ArrearsVo returnSaleArrearsVo = returnSaleService.getTotalReturn(customerBillQueryVo);
+ if (returnSaleArrearsVo != null) {
+ customerBillDataVo.setTotalReturn(returnSaleArrearsVo.getTotalReturn());
+ }
+ // 获取退货总金额
+
+ // 根据客户id及日期范围分页查询订单
+ final Page
salePage = saleService.getCustomerBill(customerBillQueryVo);
+ final List records = salePage.getRecords();
+ // 获取saleId,去查询销售单的商品明细,及退货单的商品明细
+ final List saleIdList = new ArrayList<>();
+ for (int i = 0; i < records.size(); i++) {
+ saleIdList.add(records.get(i).getSaleId());
+ // 根据时间升序查询的,这里获取第一个的初期欠款当做本次查询的初期欠款
+ if (i == 0) {
+ final BigDecimal lastDebtAmount = records.get(0).getLastDebtAmount();
+ customerBillDataVo.setInitialArrears(lastDebtAmount);
+ }
+ // 获取最后一个的剩余欠款当做本次查询的剩余欠款
+ if (i == records.size() - 1) {
+ customerBillDataVo.setEndArrears(records.get(i).getBalanceDue());
+ }
+ }
+ if (!saleIdList.isEmpty()) {
+ // 获取销售单明细
+ final List saleDetailList = saleDetailService.getSaleDetails(saleIdList);
+ // 将销售明细封装到销售单对象中
+ final Map> saleDetailMap = new HashMap<>();
+ for (SaleDetail saleDetail : saleDetailList) {
+ final String saleId = saleDetail.getSaleId();
+ if (saleDetailMap.containsKey(saleId)) {
+ final List saleDetailListOfMap = saleDetailMap.get(saleId);
+ saleDetailListOfMap.add(saleDetail);
+ } else {
+ final List saleDetailListOfMap = new ArrayList<>();
+ saleDetailListOfMap.add(saleDetail);
+ saleDetailMap.put(saleId, saleDetailListOfMap);
+ }
+ }
+ // 获取退货单明细
+ final List returnDetails = returnDetailService.getReturnDetails(saleIdList);
+ final Map> returnSaleDetailMap = new HashMap<>();
+ for (ReturnDetail returnDetail : returnDetails) {
+ final String saleId = returnDetail.getSaleId();
+ if (returnSaleDetailMap.containsKey(saleId)) {
+ final List returnDetailListOfMap = returnSaleDetailMap.get(saleId);
+ returnDetailListOfMap.add(returnDetail);
+ } else {
+ final List returnDetailListOfMap = new ArrayList<>();
+ returnDetailListOfMap.add(returnDetail);
+ returnSaleDetailMap.put(saleId, returnDetailListOfMap);
+ }
+ }
+ // 开始封装数据
+ for (CustomerBillSaleVo customerBillSaleVo : records) {
+ final String saleId = customerBillSaleVo.getSaleId();
+ // 封装销售单信息
+ final List saleDetails = saleDetailMap.get(saleId);
+ // 根据商品id分类
+ final Map> saleDetailMapOfSale = new HashMap<>();
+ if (saleDetails != null && !saleDetails.isEmpty()) {
+ for (SaleDetail saleDetail : saleDetails) {
+ final String productId = saleDetail.getProductId();
+ if (saleDetailMapOfSale.containsKey(productId)) {
+ final List saleDetailListOfMap = saleDetailMapOfSale.get(productId);
+ saleDetailListOfMap.add(saleDetail);
+ } else {
+ final List saleDetailListOfMap = new ArrayList<>();
+ saleDetailListOfMap.add(saleDetail);
+ saleDetailMapOfSale.put(productId, saleDetailListOfMap);
+ }
+ }
+ final List billSaleDetailVos = new ArrayList<>();
+ for (Map.Entry> stringListEntry : saleDetailMapOfSale.entrySet()) {
+ final List value = stringListEntry.getValue();
+ final BillProductDetailVo billProductDetailVo = new BillProductDetailVo();
+ // 同一款商品,不同规格,商品信息值几钱取第一个
+ billProductDetailVo.setProductSn(value.get(0).getProductSn());
+ billProductDetailVo.setProductName(value.get(0).getProductName());
+ billProductDetailVo.setDiscountAmount(value.get(0).getDiscountAmount());
+ int productCount = 0;
+ BigDecimal totalAmount = BigDecimal.ZERO;
+ final List billAttributeListVos = new ArrayList<>();
+ for (SaleDetail saleDetail : value) {
+ final BillAttributeListVo billAttributeListVo = new BillAttributeListVo();
+ billAttributeListVo.setAttributeList(saleDetail.getAttributeList());
+ billAttributeListVo.setProductCount(saleDetail.getProductCount());
+ billAttributeListVos.add(billAttributeListVo);
+ // 计算数量
+ productCount += saleDetail.getProductCount();
+ // 计算总金额
+ totalAmount = totalAmount.add(saleDetail.getDiscountAmount().multiply(BigDecimal.valueOf(saleDetail.getProductCount())));
+ }
+ billProductDetailVo.setProductCount(productCount);
+ billProductDetailVo.setTotalAmount(totalAmount);
+ billProductDetailVo.setBillAttributeListVos(billAttributeListVos);
+ billSaleDetailVos.add(billProductDetailVo);
+ }
+ customerBillSaleVo.setBillSaleDetailVos(billSaleDetailVos);
+ }
+
+ // 封装退货单信息
+ final List returnDetailsOfSale = returnSaleDetailMap.get(saleId);
+ if (returnDetailsOfSale != null && !returnDetailsOfSale.isEmpty()) {
+ // 根据商品id分类
+ final Map> returnSaleDetailMapOfSale = new HashMap<>();
+ for (ReturnDetail returnDetail : returnDetailsOfSale) {
+ final String productId = returnDetail.getProductId();
+ if (returnSaleDetailMapOfSale.containsKey(productId)) {
+ final List returnSaleDetails = returnSaleDetailMapOfSale.get(productId);
+ returnSaleDetails.add(returnDetail);
+ } else {
+ final List returnDetailListOfMap = new ArrayList<>();
+ returnDetailListOfMap.add(returnDetail);
+ returnSaleDetailMapOfSale.put(productId, returnDetailListOfMap);
+ }
+ }
+ final List billReturnSaleDetailVos = new ArrayList<>();
+ for (Map.Entry> stringListEntry : returnSaleDetailMapOfSale.entrySet()) {
+ final List returnDetailList = stringListEntry.getValue();
+ final BillProductDetailVo billProductDetailVo = new BillProductDetailVo();
+ // 同一款商品,不同规格,商品信息值几钱取第一个
+ billProductDetailVo.setProductSn(returnDetailList.get(0).getProductSn());
+ billProductDetailVo.setProductName(returnDetailList.get(0).getProductName());
+ billProductDetailVo.setDiscountAmount(returnDetailList.get(0).getDiscountAmount());
+ int productCount = 0;
+ BigDecimal totalAmount = BigDecimal.ZERO;
+ final List billAttributeListVos = new ArrayList<>();
+ for (ReturnDetail saleDetail : returnDetailList) {
+ final BillAttributeListVo billAttributeListVo = new BillAttributeListVo();
+ billAttributeListVo.setAttributeList(saleDetail.getAttributeList());
+ billAttributeListVo.setProductCount(saleDetail.getProductCount());
+ billAttributeListVos.add(billAttributeListVo);
+ // 计算数量
+ productCount += saleDetail.getProductCount();
+ // 计算总金额
+ totalAmount = totalAmount.add(saleDetail.getDiscountAmount().multiply(BigDecimal.valueOf(saleDetail.getProductCount())));
+ }
+ billProductDetailVo.setProductCount(productCount);
+ billProductDetailVo.setTotalAmount(totalAmount);
+ billProductDetailVo.setBillAttributeListVos(billAttributeListVos);
+ billReturnSaleDetailVos.add(billProductDetailVo);
+ }
+ customerBillSaleVo.setBillReturnSaleDetailVos(billReturnSaleDetailVos);
+ }
+ }
+ }
+
+ customerBillDataVo.setCustomerBillSaleVos(records);
+ return customerBillDataVo;
+ }
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/ArrearsVo.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/ArrearsVo.java
new file mode 100644
index 00000000..f84e4c60
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/ArrearsVo.java
@@ -0,0 +1,18 @@
+package cc.hiver.mall.bill.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class ArrearsVo {
+ @ApiModelProperty(value = "本期欠款金额")
+ private BigDecimal arrears;
+
+ @ApiModelProperty(value = "拿货总金额")
+ private BigDecimal totalSale;
+
+ @ApiModelProperty(value = "退货总金额")
+ private BigDecimal totalReturn;
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/BillAttributeListVo.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/BillAttributeListVo.java
new file mode 100644
index 00000000..8afa8ed4
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/BillAttributeListVo.java
@@ -0,0 +1,19 @@
+package cc.hiver.mall.bill.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 规格明细
+ * @author 王富康
+ * @date 2024/6/26
+ */
+@Data
+public class BillAttributeListVo {
+
+ @ApiModelProperty(value = "商品具体属性")
+ private String attributeList;
+
+ @ApiModelProperty(value = "销售数量")
+ private Integer productCount;
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/BillProductDetailVo.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/BillProductDetailVo.java
new file mode 100644
index 00000000..e162edc3
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/BillProductDetailVo.java
@@ -0,0 +1,35 @@
+package cc.hiver.mall.bill.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 商品明细
+ *
+ * @author 王富康
+ * @date 2024/6/26
+ */
+@Data
+public class BillProductDetailVo {
+
+ @ApiModelProperty(value = "商品名称")
+ private String productName;
+
+ @ApiModelProperty(value = "货号")
+ private String productSn;
+
+ @ApiModelProperty(value = "销售数量")
+ private Integer productCount;
+
+ @ApiModelProperty(value = "优惠金额")
+ private BigDecimal discountAmount;
+
+ @ApiModelProperty(value = "总价")
+ private BigDecimal totalAmount;
+
+ @ApiModelProperty(value = "同一件商品购买属性列表")
+ private List billAttributeListVos;
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/CustomerBillDataVo.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/CustomerBillDataVo.java
new file mode 100644
index 00000000..404a2297
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/CustomerBillDataVo.java
@@ -0,0 +1,44 @@
+package cc.hiver.mall.bill.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 对账单信息
+ * @author 王富康
+ * @date 2024/6/26
+ */
+@Data
+public class CustomerBillDataVo {
+
+ @ApiModelProperty(value = "客户id")
+ private String userId;
+
+ @ApiModelProperty(value = "客户名称")
+ private String userName;
+
+ @ApiModelProperty(value = "对账单日期")
+ private String queryDate;
+
+ @ApiModelProperty(value = "初期欠款金额")
+ private BigDecimal initialArrears;
+
+ @ApiModelProperty(value = "期末欠款金额")
+ private BigDecimal endArrears;
+
+ @ApiModelProperty(value = "本期欠款金额")
+ private BigDecimal arrears;
+
+ @ApiModelProperty(value = "拿货总金额")
+ private BigDecimal totalSale;
+
+ @ApiModelProperty(value = "退货总金额")
+ private BigDecimal totalReturn;
+
+ @ApiModelProperty(value = "销售单明细")
+ private List customerBillSaleVos;
+
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/CustomerBillQueryVo.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/CustomerBillQueryVo.java
new file mode 100644
index 00000000..96e5ebdc
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/CustomerBillQueryVo.java
@@ -0,0 +1,23 @@
+package cc.hiver.mall.bill.vo;
+
+import cc.hiver.core.base.HiverBasePageQuery;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 对账单查询参数
+ * @author 王富康
+ * @date 2024/6/26
+ */
+@Data
+public class CustomerBillQueryVo extends HiverBasePageQuery {
+
+ @ApiModelProperty(value = "客户id")
+ private String customerId;
+
+ @ApiModelProperty(value = "开始时间")
+ private String startDate;
+
+ @ApiModelProperty(value = "结束时间")
+ private String endDate;
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/CustomerBillSaleVo.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/CustomerBillSaleVo.java
new file mode 100644
index 00000000..d9d33431
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/bill/vo/CustomerBillSaleVo.java
@@ -0,0 +1,64 @@
+package cc.hiver.mall.bill.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 销售单明细
+ * @author 王富康
+ * @date 2024/6/26
+ */
+@Data
+public class CustomerBillSaleVo {
+
+ @ApiModelProperty(value = "销售单号")
+ private String saleId;
+
+ @ApiModelProperty(value = "操作人")
+ private String createByName;
+
+ @ApiModelProperty(value = "日期")
+ private String createTime;
+
+ @ApiModelProperty(value = "订单金额(销售金额)")
+ private BigDecimal totalAmount;
+
+ @ApiModelProperty(value="退款总金额")
+ private BigDecimal returnSaleTotalAmount;
+
+ @ApiModelProperty(value="欠款抵扣金额")
+ private BigDecimal debtDeductionAmount;
+
+ @ApiModelProperty(value="销售抵扣金额")
+ private BigDecimal saleDeductionAmount;
+
+ @ApiModelProperty(value="余额抵扣金额")
+ private BigDecimal balanceDeductionAmount;
+
+ @ApiModelProperty(value = "实收金额")
+ private BigDecimal realAmount;
+
+ @ApiModelProperty(value = "已收")
+ private BigDecimal alreadyEarn;
+
+ @ApiModelProperty(value = "上次欠款")
+ private BigDecimal lastDebtAmount;
+
+ @ApiModelProperty(value = "本单欠款")
+ private BigDecimal amount;
+
+ @ApiModelProperty(value = "剩余欠款-更新后欠款")
+ private BigDecimal balanceDue;
+
+ @ApiModelProperty(value = "交易类型:0:开单;1:退货;2:回款")
+ private Integer dealingsType;
+
+ @ApiModelProperty(value = "销售明细")
+ private List billSaleDetailVos;
+
+ @ApiModelProperty(value = "退货明细")
+ private List billReturnSaleDetailVos;
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/common/constant/StockLogConstant.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/common/constant/StockLogConstant.java
new file mode 100644
index 00000000..79d5b54e
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/common/constant/StockLogConstant.java
@@ -0,0 +1,15 @@
+package cc.hiver.mall.common.constant;
+
+/**
+ * 店铺常量
+ *
+ * @author cc
+ */
+public interface StockLogConstant {
+
+ /**
+ * 出入库类型(0-入库;1-出库)
+ */
+ Integer[] CHANGE_TYPE = {0,1};
+
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductController.java
index 2ebdf1f5..f6e4f427 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductController.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductController.java
@@ -59,10 +59,10 @@ public class ProductController {
final String attrId = productCategoryService.batchSaveCategoryAndAttribute(productCategoryVo);
// 更新店铺尺码库
productCategoryService.batchSaveCategoryOfShop(productCategoryVo);
- if(StringUtils.isNotEmpty(attrId)){
+ if (StringUtils.isNotEmpty(attrId)) {
// 回填分类id
product.setAttrId(attrId);
- }else{
+ } else {
return ResultUtil.error("添加分类信息失败");
}
// shopId从缓存中设置
@@ -99,10 +99,10 @@ public class ProductController {
final String attrId = productCategoryService.batchSaveCategoryAndAttribute(productCategoryVo);
// 更新店铺尺码库
productCategoryService.batchSaveCategoryOfShop(productCategoryVo);
- if(StringUtils.isNotEmpty(attrId)){
+ if (StringUtils.isNotEmpty(attrId)) {
// 回填分类id
product.setAttrId(attrId);
- }else{
+ } else {
return ResultUtil.error("添加分类信息失败");
}
final boolean result = productService.updateById(product);
@@ -138,6 +138,36 @@ public class ProductController {
}
}
+ /**
+ * 根据货品id批量上架货品
+ *
+ * @param ids
+ * @return Result
+ * @author 王富康
+ * @date 2024/6/22
+ */
+ @RequestMapping(value = "/batchUp", method = RequestMethod.POST)
+ @ApiOperation("根据货品id批量上架货品")
+ public Result batchUp(String ids) {
+ if (StringUtils.isEmpty(ids)) {
+ return ResultUtil.error("请选择要上架的货品");
+ }
+ final boolean result = productService.batchUp(ids);
+ if (result) {
+ return ResultUtil.success("上架成功");
+ } else {
+ return ResultUtil.error("上架失败");
+ }
+ }
+
+ /**
+ * 根据货品id下架货品
+ *
+ * @param id
+ * @return Result
+ * @author 王富康
+ * @date 2024/6/22
+ */
@RequestMapping(value = "/down", method = RequestMethod.POST)
@ApiOperation("根据货品id下架货品")
public Result down(String id) {
@@ -152,6 +182,28 @@ public class ProductController {
}
}
+ /**
+ * 根据货品id批量下架货品
+ *
+ * @param ids
+ * @return Result
+ * @author 王富康
+ * @date 2024/6/22
+ */
+ @RequestMapping(value = "/batchDown", method = RequestMethod.POST)
+ @ApiOperation("根据货品id批量下架货品")
+ public Result batchDown(String ids) {
+ if (StringUtils.isEmpty(ids)) {
+ return ResultUtil.error("请选择要下架的货品");
+ }
+ final boolean result = productService.batchDown(ids);
+ if (result) {
+ return ResultUtil.success("下架成功");
+ } else {
+ return ResultUtil.error("下架失败");
+ }
+ }
+
@RequestMapping(value = "/delById", method = RequestMethod.POST)
@ApiOperation("根据id删除货品")
public Result delete(String id) {
@@ -186,7 +238,7 @@ public class ProductController {
final QueryWrapper queryWrapper = new QueryWrapper<>();
// shopId从缓存中设置
final String shopId = securityUtil.getShopId();
- queryWrapper.eq("shop_id",shopId);
+ queryWrapper.eq("shop_id", shopId);
final List list = productService.list(queryWrapper);
return new ResultUtil>().setData(list);
}
@@ -198,7 +250,7 @@ public class ProductController {
queryWrapper.eq("del_flag", 1);
// shopId从缓存中设置
final String shopId = securityUtil.getShopId();
- queryWrapper.eq("shop_id",shopId);
+ queryWrapper.eq("shop_id", shopId);
final List list = productService.list(queryWrapper);
return new ResultUtil>().setData(list);
}
@@ -210,7 +262,7 @@ public class ProductController {
queryWrapper.like("product_name", name);
// shopId从缓存中设置
final String shopId = securityUtil.getShopId();
- queryWrapper.eq("shop_id",shopId);
+ queryWrapper.eq("shop_id", shopId);
final List list = productService.list(queryWrapper);
return new ResultUtil>().setData(list);
}
@@ -249,13 +301,14 @@ public class ProductController {
public Result> getByProductSn(String productSn) {
// shopId从缓存中设置
final String shopId = securityUtil.getShopId();
- final List byProductSn = productService.getByProductSn(productSn,shopId);
+ final List byProductSn = productService.getByProductSn(productSn, shopId);
if (byProductSn != null) {
return new ResultUtil>().setData(byProductSn);
} else {
return ResultUtil.success("未查到对应商品信息!");
}
}
+
@RequestMapping(value = "/getByBarcode", method = RequestMethod.POST)
@ApiOperation("根据条码获取商品信息")
public Result> getByBarcode(String barcode) {
@@ -269,9 +322,9 @@ public class ProductController {
@RequestMapping(value = "/getByUserIdAndProductId", method = RequestMethod.POST)
@ApiOperation("获取客户最近购买的商品价格及数量")
- public Result getByUserIdAndProductId(String userId,String productId) {
+ public Result getByUserIdAndProductId(String userId, String productId) {
- final ProductLastBuyVo byProductSn = productService.getByUserIdAndProductId( userId, productId);
+ final ProductLastBuyVo byProductSn = productService.getByUserIdAndProductId(userId, productId);
if (byProductSn != null) {
return new ResultUtil().setData(byProductSn);
} else {
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ReturnSaleController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ReturnSaleController.java
index 0c63ab56..9497ba7e 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ReturnSaleController.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ReturnSaleController.java
@@ -15,6 +15,8 @@ import cc.hiver.mall.pojo.dto.ReturnSaleDetailDTO;
import cc.hiver.mall.pojo.dto.SaleDetailDTO;
import cc.hiver.mall.pojo.dto.SaleDetailQueryDTO;
import cc.hiver.mall.pojo.dto.SaleReturnDTO;
+import cc.hiver.mall.pojo.query.ReturnSalePageQuery;
+import cc.hiver.mall.pojo.vo.ReturnSaleVo;
import cc.hiver.mall.pojo.vo.SaleComVO;
import cc.hiver.mall.pojo.vo.SaleQueryVO;
import cc.hiver.mall.pojo.vo.SaleReturnVO;
@@ -22,6 +24,7 @@ import cc.hiver.mall.service.*;
import cc.hiver.mall.service.mybatis.*;
import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -100,10 +103,10 @@ public class ReturnSaleController {
final ReturnSale returnSale = returnSaleService.getById(id);
// 增加配送人员信息
final String transportType = returnSale.getTransportType();
- if(!SaleConstant.TRANSPORT_TYPE[2].equals(transportType)){
+ if (!SaleConstant.TRANSPORT_TYPE[2].equals(transportType)) {
//非自提查询配送人员信息
final OrderXd orderData = orderService.findByOrderId(id);
- if(orderData != null && StringUtils.isNotEmpty(orderData.getOrderByWorker())){
+ if (orderData != null && StringUtils.isNotEmpty(orderData.getOrderByWorker())) {
final String workerName = orderData.getWorker().getWorkerName();
// 查询到之后回填值列表
returnSale.setWorkerName(workerName);
@@ -135,6 +138,8 @@ public class ReturnSaleController {
saleDetailDTO.setDiscount(returnDetail.getDiscount());
saleDetailDTO.setDiscountAmount(returnDetail.getDiscountAmount());
saleDetailDTO.setRealPrice(returnDetail.getRealPrice());
+ saleDetailDTO.setProductPicture(returnDetail.getProductPicture());
+ saleDetailDTO.setProductSn(returnDetail.getProductSn());
final SaleDetailQueryDTO saleDetailQueryDTO = new SaleDetailQueryDTO();
saleDetailQueryDTO.setAttributeList(returnDetail.getAttributeList());
@@ -343,7 +348,7 @@ public class ReturnSaleController {
if (!StringUtils.isEmpty(saleComVO.getSaleId())) {
// 根据销售单id,查询该销售单所有的退货信息
queryWrapper.eq("sale_id", saleComVO.getSaleId());
- }else{
+ } else {
// 如果没有saleId,则说明店铺查询所有的欠款列表。
// shopId从缓存中设置
final String shopId = securityUtil.getShopId();
@@ -379,11 +384,11 @@ public class ReturnSaleController {
for (ReturnSale record : saleList) {
final String id = record.getId();
final String transportType = record.getTransportType();
- if(!SaleConstant.TRANSPORT_TYPE[2].equals(transportType)){
+ if (!SaleConstant.TRANSPORT_TYPE[2].equals(transportType)) {
//非自提查询配送人员信息
final OrderXd orderData = orderService.findByOrderId(id);
// 订单的所属拉包工不为空的时候订单中的woker才会有值,所以这里判断所属拉包工id是否为空。
- if(orderData != null && orderData.getWorker() != null && StringUtils.isNotEmpty(orderData.getOrderByWorker())){
+ if (orderData != null && orderData.getWorker() != null && StringUtils.isNotEmpty(orderData.getOrderByWorker())) {
final String workerName = orderData.getWorker().getWorkerName();
// 查询到之后回填值列表
record.setWorkerName(workerName);
@@ -441,4 +446,30 @@ public class ReturnSaleController {
orderService.delete(orderId);
return ResultUtil.success("取消配送成功");
}
+
+ /**
+ * 查询退货单列表接口deflag=0。(根据阶段日期、操作人、客户(模糊搜索)+指定客户搜索)需要关联查出来 退货金额、之前欠款、欠款抵扣、笨蛋欠款、累计欠款等数据(加分页)
+ *
+ * @param returnSaleVo
+ * @return Result
+ * @author 王富康
+ * @date 2024/6/26
+ */
+ @RequestMapping(value = "/getReturnSaleList", method = RequestMethod.POST)
+ @ApiOperation("退货列表")
+ public Result getReturnSaleList(@RequestBody ReturnSaleVo returnSaleVo) {
+ // shopId从缓存中设置
+ final String shopId = securityUtil.getShopId();
+ returnSaleVo.setShopId(shopId);
+ final IPage result = returnSaleService.getReturnSaleList(returnSaleVo);
+ return new ResultUtil>().setData(result);
+ }
+
+ @RequestMapping(value = "/getReturnSaleListByProductId", method = RequestMethod.POST)
+ @ApiOperation("根据商品id分页获取退货历史")
+ public Result getReturnSaleListByProductId(ReturnSalePageQuery returnSalePageQuery) {
+ // 分页获取销售单历史
+ final Page salePage = returnSaleService.getReturnSaleListByProductId(returnSalePageQuery);
+ return ResultUtil.data(salePage);
+ }
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SaleController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SaleController.java
index d1ea486f..4914ce63 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SaleController.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SaleController.java
@@ -1,6 +1,7 @@
package cc.hiver.mall.controller;
import cc.hiver.core.common.annotation.RateLimiter;
+import cc.hiver.core.common.constant.CommonConstant;
import cc.hiver.core.common.constant.SaleConstant;
import cc.hiver.core.common.constant.WorkerConstant;
import cc.hiver.core.common.utils.BeanUtils;
@@ -146,7 +147,7 @@ public class SaleController {
// 20240616 开单可能值包含退货单
Sale sale = saleQueryDTO.getSale();
// 处理销售商品信息
- if(saleQueryDTO.getSaleDetailList() != null && !saleQueryDTO.getSaleDetailList().isEmpty()){
+ if (saleQueryDTO.getSaleDetailList() != null && !saleQueryDTO.getSaleDetailList().isEmpty()) {
// 1. 处理商品信息,新商品进行新商品的新增,分类及规格的新增,分类库的新增,子图的新增
saleQueryDTO = productService.handleProduct(saleQueryDTO);
// 2.处理订单表模块
@@ -187,15 +188,23 @@ public class SaleController {
}
}
- }else{
+ } else {
// 销售单只有退货信息,补充一些基本信息,保存销售单
+ // 获取销售员的手机号
+ final User currUser = securityUtil.getCurrUser();
+ sale.setCreateBy(currUser.getId());
+ sale.setCreateByName(currUser.getNickname());
+ sale.setCreateByPhone(currUser.getMobile());
+ sale.setCreateTime(new Date());
+ sale.setDelFlag(CommonConstant.DEL_FLAG_FALSE);
+ sale.setStatus(SaleConstant.SALE_STATUS[4]);
saleService.save(sale);
// 只有退货,单独处理下客户欠款
}
// 如果退货信息不为空,那么则代表需要退货,处理退货信息
// 处理退货信息
- if(saleQueryDTO.getSaleReturnDTO() != null ){
+ if (saleQueryDTO.getSaleReturnDTO() != null) {
//处理退货信息
final SaleReturnDTO saleReturnDTO = saleQueryDTO.getSaleReturnDTO();
// 回填销售单id
@@ -217,12 +226,12 @@ public class SaleController {
final BigDecimal debtDeductionAmount = saleQueryDTO.getSale().getDebtDeductionAmount();
// 余额抵扣金额
final BigDecimal balanceDeductionAmount = saleQueryDTO.getSale().getBalanceDeductionAmount();
- if(noEarn.compareTo(BigDecimal.valueOf(0)) != 0 || debtDeductionAmount.compareTo(BigDecimal.valueOf(0)) != 0 || balanceDeductionAmount.compareTo(BigDecimal.valueOf(0)) != 0){
+ if (noEarn.compareTo(BigDecimal.valueOf(0)) != 0 || debtDeductionAmount.compareTo(BigDecimal.valueOf(0)) != 0 || balanceDeductionAmount.compareTo(BigDecimal.valueOf(0)) != 0) {
debtService.saleToDebt(saleQueryDTO);
}
- return new ResultUtil<>().setData(sale.getId(),"下单成功");
- }catch (Exception e){
- log.error(e.getMessage(),e);
+ return new ResultUtil<>().setData(sale.getId(), "下单成功");
+ } catch (Exception e) {
+ log.error(e.getMessage(), e);
return ResultUtil.error("下单失败");
}
}
@@ -464,6 +473,13 @@ public class SaleController {
final String shopId = sale.getShopId();
final Shop shop = shopService.get(shopId);
saleNewVO.setShop(shop);
+
+ // 获取本单的欠款交易记录
+ final List dealingsRecords = dealingsRecordService.getDealingsRecordList(id);
+ // 正常一个单子只会生成一条交易记录,这里直接获取第一条就行
+ if (dealingsRecords != null && !dealingsRecords.isEmpty()) {
+ saleNewVO.setDealingsRecord(dealingsRecords.get(0));
+ }
return new ResultUtil().setData(saleNewVO);
}
@@ -542,10 +558,10 @@ public class SaleController {
}
final String dateText = DateUtil.COMMON.getDateText(new Date());
startTime = saleVO.getStartTime() == null ? dateText : saleVO.getStartTime();
- if(StringUtils.isEmpty(saleVO.getEndTime())){
+ if (StringUtils.isEmpty(saleVO.getEndTime())) {
// 为空,使用当前日期+1
endTime = DateUtil.getAfterDayTime(dateText, 1);
- }else{
+ } else {
// 不为空,使用传参日期+1
endTime = DateUtil.getAfterDayTime(saleVO.getEndTime(), 1);
}
@@ -1057,4 +1073,30 @@ public class SaleController {
return ResultUtil.error("转单失败!");
}
}
+
+ /**
+ * 撤销销售单
+ * (1)订单回退(订单作废、库存退回)
+ * (2)款项记录作废(查询的时候也要关联deflag=0),同时把款项回退(当前欠款+欠款抵扣-余额抵扣-笨蛋欠款)
+ * (3)如果有退货:退货表和detail作废,同时把库存退回去
+ *
+ * @param id
+ * @return Result
+ * @author 王富康
+ * @date 2024/6/26
+ */
+ @RequestMapping(value = "/cancelSale", method = RequestMethod.POST)
+ @ApiOperation("撤销销售单")
+ public Result cancelSale(String id) {
+ if (StringUtils.isEmpty(id)) {
+ ResultUtil.error("订单id不能为空!");
+ }
+ try {
+ saleService.cancelSale(id);
+ return ResultUtil.success("撤销成功");
+ } catch (Exception e) {
+ log.error(e.getMessage(), e);
+ return ResultUtil.error("撤销失败!");
+ }
+ }
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/DealingsRecordMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/DealingsRecordMapper.java
index 39356463..90521b0b 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/DealingsRecordMapper.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/DealingsRecordMapper.java
@@ -24,4 +24,12 @@ public interface DealingsRecordMapper extends BaseMapper {
* @date 2024/6/16
*/
List getDealingsRecordListByUserId(@Param("userId") String userId, @Param("shopId") String shopId);
+
+ /**
+ * 作废交易记录
+ * @author 王富康
+ * @date 2024/6/26
+ * @param saleId
+ */
+ void cancelRecord(@Param("saleId") String saleId);
}
\ No newline at end of file
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ProductMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ProductMapper.java
index 5c25a908..bd944b6a 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ProductMapper.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ProductMapper.java
@@ -43,17 +43,17 @@ public interface ProductMapper extends BaseMapper {
List getProductListOfShop(String shopId);
- CopyOnWriteArrayList getByProductSn(@Param("productSn")String productSn,@Param("shopId") String shopId);
+ CopyOnWriteArrayList getByProductSn(@Param("productSn") String productSn, @Param("shopId") String shopId);
- ProductLastBuyVo getByUserIdAndProductId(@Param("userId")String userId, @Param("productId") String productId);
+ ProductLastBuyVo getByUserIdAndProductId(@Param("userId") String userId, @Param("productId") String productId);
Product getByIdOrBrcode(String id);
- List getByBarcode(@Param("barcode")String barcode,@Param("shopId") String shopId);
+ List getByBarcode(@Param("barcode") String barcode, @Param("shopId") String shopId);
CopyOnWriteArrayList getProductByProductSnList(@Param("productSnList") List productSnList, @Param("shopId") String shopId);
- CopyOnWriteArrayList getProductByProductNameList(@Param("productNameList") List productNameList,@Param("shopId") String shopId);
+ CopyOnWriteArrayList getProductByProductNameList(@Param("productNameList") List productNameList, @Param("shopId") String shopId);
/**
* 删除分类时,根据分类id删除商品信息
@@ -65,4 +65,14 @@ public interface ProductMapper extends BaseMapper {
void deleteProductByCategoryId(@Param("categoryId") String categoryId);
void batchSaveProduct(@Param("addProductList") List addProductList);
+
+ /**
+ * 批量上架、下架、删除
+ *
+ * @param idList
+ * @param delFlag
+ * @author 王富康
+ * @date 2024/6/22
+ */
+ void batchUpdateDelFlag(@Param("idList") List idList, @Param("delFlag") Integer delFlag);
}
\ No newline at end of file
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ReturnDetailMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ReturnDetailMapper.java
index c55a6e21..ec8e0aee 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ReturnDetailMapper.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ReturnDetailMapper.java
@@ -2,7 +2,6 @@ package cc.hiver.mall.dao.mapper;
import cc.hiver.mall.entity.ReturnDetail;
import cc.hiver.mall.entity.ReturnDetailExample;
-import cc.hiver.mall.entity.Sale;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@@ -32,4 +31,6 @@ public interface ReturnDetailMapper extends BaseMapper {
int updateByPrimaryKeySelective(ReturnDetail record);
int updateByPrimaryKey(ReturnDetail record);
+
+ List getReturnDetails(@Param("saleIdList") List saleIdList);
}
\ No newline at end of file
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ReturnSaleMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ReturnSaleMapper.java
index f021180d..1395edd8 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ReturnSaleMapper.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ReturnSaleMapper.java
@@ -1,11 +1,14 @@
package cc.hiver.mall.dao.mapper;
-import cc.hiver.mall.entity.ReturnDetail;
+import cc.hiver.mall.bill.vo.ArrearsVo;
+import cc.hiver.mall.bill.vo.CustomerBillQueryVo;
import cc.hiver.mall.entity.ReturnSale;
import cc.hiver.mall.entity.ReturnSaleExample;
-import cc.hiver.mall.entity.SaleExample;
+import cc.hiver.mall.pojo.dto.SaleReturnDTO;
+import cc.hiver.mall.pojo.vo.ReturnSaleVo;
import cc.hiver.mall.pojo.vo.SaleAllVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@@ -39,4 +42,10 @@ public interface ReturnSaleMapper extends BaseMapper {
SaleAllVO saleMaxAmount(ReturnSaleExample returnSaleExample);
ReturnSale getBySaleId(String id);
+
+ List getReturnSaleList(Page page,@Param("queryParams") ReturnSaleVo returnSaleVo);
+
+ ArrearsVo getTotalReturn(@Param("customerBillQueryVo") CustomerBillQueryVo customerBillQueryVo);
+
+ Page getReturnSaleListByProductId(Page page,@Param("productId") String productId);
}
\ No newline at end of file
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/SaleDetailMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/SaleDetailMapper.java
index 5ad93eb3..f2655005 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/SaleDetailMapper.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/SaleDetailMapper.java
@@ -41,4 +41,6 @@ public interface SaleDetailMapper extends BaseMapper {
List listOfShopAll(@Param("shopId") String shopId,@Param("startDate") String startDate,@Param("endDate") String endDate);
void putInUpdatePurchasePrice(@Param("purchaseDetails") List purchaseDetails);
+
+ List getSaleDetails(@Param("saleIdList") List saleIdList);
}
\ No newline at end of file
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/SaleMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/SaleMapper.java
index f537c7f4..85ac29c6 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/SaleMapper.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/SaleMapper.java
@@ -1,5 +1,8 @@
package cc.hiver.mall.dao.mapper;
+import cc.hiver.mall.bill.vo.ArrearsVo;
+import cc.hiver.mall.bill.vo.CustomerBillQueryVo;
+import cc.hiver.mall.bill.vo.CustomerBillSaleVo;
import cc.hiver.mall.entity.Sale;
import cc.hiver.mall.entity.SaleExample;
import cc.hiver.mall.pojo.dto.ShopRevenue;
@@ -84,4 +87,8 @@ public interface SaleMapper extends BaseMapper {
void updateStatus(@Param("id")String id, @Param("status") Integer status);
List queryTotalAlreadyEarnDetail(@Param("shopId") String shopId,@Param("startTime") String startTime,@Param("endTime") String endTime);
+
+ Page getCustomerBill(Page page,@Param("customerBillQueryVo") CustomerBillQueryVo customerBillQueryVo);
+
+ ArrearsVo getArrearsAndTotalSale( @Param("customerBillQueryVo") CustomerBillQueryVo customerBillQueryVo);
}
\ No newline at end of file
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/StockMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/StockMapper.java
index b46c4eb3..e9d962c2 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/StockMapper.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/StockMapper.java
@@ -44,5 +44,9 @@ public interface StockMapper extends BaseMapper {
List getProductStock(@Param("productId")String productId);
+ List getProductsStock(@Param("productIds")List productIds);
+
void putInUpdatePurchasePrice(@Param("purchaseDetails") List purchaseDetails);
+
+ Stock getByProductIdAndAttributeList(@Param("productId") String productId, @Param("attributeList") String attributeList);
}
\ No newline at end of file
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/mapper/DebtMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/mapper/DebtMapper.java
index aad242c7..7ceb9181 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/mapper/DebtMapper.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/mapper/DebtMapper.java
@@ -6,8 +6,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
+import java.util.List;
+
public interface DebtMapper extends BaseMapper {
Page getDebtByShopId(Page page, @Param("queryDebtVo") QueryDebtVo queryDebtVo);
Debt selectByUserId(@Param("shopId")String shopId, @Param("userId") String userId);
+
+ List getDebtByUserIds(@Param("userIds") List userIds);
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/service/DebtService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/service/DebtService.java
index 31690c7a..dcfd5b4d 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/service/DebtService.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/service/DebtService.java
@@ -5,6 +5,8 @@ import cc.hiver.mall.debt.vo.QueryDebtVo;
import cc.hiver.mall.pojo.dto.SaleQueryDTO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import java.util.List;
+
public interface DebtService {
/**
@@ -41,6 +43,21 @@ public interface DebtService {
*/
// void returnSaleToDebt(SaleQueryDTO saleQueryDTO);
- // 回款20240610新回款
+ /**
+ * 根据客户或者供应商id获取欠款信息
+ * @author 王富康
+ * @date 2024/6/22
+ * @param userIds
+ * @return List
+ */
+ List getDebtByUserIds(List userIds);
+ /**
+ * 根据客户id获取欠款信息
+ * @author 王富康
+ * @date 2024/6/26
+ * @param userId
+ * @return Debt
+ */
+ Debt selectByUserId(String userId);
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/service/impl/DebtServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/service/impl/DebtServiceImpl.java
index 346ef4f8..c0b4e9df 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/service/impl/DebtServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/service/impl/DebtServiceImpl.java
@@ -23,6 +23,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Date;
+import java.util.List;
@Service
public class DebtServiceImpl extends ServiceImpl implements DebtService {
@@ -201,9 +202,18 @@ public class DebtServiceImpl extends ServiceImpl implements De
dealingsRecord.setDealingsWay("开单");
dealingsRecord.setShopId(shopId);
// 销售金额
- dealingsRecord.setSaleAmount(saleQueryDTO.getSale().getTotalAmount());
+ if(!saleQueryDTO.getSaleDetailList().isEmpty()){
+ dealingsRecord.setSaleAmount(saleQueryDTO.getSale().getTotalAmount());
+ }else{
+ dealingsRecord.setSaleAmount(BigDecimal.valueOf(0));
+ }
+
// 退货金额
- dealingsRecord.setReturnAmount(saleQueryDTO.getSaleReturnDTO().getReturnSale().getTotalAmount());
+ if(saleQueryDTO.getSaleReturnDTO() != null){
+ dealingsRecord.setReturnAmount(saleQueryDTO.getSaleReturnDTO().getReturnSale().getTotalAmount());
+ }else{
+ dealingsRecord.setReturnAmount(BigDecimal.valueOf(0));
+ }
// 上次欠款
dealingsRecord.setLastDebtAmount(lastDebtAmount);
// 最新欠款
@@ -212,4 +222,12 @@ public class DebtServiceImpl extends ServiceImpl implements De
dealingsRecord.setDealingsType(DealingsRecordConstant.DEALINGS_TYPE[0]);
dealingsRecordService.save(dealingsRecord);
}
+
+ @Override
+ public List getDebtByUserIds(List userIds) {
+ return debtMapper.getDebtByUserIds(userIds);
+ }
+ public Debt selectByUserId(String userId){
+ return debtMapper.selectByUserId(securityUtil.getShopId(),userId);
+ }
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ReturnDetail.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ReturnDetail.java
index 50d0733c..a9f4398b 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ReturnDetail.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ReturnDetail.java
@@ -3,11 +3,13 @@ package cc.hiver.mall.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
+@Data
@ApiModel(value = "退货单明细表")
@TableName(value = "t_return_detail", autoResultMap = true)
public class ReturnDetail implements Serializable {
@@ -68,200 +70,11 @@ public class ReturnDetail implements Serializable {
@ApiModelProperty(value = "实际价格")
private BigDecimal realPrice;
- private static final long serialVersionUID = 1L;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getCreateBy() {
- return createBy;
- }
-
- public void setCreateBy(String createBy) {
- this.createBy = createBy;
- }
-
- public Date getCreateTime() {
- return createTime;
- }
-
- public void setCreateTime(Date createTime) {
- this.createTime = createTime;
- }
-
- public Integer getDelFlag() {
- return delFlag;
- }
-
- public void setDelFlag(Integer delFlag) {
- this.delFlag = delFlag;
- }
-
- public String getUpdateBy() {
- return updateBy;
- }
-
- public void setUpdateBy(String updateBy) {
- this.updateBy = updateBy;
- }
-
- public Date getUpdateTime() {
- return updateTime;
- }
-
- public void setUpdateTime(Date updateTime) {
- this.updateTime = updateTime;
- }
-
- public String getSaleId() {
- return saleId;
- }
-
- public void setSaleId(String saleId) {
- this.saleId = saleId;
- }
-
- public String getProductId() {
- return productId;
- }
-
- public void setProductId(String productId) {
- this.productId = productId;
- }
-
- public String getProductName() {
- return productName;
- }
-
- public void setProductName(String productName) {
- this.productName = productName;
- }
-
- public String getUnit() {
- return unit;
- }
-
- public void setUnit(String unit) {
- this.unit = unit;
- }
-
- public String getShopId() {
- return shopId;
- }
+ @ApiModelProperty(value = "商品图片")
+ private String productPicture;
- public void setShopId(String shopId) {
- this.shopId = shopId;
- }
+ @ApiModelProperty(value = "货号")
+ private String productSn;
- public String getCategoryId() {
- return categoryId;
- }
-
- public void setCategoryId(String categoryId) {
- this.categoryId = categoryId;
- }
-
- public String getAttributeList() {
- return attributeList;
- }
-
- public void setAttributeList(String attributeList) {
- this.attributeList = attributeList;
- }
-
- public BigDecimal getPrice() {
- return price;
- }
-
- public void setPrice(BigDecimal price) {
- this.price = price;
- }
-
- public BigDecimal getPurchasePrice() {
- return purchasePrice;
- }
-
- public void setPurchasePrice(BigDecimal purchasePrice) {
- this.purchasePrice = purchasePrice;
- }
-
- public BigDecimal getWholesalePrice() {
- return wholesalePrice;
- }
-
- public void setWholesalePrice(BigDecimal wholesalePrice) {
- this.wholesalePrice = wholesalePrice;
- }
-
- public Integer getProductCount() {
- return productCount;
- }
-
- public void setProductCount(Integer productCount) {
- this.productCount = productCount;
- }
-
- public BigDecimal getDiscount() {
- return discount;
- }
-
- public void setDiscount(BigDecimal discount) {
- this.discount = discount;
- }
-
- public BigDecimal getDiscountAmount() {
- return discountAmount;
- }
-
- public void setDiscountAmount(BigDecimal discountAmount) {
- this.discountAmount = discountAmount;
- }
-
- public BigDecimal getRealPrice() {
- return realPrice;
- }
-
- public void setRealPrice(BigDecimal realPrice) {
- this.realPrice = realPrice;
- }
-
- public String getReturnSaleId() {
- return returnSaleId;
- }
-
- public void setReturnSaleId(String returnSaleId) {
- this.returnSaleId = returnSaleId;
- }
-
- @Override
- public String toString() {
- return "ReturnDetail{" +
- "id='" + id + '\'' +
- ", createBy='" + createBy + '\'' +
- ", createTime=" + createTime +
- ", delFlag=" + delFlag +
- ", updateBy='" + updateBy + '\'' +
- ", updateTime=" + updateTime +
- ", saleId='" + saleId + '\'' +
- ", returnSaleId='" + returnSaleId + '\'' +
- ", productId='" + productId + '\'' +
- ", productName='" + productName + '\'' +
- ", unit='" + unit + '\'' +
- ", shopId='" + shopId + '\'' +
- ", categoryId='" + categoryId + '\'' +
- ", attributeList='" + attributeList + '\'' +
- ", price=" + price +
- ", purchasePrice=" + purchasePrice +
- ", wholesalePrice=" + wholesalePrice +
- ", productCount=" + productCount +
- ", discount=" + discount +
- ", discountAmount=" + discountAmount +
- ", realPrice=" + realPrice +
- '}';
- }
+ private static final long serialVersionUID = 1L;
}
\ No newline at end of file
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Sale.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Sale.java
index a32307fb..37cec482 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Sale.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Sale.java
@@ -163,6 +163,11 @@ public class Sale implements Serializable {
@ApiModelProperty(value="退款数量")
private int returnSaleProductCount;
+ @Transient
+ @TableField(exist = false)
+ @ApiModelProperty(value="退款总金额")
+ private BigDecimal returnSaleTotalAmount;
+
@ApiModelProperty(value="欠款抵扣金额")
private BigDecimal debtDeductionAmount;
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Supplier.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Supplier.java
index 841e49f2..f7ca020e 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Supplier.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Supplier.java
@@ -1,6 +1,7 @@
package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -42,4 +43,8 @@ public class Supplier extends HiverBaseEntity {
@ApiModelProperty(value = "供应商联系方式")
private String consigneeMobile;
+ @TableField(exist = false)
+ @ApiModelProperty(value = "欠款")
+ private String noEarn;
+
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/ReturnSaleDetailDTO.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/ReturnSaleDetailDTO.java
index 574ca01f..ebc8e3ac 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/ReturnSaleDetailDTO.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/ReturnSaleDetailDTO.java
@@ -60,6 +60,12 @@ public class ReturnSaleDetailDTO implements Serializable {
@ApiModelProperty(value = "实际价格")
private BigDecimal realPrice;
+ @ApiModelProperty(value = "商品图片")
+ private String productPicture;
+
+ @ApiModelProperty(value = "货号")
+ private String productSn;
+
private static final long serialVersionUID = 1L;
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/SaleDetailDTO.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/SaleDetailDTO.java
index d37949a1..e46eae14 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/SaleDetailDTO.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/SaleDetailDTO.java
@@ -16,6 +16,9 @@ public class SaleDetailDTO implements Serializable {
@ApiModelProperty(value = "销售单ID")
private String saleId;
+ @ApiModelProperty(value = "销售单明细ID")
+ private String detailId;
+
@ApiModelProperty(value = "商品ID")
private String productId;
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/ReturnSalePageQuery.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/ReturnSalePageQuery.java
new file mode 100644
index 00000000..39a3b92c
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/ReturnSalePageQuery.java
@@ -0,0 +1,42 @@
+/*
+Copyright [2022] [https://hiver.cc]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ */
+package cc.hiver.mall.pojo.query;
+
+import cc.hiver.core.base.HiverBasePageQuery;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 分享页查询对象
+ *
+ * @author 王富康
+ * @date 2023/10/14
+ */
+@ApiModel("分享页查询对象")
+@Data
+public class ReturnSalePageQuery extends HiverBasePageQuery {
+
+ @ApiModelProperty("商品ID")
+ private String productId;
+
+ @ApiModelProperty("开始时间")
+ private String startDate;
+
+ @ApiModelProperty("结束时间")
+ private String endDate;
+
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/CustomerBuyProductDetailLogVo.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/CustomerBuyProductDetailLogVo.java
index 75db714b..1c4e5a15 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/CustomerBuyProductDetailLogVo.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/CustomerBuyProductDetailLogVo.java
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
+import java.math.BigDecimal;
@Data
@ApiModel(value = "客户商品购买记录")
@@ -28,6 +29,9 @@ public class CustomerBuyProductDetailLogVo implements Serializable {
private Integer productCount;
@ApiModelProperty(value = "实际价格")
- private Integer realPrice;
+ private BigDecimal realPrice;
+
+ @ApiModelProperty(value = "实际价格")
+ private BigDecimal purchasePrice;
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/CustomerBuyProductLogVo.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/CustomerBuyProductLogVo.java
index d5e83b07..d06e5829 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/CustomerBuyProductLogVo.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/CustomerBuyProductLogVo.java
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
+import java.math.BigDecimal;
import java.util.List;
@Data
@@ -22,6 +23,9 @@ public class CustomerBuyProductLogVo implements Serializable {
@ApiModelProperty(value = "商品货号")
private String productSn;
+ @ApiModelProperty(value = "采购价")
+ private BigDecimal purchasePrice;
+
@ApiModelProperty(value = "历次销售单")
private List customerBuySaleVoList;
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/CustomerBuySaleVo.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/CustomerBuySaleVo.java
index 6765959a..5c51fba8 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/CustomerBuySaleVo.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/CustomerBuySaleVo.java
@@ -22,6 +22,9 @@ public class CustomerBuySaleVo implements Serializable {
@ApiModelProperty(value = "销售时间")
private String realPrice;
+ @ApiModelProperty(value = "商品数量")
+ private String productCount;
+
@ApiModelProperty(value = "属性")
private List customerBuyProductDetailLogVos;
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductPageVO.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductPageVO.java
index 11eec5af..0ccac3fe 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductPageVO.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductPageVO.java
@@ -15,6 +15,7 @@ limitations under the License.
*/
package cc.hiver.mall.pojo.vo;
+import cc.hiver.mall.productpicture.entity.ProductPicture;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -22,6 +23,7 @@ import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.util.Date;
+import java.util.List;
/**
* 商品分页查询对应Vo
@@ -101,4 +103,7 @@ public class ProductPageVO {
@ApiModelProperty(value = "入库状态:0:待入库(未维护对应的采购价信息);1:已入库;新增商品时为已入库")
private Integer inStorageStatus;
+
+ @ApiModelProperty(value = "商品子图")
+ private List productPictures;
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ReturnSaleVo.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ReturnSaleVo.java
index 2a10d664..b9ff83ae 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ReturnSaleVo.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ReturnSaleVo.java
@@ -89,5 +89,23 @@ public class ReturnSaleVo extends HiverBasePageQuery implements Serializable {
@ApiModelProperty(value = "配送人员姓名")
private int workerName;
+ @ApiModelProperty(value = "开始时间")
+ private String startTime;
+
+ @ApiModelProperty(value = "结束时间")
+ private String endTime;
+
+ @ApiModelProperty(value = "退货金额")
+ private String returnAmount;
+
+ @ApiModelProperty(value = "之前欠款")
+ private String lastDebtAmount;
+
+ @ApiModelProperty(value = "欠款抵扣")
+ private String debtDeductionAmount;
+
+ @ApiModelProperty(value = "累计欠款")
+ private String balanceDue;
+
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SaleNewVO.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SaleNewVO.java
index 83386ebf..bff77e90 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SaleNewVO.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SaleNewVO.java
@@ -1,10 +1,7 @@
package cc.hiver.mall.pojo.vo;
import cc.hiver.core.entity.LogiticsCompany;
-import cc.hiver.mall.entity.Customer;
-import cc.hiver.mall.entity.OrderXd;
-import cc.hiver.mall.entity.Sale;
-import cc.hiver.mall.entity.Shop;
+import cc.hiver.mall.entity.*;
import cc.hiver.mall.pojo.dto.SaleDetailDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -35,4 +32,7 @@ public class SaleNewVO implements Serializable {
@ApiModelProperty(value = "店铺信息")
private Shop shop;
+ @ApiModelProperty(value = "本单的欠款交易记录")
+ private DealingsRecord dealingsRecord;
+
}
\ No newline at end of file
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/productpicture/mapper/ProductPictureMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/productpicture/mapper/ProductPictureMapper.java
index f859ea8f..dfa9ec62 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/productpicture/mapper/ProductPictureMapper.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/productpicture/mapper/ProductPictureMapper.java
@@ -13,4 +13,6 @@ public interface ProductPictureMapper extends BaseMapper {
void batchSaveProductPicture(@Param("productPictures") List productPictures);
void deleteByProductId(@Param("productId") String productId);
+
+ List getProductPictureByProductIds(@Param("productIds") List productIds);
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/productpicture/service/ProductPictureService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/productpicture/service/ProductPictureService.java
index 38f98b15..d5a33b35 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/productpicture/service/ProductPictureService.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/productpicture/service/ProductPictureService.java
@@ -7,8 +7,10 @@ import java.util.List;
public interface ProductPictureService extends IService {
List getProductPictureByProductId(String productId);
+ List getProductPictureByProductIds(List productIds);
void batchSaveProductPicture(List productPictures);
void deleteByProductId(String productId);
+
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/productpicture/service/impl/ProductPictureServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/productpicture/service/impl/ProductPictureServiceImpl.java
index 2fa78f5c..34134a80 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/productpicture/service/impl/ProductPictureServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/productpicture/service/impl/ProductPictureServiceImpl.java
@@ -19,6 +19,11 @@ public class ProductPictureServiceImpl extends ServiceImpl getProductPictureByProductIds(List productIds) {
+ return productPictureMapper.getProductPictureByProductIds(productIds);
+ }
+
@Override
public void batchSaveProductPicture(List productPictures) {
productPictureMapper.batchSaveProductPicture(productPictures);
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/impl/PurchaseOcrPictureServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/impl/PurchaseOcrPictureServiceImpl.java
index 4422f73d..2a383be7 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/impl/PurchaseOcrPictureServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/impl/PurchaseOcrPictureServiceImpl.java
@@ -45,7 +45,7 @@ import java.util.regex.Pattern;
public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService {
private static final Pattern productSn = Pattern.compile("货号");
- private static final Pattern COMPILE = Pattern.compile("\\D+");
+ private static final Pattern COMPILE = Pattern.compile("-?\\d+");
private static final Pattern SYYS = Pattern.compile("所有颜色", Pattern.LITERAL);
private static final Pattern SYCM = Pattern.compile("所有尺码", Pattern.LITERAL);
@@ -262,7 +262,7 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService
// 获取商品分类及规格信息
final List categoryIdList = new ArrayList<>();
- String attrId = product.getAttrId();
+ final String attrId = product.getAttrId();
categoryIdList.add(attrId);
final List shopCategory = productCategoryService.getShopCategory(categoryIdList);
final ProductCategoryVo productCategoryVo = shopCategory.get(0);
@@ -296,7 +296,12 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService
String color = attributeListObject.getString("color").toUpperCase();
String size = attributeListObject.getString("size").toUpperCase();
final String productCount1 = attributeListObject.getString("productCount");
- final int productCount = Integer.parseInt(COMPILE.matcher(productCount1).replaceAll(""));
+ final Matcher countMatchered = COMPILE.matcher(productCount1);
+ String replaced = "";
+ if (countMatchered.find()) {
+ replaced = countMatchered.group();
+ }
+ final int productCount = Integer.parseInt(StringUtils.isEmpty(replaced) ? "0" : replaced);
// 20240330 只能新增颜色和尺码,颜色统一改为*色、尺码统一转大写,加‘码’;
// 根据规格id规格是颜色、还是尺码。
if (!color.contains("色")) {
@@ -384,7 +389,12 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService
String color = attributeListObject.getString("color").toUpperCase();
String size = attributeListObject.getString("size").toUpperCase();
final String productCount1 = attributeListObject.getString("productCount");
- final int productCount = Integer.parseInt(COMPILE.matcher(productCount1).replaceAll(""));
+ final Matcher countMatchered = COMPILE.matcher(productCount1);
+ String replaced = "";
+ if (countMatchered.find()) {
+ replaced = countMatchered.group();
+ }
+ final int productCount = Integer.parseInt(StringUtils.isEmpty(replaced) ? "0" : replaced);
// 20240330 只能新增颜色和尺码,颜色统一改为*色、尺码统一转大写,加‘码’;
// 根据规格id规格是颜色、还是尺码。
if (!color.contains("色")) {
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/DealingsRecordService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/DealingsRecordService.java
index ab28536c..8f6daf7f 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/DealingsRecordService.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/DealingsRecordService.java
@@ -20,4 +20,12 @@ public interface DealingsRecordService extends IService {
* @date 2024/6/16
*/
List getDealingsRecordListByUserId(String userId);
+
+ /**
+ * 作废交易记录
+ * @author 王富康
+ * @date 2024/6/26
+ * @param saleId
+ */
+ void cancelRecord(String saleId);
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ProductService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ProductService.java
index 52b59baa..1f716d38 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ProductService.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ProductService.java
@@ -48,4 +48,24 @@ public interface ProductService extends IService {
void deleteProductByCategoryId(String categoryId);
SaleQueryDTO handleProduct(SaleQueryDTO saleQueryDTO);
+
+ /**
+ * 根据货品id批量上架货品
+ *
+ * @param ids
+ * @return boolean
+ * @author 王富康
+ * @date 2024/6/22
+ */
+ boolean batchUp(String ids);
+
+ /**
+ * 根据货品id批量下架货品
+ *
+ * @param ids
+ * @return boolean
+ * @author 王富康
+ * @date 2024/6/22
+ */
+ boolean batchDown(String ids);
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ReturnDetailService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ReturnDetailService.java
index 5b006314..fa02feed 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ReturnDetailService.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ReturnDetailService.java
@@ -11,4 +11,6 @@ public interface ReturnDetailService extends IService {
public List selectByCondition1(QueryWrapper queryWrapper);
+ List getReturnDetails(List saleIdList);
+
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ReturnSaleService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ReturnSaleService.java
index a6ee486b..2e54b21e 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ReturnSaleService.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ReturnSaleService.java
@@ -1,11 +1,23 @@
package cc.hiver.mall.service.mybatis;
+import cc.hiver.mall.bill.vo.ArrearsVo;
+import cc.hiver.mall.bill.vo.CustomerBillQueryVo;
import cc.hiver.mall.entity.ReturnSale;
-import cc.hiver.mall.entity.Sale;
+import cc.hiver.mall.pojo.dto.SaleReturnDTO;
+import cc.hiver.mall.pojo.query.ReturnSalePageQuery;
+import cc.hiver.mall.pojo.vo.ReturnSaleVo;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
public interface ReturnSaleService extends IService {
ReturnSale getBySaleId(String id);
+
+ IPage getReturnSaleList(ReturnSaleVo returnSaleVo);
+
+ ArrearsVo getTotalReturn(CustomerBillQueryVo customerBillQueryVo);
+
+ Page getReturnSaleListByProductId(ReturnSalePageQuery returnSalePageQuery);
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/SaleDetailService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/SaleDetailService.java
index 0164acae..1ab6d25d 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/SaleDetailService.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/SaleDetailService.java
@@ -27,4 +27,6 @@ public interface SaleDetailService extends IService {
* @param purchaseDetails
*/
void putInUpdatePurchasePrice(List purchaseDetails);
+
+ List getSaleDetails(List saleIdList);
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/SaleService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/SaleService.java
index 33b4ea59..525362a2 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/SaleService.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/SaleService.java
@@ -1,5 +1,8 @@
package cc.hiver.mall.service.mybatis;
+import cc.hiver.mall.bill.vo.ArrearsVo;
+import cc.hiver.mall.bill.vo.CustomerBillQueryVo;
+import cc.hiver.mall.bill.vo.CustomerBillSaleVo;
import cc.hiver.mall.entity.Sale;
import cc.hiver.mall.pojo.query.SalePageQuery;
import cc.hiver.mall.pojo.query.SalesRankingQueryCriteria;
@@ -69,4 +72,20 @@ public interface SaleService extends IService {
* @date 2024/4/27
*/
void changeCompany(String saleId, String companyId);
+
+ /**
+ * 撤销销售单
+ * (1)订单回退(订单作废、库存退回)
+ * (2)款项记录作废(查询的时候也要关联deflag=0),同时把款项回退(当前欠款+欠款抵扣-余额抵扣-笨蛋欠款)
+ * (3)如果有退货:退货表和detail作废,同时把库存退回去
+ *
+ * @param id
+ * @author 王富康
+ * @date 2024/6/26
+ */
+ void cancelSale(String id);
+
+ Page getCustomerBill(CustomerBillQueryVo customerBillQueryVo);
+
+ ArrearsVo getArrearsAndTotalSale(CustomerBillQueryVo customerBillQueryVo);
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/StockService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/StockService.java
index 841f198d..f0a16549 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/StockService.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/StockService.java
@@ -57,4 +57,8 @@ public interface StockService extends IService {
* @return List
*/
List getProductStock(String productId);
+
+ List getProductStock(List productIds);
+
+ Stock getByProductIdAndAttributeList(String productId, String attributeList);
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ProductShareServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ProductShareServiceImpl.java
index 83ec1430..7a563354 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ProductShareServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ProductShareServiceImpl.java
@@ -10,6 +10,8 @@ import cc.hiver.mall.pojo.query.ProductPageQuery;
import cc.hiver.mall.pojo.query.SharetPageQuery;
import cc.hiver.mall.pojo.vo.ProductPageVO;
import cc.hiver.mall.pojo.vo.ShareVO;
+import cc.hiver.mall.productpicture.entity.ProductPicture;
+import cc.hiver.mall.productpicture.service.ProductPictureService;
import cc.hiver.mall.service.ProductShareService;
import cc.hiver.mall.service.ShopService;
import cc.hiver.mall.service.mybatis.ProductService;
@@ -18,8 +20,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.util.Arrays;
-import java.util.Map;
+import java.util.*;
@Service
public class ProductShareServiceImpl implements ProductShareService {
@@ -35,6 +36,9 @@ public class ProductShareServiceImpl implements ProductShareService {
@Autowired
private ShopService shopService;
+ @Autowired
+ private ProductPictureService productPictureService;
+
/**
* 新增分享链接
*
@@ -92,6 +96,32 @@ public class ProductShareServiceImpl implements ProductShareService {
productPageQuery.setSearchStr(sharetPageQuery.getSearchStr());
// 获取商品信息
final IPage shareList = productService.getShareList(productPageQuery);
+ // 获取商品的返回结果的商品信息id,后边获取商品子图
+ final List productIds = new ArrayList<>();
+ for (ProductPageVO record : shareList.getRecords()) {
+ productIds.add(record.getId());
+ }
+ if(!productIds.isEmpty()){
+ // 封装商品子图
+ final List productPictureByProductIds = productPictureService.getProductPictureByProductIds(productIds);
+ // 将productPictureByProductIds封装为map,key为商品id,value为实体
+ final Map> productPictureMap = new HashMap<>();
+ for (ProductPicture productPictureByProductId : productPictureByProductIds) {
+ if (productPictureMap.containsKey(productPictureByProductId.getProductId())) {
+ final String productId = productPictureByProductId.getProductId();
+ final List productPictures = productPictureMap.get(productId);
+ productPictures.add(productPictureByProductId);
+ } else {
+ final List productPictures = new ArrayList<>();
+ productPictures.add(productPictureByProductId);
+ productPictureMap.put(productPictureByProductId.getProductId(),productPictures);
+ }
+ }
+ // 封装到实体中去。
+ shareList.getRecords().forEach(productPageVO -> {
+ productPageVO.setProductPictures(productPictureMap.get(productPageVO.getId()));
+ });
+ }
shareVO.setShareList(shareList);
return shareVO;
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SalesAndDetailsServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SalesAndDetailsServiceImpl.java
index 41e65238..302a517a 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SalesAndDetailsServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SalesAndDetailsServiceImpl.java
@@ -379,6 +379,8 @@ public class SalesAndDetailsServiceImpl implements SalesAndDetailsService {
returnSaleDetailDTO.setWholesalePrice(product.getWholesalePrice());
returnSaleDetailDTO.setPurchasePrice(product.getPurchasePrice());
returnSaleDetailDTO.setReturnSaleId(returnSaleId);
+ returnSaleDetailDTO.setProductPicture(product.getProductPicture());
+ returnSaleDetailDTO.setProductSn(product.getProductSn());
for(SaleDetailQueryDTO saleDetailQueryDTO : returnSaleDetailDTO.getStockLogList1()){
final ReturnDetail returnDetail = new ReturnDetail();
returnSaleDetailDTO.setAttributeList(saleDetailQueryDTO.getAttributeList());
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/StockAndLogServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/StockAndLogServiceImpl.java
index f2d3e3bf..4ba4e596 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/StockAndLogServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/StockAndLogServiceImpl.java
@@ -140,6 +140,7 @@ public class StockAndLogServiceImpl implements StockAndLogService {
//以商品维度,如果没有库存反向插入一条负库存入库
stockLog.setChangeType("0");
stockLog.setOrderId(saleId);
+ stockLog.setDetailId(saleDetailDTO.getDetailId());
stockLog.setProductId(productId);
stockLog.setAttributeList(saleDetailQueryDTO.getAttributeList());
stockLog.setStock(stockCount);//出库前数量
@@ -218,6 +219,7 @@ public class StockAndLogServiceImpl implements StockAndLogService {
//2.记录库存履历
final StockLog stockLog = new StockLog();
+ stockLog.setOrderId(saleDetailDTO.getSaleId());
stockLog.setChangeType("0");//以商品维度,如果没有库存反向插入一条正库存入库
stockLog.setProductId(productId);
stockLog.setAttributeList(saleDetailQueryDTO.getAttributeList());
@@ -235,6 +237,7 @@ public class StockAndLogServiceImpl implements StockAndLogService {
//2.记录库存履历
final StockLog stockLog = new StockLog();
+ stockLog.setOrderId(saleDetailDTO.getSaleId());
stockLog.setChangeType("0");//出库
stockLog.setProductId(productId);
stockLog.setAttributeList(saleDetailQueryDTO.getAttributeList());
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SupplierServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SupplierServiceImpl.java
index 50481524..06998525 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SupplierServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SupplierServiceImpl.java
@@ -4,6 +4,8 @@ import cc.hiver.core.base.HiverBaseDao;
import cc.hiver.core.common.constant.CommonConstant;
import cc.hiver.core.common.utils.QueryHelp;
import cc.hiver.mall.dao.SupplierDao;
+import cc.hiver.mall.debt.entity.Debt;
+import cc.hiver.mall.debt.service.DebtService;
import cc.hiver.mall.entity.Supplier;
import cc.hiver.mall.pojo.query.SupplierQueryCriteria;
import cc.hiver.mall.service.SupplierService;
@@ -14,7 +16,11 @@ import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
@Slf4j
@Service
@@ -23,6 +29,9 @@ public class SupplierServiceImpl implements SupplierService {
@Autowired
private SupplierDao supplierDao;
+ @Autowired
+ private DebtService debtService;
+
@Override
public HiverBaseDao getRepository() {
return supplierDao;
@@ -32,13 +41,33 @@ public class SupplierServiceImpl implements SupplierService {
public Page queryAll(SupplierQueryCriteria criteria, Pageable pageable) {
// 添加未删除标记
criteria.setDelFlag(CommonConstant.DEL_FLAG_FALSE);
- Page list = supplierDao.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
+ final Page list = supplierDao.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
+ // 添加欠款信息
+ // 获取供应商的id
+ final List idList = new ArrayList<>();
+ list.forEach(supplier -> {
+ // 获取供应商的id
+ final String id = supplier.getId();
+ // 添加到id列表中
+ idList.add(id);
+ });
+ // 获取供应商的欠款信息
+ final List debtByUserIds = debtService.getDebtByUserIds(idList);
+ // 变为map,key为userid,
+ final Map debtMap = debtByUserIds.stream().collect(Collectors.toMap(Debt::getUserId, Function.identity()));
+ list.forEach(supplier -> {
+ final String id = supplier.getId();
+ final Debt debt = debtMap.get(id);
+ if (debt != null) {
+ supplier.setNoEarn(debt.getAmountOwed().toString());
+ }
+ });
return list;
}
@Override
- public List getbyShopId(String shopId,String searchStr) {
- return supplierDao.getbyShopId(shopId,searchStr);
+ public List getbyShopId(String shopId, String searchStr) {
+ return supplierDao.getbyShopId(shopId, searchStr);
}
@Override
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/DealingsRecordServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/DealingsRecordServiceImpl.java
index 652177c3..f2bb8f8b 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/DealingsRecordServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/DealingsRecordServiceImpl.java
@@ -49,4 +49,15 @@ public class DealingsRecordServiceImpl extends ServiceImpl productAttributeOfAddVos = productAttributeService.selectAttributeListByCategoryId(categoryIdList);
final List attributeIds = new ArrayList<>();
- final Map productAttributeOfAddVoMap = new HashMap<>();
+ final Map productAttributeOfAddVoMap = new LinkedHashMap<>();
for (ProductAttributeOfAddVo productAttributeOfAddVo : productAttributeOfAddVos) {
attributeIds.add(productAttributeOfAddVo.getAttributeId());
productAttributeOfAddVoMap.put(productAttributeOfAddVo.getAttributeId(), productAttributeOfAddVo);
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductServiceImpl.java
index db9e4921..22459e69 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductServiceImpl.java
@@ -160,7 +160,7 @@ public class ProductServiceImpl extends ServiceImpl impl
// 放到要查询的id中
// 填充前台传过来的数据
saleDetailDTO.setProductId(product.getId());
- if(saleDetailDTO.getProductPictures() != null ){
+ if (saleDetailDTO.getProductPictures() != null) {
// 新增商品图片子图
for (ProductPicture productPicture : saleDetailDTO.getProductPictures()) {
productPicture.setProductId(product.getId());
@@ -175,7 +175,22 @@ public class ProductServiceImpl extends ServiceImpl impl
final JSONObject jsonObject = JSONUtil.parseObj(attributeList);
for (Map.Entry stringObjectEntry : jsonObject.entrySet()) {
final String key = stringObjectEntry.getKey();
- final String value = String.valueOf(stringObjectEntry.getValue());
+ String value = String.valueOf(stringObjectEntry.getValue());
+ // 根据规格id规格是颜色、还是尺码。
+ if ("颜色".equals(key)) {
+ if (!value.contains("色")) {
+ value += '色';
+ }
+ } else if ("尺码".equals(key)) {
+ final String valueUpperCase = value.toUpperCase();
+ if (value.contains("码")) {
+ value = valueUpperCase;
+ } else {
+ value = valueUpperCase + '码';
+ }
+ } else {
+ // 暂不支持其他规格
+ }
if (attributeValueMap.containsKey(key)) {
final List strings = attributeValueMap.get(key);
if (!strings.contains(value)) {
@@ -213,14 +228,54 @@ public class ProductServiceImpl extends ServiceImpl impl
addProductList.add(product);
}
}
- if(!addProductList.isEmpty()){
+ if (!addProductList.isEmpty()) {
// 批量插入商品
productMapper.batchSaveProduct(addProductList);
}
- if(!addProductPictureList.isEmpty()){
+ if (!addProductPictureList.isEmpty()) {
// 批量插入商品图片
productPictureService.batchSaveProductPicture(addProductPictureList);
}
return saleQueryDTO;
}
+
+ /**
+ * 根据货品id批量上架货品
+ *
+ * @param ids
+ * @return boolean
+ * @author 王富康
+ * @date 2024/6/22
+ */
+ @Override
+ public boolean batchUp(String ids) {
+ // ids 逗号分隔转为list
+ try {
+ final List idList = Arrays.asList(ids.split(","));
+ productMapper.batchUpdateDelFlag(idList, ProductConstant.DEL_FLAG[1]);
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ /**
+ * 根据货品id批量下架货品
+ *
+ * @param ids
+ * @return boolean
+ * @author 王富康
+ * @date 2024/6/22
+ */
+ @Override
+ public boolean batchDown(String ids) {
+ // ids 逗号分隔转为list
+ try {
+ final List idList = Arrays.asList(ids.split(","));
+ productMapper.batchUpdateDelFlag(idList, ProductConstant.DEL_FLAG[0]);
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ReturnDetailServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ReturnDetailServiceImpl.java
index d865ebe2..832de0b0 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ReturnDetailServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ReturnDetailServiceImpl.java
@@ -1,12 +1,8 @@
package cc.hiver.mall.serviceimpl.mybatis;
import cc.hiver.mall.dao.mapper.ReturnDetailMapper;
-import cc.hiver.mall.dao.mapper.ReturnSaleMapper;
-import cc.hiver.mall.dao.mapper.SaleDetailMapper;
import cc.hiver.mall.entity.ReturnDetail;
-import cc.hiver.mall.entity.SaleDetail;
import cc.hiver.mall.service.mybatis.ReturnDetailService;
-import cc.hiver.mall.service.mybatis.SaleDetailService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
@@ -26,4 +22,9 @@ public class ReturnDetailServiceImpl extends ServiceImpl list = returnDetailMapper.selectObjs(queryWrapper);
return list;
}
+
+ @Override
+ public List getReturnDetails(List saleIdList) {
+ return returnDetailMapper.getReturnDetails(saleIdList);
+ }
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ReturnSaleServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ReturnSaleServiceImpl.java
index 299367c0..2e45d84c 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ReturnSaleServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ReturnSaleServiceImpl.java
@@ -1,15 +1,23 @@
package cc.hiver.mall.serviceimpl.mybatis;
+import cc.hiver.mall.bill.vo.ArrearsVo;
+import cc.hiver.mall.bill.vo.CustomerBillQueryVo;
import cc.hiver.mall.dao.mapper.ReturnSaleMapper;
-import cc.hiver.mall.dao.mapper.SaleMapper;
import cc.hiver.mall.entity.ReturnSale;
-import cc.hiver.mall.entity.Sale;
+import cc.hiver.mall.pojo.dto.SaleReturnDTO;
+import cc.hiver.mall.pojo.query.ReturnSalePageQuery;
+import cc.hiver.mall.pojo.vo.ReturnSaleVo;
import cc.hiver.mall.service.mybatis.ReturnSaleService;
-import cc.hiver.mall.service.mybatis.SaleService;
+import cc.hiver.mall.utils.DateUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import java.util.List;
+
@Service
public class ReturnSaleServiceImpl extends ServiceImpl implements ReturnSaleService {
@@ -20,4 +28,31 @@ public class ReturnSaleServiceImpl extends ServiceImpl getReturnSaleList(ReturnSaleVo returnSaleVo) {
+ final Page page = new Page<>(returnSaleVo.getPageNum(), returnSaleVo.getPageSize());
+ if(StringUtils.isNotEmpty(returnSaleVo.getEndTime())){
+ // 日期加一天
+ returnSaleVo.setEndTime(DateUtil.addDay(returnSaleVo.getEndTime(), 1));
+ }
+ final List list = returnSaleMapper.getReturnSaleList(page, returnSaleVo);
+ page.setRecords(list);
+ return page;
+ }
+
+ @Override
+ public ArrearsVo getTotalReturn(CustomerBillQueryVo customerBillQueryVo) {
+ return returnSaleMapper.getTotalReturn(customerBillQueryVo);
+ }
+
+ @Override
+ public Page getReturnSaleListByProductId(ReturnSalePageQuery returnSalePageQuery) {
+
+ final Page page = new Page<>(returnSalePageQuery.getPageNum(), returnSalePageQuery.getPageSize());
+ final Page salePage = returnSaleMapper.getReturnSaleListByProductId(page, returnSalePageQuery.getProductId());
+ final List saleList = salePage.getRecords();
+
+ return null;
+ }
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SaleDetailServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SaleDetailServiceImpl.java
index 5d5c5f90..3a168731 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SaleDetailServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SaleDetailServiceImpl.java
@@ -66,4 +66,9 @@ public class SaleDetailServiceImpl extends ServiceImpl getSaleDetails(List saleIdList) {
+ return saleDetailMapper.getSaleDetails(saleIdList);
+ }
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SaleServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SaleServiceImpl.java
index 68d800ac..f4c4d558 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SaleServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SaleServiceImpl.java
@@ -1,5 +1,6 @@
package cc.hiver.mall.serviceimpl.mybatis;
+import cc.hiver.core.common.constant.CommonConstant;
import cc.hiver.core.common.constant.DealingsRecordConstant;
import cc.hiver.core.common.constant.SaleConstant;
import cc.hiver.core.common.utils.CommonUtil;
@@ -9,9 +10,15 @@ import cc.hiver.core.common.utils.ThreadPoolUtil;
import cc.hiver.core.entity.LogiticsCompany;
import cc.hiver.core.entity.User;
import cc.hiver.core.service.LogiticsCompanyService;
+import cc.hiver.mall.bill.vo.ArrearsVo;
+import cc.hiver.mall.bill.vo.CustomerBillQueryVo;
+import cc.hiver.mall.bill.vo.CustomerBillSaleVo;
import cc.hiver.mall.common.constant.StockConstant;
+import cc.hiver.mall.common.constant.StockLogConstant;
import cc.hiver.mall.config.thread.AiSaleThread;
import cc.hiver.mall.dao.mapper.SaleMapper;
+import cc.hiver.mall.debt.entity.Debt;
+import cc.hiver.mall.debt.service.DebtService;
import cc.hiver.mall.deductlog.service.DeductLogService;
import cc.hiver.mall.entity.*;
import cc.hiver.mall.pojo.dto.SaleDetailDTO;
@@ -93,6 +100,12 @@ public class SaleServiceImpl extends ServiceImpl implements Sa
@Autowired
private OrderService orderService;
+ @Autowired
+ private StockLogService stockLogService;
+
+ @Autowired
+ private DebtService debtService;
+
@Override
public void editPayPrice(String id, BigDecimal price, String dealingsWay) {
// 修改采购单、实付、未付金额
@@ -195,8 +208,10 @@ public class SaleServiceImpl extends ServiceImpl implements Sa
saleDetailDTO.setDiscountAmount(saleDetail.getDiscountAmount());
saleDetailDTO.setRealPrice(saleDetail.getRealPrice());
// 回填商品的的图片及货号
- saleDetailDTO.setProductPicture(productMap.get(productId).getProductPicture());
- saleDetailDTO.setProductSn(productMap.get(productId).getProductSn());
+ if (productMap.containsKey(productId)) {
+ saleDetailDTO.setProductPicture(productMap.get(productId).getProductPicture());
+ saleDetailDTO.setProductSn(productMap.get(productId).getProductSn());
+ }
final SaleDetailQueryDTO saleDetailQueryDTO = new SaleDetailQueryDTO();
saleDetailQueryDTO.setAttributeList(saleDetail.getAttributeList());
@@ -395,6 +410,13 @@ public class SaleServiceImpl extends ServiceImpl implements Sa
allMap.put(productId, stringListMap);
}
}
+
+ // 获取商品的信息
+ final List productList = productService.getProductList(productIds);
+ final Map productMap = new HashMap<>();
+ for (Product product : productList) {
+ productMap.put(product.getId(), product);
+ }
for (CustomerBuyProductLogVo record : records) {
final String productId = record.getProductId();
if (allMap.containsKey(productId)) {
@@ -418,6 +440,9 @@ public class SaleServiceImpl extends ServiceImpl implements Sa
}
}
}
+ if (productMap.containsKey(record.getProductId())) {
+ record.setPurchasePrice(productMap.get(record.getProductId()).getPurchasePrice());
+ }
}
}
// 封装到商品中
@@ -695,16 +720,16 @@ public class SaleServiceImpl extends ServiceImpl implements Sa
continue;
}
if ("SYCM码".equals(size)) {
- // 所有尺码,固定颜色
- for (ProductAttributeValueVo attributeValueVo : sizeProductAttributeValueVoList) {
- final SaleDetailQueryDTO saleDetailQueryDTO = new SaleDetailQueryDTO();
- final String attribute = "{\"颜色\":\"" + color + "\",\"尺码\":\"" + attributeValueVo.getValue() + "\"}";
- saleDetailQueryDTO.setAttributeList(attribute);
- saleDetailQueryDTO.setProductCount(productCount);
- saleDetailQueryDTO.setStockCount(stockMap.getOrDefault(attribute, null));
- saleDetailDTO.setProductCount(saleDetailDTO.getProductCount() + productCount);
- saleDetailQueryDTOS.add(saleDetailQueryDTO);
- }
+ // 所有尺码,固定颜色
+ for (ProductAttributeValueVo attributeValueVo : sizeProductAttributeValueVoList) {
+ final SaleDetailQueryDTO saleDetailQueryDTO = new SaleDetailQueryDTO();
+ final String attribute = "{\"颜色\":\"" + color + "\",\"尺码\":\"" + attributeValueVo.getValue() + "\"}";
+ saleDetailQueryDTO.setAttributeList(attribute);
+ saleDetailQueryDTO.setProductCount(productCount);
+ saleDetailQueryDTO.setStockCount(stockMap.getOrDefault(attribute, null));
+ saleDetailDTO.setProductCount(saleDetailDTO.getProductCount() + productCount);
+ saleDetailQueryDTOS.add(saleDetailQueryDTO);
+ }
continue;
}
@@ -808,6 +833,122 @@ public class SaleServiceImpl extends ServiceImpl implements Sa
saleMapper.updateById(sale);
}
+ /**
+ * 撤销销售单
+ * (1)订单回退(订单作废、库存退回)
+ * (2)款项记录作废(查询的时候也要关联deflag=0),同时把款项回退(当前欠款+欠款抵扣-余额抵扣-笨蛋欠款)
+ * (3)如果有退货:退货表和detail作废,同时把库存退回去
+ *
+ * @param id
+ * @author 王富康
+ * @date 2024/6/26
+ */
+ @Override
+ public void cancelSale(String id) {
+ // 1. 修改订单状态为作废
+ final Sale sale = saleMapper.selectById(id);
+ sale.setStatus(SaleConstant.SALE_STATUS[2]);
+ saleService.updateById(sale);
+ // 2. 如果有退货单,那么退货单作废
+ // 根据订单id获取退货单
+ final ReturnSale bySaleId = returnSaleService.getBySaleId(id);
+ if (bySaleId != null) {
+ // 退货单作废
+ bySaleId.setStatus(SaleConstant.SALE_STATUS[8]);
+ returnSaleService.saveOrUpdate(bySaleId);
+ }
+ // 3.库存回退
+ final List stockLogs = stockLogService.getByPurchaseId(id);
+ // 退还库存,并记录履历
+ // 拿到所有商品的库存
+ final List productIds = new ArrayList<>();
+ for (StockLog stockLog : stockLogs) {
+ // 这个时候库存中肯定有这个商品规格的库存数,直接根据商品id和规格查询库存。
+ final String productId = stockLog.getProductId();
+
+ productIds.add(productId);
+ }
+ final List productStock = stockService.getProductStock(productIds);
+ // 商品id为键,规格为值
+ final Map> productStockMap = new HashMap<>();
+ for (Stock stock : productStock) {
+ final String productId = stock.getProductId();
+ if (productStockMap.containsKey(productId)) {
+ final Map stockMap = productStockMap.get(productId);
+ stockMap.put(stock.getAttributeList(), stock);
+ } else {
+ final Map attributeListMap = new HashMap<>();
+ attributeListMap.put(stock.getAttributeList(), stock);
+ productStockMap.put(productId, attributeListMap);
+ }
+ }
+ final List changeStockList = new ArrayList<>();
+ for (StockLog stockLog : stockLogs) {
+ stockLog.setDelFlag(CommonConstant.DEL_FLAG_TRUE);
+ final String productId = stockLog.getProductId();
+ final String attributeList = stockLog.getAttributeList();
+ // 出入库类型(0-入库;1-出库)
+ final String changeType = stockLog.getChangeType();
+ if (productStockMap.containsKey(productId)) {
+ if (productStockMap.get(productId).containsKey(attributeList)) {
+ final Stock stock = productStockMap.get(productId).get(attributeList);
+ final Integer stockCount = stock.getStockCount();
+ final Integer productCount = stockLog.getProductCount();
+ if (StockLogConstant.CHANGE_TYPE[0].equals(changeType)) {
+ // 入库
+ stock.setStockCount(stockCount - productCount);
+ } else {
+ // 出库
+ stock.setStockCount(stockCount + productCount);
+ }
+ stock.setStockCount(stockCount + productCount);
+ changeStockList.add(stock);
+ }
+ }
+ }
+ // 批量更新库存
+ stockService.updateBatchById(changeStockList);
+ // 批量作废库存履历
+ stockLogService.saveOrUpdateBatch(stockLogs);
+ // 4. 订单款项记录作废
+ // 根据订单获取交易记录
+ final String userId = sale.getUserId();
+ final Debt oldDebt = debtService.selectByUserId(userId);
+ if(oldDebt != null){
+ final BigDecimal newDebtAmount;
+
+ // 欠款抵扣,需要单独从欠款中减掉
+ final BigDecimal debtDeductionAmount = sale.getDebtDeductionAmount() == null ? BigDecimal.valueOf(0) : sale.getDebtDeductionAmount();
+ // 余额抵扣,需要从欠款中减掉
+ final BigDecimal balanceDeductionAmount = sale.getBalanceDeductionAmount() == null ? BigDecimal.valueOf(0) : sale.getBalanceDeductionAmount();
+ // 本单欠款
+ final BigDecimal noEarn = sale.getNoEarn() == null ? BigDecimal.valueOf(0) : sale.getNoEarn();
+ // 计算欠款
+ newDebtAmount = oldDebt.getAmountOwed().subtract(noEarn).add(debtDeductionAmount).subtract(balanceDeductionAmount);
+ oldDebt.setAmountOwed(newDebtAmount);
+ debtService.saveOrUpdateDebt(oldDebt);
+ }
+ // 作废当前订单的欠款记录
+ dealingsRecordService.cancelRecord(id);
+ }
+
+ @Override
+ public Page getCustomerBill(CustomerBillQueryVo customerBillQueryVo) {
+ final Page page = new Page<>(customerBillQueryVo.getPageNum(), customerBillQueryVo.getPageSize());
+ //结束时间-1天
+ if (StringUtils.isNotEmpty(customerBillQueryVo.getEndDate())) {
+ final String endDate = DateUtil.addDay(customerBillQueryVo.getEndDate(), 1);
+ customerBillQueryVo.setEndDate(endDate);
+ }
+ final Page customerBillSaleVoPage = saleMapper.getCustomerBill(page, customerBillQueryVo);
+ return customerBillSaleVoPage;
+ }
+
+ @Override
+ public ArrearsVo getArrearsAndTotalSale(CustomerBillQueryVo customerBillQueryVo) {
+ return saleMapper.getArrearsAndTotalSale(customerBillQueryVo);
+ }
+
/**
* 使用正则表达式替换输入字符串中连续的“叉”字符为相应数量的“X”字符。
*
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java
index c56a914b..f461f173 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java
@@ -570,10 +570,14 @@ public class StockServiceImpl extends ServiceImpl implements
for (Stock stock : stockList) {
final Product product = productMap.get(stock.getProductId());
+ if(!productMap.containsKey(stock.getProductId())){
+ // 如果没有商品信息那么就进行下一个循环,暂时不计算该商品的采购价及其他信息
+ continue;
+ }
// 商品的库存预警
final Integer tailWarn = product.getTailWarn();
//平均采购价
- final BigDecimal purchasePrice = product.getPurchasePrice();
+ final BigDecimal purchasePrice = product.getPurchasePrice() == null ? new BigDecimal(0) : product.getPurchasePrice();
final Integer thisStockCount = stock.getStockCount();
// 计算成本,负数按0计算
if (thisStockCount > 0) {
@@ -673,6 +677,7 @@ public class StockServiceImpl extends ServiceImpl implements
// Ai已经生成了入库单主表信息
final Purchase purchase = purchaseVo.getPurchase();
+ purchase.setCreateByName(user.getNickname());
purchase.setShopId(shopId);
final String purchaseId = purchase.getId();
// 先根据入库单id 删除详情及库存履历表信息
@@ -744,7 +749,22 @@ public class StockServiceImpl extends ServiceImpl implements
final JSONObject jsonObject = JSON.parseObject(attributeList);
for (Map.Entry stringObjectEntry : jsonObject.entrySet()) {
final String key = stringObjectEntry.getKey();
- final String value = String.valueOf(stringObjectEntry.getValue());
+ String value = String.valueOf(stringObjectEntry.getValue());
+ // 根据规格id规格是颜色、还是尺码。
+ if ("颜色".equals(key)) {
+ if (!value.contains("色")) {
+ value += '色';
+ }
+ } else if ("尺码".equals(key)) {
+ final String valueUpperCase = value.toUpperCase();
+ if (value.contains("码")) {
+ value = valueUpperCase;
+ } else {
+ value = valueUpperCase + '码';
+ }
+ } else {
+ // 暂不支持其他规格
+ }
if (attributeValueMap.containsKey(key)) {
final List strings = attributeValueMap.get(key);
if (!strings.contains(value)) {
@@ -1059,4 +1079,14 @@ public class StockServiceImpl extends ServiceImpl implements
public List getProductStock(String productId) {
return stockMapper.getProductStock(productId);
}
+
+ @Override
+ public List getProductStock(List productIds) {
+ return stockMapper.getProductsStock(productIds);
+ }
+
+ @Override
+ public Stock getByProductIdAndAttributeList(String productId, String attributeList) {
+ return stockMapper.getByProductIdAndAttributeList(productId,attributeList);
+ }
}
diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/DealingsRecordMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/DealingsRecordMapper.xml
index d1191dbe..69bb0eb7 100644
--- a/hiver-modules/hiver-mall/src/main/resources/mapper/DealingsRecordMapper.xml
+++ b/hiver-modules/hiver-mall/src/main/resources/mapper/DealingsRecordMapper.xml
@@ -118,4 +118,10 @@
order by create_time desc
+
+
+ update t_dealings_record
+ set del_flag = 1
+ where sale_id = #{saleId}
+
\ No newline at end of file
diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/DebtMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/DebtMapper.xml
index 70bb3687..366c2a40 100644
--- a/hiver-modules/hiver-mall/src/main/resources/mapper/DebtMapper.xml
+++ b/hiver-modules/hiver-mall/src/main/resources/mapper/DebtMapper.xml
@@ -40,4 +40,15 @@
and shop_id = #{shopId,jdbcType=VARCHAR}
and user_id = #{userId,jdbcType=VARCHAR}
+
+
\ No newline at end of file
diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/ProductAttributeMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/ProductAttributeMapper.xml
index d1348892..83df05c4 100644
--- a/hiver-modules/hiver-mall/src/main/resources/mapper/ProductAttributeMapper.xml
+++ b/hiver-modules/hiver-mall/src/main/resources/mapper/ProductAttributeMapper.xml
@@ -286,6 +286,12 @@
#{listItem}
+ order by
+ case
+ attribute_name
+ when '颜色' then 1
+ when '尺码' then 2
+ else 3 end ,create_time ,create_time
diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml
index 8c732304..9f5594ab 100644
--- a/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml
+++ b/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml
@@ -747,4 +747,13 @@
+
+
+ update t_product
+ set del_flag = #{delFlag,jdbcType=INTEGER}
+ where id in
+
+ #{listItem}
+
+
\ No newline at end of file
diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/ProductPictureMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/ProductPictureMapper.xml
index df75b95f..f69d2edd 100644
--- a/hiver-modules/hiver-mall/src/main/resources/mapper/ProductPictureMapper.xml
+++ b/hiver-modules/hiver-mall/src/main/resources/mapper/ProductPictureMapper.xml
@@ -25,6 +25,18 @@
and product_id = #{productId,jdbcType=VARCHAR}
+
+
+
insert into t_product_picture (id, create_by, create_time, del_flag, update_by, update_time,product_id, product_picture) values
diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/ReturnDetailMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/ReturnDetailMapper.xml
index 6a005538..f7e06397 100644
--- a/hiver-modules/hiver-mall/src/main/resources/mapper/ReturnDetailMapper.xml
+++ b/hiver-modules/hiver-mall/src/main/resources/mapper/ReturnDetailMapper.xml
@@ -22,6 +22,9 @@
+
+
+
@@ -84,7 +87,8 @@
id, create_by, create_time, del_flag, update_by, update_time, sale_id, product_id,
product_name, unit, shop_id, category_id, attribute_list, price, purchase_price,
- wholesale_price, product_count, discount, discount_amount, real_price
+ wholesale_price, product_count, discount, discount_amount, real_price, return_sale_id,
+ product_picture, product_sn
insert into t_return_detail
@@ -195,6 +200,15 @@
real_price,
+
+ return_sale_id,
+
+
+ product_picture,
+
+
+ product_sn,
+
@@ -257,6 +271,15 @@
#{realPrice,jdbcType=DECIMAL},
+
+ #{returnSaleId,jdbcType=VARCHAR},
+
+
+ #{productPicture,jdbcType=VARCHAR},
+
+
+ #{productSn,jdbcType=VARCHAR},
+