|
|
@@ -7,6 +7,7 @@ import com.uas.sso.common.util.HttpUtil;
|
|
|
import com.uas.sso.entity.App;
|
|
|
import com.uas.sso.exception.VisibleError;
|
|
|
import com.uas.sso.service.AppService;
|
|
|
+import com.uas.sso.util.BeanUtil;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
@@ -31,10 +32,16 @@ public class AppManageController extends BaseController {
|
|
|
@RequestMapping("/getAgreementUrl")
|
|
|
public ModelMap getAgreementUrl(@RequestParam(defaultValue = "sso") String appId) {
|
|
|
App app = appService.findOne(appId);
|
|
|
+ App defaultApp = appService.findOne("sso");
|
|
|
String html = null;
|
|
|
- if (app.getPageStyle() != null) {
|
|
|
- JSONObject jsonObject = JSON.parseObject(app.getPageStyle().getTerms());
|
|
|
- if (jsonObject != null) {
|
|
|
+ if (app.getPageStyle() == null) {
|
|
|
+ app = defaultApp;
|
|
|
+ } else {
|
|
|
+ BeanUtil.copyProperties(app.getPageStyle(), defaultApp.getPageStyle(), true, "appId", "app", "desc");
|
|
|
+ }
|
|
|
+ if (defaultApp.getPageStyle() != null) {
|
|
|
+ JSONObject jsonObject = JSON.parseObject(defaultApp.getPageStyle().getTerms());
|
|
|
+ if (jsonObject != null && !jsonObject.getBoolean("isUrl")) {
|
|
|
try {
|
|
|
HttpUtil.ResponseWrap res = HttpUtil.doGet(jsonObject.getString("url"));
|
|
|
if (res.isSuccess()) {
|
|
|
@@ -51,7 +58,7 @@ public class AppManageController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
ModelMap data = new ModelMap();
|
|
|
- data.addAllAttributes(JSON.parseObject(JSON.toJSONString(app.getPageStyle()))).addAttribute("term", html);
|
|
|
+ data.addAllAttributes(JSON.parseObject(JSON.toJSONString(defaultApp.getPageStyle()))).addAttribute("term", html);
|
|
|
return success(data);
|
|
|
}
|
|
|
}
|