Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
self-service
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
廖旭伟
self-service
Commits
c6fd724b
Commit
c6fd724b
authored
Dec 19, 2023
by
廖旭伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
综窗对接事项查询增加参数
parent
ab73da49
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
108 additions
and
28 deletions
+108
-28
sst-manager/src/main/java/com/mortals/xhx/module/sst/pdu/Material.java
...rc/main/java/com/mortals/xhx/module/sst/pdu/Material.java
+2
-0
sst-manager/src/main/java/com/mortals/xhx/module/sst/pdu/SyntheticalMatterQuery.java
...om/mortals/xhx/module/sst/pdu/SyntheticalMatterQuery.java
+20
-0
sst-manager/src/main/java/com/mortals/xhx/module/sst/web/SyntheticalController.java
...com/mortals/xhx/module/sst/web/SyntheticalController.java
+86
-28
No files found.
sst-manager/src/main/java/com/mortals/xhx/module/sst/pdu/Material.java
View file @
c6fd724b
...
@@ -12,4 +12,6 @@ public class Material {
...
@@ -12,4 +12,6 @@ public class Material {
private
String
uploadFileName
;
private
String
uploadFileName
;
/**材料内容base64 */
/**材料内容base64 */
private
String
materialContent
;
private
String
materialContent
;
/**材料文件地址 */
private
String
materialFilePath
;
}
}
sst-manager/src/main/java/com/mortals/xhx/module/sst/pdu/SyntheticalMatterQuery.java
0 → 100644
View file @
c6fd724b
package
com.mortals.xhx.module.sst.pdu
;
import
lombok.Data
;
/**
* 综窗可受理事项查询参数
*/
@Data
public
class
SyntheticalMatterQuery
{
/**当前页*/
private
Integer
currentPage
;
/**每页条数*/
private
Integer
pageSize
;
/**事项面向对象O/P,O是法人P是个人 */
private
String
eventObjectType
;
/** 事项是否纳入通办。N/Y */
private
String
crossFlag
;
/**事项名称,模糊查找 */
private
String
implementName
;
}
sst-manager/src/main/java/com/mortals/xhx/module/sst/web/SyntheticalController.java
View file @
c6fd724b
package
com.mortals.xhx.module.sst.web
;
package
com.mortals.xhx.module.sst.web
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.Method
;
import
cn.hutool.http.Method
;
...
@@ -8,17 +9,26 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -8,17 +9,26 @@ import com.alibaba.fastjson.JSONObject;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.ap.GlobalSysInfo
;
import
com.mortals.framework.ap.GlobalSysInfo
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.util.HttpUtil
;
import
com.mortals.framework.util.HttpUtil
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.framework.web.BaseJsonBodyController
;
import
com.mortals.framework.web.BaseJsonBodyController
;
import
com.mortals.xhx.module.sst.pdu.AcceptHandlingPdu
;
import
com.mortals.xhx.module.matter.service.UserMatterApplyService
;
import
com.mortals.xhx.module.sst.pdu.SyntheticalPdu
;
import
com.mortals.xhx.module.sst.pdu.*
;
import
com.mortals.xhx.module.sst.pdu.TerminalPdu
;
import
lombok.Getter
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
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
java.net.HttpCookie
;
import
java.net.HttpCookie
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.Base64
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -31,6 +41,13 @@ import static com.mortals.xhx.common.key.Constant.PARAM_SERVER_CWS_HTTP_URL;
...
@@ -31,6 +41,13 @@ import static com.mortals.xhx.common.key.Constant.PARAM_SERVER_CWS_HTTP_URL;
@RestController
@RestController
public
class
SyntheticalController
extends
BaseJsonBodyController
{
public
class
SyntheticalController
extends
BaseJsonBodyController
{
@Value
(
"${upload.path}"
)
@Getter
private
String
filePath
;
@Autowired
private
UserMatterApplyService
userMatterApplyService
;
/**
/**
* 查询可受理事项
* 查询可受理事项
* @param query
* @param query
...
@@ -38,7 +55,7 @@ public class SyntheticalController extends BaseJsonBodyController {
...
@@ -38,7 +55,7 @@ public class SyntheticalController extends BaseJsonBodyController {
*/
*/
@PostMapping
({
"api/event-implementation/list"
})
@PostMapping
({
"api/event-implementation/list"
})
@UnAuth
@UnAuth
public
String
eventList
(
@RequestBody
Synthetical
Pdu
query
)
{
public
String
eventList
(
@RequestBody
Synthetical
MatterQuery
query
)
{
String
url
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_CWS_HTTP_URL
,
"http://8.136.255.30:1086"
);
String
url
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_CWS_HTTP_URL
,
"http://8.136.255.30:1086"
);
url
+=
"/complex/api/event-implementation/list"
;
url
+=
"/complex/api/event-implementation/list"
;
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
...
@@ -228,8 +245,14 @@ public class SyntheticalController extends BaseJsonBodyController {
...
@@ -228,8 +245,14 @@ public class SyntheticalController extends BaseJsonBodyController {
Map
<
String
,
Object
>
model
=
new
HashMap
();
Map
<
String
,
Object
>
model
=
new
HashMap
();
String
busiDesc
=
"自助设备接件"
;
String
busiDesc
=
"自助设备接件"
;
try
{
try
{
doFileToBase64
(
query
);
resp
=
doPost
(
url
,
JSONObject
.
toJSONString
(
query
));
resp
=
doPost
(
url
,
JSONObject
.
toJSONString
(
query
));
this
.
recordSysLog
(
this
.
request
,
busiDesc
+
" 【成功】"
);
this
.
recordSysLog
(
this
.
request
,
busiDesc
+
" 【成功】"
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
resp
);
if
(
jsonObject
.
getIntValue
(
"code"
)==
1
){
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
this
.
doException
(
this
.
request
,
busiDesc
+
" 【异常】"
,
model
,
e
);
this
.
doException
(
this
.
request
,
busiDesc
+
" 【异常】"
,
model
,
e
);
Rest
<
Object
>
ret
=
new
Rest
();
Rest
<
Object
>
ret
=
new
Rest
();
...
@@ -240,6 +263,30 @@ public class SyntheticalController extends BaseJsonBodyController {
...
@@ -240,6 +263,30 @@ public class SyntheticalController extends BaseJsonBodyController {
return
resp
;
return
resp
;
}
}
/**
* 将上传文件地址转换为Base64
* @param pdu
*/
private
void
doFileToBase64
(
AcceptHandlingPdu
pdu
){
if
(
ObjectUtil
.
isNotEmpty
(
pdu
)){
List
<
Material
>
materials
=
pdu
.
getMaterials
();
if
(
CollectionUtils
.
isNotEmpty
(
materials
)){
String
rootPath
=
this
.
filePath
.
endsWith
(
"/"
)
?
this
.
filePath
:
this
.
filePath
+
"/"
;
for
(
Material
item:
materials
){
String
filePath
=
rootPath
+
item
.
getMaterialFilePath
();
try
{
Path
path
=
Paths
.
get
(
filePath
);
// 替换为实际文件路径
byte
[]
fileBytes
=
Files
.
readAllBytes
(
path
);
String
base64EncodedString
=
Base64
.
getEncoder
().
encodeToString
(
fileBytes
);
item
.
setMaterialContent
(
base64EncodedString
);
}
catch
(
Exception
e
)
{
throw
new
AppException
(
e
.
getMessage
());
}
}
}
}
}
private
String
doPost
(
String
url
,
String
body
)
throws
Exception
{
private
String
doPost
(
String
url
,
String
body
)
throws
Exception
{
HttpRequest
httpRequest
=
HttpRequest
.
post
(
url
);
HttpRequest
httpRequest
=
HttpRequest
.
post
(
url
);
httpRequest
.
body
(
body
);
httpRequest
.
body
(
body
);
...
@@ -254,29 +301,40 @@ public class SyntheticalController extends BaseJsonBodyController {
...
@@ -254,29 +301,40 @@ public class SyntheticalController extends BaseJsonBodyController {
return
resp
;
return
resp
;
}
}
public
static
void
main
(
String
[]
args
){
// public static void main(String[] args){
String
url
=
"http://8.136.255.30:1086/complex/api/event-implementation/get-by-id"
;
// String url = "http://8.136.255.30:1086/complex/api/event-implementation/get-by-id";
JSONObject
jsonObject
=
new
JSONObject
();
// JSONObject jsonObject=new JSONObject();
System
.
out
.
println
(
jsonObject
.
toJSONString
());
// System.out.println(jsonObject.toJSONString());
jsonObject
.
put
(
"eventId"
,
"2e4575157ed27dbc7330b1595207b49c"
);
// jsonObject.put("eventId","2e4575157ed27dbc7330b1595207b49c");
String
resp
=
null
;
// String resp = null;
Map
<
String
,
Object
>
model
=
new
HashMap
();
// Map<String, Object> model = new HashMap();
HashMap
<
String
,
String
>
paramsMap
=
new
HashMap
<>();
// HashMap<String, String> paramsMap = new HashMap<>();
try
{
// try {
HttpRequest
httpRequest
=
HttpRequest
.
post
(
url
);
// HttpRequest httpRequest = HttpRequest.post(url);
httpRequest
.
body
(
jsonObject
.
toJSONString
());
// httpRequest.body(jsonObject.toJSONString());
HttpResponse
execute
=
httpRequest
.
execute
();
// HttpResponse execute = httpRequest.execute();
//
// 6. 解析这个http响应类,可以获取到响应主体、cookie、是否请求成功等信息
// // 6. 解析这个http响应类,可以获取到响应主体、cookie、是否请求成功等信息
boolean
ok
=
execute
.
isOk
();
// 是否请求成功 判断依据为:状态码范围在200~299内
// boolean ok = execute.isOk(); // 是否请求成功 判断依据为:状态码范围在200~299内
System
.
out
.
println
(
ok
);
// System.out.println(ok);
List
<
HttpCookie
>
cookies
=
execute
.
getCookies
();
// 获取所有cookie
// List<HttpCookie> cookies = execute.getCookies();// 获取所有cookie
cookies
.
forEach
(
System
.
out
::
println
);
// 如果为空不会遍历的
// cookies.forEach(System.out::println); // 如果为空不会遍历的
String
body
=
execute
.
body
();
// 获取响应主体
// String body = execute.body(); // 获取响应主体
System
.
out
.
println
(
body
);
// System.out.println(body);
//
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
}
catch
(
Exception
e
)
{
// public static void main(String[] args) {
e
.
printStackTrace
();
// try {
}
// Path filePath = Paths.get("D:\\home\\mortals\\app\\aaa.jpg"); // 替换为实际文件路径
}
// byte[] fileBytes = Files.readAllBytes(filePath);
// String base64EncodedString = Base64.getEncoder().encodeToString(fileBytes);
// System.out.println(base64EncodedString);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
}
}
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