|
@@ -1,6 +1,8 @@
|
|
|
package com.txz.mall.configurer;
|
|
package com.txz.mall.configurer;
|
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.common.collect.Range;
|
|
import com.google.common.collect.Range;
|
|
|
|
|
+import com.txz.mall.util.I18nUtil;
|
|
|
import org.apache.shardingsphere.api.sharding.complex.ComplexKeysShardingAlgorithm;
|
|
import org.apache.shardingsphere.api.sharding.complex.ComplexKeysShardingAlgorithm;
|
|
|
import org.apache.shardingsphere.api.sharding.complex.ComplexKeysShardingValue;
|
|
import org.apache.shardingsphere.api.sharding.complex.ComplexKeysShardingValue;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.util.ObjectUtils;
|
|
@@ -356,7 +358,7 @@ public class DatabaseShardingAlgorithm implements ComplexKeysShardingAlgorithm<C
|
|
|
Long userId = Long.parseLong(lastFour);
|
|
Long userId = Long.parseLong(lastFour);
|
|
|
result.put(orderId, Arrays.asList(createTime.getTime(), userId));
|
|
result.put(orderId, Arrays.asList(createTime.getTime(), userId));
|
|
|
} catch (ParseException | StringIndexOutOfBoundsException e) {
|
|
} catch (ParseException | StringIndexOutOfBoundsException e) {
|
|
|
- throw new RuntimeException("解析order_id分库条件失败: " + orderId, e);
|
|
|
|
|
|
|
+ throw new RuntimeException(I18nUtil.get("failed.to.parse.the.sharding.condition.for.order.id") + JSONObject.toJSONString(shardingValue), e);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -581,7 +583,7 @@ public class DatabaseShardingAlgorithm implements ComplexKeysShardingAlgorithm<C
|
|
|
try {
|
|
try {
|
|
|
return SDF.parse(value.toString());
|
|
return SDF.parse(value.toString());
|
|
|
} catch (ParseException e) {
|
|
} catch (ParseException e) {
|
|
|
- throw new RuntimeException("时间格式错误: " + value, e);
|
|
|
|
|
|
|
+ throw new RuntimeException(I18nUtil.get("time.format.error") + value, e);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|