From 5469e9d7083f951b4e8e0c3c5a6139e5f56ab678 Mon Sep 17 00:00:00 2001 From: Jack <46790855@qq.com> Date: Thu, 10 Jul 2025 16:43:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E9=89=B4=E6=9D=83=20bug=20fi?= =?UTF-8?q?x?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/AccountUserBaseService.java | 9 ++- .../impl/AccountUserBaseServiceImpl.java | 64 ++++++++++++------- .../impl/AdminBaseProtocolServiceImpl.java | 3 +- .../suisung/mall/common/domain/UserDto.java | 5 +- .../mall/common/utils/ContextUtil.java | 9 +-- .../mall/common/utils/ProductTitleUtil.java | 12 ++-- .../authorization/AuthorizationManager.java | 16 ++--- .../admin/ShopOrderReturnController.java | 10 +++ .../store/service/ShopStoreBaseService.java | 11 ++++ .../impl/ShopStoreBaseServiceImpl.java | 47 +++++++++++++- 10 files changed, 135 insertions(+), 51 deletions(-) diff --git a/mall-account/src/main/java/com/suisung/mall/account/service/AccountUserBaseService.java b/mall-account/src/main/java/com/suisung/mall/account/service/AccountUserBaseService.java index fc0cba18..cc0417f6 100644 --- a/mall-account/src/main/java/com/suisung/mall/account/service/AccountUserBaseService.java +++ b/mall-account/src/main/java/com/suisung/mall/account/service/AccountUserBaseService.java @@ -209,6 +209,7 @@ public interface AccountUserBaseService extends IBaseService { /** * 根据 userAccount 也就是手机号判断是否存在会员 + * * @param userAccount * @param storeId * @return @@ -240,20 +241,23 @@ public interface AccountUserBaseService extends IBaseService { /** * 根据手机号和商户查询map,用于批量匹配 + * * @param moblies 就是账号集合 * @return */ - Map getAccountBaseMapByMobile(List moblies); + Map getAccountBaseMapByMobile(List moblies); /** * 找出accountbase的最大id + * * @return */ - Integer getAccountMaxId(); + Integer getAccountMaxId(); /** * 批量保存accountBase + * * @return */ ThirdApiRes saveBatchAccountBase(List accountUserBaseList); @@ -261,6 +265,7 @@ public interface AccountUserBaseService extends IBaseService { /** * 批量保存accountInfo + * * @return */ ThirdApiRes saveBatchAccountInfo(List accountUserInfoList); diff --git a/mall-account/src/main/java/com/suisung/mall/account/service/impl/AccountUserBaseServiceImpl.java b/mall-account/src/main/java/com/suisung/mall/account/service/impl/AccountUserBaseServiceImpl.java index 91478e9f..be078b81 100644 --- a/mall-account/src/main/java/com/suisung/mall/account/service/impl/AccountUserBaseServiceImpl.java +++ b/mall-account/src/main/java/com/suisung/mall/account/service/impl/AccountUserBaseServiceImpl.java @@ -62,6 +62,7 @@ import com.suisung.mall.core.web.service.RedisService; import com.suisung.mall.core.web.service.impl.BaseServiceImpl; import io.seata.common.util.StringUtils; import io.seata.spring.annotation.GlobalTransactional; +import lombok.extern.slf4j.Slf4j; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -91,6 +92,7 @@ import static com.suisung.mall.common.utils.I18nUtil._; * @author Xinze * @since 2021-03-30 */ +@Slf4j @Service public class AccountUserBaseServiceImpl extends BaseServiceImpl implements AccountUserBaseService { @@ -324,7 +326,17 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl roles = null; List roleNames = new ArrayList<>(); @@ -368,8 +380,9 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl getAccountBaseMapByMobile(List moblies) { - QueryWrapper queryWrapper=new QueryWrapper<>(); + public Map getAccountBaseMapByMobile(List moblies) { + QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.select("user_id", "user_account"); moblies.forEach(moblie -> { queryWrapper.or(q -> q.eq("user_account", moblie)); }); - List userBaseList= this.list(queryWrapper); + List userBaseList = this.list(queryWrapper); return userBaseList.stream().collect(Collectors.toMap(AccountUserBase::getUser_account, AccountUserBase::getUser_id)); } @Override public Integer getAccountMaxId() { - QueryWrapper queryWrapper=new QueryWrapper<>(); + QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.select("max(user_id) as user_id"); - AccountUserBase accountUserBase=this.getOne(queryWrapper); + AccountUserBase accountUserBase = this.getOne(queryWrapper); return accountUserBase.getUser_id(); } + @Override public ThirdApiRes saveBatchAccountBase(List accountUserBaseList) { - boolean result=false; - if(!accountUserBaseList.isEmpty()){ + boolean result = false; + if (!accountUserBaseList.isEmpty()) { try { - result= saveBatch(accountUserBaseList,accountUserBaseList.size()); - }catch (RuntimeException e){ - throw new ApiException("保存saveBatchAccountBase报错:"+e.getMessage()); + result = saveBatch(accountUserBaseList, accountUserBaseList.size()); + } catch (RuntimeException e) { + throw new ApiException("保存saveBatchAccountBase报错:" + e.getMessage()); } } - if(result){ + if (result) { return new ThirdApiRes().success("成功"); } - return new ThirdApiRes().fail(250,"保存异常"); + return new ThirdApiRes().fail(250, "保存异常"); } @Override - public ThirdApiRes saveBatchAccountInfo(List accountUserInfoList){ - boolean result=false; - if(!accountUserInfoList.isEmpty()){ + public ThirdApiRes saveBatchAccountInfo(List accountUserInfoList) { + boolean result = false; + if (!accountUserInfoList.isEmpty()) { try { - result= accountUserInfoService.saveBatch(accountUserInfoList,accountUserInfoList.size()); - }catch (Exception e){ - throw new RuntimeException("保存AccountUserInfo报错:"+e.getMessage()); + result = accountUserInfoService.saveBatch(accountUserInfoList, accountUserInfoList.size()); + } catch (Exception e) { + throw new RuntimeException("保存AccountUserInfo报错:" + e.getMessage()); } } - if(result){ + if (result) { return new ThirdApiRes().success("成功"); } - return new ThirdApiRes().fail(250,"保存异常"); + return new ThirdApiRes().fail(250, "保存异常"); } diff --git a/mall-admin/src/main/java/com/suisung/mall/admin/service/impl/AdminBaseProtocolServiceImpl.java b/mall-admin/src/main/java/com/suisung/mall/admin/service/impl/AdminBaseProtocolServiceImpl.java index 7ec33e10..87d59469 100644 --- a/mall-admin/src/main/java/com/suisung/mall/admin/service/impl/AdminBaseProtocolServiceImpl.java +++ b/mall-admin/src/main/java/com/suisung/mall/admin/service/impl/AdminBaseProtocolServiceImpl.java @@ -105,8 +105,7 @@ public class AdminBaseProtocolServiceImpl extends BaseServiceImpl { + private final Logger logger = LoggerFactory.getLogger(AuthorizationManager.class); @Autowired private RedisTemplate redisTemplate; @Autowired @@ -54,8 +52,6 @@ public class AuthorizationManager implements ReactiveAuthorizationManager check(Mono mono, AuthorizationContext authorizationContext) { @@ -131,7 +127,9 @@ public class AuthorizationManager implements ReactiveAuthorizationManager i = AuthConstant.AUTHORITY_PREFIX + i).collect(Collectors.toList()); + +// logger.info("路由器认证用户权限:{}", authorities); //认证通过且角色匹配的用户可访问当前路径 return mono .filter(Authentication::isAuthenticated) diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/order/controller/admin/ShopOrderReturnController.java b/mall-shop/src/main/java/com/suisung/mall/shop/order/controller/admin/ShopOrderReturnController.java index 055263b7..91184391 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/order/controller/admin/ShopOrderReturnController.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/order/controller/admin/ShopOrderReturnController.java @@ -201,6 +201,16 @@ public class ShopOrderReturnController extends BaseControllerImpl { // 商家App 相关接口 + /** + * 商家处理退货退款,支持全单或部分商品退货 + * + * @param params JSON格式请求参数,包含: + * - order_id: 订单ID (必填) + * - order_return_vo: 退货商品信息 (可选,用于部分商品退货) + * - reason: 退货理由说明 (可选) + * {"order_id":"DD-20250701-1","reason":"商家协商退款","order_return_vo":{"order_id":"DD-20250701-1","return_items":[{"order_item_id":1,"return_item_num":1,"return_refund_amount":"0.01"}]}} + * @return CommonResult 处理结果 + */ @ApiOperation(value = "商家退货退款", notes = "商家退货退款,支持整单或个别商品退货") @RequestMapping(value = "/mch/order/doRefund", method = RequestMethod.POST) public CommonResult doRefundForMch(@RequestBody JSONObject params) { diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopStoreBaseService.java b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopStoreBaseService.java index bd5f142d..23bad8c3 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopStoreBaseService.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopStoreBaseService.java @@ -200,4 +200,15 @@ public interface ShopStoreBaseService extends IBaseService { */ Boolean updateStoreBizState(Integer storeId, Integer bizState); + + /** + * 追加店铺Id到商户 store_ids 字段,不保存 + * + * @param userId + * @param storeId + * @return + */ + String appendStoreIdToAccount(Integer userId, Integer storeId); + + } diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopStoreBaseServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopStoreBaseServiceImpl.java index 5203c419..dd10c66d 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopStoreBaseServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopStoreBaseServiceImpl.java @@ -67,6 +67,7 @@ import com.suisung.mall.shop.store.service.*; import com.suisung.mall.shop.user.service.ShopUserFavoritesStoreService; import com.suisung.mall.shop.wechat.service.WxQrCodeService; import io.seata.spring.annotation.GlobalTransactional; +import lombok.extern.slf4j.Slf4j; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -100,6 +101,7 @@ import static com.suisung.mall.common.utils.ContextUtil.getCurrentUser; * @author Xinze * @since 2021-04-23 */ +@Slf4j @Service public class ShopStoreBaseServiceImpl extends BaseServiceImpl implements ShopStoreBaseService { @@ -3407,7 +3409,9 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl