Browse Source

fixed 会员等级编辑功能优化

fushengqian 6 months ago
parent
commit
1e70a43a1c

+ 3 - 0
fuint-application/src/main/java/com/fuint/common/service/impl/UserGradeServiceImpl.java

@@ -96,6 +96,9 @@ public class UserGradeServiceImpl extends ServiceImpl<MtUserGradeMapper, MtUserG
     @Transactional(rollbackFor = Exception.class)
     @OperationServiceLog(description = "新增会员等级")
     public MtUserGrade addUserGrade(MtUserGrade mtUserGrade) throws BusinessCheckException {
+        if (mtUserGrade.getMerchantId() == null || mtUserGrade.getMerchantId() < 1) {
+            throw new BusinessCheckException("平台方帐号无法执行该操作,请使用商户帐号操作");
+        }
         if (mtUserGrade.getGrade() != null && (mtUserGrade.getGrade() <= 0)) {
             throw new BusinessCheckException("会员等级需大于0");
         }

+ 1 - 5
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendUserGradeController.java

@@ -203,10 +203,6 @@ public class BackendUserGradeController extends BaseController {
         String status = param.get("status") == null ? StatusEnum.ENABLED.getKey() : CommonUtil.replaceXSS(param.get("status").toString());
         String id = param.get("id") == null ? "" : param.get("id").toString();
 
-        if (accountInfo.getMerchantId() == null || accountInfo.getMerchantId() <= 0) {
-            return getFailureResult(201, "平台方帐号无法执行该操作,请使用商户帐号操作");
-        }
-
         if (StringUtil.isEmpty(grade) || StringUtil.isEmpty(name)) {
             return getFailureResult(201, "参数有误");
         }
@@ -228,7 +224,7 @@ public class BackendUserGradeController extends BaseController {
 
         mtUserGrade.setGrade(Integer.parseInt(grade));
         mtUserGrade.setName(name);
-        if (mtUserGrade.getMerchantId() == null) {
+        if (mtUserGrade.getMerchantId() == null && mtUserGrade.getMerchantId() > 0) {
             mtUserGrade.setMerchantId(accountInfo.getMerchantId());
         }
         if (StringUtil.isNotEmpty(catchType)) {