mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-12 04:16:51 +08:00
用户同步增加日志打印,优化代码
This commit is contained in:
@@ -41,6 +41,7 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
|||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void syncUserFull(UserData user) {
|
public void syncUserFull(UserData user) {
|
||||||
|
log.info("同步用户【"+user.getId()+","+user.getCode()+"】");
|
||||||
//如果删除状态为空,则设置为不删除
|
//如果删除状态为空,则设置为不删除
|
||||||
if(user.getDeleted()==null) {
|
if(user.getDeleted()==null) {
|
||||||
user.setDeleted(false);
|
user.setDeleted(false);
|
||||||
@@ -56,6 +57,7 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
|||||||
}
|
}
|
||||||
a.setLoginName(user.getCode());
|
a.setLoginName(user.getCode());
|
||||||
log.info("更新账号code");
|
log.info("更新账号code");
|
||||||
|
accountDao.update(a);
|
||||||
}else {
|
}else {
|
||||||
//新账户
|
//新账户
|
||||||
a=new Account();
|
a=new Account();
|
||||||
@@ -66,6 +68,7 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
|||||||
a.setRegTime(LocalDateTime.now());
|
a.setRegTime(LocalDateTime.now());
|
||||||
a.setSysId(user.getKid());
|
a.setSysId(user.getKid());
|
||||||
a.setStatus(1);
|
a.setStatus(1);
|
||||||
|
accountDao.save(a);
|
||||||
log.info("账号不存在,新添加账号【"+user.getId()+"】");
|
log.info("账号不存在,新添加账号【"+user.getId()+"】");
|
||||||
}
|
}
|
||||||
if(u!=null) {
|
if(u!=null) {
|
||||||
@@ -78,6 +81,7 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
|||||||
if(user.getLearningDuration()>0) { //不大于0才会更新
|
if(user.getLearningDuration()>0) { //不大于0才会更新
|
||||||
u.setLearningDuration(user.getLearningDuration());
|
u.setLearningDuration(user.getLearningDuration());
|
||||||
}
|
}
|
||||||
|
userDao.update(u);
|
||||||
log.info("更新用户信息,学习时长,姓名,所在部门");
|
log.info("更新用户信息,学习时长,姓名,所在部门");
|
||||||
}else {
|
}else {
|
||||||
//新建用户
|
//新建用户
|
||||||
@@ -99,6 +103,7 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
|||||||
}else {
|
}else {
|
||||||
u.setShowHome(true);//band16以下,及其它无bandLevel的信息
|
u.setShowHome(true);//band16以下,及其它无bandLevel的信息
|
||||||
}
|
}
|
||||||
|
userDao.save(u);
|
||||||
log.info("添加新用户");
|
log.info("添加新用户");
|
||||||
}
|
}
|
||||||
//对机构的判断,不为空时才会处理,为空时不处理
|
//对机构的判断,不为空时才会处理,为空时不处理
|
||||||
@@ -113,19 +118,16 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
|||||||
org.setNamePath(user.getOrgNamePath());
|
org.setNamePath(user.getOrgNamePath());
|
||||||
org.setDeleted(false);
|
org.setDeleted(false);
|
||||||
org.setStatus(1);
|
org.setStatus(1);
|
||||||
|
orgDao.save(org);
|
||||||
|
}else {
|
||||||
|
org.setName(user.getDepartName());
|
||||||
|
org.setNamePath(user.getOrgNamePath());
|
||||||
|
orgDao.update(org);
|
||||||
}
|
}
|
||||||
org.setName(user.getDepartName());
|
|
||||||
org.setNamePath(user.getOrgNamePath());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//先提交一下
|
||||||
accountDao.saveOrUpdate(a);
|
|
||||||
userDao.saveOrUpdate(u);
|
|
||||||
userDao.flush();
|
userDao.flush();
|
||||||
if(org!=null) {
|
|
||||||
orgDao.saveOrUpdate(org);
|
|
||||||
log.info("更新用户对应的机构信息");
|
|
||||||
}
|
|
||||||
//老师信息
|
//老师信息
|
||||||
if(u.getUserType()!=null && u.getUserType()==2) {
|
if(u.getUserType()!=null && u.getUserType()==2) {
|
||||||
Teacher t = teacherDao.get(u.getId());
|
Teacher t = teacherDao.get(u.getId());
|
||||||
@@ -145,6 +147,7 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
|||||||
log.info("教师身份已添加");
|
log.info("教师身份已添加");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log.info("同步用户完成");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ public class BasicDataSyncServiceImpl implements IBasicDataSyncService{
|
|||||||
hasOrg.setSysCreateTime(LocalDateTime.now());
|
hasOrg.setSysCreateTime(LocalDateTime.now());
|
||||||
hasOrg.setSysId(dto.getKid());
|
hasOrg.setSysId(dto.getKid());
|
||||||
hasOrg.setSysParentId(dto.getParentId());
|
hasOrg.setSysParentId(dto.getParentId());
|
||||||
hasOrg.setSysUpdateBy("");
|
// hasOrg.setSysUpdateBy("");
|
||||||
hasOrg.setSysUpdateTime(hasOrg.getSysCreateTime());
|
// hasOrg.setSysUpdateTime(hasOrg.getSysCreateTime());
|
||||||
orgDao.save(hasOrg);
|
orgDao.save(hasOrg);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import javax.persistence.Entity;
|
|||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import com.xboe.core.SysConstant;
|
import com.xboe.core.SysConstant;
|
||||||
import com.xboe.core.orm.BaseEntity;
|
import com.xboe.core.orm.IdBaseEntity;
|
||||||
|
import com.xboe.core.orm.annotation.MetaInfo;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@@ -17,14 +18,18 @@ import lombok.EqualsAndHashCode;
|
|||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = SysConstant.TABLE_PRE + "organization")
|
@Table(name = SysConstant.TABLE_PRE + "organization")
|
||||||
public class Organization extends BaseEntity {
|
public class Organization extends IdBaseEntity {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 原系统ID
|
* 原系统ID
|
||||||
*/
|
*/
|
||||||
@Column(name = "sys_id", length = 36)
|
@Column(name = "sys_id", length = 36)
|
||||||
private String sysId;
|
private String sysId;
|
||||||
|
|
||||||
|
@MetaInfo("删除的")
|
||||||
|
@Column(name = "deleted", length = 1)
|
||||||
|
private Boolean deleted;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 旧系统父id
|
* 旧系统父id
|
||||||
|
|||||||
Reference in New Issue
Block a user