28bbd277f3ddb4acb9e52e31c5751d0efcbeaf8a.svn-base
2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/**
* Copyright © 2015-2018 ODM All rights reserved.
*/
package com.thinkgem.jeesite.modules.oa.service;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.oa.entity.OaNotify;
import com.thinkgem.jeesite.modules.oa.entity.OaNotifyRecord;
import com.thinkgem.jeesite.modules.oa.dao.OaNotifyDao;
import com.thinkgem.jeesite.modules.oa.dao.OaNotifyRecordDao;
/**
* 通知通告Service
* @author ThinkGem
* @version 2014-05-16
*/
@Service
@Transactional(readOnly = true)
public class OaNotifyService extends CrudService<OaNotifyDao, OaNotify> {
@Autowired
private OaNotifyRecordDao oaNotifyRecordDao;
public OaNotify get(String id) {
OaNotify entity = dao.get(id);
return entity;
}
/**
* 获取通知发送记录
* @param oaNotify
* @return
*/
public OaNotify getRecordList(OaNotify oaNotify) {
oaNotify.setOaNotifyRecordList(oaNotifyRecordDao.findList(new OaNotifyRecord(oaNotify)));
return oaNotify;
}
public Page<OaNotify> find(Page<OaNotify> page, OaNotify oaNotify) {
oaNotify.setPage(page);
page.setList(dao.findList(oaNotify));
return page;
}
/**
* 获取通知数目
* @param oaNotify
* @return
*/
public Long findCount(OaNotify oaNotify) {
return dao.findCount(oaNotify);
}
@Transactional(readOnly = false)
public void save(OaNotify oaNotify) {
super.save(oaNotify);
// 更新发送接受人记录
oaNotifyRecordDao.deleteByOaNotifyId(oaNotify.getId());
if (oaNotify.getOaNotifyRecordList().size() > 0){
oaNotifyRecordDao.insertAll(oaNotify.getOaNotifyRecordList());
}
}
/**
* 更新阅读状态
*/
@Transactional(readOnly = false)
public void updateReadFlag(OaNotify oaNotify) {
OaNotifyRecord oaNotifyRecord = new OaNotifyRecord(oaNotify);
oaNotifyRecord.setUser(oaNotifyRecord.getCurrentUser());
oaNotifyRecord.setReadDate(new Date());
oaNotifyRecord.setReadFlag("1");
oaNotifyRecordDao.update(oaNotifyRecord);
}
}