Browse Source

公共询价查询增加是否过期判断

hejq 8 years ago
parent
commit
aea8293eb2

+ 4 - 2
src/main/java/com/uas/ps/inquiry/controller/InquiryForBuyerController.java

@@ -103,10 +103,12 @@ public class InquiryForBuyerController {
      *
      * @param pageInfo 分页参数
      * @param searchFilter 过滤条件
+     * @param state 过滤状态
+     * @param overdue 是否过期 1、过期;0、 未过期
      * @return
      */
     @RequestMapping(value = "/list", method = RequestMethod.GET)
-    public Page<PurcInquiryItemInfo> getInquiryList(PageInfo pageInfo, SearchFilter searchFilter, String state) {
+    public Page<PurcInquiryItemInfo> getInquiryList(PageInfo pageInfo, SearchFilter searchFilter, String state, Integer overdue) {
         Sort sort = new Sort(Sort.Direction.DESC, "date");
         pageInfo.setSort(sort);
         if (null != searchFilter.getUserUU()) {
@@ -116,7 +118,7 @@ public class InquiryForBuyerController {
         } else {
             throw new IllegalAccessError("非法访问");
         }
-        return inquiryService.findTodoByPageInfo(pageInfo, searchFilter, state);
+        return inquiryService.findTodoByPageInfo(pageInfo, searchFilter, state, overdue);
     }
 
     /**

+ 2 - 1
src/main/java/com/uas/ps/inquiry/service/InquiryService.java

@@ -19,9 +19,10 @@ public interface InquiryService {
      * @param info 分页新
      * @param filter 过滤条件
      * @param state 过滤状态
+     * @param overdue 是否过期
      * @return
      */
-    Page<PurcInquiryItemInfo> findTodoByPageInfo(PageInfo info, SearchFilter filter, String state);
+    Page<PurcInquiryItemInfo> findTodoByPageInfo(PageInfo info, SearchFilter filter, String state, Integer overdue);
 
     /**
      * 保存公共询价

+ 11 - 1
src/main/java/com/uas/ps/inquiry/service/impl/InquiryServiceImpl.java

@@ -61,10 +61,11 @@ public class InquiryServiceImpl implements InquiryService {
      * @param info 分页新
      * @param filter 过滤条件
      * @param state 过滤状态
+     * @param overdue 是否过期 1、已过期;0、未过期
      * @return
      */
     @Override
-    public Page<PurcInquiryItemInfo> findTodoByPageInfo(final PageInfo info, SearchFilter filter, String state) {
+    public Page<PurcInquiryItemInfo> findTodoByPageInfo(final PageInfo info, SearchFilter filter, String state, Integer overdue) {
         if (null != filter) {
             if (StringUtils.hasText(filter.getKeyword())) {
                 SimpleExpression cmpCode = new SimpleExpression("cmpCode", filter.getKeyword(), CriterionExpression.Operator.LIKE);
@@ -104,6 +105,15 @@ public class InquiryServiceImpl implements InquiryService {
                 info.expression(logicalExpression);
             }
         }
+        if (null != overdue) {
+            // 已超过截止日期
+            if (overdue.equals(Constant.YES)) {
+                SimpleExpression date = new SimpleExpression("endDate", new Date(System.currentTimeMillis()), CriterionExpression.Operator.LT);
+                SimpleExpression[] simpleExpressions = new SimpleExpression[]{date};
+                LogicalExpression logicalExpression = PredicateUtils.and(simpleExpressions);
+                info.expression(logicalExpression);
+            }
+        }
         return inquiryItemDao.findAll(new Specification<PurcInquiryItemInfo>() {
             public Predicate toPredicate(Root<PurcInquiryItemInfo> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
                 query.where(info.getPredicates(root, query, builder));