diff --git a/hiver-admin/test-output/test-report.html b/hiver-admin/test-output/test-report.html index eafac732..944409fd 100644 --- a/hiver-admin/test-output/test-report.html +++ b/hiver-admin/test-output/test-report.html @@ -35,7 +35,7 @@ Hiver
  • -十月 08, 2024 19:35:03 +十月 13, 2024 00:07:47
  • @@ -84,7 +84,7 @@

    passTest

    -

    19:35:03 下午 / 0.015 secs

    +

    00:07:47 上午 / 0.017 secs

    @@ -92,9 +92,9 @@
    #test-id=1
    passTest
    -10.08.2024 19:35:03 -10.08.2024 19:35:03 -0.015 secs +10.13.2024 00:07:47 +10.13.2024 00:07:47 +0.017 secs
    @@ -104,7 +104,7 @@ Pass - 19:35:03 + 0:07:47 Test passed @@ -128,13 +128,13 @@

    Started

    -

    十月 08, 2024 19:35:03

    +

    十月 13, 2024 00:07:47

    Ended

    -

    十月 08, 2024 19:35:03

    +

    十月 13, 2024 00:07:47

    diff --git a/hiver-core/src/main/java/cc/hiver/core/common/constant/ShopConstant.java b/hiver-core/src/main/java/cc/hiver/core/common/constant/ShopConstant.java index 1039e895..db223358 100644 --- a/hiver-core/src/main/java/cc/hiver/core/common/constant/ShopConstant.java +++ b/hiver-core/src/main/java/cc/hiver/core/common/constant/ShopConstant.java @@ -16,4 +16,6 @@ public interface ShopConstant { */ Integer SHOP_STATUS_LOCK = 0; + String[] PRINTING_METHOD = {"0","1"}; + } 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 14a7cd42..a5d8530f 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 @@ -5,10 +5,7 @@ import cc.hiver.base.vo.QRStatusVo; 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.constant.*; import cc.hiver.core.common.enums.LogType; import cc.hiver.core.common.exception.HiverException; import cc.hiver.core.common.redis.RedisTemplateHelper; @@ -446,6 +443,8 @@ public class AuthController { // 20240525 鏂板搴楅摵锛屾柊澧炲簵閾哄昂鐮佸簱 final String categoryId = productCategoryService.addCategoryOfShop(); shop.setAttrId(categoryId); + // 20241010 鎵撳嵃鏂瑰紡 瀛楁榛樿缁 0 + shop.setPrintingMethod(ShopConstant.PRINTING_METHOD[0]); shopService.save(shop); // 20240625鏂板榛樿渚涘簲鍟 final Supplier supplier = new Supplier(); 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 ecc5fe12..48defce0 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 @@ -29,6 +29,7 @@ import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.*; import java.util.List; +import java.util.Map; @Slf4j @RestController @@ -248,5 +249,29 @@ public class CustomerController { final List list = customerService.findByUserPhoneAndShopId(userPhone, shopId); return new ResultUtil>().setData(list); } - + /** + * 鏍规嵁productId鍜宎ttributeList鍜宑ustomerId鏌ヨ璇ュ鎴疯喘涔拌鍟嗗搧瑙勬牸鐨勬讳欢鏁帮紝浠ュ強閫璐ф讳欢鏁 + * @author 鐜嬪瘜搴 + * @date 2024/10/11 + * @param productId + * @param attributeList + * @param customerId + * @return Result + */ + @RequestMapping(value = "/getCustomerBuyHistory", method = RequestMethod.POST) + @ApiOperation("鏍规嵁productId鍜宎ttributeList鍜宑ustomerId鏌ヨ璇ュ鎴疯喘涔拌鍟嗗搧瑙勬牸鐨勬讳欢鏁帮紝浠ュ強閫璐ф讳欢鏁") + public Result getCustomerBuyHistory(String productId, String attributeList, String customerId) { + if(StringUtils.isEmpty(productId)){ + return ResultUtil.error("鍟嗗搧id涓嶈兘涓虹┖"); + } + if(StringUtils.isEmpty(attributeList)){ + return ResultUtil.error("鍟嗗搧瑙勬牸涓嶈兘涓虹┖"); + } + if(StringUtils.isEmpty(customerId)){ + return ResultUtil.error("瀹㈡埛id涓嶈兘涓虹┖"); + } + // shopId浠庣紦瀛樹腑璁剧疆 + final Map map = customerService.getCustomerBuyHistory(productId, attributeList, customerId); + return new ResultUtil>().setData(map); + } } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java index 21398b4a..5324fed8 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java @@ -304,6 +304,9 @@ public class ShopController { if (shop.getRemark() != null) { oldShop.setRemark(shop.getRemark()); } + if (shop.getPrintingMethod() != null) { + oldShop.setPrintingMethod(shop.getPrintingMethod()); + } shopService.update(oldShop); return ResultUtil.success("鏇存柊鎴愬姛"); } 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 342132a7..dc8c8a2e 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 @@ -139,6 +139,7 @@ public class SupplierControlller { data.setAddress(entity.getAddress()); data.setConsigneeName(entity.getConsigneeName()); data.setConsigneeMobile(entity.getConsigneeMobile()); + data.setOrderByField(entity.getOrderByField()); final Supplier supplier = supplierService.update(data); return new ResultUtil().setData(supplier); } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopUserDao.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopUserDao.java index 3affaf5d..d8340a46 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopUserDao.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopUserDao.java @@ -12,7 +12,7 @@ public interface ShopUserDao extends HiverBaseDao { @Query(value = "select * from t_shop_user where user_id = ? and shop_id = ?",nativeQuery = true) ShopUser selectByUserIdAndShopId(String userId,String shopId); - @Query(value = "select * from t_shop_user t where t.shop_id in (select id from t_shop where status=? and start_time <= ? and end_time >= ?) and user_id = ?",nativeQuery = true) + @Query(value = "SELECT t_su.*, t_s.printing_method FROM t_shop_user t_su INNER JOIN t_shop t_s ON t_su.shop_id = t_s.id WHERE t_s.status = ? AND t_s.start_time <= ? AND t_s.end_time >= ? AND t_su.user_id = ?",nativeQuery = true) List selectByUserId(Integer status,String startTime,String endTime,String userId); /** 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 7586b5b2..1d074bbf 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 @@ -82,4 +82,15 @@ public interface ReturnSaleMapper extends BaseMapper { Page getReturnSaleListByUserId(Page page, @Param("returnSalePageQuery") ReturnSalePageQuery returnSalePageQuery); void deleteBySaleId(@Param("saleId") String saleId); + + /** + * 鑾峰彇瀹㈡埛璐拱璇ュ晢鍝侀璐ф讳欢鏁 + * @author 鐜嬪瘜搴 + * @date 2024/10/11 + * @param productId + * @param attributeList + * @param customerId + * @return Integer + */ + Integer getCustomerReturnHistory(@Param("productId") String productId,@Param("attributeList") String attributeList,@Param("customerId") String customerId); } \ 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 b9226aad..350513ae 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 @@ -51,4 +51,15 @@ public interface SaleDetailMapper extends BaseMapper { List selectDetailListByProductIds(@Param("productIdList")List productIdList,@Param("sale") Sale sale); BigDecimal getTotalProfit(@Param("shopId") String shopId,@Param("startDate") String startDate,@Param("endDate") String endDate); + + /** + * 鑾峰彇瀹㈡埛璐拱璇ュ晢鍝佽鏍肩殑鎬讳欢鏁 + * @author 鐜嬪瘜搴 + * @date 2024/10/11 + * @param productId + * @param attributeList + * @param customerId + * @return Integer + */ + Integer getCustomerBuyHistory(@Param("productId") String productId,@Param("attributeList") String attributeList,@Param("customerId") String customerId); } \ No newline at end of file diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/controller/DebtController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/controller/DebtController.java index 3f24789b..54b475dd 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/controller/DebtController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/controller/DebtController.java @@ -103,15 +103,31 @@ public class DebtController { /** * 鏌ヨ鎸囧畾搴楅摵鐨勬墍鏈夋瑺娆惧鎴/渚涘簲鍟嗘暟閲忓強娆犳閲戦 - * @author 鐜嬪瘜搴 - * @date 2024/8/8 + * * @param queryDebtVo * @return Result - */ + * @author 鐜嬪瘜搴 + * @date 2024/8/8 + */ @RequestMapping(value = "/getAllDebtByShopId", method = RequestMethod.POST) @ApiOperation("鏌ヨ鎸囧畾搴楅摵鐨勬墍鏈夋瑺娆惧鎴/渚涘簲鍟嗘暟閲忓強娆犳閲戦") public Result getAllDebtByShopId(@RequestBody QueryDebtVo queryDebtVo) { final DebtOfShopVo debtByShopId = debtService.getAllDebtByShopId(queryDebtVo); return new ResultUtil<>().setData(debtByShopId); } + + /** + * 鏌ユ讳綑棰濅汉鏁板拰鎬讳綑棰 + * + * @param queryDebtVo + * @return Result + * @author 鐜嬪瘜搴 + * @date 2024/10/11 + */ + @RequestMapping(value = "/getAllBalanceByShopId", method = RequestMethod.POST) + @ApiOperation("鏌ユ讳綑棰濅汉鏁板拰鎬讳綑棰") + public Result getAllBalanceByShopId(@RequestBody QueryDebtVo queryDebtVo) { + final DebtOfShopVo debtOfShopVo = debtService.getAllBalanceByShopId(queryDebtVo); + return new ResultUtil<>().setData(debtOfShopVo); + } } 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 b2ff6382..51472cf6 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 @@ -12,9 +12,19 @@ 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); + Debt selectByUserId(@Param("shopId") String shopId, @Param("userId") String userId); List getDebtByUserIds(@Param("userIds") List userIds); DebtOfShopVo getAllDebtByShopId(@Param("queryDebtVo") QueryDebtVo queryDebtVo); + + /** + * 鏌ユ讳綑棰濅汉鏁板拰鎬讳綑棰 + * + * @param queryDebtVo + * @return DebtOfShopVo + * @author 鐜嬪瘜搴 + * @date 2024/10/11 + */ + DebtOfShopVo getAllBalanceByShopId(@Param("queryDebtVo") QueryDebtVo queryDebtVo); } 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 ce580a3a..e4e12fd5 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 @@ -84,4 +84,14 @@ public interface DebtService extends IService { DebtOfShopVo getAllDebtByShopId(QueryDebtVo queryDebtVo); void purchaseReturnToDebt(PurchaseReturn putOutPurchase, String type); + + /** + * 鏌ユ讳綑棰濅汉鏁板拰鎬讳綑棰 + * + * @param queryDebtVo + * @return DebtOfShopVo + * @author 鐜嬪瘜搴 + * @date 2024/10/11 + */ + DebtOfShopVo getAllBalanceByShopId(QueryDebtVo queryDebtVo); } 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 ed92a01d..f3e013f8 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 @@ -292,11 +292,11 @@ public class DebtServiceImpl extends ServiceImpl implements De public Debt selectByUserId(String shopId, String userId) { final Debt debt = debtMapper.selectByUserId(shopId, userId); // 鏌ヨ瀹㈡埛鐨勫垎绫籭d - if(debt != null){ + if (debt != null) { // 鑾峰彇瀹㈡埛淇℃伅 final Customer customer = customerService.getById(userId); // 鍙兘浼犱緵搴斿晢鐨刬d,鏌ヤ笉鍒帮紝灏变笉鏀句簡銆 - if(customer != null){ + if (customer != null) { debt.setCategoryId(customer.getCategoryId()); debt.setCategoryName(customer.getCategoryName()); } @@ -358,7 +358,7 @@ public class DebtServiceImpl extends ServiceImpl implements De public DebtOfShopVo getAllDebtByShopId(QueryDebtVo queryDebtVo) { final DebtOfShopVo allDebtByShopId = debtMapper.getAllDebtByShopId(queryDebtVo); // 渚涜揣鍟嗚幏鍙栦粖鏃ヨ繘璐ф讳欢鏁 - if(DebtConstant.USER_TYPE[1].equals(queryDebtVo.getUserType())){ + if (DebtConstant.USER_TYPE[1].equals(queryDebtVo.getUserType())) { final SupplierBillQueryVo supplierBillQueryVo = new SupplierBillQueryVo(); supplierBillQueryVo.setShopId(queryDebtVo.getShopId()); final String todayStr = DateUtil.COMMON.getDateText(new Date()); @@ -426,4 +426,17 @@ public class DebtServiceImpl extends ServiceImpl implements De dealingsRecordService.save(dealingsRecord); } + + /** + * 鏌ユ讳綑棰濅汉鏁板拰鎬讳綑棰 + * + * @param queryDebtVo + * @return DebtOfShopVo + * @author 鐜嬪瘜搴 + * @date 2024/10/11 + */ + @Override + public DebtOfShopVo getAllBalanceByShopId(QueryDebtVo queryDebtVo) { + return debtMapper.getAllBalanceByShopId(queryDebtVo); + } } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Customer.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Customer.java index b88877d3..cc465666 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Customer.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Customer.java @@ -85,4 +85,7 @@ public class Customer implements Serializable { @ApiModelProperty(value = "瀹㈡埛鍒嗙被鍚嶇О") private String categoryName; + @ApiModelProperty(value = "鎺掑簭瀛楁") + private String orderByField; + } \ No newline at end of file diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Shop.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Shop.java index 6f867ea4..9017d66a 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Shop.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Shop.java @@ -127,4 +127,7 @@ public class Shop extends HiverBaseEntity { @ApiModelProperty(value = "搴楅摵瑙勬牸搴撳垎绫籭d") private String attrId; + + @ApiModelProperty(value = "鎵撳嵃鏂瑰紡") + private String printingMethod; } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopUser.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopUser.java index 7b26b80e..dc46fe96 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopUser.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopUser.java @@ -50,4 +50,9 @@ public class ShopUser extends HiverBaseEntity { @ApiModelProperty(value = "搴椾富鑱旂郴鏂瑰紡") private String shopOwnerPhone; + @Transient + @TableField(exist = false) + @ApiModelProperty(value = "鎵撳嵃鏂瑰紡") + private String printingMethod; + } 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 54a70624..dfefadac 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 @@ -45,6 +45,21 @@ public class Supplier extends HiverBaseEntity { @ApiModelProperty(value = "渚涘簲鍟嗚仈绯绘柟寮") private String consigneeMobile; + @ApiModelProperty(value = "鏀惰揣浜烘墍灞炲尯鍩") + private String consigneeArea; + + @ApiModelProperty(value = "鏀惰揣浜哄叕鍙") + private String consigneeCompany; + + @ApiModelProperty(value = "鐢ㄦ埛id?") + private String userId; + + @ApiModelProperty(value = "閭紪") + private String zipCode; + + @ApiModelProperty(value = "鎺掑簭瀛楁") + private String orderByField; + @Transient @TableField(exist = false) @ApiModelProperty(value = "娆犳") 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 b3ef00e1..3624b6cb 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 @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import java.util.List; +import java.util.Map; public interface CustomerService extends IService { Page debt(CustomerPageQuery customerPageQuery); @@ -34,4 +35,6 @@ public interface CustomerService extends IService { * @return List */ List findByUserPhoneAndShopId(String userPhone, String shopId); + + Map getCustomerBuyHistory(String productId, String attributeList, String customerId); } 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 25a9736b..afb1478f 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 @@ -50,4 +50,15 @@ public interface ReturnSaleService extends IService { Page getReturnSaleListByUserId(ReturnSalePageQuery returnSalePageQuery); void deleteBySaleId(String saleId); + + /** + * 鑾峰彇瀹㈡埛璐拱璇ュ晢鍝侀璐ф讳欢鏁 + * @author 鐜嬪瘜搴 + * @date 2024/10/11 + * @param productId + * @param attributeList + * @param customerId + * @return Integer + */ + Integer getCustomerReturnHistory(String productId, String attributeList, String customerId); } 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 28cb5c44..8da9c0d6 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 @@ -53,4 +53,15 @@ public interface SaleDetailService extends IService { * @return BigDecimal */ BigDecimal getTotalProfit(String shopId, String startTime, String endTime); + + /** + * 鑾峰彇瀹㈡埛璐拱璇ュ晢鍝佽鏍肩殑鎬讳欢鏁 + * @author 鐜嬪瘜搴 + * @date 2024/10/11 + * @param productId + * @param attributeList + * @param customerId + * @return Integer + */ + Integer getCustomerBuyHistory(String productId, String attributeList, String customerId); } 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 5e28081a..77c95ac5 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 @@ -65,14 +65,21 @@ public class SupplierServiceImpl implements SupplierService { list.add(cb.equal(shopIdField, supplierOfquery.getShopId())); list.add(cb.equal(delFlagField, supplierOfquery.getDelFlag())); if (CharSequenceUtil.isNotBlank(supplierOfquery.getSearchStr())) { - Predicate p = cb.or(cb.like(consigneeNameField, "%" + supplierOfquery.getSearchStr() + "%")); - p = cb.or(p, cb.like(consigneeMobileField, "%" + supplierOfquery.getSearchStr() + "%")); + Predicate p = cb.or(cb.like(consigneeNameField, '%' + supplierOfquery.getSearchStr() + '%')); + p = cb.or(p, cb.like(consigneeMobileField, '%' + supplierOfquery.getSearchStr() + '%')); list.add(p); } - final Predicate[] arr = new Predicate[list.size()]; cq.where(list.toArray(arr)); + final Expression orderByExpression = root.get("orderByField"); + final Expression orderCase = cb.selectCase() + .when(cb.isNull(orderByExpression), 1) // 濡傛灉鏄 null, 缁欎竴涓緝澶х殑鍊 + .otherwise(0); // 濡傛灉涓嶆槸 null, 缁欎竴涓緝灏忕殑鍊 + cq.orderBy( + cb.asc(orderCase), // 鍏堟寜鏄惁涓 null 鎺掑簭 + cb.asc(orderByExpression) // 鍐嶆寜瀹為檯鍊兼帓搴 + ); return null; } }, pageable); 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 ea202481..f3f7bc78 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 @@ -23,6 +23,8 @@ 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 com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.factory.annotation.Autowired; @@ -31,9 +33,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.ObjectUtils; import java.math.BigDecimal; -import java.util.Arrays; -import java.util.Date; -import java.util.List; +import java.util.*; @Service public class CustomerServiceImpl extends ServiceImpl implements CustomerService { @@ -59,6 +59,12 @@ public class CustomerServiceImpl extends ServiceImpl i @Autowired private DealingsRecordService dealingsRecordService; + @Autowired + private SaleDetailService saleDetailService; + + @Autowired + private ReturnSaleService returnSaleService; + @Override public Page debt(CustomerPageQuery customerPageQuery) { final Page page = new Page<>(customerPageQuery.getPageNum(), customerPageQuery.getPageSize()); @@ -219,4 +225,16 @@ public class CustomerServiceImpl extends ServiceImpl i public List findByUserPhoneAndShopId(String userPhone, String shopId) { return customerMapper.findByUserPhoneAndShopId(userPhone,shopId); } + + @Override + public Map getCustomerBuyHistory(String productId, String attributeList, String customerId) { + Map result = new HashMap<>(); + // 鑾峰彇瀹㈡埛璐拱璇ュ晢鍝佽鏍肩殑鎬讳欢鏁 + Integer buyCount = saleDetailService.getCustomerBuyHistory(productId, attributeList, customerId); + result.put("buyCount",buyCount); + // 鑾峰彇瀹㈡埛璐拱璇ュ晢鍝侀璐ф讳欢鏁 + Integer returnCount = returnSaleService.getCustomerReturnHistory(productId, attributeList, customerId); + result.put("returnCount",returnCount); + return result; + } } 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 7f672f17..96813ec1 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 @@ -273,4 +273,18 @@ public class ReturnSaleServiceImpl extends ServiceImpl + @@ -85,7 +86,7 @@ id, create_by, create_time, del_flag, update_by, update_time, name, sex, phone, address, - province, city, area, shop_id, user_id, category_id, category_name + province, city, area, shop_id, user_id, category_id, category_name, order_by_field @@ -298,6 +305,9 @@ category_name = #{record.categoryName,jdbcType=VARCHAR}, + + order_by_field = #{record.orderByField,jdbcType=INTEGER}, + @@ -321,7 +331,8 @@ shop_id = #{record.shopId,jdbcType=VARCHAR}, user_id = #{record.userId,jdbcType=VARCHAR}, category_id = #{record.categoryId,jdbcType=VARCHAR}, - category_name = #{record.categoryName,jdbcType=VARCHAR} + category_name = #{record.categoryName,jdbcType=VARCHAR}, + order_by_field = #{record.orderByField,jdbcType=INTEGER} @@ -377,6 +388,9 @@ category_name = #{categoryName,jdbcType=VARCHAR}, + + order_by_field = #{orderByField,jdbcType=INTEGER}, + where id = #{id,jdbcType=VARCHAR} @@ -397,7 +411,8 @@ shop_id = #{shopId,jdbcType=VARCHAR}, user_id = #{userId,jdbcType=VARCHAR}, category_id = #{categoryId,jdbcType=VARCHAR}, - category_name = #{categoryName,jdbcType=VARCHAR} + category_name = #{categoryName,jdbcType=VARCHAR}, + order_by_field = #{orderByField,jdbcType=INTEGER} where id = #{id,jdbcType=VARCHAR} @@ -418,7 +433,7 @@ + + \ No newline at end of file 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 937d4542..fc49c9b8 100644 --- a/hiver-modules/hiver-mall/src/main/resources/mapper/ReturnDetailMapper.xml +++ b/hiver-modules/hiver-mall/src/main/resources/mapper/ReturnDetailMapper.xml @@ -554,10 +554,11 @@ + SELECT + sum( dd.product_count ) + FROM + t_return_detail dd + LEFT JOIN t_sale ss ON dd.sale_id = ss.id + WHERE + dd.product_id = #{productId} + AND dd.attribute_list = #{attributeList} + 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/SaleDetailMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/SaleDetailMapper.xml index d6b59950..e91a1cf9 100644 --- a/hiver-modules/hiver-mall/src/main/resources/mapper/SaleDetailMapper.xml +++ b/hiver-modules/hiver-mall/src/main/resources/mapper/SaleDetailMapper.xml @@ -585,4 +585,17 @@ ) + + \ 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 5c471f0d..cff27467 100644 --- a/hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml +++ b/hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml @@ -1369,20 +1369,29 @@ GROUP BY \ No newline at end of file diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/ShopMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/ShopMapper.xml index 7e6f0a66..a897b7ff 100644 --- a/hiver-modules/hiver-mall/src/main/resources/mapper/ShopMapper.xml +++ b/hiver-modules/hiver-mall/src/main/resources/mapper/ShopMapper.xml @@ -11,27 +11,37 @@ + + + + + + - - + + + + + - id, create_by, create_time, del_flag, update_by, update_time, shop_name, shop_owner_id, - shop_manger_id, shop_area, shop_address, year_fee, charge_time, start_time, end_time, - status, business_district_level, contact_phone, shop_icon, defaulted, region, shop_area_title + id, create_by, create_time, del_flag, update_by, update_time, shop_name, shop_owner_id, shop_manger_id, region, +region_id, shop_area, shop_area_title, shop_type, shop_type_title, shop_address, year_fee, charge_time, start_time, +end_time, status, remark, business_district_level, contact_phone, shop_icon, defaulted, ali_account, ali_name, +rebate_amount, attr_id, printing_method remark @@ -49,22 +59,14 @@ where id = #{id,jdbcType=VARCHAR} - insert into t_shop (id, create_by, create_time, - del_flag, update_by, update_time, - shop_name, shop_owner_id, shop_manger_id, - shop_area, shop_address, year_fee, - charge_time, start_time, end_time, - status, business_district_level, contact_phone, - shop_icon, defaulted, region, - shop_area_title, remark) - values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, - #{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, - #{shopName,jdbcType=VARCHAR}, #{shopOwnerId,jdbcType=VARCHAR}, #{shopMangerId,jdbcType=VARCHAR}, - #{shopArea,jdbcType=VARCHAR}, #{shopAddress,jdbcType=VARCHAR}, #{yearFee,jdbcType=VARCHAR}, - #{chargeTime,jdbcType=VARCHAR}, #{startTime,jdbcType=VARCHAR}, #{endTime,jdbcType=VARCHAR}, - #{status,jdbcType=INTEGER}, #{businessDistrictLevel,jdbcType=VARCHAR}, #{contactPhone,jdbcType=VARCHAR}, - #{shopIcon,jdbcType=VARCHAR}, #{defaulted,jdbcType=INTEGER}, #{region,jdbcType=VARCHAR}, - #{shopAreaTitle,jdbcType=VARCHAR}, #{remark,jdbcType=LONGVARCHAR}) + insert into t_shop (id, create_by, create_time, del_flag, update_by, update_time, shop_name, shop_owner_id, shop_manger_id, region, + region_id, shop_area, shop_area_title, shop_type, shop_type_title, shop_address, year_fee, charge_time, start_time, + end_time, status, remark, business_district_level, contact_phone, shop_icon, defaulted, ali_account, ali_name, + rebate_amount, attr_id, printing_method) + values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{shopName,jdbcType=VARCHAR}, #{shopOwnerId,jdbcType=VARCHAR}, #{shopMangerId,jdbcType=VARCHAR}, #{region,jdbcType=VARCHAR}, + #{regionId,jdbcType=VARCHAR}, #{shopArea,jdbcType=VARCHAR}, #{shopAreaTitle,jdbcType=VARCHAR}, #{shopType,jdbcType=VARCHAR}, #{shopTypeTitle,jdbcType=VARCHAR}, #{shopAddress,jdbcType=VARCHAR}, #{yearFee,jdbcType=VARCHAR}, #{chargeTime,jdbcType=VARCHAR}, #{startTime,jdbcType=VARCHAR}, + #{endTime,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{remark,jdbcType=LONGVARCHAR}, #{businessDistrictLevel,jdbcType=VARCHAR}, #{contactPhone,jdbcType=VARCHAR}, #{shopIcon,jdbcType=VARCHAR}, #{defaulted,jdbcType=INTEGER}, #{aliAccount,jdbcType=VARCHAR}, #{aliName,jdbcType=VARCHAR}, + #{rebateAmount,jdbcType=VARCHAR}, #{attrId,jdbcType=VARCHAR}, #{printingMethod,jdbcType=VARCHAR}) insert into t_shop @@ -331,7 +333,16 @@ shop_icon = #{shopIcon,jdbcType=VARCHAR}, defaulted = #{defaulted,jdbcType=INTEGER}, region = #{region,jdbcType=VARCHAR}, - shop_area_title = #{shopAreaTitle,jdbcType=VARCHAR} + shop_area_title = #{shopAreaTitle,jdbcType=VARCHAR}, + remark = #{remark,jdbcType=LONGVARCHAR}, + region_id = #{regionId,jdbcType=VARCHAR}, + shop_type = #{shopType,jdbcType=VARCHAR}, + shop_type_title = #{shopTypeTitle,jdbcType=VARCHAR}, + ali_account = #{aliAccount,jdbcType=VARCHAR}, + ali_name = #{aliName,jdbcType=VARCHAR}, + rebate_amount = #{rebateAmount,jdbcType=DECIMAL}, + attr_id = #{attrId,jdbcType=VARCHAR}, + printing_method = #{printingMethod,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}