Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sunac_report
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
java-sunac-report
sunac_report
Commits
bd9261f5
Commit
bd9261f5
authored
Dec 21, 2017
by
java-lixy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导出、转为文档、发消息
parent
de120831
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
155 additions
and
26 deletions
+155
-26
ExportExcel.java
src/main/java/com/ejweb/core/utils/excel/ExportExcel.java
+94
-0
ReportDao.java
src/main/java/com/ejweb/modules/report/dao/ReportDao.java
+1
-1
ReportEntity.java
src/main/java/com/ejweb/modules/report/entity/ReportEntity.java
+1
-0
ReportService.java
src/main/java/com/ejweb/modules/report/service/ReportService.java
+35
-7
ReportController.java
src/main/java/com/ejweb/modules/report/web/ReportController.java
+14
-10
ReportToWordController.java
src/main/java/com/ejweb/modules/report/web/ReportToWordController.java
+3
-3
ReportDao.xml
src/main/resources/mappings/modules/report/ReportDao.xml
+1
-2
reportDeliver.jsp
src/main/webapp/WEB-INF/views/modules/report/reportDeliver.jsp
+4
-1
reportList.jsp
src/main/webapp/WEB-INF/views/modules/report/reportList.jsp
+2
-2
reportTrack.jsp
src/main/webapp/WEB-INF/views/modules/report/reportTrack.jsp
+0
-0
No files found.
src/main/java/com/ejweb/core/utils/excel/ExportExcel.java
View file @
bd9261f5
...
...
@@ -89,6 +89,15 @@ public class ExportExcel {
* 构造函数
* @param title 表格标题,传“空值”,表示无标题
* @param cls 实体对象,通过annotation.ExportField获取标题
*/
public
ExportExcel
(
String
title
,
Class
<?>
cls
,
boolean
isAdmin
){
this
(
title
,
cls
,
isAdmin
,
1
);
}
/**
* 构造函数
* @param title 表格标题,传“空值”,表示无标题
* @param cls 实体对象,通过annotation.ExportField获取标题
* @param type 导出类型(1:导出数据;2:导出模板)
* @param groups 导入分组
*/
...
...
@@ -167,6 +176,91 @@ public class ExportExcel {
/**
* 构造函数
* @param title 表格标题,传“空值”,表示无标题
* @param cls 实体对象,通过annotation.ExportField获取标题
* @param type 导出类型(1:导出数据;2:导出模板)
* @param groups 导入分组
*/
public
ExportExcel
(
String
title
,
Class
<?>
cls
,
boolean
isAdmin
,
int
type
,
int
...
groups
){
// Get annotation field
Field
[]
fs
=
cls
.
getDeclaredFields
();
for
(
Field
f
:
fs
){
ExcelField
ef
=
f
.
getAnnotation
(
ExcelField
.
class
);
if
(
ef
!=
null
&&
(
ef
.
type
()==
0
||
ef
.
type
()==
type
)){
if
(
groups
!=
null
&&
groups
.
length
>
0
){
boolean
inGroup
=
false
;
for
(
int
g
:
groups
){
if
(
inGroup
){
break
;
}
for
(
int
efg
:
ef
.
groups
()){
if
(
g
==
efg
){
inGroup
=
true
;
annotationList
.
add
(
new
Object
[]{
ef
,
f
});
break
;
}
}
}
}
else
{
annotationList
.
add
(
new
Object
[]{
ef
,
f
});
}
}
}
// Get annotation method
Method
[]
ms
=
cls
.
getDeclaredMethods
();
for
(
Method
m
:
ms
){
ExcelField
ef
=
m
.
getAnnotation
(
ExcelField
.
class
);
if
(
ef
!=
null
&&
(
ef
.
type
()==
0
||
ef
.
type
()==
type
)){
if
(
groups
!=
null
&&
groups
.
length
>
0
){
boolean
inGroup
=
false
;
for
(
int
g
:
groups
){
if
(
inGroup
){
break
;
}
for
(
int
efg
:
ef
.
groups
()){
if
(
g
==
efg
){
inGroup
=
true
;
annotationList
.
add
(
new
Object
[]{
ef
,
m
});
break
;
}
}
}
}
else
{
if
(
isAdmin
){
annotationList
.
add
(
new
Object
[]{
ef
,
m
});
}
else
{
if
(!
m
.
getName
().
equals
(
"getTransferName"
)){
annotationList
.
add
(
new
Object
[]{
ef
,
m
});
}
}
}
}
}
// Field sorting
Collections
.
sort
(
annotationList
,
new
Comparator
<
Object
[]>()
{
public
int
compare
(
Object
[]
o1
,
Object
[]
o2
)
{
return
new
Integer
(((
ExcelField
)
o1
[
0
]).
sort
()).
compareTo
(
new
Integer
(((
ExcelField
)
o2
[
0
]).
sort
()));
};
});
// Initialize
List
<
String
>
headerList
=
Lists
.
newArrayList
();
for
(
Object
[]
os
:
annotationList
){
String
t
=
((
ExcelField
)
os
[
0
]).
title
();
// 如果是导出,则去掉注释
if
(
type
==
1
){
String
[]
ss
=
StringUtils
.
split
(
t
,
"**"
,
2
);
if
(
ss
.
length
==
2
){
t
=
ss
[
0
];
}
}
headerList
.
add
(
t
);
}
initialize
(
title
,
headerList
);
}
/**
* 构造函数
* @param title 表格标题,传“空值”,表示无标题
* @param headers 表头数组
*/
public
ExportExcel
(
String
title
,
String
[]
headers
)
{
...
...
src/main/java/com/ejweb/modules/report/dao/ReportDao.java
View file @
bd9261f5
...
...
@@ -120,7 +120,7 @@ public interface ReportDao extends CrudDao<ReportEntity> {
* 查询管理员ID
* @return
*/
public
String
findAdmin
(
Office
office
);
public
List
<
String
>
findAdmin
(
Office
office
);
/**
* 举报状态数据
...
...
src/main/java/com/ejweb/modules/report/entity/ReportEntity.java
View file @
bd9261f5
...
...
@@ -309,6 +309,7 @@ public class ReportEntity extends DataEntity<ReportEntity> {
this
.
types
=
types
;
}
@ExcelField
(
title
=
"移交给"
,
align
=
2
,
sort
=
42
)
public
String
getTransferName
()
{
return
transferName
;
}
...
...
src/main/java/com/ejweb/modules/report/service/ReportService.java
View file @
bd9261f5
...
...
@@ -6,6 +6,7 @@ import com.ejweb.core.service.CrudService;
import
com.ejweb.core.utils.IdGen
;
import
com.ejweb.core.utils.SpringContextHolder
;
import
com.ejweb.core.utils.StringUtils
;
import
com.ejweb.core.utils.excel.annotation.ExcelField
;
import
com.ejweb.modules.report.dao.ReportDao
;
import
com.ejweb.modules.report.entity.ReportAttachmentEntity
;
import
com.ejweb.modules.report.entity.ReportEntity
;
...
...
@@ -17,12 +18,18 @@ import com.ejweb.modules.sys.entity.Role;
import
com.ejweb.modules.sys.entity.User
;
import
com.ejweb.modules.sys.utils.UserUtils
;
import
com.ejweb.modules.workbench.entity.ReportNotice
;
import
org.apache.ibatis.javassist.bytecode.AnnotationsAttribute
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.io.File
;
import
java.io.UnsupportedEncodingException
;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.InvocationHandler
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Proxy
;
import
java.net.URLDecoder
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
...
...
@@ -80,7 +87,9 @@ public class ReportService extends CrudService<ReportDao, ReportEntity> {
reportEntity
.
setReportTime
(
reportTime
);
reportEntity
.
setReportStatus
(
"0"
);
reportEntity
.
setExchangeBeforeUser
(
reportEntity
.
getCreateBy
().
getId
());
if
(!
this
.
checkRole
(
user
))
{
reportEntity
.
setExchangeAfterUser
(
reportEntity
.
getCreateBy
().
getId
());
}
dao
.
addReport
(
reportEntity
);
if
(
StringUtils
.
isNotBlank
(
reportEntity
.
getReportAttachment
()))
{
...
...
@@ -116,14 +125,13 @@ public class ReportService extends CrudService<ReportDao, ReportEntity> {
* @param reportEntity
*/
@Transactional
(
readOnly
=
false
)
public
void
saveTrack
(
ReportEntity
reportEntity
)
{
public
void
saveTrack
(
ReportEntity
reportEntity
,
String
transferUser
)
{
//保存举报补充信息
reportEntity
.
preUpdate
();
User
user
=
UserUtils
.
getUser
();
if
(
StringUtils
.
isNotBlank
(
reportEntity
.
getExchangeAfterUser
()
)){
if
(
StringUtils
.
isNotBlank
(
transferUser
)){
reportEntity
.
setExchangeType
(
"1"
);
}
else
{
reportEntity
.
setExchangeAfterUser
(
user
.
getId
());
reportEntity
.
setExchangeAfterUser
(
transferUser
);
}
dao
.
addTrack
(
reportEntity
);
...
...
@@ -240,7 +248,7 @@ public class ReportService extends CrudService<ReportDao, ReportEntity> {
* @return
*/
@Transactional
(
readOnly
=
false
)
public
int
addNotice
(
ReportEntity
reportEntity
,
String
flag
){
public
int
addNotice
(
ReportEntity
reportEntity
,
String
flag
,
String
ifDone
){
User
user
=
UserUtils
.
getUser
();
Date
date
=
new
Date
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
...
...
@@ -259,10 +267,16 @@ public class ReportService extends CrudService<ReportDao, ReportEntity> {
reportNotice
.
setSendToId
(
reportEntity
.
getExchangeAfterUser
());
reportNotice
.
setStatus
(
"0"
);
if
(
flag
.
equals
(
"answer"
)){
reportNotice
.
setSendToId
(
reportDao
.
findAdmin
(
new
Office
()));
//当前只有杨杨是系统管理员,处理后消息发给杨杨,以后如果新增了系统管理员需修改
//findAdmin()方法获取所有系统管理员
reportNotice
.
setSendToId
(
"8434980248282724540228"
);
reportNotice
.
setTitle
(
"“"
+
reportEntity
.
getSupplementTitle
()+
"”已由"
+
user
.
getName
()+
"于"
+
dateStr
+
"处理完成"
);
}
if
(
flag
.
equals
(
"meanWhile"
)){
reportNotice
.
setTitle
(
"“"
+
reportEntity
.
getSupplementTitle
()+
"”已由"
+
user
.
getName
()+
"于"
+
dateStr
+
"处理完成"
);
//没点完成,title为请处理
if
(
reportEntity
.
getDealResult
().
equals
(
"3"
)
&&
StringUtils
.
isBlank
(
ifDone
)){
reportNotice
.
setTitle
(
"请处理-“"
+
reportEntity
.
getSupplementTitle
()+
"”"
);
}
}
reportDao
.
updateReportNotice
(
reportNotice
);
return
1
;
...
...
@@ -284,6 +298,10 @@ public class ReportService extends CrudService<ReportDao, ReportEntity> {
}
else
if
(
flag
.
equals
(
"meanWhile"
)){
reportNotice
.
setSendToId
(
reportEntity
.
getExchangeAfterUser
());
reportNotice
.
setTitle
(
"“"
+
reportEntity
.
getSupplementTitle
()+
"”已由"
+
user
.
getName
()+
"于"
+
dateStr
+
"处理完成"
);
//没点完成,title为请处理
if
(
reportEntity
.
getDealResult
().
equals
(
"3"
)
&&
StringUtils
.
isBlank
(
ifDone
)){
reportNotice
.
setTitle
(
"请处理-“"
+
reportEntity
.
getSupplementTitle
()+
"”"
);
}
}
else
{
//管理员转交或移交,消息标题为“请处理xxx”
String
title
=
reportEntity
.
getSupplementTitle
();
...
...
@@ -412,6 +430,16 @@ public class ReportService extends CrudService<ReportDao, ReportEntity> {
report
.
setSupplementArea
(
supplementArea
);
report
.
setSupplementInformant
(
report
.
getSupplementInformant
()
==
null
?
"--"
:
report
.
getSupplementInformant
());
report
.
setDealPersonName
(
report
.
getDealPersonName
()
==
null
?
"--"
:
report
.
getDealPersonName
());
User
user
=
UserUtils
.
getUser
();
if
(
this
.
checkRole
(
user
)){
if
(
StringUtils
.
isBlank
(
report
.
getTransferName
())
||
StringUtils
.
isBlank
(
report
.
getExchangeType
())){
report
.
setTransferName
(
"--"
);
}
else
if
(
StringUtils
.
isNotBlank
(
report
.
getTransferName
())
&&
StringUtils
.
isNotBlank
(
report
.
getExchangeType
())){
report
.
setTransferName
(
report
.
getTransferName
());
}
}
else
{
report
.
setTransferName
(
""
);
}
}
return
reportList
;
}
...
...
@@ -443,7 +471,7 @@ public class ReportService extends CrudService<ReportDao, ReportEntity> {
reportEntity
.
setUpdateBy
(
user
);
reportEntity
.
setUpdateDate
(
new
Date
());
reportDao
.
updateExchangeUser
(
reportEntity
);
this
.
addNotice
(
reportEntity
,
"deliver"
);
this
.
addNotice
(
reportEntity
,
"deliver"
,
null
);
this
.
addRecord
(
reportEntity
,
"2"
);
}
}
...
...
src/main/java/com/ejweb/modules/report/web/ReportController.java
View file @
bd9261f5
...
...
@@ -268,6 +268,7 @@ public class ReportController extends BaseController {
@RequestMapping
(
value
=
"addTrack"
)
public
String
addTrack
(
ReportEntity
reportEntity
,
HttpServletRequest
request
,
Model
model
,
RedirectAttributes
redirectAttributes
)
{
String
ifDone
=
request
.
getParameter
(
"ifDone"
);
// 是否完成
String
transferUser
=
request
.
getParameter
(
"exchangeAfterUser"
);
//选择移交人员
if
(!
beanValidator
(
model
,
reportEntity
))
{
return
form
(
reportEntity
,
model
);
}
...
...
@@ -286,18 +287,20 @@ public class ReportController extends BaseController {
String
exchangeAfterUser
=
reportService
.
findExchangeUser
(
reportEntity
.
getId
());
reportEntity
.
setExchangeAfterUser
(
exchangeAfterUser
);
}
reportService
.
saveTrack
(
reportEntity
);
String
exchangeAfterUser
=
request
.
getParameter
(
"exchangeAfterUser"
);
if
(
StringUtils
.
isNotBlank
(
exchangeAft
erUser
)
&&
StringUtils
.
isBlank
(
reportEntity
.
getDealResult
())){
reportService
.
saveTrack
(
reportEntity
,
transferUser
);
if
(
StringUtils
.
isNotBlank
(
transf
erUser
)
&&
StringUtils
.
isBlank
(
reportEntity
.
getDealResult
())){
//管理员移交给他人处理
reportService
.
addNotice
(
reportEntity
,
"transfer"
);
reportService
.
addNotice
(
reportEntity
,
"transfer"
,
ifDone
);
reportService
.
addRecord
(
reportEntity
,
"1"
);
}
else
if
(
StringUtils
.
isNotBlank
(
reportEntity
.
getDealResult
())
&&
StringUtils
.
isBlank
(
exchangeAft
erUser
)){
}
else
if
(
StringUtils
.
isNotBlank
(
reportEntity
.
getDealResult
())
&&
StringUtils
.
isBlank
(
transf
erUser
)){
//自行处理
reportService
.
addNotice
(
reportEntity
,
"answer"
);
}
else
if
(
StringUtils
.
isNotBlank
(
exchangeAfterUser
)
&&
StringUtils
.
isNotBlank
(
reportEntity
.
getDealResult
())){
if
(!(
reportEntity
.
getDealResult
().
equals
(
"3"
)
&&
StringUtils
.
isBlank
(
ifDone
)))
{
reportService
.
addNotice
(
reportEntity
,
"answer"
,
ifDone
);
}
}
else
if
(
StringUtils
.
isNotBlank
(
transferUser
)
&&
StringUtils
.
isNotBlank
(
reportEntity
.
getDealResult
())){
//管理员进行处理,同时移交给他人
reportService
.
addNotice
(
reportEntity
,
"meanWhile"
);
reportService
.
addNotice
(
reportEntity
,
"meanWhile"
,
ifDone
);
}
addMessage
(
redirectAttributes
,
"补充举报"
+
reportEntity
.
getSupplementTitle
()
+
"'成功"
);
return
"redirect:"
+
adminPath
+
"/report/list/?repage&flag=0"
;
...
...
@@ -388,7 +391,8 @@ public class ReportController extends BaseController {
public
String
export
(
ReportEntity
reportEntity
,
String
flag
,
HttpServletRequest
request
,
HttpServletResponse
response
,
RedirectAttributes
redirectAttributes
)
{
//判断登录人的角色
User
user
=
UserUtils
.
getUser
();
if
(!
reportService
.
checkRole
(
user
)){
boolean
isAdmin
=
reportService
.
checkRole
(
user
);
if
(!
isAdmin
){
reportEntity
.
setExchangeAfterUser
(
user
.
getId
());
}
//判断标签状态 flag为空,跳转到核查中举报列表 flag为0,跳转到未处理举报列表 flag为1,跳转到举报列表
...
...
@@ -406,7 +410,7 @@ public class ReportController extends BaseController {
try
{
String
fileName
=
"举报列表"
+
DateUtils
.
getDate
(
"yyyyMMddHHmmss"
)
+
".xlsx"
;
List
<
ReportEntity
>
reportList
=
reportService
.
getReportList
(
reportEntity
);
new
ExportExcel
(
"举报列表"
,
ReportEntity
.
class
).
setDataList
(
reportList
).
write
(
request
,
response
,
fileName
).
dispose
();
new
ExportExcel
(
"举报列表"
,
ReportEntity
.
class
,
isAdmin
).
setDataList
(
reportList
).
write
(
request
,
response
,
fileName
).
dispose
();
return
null
;
}
catch
(
Exception
e
)
{
addMessage
(
redirectAttributes
,
"导出用户失败!失败信息:"
+
e
.
getMessage
());
...
...
src/main/java/com/ejweb/modules/report/web/ReportToWordController.java
View file @
bd9261f5
...
...
@@ -132,7 +132,7 @@ public class ReportToWordController {
}
}
if
(
list
.
size
()
>
1
)
{
mergeCellsVertically
(
basicInfoTable
,
0
,
5
,
5
+
list
.
size
()
-
1
);
mergeCellsVertically
(
basicInfoTable
,
0
,
6
,
6
+
list
.
size
()
-
1
);
}
this
.
setCellWidth
(
basicInfoTable
);
...
...
@@ -318,11 +318,11 @@ public class ReportToWordController {
for
(
int
i
=
0
;
i
<
list1
.
size
();
i
++)
{
XWPFTableRow
reportAttachment
=
supplementInfoTable
.
createRow
();
reportAttachment
.
getCell
(
0
).
setText
(
"附件:"
);
reportAttachment
.
getCell
(
1
).
setText
(
list1
.
get
(
i
).
getAttachmentPath
());
reportAttachment
.
createCell
(
).
setText
(
list1
.
get
(
i
).
getAttachmentPath
());
}
}
if
(
list1
.
size
()
>
1
)
{
mergeCellsVertically
(
supplementInfoTable
,
0
,
6
,
6
+
list1
.
size
()
-
1
);
mergeCellsVertically
(
supplementInfoTable
,
0
,
4
,
4
+
list1
.
size
()
-
1
);
}
this
.
setCellWidth
(
supplementInfoTable
);
supplementInfoTable
.
setCellMargins
(
0
,
100
,
0
,
100
);
...
...
src/main/resources/mappings/modules/report/ReportDao.xml
View file @
bd9261f5
...
...
@@ -383,8 +383,7 @@
LEFT JOIN ct_bbtc_sys_role sr ON sr.id = sur.role_id
WHERE
sr.name = '系统管理员'
<if
test=
"dbName == 'oracle'"
>
AND rownum
<
= 1
</if>
<if
test=
"dbName == 'mysql'"
>
limit 1
</if>
AND SU.DEL_FLAG = '0'
</select>
<insert
id=
"addRecord"
>
...
...
src/main/webapp/WEB-INF/views/modules/report/reportDeliver.jsp
View file @
bd9261f5
...
...
@@ -184,7 +184,10 @@
<td><c:if
test=
"${report.dealPersonName eq null}"
>
--
</c:if>
<c:if
test=
"${report.dealPersonName ne null}"
>
${report.dealPersonName}
</c:if>
</td>
<td>
${report.transferName}
</td>
<td>
<c:if
test=
"${report.transferName eq null || report.exchangeType eq null}"
>
--
</c:if>
<c:if
test=
"${report.transferName ne null && report.exchangeType ne null}"
>
${report.transferName}
</c:if>
</td>
<td>
<a
href=
"${ctx}/report/view?id=${report.id}"
>
查看
</a>
</td>
...
...
src/main/webapp/WEB-INF/views/modules/report/reportList.jsp
View file @
bd9261f5
...
...
@@ -193,8 +193,8 @@
</td>
<c:if
test=
"${isAdmin eq true}"
>
<td>
<c:if
test=
"${report.transferName eq null}"
>
--
</c:if>
<c:if
test=
"${report.transferName ne null}"
>
${report.transferName}
</c:if>
<c:if
test=
"${report.transferName eq null
|| report.exchangeType eq null
}"
>
--
</c:if>
<c:if
test=
"${report.transferName ne null
&& report.exchangeType ne null
}"
>
${report.transferName}
</c:if>
</td>
</c:if>
<td>
...
...
src/main/webapp/WEB-INF/views/modules/report/reportTrack.jsp
View file @
bd9261f5
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment