updateStatusEnumBatch ok
parent
f7e1fffdac
commit
d6ff1d9588
|
|
@ -3,10 +3,7 @@ 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.RoleDeptAddCmd;
|
import com.jjb.saas.system.client.user.request.*;
|
||||||
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;
|
||||||
|
|
@ -54,4 +51,8 @@ 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,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("部门下面没有用户,不用启用禁用数据");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (Long orgPersonnelDOId : userIdList) {
|
||||||
UserUpdateQuitCmd userUpdateQuitCmd = new UserUpdateQuitCmd();
|
UserUpdateQuitCmd userUpdateQuitCmd = new UserUpdateQuitCmd();
|
||||||
userUpdateQuitCmd.setId(orgPersonnelDOId);
|
userUpdateQuitCmd.setId(orgPersonnelDOId);
|
||||||
if (state == 1) {
|
if (enabled) {
|
||||||
// 禁用
|
// 禁用
|
||||||
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);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@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());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue