Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
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
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
fangxinjiang
yifu-mvp
Commits
a2443978
Commit
a2443978
authored
Sep 27, 2024
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
huych-风险管控提交
parent
54470a68
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
610 additions
and
218 deletions
+610
-218
TRiskMonitor.java
...yifu/cloud/plus/v1/yifu/archives/entity/TRiskMonitor.java
+6
-0
RiskMonitorPerVo.java
...yifu/cloud/plus/v1/yifu/archives/vo/RiskMonitorPerVo.java
+67
-0
TRiskMonitorSearchVo.java
.../cloud/plus/v1/yifu/archives/vo/TRiskMonitorSearchVo.java
+0
-7
TRiskMonitorVo.java
...m/yifu/cloud/plus/v1/yifu/archives/vo/TRiskMonitorVo.java
+128
-166
TRiskMonitorController.java
...s/v1/yifu/archives/controller/TRiskMonitorController.java
+24
-2
TRiskMonitorMapper.java
...loud/plus/v1/yifu/archives/mapper/TRiskMonitorMapper.java
+15
-1
TRiskMonitorService.java
...ud/plus/v1/yifu/archives/service/TRiskMonitorService.java
+14
-0
TRiskMonitorServiceImpl.java
...1/yifu/archives/service/impl/TRiskMonitorServiceImpl.java
+74
-22
TRiskMonitorMapper.xml
...ives-biz/src/main/resources/mapper/TRiskMonitorMapper.xml
+273
-20
ArchiveTask.java
.../java/com/yifu/cloud/plus/v1/job/compont/ArchiveTask.java
+9
-0
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/entity/TRiskMonitor.java
View file @
a2443978
...
...
@@ -33,6 +33,12 @@ public class TRiskMonitor extends BaseEntity {
@Schema
(
description
=
"主键"
)
private
String
id
;
/**
* 项目id
*/
@Schema
(
description
=
"项目id"
)
private
String
deptId
;
/**
* 结算主体名称
*/
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/RiskMonitorPerVo.java
0 → 100644
View file @
a2443978
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
vo
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* 风险管控比例
*
* @author huyc
* @date 2024-09-27 15:54:40
*/
@Data
@ColumnWidth
(
30
)
public
class
RiskMonitorPerVo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 总项目数
*/
@Schema
(
description
=
"总项目数"
)
private
String
deptNum
;
/**
* 存在风险项目数
*/
@Schema
(
description
=
"存在风险项目数"
)
private
String
riskDeptNum
;
/**
* 存在风险项目占比
*/
@Schema
(
description
=
"存在风险项目占比"
)
private
String
riskDeptPer
;
/**
* 商险漏买项目数
*/
@Schema
(
description
=
"商险漏买项目数"
)
private
String
riskInsuraceNum
;
/**
* 商险漏买项目占比
*/
@Schema
(
description
=
"商险漏买占比"
)
private
String
riskInsuracePer
;
}
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/TRiskMonitorSearchVo.java
View file @
a2443978
...
...
@@ -21,7 +21,6 @@ import io.swagger.v3.oas.annotations.media.Schema;
import
lombok.Data
;
import
java.time.LocalDateTime
;
import
java.util.List
;
/**
* 风险管控统计
...
...
@@ -32,12 +31,6 @@ import java.util.List;
@Data
public
class
TRiskMonitorSearchVo
extends
TRiskMonitor
{
/**
* 多选导出或删除等操作
*/
@Schema
(
description
=
"选中ID,id数组"
)
private
List
<
String
>
idList
;
/**
* 创建时间区间 [开始时间,结束时间]
*/
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/TRiskMonitorVo.java
View file @
a2443978
This diff is collapsed.
Click to expand it.
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TRiskMonitorController.java
View file @
a2443978
...
...
@@ -7,6 +7,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.service.TRiskMonitorService;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TRiskMonitorSearchVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
...
...
@@ -38,7 +39,6 @@ public class TRiskMonitorController {
*/
@Operation
(
summary
=
"通过id查询"
,
description
=
"通过id查询:hasPermission('archives_triskmonitor_get')"
)
@GetMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('archives_triskmonitor_get')"
)
public
R
<
TRiskMonitor
>
getById
(
@PathVariable
(
"id"
)
String
id
)
{
return
R
.
ok
(
tRiskMonitorService
.
getById
(
id
));
}
...
...
@@ -92,8 +92,30 @@ public class TRiskMonitorController {
**/
@Operation
(
description
=
"导出风险管控统计 hasPermission('archives_triskmonitor-export')"
)
@PostMapping
(
"/export"
)
@PreAuthorize
(
"@pms.hasPermission('archives_triskmonitor-export')"
)
public
void
export
(
HttpServletResponse
response
,
@RequestBody
TRiskMonitorSearchVo
searchVo
)
{
tRiskMonitorService
.
listExport
(
response
,
searchVo
);
}
/**
* 风险管控统计 批量生成
* @author huyc
* @date 2024-09-27 14:08:58
**/
@Operation
(
description
=
"生成风险管控统计"
)
@Inner
@PostMapping
(
"/inner/createRiskMonitor"
)
public
void
createRiskMonitor
()
throws
IllegalAccessException
{
tRiskMonitorService
.
createRiskMonitor
();
}
/**
* 查询风险占比
* @author huyc
* @date 2024-06-17 16:08:58
**/
@Operation
(
description
=
"查询风险占比"
)
@PostMapping
(
"/selectCurrentRiskMonitor"
)
public
R
selectCurrentRiskMonitor
(
@RequestBody
TRiskMonitorSearchVo
tRiskMonitor
)
{
return
tRiskMonitorService
.
selectCurrentRiskMonitor
(
tRiskMonitor
);
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/mapper/TRiskMonitorMapper.java
View file @
a2443978
...
...
@@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TRiskMonitor
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.RiskMonitorPerVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TRiskMonitorSearchVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TRiskMonitorVo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -37,5 +39,17 @@ public interface TRiskMonitorMapper extends BaseMapper<TRiskMonitor> {
* @param tRiskMonitor 风险管控统计
* @return
*/
List
<
TRiskMonitor
>
getRiskMonitorExportList
(
@Param
(
"tRiskMonitor"
)
TRiskMonitorSearchVo
tRiskMonitor
);
List
<
TRiskMonitorVo
>
getRiskMonitorExportList
(
@Param
(
"tRiskMonitor"
)
TRiskMonitorSearchVo
tRiskMonitor
);
/**
* 风险管控统计导出查询
* @return
*/
List
<
TRiskMonitor
>
selectRiskMonitorList
();
/**
* 查询风险占比
* @return
*/
RiskMonitorPerVo
getTRiskMonitorPer
(
@Param
(
"tRiskMonitor"
)
TRiskMonitorSearchVo
tRiskMonitor
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TRiskMonitorService.java
View file @
a2443978
...
...
@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TRiskMonitor
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TRiskMonitorSearchVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -46,4 +47,17 @@ public interface TRiskMonitorService extends IService<TRiskMonitor> {
*/
void
listExport
(
HttpServletResponse
response
,
TRiskMonitorSearchVo
searchVo
);
/**
* 生成管控统计
* @return
*/
void
createRiskMonitor
();
/**
* 查询风险占比
* @return
*/
R
selectCurrentRiskMonitor
(
TRiskMonitorSearchVo
tRiskMonitor
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TRiskMonitorServiceImpl.java
View file @
a2443978
...
...
@@ -4,22 +4,29 @@ import com.alibaba.excel.EasyExcel;
import
com.alibaba.excel.ExcelWriter
;
import
com.alibaba.excel.write.metadata.WriteSheet
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TRiskMonitor
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.TRiskMonitorMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TRiskMonitorService
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.RiskMonitorPerVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TRiskMonitorSearchVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TRiskMonitorVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ClientNameConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.util.MenuUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.stereotype.Service
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -32,7 +39,11 @@ import java.util.List;
*/
@Log4j2
@Service
@RequiredArgsConstructor
public
class
TRiskMonitorServiceImpl
extends
ServiceImpl
<
TRiskMonitorMapper
,
TRiskMonitor
>
implements
TRiskMonitorService
{
private
final
MenuUtil
menuUtil
;
/**
* 风险管控统计简单分页查询
*
...
...
@@ -41,29 +52,41 @@ public class TRiskMonitorServiceImpl extends ServiceImpl<TRiskMonitorMapper, TRi
*/
@Override
public
IPage
<
TRiskMonitor
>
getTRiskMonitorPage
(
Page
<
TRiskMonitor
>
page
,
TRiskMonitorSearchVo
tRiskMonitor
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
long
roleId
=
1839501715787390978L
;
boolean
isSsc
=
this
.
haveRole
(
user
,
roleId
);
if
(!
isSsc
)
{
menuUtil
.
setAuthSql
(
user
,
tRiskMonitor
);
}
return
baseMapper
.
getTRiskMonitorPage
(
page
,
tRiskMonitor
);
}
/**
* 风险管控统计批量导出
*
* @param searchVo 风险管控统计
* @return
*/
@Override
public
void
listExport
(
HttpServletResponse
response
,
TRiskMonitorSearchVo
searchVo
)
{
String
fileName
=
"风险管控统计批量导出"
+
DateUtil
.
getThisTime
()
+
".xlsx"
;
YifuUser
user
=
SecurityUtils
.
getUser
();
long
roleId
=
1839501715787390978L
;
boolean
isSsc
=
this
.
haveRole
(
user
,
roleId
);
if
(!
isSsc
)
{
menuUtil
.
setAuthSql
(
user
,
searchVo
);
}
String
fileName
=
"运营风险管控"
+
DateUtil
.
getThisTime
()
+
".xlsx"
;
//获取要导出的列表
List
<
TRiskMonitor
>
list
=
new
ArrayList
<>();
List
<
TRiskMonitorVo
>
list
=
new
ArrayList
<>();
//获取要导出的数量
long
count
=
baseMapper
.
getTRiskMonitorExportCount
(
searchVo
);
ServletOutputStream
out
=
null
;
try
{
out
=
response
.
getOutputStream
();
try
(
ServletOutputStream
out
=
response
.
getOutputStream
())
{
response
.
setContentType
(
CommonConstants
.
MULTIPART_FORM_DATA
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
CommonConstants
.
CONTENT_DISPOSITION
,
CommonConstants
.
ATTACHMENT_FILENAME
+
URLEncoder
.
encode
(
fileName
,
CommonConstants
.
UTF8
));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
out
,
TRiskMonitor
.
class
).
build
();
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
out
,
TRiskMonitor
Vo
.
class
).
build
();
int
index
=
0
;
if
(
count
>
CommonConstants
.
ZERO_INT
)
{
for
(
int
i
=
0
;
i
<=
count
;
i
+=
CommonConstants
.
EXCEL_EXPORT_LIMIT
)
{
...
...
@@ -71,12 +94,6 @@ public class TRiskMonitorServiceImpl extends ServiceImpl<TRiskMonitorMapper, TRi
searchVo
.
setLimitStart
(
i
);
searchVo
.
setLimitEnd
(
CommonConstants
.
EXCEL_EXPORT_LIMIT
);
list
=
baseMapper
.
getRiskMonitorExportList
(
searchVo
);
if
(
Common
.
isNotNull
(
list
))
{
ExcelUtil
<
TRiskMonitor
>
util
=
new
ExcelUtil
<>(
TRiskMonitor
.
class
);
for
(
TRiskMonitor
vo
:
list
)
{
util
.
convertEntity
(
vo
,
null
,
null
,
null
);
}
}
if
(
Common
.
isNotNull
(
list
))
{
WriteSheet
writeSheet
=
EasyExcel
.
writerSheet
(
"运营风险管控"
+
index
).
build
();
excelWriter
.
write
(
list
,
writeSheet
);
...
...
@@ -97,14 +114,49 @@ public class TRiskMonitorServiceImpl extends ServiceImpl<TRiskMonitorMapper, TRi
excelWriter
.
finish
();
}
catch
(
Exception
e
)
{
log
.
error
(
"执行异常"
,
e
);
}
finally
{
try
{
if
(
null
!=
out
)
{
out
.
close
();
}
}
catch
(
IOException
e
)
{
log
.
error
(
"执行异常"
,
e
);
}
}
/**
* 风险管控统计批量生成
* @return
*/
@Override
public
void
createRiskMonitor
()
{
//批量删除之前生成的管控统计
baseMapper
.
delete
(
Wrappers
.<
TRiskMonitor
>
query
().
lambda
()
.
eq
(
TRiskMonitor:
:
getDeleteFlag
,
CommonConstants
.
ONE_STRING
));
//批量生成统计数据
List
<
TRiskMonitor
>
list
=
baseMapper
.
selectRiskMonitorList
();
if
(!
list
.
isEmpty
())
{
this
.
saveBatch
(
list
);
}
}
/**
* 查询风险占比
* @return
*/
@Override
public
R
selectCurrentRiskMonitor
(
TRiskMonitorSearchVo
tRiskMonitor
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
long
roleId
=
1839501715787390978L
;
boolean
isSsc
=
this
.
haveRole
(
user
,
roleId
);
if
(!
isSsc
)
{
menuUtil
.
setAuthSql
(
user
,
tRiskMonitor
);
}
RiskMonitorPerVo
RiskMonitorPerVo
=
baseMapper
.
getTRiskMonitorPer
(
tRiskMonitor
);
return
R
.
ok
(
RiskMonitorPerVo
);
}
public
boolean
haveRole
(
YifuUser
user
,
long
roleId
)
{
List
<
Long
>
roleList
=
user
.
getClientRoleMap
().
get
(
ClientNameConstants
.
CLIENT_MVP
);
for
(
Long
role
:
roleList
)
{
if
(
role
==
roleId
)
{
return
true
;
}
}
return
false
;
}
}
yifu-archives/yifu-archives-biz/src/main/resources/mapper/TRiskMonitorMapper.xml
View file @
a2443978
This diff is collapsed.
Click to expand it.
yifu-job/yifu-job-api/src/main/java/com/yifu/cloud/plus/v1/job/compont/ArchiveTask.java
View file @
a2443978
...
...
@@ -84,4 +84,13 @@ public class ArchiveTask {
SecurityConstants
.
FROM_IN
);
log
.
info
(
"-------------每日刷新档案完整监控数据-定时任务开始------------"
);
}
public
void
everyDayCreateRiskMonitor
()
{
log
.
info
(
"-------------每日刷新运营风险管控数据------------"
);
HttpDaprUtil
.
invokeMethodPost
(
daprArchivesProperties
.
getAppUrl
(),
daprArchivesProperties
.
getAppId
(),
"/triskmonitor/inner/createRiskMonitor"
,
""
,
Object
.
class
,
SecurityConstants
.
FROM_IN
);
log
.
info
(
"-------------每日刷新运营风险管控数据-定时任务开始------------"
);
}
}
\ 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