From 923af8f8eb0d849b92afa8b567036aae2837f202 Mon Sep 17 00:00:00 2001
From: Jinquan_Ou <Jinquan@gdut.com>
Date: 星期五, 21 四月 2023 16:41:00 +0800
Subject: [PATCH] 888

---
 zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java                       |   24 +++++++
 zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionServiceImpl.java |    6 +
 zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java      |   35 ++++++-----
 zhang-content/src/main/java/com/ruoyi/domain/ZfCollection.java                  |   34 ++++++++--
 zhang-content/src/main/java/com/ruoyi/domain/ZfProperty.java                    |   24 +++++++
 zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java  |   43 +++++++++----
 6 files changed, 121 insertions(+), 45 deletions(-)

diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfCollection.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfCollection.java
index 1ed6f7b..3a2530d 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfCollection.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfCollection.java
@@ -32,13 +32,6 @@
     private Integer id;
 
     /**
-     * 鑾峰緱鏃堕棿
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "鍒涘缓鏃堕棿", dateFormat = "yyyy-MM-dd")
-    private Date getTime;
-
-    /**
      * 绫诲埆
      */
     @Excel(name = "绫诲埆")
@@ -88,7 +81,7 @@
     /**
      * 鎵�灞炲搴璱d
      */
-    @Excel(name = "鎵�灞炲搴紪鍙�")
+    @Excel(name = "鎵�灞炲搴紪鍙�(瀵煎叆鏁版嵁鏃惰鍒犻櫎姝ゆ爮)")
     private String familyId;
 
     /**
@@ -97,5 +90,30 @@
     @TableField(exist = false)
     private Integer ownData = 0;
 
+    /**
+     * 鍒涘缓鏃堕棿
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date createTime;
+
+    /**
+     * 寮�濮嬫椂闂�
+     */
+    @TableField(exist = false)
+    private Date happenStartTime;
+
+    /**
+     * 缁撴潫鏃堕棿
+     */
+    @TableField(exist = false)
+    private Date happenEndTime;
+
+    /**
+     * 鑾峰緱鏃堕棿
+     */
+    @Excel(name = "鍙戠敓鏃堕棿", dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    private Date happenTime;
+
 
 }
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java
index b2664d1..4285af2 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java
@@ -1,6 +1,7 @@
 package com.ruoyi.domain;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -34,7 +35,6 @@
      * 鍒涘缓鏃堕棿
      */
     @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "鍒涘缓鏃堕棿", dateFormat = "yyyy-MM-dd")
     private Date createTime;
 
     /**
@@ -63,7 +63,27 @@
 
     private String url;
 
-    @Excel(name="瀹跺涵缂栧彿")
+    @Excel(name="鎵�灞炲搴紪鍙�(瀵煎叆鏁版嵁鏃惰鍒犻櫎姝ゆ爮)")
     private String familyId;
 
+
+    /**
+     * 寮�濮嬫椂闂�
+     */
+    @TableField(exist = false)
+    private Date happenStartTime;
+
+    /**
+     * 缁撴潫鏃堕棿
+     */
+    @TableField(exist = false)
+    private Date happenEndTime;
+
+    /**
+     * 鍙戠敓鏃堕棿
+     */
+    @Excel(name = "鍙戠敓鏃堕棿", dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    private Date happenTime;
+
 }
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfProperty.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfProperty.java
index 1989f69..06ed9ac 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfProperty.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfProperty.java
@@ -57,15 +57,21 @@
      * 鍒涘缓鏃堕棿
      */
     @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "鍒涘缓鏃堕棿", dateFormat = "yyyy-MM-dd")
     private Date createTime;
+
+    /**
+     * 鍙戠敓鏃堕棿
+     */
+    @Excel(name = "鍙戠敓鏃堕棿", dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    private Date happenTime;
 
     private String url;
 
     /**
      * 瀹跺涵id
      */
-    @Excel(name = "鎵�灞炲搴紪鍙�")
+    @Excel(name = "鎵�灞炲搴紪鍙�(瀵煎叆鏁版嵁鏃惰鍒犻櫎姝ゆ爮)")
     private String familyId;
 
     /**
@@ -74,8 +80,22 @@
     @TableField(exist = false)
     private Integer ownData = 0;
 
+    /**
+     * 鏁版嵁鐘舵��
+     */
     @Excel(name = "鏄惁娉ㄩ攢",readConverterExp = "0=姝e父,1=宸叉敞閿�")
     private Integer status;
 
+    /**
+     * 寮�濮嬫椂闂�
+     */
+    @TableField(exist = false)
+    private Date happenStartTime;
+
+    /**
+     * 缁撴潫鏃堕棿
+     */
+    @TableField(exist = false)
+    private Date happenEndTime;
 
 }
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java
index d1c5af7..cc75031 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java
@@ -22,6 +22,9 @@
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -38,14 +41,26 @@
 @Service
 public class IZfPropertyServiceImpl extends ServiceImpl<ZfPropertyMapper, ZfProperty> implements IZfPropertyService {
 
-
-
     @Resource
     IZfPropertyService zfPropertyService;
 
     @Resource
     ZInfoUserService zInfoUserService;
 
+
+//    private Date getHappenTime(ZfProperty zfProperty) {
+//        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+//        String happenTimeStr = format.format(zfProperty.getHappenTime());
+//
+//        Date happenTime = null;
+//        try {
+//            happenTime = format.parse(happenTimeStr);
+//            System.out.println("鏂规硶閲岀殑:" + happenTime);
+//        } catch (ParseException e) {
+//            throw new RuntimeException("鏃堕棿鏍煎紡杞崲鏈夎");
+//        }
+//        return happenTime;
+//    }
 
 
     private LambdaQueryWrapper<ZfProperty> buildCondition(ZfProperty zfProperty) {
@@ -57,7 +72,8 @@
                 .like(!StringUtils.isEmpty(zfProperty.getHolder()), ZfProperty::getHolder, zfProperty.getHolder())
                 .like(!StringUtils.isEmpty(zfProperty.getAddress()), ZfProperty::getAddress, zfProperty.getAddress())
                 .like(!StringUtils.isEmpty(zfProperty.getRemark()), ZfProperty::getRemark, zfProperty.getRemark())
-                .like(zfProperty.getCreateTime() != null, ZfProperty::getCreateTime, zfProperty.getCreateTime());
+                .eq(zfProperty.getHappenTime()!=null,ZfProperty::getHappenTime,zfProperty.getHappenTime())
+                .between(zfProperty.getHappenStartTime() != null && zfProperty.getHappenEndTime() != null, ZfProperty::getHappenTime, zfProperty.getHappenStartTime(), zfProperty.getHappenEndTime());
         return lqw;
     }
 
@@ -86,7 +102,7 @@
                     secondFamilyIdsBuffer.deleteCharAt(secondFamilyIdsBuffer.length() - 1);
                 }
 
-            }else{
+            } else {
                 setSecondFamilyAuthority(secondFamilyIdsBuffer, secondFamilyAuthority);
                 //鎶婂悗闈㈢殑閫楀彿鍘绘帀
                 if (secondFamilyIdsBuffer.length() > 1) {
@@ -140,7 +156,7 @@
 
         }
 
-        lqw.orderByDesc(ZfProperty::getId);
+        lqw.orderByDesc(ZfProperty::getCreateTime);
         return lqw;
     }
 
@@ -183,7 +199,7 @@
     }
 
     @Override
-        public List<ZfProperty> selectByCondition(ZfProperty zfProperty) {
+    public List<ZfProperty> selectByCondition(ZfProperty zfProperty) {
         String familyIds = listFamilyIds();
         String secondFamilyIds = listSecondFamilyIds();
         LambdaQueryWrapper<ZfProperty> lambdaQueryWrapper = buildCondition(zfProperty, familyIds, secondFamilyIds);
@@ -247,7 +263,7 @@
         if (flag) {
             if (save(zfProperty)) {
                 return AjaxResult.success();
-            }else {
+            } else {
                 return AjaxResult.error();
             }
 
@@ -257,33 +273,32 @@
     }
 
     @Override
-    public AjaxResult addData2(ZfProperty zfProperty){
+    public AjaxResult addData2(ZfProperty zfProperty) {
         ZInfoUser mySelf = getMySelf();
         String myFamilyId = mySelf.getFamilyId();
 
-        if (StringUtils.isNotEmpty(zfProperty.getFamilyId())){
+        if (StringUtils.isNotEmpty(zfProperty.getFamilyId())) {
             throw new RuntimeException("瀵煎叆鏁版嵁鏃舵偍涓嶈兘鎸囧畾瀹跺涵鍙�");
         }
 
-        if(StringUtils.isEmpty(myFamilyId)){
+        if (StringUtils.isEmpty(myFamilyId)) {
             throw new RuntimeException("鎮ㄨ繕鏈姞鍏ヤ换浣曞搴�");
         }
 
-        if (myFamilyId.contains(",")){
+        if (myFamilyId.contains(",")) {
             String[] myFamilyIds = myFamilyId.split(",");
             //榛樿娣诲姞绗竴涓搴殑鏁版嵁
             zfProperty.setFamilyId(myFamilyIds[0]);
-        }else {
+        } else {
             zfProperty.setFamilyId(myFamilyId);
         }
 
         if (save(zfProperty)) {
             return AjaxResult.success();
-        }else {
+        } else {
             return AjaxResult.error();
         }
     }
-
 
 
     @Override
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionServiceImpl.java
index 5a26611..f61f637 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionServiceImpl.java
@@ -13,6 +13,7 @@
 import com.ruoyi.domain.ZInfoUser;
 import com.ruoyi.domain.ZfCollection;
 import com.ruoyi.domain.ZfCollection;
+import com.ruoyi.domain.ZfCollection;
 import com.ruoyi.mapper.ZfCollectionMapper;
 import com.ruoyi.service.ZInfoUserService;
 import com.ruoyi.service.ZfCollectionService;
@@ -56,7 +57,8 @@
         lqw.like(StringUtils.isNotEmpty(zfCollection.getPrice()),ZfCollection::getPrice,zfCollection.getPrice());
         lqw.like(StringUtils.isNotEmpty(zfCollection.getLocation()),ZfCollection::getLocation,zfCollection.getLocation());
         lqw.like(StringUtils.isNotEmpty(zfCollection.getRemark()),ZfCollection::getRemark,zfCollection.getRemark());
-        lqw.like(zfCollection.getGetTime()!=null,ZfCollection::getGetTime,zfCollection.getGetTime());
+        lqw.eq(zfCollection.getHappenTime() != null, ZfCollection::getHappenTime, zfCollection.getHappenTime());
+        lqw.between(zfCollection.getHappenStartTime() != null && zfCollection.getHappenEndTime() != null, ZfCollection::getHappenTime, zfCollection.getHappenStartTime(), zfCollection.getHappenEndTime());
         return lqw;
     }
 
@@ -139,7 +141,7 @@
 
         }
 
-        lqw.orderByDesc(ZfCollection::getId);
+        lqw.orderByDesc(ZfCollection::getCreateTime);
         return lqw;
     }
 
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java
index fb803c4..9fef9fc 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java
@@ -42,36 +42,36 @@
 
     @Resource
     ZfEventService zfEventService;
-    
-    private String listFamilyIds(){
+
+    private String listFamilyIds() {
         SysUser user = SecurityUtils.getLoginUser().getUser();
         Long userId = user.getUserId();
         LambdaQueryWrapper<ZInfoUser> zInfoUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
-        zInfoUserLambdaQueryWrapper.eq(ZInfoUser::getUserId,userId);
+        zInfoUserLambdaQueryWrapper.eq(ZInfoUser::getUserId, userId);
         ZInfoUser zInfoUser = zInfoUserService.getOne(zInfoUserLambdaQueryWrapper);
         return zInfoUser.getFamilyId();
     }
-    
+
 
     @Override
     public AjaxResult selectEventList(ZfEvent zfEvent, Integer pageNum, Integer pageSize) {
         String familyIds = listFamilyIds();
-        LambdaQueryWrapper<ZfEvent> lqw = buildCondition(zfEvent,familyIds);
+        LambdaQueryWrapper<ZfEvent> lqw = buildCondition(zfEvent, familyIds);
 
-        Page<ZfEvent> ZfEventPage = new Page<>(pageNum,pageSize);
+        Page<ZfEvent> ZfEventPage = new Page<>(pageNum, pageSize);
         Page<ZfEvent> pageResult = page(ZfEventPage, lqw);
 
         HashMap<String, Object> data = MapUtils.getResult(pageResult);
         return AjaxResult.success(data);
     }
-    
+
 
     @Override
     public List<ZfEvent> selectByCondition(ZfEvent zfEvent) {
         String familyIds = listFamilyIds();
-        LambdaQueryWrapper<ZfEvent> lqw = buildCondition(zfEvent,familyIds);
+        LambdaQueryWrapper<ZfEvent> lqw = buildCondition(zfEvent, familyIds);
         List<ZfEvent> list = list(lqw);
-        log.info("杩斿洖鐨勬暟鎹负:{}",list);
+        log.info("杩斿洖鐨勬暟鎹负:{}", list);
         return list;
     }
 
@@ -119,11 +119,12 @@
 
     private LambdaQueryWrapper<ZfEvent> buildCondition(ZfEvent zfEvent) {
         LambdaQueryWrapper<ZfEvent> lqw = new LambdaQueryWrapper<>();
-        lqw.like(!StringUtils.isEmpty(zfEvent.getAddress()),ZfEvent::getAddress,zfEvent.getAddress());
-        lqw.like(!StringUtils.isEmpty(zfEvent.getPeople()),ZfEvent::getPeople,zfEvent.getPeople());
-        lqw.like(!StringUtils.isEmpty(zfEvent.getTitle()),ZfEvent::getTitle,zfEvent.getTitle());
-        lqw.like(!StringUtils.isEmpty(zfEvent.getRemark()),ZfEvent::getRemark,zfEvent.getRemark());
-        lqw.like(zfEvent.getCreateTime()!=null,ZfEvent::getCreateTime,zfEvent.getCreateTime());
+        lqw.like(!StringUtils.isEmpty(zfEvent.getAddress()), ZfEvent::getAddress, zfEvent.getAddress());
+        lqw.like(!StringUtils.isEmpty(zfEvent.getPeople()), ZfEvent::getPeople, zfEvent.getPeople());
+        lqw.like(!StringUtils.isEmpty(zfEvent.getTitle()), ZfEvent::getTitle, zfEvent.getTitle());
+        lqw.like(!StringUtils.isEmpty(zfEvent.getRemark()), ZfEvent::getRemark, zfEvent.getRemark());
+        lqw.eq(zfEvent.getHappenTime() != null, ZfEvent::getHappenTime, zfEvent.getHappenTime());
+        lqw.between(zfEvent.getHappenStartTime() != null && zfEvent.getHappenEndTime() != null, ZfEvent::getHappenTime, zfEvent.getHappenStartTime(), zfEvent.getHappenEndTime());
         return lqw;
     }
 
@@ -131,9 +132,9 @@
         LambdaQueryWrapper<ZfEvent> lqw = buildCondition(zfEvent);
         if (familyIds.contains(",")) {
             String[] familyList = familyIds.split(",");
-            lqw.in(ZfEvent::getFamilyId,familyList);
-        }else {
-            lqw.eq(ZfEvent::getFamilyId,familyIds);
+            lqw.in(ZfEvent::getFamilyId, familyList);
+        } else {
+            lqw.eq(ZfEvent::getFamilyId, familyIds);
         }
         return lqw;
     }

--
Gitblit v1.9.1