|
|
|
@ -1,24 +1,33 @@ |
|
|
|
package com.research.web.controller.client.project; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.util.IdUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.research.common.annotation.DataSource; |
|
|
|
import com.research.common.core.domain.AjaxResult; |
|
|
|
import com.research.common.core.domain.BaseDto; |
|
|
|
import com.research.common.core.domain.JsonResponse; |
|
|
|
import com.research.common.core.domain.entity.SysUser; |
|
|
|
import com.research.common.enums.DataSourceType; |
|
|
|
import com.research.common.utils.SecurityUtils; |
|
|
|
import com.research.common.utils.StringUtils; |
|
|
|
import com.research.flowable.service.IFlowDefinitionService; |
|
|
|
import com.research.flowable.service.IFlowTaskService; |
|
|
|
import com.research.framework.datasource.DynamicDataSourceContextHolder; |
|
|
|
import com.research.system.domain.dto.CommonDto; |
|
|
|
import com.research.system.domain.dto.GroupDto; |
|
|
|
import com.research.system.domain.po.KtsKtGroupMember; |
|
|
|
import com.research.system.domain.po.PrjProjInfo; |
|
|
|
import com.research.system.domain.po.PrjProjOrg; |
|
|
|
import com.research.system.domain.po.*; |
|
|
|
import com.research.system.domain.vo.GroupVO; |
|
|
|
import com.research.system.persist.mapper.SrvDataSourceMapper; |
|
|
|
import com.research.system.persist.mapper.TmsTenantMapper; |
|
|
|
import com.research.system.persist.mapper.TmsTenantUserMapper; |
|
|
|
import com.research.system.service.ClientPrjProjInfoService; |
|
|
|
import com.research.system.service.ISysUserService; |
|
|
|
import com.research.system.service.KtsGroupService; |
|
|
|
import com.research.system.service.TmsLoginService; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import liquibase.pro.packaged.J; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
@ -32,6 +41,7 @@ import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
@ -59,6 +69,14 @@ public class GroupController { |
|
|
|
private ISysUserService sysUserService; |
|
|
|
@Resource |
|
|
|
private IFlowDefinitionService flowDefinitionService; |
|
|
|
@Resource |
|
|
|
private TmsTenantUserMapper tmsTenantUserMapper; |
|
|
|
@Resource |
|
|
|
private SrvDataSourceMapper srvDataSourceMapper; |
|
|
|
@Resource |
|
|
|
private TmsTenantMapper tmsTenantMapper; |
|
|
|
@Resource |
|
|
|
private TmsLoginService tmsLoginService; |
|
|
|
|
|
|
|
@PostMapping("/query") |
|
|
|
public JsonResponse<PageInfo<GroupVO.Result>> queryGroupList(@RequestBody @Validated BaseDto<GroupDto.Query> query){ |
|
|
|
@ -90,9 +108,40 @@ public class GroupController { |
|
|
|
return JsonResponse.ok(new PageInfo<>(ktsGroupService.queryMemberList(query.getParam()))); |
|
|
|
} |
|
|
|
@PostMapping("/member/add") |
|
|
|
// @DataSource(DataSourceType.MASTER)
|
|
|
|
public JsonResponse<Integer> addMember(@RequestBody @Validated GroupDto.AddMember dto) throws Exception { |
|
|
|
// //判定租户及数据源是否存在
|
|
|
|
// TmsTenant dmsTenant = tmsTenantMapper.selectByPrimaryKey(SecurityUtils.getTenantId());
|
|
|
|
// if (dmsTenant == null) {
|
|
|
|
// return JsonResponse.ok().fail("租户不存在");
|
|
|
|
// }
|
|
|
|
// SrvDataSource umsDataSource = srvDataSourceMapper.selectByPrimaryKey(dmsTenant.getDataSourceId());
|
|
|
|
// if (umsDataSource == null || StrUtil.isEmpty(umsDataSource.getDataSourceKey())) {
|
|
|
|
// return JsonResponse.ok().fail("数据源不存在");
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// //新增主库租户用户
|
|
|
|
// if (tmsLoginService.checkUserNameUnique(dto.getMemberPhone())) {
|
|
|
|
// return JsonResponse.ok().fail("新增用户'" + dto.getMemberPhone() + "'失败,登录账号已存在");
|
|
|
|
// }
|
|
|
|
// TmsTenantUser tmsTenantUser = new TmsTenantUser();
|
|
|
|
// tmsTenantUser.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
// tmsTenantUser.setCreateTime(new Date());
|
|
|
|
// tmsTenantUser.setTenantId(SecurityUtils.getTenantId());
|
|
|
|
// tmsTenantUser.setTenantUserId(dto.getUserId());
|
|
|
|
// tmsTenantUser.setUserName(dto.getMemberName());
|
|
|
|
// tmsTenantUser.setNickName(dto.getMemberName());
|
|
|
|
// tmsTenantUser.setDelFlag((byte) 0);
|
|
|
|
// tmsTenantUser.setSlaverAdmin((byte) 0);
|
|
|
|
// tmsTenantUser.setPhonenumber(dto.getMemberPhone());
|
|
|
|
// tmsTenantUser.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
// tmsTenantUserMapper.insertSelective(tmsTenantUser);
|
|
|
|
// //切换至从库
|
|
|
|
// DynamicDataSourceContextHolder.setDataSourceType(umsDataSource.getDataSourceKey());
|
|
|
|
KtsKtGroupMember ktsKtGroupMember = ktsGroupService.addMember(dto); |
|
|
|
// aduit(ktsKtGroupMember.getId());
|
|
|
|
aduit(ktsKtGroupMember.getId()); |
|
|
|
// //销毁切换数据源
|
|
|
|
// DynamicDataSourceContextHolder.clearDataSourceType();
|
|
|
|
return JsonResponse.ok(); |
|
|
|
} |
|
|
|
|
|
|
|
|