|
@@ -11,6 +11,7 @@ import com.caimei365.user.model.po.ShopPo;
|
|
|
import com.caimei365.user.model.po.UserPo;
|
|
|
import com.caimei365.user.model.vo.ServiceProviderVo;
|
|
|
import com.caimei365.user.model.vo.UserLoginVo;
|
|
|
+import com.caimei365.user.model.vo.UserVo;
|
|
|
import com.caimei365.user.service.RegisterService;
|
|
|
import com.caimei365.user.components.RedisService;
|
|
|
import com.caimei365.user.utils.AliyunSmsUtil;
|
|
@@ -71,7 +72,7 @@ public class RegisterServiceImpl implements RegisterService {
|
|
|
String ip = headers.getFirst("X-CLIENT-IP");
|
|
|
log.info("机构注册 X-CLIENT-IP : " + ip);
|
|
|
// 参数校验
|
|
|
- if (StringUtils.isBlank(clubRegisterDto.getUserName()) || StringUtils.isBlank(clubRegisterDto.getBindMobile())
|
|
|
+ if (null == clubRegisterDto.getIsAgreed() || StringUtils.isBlank(clubRegisterDto.getUserName()) || StringUtils.isBlank(clubRegisterDto.getBindMobile())
|
|
|
|| StringUtils.isBlank(clubRegisterDto.getPassword()) || StringUtils.isBlank(clubRegisterDto.getPassWordConfirm()) ||
|
|
|
StringUtils.isBlank(clubRegisterDto.getSmsCode())) {
|
|
|
return ResponseJson.error("参数异常");
|
|
@@ -367,7 +368,7 @@ public class RegisterServiceImpl implements RegisterService {
|
|
|
* @return ClubPo
|
|
|
*/
|
|
|
@Override
|
|
|
- public ResponseJson<ClubPo> clubOnline(ClubOnlineDto onlineDto, HttpHeaders headers) {
|
|
|
+ public ResponseJson clubOnline(ClubOnlineDto onlineDto, HttpHeaders headers) {
|
|
|
Integer isAgreed = onlineDto.getIsAgreed();
|
|
|
// 打印IP
|
|
|
String ip = headers.getFirst("X-CLIENT-IP");
|
|
@@ -377,20 +378,20 @@ public class RegisterServiceImpl implements RegisterService {
|
|
|
// 参数校验
|
|
|
if (onlineDto.getUserId() == null || StringUtils.isBlank(onlineDto.getLinkMan()) || StringUtils.isBlank(mobile)
|
|
|
|| isAgreed == null) {
|
|
|
- return ResponseJson.error("参数异常", null);
|
|
|
+ return ResponseJson.error("参数异常");
|
|
|
}
|
|
|
if (1 != isAgreed) {
|
|
|
- return ResponseJson.error("请勾选同意协议", null);
|
|
|
+ return ResponseJson.error("请勾选同意协议");
|
|
|
}
|
|
|
// 是否填写升级资料
|
|
|
if (StringUtils.isNotBlank(onlineDto.getContractEmail())) {
|
|
|
// 邮箱验证
|
|
|
if (ValidateUtil.validateEmail(onlineDto.getContractEmail())) {
|
|
|
- return ResponseJson.error("邮箱格式不正确", null);
|
|
|
+ return ResponseJson.error("邮箱格式不正确");
|
|
|
}
|
|
|
Integer userIdByEmail = baseMapper.getUserIdByEmail(onlineDto.getContractEmail());
|
|
|
if (null != userIdByEmail && userIdByEmail > 0 ) {
|
|
|
- return ResponseJson.error("该邮箱已被使用", null);
|
|
|
+ return ResponseJson.error("该邮箱已被使用");
|
|
|
}
|
|
|
// 机构名称检查
|
|
|
ResponseJson responseJson = ValidateUtil.validateClubName(onlineDto.getName());
|
|
@@ -399,17 +400,17 @@ public class RegisterServiceImpl implements RegisterService {
|
|
|
}
|
|
|
Integer clubCount = loginMapper.getClubCountByClubName(onlineDto.getName());
|
|
|
if (clubCount != null && clubCount > 0) {
|
|
|
- return ResponseJson.error("该名称已存在,请拨打电话:0755-22907771,联系采美客服", null);
|
|
|
+ return ResponseJson.error("该名称已存在,请拨打电话:0755-22907771,联系采美客服");
|
|
|
}
|
|
|
if (onlineDto.getFirstClubType() == 1){
|
|
|
if (onlineDto.getSecondClubType() == null || StringUtils.isBlank(onlineDto.getDepartment()) || StringUtils.isBlank(onlineDto.getMedicalPracticeLicense())) {
|
|
|
- return ResponseJson.error("医美分类下参数异常", null);
|
|
|
+ return ResponseJson.error("医美分类下参数异常");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// 手机号验证
|
|
|
String result = mobileAndCodeValidate(mobile, null);
|
|
|
- if (result != null) {return ResponseJson.error(result, null);}
|
|
|
+ if (result != null) {return ResponseJson.error(result);}
|
|
|
// 获取协销信息
|
|
|
Integer userId = onlineDto.getUserId();
|
|
|
ServiceProviderVo serviceProvider = loginMapper.getServiceProviderByUserId(userId);
|
|
@@ -560,7 +561,7 @@ public class RegisterServiceImpl implements RegisterService {
|
|
|
log.info(logTxt);
|
|
|
|
|
|
// 返回状态
|
|
|
- return ResponseJson.success(club);
|
|
|
+ return ResponseJson.success();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -593,17 +594,17 @@ public class RegisterServiceImpl implements RegisterService {
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public ResponseJson<ShopPo> shopRegister(ShopRegisterDto shopRegisterDto, String passWordConfirm, String smsCode, Integer isAgreed, Integer whichStep, HttpHeaders headers) {
|
|
|
+ public ResponseJson shopRegister(ShopRegisterDto shopRegisterDto, String passWordConfirm, String smsCode, Integer isAgreed, Integer whichStep, HttpHeaders headers) {
|
|
|
// 打印IP
|
|
|
String ip = headers.getFirst("X-CLIENT-IP");
|
|
|
log.info("供应商注册 X-CLIENT-IP : " + ip);
|
|
|
// 参数校验
|
|
|
- if (StringUtils.isBlank(shopRegisterDto.getBindMobile()) || StringUtils.isBlank(smsCode)
|
|
|
+ if (null == isAgreed || StringUtils.isBlank(shopRegisterDto.getBindMobile()) || StringUtils.isBlank(smsCode)
|
|
|
|| StringUtils.isBlank(shopRegisterDto.getPassword()) || StringUtils.isBlank(passWordConfirm)) {
|
|
|
- return ResponseJson.error("参数异常", null);
|
|
|
+ return ResponseJson.error("参数异常");
|
|
|
}
|
|
|
if (!shopRegisterDto.getPassword() .equals(passWordConfirm)) {
|
|
|
- return ResponseJson.error("两次输入的密码不一致", null);
|
|
|
+ return ResponseJson.error("两次输入的密码不一致");
|
|
|
}
|
|
|
// 手机号与验证码校验
|
|
|
String result = mobileAndCodeValidate(shopRegisterDto.getBindMobile(), smsCode);
|
|
@@ -613,13 +614,13 @@ public class RegisterServiceImpl implements RegisterService {
|
|
|
return ResponseJson.success(null);
|
|
|
}
|
|
|
if (StringUtils.isBlank(shopRegisterDto.getName()) || StringUtils.isBlank(shopRegisterDto.getLinkMan())) {
|
|
|
- return ResponseJson.error("参数异常", null);
|
|
|
+ return ResponseJson.error("参数异常");
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(shopRegisterDto.getEmail())) {
|
|
|
// 查找用户表是否存在相同邮箱
|
|
|
Integer userIdByEmail = baseMapper.getUserIdByEmail(shopRegisterDto.getEmail());
|
|
|
if (null != userIdByEmail && userIdByEmail > 0) {
|
|
|
- return ResponseJson.error("该邮箱已被使用", null);
|
|
|
+ return ResponseJson.error("该邮箱已被使用");
|
|
|
}
|
|
|
}
|
|
|
// 小程序第二步校验完成
|
|
@@ -627,7 +628,7 @@ public class RegisterServiceImpl implements RegisterService {
|
|
|
return ResponseJson.success(null);
|
|
|
}
|
|
|
if (1 != isAgreed) {
|
|
|
- return ResponseJson.error("请勾选同意协议", null);
|
|
|
+ return ResponseJson.error("请勾选同意协议");
|
|
|
}
|
|
|
/*
|
|
|
组装用户数据 user
|
|
@@ -707,41 +708,49 @@ public class RegisterServiceImpl implements RegisterService {
|
|
|
int insertShopFlag = registerMapper.insertShop(shop);
|
|
|
if (insertShopFlag < 1) {
|
|
|
log.info(shop.getUserId() + " 插入数据库异常shop:" + shop.toString());
|
|
|
- return ResponseJson.error("插入数据库异常", null);
|
|
|
+ return ResponseJson.error("插入数据库异常");
|
|
|
}
|
|
|
// user更新shopId
|
|
|
user.setShopId(shop.getShopId());
|
|
|
registerMapper.updateUserShopId(user.getUserId(), shop.getShopId());
|
|
|
log.info("注册供应商---------userID:" + user.getUserId());
|
|
|
- return ResponseJson.success(shop);
|
|
|
+ return ResponseJson.success();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @param shopApplyDto ShopApplyDto
|
|
|
+ * @param shop ShopApplyDto
|
|
|
* @param headers HttpHeaders
|
|
|
* @return ShopPo
|
|
|
*/
|
|
|
@Override
|
|
|
- public ResponseJson<ShopPo> updateShopApply(ShopApplyDto shopApplyDto, HttpHeaders headers) {
|
|
|
- /*if (null == shopRegisterDto || null == ShopRegisterDto.getUserId() || null == shop.getShopID()) {
|
|
|
- return ResponseJson.error("参数异常", null);
|
|
|
+ public ResponseJson updateShopApply(ShopApplyDto shop, HttpHeaders headers) {
|
|
|
+ if (null == shop || null == shop.getUserId() || null == shop.getShopId() || null ==shop.getIsAgreed()) {
|
|
|
+ return ResponseJson.error("参数异常");
|
|
|
}
|
|
|
- if (!"1".equals(isAgreed)) {
|
|
|
- return ResponseJson.error("请勾选同意协议", null);
|
|
|
- }*/
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ if (1 != shop.getIsAgreed()) {
|
|
|
+ return ResponseJson.error("请勾选同意协议");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(shop.getEmail())) {
|
|
|
+ Integer userIdByEmail = baseMapper.getUserIdByEmail(shop.getEmail());
|
|
|
+ if (null != userIdByEmail && userIdByEmail > 0 && !userIdByEmail.equals(shop.getUserId())) {
|
|
|
+ return ResponseJson.error("该邮箱已被使用");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 更新用户数据 user
|
|
|
+ UserPo user = new UserPo();
|
|
|
+ user.setUserId(shop.getUserId());
|
|
|
+ user.setUserName(shop.getShortName());
|
|
|
+ user.setName(shop.getLinkMan());
|
|
|
+ user.setEmail(shop.getEmail());
|
|
|
+ user.setManufacturerStatus(3);
|
|
|
+ // 更新供应商用户信息
|
|
|
+ registerMapper.updateShopUserByApply(user);
|
|
|
+ // 更新机构信息
|
|
|
+ shop.setStatus(3);
|
|
|
+ registerMapper.updateShopInfoByApply(shop);
|
|
|
|
|
|
+ return ResponseJson.success("修改机构资料成功", null);
|
|
|
|
|
|
- return null;
|
|
|
}
|
|
|
|
|
|
/**
|