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