Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
AmosBankPatrolRoot
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
bank
AmosBankPatrolRoot
Commits
e2d755af
Commit
e2d755af
authored
Aug 27, 2020
by
xinglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改bug
parent
51694ad2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
238 additions
and
164 deletions
+238
-164
CheckServiceImpl.java
...atrol/service/business/service/impl/CheckServiceImpl.java
+16
-6
DateUtil.java
...a/com/yeejoin/amos/patrol/service/core/util/DateUtil.java
+12
-0
PoiUtil.java
...va/com/yeejoin/amos/patrol/service/core/util/PoiUtil.java
+26
-0
StringUtil.java
...com/yeejoin/amos/patrol/service/core/util/StringUtil.java
+168
-147
dbTemplate_check.xml
...olStart/src/main/resources/db/mapper/dbTemplate_check.xml
+16
-11
No files found.
AmosBankPatrolService/src/main/java/com/yeejoin/amos/patrol/service/business/service/impl/CheckServiceImpl.java
View file @
e2d755af
...
...
@@ -1175,7 +1175,7 @@ public class CheckServiceImpl implements ICheckService {
if
(!
stateMap
.
containsKey
(
finalSp
[
i
]))
{
properties
.
put
(
finalSp
[
i
],
""
);
}
else
{
properties
.
put
(
finalSp
[
i
],
CheckStatusEnum
.
getEnum
(
stateMap
.
get
(
finalSp
[
i
]).
toString
()).
getName
(
));
properties
.
put
(
finalSp
[
i
],
stateMap
.
get
(
finalSp
[
i
]
));
}
}
try
{
...
...
@@ -1236,10 +1236,11 @@ public class CheckServiceImpl implements ICheckService {
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
1
,
1
,
0
,
mergeNum
));
//第一行
String
title
=
String
.
format
(
"%s %s 每日巡检情况表"
,
companyName
,
linkMap
.
get
(
"departmentName"
).
toString
());
PoiUtil
.
setTitleValue
(
sheet
.
createRow
(
rowNum
++),
title
,
headerStyle
);
String
title1
=
String
.
format
(
"%s %s 每日巡检情况表"
,
companyName
,
linkMap
.
get
(
"departmentName"
).
toString
());
String
title2
=
String
.
format
(
"巡检人:____________ 日期:%s 至 %s"
,
param
.
getBeginDate
(),
param
.
getEndDate
());
PoiUtil
.
setTitleValue
(
sheet
.
createRow
(
rowNum
++),
title1
,
headerStyle
);
//第二行
PoiUtil
.
setTitleValue
(
sheet
.
createRow
(
rowNum
++),
"巡检人:____________ 日期: ___年___月___日至___日"
,
headerStyle
);
PoiUtil
.
setTitleValue
(
sheet
.
createRow
(
rowNum
++),
title2
,
headerStyle
);
HSSFRow
row
=
sheet
.
createRow
(
rowNum
++);
HSSFCell
cell
=
null
;
...
...
@@ -1260,6 +1261,11 @@ public class CheckServiceImpl implements ICheckService {
//PoiUtil.exportLocal(wb, "D:/upload", "机构客户信息表.xls");
}
/**
* 返回时间-状态Map
* @param idState
* @return
*/
private
Map
<
String
,
Object
>
getStateMap
(
String
idState
)
{
Map
<
String
,
Object
>
idStateMap
=
Maps
.
newHashMap
();
if
(
ObjectUtils
.
isEmpty
(
idState
))
{
...
...
@@ -1268,7 +1274,11 @@ public class CheckServiceImpl implements ICheckService {
String
[]
split
=
idState
.
split
(
","
);
for
(
int
i
=
0
;
i
<
split
.
length
;
i
++)
{
String
[]
sp
=
split
[
i
].
split
(
"_"
);
idStateMap
.
put
(
sp
[
0
],
sp
[
1
]);
if
(
ObjectUtils
.
isEmpty
(
sp
[
1
]))
{
//文本类的输入值
idStateMap
.
put
(
sp
[
0
],
CheckStatusEnum
.
getEnum
(
sp
[
2
]).
getName
());
}
else
{
idStateMap
.
put
(
sp
[
0
],
sp
[
1
]);
}
}
return
idStateMap
;
}
...
...
@@ -1403,7 +1413,7 @@ public class CheckServiceImpl implements ICheckService {
cell3
.
setCellValue
(
checkInputBo
.
getInputItemName
());
cell3
.
setCellStyle
(
alignLeftStyle
);
HSSFCell
cell4
=
row
.
createCell
(
4
);
if
(
"选择"
.
equals
(
checkInputBo
.
getItemType
())
)
{
if
(
"选择"
.
equals
(
checkInputBo
.
getItemType
())
&&
ObjectUtils
.
isEmpty
(
checkInputBo
.
getInputValue
()))
{
cell4
.
setCellValue
(
checkInputBo
.
getIsOK
());
}
else
{
cell4
.
setCellValue
(
checkInputBo
.
getInputValue
());
...
...
AmosBankPatrolService/src/main/java/com/yeejoin/amos/patrol/service/core/util/DateUtil.java
View file @
e2d755af
...
...
@@ -707,4 +707,16 @@ public class DateUtil {
public
static
String
splitDate
(
String
Date
){
return
Date
.
substring
(
11
,
Date
.
length
());
}
/**
* 当前日期毫秒.xls
*
* @return
*/
public
static
String
formatName
()
{
Calendar
calen
=
Calendar
.
getInstance
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyyMMddhhmmss"
);
String
name
=
sdf
.
format
(
calen
.
getTime
());
return
name
;
}
}
AmosBankPatrolService/src/main/java/com/yeejoin/amos/patrol/service/core/util/PoiUtil.java
View file @
e2d755af
...
...
@@ -10,6 +10,7 @@ import java.io.File;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.net.URLEncoder
;
/**
* @Author: xinglei
...
...
@@ -81,6 +82,31 @@ public class PoiUtil {
}
/**
* 导出(前端导出,带文件名)
*/
public
static
void
exportFile
(
HSSFWorkbook
wb
,
String
fileName
,
HttpServletResponse
response
)
{
OutputStream
out
=
null
;
try
{
out
=
response
.
getOutputStream
();
String
name
=
URLEncoder
.
encode
(
fileName
,
"UTF-8"
);
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setContentType
(
"application/force-download"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
name
+
".xls"
);
wb
.
write
(
out
);
out
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
out
!=
null
)
{
try
{
out
.
close
();
}
catch
(
Exception
e2
)
{
}
}
}
}
/**
* 导出(本地导出,测试用)
*/
public
static
void
exportLocal
(
HSSFWorkbook
wb
,
String
path
,
String
name
)
{
...
...
AmosBankPatrolService/src/main/java/com/yeejoin/amos/patrol/service/core/util/StringUtil.java
View file @
e2d755af
package
com
.
yeejoin
.
amos
.
patrol
.
service
.
core
.
util
;
import
org.springframework.util.Assert
;
import
org.springframework.util.ObjectUtils
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
...
...
@@ -10,155 +15,171 @@ import static com.yeejoin.amos.patrol.service.constants.XJConstant.JOINT;
/**
* 字符串工具类
*
* @author as-youjun
*
* @author as-youjun
*/
public
class
StringUtil
{
private
static
Pattern
NOT_ZERO_AT_THE_END
=
Pattern
.
compile
(
"[1-9](\\d*[1-9])?"
);
private
static
Pattern
numericPattern
=
Pattern
.
compile
(
"-?[0-9]+\\.?[0-9]*"
);
/**
* 判断对象是否为空
*
* @param str
* @return
*/
public
static
boolean
isNotEmpty
(
Object
str
)
{
boolean
flag
=
true
;
if
(
str
!=
null
&&
!
str
.
equals
(
""
))
{
if
(
str
.
toString
().
length
()
>
0
)
{
flag
=
true
;
}
}
else
{
flag
=
false
;
}
return
flag
;
}
/***************************************************************************
* repeat - 通过源字符串重复生成N次组成新的字符串。
*
* @param src
* - 源字符串 例如: 空格(" "), 星号("*"), "浙江" 等等...
* @param num
* - 重复生成次数
* @return 返回已生成的重复字符串
* @version 1.0 (2006.10.10) Wilson Lin
**************************************************************************/
public
static
String
repeat
(
String
src
,
int
num
)
{
StringBuffer
s
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
num
;
i
++)
s
.
append
(
src
);
return
s
.
toString
();
}
/**
* 判断是否数字表示
* 源字符串
* @return 是否数字的标志
*/
public
static
boolean
isNumeric
(
String
str
)
{
// 该正则表达式可以匹配所有的数字 包括负数
String
bigStr
;
try
{
bigStr
=
new
BigDecimal
(
str
).
toString
();
}
catch
(
Exception
e
)
{
return
false
;
// 异常 说明包含非数字。
}
Matcher
isNum
=
numericPattern
.
matcher
(
bigStr
);
// matcher是全匹配
if
(!
isNum
.
matches
())
{
return
false
;
}
return
true
;
}
public
static
int
toInt
(
String
s
)
{
if
(
s
!=
null
&&
!
""
.
equals
(
s
.
trim
()))
{
try
{
return
Integer
.
parseInt
(
s
);
}
catch
(
Exception
e
)
{
return
0
;
}
}
return
0
;
}
/**
* 截取前后都不是0的数字字符串
*
* 12010102 => 12010102 12010100 => 120101 ab1201100b => 12011
*
* @param str
* @return
*/
public
static
String
delEndZero
(
String
str
)
{
Matcher
mat
=
NOT_ZERO_AT_THE_END
.
matcher
(
str
);
boolean
rs
=
mat
.
find
();
if
(
rs
)
{
return
mat
.
group
(
0
);
}
return
null
;
}
/**
*
* <pre>
* 移除字符串后面的0
* </pre>
*
* @param s
* @return
*/
public
static
String
removeSufixZero
(
String
s
)
{
if
(
s
==
null
)
{
return
""
;
}
while
(
s
.
endsWith
(
"0"
))
{
if
(
s
.
equals
(
"0"
))
{
s
=
""
;
break
;
}
s
=
s
.
substring
(
0
,
s
.
length
()
-
1
);
}
return
s
;
}
public
static
String
transforCode
(
String
code
)
{
if
(
code
.
endsWith
(
"0000000"
))
{
code
=
code
.
substring
(
0
,
1
);
}
else
if
(
code
.
endsWith
(
"000000"
))
{
code
=
code
.
substring
(
0
,
2
);
}
else
if
(
code
.
endsWith
(
"0000"
))
{
code
=
code
.
substring
(
0
,
4
);
}
else
if
(
code
.
endsWith
(
"00"
))
{
code
=
code
.
substring
(
0
,
6
);
}
return
code
;
}
/**
* 获取支队orgCode
*
* @param orgCode
* @return
*/
public
static
String
getDetachmentOrgCode
(
String
orgCode
)
{
Assert
.
notNull
(
orgCode
,
"组织结构orgCode不能为空!"
);
String
[]
codes
=
orgCode
.
split
(
"\\*"
);
if
(
codes
.
length
<
2
)
{
throw
new
IllegalArgumentException
(
"组织结构orgCode为总队,不能获取支队orgCode!"
);
}
else
{
return
codes
[
0
]
+
"*"
+
codes
[
1
];
}
}
public
static
String
setStr
(
String
str1
,
String
str2
)
{
String
str
=
str1
+
JOINT
+
str2
;
return
str
;
}
private
static
Pattern
NOT_ZERO_AT_THE_END
=
Pattern
.
compile
(
"[1-9](\\d*[1-9])?"
);
private
static
Pattern
numericPattern
=
Pattern
.
compile
(
"-?[0-9]+\\.?[0-9]*"
);
/**
* 判断对象是否为空
*
* @param str
* @return
*/
public
static
boolean
isNotEmpty
(
Object
str
)
{
boolean
flag
=
true
;
if
(
str
!=
null
&&
!
str
.
equals
(
""
))
{
if
(
str
.
toString
().
length
()
>
0
)
{
flag
=
true
;
}
}
else
{
flag
=
false
;
}
return
flag
;
}
/***************************************************************************
* repeat - 通过源字符串重复生成N次组成新的字符串。
*
* @param src
* - 源字符串 例如: 空格(" "), 星号("*"), "浙江" 等等...
* @param num
* - 重复生成次数
* @return 返回已生成的重复字符串
* @version 1.0 (2006.10.10) Wilson Lin
**************************************************************************/
public
static
String
repeat
(
String
src
,
int
num
)
{
StringBuffer
s
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
num
;
i
++)
s
.
append
(
src
);
return
s
.
toString
();
}
/**
* 判断是否数字表示
* 源字符串
*
* @return 是否数字的标志
*/
public
static
boolean
isNumeric
(
String
str
)
{
// 该正则表达式可以匹配所有的数字 包括负数
String
bigStr
;
try
{
bigStr
=
new
BigDecimal
(
str
).
toString
();
}
catch
(
Exception
e
)
{
return
false
;
// 异常 说明包含非数字。
}
Matcher
isNum
=
numericPattern
.
matcher
(
bigStr
);
// matcher是全匹配
if
(!
isNum
.
matches
())
{
return
false
;
}
return
true
;
}
public
static
int
toInt
(
String
s
)
{
if
(
s
!=
null
&&
!
""
.
equals
(
s
.
trim
()))
{
try
{
return
Integer
.
parseInt
(
s
);
}
catch
(
Exception
e
)
{
return
0
;
}
}
return
0
;
}
/**
* 截取前后都不是0的数字字符串
* <p>
* 12010102 => 12010102 12010100 => 120101 ab1201100b => 12011
*
* @param str
* @return
*/
public
static
String
delEndZero
(
String
str
)
{
Matcher
mat
=
NOT_ZERO_AT_THE_END
.
matcher
(
str
);
boolean
rs
=
mat
.
find
();
if
(
rs
)
{
return
mat
.
group
(
0
);
}
return
null
;
}
/**
* <pre>
* 移除字符串后面的0
* </pre>
*
* @param s
* @return
*/
public
static
String
removeSufixZero
(
String
s
)
{
if
(
s
==
null
)
{
return
""
;
}
while
(
s
.
endsWith
(
"0"
))
{
if
(
s
.
equals
(
"0"
))
{
s
=
""
;
break
;
}
s
=
s
.
substring
(
0
,
s
.
length
()
-
1
);
}
return
s
;
}
public
static
String
transforCode
(
String
code
)
{
if
(
code
.
endsWith
(
"0000000"
))
{
code
=
code
.
substring
(
0
,
1
);
}
else
if
(
code
.
endsWith
(
"000000"
))
{
code
=
code
.
substring
(
0
,
2
);
}
else
if
(
code
.
endsWith
(
"0000"
))
{
code
=
code
.
substring
(
0
,
4
);
}
else
if
(
code
.
endsWith
(
"00"
))
{
code
=
code
.
substring
(
0
,
6
);
}
return
code
;
}
/**
* 获取支队orgCode
*
* @param orgCode
* @return
*/
public
static
String
getDetachmentOrgCode
(
String
orgCode
)
{
Assert
.
notNull
(
orgCode
,
"组织结构orgCode不能为空!"
);
String
[]
codes
=
orgCode
.
split
(
"\\*"
);
if
(
codes
.
length
<
2
)
{
throw
new
IllegalArgumentException
(
"组织结构orgCode为总队,不能获取支队orgCode!"
);
}
else
{
return
codes
[
0
]
+
"*"
+
codes
[
1
];
}
}
public
static
String
setStr
(
String
str1
,
String
str2
)
{
String
str
=
str1
+
JOINT
+
str2
;
return
str
;
}
/**
* List去重
*
* @param list
* @return
*/
public
static
List
getNewList
(
List
<
String
>
list
)
{
Set
set
=
new
HashSet
();
List
newList
=
new
ArrayList
();
for
(
String
cd
:
list
)
{
if
(!
ObjectUtils
.
isEmpty
(
cd
)
&&
set
.
add
(
cd
))
{
newList
.
add
(
cd
);
}
}
return
newList
;
}
}
AmosBankPatrolStart/src/main/resources/db/mapper/dbTemplate_check.xml
View file @
e2d755af
...
...
@@ -173,6 +173,7 @@
ci.id checkInputId,
ci.input_id inputId,
ci.input_value AS InputValue,
pc.order_no orderNo,
(
CASE ci.is_ok
WHEN 1 THEN
...
...
@@ -185,8 +186,8 @@
) AS IsOK,
ii.`name` AS inputItemName,
ii.item_type as itemType,
c.id checkId,
c.upload_time AS UploadTime,
u.`name` AS RealName,
ci.score AS Score,
ci.point_classify_id classifyId,
ci.point_classify_name classifyName,
...
...
@@ -205,21 +206,23 @@
p_check_input ci
LEFT JOIN p_input_item ii ON ci.input_id = ii.id
LEFT JOIN p_check c ON ci.check_id = c.id
LEFT JOIN s_user u ON c.user_id = u.id
LEFT JOIN p_point p ON c.point_id = p.id
LEFT JOIN p_plan_task_detail ptd ON c.plan_task_detail_id = ptd.id
LEFT JOIN p_plan_task pt ON pt.id = ptd.task_no
LEFT JOIN p_point_classify pc on pc.id = ci.point_classify_id
<trim
prefix=
"WHERE"
prefixOverrides=
"AND "
>
<if
test=
"beginDate!=null and endDate!=null"
>
and c.check_time BETWEEN #{beginDate} and #{endDate}
</if>
<if
test=
"orgCode!=null"
>
and c.org_Code like concat(#{orgCode},"%")
</if>
<if
test=
"departmentId!=null"
>
and c.dep_id = #{departmentId}
</if>
</trim>
GROUP BY inputId, classifyId, beginTime
GROUP BY inputId, classifyId, beginTime
, checkInputId
ORDER BY
beginTime is null,
beginTime ASC,
pointId ASC,
classifyId ASC
planTaskId ASC,
checkDate ASC,
orderNo ASC
</when>
<otherwise>
select
...
...
@@ -234,10 +237,11 @@
c.upload_time AS UploadTime,
pt.id planTaskId,
pt.begin_time beginTime,
GROUP_CONCAT(DISTINCT pt.begin_time, '_', ci.is_ok) as idStateStr,
GROUP_CONCAT(DISTINCT pt.begin_time, '_',
IFNULL(ci.input_value,''), '_',
ci.is_ok) as idStateStr,
ci.id checkInputId,
ci.input_id inputId,
ci.input_value AS InputValue,
pc.order_no orderNo,
(
CASE ci.is_ok
WHEN 1 THEN
...
...
@@ -259,6 +263,7 @@
LEFT JOIN p_check_input ci ON c.id = ci.check_id
LEFT JOIN p_input_item ii ON ci.input_id = ii.id
LEFT JOIN p_plan_task pt ON pt.id = ptd.task_no
LEFT JOIN p_point_classify pc on pc.id = ci.point_classify_id
<trim
prefix=
"WHERE"
prefixOverrides=
"AND "
>
<if
test=
"beginDate!=null and endDate!=null"
>
and c.check_time BETWEEN #{beginDate} and #{endDate}
</if>
<if
test=
"orgCode!=null"
>
and c.org_Code like concat(#{orgCode},"%")
</if>
...
...
@@ -266,7 +271,7 @@
and (pt.id is NOT NULL or pt.id = '')
</trim>
group by pointId, inputId, classifyId
order BY pointId, classifyId
order BY pointId,
orderNo ASC,
classifyId
</otherwise>
</choose>
</select>
...
...
@@ -981,7 +986,7 @@
'漏检'
END
) AS IsOK,
ii.`name` AS
NAME
,
ii.`name` AS
inputItemName
,
c.upload_time AS UploadTime,
u.`name` AS RealName,
ci.score AS Score,
...
...
@@ -1912,8 +1917,8 @@
LEFT JOIN p_route r ON r.id = pnt.route_id
LEFT JOIN p_check c ON c.plan_task_detail_id = ptd.id
WHERE pnt.org_code LIKE CONCAT(#{orgCode}, '%')
<if
test=
"startTime !=null and startTime!= '' "
>
<![CDATA[ AND pnt.
check_dat
e >= #{startTime} ]]>
</if>
<if
test=
"endTime !=null and endTime!='' "
>
<![CDATA[AND pnt.
check_dat
e <= #{endTime} ]]>
</if>
<if
test=
"startTime !=null and startTime!= '' "
>
<![CDATA[ AND pnt.
begin_tim
e >= #{startTime} ]]>
</if>
<if
test=
"endTime !=null and endTime!='' "
>
<![CDATA[AND pnt.
begin_tim
e <= #{endTime} ]]>
</if>
GROUP BY ptd.id
) a
GROUP BY
...
...
@@ -1992,8 +1997,8 @@
</when>
</choose>
<if
test=
"isOk !=null and isOk != '' "
>
and c.isOk = #{isOk}
</if>
<if
test=
"startTime !=null and startTime!= '' "
>
<![CDATA[ AND pnt.
check_dat
e >= #{startTime} ]]>
</if>
<if
test=
"endTime !=null and endTime!='' "
>
<![CDATA[AND pnt.
check_dat
e <= #{endTime} ]]>
</if>
<if
test=
"startTime !=null and startTime!= '' "
>
<![CDATA[ AND pnt.
begin_tim
e >= #{startTime} ]]>
</if>
<if
test=
"endTime !=null and endTime!='' "
>
<![CDATA[AND pnt.
begin_tim
e <= #{endTime} ]]>
</if>
GROUP BY
pnt.id
) a
...
...
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