diff --git a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/filter/ValidateCodeFilter.java b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/filter/ValidateCodeFilter.java index 6a75a244..94bb000c 100644 --- a/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/filter/ValidateCodeFilter.java +++ b/pjcloud-auth/src/main/java/com/bsd/pjcloud/auth/support/filter/ValidateCodeFilter.java @@ -16,7 +16,9 @@ import com.bsd.pjcloud.common.core.constant.CacheConstants; import com.bsd.pjcloud.common.core.constant.CommonConstants; import com.bsd.pjcloud.common.core.constant.SecurityConstants; import com.bsd.pjcloud.common.core.constant.enums.CaptchaFlagTypeEnum; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; import com.bsd.pjcloud.common.core.exception.ValidateCodeException; +import com.bsd.pjcloud.common.core.util.MsgUtils; import com.bsd.pjcloud.common.core.util.SpringContextHolder; import com.bsd.pjcloud.common.core.util.WebUtils; import jakarta.servlet.FilterChain; @@ -103,7 +105,7 @@ public class ValidateCodeFilter extends OncePerRequestFilter { String code = request.getParameter("code"); if (StrUtil.isBlank(code)) { - throw new ValidateCodeException("验证码不能为空"); + throw new ValidateCodeException(MsgUtils.getMessage(ErrorCodes.AUTH_CAPTCHA_EMPTY)); } String randomStr = request.getParameter("randomStr"); @@ -121,7 +123,7 @@ public class ValidateCodeFilter extends OncePerRequestFilter { vo.setCaptchaVerification(code); vo.setCaptchaType(CommonConstants.IMAGE_CODE_TYPE); if (!captchaService.verification(vo).isSuccess()) { - throw new ValidateCodeException("验证码不能为空"); + throw new ValidateCodeException(MsgUtils.getMessage(ErrorCodes.AUTH_CAPTCHA_EMPTY)); } return; } @@ -129,24 +131,24 @@ public class ValidateCodeFilter extends OncePerRequestFilter { String key = CacheConstants.DEFAULT_CODE_KEY + randomStr; if (Boolean.FALSE.equals(redisTemplate.hasKey(key))) { - throw new ValidateCodeException("验证码不合法"); + throw new ValidateCodeException(MsgUtils.getMessage(ErrorCodes.AUTH_CAPTCHA_INVALID)); } Object codeObj = redisTemplate.opsForValue().get(key); if (codeObj == null) { - throw new ValidateCodeException("验证码不合法"); + throw new ValidateCodeException(MsgUtils.getMessage(ErrorCodes.AUTH_CAPTCHA_INVALID)); } String saveCode = codeObj.toString(); if (StrUtil.isBlank(saveCode)) { redisTemplate.delete(key); - throw new ValidateCodeException("验证码不合法"); + throw new ValidateCodeException(MsgUtils.getMessage(ErrorCodes.AUTH_CAPTCHA_INVALID)); } if (!StrUtil.equals(saveCode, code)) { redisTemplate.delete(key); - throw new ValidateCodeException("验证码不合法"); + throw new ValidateCodeException(MsgUtils.getMessage(ErrorCodes.AUTH_CAPTCHA_INVALID)); } redisTemplate.delete(key); diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenDeliveryOrderController.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenDeliveryOrderController.java index 28d73564..38b04253 100644 --- a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenDeliveryOrderController.java +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenDeliveryOrderController.java @@ -13,6 +13,9 @@ import com.bsd.pjcloud.canteen.vo.app.CanteenDeliveryMerchantStatsSummaryVO; import com.bsd.pjcloud.canteen.vo.app.CanteenDeliveryOrderAppVO; import com.bsd.pjcloud.canteen.vo.app.CanteenDeliveryRiderCommissionQueryVO; import com.bsd.pjcloud.canteen.vo.app.CanteenDeliveryRiderCommissionSummaryVO; +import com.bsd.pjcloud.common.core.util.MsgUtils; + +import com.bsd.pjcloud.common.core.exception.ErrorCodes; import com.bsd.pjcloud.common.core.util.R; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.bsd.pjcloud.common.log.annotation.SysLog; @@ -133,7 +136,7 @@ public class CanteenDeliveryOrderController { Long uid = SecurityUtils.getUser().getId(); return R.ok(canteenDeliveryOrderService.commissionQueryForRider(uid, start, end)); } catch (DateTimeParseException ex) { - return R.failed("日期格式应为 yyyy-MM-dd"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_DATE_FORMAT_YMD)); } catch (IllegalArgumentException ex) { return R.failed(ex.getMessage()); } @@ -146,7 +149,7 @@ public class CanteenDeliveryOrderController { Long uid = SecurityUtils.getUser().getId(); CanteenDeliveryOrderAppVO vo = canteenDeliveryOrderService.detailForRider(uid, id); if (vo == null) { - return R.failed("订单不存在或无权查看"); + return R.failed(MsgUtils.getMessage(ErrorCodes.DELIVERY_ORDER_NO_VIEW)); } return R.ok(vo); } diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenOnlineSpuController.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenOnlineSpuController.java index aa7dc20f..eb7f0a34 100644 --- a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenOnlineSpuController.java +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenOnlineSpuController.java @@ -16,6 +16,8 @@ import com.bsd.pjcloud.canteen.vo.app.CanteenOnlineSpuAppVO; import com.bsd.pjcloud.canteen.vo.app.MchSimpleAppVO; import com.bsd.pjcloud.canteen.vo.app.OnlineSpuChoiceGroupsVO; import com.bsd.pjcloud.canteen.vo.app.OnlineSpuChoiceGroupRuleVO; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.util.MsgUtils; import com.bsd.pjcloud.common.core.util.BeanUtils; import com.bsd.pjcloud.common.core.util.R; import com.bsd.pjcloud.common.log.annotation.SysLog; @@ -395,10 +397,10 @@ public class CanteenOnlineSpuController { public R checkSpuStock(@RequestParam(value = "spuId") Long spuId, @RequestParam("incrCount") Integer incrCount) { CanteenOnlineSpuEntity canteenOnlineSpuEntity = canteenOnlineSpuService.getById(spuId); if (canteenOnlineSpuEntity == null) { - return R.failed("商品不存在"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_PRODUCT_NOT_FOUND)); } if (canteenOnlineSpuEntity.getStock() < Math.abs(incrCount)) { - return R.failed("库存不足"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_PRODUCT_STOCK_LOW)); } return R.ok(); } diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenSpuController.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenSpuController.java index a2b18a94..76c7227f 100644 --- a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenSpuController.java +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/controller/CanteenSpuController.java @@ -24,6 +24,8 @@ import com.bsd.pjcloud.canteen.vo.ADCanteenSpuListVO; import com.bsd.pjcloud.canteen.vo.app.OnlineSpuComboItemVO; import com.bsd.pjcloud.canteen.vo.erp.CanteenSpuSimpleVO; import com.bsd.pjcloud.canteen.vo.erp.CanteenSpuStockVO; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.util.MsgUtils; import com.bsd.pjcloud.common.core.util.BeanUtils; import com.bsd.pjcloud.common.core.util.R; import com.bsd.pjcloud.common.log.annotation.SysLog; @@ -357,7 +359,7 @@ public class CanteenSpuController { public R getCanteenSpuDetails(@RequestParam("id") Long id) { CanteenSpuEntity detail = canteenSpuService.getDetail(id); if (detail == null) { - return R.failed("商品不存在"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_PRODUCT_NOT_FOUND)); } ADCanteenSpuListVO vo = BeanUtils.toBean(detail, ADCanteenSpuListVO.class); vo.setIntroduction(detail.getIntroduction()); @@ -450,10 +452,10 @@ public class CanteenSpuController { public R checkSpuStock(@RequestParam(value ="spuId")Long spuId,@RequestParam("incrCount")Integer incrCount) { CanteenSpuEntity canteenSpuEntity = canteenSpuService.getById(spuId); if (canteenSpuEntity == null) { - R.failed("商品不存在"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_PRODUCT_NOT_FOUND)); } if (canteenSpuEntity.getStock() resolveMerchantStaffUserIds(CanteenDeliveryOrderEntity order) { diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/push/CanteenDeliveryRiderPushPublisher.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/push/CanteenDeliveryRiderPushPublisher.java index 48f1fa8a..fca85abf 100644 --- a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/push/CanteenDeliveryRiderPushPublisher.java +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/push/CanteenDeliveryRiderPushPublisher.java @@ -1,5 +1,9 @@ package com.bsd.pjcloud.canteen.push; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; + +import com.bsd.pjcloud.common.core.util.MsgUtils; + import com.bsd.pjcloud.canteen.constants.CanteenDeliveryPushConstants; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; @@ -47,8 +51,8 @@ public class CanteenDeliveryRiderPushPublisher { ObjectNode envelope = objectMapper.createObjectNode(); envelope.put("bizType", CanteenDeliveryPushConstants.BIZ_TYPE_ORDER_ASSIGNED); envelope.put("version", CanteenDeliveryPushConstants.PAYLOAD_VERSION); - envelope.put("title", "新配送任务"); - envelope.put("body", "您有一单新的食堂外送,请及时处理"); + envelope.put("title", MsgUtils.getMessage(ErrorCodes.DELIVERY_RIDER_PUSH_TITLE)); + envelope.put("body", MsgUtils.getMessage(ErrorCodes.DELIVERY_RIDER_PUSH_BODY)); envelope.set("payload", objectMapper.valueToTree(Map.of( "deliveryOrderId", deliveryOrderId, "sourceOrderId", sourceOrderId != null ? sourceOrderId : "", diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenDeliveryOrderServiceImpl.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenDeliveryOrderServiceImpl.java index 97f49578..1040e10b 100644 --- a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenDeliveryOrderServiceImpl.java +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenDeliveryOrderServiceImpl.java @@ -1,5 +1,8 @@ package com.bsd.pjcloud.canteen.service.impl; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.exception.I18nBizException; + import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -40,6 +43,7 @@ import com.bsd.pjcloud.canteen.vo.app.CanteenDeliveryOrderAppVO; import com.bsd.pjcloud.canteen.vo.app.CanteenDeliveryRiderCommissionQueryVO; import com.bsd.pjcloud.canteen.vo.app.CanteenDeliveryRiderCommissionSummaryVO; import com.bsd.pjcloud.common.core.util.BeanUtils; +import com.bsd.pjcloud.common.core.util.MsgUtils; import com.bsd.pjcloud.common.core.util.R; import com.bsd.pjcloud.common.security.util.SecurityUtils; import com.bsd.pjcloud.wallet.api.feign.RemoteMchService; @@ -101,7 +105,7 @@ public class CanteenDeliveryOrderServiceImpl extends ServiceImpllambdaQuery() .eq(CanteenDeliveryOrderEntity::getSourceOrderId, dto.getId())); if (exists > 0) { - return R.failed("订单已同步过"); + return R.failed(MsgUtils.getMessage(ErrorCodes.DELIVERY_ORDER_ALREADY_SYNCED)); } CanteenDeliveryOrderEntity entity = new CanteenDeliveryOrderEntity(); entity.setSourceOrderId(dto.getId()); @@ -142,7 +146,7 @@ public class CanteenDeliveryOrderServiceImpl extends ServiceImpl cancelBySourceOrderId(String sourceOrderId) { if (StrUtil.isBlank(sourceOrderId)) { - return R.failed("订单号不能为空"); + return R.failed(MsgUtils.getMessage(ErrorCodes.DELIVERY_ORDER_NO_EMPTY)); } CanteenDeliveryOrderEntity one = getOne(Wrappers.lambdaQuery() .eq(CanteenDeliveryOrderEntity::getSourceOrderId, sourceOrderId)); @@ -477,16 +481,16 @@ public class CanteenDeliveryOrderServiceImpl extends ServiceImpl> resolveMerchantIdStringsForLoginUser() { var user = SecurityUtils.getUser(); if (user == null || user.getId() == null) { - return R.failed("未登录"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_NOT_LOGIN)); } R userInfoR = remoteUserService.getInnerByUserId(user.getId()); if (userInfoR == null || !userInfoR.isOk() || userInfoR.getData() == null || userInfoR.getData().getSysUser() == null) { - return R.failed("用户信息不存在"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_USER_NOT_EXIST)); } Long rootDeptId = userInfoR.getData().getSysUser().getDeptId(); if (rootDeptId == null) { - return R.failed("用户部门不存在"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_USER_DEPT_MISSING)); } List deptIds; R> deptR = remoteDeptService.getDescendantList(rootDeptId); @@ -497,7 +501,7 @@ public class CanteenDeliveryOrderServiceImpl extends ServiceImpl> mchR = remoteMchService.getByDeptIds(deptIds); if (mchR == null || !mchR.isOk() || CollUtil.isEmpty(mchR.getData())) { - String msg = mchR != null && StrUtil.isNotBlank(mchR.getMsg()) ? mchR.getMsg() : "商户不存在"; + String msg = mchR != null && StrUtil.isNotBlank(mchR.getMsg()) ? mchR.getMsg() : MsgUtils.getMessage(ErrorCodes.COMMON_MCH_NOT_FOUND); return R.failed(msg); } List ids = mchR.getData().stream() @@ -507,7 +511,7 @@ public class CanteenDeliveryOrderServiceImpl extends ServiceImpl merchantIds = mchIdsR.getData(); CanteenDeliveryOrderEntity e = getById(id); if (e == null || StrUtil.isBlank(e.getMerchantId()) || !merchantIds.contains(e.getMerchantId())) { - return R.failed("订单不存在或无权查看"); + return R.failed(MsgUtils.getMessage(ErrorCodes.DELIVERY_ORDER_NO_VIEW)); } if (!merchantScheduledOrderVisibleToMerchant(e)) { - return R.failed("订单不存在或无权查看"); + return R.failed(MsgUtils.getMessage(ErrorCodes.DELIVERY_ORDER_NO_VIEW)); } Map riderById = loadRidersByIds( e.getRiderUserId() != null ? List.of(e.getRiderUserId()) : List.of()); @@ -652,13 +656,13 @@ public class CanteenDeliveryOrderServiceImpl extends ServiceImpl pickup(Long riderUserId, CanteenDeliveryPhotoDTO dto) { CanteenDeliveryOrderEntity e = getById(dto.getId()); if (e == null || !Objects.equals(e.getRiderUserId(), riderUserId)) { - return R.failed("订单不存在或无权操作"); + return R.failed(MsgUtils.getMessage(ErrorCodes.DELIVERY_ORDER_NO_OPERATE)); } if (!Objects.equals(e.getRiderAccepted(), 1)) { - return R.failed("请先接单"); + return R.failed(MsgUtils.getMessage(ErrorCodes.DELIVERY_ACCEPT_FIRST)); } if (e.getStatus() != CanteenDeliveryOrderStatus.WAIT_PICKUP) { - return R.failed("当前状态不可上传取餐照"); + return R.failed(MsgUtils.getMessage(ErrorCodes.DELIVERY_PICKUP_PHOTO_STATUS_INVALID)); } e.setPickupPhotoUrl(dto.getPhotoUrl()); e.setStatus(CanteenDeliveryOrderStatus.DELIVERING); @@ -673,10 +677,10 @@ public class CanteenDeliveryOrderServiceImpl extends ServiceImpl deliver(Long riderUserId, CanteenDeliveryPhotoDTO dto) { CanteenDeliveryOrderEntity e = getById(dto.getId()); if (e == null || !Objects.equals(e.getRiderUserId(), riderUserId)) { - return R.failed("订单不存在或无权操作"); + return R.failed(MsgUtils.getMessage(ErrorCodes.DELIVERY_ORDER_NO_OPERATE)); } if (e.getStatus() != CanteenDeliveryOrderStatus.DELIVERING) { - return R.failed("当前状态不可上传送达照"); + return R.failed(MsgUtils.getMessage(ErrorCodes.DELIVERY_DELIVER_PHOTO_STATUS_INVALID)); } e.setDeliveryPhotoUrl(dto.getPhotoUrl()); e.setStatus(CanteenDeliveryOrderStatus.COMPLETED); @@ -841,10 +845,10 @@ public class CanteenDeliveryOrderServiceImpl extends ServiceImpl riderAcceptOrder(Long riderUserId, Long deliveryOrderId) { CanteenDeliveryOrderEntity e = getById(deliveryOrderId); if (e == null || !Objects.equals(e.getRiderUserId(), riderUserId)) { - return R.failed("订单不存在或无权操作"); + return R.failed(MsgUtils.getMessage(ErrorCodes.DELIVERY_ORDER_NO_OPERATE)); } if (!Objects.equals(e.getStatus(), CanteenDeliveryOrderStatus.RIDER_PENDING_ACCEPT)) { - return R.failed("当前状态不可接单"); + return R.failed(MsgUtils.getMessage(ErrorCodes.DELIVERY_ACCEPT_STATUS_INVALID)); } e.setRiderAccepted(1); e.setRiderAcceptTime(LocalDateTime.now()); @@ -962,7 +966,7 @@ public class CanteenDeliveryOrderServiceImpl extends ServiceImpl r = remoteHardOrderService.updateTakeOutStatus(dto); if (r == null || !r.isOk() || !Boolean.TRUE.equals(r.getData())) { - String msg = r == null ? "无响应" : r.getMsg(); - throw new IllegalStateException("同步硬件外卖订单状态失败: " + msg); + String msg = r == null ? MsgUtils.getMessage(ErrorCodes.DELIVERY_NO_RESPONSE) : r.getMsg(); + throw new I18nBizException(ErrorCodes.DELIVERY_SYNC_HARDWARE_FAIL, msg); } } } diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenOnlineSpuServiceImpl.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenOnlineSpuServiceImpl.java index e2da544c..52a74e22 100644 --- a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenOnlineSpuServiceImpl.java +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenOnlineSpuServiceImpl.java @@ -31,7 +31,10 @@ import com.bsd.pjcloud.canteen.vo.app.OnlineSpuChoiceGroupRuleVO; import com.bsd.pjcloud.canteen.vo.app.OnlineSpuComboItemVO; import com.bsd.pjcloud.canteen.vo.APPOnlineSpuVO; import com.bsd.pjcloud.canteen.vo.erp.CanteenOnlineSpuSimpleVO; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.exception.I18nBizException; import com.bsd.pjcloud.common.core.util.BeanUtils; +import com.bsd.pjcloud.common.core.util.MsgUtils; import com.bsd.pjcloud.common.core.util.R; import com.bsd.pjcloud.common.data.datascope.DataScope; import lombok.AllArgsConstructor; @@ -435,16 +438,16 @@ public class CanteenOnlineSpuServiceImpl extends ServiceImpl spu.getStock()) { - return R.failed(spu.getName() + "库存不足,无法完成操作"); + return R.failed(MsgUtils.getMessage(ErrorCodes.HARD_PRODUCT_STOCK_LOW, spu.getName())); } } // 下单等场景:库存与销量联动(incrCount<0 视为售出)。并发条件更新失败时抛异常回滚整批。 for (CanteenOnlineSpuUpdateStockReqDTO.Item v : canteenOnlineSpuUpdateStockReqDTO.getItems()) { if (baseMapper.updateStock(v.getId(), v.getIncrCount()) == 0) { - throw new RuntimeException("库存不足,无法完成操作"); + throw new I18nBizException(ErrorCodes.CANTEEN_STOCK_INSUFFICIENT); } } return R.ok(); @@ -463,7 +466,7 @@ public class CanteenOnlineSpuServiceImpl extends ServiceImpl item.getBeforeStock() == null)) { - return R.failed("库存业务参数错误"); + return R.failed(MsgUtils.getMessage(ErrorCodes.CANTEEN_STOCK_BIZ_PARAM_BAD)); } String stateKey = ORDER_STOCK_BIZ_KEY_PREFIX + dto.getBizId(); String state = stringRedisTemplate.opsForValue().get(stateKey); @@ -476,7 +479,7 @@ public class CanteenOnlineSpuServiceImpl extends ServiceImpl spu.getStock()) { - return R.failed(StrUtil.blankToDefault(spu.getName(), "商品") + "库存不足,无法完成操作"); + return R.failed(MsgUtils.getMessage(ErrorCodes.HARD_PRODUCT_STOCK_LOW, + StrUtil.blankToDefault(spu.getName(), "商品"))); } baseMapper.adjustStockOnly(v.getId(), v.getIncrCount()); } @@ -534,14 +539,14 @@ public class CanteenOnlineSpuServiceImpl extends ServiceImpl uw = new LambdaUpdateWrapper() .eq(CanteenOnlineSpuEntity::getId, dto.getId()) diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenOrderingFoodServiceImpl.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenOrderingFoodServiceImpl.java index fa125323..1faf96d1 100644 --- a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenOrderingFoodServiceImpl.java +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenOrderingFoodServiceImpl.java @@ -36,6 +36,8 @@ import com.bsd.pjcloud.canteen.vo.app.OrderingFoodStatsSegmentCountVO; import com.bsd.pjcloud.canteen.vo.app.OrderingFoodStatsSegmentDetailVO; import com.bsd.pjcloud.canteen.vo.app.OrderingFoodStatsSegmentDishExportVO; import com.bsd.pjcloud.canteen.vo.app.OrderingFoodStatsSummaryVO; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.util.MsgUtils; import com.bsd.pjcloud.common.core.util.R; import com.bsd.pjcloud.common.security.util.SecurityUtils; import com.bsd.pjcloud.wallet.api.entity.mch.MchManageEntity; @@ -86,14 +88,14 @@ public class CanteenOrderingFoodServiceImpl extends ServiceImpl> listMealSegments(String merchantId) { MchManageVo mch = loadMerchantOrFail(merchantId); if (mch == null) { - return R.failed("商户不存在"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_MCH_NOT_FOUND)); } if (!isOrderingFoodEnabled(mch)) { - return R.failed("该商户未启用报餐"); + return R.failed(MsgUtils.getMessage(ErrorCodes.ORDERING_FOOD_MCH_DISABLED)); } List segments = MchJobTimeMealSegmentUtils.parseMealSegments(mch.getJobTime()); if (CollUtil.isEmpty(segments)) { - return R.failed("商户未配置营业时间,无法获取餐段"); + return R.failed(MsgUtils.getMessage(ErrorCodes.ORDERING_FOOD_JOB_TIME_MISSING_FOR_SEGMENT)); } return R.ok(segments); } @@ -113,27 +115,27 @@ public class CanteenOrderingFoodServiceImpl extends ServiceImpl submit(OrderingFoodSubmitDTO dto) { var login = SecurityUtils.getUser(); if (login == null || login.getId() == null) { - return R.failed("未登录"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_NOT_LOGIN)); } MchManageVo mch = loadMerchantOrFail(dto.getMerchantId()); if (mch == null) { - return R.failed("商户不存在"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_MCH_NOT_FOUND)); } if (!isOrderingFoodEnabled(mch)) { - return R.failed("该商户未启用报餐"); + return R.failed(MsgUtils.getMessage(ErrorCodes.ORDERING_FOOD_MCH_DISABLED)); } if (CollUtil.isEmpty(dto.getSelections())) { - return R.failed("请选择报餐日期与餐段"); + return R.failed(MsgUtils.getMessage(ErrorCodes.ORDERING_FOOD_SELECT_DATE_SEGMENT)); } if (CollUtil.isEmpty(dto.getSpuItems())) { - return R.failed("请选择报餐菜品"); + return R.failed(MsgUtils.getMessage(ErrorCodes.ORDERING_FOOD_SELECT_DISH)); } if (dto.getPeopleCount() == null || dto.getPeopleCount() < 1) { - return R.failed("请填写报餐人数"); + return R.failed(MsgUtils.getMessage(ErrorCodes.ORDERING_FOOD_FILL_PERSON_COUNT)); } String jobTime = mch.getJobTime(); if (MchJobTimeMealSegmentUtils.isBlankJobTime(jobTime)) { - return R.failed("商户未配置营业时间"); + return R.failed(MsgUtils.getMessage(ErrorCodes.ORDERING_FOOD_JOB_TIME_MISSING)); } LocalDate minDate = LocalDate.now(); @@ -188,7 +190,7 @@ public class CanteenOrderingFoodServiceImpl extends ServiceImpl page) { Long uid = loginUserIdOrNull(); if (uid == null) { - return R.failed("未登录"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_NOT_LOGIN)); } Page p = normalizePage(page); var q = Wrappers.lambdaQuery() @@ -203,11 +205,11 @@ public class CanteenOrderingFoodServiceImpl extends ServiceImpl detailMyRecord(Long id) { Long uid = loginUserIdOrNull(); if (uid == null) { - return R.failed("未登录"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_NOT_LOGIN)); } CanteenOrderingFoodEntity e = getById(id); if (e == null || !Objects.equals(e.getUserId(), uid)) { - return R.failed("记录不存在"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_RECORD_NOT_FOUND)); } return R.ok(toAppVo(e)); } @@ -217,14 +219,14 @@ public class CanteenOrderingFoodServiceImpl extends ServiceImpl cancelMyRecord(Long id) { Long uid = loginUserIdOrNull(); if (uid == null) { - return R.failed("未登录"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_NOT_LOGIN)); } CanteenOrderingFoodEntity e = getById(id); if (e == null || !Objects.equals(e.getUserId(), uid)) { - return R.failed("记录不存在"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_RECORD_NOT_FOUND)); } if (!Objects.equals(e.getStatus(), CanteenOrderingFoodStatus.BOOKED.getCode())) { - return R.failed("当前状态不可取消"); + return R.failed(MsgUtils.getMessage(ErrorCodes.ORDERING_FOOD_CANCEL_STATUS_INVALID)); } e.setStatus(CanteenOrderingFoodStatus.CANCELLED.getCode()); e.setCancelTime(LocalDateTime.now()); @@ -245,10 +247,10 @@ public class CanteenOrderingFoodServiceImpl extends ServiceImpl rangeR = normalizeDateRange(startDate, endDate); if (!rangeR.isOk()) { @@ -271,13 +273,13 @@ public class CanteenOrderingFoodServiceImpl extends ServiceImpl adminRecordDetail(Long id) { if (id == null) { - return R.failed("记录不存在"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_RECORD_NOT_FOUND)); } CanteenOrderingFoodEntity e = getById(id); if (e == null) { - return R.failed("记录不存在"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_RECORD_NOT_FOUND)); } R mchR = resolveAdminMerchantId(e.getMerchantId()); if (!mchR.isOk()) { @@ -431,7 +433,7 @@ public class CanteenOrderingFoodServiceImpl extends ServiceImpl> deptR = remoteDeptService.getDescendantList(rootDeptId); if (deptR != null && deptR.isOk() && CollUtil.isNotEmpty(deptR.getData())) { @@ -486,7 +488,7 @@ public class CanteenOrderingFoodServiceImpl extends ServiceImpl> deptR = remoteDeptService.getDescendantList(rootDeptId); if (deptR != null && deptR.isOk() && CollUtil.isNotEmpty(deptR.getData())) { @@ -504,7 +506,7 @@ public class CanteenOrderingFoodServiceImpl extends ServiceImpl resolveAdminMerchantId(String merchantId) { if (StrUtil.isBlank(merchantId)) { - return R.failed("请选择食堂商户"); + return R.failed(MsgUtils.getMessage(ErrorCodes.ORDERING_FOOD_SELECT_CANTEEN_MCH)); } R> mchIdsR = resolveMerchantIdStringsForLoginUser(); if (!mchIdsR.isOk()) { @@ -512,7 +514,7 @@ public class CanteenOrderingFoodServiceImpl extends ServiceImpl MAX_STATS_RANGE_DAYS) { - return R.failed("查询日期范围最多一个月(" + MAX_STATS_RANGE_DAYS + "天)"); + return R.failed(MsgUtils.getMessage(ErrorCodes.ORDERING_FOOD_STATS_RANGE_TOO_LARGE, MAX_STATS_RANGE_DAYS)); } return R.ok(new LocalDate[]{start, end}); } @@ -857,15 +859,15 @@ public class CanteenOrderingFoodServiceImpl extends ServiceImpl checkOnlineCanteenMchRole() { var login = SecurityUtils.getUser(); if (login == null || login.getId() == null) { - return R.failed("未登录"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_NOT_LOGIN)); } R userInfoR = remoteUserService.getInnerByUserId(login.getId()); if (userInfoR == null || !userInfoR.isOk() || userInfoR.getData() == null) { - return R.failed("用户信息不存在"); + return R.failed(MsgUtils.getMessage(ErrorCodes.ORDERING_FOOD_USER_INFO_MISSING)); } String[] roleCodes = userInfoR.getData().getRoleCodes(); if (roleCodes == null || !Arrays.asList(roleCodes).contains(CommonRoleConstant.ONLINE_CANTEEN_MCH)) { - return R.failed("无权访问报餐统计"); + return R.failed(MsgUtils.getMessage(ErrorCodes.ORDERING_FOOD_NO_STATS_PERM)); } return R.ok(); } @@ -873,11 +875,11 @@ public class CanteenOrderingFoodServiceImpl extends ServiceImpl> resolveMerchantIdStringsForLoginUser() { var user = SecurityUtils.getUser(); if (user == null || user.getId() == null) { - return R.failed("未登录"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_NOT_LOGIN)); } Long rootDeptId = resolveLoginUserDeptId(); if (rootDeptId == null) { - return R.failed("用户部门不存在"); + return R.failed(MsgUtils.getMessage(ErrorCodes.ORDERING_FOOD_USER_DEPT_MISSING)); } List deptIds; R> deptR = remoteDeptService.getDescendantList(rootDeptId); @@ -888,7 +890,7 @@ public class CanteenOrderingFoodServiceImpl extends ServiceImpl> mchR = remoteMchService.getByDeptIds(deptIds); if (mchR == null || !mchR.isOk() || CollUtil.isEmpty(mchR.getData())) { - String msg = mchR != null && StrUtil.isNotBlank(mchR.getMsg()) ? mchR.getMsg() : "商户不存在"; + String msg = mchR != null && StrUtil.isNotBlank(mchR.getMsg()) ? mchR.getMsg() : MsgUtils.getMessage(ErrorCodes.COMMON_MCH_NOT_FOUND); return R.failed(msg); } List ids = mchR.getData().stream() @@ -898,7 +900,7 @@ public class CanteenOrderingFoodServiceImpl extends ServiceImpl selections) { for (OrderingFoodSpuItemDTO item : items) { if (item == null || item.getId() == null || StrUtil.isBlank(item.getName())) { - return "报餐菜品信息不完整"; + return MsgUtils.getMessage(ErrorCodes.ORDERING_FOOD_DISH_INFO_INCOMPLETE); } } boolean hasSegmentTag = items.stream().anyMatch(i -> i != null && i.getSegmentIndex() != null); @@ -967,7 +969,7 @@ public class CanteenOrderingFoodServiceImpl extends ServiceImpl items = new ArrayList<>(); for (OrderingFoodSelectionDTO sel : raw) { if (sel.getDiningDate() == null || sel.getSegmentIndex() == null) { - return R.failed("报餐日期或餐段不完整"); + return R.failed(MsgUtils.getMessage(ErrorCodes.ORDERING_FOOD_DATE_SEGMENT_INCOMPLETE)); } if (sel.getDiningDate().isBefore(minDate) || sel.getDiningDate().isAfter(maxDate)) { - return R.failed("仅支持报餐未来" + MAX_FUTURE_DAYS + "天内"); + return R.failed(MsgUtils.getMessage(ErrorCodes.ORDERING_FOOD_FUTURE_DAYS_LIMIT, MAX_FUTURE_DAYS)); } if (!MchJobTimeMealSegmentUtils.isValidSegmentIndex(jobTime, sel.getSegmentIndex())) { - return R.failed("餐段无效,请刷新后重试"); + return R.failed(MsgUtils.getMessage(ErrorCodes.ORDERING_FOOD_SEGMENT_INVALID)); } String key = sel.getDiningDate() + "#" + sel.getSegmentIndex(); if (!dedup.add(key)) { - return R.failed("存在重复的日期餐段选择"); + return R.failed(MsgUtils.getMessage(ErrorCodes.ORDERING_FOOD_DUPLICATE_DATE_SEGMENT)); } OrderingFoodMealSegmentVO segment = MchJobTimeMealSegmentUtils.findSegment(jobTime, sel.getSegmentIndex()); OrderingFoodSelectionItemDTO item = new OrderingFoodSelectionItemDTO(); diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenRiderConfigServiceImpl.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenRiderConfigServiceImpl.java index 7dc273aa..2ad965aa 100644 --- a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenRiderConfigServiceImpl.java +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenRiderConfigServiceImpl.java @@ -1,11 +1,14 @@ package com.bsd.pjcloud.canteen.service.impl; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; + import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.bsd.pjcloud.canteen.entity.CanteenRiderBuildingBindEntity; import com.bsd.pjcloud.canteen.entity.CanteenRiderPoolEntity; import com.bsd.pjcloud.canteen.mapper.CanteenRiderBuildingBindMapper; import com.bsd.pjcloud.canteen.mapper.CanteenRiderPoolMapper; import com.bsd.pjcloud.canteen.service.CanteenRiderConfigService; +import com.bsd.pjcloud.common.core.util.MsgUtils; import com.bsd.pjcloud.common.core.util.R; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -25,7 +28,7 @@ public class CanteenRiderConfigServiceImpl implements CanteenRiderConfigService .eq(CanteenRiderBuildingBindEntity::getDeptId, deptId) .eq(CanteenRiderBuildingBindEntity::getBuildingId, buildingId)); if (dup > 0) { - return R.failed("该单位下楼栋已绑定骑手,请先解绑"); + return R.failed(MsgUtils.getMessage(ErrorCodes.DELIVERY_RIDER_BUILDING_BOUND)); } CanteenRiderBuildingBindEntity e = new CanteenRiderBuildingBindEntity(); e.setDeptId(deptId); diff --git a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenSpuServiceImpl.java b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenSpuServiceImpl.java index 351090ef..9433b581 100644 --- a/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenSpuServiceImpl.java +++ b/pjcloud-canteen/pjcloud-canteen-biz/src/main/java/com/bsd/pjcloud/canteen/service/impl/CanteenSpuServiceImpl.java @@ -22,7 +22,10 @@ import com.bsd.pjcloud.canteen.vo.erp.CanteenSpuSimpleVO; import com.bsd.pjcloud.canteen.vo.erp.CanteenSpuStockVO; import com.bsd.pjcloud.canteen.vo.ADCanteenSpuListVO; import com.bsd.pjcloud.canteen.util.CanteenMerchantScopeHelper; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.exception.I18nBizException; import com.bsd.pjcloud.common.core.util.BeanUtils; +import com.bsd.pjcloud.common.core.util.MsgUtils; import com.bsd.pjcloud.common.core.util.R; import com.bsd.pjcloud.common.data.datascope.DataScope; import lombok.AllArgsConstructor; @@ -77,28 +80,29 @@ public class CanteenSpuServiceImpl extends ServiceImpl spu.getStock())) { - return R.failed(StrUtil.blankToDefault(spu.getName(), "商品") + "库存不足,无法完成操作"); + return R.failed(MsgUtils.getMessage(ErrorCodes.HARD_PRODUCT_STOCK_LOW, + StrUtil.blankToDefault(spu.getName(), "商品"))); } } for (CanteenSpuUpdateStockReqDTO.Item item : updateStockReqDTO.getItems()) { if (baseMapper.updateStock(item.getId(), item.getIncrCount()) == 0) { - throw new RuntimeException("库存不足,无法完成操作"); + throw new I18nBizException(ErrorCodes.CANTEEN_STOCK_INSUFFICIENT); } } return R.ok(); @@ -122,10 +126,10 @@ public class CanteenSpuServiceImpl extends ServiceImpl item == null || item.getId() == null || item.getIncrCount() == null || item.getIncrCount() == 0 || item.getBeforeStock() == null)) { - return R.failed("库存业务参数错误"); + return R.failed(MsgUtils.getMessage(ErrorCodes.CANTEEN_STOCK_BIZ_PARAM_BAD)); } if (dto.getItems().stream().map(CanteenSpuUpdateStockReqDTO.Item::getId).distinct().count() != dto.getItems().size()) { - return R.failed("库存商品不能重复"); + return R.failed(MsgUtils.getMessage(ErrorCodes.CANTEEN_STOCK_ITEM_DUP)); } String stateKey = ORDER_STOCK_BIZ_KEY_PREFIX + dto.getBizId(); @@ -142,26 +146,29 @@ public class CanteenSpuServiceImpl extends ServiceImpl不存在 */ + String AFTER_SALE_REFUND_PRODUCT_MISSING = "after.sale.refund.product.missing"; + + /** 退款商品<{0}>数量不能为空 */ + String AFTER_SALE_REFUND_QTY_EMPTY = "after.sale.refund.qty.empty"; + + /** 退款商品<{0}>数量不能为负数 */ + String AFTER_SALE_REFUND_QTY_NEGATIVE = "after.sale.refund.qty.negative"; + + /** 退款商品<{0}>数量异常 */ + String AFTER_SALE_REFUND_QTY_INVALID = "after.sale.refund.qty.invalid"; + + /** 历史退款商品数量异常 */ + String AFTER_SALE_HIST_QTY_INVALID = "after.sale.hist.qty.invalid"; + + /** 订单商品数量异常 */ + String AFTER_SALE_ORDER_QTY_INVALID = "after.sale.order.qty.invalid"; + + /** 退款商品数量异常 */ + String AFTER_SALE_REFUND_QTY_BAD = "after.sale.refund.qty.bad"; + + /** 退款商品<{0}>数量超出 */ + String AFTER_SALE_REFUND_QTY_EXCEED = "after.sale.refund.qty.exceed"; + + /** 该订单类型不支持退款 */ + String AFTER_SALE_ORDER_TYPE_NO_REFUND = "after.sale.order.type.no.refund"; + + /** 当前订单状态不支持退款 */ + String AFTER_SALE_ORDER_STATUS_NO_REFUND = "after.sale.order.status.no.refund"; + + /** 订单已超过可退款时限 */ + String AFTER_SALE_REFUND_TIME_EXCEEDED = "after.sale.refund.time.exceeded"; + + /** 自动退款处理中,当前售后单不允许人工取消或审核 */ + String AFTER_SALE_AUTO_REFUND_LOCK = "after.sale.auto.refund.lock"; + + /** 同一商品不能重复提交 */ + String AFTER_SALE_DUP_PRODUCT = "after.sale.dup.product"; + + /** 退款商品不属于当前订单 */ + String AFTER_SALE_PRODUCT_NOT_IN_ORDER = "after.sale.product.not.in.order"; + + /** 称重商品暂不支持在线逐份退款 */ + String AFTER_SALE_WEIGHTED_NO_PARTIAL = "after.sale.weighted.no.partial"; + + /** 退款商品<{0}>数量超出可退范围 */ + String AFTER_SALE_REFUND_QTY_OUT_RANGE = "after.sale.refund.qty.out.range"; + + /** 退款商品<{0}>退款金额异常 */ + String AFTER_SALE_REFUND_AMOUNT_INVALID = "after.sale.refund.amount.invalid"; + + /** 请选择需要退款的商品 */ + String AFTER_SALE_SELECT_PRODUCT = "after.sale.select.product"; + + /** 订单商品数据异常 */ + String AFTER_SALE_ORDER_PRODUCT_BAD = "after.sale.order.product.bad"; + + /** 订单商品金额快照异常 */ + String AFTER_SALE_ORDER_AMOUNT_SNAPSHOT_BAD = "after.sale.order.amount.snapshot.bad"; + + /** 退款分摊权重异常 */ + String AFTER_SALE_ALLOC_WEIGHT_BAD = "after.sale.alloc.weight.bad"; + + /** 订单退款正在处理中,请稍后重试 */ + String AFTER_SALE_PROCESSING = "after.sale.processing"; + + /** 审批失败,售后状态不处于审批中 */ + String AFTER_SALE_APPROVE_STATUS_INVALID = "after.sale.approve.status.invalid"; + + /** 当前订单已有退款申请待审核,请先处理后再退款 */ + String AFTER_SALE_PENDING_HANDLE_FIRST = "after.sale.pending.handle.first"; + + /** 历史退款商品明细不完整,请通过后台核对后处理 */ + String AFTER_SALE_HIST_DETAIL_INCOMPLETE = "after.sale.hist.detail.incomplete"; + + /** 订单类型错误 */ + String AFTER_SALE_ORDER_TYPE_ERROR = "after.sale.order.type.error"; + + /** 退款商品列表不能为空 */ + String AFTER_SALE_REFUND_LIST_EMPTY = "after.sale.refund.list.empty"; + + /** 设备订单不存在 */ + String AFTER_SALE_DEVICE_ORDER_MISSING = "after.sale.device.order.missing"; + + /** 购物车不存在或不属于当前用户 */ + String HARD_CART_NOT_OWNED = "hard.cart.not.owned"; + + /** 购物车不存在或无权查看 */ + String HARD_CART_NO_VIEW = "hard.cart.no.view"; + + /** 购物车状态已变更,请重新选择商品 */ + String HARD_CART_STATUS_CHANGED = "hard.cart.status.changed"; + + /** 购物车金额异常 */ + String HARD_CART_AMOUNT_INVALID = "hard.cart.amount.invalid"; + + /** 购物车商品数据异常,请重新选择商品 */ + String HARD_CART_PRODUCT_BAD = "hard.cart.product.bad"; + + /** 购物车商品不存在或不属于当前商户 */ + String HARD_CART_PRODUCT_NOT_IN_MCH = "hard.cart.product.not.in.mch"; + + /** 未选择必选菜品 */ + String HARD_REQUIRED_DISH_MISSING = "hard.required.dish.missing"; + + /** 用户地址不存在 */ + String HARD_USER_ADDRESS_MISSING = "hard.user.address.missing"; + + /** 查询自提点不存在 */ + String HARD_PICKUP_POINT_MISSING = "hard.pickup.point.missing"; + + /** 该商家未合作 */ + String HARD_MCH_NOT_COOPERATE = "hard.mch.not.cooperate"; + + /** 发起app支付失败 */ + String HARD_APP_PAY_FAIL = "hard.app.pay.fail"; + + /** 钱包扣款错误 */ + String HARD_WALLET_DEDUCT_FAIL = "hard.wallet.deduct.fail"; + + /** 您有{0}笔未核销的预约订单,请先核销 */ + String HARD_UNVERIFIED_SELF = "hard.unverified.self"; + + /** 用餐人已有{0}笔未核销的预约订单,请先核销 */ + String HARD_UNVERIFIED_DINER = "hard.unverified.diner"; + + /** 用餐人已有{0}笔未核销的预约订单,本次订餐后将超过200笔上限 */ + String HARD_UNVERIFIED_DINER_LIMIT = "hard.unverified.diner.limit"; + + /** 批量订餐暂仅支持钱包支付 */ + String HARD_BATCH_WALLET_ONLY = "hard.batch.wallet.only"; + + /** 仅食堂购物车可以多人订餐 */ + String HARD_MULTI_DINER_CANTEEN_ONLY = "hard.multi.diner.canteen.only"; + + /** 该购物车已创建订单,请勿重复提交 */ + String HARD_CART_ALREADY_ORDERED = "hard.cart.already.ordered"; + + /** 购物车已创建订单,请勿重复提交 */ + String HARD_CART_ALREADY_ORDERED2 = "hard.cart.already.ordered2"; + + /** 购物车商户不是食堂商户 */ + String HARD_CART_NOT_CANTEEN = "hard.cart.not.canteen"; + + /** 用餐人不存在 */ + String HARD_DINER_NOT_FOUND = "hard.diner.not.found"; + + /** 创建订餐订单失败 */ + String HARD_CREATE_RESERVE_FAIL = "hard.create.reserve.fail"; + + /** 订餐事务状态异常,请稍后重试 */ + String HARD_RESERVE_TX_BAD = "hard.reserve.tx.bad"; + + /** 订餐分组不能为空 */ + String HARD_RESERVE_GROUP_EMPTY = "hard.reserve.group.empty"; + + /** 请勿重复提交同一购物车 */ + String HARD_CART_DUP_SUBMIT = "hard.cart.dup.submit"; + + /** 订餐订单正在处理中,请勿重复提交 */ + String HARD_RESERVE_PROCESSING = "hard.reserve.processing"; + + /** 仅食堂购物车可以提交每日菜谱订单 */ + String HARD_DAILY_MENU_CANTEEN_ONLY = "hard.daily.menu.canteen.only"; + + /** 购物车不是每日菜谱场景,请重新点击去支付 */ + String HARD_NOT_DAILY_MENU_SCENE = "hard.not.daily.menu.scene"; + + /** 批量订餐必须属于同一商户 */ + String HARD_BATCH_SAME_MCH = "hard.batch.same.mch"; + + /** 请勿重复提交同一天同一餐段 */ + String HARD_DUP_DATE_MEAL = "hard.dup.date.meal"; + + /** 当前商户未开启每日菜谱订餐模式 */ + String HARD_DAILY_MENU_MODE_OFF = "hard.daily.menu.mode.off"; + + /** 订餐金额异常 */ + String HARD_RESERVE_AMOUNT_BAD = "hard.reserve.amount.bad"; + + /** 查询用餐人饭卡失败,请稍后重试 */ + String HARD_DINER_CARD_QUERY_FAIL = "hard.diner.card.query.fail"; + + /** 查询用餐人失败 */ + String HARD_DINER_QUERY_FAIL = "hard.diner.query.fail"; + + /** 用餐人饭卡数据异常,请联系管理员 */ + String HARD_DINER_CARD_DATA_BAD = "hard.diner.card.data.bad"; + + /** {0}存在重复饭卡数据,请联系管理员 */ + String HARD_DINER_CARD_DUP = "hard.diner.card.dup"; + + /** {0}未开通饭卡 */ + String HARD_DINER_NO_CARD = "hard.diner.no.card"; + + /** {0}的饭卡归属异常,请联系管理员 */ + String HARD_DINER_CARD_OWNER_BAD = "hard.diner.card.owner.bad"; + + /** {0}饭卡余额不足 */ + String HARD_DINER_BALANCE_LOW = "hard.diner.balance.low"; + + /** 每日菜谱商品不存在、已下架或不属于当前商户 */ + String HARD_DAILY_MENU_PRODUCT_BAD = "hard.daily.menu.product.bad"; + + /** {0}价格异常,请联系商户 */ + String HARD_PRODUCT_PRICE_BAD = "hard.product.price.bad"; + + /** {0}商品模式异常,请联系商户 */ + String HARD_PRODUCT_MODE_BAD = "hard.product.mode.bad"; + + /** {0}价格已变化,请重新选择菜品 */ + String HARD_PRODUCT_PRICE_CHANGED = "hard.product.price.changed"; + + /** {0}库存不足 */ + String HARD_PRODUCT_STOCK_LOW = "hard.product.stock.low"; + + /** 该商户每个日期餐段仅允许选择一份商品 */ + String HARD_ONE_ITEM_PER_SLOT = "hard.one.item.per.slot"; + + /** 用餐人不能为空 */ + String HARD_DINER_EMPTY = "hard.diner.empty"; + + /** 请勿重复选择用餐人 */ + String HARD_DINER_DUP = "hard.diner.dup"; + + /** 存在无效或无权代订的用餐人 */ + String HARD_DINER_INVALID = "hard.diner.invalid"; + + /** 当前商户未开启监护关系代订餐 */ + String HARD_GUARDIAN_RESERVE_OFF = "hard.guardian.reserve.off"; + + /** 存在不符合当前商户可订餐身份的用餐人 */ + String HARD_DINER_IDENTITY_INVALID = "hard.diner.identity.invalid"; + + /** 同一用餐人同一天同一餐段只能预约一次,请勿重复预约 */ + String HARD_DINER_SLOT_ONCE = "hard.diner.slot.once"; + + /** 预约正在处理中,请勿重复提交 */ + String HARD_APPT_PROCESSING = "hard.appt.processing"; + + /** 预约事务状态异常,请稍后重试 */ + String HARD_APPT_TX_BAD = "hard.appt.tx.bad"; + + /** 用餐人与饭卡归属不一致 */ + String HARD_DINER_CARD_MISMATCH = "hard.diner.card.mismatch"; + + /** 库存不足或扣减失败 */ + String HARD_STOCK_DEDUCT_FAIL = "hard.stock.deduct.fail"; + + /** 恢复库存失败 */ + String HARD_STOCK_RESTORE_FAIL = "hard.stock.restore.fail"; + + /** 每日菜谱库存不足或扣减失败 */ + String HARD_DAILY_STOCK_DEDUCT_FAIL = "hard.daily.stock.deduct.fail"; + + /** 每日菜谱库存恢复失败 */ + String HARD_DAILY_STOCK_RESTORE_FAIL = "hard.daily.stock.restore.fail"; + + /** 复制订餐购物车失败 */ + String HARD_COPY_CART_FAIL = "hard.copy.cart.fail"; + + /** 复制订餐商品失败 */ + String HARD_COPY_PRODUCT_FAIL = "hard.copy.product.fail"; + + /** 订餐钱包交易数据异常 */ + String HARD_WALLET_TX_BAD = "hard.wallet.tx.bad"; + + /** 更新订餐订单支付状态失败 */ + String HARD_UPDATE_PAY_STATUS_FAIL = "hard.update.pay.status.fail"; + + /** 更新订餐购物车状态失败 */ + String HARD_UPDATE_CART_STATUS_FAIL = "hard.update.cart.status.fail"; + + /** 查询商户无响应 */ + String HARD_MCH_NO_RESP = "hard.mch.no.resp"; + + /** 查询用餐人饭卡无响应 */ + String HARD_DINER_CARD_NO_RESP = "hard.diner.card.no.resp"; + + /** 查询每日菜谱商品无响应 */ + String HARD_DAILY_PRODUCT_NO_RESP = "hard.daily.product.no.resp"; + + /** 查询每日菜谱商品失败 */ + String HARD_DAILY_PRODUCT_QUERY_FAIL = "hard.daily.product.query.fail"; + + /** 查询用餐人身份无响应 */ + String HARD_DINER_IDENTITY_NO_RESP = "hard.diner.identity.no.resp"; + + /** 查询用餐人身份失败 */ + String HARD_DINER_IDENTITY_QUERY_FAIL = "hard.diner.identity.query.fail"; + + /** 每日菜谱订单批次数据异常 */ + String HARD_DAILY_MENU_BATCH_BAD = "hard.daily.menu.batch.bad"; + + /** 订餐订单批次数据异常 */ + String HARD_RESERVE_BATCH_BAD = "hard.reserve.batch.bad"; + + /** 钱包批量扣款结果异常 */ + String HARD_WALLET_BATCH_DEDUCT_BAD = "hard.wallet.batch.deduct.bad"; + + /** 周期预约规则不能为空 */ + String HARD_APPT_CYCLE_RULE_REQUIRED = "hard.appt.cycle.rule.required"; + + /** 动态时间窗商户不能提交周期预约规则 */ + String HARD_APPT_CYCLE_NOT_ALLOWED = "hard.appt.cycle.not.allowed"; + + /** 周期预约需要选择预约日期和餐端 */ + String HARD_APPT_DATE_MEAL_REQUIRED = "hard.appt.date.meal.required"; + + /** 周期预约尚未开放(周几几点开放) */ + String HARD_APPT_CYCLE_OPEN_AT = "hard.appt.cycle.open.at"; + + /** 钱包批量扣款无响应 */ + String HARD_WALLET_BATCH_DEDUCT_NO_RESP = "hard.wallet.batch.deduct.no.resp"; + + /** 钱包批量补偿无响应 */ + String HARD_WALLET_BATCH_COMP_NO_RESP = "hard.wallet.batch.comp.no.resp"; + + /** 查询商品库存无响应 */ + String HARD_STOCK_NO_RESP = "hard.stock.no.resp"; + + /** 预约餐段不存在 */ + String HARD_APPT_SLOT_MISSING = "hard.appt.slot.missing"; + + /** 预约餐段与当前商户不匹配 */ + String HARD_APPT_SLOT_MCH_MISMATCH = "hard.appt.slot.mch.mismatch"; + + /** 预约餐段已停用 */ + String HARD_APPT_SLOT_DISABLED = "hard.appt.slot.disabled"; + + /** 预约餐段与商户当前模式不匹配 */ + String HARD_APPT_SLOT_MODE_MISMATCH = "hard.appt.slot.mode.mismatch"; + + /** 该预约日期不在可选范围内 */ + String HARD_APPT_DATE_OUT_RANGE = "hard.appt.date.out.range"; + + /** 该日期未配置此预约餐段 */ + String HARD_APPT_DATE_NO_SLOT = "hard.appt.date.no.slot"; + + /** 预约日期类型无效 */ + String HARD_APPT_DATE_TYPE_INVALID = "hard.appt.date.type.invalid"; + + /** 动态预约餐段不能为空 */ + String HARD_APPT_DYNAMIC_SLOT_EMPTY = "hard.appt.dynamic.slot.empty"; + + /** 本期预约已截止 */ + String HARD_APPT_PERIOD_CLOSED = "hard.appt.period.closed"; + + /** 预约尚未开放 */ + String HARD_APPT_NOT_OPEN = "hard.appt.not.open"; + + /** 预约已截止 */ + String HARD_APPT_CLOSED = "hard.appt.closed"; + + /** 预约规则模式无效 */ + String HARD_APPT_RULE_MODE_INVALID = "hard.appt.rule.mode.invalid"; + + /** 预约规则配置不完整 */ + String HARD_APPT_RULE_INCOMPLETE = "hard.appt.rule.incomplete"; + + /** 预约规则时间范围无效 */ + String HARD_APPT_RULE_TIME_INVALID = "hard.appt.rule.time.invalid"; + + /** 周期预约规则不存在或已停用 */ + String HARD_APPT_CYCLE_MISSING = "hard.appt.cycle.missing"; + + /** 获取商户预约配置失败 */ + String HARD_APPT_MCH_CONF_FAIL = "hard.appt.mch.conf.fail"; + + /** 商户预约时间模式无效 */ + String HARD_APPT_MCH_MODE_INVALID = "hard.appt.mch.mode.invalid"; + + /** 配送时间类型无效 */ + String HARD_DELIVERY_TYPE_INVALID = "hard.delivery.type.invalid"; + + /** 预约配送须选择日期与时段 */ + String HARD_SCHEDULE_NEED_SLOT = "hard.schedule.need.slot"; + + /** 预约时段结束须晚于开始 */ + String HARD_SCHEDULE_END_AFTER_START = "hard.schedule.end.after.start"; + + /** 商户未配置营业时间 */ + String HARD_MCH_JOB_TIME_MISSING = "hard.mch.job.time.missing"; + + /** 预计送达时间不在商户营业时间内,请重新选择 */ + String HARD_ETA_OUT_OF_HOURS = "hard.eta.out.of.hours"; + + /** 商户未配置营业时间,暂不可预约配送 */ + String HARD_NO_SCHEDULE_WITHOUT_HOURS = "hard.no.schedule.without.hours"; + + /** 商户营业时间格式无效,请先在后台正确配置 jobTime */ + String HARD_JOB_TIME_FORMAT_BAD = "hard.job.time.format.bad"; + + /** 预约时段不在商户营业时间内,请重新选择 */ + String HARD_SLOT_OUT_OF_HOURS = "hard.slot.out.of.hours"; + + /** 该二维码已被核销 */ + String HARD_QR_ALREADY_VERIFIED = "hard.qr.already.verified"; + + /** 仅实际用餐人可以使用预约核销码 */ + String HARD_VERIFY_DINER_ONLY = "hard.verify.diner.only"; + + /** 该订单不是食堂预约订单 */ + String HARD_NOT_CANTEEN_RESERVE = "hard.not.canteen.reserve"; + + /** 当前用户没有商户核销权限 */ + String HARD_NO_MCH_VERIFY_PERM = "hard.no.mch.verify.perm"; + + /** 无权管理该商户订单 */ + String HARD_NO_MCH_ORDER_MANAGE = "hard.no.mch.order.manage"; + + /** 该预约订单当前不可核销 */ + String HARD_RESERVE_NOT_VERIFIABLE = "hard.reserve.not.verifiable"; + + /** 该预约订单正在退款,不能核销 */ + String HARD_RESERVE_REFUNDING_NO_VERIFY = "hard.reserve.refunding.no.verify"; + + /** 该预约订单商品已全部退款,不能核销 */ + String HARD_RESERVE_FULL_REFUND_NO_VERIFY = "hard.reserve.full.refund.no.verify"; + + /** 订单状态已变化,核销失败 */ + String HARD_VERIFY_STATUS_CHANGED = "hard.verify.status.changed"; + + /** 恢复预约核销码无响应 */ + String HARD_RESTORE_CODE_NO_RESP = "hard.restore.code.no.resp"; + + /** 恢复预约核销码失败 */ + String HARD_RESTORE_CODE_FAIL = "hard.restore.code.fail"; + + /** 仅线上预订订单支持退回到核销前 */ + String HARD_ROLLBACK_ONLINE_ONLY = "hard.rollback.online.only"; + + /** 当前业务类型不支持退回到核销前 */ + String HARD_ROLLBACK_BIZ_UNSUPPORTED = "hard.rollback.biz.unsupported"; + + /** 仅已核销订单支持退回到核销前 */ + String HARD_ROLLBACK_VERIFIED_ONLY = "hard.rollback.verified.only"; + + /** 该预约订单正在退款,不能退回到核销前 */ + String HARD_ROLLBACK_REFUNDING = "hard.rollback.refunding"; + + /** 该预约订单商品已全部退款,不能退回到核销前 */ + String HARD_ROLLBACK_FULL_REFUND = "hard.rollback.full.refund"; + + /** 订单状态已变化,退回核销状态失败 */ + String HARD_ROLLBACK_STATUS_CHANGED = "hard.rollback.status.changed"; + + /** 核销失败,活动已结束 */ + String HARD_ACT_ENDED = "hard.act.ended"; + + /** 核销失败,活动未开始 */ + String HARD_ACT_NOT_STARTED = "hard.act.not.started"; + + /** 核销失败,您领取的优惠券已核销 */ + String HARD_ACT_COUPON_USED = "hard.act.coupon.used"; + + /** 核销失败,位置的错误 */ + String HARD_ACT_LOCATION_ERROR = "hard.act.location.error"; + + /** 核销失败 */ + String HARD_ACT_VERIFY_FAIL = "hard.act.verify.fail"; + + /** 核销二维码错误 */ + String HARD_ACT_QR_BAD = "hard.act.qr.bad"; + + /** 当前设备不能核销该活动订单 */ + String HARD_ACT_DEVICE_NO_PERM = "hard.act.device.no.perm"; + + /** 当前活动,该用户没有核销权限 */ + String HARD_ACT_USER_NO_PERM = "hard.act.user.no.perm"; + + /** 核销用户不存在不存在 */ + String HARD_ACT_VERIFY_USER_MISSING = "hard.act.verify.user.missing"; + + /** 领券用户不存在不存在 */ + String HARD_ACT_COUPON_USER_MISSING = "hard.act.coupon.user.missing"; + + /** 订单已失效,请重新扫码 */ + String HARD_ORDER_EXPIRED_RESCAN = "hard.order.expired.rescan"; + + /** 该订单不是设备扫码支付订单 */ + String HARD_NOT_DEVICE_SCAN_PAY = "hard.not.device.scan.pay"; + + /** 该订单不是设备扫一扫订单 */ + String HARD_NOT_DEVICE_SCAN = "hard.not.device.scan"; + + /** 该订单已支付或状态已变更 */ + String HARD_ORDER_PAID_OR_CHANGED = "hard.order.paid.or.changed"; + + /** 支付金额为0元 */ + String HARD_PAY_AMOUNT_ZERO = "hard.pay.amount.zero"; + + /** 该用户没有这个钱包 */ + String HARD_USER_NO_WALLET = "hard.user.no.wallet"; + + /** 钱包用户不存在 */ + String HARD_WALLET_USER_MISSING = "hard.wallet.user.missing"; + + /** 快递单号不存在 */ + String HARD_SHIPMENT_NO_MISSING = "hard.shipment.no.missing"; + + /** 该订单类型不支持确认收货 */ + String HARD_ORDER_TYPE_NO_RECEIPT = "hard.order.type.no.receipt"; + + /** 该订单状态不支持确认收货 */ + String HARD_ORDER_STATUS_NO_RECEIPT = "hard.order.status.no.receipt"; + + /** 订单类型错误 */ + String HARD_ORDER_TYPE_ERROR = "hard.order.type.error"; + + /** 订单状态错误 */ + String HARD_ORDER_STATUS_ERROR = "hard.order.status.error"; + + /** 正在创建订单中,请勿重复操作 */ + String HARD_IDEM_CREATE = "hard.idem.create"; + + /** 正在核销中,请勿重复操作 */ + String HARD_IDEM_VERIFY = "hard.idem.verify"; + + /** 正在退回核销状态,请勿重复操作 */ + String HARD_IDEM_ROLLBACK = "hard.idem.rollback"; + + /** 购物车分组不能为空 */ + String HARD_CAR_GROUP_EMPTY = "hard.car.group.empty"; + + /** 购物车业务信息不完整 */ + String HARD_CAR_BIZ_INCOMPLETE = "hard.car.biz.incomplete"; + + /** 批量购物车必须属于同一用户、商户和业务类型 */ + String HARD_CAR_BATCH_SAME_USER_MCH = "hard.car.batch.same.user.mch"; + + /** 购物车商品保存失败 */ + String HARD_CAR_SAVE_FAIL = "hard.car.save.fail"; + + /** 验证码不能为空 */ + String AUTH_CAPTCHA_EMPTY = "auth.captcha.empty"; + + /** 验证码不合法 */ + String AUTH_CAPTCHA_INVALID = "auth.captcha.invalid"; + + /** 微信授权失败:{0} */ + String AUTH_WX_AUTH_FAIL = "auth.wx.auth.fail"; + + /** 微信授权失败,未获取到用户标识 */ + String AUTH_WX_OPENID_MISSING = "auth.wx.openid.missing"; + + /** 微信授权已过期,请重新授权 */ + String AUTH_WX_AUTH_EXPIRED = "auth.wx.auth.expired"; + + /** 未配置Apple登录 */ + String AUTH_APPLE_NOT_CONFIGURED = "auth.apple.not.configured"; + + /** 未启用Apple登录 */ + String AUTH_APPLE_NOT_ENABLED = "auth.apple.not.enabled"; + + /** 微信小程序登录失败 */ + String AUTH_MINI_APP_LOGIN_FAIL = "auth.mini.app.login.fail"; + + /** 授权已过期,请重新授权 */ + String AUTH_SOCIAL_AUTH_EXPIRED = "auth.social.auth.expired"; + + /** 短信验证码发送失败,请稍后重试 */ + String SYS_APP_SMS_SEND_FAIL = "sys.app.sms.send.fail"; + + /** 短信验证码错误或已过期 */ + String SYS_APP_SMS_CODE_INVALID = "sys.app.sms.code.invalid"; + + /** 新旧密码不能相同 */ + String SYS_USER_PASSWORD_SAME = "sys.user.password.same"; + + /** 解绑账号类型不存在 */ + String SYS_USER_UNBIND_TYPE_INVALID = "sys.user.unbind.type.invalid"; + + /** 充值业务id解析错误 */ + String THIRD_RECHARGE_BIZ_ID_INVALID = "third.recharge.biz.id.invalid"; + + /** 代充值业务id解析错误 */ + String THIRD_PROXY_RECHARGE_BIZ_ID_INVALID = "third.proxy.recharge.biz.id.invalid"; + + /** 代充值记录不存在或金额无效 */ + String THIRD_PROXY_RECHARGE_INVALID = "third.proxy.recharge.invalid"; + + /** 目标饭卡当前不可充值 */ + String THIRD_WARD_WALLET_NO_RECHARGE = "third.ward.wallet.no.recharge"; + + /** 支付金额必须大于0 */ + String THIRD_PAY_AMOUNT_GT_ZERO = "third.pay.amount.gt.zero"; + + /** 创建微信支付错误 */ + String THIRD_WECHAT_PAY_CREATE_FAIL = "third.wechat.pay.create.fail"; + + /** 创建支付宝支付错误 */ + String THIRD_ALIPAY_PAY_CREATE_FAIL = "third.alipay.pay.create.fail"; + + /** 用户不属于任何食堂或者商城 */ + String THIRD_USER_NO_MCH = "third.user.no.mch"; + + /** 用户不属于任何食堂 */ + String THIRD_USER_NO_CANTEEN = "third.user.no.canteen"; + + /** 商城支付缺少可信商户信息 */ + String THIRD_SHOP_PAY_MCH_MISSING = "third.shop.pay.mch.missing"; + + /** 商城订单业务id解析错误 */ + String THIRD_SHOP_ORDER_BIZ_ID_INVALID = "third.shop.order.biz.id.invalid"; + + /** 商城订单不存在或无权支付 */ + String THIRD_SHOP_ORDER_NO_PAY = "third.shop.order.no.pay"; + + /** 商城订单支付金额不一致 */ + String THIRD_SHOP_ORDER_AMOUNT_MISMATCH = "third.shop.order.amount.mismatch"; + + /** 商城订单收款商户不一致 */ + String THIRD_SHOP_ORDER_MCH_MISMATCH = "third.shop.order.mch.mismatch"; + + /** 收款商户已停用 */ + String THIRD_MCH_PAY_DISABLED = "third.mch.pay.disabled"; + + /** 商户未配置微信支付参数 */ + String THIRD_MCH_WECHAT_PAY_CONFIG_MISSING = "third.mch.wechat.pay.config.missing"; + + /** 商户未配置支付宝支付参数 */ + String THIRD_MCH_ALIPAY_PAY_CONFIG_MISSING = "third.mch.alipay.pay.config.missing"; + + /** 订单码支付正在处理中,请勿重复提交 */ + String THIRD_ORDER_CODE_PROCESSING = "third.order.code.processing"; + + /** 支付订单号不能为空 */ + String THIRD_PAY_NO_EMPTY = "third.pay.no.empty"; + + /** 订单码支付订单不存在 */ + String THIRD_ORDER_CODE_NOT_FOUND = "third.order.code.not.found"; + + /** 该业务订单已支付,请勿重复下单 */ + String THIRD_ORDER_ALREADY_PAID = "third.order.already.paid"; + + /** 该业务订单已有其他平台的待支付订单码 */ + String THIRD_ORDER_CODE_OTHER_PLATFORM = "third.order.code.other.platform"; + + /** 订单码数据异常,请稍后重试 */ + String THIRD_ORDER_CODE_DATA_ERROR = "third.order.code.data.error"; + + /** 上一笔订单正在确认关闭,请稍后重试 */ + String THIRD_ORDER_CLOSING = "third.order.closing"; + + /** 订单码支付参数不能为空 */ + String THIRD_ORDER_CODE_PARAM_EMPTY = "third.order.code.param.empty"; + + /** 订单码支付仅支持云消费机支付业务 */ + String THIRD_ORDER_CODE_BIZ_ONLY = "third.order.code.biz.only"; + + /** 订单码支付仅支持支付宝或微信 */ + String THIRD_ORDER_CODE_PLATFORM_ONLY = "third.order.code.platform.only"; + + /** 支付业务id不能为空 */ + String THIRD_PAY_BIZ_ID_EMPTY = "third.pay.biz.id.empty"; + + /** 该业务订单已有不同金额或商户的待支付订单 */ + String THIRD_ORDER_PENDING_MISMATCH = "third.order.pending.mismatch"; + + /** 收款商户信息不一致 */ + String THIRD_MCH_INFO_MISMATCH = "third.mch.info.mismatch"; + + /** 商户未启用支付宝支付配置 */ + String THIRD_MCH_ALIPAY_CONFIG_DISABLED = "third.mch.alipay.config.disabled"; + + /** 商户未启用微信支付配置 */ + String THIRD_MCH_WECHAT_CONFIG_DISABLED = "third.mch.wechat.config.disabled"; + + /** 支付宝应用支付配置不完整 */ + String THIRD_ALIPAY_APP_CONFIG_INCOMPLETE = "third.alipay.app.config.incomplete"; + + /** 微信服务商支付配置不完整 */ + String THIRD_WECHAT_APP_CONFIG_INCOMPLETE = "third.wechat.app.config.incomplete"; + + /** 上一笔退款仍在处理中,请稍后重试 */ + String THIRD_REFUND_PROCESSING = "third.refund.processing"; + + /** 微信用户授权参数不完整 */ + String THIRD_WX_OAUTH_INCOMPLETE = "third.wx.oauth.incomplete"; + + /** 微信用户授权失败,请重新扫码 */ + String THIRD_WX_OAUTH_FAIL = "third.wx.oauth.fail"; + + /** 支付平台分佣关系服务不可用 */ + String THIRD_FZ_RELATION_UNAVAILABLE = "third.fz.relation.unavailable"; + + /** 创建微信支付订单失败,请重新扫码 */ + String THIRD_WX_JSAPI_CREATE_FAIL = "third.wx.jsapi.create.fail"; + + /** 聚合支付子订单保存失败 */ + String THIRD_AGGREGATE_SUB_ORDER_SAVE_FAIL = "third.aggregate.sub.order.save.fail"; + + /** 商户微信支付配置不完整 */ + String THIRD_MCH_WECHAT_CONFIG_INCOMPLETE = "third.mch.wechat.config.incomplete"; + + /** 商户微信子商户号未配置 */ + String THIRD_MCH_WECHAT_SUB_MCH_MISSING = "third.mch.wechat.sub.mch.missing"; + + /** 支付订单缺少商户配置快照 */ + String THIRD_PAY_ORDER_SNAPSHOT_MISSING = "third.pay.order.snapshot.missing"; + + /** 支付订单商户配置快照无效 */ + String THIRD_PAY_ORDER_SNAPSHOT_INVALID = "third.pay.order.snapshot.invalid"; + + /** 支付宝授权码不能为空 */ + String THIRD_ALIPAY_AUTH_CODE_EMPTY = "third.alipay.auth.code.empty"; + + /** 支付宝用户授权失败,请重新扫码 */ + String THIRD_ALIPAY_OAUTH_FAIL = "third.alipay.oauth.fail"; + + /** 支付宝用户授权未返回付款人标识 */ + String THIRD_ALIPAY_OAUTH_NO_PAYER = "third.alipay.oauth.no.payer"; + + /** 创建支付宝支付订单失败,请重新扫码 */ + String THIRD_ALIPAY_JSAPI_CREATE_FAIL = "third.alipay.jsapi.create.fail"; + + /** 支付宝客户端初始化失败 */ + String THIRD_ALIPAY_CLIENT_INIT_FAIL = "third.alipay.client.init.fail"; + + /** 商户支付宝支付配置不完整 */ + String THIRD_MCH_ALIPAY_CONFIG_INCOMPLETE = "third.mch.alipay.config.incomplete"; + + /** 商户支付宝直付通二级商户标识未配置 */ + String THIRD_MCH_ALIPAY_SUB_MCH_MISSING = "third.mch.alipay.sub.mch.missing"; + + /** 创建微信订单码失败,请稍后重试 */ + String THIRD_WX_NATIVE_CREATE_FAIL = "third.wx.native.create.fail"; + + /** 创建微信订单码失败,微信错误码:{0} */ + String THIRD_WX_NATIVE_CREATE_FAIL_CODE = "third.wx.native.create.fail.code"; + + /** 创建微信订单码失败,微信未返回二维码 */ + String THIRD_WX_NATIVE_NO_QR = "third.wx.native.no.qr"; + + /* ========== App 业务消息 title/content ========== */ + String APP_MSG_TITLE_WALLET_PAYMENT = "app.msg.title.wallet.payment"; + String APP_MSG_TITLE_WALLET_REFUND = "app.msg.title.wallet.refund"; + String APP_MSG_TITLE_WALLET_RECHARGE = "app.msg.title.wallet.recharge"; + String APP_MSG_TITLE_WALLET_RESET = "app.msg.title.wallet.reset"; + String APP_MSG_TITLE_MEAL_VERIFIED = "app.msg.title.meal.verified"; + + String APP_MSG_EVENT_WALLET_UPDATE = "app.msg.event.wallet.update"; + String APP_MSG_EVENT_WALLET_BATCH = "app.msg.event.wallet.batch"; + String APP_MSG_EVENT_WALLET_RECHARGE = "app.msg.event.wallet.recharge"; + String APP_MSG_EVENT_WALLET_PAYMENT = "app.msg.event.wallet.payment"; + String APP_MSG_EVENT_WALLET_REFUND = "app.msg.event.wallet.refund"; + String APP_MSG_EVENT_WALLET_TRANSFER = "app.msg.event.wallet.transfer"; + String APP_MSG_EVENT_WALLET_TRANSFER_REFUND = "app.msg.event.wallet.transfer.refund"; + String APP_MSG_EVENT_WALLET_RETURN_CANTEEN = "app.msg.event.wallet.return.canteen"; + String APP_MSG_EVENT_WALLET_RESET = "app.msg.event.wallet.reset"; + String APP_MSG_EVENT_MEAL_VERIFIED = "app.msg.event.meal.verified"; + + String APP_MSG_WALLET_DEFAULT_NAME = "app.msg.wallet.default.name"; + String APP_MSG_WALLET_DETAIL_INC = "app.msg.wallet.detail.inc"; + String APP_MSG_WALLET_DETAIL_DEC = "app.msg.wallet.detail.dec"; + String APP_MSG_WALLET_DETAIL_SEP = "app.msg.wallet.detail.sep"; + String APP_MSG_WALLET_CONTENT = "app.msg.wallet.content"; + + String APP_MSG_MEAL_DEFAULT_NAME = "app.msg.meal.default.name"; + String APP_MSG_MEAL_CONTENT = "app.msg.meal.content"; + + String APP_MSG_WARD_FALLBACK = "app.msg.ward.fallback"; + String APP_MSG_RELATION_TITLE = "app.msg.relation.title"; + String APP_MSG_RELATION_CONTENT = "app.msg.relation.content"; + + /* ========== 商城 / SKU ========== */ + /** 商品SKU不存在 */ + String COMMON_PRODUCT_SKU_NOT_FOUND = "common.product.sku.not.found"; + + /** 商户服务异常 */ + String COMMON_MCH_SERVICE_ERROR = "common.mch.service.error"; + + /** 该用户未分配共富商户 */ + String MALL_USER_NO_FARMER_MCH = "mall.user.no.farmer.mch"; + + /** 无权限处理此商品 */ + String MALL_NO_PRODUCT_PERM = "mall.no.product.perm"; + + /** 分类不存在 */ + String MALL_CATEGORY_NOT_FOUND = "mall.category.not.found"; + + /** 无权限处理此分类 */ + String MALL_NO_CATEGORY_PERM = "mall.no.category.perm"; + + /* ========== 用户配送地址 ========== */ + String ADDRESS_ID_EMPTY = "address.id.empty"; + String ADDRESS_NOT_FOUND = "address.not.found"; + String ADDRESS_DEPT_BUILDING_REQUIRED = "address.dept.building.required"; + String ADDRESS_UNIT_REQUIRED = "address.unit.required"; + String ADDRESS_ROOM_REQUIRED = "address.room.required"; + String ADDRESS_DEPT_NOT_FOUND = "address.dept.not.found"; + String ADDRESS_BUILDING_NOT_FOUND = "address.building.not.found"; + String ADDRESS_BUILDING_DEPT_MISMATCH = "address.building.dept.mismatch"; + String ADDRESS_UNIT_NOT_FOUND = "address.unit.not.found"; + String ADDRESS_UNIT_BUILDING_MISMATCH = "address.unit.building.mismatch"; + String ADDRESS_ROOM_NOT_FOUND = "address.room.not.found"; + String ADDRESS_ROOM_UNIT_MISMATCH = "address.room.unit.mismatch"; + String ADDRESS_ROOM_NO_EMPTY = "address.room.no.empty"; + String ADDRESS_BUILDING_NO_ACCESS = "address.building.no.access"; + String ADDRESS_UNIT_NO_ACCESS = "address.unit.no.access"; + String ADDRESS_RECORD_UPDATE_MISSING = "address.record.update.missing"; + String ADDRESS_RECORD_DELETE_MISSING = "address.record.delete.missing"; + + /* ========== 购物车分组 / 商城 SKU ========== */ + String HARD_CAR_GROUP_ITEM_EMPTY = "hard.car.group.item.empty"; + String HARD_CAR_GROUP_ITEM_INCOMPLETE = "hard.car.group.item.incomplete"; + String HARD_CAR_GROUP_PARENT_FAIL = "hard.car.group.parent.fail"; + String HARD_CAR_GROUP_ITEM_INVALID = "hard.car.group.item.invalid"; + String MALL_PRODUCT_SKU_MISSING = "mall.product.sku.missing"; + + /* ========== 食堂库存 ========== */ + String CANTEEN_STOCK_ITEMS_EMPTY = "canteen.stock.items.empty"; + String CANTEEN_STOCK_ITEM_PARAM_BAD = "canteen.stock.item.param.bad"; + String CANTEEN_STOCK_BIZ_PARAM_BAD = "canteen.stock.biz.param.bad"; + String CANTEEN_STOCK_ITEM_DUP = "canteen.stock.item.dup"; + String CANTEEN_STOCK_SPU_BAD = "canteen.stock.spu.bad"; + String CANTEEN_STOCK_SNAPSHOT_BAD = "canteen.stock.snapshot.bad"; + String CANTEEN_STOCK_CHANGED = "canteen.stock.changed"; + String CANTEEN_STOCK_COMPENSATE_FAIL = "canteen.stock.compensate.fail"; + String CANTEEN_STOCK_UPDATE_FAIL = "canteen.stock.update.fail"; + String CANTEEN_STOCK_TX_STATE_BAD = "canteen.stock.tx.state.bad"; + String CANTEEN_STOCK_INSUFFICIENT = "canteen.stock.insufficient"; + String CANTEEN_NO_PRODUCT_PERM = "canteen.no.product.perm"; + String CANTEEN_NO_PRODUCT_PERM_NAMED = "canteen.no.product.perm.named"; + String CANTEEN_SHELF_STATUS_INVALID = "canteen.shelf.status.invalid"; + + /* ========== 订单库存 ========== */ + String HARD_STOCK_TX_STATE_BAD = "hard.stock.tx.state.bad"; + String HARD_CANTEEN_STOCK_AFTERSALE_MISSING = "hard.canteen.stock.aftersale.missing"; + String HARD_CANTEEN_STOCK_CAR_MISSING = "hard.canteen.stock.car.missing"; + String HARD_CANTEEN_STOCK_REFUND_ITEM_MISSING = "hard.canteen.stock.refund.item.missing"; + String HARD_CANTEEN_STOCK_NO_RESP = "hard.canteen.stock.no.resp"; + String HARD_CANTEEN_STOCK_QUERY_FAIL = "hard.canteen.stock.query.fail"; + String HARD_CANTEEN_SPU_BAD = "hard.canteen.spu.bad"; + String HARD_CANTEEN_STOCK_OP_FAIL = "hard.canteen.stock.op.fail"; + String HARD_DOOR_STOCK_FAIL = "hard.door.stock.fail"; + String HARD_STOCK_DEDUCT_CART_MISSING = "hard.stock.deduct.cart.missing"; + String HARD_STOCK_OP_FAIL = "hard.stock.op.fail"; + + /* ========== 钱包转账 / 活动领券 ========== */ + String WALLET_TRANSFER_SOURCE_LOW = "wallet.transfer.source.low"; + String WALLET_TRANSFER_LIMIT_EXCEEDED = "wallet.transfer.limit.exceeded"; + String WALLET_TRANSFER_NOT_FOUND = "wallet.transfer.not.found"; + String WALLET_TRANSFER_REFUND_DUP = "wallet.transfer.refund.dup"; + String WALLET_TRANSFER_REFUND_SOURCE_LOW = "wallet.transfer.refund.source.low"; + String WALLET_APPLY_DUP_SUBMIT = "wallet.apply.dup.submit"; + String ACT_CANCEL_NOT_FOUND = "act.cancel.not.found"; + String ACT_CANCEL_CLOSED = "act.cancel.closed"; + String ACT_CANCEL_MCH_MISSING = "act.cancel.mch.missing"; + String ACT_CANCEL_ALREADY_RECEIVED = "act.cancel.already.received"; + String ACT_CANCEL_BALANCE_LOW = "act.cancel.balance.low"; + String ACT_CANCEL_COUPON_EXPIRED = "act.cancel.coupon.expired"; + String ACT_COUPON_NOT_FOUND = "act.coupon.not.found"; + String ACT_NOT_FOUND = "act.not.found"; + String ACT_COUPON_POINTS_DEDUCT_FAIL = "act.coupon.points.deduct.fail"; + String ACT_ID_EMPTY = "act.id.empty"; + + /* ========== 人脸 / 车牌 ========== */ + String SYS_FACE_MAX_COUNT = "sys.face.max.count"; + String SYS_FACE_MAX_ACTIVE = "sys.face.max.active"; + String SYS_FACE_DUP_IMAGE = "sys.face.dup.image"; + String SYS_FACE_DEPT_MISSING = "sys.face.dept.missing"; + String SYS_FACE_WARD_ONLY = "sys.face.ward.only"; + String SYS_FACE_RECORD_MISSING = "sys.face.record.missing"; + String SYS_FACE_REVOKE_STATUS = "sys.face.revoke.status"; + String SYS_FACE_STATUS_CHANGED = "sys.face.status.changed"; + String SYS_CAR_PLATE_DUP = "sys.car.plate.dup"; + + /* ========== 幂等提示 ========== */ + String HARD_IDEM_APPLYING = "hard.idem.applying"; + String HARD_IDEM_CANCELING = "hard.idem.canceling"; + String HARD_IDEM_PROCESSING = "hard.idem.processing"; + String HARD_IDEM_REFUNDING = "hard.idem.refunding"; + String HARD_IDEM_BATCH_REFUND = "hard.idem.batch.refund"; + String ACT_IDEM_RECEIVING = "act.idem.receiving"; + String WALLET_IDEM_APPLYING = "wallet.idem.applying"; + String WALLET_IDEM_OPENING = "wallet.idem.opening"; + String WALLET_IDEM_PROCESSING = "wallet.idem.processing"; + String WALLET_IDEM_IMPORTING = "wallet.idem.importing"; + String WALLET_IDEM_RECHARGING = "wallet.idem.recharging"; + String WALLET_IDEM_UPLOADING = "wallet.idem.uploading"; + String WALLET_IDEM_INVOICE = "wallet.idem.invoice"; + + /* ========== 商城商家 CRUD ========== */ + String MALL_PRODUCT_CREATE_FAIL = "mall.product.create.fail"; + String MALL_PRODUCT_ID_EMPTY = "mall.product.id.empty"; + String MALL_PRODUCT_UPDATE_FAIL = "mall.product.update.fail"; + String MALL_PRODUCT_LIST_FAIL = "mall.product.list.fail"; + String MALL_PRODUCT_DELETE_FAIL = "mall.product.delete.fail"; + String MALL_CATEGORY_CREATE_FAIL = "mall.category.create.fail"; + String MALL_CATEGORY_ID_EMPTY = "mall.category.id.empty"; + String MALL_CATEGORY_UPDATE_FAIL = "mall.category.update.fail"; + String MALL_CATEGORY_DELETE_FAIL = "mall.category.delete.fail"; + String MALL_CATEGORY_LIST_FAIL = "mall.category.list.fail"; + + /* ========== App 支付面向用户 ========== */ + String THIRD_WX_PROFIT_AMOUNT_MIN = "third.wx.profit.amount.min"; + String THIRD_WX_PROFIT_AMOUNT_RANGE = "third.wx.profit.amount.range"; + String THIRD_PAY_CONFIG_MISSING = "third.pay.config.missing"; + String THIRD_WX_REFUND_AMOUNT_BAD = "third.wx.refund.amount.bad"; + String THIRD_PAY_ORDER_STATUS_NO_REFUND = "third.pay.order.status.no.refund"; + String THIRD_ALI_QR_CREATE_FAIL = "third.ali.qr.create.fail"; + String THIRD_ALI_AMOUNT_INVALID = "third.ali.amount.invalid"; + String THIRD_ALI_ZT_AMOUNT_MIN = "third.ali.zt.amount.min"; + String THIRD_WX_REFUND_APPLY_ERROR = "third.wx.refund.apply.error"; + String THIRD_WX_REFUND_QUEUED = "third.wx.refund.queued"; + String THIRD_ALI_REFUND_AMOUNT_BAD = "third.ali.refund.amount.bad"; + + /** 暂时停止注册 */ + String SYS_REGISTER_SUSPENDED = "sys.register.suspended"; + } diff --git a/pjcloud-common/pjcloud-common-core/src/main/resources/i18n/messages_en.properties b/pjcloud-common/pjcloud-common-core/src/main/resources/i18n/messages_en.properties index 8060dea0..50ae65a2 100644 --- a/pjcloud-common/pjcloud-common-core/src/main/resources/i18n/messages_en.properties +++ b/pjcloud-common/pjcloud-common-core/src/main/resources/i18n/messages_en.properties @@ -37,3 +37,535 @@ sys.user.password.new.empty=New password cannot be empty sys.user.password.length=Password length must be 6-20 characters sys.user.password.chars.only=Password can only contain letters and digits sys.user.password.letter.digit=Password must contain both letters and digits +common.not.login=Not signed in +common.record.not.found=Record not found +common.mch.not.found=Merchant not found +common.user.dept.missing=User department not found +ordering.food.mch.disabled=Meal ordering is not enabled for this merchant +ordering.food.job.time.missing.for.segment=Business hours are not configured; meal slots unavailable +ordering.food.job.time.missing=Business hours are not configured +ordering.food.select.date.segment=Please select meal date and slot +ordering.food.select.dish=Please select dishes +ordering.food.fill.person.count=Please enter the number of diners +ordering.food.cancel.status.invalid=Cannot cancel in the current status +ordering.food.select.valid.mch=Please select a valid merchant +ordering.food.no.mch.view.perm=No permission to view this merchant +ordering.food.select.date=Please select a date +ordering.food.user.dept.missing=User department not found +ordering.food.select.canteen.mch=Please select a canteen merchant +ordering.food.stats.range.too.large=Date range cannot exceed one month ({0} days) +ordering.food.user.info.missing=User info not found +ordering.food.no.stats.perm=No permission to access meal-order statistics +ordering.food.date.segment.incomplete=Meal date or slot is incomplete +ordering.food.future.days.limit=Only meals within the next {0} days are allowed +ordering.food.segment.invalid=Invalid meal slot. Please refresh and try again +ordering.food.duplicate.date.segment=Duplicate date and meal slot selection +ordering.food.dish.info.incomplete=Dish information is incomplete +ordering.food.select.dish.for.segment=Please select dishes for "{0}" +ordering.food.dish.segment.invalid=Invalid dish meal slot +common.order.not.found=Order not found +common.cart.not.found=Cart not found +common.wallet.not.found=User wallet not found +common.wallet.balance.insufficient=Insufficient wallet balance +common.product.not.found=Product not found +common.product.stock.low=Insufficient stock +common.user.not.exist=User not found +common.user.not.exist.dup=User not found +common.unsupported.pay.type=Unsupported payment method +common.mch.id.empty=Merchant ID is required +common.past.date.not.allowed=Cannot select a past date +common.date.format.ymd=Date format must be yyyy-MM-dd +common.date.range.required=Start and end dates are required +common.date.range.invalid=End date cannot be earlier than start date +common.month.format.ym=Month format must be yyyy-MM +delivery.order.no.view=Order not found or no permission to view +delivery.order.no.operate=Order not found or no permission to operate +delivery.accept.first=Please accept the order first +delivery.accept.status.invalid=Cannot accept in current status +delivery.already.accepted=Order already accepted +delivery.pickup.photo.status.invalid=Cannot upload pickup photo in current status +delivery.deliver.photo.status.invalid=Cannot upload delivery photo in current status +delivery.sync.hardware.fail=Failed to sync hardware takeout status: {0} +delivery.no.response=No response +delivery.order.already.synced=Order already synced +delivery.cart.serialize.fail=Cart serialization failed +delivery.order.no.empty=Order number is required +delivery.rider.push.title=New delivery task +delivery.rider.push.body=You have a new canteen delivery. Please handle it promptly. +delivery.mch.push.title=New takeout order +delivery.mch.push.body=You have a new canteen takeout order. Please handle it promptly. +delivery.mch.schedule.title=Scheduled delivery reminder +delivery.mch.schedule.body=A scheduled delivery is entering prep time. Please check it. +delivery.rider.building.bound=Buildings under this unit already have riders. Unbind first. +wallet.type.id.empty=Wallet type ID is required +wallet.remark.empty=Remark is required +wallet.not.found=Wallet not found +wallet.freeze.dup=Request already submitted +wallet.card.not.found=Card number not found +wallet.card.already.bound=Card already bound to a user +wallet.meal.card.not.found=Meal card wallet not found +wallet.user.already.bound=User already has a meal card +wallet.qr.gen.fail=Failed to generate wallet QR code +wallet.relation.query.fail=Failed to query related person info +wallet.user.relation.fail=Failed to query user relation +wallet.face.query.fail=Failed to query face enrollment +wallet.pending.appt.fail=Failed to query pending reservations +wallet.package.amount.invalid=Invalid recharge package amount +wallet.target.card.missing=Target meal card not found +wallet.no.ward.perm=No permission for this ward +wallet.ward.query.fail=Failed to query ward info +wallet.ward.not.found=Ward not found +wallet.identity.query.fail=Failed to query recharge identity +wallet.canteen.missing=Wallet canteen not found +wallet.identity.no.recharge=This identity cannot recharge the wallet +wallet.card.canteen.missing=Meal card canteen not found +wallet.pay.method.missing=Canteen has no payment methods configured +wallet.proxy.record.missing=Proxy recharge record not found +wallet.guardian.relation.fail=Failed to query guardian relation +wallet.package.not.found=Recharge package not found +wallet.package.disabled=Recharge package disabled +wallet.meal.card.not.open=Meal card not opened +wallet.meal.card.frozen=Meal card frozen +wallet.card.status.no.recharge={0}; recharge unavailable +wallet.target.user.missing=Target user info missing +wallet.no.ward.tx.perm=No permission to view this ward's transactions +wallet.tx.deduct.amount.mismatch=Duplicate deduction amount mismatch +wallet.tx.credit.amount.mismatch=Duplicate credit amount mismatch +wallet.tx.refund.amount.mismatch=Duplicate refund amount mismatch +wallet.tx.payment.amount.mismatch=Payment amount does not match compensation +wallet.order.payment.cancelled=Order payment was cancelled; deduction not allowed +wallet.order.payment.compensated=Order payment was compensated; duplicate deduction not allowed +wallet.tx.compensate.fail=Wallet compensation failed +wallet.tx.batch.compensate.fail=Wallet batch compensation failed +wallet.tx.payment.save.fail=Failed to save wallet payment transaction +wallet.tx.refund.save.fail=Failed to save wallet compensation transaction +wallet.tx.batch.empty=Wallet batch transaction details cannot be empty +wallet.tx.batch.incomplete=Wallet batch transaction details are incomplete +wallet.tx.batch.non.force.only=Wallet batch transactions support non-overdraft payment only +wallet.tx.batch.dup.biz=Do not resubmit the same wallet business ID +wallet.tx.processing=Wallet order transaction in progress; please retry later +wallet.tx.lock.interrupted=Wallet order transaction wait interrupted; please retry later +wallet.tx.tx.state.bad=Wallet batch transaction state invalid; please retry later +wallet.tx.not.found=Wallet transaction not found or deleted +wallet.reset.balance.fail=Failed to reset balance +wallet.proxy.refund.not.paid=Proxy recharge not credited; refund not allowed +wallet.proxy.pay.status.fail=Failed to update proxy recharge credit status +wallet.proxy.refund.status.fail=Failed to update proxy recharge refund status +wallet.card.no.user=This meal card is not bound to a user +after.sale.refund.only=Only refund-only is supported +after.sale.pending.dup=A pending refund already exists +after.sale.partial.continue.unsupported=Partial refund continue is unsupported; please upgrade +after.sale.amount.exceed=Refund exceeds remaining refundable amount +after.sale.pay.amount.invalid=Order paid amount is invalid +after.sale.not.found=After-sale order not found +after.sale.order.not.found=After-sale order not found +after.sale.payer.only=Only the payer can request a refund +after.sale.app.mch.scope=App merchant can only review canteen reservations +after.sale.cancel.status.invalid=Cancel failed; after-sale is not pending review +after.sale.amount.gt.zero=Refund amount must be greater than 0 +after.sale.amount.gt.pay=Refund total exceeds paid amount +after.sale.wallet.refund.fail=Wallet refund failed +after.sale.wx.refund.fail=WeChat refund failed +after.sale.wx.refund.fail.msg=WeChat refund failed: {0} +after.sale.ali.refund.fail=Alipay refund failed +after.sale.ali.refund.fail.msg=Alipay refund failed: {0} +after.sale.unsupported.type=Unsupported refund type +after.sale.wallet.clawback.fail=Failed to claw back wallet refund +after.sale.order.fully.refunded=Order fully refunded +after.sale.product.list.empty=After-sale product list cannot be empty +after.sale.order.cart.missing=Order cart not found +after.sale.refund.product.empty=Refund product cannot be empty +after.sale.refund.product.missing=Refund product <{0}> not found +after.sale.refund.qty.empty=Refund qty for <{0}> is required +after.sale.refund.qty.negative=Refund qty for <{0}> cannot be negative +after.sale.refund.qty.invalid=Refund qty for <{0}> is invalid +after.sale.hist.qty.invalid=Historical refund qty is invalid +after.sale.order.qty.invalid=Order product qty is invalid +after.sale.refund.qty.bad=Refund product qty is invalid +after.sale.refund.qty.exceed=Refund qty for <{0}> exceeds limit +after.sale.order.type.no.refund=Order type does not support refund +after.sale.order.status.no.refund=Order status does not support refund +after.sale.refund.time.exceeded=Order is over 4 hours old; refund not allowed +after.sale.auto.refund.lock=Auto refund in progress; manual cancel/review blocked +after.sale.dup.product=Cannot submit the same product twice +after.sale.product.not.in.order=Refund product not in this order +after.sale.weighted.no.partial=Weighted items do not support per-unit online refund +after.sale.refund.qty.out.range=Refund qty for <{0}> exceeds refundable range +after.sale.refund.amount.invalid=Refund amount for <{0}> is invalid +after.sale.select.product=Please select products to refund +after.sale.order.product.bad=Order product data is invalid +after.sale.order.amount.snapshot.bad=Order amount snapshot is invalid +after.sale.alloc.weight.bad=Refund allocation weight is invalid +after.sale.processing=Refund is processing; try again later +after.sale.approve.status.invalid=Approve failed; not in review status +after.sale.pending.handle.first=Handle pending refund before new refund +after.sale.hist.detail.incomplete=Historical refund details incomplete; check in admin +after.sale.order.type.error=Invalid order type +after.sale.refund.list.empty=Refund product list cannot be empty +after.sale.device.order.missing=Device order not found +hard.cart.not.owned=Cart not found or not owned by current user +hard.cart.no.view=Cart not found or no permission to view +hard.cart.status.changed=Cart status changed; please reselect items +hard.cart.amount.invalid=Cart amount is invalid +hard.cart.product.bad=Cart product data invalid; please reselect +hard.cart.product.not.in.mch=Cart product missing or not in this merchant +hard.required.dish.missing=Required dish not selected +hard.user.address.missing=User address not found +hard.pickup.point.missing=Pickup point not found +hard.mch.not.cooperate=Merchant is not a partner +hard.app.pay.fail=Failed to start app payment +hard.wallet.deduct.fail=Wallet deduction failed +hard.unverified.self=You have {0} unverified reservation(s); verify first +hard.unverified.diner=Diner has {0} unverified reservation(s); verify first +hard.unverified.diner.limit=Diner has {0} unverified reservation(s); would exceed 200 limit +hard.batch.wallet.only=Batch ordering currently supports wallet only +hard.multi.diner.canteen.only=Multi-diner ordering is canteen-only +hard.cart.already.ordered=Cart already ordered; do not resubmit +hard.cart.already.ordered2=Cart already ordered; do not resubmit +hard.cart.not.canteen=Cart merchant is not a canteen +hard.diner.not.found=Diner not found +hard.create.reserve.fail=Failed to create reservation order +hard.reserve.tx.bad=Reservation transaction abnormal; retry later +hard.reserve.group.empty=Reservation group cannot be empty +hard.cart.dup.submit=Do not resubmit the same cart +hard.reserve.processing=Reservation is processing; do not resubmit +hard.daily.menu.canteen.only=Daily menu orders are canteen-only +hard.not.daily.menu.scene=Cart is not daily-menu; please pay again +hard.batch.same.mch=Batch order must be same merchant +hard.dup.date.meal=Do not resubmit same date and meal slot +hard.daily.menu.mode.off=Daily menu mode is not enabled +hard.reserve.amount.bad=Reservation amount is invalid +hard.diner.card.query.fail=Failed to query diner meal card; retry later +hard.diner.query.fail=Failed to query diner +hard.diner.card.data.bad=Diner meal card data invalid; contact admin +hard.diner.card.dup={0} has duplicate meal cards; contact admin +hard.diner.no.card={0} has no meal card +hard.diner.card.owner.bad={0} meal card ownership invalid; contact admin +hard.diner.balance.low={0} meal card balance insufficient +hard.daily.menu.product.bad=Daily menu product missing/off-shelf/wrong merchant +hard.product.price.bad={0} price invalid; contact merchant +hard.product.mode.bad={0} product mode invalid; contact merchant +hard.product.price.changed={0} price changed; reselect dishes +hard.product.stock.low={0} is out of stock +hard.one.item.per.slot=Only one item per date/slot for this merchant +hard.diner.empty=Diner is required +hard.diner.dup=Do not select the same diner twice +hard.diner.invalid=Invalid or unauthorized diner +hard.guardian.reserve.off=Guardian ordering is not enabled +hard.diner.identity.invalid=Diner identity not allowed for this merchant +hard.diner.slot.once=Same diner/date/slot can reserve once only +hard.appt.processing=Reservation processing; do not resubmit +hard.appt.tx.bad=Reservation transaction abnormal; retry later +hard.diner.card.mismatch=Diner and meal card ownership mismatch +hard.stock.deduct.fail=Insufficient stock or deduct failed +hard.stock.restore.fail=Failed to restore stock +hard.daily.stock.deduct.fail=Daily menu stock insufficient or deduct failed +hard.daily.stock.restore.fail=Failed to restore daily menu stock +hard.copy.cart.fail=Failed to copy reservation cart +hard.copy.product.fail=Failed to copy reservation products +hard.wallet.tx.bad=Reservation wallet transaction data invalid +hard.update.pay.status.fail=Failed to update reservation pay status +hard.update.cart.status.fail=Failed to update reservation cart status +hard.mch.no.resp=No response querying merchant +hard.diner.card.no.resp=No response querying diner meal card +hard.daily.product.no.resp=No response querying daily menu products +hard.daily.product.query.fail=Failed to query daily menu products +hard.diner.identity.no.resp=No response querying diner identity +hard.diner.identity.query.fail=Failed to query diner identity +hard.daily.menu.batch.bad=Daily menu order batch data invalid +hard.reserve.batch.bad=Reservation order batch data invalid +hard.wallet.batch.deduct.bad=Wallet batch deduction result invalid +hard.appt.cycle.rule.required=Cycle reservation rule required +hard.appt.cycle.not.allowed=Merchant uses dynamic time window; cycle rule not allowed +hard.appt.date.meal.required=Select reservation date and meal slot for cycle booking +hard.appt.cycle.open.at=Opens on {0} at {1} +hard.wallet.batch.deduct.no.resp=No response for wallet batch deduct +hard.wallet.batch.comp.no.resp=No response for wallet batch compensate +hard.stock.no.resp=No response querying product stock +hard.appt.slot.missing=Reservation slot not found +hard.appt.slot.mch.mismatch=Reservation slot does not match merchant +hard.appt.slot.disabled=Reservation slot disabled +hard.appt.slot.mode.mismatch=Reservation slot mismatches merchant mode +hard.appt.date.out.range=Reservation date out of range +hard.appt.date.no.slot=This date has no such reservation slot +hard.appt.date.type.invalid=Invalid reservation date type +hard.appt.dynamic.slot.empty=Dynamic reservation slot required +hard.appt.period.closed=Current reservation period closed +hard.appt.not.open=Reservation not open yet +hard.appt.closed=Reservation closed +hard.appt.rule.mode.invalid=Invalid reservation rule mode +hard.appt.rule.incomplete=Reservation rule incomplete +hard.appt.rule.time.invalid=Reservation rule time range invalid +hard.appt.cycle.missing=Cycle rule missing or disabled +hard.appt.mch.conf.fail=Failed to load merchant reservation config +hard.appt.mch.mode.invalid=Invalid merchant reservation time mode +hard.delivery.type.invalid=Invalid delivery time type +hard.schedule.need.slot=Scheduled delivery requires date and slot +hard.schedule.end.after.start=Slot end must be after start +hard.mch.job.time.missing=Merchant business hours not configured +hard.eta.out.of.hours=ETA outside business hours; reselect +hard.no.schedule.without.hours=No business hours; scheduled delivery unavailable +hard.job.time.format.bad=Invalid jobTime format; fix in admin +hard.slot.out.of.hours=Slot outside business hours; reselect +hard.qr.already.verified=QR code already verified +hard.verify.diner.only=Only the diner can use the verification code +hard.not.canteen.reserve=Not a canteen reservation order +hard.no.mch.verify.perm=No merchant verification permission +hard.no.mch.order.manage=No permission to manage this merchant's orders +hard.reserve.not.verifiable=Reservation cannot be verified now +hard.reserve.refunding.no.verify=Reservation is refunding; cannot verify +hard.reserve.full.refund.no.verify=Reservation fully refunded; cannot verify +hard.verify.status.changed=Order status changed; verify failed +hard.restore.code.no.resp=No response restoring verification code +hard.restore.code.fail=Failed to restore verification code +hard.rollback.online.only=Only online reservations support verify rollback +hard.rollback.biz.unsupported=Business type does not support verify rollback +hard.rollback.verified.only=Only verified orders support rollback +hard.rollback.refunding=Refunding; cannot rollback verification +hard.rollback.full.refund=Fully refunded; cannot rollback verification +hard.rollback.status.changed=Order status changed; rollback failed +hard.act.ended=Verify failed; activity ended +hard.act.not.started=Verify failed; activity not started +hard.act.coupon.used=Verify failed; coupon already used +hard.act.location.error=Verify failed; location error +hard.act.verify.fail=Verification failed +hard.act.qr.bad=Invalid verification QR code +hard.act.device.no.perm=Device cannot verify this activity order +hard.act.user.no.perm=User has no verify permission for activity +hard.act.verify.user.missing=Verify user not found +hard.act.coupon.user.missing=Coupon user not found +hard.order.expired.rescan=Order expired; scan again +hard.not.device.scan.pay=Not a device scan-pay order +hard.not.device.scan=Not a device scan order +hard.order.paid.or.changed=Order paid or status changed +hard.pay.amount.zero=Payment amount is 0 +hard.user.no.wallet=User does not have this wallet +hard.wallet.user.missing=Wallet user not found +hard.shipment.no.missing=Tracking number not found +hard.order.type.no.receipt=Order type does not support confirm receipt +hard.order.status.no.receipt=Order status does not support confirm receipt +hard.order.type.error=Invalid order type +hard.order.status.error=Invalid order status +hard.idem.create=Creating order; do not repeat +hard.idem.verify=Verifying; do not repeat +hard.idem.rollback=Rolling back verification; do not repeat +hard.car.group.empty=Cart group cannot be empty +hard.car.biz.incomplete=Cart business info incomplete +hard.car.batch.same.user.mch=Batch cart must share user/merchant/type +hard.car.save.fail=Failed to save cart products +common.idempotent.retry=Duplicate request. Please try again later +auth.captcha.empty=Verification code is required +auth.captcha.invalid=Invalid verification code +auth.wx.auth.fail=WeChat authorization failed: {0} +auth.wx.openid.missing=WeChat authorization failed; user identifier not received +auth.wx.auth.expired=WeChat authorization expired; please authorize again +auth.apple.not.configured=Apple login is not configured +auth.apple.not.enabled=Apple login is not enabled +auth.mini.app.login.fail=WeChat mini program login failed +auth.social.auth.expired=Authorization expired; please authorize again +sys.app.sms.send.fail=Failed to send SMS code; please try again later +sys.app.sms.code.invalid=SMS code is invalid or expired +sys.user.password.same=New password must differ from old password +sys.user.unbind.type.invalid=Unbind account type does not exist +third.recharge.biz.id.invalid=Invalid recharge business ID +third.proxy.recharge.biz.id.invalid=Invalid proxy recharge business ID +third.proxy.recharge.invalid=Proxy recharge record missing or amount invalid +third.ward.wallet.no.recharge=Target meal card cannot be recharged now +third.pay.amount.gt.zero=Payment amount must be greater than 0 +third.wechat.pay.create.fail=Failed to create WeChat payment +third.alipay.pay.create.fail=Failed to create Alipay payment +third.user.no.mch=User does not belong to any canteen or shop +third.user.no.canteen=User does not belong to any canteen +third.shop.pay.mch.missing=Shop payment missing trusted merchant info +third.shop.order.biz.id.invalid=Invalid shop order business ID +third.shop.order.no.pay=Shop order not found or not payable +third.shop.order.amount.mismatch=Shop order payment amount mismatch +third.shop.order.mch.mismatch=Shop order merchant mismatch +third.mch.pay.disabled=Receiving merchant is disabled +third.mch.wechat.pay.config.missing=Merchant WeChat pay config is missing +third.mch.alipay.pay.config.missing=Merchant Alipay pay config is missing +third.order.code.processing=Order code payment in progress; do not resubmit +third.pay.no.empty=Payment order number is required +third.order.code.not.found=Order code payment order not found +third.order.already.paid=Business order already paid; do not reorder +third.order.code.other.platform=Pending order code exists on another platform +third.order.code.data.error=Order code data error; please retry later +third.order.closing=Previous order is closing; please retry later +third.order.code.param.empty=Order code payment parameters are required +third.order.code.biz.only=Order code payment supports cloud POS only +third.order.code.platform.only=Order code payment supports Alipay or WeChat only +third.pay.biz.id.empty=Payment business ID is required +third.order.pending.mismatch=Pending order has different amount or merchant +third.mch.info.mismatch=Receiving merchant info mismatch +third.mch.alipay.config.disabled=Merchant Alipay pay config is disabled +third.mch.wechat.config.disabled=Merchant WeChat pay config is disabled +third.alipay.app.config.incomplete=Alipay app pay config is incomplete +third.wechat.app.config.incomplete=WeChat service provider pay config is incomplete +third.refund.processing=Previous refund is still processing; please retry later +third.wx.oauth.incomplete=WeChat OAuth parameters are incomplete +third.wx.oauth.fail=WeChat OAuth failed; please scan again +third.fz.relation.unavailable=Payment revenue-sharing service unavailable +third.wx.jsapi.create.fail=Failed to create WeChat JSAPI order; please scan again +third.aggregate.sub.order.save.fail=Failed to save aggregate sub-order +third.mch.wechat.config.incomplete=Merchant WeChat pay config is incomplete +third.mch.wechat.sub.mch.missing=Merchant WeChat sub-merchant ID is missing +third.pay.order.snapshot.missing=Payment order missing merchant config snapshot +third.pay.order.snapshot.invalid=Payment order merchant config snapshot invalid +third.alipay.auth.code.empty=Alipay authorization code is required +third.alipay.oauth.fail=Alipay OAuth failed; please scan again +third.alipay.oauth.no.payer=Alipay OAuth did not return payer identifier +third.alipay.jsapi.create.fail=Failed to create Alipay order; please scan again +third.alipay.client.init.fail=Failed to initialize Alipay client +third.mch.alipay.config.incomplete=Merchant Alipay pay config is incomplete +third.mch.alipay.sub.mch.missing=Merchant Alipay sub-merchant ID is missing +third.wx.native.create.fail=Failed to create WeChat order code; please retry later +third.wx.native.create.fail.code=Failed to create WeChat order code; WeChat error: {0} +third.wx.native.no.qr=Failed to create WeChat order code; QR not returned + +app.msg.title.wallet.payment=Order placed, wallet charged +app.msg.title.wallet.refund=Refund credited +app.msg.title.wallet.recharge=Top-up credited +app.msg.title.wallet.reset=Wallet balance reset +app.msg.title.meal.verified=Meal verified +app.msg.event.wallet.update=Balance update +app.msg.event.wallet.batch=Batch balance update +app.msg.event.wallet.recharge=Top-up +app.msg.event.wallet.payment=Payment +app.msg.event.wallet.refund=Refund +app.msg.event.wallet.transfer=Wallet transfer +app.msg.event.wallet.transfer.refund=Transfer refund +app.msg.event.wallet.return.canteen=Return to canteen +app.msg.event.wallet.reset=Balance reset +app.msg.event.meal.verified=Meal verification +app.msg.wallet.default.name=Wallet +app.msg.wallet.detail.inc={0} increased by {1}, balance {2} +app.msg.wallet.detail.dec={0} decreased by {1}, balance {2} +app.msg.wallet.detail.sep=; +app.msg.wallet.content={0}: {1} +app.msg.meal.default.name=This reserved meal +app.msg.meal.content={0} has been verified. Enjoy your meal. +app.msg.ward.fallback=Ward +app.msg.relation.title={0}'s {1} +app.msg.relation.content={0}: {1} + +common.product.sku.not.found=Product SKU not found +common.mch.service.error=Merchant service error +mall.user.no.farmer.mch=No mall merchant assigned to this user +mall.no.product.perm=No permission for this product +mall.category.not.found=Category not found +mall.no.category.perm=No permission for this category +address.id.empty=Address ID is required +address.not.found=Address not found +address.dept.building.required=Department and building are required +address.unit.required=Unit is required +address.room.required=Room is required +address.dept.not.found=Department not found +address.building.not.found=Building not found +address.building.dept.mismatch=Selected building does not belong to this department +address.unit.not.found=Unit not found +address.unit.building.mismatch=Selected unit does not belong to this building +address.room.not.found=Room not found +address.room.unit.mismatch=Selected room does not belong to this unit/building +address.room.no.empty=Room number is required +address.building.no.access=No access to this building +address.unit.no.access=No access to this unit +address.record.update.missing=Address not found, cannot update +address.record.delete.missing=Address not found, cannot delete + +hard.car.group.item.empty=Cart group {0} cannot be empty +hard.car.group.item.incomplete=Cart group {0} has incomplete items or invalid quantity +hard.car.group.parent.fail=Failed to create parent cart for group {0} +hard.car.group.item.invalid=Cart group {0} contains invalid products +mall.product.sku.missing=Mall product has no SKU. name:{0}, id:{1}. Contact admin + +canteen.stock.items.empty=Stock items cannot be empty +canteen.stock.item.param.bad=Invalid stock item parameters +canteen.stock.biz.param.bad=Invalid stock business parameters +canteen.stock.item.dup=Duplicate stock items are not allowed +canteen.stock.spu.bad=Product not found or stock abnormal +canteen.stock.snapshot.bad=Invalid stock snapshot +canteen.stock.changed={0} stock changed, please retry +canteen.stock.compensate.fail=Stock compensation failed, please retry +canteen.stock.update.fail=Stock update failed, please retry +canteen.stock.tx.state.bad=Stock transaction state abnormal, please retry later +canteen.stock.insufficient=Insufficient stock +canteen.no.product.perm=No permission for this product +canteen.no.product.perm.named=No permission for product: {0} +canteen.shelf.status.invalid=Invalid status; only 0 (on) and 1 (off) are allowed + +hard.stock.tx.state.bad=Stock transaction state abnormal, please retry later +hard.canteen.stock.aftersale.missing=Canteen stock refund requires after-sale ID +hard.canteen.stock.car.missing=Canteen stock operation failed: cart not found +hard.canteen.stock.refund.item.missing=Canteen stock operation failed: refund item not found +hard.canteen.stock.no.resp=No response when querying canteen stock +hard.canteen.stock.query.fail=Failed to query canteen stock +hard.canteen.spu.bad=Canteen dish not found or not in this merchant +hard.canteen.stock.op.fail=Canteen stock service operation failed +hard.door.stock.fail=Smart locker stock {0} failed +hard.stock.deduct.cart.missing=Stock deduct failed: cart not found +hard.stock.op.fail={0} failed + +wallet.transfer.source.low=Insufficient balance in source wallet {0} +wallet.transfer.limit.exceeded=Transfer amount exceeds maximum limit +wallet.transfer.not.found=Transfer record not found +wallet.transfer.refund.dup=Already refunded; do not repeat +wallet.transfer.refund.source.low=Insufficient balance in source wallet {0}; cannot refund +wallet.apply.dup.submit=Application already submitted; do not repeat +act.cancel.not.found=Redemption activity not found +act.cancel.closed=Redemption activity is closed +act.cancel.mch.missing=Redemption activity merchant not found +act.cancel.already.received=Already claimed; do not repeat +act.cancel.balance.low=Insufficient consume-wallet balance ({0}); cannot claim +act.cancel.coupon.expired=Your coupon has expired +act.coupon.not.found=Coupon not found +act.not.found=Activity not found +act.coupon.points.deduct.fail=Points deduction failed +act.id.empty=Activity ID is required + +sys.face.max.count=You can upload at most 3 face images +sys.face.max.active=At most 3 faces in pending/approved status can be kept +sys.face.dup.image=Do not resubmit the same face image +sys.face.dept.missing=Your department is missing; cannot start face review +sys.face.ward.only=You can only view or manage your own and valid wards' face records +sys.face.record.missing=Face review record not found +sys.face.revoke.status=Only pending face records can be revoked +sys.face.status.changed=Face review status changed; please refresh +sys.car.plate.dup=License plate already exists + +hard.idem.applying=Application in progress; do not repeat +hard.idem.canceling=Cancellation in progress; do not repeat +hard.idem.processing=Processing; do not repeat +hard.idem.refunding=Refund in progress; do not repeat +hard.idem.batch.refund=Batch refund is being submitted; do not repeat +act.idem.receiving=Claim in progress; do not repeat +wallet.idem.applying=Application in progress; do not repeat +wallet.idem.opening=Card opening in progress; do not repeat +wallet.idem.processing=Processing; do not repeat +wallet.idem.importing=Import in progress; do not repeat +wallet.idem.recharging=Top-up in progress; do not repeat +wallet.idem.uploading=Upload in progress; do not repeat +wallet.idem.invoice=Regenerating invoice; do not repeat + +mall.product.create.fail=Failed to create product +mall.product.id.empty=Product ID is required +mall.product.update.fail=Failed to update product +mall.product.list.fail=Failed to load product list +mall.product.delete.fail=Failed to delete product +mall.category.create.fail=Failed to create category +mall.category.id.empty=Category ID is required +mall.category.update.fail=Failed to update category +mall.category.delete.fail=Failed to delete category +mall.category.list.fail=Failed to load category list + +third.wx.profit.amount.min=WeChat profit-sharing amount must be greater than 10 fen +third.wx.profit.amount.range=WeChat platform fee must be at least 1 fen and not exceed order amount +third.pay.config.missing=Payment config not found +third.wx.refund.amount.bad=WeChat refund amount must be > 0 and not exceed order amount +third.pay.order.status.no.refund=Current payment order status does not allow refund +third.ali.qr.create.fail=Failed to create Alipay QR code; please retry later +third.ali.amount.invalid=Alipay amount must be greater than 0 fen +third.ali.zt.amount.min=Alipay ZFT amount must be greater than 10 fen +third.wx.refund.apply.error=WeChat refund application error +third.wx.refund.queued=WeChat refund entered compensation queue; check later +third.ali.refund.amount.bad=Alipay refund amount must be > 0 and not exceed order amount +sys.register.suspended=Registration is temporarily suspended. diff --git a/pjcloud-common/pjcloud-common-core/src/main/resources/i18n/messages_zh_CN.properties b/pjcloud-common/pjcloud-common-core/src/main/resources/i18n/messages_zh_CN.properties index ddc14f93..9f1c975f 100644 --- a/pjcloud-common/pjcloud-common-core/src/main/resources/i18n/messages_zh_CN.properties +++ b/pjcloud-common/pjcloud-common-core/src/main/resources/i18n/messages_zh_CN.properties @@ -37,3 +37,535 @@ sys.user.password.new.empty=新密码不能为空 sys.user.password.length=密码长度需为6-20位 sys.user.password.chars.only=密码只能包含字母和数字 sys.user.password.letter.digit=密码需同时包含字母和数字 +common.not.login=未登录 +common.record.not.found=记录不存在 +common.mch.not.found=商户不存在 +common.user.dept.missing=用户部门不存在 +ordering.food.mch.disabled=该商户未启用报餐 +ordering.food.job.time.missing.for.segment=商户未配置营业时间,无法获取餐段 +ordering.food.job.time.missing=商户未配置营业时间 +ordering.food.select.date.segment=请选择报餐日期与餐段 +ordering.food.select.dish=请选择报餐菜品 +ordering.food.fill.person.count=请填写报餐人数 +ordering.food.cancel.status.invalid=当前状态不可取消 +ordering.food.select.valid.mch=请选择有效商户 +ordering.food.no.mch.view.perm=无权查看该商户数据 +ordering.food.select.date=请选择日期 +ordering.food.user.dept.missing=用户部门不存在 +ordering.food.select.canteen.mch=请选择食堂商户 +ordering.food.stats.range.too.large=查询日期范围最多一个月({0}天) +ordering.food.user.info.missing=用户信息不存在 +ordering.food.no.stats.perm=无权访问报餐统计 +ordering.food.date.segment.incomplete=报餐日期或餐段不完整 +ordering.food.future.days.limit=仅支持报餐未来{0}天内 +ordering.food.segment.invalid=餐段无效,请刷新后重试 +ordering.food.duplicate.date.segment=存在重复的日期餐段选择 +ordering.food.dish.info.incomplete=报餐菜品信息不完整 +ordering.food.select.dish.for.segment=请为「{0}」选择菜品 +ordering.food.dish.segment.invalid=菜品餐段无效 +common.order.not.found=订单不存在 +common.cart.not.found=购物车不存在 +common.wallet.not.found=用户钱包不存在 +common.wallet.balance.insufficient=钱包余额不足 +common.product.not.found=商品不存在 +common.product.stock.low=库存不足 +common.user.not.exist=用户不存在 +common.user.not.exist.dup=用户不存在不存在 +common.unsupported.pay.type=不支持的支付方式 +common.mch.id.empty=商户ID不能为空 +common.past.date.not.allowed=不能选择过去的日期 +common.date.format.ymd=日期格式应为 yyyy-MM-dd +common.date.range.required=开始日期与结束日期不能为空 +common.date.range.invalid=结束日期不能早于开始日期 +common.month.format.ym=月份格式应为 yyyy-MM +delivery.order.no.view=订单不存在或无权查看 +delivery.order.no.operate=订单不存在或无权操作 +delivery.accept.first=请先接单 +delivery.accept.status.invalid=当前状态不可接单 +delivery.already.accepted=订单已接单 +delivery.pickup.photo.status.invalid=当前状态不可上传取餐照 +delivery.deliver.photo.status.invalid=当前状态不可上传送达照 +delivery.sync.hardware.fail=同步硬件外卖订单状态失败: {0} +delivery.no.response=无响应 +delivery.order.already.synced=订单已同步过 +delivery.cart.serialize.fail=购物车序列化失败 +delivery.order.no.empty=订单号不能为空 +delivery.rider.push.title=新配送任务 +delivery.rider.push.body=您有一单新的食堂外送,请及时处理 +delivery.mch.push.title=新外送订单 +delivery.mch.push.body=您有一单新的食堂外送订单,请及时处理 +delivery.mch.schedule.title=预约外送提醒 +delivery.mch.schedule.body=您有一单预约外送即将进入备餐时段,请及时查看 +delivery.rider.building.bound=该单位下楼栋已绑定骑手,请先解绑 +wallet.type.id.empty=钱包类型id不能为空 +wallet.remark.empty=备注不能为空 +wallet.not.found=钱包不存在 +wallet.freeze.dup=已提交申请,请勿重复提交 +wallet.card.not.found=卡号不存在 +wallet.card.already.bound=该卡号已经绑定用户 +wallet.meal.card.not.found=饭卡钱包不存在 +wallet.user.already.bound=用户已绑定饭卡 +wallet.qr.gen.fail=钱包二维码生成错误 +wallet.relation.query.fail=查询关系人信息失败 +wallet.user.relation.fail=查询用户关系失败 +wallet.face.query.fail=查询用户人脸情况失败 +wallet.pending.appt.fail=查询用户待核销预约失败 +wallet.package.amount.invalid=充值套餐金额无效 +wallet.target.card.missing=目标饭卡不存在 +wallet.no.ward.perm=无权操作该被监护人 +wallet.ward.query.fail=查询被监护人信息失败 +wallet.ward.not.found=被监护人不存在 +wallet.identity.query.fail=查询充值用户身份失败 +wallet.canteen.missing=钱包所属食堂不存在 +wallet.identity.no.recharge=当前人员身份不支持钱包充值 +wallet.card.canteen.missing=饭卡所属食堂不存在 +wallet.pay.method.missing=饭卡所属食堂暂未配置支付方式 +wallet.proxy.record.missing=代充值记录不存在 +wallet.guardian.relation.fail=查询监护关系失败 +wallet.package.not.found=钱包充值套餐不存在 +wallet.package.disabled=钱包充值套餐已禁用 +wallet.meal.card.not.open=未开通饭卡 +wallet.meal.card.frozen=饭卡已冻结 +wallet.card.status.no.recharge={0},暂不可充值 +wallet.target.user.missing=缺少目标用户信息 +wallet.no.ward.tx.perm=无权查看该被监护人的钱包流水 +wallet.tx.deduct.amount.mismatch=重复业务扣款金额不一致 +wallet.tx.credit.amount.mismatch=重复业务入账金额不一致 +wallet.tx.refund.amount.mismatch=重复业务退款金额不一致 +wallet.tx.payment.amount.mismatch=支付流水金额与补偿金额不一致 +wallet.order.payment.cancelled=订单支付已经取消,不能继续扣款 +wallet.order.payment.compensated=订单支付已经补偿,不能重复扣款 +wallet.tx.compensate.fail=钱包补偿失败 +wallet.tx.batch.compensate.fail=钱包批量补偿失败 +wallet.tx.payment.save.fail=保存钱包支付流水失败 +wallet.tx.refund.save.fail=保存钱包补偿流水失败 +wallet.tx.batch.empty=钱包批量交易明细不能为空 +wallet.tx.batch.incomplete=钱包批量交易明细不完整 +wallet.tx.batch.non.force.only=钱包批量交易仅支持非透支支付 +wallet.tx.batch.dup.biz=请勿重复提交同一钱包业务号 +wallet.tx.processing=订单钱包交易正在处理中,请稍后重试 +wallet.tx.lock.interrupted=订单钱包交易等待已中断,请稍后重试 +wallet.tx.tx.state.bad=钱包批量交易事务状态异常,请稍后重试 +wallet.tx.not.found=钱包流水不存在或已删除 +wallet.reset.balance.fail=重置余额失败 +wallet.proxy.refund.not.paid=代充值尚未到账,不能退款 +wallet.proxy.pay.status.fail=更新代充值到账状态失败 +wallet.proxy.refund.status.fail=更新代充值退款状态失败 +wallet.card.no.user=该饭卡没有绑定用户 +after.sale.refund.only=当前仅支持仅退款 +after.sale.pending.dup=当前订单已有退款申请待审核,请勿重复提交 +after.sale.partial.continue.unsupported=当前版本不支持部分退款后的继续申请,请升级应用后重试 +after.sale.amount.exceed=本次退款金额超出订单剩余可退金额 +after.sale.pay.amount.invalid=订单实付金额异常 +after.sale.not.found=售后单不存在 +after.sale.order.not.found=售后订单不存在 +after.sale.payer.only=仅订单付款人可以申请退款 +after.sale.app.mch.scope=当前 App 商户仅支持审核食堂预约订单 +after.sale.cancel.status.invalid=取消售后单失败,售后单状态不是【待审核】 +after.sale.amount.gt.zero=退款金额必须大于0 +after.sale.amount.gt.pay=退款总金额大于支付总金额 +after.sale.wallet.refund.fail=钱包退款错误 +after.sale.wx.refund.fail=微信退款错误 +after.sale.wx.refund.fail.msg=微信退款错误:{0} +after.sale.ali.refund.fail=支付宝退款错误 +after.sale.ali.refund.fail.msg=支付宝退款错误:{0} +after.sale.unsupported.type=不支持的退款类型 +after.sale.wallet.clawback.fail=钱包退款金额扣回失败 +after.sale.order.fully.refunded=订单已全部退款 +after.sale.product.list.empty=售后商品列表不能为空 +after.sale.order.cart.missing=订单购物车不存在 +after.sale.refund.product.empty=退款商品不能为空 +after.sale.refund.product.missing=退款商品<{0}>不存在 +after.sale.refund.qty.empty=退款商品<{0}>数量不能为空 +after.sale.refund.qty.negative=退款商品<{0}>数量不能为负数 +after.sale.refund.qty.invalid=退款商品<{0}>数量异常 +after.sale.hist.qty.invalid=历史退款商品数量异常 +after.sale.order.qty.invalid=订单商品数量异常 +after.sale.refund.qty.bad=退款商品数量异常 +after.sale.refund.qty.exceed=退款商品<{0}>数量超出 +after.sale.order.type.no.refund=该订单类型不支持退款 +after.sale.order.status.no.refund=当前订单状态不支持退款 +after.sale.refund.time.exceeded=订单已超过4个小时,不能退款 +after.sale.auto.refund.lock=自动退款处理中,当前售后单不允许人工取消或审核 +after.sale.dup.product=同一商品不能重复提交 +after.sale.product.not.in.order=退款商品不属于当前订单 +after.sale.weighted.no.partial=称重商品暂不支持在线逐份退款 +after.sale.refund.qty.out.range=退款商品<{0}>数量超出可退范围 +after.sale.refund.amount.invalid=退款商品<{0}>退款金额异常 +after.sale.select.product=请选择需要退款的商品 +after.sale.order.product.bad=订单商品数据异常 +after.sale.order.amount.snapshot.bad=订单商品金额快照异常 +after.sale.alloc.weight.bad=退款分摊权重异常 +after.sale.processing=订单退款正在处理中,请稍后重试 +after.sale.approve.status.invalid=审批失败,售后状态不处于审批中 +after.sale.pending.handle.first=当前订单已有退款申请待审核,请先处理后再退款 +after.sale.hist.detail.incomplete=历史退款商品明细不完整,请通过后台核对后处理 +after.sale.order.type.error=订单类型错误 +after.sale.refund.list.empty=退款商品列表不能为空 +after.sale.device.order.missing=设备订单不存在 +hard.cart.not.owned=购物车不存在或不属于当前用户 +hard.cart.no.view=购物车不存在或无权查看 +hard.cart.status.changed=购物车状态已变更,请重新选择商品 +hard.cart.amount.invalid=购物车金额异常 +hard.cart.product.bad=购物车商品数据异常,请重新选择商品 +hard.cart.product.not.in.mch=购物车商品不存在或不属于当前商户 +hard.required.dish.missing=未选择必选菜品 +hard.user.address.missing=用户地址不存在 +hard.pickup.point.missing=查询自提点不存在 +hard.mch.not.cooperate=该商家未合作 +hard.app.pay.fail=发起app支付失败 +hard.wallet.deduct.fail=钱包扣款错误 +hard.unverified.self=您有{0}笔未核销的预约订单,请先核销 +hard.unverified.diner=用餐人已有{0}笔未核销的预约订单,请先核销 +hard.unverified.diner.limit=用餐人已有{0}笔未核销的预约订单,本次订餐后将超过200笔上限 +hard.batch.wallet.only=批量订餐暂仅支持钱包支付 +hard.multi.diner.canteen.only=仅食堂购物车可以多人订餐 +hard.cart.already.ordered=该购物车已创建订单,请勿重复提交 +hard.cart.already.ordered2=购物车已创建订单,请勿重复提交 +hard.cart.not.canteen=购物车商户不是食堂商户 +hard.diner.not.found=用餐人不存在 +hard.create.reserve.fail=创建订餐订单失败 +hard.reserve.tx.bad=订餐事务状态异常,请稍后重试 +hard.reserve.group.empty=订餐分组不能为空 +hard.cart.dup.submit=请勿重复提交同一购物车 +hard.reserve.processing=订餐订单正在处理中,请勿重复提交 +hard.daily.menu.canteen.only=仅食堂购物车可以提交每日菜谱订单 +hard.not.daily.menu.scene=购物车不是每日菜谱场景,请重新点击去支付 +hard.batch.same.mch=批量订餐必须属于同一商户 +hard.dup.date.meal=请勿重复提交同一天同一餐段 +hard.daily.menu.mode.off=当前商户未开启每日菜谱订餐模式 +hard.reserve.amount.bad=订餐金额异常 +hard.diner.card.query.fail=查询用餐人饭卡失败,请稍后重试 +hard.diner.query.fail=查询用餐人失败 +hard.diner.card.data.bad=用餐人饭卡数据异常,请联系管理员 +hard.diner.card.dup={0}存在重复饭卡数据,请联系管理员 +hard.diner.no.card={0}未开通饭卡 +hard.diner.card.owner.bad={0}的饭卡归属异常,请联系管理员 +hard.diner.balance.low={0}饭卡余额不足 +hard.daily.menu.product.bad=每日菜谱商品不存在、已下架或不属于当前商户 +hard.product.price.bad={0}价格异常,请联系商户 +hard.product.mode.bad={0}商品模式异常,请联系商户 +hard.product.price.changed={0}价格已变化,请重新选择菜品 +hard.product.stock.low={0}库存不足 +hard.one.item.per.slot=该商户每个日期餐段仅允许选择一份商品 +hard.diner.empty=用餐人不能为空 +hard.diner.dup=请勿重复选择用餐人 +hard.diner.invalid=存在无效或无权代订的用餐人 +hard.guardian.reserve.off=当前商户未开启监护关系代订餐 +hard.diner.identity.invalid=存在不符合当前商户可订餐身份的用餐人 +hard.diner.slot.once=同一用餐人同一天同一餐段只能预约一次,请勿重复预约 +hard.appt.processing=预约正在处理中,请勿重复提交 +hard.appt.tx.bad=预约事务状态异常,请稍后重试 +hard.diner.card.mismatch=用餐人与饭卡归属不一致 +hard.stock.deduct.fail=库存不足或扣减失败 +hard.stock.restore.fail=恢复库存失败 +hard.daily.stock.deduct.fail=每日菜谱库存不足或扣减失败 +hard.daily.stock.restore.fail=每日菜谱库存恢复失败 +hard.copy.cart.fail=复制订餐购物车失败 +hard.copy.product.fail=复制订餐商品失败 +hard.wallet.tx.bad=订餐钱包交易数据异常 +hard.update.pay.status.fail=更新订餐订单支付状态失败 +hard.update.cart.status.fail=更新订餐购物车状态失败 +hard.mch.no.resp=查询商户无响应 +hard.diner.card.no.resp=查询用餐人饭卡无响应 +hard.daily.product.no.resp=查询每日菜谱商品无响应 +hard.daily.product.query.fail=查询每日菜谱商品失败 +hard.diner.identity.no.resp=查询用餐人身份无响应 +hard.diner.identity.query.fail=查询用餐人身份失败 +hard.daily.menu.batch.bad=每日菜谱订单批次数据异常 +hard.reserve.batch.bad=订餐订单批次数据异常 +hard.wallet.batch.deduct.bad=钱包批量扣款结果异常 +hard.appt.cycle.rule.required=周期预约规则不能为空 +hard.appt.cycle.not.allowed=当前商户使用动态时间窗,不能提交周期预约规则 +hard.appt.date.meal.required=周期预约需要选择预约日期和餐端 +hard.appt.cycle.open.at=周{0}{1}开放 +hard.wallet.batch.deduct.no.resp=钱包批量扣款无响应 +hard.wallet.batch.comp.no.resp=钱包批量补偿无响应 +hard.stock.no.resp=查询商品库存无响应 +hard.appt.slot.missing=预约餐段不存在 +hard.appt.slot.mch.mismatch=预约餐段与当前商户不匹配 +hard.appt.slot.disabled=预约餐段已停用 +hard.appt.slot.mode.mismatch=预约餐段与商户当前模式不匹配 +hard.appt.date.out.range=该预约日期不在可选范围内 +hard.appt.date.no.slot=该日期未配置此预约餐段 +hard.appt.date.type.invalid=预约日期类型无效 +hard.appt.dynamic.slot.empty=动态预约餐段不能为空 +hard.appt.period.closed=本期预约已截止 +hard.appt.not.open=预约尚未开放 +hard.appt.closed=预约已截止 +hard.appt.rule.mode.invalid=预约规则模式无效 +hard.appt.rule.incomplete=预约规则配置不完整 +hard.appt.rule.time.invalid=预约规则时间范围无效 +hard.appt.cycle.missing=周期预约规则不存在或已停用 +hard.appt.mch.conf.fail=获取商户预约配置失败 +hard.appt.mch.mode.invalid=商户预约时间模式无效 +hard.delivery.type.invalid=配送时间类型无效 +hard.schedule.need.slot=预约配送须选择日期与时段 +hard.schedule.end.after.start=预约时段结束须晚于开始 +hard.mch.job.time.missing=商户未配置营业时间 +hard.eta.out.of.hours=预计送达时间不在商户营业时间内,请重新选择 +hard.no.schedule.without.hours=商户未配置营业时间,暂不可预约配送 +hard.job.time.format.bad=商户营业时间格式无效,请先在后台正确配置 jobTime +hard.slot.out.of.hours=预约时段不在商户营业时间内,请重新选择 +hard.qr.already.verified=该二维码已被核销 +hard.verify.diner.only=仅实际用餐人可以使用预约核销码 +hard.not.canteen.reserve=该订单不是食堂预约订单 +hard.no.mch.verify.perm=当前用户没有商户核销权限 +hard.no.mch.order.manage=无权管理该商户订单 +hard.reserve.not.verifiable=该预约订单当前不可核销 +hard.reserve.refunding.no.verify=该预约订单正在退款,不能核销 +hard.reserve.full.refund.no.verify=该预约订单商品已全部退款,不能核销 +hard.verify.status.changed=订单状态已变化,核销失败 +hard.restore.code.no.resp=恢复预约核销码无响应 +hard.restore.code.fail=恢复预约核销码失败 +hard.rollback.online.only=仅线上预订订单支持退回到核销前 +hard.rollback.biz.unsupported=当前业务类型不支持退回到核销前 +hard.rollback.verified.only=仅已核销订单支持退回到核销前 +hard.rollback.refunding=该预约订单正在退款,不能退回到核销前 +hard.rollback.full.refund=该预约订单商品已全部退款,不能退回到核销前 +hard.rollback.status.changed=订单状态已变化,退回核销状态失败 +hard.act.ended=核销失败,活动已结束 +hard.act.not.started=核销失败,活动未开始 +hard.act.coupon.used=核销失败,您领取的优惠券已核销 +hard.act.location.error=核销失败,位置的错误 +hard.act.verify.fail=核销失败 +hard.act.qr.bad=核销二维码错误 +hard.act.device.no.perm=当前设备不能核销该活动订单 +hard.act.user.no.perm=当前活动,该用户没有核销权限 +hard.act.verify.user.missing=核销用户不存在不存在 +hard.act.coupon.user.missing=领券用户不存在不存在 +hard.order.expired.rescan=订单已失效,请重新扫码 +hard.not.device.scan.pay=该订单不是设备扫码支付订单 +hard.not.device.scan=该订单不是设备扫一扫订单 +hard.order.paid.or.changed=该订单已支付或状态已变更 +hard.pay.amount.zero=支付金额为0元 +hard.user.no.wallet=该用户没有这个钱包 +hard.wallet.user.missing=钱包用户不存在 +hard.shipment.no.missing=快递单号不存在 +hard.order.type.no.receipt=该订单类型不支持确认收货 +hard.order.status.no.receipt=该订单状态不支持确认收货 +hard.order.type.error=订单类型错误 +hard.order.status.error=订单状态错误 +hard.idem.create=正在创建订单中,请勿重复操作 +hard.idem.verify=正在核销中,请勿重复操作 +hard.idem.rollback=正在退回核销状态,请勿重复操作 +hard.car.group.empty=购物车分组不能为空 +hard.car.biz.incomplete=购物车业务信息不完整 +hard.car.batch.same.user.mch=批量购物车必须属于同一用户、商户和业务类型 +hard.car.save.fail=购物车商品保存失败 +common.idempotent.retry=重复请求,请稍后重试 +auth.captcha.empty=验证码不能为空 +auth.captcha.invalid=验证码不合法 +auth.wx.auth.fail=微信授权失败:{0} +auth.wx.openid.missing=微信授权失败,未获取到用户标识 +auth.wx.auth.expired=微信授权已过期,请重新授权 +auth.apple.not.configured=未配置Apple登录 +auth.apple.not.enabled=未启用Apple登录 +auth.mini.app.login.fail=微信小程序登录失败 +auth.social.auth.expired=授权已过期,请重新授权 +sys.app.sms.send.fail=短信验证码发送失败,请稍后重试 +sys.app.sms.code.invalid=短信验证码错误或已过期 +sys.user.password.same=新旧密码不能相同 +sys.user.unbind.type.invalid=解绑账号类型不存在 +third.recharge.biz.id.invalid=充值业务id解析错误 +third.proxy.recharge.biz.id.invalid=代充值业务id解析错误 +third.proxy.recharge.invalid=代充值记录不存在或金额无效 +third.ward.wallet.no.recharge=目标饭卡当前不可充值 +third.pay.amount.gt.zero=支付金额必须大于0 +third.wechat.pay.create.fail=创建微信支付错误 +third.alipay.pay.create.fail=创建支付宝支付错误 +third.user.no.mch=用户不属于任何食堂或者商城 +third.user.no.canteen=用户不属于任何食堂 +third.shop.pay.mch.missing=商城支付缺少可信商户信息 +third.shop.order.biz.id.invalid=商城订单业务id解析错误 +third.shop.order.no.pay=商城订单不存在或无权支付 +third.shop.order.amount.mismatch=商城订单支付金额不一致 +third.shop.order.mch.mismatch=商城订单收款商户不一致 +third.mch.pay.disabled=收款商户已停用 +third.mch.wechat.pay.config.missing=商户未配置微信支付参数 +third.mch.alipay.pay.config.missing=商户未配置支付宝支付参数 +third.order.code.processing=订单码支付正在处理中,请勿重复提交 +third.pay.no.empty=支付订单号不能为空 +third.order.code.not.found=订单码支付订单不存在 +third.order.already.paid=该业务订单已支付,请勿重复下单 +third.order.code.other.platform=该业务订单已有其他平台的待支付订单码 +third.order.code.data.error=订单码数据异常,请稍后重试 +third.order.closing=上一笔订单正在确认关闭,请稍后重试 +third.order.code.param.empty=订单码支付参数不能为空 +third.order.code.biz.only=订单码支付仅支持云消费机支付业务 +third.order.code.platform.only=订单码支付仅支持支付宝或微信 +third.pay.biz.id.empty=支付业务id不能为空 +third.order.pending.mismatch=该业务订单已有不同金额或商户的待支付订单 +third.mch.info.mismatch=收款商户信息不一致 +third.mch.alipay.config.disabled=商户未启用支付宝支付配置 +third.mch.wechat.config.disabled=商户未启用微信支付配置 +third.alipay.app.config.incomplete=支付宝应用支付配置不完整 +third.wechat.app.config.incomplete=微信服务商支付配置不完整 +third.refund.processing=上一笔退款仍在处理中,请稍后重试 +third.wx.oauth.incomplete=微信用户授权参数不完整 +third.wx.oauth.fail=微信用户授权失败,请重新扫码 +third.fz.relation.unavailable=支付平台分佣关系服务不可用 +third.wx.jsapi.create.fail=创建微信支付订单失败,请重新扫码 +third.aggregate.sub.order.save.fail=聚合支付子订单保存失败 +third.mch.wechat.config.incomplete=商户微信支付配置不完整 +third.mch.wechat.sub.mch.missing=商户微信子商户号未配置 +third.pay.order.snapshot.missing=支付订单缺少商户配置快照 +third.pay.order.snapshot.invalid=支付订单商户配置快照无效 +third.alipay.auth.code.empty=支付宝授权码不能为空 +third.alipay.oauth.fail=支付宝用户授权失败,请重新扫码 +third.alipay.oauth.no.payer=支付宝用户授权未返回付款人标识 +third.alipay.jsapi.create.fail=创建支付宝支付订单失败,请重新扫码 +third.alipay.client.init.fail=支付宝客户端初始化失败 +third.mch.alipay.config.incomplete=商户支付宝支付配置不完整 +third.mch.alipay.sub.mch.missing=商户支付宝直付通二级商户标识未配置 +third.wx.native.create.fail=创建微信订单码失败,请稍后重试 +third.wx.native.create.fail.code=创建微信订单码失败,微信错误码:{0} +third.wx.native.no.qr=创建微信订单码失败,微信未返回二维码 + +app.msg.title.wallet.payment=下单成功,钱包已扣款 +app.msg.title.wallet.refund=退款已到账 +app.msg.title.wallet.recharge=充值已到账 +app.msg.title.wallet.reset=钱包余额已重置 +app.msg.title.meal.verified=用餐核销成功 +app.msg.event.wallet.update=余额更新 +app.msg.event.wallet.batch=批量余额更新 +app.msg.event.wallet.recharge=充值到账 +app.msg.event.wallet.payment=消费支付 +app.msg.event.wallet.refund=退款到账 +app.msg.event.wallet.transfer=钱包转账 +app.msg.event.wallet.transfer.refund=转账退款 +app.msg.event.wallet.return.canteen=退还食堂 +app.msg.event.wallet.reset=余额重置 +app.msg.event.meal.verified=用餐核销 +app.msg.wallet.default.name=钱包 +app.msg.wallet.detail.inc={0}增加{1}元,余额{2}元 +app.msg.wallet.detail.dec={0}减少{1}元,余额{2}元 +app.msg.wallet.detail.sep=; +app.msg.wallet.content={0}:{1} +app.msg.meal.default.name=本次预约用餐 +app.msg.meal.content={0}已核销,祝您用餐愉快。 +app.msg.ward.fallback=被监护人 +app.msg.relation.title={0}的{1} +app.msg.relation.content={0}:{1} + +common.product.sku.not.found=商品SKU不存在 +common.mch.service.error=商户服务异常 +mall.user.no.farmer.mch=该用户未分配共富商户 +mall.no.product.perm=无权限处理此商品 +mall.category.not.found=分类不存在 +mall.no.category.perm=无权限处理此分类 +address.id.empty=地址ID不能为空 +address.not.found=地址不存在 +address.dept.building.required=单位与楼栋不能为空 +address.unit.required=单元不能为空 +address.room.required=房间不能为空 +address.dept.not.found=单位不存在 +address.building.not.found=楼栋不存在 +address.building.dept.mismatch=所选楼栋不属于该单位 +address.unit.not.found=单元不存在 +address.unit.building.mismatch=所选单元不属于该楼栋 +address.room.not.found=房间不存在 +address.room.unit.mismatch=所选房间不属于该单元/楼栋 +address.room.no.empty=房间号不能为空 +address.building.no.access=无权访问该楼栋 +address.unit.no.access=无权访问该单元 +address.record.update.missing=地址记录不存在,无法修改 +address.record.delete.missing=地址记录不存在,无法删除 + +hard.car.group.item.empty=第{0}组购物车不能为空 +hard.car.group.item.incomplete=第{0}组购物车商品信息不完整或数量无效 +hard.car.group.parent.fail=第{0}组父购物车创建失败 +hard.car.group.item.invalid=第{0}组存在无效商品 +mall.product.sku.missing=共富商城商品无SKU信息,商品名:{0},商品ID:{1},请联系管理员 + +canteen.stock.items.empty=库存商品不能为空 +canteen.stock.item.param.bad=库存商品参数错误 +canteen.stock.biz.param.bad=库存业务参数错误 +canteen.stock.item.dup=库存商品不能重复 +canteen.stock.spu.bad=商品不存在或库存异常 +canteen.stock.snapshot.bad=库存快照异常 +canteen.stock.changed={0}库存已变化,请重新操作 +canteen.stock.compensate.fail=库存补偿失败,请重试 +canteen.stock.update.fail=库存更新失败,请重试 +canteen.stock.tx.state.bad=库存事务状态异常,请稍后重试 +canteen.stock.insufficient=库存不足,无法完成操作 +canteen.no.product.perm=无权操作该商品 +canteen.no.product.perm.named=无权操作该商品:{0} +canteen.shelf.status.invalid=状态非法,仅支持 0-上架、1-下架 + +hard.stock.tx.state.bad=库存事务状态异常,请稍后重试 +hard.canteen.stock.aftersale.missing=食堂菜品退款库存缺少售后单 ID +hard.canteen.stock.car.missing=食堂菜品库存操作失败,购物车不存在 +hard.canteen.stock.refund.item.missing=食堂菜品库存操作失败,退款商品不存在 +hard.canteen.stock.no.resp=查询食堂菜品库存无响应 +hard.canteen.stock.query.fail=查询食堂菜品库存失败 +hard.canteen.spu.bad=食堂菜品不存在或不属于当前商户 +hard.canteen.stock.op.fail=食堂菜品库存服务操作失败 +hard.door.stock.fail=扣减智能柜库存{0}错误 +hard.stock.deduct.cart.missing=扣减库存错误,购物车不存在 +hard.stock.op.fail={0}错误 + +wallet.transfer.source.low=源钱包{0}余额不足 +wallet.transfer.limit.exceeded=已经超过最大转账金额限制 +wallet.transfer.not.found=查询不到转账记录 +wallet.transfer.refund.dup=已退回请勿重复操作 +wallet.transfer.refund.source.low=源钱包{0}余额不足,无法退回 +wallet.apply.dup.submit=已提交申请,请勿重复提交 +act.cancel.not.found=核销活动不存在 +act.cancel.closed=核销活动已关闭 +act.cancel.mch.missing=核销活动商户不存在 +act.cancel.already.received=您已经领,请勿重复领取 +act.cancel.balance.low=消费钱包余额不足{0}元,无法领取 +act.cancel.coupon.expired=您领取的优惠券已过期 +act.coupon.not.found=优惠券不存在 +act.not.found=活动不存在 +act.coupon.points.deduct.fail=扣减积分错误 +act.id.empty=活动id不能为空 + +sys.face.max.count=最多只能上传3张人脸图片 +sys.face.max.active=审核中和已通过的人脸合计最多只能保留3张 +sys.face.dup.image=请勿重复提交同一张人脸图片 +sys.face.dept.missing=当前用户所属部门不存在,无法发起人脸审核 +sys.face.ward.only=仅可查看或操作本人及有效被监护人的人脸审核记录 +sys.face.record.missing=人脸审核记录不存在 +sys.face.revoke.status=只有审核中的人脸记录可以撤销 +sys.face.status.changed=人脸审核状态已发生变化,请刷新后重试 +sys.car.plate.dup=车牌号不能重复 + +hard.idem.applying=正在申请中,请勿重复操作 +hard.idem.canceling=正在取消中,请勿重复操作 +hard.idem.processing=正在处理中,请勿重复操作 +hard.idem.refunding=正在退款中,请勿重复操作 +hard.idem.batch.refund=批量退款任务正在提交,请勿重复操作 +act.idem.receiving=正在领取中,请勿重复操作 +wallet.idem.applying=正在申请中,请勿重复操作 +wallet.idem.opening=正在开卡中,请勿重复提交 +wallet.idem.processing=正在处理中,请勿重复提交 +wallet.idem.importing=正在导入中,请勿重复操作 +wallet.idem.recharging=正在充值中,请勿重复操作 +wallet.idem.uploading=正在上传中,请勿重复操作 +wallet.idem.invoice=正在重新生成发票中,请勿重复操作 + +mall.product.create.fail=商品创建失败 +mall.product.id.empty=商品ID不能为空 +mall.product.update.fail=商品更新失败 +mall.product.list.fail=获取商品列表失败 +mall.product.delete.fail=商品删除失败 +mall.category.create.fail=商品分类创建失败 +mall.category.id.empty=分类ID不能为空 +mall.category.update.fail=分类更新失败 +mall.category.delete.fail=分类删除失败 +mall.category.list.fail=获取分类列表失败 + +third.wx.profit.amount.min=微信分账支付金额必须大于10分 +third.wx.profit.amount.range=微信平台抽佣金额必须不少于1分且不能超过订单金额 +third.pay.config.missing=支付配置不存在 +third.wx.refund.amount.bad=微信退款金额必须大于0且不能超过订单金额 +third.pay.order.status.no.refund=支付订单当前状态不允许退款 +third.ali.qr.create.fail=创建支付宝订单码失败,请稍后重试 +third.ali.amount.invalid=支付宝支付金额必须大于0分 +third.ali.zt.amount.min=支付宝直付通支付金额必须大于10分 +third.wx.refund.apply.error=微信退款申请错误异常 +third.wx.refund.queued=微信退款请求已进入补偿队列,请稍后查询结果 +third.ali.refund.amount.bad=支付宝退款金额必须大于0且不能超过订单金额 +sys.register.suspended=暂时停止注册! diff --git a/pjcloud-common/pjcloud-common-core/src/main/resources/i18n/messages_zh_HK.properties b/pjcloud-common/pjcloud-common-core/src/main/resources/i18n/messages_zh_HK.properties index 9b619350..878cbb30 100644 --- a/pjcloud-common/pjcloud-common-core/src/main/resources/i18n/messages_zh_HK.properties +++ b/pjcloud-common/pjcloud-common-core/src/main/resources/i18n/messages_zh_HK.properties @@ -37,3 +37,535 @@ sys.user.password.new.empty=新密碼不能為空 sys.user.password.length=密碼長度需為6-20位 sys.user.password.chars.only=密碼只能包含字母和數字 sys.user.password.letter.digit=密碼需同時包含字母和數字 +common.not.login=未登入 +common.record.not.found=記錄不存在 +common.mch.not.found=商戶不存在 +common.user.dept.missing=用戶部門不存在 +ordering.food.mch.disabled=該商戶未啟用報餐 +ordering.food.job.time.missing.for.segment=商戶未配置營業時間,無法獲取餐段 +ordering.food.job.time.missing=商戶未配置營業時間 +ordering.food.select.date.segment=請選擇報餐日期與餐段 +ordering.food.select.dish=請選擇報餐菜品 +ordering.food.fill.person.count=請填寫報餐人數 +ordering.food.cancel.status.invalid=當前狀態不可取消 +ordering.food.select.valid.mch=請選擇有效商戶 +ordering.food.no.mch.view.perm=無權查看該商戶數據 +ordering.food.select.date=請選擇日期 +ordering.food.user.dept.missing=用戶部門不存在 +ordering.food.select.canteen.mch=請選擇食堂商戶 +ordering.food.stats.range.too.large=查詢日期範圍最多一個月({0}天) +ordering.food.user.info.missing=用戶資訊不存在 +ordering.food.no.stats.perm=無權訪問報餐統計 +ordering.food.date.segment.incomplete=報餐日期或餐段不完整 +ordering.food.future.days.limit=僅支援報餐未來{0}天內 +ordering.food.segment.invalid=餐段無效,請刷新後重試 +ordering.food.duplicate.date.segment=存在重複的日期餐段選擇 +ordering.food.dish.info.incomplete=報餐菜品資訊不完整 +ordering.food.select.dish.for.segment=請為「{0}」選擇菜品 +ordering.food.dish.segment.invalid=菜品餐段無效 +common.order.not.found=訂單不存在 +common.cart.not.found=購物車不存在 +common.wallet.not.found=用戶錢包不存在 +common.wallet.balance.insufficient=錢包餘額不足 +common.product.not.found=商品不存在 +common.product.stock.low=庫存不足 +common.user.not.exist=用戶不存在 +common.user.not.exist.dup=用戶不存在 +common.unsupported.pay.type=不支持的支付方式 +common.mch.id.empty=商戶ID不能為空 +common.past.date.not.allowed=不能選擇過去的日期 +common.date.format.ymd=日期格式應為 yyyy-MM-dd +common.date.range.required=開始日期與結束日期不能為空 +common.date.range.invalid=結束日期不能早於開始日期 +common.month.format.ym=月份格式應為 yyyy-MM +delivery.order.no.view=訂單不存在或無權查看 +delivery.order.no.operate=訂單不存在或無權操作 +delivery.accept.first=請先接單 +delivery.accept.status.invalid=當前狀態不可接單 +delivery.already.accepted=訂單已接單 +delivery.pickup.photo.status.invalid=當前狀態不可上傳取餐照 +delivery.deliver.photo.status.invalid=當前狀態不可上傳送達照 +delivery.sync.hardware.fail=同步硬件外賣訂單狀態失敗: {0} +delivery.no.response=無響應 +delivery.order.already.synced=訂單已同步過 +delivery.cart.serialize.fail=購物車序列化失敗 +delivery.order.no.empty=訂單號不能為空 +delivery.rider.push.title=新配送任務 +delivery.rider.push.body=您有一單新的食堂外送,請及時處理 +delivery.mch.push.title=新外送訂單 +delivery.mch.push.body=您有一單新的食堂外送訂單,請及時處理 +delivery.mch.schedule.title=預約外送提醒 +delivery.mch.schedule.body=您有一單預約外送即將進入備餐時段,請及時查看 +delivery.rider.building.bound=該單位下樓棟已綁定騎手,請先解綁 +wallet.type.id.empty=錢包類型id不能為空 +wallet.remark.empty=備註不能為空 +wallet.not.found=錢包不存在 +wallet.freeze.dup=已提交申請,請勿重複提交 +wallet.card.not.found=卡號不存在 +wallet.card.already.bound=該卡號已經綁定用戶 +wallet.meal.card.not.found=飯卡錢包不存在 +wallet.user.already.bound=用戶已綁定飯卡 +wallet.qr.gen.fail=錢包二維碼生成錯誤 +wallet.relation.query.fail=查詢關係人資訊失敗 +wallet.user.relation.fail=查詢用戶關係失敗 +wallet.face.query.fail=查詢用戶人臉情況失敗 +wallet.pending.appt.fail=查詢用戶待核銷預約失敗 +wallet.package.amount.invalid=充值套餐金額無效 +wallet.target.card.missing=目標飯卡不存在 +wallet.no.ward.perm=無權操作該被監護人 +wallet.ward.query.fail=查詢被監護人資訊失敗 +wallet.ward.not.found=被監護人不存在 +wallet.identity.query.fail=查詢充值用戶身份失敗 +wallet.canteen.missing=錢包所屬食堂不存在 +wallet.identity.no.recharge=當前人員身份不支持錢包充值 +wallet.card.canteen.missing=飯卡所屬食堂不存在 +wallet.pay.method.missing=飯卡所屬食堂暫未配置支付方式 +wallet.proxy.record.missing=代充值記錄不存在 +wallet.guardian.relation.fail=查詢監護關係失敗 +wallet.package.not.found=錢包充值套餐不存在 +wallet.package.disabled=錢包充值套餐已禁用 +wallet.meal.card.not.open=未開通飯卡 +wallet.meal.card.frozen=飯卡已凍結 +wallet.card.status.no.recharge={0},暫不可充值 +wallet.target.user.missing=缺少目標用戶資訊 +wallet.no.ward.tx.perm=無權查看該被監護人的錢包流水 +wallet.tx.deduct.amount.mismatch=重複業務扣款金額不一致 +wallet.tx.credit.amount.mismatch=重複業務入賬金額不一致 +wallet.tx.refund.amount.mismatch=重複業務退款金額不一致 +wallet.tx.payment.amount.mismatch=支付流水金額與補償金額不一致 +wallet.order.payment.cancelled=訂單支付已經取消,不能繼續扣款 +wallet.order.payment.compensated=訂單支付已經補償,不能重複扣款 +wallet.tx.compensate.fail=錢包補償失敗 +wallet.tx.batch.compensate.fail=錢包批量補償失敗 +wallet.tx.payment.save.fail=保存錢包支付流水失敗 +wallet.tx.refund.save.fail=保存錢包補償流水失敗 +wallet.tx.batch.empty=錢包批量交易明細不能為空 +wallet.tx.batch.incomplete=錢包批量交易明細不完整 +wallet.tx.batch.non.force.only=錢包批量交易僅支持非透支支付 +wallet.tx.batch.dup.biz=請勿重複提交同一錢包業務號 +wallet.tx.processing=訂單錢包交易正在處理中,請稍後重試 +wallet.tx.lock.interrupted=訂單錢包交易等待已中斷,請稍後重試 +wallet.tx.tx.state.bad=錢包批量交易事務狀態異常,請稍後重試 +wallet.tx.not.found=錢包流水不存在或已刪除 +wallet.reset.balance.fail=重置餘額失敗 +wallet.proxy.refund.not.paid=代充值尚未到賬,不能退款 +wallet.proxy.pay.status.fail=更新代充值到賬狀態失敗 +wallet.proxy.refund.status.fail=更新代充值退款狀態失敗 +wallet.card.no.user=該飯卡沒有綁定用戶 +after.sale.refund.only=當前僅支持僅退款 +after.sale.pending.dup=當前訂單已有退款申請待審核,請勿重複提交 +after.sale.partial.continue.unsupported=當前版本不支持部分退款後的繼續申請,請升級應用後重試 +after.sale.amount.exceed=本次退款金額超出訂單剩餘可退金額 +after.sale.pay.amount.invalid=訂單實付金額異常 +after.sale.not.found=售後單不存在 +after.sale.order.not.found=售後訂單不存在 +after.sale.payer.only=僅訂單付款人可以申請退款 +after.sale.app.mch.scope=當前 App 商戶僅支持審核食堂預約訂單 +after.sale.cancel.status.invalid=取消售後單失敗,售後單狀態不是【待審核】 +after.sale.amount.gt.zero=退款金額必須大於0 +after.sale.amount.gt.pay=退款總金額大於支付總金額 +after.sale.wallet.refund.fail=錢包退款錯誤 +after.sale.wx.refund.fail=微信退款錯誤 +after.sale.wx.refund.fail.msg=微信退款錯誤:{0} +after.sale.ali.refund.fail=支付寶退款錯誤 +after.sale.ali.refund.fail.msg=支付寶退款錯誤:{0} +after.sale.unsupported.type=不支持的退款類型 +after.sale.wallet.clawback.fail=錢包退款金額扣回失敗 +after.sale.order.fully.refunded=訂單已全部退款 +after.sale.product.list.empty=售後商品列表不能為空 +after.sale.order.cart.missing=訂單購物車不存在 +after.sale.refund.product.empty=退款商品不能為空 +after.sale.refund.product.missing=退款商品<{0}>不存在 +after.sale.refund.qty.empty=退款商品<{0}>數量不能為空 +after.sale.refund.qty.negative=退款商品<{0}>數量不能為負數 +after.sale.refund.qty.invalid=退款商品<{0}>數量異常 +after.sale.hist.qty.invalid=歷史退款商品數量異常 +after.sale.order.qty.invalid=訂單商品數量異常 +after.sale.refund.qty.bad=退款商品數量異常 +after.sale.refund.qty.exceed=退款商品<{0}>數量超出 +after.sale.order.type.no.refund=該訂單類型不支持退款 +after.sale.order.status.no.refund=當前訂單狀態不支持退款 +after.sale.refund.time.exceeded=訂單已超過4個小時,不能退款 +after.sale.auto.refund.lock=自動退款處理中,當前售後單不允許人工取消或審核 +after.sale.dup.product=同一商品不能重複提交 +after.sale.product.not.in.order=退款商品不屬於當前訂單 +after.sale.weighted.no.partial=稱重商品暫不支持在線逐份退款 +after.sale.refund.qty.out.range=退款商品<{0}>數量超出可退範圍 +after.sale.refund.amount.invalid=退款商品<{0}>退款金額異常 +after.sale.select.product=請選擇需要退款的商品 +after.sale.order.product.bad=訂單商品數據異常 +after.sale.order.amount.snapshot.bad=訂單商品金額快照異常 +after.sale.alloc.weight.bad=退款分攤權重異常 +after.sale.processing=訂單退款正在處理中,請稍後重試 +after.sale.approve.status.invalid=審批失敗,售後狀態不處於審批中 +after.sale.pending.handle.first=當前訂單已有退款申請待審核,請先處理後再退款 +after.sale.hist.detail.incomplete=歷史退款商品明細不完整,請通過後台核對後處理 +after.sale.order.type.error=訂單類型錯誤 +after.sale.refund.list.empty=退款商品列表不能為空 +after.sale.device.order.missing=設備訂單不存在 +hard.cart.not.owned=購物車不存在或不屬於當前用戶 +hard.cart.no.view=購物車不存在或無權查看 +hard.cart.status.changed=購物車狀態已變更,請重新選擇商品 +hard.cart.amount.invalid=購物車金額異常 +hard.cart.product.bad=購物車商品數據異常,請重新選擇商品 +hard.cart.product.not.in.mch=購物車商品不存在或不屬於當前商戶 +hard.required.dish.missing=未選擇必選菜品 +hard.user.address.missing=用戶地址不存在 +hard.pickup.point.missing=查詢自提點不存在 +hard.mch.not.cooperate=該商家未合作 +hard.app.pay.fail=發起app支付失敗 +hard.wallet.deduct.fail=錢包扣款錯誤 +hard.unverified.self=您有{0}筆未核銷的預約訂單,請先核銷 +hard.unverified.diner=用餐人已有{0}筆未核銷的預約訂單,請先核銷 +hard.unverified.diner.limit=用餐人已有{0}筆未核銷的預約訂單,本次訂餐後將超過200筆上限 +hard.batch.wallet.only=批量訂餐暫僅支持錢包支付 +hard.multi.diner.canteen.only=僅食堂購物車可以多人訂餐 +hard.cart.already.ordered=該購物車已創建訂單,請勿重複提交 +hard.cart.already.ordered2=購物車已創建訂單,請勿重複提交 +hard.cart.not.canteen=購物車商戶不是食堂商戶 +hard.diner.not.found=用餐人不存在 +hard.create.reserve.fail=創建訂餐訂單失敗 +hard.reserve.tx.bad=訂餐事務狀態異常,請稍後重試 +hard.reserve.group.empty=訂餐分組不能為空 +hard.cart.dup.submit=請勿重複提交同一購物車 +hard.reserve.processing=訂餐訂單正在處理中,請勿重複提交 +hard.daily.menu.canteen.only=僅食堂購物車可以提交每日菜譜訂單 +hard.not.daily.menu.scene=購物車不是每日菜譜場景,請重新點擊去支付 +hard.batch.same.mch=批量訂餐必須屬於同一商戶 +hard.dup.date.meal=請勿重複提交同一天同一餐段 +hard.daily.menu.mode.off=當前商戶未開啟每日菜譜訂餐模式 +hard.reserve.amount.bad=訂餐金額異常 +hard.diner.card.query.fail=查詢用餐人飯卡失敗,請稍後重試 +hard.diner.query.fail=查詢用餐人失敗 +hard.diner.card.data.bad=用餐人飯卡數據異常,請聯繫管理員 +hard.diner.card.dup={0}存在重複飯卡數據,請聯繫管理員 +hard.diner.no.card={0}未開通飯卡 +hard.diner.card.owner.bad={0}的飯卡歸屬異常,請聯繫管理員 +hard.diner.balance.low={0}飯卡餘額不足 +hard.daily.menu.product.bad=每日菜譜商品不存在、已下架或不屬於當前商戶 +hard.product.price.bad={0}價格異常,請聯繫商戶 +hard.product.mode.bad={0}商品模式異常,請聯繫商戶 +hard.product.price.changed={0}價格已變化,請重新選擇菜品 +hard.product.stock.low={0}庫存不足 +hard.one.item.per.slot=該商戶每個日期餐段僅允許選擇一份商品 +hard.diner.empty=用餐人不能為空 +hard.diner.dup=請勿重複選用餐人 +hard.diner.invalid=存在無效或無權代訂的用餐人 +hard.guardian.reserve.off=當前商戶未開啟監護關係代訂餐 +hard.diner.identity.invalid=存在不符合當前商戶可訂餐身份的用餐人 +hard.diner.slot.once=同一用餐人同一天同一餐段只能預約一次,請勿重複預約 +hard.appt.processing=預約正在處理中,請勿重複提交 +hard.appt.tx.bad=預約事務狀態異常,請稍後重試 +hard.diner.card.mismatch=用餐人與飯卡歸屬不一致 +hard.stock.deduct.fail=庫存不足或扣減失敗 +hard.stock.restore.fail=恢復庫存失敗 +hard.daily.stock.deduct.fail=每日菜譜庫存不足或扣減失敗 +hard.daily.stock.restore.fail=每日菜譜庫存恢復失敗 +hard.copy.cart.fail=複製訂餐購物車失敗 +hard.copy.product.fail=複製訂餐商品失敗 +hard.wallet.tx.bad=訂餐錢包交易數據異常 +hard.update.pay.status.fail=更新訂餐訂單支付狀態失敗 +hard.update.cart.status.fail=更新訂餐購物車狀態失敗 +hard.mch.no.resp=查詢商戶無響應 +hard.diner.card.no.resp=查詢用餐人飯卡無響應 +hard.daily.product.no.resp=查詢每日菜譜商品無響應 +hard.daily.product.query.fail=查詢每日菜譜商品失敗 +hard.diner.identity.no.resp=查詢用餐人身份無響應 +hard.diner.identity.query.fail=查詢用餐人身份失敗 +hard.daily.menu.batch.bad=每日菜譜訂單批次數據異常 +hard.reserve.batch.bad=訂餐訂單批次數據異常 +hard.wallet.batch.deduct.bad=錢包批量扣款結果異常 +hard.appt.cycle.rule.required=週期預約規則不能為空 +hard.appt.cycle.not.allowed=當前商戶使用動態時間窗,不能提交週期預約規則 +hard.appt.date.meal.required=週期預約需要選擇預約日期和餐端 +hard.appt.cycle.open.at=週{0}{1}開放 +hard.wallet.batch.deduct.no.resp=錢包批量扣款無響應 +hard.wallet.batch.comp.no.resp=錢包批量補償無響應 +hard.stock.no.resp=查詢商品庫存無響應 +hard.appt.slot.missing=預約餐段不存在 +hard.appt.slot.mch.mismatch=預約餐段與當前商戶不匹配 +hard.appt.slot.disabled=預約餐段已停用 +hard.appt.slot.mode.mismatch=預約餐段與商戶當前模式不匹配 +hard.appt.date.out.range=該預約日期不在可選範圍內 +hard.appt.date.no.slot=該日期未配置此預約餐段 +hard.appt.date.type.invalid=預約日期類型無效 +hard.appt.dynamic.slot.empty=動態預約餐段不能為空 +hard.appt.period.closed=本期預約已截止 +hard.appt.not.open=預約尚未開放 +hard.appt.closed=預約已截止 +hard.appt.rule.mode.invalid=預約規則模式無效 +hard.appt.rule.incomplete=預約規則配置不完整 +hard.appt.rule.time.invalid=預約規則時間範圍無效 +hard.appt.cycle.missing=週期預約規則不存在或已停用 +hard.appt.mch.conf.fail=獲取商戶預約配置失敗 +hard.appt.mch.mode.invalid=商戶預約時間模式無效 +hard.delivery.type.invalid=配送時間類型無效 +hard.schedule.need.slot=預約配送須選擇日期與時段 +hard.schedule.end.after.start=預約時段結束須晚於開始 +hard.mch.job.time.missing=商戶未配置營業時間 +hard.eta.out.of.hours=預計送達時間不在商戶營業時間內,請重新選擇 +hard.no.schedule.without.hours=商戶未配置營業時間,暫不可預約配送 +hard.job.time.format.bad=商戶營業時間格式無效,請先在後台正確配置 jobTime +hard.slot.out.of.hours=預約時段不在商戶營業時間內,請重新選擇 +hard.qr.already.verified=該二維碼已被核銷 +hard.verify.diner.only=僅實際用餐人可以使用預約核銷碼 +hard.not.canteen.reserve=該訂單不是食堂預約訂單 +hard.no.mch.verify.perm=當前用戶沒有商戶核銷權限 +hard.no.mch.order.manage=無權管理該商戶訂單 +hard.reserve.not.verifiable=該預約訂單當前不可核銷 +hard.reserve.refunding.no.verify=該預約訂單正在退款,不能核銷 +hard.reserve.full.refund.no.verify=該預約訂單商品已全部退款,不能核銷 +hard.verify.status.changed=訂單狀態已變化,核銷失敗 +hard.restore.code.no.resp=恢復預約核銷碼無響應 +hard.restore.code.fail=恢復預約核銷碼失敗 +hard.rollback.online.only=僅線上預訂訂單支持退回到核銷前 +hard.rollback.biz.unsupported=當前業務類型不支持退回到核銷前 +hard.rollback.verified.only=僅已核銷訂單支持退回到核銷前 +hard.rollback.refunding=該預約訂單正在退款,不能退回到核銷前 +hard.rollback.full.refund=該預約訂單商品已全部退款,不能退回到核銷前 +hard.rollback.status.changed=訂單狀態已變化,退回核銷狀態失敗 +hard.act.ended=核銷失敗,活動已結束 +hard.act.not.started=核銷失敗,活動未開始 +hard.act.coupon.used=核銷失敗,您領取的優惠券已核銷 +hard.act.location.error=核銷失敗,位置錯誤 +hard.act.verify.fail=核銷失敗 +hard.act.qr.bad=核銷二維碼錯誤 +hard.act.device.no.perm=當前設備不能核銷該活動訂單 +hard.act.user.no.perm=當前活動,該用戶沒有核銷權限 +hard.act.verify.user.missing=核銷用戶不存在 +hard.act.coupon.user.missing=領券用戶不存在 +hard.order.expired.rescan=訂單已失效,請重新掃碼 +hard.not.device.scan.pay=該訂單不是設備掃碼支付訂單 +hard.not.device.scan=該訂單不是設備掃一掃訂單 +hard.order.paid.or.changed=該訂單已支付或狀態已變更 +hard.pay.amount.zero=支付金額為0元 +hard.user.no.wallet=該用戶沒有這個錢包 +hard.wallet.user.missing=錢包用戶不存在 +hard.shipment.no.missing=快遞單號不存在 +hard.order.type.no.receipt=該訂單類型不支持確認收貨 +hard.order.status.no.receipt=該訂單狀態不支持確認收貨 +hard.order.type.error=訂單類型錯誤 +hard.order.status.error=訂單狀態錯誤 +hard.idem.create=正在創建訂單中,請勿重複操作 +hard.idem.verify=正在核銷中,請勿重複操作 +hard.idem.rollback=正在退回核銷狀態,請勿重複操作 +hard.car.group.empty=購物車分組不能為空 +hard.car.biz.incomplete=購物車業務資訊不完整 +hard.car.batch.same.user.mch=批量購物車必須屬於同一用戶、商戶和業務類型 +hard.car.save.fail=購物車商品保存失敗 +common.idempotent.retry=重複請求,請稍後重試 +auth.captcha.empty=驗證碼不能為空 +auth.captcha.invalid=驗證碼不合法 +auth.wx.auth.fail=微信授權失敗:{0} +auth.wx.openid.missing=微信授權失敗,未獲取到用戶標識 +auth.wx.auth.expired=微信授權已過期,請重新授權 +auth.apple.not.configured=未配置Apple登錄 +auth.apple.not.enabled=未啟用Apple登錄 +auth.mini.app.login.fail=微信小程序登錄失敗 +auth.social.auth.expired=授權已過期,請重新授權 +sys.app.sms.send.fail=短信驗證碼發送失敗,請稍後重試 +sys.app.sms.code.invalid=短信驗證碼錯誤或已過期 +sys.user.password.same=新舊密碼不能相同 +sys.user.unbind.type.invalid=解綁賬號類型不存在 +third.recharge.biz.id.invalid=充值業務id解析錯誤 +third.proxy.recharge.biz.id.invalid=代充值業務id解析錯誤 +third.proxy.recharge.invalid=代充值記錄不存在或金額無效 +third.ward.wallet.no.recharge=目標飯卡當前不可充值 +third.pay.amount.gt.zero=支付金額必須大於0 +third.wechat.pay.create.fail=創建微信支付錯誤 +third.alipay.pay.create.fail=創建支付寶支付錯誤 +third.user.no.mch=用戶不屬於任何食堂或者商城 +third.user.no.canteen=用戶不屬於任何食堂 +third.shop.pay.mch.missing=商城支付缺少可信商戶信息 +third.shop.order.biz.id.invalid=商城訂單業務id解析錯誤 +third.shop.order.no.pay=商城訂單不存在或無權支付 +third.shop.order.amount.mismatch=商城訂單支付金額不一致 +third.shop.order.mch.mismatch=商城訂單收款商戶不一致 +third.mch.pay.disabled=收款商戶已停用 +third.mch.wechat.pay.config.missing=商戶未配置微信支付參數 +third.mch.alipay.pay.config.missing=商戶未配置支付寶支付參數 +third.order.code.processing=訂單碼支付正在處理中,請勿重複提交 +third.pay.no.empty=支付訂單號不能為空 +third.order.code.not.found=訂單碼支付訂單不存在 +third.order.already.paid=該業務訂單已支付,請勿重複下單 +third.order.code.other.platform=該業務訂單已有其他平台的待支付訂單碼 +third.order.code.data.error=訂單碼數據異常,請稍後重試 +third.order.closing=上一筆訂單正在確認關閉,請稍後重試 +third.order.code.param.empty=訂單碼支付參數不能為空 +third.order.code.biz.only=訂單碼支付僅支持雲消費機支付業務 +third.order.code.platform.only=訂單碼支付僅支持支付寶或微信 +third.pay.biz.id.empty=支付業務id不能為空 +third.order.pending.mismatch=該業務訂單已有不同金額或商戶的待支付訂單 +third.mch.info.mismatch=收款商戶信息不一致 +third.mch.alipay.config.disabled=商戶未啟用支付寶支付配置 +third.mch.wechat.config.disabled=商戶未啟用微信支付配置 +third.alipay.app.config.incomplete=支付寶應用支付配置不完整 +third.wechat.app.config.incomplete=微信服務商支付配置不完整 +third.refund.processing=上一筆退款仍在處理中,請稍後重試 +third.wx.oauth.incomplete=微信用戶授權參數不完整 +third.wx.oauth.fail=微信用戶授權失敗,請重新掃碼 +third.fz.relation.unavailable=支付平台分佣關係服務不可用 +third.wx.jsapi.create.fail=創建微信支付訂單失敗,請重新掃碼 +third.aggregate.sub.order.save.fail=聚合支付子訂單保存失敗 +third.mch.wechat.config.incomplete=商戶微信支付配置不完整 +third.mch.wechat.sub.mch.missing=商戶微信子商戶號未配置 +third.pay.order.snapshot.missing=支付訂單缺少商戶配置快照 +third.pay.order.snapshot.invalid=支付訂單商戶配置快照無效 +third.alipay.auth.code.empty=支付寶授權碼不能為空 +third.alipay.oauth.fail=支付寶用戶授權失敗,請重新掃碼 +third.alipay.oauth.no.payer=支付寶用戶授權未返回付款人標識 +third.alipay.jsapi.create.fail=創建支付寶支付訂單失敗,請重新掃碼 +third.alipay.client.init.fail=支付寶客戶端初始化失敗 +third.mch.alipay.config.incomplete=商戶支付寶支付配置不完整 +third.mch.alipay.sub.mch.missing=商戶支付寶直付通二級商戶標識未配置 +third.wx.native.create.fail=創建微信訂單碼失敗,請稍後重試 +third.wx.native.create.fail.code=創建微信訂單碼失敗,微信錯誤碼:{0} +third.wx.native.no.qr=創建微信訂單碼失敗,微信未返回二維碼 + +app.msg.title.wallet.payment=下單成功,錢包已扣款 +app.msg.title.wallet.refund=退款已到賬 +app.msg.title.wallet.recharge=充值已到賬 +app.msg.title.wallet.reset=錢包餘額已重置 +app.msg.title.meal.verified=用餐核銷成功 +app.msg.event.wallet.update=餘額更新 +app.msg.event.wallet.batch=批量餘額更新 +app.msg.event.wallet.recharge=充值到賬 +app.msg.event.wallet.payment=消費支付 +app.msg.event.wallet.refund=退款到賬 +app.msg.event.wallet.transfer=錢包轉賬 +app.msg.event.wallet.transfer.refund=轉賬退款 +app.msg.event.wallet.return.canteen=退還食堂 +app.msg.event.wallet.reset=餘額重置 +app.msg.event.meal.verified=用餐核銷 +app.msg.wallet.default.name=錢包 +app.msg.wallet.detail.inc={0}增加{1}元,餘額{2}元 +app.msg.wallet.detail.dec={0}減少{1}元,餘額{2}元 +app.msg.wallet.detail.sep=; +app.msg.wallet.content={0}:{1} +app.msg.meal.default.name=本次預約用餐 +app.msg.meal.content={0}已核銷,祝您用餐愉快。 +app.msg.ward.fallback=被監護人 +app.msg.relation.title={0}的{1} +app.msg.relation.content={0}:{1} + +common.product.sku.not.found=商品SKU不存在 +common.mch.service.error=商戶服務異常 +mall.user.no.farmer.mch=該用戶未分配共富商戶 +mall.no.product.perm=無權限處理此商品 +mall.category.not.found=分類不存在 +mall.no.category.perm=無權限處理此分類 +address.id.empty=地址ID不能為空 +address.not.found=地址不存在 +address.dept.building.required=單位與樓棟不能為空 +address.unit.required=單元不能為空 +address.room.required=房間不能為空 +address.dept.not.found=單位不存在 +address.building.not.found=樓棟不存在 +address.building.dept.mismatch=所選樓棟不屬於該單位 +address.unit.not.found=單元不存在 +address.unit.building.mismatch=所選單元不屬於該樓棟 +address.room.not.found=房間不存在 +address.room.unit.mismatch=所選房間不屬於該單元/樓棟 +address.room.no.empty=房間號不能為空 +address.building.no.access=無權訪問該樓棟 +address.unit.no.access=無權訪問該單元 +address.record.update.missing=地址記錄不存在,無法修改 +address.record.delete.missing=地址記錄不存在,無法刪除 + +hard.car.group.item.empty=第{0}組購物車不能為空 +hard.car.group.item.incomplete=第{0}組購物車商品信息不完整或數量無效 +hard.car.group.parent.fail=第{0}組父購物車創建失敗 +hard.car.group.item.invalid=第{0}組存在無效商品 +mall.product.sku.missing=共富商城商品無SKU信息,商品名:{0},商品ID:{1},請聯繫管理員 + +canteen.stock.items.empty=庫存商品不能為空 +canteen.stock.item.param.bad=庫存商品參數錯誤 +canteen.stock.biz.param.bad=庫存業務參數錯誤 +canteen.stock.item.dup=庫存商品不能重複 +canteen.stock.spu.bad=商品不存在或庫存異常 +canteen.stock.snapshot.bad=庫存快照異常 +canteen.stock.changed={0}庫存已變化,請重新操作 +canteen.stock.compensate.fail=庫存補償失敗,請重試 +canteen.stock.update.fail=庫存更新失敗,請重試 +canteen.stock.tx.state.bad=庫存事務狀態異常,請稍後重試 +canteen.stock.insufficient=庫存不足,無法完成操作 +canteen.no.product.perm=無權操作該商品 +canteen.no.product.perm.named=無權操作該商品:{0} +canteen.shelf.status.invalid=狀態非法,僅支持 0-上架、1-下架 + +hard.stock.tx.state.bad=庫存事務狀態異常,請稍後重試 +hard.canteen.stock.aftersale.missing=食堂菜品退款庫存缺少售後單 ID +hard.canteen.stock.car.missing=食堂菜品庫存操作失敗,購物車不存在 +hard.canteen.stock.refund.item.missing=食堂菜品庫存操作失敗,退款商品不存在 +hard.canteen.stock.no.resp=查詢食堂菜品庫存無響應 +hard.canteen.stock.query.fail=查詢食堂菜品庫存失敗 +hard.canteen.spu.bad=食堂菜品不存在或不屬於當前商戶 +hard.canteen.stock.op.fail=食堂菜品庫存服務操作失敗 +hard.door.stock.fail=扣減智能櫃庫存{0}錯誤 +hard.stock.deduct.cart.missing=扣減庫存錯誤,購物車不存在 +hard.stock.op.fail={0}錯誤 + +wallet.transfer.source.low=源錢包{0}餘額不足 +wallet.transfer.limit.exceeded=已經超過最大轉賬金額限制 +wallet.transfer.not.found=查詢不到轉賬記錄 +wallet.transfer.refund.dup=已退回請勿重複操作 +wallet.transfer.refund.source.low=源錢包{0}餘額不足,無法退回 +wallet.apply.dup.submit=已提交申請,請勿重複提交 +act.cancel.not.found=核銷活動不存在 +act.cancel.closed=核銷活動已關閉 +act.cancel.mch.missing=核銷活動商戶不存在 +act.cancel.already.received=您已經領,請勿重複領取 +act.cancel.balance.low=消費錢包餘額不足{0}元,無法領取 +act.cancel.coupon.expired=您領取的優惠券已過期 +act.coupon.not.found=優惠券不存在 +act.not.found=活動不存在 +act.coupon.points.deduct.fail=扣減積分錯誤 +act.id.empty=活動id不能為空 + +sys.face.max.count=最多只能上傳3張人臉圖片 +sys.face.max.active=審核中和已通過的人臉合計最多只能保留3張 +sys.face.dup.image=請勿重複提交同一張人臉圖片 +sys.face.dept.missing=當前用戶所屬部門不存在,無法發起人臉審核 +sys.face.ward.only=僅可查看或操作本人及有效被監護人的人臉審核記錄 +sys.face.record.missing=人臉審核記錄不存在 +sys.face.revoke.status=只有審核中的人臉記錄可以撤銷 +sys.face.status.changed=人臉審核狀態已發生變化,請刷新後重試 +sys.car.plate.dup=車牌號不能重複 + +hard.idem.applying=正在申請中,請勿重複操作 +hard.idem.canceling=正在取消中,請勿重複操作 +hard.idem.processing=正在處理中,請勿重複操作 +hard.idem.refunding=正在退款中,請勿重複操作 +hard.idem.batch.refund=批量退款任務正在提交,請勿重複操作 +act.idem.receiving=正在領取中,請勿重複操作 +wallet.idem.applying=正在申請中,請勿重複操作 +wallet.idem.opening=正在開卡中,請勿重複提交 +wallet.idem.processing=正在處理中,請勿重複提交 +wallet.idem.importing=正在導入中,請勿重複操作 +wallet.idem.recharging=正在充值中,請勿重複操作 +wallet.idem.uploading=正在上傳中,請勿重複操作 +wallet.idem.invoice=正在重新生成發票中,請勿重複操作 + +mall.product.create.fail=商品創建失敗 +mall.product.id.empty=商品ID不能為空 +mall.product.update.fail=商品更新失敗 +mall.product.list.fail=獲取商品列表失敗 +mall.product.delete.fail=商品刪除失敗 +mall.category.create.fail=商品分類創建失敗 +mall.category.id.empty=分類ID不能為空 +mall.category.update.fail=分類更新失敗 +mall.category.delete.fail=分類刪除失敗 +mall.category.list.fail=獲取分類列表失敗 + +third.wx.profit.amount.min=微信分賬支付金額必須大於10分 +third.wx.profit.amount.range=微信平台抽佣金額必須不少於1分且不能超過訂單金額 +third.pay.config.missing=支付配置不存在 +third.wx.refund.amount.bad=微信退款金額必須大於0且不能超過訂單金額 +third.pay.order.status.no.refund=支付訂單當前狀態不允許退款 +third.ali.qr.create.fail=創建支付寶訂單碼失敗,請稍後重試 +third.ali.amount.invalid=支付寶支付金額必須大於0分 +third.ali.zt.amount.min=支付寶直付通支付金額必須大於10分 +third.wx.refund.apply.error=微信退款申請錯誤異常 +third.wx.refund.queued=微信退款請求已進入補償隊列,請稍後查詢結果 +third.ali.refund.amount.bad=支付寶退款金額必須大於0且不能超過訂單金額 +sys.register.suspended=暫時停止註冊! diff --git a/pjcloud-common/pjcloud-common-sentinel/src/main/java/com/bsd/pjcloud/common/sentinel/handle/GlobalBizExceptionHandler.java b/pjcloud-common/pjcloud-common-sentinel/src/main/java/com/bsd/pjcloud/common/sentinel/handle/GlobalBizExceptionHandler.java index b5c4a3f8..e447770a 100644 --- a/pjcloud-common/pjcloud-common-sentinel/src/main/java/com/bsd/pjcloud/common/sentinel/handle/GlobalBizExceptionHandler.java +++ b/pjcloud-common/pjcloud-common-sentinel/src/main/java/com/bsd/pjcloud/common/sentinel/handle/GlobalBizExceptionHandler.java @@ -67,7 +67,7 @@ public class GlobalBizExceptionHandler { // 业务异常交由 sentinel 记录 Tracer.trace(e); - return R.failed(e.getLocalizedMessage()); + return R.failed(resolveClientMessage(e.getLocalizedMessage())); } /** @@ -153,4 +153,31 @@ public class GlobalBizExceptionHandler { return R.failed(exception.getMessage()); } + /** + * 将已知的硬编码中文(如幂等注解 info)映射为当前语言文案。 + */ + private String resolveClientMessage(String message) { + if (message == null || message.isBlank()) { + return message; + } + return switch (message) { + case "正在创建订单中,请勿重复操作" -> MsgUtils.getMessage(ErrorCodes.HARD_IDEM_CREATE); + case "正在核销中,请勿重复操作" -> MsgUtils.getMessage(ErrorCodes.HARD_IDEM_VERIFY); + case "正在退回核销状态,请勿重复操作" -> MsgUtils.getMessage(ErrorCodes.HARD_IDEM_ROLLBACK); + case "正在申请中,请勿重复操作" -> MsgUtils.getMessage(ErrorCodes.HARD_IDEM_APPLYING); + case "正在取消中,请勿重复操作" -> MsgUtils.getMessage(ErrorCodes.HARD_IDEM_CANCELING); + case "正在处理中,请勿重复操作", "正在处理中,请勿重复提交" -> MsgUtils.getMessage(ErrorCodes.HARD_IDEM_PROCESSING); + case "正在退款中,请勿重复操作" -> MsgUtils.getMessage(ErrorCodes.HARD_IDEM_REFUNDING); + case "批量退款任务正在提交,请勿重复操作" -> MsgUtils.getMessage(ErrorCodes.HARD_IDEM_BATCH_REFUND); + case "正在领取中,请勿重复操作" -> MsgUtils.getMessage(ErrorCodes.ACT_IDEM_RECEIVING); + case "正在开卡中,请勿重复提交" -> MsgUtils.getMessage(ErrorCodes.WALLET_IDEM_OPENING); + case "正在导入中,请勿重复操作" -> MsgUtils.getMessage(ErrorCodes.WALLET_IDEM_IMPORTING); + case "正在充值中,请勿重复操作" -> MsgUtils.getMessage(ErrorCodes.WALLET_IDEM_RECHARGING); + case "正在上传中,请勿重复操作" -> MsgUtils.getMessage(ErrorCodes.WALLET_IDEM_UPLOADING); + case "正在重新生成发票中,请勿重复操作" -> MsgUtils.getMessage(ErrorCodes.WALLET_IDEM_INVOICE); + case "重复请求,请稍后重试" -> MsgUtils.getMessage("common.idempotent.retry"); + default -> message; + }; + } + } diff --git a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/controller/order/HardCarController.java b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/controller/order/HardCarController.java index 03c6fdea..6596fd6e 100644 --- a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/controller/order/HardCarController.java +++ b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/controller/order/HardCarController.java @@ -1,4 +1,7 @@ package com.bsd.pjcloud.hard.controller.order; + +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.exception.I18nBizException; import com.bsd.pjcloud.common.api.encrypt.annotation.crypto.ApiCryptoAes; import cn.hutool.core.util.ArrayUtil; @@ -63,7 +66,7 @@ public class HardCarController { public R appGetParentCar(@RequestParam Long id) { HardParentCarEntity parentCar = hardParentCarService.getById(id); if (parentCar == null || !ObjectUtil.equals(parentCar.getUserId(), SecurityUtils.getUser().getId())) { - throw new RuntimeException("购物车不存在或无权查看"); + throw new I18nBizException(ErrorCodes.HARD_CART_NO_VIEW); } return R.ok(parentCar); } diff --git a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/HardApptMerchantModeServiceImpl.java b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/HardApptMerchantModeServiceImpl.java index af3b1129..25ed7216 100644 --- a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/HardApptMerchantModeServiceImpl.java +++ b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/HardApptMerchantModeServiceImpl.java @@ -1,5 +1,8 @@ package com.bsd.pjcloud.hard.service.impl; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.exception.I18nBizException; + import cn.hutool.core.util.ObjectUtil; import com.bsd.pjcloud.common.core.util.R; import com.bsd.pjcloud.hard.api.constant.HardApptReserveModeEnum; @@ -22,23 +25,21 @@ public class HardApptMerchantModeServiceImpl implements HardApptMerchantModeServ @Override public MerchantModeContext resolve(Long mchId) { if (ObjectUtil.isEmpty(mchId)) { - throw new RuntimeException("商户ID不能为空"); + throw new I18nBizException(ErrorCodes.COMMON_MCH_ID_EMPTY); } R result; try { result = remoteMchService.getById(mchId); } catch (RuntimeException exception) { - throw new RuntimeException("获取商户预约配置失败", exception); + throw new I18nBizException(ErrorCodes.HARD_APPT_MCH_CONF_FAIL); } if (result == null || !result.isOk()) { - String message = result == null || ObjectUtil.isEmpty(result.getMsg()) - ? "获取商户预约配置失败" : result.getMsg(); - throw new RuntimeException(message); + throw new I18nBizException(ErrorCodes.HARD_APPT_MCH_CONF_FAIL); } MchManageVo merchant = result.getData(); if (merchant == null) { - throw new RuntimeException("商户不存在"); + throw new I18nBizException(ErrorCodes.COMMON_MCH_NOT_FOUND); } MchManageEntity.TableReservationConf conf = merchant.getTableReservationConf(); @@ -46,7 +47,7 @@ public class HardApptMerchantModeServiceImpl implements HardApptMerchantModeServ HardApptReserveModeEnum reserveMode = HardApptReserveModeEnum.valueOfByType( modeValue == null ? null : modeValue.trim()); if (reserveMode == null) { - throw new RuntimeException("商户预约时间模式无效"); + throw new I18nBizException(ErrorCodes.HARD_APPT_MCH_MODE_INVALID); } return new MerchantModeContext(merchant, reserveMode); } diff --git a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/HardApptReservationServiceImpl.java b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/HardApptReservationServiceImpl.java index 2dddc62b..ba3ede16 100644 --- a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/HardApptReservationServiceImpl.java +++ b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/HardApptReservationServiceImpl.java @@ -1,5 +1,9 @@ package com.bsd.pjcloud.hard.service.impl; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.exception.I18nBizException; +import com.bsd.pjcloud.common.core.util.MsgUtils; + import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -294,11 +298,10 @@ public class HardApptReservationServiceImpl implements HardApptReservationServic return Availability.available(start, end); } if (now.isBefore(start)) { - String reason = "周" + weekdayLabel(rule.getOpenWeekday()) - + rule.getOpenTime().format(TIME_FORMATTER) + "开放"; - return Availability.unavailable(reason, start, end); + return Availability.unavailableI18n(ErrorCodes.HARD_APPT_CYCLE_OPEN_AT, start, end, + weekdayLabel(rule.getOpenWeekday()), rule.getOpenTime().format(TIME_FORMATTER)); } - return Availability.unavailable("本期预约已截止", start, end); + return Availability.unavailableI18n(ErrorCodes.HARD_APPT_PERIOD_CLOSED, start, end); } @Override @@ -312,50 +315,50 @@ public class HardApptReservationServiceImpl implements HardApptReservationServic HardApptReserveModeEnum merchantMode = resolveMerchantMode(mchId); if (merchantMode == HardApptReserveModeEnum.WEEKLY_CYCLE) { if (apptRuleId == null) { - throw new RuntimeException("周期预约规则不能为空"); + throw new I18nBizException(ErrorCodes.HARD_APPT_CYCLE_RULE_REQUIRED); } return validateCycleReservation(mchId, apptRuleId, hourType, apptDate, now); } if (apptRuleId != null) { - throw new RuntimeException("当前商户使用动态时间窗,不能提交周期预约规则"); + throw new I18nBizException(ErrorCodes.HARD_APPT_CYCLE_NOT_ALLOWED); } if (ObjectUtil.isEmpty(apptId)) { - throw new RuntimeException("动态预约餐段不能为空"); + throw new I18nBizException(ErrorCodes.HARD_APPT_DYNAMIC_SLOT_EMPTY); } HardApptEntity appt = hardApptService.getById(apptId); if (appt == null) { - throw new RuntimeException("预约餐段不存在"); + throw new I18nBizException(ErrorCodes.HARD_APPT_SLOT_MISSING); } if (ObjectUtil.notEqual(mchId, appt.getMchId())) { - throw new RuntimeException("预约餐段与当前商户不匹配"); + throw new I18nBizException(ErrorCodes.HARD_APPT_SLOT_MCH_MISMATCH); } if (ObjectUtil.notEqual(YesNoEnum.YES.getCode(), appt.getStatus())) { - throw new RuntimeException("预约餐段已停用"); + throw new I18nBizException(ErrorCodes.HARD_APPT_SLOT_DISABLED); } HardApptReserveModeEnum reserveMode = resolveMode(appt); if (reserveMode != HardApptReserveModeEnum.TIME_WINDOW) { - throw new RuntimeException("预约餐段与商户当前模式不匹配"); + throw new I18nBizException(ErrorCodes.HARD_APPT_SLOT_MODE_MISMATCH); } LocalDate targetDate = resolveLegacyApptDate(apptDate, legacyApptTimeType, now.toLocalDate()); long dayOffset = ChronoUnit.DAYS.between(now.toLocalDate(), targetDate); HardApptTimeTypeEnum dateType = HardApptTimeTypeEnum.valueOfByDay((int) dayOffset); if (dateType == null || !HardApptTimeTypeEnum.isReservationDateType(dateType.getType())) { - throw new RuntimeException("该预约日期不在可选范围内"); + throw new I18nBizException(ErrorCodes.HARD_APPT_DATE_OUT_RANGE); } long mappingCount = hardApptTimeService.count(new LambdaQueryWrapper() .eq(HardApptTimeEntity::getMchId, mchId) .eq(HardApptTimeEntity::getApptId, apptId) .eq(HardApptTimeEntity::getType, dateType.getType())); if (mappingCount == 0) { - throw new RuntimeException("该日期未配置此预约餐段"); + throw new I18nBizException(ErrorCodes.HARD_APPT_DATE_NO_SLOT); } Availability availability = evaluateAvailability(appt, targetDate, now); if (!availability.available()) { - throw new RuntimeException(availability.unavailableReason()); + throwUnavailable(availability); } return new ReservationValidation(appt, appt.getHourType(), targetDate, null, availability.endDateTime(), resolveUsageEndDateTime(targetDate)); @@ -363,19 +366,19 @@ public class HardApptReservationServiceImpl implements HardApptReservationServic private ReservationValidation validateCycleReservation(Long mchId, Long apptRuleId, String hourType, LocalDate apptDate, LocalDateTime now) { if (apptDate == null || HardHourTypeEnum.valueOfByType(hourType) == null) { - throw new RuntimeException("周期预约需要选择预约日期和餐端"); + throw new I18nBizException(ErrorCodes.HARD_APPT_DATE_MEAL_REQUIRED); } List rules = cycleRuleService.listEnabledConfigurations(mchId); HardApptCycleRuleVo selected = rules.stream() .filter(rule -> ObjectUtil.equals(rule.getId(), apptRuleId)) .findFirst() - .orElseThrow(() -> new RuntimeException("周期预约规则不存在或已停用")); + .orElseThrow(() -> new I18nBizException(ErrorCodes.HARD_APPT_CYCLE_MISSING)); CycleMatch match = matchCycleRule(selected, hourType, apptDate, now); if (match == null) { - throw new RuntimeException("该日期未配置此预约餐段"); + throw new I18nBizException(ErrorCodes.HARD_APPT_DATE_NO_SLOT); } if (!match.availability().available()) { - throw new RuntimeException(match.availability().unavailableReason()); + throwUnavailable(match.availability()); } return new ReservationValidation(null, hourType, apptDate, selected.getId(), match.availability().endDateTime(), resolveUsageEndDateTime(apptDate)); @@ -416,7 +419,7 @@ public class HardApptReservationServiceImpl implements HardApptReservationServic private HardApptOptionVo buildOption(HardApptEntity appt, Availability availability) { HardApptOptionVo option = BeanUtil.toBean(appt, HardApptOptionVo.class); option.setAvailable(availability.available()); - option.setUnavailableReason(availability.unavailableReason()); + option.setUnavailableReason(availability.resolvedUnavailableReason()); option.setReserveStartDateTime(availability.startDateTime()); option.setReserveEndDateTime(availability.endDateTime()); return option; @@ -429,7 +432,7 @@ public class HardApptReservationServiceImpl implements HardApptReservationServic option.setHourTypeName(hourType.getDescription()); option.setTitle(hourType.getDescription()); option.setAvailable(availability.available()); - option.setUnavailableReason(availability.unavailableReason()); + option.setUnavailableReason(availability.resolvedUnavailableReason()); option.setReserveStartDateTime(availability.startDateTime()); option.setReserveEndDateTime(availability.endDateTime()); return option; @@ -438,28 +441,28 @@ public class HardApptReservationServiceImpl implements HardApptReservationServic static Availability evaluateAvailability(HardApptEntity appt, LocalDate apptDate, LocalDateTime now) { HardApptReserveModeEnum reserveMode = HardApptReserveModeEnum.valueOfByType(appt.getReserveMode()); if (reserveMode == null) { - return Availability.unavailable("预约规则模式无效"); + return Availability.unavailableI18n(ErrorCodes.HARD_APPT_RULE_MODE_INVALID); } if (reserveMode == HardApptReserveModeEnum.WEEKLY_CYCLE) { - return Availability.unavailable("周期预约规则配置不完整"); + return Availability.unavailableI18n(ErrorCodes.HARD_APPT_RULE_INCOMPLETE); } HardApptTimeTypeEnum startType = HardApptTimeTypeEnum.valueOfByType(appt.getStartTimeType()); HardApptTimeTypeEnum endType = HardApptTimeTypeEnum.valueOfByType(appt.getEndTimeType()); if (startType == null || endType == null || appt.getStartTime() == null || appt.getEndTime() == null) { - return Availability.unavailable("预约规则配置不完整"); + return Availability.unavailableI18n(ErrorCodes.HARD_APPT_RULE_INCOMPLETE); } LocalDateTime startDateTime = apptDate.plusDays(startType.getDay()).atTime(appt.getStartTime()); LocalDateTime endDateTime = apptDate.plusDays(endType.getDay()).atTime(appt.getEndTime()); if (!endDateTime.isAfter(startDateTime)) { - return Availability.unavailable("预约规则时间范围无效"); + return Availability.unavailableI18n(ErrorCodes.HARD_APPT_RULE_TIME_INVALID); } if (now.isBefore(startDateTime)) { - return Availability.unavailable("预约尚未开放", startDateTime, endDateTime); + return Availability.unavailableI18n(ErrorCodes.HARD_APPT_NOT_OPEN, startDateTime, endDateTime); } if (now.isAfter(endDateTime)) { - return Availability.unavailable("预约已截止", startDateTime, endDateTime); + return Availability.unavailableI18n(ErrorCodes.HARD_APPT_CLOSED, startDateTime, endDateTime); } // 业务要求开始和结束准点均可提交,因此使用闭区间 [start, end]。 return Availability.available(startDateTime, endDateTime); @@ -471,7 +474,7 @@ public class HardApptReservationServiceImpl implements HardApptReservationServic } HardApptTimeTypeEnum legacyType = HardApptTimeTypeEnum.valueOfByTypeOrToday(legacyApptTimeType); if (legacyType == null || !HardApptTimeTypeEnum.isReservationDateType(legacyType.getType())) { - throw new RuntimeException("预约日期类型无效"); + throw new I18nBizException(ErrorCodes.HARD_APPT_DATE_TYPE_INVALID); } return today.plusDays(legacyType.getDay()); } @@ -483,9 +486,8 @@ public class HardApptReservationServiceImpl implements HardApptReservationServic if (batch.open()) { return Availability.available(start, end); } - String reason = "周" + weekdayLabel(rule.getOpenWeekday()) - + rule.getOpenTime().format(TIME_FORMATTER) + "开放"; - return Availability.unavailable(reason, start, end); + return Availability.unavailableI18n(ErrorCodes.HARD_APPT_CYCLE_OPEN_AT, start, end, + weekdayLabel(rule.getOpenWeekday()), rule.getOpenTime().format(TIME_FORMATTER)); } private List findEnabledAppts(Long mchId, HardApptReserveModeEnum reserveMode) { @@ -549,11 +551,20 @@ public class HardApptReservationServiceImpl implements HardApptReservationServic }; } + private void throwUnavailable(Availability availability) { + if (availability.unavailableCode() != null) { + throw new I18nBizException(availability.unavailableCode(), + availability.unavailableArgs() == null ? new Object[0] : availability.unavailableArgs()); + } + throw new I18nBizException(ErrorCodes.HARD_APPT_CLOSED); + } + record Availability(boolean available, String unavailableReason, + String unavailableCode, Object[] unavailableArgs, LocalDateTime startDateTime, LocalDateTime endDateTime) { static Availability available(LocalDateTime startDateTime, LocalDateTime endDateTime) { - return new Availability(true, null, startDateTime, endDateTime); + return new Availability(true, null, null, null, startDateTime, endDateTime); } static Availability unavailable(String reason) { @@ -561,7 +572,23 @@ public class HardApptReservationServiceImpl implements HardApptReservationServic } static Availability unavailable(String reason, LocalDateTime startDateTime, LocalDateTime endDateTime) { - return new Availability(false, reason, startDateTime, endDateTime); + return new Availability(false, reason, null, null, startDateTime, endDateTime); + } + + static Availability unavailableI18n(String code, LocalDateTime startDateTime, LocalDateTime endDateTime, + Object... args) { + return new Availability(false, null, code, args, startDateTime, endDateTime); + } + + static Availability unavailableI18n(String code, Object... args) { + return new Availability(false, null, code, args, null, null); + } + + String resolvedUnavailableReason() { + if (unavailableCode != null) { + return MsgUtils.getMessage(unavailableCode, unavailableArgs == null ? new Object[0] : unavailableArgs); + } + return unavailableReason; } } diff --git a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/HardTakeOutDeliveryTimeOptionServiceImpl.java b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/HardTakeOutDeliveryTimeOptionServiceImpl.java index a016a4c8..9f86e579 100644 --- a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/HardTakeOutDeliveryTimeOptionServiceImpl.java +++ b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/HardTakeOutDeliveryTimeOptionServiceImpl.java @@ -1,5 +1,8 @@ package com.bsd.pjcloud.hard.service.impl; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; + +import com.bsd.pjcloud.common.core.util.MsgUtils; import com.bsd.pjcloud.common.core.util.R; import com.bsd.pjcloud.hard.api.vo.order.app.HardTakeOutDeliveryTimeDayVO; import com.bsd.pjcloud.hard.api.vo.order.app.HardTakeOutDeliveryTimeOptionVO; @@ -31,12 +34,12 @@ public class HardTakeOutDeliveryTimeOptionServiceImpl implements HardTakeOutDeli @Override public R listDeliveryTimeSlots(Long merchantId, LocalDate expectDate, Integer days, Integer slotMinutes, Integer leadMinutes) { if (merchantId == null) { - return R.failed("商户ID不能为空"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_MCH_ID_EMPTY)); } LocalDate today = LocalDate.now(); LocalDate startDate = expectDate != null ? expectDate : today; if (startDate.isBefore(today)) { - return R.failed("不能选择过去的日期"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_PAST_DATE_NOT_ALLOWED)); } int dayCount = days == null || days < 1 ? DEFAULT_DAY_COUNT : Math.min(days, MAX_DAY_COUNT); int sm = slotMinutes == null || slotMinutes <= 0 ? DEFAULT_SLOT_MINUTES : Math.min(slotMinutes, MAX_SLOT_MINUTES); @@ -44,7 +47,7 @@ public class HardTakeOutDeliveryTimeOptionServiceImpl implements HardTakeOutDeli R r = remoteMchService.getById(merchantId); if (r == null || !r.isOk() || r.getData() == null) { - return R.failed("商户不存在"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_MCH_NOT_FOUND)); } MchManageVo mch = r.getData(); String jobTime = mch.getJobTime(); diff --git a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/address/HardUserMapAddressServiceImpl.java b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/address/HardUserMapAddressServiceImpl.java index 363d46b0..916d9bfd 100755 --- a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/address/HardUserMapAddressServiceImpl.java +++ b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/address/HardUserMapAddressServiceImpl.java @@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.bsd.pjcloud.admin.api.dto.UserInfo; import com.bsd.pjcloud.admin.api.feign.RemoteUserService; import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.exception.I18nBizException; import com.bsd.pjcloud.common.core.util.BeanUtils; import com.bsd.pjcloud.common.data.datascope.DataScope; import com.bsd.pjcloud.hard.api.dto.address.HardUserMapAddressDto; @@ -38,11 +40,11 @@ public class HardUserMapAddressServiceImpl extends ServiceImpl afterSales = listOrderAfterSales(order.getId()); if (afterSales.stream().anyMatch(item -> ObjectUtil.equals(item.getStatus(), HardSaleStatusEnum.APPLY.getStatus()))) { - throw new RuntimeException("当前订单已有退款申请待审核,请勿重复提交"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_PENDING_DUP); } List originalCars = getOriginalCars(order); List refundCars; if (dto.getCarList() == null) { if (hasEffectiveRefund(afterSales)) { - throw new RuntimeException("当前版本不支持部分退款后的继续申请,请升级应用后重试"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_PARTIAL_CONTINUE_UNSUPPORTED); } refundCars = buildLegacyWholeOrderRefundCars(order, originalCars); } else { @@ -242,7 +245,7 @@ public class HardAfterSaleServiceImpl extends ServiceImpl safePrice(order.getPayPrice())) { - throw new RuntimeException("本次退款金额超出订单剩余可退金额"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_AMOUNT_EXCEED); } HardAfterSaleEntity afterSale = new HardAfterSaleEntity(); @@ -282,12 +285,12 @@ public class HardAfterSaleServiceImpl extends ServiceImpl originalCars = getOriginalCars(order); List afterSales = listOrderAfterSales(orderId); @@ -392,7 +395,7 @@ public class HardAfterSaleServiceImpl extends ServiceImpl getSelf().cancelAfterSaleInTransaction(userId, afterSaleId)); } @@ -451,11 +454,11 @@ public class HardAfterSaleServiceImpl extends ServiceImpl safePrice(order.getPayPrice()) || completedRefundPrice + refundPrice > safePrice(order.getPayPrice())) { - throw new RuntimeException("退款总金额大于支付总金额"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_AMOUNT_GT_PAY); } HardOrderTypeEnum hardOrderType = HardOrderTypeEnum.valueOfByType(order.getOrderType()); HardPayTypeEnum hardPayType = HardPayTypeEnum.valueOfByType(order.getPayType()); @@ -661,7 +664,7 @@ public class HardAfterSaleServiceImpl extends ServiceImpl walletRefundResult = walletRechargeService.refund(hardRefundDto); if (walletRefundResult == null || !walletRefundResult.isOk() || ObjectUtil.isEmpty(walletRefundResult.getData())) { - throw new RuntimeException("钱包退款错误"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_WALLET_REFUND_FAIL); } WalletRechargeVo walletRefund = walletRefundResult.getData(); HardOrderEntity updateObj = HardOrderEntity.builder() @@ -679,10 +682,10 @@ public class HardAfterSaleServiceImpl extends ServiceImpl refundRes = thirdAppPlusPayService.remoterRefund(refundDto); if (!refundRes.isOk()) { - throw new RuntimeException("微信退款错误:" + refundRes.getMsg()); + throw new I18nBizException(ErrorCodes.AFTER_SALE_WX_REFUND_FAIL_MSG, refundRes.getMsg()); } if (ObjectUtil.isEmpty(refundRes.getData())) { - throw new RuntimeException("微信退款错误"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_WX_REFUND_FAIL); } hardOrderService.updateById(HardOrderEntity.builder().id(order.getId()).payRefundId(order.getId()).build()); } @@ -695,14 +698,14 @@ public class HardAfterSaleServiceImpl extends ServiceImpl refundRes = thirdAppPlusPayService.remoterRefund(refundDto); if (!refundRes.isOk()) { - throw new RuntimeException("支付宝退款错误:" + refundRes.getMsg()); + throw new I18nBizException(ErrorCodes.AFTER_SALE_ALI_REFUND_FAIL_MSG, refundRes.getMsg()); } if (ObjectUtil.isEmpty(refundRes.getData())) { - throw new RuntimeException("支付宝退款错误"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_ALI_REFUND_FAIL); } hardOrderService.updateById(HardOrderEntity.builder().id(order.getId()).payRefundId(order.getId()).build()); } else { - throw new RuntimeException("不支持的退款类型"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_UNSUPPORTED_TYPE); } baseMapper.updateById(HardAfterSaleEntity.builder().id(afterSaleId).refundTime(LocalDateTime.now()).build()); return order; @@ -719,14 +722,14 @@ public class HardAfterSaleServiceImpl extends ServiceImpl getSelf().agreeAfterSaleInTransaction(userId, id)); } @@ -904,7 +907,7 @@ public class HardAfterSaleServiceImpl extends ServiceImpl getSelf().returnToReviewInTransaction(userId, id)); } @@ -953,7 +956,7 @@ public class HardAfterSaleServiceImpl extends ServiceImpl getSelf().disagreeRefundInTransaction(userId, dto)); } @@ -1049,7 +1052,7 @@ public class HardAfterSaleServiceImpl extends ServiceImpl ObjectUtil.isNotEmpty(v.getRefundPrice())).map(HardAfterSaleEntity::getRefundPrice).reduce(0, Integer::sum); if (totalPrice >= safePrice(order.getPayPrice())) { if (totalPrice > safePrice(order.getPayPrice())) { - throw new RuntimeException("退款总金额大于支付总金额"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_AMOUNT_GT_PAY); } - throw new RuntimeException("订单已全部退款"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_ORDER_FULLY_REFUNDED); } if (totalPrice < 0) { - throw new RuntimeException("退款总金额大于支付总金额"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_AMOUNT_GT_PAY); } return orderVo; } @@ -1097,34 +1100,34 @@ public class HardAfterSaleServiceImpl extends ServiceImpl refundCarList) { - if (ObjectUtil.isEmpty(refundCarList)) throw new RuntimeException("售后商品列表不能为空"); + if (ObjectUtil.isEmpty(refundCarList)) throw new I18nBizException(ErrorCodes.AFTER_SALE_PRODUCT_LIST_EMPTY); // 查询订单购物车 List orderCarList = hardCarService.getByParentCarId(order.getParentCarId()); - if (ObjectUtil.isEmpty(orderCarList)) throw new RuntimeException("订单购物车不存在"); + if (ObjectUtil.isEmpty(orderCarList)) throw new I18nBizException(ErrorCodes.AFTER_SALE_ORDER_CART_MISSING); // 查询已退款商品 List refundSuccessCarList = hardAfterSaleCarService.getOccupiedByCarParentId(order.getParentCarId()); Map requestedCountByProductId = new LinkedHashMap<>(); for (HardAfterSaleCarEntity refundCar : refundCarList) { if (refundCar == null || (refundCar.getProductId() == null && refundCar.getId() == null)) { - throw new RuntimeException("退款商品不能为空"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_REFUND_PRODUCT_EMPTY); } HardCarEntity orderCar = resolveRefundOrderCar(orderCarList, refundCar); - if (orderCar == null) throw new RuntimeException("退款商品<" + refundCar.getProductName() + ">不存在"); + if (orderCar == null) throw new I18nBizException(ErrorCodes.AFTER_SALE_REFUND_PRODUCT_MISSING, refundCar.getProductName()); // 后续金额、售后快照和库存恢复都以服务端商品 ID 为准,兼容后台历史提交的购物车行 ID。 refundCar.setProductId(orderCar.getProductId()); // 按数量商品必须提交有效份数;称重商品历史请求可能只提交重量,数量按零参与数量校验。 if (HardProductNatureEnum.DEFAULT.getType().equals(orderCar.getProductNature()) && refundCar.getProductCount() == null) { - throw new RuntimeException("退款商品<" + orderCar.getProductName() + ">数量不能为空"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_REFUND_QTY_EMPTY, orderCar.getProductName()); } if (refundCar.getProductCount() != null && refundCar.getProductCount() < 0) { - throw new RuntimeException("退款商品<" + orderCar.getProductName() + ">数量不能为负数"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_REFUND_QTY_NEGATIVE, orderCar.getProductName()); } int requestCount = refundCar.getProductCount() == null ? 0 : refundCar.getProductCount(); try { requestedCountByProductId.merge(orderCar.getProductId(), requestCount, Math::addExact); } catch (ArithmeticException exception) { - throw new RuntimeException("退款商品<" + orderCar.getProductName() + ">数量异常"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_REFUND_QTY_INVALID, orderCar.getProductName()); } } Map occupiedCountByProductId = refundSuccessCarList.stream() @@ -1135,7 +1138,7 @@ public class HardAfterSaleServiceImpl extends ServiceImpl originalCountByProductId = orderCarList.stream() @@ -1146,7 +1149,7 @@ public class HardAfterSaleServiceImpl extends ServiceImpl { @@ -1156,13 +1159,13 @@ public class HardAfterSaleServiceImpl extends ServiceImpl originalCount) { HardCarEntity orderCar = orderCarList.stream() .filter(item -> ObjectUtil.equal(item.getProductId(), productId)) .findFirst().orElse(null); - throw new RuntimeException("退款商品<" + (orderCar == null ? productId : orderCar.getProductName()) + ">数量超出"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_REFUND_QTY_EXCEED, orderCar == null ? productId : orderCar.getProductName()); } }); } @@ -1210,7 +1213,7 @@ public class HardAfterSaleServiceImpl extends ServiceImpl getOriginalCars(HardOrderEntity order) { List cars = hardCarService.getByParentCarId(order.getParentCarId()); if (ObjectUtil.isEmpty(cars)) { - throw new RuntimeException("订单购物车不存在"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_ORDER_CART_MISSING); } return cars; } @@ -1395,31 +1398,31 @@ public class HardAfterSaleServiceImpl extends ServiceImpl result = new ArrayList<>(); for (HardAppRefundItemDto requestItem : requestItems) { if (!selectedProductIds.add(requestItem.getProductId())) { - throw new RuntimeException("同一商品不能重复提交"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_DUP_PRODUCT); } HardAppRefundProductVo product = allocations.get(requestItem.getProductId()); if (product == null) { - throw new RuntimeException("退款商品不属于当前订单"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_PRODUCT_NOT_IN_ORDER); } if (!ObjectUtil.equals(product.getProductNature(), HardProductNatureEnum.DEFAULT.getType())) { - throw new RuntimeException("称重商品暂不支持在线逐份退款"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_WEIGHTED_NO_PARTIAL); } int requestCount = requestItem.getProductCount() == null ? 0 : requestItem.getProductCount(); int occupiedCount = occupiedCounts.getOrDefault(product.getProductId(), 0); if (requestCount <= 0 || occupiedCount + requestCount > product.getOriginalCount()) { - throw new RuntimeException("退款商品<" + product.getProductName() + ">数量超出可退范围"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_REFUND_QTY_OUT_RANGE, product.getProductName()); } int beforePrice = cumulativeProductPrice(product, occupiedCount); int afterPrice = cumulativeProductPrice(product, occupiedCount + requestCount); int currentPrice = afterPrice - beforePrice; if (currentPrice < 0) { - throw new RuntimeException("退款商品<" + product.getProductName() + ">退款金额异常"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_REFUND_AMOUNT_INVALID, product.getProductName()); } // 赠品或全额优惠商品的分摊额可以为零;允许其与正金额商品一同申请,确保审核后仍能按所选份数恢复库存。 result.add(toAfterSaleCar(product, requestCount, currentPrice)); } if (result.isEmpty()) { - throw new RuntimeException("请选择需要退款的商品"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_SELECT_PRODUCT); } return result; } @@ -1435,7 +1438,7 @@ public class HardAfterSaleServiceImpl extends ServiceImpl products = new TreeMap<>(); for (HardCarEntity car : originalCars) { if (car.getProductId() == null) { - throw new RuntimeException("订单商品数据异常"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_ORDER_PRODUCT_BAD); } HardAppRefundProductVo product = products.computeIfAbsent(car.getProductId(), productId -> { HardAppRefundProductVo item = new HardAppRefundProductVo(); @@ -1458,7 +1461,7 @@ public class HardAfterSaleServiceImpl extends ServiceImpl afterSales = listOrderAfterSales(orderId); int completedPrice = sumRefundPrice(afterSales, HardSaleStatusEnum.COMPLETE.getStatus()); @@ -1678,7 +1681,7 @@ public class HardAfterSaleServiceImpl extends ServiceImpl afterSales = listOrderAfterSales(order.getId()); if (afterSales.stream().anyMatch(item -> ObjectUtil.equals(item.getStatus(), HardSaleStatusEnum.APPLY.getStatus()))) { - throw new RuntimeException("当前订单已有退款申请待审核,请先处理后再退款"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_PENDING_HANDLE_FIRST); } int remainingRefundPrice = safePrice(order.getPayPrice()) - sumRefundPrice(afterSales, HardSaleStatusEnum.COMPLETE.getStatus()); if (remainingRefundPrice <= 0) { - throw new RuntimeException("订单已全部退款"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_ORDER_FULLY_REFUNDED); } HardPayTypeEnum payType = HardPayTypeEnum.valueOfByType(lockedOrder.getPayType()); HardOrderTypeEnum orderType = HardOrderTypeEnum.valueOfByType(lockedOrder.getOrderType()); @@ -1806,7 +1809,7 @@ public class HardAfterSaleServiceImpl extends ServiceImpl ObjectUtil.equals(item.getStatus(), HardSaleStatusEnum.APPLY.getStatus()))) { - throw new RuntimeException("当前订单已有退款申请待审核,请先处理后再退款"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_PENDING_HANDLE_FIRST); } // 判断是否快速支付 HardPayTypeEnum hardPayType = HardPayTypeEnum.valueOfByType(order.getPayType()); - if (ObjectUtil.isEmpty(hardPayType)) throw new RuntimeException("订单类型错误"); + if (ObjectUtil.isEmpty(hardPayType)) throw new I18nBizException(ErrorCodes.AFTER_SALE_ORDER_TYPE_ERROR); HardOrderTypeEnum orderType = HardOrderTypeEnum.valueOfByType(order.getOrderType()); - if (ObjectUtil.isEmpty(orderType)) throw new RuntimeException("订单类型错误"); + if (ObjectUtil.isEmpty(orderType)) throw new I18nBizException(ErrorCodes.AFTER_SALE_ORDER_TYPE_ERROR); // 如果是简单支付(没有购物车)的支付方式就直接返回 boolean isSimplePayList = HardPayTypeEnum.isSimplePayList.contains(hardPayType); if (!isSimplePayList) { isSimplePayList = HardOrderTypeEnum.isSimplePayList.contains(orderType); } if (!isSimplePayList) { - if (ObjectUtil.isEmpty(dto.getCarList())) throw new RuntimeException("退款商品列表不能为空"); + if (ObjectUtil.isEmpty(dto.getCarList())) throw new I18nBizException(ErrorCodes.AFTER_SALE_REFUND_LIST_EMPTY); // 校验订单购物车是否支持退款 validateOrderCarCanRefund(order, dto.getCarList()); } @@ -1922,7 +1925,7 @@ public class HardAfterSaleServiceImpl extends ServiceImpl refundCarList) { List orderCarList = hardCarService.getByParentCarId(order.getParentCarId()); if (ObjectUtil.isEmpty(orderCarList)) { - throw new RuntimeException("订单购物车不存在"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_ORDER_CART_MISSING); } Map refundCountByProductId = new LinkedHashMap<>(); try { @@ -2149,7 +2152,7 @@ public class HardAfterSaleServiceImpl extends ServiceImpl refundCarList) { List orderCarList = hardCarService.getByParentCarId(order.getParentCarId()); if (ObjectUtil.isEmpty(orderCarList)) { - throw new RuntimeException("订单购物车不存在"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_ORDER_CART_MISSING); } Map orderCarMap = orderCarList.stream() .filter(item -> item.getProductId() != null) @@ -2253,15 +2256,15 @@ public class HardAfterSaleServiceImpl extends ServiceImpl afterSales = listOrderAfterSales(orderId); if (afterSales.stream().anyMatch(item -> ObjectUtil.equals(item.getStatus(), HardSaleStatusEnum.APPLY.getStatus()))) { - throw new RuntimeException("当前订单已有退款申请待审核,请先处理后再退款"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_PENDING_HANDLE_FIRST); } int remainingRefundPrice = safePrice(order.getPayPrice()) - sumRefundPrice(afterSales, HardSaleStatusEnum.COMPLETE.getStatus()); if (remainingRefundPrice <= 0) { - throw new RuntimeException("订单已全部退款"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_ORDER_FULLY_REFUNDED); } if (checkTimeLimit && order.getPayTime() != null && order.getPayTime().plusHours(4).isBefore(LocalDateTime.now())) { - throw new RuntimeException("订单已超过4个小时,不能退款"); + throw new I18nBizException(ErrorCodes.AFTER_SALE_REFUND_TIME_EXCEEDED); } HardPayTypeEnum payType = HardPayTypeEnum.valueOfByType(order.getPayType()); @@ -2273,7 +2276,7 @@ public class HardAfterSaleServiceImpl extends ServiceImpl saveBatchCarts(HardCarBatchSaveOrUpdateDto dto, boolean useDailyMenuProducts) { if (dto == null || ObjectUtil.isEmpty(dto.getGroups())) { - throw new RuntimeException("购物车分组不能为空"); + throw new I18nBizException(ErrorCodes.HARD_CAR_GROUP_EMPTY); } HardCarSaveOrUpdateDto firstGroup = dto.getGroups().get(0); if (firstGroup == null || !ObjectUtil.isAllNotEmpty(firstGroup.getUserId(), firstGroup.getMerchantId(), firstGroup.getHardType(), firstGroup.getOrderType())) { - throw new RuntimeException("购物车业务信息不完整"); + throw new I18nBizException(ErrorCodes.HARD_CAR_BIZ_INCOMPLETE); } boolean containsDifferentOwner = dto.getGroups().stream().anyMatch(group -> group == null || !Objects.equals(group.getUserId(), firstGroup.getUserId()) @@ -282,7 +285,7 @@ public class HardCarServiceImpl extends ServiceImpl carList = group.getList().stream() .filter(Objects::nonNull) @@ -298,7 +301,7 @@ public class HardCarServiceImpl extends ServiceImpl item.getProductCount() != null && item.getProductCount() > 0) .toList(); if (carList.size() != group.getList().size()) { - throw new RuntimeException("第" + (groupIndex + 1) + "组购物车商品信息不完整或数量无效"); + throw new I18nBizException(ErrorCodes.HARD_CAR_GROUP_ITEM_INCOMPLETE, groupIndex + 1); } HardProductSourceEnum groupProductSource = useDailyMenuProducts ? HardProductSourceEnum.CANTEEN_DAILY_MENU @@ -312,7 +315,7 @@ public class HardCarServiceImpl extends ServiceImpl productIds = productList.stream().map(HardCreateCarDto::getProductId).distinct().toList(); R> response = canteenSpuService.getInnerSpuListByIds(productIds); if (response == null || !response.isOk() || response.getData() == null) { - String message = response == null || response.getMsg() == null ? "查询每日菜谱商品失败" : response.getMsg(); - throw new RuntimeException(message); + if (response != null && ObjectUtil.isNotEmpty(response.getMsg())) { + throw new RuntimeException(response.getMsg()); + } + throw new I18nBizException(ErrorCodes.HARD_DAILY_PRODUCT_QUERY_FAIL); } Map productMap = new HashMap<>(response.getData().size()); response.getData().stream() @@ -351,10 +356,10 @@ public class HardCarServiceImpl extends ServiceImpl cartItems) { for (HardCarEntity cartItem : cartItems) { if (baseMapper.insert(cartItem) != 1) { - throw new RuntimeException("购物车商品保存失败"); + throw new I18nBizException(ErrorCodes.HARD_CAR_SAVE_FAIL); } } } @@ -860,7 +865,7 @@ public class HardCarServiceImpl extends ServiceImpl permittedMerchants = merchantResult == null ? null : merchantResult.getData(); boolean permitted = ObjectUtil.isNotEmpty(permittedMerchants) && permittedMerchants.stream().anyMatch(merchant -> Objects.equals(merchant.getId(), order.getMerchantId())); if (!permitted) { - throw new RuntimeException("无权管理该商户订单"); + throw new I18nBizException(ErrorCodes.HARD_NO_MCH_ORDER_MANAGE); } } @@ -671,7 +674,7 @@ public class HardOrderServiceImpl extends ServiceImpl mchResult = remoteMchService.getById(order.getMerchantId()); MchManageVo mch = mchResult == null ? null : mchResult.getData(); if (mch == null || ObjectUtil.notEqual(mch.getTypes(), MerchantTypeEnum.SELF_SUPERMARKET.getType())) { - throw new RuntimeException("该订单不是设备扫一扫订单"); + throw new I18nBizException(ErrorCodes.HARD_NOT_DEVICE_SCAN); } // 待支付设备订单必须仍处于二维码有效期内,且尚未绑定任何用户和钱包。 @@ -1288,19 +1291,19 @@ public class HardOrderServiceImpl extends ServiceImpl 200) { - throw new RuntimeException("您有" + reserveCount + "笔未核销的预约订单,请先核销"); + throw new I18nBizException(ErrorCodes.HARD_UNVERIFIED_SELF, reserveCount); } WalletManageEntity wallet = remoteWalletService.getWallet(dto.getUserId(), dto.getWalletType()).getData(); if (ObjectUtil.isEmpty(wallet)) { - throw new RuntimeException("用户钱包不存在"); + throw new I18nBizException(ErrorCodes.COMMON_WALLET_NOT_FOUND); } MchManageVo merchant = remoteMchService.getById(parentCar.getMerchantId()).getData(); if (ObjectUtil.isEmpty(merchant)) { - throw new RuntimeException("商户不存在"); + throw new I18nBizException(ErrorCodes.COMMON_MCH_NOT_FOUND); } List carList = hardCarService.getByParentCarId(dto.getCarParentId()); if (ObjectUtil.isEmpty(carList)) { - throw new RuntimeException("购物车不存在"); + throw new I18nBizException(ErrorCodes.COMMON_CART_NOT_FOUND); } int totalPrice = Math.toIntExact(carList.stream().mapToLong(HardCarEntity::getTotalPrice).sum()); if (wallet.getBalance() < totalPrice) { - throw new RuntimeException("钱包余额不足"); + throw new I18nBizException(ErrorCodes.COMMON_WALLET_BALANCE_INSUFFICIENT); } boolean isPay = isPay(dto.getOrderType(), dto.getPayType()); List carListDto = carList.stream().map(item -> { @@ -1430,48 +1433,48 @@ public class HardOrderServiceImpl extends ServiceImpl dinerUserIds = validateReserveDinerUserIds(payerUserId, dto.getDinerUserIds()); HardParentCarEntity sourceParentCar = hardCarService.getParentCarById(dto.getCarParentId()); if (sourceParentCar == null || !Objects.equals(sourceParentCar.getUserId(), payerUserId)) { - throw new RuntimeException("购物车不存在或不属于当前用户"); + throw new I18nBizException(ErrorCodes.HARD_CART_NOT_OWNED); } if (!Objects.equals(sourceParentCar.getHardType(), HardTypeEnum.CANTEEN.getType())) { - throw new RuntimeException("仅食堂购物车可以多人订餐"); + throw new I18nBizException(ErrorCodes.HARD_MULTI_DINER_CANTEEN_ONLY); } if (!Objects.equals(sourceParentCar.getOrderStatus(), HardOrderStatusEnum.CREATE.getType())) { - throw new RuntimeException("购物车状态已变更,请重新选择商品"); + throw new I18nBizException(ErrorCodes.HARD_CART_STATUS_CHANGED); } if (baseMapper.selectCount(new LambdaQueryWrapper() .eq(HardOrderEntity::getParentCarId, dto.getCarParentId())) > 0) { - throw new RuntimeException("该购物车已创建订单,请勿重复提交"); + throw new I18nBizException(ErrorCodes.HARD_CART_ALREADY_ORDERED); } List sourceCarList = hardCarService.getByParentCarId(dto.getCarParentId()); if (ObjectUtil.isEmpty(sourceCarList)) { - throw new RuntimeException("购物车不存在"); + throw new I18nBizException(ErrorCodes.COMMON_CART_NOT_FOUND); } validateReserveCartItems(sourceCarList); HardApptReservationService.ReservationValidation reservation = hardApptReservationService.validateReservation(sourceParentCar.getMerchantId(), dto.getApptId(), dto.getApptRuleId(), dto.getHourType(), dto.getApptDate(), dto.getApptTimeType()); - MchManageVo merchant = Optional.ofNullable(remoteMchService.getById(sourceParentCar.getMerchantId())).map(R::getData).orElseThrow(() -> new RuntimeException("商户不存在")); + MchManageVo merchant = Optional.ofNullable(remoteMchService.getById(sourceParentCar.getMerchantId())).map(R::getData).orElseThrow(() -> new I18nBizException(ErrorCodes.COMMON_MCH_NOT_FOUND)); if (!Objects.equals(merchant.getTypes(), MerchantTypeEnum.CANTEEN.getType())) { - throw new RuntimeException("购物车商户不是食堂商户"); + throw new I18nBizException(ErrorCodes.HARD_CART_NOT_CANTEEN); } validateMerchantReserveDinerPermissions(payerUserId, dinerUserIds, merchant); - List dinerUsers = Optional.ofNullable(userService.getInnerUserById(dinerUserIds)).map(R::getData).orElseThrow(() -> new RuntimeException("查询用餐人失败")); + List dinerUsers = Optional.ofNullable(userService.getInnerUserById(dinerUserIds)).map(R::getData).orElseThrow(() -> new I18nBizException(ErrorCodes.HARD_DINER_QUERY_FAIL)); Map dinerUserMap = dinerUsers.stream().collect(Collectors.toMap(SysUser::getUserId, Function.identity(), (first, second) -> first)); if (dinerUserMap.size() != dinerUserIds.size()) { - throw new RuntimeException("用餐人不存在"); + throw new I18nBizException(ErrorCodes.HARD_DINER_NOT_FOUND); } for (Long dinerUserId : dinerUserIds) { Long reserveCount = isHaveCanteenReserve(dinerUserId); if (reserveCount >= 200) { - throw new RuntimeException("用餐人已有" + reserveCount + "笔未核销的预约订单,请先核销"); + throw new I18nBizException(ErrorCodes.HARD_UNVERIFIED_DINER, reserveCount); } } int singlePrice = Math.toIntExact(sourceCarList.stream().mapToLong(HardCarEntity::getTotalPrice).sum()); if (singlePrice <= 0) { - throw new RuntimeException("购物车金额异常"); + throw new I18nBizException(ErrorCodes.HARD_CART_AMOUNT_INVALID); } int totalPayPrice = Math.multiplyExact(singlePrice, dinerUserIds.size()); Map dinerWalletMap = resolveReserveDinerWallets(dinerUserIds, dinerUserMap, singlePrice); @@ -1490,7 +1493,7 @@ public class HardOrderServiceImpl extends ServiceImpl dinerUsers = Optional.ofNullable(userService.getInnerUserById(dinerUserIds)) .map(R::getData) - .orElseThrow(() -> new RuntimeException("查询用餐人失败")); + .orElseThrow(() -> new I18nBizException(ErrorCodes.HARD_DINER_QUERY_FAIL)); Map dinerUserMap = dinerUsers.stream() .filter(Objects::nonNull) .filter(user -> user.getUserId() != null) .collect(Collectors.toMap(SysUser::getUserId, Function.identity(), (first, second) -> first)); if (dinerUserMap.size() != dinerUserIds.size()) { - throw new RuntimeException("用餐人不存在"); + throw new I18nBizException(ErrorCodes.HARD_DINER_NOT_FOUND); } for (Long dinerUserId : dinerUserIds) { Long reserveCount = isHaveCanteenReserve(dinerUserId); if (Math.addExact(reserveCount, (long) contexts.size()) > 200L) { - throw new RuntimeException("用餐人已有" + reserveCount + "笔未核销的预约订单,本次订餐后将超过200笔上限"); + throw new I18nBizException(ErrorCodes.HARD_UNVERIFIED_DINER_LIMIT, reserveCount); } } @@ -1567,7 +1570,7 @@ public class HardOrderServiceImpl extends ServiceImpl dinerWalletMap = resolveReserveDinerWallets(dinerUserIds, dinerUserMap, singleDinerTotalPrice); @@ -1592,7 +1595,7 @@ public class HardOrderServiceImpl extends ServiceImpl inventorySnapshot, String inventoryBizId) { if (!TransactionSynchronizationManager.isSynchronizationActive()) { - throw new RuntimeException("订餐事务状态异常,请稍后重试"); + throw new I18nBizException(ErrorCodes.HARD_RESERVE_TX_BAD); } List rollbackOrders = List.copyOf(createdOrders); List rollbackContexts = List.copyOf(contexts); @@ -1676,7 +1679,7 @@ public class HardOrderServiceImpl extends ServiceImpl inventorySnapshot, String inventoryBizId) { if (!TransactionSynchronizationManager.isSynchronizationActive()) { - throw new RuntimeException("订餐事务状态异常,请稍后重试"); + throw new I18nBizException(ErrorCodes.HARD_RESERVE_TX_BAD); } List rollbackOrders = List.copyOf(createdOrders); List rollbackCars = List.copyOf(sourceCarList); @@ -1705,14 +1708,14 @@ public class HardOrderServiceImpl extends ServiceImpl validateDailyMenuReserveGroups( List groups) { if (ObjectUtil.isEmpty(groups) || groups.stream().anyMatch(Objects::isNull)) { - throw new RuntimeException("订餐分组不能为空"); + throw new I18nBizException(ErrorCodes.HARD_RESERVE_GROUP_EMPTY); } Set parentCarIds = groups.stream() .map(HardAppCreateDailyMenuReserveOrdersDto.Group::getCarParentId) .filter(Objects::nonNull) .collect(Collectors.toSet()); if (parentCarIds.size() != groups.size()) { - throw new RuntimeException("请勿重复提交同一购物车"); + throw new I18nBizException(ErrorCodes.HARD_CART_DUP_SUBMIT); } return new ArrayList<>(groups); } @@ -1734,7 +1737,7 @@ public class HardOrderServiceImpl extends ServiceImpl locks) { if (!TransactionSynchronizationManager.isSynchronizationActive()) { - throw new RuntimeException("订餐事务状态异常,请稍后重试"); + throw new I18nBizException(ErrorCodes.HARD_RESERVE_TX_BAD); } TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() { /** @@ -1801,29 +1804,29 @@ public class HardOrderServiceImpl extends ServiceImpl() .eq(HardOrderEntity::getParentCarId, parentCar.getId())) > 0) { - throw new RuntimeException("购物车已创建订单,请勿重复提交"); + throw new I18nBizException(ErrorCodes.HARD_CART_ALREADY_ORDERED2); } if (merchantId == null) { merchantId = parentCar.getMerchantId(); } else if (!Objects.equals(merchantId, parentCar.getMerchantId())) { - throw new RuntimeException("批量订餐必须属于同一商户"); + throw new I18nBizException(ErrorCodes.HARD_BATCH_SAME_MCH); } List carList = hardCarService.getByParentCarId(parentCar.getId()); if (ObjectUtil.isEmpty(carList)) { - throw new RuntimeException("购物车不存在"); + throw new I18nBizException(ErrorCodes.COMMON_CART_NOT_FOUND); } validateReserveCartItems(carList); HardApptReservationService.ReservationValidation reservation = hardApptReservationService @@ -1831,11 +1834,11 @@ public class HardOrderServiceImpl extends ServiceImpl result = remoteMchService.getById(merchantId); MchManageVo merchant = result == null || !result.isOk() ? null : result.getData(); if (merchant == null) { - throw new RuntimeException(result == null ? "查询商户无响应" : StrUtil.blankToDefault(result.getMsg(), "商户不存在")); + throw new I18nBizException(result == null ? ErrorCodes.HARD_MCH_NO_RESP : ErrorCodes.COMMON_MCH_NOT_FOUND); } if (!Objects.equals(merchant.getTypes(), MerchantTypeEnum.CANTEEN.getType())) { - throw new RuntimeException("购物车商户不是食堂商户"); + throw new I18nBizException(ErrorCodes.HARD_CART_NOT_CANTEEN); } MchManageEntity.TableReservationConf conf = merchant.getTableReservationConf(); if (conf == null || !Objects.equals(conf.getMode(), WalletMchTableReservationMode.DAILY_MENU.getCode())) { - throw new RuntimeException("当前商户未开启每日菜谱订餐模式"); + throw new I18nBizException(ErrorCodes.HARD_DAILY_MENU_MODE_OFF); } return merchant; } @@ -1963,39 +1966,38 @@ public class HardOrderServiceImpl extends ServiceImpl dinerUserMap, int requiredPricePerDiner) { if (requiredPricePerDiner <= 0) { - throw new RuntimeException("订餐金额异常"); + throw new I18nBizException(ErrorCodes.HARD_RESERVE_AMOUNT_BAD); } R> result; try { result = remoteWalletService.getWalletsByUserIds(dinerUserIds, WalletTypeEnum.EAT); } catch (Exception exception) { - throw new RuntimeException("查询用餐人饭卡失败,请稍后重试", exception); + throw new I18nBizException(ErrorCodes.HARD_DINER_CARD_QUERY_FAIL); } if (result == null || !result.isOk() || result.getData() == null) { - throw new RuntimeException(result == null ? "查询用餐人饭卡无响应" - : StrUtil.blankToDefault(result.getMsg(), "查询用餐人饭卡失败")); + throw new I18nBizException(result == null ? ErrorCodes.HARD_DINER_CARD_NO_RESP : ErrorCodes.HARD_DINER_CARD_QUERY_FAIL); } Map walletMap = new LinkedHashMap<>(); for (WalletManageEntity wallet : result.getData()) { if (wallet == null || wallet.getId() == null || wallet.getUserId() == null || !dinerUserMap.containsKey(wallet.getUserId())) { - throw new RuntimeException("用餐人饭卡数据异常,请联系管理员"); + throw new I18nBizException(ErrorCodes.HARD_DINER_CARD_DATA_BAD); } if (walletMap.putIfAbsent(wallet.getUserId(), wallet) != null) { - throw new RuntimeException(reserveDinerDisplayName(dinerUserMap.get(wallet.getUserId())) + "存在重复饭卡数据,请联系管理员"); + throw new I18nBizException(ErrorCodes.HARD_DINER_CARD_DUP, reserveDinerDisplayName(dinerUserMap.get(wallet.getUserId()))); } } for (Long dinerUserId : dinerUserIds) { SysUser dinerUser = dinerUserMap.get(dinerUserId); WalletManageEntity wallet = walletMap.get(dinerUserId); if (wallet == null) { - throw new RuntimeException(reserveDinerDisplayName(dinerUser) + "未开通饭卡"); + throw new I18nBizException(ErrorCodes.HARD_DINER_NO_CARD, reserveDinerDisplayName(dinerUser)); } if (!Objects.equals(wallet.getUserId(), dinerUserId)) { - throw new RuntimeException(reserveDinerDisplayName(dinerUser) + "的饭卡归属异常,请联系管理员"); + throw new I18nBizException(ErrorCodes.HARD_DINER_CARD_OWNER_BAD, reserveDinerDisplayName(dinerUser)); } if (wallet.getBalance() == null || wallet.getBalance() < requiredPricePerDiner) { - throw new RuntimeException(reserveDinerDisplayName(dinerUser) + "饭卡余额不足"); + throw new I18nBizException(ErrorCodes.HARD_DINER_BALANCE_LOW, reserveDinerDisplayName(dinerUser)); } } return walletMap; @@ -2034,8 +2036,7 @@ public class HardOrderServiceImpl extends ServiceImpl> result = remoteCanteenSpuService.getInnerSpuListByIds(productIds); if (result == null || !result.isOk() || result.getData() == null) { - throw new RuntimeException(result == null ? "查询每日菜谱商品无响应" - : StrUtil.blankToDefault(result.getMsg(), "查询每日菜谱商品失败")); + throw new I18nBizException(result == null ? ErrorCodes.HARD_DAILY_PRODUCT_NO_RESP : ErrorCodes.HARD_DAILY_PRODUCT_QUERY_FAIL); } Map productMap = result.getData().stream() .filter(Objects::nonNull) @@ -2052,26 +2053,26 @@ public class HardOrderServiceImpl extends ServiceImpl entry : requiredStock.entrySet()) { CanteenSpuEntity product = productMap.get(entry.getKey()); if (product.getStock() == null || product.getStock() < entry.getValue()) { - throw new RuntimeException(product.getName() + "库存不足"); + throw new I18nBizException(ErrorCodes.HARD_PRODUCT_STOCK_LOW, product.getName()); } } return requiredStock.keySet().stream().collect(Collectors.toMap(Function.identity(), @@ -2093,7 +2094,7 @@ public class HardOrderServiceImpl extends ServiceImpl 1L); if (exceedsLimit) { - throw new RuntimeException("该商户每个日期餐段仅允许选择一份商品"); + throw new I18nBizException(ErrorCodes.HARD_ONE_ITEM_PER_SLOT); } } @@ -2195,14 +2196,14 @@ public class HardOrderServiceImpl extends ServiceImpl validateReserveDinerUserIds(Long payerUserId, List dinerUserIds) { if (ObjectUtil.isEmpty(dinerUserIds)) { - throw new RuntimeException("用餐人不能为空"); + throw new I18nBizException(ErrorCodes.HARD_DINER_EMPTY); } if (dinerUserIds.stream().anyMatch(Objects::isNull)) { - throw new RuntimeException("用餐人不能为空"); + throw new I18nBizException(ErrorCodes.HARD_DINER_EMPTY); } LinkedHashSet distinctIds = new LinkedHashSet<>(dinerUserIds); if (distinctIds.size() != dinerUserIds.size()) { - throw new RuntimeException("请勿重复选择用餐人"); + throw new I18nBizException(ErrorCodes.HARD_DINER_DUP); } Set allowedUserIds = new HashSet<>(); allowedUserIds.add(payerUserId); @@ -2211,7 +2212,7 @@ public class HardOrderServiceImpl extends ServiceImpl(distinctIds); } @@ -2228,7 +2229,7 @@ public class HardOrderServiceImpl extends ServiceImpl> userResponse = userService.getUserDeptByIds(dinerUserIds); if (userResponse == null || !userResponse.isOk() || userResponse.getData() == null) { - throw new RuntimeException(userResponse == null - ? "查询用餐人身份无响应" - : StrUtil.blankToDefault(userResponse.getMsg(), "查询用餐人身份失败")); + throw new I18nBizException(userResponse == null ? ErrorCodes.HARD_DINER_IDENTITY_NO_RESP : ErrorCodes.HARD_DINER_IDENTITY_QUERY_FAIL); } Map userMap = userResponse.getData().stream() .filter(Objects::nonNull) @@ -2258,7 +2257,7 @@ public class HardOrderServiceImpl extends ServiceImpl 0) { - throw new RuntimeException("同一用餐人同一天同一餐段只能预约一次,请勿重复预约"); + throw new I18nBizException(ErrorCodes.HARD_DINER_SLOT_ONCE); } } @@ -2305,7 +2304,7 @@ public class HardOrderServiceImpl extends ServiceImpl locks) { if (!TransactionSynchronizationManager.isSynchronizationActive()) { - throw new RuntimeException("预约事务状态异常,请稍后重试"); + throw new I18nBizException(ErrorCodes.HARD_APPT_TX_BAD); } TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() { @Override @@ -2350,7 +2349,7 @@ public class HardOrderServiceImpl extends ServiceImpl paymentList = buildReserveWalletTransactions(orders); R> result = walletTransactionService.reduceWalletBalanceBatchIdempotent(paymentList); if (result == null || !result.isOk() || result.getData() == null || result.getData().size() != paymentList.size()) { - throw new RuntimeException(result == null ? "钱包批量扣款无响应" - : StrUtil.blankToDefault(result.getMsg(), "钱包批量扣款结果异常")); + throw new I18nBizException(result == null ? ErrorCodes.HARD_WALLET_BATCH_DEDUCT_NO_RESP : ErrorCodes.HARD_WALLET_BATCH_DEDUCT_BAD); } } @@ -2389,7 +2387,7 @@ public class HardOrderServiceImpl extends ServiceImpl buildReserveWalletTransactions(List orders) { return orders.stream().map(order -> { if (order.getId() == null || order.getWalletId() == null || order.getPayPrice() == null || order.getPayPrice() <= 0) { - throw new RuntimeException("订餐钱包交易数据异常"); + throw new I18nBizException(ErrorCodes.HARD_WALLET_TX_BAD); } WalletBalanceTransactionDto transaction = new WalletBalanceTransactionDto(); transaction.setWalletId(order.getWalletId()); @@ -2416,17 +2414,17 @@ public class HardOrderServiceImpl extends ServiceImpl> result = remoteOnlineCanteenSpuService .getSpuListByIds(new ArrayList<>(requiredStock.keySet())); if (result == null || !result.isOk() || result.getData() == null) { - throw new RuntimeException(result == null ? "查询商品库存无响应" : result.getMsg()); + throw new I18nBizException(result == null ? ErrorCodes.HARD_STOCK_NO_RESP : ErrorCodes.HARD_STOCK_DEDUCT_FAIL); } Map productMap = result.getData().stream() .collect(Collectors.toMap(CanteenOnlineSpuAppVO::getId, Function.identity(), (first, second) -> first)); for (Map.Entry entry : requiredStock.entrySet()) { CanteenOnlineSpuAppVO product = productMap.get(entry.getKey()); if (product == null || !Objects.equals(product.getMerchantId(), merchantId)) { - throw new RuntimeException("购物车商品不存在或不属于当前商户"); + throw new I18nBizException(ErrorCodes.HARD_CART_PRODUCT_NOT_IN_MCH); } if (product.getStock() == null || product.getStock() < entry.getValue()) { - throw new RuntimeException(product.getName() + "库存不足"); + throw new I18nBizException(ErrorCodes.HARD_PRODUCT_STOCK_LOW, product.getName()); } } return productMap.values().stream().collect(Collectors.toMap(CanteenOnlineSpuAppVO::getId, CanteenOnlineSpuAppVO::getStock)); @@ -2451,7 +2449,7 @@ public class HardOrderServiceImpl extends ServiceImpl clonedCars = sourceCarList.stream().map(source -> HardCarEntity.builder() .parentCarId(targetParentCar.getId()) @@ -2466,7 +2464,7 @@ public class HardOrderServiceImpl extends ServiceImpl result = remoteCanteenSpuService.updateSkuStockIdempotent(stockDto); if (result == null || !result.isOk()) { - throw new RuntimeException(reduce ? "每日菜谱库存不足或扣减失败" : "每日菜谱库存恢复失败"); + throw new I18nBizException(reduce ? ErrorCodes.HARD_DAILY_STOCK_DEDUCT_FAIL : ErrorCodes.HARD_DAILY_STOCK_RESTORE_FAIL); } } @@ -2620,7 +2618,7 @@ public class HardOrderServiceImpl extends ServiceImpl new RuntimeException("每日菜谱订单批次数据异常")); + .orElseThrow(() -> new I18nBizException(ErrorCodes.HARD_DAILY_MENU_BATCH_BAD)); return "HARD_DAILY_MENU_ORDER_BATCH:" + firstOrderId; } @@ -2672,7 +2670,7 @@ public class HardOrderServiceImpl extends ServiceImpl result = onlineCanteenSpuService.updateSkuStockIdempotent(stockDto); if (result == null || !result.isOk()) { - throw new RuntimeException(reduce ? "库存不足或扣减失败" : "恢复库存失败"); + throw new I18nBizException(reduce ? ErrorCodes.HARD_STOCK_DEDUCT_FAIL : ErrorCodes.HARD_STOCK_RESTORE_FAIL); } } @@ -2688,7 +2686,7 @@ public class HardOrderServiceImpl extends ServiceImpl new RuntimeException("订餐订单批次数据异常")); + .orElseThrow(() -> new I18nBizException(ErrorCodes.HARD_RESERVE_BATCH_BAD)); return "HARD_RESERVE_ORDER_BATCH:" + firstOrderId; } @@ -2726,8 +2724,7 @@ public class HardOrderServiceImpl extends ServiceImpl result = walletTransactionService.compensatePaymentBatch(buildReserveWalletTransactions(createdOrders)); if (result == null || !result.isOk() || !Boolean.TRUE.equals(result.getData())) { - throw new RuntimeException(result == null ? "钱包批量补偿无响应" - : StrUtil.blankToDefault(result.getMsg(), "钱包批量补偿失败")); + throw new I18nBizException(result == null ? ErrorCodes.HARD_WALLET_BATCH_COMP_NO_RESP : ErrorCodes.HARD_WALLET_BATCH_DEDUCT_BAD); } } catch (Exception compensationException) { log.error("|{}|多人订餐钱包批量补偿失败,orderIds:|{}|", TAG, @@ -2742,34 +2739,34 @@ public class HardOrderServiceImpl extends ServiceImpl 200) throw new RuntimeException("您有" + reserveCount + "笔未核销的预约订单,请先核销"); + if (reserveCount > 200) throw new I18nBizException(ErrorCodes.HARD_UNVERIFIED_SELF, reserveCount); // 钱包 WalletManageEntity wallet = remoteWalletService.getWallet(dto.getUserId(), dto.getWalletType()).getData(); - if (ObjectUtil.isEmpty(wallet)) throw new RuntimeException("用户钱包不存在"); + if (ObjectUtil.isEmpty(wallet)) throw new I18nBizException(ErrorCodes.COMMON_WALLET_NOT_FOUND); // 查询父订单 HardParentCarEntity parentCar = hardCarService.getParentCarById(dto.getCarParentId()); - if (ObjectUtil.isEmpty(parentCar)) throw new RuntimeException("购物车不存在"); + if (ObjectUtil.isEmpty(parentCar)) throw new I18nBizException(ErrorCodes.COMMON_CART_NOT_FOUND); //效验是否有选择必选品 R choiceGroups = remoteOnlineCanteenSpuService.getChoiceGroups(String.valueOf(parentCar.getMerchantId())); if (!choiceGroups.isOk()) { - throw new RuntimeException("未选择必选菜品"); + throw new I18nBizException(ErrorCodes.HARD_REQUIRED_DISH_MISSING); } // 查询商户 MchManageVo hardManager = remoteMchService.getById(parentCar.getMerchantId()).getData(); - if (ObjectUtil.isEmpty(hardManager)) throw new RuntimeException("商户不存在"); + if (ObjectUtil.isEmpty(hardManager)) throw new I18nBizException(ErrorCodes.COMMON_MCH_NOT_FOUND); validateTakeOutApptAgainstMerchantJobTime(hardManager, dto.getAppt()); // 查询父购物车 List carList = hardCarService.getByParentCarId(dto.getCarParentId()); if (ObjectUtil.isEmpty(carList)) { - throw new RuntimeException("购物车不存在"); + throw new I18nBizException(ErrorCodes.COMMON_CART_NOT_FOUND); } Integer balance = wallet.getBalance(); int carPrice = (int) carList.stream().mapToLong(HardCarEntity::getTotalPrice).sum(); @@ -2782,7 +2779,7 @@ public class HardOrderServiceImpl extends ServiceImpl carList = hardCarService.getByParentCarId(dto.getCarParentId()); - if (ObjectUtil.isEmpty(carList)) throw new RuntimeException("购物车不存在"); + if (ObjectUtil.isEmpty(carList)) throw new I18nBizException(ErrorCodes.COMMON_CART_NOT_FOUND); Integer balance = wallet.getBalance(); int totalPrice = (int) carList.stream().mapToLong(HardCarEntity::getTotalPrice).sum(); if (balance < totalPrice) { - throw new RuntimeException("钱包余额不足"); + throw new I18nBizException(ErrorCodes.COMMON_WALLET_BALANCE_INSUFFICIENT); } // 获取商品描述 List carListDto = carList.stream().map(v -> { @@ -3056,7 +3053,7 @@ public class HardOrderServiceImpl extends ServiceImpl carList = hardCarService.getByParentCarId(dto.getCarParentId()); - if (ObjectUtil.isEmpty(carList)) throw new RuntimeException("购物车不存在"); + if (ObjectUtil.isEmpty(carList)) throw new I18nBizException(ErrorCodes.COMMON_CART_NOT_FOUND); Integer balance = wallet.getBalance(); int totalPrice = (int) carList.stream().mapToLong(HardCarEntity::getTotalPrice).sum(); if (balance < totalPrice) { - throw new RuntimeException("钱包余额不足"); + throw new I18nBizException(ErrorCodes.COMMON_WALLET_BALANCE_INSUFFICIENT); } // 获取商品描述 List carListDto = carList.stream().map(v -> { @@ -3134,25 +3131,25 @@ public class HardOrderServiceImpl extends ServiceImpl carList = hardCarService.getByParentCarId(dto.getCarParentId()); - if (ObjectUtil.isEmpty(carList)) throw new RuntimeException("购物车不存在"); + if (ObjectUtil.isEmpty(carList)) throw new I18nBizException(ErrorCodes.COMMON_CART_NOT_FOUND); // 查询地址 HardUserMapAddressEntity userMapAddress = hardUserMapAddressService.getById(dto.getMapAddressId()); - if (ObjectUtil.isEmpty(userMapAddress)) throw new RuntimeException("用户地址不存在"); + if (ObjectUtil.isEmpty(userMapAddress)) throw new I18nBizException(ErrorCodes.HARD_USER_ADDRESS_MISSING); int totalPrice = (int) carList.stream().mapToLong(HardCarEntity::getTotalPrice).sum(); @@ -3160,10 +3157,10 @@ public class HardOrderServiceImpl extends ServiceImpl appPayRes = thirdAppPlusPayService.remoterAppPay(appPayDto); if (!appPayRes.isOk()) { - throw new RuntimeException("发起app支付失败"); + throw new I18nBizException(ErrorCodes.HARD_APP_PAY_FAIL); } ThirdMiniAppPayVo appPayVo = appPayRes.getData(); // 更新订单订单号 @@ -3250,24 +3247,24 @@ public class HardOrderServiceImpl extends ServiceImpl reduceRes = walletTransactionService.reduceWalletBalance(reduceBuild); if (reduceRes.getCode() != 0 || ObjectUtil.isEmpty(reduceRes.getData())) { - throw new RuntimeException("钱包扣款错误"); + throw new I18nBizException(ErrorCodes.HARD_WALLET_DEDUCT_FAIL); } } // 订单成功 @@ -3787,15 +3784,15 @@ public class HardOrderServiceImpl extends ServiceImpl() @@ -3845,7 +3842,7 @@ public class HardOrderServiceImpl extends ServiceImpl cars = hardCarService.getByOrderId(order.getId()); boolean hasFulfillableProduct = ObjectUtil.isNotEmpty(cars) && cars.stream().anyMatch(car -> resolveEffectiveProductCount(car) > 0); if (!hasFulfillableProduct) { - throw new RuntimeException("该预约订单商品已全部退款,不能退回到核销前"); + throw new I18nBizException(ErrorCodes.HARD_ROLLBACK_FULL_REFUND); } } @@ -3919,16 +3916,16 @@ public class HardOrderServiceImpl extends ServiceImpl cars = hardCarService.getByOrderId(order.getId()); boolean hasFulfillableProduct = ObjectUtil.isNotEmpty(cars) && cars.stream().anyMatch(car -> resolveEffectiveProductCount(car) > 0); if (!hasFulfillableProduct) { - throw new RuntimeException("该预约订单商品已全部退款,不能核销"); + throw new I18nBizException(ErrorCodes.HARD_RESERVE_FULL_REFUND_NO_VERIFY); } } @@ -4042,12 +4039,12 @@ public class HardOrderServiceImpl extends ServiceImpl result = remoteCodeUseService.cancelCode(id); if (ObjectUtil.isEmpty(result) || result.getCode() != 0 || !result.getData()) { - throw new RuntimeException("核销二维码错误"); + throw new I18nBizException(ErrorCodes.HARD_ACT_QR_BAD); } // 发送mq if (ObjectUtil.equals(orderTypeEnum, HardOrderTypeEnum.RESERVE)) { @@ -4210,17 +4207,17 @@ public class HardOrderServiceImpl extends ServiceImpl carList = hardCarService.getByParentCarId(order.getParentCarId()); if (ObjectUtil.isEmpty(carList)) { - throw new RuntimeException("食堂菜品库存操作失败,购物车不存在"); + throw new I18nBizException(ErrorCodes.HARD_CANTEEN_STOCK_CAR_MISSING); } if (ObjectUtil.isNotEmpty(refundCarList)) { carList = filterRefundInventoryCars(carList, refundCarList); } if (ObjectUtil.isEmpty(carList)) { - throw new RuntimeException("食堂菜品库存操作失败,退款商品不存在"); + throw new I18nBizException(ErrorCodes.HARD_CANTEEN_STOCK_REFUND_ITEM_MISSING); } int factor = ObjectUtil.equals(isReduce, YesNoEnum.YES) ? -1 : 1; @@ -4232,8 +4229,13 @@ public class HardOrderServiceImpl extends ServiceImpl> productResult = remoteCanteenSpuService .getInnerSpuListByIds(new ArrayList<>(stockChanges.keySet())); if (productResult == null || !productResult.isOk() || productResult.getData() == null) { - throw new RuntimeException(productResult == null ? "查询食堂菜品库存无响应" - : StrUtil.blankToDefault(productResult.getMsg(), "查询食堂菜品库存失败")); + if (productResult == null) { + throw new I18nBizException(ErrorCodes.HARD_CANTEEN_STOCK_NO_RESP); + } + if (StrUtil.isNotBlank(productResult.getMsg())) { + throw new RuntimeException(productResult.getMsg()); + } + throw new I18nBizException(ErrorCodes.HARD_CANTEEN_STOCK_QUERY_FAIL); } Map productMap = productResult.getData().stream() .filter(Objects::nonNull) @@ -4243,14 +4245,14 @@ public class HardOrderServiceImpl extends ServiceImpl entry : stockChanges.entrySet()) { CanteenSpuEntity product = productMap.get(entry.getKey()); if (product == null || !Objects.equals(product.getMerchantId(), order.getMerchantId())) { - throw new RuntimeException("食堂菜品不存在或不属于当前商户"); + throw new I18nBizException(ErrorCodes.HARD_CANTEEN_SPU_BAD); } int productType = product.getSpuType() == null ? 1 : product.getSpuType(); if (productType != 1 && productType != 2) { - throw new RuntimeException(product.getName() + "商品模式异常,请联系商户"); + throw new I18nBizException(ErrorCodes.HARD_PRODUCT_MODE_BAD, product.getName()); } if (product.getStock() == null || entry.getValue() < 0 && product.getStock() < Math.abs(entry.getValue())) { - throw new RuntimeException(product.getName() + "库存不足"); + throw new I18nBizException(ErrorCodes.HARD_PRODUCT_STOCK_LOW, product.getName()); } inventorySnapshot.put(entry.getKey(), product.getStock()); } @@ -4277,7 +4279,7 @@ public class HardOrderServiceImpl extends ServiceImpl inventorySnapshot, String inventoryBizId) { if (!TransactionSynchronizationManager.isSynchronizationActive()) { - throw new RuntimeException("库存事务状态异常,请稍后重试"); + throw new I18nBizException(ErrorCodes.HARD_STOCK_TX_STATE_BAD); } Map rollbackChanges = Map.copyOf(stockChanges); Map rollbackSnapshot = Map.copyOf(inventorySnapshot); @@ -4325,8 +4327,13 @@ public class HardOrderServiceImpl extends ServiceImpl result = remoteCanteenSpuService.updateSkuStockIdempotent(dto); if (result == null || !result.isOk()) { - throw new RuntimeException(result == null ? "食堂菜品库存服务无响应" - : StrUtil.blankToDefault(result.getMsg(), "食堂菜品库存操作失败")); + if (result == null) { + throw new I18nBizException(ErrorCodes.HARD_CANTEEN_STOCK_NO_RESP); + } + if (StrUtil.isNotBlank(result.getMsg())) { + throw new RuntimeException(result.getMsg()); + } + throw new I18nBizException(ErrorCodes.HARD_CANTEEN_STOCK_OP_FAIL); } } @@ -4388,7 +4395,7 @@ public class HardOrderServiceImpl extends ServiceImpl carList = hardCarService.getByParentCarId(order.getParentCarId()); - if (ObjectUtil.isEmpty(carList)) throw new RuntimeException(CarErrorMsg + "错误,购物车不存在"); + if (ObjectUtil.isEmpty(carList)) throw new I18nBizException(ErrorCodes.HARD_STOCK_DEDUCT_CART_MISSING); if (ObjectUtil.isNotEmpty(refundCarList)) { carList = filterRefundInventoryCars(carList, refundCarList); } @@ -4410,7 +4417,7 @@ public class HardOrderServiceImpl extends ServiceImpl carList = hardCarService.getByParentCarId(order.getParentCarId()); - if (ObjectUtil.isEmpty(carList)) throw new RuntimeException("扣减库存错误,购物车不存在"); + if (ObjectUtil.isEmpty(carList)) throw new I18nBizException(ErrorCodes.HARD_STOCK_DEDUCT_CART_MISSING); if (ObjectUtil.isNotEmpty(refundCarList)) { carList = filterRefundInventoryCars(carList, refundCarList); } @@ -4460,7 +4467,7 @@ public class HardOrderServiceImpl extends ServiceImpl updateSkuStockRes = remoteShopSkuService.deductStock(dto); if (updateSkuStockRes.getCode() != 0) { log.info("|{}|{},失败,order:|{}|,isReduce:|{}|,params:|{}|", TAG, CarErrorMsg, JSON.toJSON(order), isReduce, JSON.toJSON(dto)); - throw new RuntimeException(CarErrorMsg + "错误"); + throw new I18nBizException(ErrorCodes.HARD_STOCK_OP_FAIL, CarErrorMsg); } log.info("|{}|{},成功,order:|{}|,isReduce:|{}|,params:|{}|", TAG, CarErrorMsg, JSON.toJSON(order), isReduce, JSON.toJSON(dto)); return; @@ -4512,7 +4519,7 @@ public class HardOrderServiceImpl extends ServiceImpl carList = hardCarService.getByParentCarId(order.getParentCarId()); - if (ObjectUtil.isEmpty(carList)) throw new RuntimeException("扣减库存错误,购物车不存在"); + if (ObjectUtil.isEmpty(carList)) throw new I18nBizException(ErrorCodes.HARD_STOCK_DEDUCT_CART_MISSING); if (ObjectUtil.isNotEmpty(refundCarList)) { carList = filterRefundInventoryCars(carList, refundCarList); } @@ -4538,7 +4545,7 @@ public class HardOrderServiceImpl extends ServiceImpl updateSkuStockRes = remoteMallProductService.deductStock(dto); if (updateSkuStockRes.getCode() != 0 || !updateSkuStockRes.getData()) { log.info("|{}|{},失败,order:|{}|,isReduce:|{}|,params:|{}|", TAG, CarErrorMsg, JSON.toJSON(order), isReduce, JSON.toJSON(dto)); - throw new RuntimeException(CarErrorMsg + "错误"); + throw new I18nBizException(ErrorCodes.HARD_STOCK_OP_FAIL, CarErrorMsg); } log.info("|{}|{},成功,order:|{}|,isReduce:|{}|,params:|{}|", TAG, CarErrorMsg, JSON.toJSON(order), isReduce, JSON.toJSON(dto)); return; @@ -4724,14 +4731,14 @@ public class HardOrderServiceImpl extends ServiceImpl true; }; - if (flag) throw new RuntimeException("该二维码已被核销"); + if (flag) throw new I18nBizException(ErrorCodes.HARD_QR_ALREADY_VERIFIED); return flag; } @@ -4770,7 +4777,7 @@ public class HardOrderServiceImpl extends ServiceImpl mch = remoteMchService.getById(dto.getMerchantId()); if (ObjectUtil.isEmpty(mch.getData())) { - throw new RuntimeException("商户不存在"); + throw new I18nBizException(ErrorCodes.COMMON_MCH_NOT_FOUND); } HardManagerEntity hard = hardManagerService.getByHardId(dto.getHardwareId()); if (ObjectUtil.isEmpty(hard)) { @@ -4818,10 +4825,10 @@ public class HardOrderServiceImpl extends ServiceImpl detail(@PathVariable("id") Long id) { ShopSpuEntity spu = shopSpuService.getByIdDeep(id); - if (spu == null) return R.failed("商品不存在"); + if (spu == null) return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_PRODUCT_NOT_FOUND)); ShopSpuDetailAppVo vo = BeanUtils.toBean(spu, ShopSpuDetailAppVo.class); // 查询sku列表 List skuList = shopSkuService.list(Wrappers.lambdaQuery().eq(ShopSkuEntity::getSpuId, id)); @@ -111,16 +113,16 @@ public class AppShopSpuController { @Operation(summary = "批量增减库存", description = "正加负减,任一失败全失败") public R deductStock(@RequestBody SkuStockChangeDTO changes) { boolean result = shopSkuService.deductStockBatch(changes); - return result ? R.ok(true) : R.failed("库存不足或扣减失败"); + return result ? R.ok(true) : R.failed(MsgUtils.getMessage(ErrorCodes.HARD_STOCK_DEDUCT_FAIL)); } @GetMapping("/checkSpuStock") @Operation(summary = "检查商品库存", description = "检查商品库存") public R checkSpuStock(@RequestParam(value ="skuId")Long skuId,@RequestParam("incrCount")Integer incrCount) { ShopSkuEntity shopSkuEntity = shopSkuService.getById(skuId); - if (shopSkuEntity == null) return R.failed("商品sku不存在"); + if (shopSkuEntity == null) return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_PRODUCT_SKU_NOT_FOUND)); if (shopSkuEntity.getStock()> listR = remoteMchService.list(mchManageDto); if (!listR.isOk()) { - return R.failed("商户服务异常!"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_MCH_SERVICE_ERROR)); } List merchants = listR.getData(); if (CollectionUtils.isEmpty(merchants)) { @@ -247,11 +249,11 @@ public class MallAppController { public R getMerchantDetail(@PathVariable("id") Long id) { R mchManageVoR = remoteMchService.getById(id); if (!mchManageVoR.isOk()) { - return R.failed("商户服务异常!"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_MCH_SERVICE_ERROR)); } MchManageVo mchManageVo = mchManageVoR.getData(); if (mchManageVo == null) { - return R.failed("商户不存在"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_MCH_NOT_FOUND)); } MallMchManageVo mallMchManageVo = new MallMchManageVo(); mallMchManageVo.setId(mchManageVo.getId()); @@ -335,7 +337,7 @@ public class MallAppController { public R getProductDetail(@PathVariable("id") Long id) { MallProductEntity product = mallProductService.getById(id); if (product == null) { - return R.failed("商品不存在"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_PRODUCT_NOT_FOUND)); } MallProductDetailAppVo vo = BeanUtils.toBean(product, MallProductDetailAppVo.class); @@ -400,10 +402,10 @@ public class MallAppController { if (success) { return R.ok("商品创建成功"); } else { - return R.failed("商品创建失败"); + return R.failed(MsgUtils.getMessage(ErrorCodes.MALL_PRODUCT_CREATE_FAIL)); } } catch (Exception e) { - return R.failed("商品创建失败:" + e.getMessage()); + return R.failed(MsgUtils.getMessage(ErrorCodes.MALL_PRODUCT_CREATE_FAIL)); } } @@ -423,17 +425,17 @@ public class MallAppController { // 验证商品ID if (productCreateDTO.getId() == null) { - return R.failed("商品ID不能为空"); + return R.failed(MsgUtils.getMessage(ErrorCodes.MALL_PRODUCT_ID_EMPTY)); } // 更新商品 boolean success = mallProductService.updateProductWithSkus(productCreateDTO); if (success) { return R.ok("商品更新成功"); } else { - return R.failed("商品更新失败"); + return R.failed(MsgUtils.getMessage(ErrorCodes.MALL_PRODUCT_UPDATE_FAIL)); } } catch (Exception e) { - return R.failed("商品更新失败:" + e.getMessage()); + return R.failed(MsgUtils.getMessage(ErrorCodes.MALL_PRODUCT_UPDATE_FAIL)); } } @@ -446,7 +448,7 @@ public class MallAppController { // 获取当前用户ID Long deptId = SecurityUtils.getUser().getDeptId(); if (deptId == null) { - throw new BusinessException("用户未登录"); + throw new I18nBizException(ErrorCodes.COMMON_NOT_LOGIN); } // Long merchantIdByUserId=null; @@ -458,7 +460,7 @@ public class MallAppController { return mchManageVo.getId(); } else { - throw new BusinessException("该用户未分配共富商户"); + throw new I18nBizException(ErrorCodes.MALL_USER_NO_FARMER_MCH); } // R> mallMchUserLists = remoteRoleService.findRolesByCodes(Arrays.asList(MallConstants.RoleCode.MERCHANT_USER)); // if (mallMchUserLists.isOk()) { @@ -487,10 +489,10 @@ public class MallAppController { MallProductEntity mallProduct = mallProductService.getById(productId); if (mallProduct == null) { - throw new BusinessException("商品不存在"); + throw new I18nBizException(ErrorCodes.COMMON_PRODUCT_NOT_FOUND); } if (!merchantId.equals(mallProduct.getMerchantId())) { - throw new BusinessException("无权限处理此商品"); + throw new I18nBizException(ErrorCodes.MALL_NO_PRODUCT_PERM); } } @@ -558,7 +560,7 @@ public class MallAppController { return R.ok(voPage); } catch (Exception e) { - return R.failed("获取商品列表失败:" + e.getMessage()); + return R.failed(MsgUtils.getMessage(ErrorCodes.MALL_PRODUCT_LIST_FAIL)); } } @@ -577,10 +579,10 @@ public class MallAppController { if (success) { return R.ok("商品删除成功"); } else { - return R.failed("商品删除失败"); + return R.failed(MsgUtils.getMessage(ErrorCodes.MALL_PRODUCT_DELETE_FAIL)); } } catch (Exception e) { - return R.failed("商品删除失败:" + e.getMessage()); + return R.failed(MsgUtils.getMessage(ErrorCodes.MALL_PRODUCT_DELETE_FAIL)); } } @@ -603,10 +605,10 @@ public class MallAppController { if (success) { return R.ok("商品分类创建成功"); } else { - return R.failed("商品分类创建失败"); + return R.failed(MsgUtils.getMessage(ErrorCodes.MALL_CATEGORY_CREATE_FAIL)); } } catch (Exception e) { - return R.failed("商品分类创建失败:" + e.getMessage()); + return R.failed(MsgUtils.getMessage(ErrorCodes.MALL_CATEGORY_CREATE_FAIL)); } } @@ -623,7 +625,7 @@ public class MallAppController { // 验证分类ID if (category.getId() == null) { - return R.failed("分类ID不能为空"); + return R.failed(MsgUtils.getMessage(ErrorCodes.MALL_CATEGORY_ID_EMPTY)); } // 更新分类 @@ -631,10 +633,10 @@ public class MallAppController { if (success) { return R.ok("分类更新成功"); } else { - return R.failed("分类更新失败"); + return R.failed(MsgUtils.getMessage(ErrorCodes.MALL_CATEGORY_UPDATE_FAIL)); } } catch (Exception e) { - return R.failed("分类更新失败:" + e.getMessage()); + return R.failed(MsgUtils.getMessage(ErrorCodes.MALL_CATEGORY_UPDATE_FAIL)); } } @@ -653,10 +655,10 @@ public class MallAppController { if (success) { return R.ok("分类删除成功"); } else { - return R.failed("分类删除失败"); + return R.failed(MsgUtils.getMessage(ErrorCodes.MALL_CATEGORY_DELETE_FAIL)); } } catch (Exception e) { - return R.failed("分类删除失败:" + e.getMessage()); + return R.failed(MsgUtils.getMessage(ErrorCodes.MALL_CATEGORY_DELETE_FAIL)); } } @@ -677,7 +679,7 @@ public class MallAppController { List list = mallCategoryService.list(wrapper); return R.ok(list); } catch (Exception e) { - return R.failed("获取分类列表失败:" + e.getMessage()); + return R.failed(MsgUtils.getMessage(ErrorCodes.MALL_CATEGORY_LIST_FAIL)); } } @@ -687,10 +689,10 @@ public class MallAppController { private void validateCategoryPermission(Long categoryId, Long merchantId) { MallCategoryEntity category = mallCategoryService.getById(categoryId); if (category == null) { - throw new BusinessException("分类不存在"); + throw new I18nBizException(ErrorCodes.MALL_CATEGORY_NOT_FOUND); } if (!merchantId.equals(category.getMerchantId())) { - throw new BusinessException("无权限处理此分类"); + throw new I18nBizException(ErrorCodes.MALL_NO_CATEGORY_PERM); } } @@ -703,7 +705,7 @@ public class MallAppController { @Operation(summary = "批量增减库存", description = "正加负减,任一失败全失败") public R deductStock(@RequestBody SkuStockChangeDTO changes) { boolean result = mallProductSkuService.deductStockBatch(changes); - return result ? R.ok(true) : R.failed("库存不足或扣减失败"); + return result ? R.ok(true) : R.failed(MsgUtils.getMessage(ErrorCodes.HARD_STOCK_DEDUCT_FAIL)); } /** @@ -714,10 +716,10 @@ public class MallAppController { public R checkStock(@RequestParam("skuId") Long skuId, @RequestParam("incrCount") Integer incrCount) { MallProductSkuEntity sku = mallProductSkuService.getById(skuId); if (sku == null) { - return R.failed("商品SKU不存在"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_PRODUCT_SKU_NOT_FOUND)); } if (sku.getStock() < Math.abs(incrCount)) { - return R.failed("库存不足"); + return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_PRODUCT_STOCK_LOW)); } return R.ok(true); } diff --git a/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appmessage/ThirdAppMessageServiceImpl.java b/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appmessage/ThirdAppMessageServiceImpl.java index a20fa27e..7d405b22 100644 --- a/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appmessage/ThirdAppMessageServiceImpl.java +++ b/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appmessage/ThirdAppMessageServiceImpl.java @@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.bsd.pjcloud.admin.api.dto.user.SysUserRelationRecipientQueryDto; import com.bsd.pjcloud.admin.api.feign.RemoteUserRelationService; import com.bsd.pjcloud.admin.api.vo.user.SysUserRelationRecipientVo; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.util.MsgUtils; import com.bsd.pjcloud.common.core.util.R; import com.bsd.pjcloud.thirdparty.constant.appmessage.AppMessageConstants; import com.bsd.pjcloud.thirdparty.constant.appmessage.AppMessageEventEnum; @@ -20,8 +22,11 @@ import com.bsd.pjcloud.thirdparty.service.appmessage.ThirdAppMessageSettingServi import com.bsd.pjcloud.thirdparty.service.appmessage.ThirdPushDeliveryService; import com.bsd.pjcloud.thirdparty.vo.appmessage.AppMessageVo; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -38,6 +43,7 @@ import java.util.Set; /** * App业务消息事件接入和收件箱实现。 */ +@Slf4j @Service @RequiredArgsConstructor public class ThirdAppMessageServiceImpl implements ThirdAppMessageService { @@ -98,15 +104,16 @@ public class ThirdAppMessageServiceImpl implements ThirdAppMessageService { if (ownerMessageExists(dto.getEventId(), dto.getSubjectUserId())) { return true; } - String mealName = StrUtil.blankToDefault(dto.getMealName(), "本次预约用餐"); + String mealName = StrUtil.blankToDefault(dto.getMealName(), MsgUtils.getMessage(ErrorCodes.APP_MSG_MEAL_DEFAULT_NAME)); String payloadJson = serialize(Map.of( "orderId", dto.getOrderId(), "mealName", mealName)); ThirdAppMessageEntity ownerMessage = buildBaseMessage( dto.getTenantId(), dto.getEventId(), event.getCode(), dto.getSubjectUserId(), dto.getSubjectUserId(), AppMessageConstants.RECIPIENT_OWNER, AppMessageConstants.SOURCE_HARDWARE, event.getCode(), - String.valueOf(dto.getOrderId()), dto.getSourceMchId(), dto.getSourceMchName(), "用餐核销成功", - mealName + "已核销,祝您用餐愉快。", payloadJson, dto.getOccurredTime()); + String.valueOf(dto.getOrderId()), dto.getSourceMchId(), dto.getSourceMchName(), + MsgUtils.getMessage(ErrorCodes.APP_MSG_TITLE_MEAL_VERIFIED), + MsgUtils.getMessage(ErrorCodes.APP_MSG_MEAL_CONTENT, mealName), payloadJson, dto.getOccurredTime()); messageMapper.insert(ownerMessage); ThirdAppPushPolicyEntity policy = settingService.findPolicy(dto.getSourceMchId(), event.getCode()); deliveryService.createDelivery(ownerMessage, ownerSkipReason(dto.getSourceMchId(), policy, dto.getSubjectUserId(), event.getCode())); @@ -231,13 +238,16 @@ public class ThirdAppMessageServiceImpl implements ThirdAppMessageService { createdRecipientIds.remove(relation.getRecipientUserId()); continue; } - String subjectName = StrUtil.blankToDefault(relation.getSubjectUserName(), "被监护人"); + String subjectName = StrUtil.blankToDefault(relation.getSubjectUserName(), + MsgUtils.getMessage(ErrorCodes.APP_MSG_WARD_FALLBACK)); ThirdAppMessageEntity relationMessage = buildBaseMessage( ownerMessage.getTenantId(), ownerMessage.getEventId(), ownerMessage.getEventCode(), relation.getRecipientUserId(), ownerMessage.getSubjectUserId(), AppMessageConstants.RECIPIENT_RELATION, ownerMessage.getSourceService(), ownerMessage.getSourceBizType(), ownerMessage.getSourceBizId(), - ownerMessage.getSourceMchId(), ownerMessage.getSourceMchName(), subjectName + "的" + ownerMessage.getTitle(), - subjectName + ":" + ownerMessage.getContent(), payloadJson, occurredTime); + ownerMessage.getSourceMchId(), ownerMessage.getSourceMchName(), + MsgUtils.getMessage(ErrorCodes.APP_MSG_RELATION_TITLE, subjectName, ownerMessage.getTitle()), + MsgUtils.getMessage(ErrorCodes.APP_MSG_RELATION_CONTENT, subjectName, ownerMessage.getContent()), + payloadJson, occurredTime); relationMessage.setRelationId(relation.getRelationId()); relationMessage.setRelationCode(relation.getRelationCode()); relationMessage.setRelationName(relation.getRelationName()); @@ -367,18 +377,43 @@ public class ThirdAppMessageServiceImpl implements ThirdAppMessageService { } /** - * 返回钱包事件本人标题。 + * 返回钱包事件本人标题(写入与按请求语言重渲染共用)。 * * @param event 钱包事件 - * @return 固定模板标题 + * @return 当前语言下的固定模板标题 */ private String ownerTitle(AppMessageEventEnum event) { return switch (event) { - case WALLET_PAYMENT -> "下单成功,钱包已扣款"; - case WALLET_REFUND, WALLET_TRANSFER_REFUND -> "退款已到账"; - case WALLET_RECHARGE -> "充值已到账"; - case WALLET_RESET -> "钱包余额已重置"; - default -> event.getLabel(); + case WALLET_PAYMENT -> MsgUtils.getMessage(ErrorCodes.APP_MSG_TITLE_WALLET_PAYMENT); + case WALLET_REFUND, WALLET_TRANSFER_REFUND -> MsgUtils.getMessage(ErrorCodes.APP_MSG_TITLE_WALLET_REFUND); + case WALLET_RECHARGE -> MsgUtils.getMessage(ErrorCodes.APP_MSG_TITLE_WALLET_RECHARGE); + case WALLET_RESET -> MsgUtils.getMessage(ErrorCodes.APP_MSG_TITLE_WALLET_RESET); + case MEAL_VERIFIED -> MsgUtils.getMessage(ErrorCodes.APP_MSG_TITLE_MEAL_VERIFIED); + default -> eventLabel(event); + }; + } + + /** + * 返回事件展示名称(正文前缀)。 + * + * @param event 消息事件 + * @return 当前语言下的事件名称 + */ + private String eventLabel(AppMessageEventEnum event) { + if (event == null) { + return ""; + } + return switch (event) { + case WALLET_UPDATE -> MsgUtils.getMessage(ErrorCodes.APP_MSG_EVENT_WALLET_UPDATE); + case WALLET_BATCH -> MsgUtils.getMessage(ErrorCodes.APP_MSG_EVENT_WALLET_BATCH); + case WALLET_RECHARGE -> MsgUtils.getMessage(ErrorCodes.APP_MSG_EVENT_WALLET_RECHARGE); + case WALLET_PAYMENT -> MsgUtils.getMessage(ErrorCodes.APP_MSG_EVENT_WALLET_PAYMENT); + case WALLET_REFUND -> MsgUtils.getMessage(ErrorCodes.APP_MSG_EVENT_WALLET_REFUND); + case WALLET_TRANSFER -> MsgUtils.getMessage(ErrorCodes.APP_MSG_EVENT_WALLET_TRANSFER); + case WALLET_TRANSFER_REFUND -> MsgUtils.getMessage(ErrorCodes.APP_MSG_EVENT_WALLET_TRANSFER_REFUND); + case WALLET_RETURN_CANTEEN -> MsgUtils.getMessage(ErrorCodes.APP_MSG_EVENT_WALLET_RETURN_CANTEEN); + case WALLET_RESET -> MsgUtils.getMessage(ErrorCodes.APP_MSG_EVENT_WALLET_RESET); + case MEAL_VERIFIED -> MsgUtils.getMessage(ErrorCodes.APP_MSG_EVENT_MEAL_VERIFIED); }; } @@ -387,23 +422,111 @@ public class ThirdAppMessageServiceImpl implements ThirdAppMessageService { * * @param event 钱包事件 * @param details 同一业务操作的钱包明细 - * @return 固定模板正文 + * @return 当前语言下的模板正文 */ private String walletContent(AppMessageEventEnum event, List details) { - StringBuilder content = new StringBuilder(event.getLabel()).append(":"); + String sep = MsgUtils.getMessage(ErrorCodes.APP_MSG_WALLET_DETAIL_SEP); + StringBuilder detailsText = new StringBuilder(); for (int index = 0; index < details.size(); index++) { WalletMessageDetailDto detail = details.get(index); if (index > 0) { - content.append(";"); + detailsText.append(sep); } - content.append(StrUtil.blankToDefault(detail.getWalletName(), "钱包")) - .append(detail.getAmount() >= 0 ? "增加" : "减少") - .append(formatFen(Math.abs(detail.getAmount()))) - .append("元,余额") - .append(formatFen(detail.getBalance())) - .append("元"); + String walletName = StrUtil.blankToDefault(detail.getWalletName(), + MsgUtils.getMessage(ErrorCodes.APP_MSG_WALLET_DEFAULT_NAME)); + String amount = formatFen(Math.abs(detail.getAmount() == null ? 0 : detail.getAmount())); + String balance = formatFen(detail.getBalance() == null ? 0 : detail.getBalance()); + String detailCode = detail.getAmount() != null && detail.getAmount() >= 0 + ? ErrorCodes.APP_MSG_WALLET_DETAIL_INC + : ErrorCodes.APP_MSG_WALLET_DETAIL_DEC; + detailsText.append(MsgUtils.getMessage(detailCode, walletName, amount, balance)); + } + return MsgUtils.getMessage(ErrorCodes.APP_MSG_WALLET_CONTENT, eventLabel(event), detailsText.toString()); + } + + /** + * 按当前请求语言重渲染标题;payload 缺失时回退库中原文。 + */ + private String resolveLocalizedTitle(ThirdAppMessageEntity entity, AppMessageEventEnum event) { + if (event == null) { + return entity.getTitle(); + } + String ownerTitle = ownerTitle(event); + if (AppMessageConstants.RECIPIENT_RELATION.equals(entity.getRecipientType())) { + String subjectName = StrUtil.blankToDefault(entity.getSubjectUserName(), + MsgUtils.getMessage(ErrorCodes.APP_MSG_WARD_FALLBACK)); + return MsgUtils.getMessage(ErrorCodes.APP_MSG_RELATION_TITLE, subjectName, ownerTitle); + } + return ownerTitle; + } + + /** + * 按当前请求语言重渲染正文;无法从 payload 还原时回退库中原文。 + */ + private String resolveLocalizedContent(ThirdAppMessageEntity entity, AppMessageEventEnum event) { + if (event == null) { + return entity.getContent(); + } + String ownerContent; + if (event == AppMessageEventEnum.MEAL_VERIFIED) { + ownerContent = resolveMealContent(entity.getPayloadJson()); + } else if ("wallet".equals(event.getCategory())) { + ownerContent = resolveWalletContent(event, entity.getPayloadJson()); + } else { + ownerContent = null; + } + if (StrUtil.isBlank(ownerContent)) { + return entity.getContent(); + } + if (AppMessageConstants.RECIPIENT_RELATION.equals(entity.getRecipientType())) { + String subjectName = StrUtil.blankToDefault(entity.getSubjectUserName(), + MsgUtils.getMessage(ErrorCodes.APP_MSG_WARD_FALLBACK)); + return MsgUtils.getMessage(ErrorCodes.APP_MSG_RELATION_CONTENT, subjectName, ownerContent); + } + return ownerContent; + } + + private String resolveWalletContent(AppMessageEventEnum event, String payloadJson) { + List details = parseWalletDetails(payloadJson); + if (details == null || details.isEmpty()) { + return null; + } + return walletContent(event, details); + } + + private String resolveMealContent(String payloadJson) { + if (StrUtil.isBlank(payloadJson)) { + return null; + } + try { + JsonNode root = objectMapper.readTree(payloadJson); + String mealName = root.path("mealName").asText(null); + if (StrUtil.isBlank(mealName)) { + mealName = MsgUtils.getMessage(ErrorCodes.APP_MSG_MEAL_DEFAULT_NAME); + } + return MsgUtils.getMessage(ErrorCodes.APP_MSG_MEAL_CONTENT, mealName); + } catch (Exception exception) { + log.warn("解析用餐消息 payload 失败,回退库中正文", exception); + return null; + } + } + + private List parseWalletDetails(String payloadJson) { + if (StrUtil.isBlank(payloadJson)) { + return null; + } + try { + JsonNode root = objectMapper.readTree(payloadJson); + JsonNode detailsNode = root.get("details"); + if (detailsNode == null || !detailsNode.isArray() || detailsNode.isEmpty()) { + return null; + } + return objectMapper.convertValue(detailsNode, new TypeReference>() { + }); + } catch (Exception exception) { + log.warn("解析钱包消息 payload 失败,回退库中正文", exception); + return null; } - return content.toString(); } /** @@ -463,7 +586,7 @@ public class ThirdAppMessageServiceImpl implements ThirdAppMessageService { } /** - * 将消息实体转换为App安全展示模型。 + * 将消息实体转换为App安全展示模型,并按请求语言重渲染 title/content。 * * @param entity 消息实体 * @return App消息模型 @@ -474,6 +597,8 @@ public class ThirdAppMessageServiceImpl implements ThirdAppMessageService { AppMessageEventEnum event = AppMessageEventEnum.fromCode(entity.getEventCode()); vo.setCategory(event == null ? null : event.getCategory()); vo.setRead(AppMessageConstants.READ.equals(entity.getReadStatus())); + vo.setTitle(resolveLocalizedTitle(entity, event)); + vo.setContent(resolveLocalizedContent(entity, event)); return vo; } } diff --git a/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAggregateAliPayServiceImpl.java b/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAggregateAliPayServiceImpl.java index f59434dc..7a336cbd 100644 --- a/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAggregateAliPayServiceImpl.java +++ b/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAggregateAliPayServiceImpl.java @@ -4,6 +4,8 @@ import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.exception.I18nBizException; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.alipay.api.AlipayClient; @@ -109,7 +111,7 @@ public class ThirdAggregateAliPayServiceImpl implements ThirdAggregateAliPayServ @Override public ThirdAggregateAlipayOauthIdentity exchangeOauthCode(String authCode) { if (StrUtil.isBlank(authCode)) { - throw new RuntimeException("支付宝授权码不能为空"); + throw new I18nBizException(ErrorCodes.THIRD_ALIPAY_AUTH_CODE_EMPTY); } AlipaySystemOauthTokenRequest request = new AlipaySystemOauthTokenRequest(); request.setGrantType(OAUTH_GRANT_TYPE); @@ -119,18 +121,18 @@ public class ThirdAggregateAliPayServiceImpl implements ThirdAggregateAliPayServ if (response == null || !response.isSuccess()) { String errorCode = response == null ? "EMPTY_RESPONSE" : StrUtil.firstNonBlank(response.getSubCode(), response.getCode(), "UNKNOWN"); log.warn("|{}|支付宝用户授权失败,errorCode:{}", TAG, errorCode); - throw new RuntimeException("支付宝用户授权失败,请重新扫码"); + throw new I18nBizException(ErrorCodes.THIRD_ALIPAY_OAUTH_FAIL); } ThirdAggregateAlipayOauthIdentity identity = new ThirdAggregateAlipayOauthIdentity(response.getOpenId(), response.getUserId()); if (StrUtil.isBlank(identity.getStableIdentity())) { - throw new RuntimeException("支付宝用户授权未返回付款人标识"); + throw new I18nBizException(ErrorCodes.THIRD_ALIPAY_OAUTH_NO_PAYER); } return identity; } catch (RuntimeException exception) { throw exception; } catch (Exception exception) { log.warn("|{}|支付宝用户授权异常,exceptionType:{}", TAG, exception.getClass().getSimpleName()); - throw new RuntimeException("支付宝用户授权失败,请重新扫码"); + throw new I18nBizException(ErrorCodes.THIRD_ALIPAY_OAUTH_FAIL); } } @@ -182,13 +184,13 @@ public class ThirdAggregateAliPayServiceImpl implements ThirdAggregateAliPayServ } catch (Exception exception) { saveFailedOrder(payOrder, "SDK_EXCEPTION", exception.getClass().getSimpleName()); log.warn("|{}|支付宝JSAPI子订单创建异常,payNo:{},exceptionType:{}", TAG, context.getPayNo(), exception.getClass().getSimpleName()); - throw new RuntimeException("创建支付宝支付订单失败,请重新扫码"); + throw new I18nBizException(ErrorCodes.THIRD_ALIPAY_JSAPI_CREATE_FAIL); } if (response == null || !response.isSuccess() || StrUtil.isBlank(response.getTradeNo())) { String errorCode = response == null ? "EMPTY_RESPONSE" : StrUtil.firstNonBlank(response.getSubCode(), response.getCode(), "EMPTY_TRADE_NO"); saveFailedOrder(payOrder, errorCode, null); log.warn("|{}|支付宝JSAPI子订单创建失败,payNo:{},errorCode:{}", TAG, context.getPayNo(), errorCode); - throw new RuntimeException("创建支付宝支付订单失败,请重新扫码"); + throw new I18nBizException(ErrorCodes.THIRD_ALIPAY_JSAPI_CREATE_FAIL); } Map payParams = new LinkedHashMap<>(); @@ -199,12 +201,12 @@ public class ThirdAggregateAliPayServiceImpl implements ThirdAggregateAliPayServ .set("launchParams", payParams).toString()); try { if (!thirdPayOrderService.save(payOrder)) { - throw new RuntimeException("聚合支付子订单保存失败"); + throw new I18nBizException(ErrorCodes.THIRD_AGGREGATE_SUB_ORDER_SAVE_FAIL); } } catch (RuntimeException exception) { thirdAppPlusAliPayService.cancel(context.getPayNo(), JSONUtil.toJsonStr(paySetting)); log.error("|{}|支付宝JSAPI子订单保存失败,已执行最佳努力撤销,payNo:{}", TAG, context.getPayNo()); - throw new RuntimeException("创建支付宝支付订单失败,请重新扫码"); + throw new I18nBizException(ErrorCodes.THIRD_ALIPAY_JSAPI_CREATE_FAIL); } return new ThirdAggregateCashierLaunch(AppPlusPlatformTypeEnum.ALI_PAY, context.getPayNo(), payParams); } @@ -252,7 +254,7 @@ public class ThirdAggregateAliPayServiceImpl implements ThirdAggregateAliPayServ sdkConfig.setSignType("RSA2"); alipayClient = new DefaultAlipayClient(sdkConfig); } catch (Exception exception) { - throw new RuntimeException("支付宝客户端初始化失败"); + throw new I18nBizException(ErrorCodes.THIRD_ALIPAY_CLIENT_INIT_FAIL); } } return alipayClient; @@ -323,11 +325,11 @@ public class ThirdAggregateAliPayServiceImpl implements ThirdAggregateAliPayServ */ private MchPaySettingEntity.AliPaySetting parseAliPaySetting(MchPaySettingVo paySetting) { if (paySetting == null || StrUtil.isBlank(paySetting.getSettingJson())) { - throw new RuntimeException("商户支付宝支付配置不完整"); + throw new I18nBizException(ErrorCodes.THIRD_MCH_ALIPAY_CONFIG_INCOMPLETE); } MchPaySettingEntity.AliPaySetting setting = JSONUtil.toBean(paySetting.getSettingJson(), MchPaySettingEntity.AliPaySetting.class); if (setting == null || StrUtil.isBlank(setting.getSubMchid())) { - throw new RuntimeException("商户支付宝直付通二级商户标识未配置"); + throw new I18nBizException(ErrorCodes.THIRD_MCH_ALIPAY_SUB_MCH_MISSING); } return setting; } @@ -338,7 +340,7 @@ public class ThirdAggregateAliPayServiceImpl implements ThirdAggregateAliPayServ return; } if (mchFzRelationService == null) { - throw new RuntimeException("支付宝平台分佣关系服务不可用"); + throw new I18nBizException(ErrorCodes.THIRD_FZ_RELATION_UNAVAILABLE); } mchFzRelationService.requirePaymentRelation(context.getFzRelationId(), paySetting); } diff --git a/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAggregateWechatPayServiceImpl.java b/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAggregateWechatPayServiceImpl.java index 3ea4cde1..80fd7c6c 100644 --- a/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAggregateWechatPayServiceImpl.java +++ b/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAggregateWechatPayServiceImpl.java @@ -1,6 +1,8 @@ package com.bsd.pjcloud.thirdparty.service.impl.appplus; import cn.hutool.core.util.StrUtil; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.exception.I18nBizException; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; import cn.hutool.json.JSONObject; @@ -107,7 +109,7 @@ public class ThirdAggregateWechatPayServiceImpl implements ThirdAggregateWechatP AppPlusPayConfig.WechatConfig wechatConfig = appPlusPayConfig.getWechatConfig(); if (StrUtil.isBlank(authCode) || wechatConfig == null || StrUtil.hasBlank(wechatConfig.getGzhAppId(), wechatConfig.getGzhAppSecret())) { - throw new RuntimeException("微信用户授权参数不完整"); + throw new I18nBizException(ErrorCodes.THIRD_WX_OAUTH_INCOMPLETE); } Map form = new LinkedHashMap<>(); form.put("appid", wechatConfig.getGzhAppId()); @@ -120,20 +122,20 @@ public class ThirdAggregateWechatPayServiceImpl implements ThirdAggregateWechatP .execute()) { if (!response.isOk()) { log.warn("|{}|微信用户授权HTTP失败,httpStatus:{}", TAG, response.getStatus()); - throw new RuntimeException("微信用户授权失败,请重新扫码"); + throw new I18nBizException(ErrorCodes.THIRD_WX_OAUTH_FAIL); } JSONObject body = JSONUtil.parseObj(response.body()); String spOpenId = body.getStr("openid"); if (StrUtil.isBlank(spOpenId)) { log.warn("|{}|微信用户授权业务失败,errorCode:{}", TAG, body.getStr("errcode")); - throw new RuntimeException("微信用户授权失败,请重新扫码"); + throw new I18nBizException(ErrorCodes.THIRD_WX_OAUTH_FAIL); } return spOpenId; } catch (RuntimeException exception) { throw exception; } catch (Exception exception) { log.warn("|{}|微信用户授权异常,exceptionType:{}", TAG, exception.getClass().getSimpleName()); - throw new RuntimeException("微信用户授权失败,请重新扫码"); + throw new I18nBizException(ErrorCodes.THIRD_WX_OAUTH_FAIL); } } @@ -172,7 +174,7 @@ public class ThirdAggregateWechatPayServiceImpl implements ThirdAggregateWechatP boolean enableFz = context.getFzRelationId() != null; if (enableFz) { if (mchFzRelationService == null) { - throw new RuntimeException("微信平台分佣关系服务不可用"); + throw new I18nBizException(ErrorCodes.THIRD_FZ_RELATION_UNAVAILABLE); } mchFzRelationService.requirePaymentRelation(context.getFzRelationId(), paySetting); } @@ -187,15 +189,15 @@ public class ThirdAggregateWechatPayServiceImpl implements ThirdAggregateWechatP String errorCode = StrUtil.blankToDefault(exception.getErrorCode(), "UNKNOWN"); saveFailedOrder(payOrder, errorCode, exception.getClass().getSimpleName()); log.warn("|{}|微信JSAPI子订单创建失败,payNo:{},errorCode:{}", TAG, context.getPayNo(), errorCode); - throw new RuntimeException("创建微信支付订单失败,请重新扫码"); + throw new I18nBizException(ErrorCodes.THIRD_WX_JSAPI_CREATE_FAIL); } catch (Exception exception) { saveFailedOrder(payOrder, "SDK_EXCEPTION", exception.getClass().getSimpleName()); log.warn("|{}|微信JSAPI子订单创建异常,payNo:{},exceptionType:{}", TAG, context.getPayNo(), exception.getClass().getSimpleName()); - throw new RuntimeException("创建微信支付订单失败,请重新扫码"); + throw new I18nBizException(ErrorCodes.THIRD_WX_JSAPI_CREATE_FAIL); } if (!isCompleteResponse(response)) { saveFailedOrder(payOrder, "INCOMPLETE_RESPONSE", null); - throw new RuntimeException("创建微信支付订单失败,请重新扫码"); + throw new I18nBizException(ErrorCodes.THIRD_WX_JSAPI_CREATE_FAIL); } Map payParams = new LinkedHashMap<>(); @@ -208,12 +210,12 @@ public class ThirdAggregateWechatPayServiceImpl implements ThirdAggregateWechatP payOrder.setPayRes(JSONUtil.createObj().set("aggregatePay", true).set("launchParams", payParams).toString()); try { if (!thirdPayOrderService.save(payOrder)) { - throw new RuntimeException("聚合支付子订单保存失败"); + throw new I18nBizException(ErrorCodes.THIRD_AGGREGATE_SUB_ORDER_SAVE_FAIL); } } catch (RuntimeException exception) { close(context.getPayNo(), JSONUtil.toJsonStr(paySetting)); log.error("|{}|微信JSAPI子订单保存失败,已执行最佳努力关单,payNo:{}", TAG, context.getPayNo()); - throw new RuntimeException("创建微信支付订单失败,请重新扫码"); + throw new I18nBizException(ErrorCodes.THIRD_WX_JSAPI_CREATE_FAIL); } return new ThirdAggregateCashierLaunch(AppPlusPlatformTypeEnum.WECHAT, context.getPayNo(), payParams); } @@ -339,11 +341,11 @@ public class ThirdAggregateWechatPayServiceImpl implements ThirdAggregateWechatP */ private MchPaySettingEntity.WechatPaySetting parseWechatPaySetting(MchPaySettingVo paySetting) { if (paySetting == null || StrUtil.isBlank(paySetting.getSettingJson())) { - throw new RuntimeException("商户微信支付配置不完整"); + throw new I18nBizException(ErrorCodes.THIRD_MCH_WECHAT_CONFIG_INCOMPLETE); } MchPaySettingEntity.WechatPaySetting setting = JSONUtil.toBean(paySetting.getSettingJson(), MchPaySettingEntity.WechatPaySetting.class); if (setting == null || StrUtil.isBlank(setting.getSubMchid())) { - throw new RuntimeException("商户微信子商户号未配置"); + throw new I18nBizException(ErrorCodes.THIRD_MCH_WECHAT_SUB_MCH_MISSING); } return setting; } @@ -356,11 +358,11 @@ public class ThirdAggregateWechatPayServiceImpl implements ThirdAggregateWechatP */ private MchPaySettingEntity.WechatPaySetting parseWechatPaySettingSnapshot(String settingJson) { if (StrUtil.isBlank(settingJson)) { - throw new RuntimeException("支付订单缺少商户配置快照"); + throw new I18nBizException(ErrorCodes.THIRD_PAY_ORDER_SNAPSHOT_MISSING); } MchPaySettingEntity snapshot = JSONUtil.toBean(settingJson, MchPaySettingEntity.class); if (snapshot == null || StrUtil.isBlank(snapshot.getSettingJson())) { - throw new RuntimeException("支付订单商户配置快照无效"); + throw new I18nBizException(ErrorCodes.THIRD_PAY_ORDER_SNAPSHOT_INVALID); } MchPaySettingVo setting = new MchPaySettingVo(); setting.setSettingJson(snapshot.getSettingJson()); diff --git a/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAppPlusAliPayServiceImpl.java b/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAppPlusAliPayServiceImpl.java index ecdd2a0f..20312eaa 100644 --- a/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAppPlusAliPayServiceImpl.java +++ b/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAppPlusAliPayServiceImpl.java @@ -48,6 +48,8 @@ import com.alipay.api.response.AlipayTradeSettleConfirmResponse; import com.alipay.api.response.AlipayTradeOrderSettleResponse; import com.alipay.api.response.AlipayTradeOrderSettleQueryResponse; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.exception.I18nBizException; import com.bsd.pjcloud.thirdparty.config.AppPlusPayConfig; import com.bsd.pjcloud.thirdparty.constant.fz.ThirdMchFzRelationStatusEnum; import com.bsd.pjcloud.thirdparty.constant.miniplatform.AppPlusPlatformTypeEnum; @@ -207,7 +209,7 @@ public class ThirdAppPlusAliPayServiceImpl implements ThirdAppPlusAliPayService alipayClient = new DefaultAlipayClient(getAlipayConfig()); } catch (Exception e) { log.error("初始化支付宝客户端失败", e); - throw new RuntimeException("支付宝客户端初始化失败"); + throw new I18nBizException(ErrorCodes.THIRD_ALIPAY_CLIENT_INIT_FAIL); } } return alipayClient; @@ -371,20 +373,19 @@ public class ThirdAppPlusAliPayServiceImpl implements ThirdAppPlusAliPayService payOrder.setPayRes(buildExceptionSnapshot(exception).toString()); thirdPayOrderService.save(payOrder); log.error("|{}|支付宝订单码预创建异常,payNo:{},exceptionType:{}", TAG, dto.getOutTradeNo(), exception.getClass().getSimpleName()); - throw new RuntimeException("创建支付宝订单码失败,请稍后重试"); + throw new I18nBizException(ErrorCodes.THIRD_ALI_QR_CREATE_FAIL); } payOrder.setPayRes(buildPrecreateResponseSnapshot(response).toString()); if (response == null || !response.isSuccess()) { payOrder.setStatus(ThirdPayOrderStatusEnum.PAY_FAILED.getType()); thirdPayOrderService.save(payOrder); - String errorCode = response == null ? "EMPTY_RESPONSE" : StrUtil.firstNonBlank(response.getSubCode(), response.getCode(), "UNKNOWN"); - throw new RuntimeException("创建支付宝订单码失败,支付宝错误码:" + errorCode); + throw new I18nBizException(ErrorCodes.THIRD_ALI_QR_CREATE_FAIL); } if (StrUtil.isBlank(response.getQrCode())) { payOrder.setStatus(ThirdPayOrderStatusEnum.PAY_FAILED.getType()); thirdPayOrderService.save(payOrder); - throw new RuntimeException("创建支付宝订单码失败,支付宝未返回二维码"); + throw new I18nBizException(ErrorCodes.THIRD_ALI_QR_CREATE_FAIL); } thirdPayOrderService.save(payOrder); @@ -449,12 +450,12 @@ public class ThirdAppPlusAliPayServiceImpl implements ThirdAppPlusAliPayService payOrder.setFzRelationId(dto.getFzRelationId()); validateFzRatioAndRelation(dto, setting); if (dto.getAmount() == null || dto.getAmount() <= 0) { - throw new RuntimeException("支付宝支付金额必须大于0分"); + throw new I18nBizException(ErrorCodes.THIRD_ALI_AMOUNT_INVALID); } boolean enableFz = dto.getFzRelationId() != null; if (enableFz) { if (dto.getAmount() <= 10) { - throw new RuntimeException("支付宝直付通支付金额必须大于10分"); + throw new I18nBizException(ErrorCodes.THIRD_ALI_ZT_AMOUNT_MIN); } // 上层通常已经通过 requireBound 解析关系;底层再次核对是为了防止内部调用者伪造 // fzRelationId,把其他商户、其他 smid 或尚未绑定的关系带入支付宝支付请求。 @@ -539,7 +540,7 @@ public class ThirdAppPlusAliPayServiceImpl implements ThirdAppPlusAliPayService } if (refundFee == null || refundFee <= 0 || thirdPayOrder.getPrice() == null || refundFee > thirdPayOrder.getPrice()) { - throw new RuntimeException("支付宝退款金额必须大于0且不能超过订单金额"); + throw new I18nBizException(ErrorCodes.THIRD_ALI_REFUND_AMOUNT_BAD); } ThirdPayOrderEntity updateObj = new ThirdPayOrderEntity(); @@ -1811,7 +1812,7 @@ public class ThirdAppPlusAliPayServiceImpl implements ThirdAppPlusAliPayService */ private MchPaySettingEntity.AliPaySetting parseAliPaySetting(MchPaySettingVo setting) { if (setting == null || StrUtil.isBlank(setting.getSettingJson())) { - throw new RuntimeException("商户支付宝支付配置不完整"); + throw new I18nBizException(ErrorCodes.THIRD_MCH_ALIPAY_CONFIG_INCOMPLETE); } MchPaySettingEntity.AliPaySetting aliPaySetting = JSONUtil.toBean(setting.getSettingJson(), MchPaySettingEntity.AliPaySetting.class); if (aliPaySetting == null || StrUtil.isBlank(aliPaySetting.getSubMchid())) { diff --git a/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAppPlusServiceImpl.java b/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAppPlusServiceImpl.java index 3f9ab136..c4026f5f 100644 --- a/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAppPlusServiceImpl.java +++ b/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAppPlusServiceImpl.java @@ -23,6 +23,8 @@ import com.bsd.pjcloud.app.api.dto.AppUserInfo; import com.bsd.pjcloud.app.api.feign.RemoteAppUserService; import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum; import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.exception.I18nBizException; import com.bsd.pjcloud.common.core.util.R; import com.bsd.pjcloud.hard.api.dto.order.remote.HardUpdateShopStatusDto; import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity; @@ -350,16 +352,16 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { try { bizId = Long.valueOf(dto.getBizId()); } catch (Exception e) { - throw new RuntimeException("充值业务id解析错误"); + throw new I18nBizException(ErrorCodes.THIRD_RECHARGE_BIZ_ID_INVALID); } // 查询充值配置 WalletRechargePackageEntity walletPackage = remoteWalletRechargePackageService.remoteGetById(bizId).getData(); if (ObjectUtil.isEmpty(walletPackage)) { - throw new RuntimeException("错误的充值配置"); + throw new I18nBizException(ErrorCodes.WALLET_PACKAGE_NOT_FOUND); } int price = walletPackage.getPayPrice(); if (price <= 0) { - throw new RuntimeException("错误的充值配置"); + throw new I18nBizException(ErrorCodes.WALLET_PACKAGE_AMOUNT_INVALID); } dto.setAmount(price); mchManage = getUserMerchant(userId); @@ -369,14 +371,14 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { try { rechargeId = Long.valueOf(dto.getBizId()); } catch (Exception exception) { - throw new RuntimeException("代充值业务id解析错误"); + throw new I18nBizException(ErrorCodes.THIRD_PROXY_RECHARGE_BIZ_ID_INVALID); } // 类型 40 仍走统一 App 支付,只从待支付充值记录解析可信金额和目标饭卡。 R rechargeResult = remoteWalletRechargeService.getRechargeById(rechargeId); WalletRechargeEntity recharge = rechargeResult == null || !rechargeResult.isOk() ? null : rechargeResult.getData(); if (recharge == null || recharge.getWalletId() == null || recharge.getPackageId() == null || !Boolean.FALSE.equals(recharge.getPayStatus()) || recharge.getPayPrice() == null || recharge.getPayPrice() <= 0) { - throw new RuntimeException("代充值记录不存在或金额无效"); + throw new I18nBizException(ErrorCodes.THIRD_PROXY_RECHARGE_INVALID); } R walletResult = remoteWalletService.getWalletById(recharge.getWalletId()); WalletManageEntity wallet = walletResult == null || !walletResult.isOk() ? null : walletResult.getData(); @@ -387,30 +389,30 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { || ObjectUtil.equals(wallet.getStatus(), WalleCardStatusEnum.NONE_ACTIVE.getCode()) || ObjectUtil.equals(wallet.getStatus(), WalleCardStatusEnum.ACTIVE.getCode())); if (!walletSupportsRecharge) { - throw new RuntimeException("目标饭卡当前不可充值"); + throw new I18nBizException(ErrorCodes.THIRD_WARD_WALLET_NO_RECHARGE); } R> relationResult = remoteUserRelationService.listActiveGuardianWardUserIds(userId); if (relationResult == null || !relationResult.isOk() || relationResult.getData() == null || !relationResult.getData().contains(wallet.getUserId())) { - throw new RuntimeException("无权操作该被监护人"); + throw new I18nBizException(ErrorCodes.WALLET_NO_WARD_PERM); } R merchantResult = remoteMchService.getViewsMchByDeptId(wallet.getDeptId(), List.of(MerchantTypeEnum.FARMER, MerchantTypeEnum.CANTEEN)); mchManage = merchantResult == null || !merchantResult.isOk() ? null : merchantResult.getData(); if (ObjectUtil.isEmpty(mchManage)) { - throw new RuntimeException("饭卡所属食堂不存在"); + throw new I18nBizException(ErrorCodes.WALLET_CARD_CANTEEN_MISSING); } // 支付创建时再次读取目标用户身份,防止待支付记录创建后商户身份配置变化导致越权充值。 validateTopUpIdentity(mchManage, wallet.getUserId()); dto.setAmount(recharge.getPayPrice()); } else if (ObjectUtil.equals(dto.getBizType(), ThirdPayOrderBizTypeEnum.APP_SHOP_PAY)) { if (dto.getAmount() == null || dto.getAmount() <= 0) { - throw new RuntimeException("支付金额不能小于等于0"); + throw new I18nBizException(ErrorCodes.THIRD_PAY_AMOUNT_GT_ZERO); } mchManage = resolveShopPayMerchant(userId, dto); } else { - throw new RuntimeException("不支持的支付类型"); + throw new I18nBizException(ErrorCodes.COMMON_UNSUPPORTED_PAY_TYPE); } if (ObjectUtil.isEmpty(mchManage) || ObjectUtil.isEmpty(mchManage.getPaySettingList())) { - throw new RuntimeException("商户未配置支付参数"); + throw new I18nBizException(ErrorCodes.WALLET_PAY_METHOD_MISSING); } validateMerchantForPayment(mchManage); List paySettingList = mchManage.getPaySettingList(); @@ -441,7 +443,7 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { pollingCoordinator.wakePaymentCompensationPolling(); } if (ObjectUtil.isEmpty(appPlusPayParams)) { - throw new RuntimeException("创建微信支付错误"); + throw new I18nBizException(ErrorCodes.THIRD_WECHAT_PAY_CREATE_FAIL); } result.setAppPlusPayParams(appPlusPayParams); } @@ -457,7 +459,7 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { pollingCoordinator.wakePaymentCompensationPolling(); } if (ObjectUtil.isEmpty(orderStr)) { - throw new RuntimeException("创建支付宝支付错误"); + throw new I18nBizException(ErrorCodes.THIRD_ALIPAY_PAY_CREATE_FAIL); } HashMap aliPayParams = new HashMap(); aliPayParams.put("orderInfo", orderStr); @@ -465,7 +467,7 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { } // 不支持的支付类型 else { - throw new RuntimeException("不支持的支付类型"); + throw new I18nBizException(ErrorCodes.COMMON_UNSUPPORTED_PAY_TYPE); } return result; } @@ -477,12 +479,12 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { R userResult = remoteUserService.getByUserId(userId); UserInfo userInfo = userResult == null || !userResult.isOk() ? null : userResult.getData(); if (ObjectUtil.isEmpty(userInfo)) { - throw new RuntimeException("用户不存在"); + throw new I18nBizException(ErrorCodes.COMMON_USER_NOT_EXIST); } R merchantResult = remoteMchService.getViewsMchByDeptId(userInfo.getSysUser().getDeptId(), List.of(MerchantTypeEnum.FARMER, MerchantTypeEnum.CANTEEN)); MchManageVo merchant = merchantResult == null || !merchantResult.isOk() ? null : merchantResult.getData(); if (ObjectUtil.isEmpty(merchant)) { - throw new RuntimeException("用户不属于任何食堂或者商城"); + throw new I18nBizException(ErrorCodes.THIRD_USER_NO_MCH); } return merchant; } @@ -510,10 +512,10 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { try { userResult = remoteUserService.getUserDeptByIds(List.of(targetUserId)); } catch (Exception exception) { - throw new RuntimeException("查询充值用户身份失败", exception); + throw new I18nBizException(ErrorCodes.WALLET_IDENTITY_QUERY_FAIL); } if (userResult == null || !userResult.isOk() || userResult.getData() == null || userResult.getData().isEmpty()) { - throw new RuntimeException("查询充值用户身份失败"); + throw new I18nBizException(ErrorCodes.WALLET_IDENTITY_QUERY_FAIL); } UserVO targetUser = userResult.getData().get(0); boolean allowed = targetUser.getIdentityTypes() != null && targetUser.getIdentityTypes().stream() @@ -521,7 +523,7 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { .map(String::trim) .anyMatch(allowedIdentityTypes::contains); if (!allowed) { - throw new RuntimeException("当前人员身份不支持钱包充值"); + throw new I18nBizException(ErrorCodes.WALLET_IDENTITY_NO_RECHARGE); } } @@ -535,13 +537,13 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { */ private MchManageVo resolveShopPayMerchant(Long userId, ThirdMiniAppPayDto dto) { if (!(dto instanceof ThirdMiniRemotePayDto remotePayDto) || remotePayDto.getMchId() == null) { - throw new RuntimeException("商城支付缺少可信商户信息"); + throw new I18nBizException(ErrorCodes.THIRD_SHOP_PAY_MCH_MISSING); } Long orderId; try { orderId = Long.valueOf(dto.getBizId()); } catch (Exception exception) { - throw new RuntimeException("商城订单业务id解析错误"); + throw new I18nBizException(ErrorCodes.THIRD_SHOP_ORDER_BIZ_ID_INVALID); } R> orderResult = remoteHardOrderService.getByIds(List.of(orderId)); List orders = orderResult == null || !orderResult.isOk() ? null : orderResult.getData(); @@ -549,17 +551,17 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { .filter(item -> item != null && ObjectUtil.equals(item.getId(), orderId)) .findFirst().orElse(null); if (order == null || order.getMerchantId() == null || !ObjectUtil.equals(order.getUserId(), userId)) { - throw new RuntimeException("商城订单不存在或无权支付"); + throw new I18nBizException(ErrorCodes.THIRD_SHOP_ORDER_NO_PAY); } if (order.getPayPrice() == null || order.getPayPrice() <= 0 || ObjectUtil.notEqual(order.getPayPrice(), dto.getAmount())) { - throw new RuntimeException("商城订单支付金额不一致"); + throw new I18nBizException(ErrorCodes.THIRD_SHOP_ORDER_AMOUNT_MISMATCH); } if (!ObjectUtil.equals(order.getMerchantId(), remotePayDto.getMchId())) { - throw new RuntimeException("商城订单收款商户不一致"); + throw new I18nBizException(ErrorCodes.THIRD_SHOP_ORDER_MCH_MISMATCH); } MchManageVo merchant = getMerchantById(order.getMerchantId()); if (merchant == null) { - throw new RuntimeException("商城订单收款商户不存在"); + throw new I18nBizException(ErrorCodes.COMMON_MCH_NOT_FOUND); } return merchant; } @@ -571,10 +573,10 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { */ private void validateMerchantForPayment(MchManageVo merchant) { if (merchant == null || merchant.getId() == null) { - throw new RuntimeException("收款商户不存在"); + throw new I18nBizException(ErrorCodes.COMMON_MCH_NOT_FOUND); } if (ObjectUtil.equals(merchant.getCooperationStatus(), YesNoEnum.NO.getCode())) { - throw new RuntimeException("收款商户已停用"); + throw new I18nBizException(ErrorCodes.THIRD_MCH_PAY_DISABLED); } } @@ -603,17 +605,17 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { if (ObjectUtil.equals(dto.getMiniPlatformType(), AppPlusPlatformTypeEnum.ZAX_APP_WALLET)) { UserInfo userInfo = remoteUserService.getByUserId(dto.getUserId()).getData(); if (ObjectUtil.isEmpty(userInfo)) { - throw new RuntimeException("用户不存在"); + throw new I18nBizException(ErrorCodes.COMMON_USER_NOT_EXIST); } mchManage = remoteMchService.getViewsCanteenMchByDeptId(userInfo.getSysUser().getDeptId()).getData(); } else { mchManage = remoteMchService.getById(dto.getMchId()).getData(); } if (ObjectUtil.isEmpty(mchManage)) { - throw new RuntimeException("用户不属于任何食堂"); + throw new I18nBizException(ErrorCodes.THIRD_USER_NO_CANTEEN); } if (ObjectUtil.isEmpty(mchManage.getPaySettingList())) { - throw new RuntimeException("商户未配置支付参数"); + throw new I18nBizException(ErrorCodes.WALLET_PAY_METHOD_MISSING); } List paySettingList = mchManage.getPaySettingList(); @@ -622,7 +624,7 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { } // 不支持的类型 else { - throw new RuntimeException("不支持的支付类型"); + throw new I18nBizException(ErrorCodes.COMMON_UNSUPPORTED_PAY_TYPE); } ThirdAppPlusPayDto appPlusPayDto = new ThirdAppPlusPayDto(); @@ -644,7 +646,7 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { if (ObjectUtil.equals(dto.getMiniPlatformType().getType(), AppPlusPlatformTypeEnum.WECHAT.getType())) { MchPaySettingVo paySetting = paySettingList.stream().filter(item -> ObjectUtil.equals(item.getPlatformType(), AppPlusPlatformPayType.WECHAT.getType())).findFirst().orElse(null); if (ObjectUtil.isEmpty(paySetting)) { - throw new RuntimeException("商户未配置微信支付参数"); + throw new I18nBizException(ErrorCodes.THIRD_MCH_WECHAT_PAY_CONFIG_MISSING); } paySetting = applyDefaultPaymentRelation(paySetting, appPlusPayDto); @@ -657,13 +659,13 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { else if (ObjectUtil.equals(dto.getMiniPlatformType().getType(), AppPlusPlatformTypeEnum.ALI_PAY.getType())) { MchPaySettingVo paySetting = paySettingList.stream().filter(item -> ObjectUtil.equals(item.getPlatformType(), AppPlusPlatformPayType.ALI_PAY.getType())).findFirst().orElse(null); if (ObjectUtil.isEmpty(paySetting)) { - throw new RuntimeException("商户未配置微信支付参数"); + throw new I18nBizException(ErrorCodes.THIRD_MCH_ALIPAY_PAY_CONFIG_MISSING); } applyDefaultPaymentRelation(paySetting, appPlusPayDto); } // 不支持的支付类型 else { - throw new RuntimeException("不支持的支付类型"); + throw new I18nBizException(ErrorCodes.COMMON_UNSUPPORTED_PAY_TYPE); } return null; } @@ -681,7 +683,7 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { String lockToken = UUID.randomUUID().toString(); Boolean lockAcquired = stringRedisTemplate.opsForValue().setIfAbsent(lockKey, lockToken, ORDER_CODE_LOCK_TTL); if (!Boolean.TRUE.equals(lockAcquired)) { - throw new RuntimeException("订单码支付正在处理中,请勿重复提交"); + throw new I18nBizException(ErrorCodes.THIRD_ORDER_CODE_PROCESSING); } try { ThirdOrderCodePayVo result = createOrReuseOrderCodePay(dto); @@ -698,13 +700,13 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { @Override public ThirdOrderCodePayStatusVo getOrderCodePayStatus(String payNo) { if (StrUtil.isBlank(payNo)) { - throw new RuntimeException("支付订单号不能为空"); + throw new I18nBizException(ErrorCodes.THIRD_PAY_NO_EMPTY); } ThirdPayOrderEntity payOrder = thirdPayOrderService.getByPayNo(payNo); if (payOrder == null || ObjectUtil.notEqual(payOrder.getBizType(), ThirdPayOrderBizTypeEnum.YXFJ_PAY.getType()) || !isSupportedOrderCodePlatform(payOrder.getPayPlatformType())) { - throw new RuntimeException("订单码支付订单不存在"); + throw new I18nBizException(ErrorCodes.THIRD_ORDER_CODE_NOT_FOUND); } ThirdOrderCodePayStatusVo result = new ThirdOrderCodePayStatusVo(); result.setPayNo(payOrder.getPayNo()); @@ -742,19 +744,19 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { private ThirdOrderCodePayVo createOrReuseOrderCodePay(ThirdOrderCodePayDto dto) { thirdAggregateOrderPayService.assertNoBlockingAggregateSession(dto.getBizType(), dto.getBizId()); if (hasSuccessfulOrderCodePay(dto.getBizType(), dto.getBizId())) { - throw new RuntimeException("该业务订单已支付,请勿重复下单"); + throw new I18nBizException(ErrorCodes.THIRD_ORDER_ALREADY_PAID); } ThirdPayOrderEntity latestOrder = getLatestOrderCodePay(dto.getBizType(), dto.getBizId()); if (latestOrder != null) { if (ObjectUtil.equals(latestOrder.getStatus(), ThirdPayOrderStatusEnum.PAY_SUCCESS.getType())) { - throw new RuntimeException("该业务订单已支付,请勿重复下单"); + throw new I18nBizException(ErrorCodes.THIRD_ORDER_ALREADY_PAID); } if (ObjectUtil.equals(latestOrder.getStatus(), ThirdPayOrderStatusEnum.PAY_UNPAID.getType())) { validateReusableOrder(latestOrder, dto); String qrCode = getOrderCodeQrCode(latestOrder); if (latestOrder.getExpireTime() != null && latestOrder.getExpireTime().isAfter(LocalDateTime.now()) && StrUtil.isNotBlank(qrCode)) { if (ObjectUtil.notEqual(latestOrder.getPayPlatformType(), dto.getMiniPlatformType().getType())) { - throw new RuntimeException("该业务订单已有其他平台的待支付订单码"); + throw new I18nBizException(ErrorCodes.THIRD_ORDER_CODE_OTHER_PLATFORM); } return buildOrderCodePayVo(latestOrder, qrCode); } @@ -763,13 +765,13 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { queryPayResult(latestOrder); latestOrder = thirdPayOrderService.getById(latestOrder.getId()); if (latestOrder != null && ObjectUtil.equals(latestOrder.getStatus(), ThirdPayOrderStatusEnum.PAY_SUCCESS.getType())) { - throw new RuntimeException("该业务订单已支付,请勿重复下单"); + throw new I18nBizException(ErrorCodes.THIRD_ORDER_ALREADY_PAID); } if (latestOrder != null && ObjectUtil.equals(latestOrder.getStatus(), ThirdPayOrderStatusEnum.PAY_UNPAID.getType())) { if (latestOrder.getExpireTime() != null && latestOrder.getExpireTime().isAfter(LocalDateTime.now())) { - throw new RuntimeException("订单码数据异常,请稍后重试"); + throw new I18nBizException(ErrorCodes.THIRD_ORDER_CODE_DATA_ERROR); } - throw new RuntimeException("上一笔订单正在确认关闭,请稍后重试"); + throw new I18nBizException(ErrorCodes.THIRD_ORDER_CLOSING); } } } @@ -830,22 +832,22 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { */ private void validateOrderCodePayRequest(ThirdOrderCodePayDto dto) { if (dto == null) { - throw new RuntimeException("订单码支付参数不能为空"); + throw new I18nBizException(ErrorCodes.THIRD_ORDER_CODE_PARAM_EMPTY); } if (ObjectUtil.notEqual(dto.getBizType(), ThirdPayOrderBizTypeEnum.YXFJ_PAY)) { - throw new RuntimeException("订单码支付仅支持云消费机支付业务"); + throw new I18nBizException(ErrorCodes.THIRD_ORDER_CODE_BIZ_ONLY); } if (dto.getMiniPlatformType() == null || !isSupportedOrderCodePlatform(dto.getMiniPlatformType().getType())) { - throw new RuntimeException("订单码支付仅支持支付宝或微信"); + throw new I18nBizException(ErrorCodes.THIRD_ORDER_CODE_PLATFORM_ONLY); } if (StrUtil.isBlank(dto.getBizId())) { - throw new RuntimeException("支付业务id不能为空"); + throw new I18nBizException(ErrorCodes.THIRD_PAY_BIZ_ID_EMPTY); } if (dto.getMchId() == null) { - throw new RuntimeException("商户id不能为空"); + throw new I18nBizException(ErrorCodes.COMMON_MCH_ID_EMPTY); } if (dto.getAmount() == null || dto.getAmount() <= 0) { - throw new RuntimeException("支付金额必须大于0"); + throw new I18nBizException(ErrorCodes.THIRD_PAY_AMOUNT_GT_ZERO); } } @@ -882,7 +884,7 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { */ private void validateReusableOrder(ThirdPayOrderEntity payOrder, ThirdOrderCodePayDto dto) { if (ObjectUtil.notEqual(payOrder.getMchId(), dto.getMchId()) || ObjectUtil.notEqual(payOrder.getPrice(), dto.getAmount())) { - throw new RuntimeException("该业务订单已有不同金额或商户的待支付订单"); + throw new I18nBizException(ErrorCodes.THIRD_ORDER_PENDING_MISMATCH); } } @@ -919,13 +921,13 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { R merchantResult = remoteMchService.getById(mchId); MchManageVo merchant = merchantResult == null || !merchantResult.isOk() ? null : merchantResult.getData(); if (merchant == null) { - throw new RuntimeException("收款商户不存在"); + throw new I18nBizException(ErrorCodes.COMMON_MCH_NOT_FOUND); } if (merchant.getId() == null || ObjectUtil.notEqual(merchant.getId(), mchId)) { - throw new RuntimeException("收款商户信息不一致"); + throw new I18nBizException(ErrorCodes.THIRD_MCH_INFO_MISMATCH); } if (ObjectUtil.isEmpty(merchant.getPaySettingList())) { - throw new RuntimeException("商户未配置支付参数"); + throw new I18nBizException(ErrorCodes.WALLET_PAY_METHOD_MISSING); } return merchant; } @@ -946,7 +948,7 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { .findFirst() .orElse(null); if (paySetting == null) { - throw new RuntimeException("商户未启用支付宝支付配置"); + throw new I18nBizException(ErrorCodes.THIRD_MCH_ALIPAY_CONFIG_DISABLED); } return paySetting; } @@ -961,7 +963,7 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { .findFirst() .orElse(null); if (paySetting == null) { - throw new RuntimeException("商户未启用微信支付配置"); + throw new I18nBizException(ErrorCodes.THIRD_MCH_WECHAT_CONFIG_DISABLED); } return paySetting; } @@ -973,7 +975,7 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { AppPlusPayConfig.AliPayConfig config = appPlusPayConfig.getAliPayConfig(); if (config == null || StrUtil.hasBlank(config.getAppId(), config.getAppPrivateKey(), config.getAlipayPublicKey(), config.getBaseCallbackUrl(), config.getPayCallbackUrl())) { - throw new RuntimeException("支付宝应用支付配置不完整"); + throw new I18nBizException(ErrorCodes.THIRD_ALIPAY_APP_CONFIG_INCOMPLETE); } } @@ -985,7 +987,7 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { if (config == null || StrUtil.hasBlank(config.getAppPlatformAppId(), config.getMerchantId(), config.getMchPrivatePath(), config.getMerchantSerialNumber(), config.getApiV3Key(), config.getBaseCallbackUrl(), config.getPayCallbackUrl())) { - throw new RuntimeException("微信服务商支付配置不完整"); + throw new I18nBizException(ErrorCodes.THIRD_WECHAT_APP_CONFIG_INCOMPLETE); } } @@ -1037,7 +1039,7 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { ThirdPayOrderEntity thirdPayOrder = thirdPayOrderService.getByPayNo(dto.getPayNo()); if (ObjectUtil.isEmpty(thirdPayOrder)) { log.error("|{}|小程序退款错误,订单不存在dto:|{}|", TAG, JSONUtil.toJsonStr(dto)); - throw new RuntimeException("订单不存在"); + throw new I18nBizException(ErrorCodes.COMMON_ORDER_NOT_FOUND); } try { // 微信小程序 @@ -1054,7 +1056,7 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { } // 不支持的支付类型 else { - throw new RuntimeException("不支持的支付类型"); + throw new I18nBizException(ErrorCodes.COMMON_UNSUPPORTED_PAY_TYPE); } } finally { pollingCoordinator.wakePaymentCompensationPolling(); @@ -1071,7 +1073,7 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { ThirdPayOrderEntity thirdPayOrder = thirdPayOrderService.getByBiz(dto.getBizType(), String.valueOf(dto.getOrderId())); if (ObjectUtil.isEmpty(thirdPayOrder)) { log.error("|{}|远程退款,订单不存在dto:|{}|", TAG, JSONUtil.toJsonStr(dto)); - throw new RuntimeException("订单不存在"); + throw new I18nBizException(ErrorCodes.COMMON_ORDER_NOT_FOUND); } String expectedRefundNo = dto.getAfterSaleId() == null ? "refund_" + thirdPayOrder.getPayNo() @@ -1081,7 +1083,7 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { if (ObjectUtil.equals(thirdPayOrder.getRefundNo(), expectedRefundNo)) { return thirdPayOrder.getRefundNo(); } - throw new RuntimeException("上一笔退款仍在处理中,请稍后重试"); + throw new I18nBizException(ErrorCodes.THIRD_REFUND_PROCESSING); } // 同一售后单的远程重试直接返回原退款号,避免渠道重复受理同一笔金额。 if (ObjectUtil.equals(thirdPayOrder.getStatus(), ThirdPayOrderStatusEnum.REFUND_SUCCESS.getType()) @@ -1113,7 +1115,7 @@ public class ThirdAppPlusServiceImpl implements ThirdAppPlusService { } // 不支持的支付类型 else { - throw new RuntimeException("不支持的支付类型"); + throw new I18nBizException(ErrorCodes.COMMON_UNSUPPORTED_PAY_TYPE); } return null; } finally { diff --git a/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAppPlusWechatNativePayServiceImpl.java b/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAppPlusWechatNativePayServiceImpl.java index 53a3f294..55d35585 100644 --- a/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAppPlusWechatNativePayServiceImpl.java +++ b/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAppPlusWechatNativePayServiceImpl.java @@ -1,6 +1,8 @@ package com.bsd.pjcloud.thirdparty.service.impl.appplus; import cn.hutool.core.util.StrUtil; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.exception.I18nBizException; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.bsd.pjcloud.thirdparty.config.AppPlusPayConfig; @@ -110,7 +112,7 @@ public class ThirdAppPlusWechatNativePayServiceImpl implements ThirdAppPlusWecha boolean enableFz = dto.getFzRelationId() != null; if (enableFz) { if (mchFzRelationService == null) { - throw new RuntimeException("微信平台分佣关系服务不可用"); + throw new I18nBizException(ErrorCodes.THIRD_FZ_RELATION_UNAVAILABLE); } mchFzRelationService.requirePaymentRelation(dto.getFzRelationId(), setting); } @@ -125,16 +127,16 @@ public class ThirdAppPlusWechatNativePayServiceImpl implements ThirdAppPlusWecha String errorCode = StrUtil.blankToDefault(exception.getErrorCode(), "UNKNOWN"); saveFailedOrder(payOrder, errorCode, exception.getClass().getSimpleName()); log.error("|{}|创建微信订单码失败,payNo:{},errorCode:{}", TAG, dto.getOutTradeNo(), errorCode); - throw new RuntimeException("创建微信订单码失败,微信错误码:" + errorCode); + throw new I18nBizException(ErrorCodes.THIRD_WX_NATIVE_CREATE_FAIL_CODE, errorCode); } catch (Exception exception) { saveFailedOrder(payOrder, "SDK_EXCEPTION", exception.getClass().getSimpleName()); log.error("|{}|创建微信订单码异常,payNo:{},exceptionType:{}", TAG, dto.getOutTradeNo(), exception.getClass().getSimpleName()); - throw new RuntimeException("创建微信订单码失败,请稍后重试"); + throw new I18nBizException(ErrorCodes.THIRD_WX_NATIVE_CREATE_FAIL); } if (response == null || StrUtil.isBlank(response.getCodeUrl())) { saveFailedOrder(payOrder, response == null ? "EMPTY_RESPONSE" : "EMPTY_CODE_URL", null); - throw new RuntimeException("创建微信订单码失败,微信未返回二维码"); + throw new I18nBizException(ErrorCodes.THIRD_WX_NATIVE_NO_QR); } JSONObject responseSnapshot = JSONUtil.createObj().set("qrCode", response.getCodeUrl()); @@ -251,11 +253,11 @@ public class ThirdAppPlusWechatNativePayServiceImpl implements ThirdAppPlusWecha */ private MchPaySettingEntity.WechatPaySetting parseWechatPaySetting(MchPaySettingVo setting) { if (setting == null || StrUtil.isBlank(setting.getSettingJson())) { - throw new RuntimeException("商户微信支付配置不完整"); + throw new I18nBizException(ErrorCodes.THIRD_MCH_WECHAT_CONFIG_INCOMPLETE); } MchPaySettingEntity.WechatPaySetting wechatPaySetting = JSONUtil.toBean(setting.getSettingJson(), MchPaySettingEntity.WechatPaySetting.class); if (wechatPaySetting == null || StrUtil.isBlank(wechatPaySetting.getSubMchid())) { - throw new RuntimeException("商户微信子商户号未配置"); + throw new I18nBizException(ErrorCodes.THIRD_MCH_WECHAT_SUB_MCH_MISSING); } return wechatPaySetting; } @@ -268,11 +270,11 @@ public class ThirdAppPlusWechatNativePayServiceImpl implements ThirdAppPlusWecha */ private MchPaySettingEntity.WechatPaySetting parseWechatPaySettingSnapshot(String settingJson) { if (StrUtil.isBlank(settingJson)) { - throw new RuntimeException("支付订单缺少商户配置快照"); + throw new I18nBizException(ErrorCodes.THIRD_PAY_ORDER_SNAPSHOT_MISSING); } MchPaySettingEntity settingSnapshot = JSONUtil.toBean(settingJson, MchPaySettingEntity.class); if (settingSnapshot == null) { - throw new RuntimeException("支付订单商户配置快照无效"); + throw new I18nBizException(ErrorCodes.THIRD_PAY_ORDER_SNAPSHOT_INVALID); } MchPaySettingVo setting = new MchPaySettingVo(); setting.setSettingJson(settingSnapshot.getSettingJson()); diff --git a/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAppPlusWechatServiceImpl.java b/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAppPlusWechatServiceImpl.java index d24d7681..a1ef1548 100644 --- a/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAppPlusWechatServiceImpl.java +++ b/pjcloud-thirdparty/pjcloud-thirdparty-biz/src/main/java/com/bsd/pjcloud/thirdparty/service/impl/appplus/ThirdAppPlusWechatServiceImpl.java @@ -12,6 +12,8 @@ import cn.hutool.core.util.XmlUtil; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.exception.I18nBizException; import com.bsd.pjcloud.thirdparty.config.AppPlusPayConfig; import com.bsd.pjcloud.thirdparty.constant.miniplatform.AppPlusPlatformTypeEnum; import com.bsd.pjcloud.thirdparty.constant.pay.ThirdPayOrderBizTypeEnum; @@ -190,22 +192,22 @@ public class ThirdAppPlusWechatServiceImpl implements ThirdAppPlusWechatService private MchPaySettingEntity.WechatPaySetting validateWechatAppPaySetting(ThirdAppPlusPayDto dto, MchPaySettingVo setting) { if (dto == null || dto.getAmount() == null || dto.getAmount() <= 0) { - throw new RuntimeException("微信支付金额必须大于0"); + throw new I18nBizException(ErrorCodes.THIRD_PAY_AMOUNT_GT_ZERO); } if (setting == null || StrUtil.isBlank(setting.getSettingJson())) { - throw new RuntimeException("商户微信支付配置不完整"); + throw new I18nBizException(ErrorCodes.THIRD_MCH_WECHAT_CONFIG_INCOMPLETE); } MchPaySettingEntity.WechatPaySetting wechatPaySetting = JSONUtil.toBean( setting.getSettingJson(), MchPaySettingEntity.WechatPaySetting.class); if (wechatPaySetting == null || StrUtil.isBlank(wechatPaySetting.getSubMchid())) { - throw new RuntimeException("微信支付子商户号未配置"); + throw new I18nBizException(ErrorCodes.THIRD_MCH_WECHAT_SUB_MCH_MISSING); } if (dto.getFzRelationId() == null) { return wechatPaySetting; } ThirdMchFzRelationEntity relation = mchFzRelationService.requirePaymentRelation(dto.getFzRelationId(), setting); if (dto.getAmount() <= 10) { - throw new RuntimeException("微信分账支付金额必须大于10分"); + throw new I18nBizException(ErrorCodes.THIRD_WX_PROFIT_AMOUNT_MIN); } long fzAmount = BigDecimal.valueOf(dto.getAmount()) .multiply(BigDecimal.valueOf(relation.getFzRatio())) @@ -213,7 +215,7 @@ public class ThirdAppPlusWechatServiceImpl implements ThirdAppPlusWechatService // 微信分账单笔金额至少1分,低比例向下取整为0时按1分提交。 fzAmount = Math.max(1L, fzAmount); if (fzAmount > dto.getAmount()) { - throw new RuntimeException("微信平台抽佣金额必须不少于1分且不能超过订单金额"); + throw new I18nBizException(ErrorCodes.THIRD_WX_PROFIT_AMOUNT_RANGE); } return wechatPaySetting; } @@ -325,13 +327,13 @@ public class ThirdAppPlusWechatServiceImpl implements ThirdAppPlusWechatService AppPlusPayConfig.WechatConfig wechatConfig = appPlusPayConfig.getWechatConfig(); if (ObjectUtil.isEmpty(thirdPayOrder.getMchPaySettingJson())) { - throw new RuntimeException("支付配置不存在"); + throw new I18nBizException(ErrorCodes.THIRD_PAY_CONFIG_MISSING); } MchPaySettingEntity wechatPaySettingEntity = JSONUtil.toBean(thirdPayOrder.getMchPaySettingJson(), MchPaySettingEntity.class); MchPaySettingEntity.WechatPaySetting wechatPaySetting = JSONUtil.toBean(wechatPaySettingEntity.getSettingJson(), MchPaySettingEntity.WechatPaySetting.class); if (wechatPaySetting == null || StrUtil.isBlank(wechatPaySetting.getSubMchid())) { - throw new RuntimeException("微信支付配置快照无效"); + throw new I18nBizException(ErrorCodes.THIRD_PAY_ORDER_SNAPSHOT_INVALID); } ThirdPayOrderEntity updateObj = new ThirdPayOrderEntity(); @@ -349,7 +351,7 @@ public class ThirdAppPlusWechatServiceImpl implements ThirdAppPlusWechatService } if (refundFee == null || refundFee <= 0 || thirdPayOrder.getPrice() == null || refundFee > thirdPayOrder.getPrice()) { - throw new RuntimeException("微信退款金额必须大于0且不能超过订单金额"); + throw new I18nBizException(ErrorCodes.THIRD_WX_REFUND_AMOUNT_BAD); } String refundNo = dto.getAfterSaleId() == null ? "refund_" + thirdPayOrder.getPayNo() : "refund_" + dto.getAfterSaleId(); @@ -383,7 +385,7 @@ public class ThirdAppPlusWechatServiceImpl implements ThirdAppPlusWechatService || ObjectUtil.equals(latest.getStatus(), ThirdPayOrderStatusEnum.REFUND_SUCCESS.getType()))) { return latest; } - throw new RuntimeException("支付订单当前状态不允许退款"); + throw new I18nBizException(ErrorCodes.THIRD_PAY_ORDER_STATUS_NO_REFUND); } // 先持久化普通退款请求,再使用稳定分账退款号发起退分账;两条链路均可由数据库轮询恢复。 @@ -393,12 +395,12 @@ public class ThirdAppPlusWechatServiceImpl implements ThirdAppPlusWechatService try { Refund refund = refundService.create(createRequest); if (ObjectUtil.isEmpty(refund)) { - throw new RuntimeException("微信退款申请错误异常"); + throw new I18nBizException(ErrorCodes.THIRD_WX_REFUND_APPLY_ERROR); } saveWechatRefundResponse(thirdPayOrder.getId(), refundNo, refund); } catch (Exception e) { log.error("|{}|AP申请退款,异常", TAG, e); - throw new RuntimeException("微信退款请求已进入补偿队列,请稍后查询结果"); + throw new I18nBizException(ErrorCodes.THIRD_WX_REFUND_QUEUED); } finally { // 退款订单已先原子推进到 REFUNDING,渠道异常也必须留下稳定退款号对应的查单任务。 if (paymentTaskEnqueuer != null) { diff --git a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/controller/RegisterController.java b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/controller/RegisterController.java index 61f85970..53e26488 100644 --- a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/controller/RegisterController.java +++ b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/controller/RegisterController.java @@ -3,6 +3,8 @@ import com.bsd.pjcloud.common.api.encrypt.annotation.crypto.ApiCryptoAes; import com.bsd.pjcloud.admin.api.dto.UserDTO; import com.bsd.pjcloud.admin.service.SysUserService; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.util.MsgUtils; import com.bsd.pjcloud.common.core.util.R; import com.bsd.pjcloud.common.log.annotation.SysLog; import com.bsd.pjcloud.common.security.annotation.Inner; @@ -46,7 +48,7 @@ public class RegisterController { @SysLog("注册用户") @PostMapping("/default-user") public R registerDefaultUser(@RequestBody UserDTO userDto) { - return R.failed("暂时停止注册!"); + return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_REGISTER_SUSPENDED)); // return R.ok(userService.registerDefaultUser(userDto)); } diff --git a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/controller/address/SysUserAddressController.java b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/controller/address/SysUserAddressController.java index 13197df7..61c3d69f 100644 --- a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/controller/address/SysUserAddressController.java +++ b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/controller/address/SysUserAddressController.java @@ -13,6 +13,8 @@ import com.bsd.pjcloud.admin.service.SysDeptBuildingService; import com.bsd.pjcloud.admin.service.SysDeptBuildingUnitService; import com.bsd.pjcloud.admin.service.SysDeptService; import com.bsd.pjcloud.admin.service.SysUserAddressService; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.util.MsgUtils; import com.bsd.pjcloud.common.core.util.R; import com.bsd.pjcloud.common.log.annotation.SysLog; import com.bsd.pjcloud.common.security.annotation.Inner; @@ -78,10 +80,10 @@ public class SysUserAddressController { Long deptId = SecurityUtils.getUser().getDeptId(); SysDeptBuildingEntity building = sysDeptBuildingService.getById(buildingId); if (building == null) { - return R.failed("楼栋不存在"); + return R.failed(MsgUtils.getMessage(ErrorCodes.ADDRESS_BUILDING_NOT_FOUND)); } if (!Objects.equals(building.getDeptId(), deptId)) { - return R.failed("无权访问该楼栋"); + return R.failed(MsgUtils.getMessage(ErrorCodes.ADDRESS_BUILDING_NO_ACCESS)); } List list = sysDeptBuildingUnitService.listByBuildingId(buildingId); List options = list == null ? List.of() : list.stream() @@ -98,14 +100,14 @@ public class SysUserAddressController { Long deptId = SecurityUtils.getUser().getDeptId(); SysDeptBuildingUnitEntity unit = sysDeptBuildingUnitService.getById(unitId); if (unit == null) { - return R.failed("单元不存在"); + return R.failed(MsgUtils.getMessage(ErrorCodes.ADDRESS_UNIT_NOT_FOUND)); } SysDeptBuildingEntity building = sysDeptBuildingService.getById(unit.getBuildingId()); if (building == null) { - return R.failed("楼栋不存在"); + return R.failed(MsgUtils.getMessage(ErrorCodes.ADDRESS_BUILDING_NOT_FOUND)); } if (!Objects.equals(building.getDeptId(), deptId)) { - return R.failed("无权访问该单元"); + return R.failed(MsgUtils.getMessage(ErrorCodes.ADDRESS_UNIT_NO_ACCESS)); } List list = sysDeptBuildingRoomService.listByUnitId(unitId); List options = list == null ? List.of() : list.stream() diff --git a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/handler/AppleLoginHandler.java b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/handler/AppleLoginHandler.java index 2d7b913d..7aa67808 100644 --- a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/handler/AppleLoginHandler.java +++ b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/handler/AppleLoginHandler.java @@ -10,6 +10,8 @@ import com.bsd.pjcloud.admin.mapper.SysSocialDetailsMapper; import com.bsd.pjcloud.admin.service.SysUserService; import com.bsd.pjcloud.common.core.constant.enums.LoginTypeEnum; import com.bsd.pjcloud.common.core.exception.CheckedException; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.util.MsgUtils; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -32,7 +34,7 @@ public class AppleLoginHandler extends AbstractLoginHandler { condition.setType(LoginTypeEnum.APPLE.getType()); SysSocialDetails socialDetails = sysSocialDetailsMapper.selectOne(new QueryWrapper<>(condition)); if (socialDetails == null) { - throw new CheckedException("未配置Apple登录"); + throw new CheckedException(MsgUtils.getMessage(ErrorCodes.AUTH_APPLE_NOT_CONFIGURED)); } String sub = AppleIdentityTokenVerifier.verifyAndGetSubject(identityToken, socialDetails.getAppId()); log.debug("Apple identityToken 校验通过, sub={}", sub); diff --git a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/handler/MiniAppLoginHandler.java b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/handler/MiniAppLoginHandler.java index a9d261da..83d18ff8 100644 --- a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/handler/MiniAppLoginHandler.java +++ b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/handler/MiniAppLoginHandler.java @@ -30,6 +30,8 @@ import com.bsd.pjcloud.admin.service.SysUserService; import com.bsd.pjcloud.common.core.constant.SecurityConstants; import com.bsd.pjcloud.common.core.constant.enums.LoginTypeEnum; import com.bsd.pjcloud.common.core.exception.CheckedException; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.util.MsgUtils; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -71,7 +73,7 @@ public class MiniAppLoginHandler extends AbstractLoginHandler { if (resultJsonObj.containsKey("errcode")) { log.error("微信小程序登录失败:{}", result); - throw new CheckedException("微信小程序登录失败"); + throw new CheckedException(MsgUtils.getMessage(ErrorCodes.AUTH_MINI_APP_LOGIN_FAIL)); } Object obj = resultJsonObj.get("openid"); diff --git a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/handler/WeChatLoginHandler.java b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/handler/WeChatLoginHandler.java index 1022b007..6eb4ceea 100644 --- a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/handler/WeChatLoginHandler.java +++ b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/handler/WeChatLoginHandler.java @@ -30,6 +30,8 @@ import com.bsd.pjcloud.admin.service.SysUserService; import com.bsd.pjcloud.common.core.constant.SecurityConstants; import com.bsd.pjcloud.common.core.constant.enums.LoginTypeEnum; import com.bsd.pjcloud.common.core.exception.CheckedException; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.util.MsgUtils; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -69,13 +71,13 @@ public class WeChatLoginHandler extends AbstractLoginHandler { if (resultJsonObj.containsKey("errcode")) { log.error("微信授权失败:{}", result); String errMsg = resultJsonObj.getStr("errmsg", "微信授权失败"); - throw new CheckedException("微信授权失败:" + errMsg); + throw new CheckedException(MsgUtils.getMessage(ErrorCodes.AUTH_WX_AUTH_FAIL, errMsg)); } Object obj = resultJsonObj.get("openid"); if (obj == null) { log.error("微信响应缺少openid:{}", result); - throw new CheckedException("微信授权失败,未获取到用户标识"); + throw new CheckedException(MsgUtils.getMessage(ErrorCodes.AUTH_WX_OPENID_MISSING)); } return obj.toString(); } diff --git a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/handler/WxTicketLoginHandler.java b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/handler/WxTicketLoginHandler.java index 1d41b581..89f766b9 100644 --- a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/handler/WxTicketLoginHandler.java +++ b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/handler/WxTicketLoginHandler.java @@ -7,6 +7,8 @@ import com.bsd.pjcloud.admin.api.entity.SysUser; import com.bsd.pjcloud.admin.service.SysUserService; import com.bsd.pjcloud.common.core.constant.CacheConstants; import com.bsd.pjcloud.common.core.exception.CheckedException; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.util.MsgUtils; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.data.redis.core.StringRedisTemplate; @@ -39,7 +41,7 @@ public class WxTicketLoginHandler implements LoginHandler { public String identify(String ticket) { String openid = redisTemplate.opsForValue().get(ticketKey(ticket)); if (StrUtil.isBlank(openid)) { - throw new CheckedException("微信授权已过期,请重新授权"); + throw new CheckedException(MsgUtils.getMessage(ErrorCodes.AUTH_WX_AUTH_EXPIRED)); } redisTemplate.delete(ticketKey(ticket)); return openid; diff --git a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/service/impl/SysMessageServiceImpl.java b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/service/impl/SysMessageServiceImpl.java index d94cbf33..d5b50078 100644 --- a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/service/impl/SysMessageServiceImpl.java +++ b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/service/impl/SysMessageServiceImpl.java @@ -292,7 +292,7 @@ public class SysMessageServiceImpl extends ServiceImpl createGuardianWardFaces(SysUserFaceGuardianWardCreateDto dto) { PjcloudUser loginUser = SecurityUtils.getUser(); if (new HashSet<>(dto.getFaceImgs()).size() != dto.getFaceImgs().size()) { - throw new RuntimeException("请勿重复提交同一张人脸图片"); + throw new I18nBizException(ErrorCodes.SYS_FACE_DUP_IMAGE); } SysUser applyUser = sysUserService.getById(loginUser.getId()); if (applyUser == null) { - throw new RuntimeException("当前用户不存在"); + throw new I18nBizException(ErrorCodes.SYS_USER_NOT_FOUND); } if (sysUserService.getById(dto.getWardUserId()) == null) { - throw new RuntimeException("目标用户不存在"); + throw new I18nBizException(ErrorCodes.SYS_USER_NOT_FOUND); } validateSelfOrGuardianWardUser(loginUser.getId(), dto.getWardUserId()); boolean needFaceApproval = needFaceApproval(loginUser.getId()); if (needFaceApproval && sysDeptService.getById(applyUser.getDeptId()) == null) { - throw new RuntimeException("当前用户所属部门不存在,无法发起人脸审核"); + throw new I18nBizException(ErrorCodes.SYS_FACE_DEPT_MISSING); } validateAppRelationFaceLimit(dto.getWardUserId(), dto.getFaceImgs().size()); @@ -406,7 +408,7 @@ public class SysUserFaceServiceImpl extends ServiceImpl() .eq(SysUserFaceEntity::getId, detail.getId()) @@ -435,7 +437,7 @@ public class SysUserFaceServiceImpl extends ServiceImpl 3) { - throw new RuntimeException("审核中和已通过的人脸合计最多只能保留3张"); + throw new I18nBizException(ErrorCodes.SYS_FACE_MAX_ACTIVE); } } @@ -601,7 +603,7 @@ public class SysUserFaceServiceImpl extends ServiceImpl impl public Boolean applyCloseAccount(Long userId) { SysUser sysUser = baseMapper.selectById(userId); if (ObjectUtil.isEmpty(sysUser)) { - throw new RuntimeException("用户不存在"); + throw new I18nBizException(ErrorCodes.COMMON_USER_NOT_EXIST); } if (ObjectUtil.equals(sysUser.getCloseAccountFlag(), YesNoEnum.YES.getCode())) { - throw new RuntimeException("您已注销"); + throw new I18nBizException(ErrorCodes.SYS_USER_CANCELLED); } SysUser updateObj = new SysUser(); updateObj.setUserId(userId); @@ -938,7 +939,7 @@ public class SysUserServiceImpl extends ServiceImpl impl public R changePassword(UserDTO userDto) { SysUser user = baseMapper.selectById(SecurityUtils.getUser().getId()); if (StrUtil.isEmpty(userDto.getPassword())) { - return R.failed("原密码不能为空"); + return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_PASSWORD_OLD_EMPTY)); } if (!ENCODER.matches(userDto.getPassword(), user.getPassword())) { @@ -947,7 +948,7 @@ public class SysUserServiceImpl extends ServiceImpl impl } if (StrUtil.isEmpty(userDto.getNewpassword1())) { - return R.failed("新密码不能为空"); + return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_PASSWORD_NEW_EMPTY)); } String weakPasswordMsg = validatePasswordStrength(userDto.getNewpassword1()); if (StrUtil.isNotBlank(weakPasswordMsg)) { @@ -981,7 +982,7 @@ public class SysUserServiceImpl extends ServiceImpl impl wrapper = Wrappers.lambdaUpdate().set(SysUser::getWxDingUserid, null).eq(SysUser::getUserId, user.getId()); } if (wrapper == null) { - return R.failed("解绑账号类型不存在"); + return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_UNBIND_TYPE_INVALID)); } this.update(wrapper); return R.ok(); @@ -995,7 +996,7 @@ public class SysUserServiceImpl extends ServiceImpl impl if (!ENCODER.matches(password, sysUser.getPassword())) { log.info("原密码错误"); - return R.failed("密码输入错误"); + return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_UPDATE_PASSWORDERROR)); } else { return R.ok(); } @@ -1018,7 +1019,7 @@ public class SysUserServiceImpl extends ServiceImpl impl // 新密码校验 if (StrUtil.equals(userDto.getPassword(), userDto.getNewpassword1())) { - return R.failed("新旧密码不能相同"); + return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_PASSWORD_SAME)); } String weakPasswordMsg = validatePasswordStrength(userDto.getNewpassword1()); if (StrUtil.isNotBlank(weakPasswordMsg)) { @@ -1041,7 +1042,7 @@ public class SysUserServiceImpl extends ServiceImpl impl String cacheKey = CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.SMS.getType() + StringPool.AT + forgotPasswordDTO.getMobile(); String cacheCode = redisTemplate.opsForValue().get(cacheKey); if (StrUtil.isBlank(cacheCode) || !StrUtil.equals(cacheCode, forgotPasswordDTO.getSmsCode())) { - return R.failed("短信验证码错误或已过期"); + return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_APP_SMS_CODE_INVALID)); } String weakPasswordMsg = validatePasswordStrength(forgotPasswordDTO.getNewPassword()); if (StrUtil.isNotBlank(weakPasswordMsg)) { @@ -1065,7 +1066,7 @@ public class SysUserServiceImpl extends ServiceImpl impl private String validatePasswordStrength(String password) { if (StrUtil.length(password) < 8 || StrUtil.length(password) > 20) { - return "密码长度需为8-20位"; + return MsgUtils.getMessage(ErrorCodes.SYS_USER_PASSWORD_LENGTH); } boolean hasLetter = false; boolean hasDigit = false; @@ -1075,11 +1076,11 @@ public class SysUserServiceImpl extends ServiceImpl impl } else if (Character.isDigit(c)) { hasDigit = true; } else { - return "密码只能包含字母和数字"; + return MsgUtils.getMessage(ErrorCodes.SYS_USER_PASSWORD_CHARS_ONLY); } } if (!(hasLetter && hasDigit)) { - return "密码需同时包含字母和数字"; + return MsgUtils.getMessage(ErrorCodes.SYS_USER_PASSWORD_LETTER_DIGIT); } return null; } diff --git a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/service/impl/address/SysUserAddressServiceImpl.java b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/service/impl/address/SysUserAddressServiceImpl.java index fe92e45d..3ea632ce 100644 --- a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/service/impl/address/SysUserAddressServiceImpl.java +++ b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/service/impl/address/SysUserAddressServiceImpl.java @@ -17,6 +17,8 @@ import com.bsd.pjcloud.admin.service.SysDeptBuildingUnitService; import com.bsd.pjcloud.admin.service.SysDeptService; import com.bsd.pjcloud.admin.service.SysUserAddressService; import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.exception.I18nBizException; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -90,11 +92,11 @@ public class SysUserAddressServiceImpl extends ServiceImpl appApplyFreeze(@RequestBody WalletFreezeDto dto) { if (ObjectUtil.isEmpty(dto.getWalletTypeId())) { - throw new RuntimeException("钱包类型id不能为空"); + throw new I18nBizException(ErrorCodes.WALLET_TYPE_ID_EMPTY); } if (ObjectUtil.isEmpty(dto.getRemark())) { - throw new RuntimeException("备注不能为空"); + throw new I18nBizException(ErrorCodes.WALLET_REMARK_EMPTY); } PjcloudUser user = SecurityUtils.getUser(); dto.setUserId(user.getId()); diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/act/ActCancelItemController.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/act/ActCancelItemController.java index b9039eae..59adaefb 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/act/ActCancelItemController.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/act/ActCancelItemController.java @@ -4,6 +4,8 @@ import com.bsd.pjcloud.common.api.encrypt.annotation.crypto.ApiCryptoAes; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.exception.I18nBizException; import com.bsd.pjcloud.common.core.util.R; import com.bsd.pjcloud.common.idempotent.annotation.Idempotent; import com.bsd.pjcloud.common.log.annotation.SysLog; @@ -58,8 +60,8 @@ public class ActCancelItemController { @PostMapping("/app/get") @Idempotent(expireTime = 2, key = "'/act/cancel/app/get/' + #dto.getReceiverUserId()", info = "正在领取中,请勿重复操作") public R appGet(@RequestBody ActCancelItemDto dto) { - if (ObjectUtil.isEmpty(dto.getActId())) throw new RuntimeException("活动id不能为空"); - if (ObjectUtil.isEmpty(dto.getMchId())) throw new RuntimeException("商户id不能为空"); + if (ObjectUtil.isEmpty(dto.getActId())) throw new I18nBizException(ErrorCodes.ACT_ID_EMPTY); + if (ObjectUtil.isEmpty(dto.getMchId())) throw new I18nBizException(ErrorCodes.COMMON_MCH_ID_EMPTY); PjcloudUser user = SecurityUtils.getUser(); return R.ok(actCancelItemService.appGet(user, dto)); } diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/mch/MchManageController.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/mch/MchManageController.java index 13043fec..943b812c 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/mch/MchManageController.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/mch/MchManageController.java @@ -14,6 +14,8 @@ import com.bsd.pjcloud.admin.api.feign.RemoteUserService; import com.bsd.pjcloud.common.api.encrypt.annotation.encrypt.ApiEncryptAes; import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum; import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.util.MsgUtils; import com.bsd.pjcloud.common.core.util.R; import com.bsd.pjcloud.common.data.datascope.DataScope; import com.bsd.pjcloud.common.log.annotation.SysLog; @@ -74,7 +76,7 @@ public class MchManageController { @GetMapping("/get-by-types") public R> getByTypes(@RequestParam List types) { List list = mchManageService.list(MchManageDto.builder().typesList(types).build()); - if (ObjectUtil.isEmpty(list)) return R.failed("商户不存在"); + if (ObjectUtil.isEmpty(list)) return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_MCH_NOT_FOUND)); return R.ok(list); } @@ -82,7 +84,7 @@ public class MchManageController { @GetMapping("/get-by-id") public R getById(@RequestParam Long id) { MchManageVo mchManageVo = mchManageService.join(id); - if (ObjectUtil.isEmpty(mchManageVo)) return R.failed("商户不存在"); + if (ObjectUtil.isEmpty(mchManageVo)) return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_MCH_NOT_FOUND)); return R.ok(mchManageVo); } @@ -100,7 +102,7 @@ public class MchManageController { @GetMapping("/get-by-ids") public R> getByIds(@RequestParam List ids) { List list = mchManageService.list(MchManageDto.builder().ids(ids).build()); - if (ObjectUtil.isEmpty(list)) return R.failed("商户不存在"); + if (ObjectUtil.isEmpty(list)) return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_MCH_NOT_FOUND)); return R.ok(list); } @@ -108,7 +110,7 @@ public class MchManageController { @GetMapping("/get-by-dept-id") public R getByDeptId(@RequestParam("deptId") Long deptId, MerchantTypeEnum type) { MchManageVo mchManage = mchManageService.getByDeptId(deptId, type); - if (ObjectUtil.isEmpty(mchManage)) return R.failed("商户不存在"); + if (ObjectUtil.isEmpty(mchManage)) return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_MCH_NOT_FOUND)); return R.ok(mchManage); } @@ -116,7 +118,7 @@ public class MchManageController { @GetMapping("/get-by-dept-ids") public R> getByDeptIds(@RequestParam List deptIds) { List list = mchManageService.list(MchManageDto.builder().deptIds(deptIds).build()); - if (ObjectUtil.isEmpty(list)) return R.failed("商户不存在"); + if (ObjectUtil.isEmpty(list)) return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_MCH_NOT_FOUND)); return R.ok(list); } @@ -124,7 +126,7 @@ public class MchManageController { @GetMapping("/get-first-mch") public R getFirstMch(@RequestParam List deptIds, @RequestParam MerchantTypeEnum mchType) { MchManageVo mchManage = mchManageService.getFirstMch(deptIds, List.of(mchType)); - if (ObjectUtil.isEmpty(mchManage)) return R.failed("商户不存在"); + if (ObjectUtil.isEmpty(mchManage)) return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_MCH_NOT_FOUND)); return R.ok(mchManage); } @@ -132,7 +134,7 @@ public class MchManageController { @GetMapping("/get-first-mch-by-dept-id") public R getFirstMchByDeptId(@RequestParam Long deptId, @RequestParam MerchantTypeEnum mchType) { MchManageVo mchManage = mchManageService.getFirstMchByDeptId(deptId, List.of(mchType)); - if (ObjectUtil.isEmpty(mchManage)) return R.failed("商户不存在"); + if (ObjectUtil.isEmpty(mchManage)) return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_MCH_NOT_FOUND)); return R.ok(mchManage); } @@ -140,7 +142,7 @@ public class MchManageController { @GetMapping("/get-views-canteen-mch-by-dept-id") public R getViewsCanteenMchByDeptId(@RequestParam Long deptId) { MchManageVo mchManage = mchManageService.getViewsCanteenMchByDeptId(deptId); - if (ObjectUtil.isEmpty(mchManage)) return R.failed("商户不存在"); + if (ObjectUtil.isEmpty(mchManage)) return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_MCH_NOT_FOUND)); return R.ok(mchManage); } @@ -148,7 +150,7 @@ public class MchManageController { @GetMapping("/get-views-mch-by-dept-id") public R getViewsMchByDeptId(@RequestParam Long deptId, @RequestParam List mchTypeList) { MchManageVo mchManage = mchManageService.getViewsCanteenMch(deptId, mchTypeList); - if (ObjectUtil.isEmpty(mchManage)) return R.failed("商户不存在"); + if (ObjectUtil.isEmpty(mchManage)) return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_MCH_NOT_FOUND)); return R.ok(mchManage); } @@ -156,7 +158,7 @@ public class MchManageController { @GetMapping("/get-self-canteen-user-dept-id-list") public R> getSelfCanteenUserDeptIdList(@RequestParam Long mchId) { List userDeptIdList = mchManageService.getSelfCanteenUserDeptIdList(mchId); - if (ObjectUtil.isEmpty(userDeptIdList)) return R.failed("商户不存在"); + if (ObjectUtil.isEmpty(userDeptIdList)) return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_MCH_NOT_FOUND)); return R.ok(userDeptIdList); } @@ -172,7 +174,7 @@ public class MchManageController { public R> getSelfMchUserDeptIdListByUserId(@RequestParam Long userId, @RequestParam List mchTypeList) { List userDeptIdList = mchManageService.getSelfMchUserDeptIdListByUserId(userId, mchTypeList); - if (ObjectUtil.isEmpty(userDeptIdList)) return R.failed("商户不存在"); + if (ObjectUtil.isEmpty(userDeptIdList)) return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_MCH_NOT_FOUND)); return R.ok(userDeptIdList); } @@ -180,7 +182,7 @@ public class MchManageController { @GetMapping("/get-self-mch-id-list") public R> getSelfMchIdList(@RequestParam Long userId, @RequestParam List mchTypeList) { List userDeptIdList = mchManageService.getSelfMchIdList(userId, mchTypeList); - if (ObjectUtil.isEmpty(userDeptIdList)) return R.failed("商户不存在"); + if (ObjectUtil.isEmpty(userDeptIdList)) return R.failed(MsgUtils.getMessage(ErrorCodes.COMMON_MCH_NOT_FOUND)); return R.ok(userDeptIdList); } diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletActiveServiceImpl.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletActiveServiceImpl.java index 1a27bdda..843efb0d 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletActiveServiceImpl.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletActiveServiceImpl.java @@ -1,5 +1,8 @@ package com.bsd.pjcloud.wallet.service.impl; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.exception.I18nBizException; + import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.RandomUtil; import cn.hutool.extra.spring.SpringUtil; @@ -132,18 +135,18 @@ public class WalletActiveServiceImpl extends ServiceImpl walletActiveUpdateWrapper = new LambdaUpdateWrapper() diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletForeignServiceImpl.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletForeignServiceImpl.java index 3c18ead0..47a00772 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletForeignServiceImpl.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletForeignServiceImpl.java @@ -13,6 +13,8 @@ import com.bsd.pjcloud.admin.api.entity.SysUser; import com.bsd.pjcloud.admin.api.feign.RemoteDeptService; import com.bsd.pjcloud.admin.api.feign.RemoteUserService; import com.bsd.pjcloud.admin.api.utils.DataUtil; +import com.bsd.pjcloud.common.core.exception.ErrorCodes; +import com.bsd.pjcloud.common.core.exception.I18nBizException; import com.bsd.pjcloud.common.core.util.CollectionUtils; import com.bsd.pjcloud.common.core.util.R; import com.bsd.pjcloud.common.security.util.SecurityUtils; @@ -75,7 +77,7 @@ public class WalletForeignServiceImpl extends ServiceImpl payments = validatePaymentBatch(dtoList); acquirePaymentOperationLocks(payments, new ArrayList<>()); if (payments.stream().anyMatch(this::isPaymentCancelled)) { - throw new RuntimeException("订单支付已经取消,不能继续扣款"); + throw new I18nBizException(ErrorCodes.WALLET_ORDER_PAYMENT_CANCELLED); } Map lockedWalletMap = lockBatchWallets(payments); Map pendingPriceMap = new LinkedHashMap<>(); @@ -326,12 +329,12 @@ public class WalletTransactionServiceImpl extends ServiceImpl { WalletManageEntity wallet = lockedWalletMap.get(walletId); if (wallet.getBalance() == null || wallet.getBalance() < totalPrice) { - throw new RuntimeException("钱包余额不足"); + throw new I18nBizException(ErrorCodes.COMMON_WALLET_BALANCE_INSUFFICIENT); } }); pendingPriceMap.forEach((walletId, totalPrice) -> { if (walletManageMapper.updateWhenConsumption(walletId, totalPrice, false) != 1) { - throw new RuntimeException("钱包余额不足"); + throw new I18nBizException(ErrorCodes.COMMON_WALLET_BALANCE_INSUFFICIENT); } }); @@ -367,7 +370,7 @@ public class WalletTransactionServiceImpl extends ServiceImpl { if (walletManageMapper.updateWhenConsumptionRefund(walletId, totalPrice) != 1) { - throw new RuntimeException("钱包批量补偿失败"); + throw new I18nBizException(ErrorCodes.WALLET_TX_BATCH_COMPENSATE_FAIL); } }); @@ -460,7 +463,7 @@ public class WalletTransactionServiceImpl extends ServiceImpl validatePaymentBatch(List dtoList) { if (ObjectUtil.isEmpty(dtoList) || dtoList.stream().anyMatch(Objects::isNull)) { - throw new RuntimeException("钱包批量交易明细不能为空"); + throw new I18nBizException(ErrorCodes.WALLET_TX_BATCH_EMPTY); } Set businessKeys = new HashSet<>(); for (WalletBalanceTransactionDto dto : dtoList) { if (dto.getWalletId() == null || dto.getPrice() == null || dto.getPrice() <= 0 || dto.getBizId() == null || dto.getBizId().isBlank()) { - throw new RuntimeException("钱包批量交易明细不完整"); + throw new I18nBizException(ErrorCodes.WALLET_TX_BATCH_INCOMPLETE); } if (!Objects.equals(dto.getBizType(), WalletBizEnum.PAYMENT) || Boolean.TRUE.equals(dto.getForce())) { - throw new RuntimeException("钱包批量交易仅支持非透支支付"); + throw new I18nBizException(ErrorCodes.WALLET_TX_BATCH_NON_FORCE_ONLY); } if (!businessKeys.add(paymentBatchKey(dto))) { - throw new RuntimeException("请勿重复提交同一钱包业务号"); + throw new I18nBizException(ErrorCodes.WALLET_TX_BATCH_DUP_BIZ); } } return new ArrayList<>(dtoList); @@ -505,7 +508,7 @@ public class WalletTransactionServiceImpl extends ServiceImpl { WalletManageEntity wallet = walletManageMapper.selectByIdForUpdate(walletId); if (wallet == null) { - throw new RuntimeException("扣款失败,用户钱包不存在"); + throw new I18nBizException(ErrorCodes.COMMON_WALLET_NOT_FOUND); } walletMap.put(walletId, wallet); }); @@ -535,7 +538,7 @@ public class WalletTransactionServiceImpl extends ServiceImpl locks, List rollbackMarkerKeys) { if (!TransactionSynchronizationManager.isSynchronizationActive()) { - throw new RuntimeException("钱包批量交易事务状态异常,请稍后重试"); + throw new I18nBizException(ErrorCodes.WALLET_TX_TX_STATE_BAD); } List transactionLocks = List.copyOf(locks); TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() { @@ -690,12 +693,12 @@ public class WalletTransactionServiceImpl extends ServiceImpl() .eq(ActCancelItemEntity::getActId, actId) .eq(ActCancelItemEntity::getReceiverUserId, user.getId()) @@ -202,7 +205,7 @@ public class ActCancelItemServiceImpl extends ServiceImpl userMap = new LinkedHashMap<>(); userResult.getData().forEach(user -> userMap.put(user.getUserId(), user)); @@ -226,7 +230,7 @@ public class WalletRechargeServiceImpl extends ServiceImpl countMap = new LinkedHashMap<>(); result.getData().stream().filter(Objects::nonNull).filter(item -> item.getUserId() != null).forEach(item -> countMap.put(item.getUserId(), item)); @@ -529,7 +533,7 @@ public class WalletRechargeServiceImpl extends ServiceImpl countMap = new LinkedHashMap<>(); result.getData().stream().filter(Objects::nonNull).filter(item -> item.getUserId() != null).forEach(item -> countMap.put(item.getUserId(), item)); @@ -541,7 +545,7 @@ public class WalletRechargeServiceImpl extends ServiceImpl> result; try { @@ -551,7 +555,7 @@ public class WalletRechargeServiceImpl extends ServiceImpl> userResult; try { @@ -584,14 +588,14 @@ public class WalletRechargeServiceImpl extends ServiceImpl identityTypes) { + if (ObjectUtil.equals(wallet.getIsFreeze(), YesNoEnum.YES.getCode())) { + throw new I18nBizException(ErrorCodes.WALLET_MEAL_CARD_FROZEN); + } + boolean cardStatusSupportsRecharge = StrUtil.isBlank(wallet.getStatus()) + || ObjectUtil.equals(wallet.getStatus(), WalleCardStatusEnum.NONE_ACTIVE.getCode()) + || ObjectUtil.equals(wallet.getStatus(), WalleCardStatusEnum.ACTIVE.getCode()); + if (!cardStatusSupportsRecharge) { + throw new I18nBizException(ErrorCodes.WALLET_CARD_STATUS_NO_RECHARGE, cardStatusName(wallet.getStatus())); + } + MchManageVo merchant = mchManageService.getViewsCanteenMchByDeptId(wallet.getDeptId()); + if (merchant == null) { + throw new I18nBizException(ErrorCodes.WALLET_CARD_CANTEEN_MISSING); + } + if (!mchManageService.isTopUpIdentityAllowed(merchant, identityTypes)) { + throw new I18nBizException(ErrorCodes.WALLET_IDENTITY_NO_RECHARGE); + } + } + /** * 返回余额钱包的充值禁用原因。未绑定或未激活实体饭卡不影响余额充值,只有冻结、挂失、锁卡、 * 销卡、异常状态、商户异常或人员身份不匹配时才禁止充值,页面无需自行推断状态编码。 @@ -635,22 +658,22 @@ public class WalletRechargeServiceImpl extends ServiceImpl identityTypes) { if (ObjectUtil.equals(wallet.getIsFreeze(), YesNoEnum.YES.getCode())) { - return "饭卡已冻结"; + return MsgUtils.getMessage(ErrorCodes.WALLET_MEAL_CARD_FROZEN); } // 新建但尚未绑定实体卡的钱包可能没有写入绑定状态,空状态与“未激活”均表示可接收余额充值。 boolean cardStatusSupportsRecharge = StrUtil.isBlank(wallet.getStatus()) || ObjectUtil.equals(wallet.getStatus(), WalleCardStatusEnum.NONE_ACTIVE.getCode()) || ObjectUtil.equals(wallet.getStatus(), WalleCardStatusEnum.ACTIVE.getCode()); if (!cardStatusSupportsRecharge) { - return cardStatusName(wallet.getStatus()) + ",暂不可充值"; + return MsgUtils.getMessage(ErrorCodes.WALLET_CARD_STATUS_NO_RECHARGE, cardStatusName(wallet.getStatus())); } MchManageVo merchant = mchManageService.getViewsCanteenMchByDeptId(wallet.getDeptId()); if (merchant == null) { - return "饭卡所属食堂不存在"; + return MsgUtils.getMessage(ErrorCodes.WALLET_CARD_CANTEEN_MISSING); } // 商户未配置身份限制时保持历史行为;配置非空时要求目标用户至少命中一种身份。 if (!mchManageService.isTopUpIdentityAllowed(merchant, identityTypes)) { - return "当前人员身份不支持钱包充值"; + return MsgUtils.getMessage(ErrorCodes.WALLET_IDENTITY_NO_RECHARGE); } return ""; } @@ -708,7 +731,7 @@ public class WalletRechargeServiceImpl extends ServiceImpl resolvePaymentPlatformTypes(WalletManageEntity wallet) { MchManageVo merchant = mchManageService.getViewsCanteenMchByDeptId(wallet.getDeptId()); if (merchant == null) { - throw new RuntimeException("饭卡所属食堂不存在"); + throw new I18nBizException(ErrorCodes.WALLET_CARD_CANTEEN_MISSING); } List platformTypes = merchant.getPaySettingList() == null ? List.of() : merchant.getPaySettingList().stream() .map(item -> item.getPlatformType()) @@ -716,7 +739,7 @@ public class WalletRechargeServiceImpl extends ServiceImpl userConfig.getMaxTransferBalance()) { - throw new RuntimeException("已经超过最大转账金额限制"); + throw new I18nBizException(ErrorCodes.WALLET_TRANSFER_LIMIT_EXCEEDED); } entity.setBizType(WalletRuleTransationTypeEnum.USER_CHANGE.getCode()); entity.setSourceWalletId(userConfig.getSourceWalletId()); @@ -170,15 +172,15 @@ public class WalletRuleTransactionServiceImpl extends ServiceImpl