增加个推配置和公共方法
This commit is contained in:
commit
85e7989a8e
44
README.MD
44
README.MD
@ -27,7 +27,6 @@ mall-im
|
||||
}
|
||||
|
||||
清除 docker 日志
|
||||
docker ps -aq | xargs docker inspect --format='{{.LogPath}}' | xargs truncate -s 0
|
||||
|
||||
查看哪个文件夹占空间
|
||||
du -sh * | sort -h
|
||||
@ -36,10 +35,41 @@ cd /data/docker/overlay2
|
||||
查看哪个文件夹占空间
|
||||
du -sh * | sort -h
|
||||
|
||||
进入到 大文件的目录下,执行以下脚本
|
||||
for file in *log*; do
|
||||
cat /dev/null > "$file"
|
||||
done
|
||||
### 删除 docker 产生的日志文件:update:2025-05-21
|
||||
|
||||
或者递归删除log 文件
|
||||
find overlay2 -type f -name "*.log.*" -print0 | xargs -0 -I {} cat /dev/null > {}
|
||||
* 避免误删: 先用 -print 参数预览匹配的文件,确认无误后再执行 -delete:
|
||||
* 删除 7 天前
|
||||
|
||||
``` bash
|
||||
-- 打印所有匹配文件路径
|
||||
find /data/docker/overlay2 -type f \( \
|
||||
-name "*.log" \
|
||||
-o -name "*.log.[0-9]*" \
|
||||
-o -name "*.log.[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" \
|
||||
\) -not \( \
|
||||
-name "mysql*.log*" \
|
||||
-o -name "*.idx" \
|
||||
-o -name "*.lck" \
|
||||
-o -name "*.js" \
|
||||
-o -name "*.yml" \
|
||||
-o -name "*.toml" \
|
||||
-o -name "*.gz" \
|
||||
-o -name "*mysql*" \
|
||||
\) -print
|
||||
|
||||
-- 删除 7 天前的日志文件
|
||||
find /data/docker/overlay2 -type f \( \
|
||||
-name "*.log" \
|
||||
-o -name "*.log.[0-9]*" \
|
||||
-o -name "*.log.[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" \
|
||||
\) -not \( \
|
||||
-name "mysql*.log*" \
|
||||
-o -name "*.idx" \
|
||||
-o -name "*.lck" \
|
||||
-o -name "*.js" \
|
||||
-o -name "*.yml" \
|
||||
-o -name "*.toml" \
|
||||
-o -name "*.gz" \
|
||||
-o -name "*mysql*" \
|
||||
\) -mtime +7 -delete
|
||||
```
|
||||
@ -40,6 +40,7 @@ public class LklLedgerMerReceiverBind implements Serializable {
|
||||
private String entrust_file_path;
|
||||
private String ret_url;
|
||||
private String apply_id;
|
||||
private Long platform_id;
|
||||
private String audit_status;
|
||||
private String audit_status_text;
|
||||
private String remark;
|
||||
|
||||
@ -46,6 +46,9 @@ public class LklOrderSeparate {
|
||||
@ApiModelProperty(value = "分账指令流水号,分账系统生成唯一流水")
|
||||
private String separate_no;
|
||||
|
||||
@ApiModelProperty(value = "平台订单Id")
|
||||
private String order_id;
|
||||
|
||||
@ApiModelProperty(value = "分账总金额,单位:分")
|
||||
private String total_amt;
|
||||
|
||||
|
||||
@ -0,0 +1,70 @@
|
||||
package com.suisung.mall.common.modules.order;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 关联拉卡拉的店铺订单信息
|
||||
* </p>
|
||||
*
|
||||
* @author Xinze
|
||||
* @since 2021-04-30
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("shop_order_lkl")
|
||||
@ApiModel(value = "ShopOrderLkl对象", description = "关联拉卡拉的店铺订单信息")
|
||||
public class ShopOrderLkl implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "自增Id")
|
||||
@TableId(value = "id", type = IdType.INPUT)
|
||||
private Long id;
|
||||
|
||||
private String store_id;
|
||||
|
||||
private String order_id;
|
||||
|
||||
private String log_no;
|
||||
|
||||
private String log_date;
|
||||
|
||||
private String merchant_no;
|
||||
|
||||
private Integer total_amt;
|
||||
|
||||
private Integer shopping_fee;
|
||||
|
||||
private BigDecimal split_ratio;
|
||||
|
||||
private String payment_time;
|
||||
|
||||
private String account_type;
|
||||
|
||||
private String trans_type;
|
||||
|
||||
private String lkl_trade_no;
|
||||
|
||||
private String lkl_term_no;
|
||||
|
||||
private String lkl_resp;
|
||||
|
||||
private Integer status;
|
||||
|
||||
private Date created_at;
|
||||
|
||||
private Date updated_at;
|
||||
}
|
||||
@ -246,6 +246,9 @@ public class ShopMchEntry implements Serializable {
|
||||
@ApiModelProperty(value = "是否签署电子合同:1-是;2-否;")
|
||||
private Integer has_ec_signed;
|
||||
|
||||
@ApiModelProperty(value = "是否进件成功:1-是;2-否;")
|
||||
private Integer has_apply_mer;
|
||||
|
||||
@ApiModelProperty(value = "是否申请分账业务:1-是;2-否;")
|
||||
private Integer has_apply_split;
|
||||
|
||||
|
||||
@ -140,6 +140,8 @@ public class CommonUtil {
|
||||
|
||||
/**
|
||||
* Double 四舍五入,不保留小数点
|
||||
* 2.5=3
|
||||
* 2.3=2
|
||||
*
|
||||
* @param d
|
||||
* @return
|
||||
@ -150,6 +152,8 @@ public class CommonUtil {
|
||||
|
||||
/**
|
||||
* Decimal 四舍五入,不保留小数点
|
||||
* 2.5=3
|
||||
* 2.3=2
|
||||
*
|
||||
* @param d
|
||||
* @return
|
||||
@ -158,6 +162,18 @@ public class CommonUtil {
|
||||
return d.setScale(0, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decimal 不四舍五入,不保留小数点
|
||||
* 2.5 = 2
|
||||
* 2.2 = 2
|
||||
*
|
||||
* @param d
|
||||
* @return
|
||||
*/
|
||||
public static BigDecimal DecimalRoundHalfDown(BigDecimal d) {
|
||||
return d.setScale(0, RoundingMode.HALF_DOWN);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据上一个订单状态和当前状态,获取订单状态变化备注
|
||||
|
||||
@ -1268,73 +1268,70 @@ public class PayUserPayServiceImpl extends BaseServiceImpl<PayUserPayMapper, Pay
|
||||
try {
|
||||
lakalaPayService.initLKLSDK();
|
||||
|
||||
// spring-boot 2.x 直接调用读取请求体并验签方法,返回请求体
|
||||
// 读取请求体并验签
|
||||
String body = LKLSDK.notificationHandle(request);
|
||||
String authorization = request.getHeader("Authorization");
|
||||
|
||||
if (StrUtil.isBlank(body)) {
|
||||
return lklNotifyMsg(false, "验签失败!");
|
||||
}
|
||||
// logger.debug("支付回调 body 数据:{}", body);
|
||||
|
||||
// 拉卡拉返回 json 格式的 数据
|
||||
// 敏感头信息脱敏打印
|
||||
logger.debug("拉卡拉支付异步通知回调 body:{} \n authorization: {}", body, authorization);
|
||||
|
||||
// 解析JSON格式响应
|
||||
params = Convert.toMap(String.class, String.class, JSONUtil.parseObj(body));
|
||||
String order_id = getParameter("out_trade_no");
|
||||
if (StrUtil.isBlank(order_id)) {
|
||||
order_id = params.getOrDefault("out_trade_no", "");
|
||||
}
|
||||
// logger.debug("支付回调 params 数据:{}", params);
|
||||
String order_id = params.getOrDefault("out_trade_no", "");
|
||||
|
||||
String authorization = request.getHeader("Authorization");
|
||||
// logger.debug("支付回调 Authorization 数据:{}", authorization);
|
||||
// 提取授权签名信息
|
||||
Map<String, String> authMap = LakalaUtil.getLakalaAuthorizationMap(authorization);
|
||||
if (authMap != null && authMap.get("signature") != null) {
|
||||
if (authMap != null && authMap.containsKey("signature")) {
|
||||
params.put("sign", authMap.get("signature"));
|
||||
} else {
|
||||
logger.error("缺少签名信息");
|
||||
return lklNotifyMsg(false, "缺少签名信息");
|
||||
}
|
||||
|
||||
// 基于安全考虑,检测支付模式及数据
|
||||
// 判断是门店 店铺 平台
|
||||
Integer payment_store_id = 0;
|
||||
Integer payment_chain_id = 0;
|
||||
String orderSubject = "";
|
||||
Integer userId = 0;
|
||||
|
||||
// 查询交易信息
|
||||
QueryWrapper<PayConsumeTrade> tradeQueryWrapper = new QueryWrapper<>();
|
||||
tradeQueryWrapper.eq("order_id", order_id);
|
||||
PayConsumeTrade trade_row_tmp = payConsumeTradeService.findOne(tradeQueryWrapper);
|
||||
if (trade_row_tmp != null) {
|
||||
payment_store_id = trade_row_tmp.getStore_id();
|
||||
orderSubject = trade_row_tmp.getTrade_title();
|
||||
userId = trade_row_tmp.getBuyer_id();
|
||||
}
|
||||
|
||||
Integer payment_store_id = trade_row_tmp != null ? trade_row_tmp.getStore_id() : 0;
|
||||
String orderSubject = trade_row_tmp != null ? trade_row_tmp.getTrade_title() : "";
|
||||
Integer userId = trade_row_tmp != null ? trade_row_tmp.getBuyer_id() : 0;
|
||||
|
||||
// 查询支付渠道
|
||||
QueryWrapper<PayPaymentChannel> channelQueryWrapper = new QueryWrapper<>();
|
||||
channelQueryWrapper.eq("payment_channel_code", "lakala");
|
||||
PayPaymentChannel payPaymentChannel = payPaymentChannelService.findOne(channelQueryWrapper);
|
||||
|
||||
if (payPaymentChannel == null) {
|
||||
logger.error("支付渠道不存在");
|
||||
return lklNotifyMsg(false, "支付渠道不存在");
|
||||
}
|
||||
Integer payment_channel_id = payPaymentChannel.getPayment_channel_id();
|
||||
|
||||
// 插入充值记录
|
||||
PayConsumeDeposit notify_row = createNotify(params, payPaymentChannel);
|
||||
notify_row.setOrder_id(order_id);
|
||||
notify_row.setStore_id(payment_store_id); // 所属店铺
|
||||
notify_row.setChain_id(payment_chain_id); // 所属门店
|
||||
notify_row.setPayment_channel_id(payment_channel_id);
|
||||
notify_row.setDeposit_subject(orderSubject);
|
||||
notify_row.setDeposit_body(orderSubject);
|
||||
notify_row.setUser_id(userId);
|
||||
// notify_row.setDeposit_state(1);// 支付状态:0-默认; 1-接收正确数据处理完逻辑; 9-异常订单
|
||||
// notify_row.setDeposit_async(0); // 是否同步:0-同步; 1-异步回调使用
|
||||
|
||||
|
||||
BigDecimal zero = BigDecimal.ZERO;
|
||||
PayConsumeDeposit payConsumeDeposit = createNotify(params, payPaymentChannel);
|
||||
payConsumeDeposit.setOrder_id(order_id);
|
||||
payConsumeDeposit.setStore_id(payment_store_id); // 所属店铺
|
||||
payConsumeDeposit.setChain_id(0); // 所属门店默认为0
|
||||
payConsumeDeposit.setPayment_channel_id(payment_channel_id);
|
||||
payConsumeDeposit.setDeposit_subject(orderSubject);
|
||||
payConsumeDeposit.setDeposit_body(orderSubject);
|
||||
payConsumeDeposit.setUser_id(userId);
|
||||
|
||||
// 判断是否联合支付
|
||||
PayConsumeTradeCombine tradeCombine = payConsumeTradeCombineService.get(order_id);
|
||||
TransactionStatus transactionStatus = transactionManager.getTransaction(transactionDefinition);
|
||||
try {
|
||||
if (tradeCombine != null && StrUtil.isNotBlank(tradeCombine.getOrder_ids())) {
|
||||
notify_row.setOrder_id(tradeCombine.getOrder_ids());
|
||||
payConsumeDeposit.setOrder_id(tradeCombine.getOrder_ids());
|
||||
}
|
||||
|
||||
if (!payConsumeDepositService.processDeposit(notify_row, zero, zero, zero, zero, zero)) {
|
||||
if (!payConsumeDepositService.processDeposit(payConsumeDeposit, BigDecimal.ZERO, BigDecimal.ZERO,
|
||||
BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO)) {
|
||||
log.error("支付失败!");
|
||||
return lklNotifyMsg(false, "支付失败!");
|
||||
}
|
||||
@ -1342,13 +1339,13 @@ public class PayUserPayServiceImpl extends BaseServiceImpl<PayUserPayMapper, Pay
|
||||
transactionManager.commit(transactionStatus);
|
||||
} catch (Exception e) {
|
||||
transactionManager.rollback(transactionStatus);
|
||||
log.error("支付失败,错误信息:", e);
|
||||
log.error("支付失败,错误信息:{}", e);
|
||||
throw new ApiException(e.getMessage());
|
||||
}
|
||||
|
||||
return lklNotifyMsg(true, "执行成功");
|
||||
} catch (Exception e) {
|
||||
logger.error("通知处理发生异常:" + e.getMessage() + ", {}", e);
|
||||
logger.error("通知处理发生异常:{}", e.getMessage(), e);
|
||||
return lklNotifyMsg(false, "通知处理发生异常!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -316,7 +316,7 @@ public class EsignContractServiceImpl extends BaseServiceImpl<EsignContractMappe
|
||||
}
|
||||
|
||||
// 更新商家的hasEsigned状态=1
|
||||
shopMchEntryService.updateMulStatus(esignContract.getMch_mobile(), "", 1, 0, 0, 0);
|
||||
shopMchEntryService.updateMulStatus(esignContract.getMch_mobile(), "", 1, 0, 0, 0, 0);
|
||||
|
||||
return new ResponseEntity<>(new JSONObject().put("code", 200).put("msg", "success").toString(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
package com.suisung.mall.shop.lakala.service;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.lkl.laop.sdk.request.V3SacsSeparateRequest;
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import org.springframework.data.util.Pair;
|
||||
|
||||
@ -180,7 +179,7 @@ public interface LakalaApiService {
|
||||
* @param bankCardNo
|
||||
* @return
|
||||
*/
|
||||
JSONObject getBankCardBin(String bankCardNo);
|
||||
CommonResult getBankCardBin(String bankCardNo);
|
||||
|
||||
|
||||
/**
|
||||
@ -190,7 +189,8 @@ public interface LakalaApiService {
|
||||
* @param merchantNo 拉卡拉外部商户号
|
||||
* @param logNo 拉卡拉对账单流水号
|
||||
* @param logDate 拉卡拉对账单交易日期 yyyyMMdd
|
||||
* @return 响应结果 {
|
||||
* @return 响应结果 分账总金额,可分账金额 键值对
|
||||
* {
|
||||
* "merchant_no": "82229005943096D",
|
||||
* "total_separate_amt": "9900",
|
||||
* "can_separate_amt": "0",
|
||||
@ -198,15 +198,24 @@ public interface LakalaApiService {
|
||||
* "log_no": "66210306990190"
|
||||
* }
|
||||
*/
|
||||
JSONObject queryMchCanSplitAmt(String merchantNo, String logNo, String logDate);
|
||||
Pair<String, String> queryMchCanSplitAmt(String merchantNo, String logNo, String logDate);
|
||||
|
||||
/**
|
||||
* 拉卡拉订单分账,用户下单成功之后,进行分账
|
||||
* 说明:分账指令是异步处理模式,响应报文成功时,指令状态是”status”: “PROCESSING”,需要等待分账结果通知,或者主动发起查询,建议主动发起查询与分账指令动作之间间隔15秒以上。
|
||||
* 参考:https://o.lakala.com/#/home/document/detail?id=389
|
||||
*
|
||||
* @param v3SacsSeparateRequest
|
||||
* @param orderId 平台订单号
|
||||
* @return
|
||||
*/
|
||||
Pair<Boolean, String> innerDoOrderSeparate(V3SacsSeparateRequest v3SacsSeparateRequest);
|
||||
Pair<Boolean, String> innerDoOrderSeparate(String orderId);
|
||||
|
||||
/**
|
||||
* 分账结果通知
|
||||
* 参考:https://o.lakala.com/#/home/document/detail?id=393
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
JSONObject sacsSeparateNotify(HttpServletRequest request);
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ public interface LklLedgerEcService extends IBaseService<LklLedgerEc> {
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
Boolean saveOrUpdateByMchId(LklLedgerEc record);
|
||||
Boolean addOrUpdateByMchId(LklLedgerEc record);
|
||||
|
||||
/**
|
||||
* 根据applyId更新记录
|
||||
|
||||
@ -36,7 +36,7 @@ public interface LklLedgerMemberService extends IBaseService<LklLedgerMember> {
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
Boolean saveOrUpdateByMerCupNo(LklLedgerMember record);
|
||||
Boolean addOrUpdateByMerCupNo(LklLedgerMember record);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -11,6 +11,8 @@ package com.suisung.mall.shop.lakala.service;
|
||||
import com.suisung.mall.common.modules.lakala.LklLedgerMerReceiverBind;
|
||||
import com.suisung.mall.core.web.service.IBaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface LklLedgerMerReceiverBindService extends IBaseService<LklLedgerMerReceiverBind> {
|
||||
|
||||
/**
|
||||
@ -19,10 +21,10 @@ public interface LklLedgerMerReceiverBindService extends IBaseService<LklLedgerM
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
Boolean saveOrUpdateByMerCupNoReceiverNo(LklLedgerMerReceiverBind record);
|
||||
Boolean addOrUpdateByMerCupNoReceiverNo(LklLedgerMerReceiverBind record);
|
||||
|
||||
/**
|
||||
* 根据接收方编号查询记录
|
||||
* 根据商户编号和接收方编号查询一条记录
|
||||
*
|
||||
* @param merCupNo
|
||||
* @param receiverNo
|
||||
@ -30,6 +32,33 @@ public interface LklLedgerMerReceiverBindService extends IBaseService<LklLedgerM
|
||||
*/
|
||||
LklLedgerMerReceiverBind getByCondition(String merCupNo, String receiverNo);
|
||||
|
||||
|
||||
/**
|
||||
* 根据商户编号查询多条记录
|
||||
*
|
||||
* @param merCupNo
|
||||
* @param isPlatform
|
||||
* @return
|
||||
*/
|
||||
List<LklLedgerMerReceiverBind> selectListByMerCupNo(String merCupNo, Boolean isPlatform);
|
||||
|
||||
|
||||
/**
|
||||
* 根据商户编号查询一条平台绑定记录
|
||||
*
|
||||
* @param merCupNo
|
||||
* @return
|
||||
*/
|
||||
LklLedgerMerReceiverBind getPlatformByMerCupNo(String merCupNo);
|
||||
|
||||
/**
|
||||
* 根据商户编号查询一条代理商绑定记录
|
||||
*
|
||||
* @param merCupNo
|
||||
* @return
|
||||
*/
|
||||
List<LklLedgerMerReceiverBind> selectDistributorByMerCupNo(String merCupNo);
|
||||
|
||||
/**
|
||||
* 更新审核结果
|
||||
*
|
||||
|
||||
@ -22,7 +22,7 @@ public interface LklLedgerReceiverService extends IBaseService<LklLedgerReceiver
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
Boolean saveOrUpdateByReceiverNo(LklLedgerReceiver record);
|
||||
Boolean addOrUpdateByReceiverNo(LklLedgerReceiver record);
|
||||
|
||||
/**
|
||||
* 根据接收方编号查询记录
|
||||
@ -82,4 +82,14 @@ public interface LklLedgerReceiverService extends IBaseService<LklLedgerReceiver
|
||||
* @return
|
||||
*/
|
||||
List<LklLedgerReceiver> getByCondition(String LicenseNo, String ContactMobile);
|
||||
|
||||
/**
|
||||
* 根据条件查询记录数量
|
||||
*
|
||||
* @param LicenseNo
|
||||
* @param ContactMobile
|
||||
* @param platformId
|
||||
* @return
|
||||
*/
|
||||
Long countByCondition(String LicenseNo, String ContactMobile, Long platformId);
|
||||
}
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
|
||||
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
|
||||
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
|
||||
* Vestibulum commodo. Ut rhoncus gravida arcu.
|
||||
*/
|
||||
|
||||
package com.suisung.mall.shop.lakala.service;
|
||||
|
||||
import com.suisung.mall.common.modules.lakala.LklOrderSeparate;
|
||||
import com.suisung.mall.core.web.service.IBaseService;
|
||||
|
||||
public interface LklOrderSeparateService extends IBaseService<LklOrderSeparate> {
|
||||
|
||||
/**
|
||||
* 新增或更新记录
|
||||
*
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
Boolean addOrUpdateByReceiverNo(LklOrderSeparate record);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -47,7 +47,7 @@ public class LklLedgerEcServiceImpl extends BaseServiceImpl<LklLedgerEcMapper, L
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean saveOrUpdateByMchId(LklLedgerEc record) {
|
||||
public Boolean addOrUpdateByMchId(LklLedgerEc record) {
|
||||
if (record == null || (ObjectUtil.isEmpty(record.getMch_id()) && StrUtil.isBlank(record.getMch_mobile()))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ public class LklLedgerMemberServiceImpl extends BaseServiceImpl<LklLedgerMemberM
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean saveOrUpdateByMerCupNo(LklLedgerMember record) {
|
||||
public Boolean addOrUpdateByMerCupNo(LklLedgerMember record) {
|
||||
if (record == null || StrUtil.isBlank(record.getMer_cup_no())) {
|
||||
return false;
|
||||
}
|
||||
@ -123,5 +123,5 @@ public class LklLedgerMemberServiceImpl extends BaseServiceImpl<LklLedgerMemberM
|
||||
|
||||
return update(updateWrapper);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ public class LklLedgerMerReceiverBindServiceImpl extends BaseServiceImpl<LklLedg
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean saveOrUpdateByMerCupNoReceiverNo(LklLedgerMerReceiverBind record) {
|
||||
public Boolean addOrUpdateByMerCupNoReceiverNo(LklLedgerMerReceiverBind record) {
|
||||
if (record == null || StrUtil.isBlank(record.getMer_cup_no()) || StrUtil.isBlank(record.getReceiver_no())) {
|
||||
return false;
|
||||
}
|
||||
@ -51,6 +51,14 @@ public class LklLedgerMerReceiverBindServiceImpl extends BaseServiceImpl<LklLedg
|
||||
return add(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据商户编号和接收方编号查询一条记录
|
||||
*
|
||||
* @param merCupNo
|
||||
* @param receiverNo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public LklLedgerMerReceiverBind getByCondition(String merCupNo, String receiverNo) {
|
||||
if (StrUtil.isBlank(merCupNo) || StrUtil.isBlank(receiverNo)) {
|
||||
return null;
|
||||
@ -61,10 +69,68 @@ public class LklLedgerMerReceiverBindServiceImpl extends BaseServiceImpl<LklLedg
|
||||
.eq("receiver_no", receiverNo)
|
||||
.eq("audit_status", CommonConstant.Enable);
|
||||
|
||||
|
||||
return getOne(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据商户编号查询多条平台或代理商记录
|
||||
*
|
||||
* @param merCupNo
|
||||
* @param isPlatform 是否平台
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<LklLedgerMerReceiverBind> selectListByMerCupNo(String merCupNo, Boolean isPlatform) {
|
||||
if (StrUtil.isBlank(merCupNo)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
QueryWrapper<LklLedgerMerReceiverBind> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("mer_cup_no", merCupNo)
|
||||
.eq("audit_status", CommonConstant.Enable);
|
||||
if (isPlatform != null && isPlatform) {
|
||||
queryWrapper.eq("platform_id", 0);
|
||||
} else if (isPlatform != null && !isPlatform) {
|
||||
queryWrapper.gt("platform_id", 0);
|
||||
}
|
||||
|
||||
queryWrapper.orderByAsc("id");
|
||||
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据商户编号查询一条平台绑定记录
|
||||
*
|
||||
* @param merCupNo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public LklLedgerMerReceiverBind getPlatformByMerCupNo(String merCupNo) {
|
||||
List<LklLedgerMerReceiverBind> list = selectListByMerCupNo(merCupNo, true);
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据商户编号查询一条代理商绑定记录
|
||||
*
|
||||
* @param merCupNo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<LklLedgerMerReceiverBind> selectDistributorByMerCupNo(String merCupNo) {
|
||||
List<LklLedgerMerReceiverBind> list = selectListByMerCupNo(merCupNo, false);
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新审核结果
|
||||
*
|
||||
@ -111,7 +177,7 @@ public class LklLedgerMerReceiverBindServiceImpl extends BaseServiceImpl<LklLedg
|
||||
if (StrUtil.isNotBlank(remark)) {
|
||||
updateWrapper.set("remark", remark);
|
||||
}
|
||||
|
||||
|
||||
return update(updateWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ public class LklLedgerReceiverServiceImpl extends BaseServiceImpl<LklLedgerRecei
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean saveOrUpdateByReceiverNo(LklLedgerReceiver record) {
|
||||
public Boolean addOrUpdateByReceiverNo(LklLedgerReceiver record) {
|
||||
if (record == null || (StrUtil.isBlank(record.getLicense_no()) && StrUtil.isBlank(record.getContact_mobile()))) {
|
||||
return false;
|
||||
}
|
||||
@ -210,6 +210,7 @@ public class LklLedgerReceiverServiceImpl extends BaseServiceImpl<LklLedgerRecei
|
||||
/**
|
||||
* 内部调用:申请一个或多个分账接收方(平台方和代理商)
|
||||
*
|
||||
* @param merCupNo 用于标记接收方绑定merCupNo商家
|
||||
* @param platformId
|
||||
* @return
|
||||
*/
|
||||
@ -218,7 +219,7 @@ public class LklLedgerReceiverServiceImpl extends BaseServiceImpl<LklLedgerRecei
|
||||
// 接收方至少有一个平台方
|
||||
JSONArray buildApplyLedgerReceiverReqParams = buildApplyLedgerReceiverReqParams(platformId);
|
||||
if (buildApplyLedgerReceiverReqParams == null || buildApplyLedgerReceiverReqParams.isEmpty()) {
|
||||
log.error("获取不到平台或代理商信息");
|
||||
log.error("先新增平台或代理商信息");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -237,7 +238,7 @@ public class LklLedgerReceiverServiceImpl extends BaseServiceImpl<LklLedgerRecei
|
||||
boolean success = successCnt > 0;
|
||||
if (success) {
|
||||
// 更新多个状态
|
||||
shopMchEntryService.updateMulStatus("", merCupNo, 0, 0, 1, 0);
|
||||
shopMchEntryService.updateMulStatus("", merCupNo, 0, 0, 1, 0, 0);
|
||||
}
|
||||
|
||||
return success;
|
||||
@ -311,4 +312,31 @@ public class LklLedgerReceiverServiceImpl extends BaseServiceImpl<LklLedgerRecei
|
||||
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询记录数量
|
||||
*
|
||||
* @param LicenseNo
|
||||
* @param ContactMobile
|
||||
* @param platformId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Long countByCondition(String LicenseNo, String ContactMobile, Long platformId) {
|
||||
QueryWrapper<LklLedgerReceiver> queryWrapper = new QueryWrapper<>();
|
||||
if (StrUtil.isNotBlank(LicenseNo)) {
|
||||
queryWrapper.eq("license_no", LicenseNo);
|
||||
}
|
||||
if (StrUtil.isNotBlank(ContactMobile)) {
|
||||
queryWrapper.eq("contact_mobile", ContactMobile);
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(platformId) && platformId > 0) {
|
||||
queryWrapper.eq("platform_id", platformId);
|
||||
}
|
||||
|
||||
queryWrapper.eq("status", CommonConstant.Enable);
|
||||
|
||||
return count(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
|
||||
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
|
||||
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
|
||||
* Vestibulum commodo. Ut rhoncus gravida arcu.
|
||||
*/
|
||||
|
||||
package com.suisung.mall.shop.lakala.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.suisung.mall.common.modules.lakala.LklOrderSeparate;
|
||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||
import com.suisung.mall.shop.lakala.mapper.LklOrderSeparateMapper;
|
||||
import com.suisung.mall.shop.lakala.service.LklOrderSeparateService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class LklOrderSeparateServiceImpl extends BaseServiceImpl<LklOrderSeparateMapper, LklOrderSeparate> implements LklOrderSeparateService {
|
||||
|
||||
/**
|
||||
* 新增或更新记录(根据out_separate_no 和 separate_no 更新记录)
|
||||
*
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean addOrUpdateByReceiverNo(LklOrderSeparate record) {
|
||||
if (record == null || (StrUtil.isBlank(record.getOut_separate_no()) && StrUtil.isBlank(record.getSeparate_no()))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
QueryWrapper<LklOrderSeparate> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("separate_no", record.getSeparate_no()).eq("out_separate_no", record.getOut_separate_no());
|
||||
if (StrUtil.isNotBlank(record.getSeparate_no())) {
|
||||
queryWrapper.eq("log_no", record.getLog_no());
|
||||
}
|
||||
LklOrderSeparate existsRecord = getOne(queryWrapper);
|
||||
if (existsRecord != null && existsRecord.getId() > 0) {
|
||||
// 更新记录
|
||||
record.setId(existsRecord.getId());
|
||||
return updateById(record);
|
||||
}
|
||||
|
||||
return add(record);
|
||||
}
|
||||
}
|
||||
@ -510,8 +510,9 @@ public class LklTkServiceImpl {
|
||||
}
|
||||
|
||||
JSONObject respBody = response.getBody();
|
||||
logger.debug("进件返回结果:{}", respBody);
|
||||
if (response.getStatusCode() != HttpStatus.OK && ObjectUtil.isNotEmpty(respBody)) {
|
||||
String errMsg = respBody.getStr("message") == null ? "返回状态有误" : respBody.getStr("message");
|
||||
String errMsg = respBody.getStr("message") == null ? "未知错误" : respBody.getStr("message");
|
||||
return Pair.of(false, "进件失败:" + errMsg);
|
||||
}
|
||||
|
||||
@ -544,6 +545,7 @@ public class LklTkServiceImpl {
|
||||
// 解密请求参数
|
||||
String requestBody = LakalaUtil.getBody(request);
|
||||
logger.debug("拉卡拉进件异步通知返回参数:{}", requestBody);
|
||||
|
||||
if (StrUtil.isBlank(requestBody)) {
|
||||
return new JSONObject().set("code", "400").set("message", "返回参数为空");
|
||||
}
|
||||
@ -562,39 +564,44 @@ public class LklTkServiceImpl {
|
||||
String notifyPubKey = LakalaUtil.getResourceFile(notifyPubKeyPath, false, false);
|
||||
String data = LakalaUtil.decryptNotifyData(notifyPubKey, srcData);
|
||||
if (StrUtil.isBlank(data)) {
|
||||
return new JSONObject().set("code", "400").set("message", "密文解密出错!");
|
||||
return new JSONObject().set("code", "400").set("message", "数据解密出错!");
|
||||
}
|
||||
|
||||
logger.debug("拉卡拉进件异步通知data解密成功,开始处理逻辑");
|
||||
|
||||
// 逻辑处理
|
||||
JSONObject dataJSON = JSONUtil.parseObj(data);
|
||||
if (dataJSON.isEmpty() || StrUtil.isBlank(dataJSON.getStr("externalCustomerNo")) || StrUtil.isBlank(dataJSON.getStr("status"))) {
|
||||
String auditStatus = dataJSON.getStr("status");
|
||||
String merCupNo = dataJSON.getStr("externalCustomerNo"); //拉卡拉外部商户号
|
||||
String merInnerNo = dataJSON.getStr("customerNo"); //拉卡拉内部商户号
|
||||
String termNos = dataJSON.getStr("termNos"); //拉卡拉分配的业务终端号
|
||||
|
||||
// 合并参数校验,减少嵌套
|
||||
if (dataJSON.isEmpty() ||
|
||||
StrUtil.isBlank(auditStatus) ||
|
||||
StrUtil.isBlank(merCupNo) ||
|
||||
StrUtil.isBlank(merInnerNo)) {
|
||||
return new JSONObject().set("code", "500").set("message", "参数解析出错");
|
||||
}
|
||||
|
||||
String auditStatus = dataJSON.getStr("status");
|
||||
// 校验审核状态
|
||||
if (!"SUCCESS".equals(auditStatus) && !"REVIEW_PASS".equals(auditStatus)) {
|
||||
logger.debug("返回的审核状态:{}", auditStatus);
|
||||
return new JSONObject().set("code", "FAIL").set("message", "返回审核状态有误");
|
||||
}
|
||||
|
||||
// RMK 拉卡拉进价提交成功,边处理周边的数据,边等待审核异步通知
|
||||
|
||||
// 给商家入驻表增加拉卡拉的商户号和拉卡拉返回的数据
|
||||
String merCupNo = dataJSON.getStr("externalCustomerNo"); //拉卡拉外部商户号
|
||||
String merInnerNo = dataJSON.getStr("customerNo"); //拉卡拉内部商户号
|
||||
String termNos = dataJSON.getStr("termNos"); //拉卡拉分配的业务终端号
|
||||
if (StrUtil.isBlank(merInnerNo) || StrUtil.isBlank(merCupNo)) {
|
||||
return new JSONObject().set("code", "500").set("message", "返回数据有误");
|
||||
}
|
||||
|
||||
ShopMchEntry shopMchEntry = shopMchEntryService.getShopMerchEntryByMerInnerNo(merInnerNo);
|
||||
if (ObjectUtil.isEmpty(shopMchEntry)) {
|
||||
logger.error("拉卡拉进件异步通知:返回的内部商户号:{} 入驻信息不存在!", merInnerNo);
|
||||
return new JSONObject().put("code", "500").put("message", "内部商户号:" + merInnerNo + " 入驻信息不存在");
|
||||
logger.error("拉卡拉进件异步通知:{}内部商户号入驻信息不存在!", merInnerNo);
|
||||
return new JSONObject().put("code", "500").put("message", merInnerNo + "内部商户号入驻信息不存在");
|
||||
}
|
||||
|
||||
Boolean success = shopMchEntryService.updateMerchEntryLklAuditStatusByLklMerCupNo(merInnerNo, merCupNo, termNos, CommonConstant.Enable, null, data);
|
||||
Boolean success = shopMchEntryService.updateMerchEntryLklAuditStatusByLklMerCupNo(
|
||||
merInnerNo, merCupNo, termNos, CommonConstant.Enable, null, data);
|
||||
|
||||
if (!success) {
|
||||
return new JSONObject().set("code", "500").set("message", "更新商户号失败");
|
||||
// throw new ApiException("更新商户号失败");
|
||||
@ -618,11 +625,13 @@ public class LklTkServiceImpl {
|
||||
if (success && StrUtil.isNotBlank(shopMchEntry.getContract_download_url())) {
|
||||
|
||||
// TODO 新建一个正式的已审核通过的店铺, 新建之前判断是否已经新建过了?
|
||||
// 新建一个正式的已审核通过的店铺
|
||||
// ShopMchEntry shopEntry = shopMchEntryService.getShopMerchEntryByMerCupNo(merCupNo);
|
||||
// 新建一个正式的已审核通过的店铺,不要抛异常,使用补偿机制,可以独立初始化店铺
|
||||
ShopMchEntry shopEntry = shopMchEntryService.getShopMerchEntryByMerCupNo(merCupNo);
|
||||
// if (shopEntry != null && !CommonConstant.Enable.equals(shopEntry.getStore_status())) {
|
||||
// String mchMobile = shopEntry.getLogin_mobile();
|
||||
// Pair<Integer, String> retPair = shopStoreBaseService.merchEntryInfo2StoreInfo(mchMobile);
|
||||
// // 禁止往外抛异常,如果失败使用补偿机制,创建新店
|
||||
// Pair<Integer, String> retPair = shopStoreBaseService.merchEntryInfo2StoreInfo(mchMobile, false);
|
||||
//
|
||||
// if (retPair.getFirst() > 0) {
|
||||
// // 2025-05-17暂停e签宝电子合同生成流程
|
||||
// // 更改合同记录表的店铺id
|
||||
@ -631,8 +640,10 @@ public class LklTkServiceImpl {
|
||||
// // esignContractFillingFileService.updateContractFillingStoreId(mchMobile, retPair.getFirst());
|
||||
// // 店铺创建状态已完成
|
||||
// shopMchEntryService.updateMerchEntryStoreStatus(mchMobile, CommonConstant.Enable);
|
||||
// logger.info("商家进件:初始化店铺成功!");
|
||||
// } else {
|
||||
// throw new ApiException("商家进件:初始化店铺失败!");
|
||||
// logger.error("商家进件:初始化店铺失败!");
|
||||
// // throw new ApiException("商家进件:初始化店铺失败!");
|
||||
// }
|
||||
// }
|
||||
|
||||
@ -643,6 +654,7 @@ public class LklTkServiceImpl {
|
||||
// 2:新增一个接收方记录,起码要一个平台方,代理商根据入驻信息新增
|
||||
Boolean genSuccess = lklLedgerReceiverService.innerApplyLedgerReceiver(merCupNo, shopMchEntry.getDistributor_id());
|
||||
|
||||
// 统一处理分账申请结果
|
||||
if (retPair.getFirst() && genSuccess) {
|
||||
return new JSONObject().put("code", "200").put("message", "处理成功");
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ import com.suisung.mall.common.utils.StringUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.data.util.Pair;
|
||||
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.Cipher;
|
||||
@ -403,4 +404,26 @@ public class LakalaUtil {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉卡拉异步回调通知,签名验证公共方法
|
||||
*
|
||||
* @param request
|
||||
* @param lklNotifyCerPath
|
||||
* @return 验签成功,返回解密后的json字符串,验签失败,返回错误信息
|
||||
*/
|
||||
public static Pair<Boolean, String> chkLklApiNotifySign(HttpServletRequest request, String lklNotifyCerPath) {
|
||||
// 验签
|
||||
String authorization = request.getHeader("Authorization");
|
||||
String requestBody = getBody(request);
|
||||
log.debug("{} 回调通知 requestbody 参数:{}\n authorization参数:{}\n", request.getRequestURL(), requestBody, authorization);
|
||||
|
||||
boolean checkSuccess = LakalaUtil.verify(authorization, requestBody, lklNotifyCerPath);
|
||||
if (!checkSuccess) {
|
||||
log.error("{} 回调通知验签失败", request.getRequestURL());
|
||||
return Pair.of(false, "验签失败!");
|
||||
}
|
||||
|
||||
return Pair.of(true, requestBody);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
|
||||
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
|
||||
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
|
||||
* Vestibulum commodo. Ut rhoncus gravida arcu.
|
||||
*/
|
||||
|
||||
package com.suisung.mall.shop.order.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.suisung.mall.common.modules.order.ShopOrderLkl;
|
||||
|
||||
public interface ShopOrderLklMapper extends BaseMapper<ShopOrderLkl> {
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
|
||||
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
|
||||
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
|
||||
* Vestibulum commodo. Ut rhoncus gravida arcu.
|
||||
*/
|
||||
|
||||
package com.suisung.mall.shop.order.service;
|
||||
|
||||
import com.suisung.mall.common.modules.order.ShopOrderLkl;
|
||||
import com.suisung.mall.core.web.service.IBaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ShopOrderLklService extends IBaseService<ShopOrderLkl> {
|
||||
|
||||
/**
|
||||
* 添加或更新记录
|
||||
*
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
Boolean addOrUpdateByStoreOrder(ShopOrderLkl record);
|
||||
|
||||
/**
|
||||
* 根据订单编号查询多条记录(因为一个订单里可能有多个店铺的商品)
|
||||
*
|
||||
* @param orderId
|
||||
* @param storeId
|
||||
* @return
|
||||
*/
|
||||
List<ShopOrderLkl> selectByOrderId(String orderId, String storeId);
|
||||
}
|
||||
@ -2743,7 +2743,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
}
|
||||
}
|
||||
|
||||
List<ShopOrderInfo> order_rows = null;
|
||||
List<ShopOrderInfo> order_rows;
|
||||
List<String> review_id_row = new ArrayList<>();
|
||||
// 检测数据是否合法,过滤允许修改的数据
|
||||
if (CollUtil.isNotEmpty(order_ids)) {
|
||||
@ -2821,7 +2821,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
Integer store_id = order_row.getStore_id();
|
||||
|
||||
// 判断是否可以读取到下一个状态,如果读不到,则为订货系统使用,可以不支付直接处理发货流程
|
||||
Integer order_next_state_id = null;
|
||||
Integer order_next_state_id;
|
||||
|
||||
// 虚拟设置为StateCode.ORDER_STATE_SHIPPED 待收货状态
|
||||
Integer kind_id = order_row.getKind_id();
|
||||
|
||||
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
|
||||
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
|
||||
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
|
||||
* Vestibulum commodo. Ut rhoncus gravida arcu.
|
||||
*/
|
||||
|
||||
package com.suisung.mall.shop.order.service.impl;
|
||||
|
||||
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.order.ShopOrderLkl;
|
||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||
import com.suisung.mall.shop.order.mapper.ShopOrderLklMapper;
|
||||
import com.suisung.mall.shop.order.service.ShopOrderLklService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ShopOrderLklServiceImpl extends BaseServiceImpl<ShopOrderLklMapper, ShopOrderLkl> implements ShopOrderLklService {
|
||||
|
||||
@Override
|
||||
public Boolean addOrUpdateByStoreOrder(ShopOrderLkl record) {
|
||||
if (record == null
|
||||
|| StringUtils.isAnyBlank(record.getOrder_id(), record.getStore_id(), record.getLog_no())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<ShopOrderLkl> existsRecordList = selectByOrderId(record.getOrder_id(), record.getStore_id());
|
||||
if (CollectionUtil.isNotEmpty(existsRecordList)
|
||||
&& existsRecordList.get(0) != null
|
||||
&& existsRecordList.get(0).getId() > 0) {
|
||||
// 更新记录
|
||||
record.setId(existsRecordList.get(0).getId());
|
||||
return updateById(record);
|
||||
}
|
||||
|
||||
return add(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单编号查询多条记录(因为一个订单里可能有多个店铺的商品)
|
||||
*
|
||||
* @param orderId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<ShopOrderLkl> selectByOrderId(String orderId, String storeId) {
|
||||
if (StringUtils.isBlank(orderId)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
QueryWrapper<ShopOrderLkl> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("order_id", orderId).orderByAsc("id");
|
||||
if (StrUtil.isNotBlank(storeId)) {
|
||||
queryWrapper.eq("store_id", storeId);
|
||||
}
|
||||
|
||||
return list(queryWrapper);
|
||||
}
|
||||
}
|
||||
@ -254,7 +254,7 @@ public class ShopStoreBaseController extends BaseControllerImpl {
|
||||
@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"));
|
||||
Pair<Integer, String> result = shopStoreBaseService.merchEntryInfo2StoreInfo(jsonParam.getStr("mchMobile"), true);
|
||||
if (result.getFirst().equals(0)) {
|
||||
return CommonResult.failed(result.getSecond());
|
||||
}
|
||||
|
||||
@ -213,8 +213,9 @@ public interface ShopMchEntryService {
|
||||
* @param hasApplySplit
|
||||
* @param hasApplyReceiver
|
||||
* @param hasBindReceiver
|
||||
* @param hasApplyMer
|
||||
* @return
|
||||
*/
|
||||
Boolean updateMulStatus(String mchMobile, String merCupNo, Integer hasEcSigned, Integer hasApplySplit, Integer hasApplyReceiver, Integer hasBindReceiver);
|
||||
Boolean updateMulStatus(String mchMobile, String merCupNo, Integer hasEcSigned, Integer hasApplySplit, Integer hasApplyReceiver, Integer hasBindReceiver, Integer hasApplyMer);
|
||||
|
||||
}
|
||||
@ -141,9 +141,10 @@ public interface ShopStoreBaseService extends IBaseService<ShopStoreBase> {
|
||||
* (重要)入驻审批通过并且合同盖章完结之后,把商家入驻信息转换成店铺信息,正式生成店铺所需的数据
|
||||
*
|
||||
* @param mchMobile
|
||||
* @param allowThrown 是否允许抛出异常
|
||||
* @return 店铺Id
|
||||
*/
|
||||
Pair<Integer, String> merchEntryInfo2StoreInfo(String mchMobile);
|
||||
Pair<Integer, String> merchEntryInfo2StoreInfo(String mchMobile, Boolean allowThrown);
|
||||
|
||||
/**
|
||||
* 根据店铺名称判断店铺是否存在
|
||||
|
||||
@ -247,7 +247,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
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
|
||||
shopMessageTemplateService.aliyunSmsSend(mobileAndLicenseNumber.getFirst(), "SMS_486545331", tmplArgs);//SMS_479760276
|
||||
}
|
||||
|
||||
return CommonResult.success();
|
||||
@ -847,6 +847,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
UpdateWrapper<ShopMchEntry> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("lkl_mer_inner_no", lklInnerMerNo);
|
||||
|
||||
updateWrapper.set("has_apply_mer", CommonConstant.Enable); // 是否进件成功:1-是;2-否;
|
||||
if (StrUtil.isNotBlank(lklMerCupNo)) {
|
||||
updateWrapper.set("lkl_mer_cup_no", lklMerCupNo);
|
||||
}
|
||||
@ -974,11 +975,12 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
* @param hasApplySplit
|
||||
* @param hasApplyReceiver
|
||||
* @param hasBindReceiver
|
||||
* @param hasApplyMer
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateMulStatus(String mchMobile, String merCupNo, Integer hasEcSigned,
|
||||
Integer hasApplySplit, Integer hasApplyReceiver, Integer hasBindReceiver) {
|
||||
Integer hasApplySplit, Integer hasApplyReceiver, Integer hasBindReceiver, Integer hasApplyMer) {
|
||||
// 参数校验
|
||||
if (StrUtil.isAllBlank(merCupNo, mchMobile)) {
|
||||
log.error("缺少merCupNo或mchMobile参数");
|
||||
@ -1000,6 +1002,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
fieldMap.put("has_apply_split", hasApplySplit);
|
||||
fieldMap.put("has_apply_receiver", hasApplyReceiver);
|
||||
fieldMap.put("has_bind_receiver", hasBindReceiver);
|
||||
fieldMap.put("has_apply_mer", hasApplyMer);
|
||||
|
||||
// 过滤有效字段并设置
|
||||
fieldMap.entrySet().stream()
|
||||
|
||||
@ -2991,21 +2991,22 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
||||
* (重要)入驻审批通过并且合同盖章完结之后,把商家入驻信息转换成店铺信息,正式生成店铺所需的数据
|
||||
*
|
||||
* @param mchMobile
|
||||
* @param allowThrown 是否允许抛出异常?
|
||||
* @return 店铺Id
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public Pair<Integer, String> merchEntryInfo2StoreInfo(String mchMobile) {
|
||||
public Pair<Integer, String> merchEntryInfo2StoreInfo(String mchMobile, Boolean allowThrown) {
|
||||
if (StrUtil.isBlank(mchMobile)) {
|
||||
logger.error("生成店铺:商家手机号不能为空");
|
||||
return Pair.of(0, "商家手机号不能为空");
|
||||
return Pair.of(0, "商家手机不能为空");
|
||||
}
|
||||
|
||||
// 从绑定关系中,获取商家注册账号信息
|
||||
Integer userId = accountService.getUserBindConnectUserIdByCondition(mchMobile, BindCode.MOBILE, CommonConstant.USER_TYPE_MCH);
|
||||
if (userId == null) {
|
||||
logger.error("生成店铺:绑定关系中获取不到该手机{}商家的账号", mchMobile);
|
||||
return Pair.of(0, "商家账号异常!");
|
||||
return Pair.of(0, "该商家手机未注册账号!");
|
||||
}
|
||||
|
||||
ShopMchEntry shopMchEntry = shopMchEntryService.getShopMerchEntryByCondition(mchMobile, "");
|
||||
@ -3019,6 +3020,17 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
||||
return Pair.of(0, "店铺名称已存在");
|
||||
}
|
||||
|
||||
// 校验店铺状态,
|
||||
if (CommonConstant.Enable.equals(shopMchEntry.getStore_status())) {
|
||||
return Pair.of(0, "操作失败,检查店铺是否已创建完成?");
|
||||
}
|
||||
|
||||
if (!CommonConstant.Enable.equals(shopMchEntry.getStore_status())
|
||||
&& !CommonConstant.Enable.equals(shopMchEntry.getHas_ec_signed())
|
||||
&& !CommonConstant.Enable.equals(shopMchEntry.getHas_apply_mer())) {
|
||||
return Pair.of(0, "前置条件为满足,请检查电子合同或申请进件状态");
|
||||
}
|
||||
|
||||
try {
|
||||
// 新增 shop_store_base,shop_store_info,shop_store_company, shop_store_employee 待补充
|
||||
|
||||
@ -3060,7 +3072,10 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
||||
shopStoreBase.setStore_end_time(System.currentTimeMillis() + 1000L * 60 * 60 * 24 * 365 * 5); // 5年
|
||||
if (!save(shopStoreBase)) {
|
||||
logger.error("生成店铺:新增店铺基本信息失败");
|
||||
throw new ApiException(I18nUtil._("新增店铺失败"));
|
||||
if (allowThrown) {
|
||||
throw new ApiException(I18nUtil._("新增店铺基础信息失败"));
|
||||
}
|
||||
return Pair.of(0, "新增店铺基础信息失败");
|
||||
}
|
||||
|
||||
// 保存后店铺Id
|
||||
@ -3099,7 +3114,10 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
||||
shopStoreInfo.setStore_state_id(StateCode.STORE_STATE_YES);
|
||||
if (!shopStoreInfoService.save(shopStoreInfo)) {
|
||||
logger.error("生成店铺:新增店铺info失败");
|
||||
throw new ApiException(I18nUtil._("新增店铺失败"));
|
||||
if (allowThrown) {
|
||||
throw new ApiException(I18nUtil._("新增店铺信息失败"));
|
||||
}
|
||||
return Pair.of(0, "新增店铺信息失败");
|
||||
}
|
||||
|
||||
// 初始化默认公司信息,避免商家编辑不了,申请入驻即使是个人类型的,也需要保存相关应有信息,公司信息不能空着
|
||||
@ -3146,7 +3164,11 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
||||
|
||||
if (!shopStoreCompanyService.save(shopStoreCompany)) {
|
||||
logger.error("生成店铺:新增店铺公司失败");
|
||||
throw new ApiException(I18nUtil._("新增店铺公司失败"));
|
||||
if (allowThrown) {
|
||||
throw new ApiException(I18nUtil._("新增店铺公司失败"));
|
||||
}
|
||||
|
||||
return Pair.of(0, "新增店铺公司失败");
|
||||
}
|
||||
|
||||
// shop_store_employee 店铺员工,添加管理员
|
||||
@ -3159,7 +3181,11 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
||||
shopStoreEmployeeService.save(shopStoreEmployee);
|
||||
if (!shopStoreEmployeeService.save(shopStoreEmployee)) {
|
||||
logger.error("生成店铺:新增店铺员工失败");
|
||||
throw new ApiException(I18nUtil._("新增店铺员工失败"));
|
||||
if (allowThrown) {
|
||||
throw new ApiException(I18nUtil._("新增店铺员工失败"));
|
||||
}
|
||||
|
||||
return Pair.of(0, "新增店铺员工失败");
|
||||
}
|
||||
|
||||
// 生成店铺的太阳码 2025-03-31
|
||||
@ -3178,8 +3204,11 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
||||
|
||||
return Pair.of(storeId, "新增成功");
|
||||
} catch (Exception e) {
|
||||
logger.error("生成店铺失败", e);
|
||||
return Pair.of(0, I18nUtil._("新增店铺失败"));
|
||||
logger.error("店铺生成失败", e);
|
||||
if (allowThrown) {
|
||||
throw new ApiException(I18nUtil._("新增店铺失败"));
|
||||
}
|
||||
return Pair.of(0, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.suisung.mall.shop.order.mapper.ShopOrderLklMapper">
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
*
|
||||
</sql>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user