From 4ea15c3e2a3f0434df79a1b49fe4e90f7337b025 Mon Sep 17 00:00:00 2001 From: luodangjia <luodangjia> Date: 星期四, 06 二月 2025 18:16:40 +0800 Subject: [PATCH] 修改物流信息导入模板 --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java | 4 ++ ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java | 4 + ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java | 9 ++++ ruoyi-service/ruoyi-other/src/main/resources/mapper/other/CouponInfoMapper.xml | 2 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Goods.java | 1 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderPageList.java | 13 +++++- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java | 47 ++++++++++++++++++++--- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java | 3 + ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml | 2 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml | 5 +- 10 files changed, 76 insertions(+), 14 deletions(-) diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Goods.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Goods.java index d27b161..c0dbf1e 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Goods.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Goods.java @@ -169,6 +169,7 @@ private Integer pageSize; + public String getIdStr() { return String.valueOf(id); } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java index 3810f15..e354037 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java @@ -1,6 +1,7 @@ package com.ruoyi.account.controller; +import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -744,7 +745,7 @@ @GetMapping("/detail") @ApiOperation(value = "用户列表-详情", tags = {"管理后台"}) - public R<AppUser> detail(Long id, Integer shopId, Integer pageNum, Integer pageSize) { + public R<AppUser> detail(Long id, Integer shopId) { Long userid = tokenService.getLoginUser().getUserid(); SysUser sysUser = sysUserClient.getSysUser(userid).getData(); AppUser byId = appUserService.getById(id); @@ -774,8 +775,8 @@ if (lastOrder.getData() != null) { byId.setLastOrderTime(lastOrder.getData().getCreateTime()); } - Page<AppUser> page = appUserService.page(Page.of(pageNum, pageSize), new LambdaQueryWrapper<AppUser>().eq(AppUser::getInviteUserId, id)); - byId.setBottomUsersPage(page); + List<AppUser> list = appUserService.lambdaQuery().eq(AppUser::getInviteUserId, id).list(); + byId.setBottomUsers(list); //消费总金额 if(null == shopId || 1 == sysUser.getRoleType()){ shopId = -1; @@ -793,6 +794,20 @@ } return R.ok(byId); } + + /** + * 获取指定用户的下级用户 + */ + @GetMapping("/bottom/list") + @ApiOperation(value = "用户列表-下级用户", tags = {"管理后台"}) + public R<Page<AppUser>> bottom(Integer pageNum, Integer pageSize, Long userId){ + Page<AppUser> page = appUserService.page(Page.of(pageNum, pageSize), new LambdaQueryWrapper<AppUser>() + .eq(AppUser::getInviteUserId, userId)); + return R.ok(page); + } + + + @@ -815,7 +830,6 @@ byId.setVipId(vipId); appUserService.updateById(byId); return R.ok(); - } @GetMapping("/bottom") @@ -829,7 +843,7 @@ @GetMapping("/orders") @ApiOperation(value = "用户列表-订单列表", tags = {"管理后台"}) - public R<List<Order>> orders(Long id) { + public R<JSONObject> orders(Long id,Integer pageNum, Integer pageSize) { Long userid = tokenService.getLoginUser().getUserid(); SysUser sysUser = sysUserClient.getSysUser(userid).getData(); Integer shopId = -1; @@ -837,8 +851,27 @@ shopId = sysUser.getObjectId(); } R<List<Order>> listR = remoteOrderGoodsClient.byUserId(id,shopId); - return R.ok(listR.getData()); - + List<Order> data = listR.getData(); + Integer total = data.size(); + // 手动分页 + if (data != null && data.size() > 0) { + if (pageNum == null || pageNum == 0) { + pageNum = 1; + } + if (pageSize == null || pageSize == 0) { + pageSize = 10; + } + data = data.stream() + .skip((pageNum - 1) * pageSize) + .limit(pageSize) + .collect(Collectors.toList()); + } + JSONObject jsonObject = new JSONObject(); + jsonObject.put("records", data); + jsonObject.put("total", total); + jsonObject.put("size", pageSize); + jsonObject.put("current", pageNum); + return R.ok(jsonObject); } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java index f1bd4ef..1f9a8f2 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java @@ -894,7 +894,7 @@ .eq(AppUser::getStatus, 1).in(AppUser::getId, replaceable)); for (AppUser appUser : list) { Long data = orderClient.getOrderCountByAppUserId(appUser.getId()).getData(); - if(data == 0){ + if(data == 0L){ appUser.setChangePromoter(1); this.updateById(appUser); } @@ -973,6 +973,8 @@ Set<Integer> shopIds = shopR.getData(); if (!CollectionUtils.isEmpty(shopIds)){ appUser.setShopIds(shopIds); + }else { + return new Page<>(); } } } diff --git a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml index 5932c76..3c9c285 100644 --- a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml +++ b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml @@ -79,7 +79,7 @@ </foreach> </if> </where> - order by ta.is_danger desc ta.create_time desc + order by ta.is_danger desc , ta.create_time desc </select> <select id="getAppuserPage1" resultType="com.ruoyi.account.api.model.AppUser"> diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java index 1c1ed64..41cf60b 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java @@ -46,6 +46,7 @@ import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; @@ -318,6 +319,9 @@ if(StringUtils.isNotEmpty(orderPageList.getUserName())){ List<AppUser> data = appUserClient.getAppUserByName(orderPageList.getUserName()).getData(); List<Long> collect = data.stream().map(AppUser::getId).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(collect)){ + return new PageInfo<>(); + } if(null != orderPageList.getAppUserIds()){ List<Long> appUserIds = orderPageList.getAppUserIds(); appUserIds.addAll(collect); @@ -330,6 +334,9 @@ if(StringUtils.isNotEmpty(orderPageList.getPhone())){ List<AppUser> data = appUserClient.getAppUserByPhone(orderPageList.getPhone()).getData(); List<Long> collect = data.stream().map(AppUser::getId).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(collect)){ + return new PageInfo<>(); + } if(null != orderPageList.getAppUserIds()){ List<Long> appUserIds = orderPageList.getAppUserIds(); appUserIds.addAll(collect); @@ -338,6 +345,8 @@ orderPageList.setAppUserIds(collect); } } + + PageInfo<OrderPageListVo> pageInfo = new PageInfo<>(orderPageList.getPageCurr(), orderPageList.getPageSize()); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderPageList.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderPageList.java index cc41c96..986d3f4 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderPageList.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderPageList.java @@ -1,10 +1,13 @@ package com.ruoyi.order.vo; +import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.core.web.page.BasePage; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; import java.util.List; /** @@ -26,8 +29,14 @@ private Integer paymentType; @ApiModelProperty("订单状态(1待发货2待收货3待使用4已完成5已取消6已退款7售后中8已评价)") private Integer status; - @ApiModelProperty("下单时间") - private String createTime; + @ApiModelProperty("开始时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime startTime; + @ApiModelProperty("结束时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime endTime; private Integer shopId; private List<Long> appUserIds; diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml index 801d70d..3ed06c4 100644 --- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml +++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml @@ -18,6 +18,7 @@ FROM t_order o <where> + pay_status = 2 <if test="status != null"> <choose> <when test="status == 4"> @@ -93,8 +94,8 @@ <if test="null != item.shopId"> and shop_id = #{item.shopId} and distribution_mode != 2 </if> - <if test="null != item.createTime"> - and create_time = #{item.createTime} + <if test="null != item.startTime and null != item.endTime"> + and create_time between #{item.startTime} and #{item.endTime} </if> order by create_time desc </select> diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java index 5f6df24..81f745a 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java @@ -62,6 +62,10 @@ public R<IPage<CouponInfo>> list(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize, CouponInfo couponInfo) { + Integer periodType = couponInfo.getPeriodType(); + if (periodType != null && periodType.equals(0)){ + couponInfo.setPeriodType(null); + } IPage<CouponInfo> couponInfoIPage = couponInfoService.queryCouponInfoPage(Page.of(pageNum, pageSize), couponInfo); for (CouponInfo record : couponInfoIPage.getRecords()) { R<Long> r = userCouponClient.getCouponCount(record.getId()); diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java index 68b621e..0fda853 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java @@ -143,6 +143,9 @@ if (shopDetailVO == null) { throw new ServiceException("查询店铺不存在"); } + if (shopDetailVO.getStatus().equals(2)){ + throw new ServiceException("店铺已冻结"); + } ShopScore one = shopScoreService.getOne(new LambdaQueryWrapper<ShopScore>().eq(ShopScore::getAppUserId, userid).eq(ShopScore::getShopId, shopId).last(" order by create_time desc limit 0, 1")); shopDetailVO.setMyScore(null == one ? BigDecimal.ZERO : one.getScore()); // 计算距离 diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/CouponInfoMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/CouponInfoMapper.xml index 9c7683f..be658be 100644 --- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/CouponInfoMapper.xml +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/CouponInfoMapper.xml @@ -40,7 +40,7 @@ <if test="couponInfo.sendType != null"> AND tci.send_type = #{couponInfo.sendType} </if> - <if test="couponInfo.personType != null"> + <if test="couponInfo.personType != null and couponInfo.personType != 0"> AND tci.person_type = #{couponInfo.personType} </if> <if test="couponInfo.shelfStatus != null"> -- Gitblit v1.7.1