提交 a73b36d4 authored 作者: LJJ's avatar LJJ

Merge branch 'develop' of…

...@@ -19,5 +19,6 @@ public interface NoticeDao extends JpaRepository<Notice , Integer> { ...@@ -19,5 +19,6 @@ public interface NoticeDao extends JpaRepository<Notice , Integer> {
Page<Notice> findOutByReceiverAndType(String addressee, int type, Pageable pageable); Page<Notice> findOutByReceiverAndType(String addressee, int type, Pageable pageable);
Page<Notice> findOutByReceiverAndTypeAndStatus(String addressee, int type, int status, Pageable pageable); Page<Notice> findOutByReceiverAndTypeAndStatus(String addressee, int type, int status, Pageable pageable);
List<Notice> findOutByReceiverAndStatus(String receiver, int status); List<Notice> findOutByReceiverAndStatus(String receiver, int status);
Page<Notice> findOutBySenderAndTypeAndDeleted(String sender, int type, Pageable pageable, String deleted);
} }
...@@ -99,4 +99,12 @@ public class NoticeController { ...@@ -99,4 +99,12 @@ public class NoticeController {
return ResponseEntity.ok(noticeService.unreadNum(userId)); return ResponseEntity.ok(noticeService.unreadNum(userId));
} }
@GetMapping("/deleteDraft")
@ApiOperation(value = "删除草稿")
@ApiImplicitParam(name = "noticeId", value = "草稿编号", paramType = "query", required = true)
public ResponseEntity deleteDraft(int noticeId){
log.info("删除草稿");
return ResponseEntity.ok(noticeService.deleteDraft(noticeId));
}
} }
...@@ -63,4 +63,5 @@ public class Attention { ...@@ -63,4 +63,5 @@ public class Attention {
private Date updateTime; private Date updateTime;
} }
...@@ -136,6 +136,13 @@ public class Notice { ...@@ -136,6 +136,13 @@ public class Notice {
@Column(name = "receiver") @Column(name = "receiver")
private String receiver; private String receiver;
/**
* 是否删除
*/
@ApiModelProperty(value = "deleted", example = "", dataType = "String", name = "是否删除",notes = "没有删除0,已删除1")
@Column(name = "deleted")
private String deleted;
} }
...@@ -77,4 +77,11 @@ public interface NoticeService { ...@@ -77,4 +77,11 @@ public interface NoticeService {
* @return 已接收未读数量 * @return 已接收未读数量
*/ */
int unreadNum(String userId); int unreadNum(String userId);
/**
* 删除草稿
* @param noticeId 通知编号
* @return 成功true
*/
boolean deleteDraft(int noticeId);
} }
...@@ -68,6 +68,7 @@ public class NoticeServiceImpl implements NoticeService { ...@@ -68,6 +68,7 @@ public class NoticeServiceImpl implements NoticeService {
} }
notice.setAddressee(JSONObject.toJSONString(addresseeList)); notice.setAddressee(JSONObject.toJSONString(addresseeList));
notice.setDeleted("0");
noticeDao.save(notice); noticeDao.save(notice);
}else { }else {
...@@ -194,8 +195,8 @@ public class NoticeServiceImpl implements NoticeService { ...@@ -194,8 +195,8 @@ public class NoticeServiceImpl implements NoticeService {
notice.setStatus(1); notice.setStatus(1);
noticeDao.save(notice); noticeDao.save(notice);
UserDo userDo = userService.findById(userId); // 当前用户 UserDo userDo = userService.findById(userId); // 当前用户
String data = "[" +userDo.getUnit() + "][" + userDo.getDepartment() + "]的[" + userDo.getName() String data = "[" +userDo.getUnit() + "_" + userDo.getName()
+ "查看了关于[" + notice.getTitle() + "的通知"; + "]查看了《" + notice.getTitle() + "》";
efsLogUtil.addLog(new EfsLog(null, userDo.getId(), data, new Date())); efsLogUtil.addLog(new EfsLog(null, userDo.getId(), data, new Date()));
return notice; return notice;
...@@ -216,8 +217,11 @@ public class NoticeServiceImpl implements NoticeService { ...@@ -216,8 +217,11 @@ public class NoticeServiceImpl implements NoticeService {
//已接收 //已接收
// p = noticeDao.findOutByAddresseeLikeAndType("%"+user+"%", type, pageable); // p = noticeDao.findOutByAddresseeLikeAndType("%"+user+"%", type, pageable);
p = noticeDao.findOutByReceiverAndType(user, type,pageable); p = noticeDao.findOutByReceiverAndType(user, type,pageable);
}else if(type == 2){
//草稿
p = noticeDao.findOutBySenderAndTypeAndDeleted(user, type, pageable,"0");
}else { }else {
//已发送,草稿 //已发送
p = noticeDao.findOutBySenderAndType(user, type, pageable); p = noticeDao.findOutBySenderAndType(user, type, pageable);
} }
...@@ -298,5 +302,19 @@ public class NoticeServiceImpl implements NoticeService { ...@@ -298,5 +302,19 @@ public class NoticeServiceImpl implements NoticeService {
return noticeList.size(); return noticeList.size();
} }
@Override
public boolean deleteDraft(int noticeId) {
try {
Notice notice = noticeDao.findById(noticeId);
notice.setDeleted("1");
noticeDao.save(notice);
return true;
}catch (Exception e){
e.printStackTrace();
return false;
}
}
} }
...@@ -39,10 +39,10 @@ public class Job { ...@@ -39,10 +39,10 @@ public class Job {
// updateAtt(notice, days, 1); // updateAtt(notice, days, 1);
if (days <= 3.001 && days > 2.998 && notice.getLabel() != 1){ if (days <= 3.001 && days > 2.998 && notice.getLabel() != 1){
updateAtt(notice, 3, 1); updateAtt(notice, "3", 1);
} }
if(days <= 1.001 && days > 0.998 && notice.getLabel() != 2){ if(days <= 1.001 && days > 0.998 && notice.getLabel() != 2){
updateAtt(notice, 1, 2); updateAtt(notice, "1", 2);
} }
} }
...@@ -57,7 +57,7 @@ public class Job { ...@@ -57,7 +57,7 @@ public class Job {
* @param days 失效天数 * @param days 失效天数
* @param label 修改通知label 1为提醒过一次,2为提醒过两次 * @param label 修改通知label 1为提醒过一次,2为提醒过两次
*/ */
private void updateAtt(Notice notice, double days, int label){ private void updateAtt(Notice notice, String days, int label){
String data = ""; String data = "";
Attention attention = new Attention(); Attention attention = new Attention();
// data = "您收到来自["+ notice.getUnit() + "][" + notice.getName() +"]标题为[" + notice.getTitle() + "]的通知,没有查看"; // data = "您收到来自["+ notice.getUnit() + "][" + notice.getName() +"]标题为[" + notice.getTitle() + "]的通知,没有查看";
...@@ -78,7 +78,7 @@ public class Job { ...@@ -78,7 +78,7 @@ public class Job {
// System.out.println(downLoadCounts); // System.out.println(downLoadCounts);
for(DownLoadCount downLoadCount:downLoadCounts){ for(DownLoadCount downLoadCount:downLoadCounts){
if(downLoadCount.getCount() == 0){ if(downLoadCount.getCount() == 0){
data = "您收到["+ notice.getUnit() + "][" + notice.getName() +"]的《" + notice.getTitle() + "》,有文件没有下载"; data = "您收到["+ notice.getUnit() + "_" + notice.getName() +"]的《" + notice.getTitle() + "》,有文件没有下载";
add(days, attention, data, notice, label); add(days, attention, data, notice, label);
} }
} }
...@@ -99,7 +99,7 @@ public class Job { ...@@ -99,7 +99,7 @@ public class Job {
* @param notice 通知实体 * @param notice 通知实体
* @param label 该通知提醒过几次 * @param label 该通知提醒过几次
*/ */
private void add(double days, Attention attention, String data, Notice notice, int label){ private void add(String days, Attention attention, String data, Notice notice, int label){
// int d = (int)Math.ceil(days); // int d = (int)Math.ceil(days);
data = data + ",还有" + days + "天失效。请尽快下载。"; data = data + ",还有" + days + "天失效。请尽快下载。";
attention.setData(data); attention.setData(data);
......
...@@ -72,7 +72,7 @@ public class FileUploadController { ...@@ -72,7 +72,7 @@ public class FileUploadController {
}) })
@ResponseBody @ResponseBody
public ServerResponse upload(@RequestParam(value = "file", required = false) MultipartFile file, public ServerResponse upload(@RequestParam(value = "file", required = false) MultipartFile file,
@RequestParam(value = "md5File") String md5File, @RequestParam(value = "md5File",required = false) String md5File,
@RequestParam(value = "chunk",required= false) Integer chunk) { //第几片,从0开始 @RequestParam(value = "chunk",required= false) Integer chunk) { //第几片,从0开始
return fileUploadService.upload(file,md5File,chunk); return fileUploadService.upload(file,md5File,chunk);
} }
......
...@@ -123,6 +123,11 @@ public class FileUploadServiceImpl implements FileUploadService { ...@@ -123,6 +123,11 @@ public class FileUploadServiceImpl implements FileUploadService {
@Override @Override
public ServerResponse upload(MultipartFile file, String md5File, Integer chunk) { public ServerResponse upload(MultipartFile file, String md5File, Integer chunk) {
log.info("开始文件上传");
log.info("文件:" + file);
log.info("md5File" + md5File);
log.info("当前分片" + chunk);
log.info("文件名称" + file.getName());
String chunkPath = fileAddress + "/" + md5File + "/";//分片存放目录 String chunkPath = fileAddress + "/" + md5File + "/";//分片存放目录
File dirFile = new File(chunkPath); File dirFile = new File(chunkPath);
if (!dirFile.exists()) {//目录不存在,创建目录 if (!dirFile.exists()) {//目录不存在,创建目录
...@@ -144,6 +149,7 @@ public class FileUploadServiceImpl implements FileUploadService { ...@@ -144,6 +149,7 @@ public class FileUploadServiceImpl implements FileUploadService {
} catch (IOException e) { } catch (IOException e) {
log.error(filePath + "文件没有保存"); log.error(filePath + "文件没有保存");
} }
log.info(saveFile.getAbsolutePath() + "文件保存成功");
return ServerResponse.success("true"); return ServerResponse.success("true");
} }
...@@ -183,6 +189,7 @@ public class FileUploadServiceImpl implements FileUploadService { ...@@ -183,6 +189,7 @@ public class FileUploadServiceImpl implements FileUploadService {
//删除md5目录,及临时文件 //删除md5目录,及临时文件
deleteFile(new File(fileAddress + "/" + md5File)); deleteFile(new File(fileAddress + "/" + md5File));
fileOutputStream.flush(); fileOutputStream.flush();
log.info(savePath + "文件合并成功");
} catch (Exception e) { } catch (Exception e) {
log.error(fileSave.getPath() + "文件保存失败"); log.error(fileSave.getPath() + "文件保存失败");
e.printStackTrace(); e.printStackTrace();
......
...@@ -21,6 +21,8 @@ spring.jpa.open-in-view=true ...@@ -21,6 +21,8 @@ spring.jpa.open-in-view=true
spring.servlet.multipart.max-file-size=100MB spring.servlet.multipart.max-file-size=100MB
spring.servlet.multipart.max-request-size=100MB spring.servlet.multipart.max-request-size=100MB
server.tomcat.max-http-form-post-size=100*1024*1024
file.address=/Users/ljj/software/ftp file.address=/Users/ljj/software/ftp
# SSL config # SSL config
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论