| | |
| | | cacheKey = "rs-" + StringUtil.Md5(cacheKey);
|
| | | // jiedis原子性做拦截
|
| | | Jedis jedis = jedisPool.getResource();
|
| | | long threadId= Thread.currentThread().getId();
|
| | | LogHelper.test("进入拦截:"+cacheKey+"-"+threadId);
|
| | | try {
|
| | | Constant.waitingThreadSet.add(Thread.currentThread().getId());
|
| | | Constant.waitingThreadSet.add(threadId);
|
| | | long result = 0;
|
| | | long startTime = System.currentTimeMillis();
|
| | | // 等待响应
|
| | |
| | | LogHelper.error("触发并发锁:" + cacheAlias);
|
| | | LogHelper.error("redis键:" + cacheKey);
|
| | | if (result <= 0) {
|
| | | LogHelper.test("等待:"+threadId);
|
| | | try {
|
| | | Thread.sleep(50);
|
| | | } catch (InterruptedException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | if (System.currentTimeMillis() - startTime > 1000 * 60L) {
|
| | | if (System.currentTimeMillis() - startTime > 1000 * 30L) {
|
| | | Constant.waitingThreadSet.remove(Thread.currentThread().getId());
|
| | | out.print(JsonUtil.loadFalseResult("连接超时"));
|
| | | return null;
|
| | |
| | | } else {
|
| | | // 设置30秒处理时间
|
| | | jedis.expire(cacheKey, 30);
|
| | | LogHelper.test("获取到锁:"+threadId);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } finally {
|
| | | LogHelper.test("方法执行完毕:"+threadId);
|
| | | jedis.del(cacheKey);
|
| | | Constant.waitingThreadSet.remove(Thread.currentThread().getId());
|
| | | LogHelper.test("释放锁:"+threadId);
|
| | | }
|
| | | }
|
| | | } finally {
|
| | |
| | |
|
| | | try {
|
| | | ShareInfoVO shareInfo = new ShareInfoVO();
|
| | | // 测试
|
| | | List<String> commentTexts = new ArrayList<>();
|
| | | commentTexts.add("口令1");
|
| | | commentTexts.add("口令2口令口令淘口令口令口令淘口令");
|
| | | commentTexts.add("口令3");
|
| | | commentTexts.add("口令口令淘口令口令口令淘口令口令口令淘口令口令口令淘口令口令口令淘口令口令口令淘口令");
|
| | | shareInfo.setCommentTexts(commentTexts);
|
| | | shareInfo.setWxErCode("这是微信分享二维码内容");
|
| | |
|
| | | TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, goodsId, relationId);
|
| | |
|
| | |
| | | <if test="stateList!=null"> |
| | | <foreach collection="stateList" item="state" open=" and (" |
| | | close=")" separator=" or ">so_state=#{state}</foreach> |
| | | order by so_id desc limit #{start},#{count} |
| | | </if> |
| | | order by so_id desc limit #{start},#{count} |
| | | </select> |
| | | <select id="countByUid" resultType="java.lang.Long"> |
| | | select count(*) from yeshi_ec_shop_order where so_uid = #{uid} |
| | |
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.yeshi.utils.entity.wx.WXAPPInfo;
|
| | | import org.yeshi.utils.exception.WXOrderException;
|
| | | import org.yeshi.utils.wx.WXPayUtil;
|
| | |
|
| | | import com.aliyun.openservices.ons.api.Message;
|
| | | import com.aliyun.openservices.ons.api.Producer;
|
| | |
| | | BanLiShopOrder update = new BanLiShopOrder();
|
| | | update.setId(order.getId());
|
| | | update.setOrderNo(orderNo);
|
| | | order.setOrderNo(orderNo);
|
| | | banLiShopOrderMapper.updateByPrimaryKeySelective(update);
|
| | |
|
| | | // 订单添加成功 ,延时通知后续
|
| | |
| | |
|
| | | // 支付成功
|
| | | BanLiShopOrder update = new BanLiShopOrder();
|
| | | update.setId(orderId);
|
| | | update.setMoneyPaymentState(BanLiShopOrder.PAY_STATE_PAID);
|
| | | // 判断其他待支付项是否已经支付
|
| | | update.setUpdateTime(new Date());
|
| | |
| | | */
|
| | | public static boolean refund(String orderNo, BigDecimal money) throws WXOrderException {
|
| | | boolean success = WXPayUtil.refund(BanLiShopOrderUtil.getWXPayOrderNo(orderNo), money, money, null,
|
| | | new WXAPPInfo(), MCH_ID, BanLiShopWXPayUtil.class.getClassLoader().getResourceAsStream(MCH_CERT_PATH));
|
| | | new WXAPPInfo(Constant.getWXAccount(null, null).getGzAppId(),
|
| | | Constant.getWXAccount(null, null).getGzAppSecret(), MCH_ID, MCH_KEY), MCH_ID, BanLiShopWXPayUtil.class.getClassLoader().getResourceAsStream(MCH_CERT_PATH));
|
| | | return success;
|
| | | }
|
| | |
|
| | |
| | | package com.yeshi.fanli.vo.goods;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.List;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | |
|
| | |
| | | // 分享文字
|
| | | @Expose
|
| | | private String shareText;
|
| | | |
| | |
|
| | | // 分享文字-无标题
|
| | | @Expose
|
| | | private String descText;
|
| | |
| | | // 分享金额
|
| | | @Expose
|
| | | private String shareMoney;
|
| | | |
| | |
|
| | | // 淘礼金红包
|
| | | @Expose
|
| | | private String spreadMoney;
|
| | | |
| | |
|
| | | // 淘礼金ID
|
| | | @Expose
|
| | | private String tljId;
|
| | | |
| | |
|
| | | // 淘礼金余额
|
| | | @Expose
|
| | | private String surplusMoney;
|
| | | |
| | |
|
| | | // 评论区文案 2.0.2新增
|
| | | @Expose
|
| | | private List<String> commentTexts;
|
| | |
|
| | | @Expose
|
| | | private String wxErCode;// 微信二维码内容
|
| | |
|
| | | public List<String> getCommentTexts() {
|
| | | return commentTexts;
|
| | | }
|
| | |
|
| | | public void setCommentTexts(List<String> commentTexts) {
|
| | | this.commentTexts = commentTexts;
|
| | | }
|
| | |
|
| | | public String getWxErCode() {
|
| | | return wxErCode;
|
| | | }
|
| | |
|
| | | public void setWxErCode(String wxErCode) {
|
| | | this.wxErCode = wxErCode;
|
| | | }
|
| | |
|
| | | public String getShareId() {
|
| | | return shareId;
|
| | | }
|
| | |
| | | package org.yeshi.utils.wx;
|
| | |
|
| | | import java.io.InputStream;
|
| | | import java.io.UnsupportedEncodingException;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.HashMap;
|
| | | import java.util.Map;
|
| | |
| | | String entity = WXUtil.loadWXMessage(map);
|
| | |
|
| | | String result = HttpUtil.post("https://api.mch.weixin.qq.com/pay/unifiedorder", entity);
|
| | | System.out.println("统一下单结果:" + result);
|
| | | try {
|
| | | System.out.println("统一下单结果:" + new String( result.getBytes("GBK"),"UTF-8"));
|
| | | } catch (UnsupportedEncodingException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | Map<String, String> resultMap = WXUtil.parseXML(result);
|
| | |
|
| | | return resultMap;
|