删除sysuser
parent
78820da98b
commit
a3502a6283
|
|
@ -1,182 +0,0 @@
|
||||||
package com.zcloud.basic.info.web;
|
|
||||||
|
|
||||||
|
|
||||||
import com.alibaba.cola.dto.MultiResponse;
|
|
||||||
import com.alibaba.cola.dto.PageResponse;
|
|
||||||
import com.alibaba.cola.dto.Response;
|
|
||||||
import com.alibaba.cola.dto.SingleResponse;
|
|
||||||
import com.alibaba.cola.exception.BizException;
|
|
||||||
import com.jjb.saas.framework.auth.model.SSOUser;
|
|
||||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
|
||||||
import com.jjb.saas.system.client.dept.request.DeptAddCmd;
|
|
||||||
import com.jjb.saas.system.client.role.facade.RoleFacade;
|
|
||||||
import com.jjb.saas.system.client.role.response.RoleCO;
|
|
||||||
import com.jjb.saas.system.client.user.facade.UserFacade;
|
|
||||||
import com.jjb.saas.system.client.user.request.FacadeUserAddCmd;
|
|
||||||
import com.zcloud.basic.info.api.SysUserServiceI;
|
|
||||||
import com.zcloud.basic.info.dto.SysCorpUserAddCmd;
|
|
||||||
import com.zcloud.basic.info.dto.SysUserAddCmd;
|
|
||||||
import com.zcloud.basic.info.dto.SysUserPageQry;
|
|
||||||
import com.zcloud.basic.info.dto.SysUserUpdateCmd;
|
|
||||||
import com.zcloud.basic.info.dto.clientobject.SysUserCO;
|
|
||||||
import com.zcloud.gbscommon.utils.Smb;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* web-adapter
|
|
||||||
*
|
|
||||||
* @Author zhaokai
|
|
||||||
* @Date 2025-10-28 15:44:24
|
|
||||||
*/
|
|
||||||
@Api(tags = "用户信息表")
|
|
||||||
@RequestMapping("/${application.gateway}/sysUser")
|
|
||||||
@RestController
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class SysUserController {
|
|
||||||
private final SysUserServiceI sysUserService;
|
|
||||||
|
|
||||||
|
|
||||||
@DubboReference(check = false)
|
|
||||||
private UserFacade userFacade;
|
|
||||||
|
|
||||||
@DubboReference(check = false)
|
|
||||||
private RoleFacade roleFacade;
|
|
||||||
|
|
||||||
@ApiOperation("新增-企业主账号")
|
|
||||||
@PostMapping("/saveCorpAccount")
|
|
||||||
// public SingleResponse<SysUserCO> add(@Validated @RequestBody SysUserAddCmd cmd) {
|
|
||||||
public Response saveCorpAccount(@Validated @RequestBody SysCorpUserAddCmd cmd) {
|
|
||||||
MultiResponse<RoleCO> roleCOMultiResponse = roleFacade.listRoles();
|
|
||||||
// List<RoleCO> data = roleCOMultiResponse.getData();
|
|
||||||
// FacadeUserAddCmd facadeUserAddCmd = new FacadeUserAddCmd();
|
|
||||||
// facadeUserAddCmd.setAccount("wxsaas");
|
|
||||||
// facadeUserAddCmd.setName("wx");
|
|
||||||
// facadeUserAddCmd.setAppKey("722091ff53dd4abba078c2a00efd4a42");
|
|
||||||
// facadeUserAddCmd.setPassword("wxsaas");
|
|
||||||
// facadeUserAddCmd.setRoleTypeEnum("ORG_ADMIN");
|
|
||||||
// todo 设置 用户id 用于登录
|
|
||||||
// SingleResponse<Long> longSingleResponse = userFacade.addUser(facadeUserAddCmd);
|
|
||||||
// longSingleResponse.getData();
|
|
||||||
System.out.println(cmd);
|
|
||||||
List<RoleCO> data = roleCOMultiResponse.getData();
|
|
||||||
FacadeUserAddCmd facadeUserAddCmd = new FacadeUserAddCmd();
|
|
||||||
facadeUserAddCmd.setAccount(cmd.getUsername());
|
|
||||||
facadeUserAddCmd.setName(cmd.getUsername());
|
|
||||||
facadeUserAddCmd.setAppKey("e6ab3c9abda747b39d7cc12b6dc0f5a0");
|
|
||||||
facadeUserAddCmd.setPassword("Aa12345678");
|
|
||||||
try {
|
|
||||||
Map<String, String> collect = data.stream().collect(Collectors.toMap(RoleCO::getRoleName, RoleCO::getRoleTypeEnum));
|
|
||||||
facadeUserAddCmd.setRoleTypeEnum("2".equals(cmd.getUserType()) ? collect.get("分公司主账号") : collect.get("相关方主账号"));
|
|
||||||
// todo 新增用户 GBS不适配功能
|
|
||||||
|
|
||||||
// todo 新增二级租户
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
// 有重复的角色名称 抛异常 联系管理员
|
|
||||||
throw new BizException("监测到角色名称重复,请联系管理员。");
|
|
||||||
}
|
|
||||||
sysUserService.addCorpAccount(cmd);
|
|
||||||
return Response.buildSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("重置-企业主账号密码")
|
|
||||||
@PutMapping("/resetCorpAccountPassword/{corpinfoId}")
|
|
||||||
// public SingleResponse<SysUserCO> add(@Validated @RequestBody SysUserAddCmd cmd) {
|
|
||||||
public Response resetCorpAccountPassword(@PathVariable("corpinfoId") Long corpinfoId) {
|
|
||||||
// todo GBS不适配功能
|
|
||||||
|
|
||||||
// FacadeUserAddCmd facadeUserAddCmd = new FacadeUserAddCmd();
|
|
||||||
// facadeUserAddCmd.setAccount(cmd.getUsername());
|
|
||||||
// facadeUserAddCmd.setName(cmd.getUsername());
|
|
||||||
// facadeUserAddCmd.setAppKey("e6ab3c9abda747b39d7cc12b6dc0f5a0");
|
|
||||||
// facadeUserAddCmd.setPassword("Aa12345678");
|
|
||||||
|
|
||||||
return Response.buildSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("删除-企业主账号")
|
|
||||||
@PutMapping("/removeCorpAccount/{corpinfoId}")
|
|
||||||
public Response removeCorpAccount(@PathVariable("corpinfoId") Long corpinfoId) {
|
|
||||||
// todo GBS不适配功能
|
|
||||||
return Response.buildSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("修改停用启用状态-企业主账号")
|
|
||||||
@PutMapping("/enabledCorpAccount/{corpinfoId}")
|
|
||||||
public Response enabledCorpAccount(@PathVariable("corpinfoId") Long corpinfoId) {
|
|
||||||
// todo GBS不适配功能
|
|
||||||
return Response.buildSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("新增")
|
|
||||||
@PostMapping("/save")
|
|
||||||
// public SingleResponse<SysUserCO> add(@Validated @RequestBody SysUserAddCmd cmd) {
|
|
||||||
public SingleResponse<SysUserCO> add(@RequestBody SysUserAddCmd cmd) {
|
|
||||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
|
||||||
MultiResponse<RoleCO> roleCOMultiResponse = roleFacade.listRoles();
|
|
||||||
List<RoleCO> data = roleCOMultiResponse.getData();
|
|
||||||
FacadeUserAddCmd facadeUserAddCmd = new FacadeUserAddCmd();
|
|
||||||
facadeUserAddCmd.setAccount("wxsaas");
|
|
||||||
facadeUserAddCmd.setName("wx");
|
|
||||||
facadeUserAddCmd.setAppKey("e6ab3c9abda747b39d7cc12b6dc0f5a0");
|
|
||||||
facadeUserAddCmd.setPassword("Aa12345678");
|
|
||||||
facadeUserAddCmd.setRoleTypeEnum("FGS_DEPART_ADMIN");
|
|
||||||
// todo 设置 用户id 用于登录
|
|
||||||
SingleResponse<Long> longSingleResponse = userFacade.addUser(facadeUserAddCmd);
|
|
||||||
cmd.setUid(longSingleResponse.getData());
|
|
||||||
|
|
||||||
return sysUserService.add(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("分页")
|
|
||||||
@PostMapping("/list")
|
|
||||||
public PageResponse<SysUserCO> page(@RequestBody SysUserPageQry qry) {
|
|
||||||
return sysUserService.listPage(qry);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("所有数据")
|
|
||||||
@GetMapping("/listAll")
|
|
||||||
public MultiResponse<SysUserCO> listAll() {
|
|
||||||
return MultiResponse.of(new ArrayList<SysUserCO>());
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("详情")
|
|
||||||
@GetMapping("/{id}")
|
|
||||||
public SingleResponse<SysUserCO> getInfoById(@PathVariable("id") Long id) {
|
|
||||||
return SingleResponse.of(new SysUserCO());
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("删除")
|
|
||||||
@DeleteMapping("/{id}")
|
|
||||||
public Response remove(@PathVariable("id") Long id) {
|
|
||||||
sysUserService.remove(id);
|
|
||||||
return SingleResponse.buildSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("删除多个")
|
|
||||||
@DeleteMapping("/ids")
|
|
||||||
public Response removeBatch(@RequestParam Long[] ids) {
|
|
||||||
sysUserService.removeBatch(ids);
|
|
||||||
return SingleResponse.buildSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("修改")
|
|
||||||
@PutMapping("/edit")
|
|
||||||
public SingleResponse edit(@Validated @RequestBody SysUserUpdateCmd sysUserUpdateCmd) {
|
|
||||||
sysUserService.edit(sysUserUpdateCmd);
|
|
||||||
return SingleResponse.buildSuccess();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue