Ver Fonte

时间时区问题

plf há 4 anos atrás
pai
commit
4989de22d9

+ 5 - 4
pay/src/main/java/com/caimei/module/pay/service/impl/PayServiceImpl.java

@@ -12,7 +12,6 @@ import com.caimei.module.pay.util.*;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.http.client.utils.DateUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -814,8 +813,9 @@ public class PayServiceImpl implements PayService {
     public void delayedSplitting(String notifyUrl) {
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(new Date());
-        calendar.add(Calendar.DATE, -1);
-        String currentTime = DateUtils.formatDate(calendar.getTime(), "yyyy-MM-dd HH:mm:ss");
+        calendar.add(Calendar.DAY_OF_MONTH, -1);
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String currentTime = format.format(new Date());
         List<OrderRelationVo> orderRelations = payDao.findUnallocatedAccount(currentTime);
         if (orderRelations != null && orderRelations.size() > 0) {
             for (OrderRelationVo orderRelation : orderRelations) {
@@ -929,7 +929,8 @@ public class PayServiceImpl implements PayService {
                     }
                 }
 
-                String currentTime = DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss");
+                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                String currentTime = format.format(new Date());
                 //保存付供应商记录
                 PayShopVo payShop = new PayShopVo();
                 payShop.setShopID(shopId);