|
@@ -118,6 +118,32 @@ public class IntegralShoppingMallController {
|
|
|
integralOrder.setIntegralOrderNo(integralOrderNo);
|
|
|
integralOrder.setExchangeTime(new Date());
|
|
|
|
|
|
+ String gzhAppId ="";
|
|
|
+ String gzhAppSecret ="";
|
|
|
+ String stationName = ""; //油站名称
|
|
|
+ Map<String, String> m = stationService.getStationAppIdAndAppSecret(request.getStationId());
|
|
|
+ if(m !=null && m.containsKey("stationName") && m.containsKey("gzhAppId") && m.containsKey("gzhAppSecret")){
|
|
|
+ stationName = m.get("stationName");
|
|
|
+ gzhAppId = m.get("gzhAppId");
|
|
|
+ gzhAppSecret = m.get("gzhAppSecret");
|
|
|
+ integralOrder.setStationName(stationName);
|
|
|
+ customerPointsRecord.setStationName(stationName);
|
|
|
+ String accessToken ="";
|
|
|
+ if(!redisCacheUtil.hasKey(gzhAppId)){
|
|
|
+ accessToken = WeiXinUserUtil.getToken(gzhAppId, gzhAppSecret).getAccessToken();
|
|
|
+ redisCacheUtil.setCacheObject(gzhAppId, accessToken);
|
|
|
+ redisCacheUtil.expire(gzhAppId, 7200);
|
|
|
+ }else {
|
|
|
+ accessToken = redisCacheUtil.getCacheObject(gzhAppId);
|
|
|
+ }
|
|
|
+ net.sf.json.JSONObject unionIdInfo = WeiXinUserUtil.getUnionIdInfo(accessToken, request.getOpenId());
|
|
|
+ if(unionIdInfo !=null && unionIdInfo.containsKey("unoinId")){
|
|
|
+ integralOrder.setUnionId(unionIdInfo.get("unoinId").toString());
|
|
|
+ customerPoints.setUnionId(unionIdInfo.get("unoinId").toString());
|
|
|
+ customerPointsRecord.setUnionId(unionIdInfo.get("unoinId").toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//更新用户积分
|
|
|
String surplusPoints =""; //剩余积分
|
|
|
String orderSumIntegral =""; //订单消费总积分
|
|
@@ -135,21 +161,9 @@ public class IntegralShoppingMallController {
|
|
|
customerPointsService.updateCustomerPointsInfo(customerPoints);
|
|
|
}
|
|
|
|
|
|
- String gzhAppId ="";
|
|
|
- String gzhAppSecret ="";
|
|
|
- String stationName = ""; //油站名称
|
|
|
- Map<String, String> m = stationService.getStationAppIdAndAppSecret(request.getStationId());
|
|
|
- if(m !=null && m.containsKey("stationName") && m.containsKey("gzhAppId") && m.containsKey("gzhAppSecret")){
|
|
|
- stationName = m.get("stationName");
|
|
|
- gzhAppId = m.get("gzhAppId");
|
|
|
- gzhAppSecret = m.get("gzhAppSecret");
|
|
|
- integralOrder.setStationName(stationName);
|
|
|
- customerPointsRecord.setStationName(stationName);
|
|
|
- }
|
|
|
-
|
|
|
+ //更新商品已售数量
|
|
|
List<IntegralWares> integralWaresInfoList = integralWaresService.getIntegralWaresInfoList(integralWares);
|
|
|
if(integralWaresInfoList !=null && integralWaresInfoList.size() ==1){
|
|
|
- //更新商品已售数量
|
|
|
integralWares.setWaresOutCount(integralWaresInfoList.get(0).getWaresOutCount()+1);
|
|
|
integralWares.setWaresCount(integralWaresInfoList.get(0).getWaresCount()-1);
|
|
|
integralWaresService.updateIntegralWaresInfo(integralWares);
|