mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-10 03:16:48 +08:00
修改同步信息
This commit is contained in:
@@ -61,7 +61,7 @@ public class StartRunner implements ApplicationRunner {
|
||||
mainOrgMap.put(org.getKid(),mainOrg.getId());//
|
||||
|
||||
}
|
||||
//同步用户信息
|
||||
//同步用户信息,2022/11/04同步用户学习时长
|
||||
//查询出本地用户
|
||||
List<MainUser> allUsers=mainService.findAll();
|
||||
for(MainUser mainUser : allUsers) {
|
||||
@@ -72,13 +72,23 @@ public class StartRunner implements ApplicationRunner {
|
||||
String newId=mainOrgMap.get(oldUser.getOrgnizationId());
|
||||
|
||||
if(StringUtils.isBlank(newId)) {
|
||||
log.error("未找到【"+oldUser.getKid()+"】对应的机构id,不更新用户");
|
||||
log.error("本地未找到【"+oldUser.getKid()+"】对应的机构id,不更新用户");
|
||||
}else {
|
||||
mainUser.setSysDepartId(oldUser.getOrgnizationId());
|
||||
mainUser.setCompanyId(oldUser.getCompanyId());
|
||||
mainUser.setDepartId(newId);
|
||||
|
||||
mainUser.setLearningDuration(oldUser.getLearningDuration());
|
||||
mainUser.setStatus(oldUser.getStatus());
|
||||
if(oldUser.getIsDeleted()!=null) {
|
||||
mainUser.setDeleted(oldUser.getIsDeleted()==0? false:true);
|
||||
}
|
||||
mainService.updateUser(mainUser);
|
||||
}
|
||||
}else {
|
||||
//本地应该删除
|
||||
log.error("原系统中无【"+oldUser.getKid()+"】对应的用户id,本地标识删除此用户");
|
||||
mainService.deleteAccount(mainUser.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public class OldUser implements java.io.Serializable{
|
||||
* 状态;0:临时,1:正常,2:停用
|
||||
*/
|
||||
@Column(name = "status", length = 3)
|
||||
private String status;
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 企业ID
|
||||
@@ -50,10 +50,14 @@ public class OldUser implements java.io.Serializable{
|
||||
*/
|
||||
@Column(name = "orgnization_id", length = 150)
|
||||
private String orgnizationId;
|
||||
|
||||
/**用户学习时长*/
|
||||
@Column(name = "learning_duration")
|
||||
private Float learningDuration;
|
||||
|
||||
/**
|
||||
* 删除标记;0:正常,1:已删除
|
||||
*/
|
||||
@Column(name = "is_deleted", length = 3)
|
||||
private String isDeleted;
|
||||
private Integer isDeleted;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ 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;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,7 +15,10 @@ 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);
|
||||
|
||||
@Modifying
|
||||
@Query(value = "update MainAccount set status=?1,deleted=?2 where id=?3")
|
||||
public Integer updateStatusAndDeleted(Integer status,Boolean deleted,String id);
|
||||
|
||||
}
|
||||
|
||||
@@ -64,6 +64,10 @@ public class MainUser extends IdEntity {
|
||||
*/
|
||||
@Column(name = "sass_id", length = 36)
|
||||
private String sassId;
|
||||
|
||||
/**用户学习时长*/
|
||||
@Column(name = "learning_duration")
|
||||
private Float learningDuration;
|
||||
|
||||
/**
|
||||
* 删除标识
|
||||
@@ -71,6 +75,11 @@ public class MainUser extends IdEntity {
|
||||
@Column(name="deleted",length = 1)
|
||||
private Boolean deleted;
|
||||
|
||||
/**
|
||||
* 用户的状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
public MainUser() {
|
||||
|
||||
}
|
||||
|
||||
@@ -27,5 +27,11 @@ public interface IMainDbSyncService {
|
||||
void update(MainOrganization mainOrg);
|
||||
|
||||
void updateUser(MainUser muser);
|
||||
|
||||
/**
|
||||
* 把账号设置为已删除
|
||||
* @param id
|
||||
*/
|
||||
void deleteAccount(String id);
|
||||
|
||||
}
|
||||
|
||||
@@ -59,10 +59,18 @@ public class MainDbSyncServiceImpl implements IMainDbSyncService {
|
||||
|
||||
return userDao.findAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional("transactionManagerPrimary")
|
||||
public void deleteAccount(String id) {
|
||||
accountDao.setDeleted(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional("transactionManagerPrimary")
|
||||
public void updateUser(MainUser muser) {
|
||||
userDao.update(muser.getDepartId(),muser.getSysDepartId(),muser.getCompanyId(),muser.getId());
|
||||
accountDao.updateStatusAndDeleted(muser.getStatus(),muser.getDeleted(), muser.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user