Просмотр исходного кода

angelBell HN provinceCode = 90

guozhaoshun 6 лет назад
Родитель
Сommit
9efc79ba32

+ 19 - 0
rankin-user-service/src/main/java/cn/rankin/userservice/controller/CampusController.java

@@ -2,6 +2,7 @@ package cn.rankin.userservice.controller;
 
 import cn.rankin.common.utils.api.model.APIResult;
 import cn.rankin.common.utils.api.page.Page;
+import cn.rankin.common.utils.util.ProvinceUtil;
 import cn.rankin.data.api.user.dto.CampusDTO;
 import cn.rankin.data.api.user.dto.CampusSearchDTO;
 import cn.rankin.common.utils.enums.BaseOrderEnum;
@@ -114,6 +115,8 @@ public class CampusController {
             return APIResult.error(UserServiceAPICode.PARAMETER_ERROR);
         }
 
+        provinceCode = converProvinceCode(merchantId, provinceCode);
+
         Integer serialNo = campusService.getSerialNo(merchantId, provinceCode);
 
         StudentNo studentNo = StudentNumberUtil.getStudentNo(merchant.getCode(), provinceCode, serialNo);
@@ -133,6 +136,22 @@ public class CampusController {
         return result;
     }
 
+    /**
+     * 判断是否贝尔安亲,湖南校区。
+     * 因湖南校区已达到最大限额,使用湖南新编号
+     * @param merchantId
+     * @param provinceCode
+     * @return
+     */
+    private String converProvinceCode(String merchantId, String provinceCode) {
+        Merchant merchant = merchantService.findOne(merchantId);
+        if("6666".equals(merchant.getCode()) && provinceCode.equals(ProvinceUtil.HN_ORIGINAL)){
+            provinceCode = ProvinceUtil.HN;
+        }
+
+        return provinceCode;
+    }
+
     @RequestMapping(value = "/ids", method = RequestMethod.GET)
     public APIResult<Map<String, Campus>> findByIds(@RequestParam("id") List<String> campusIds) {
         Map<String, Campus> campusMap = campusService.getCampusMap(campusIds);