Commit e7764675 by zhiheng.zhang

删除多余的方法

parent 66376df5
......@@ -91,12 +91,6 @@ import static cn.freemud.constant.OrderRefundConstant.ALLOW_REFUND;
@Component
public class OrderAdapter {
public final static String TAKECODEKEY = "takecode";
public static final String REDIS_KEY_SEP = ":";
public static final String numberChar = "0123456789";
public static final String numberCharWithoutZero = "12345";
private static FastDateFormat yyyyMMddHHmmss = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss", Locale.CHINA);
private static String SPMCHID = "1237482502";
......@@ -134,9 +128,6 @@ public class OrderAdapter {
private static Gson gson = new Gson();
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private RedisCache redisCache;
/**
......@@ -3168,79 +3159,6 @@ public class OrderAdapter {
return StringUtils.isNotBlank(payChannel) && OrderAdapter.PAY_CODE_10102.equalsIgnoreCase(payChannel);
}
/**
* 生成取餐码
* @param partnerId 商户ID
* @param storeId 门店ID
* @return
*/
public String generateTackCode(String partnerId, String storeId){
String pickUpGoodsNo = generateNumber(6);
String key = this.getOrderTackCodeKey(partnerId,storeId);
if(!redisTemplate.opsForHash().hasKey(key,storeId+pickUpGoodsNo)) {
redisTemplate.opsForHash().put(key,storeId+pickUpGoodsNo,pickUpGoodsNo);
redisTemplate.expire(key,getSecondsNextEarlyMorning(), TimeUnit.SECONDS);
}else{
generateTackCode(partnerId, storeId);
}
return pickUpGoodsNo;
}
/**
* 获取取餐码key
* @param partnerId
* @return
*/
public String getOrderTackCodeKey(String partnerId,String storeId){
Date currentDay = new Date();
String todayStr = formatDate(currentDay);
StringBuilder key = new StringBuilder(TAKECODEKEY).append(REDIS_KEY_SEP)
.append(partnerId)
.append(REDIS_KEY_SEP)
.append(storeId)
.append(REDIS_KEY_SEP)
.append(todayStr);
return key.toString();
}
public static SimpleDateFormat defaultDateFormater = new SimpleDateFormat("yyyy-MM-dd");
private String formatDate(Date date){
return defaultDateFormater.format(date);
}
/**
* 返回一个定长的随机字符串(只包含大小写字母、数字)
*
* @param length
* 随机字符串长度
* @return 随机字符串
*/
public static String generateNumber(int length) {
StringBuffer sb = new StringBuffer();
Random random = new Random();
for (int i = 0; i < length; i++) {
if (i == 0){
sb.append(numberCharWithoutZero.charAt(random.nextInt(numberCharWithoutZero.length())));
}else {
sb.append(numberChar.charAt(random.nextInt(numberChar.length())));
}
}
return sb.toString();
}
private Long getSecondsNextEarlyMorning(){
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_YEAR, 1);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.MILLISECOND, 0);
return (cal.getTimeInMillis() - System.currentTimeMillis()) / 1000;
}
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;
......
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