入驻信息转成店铺接口开发
This commit is contained in:
parent
0bddd33531
commit
3a06d4db4c
@ -28,38 +28,28 @@ import java.util.Map;
|
|||||||
@RequestMapping("/admin/account/accountController")
|
@RequestMapping("/admin/account/accountController")
|
||||||
public class AccountController {
|
public class AccountController {
|
||||||
|
|
||||||
@Autowired
|
private static final Logger logger = LoggerFactory.getLogger(AccountController.class);
|
||||||
private AccountUserBaseService accountUserBaseService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
AccountUserAnalyticsService accountUserAnalyticsService;
|
AccountUserAnalyticsService accountUserAnalyticsService;
|
||||||
|
@Autowired
|
||||||
|
private AccountUserBaseService accountUserBaseService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private AccountUserLoginService accountUserLoginService;
|
private AccountUserLoginService accountUserLoginService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AccountUserInfoService accountUserInfoService;
|
private AccountUserInfoService accountUserInfoService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AccountBaseUserLevelService accountBaseUserLevelService;
|
private AccountBaseUserLevelService accountBaseUserLevelService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AccountBaseRoleLevelService accountBaseRoleLevelService;
|
private AccountBaseRoleLevelService accountBaseRoleLevelService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AccountUserSnsService accountUserSnsService;
|
private AccountUserSnsService accountUserSnsService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AccountUserBindConnectService accountUserBindConnectService;
|
private AccountUserBindConnectService accountUserBindConnectService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AccountUserChainService accountUserChainService;
|
private AccountUserChainService accountUserChainService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AccountUserTypeService accountUserTypeService;
|
private AccountUserTypeService accountUserTypeService;
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(AccountController.class);
|
|
||||||
|
|
||||||
@ApiOperation(value = "用户基本信息", notes = "用户基本信息")
|
@ApiOperation(value = "用户基本信息", notes = "用户基本信息")
|
||||||
@RequestMapping(value = "/getUserBase", method = RequestMethod.GET)
|
@RequestMapping(value = "/getUserBase", method = RequestMethod.GET)
|
||||||
public AccountUserBase getUserBase(@RequestParam(name = "user_id") Integer user_id) {
|
public AccountUserBase getUserBase(@RequestParam(name = "user_id") Integer user_id) {
|
||||||
@ -211,8 +201,9 @@ public class AccountController {
|
|||||||
@ApiOperation(value = "用户SNS信息", notes = "用户SNS信息")
|
@ApiOperation(value = "用户SNS信息", notes = "用户SNS信息")
|
||||||
@RequestMapping(value = "/getBind", method = RequestMethod.GET)
|
@RequestMapping(value = "/getBind", method = RequestMethod.GET)
|
||||||
public Map getBind(@RequestParam(name = "user_id") Integer user_id,
|
public Map getBind(@RequestParam(name = "user_id") Integer user_id,
|
||||||
@RequestParam(name = "bind_type") Integer bind_type) {
|
@RequestParam(name = "bind_type") Integer bind_type,
|
||||||
return accountUserBindConnectService.getBind(user_id, bind_type);
|
@RequestParam(name = "user_type", defaultValue = "0") Integer user_type) {
|
||||||
|
return accountUserBindConnectService.getBind(user_id, bind_type, user_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/getUserInfoAndBase", method = RequestMethod.GET)
|
@RequestMapping(value = "/getUserInfoAndBase", method = RequestMethod.GET)
|
||||||
|
|||||||
@ -76,5 +76,14 @@ public class AccountUserBindConnectController {
|
|||||||
return CommonResult.success(flag);
|
return CommonResult.success(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "获取绑定关系的用户Id", notes = "根据 bind_id 和 bind_type user_type 获取绑定关系的用户Id(仅供内部调用)")
|
||||||
|
@RequestMapping(value = "/get-userid-by-condition", method = RequestMethod.POST)
|
||||||
|
public Integer getUserBindConnectUserIdByCondition(@RequestParam(name = "bind_id") String bind_id,
|
||||||
|
@RequestParam(name = "bind_type") Integer bind_type,
|
||||||
|
@RequestParam(name = "user_type", required = false) Integer user_type) {
|
||||||
|
return accountUserBindConnectService.getUserBindConnectUserIdByCondition(bind_id, bind_type, user_type);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,23 +20,25 @@ public interface AccountUserBindConnectService extends IBaseService<AccountUserB
|
|||||||
*
|
*
|
||||||
* @param user_id
|
* @param user_id
|
||||||
* @param bind_type
|
* @param bind_type
|
||||||
|
* @param user_type
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AccountUserBindConnect getBindByUserId(Integer user_id, Integer bind_type);
|
AccountUserBindConnect getBindByUserId(Integer user_id, Integer bind_type, Integer user_type);
|
||||||
|
|
||||||
Map getBind(Integer user_id, int bind_type);
|
Map getBind(Integer user_id, Integer bind_type, Integer user_type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据 bind_id 和 bind_type 获取一条记录
|
* 根据 bind_id 和 bind_type 获取一条记录
|
||||||
*
|
*
|
||||||
* @param bind_id
|
* @param bind_id
|
||||||
* @param bind_type
|
* @param bind_type
|
||||||
|
* @param user_type
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AccountUserBindConnect getBindByBindId(String bind_id, Integer bind_type);
|
AccountUserBindConnect getBindByBindId(String bind_id, Integer bind_type, Integer user_type);
|
||||||
|
|
||||||
|
|
||||||
boolean checkBind(String bind_id, int bind_type, Integer user_id, AccountUserBindConnect user_info_row);
|
boolean checkBind(String bind_id, int bind_type, Integer user_id, Integer user_type, AccountUserBindConnect user_info_row);
|
||||||
|
|
||||||
boolean checkAccessToken(Integer bind_type, AccountUserBindConnect bind_data, Integer user_id);
|
boolean checkAccessToken(Integer bind_type, AccountUserBindConnect bind_data, Integer user_id);
|
||||||
|
|
||||||
@ -44,10 +46,20 @@ public interface AccountUserBindConnectService extends IBaseService<AccountUserB
|
|||||||
* 传入各渠道数据信息,完成绑定操作,包含注册绑定
|
* 传入各渠道数据信息,完成绑定操作,包含注册绑定
|
||||||
*
|
*
|
||||||
* @param user_info_row bind_connect数据
|
* @param user_info_row bind_connect数据
|
||||||
* @param reg_flag 是否需要注册新账号
|
* @param needRegNow 是否需要注册新账号
|
||||||
* @source_user_id 父级用户id
|
* @source_user_id 父级用户id
|
||||||
* @activity_id 活动id
|
* @activity_id 活动id
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
Integer doUserBind(AccountUserBindConnect user_info_row, String activity_id, boolean reg_flag);
|
Integer doUserBind(AccountUserBindConnect user_info_row, String activity_id, boolean needRegNow);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 bind_id 和 bind_type user_type 获取绑定关系的 user_id
|
||||||
|
*
|
||||||
|
* @param bindId
|
||||||
|
* @param bindType
|
||||||
|
* @param userType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer getUserBindConnectUserIdByCondition(String bindId, Integer bindType, Integer userType);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -189,7 +189,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
data.put("key", token);
|
data.put("key", token);
|
||||||
data.put("rid", rid); // 用户角色 rid:0-用户;2-商家;3-门店;9-平台;
|
data.put("rid", rid); // 用户角色 rid:0-用户;2-商家;3-门店;9-平台;
|
||||||
|
|
||||||
String as = bindConnectService.getBind(user_id, BindCode.MOBILE) == null ? "0" : "1";
|
String as = bindConnectService.getBind(user_id, BindCode.MOBILE, userDto.getUserType()) == null ? "0" : "1";
|
||||||
data.put("as", as);
|
data.put("as", as);
|
||||||
CookieUtils.setCookie("as", as);
|
CookieUtils.setCookie("as", as);
|
||||||
|
|
||||||
@ -841,7 +841,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
// data.put("key", ukey);
|
// data.put("key", ukey);
|
||||||
|
|
||||||
// 判断是否绑定,是否填写地址
|
// 判断是否绑定,是否填写地址
|
||||||
Map bind_row = bindConnectService.getBind(user_id, BindCode.MOBILE);
|
Map bind_row = bindConnectService.getBind(user_id, BindCode.MOBILE, (Integer) data.get("user_is_admin"));
|
||||||
if (bind_row != null) {
|
if (bind_row != null) {
|
||||||
CookieUtils.setCookie("as", "1");
|
CookieUtils.setCookie("as", "1");
|
||||||
data.put("as", 1);
|
data.put("as", 1);
|
||||||
@ -945,7 +945,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
Integer userLevelId = getParameter("user_level_id", Integer.class);
|
Integer userLevelId = getParameter("user_level_id", Integer.class);
|
||||||
Integer user_state = getParameter("user_state", Integer.class);
|
Integer user_state = getParameter("user_state", Integer.class);
|
||||||
|
|
||||||
Map data = new HashMap();
|
Map data;
|
||||||
Map param = new HashMap();
|
Map param = new HashMap();
|
||||||
|
|
||||||
if (user_certification != -1) {
|
if (user_certification != -1) {
|
||||||
@ -1620,7 +1620,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
// todo 支持国外手机号 isMobile() 方法
|
// todo 支持国外手机号 isMobile() 方法
|
||||||
String currency_id = "+" + getParameter("currency_id", "");
|
String currency_id = "+" + getParameter("currency_id", "");
|
||||||
|
|
||||||
org.apache.commons.lang3.StringUtils.isBlank("");
|
// org.apache.commons.lang3.StringUtils.isBlank("");
|
||||||
if (StrUtil.isNotBlank(user_mobile) || (CheckUtil.isMobile(user_account, currency_id) && StrUtil.equals(user_account, user_mobile))) {
|
if (StrUtil.isNotBlank(user_mobile) || (CheckUtil.isMobile(user_account, currency_id) && StrUtil.equals(user_account, user_mobile))) {
|
||||||
// 是否为手机号码的注册
|
// 是否为手机号码的注册
|
||||||
// 拆分手机号码为intl + code
|
// 拆分手机号码为intl + code
|
||||||
@ -1674,7 +1674,9 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
String user_email = (String) userInfo.get("user_email");
|
String user_email = (String) userInfo.get("user_email");
|
||||||
Integer bind_type = getParameter("bind_type", 0);
|
Integer bind_type = getParameter("bind_type", 0);
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(user_email) || (CheckUtil.isEmail(user_account) && StrUtil.equals(user_account, user_email)) || bind_type.equals(2)) {
|
if (StrUtil.isNotBlank(user_email)
|
||||||
|
|| (CheckUtil.isEmail(user_account) && StrUtil.equals(user_account, user_email))
|
||||||
|
|| bind_type.equals(2)) {
|
||||||
// 是否为邮箱注册
|
// 是否为邮箱注册
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(rand_key)) {
|
if (StrUtil.isNotBlank(rand_key)) {
|
||||||
@ -1710,7 +1712,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
// 用户尚未注册,立即新增用户基本信息和用户附加信息
|
// 用户尚未注册,立即新增用户基本信息和用户附加信息
|
||||||
String user_nickname = Convert.toStr(userInfo.get("user_nickname"), user_account);
|
String user_nickname = Convert.toStr(userInfo.get("user_nickname"), user_account);
|
||||||
Integer user_state = Convert.toInt(userInfo.get("user_state"), 2);
|
Integer user_state = Convert.toInt(userInfo.get("user_state"), 2);
|
||||||
Integer user_is_admin = Convert.toInt(userInfo.get("is_admin"), CommonConstant.USER_TYPE_NORMAL);
|
Integer user_is_admin = Convert.toInt(userInfo.get("user_is_admin"), CommonConstant.USER_TYPE_NORMAL); // 用户类型:0-普通用户;1-管理员;2-入驻商户;默认是普通用户
|
||||||
String user_key = IdUtil.simpleUUID();
|
String user_key = IdUtil.simpleUUID();
|
||||||
String user_salt = IdUtil.simpleUUID();
|
String user_salt = IdUtil.simpleUUID();
|
||||||
String user_token = IdUtil.simpleUUID();
|
String user_token = IdUtil.simpleUUID();
|
||||||
@ -1718,7 +1720,9 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
String store_ids = Convert.toStr(userInfo.get("store_ids"), "");
|
String store_ids = Convert.toStr(userInfo.get("store_ids"), "");
|
||||||
|
|
||||||
user_base_reg_row.setUser_account(user_account);
|
user_base_reg_row.setUser_account(user_account);
|
||||||
user_base_reg_row.setUser_password(SecureUtil.md5(user_salt + SecureUtil.md5(user_password)));
|
// 密码加盐加密
|
||||||
|
user_password = SecureUtil.md5(user_salt + SecureUtil.md5(user_password));
|
||||||
|
user_base_reg_row.setUser_password(user_password);
|
||||||
// user_base_reg_row.setUser_password((BCrypt.hashpw(user_password)));
|
// user_base_reg_row.setUser_password((BCrypt.hashpw(user_password)));
|
||||||
|
|
||||||
user_base_reg_row.setUser_nickname(user_nickname);
|
user_base_reg_row.setUser_nickname(user_nickname);
|
||||||
@ -1783,23 +1787,23 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
// connect绑定操作
|
// connect绑定操作
|
||||||
AccountUserBindConnect bindConnect = new AccountUserBindConnect();
|
AccountUserBindConnect bindConnect = new AccountUserBindConnect();
|
||||||
bindConnect.setBind_openid(user_mobile);
|
bindConnect.setBind_openid(user_mobile);
|
||||||
bindConnect.setBind_active(1);
|
bindConnect.setBind_active(CommonConstant.Enable);
|
||||||
|
|
||||||
if (!bindConnectService.checkBind(user_mobile, BindCode.MOBILE, user_id, bindConnect)) {
|
if (!bindConnectService.checkBind(user_mobile, BindCode.MOBILE, user_id, user_is_admin, bindConnect)) {
|
||||||
throw new ApiException(ResultCode.FAILED);
|
throw new ApiException(ResultCode.FAILED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 是否为邮箱注册
|
// 是否为邮箱注册
|
||||||
if (StrUtil.isNotBlank(user_email) || bind_type.equals(2)) {
|
if (StrUtil.isNotBlank(user_email) || bind_type.equals(BindCode.EMAIL)) {
|
||||||
// connect绑定操作
|
// connect绑定操作
|
||||||
AccountUserBindConnect bindConnect = new AccountUserBindConnect();
|
AccountUserBindConnect bindConnect = new AccountUserBindConnect();
|
||||||
bindConnect.setBind_openid(user_email);
|
bindConnect.setBind_openid(user_email);
|
||||||
bindConnect.setBind_active(1);
|
bindConnect.setBind_active(CommonConstant.Enable);
|
||||||
|
|
||||||
String bind_id = StrUtil.isNotBlank(user_email) ? user_email : user_account;
|
String bind_id = StrUtil.isNotBlank(user_email) ? user_email : user_account;
|
||||||
|
|
||||||
if (!bindConnectService.checkBind(bind_id, BindCode.EMAIL, user_id, bindConnect)) {
|
if (!bindConnectService.checkBind(bind_id, BindCode.EMAIL, user_id, user_base_row.getUser_is_admin(), bindConnect)) {
|
||||||
throw new ApiException(ResultCode.FAILED);
|
throw new ApiException(ResultCode.FAILED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1807,7 +1811,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
// 远程调用异常忽略掉
|
// 远程调用异常忽略掉
|
||||||
try {
|
try {
|
||||||
// todo trigger
|
// todo trigger
|
||||||
// User_Resource初始化
|
// User_Resource初始化 用户积分
|
||||||
if (!payService.initUserPoints(user_id)) {
|
if (!payService.initUserPoints(user_id)) {
|
||||||
// throw new ApiException(ResultCode.FAILED);
|
// throw new ApiException(ResultCode.FAILED);
|
||||||
}
|
}
|
||||||
@ -1853,7 +1857,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
addChannelSourceUserId(user_id, source_ucc_code);
|
addChannelSourceUserId(user_id, source_ucc_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
//初次注册消息
|
//初次注册发送消息
|
||||||
String message_id = "registration-of-welcome-information";
|
String message_id = "registration-of-welcome-information";
|
||||||
HashMap<String, Object> args = new HashMap<>();
|
HashMap<String, Object> args = new HashMap<>();
|
||||||
args.put("user_account", user_nickname);
|
args.put("user_account", user_nickname);
|
||||||
@ -2223,6 +2227,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
accountUserBindConnectNew.setBind_id(bind_id);
|
accountUserBindConnectNew.setBind_id(bind_id);
|
||||||
accountUserBindConnectNew.setBind_type(BindCode.MOBILE);
|
accountUserBindConnectNew.setBind_type(BindCode.MOBILE);
|
||||||
accountUserBindConnectNew.setUser_id(currentUser.getId());
|
accountUserBindConnectNew.setUser_id(currentUser.getId());
|
||||||
|
accountUserBindConnectNew.setUser_type(currentUser.getUserType());
|
||||||
accountUserBindConnectNew.setBind_gender(getParameter("gender", 0));
|
accountUserBindConnectNew.setBind_gender(getParameter("gender", 0));
|
||||||
accountUserBindConnectNew.setBind_vip(getParameter("vip", 0));
|
accountUserBindConnectNew.setBind_vip(getParameter("vip", 0));
|
||||||
accountUserBindConnectNew.setBind_level(getParameter("level", 0));
|
accountUserBindConnectNew.setBind_level(getParameter("level", 0));
|
||||||
@ -2367,12 +2372,14 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
return CommonResult.failed("缺少必要参数!");
|
return CommonResult.failed("缺少必要参数!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UserDto userDto = getCurrentUser();
|
||||||
|
|
||||||
String mobileOrEmail = "";
|
String mobileOrEmail = "";
|
||||||
AccountUserBindConnect accountUserBindConnect = null;
|
AccountUserBindConnect accountUserBindConnect = null;
|
||||||
boolean isMobile = PhoneNumberUtils.checkPhoneNumber(number);
|
boolean isMobile = PhoneNumberUtils.checkPhoneNumber(number);
|
||||||
if (isMobile) {
|
if (isMobile) {
|
||||||
// number 是手机格式
|
// number 是手机格式
|
||||||
accountUserBindConnect = accountUserBindConnectService.getBindByBindId(PhoneNumberUtils.convZhPhoneNumber(number), BindCode.MOBILE);
|
accountUserBindConnect = accountUserBindConnectService.getBindByBindId(PhoneNumberUtils.convZhPhoneNumber(number), BindCode.MOBILE, userDto.getUserType());
|
||||||
if (accountUserBindConnect != null) {
|
if (accountUserBindConnect != null) {
|
||||||
// 获取绑定的手机号(带国家码)
|
// 获取绑定的手机号(带国家码)
|
||||||
mobileOrEmail = PhoneNumberUtils.convZhPhoneNumber(accountUserBindConnect.getBind_id());
|
mobileOrEmail = PhoneNumberUtils.convZhPhoneNumber(accountUserBindConnect.getBind_id());
|
||||||
@ -2380,7 +2387,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
|
|
||||||
} else if (CheckUtil.isEmail(number)) {
|
} else if (CheckUtil.isEmail(number)) {
|
||||||
// number 是邮箱格式
|
// number 是邮箱格式
|
||||||
accountUserBindConnect = accountUserBindConnectService.getBindByBindId(number, BindCode.EMAIL);
|
accountUserBindConnect = accountUserBindConnectService.getBindByBindId(number, BindCode.EMAIL, userDto.getUserType());
|
||||||
if (accountUserBindConnect != null) {
|
if (accountUserBindConnect != null) {
|
||||||
// email
|
// email
|
||||||
mobileOrEmail = accountUserBindConnect.getBind_id();
|
mobileOrEmail = accountUserBindConnect.getBind_id();
|
||||||
@ -2390,7 +2397,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
// number 是userAccount账号格式
|
// number 是userAccount账号格式
|
||||||
AccountUserBase accountUserBase = accountUserBaseService.getByAccount(number);
|
AccountUserBase accountUserBase = accountUserBaseService.getByAccount(number);
|
||||||
if (accountUserBase != null) {
|
if (accountUserBase != null) {
|
||||||
accountUserBindConnect = accountUserBindConnectService.getBindByUserId(accountUserBase.getUser_id(), BindCode.MOBILE);
|
accountUserBindConnect = accountUserBindConnectService.getBindByUserId(accountUserBase.getUser_id(), BindCode.MOBILE, accountUserBase.getUser_is_admin());
|
||||||
if (accountUserBindConnect != null) {
|
if (accountUserBindConnect != null) {
|
||||||
// 获取绑定的手机号(带国家码)
|
// 获取绑定的手机号(带国家码)
|
||||||
mobileOrEmail = PhoneNumberUtils.convZhPhoneNumber(accountUserBindConnect.getBind_id());
|
mobileOrEmail = PhoneNumberUtils.convZhPhoneNumber(accountUserBindConnect.getBind_id());
|
||||||
@ -2740,31 +2747,37 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
// 流程:通过手机号检查是否有绑定关系?没有就直接注册,有就直接登录,返回登录后的所有信息,附加是否已经申请入驻标记?
|
// 流程:通过手机号检查是否有绑定关系?没有就直接注册,有就直接登录,返回登录后的所有信息,附加是否已经申请入驻标记?
|
||||||
// 商家入驻账号,都是需要手机号绑定的。账号组成:1000000+(数字加法)自增ID,密码随机6位数
|
// 商家入驻账号,都是需要手机号绑定的。账号组成:1000000+(数字加法)自增ID,密码随机6位数
|
||||||
if (StrUtil.isBlank(user_mobile) || StrUtil.isBlank(verify_code)) {
|
if (StrUtil.isBlank(user_mobile) || StrUtil.isBlank(verify_code)) {
|
||||||
throw new ApiException(_("缺少必要参数!"));
|
// throw new ApiException(_("缺少必要参数!"));
|
||||||
|
return CommonResult.failed(_("缺少必要参数!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PhoneNumberUtils.checkPhoneNumber(user_mobile)) {
|
if (!PhoneNumberUtils.checkPhoneNumber(user_mobile)) {
|
||||||
throw new ApiException(_("请输入正确的手机号!"));
|
// throw new ApiException(_("请输入正确的手机号!"));
|
||||||
|
return CommonResult.failed(_("请输入正确的手机号!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrUtil.isBlank(rand_key)) {
|
if (StrUtil.isBlank(rand_key)) {
|
||||||
throw new ApiException(_("程序非法请求, 检测验证码键值!"));
|
// throw new ApiException(_("程序非法请求, 检测验证码键值!"));
|
||||||
|
return CommonResult.failed(_("程序非法请求, 检测验证码键值!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrUtil.isBlank(verify_code)) {
|
if (StrUtil.isBlank(verify_code)) {
|
||||||
throw new ApiException(_("请输入验证码!"));
|
// throw new ApiException(_("请输入验证码!"));
|
||||||
|
return CommonResult.failed(_("请输入验证码!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// rmk 为什么随机数和手机号一致?
|
// rmk 为什么随机数和手机号一致?
|
||||||
if (ObjectUtil.notEqual(user_mobile, rand_key)) {
|
if (ObjectUtil.notEqual(user_mobile, rand_key)) {
|
||||||
throw new ApiException(_("非法数据,或者提交超时,请刷新页面重新提交!"));
|
// throw new ApiException(_("非法数据,或者提交超时,请刷新页面重新提交!"));
|
||||||
|
return CommonResult.failed(_("非法数据,或者提交超时,请刷新页面重新提交!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
String verifyMobile = PhoneNumberUtils.convZhPhoneNumber(user_mobile);
|
String verifyMobile = PhoneNumberUtils.convZhPhoneNumber(user_mobile);
|
||||||
// if (!checkVerifyCode(verifyMobile, verify_code)) {
|
// if (!checkVerifyCode(verifyMobile, verify_code)) {
|
||||||
if (!"9999".equals(verify_code)) {
|
if (!"9999".equals(verify_code)) {
|
||||||
// TODO 切换到正式平台
|
// TODO 切换到正式平台
|
||||||
throw new ApiException(_("验证码错误!"));
|
// throw new ApiException(_("验证码错误!"));
|
||||||
|
return CommonResult.failed(_("验证码错误!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 找出手机对应的绑定用户
|
// 找出手机对应的绑定用户
|
||||||
@ -2818,18 +2831,21 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
Integer user_id = bind_row.getUser_id();
|
Integer user_id = bind_row.getUser_id();
|
||||||
accountUserBase = get(user_id);
|
accountUserBase = get(user_id);
|
||||||
if (accountUserBase == null) {
|
if (accountUserBase == null) {
|
||||||
throw new ApiException(ResultCode.FAILED);
|
// throw new ApiException(ResultCode.FAILED);
|
||||||
|
return CommonResult.failed("获取不到用户信息!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjectUtil.notEqual(CommonConstant.USER_TYPE_MCH, accountUserBase.getUser_is_admin())) {
|
if (ObjectUtil.notEqual(CommonConstant.USER_TYPE_MCH, accountUserBase.getUser_is_admin())) {
|
||||||
// 不是入驻商家的情况,已经有普通用户使用了手机号了,提示已经被注册。
|
// 不是入驻商家的情况,已经有普通用户使用了手机号了,提示已经被注册。
|
||||||
throw new ApiException(_("已被注册,请换一个手机号码!"));
|
// throw new ApiException(_("已被注册,请换一个手机号码!"));
|
||||||
|
return CommonResult.failed("已被注册,请换一个手机号码!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 手机号码未绑定的情况,直接去注册一个账号
|
// 手机号码未绑定的情况,直接去注册一个账号
|
||||||
Map<String, Object> userInfo = new HashMap<>();
|
Map<String, Object> userInfo = new HashMap<>();
|
||||||
userInfo.put("user_account", com.suisung.mall.common.utils.StringUtils.genLklOrderNo(4));// 时间 yyyyMMddHHmmss + 4位随机数
|
userInfo.put("user_account", com.suisung.mall.common.utils.StringUtils.genLklOrderNo(4));// 时间 yyyyMMddHHmmss + 4位随机数
|
||||||
userInfo.put("user_mobile", user_mobile);
|
userInfo.put("user_mobile", user_mobile);
|
||||||
|
userInfo.put("user_is_admin", CommonConstant.USER_TYPE_MCH); // 商家入驻注册
|
||||||
// userInfo.put("verify_code", verifyCode);
|
// userInfo.put("verify_code", verifyCode);
|
||||||
// 密码要随机数
|
// 密码要随机数
|
||||||
String user_password = com.suisung.mall.common.utils.StringUtils.random(6, com.suisung.mall.common.utils.StringUtils.RandomType.STRING);
|
String user_password = com.suisung.mall.common.utils.StringUtils.random(6, com.suisung.mall.common.utils.StringUtils.RandomType.STRING);
|
||||||
@ -2866,6 +2882,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
String bind_id = "";
|
String bind_id = "";
|
||||||
String union_id = null;
|
String union_id = null;
|
||||||
Integer user_id = null;
|
Integer user_id = null;
|
||||||
|
Integer user_type = CommonConstant.USER_TYPE_NORMAL;
|
||||||
|
|
||||||
switch (bind_name) {
|
switch (bind_name) {
|
||||||
case "weixin":
|
case "weixin":
|
||||||
@ -2875,6 +2892,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
union_id = getParameter("unionId");
|
union_id = getParameter("unionId");
|
||||||
bind_id = String.format("%s_%s", id_prefix, open_id);
|
bind_id = String.format("%s_%s", id_prefix, open_id);
|
||||||
|
|
||||||
|
|
||||||
//安全验证
|
//安全验证
|
||||||
//解析用户基本信息
|
//解析用户基本信息
|
||||||
AccountUserBindConnect accountUserBindConnect = new AccountUserBindConnect();
|
AccountUserBindConnect accountUserBindConnect = new AccountUserBindConnect();
|
||||||
@ -2889,6 +2907,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
accountUserBindConnect.setBind_country(getParameter("country", ""));
|
accountUserBindConnect.setBind_country(getParameter("country", ""));
|
||||||
accountUserBindConnect.setBind_icon(getParameter("avatarUrl", ""));
|
accountUserBindConnect.setBind_icon(getParameter("avatarUrl", ""));
|
||||||
accountUserBindConnect.setBind_type(bind_type);
|
accountUserBindConnect.setBind_type(bind_type);
|
||||||
|
accountUserBindConnect.setUser_type(user_type);
|
||||||
|
|
||||||
user_id = accountUserBindConnectService.doUserBind(accountUserBindConnect, "", true);
|
user_id = accountUserBindConnectService.doUserBind(accountUserBindConnect, "", true);
|
||||||
break;
|
break;
|
||||||
@ -2976,6 +2995,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
accountUserBindConnect.setBind_id(bind_id);
|
accountUserBindConnect.setBind_id(bind_id);
|
||||||
accountUserBindConnect.setBind_openid(id);
|
accountUserBindConnect.setBind_openid(id);
|
||||||
accountUserBindConnect.setBind_type(BindCode.GOOGLE);
|
accountUserBindConnect.setBind_type(BindCode.GOOGLE);
|
||||||
|
accountUserBindConnect.setUser_type(CommonConstant.USER_TYPE_NORMAL);
|
||||||
accountUserBindConnect.setBind_nickname(nickname);
|
accountUserBindConnect.setBind_nickname(nickname);
|
||||||
accountUserBindConnect.setBind_icon(picture);
|
accountUserBindConnect.setBind_icon(picture);
|
||||||
accountUserBindConnect.setBind_gender(gender);
|
accountUserBindConnect.setBind_gender(gender);
|
||||||
@ -3178,12 +3198,14 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
return CommonResult.failed("缺少必要参数!");
|
return CommonResult.failed("缺少必要参数!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UserDto userDto = getCurrentUser();
|
||||||
|
|
||||||
AccountUserBase accountUserBase;
|
AccountUserBase accountUserBase;
|
||||||
String mobileOrEmail = "";
|
String mobileOrEmail = "";
|
||||||
boolean isMobile = PhoneNumberUtils.checkPhoneNumber(userAccountOrMobile);
|
boolean isMobile = PhoneNumberUtils.checkPhoneNumber(userAccountOrMobile);
|
||||||
if (isMobile) {
|
if (isMobile) {
|
||||||
// number 是手机格式
|
// number 是手机格式
|
||||||
AccountUserBindConnect accountUserBindConnect = accountUserBindConnectService.getBindByBindId(PhoneNumberUtils.convZhPhoneNumber(userAccountOrMobile), BindCode.MOBILE);
|
AccountUserBindConnect accountUserBindConnect = accountUserBindConnectService.getBindByBindId(PhoneNumberUtils.convZhPhoneNumber(userAccountOrMobile), BindCode.MOBILE, userDto.getUserType());
|
||||||
if (accountUserBindConnect == null) {
|
if (accountUserBindConnect == null) {
|
||||||
return CommonResult.failed(_("账号有异常!"));
|
return CommonResult.failed(_("账号有异常!"));
|
||||||
}
|
}
|
||||||
@ -3202,7 +3224,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
return CommonResult.failed(_("账号有异常!"));
|
return CommonResult.failed(_("账号有异常!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
AccountUserBindConnect accountUserBindConnect = accountUserBindConnectService.getBindByUserId(accountUserBase.getUser_id(), BindCode.MOBILE);
|
AccountUserBindConnect accountUserBindConnect = accountUserBindConnectService.getBindByUserId(accountUserBase.getUser_id(), BindCode.MOBILE, accountUserBase.getUser_is_admin());
|
||||||
if (accountUserBindConnect == null) {
|
if (accountUserBindConnect == null) {
|
||||||
return CommonResult.failed(_("账号有异常!"));
|
return CommonResult.failed(_("账号有异常!"));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import com.suisung.mall.account.mapper.AccountUserBindConnectMapper;
|
|||||||
import com.suisung.mall.account.service.AccountUserBaseService;
|
import com.suisung.mall.account.service.AccountUserBaseService;
|
||||||
import com.suisung.mall.account.service.AccountUserBindConnectService;
|
import com.suisung.mall.account.service.AccountUserBindConnectService;
|
||||||
import com.suisung.mall.account.service.AccountUserInfoService;
|
import com.suisung.mall.account.service.AccountUserInfoService;
|
||||||
|
import com.suisung.mall.common.api.BindCode;
|
||||||
import com.suisung.mall.common.api.ResultCode;
|
import com.suisung.mall.common.api.ResultCode;
|
||||||
import com.suisung.mall.common.constant.CommonConstant;
|
import com.suisung.mall.common.constant.CommonConstant;
|
||||||
import com.suisung.mall.common.exception.ApiException;
|
import com.suisung.mall.common.exception.ApiException;
|
||||||
@ -16,6 +17,7 @@ import com.suisung.mall.common.modules.account.AccountUserBindConnect;
|
|||||||
import com.suisung.mall.common.modules.account.AccountUserInfo;
|
import com.suisung.mall.common.modules.account.AccountUserInfo;
|
||||||
import com.suisung.mall.common.utils.CheckUtil;
|
import com.suisung.mall.common.utils.CheckUtil;
|
||||||
import com.suisung.mall.common.utils.I18nUtil;
|
import com.suisung.mall.common.utils.I18nUtil;
|
||||||
|
import com.suisung.mall.common.utils.phone.PhoneNumberUtils;
|
||||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -48,14 +50,17 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
|
|||||||
*
|
*
|
||||||
* @param user_id
|
* @param user_id
|
||||||
* @param bind_type
|
* @param bind_type
|
||||||
|
* @param user_type
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AccountUserBindConnect getBindByUserId(Integer user_id, Integer bind_type) {
|
public AccountUserBindConnect getBindByUserId(Integer user_id, Integer bind_type, Integer user_type) {
|
||||||
|
user_type = ObjectUtil.isNotEmpty(user_type) ? user_type : CommonConstant.USER_TYPE_NORMAL;
|
||||||
QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("user_id", user_id)
|
queryWrapper.eq("user_id", user_id).eq("bind_type", bind_type)
|
||||||
.eq("bind_active", CommonConstant.Enable)
|
.eq("user_type", user_type)
|
||||||
.eq("bind_type", bind_type);
|
.eq("bind_active", CommonConstant.Enable);
|
||||||
|
|
||||||
return findOne(queryWrapper);
|
return findOne(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,45 +72,51 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map getBind(Integer user_id, int bind_type) {
|
public Map getBind(Integer user_id, Integer bind_type, Integer user_type) {
|
||||||
return Convert.toMap(String.class, Object.class, getBindByUserId(user_id, bind_type));
|
return Convert.toMap(String.class, Object.class, getBindByUserId(user_id, bind_type, user_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AccountUserBindConnect getBindByBindId(String bind_id, Integer bind_type) {
|
public AccountUserBindConnect getBindByBindId(String bind_id, Integer bind_type, Integer user_type) {
|
||||||
|
user_type = ObjectUtil.isNotEmpty(user_type) ? user_type : CommonConstant.USER_TYPE_NORMAL;
|
||||||
QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("bind_id", bind_id)
|
queryWrapper.eq("bind_id", bind_id)
|
||||||
.eq("bind_active", CommonConstant.Enable)
|
.eq("bind_type", bind_type)
|
||||||
.eq("bind_type", bind_type);
|
.eq("user_type", user_type)
|
||||||
|
.eq("bind_active", CommonConstant.Enable);
|
||||||
return findOne(queryWrapper);
|
return findOne(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkBind(String bind_id, int bind_type, Integer user_id, AccountUserBindConnect user_info_row) {
|
public boolean checkBind(String bind_id, int bind_type, Integer user_id, Integer user_type, AccountUserBindConnect user_info_row) {
|
||||||
|
|
||||||
AccountUserBindConnect bind_row = get(bind_id);
|
AccountUserBindConnect currAccountUserBindConnect = get(bind_id);
|
||||||
if (bind_row != null && CheckUtil.isNotEmpty(bind_row.getUser_id())) {
|
if (currAccountUserBindConnect != null && CheckUtil.isNotEmpty(currAccountUserBindConnect.getUser_id())) {
|
||||||
// 验证通过, 登录成功.
|
// 验证通过, 登录成功.
|
||||||
Integer bind_user_id = bind_row.getUser_id();
|
Integer bind_user_id = currAccountUserBindConnect.getUser_id();
|
||||||
if (CheckUtil.isNotEmpty(user_id) && ObjectUtil.equal(user_id, bind_user_id)) {
|
if (CheckUtil.isNotEmpty(user_id) && ObjectUtil.equal(user_id, bind_user_id)) {
|
||||||
throw new ApiException(I18nUtil._("非法请求,已经登录用户不应该访问到此页面-重复绑定"));
|
throw new ApiException(I18nUtil._("非法请求,已经登录用户不应该访问到此页面-重复绑定"));
|
||||||
} else if (CheckUtil.isEmpty(user_id) && ObjectUtil.equal(user_id, bind_user_id)) {
|
} else if (CheckUtil.isEmpty(user_id) && ObjectUtil.equal(user_id, bind_user_id)) {
|
||||||
throw new ApiException(I18nUtil._("非法请求,错误绑定数据"));
|
throw new ApiException(I18nUtil._("非法请求,错误绑定数据"));
|
||||||
}
|
}
|
||||||
} else if (bind_row != null && CheckUtil.isEmpty(bind_row.getUser_id())) {
|
} else if (currAccountUserBindConnect != null && CheckUtil.isEmpty(currAccountUserBindConnect.getUser_id())) {
|
||||||
|
|
||||||
user_info_row.setUser_id(user_id);
|
user_info_row.setUser_id(user_id);
|
||||||
user_info_row.setBind_id(bind_id);
|
user_info_row.setBind_id(bind_id);
|
||||||
|
user_info_row.setUser_type(user_type);
|
||||||
|
|
||||||
|
// (重要)新增或更新用户绑定关系
|
||||||
if (!saveOrUpdate(user_info_row)) {
|
if (!saveOrUpdate(user_info_row)) {
|
||||||
throw new ApiException(ResultCode.FAILED);
|
throw new ApiException(ResultCode.FAILED);
|
||||||
}
|
}
|
||||||
} else if (bind_row == null) {
|
} else if (currAccountUserBindConnect == null) {
|
||||||
// todo 头像会变动, 需要本地缓存, 生成新网址.
|
// todo 头像会变动, 需要本地缓存, 生成新网址.
|
||||||
user_info_row.setBind_id(bind_id);
|
user_info_row.setBind_id(bind_id);
|
||||||
user_info_row.setBind_type(bind_type);
|
user_info_row.setBind_type(bind_type);
|
||||||
user_info_row.setUser_id(user_id);
|
user_info_row.setUser_id(user_id);
|
||||||
|
user_info_row.setUser_type(user_type);
|
||||||
|
|
||||||
|
// (重要)新增或更新用户绑定关系
|
||||||
if (!saveOrUpdate(user_info_row)) {
|
if (!saveOrUpdate(user_info_row)) {
|
||||||
throw new ApiException(ResultCode.FAILED);
|
throw new ApiException(ResultCode.FAILED);
|
||||||
}
|
}
|
||||||
@ -183,92 +194,110 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer doUserBind(AccountUserBindConnect user_info_row, String activity_id, boolean reg_flag) {
|
public Integer doUserBind(AccountUserBindConnect accountUserBindConnect, String activity_id, boolean needRegNow) {
|
||||||
|
|
||||||
Integer user_id = null;
|
Integer user_id = null;
|
||||||
|
|
||||||
String bind_id = user_info_row.getBind_id();
|
String bind_id = accountUserBindConnect.getBind_id();
|
||||||
AccountUserBase user_base_row = accountUserBaseService.getByAccount(bind_id);
|
AccountUserBase accountUserBase = accountUserBaseService.getByAccount(bind_id);
|
||||||
|
|
||||||
//unionId 获取,如果存在
|
//unionId 获取,如果存在
|
||||||
if (user_info_row.getBind_unionid() != null) {
|
if (StrUtil.isNotBlank(accountUserBindConnect.getBind_unionid()) && ObjectUtil.isNull(accountUserBase)) {
|
||||||
//检测unionId, 判断用户
|
//检测unionId, 判断用户
|
||||||
if (user_base_row == null) {
|
//根据unionId,判断已经绑定的用户
|
||||||
//根据unionId,判断已经绑定的用户
|
QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>();
|
||||||
QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>();
|
queryWrapper.eq("bind_unionid", accountUserBindConnect.getBind_unionid());
|
||||||
queryWrapper.eq("bind_unionid", user_info_row.getBind_unionid());
|
AccountUserBindConnect find_bind_row = findOne(queryWrapper);
|
||||||
AccountUserBindConnect find_bind_row = findOne(queryWrapper);
|
if (find_bind_row != null) {
|
||||||
if (find_bind_row != null) {
|
accountUserBase = accountUserBaseService.get(find_bind_row.getUser_id());
|
||||||
user_base_row = accountUserBaseService.get(find_bind_row.getUser_id());
|
|
||||||
|
|
||||||
//运行到此处
|
//运行到此处
|
||||||
//判断bind openid是否存在,不存在则需要添加
|
//判断bind openid是否存在,不存在则需要添加
|
||||||
//支付地方需要调用到openid, 此处必须冗余存放openid
|
//支付地方需要调用到openid, 此处必须冗余存放openid
|
||||||
AccountUserBindConnect open_bind_row = get(bind_id);
|
AccountUserBindConnect open_bind_row = get(bind_id);
|
||||||
|
if (null == open_bind_row) {
|
||||||
|
accountUserBindConnect.setBind_active(CommonConstant.Enable);
|
||||||
|
accountUserBindConnect.setBind_type(accountUserBindConnect.getBind_type());
|
||||||
|
save(accountUserBindConnect);
|
||||||
|
}
|
||||||
|
|
||||||
if (null == open_bind_row) {
|
AccountUserBase updAccountUserBase = accountUserBaseService.get(find_bind_row.getUser_id());
|
||||||
user_info_row.setBind_active(1);
|
if (updAccountUserBase != null) {
|
||||||
user_info_row.setBind_type(user_info_row.getBind_type());
|
user_id = updAccountUserBase.getUser_id();
|
||||||
save(user_info_row);
|
AccountUserBindConnect userBindConnect = new AccountUserBindConnect();
|
||||||
}
|
userBindConnect.setBind_id(bind_id);
|
||||||
AccountUserBase accountUserBase = accountUserBaseService.get(find_bind_row.getUser_id());
|
userBindConnect.setUser_id(user_id);
|
||||||
if (accountUserBase != null) {
|
edit(userBindConnect);
|
||||||
user_id = accountUserBase.getUser_id();
|
return user_id;
|
||||||
AccountUserBindConnect userBindConnect = new AccountUserBindConnect();
|
|
||||||
userBindConnect.setBind_id(bind_id);
|
|
||||||
userBindConnect.setUser_id(user_id);
|
|
||||||
edit(userBindConnect);
|
|
||||||
return user_id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
//throw new Exception(__('unionId 不存在'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//自动注册用户
|
//自动注册用户
|
||||||
if (user_base_row != null) {
|
if (accountUserBase != null) {
|
||||||
user_id = user_base_row.getUser_id();
|
user_id = accountUserBase.getUser_id();
|
||||||
} else {
|
} else {
|
||||||
boolean flag = false;
|
|
||||||
//需要注册用户
|
//需要注册用户
|
||||||
if (reg_flag) {
|
if (needRegNow) {
|
||||||
Map reg_info = new HashMap();
|
Map reg_info = new HashMap();
|
||||||
reg_info.put("user_account", bind_id);
|
reg_info.put("user_account", bind_id);
|
||||||
reg_info.put("user_password", "Ss@123" + UUID.randomUUID());
|
reg_info.put("user_password", "Ss@123" + UUID.randomUUID());
|
||||||
reg_info.put("user_nickname", user_info_row.getBind_nickname());
|
reg_info.put("user_nickname", accountUserBindConnect.getBind_nickname());
|
||||||
reg_info.put("activity_id", activity_id);
|
reg_info.put("activity_id", activity_id);
|
||||||
|
|
||||||
user_base_row = accountUserBaseService.register(reg_info);
|
accountUserBase = accountUserBaseService.register(reg_info);
|
||||||
|
|
||||||
if (user_base_row != null) {
|
if (accountUserBase != null) {
|
||||||
user_id = user_base_row.getUser_id();
|
user_id = accountUserBase.getUser_id();
|
||||||
|
|
||||||
//添加user info
|
//添加user info
|
||||||
Map info = new HashMap();
|
Map info = new HashMap();
|
||||||
info.put("user_nickname", user_info_row.getBind_nickname());// 名称
|
info.put("user_nickname", accountUserBindConnect.getBind_nickname());// 名称
|
||||||
info.put("user_avatar", user_info_row.getBind_icon());
|
info.put("user_avatar", accountUserBindConnect.getBind_icon());
|
||||||
info.put("user_gender", user_info_row.getBind_gender()); // 性别 1:男 2:女
|
info.put("user_gender", accountUserBindConnect.getBind_gender()); // 性别 1:男 2:女
|
||||||
|
|
||||||
/*
|
accountUserInfoService.editAccount(user_id, info);
|
||||||
if ($qy_userid)
|
checkBind(bind_id, accountUserBindConnect.getBind_type(), user_id, accountUserBindConnect.getUser_type(), accountUserBindConnect);
|
||||||
{
|
|
||||||
$info['user_level_id'] = 1006 ; // 性别 1:男 2:女
|
|
||||||
$info['user_notename'] = $qy_userid ; //
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
flag = accountUserInfoService.editAccount(user_id, info);
|
|
||||||
flag = checkBind(bind_id, user_info_row.getBind_type(), user_id, user_info_row);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//读取用户信息
|
//读取用户信息
|
||||||
user_id = user_info_row.getUser_id();
|
user_id = accountUserBindConnect.getUser_id();
|
||||||
flag = checkBind(bind_id, user_info_row.getBind_type(), user_id, user_info_row);
|
checkBind(bind_id, accountUserBindConnect.getBind_type(), user_id, accountUserBindConnect.getUser_type(), accountUserBindConnect);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return user_id;
|
return user_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 bind_id 和 bind_type user_type 获取绑定关系的 user_id
|
||||||
|
*
|
||||||
|
* @param bindId 必填
|
||||||
|
* @param bindType
|
||||||
|
* @param userType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Integer getUserBindConnectUserIdByCondition(String bindId, Integer bindType, Integer userType) {
|
||||||
|
if (bindId == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (BindCode.MOBILE == bindType) {
|
||||||
|
// 加上 +86 中国区域号
|
||||||
|
bindId = PhoneNumberUtils.convZhPhoneNumber(bindId);
|
||||||
|
}
|
||||||
|
QueryWrapper<AccountUserBindConnect> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("bind_id", bindId).eq("bind_type", bindType);
|
||||||
|
if (userType != null) {
|
||||||
|
queryWrapper.eq("user_type", userType);
|
||||||
|
}
|
||||||
|
|
||||||
|
queryWrapper.select("user_id").orderByAsc("user_id");
|
||||||
|
|
||||||
|
AccountUserBindConnect accountUserBindConnect = findOne(queryWrapper);
|
||||||
|
return accountUserBindConnect != null ? accountUserBindConnect.getUser_id() : null;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -340,7 +340,7 @@ public class WeiXinServiceImpl implements WeiXinService {
|
|||||||
UserDto userDto = JSONUtil.toBean(jwsObject.getPayload().toString(), UserDto.class);
|
UserDto userDto = JSONUtil.toBean(jwsObject.getPayload().toString(), UserDto.class);
|
||||||
Integer rid = userDto.getRole_id();
|
Integer rid = userDto.getRole_id();
|
||||||
Map<String, Object> userInfo = accountUserBaseService.getUserInfo(userDto.getId());
|
Map<String, Object> userInfo = accountUserBaseService.getUserInfo(userDto.getId());
|
||||||
Map bind = accountUserBindConnectService.getBind(user_id, BindCode.MOBILE);
|
Map bind = accountUserBindConnectService.getBind(user_id, BindCode.MOBILE, userDto.getUserType());
|
||||||
userInfo.put("id", user_id);
|
userInfo.put("id", user_id);
|
||||||
userInfo.put("k", wxUserToken);
|
userInfo.put("k", wxUserToken);
|
||||||
userInfo.put("key", wxUserToken);
|
userInfo.put("key", wxUserToken);
|
||||||
@ -481,7 +481,7 @@ public class WeiXinServiceImpl implements WeiXinService {
|
|||||||
public Map getOpenIdByCode(String code, UserDto user) {
|
public Map getOpenIdByCode(String code, UserDto user) {
|
||||||
Map data = new HashMap();
|
Map data = new HashMap();
|
||||||
if (user != null && CheckUtil.isNotEmpty(user.getId())) {
|
if (user != null && CheckUtil.isNotEmpty(user.getId())) {
|
||||||
Map bind_row = accountUserBindConnectService.getBind(user.getId(), BindCode.WEIXIN_XCX);
|
Map bind_row = accountUserBindConnectService.getBind(user.getId(), BindCode.WEIXIN_XCX, user.getUserType());
|
||||||
if (CollUtil.isNotEmpty(bind_row) && StrUtil.isNotBlank(Convert.toStr(bind_row.get("bind_openid")))) {
|
if (CollUtil.isNotEmpty(bind_row) && StrUtil.isNotBlank(Convert.toStr(bind_row.get("bind_openid")))) {
|
||||||
data.put("openid", bind_row.get("bind_openid"));
|
data.put("openid", bind_row.get("bind_openid"));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@ public class CommonConstant {
|
|||||||
public static final Integer Delivery_Amount_Comput_Type_Payment = 3;
|
public static final Integer Delivery_Amount_Comput_Type_Payment = 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户类型:0-普通用户;1-管理员;2-商户
|
* 用户类型:0-普通用户;1-管理员;2-入驻商户
|
||||||
*/
|
*/
|
||||||
public static final Integer USER_TYPE_NORMAL = 0;
|
public static final Integer USER_TYPE_NORMAL = 0;
|
||||||
public static final Integer USER_TYPE_ADMIN = 1;
|
public static final Integer USER_TYPE_ADMIN = 1;
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.suisung.mall.common.domain;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.suisung.mall.common.constant.AuthConstant;
|
import com.suisung.mall.common.constant.AuthConstant;
|
||||||
|
import com.suisung.mall.common.constant.CommonConstant;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@ -87,4 +88,20 @@ public class UserDto {
|
|||||||
public boolean isMerchant() {
|
public boolean isMerchant() {
|
||||||
return ObjectUtil.equal(client_id, AuthConstant.MCH_CLIENT_ID);
|
return ObjectUtil.equal(client_id, AuthConstant.MCH_CLIENT_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户类型:对应user_base 的 is_admin:0-普通用户;1-管理员;2-入驻商家;
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Integer getUserType() {
|
||||||
|
Integer user_type = CommonConstant.USER_TYPE_NORMAL; // 用户类型,对应user_base 的 is_admin:0-普通用户;1-管理员;2-入驻商家;
|
||||||
|
if (isAdmin()) {
|
||||||
|
user_type = CommonConstant.USER_TYPE_ADMIN;
|
||||||
|
} else if (isMerchant()) {
|
||||||
|
user_type = CommonConstant.USER_TYPE_MCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
return user_type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.suisung.mall.common.feignService;
|
|||||||
import com.suisung.mall.common.api.CommonResult;
|
import com.suisung.mall.common.api.CommonResult;
|
||||||
import com.suisung.mall.common.modules.account.*;
|
import com.suisung.mall.common.modules.account.*;
|
||||||
import com.suisung.mall.common.pojo.output.TimelineOutput;
|
import com.suisung.mall.common.pojo.output.TimelineOutput;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -136,6 +137,7 @@ public interface AccountService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断一个店铺是否存在某个昵称的会员
|
* 判断一个店铺是否存在某个昵称的会员
|
||||||
|
*
|
||||||
* @param nickname
|
* @param nickname
|
||||||
* @param storeId
|
* @param storeId
|
||||||
* @return
|
* @return
|
||||||
@ -207,4 +209,10 @@ public interface AccountService {
|
|||||||
|
|
||||||
@GetMapping("/admin/account/analytics/user/getUserTimeLineInfo")
|
@GetMapping("/admin/account/analytics/user/getUserTimeLineInfo")
|
||||||
List<TimelineOutput> getUserTimeLine(@RequestParam("startTime") Long startTime, @RequestParam("endTime") Long endTime);
|
List<TimelineOutput> getUserTimeLine(@RequestParam("startTime") Long startTime, @RequestParam("endTime") Long endTime);
|
||||||
|
|
||||||
|
@ApiOperation(value = "获取绑定关系的用户Id", notes = "根据 bind_id 和 bind_type user_type 获取绑定关系的用户Id(仅供内部调用)")
|
||||||
|
@PostMapping(value = "/admin/account/account-user-bind-connect/get-userid-by-condition")
|
||||||
|
Integer getUserBindConnectUserIdByCondition(@RequestParam(name = "bind_id") String bind_id,
|
||||||
|
@RequestParam(name = "bind_type") Integer bind_type,
|
||||||
|
@RequestParam(name = "user_type", required = false) Integer user_type);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,12 +33,15 @@ public class AccountUserBindConnect implements Serializable {
|
|||||||
@TableId(value = "bind_id", type = IdType.INPUT)
|
@TableId(value = "bind_id", type = IdType.INPUT)
|
||||||
private String bind_id;
|
private String bind_id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "绑定类型(EMUN):1-mobile; 2-email; 11-sinaweibo; 12-qq; 13-weixin")
|
@ApiModelProperty(value = "绑定类型(EMUN):1-手机号; 2-邮箱; 11-新浪微博; 12-QQ; 13-微信;14-微信公众号;15-微信小程序;16-企业微信;17-苹果;18-支付宝;19-facebook;20-谷歌;21-建行用户;")
|
||||||
private Integer bind_type;
|
private Integer bind_type;
|
||||||
|
|
||||||
@ApiModelProperty(value = "用户编号")
|
@ApiModelProperty(value = "用户编号")
|
||||||
private Integer user_id;
|
private Integer user_id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户类型,对应user_base 的 is_admin:0-普通用户;1-管理员;2-入驻商家;")
|
||||||
|
private Integer user_type;
|
||||||
|
|
||||||
@ApiModelProperty(value = "绑定时间")
|
@ApiModelProperty(value = "绑定时间")
|
||||||
private Date bind_time;
|
private Date bind_time;
|
||||||
|
|
||||||
|
|||||||
@ -35,4 +35,25 @@ public interface ShopBaseDistrictService extends IBaseService<ShopBaseDistrict>
|
|||||||
|
|
||||||
List<Map> getDistrictByParentId(Integer district_parent_id, boolean recursive, Integer district_level);
|
List<Map> getDistrictByParentId(Integer district_parent_id, boolean recursive, Integer district_level);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据省或市或区编号获取完整关联省市区列表
|
||||||
|
*
|
||||||
|
* @param districtCode
|
||||||
|
* @return 关联省市区列表
|
||||||
|
*/
|
||||||
|
List<ShopBaseDistrict> getFullDistrictByDistrictCode(String districtCode);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 把一个三个有序的关联省市区列表,拼接名字或者拼接id,输出字符串
|
||||||
|
* 如:广东省/深圳市/南山区 440000/440300/440306
|
||||||
|
*
|
||||||
|
* @param list
|
||||||
|
* @param joinKey
|
||||||
|
* @param hasSeparator
|
||||||
|
* @param separator
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String joinDistrict(List<ShopBaseDistrict> list, Integer joinKey, Boolean hasSeparator, String separator);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,9 +20,7 @@ import org.springframework.util.FileCopyUtils;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -35,14 +33,12 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
public class ShopBaseDistrictServiceImpl extends BaseServiceImpl<ShopBaseDistrictMapper, ShopBaseDistrict> implements ShopBaseDistrictService {
|
public class ShopBaseDistrictServiceImpl extends BaseServiceImpl<ShopBaseDistrictMapper, ShopBaseDistrict> implements ShopBaseDistrictService {
|
||||||
|
|
||||||
|
private static JSON districtData;
|
||||||
@Autowired
|
@Autowired
|
||||||
private AccountBaseConfigService accountBaseConfigService;
|
private AccountBaseConfigService accountBaseConfigService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ShopBaseDistrictMapper shopBaseDistrictMapper;
|
private ShopBaseDistrictMapper shopBaseDistrictMapper;
|
||||||
|
|
||||||
private static JSON districtData;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getDefaultDistrictId() {
|
public Integer getDefaultDistrictId() {
|
||||||
Integer district_id = null;
|
Integer district_id = null;
|
||||||
@ -169,6 +165,147 @@ public class ShopBaseDistrictServiceImpl extends BaseServiceImpl<ShopBaseDistric
|
|||||||
return district_rows;
|
return district_rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据省或市或区编号获取完整关联省市区列表
|
||||||
|
*
|
||||||
|
* @param districtCode
|
||||||
|
* @return 关联省市区列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ShopBaseDistrict> getFullDistrictByDistrictCode(String districtCode) {
|
||||||
|
if (StrUtil.isBlank(districtCode)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ShopBaseDistrict> districtList = new LinkedList<>();
|
||||||
|
|
||||||
|
QueryWrapper<ShopBaseDistrict> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("district_id", districtCode);
|
||||||
|
ShopBaseDistrict district = findOne(queryWrapper);
|
||||||
|
if (ObjectUtil.isEmpty(district)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ObjectUtil.equals(district.getDistrict_level(), 3)) {
|
||||||
|
// 如果是第三级
|
||||||
|
queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("district_id", district.getDistrict_parent_id());
|
||||||
|
ShopBaseDistrict districtSecond = findOne(queryWrapper);
|
||||||
|
if (ObjectUtil.isNotEmpty(districtSecond)) {
|
||||||
|
queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("district_id", districtSecond.getDistrict_parent_id());
|
||||||
|
ShopBaseDistrict districtFirst = findOne(queryWrapper);
|
||||||
|
if (ObjectUtil.isNotEmpty(districtFirst)) {
|
||||||
|
// 1st
|
||||||
|
districtList.add(districtFirst);
|
||||||
|
}
|
||||||
|
//2nd
|
||||||
|
districtList.add(districtSecond);
|
||||||
|
}
|
||||||
|
|
||||||
|
//3rd
|
||||||
|
districtList.add(district);
|
||||||
|
} else if (ObjectUtil.equals(district.getDistrict_level(), 2)) {
|
||||||
|
// 如果是第二级
|
||||||
|
queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("district_id", district.getDistrict_parent_id());
|
||||||
|
ShopBaseDistrict districtFirst = findOne(queryWrapper);
|
||||||
|
if (ObjectUtil.isNotEmpty(districtFirst)) {
|
||||||
|
// 1st
|
||||||
|
districtList.add(districtFirst);
|
||||||
|
}
|
||||||
|
|
||||||
|
//2nd
|
||||||
|
districtList.add(district);
|
||||||
|
|
||||||
|
queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("district_parent_id", district.getDistrict_id());
|
||||||
|
ShopBaseDistrict districtThird = findOne(queryWrapper);
|
||||||
|
if (ObjectUtil.isNotEmpty(districtThird)) {
|
||||||
|
// 3rd
|
||||||
|
districtList.add(districtThird);
|
||||||
|
}
|
||||||
|
} else if (ObjectUtil.equals(district.getDistrict_level(), 1)) {
|
||||||
|
districtList.add(district);
|
||||||
|
|
||||||
|
queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("district_parent_id", district.getDistrict_id());
|
||||||
|
ShopBaseDistrict districtSecond = findOne(queryWrapper);
|
||||||
|
if (ObjectUtil.isNotEmpty(districtSecond)) {
|
||||||
|
districtList.add(districtSecond);
|
||||||
|
|
||||||
|
queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("district_parent_id", districtSecond.getDistrict_id());
|
||||||
|
ShopBaseDistrict districtThird = findOne(queryWrapper);
|
||||||
|
if (ObjectUtil.isNotEmpty(districtThird)) {
|
||||||
|
districtList.add(districtThird);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return districtList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 把一个三个有序的关联省市区列表,拼接名字或者拼接id,输出字符串
|
||||||
|
* 如:广东省/深圳市/南山区 440000/440300/440306
|
||||||
|
*
|
||||||
|
* @param list 有序列表
|
||||||
|
* @param joinKey 1-id 2-name
|
||||||
|
* @param needSeparator 需要分割字符?
|
||||||
|
* @param separator 分割字符串
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String joinDistrict(List<ShopBaseDistrict> list, Integer joinKey, Boolean needSeparator, String separator) {
|
||||||
|
// 参数校验
|
||||||
|
if (CollUtil.isEmpty(list)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (separator == null) {
|
||||||
|
separator = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (needSeparator == null) {
|
||||||
|
needSeparator = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (joinKey == null || (joinKey != 1 && joinKey != 2)) {
|
||||||
|
joinKey = 1; // 默认使用 id
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder result = new StringBuilder();
|
||||||
|
boolean first = true;
|
||||||
|
|
||||||
|
for (ShopBaseDistrict district : list) {
|
||||||
|
if (district == null) {
|
||||||
|
continue; // 跳过空元素
|
||||||
|
}
|
||||||
|
|
||||||
|
String valueToJoin;
|
||||||
|
if (joinKey == 1) {
|
||||||
|
valueToJoin = district.getDistrict_id().toString(); // 使用 id
|
||||||
|
} else {
|
||||||
|
valueToJoin = district.getDistrict_name(); // 使用 name
|
||||||
|
}
|
||||||
|
|
||||||
|
if (valueToJoin == null) {
|
||||||
|
valueToJoin = ""; // 处理空值
|
||||||
|
}
|
||||||
|
|
||||||
|
if (needSeparator && !first) {
|
||||||
|
result.append(separator);
|
||||||
|
}
|
||||||
|
|
||||||
|
result.append(valueToJoin);
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 读取子类id
|
* 读取子类id
|
||||||
*
|
*
|
||||||
|
|||||||
@ -53,4 +53,6 @@ public class ShopMerchEntryAdminController extends BaseControllerImpl {
|
|||||||
// approvalStatus 入驻商家的审批状态:1-已通过;2-未通过;3-待审核;
|
// approvalStatus 入驻商家的审批状态:1-已通过;2-未通过;3-待审核;
|
||||||
return shopMerchEntryService.shopMerchEntryApproval(jsonParam.getLong("id"), jsonParam.getInt("approvalStatus"), jsonParam.getStr("approvalRemark"), jsonParam.getStr("approvalInvalidCol"));
|
return shopMerchEntryService.shopMerchEntryApproval(jsonParam.getLong("id"), jsonParam.getInt("approvalStatus"), jsonParam.getStr("approvalRemark"), jsonParam.getStr("approvalInvalidCol"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.suisung.mall.shop.store.controller.admin;
|
|||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.suisung.mall.common.api.CommonResult;
|
import com.suisung.mall.common.api.CommonResult;
|
||||||
import com.suisung.mall.common.domain.UserDto;
|
import com.suisung.mall.common.domain.UserDto;
|
||||||
@ -17,6 +18,7 @@ import com.suisung.mall.shop.store.service.ShopStoreSameCityTransportBaseService
|
|||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.util.Pair;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@ -248,5 +250,15 @@ public class ShopStoreBaseController extends BaseControllerImpl {
|
|||||||
public ShopStoreBase getLklMerchantNoAndTermNo(@RequestParam(name = "store_id") Integer store_id) {
|
public ShopStoreBase getLklMerchantNoAndTermNo(@RequestParam(name = "store_id") Integer store_id) {
|
||||||
return shopStoreBaseService.getLklMerchantNoAndTermNo(store_id);
|
return shopStoreBaseService.getLklMerchantNoAndTermNo(store_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "商家入驻资料转成店铺", notes = "商家入驻资料转成店铺")
|
||||||
|
@RequestMapping(value = "/mchinfo/to/storeinfo", method = RequestMethod.POST)
|
||||||
|
public CommonResult merchEntryInfo2StoreInfo(@RequestBody JSONObject jsonParam) {
|
||||||
|
Pair<Integer, String> result = shopStoreBaseService.merchEntryInfo2StoreInfo(jsonParam.getStr("mchMobile"));
|
||||||
|
if (result.getFirst().equals(0)) {
|
||||||
|
return CommonResult.failed(result.getSecond());
|
||||||
|
}
|
||||||
|
return CommonResult.success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -142,5 +142,13 @@ public interface ShopStoreBaseService extends IBaseService<ShopStoreBase> {
|
|||||||
* @param mchMobile
|
* @param mchMobile
|
||||||
* @return 店铺Id
|
* @return 店铺Id
|
||||||
*/
|
*/
|
||||||
Integer merchEntryInfo2StoreInfo(String mchMobile);
|
Pair<Integer, String> merchEntryInfo2StoreInfo(String mchMobile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据店铺名称判断店铺是否存在
|
||||||
|
*
|
||||||
|
* @param storeName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean isExistsByStoreName(String storeName);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,7 @@ import com.suisung.mall.shop.esign.service.EsignPlatformInfoService;
|
|||||||
import com.suisung.mall.shop.message.service.ShopMessageTemplateService;
|
import com.suisung.mall.shop.message.service.ShopMessageTemplateService;
|
||||||
import com.suisung.mall.shop.store.mapper.ShopMerchEntryMapper;
|
import com.suisung.mall.shop.store.mapper.ShopMerchEntryMapper;
|
||||||
import com.suisung.mall.shop.store.service.ShopMerchEntryService;
|
import com.suisung.mall.shop.store.service.ShopMerchEntryService;
|
||||||
|
import com.suisung.mall.shop.store.service.ShopStoreBaseService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
@ -66,6 +67,10 @@ public class ShopMerchEntryServiceImpl extends BaseServiceImpl<ShopMerchEntryMap
|
|||||||
@Resource
|
@Resource
|
||||||
private EsignContractService esignContractService;
|
private EsignContractService esignContractService;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Resource
|
||||||
|
private ShopStoreBaseService shopStoreBaseService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TaskService taskService;
|
private TaskService taskService;
|
||||||
|
|
||||||
@ -181,6 +186,10 @@ public class ShopMerchEntryServiceImpl extends BaseServiceImpl<ShopMerchEntryMap
|
|||||||
return CommonResult.failed("缺少银行账号信息!");
|
return CommonResult.failed("缺少银行账号信息!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (shopStoreBaseService.isExistsByStoreName(record.getStore_name())) {
|
||||||
|
return CommonResult.failed("店铺名已被使用!");
|
||||||
|
}
|
||||||
|
|
||||||
// 检查店铺是否已经申请过入驻
|
// 检查店铺是否已经申请过入驻
|
||||||
Pair<Boolean, String> isApplied = isApplied(record.getLogin_mobile(), record.getBiz_license_number());
|
Pair<Boolean, String> isApplied = isApplied(record.getLogin_mobile(), record.getBiz_license_number());
|
||||||
if (isApplied.getFirst()) {
|
if (isApplied.getFirst()) {
|
||||||
@ -270,6 +279,10 @@ public class ShopMerchEntryServiceImpl extends BaseServiceImpl<ShopMerchEntryMap
|
|||||||
return CommonResult.failed("法人手机号码有误!");
|
return CommonResult.failed("法人手机号码有误!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (shopStoreBaseService.isExistsByStoreName(record.getStore_name())) {
|
||||||
|
return CommonResult.failed("店铺名已被使用!");
|
||||||
|
}
|
||||||
|
|
||||||
record.setLogin_mobile(null);// 手机号不能更改
|
record.setLogin_mobile(null);// 手机号不能更改
|
||||||
record.setCreated_by(userId);
|
record.setCreated_by(userId);
|
||||||
record.setApproval_status(CommonConstant.MCH_APPR_STA_PADDING);
|
record.setApproval_status(CommonConstant.MCH_APPR_STA_PADDING);
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import cn.hutool.json.JSONUtil;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.suisung.mall.common.api.BindCode;
|
||||||
import com.suisung.mall.common.api.CommonResult;
|
import com.suisung.mall.common.api.CommonResult;
|
||||||
import com.suisung.mall.common.api.ResultCode;
|
import com.suisung.mall.common.api.ResultCode;
|
||||||
import com.suisung.mall.common.api.StateCode;
|
import com.suisung.mall.common.api.StateCode;
|
||||||
@ -29,10 +30,7 @@ import com.suisung.mall.common.feignService.PayService;
|
|||||||
import com.suisung.mall.common.modules.account.AccountUserBase;
|
import com.suisung.mall.common.modules.account.AccountUserBase;
|
||||||
import com.suisung.mall.common.modules.account.AccountUserInfo;
|
import com.suisung.mall.common.modules.account.AccountUserInfo;
|
||||||
import com.suisung.mall.common.modules.account.AccountUserSns;
|
import com.suisung.mall.common.modules.account.AccountUserSns;
|
||||||
import com.suisung.mall.common.modules.base.ShopBaseProductTag;
|
import com.suisung.mall.common.modules.base.*;
|
||||||
import com.suisung.mall.common.modules.base.ShopBaseStoreCategory;
|
|
||||||
import com.suisung.mall.common.modules.base.ShopBaseStoreGrade;
|
|
||||||
import com.suisung.mall.common.modules.base.ShopPageModule;
|
|
||||||
import com.suisung.mall.common.modules.distribution.ShopDistributionPlantformUser;
|
import com.suisung.mall.common.modules.distribution.ShopDistributionPlantformUser;
|
||||||
import com.suisung.mall.common.modules.invoicing.InvoicingCustomerLevel;
|
import com.suisung.mall.common.modules.invoicing.InvoicingCustomerLevel;
|
||||||
import com.suisung.mall.common.modules.invoicing.InvoicingWarehouseBase;
|
import com.suisung.mall.common.modules.invoicing.InvoicingWarehouseBase;
|
||||||
@ -49,10 +47,7 @@ import com.suisung.mall.common.pojo.dto.StandardAddressDTO;
|
|||||||
import com.suisung.mall.common.service.impl.BaiduMapServiceImpl;
|
import com.suisung.mall.common.service.impl.BaiduMapServiceImpl;
|
||||||
import com.suisung.mall.common.utils.*;
|
import com.suisung.mall.common.utils.*;
|
||||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||||
import com.suisung.mall.shop.base.service.AccountBaseConfigService;
|
import com.suisung.mall.shop.base.service.*;
|
||||||
import com.suisung.mall.shop.base.service.ShopBaseProductTagService;
|
|
||||||
import com.suisung.mall.shop.base.service.ShopBaseStoreCategoryService;
|
|
||||||
import com.suisung.mall.shop.base.service.ShopBaseStoreGradeService;
|
|
||||||
import com.suisung.mall.shop.config.BaiduUtil;
|
import com.suisung.mall.shop.config.BaiduUtil;
|
||||||
import com.suisung.mall.shop.distribution.service.ShopDistributionPlantformUserService;
|
import com.suisung.mall.shop.distribution.service.ShopDistributionPlantformUserService;
|
||||||
import com.suisung.mall.shop.entity.LocationBean;
|
import com.suisung.mall.shop.entity.LocationBean;
|
||||||
@ -171,6 +166,9 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
|||||||
private ShopPageModuleService shopPageModuleService;
|
private ShopPageModuleService shopPageModuleService;
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private ShopBaseDistrictService shopBaseDistrictService;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
private ShopMerchEntryService shopMerchEntryService;
|
private ShopMerchEntryService shopMerchEntryService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ThreadPoolExecutor executor;
|
private ThreadPoolExecutor executor;
|
||||||
@ -2959,69 +2957,186 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
|||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public Integer merchEntryInfo2StoreInfo(String mchMobile) {
|
public Pair<Integer, String> merchEntryInfo2StoreInfo(String mchMobile) {
|
||||||
Integer storeId = 0;
|
Integer storeId = 0;
|
||||||
if (StrUtil.isBlank(mchMobile)) {
|
if (StrUtil.isBlank(mchMobile)) {
|
||||||
logger.error("生成店铺:商家注册手机号为空");
|
logger.error("生成店铺:商家手机号不能为空");
|
||||||
return storeId;
|
return Pair.of(0, "商家手机号不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取商家注册账号信息
|
// 从绑定关系中,获取商家注册账号信息
|
||||||
Integer userId = 0;
|
Integer userId = accountService.getUserBindConnectUserIdByCondition(mchMobile, BindCode.MOBILE, CommonConstant.USER_TYPE_MCH);
|
||||||
|
if (userId == null) {
|
||||||
|
logger.error("生成店铺:绑定关系中获取不到该手机{}商家的账号", mchMobile);
|
||||||
|
return Pair.of(0, "商家账号异常!");
|
||||||
|
}
|
||||||
|
|
||||||
ShopMerchEntry shopMerchEntry = shopMerchEntryService.getShopMerchEntryByCondition(mchMobile, "", CommonConstant.MCH_APPR_STA_PASS);
|
ShopMerchEntry shopMerchEntry = shopMerchEntryService.getShopMerchEntryByCondition(mchMobile, "", CommonConstant.MCH_APPR_STA_PASS);
|
||||||
if (ObjectUtil.isEmpty(shopMerchEntry)) {
|
if (ObjectUtil.isEmpty(shopMerchEntry)) {
|
||||||
logger.error("生成店铺:商家入驻信息为空");
|
logger.error("生成店铺:入驻信息不能为空");
|
||||||
return storeId;
|
return Pair.of(0, "入驻信息不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isExistsByStoreName(shopMerchEntry.getStore_name())) {
|
||||||
|
logger.error("生成店铺:店铺名称已存在");
|
||||||
|
return Pair.of(0, "店铺名称已存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增 shop_store_base,shop_store_info,shop_store_company, shop_store_employee 待补充
|
// 新增 shop_store_base,shop_store_info,shop_store_company, shop_store_employee 待补充
|
||||||
|
|
||||||
|
String storeFacadeImage = shopMerchEntry.getFront_facade_image();
|
||||||
|
|
||||||
|
// shop_store_base
|
||||||
ShopStoreBase shopStoreBase = new ShopStoreBase();
|
ShopStoreBase shopStoreBase = new ShopStoreBase();
|
||||||
shopStoreBase.setUser_id(userId); // 店铺管理员用户Id
|
shopStoreBase.setUser_id(userId); // 店铺管理员用户Id
|
||||||
shopStoreBase.setStore_name(shopMerchEntry.getStore_name());
|
shopStoreBase.setStore_name(shopMerchEntry.getStore_name());
|
||||||
|
shopStoreBase.setStore_category_id(shopMerchEntry.getBiz_category());
|
||||||
|
shopStoreBase.setStore_logo(storeFacadeImage); // 临时使用门面照片做logo
|
||||||
|
|
||||||
|
// 省市区记录有序列表
|
||||||
|
List<ShopBaseDistrict> districtList = shopBaseDistrictService.getFullDistrictByDistrictCode(shopMerchEntry.getCounty_id());
|
||||||
|
shopStoreBase.setStore_district_id(shopBaseDistrictService.joinDistrict(districtList, 1, true, "/"));
|
||||||
|
shopStoreBase.setStore_area(shopBaseDistrictService.joinDistrict(districtList, 2, true, "/"));
|
||||||
shopStoreBase.setStore_address(shopMerchEntry.getStore_address());
|
shopStoreBase.setStore_address(shopMerchEntry.getStore_address());
|
||||||
shopStoreBase.setStore_longitude(shopMerchEntry.getStore_longitude());
|
shopStoreBase.setStore_longitude(shopMerchEntry.getStore_longitude());
|
||||||
shopStoreBase.setStore_latitude(shopMerchEntry.getStore_latitude());
|
shopStoreBase.setStore_latitude(shopMerchEntry.getStore_latitude());
|
||||||
shopStoreBase.setStore_grade_id(1001); // 店铺等级,默认为普通店铺
|
shopStoreBase.setStore_grade_id(1001); // 店铺等级,默认为普通店铺
|
||||||
shopStoreBase.setStore_category_id(shopMerchEntry.getBiz_category());
|
|
||||||
shopStoreBase.setStore_type(1);//店铺类型(ENUM): 1-卖家店铺; 2-供应商店铺
|
shopStoreBase.setStore_type(1);//店铺类型(ENUM): 1-卖家店铺; 2-供应商店铺
|
||||||
shopStoreBase.setStore_district_id("");
|
|
||||||
shopStoreBase.setStore_area("");
|
|
||||||
shopStoreBase.setStore_is_open(1);
|
shopStoreBase.setStore_is_open(1);
|
||||||
shopStoreBase.setStore_is_selfsupport(0);
|
shopStoreBase.setStore_is_selfsupport(0);
|
||||||
shopStoreBase.setStore_o2o_flag(0);
|
shopStoreBase.setStore_o2o_flag(0);
|
||||||
shopStoreBase.setSubsite_id(0);
|
shopStoreBase.setSubsite_id(0);
|
||||||
shopStoreBase.setStore_state_id(3240);//店铺资料信息状态(ENUM):3210-待完善资料; 3220-等待审核 ; 3230-资料审核没有通过;3240-资料审核通过,待付款
|
shopStoreBase.setStore_state_id(StateCode.STORE_STATE_YES);//店铺资料信息状态(ENUM):3210-待完善资料; 3220-等待审核 ; 3230-资料审核没有通过;3240-资料审核通过,待付款
|
||||||
shopStoreBase.setStore_time(DateUtil.date());
|
shopStoreBase.setStore_time(DateUtil.date());
|
||||||
shopStoreBase.setStore_end_time(0L);
|
shopStoreBase.setStore_end_time(System.currentTimeMillis() + 1000L * 60 * 60 * 24 * 365 * 5); // 5年
|
||||||
|
|
||||||
if (!save(shopStoreBase)) {
|
if (!save(shopStoreBase)) {
|
||||||
logger.error("生成店铺:新增店铺基本信息失败");
|
logger.error("生成店铺:新增店铺基本信息失败");
|
||||||
return storeId;
|
// return Pair.of(0, "新增店铺失败");
|
||||||
|
throw new ApiException(I18nUtil._("新增店铺失败"));
|
||||||
}
|
}
|
||||||
// 保存后店铺Id
|
// 保存后店铺Id
|
||||||
storeId = shopStoreBase.getStore_id();
|
storeId = shopStoreBase.getStore_id();
|
||||||
|
|
||||||
|
|
||||||
|
// shop_store_info
|
||||||
ShopStoreInfo shopStoreInfo = new ShopStoreInfo();
|
ShopStoreInfo shopStoreInfo = new ShopStoreInfo();
|
||||||
shopStoreInfo.setStore_id(storeId);
|
shopStoreInfo.setStore_id(storeId);
|
||||||
shopStoreInfo.setStore_start_time(DateUtil.date());
|
shopStoreInfo.setStore_start_time(DateUtil.date());
|
||||||
shopStoreInfo.setStore_end_time(DateUtil.offsetDay(DateUtil.date(), 365));
|
shopStoreInfo.setStore_end_time(DateUtil.offsetDay(DateUtil.date(), 365 * 5));
|
||||||
shopStoreInfo.setStore_opening_hours("08:00");
|
shopStoreInfo.setStore_opening_hours("08:00");
|
||||||
shopStoreInfo.setStore_close_hours("22:00");
|
shopStoreInfo.setStore_close_hours("22:00");
|
||||||
|
shopStoreInfo.setStore_discount(BigDecimal.valueOf(10));// 原价
|
||||||
shopStoreInfo.setStore_tel(shopMerchEntry.getLogin_mobile());
|
shopStoreInfo.setStore_tel(shopMerchEntry.getLogin_mobile());
|
||||||
shopStoreInfo.setStore_address(shopMerchEntry.getStore_address());
|
shopStoreInfo.setStore_banner(storeFacadeImage);
|
||||||
shopStoreInfoService.save(shopStoreInfo);
|
|
||||||
|
|
||||||
ShopStoreCompany shopStoreCompany = new ShopStoreCompany();
|
JSONArray list = new JSONArray();
|
||||||
shopStoreCompany.setStore_id(storeId);
|
if (StrUtil.isNotBlank(storeFacadeImage)) {
|
||||||
shopStoreCompany.setCompany_name(shopMerchEntry.getBiz_license_company());
|
JSONObject slide = new JSONObject();
|
||||||
shopStoreCompany.setCompany_address(shopMerchEntry.getStore_address());
|
slide.put("img", storeFacadeImage);
|
||||||
// 待补充
|
slide.put("name", "店铺门面照片");
|
||||||
shopStoreCompanyService.save(shopStoreCompany);
|
slide.put("check", true);
|
||||||
|
slide.put("url", "https://www.gpsxcs.cn");
|
||||||
|
list.put(slide);
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(shopMerchEntry.getEnvironment_image())) {
|
||||||
|
JSONObject slide = new JSONObject();
|
||||||
|
slide.put("img", shopMerchEntry.getEnvironment_image());
|
||||||
|
slide.put("name", "店铺环境照片");
|
||||||
|
slide.put("check", true);
|
||||||
|
slide.put("url", "https://www.gpsxcs.cn");
|
||||||
|
list.put(slide);
|
||||||
|
}
|
||||||
|
shopStoreInfo.setStore_slide(list.toString());
|
||||||
|
|
||||||
|
shopStoreInfo.setStore_address(shopMerchEntry.getStore_address()); // 包含省市区的详细地址
|
||||||
|
shopStoreInfo.setStore_state_id(StateCode.STORE_STATE_YES);
|
||||||
|
if (!shopStoreInfoService.save(shopStoreInfo)) {
|
||||||
|
logger.error("生成店铺:新增店铺info失败");
|
||||||
|
throw new ApiException(I18nUtil._("新增店铺失败"));
|
||||||
|
}
|
||||||
|
|
||||||
return storeId;
|
// 如果商家是企业,则保存商家公司信息
|
||||||
|
if (CommonConstant.MCH_ENTITY_TYPE_QY.equals(shopMerchEntry.getEntity_type())) {
|
||||||
|
// shop_store_company
|
||||||
|
ShopStoreCompany shopStoreCompany = new ShopStoreCompany();
|
||||||
|
shopStoreCompany.setUser_id(userId);
|
||||||
|
shopStoreCompany.setStore_id(storeId);
|
||||||
|
|
||||||
|
// 公司名
|
||||||
|
shopStoreCompany.setCompany_name(shopMerchEntry.getBiz_license_company());
|
||||||
|
shopStoreCompany.setCompany_area(shopStoreBase.getStore_area());
|
||||||
|
shopStoreCompany.setCompany_address(shopMerchEntry.getStore_address());
|
||||||
|
|
||||||
|
// 营业执照
|
||||||
|
shopStoreCompany.setBusiness_id(shopMerchEntry.getBiz_license_number());
|
||||||
|
shopStoreCompany.setBusiness_license_electronic(shopMerchEntry.getBiz_license_image());
|
||||||
|
|
||||||
|
// 企业法人
|
||||||
|
shopStoreCompany.setLegal_person(shopMerchEntry.getLegal_person_name());
|
||||||
|
shopStoreCompany.setLegal_person_number(shopMerchEntry.getLegal_person_id_number());
|
||||||
|
shopStoreCompany.setLegal_person_electronic(shopMerchEntry.getLegal_person_id_images());
|
||||||
|
|
||||||
|
// 联系人
|
||||||
|
shopStoreCompany.setContacts_name(shopMerchEntry.getContact_name());
|
||||||
|
shopStoreCompany.setContacts_phone(shopMerchEntry.getLogin_mobile());
|
||||||
|
|
||||||
|
// 银行对公账号
|
||||||
|
shopStoreCompany.setBank_account_name(shopMerchEntry.getAccount_holder_name());
|
||||||
|
shopStoreCompany.setBank_account_number(shopMerchEntry.getAccount_number());
|
||||||
|
shopStoreCompany.setBank_name(shopMerchEntry.getBank_name());
|
||||||
|
|
||||||
|
Date today = new Date();
|
||||||
|
|
||||||
|
shopStoreCompany.setOrganization_code_start(today);
|
||||||
|
shopStoreCompany.setOrganization_code_end(DateUtil.offsetDay(today, 365 * 5));
|
||||||
|
shopStoreCompany.setEstablish_date(today);
|
||||||
|
shopStoreCompany.setBusiness_licence_start(today);
|
||||||
|
shopStoreCompany.setBusiness_licence_end(DateUtil.offsetDay(today, 365 * 5));
|
||||||
|
|
||||||
|
shopStoreCompany.setCompany_description("");
|
||||||
|
shopStoreCompany.setStore_class_ids("");
|
||||||
|
shopStoreCompany.setStore_class_names("");
|
||||||
|
shopStoreCompany.setStore_class_commission("");
|
||||||
|
|
||||||
|
// 待补充
|
||||||
|
if (!shopStoreCompanyService.save(shopStoreCompany)) {
|
||||||
|
logger.error("生成店铺:新增店铺公司失败");
|
||||||
|
throw new ApiException(I18nUtil._("新增店铺公司失败"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// shop_store_employee 店铺员工,添加管理员
|
||||||
|
ShopStoreEmployee shopStoreEmployee = new ShopStoreEmployee();
|
||||||
|
shopStoreEmployee.setStore_id(storeId);
|
||||||
|
shopStoreEmployee.setUser_id(userId);
|
||||||
|
shopStoreEmployee.setRights_group_id("1"); // 店铺管理员
|
||||||
|
shopStoreEmployee.setEmployee_is_admin(CommonConstant.Enable);
|
||||||
|
shopStoreEmployee.setEmployee_is_kefu(CommonConstant.Enable);
|
||||||
|
shopStoreEmployeeService.save(shopStoreEmployee);
|
||||||
|
if (!shopStoreEmployeeService.save(shopStoreEmployee)) {
|
||||||
|
logger.error("生成店铺:新增店铺员工失败");
|
||||||
|
throw new ApiException(I18nUtil._("新增店铺员工失败"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Pair.of(storeId, "新增成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据店铺名称判断店铺是否存在
|
||||||
|
*
|
||||||
|
* @param storeName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean isExistsByStoreName(String storeName) {
|
||||||
|
if (StrUtil.isBlank(storeName)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
QueryWrapper<ShopStoreBase> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("store_name", storeName);
|
||||||
|
|
||||||
|
return count(queryWrapper) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user