Commit 6a0cabba by zhiheng.zhang

取餐码从换从中获取

parent 3f59dab0
......@@ -137,6 +137,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.util.StringUtil;
......@@ -256,6 +257,8 @@ public class OrderServiceImpl implements Orderservice {
private OfflineCouponSdkService offlineCouponSdkService;
@Autowired
private DeliveryFeiginClient deliveryFeiginClient;
@Autowired
private RedisTemplate redisTemplate;
@Override
public BaseResponse checkBeforeCreateOrder(CheckBeforeCreateOrderRequestVo requestVo) {
......@@ -439,8 +442,11 @@ public class OrderServiceImpl implements Orderservice {
//orderRefund(orderBean, "订单异常退款", openid, oid);
return gson.toJson(message);
}
//获取生态缓存中的配置项,如果mealCodeRule的值不为空并且值等于2,则随机生成取参数,当日不重复
String mealCodeRule = redisCache.getValue("mealCodeRule");
List<AssortmentOpenPlatformPartnerWxappConfig> partnerWxappConfigs = this.cacheSelectDefaultPage(wxappid, "2");
Map<String, AssortmentOpenPlatformPartnerWxappConfig> configMap = partnerWxappConfigs.stream().collect(Collectors.toMap(AssortmentOpenPlatformPartnerWxappConfig::getAppKey, Function.identity()));
AssortmentOpenPlatformPartnerWxappConfig refundDeliveryFeeConfig = configMap.get("mealCodeRule");
log.info("partnerWxappConfigs:configMap:refundDeliveryFeeConfig{},{},{}",partnerWxappConfigs,configMap,refundDeliveryFeeConfig);
String mealCodeRule = refundDeliveryFeeConfig.getAppValue();
if(!StringUtils.isEmpty(mealCodeRule) && "2".equalsIgnoreCase(mealCodeRule)){
//更新db中的取餐码,生成取餐码
OrderModifyRelatingCodeReq relatingCodeReq =new OrderModifyRelatingCodeReq();
......@@ -2958,4 +2964,14 @@ public class OrderServiceImpl implements Orderservice {
return ResponseUtil.success(responses.getData());
}
public List<AssortmentOpenPlatformPartnerWxappConfig> cacheSelectDefaultPage(String wxAppId, String type) {
if (!StringUtils.isEmpty(wxAppId) && !StringUtils.isEmpty(type)) {
String hashKey = "ecology:kgd:wxappconfig:open_platform_partner_wxapp_config:appkey_" + wxAppId;
Object value = this.redisCache.hashGet(hashKey, type);
return (List)(value != null ? JSONArray.parseArray(value.toString(), AssortmentOpenPlatformPartnerWxappConfig.class) : new ArrayList());
} else {
return new ArrayList();
}
}
}
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