팀 생성

Swit Team 정보 생성 
 
 
 Swit 의 Team API를 이용하여 팀을 생성 합니다. 
 상위조직의 아이디는 필수값이므로 상위조직부터 생성하시길 바랍니다. 
 최상위 조직을 등록하실땐 parent_id를 0으로 주시면 됩니다. 
 
 
 package io.swit.api.service.eai;

@Service
@Slf4j
@AllArgsConstructor
public class TeamService {
 public String createSwitTeam(SwitDeptDto team) throws Exception{
 String teamId = "";
 JSONObject params = new JSONObject();
 try {
 params.put("name", team.getTeamName());
 params.put("parent_id", team.getParentId());
 params.put("reference", team.getReference());

 SwitTokenDto tokenDto = authService.getSwitTokenByDb("cts-api");
 JsonObject result = httpUtils.post("team.create", params, tokenDto);
 JsonElement data = result.getAsJsonObject().get("data");
 SwitDeptDto switDept = new SwitDeptDto();
 switDept = this.parsingTeamResult(data);
 teamId = this.saveSwitDeptBySync(switDept);
 } catch (Exception e) {
 log.error(e.getMessage());
 }

 return teamId;
 }
}