时间戳服务BUG修复
This commit is contained in:
@ -14,13 +14,8 @@ import org.springframework.core.io.ClassPathResource;
|
|||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
import java.util.concurrent.Future;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class TimeServiceConstant {
|
public class TimeServiceConstant {
|
||||||
@ -28,7 +23,7 @@ public class TimeServiceConstant {
|
|||||||
public static TSAClient client;
|
public static TSAClient client;
|
||||||
|
|
||||||
@Value("${spring.redis.sentinel.master}")
|
@Value("${spring.redis.sentinel.master}")
|
||||||
private String redis="eshop-redis";
|
private String redis;
|
||||||
|
|
||||||
public TimeServiceConstant(){
|
public TimeServiceConstant(){
|
||||||
try{
|
try{
|
||||||
@ -52,7 +47,7 @@ public class TimeServiceConstant {
|
|||||||
* @return 时间戳加密原文
|
* @return 时间戳加密原文
|
||||||
*/
|
*/
|
||||||
public String signTimeStamp(String data){
|
public String signTimeStamp(String data){
|
||||||
if(redis.equals("eshop-redis-sim")){
|
if(redis!=null&&redis.equals("eshop-redis-sim")){
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
@ -79,7 +74,7 @@ public class TimeServiceConstant {
|
|||||||
public TtsAgent.TtsParseResult verifyTimeStamp2(String timestamp){
|
public TtsAgent.TtsParseResult verifyTimeStamp2(String timestamp){
|
||||||
String systemtime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
String systemtime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||||
TtsAgent.TtsParseResult ttsParseResult = new TtsAgent.TtsParseResult(systemtime,"","");
|
TtsAgent.TtsParseResult ttsParseResult = new TtsAgent.TtsParseResult(systemtime,"","");
|
||||||
if(redis.equals("eshop-redis-sim")){
|
if(redis!=null&&redis.equals("eshop-redis-sim")){
|
||||||
return ttsParseResult;
|
return ttsParseResult;
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
@ -116,7 +111,7 @@ public class TimeServiceConstant {
|
|||||||
public TtsAgent.TtsParseResult getServiceTimeObj(String data){
|
public TtsAgent.TtsParseResult getServiceTimeObj(String data){
|
||||||
String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||||
TtsAgent.TtsParseResult ttsParseResult = new TtsAgent.TtsParseResult(time,"","");
|
TtsAgent.TtsParseResult ttsParseResult = new TtsAgent.TtsParseResult(time,"","");
|
||||||
if(redis.equals("eshop-redis-sim")){
|
if(redis!=null&&redis.equals("eshop-redis-sim")){
|
||||||
return ttsParseResult;
|
return ttsParseResult;
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
@ -135,8 +130,9 @@ public class TimeServiceConstant {
|
|||||||
* @return 时间
|
* @return 时间
|
||||||
*/
|
*/
|
||||||
public String getServiceTime(String data){
|
public String getServiceTime(String data){
|
||||||
|
log.info("-------------------redis-"+redis);
|
||||||
String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||||
if(redis.equals("eshop-redis-sim")){
|
if(redis!=null&&redis.equals("eshop-redis-sim")){
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
@ -157,7 +153,7 @@ public class TimeServiceConstant {
|
|||||||
* @return date时间
|
* @return date时间
|
||||||
*/
|
*/
|
||||||
public Date getServiceDate(String data){
|
public Date getServiceDate(String data){
|
||||||
if(redis.equals("eshop-redis-sim")){
|
if(redis!=null&&redis.equals("eshop-redis-sim")){
|
||||||
return new Date();
|
return new Date();
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
@ -178,7 +174,7 @@ public class TimeServiceConstant {
|
|||||||
*/
|
*/
|
||||||
public SystemTime getServiceSystemTime(String data){
|
public SystemTime getServiceSystemTime(String data){
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
if(redis.equals("eshop-redis-sim")){
|
if(redis!=null&&redis.equals("eshop-redis-sim")){
|
||||||
return new SystemTime()
|
return new SystemTime()
|
||||||
.setYear(date.getYear()+1900)
|
.setYear(date.getYear()+1900)
|
||||||
.setMonth(date.getMonth()+1)
|
.setMonth(date.getMonth()+1)
|
||||||
|
Reference in New Issue
Block a user