package com.gkhy.safePlatform.account.rpc.test;
|
|
import com.gkhy.safePlatform.account.model.dto.resp.ProjectRespDTO;
|
import com.gkhy.safePlatform.account.rpc.apimodel.AccountMenuService;
|
import com.gkhy.safePlatform.account.rpc.apimodel.AccountProjectService;
|
import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.ProjectRPCRespDTO;
|
import com.gkhy.safePlatform.account.service.ProjectService;
|
import com.gkhy.safePlatform.commons.enums.ResultCodes;
|
import com.gkhy.safePlatform.commons.exception.AusinessException;
|
import com.gkhy.safePlatform.commons.exception.BusinessException;
|
import com.gkhy.safePlatform.commons.utils.BeanCopyUtils;
|
import com.gkhy.safePlatform.commons.vo.ResultVO;
|
import org.apache.dubbo.config.annotation.DubboService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import java.util.List;
|
|
@DubboService
|
public class AccountProjectProvider implements AccountProjectService {
|
|
@Autowired
|
private ProjectService projectService;
|
|
@Override
|
public ResultVO<List<ProjectRPCRespDTO>> getProjectList() {
|
try {
|
List<ProjectRespDTO> enableProjectList = projectService.getEnableProjectList();
|
List<ProjectRPCRespDTO> data = BeanCopyUtils.copyBeanList(enableProjectList, ProjectRPCRespDTO.class);
|
return new ResultVO<>(ResultCodes.OK, data);
|
} catch (AusinessException e) {
|
return new ResultVO<>(e.getCode(), e.getMessage());
|
} catch (BusinessException e) {
|
return new ResultVO<>(e.getCode(),e.getMessage());
|
} catch (Exception e) {
|
// return new ResultVO<>(ResultCodes.SERVER_ERROR);
|
ResultVO resultVO = new ResultVO<>();
|
resultVO.setCode(ResultCodes.SERVER_ERROR);
|
return resultVO;
|
}
|
|
}
|
}
|