Browse Source

修改限定列表,排序字段更改,排序方式更改

anderx 1 year ago
parent
commit
0304a7ea22

+ 10 - 0
src/main/java/com/goafanti/business/bo/RestrictProjectPageList.java

@@ -56,6 +56,16 @@ public class RestrictProjectPageList {
     private String intendedProject;
     private String     businessScope;
 
+    private Integer days;
+
+    public Integer getDays() {
+        return days;
+    }
+
+    public void setDays(Integer days) {
+        this.days = days;
+    }
+
     public String getPid() {
         return pid;
     }

+ 12 - 12
src/main/java/com/goafanti/business/service/impl/RestrictProjectServiceImpl.java

@@ -20,8 +20,6 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
-import java.time.LocalDateTime;
-import java.time.temporal.ChronoUnit;
 import java.util.*;
 
 @Service
@@ -175,19 +173,21 @@ public class RestrictProjectServiceImpl extends BaseMybatisDao<RestrictProjectMa
 
 
     private void pushPageList(List<RestrictProjectPageList> list) {
-        LocalDateTime now = LocalDateTime.now();
-        now=now.withHour(0).withMinute(0).withSecond(0).withNano(0);
+//        LocalDateTime now = LocalDateTime.now();
+//        now=now.withHour(0).withMinute(0).withSecond(0).withNano(0);
         for (RestrictProjectPageList e : list) {
-            LocalDateTime lockTime = e.getLockTime().toInstant().atZone(java.time.ZoneId.systemDefault()).toLocalDateTime();
-            lockTime=lockTime.withHour(0).withMinute(0).withSecond(0).withNano(0);
+//            LocalDateTime lockTime = e.getLockTime().toInstant().atZone(java.time.ZoneId.systemDefault()).toLocalDateTime();
+//            lockTime=lockTime.withHour(0).withMinute(0).withSecond(0).withNano(0);
             if (e.getType()==1){
-                LocalDateTime endTime = lockTime.plusDays(30);
-                long between = ChronoUnit.DAYS.between(now, endTime);
-                e.setPrivateDays(between>0?(int)between:0);
+//                LocalDateTime endTime = lockTime.plusDays(30);
+//                long between = ChronoUnit.DAYS.between(now, endTime);
+//                e.setPrivateDays(between>0?(int)between:0);
+                e.setPrivateDays(e.getDays());
             }else if (e.getType()==2){
-                LocalDateTime endTime = lockTime.plusDays(270);
-                long between = ChronoUnit.DAYS.between(now, endTime);
-                e.setSignDays(between>0?(int)between:0);
+//                LocalDateTime endTime = lockTime.plusDays(270);
+//                long between = ChronoUnit.DAYS.between(now, endTime);
+//                e.setSignDays(between>0?(int)between:0);
+                e.setSignDays(e.getDays());
             }
         }
     }

+ 9 - 6
src/main/java/com/goafanti/common/mapper/RestrictProjectMapper.xml

@@ -133,19 +133,22 @@
         where a.restrict_status =1
     </select>
     <select id="RestrictProjectList" resultType="com.goafanti.business.bo.RestrictProjectPageList">
-        select a.id,b.nickname name,c.bname projectName,a.`type` ,ad.name userAdmin,ad2.name adminName,a.lock_time lockTime,
-               a.last_follow_time lastFollowTime,a.uid, b.society_tag societyTag,dg1.name as province, dg2.name as city,
-               dg3.name as area,d.intended_project intendedProject, d.business_scope businessScope,a.pid
+        select *
+        from (select a.id,b.nickname name,c.bname projectName,a.`type` ,ad.name userAdmin,ad2.name adminName,a.lock_time lockTime,
+        a.last_follow_time lastFollowTime,a.uid, b.society_tag societyTag,dg1.name as province, dg2.name as city,
+        dg3.name as area,d.intended_project intendedProject, d.business_scope businessScope,a.pid,
+        (if(a.type=1,30,270) -DATEDIFF(now(),if(a.last_follow_time>a.lock_time,a.last_follow_time,a.lock_time)))days
         from restrict_project a
-                 left join user b on a.uid =b.id left join business_project c on a.pid =c.id
-                 left join admin ad on b.aid =ad.id left join admin ad2 on a.aid =ad2.id
+        left join user b on a.uid =b.id left join business_project c on a.pid =c.id
+        left join admin ad on b.aid =ad.id left join admin ad2 on a.aid =ad2.id
         left join organization_identity d on b.id = d.uid
         left join district_glossory dg1 on d.location_province = dg1.id
         left join district_glossory dg2 on d.location_city = dg2.id
         left join district_glossory dg3 on d.location_area = dg3.id
         where a.`type` >0
         <include refid="RestrictProjectSql"/>
-        order by a.lock_time desc
+        )x
+        order by x.days
     </select>
     <sql id="RestrictProjectSql">
         <if test="aid != null">

+ 5 - 5
src/main/resources/props/config_local.properties

@@ -4,13 +4,13 @@ jdbc.driverClassName=com.mysql.jdbc.Driver
 static.host=//uat.jishutao.com/1.3.16
 #static.host=//172.16.1.187/1.3.15
 
-jdbc.url=jdbc\:mysql://localhost:3306/aft20240430?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+#jdbc.url=jdbc\:mysql://localhost:3306/aft20240430?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
 #jdbc.url=jdbc\:mysql://localhost:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
-jdbc.username=root
-jdbc.password=123456
-#jdbc.url=jdbc:mysql://101.37.32.31:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
 #jdbc.username=root
-#jdbc.password=aftdev
+#jdbc.password=123456
+jdbc.url=jdbc:mysql://101.37.32.31:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+jdbc.username=root
+jdbc.password=aftdev
 jdbc.validationQuery=SELECT 'x'
 jdbc.initialSize=3
 jdbc.maxActive=20