Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
K
kwell-mes
Project
Project
Details
Activity
Releases
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
gavelinfo
kwell-mes
Commits
c79430c4
Commit
c79430c4
authored
Apr 01, 2022
by
zhoumaotao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码调整2
parent
bfbcf0a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
11 deletions
+41
-11
KmesBoardServiceImpl.java
...va/com/gavel/kwell/service/impl/KmesBoardServiceImpl.java
+41
-11
No files found.
gavel/src/main/java/com/gavel/kwell/service/impl/KmesBoardServiceImpl.java
View file @
c79430c4
package
com
.
gavel
.
kwell
.
service
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gavel.common.base.service.impl.BaseEditServiceImpl
;
import
com.gavel.common.business.service.CommonService
;
import
com.gavel.common.http.HttpUtils
;
import
com.gavel.common.utils.CollectionUtils
;
import
com.gavel.common.utils.DateUtils
;
import
com.gavel.common.utils.NumberUtils
;
import
com.gavel.common.utils.StringUtils
;
import
com.gavel.common.utils.*
;
import
com.gavel.kwell.dao.GpfkcxDao
;
import
com.gavel.kwell.dao.KmesBoardDao
;
import
com.gavel.kwell.persistent.Gpfkjg
;
...
...
@@ -19,11 +16,14 @@ import com.gavel.wo.persistent.Pcjhmx;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.*
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.client.RestTemplate
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.nio.charset.StandardCharsets
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
...
...
@@ -44,6 +44,9 @@ public class KmesBoardServiceImpl extends BaseEditServiceImpl implements KmesBoa
@Autowired
private
CommonService
commonService
;
@Autowired
private
RestTemplate
restTemplate
;
@Override
public
void
initService
(){
}
...
...
@@ -316,15 +319,42 @@ public class KmesBoardServiceImpl extends BaseEditServiceImpl implements KmesBoa
@Override
public
KqtjVO
queryOA
()
{
KqtjVO
kqtjVO
=
new
KqtjVO
();
String
time
=
DateUtils
.
formatDate
(
DateUtils
.
getDateTime
(),
"yyyyMMddHHmmss"
);
String
url
=
"http://oa.kewell.com.cn/api/cube/restful/interface/getModeDataPageList/mes_kqtj"
;
String
param
=
"{\"datajson\":{\"operationinfo\":{\"operator\":\"1\"},\"mainTable\":{},\"pageInfo\":{\"pageNo\":\"1\",\"pageSize\":\"10\"},"
+
"\"header\":{\"systemid\":\"CRM_System\",\"currentDateTime\":\"20200101010101\",\"Md5\":\"c4ca4238a0b923820dcc509a6f75849b\"}}}"
;
StringBuilder
param
=
new
StringBuilder
();
param
.
append
(
"{\"datajson\":{\"operationinfo\":{\"operator\":\"1\"},\"mainTable\":{},\"pageInfo\":{\"pageNo\":\"1\",\"pageSize\":\"10\"},"
);
param
.
append
(
"\"header\":{\"systemid\":\"oa\","
);
param
.
append
(
"\"currentDateTime\":"
).
append
(
"\""
+
time
+
"\""
).
append
(
",\"Md5\":"
).
append
(
"\""
+
MD5Utils
.
md5Hex
(
"oa"
+
"123456"
+
time
)+
"\""
).
append
(
"}}}"
);
try
{
String
response
=
HttpUtils
.
doPost
(
url
,
param
);
if
(
StringUtils
.
isNotEmpty
(
response
)){
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
response
);
logger
.
info
(
"返回信息:"
+
response
);
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
set
(
HttpHeaders
.
ACCEPT_CHARSET
,
StandardCharsets
.
UTF_8
.
toString
());
HttpEntity
httpEntity
=
new
HttpEntity
<>(
param
,
headers
);
ResponseEntity
<
String
>
exchange
=
restTemplate
.
exchange
(
url
,
HttpMethod
.
POST
,
httpEntity
,
String
.
class
);
String
body
=
exchange
.
getBody
();
logger
.
info
(
"返回信息:"
+
body
);
if
(
StringUtils
.
isNotEmpty
(
body
)){
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
body
);
JSONArray
jsonArray
=
jsonObject
.
getJSONArray
(
"result"
);
for
(
int
j
=
0
;
j
<
jsonArray
.
size
();
j
++){
JSONObject
jsonObjectOne
=
jsonArray
.
getJSONObject
(
j
);
int
ydrs
=
0
;
int
sdrs
=
0
;
Integer
ydrs1
=
jsonObjectOne
.
getJSONObject
(
"mainTable"
).
getInteger
(
"ydrs"
);
Integer
sdrs1
=
jsonObjectOne
.
getJSONObject
(
"mainTable"
).
getInteger
(
"sdrs"
);
if
(
ydrs1
!=
null
){
ydrs
=
ydrs1
;
}
if
(
sdrs1
!=
null
){
sdrs
=
sdrs1
;
}
kqtjVO
.
setYdrs
(
ydrs
);
kqtjVO
.
setSdrs
(
sdrs
);
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"错误信息:"
,
e
);
}
...
...
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