Compare commits
No commits in common. "a8d2486ec11b27718107ce09db0e505ea5c78c2b" and "f53cdc289f9b2e8cab770dd39562ab81015a6e1a" have entirely different histories.
a8d2486ec1
...
f53cdc289f
|
|
@ -3,7 +3,10 @@ package org.qinan.safetyeval.infrastructure.adapter.gbs;
|
||||||
import com.alibaba.cola.dto.Response;
|
import com.alibaba.cola.dto.Response;
|
||||||
import com.alibaba.cola.dto.SingleResponse;
|
import com.alibaba.cola.dto.SingleResponse;
|
||||||
import com.jjb.saas.system.client.user.facade.UserFacade;
|
import com.jjb.saas.system.client.user.facade.UserFacade;
|
||||||
import com.jjb.saas.system.client.user.request.*;
|
import com.jjb.saas.system.client.user.request.RoleDeptAddCmd;
|
||||||
|
import com.jjb.saas.system.client.user.request.UserAddCmd;
|
||||||
|
import com.jjb.saas.system.client.user.request.UserUpdatePasswordCmd;
|
||||||
|
import com.jjb.saas.system.client.user.request.UserUpdateQuitCmd;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.qinan.safetyeval.domain.exception.BizException;
|
import org.qinan.safetyeval.domain.exception.BizException;
|
||||||
|
|
@ -51,8 +54,4 @@ public class GbsUserFacadeClient {
|
||||||
public void restoreJob(UserUpdateQuitCmd cmd) {
|
public void restoreJob(UserUpdateQuitCmd cmd) {
|
||||||
userFacade.restoreJob(cmd);
|
userFacade.restoreJob(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateStatusEnumBatch(FacadeUserUpdateStatusEnumBatchCmd cmd) {
|
|
||||||
userFacade.updateStatusEnumBatch(cmd);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -3,13 +3,14 @@ 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.framework.enums.enums.BooleanEnum;
|
import com.jjb.saas.system.client.user.facade.UserFacade;
|
||||||
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 lombok.extern.slf4j.Slf4j;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
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;
|
||||||
|
|
@ -22,8 +23,6 @@ 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;
|
||||||
|
|
@ -41,7 +40,6 @@ 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);
|
||||||
|
|
@ -80,7 +78,6 @@ 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<>();
|
||||||
|
|
@ -128,37 +125,32 @@ 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> userIdList = orgPersonnelMapper.selectList(new LambdaQueryWrapper<OrgPersonnelDO>()
|
List<Long> orgPersonnelDOIdS = 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(userIdList)) {
|
if (!CollectionUtils.isEmpty(orgPersonnelDOIdS)) {
|
||||||
log.info("部门下面没有用户,不用启用禁用数据");
|
for (Long orgPersonnelDOId : orgPersonnelDOIdS) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (Long orgPersonnelDOId : userIdList) {
|
|
||||||
UserUpdateQuitCmd userUpdateQuitCmd = new UserUpdateQuitCmd();
|
UserUpdateQuitCmd userUpdateQuitCmd = new UserUpdateQuitCmd();
|
||||||
userUpdateQuitCmd.setId(orgPersonnelDOId);
|
userUpdateQuitCmd.setId(orgPersonnelDOId);
|
||||||
if (enabled) {
|
if (state == 1) {
|
||||||
// 禁用
|
// 禁用
|
||||||
|
syncGbsUser("quit user", new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
gbsUserFacadeClient.quit(userUpdateQuitCmd);
|
gbsUserFacadeClient.quit(userUpdateQuitCmd);
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
// 启用
|
// 启用
|
||||||
|
syncGbsUser("restore user job", new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
gbsUserFacadeClient.restoreJob(userUpdateQuitCmd);
|
gbsUserFacadeClient.restoreJob(userUpdateQuitCmd);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -253,7 +245,6 @@ 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());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue