|
|
@@ -423,78 +423,14 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, CorpsDesc
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public List<CorpsDesc> getFleetList(CorpsDesc corpsDesc) {
|
|
|
- CorpsType corpsType = corpsTypeMapper.selectOne(new LambdaQueryWrapper<CorpsType>()
|
|
|
- .eq(CorpsType::getCname, LandConstant.FLEET_CHINESE)
|
|
|
- .eq(CorpsType::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(CorpsType::getIsDeleted, 0)
|
|
|
- );
|
|
|
-
|
|
|
- if (ObjectUtil.isEmpty(corpsType)) {
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- List<Long> corpIdList = corpsTypeDescMapper.selectList(new LambdaQueryWrapper<CorpsTypeDesc>()
|
|
|
- .eq(CorpsTypeDesc::getCorpTypeId, corpsType.getId())
|
|
|
- ).stream().map(CorpsTypeDesc::getCorpId).collect(Collectors.toList());
|
|
|
-
|
|
|
- if (CollectionUtil.isEmpty(corpIdList)) {
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- return baseMapper.selectList(new LambdaQueryWrapper<CorpsDesc>()
|
|
|
- .like(StringUtil.isNotBlank(corpsDesc.getCname()), CorpsDesc::getCname, corpsDesc.getCname())
|
|
|
- .in(CorpsDesc::getId, corpIdList)
|
|
|
- .eq(CorpsDesc::getIsDeleted, 0)
|
|
|
- );
|
|
|
- }
|
|
|
|
|
|
@Override
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- @GlobalTransactional(rollbackFor = Exception.class)
|
|
|
- public R createUser(CorpsDesc corpsDesc) {
|
|
|
+ public R copy(CorpsDesc corpsDesc) {
|
|
|
CorpsDesc desc = baseMapper.selectById(corpsDesc.getId());
|
|
|
- if (ObjectUtil.isEmpty(desc)) {
|
|
|
- return R.fail("操作失败");
|
|
|
- }
|
|
|
-
|
|
|
- String typeName = corpsTypeDescMapper.selectTypeName(desc.getId());
|
|
|
- if (StringUtil.isEmpty(typeName)) {
|
|
|
- return R.fail("获取客户类型失败");
|
|
|
- }
|
|
|
-
|
|
|
- if (LandConstant.FLEET_CHINESE.equals(typeName)) {
|
|
|
- typeName = LandConstant.FLEET_ROLE;
|
|
|
- } else {
|
|
|
- typeName = LandConstant.CORP_ROLE;
|
|
|
- }
|
|
|
-
|
|
|
- R<String> sysMessage;
|
|
|
- if (LandConstant.IS_ADMIN.equals(corpsDesc.getUserType())) {
|
|
|
- sysMessage = sysClient.getRoleIdString(AuthUtil.getTenantId(), typeName, LandConstant.LAND_ADMIN);
|
|
|
- } else {
|
|
|
- sysMessage = sysClient.getRoleIdString(AuthUtil.getTenantId(), typeName, LandConstant.LAND_OPERATOR);
|
|
|
- }
|
|
|
-
|
|
|
- if (!sysMessage.isSuccess() || sysMessage.getData() == null) {
|
|
|
- return R.fail("缺少必要角色");
|
|
|
- }
|
|
|
-
|
|
|
- User user = new User();
|
|
|
- user.setTenantId(AuthUtil.getTenantId());
|
|
|
- user.setUserType(1);
|
|
|
- user.setAccount(desc.getCname());
|
|
|
- user.setPassword(LandConstant.USER_PASSWORD);
|
|
|
- user.setName(desc.getCname());
|
|
|
- user.setRealName(desc.getCname());
|
|
|
- user.setRoleId(sysMessage.getData());
|
|
|
- user.setDeptId(corpsDesc.getDeptId());
|
|
|
- userClient.saveUser(user);
|
|
|
-
|
|
|
- desc.setUserId(user.getId());
|
|
|
+ desc.setCorpType(desc.getCorpType() + "," + corpsDesc.getCorpType());
|
|
|
baseMapper.updateById(desc);
|
|
|
- return R.success("操作成功");
|
|
|
+ saveOrUpdateTypeDesc(corpsDesc, AuthUtil.getUserId(), corpsDesc.getId(), new Date(), desc.getTenantId());
|
|
|
+ return R.success("同步成功");
|
|
|
}
|
|
|
|
|
|
|