Browse Source

Merge branch 'master' of http://git.iamberry.com/hexiugang/iamberry-common-parent

# Conflicts:
#	watero-rst-web/src/main/webapp/WEB-INF/views/cm/customer/order_list.ftl
wangxiang 7 years ago
parent
commit
9f20ddd6ee

+ 18 - 1
watero-rst-web/src/main/java/com/iamberry/rst/utils/StitchAttrUtil.java

@@ -4,6 +4,8 @@ import com.iamberry.rst.core.page.PagedResult;
 import org.springframework.web.servlet.ModelAndView;
 
 import java.lang.reflect.Field;
+import java.text.ParsePosition;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
 public class StitchAttrUtil {
@@ -12,6 +14,12 @@ public class StitchAttrUtil {
      * 组装参数时,会过滤以下参数
      * 推荐使用:addNoPro(),添加过滤
      */
+    public final static String timeDate[] = {
+            "startDate",
+            "endDate"
+    };
+    public static Set<String> timeDateSet = new HashSet<String>(Arrays.asList(timeDate));
+
     public final static String noProperty[] = {
             "serialVersionUID",
             "awaitingSignclosedProductInfoList",
@@ -90,7 +98,16 @@ public class StitchAttrUtil {
             }catch (IllegalAccessException e){
             }
             if (value != null && !propertySet.contains(fieldName)) {
-                sb.append("&"+fieldName+ "=" + value.toString());
+                if(timeDateSet.contains(fieldName)){
+                    //Date currentTime = new Date();
+                    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                    String dateString = formatter.format(value);
+                    //ParsePosition pos = new ParsePosition(8);
+                    //Date currentTime = formatter.parse(dateString, pos);
+                    sb.append("&"+fieldName+ "=" + dateString);
+                }else{
+                    sb.append("&"+fieldName+ "=" + value.toString());
+                }
             }
         }
     }