Commit 6e916fc5 authored by Du Xingdong's avatar Du Xingdong

收文编辑中的转发功能

parent 7fe6cae2
......@@ -308,43 +308,58 @@ public class MailSendController extends BaseServiceController<MailSend, IMailSen
*/
@RequestMapping("/forwardSend")
@ResponseBody
public Map<String, String> forwardSend(String sendId, String title, String receiveDept, HttpServletRequest request) {
public Map<String, String> forwardSend(String mailSendId, String receiveDept, HttpSession session) {
MailSend entity = getBaseService().getById(mailSendId);
Map<String, String> mm = new HashMap<>();
IUser uu = this.getUser();
IOrganization org = getOrg(session);
Date now = new Date();
entity.setId(PrimaryKey.generateId());
entity.setUserId(uu.getId());
entity.setUserName(uu.getUserName());
entity.setDeptId(org.getId());
entity.setDeptName(org.getName());
entity.setSendTime(now);
entity.setStatus("0");
getBaseService().save(entity);
attachmentService.addFromOld(attachModule, mailSendId, attachModule, entity.getId(), uu, org);
QueryWrapper<Attachment> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("RELEVANCE_ID", sendId);
List<Attachment> list = attachmentService.getBaseMapper().selectList(queryWrapper);
//查询最后一个排序
QueryWrapper<MailReceive> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.eq("MAIL_SEND_ID", sendId);
List<MailReceive> mailReceiveList1 = mailReceiveService.getBaseMapper().selectList(queryWrapper1);
String sortNum = "0";
for (int i = 0; i < mailReceiveList1.size(); i++) {
MailReceive mailReceive = mailReceiveList1.get(i);
String sortNumber = mailReceive.getSortNumber();
if (Integer.parseInt(sortNumber) > Integer.parseInt(sortNum)) {
sortNum = sortNumber;
queryWrapper.eq("RELEVANCE_ID", entity.getId());
List<Attachment> attachmentList = attachmentService.list(queryWrapper);
List<MailReceive> mailReceiveList = null;
//收件
if (StrUtil.isNotEmpty(receiveDept)) {
JSONArray jsonArray = new JSONArray(receiveDept);
mailReceiveList = new ArrayList<>();
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject deptJson = (JSONObject) jsonArray.get(i);
MailReceive mailReceive = new MailReceive();
mailReceive.setId(PrimaryKey.generateId());
mailReceive.setMailSendId(entity.getId());
mailReceive.setDeptId(deptJson.getStr("deptId"));
mailReceive.setDeptName(deptJson.getStr("deptName"));
mailReceive.setStatus("1");
mailReceiveList.add(mailReceive);
newMessagesService.addNewMessage(deptJson.getStr("deptId"), this.getUser().getId(), mailReceive.getId(), MsgType.RECEIVE_MSG);
}
}
JSONArray jsonArray = new JSONArray(receiveDept);
List<MailReceive> mailReceiveList = new ArrayList<>();
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject deptJson = (JSONObject) jsonArray.get(i);
MailReceive mailReceive = new MailReceive();
mailReceive.setId(PrimaryKey.generateId());
mailReceive.setMailSendId(sendId);
mailReceive.setDeptId(deptJson.getStr("deptId"));
mailReceive.setDeptName(deptJson.getStr("deptName"));
mailReceive.setSortNumber(String.valueOf(Integer.parseInt(sortNum)+Integer.parseInt(deptJson.getStr("num"))));
mailReceive.setStatus("1");
mailReceiveList.add(mailReceive);
newMessagesService.addNewMessage(deptJson.getStr("deptId"), this.getUser().getId(), mailReceive.getId(), MsgType.RECEIVE_MSG);
}
if (mailReceiveService.saveBatch(mailReceiveList)) {
logsService.operateLog(request, uu.getId(), uu.getUserName(), LogType.ADD, "成功", "文电", "", "发件箱", title);
} else {
logsService.operateLog(request, uu.getId(), uu.getUserName(), LogType.ADD, "失败", "文电", "", "发件箱", title);
mailReceiveService.saveBatch(mailReceiveList);
if (attachmentList != null && attachmentList.size() > 0) {
for (MailReceive mailReceive : mailReceiveList) {
for (Attachment att : attachmentList) {
PrintNum printNum = new PrintNum();
printNum.setId(PrimaryKey.generateId());
printNum.setMialReceiveId(mailReceive.getId());
printNum.setAttachId(att.getId());
printNum.setPrintNumb(entity.getPrintNum());
printNumService.getBaseMapper().insert(printNum);
}
}
}
mm.put("status", "success");
return mm;
......
......@@ -23,7 +23,9 @@
<cui:form id="form${idSuffix}" heightStyle="fill" style="padding: 0px;">
<!-- 原数据 -->
<input type="hidden" name="id" id="id"/>
<input type="hidden" name="mailSendId" id="mailSendId"/>
<input type="hidden" name="canDownload" id="canDownload"/>
<input type="hidden" name="receiveDept" id="receiveDept${idSuffix}"/>
<div style="width: 100%;margin: 0px auto;">
<div class="form-wrap2" style="padding-right: 5px;width: 100%;">
<table class="form-table" cellpadding="0" cellspacing="0">
......@@ -122,10 +124,13 @@
<div class="buttens-foot-tools">
<%-- <a onclick="mailReceive_edit_sample.printApply()" id="rePrintReply" class="readOnly">重打印申请</a>--%>
<a onclick="mailReceive_edit_sample.toSign()" id="toSingButton">签收</a>
<a onclick="mailReceive_edit_sample.jsdwPicker()" id="toSingButton">转发</a>
<a onclick="mailReceive_edit_sample.colseD()">返回</a>
</div>
</cui:layoutRegion>
</cui:layout>
<cui:dialog id="dialogA${idSuffix}" modal="true" autoOpen="false" reLoadOnOpen="true"
focusInput="false" resizable="true" autoDestroy="true" maximized="false"></cui:dialog>
<cui:dialog id="dialogB${idSuffix}" modal="true" autoOpen="false" resizable="true"
autoDestroy="false" reLoadOnOpen="false" maximized="false"></cui:dialog>
<cui:dialog id="dialogC${idSuffix}" modal="true" autoOpen="false" resizable="true"
......@@ -343,6 +348,82 @@
buttons: null
}).dialog('open');
}
//选择部门
var selectDepts = [];//已选单位
sample.prototype.jsdwPicker = function () {
selectDepts = []
var url = '${ctx}/auth/selectDept?initfun=mailReceive_edit_sample.initfun&callback=mailReceive_edit_sample.deptCallback';
$('#dialogA${idSuffix}').dialog('option', {
url: url,
title: '添加单位',
asyncType: 'get',
width: 735,
height: 565,
buttons: null
}).dialog('open');
}
//获取已选单位
sample.prototype.initfun = function () {
return [];
}
//选择部门回调方法
sample.prototype.deptCallback = function (selectDeptArray) {
selectDepts = selectDeptArray;
var str = JSON.stringify(selectDeptArray);
$('#receiveDept${idSuffix}').val(str);
if (selectDeptArray.length==0){
warning('转发单位为空!');
return;
}
mailReceive_edit_sample.forwardSend();
}
//转发
sample.prototype.forwardSend = function () {
if (!$form.form('valid')) {
warning('表单填写不正确!');
return;
}
var formData = $form.form('formData');
$.confirm('确认转发?', function (r) {
if (r) {
//console.log(formData);
//return;
loading('发送中...');
$.ajax({
type: 'POST',
url: '${ctx}/mail-send/forwardSend',
data: formData,
dataType: 'json',
success: function (data) {
hide();
if (data.status == 'success') {
var replyText = $("#replyText${idSuffix}").textbox("getValue");
$.ajax({
type: 'GET',
url: '${ctx}/mail-receive/updateReplyStatus?bussinessId=' + bussinessId + '&mailSendId=' + mailSendId + '&replyText=' + replyText,
dataType: 'json',
success: function (data) {
if (data) {
message('转发成功!');
mailReceive_list_sample.reloadGrid();
closeThisDialog();
}
}
});
} else {
error('转发失败!');
}
},
error: function (e) {
hide();
error(e);
}
});
}
})
}
return sample;
})(window, $);
......
......@@ -51,7 +51,6 @@
<cui:gridCol name="mailSend.sendTime" width="80">发送时间</cui:gridCol>
<cui:gridCol name="status" width="60"
formatter="mailReceive_list_sample.statusFmt">状态</cui:gridCol>
<cui:gridCol align="center" name="cz" width="35" formatter="mailReceive_list_sample.zf">操作</cui:gridCol>
</cui:gridCols>
<cui:gridPager gridId="grid${idSuffix}"/>
</cui:grid>
......@@ -83,12 +82,6 @@
$grid.grid('reload', {page: 1});
}
sample.prototype.zf = function (cellValue, options, rowObject) {
var status = rowObject.status;
var sendId=rowObject.id;
var title=rowObject.mailTitle;
return '<a style="text-decoration: underline" onclick="mailReceive_list_sample.jsdwPicker(\''+sendId+'\',\''+title+'\')">转发</a>'
}
//选择部门
sample.prototype.jsdwPicker = function () {
selectDepts = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment