From 1244cf1b41b35c01f2bc988fc4bc87b5111c4ba1 Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Thu, 24 Oct 2024 21:15:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hiver-admin/test-output/test-report.html | 18 +++++----- .../mall/controller/CommonController.java | 18 ++++++++-- .../mall/controller/CustomerController.java | 18 ++++++++++ .../mall/controller/SupplierControlller.java | 24 ++++++++++--- .../hiver/mall/dao/mapper/PurchaseMapper.java | 17 ++++++++++ .../mall/dao/mapper/ReturnSaleMapper.java | 6 ++++ .../cc/hiver/mall/dao/mapper/SaleMapper.java | 5 +++ .../debt/service/impl/DebtServiceImpl.java | 4 ++- .../mall/pojo/query/CustomerPageQuery.java | 9 +++++ .../cc/hiver/mall/pojo/vo/CustomerDataVo.java | 27 +++++++++++++++ .../cc/hiver/mall/pojo/vo/SupplierDataVo.java | 27 +++++++++++++++ .../mapper/PurchaseReturnMapper.java | 19 +++++++++++ .../service/PurchaseReturnService.java | 11 ++++++ .../impl/PurchaseReturnServiceImpl.java | 19 +++++++++++ .../hiver/mall/service/SupplierService.java | 11 ++++++ .../mall/service/mybatis/CustomerService.java | 10 ++++++ .../mall/service/mybatis/PurchaseService.java | 9 +++++ .../service/mybatis/ReturnSaleService.java | 4 +++ .../mall/service/mybatis/SaleService.java | 9 +++++ .../mall/serviceimpl/SupplierServiceImpl.java | 31 +++++++++++++++++ .../mybatis/CustomerServiceImpl.java | 30 +++++++++++++--- .../mybatis/PurchaseServiceImpl.java | 17 ++++++++++ .../mybatis/ReturnSaleServiceImpl.java | 22 ++++++++++++ .../serviceimpl/mybatis/SaleServiceImpl.java | 21 ++++++++++++ .../main/resources/mapper/PurchaseMapper.xml | 31 +++++++++++++++++ .../resources/mapper/PurchaseReturnMapper.xml | 30 ++++++++++++++++ .../resources/mapper/ReturnSaleMapper.xml | 34 +++++++++++++++++++ .../src/main/resources/mapper/SaleMapper.xml | 32 +++++++++++++++++ 28 files changed, 493 insertions(+), 20 deletions(-) create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/CustomerDataVo.java create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SupplierDataVo.java diff --git a/hiver-admin/test-output/test-report.html b/hiver-admin/test-output/test-report.html index cf1276a6..4c150364 100644 --- a/hiver-admin/test-output/test-report.html +++ b/hiver-admin/test-output/test-report.html @@ -5,7 +5,7 @@ -Hiver测试报告 +Hiver���Ա��� @@ -35,7 +35,7 @@ Hiver
  • -十月 23, 2024 23:46:29 +ʮ�� 24, 2024 20:09:59
  • @@ -84,7 +84,7 @@

    passTest

    -

    23:46:29 下午 / 0.01 secs

    +

    20:10:00 ���� / 0.017 secs

    @@ -92,9 +92,9 @@
    #test-id=1
    passTest
    -10.23.2024 23:46:29 -10.23.2024 23:46:29 -0.01 secs +10.24.2024 20:10:00 +10.24.2024 20:10:00 +0.017 secs
    @@ -104,7 +104,7 @@ Pass - 23:46:29 + 20:10:00 Test passed @@ -128,13 +128,13 @@

    Started

    -

    十月 23, 2024 23:46:29

    +

    ʮ�� 24, 2024 20:09:59

    Ended

    -

    十月 23, 2024 23:46:29

    +

    ʮ�� 24, 2024 20:10:00

    diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CommonController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CommonController.java index b2204369..591ae1c7 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CommonController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CommonController.java @@ -152,9 +152,9 @@ public class CommonController { final String shopId = securityUtil.getShopId(); final ShopUser shopUser = shopUserService.selectByUserIdAndShopId(user.getId(), shopId); // 这里接收前台得到type,只用于shop_user的type,不会对user的type产生影响 - if(!shopUser.getType().equals(Integer.valueOf(user.getType()))){ + if (!shopUser.getType().equals(Integer.valueOf(user.getType()))) { // 如果修改了权限信息,那么就需要清除用户缓存,重新登录 - final String oldToken = redisTemplate.get(SecurityConstant.USER_TOKEN + user.getUsername()+"type:"+user.getType()); + final String oldToken = redisTemplate.get(SecurityConstant.USER_TOKEN + user.getUsername() + "type:" + user.getType()); if (CharSequenceUtil.isNotBlank(oldToken)) { redisTemplate.delete(SecurityConstant.TOKEN_PRE + oldToken); } @@ -169,8 +169,22 @@ public class CommonController { @ApiOperation("批量通过ids删除") public Result delAllByIds(@RequestParam String[] ids) { for (String id : ids) { + final User user = userService.get(id); + // 员工信息 userService.delete(id); + // 员工店铺关联信息 + final String shopId = securityUtil.getShopId(); + shopUserService.deleteAllByShopIdAndUserId(shopId, id); + // 手动删除缓存 + final String oldToken = redisTemplate.get(SecurityConstant.USER_TOKEN + user.getUsername() + "type:0"); + if (CharSequenceUtil.isNotBlank(oldToken)) { + redisTemplate.delete(SecurityConstant.TOKEN_PRE + oldToken); + } + redisTemplate.delete("userRole::" + id); + redisTemplate.delete("userRole::depIds:" + id); + redisTemplate.delete("permission::userMenuList:" + id); } + return ResultUtil.success("批量通过id删除数据成功"); } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomerController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomerController.java index 48defce0..44da20b2 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomerController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomerController.java @@ -16,6 +16,7 @@ import cc.hiver.core.service.UserService; import cc.hiver.mall.entity.Customer; import cc.hiver.mall.pojo.dto.DebtCustomer; import cc.hiver.mall.pojo.query.CustomerPageQuery; +import cc.hiver.mall.pojo.vo.CustomerDataVo; import cc.hiver.mall.service.mybatis.CustomerService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -274,4 +275,21 @@ public class CustomerController { final Map map = customerService.getCustomerBuyHistory(productId, attributeList, customerId); return new ResultUtil>().setData(map); } + + /** + * 查询客户 拿货(总金额)商品总款数、总件数、退货(总金额)商品总款数、总件数 + * @author 王富康 + * @date 2024/10/24 + * @param customerPageQuery + * @return Result> + */ + @RequestMapping(value = "/getCustomerData", method = RequestMethod.POST) + @ApiOperation("查询客户 拿货(总金额)商品总款数、总件数、退货(总金额)商品总款数、总件数") + public Result getCustomerData(@RequestBody CustomerPageQuery customerPageQuery) { + if (StringUtils.isEmpty(customerPageQuery.getCustomerId())) { + return ResultUtil.error("客户id不能为空"); + } + final CustomerDataVo customerData = customerService.getCustomerData(customerPageQuery); + return new ResultUtil().setData(customerData); + } } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SupplierControlller.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SupplierControlller.java index dc8c8a2e..eaa15e87 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SupplierControlller.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SupplierControlller.java @@ -14,6 +14,8 @@ import cc.hiver.mall.debt.entity.Debt; import cc.hiver.mall.debt.service.DebtService; import cc.hiver.mall.entity.DealingsRecord; import cc.hiver.mall.entity.Supplier; +import cc.hiver.mall.pojo.query.PurchasePageQuery; +import cc.hiver.mall.pojo.vo.SupplierDataVo; import cc.hiver.mall.service.SupplierService; import cc.hiver.mall.service.mybatis.DealingsRecordService; import io.swagger.annotations.Api; @@ -22,10 +24,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; import java.util.Date; @@ -181,4 +180,21 @@ public class SupplierControlller { final List suppliers = supplierService.getbySupplierName(supplierName, shopId); return new ResultUtil>().setData(suppliers); } + + /** + * 查询供应商(总金额)商品总款数、总件数、采购退货(总金额)商品总款数、总件数 + * @author 王富康 + * @date 2024/10/24 + * @param purchasePageQuery + * @return Result> + */ + @RequestMapping(value = "/getSupplierData", method = RequestMethod.POST) + @ApiOperation("查询供应商(总金额)商品总款数、总件数、采购退货(总金额)商品总款数、总件数") + public Result getSupplierData(@RequestBody PurchasePageQuery purchasePageQuery) { + if (StringUtils.isEmpty(purchasePageQuery.getSupplierId())) { + return ResultUtil.error("供应商id不能为空"); + } + final SupplierDataVo suppliers = supplierService.getSupplierData(purchasePageQuery); + return new ResultUtil().setData(suppliers); + } } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/PurchaseMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/PurchaseMapper.java index 8981fc7d..7b2af39b 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/PurchaseMapper.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/PurchaseMapper.java @@ -7,6 +7,7 @@ import cc.hiver.mall.entity.PurchaseExample; import cc.hiver.mall.pojo.dto.DebtSupplier; import cc.hiver.mall.pojo.query.PurchasePageQuery; import cc.hiver.mall.pojo.vo.PurchasingCostDetailVo; +import cc.hiver.mall.pojo.vo.SupplierDataVo; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Param; @@ -63,4 +64,20 @@ public interface PurchaseMapper extends BaseMapper { * @return Page */ Page getPurchaseListBySupplierId(Page page,@Param("purchasePageQuery") PurchasePageQuery purchasePageQuery); + + /** + * 查询供应商(总金额)商品总款数 + * @author 王富康 + * @date 2024/10/24 + * @param purchasePageQuery + */ + SupplierDataVo getPurchasePrice(@Param("purchasePageQuery") PurchasePageQuery purchasePageQuery); + + /** + * 查询供应商总件数 + * @author 王富康 + * @date 2024/10/24 + * @param purchasePageQuery + */ + SupplierDataVo getPurchaseCount(@Param("purchasePageQuery") PurchasePageQuery purchasePageQuery); } \ 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 1d074bbf..7ec7c50f 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 @@ -4,7 +4,9 @@ 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.pojo.query.CustomerPageQuery; import cc.hiver.mall.pojo.query.ReturnSalePageQuery; +import cc.hiver.mall.pojo.vo.CustomerDataVo; import cc.hiver.mall.pojo.vo.ReturnSaleVo; import cc.hiver.mall.pojo.vo.ReturnTotalAmountDetailVo; import cc.hiver.mall.pojo.vo.SaleAllVO; @@ -93,4 +95,8 @@ public interface ReturnSaleMapper extends BaseMapper { * @return Integer */ Integer getCustomerReturnHistory(@Param("productId") String productId,@Param("attributeList") String attributeList,@Param("customerId") String customerId); + + CustomerDataVo getSaleReturnPrice(@Param("customerPageQuery") CustomerPageQuery customerPageQuery); + + CustomerDataVo getSaleReturnCount(@Param("customerPageQuery") CustomerPageQuery customerPageQuery); } \ 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 ce6d7d3c..e42a2d7f 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 @@ -6,6 +6,7 @@ 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; +import cc.hiver.mall.pojo.query.CustomerPageQuery; import cc.hiver.mall.pojo.query.SalePageQuery; import cc.hiver.mall.pojo.query.SalesRankingQueryCriteria; import cc.hiver.mall.pojo.vo.*; @@ -142,4 +143,8 @@ public interface SaleMapper extends BaseMapper { Page totalAmountDetailByProduct(Page page, @Param("salePageQuery") SalePageQuery salePageQuery); List buyCount(@Param("customerId")String customerId, @Param("productIdList") List productIdList); + + CustomerDataVo getSalePrice(@Param("customerPageQuery")CustomerPageQuery customerPageQuery); + + CustomerDataVo getSaleCount(@Param("customerPageQuery")CustomerPageQuery customerPageQuery); } \ No newline at end of file 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 f3e013f8..a30156ea 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 @@ -327,7 +327,9 @@ public class DebtServiceImpl extends ServiceImpl implements De BigDecimal newDebtAmount = BigDecimal.ZERO; lastDebtAmount = oldDebt.getAmountOwed() == null ? BigDecimal.ZERO : oldDebt.getAmountOwed(); // 计算欠款 - newDebtAmount = oldDebt.getAmountOwed().subtract(debt.getAmountOwed()); + if (oldDebt.getAmountOwed() != null) { + newDebtAmount = oldDebt.getAmountOwed().subtract(debt.getAmountOwed()); + } oldDebt.setAmountOwed(newDebtAmount); debtMapper.updateById(oldDebt); // 2. 新增欠款记录 diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/CustomerPageQuery.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/CustomerPageQuery.java index 465ddfb0..1f41f19b 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/CustomerPageQuery.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/CustomerPageQuery.java @@ -33,6 +33,9 @@ public class CustomerPageQuery extends HiverBasePageQuery { @ApiModelProperty("店铺ID") private String shopId; + @ApiModelProperty("客户id") + private String customerId; + @ApiModelProperty("删除标识") private Integer delFlag; @@ -42,5 +45,11 @@ public class CustomerPageQuery extends HiverBasePageQuery { @ApiModelProperty("查询超过多少天未拿货的") private String notBuyDays; + @ApiModelProperty(value = "起始日期") + private String startDate; + + @ApiModelProperty(value = "结束日期") + private String endDate; + } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/CustomerDataVo.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/CustomerDataVo.java new file mode 100644 index 00000000..1f94d1ab --- /dev/null +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/CustomerDataVo.java @@ -0,0 +1,27 @@ +package cc.hiver.mall.pojo.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 供应商(总金额)商品总款数、总件数、采购退货(总金额)商品总款数、总件数Vo + * @author 王富康 + * @date 2024/10/24 + */ +@Data +@ApiModel(value = "供应商(总金额)商品总款数、总件数、采购退货(总金额)商品总款数、总件数") +public class CustomerDataVo { + + @ApiModelProperty(value = "供应商(总金额)商品总款数") + private String salePrice; + + @ApiModelProperty(value = "总件数") + private Integer saleCount; + + @ApiModelProperty(value = "采购退货(总金额)商品总款数") + private String saleReturnPrice; + + @ApiModelProperty(value = "采购退货总件数") + private Integer saleReturnCount; +} diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SupplierDataVo.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SupplierDataVo.java new file mode 100644 index 00000000..2cab6b5c --- /dev/null +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SupplierDataVo.java @@ -0,0 +1,27 @@ +package cc.hiver.mall.pojo.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 供应商(总金额)商品总款数、总件数、采购退货(总金额)商品总款数、总件数Vo + * @author 王富康 + * @date 2024/10/24 + */ +@Data +@ApiModel(value = "供应商(总金额)商品总款数、总件数、采购退货(总金额)商品总款数、总件数") +public class SupplierDataVo { + + @ApiModelProperty(value = "供应商(总金额)商品总款数") + private String purchasePrice; + + @ApiModelProperty(value = "总件数") + private Integer purchaseCount; + + @ApiModelProperty(value = "采购退货(总金额)商品总款数") + private String purchaseReturnPrice; + + @ApiModelProperty(value = "采购退货总件数") + private Integer purchaseReturnCount; +} diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchasereturn/mapper/PurchaseReturnMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchasereturn/mapper/PurchaseReturnMapper.java index 8c118d2a..ff50e5aa 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchasereturn/mapper/PurchaseReturnMapper.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchasereturn/mapper/PurchaseReturnMapper.java @@ -1,5 +1,7 @@ package cc.hiver.mall.purchasereturn.mapper; +import cc.hiver.mall.pojo.query.PurchasePageQuery; +import cc.hiver.mall.pojo.vo.SupplierDataVo; import cc.hiver.mall.purchasereturn.entity.PurchaseReturn; import cc.hiver.mall.purchasereturn.vo.PurchaseReturnQueryVo; import com.baomidou.mybatisplus.core.mapper.BaseMapper; @@ -27,4 +29,21 @@ public interface PurchaseReturnMapper extends BaseMapper { void cancelPurchaseReturnById(@Param("id") String id); + /** + * 查询供应商 采购退货(总金额)商品总款数 + * @author 王富康 + * @date 2024/10/24 + * @param purchasePageQuery + * @return SupplierDataVo + */ + SupplierDataVo getPurchaseReturnPrice(@Param("purchasePageQuery") PurchasePageQuery purchasePageQuery); + + /** + * 查询供应商 采购退货总件数 + * @author 王富康 + * @date 2024/10/24 + * @param purchasePageQuery + * @return SupplierDataVo + */ + SupplierDataVo getPurchaseReturnCount(@Param("purchasePageQuery") PurchasePageQuery purchasePageQuery); } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchasereturn/service/PurchaseReturnService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchasereturn/service/PurchaseReturnService.java index 6d6511b3..800fbdfe 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchasereturn/service/PurchaseReturnService.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchasereturn/service/PurchaseReturnService.java @@ -1,5 +1,7 @@ package cc.hiver.mall.purchasereturn.service; +import cc.hiver.mall.pojo.query.PurchasePageQuery; +import cc.hiver.mall.pojo.vo.SupplierDataVo; import cc.hiver.mall.purchasereturn.entity.PurchaseReturn; import cc.hiver.mall.purchasereturn.vo.PurchaseReturnDataVo; import cc.hiver.mall.purchasereturn.vo.PurchaseReturnQueryVo; @@ -42,4 +44,13 @@ public interface PurchaseReturnService extends IService { * @date 2024/8/17 */ void cancelPurchaseReturn(String id); + + /** + * 查询供应商 采购退货(总金额)商品总款数、总件数 + * @author 王富康 + * @date 2024/10/24 + * @param purchasePageQuery + * @return SupplierDataVo + */ + SupplierDataVo getSupplierReturnPurchaseInfo(PurchasePageQuery purchasePageQuery); } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchasereturn/service/impl/PurchaseReturnServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchasereturn/service/impl/PurchaseReturnServiceImpl.java index d86c5835..5fade7fe 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchasereturn/service/impl/PurchaseReturnServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchasereturn/service/impl/PurchaseReturnServiceImpl.java @@ -8,6 +8,8 @@ import cc.hiver.mall.entity.Product; import cc.hiver.mall.entity.Stock; import cc.hiver.mall.entity.StockLog; import cc.hiver.mall.entity.Supplier; +import cc.hiver.mall.pojo.query.PurchasePageQuery; +import cc.hiver.mall.pojo.vo.SupplierDataVo; import cc.hiver.mall.purchasereturn.constant.PurchaseReturnConstant; import cc.hiver.mall.purchasereturn.entity.PurchaseReturn; import cc.hiver.mall.purchasereturn.entity.PurchaseReturnDetail; @@ -231,4 +233,21 @@ public class PurchaseReturnServiceImpl extends ServiceImpl { * @date 2024/8/11 */ List getbySupplierName(String supplierName, String shopId); + + /** + * 查询供应商(总金额)商品总款数、总件数、采购退货(总金额)商品总款数、总件数 + * @author 王富康 + * @date 2024/10/24 + * @param purchasePageQuery + * @return SupplierDataVo + */ + SupplierDataVo getSupplierData(PurchasePageQuery purchasePageQuery); } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/CustomerService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/CustomerService.java index 3624b6cb..e5f0aa42 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/CustomerService.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/CustomerService.java @@ -3,6 +3,7 @@ package cc.hiver.mall.service.mybatis; import cc.hiver.mall.entity.Customer; import cc.hiver.mall.pojo.dto.DebtCustomer; import cc.hiver.mall.pojo.query.CustomerPageQuery; +import cc.hiver.mall.pojo.vo.CustomerDataVo; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; @@ -37,4 +38,13 @@ public interface CustomerService extends IService { List findByUserPhoneAndShopId(String userPhone, String shopId); Map getCustomerBuyHistory(String productId, String attributeList, String customerId); + + /** + * 查询客户 拿货(总金额)商品总款数、总件数、退货(总金额)商品总款数、总件数 + * @author 王富康 + * @date 2024/10/24 + * @param customerPageQuery + * @return SupplierDataVo + */ + CustomerDataVo getCustomerData(CustomerPageQuery customerPageQuery); } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/PurchaseService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/PurchaseService.java index b4d80bc6..a1c6b504 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/PurchaseService.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/PurchaseService.java @@ -7,6 +7,7 @@ import cc.hiver.mall.pojo.dto.DebtSupplier; import cc.hiver.mall.pojo.query.PurchasePageQuery; import cc.hiver.mall.pojo.vo.PurchaseVo; import cc.hiver.mall.pojo.vo.PurchasingCostDetailVo; +import cc.hiver.mall.pojo.vo.SupplierDataVo; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; @@ -79,4 +80,12 @@ public interface PurchaseService extends IService { void cancelPurchase(String id); boolean insert(Purchase purchase); + + /** + * 查询供应商(总金额)商品总款数、总件数 + * @author 王富康 + * @date 2024/10/24 + * @param purchasePageQuery + */ + SupplierDataVo getSupplierPurchaseInfo(PurchasePageQuery purchasePageQuery); } 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 afb1478f..827ef32d 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 @@ -3,7 +3,9 @@ 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.pojo.query.CustomerPageQuery; import cc.hiver.mall.pojo.query.ReturnSalePageQuery; +import cc.hiver.mall.pojo.vo.CustomerDataVo; import cc.hiver.mall.pojo.vo.ReturnSaleVo; import cc.hiver.mall.pojo.vo.ReturnTotalAmountDetailVo; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -61,4 +63,6 @@ public interface ReturnSaleService extends IService { * @return Integer */ Integer getCustomerReturnHistory(String productId, String attributeList, String customerId); + + CustomerDataVo getCustomerSaleReturnInfo(CustomerPageQuery customerPageQuery); } 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 6098510d..7ab882a5 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 @@ -5,6 +5,7 @@ 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.dto.SaleQueryDTO; +import cc.hiver.mall.pojo.query.CustomerPageQuery; import cc.hiver.mall.pojo.query.SalePageQuery; import cc.hiver.mall.pojo.query.SalesRankingQueryCriteria; import cc.hiver.mall.pojo.vo.*; @@ -159,4 +160,12 @@ public interface SaleService extends IService { */ List buyCount(String customerId, List productIdList); + /** + * 查询客户 拿货(总金额)商品总款数、总件数 + * @author 王富康 + * @date 2024/10/24 + * @param customerPageQuery + * @return CustomerDataVo + */ + CustomerDataVo getCustomerSaleInfo(CustomerPageQuery customerPageQuery); } 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 77c95ac5..afd91515 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 @@ -9,8 +9,12 @@ import cc.hiver.mall.debt.entity.Debt; import cc.hiver.mall.debt.service.DebtService; import cc.hiver.mall.entity.DealingsRecord; import cc.hiver.mall.entity.Supplier; +import cc.hiver.mall.pojo.query.PurchasePageQuery; +import cc.hiver.mall.pojo.vo.SupplierDataVo; +import cc.hiver.mall.purchasereturn.service.PurchaseReturnService; import cc.hiver.mall.service.SupplierService; import cc.hiver.mall.service.mybatis.DealingsRecordService; +import cc.hiver.mall.service.mybatis.PurchaseService; import cn.hutool.core.text.CharSequenceUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -43,6 +47,12 @@ public class SupplierServiceImpl implements SupplierService { @Autowired private DealingsRecordService dealingsRecordService; + @Autowired + private PurchaseService purchaseService; + + @Autowired + private PurchaseReturnService purchaseReturnService; + @Override public HiverBaseDao getRepository() { return supplierDao; @@ -172,4 +182,25 @@ public class SupplierServiceImpl implements SupplierService { public List getbySupplierName(String supplierName, String shopId) { return supplierDao.getbySupplierName(supplierName, shopId); } + + /** + * 查询供应商(总金额)商品总款数、总件数、采购退货(总金额)商品总款数、总件数 + * @author 王富康 + * @date 2024/10/24 + * @param purchasePageQuery + * @return SupplierDataVo + */ + @Override + public SupplierDataVo getSupplierData(PurchasePageQuery purchasePageQuery) { + final SupplierDataVo returnSupplierDataVo = new SupplierDataVo(); + // 查询供应商(总金额)商品总款数、总件数 + final SupplierDataVo supplierPurchaseInfo = purchaseService.getSupplierPurchaseInfo(purchasePageQuery); + returnSupplierDataVo.setPurchasePrice(supplierPurchaseInfo.getPurchasePrice()); + returnSupplierDataVo.setPurchaseCount(supplierPurchaseInfo.getPurchaseCount()); + // 查询供应商 采购退货(总金额)商品总款数、总件数 + final SupplierDataVo supplierReturnPurchaseInfo = purchaseReturnService.getSupplierReturnPurchaseInfo(purchasePageQuery); + returnSupplierDataVo.setPurchaseReturnPrice(supplierReturnPurchaseInfo.getPurchaseReturnPrice()); + returnSupplierDataVo.setPurchaseReturnCount(supplierReturnPurchaseInfo.getPurchaseReturnCount()); + return returnSupplierDataVo; + } } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/CustomerServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/CustomerServiceImpl.java index f3f7bc78..cf8355c5 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/CustomerServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/CustomerServiceImpl.java @@ -21,10 +21,8 @@ import cc.hiver.mall.entity.Customer; import cc.hiver.mall.entity.DealingsRecord; import cc.hiver.mall.pojo.dto.DebtCustomer; import cc.hiver.mall.pojo.query.CustomerPageQuery; -import cc.hiver.mall.service.mybatis.CustomerService; -import cc.hiver.mall.service.mybatis.DealingsRecordService; -import cc.hiver.mall.service.mybatis.ReturnSaleService; -import cc.hiver.mall.service.mybatis.SaleDetailService; +import cc.hiver.mall.pojo.vo.CustomerDataVo; +import cc.hiver.mall.service.mybatis.*; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.factory.annotation.Autowired; @@ -62,6 +60,9 @@ public class CustomerServiceImpl extends ServiceImpl i @Autowired private SaleDetailService saleDetailService; + @Autowired + private SaleService saleService; + @Autowired private ReturnSaleService returnSaleService; @@ -237,4 +238,25 @@ public class CustomerServiceImpl extends ServiceImpl i result.put("returnCount",returnCount); return result; } + + /** + * 查询客户 拿货(总金额)商品总款数、总件数、退货(总金额)商品总款数、总件数 + * @author 王富康 + * @date 2024/10/24 + * @param customerPageQuery + * @return SupplierDataVo + */ + @Override + public CustomerDataVo getCustomerData(CustomerPageQuery customerPageQuery) { + final CustomerDataVo customerDataVo = new CustomerDataVo(); + // 查询客户 拿货(总金额)商品总款数、总件数 + final CustomerDataVo saleDataVo = saleService.getCustomerSaleInfo(customerPageQuery); + customerDataVo.setSalePrice(saleDataVo.getSalePrice()); + customerDataVo.setSaleCount(saleDataVo.getSaleCount()); + // 查询客户 退货(总金额)商品总款数、总件数 + final CustomerDataVo returnSaleInfo = returnSaleService.getCustomerSaleReturnInfo(customerPageQuery); + customerDataVo.setSaleReturnPrice(returnSaleInfo.getSaleReturnPrice()); + customerDataVo.setSaleReturnCount(returnSaleInfo.getSaleReturnCount()); + return customerDataVo; + } } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/PurchaseServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/PurchaseServiceImpl.java index 2b3e2332..a9a06e59 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/PurchaseServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/PurchaseServiceImpl.java @@ -15,6 +15,7 @@ import cc.hiver.mall.pojo.query.PurchasePageQuery; import cc.hiver.mall.pojo.vo.ProductCategoryVo; import cc.hiver.mall.pojo.vo.PurchaseVo; import cc.hiver.mall.pojo.vo.PurchasingCostDetailVo; +import cc.hiver.mall.pojo.vo.SupplierDataVo; import cc.hiver.mall.purchaseocr.entity.PurchaseOcrPicture; import cc.hiver.mall.purchaseocr.service.PurchaseOcrPictureService; import cc.hiver.mall.purchaseocr.vo.PurchaseOcrCountVo; @@ -763,4 +764,20 @@ public class PurchaseServiceImpl extends ServiceImpl i final int insert = purchaseMapper.insert(purchase); return insert > 0; } + + /** + * 查询供应商(总金额)商品总款数、总件数 + * @author 王富康 + * @date 2024/10/24 + * @param purchasePageQuery + */ + @Override + public SupplierDataVo getSupplierPurchaseInfo(PurchasePageQuery purchasePageQuery) { + final SupplierDataVo supplierDataVo = new SupplierDataVo(); + final SupplierDataVo purchasePrice = purchaseMapper.getPurchasePrice(purchasePageQuery); + final SupplierDataVo purchaseCount = purchaseMapper.getPurchaseCount(purchasePageQuery); + supplierDataVo.setPurchasePrice(purchasePrice.getPurchasePrice()); + supplierDataVo.setPurchaseCount(purchaseCount.getPurchaseCount()); + return supplierDataVo; + } } 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 96813ec1..074af894 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 @@ -9,7 +9,9 @@ import cc.hiver.mall.entity.ReturnDetail; import cc.hiver.mall.entity.ReturnSale; import cc.hiver.mall.pojo.dto.ReturnSaleDetailDTO; import cc.hiver.mall.pojo.dto.SaleDetailQueryDTO; +import cc.hiver.mall.pojo.query.CustomerPageQuery; import cc.hiver.mall.pojo.query.ReturnSalePageQuery; +import cc.hiver.mall.pojo.vo.CustomerDataVo; import cc.hiver.mall.pojo.vo.ReturnSaleVo; import cc.hiver.mall.pojo.vo.ReturnTotalAmountDetailVo; import cc.hiver.mall.service.mybatis.ProductService; @@ -287,4 +289,24 @@ public class ReturnSaleServiceImpl extends ServiceImpl implements Sa return saleMapper.buyCount(customerId,productIdList); } + /** + * 查询客户 拿货(总金额)商品总款数、总件数 + * @author 王富康 + * @date 2024/10/24 + * @param customerPageQuery + * @return CustomerDataVo + */ + @Override + public CustomerDataVo getCustomerSaleInfo(CustomerPageQuery customerPageQuery) { + final CustomerDataVo customerDataVo = new CustomerDataVo(); + // 查询客户 拿货(总金额)商品总款数 + final CustomerDataVo salePrice = saleMapper.getSalePrice(customerPageQuery); + + // 查询客户 总件数 + final CustomerDataVo saleCount = saleMapper.getSaleCount(customerPageQuery); + customerDataVo.setSalePrice(salePrice.getSalePrice()); + customerDataVo.setSaleCount(saleCount.getSaleCount()); + return customerDataVo; + } + /** * 使用正则表达式替换输入字符串中连续的“叉”字符为相应数量的“X”字符。 * diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/PurchaseMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/PurchaseMapper.xml index 1ddfb150..50437f63 100644 --- a/hiver-modules/hiver-mall/src/main/resources/mapper/PurchaseMapper.xml +++ b/hiver-modules/hiver-mall/src/main/resources/mapper/PurchaseMapper.xml @@ -582,4 +582,35 @@ order by create_time desc + + + + + + \ No newline at end of file diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/PurchaseReturnMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/PurchaseReturnMapper.xml index cca964ae..75c8d746 100644 --- a/hiver-modules/hiver-mall/src/main/resources/mapper/PurchaseReturnMapper.xml +++ b/hiver-modules/hiver-mall/src/main/resources/mapper/PurchaseReturnMapper.xml @@ -70,4 +70,34 @@ + + + + \ No newline at end of file diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/ReturnSaleMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/ReturnSaleMapper.xml index 3f92248e..d0ea9a20 100644 --- a/hiver-modules/hiver-mall/src/main/resources/mapper/ReturnSaleMapper.xml +++ b/hiver-modules/hiver-mall/src/main/resources/mapper/ReturnSaleMapper.xml @@ -708,4 +708,38 @@ AND ss.STATUS = 4 AND ss.user_id = #{customerId} + + + + + \ No newline at end of file diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml index cff27467..8cc8c697 100644 --- a/hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml +++ b/hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml @@ -1394,4 +1394,36 @@ GROUP BY GROUP BY dd.product_id + + + + \ No newline at end of file