Authored by zhaojun2

bugfix

... ... @@ -40,6 +40,7 @@ public class DateUtil {
public static final String MM_dd = "MM月dd日";
public static final String M_d = "M月d日";
public static final String HH_mm = "HH:mm";
public final static String YYYY_MM_DD_DOT="yyyy.MM.dd";
public static final String yyyyMM = "yyyyMM";
... ... @@ -2107,4 +2108,11 @@ public class DateUtil {
public enum TimeUnit{
minute,hour,day
}
public static String getDateString(long time, String format) {
SimpleDateFormat sdf=new SimpleDateFormat(format);
Calendar c=Calendar.getInstance(TimeZone.getTimeZone("UTC"));
c.setTime(new Date (time*1000));
return sdf.format(c.getTime());
}
}
... ...
... ... @@ -21,7 +21,7 @@ import org.springframework.stereotype.Service;
import com.yoho.error.exception.ServiceException;
import com.yohoufo.product.request.StoragePriceBo;
import com.yohoufo.product.service.ProductService;
import com.yohoufo.resource.util.DateUtils;
import com.yohoufo.common.utils.DateUtil;
import org.springframework.util.CollectionUtils;
... ... @@ -63,7 +63,7 @@ public class ProductServiceImpl implements ProductService{
productInfo.setProductId(product.getId());
productInfo.setProductName(product.getProductName());
productInfo.setProductCode(product.getProductCode());
productInfo.setSaleTime((product.getSaleTime() == null || product.getSaleTime().equals(0)) ? "0" : DateUtils.getDateString(product.getSaleTime(), DateUtils.FOMART_DATE_DOT));
productInfo.setSaleTime((product.getSaleTime() == null || product.getSaleTime().equals(0)) ? "0" : DateUtil.getDateString(product.getSaleTime(), DateUtil.YYYY_MM_DD_DOT));
productInfo.setLeastPrice(new BigDecimal(0));
setBrand(productInfo, product.getBrandId());
setSeries(productInfo, product.getSeriesId());
... ...
... ... @@ -16,7 +16,6 @@ public final class DateUtils {
public final static String DEFAULT_FOMART_DATE="yyyy-MM-dd";
public final static String FOMART_DATE_DOT="yyyy.MM.dd";
/**
* 将数据库中的UNIX_Time(该时间是距离1970年的秒数,在转换过程中先要换算成毫秒)转换成UTC时间
... ... @@ -129,11 +128,4 @@ public final class DateUtils {
return (int)(cal.getTimeInMillis() / 1000);
}
public static String getDateString(long time, String format) {
SimpleDateFormat sdf=new SimpleDateFormat(format);
Calendar c=Calendar.getInstance(TimeZone.getTimeZone("UTC"));
c.setTime(new Date (time*1000));
return sdf.format(c.getTime());
}
}
... ...