mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-11 20:06:51 +08:00
修改同步信息
This commit is contained in:
@@ -61,7 +61,7 @@ public class StartRunner implements ApplicationRunner {
|
|||||||
mainOrgMap.put(org.getKid(),mainOrg.getId());//
|
mainOrgMap.put(org.getKid(),mainOrg.getId());//
|
||||||
|
|
||||||
}
|
}
|
||||||
//同步用户信息
|
//同步用户信息,2022/11/04同步用户学习时长
|
||||||
//查询出本地用户
|
//查询出本地用户
|
||||||
List<MainUser> allUsers=mainService.findAll();
|
List<MainUser> allUsers=mainService.findAll();
|
||||||
for(MainUser mainUser : allUsers) {
|
for(MainUser mainUser : allUsers) {
|
||||||
@@ -72,13 +72,23 @@ public class StartRunner implements ApplicationRunner {
|
|||||||
String newId=mainOrgMap.get(oldUser.getOrgnizationId());
|
String newId=mainOrgMap.get(oldUser.getOrgnizationId());
|
||||||
|
|
||||||
if(StringUtils.isBlank(newId)) {
|
if(StringUtils.isBlank(newId)) {
|
||||||
log.error("未找到【"+oldUser.getKid()+"】对应的机构id,不更新用户");
|
log.error("本地未找到【"+oldUser.getKid()+"】对应的机构id,不更新用户");
|
||||||
}else {
|
}else {
|
||||||
mainUser.setSysDepartId(oldUser.getOrgnizationId());
|
mainUser.setSysDepartId(oldUser.getOrgnizationId());
|
||||||
mainUser.setCompanyId(oldUser.getCompanyId());
|
mainUser.setCompanyId(oldUser.getCompanyId());
|
||||||
mainUser.setDepartId(newId);
|
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);
|
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:停用
|
* 状态;0:临时,1:正常,2:停用
|
||||||
*/
|
*/
|
||||||
@Column(name = "status", length = 3)
|
@Column(name = "status", length = 3)
|
||||||
private String status;
|
private Integer status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 企业ID
|
* 企业ID
|
||||||
@@ -51,9 +51,13 @@ public class OldUser implements java.io.Serializable{
|
|||||||
@Column(name = "orgnization_id", length = 150)
|
@Column(name = "orgnization_id", length = 150)
|
||||||
private String orgnizationId;
|
private String orgnizationId;
|
||||||
|
|
||||||
|
/**用户学习时长*/
|
||||||
|
@Column(name = "learning_duration")
|
||||||
|
private Float learningDuration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除标记;0:正常,1:已删除
|
* 删除标记;0:正常,1:已删除
|
||||||
*/
|
*/
|
||||||
@Column(name = "is_deleted", length = 3)
|
@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.OldOrganization;
|
||||||
import com.xboe.basic.entity.OldUser;
|
import com.xboe.basic.entity.OldUser;
|
||||||
import com.xboe.basic.service.IOldService;
|
import com.xboe.basic.service.IOldService;
|
||||||
import com.xboe.common.OrderCondition;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -15,7 +15,10 @@ public interface MainAccountDao extends JpaRepository<MainAccount,String>{
|
|||||||
|
|
||||||
@Modifying
|
@Modifying
|
||||||
@Query(value = "update MainAccount set deleted=true where id=?1")
|
@Query(value = "update MainAccount set deleted=true where id=?1")
|
||||||
// @Transactional(rollbackFor = Exception.class)
|
|
||||||
public Integer setDeleted(String id);
|
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,12 +65,21 @@ public class MainUser extends IdEntity {
|
|||||||
@Column(name = "sass_id", length = 36)
|
@Column(name = "sass_id", length = 36)
|
||||||
private String sassId;
|
private String sassId;
|
||||||
|
|
||||||
|
/**用户学习时长*/
|
||||||
|
@Column(name = "learning_duration")
|
||||||
|
private Float learningDuration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除标识
|
* 删除标识
|
||||||
* */
|
* */
|
||||||
@Column(name="deleted",length = 1)
|
@Column(name="deleted",length = 1)
|
||||||
private Boolean deleted;
|
private Boolean deleted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户的状态
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
public MainUser() {
|
public MainUser() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,4 +28,10 @@ public interface IMainDbSyncService {
|
|||||||
|
|
||||||
void updateUser(MainUser muser);
|
void updateUser(MainUser muser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 把账号设置为已删除
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
void deleteAccount(String id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,8 +61,16 @@ public class MainDbSyncServiceImpl implements IMainDbSyncService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional("transactionManagerPrimary")
|
||||||
|
public void deleteAccount(String id) {
|
||||||
|
accountDao.setDeleted(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional("transactionManagerPrimary")
|
||||||
public void updateUser(MainUser muser) {
|
public void updateUser(MainUser muser) {
|
||||||
userDao.update(muser.getDepartId(),muser.getSysDepartId(),muser.getCompanyId(),muser.getId());
|
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