Kaynağa Gözat

公告流程变更

user5 4 yıl önce
ebeveyn
işleme
2087e85be7

+ 10 - 1
src/main/java/com/jeeplus/modules/oa/entity/OaNotify.java

@@ -56,6 +56,7 @@ public class OaNotify extends ActEntity<OaNotify> {
 
 	private String processInstanceId;
 	private Integer closeStatus;  //关闭状态
+	private String flagAdmin;     //管理员状态(1:管理员,0:非管理员)
 
     public String getHome() {
         return home;
@@ -349,7 +350,15 @@ public class OaNotify extends ActEntity<OaNotify> {
 	public void setCloseStatus(Integer closeStatus) {
 		this.closeStatus = closeStatus;
 	}
-    /*	@Override
+
+	public String getFlagAdmin() {
+		return flagAdmin;
+	}
+
+	public void setFlagAdmin(String flagAdmin) {
+		this.flagAdmin = flagAdmin;
+	}
+	/*	@Override
 	public String toString() {
 		return "OaNotify [type=" + type + ", title=" + title + ", content=" + content + ", files=" + files + ", status="
 				+ status + ", company=" + company + ", readNum=" + readNum + ", unReadNum=" + unReadNum + ", isSelf="

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

@@ -258,6 +258,33 @@ public class OaNotifyService extends CrudService<OaNotifyDao, OaNotify> {
 
     }
 
+    /**
+     * admin修改
+     * @param oaNotify
+     */
+    @Transactional(readOnly = false)
+    public void adminUpdate(OaNotify oaNotify) {
+        if(oaNotify.getCompany()==null || StringUtils.isBlank(oaNotify.getCompany().getId())){
+            oaNotify.setCompany(UserUtils.getSelectCompany());
+        }
+        if (oaNotify.getOffice()==null || StringUtils.isBlank(oaNotify.getOffice().getId())){
+            oaNotify.setOffice(UserUtils.getSelectOffice());
+        }
+        String title = StringEscapeUtils.unescapeHtml4(oaNotify.getTitle());
+        String content = StringEscapeUtils.unescapeHtml4(oaNotify.getContent());
+        oaNotify.setTitle(title);
+        oaNotify.setContent(content);
+        String contents = "";
+        if (oaNotify!=null && oaNotify.getContents()!=null){
+            contents = StringEscapeUtils.unescapeHtml4(oaNotify.getContents());
+            oaNotify.setContents(contents);
+        }
+        super.save(oaNotify);
+        //保存附件
+        this.saveAttachments(oaNotify);
+
+    }
+
     @Transactional(readOnly = false)
     public String saveNotify(OaNotify oaNotify) {
         oaNotify.setCloseStatus(0);
@@ -291,7 +318,8 @@ public class OaNotifyService extends CrudService<OaNotifyDao, OaNotify> {
                 );
 
         List<User> users = new ArrayList<>();
-        List<User> zjlList = UserUtils.getByRoleActivityEnname("zjl",3,oaNotify.getOffice().getId(),"11",oaNotify.getCreateBy());
+        List<User> zjlList = UserUtils.getByRoleActivityEnname("bgsquhe",3,oaNotify.getOffice().getId(),"11",oaNotify.getCreateBy());
+        //List<User> zjlList = UserUtils.getByRoleActivityEnname("zjl",3,oaNotify.getOffice().getId(),"11",oaNotify.getCreateBy());
         if (StringUtils.isNotBlank(workActivityMenu.getId())) {
             workProjectNotify.setNotifyRole("");
             workActivityMenu = workActivityMenuService.get(workActivityMenu.getId());
@@ -332,10 +360,10 @@ public class OaNotifyService extends CrudService<OaNotifyDao, OaNotify> {
                 dao.updateStatusById(oaNotify);
             }
             if (zjlList.size()==0){
-                return "流程审批人不能为空,总经理岗位下无用户,请联系管理员!";
+                return "流程审批人不能为空,办公室岗位下无用户,请联系管理员!";
             }
             variables.put("zjlCount",zjlList.size());
-            processType = "oaNotify";
+            processType = "newOaNotify";
             users.addAll(zjlList);
         }
         List<String> userIds = new ArrayList<>(users.size());
@@ -343,7 +371,7 @@ public class OaNotifyService extends CrudService<OaNotifyDao, OaNotify> {
             userIds.add(u.getId());
             workProjectNotify.setUser(u);
             workProjectNotify.setId("");
-            workProjectNotify.setNotifyRole("总经理审批");
+            workProjectNotify.setNotifyRole("办公室审批");
             workProjectNotifyService.save(workProjectNotify);
             Map<String,Object> extras = new HashMap<>();
             extras.put("type","7002");
@@ -636,7 +664,7 @@ public class OaNotifyService extends CrudService<OaNotifyDao, OaNotify> {
             selectProcess.setProcessInstanceId(oaNotify.getProcessInstanceId());
             List<WorkActivityProcess> workActivityProcesses = workActivityProcessService.findList(selectProcess);
             List<Activity> activities = workActivityMenu.getActivities();
-            if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("oaNotify")) {
+            if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("newOaNotify")) {
                 key = 1;
                 for (int i = 0; i < workActivityProcesses.size(); i++) {
                     WorkActivityProcess activityProcess = workActivityProcesses.get(i);
@@ -681,7 +709,7 @@ public class OaNotifyService extends CrudService<OaNotifyDao, OaNotify> {
                     }
                 }
             } else {
-                workActivityMenu.setProcessType("oaNotify");
+                workActivityMenu.setProcessType("newOaNotify");
                 for (int i = 0; i < workActivityProcesses.size(); i++) {
                     WorkActivityProcess activityProcess = workActivityProcesses.get(i);
                     String count = activityProcess.getCount() + "";
@@ -702,7 +730,7 @@ public class OaNotifyService extends CrudService<OaNotifyDao, OaNotify> {
                         }
                         break;
                     } else if ("modifyApply".equals(taskDefKey)&& count.contains("0")) {
-                        notifyRole = "总经理审批";
+                        notifyRole = "办公室审批";
                         taskCount = "0";
                         exp = "pass";
                         workActivityProcess.setCount(0);
@@ -768,7 +796,7 @@ public class OaNotifyService extends CrudService<OaNotifyDao, OaNotify> {
                 }
                 workActivityProcessService.deleteProcessIdAuditUsers(oaNotify.getProcessInstanceId());
             } else {
-                if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("oaNotify")) {
+                if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("newOaNotify")) {
                     WorkProjectNotify notify = new WorkProjectNotify();
                     notify.setNotifyId(oaNotify.getId());
                     userList = workProjectNotifyService.readByNotifyId(notify);

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

@@ -98,6 +98,15 @@ public class OaNotifyController extends BaseController {
 			oaNotify.setCompany(user.getCompany());
 		}
 		Page<OaNotify> page = oaNotifyService.findByPc(new Page<OaNotify>(request, response), oaNotify);
+		List<OaNotify> list = page.getList();
+		for (OaNotify notify: list) {
+			//判断是否为管理员
+			if (UserUtils.isManager()){
+				notify.setFlagAdmin("1");
+			}else{
+				notify.setFlagAdmin("0");
+			}
+		}
 		model.addAttribute("page", page);
 		return "modules/oa/oaNotifyList";
 	}
@@ -130,6 +139,29 @@ public class OaNotifyController extends BaseController {
 	}
 
 	/**
+	 * admin修改跳转
+	 */
+	@RequestMapping(value = "adminForm")
+	public String adminForm(@RequestParam(value = "view",required = false)String view, OaNotify oaNotify, Model model) {
+		if (StringUtils.isNotBlank(oaNotify.getId())){
+			oaNotify = oaNotifyService.getRecordList2(oaNotify);
+            oaNotifyService.queryDetails(oaNotify);
+		}
+		if (oaNotify.getCreateDate() == null){
+			oaNotify.setCreateDate(new Date());
+		}
+		if (oaNotify.getCreateBy() == null || StringUtils.isBlank(oaNotify.getCreateBy().getId())){
+			oaNotify.setCreateBy(UserUtils.getUser());
+		}
+		if(oaNotify.getOffice() == null || StringUtils.isBlank(oaNotify.getOffice().getId())){
+            oaNotify.setOffice(UserUtils.getSelectOffice());
+        }
+		oaNotify.setContent("");
+		model.addAttribute("oaNotify", oaNotify);
+		return "modules/oa/oaNotifyAdminForm";
+	}
+
+	/**
 	 * 删除附件
 	 * @param request
 	 * @param model
@@ -161,6 +193,11 @@ public class OaNotifyController extends BaseController {
         if (!beanValidator(model, oaNotify)){
             return form("",oaNotify, model);
         }
+		//判断内容富文本中是否含有该字符串
+		while (oaNotify.getContent().contains("img{max-width:100%!important;}")){
+			oaNotify.setContent(oaNotify.getContent().replace("\r\n",""));
+			oaNotify.setContent(oaNotify.getContent().replace("img{max-width:100%!important;}",""));
+		}
         oaNotify.setStatus(String.valueOf(ProjectStatusEnum.TSTORE.getValue()));
         if(!oaNotify.getIsNewRecord()){//编辑表单保存
             OaNotify t = oaNotifyService.get(oaNotify.getId());//从数据库取出记录的值
@@ -173,6 +210,32 @@ public class OaNotifyController extends BaseController {
         return "redirect:"+ Global.getAdminPath()+"/oa/oaNotify/?repage";
     }
 
+    /**
+     * admin修改
+     * @param oaNotify
+     * @param model
+     * @param redirectAttributes
+     * @return
+     * @throws Exception
+     */
+    @RequestMapping(value = "adminUpdate")
+    public String adminUpdate(OaNotify oaNotify, Model model, RedirectAttributes redirectAttributes) throws Exception{
+        if (!beanValidator(model, oaNotify)){
+            return form("",oaNotify, model);
+        }
+        //判断内容富文本中是否含有该字符串
+        while (oaNotify.getContent().contains("img{max-width:100%!important;}")){
+			oaNotify.setContent(oaNotify.getContent().replace("\r\n",""));
+			oaNotify.setContent(oaNotify.getContent().replace("img{max-width:100%!important;}",""));
+		}
+		//编辑表单保存
+		OaNotify t = oaNotifyService.get(oaNotify.getId());//从数据库取出记录的值
+		MyBeanUtils.copyBeanNotNull2Bean(oaNotify, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+		oaNotifyService.adminUpdate(t);//修改
+        addMessage(redirectAttributes, "修改公告成功");
+        return "redirect:"+ Global.getAdminPath()+"/oa/oaNotify/?repage";
+    }
+
 	//添加操作只在"通告管理"页面完成;
 	@RequiresPermissions(value={"oa:oaNotify:add","oa:oaNotify:edit"},logical=Logical.OR)
 	@RequestMapping(value = "save")
@@ -180,7 +243,11 @@ public class OaNotifyController extends BaseController {
         if (!beanValidator(model, oaNotify)){
             return form("",oaNotify, model);
         }
-
+		//判断内容富文本中是否含有该字符串
+		while (oaNotify.getContent().contains("img{max-width:100%!important;}")){
+			oaNotify.setContent(oaNotify.getContent().replace("\r\n",""));
+			oaNotify.setContent(oaNotify.getContent().replace("img{max-width:100%!important;}",""));
+		}
         oaNotify.setState(String.valueOf(ProjectStatusEnum.IN_APRL.getValue()));
         String str = "";
         if(!oaNotify.getIsNewRecord()){//编辑表单保存
@@ -366,6 +433,11 @@ public class OaNotifyController extends BaseController {
     public String saveAudit(OaNotify oaNotify, Model model,
                             RedirectAttributes redirectAttributes) {
         try {
+			//判断内容富文本中是否含有该字符串
+			while (oaNotify.getContent().contains("img{max-width:100%!important;}")){
+				oaNotify.setContent(oaNotify.getContent().replace("\r\n",""));
+				oaNotify.setContent(oaNotify.getContent().replace("img{max-width:100%!important;}",""));
+			}
             List<User> users = UserUtils.getByProssType(oaNotify.getProcessInstanceId(),1);
             String flag = oaNotify.getAct().getFlag();
             if ("yes".equals(flag) && (users==null || users.size()==0)){

+ 1 - 0
src/main/java/com/jeeplus/modules/workcalendar/service/WorkCalendarTaskService.java

@@ -110,6 +110,7 @@ public class WorkCalendarTaskService  {
     /**
      * 获取项目即将超期还未上报并进行通知
      */
+    //设置每日凌晨10分调用通知方法
     @Scheduled(cron= "0 10 0 * * ?")
     @Transactional(readOnly = false)
     public void getProjectReportedListByAdvent() {

+ 3 - 1
src/main/resources/mappings/modules/oa/OaNotifyDao.xml

@@ -271,7 +271,9 @@
 			CONTENT = #{content},
 			CONTENTS = #{contents},
 			FILES = #{files},
-			STATUS = #{status},
+			<if test="status != null and status != ''">
+				STATUS = #{status},
+			</if>
 			UPDATE_BY = #{updateBy.id},
 			UPDATE_DATE = #{updateDate},
 			start_date = #{startDate},

+ 43 - 2
src/main/webapp/webpage/modules/oa/oaNotifyList.jsp

@@ -113,6 +113,44 @@
             });
         }
 
+        function openDialogAdmin(title,url,width,height,target) {
+
+            if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) {//如果是移动端,就使用自适应大小弹窗
+                width = 'auto';
+                height = 'auto';
+            } else {//如果是PC端,根据用户设置的width和height显示。
+
+            }
+
+            top.layer.open({
+                type: 2,
+                area: [width, height],
+                title: title,
+                maxmin: true, //开启最大化最小化按钮
+                content: url,
+                skin: 'three-btns',
+                btn: ['提交', '关闭'],
+                btn1: function(index, layero){
+                    var body = top.layer.getChildFrame('body', index);
+                    var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+                    var inputForm = body.find('#inputForm');
+                    var top_iframe;
+                    if(target){
+                        top_iframe = target;//如果指定了iframe,则在改frame中跳转
+                    }else{
+                        top_iframe = top.getActiveTab().attr("name");//获取当前active的tab的iframe
+                    }
+                    inputForm.attr("target",top_iframe);//表单提交成功后,从服务器返回的url在当前tab中展示
+                    if(iframeWin.contentWindow.doSubmit(1) ){
+                        // top.layer.close(index);//关闭对话框。
+                        setTimeout(function(){top.layer.close(index)}, 100);//延时0.1秒,对应360 7.1版本bug
+                    }
+                },
+                btn2: function (index) {
+                }
+            });
+        }
+
         function openDialogre(title,url,width,height,target,buttons) {
 
             if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) {//如果是移动端,就使用自适应大小弹窗
@@ -295,11 +333,11 @@
             ,cols: [[
                 // {checkbox: true, fixed: true},
                 {field:'index',align:'center',  width:40,title: '序号'}
-                ,{field:'number',align:'center', title: '公告编号', minWidth:150,templet:function(d){
+                ,{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/form?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>";
@@ -327,6 +365,8 @@
                         var xml = "";
                         if(d.canedit != undefined && d.canedit == "1")
                             xml += "<a href=\"javascript:void(0)\" onclick=\"openDialog('修改公告', '${ctx}/oa/oaNotify/form?id="+ d.id +"','95%', '95%')\"   class=\"op-btn op-btn-edit\"><i class=\"fa fa-edit\"></i> 修改</a>";
+                        if(d.flagAdmin != undefined && d.flagAdmin == "1")
+                            xml += "<a href=\"javascript:void(0)\" onclick=\"openDialogAdmin('修改公告', '${ctx}/oa/oaNotify/adminForm?id="+ d.id +"','95%', '95%')\"   class=\"op-btn op-btn-edit\"><i class=\"fa fa-edit\"></i> 修改</a>";
                         if(d.candel != undefined && d.candel == "1")
                             xml += "<a href=\"${ctx}/oa/oaNotify/delete?id="+ d.id +"\" onclick=\"return confirmx('确认要关闭该公告吗?', this.href)\"   class=\"op-btn op-btn-delete\"><i class=\"fa fa-trash\"></i> 关闭</a>";
                         if(d.canmodify != undefined && d.canmodify =="1"){
@@ -370,6 +410,7 @@
                     </shiro:hasPermission>
                     <shiro:hasPermission name="oa:oaNotify:del">,"candelete":<c:choose><c:when test="${oaNotify.status == 1 or oaNotify.status == 3 or oaNotify.status == 4}">"1"</c:when><c:otherwise>"0"</c:otherwise></c:choose></shiro:hasPermission>
                     ,"cancancel":<c:choose><c:when test="${oaNotify.status == 2 }">"1"</c:when><c:otherwise>"0"</c:otherwise></c:choose>
+                    ,"flagAdmin":<c:choose><c:when test="${not empty oaNotify.candel && oaNotify.flagAdmin == '1' && oaNotify.status == 5 }">"1"</c:when><c:otherwise>"0"</c:otherwise></c:choose>
 
                 }
                 </c:forEach>