|
@@ -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;
|
|
@@ -12,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;
|
|
@@ -20,7 +22,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
import java.util.*;
|
|
|
-
|
|
|
+@Slf4j
|
|
|
@RestController
|
|
|
@RequestMapping(value = "/campus")
|
|
|
public class CampusController {
|
|
@@ -114,13 +116,15 @@ public class CampusController {
|
|
|
return APIResult.error(UserServiceAPICode.PARAMETER_ERROR);
|
|
|
}
|
|
|
|
|
|
- Integer serialNo = campusService.getSerialNo(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.setProvinceCode(provinceCode);
|
|
|
campusDTO.setSerialNo(serialNo);
|
|
|
campusDTO.setCode(studentNo.getCampusNo());
|
|
|
|
|
@@ -133,6 +137,21 @@ public class CampusController {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 判断是否贝尔安亲,湖南校区。
|
|
|
+ * 因湖南校区已达到最大限额,使用湖南新编号
|
|
|
+ * @param merchant
|
|
|
+ * @param provinceCode
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String converProvinceCode(Merchant merchant, String provinceCode) {
|
|
|
+ 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);
|