|
@@ -0,0 +1,64 @@
|
|
|
|
+package cn.com.qmth.examcloud.core.basic.api.provider;
|
|
|
|
+
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
+
|
|
|
|
+import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
|
|
+import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.CommonCloudService;
|
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.bean.ThirdPartyAccessBean;
|
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.request.GetThirdPartyAccessInfoReq;
|
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.response.GetThirdPartyAccessInfoResp;
|
|
|
|
+import cn.com.qmth.examcloud.core.basic.dao.ThirdPartyAccessRepo;
|
|
|
|
+import cn.com.qmth.examcloud.core.basic.dao.entity.ThirdPartyAccessEntity;
|
|
|
|
+import cn.com.qmth.examcloud.core.basic.dao.entity.ThirdPartyAccessPK;
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 类注释
|
|
|
|
+ *
|
|
|
|
+ * @author WANGWEI
|
|
|
|
+ * @date 2018年7月6日
|
|
|
|
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
|
|
|
|
+ */
|
|
|
|
+@RestController
|
|
|
|
+@RequestMapping("${$rmp.cloud.basic}" + "common")
|
|
|
|
+public class CommonCloudServiceProvider extends ControllerSupport implements CommonCloudService {
|
|
|
|
+
|
|
|
|
+ private static final long serialVersionUID = 8860099250569635574L;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ ThirdPartyAccessRepo thirdPartyAccessRepo;
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "获取第三方接入信息")
|
|
|
|
+ @PostMapping("getThirdPartyAccessInfo")
|
|
|
|
+ @Override
|
|
|
|
+ public GetThirdPartyAccessInfoResp getThirdPartyAccessInfo(
|
|
|
|
+ @RequestBody GetThirdPartyAccessInfoReq req) {
|
|
|
|
+
|
|
|
|
+ String appId = req.getAppId();
|
|
|
|
+ Long rootOrgId = req.getRootOrgId();
|
|
|
|
+
|
|
|
|
+ ThirdPartyAccessEntity entity = thirdPartyAccessRepo
|
|
|
|
+ .findOne(new ThirdPartyAccessPK(rootOrgId, appId));
|
|
|
|
+
|
|
|
|
+ if (null == entity) {
|
|
|
|
+ throw new StatusException("B-001001", "第三方接入信息不存在");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ThirdPartyAccessBean bean = new ThirdPartyAccessBean();
|
|
|
|
+ bean.setAppId(entity.getAppId());
|
|
|
|
+ bean.setRootOrgId(bean.getRootOrgId());
|
|
|
|
+ bean.setSecretKey(entity.getSecretKey());
|
|
|
|
+ bean.setTimeRange(entity.getTimeRange());
|
|
|
|
+
|
|
|
|
+ GetThirdPartyAccessInfoResp resp = new GetThirdPartyAccessInfoResp();
|
|
|
|
+ resp.setThirdPartyAccessBean(bean);
|
|
|
|
+
|
|
|
|
+ return resp;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|