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
503e0207
Commit
503e0207
authored
Jul 23, 2025
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化-反馈文件下载单个下载-fxj
parent
76eea8a7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
10 deletions
+76
-10
TDispatchInfoController.java
...us/v1/yifu/social/controller/TDispatchInfoController.java
+12
-0
TDispatchInfoService.java
...oud/plus/v1/yifu/social/service/TDispatchInfoService.java
+2
-0
TDispatchInfoServiceImpl.java
...v1/yifu/social/service/impl/TDispatchInfoServiceImpl.java
+62
-10
No files found.
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/controller/TDispatchInfoController.java
View file @
503e0207
...
...
@@ -959,5 +959,17 @@ public class TDispatchInfoController {
@RequestBody
SocialHandleSearchVo
searchVo
)
{
tDispatchInfoService
.
doExportSocialSoldierAllBackFile
(
response
,
searchVo
,
searchVo
.
getIdStr
());
}
/**
* @Author fxj
* @Description
* @Date 15:20 2025/7/15
**/
@PostMapping
(
"/doExportSocialSoldierBackFileById"
)
@Operation
(
description
=
"自动化办理查询导出反馈文件单个"
)
@SysLog
(
"自动化办理查询导出反馈文件单个"
)
public
String
doExportSocialSoldierBackFileById
(
HttpServletResponse
response
,
HttpServletRequest
request
,
@RequestBody
SocialHandleSearchVo
searchVo
)
{
return
tDispatchInfoService
.
doExportSocialSoldierBackFileById
(
searchVo
.
getIdStr
());
}
}
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/TDispatchInfoService.java
View file @
503e0207
...
...
@@ -189,4 +189,6 @@ public interface TDispatchInfoService extends IService<TDispatchInfo> {
R
<
URL
>
doExportRoster
(
String
socialId
,
String
type
,
String
unitCreditCode
);
void
doExportSocialSoldierAllBackFile
(
HttpServletResponse
response
,
SocialHandleSearchVo
searchVo
,
String
idStr
);
String
doExportSocialSoldierBackFileById
(
String
idStr
);
}
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TDispatchInfoServiceImpl.java
View file @
503e0207
...
...
@@ -38,6 +38,7 @@ 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.google.common.collect.Lists
;
import
com.google.gson.JsonObject
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.AllUserNaVo
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo
;
...
...
@@ -8419,7 +8420,16 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
list
.
clear
();
}
}
// 自定义错误响应方法
public
void
sendErrorResponse
(
HttpServletResponse
response
,
String
msg
)
throws
IOException
{
response
.
setContentType
(
"application/json;charset=UTF-8"
);
JsonObject
json
=
new
JsonObject
();
json
.
addProperty
(
"success"
,
false
);
json
.
addProperty
(
"message"
,
msg
);
PrintWriter
out
=
response
.
getWriter
();
out
.
print
(
json
.
toString
());
out
.
flush
();
}
/**
* @Author fxj
* @Description 下载自动化办理反馈文件 目前只有办理成功 增员 的有反馈照片,减员或办理失败的增员没有反馈照片
...
...
@@ -8428,7 +8438,10 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
@Override
public
void
doExportSocialSoldierAllBackFile
(
HttpServletResponse
response
,
SocialHandleSearchVo
searchVo
,
String
idStr
)
{
try
{
List
<
SocialSoldierBackVo
>
list
=
baseMapper
.
getSocialSoldierAllListBackFile
(
searchVo
,
Common
.
getList
(
idStr
));
List
<
SocialSoldierBackVo
>
list
=
null
;
if
(!
Common
.
isEmpty
(
idStr
))
{
list
=
baseMapper
.
getSocialSoldierAllListBackFile
(
searchVo
,
Common
.
getList
(
idStr
));
}
// 收集所有需要下载的 URL
Map
<
String
,
List
<
String
>>
urlMap
=
new
HashMap
<>();
Map
<
String
,
SocialSoldierBackVo
>
socialMap
=
new
HashMap
<>();
...
...
@@ -8455,12 +8468,23 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
// 通过requestIdMap 获取反馈的URL 因为对方是异步请求
if
(
CollectionUtils
.
isNotEmpty
(
requestIdMap
))
{
// 循环 requestIdMap
List
<
String
>
urls
;
for
(
Map
.
Entry
<
String
,
String
>
entry
:
requestIdMap
.
entrySet
()){
urlMap
.
put
(
entry
.
getKey
(),
socialFriendConfig
.
getDownloadFeedbackUrls
(
restTemplate
,
entry
.
getValue
()));
urls
=
socialFriendConfig
.
getDownloadFeedbackUrls
(
restTemplate
,
entry
.
getValue
());
if
(!
CollectionUtils
.
isEmpty
(
urls
)){
urlMap
.
put
(
entry
.
getKey
(),
urls
);
}
}
}
if
(
CollectionUtils
.
isEmpty
(
urlMap
)){
sendErrorResponse
(
response
,
"无附件可下载"
);
return
;
}
// 更新反馈文件状态
updateBackFileFlage
(
socialMap
,
urlMap
);
}
else
{
sendErrorResponse
(
response
,
"无附件可下载"
);
return
;
}
// 设置响应头
response
.
setContentType
(
"application/octet-stream"
);
...
...
@@ -8537,13 +8561,6 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
}
}
private
void
sendJsonError
(
HttpServletResponse
response
,
String
message
,
String
errorCode
)
throws
IOException
{
response
.
setCharacterEncoding
(
"UTF-8"
);
PrintWriter
writer
=
response
.
getWriter
();
writer
.
println
(
"{\"success\": false, \"code\": \""
+
errorCode
+
"\", \"msg\": \""
+
message
+
"\"}"
);
writer
.
flush
();
}
/**
* 生成文件名:自定义名称 + 原始扩展名
*/
...
...
@@ -8571,4 +8588,39 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
return
customName
;
}
@Override
public
String
doExportSocialSoldierBackFileById
(
String
idStr
)
{
List
<
SocialSoldierBackVo
>
list
=
null
;
if
(
Common
.
isEmpty
(
idStr
))
{
list
=
baseMapper
.
getSocialSoldierAllListBackFile
(
null
,
Common
.
getList
(
idStr
));
}
// 收集所有需要下载的 URL
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
// 获取社保户信息
List
<
SysHouseHoldInfo
>
zhangList
=
houseHoldInfoMapper
.
getHouseInfoAutoDoc
();
Map
<
String
,
SysHouseHoldInfo
>
holdInfoMap
=
zhangList
.
stream
()
.
collect
(
Collectors
.
toMap
(
SysHouseHoldInfo:
:
getName
,
info
->
info
,
(
existing
,
replacement
)
->
existing
));
HashMap
<
String
,
String
>
requestIdMap
=
new
HashMap
<>();
// 获取URL前先获取下载反馈的requestId
for
(
SocialSoldierBackVo
item
:
list
)
{
String
householdName
=
item
.
getSocialHouseholdName
();
if
(
StringUtils
.
isNotBlank
(
householdName
))
{
SysHouseHoldInfo
holdInfo
=
holdInfoMap
.
get
(
householdName
);
if
(
holdInfo
!=
null
)
{
requestIdMap
.
putAll
(
socialFriendConfig
.
getDownloadEmployeeAsync
(
restTemplate
,
holdInfo
,
item
));
}
}
}
// 通过requestId 获取反馈的URL 因为对方是异步请求
List
<
String
>
urls
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
requestIdMap
))
{
urls
=
socialFriendConfig
.
getDownloadFeedbackUrls
(
restTemplate
,
requestIdMap
.
get
(
list
.
get
(
0
).
getSocialId
()));
}
if
(
Common
.
isNotNull
(
urls
)){
return
urls
.
get
(
0
);
}
}
return
null
;
}
}
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