This commit is contained in:
MaxKey 2023-04-11 15:37:25 +08:00
parent 5ba0dddd3d
commit 43a8602a64
3 changed files with 321 additions and 43 deletions

View File

@ -1,19 +1,19 @@
/* /*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top] * Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.maxkey.entity; package org.maxkey.entity;
@ -27,9 +27,6 @@ import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import lombok.Getter;
import lombok.Setter;
import org.apache.mybatis.jpa.persistence.JpaBaseEntity; import org.apache.mybatis.jpa.persistence.JpaBaseEntity;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
@ -46,13 +43,11 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
*/ */
@Entity @Entity
@Table(name = "MXK_ACCOUNTS") @Table(name = "MXK_ACCOUNTS")
@Setter
@Getter
public class Accounts extends JpaBaseEntity implements Serializable { public class Accounts extends JpaBaseEntity implements Serializable {
private static final long serialVersionUID = 6829592256223630307L; private static final long serialVersionUID = 6829592256223630307L;
public static final String DEFAULT_PASSWORD_SUFFIX = UserInfo.DEFAULT_PASSWORD_SUFFIX; public static final String DEFAULT_PASSWORD_SUFFIX = UserInfo.DEFAULT_PASSWORD_SUFFIX;
@Id @Id
@Column @Column
@GeneratedValue(strategy = GenerationType.AUTO, generator = "snowflakeid") @GeneratedValue(strategy = GenerationType.AUTO, generator = "snowflakeid")
@ -81,16 +76,16 @@ public class Accounts extends JpaBaseEntity implements Serializable {
private String strategyName; private String strategyName;
@Column @Column
private int status; private int status;
@Column @Column
private String instId; private String instId;
private String instName; private String instName;
UserInfo userInfo; UserInfo userInfo;
@JsonIgnore @JsonIgnore
private HashMap<String, OrganizationsCast> orgCast = new HashMap<String, OrganizationsCast>(); private HashMap<String,OrganizationsCast> orgCast =new HashMap<String,OrganizationsCast>();
public Accounts() { public Accounts() {
super(); super();
@ -111,13 +106,144 @@ public class Accounts extends JpaBaseEntity implements Serializable {
this.relatedPassword = password; this.relatedPassword = password;
} }
public void setOrgCast(List<OrganizationsCast> listOrgCast) { public String getUserId() {
for (OrganizationsCast cast : listOrgCast) { return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public String getRelatedUsername() {
return relatedUsername;
}
public void setRelatedUsername(String relatedUsername) {
this.relatedUsername = relatedUsername;
}
public String getRelatedPassword() {
return relatedPassword;
}
public void setRelatedPassword(String relatedPassword) {
this.relatedPassword = relatedPassword;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public UserInfo getUserInfo() {
return userInfo;
}
public void setUserInfo(UserInfo userInfo) {
this.userInfo = userInfo;
}
public String getCreateType() {
return createType;
}
public void setCreateType(String createType) {
this.createType = createType;
}
public String getStrategyId() {
return strategyId;
}
public void setStrategyId(String strategyId) {
this.strategyId = strategyId;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public HashMap<String, OrganizationsCast> getOrgCast() {
return orgCast;
}
public void setOrgCast(HashMap<String, OrganizationsCast> orgCast) {
this.orgCast = orgCast;
}
public void setOrgCast(List <OrganizationsCast> listOrgCast) {
for(OrganizationsCast cast : listOrgCast) {
this.orgCast.put(cast.getProvider(), cast); this.orgCast.put(cast.getProvider(), cast);
} }
} }
@Override public String getStrategyName() {
return strategyName;
}
public void setStrategyName(String strategyName) {
this.strategyName = strategyName;
}
public String getInstId() {
return instId;
}
public void setInstId(String instId) {
this.instId = instId;
}
public String getInstName() {
return instName;
}
public void setInstName(String instName) {
this.instName = instName;
}
@Override
public String toString() { public String toString() {
return "AppAccounts [uid=" + userId + ", username=" + username + ", displayName=" + displayName + ", appId=" return "AppAccounts [uid=" + userId + ", username=" + username + ", displayName=" + displayName + ", appId="
+ appId + ", appName=" + appName + ", relatedUsername=" + relatedUsername + ", relatedPassword=" + appId + ", appName=" + appName + ", relatedUsername=" + relatedUsername + ", relatedPassword="

View File

@ -1,19 +1,19 @@
/* /*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top] * Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.maxkey.entity; package org.maxkey.entity;
@ -26,24 +26,19 @@ import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import lombok.Getter;
import lombok.Setter;
import org.apache.mybatis.jpa.persistence.JpaBaseEntity; import org.apache.mybatis.jpa.persistence.JpaBaseEntity;
@Entity @Entity
@Table(name = "MXK_ACCOUNTS_STRATEGY") @Table(name = "MXK_ACCOUNTS_STRATEGY")
@Setter
@Getter
public class AccountsStrategy extends JpaBaseEntity implements Serializable { public class AccountsStrategy extends JpaBaseEntity implements Serializable {
/** /**
* *
*/ */
private static final long serialVersionUID = -8743329570694948718L; private static final long serialVersionUID = -8743329570694948718L;
@Id @Id
@Column @Column
@GeneratedValue(strategy = GenerationType.AUTO, generator = "snowflakeid") @GeneratedValue(strategy = GenerationType.AUTO,generator = "snowflakeid")
private String id; private String id;
@Column @Column
private String name; private String name;
@ -56,7 +51,7 @@ public class AccountsStrategy extends JpaBaseEntity implements Serializable {
@Column @Column
private String mapping; private String mapping;
@Column @Column
String filters; String filters ;
@Column @Column
String orgIdsList; String orgIdsList;
@Column @Column
@ -75,26 +70,178 @@ public class AccountsStrategy extends JpaBaseEntity implements Serializable {
String modifiedBy; String modifiedBy;
@Column @Column
String modifiedDate; String modifiedDate;
@Column @Column
private String instId; private String instId;
private String instName; private String instName;
public AccountsStrategy() { public AccountsStrategy() {
super(); super();
} }
public String getId() {
public void transIconBase64() { return id;
if (this.appIcon != null) {
this.appIconBase64 = "data:image/png;base64," +
Base64.getEncoder().encodeToString(appIcon);
}
} }
public void setId(String id) {
this.id = id;
}
@Override public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public String getCreatedDate() {
return createdDate;
}
public void setCreatedDate(String createdDate) {
this.createdDate = createdDate;
}
public String getModifiedBy() {
return modifiedBy;
}
public void setModifiedBy(String modifiedBy) {
this.modifiedBy = modifiedBy;
}
public String getModifiedDate() {
return modifiedDate;
}
public void setModifiedDate(String modifiedDate) {
this.modifiedDate = modifiedDate;
}
public String getFilters() {
return filters;
}
public void setFilters(String filters) {
this.filters = filters;
}
public String getOrgIdsList() {
return orgIdsList;
}
public void setOrgIdsList(String orgIdsList) {
this.orgIdsList = orgIdsList;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public String getMapping() {
return mapping;
}
public void setMapping(String mapping) {
this.mapping = mapping;
}
public byte[] getAppIcon() {
return appIcon;
}
public String getAppIconBase64() {
return appIconBase64;
}
public void setAppIconBase64(String appIconBase64) {
this.appIconBase64 = appIconBase64;
}
public void setAppIcon(byte[] appIcon) {
this.appIcon = appIcon;
}
public String getCreateType() {
return createType;
}
public void setCreateType(String createType) {
this.createType = createType;
}
public String getSuffixes() {
return suffixes;
}
public void setSuffixes(String suffixes) {
this.suffixes = suffixes;
}
public String getInstId() {
return instId;
}
public void setInstId(String instId) {
this.instId = instId;
}
public String getInstName() {
return instName;
}
public void setInstName(String instName) {
this.instName = instName;
}
public void transIconBase64() {
if(this.appIcon !=null) {
this.appIconBase64 = "data:image/png;base64," +
Base64.getEncoder().encodeToString(appIcon);
}
}
@Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append("AccountsStrategy [id="); builder.append("AccountsStrategy [id=");
@ -126,5 +273,7 @@ public class AccountsStrategy extends JpaBaseEntity implements Serializable {
builder.append("]"); builder.append("]");
return builder.toString(); return builder.toString();
} }
} }

View File

@ -41,7 +41,8 @@ public class ConfigurerFreeMarker implements ApplicationContextAware {
ApplicationContext applicationContext ; ApplicationContext applicationContext ;
@Autowired @Autowired
Configuration configuration; Configuration configuration;
@PostConstruct // 在项目启动时执行方法 @PostConstruct // 在项目启动时执行方法
public void setSharedVariable() throws IOException, TemplateException { public void setSharedVariable() throws IOException, TemplateException {
@ -51,11 +52,13 @@ public class ConfigurerFreeMarker implements ApplicationContextAware {
configuration.setSharedVariable(key, map.get(key)); configuration.setSharedVariable(key, map.get(key));
_logger.trace("FreeMarker Template "+key); _logger.trace("FreeMarker Template "+key);
} }
} }
@Override @Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext; this.applicationContext = applicationContext;
} }
} }