Bläddra i källkod

angelBell HN provinceCode = 90

guozhaoshun 6 år sedan
förälder
incheckning
ea9b83742d

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

@@ -13,6 +13,7 @@ import cn.rankin.userservice.service.CampusService;
 import cn.rankin.userservice.service.MerchantService;
 import cn.rankin.userservice.utils.StudentNo;
 import cn.rankin.userservice.utils.StudentNumberUtil;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -21,7 +22,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
 import java.util.*;
-
+@Slf4j
 @RestController
 @RequestMapping(value = "/campus")
 public class CampusController {
@@ -115,15 +116,15 @@ public class CampusController {
             return APIResult.error(UserServiceAPICode.PARAMETER_ERROR);
         }
 
-        provinceCode = converProvinceCode(merchantId, provinceCode);
+        provinceCode = converProvinceCode(merchant, provinceCode);
 
         Integer serialNo = campusService.getSerialNo(merchantId, provinceCode);
-
         StudentNo studentNo = StudentNumberUtil.getStudentNo(merchant.getCode(), provinceCode, serialNo);
         if (studentNo == null) {
             return APIResult.error(UserServiceAPICode.CAMPUS_NO_ERROR);
         }
 
+        campusDTO.setCode(provinceCode);
         campusDTO.setSerialNo(serialNo);
         campusDTO.setCode(studentNo.getCampusNo());
 
@@ -139,12 +140,11 @@ public class CampusController {
     /**
      * 判断是否贝尔安亲,湖南校区。
      * 因湖南校区已达到最大限额,使用湖南新编号
-     * @param merchantId
+     * @param merchant
      * @param provinceCode
      * @return
      */
-    private String converProvinceCode(String merchantId, String provinceCode) {
-        Merchant merchant = merchantService.findOne(merchantId);
+    private String converProvinceCode(Merchant merchant, String provinceCode) {
         if("6666".equals(merchant.getCode()) && provinceCode.equals(ProvinceUtil.HN_ORIGINAL)){
             provinceCode = ProvinceUtil.HN;
         }