Browse Source

首页获取最近打卡信息修改

anderx 1 year ago
parent
commit
7652d41e50

+ 3 - 2
src/main/java/com/goafanti/common/mapper/PublicReleaseMapper.xml

@@ -726,8 +726,9 @@
     <select id="selectMyNewPublic" resultMap="BaseResultMap">
         select
         <include refid="Base_Column_List" />
-        where a.status in(1,2)  and a.aid = #{aid}
-        order by a.release_start desc limit 10
+        from public_release
+        where status in(1,2)  and aid = #{aid}
+        order by release_start desc limit 10
     </select>
     <select id="selectOutListBoById" resultType="com.goafanti.weChat.bo.OutPublicReleaseList">
         select  a.id ,c.name  aname,date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,a.aid,a.public_type publicType,

+ 11 - 10
src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java

@@ -1350,21 +1350,23 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		Integer id=null;
 		long count=999999;
 		for (PublicRelease e : myPublic) {
-			long time = e.getReleaseStart().getTime();
-			long time2 = e.getReleaseEnd().getTime();
 			long nowTime=System.currentTimeMillis();
-			if ((nowTime-time)/(1000*60)<count){
-				count=(time-nowTime)/(1000*60);
+			long time = Math.abs(nowTime-e.getReleaseStart().getTime())/(1000*60);
+			long time2 = Math.abs(e.getReleaseEnd().getTime()-nowTime)/(1000*60);
+
+			if (time<count&&e.getReleaseStart().getTime()<nowTime){
+				count=time;
 				id=e.getId();
 			}
-			if ((time2-nowTime)/(1000*60)<count){
-				count=(time2-nowTime)/(1000*60);
+			if (time2<count&&e.getReleaseEnd().getTime()>nowTime){
+				count=time2;
 				id=e.getId();
 			}
 		}
-		if (id!=null){
-			return publicReleaseMapper.selectOutListBoById(id);
-		}
+		if (id==null)id=myPublic.get(0).getId();
+		OutPublicReleaseList out = publicReleaseMapper.selectOutListBoById(id);
+		out.setPrdList(publicReleaseDetailsMapper.selectByPCid(out.getId()));
+		return out;
 //		List<OutPublicReleaseList> myPublic = getMyPublic(0,1);
 //		if (myPublic.isEmpty()){
 //			List<OutPublicReleaseList> myPublic2 = getMyPublic(0,0);
@@ -1374,7 +1376,6 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 //		}else {
 //			return myPublic.get(0);
 //		}
-		return null;
 	}