a.json
New file @@ -0,0 +1,26 @@ { "appointStore": 2, "cashPayment": 1, "commodityAuthority": "-1", "delFlag": 0, "detail": "<p>124</p>", "detailPicture": "http://qijishenghuiyuan.obs.cn-southwest-2.myhuaweicloud.com/admin/ce9f63be73a64fd29449fcd1aae6ed8c.png", "distributionMode": "1", "goodsCategoryId": 21, "homePagePicture": "http://qijishenghuiyuan.obs.cn-southwest-2.myhuaweicloud.com/admin/9655a4f62a784daa8bd46b8881020183.png", "id": 71, "idStr": "71", "introduction": "1111", "name": "面部玫瑰精油", "operatingCost": 20.00, "originalPrice": 2.00, "pageCurr": 1, "pageSize": 10, "pointPayment": 0, "purchaseLimit": -1, "saleNum": 0, "sellingPrice": 15.00, "shopCost": 20.00, "status": 2, "type": 2 } ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java
@@ -133,6 +133,7 @@ public R clearBindShop(Integer shopId) { return R.fail("清空绑定门店的用户门店数据失败:" + cause.getMessage()); } }; } } ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java
@@ -134,4 +134,5 @@ */ @PostMapping("/app-user/clearBindShop") R clearBindShop(@RequestParam("shopId") Integer shopId); } ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java
@@ -97,6 +97,10 @@ @ApiModelProperty(value = "推广人姓名") @TableField(exist = false) private String inviteUserName; @ApiModelProperty(value = "指导老师") @TableField(exist = false) private String teacher; @ApiModelProperty(value = "绑定门店id") @TableField("shop_id") private Integer shopId; ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/OrderClientFallbackFactory.java
@@ -49,6 +49,7 @@ return R.fail("编辑订单详情失败:" + cause.getMessage()); } @Override public R<Long> getOrderCountByAppUserId(Long appUserId) { return R.fail("获取用户订单数量失败:" + cause.getMessage()); ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderGoodsFallbackFactory.java
@@ -66,6 +66,11 @@ public R<List<Order>> byShopIdAndUserId(Long userId,Integer shopId) { return R.fail("通过门店和用户id查询订单失败"); } @Override public R<List<OrderGood>> getUnDistributedOrder(Long appUserId) { return R.fail("获取未分配订单失败"); } }; } ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/OrderClient.java
@@ -7,6 +7,7 @@ import com.ruoyi.order.model.Order; import com.ruoyi.order.vo.OrderSaleNum; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderGoodsClient.java
@@ -63,4 +63,9 @@ R<Price> getGoodsPrice(@RequestParam("appUserId") Long appUserId, @RequestParam("goodsId") Integer goodsId, @RequestParam("shopId") Integer shopId); @PostMapping("/order/getLastOrder") R<Order> getLastOrder(@RequestParam("appUserId") Long appUserId); @GetMapping("/order-good/getUnDistributedOrder") R<List<OrderGood>> getUnDistributedOrder(Long appUserId); } ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/FreezeRecord.java
New file @@ -0,0 +1,17 @@ package com.ruoyi.order.model; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.math.BigDecimal; @Data @TableName("freeze_record") public class FreezeRecord { private Long id; private Long orderId; private Long userId; private Integer storeId; private BigDecimal freezeMoney; private Integer freezePoint; } ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/OrderGood.java
@@ -128,5 +128,4 @@ @TableField("integral") private Integer integral; } ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsVip.java
@@ -88,19 +88,19 @@ @TableField("technician_points") private Integer technicianPoints; @ApiModelProperty(value = "绑定门店可获得分佣金额") @ApiModelProperty(value = "服务商可获得分佣金额") @TableField("bound_shop_charges") private BigDecimal boundShopCharges; @ApiModelProperty(value = "绑定门店可获得返佣积分") @ApiModelProperty(value = "服务商可获得返佣积分") @TableField("bound_shop_points") private Integer boundShopPoints; @ApiModelProperty(value = "绑定门店上级门店可获得分佣金额") @ApiModelProperty(value = "高级服务商上级门店可获得分佣金额") @TableField("bound_shop_superiors_charges") private BigDecimal boundShopSuperiorsCharges; @ApiModelProperty(value = "绑定门店上级门店可获得返佣积分") @ApiModelProperty(value = "高级服务商上级门店可获得返佣积分") @TableField("bound_shop_superiors_points") private Integer boundShopSuperiorsPoints; ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Shop.java
@@ -152,6 +152,7 @@ @TableField("balance") private BigDecimal balance; @ApiModelProperty(value = "门店订单总数") @TableField("order_number") private Integer orderNumber; ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java
@@ -6,6 +6,7 @@ import com.ruoyi.other.api.feignClient.ShopClient; import lombok.extern.slf4j.Slf4j; import org.springframework.cloud.openfeign.FallbackFactory; import org.springframework.web.bind.annotation.GetMapping; import java.math.BigDecimal; import java.util.List; @@ -57,10 +58,21 @@ return R.fail("获取所有门店失败:" + cause.getMessage()); } @GetMapping("/shop/getShopStatistics") @Override public R<Map<String, BigDecimal>> getShopStatistics(Integer shopId) { return R.fail(); } @Override public R<Shop> getServiceProvider(Long appUserId) { return R.fail("获取服务商失败"); } @Override public R<Shop> getSuperiorServiceProvider(Long appUserId) { return R.fail("获取高级服务商失败"); } }; } } ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java
@@ -71,4 +71,18 @@ @GetMapping("/shop/getShopStatistics") public R<Map<String, BigDecimal>> getShopStatistics(@RequestParam("shopId") Integer shopId); /** * 获取指定用户的服务商 */ @GetMapping("/shop/getServiceProvider") public R<Shop> getServiceProvider(@RequestParam("appUserId") Long appUserId); /** * 获取指定用户的高级服务商 */ @GetMapping("/shop/getSuperiorServiceProvider") public R<Shop> getSuperiorServiceProvider(@RequestParam("appUserId") Long appUserId); } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -276,14 +276,30 @@ Long userId = tokenService.getLoginUserApplet().getUserid(); //获取绑定门店 AppUser user = appUserService.getById(userId); if (user.getShopId() != null) { R<Shop> storeById = storeClient.getStoreById(user.getShopId()); if (storeById.getData() != null) { user.setShopName(storeById.getData().getName()); user.setShopCover(storeById.getData().getHomePicture()); user.setShopAddress(storeById.getData().getAddress()); //当前用户的推荐人信息(指导老师) List<AppUser> allSuperiors = getAllSuperiors(userId); //当前绑定门店的店铺信息 for (AppUser allSuperior : allSuperiors) { List<Shop> shopList = shopClient.getShopByUserId(allSuperior.getId()).getData(); if (!CollectionUtils.isEmpty(shopList)){ user.setShopName(shopList.get(0).getName()); user.setShopCover(shopList.get(0).getHomePicture()); user.setShopAddress(shopList.get(0).getAddress()); break; } } //指导老师 allSuperiors.stream() .filter(superiors -> superiors.getVipId() != null && superiors.getVipId() > 3) .findFirst() .ifPresent(superiors -> { user.setTeacher(superiors.getName()); }); //获取绑定上级 if (user.getInviteUserId() != null) { @@ -456,19 +472,29 @@ appUserService.updateById(user); } //当前用户的推荐人信息 if (user.getInviteUserId() != null) { AppUser inviteUser = appUserService.getById(user.getInviteUserId()); user.setInviteUserName(inviteUser.getName()); } //当前绑定门店的店铺信息 if (user.getShopId() != null) { R<Shop> storeById = shopClient.getShopById(user.getShopId()); if (storeById.getData() != null) { Shop shop = storeById.getData(); user.setShopName(shop.getName()); //指导老师 List<AppUser> allSuperiors = getAllSuperiors(userId); allSuperiors.stream() .filter(superiors -> superiors.getVipId() != null && superiors.getVipId() > 3) .findFirst() .ifPresent(superiors -> { user.setTeacher(superiors.getName()); }); //当前绑定门店的店铺信息(服务商) for (AppUser allSuperior : allSuperiors) { List<Shop> shopList = shopClient.getShopByUserId(allSuperior.getId()).getData(); if (!CollectionUtils.isEmpty(shopList)){ user.setShopName(shopList.get(0).getName()); break; } } // if (user.getShopId() != null) { // R<Shop> storeById = shopClient.getShopById(user.getShopId()); // if (storeById.getData() != null) { // Shop shop = storeById.getData(); // user.setShopName(shop.getName()); // } // } ArrayList<Long> userIds = new ArrayList<>(); userIds.add(userId); // 获取当前用户的所有下级 @@ -517,6 +543,25 @@ } return R.ok(user); } public List<AppUser> getAllSuperiors(Long userId) { List<AppUser> allSuperiors = new ArrayList<>(); // 获取当前用户的直接上级 AppUser currentUser = appUserService.getById(userId); if (currentUser != null && currentUser.getInviteUserId() != null) { AppUser superior = appUserService.getById(currentUser.getInviteUserId()); if (superior != null) { allSuperiors.add(superior); // 添加直接上级 allSuperiors.addAll(getAllSuperiors(superior.getId())); // 递归添加上级的上级 } } return allSuperiors; } // 递归获取指定用户的所有下级 public List<AppUser> getAllSubordinates(Long userId) { @@ -1280,5 +1325,6 @@ .set(AppUser::getUserType,1)); return R.ok(); } } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java
@@ -23,6 +23,8 @@ import com.ruoyi.common.core.utils.PhoneNumberValidator; import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; import com.ruoyi.order.model.OrderGood; import com.ruoyi.other.api.domain.PointSetting; import com.ruoyi.other.api.domain.VipSetting; import com.ruoyi.other.api.enums.PointChangeType; @@ -61,6 +63,8 @@ private PointSettingService pointSettingService; @Resource private UserPointService userPointService; @Resource private RemoteOrderGoodsClient remoteOrderGoodsClient; @@ -72,7 +76,15 @@ UserPointVO userPointVO = new UserPointVO(); // todo bug说取剩余积分 userPointVO.setTotalPoint(appUser.getLavePoint()); R<List<OrderGood>> unDistributedOrder = remoteOrderGoodsClient.getUnDistributedOrder(userId); List<OrderGood> unDistributedOrderList = unDistributedOrder.getData(); Integer totalPoint = unDistributedOrderList.stream() .mapToInt(OrderGood::getSuperiorRebatePoints) .sum(); userPointVO.setTotalPoint(appUser.getLavePoint()+totalPoint); userPointVO.setConsumePoint(appUser.getAvailablePoint()); userPointVO.setShopPoint(appUser.getShopPoint()); userPointVO.setSharePoint(appUser.getSharePoint()); ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java
@@ -1,6 +1,10 @@ package com.ruoyi.account.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.order.feignClient.OrderClient; import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; import com.ruoyi.order.model.Order; import com.ruoyi.order.model.OrderGood; import com.ruoyi.other.api.enums.WithdrawalAuditStatus; import com.ruoyi.account.api.model.AppUser; import com.ruoyi.account.api.model.WithdrawalRequests; @@ -25,6 +29,8 @@ private RemoteVipSettingClient remoteVipSettingClient; @Resource private WithdrawalRequestsService withdrawalRequestsService; @Resource private RemoteOrderGoodsClient remoteOrderGoodsClient; @Override public WalletVO getWalletByUserId(Long userId) { @@ -45,6 +51,15 @@ .eq(WithdrawalRequests::getAuditStatus, WithdrawalAuditStatus.WAIT_AUDIT.getCode())); BigDecimal reduce = waitAuditList.stream().map(WithdrawalRequests::getWithdrawalAmount).reduce(BigDecimal.ZERO, BigDecimal::add); WalletVO walletVO = new WalletVO(); R<List<OrderGood>> unDistributedOrder = remoteOrderGoodsClient.getUnDistributedOrder(userId); List<OrderGood> unDistributedOrderList = unDistributedOrder.getData(); BigDecimal commissionAmount = unDistributedOrderList.stream() .map(OrderGood::getSuperiorSubcommission) .reduce(BigDecimal.ZERO, BigDecimal::add); walletVO.setCommissionAmount(appUser.getTotalDistributionAmount().add(commissionAmount)); walletVO.setWithdrawalAmount(appUser.getWithdrawableAmount()); walletVO.setWithdrawnAmount(appUser.getWithdrawnAmount().subtract(reduce)); walletVO.setVipWithdrawalMinAmount(data.getVipWithdrawalMinAmount()); ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/WalletVO.java
@@ -13,6 +13,9 @@ @ApiModelProperty(value = "账户余额") private BigDecimal balance; @ApiModelProperty(value = "分佣金额") private BigDecimal commissionAmount; @ApiModelProperty(value = "可提现金额") private BigDecimal withdrawalAmount; ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
@@ -5,7 +5,9 @@ import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.ruoyi.account.api.feignClient.AppUserClient; import com.ruoyi.account.api.feignClient.UserAddressClient; import com.ruoyi.account.api.model.AppUser; import com.ruoyi.account.api.model.UserAddress; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.StringUtils; @@ -25,27 +27,19 @@ import com.ruoyi.order.util.vo.MapTrackKD100Vo; import com.ruoyi.order.vo.*; import com.ruoyi.other.api.domain.BaseSetting; import com.ruoyi.other.api.domain.Goods; import com.ruoyi.other.api.feignClient.BaseSettingClient; import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.system.api.feignClient.SysUserClient; import com.ruoyi.system.api.model.LoginUser; import io.swagger.annotations.*; import org.springframework.core.io.InputStreamResource; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.validation.constraints.NotBlank; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.math.BigDecimal; import java.net.URL; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDateTime; @@ -81,6 +75,8 @@ private SysUserClient sysUserClient; @Resource private RefundPassService refundPassService; @Resource private AppUserClient appUserClient; /** @@ -252,10 +248,12 @@ .notIn(Order::getOrderStatus, 5, 6).list(); return R.ok(list); } @PostMapping("/byShopId") public R<List<Order>> byShopId(@RequestParam("shopId") Integer shopId){ return R.ok(orderService.lambdaQuery().isNotNull(Order::getEndTime).eq(Order::getShopId, shopId).list()); } @PostMapping("/byShopIdAndUserId") public R<List<Order>> byShopIdAndUserId(@RequestParam("appUserId") Long appUserId,@RequestParam("shopId") Integer shopId){ List<Order> list = orderService.lambdaQuery().isNotNull(Order::getEndTime) @@ -267,7 +265,6 @@ .notIn(Order::getOrderStatus, 5, 6).list(); return R.ok(list); } @PostMapping("/confirmDelivery") @@ -389,6 +386,7 @@ /** * 订单取消支付回退 * * @param refundCallbackResult * @param response * @return @@ -414,6 +412,7 @@ /** * 取消订单快递费回退 * * @param refundCallbackResult * @param response */ @@ -438,6 +437,7 @@ /** * 获取商品销售数量 * * @param goodsId * @return */ @@ -448,9 +448,9 @@ } /** * 获取门店销售订单数量 * * @param shopId 门店id * @param type 1:服务订单,2:单品订单 * @return @@ -470,6 +470,7 @@ /** * 获取所有在指定门店消费的用户id * * @param shopId * @return */ @@ -484,6 +485,7 @@ /** * 获取订单快递明细 * * @param id * @return */ @@ -502,6 +504,7 @@ /** * 根据id获取订单详情 * * @param id * @return */ @@ -514,6 +517,7 @@ /** * 修改订单 * * @param order * @return */ @@ -540,17 +544,40 @@ */ @GetMapping("/exportExpress") public void exportExpress(HttpServletResponse response,OrderPageList orderPage){ orderPage.setPageCurr(1); orderPage.setPageSize(Integer.MAX_VALUE); PageInfo<OrderPageListVo> orderPageList = orderService.getOrderPageList(orderPage); List<OrderPageListVo> list = orderPageList.getRecords(); ExcelUtil<OrderPageListVo> util = new ExcelUtil<OrderPageListVo>(OrderPageListVo.class); util.exportExcel(response, list, "订单数据"); List<OrderExport> orderExportList = orderMapper.getOrderExportList(orderPage); orderExportList.forEach(orderExport -> { Long appUserId = orderExport.getAppUserId(); AppUser appUserById = appUserClient.getAppUserById(appUserId); if (null != appUserById){ orderExport.setUserName(appUserById.getName()); orderExport.setPhone(appUserById.getPhone()); } String goodJson = orderExport.getGoodJson(); if (StringUtils.isNotEmpty(goodJson) && !"NULL".equals(goodJson)) { Goods goods = JSONObject.parseObject(goodJson, Goods.class); orderExport.setGoodsName(goods.getName()); orderExport.setCostPrice(goods.getShopCost().add(goods.getOperatingCost())); } String expressJson = orderExport.getExpressJson(); if (StringUtils.isNotEmpty(expressJson) && !expressJson.equals("NULL")) { JSONObject jsonObject = JSONObject.parseObject(expressJson); orderExport.setExpressNum(jsonObject.getString("num")); orderExport.setExpressName(jsonObject.getString("com")); } }); ExcelUtil<OrderExport> util = new ExcelUtil<OrderExport>(OrderExport.class); util.exportExcel(response, orderExportList, "订单数据"); } /** * 获取用户订单数量 * * @param appUserId * @return */ @@ -562,5 +589,6 @@ return R.ok(count); } } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderGoodController.java
@@ -4,12 +4,15 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.controller.BaseController; import com.ruoyi.order.model.Order; import com.ruoyi.order.model.OrderGood; import com.ruoyi.order.service.OrderGoodService; import com.ruoyi.order.service.OrderService; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; import java.util.stream.Collectors; /** * <p> @@ -24,6 +27,8 @@ public class OrderGoodController extends BaseController { @Resource private OrderGoodService orderGoodService; @Resource private OrderService orderService; /** * 查询指定商品订单 @@ -40,5 +45,22 @@ public R<List<OrderGood>> getOrderListByUserIdAndGoodsId(Long userId, Integer goodsId){ return R.ok(orderGoodService.getOrderListByUserIdAndGoodsId(userId, goodsId)); } /** * 获取指定用户未分销的订单 */ @PostMapping("/getUnDistributedOrder") public R<List<OrderGood>> getUnDistributedOrder(Long appUserId) { List<Order> list = orderService.list(new LambdaQueryWrapper<Order>() .eq(Order::getAppUserId, appUserId) .eq(Order::getIsCommission, 0) .eq(Order::getDelFlag, 0)); List<Long> orderIds = list.stream().map(Order::getId).collect(Collectors.toList()); List<OrderGood> orderGoods = orderGoodService.list(new LambdaQueryWrapper<OrderGood>() .in(OrderGood::getOrderId, orderIds)); return R.ok(orderGoods); } } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/FreezeRecordMapper.java
New file @@ -0,0 +1,7 @@ package com.ruoyi.order.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.order.model.FreezeRecord; public interface FreezeRecordMapper extends BaseMapper<FreezeRecord> { } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/OrderMapper.java
@@ -2,10 +2,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.order.vo.OrderPageList; import com.ruoyi.order.vo.OrderPageListVo; import com.ruoyi.order.vo.OrderStatistics; import com.ruoyi.order.vo.OrderVO; import com.ruoyi.order.vo.*; import com.ruoyi.order.model.Order; import org.apache.ibatis.annotations.Param; @@ -57,4 +54,6 @@ Integer getShopSaleNum(@Param("shopId") Integer shopId, @Param("type") Integer type); Integer getShopSaleNumByShopIds(@Param("shopIds") List<Integer> shopIds, @Param("type") Integer type); List<OrderExport> getOrderExportList( @Param("item") OrderPageList order); } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/FreezeRecordService.java
New file @@ -0,0 +1,7 @@ package com.ruoyi.order.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.order.model.FreezeRecord; public interface FreezeRecordService extends IService<FreezeRecord> { } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java
@@ -36,6 +36,13 @@ PageInfo<OrderPageListVo> getOrderPageList(OrderPageList orderPageList); /** * 获取导出订单列表数据 */ List<OrderExport> getOrderExportList(OrderPageList orderPageList); /** * 小程序取消订单 * @param orderId * @return ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java
@@ -385,8 +385,8 @@ } } //绑定门店分佣 Shop shop1 = shopClient.getShopById(appUser.getShopId()).getData(); //服务商分佣 Shop shop1 = shopClient.getServiceProvider(appUser.getId()).getData(); if(null != shop1){ AppUser bdShopAppUser = appUserClient.getAppUserById(shop1.getAppUserId()); if(null != bdShopAppUser){ @@ -468,10 +468,8 @@ } } //上级门店分佣 if(null != shop1){ Integer pid = shop1.getPid(); Shop shop2 = shopClient.getShopById(pid).getData(); //高级服务商 Shop shop2 = shopClient.getSuperiorServiceProvider(order.getAppUserId()).getData(); if(null != shop2){ AppUser sjShopAppUser = appUserClient.getAppUserById(shop2.getAppUserId()); if(null != sjShopAppUser){ @@ -549,7 +547,6 @@ shopPoint.setObjectId(order.getId()); shopPoint.setOrderNum(order.getOrderNumber()); shopPointClient.saveShopPoint(shopPoint); } } } } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/FreezeRecordServiceImpl.java
New file @@ -0,0 +1,11 @@ package com.ruoyi.order.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.order.mapper.FreezeRecordMapper; import com.ruoyi.order.model.FreezeRecord; import com.ruoyi.order.service.FreezeRecordService; import org.springframework.stereotype.Service; @Service public class FreezeRecordServiceImpl extends ServiceImpl<FreezeRecordMapper, FreezeRecord> implements FreezeRecordService { } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -1091,4 +1091,9 @@ public Integer getShopSaleNumByShopIds(List<Integer> shopIds, Integer type) { return this.baseMapper.getShopSaleNumByShopIds(shopIds, type); } @Override public List<OrderExport> getOrderExportList(OrderPageList orderPageList) { return Collections.emptyList(); } } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/TaskUtil.java
@@ -30,7 +30,7 @@ @Scheduled(fixedRate = 60000) public void taskMonth() { commissionService.calculationCommission(); commissionService.calculationCommission(); //2.18版本修改为下单后计算返佣金额 shoppingCartService.closeOrder(); orderService.taskExpress(); } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderExport.java
@@ -1,5 +1,112 @@ package com.ruoyi.order.vo; import com.ruoyi.common.core.annotation.Excel; import lombok.Data; import java.math.BigDecimal; @Data public class OrderExport { /** * 订单状态 */ @Excel(name = "订单状态") private String status; /** * 订单编号 */ @Excel(name = "订单编号") private String code; /** * 订单类型 */ @Excel(name = "订单类型") private String orderType; /** * 下单时间 */ @Excel(name = "下单时间") private String createTime; /** * 下单用户 */ @Excel(name = "下单用户") private String userName; private Long appUserId; /** * 联系方式 */ @Excel(name = "联系方式") private String phone; /** * 商品名称 */ @Excel(name = "商品名称") private String goodsName; /** * 商品售价 */ @Excel(name = "商品售价") private BigDecimal goodsPrice; /** * 成本价 */ @Excel(name = "成本价") private BigDecimal costPrice; /** * 支付金额 */ @Excel(name = "支付金额") private String orderMoney; /** * 快递单号 */ @Excel(name = "快递单号") private String expressNum; private String expressJson; private String goodJson; /** * 快递公司 */ @Excel(name = "快递公司") private String expressName; /** * 省 */ @Excel(name = "省") private String province; /** * 省区划代码 */ @Excel(name = "省区划代码") private String provinceCode; /** * 市 */ @Excel(name = "市") private String city; /** * 市区划代码 */ @Excel(name = "市区划代码") private String cityCode; } ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
@@ -156,4 +156,53 @@ and order_type = #{type} </if> </select> <select id="getOrderExportList" resultType="com.ruoyi.order.vo.OrderExport"> SELECT o.order_status, o.order_number, o.order_type, o.create_time, o.app_user_id, og.goods_id, og.selling_price, og.good_json, og.selling_price orderMoney, o.express_json, o.deliver_province province, o.deliver_province_code provinceCode, o.deliver_city city, o.deliver_city_code cityCode FROM t_order_good og LEFT JOIN t_order o ON og.order_id = o.id where o.del_flag = 0 and o.pay_status = 2 <if test="null != item.code and '' != item.code"> and o.order_number like CONCAT('%', #{item.code}, '%') </if> <if test="null != item.appUserIds and item.appUserIds.size() > 0"> and o.app_user_id in <foreach collection="item.appUserIds" separator="," item="tem" index="index" open="(" close=")"> #{tem} </foreach> </if> <if test="null != item.goodsType"> and o.order_type = #{item.goodsType} </if> <if test="null != item.paymentType"> and o.pay_method = #{item.paymentType} </if> <if test="null != item.status and 4 != item.status"> and o.order_status = #{item.status} </if> <if test="null != item.status and 4 == item.status"> and o.order_status in (4, 8) </if> <if test="null != item.shopId"> and o.shop_id = #{item.shopId} and distribution_mode != 2 </if> <if test="null != item.startTime and null != item.endTime"> and o.create_time between #{item.startTime} and #{item.endTime} </if> order by o.create_time desc </select> </mapper> ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -863,5 +863,70 @@ return R.ok(map); } /** * 获取指定用户的服务商 * @param userId * @return */ @GetMapping("/getServiceProvider") public R<Shop> getServiceProvider(Long userId){ List<AppUser> allSuperiors = getAllSuperiors(userId); //当前绑定门店的店铺信息(服务商) Shop serviceProvider = null; for (AppUser allSuperior : allSuperiors) { List<Shop> shopList = shopService.lambdaQuery().eq(Shop::getAppUserId, allSuperior.getId()).eq(Shop::getDelFlag,0).list(); if (!CollectionUtils.isEmpty(shopList)){ serviceProvider = shopList.get(0); break; } } return R.ok(serviceProvider); } /** * 获取指定用户的高级服务商 * @return */ @GetMapping("/getSuperiorServiceProvider") public R<Shop> getSuperiorServiceProvider(Long userId){ List<AppUser> allSuperiors = getAllSuperiors(userId); Long techerId = null; for (AppUser allSuperior : allSuperiors) { List<Shop> shopList = shopService.lambdaQuery().eq(Shop::getAppUserId, allSuperior.getId()).eq(Shop::getDelFlag,0).list(); if (!CollectionUtils.isEmpty(shopList)){ techerId = allSuperior.getId(); break; } } if (techerId == null){ return R.fail("暂无高级服务商"); } List<AppUser> allSuperiors1 = getAllSuperiors(techerId); for (AppUser allSuperior : allSuperiors1) { List<Shop> shopList = shopService.lambdaQuery().eq(Shop::getAppUserId, allSuperior.getId()).eq(Shop::getDelFlag,0).list(); if (!CollectionUtils.isEmpty(shopList)){ return R.ok(shopList.get(0)); } } return R.fail("暂无高级服务商"); } public List<AppUser> getAllSuperiors(Long userId) { List<AppUser> allSuperiors = new ArrayList<>(); // 获取当前用户的直接上级 AppUser currentUser = appUserClient.getAppUserById(userId); if (currentUser != null && currentUser.getInviteUserId() != null) { AppUser superior = appUserClient.getAppUserById(currentUser.getInviteUserId()); if (superior != null) { allSuperiors.add(superior); // 添加直接上级 allSuperiors.addAll(getAllSuperiors(superior.getId())); // 递归添加上级的上级 } } return allSuperiors; } } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
@@ -424,6 +424,8 @@ goodsVipList.forEach(item -> { item.setId(null); item.setGoodsId(id); item.setSuperiorType("2"); item.setSuperiorPriceType("2"); }); goodsVipService.saveBatch(goodsVipList); }