Commit ee7c4ecf authored by Du Xingdong's avatar Du Xingdong

转发,多文件下载

parent 6e916fc5
......@@ -305,6 +305,7 @@ public class MailReceiveController extends BaseServiceController<MailReceive, IM
mv.addObject("mailSendId", mailSendId);
String canPrintNot = mailSendService.getById(mailSendId).getCanDownload();
mv.addObject("canPrintNot", canPrintNot);
mv.addObject("currentOrgId", authsystemService.getOrganizationByUserId(getUser().getId()).getId());
return mv;
}
......@@ -692,7 +693,7 @@ public class MailReceiveController extends BaseServiceController<MailReceive, IM
Map<String, String> retMap = new HashMap<>();
IUser user = getUser();
IOrganization org = authsystemService.getOrganizationByUserId(user.getId());
String s = session.getAttribute(Constant.CURRENT_ORG_ID).toString();
//String s = session.getAttribute(Constant.CURRENT_ORG_ID).toString();
QueryWrapper<MailReceive> querReceive = new QueryWrapper<>();
querReceive.eq("DEPT_ID", org.getId()).eq("STATUS", "1");
//int querReceiveCounts = getBaseService().count(querReceive);//待签数量
......@@ -788,4 +789,13 @@ public class MailReceiveController extends BaseServiceController<MailReceive, IM
return mm;
}
/**
* 下载所有文件
* @return
*/
@RequestMapping("/downloadFiles")
public void downloadFiles(HttpServletRequest request, HttpServletResponse response){
getBaseService().download(request,response);
}
}
......@@ -300,7 +300,6 @@ public class MailSendController extends BaseServiceController<MailSend, IMailSen
/**
* 转发
*
* @param sendId
* @param receiveDept 接收单位json数组字符串
* @return
* @author: dxd
......@@ -314,7 +313,11 @@ public class MailSendController extends BaseServiceController<MailSend, IMailSen
IUser uu = this.getUser();
IOrganization org = getOrg(session);
Date now = new Date();
if (entity.getForwordDept() == null || entity.getForwordDept().equals("")) {
entity.setForwordDept(entity.getDeptName());
}else {
entity.setForwordDept(entity.getForwordDept());
}
entity.setId(PrimaryKey.generateId());
entity.setUserId(uu.getId());
entity.setUserName(uu.getUserName());
......
......@@ -169,4 +169,10 @@ public class MailSend implements Serializable {
*/
@TableField("CAN_STAMP")
private String canStamp;
/**
* 转发文件的源头单位
*/
@TableField("FORWORD_DEPT")
private String forwordDept;
}
......@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.cesgroup.bdc.util.CuiPage;
import com.cesgroup.bdc.wdgl.vo.ConditionVo;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
......@@ -76,4 +78,6 @@ public interface IMailReceiveService extends IService<MailReceive> {
void updateMailSendStatus(String mailSendId);
int querReceiveCounts(String deptId);
void download(HttpServletRequest request, HttpServletResponse response);
}
......@@ -5,21 +5,27 @@ import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cesgroup.bdc.attachment.entity.Attachment;
import com.cesgroup.bdc.attachment.entity.DiskFile;
import com.cesgroup.bdc.attachment.service.IDiskFileService;
import com.cesgroup.bdc.attachment.service.impl.AttachmentServiceImpl;
import com.cesgroup.bdc.mail.entity.MailReceive;
import com.cesgroup.bdc.mail.entity.MailSend;
import com.cesgroup.bdc.mail.mapper.MailReceiveMapper;
import com.cesgroup.bdc.mail.service.IMailReceiveService;
import com.cesgroup.bdc.mail.service.IMailSendService;
import com.cesgroup.bdc.util.CompressUtil;
import com.cesgroup.bdc.util.CuiPage;
import com.cesgroup.bdc.wdgl.vo.ConditionVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* <p>
......@@ -34,6 +40,15 @@ public class MailReceiveServiceImpl extends ServiceImpl<MailReceiveMapper, MailR
@Autowired
private IMailSendService mailSendService;
@Autowired
private AttachmentServiceImpl attachmentService;
@Autowired
private IDiskFileService diskFileService;
@Value("${file.upload.path}")
private String fileBasePath;
/**
* 根据状态查询
*
......@@ -200,4 +215,29 @@ public class MailReceiveServiceImpl extends ServiceImpl<MailReceiveMapper, MailR
dateString+=" 23:59:59";
return getBaseMapper().querReceiveCounts(deptId,dateString);
}
@Override
public void download(HttpServletRequest request, HttpServletResponse response) {
String mailSendId = request.getParameter("mailSendId");
String mailTitle = request.getParameter("mailTitle");
List<Attachment> attachmentList = attachmentService.selectByModuleAndRelevanceId("mail", mailSendId);
List<Map<String, String>> filePaths = new ArrayList<>();
if (attachmentList != null && attachmentList.size()>0) {
for (int i = 0; i < attachmentList.size(); i++) {
Attachment attachment = attachmentList.get(i);
String diskFileId = attachment.getDiskFileId();
DiskFile diskFile = diskFileService.getById(diskFileId);
Map<String, String> map=new HashMap<>();
map.put("filePath",fileBasePath+diskFile.getPath());
map.put("fileName",diskFile.getOriginalName());
filePaths.add(map);
}
}
String zipName = mailTitle + ((int) (Math.random() * 10000)) + ".zip";
String zipPath = fileBasePath + "/zipTemp/" + zipName;
CompressUtil.compress(filePaths, zipPath, false);
File pocZipFile = new File(zipPath);
CompressUtil.downloadZip(response, zipName, pocZipFile, request);
//pocZipFile.delete();
}
}
......@@ -35,6 +35,7 @@
<result property="remark" column="S_REMARK"/>
<result property="status" column="S_STATUS"/>
<result property="previousId" column="S_PREVIOUS_ID"/>
<result property="forwordDept" column="S_FORWORD_DEPT"/>
</association>
</resultMap>
......@@ -44,6 +45,7 @@
, s.DEPT_NAME S_DEPT_NAME, s.SEND_TIME S_SEND_TIME, s.MAIL_TYPE S_MAIL_TYPE, s.SAFE_LEVEL S_SAFE_LEVEL, s.EMERGENCY S_EMERGENCY
, s.PARTY_TIME S_PARTY_TIME, s.MAIL_PAGE S_MAIL_PAGE, s.MAIL_NO S_MAIL_NO, s.EFF_DATE S_EFF_DATE, s.PRINT_NUM S_PRINT_NUM
, s.CAN_DOWNLOAD S_CAN_DOWNLOAD, s.NEED_MSG S_NEED_MSG, s.MSG_CONTENT S_MSG_CONTENT, s.REMARK S_REMARK, s.STATUS S_STATUS, s.PREVIOUS_ID S_PREVIOUS_ID
, s.FORWORD_DEPT S_FORWORD_DEPT
</sql>
<sql id="common_where_if">
......
......@@ -64,7 +64,7 @@
<th colspan="3">发送人</th>
<td id="userName" name="userName" colspan="7"></td>
<th colspan="3" rowspan="2" style="background-color: #feffef;">
附件
附件<br /><a id="downloadZip" target="_blank">(下载所有文件)</a>
</th>
<td rowspan="2" colspan="7" style="padding: 0px; background-color: #feffef;">
<div id="fileList${idSuffix}"
......@@ -124,7 +124,9 @@
<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>
<c:if test="${currentOrgId=='f821ea6b183245bfa594d6e5d6f34843'}">
<a onclick="mailReceive_edit_sample.jsdwPicker()">转发</a>
</c:if>
<a onclick="mailReceive_edit_sample.colseD()">返回</a>
</div>
</cui:layoutRegion>
......@@ -172,6 +174,12 @@
}
$("#receiveUserName${idSuffix}").html(data.receiveUserName);
debugger;
let forwordDept = data.mailSend.forwordDept;
let deptName = data.mailSend.deptName;
if (forwordDept != null && forwordDept != "" && forwordDept != deptName){
data.mailSend.deptName = forwordDept;
data.mailSend.mailTitle = data.mailSend.mailTitle+"(由"+deptName+"转发)"
}
$form.form('load', data.mailSend);
$form.form('load', data);
$("#userName").html(data.mailSend.userName);
......@@ -191,6 +199,9 @@
$('#' + key + '${idSuffix}').html(text);
}
let mailSendId = $("#mailSendId").val();
let mailTitle = $("#mailTitle${idSuffix}").text();
$("#downloadZip").attr("href",'${ctx}/mail-receive/downloadFiles?mailSendId='+mailSendId+"&mailTitle="+mailTitle)
},
error: function (e) {
hide();
......@@ -228,6 +239,20 @@
});
}
sample.prototype.downloadZip = function () {
let mailSendId = $("#mailSendId").val();
let mailTitle = $("#mailTitle${idSuffix}").text();
console.log(mailTitle)
$.ajax({
type: 'GET',
url: '${ctx}/mail-receive/downloadFiles?mailSendId='+mailSendId+"&mailTitle="+mailTitle,
dataType: 'json',
success: function (data) {
}
})
}
function closeThisDialog() {
$thisDialog.dialog('close');
......
......@@ -41,7 +41,7 @@
<cui:gridCol name="id" hidden="true">id</cui:gridCol>
<cui:gridCol name="mailSendId" hidden="true">mailSendId</cui:gridCol>
<%--<cui:gridCol name="mailSend.mailNo" width="60">发文号</cui:gridCol>--%>
<cui:gridCol name="mailSend.deptName" width="60">来文单位</cui:gridCol>
<cui:gridCol name="mailSend.deptName" width="60" formatter="mailReceive_list_sample.deptNameFmt">来文单位</cui:gridCol>
<cui:gridCol name="mailSend.mailTitle" width="120"
formatter="mailReceive_list_sample.titleFmt">文电标题</cui:gridCol>
<cui:gridCol name="mailSend.mailType" width="50">类型</cui:gridCol>
......@@ -192,8 +192,22 @@
}
return result;
}
sample.prototype.deptNameFmt = function (cellValue, options, rowObject) {
var result = '';
if (rowObject.mailSend.forwordDept != null && rowObject.mailSend.forwordDept != "" && rowObject.mailSend.forwordDept != rowObject.mailSend.deptName){
result = rowObject.mailSend.forwordDept;
}else {
result = cellValue;
}
return result;
}
sample.prototype.titleFmt = function (cellValue, options, rowObject) {
var result = '<a style="color:rgb(67,71,201)" onclick="mailReceive_list_sample.edit(\'' + rowObject.id + '\',\'' + rowObject.mailSendId + '\')">' + cellValue + '</a>';
var result = '';
if (rowObject.mailSend.forwordDept != null && rowObject.mailSend.forwordDept != "" && rowObject.mailSend.forwordDept != rowObject.mailSend.deptName){
result += '<a style="color:rgb(67,71,201)" onclick="mailReceive_list_sample.edit(\'' + rowObject.id + '\',\'' + rowObject.mailSendId + '\')">' + cellValue +'(由'+rowObject.mailSend.deptName+'转发)</a>';
}else {
result += '<a style="color:rgb(67,71,201)" onclick="mailReceive_list_sample.edit(\'' + rowObject.id + '\',\'' + rowObject.mailSendId + '\')">' + cellValue + '</a>';
}
return result;
}
......
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