Browse Source

商户类型功能修改

fushengqian 1 year ago
parent
commit
418122ab57

+ 39 - 0
fuint-application/src/main/java/com/fuint/common/enums/MerchantTypeEnum.java

@@ -0,0 +1,39 @@
+package com.fuint.common.enums;
+
+/**
+ * 商户类型枚举
+ *
+ * Created by FSQ
+ * CopyRight https://www.fuint.cn
+ */
+public enum MerchantTypeEnum {
+    RESTAURANT("restaurant", "餐饮"),
+    RETAIL("retail", "零售"),
+    SERVICE("service", "服务"),
+    OTHER("other", "其他");
+
+    private String key;
+
+    private String value;
+
+    MerchantTypeEnum(String key, String value) {
+        this.key = key;
+        this.value = value;
+    }
+
+    public String getKey() {
+        return key;
+    }
+
+    public void setKey(String key) {
+        this.key = key;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+}

+ 2 - 1
fuint-application/src/main/java/com/fuint/common/service/UserGradeService.java

@@ -70,8 +70,9 @@ public interface UserGradeService extends IService<MtUserGrade> {
     /**
     /**
      * 获取付费会员等级列表
      * 获取付费会员等级列表
      *
      *
+     * @param  merchantId
      * @param  userInfo
      * @param  userInfo
      * @throws BusinessCheckException
      * @throws BusinessCheckException
      * */
      * */
-    List<MtUserGrade> getPayUserGradeList(MtUser userInfo) throws BusinessCheckException;
+    List<MtUserGrade> getPayUserGradeList(Integer merchantId, MtUser userInfo) throws BusinessCheckException;
 }
 }

+ 1 - 0
fuint-application/src/main/java/com/fuint/common/service/impl/AccountServiceImpl.java

@@ -162,6 +162,7 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
     @OperationServiceLog(description = "新增后台账户")
     @OperationServiceLog(description = "新增后台账户")
     public TAccount createAccountInfo(TAccount tAccount, List<TDuty> duties) {
     public TAccount createAccountInfo(TAccount tAccount, List<TDuty> duties) {
         TAccount account = new TAccount();
         TAccount account = new TAccount();
+        account.setAccountKey(tAccount.getAccountKey());
         account.setAccountName(tAccount.getAccountName().toLowerCase());
         account.setAccountName(tAccount.getAccountName().toLowerCase());
         account.setAccountStatus(1);
         account.setAccountStatus(1);
         account.setRealName(tAccount.getRealName());
         account.setRealName(tAccount.getRealName());

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

@@ -205,14 +205,15 @@ public class UserGradeServiceImpl extends ServiceImpl<MtUserGradeMapper, MtUserG
     /**
     /**
      * 获取付费会员等级列表
      * 获取付费会员等级列表
      *
      *
+     * @param merchantId
      * @param userInfo
      * @param userInfo
      * */
      * */
     @Override
     @Override
-    public List<MtUserGrade> getPayUserGradeList(MtUser userInfo) {
+    public List<MtUserGrade> getPayUserGradeList(Integer merchantId, MtUser userInfo) {
         Map<String, Object> param = new HashMap<>();
         Map<String, Object> param = new HashMap<>();
         param.put("status", StatusEnum.ENABLED.getKey());
         param.put("status", StatusEnum.ENABLED.getKey());
         param.put("catch_type", UserGradeCatchTypeEnum.PAY.getKey());
         param.put("catch_type", UserGradeCatchTypeEnum.PAY.getKey());
-        param.put("merchant_id", userInfo.getMerchantId());
+        param.put("merchant_id", merchantId);
         List<MtUserGrade> userGrades = mtUserGradeMapper.selectByMap(param);
         List<MtUserGrade> userGrades = mtUserGradeMapper.selectByMap(param);
         List<MtUserGrade> dataList = new ArrayList<>();
         List<MtUserGrade> dataList = new ArrayList<>();
         if (userGrades.size() > 0 && userInfo != null) {
         if (userGrades.size() > 0 && userInfo != null) {

+ 11 - 0
fuint-application/src/main/java/com/fuint/common/util/CommonUtil.java

@@ -78,6 +78,17 @@ public class CommonUtil {
         return sb.toString();
         return sb.toString();
     }
     }
 
 
+    /**
+     * 生成随机键值号
+     * */
+    public static String createAccountKey() {
+        StringBuilder sb = new StringBuilder("11");
+        sb.append(SeqUtil.getRandomNumber(6));
+        sb.append(SeqUtil.getRandomNumber(5));
+        String t = TimeUtils.formatDate(new Date(), "yyyyMMddHH");
+        return t + sb.toString();
+    }
+
     /**
     /**
      * 生成随机商户号
      * 生成随机商户号
      * */
      * */

+ 2 - 0
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendAccountController.java

@@ -9,6 +9,7 @@ import com.fuint.common.service.AccountService;
 import com.fuint.common.service.DutyService;
 import com.fuint.common.service.DutyService;
 import com.fuint.common.service.MerchantService;
 import com.fuint.common.service.MerchantService;
 import com.fuint.common.service.StoreService;
 import com.fuint.common.service.StoreService;
+import com.fuint.common.util.CommonUtil;
 import com.fuint.common.util.TokenUtil;
 import com.fuint.common.util.TokenUtil;
 import com.fuint.framework.exception.BusinessCheckException;
 import com.fuint.framework.exception.BusinessCheckException;
 import com.fuint.framework.pagination.PaginationRequest;
 import com.fuint.framework.pagination.PaginationRequest;
@@ -239,6 +240,7 @@ public class BackendAccountController extends BaseController {
         }
         }
 
 
         TAccount tAccount = new TAccount();
         TAccount tAccount = new TAccount();
+        tAccount.setAccountKey(CommonUtil.createAccountKey());
         tAccount.setRealName(realName);
         tAccount.setRealName(realName);
         tAccount.setAccountName(accountName);
         tAccount.setAccountName(accountName);
         tAccount.setAccountStatus(Integer.parseInt(accountStatus));
         tAccount.setAccountStatus(Integer.parseInt(accountStatus));

+ 6 - 2
fuint-application/src/main/java/com/fuint/module/clientApi/controller/ClientSystemController.java

@@ -77,7 +77,7 @@ public class ClientSystemController extends BaseController {
         String longitude = request.getHeader("longitude") == null ? "" : request.getHeader("longitude");
         String longitude = request.getHeader("longitude") == null ? "" : request.getHeader("longitude");
 
 
         UserInfo loginInfo = TokenUtil.getUserInfoByToken(token);
         UserInfo loginInfo = TokenUtil.getUserInfoByToken(token);
-        MtMerchant mtMerchant = merchantService.queryMerchantByNo(merchantNo);
+        Integer merchantId = merchantService.getMerchantId(merchantNo);
 
 
         // 默认店铺,取会员之前选择的店铺
         // 默认店铺,取会员之前选择的店铺
         MtStore storeInfo = null;
         MtStore storeInfo = null;
@@ -89,6 +89,10 @@ public class ClientSystemController extends BaseController {
                 if (!mtUser.getStatus().equals(StatusEnum.ENABLED.getKey())) {
                 if (!mtUser.getStatus().equals(StatusEnum.ENABLED.getKey())) {
                     return getFailureResult(1001);
                     return getFailureResult(1001);
                 }
                 }
+                // 商户号不同
+                if (!mtUser.getMerchantId().equals(merchantId)) {
+                    return getFailureResult(1001);
+                }
             }
             }
         }
         }
 
 
@@ -100,7 +104,7 @@ public class ClientSystemController extends BaseController {
                 if (!storeInfo.getStatus().equals(StatusEnum.ENABLED.getKey())) {
                 if (!storeInfo.getStatus().equals(StatusEnum.ENABLED.getKey())) {
                     storeInfo = null;
                     storeInfo = null;
                 }
                 }
-                if (storeInfo != null && mtMerchant != null && !mtMerchant.getId().equals(storeInfo.getMerchantId())) {
+                if (storeInfo != null && merchantId.equals(storeInfo.getMerchantId())) {
                     storeInfo = null;
                     storeInfo = null;
                 }
                 }
             }
             }

+ 5 - 1
fuint-application/src/main/java/com/fuint/module/clientApi/controller/ClientUserController.java

@@ -99,8 +99,12 @@ public class ClientUserController extends BaseController {
     @CrossOrigin
     @CrossOrigin
     public ResponseObject info(HttpServletRequest request) throws BusinessCheckException {
     public ResponseObject info(HttpServletRequest request) throws BusinessCheckException {
         String token = request.getHeader("Access-Token");
         String token = request.getHeader("Access-Token");
+        String merchantNo = request.getHeader("merchantNo") == null ? "" : request.getHeader("merchantNo");
         String userNo = request.getParameter("code") == null ? "" : request.getParameter("code");
         String userNo = request.getParameter("code") == null ? "" : request.getParameter("code");
         UserInfo loginInfo = TokenUtil.getUserInfoByToken(token);
         UserInfo loginInfo = TokenUtil.getUserInfoByToken(token);
+
+        Integer merchantId = merchantService.getMerchantId(merchantNo);
+
         MtUser userInfo = null;
         MtUser userInfo = null;
         if (loginInfo != null) {
         if (loginInfo != null) {
             userInfo = memberService.queryMemberById(loginInfo.getId());
             userInfo = memberService.queryMemberById(loginInfo.getId());
@@ -113,7 +117,7 @@ public class ClientUserController extends BaseController {
             gradeInfo = memberService.queryMemberGradeByGradeId(Integer.parseInt(userInfo.getGradeId()));
             gradeInfo = memberService.queryMemberGradeByGradeId(Integer.parseInt(userInfo.getGradeId()));
         }
         }
 
 
-        List<MtUserGrade> memberGrade = userGradeService.getPayUserGradeList(userInfo);
+        List<MtUserGrade> memberGrade = userGradeService.getPayUserGradeList(merchantId, userInfo);
         Map<String, Object> outParams = new HashMap<>();
         Map<String, Object> outParams = new HashMap<>();
         outParams.put("userInfo", userInfo);
         outParams.put("userInfo", userInfo);
         outParams.put("gradeInfo", gradeInfo);
         outParams.put("gradeInfo", gradeInfo);

+ 0 - 3
fuint-repository/src/main/resources/mapper/MtGoodsMapper.xml

@@ -26,9 +26,6 @@
 
 
     <update id="updateInitSale">
     <update id="updateInitSale">
         update mt_goods t set t.INIT_SALE = t.INIT_SALE + 1 where t.ID = #{goodsId}
         update mt_goods t set t.INIT_SALE = t.INIT_SALE + 1 where t.ID = #{goodsId}
-        <if test="merchantId != null and merchantId > 0">
-            AND t.MERCHANT_ID = #{merchantId}
-        </if>
     </update>
     </update>
 
 
     <select id="selectGoodsList" resultType="com.fuint.repository.bean.GoodsBean">
     <select id="selectGoodsList" resultType="com.fuint.repository.bean.GoodsBean">