|
@@ -31,6 +31,8 @@ import io.swagger.annotations.ApiOperation;
|
|
|
@RequestMapping("${$rmp.cloud.basic}" + "org")
|
|
|
public class OrgCloudServiceProvider extends ControllerSupport implements OrgCloudService {
|
|
|
|
|
|
+ private static final long serialVersionUID = -7858439296389761341L;
|
|
|
+
|
|
|
@Autowired
|
|
|
private OrgService orgService;
|
|
|
|
|
@@ -95,12 +97,26 @@ public class OrgCloudServiceProvider extends ControllerSupport implements OrgClo
|
|
|
@Override
|
|
|
public GetOrgResp getOrg(@RequestBody GetOrgReq req) {
|
|
|
Long orgId = req.getOrgId();
|
|
|
+ String orgCode = req.getOrgCode();
|
|
|
+ Long rootOrgId = req.getRootOrgId();
|
|
|
+
|
|
|
+ if (null == orgId && StringUtils.isBlank(orgCode)) {
|
|
|
+ throw new StatusException("B-150000", "orgId,orgCode不能都为空");
|
|
|
+ }
|
|
|
|
|
|
- if (null == orgId) {
|
|
|
- throw new StatusException("B-150000", "orgId is null");
|
|
|
+ if (null != orgId && StringUtils.isNotBlank(orgCode)) {
|
|
|
+ throw new StatusException("B-150001", "orgId,orgCode不能都不为空");
|
|
|
}
|
|
|
|
|
|
- Org org = orgRepo.findOne(orgId);
|
|
|
+ Org org = null;
|
|
|
+ if (null != orgId) {
|
|
|
+ org = orgRepo.findOne(orgId);
|
|
|
+ } else if (StringUtils.isNotBlank(orgCode)) {
|
|
|
+ if (null == rootOrgId) {
|
|
|
+ throw new StatusException("B-150001", "rootOrgId is null");
|
|
|
+ }
|
|
|
+ org = orgRepo.findByRootIdAndCode(rootOrgId, orgCode);
|
|
|
+ }
|
|
|
|
|
|
if (null == org) {
|
|
|
throw new StatusException("B-150001", "机构不存在");
|