mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-07 01:46:47 +08:00
一次性修改数据
This commit is contained in:
169
servers/modify-221027/pom.xml
Normal file
169
servers/modify-221027/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>modify-221027</artifactId>
|
||||||
|
<version>2.0.0</version>
|
||||||
|
<name>modify-221027</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;
|
||||||
|
}
|
||||||
|
}
|
||||||
137
servers/modify-221027/src/main/java/com/xboe/StartRunner.java
Normal file
137
servers/modify-221027/src/main/java/com/xboe/StartRunner.java
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
package com.xboe;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.ApplicationArguments;
|
||||||
|
import org.springframework.boot.ApplicationRunner;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.xboe.basic.entity.OldOrganization;
|
||||||
|
import com.xboe.basic.entity.OldUser;
|
||||||
|
import com.xboe.basic.service.IOldService;
|
||||||
|
import com.xboe.primary.entity.MainOrganization;
|
||||||
|
import com.xboe.primary.entity.MainUser;
|
||||||
|
import com.xboe.primary.service.IMainDbSyncService;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启动执行一次
|
||||||
|
* @author seastar
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class StartRunner implements ApplicationRunner {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
IOldService oldService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
IMainDbSyncService mainService;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(ApplicationArguments args) throws Exception {
|
||||||
|
//用于存放 kid=newId
|
||||||
|
|
||||||
|
Map<String,String> mainOrgMap=new HashMap<String,String>();
|
||||||
|
try {
|
||||||
|
//同步机构
|
||||||
|
List<OldOrganization> allList =oldService.listAll();
|
||||||
|
for(OldOrganization org :allList) {
|
||||||
|
|
||||||
|
MainOrganization mainOrg = mainService.findByKid(org.getKid());
|
||||||
|
|
||||||
|
if(mainOrg==null) {
|
||||||
|
//添加
|
||||||
|
mainOrg=organizationToEntity(org);
|
||||||
|
mainService.save(mainOrg);
|
||||||
|
}else {
|
||||||
|
//更新
|
||||||
|
copyOrganizationToEntity(mainOrg,org);
|
||||||
|
mainService.update(mainOrg);
|
||||||
|
}
|
||||||
|
|
||||||
|
mainOrgMap.put(org.getKid(),mainOrg.getId());//
|
||||||
|
|
||||||
|
}
|
||||||
|
//同步用户信息
|
||||||
|
//查询出本地用户
|
||||||
|
List<MainUser> allUsers=mainService.findAll();
|
||||||
|
for(MainUser mainUser : allUsers) {
|
||||||
|
|
||||||
|
OldUser oldUser = oldService.getByUserKid(mainUser.getSysId());
|
||||||
|
if(oldUser!=null) {
|
||||||
|
|
||||||
|
String newId=mainOrgMap.get(oldUser.getOrgnizationId());
|
||||||
|
|
||||||
|
if(StringUtils.isBlank(newId)) {
|
||||||
|
log.error("未找到【"+oldUser.getKid()+"】对应的机构id,不更新用户");
|
||||||
|
}else {
|
||||||
|
mainUser.setSysDepartId(oldUser.getOrgnizationId());
|
||||||
|
mainUser.setCompanyId(oldUser.getCompanyId());
|
||||||
|
mainUser.setDepartId(newId);
|
||||||
|
mainService.updateUser(mainUser);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("执行失败",e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void copyOrganizationToEntity(MainOrganization ov ,OldOrganization org) {
|
||||||
|
ov.setCode(org.getOrgnizationCode());
|
||||||
|
ov.setName(org.getOrgnizationName());
|
||||||
|
ov.setSysId(org.getKid());
|
||||||
|
ov.setSysParentId(org.getParentOrgnizationId());
|
||||||
|
ov.setDescription(org.getDescription());
|
||||||
|
ov.setCompanyId(org.getCompanyId());
|
||||||
|
ov.setDomainId(org.getDomainId());
|
||||||
|
ov.setNamePath(org.getNamePath());
|
||||||
|
ov.setOrgnizationManagerId(org.getOrgnizationManagerId());
|
||||||
|
ov.setOrganizationLevel(org.getOrganizationLevel());
|
||||||
|
if(StringUtils.isNotBlank(org.getIsMakeOrg())){
|
||||||
|
ov.setIsMakeOrg("1".equals(org.getIsMakeOrg()));//0:否,1:是
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(org.getIsServiceSite())) {
|
||||||
|
ov.setIsServiceSite("1".equals(org.getIsServiceSite()));//0:否,1:是
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(org.getIsDefaultOrganization())) {
|
||||||
|
ov.setIsDefaultOrganization("1".equals(org.getIsDefaultOrganization()));//0:否,1:是
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(org.getStatus())) {
|
||||||
|
ov.setStatus(Integer.parseInt(org.getStatus()));
|
||||||
|
}else{
|
||||||
|
ov.setStatus(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(org.getIsDeleted()!=null) {
|
||||||
|
ov.setDeleted(org.getIsDeleted()==0? false:true); //0:正常,1:已删除
|
||||||
|
}else {
|
||||||
|
ov.setDeleted(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转化对象
|
||||||
|
* @param org
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private MainOrganization organizationToEntity(OldOrganization org) {
|
||||||
|
MainOrganization ov = new MainOrganization();
|
||||||
|
copyOrganizationToEntity(ov,org);
|
||||||
|
return ov;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.xboe.basic.api;
|
||||||
|
|
||||||
|
import com.xboe.core.JsonResponse;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/org-user")
|
||||||
|
public class userOrgApi {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新系统查询老系统添加或者更新机构
|
||||||
|
* */
|
||||||
|
@GetMapping("/save-org")
|
||||||
|
public JsonResponse<Boolean> saveOrg(){
|
||||||
|
//查询数据
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新系统查出用户 并根据老库 更新sys_depart_id,commany_id
|
||||||
|
* */
|
||||||
|
@GetMapping("/save-user")
|
||||||
|
public JsonResponse<Boolean> saveUser(){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package com.xboe.basic.dao;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.xboe.basic.entity.OldOrganization;
|
||||||
|
import com.xboe.common.PageList;
|
||||||
|
import com.xboe.core.orm.BaseDao;
|
||||||
|
import com.xboe.core.orm.FieldFilters;
|
||||||
|
import com.xboe.core.orm.QueryBuilder;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 老系统的机构
|
||||||
|
* */
|
||||||
|
@Slf4j
|
||||||
|
@Repository
|
||||||
|
public class OldOrganizationDao extends BaseDao<OldOrganization> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部机构信息
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<OldOrganization> listAll() {
|
||||||
|
// 删除状态的也同步,用于解决删除数据问题
|
||||||
|
//filters.add(FieldFilters.eq("isDeleted", Constants.DELETED_NORMAL));
|
||||||
|
//String hql="Select org,tn.namePath from FwOrganization org,FwOrgTreeNode tn where org.treeNodeId=tn.kid and tn.isDeleted=0";
|
||||||
|
|
||||||
|
QueryBuilder query=QueryBuilder.from("OldOrganization org,OldTreeNode tn");
|
||||||
|
query.addFields("org","tn.namePath");
|
||||||
|
|
||||||
|
query.addFilter(FieldFilters.eqField("org.treeNodeId", "tn.kid"));
|
||||||
|
query.addFilter(FieldFilters.eq("org.isDeleted", 0));
|
||||||
|
|
||||||
|
|
||||||
|
List<OldOrganization> list=new ArrayList<OldOrganization>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
List<Object[]> rs = this.findListFields(query.builder());
|
||||||
|
//List<Object[]> rs=this.findListFields(query.builder());
|
||||||
|
for(Object[] objs : rs) {
|
||||||
|
OldOrganization fworg=(OldOrganization)objs[0];
|
||||||
|
String namePath=(String)objs[1];
|
||||||
|
fworg.setNamePath(namePath);
|
||||||
|
list.add(fworg);
|
||||||
|
}
|
||||||
|
}catch(Exception e) {
|
||||||
|
log.error("查询机构信息错误",e);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.xboe.basic.dao;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.xboe.basic.entity.OldUser;
|
||||||
|
import com.xboe.core.orm.BaseDao;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class OldUserDao extends BaseDao<OldUser>{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
package com.xboe.basic.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Entity
|
||||||
|
@Table(name = "eln_fw_orgnization")
|
||||||
|
public class OldOrganization {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织部门ID
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
@Column(name = "kid", length = 150)
|
||||||
|
private String kid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 树节点ID
|
||||||
|
*/
|
||||||
|
@Column(name = "tree_node_id", length = 150)
|
||||||
|
private String treeNodeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父组织部门ID
|
||||||
|
*/
|
||||||
|
@Column(name = "parent_orgnization_id", length = 150)
|
||||||
|
private String parentOrgnizationId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业ID
|
||||||
|
*/
|
||||||
|
@Column(name = "company_id", length = 150)
|
||||||
|
private String companyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 域ID
|
||||||
|
*/
|
||||||
|
@Column(name = "domain_id", length = 150)
|
||||||
|
private String domainId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织部门代码
|
||||||
|
*/
|
||||||
|
@Column(name = "orgnization_code", length = 150)
|
||||||
|
private String orgnizationCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织名
|
||||||
|
*/
|
||||||
|
@Column(name = "orgnization_name", length = 150)
|
||||||
|
private String orgnizationName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
@Column(name = "description", columnDefinition = "text")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织部门经理ID
|
||||||
|
*/
|
||||||
|
@Column(name = "orgnization_manager_id", length = 150)
|
||||||
|
private String orgnizationManagerId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织级别orgnization_level
|
||||||
|
*/
|
||||||
|
@Column(name = "orgnization_level", length = 150)
|
||||||
|
private String organizationLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否制造组织
|
||||||
|
* 0:否,1:是
|
||||||
|
*/
|
||||||
|
@Column(name = "is_make_org", length = 3)
|
||||||
|
private String isMakeOrg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否服务现地
|
||||||
|
* 0:否,1:是
|
||||||
|
*/
|
||||||
|
@Column(name = "is_service_site", length = 3)
|
||||||
|
private String isServiceSite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否默认注册组织
|
||||||
|
* 0:否,1:是
|
||||||
|
*/
|
||||||
|
@Column(name = "is_default_orgnization", length = 3)
|
||||||
|
private String isDefaultOrganization;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
* 0:临时,1:正常,2:停用
|
||||||
|
*/
|
||||||
|
@Column(name = "status", length = 3)
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织全路径
|
||||||
|
*/
|
||||||
|
@Column(name = "orgnization_name_path")
|
||||||
|
private String namePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号
|
||||||
|
*/
|
||||||
|
@Column(name = "version", length = 11)
|
||||||
|
private Integer version;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据来源
|
||||||
|
*/
|
||||||
|
@Column(name = "data_from", length = 150)
|
||||||
|
private String dataFrom;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人ID
|
||||||
|
*/
|
||||||
|
@Column(name = "created_by", length = 150)
|
||||||
|
private String createdBy;
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 创建时间
|
||||||
|
// */
|
||||||
|
// @Column(name = "created_at")
|
||||||
|
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
// @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
// private Date createdAt;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 创建来源
|
||||||
|
// */
|
||||||
|
// @Column(name = "created_from", length = 150)
|
||||||
|
// private String createdFrom;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 创建IP
|
||||||
|
// */
|
||||||
|
// @Column(name = "created_ip", length = 150)
|
||||||
|
// private String createdIp;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 更新人ID
|
||||||
|
// */
|
||||||
|
// @Column(name = "updated_by", length = 150)
|
||||||
|
// private String updatedBy;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 更新时间
|
||||||
|
// */
|
||||||
|
// @Column(name = "updated_at")
|
||||||
|
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
// @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
// private Date updatedAt;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 更新来源
|
||||||
|
// */
|
||||||
|
// @Column(name = "updated_from", length = 150)
|
||||||
|
// private String updatedFrom;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 更新IP
|
||||||
|
// */
|
||||||
|
// @Column(name = "updated_ip", length = 150)
|
||||||
|
// private String updatedIp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除标记;0:正常,1:已删除
|
||||||
|
*/
|
||||||
|
@Column(name = "is_deleted", length = 3)
|
||||||
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.xboe.basic.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机构treeNode表
|
||||||
|
* @author seastar
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Entity
|
||||||
|
@Table(name = "eln_fw_tree_node")
|
||||||
|
public class OldTreeNode {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(name = "kid", length = 36)
|
||||||
|
private String kid;
|
||||||
|
|
||||||
|
@Column(name = "tree_node_name", length = 100)
|
||||||
|
private String nodeName;
|
||||||
|
|
||||||
|
@Column(name = "node_name_path", length = 500)
|
||||||
|
private String namePath;
|
||||||
|
|
||||||
|
@Column(name = "is_deleted", length = 1)
|
||||||
|
private Integer isDeleted;
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.xboe.basic.entity;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户信息表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Entity
|
||||||
|
@Table(name = "eln_fw_user")
|
||||||
|
public class OldUser implements java.io.Serializable{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
@Column(name = "kid", length = 150)
|
||||||
|
private String kid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 员工编号
|
||||||
|
*/
|
||||||
|
@Column(name = "user_no", length = 90)
|
||||||
|
private String userNo;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态;0:临时,1:正常,2:停用
|
||||||
|
*/
|
||||||
|
@Column(name = "status", length = 3)
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业ID
|
||||||
|
*/
|
||||||
|
@Column(name = "company_id", length = 150)
|
||||||
|
private String companyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织部门ID
|
||||||
|
*/
|
||||||
|
@Column(name = "orgnization_id", length = 150)
|
||||||
|
private String orgnizationId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除标记;0:正常,1:已删除
|
||||||
|
*/
|
||||||
|
@Column(name = "is_deleted", length = 3)
|
||||||
|
private String isDeleted;
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.xboe.basic.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.xboe.basic.entity.OldOrganization;
|
||||||
|
import com.xboe.basic.entity.OldUser;
|
||||||
|
|
||||||
|
public interface IOldService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询指定条数的机构信息
|
||||||
|
*
|
||||||
|
* @param pageIndex
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<OldOrganization> listAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据kid获取用户信息
|
||||||
|
* @param kid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
OldUser getByUserKid(String kid);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.xboe.basic.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.xboe.basic.dao.OldOrganizationDao;
|
||||||
|
import com.xboe.basic.dao.OldUserDao;
|
||||||
|
import com.xboe.basic.entity.OldOrganization;
|
||||||
|
import com.xboe.basic.entity.OldUser;
|
||||||
|
import com.xboe.basic.service.IOldService;
|
||||||
|
import com.xboe.common.OrderCondition;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 老系统的机构
|
||||||
|
* */
|
||||||
|
@Service
|
||||||
|
public class OldServiceImpl implements IOldService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
OldOrganizationDao dao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
OldUserDao userDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<OldOrganization> listAll() {
|
||||||
|
List<OldOrganization> list = dao.listAll();
|
||||||
|
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OldUser getByUserKid(String kid) {
|
||||||
|
|
||||||
|
return userDao.get(kid);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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/modify-221027/src/main/java/com/xboe/dto/UserDto.java
Normal file
152
servers/modify-221027/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,29 @@
|
|||||||
|
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);
|
||||||
|
|
||||||
|
@Query(value = "from MainOrganization where sysId=?1")
|
||||||
|
public List<MainOrganization> findBySysId(String sysId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
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.MainUser;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户DAO
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
@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);
|
||||||
|
|
||||||
|
@Modifying
|
||||||
|
@Query(value = "update MainUser set departId=?1, sysDepartId=?2,companyId=?3 where id=?4")
|
||||||
|
public Integer update(String departId,String sysDepartId,String companyId,String id);
|
||||||
|
|
||||||
|
|
||||||
|
@Query(value = "from MainUser where id=?1")
|
||||||
|
public MainUser get(String id);
|
||||||
|
|
||||||
|
|
||||||
|
@Query(value = "Select new MainUser(id,sysId,userNo) from MainUser where id=?1")
|
||||||
|
public List<MainUser> findAll(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,83 @@
|
|||||||
|
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.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;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所在公司
|
||||||
|
*/
|
||||||
|
@Column(name = "company_id", length = 36)
|
||||||
|
private String companyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所在部门
|
||||||
|
*/
|
||||||
|
@Column(name = "depart_id", length = 20)
|
||||||
|
private String departId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扩展字段,多租户系统的标识值
|
||||||
|
*/
|
||||||
|
@Column(name = "sass_id", length = 36)
|
||||||
|
private String sassId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除标识
|
||||||
|
* */
|
||||||
|
@Column(name="deleted",length = 1)
|
||||||
|
private Boolean deleted;
|
||||||
|
|
||||||
|
public MainUser() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public MainUser(String id,String sysId,String userNo) {
|
||||||
|
this.setId(id);
|
||||||
|
this.sysId=sysId;
|
||||||
|
this.userNo=userNo;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.xboe.primary.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.xboe.primary.entity.MainOrganization;
|
||||||
|
import com.xboe.primary.entity.MainUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 基本数据同步的相关处理
|
||||||
|
* @author seastar
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IMainDbSyncService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有的用户
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<MainUser> findAll();
|
||||||
|
|
||||||
|
MainOrganization findByKid(String kid);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void save(MainOrganization mainOrg);
|
||||||
|
|
||||||
|
void update(MainOrganization mainOrg);
|
||||||
|
|
||||||
|
void updateUser(MainUser muser);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package com.xboe.primary.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.xboe.common.utils.IDGenerator;
|
||||||
|
import com.xboe.primary.dao.MainAccountDao;
|
||||||
|
import com.xboe.primary.dao.MainOrganizationDao;
|
||||||
|
import com.xboe.primary.dao.MainUserDao;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional("transactionManagerPrimary")
|
||||||
|
public MainOrganization findByKid(String kid) {
|
||||||
|
List<MainOrganization> orgs=orgDao.findBySysId(kid);
|
||||||
|
if(orgs!=null && !orgs.isEmpty()) {
|
||||||
|
return orgs.get(0);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional("transactionManagerPrimary")
|
||||||
|
public void save(MainOrganization mainOrg) {
|
||||||
|
mainOrg.setId(IDGenerator.generate());
|
||||||
|
orgDao.save(mainOrg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional("transactionManagerPrimary")
|
||||||
|
public void update(MainOrganization mainOrg) {
|
||||||
|
orgDao.save(mainOrg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MainUser> findAll() {
|
||||||
|
|
||||||
|
return userDao.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateUser(MainUser muser) {
|
||||||
|
userDao.update(muser.getDepartId(),muser.getSysDepartId(),muser.getCompanyId(),muser.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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=10.251.160.38
|
||||||
|
spring.redis.password=qwert!W577
|
||||||
|
spring.redis.port=6379
|
||||||
|
|
||||||
|
# datasource config
|
||||||
|
# basic数据库
|
||||||
|
spring.jpa.hibernate.ddl-auto=none
|
||||||
|
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
|
||||||
|
# 原数据库 old 对应的数据库
|
||||||
|
spring.datasource.db1.driverClassName=com.mysql.jdbc.Driver
|
||||||
|
spring.datasource.db1.jdbc-url=jdbc:mysql://10.251.129.126:3306/elearninglms?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||||
|
spring.datasource.db1.username=admin
|
||||||
|
spring.datasource.db1.password=boeRds01
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 新主数据库 all 对应的数据库
|
||||||
|
spring.datasource.db2.driverClassName=com.mysql.jdbc.Driver
|
||||||
|
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||||
|
spring.datasource.db2.jdbc-url=jdbc:mysql://10.251.129.126:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||||
|
spring.datasource.db2.username=admin
|
||||||
|
spring.datasource.db2.password=boeRds01
|
||||||
|
|
||||||
|
|
||||||
|
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=
|
||||||
|
xboe.upload.file.save_path=
|
||||||
|
xboe.upload.file.http_path=
|
||||||
|
|
||||||
|
## 新系统的内部地址,可以不通过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=9096
|
||||||
|
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/modify-221027/src/main/resources/log/logback-dev.xml
Normal file
54
servers/modify-221027/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/modify-221027/src/main/resources/log/logback-pro.xml
Normal file
55
servers/modify-221027/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();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
}
|
||||||
189
servers/modify-221027/src/test/java/com/xboe/MultiDbTest.java
Normal file
189
servers/modify-221027/src/test/java/com/xboe/MultiDbTest.java
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
package com.xboe;
|
||||||
|
|
||||||
|
//@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