Commit 075dd586 by hanghang.wang

调整取餐码起始规则

parent cd2f20c6
......@@ -73,13 +73,13 @@ public class OrderTackCodeManager {
} else if (StringUtils.isNotEmpty(rule) && rule.equals(OrderTackCodeRuleEnum.THE_CUSTOM.getCode()+"")) {
//规则自定义
Map<Object, Object> tackCodeSettingMap = redisTemplate.opsForHash().entries(randomKey);
log.info("tackCode rule3 : " + assortmentTackCodeRule );
// log.info("tackCode rule3 : " + assortmentTackCodeRule );
if (tackCodeSettingMap.isEmpty()) {
if (Objects.isNull(assortmentTackCodeRule)) {
log.info("tackCode rule4 : " + assortmentTackCodeRule );
// log.info("tackCode rule4 : " + assortmentTackCodeRule );
assortmentTackCodeRule = assortmentTackCodeRuleManager.queryTackCodeRule(partnerId);
}
log.info("tackCode rule5 : " + assortmentTackCodeRule );
// log.info("tackCode rule5 : " + assortmentTackCodeRule );
initTackCodeSettingHash(assortmentTackCodeRule,randomKey,tackCodeSettingMap);
}
//判断订单类型
......@@ -87,12 +87,13 @@ public class OrderTackCodeManager {
OrderType orderTypeEnum = OrderType.getByCode(orderType);
if(!Objects.isNull(orderTypeEnum)){
String tackDesc = orderTypeEnum.getTackDesc();
head = (String) tackCodeSettingMap.get(tackDesc+"Head");
head = tackCodeSettingMap.get(tackDesc+"Head").toString();
Integer length = (Integer) tackCodeSettingMap.get(tackDesc+"Length");
code = redisTemplate.opsForHash().increment(key, tackDesc+"Code", 1).toString();
if (code.length() > length) {
//处理并发情况下,同时含有超过上限的数字。在第一次已经变更为1之后,再次塞1进缓存导致取餐吗重复
if(redisTemplate.opsForHash().get(key,tackDesc + "Code").toString().length() < length){
code = tackCodeSettingMap.get(tackDesc+"Code").toString();
String incrementCode = redisTemplate.opsForHash().increment(key, tackDesc+"Code", 1).toString();
if (incrementCode.length() > length) {
//处理并发情况下,同时含有超过上限的数字。在第一次已经变更为1之后,再次塞1进缓存导致取餐吗重复。暂时无效,后续调整
if(incrementCode.length() < length){
code = redisTemplate.opsForHash().increment(key, tackDesc+"Code", 1).toString();
}else{
code = "1";
......
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