|
@@ -1,13 +1,17 @@
|
|
|
package cn.newfeifan.mall.module.sale.service.merchantapply;
|
|
|
|
|
|
import cn.newfeifan.mall.framework.common.exception.ErrorCode;
|
|
|
+import cn.newfeifan.mall.module.member.api.user.MemberUserApi;
|
|
|
+import cn.newfeifan.mall.module.member.api.user.dto.MemberUserRespDTO;
|
|
|
import cn.newfeifan.mall.module.member.enums.DictTypeConstants;
|
|
|
import cn.newfeifan.mall.module.sale.controller.app.merchantapply.vo.MerchantApplyPageReqVO;
|
|
|
import cn.newfeifan.mall.module.sale.controller.app.merchantapply.vo.MerchantApplySaveReqVO;
|
|
|
import cn.newfeifan.mall.module.sale.enums.MerchantApplyCheckStatusEnum;
|
|
|
import cn.newfeifan.mall.module.system.service.user.AdminUserService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
import javax.annotation.Resource;
|
|
|
+
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
import cn.newfeifan.mall.module.sale.dal.dataobject.merchantapply.MerchantApplyDO;
|
|
@@ -36,11 +40,14 @@ public class MerchantApplyServiceImpl implements MerchantApplyService {
|
|
|
@Resource
|
|
|
private AdminUserService usersService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private MemberUserApi memberUserApi;
|
|
|
+
|
|
|
@Override
|
|
|
public Long createMerchantApply(MerchantApplySaveReqVO createReqVO) {
|
|
|
|
|
|
// 校验存在
|
|
|
- if(usersService.getUserByMobile(createReqVO.getContactNumber()) != null){
|
|
|
+ if (usersService.getUserByMobile(createReqVO.getContactNumber()) != null) {
|
|
|
ErrorCode ERROR = new ErrorCode(1_002_029_003, "联络人账户已存在");
|
|
|
throw exception(ERROR);
|
|
|
}
|
|
@@ -50,8 +57,8 @@ public class MerchantApplyServiceImpl implements MerchantApplyService {
|
|
|
merchantApply.setApplyMemberUserId(getLoginUserId());
|
|
|
|
|
|
// 默认log
|
|
|
- if(createReqVO.getLogoUrl() == null || createReqVO.getLogoUrl().isEmpty()){
|
|
|
- createReqVO.setLogoUrl(DictTypeConstants.DEFAULT_AVATAR);
|
|
|
+ if (createReqVO.getLogoUrl() == null || createReqVO.getLogoUrl().isEmpty()) {
|
|
|
+ merchantApply.setLogoUrl(DictTypeConstants.DEFAULT_AVATAR);
|
|
|
}
|
|
|
|
|
|
merchantApplyMapper.insert(merchantApply);
|
|
@@ -65,7 +72,7 @@ public class MerchantApplyServiceImpl implements MerchantApplyService {
|
|
|
MerchantApplyDO merchantApplyDO = merchantApplyMapper.selectById(updateReqVO.getId());
|
|
|
|
|
|
// 联系人手机号校验
|
|
|
- if(!merchantApplyDO.getContactNumber().equals(updateReqVO.getContactNumber()) && usersService.getUserByMobile(updateReqVO.getContactNumber()) != null){
|
|
|
+ if (!merchantApplyDO.getContactNumber().equals(updateReqVO.getContactNumber()) && usersService.getUserByMobile(updateReqVO.getContactNumber()) != null) {
|
|
|
ErrorCode ERROR = new ErrorCode(1_002_029_003, "联络人账户已存在");
|
|
|
throw exception(ERROR);
|
|
|
}
|
|
@@ -77,7 +84,7 @@ public class MerchantApplyServiceImpl implements MerchantApplyService {
|
|
|
MerchantApplyDO updateObj = BeanUtils.toBean(updateReqVO, MerchantApplyDO.class);
|
|
|
|
|
|
// 默认log
|
|
|
- if(updateObj.getLogoUrl() == null || updateObj.getLogoUrl().isEmpty()){
|
|
|
+ if (updateObj.getLogoUrl() == null || updateObj.getLogoUrl().isEmpty()) {
|
|
|
updateObj.setLogoUrl(DictTypeConstants.DEFAULT_AVATAR);
|
|
|
}
|
|
|
|
|
@@ -116,4 +123,15 @@ public class MerchantApplyServiceImpl implements MerchantApplyService {
|
|
|
return merchantApplyMapper.selectOne(MerchantApplyDO::getApplyMemberUserId, loginUserId);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Boolean isSystemUserByMobile() {
|
|
|
+ // 获取消费者手机号
|
|
|
+ MemberUserRespDTO user = memberUserApi.getUser(getLoginUserId());
|
|
|
+ // 获取申请入驻信息
|
|
|
+ MerchantApplyDO merchantApplyDO = merchantApplyMapper.selectOne(MerchantApplyDO::getApplyMemberUserId, getLoginUserId());
|
|
|
+
|
|
|
+ // 判断是否有系统用户
|
|
|
+ return usersService.getUserByMobile(user.getMobile()) != null && merchantApplyDO == null;
|
|
|
+ }
|
|
|
+
|
|
|
}
|