up
This commit is contained in:
@@ -6,12 +6,12 @@
|
||||
<parent>
|
||||
<groupId>com.ecep.contract</groupId>
|
||||
<artifactId>Contract-Manager</artifactId>
|
||||
<version>0.0.134-SNAPSHOT</version>
|
||||
<version>0.0.135-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.ecep.contract</groupId>
|
||||
<artifactId>common</artifactId>
|
||||
<version>0.0.134-SNAPSHOT</version>
|
||||
<version>0.0.135-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
|
||||
@@ -1,27 +1,14 @@
|
||||
package com.ecep.contract.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.ecep.contract.util.HibernateProxyUtils;
|
||||
import com.ecep.contract.vo.EmployeeRoleVo;
|
||||
import com.ecep.contract.vo.FunctionVo;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import jakarta.persistence.CascadeType;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.JoinTable;
|
||||
import jakarta.persistence.ManyToMany;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@jakarta.persistence.Entity
|
||||
@@ -56,12 +43,12 @@ public class EmployeeRole implements IdentityEntity, NamedEntity, Voable<Employe
|
||||
@Column(name = "IS_ACTIVE")
|
||||
private boolean active = true;
|
||||
|
||||
@ManyToMany(fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
|
||||
@ManyToMany(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
|
||||
@JoinTable(name = "EMPLOYEE_ROLE_FUNCTIONS", joinColumns = @JoinColumn(name = "ROLE_ID"), inverseJoinColumns = @JoinColumn(name = "FUNC_ID"))
|
||||
@JsonIgnore
|
||||
private java.util.List<Function> functions = new java.util.ArrayList<>();
|
||||
|
||||
@ManyToMany(fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
|
||||
@ManyToMany(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
|
||||
@JoinTable(name = "EMPLOYEE_ROLES", joinColumns = @JoinColumn(name = "ROLE_ID"), inverseJoinColumns = @JoinColumn(name = "EMPLOYEE_ID"))
|
||||
@JsonIgnore
|
||||
private java.util.List<Employee> employees = new java.util.ArrayList<>();
|
||||
@@ -93,22 +80,6 @@ public class EmployeeRole implements IdentityEntity, NamedEntity, Voable<Employe
|
||||
vo.setSystemAdministrator(isSystemAdministrator());
|
||||
vo.setManager(isManager());
|
||||
vo.setActive(isActive());
|
||||
|
||||
// 转换functions列表
|
||||
if (getFunctions() != null && !getFunctions().isEmpty()) {
|
||||
List<FunctionVo> functionVos = new ArrayList<>();
|
||||
for (Function function : getFunctions()) {
|
||||
if (function != null) {
|
||||
FunctionVo functionVo = new FunctionVo();
|
||||
functionVo.setId(function.getId());
|
||||
functionVo.setName(function.getName());
|
||||
functionVo.setKey(function.getKey());
|
||||
functionVos.add(functionVo);
|
||||
}
|
||||
}
|
||||
vo.setFunctions(functionVos);
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class HttpJsonUtils {
|
||||
public static void post(String url,
|
||||
public static void post(String url, Map<String, String> headers,
|
||||
Consumer<Map<String, Object>> data,
|
||||
Consumer<JsonNode> consumer,
|
||||
ObjectMapper objectMapper, Proxy proxy) throws IOException {
|
||||
@@ -24,6 +24,10 @@ public class HttpJsonUtils {
|
||||
conn.usingProxy();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setRequestProperty("Content-Type", "application/json");
|
||||
if (headers != null) {
|
||||
headers.forEach(conn::setRequestProperty);
|
||||
}
|
||||
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
PrintWriter writer = new PrintWriter(conn.getOutputStream());
|
||||
@@ -37,12 +41,16 @@ public class HttpJsonUtils {
|
||||
|
||||
}
|
||||
|
||||
public static void get(String url, Consumer<JsonNode> consumer, ObjectMapper objectMapper, Proxy proxy) throws IOException {
|
||||
public static void get(String url, Map<String, String> headers,
|
||||
Consumer<JsonNode> consumer, ObjectMapper objectMapper, Proxy proxy) throws IOException {
|
||||
URI uri = URI.create(url);
|
||||
HttpURLConnection conn = (HttpURLConnection) (proxy == null ? uri.toURL().openConnection() : uri.toURL().openConnection(proxy));
|
||||
conn.setRequestMethod("GET");
|
||||
conn.setRequestProperty("Accept", "application/json, text/plain, */*");
|
||||
conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36");
|
||||
if (headers != null) {
|
||||
headers.forEach(conn::setRequestProperty);
|
||||
}
|
||||
try (InputStream is = conn.getInputStream()) {
|
||||
JsonNode json = objectMapper.readTree(is);
|
||||
consumer.accept(json);
|
||||
|
||||
@@ -18,6 +18,7 @@ public class EmployeeRoleVo implements IdentityEntity, NamedEntity, Serializable
|
||||
private boolean manager = false;
|
||||
private boolean active = true;
|
||||
private String description;
|
||||
private List<FunctionVo> functions;
|
||||
// 角色功能通过功能列表查询
|
||||
// private List<FunctionVo> functions;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user