feat(shop): 新增公众号openid支持并优化提现通知逻辑
- 在ShopDealerWithdraw实体中增加officeOpenid字段用于存储公众号openid - 更新数据库查询SQL以包含新的office_openid字段 - 修改PushTemplateMessageController中的模板消息发送逻辑,使用 officeOpenid替代openId作为用户标识 - 为ShopDealerWithdrawParam参数类添加openId和officeOpenid查询字段 - 在推送提现到账通知接口中增加对officeOpenid空值的校验 - 调整小程序跳转路径,根据不同场景设置不同的页面地址 - 引入StrUtil工具类以进行字符串判空操作
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.gxwebsoft.sdy.controller;
|
package com.gxwebsoft.sdy.controller;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
@@ -151,7 +152,8 @@ public class PushTemplateMessageController extends BaseController {
|
|||||||
templateMessageRequest.setTemplateId("fJOb0ZPs_HCQO6tdqPRTfaELGgjH5s8a6Vm9X9Hxgrk");
|
templateMessageRequest.setTemplateId("fJOb0ZPs_HCQO6tdqPRTfaELGgjH5s8a6Vm9X9Hxgrk");
|
||||||
final TemplateMessageRequest.MiniProgram miniProgram = new TemplateMessageRequest.MiniProgram();
|
final TemplateMessageRequest.MiniProgram miniProgram = new TemplateMessageRequest.MiniProgram();
|
||||||
miniProgram.setAppid(appId);
|
miniProgram.setAppid(appId);
|
||||||
miniProgram.setPagepath("pages/index/index"); // dealer/withdraw/admin
|
// miniProgram.setPagepath("dealer/withdraw/admin");
|
||||||
|
miniProgram.setPagepath("pages/index/index");
|
||||||
templateMessageRequest.setMiniprogram(miniProgram);
|
templateMessageRequest.setMiniprogram(miniProgram);
|
||||||
HashMap<String, TemplateMessageRequest.TemplateDataItem> map = new HashMap<>();
|
HashMap<String, TemplateMessageRequest.TemplateDataItem> map = new HashMap<>();
|
||||||
map.put("amount1", new TemplateMessageRequest.TemplateDataItem(shopDealerWithdraw.getMoney().toString()));
|
map.put("amount1", new TemplateMessageRequest.TemplateDataItem(shopDealerWithdraw.getMoney().toString()));
|
||||||
@@ -173,14 +175,17 @@ public class PushTemplateMessageController extends BaseController {
|
|||||||
@Operation(summary = "提现到账通知提醒")
|
@Operation(summary = "提现到账通知提醒")
|
||||||
@PostMapping("/pushNoticeOfWithdrawalToAccount")
|
@PostMapping("/pushNoticeOfWithdrawalToAccount")
|
||||||
public ApiResult<?> pushNoticeOfWithdrawalToAccount(@RequestBody ShopDealerWithdraw shopDealerWithdraw) {
|
public ApiResult<?> pushNoticeOfWithdrawalToAccount(@RequestBody ShopDealerWithdraw shopDealerWithdraw) {
|
||||||
|
if (StrUtil.isBlank(shopDealerWithdraw.getOfficeOpenid())) {
|
||||||
|
return fail("请传入公众号openid");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
// 发送模板消息
|
// 发送模板消息
|
||||||
final TemplateMessageRequest templateMessageRequest = new TemplateMessageRequest();
|
final TemplateMessageRequest templateMessageRequest = new TemplateMessageRequest();
|
||||||
templateMessageRequest.setToUser(shopDealerWithdraw.getOpenId());
|
templateMessageRequest.setToUser(shopDealerWithdraw.getOfficeOpenid());
|
||||||
templateMessageRequest.setTemplateId("QnmEjyEBmodtfnDsflDwVS1mmh4v_hql-TCDxi2ADs8");
|
templateMessageRequest.setTemplateId("QnmEjyEBmodtfnDsflDwVS1mmh4v_hql-TCDxi2ADs8");
|
||||||
final TemplateMessageRequest.MiniProgram miniProgram = new TemplateMessageRequest.MiniProgram();
|
final TemplateMessageRequest.MiniProgram miniProgram = new TemplateMessageRequest.MiniProgram();
|
||||||
miniProgram.setAppid(appId);
|
miniProgram.setAppid(appId);
|
||||||
miniProgram.setPagepath("pages/index/index");
|
miniProgram.setPagepath("dealer/withdraw/admin");
|
||||||
templateMessageRequest.setMiniprogram(miniProgram);
|
templateMessageRequest.setMiniprogram(miniProgram);
|
||||||
HashMap<String, TemplateMessageRequest.TemplateDataItem> map = new HashMap<>();
|
HashMap<String, TemplateMessageRequest.TemplateDataItem> map = new HashMap<>();
|
||||||
map.put("thing13", new TemplateMessageRequest.TemplateDataItem(shopDealerWithdraw.getBankAccount()));
|
map.put("thing13", new TemplateMessageRequest.TemplateDataItem(shopDealerWithdraw.getBankAccount()));
|
||||||
|
|||||||
@@ -90,6 +90,10 @@ public class ShopDealerWithdraw implements Serializable {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String openId;
|
private String openId;
|
||||||
|
|
||||||
|
@Schema(description = "公众号openId")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String officeOpenid;
|
||||||
|
|
||||||
@Schema(description = "租户id")
|
@Schema(description = "租户id")
|
||||||
private Integer tenantId;
|
private Integer tenantId;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<!-- 关联查询sql -->
|
<!-- 关联查询sql -->
|
||||||
<sql id="selectSql">
|
<sql id="selectSql">
|
||||||
SELECT a.*, b.nickname, b.phone AS phone, b.avatar,b.openid, c.real_name as realName
|
SELECT a.*, b.nickname, b.phone AS phone, b.avatar,b.openid,b.office_openid, c.real_name as realName
|
||||||
FROM shop_dealer_withdraw a
|
FROM shop_dealer_withdraw a
|
||||||
LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id
|
LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id
|
||||||
LEFT JOIN gxwebsoft_core.sys_user_verify c ON a.user_id = c.user_id AND c.status = 1
|
LEFT JOIN gxwebsoft_core.sys_user_verify c ON a.user_id = c.user_id AND c.status = 1
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.gxwebsoft.shop.param;
|
package com.gxwebsoft.shop.param;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||||
import com.gxwebsoft.common.core.web.BaseParam;
|
import com.gxwebsoft.common.core.web.BaseParam;
|
||||||
@@ -73,4 +75,12 @@ public class ShopDealerWithdrawParam extends BaseParam {
|
|||||||
@Schema(description = "上传支付凭证")
|
@Schema(description = "上传支付凭证")
|
||||||
private String image;
|
private String image;
|
||||||
|
|
||||||
|
@Schema(description = "微信openId")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private String openId;
|
||||||
|
|
||||||
|
@Schema(description = "公众号openId")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private String officeOpenid;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user