From 2ae7d73e29010a1f1b43c3b71f6789c16c2c3128 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Mon, 19 May 2025 14:39:09 +0800
Subject: [PATCH] fix(mall): 修复完善信息赠送新人礼逻辑
---
src/main/java/cc/mrbird/febs/mall/controller/AdminSystemController.java | 69 +++++++++++++++++++++++-----------
1 files changed, 46 insertions(+), 23 deletions(-)
diff --git a/src/main/java/cc/mrbird/febs/mall/controller/AdminSystemController.java b/src/main/java/cc/mrbird/febs/mall/controller/AdminSystemController.java
index bef7b04..36b5d3a 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/AdminSystemController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/AdminSystemController.java
@@ -2,7 +2,9 @@
import cc.mrbird.febs.common.annotation.ControllerEndpoint;
import cc.mrbird.febs.common.entity.FebsResponse;
+import cc.mrbird.febs.common.enumerates.CommonDictionaryEnum;
import cc.mrbird.febs.common.enumerates.DataDictionaryEnum;
+import cc.mrbird.febs.common.utils.AppContants;
import cc.mrbird.febs.mall.dto.*;
import cc.mrbird.febs.mall.entity.DataDictionaryCustom;
import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper;
@@ -29,6 +31,8 @@
import java.io.IOException;
import java.math.BigDecimal;
import java.security.KeyPair;
+import java.security.NoSuchAlgorithmException;
+import java.security.PrivateKey;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -136,39 +140,34 @@
DataDictionaryEnum.FP_CALLBACK_URL.getCode(),
faPiaoDto.getCallbackUrl()
);
- KeyPair privateKey = wxFaPiaoService.getPrivateKey();
HeaderDto headerDto = new HeaderDto();
- headerDto.setCallback_url(faPiaoDto.getCallbackUrl());
+ headerDto.setCallback_url("https://api.blnka.cn/api/xcxPay/fapiaoCallBack");
headerDto.setShow_fapiao_cell(false);
String parseObj = JSONUtil.parseObj(headerDto).toString();
String baseUrl = "https://api.mch.weixin.qq.com";
String canonicalUrl = "/v3/new-tax-control-fapiao/merchant/development-config";
- String postStr = wxFaPiaoService.createAuthorization(
- "POST",
- canonicalUrl,
- parseObj,
- privateKey
- );
- // 创建httppost
+ String postStr = null;
try {
- HttpClient httpClient = new HttpClient();
- PostMethod post = new PostMethod(baseUrl+canonicalUrl);
- post.setRequestHeader("Accept", "application/json");
- post.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36");
- post.setRequestHeader("Content-Type", "application/json");
- post.setRequestHeader("Connection", "keep-alive");
- post.setRequestHeader("Authorization", "WECHATPAY2-SHA256-RSA2048 "+postStr);
- RequestEntity entity = new StringRequestEntity(parseObj, "text/html", "utf-8");
- post.setRequestEntity(entity);
- httpClient.executeMethod(post);
- String responseBodyAsString = post.getResponseBodyAsString();
- cn.hutool.json.JSONObject maps = JSONUtil.parseObj(responseBodyAsString);
- System.out.println(maps);
+
+ PrivateKey privateKey = wxFaPiaoService.getPrivateKeyV3();
+ postStr = wxFaPiaoService.createAuthorization(
+ "PATCH",
+ baseUrl+canonicalUrl,
+ parseObj,
+ privateKey
+ );
+ } catch (NoSuchAlgorithmException e) {
+ e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
- return new FebsResponse().success().message("操作成功");
+ String token = AppContants.FP_TOKEN_HEADER_TYPE+postStr;
+ System.out.println("WECHATPAY2-SHA256-RSA2048 "+postStr);
+ String s = wxFaPiaoService.sendPatch(baseUrl + canonicalUrl, parseObj, token);
+ log.info("配置开发选项:"+s);
+
+ return new FebsResponse().success().message(s);
}
@PostMapping(value = "/agentDetail")
@@ -199,6 +198,30 @@
return new FebsResponse().success();
}
+ @PostMapping(value = "/indexPngSet")
+ public FebsResponse indexPngSet(AdminIndexVideoDto adminIndexVideoDto) {
+// DataDictionaryCustom pngDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
+// CommonDictionaryEnum.PNG_URL_INDEX.getType(),
+// CommonDictionaryEnum.PNG_URL_INDEX.getCode()
+// );
+// if(ObjectUtil.isEmpty(pngDic)){
+// return new FebsResponse().fail().message("请刷新页面重试");
+// }
+// pngDic.setValue(adminIndexVideoDto.getPngUrl());
+// dataDictionaryCustomMapper.updateById(pngDic);
+
+ DataDictionaryCustom timeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
+ CommonDictionaryEnum.TIME_URL_INDEX.getType(),
+ CommonDictionaryEnum.TIME_URL_INDEX.getCode()
+ );
+ if(ObjectUtil.isEmpty(timeDic)){
+ return new FebsResponse().fail().message("请刷新页面重试");
+ }
+ timeDic.setValue(adminIndexVideoDto.getTimeStop());
+ dataDictionaryCustomMapper.updateById(timeDic);
+ return new FebsResponse().success();
+ }
+
// public static void main(String[] args) {
// List<Integer> lines = Arrays.asList(new Integer[]{1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0});
// //数字连续出现的计数
--
Gitblit v1.9.1