mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-08 18:36:51 +08:00
增加一个用户机构一次运行的同步的程序
This commit is contained in:
169
servers/org-user-sync/pom.xml
Normal file
169
servers/org-user-sync/pom.xml
Normal file
@@ -0,0 +1,169 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.6.3</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.xboe</groupId>
|
||||
<artifactId>org-user-sync</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<name>org-user-sync</name>
|
||||
<description>用户机构的数据同步</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.xboe</groupId>
|
||||
<artifactId>xboe-core</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<!-- java-jwt -->
|
||||
<dependency>
|
||||
<groupId>com.auth0</groupId>
|
||||
<artifactId>java-jwt</artifactId>
|
||||
<version>3.18.3</version>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.bitbucket.b_c</groupId>
|
||||
<artifactId>jose4j</artifactId>
|
||||
<version>0.7.9</version>
|
||||
</dependency>
|
||||
-->
|
||||
<!-- apache commons -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-actuator</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.session</groupId>
|
||||
<artifactId>spring-session-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.27</version>
|
||||
<!-- <scope>runtime</scope> -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!--加密配置文件-->
|
||||
<dependency>
|
||||
<groupId>com.github.ulisesbocchio</groupId>
|
||||
<artifactId>jasypt-spring-boot-starter</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<filtering>true</filtering>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>application-${profileActive}.properties</include>
|
||||
<include>application.properties</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<filtering>false</filtering>
|
||||
<directory>src/main/resources</directory>
|
||||
<excludes>
|
||||
<exclude>*.properties</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>pro</id>
|
||||
<properties>
|
||||
<profileActive>pro</profileActive>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>pre</id>
|
||||
<properties>
|
||||
<profileActive>pre</profileActive>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>test</id>
|
||||
<properties>
|
||||
<profileActive>test</profileActive>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>dev</id>
|
||||
<properties>
|
||||
<profileActive>dev</profileActive>
|
||||
</properties>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.xboe;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@SpringBootApplication
|
||||
@EnableCaching
|
||||
public class BoeBasicApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.setProperty("jasypt.encryptor.password","jasypt");
|
||||
SpringApplication.run(BoeBasicApplication.class, args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.xboe;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
|
||||
/**
|
||||
* 返回的数据中如果是null 就会转化成空字符串
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class ResultNullToEmptyConfig {
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
@ConditionalOnMissingBean(ObjectMapper.class)
|
||||
public ObjectMapper jacksonObjectMapper(Jackson2ObjectMapperBuilder builder) {
|
||||
ObjectMapper objectMapper = builder.createXmlMapper(false).build();
|
||||
objectMapper.getSerializerProvider().setNullValueSerializer(new JsonSerializer<Object>() {
|
||||
@Override
|
||||
public void serialize(Object o, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
|
||||
throws IOException, JsonProcessingException {
|
||||
jsonGenerator.writeString("");
|
||||
}
|
||||
});
|
||||
return objectMapper;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.xboe.basic.dao;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.xboe.basic.entity.Account;
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
|
||||
/**
|
||||
* 账号信息DAO
|
||||
*/
|
||||
@Repository
|
||||
public class AccountDao extends BaseDao<Account> {
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.xboe.basic.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.xboe.basic.entity.Organization;
|
||||
|
||||
@Repository
|
||||
public interface BasicOrganizationDao extends JpaRepository<Organization,String>{
|
||||
|
||||
@Query(value = "from Organization where kid=?1")
|
||||
public List<Organization> getByKid(String id);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.xboe.basic.dao;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.xboe.basic.entity.ErrorLog;
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
|
||||
@Repository
|
||||
public class ErrorLogDao extends BaseDao<ErrorLog>{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.xboe.basic.dao;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.xboe.basic.entity.OrgTree;
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
|
||||
@Repository
|
||||
public class OrgTreeDao extends BaseDao<OrgTree> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.xboe.basic.dao;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.xboe.basic.entity.Organization;
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
|
||||
@Repository
|
||||
public class OrganizationDao extends BaseDao<Organization> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.xboe.basic.dao;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.xboe.basic.entity.Person;
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
|
||||
@Repository
|
||||
public class PersonDao extends BaseDao<Person>{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.xboe.basic.dao;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.xboe.basic.entity.User;
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
|
||||
@Repository
|
||||
public class UserDao extends BaseDao<User> {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.xboe.basic.dao;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.xboe.basic.entity.ViewUser;
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
|
||||
//@Repository
|
||||
public class ViewUserDao extends BaseDao<ViewUser> {
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.xboe.basic.entity;
|
||||
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.IdEntity;
|
||||
import com.xboe.core.orm.annotation.MetaInfo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 账号表,只是记录登录的账号信息,无任务业务实名类的信息
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Entity
|
||||
@Table(name = SysConstant.TABLE_PRE + "account")
|
||||
public class Account extends IdEntity{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**0 临时数据*/
|
||||
public static final int STATUS_TEMPORARY=0;
|
||||
|
||||
/**1 正常数据*/
|
||||
public static final int STATUS_NORMAL=1;
|
||||
|
||||
/**2 停用数据*/
|
||||
public static final int STATUS_DEAD=2;
|
||||
|
||||
@MetaInfo("人员id")
|
||||
@Column(name = "person_id", length = 36)
|
||||
private String personId;
|
||||
|
||||
@MetaInfo("登录名")
|
||||
@Column(name = "login_name", nullable = true, length = 30)
|
||||
private String loginName;
|
||||
|
||||
@MetaInfo("用户头像地址")
|
||||
@Column(name = "avatar", nullable = true, length = 100)
|
||||
private String avatar;
|
||||
|
||||
@MetaInfo("手机号")
|
||||
@Column(name = "mobile", length = 11)
|
||||
private String mobile;
|
||||
|
||||
@Column(name = "email", length = 100)
|
||||
private String email;
|
||||
|
||||
@Column(name = "nick_name", length = 20)
|
||||
private String nickName;
|
||||
|
||||
@Column(name = "pass_key", length = 6)
|
||||
private String passKey;
|
||||
|
||||
@Column(name = "pass_value", length = 32)
|
||||
private String passValue;
|
||||
|
||||
@Column(name = "reg_time" )
|
||||
private LocalDateTime regTime;
|
||||
|
||||
@MetaInfo("语言")
|
||||
@Column(name = "language",length=30)
|
||||
private String language;
|
||||
|
||||
/**
|
||||
* 0临时,1 正常,2停用
|
||||
*/
|
||||
@Column(name = "status", length = 1)
|
||||
private Integer status;
|
||||
|
||||
@Column(name = "deleted", length = 1)
|
||||
private Boolean deleted;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.xboe.basic.entity;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.IdEntity;
|
||||
import com.xboe.core.orm.annotation.MetaInfo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Entity
|
||||
@Table(name = SysConstant.TABLE_PRE + "log_error")
|
||||
public class ErrorLog extends IdEntity{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@MetaInfo("日志时间")
|
||||
@Column(name = "log_time" )
|
||||
private LocalDateTime logTime;
|
||||
|
||||
@MetaInfo("日志对象")
|
||||
@Column(name = "log_object", columnDefinition = "text")
|
||||
private String logObject;
|
||||
|
||||
@MetaInfo("日志错误内容")
|
||||
@Column(name = "log_error", length=500)
|
||||
private String logError;
|
||||
|
||||
@MetaInfo("数据的id")
|
||||
@Column(name = "data_id", length=36)
|
||||
private String dataId;
|
||||
|
||||
@MetaInfo("生成的新的id")
|
||||
@Column(name = "new_id", length=36)
|
||||
private String newId;
|
||||
|
||||
@MetaInfo("数据类型,1表同步机构,2表同步用户,3表删除机构,4表删除用户")
|
||||
@Column(name = "data_type", length=1)
|
||||
private Integer dataType;
|
||||
|
||||
@Column(name = "error_type", length=1)
|
||||
private Integer type;//1是同步,2是内部同步
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.xboe.basic.entity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.IdEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@Entity
|
||||
@Table(name = SysConstant.TABLE_PRE+"org_tree")
|
||||
public class OrgTree extends IdEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 机构id
|
||||
* */
|
||||
@Column(name = "org_id",length = 20)
|
||||
private String orgId;
|
||||
|
||||
/**
|
||||
* 上级id
|
||||
* */
|
||||
@Column(name = "parent_id",length = 36)
|
||||
private String parentId;
|
||||
|
||||
/**
|
||||
* 原系统的上级id
|
||||
*/
|
||||
@Column(name = "old_parent_id",length = 36)
|
||||
private String oldParentId;
|
||||
|
||||
/**
|
||||
* 体系标识
|
||||
* */
|
||||
@Column(name = "tree_type",length = 20)
|
||||
private String treeType;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
* */
|
||||
@Column(name = "remark",length = 200)
|
||||
private String remark;
|
||||
|
||||
/**机构的路径,下次更新应该加上*/
|
||||
@Column(name = "name_path",length = 200)
|
||||
private String namePath;
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.xboe.basic.entity;
|
||||
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 机构实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Entity
|
||||
@Table(name = SysConstant.TABLE_PRE + "organization")
|
||||
public class Organization extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 原系统ID
|
||||
*/
|
||||
@Column(name = "kid", length = 36)
|
||||
private String kid;
|
||||
|
||||
/**
|
||||
* 组织部门代码
|
||||
*/
|
||||
@Column(name = "code", length = 50)
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 组织名
|
||||
*/
|
||||
@Column(name = "name", nullable = false, length = 100)
|
||||
private String name;
|
||||
|
||||
|
||||
/**
|
||||
* 路径,不用每次都去计算了,用默认tree的
|
||||
*/
|
||||
@Column(name = "name_path", length = 300)
|
||||
private String namePath;
|
||||
|
||||
/**
|
||||
* 机构名称简称
|
||||
*/
|
||||
@Column(name = "short_name",length = 30)
|
||||
private String shortName;
|
||||
|
||||
/**
|
||||
* 多租户下的id,此机构属于哪个sass用户
|
||||
*/
|
||||
@Column(name = "sass_id",length = 36)
|
||||
private String sassId;
|
||||
|
||||
/**
|
||||
* 系统级别
|
||||
*/
|
||||
@Column(name = "sys_level",length = 2)
|
||||
private Integer sysLevel;
|
||||
|
||||
/**
|
||||
* 是否是默认注册组织机构
|
||||
*/
|
||||
@Column(name = "is_default",length = 1)
|
||||
private Boolean isDefault;
|
||||
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Column(name = "description", columnDefinition = "text")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 数据来源
|
||||
*/
|
||||
@Column(name = "data_from", length = 100)
|
||||
private String dataFrom;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
// @Column(name = "create_time", length = 36)
|
||||
// private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 创建来源
|
||||
*/
|
||||
@Column(name = "create_from", length = 100)
|
||||
private String createFrom;
|
||||
|
||||
/**
|
||||
* 组织级别
|
||||
*/
|
||||
@Column(name = "organization_level", length = 50)
|
||||
private String organizationLevel;
|
||||
|
||||
/**
|
||||
* 是否制造组织
|
||||
*/
|
||||
@Column(name = "is_make_org", length = 1)
|
||||
private Boolean isMakeOrg;
|
||||
|
||||
/**
|
||||
* 是否服务现地
|
||||
*/
|
||||
@Column(name = "is_service_site", length = 1)
|
||||
private Boolean isServiceSite;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
* 0:临时,1:正常,2:停用
|
||||
*/
|
||||
@Column(name = "status", nullable = false, length = 1)
|
||||
private Integer status;
|
||||
|
||||
@Column(name = "remark", length = 200)
|
||||
private String remark;
|
||||
|
||||
// @Column(name = "deleted")
|
||||
// private Boolean deleted;
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.xboe.basic.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.IdEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@Entity
|
||||
@Table(name = SysConstant.TABLE_PRE+"person")
|
||||
public class Person extends IdEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**临时数据*/
|
||||
public static final int STATUS_TEMPORARY=0;
|
||||
|
||||
/**正常数据*/
|
||||
public static final int STATUS_NORMAL=1;
|
||||
|
||||
/**死数据*/
|
||||
public static final int STATUS_DEAD=4;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
* */
|
||||
@Column(name = "name",length = 100)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
* */
|
||||
@Column(name = "gender",length = 1)
|
||||
private Integer gender;
|
||||
|
||||
/**
|
||||
* 出生日期
|
||||
* */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Column(name = "birthday")
|
||||
private LocalDateTime birthday;
|
||||
|
||||
/**
|
||||
* 证件类型
|
||||
* */
|
||||
@Column(name = "id_type")
|
||||
private String idType;
|
||||
|
||||
/**
|
||||
* 证件号码
|
||||
* */
|
||||
@Column(name = "id_number",length = 18)
|
||||
private String idNumber;
|
||||
|
||||
/**
|
||||
* 家庭电话
|
||||
*/
|
||||
@Column(name = "home_phone_no", length = 50)
|
||||
private String homePhoneNo;
|
||||
|
||||
/**
|
||||
* 国籍
|
||||
*/
|
||||
@Column(name = "nationality", length = 50)
|
||||
private String nationality;
|
||||
|
||||
|
||||
/**
|
||||
* 民族
|
||||
* */
|
||||
@Column(name = "nation")
|
||||
private String nation;
|
||||
|
||||
/**
|
||||
* 毕业院校
|
||||
*/
|
||||
@Column(name = "graduated_from", length = 50)
|
||||
private String graduatedFrom;
|
||||
|
||||
/**
|
||||
* 毕业专业
|
||||
*/
|
||||
@Column(name = "graduated_major", length = 50)
|
||||
private String graduatedMajor;
|
||||
|
||||
/**
|
||||
* 最高学历
|
||||
*/
|
||||
@Column(name = "highest_education", length = 50)
|
||||
private String highestEducation;
|
||||
|
||||
/**
|
||||
* 数据来源说明
|
||||
* */
|
||||
@Column(name = "data_from",length = 500)
|
||||
private String dataFrom;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
* 0表临时,1表正常。。。4表已删除
|
||||
* */
|
||||
@Column(name = "status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
*备注
|
||||
* */
|
||||
@Column(name = "remark")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
package com.xboe.basic.entity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.IdEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 用户信息表
|
||||
* 存储所有的用户信息,原表中的部分信息
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Entity
|
||||
@Table(name = SysConstant.TABLE_PRE + "user")
|
||||
public class User extends IdEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 人员基本信息id
|
||||
*/
|
||||
@Column(name = "person_id", length = 19)
|
||||
private String personId;
|
||||
|
||||
/**
|
||||
* 原系统的kid
|
||||
*/
|
||||
@Column(name = "kid", length = 36)
|
||||
private String kid;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Column(name = "mobile", length = 30)
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 默认的组织机构体系
|
||||
*/
|
||||
@Column(name = "org_tree_type", length = 19)
|
||||
private String orgTreeType;
|
||||
|
||||
|
||||
@Column(name = "old_enterprise_id", length = 36)
|
||||
private String oldEnterpriseId;
|
||||
|
||||
/**
|
||||
* 旧系统机构id
|
||||
*/
|
||||
@Column(name = "old_depart_id", length = 36)
|
||||
private String oldDepartId;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Column(name = "name", length = 30)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 员工编号
|
||||
*/
|
||||
@Column(name = "user_no", length = 30)
|
||||
private String userNo;
|
||||
|
||||
/**
|
||||
* 所在公司
|
||||
*/
|
||||
@Column(name = "enterprise_id", length = 36)
|
||||
private String enterpriseId;
|
||||
|
||||
/**级别代码*/
|
||||
@Column(name = "band_code", length = 20)
|
||||
private String bandCode;
|
||||
|
||||
/**级别描述*/
|
||||
@Column(name = "band_desc", length = 200)
|
||||
private String bandDesc;
|
||||
|
||||
/**
|
||||
* 发薪地id
|
||||
*/
|
||||
@Column(name = "payroll_place_id",length=36)
|
||||
private String payrollPlaceId;
|
||||
|
||||
/**
|
||||
* 发薪地名称
|
||||
*/
|
||||
@Column(name = "payroll_place_name",length=150)
|
||||
private String payrollPlaceName;
|
||||
|
||||
|
||||
/**
|
||||
* 管理序列职级
|
||||
*/
|
||||
@Column(name = "position_mgr_level", length = 150)
|
||||
private String positionMgrLevel;
|
||||
|
||||
/**
|
||||
* 所在部门
|
||||
*/
|
||||
@Column(name = "depart_id", length = 18)
|
||||
private String departId;
|
||||
|
||||
/**
|
||||
* 机构名称/分隔的全路径
|
||||
*/
|
||||
@Column(name = "org_name_path", length = 300)
|
||||
private String orgNamePath;
|
||||
|
||||
|
||||
/**
|
||||
* 所在域
|
||||
*/
|
||||
@Column(name = "domain_id", length = 36)
|
||||
private String domainId;
|
||||
|
||||
/**
|
||||
* 扩展字段,多租户系统的标识值,原系统的companyId
|
||||
*/
|
||||
@Column(name = "sass_id", length = 36)
|
||||
private String sassId;
|
||||
|
||||
|
||||
/**
|
||||
* 办公电话
|
||||
*/
|
||||
@Column(name = "telephone_no", length = 50)
|
||||
private String telephoneNo;
|
||||
|
||||
/**
|
||||
* 职务
|
||||
*/
|
||||
@Column(name = "duty", length = 50)
|
||||
private String duty;
|
||||
|
||||
/**
|
||||
* 职级
|
||||
*/
|
||||
@Column(name = "rank", length = 50)
|
||||
private String rank;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Column(name = "description")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* boe的时长,和系统时长单独保存
|
||||
*/
|
||||
@Column(name = "learning_Duration", length = 11)
|
||||
private Integer learningDuration;
|
||||
|
||||
/**
|
||||
* 在职状态,2在职,3是离职
|
||||
*/
|
||||
@Column(name = "employee_status", length = 1)
|
||||
private Integer employeeStatus;
|
||||
|
||||
/**
|
||||
* 0临时,1是正常,2是停用
|
||||
*/
|
||||
@Column(name = "status", length = 1)
|
||||
private Integer status;
|
||||
|
||||
@Column(name = "deleted")
|
||||
private Boolean deleted;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,358 @@
|
||||
package com.xboe.basic.entity;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.IdEntity;
|
||||
import com.xboe.core.orm.annotation.MetaInfo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 账户,人员,机构,用户的合表
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
//@Entity
|
||||
//@Table(name = SysConstant.TABLE_PRE + "view_user")
|
||||
public class ViewUser extends IdEntity{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@MetaInfo("原系统中的id")
|
||||
@Column(name = "sys_id", length = 36)
|
||||
private String sysId;
|
||||
|
||||
@MetaInfo("登录名")
|
||||
@Column(name = "login_name", nullable = true, length = 30)
|
||||
private String loginName;
|
||||
|
||||
@MetaInfo("用户头像地址")
|
||||
@Column(name = "avatar", nullable = true, length = 100)
|
||||
private String avatar;
|
||||
|
||||
@MetaInfo("手机号")
|
||||
@Column(name = "mobile", length = 11)
|
||||
private String mobile;
|
||||
|
||||
@Column(name = "email", length = 100)
|
||||
private String email;
|
||||
|
||||
@Column(name = "nick_name", length = 20)
|
||||
private String nickName;
|
||||
|
||||
@Column(name = "pass_key", length = 6)
|
||||
private String passKey;
|
||||
|
||||
@Column(name = "pass_value", length = 32)
|
||||
private String passValue;
|
||||
|
||||
@Column(name = "reg_time" )
|
||||
private LocalDateTime regTime;
|
||||
|
||||
@MetaInfo("关联的公司id")
|
||||
@Column(name = "company_id", length = 36)
|
||||
private String companyId;
|
||||
|
||||
// 状态1, 正常,2停用
|
||||
@Column(name = "status", length = 1)
|
||||
private Integer status;
|
||||
|
||||
@Column(name = "deleted", length = 1)
|
||||
private Boolean deleted;
|
||||
|
||||
/*
|
||||
* 旧系统父id
|
||||
*/
|
||||
@Column(name = "sys_parent_id", length = 36)
|
||||
private String sysParentId;
|
||||
|
||||
/**
|
||||
* 组织部门代码
|
||||
*/
|
||||
@Column(name = "code", nullable = false, length = 50)
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 组织名
|
||||
*/
|
||||
@Column(name = "org_name", nullable = false, length = 50)
|
||||
private String orgName;
|
||||
|
||||
/**
|
||||
* 组织全路径
|
||||
*/
|
||||
@Column(name = "name_path")
|
||||
private String namePath;
|
||||
|
||||
/**
|
||||
* 父组织部门ID
|
||||
*/
|
||||
@Column(name = "parent_id", length = 18)
|
||||
private String parentId;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Column(name = "description", columnDefinition = "text")
|
||||
private String description;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 域ID
|
||||
*/
|
||||
@Column(name = "domain_id", length = 36)
|
||||
private String domainId;
|
||||
|
||||
/**
|
||||
* 组织部门经理ID
|
||||
*/
|
||||
@Column(name = "orgnization_manager_id", length = 36)
|
||||
private String orgnizationManagerId;
|
||||
|
||||
/**
|
||||
* 组织级别
|
||||
*/
|
||||
@Column(name = "organization_level", length = 50)
|
||||
private String organizationLevel;
|
||||
|
||||
/**
|
||||
* 是否制造组织
|
||||
*/
|
||||
@Column(name = "is_make_org", length = 1)
|
||||
private Boolean isMakeOrg;
|
||||
|
||||
/**
|
||||
* 是否服务现地
|
||||
*/
|
||||
@Column(name = "is_service_site", length = 1)
|
||||
private Boolean isServiceSite;
|
||||
|
||||
/**
|
||||
* 是否默认注册组织
|
||||
*/
|
||||
@Column(name = "is_default_organization", length = 1)
|
||||
private Boolean isDefaultOrganization;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
* 0:临时,1:正常,2:停用
|
||||
*/
|
||||
@Column(name = "org_status", nullable = false, length = 1)
|
||||
private Integer orgStatus;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
* */
|
||||
@Column(name = "name",length = 100)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
* */
|
||||
@Column(name = "gender",length = 1)
|
||||
private Integer gender;
|
||||
|
||||
/**
|
||||
* 出生日期
|
||||
* */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Column(name = "birthday")
|
||||
private LocalDateTime birthday;
|
||||
|
||||
/**
|
||||
* 证件类型
|
||||
* */
|
||||
@Column(name = "id_type")
|
||||
private String idType;
|
||||
|
||||
/**
|
||||
* 证件号码
|
||||
* */
|
||||
@Column(name = "id_number",length = 18)
|
||||
private String idNumber;
|
||||
|
||||
/**
|
||||
* 家庭电话
|
||||
*/
|
||||
@Column(name = "home_phone_no", length = 50)
|
||||
private String homePhoneNo;
|
||||
|
||||
/**
|
||||
* 国籍
|
||||
*/
|
||||
@Column(name = "nationality", length = 50)
|
||||
private String nationality;
|
||||
|
||||
|
||||
/**
|
||||
* 民族
|
||||
* */
|
||||
@Column(name = "nation")
|
||||
private String nation;
|
||||
|
||||
/**
|
||||
* 毕业院校
|
||||
*/
|
||||
@Column(name = "graduated_from", length = 50)
|
||||
private String graduatedFrom;
|
||||
|
||||
/**
|
||||
* 毕业专业
|
||||
*/
|
||||
@Column(name = "graduated_major", length = 50)
|
||||
private String graduatedMajor;
|
||||
|
||||
/**
|
||||
* 最高学历
|
||||
*/
|
||||
@Column(name = "highest_education", length = 50)
|
||||
private String highestEducation;
|
||||
|
||||
/**
|
||||
* 数据来源说明
|
||||
* */
|
||||
@Column(name = "data_from",length = 500)
|
||||
private String dataFrom;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
* 0表临时,1表正常。。。9表不存在
|
||||
* */
|
||||
@Column(name = "user_status")
|
||||
private Integer userStatus;
|
||||
|
||||
/**
|
||||
*备注
|
||||
* */
|
||||
@Column(name = "remark")
|
||||
private String remark;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 旧系统机构id
|
||||
*/
|
||||
@Column(name = "sys_depart_id", length = 36)
|
||||
private String sysDepartId;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 员工编号
|
||||
*/
|
||||
@Column(name = "user_no", length = 30)
|
||||
private String userNo;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Column(name = "mobile_no", length = 11)
|
||||
private String mobileNo;
|
||||
|
||||
/**
|
||||
* 办公电话
|
||||
*/
|
||||
@Column(name = "telephone_no", length = 50)
|
||||
private String telephoneNo;
|
||||
|
||||
/**
|
||||
* 职务
|
||||
*/
|
||||
@Column(name = "duty", length = 50)
|
||||
private String duty;
|
||||
|
||||
/**
|
||||
* 职级
|
||||
*/
|
||||
@Column(name = "rank", length = 50)
|
||||
private String rank;
|
||||
|
||||
|
||||
|
||||
@Transient
|
||||
private String departName;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 扩展字段,多租户系统的标识值
|
||||
*/
|
||||
@Column(name = "sass_id", length = 18)
|
||||
private String sassId;
|
||||
|
||||
/**
|
||||
* 用户类型,1表学员,2表教师,3表管理员
|
||||
* 该字段暂用于表示是否前台管理员
|
||||
*/
|
||||
@Column(name = "user_type", length = 1)
|
||||
private Integer userType;
|
||||
|
||||
/**
|
||||
* 学习总时长
|
||||
*/
|
||||
@Column(name = "study_total", length = 11)
|
||||
private Integer studyTotal;
|
||||
|
||||
/**
|
||||
* boe的时长,和系统时长单独保存
|
||||
*/
|
||||
@Column(name = "learning_Duration", length = 11)
|
||||
private Integer learningDuration;
|
||||
|
||||
/**
|
||||
* 最近一次登录时间
|
||||
*/
|
||||
@Column(name = "last_login_at")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastLoginAt;
|
||||
|
||||
/**
|
||||
* 最近一次登录IP
|
||||
*/
|
||||
@Column(name = "last_login_ip", length = 30)
|
||||
private String lastLoginIp;
|
||||
|
||||
/**
|
||||
* 最近一次登录MAC地址
|
||||
*/
|
||||
@Column(name = "last_login_mac", length = 30)
|
||||
private String lastLoginMac;
|
||||
|
||||
/**
|
||||
* 最近一次操作时间
|
||||
*/
|
||||
@Column(name = "last_action_at")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastActionAt;
|
||||
|
||||
/**
|
||||
* 最近一次操作IP
|
||||
*/
|
||||
@Column(name = "last_action_ip", length = 30)
|
||||
private String lastActionIp;
|
||||
|
||||
/**
|
||||
* 最近一次操作MAC地址
|
||||
*/
|
||||
@Column(name = "last_action_mac", length = 30)
|
||||
private String lastActionMac;
|
||||
|
||||
/**
|
||||
* 在线状态;
|
||||
* 0:离线,1:在线
|
||||
*/
|
||||
@Column(name = "online", length = 1)
|
||||
private Boolean online;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.xboe.basic.service;
|
||||
|
||||
import com.xboe.basic.entity.ErrorLog;
|
||||
import com.xboe.basic.entity.User;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.dto.OrganizationDto;
|
||||
import com.xboe.dto.UserDto;
|
||||
|
||||
/**
|
||||
* 基本数据同步的相关处理
|
||||
* @author seastar
|
||||
*
|
||||
*/
|
||||
public interface IBasicDataSyncService {
|
||||
|
||||
/**
|
||||
* 同步机构数据
|
||||
* @param dto
|
||||
*/
|
||||
void syncOrganization(OrganizationDto dto);
|
||||
|
||||
/**
|
||||
* 同步人员数据
|
||||
* @param dto
|
||||
*/
|
||||
void syncUser(UserDto dto);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 同步删除机构 kid 老系统id
|
||||
* @param id
|
||||
*/
|
||||
String syncDeleteOrganization(String kid);
|
||||
|
||||
/**
|
||||
* 同步删除用户
|
||||
* @param kid,老系统id
|
||||
* @param code
|
||||
*/
|
||||
String syncDeleteUser(String kid,String code);
|
||||
|
||||
|
||||
void saveError(ErrorLog error);
|
||||
|
||||
PageList<ErrorLog> findLogs(int pageIndex,int pageSize,ErrorLog err);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.xboe.basic.service;
|
||||
|
||||
import com.xboe.basic.entity.Organization;
|
||||
|
||||
public interface IOrganizationService {
|
||||
|
||||
/**
|
||||
* 根据kid获取机构信息
|
||||
* @param kid
|
||||
* @return
|
||||
*/
|
||||
Organization getByKid(String kid);
|
||||
}
|
||||
@@ -0,0 +1,339 @@
|
||||
package com.xboe.basic.service.impl;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.xboe.basic.dao.AccountDao;
|
||||
import com.xboe.basic.dao.ErrorLogDao;
|
||||
import com.xboe.basic.dao.OrgTreeDao;
|
||||
import com.xboe.basic.dao.OrganizationDao;
|
||||
import com.xboe.basic.dao.PersonDao;
|
||||
import com.xboe.basic.dao.UserDao;
|
||||
import com.xboe.basic.entity.Account;
|
||||
import com.xboe.basic.entity.ErrorLog;
|
||||
import com.xboe.basic.entity.OrgTree;
|
||||
import com.xboe.basic.entity.Organization;
|
||||
import com.xboe.basic.entity.Person;
|
||||
import com.xboe.basic.entity.User;
|
||||
import com.xboe.basic.service.IBasicDataSyncService;
|
||||
import com.xboe.common.OrderCondition;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.common.utils.IDGenerator;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.core.orm.QueryBuilder;
|
||||
import com.xboe.dto.OrganizationDto;
|
||||
import com.xboe.dto.UserDto;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Service("basicService")
|
||||
public class BasicDataSyncServiceImpl implements IBasicDataSyncService{
|
||||
|
||||
@Autowired
|
||||
OrganizationDao orgDao;
|
||||
|
||||
@Autowired
|
||||
OrgTreeDao orgTreeDao;
|
||||
|
||||
@Autowired
|
||||
AccountDao accountDao;
|
||||
|
||||
@Autowired
|
||||
PersonDao personDao;
|
||||
|
||||
@Autowired
|
||||
UserDao userDao;
|
||||
|
||||
@Autowired
|
||||
ErrorLogDao errorDao;
|
||||
|
||||
@Override
|
||||
@Transactional("transactionManagerBasic")
|
||||
public synchronized void syncOrganization(OrganizationDto dto) {
|
||||
|
||||
Organization org=orgDao.findOne(FieldFilters.eq("kid", dto.getKid()));
|
||||
if(org==null) {//新增加
|
||||
org=new Organization();
|
||||
org.setId(IDGenerator.generate());
|
||||
org.setKid(dto.getKid());//老系统的id
|
||||
|
||||
org.setCode(org.getCode());
|
||||
org.setCreateFrom(dto.getCreateFrom());
|
||||
org.setSysCreateTime(dto.getCreateTime());
|
||||
org.setDataFrom(dto.getDataFrom());
|
||||
org.setDeleted(false);
|
||||
org.setDescription(dto.getDescription());
|
||||
org.setIsDefault(dto.getIsDefault());
|
||||
org.setIsMakeOrg(dto.getIsMakeOrg());
|
||||
org.setIsServiceSite(dto.getIsServiceSite());
|
||||
org.setName(dto.getName());
|
||||
org.setNamePath(dto.getNamePath());
|
||||
|
||||
//org.setOrganizationLevel(dto.getSysLevel());
|
||||
org.setSysLevel(dto.getSysLevel());
|
||||
org.setRemark(dto.getRemark());
|
||||
org.setSassId(dto.getSassId());
|
||||
org.setShortName(dto.getShortName());
|
||||
org.setStatus(dto.getStatus());
|
||||
org.setOrganizationLevel(dto.getOrganizationLevel());
|
||||
dto.setId(org.getId());
|
||||
orgDao.save(org);
|
||||
|
||||
OrgTree treeNode=new OrgTree();
|
||||
treeNode.setOrgId(org.getId());
|
||||
treeNode.setTreeType(dto.getTreeType());
|
||||
treeNode.setParentId("");
|
||||
treeNode.setRemark("系统同步");
|
||||
treeNode.setOldParentId(dto.getParentId());//保原机构的父id
|
||||
if(StringUtils.isNotBlank(dto.getParentId())){
|
||||
//检查它的上级id是哪个
|
||||
String parentId=(String)orgDao.findField("id",FieldFilters.eq("kid",dto.getParentId()));
|
||||
//如果没有orgId,应该再去获取,但是这里没有再去获取的途径,
|
||||
if(StringUtils.isNotBlank(parentId)){
|
||||
treeNode.setParentId(parentId);
|
||||
dto.setParentId(parentId);//设置dto的parentId;
|
||||
}else {
|
||||
//这种情况,本地无机构,应该去远程获取
|
||||
log.error("本地未找到机构【"+dto.getKid()+"】的上级parentId【"+dto.getParentId()+"】对应的机构,机构新id【"+org.getId()+"】");
|
||||
dto.setParentId("-1");//如果没有情况,设置为-1
|
||||
}
|
||||
}
|
||||
orgTreeDao.save(treeNode);
|
||||
}else {//更新
|
||||
dto.setId(org.getId());
|
||||
// org.setCode(org.getCode());
|
||||
// org.setCreateFrom(dto.getCreateFrom());
|
||||
// org.setCreateTime(dto.getCreateTime());
|
||||
// org.setDataFrom(dto.getDataFrom());
|
||||
//已经删除的,需要还原,因为新的同步过来了
|
||||
if(dto.getDeleted()!=null && dto.getDeleted()) {
|
||||
org.setDeleted(dto.getDeleted());
|
||||
}
|
||||
org.setDescription(dto.getDescription());
|
||||
org.setIsDefault(dto.getIsDefault());
|
||||
org.setIsMakeOrg(dto.getIsMakeOrg());
|
||||
org.setIsServiceSite(dto.getIsServiceSite());
|
||||
org.setName(dto.getName());
|
||||
org.setNamePath(dto.getNamePath());
|
||||
org.setSysLevel(dto.getSysLevel());
|
||||
org.setRemark(dto.getRemark());
|
||||
org.setSassId(dto.getSassId());
|
||||
org.setShortName(dto.getShortName());
|
||||
org.setOrganizationLevel(dto.getOrganizationLevel());
|
||||
org.setStatus(dto.getStatus());
|
||||
orgDao.update(org);
|
||||
|
||||
OrgTree treeNode=orgTreeDao.findOne(FieldFilters.eq("orgId",org.getId()));
|
||||
//得到对应的parentId,有可能修改了对应的上级关系
|
||||
String parentId="";
|
||||
if(StringUtils.isNotBlank(dto.getParentId())){
|
||||
parentId=(String)orgDao.findField("id",FieldFilters.eq("kid",dto.getParentId()));
|
||||
}
|
||||
dto.setParentId(parentId);
|
||||
if(treeNode!=null){
|
||||
treeNode.setParentId(parentId);
|
||||
treeNode.setOldParentId(dto.getParentId());
|
||||
orgTreeDao.update(treeNode);
|
||||
}else {
|
||||
treeNode=new OrgTree();
|
||||
treeNode.setOrgId(org.getId());
|
||||
treeNode.setTreeType(dto.getTreeType());
|
||||
treeNode.setParentId(parentId);
|
||||
treeNode.setRemark("系统同步");
|
||||
orgTreeDao.save(treeNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional("transactionManagerBasic")
|
||||
public synchronized void syncUser(UserDto dto) {
|
||||
|
||||
Integer employeeStatus=dto.getEmployeeStatus();
|
||||
//获取原机构的id
|
||||
if(StringUtils.isNotBlank(dto.getOldDepartId())) {
|
||||
Object idObj = orgDao.findField("id", FieldFilters.eq("kid", dto.getOldDepartId()));
|
||||
if(idObj!=null) {
|
||||
dto.setDepartId(idObj.toString());
|
||||
}
|
||||
}
|
||||
//同一个用户工号对应 多个kid的情况,所以直接根据kid查询是不对的,所以这里按工号查询,不使用kid
|
||||
User user = userDao.findOne(FieldFilters.eq("userNo", dto.getUserNo()));
|
||||
if(user==null) {
|
||||
//人员基本信息
|
||||
Person person=new Person();
|
||||
person.setId(IDGenerator.generate());
|
||||
//person.setBirthday(dto.getBirthday());
|
||||
person.setDataFrom(dto.getDataFrom());
|
||||
person.setGender(dto.toGenderInteger());
|
||||
person.setGraduatedFrom(dto.getGraduatedFrom());
|
||||
person.setGraduatedMajor(dto.getGraduatedMajor());
|
||||
person.setHighestEducation(dto.getHighestEducation());
|
||||
person.setHomePhoneNo(dto.getHomePhoneNo());
|
||||
person.setIdNumber(dto.getIdNumber());
|
||||
person.setIdType(dto.getIdType());
|
||||
person.setName(dto.getName());
|
||||
person.setNation(dto.getNation());
|
||||
person.setNationality(dto.getNationality());
|
||||
person.setRemark("用户同步");
|
||||
person.setStatus(Person.STATUS_NORMAL);//
|
||||
|
||||
//账号信息
|
||||
Account a=new Account();
|
||||
//同步过程中一样,可以不一样。因为此系统当前是一致的,所以统一使用一个
|
||||
a.setId(person.getId());
|
||||
a.setPersonId(person.getId());
|
||||
a.setAvatar(dto.getAvatar());
|
||||
a.setDeleted(false);
|
||||
a.setEmail(dto.getEmail());
|
||||
a.setLanguage(dto.getLanguage());
|
||||
a.setLoginName(dto.getLoginName());
|
||||
a.setMobile(dto.getMobile());
|
||||
a.setPassKey("");
|
||||
a.setPassValue("");
|
||||
a.setStatus(Account.STATUS_NORMAL);//正常状态
|
||||
if(employeeStatus==3) {
|
||||
a.setDeleted(true);
|
||||
}else {
|
||||
a.setDeleted(false);
|
||||
}
|
||||
|
||||
user=new User();
|
||||
//同步过程中一样,可以不一样。因为此系统当前是一致的,所以统一使用一个
|
||||
user.setId(a.getId());
|
||||
user.setPersonId(person.getId());
|
||||
user.setEnterpriseId(dto.getEnterpriseId());
|
||||
user.setDepartId(dto.getDepartId());
|
||||
user.setDescription(dto.getDescription());
|
||||
user.setDomainId(dto.getDomainId());
|
||||
user.setDuty(dto.getDuty());
|
||||
user.setKid(dto.getKid());
|
||||
user.setLearningDuration(dto.getLearningDuration());
|
||||
user.setMobile(dto.getMobile());
|
||||
user.setName(dto.getName());
|
||||
user.setOldEnterpriseId(dto.getOldEnterpriseId());
|
||||
user.setOldDepartId(dto.getOldDepartId());
|
||||
user.setOrgNamePath(dto.getOrgNamePath());
|
||||
user.setOrgTreeType(dto.getOrgTreeType());
|
||||
user.setRank(dto.getRank());
|
||||
user.setSassId(dto.getSassId());
|
||||
user.setTelephoneNo(dto.getTelephoneNo());
|
||||
user.setUserNo(dto.getUserNo());
|
||||
user.setPayrollPlaceId(dto.getPayrollPlaceId());
|
||||
user.setPayrollPlaceName(dto.getPayrollPlaceName());
|
||||
user.setEmployeeStatus(dto.getEmployeeStatus());
|
||||
|
||||
|
||||
if(user.getStatus()==null) {
|
||||
user.setStatus(1);//如果为空,就是正常
|
||||
}
|
||||
if(user.getEmployeeStatus()==null) {
|
||||
user.setEmployeeStatus(2);//在职状态
|
||||
}
|
||||
if(employeeStatus==3) {
|
||||
user.setDeleted(true);
|
||||
}else {
|
||||
user.setDeleted(false);
|
||||
}
|
||||
|
||||
|
||||
personDao.save(person);
|
||||
accountDao.save(a);
|
||||
userDao.save(user);
|
||||
dto.setId(user.getId());
|
||||
|
||||
}else {
|
||||
//更新时不更新用户基本信息和账户信息
|
||||
user.setDescription(dto.getDescription());
|
||||
user.setKid(dto.getKid());
|
||||
user.setDomainId(dto.getDomainId());
|
||||
user.setDuty(dto.getDuty());
|
||||
user.setLearningDuration(dto.getLearningDuration());
|
||||
user.setMobile(dto.getMobile());
|
||||
user.setOldEnterpriseId(dto.getOldEnterpriseId());
|
||||
user.setOldDepartId(dto.getOldDepartId());
|
||||
user.setOrgNamePath(dto.getOrgNamePath());
|
||||
user.setOrgTreeType(dto.getOrgTreeType());
|
||||
user.setEnterpriseId(dto.getEnterpriseId());
|
||||
user.setDepartId(dto.getDepartId());
|
||||
user.setRank(dto.getRank());
|
||||
user.setSassId(dto.getSassId());
|
||||
user.setTelephoneNo(dto.getTelephoneNo());
|
||||
user.setPayrollPlaceId(dto.getPayrollPlaceId());
|
||||
user.setPayrollPlaceName(dto.getPayrollPlaceName());
|
||||
user.setEmployeeStatus(dto.getEmployeeStatus());
|
||||
|
||||
if(employeeStatus==3) {
|
||||
user.setDeleted(true);
|
||||
}else {
|
||||
user.setDeleted(false);
|
||||
}
|
||||
|
||||
userDao.update(user);
|
||||
dto.setId(user.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageList<ErrorLog> findLogs(int pageIndex, int pageSize,ErrorLog log) {
|
||||
|
||||
QueryBuilder builder = QueryBuilder.from(ErrorLog.class);
|
||||
if(log.getDataType()!=null){
|
||||
builder.addFilter(FieldFilters.eq("dataType",log.getDataType()));
|
||||
}
|
||||
if(log.getType()!=null){
|
||||
builder.addFilter(FieldFilters.eq("type",log.getType()));
|
||||
}
|
||||
builder.setPageIndex(pageIndex);
|
||||
builder.setPageSize(pageSize);
|
||||
builder.addOrder(OrderCondition.desc("logTime"));
|
||||
return errorDao.findPage(builder.builder());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional("transactionManagerBasic")
|
||||
public void saveError(ErrorLog error) {
|
||||
if(error.getLogTime()==null) {
|
||||
error.setLogTime(LocalDateTime.now());
|
||||
}
|
||||
errorDao.save(error);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional("transactionManagerBasic")
|
||||
public String syncDeleteOrganization(String kid) {
|
||||
|
||||
//如果机构下有用户怎么办? 第二 ,是否也同步删除机构关系中的数据?
|
||||
Organization org=orgDao.findOne(FieldFilters.eq("kid",kid));
|
||||
//System.out.println(org.getId()+"1313131312312");
|
||||
if(org!=null) {
|
||||
orgDao.setDeleted(org.getId());
|
||||
return org.getId();
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional("transactionManagerBasic")
|
||||
public String syncDeleteUser(String kid,String code) {
|
||||
//同一个code,不同的id的部分,
|
||||
User user = userDao.findOne(FieldFilters.eq("kid", kid));
|
||||
if(user!=null) {
|
||||
userDao.setDeleted(user.getId());
|
||||
accountDao.setDeleted(user.getId());
|
||||
return user.getId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.xboe.datasource;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties;
|
||||
import org.springframework.boot.autoconfigure.orm.jpa.HibernateSettings;
|
||||
import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties;
|
||||
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@Configuration
|
||||
@EnableTransactionManagement
|
||||
@EnableJpaRepositories(
|
||||
entityManagerFactoryRef="entityManagerFactoryBasic",
|
||||
transactionManagerRef="transactionManagerBasic",
|
||||
basePackages= { "com.xboe.basic" }) //设置Repository所在位置
|
||||
public class BasicJPAConfig {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("basicDataSource")
|
||||
private DataSource basicDataSource;
|
||||
|
||||
@Autowired
|
||||
private JpaProperties jpaProperties;
|
||||
|
||||
@Autowired
|
||||
private HibernateProperties hibernateProperties;
|
||||
|
||||
private Map<String, Object> getVendorProperties() {
|
||||
return hibernateProperties.determineHibernateProperties(jpaProperties.getProperties(), new HibernateSettings());
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean(name = "entityManagerBasic")
|
||||
public EntityManager entityManager(EntityManagerFactoryBuilder builder) {
|
||||
return entityManagerFactoryPrimary(builder).getObject().createEntityManager();
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean(name = "entityManagerFactoryBasic")
|
||||
public LocalContainerEntityManagerFactoryBean entityManagerFactoryPrimary (EntityManagerFactoryBuilder builder) {
|
||||
return builder
|
||||
.dataSource(basicDataSource)
|
||||
.packages("com.xboe.basic") //设置实体类所在位置
|
||||
.persistenceUnit("basicPersistenceUnit")
|
||||
.properties(getVendorProperties())
|
||||
.build();
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean(name = "transactionManagerBasic")
|
||||
public PlatformTransactionManager transactionManagerPrimary(EntityManagerFactoryBuilder builder) {
|
||||
return new JpaTransactionManager(entityManagerFactoryPrimary(builder).getObject());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.xboe.datasource;
|
||||
|
||||
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
@Configuration
|
||||
public class DataSourceConfiguration {
|
||||
|
||||
@Primary
|
||||
@Bean(name="basicDataSource")
|
||||
@ConfigurationProperties(prefix = "spring.datasource.db1")
|
||||
public DataSource primaryDataSource() {
|
||||
return DataSourceBuilder.create().build();
|
||||
}
|
||||
|
||||
@Bean(name="primaryDataSource")
|
||||
@ConfigurationProperties(prefix = "spring.datasource.db2")
|
||||
public DataSource secondaryDataSource() {
|
||||
return DataSourceBuilder.create().build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.xboe.datasource;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties;
|
||||
import org.springframework.boot.autoconfigure.orm.jpa.HibernateSettings;
|
||||
import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties;
|
||||
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@Configuration
|
||||
@EnableTransactionManagement
|
||||
@EnableJpaRepositories(
|
||||
entityManagerFactoryRef="entityManagerFactoryPrimary",
|
||||
transactionManagerRef="transactionManagerPrimary",
|
||||
basePackages= { "com.xboe.primary" }) //设置Repository所在位置
|
||||
public class MainJPAConfig {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("primaryDataSource")
|
||||
private DataSource primaryDataSource;
|
||||
|
||||
@Autowired
|
||||
private JpaProperties jpaProperties;
|
||||
|
||||
@Autowired
|
||||
private HibernateProperties hibernateProperties;
|
||||
|
||||
private Map<String, Object> getVendorProperties() {
|
||||
return hibernateProperties.determineHibernateProperties(jpaProperties.getProperties(), new HibernateSettings());
|
||||
}
|
||||
|
||||
@Bean(name = "entityManagerPrimary")
|
||||
public EntityManager entityManager(EntityManagerFactoryBuilder builder) {
|
||||
return entityManagerFactoryPrimary(builder).getObject().createEntityManager();
|
||||
}
|
||||
|
||||
@Bean(name = "entityManagerFactoryPrimary")
|
||||
public LocalContainerEntityManagerFactoryBean entityManagerFactoryPrimary (EntityManagerFactoryBuilder builder) {
|
||||
return builder
|
||||
.dataSource(primaryDataSource)
|
||||
.packages("com.xboe.primary") //设置实体类所在位置
|
||||
.persistenceUnit("primaryPersistenceUnit")
|
||||
.properties(getVendorProperties())
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean(name = "transactionManagerPrimary")
|
||||
public PlatformTransactionManager transactionManagerPrimary(EntityManagerFactoryBuilder builder) {
|
||||
return new JpaTransactionManager(entityManagerFactoryPrimary(builder).getObject());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.xboe.dto;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 按数据标准构建
|
||||
*/
|
||||
@Data
|
||||
public class OrganizationDto implements java.io.Serializable{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**新系统的id*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 老系统ID
|
||||
*/
|
||||
private String kid;
|
||||
|
||||
/**
|
||||
* 组织部门代码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 组织名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**使用默认体系下,机构的namePath路径,中间使用/分开*/
|
||||
private String namePath;
|
||||
|
||||
/**
|
||||
* 机构名称简称
|
||||
*/
|
||||
private String shortName;
|
||||
|
||||
/**
|
||||
* 多租户下的id,此机构属于哪个sass用户
|
||||
*/
|
||||
private String sassId;
|
||||
|
||||
/**
|
||||
* 系统级别
|
||||
*/
|
||||
private Integer sysLevel;
|
||||
|
||||
/**
|
||||
* 是否是默认注册组织机构
|
||||
*/
|
||||
private Boolean isDefault;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 数据来源
|
||||
*/
|
||||
private String dataFrom;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 创建来源
|
||||
*/
|
||||
private String createFrom;
|
||||
|
||||
/**
|
||||
* 组织级别
|
||||
*/
|
||||
private String organizationLevel;
|
||||
|
||||
/**
|
||||
* 是否制造组织
|
||||
*/
|
||||
private Boolean isMakeOrg;
|
||||
|
||||
/**
|
||||
* 是否服务现地
|
||||
*/
|
||||
private Boolean isServiceSite;
|
||||
|
||||
/**
|
||||
* 状态 0:临时,1:正常,2:停用
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**备注*/
|
||||
private String remark;
|
||||
|
||||
//以下字段用于检查体系
|
||||
/**
|
||||
* 上级id
|
||||
* */
|
||||
private String parentId;
|
||||
|
||||
/**
|
||||
* 体系标识
|
||||
* */
|
||||
private String treeType;
|
||||
|
||||
/**
|
||||
* 是否已删除
|
||||
*/
|
||||
private Boolean deleted;
|
||||
|
||||
}
|
||||
152
servers/org-user-sync/src/main/java/com/xboe/dto/UserDto.java
Normal file
152
servers/org-user-sync/src/main/java/com/xboe/dto/UserDto.java
Normal file
@@ -0,0 +1,152 @@
|
||||
package com.xboe.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 按用户的数据标准构建
|
||||
*/
|
||||
@Data
|
||||
public class UserDto implements java.io.Serializable{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**新系统的用户id*/
|
||||
private String id;
|
||||
|
||||
/** 原系统的kid */
|
||||
private String kid;
|
||||
|
||||
/**人员基本信息id*/
|
||||
private String personId;
|
||||
|
||||
/**姓名*/
|
||||
private String name;
|
||||
|
||||
/**出生日期 yyyy-MM-dd*/
|
||||
private String birthday;
|
||||
|
||||
/**登录名*/
|
||||
private String loginName;
|
||||
|
||||
/**头像路径*/
|
||||
private String avatar;
|
||||
|
||||
/**邮箱*/
|
||||
private String email;
|
||||
|
||||
/**状态*/
|
||||
private Integer status;
|
||||
|
||||
/**性别,男,女 */
|
||||
private String gender;
|
||||
|
||||
/**证件类型, 身份证*/
|
||||
private String idType;
|
||||
|
||||
/**证件号码*/
|
||||
private String idNumber;
|
||||
|
||||
/**家庭电话*/
|
||||
private String homePhoneNo;
|
||||
|
||||
/**国家*/
|
||||
private String nationality;
|
||||
|
||||
/**民族*/
|
||||
private String nation;
|
||||
|
||||
/**毕来院校*/
|
||||
private String graduatedFrom;
|
||||
|
||||
/**毕业专业*/
|
||||
private String graduatedMajor;
|
||||
|
||||
/**最高学历*/
|
||||
private String highestEducation;
|
||||
|
||||
/**数据来源,老系统字段*/
|
||||
private String dataFrom;
|
||||
|
||||
/**语言,老系统字段*/
|
||||
private String language;
|
||||
|
||||
/**级别代码*/
|
||||
private String bandCode;
|
||||
|
||||
/**级别描述*/
|
||||
private String bandDesc;
|
||||
|
||||
/**发薪地id*/
|
||||
private String payrollPlaceId;
|
||||
|
||||
/**发薪地名称*/
|
||||
private String payrollPlaceName;
|
||||
|
||||
|
||||
/**管理序列职级*/
|
||||
private String positionMgrLevel;
|
||||
|
||||
/**是否在职 2正常,3离职*/
|
||||
private Integer employeeStatus;
|
||||
|
||||
/** 手机号 */
|
||||
private String mobile;
|
||||
|
||||
/** 默认的组织机构体系 */
|
||||
private String orgTreeType;
|
||||
|
||||
/**原数据关联的企业id*/
|
||||
private String oldEnterpriseId;
|
||||
|
||||
/** 旧系统机构id */
|
||||
private String oldDepartId;
|
||||
|
||||
/** 员工编号 */
|
||||
private String userNo;
|
||||
|
||||
/** 所在公司,新系统的关联的企业ID, 对应机构表中的企业 */
|
||||
private String enterpriseId;
|
||||
|
||||
/** 所在部门,新系统的机构id*/
|
||||
private String departId;
|
||||
|
||||
/** 机构名称/分隔的全路径 */
|
||||
private String orgNamePath;
|
||||
|
||||
|
||||
/** 所在域 */
|
||||
private String domainId;
|
||||
|
||||
/** 扩展字段,多租户系统的标识值 */
|
||||
private String sassId;
|
||||
|
||||
|
||||
/** 办公电话*/
|
||||
private String telephoneNo;
|
||||
|
||||
/** 职务 */
|
||||
private String duty;
|
||||
|
||||
/** 职级*/
|
||||
private String rank;
|
||||
|
||||
/** 描述*/
|
||||
private String description;
|
||||
|
||||
/**boe的时长,和系统时长单独保存,此字段不应该存在的*/
|
||||
private Integer learningDuration;
|
||||
|
||||
public Integer toGenderInteger() {
|
||||
if(this.gender!=null) {
|
||||
if(this.gender.equals("male")) {
|
||||
return 1;
|
||||
}else if(this.gender.equals("female")) {
|
||||
return 2;
|
||||
}else {
|
||||
return 3;//其它
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.xboe.primary.dao;
|
||||
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.xboe.primary.entity.MainAccount;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 账号信息DAO
|
||||
*/
|
||||
@Repository
|
||||
public interface MainAccountDao extends JpaRepository<MainAccount,String>{
|
||||
|
||||
@Modifying
|
||||
@Query(value = "update MainAccount set deleted=true where id=?1")
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
public Integer setDeleted(String id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.xboe.primary.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.xboe.primary.entity.MainOrganization;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 机构管理DAO
|
||||
*/
|
||||
@Repository("organizationAllDao")
|
||||
public interface MainOrganizationDao extends JpaRepository<MainOrganization,String> {
|
||||
|
||||
@Modifying
|
||||
@Query(value = "update MainOrganization set deleted=true where id=?1")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer setDeleted(String id);
|
||||
|
||||
@Query(value = "from MainOrganization where id=?1")
|
||||
public MainOrganization get(String id);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.xboe.primary.dao;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.xboe.primary.entity.MainTeacher;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
@Repository("teacherAllDao")
|
||||
public interface MainTeacherDao extends JpaRepository<MainTeacher,String> {
|
||||
|
||||
@Modifying
|
||||
@Query(value = "update MainTeacher set waitStatus=?2 where id=?1")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateStatus(String id,Integer status);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.xboe.primary.dao;
|
||||
|
||||
import com.xboe.basic.entity.User;
|
||||
import com.xboe.primary.entity.MainOrganization;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.xboe.primary.entity.MainUser;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 用户DAO
|
||||
*/
|
||||
@Repository("userAllDao")
|
||||
public interface MainUserDao extends JpaRepository<MainUser,String> {
|
||||
|
||||
@Modifying
|
||||
@Query(value = "update MainUser set deleted=true where id=?1")
|
||||
public Integer setDeleted(String id);
|
||||
|
||||
|
||||
@Query(value = "from MainUser where id=?1")
|
||||
public MainUser get(String id);
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.xboe.primary.entity;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.IdEntity;
|
||||
import com.xboe.core.orm.annotation.MetaInfo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 账号表,只是记录登录的账号信息,无任务业务实名类的信息
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Entity
|
||||
@Table(name = SysConstant.TABLE_PRE + "account")
|
||||
public class MainAccount extends IdEntity{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**0 临时数据*/
|
||||
public static final int STATUS_TEMPORARY=0;
|
||||
|
||||
/**1 正常数据*/
|
||||
public static final int STATUS_NORMAL=1;
|
||||
|
||||
/**2 停用数据*/
|
||||
public static final int STATUS_DEAD=2;
|
||||
|
||||
@MetaInfo("原系统中的id")
|
||||
@Column(name = "sys_id", length = 36)
|
||||
private String sysId;
|
||||
|
||||
@MetaInfo("登录名")
|
||||
@Column(name = "login_name", nullable = true, length = 30)
|
||||
private String loginName;
|
||||
|
||||
@MetaInfo("用户头像地址")
|
||||
@Column(name = "avatar", nullable = true, length = 100)
|
||||
private String avatar;
|
||||
|
||||
@MetaInfo("手机号")
|
||||
@Column(name = "mobile", length = 11)
|
||||
private String mobile;
|
||||
|
||||
@Column(name = "email", length = 100)
|
||||
private String email;
|
||||
|
||||
@Column(name = "nick_name", length = 20)
|
||||
private String nickName;
|
||||
|
||||
@Column(name = "pass_key", length = 6)
|
||||
private String passKey;
|
||||
|
||||
@Column(name = "pass_value", length = 32)
|
||||
private String passValue;
|
||||
|
||||
@Column(name = "reg_time" )
|
||||
private LocalDateTime regTime;
|
||||
|
||||
@MetaInfo("关联的公司id")
|
||||
@Column(name = "company_id", length = 36)
|
||||
private String companyId;
|
||||
|
||||
// 状态1, 正常,2停用
|
||||
@Column(name = "status", length = 1)
|
||||
private Integer status;
|
||||
|
||||
@Column(name = "deleted", length = 1)
|
||||
private Boolean deleted;
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.xboe.primary.entity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.BaseEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 机构实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Entity
|
||||
@Table(name = SysConstant.TABLE_PRE + "organization")
|
||||
public class MainOrganization extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 原系统ID
|
||||
*/
|
||||
@Column(name = "sys_id", length = 36)
|
||||
private String sysId;
|
||||
|
||||
/**
|
||||
* 旧系统父id
|
||||
*/
|
||||
@Column(name = "sys_parent_id", length = 36)
|
||||
private String sysParentId;
|
||||
|
||||
/**
|
||||
* 组织部门代码
|
||||
*/
|
||||
@Column(name = "code", nullable = false, length = 50)
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 组织名
|
||||
*/
|
||||
@Column(name = "name", nullable = false, length = 50)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 组织全路径
|
||||
*/
|
||||
@Column(name = "name_path")
|
||||
private String namePath;
|
||||
|
||||
/**
|
||||
* 父组织部门ID
|
||||
*/
|
||||
@Column(name = "parent_id", length = 20)
|
||||
private String parentId;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Column(name = "description", columnDefinition = "text")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 企业ID
|
||||
*/
|
||||
@Column(name = "company_id", length = 36)
|
||||
private String companyId;
|
||||
|
||||
/**
|
||||
* 域ID
|
||||
*/
|
||||
@Column(name = "domain_id", length = 36)
|
||||
private String domainId;
|
||||
|
||||
/**
|
||||
* 组织部门经理ID
|
||||
*/
|
||||
@Column(name = "orgnization_manager_id", length = 36)
|
||||
private String orgnizationManagerId;
|
||||
|
||||
/**
|
||||
* 组织级别
|
||||
*/
|
||||
@Column(name = "organization_level", length = 50)
|
||||
private String organizationLevel;
|
||||
|
||||
/**
|
||||
* 是否制造组织
|
||||
*/
|
||||
@Column(name = "is_make_org", length = 1)
|
||||
private Boolean isMakeOrg;
|
||||
|
||||
/**
|
||||
* 是否服务现地
|
||||
*/
|
||||
@Column(name = "is_service_site", length = 1)
|
||||
private Boolean isServiceSite;
|
||||
|
||||
/**
|
||||
* 是否默认注册组织
|
||||
*/
|
||||
@Column(name = "is_default_organization", length = 1)
|
||||
private Boolean isDefaultOrganization;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
* 0:临时,1:正常,2:停用
|
||||
*/
|
||||
@Column(name = "status", nullable = false, length = 1)
|
||||
private Integer status;
|
||||
|
||||
@Column(name="deleted",length = 1)
|
||||
private Boolean deleted;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
package com.xboe.primary.entity;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.BaseEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Entity
|
||||
@Table(name = SysConstant.TABLE_PRE + "teacher")
|
||||
public class MainTeacher extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 系统id
|
||||
*/
|
||||
@Column(name = "sys_id", length = 36)
|
||||
private String sysId;
|
||||
|
||||
@Column(name = "photo", length = 100)
|
||||
private String photo;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Column(name = "name", length = 30)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 所属机构
|
||||
*/
|
||||
@Column(name = "depart_id", length = 18)
|
||||
private String departId;
|
||||
|
||||
/**
|
||||
* 性别 1:男 2:女
|
||||
*/
|
||||
@Column(name = "gender", length = 1)
|
||||
private Integer gender;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
@Column(name = "id_number", length = 18)
|
||||
private String idNumber;
|
||||
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
@Column(name = "birthday")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate birthday;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Column(name = "mobile", length = 11)
|
||||
private String mobile;
|
||||
|
||||
@Column(name = "email", length = 100)
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 家庭电话
|
||||
*/
|
||||
@Column(name = "home_phone_no", length = 50)
|
||||
private String homePhoneNo;
|
||||
|
||||
/**
|
||||
* 个人标签
|
||||
*/
|
||||
@Column(name = "personal_label", length = 100)
|
||||
private String personalLabel;
|
||||
|
||||
/**
|
||||
* 所在公司
|
||||
*/
|
||||
@Column(name = "company_id", length = 36)
|
||||
private String companyId;
|
||||
|
||||
/**
|
||||
* 所在域
|
||||
*/
|
||||
@Column(name = "domain_id", length = 36)
|
||||
private String domainId;
|
||||
|
||||
/**
|
||||
* 岗位
|
||||
*/
|
||||
@Column(name = "operating_post", length = 100)
|
||||
private String operatingPost;
|
||||
|
||||
/**
|
||||
* 直线经理
|
||||
*/
|
||||
@Column(name = "superior_manager", length = 32)
|
||||
private String superiorManager;
|
||||
|
||||
/**
|
||||
* 位置
|
||||
*/
|
||||
@Column(name = "address", length = 200)
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Column(name = "description",columnDefinition = "text")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 授课时长
|
||||
*/
|
||||
@Column(name = "teaching")
|
||||
private String teaching;
|
||||
|
||||
/**
|
||||
* 在职状态 在职: 0 离职: 1
|
||||
*/
|
||||
@Column(name = "wait_status")
|
||||
private Integer waitStatus;
|
||||
|
||||
/**状态,0表临时, 1表启用,2表停用的*/
|
||||
@Column(name = "status",length = 1)
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 认证状态,0表未认证,1表已认证
|
||||
*/
|
||||
@Column(name = "cert_status",length = 1)
|
||||
private Integer certStatus;
|
||||
|
||||
/**
|
||||
* 擅长课程
|
||||
*/
|
||||
@Column(name = "courses")
|
||||
private String courses;
|
||||
|
||||
/**
|
||||
* 发薪地id
|
||||
*/
|
||||
@Column(name = "salary_id",length=36)
|
||||
private String salaryId;
|
||||
|
||||
/**
|
||||
* 发薪地名称
|
||||
*/
|
||||
@Column(name = "salary_name",length=50)
|
||||
private String salaryName;
|
||||
|
||||
/**
|
||||
* 所属体系id
|
||||
* */
|
||||
@Column(name = "t_system_id",length = 36)
|
||||
private String tsystemId;
|
||||
|
||||
/**
|
||||
* 所属体系name
|
||||
* */
|
||||
@Column(name = "t_system_name",length = 30)
|
||||
private String tsystemName;
|
||||
|
||||
/**
|
||||
* 所属级别id
|
||||
* */
|
||||
@Column(name = "t_level_id",length = 36)
|
||||
private String tlevelId;
|
||||
|
||||
/**
|
||||
* 所属级别名称
|
||||
* */
|
||||
@Column(name = "t_level_name",length = 30)
|
||||
private String tlevelName;
|
||||
|
||||
/**讲师备注*/
|
||||
@Column(name = "remark",length = 500)
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
package com.xboe.primary.entity;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.IdEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 用户信息表
|
||||
* 存储所有的用户信息,原表中的部分信息
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Entity
|
||||
@Table(name = SysConstant.TABLE_PRE + "user")
|
||||
public class MainUser extends IdEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 旧系统id
|
||||
*/
|
||||
@Column(name = "sys_id", length = 36)
|
||||
private String sysId;
|
||||
|
||||
/**
|
||||
* 旧系统机构id
|
||||
*/
|
||||
@Column(name = "sys_depart_id", length = 36)
|
||||
private String sysDepartId;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Column(name = "name", length = 30)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 员工编号
|
||||
*/
|
||||
@Column(name = "user_no", length = 30)
|
||||
private String userNo;
|
||||
|
||||
/**
|
||||
* 性别 1:男 2:女
|
||||
*/
|
||||
@Column(name = "gender", length = 1)
|
||||
private Integer gender;
|
||||
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
@Column(name = "birthday")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate birthday;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
@Column(name = "id_number", length = 18)
|
||||
private String idNumber;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Column(name = "mobile_no", length = 11)
|
||||
private String mobileNo;
|
||||
|
||||
/**
|
||||
* 家庭电话
|
||||
*/
|
||||
@Column(name = "home_phone_no", length = 50)
|
||||
private String homePhoneNo;
|
||||
|
||||
/**
|
||||
* 国籍
|
||||
*/
|
||||
@Column(name = "nationality", length = 50)
|
||||
private String nationality;
|
||||
|
||||
/**
|
||||
* 毕业院校
|
||||
*/
|
||||
@Column(name = "graduated_from", length = 50)
|
||||
private String graduatedFrom;
|
||||
|
||||
/**
|
||||
* 毕业专业
|
||||
*/
|
||||
@Column(name = "graduated_major", length = 50)
|
||||
private String graduatedMajor;
|
||||
|
||||
/**
|
||||
* 最高学历
|
||||
*/
|
||||
@Column(name = "highest_education", length = 50)
|
||||
private String highestEducation;
|
||||
|
||||
/**
|
||||
* 办公电话
|
||||
*/
|
||||
@Column(name = "telephone_no", length = 50)
|
||||
private String telephoneNo;
|
||||
|
||||
/**发薪地*/
|
||||
@Column(name = "payroll_place", length = 150)
|
||||
private String payrollPlace;
|
||||
|
||||
/**管理序列职级*/
|
||||
@Column(name = "position_mgr_level", length = 150)
|
||||
private String positionMgrLevel;
|
||||
|
||||
/**
|
||||
* 职务
|
||||
*/
|
||||
@Column(name = "duty", length = 50)
|
||||
private String duty;
|
||||
|
||||
/**
|
||||
* 职级
|
||||
*/
|
||||
@Column(name = "rank", length = 50)
|
||||
private String rank;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Column(name = "description")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 所在公司
|
||||
*/
|
||||
@Column(name = "company_id", length = 36)
|
||||
private String companyId;
|
||||
|
||||
/**
|
||||
* 所在部门
|
||||
*/
|
||||
@Column(name = "depart_id", length = 18)
|
||||
private String departId;
|
||||
|
||||
@Transient
|
||||
private String departName;
|
||||
|
||||
|
||||
/**
|
||||
* 所在域
|
||||
*/
|
||||
@Column(name = "domain_id", length = 36)
|
||||
private String domainId;
|
||||
|
||||
/**
|
||||
* 扩展字段,多租户系统的标识值
|
||||
*/
|
||||
@Column(name = "sass_id", length = 36)
|
||||
private String sassId;
|
||||
|
||||
/**
|
||||
* 用户类型,1表学员,2表教师,3表管理员
|
||||
* 该字段暂用于表示是否前台管理员
|
||||
*/
|
||||
@Column(name = "user_type", length = 1)
|
||||
private Integer userType;
|
||||
|
||||
/**
|
||||
* 学习总时长
|
||||
*/
|
||||
@Column(name = "study_total", length = 11)
|
||||
private Integer studyTotal;
|
||||
|
||||
/**
|
||||
* boe的时长,和系统时长单独保存
|
||||
*/
|
||||
@Column(name = "learning_Duration", length = 11)
|
||||
private Integer learningDuration;
|
||||
|
||||
/**
|
||||
* 最近一次登录时间
|
||||
*/
|
||||
@Column(name = "last_login_at")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastLoginAt;
|
||||
|
||||
/**
|
||||
* 最近一次登录IP
|
||||
*/
|
||||
@Column(name = "last_login_ip", length = 30)
|
||||
private String lastLoginIp;
|
||||
|
||||
/**
|
||||
* 最近一次登录MAC地址
|
||||
*/
|
||||
@Column(name = "last_login_mac", length = 30)
|
||||
private String lastLoginMac;
|
||||
|
||||
/**
|
||||
* 最近一次操作时间
|
||||
*/
|
||||
@Column(name = "last_action_at")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastActionAt;
|
||||
|
||||
/**
|
||||
* 最近一次操作IP
|
||||
*/
|
||||
@Column(name = "last_action_ip", length = 30)
|
||||
private String lastActionIp;
|
||||
|
||||
/**
|
||||
* 最近一次操作MAC地址
|
||||
*/
|
||||
@Column(name = "last_action_mac", length = 30)
|
||||
private String lastActionMac;
|
||||
|
||||
/**
|
||||
* 在线状态;
|
||||
* 0:离线,1:在线
|
||||
*/
|
||||
@Column(name = "online", length = 1)
|
||||
private Boolean online;
|
||||
|
||||
/**
|
||||
* 删除标识
|
||||
* */
|
||||
@Column(name="deleted",length = 1)
|
||||
private Boolean deleted;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.xboe.primary.service;
|
||||
|
||||
import com.xboe.dto.OrganizationDto;
|
||||
import com.xboe.dto.UserDto;
|
||||
|
||||
/**
|
||||
* 基本数据同步的相关处理
|
||||
* @author seastar
|
||||
*
|
||||
*/
|
||||
public interface IMainDbSyncService {
|
||||
|
||||
/**
|
||||
* 同步机构数据
|
||||
* @param dto
|
||||
*/
|
||||
void syncOrganization(OrganizationDto dto);
|
||||
|
||||
/**
|
||||
* 同步人员数据
|
||||
* @param dto
|
||||
*/
|
||||
void syncUser(UserDto dto);
|
||||
|
||||
/**
|
||||
* 同步删除机构 id.
|
||||
* 内部同步不是新的id
|
||||
* @param id
|
||||
*/
|
||||
String syncDeleteOrganization(String id);
|
||||
|
||||
/**
|
||||
* 同步删除用户
|
||||
* @param id,新系统调用是数据中心的id
|
||||
* @param code
|
||||
*/
|
||||
String syncDeleteUser(String id,String code);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
package com.xboe.primary.service.impl;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.xboe.basic.entity.Account;
|
||||
import com.xboe.dto.OrganizationDto;
|
||||
import com.xboe.dto.UserDto;
|
||||
import com.xboe.primary.dao.MainAccountDao;
|
||||
import com.xboe.primary.dao.MainOrganizationDao;
|
||||
import com.xboe.primary.dao.MainTeacherDao;
|
||||
import com.xboe.primary.dao.MainUserDao;
|
||||
import com.xboe.primary.entity.MainAccount;
|
||||
import com.xboe.primary.entity.MainOrganization;
|
||||
import com.xboe.primary.entity.MainUser;
|
||||
import com.xboe.primary.service.IMainDbSyncService;
|
||||
|
||||
/**
|
||||
* 主数据库同步的实现
|
||||
*/
|
||||
@Service("allService")
|
||||
public class MainDbSyncServiceImpl implements IMainDbSyncService {
|
||||
|
||||
@Autowired
|
||||
MainOrganizationDao orgDao;
|
||||
|
||||
@Autowired
|
||||
MainUserDao userDao;
|
||||
|
||||
@Autowired
|
||||
MainAccountDao accountDao;
|
||||
|
||||
@Autowired
|
||||
MainTeacherDao teacherDao;
|
||||
|
||||
@Override
|
||||
@Transactional("transactionManagerPrimary")
|
||||
public synchronized void syncOrganization(OrganizationDto dto) {
|
||||
MainOrganization hasOrg =orgDao.get(dto.getId());
|
||||
if(hasOrg!=null) {
|
||||
if(dto.getDeleted()!=null && dto.getDeleted()) {
|
||||
hasOrg.setDeleted(dto.getDeleted());
|
||||
}
|
||||
hasOrg.setDescription(dto.getDescription());
|
||||
hasOrg.setIsMakeOrg(dto.getIsMakeOrg());
|
||||
hasOrg.setIsServiceSite(dto.getIsServiceSite());
|
||||
hasOrg.setName(dto.getName());
|
||||
hasOrg.setParentId(dto.getParentId());
|
||||
hasOrg.setNamePath(dto.getNamePath());
|
||||
hasOrg.setStatus(dto.getStatus());
|
||||
orgDao.save(hasOrg);
|
||||
}else {
|
||||
//hasOrg =orgDao.getBySysId(dto.getKid());
|
||||
hasOrg=new MainOrganization();
|
||||
hasOrg.setId(dto.getId());
|
||||
hasOrg.setCode(dto.getCode());
|
||||
hasOrg.setCompanyId(dto.getSassId());
|
||||
hasOrg.setDeleted(false);
|
||||
hasOrg.setDescription(dto.getDescription());
|
||||
//hasOrg.setDomainId(dto.getD);
|
||||
hasOrg.setIsDefaultOrganization(true);
|
||||
hasOrg.setStatus(dto.getStatus());
|
||||
hasOrg.setIsMakeOrg(dto.getIsMakeOrg());
|
||||
hasOrg.setIsServiceSite(dto.getIsServiceSite());
|
||||
hasOrg.setName(dto.getName());
|
||||
hasOrg.setNamePath(dto.getNamePath());
|
||||
hasOrg.setOrganizationLevel(dto.getOrganizationLevel());
|
||||
//hasOrg.setOrgnizationManagerId(dto.get);
|
||||
hasOrg.setParentId(dto.getParentId());
|
||||
//hasOrg.setSysCreateAid();//创建人没有这个数据
|
||||
hasOrg.setSysCreateBy("同步基础数据");
|
||||
hasOrg.setSysCreateTime(LocalDateTime.now());
|
||||
hasOrg.setSysId(dto.getKid());
|
||||
hasOrg.setSysParentId(dto.getParentId());
|
||||
hasOrg.setSysUpdateBy("");
|
||||
hasOrg.setSysUpdateTime(hasOrg.getSysCreateTime());
|
||||
orgDao.save(hasOrg);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional("transactionManagerPrimary")
|
||||
public void syncUser(UserDto dto) {
|
||||
//System.out.println("dto.name="+dto.getName());
|
||||
Integer employeeStatus=dto.getEmployeeStatus();
|
||||
//同一个用户工号对应 多个kid的情况,所以直接根据kid查询是不对的,同步过来的,使用sysId查询
|
||||
MainUser user = userDao.get(dto.getId());
|
||||
if(user!=null) {
|
||||
//更新用户信息,更新账号信息
|
||||
user.setSysId(dto.getKid());
|
||||
//hasUser.setBirthday(null);
|
||||
}else {
|
||||
//账号信息
|
||||
MainAccount a=new MainAccount();
|
||||
//同步过程中一样,可以不一样。因为此系统当前是一致的,所以统一使用一个
|
||||
a.setId(dto.getId());
|
||||
a.setAvatar(dto.getAvatar());
|
||||
a.setDeleted(false);
|
||||
a.setEmail(dto.getEmail());
|
||||
a.setLoginName(dto.getLoginName());
|
||||
a.setSysId(dto.getKid());
|
||||
a.setRegTime(LocalDateTime.now());
|
||||
|
||||
a.setMobile(dto.getMobile());
|
||||
a.setPassKey("");
|
||||
a.setPassValue("");
|
||||
a.setStatus(Account.STATUS_NORMAL);//正常状态
|
||||
if(employeeStatus==3) {
|
||||
a.setDeleted(true);
|
||||
}else {
|
||||
a.setDeleted(false);
|
||||
}
|
||||
|
||||
user=new MainUser();
|
||||
//同步过程中一样,可以不一样。因为此系统当前是一致的,所以统一使用一个
|
||||
user.setId(a.getId());
|
||||
user.setDepartId(dto.getDepartId());
|
||||
user.setDescription(dto.getDescription());
|
||||
user.setDomainId(dto.getDomainId());
|
||||
user.setDuty(dto.getDuty());
|
||||
user.setSysId(dto.getKid());
|
||||
user.setLearningDuration(dto.getLearningDuration());
|
||||
user.setName(dto.getName());
|
||||
user.setRank(dto.getRank());
|
||||
user.setSassId(dto.getSassId());
|
||||
user.setTelephoneNo(dto.getTelephoneNo());
|
||||
user.setUserNo(dto.getUserNo());
|
||||
user.setGender(dto.toGenderInteger()==3? 1:dto.toGenderInteger());
|
||||
user.setGraduatedFrom(dto.getGraduatedFrom());
|
||||
user.setGraduatedMajor(dto.getGraduatedMajor());
|
||||
user.setHighestEducation(dto.getHighestEducation());
|
||||
user.setHomePhoneNo(dto.getHomePhoneNo());
|
||||
user.setIdNumber(dto.getIdNumber());
|
||||
user.setMobileNo(dto.getMobile());
|
||||
user.setNationality(dto.getNationality());
|
||||
user.setOnline(true);
|
||||
user.setDeleted(false);
|
||||
accountDao.save(a);
|
||||
userDao.save(user);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional("transactionManagerPrimary")
|
||||
public String syncDeleteOrganization(String id){
|
||||
//注意这里调用的是机构的id
|
||||
orgDao.setDeleted(id);
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional("transactionManagerPrimary")
|
||||
public String syncDeleteUser(String id,String code) {
|
||||
MainAccount a = accountDao.getById(id);
|
||||
if(a!=null) {
|
||||
accountDao.setDeleted(id);
|
||||
//设置教师是离职状态
|
||||
teacherDao.updateStatus(id, 1);
|
||||
}
|
||||
//当前系统User相当于Person
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
# redis
|
||||
spring.redis.database=2
|
||||
spring.redis.host=127.0.0.1
|
||||
spring.redis.password=ENC(zA5LNV8xw3yEx6LMwdGGBGgNsOaD3Cg+)
|
||||
spring.redis.port=6379
|
||||
|
||||
# datasource config
|
||||
# basic数据库
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
spring.jpa.open-in-view=false
|
||||
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
|
||||
|
||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
# 当前数据库 basic 对应的数据库
|
||||
spring.datasource.db1.driverClassName=com.mysql.jdbc.Driver
|
||||
spring.datasource.db1.jdbc-url=jdbc:mysql://127.0.0.1:3306/boeu_basic?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.db1.username=root
|
||||
spring.datasource.db1.password=ENC(lAoFOYuc8CAypPtigTNLYg==)
|
||||
|
||||
|
||||
|
||||
# 主数据库 all 对应的数据库
|
||||
spring.datasource.db2.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.db2.jdbc-url=jdbc:mysql://127.0.0.1:3306/boe_base3?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.db2.username=root
|
||||
spring.datasource.db2.password=ENC(lAoFOYuc8CAypPtigTNLYg==)
|
||||
|
||||
|
||||
logging.level.org.hibernate.SQL=DEBUG
|
||||
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
||||
|
||||
# 设置logback.xml位置
|
||||
logging.config=classpath:log/logback-dev.xml
|
||||
|
||||
## 静态文件目录,默认是在static下面,以后独立到nginx下面配置
|
||||
spring.web.resources.static-locations=file:E:/Projects/BOE/java/static
|
||||
|
||||
## 上传相磁的路径配置
|
||||
xboe.upload.file.temp_path=E:/Projects/BOE/java/static/temp
|
||||
xboe.upload.file.save_path=E:/Projects/BOE/java/static/upload
|
||||
xboe.upload.file.http_path=http://localhost:9090/cdn/upload
|
||||
|
||||
## 新系统的内部地址,可以不通过nginx调用
|
||||
xboe.inner.data.sync.baseurl=http://localhost:9090
|
||||
|
||||
#加密盐
|
||||
#jasypt.encryptor.password=jasypt
|
||||
jasypt.encryptor.algorithm=PBEWithMD5AndDES
|
||||
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
|
||||
@@ -0,0 +1,37 @@
|
||||
## redis
|
||||
spring.redis.database=2
|
||||
spring.redis.host=127.0.0.1
|
||||
spring.redis.password=ENC(zA5LNV8xw3yEx6LMwdGGBGgNsOaD3Cg+)
|
||||
spring.redis.port=6379
|
||||
|
||||
## datasource config
|
||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=ENC(lAoFOYuc8CAypPtigTNLYg==)
|
||||
|
||||
logging.level.org.hibernate.SQL=ERROR
|
||||
# logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
||||
|
||||
# 设置logback.xml位置
|
||||
logging.config=classpath:log/logback-pro.xml
|
||||
|
||||
## 静态文件目录,默认是在static下面,以后独立到nginx下面配置
|
||||
spring.web.resources.static-locations=file:E:/Projects/BOE/java/static
|
||||
|
||||
## xboe config
|
||||
xboe.api.cross_filter=true
|
||||
|
||||
## 上传相磁的路径配置
|
||||
xboe.upload.file.temp_path=E:/Projects/BOE/java/static/temp
|
||||
xboe.upload.file.save_path=E:/Projects/BOE/java/static/upload
|
||||
xboe.upload.file.http_path=http://localhost:9090/cdn/upload
|
||||
|
||||
## 新系统的内部地址,可以不通过nginx调用
|
||||
xboe.inner.data.sync.baseurl=http://localhost:9090
|
||||
|
||||
#加密盐
|
||||
#jasypt.encryptor.password=jasypt
|
||||
jasypt.encryptor.algorithm=PBEWithMD5AndDES
|
||||
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
|
||||
@@ -0,0 +1,54 @@
|
||||
## redis
|
||||
spring.redis.database=2
|
||||
spring.redis.host=127.0.0.1
|
||||
spring.redis.password=ENC(zA5LNV8xw3yEx6LMwdGGBGgNsOaD3Cg+)
|
||||
spring.redis.port=6379
|
||||
|
||||
# datasource config
|
||||
# basic数据库
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
spring.jpa.open-in-view=false
|
||||
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
|
||||
|
||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
# 当前数据库 basic 对应的数据库
|
||||
spring.datasource.db1.driverClassName=com.mysql.jdbc.Driver
|
||||
spring.datasource.db1.jdbc-url=jdbc:mysql://127.0.0.1:3306/boeu_basic?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.db1.username=root
|
||||
spring.datasource.db1.password=root
|
||||
|
||||
|
||||
|
||||
# 主数据库 all 对应的数据库
|
||||
spring.datasource.db2.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.db2.jdbc-url=jdbc:mysql://127.0.0.1:3306/boe_base3?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.db2.username=root
|
||||
spring.datasource.db2.password=root
|
||||
|
||||
|
||||
logging.level.org.hibernate.SQL=ERROR
|
||||
# logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
||||
|
||||
## 静态文件目录,默认是在static下面,以后独立到nginx下面配置
|
||||
spring.web.resources.static-locations=file:E:/Projects/BOE/java/static
|
||||
|
||||
# 设置logback.xml位置
|
||||
logging.config=classpath:log/logback-pro.xml
|
||||
|
||||
## xboe config
|
||||
xboe.api.cross_filter=true
|
||||
|
||||
## 上传相磁的路径配置
|
||||
xboe.upload.file.temp_path=E:/Projects/BOE/java/static/temp
|
||||
xboe.upload.file.save_path=E:/Projects/BOE/java/static/upload
|
||||
xboe.upload.file.http_path=http://localhost:9090/cdn/upload
|
||||
|
||||
## 新系统的内部地址,可以不通过nginx调用
|
||||
xboe.inner.data.sync.baseurl=http://localhost:9090
|
||||
|
||||
#加密盐
|
||||
#jasypt.encryptor.password=jasypt
|
||||
jasypt.encryptor.algorithm=PBEWithMD5AndDES
|
||||
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
|
||||
@@ -0,0 +1,34 @@
|
||||
## redis
|
||||
spring.redis.database=2
|
||||
spring.redis.host=127.0.0.1
|
||||
spring.redis.password=ENC(zA5LNV8xw3yEx6LMwdGGBGgNsOaD3Cg+)
|
||||
spring.redis.port=6379
|
||||
|
||||
## datasource config
|
||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.username=boe_base
|
||||
spring.datasource.password=ENC(MaC28GJw2JcbH8Lil0CrqSDTYxX49FJ0rxcmHH2pX0k=)
|
||||
|
||||
logging.level.org.hibernate.SQL=DEBUG
|
||||
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
||||
|
||||
# 设置logback.xml位置
|
||||
logging.config=classpath:log/logback-test.xml
|
||||
|
||||
## xboe config
|
||||
xboe.api.cross_filter=true
|
||||
|
||||
## 上传相磁的路径配置
|
||||
xboe.upload.file.temp_path=/www/wwwroot/file/temp
|
||||
xboe.upload.file.save_path=/www/wwwroot/file/upload
|
||||
xboe.upload.file.http_path=http://114.115.162.187/file/upload
|
||||
|
||||
## 新系统的内部地址,可以不通过nginx调用
|
||||
xboe.inner.data.sync.baseurl=http://localhost:9090
|
||||
|
||||
#加密盐
|
||||
#jasypt.encryptor.password=jasypt
|
||||
jasypt.encryptor.algorithm=PBEWithMD5AndDES
|
||||
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
|
||||
@@ -0,0 +1,62 @@
|
||||
spring.profiles.active=@profileActive@
|
||||
spring.application.name=boe-server-basic
|
||||
server.port=9095
|
||||
server.servlet.session.timeout=30m
|
||||
|
||||
|
||||
server.servlet.encoding.charset=UTF-8
|
||||
server.servlet.encoding.enabled=true
|
||||
server.servlet.encoding.force=true
|
||||
|
||||
server.tomcat.uri-encoding=UTF-8
|
||||
|
||||
|
||||
|
||||
ok.http.connect-timeout=30
|
||||
ok.http.read-timeout=30
|
||||
ok.http.write-timeout=30
|
||||
|
||||
# 连接池中整体的空闲连接的最大数量
|
||||
ok.http.max-idle-connections=200
|
||||
# 连接空闲时间最多为 300 秒
|
||||
ok.http.keep-alive-duration=300
|
||||
|
||||
#spring.jackson.locale=
|
||||
#spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
|
||||
# spring.jackson.default-property-inclusion=NON_NULL
|
||||
spring.jackson.time-zone=GMT+8
|
||||
|
||||
spring.servlet.multipart.max-file-size=1024MB
|
||||
spring.servlet.multipart.max-request-size=1024MB
|
||||
|
||||
## 静态文件目录,默认是在static下面,以后独立到nginx下面配置
|
||||
spring.mvc.static-path-pattern=/cdn/**
|
||||
|
||||
spring.redis.lettuce.pool.max-active=8
|
||||
spring.redis.lettuce.pool.min-idle=0
|
||||
spring.redis.lettuce.pool.max-idle=30
|
||||
spring.redis.lettuce.pool.max-wait=10000ms
|
||||
spring.redis.lettuce.shutdown-timeout=100ms
|
||||
|
||||
# 上传的临时目录,部署到服务器必须指定
|
||||
# spring.servlet.multipart.location=
|
||||
|
||||
# jpa config
|
||||
spring.jpa.database = MYSQL
|
||||
spring.jpa.show-sql = true
|
||||
# spring.jpa.properties.hibernate.cache.use_second_level_cache=true
|
||||
# spring.jpa.properties.hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory
|
||||
|
||||
spring.jpa.properties.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy
|
||||
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
|
||||
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
|
||||
#spring.transaction
|
||||
# spring.jpa.properties.hibernate.allow_update_outside_transaction=true
|
||||
# spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
|
||||
spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
|
||||
|
||||
|
||||
# 设置logback.xml位置
|
||||
logging.config=classpath:log/logback-@profileActive@.xml
|
||||
|
||||
|
||||
54
servers/org-user-sync/src/main/resources/log/logback-dev.xml
Normal file
54
servers/org-user-sync/src/main/resources/log/logback-dev.xml
Normal file
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration debug="false" scan="false">
|
||||
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
|
||||
<property name="log.path" value="logs/${spring.application.name}"/>
|
||||
<!-- 彩色日志格式 -->
|
||||
<property name="CONSOLE_LOG_PATTERN"
|
||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
||||
<!-- 彩色日志依赖的渲染类 -->
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||
<conversionRule conversionWord="wex"
|
||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
||||
<conversionRule conversionWord="wEx"
|
||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
||||
<!-- Console log output -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Log file debug output -->
|
||||
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/debug.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Log file error output -->
|
||||
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>ERROR</level>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
</configuration>
|
||||
55
servers/org-user-sync/src/main/resources/log/logback-pro.xml
Normal file
55
servers/org-user-sync/src/main/resources/log/logback-pro.xml
Normal file
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration debug="false" scan="false">
|
||||
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
|
||||
<property name="log.path" value="/home/logs/${spring.application.name}"/>
|
||||
<!-- 彩色日志格式 -->
|
||||
<property name="CONSOLE_LOG_PATTERN"
|
||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
||||
<!-- 彩色日志依赖的渲染类 -->
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||
<conversionRule conversionWord="wex"
|
||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
||||
<conversionRule conversionWord="wEx"
|
||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
||||
<!-- Console log output -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Log file debug output -->
|
||||
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/debug.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Log file error output -->
|
||||
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>ERROR</level>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
||||
<root level="WARN">
|
||||
<appender-ref ref="debug"/>
|
||||
<appender-ref ref="error"/>
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration debug="false" scan="false">
|
||||
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
|
||||
<property name="log.path" value="logs/${spring.application.name}"/>
|
||||
<!-- 彩色日志格式 -->
|
||||
<property name="CONSOLE_LOG_PATTERN"
|
||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
||||
<!-- 彩色日志依赖的渲染类 -->
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||
<conversionRule conversionWord="wex"
|
||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
||||
<conversionRule conversionWord="wEx"
|
||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
||||
<!-- Console log output -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Log file debug output -->
|
||||
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/debug.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Log file error output -->
|
||||
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>ERROR</level>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="debug"/>
|
||||
<appender-ref ref="error"/>
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.xboe;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xboe.dto.OrganizationDto;
|
||||
import com.xboe.dto.UserDto;
|
||||
|
||||
public class BasicSyncTest {
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// OrganizationDto dto=new OrganizationDto();
|
||||
// dto.setCode("100001");
|
||||
// dto.setName("机构名称");
|
||||
// dto.setKid("1234-4567-3948");
|
||||
// dto.setSysLevel(0);
|
||||
// dto.setStatus(1);
|
||||
//
|
||||
// UserDto u=new UserDto();
|
||||
// u.setKid("02928-10231-01239-2392");
|
||||
// u.setLoginName("2029182");
|
||||
// u.setLearningDuration(0);
|
||||
// u.setGender(1);
|
||||
//
|
||||
// ObjectMapper om=new ObjectMapper();
|
||||
// try {
|
||||
// System.out.println(om.writeValueAsString(dto));
|
||||
// System.out.println(om.writeValueAsString(u));
|
||||
// } catch (JsonProcessingException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
}
|
||||
209
servers/org-user-sync/src/test/java/com/xboe/MultiDbTest.java
Normal file
209
servers/org-user-sync/src/test/java/com/xboe/MultiDbTest.java
Normal file
@@ -0,0 +1,209 @@
|
||||
package com.xboe;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import com.xboe.basic.dao.BasicOrganizationDao;
|
||||
import com.xboe.basic.dao.ErrorLogDao;
|
||||
import com.xboe.basic.entity.Organization;
|
||||
import com.xboe.basic.service.IBasicDataSyncService;
|
||||
import com.xboe.common.utils.IDGenerator;
|
||||
import com.xboe.dto.OrganizationDto;
|
||||
import com.xboe.primary.dao.MainAccountDao;
|
||||
import com.xboe.primary.dao.MainOrganizationDao;
|
||||
import com.xboe.primary.entity.MainOrganization;
|
||||
import com.xboe.primary.service.IMainDbSyncService;
|
||||
|
||||
//@SpringBootTest
|
||||
public class MultiDbTest {
|
||||
|
||||
// @Autowired
|
||||
// BasicOrganizationDao orgDao;
|
||||
//
|
||||
// @Autowired
|
||||
// MainOrganizationDao mainOrgDao;
|
||||
//
|
||||
// @Autowired
|
||||
// ErrorLogDao errDao;
|
||||
//
|
||||
// @Autowired
|
||||
// MainAccountDao mainAccountDao;
|
||||
//
|
||||
// @Autowired
|
||||
// IMainDbSyncService mainService;
|
||||
//
|
||||
// @Autowired
|
||||
// IBasicDataSyncService basicService;
|
||||
|
||||
|
||||
// @Test
|
||||
// @Transactional
|
||||
// public void testOrganizationDto() {
|
||||
//
|
||||
// OrganizationDto dto=new OrganizationDto();
|
||||
//
|
||||
// dto.setCode("100001");
|
||||
// dto.setName("机构名称");
|
||||
// dto.setKid("1234-4567-39048");
|
||||
// dto.setSysLevel(0);
|
||||
// dto.setStatus(1);
|
||||
//
|
||||
// Organization org=null;
|
||||
//
|
||||
// List<Organization> orgList=orgDao.getByKid(dto.getKid());
|
||||
//
|
||||
// if(!orgList.isEmpty()) {
|
||||
// org=orgList.get(0);
|
||||
// }
|
||||
// System.out.println("org");
|
||||
// System.out.println(org);
|
||||
// if(org==null) {//新增加
|
||||
// org=new Organization();
|
||||
// org.setId(IDGenerator.generate());
|
||||
// org.setKid(dto.getKid());
|
||||
//
|
||||
// org.setCode(org.getCode());
|
||||
// org.setCreateFrom(dto.getCreateFrom());
|
||||
// org.setSysCreateTime(dto.getCreateTime());
|
||||
// org.setDataFrom(dto.getDataFrom());
|
||||
// org.setDeleted(false);
|
||||
// org.setDescription(dto.getDescription());
|
||||
// org.setIsDefault(dto.getIsDefault());
|
||||
// org.setIsMakeOrg(dto.getIsMakeOrg());
|
||||
// org.setIsServiceSite(dto.getIsServiceSite());
|
||||
// org.setName(dto.getName());
|
||||
// org.setNamePath(dto.getNamePath());
|
||||
//
|
||||
// //org.setOrganizationLevel(dto.getSysLevel());
|
||||
// org.setSysLevel(dto.getSysLevel());
|
||||
// org.setRemark(dto.getRemark());
|
||||
// org.setSassId(dto.getSassId());
|
||||
// org.setShortName(dto.getShortName());
|
||||
// org.setStatus(dto.getStatus());
|
||||
// dto.setId(org.getId());
|
||||
// orgDao.save(org);
|
||||
//
|
||||
// }else {//更新
|
||||
//
|
||||
// if(dto.getDeleted()!=null && dto.getDeleted()) {
|
||||
// org.setDeleted(dto.getDeleted());
|
||||
// }
|
||||
// org.setDescription(dto.getDescription());
|
||||
// org.setIsDefault(dto.getIsDefault());
|
||||
// org.setIsMakeOrg(dto.getIsMakeOrg());
|
||||
// org.setIsServiceSite(dto.getIsServiceSite());
|
||||
// org.setName(dto.getName());
|
||||
// //org.setOrganizationLevel(dto.getSysLevel());
|
||||
// org.setSysLevel(dto.getSysLevel());
|
||||
// org.setRemark(dto.getRemark());
|
||||
// org.setSassId(dto.getSassId());
|
||||
// org.setShortName(dto.getShortName());
|
||||
// org.setStatus(dto.getStatus());
|
||||
// orgDao.save(org);
|
||||
// dto.setId(org.getId());
|
||||
// }
|
||||
//
|
||||
// MainOrganization hasOrg=null;
|
||||
// System.out.println("dto.id");
|
||||
// System.out.println("dto.id="+dto.getId());
|
||||
// hasOrg =mainOrgDao.get(dto.getId());
|
||||
// System.out.println("hasOrg");
|
||||
// //System.out.println(hasOrg);
|
||||
// System.out.println("hasOrg");
|
||||
// if(hasOrg!=null) {
|
||||
// System.out.println("hasOrg不为null");
|
||||
// System.out.println("hasOrg name ="+hasOrg.getName());
|
||||
//// if(dto.getDeleted()!=null && dto.getDeleted()) {
|
||||
//// hasOrg.setDeleted(dto.getDeleted());
|
||||
//// }
|
||||
//// //hasOrg.setDescription(dto.getDescription());
|
||||
//// hasOrg.setIsMakeOrg(dto.getIsMakeOrg());
|
||||
//// hasOrg.setIsServiceSite(dto.getIsServiceSite());
|
||||
//// hasOrg.setName(dto.getName());
|
||||
//// hasOrg.setParentId(dto.getParentId());
|
||||
//// //hasOrg.setNamePath(dto.getn);
|
||||
//// hasOrg.setStatus(dto.getStatus());
|
||||
//// mainOrgDao.save(hasOrg);
|
||||
// }else {
|
||||
// System.out.println("hasOrg 是 null");
|
||||
// //hasOrg =orgDao.getBySysId(dto.getKid());
|
||||
// hasOrg=new MainOrganization();
|
||||
// hasOrg.setId(dto.getId());
|
||||
// hasOrg.setCode(dto.getCode());
|
||||
// hasOrg.setCompanyId(dto.getSassId());
|
||||
// hasOrg.setDeleted(false);
|
||||
// hasOrg.setDescription(dto.getDescription());
|
||||
// //hasOrg.setDomainId(dto.getD);
|
||||
// hasOrg.setIsDefaultOrganization(true);
|
||||
// hasOrg.setStatus(dto.getStatus());
|
||||
// hasOrg.setIsMakeOrg(dto.getIsMakeOrg());
|
||||
// hasOrg.setIsServiceSite(dto.getIsServiceSite());
|
||||
// hasOrg.setName(dto.getName());
|
||||
// hasOrg.setNamePath(dto.getNamePath());
|
||||
// hasOrg.setOrganizationLevel(dto.getOrganizationLevel());
|
||||
// //hasOrg.setOrgnizationManagerId(dto.get);
|
||||
// hasOrg.setParentId(dto.getParentId());
|
||||
// //hasOrg.setSysCreateAid();//创建人没有这个数据
|
||||
// hasOrg.setSysCreateBy("同步基础数据");
|
||||
// hasOrg.setSysCreateTime(LocalDateTime.now());
|
||||
// hasOrg.setSysId(dto.getKid());
|
||||
// hasOrg.setSysParentId(dto.getParentId());
|
||||
// hasOrg.setSysUpdateBy("");
|
||||
// hasOrg.setSysUpdateTime(hasOrg.getSysCreateTime());
|
||||
// mainOrgDao.save(hasOrg);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
// @Test
|
||||
// @Transactional
|
||||
// public void userSave() {
|
||||
//
|
||||
// OrganizationDto dto=new OrganizationDto();
|
||||
//
|
||||
// dto.setCode("100001");
|
||||
// dto.setName("机构名称");
|
||||
// dto.setKid("1234-4567-3948");
|
||||
// dto.setSysLevel(0);
|
||||
// dto.setStatus(1);
|
||||
// //Organization org=orgDao.findOne(FieldFilters.eq("kid", dto.getKid()));
|
||||
// basicService.syncOrganization(dto);
|
||||
// mainService.syncOrganization(dto);
|
||||
//
|
||||
// }
|
||||
|
||||
// @Test
|
||||
// @Transactional
|
||||
// public void userSave1() {
|
||||
//
|
||||
// ErrorLog error=new ErrorLog();
|
||||
// error.setId(IDGenerator.generate());
|
||||
// error.setDataType(1);
|
||||
// error.setDataId("1");
|
||||
// error.setLogObject("{}");
|
||||
// error.setLogTime(LocalDateTime.now());
|
||||
// error.setType(1);
|
||||
// errDao.save(error);
|
||||
//
|
||||
// MainAccount ma=new MainAccount();
|
||||
// ma.setId(IDGenerator.generate());
|
||||
// ma.setAvatar("");
|
||||
// ma.setLoginName("aaaaa");
|
||||
// ma.setPassKey("");
|
||||
// ma.setPassValue("");
|
||||
// ma.setRegTime(LocalDateTime.now());
|
||||
// ma.setStatus(1);
|
||||
// ma.setSysId("1");
|
||||
// ma.setDeleted(false);
|
||||
// mainAccountDao.save(ma);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user