/** * 设置一些值 * * @param entity */ public void setSomething(BusinessContactLetter entity) { UserInfo userInfo = super.getUser(); String documentNumber = commonOrderCodeService.generatorLetterCode(userInfo.getRegionId()); if (entity.getId() == null) { entity.setDocumentNumber(""); } else { StringBuffer issuerUserNames = new StringBuffer(); String name = ""; entity.setDocumentNumber(documentNumber); if (StringUtils.isNotBlank(entity.getAuditUserId())) { entity.setAuditUserName( userinfoService.getUserInfoByPersonId(entity.getAuditUserId()).getUserName()); } if (StringUtils.isNotBlank(entity.getIssuerAreaUserIds())) { String[] ids = entity.getIssuerAreaUserIds().split(","); for (int i = 0; i < ids.length; i++) { if (userinfoService.getUserInfoByPersonId(ids[i]) != null) { name = userinfoService.getUserInfoByPersonId(ids[i]).getUserName(); } if (name != null) { issuerUserNames.append(name).append(";"); } } } entity.setIssuerAreaUserNames(issuerUserNames.toString()); } }
/** * 获取用户已读信息 * * @param entity 实体 * @return */ public String getReadNameStr(BusinessContactLetter entity) throws Exception { StringBuffer str = new StringBuffer(); if (StringUtils.isNotBlank(entity.getIssuerAreaUserIds())) { String[] ids = entity.getIssuerAreaUserIds().split(","); if (ids != null && ids.length > 0) { for (int i = 0; i < ids.length; i++) { String isread = businessContactlettersendeeservice.checkReadById(entity.getId(), ids[i]); String issuserNames = userinfoService.getUserInfoByPersonId(ids[i]).getUserName(); if (StringUtils.isNotBlank(isread)) { if (isread.equals("1")) { str.append(issuserNames).append("[<font color=\"red\">已读</font>]").append(";"); if ((i + 1) % 6 == 0) { str.append("</br>"); } } else { str.append(issuserNames).append("[<font color=\"green\">未读</font>]").append(";"); if ((i + 1) % 6 == 0) { str.append("</br>"); } } } } } } return str.toString(); }
/** * 查看详细信息。 * * @param mapping * @param form * @param request * @param response * @return * @throws Exception */ @Override public String view() throws Exception { String id = super.getRequest().getParameter("id"); UserInfo user = super.getUser(); Boolean flag = false; entity = businessContactletterservice.loadBusinessContactletter(id); if (entity.getStatus().equals(Constant4Bcl.CHECKOFF)) { flag = true; } if (flag) { entity = businessContactletterservice.readContactletter(id, user.getPersonId()); } if (StringUtils.isNotBlank(entity.getAuditUserId())) { entity.setAuditUserName( userinfoService.getUserInfoByPersonId(entity.getAuditUserId()).getUserName()); } if (StringUtils.isNotBlank(entity.getReleaseUserId())) { entity.setReleaseUserName( userinfoService.getUserInfoByPersonId(entity.getReleaseUserId()).getUserName()); } String str = getReadNameStr(entity); if (StringUtils.isNotBlank(str.toString())) { entity.setIssuerAreaUserNames(str.toString()); } if (StringUtils.isNotBlank(entity.getDocumentType())) { if (entity.getDocumentType().equals("1")) { entity.setDocumentType("通告"); } else { entity.setDocumentType("通知"); } } Date now = new Date(); String timeOutstr = "未过期"; if (entity.getExpirationTime() != null) { if (entity.getExpirationTime().before(now)) { timeOutstr = "<font color='red'>已过期</font>"; } } Map<String, List<CommonWorkflowResult>> checkresultMap = businessContactletterservice.getProcessHistoryList(id); super.getRequest().setAttribute(PROCESS_HISTORY_MAP, checkresultMap); super.getRequest().setAttribute("timeOutstr", timeOutstr); super.getRequest().setAttribute("entity", entity); return "showcontactletter"; }
/** * 转向审核页面 * * @return auditContactLetter */ public String toCheck() { String id = super.getRequest().getParameter("id"); String taskid = super.getRequest().getParameter("taskId"); if (id != null) { entity = businessContactletterservice.loadBusinessContactletter(id); } if (entity != null) { StringBuffer sb = new StringBuffer(); UserInfo userinfo = userinfoService.getUserInfoByPersonId(entity.getReleaseUserId()); entity.setReleaseUserName(userinfo.getUserName()); entity.setReleaseUserDept(userinfo.getDeptName()); String[] str = entity.getIssuerAreaUserIds().split(","); if (str != null && str.length > 0) { for (int i = 0; i < str.length; i++) { sb.append(userinfoService.getUserInfoByPersonId(str[i]).getUserName() + ";"); } } entity.setIssuerAreaUserNames(sb.toString()); } StringBuffer readNameStr = getReadNameStr4Audit(entity); if (readNameStr != null) { entity.setIssuerAreaUserNames(readNameStr.toString()); } if (StringUtils.isNotBlank(entity.getDocumentType())) { if (entity.getDocumentType().equals("1")) { entity.setDocumentType("通告"); } else { entity.setDocumentType("通知"); } } contactLetterAudit.setTaskId(taskid); Map<String, List<CommonWorkflowResult>> checkresultMap = businessContactletterservice.getProcessHistoryList(id); // 获取任务id super.getRequest().setAttribute(PROCESS_HISTORY_MAP, checkresultMap); this.getRequest().setAttribute("contactLetterAudit", contactLetterAudit); this.getRequest().setAttribute("entity", entity); return "auditContactLetter"; }
/** * 获取用户已读信息 * * @param entity 实体 * @return */ public StringBuffer getReadNameStr4Audit(BusinessContactLetter entity) { String issuerUserIds = entity.getIssuerAreaUserIds(); String issuserNames = ""; StringBuffer str = new StringBuffer(); str.append("姓名:"); if (StringUtils.isNotBlank(issuerUserIds)) { String[] ids = issuerUserIds.split(","); if (ids != null && ids.length > 0) { for (int i = 0; i < ids.length; i++) { issuserNames = userinfoService.getUserInfoByPersonId(ids[i]).getUserName(); str.append(issuserNames).append(";"); } } } logger.info(str); return str; }