|
|
|
@ -3,14 +3,13 @@ package org.qinan.safetyeval.infrastructure.gatewayimpl;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.jjb.saas.system.client.user.facade.UserFacade;
|
|
|
|
import com.jjb.saas.framework.enums.enums.BooleanEnum;
|
|
|
|
|
|
|
|
import com.jjb.saas.system.client.user.request.FacadeUserUpdateStatusEnumBatchCmd;
|
|
|
|
import com.jjb.saas.system.client.user.request.UserUpdatePasswordCmd;
|
|
|
|
import com.jjb.saas.system.client.user.request.UserUpdatePasswordCmd;
|
|
|
|
import com.jjb.saas.system.client.user.request.UserUpdateQuitCmd;
|
|
|
|
import com.jjb.saas.system.client.user.request.UserUpdateQuitCmd;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
import com.zcloud.gbscommon.utils.MD5;
|
|
|
|
import com.zcloud.gbscommon.utils.MD5;
|
|
|
|
import com.zcloud.gbscommon.utils.Sm2Util;
|
|
|
|
import com.zcloud.gbscommon.utils.Sm2Util;
|
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.qinan.safetyeval.domain.entity.OrgInfoEntity;
|
|
|
|
import org.qinan.safetyeval.domain.entity.OrgInfoEntity;
|
|
|
|
import org.qinan.safetyeval.domain.gateway.OrgInfoGateway;
|
|
|
|
import org.qinan.safetyeval.domain.gateway.OrgInfoGateway;
|
|
|
|
import org.qinan.safetyeval.domain.query.OrgInfoQuery;
|
|
|
|
import org.qinan.safetyeval.domain.query.OrgInfoQuery;
|
|
|
|
@ -23,6 +22,8 @@ import org.qinan.safetyeval.infrastructure.mapper.OrgInfoMapper;
|
|
|
|
import org.qinan.safetyeval.infrastructure.mapper.OrgPersonnelMapper;
|
|
|
|
import org.qinan.safetyeval.infrastructure.mapper.OrgPersonnelMapper;
|
|
|
|
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
|
|
|
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
|
|
|
import org.qinan.safetyeval.infrastructure.support.OrgInfoCascadeDeleter;
|
|
|
|
import org.qinan.safetyeval.infrastructure.support.OrgInfoCascadeDeleter;
|
|
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
@ -40,6 +41,7 @@ import java.util.stream.Collectors;
|
|
|
|
* @author safety-eval
|
|
|
|
* @author safety-eval
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Component
|
|
|
|
@Component
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
public class OrgInfoGatewayImpl implements OrgInfoGateway {
|
|
|
|
public class OrgInfoGatewayImpl implements OrgInfoGateway {
|
|
|
|
|
|
|
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(OrgInfoGatewayImpl.class);
|
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(OrgInfoGatewayImpl.class);
|
|
|
|
@ -78,7 +80,8 @@ public class OrgInfoGatewayImpl implements OrgInfoGateway {
|
|
|
|
OrgInfoDO dataObject = orgInfoMapper.selectById(id);
|
|
|
|
OrgInfoDO dataObject = orgInfoMapper.selectById(id);
|
|
|
|
return toEntity(dataObject);
|
|
|
|
return toEntity(dataObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public OrgInfoEntity getByCreditCode(String creditCode) {
|
|
|
|
public OrgInfoEntity getByCreditCode(String creditCode) {
|
|
|
|
LambdaQueryWrapper<OrgInfoDO> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
LambdaQueryWrapper<OrgInfoDO> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
wrapper.eq(OrgInfoDO::getCreditCode, creditCode);
|
|
|
|
wrapper.eq(OrgInfoDO::getCreditCode, creditCode);
|
|
|
|
@ -125,33 +128,38 @@ public class OrgInfoGatewayImpl implements OrgInfoGateway {
|
|
|
|
update.setState(state);
|
|
|
|
update.setState(state);
|
|
|
|
InsertFieldDefaults.applyForUpdate(update);
|
|
|
|
InsertFieldDefaults.applyForUpdate(update);
|
|
|
|
orgInfoMapper.updateById(update);
|
|
|
|
orgInfoMapper.updateById(update);
|
|
|
|
|
|
|
|
List<Long> departUserId = orgInfoMapper.selectList(new LambdaQueryWrapper<OrgInfoDO>()
|
|
|
|
|
|
|
|
.select(OrgInfoDO::getCreateId)
|
|
|
|
|
|
|
|
.eq(OrgInfoDO::getId, id)).stream()
|
|
|
|
|
|
|
|
.map(OrgInfoDO::getCreateId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean enabled = state == 1;
|
|
|
|
|
|
|
|
FacadeUserUpdateStatusEnumBatchCmd cmd = new FacadeUserUpdateStatusEnumBatchCmd();
|
|
|
|
|
|
|
|
cmd.setIds(departUserId);
|
|
|
|
|
|
|
|
cmd.setStatusEnum(enabled ? BooleanEnum.FALSE.getValue() : BooleanEnum.TRUE.getValue());
|
|
|
|
|
|
|
|
gbsUserFacadeClient.updateStatusEnumBatch(cmd);
|
|
|
|
|
|
|
|
|
|
|
|
// 同步启用禁用gbs用户
|
|
|
|
// 同步启用禁用gbs用户
|
|
|
|
List<Long> orgPersonnelDOIdS = orgPersonnelMapper.selectList(new LambdaQueryWrapper<OrgPersonnelDO>()
|
|
|
|
List<Long> userIdList = orgPersonnelMapper.selectList(new LambdaQueryWrapper<OrgPersonnelDO>()
|
|
|
|
|
|
|
|
.select(OrgPersonnelDO::getId)
|
|
|
|
.eq(OrgPersonnelDO::getOrgId, id)).stream().map(OrgPersonnelDO::getId).collect(Collectors.toList());
|
|
|
|
.eq(OrgPersonnelDO::getOrgId, id)).stream().map(OrgPersonnelDO::getId).collect(Collectors.toList());
|
|
|
|
if (!CollectionUtils.isEmpty(orgPersonnelDOIdS)) {
|
|
|
|
if (CollectionUtils.isEmpty(userIdList)) {
|
|
|
|
for (Long orgPersonnelDOId : orgPersonnelDOIdS) {
|
|
|
|
log.info("部门下面没有用户,不用启用禁用数据");
|
|
|
|
UserUpdateQuitCmd userUpdateQuitCmd = new UserUpdateQuitCmd();
|
|
|
|
return;
|
|
|
|
userUpdateQuitCmd.setId(orgPersonnelDOId);
|
|
|
|
}
|
|
|
|
if (state == 1) {
|
|
|
|
for (Long orgPersonnelDOId : userIdList) {
|
|
|
|
// 禁用
|
|
|
|
UserUpdateQuitCmd userUpdateQuitCmd = new UserUpdateQuitCmd();
|
|
|
|
syncGbsUser("quit user", new Runnable() {
|
|
|
|
userUpdateQuitCmd.setId(orgPersonnelDOId);
|
|
|
|
@Override
|
|
|
|
if (enabled) {
|
|
|
|
public void run() {
|
|
|
|
// 禁用
|
|
|
|
gbsUserFacadeClient.quit(userUpdateQuitCmd);
|
|
|
|
gbsUserFacadeClient.quit(userUpdateQuitCmd);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
});
|
|
|
|
// 启用
|
|
|
|
} else {
|
|
|
|
gbsUserFacadeClient.restoreJob(userUpdateQuitCmd);
|
|
|
|
// 启用
|
|
|
|
|
|
|
|
syncGbsUser("restore user job", new Runnable() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
gbsUserFacadeClient.restoreJob(userUpdateQuitCmd);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@ -245,6 +253,7 @@ public class OrgInfoGatewayImpl implements OrgInfoGateway {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private OrgInfoDO toDO(OrgInfoEntity entity) {
|
|
|
|
private OrgInfoDO toDO(OrgInfoEntity entity) {
|
|
|
|
OrgInfoDO dataObject = new OrgInfoDO();
|
|
|
|
OrgInfoDO dataObject = new OrgInfoDO();
|
|
|
|
dataObject.setUnitName(entity.getUnitName());
|
|
|
|
dataObject.setUnitName(entity.getUnitName());
|
|
|
|
|