商家入驻审批增加 无效字段和合同签署状态

This commit is contained in:
Jack 2025-03-05 15:57:48 +08:00
parent c919d8ae8c
commit f9c648bc0e
9 changed files with 132 additions and 56 deletions

View File

@ -146,6 +146,12 @@ public class ShopMerchEntry implements Serializable {
@ApiModelProperty(value = "入驻商家审批时的备注信息")
private String approval_remark;
@ApiModelProperty(value = "审核时无效字段集合,如:[`bank_name`,`license_number`,…]")
private String approval_invalid_col;
@ApiModelProperty(value = "合同签署状态0-无任何签署1-一方签署2-双方已签署;")
private Integer signed_status;
@ApiModelProperty(value = "该商家入驻记录是否有效0:无效1:有效")
private Integer status;

View File

@ -1,6 +1,5 @@
package com.suisung.mall.common.utils;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.*;
import org.slf4j.Logger;
@ -37,6 +36,14 @@ public final class StringUtils extends org.apache.commons.lang3.StringUtils {
private static final Random RANDOM = new Random();
private static final Logger logger = LoggerFactory.getLogger(StringUtils.class);
private static final ObjectMapper objectMapper = new ObjectMapper();
/**
* 全地址去除省市区保留详细地址
*
* @param fullAddress 比如广西壮族自治区贵港市桂平市西山镇新安街粤桂花城1102号 -> 西山镇新安街粤桂花城1102号
* @return
*/
private static final String PROVINCE_CITY_DISTRICT_REGEX =
"(?<province>(\\w+省|\\w+自治区))?(?<city>(\\w+市|\\w+自治州))?(?<district>(\\w+区|\\w+县|\\w+市辖区|\\w+市))?";
public static void main(String[] args) {
// System.out.println(removeProvinceCityDistrict("广西壮族自治区贵港市桂平市西山镇新安街粤桂花城1102号"));
@ -277,37 +284,38 @@ public final class StringUtils extends org.apache.commons.lang3.StringUtils {
return base64.substring(0, length);
}
/**
* 全地址去除省市区保留详细地址
*
* @param fullAddress 比如广西壮族自治区贵港市桂平市西山镇新安街粤桂花城1102号 -> 西山镇新安街粤桂花城1102号
* @return
*/
public static String removeProvinceCityDistrict(String fullAddress) {
if (StrUtil.isBlank(fullAddress)) {
if (StringUtils.isBlank(fullAddress)) {
return "";
}
// 使用正则表达式匹配省市区信息
Pattern pattern = Pattern.compile("(.*?省|.*?自治区)?(.*?市|.*?自治州)?(.*?区|.*?县|.*?市辖区|.*?市)?");
Matcher matcher = pattern.matcher(fullAddress);
if (!matcher.find()) {
return fullAddress;
}
try {
Pattern pattern = Pattern.compile(PROVINCE_CITY_DISTRICT_REGEX);
Matcher matcher = pattern.matcher(fullAddress);
if (matcher.group(1) != null) {
fullAddress = fullAddress.replace(matcher.group(1), "");
}
if (!matcher.find()) {
return fullAddress;
}
if (matcher.group(2) != null) {
fullAddress = fullAddress.replace(matcher.group(2), "");
}
StringBuilder result = new StringBuilder(fullAddress);
if (matcher.group(3) != null) {
fullAddress = fullAddress.replace(matcher.group(3), "");
}
// Remove matched groups in reverse order to avoid index shifting issues
if (matcher.group("district") != null) {
result.replace(matcher.start("district"), matcher.end("district"), "");
}
if (matcher.group("city") != null) {
result.replace(matcher.start("city"), matcher.end("city"), "");
}
if (matcher.group("province") != null) {
result.replace(matcher.start("province"), matcher.end("province"), "");
}
return fullAddress;
return result.toString().trim();
} catch (Exception e) {
// Log the exception for debugging purposes
System.err.println("Error processing address: " + e.getMessage());
return fullAddress; // Return original address on failure
}
}
/**

View File

@ -9,7 +9,11 @@
package com.suisung.mall.shop.esign.service;
import com.suisung.mall.common.modules.esign.EsignPlatformInfo;
import org.springframework.data.util.Pair;
/**
* 平台方详细信息接口
*/
public interface EsignPlatformInfoService {
/**
@ -20,4 +24,12 @@ public interface EsignPlatformInfoService {
* @return
*/
EsignPlatformInfo getEsignPlatformInfo(Integer type, String licenseNumber);
/**
* 获取平台方手机号和营业执照号
*
* @return
*/
Pair<String, String> getEsignPlatformMobileAndLicenseNumber();
}

View File

@ -12,9 +12,11 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.suisung.mall.common.modules.esign.EsignPlatformInfo;
import com.suisung.mall.common.utils.phone.PhoneNumberUtils;
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
import com.suisung.mall.shop.esign.mapper.EsignPlatformInfoMapper;
import com.suisung.mall.shop.esign.service.EsignPlatformInfoService;
import org.springframework.data.util.Pair;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
@ -47,4 +49,27 @@ public class EsignPlatformInfoServiceImpl extends BaseServiceImpl<EsignPlatformI
return esignPlatformInfos.get(0);
}
/**
* 获取平台方手机号和营业执照号
*
* @return
*/
@Override
public Pair<String, String> getEsignPlatformMobileAndLicenseNumber() {
QueryWrapper<EsignPlatformInfo> queryWrapper = new QueryWrapper();
queryWrapper.eq("type", 0).select("mobile", "license_number", "legal_person_mobile");
List<EsignPlatformInfo> esignPlatformInfos = list(queryWrapper);
if (CollectionUtil.isEmpty(esignPlatformInfos)) {
return null;
}
EsignPlatformInfo esignPlatformInfo = esignPlatformInfos.get(0);
String mobile = esignPlatformInfo.getTelephone();
if (!PhoneNumberUtils.checkPhoneNumber(mobile) && StrUtil.isNotBlank(esignPlatformInfo.getLegal_person_mobile())) {
mobile = esignPlatformInfo.getLegal_person_mobile();
}
return Pair.of(mobile, esignPlatformInfo.getLicense_number());
}
}

View File

@ -28,7 +28,6 @@ import com.suisung.mall.common.modules.store.ShopStoreBase;
import com.suisung.mall.common.modules.wechat.ShopWechatTplmsg;
import com.suisung.mall.common.pojo.dto.ErrorTypeEnum;
import com.suisung.mall.common.pojo.dto.SmsDto;
import com.suisung.mall.common.service.impl.AliServiceImpl;
import com.suisung.mall.common.utils.EmailUtil;
import com.suisung.mall.common.utils.LogUtil;
import com.suisung.mall.common.utils.ThirdUtil;
@ -45,10 +44,10 @@ import com.suisung.mall.shop.store.service.ShopStoreBaseService;
import com.suisung.mall.shop.wechat.service.ShopWechatTplmsgService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.text.StringSubstitutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
@ -68,22 +67,19 @@ import static com.suisung.mall.common.utils.I18nUtil._;
* @author Xinze
* @since 2021-08-17
*/
@EnableAsync
@Service
@Slf4j
public class ShopMessageTemplateServiceImpl extends BaseServiceImpl<ShopMessageTemplateMapper, ShopMessageTemplate> implements ShopMessageTemplateService {
@Autowired
ShopStoreBaseService shopStoreBaseService;
@Autowired
private AccountBaseConfigService accountBaseConfigService;
@Autowired
private AccountService accountService;
@Autowired
private SnsService snsService;
@Autowired
ShopStoreBaseService shopStoreBaseService;
@Autowired
private GeTuiUtil geTuiUtil;
@ -311,7 +307,7 @@ public class ShopMessageTemplateServiceImpl extends BaseServiceImpl<ShopMessageT
smsDto.setContent(message_row.getMessage_sms());
smsDto.setParamMap(args); //传入模板对应参数
smsDto.setTengxunTemplateId(NumberUtil.parseInt(message_row.getMessage_tpl_id(),0));
smsDto.setTengxunTemplateId(NumberUtil.parseInt(message_row.getMessage_tpl_id(), 0));
try {
ThirdUtil.send(smsDto);
@ -584,13 +580,14 @@ public class ShopMessageTemplateServiceImpl extends BaseServiceImpl<ShopMessageT
/**
* 临时方法发送阿里云短信
*
* @param mobile
* @param tmplCode
* @param tmplParams
* @return 阿里云返回的 json 数据
*/
@Override
public Boolean aliyunSmsSend(String mobile, String tmplCode, Map<String,Object> tmplParams) {
public Boolean aliyunSmsSend(String mobile, String tmplCode, Map<String, Object> tmplParams) {
if (StrUtil.isBlank(mobile) || StrUtil.isBlank(tmplCode)) {
LogUtil.error("阿里云发送短信时,缺少必要参数!");
return false;
@ -647,11 +644,14 @@ public class ShopMessageTemplateServiceImpl extends BaseServiceImpl<ShopMessageT
}
/**
* 异步批量发送阿里云短信
*
* @param mobiles
* @param tmplCode
* @param tmplParams
* @return
*/
@Async
@Override
public Integer aliyunSmsSend(List<String> mobiles, String tmplCode, Map<String, Object> tmplParams) {
int successCnt = 0;

View File

@ -51,6 +51,6 @@ public class ShopMerchEntryAdminController extends BaseControllerImpl {
@RequestMapping(value = "/approval", method = RequestMethod.POST)
public CommonResult shopMerchEntryApproval(@RequestBody JSONObject jsonParam) {
// approvalStatus 入驻商家的审批状态1-已通过2-未通过3-待审核
return shopMerchEntryService.shopMerchEntryApproval(jsonParam.getLong("id"), jsonParam.getInt("approvalStatus"), jsonParam.getStr("approvalRemark"));
return shopMerchEntryService.shopMerchEntryApproval(jsonParam.getLong("id"), jsonParam.getInt("approvalStatus"), jsonParam.getStr("approvalRemark"), jsonParam.getStr("approvalInvalidCol"));
}
}

View File

@ -21,8 +21,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Api(tags = "店铺基础信息表")
@RestController
@ -59,10 +57,10 @@ public class ShopMerchEntryController extends BaseControllerImpl {
@RequestMapping(value = "/detail", method = RequestMethod.POST)
public CommonResult shopMerchEntryDetail(@RequestBody JSONObject jsonParam) {
// approvalStatus 入驻商家的审批状态1-已通过2-未通过3-待审核
List<Integer> approvalStatusList = new ArrayList<Integer>();
approvalStatusList.add(2);
approvalStatusList.add(3);
return shopMerchEntryService.shopMerchEntryDetail(null, jsonParam.getStr("mobile"), approvalStatusList);
// List<Integer> approvalStatusList = new ArrayList<Integer>();
// approvalStatusList.add(2);
// approvalStatusList.add(3);
return shopMerchEntryService.shopMerchEntryDetail(null, jsonParam.getStr("mobile"), null);
}
@ApiOperation(value = "通过手机号mobile获取商家入驻审核状态", notes = "通过手机号获取商家入驻审核状态")

View File

@ -55,11 +55,12 @@ public interface ShopMerchEntryService {
* 商家入驻审批
*
* @param id
* @param approvalStatus
* @param approvalRemark
* @param approvalStatus 入驻商家的审批状态1-已通过2-未通过3-待审核4-未申请
* @param approvalRemark 审批备注
* @param approvalInvalidCol 审批无效字段
* @return
*/
CommonResult shopMerchEntryApproval(Long id, Integer approvalStatus, String approvalRemark);
CommonResult shopMerchEntryApproval(Long id, Integer approvalStatus, String approvalRemark, String approvalInvalidCol);
/**

View File

@ -24,13 +24,18 @@ import com.suisung.mall.common.utils.StringUtils;
import com.suisung.mall.common.utils.phone.PhoneNumberUtils;
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
import com.suisung.mall.shop.base.service.AccountBaseConfigService;
import com.suisung.mall.shop.esign.service.EsignPlatformInfoService;
import com.suisung.mall.shop.message.service.ShopMessageTemplateService;
import com.suisung.mall.shop.store.mapper.ShopMerchEntryMapper;
import com.suisung.mall.shop.store.service.ShopMerchEntryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.util.Pair;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@Service
@ -39,6 +44,12 @@ public class ShopMerchEntryServiceImpl extends BaseServiceImpl<ShopMerchEntryMap
@Resource
private AccountBaseConfigService accountBaseConfigService;
@Resource
private ShopMessageTemplateService shopMessageTemplateService;
@Resource
private EsignPlatformInfoService esignPlatformInfoService;
/**
* 获取店铺的经营类目列表
*
@ -162,7 +173,15 @@ public class ShopMerchEntryServiceImpl extends BaseServiceImpl<ShopMerchEntryMap
return CommonResult.failed("入驻信息提交失败!");
}
// TODO 发送短信给管理员和商家
// 尊敬的管理员商家 ${name}提交了入驻我们平台的申请请及时对相关资质材料予以审核以便推进后续流程
// 获取平台方的手机号码发送短信通知
Pair<String, String> mobileAndLicenseNumber = esignPlatformInfoService.getEsignPlatformMobileAndLicenseNumber();
if (mobileAndLicenseNumber != null) {
Map<String, Object> tmplArgs = new HashMap<>(1);
tmplArgs.put("name", record.getBiz_license_company()); // 商家公司名称
// 所有店铺管理员的发送邮件 提醒商家您有一笔新的订单 ${order_id}请及时处理
shopMessageTemplateService.aliyunSmsSend(mobileAndLicenseNumber.getFirst(), "SMS_479760276", tmplArgs);//SMS_475836097
}
return CommonResult.success();
}
@ -246,12 +265,13 @@ public class ShopMerchEntryServiceImpl extends BaseServiceImpl<ShopMerchEntryMap
* 商家入驻审批
*
* @param id
* @param approvalStatus
* @param approvalRemark
* @param approvalStatus 入驻商家的审批状态1-已通过2-未通过3-待审核4-未申请
* @param approvalRemark 审批备注
* @param approvalInvalidCol 审批无效字段
* @return
*/
@Override
public CommonResult shopMerchEntryApproval(Long id, Integer approvalStatus, String approvalRemark) {
public CommonResult shopMerchEntryApproval(Long id, Integer approvalStatus, String approvalRemark, String approvalInvalidCol) {
// 检查登录用户是否有管理权限
String userId = "0";
@ -265,25 +285,31 @@ public class ShopMerchEntryServiceImpl extends BaseServiceImpl<ShopMerchEntryMap
return CommonResult.failed("缺少必要参数!");
}
if (!approvalStatus.equals(1) && !approvalStatus.equals(2)) {
if (!approvalStatus.equals(CommonConstant.Enable) && !approvalStatus.equals(CommonConstant.Disable2)) {
return CommonResult.failed("审批状态有误!");
}
// TODO 已经审核通过的不能再审核了
if (approvalStatus.equals(1) && StrUtil.isBlank(approvalRemark)) {
approvalRemark = "审核通过,后续将签署电子合同流程。";
} else if (approvalStatus.equals(2) && StrUtil.isBlank(approvalRemark)) {
approvalRemark = "审核未通过,申请材料有待完善";
if (approvalStatus.equals(CommonConstant.Enable) && StrUtil.isBlank(approvalRemark)) {
approvalRemark = "审核通过,后续将向您发起签署电子合同流程。";
} else if (approvalStatus.equals(CommonConstant.Disable2) && StrUtil.isBlank(approvalRemark)) {
approvalRemark = "审核未通过,请继续完善入驻资料信息";
}
UpdateWrapper<ShopMerchEntry> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", id).set("approval_status", approvalStatus)
updateWrapper.eq("id", id)
.set("approval_status", approvalStatus)
.set("approval_remark", approvalRemark)
.set("updated_by", userId);
// 指定哪些字段无效字段的审批细节
if (StrUtil.isNotBlank(approvalInvalidCol)) {
updateWrapper.set("approval_invalid_col", approvalInvalidCol);
}
if (!update(updateWrapper)) {
return CommonResult.failed("审批出错,请联系管理员!");
return CommonResult.failed("系统处理审批出错,请联系管理员!");
}
// TODO 审核通过后去拉卡拉进件即时发送短信给商家通知去签电子合同