商家入驻,fix bug。
This commit is contained in:
parent
e39a6ac074
commit
76e28177f9
@ -139,8 +139,8 @@ public class OrderPayedListener {
|
||||
try {
|
||||
// 同城配送或普通快递,都发送 unipush 推送:您有一个新的订单,请查收!
|
||||
String orderType = orderInfoOld.getDelivery_type_id() == StateCode.DELIVERY_TYPE_SAME_CITY ? "同城" : "";
|
||||
String title = String.format("您有一个新的%s订单,请注意查收!", orderType);
|
||||
String content = String.format("新%s订单号:%s,用户在%s下的单,请注意查收!", orderId, DateTimeUtils.formatDateTime(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss"));
|
||||
String title = String.format("您有一笔新的%s订单,请注意查收。", orderType);
|
||||
String content = String.format("这笔新%s订单:%s,用户于%s下的单,请注意查收。", orderType, orderId, DateTimeUtils.formatDateTime(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss"));
|
||||
JSONObject payload = new JSONObject();
|
||||
payload.put("category", CommonConstant.PUSH_MSG_CATE_MCH_ONLINE_ORDER_LIST);
|
||||
payload.put("orderId", orderId);
|
||||
@ -151,10 +151,11 @@ public class OrderPayedListener {
|
||||
jsonObject.put("category", MqConstant.DEAD_EVENT_CATE_ORDER_EXPIRED); // 消息分类:1-订单超时消息
|
||||
jsonObject.put("orderId", orderId); // 订单ID
|
||||
jsonObject.put("storeId", orderInfoOld.getStore_id()); // 店铺ID
|
||||
jsonObject.put("title", "有一笔已超时的订单!"); // 消息标题
|
||||
jsonObject.put("message", String.format("您有一笔已超时的订单%s,请及时处理。", orderId)); // 消息内容
|
||||
// 发送延迟消息
|
||||
mqMessageService.sendDelayMessage(jsonObject.toString(), 1500L * 1000); // 转换为毫秒
|
||||
jsonObject.put("title", "您有一笔将超时的订单。"); // 消息标题
|
||||
jsonObject.put("message", String.format("您有一笔将超时的订单:%s,请您及时处理。", orderId)); // 消息内容
|
||||
// 发送延迟消息(提前10分钟)
|
||||
Long mchOrderExpireSeconds = shopOrderBaseService.sameCityOrderExpireSeconds(1500L) - 600;
|
||||
mqMessageService.sendDelayMessage(jsonObject.toString(), mchOrderExpireSeconds * 1000); // 转换为毫秒
|
||||
} catch (Exception e) {
|
||||
log.error("发送推送消息失败:{}", e.getMessage());
|
||||
}
|
||||
|
||||
@ -5150,8 +5150,11 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
if (Arrays.asList(1001, 1002).contains(order_item_inventory_lock)) {
|
||||
Long item_id = order_item_row.getItem_id();
|
||||
ShopProductItem shopProductItem = shopProductItemService.get(item_id);
|
||||
if (shopProductItem == null) {
|
||||
throw new ApiException(I18nUtil._("无法获取订单中的商品,请检查!"));
|
||||
}
|
||||
|
||||
Integer item_quantity_frozen = shopProductItem.getItem_quantity_frozen();
|
||||
|
||||
int quantity_frozen = item_quantity_frozen - order_item_quantity;
|
||||
shopProductItem.setItem_quantity_frozen(quantity_frozen > 0 ? quantity_frozen : 0);
|
||||
|
||||
|
||||
@ -736,7 +736,6 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
||||
String sfOrderId = shopStoreSfOrder.getSf_order_id(); // 顺丰订单Id
|
||||
params.put("order_id", sfOrderId);
|
||||
ThirdApiRes feedRes = listOrderFeed(params);
|
||||
// logger.debug("获取配送员物流轨迹:{}", feedRes);
|
||||
if (feedRes != null && feedRes.getError_code().equals(0)) {
|
||||
JSONObject result = JSONUtil.parseObj(feedRes.getResult());
|
||||
if (result != null && result.get("feed") != null) {
|
||||
@ -744,6 +743,15 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
||||
}
|
||||
}
|
||||
|
||||
// 获取配送员轨迹H5
|
||||
ThirdApiRes riderViewV2Res = riderViewV2(params);
|
||||
if (riderViewV2Res != null && riderViewV2Res.getError_code().equals(0)) {
|
||||
JSONObject result = JSONUtil.parseObj(riderViewV2Res.getResult());
|
||||
if (result != null && result.get("url") != null) {
|
||||
shopStoreSfOrder.setH5_url(result.get("url").toString());
|
||||
}
|
||||
}
|
||||
|
||||
Boolean success = shopStoreSfOrderService.updateShopStoreSfOrderStatus(shopStoreSfOrder);
|
||||
if (!success) {
|
||||
throw new ApiException(I18nUtil._("状态处理失败!"));
|
||||
@ -859,6 +867,15 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
||||
}
|
||||
}
|
||||
|
||||
// 获取配送员轨迹H5
|
||||
ThirdApiRes riderViewV2Res = riderViewV2(params);
|
||||
if (riderViewV2Res != null && riderViewV2Res.getError_code().equals(0)) {
|
||||
JSONObject result = JSONUtil.parseObj(riderViewV2Res.getResult());
|
||||
if (result != null && result.get("url") != null) {
|
||||
shopStoreSfOrder.setH5_url(result.get("url").toString());
|
||||
}
|
||||
}
|
||||
|
||||
Boolean success = shopStoreSfOrderService.updateShopStoreSfOrderStatus(shopStoreSfOrder);
|
||||
if (!success) {
|
||||
throw new ApiException(I18nUtil._("状态处理失败!"));
|
||||
|
||||
@ -81,7 +81,7 @@ public interface ShopMchEntryService {
|
||||
* @param individualIdNumber 个人身份证号码,个人必填
|
||||
* @return
|
||||
*/
|
||||
Pair<Boolean, String> isApplied(Integer entityType, String contactMobile, String bizLicenseNumber, String individualIdNumber);
|
||||
Pair<Boolean, String> canApply(Integer entityType, String contactMobile, String bizLicenseNumber, String individualIdNumber);
|
||||
|
||||
/**
|
||||
* 通过手机号获取商家入驻审核状态
|
||||
|
||||
@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.api.ResultCode;
|
||||
import com.suisung.mall.common.constant.CommonConstant;
|
||||
import com.suisung.mall.common.domain.UserDto;
|
||||
import com.suisung.mall.common.modules.lakala.LklLedgerEc;
|
||||
@ -177,7 +178,6 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
return CommonResult.failed("请选择是企业还是个人");
|
||||
}
|
||||
|
||||
|
||||
// 不管是企业或个人,只要没有填写联系人,就直接把商家手机号码作为联系人手机号码
|
||||
if (StrUtil.isBlank(record.getLegal_person_mobile())) {
|
||||
record.setLegal_person_mobile(loginMobile);
|
||||
@ -188,9 +188,9 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
// * 根据入驻主体类型(企业或个人)使用不同的判断条件:
|
||||
// * - 企业:通过营业执照号+联系人手机号判断
|
||||
// * - 个人:通过个人身份证号+联系人手机号判断
|
||||
Pair<Boolean, String> isApplied = isApplied(record.getEntity_type(), record.getLegal_person_mobile(), record.getBiz_license_number(), record.getIndividual_id_number());
|
||||
if (isApplied.getFirst()) {
|
||||
return CommonResult.failed(isApplied.getSecond());
|
||||
Pair<Boolean, String> canDo = canApply(record.getEntity_type(), record.getLegal_person_mobile(), record.getBiz_license_number(), record.getIndividual_id_number());
|
||||
if (!canDo.getFirst()) {
|
||||
return CommonResult.failed(canDo.getSecond());
|
||||
}
|
||||
|
||||
if (shopStoreBaseService.isExistsByStoreName(record.getStore_name())) {
|
||||
@ -221,6 +221,10 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
record.setIndividual_id_period_end("9999-12-31");
|
||||
}
|
||||
|
||||
if (StrUtil.isBlank(record.getContact_name())) {
|
||||
record.setContact_name(record.getIndividual_id_name());
|
||||
}
|
||||
|
||||
} else {
|
||||
// 企业
|
||||
if (StrUtil.isBlank(record.getBiz_license_number()) || StrUtil.isBlank(record.getBiz_license_image())) {
|
||||
@ -252,8 +256,13 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
if (StrUtil.contains(record.getLegal_person_id_period_end(), "长期")) {
|
||||
record.setLegal_person_id_period_end("9999-12-31");
|
||||
}
|
||||
|
||||
if (StrUtil.isBlank(record.getContact_name())) {
|
||||
record.setContact_name(record.getLegal_person_name());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 检查银行账号
|
||||
if (StrUtil.isBlank(record.getBank_name()) || StrUtil.isBlank(record.getAccount_number()) || StrUtil.isBlank(record.getAccount_holder_name())) {
|
||||
return CommonResult.failed("缺少银行账号信息!");
|
||||
@ -267,6 +276,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
return CommonResult.failed("请填写结算账户清算⾏号!");
|
||||
}
|
||||
|
||||
|
||||
// 对公对私,结算账户清算⾏号和结算账户开户⾏号一定一致
|
||||
record.setClearing_bank_code(record.getOpenning_bank_code());
|
||||
|
||||
@ -332,7 +342,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
}
|
||||
|
||||
// 验证合同签署状态,如果已经签署,不能再次申请
|
||||
ShopMchEntry oldRecord = getById(shopMerchEntryJSON.getInt("id"));
|
||||
ShopMchEntry oldRecord = shopMerchEntryById(shopMerchEntryJSON.getLong("id"));
|
||||
if (oldRecord == null) {
|
||||
return CommonResult.failed("未找到入驻记录!");
|
||||
}
|
||||
@ -351,28 +361,21 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
// 检查企业、法人或个人的营业执照或身份证
|
||||
if (ObjectUtil.isNotEmpty(oldRecord.getEntity_type()) && !oldRecord.getEntity_type().equals(CommonConstant.MCH_ENTITY_TYPE_QY)) {
|
||||
// 个人
|
||||
// if (StrUtil.isBlank(record.getIndividual_id_number()) || StrUtil.isBlank(record.getIndividual_id_images()) || StrUtil.isBlank(record.getIndividual_id_images2())) {
|
||||
// return CommonResult.failed("缺少个人身份证信息!");
|
||||
// }
|
||||
|
||||
isQy = false; // 个人入驻
|
||||
|
||||
if (StrUtil.isNotBlank(record.getIndividual_id_number()) && !StringUtils.validateIDCard(record.getIndividual_id_number())) {
|
||||
return CommonResult.failed("个人身份证号码有误!");
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(record.getIndividual_id_name()) && StrUtil.isBlank(record.getContact_name())) {
|
||||
record.setContact_name(record.getIndividual_id_name());
|
||||
}
|
||||
|
||||
} else {
|
||||
// 企业
|
||||
// if (StrUtil.isBlank(record.getBiz_license_number()) || StrUtil.isBlank(record.getBiz_license_image())) {
|
||||
// return CommonResult.failed("缺少企业营业执照信息!");
|
||||
// }
|
||||
//
|
||||
if (StrUtil.isNotBlank(record.getBiz_license_number()) && !StringUtils.verifyBusinessLicense(record.getBiz_license_number())) {
|
||||
return CommonResult.failed("营业执照号码有误!");
|
||||
}
|
||||
//
|
||||
// if (StrUtil.isBlank(record.getLegal_person_id_images()) || StrUtil.isBlank(record.getLegal_person_id_images2())) {
|
||||
// return CommonResult.failed("法人身份证信息!");
|
||||
// }
|
||||
|
||||
if (StrUtil.isNotBlank(record.getLegal_person_id_number()) && !StringUtils.validateIDCard(record.getLegal_person_id_number())) {
|
||||
return CommonResult.failed("法人身份证号码有误!");
|
||||
@ -381,25 +384,16 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
if (StrUtil.isNotBlank(record.getLegal_person_mobile()) && !PhoneNumberUtils.checkPhoneNumber(record.getLegal_person_mobile())) {
|
||||
return CommonResult.failed("法人手机号码有误!");
|
||||
}
|
||||
}
|
||||
|
||||
// 检查银行账号
|
||||
// if (StrUtil.isBlank(record.getBank_name()) || StrUtil.isBlank(record.getAccount_number()) || StrUtil.isBlank(record.getAccount_holder_name())) {
|
||||
// return CommonResult.failed("缺少银行账号信息!");
|
||||
// }
|
||||
if (StrUtil.isNotBlank(record.getLegal_person_name()) && StrUtil.isBlank(record.getContact_name())) {
|
||||
record.setContact_name(record.getLegal_person_name());
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(record.getAccount_number()) && !BankUtil.validateBankCard(record.getAccount_number(), "CN", isQy)) {
|
||||
return CommonResult.failed("银行卡号格式有误!");
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(record.getOpenning_bank_code())) {
|
||||
// 对公对私,结算账户清算⾏号和结算账户开户⾏号一定一致
|
||||
record.setClearing_bank_code(record.getOpenning_bank_code());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(record.getStore_name()) && shopStoreBaseService.isExistsByStoreName(record.getStore_name())) {
|
||||
return CommonResult.failed("店铺名已被使用!");
|
||||
}
|
||||
|
||||
record.setLogin_mobile(null);// 手机号不能更改
|
||||
|
||||
@ -419,6 +413,20 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
// 转换拉卡拉的日期格式 yyyy-MM-dd
|
||||
record = convLklDateFormat(record);
|
||||
|
||||
// 不管是企业或个人,只要没有填写联系人,就直接把商家手机号码作为联系人手机号码
|
||||
if (StrUtil.isBlank(oldRecord.getLegal_person_mobile()) && StrUtil.isBlank(record.getLegal_person_mobile())) {
|
||||
record.setLegal_person_mobile(oldRecord.getLogin_mobile());
|
||||
}
|
||||
|
||||
// 对公对私,结算账户清算⾏号和结算账户开户⾏号一定一致
|
||||
if (StrUtil.isNotBlank(record.getOpenning_bank_code())) {
|
||||
record.setClearing_bank_code(record.getOpenning_bank_code());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(record.getStore_name()) && shopStoreBaseService.isExistsByStoreName(record.getStore_name())) {
|
||||
return CommonResult.failed("店铺名已被使用!");
|
||||
}
|
||||
|
||||
if (!updateById(record)) {
|
||||
return CommonResult.failed("重新申请入驻提交失败!");
|
||||
}
|
||||
@ -657,7 +665,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
|
||||
UserDto user = getCurrentUser();
|
||||
if (!user.isAdmin()) {
|
||||
return CommonResult.failed("权限不足!");
|
||||
return CommonResult.failed(ResultCode.FORBIDDEN);
|
||||
}
|
||||
userId = user.getId();
|
||||
|
||||
@ -699,7 +707,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
|
||||
// 如果是驳回状态,直接返回成功消息
|
||||
if (approvalStatus.equals(CommonConstant.MCH_APPR_STA_NOPASS)) {
|
||||
// 重置审核状态,合同等相关字段
|
||||
// 驳回或重新申请入驻时,重置入驻申请的合同信息
|
||||
record = resetAuditColumns(record);
|
||||
}
|
||||
|
||||
@ -771,7 +779,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查商家是否已经申请过入驻
|
||||
* 检查商家是否能申请入驻
|
||||
* 根据入驻主体类型(企业或个人)使用不同的判断条件:
|
||||
* - 企业:通过营业执照号+联系人手机号判断
|
||||
* - 个人:通过个人身份证号+联系人手机号判断
|
||||
@ -783,26 +791,27 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
* @return Pair<Boolean, String> 第一个值表示是否已申请(true表示已申请),第二个值为提示信息
|
||||
*/
|
||||
@Override
|
||||
public Pair<Boolean, String> isApplied(Integer entityType, String contactMobile, String bizLicenseNumber, String individualIdNumber) {
|
||||
public Pair<Boolean, String> canApply(Integer entityType, String contactMobile, String bizLicenseNumber, String individualIdNumber) {
|
||||
log.info("准备检查商家是否已经申请过入驻");
|
||||
// 1. 参数校验:入驻主体类型不能为空
|
||||
if (CheckUtil.isEmpty(entityType)) {
|
||||
return Pair.of(Boolean.FALSE, "请选择是企业还是个人");
|
||||
return Pair.of(false, "请选择是企业还是个人");
|
||||
}
|
||||
|
||||
// 2. 根据不同主体类型校验必要参数
|
||||
if (entityType.equals(CommonConstant.MCH_ENTITY_TYPE_QY)) {
|
||||
// 企业类型:营业执照号和联系人手机号至少提供一个
|
||||
if (StrUtil.isBlank(contactMobile) && StrUtil.isBlank(bizLicenseNumber)) {
|
||||
return Pair.of(Boolean.FALSE, "缺少企业营业执照或联系人手机号!");
|
||||
return Pair.of(false, "缺少企业营业执照或联系人手机号!");
|
||||
}
|
||||
} else if (entityType.equals(CommonConstant.MCH_ENTITY_TYPE_GR)) {
|
||||
// 个人类型:身份证号和联系人手机号至少提供一个
|
||||
if (StrUtil.isBlank(contactMobile) && StrUtil.isBlank(individualIdNumber)) {
|
||||
return Pair.of(Boolean.FALSE, "缺少个人身份证号或联系人手机号!");
|
||||
return Pair.of(false, "缺少个人身份证号或联系人手机号!");
|
||||
}
|
||||
} else {
|
||||
// 未知的主体类型
|
||||
return Pair.of(Boolean.FALSE, "不支持的入驻主体类型");
|
||||
return Pair.of(false, "不支持的入驻主体类型");
|
||||
}
|
||||
|
||||
try {
|
||||
@ -813,7 +822,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
|
||||
// 必须包含联系人手机号
|
||||
if (StrUtil.isBlank(contactMobile)) {
|
||||
return Pair.of(Boolean.FALSE, "联系人手机号不能为空");
|
||||
return Pair.of(false, "联系人手机号不能为空");
|
||||
}
|
||||
queryWrapper.eq("legal_person_mobile", contactMobile);
|
||||
|
||||
@ -822,34 +831,34 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
if (entityType.equals(CommonConstant.MCH_ENTITY_TYPE_QY)) {
|
||||
// 企业类型:增加营业执照号查询条件
|
||||
if (StrUtil.isBlank(bizLicenseNumber)) {
|
||||
return Pair.of(Boolean.FALSE, "企业营业执照号不能为空");
|
||||
return Pair.of(false, "企业营业执照号不能为空");
|
||||
}
|
||||
queryWrapper.eq("biz_license_number", bizLicenseNumber);
|
||||
msg = "营业执照号已提交过入驻";
|
||||
} else {
|
||||
// 个人类型:增加身份证号查询条件
|
||||
if (StrUtil.isBlank(individualIdNumber)) {
|
||||
return Pair.of(Boolean.FALSE, "个人身份证号不能为空");
|
||||
return Pair.of(false, "个人身份证号不能为空");
|
||||
}
|
||||
queryWrapper.eq("individual_id_number", individualIdNumber);
|
||||
msg = "个人身份证已提交过入驻";
|
||||
}
|
||||
|
||||
// 5. 执行查询并返回结果
|
||||
long count = count(queryWrapper);
|
||||
boolean isApplied = count > 0;
|
||||
|
||||
if (isApplied) {
|
||||
return Pair.of(Boolean.FALSE, msg);
|
||||
if (count(queryWrapper) > 0) {
|
||||
return Pair.of(false, msg);
|
||||
}
|
||||
|
||||
return Pair.of(Boolean.TRUE, "");
|
||||
|
||||
log.info("可以申请入驻,准备申请入驻");
|
||||
|
||||
return Pair.of(true, "可以申请入驻,准备下一个流程");
|
||||
|
||||
} catch (Exception e) {
|
||||
// 6. 异常处理:记录日志并返回错误信息
|
||||
log.error("检查商家入驻申请状态时发生异常: entityType={}, contactMobile={}, bizLicenseNumber={}, individualIdNumber={}",
|
||||
entityType, contactMobile, bizLicenseNumber, individualIdNumber, e);
|
||||
return Pair.of(Boolean.FALSE, "系统异常,请稍后重试");
|
||||
return Pair.of(false, "系统异常,请稍后重试");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user