ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopPointCopy.java
@@ -25,7 +25,7 @@ */ @Data @EqualsAndHashCode(callSuper = false) @TableName("t_shop_point") @TableName("t_shop_point_copy") @ApiModel(value="ShopPoint对象", description="") public class ShopPointCopy implements Serializable { ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/WeChatUtil.java
@@ -222,8 +222,6 @@ HttpResponse execute = post.execute(); byte[] bytes = execute.bodyBytes(); String body1 = execute.body(); System.err.println(body1); System.err.println(Base64.encodeBase64String(bytes)); return new ByteArrayInputStream(bytes); }catch (Exception e){ e.printStackTrace(); ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
@@ -34,6 +34,7 @@ import com.ruoyi.system.api.feignClient.SysUserClient; import com.ruoyi.system.api.model.LoginUser; import io.swagger.annotations.*; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -545,11 +546,55 @@ @GetMapping("/exportExpress") public void exportExpress(HttpServletResponse response, OrderPageList orderPage) { //搜索条件,用户姓名 if (StringUtils.isNotEmpty(orderPage.getUserName())) { List<AppUser> data = appUserClient.getAppUserByNameNoFilter(orderPage.getUserName()).getData(); List<Long> collect = data.stream().map(AppUser::getId).collect(Collectors.toList()); if (CollectionUtils.isEmpty(collect)) { return; } if (null != orderPage.getAppUserIds()) { List<Long> appUserIds = orderPage.getAppUserIds(); appUserIds.addAll(collect); orderPage.setAppUserIds(appUserIds); } else { orderPage.setAppUserIds(collect); } } //搜索条件,用户电话 if (StringUtils.isNotEmpty(orderPage.getPhone())) { List<AppUser> data = appUserClient.getAppUserByPhoneNoFilter(orderPage.getPhone()).getData(); List<Long> collect = data.stream().map(AppUser::getId).collect(Collectors.toList()); if (CollectionUtils.isEmpty(collect)) { return; } if (null != orderPage.getAppUserIds()) { List<Long> appUserIds = orderPage.getAppUserIds(); if (!containsAny(appUserIds, collect)) { return; } appUserIds.addAll(collect); orderPage.setAppUserIds(appUserIds); } else { orderPage.setAppUserIds(collect); } } if (null != orderPage.getAppUserIds()) { orderPage.setAppUserIds(orderPage.getAppUserIds().stream().distinct().collect(Collectors.toList())); } // UserAddress userAddress = JSON.parseObject(order.getAddressJson(), UserAddress.class); // orderInfo.setRecipient(userAddress.getRecieveName() + "-" + userAddress.getRecievePhone()); // userAddress.setRecieveAddress(userAddress.getProvince() + userAddress.getCity() + userAddress.getDistrict() + userAddress.getRecieveAddress()); // orderInfo.setAddress(userAddress.getRecieveAddress()); List<OrderExport> orderExportList = orderMapper.getOrderExportList(orderPage); orderExportList.forEach(orderExport -> { Long appUserId = orderExport.getAppUserId(); AppUser appUserById = appUserClient.getAppUserById(appUserId); if (null != appUserById){ if (null != appUserById) { orderExport.setUserName(appUserById.getName()); orderExport.setPhone(appUserById.getPhone()); } @@ -567,6 +612,16 @@ orderExport.setExpressNum(jsonObject.getString("num")); orderExport.setExpressName(ExpressCompanyMap.getCompanyNameByCode(jsonObject.getString("com"))); } String addressJson = orderExport.getAddressJson(); if (StringUtils.isNotEmpty(addressJson)) { UserAddress userAddress = JSON.parseObject(addressJson, UserAddress.class); orderExport.setAddress( userAddress.getProvince() + userAddress.getCity() + userAddress.getDistrict() + userAddress.getRecieveAddress() ); } }); @@ -577,6 +632,29 @@ /** * 判断 list1 是否包含 list2 中的至少一个元素 * * @param list1 第一个列表 * @param list2 第二个列表 * @return 如果 list1 包含 list2 中的至少一个元素,返回 true;否则返回 false */ private boolean containsAny(List<Long> list1, List<Long> list2) { // 将 list1 转换为 HashSet 以提高查询效率 Set<Long> set1 = new HashSet<>(list1); // 遍历 list2,检查是否有元素存在于 set1 中 for (Long element : list2) { if (set1.contains(element)) { return true; } } // 如果没有找到共同元素,返回 false return false; } /** * 获取用户订单数量 * * @param appUserId ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java
@@ -64,7 +64,7 @@ List<Order> list = orderService.list(new LambdaQueryWrapper<Order>().eq(Order::getIsCommission, 2).isNotNull(Order::getAfterSaleTime) .eq(Order::getDelFlag, 0).ne(Order::getPayMethod, 3).last(" and after_sale_time <= now()")); List<Long> collect = list.stream().map(Order::getId).collect(Collectors.toList()); if(collect.size() == 0){ if(collect.isEmpty()){ return; } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -499,7 +499,8 @@ public R refundPayMoney(Order order) { //开始退款 Integer payMethod = order.getPayMethod(); BigDecimal paymentAmount = order.getPaymentAmount(); BigDecimal expressAmount = order.getExpressAmount() == null ? BigDecimal.ZERO : order.getExpressAmount(); BigDecimal paymentAmount = order.getPaymentAmount().add(expressAmount); AppUser appUser = appUserClient.getAppUserById(order.getAppUserId()); if (1 == payMethod) { //微信退款 @@ -594,7 +595,6 @@ if (3 == payMethod) { //开始运费退款,积分支付,运费是单独进行支付的,所以需要单独退款 if (null != order.getExpressAmount() && BigDecimal.ZERO.compareTo(order.getExpressAmount()) < 0) { BigDecimal expressAmount = order.getExpressAmount(); if (1 == order.getExpressPayMethod()) { //微信退款 RefundResult refund = PaymentUtil.refund(order.getOrderNumber(), "R" + order.getOrderNumber(), expressAmount.doubleValue(), "/order/order/refundExpressPayMoneyCallback"); @@ -663,6 +663,7 @@ order.setRefundTime(LocalDateTime.now()); shopPointClient.deleteShopPointCopy(order.getId(), Arrays.asList(1,2,3)); shopBalanceStatementClient.deleteShopBalanceStatementCopy(order.getId(), Arrays.asList(1,2,3)); appUserGiveawayTemporaryClient.delAppUserGiveawayTemporary(order.getId()); shopGiveawayTemporaryClient.delShopGiveawayTemporary(order.getId()); return R.ok(); @@ -811,6 +812,7 @@ Long days = jsonObject.getLong("days"); order.setAfterSaleTime(LocalDateTime.now().plusDays(days)); this.updateById(order); commissionService.calculationCommissionShop(order.getId()); return R.ok(); } @@ -985,18 +987,33 @@ for (int i = 1; i <= lastRowNum; i++) { Row row = sheet.getRow(i); // 订单编号 if (row.getCell(0) == null){ throw new ServiceException("第" + i + "行订单编号为空", 500); } row.getCell(0).setCellType(CellType.STRING); String orderNum = row.getCell(0).getStringCellValue(); // 快递单号 if (row.getCell(1) == null){ throw new ServiceException("第" + i + "行快递单号为空", 500); } row.getCell(1).setCellType(CellType.STRING); String expressNum = row.getCell(1).getStringCellValue(); // 快递公司名称 if (row.getCell(2) == null){ throw new ServiceException("第" + i + "行快递公司为空", 500); } row.getCell(2).setCellType(CellType.STRING); String expressName = row.getCell(2).getStringCellValue(); // 省区划代码 if (row.getCell(3) == null){ throw new ServiceException("第" + i + "行省区划代码为空", 500); } row.getCell(3).setCellType(CellType.STRING); String provinceCode = row.getCell(3).getStringCellValue(); // 市区划代码 if (row.getCell(4) == null){ throw new ServiceException("第" + i + "行市区划代码为空", 500); } row.getCell(4).setCellType(CellType.STRING); String cityCode = row.getCell(4).getStringCellValue(); Order order = this.getOne(new LambdaQueryWrapper<Order>() ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
@@ -1204,33 +1204,36 @@ BigDecimal balance = appUser.getBalance(); //红包金额满足支付 BigDecimal paymentMoney1 = paymentMoney; if(paymentMoney1.compareTo(totalRedPacketAmount) <= 0){ totalRedPacketAmount = totalRedPacketAmount.subtract(paymentMoney1); balance = balance.subtract(paymentMoney1); appUser.setTotalRedPacketAmount(totalRedPacketAmount); appUser.setBalance(balance); redPacketAmount = paymentMoney1; }else{ paymentMoney1 = paymentMoney1.subtract(totalRedPacketAmount); redPacketAmount = totalRedPacketAmount; totalRedPacketAmount = BigDecimal.ZERO; if(paymentMoney1.compareTo(totalDistributionAmount) <= 0){ totalDistributionAmount = totalDistributionAmount.subtract(paymentMoney1); balance = balance.subtract(paymentMoney1); appUser.setTotalRedPacketAmount(totalRedPacketAmount); // appUser.setTotalDistributionAmount(totalDistributionAmount); appUser.setBalance(balance); distributionAmount = paymentMoney1; }else{ paymentMoney1 = paymentMoney1.subtract(totalDistributionAmount); totalDistributionAmount = BigDecimal.ZERO; balance = balance.subtract(paymentMoney1); appUser.setTotalRedPacketAmount(totalRedPacketAmount); // appUser.setTotalDistributionAmount(totalDistributionAmount); appUser.setBalance(balance); distributionAmount = totalDistributionAmount; } } balance = balance.subtract(paymentMoney1); appUser.setBalance(balance); // if(paymentMoney1.compareTo(totalRedPacketAmount) <= 0){ // totalRedPacketAmount = totalRedPacketAmount.subtract(paymentMoney1); // balance = balance.subtract(paymentMoney1); // appUser.setTotalRedPacketAmount(totalRedPacketAmount); // appUser.setBalance(balance); // redPacketAmount = paymentMoney1; // }else{ // paymentMoney1 = paymentMoney1.subtract(totalRedPacketAmount); // redPacketAmount = totalRedPacketAmount; // totalRedPacketAmount = BigDecimal.ZERO; // if(paymentMoney1.compareTo(totalDistributionAmount) <= 0){ //// totalDistributionAmount = totalDistributionAmount.subtract(paymentMoney1); // balance = balance.subtract(paymentMoney1); // appUser.setTotalRedPacketAmount(totalRedPacketAmount); //// appUser.setTotalDistributionAmount(totalDistributionAmount); // appUser.setBalance(balance); // distributionAmount = paymentMoney1; // }else{ // paymentMoney1 = paymentMoney1.subtract(totalDistributionAmount); // totalDistributionAmount = BigDecimal.ZERO; // balance = balance.subtract(paymentMoney1); // appUser.setTotalRedPacketAmount(totalRedPacketAmount); //// appUser.setTotalDistributionAmount(totalDistributionAmount); // appUser.setBalance(balance); // distributionAmount = totalDistributionAmount; // } // } //构建积分流水记录 if(earnPoint > 0){ PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData(); ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderExport.java
@@ -27,6 +27,12 @@ private String orderType; /** * 收货地址 */ @Excel(name = "收货地址") private String address; /** * 下单时间 */ @Excel(name = "下单时间") @@ -115,4 +121,6 @@ */ @Excel(name = "市区划代码") private String cityCode; private String addressJson; } ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
@@ -160,6 +160,7 @@ o.order_status, o.order_number, o.order_type, o.address_Json, o.create_time, o.app_user_id, og.goods_id, ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java
@@ -31,6 +31,7 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.apache.commons.lang3.tuple.Pair; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -272,6 +273,7 @@ */ @GetMapping("getShopCommission") @ApiOperation(value = "获取门店佣金", notes = "获取门店佣金", tags = {"小程序-个人中心-门店管理-门店钱包"}) @Transactional public R<ShopCommission> getShopCommission(@RequestParam("shopId") Integer shopId) { // 合并查询逻辑 List<ShopBalanceStatementCopy> copies = shopBalanceStatementCopyMapper.selectList( ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java
@@ -131,11 +131,26 @@ LoginUser loginUser = tokenService.getLoginUser(); SysUser sysUser = sysUserClient.getSysUser(loginUser.getUserid()).getData(); Shop byId = shopService.getById(sysUser.getObjectId()); List<ShopWithdraw> list = shopWithdrawService.lambdaQuery().eq(ShopWithdraw::getShopId, sysUser.getObjectId()) .eq(ShopWithdraw::getAuditStatus, 0).list(); List<ShopWithdraw> list = shopWithdrawService.lambdaQuery() .eq(ShopWithdraw::getShopId, sysUser.getObjectId()) .list(); if (!list.isEmpty()){ BigDecimal bigDecimal = list.stream().map(ShopWithdraw::getMoney).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); // 待审核列表 List<ShopWithdraw> toBeReviewList = list.stream() .filter(s -> s.getAuditStatus() == 0) .collect(Collectors.toList()); // 审核通过列表 List<ShopWithdraw> passedReviewList = list.stream() .filter(s -> s.getAuditStatus() == 1) .collect(Collectors.toList()); BigDecimal bigDecimal = toBeReviewList.stream().map(ShopWithdraw::getMoney).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); byId.setWithdrawAuditMoney(bigDecimal); BigDecimal bigDecimal1 = passedReviewList.stream().map(ShopWithdraw::getMoney).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); byId.setWithdrawMoney(bigDecimal1); }else { byId.setWithdrawAuditMoney(BigDecimal.ZERO); }