Commit e599c060 authored by gaoyingwei's avatar gaoyingwei

修改 活动下单支付

parent a894b60b
...@@ -9,6 +9,8 @@ import org.rcisoft.app.pay.service.WxPayService; ...@@ -9,6 +9,8 @@ import org.rcisoft.app.pay.service.WxPayService;
import org.rcisoft.business.cmsActivity.entity.CmsActivity; import org.rcisoft.business.cmsActivity.entity.CmsActivity;
import org.rcisoft.business.cmsOrder.dao.CmsOrderRepository; import org.rcisoft.business.cmsOrder.dao.CmsOrderRepository;
import org.rcisoft.business.cmsOrder.entity.CmsOrder; import org.rcisoft.business.cmsOrder.entity.CmsOrder;
import org.rcisoft.business.memInfo.dao.MemInfoRepository;
import org.rcisoft.business.memInfo.entity.MemInfo;
import org.rcisoft.core.exception.CyServiceException; import org.rcisoft.core.exception.CyServiceException;
import org.rcisoft.core.model.CyPersistModel; import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.rabbitmq.bean.RabbitMQConfigBean; import org.rcisoft.core.rabbitmq.bean.RabbitMQConfigBean;
...@@ -73,6 +75,9 @@ public class WxPayServiceImpl implements WxPayService { ...@@ -73,6 +75,9 @@ public class WxPayServiceImpl implements WxPayService {
@Autowired @Autowired
private CmsOrderRepository orderInfoRepository; private CmsOrderRepository orderInfoRepository;
@Autowired
private MemInfoRepository memInfoRepository;
@Value("${wx.appId}") @Value("${wx.appId}")
private String appId; private String appId;
...@@ -91,6 +96,11 @@ public class WxPayServiceImpl implements WxPayService { ...@@ -91,6 +96,11 @@ public class WxPayServiceImpl implements WxPayService {
@Override @Override
public JSONObject wxPay(Long orderId, Long activityId, HttpServletRequest request) throws IOException, JDOMException { public JSONObject wxPay(Long orderId, Long activityId, HttpServletRequest request) throws IOException, JDOMException {
//添加实名判断
String userId = CyUserUtil.getAuthenBusinessId();
MemInfo memInfo = memInfoRepository.getInfoByUserId(userId);
if (!"1".equals(memInfo.getMemRealAuthen()))
throw new CyServiceException("您未实名认证,不能报名");
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
// try{ // try{
//redis key: 【order:activity:${aid}:${oid}】 value 【hash】;status -> 待支付 ,可以进行支付 //redis key: 【order:activity:${aid}:${oid}】 value 【hash】;status -> 待支付 ,可以进行支付
...@@ -178,9 +188,11 @@ public class WxPayServiceImpl implements WxPayService { ...@@ -178,9 +188,11 @@ public class WxPayServiceImpl implements WxPayService {
// 将解析结果存储在HashMap中 // 将解析结果存储在HashMap中
Map map = PayUtil.doXMLParse(result); Map map = PayUtil.doXMLParse(result);
String returnCode = (String) map.get("return_code");//返回状态码 String returnCode = (String) map.get("return_code");//返回状态码
String resultCode = (String) map.get("result_code");//返回状态码
//返回给移动端需要的参数 //返回给移动端需要的参数
Map<String, Object> response = new HashMap<>(); Map<String, Object> response = new HashMap<>();
if(Objects.equals(returnCode, "SUCCESS")){ if(Objects.equals(returnCode, "SUCCESS") && Objects.equals(resultCode, "SUCCESS")){
json.put("success", true);
// 业务结果 // 业务结果
String prepayId = (String) map.get("prepay_id");//返回的预付单信息 String prepayId = (String) map.get("prepay_id");//返回的预付单信息
response.put("nonceStr", nonceStr); response.put("nonceStr", nonceStr);
...@@ -218,8 +230,10 @@ public class WxPayServiceImpl implements WxPayService { ...@@ -218,8 +230,10 @@ public class WxPayServiceImpl implements WxPayService {
log.error("释放成功"); log.error("释放成功");
} }
} else } else {
response.put("err_code_des",map.get("err_code_des")); json.put("success", false);
response.put("err_code_des", map.get("err_code_des"));
}
response.put("appid", appId); response.put("appid", appId);
json.put("errMsg", "OK"); json.put("errMsg", "OK");
json.put("data", response); json.put("data", response);
......
...@@ -13,6 +13,8 @@ import org.rcisoft.business.cmsActivity.service.impl.StockService; ...@@ -13,6 +13,8 @@ import org.rcisoft.business.cmsActivity.service.impl.StockService;
import org.rcisoft.business.cmsApplication.dao.CmsApplicationRepository; import org.rcisoft.business.cmsApplication.dao.CmsApplicationRepository;
import org.rcisoft.business.cmsApplication.entity.CmsApplication; import org.rcisoft.business.cmsApplication.entity.CmsApplication;
import org.rcisoft.business.cmsOrder.dto.OrderActivityDto; import org.rcisoft.business.cmsOrder.dto.OrderActivityDto;
import org.rcisoft.business.memInfo.dao.MemInfoRepository;
import org.rcisoft.business.memInfo.entity.MemInfo;
import org.rcisoft.core.async.AsyncFactory; import org.rcisoft.core.async.AsyncFactory;
import org.rcisoft.core.exception.CyServiceException; import org.rcisoft.core.exception.CyServiceException;
import org.rcisoft.core.rabbitmq.bean.RabbitMQConfigBean; import org.rcisoft.core.rabbitmq.bean.RabbitMQConfigBean;
...@@ -89,6 +91,9 @@ public class CmsOrderServiceImpl extends ServiceImpl<CmsOrderRepository,CmsOrder ...@@ -89,6 +91,9 @@ public class CmsOrderServiceImpl extends ServiceImpl<CmsOrderRepository,CmsOrder
@Autowired @Autowired
private CmsApplicationRepository applicationRepository; private CmsApplicationRepository applicationRepository;
@Autowired
private MemInfoRepository memInfoRepository;
/** /**
* 保存 订单信息表 * 保存 订单信息表
* @param cmsOrder * @param cmsOrder
...@@ -99,9 +104,11 @@ public class CmsOrderServiceImpl extends ServiceImpl<CmsOrderRepository,CmsOrder ...@@ -99,9 +104,11 @@ public class CmsOrderServiceImpl extends ServiceImpl<CmsOrderRepository,CmsOrder
public CyPersistModel persist(CmsOrder cmsOrder){ public CyPersistModel persist(CmsOrder cmsOrder){
//增加操作 //增加操作
int line = 1; int line = 1;
// int line = baseMapper.insert(cmsOrder); //添加实名判断
// log.debug(CyUserUtil.getAuthenUsername()+"新增了ID为"+ String userId = CyUserUtil.getAuthenBusinessId();
// cmsOrder.getBusinessId()+"的订单信息表信息"); MemInfo memInfo = memInfoRepository.getInfoByUserId(userId);
if (!"1".equals(memInfo.getMemRealAuthen()))
throw new CyServiceException("您未实名认证,不能报名");
//加redis锁 //加redis锁
boolean isGetLock = false; boolean isGetLock = false;
RLock lock = redissonClient.getLock(RedisCons.ACTIVITY_INFO + cmsOrder.getGoodsId()); RLock lock = redissonClient.getLock(RedisCons.ACTIVITY_INFO + cmsOrder.getGoodsId());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment