|
|
|
@ -49,7 +49,7 @@ import springfox.documentation.annotations.ApiIgnore;
|
|
|
|
|
@ApiIgnore
|
|
|
|
|
@RestController
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class UserRegisterController extends BaseController {
|
|
|
|
|
public class UserRegisterController extends BaseController {
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(UserRegisterController.class);
|
|
|
|
|
@Resource
|
|
|
|
|
private UserRegisterService userRegisterService;
|
|
|
|
@ -69,10 +69,9 @@ public class UserRegisterController extends BaseController {
|
|
|
|
|
private IEmailService iEmailService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/admin/auth/register/getCheckcode")
|
|
|
|
|
public BaseResponse getCheckcode(@RequestBody loginmobileRequest params, HttpSession httpSession) {
|
|
|
|
|
return CaptchaUtils.getCheckcode(params,httpSession);
|
|
|
|
|
return CaptchaUtils.getCheckcode(params, httpSession);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/admin/auth/register/checkCode")
|
|
|
|
@ -87,11 +86,11 @@ public class UserRegisterController extends BaseController {
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/admin/auth/register/get/{mobile}")
|
|
|
|
|
public BaseResponse getInfo(@PathVariable String mobile) {
|
|
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
UserRegisterEntity userRegisterEntity = userRegisterService.getOne(new QueryWrapper<UserRegisterEntity>().eq("mobile", mobile));
|
|
|
|
|
List<UserPersonEntity> userPersons = new ArrayList<>();
|
|
|
|
|
List<UserCertEntity> userCerts = new ArrayList<>();
|
|
|
|
|
if(userRegisterEntity==null) {
|
|
|
|
|
if (userRegisterEntity == null) {
|
|
|
|
|
userRegisterEntity = new UserRegisterEntity();
|
|
|
|
|
userRegisterEntity.setMobile(mobile);
|
|
|
|
|
userRegisterService.saveOrUpdate(userRegisterEntity);
|
|
|
|
@ -122,17 +121,16 @@ public class UserRegisterController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
UserRegisterEntity userRegisterEntity2 = userRegisterService.getOne(new QueryWrapper<UserRegisterEntity>().eq("companyName", userRegisterEntity.getCompanyName()));
|
|
|
|
|
if (userRegisterEntity2 !=null ) {
|
|
|
|
|
if(userRegisterEntity.getId()==null)
|
|
|
|
|
if (userRegisterEntity2 != null) {
|
|
|
|
|
if (userRegisterEntity.getId() == null)
|
|
|
|
|
return ResultVOUtils.error(500, "该单位已被注册!");
|
|
|
|
|
if(userRegisterEntity2.getId()!=userRegisterEntity.getId())
|
|
|
|
|
if (userRegisterEntity2.getId() != userRegisterEntity.getId())
|
|
|
|
|
return ResultVOUtils.error(500, "该单位已被注册!");
|
|
|
|
|
}
|
|
|
|
|
if(StringUtils.isEmpty(userRegisterEntity.getCheckStatus()))
|
|
|
|
|
if (StringUtils.isEmpty(userRegisterEntity.getCheckStatus()))
|
|
|
|
|
userRegisterEntity.setCheckStatus("0");
|
|
|
|
|
boolean b = false;
|
|
|
|
|
b = userRegisterService.saveOrUpdate(userRegisterEntity);
|
|
|
|
|
|
|
|
|
|
if (!b) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
|
|
|
|
}
|
|
|
|
@ -141,27 +139,26 @@ public class UserRegisterController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//第一次完善信息 插入默认数据
|
|
|
|
|
@GetMapping("/admin/auth/register/insertInitial")
|
|
|
|
|
public BaseResponse insertInitial (String mobile){
|
|
|
|
|
public BaseResponse insertInitial(String mobile) {
|
|
|
|
|
Map<Object, Object> map = new HashMap<>();
|
|
|
|
|
//根据手机号去查询 数据是否存在 不存在插入
|
|
|
|
|
UserRegisterEntity userRegister = userRegisterService.getOne(new QueryWrapper<UserRegisterEntity>().eq("mobile", mobile));
|
|
|
|
|
if(userRegister == null){
|
|
|
|
|
if (userRegister == null) {
|
|
|
|
|
//插入初始数据
|
|
|
|
|
UserRegisterEntity userRegisterEntity = new UserRegisterEntity();
|
|
|
|
|
UserCompanyEntity userCompanyEntity = new UserCompanyEntity();
|
|
|
|
|
// UserPersonEntity userPersonEntity = new UserPersonEntity();
|
|
|
|
|
|
|
|
|
|
userCompanyEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
userCompanyEntity.setCheckStatus(0+"");
|
|
|
|
|
userCompanyEntity.setCheckStatus(0 + "");
|
|
|
|
|
userCompanyEntity.setRegisterTime(new Date());
|
|
|
|
|
|
|
|
|
|
userRegisterEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
userRegisterEntity.setCompanyId(userCompanyEntity.getId());
|
|
|
|
|
userRegisterEntity.setMobile(mobile);
|
|
|
|
|
userRegisterEntity.setCheckStatus(0+"");
|
|
|
|
|
userRegisterEntity.setCheckStatus(0 + "");
|
|
|
|
|
userRegisterEntity.setRegisterTime(new Date());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -173,19 +170,19 @@ public class UserRegisterController extends BaseController {
|
|
|
|
|
userRegisterService.insert(userRegisterEntity);
|
|
|
|
|
int insert = userCompanyService.insert(userCompanyEntity);
|
|
|
|
|
// userPersonService.insert(userPersonEntity);
|
|
|
|
|
if(insert>0){
|
|
|
|
|
if (insert > 0) {
|
|
|
|
|
// map.put("upId",userPersonEntity.getId()+"");
|
|
|
|
|
map.put("ucId",userCompanyEntity.getId()+"");
|
|
|
|
|
map.put("urId",userRegisterEntity.getId()+"");
|
|
|
|
|
map.put("ucId", userCompanyEntity.getId() + "");
|
|
|
|
|
map.put("urId", userRegisterEntity.getId() + "");
|
|
|
|
|
return ResultVOUtils.success(map);
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.error(500,"添加失败");
|
|
|
|
|
}else{
|
|
|
|
|
return ResultVOUtils.error(500, "添加失败");
|
|
|
|
|
} else {
|
|
|
|
|
UserRegisterFilterRequest userRegisterFilterRequest = new UserRegisterFilterRequest();
|
|
|
|
|
userRegisterFilterRequest.setCompanyId(userRegister.getCompanyId()+"");
|
|
|
|
|
userRegisterFilterRequest.setCompanyId(userRegister.getCompanyId() + "");
|
|
|
|
|
|
|
|
|
|
registComPerResponse registComPerResponse = userRegisterService.selectAllInfo(userRegisterFilterRequest);
|
|
|
|
|
map.put("registComPerResponse",registComPerResponse);
|
|
|
|
|
map.put("registComPerResponse", registComPerResponse);
|
|
|
|
|
return ResultVOUtils.success(map);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -193,38 +190,38 @@ public class UserRegisterController extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/admin/auth/register/saveAllInfo")
|
|
|
|
|
public BaseResponse saveAllInfo(@RequestBody registComPerResponse registComPerResponse){
|
|
|
|
|
public BaseResponse saveAllInfo(@RequestBody registComPerResponse registComPerResponse) {
|
|
|
|
|
|
|
|
|
|
UserRegisterEntity userRegisterEntity = new UserRegisterEntity();
|
|
|
|
|
// UserPersonEntity userPersonEntity = new UserPersonEntity();
|
|
|
|
|
UserCompanyEntity userCompanyEntity = new UserCompanyEntity();
|
|
|
|
|
BeanUtils.copyProperties(registComPerResponse,userRegisterEntity);
|
|
|
|
|
BeanUtils.copyProperties(registComPerResponse, userRegisterEntity);
|
|
|
|
|
// BeanUtils.copyProperties(registComPerResponse,userPersonEntity);
|
|
|
|
|
BeanUtils.copyProperties(registComPerResponse,userCompanyEntity);
|
|
|
|
|
BeanUtils.copyProperties(registComPerResponse, userCompanyEntity);
|
|
|
|
|
userRegisterEntity.setId(Long.valueOf(registComPerResponse.getUrId()));
|
|
|
|
|
|
|
|
|
|
// userPersonEntity.setId(Long.valueOf(registComPerResponse.getUpId()));
|
|
|
|
|
userCompanyEntity.setId(Long.valueOf(registComPerResponse.getUcId()));
|
|
|
|
|
userCompanyEntity.setContactWay(registComPerResponse.getFmobile());
|
|
|
|
|
if("key".equals(registComPerResponse.getKey())){
|
|
|
|
|
if ("key".equals(registComPerResponse.getKey())) {
|
|
|
|
|
//提交审核
|
|
|
|
|
userCompanyEntity.setCheckStatus(3+"");
|
|
|
|
|
userRegisterEntity.setCheckStatus(3+"");
|
|
|
|
|
userCompanyEntity.setCheckStatus(3 + "");
|
|
|
|
|
userRegisterEntity.setCheckStatus(3 + "");
|
|
|
|
|
}
|
|
|
|
|
//插入资质证书
|
|
|
|
|
for (UserCertEntity userCertEntity : registComPerResponse.getList()) {
|
|
|
|
|
userCertService.saveOrUpdate(userCertEntity);
|
|
|
|
|
}
|
|
|
|
|
userRegisterService.update(userRegisterEntity);
|
|
|
|
|
userCompanyService.update(userCompanyEntity);
|
|
|
|
|
//插入资质证书
|
|
|
|
|
for (UserCertEntity userCertEntity : registComPerResponse.getList()) {
|
|
|
|
|
userCertService.saveOrUpdate(userCertEntity);
|
|
|
|
|
}
|
|
|
|
|
userRegisterService.update(userRegisterEntity);
|
|
|
|
|
userCompanyService.update(userCompanyEntity);
|
|
|
|
|
// userPersonService.update(userPersonEntity);
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/admin/auth/register/list")
|
|
|
|
|
public BaseResponse selectReslist(@RequestBody UserRegisterFilterRequest userRegisterFilterRequest, BindingResult bindingResult){
|
|
|
|
|
public BaseResponse selectReslist(@RequestBody UserRegisterFilterRequest userRegisterFilterRequest, BindingResult bindingResult) {
|
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
}
|
|
|
|
@ -235,12 +232,14 @@ public class UserRegisterController extends BaseController {
|
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
|
pageSimpleResponse.setList(selectlist);
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
UserCompanyConfigService userCompanyConfigService;
|
|
|
|
|
|
|
|
|
|
@PostMapping("/admin/auth/register/NotApproved")
|
|
|
|
|
public BaseResponse NotApproved(@RequestBody registComPerResponse registComPerResponse,BindingResult bindingResult){
|
|
|
|
|
public BaseResponse NotApproved(@RequestBody registComPerResponse registComPerResponse, BindingResult bindingResult) {
|
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
}
|
|
|
|
@ -248,26 +247,26 @@ public class UserRegisterController extends BaseController {
|
|
|
|
|
UserCompanyEntity userCompanyEntity = new UserCompanyEntity();
|
|
|
|
|
UserCheckEntity userCheckEntity = new UserCheckEntity();
|
|
|
|
|
// UserCertSetEntity userCertSetEntity = new UserCertSetEntity();
|
|
|
|
|
if("isPass".equals(registComPerResponse.getIsPass())){
|
|
|
|
|
if ("isPass".equals(registComPerResponse.getIsPass())) {
|
|
|
|
|
//审核通过
|
|
|
|
|
//资质证书全部通过才能审核 审核通过
|
|
|
|
|
certRequest certRequest = new certRequest();
|
|
|
|
|
certRequest.setBusinessId(Long.valueOf(registComPerResponse.getUcId()));
|
|
|
|
|
List<UserCertEntity> userCertEntities = userCertService.selectBybId(certRequest);
|
|
|
|
|
for (UserCertEntity userCertEntity : userCertEntities) {
|
|
|
|
|
if(!"1".equals(userCertEntity.getCheckStatus())){
|
|
|
|
|
return ResultVOUtils.error(500,"证书未全部通过,不能通过");
|
|
|
|
|
if (!"1".equals(userCertEntity.getCheckStatus())) {
|
|
|
|
|
return ResultVOUtils.error(500, "证书未全部通过,不能通过");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//通过之后 修改注册状态 和企业状态 将注册信息插入到系统负责人表中 生成用户名密码
|
|
|
|
|
userCheckEntity.setCheckResult(1+"");
|
|
|
|
|
userCheckEntity.setCheckResult(1 + "");
|
|
|
|
|
userCheckEntity.setResultExplain("通过");
|
|
|
|
|
//生成账号密码
|
|
|
|
|
String userName = "YYJY"+UuidUtils.getShortUuid(4);
|
|
|
|
|
String userName = "YYJY" + UuidUtils.getShortUuid(4);
|
|
|
|
|
String password = "123456";
|
|
|
|
|
UserRegisterEntity id = userRegisterService.getOne(new QueryWrapper<UserRegisterEntity>().eq("id", registComPerResponse.getId()));
|
|
|
|
|
UserPersonEntity userPersonEntity = new UserPersonEntity();
|
|
|
|
|
BeanUtils.copyProperties(id,userPersonEntity);
|
|
|
|
|
BeanUtils.copyProperties(id, userPersonEntity);
|
|
|
|
|
userPersonEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
userPersonEntity.setEmail(id.getXemail());
|
|
|
|
|
userPersonEntity.setUserName(userName);
|
|
|
|
@ -276,28 +275,26 @@ public class UserRegisterController extends BaseController {
|
|
|
|
|
userPersonEntity.setRegisterId(Long.valueOf(registComPerResponse.getId()));
|
|
|
|
|
userPersonService.insert(userPersonEntity);
|
|
|
|
|
//发送邮件
|
|
|
|
|
iEmailService.sendSimpleMail(id.getXemail(),"测试邮箱","账号:"+userName+",密码:"+password);
|
|
|
|
|
|
|
|
|
|
iEmailService.sendSimpleMail(id.getXemail(), "测试邮箱", "账号:" + userName + ",密码:" + password);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 生产企业任务配置表
|
|
|
|
|
UserCompanyConfigEntity userCompanyConfigEntity = new UserCompanyConfigEntity();
|
|
|
|
|
userCompanyConfigEntity.setCompanyId(Long.valueOf(registComPerResponse.getUcId()));
|
|
|
|
|
userCompanyConfigEntity.setHeartRate(10);
|
|
|
|
|
userCompanyConfigService.updateByCompanyId(userCompanyConfigEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//修改注册表中的状态 企业状态 操作表中插入记录
|
|
|
|
|
userCheckEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
userCheckEntity.setBusinessId(Long.valueOf(registComPerResponse.getUcId()));
|
|
|
|
|
userCheckEntity.setCreateUser(registComPerResponse.getReviewer());
|
|
|
|
|
if(!"isPass".equals(registComPerResponse.getIsPass())){
|
|
|
|
|
userCheckEntity.setCheckResult(0+"");
|
|
|
|
|
if (!"isPass".equals(registComPerResponse.getIsPass())) {
|
|
|
|
|
userCheckEntity.setCheckResult(0 + "");
|
|
|
|
|
userCheckEntity.setResultExplain(registComPerResponse.getReason());
|
|
|
|
|
}
|
|
|
|
|
userCheckEntity.setCreateTime(new Date());
|
|
|
|
|
|
|
|
|
|
// userCertSetEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
// userCertSetEntity.setName(registComPerResponse.getName());
|
|
|
|
|
// userCertSetEntity.setCreateUser(registComPerResponse.getReviewer());
|
|
|
|
|
// userCertSetEntity.setCreateTime(new Date());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
userRegisterEntity.setId(Long.valueOf(registComPerResponse.getId()));
|
|
|
|
|
userRegisterEntity.setCheckStatus(registComPerResponse.getCheckStatus());
|
|
|
|
|
userCompanyEntity.setId(Long.valueOf(registComPerResponse.getUcId()));
|
|
|
|
@ -308,15 +305,15 @@ public class UserRegisterController extends BaseController {
|
|
|
|
|
userRegisterService.updateById(userRegisterEntity);
|
|
|
|
|
userCompanyService.updateById(userCompanyEntity);
|
|
|
|
|
userCheckService.insert(userCheckEntity);
|
|
|
|
|
// userCertSetService.insert(userCertSetEntity);
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
// userCertSetService.insert(userCertSetEntity);
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//对手机 验证码进行加密/解密
|
|
|
|
|
//对手机 验证码进行加密/解密
|
|
|
|
|
@PostMapping("/admin/auth/register/encrypt")
|
|
|
|
|
public BaseResponse encrypt(@RequestBody MobileCaptchaRequest mobileCaptchaRequest){
|
|
|
|
|
if(mobileCaptchaRequest == null){
|
|
|
|
|
return ResultVOUtils.error(500,"");
|
|
|
|
|
public BaseResponse encrypt(@RequestBody MobileCaptchaRequest mobileCaptchaRequest) {
|
|
|
|
|
if (mobileCaptchaRequest == null) {
|
|
|
|
|
return ResultVOUtils.error(500, "");
|
|
|
|
|
}
|
|
|
|
|
MobileCaptchaRequest mobileCaptchaRequest1 = new MobileCaptchaRequest();
|
|
|
|
|
String mobile;
|
|
|
|
@ -326,11 +323,11 @@ public class UserRegisterController extends BaseController {
|
|
|
|
|
"0123456789ABHAEQ".getBytes(),
|
|
|
|
|
// iv加盐,按照实际需求添加
|
|
|
|
|
"DYgjCEIMVrj2W9xN".getBytes());
|
|
|
|
|
if("key".equals(mobileCaptchaRequest.getKey())){
|
|
|
|
|
if ("key".equals(mobileCaptchaRequest.getKey())) {
|
|
|
|
|
// 加密
|
|
|
|
|
mobile = aes.encryptHex(mobileCaptchaRequest.getMobile());
|
|
|
|
|
captcha = aes.encryptHex(mobileCaptchaRequest.getCaptcha());
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
mobile = aes.decryptStr(mobileCaptchaRequest.getMobile());
|
|
|
|
|
captcha = aes.decryptStr(mobileCaptchaRequest.getCaptcha());
|
|
|
|
|
|
|
|
|
@ -342,8 +339,4 @@ public class UserRegisterController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|