parent
de55f0b10c
commit
0b70366c7e
@ -0,0 +1,15 @@
|
||||
package au.com.royalpay.payment.manage.support.cms.core;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
public interface AppStyleService {
|
||||
JSONObject listAppStyleGroup(int page, int limit);
|
||||
|
||||
JSONObject getAppStyleByStyleId(String style_id);
|
||||
|
||||
void switchGroupByStyleId(String style_id);
|
||||
|
||||
void addAppStyle(String style_id, JSONObject appStyleGroup);
|
||||
|
||||
void updateAppStyleByStyleId(String style_id, String originStyleId, JSONObject appStyleGroup);
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
package au.com.royalpay.payment.manage.support.cms.core.Impl;
|
||||
|
||||
import au.com.royalpay.payment.manage.support.cms.core.AppStyleService;
|
||||
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
|
||||
import cn.yixblog.platform.http.HttpRequestGenerator;
|
||||
import cn.yixblog.platform.http.HttpRequestResult;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
@Service
|
||||
public class AppStyleServiceImpl implements AppStyleService {
|
||||
|
||||
@Value("http://127.0.0.1:9533")
|
||||
private String cmsHost;
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Override
|
||||
public JSONObject listAppStyleGroup(int page, int limit) {
|
||||
String url = concatUrl("/app/style_group");
|
||||
HttpRequestGenerator gen = new HttpRequestGenerator(url, RequestMethod.GET).addQueryString("page", page + "").addQueryString("limit", limit + "");
|
||||
try {
|
||||
HttpRequestResult res = gen.execute();
|
||||
if (res.isSuccess()) {
|
||||
return res.getResponseContentJSONObj();
|
||||
}
|
||||
} catch (URISyntaxException | IOException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
throw new ServerErrorException("Failed to request CMS");
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getAppStyleByStyleId(String style_id) {
|
||||
String url = concatUrl("/app/style_group/" + style_id);
|
||||
HttpRequestGenerator gen = new HttpRequestGenerator(url, RequestMethod.GET);
|
||||
try {
|
||||
HttpRequestResult res = gen.execute();
|
||||
if (res.isSuccess()) {
|
||||
return res.getResponseContentJSONObj();
|
||||
}
|
||||
} catch (URISyntaxException | IOException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
throw new ServerErrorException("Failed to request CMS");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switchGroupByStyleId(String style_id) {
|
||||
String url = concatUrl("/app/style_group/" + style_id);
|
||||
try {
|
||||
HttpRequestResult res = new HttpRequestGenerator(url, RequestMethod.PUT).execute();
|
||||
if (res.isSuccess()) {
|
||||
return;
|
||||
}
|
||||
} catch (URISyntaxException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
throw new ServerErrorException("Failed to request CMS");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAppStyle(String style_id, JSONObject appStyleGroup) {
|
||||
String url = concatUrl("/app/style_group");
|
||||
try {
|
||||
HttpRequestResult gen = new HttpRequestGenerator(url, RequestMethod.POST).addQueryString("style_id", style_id).setJSONEntity(appStyleGroup).execute();
|
||||
if (gen.isSuccess()) {
|
||||
return;
|
||||
}
|
||||
} catch (URISyntaxException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
throw new ServerErrorException("Failed to request CMS");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAppStyleByStyleId(String style_id, String originStyleId, JSONObject appStyleGroup) {
|
||||
String url = concatUrl("/app/style_group/" + style_id + "/style");
|
||||
try {
|
||||
HttpRequestResult gen = new HttpRequestGenerator(url, RequestMethod.PUT).addQueryString("originStyleId", originStyleId).setJSONEntity(appStyleGroup).execute();
|
||||
if (gen.isSuccess()) {
|
||||
return;
|
||||
}
|
||||
} catch (URISyntaxException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
throw new ServerErrorException("Failed to request CMS");
|
||||
}
|
||||
|
||||
private String concatUrl(String uri) {
|
||||
String host = cmsHost.endsWith("/") ? cmsHost.substring(0, cmsHost.length() - 1) : cmsHost;
|
||||
uri = uri.startsWith("/") ? uri.substring(1) : uri;
|
||||
return host + "/" + uri;
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package au.com.royalpay.payment.manage.support.cms.web;
|
||||
|
||||
|
||||
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
|
||||
import au.com.royalpay.payment.manage.support.cms.core.AppStyleService;
|
||||
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@ManagerMapping(value = "/app/cms/app_style", role = {ManagerRole.SITE_MANAGER})
|
||||
public class AppStyleController {
|
||||
@Resource
|
||||
private AppStyleService appStyleService;
|
||||
|
||||
@RequestMapping(value = "/style_group", method = RequestMethod.GET)
|
||||
public JSONObject listAppStyleGroup(@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int limit) {
|
||||
return appStyleService.listAppStyleGroup(page, limit);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/style_group/{style_id}", method = RequestMethod.GET)
|
||||
public JSONObject getAppStyleByStyleId(@PathVariable String style_id) {
|
||||
return appStyleService.getAppStyleByStyleId(style_id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/style_group/{style_id}", method = RequestMethod.PUT)
|
||||
public void switchGroupByStyleId(@PathVariable String style_id) {
|
||||
appStyleService.switchGroupByStyleId(style_id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/style_group", method = RequestMethod.POST)
|
||||
public void addOneGroupAppStyle(@RequestParam String style_id, @RequestBody JSONObject appStyleGroup) {
|
||||
appStyleService.addAppStyle(style_id, appStyleGroup);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/style_group/{style_id}/style", method = RequestMethod.PUT)
|
||||
public void updateAppStyleByStyleId(@PathVariable String style_id,@RequestParam String originStyleId, @RequestBody JSONObject appStyleGroup) {
|
||||
appStyleService.updateAppStyleByStyleId(style_id, originStyleId, appStyleGroup);
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
<div ui-view>
|
||||
<section class="content-header">
|
||||
<h1>APP_STYLE</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a ui-sref="cms">网站管理</a></li>
|
||||
<li>app图标</li>
|
||||
</ol>
|
||||
</section>
|
||||
<section class="content" >
|
||||
<div class="box box-warning">
|
||||
<div class="box-body">
|
||||
<div class="form-inline">
|
||||
<div class="form-group">
|
||||
<a class="btn btn-success" ui-sref=".app_style_save">
|
||||
<i class="fa fa-plus"></i> New App Style
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box box-default">
|
||||
<div class="box-body table-responsive">
|
||||
<table class="table table-bordered table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th>Published</th>
|
||||
<th>Operation</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="appStyleGroup in appStyleGroups" class="ng-scope">
|
||||
<td><a role="button" ui-sref=".app_style_preview({style_id:appStyleGroup.style_id})" ng-bind="appStyleGroup.style_id"></a></td>
|
||||
<td>
|
||||
<a title="Toggle publish status">
|
||||
<i class="fa" ng-class="{'fa-check text-success':appStyleGroup.is_valid,'fa-remove text-danger':!appStyleGroup.is_valid}"></i>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a role="button" ui-sref=".app_style_edit({style_id:appStyleGroup.style_id})" title="edit"><i class="fa fa-edit"></i></a>
|
||||
<a role="button" ui-sref=".app_style_preview({style_id:appStyleGroup.style_id})" title="preview"><i class="fa fa-eye"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<uib-pagination class="pagination"
|
||||
total-items="pagination.totalCount"
|
||||
boundary-links="true"
|
||||
ng-model="pagination.page"
|
||||
items-per-page="pagination.limit"
|
||||
max-size="10"
|
||||
ng-change="appStyleGroupList()"
|
||||
previous-text="‹"
|
||||
next-text="›"
|
||||
first-text="«"
|
||||
last-text="»"></uib-pagination>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">Total Records:{{pagination.totalCount}};Total Pages:{{pagination.totalPages}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
@ -0,0 +1,67 @@
|
||||
<div ui-view xmlns="http://www.w3.org/1999/html">
|
||||
<section class="content-header">
|
||||
<h1>APP_STYLE</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a ui-sref="cms">网站管理</a></li>
|
||||
<li><a ui-sref="cms.app_style">app图标</a></li>
|
||||
<li class="active" ng-bind="!ctrl.flag?'Edit Article':'New Article'"></li>
|
||||
</ol>
|
||||
</section>
|
||||
<section class="content" >
|
||||
<div class="box box-warning">
|
||||
<div class="box-body">
|
||||
<div class="form-inline">
|
||||
<div class="form-group">
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="short-name-search">title</label>
|
||||
<input type="text" class="form-control" id="short-name-search" name="style_id"
|
||||
ng-model="params.style_id" required>
|
||||
<div class="checkbox-inline">
|
||||
<label><input role="button" type="radio" ng-value="true" ng-model="entity.appStyle[0].is_valid" ng-change="toggleAppStyleIsValid(params.style_id)"> Published</label>
|
||||
</div>
|
||||
</div>
|
||||
<!--<div class="form-group">-->
|
||||
<!--<button class="btn btn-success" type="button" ng-click="addSpecOption()">-->
|
||||
<!--<i class="fa fa-plus"></i> New App Style-->
|
||||
<!--</button>-->
|
||||
<!--</div>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box box-default">
|
||||
<div class="alert alert-danger" ng-if="errmsg" ng-bind="errmsg"></div>
|
||||
<div class="box-body table-responsive">
|
||||
<table class="table table-bordered table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Key</th>
|
||||
<th>Value</th>
|
||||
<!--<th class=>Operation</th>-->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="appStyle in entity.appStyle">
|
||||
<td>
|
||||
<input class="form-control" ng-model="appStyle.style_key" placeholder="Key" disabled>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" name="style_value" ng-model="appStyle.style_value" placeholder="Value">
|
||||
</td>
|
||||
<!--<td>-->
|
||||
<!--<button type="button" ng-click="delSpecOption($index)"-->
|
||||
<!--class="btn btn-default" title="删除">-->
|
||||
<!--<i class="fa fa-trash-o"></i> 删除-->
|
||||
<!--</button>-->
|
||||
<!--</td>-->
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-success" type="button" ng-click="saveOneGroupAppStyle(style_form)" ng-disabled="ctrl.sending">Submit</button>
|
||||
<a role="button" class="btn btn-danger" ui-sref="^" ui-sref-opts="{reload:true}">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
@ -0,0 +1,46 @@
|
||||
<div ui-view>
|
||||
<section class="content-header">
|
||||
<h1>APP_STYLE</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a ui-sref="cms">网站管理</a></li>
|
||||
<li><a ui-sref="cms.app_style">app图标</a></li>
|
||||
<li class="active">app图标详情</li>
|
||||
</ol>
|
||||
</section>
|
||||
<section class="content" >
|
||||
<div class="box box-warning">
|
||||
<div class="box-body">
|
||||
<div class="form-inline">
|
||||
<div class="form-group">
|
||||
<a class="btn btn-success" ui-sref="cms.app_style.app_style_save">
|
||||
<i class="fa fa-plus"></i> New App Style
|
||||
</a>
|
||||
<a class="btn btn-primary" ui-sref="cms.app_style.app_style_edit({style_id:appStyles[0].style_id})">
|
||||
<i class="fa fa-edit"></i> Edit App Style
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box box-default">
|
||||
<div class="box-body table-responsive">
|
||||
<table class="table table-bordered table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th>Style_Key</th>
|
||||
<th>Style_Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="appStyle in appStyles">
|
||||
<td ng-bind="appStyle.style_id"></td>
|
||||
<td ng-bind="appStyle.style_key"></td>
|
||||
<td style="width: 50%;" ng-bind="appStyle.style_value"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
Loading…
Reference in new issue