From 529ad9dd8d1876b57e852bc45b602ba3ccc8df2a Mon Sep 17 00:00:00 2001 From: KKSU <15274802129@163.com> Date: Wed, 10 Apr 2024 17:19:08 +0800 Subject: [PATCH] 公告-首页公告调整 --- src/main/java/cc/mrbird/febs/pay/service/impl/XcxPayServiceImpl.java | 70 +++++++++++++++++++++-------------- 1 files changed, 42 insertions(+), 28 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/pay/service/impl/XcxPayServiceImpl.java b/src/main/java/cc/mrbird/febs/pay/service/impl/XcxPayServiceImpl.java index 110339a..0751acb 100644 --- a/src/main/java/cc/mrbird/febs/pay/service/impl/XcxPayServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/pay/service/impl/XcxPayServiceImpl.java @@ -18,17 +18,11 @@ import cc.mrbird.febs.pay.util.WeixinServiceUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.text.StrFormatter; -import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; -import cn.hutool.extra.spring.SpringUtil; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; -import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; -import com.alibaba.fastjson.JSON; -import com.baomidou.dynamic.datasource.toolkit.Base64; -import com.baomidou.mybatisplus.extension.exceptions.ApiException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; @@ -46,7 +40,6 @@ import java.io.*; import java.math.BigDecimal; -import java.net.*; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.HashMap; @@ -85,9 +78,13 @@ BrandWCPayRequestData payData; String productNames = "小程序充值"; MallMember mallMember = mallMemberMapper.selectById(apiRechargeWalletDto.getMemberId()); - String rechargeNo = "CZ_"+MallUtils.getOrderNum(); + String rechargeNo = apiRechargeWalletDto.getRechargeNo(); + Long agentApplyId = apiRechargeWalletDto.getAgentApplyId() == null ? 0L : apiRechargeWalletDto.getAgentApplyId(); Boolean debug = xcxProperties.getDebug(); - String attrStr = "{'rechargeNo':"+rechargeNo+",'memberId':"+mallMember.getId()+"}"; + String attrStr = "{'rechargeNo':"+rechargeNo + +",'memberId':"+mallMember.getId() + +",'agentApplyId':"+agentApplyId + +",'type':"+apiRechargeWalletDto.getType()+"}"; if (debug) { payData = weixinServiceUtil.createRechargeWallet("[测试]" + productNames, rechargeNo, 1, mallMember.getOpenId(), attrStr); @@ -95,13 +92,6 @@ payData = weixinServiceUtil.createRechargeWallet(productNames, rechargeNo, unit.multiply(money).intValue(),mallMember.getOpenId(), attrStr); } - mallMoneyFlowService.addMoneyFlow( - mallMember.getId(), - money, - MoneyFlowTypeEnum.RECHARGE.getValue(), - rechargeNo, - FlowTypeEnum.BALANCE.getValue(), - "余额充值",1); return payData; } @@ -225,10 +215,10 @@ orderStateMsgVo.setTemplate_id(info.getTemplateId());//订阅消息模板id orderStateMsgVo.setPage(info.getPage()); Map<String, WxTemplateData> m = new HashMap<>(4); - m.put("character_string2", new WxTemplateData(info.getOrderNo())); - m.put("thing11", new WxTemplateData(info.getGoodsName())); - m.put("amount1", new WxTemplateData(info.getAmount())); - m.put("character_string9", new WxTemplateData(info.getTakeCode())); + m.put("thing19", new WxTemplateData(info.getAddressArea())); + m.put("phone_number18", new WxTemplateData(info.getLeaderPhone())); + m.put("thing3", new WxTemplateData(info.getGoodsName())); + m.put("thing15", new WxTemplateData(info.getRemark())); orderStateMsgVo.setData(m); String s = JSONUtil.toJsonStr(orderStateMsgVo); log.info(s); @@ -286,12 +276,15 @@ } @Override - public List<String> getTemplateId() { - List<String> wxTemplates = new ArrayList<>(); - List<DataDictionaryCustom> wxTemplateList = dataDictionaryCustomMapper.selectDicByType(DataDictionaryEnum.WX_TEMPLATE_ID_ONE.getType()); + public List<HashMap<String, String>> getTemplateId() { + List<HashMap<String, String>> wxTemplates = new ArrayList<>(); + List<DataDictionaryCustom> wxTemplateList = dataDictionaryCustomMapper.selectDicByType(DataDictionaryEnum.WX_TEMPLATE_ID_THREE.getType()); if(CollUtil.isNotEmpty(wxTemplateList)){ for(DataDictionaryCustom dic : wxTemplateList){ - wxTemplates.add(dic.getValue()); + HashMap<String, String> objectObjectHashMap = new HashMap<>(); + objectObjectHashMap.put("name",dic.getCode()); + objectObjectHashMap.put("value",dic.getValue()); + wxTemplates.add(objectObjectHashMap); } } return wxTemplates; @@ -326,6 +319,17 @@ } } + if (type == 3) { + String inviteId = wxGenerateQrCodeDto.getTypeParam(); + MallMember member = mallMemberMapper.selectInfoByInviteId(inviteId); + if(ObjectUtil.isNotNull(member)){ + String wxCodeImg = member.getInviteImg(); + if(StrUtil.isNotBlank(wxCodeImg)){ + return new FebsResponse().success().data(wxCodeImg); + } + } + } + String randomNum = MallUtils.getRandomNum(5); String imgName="/user_" + randomNum + "_acode_1.jpg"; String codeImgPath = generateAcode(wxGenerateQrCodeDto.getScene(), wxGenerateQrCodeDto.getPage(), imgName, "400px", null); @@ -340,6 +344,15 @@ MallTeamLeader mallTeamLeader = mallTeamLeaderMapper.selectLeaderByUniqueCode(uniqueCode); mallTeamLeader.setWxCodeImg(codeImgPath); mallTeamLeaderMapper.updateById(mallTeamLeader); + } + + if (type == 3) { + String inviteId = wxGenerateQrCodeDto.getTypeParam(); + MallMember member = mallMemberMapper.selectInfoByInviteId(inviteId); + if(ObjectUtil.isNotNull(member)){ + member.setInviteImg(codeImgPath); + mallMemberMapper.updateById(member); + } } return new FebsResponse().success().data(codeImgPath); } @@ -399,9 +412,9 @@ * @return */ //图片上传路径 - public static final String IMG_UPLOAD_PATH="/mnt/sdc/webresource/groupbuy/wxcode"; + public static final String IMG_UPLOAD_PATH="/mnt/sdc/webresource/blnka/wxcode"; public String generateAcode(String scene,String path,String imgName,String width, Integer type){ - String urlPrefix="https://hwfile.csxuncong.com/groupbuy/wxcode"; + String urlPrefix="https://file.blnka.cn/blnka/wxcode"; String imgPath=IMG_UPLOAD_PATH+imgName; if(!FileUtil.exist(imgPath)){ @@ -410,12 +423,12 @@ String url = null; if (type == null) { // 该接口无数量限制,但是 scene 传参最大字符长度为32个字符 - url = StrFormatter.format("https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={}",redisUtils.get(WechatConfigure.WX_ACCESS_TOKEN_REDIS_KEY).toString()); + url = StrUtil.format("https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={}",redisUtils.get(WechatConfigure.WX_ACCESS_TOKEN_REDIS_KEY).toString()); obj.set("scene", scene); obj.set("page", path); } else { // 该接口存在数量限制, 总共可生成10w个, 但参数是接在path后面 - url = StrFormatter.format("https://api.weixin.qq.com/wxa/getwxacode?access_token={}", redisUtils.get(WechatConfigure.WX_ACCESS_TOKEN_REDIS_KEY).toString()); + url = StrUtil.format("https://api.weixin.qq.com/wxa/getwxacode?access_token={}", redisUtils.get(WechatConfigure.WX_ACCESS_TOKEN_REDIS_KEY).toString()); obj.set("page", path + "?" + scene ); } @@ -431,6 +444,7 @@ obj.set("is_hyaline", false); try { HttpResponse execute = HttpRequest.post(url).body(obj.toString(), "application/json").execute(); + log.error("微信返回值:{}", execute.body()); InputStream inputStream = execute.bodyStream(); File file = new File(imgPath); FileUtil.writeFromStream(inputStream, file); -- Gitblit v1.9.1