Merge branch 'dev' into 'uat'
Dev See merge request eshop/biz_service_ebtp_extend!51
This commit is contained in:
@ -35,10 +35,18 @@ spec:
|
|||||||
|
|
||||||
# 定义容器模板,该模板可以包含多个容器
|
# 定义容器模板,该模板可以包含多个容器
|
||||||
spec:
|
spec:
|
||||||
|
volumes:
|
||||||
|
- name: log
|
||||||
|
hostPath:
|
||||||
|
path: /var/lib/docker/log/349553515466-test/default-group/all #开发环境
|
||||||
# 必选,Pod中容器列表
|
# 必选,Pod中容器列表
|
||||||
containers:
|
containers:
|
||||||
- name: biz-service-ebtp-extend
|
- name: biz-service-ebtp-extend
|
||||||
image: harbor.dcos.guangzhou.unicom.local/eshop/biz-service-ebtp-extend:latest
|
image: harbor.dcos.guangzhou.unicom.local/eshop/biz-service-ebtp-extend:latest
|
||||||
|
# 在容器中挂载日志存储区
|
||||||
|
volumeMounts:
|
||||||
|
- name: log
|
||||||
|
mountPath: /log
|
||||||
# 需要暴露的端口库号列表
|
# 需要暴露的端口库号列表
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 18018
|
- containerPort: 18018
|
||||||
|
@ -37,9 +37,8 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
volumes:
|
volumes:
|
||||||
- name: log
|
- name: log
|
||||||
persistentVolumeClaim:
|
hostPath:
|
||||||
claimName: log-pvc
|
path: /var/lib/docker/log/349553515466-preprod/default-group/all #开发环境
|
||||||
readOnly: false
|
|
||||||
affinity:
|
affinity:
|
||||||
podAntiAffinity:
|
podAntiAffinity:
|
||||||
requiredDuringSchedulingIgnoredDuringExecution:
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
@ -38,9 +38,8 @@ spec:
|
|||||||
# 挂载日志存储
|
# 挂载日志存储
|
||||||
volumes:
|
volumes:
|
||||||
- name: log
|
- name: log
|
||||||
persistentVolumeClaim:
|
hostPath:
|
||||||
claimName: log-pvc
|
path: /var/lib/docker/log/349553515466-uat/default-group/all #开发环境
|
||||||
readOnly: false
|
|
||||||
|
|
||||||
# 必选,Pod中容器列表
|
# 必选,Pod中容器列表
|
||||||
containers:
|
containers:
|
||||||
|
@ -9,7 +9,9 @@ import com.chinaunicom.mall.ebtp.extend.timeService.tsa.SystemTime;
|
|||||||
import com.chinaunicom.mall.ebtp.extend.timeService.tsa.TtsAgent;
|
import com.chinaunicom.mall.ebtp.extend.timeService.tsa.TtsAgent;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@ -17,11 +19,15 @@ import java.util.Date;
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@Service
|
||||||
public class TimeServiceConstant {
|
public class TimeServiceConstant {
|
||||||
|
|
||||||
public static TSAClient client;
|
public static TSAClient client;
|
||||||
|
|
||||||
public TimeServiceConstant() {
|
@Value("${spring.redis.sentinel.master}")
|
||||||
|
private String redis;
|
||||||
|
|
||||||
|
static {
|
||||||
try{
|
try{
|
||||||
Properties prop = new Properties();
|
Properties prop = new Properties();
|
||||||
ClassPathResource classPathResource = new ClassPathResource("cssconfig.properties");
|
ClassPathResource classPathResource = new ClassPathResource("cssconfig.properties");
|
||||||
@ -37,15 +43,17 @@ public class TimeServiceConstant {
|
|||||||
log.error("读取配置文件或连接时间戳服务器异常", e);
|
log.error("读取配置文件或连接时间戳服务器异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 申请时间戳
|
* 申请时间戳
|
||||||
*
|
|
||||||
* @param data 待申请时间戳的原文
|
* @param data 待申请时间戳的原文
|
||||||
* @return 时间戳加密原文
|
* @return 时间戳加密原文
|
||||||
*/
|
*/
|
||||||
public String signTimeStamp(String data){
|
public String signTimeStamp(String data){
|
||||||
|
if(redis.equals("eshop-redis-sim")){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
try{
|
try{
|
||||||
|
|
||||||
data = data!=null&&!"".equals(data)?data:"system";
|
data = data!=null&&!"".equals(data)?data:"system";
|
||||||
//第三步:申请时间戳,向时间戳服务器发起申请时间戳请求,返回时间戳结果
|
//第三步:申请时间戳,向时间戳服务器发起申请时间戳请求,返回时间戳结果
|
||||||
TSASignedResult result = client.signTimeStamp("SHA1", data.getBytes("UTF-8"));
|
TSASignedResult result = client.signTimeStamp("SHA1", data.getBytes("UTF-8"));
|
||||||
@ -58,31 +66,36 @@ public class TimeServiceConstant {
|
|||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("申请时间戳异常", e);
|
log.error("申请时间戳异常", e);
|
||||||
}
|
}
|
||||||
return null;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解析时间戳
|
* 解析时间戳
|
||||||
*
|
|
||||||
* @param timestamp 时间戳加密原文
|
* @param timestamp 时间戳加密原文
|
||||||
* @return 时间戳对象
|
* @return 时间戳对象
|
||||||
*/
|
*/
|
||||||
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());
|
||||||
|
TtsAgent.TtsParseResult ttsParseResult = new TtsAgent.TtsParseResult(systemtime,"","");
|
||||||
|
if(redis.equals("eshop-redis-sim")){
|
||||||
|
return ttsParseResult;
|
||||||
|
}
|
||||||
try{
|
try{
|
||||||
|
|
||||||
log.info("timestamp -->"+timestamp);
|
log.info("timestamp -->"+timestamp);
|
||||||
TSAVerifyResult verifyResult = this.verifyTimeStamp(timestamp);
|
TSAVerifyResult verifyResult = this.verifyTimeStamp(timestamp);
|
||||||
String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(verifyResult.getSignedTime());
|
String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(verifyResult.getSignedTime());
|
||||||
TtsAgent.TtsParseResult ttsParseResult = new TtsAgent.TtsParseResult(time, HelperUtil.bytesToHexString(verifyResult.getData()),
|
ttsParseResult = new TtsAgent.TtsParseResult(time, HelperUtil.bytesToHexString(verifyResult.getData()),
|
||||||
verifyResult.getSignerSubject());
|
verifyResult.getSignerSubject());
|
||||||
return ttsParseResult;
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("解析时间戳", e);
|
log.error("解析时间戳", e);
|
||||||
}
|
}
|
||||||
return null;
|
return ttsParseResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TSAVerifyResult verifyTimeStamp(String timestamp){
|
private TSAVerifyResult verifyTimeStamp(String timestamp){
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|
||||||
log.info("timestamp -->"+timestamp);
|
log.info("timestamp -->"+timestamp);
|
||||||
TSAVerifyResult verifyResult = client.verifyTimeStamp(Base64.decodeBase64(timestamp));
|
TSAVerifyResult verifyResult = client.verifyTimeStamp(Base64.decodeBase64(timestamp));
|
||||||
return verifyResult;
|
return verifyResult;
|
||||||
@ -94,49 +107,59 @@ public class TimeServiceConstant {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取时间戳
|
* 获取时间戳
|
||||||
*
|
|
||||||
* @param data 待申请时间戳的原文
|
* @param data 待申请时间戳的原文
|
||||||
* @return 时间戳对象
|
* @return 时间戳对象
|
||||||
*/
|
*/
|
||||||
public TtsAgent.TtsParseResult getServiceTimeObj(String data){
|
public TtsAgent.TtsParseResult getServiceTimeObj(String data){
|
||||||
try {
|
String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||||
String timestamp = this.signTimeStamp(data);
|
TtsAgent.TtsParseResult ttsParseResult = new TtsAgent.TtsParseResult(time,"","");
|
||||||
TtsAgent.TtsParseResult ttsParseResult = this.verifyTimeStamp2(timestamp);
|
if(redis.equals("eshop-redis-sim")){
|
||||||
return ttsParseResult;
|
return ttsParseResult;
|
||||||
|
}
|
||||||
|
try{
|
||||||
|
|
||||||
|
String timestamp = this.signTimeStamp(data);
|
||||||
|
ttsParseResult = this.verifyTimeStamp2(timestamp);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("获取时间戳异常", e);
|
log.error("获取时间戳异常", e);
|
||||||
}
|
}
|
||||||
return null;
|
return ttsParseResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 直接获取获取时间戳 时间1
|
* 直接获取获取时间戳 时间1
|
||||||
*
|
|
||||||
* @param data 待申请时间戳的原文
|
* @param data 待申请时间戳的原文
|
||||||
* @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());
|
||||||
|
if(redis.equals("eshop-redis-sim")){
|
||||||
|
return time;
|
||||||
|
}
|
||||||
try{
|
try{
|
||||||
|
|
||||||
String timestamp = this.signTimeStamp(data);
|
String timestamp = this.signTimeStamp(data);
|
||||||
TSAVerifyResult verifyResult = this.verifyTimeStamp(timestamp);
|
TSAVerifyResult verifyResult = this.verifyTimeStamp(timestamp);
|
||||||
String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(verifyResult.getSignedTime());
|
time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(verifyResult.getSignedTime());
|
||||||
|
|
||||||
return time;
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("获取时间戳异常", e);
|
log.error("获取时间戳异常", e);
|
||||||
}
|
}
|
||||||
return null;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 直接获取获取时间戳 时间1
|
* 直接获取获取时间戳 时间1
|
||||||
*
|
|
||||||
* @param data 待申请时间戳的原文
|
* @param data 待申请时间戳的原文
|
||||||
* @return date时间
|
* @return date时间
|
||||||
*/
|
*/
|
||||||
public Date getServiceDate(String data){
|
public Date getServiceDate(String data){
|
||||||
|
if(redis.equals("eshop-redis-sim")){
|
||||||
|
return new Date();
|
||||||
|
}
|
||||||
try{
|
try{
|
||||||
|
|
||||||
String timestamp = this.signTimeStamp(data);
|
String timestamp = this.signTimeStamp(data);
|
||||||
TSAVerifyResult verifyResult = this.verifyTimeStamp(timestamp);
|
TSAVerifyResult verifyResult = this.verifyTimeStamp(timestamp);
|
||||||
Date date = verifyResult.getSignedTime();
|
Date date = verifyResult.getSignedTime();
|
||||||
@ -144,20 +167,34 @@ public class TimeServiceConstant {
|
|||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("获取时间戳异常", e);
|
log.error("获取时间戳异常", e);
|
||||||
}
|
}
|
||||||
return null;
|
return new Date();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取年月日时分秒分割存储对象
|
* 获取年月日时分秒分割存储对象
|
||||||
*
|
|
||||||
* @param data 待申请时间戳的原文
|
* @param data 待申请时间戳的原文
|
||||||
* @return SystemTime
|
* @return SystemTime
|
||||||
*/
|
*/
|
||||||
public SystemTime getServiceSystemTime(String data){
|
public SystemTime getServiceSystemTime(String data){
|
||||||
|
Date date = new Date();
|
||||||
|
if(redis.equals("eshop-redis-sim")){
|
||||||
|
return new SystemTime()
|
||||||
|
.setYear(date.getYear()+1900)
|
||||||
|
.setMonth(date.getMonth()+1)
|
||||||
|
.setDate(date.getDate())
|
||||||
|
.setHour(date.getHours())
|
||||||
|
.setMinute(date.getMinutes())
|
||||||
|
.setSecond(date.getSeconds())
|
||||||
|
.setTimestamp(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date));
|
||||||
|
}
|
||||||
try{
|
try{
|
||||||
|
|
||||||
String timestamp = this.signTimeStamp(data);
|
String timestamp = this.signTimeStamp(data);
|
||||||
TSAVerifyResult verifyResult = this.verifyTimeStamp(timestamp);
|
TSAVerifyResult verifyResult = this.verifyTimeStamp(timestamp);
|
||||||
Date date = verifyResult.getSignedTime();
|
date = verifyResult.getSignedTime();
|
||||||
|
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("获取时间戳异常", e);
|
||||||
|
}
|
||||||
SystemTime systemTime = new SystemTime()
|
SystemTime systemTime = new SystemTime()
|
||||||
.setYear(date.getYear()+1900)
|
.setYear(date.getYear()+1900)
|
||||||
.setMonth(date.getMonth()+1)
|
.setMonth(date.getMonth()+1)
|
||||||
@ -167,13 +204,11 @@ public class TimeServiceConstant {
|
|||||||
.setSecond(date.getSeconds())
|
.setSecond(date.getSeconds())
|
||||||
.setTimestamp(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date));
|
.setTimestamp(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date));
|
||||||
return systemTime;
|
return systemTime;
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("获取时间戳异常", e);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String arge[]){
|
public static void main(String arge[]){
|
||||||
|
try{
|
||||||
|
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
System.out.println("-----------"+(date.getYear()+1900));
|
System.out.println("-----------"+(date.getYear()+1900));
|
||||||
System.out.println("-----------"+(date.getMonth()+1));
|
System.out.println("-----------"+(date.getMonth()+1));
|
||||||
@ -181,5 +216,9 @@ public class TimeServiceConstant {
|
|||||||
System.out.println("-----------"+date.getHours());
|
System.out.println("-----------"+date.getHours());
|
||||||
System.out.println("-----------"+date.getMinutes());
|
System.out.println("-----------"+date.getMinutes());
|
||||||
System.out.println("-----------"+date.getSeconds());
|
System.out.println("-----------"+date.getSeconds());
|
||||||
|
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
package com.chinaunicom.mall.ebtp.extend.timeService.controller;
|
package com.chinaunicom.mall.ebtp.extend.timeService.controller;
|
||||||
|
|
||||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||||
|
import com.chinaunicom.mall.ebtp.extend.export.service.ExportServiceFactory;
|
||||||
import com.chinaunicom.mall.ebtp.extend.timeService.TimeServiceConstant;
|
import com.chinaunicom.mall.ebtp.extend.timeService.TimeServiceConstant;
|
||||||
import com.chinaunicom.mall.ebtp.extend.timeService.tsa.SystemTime;
|
import com.chinaunicom.mall.ebtp.extend.timeService.tsa.SystemTime;
|
||||||
import com.chinaunicom.mall.ebtp.extend.timeService.tsa.TtsAgent;
|
import com.chinaunicom.mall.ebtp.extend.timeService.tsa.TtsAgent;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import io.swagger.annotations.ApiParam;
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -20,6 +22,8 @@ import java.util.Date;
|
|||||||
@RequestMapping("/v1/timeService")
|
@RequestMapping("/v1/timeService")
|
||||||
public class TimeServiceController {
|
public class TimeServiceController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TimeServiceConstant timeServiceConstant;
|
||||||
/**
|
/**
|
||||||
* 申请时间戳
|
* 申请时间戳
|
||||||
*
|
*
|
||||||
@ -29,8 +33,8 @@ public class TimeServiceController {
|
|||||||
@ApiOperation("申请时间戳")
|
@ApiOperation("申请时间戳")
|
||||||
@GetMapping(value = "/signTimeStamp")
|
@GetMapping(value = "/signTimeStamp")
|
||||||
public BaseResponse<String> signTimeStamp(@ApiParam(value = "待申请时间戳的原文", required = false) @RequestParam(name = "data", required = false) String data) {
|
public BaseResponse<String> signTimeStamp(@ApiParam(value = "待申请时间戳的原文", required = false) @RequestParam(name = "data", required = false) String data) {
|
||||||
TimeServiceConstant constant = new TimeServiceConstant();
|
//TimeServiceConstant constant = new TimeServiceConstant();
|
||||||
return BaseResponse.success(constant.signTimeStamp(data));
|
return BaseResponse.success(timeServiceConstant.signTimeStamp(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,8 +46,8 @@ public class TimeServiceController {
|
|||||||
@ApiOperation("解析时间戳加密原文")
|
@ApiOperation("解析时间戳加密原文")
|
||||||
@PostMapping(value = "/verifyTimeStamp")
|
@PostMapping(value = "/verifyTimeStamp")
|
||||||
public BaseResponse<TtsAgent.TtsParseResult> verifyTimeStamp(@ApiParam(value = "时间戳加密原文", required = true) @RequestBody String timestamp) {
|
public BaseResponse<TtsAgent.TtsParseResult> verifyTimeStamp(@ApiParam(value = "时间戳加密原文", required = true) @RequestBody String timestamp) {
|
||||||
TimeServiceConstant constant = new TimeServiceConstant();
|
//TimeServiceConstant constant = new TimeServiceConstant();
|
||||||
return BaseResponse.success(constant.verifyTimeStamp2(timestamp));
|
return BaseResponse.success(timeServiceConstant.verifyTimeStamp2(timestamp));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,8 +59,8 @@ public class TimeServiceController {
|
|||||||
@ApiOperation("直接获取时间戳对象(内涵日期)")
|
@ApiOperation("直接获取时间戳对象(内涵日期)")
|
||||||
@PostMapping(value = "/getServiceTimeObj")
|
@PostMapping(value = "/getServiceTimeObj")
|
||||||
public BaseResponse<TtsAgent.TtsParseResult> getServiceTimeObj(@ApiParam(value = "待申请时间戳的原文", required = false) @RequestParam(name = "data", required = false) String data) {
|
public BaseResponse<TtsAgent.TtsParseResult> getServiceTimeObj(@ApiParam(value = "待申请时间戳的原文", required = false) @RequestParam(name = "data", required = false) String data) {
|
||||||
TimeServiceConstant constant = new TimeServiceConstant();
|
//TimeServiceConstant constant = new TimeServiceConstant();
|
||||||
return BaseResponse.success(constant.getServiceTimeObj(data));
|
return BaseResponse.success(timeServiceConstant.getServiceTimeObj(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,8 +72,8 @@ public class TimeServiceController {
|
|||||||
@ApiOperation("直接获取日期字符串")
|
@ApiOperation("直接获取日期字符串")
|
||||||
@GetMapping(value = "/getServiceTime")
|
@GetMapping(value = "/getServiceTime")
|
||||||
public BaseResponse<String> getServiceTime(@ApiParam(value = "待申请时间戳的原文", required = false) @RequestParam(name = "data", required = false) String data) {
|
public BaseResponse<String> getServiceTime(@ApiParam(value = "待申请时间戳的原文", required = false) @RequestParam(name = "data", required = false) String data) {
|
||||||
TimeServiceConstant constant = new TimeServiceConstant();
|
//TimeServiceConstant constant = new TimeServiceConstant();
|
||||||
return BaseResponse.success(constant.getServiceTime(data));
|
return BaseResponse.success(timeServiceConstant.getServiceTime(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -81,8 +85,8 @@ public class TimeServiceController {
|
|||||||
@ApiOperation("获取日期对象SystemTime")
|
@ApiOperation("获取日期对象SystemTime")
|
||||||
@GetMapping(value = "/getServiceSystemTime")
|
@GetMapping(value = "/getServiceSystemTime")
|
||||||
public BaseResponse<SystemTime> getServiceSystemTime(@ApiParam(value = "待申请时间戳的原文", required = false) @RequestParam(name = "data", required = false) String data) {
|
public BaseResponse<SystemTime> getServiceSystemTime(@ApiParam(value = "待申请时间戳的原文", required = false) @RequestParam(name = "data", required = false) String data) {
|
||||||
TimeServiceConstant constant = new TimeServiceConstant();
|
//TimeServiceConstant constant = new TimeServiceConstant();
|
||||||
return BaseResponse.success(constant.getServiceSystemTime(data));
|
return BaseResponse.success(timeServiceConstant.getServiceSystemTime(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -96,9 +100,9 @@ public class TimeServiceController {
|
|||||||
public BaseResponse<SystemTime> getDescOpenRoomTime(@RequestParam(name = "openTime", required = true) String openTime) {
|
public BaseResponse<SystemTime> getDescOpenRoomTime(@RequestParam(name = "openTime", required = true) String openTime) {
|
||||||
try {
|
try {
|
||||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
TimeServiceConstant constant = new TimeServiceConstant();
|
//TimeServiceConstant constant = new TimeServiceConstant();
|
||||||
|
|
||||||
Date now = constant.getServiceDate("getDescOpenRoomTime");
|
Date now = timeServiceConstant.getServiceDate("getDescOpenRoomTime");
|
||||||
;//当前时间
|
;//当前时间
|
||||||
Date date = df.parse(openTime);//过去
|
Date date = df.parse(openTime);//过去
|
||||||
long l = date.getTime() - now.getTime();
|
long l = date.getTime() - now.getTime();
|
||||||
|
Reference in New Issue
Block a user