提交 1d777490 authored 作者: 李炎's avatar 李炎

优化

上级 7d776951
...@@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.IOException; import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -122,16 +123,31 @@ public class PurchaseorderServiceImpl extends ServiceImpl<PurchaseorderMapper, P ...@@ -122,16 +123,31 @@ public class PurchaseorderServiceImpl extends ServiceImpl<PurchaseorderMapper, P
*/ */
public String getTime() { public String getTime() {
Purchaseorder purchaseorder_api_time = this.getBaseMapper().selectOne(new QueryWrapper<Purchaseorder>().orderByDesc("modify_Time").last("limit 1").select("modify_Time")); Purchaseorder purchaseorder_api_time = this.getBaseMapper().selectOne(new QueryWrapper<Purchaseorder>().orderByDesc("modify_Time").last("limit 1").select("modify_Time"));
Date currentTime = new Date(0); Date currentTime = null;
String dateString = null;
dateString = beforeDayByNowDay();
if (purchaseorder_api_time != null) {//非空判断 if (purchaseorder_api_time != null) {//非空判断
if (purchaseorder_api_time.getModifyTime() != null) if (purchaseorder_api_time.getModifyTime() != null)
currentTime = purchaseorder_api_time.getModifyTime(); currentTime = purchaseorder_api_time.getModifyTime();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
dateString = formatter.format(currentTime);
} }
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
return dateString; return dateString;
} }
/**
* 获取当前日期的前一天
* 需要返回的日期格式,例如:yyyy-MM-dd HH:mm:ss
*
* @return 前一天日期字符串
*/
public String beforeDayByNowDay() {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, -1); //得到前一天
Date date = calendar.getTime();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return df.format(date);
}
/** /**
* //将解析的国网采购订单同步至金蝶销售订单 * //将解析的国网采购订单同步至金蝶销售订单
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论