huxuetao %!s(int64=3) %!d(string=hai) anos
pai
achega
0c822890b6

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

@@ -31,6 +31,11 @@ public interface OaNotifyDao extends CrudDao<OaNotify> {
     String getCreateId(String id);
     void saveRemarks(OaNotify oaNotify);
 
+
+    //查询全部公告
+    List<OaNotify> findAll(OaNotify oaNotify);
+
+
     //我的通告
     List<OaNotify> findListByMyself(OaNotify oaNotify);
     //我的通告

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

@@ -197,6 +197,42 @@ public class OaNotifyService extends CrudService<OaNotifyDao, OaNotify> {
         return page;
     }
 
+
+    //我的通告(全部)
+    public List<OaNotify> findAll( OaNotify oaNotify) {
+        User user = UserUtils.getUser();
+        oaNotify.setCurrentUser(user);
+
+        if(!user.isAdmin()){
+            oaNotify.setCompany(user.getCompany());
+        }
+        //oaNotify.setPage(page);
+        List<OaNotify> oaNotifyList = dao.findAll(oaNotify);
+        for (OaNotify notify:oaNotifyList){
+            if (StringUtils.isBlank(notify.getRemarks())) {
+                if(0 == notify.getExt()){
+                    Long startDate = notify.getStartDate().getTime();
+                    Long endDate = notify.getEndDate().getTime();
+                    Long now = new Date().getTime();
+                    if (startDate < now && endDate > now){
+                        notify.setCandel("yes");
+                    }
+                }else{
+                    notify.setCandel("yes");
+                }
+            }
+            if(StringUtils.isNotBlank(notify.getReadFlag()) && "0".equals(notify.getReadFlag())){
+                notify.setReadFlagStr("未读");
+            }else{
+                notify.setReadFlagStr("已读");
+            }
+        }
+        //只查询当前公司下发送给自己的通告
+        //page.setList(oaNotifyList);
+        return oaNotifyList;
+    }
+    
+
     //我的通告(个人未读)
     public Page<OaNotify> findUnreadMyself(Page<OaNotify> page, OaNotify oaNotify) {
         User user = UserUtils.getUser();

+ 30 - 17
src/main/java/com/jeeplus/modules/oa/web/OaNotifyController.java

@@ -117,25 +117,38 @@ public class OaNotifyController extends BaseController {
 	@RequestMapping(value = {"self"})
 	public String listMyself(OaNotify oaNotify, HttpServletRequest request, HttpServletResponse response, Model model) {
 		//进行查询之后进行任何操作,返回还是查询之后的数据页面
-		if (StringUtils.isNotBlank(oaNotify.getToflag())){
-			request.getSession().removeAttribute("searchlistMyself");
-			OaNotify search=oaNotify;
-			request.getSession().setAttribute("searchlistMyself",search);
-		}else{
-			if (request.getSession().getAttribute("searchlistMyself")!=null){
-				oaNotify= (OaNotify) request.getSession().getAttribute("searchlistMyself");
-				model.addAttribute("oaNotify", oaNotify);
+		//if (StringUtils.isBlank(oaNotify.getType())) {
+			if (StringUtils.isNotBlank(oaNotify.getToflag())) {
+				request.getSession().removeAttribute("searchlistMyself");
+				OaNotify search = oaNotify;
+				request.getSession().setAttribute("searchlistMyself", search);
+			} else {
+				if (request.getSession().getAttribute("searchlistMyself") != null) {
+					oaNotify = (OaNotify) request.getSession().getAttribute("searchlistMyself");
+					model.addAttribute("oaNotify", oaNotify);
+				}
 			}
-		}
-		oaNotify.setSelf(true);
-		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())) {
-				notify.setContent(notify.getContent().replace("\n", ""));
+			oaNotify.setSelf(true);
+			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())) {
+					notify.setContent(notify.getContent().replace("\n", ""));
+				}
 			}
-		}
-		model.addAttribute("page", page);
+			model.addAttribute("page", page);
+/*		}else {
+			Page<OaNotify> page = (Page<OaNotify>) request.getSession().getAttribute("page");
+			List<OaNotify> list = page.getList();
+			List<OaNotify> list1 =new ArrayList<OaNotify>();
+			for (OaNotify notify : list) {
+				if ("1".equals(notify.getType())) {
+					list1.add(notify);
+				}
+			}
+			page.setList(list1);
+			model.addAttribute("page", page);
+		}*/
 		return "modules/oa/oaNotifyListMyself";
 	}
 	//我的公告(已过期)

+ 16 - 2
src/main/java/com/jeeplus/modules/sys/web/LoginController.java

@@ -3,6 +3,7 @@
  */
 package com.jeeplus.modules.sys.web;
 
+import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.jeeplus.common.config.Global;
 import com.jeeplus.common.json.AjaxJson;
@@ -418,11 +419,24 @@ public class LoginController extends BaseController{
 		model.addAttribute("count", page.getList().size());//未读通知条数
 		model.addAttribute("count1", page.getCount());//未读通知条数
 		model.addAttribute("type", type);//返回公告类型
+			//request.getSession().setAttribute("page",page);
+		oaNotify.setPage(new Page());
+		List<OaNotify> list = oaNotifyService.findAll(oaNotify);
+		List<Map<String,Object>> mapList = Lists.newArrayList();
+		for (OaNotify info: list) {
+			Map map = new HashMap();
+			map.put("title",info.getTitle());
+			map.put("type",info.getType());
+			map.put("readFlagStr",info.getReadFlagStr());
+			map.put("updateDate",info.getUpdateDate());
+			mapList.add(map);
+		}
+		model.addAttribute("oaNotifyList", mapList);
+		//待办事项
 		WorkProjectNotify workProjectNotify = new WorkProjectNotify();
 		workProjectNotify.setUser(user);
 		workProjectNotify.setCompanyId(user.getComId());
 		workProjectNotify.setRemarks("待审批");
-		//待办事项
 		Page<WorkProjectNotify> workProjectNotifyPage = new Page<>(request, response);
 		workProjectNotifyPage.setPageNo(1);
 		workProjectNotifyPage.setPageSize(10);
@@ -456,7 +470,7 @@ public class LoginController extends BaseController{
 		Page<WorkCalendar> workCalendars=workCalendarService.findHomePage(new Page<WorkCalendar>(request, response), workCalendar);
 		model.addAttribute("calendarCount", workCalendars.getList());
 		model.addAttribute("calendarPage", workCalendars.getList().size());
-		model.addAttribute("calendarSize", workCalendars.getCount());
+		//model.addAttribute("calendarSize", workCalendars.getCount());
 		//我的项目
 		RuralProjectRecordReportInfo ruralProjectRecordReportInfo = new RuralProjectRecordReportInfo();
 		ruralProjectRecordReportInfo.setCreateBy(user);

+ 70 - 0
src/main/resources/mappings/modules/oa/OaNotifyDao.xml

@@ -120,6 +120,76 @@
 		ORDER BY /*wo.id asc,*/ a.update_date DESC
 	</select>
 
+
+	<select id="findAll" resultType="OaNotify">
+		SELECT
+		<include refid="oaNotifyColumns"/>
+		<if test="isSelf">,
+			r.read_flag
+		</if>
+		,a.flag_office as "flagOffice"
+		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,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
+			<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="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} or a.start_date is null) AND (a.end_date &gt;= #{nowDate} or a.end_date is null)
+		</if>
+
+		ORDER BY /*wo.id asc,*/ a.update_date DESC
+	</select>
+
 	<select id="findUnReadList" resultType="OaNotify">
 		SELECT
 			<include refid="oaNotifyColumns"/>

+ 61 - 21
src/main/webapp/webpage/modules/sys/sysHome.jsp

@@ -28,17 +28,57 @@
         $(document).ready(function() {
             WinMove();
 
-            var ggType = '${type}'
+
+            <%--var ggType = '${type}'--%>
+            <%--if(undefined !== ggType && null !== ggType && '' !== ggType){--%>
+            <%--    $(".layui-tab-title li").eq(ggType-1).attr("class","layui-this");--%>
+            <%--}--%>
+            <%--$(".layui-tab-title li").click(function() {--%>
+            <%--    $(".layui-tab-title li").each(function () {--%>
+            <%--        $(this).removeAttr("layui-this");--%>
+            <%--    })--%>
+            <%--    $(this).attr("layui-this");--%>
+            <%--    location.replace("${ctx}/home?type="+$(this).val())--%>
+            <%--})--%>
+
+            /*function ggType(){
+                $.ajax({
+                    type:"post",
+                    cache:false,
+                    url:"${ctx}/home?type=",
+                    data:{"type":'${type}'},
+                    success: function success(data){
+                        var name = data.name;
+                        $("#name").text(name);
+                    },
+                    error: function error(){
+                        alert("服务器请求失败")
+                    }
+                });
+            }
+*/
+          /*  var ggType = '${type}'
             if(undefined !== ggType && null !== ggType && '' !== ggType){
                 $(".layui-tab-title li").eq(ggType-1).attr("class","layui-this");
-            }
+            }*/
             $(".layui-tab-title li").click(function() {
                 $(".layui-tab-title li").each(function () {
-                    $(this).removeAttr("layui-this");
+                    $(this).removeAttr("class","layui-this");
                 })
-                $(this).attr("layui-this");
-                location.replace("${ctx}/home?type="+$(this).val())
+                $(this).attr("class","layui-this");
+                console.log(this.value)
+                var oaNotifyList = '${oaNotifyList}';
+                var array = new Array();
+                //console.info("info");
+                <c:forEach items="${oaNotifyList}" var="item" varStatus="status" >
+                var info = '${item}';
+                    if(info.type == this.value){
+                        array.push("${item}");
+                    }
+                </c:forEach>
+                console.log(oaNotifyList)
             })
+
         });
 
         function openDialogre(title,url,width,height,target){
@@ -890,20 +930,21 @@
                 <div class="bord-left">
                     <div class="bord-left-content">
                         <div class="bord-title">
-
-                            <div class="layui-tab ggTab" id="nt4">
-                                <ul class="layui-tab-title" id="nt4_1" style="margin-top: -10px;margin-left: 0px">
-                                    <li value="1">通知</li>
-                                    <li value="2">会议通知</li>
-                                    <li value="3">公司标准或规范</li>
-                                    <li value="4">行业标准或规范</li>
-                                    <li value="5">其他</li>
-                                </ul>
-                            </div>
+                                <div class="layui-tab ggTab" id="nt4">
+                                    <ul  class="layui-tab-title" id="nt4_1" style="margin-top: -10px;margin-left: 0px" >
+                                        <%--<li value="1"><a>通知</a><span class="hide" id="inform"></span></li>
+                                        <li value="2"><a>会议通知</a><span class="hide" id="HYinform"></span></li>
+                                        <li value="3"><a>公司标准或规范</a><span class="hide" id="standard"></span></li>
+                                        <li value="4"><a>行业标准或规范</a><span class="hide" id="standard2"></span></li>
+                                        <li value="5"><a>其他</a><span class="hide" id="other"></span></li>--%>
+                                        <li value="1"><a>通知</a></li>
+                                        <li value="2"><a>会议通知</a></li>
+                                        <li value="3"><a>公司标准或规范</a></li>
+                                        <li value="4"><a>行业标准或规范</a></li>
+                                        <li value="5"><a>其他</a></li>
+                                    </ul>
+                                </div>
                         </div>
-                        <%--                    <div class="bord-title">公告信息(${count1})</div>--%>
-                        <%--<div class="bord-pic"><img src="${ctxStatic}/common/img/icon03.png" height="100%" /></div>--%>
-                        <%--<div class="bord-num">${count1}</div>--%>
                     </div>
                     <div class="bord-more">
                         <a href="javascript:void(0)" onclick='top.openTab("${ctx }/oa/oaNotify/self","公告信息", false)'><span>更多 </span><i class="fa fa-angle-right"></i></a>
@@ -918,6 +959,7 @@
                 </div>
             </div>
         </div>
+
         <div class="layui-col-sm6 layui-col-md6 call-board">
             <div id="email-bord" class="call-bord-content contentShadow">
                 <div class="bord-left">
@@ -1196,9 +1238,7 @@
         <c:forEach items="${page}" var="oaNotify" varStatus="index">
         <c:if test="${index.index < 8}">
         xml ="<a href=\"javascript:void(0)\" onclick=\"homeOpenDialogView('查看公告', '${ctx}/oa/oaNotify/homeView?id=${oaNotify.id}&readAttr=disabled','95%','95%')\"  >";
-
-        elem.append('<li>' + xml + "<span class=\"bord-record-type\" title=\"${fns:getMainDictLabel(oaNotify.type, 'oa_notify_type', '')}\">${fns:getMainDictLabel(oaNotify.type, 'oa_notify_type', '')}</span>"+
-            "<span class=\"bord-record\" title=\"${oaNotify.title}\">${oaNotify.title}</span>"+
+        elem.append('<li>' + xml + "<span class=\"bord-record\" title=\"${oaNotify.title}\">${oaNotify.title}</span>"+
             '<span class="bord-record-flag">'+'${oaNotify.readFlagStr}'+'</span>' +
             '<span class="bord-record-time">' + '<fmt:formatDate value="${oaNotify.updateDate}" pattern="yyyy-MM-dd"/>' + '</span></a></li>');
         </c:if>