Browse Source

首页-公告(未读、已读、未读排序在前)

user5 4 năm trước cách đây
mục cha
commit
77afce1ad9

+ 35 - 0
src/main/java/com/jeeplus/modules/oa/dao/OaNotifyDao.java

@@ -6,6 +6,8 @@ package com.jeeplus.modules.oa.dao;
 import com.jeeplus.common.persistence.CrudDao;
 import com.jeeplus.common.persistence.annotation.MyBatisDao;
 import com.jeeplus.modules.oa.entity.OaNotify;
+import com.jeeplus.modules.oa.entity.OaNotifyView;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -36,4 +38,37 @@ public interface OaNotifyDao extends CrudDao<OaNotify> {
     void updateStatusById(OaNotify oaNotify);
 
     void updateProcessIdAndStatus(OaNotify oaNotify);
+
+    //我的通告(未读)
+    List<OaNotify> findUnReadList(OaNotify oaNotify);
+
+    //我的通告(已读)
+    List<OaNotify> findReadList(OaNotify oaNotify);
+
+    /**
+     * 根据公告id查询查看公告记录信息
+     * @param oaNotifyId
+     * @return
+     */
+    List<OaNotifyView> getOaNotifyViewList(String oaNotifyId);
+
+    /**
+     * 根据公告id和用户id查询查看公告信息数据
+     * @param oaNotifyId
+     * @param userId
+     * @return
+     */
+    OaNotifyView getOaNotifyView(@Param("oaNotifyId") String oaNotifyId,@Param("userId")String userId);
+
+    /**
+     * 新增公告浏览记录
+     * @param oaNotifyView
+     */
+    void saveOaNotifyView(OaNotifyView oaNotifyView);
+
+    /**
+     * 修改公告浏览记录
+     * @param oaNotifyView
+     */
+    void updateOaNotifyView(OaNotifyView oaNotifyView);
 }

+ 60 - 0
src/main/java/com/jeeplus/modules/oa/entity/OaNotifyView.java

@@ -0,0 +1,60 @@
+package com.jeeplus.modules.oa.entity;
+
+import com.jeeplus.common.persistence.DataEntity;
+
+import java.util.Date;
+
+/**
+ * @author: 大猫
+ * @create: 2020-12-03 16:54
+ **/
+public class OaNotifyView extends DataEntity<OaNotifyView> {
+
+    private static final long serialVersionUID = 1L;
+
+    private String afficheId;  //公告id
+    private String userId;  //访问用户id
+    private Date firstVisitTime;  //首次访问时间
+    private Date lastVisitTime;   //最有一次访问时间
+    private Integer visitCount;  //访问次数
+
+    public String getAfficheId() {
+        return afficheId;
+    }
+
+    public void setAfficheId(String afficheId) {
+        this.afficheId = afficheId;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public Date getFirstVisitTime() {
+        return firstVisitTime;
+    }
+
+    public void setFirstVisitTime(Date firstVisitTime) {
+        this.firstVisitTime = firstVisitTime;
+    }
+
+    public Date getLastVisitTime() {
+        return lastVisitTime;
+    }
+
+    public void setLastVisitTime(Date lastVisitTime) {
+        this.lastVisitTime = lastVisitTime;
+    }
+
+    public Integer getVisitCount() {
+        return visitCount;
+    }
+
+    public void setVisitCount(Integer visitCount) {
+        this.visitCount = visitCount;
+    }
+}

+ 95 - 0
src/main/java/com/jeeplus/modules/oa/service/OaNotifyService.java

@@ -19,6 +19,7 @@ import com.jeeplus.modules.oa.dao.OaNotifyDetailDao;
 import com.jeeplus.modules.oa.dao.OaNotifyRecordDao;
 import com.jeeplus.modules.oa.entity.OaNotify;
 import com.jeeplus.modules.oa.entity.OaNotifyRecord;
+import com.jeeplus.modules.oa.entity.OaNotifyView;
 import com.jeeplus.modules.projectrecord.enums.ProjectStatusEnum;
 import com.jeeplus.modules.pushinfo.entity.Pushinfo;
 import com.jeeplus.modules.pushinfo.service.PushinfoService;
@@ -174,6 +175,56 @@ public class OaNotifyService extends CrudService<OaNotifyDao, OaNotify> {
         page.setList(oaNotifyList);
         return page;
     }
+
+    //我的通告(个人未读)
+    public Page<OaNotify> findUnreadMyself(Page<OaNotify> page, OaNotify oaNotify) {
+        User user = UserUtils.getUser();
+        oaNotify.setCurrentUser(user);
+
+        if(!user.isAdmin()){
+            oaNotify.setCompany(user.getCompany());
+        }
+        oaNotify.setPage(page);
+        List<OaNotify> oaNotifyList = dao.findUnReadList(oaNotify);
+        for (OaNotify notify:oaNotifyList){
+            if (StringUtils.isBlank(notify.getRemarks())) {
+                Long endDate = notify.getEndDate().getTime();
+                Long startDate = notify.getStartDate().getTime();
+                Long now = new Date().getTime();
+                if (startDate < now && endDate > now) {
+                    notify.setCandel("yes");
+                }
+            }
+        }
+        //只查询当前公司下发送给自己的通告
+        page.setList(oaNotifyList);
+        return page;
+    }
+
+    //我的通告(个人已读)
+    public Page<OaNotify> findReadMyself(Page<OaNotify> page, OaNotify oaNotify) {
+        User user = UserUtils.getUser();
+        oaNotify.setCurrentUser(user);
+
+        if(!user.isAdmin()){
+            oaNotify.setCompany(user.getCompany());
+        }
+        oaNotify.setPage(page);
+        List<OaNotify> oaNotifyList = dao.findReadList(oaNotify);
+        for (OaNotify notify:oaNotifyList){
+            if (StringUtils.isBlank(notify.getRemarks())) {
+                Long endDate = notify.getEndDate().getTime();
+                Long startDate = notify.getStartDate().getTime();
+                Long now = new Date().getTime();
+                if (startDate < now && endDate > now) {
+                    notify.setCandel("yes");
+                }
+            }
+        }
+        //只查询当前公司下发送给自己的通告
+        page.setList(oaNotifyList);
+        return page;
+    }
     //通告管理(管理员)
     public Page<OaNotify> find(Page<OaNotify> page, OaNotify oaNotify) {
         oaNotify.setPage(page);
@@ -1000,4 +1051,48 @@ public class OaNotifyService extends CrudService<OaNotifyDao, OaNotify> {
             }
         }
     }
+
+    /**
+     * 根据公告id和用户id查询查看公告信息数据
+     * @param oaNotifyId
+     * @param userId
+     * @return
+     */
+    public OaNotifyView getOaNotifyView(String oaNotifyId, String userId){
+        return dao.getOaNotifyView(oaNotifyId, userId);
+
+    }
+
+    /**
+     * 根据公告id查询查看公告记录信息
+     * @param oaNotifyId
+     * @return
+     */
+    public List<OaNotifyView> getOaNotifyViewList(String oaNotifyId){
+        return dao.getOaNotifyViewList(oaNotifyId);
+    }
+
+    /**
+     *
+     * @param oaNotifyView
+     */
+    @Transactional(readOnly = false)
+    public void saveOaNotifyView(OaNotifyView oaNotifyView,String oaNotifyId){
+        //判断是否为空,若为空则该公告没看过 则对该公告进行添加基本数据
+        if(null == oaNotifyView){
+            OaNotifyView newOaNotifyView = new OaNotifyView();
+            newOaNotifyView.setAfficheId(oaNotifyId);
+            newOaNotifyView.setUserId(UserUtils.getUser().getId());
+            newOaNotifyView.setVisitCount(1);
+            newOaNotifyView.setFirstVisitTime(new Date());
+            newOaNotifyView.setLastVisitTime(new Date());
+            newOaNotifyView.preInsert();
+            dao.saveOaNotifyView(newOaNotifyView);
+        }else{
+            //如果已经有查看记录则修改最后一次查看记录时间并修改查看次数
+            oaNotifyView.setLastVisitTime(new Date());
+            oaNotifyView.preUpdate();
+            dao.updateOaNotifyView(oaNotifyView);
+        }
+    }
 }

+ 29 - 1
src/main/java/com/jeeplus/modules/oa/web/OaNotifyController.java

@@ -14,6 +14,7 @@ import com.jeeplus.modules.act.entity.Act;
 import com.jeeplus.modules.act.service.ActTaskService;
 import com.jeeplus.modules.oa.entity.OaNotify;
 import com.jeeplus.modules.oa.entity.OaNotifyRecord;
+import com.jeeplus.modules.oa.entity.OaNotifyView;
 import com.jeeplus.modules.oa.service.OaNotifyService;
 import com.jeeplus.modules.projectrecord.enums.ProjectStatusEnum;
 import com.jeeplus.modules.pushinfo.service.PushinfoService;
@@ -74,7 +75,7 @@ public class OaNotifyController extends BaseController {
 	@RequestMapping(value = {"self"})
 	public String listMyself(OaNotify oaNotify, HttpServletRequest request, HttpServletResponse response, Model model) {
 		oaNotify.setSelf(true);
-		Page<OaNotify> page = oaNotifyService.findMyself(new Page<OaNotify>(request, response), oaNotify);
+		Page<OaNotify> page = oaNotifyService.findUnreadMyself(new Page<OaNotify>(request, response), oaNotify);
 		List<OaNotify> list = page.getList();
 		for (OaNotify notify:list){
 			if (StringUtils.isNotBlank(notify.getContent())){
@@ -84,6 +85,20 @@ public class OaNotifyController extends BaseController {
 		model.addAttribute("page", page);
 		return "modules/oa/oaNotifyListMyself";
 	}
+	//我的公告(已读)
+	@RequestMapping(value = {"readSelf"})
+	public String listReadMyself(OaNotify oaNotify, HttpServletRequest request, HttpServletResponse response, Model model) {
+		oaNotify.setSelf(true);
+		Page<OaNotify> page = oaNotifyService.findReadMyself(new Page<OaNotify>(request, response), oaNotify);
+		List<OaNotify> list = page.getList();
+		for (OaNotify notify:list){
+			if (StringUtils.isNotBlank(notify.getContent())){
+				notify.setContent(notify.getContent().replace("\n",""));
+			}
+		}
+		model.addAttribute("page", page);
+		return "modules/oa/oaNotifyListReadMyself";
+	}
 	//通告管理
 	@RequiresPermissions("oa:oaNotify:list")
 	@RequestMapping(value = {"list", ""})
@@ -133,6 +148,10 @@ public class OaNotifyController extends BaseController {
 		oaNotify.setContent("");
 		model.addAttribute("oaNotify", oaNotify);
 		if(StringUtils.isNotBlank(view)&& "view".equals(view)){
+			//查看登陆者访问该公告信息
+			OaNotifyView oaNotifyView = oaNotifyService.getOaNotifyView(oaNotify.getId(), UserUtils.getUser().getId());
+			//更新查看公告已看数据
+			oaNotifyService.saveOaNotifyView(oaNotifyView,oaNotify.getId());
 			return "modules/oa/oaNotifyView";
 		}
 		return "modules/oa/oaNotifyForm";
@@ -357,9 +376,18 @@ public class OaNotifyController extends BaseController {
 			oaNotify = oaNotifyService.getRecordList(oaNotify);
 			oaNotifyService.getUsers(oaNotify);
 			oaNotifyService.getOffices(oaNotify);
+			//查看登陆者访问该公告信息
+			OaNotifyView oaNotifyView = oaNotifyService.getOaNotifyView(oaNotify.getId(), UserUtils.getUser().getId());
+			//更新查看公告已看数据
+			oaNotifyService.saveOaNotifyView(oaNotifyView,oaNotify.getId());
+
+			//根据公告id查询查看公告记录信息(先修改查看记录 再进行查询)
+			List<OaNotifyView> oaNotifyViewList = oaNotifyService.getOaNotifyViewList(oaNotify.getId());
+
 			model.addAttribute("toReadMyNotify",true);
 			model.addAttribute("disabled",(readAttr==null||"".equals(readAttr))?"false":"true");
 			model.addAttribute("oaNotify", oaNotify);
+			model.addAttribute("oaNotifyViewList", oaNotifyViewList);
 			return "modules/oa/oaNotifyView";
 		}
 		return "redirect:" + adminPath + "/oa/oaNotify/self?repage";

+ 240 - 2
src/main/resources/mappings/modules/oa/OaNotifyDao.xml

@@ -49,7 +49,7 @@
 	</select>
 	
 	<select id="findList" resultType="OaNotify">
-		SELECT 
+		SELECT
 			<include refid="oaNotifyColumns"/>
 			<if test="isSelf">,
                     r.read_flag
@@ -60,13 +60,14 @@
 		<if test="isSelf">
 			JOIN oa_notify_record r ON r.oa_notify_id = a.id AND r.user_id = #{currentUser.id,jdbcType=VARCHAR}
 		</if>
+		left join work_oa_notify_view wo on a.id =wo.affiche_id and wo.user_id = #{currentUser.id,jdbcType=VARCHAR}
 		WHERE a.del_flag = #{DEL_FLAG_NORMAL} and close_status = 0
 		<!-- 未读0,已读1 -->
 		<if test="readFlag != null and readFlag != ''">
 			AND r.read_flag = #{readFlag}
 		</if>
 		<if test="title != null and title != ''">
-			AND a.TITLE LIKE 
+			AND a.TITLE LIKE
 					<if test="dbName == 'oracle'">'%'||#{title}||'%'</if>
 					<if test="dbName == 'mysql'">CONCAT('%', #{title}, '%')</if>
 		</if>
@@ -117,6 +118,158 @@
 			AND a.start_date &lt;= #{nowDate} AND a.end_date &gt;= #{nowDate}
 		</if>
 
+		ORDER BY wo.id asc, a.update_date DESC
+	</select>
+
+	<select id="findUnReadList" resultType="OaNotify">
+		SELECT
+			<include refid="oaNotifyColumns"/>
+			<if test="isSelf">,
+                    r.read_flag
+			</if>
+		FROM oa_notify a
+		<include refid="oaNotifyJoins"/>
+		<!-- 我的通告 -->
+		<if test="isSelf">
+			JOIN oa_notify_record r ON r.oa_notify_id = a.id AND r.user_id = #{currentUser.id,jdbcType=VARCHAR}
+		</if>
+		<!-- 关联公告查看表 -->
+		left join work_oa_notify_view wo on a.id =wo.affiche_id and wo.user_id = #{currentUser.id}
+
+		WHERE a.del_flag = #{DEL_FLAG_NORMAL} and close_status = 0
+		<!-- 未读0,已读1 -->
+		<if test="readFlag != null and readFlag != ''">
+			AND r.read_flag = #{readFlag}
+		</if>
+		<if test="title != null and title != ''">
+			AND a.TITLE LIKE
+					<if test="dbName == 'oracle'">'%'||#{title}||'%'</if>
+					<if test="dbName == 'mysql'">CONCAT('%', #{title}, '%')</if>
+		</if>
+		<if test="type != null and type != ''">
+			AND a.TYPE = #{type}
+		</if>
+		<if test="number != null and number != ''">
+			AND a.number = #{number}
+		</if>
+		<if test="status != null and status != ''">
+			AND a.STATUS = #{status}
+		</if>
+		<!-- 我的通告:只查询"发布"状态的,不要"草稿"状态的 -->
+		<if test="isSelf">
+			AND a.STATUS = '5'
+		</if>
+		<if test="title != null and title != ''">
+			AND a.title like
+			<if test="dbName == 'oracle'">'%'||#{ctitle}||'%'</if>
+			<if test="dbName == 'mysql'">CONCAT('%', #{title}, '%')</if>
+		</if>
+		<if test="content != null and content != ''">
+			AND a.content like
+			<if test="dbName == 'oracle'">'%'||#{content}||'%'</if>
+			<if test="dbName == 'mysql'">CONCAT('%', #{content}, '%')</if>
+		</if>
+		<if test="company != null and company.id !=null and company.id != ''">
+			AND a.company_id = #{company.id}
+		</if>
+		<if test="office != null and office.id !=null and office.id != ''">
+			AND a.office_id = #{office.id}
+		</if>
+        <if test="createBy != null and createBy.id !=null and createBy.id != ''">
+            AND a.CREATE_BY = #{createBy.id}
+        </if>
+        <if test="createBy != null and createBy.name !=null and createBy.name != ''">
+            AND u.name like
+			<if test="dbName == 'oracle'">'%'||#{createBy.name}||'%'</if>
+			<if test="dbName == 'mysql'">CONCAT('%', #{createBy.name}, '%')</if>
+        </if>
+		<if test="createStartDate != null and createStartDate != ''">
+			AND a.create_date &gt;= #{createStartDate}
+		</if>
+		<if test="createEndDate != null and createEndDate != ''">
+			AND a.create_date &lt;= #{createEndDate}
+		</if>
+		<if test="nowDate != null and nowDate != ''">
+			AND a.start_date &lt;= #{nowDate} AND a.end_date &gt;= #{nowDate}
+		</if>
+		and wo.affiche_id is null
+		ORDER BY a.update_date DESC
+	</select>
+
+	<select id="findReadList" resultType="OaNotify">
+		SELECT
+
+			<include refid="oaNotifyColumns"/>
+			<if test="isSelf">,
+                    r.read_flag
+			</if>
+		FROM oa_notify a
+		<include refid="oaNotifyJoins"/>
+		<!-- 我的通告 -->
+		<if test="isSelf">
+			JOIN oa_notify_record r ON r.oa_notify_id = a.id AND r.user_id = #{currentUser.id,jdbcType=VARCHAR}
+		</if>
+		<!-- 关联公告查看表 -->
+		left join work_oa_notify_view wo on a.id =wo.affiche_id and wo.user_id = #{currentUser.id}
+
+		WHERE a.del_flag = #{DEL_FLAG_NORMAL} and close_status = 0
+		<!-- 未读0,已读1 -->
+		<if test="readFlag != null and readFlag != ''">
+			AND r.read_flag = #{readFlag}
+		</if>
+		<if test="title != null and title != ''">
+			AND a.TITLE LIKE
+					<if test="dbName == 'oracle'">'%'||#{title}||'%'</if>
+					<if test="dbName == 'mysql'">CONCAT('%', #{title}, '%')</if>
+		</if>
+		<if test="type != null and type != ''">
+			AND a.TYPE = #{type}
+		</if>
+		<if test="number != null and number != ''">
+			AND a.number = #{number}
+		</if>
+		<if test="status != null and status != ''">
+			AND a.STATUS = #{status}
+		</if>
+		<!-- 我的通告:只查询"发布"状态的,不要"草稿"状态的 -->
+		<if test="isSelf">
+			AND a.STATUS = '5'
+		</if>
+		<if test="title != null and title != ''">
+			AND a.title like
+			<if test="dbName == 'oracle'">'%'||#{ctitle}||'%'</if>
+			<if test="dbName == 'mysql'">CONCAT('%', #{title}, '%')</if>
+		</if>
+		<if test="content != null and content != ''">
+			AND a.content like
+			<if test="dbName == 'oracle'">'%'||#{content}||'%'</if>
+			<if test="dbName == 'mysql'">CONCAT('%', #{content}, '%')</if>
+		</if>
+		<if test="company != null and company.id !=null and company.id != ''">
+			AND a.company_id = #{company.id}
+		</if>
+		<if test="office != null and office.id !=null and office.id != ''">
+			AND a.office_id = #{office.id}
+		</if>
+        <if test="createBy != null and createBy.id !=null and createBy.id != ''">
+            AND a.CREATE_BY = #{createBy.id}
+        </if>
+        <if test="createBy != null and createBy.name !=null and createBy.name != ''">
+            AND u.name like
+			<if test="dbName == 'oracle'">'%'||#{createBy.name}||'%'</if>
+			<if test="dbName == 'mysql'">CONCAT('%', #{createBy.name}, '%')</if>
+        </if>
+		<if test="createStartDate != null and createStartDate != ''">
+			AND a.create_date &gt;= #{createStartDate}
+		</if>
+		<if test="createEndDate != null and createEndDate != ''">
+			AND a.create_date &lt;= #{createEndDate}
+		</if>
+		<if test="nowDate != null and nowDate != ''">
+			AND a.start_date &lt;= #{nowDate} AND a.end_date &gt;= #{nowDate}
+		</if>
+		and wo.user_id = #{currentUser.id}
+		and wo.id is not null
 		ORDER BY a.update_date DESC
 	</select>
 
@@ -320,4 +473,89 @@
         status = #{status}
         WHERE id = #{id}
     </update>
+
+	<select id="getOaNotifyViewList" resultType="com.jeeplus.modules.oa.entity.OaNotifyView">
+		select
+		  a.id AS "id",
+		  a.create_by AS "createBy.id",
+		  a.create_date AS "createDate",
+		  a.update_by AS "updateBy.id",
+		  a.update_date AS "updateDate",
+		  a.del_flag AS "delFlag",
+		  a.remarks AS "remarks",
+		  a.affiche_id as "afficheId",
+		  su.name as "userId",
+		  a.first_visit_time as "firstVisitTime",
+		  a.last_visit_time as "lastVisitTime",
+		  a.visit_count as "visitCount"
+		from
+		  work_oa_notify_view a
+		  left join sys_user su on a.user_id = su.id
+		  where
+		  a.affiche_id = #{oaNotifyId}
+	</select>
+
+	<select id="getOaNotifyView" resultType="com.jeeplus.modules.oa.entity.OaNotifyView">
+		select
+		  a.id AS "id",
+		  a.create_by AS "createBy.id",
+		  a.create_date AS "createDate",
+		  a.update_by AS "updateBy.id",
+		  a.update_date AS "updateDate",
+		  a.del_flag AS "delFlag",
+		  a.remarks AS "remarks",
+		  a.affiche_id as "afficheId",
+		  a.user_id as "userId",
+		  a.first_visit_time as "firstVisitTime",
+		  a.last_visit_time as "lastVisitTime",
+		  a.visit_count as "visitCount"
+		from
+		  work_oa_notify_view a
+		  where
+		  a.affiche_id = #{oaNotifyId}
+		  and a.user_id = #{userId}
+	</select>
+
+	<insert id="saveOaNotifyView">
+		insert into work_oa_notify_view (
+		  id,
+		  create_by,
+		  create_date,
+		  update_by,
+		  update_date,
+		  remarks,
+		  del_flag,
+		  affiche_id,
+		  user_id,
+		  first_visit_time,
+		  last_visit_time,
+		  visit_count
+		)
+		values
+		  (
+			#{id},
+			#{createBy.id},
+			#{createDate},
+			#{updateBy.id},
+			#{updateDate},
+			#{remarks},
+			#{delFlag},
+			#{afficheId},
+			#{userId},
+			#{firstVisitTime},
+			#{lastVisitTime},
+			#{visitCount}
+		  )
+	</insert>
+
+	<update id="updateOaNotifyView">
+		update
+			work_oa_notify_view
+		set
+			update_by = #{updateBy.id},
+			update_date = #{updateDate},
+			last_visit_time = #{lastVisitTime},
+			visit_count = visit_count + 1
+		where id = #{id}
+	</update>
 </mapper>

+ 47 - 11
src/main/webapp/webpage/modules/oa/oaNotifyListMyself.jsp

@@ -27,14 +27,44 @@
             laydate.render({
                 elem: '#createStartDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎,因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
                 event: 'focus', //响应事件。如果没有传入event,则按照默认的click
-                type : 'datetime'
+                type : 'date'
             });
             laydate.render({
                 elem: '#createEndDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎,因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
                 event: 'focus', //响应事件。如果没有传入event,则按照默认的click
-                type : 'datetime'
+                type : 'date'
             });
         });
+
+
+		//打开对话框(查看)
+		function openView(title,url,width,height){
+
+
+			if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+				width='auto';
+				height='auto';
+			}else{//如果是PC端,根据用户设置的width和height显示。
+
+			}
+			top.layer.open({
+				type: 2,
+				skin: 'one-btn',
+				area: [width, height],
+				title: title,
+				maxmin: true, //开启最大化最小化按钮
+				content: url ,
+				btn: ['关闭'],
+				yes: function(index, layero){
+					top.layer.close(index);
+					location.reload();
+				},
+				cancel: function(index){
+
+				}
+			});
+
+		}
 	</script>
 
 	<style>
@@ -52,6 +82,12 @@
 	<sys:message content="${message}"/>
 	<div class="layui-row">
 		<div class="full-width fl">
+			<div class="list-form-tab contentShadow shadowLTR" id="tabDiv">
+				<ul class="list-tabs" >
+					<li class="active"><a href="${ctx}/oa/oaNotify/self">未读公告</a></li>
+					<li><a href="${ctx}/oa/oaNotify/readSelf">已读公告</a></li>
+				</ul>
+			</div>
 			<div class="contentShadow layui-row" id="queryDiv">
 			<form:form id="searchForm" modelAttribute="oaNotify" action="${ctx}/oa/oaNotify/self" method="post" class="form-inline">
 			<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
@@ -93,13 +129,13 @@
 					<div class="layui-item query athird">
 						<label class="layui-form-label">创建日期:</label>
 						<div class="layui-input-block">
-							<input class="form-control layer-date laydate-icon layui-input laydate-icondate" id="createStartDate" name="createStartDate" value="<fmt:formatDate value="${oaNotify.createStartDate}" pattern="yyyy-MM-dd"/>" onclick="laydate({istime: false, format: 'YYYY-MM-DD'})">
-						</div>
-					</div>
-					<div class="layui-item query athird">
-						<label class="layui-form-label">——&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
-						<div class="layui-input-block">
-							<input class="form-control layer-date laydate-icon layui-input laydate-icondate" id="createEndDate" name="createEndDate" value="<fmt:formatDate value="${oaNotify.createEndDate}" pattern="yyyy-MM-dd"/>" onclick="laydate({istime: false, format: 'YYYY-MM-DD'})">
+							<input id="createStartDate" name="createStartDate" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date layui-input laydate-icon query-group"
+								   value="<fmt:formatDate value="${oaNotify.createStartDate}" pattern="yyyy-MM-dd"/>"/>
+							</input>
+							<span class="group-sep">-</span>
+							<input id="createEndDate" name="createEndDate" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date layui-input laydate-icon query-group"
+								   value="<fmt:formatDate value="${oaNotify.createEndDate}" pattern="yyyy-MM-dd"/>"/>
+							</input>
 						</div>
 					</div>
 					<div class="layui-item query athird">
@@ -152,12 +188,12 @@
                 // {checkbox: true, fixed: true},
                 {field:'index',align:'center',  width:40,title: '序号'}
                 ,{field:'number',align:'center', title: '公告编号', minWidth:150,templet:function(d){
-                    var xml = "<a class=\"attention-info\" href=\"javascript:void(0)\" onclick=\"openDialogView('查看公告', '${ctx}/oa/oaNotify/view?id=" + d.id + "&view=view','95%','95%')\">" +
+                    var xml = "<a class=\"attention-info\" href=\"javascript:void(0)\" onclick=\"openView('查看公告', '${ctx}/oa/oaNotify/view?id=" + d.id + "&view=view','95%','95%')\">" +
                         "<span title=" + d.number + ">" + d.number + "</span></a>";
                     return xml;
                 }}
                 ,{field:'title',align:'center', title: '公告标题', minWidth:150/*,templet:function(d){
-                    var xml = "<a class=\"attention-info\" href=\"javascript:void(0)\" onclick=\"openDialogView('查看公告', '${ctx}/oa/oaNotify/form?id=" + d.id + "&view=view','95%','95%')\">" +
+                    var xml = "<a class=\"attention-info\" href=\"javascript:void(0)\" onclick=\"openView('查看公告', '${ctx}/oa/oaNotify/form?id=" + d.id + "&view=view','95%','95%')\">" +
                         "<span title=" + d.title + ">" + d.title + "</span></a>";
                     return xml;
                 }*/}

+ 220 - 0
src/main/webapp/webpage/modules/oa/oaNotifyListReadMyself.jsp

@@ -0,0 +1,220 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<html>
+<head>
+	<title>我的通告</title>
+	<meta name="decorator" content="default"/>
+	<script type="text/javascript" src="${ctxStatic}/ckeditor/ckeditor.js"></script>
+	<script type="text/javascript">
+
+		$(function () {
+			$(".btn btn-white btn-sm").bind("click",function () {
+
+            })
+        });
+        $(document).ready(function() {
+            //搜索框收放
+            $('#moresee').click(function(){
+                if($('#moresees').is(':visible'))
+                {
+                    $('#moresees').slideUp(0,resizeListWindow1);
+                    $('#moresee i').removeClass("glyphicon glyphicon-menu-up").addClass("glyphicon glyphicon-menu-down");
+                }else{
+                    $('#moresees').slideDown(0,resizeListWindow1);
+                    $('#moresee i').removeClass("glyphicon glyphicon-menu-down").addClass("glyphicon glyphicon-menu-up");
+                }
+            });
+            laydate.render({
+                elem: '#createStartDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎,因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
+                event: 'focus', //响应事件。如果没有传入event,则按照默认的click
+                type : 'date'
+            });
+            laydate.render({
+                elem: '#createEndDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎,因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
+                event: 'focus', //响应事件。如果没有传入event,则按照默认的click
+                type : 'date'
+            });
+        });
+	</script>
+
+	<style>
+		body{
+			background-color:transparent;
+			filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#26FFFFFF, endColorstr=#26FFFFFF);
+			color:#ffffff;
+			background-color:rgba(255,255,255,0);
+			height:100%;
+		}
+	</style>
+</head>
+<body>
+<div class="wrapper wrapper-content">
+	<sys:message content="${message}"/>
+	<div class="layui-row">
+		<div class="full-width fl">
+			<div class="list-form-tab contentShadow shadowLTR" id="tabDiv">
+				<ul class="list-tabs" >
+					<li><a href="${ctx}/oa/oaNotify/self">未读公告</a></li>
+					<li class="active"><a href="${ctx}/oa/oaNotify/readSelf">已读公告</a></li>
+				</ul>
+			</div>
+			<div class="contentShadow layui-row" id="queryDiv">
+			<form:form id="searchForm" modelAttribute="oaNotify" action="${ctx}/oa/oaNotify/readSelf" method="post" class="form-inline">
+			<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+			<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+			<table:sortColumn id="orderBy" name="orderBy" value="${page.orderBy}" callback="sortOrRefresh();"/><!-- 支持排序 -->
+
+				<div class="commonQuery">
+					<div class="layui-item query athird">
+						<label class="layui-form-label">标题:</label>
+						<div class="layui-input-block with-icon">
+							<form:input path="title" htmlEscape="false" maxlength="200"  class=" form-control layui-input"/>
+						</div>
+					</div>
+					<div class="layui-item query athird">
+						<label class="layui-form-label">类型:</label>
+						<div class="layui-input-block">
+							<form:select path="type"  class="form-control simple-select">
+								<form:option value="" label=""/>
+								<form:options items="${fns:getMainDictList('oa_notify_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
+							</form:select>
+						</div>
+					</div>
+					<div class="layui-item athird">
+						<div class="input-group">
+							<a href="#" id="moresee"><i class="glyphicon glyphicon-menu-down"></i></a>
+							<button id="searchReset" class="fixed-btn searchReset fr" onclick="resetSearch()">重置</button>
+							<button id="searchQuery" class="fixed-btn searchQuery fr" onclick="search()">查询</button>
+						</div>
+					</div>
+					<div style="    clear:both;"></div>
+				</div>
+				<div id="moresees" style="clear:both;display:none;">
+					<div class="layui-item query athird">
+						<label class="layui-form-label">公告编号:</label>
+						<div class="layui-input-block with-icon">
+							<form:input path="number" htmlEscape="false" maxlength="200"  class=" form-control layui-input"/>
+						</div>
+					</div>
+
+					<div class="layui-item query athird">
+						<label class="layui-form-label">创建日期:</label>
+						<div class="layui-input-block">
+							<input id="createStartDate" name="createStartDate" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date layui-input laydate-icon query-group"
+								   value="<fmt:formatDate value="${oaNotify.createStartDate}" pattern="yyyy-MM-dd"/>"/>
+							</input>
+							<span class="group-sep">-</span>
+							<input id="createEndDate" name="createEndDate" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date layui-input laydate-icon query-group"
+								   value="<fmt:formatDate value="${oaNotify.createEndDate}" pattern="yyyy-MM-dd"/>"/>
+							</input>
+						</div>
+					</div>
+					<div class="layui-item query athird">
+						<label class="layui-form-label">公告内容:</label>
+						<div class="layui-input-block with-icon">
+							<form:input path="content" htmlEscape="false" maxlength="200"  class=" form-control layui-input"/>
+						</div>
+					</div>
+					<div class="layui-item query athird">
+						<label class="layui-form-label">创建人:</label>
+						<div class="layui-input-block with-icon">
+							<form:input path="createBy.name" htmlEscape="false" maxlength="200"  class=" form-control layui-input"/>
+						</div>
+					</div>
+					<%--<div class="layui-item query athird">
+						<label class="layui-form-label">阅读状态:</label>
+						<div class="layui-input-block">
+							<form:radiobuttons path="status" class="i-checks" items="${fns:getDictList('oa_notify_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
+						</div>
+					</div>--%>
+					<div style="clear:both;"></div>
+				</div>
+			</form:form>
+			</div>
+		</div>
+		<div class="full-width fl">
+			<div class="contentShadow layui-form contentDetails">
+				<div class="nav-btns">
+					<button class="nav-btn nav-btn-refresh" data-toggle="tooltip" data-placement="left" onclick="sortOrRefresh()" title="刷新"><i class="glyphicon glyphicon-repeat"></i>&nbsp;刷新</button>
+					<div style="clear: both;"></div>
+				</div>
+				<table class="oa-table layui-table" id="contentTable"></table>
+
+				<!-- 分页代码 -->
+				<table:page page="${page}"></table:page>
+				<div style="clear: both;"></div>
+			</div>
+		</div>
+	</div>
+	<div id="changewidth"></div>
+</div>
+<script src="${ctxStatic}/layer-v2.3/layui/layui.all.js" charset="utf-8"></script>
+<script>
+    layui.use('table', function(){
+        layui.table.render({
+            limit:${ page.pageSize }
+            ,elem: '#contentTable'
+            ,page: false
+            ,cols: [[
+                // {checkbox: true, fixed: true},
+                {field:'index',align:'center',  width:40,title: '序号'}
+                ,{field:'number',align:'center', title: '公告编号', minWidth:150,templet:function(d){
+                    var xml = "<a class=\"attention-info\" href=\"javascript:void(0)\" onclick=\"openDialogView('查看公告', '${ctx}/oa/oaNotify/view?id=" + d.id + "&view=view','95%','95%')\">" +
+                        "<span title=" + d.number + ">" + d.number + "</span></a>";
+                    return xml;
+                }}
+                ,{field:'title',align:'center', title: '公告标题', minWidth:150/*,templet:function(d){
+                    var xml = "<a class=\"attention-info\" href=\"javascript:void(0)\" onclick=\"openDialogView('查看公告', '${ctx}/oa/oaNotify/form?id=" + d.id + "&view=view','95%','95%')\">" +
+                        "<span title=" + d.title + ">" + d.title + "</span></a>";
+                    return xml;
+                }*/}
+                ,{field:'type',align:'center', title: '公告类型', width:80}
+                ,{field:'content',align:'center', title: '公告内容', minWidth:200,templet:function(d){
+                    return "<span title='"+ d.title +"'>" + d.title + "</span>";
+                }}
+                /*,{field:'status',align:'center', title: '公告状态', width:80}*/
+                ,{field:'startDate', align:'center',title: '开始时间',width:150}
+                ,{field:'endDate', align:'center',title: '结束时间',width:150}
+                /*,{field:'vtatus', align:'center',title: '查阅状态', width:80}*/
+                ,{field:'createBy', align:'center',title: '创建人', width:80,templet:function(d){
+                    return "<span title='"+ d.createBy +"'>" + d.createBy + "</span>";
+                }}
+                ,{field:'createDate', align:'center',title: '创建时间',width:150}
+            ]]
+            ,data: [
+                <c:if test="${ not empty page.list}">
+                <c:forEach items="${page.list}" var="oaNotify" varStatus="index">
+                <c:if test="${index.index != 0}">,</c:if>
+                {
+                    "index":"${index.index+1}"
+                    ,"id":"${oaNotify.id}"
+                    ,"number":"${oaNotify.number}"
+                    ,"title":"<c:out value="${oaNotify.title}" escapeXml="true"/>"
+                    ,"type":"${fns:getMainDictLabel(oaNotify.type, 'oa_notify_type', '')}"
+                    ,"content":"<c:out value="${oaNotify.content}" escapeXml="true"/>"
+                    ,"status":"${fns:getDictLabel(oaNotify.status, 'oa_notify_status', '')}"
+                    ,"startDate":"<fmt:formatDate value="${oaNotify.startDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+                    ,"endDate":"<fmt:formatDate value="${oaNotify.endDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+                    /*,"vtatus":"${oaNotify.readNum} / ${oaNotify.readNum + oaNotify.unReadNum}"*/
+                    ,"createBy":"${oaNotify.createBy.name}"
+                    ,"createDate":"<fmt:formatDate value="${oaNotify.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+                }
+                </c:forEach>
+                </c:if>
+            ]
+            // ,even: true
+            // ,height: 315
+        });
+
+    })
+
+    resizeListTable();
+</script>
+<script>
+    resizeListWindow1();
+    $(window).resize(function(){
+        resizeListWindow1();
+    });
+</script>
+</body>
+</html>

+ 36 - 0
src/main/webapp/webpage/modules/oa/oaNotifyView.jsp

@@ -327,6 +327,42 @@
                          </c:if>
                      </c:otherwise>
                  </c:choose>--%>
+
+
+            <div class="form-group layui-row">
+                <div class="form-group-label"><h2>访问日志</h2></div>
+                <div class="layui-item layui-col-xs12" style="padding:0 16px;">
+                    <table id="viewTable" class="table table-bordered table-condensed details">
+                        <thead>
+                        <tr>
+                            <th width="60px">序号</th>
+                            <th>访问人</th>
+                            <th>首次访问时间</th>
+                            <th>最近访问时间</th>
+                            <th>访问次数</th>
+                        </tr>
+                        </thead>
+                        <tbody id="oa_notify_view">
+
+                        <c:forEach items="${oaNotifyViewList}" var="oaNotifyView" varStatus="status">
+                            <tr>
+                                <td>${status.index + 1}</td>
+                                <td>${oaNotifyView.userId}</td>
+                                <td>
+                                    <fmt:formatDate value="${oaNotifyView.firstVisitTime}" type="both"/>
+                                </td>
+                                <td>
+                                    <fmt:formatDate value="${oaNotifyView.lastVisitTime}" type="both"/>
+                                </td>
+                                <td>${oaNotifyView.visitCount}</td>
+                            </tr>
+                        </c:forEach>
+
+                        </tbody>
+                    </table>
+                </div>
+            </div>
+
             <div class="form-group layui-row page-end"></div>
             </form:form>
         </div>