|
|
|
@ -5,11 +5,21 @@ import cn.dev33.satoken.secure.BCrypt;
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
import com.ruoyi.common.core.domain.R;
|
|
|
|
import com.ruoyi.common.core.domain.R;
|
|
|
|
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
|
import com.ruoyi.common.core.domain.model.RegisterBody;
|
|
|
|
import com.ruoyi.common.core.domain.model.RegisterBody;
|
|
|
|
import com.ruoyi.common.core.service.DictService;
|
|
|
|
import com.ruoyi.common.core.service.DictService;
|
|
|
|
|
|
|
|
import com.ruoyi.common.core.validate.AddGroup;
|
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
|
|
|
|
|
import com.ruoyi.pay.domain.bo.PaySubInfoBo;
|
|
|
|
|
|
|
|
import com.ruoyi.pay.domain.bo.PaySubPlanBo;
|
|
|
|
|
|
|
|
import com.ruoyi.pay.domain.bo.PayTenantBo;
|
|
|
|
|
|
|
|
import com.ruoyi.pay.domain.vo.PaySubPlanVo;
|
|
|
|
|
|
|
|
import com.ruoyi.pay.domain.vo.PayTenantVo;
|
|
|
|
|
|
|
|
import com.ruoyi.pay.service.IPaySubInfoService;
|
|
|
|
|
|
|
|
import com.ruoyi.pay.service.IPaySubPlanService;
|
|
|
|
|
|
|
|
import com.ruoyi.pay.service.IPayTenantService;
|
|
|
|
import com.ruoyi.system.service.*;
|
|
|
|
import com.ruoyi.system.service.*;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
@ -18,6 +28,11 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Calendar;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 注册验证
|
|
|
|
* 注册验证
|
|
|
|
*
|
|
|
|
*
|
|
|
|
@ -33,6 +48,9 @@ public class SysRegisterController extends BaseController {
|
|
|
|
private final ISysRoleService roleService;
|
|
|
|
private final ISysRoleService roleService;
|
|
|
|
private final ISysUserService userService;
|
|
|
|
private final ISysUserService userService;
|
|
|
|
private final SysLoginService loginService;
|
|
|
|
private final SysLoginService loginService;
|
|
|
|
|
|
|
|
private final IPaySubInfoService iPaySubInfoService;
|
|
|
|
|
|
|
|
private final IPaySubPlanService iPaySubPlanService;
|
|
|
|
|
|
|
|
private final IPayTenantService iPayTenantService;
|
|
|
|
|
|
|
|
|
|
|
|
private final DictService dictService;
|
|
|
|
private final DictService dictService;
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
@ -51,27 +69,25 @@ public class SysRegisterController extends BaseController {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 公司注册并添加默认角色
|
|
|
|
* 公司注册并添加默认角色
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
/* @SaIgnore
|
|
|
|
@SaIgnore
|
|
|
|
@PostMapping("/registerGs")
|
|
|
|
@PostMapping("/registerGs")
|
|
|
|
public R<Map<String ,Object>> register1(@Validated(AddGroup.class) @RequestBody AsCompanyBo bo) {
|
|
|
|
public R<SysRole> register1(@Validated(AddGroup.class) @RequestBody PayTenantBo bo) {
|
|
|
|
//添加验证 手机号相同或者公司名相同不允许注册
|
|
|
|
//添加验证 手机号相同或者公司名相同不允许注册
|
|
|
|
AsCompanyBo queryBo = new AsCompanyBo();
|
|
|
|
PayTenantBo queryBo = new PayTenantBo();
|
|
|
|
queryBo.setPhone(bo.getPhone());
|
|
|
|
queryBo.setPhone(bo.getPhone());
|
|
|
|
List<AsCompanyVo> asCompanyVos = iAsCompanyService.queryList(queryBo);
|
|
|
|
List<PayTenantVo> asCompanyVos = iPayTenantService.queryList(queryBo);
|
|
|
|
if(asCompanyVos!=null&&asCompanyVos.size()>0){
|
|
|
|
if(asCompanyVos!=null&&asCompanyVos.size()>0){
|
|
|
|
return new R().fail("手机号已注册");
|
|
|
|
return new R().fail("手机号已注册");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
queryBo.setName(bo.getName());
|
|
|
|
queryBo.setName(bo.getName());
|
|
|
|
queryBo.setPhone(null);
|
|
|
|
queryBo.setPhone(null);
|
|
|
|
List<AsCompanyVo> asCompanyVos2 = iAsCompanyService.queryList(queryBo);
|
|
|
|
List<PayTenantVo> asCompanyVos2 = iPayTenantService.queryList(queryBo);
|
|
|
|
if(asCompanyVos2!=null&&asCompanyVos2.size()>0){
|
|
|
|
if(asCompanyVos2!=null&&asCompanyVos2.size()>0){
|
|
|
|
return new R().fail("公司名已注册");
|
|
|
|
return new R().fail("公司名已注册");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(iAsCompanyService.insertByBo(bo)){
|
|
|
|
if(iPayTenantService.insertByBo(bo)){
|
|
|
|
//公司注册成功后自动添加3个角色:管理员、客户、运维
|
|
|
|
//公司注册成功后自动添加角色:管理员 todo
|
|
|
|
Long[] adids={1655371202140614657L, 1642699828651147266L, 1642699828651147267L, 1642699828651147268L, 1642699828651147269L, 1642699828651147270L, 1642699828651147271L, 1702576150650126337L, 1642699829787803649L, 1642699829787803650L, 1642699829787803651L, 1642699829787803652L, 1642699829787803653L, 1642699829787803654L, 1702576351469207553L, 1642699830664413186L, 1642699830664413187L, 1642699830664413188L, 1642699830664413189L, 1642699830664413190L, 1655482882922754049L, 1655840316736458753L, 1655448497192230913L, 1654661619136454657L, 1655842888306184194L, 1654661698882756610L, 1654661489897365506L, 1642699830664413191L, 1666004221847199746L, 1702576545644511234L, 1645595648910704641L, 1645314322216816642L, 1645314322216816643L, 1645314322216816644L, 1645314322216816645L, 1645314322216816646L, 1645314322216816647L, 1702576946385092610L, 1658662667209936897L, 1658662667209936898L, 1658662667209936899L, 1658662667209936900L, 1658662667209936901L, 1658662667209936902L, 1701529461713534977L, 1645688918156320769L, 1645688918156320770L, 1645688918156320771L, 1645688918156320772L, 1645688918156320773L, 1645688918156320774L, 1702577106473287681L, 1658662668782800897L, 1658662668782800898L, 1658662668782800899L, 1658662668782800900L, 1658662668782800901L, 1658662668782800902L, 1702577252363763714L, 1647137024584462337L, 1647137024584462338L, 1647137024584462339L, 1647137024584462340L, 1647137024584462341L, 1647137024584462342L, 1661650957882208257L, 1702578000103309314L, 1645688916713480193L, 1645688916713480194L, 1645688916713480195L, 1645688916713480196L, 1645688916713480197L, 1645688916713480198L, 1702578372427481090L, 1642699829523562497L, 1642699829523562498L, 1642699829523562499L, 1642699829523562500L, 1642699829523562501L, 1642699829523562502L, 1702581675269914626L, 1642699828978302977L, 1642699828978302978L, 1642699828978302979L, 1642699828978302980L, 1642699828978302981L, 1642699828978302982L, 1701527993971376129L, 1661257205264498690L, 1661257343563284481L, 1662289656452018177L, 1662289815781044225L, 1662289897637081089L, 1662289992025698306L, 1669951329203130370L, 1645314323366055938L, 1702567199455936513L, 1645314323366055939L, 1645314323366055940L, 1645314323366055941L, 1645314323366055942L, 1645314323366055943L, 1642699830974791687L, 1642699830320480257L, 1642699830320480258L, 1642699830320480259L, 1642699830320480260L, 1642699830320480261L, 1642699830320480262L, 1702582089298051073L, 1642699830031073281L, 1642699830031073282L, 1642699830031073283L, 1642699830031073284L, 1642699830031073285L, 1642699830031073286L, 1644533653729988609L, 1702582246030802945L, 1645597336069488641L, 1645688917699141633L, 1645688917699141634L, 1645688917699141635L, 1645688917699141636L, 1645688917699141637L, 1645688917699141638L, 1702582588248260610L, 1642699829242544129L, 1642699829242544130L, 1642699829242544131L, 1642699829242544132L, 1642699829242544133L, 1642699829242544134L, 1702582422652944386L, 1645688917497815042L, 1645688917497815043L, 1645688917497815044L, 1645688917497815045L, 1645688917497815046L, 1645688917497815047L, 1702582710013100034L, 1645329015545835521L, 1645329015545835522L, 1645329015545835523L, 1645329015545835524L, 1645329015545835525L, 1645329015545835526L, 1702582843756871681L, 1645688917900468225L, 1645688917900468226L, 1645688917900468227L, 1645688917900468228L, 1645688917900468229L, 1645688917900468230L, 1702582979249668098L, 1L, 100L, 1001L, 1002L, 1003L, 1004L, 1005L, 1006L, 1007L, 1702585719430414338L, 101L, 1010L, 1011L, 1012L, 1013L, 1702585850393362434L};
|
|
|
|
Long[] adids={};
|
|
|
|
Long[] khids={1655371202140614657L, 1642699828651147266L, 1642699828651147268L, 1642699830664413186L, 1642699830664413187L, 1642699830664413188L, 1642699830664413189L, 1642699830664413190L, 1655482882922754049L, 1655840316736458753L, 1655842888306184194L, 1654661489897365506L, 1702576545644511234L, 1661257205264498690L, 1661257343563284481L, 1662289656452018177L, 1662289815781044225L, 1662289897637081089L, 1662289992025698306L, 1669951329203130370L};
|
|
|
|
|
|
|
|
Long[] wxids = {1702576150650126337L, 1642699829787803649L, 1642699829787803650L, 1642699829787803651L, 1642699829787803652L, 1642699829787803653L, 1642699829787803654L, 1642699830664413186L, 1642699830664413187L, 1642699830664413188L, 1642699830664413189L, 1642699830664413190L, 1655482882922754049L, 1655840316736458753L, 1655448497192230913L, 1654661619136454657L, 1655842888306184194L, 1654661698882756610L, 1654661489897365506L, 1642699830664413191L, 1702576545644511234L, 1702576946385092610L, 1701529461713534977L, 1702577106473287681L, 1702577252363763714L, 1702578372427481090L, 1702581675269914626L, 1701527993971376129L, 1661257205264498690L, 1661257343563284481L, 1662289656452018177L, 1662289815781044225L, 1662289897637081089L, 1662289992025698306L, 1669951329203130370L};
|
|
|
|
|
|
|
|
SysRole role1 = new SysRole();
|
|
|
|
SysRole role1 = new SysRole();
|
|
|
|
role1.setRoleKey("companyAdmin");
|
|
|
|
role1.setRoleKey("companyAdmin");
|
|
|
|
role1.setRoleName("公司管理员");
|
|
|
|
role1.setRoleName("公司管理员");
|
|
|
|
@ -83,42 +99,18 @@ public class SysRegisterController extends BaseController {
|
|
|
|
role1.setFlag(false);
|
|
|
|
role1.setFlag(false);
|
|
|
|
role1.setMenuIds(adids);
|
|
|
|
role1.setMenuIds(adids);
|
|
|
|
|
|
|
|
|
|
|
|
SysRole role2 = new SysRole();
|
|
|
|
|
|
|
|
role2.setRoleKey("client");
|
|
|
|
|
|
|
|
role2.setRoleName("客户");
|
|
|
|
|
|
|
|
role2.setTenantId(bo.getId());
|
|
|
|
|
|
|
|
role2.setStatus("0");
|
|
|
|
|
|
|
|
role2.setRoleSort(0);
|
|
|
|
|
|
|
|
role2.setMenuCheckStrictly(false);
|
|
|
|
|
|
|
|
role2.setDeptCheckStrictly(true);
|
|
|
|
|
|
|
|
role2.setFlag(false);
|
|
|
|
|
|
|
|
role2.setMenuIds(khids);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SysRole role3 = new SysRole();
|
|
|
|
|
|
|
|
role3.setRoleKey("maintainer");
|
|
|
|
|
|
|
|
role3.setRoleName("维修");
|
|
|
|
|
|
|
|
role3.setTenantId(bo.getId());
|
|
|
|
|
|
|
|
role3.setStatus("0");
|
|
|
|
|
|
|
|
role3.setRoleSort(0);
|
|
|
|
|
|
|
|
role3.setMenuCheckStrictly(false);
|
|
|
|
|
|
|
|
role3.setDeptCheckStrictly(true);
|
|
|
|
|
|
|
|
role3.setFlag(false);
|
|
|
|
|
|
|
|
role3.setMenuIds(wxids);
|
|
|
|
|
|
|
|
roleService.insertRole(role1);
|
|
|
|
roleService.insertRole(role1);
|
|
|
|
roleService.insertRole(role2);
|
|
|
|
/*Map<String ,Object> data = new HashMap<>();
|
|
|
|
roleService.insertRole(role3);
|
|
|
|
|
|
|
|
Map<String ,Object> data = new HashMap<>();
|
|
|
|
|
|
|
|
List<SysRole> roles = new ArrayList<>();
|
|
|
|
List<SysRole> roles = new ArrayList<>();
|
|
|
|
roles.add(role1);
|
|
|
|
roles.add(role1);
|
|
|
|
roles.add(role2);
|
|
|
|
|
|
|
|
roles.add(role3);
|
|
|
|
|
|
|
|
// data.put("id",bo.getId());
|
|
|
|
// data.put("id",bo.getId());
|
|
|
|
data.put("roles",roles);
|
|
|
|
data.put("roles",roles);*/
|
|
|
|
return new R().ok(data);
|
|
|
|
return new R().ok(role1);
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
return new R().fail("注册失败,请重试");
|
|
|
|
return new R().fail("注册失败,请重试");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 添加公司管理员用户
|
|
|
|
* 添加公司管理员用户
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ -136,12 +128,12 @@ public class SysRegisterController extends BaseController {
|
|
|
|
return R.fail("新增用户'" + user.getUserName() + "'失败,用户已存在");
|
|
|
|
return R.fail("新增用户'" + user.getUserName() + "'失败,用户已存在");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
user.setPassword(BCrypt.hashpw(user.getPassword()));
|
|
|
|
user.setPassword(BCrypt.hashpw(user.getPassword()));
|
|
|
|
/* //1.查询试用的订阅计划信息 2.注册管理员用户同时添加公司的订阅计划——免费试用3月
|
|
|
|
//1.查询试用的订阅计划信息 2.注册管理员用户同时添加公司的订阅计划——免费试用3月
|
|
|
|
AsSubscriptionInfoBo bo = new AsSubscriptionInfoBo();
|
|
|
|
PaySubInfoBo bo = new PaySubInfoBo();
|
|
|
|
AsSubscriptionPlanBo planBo= new AsSubscriptionPlanBo();
|
|
|
|
PaySubPlanBo planBo= new PaySubPlanBo();
|
|
|
|
planBo.setName(dictService.getDictValue("trial_plan","sub_name")); //对应字典的使用计划名称查询试用计划
|
|
|
|
planBo.setName(dictService.getDictValue("trial_plan","trial_name")); //试用 对应字典的试用名称查询试用计划
|
|
|
|
List<AsSubscriptionPlanVo> asSubscriptionPlanVos = iAsSubscriptionPlanService.queryList(planBo);
|
|
|
|
List<PaySubPlanVo> planVos = iPaySubPlanService.queryList(planBo);
|
|
|
|
if(asSubscriptionPlanVos!=null&&asSubscriptionPlanVos.size()>0){
|
|
|
|
if(planVos!=null&&planVos.size()>0){
|
|
|
|
Date date = new Date();
|
|
|
|
Date date = new Date();
|
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
|
calendar.setTime(date); // 设置当前日期
|
|
|
|
calendar.setTime(date); // 设置当前日期
|
|
|
|
@ -150,8 +142,8 @@ public class SysRegisterController extends BaseController {
|
|
|
|
bo.setActive("0");
|
|
|
|
bo.setActive("0");
|
|
|
|
bo.setTenantId(user.getTenantId());
|
|
|
|
bo.setTenantId(user.getTenantId());
|
|
|
|
bo.setCompanyName(user.getTenantName());
|
|
|
|
bo.setCompanyName(user.getTenantName());
|
|
|
|
bo.setSubplanId(asSubscriptionPlanVos.get(0).getId());
|
|
|
|
bo.setSubplanId(planVos.get(0).getId());
|
|
|
|
bo.setSubplanName(asSubscriptionPlanVos.get(0).getName());
|
|
|
|
bo.setSubplanName(planVos.get(0).getName());
|
|
|
|
bo.setStartTime(date);
|
|
|
|
bo.setStartTime(date);
|
|
|
|
bo.setEndTime(endDate);
|
|
|
|
bo.setEndTime(endDate);
|
|
|
|
bo.setRemark("用户注册默认试用");
|
|
|
|
bo.setRemark("用户注册默认试用");
|
|
|
|
@ -163,7 +155,7 @@ public class SysRegisterController extends BaseController {
|
|
|
|
bo.setStartTime(null);
|
|
|
|
bo.setStartTime(null);
|
|
|
|
bo.setRemark("用户注册时未找到试用计划");
|
|
|
|
bo.setRemark("用户注册时未找到试用计划");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
iAsSubscriptionInfoService.insertByBo(bo);*/
|
|
|
|
iPaySubInfoService.insertByBo(bo);
|
|
|
|
user.setTenantName(null);
|
|
|
|
user.setTenantName(null);
|
|
|
|
return toAjax(userService.insertUser(user));
|
|
|
|
return toAjax(userService.insertUser(user));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|