/** * 回复,转发邮件 * * @param sqlSession * @param mapper * @param mapperRelation * @param mapperContent * @param record * @param recordRelation * @param recordContent * @param sendTime * @param sendUser * @param sendSysUser * @return * @throws IllegalAccessException * @throws UnsupportedEncodingException */ private String replyTrunMail( B_T_Ufp_Mail_Attribute record, B_T_Ufp_Mail_Relation recordRelation, B_T_Ufp_Mail_Content recordContent, String sendTime, String sendUser, String sendSysUser, C_T_Sys_FileExample example, C_T_Sys_FileExample.Criteria criteria) throws IllegalAccessException, UnsupportedEncodingException { String returnMsg; String uuid = new GUID().toString(); // 更新附件表的主文档ID String isFile = null; try { replyMailFile(example, criteria, uuid); criteria.andMainIdEqualTo(uuid); List<C_T_Sys_File> listFile = mapperFT.selectByExample(example); if (listFile != null) { if (listFile.size() > 0) { isFile = "1"; // 有附件 } else { isFile = "0"; // 没有附件 } } else { isFile = "0"; // 没有附件 } } catch (Exception e) { e.printStackTrace(); } // 收件人未收邮件 b_T_Ufp_Mail_Relation.setUuid(uuid); b_T_Ufp_Mail_Relation.setMailType(Long.valueOf(mailTypeS)); b_T_Ufp_Mail_Relation.setMailAttributeId(uuid); b_T_Ufp_Mail_Relation.setMailContentId(uuid); b_T_Ufp_Mail_Relation.setReceiverTime(sendTime); b_T_Ufp_Mail_Relation.setReplyFlag(1); // 正常回复 b_T_Ufp_Mail_Relation.setIsFile(Integer.valueOf(isFile)); // 有无附件 if (b_T_Ufp_Mail_Relation != null) { b_T_Ufp_Mail_Relation.setSpecificRecsysUser(b_T_Ufp_Mail_Relation.getUserId()); } mapperMRT.insertSelective(b_T_Ufp_Mail_Relation); // 插入邮件属性表 b_T_Ufp_Mail_Attribute.setUuid(uuid); b_T_Ufp_Mail_Attribute.setSendTime(sendTime); // 回复时:发件箱中的发送时间 b_T_Ufp_Mail_Attribute.setSendUser(sendUser); b_T_Ufp_Mail_Attribute.setSendSysUser(sendSysUser); b_T_Ufp_Mail_Attribute.setIsReceipt(Integer.valueOf(booleanToString(isReceipt))); // 回执选项 mapperMAT.insertSelective(b_T_Ufp_Mail_Attribute); // 插入邮件正文表 b_T_Ufp_Mail_Content.setUuid(uuid); mapperMCT.insertSelective(recordContent); // 发件箱显示 String newUuid = new GUID().toString(); String isNewFile = null; // 更新附件表的主文档ID try { replyMailFile(example, criteria, newUuid); example.clear(); criteria = example.createCriteria(); criteria.andMainIdEqualTo(newUuid); List<C_T_Sys_File> listFile = mapperFT.selectByExample(example); if (listFile != null) { if (listFile.size() > 0) { isNewFile = "1"; // 有附件 } else { isNewFile = "0"; // 没有附件 } } else { isNewFile = "0"; // 没有附件 } } catch (Exception e) { e.printStackTrace(); } b_T_Ufp_Mail_Relation.setUuid(newUuid); b_T_Ufp_Mail_Relation.setMailType(Long.valueOf("1")); b_T_Ufp_Mail_Relation.setMailAttributeId(uuid); b_T_Ufp_Mail_Relation.setMailContentId(uuid); b_T_Ufp_Mail_Relation.setReceiverTime(sendTime); b_T_Ufp_Mail_Relation.setReplyFlag(2); // 自己发的回复信息 b_T_Ufp_Mail_Relation.setIsFile(Integer.valueOf(isNewFile)); // 有无附件 mapperMRT.insertSelective(b_T_Ufp_Mail_Relation); // 插入邮件属性表 b_T_Ufp_Mail_Attribute.setUuid(newUuid); b_T_Ufp_Mail_Attribute.setSendTime(sendTime); // 回复时:发件箱中的发送时间 b_T_Ufp_Mail_Attribute.setSendUser(sendUser); b_T_Ufp_Mail_Attribute.setSendSysUser(sendSysUser); b_T_Ufp_Mail_Attribute.setIsReceipt(Integer.valueOf(booleanToString(isReceipt))); // 回执选项 b_T_Ufp_Mail_Attribute.setIsSendMsg(Integer.valueOf(booleanToString(isSendMsg))); // 是否发送短消息 mapperMAT.insertSelective(b_T_Ufp_Mail_Attribute); // 插入邮件正文表 b_T_Ufp_Mail_Content.setUuid(newUuid); mapperMCT.insertSelective(b_T_Ufp_Mail_Content); if ("0".equals(isReplyTrun)) { returnMsg = "回复成功!"; } else if ("1".equals(isReplyTrun)) { returnMsg = "转发成功!"; } else { returnMsg = Constants.SAVE_SUCCESSFUL_MSG; } return returnMsg; }