export merchant excel ui button

master
yixian 5 years ago
parent cf7e8cbcaa
commit 75a7461009

@ -21,7 +21,6 @@ public class AppPermissionSupportImpl implements AppPermissionSupport {
private SysAppsMapper sysAppsMapper; private SysAppsMapper sysAppsMapper;
private final String signTemplate = "%s&%s&%s&%s&%s"; private final String signTemplate = "%s&%s&%s&%s&%s";
private Logger logger = LoggerFactory.getLogger(getClass()); private Logger logger = LoggerFactory.getLogger(getClass());
public static final String[] NODES_IP_ADDRESSS = new String[]{"119.28.3.196","150.109.64.108", "119.28.178.24", "119.28.24.146", "119.28.77.25"};
@Override @Override
public JSONObject validateSign(String appid, long timestamp, String ip, String requestUri, String sign) { public JSONObject validateSign(String appid, long timestamp, String ip, String requestUri, String sign) {
@ -42,18 +41,9 @@ public class AppPermissionSupportImpl implements AppPermissionSupport {
} }
String auth = app.getString("auth_code"); String auth = app.getString("auth_code");
String str = String.format(signTemplate, appid, auth, timestamp, requestUri, ip); String str = String.format(signTemplate, appid, auth, timestamp, requestUri, ip);
logger.debug("sso-str before hash:" + str); logger.debug("sso-str before hash:{}", str);
String hash = DigestUtils.sha256Hex(str).toLowerCase(); String hash = DigestUtils.sha256Hex(str).toLowerCase();
if (!StringUtils.equals(hash, sign)) { if (!StringUtils.equals(hash, sign)) {
for (String nodeIp : NODES_IP_ADDRESSS) {
logger.error("[{}]请求的签名有误,使用节点 [{}] 签名", appid, nodeIp);
str = String.format(signTemplate, appid, auth, timestamp, requestUri, nodeIp);
logger.debug("NodeIp check sso-str before hash:" + str);
hash = DigestUtils.sha256Hex(str).toLowerCase();
if (StringUtils.equals(hash, sign)) {
return app;
}
}
throw new ForbiddenException("InvalidSign"); throw new ForbiddenException("InvalidSign");
} }
return app; return app;

@ -58,7 +58,7 @@ public class SSOSupportImpl implements SSOSupport {
public String cacheClient(String appid, JSONObject clientUser) { public String cacheClient(String appid, JSONObject clientUser) {
String code = Long.toString(System.currentTimeMillis(), 36) + RandomStringUtils.random(10, true, true); String code = Long.toString(System.currentTimeMillis(), 36) + RandomStringUtils.random(10, true, true);
String cacheKey = accountCacheKey("client", appid, code); String cacheKey = accountCacheKey("client", appid, code);
logger.debug("========cacheClient,key:"+cacheKey+"========"); logger.debug("========cacheClient,key:{}========", cacheKey);
stringRedisTemplate.boundValueOps(cacheKey).set(clientUser.toJSONString(), 30, TimeUnit.SECONDS); stringRedisTemplate.boundValueOps(cacheKey).set(clientUser.toJSONString(), 30, TimeUnit.SECONDS);
return code; return code;
} }
@ -70,7 +70,7 @@ public class SSOSupportImpl implements SSOSupport {
private JSONObject getCachedAccount(String appid, String code, String type) { private JSONObject getCachedAccount(String appid, String code, String type) {
String cacheKey = accountCacheKey(type, appid, code); String cacheKey = accountCacheKey(type, appid, code);
logger.debug("========getCachedAccount,key:"+cacheKey+"========"); logger.debug("========getCachedAccount,key:{}========", cacheKey);
String jsonstr = stringRedisTemplate.boundValueOps(cacheKey).get(); String jsonstr = stringRedisTemplate.boundValueOps(cacheKey).get();
stringRedisTemplate.delete(cacheKey); stringRedisTemplate.delete(cacheKey);
if (jsonstr != null) { if (jsonstr != null) {
@ -81,7 +81,7 @@ public class SSOSupportImpl implements SSOSupport {
@Override @Override
public JSONObject getCachedClientAccount(String appid, String code) { public JSONObject getCachedClientAccount(String appid, String code) {
logger.debug("========getCachedClientAccount,appid:"+appid+",code:"+code+"========"); logger.debug("========getCachedClientAccount,appid:{},code:{}========", appid, code);
return getCachedAccount(appid, code, "client"); return getCachedAccount(appid, code, "client");
} }

@ -225,6 +225,18 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}); });
}; };
$scope.exportPartnersExcel = function () {
var params = angular.copy($scope.params);
var param_str = keys(params).map(function (key) {
var value = params[key];
if (angular.isDate(value)) {
value = $filter('date')(value, 'yyyy-MM-ddTHH:mm:ssZ')
}
return key + '=' + encodeURIComponent(value)
}).join('&');
window.open('/sys/partners/exporting_excel?'+param_str)
};
/*$scope.loadLocations = function () { /*$scope.loadLocations = function () {
var params = angular.copy($scope.params); var params = angular.copy($scope.params);
$http.get('/sys/partners/merchant/list_locations', {params: params}).then(function (resp) { $http.get('/sys/partners/merchant/list_locations', {params: params}).then(function (resp) {

@ -386,6 +386,9 @@
ng-click="loadPartners(1)"><i ng-click="loadPartners(1)"><i
class="fa fa-search"></i> Search class="fa fa-search"></i> Search
</button> </button>
<button class="btn btn-primary" type="button" ng-if="'export_clients_excel'|withFunc" ng-click="exportParntersExcel()">
<i class="fa fa-save"></i> Export
</button>
<!-- 商户分布以及商户进件位置转移 --> <!-- 商户分布以及商户进件位置转移 -->
<!--<button ng-if="mapFrame" class="btn btn-primary" type="button" <!--<button ng-if="mapFrame" class="btn btn-primary" type="button"
ng-click="loadLocations()"><i ng-click="loadLocations()"><i

Loading…
Cancel
Save