Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-qywx-self
Overview
Overview
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
haoban3.0
gic-qywx-self
Commits
2f3792eb
Commit
2f3792eb
authored
Aug 08, 2023
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
09571e15
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
1 deletions
+74
-1
pom.xml
pom.xml
+5
-0
QywxSelfApiServiceImpl.java
src/main/java/com/gic/qywx/self/QywxSelfApiServiceImpl.java
+63
-0
dubbo-haoban-self-web.xml
src/main/webapp/WEB-INF/dubbo-haoban-self-web.xml
+6
-1
No files found.
pom.xml
View file @
2f3792eb
...
...
@@ -57,6 +57,11 @@
<artifactId>
gic-commons
</artifactId>
<version>
${gic-commons}
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
haoban-manage3-api
</artifactId>
<version>
${haoban-manage3-api}
</version>
</dependency>
</dependencies>
<build>
...
...
src/main/java/com/gic/qywx/self/QywxSelfApiServiceImpl.java
0 → 100644
View file @
2f3792eb
package
com
.
gic
.
qywx
.
self
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.haoban.manage.api.service.QywxSelfApiService
;
import
org.apache.http.entity.ContentType
;
import
org.apache.http.entity.mime.content.ByteArrayBody
;
import
org.apache.http.entity.mime.content.ContentBody
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.util.HashMap
;
import
java.util.Map
;
@Service
(
"qywxSelfApiService"
)
public
class
QywxSelfApiServiceImpl
implements
QywxSelfApiService
{
private
Logger
logger
=
LogManager
.
getLogger
(
QywxSelfApiServiceImpl
.
class
);
@Override
public
Map
<
String
,
Object
>
selfPost
(
String
url
,
String
json
,
String
ip
)
{
logger
.
info
(
"自建post,url={},json={},{}"
,
url
,
json
,
ip
);
Map
<
String
,
Object
>
map
=
HttpClient
.
getWinxinResByJson
(
url
,
json
,
getIp
(
ip
)
,
ip
);
logger
.
info
(
"end={}"
,
JSONObject
.
toJSON
(
map
));
return
map
;
}
@Override
public
Map
<
String
,
Object
>
selfGet
(
String
url
,
String
ip
)
{
logger
.
info
(
"自建get,url={},{}"
,
url
,
ip
);
Map
<
String
,
Object
>
map
=
HttpClient
.
getHttpByGet
(
url
,
getIp
(
ip
)
,
ip
);
logger
.
info
(
"end={}"
,
JSONObject
.
toJSON
(
map
));
return
map
;
}
@Override
public
Map
<
String
,
Object
>
selfUpload
(
String
url
,
String
fileUrl
,
String
fileName
,
String
ip
)
{
logger
.
info
(
"自建upload,url={},fileUrl={},{}"
,
url
,
fileUrl
,
ip
);
byte
[]
data
=
CommonUtil
.
getFileByte
(
fileUrl
);
Map
<
String
,
ContentBody
>
paramsMap
=
new
HashMap
<
String
,
ContentBody
>();
paramsMap
.
put
(
"media"
,
new
ByteArrayBody
(
data
,
ContentType
.
DEFAULT_BINARY
,
fileName
));
Map
<
String
,
Object
>
map
=
HttpClient
.
getWinxinResByFile
(
url
,
paramsMap
,
getIp
(
ip
)
,
ip
);
logger
.
info
(
"end={}"
,
JSONObject
.
toJSON
(
map
));
return
map
;
}
@Override
public
Map
<
String
,
Object
>
selfImage
(
String
url
,
String
fileName
,
String
ip
,
byte
[]
data
)
{
logger
.
info
(
"自建upload-data,url={},{}"
,
url
,
ip
);
Map
<
String
,
ContentBody
>
paramsMap
=
new
HashMap
<
String
,
ContentBody
>();
paramsMap
.
put
(
"media"
,
new
ByteArrayBody
(
data
,
ContentType
.
DEFAULT_BINARY
,
fileName
));
Map
<
String
,
Object
>
map
=
HttpClient
.
getWinxinResByFile
(
url
,
paramsMap
,
getIp
(
ip
)
,
ip
);
logger
.
info
(
"end={}"
,
JSONObject
.
toJSON
(
map
));
return
map
;
}
// 必须是内网ip
private
byte
[]
getIp
(
String
ip
)
{
if
(
StringUtils
.
isEmpty
(
ip
))
{
return
null
;
}
String
[]
arr
=
ip
.
split
(
"\\."
);
byte
[]
b
=
new
byte
[]
{
Integer
.
valueOf
(
arr
[
0
]).
byteValue
(),
Integer
.
valueOf
(
arr
[
1
]).
byteValue
(),
Integer
.
valueOf
(
arr
[
2
]).
byteValue
(),
Integer
.
valueOf
(
arr
[
3
]).
byteValue
()};
return
b
;
}
}
src/main/webapp/WEB-INF/dubbo-haoban-self-web.xml
View file @
2f3792eb
...
...
@@ -8,7 +8,11 @@
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"
>
<context:component-scan
base-package=
"com.gic.qywx.*"
/>
<dubbo:application
name=
"gic-qywx-self"
/>
<!-- 用dubbo协议在20880端口暴露服务 -->
<dubbo:protocol
name=
"dubbo"
port=
"20130"
/>
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.QywxSelfApiService"
ref=
"qywxSelfApiService"
retries=
"0"
/>
</beans>
\ 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