1  实例明细url显示 2  增加了logo图片可以编辑

1  实例明细url显示

是在iop中写死的配置

2  增加了logo图片可以编辑

仿照 admin里  服务工厂-服务定义中的内容

(1)在edit.html中增加logo图片字样及调用选择图片,以及logo.html

    <div class="form-group form-required">
<label class="control-label col-sm-3">logo图片:</label> <div class="col-sm-7">
<input type="text" class="form-control" name="logo_url" value="{{serviceDef.logo_url}}" readonly
style="cursor:pointer;">
</div>
</div>

(2)在detail.js中增加          self.logoChoose($dialog); 以及logoChoose函数(在group.js中静姐写过)

3 前端和后端密钥支持删除

 (1)前端在secretKey.js中添加:首先增加按钮,写deleteSecretKey函数(前后端密钥一样)

(2)self.ajax.delete("/dev/v1.0/secretKey-list/delete/"+id,function(err,data)  通过这个借口,链接到后台 cloud-api-service中。

controller层:

dao层:修改,ApiClientDefineDao,,增加了ApiClientDefineEntityDao.java   ,增加了getListByClientId

/**
*
*/
package com.inspur.cloud.api.dao; import com.inspur.cloud.api.entity.ApiClientDefine;
import com.inspur.cloud.api.entity.ApiClientDefineEntity;
import com.inspur.cloud.api.entity.ApiServiceEntity;
import com.inspur.cloud.resource.ResourceRelationUtils;
import org.springframework.util.StringUtils;
import org.springside.modules.orm.hibernate.HibernateDao; import java.util.Date; /**
*
* @author cww<br>
* @version 1.0
* 2015-6-3 10:52:49<br>
*/
public class ApiClientDefineEntityDao<T extends ApiClientDefine> extends HibernateDao<T, String> { /**
* The t parameter must be a Resource object.
* <p></p>
*/
public void save(T t) {
this.save(t, StringUtils.isEmpty(t.getId()));
} /**
* The t parameter must be a Resource object.
* <p></p>
*/
public void save(T t, boolean isCreate) {
//create a resource Date time = new Date();
t.setUpdatedAt(time);
if(isCreate) {
if(t.getCreatedAt() == null) {
t.setCreatedAt(time);
}
t.setIsDeleted(Boolean.FALSE);
}
super.save(t);
} // private void setProperty() public void delete(String id) {
//check the resource has referenced by any other resource
ResourceRelationUtils.checkResourceDelete(id);
T t = this.get(id);
Date time = new Date();
t.setUpdatedAt(time);
t.setDeletedAt(time);
t.setIsDeleted(Boolean.TRUE);
this.save(t);
} /* (non-Javadoc)
* @see org.springside.modules.orm.hibernate.SimpleHibernateDao#delete(java.lang.Object)
*/
@Override
public void delete(ApiClientDefine entity) {
this.delete(entity.getId());
}
}

 entiyt 层:ApiClientDefine和ApiClientDefineEntity ,仿照静姐delete,增加了ApiClientDefineEntity(extends IdEntity)

package com.inspur.cloud.api.entity;

import java.io.Serializable;
import java.util.Date; import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table; import org.hibernate.annotations.Type; import com.fasterxml.jackson.annotation.JsonProperty;
import com.wordnik.swagger.annotations.ApiModelProperty; @Entity
@Table(name="Api_client_define")
public class ApiClientDefine extends ApiClientDefineEntity{
private static final long serialVersionUID = 1L; @JsonProperty("CLIENT_KEY")
private String clientKey;
@JsonProperty("CLIENT_SECRET")
private String clientSecret;
@JsonProperty("DESCRIPTION")
private String description;
@JsonProperty("CLIENT_TYPE")
private String clientType;
@JsonProperty("OWNER")
private String owner;
@JsonProperty("IN_USE")
private Boolean inUse;
@ApiModelProperty(hidden=true)
@JsonProperty("IS_DELETED")
private Boolean isDeleted;
@ApiModelProperty(hidden=true)
@JsonProperty("CREATED_AT")
private Date createdAt;
@ApiModelProperty(hidden=true)
@JsonProperty("UPDATED_AT")
private Date updatedAt;
@ApiModelProperty(hidden=true)
@JsonProperty("DELETED_AT")
private Date deletedAt; public String getClientKey() {
return clientKey;
}
public void setClientKey(String clientKey) {
this.clientKey = clientKey;
}
public String getClientSecret() {
return clientSecret;
}
public void setClientSecret(String clientSecret) {
this.clientSecret = clientSecret;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getClientType() {
return clientType;
}
public void setClientType(String clientType) {
this.clientType = clientType;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
@Type(type="com.inspur.cloudframework.hibernate.type.CharacterBooleanType")
public Boolean getInUse() {
return inUse;
}
public void setInUse(Boolean inUse) {
this.inUse = inUse;
} public Date getDeletedAt() {
return deletedAt;
} public void setDeletedAt(Date deletedAt) {
this.deletedAt = deletedAt;
} public Date getUpdatedAt() {
return updatedAt;
} public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
} @JsonProperty(value="CREATED_AT")
public Date getCreatedAt() {
return createdAt;
} public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
} @Type(type="com.inspur.cloudframework.hibernate.type.CharacterBooleanType")
public Boolean getIsDeleted() {
return isDeleted;
} public void setIsDeleted(Boolean isDeleted) {
this.isDeleted = isDeleted;
} }
/**
*
*/
package com.inspur.cloud.api.entity; import com.fasterxml.jackson.annotation.JsonProperty;
import com.inspur.cloud.entity.IdEntity;
import com.wordnik.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.Type; import javax.persistence.MappedSuperclass;
import java.util.Date; /**
*
* @author tang<br>
* @version 1.0
* Aug 27, 2015 4:40:48 PM<br>
*/
@MappedSuperclass public class ApiClientDefineEntity extends IdEntity{ /**
*
*/
private static final long serialVersionUID = 4654645545548886144L; /**
*
*/
//private static final long serialVersionUID = -2312615559760803050L;
/*@ApiModelProperty(hidden=true)
@JsonProperty("IS_DELETED")
private Boolean isDeleted;
@ApiModelProperty(hidden=true)
@JsonProperty("CREATED_AT")
private Date createdAt;
@ApiModelProperty(hidden=true)
@JsonProperty("UPDATED_AT")
private Date updatedAt;
@ApiModelProperty(hidden=true)
@JsonProperty("DELETED_AT")
private Date deletedAt; *//**
* @return the deletedAt
*//*
public Date getDeletedAt() {
return deletedAt;
}
*//**
* @param deletedAt the deletedAt to set
*//*
public void setDeletedAt(Date deletedAt) {
this.deletedAt = deletedAt;
}
*//**
* @return the updatedAt
*//*
public Date getUpdatedAt() {
return updatedAt;
}
*//**
* @param updatedAt the updatedAt to set
*//*
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
*//**
* @return the createdAt
*//*
@JsonProperty(value="created_at")
public Date getCreatedAt() {
return createdAt;
}
*//**
* @param createdAt the createdAt to set
*//*
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
*//**
* @return the isDeleted
*//*
@Type(type="com.inspur.cloudframework.hibernate.type.CharacterBooleanType")
public Boolean getIsDeleted() {
return isDeleted;
}
*//**
* @param isDeleted the isDeleted to set
*//*
public void setIsDeleted(Boolean isDeleted) {
this.isDeleted = isDeleted;
}
*/
}

service层:ApiClientDefineServiceImpl

package com.inspur.cloud.api.service;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map; import javax.annotation.Resource; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.orm.Page; import com.inspur.cloud.am.dao.UserDao;
import com.inspur.cloud.api.common.GuidGenerator;
import com.inspur.cloud.api.dao.ApiClientDefineDao;
import com.inspur.cloud.api.dao.ApiClientSvcInstRelaDao;
import com.inspur.cloud.api.dao.ApiServiceVersionDao;
import com.inspur.cloud.api.entity.ApiClientDefine;
import com.inspur.cloud.api.entity.ApiClientSvcInstRela;
import com.inspur.cloud.api.entity.ApiSvcVersion;
import com.inspur.cloud.api.utils.RedisCachePrefix; @Service
@Transactional
public class ApiClientDefineServiceImpl implements ApiClientDefineService { @Autowired
private ApiClientDefineDao apiClientDefineDao;
@Autowired
private ApiClientSvcInstRelaDao apiClientSvcInstRelaDao;
@Autowired
private ApiServiceVersionDao apiSvcVersionDao;
@Resource(name="apiRedisTemplate")
private RedisTemplate<String,String> redisTemplate;
@Autowired
private UserDao userDao; //获取当前用户下的所有密钥对(前端密钥)
public Page<ApiClientDefine> getApiClientDefineList(Page<ApiClientDefine> page,String description,String userId){
Map<String,Object> map = new HashMap<String,Object>();
map.put("OWNER", userId);
if(description!=null&&description.trim()!=""){
map.put("DESCRIPTION", description);
}
map.put("IS_DELETED", false);
Page<ApiClientDefine> apiClientDefinePage = apiClientDefineDao.getList(page, map);
return apiClientDefinePage;
}
//编辑
public void editSecretKey(String id,String name){
ApiClientDefine apiClientDefine = apiClientDefineDao.get(id);
apiClientDefine.setDescription(name);
apiClientDefine.setUpdatedAt(new Date());
apiClientDefineDao.save(apiClientDefine);
}
//新增
public void addSecretKey(String userId,String desc,String clientType){
ApiClientDefine api = new ApiClientDefine();
// String id = GuidGenerator.generate();
String clientKey = GuidGenerator.generate();
String clientSecret = GuidGenerator.generate();
// api.setId(id);
api.setClientKey(clientKey);
api.setClientSecret(clientSecret);
api.setClientType(clientType);
api.setDescription(desc);
api.setInUse(Boolean.TRUE);
api.setOwner(userId);
apiClientDefineDao.save(api);
// User user = this.userDao.get(userId);
if("SVC".equals(clientType)){
String redisValue = clientSecret+":"+api.getId();
// String redisValue = clientSecret+":"+id+":"+userId+":"+user.getLoginName();
RedisSerializer stringSerializer = new StringRedisSerializer();
redisTemplate.setKeySerializer(stringSerializer);
redisTemplate.setValueSerializer(stringSerializer);
redisTemplate.opsForValue().set(RedisCachePrefix.getBckKey(clientKey), redisValue);
}
}
//停用启用
public void stopSecretKey(String id){
ApiClientDefine apiClientDefine = apiClientDefineDao.findById(id);
Boolean inUse = apiClientDefine.getInUse();
if(inUse != null){
if(inUse.equals(Boolean.TRUE)){
apiClientDefine.setInUse(Boolean.FALSE);
}else if(inUse.equals(Boolean.FALSE)){
apiClientDefine.setInUse(Boolean.TRUE);
}
}
apiClientDefineDao.save(apiClientDefine);
} // 删除
public void deleteSecretKey(String id) {
ApiClientDefine apiClientDefine = apiClientDefineDao.findById(id);
Boolean inUse = apiClientDefine.getInUse();
if (inUse != null) {
if (inUse.equals(Boolean.TRUE)) {
apiClientDefine.setInUse(Boolean.FALSE);
} else if (inUse.equals(Boolean.FALSE)) {
apiClientDefine.setInUse(Boolean.TRUE);
}
}
Map<String, Object> map = new HashMap<String, Object>();
map.put("CLIENT_ID", id);
List<ApiClientSvcInstRela> apiClientSvcInstRelaList = apiClientSvcInstRelaDao.getList(map);
Map<String, Object> map1 = new HashMap<String, Object>();
map1.put("svc_client_id", id);
List<ApiSvcVersion> apiSvcVersionList = apiSvcVersionDao.getListByClientId(map1);
// 根据 CLIENT_ID判断【 前端秘钥】是否使用
if (null == apiClientSvcInstRelaList || apiClientSvcInstRelaList.size() == 0) {
// 根据 CLIENT_ID判断【 后端秘钥】是否使用
if (null == apiSvcVersionList || apiSvcVersionList.size() == 0) {
apiClientDefineDao.delete(apiClientDefine);
} else {
ArrayList<String> arrayList = new ArrayList<>();
for (ApiSvcVersion apiVer : apiSvcVersionList) {
arrayList.add(apiVer.getDisplayName());
}
for (ApiSvcVersion apiVer : apiSvcVersionList) {
throw new RuntimeException("该密钥已被版本" + arrayList + "使用!请解绑后再尝试删除。");
}
}
} else {
throw new RuntimeException("该密钥已绑定服务实例,请执行解绑操作后再尝试删除!");
}
}
//重置密钥对
public void resetSecretKey(String id){
ApiClientDefine apiClientDefine = apiClientDefineDao.findById(id);
String clientType = apiClientDefine.getClientType();
String clientSecret = GuidGenerator.generate();
String clientKey = apiClientDefine.getClientKey();
RedisSerializer stringSerializer = new StringRedisSerializer();
redisTemplate.setKeySerializer(stringSerializer);
redisTemplate.setValueSerializer(stringSerializer);
if("DEV".equals(clientType)){
Map<String,Object> map = new HashMap<String,Object>();
map.put("CLIENT_ID", id);
String ownerId = apiClientDefine.getOwner();
String ownerName = this.userDao.get(ownerId).getLoginName();
List<ApiClientSvcInstRela> apiClientSvcInstRelaList = apiClientSvcInstRelaDao.getList(map);
if(apiClientSvcInstRelaList != null &&apiClientSvcInstRelaList.size()>0){
for (ApiClientSvcInstRela apiClientSvcInstRela : apiClientSvcInstRelaList) {
String versionId = apiClientSvcInstRela.getVersionId();
String redisValue = redisTemplate.opsForValue().get(RedisCachePrefix.getFrtKey(clientKey, versionId));
String[] split = redisValue.split(":");
redisValue =clientSecret+":"+split[1]+":"+split[2]+":"+ownerId+":"+ownerName;
redisTemplate.opsForValue().set(RedisCachePrefix.getFrtKey(clientKey, versionId), redisValue);
}
}
}else if("SVC".equals(clientType)){
String redisKey = clientKey;
String redisValue = clientSecret+":"+id;
// String redisValue = clientSecret+":"+id+":"+ownerId+":"+ownerName;
redisTemplate.opsForValue().set(RedisCachePrefix.getBckKey(redisKey),redisValue);
}
apiClientDefine.setClientSecret(clientSecret);
//apiClientDefine.setCreatedAt(new Date());
apiClientDefine.setUpdatedAt(new Date());
apiClientDefineDao.save(apiClientDefine);
} @Override
public List<ApiClientDefine> getAllSecretKeys(String vdcId){
Map<String,Object> params = new HashMap<String,Object>();
params.put("owner",vdcId);
List<ApiClientDefine> apiClientDefines=apiClientDefineDao.getapiClientDefine(params);
return apiClientDefines;
}
//获取当前用户下的所有密钥对(后端密钥)
public Page<ApiClientDefine> getBackEndApiClientDefineList(Page<ApiClientDefine> page,String desc,String vdcId){
Map<String,Object> map = new HashMap<String,Object>();
map.put("CLIENT_TYPE", "SVC");
map.put("OWNER", vdcId);
map.put("IS_DELETED", false);
if(desc!=null&&desc.trim()!=""){
map.put("DESCRIPTION", desc);
}
Page<ApiClientDefine> apiClientDefinePage = apiClientDefineDao.getList(page, map);
return apiClientDefinePage;
}
}

未完待续……

IOP知识点(1)的更多相关文章

  1. IOP知识点(5)

    1 检验规则 取“或”   2 IOP升级中心 2 IOP升级中心 http://10.110.17.12:8080/cloud-ops/#/environment/     admin 我修改了io ...

  2. IOP知识点(4)

    1.选择多个“li”后,如何再次筛选. 2 按钮屏蔽功能 1.选择多个“li”后,如何再次筛选. 2 按钮屏蔽功能 http://gitserver/iop/cloud-iopm-web/issues ...

  3. IOP知识点(3)-Modal.show

    1.position 模态框初始位置.可设为字符串 "左位置 上位置" 或数组 [左位置, 上位置],规则如下: 左位置 可设为 left|center|right 三者之一,上位 ...

  4. IOP知识点(2)

    1   URL资源访问不足时,需要添加URL权限 2   重定向问题解决办法:3  cloud-service-factory 项目 gradlew方法 1   URL资源访问不足时,需要添加URL权 ...

  5. ASP.NET Core 中的那些认证中间件及一些重要知识点

    前言 在读这篇文章之间,建议先看一下我的 ASP.NET Core 之 Identity 入门系列(一,二,三)奠定一下基础. 有关于 Authentication 的知识太广,所以本篇介绍几个在 A ...

  6. ASP.NET MVC开发:Web项目开发必备知识点

    最近加班加点完成一个Web项目,使用Asp.net MVC开发.很久以前接触的Asp.net开发还是Aspx形式,什么Razor引擎,什么MVC还是这次开发才明白,可以算是新手. 对新手而言,那进行A ...

  7. UWP开发必备以及常用知识点总结

    一直在学UWP,一直在写Code,自己到达了什么水平?还有多少东西需要学习才能独挡一面?我想对刚接触UWP的开发者都有这种困惑,偶尔停下来总结分析一下还是很有收获的! 以下内容是自己开发中经常遇到的一 ...

  8. C#高级知识点&(ABP框架理论学习高级篇)——白金版

    前言摘要 很早以前就有要写ABP高级系列教程的计划了,但是迟迟到现在这个高级理论系列才和大家见面.其实这篇博客很早就着手写了,只是楼主一直写写停停.看看下图,就知道这篇博客的生产日期了,谁知它的出厂日 ...

  9. lucene 基础知识点

    部分知识点的梳理,参考<lucene实战>及网络资料 1.基本概念 lucence 可以认为分为两大组件: 1)索引组件 a.内容获取:即将原始的内容材料,可以是数据库.网站(爬虫).文本 ...

随机推荐

  1. Vue----目录结构

    目录结构: (1):build:---------------------------------------------------------------------------------:保存 ...

  2. 常用Common集合

    Log using System; using System.IO; using System.Linq; using System.Text; namespace Common { public c ...

  3. js callback 和 js 混淆

    function test(a,callback){ a+=100; callback(a) } function abc(a){ a+=100; alert(a); } test(5,abc) js ...

  4. myEclipse中项目无法部署到tomcat

    问题现象: 从svn上新下载了项目到win环境上. 部署项目的时候,在servers视图里,Add Deployment,如下图: 发现只有一个项目可以加载,另外的项目看不到:可是明明我并没有部署过啊 ...

  5. win10屏幕变灰怎么解决?

    朋友们在使用电脑过程中最高频使用的快捷键可能就是ctrl+c, ctrl+v了,但是殊不知,有时候按的太快产生误触,触发了ctrl+win+c,是屏幕变成了灰色,只需要再次同时按下这三个键就可以恢复彩 ...

  6. [No000014E]提问的智慧How To Ask Questions The Smart Way

    原文版本历史 目录 声明 简介 在提问之前 当你提问时 慎选提问的论坛 Stack Overflow 网站和 IRC 论坛 第二步,使用项目邮件列表 使用有意义且描述明确的标题 使问题容易回复 用清晰 ...

  7. debootstrap 配置

    在主机sudo su 切换到root mount proc jessie/proc -t proc mount sysfs jessie/sys -t sysfs chroot jessie /bin ...

  8. An optimizer that trains as fast as Adam and as good as SGD. https://www.luolc.com/publications/ad…

    设立3个指针pa.pb和pc,其中pa和pb分别指向La表和Lb表中当前待比较插入的结点,而pc指向Lc表中当前最后一个结点:若pa->data<=pb->data,则将pa所指结点 ...

  9. iOS之WKWebView加载的网页自适应大小

    一,前言 有时候在WKWebView加载页面后会发现页面的字会很小, 这是因为原网页没有做手机屏幕尺寸的适配, 那么在后台不做调整的情况下我们移动端怎样来适配页面呢? 以下代码可以适配大小(原本不可以 ...

  10. 转:jsp内置对象中page与pageContext与el内置对象pageScope与pageContext区别

    原文地址:jsp内置对象中page与pageContext与el内置对象pageScope与pageContext区别 首先说明一下jsp9大内置对象 (1)HttpSession类的session对 ...