36 Commits

Author SHA1 Message Date
6b3fb08036 打印 单价 2026-01-17 11:24:44 +08:00
484ffb07e5 多余 controller 2026-01-17 10:32:10 +08:00
e9ef1b0fac 支付参数 2026-01-17 10:25:19 +08:00
04be17d63e 暂时限制开通 2026-01-17 09:55:05 +08:00
21da0a344c Merge branch 'test' into prod
# Conflicts:
#	cash-api/account-server/src/main/java/com/czg/controller/admin/AuthorizationController.java
#	cash-api/order-server/src/main/java/com/czg/controller/DistributionPayController.java
#	cash-service/order-service/src/main/java/com/czg/service/order/service/impl/OrderInfoCustomServiceImpl.java
#	cash-service/order-service/src/main/java/com/czg/service/order/service/impl/PayServiceImpl.java
2026-01-17 09:52:55 +08:00
656db661ab 进件关联 2026-01-16 18:20:06 +08:00
4498108fb5 进件关联 2026-01-16 17:55:03 +08:00
235c442c6d 进件关联 2026-01-16 17:49:52 +08:00
592cc99db4 进件关联 2026-01-16 17:42:02 +08:00
f8db70ca43 支付回调问题 2026-01-16 16:24:41 +08:00
1f6593c957 进件查询问题 2026-01-16 16:16:48 +08:00
b22b9bd4d6 进件查询问题 2026-01-16 16:15:17 +08:00
d6ef8cfba9 店铺名称问题 2026-01-16 09:57:44 +08:00
gong
0fbe490178 微信支付 进件增加 h5支付域名 2026-01-15 16:04:22 +08:00
d693bb0dd3 Merge remote-tracking branch 'origin/test' into test 2026-01-15 15:46:14 +08:00
b6e3d109fc 常量 2026-01-15 15:45:57 +08:00
gong
b83c53fe04 微信退款 退款中处理4 2026-01-15 15:40:42 +08:00
gong
5b617b653b 微信退款 退款中处理3 2026-01-15 15:39:28 +08:00
gong
4866784afe 微信退款 退款中处理 2026-01-15 15:36:32 +08:00
gong
97bf69eb31 微信退款 退款中处理 2026-01-15 15:31:57 +08:00
gong
aca48f84d9 微信支付回调日期格式化 2026-01-15 15:17:57 +08:00
9834c59fc7 常量 2026-01-15 14:31:26 +08:00
c151a0188d 支付参数5 2026-01-15 14:15:32 +08:00
2c417daa3f 支付参数5 2026-01-15 14:12:57 +08:00
b3a161d643 支付参数4 2026-01-15 14:08:57 +08:00
df72bad0dc Merge remote-tracking branch 'origin/test' into test 2026-01-15 14:05:06 +08:00
071e7f5c82 支付参数3 2026-01-15 14:04:36 +08:00
bfff341d17 团购扫码 token获取信息 2026-01-14 17:48:59 +08:00
f85ac0815b 计算成本价问题 2026-01-05 14:31:32 +08:00
80fb367673 统计 2026-01-05 11:30:16 +08:00
574c73d0b5 shop_user查询多个的问题 2026-01-05 09:37:45 +08:00
cb18aa5670 退款问题 2025-12-26 17:09:34 +08:00
da3447cd0b 异步执行退款额外问题 2025-12-26 16:21:59 +08:00
9e946443ec sql问题 2025-12-26 16:18:17 +08:00
71ffdede19 分销退款问题 2025-12-26 16:02:31 +08:00
353404dde4 显式抛出 2025-12-26 14:53:38 +08:00
31 changed files with 181 additions and 175 deletions

View File

@@ -3,7 +3,6 @@ package com.czg.controller.admin;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.czg.EntryManager; import com.czg.EntryManager;
import com.czg.annotation.Debounce; import com.czg.annotation.Debounce;
import com.czg.config.RabbitPublisher;
import com.czg.dto.req.AggregateMerchantDto; import com.czg.dto.req.AggregateMerchantDto;
import com.czg.dto.resp.WechatBankBranchRespDto; import com.czg.dto.resp.WechatBankBranchRespDto;
import com.czg.order.entity.ShopDirectMerchant; import com.czg.order.entity.ShopDirectMerchant;
@@ -33,9 +32,6 @@ public class EntryManagerController {
@Resource @Resource
private EntryManagerTask entryManagerTask; private EntryManagerTask entryManagerTask;
@Resource
private RabbitPublisher rabbitPublisher;
/** /**
* ocr识别填充 * ocr识别填充
* 阿里 ocr识别图片 * 阿里 ocr识别图片
@@ -68,12 +64,6 @@ public class EntryManagerController {
return CzgResult.success(EntryManager.queryBankBranchList(bankAliceCode, cityCode)); return CzgResult.success(EntryManager.queryBankBranchList(bankAliceCode, cityCode));
} }
@GetMapping("test")
public CzgResult<Void> test(String shopId, String licenceNo) {
rabbitPublisher.sendEntryManagerMsg(shopId + ":" + licenceNo);
return CzgResult.success();
}
/** /**
* 获取进件列表 * 获取进件列表
*/ */
@@ -87,8 +77,8 @@ public class EntryManagerController {
* 获取进件信息 * 获取进件信息
*/ */
@GetMapping @GetMapping
public CzgResult<AggregateMerchantVO> getEntry(Long shopId, String licenceNo) { public CzgResult<AggregateMerchantVO> getEntry(Long shopId) {
return CzgResult.success(shopDirectMerchantService.getEntry(shopId, licenceNo)); return CzgResult.success(shopDirectMerchantService.getEntry(shopId));
} }
/** /**
@@ -98,8 +88,8 @@ public class EntryManagerController {
*/ */
@GetMapping("queryEntry") @GetMapping("queryEntry")
@Debounce(value = "#shopId", interval = 1000 * 60 * 3) @Debounce(value = "#shopId", interval = 1000 * 60 * 3)
public CzgResult<Boolean> queryEntry(Long shopId, String licenceNo) { public CzgResult<Boolean> queryEntry(Long shopId) {
entryManagerTask.entryManager(shopId, licenceNo); entryManagerTask.entryManager(shopId);
return CzgResult.success(); return CzgResult.success();
} }

View File

@@ -2,6 +2,8 @@ package com.czg.controller.admin;
import com.czg.annotation.SaAdminCheckPermission; import com.czg.annotation.SaAdminCheckPermission;
import com.czg.annotation.SaAdminCheckRole; import com.czg.annotation.SaAdminCheckRole;
import com.czg.constant.PayChannelCst;
import com.czg.exception.CzgException;
import com.czg.order.dto.ShopMerchantDTO; import com.czg.order.dto.ShopMerchantDTO;
import com.czg.order.entity.ShopDirectMerchant; import com.czg.order.entity.ShopDirectMerchant;
import com.czg.order.service.ShopMerchantService; import com.czg.order.service.ShopMerchantService;
@@ -44,6 +46,9 @@ public class ShopMerchantController {
@SaAdminCheckPermission(parentName = "支付参数信息", value = "shopMerchant:edit", name = "商户支付信息修改") @SaAdminCheckPermission(parentName = "支付参数信息", value = "shopMerchant:edit", name = "商户支付信息修改")
@PutMapping @PutMapping
public CzgResult<Boolean> edit(@RequestBody ShopMerchantDTO shopMerchant) { public CzgResult<Boolean> edit(@RequestBody ShopMerchantDTO shopMerchant) {
if (shopMerchant != null && shopMerchant.getChannel() != null && shopMerchant.getChannel().equals(PayChannelCst.NATIVE)) {
throw new CzgException("原生支付渠道暂未开通");
}
return CzgResult.success(shopMerchantService.editEntry(shopMerchant, true)); return CzgResult.success(shopMerchantService.editEntry(shopMerchant, true));
} }

View File

@@ -36,7 +36,7 @@ public class VipPayController {
private ShopUserPayService shopUserPayService; private ShopUserPayService shopUserPayService;
@Resource @Resource
private OrderPaymentService orderPaymentService; private OrderPaymentService paymentService;
/** /**
* 现金充值 * 现金充值
@@ -79,9 +79,6 @@ public class VipPayController {
/** /**
* 智慧充值 * 智慧充值
* @param request
* @param rechargeDTO
* @return
*/ */
@PostMapping("/recharge") @PostMapping("/recharge")
@Debounce(value = "#rechargeDTO.shopUserId") @Debounce(value = "#rechargeDTO.shopUserId")
@@ -95,9 +92,6 @@ public class VipPayController {
/** /**
* 会员购买支付 * 会员购买支付
* @param request
* @param payParam
* @return
*/ */
@PostMapping("/ltPayMember") @PostMapping("/ltPayMember")
@Debounce(value = "#payParam.shopUserId") @Debounce(value = "#payParam.shopUserId")
@@ -175,7 +169,7 @@ public class VipPayController {
AssertUtil.isNull(shopId, "店铺id不能为空"); AssertUtil.isNull(shopId, "店铺id不能为空");
AssertUtil.isBlank(payOrderNo, "支付单号不能为空"); AssertUtil.isBlank(payOrderNo, "支付单号不能为空");
OrderPayment payment = orderPaymentService.getOne(QueryWrapper.create().eq(OrderPayment::getOrderNo, payOrderNo)); OrderPayment payment = paymentService.getOne(QueryWrapper.create().eq(OrderPayment::getOrderNo, payOrderNo));
if (payment == null) { if (payment == null) {
return CzgResult.failure("支付单号不存在"); return CzgResult.failure("支付单号不存在");
} }

View File

@@ -75,7 +75,7 @@ public class EntryManagerMqListener {
ThreadContext.put("traceId", String.valueOf(shopId)); ThreadContext.put("traceId", String.valueOf(shopId));
log.info("进件2MQ对接开始shopId:{}", msg); log.info("进件2MQ对接开始shopId:{}", msg);
// 安全转换shopId // 安全转换shopId
AggregateMerchantVO entry = shopDirectMerchantService.getEntry(shopId, split[1]); AggregateMerchantVO entry = shopDirectMerchantService.getEntry(shopId);
log.info("进件3MQ对接开始shopId:{}", msg); log.info("进件3MQ对接开始shopId:{}", msg);
if (entry != null) { if (entry != null) {
EntryManager.uploadParamImage(entry); EntryManager.uploadParamImage(entry);

View File

@@ -5,9 +5,7 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.czg.EntryManager; import com.czg.EntryManager;
import com.czg.PayCst; import com.czg.PayCst;
import com.czg.constant.PayChannelCst;
import com.czg.dto.resp.QueryStatusResp; import com.czg.dto.resp.QueryStatusResp;
import com.czg.order.dto.ShopMerchantDTO;
import com.czg.order.entity.ShopDirectMerchant; import com.czg.order.entity.ShopDirectMerchant;
import com.czg.order.service.ShopMerchantService; import com.czg.order.service.ShopMerchantService;
import com.czg.pay.AlipayAuthInfoDto; import com.czg.pay.AlipayAuthInfoDto;
@@ -39,17 +37,16 @@ public class EntryManagerTask {
public void run() { public void run() {
log.info("进件查询,定时任务执行"); log.info("进件查询,定时任务执行");
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
entryManager(null, null); entryManager(null);
log.info("进件查询,定时任务执行完毕,耗时:{}ms", start - System.currentTimeMillis()); log.info("进件查询,定时任务执行完毕,耗时:{}ms", start - System.currentTimeMillis());
} }
/** /**
* 查询状态为待处理、待签约、待审核的进件 * 查询状态为待处理、待签约、待审核的进件
*/ */
public void entryManager(Long shopId, String licenceNo) { public void entryManager(Long shopId) {
List<ShopDirectMerchant> list = shopDirectMerchantService.list(QueryWrapper.create() List<ShopDirectMerchant> list = shopDirectMerchantService.list(QueryWrapper.create()
.eq(ShopDirectMerchant::getShopId, shopId) .eq(ShopDirectMerchant::getShopId, shopId)
.eq(ShopDirectMerchant::getLicenceNo, licenceNo)
.in(ShopDirectMerchant::getWechatStatus, PayCst.EntryStatus.NEED_QUERY_LIST) .in(ShopDirectMerchant::getWechatStatus, PayCst.EntryStatus.NEED_QUERY_LIST)
.or(ShopDirectMerchant::getAlipayStatus).in(PayCst.EntryStatus.NEED_QUERY_LIST)); .or(ShopDirectMerchant::getAlipayStatus).in(PayCst.EntryStatus.NEED_QUERY_LIST));
if (CollUtil.isEmpty(list)) { if (CollUtil.isEmpty(list)) {
@@ -80,10 +77,10 @@ public class EntryManagerTask {
} }
shopDirectMerchantService.updateById(shopDirectMerchant); shopDirectMerchantService.updateById(shopDirectMerchant);
if (StrUtil.isNotBlank(wechatMerchantId) || StrUtil.isNotBlank(alipayMerchantId)) { if (StrUtil.isNotBlank(wechatMerchantId) || StrUtil.isNotBlank(alipayMerchantId)) {
ShopMerchantDTO shopMerchantDTO = new ShopMerchantDTO(); // ShopMerchantDTO shopMerchantDTO = new ShopMerchantDTO();
shopMerchantDTO.setShopId(shopId); // shopMerchantDTO.setShopId(shopId);
shopMerchantDTO.setChannel(PayChannelCst.NATIVE); // shopMerchantDTO.setChannel(PayChannelCst.NATIVE);
shopMerchantDTO.setRelatedLicenceNo(licenceNo); // shopMerchantDTO.setRelatedId(shopDirectMerchant.getShopId());
NativeMerchantDTO nativeMerchantDTO = new NativeMerchantDTO(); NativeMerchantDTO nativeMerchantDTO = new NativeMerchantDTO();
nativeMerchantDTO.setWechatMerchantId(wechatMerchantId); nativeMerchantDTO.setWechatMerchantId(wechatMerchantId);
nativeMerchantDTO.setAlipayMerchantId(alipayMerchantId); nativeMerchantDTO.setAlipayMerchantId(alipayMerchantId);
@@ -91,9 +88,9 @@ public class EntryManagerTask {
AlipayAuthInfoDto alipayAuthInfoDto = JSONObject.parseObject(shopDirectMerchant.getAlipayAuthInfo(), AlipayAuthInfoDto.class); AlipayAuthInfoDto alipayAuthInfoDto = JSONObject.parseObject(shopDirectMerchant.getAlipayAuthInfo(), AlipayAuthInfoDto.class);
nativeMerchantDTO.setAlipayAuthInfo(alipayAuthInfoDto); nativeMerchantDTO.setAlipayAuthInfo(alipayAuthInfoDto);
} }
shopMerchantDTO.setNativeMerchantDTO(nativeMerchantDTO); // shopMerchantDTO.setNativeMerchantDTO(nativeMerchantDTO);
shopMerchantService.editEntry(shopMerchantDTO, false); // shopMerchantService.editEntry(shopMerchantDTO, false);
shopMerchantService.upMerchant(licenceNo, nativeMerchantDTO); shopMerchantService.upMerchant(shopDirectMerchant.getShopId(), nativeMerchantDTO);
} }
} }
} }

View File

@@ -10,7 +10,7 @@
<artifactId>cash-common-service</artifactId> <artifactId>cash-common-service</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>global-service</name> <name>common-service</name>
<url>https://maven.apache.org</url> <url>https://maven.apache.org</url>

View File

@@ -79,9 +79,27 @@ public interface ParamCodeCst {
* 超掌柜支付回调地址 * 超掌柜支付回调地址
* <p>支付宝/微信支付完成后,支付平台回调我方系统的地址</p> * <p>支付宝/微信支付完成后,支付平台回调我方系统的地址</p>
*/ */
// public static String PAY_CZG_NOTIFY_URL = "pay_czg_notify_url";
public static String NATIVE_PAY_NOTIFY_URL = "native_pay_notify_url"; public static String NATIVE_PAY_NOTIFY_URL = "native_pay_notify_url";
public static String NATIVE_REFUND_NOTIFY_URL = "native_refund_notify_url";
/**
* 超掌柜支付域名
* <p>超掌柜支付相关接口的根域名</p>
*/
public static String POLY_DOMAIN = "poly_domain";
public static String POLY_PAY_NOTIFY_URL = "poly_pay_notify_url"; public static String POLY_PAY_NOTIFY_URL = "poly_pay_notify_url";
public static String POLY_REFUND_NOTIFY_URL = "poly_refund_notify_url";
/**
* 微信原生回调地址
* <p>微信原生支付接口的回调地址(区别于超掌柜封装的回调)</p>
*/
public static String NATIVE_NOTIFY_URL = "native_notify_url";
/**
* 店铺订单支付BaseUrl
* <p>店铺订单支付页面的基础域名</p>
*/
public static String SHOP_ORDER_PAY_BASE_URL = "shop_order_pay_base_url";
/** /**
* 排队到号通知 * 排队到号通知
*/ */
@@ -113,11 +131,6 @@ public interface ParamCodeCst {
*/ */
public static String SMS_FEE = "sms_fee"; public static String SMS_FEE = "sms_fee";
/**
* 店铺订单支付BaseUrl
* <p>店铺订单支付页面的基础域名</p>
*/
public static String SHOP_ORDER_PAY_BASE_URL = "shop_order_pay_base_url";
/** /**
* 平台名称 * 平台名称
@@ -125,30 +138,12 @@ public interface ParamCodeCst {
*/ */
public static String PLATE_NAME = "plate_name"; public static String PLATE_NAME = "plate_name";
/**
* 超掌柜退款回调地址
* <p>支付平台处理退款后,回调我方系统的地址</p>
*/
public static String PAY_CZG_REFUND_NOTIFY_URL = "pay_czg_refund_notify_url";
/**
* 超掌柜支付域名
* <p>超掌柜支付相关接口的根域名</p>
*/
public static String PAY_CZG_DOMAIN = "pay_czg_domain";
/** /**
* 叫号页面地址 * 叫号页面地址
* <p>餐厅叫号系统的前端页面地址</p> * <p>餐厅叫号系统的前端页面地址</p>
*/ */
public static String CALL_PAGE_URL = "call_page_url"; public static String CALL_PAGE_URL = "call_page_url";
/**
* 微信原生回调地址
* <p>微信原生支付接口的回调地址(区别于超掌柜封装的回调)</p>
*/
public static String NATIVE_NOTIFY_URL = "native_notify_url";
/** /**
* 公众号关注位置 * 公众号关注位置
* <p>公众号关注入口的展示位置可选值mine-我的页面、order-订单页面、eat-就餐页面</p> * <p>公众号关注入口的展示位置可选值mine-我的页面、order-订单页面、eat-就餐页面</p>

View File

@@ -1,6 +1,7 @@
package com.czg.market.service; package com.czg.market.service;
import com.czg.enums.ShopUserFlowBizEnum; import com.czg.enums.ShopUserFlowBizEnum;
import com.czg.exception.CzgException;
import com.czg.market.dto.MkShopRechargeDTO; import com.czg.market.dto.MkShopRechargeDTO;
import com.czg.market.vo.MkShopRechargeShopListVO; import com.czg.market.vo.MkShopRechargeShopListVO;
import com.czg.market.vo.MkShopRechargeVO; import com.czg.market.vo.MkShopRechargeVO;
@@ -21,7 +22,7 @@ import java.util.List;
*/ */
public interface MkShopRechargeService extends IService<MkShopRecharge> { public interface MkShopRechargeService extends IService<MkShopRecharge> {
MkShopRechargeVO detail(Long shopId); MkShopRechargeVO detail(Long shopId) throws CzgException;
MkShopRechargeVO detailApp(Long shopId); MkShopRechargeVO detailApp(Long shopId);

View File

@@ -21,9 +21,9 @@ public class ShopMerchantDTO {
private String channel; private String channel;
/** /**
* 聚合支付商户 * 聚合支付商户
* native 必填 对应 tb_shop_direct_merchant 的 licence_no 营业执照 * native 必填 对应 tb_shop_direct_merchant 的 shopId
*/ */
private String relatedLicenceNo; private Long relatedId;
/** /**
* 原生支付参数 * 原生支付参数
*/ */

View File

@@ -93,7 +93,7 @@ public class OrderPayment implements Serializable {
*/ */
private String tradeNumber; private String tradeNumber;
@Column(onUpdateValue = "now()") // @Column(onUpdateValue = "now()")
private LocalDateTime payTime; private LocalDateTime payTime;
/** /**

View File

@@ -3,7 +3,6 @@ package com.czg.order.entity;
import com.mybatisflex.annotation.Column; import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id; import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table; import com.mybatisflex.annotation.Table;
import jakarta.validation.constraints.NotEmpty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@@ -21,7 +20,7 @@ import java.time.LocalDateTime;
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Table("tb_shop_merchant2") @Table("tb_shop_merchant")
public class ShopMerchant implements Serializable { public class ShopMerchant implements Serializable {
@Serial @Serial
@@ -42,9 +41,9 @@ public class ShopMerchant implements Serializable {
/** /**
* 聚合支付商户 * 聚合支付商户
* native 必填 对应 tb_shop_direct_merchant 的 licence_no 营业执照 * native 必填 对应 tb_shop_direct_merchant 的 shopId
*/ */
private String relatedLicenceNo; private Long relatedId;
/** /**
* 微信appid * 微信appid

View File

@@ -28,9 +28,9 @@ public interface ShopMerchantService extends IService<ShopMerchant> {
* 已绑定的支付 * 已绑定的支付
* 更新商户支付参数 * 更新商户支付参数
*/ */
void upMerchant(@NotBlank String relatedLicenceNo, @NotNull NativeMerchantDTO nativeMerchantDTO); void upMerchant(@NotBlank Long relatedId, @NotNull NativeMerchantDTO nativeMerchantDTO);
ShopMerchant getById(Long shopId); ShopMerchant getByShopId(Long shopId);
ShopDirectMerchant getMainMerchant(Long shopId); ShopDirectMerchant getMainMerchant(Long shopId);

View File

@@ -37,6 +37,11 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<!-- 短信 -->
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>dysmsapi20170525</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.google.zxing</groupId> <groupId>com.google.zxing</groupId>
<artifactId>core</artifactId> <artifactId>core</artifactId>
@@ -45,10 +50,6 @@
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>dysmsapi20170525</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.alibaba.fastjson2</groupId> <groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId> <artifactId>fastjson2</artifactId>

View File

@@ -5,6 +5,9 @@ import com.czg.PayCst;
import com.czg.pay.PayNotifyRespDTO; import com.czg.pay.PayNotifyRespDTO;
import lombok.Data; import lombok.Data;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
/** /**
* @author yjjie * @author yjjie
* @date 2025/12/23 22:21 * @date 2025/12/23 22:21
@@ -119,13 +122,16 @@ public class WechatPayNotifyDataDto {
} }
public PayNotifyRespDTO convertToPayNotifyRespDTO() { public PayNotifyRespDTO convertToPayNotifyRespDTO() {
ZonedDateTime zonedDateTime = ZonedDateTime.parse(successTime);
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String time = zonedDateTime.format(outputFormatter);
PayNotifyRespDTO respDTO = new PayNotifyRespDTO() PayNotifyRespDTO respDTO = new PayNotifyRespDTO()
.setMchOrderNo(outTradeNo) .setMchOrderNo(outTradeNo)
.setThirdOrderNo(transactionId) .setThirdOrderNo(transactionId)
.setAmount(getPayAmount()) .setAmount(getPayAmount())
.setPlatform(PayCst.Platform.WECHAT) .setPlatform(PayCst.Platform.WECHAT)
.setExtData(attach) .setExtData(attach)
.setPaySuccessTime(successTime) .setPaySuccessTime(time)
.setErrorMsg(tradeStateDesc); .setErrorMsg(tradeStateDesc);
switch (tradeState) { switch (tradeState) {

View File

@@ -15,9 +15,7 @@ import com.czg.third.wechat.dto.req.entry.*;
import com.czg.third.wechat.dto.req.entry.business.WechatEntryBusinessReqDto; import com.czg.third.wechat.dto.req.entry.business.WechatEntryBusinessReqDto;
import com.czg.third.wechat.dto.req.entry.business.WechatEntryIdentityReqDto; import com.czg.third.wechat.dto.req.entry.business.WechatEntryIdentityReqDto;
import com.czg.third.wechat.dto.req.entry.business.WechatEntryLicenseReqDto; import com.czg.third.wechat.dto.req.entry.business.WechatEntryLicenseReqDto;
import com.czg.third.wechat.dto.req.entry.business.sales.WechatEntryMiniProgramReqDto; import com.czg.third.wechat.dto.req.entry.business.sales.*;
import com.czg.third.wechat.dto.req.entry.business.sales.WechatEntrySalesInfoReqDto;
import com.czg.third.wechat.dto.req.entry.business.sales.WechatEntryStoreInfoReqDto;
import com.czg.third.wechat.dto.req.entry.id.WechatEntryIdCardReqDto; import com.czg.third.wechat.dto.req.entry.id.WechatEntryIdCardReqDto;
import com.czg.third.wechat.dto.resp.WechatAuditDetail; import com.czg.third.wechat.dto.resp.WechatAuditDetail;
import com.czg.third.wechat.dto.resp.WechatQueryStateResp; import com.czg.third.wechat.dto.resp.WechatQueryStateResp;
@@ -319,6 +317,9 @@ public class WechatEntryManager {
WechatEntryMiniProgramReqDto miniProgramInfo = new WechatEntryMiniProgramReqDto(); WechatEntryMiniProgramReqDto miniProgramInfo = new WechatEntryMiniProgramReqDto();
miniProgramInfo.setMiniProgramAppid("wxd88fffa983758a30"); miniProgramInfo.setMiniProgramAppid("wxd88fffa983758a30");
salesInfo.setMiniProgramInfo(miniProgramInfo); salesInfo.setMiniProgramInfo(miniProgramInfo);
WechatEntryWebInfoReqDto webInfo = new WechatEntryWebInfoReqDto();
webInfo.setDomain("https://invoice.sxczgkj.cn/pay/");
salesInfo.setWebInfo(webInfo);
businessReqInfo.setSalesInfo(salesInfo); businessReqInfo.setSalesInfo(salesInfo);
entryParams.setBusinessInfo(businessReqInfo); entryParams.setBusinessInfo(businessReqInfo);

View File

@@ -280,6 +280,12 @@ public class WechatPayManager {
JSONObject object = JSONObject.parseObject(resp); JSONObject object = JSONObject.parseObject(resp);
String code = object.getString("code");
String status = object.getString("status");
if ("INVALID_REQUEST".equalsIgnoreCase(code) || StrUtil.isNotBlank(status)) {
throw new CzgException("微信退款失败:" + object.getString("message"));
}
RefundRespDTO respDTO = new RefundRespDTO() RefundRespDTO respDTO = new RefundRespDTO()
.setMerchantRefundNo(object.getString("out_refund_no")) .setMerchantRefundNo(object.getString("out_refund_no"))
.setThirdRefundNo(object.getString("refund_id")) .setThirdRefundNo(object.getString("refund_id"))
@@ -292,16 +298,14 @@ public class WechatPayManager {
respDTO.setRefundAmount(resAmount.getLong("refund")); respDTO.setRefundAmount(resAmount.getLong("refund"));
} }
switch (object.getString("status")) { switch (status) {
case "SUCCESS": case "SUCCESS":
case "PROCESSING":
respDTO.setStatus("SUCCESS"); respDTO.setStatus("SUCCESS");
break; break;
case "CLOSED": case "CLOSED":
respDTO.setStatus("CLOSED"); respDTO.setStatus("CLOSED");
break; break;
case "PROCESSING":
respDTO.setStatus("ING");
break;
case "ABNORMAL": case "ABNORMAL":
respDTO.setStatus("INIT"); respDTO.setStatus("INIT");
break; break;
@@ -311,8 +315,10 @@ public class WechatPayManager {
} }
return respDTO; return respDTO;
} catch (CzgException e) {
throw e;
} catch (Exception e) { } catch (Exception e) {
log.error("微信退款异常: orderNo = {}, e = {}", paramsDto.getMchOrderNo(), e.getMessage()); log.error("微信退款异常: orderNo = {} ", paramsDto.getMchOrderNo(), e);
throw new CzgException("微信退款异常"); throw new CzgException("微信退款异常");
} }
} }

View File

@@ -29,6 +29,7 @@ import jakarta.annotation.Resource;
import org.apache.dubbo.config.annotation.DubboReference; import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService; import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.util.*; import java.util.*;
@@ -41,7 +42,7 @@ import java.util.stream.Collectors;
* @author zs * @author zs
* @since 2025-02-21 * @since 2025-02-21
*/ */
@DubboService @Service
public class CallTableServiceImpl extends ServiceImpl<CallTableMapper, CallTable> implements CallTableService { public class CallTableServiceImpl extends ServiceImpl<CallTableMapper, CallTable> implements CallTableService {
@DubboReference @DubboReference
private SysParamsService sysParamsService; private SysParamsService sysParamsService;

View File

@@ -253,6 +253,7 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
@Override @Override
@CacheEvict(key = "#shopInfoEditDTO.id") @CacheEvict(key = "#shopInfoEditDTO.id")
public Boolean edit(ShopInfoEditDTO shopInfoEditDTO) { public Boolean edit(ShopInfoEditDTO shopInfoEditDTO) {
shopInfoEditDTO.setIsMemberPrice(null);
ShopInfo shopInfo; ShopInfo shopInfo;
if (!StpKit.USER.isAdmin()) { if (!StpKit.USER.isAdmin()) {
shopInfo = queryChain().eq(ShopInfo::getId, StpKit.USER.getShopId()).one(); shopInfo = queryChain().eq(ShopInfo::getId, StpKit.USER.getShopId()).one();
@@ -319,8 +320,6 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
rabbitPublisher.sendOrderDetailStatusMsg(shopInfo.getId().toString(), "shopInfoUpdate"); rabbitPublisher.sendOrderDetailStatusMsg(shopInfo.getId().toString(), "shopInfoUpdate");
return true; return true;
} }
return false; return false;
} }

View File

@@ -26,8 +26,6 @@ import com.czg.market.vo.InviteUserVO;
import com.czg.market.vo.MkDistributionConfigVO; import com.czg.market.vo.MkDistributionConfigVO;
import com.czg.order.dto.MkDistributionPayDTO; import com.czg.order.dto.MkDistributionPayDTO;
import com.czg.order.entity.OrderInfo; import com.czg.order.entity.OrderInfo;
import com.czg.market.service.OrderInfoService;
import com.czg.order.service.OrderPaymentService;
import com.czg.sa.StpKit; import com.czg.sa.StpKit;
import com.czg.service.market.enums.OrderStatusEnums; import com.czg.service.market.enums.OrderStatusEnums;
import com.czg.service.market.mapper.MkDistributionUserMapper; import com.czg.service.market.mapper.MkDistributionUserMapper;
@@ -685,22 +683,15 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
.ne(MkDistributionFlow::getStatus, TableValueConstant.DistributionFlow.Status.REFUND.getCode())); .ne(MkDistributionFlow::getStatus, TableValueConstant.DistributionFlow.Status.REFUND.getCode()));
list.forEach(item -> { list.forEach(item -> {
MkDistributionFlow refundFlow = BeanUtil.copyProperties(item, MkDistributionFlow.class);
refundFlow.setStatus(TableValueConstant.DistributionFlow.Status.REFUND.getCode());
refundFlow.setSourceId(item.getId());
refundFlow.setId(null);
refundFlow.setCreateTime(DateUtil.date().toLocalDateTime());
refundFlow.setUpdateTime(DateUtil.date().toLocalDateTime());
if (TableValueConstant.DistributionFlow.Status.PENDING.getCode().equals(item.getStatus())) { if (TableValueConstant.DistributionFlow.Status.PENDING.getCode().equals(item.getStatus())) {
item.setStatus(TableValueConstant.DistributionFlow.Status.SUCCESS.getCode()); item.setStatus(TableValueConstant.DistributionFlow.Status.REFUND.getCode());
// updateIncome(item.getRewardAmount().negate(), BigDecimal.ZERO, BigDecimal.ZERO, item.getDistributionUserId(), item.getUserId(), item.getShopUserId(), item.getShopId(), item.getLevel());
distributionFlowService.updateById(item); distributionFlowService.updateById(item);
mapper.updateIncome(item.getRewardAmount().negate(), null, null, item.getDistributionUserId(), item.getShopId());
} else { } else {
// 执行扣款 // 执行扣款
updateIncome(BigDecimal.ZERO, item.getRewardAmount().negate(), BigDecimal.ZERO, item.getDistributionUserId(), item.getUserId(), item.getShopUserId(), item.getShopId(), item.getLevel()); updateIncome(BigDecimal.ZERO, item.getRewardAmount().negate(), BigDecimal.ZERO, item.getDistributionUserId(), item.getUserId(), item.getShopUserId(), item.getShopId(), item.getLevel());
updateShopInfoAmount(item.getShopId(), item.getRewardAmount(), orderId, TableValueConstant.DistributionAmountFlow.Type.REFUND, "分销回退"); updateShopInfoAmount(item.getShopId(), item.getRewardAmount(), orderId, TableValueConstant.DistributionAmountFlow.Type.REFUND, "分销回退");
} }
distributionFlowService.save(refundFlow);
}); });
} }
@@ -738,6 +729,13 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
distributionDeliverService.save(deliver); distributionDeliverService.save(deliver);
} }
/**
* 分销金额修改
*
* @param pendingIncome 待入账金额
* @param receivedIncome 已入账
* @param withdrawIncome 已提现
*/
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateIncome(BigDecimal pendingIncome, BigDecimal receivedIncome, BigDecimal withdrawIncome, Long id, Long userId, Long shopUserId, Long shopId, Integer isOne) { public void updateIncome(BigDecimal pendingIncome, BigDecimal receivedIncome, BigDecimal withdrawIncome, Long id, Long userId, Long shopUserId, Long shopId, Integer isOne) {

View File

@@ -72,7 +72,7 @@ public class MkShopRechargeServiceImpl extends ServiceImpl<MkShopRechargeMapper,
} }
@Override @Override
public MkShopRechargeVO detail(Long shopId) { public MkShopRechargeVO detail(Long shopId) throws CzgException{
shopId = shopInfoService.getMainIdByShopId(shopId); shopId = shopInfoService.getMainIdByShopId(shopId);
ShopInfo shopInfo = shopInfoService.getById(shopId); ShopInfo shopInfo = shopInfoService.getById(shopId);
if (shopInfo.getMainId() != null) { if (shopInfo.getMainId() != null) {

View File

@@ -45,36 +45,33 @@
order by a.create_time desc order by a.create_time desc
</select> </select>
<select id="totalAmount" resultType="java.math.BigDecimal"> <select id="totalAmount" resultType="java.math.BigDecimal">
select sum(a.amount) from mk_distribution_flow as a select sum(a.reward_amount)
left join mk_distribution_user as d on d.id=a.distribution_user_id from mk_distribution_flow as a
left join tb_shop_user as b on a.shop_user_id=b.id left join tb_shop_user as b on a.shop_user_id = b.id
left join tb_shop_user as c on c.id=a.shop_user_id
where a.shop_id=#{shopId} where a.shop_id=#{shopId}
<if test="id != null">
and a.shop_user_id=#{id}
</if>
<if test="userId != null">
and a.user_id=#{userId}
</if>
<if test="status != null and status != ''">
and a.status=#{status}
</if>
<if test="type != null and type != ''">
and a.type=#{type}
</if>
<if test="startTime != null"> <if test="startTime != null">
and a.create_time>=#{startTime} and a.create_time>=#{startTime}
</if> </if>
<if test="endTime != null"> <if test="endTime != null">
and a.create_time&lt;=#{endTime} and a.create_time&lt;=#{endTime}
</if> </if>
<if test="status != null and status != ''">
and a.status=#{status}
</if>
<if test="key != null and key != ''"> <if test="key != null and key != ''">
and ( and (
b.nick_name like concat('%',#{key},'%') b.nick_name like concat('%',#{key},'%')
or b.id like concat('%',#{key},'%') or b.id like concat('%',#{key},'%')
or c.id like concat('%',#{key},'%')
or c.nick_name like concat('%',#{key},'%')
) )
</if> </if>
<if test="id != null">
and d.id=#{id}
</if>
<if test="type != null and type != ''">
and a.type=#{type}
</if>
<if test="userId != null">
and d.user_id=#{userId}
</if>
</select> </select>
</mapper> </mapper>

View File

@@ -5,16 +5,24 @@
<mapper namespace="com.czg.service.market.mapper.MkDistributionUserMapper"> <mapper namespace="com.czg.service.market.mapper.MkDistributionUserMapper">
<update id="updateIncome"> <update id="updateIncome">
update mk_distribution_user update mk_distribution_user
set <set>
<if test="pendingIncome != null"> <if test="pendingIncome != null">
total_income = total_income + #{pendingIncome}, total_income = total_income + #{pendingIncome},
</if> </if>
<if test="receivedIncome != null"> <if test="receivedIncome != null">
total_income = total_income + #{receivedIncome}, total_income = total_income + #{receivedIncome},
</if> </if>
pending_income = pending_income + #{pendingIncome},
received_income = received_income + #{receivedIncome}, <if test="pendingIncome != null">
withdrawn_income = withdrawn_income + #{withdrawIncome} pending_income = pending_income + #{pendingIncome},
</if>
<if test="receivedIncome != null">
received_income = received_income + #{receivedIncome},
</if>
<if test="withdrawIncome != null">
withdrawn_income = withdrawn_income + #{withdrawIncome}
</if>
</set>
where id = #{id} and shop_id = #{shopId} where id = #{id} and shop_id = #{shopId}
</update> </update>

View File

@@ -261,7 +261,7 @@ public interface PrinterImpl {
// data.append("<OUT:15>"); // data.append("<OUT:15>");
// data.append("<BR>"); // data.append("<BR>");
// 18个空格 12 // 18个空格 12
data.append(getFormatLabel("品名 数量 小计 ", signLabelInfo.s)) data.append(getFormatLabel("品名 数量 单价 ", signLabelInfo.s))
.append(signLabelInfo.br); .append(signLabelInfo.br);
// data.append("<S>品名 数量 小计</S><BR>"); // data.append("<S>品名 数量 小计</S><BR>");
data.append(getFormatLabel("--------------------------------", signLabelInfo.s)) data.append(getFormatLabel("--------------------------------", signLabelInfo.s))

View File

@@ -29,7 +29,7 @@ public interface ShopDirectMerchantService extends IService<ShopDirectMerchant>
/** /**
* 获取进件信息 * 获取进件信息
*/ */
AggregateMerchantVO getEntry(Long shopId, String licenceNo); AggregateMerchantVO getEntry(Long shopId);
/** /**
* 申请进件 * 申请进件

View File

@@ -91,11 +91,12 @@ public class PayServiceImpl implements PayService {
String payData = null; String payData = null;
if (shopMerchant.getChannel().equals(PayChannelCst.NATIVE)) { if (shopMerchant.getChannel().equals(PayChannelCst.NATIVE)) {
payData = shopMerchant.getNativePayJson(); payData = shopMerchant.getNativePayJson();
bizData.setNotifyUrl(sysParamsService.getSysParamValue(ParamCodeCst.System.NATIVE_REFUND_NOTIFY_URL));
} else if (shopMerchant.getChannel().equals(PayChannelCst.POLY)) { } else if (shopMerchant.getChannel().equals(PayChannelCst.POLY)) {
payData = shopMerchant.getPolyPayJson(); payData = shopMerchant.getPolyPayJson();
bizData.setNotifyUrl(sysParamsService.getSysParamValue(ParamCodeCst.System.POLY_REFUND_NOTIFY_URL));
} }
// bizData.setNotifyUrl(sysParamsService.getSysParamValue(ParamCodeCst.System.PAY_CZG_REFUND_NOTIFY_URL)); return adapter.refund(getDomain(), payData, bizData);
return adapter.refund(getDomain(), payData, "", bizData);
} }
@Override @Override
@@ -180,30 +181,26 @@ public class PayServiceImpl implements PayService {
} }
private ShopMerchant getMerchant(Long shopId) { private ShopMerchant getMerchant(Long shopId) {
try { ShopMerchant shopMerchant = shopMerchantService.getByShopId(shopId);
ShopMerchant shopMerchant = shopMerchantService.getById(shopId); if (shopMerchant == null || StrUtil.isBlank(shopMerchant.getChannel())) {
if (shopMerchant == null || StrUtil.isBlank(shopMerchant.getChannel())) { throw new CzgException("暂未开通支付!");
throw new CzgException("暂未开通支付!");
}
if (shopMerchant.getChannel().equals(PayChannelCst.NATIVE)) {
if (StrUtil.isNotBlank(shopMerchant.getNativePayJson())) {
throw new CzgException("原生支付未开通");
}
} else if (shopMerchant.getChannel().equals(PayChannelCst.POLY)) {
if (StrUtil.isNotBlank(shopMerchant.getPolyPayJson())) {
throw new CzgException("聚合支付未开通");
}
} else {
throw new CzgException("暂不支持的支付渠道");
}
return shopMerchant;
} catch (Exception e) {
throw new CzgException("该店铺暂未开通支付!");
} }
if (shopMerchant.getChannel().equals(PayChannelCst.NATIVE)) {
if (StrUtil.isBlank(shopMerchant.getNativePayJson())) {
throw new CzgException("原生支付未开通");
}
} else if (shopMerchant.getChannel().equals(PayChannelCst.POLY)) {
if (StrUtil.isBlank(shopMerchant.getPolyPayJson())) {
throw new CzgException("聚合支付未开通");
}
} else {
throw new CzgException("暂不支持的支付渠道");
}
return shopMerchant;
} }
private String getDomain() { private String getDomain() {
return sysParamsService.getSysParamValue(ParamCodeCst.System.PAY_CZG_DOMAIN); return sysParamsService.getSysParamValue(ParamCodeCst.System.POLY_DOMAIN);
} }
private String getNotifyUrl(String channel) { private String getNotifyUrl(String channel) {
@@ -232,9 +229,11 @@ public class PayServiceImpl implements PayService {
if (firstTwoDigits >= 10 && firstTwoDigits <= 15) { if (firstTwoDigits >= 10 && firstTwoDigits <= 15) {
//微信支付 //微信支付
bizData.setSubAppid(shopMerchant.getWechatAppId()); bizData.setSubAppid(shopMerchant.getWechatAppId());
bizData.setPayType(SystemConstants.PayType.WECHAT);
} else if (firstTwoDigits >= 25 && firstTwoDigits <= 30) { } else if (firstTwoDigits >= 25 && firstTwoDigits <= 30) {
//支付宝支付 //支付宝支付
bizData.setSubAppid(shopMerchant.getAlipayAppId()); bizData.setSubAppid(shopMerchant.getAlipayAppId());
bizData.setPayType(SystemConstants.PayType.ALIPAY);
} else { } else {
throw new CzgException("扫描码非法或暂不支持"); throw new CzgException("扫描码非法或暂不支持");
} }

View File

@@ -64,9 +64,8 @@ public class ShopDirectMerchantServiceImpl extends ServiceImpl<ShopDirectMerchan
} }
@Override @Override
public AggregateMerchantVO getEntry(Long shopId, String licenceNo) { public AggregateMerchantVO getEntry(Long shopId) {
ShopDirectMerchant merchant = getOne(query() ShopDirectMerchant merchant = getOne(query()
.eq(ShopDirectMerchant::getLicenceNo, licenceNo)
.eq(ShopDirectMerchant::getShopId, shopId)); .eq(ShopDirectMerchant::getShopId, shopId));
if (merchant == null) { if (merchant == null) {
return null; return null;

View File

@@ -8,6 +8,7 @@ import com.czg.order.dto.ShopMerchantDTO;
import com.czg.order.entity.ShopDirectMerchant; import com.czg.order.entity.ShopDirectMerchant;
import com.czg.order.entity.ShopMerchant; import com.czg.order.entity.ShopMerchant;
import com.czg.order.service.ShopMerchantService; import com.czg.order.service.ShopMerchantService;
import com.czg.pay.AlipayAuthInfoDto;
import com.czg.pay.NativeMerchantDTO; import com.czg.pay.NativeMerchantDTO;
import com.czg.pay.PolyMerchantDTO; import com.czg.pay.PolyMerchantDTO;
import com.czg.service.order.mapper.ShopMerchantMapper; import com.czg.service.order.mapper.ShopMerchantMapper;
@@ -48,15 +49,15 @@ public class ShopMerchantServiceImpl extends ServiceImpl<ShopMerchantMapper, Sho
} }
shopMerchantVO.setShopId(shopId); shopMerchantVO.setShopId(shopId);
shopMerchantVO.setChannel(one.getChannel()); shopMerchantVO.setChannel(one.getChannel());
shopMerchantVO.setRelatedLicenceNo(one.getRelatedLicenceNo()); shopMerchantVO.setRelatedId(one.getRelatedId());
if (StrUtil.isNotBlank(one.getNativePayJson())) { if (StrUtil.isNotBlank(one.getNativePayJson())) {
shopMerchantVO.setNativeMerchantDTO(JSONObject.parseObject(one.getNativePayJson(), NativeMerchantDTO.class)); shopMerchantVO.setNativeMerchantDTO(JSONObject.parseObject(one.getNativePayJson(), NativeMerchantDTO.class));
} }
if (StrUtil.isNotBlank(one.getPolyPayJson())) { if (StrUtil.isNotBlank(one.getPolyPayJson())) {
shopMerchantVO.setPolyMerchantDTO(JSONObject.parseObject(one.getPolyPayJson(), PolyMerchantDTO.class)); shopMerchantVO.setPolyMerchantDTO(JSONObject.parseObject(one.getPolyPayJson(), PolyMerchantDTO.class));
} }
if (StrUtil.isNotBlank(one.getRelatedLicenceNo())) { if (one.getRelatedId() != null) {
shopMerchantVO.setShopDirectMerchant(shopDirectMerchantService.getOne(query().eq(ShopDirectMerchant::getLicenceNo, one.getRelatedLicenceNo()))); shopMerchantVO.setShopDirectMerchant(shopDirectMerchantService.getOne(query().eq(ShopDirectMerchant::getShopId, one.getRelatedId())));
} }
return shopMerchantVO; return shopMerchantVO;
} }
@@ -76,42 +77,61 @@ public class ShopMerchantServiceImpl extends ServiceImpl<ShopMerchantMapper, Sho
shopMerchant = new ShopMerchant(); shopMerchant = new ShopMerchant();
shopMerchant.setAlipayAppId(SystemConstants.PayType.ALIPAY_APP_ID); shopMerchant.setAlipayAppId(SystemConstants.PayType.ALIPAY_APP_ID);
shopMerchant.setWechatAppId(SystemConstants.PayType.WECHAT_APP_ID); shopMerchant.setWechatAppId(SystemConstants.PayType.WECHAT_APP_ID);
shopMerchant.setRelatedId(shopMerchantParam.getShopId());
} }
shopMerchant.setShopId(shopMerchantParam.getShopId()); shopMerchant.setShopId(shopMerchantParam.getShopId());
if (isUp) { if (isUp) {
shopMerchant.setChannel(CzgStrUtils.getStrOrNull(shopMerchantParam.getChannel())); shopMerchant.setChannel(CzgStrUtils.getStrOrNull(shopMerchantParam.getChannel()));
shopMerchant.setRelatedLicenceNo(CzgStrUtils.getStrOrNull(shopMerchantParam.getRelatedLicenceNo())); shopMerchant.setRelatedId(shopMerchantParam.getRelatedId());
if (shopMerchantParam.getNativeMerchantDTO() != null) { if (shopMerchantParam.getRelatedId() == null || !shopMerchantParam.getRelatedId().equals(shopMerchant.getRelatedId())) {
shopMerchant.setNativePayJson(JSONObject.toJSONString(shopMerchantParam.getNativeMerchantDTO())); ShopDirectMerchant shopDirectMerchant = shopDirectMerchantService.getById(shopMerchantParam.getRelatedId());
if (shopDirectMerchant != null) {
NativeMerchantDTO nativeMerchantDTO = new NativeMerchantDTO();
nativeMerchantDTO.setWechatMerchantId(shopDirectMerchant.getWechatMerchantId());
nativeMerchantDTO.setAlipayMerchantId(shopDirectMerchant.getAlipayMerchantId());
if (StrUtil.isNotBlank(shopDirectMerchant.getAlipayAuthInfo())) {
AlipayAuthInfoDto alipayAuthInfoDto = JSONObject.parseObject(shopDirectMerchant.getAlipayAuthInfo(), AlipayAuthInfoDto.class);
nativeMerchantDTO.setAlipayAuthInfo(alipayAuthInfoDto);
}
shopMerchant.setNativePayJson(JSONObject.toJSONString(nativeMerchantDTO));
} else {
shopMerchant.setNativePayJson(null);
shopMerchant.setWechatAppId(null);
shopMerchant.setAlipayAppId(null);
}
} }
if (shopMerchantParam.getPolyMerchantDTO() != null) { if (shopMerchantParam.getPolyMerchantDTO() != null) {
shopMerchant.setPolyPayJson(JSONObject.toJSONString(shopMerchantParam.getPolyMerchantDTO())); shopMerchant.setPolyPayJson(JSONObject.toJSONString(shopMerchantParam.getPolyMerchantDTO()));
} }
} else { } else {
//不是新增且不是修改 只有进件完成会进入这里 //只有进件会进入这里
if (StrUtil.isBlank(shopMerchant.getRelatedLicenceNo())) { if (shopMerchant.getRelatedId() == null) {
shopMerchant.setRelatedLicenceNo(shopMerchantParam.getRelatedLicenceNo()); shopMerchant.setRelatedId(shopMerchantParam.getShopId());
} }
if (StrUtil.isBlank(shopMerchant.getNativePayJson()) && shopMerchantParam.getNativeMerchantDTO() != null) { if (StrUtil.isBlank(shopMerchant.getNativePayJson()) && shopMerchantParam.getNativeMerchantDTO() != null) {
shopMerchant.setNativePayJson(JSONObject.toJSONString(shopMerchantParam.getNativeMerchantDTO())); shopMerchant.setNativePayJson(JSONObject.toJSONString(shopMerchantParam.getNativeMerchantDTO()));
} }
} }
return saveOrUpdate(shopMerchant); if (shopMerchant.getId() == null) {
return save(shopMerchant);
} else {
return updateById(shopMerchant, false);
}
} }
@Override @Override
@CacheEvict(allEntries = true) @CacheEvict(allEntries = true)
public void upMerchant(@NotBlank String relatedLicenceNo, @NotNull NativeMerchantDTO nativeMerchantDTO) { public void upMerchant(@NotBlank Long relatedId, @NotNull NativeMerchantDTO nativeMerchantDTO) {
ShopMerchant upShopMerchant = new ShopMerchant(); ShopMerchant upShopMerchant = new ShopMerchant();
upShopMerchant.setAlipayAppId(nativeMerchantDTO.getAlipayMerchantId()); upShopMerchant.setAlipayAppId(nativeMerchantDTO.getAlipayMerchantId());
upShopMerchant.setWechatAppId(nativeMerchantDTO.getWechatMerchantId()); upShopMerchant.setWechatAppId(nativeMerchantDTO.getWechatMerchantId());
upShopMerchant.setNativePayJson(JSONObject.toJSONString(nativeMerchantDTO)); upShopMerchant.setNativePayJson(JSONObject.toJSONString(nativeMerchantDTO));
update(upShopMerchant, query().eq(ShopMerchant::getRelatedLicenceNo, relatedLicenceNo)); update(upShopMerchant, query().eq(ShopMerchant::getRelatedId, relatedId));
} }
@Cacheable(key = "#id") @Cacheable(key = "#shopId")
@Override @Override
public ShopMerchant getById(Long shopId) { public ShopMerchant getByShopId(Long shopId) {
ShopMerchant shopMerchant = getOne(query().eq(ShopMerchant::getShopId, shopId)); ShopMerchant shopMerchant = getOne(query().eq(ShopMerchant::getShopId, shopId));
AssertUtil.isNull(shopMerchant, "暂未开通支付."); AssertUtil.isNull(shopMerchant, "暂未开通支付.");
return shopMerchant; return shopMerchant;

View File

@@ -36,7 +36,7 @@ public interface PayAdapter {
CzgResult<Map<String, Object>> pay(@NonNull CzgPayEnum payType, @NotBlank String payData, @NotBlank String domain, CzgResult<Map<String, Object>> pay(@NonNull CzgPayEnum payType, @NotBlank String payData, @NotBlank String domain,
@NotBlank String notifyUrl, CzgPayBaseReq bizData); @NotBlank String notifyUrl, CzgPayBaseReq bizData);
CzgResult<RefundRespDTO> refund(@NotBlank String domain, @NotBlank String payData, String notifyUrl, CzgRefundReq bizData); CzgResult<RefundRespDTO> refund(@NotBlank String domain, @NotBlank String payData, CzgRefundReq bizData);
CzgResult<QueryOrderRespDTO> queryPayOrder(@NotBlank String domain, @NotBlank String payData, String payOrderId, String mchOrderNo, String platform); CzgResult<QueryOrderRespDTO> queryPayOrder(@NotBlank String domain, @NotBlank String payData, String payOrderId, String mchOrderNo, String platform);

View File

@@ -51,9 +51,9 @@ public class NativePayAdapter implements PayAdapter {
} }
@Override @Override
public CzgResult<RefundRespDTO> refund(String domain, String payData, String notifyUrl, CzgRefundReq bizData) { public CzgResult<RefundRespDTO> refund(String domain, String payData, CzgRefundReq bizData) {
NativeMerchantDTO merchantDTO = getMerchantDTO(payData); NativeMerchantDTO merchantDTO = getMerchantDTO(payData);
return CzgResult.success(PayManager.refund(bizData, notifyUrl, merchantDTO)); return CzgResult.success(PayManager.refund(bizData, bizData.getNotifyUrl(), merchantDTO));
} }
@Override @Override

View File

@@ -49,9 +49,8 @@ public class PolyPayAdapter implements PayAdapter {
@Override @Override
public CzgResult<RefundRespDTO> refund(@NotBlank String domain, @NotBlank String payData, String notifyUrl, CzgRefundReq bizData) { public CzgResult<RefundRespDTO> refund(@NotBlank String domain, @NotBlank String payData, CzgRefundReq bizData) {
PolyMerchantDTO shopMerchant = JSONObject.parseObject(payData, PolyMerchantDTO.class); PolyMerchantDTO shopMerchant = JSONObject.parseObject(payData, PolyMerchantDTO.class);
bizData.setNotifyUrl(notifyUrl);
CzgResult<CzgRefundResp> result = PolyPayUtils.refundOrder(domain, shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData); CzgResult<CzgRefundResp> result = PolyPayUtils.refundOrder(domain, shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
return convertRefundResp(result); return convertRefundResp(result);
} }

View File

@@ -8,7 +8,6 @@ import cn.hutool.core.util.StrUtil;
import com.czg.product.entity.Product; import com.czg.product.entity.Product;
import com.czg.product.entity.ProductStockFlow; import com.czg.product.entity.ProductStockFlow;
import com.czg.product.service.ProductStockFlowService; import com.czg.product.service.ProductStockFlowService;
import com.czg.sa.StpKit;
import com.czg.service.product.mapper.ConsInfoMapper; import com.czg.service.product.mapper.ConsInfoMapper;
import com.czg.service.product.mapper.ProductMapper; import com.czg.service.product.mapper.ProductMapper;
import com.czg.service.product.mapper.ProductStockFlowMapper; import com.czg.service.product.mapper.ProductStockFlowMapper;
@@ -44,15 +43,7 @@ public class ProductStockFlowServiceImpl extends ServiceImpl<ProductStockFlowMap
Long shopId = entity.getShopId(); Long shopId = entity.getShopId();
BigDecimal afterNumber = entity.getAfterNumber(); BigDecimal afterNumber = entity.getAfterNumber();
Product product = productMapper.selectOneById(entity.getProductId()); Product product = productMapper.selectOneById(entity.getProductId());
String shopName = ""; String shopName = productMapper.getShopName(shopId);
try {
shopName = StpKit.USER.getShopName();
} catch (Exception e) {
log.error("获取店铺名称失败");
}
if (StrUtil.isEmpty(shopName)) {
shopName = productMapper.getShopName(shopId);
}
BigDecimal warnLine = Convert.toBigDecimal(product.getWarnLine()); BigDecimal warnLine = Convert.toBigDecimal(product.getWarnLine());
// 库存小于警告值,发送消息提醒 // 库存小于警告值,发送消息提醒
if (NumberUtil.isLess(afterNumber, warnLine)) { if (NumberUtil.isLess(afterNumber, warnLine)) {