Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bill-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
bill-platform
Commits
5c9cd9bc
Commit
5c9cd9bc
authored
Jun 24, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加排号与评价统计报表
parent
7422e1ac
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
187 additions
and
10 deletions
+187
-10
bill-manager/src/main/java/com/mortals/xhx/module/pj/service/impl/PjEvaluateStatServiceImpl.java
...xhx/module/pj/service/impl/PjEvaluateStatServiceImpl.java
+94
-0
bill-manager/src/main/java/com/mortals/xhx/module/pj/web/PjEvaluateStatController.java
...m/mortals/xhx/module/pj/web/PjEvaluateStatController.java
+93
-10
No files found.
bill-manager/src/main/java/com/mortals/xhx/module/pj/service/impl/PjEvaluateStatServiceImpl.java
View file @
5c9cd9bc
...
@@ -60,12 +60,18 @@ public class PjEvaluateStatServiceImpl extends AbstractCRUDServiceImpl<PjEvaluat
...
@@ -60,12 +60,18 @@ public class PjEvaluateStatServiceImpl extends AbstractCRUDServiceImpl<PjEvaluat
updateSiteSectionNamePjCount
(
currentDate
,
entity
,
pjEvaluateEntities
);
updateSiteSectionNamePjCount
(
currentDate
,
entity
,
pjEvaluateEntities
);
updateSiteHallPjCount
(
currentDate
,
entity
,
pjEvaluateEntities
);
updateSiteWindowPjCount
(
currentDate
,
entity
,
pjEvaluateEntities
);
updateSiteWindowPjCount
(
currentDate
,
entity
,
pjEvaluateEntities
);
updateSiteOptionPjCount
(
currentDate
,
entity
,
pjEvaluateEntities
);
return
Rest
.
ok
();
return
Rest
.
ok
();
}
}
private
void
updateSitePjCount
(
PjEvaluateStatEntity
entity
,
List
<
PjEvaluateEntity
>
pjEvaluateEntities
)
{
private
void
updateSitePjCount
(
PjEvaluateStatEntity
entity
,
List
<
PjEvaluateEntity
>
pjEvaluateEntities
)
{
if
(
ObjectUtils
.
isEmpty
(
entity
.
getSiteId
()))
return
;
if
(
0L
>=
entity
.
getSiteId
())
return
;
PjEvaluateStatEntity
pjEvaluateStatEntity
=
this
.
selectOne
(
new
PjEvaluateStatQuery
()
PjEvaluateStatEntity
pjEvaluateStatEntity
=
this
.
selectOne
(
new
PjEvaluateStatQuery
()
.
siteId
(
entity
.
getSiteId
())
.
siteId
(
entity
.
getSiteId
())
.
year
(
entity
.
getYear
())
.
year
(
entity
.
getYear
())
...
@@ -102,6 +108,7 @@ public class PjEvaluateStatServiceImpl extends AbstractCRUDServiceImpl<PjEvaluat
...
@@ -102,6 +108,7 @@ public class PjEvaluateStatServiceImpl extends AbstractCRUDServiceImpl<PjEvaluat
Map
<
String
,
Long
>
collect
=
pjEvaluateEntities
.
stream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getSectionName
(),
Collectors
.
counting
()));
Map
<
String
,
Long
>
collect
=
pjEvaluateEntities
.
stream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getSectionName
(),
Collectors
.
counting
()));
collect
.
entrySet
().
stream
().
forEach
(
item
->
{
collect
.
entrySet
().
stream
().
forEach
(
item
->
{
String
sectionName
=
item
.
getKey
();
String
sectionName
=
item
.
getKey
();
if
(
ObjectUtils
.
isEmpty
(
sectionName
))
return
;
Long
value
=
item
.
getValue
();
Long
value
=
item
.
getValue
();
log
.
info
(
"更新站点评价统计数据,站点名称:{},日期:{},部门:{},评价数量:{}"
,
entity
.
getSiteName
(),
currentDate
,
entity
.
getSectionName
(),
pjEvaluateEntities
.
size
());
log
.
info
(
"更新站点评价统计数据,站点名称:{},日期:{},部门:{},评价数量:{}"
,
entity
.
getSiteName
(),
currentDate
,
entity
.
getSectionName
(),
pjEvaluateEntities
.
size
());
PjEvaluateStatEntity
pjEvaluateStatEntity
=
this
.
selectOne
(
new
PjEvaluateStatQuery
()
PjEvaluateStatEntity
pjEvaluateStatEntity
=
this
.
selectOne
(
new
PjEvaluateStatQuery
()
...
@@ -138,11 +145,56 @@ public class PjEvaluateStatServiceImpl extends AbstractCRUDServiceImpl<PjEvaluat
...
@@ -138,11 +145,56 @@ public class PjEvaluateStatServiceImpl extends AbstractCRUDServiceImpl<PjEvaluat
}
}
private
void
updateSiteHallPjCount
(
String
currentDate
,
PjEvaluateStatEntity
entity
,
List
<
PjEvaluateEntity
>
pjEvaluateEntities
)
{
Map
<
String
,
Long
>
collect
=
pjEvaluateEntities
.
stream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getHallName
(),
Collectors
.
counting
()));
collect
.
entrySet
().
stream
().
forEach
(
item
->
{
String
hallName
=
item
.
getKey
();
if
(
ObjectUtils
.
isEmpty
(
hallName
))
return
;
Long
value
=
item
.
getValue
();
log
.
info
(
"更新站点评价统计数据,站点名称:{},日期:{},部门:{},评价数量:{}"
,
entity
.
getSiteName
(),
currentDate
,
entity
.
getSectionName
(),
pjEvaluateEntities
.
size
());
PjEvaluateStatEntity
pjEvaluateStatEntity
=
this
.
selectOne
(
new
PjEvaluateStatQuery
()
.
siteId
(
entity
.
getSiteId
())
.
hallName
(
hallName
)
.
year
(
entity
.
getYear
())
.
month
(
entity
.
getMonth
())
.
day
(
entity
.
getDay
()));
if
(
ObjectUtils
.
isEmpty
(
pjEvaluateStatEntity
))
{
//统计当前站点新增所有评价数量
pjEvaluateStatEntity
=
new
PjEvaluateStatEntity
();
pjEvaluateStatEntity
.
initAttrValue
();
pjEvaluateStatEntity
.
setSiteId
(
entity
.
getSiteId
());
pjEvaluateStatEntity
.
setSiteCode
(
entity
.
getSiteCode
());
pjEvaluateStatEntity
.
setSiteName
(
entity
.
getSiteName
());
pjEvaluateStatEntity
.
setHallName
(
hallName
);
pjEvaluateStatEntity
.
setPjCount
(
value
.
intValue
());
pjEvaluateStatEntity
.
setYear
(
entity
.
getYear
());
pjEvaluateStatEntity
.
setMonth
(
entity
.
getMonth
());
pjEvaluateStatEntity
.
setDay
(
entity
.
getDay
());
pjEvaluateStatEntity
.
setCreateTime
(
new
Date
());
pjEvaluateStatEntity
.
setCreateUserId
(
1L
);
this
.
save
(
pjEvaluateStatEntity
);
}
else
{
pjEvaluateStatEntity
.
setPjCount
(
value
.
intValue
());
pjEvaluateStatEntity
.
setYear
(
entity
.
getYear
());
pjEvaluateStatEntity
.
setMonth
(
entity
.
getMonth
());
pjEvaluateStatEntity
.
setDay
(
entity
.
getDay
());
pjEvaluateStatEntity
.
setUpdateTime
(
new
Date
());
pjEvaluateStatEntity
.
setUpdateUserId
(
1L
);
this
.
update
(
pjEvaluateStatEntity
);
}
});
}
private
void
updateSiteWindowPjCount
(
String
currentDate
,
PjEvaluateStatEntity
entity
,
List
<
PjEvaluateEntity
>
pjEvaluateEntities
)
{
private
void
updateSiteWindowPjCount
(
String
currentDate
,
PjEvaluateStatEntity
entity
,
List
<
PjEvaluateEntity
>
pjEvaluateEntities
)
{
Map
<
String
,
Long
>
collect
=
pjEvaluateEntities
.
stream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getWindowFromnum
(),
Collectors
.
counting
()));
Map
<
String
,
Long
>
collect
=
pjEvaluateEntities
.
stream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getWindowFromnum
(),
Collectors
.
counting
()));
collect
.
entrySet
().
stream
().
forEach
(
item
->
{
collect
.
entrySet
().
stream
().
forEach
(
item
->
{
String
windowFromnum
=
item
.
getKey
();
String
windowFromnum
=
item
.
getKey
();
if
(
ObjectUtils
.
isEmpty
(
windowFromnum
))
return
;
Long
value
=
item
.
getValue
();
Long
value
=
item
.
getValue
();
log
.
info
(
"更新站点评价统计数据,站点名称:{},日期:{},窗口:{},评价数量:{}"
,
entity
.
getSiteName
(),
currentDate
,
entity
.
getWindowFromnum
(),
pjEvaluateEntities
.
size
());
log
.
info
(
"更新站点评价统计数据,站点名称:{},日期:{},窗口:{},评价数量:{}"
,
entity
.
getSiteName
(),
currentDate
,
entity
.
getWindowFromnum
(),
pjEvaluateEntities
.
size
());
PjEvaluateStatEntity
pjEvaluateStatEntity
=
this
.
selectOne
(
new
PjEvaluateStatQuery
()
PjEvaluateStatEntity
pjEvaluateStatEntity
=
this
.
selectOne
(
new
PjEvaluateStatQuery
()
...
@@ -177,4 +229,46 @@ public class PjEvaluateStatServiceImpl extends AbstractCRUDServiceImpl<PjEvaluat
...
@@ -177,4 +229,46 @@ public class PjEvaluateStatServiceImpl extends AbstractCRUDServiceImpl<PjEvaluat
}
}
});
});
}
}
private
void
updateSiteOptionPjCount
(
String
currentDate
,
PjEvaluateStatEntity
entity
,
List
<
PjEvaluateEntity
>
pjEvaluateEntities
)
{
Map
<
String
,
Long
>
collect
=
pjEvaluateEntities
.
stream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getPjOption
(),
Collectors
.
counting
()));
collect
.
entrySet
().
stream
().
forEach
(
item
->
{
String
pjOption
=
item
.
getKey
();
if
(
ObjectUtils
.
isEmpty
(
pjOption
))
return
;
Long
value
=
item
.
getValue
();
log
.
info
(
"更新站点评价统计数据,站点名称:{},日期:{},窗口:{},评价数量:{}"
,
entity
.
getSiteName
(),
currentDate
,
entity
.
getWindowFromnum
(),
pjEvaluateEntities
.
size
());
PjEvaluateStatEntity
pjEvaluateStatEntity
=
this
.
selectOne
(
new
PjEvaluateStatQuery
()
.
siteId
(
entity
.
getSiteId
())
.
pjOption
(
pjOption
)
.
year
(
entity
.
getYear
())
.
month
(
entity
.
getMonth
())
.
day
(
entity
.
getDay
()));
if
(
ObjectUtils
.
isEmpty
(
pjEvaluateStatEntity
))
{
//统计当前站点新增所有评价数量
pjEvaluateStatEntity
=
new
PjEvaluateStatEntity
();
pjEvaluateStatEntity
.
initAttrValue
();
pjEvaluateStatEntity
.
setSiteId
(
entity
.
getSiteId
());
pjEvaluateStatEntity
.
setSiteCode
(
entity
.
getSiteCode
());
pjEvaluateStatEntity
.
setSiteName
(
entity
.
getSiteName
());
pjEvaluateStatEntity
.
setPjOption
(
pjOption
);
pjEvaluateStatEntity
.
setPjCount
(
value
.
intValue
());
pjEvaluateStatEntity
.
setYear
(
entity
.
getYear
());
pjEvaluateStatEntity
.
setMonth
(
entity
.
getMonth
());
pjEvaluateStatEntity
.
setDay
(
entity
.
getDay
());
pjEvaluateStatEntity
.
setCreateTime
(
new
Date
());
pjEvaluateStatEntity
.
setCreateUserId
(
1L
);
this
.
save
(
pjEvaluateStatEntity
);
}
else
{
pjEvaluateStatEntity
.
setPjCount
(
value
.
intValue
());
pjEvaluateStatEntity
.
setYear
(
entity
.
getYear
());
pjEvaluateStatEntity
.
setMonth
(
entity
.
getMonth
());
pjEvaluateStatEntity
.
setDay
(
entity
.
getDay
());
pjEvaluateStatEntity
.
setUpdateTime
(
new
Date
());
pjEvaluateStatEntity
.
setUpdateUserId
(
1L
);
this
.
update
(
pjEvaluateStatEntity
);
}
});
}
}
}
\ No newline at end of file
bill-manager/src/main/java/com/mortals/xhx/module/pj/web/PjEvaluateStatController.java
View file @
5c9cd9bc
package
com.mortals.xhx.module.pj.web
;
package
com.mortals.xhx.module.pj.web
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUnit
;
import
cn.hutool.core.date.DateUtil
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.common.pdu.RespData
;
import
com.mortals.xhx.common.pdu.site.SitePdu
;
import
com.mortals.xhx.feign.site.ISiteFeign
;
import
com.mortals.xhx.module.pj.model.PjEvaluateEntity
;
import
com.mortals.xhx.module.pj.model.PjEvaluateQuery
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.StopWatch
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.Context
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.module.pj.model.PjEvaluateStatEntity
;
import
com.mortals.xhx.module.pj.model.PjEvaluateStatEntity
;
import
com.mortals.xhx.module.pj.service.PjEvaluateStatService
;
import
com.mortals.xhx.module.pj.service.PjEvaluateStatService
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.commons.lang3.ArrayUtils
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.framework.util.StringUtils
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
static
com
.
mortals
.
framework
.
ap
.
SysConstains
.*;
import
static
com
.
mortals
.
framework
.
ap
.
SysConstains
.*;
import
com.mortals.xhx.common.code.*
;
import
com.mortals.xhx.common.code.*
;
/**
/**
*
* 评价汇总统计
* 评价汇总统计
*
*
* @author zxfei
* @author zxfei
* @date 2024-06-24
* @date 2024-06-24
*/
*/
@RestController
@RestController
@RequestMapping
(
"pj/evaluate/stat"
)
@RequestMapping
(
"pj/evaluate/stat"
)
public
class
PjEvaluateStatController
extends
BaseCRUDJsonBodyMappingController
<
PjEvaluateStatService
,
PjEvaluateStatEntity
,
Long
>
{
@Slf4j
public
class
PjEvaluateStatController
extends
BaseCRUDJsonBodyMappingController
<
PjEvaluateStatService
,
PjEvaluateStatEntity
,
Long
>
{
@Autowired
@Autowired
private
ParamService
paramService
;
private
ParamService
paramService
;
public
PjEvaluateStatController
(){
@Autowired
super
.
setModuleDesc
(
"评价汇总统计"
);
private
ISiteFeign
siteFeign
;
public
PjEvaluateStatController
()
{
super
.
setModuleDesc
(
"评价汇总统计"
);
}
}
@Override
@Override
...
@@ -48,4 +73,62 @@ public class PjEvaluateStatController extends BaseCRUDJsonBodyMappingController<
...
@@ -48,4 +73,62 @@ public class PjEvaluateStatController extends BaseCRUDJsonBodyMappingController<
}
}
@PostMapping
(
value
=
"/pjstat"
)
@UnAuth
public
Rest
<
String
>
addAttendanceRecordCustom
(
@RequestBody
PjEvaluateQuery
pjEvaluateQuery
)
{
Rest
<
String
>
ret
=
new
Rest
();
Map
<
String
,
Object
>
model
=
new
HashMap
();
Context
context
=
this
.
getContext
();
String
busiDesc
=
"查询"
+
this
.
getModuleDesc
();
int
code
=
1
;
try
{
//天数区间分段计算
DateTime
attendStart
=
DateUtil
.
parseDate
(
pjEvaluateQuery
.
getPjTimeStart
());
DateTime
attendEnd
=
DateUtil
.
parseDate
(
pjEvaluateQuery
.
getPjTimeEnd
());
Long
compare
=
DateUtil
.
between
(
attendEnd
,
attendStart
,
DateUnit
.
DAY
);
StopWatch
stopWatch
=
new
StopWatch
(
"stopwatch"
);
log
.
info
(
"计算天数区间:{}"
,
compare
);
for
(
int
i
=
0
;
i
<=
compare
.
intValue
();
i
++)
{
DateTime
curDate
=
DateUtil
.
offsetDay
(
attendStart
,
i
);
log
.
info
(
"记录日期:{}"
,
curDate
.
toDateStr
());
stopWatch
.
start
(
"执行本地方法"
);
SitePdu
sitePdu
=
new
SitePdu
();
sitePdu
.
setSize
(-
1
);
Rest
<
RespData
<
List
<
SitePdu
>>>
resp
=
siteFeign
.
list
(
sitePdu
);
if
(
resp
.
getCode
()
==
1
)
{
List
<
SitePdu
>
sitePduList
=
resp
.
getData
().
getData
();
sitePduList
.
stream
().
forEach
(
site
->
{
PjEvaluateStatEntity
sitestatEntity
=
new
PjEvaluateStatEntity
();
sitestatEntity
.
initAttrValue
();
sitestatEntity
.
setSiteId
(
site
.
getId
());
sitestatEntity
.
setSiteName
(
site
.
getSiteName
());
sitestatEntity
.
setSiteCode
(
site
.
getSiteCode
());
sitestatEntity
.
setYear
(
curDate
.
year
());
sitestatEntity
.
setMonth
(
curDate
.
month
()
+
1
);
sitestatEntity
.
setDay
(
curDate
.
dayOfMonth
());
//设置年月日
this
.
service
.
updateSitePjStat
(
sitestatEntity
,
context
);
});
}
stopWatch
.
stop
();
log
.
info
(
"日期:{} 完成,耗时:{}ms"
,
curDate
.
toDateStr
(),
stopWatch
.
getLastTaskTimeMillis
());
}
model
.
put
(
"message_info"
,
busiDesc
+
"成功"
);
this
.
recordSysLog
(
this
.
request
,
busiDesc
+
" 【成功】"
);
}
catch
(
Exception
e
)
{
code
=
-
1
;
this
.
doException
(
this
.
request
,
busiDesc
,
model
,
e
);
model
.
put
(
"message_info"
,
e
.
getMessage
());
}
this
.
init
(
model
,
context
);
ret
.
setCode
(
code
);
ret
.
setMsg
(
model
.
get
(
"message_info"
)
==
null
?
""
:
model
.
remove
(
"message_info"
).
toString
());
return
ret
;
}
}
}
\ No newline at end of file
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