Commit cab5aecc by 丁伟峰

发现原先使用RequestParam String[], 调用的时候出错,现在改成dto方式

1 parent 5ea68c29
......@@ -3,6 +3,7 @@ package com.alibaba.cloud.integration.order.controller;
import com.alibaba.cloud.integration.common.BusinessException;
import com.alibaba.cloud.integration.common.Result;
import com.alibaba.cloud.integration.order.dto.LevelReqDTO;
import com.alibaba.cloud.integration.order.dto.OrganizationEngineersReqDTO;
import com.alibaba.cloud.integration.order.service.OrganizationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -42,10 +43,10 @@ public class OrganizationController {
}
@GetMapping("/organization/engineer/list")
public Result<?> getTeamsEngineers(@RequestParam String[] teamIds) {
public Result<?> getTeamsEngineers(OrganizationEngineersReqDTO reqDTO) {
Result<?> res = null;
try {
res = organizationService.getEngineersByTeams(teamIds);
res = organizationService.getEngineersByTeams(reqDTO.getTeamIds());
} catch (BusinessException e) {
return Result.failed(e.getMessage());
}
......
package com.alibaba.cloud.integration.order.dto;
import lombok.experimental.Accessors;
import java.util.List;
@lombok.Data
public class OrganizationEngineersReqDTO {
private List<String> teamIds;
}
......@@ -2,10 +2,12 @@ package com.alibaba.cloud.integration.order.service;
import com.alibaba.cloud.integration.common.Result;
import java.util.List;
public interface OrganizationService {
Result<?> getOrganizationTree(String levelType, String levelId);
Result<?> getEngineersByTeams(String[] teamIds);
Result<?> getEngineersByTeams(List<String> teamIds);
Result<?> getTeamsByLevel(String levelType, String levelValue);
}
......@@ -75,9 +75,9 @@ public class OrganizationServiceImpl implements OrganizationService {
}
@Override
public Result<?> getEngineersByTeams(String[] teamIds) {
public Result<?> getEngineersByTeams(List<String> teamIds) {
List<OrganizationEngineersRespDTO.Engineer> engineers = new ArrayList<>();
for (OrgTeamEngineerEntity e : orgTeamEngineerDao.findAllByTeamIdIn(Arrays.asList(teamIds))) {
for (OrgTeamEngineerEntity e : orgTeamEngineerDao.findAllByTeamIdIn(teamIds)) {
EngineerInfoEntity engineerInfoEntity = engineerInfoDao.getByEngineerCode(e.getEngineerCode());
if (engineerInfoEntity == null) {
log.error("技术员信息不存在!engineer_code: {}", e.getEngineerCode());
......@@ -90,6 +90,7 @@ public class OrganizationServiceImpl implements OrganizationService {
@Override
public Result<?> getTeamsByLevel(String levelType, String levelValue) {
log.debug("getTeamsByLevel({}, {})", levelType, levelValue);
List<OrgTeamEntity> entities;
if ("cluster".equals(levelType)) {
entities = orgTeamDao.findAllByClusterId(levelValue);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!