Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hp-smart
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
platform
hp-smart
Commits
b711bbf5
Commit
b711bbf5
authored
Jan 31, 2024
by
yukang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
生产订单增加单重
parent
15dc5ad7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
217 additions
and
182 deletions
+217
-182
BaiDuApi.java
src/main/java/com/baosight/hpjx/core/api/BaiDuApi.java
+83
-83
HPSC005.java
src/main/java/com/baosight/hpjx/hp/sc/domain/HPSC005.java
+30
-0
ServiceHPSC002.java
.../java/com/baosight/hpjx/hp/sc/service/ServiceHPSC002.java
+1
-0
ServiceHPSC003.java
.../java/com/baosight/hpjx/hp/sc/service/ServiceHPSC003.java
+2
-1
ServiceHPSC098.java
.../java/com/baosight/hpjx/hp/sc/service/ServiceHPSC098.java
+2
-2
HPSC005.xml
src/main/java/com/baosight/hpjx/hp/sc/sql/HPSC005.xml
+4
-1
HttpUtils.java
src/main/java/com/baosight/hpjx/util/HttpUtils.java
+95
-95
No files found.
src/main/java/com/baosight/hpjx/core/api/BaiDuApi.java
View file @
b711bbf5
...
@@ -19,57 +19,57 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -19,57 +19,57 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
@Slf4j
public
class
BaiDuApi
{
public
class
BaiDuApi
{
// 鉴权接口
//
// 鉴权接口
private
static
final
String
TOKEN_URL
=
"https://aip.baidubce.com/oauth/2.0/token"
;
//
private static final String TOKEN_URL = "https://aip.baidubce.com/oauth/2.0/token";
// 标准版接口地址
//
// 标准版接口地址
private
static
final
String
BASIC_URL
=
"https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic"
;
//
private static final String BASIC_URL = "https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic";
// 办公文档版接口地址
//
// 办公文档版接口地址
private
static
final
String
OFFICE_URL
=
"https://aip.baidubce.com/rest/2.0/ocr/v1/doc_analysis_office"
;
//
private static final String OFFICE_URL = "https://aip.baidubce.com/rest/2.0/ocr/v1/doc_analysis_office";
// Api Key
//
// Api Key
private
static
final
String
API_KEY
=
"dkXgTCScKjfMmL7oCzAIFdgZ"
;
//
private static final String API_KEY = "dkXgTCScKjfMmL7oCzAIFdgZ";
// Secret Key
//
// Secret Key
private
static
final
String
SECRET_KEY
=
"xP5V9k23KBNHOyzc0rYkm00GdQMMxvEh"
;
//
private static final String SECRET_KEY = "xP5V9k23KBNHOyzc0rYkm00GdQMMxvEh";
//
/**
//
/**
* 获取TOKEN
//
* 获取TOKEN
*
//
*
* @return
//
* @return
*/
//
*/
public
static
String
getToken
()
{
//
public static String getToken() {
return
SingletonHolder
.
TOKEN
;
//
return SingletonHolder.TOKEN;
}
//
}
//
/**
//
/**
* 刷新TOKEN
//
* 刷新TOKEN
*
//
*
* @return
//
* @return
*/
//
*/
public
static
void
refreshToken
()
{
//
public static void refreshToken() {
SingletonHolder
.
refresh
();
//
SingletonHolder.refresh();
}
//
}
//
public
static
void
main
(
String
[]
args
)
throws
IOException
{
//
public static void main(String[] args) throws IOException {
// String filePath = "e:/10001.jpg";
//
//
String filePath = "e:/10001.jpg";
String
filePath
=
"e:/新年贺词.pdf"
;
//
String filePath = "e:/新年贺词.pdf";
docAnalysisOffice
(
filePath
);
//
docAnalysisOffice(filePath);
}
//
}
//
/**
//
/**
* 解析办公文档
//
* 解析办公文档
*
//
*
* @param filePath 本地文件地址
//
* @param filePath 本地文件地址
*/
//
*/
public
static
void
docAnalysisOffice
(
String
filePath
)
throws
IOException
{
//
public static void docAnalysisOffice(String filePath) throws IOException {
byte
[]
fileBytes
=
FileUtils
.
readByBytes
(
filePath
);
//
byte[] fileBytes = FileUtils.readByBytes(filePath);
String
fileBase64
=
Base64Utils
.
encode
(
fileBytes
);
//
String fileBase64 = Base64Utils.encode(fileBytes);
String
fileEncoder
=
URLEncoder
.
encode
(
fileBase64
,
"UTF-8"
);
//
String fileEncoder = URLEncoder.encode(fileBase64, "UTF-8");
String
param
=
"pdf_file_num=2&image="
+
fileEncoder
;
//
String param = "pdf_file_num=2&image=" + fileEncoder;
Map
<
String
,
String
>
header
=
new
HashMap
<>();
//
Map<String, String> header = new HashMap<>();
header
.
put
(
"Content-Type"
,
"application/x-www-form-urlencoded"
);
//
header.put("Content-Type", "application/x-www-form-urlencoded");
String
url
=
OFFICE_URL
+
"?access_token="
+
getToken
();
//
String url = OFFICE_URL + "?access_token=" + getToken();
String
result
=
HttpUtils
.
post
(
url
,
header
,
param
,
HttpUtils
.
FORM_MEDIA_TYPE
);
//
String result = HttpUtils.post(url, header, param, HttpUtils.FORM_MEDIA_TYPE);
log
.
info
(
"result->{}"
,
result
);
//
log.info("result->{}", result);
}
//
}
/**
/**
* 静态内部类用于初始化
* 静态内部类用于初始化
...
@@ -79,38 +79,38 @@ public class BaiDuApi {
...
@@ -79,38 +79,38 @@ public class BaiDuApi {
*/
*/
private
static
class
SingletonHolder
{
private
static
class
SingletonHolder
{
/**
//
/**
* 默认DAO
//
* 默认DAO
*/
//
*/
private
static
String
TOKEN
=
"24.717d5b52074bdf31d0377a4afa6c97d6.2592000.1709101017.282335-48528257"
;
//getToken();
//
private static String TOKEN = "24.717d5b52074bdf31d0377a4afa6c97d6.2592000.1709101017.282335-48528257";//getToken();
//
/**
//
/**
* 获取TOKEN
//
* 获取TOKEN
*
//
*
* @return
//
* @return
* @throws IOException
//
* @throws IOException
*/
//
*/
private
static
String
getToken
()
{
//
private static String getToken() {
try
{
//
try {
String
url
=
String
.
format
(
"%s?client_id=%s&client_secret=%s&grant_type=client_credentials"
,
//
String url = String.format("%s?client_id=%s&client_secret=%s&grant_type=client_credentials",
TOKEN_URL
,
API_KEY
,
SECRET_KEY
);
//
TOKEN_URL, API_KEY, SECRET_KEY);
String
result
=
HttpUtils
.
post
(
url
);
//
String result = HttpUtils.post(url);
JSONObject
resultJson
=
JSONObject
.
parseObject
(
result
);
//
JSONObject resultJson = JSONObject.parseObject(result);
return
resultJson
.
getString
(
"access_token"
);
//
return resultJson.getString("access_token");
}
catch
(
Exception
e
)
{
//
} catch (Exception e) {
log
.
error
(
"获取百度API的TOKEN失败:{}"
,
e
.
getMessage
(),
e
);
//
log.error("获取百度API的TOKEN失败:{}", e.getMessage(), e);
}
//
}
return
null
;
//
return null;
}
//
}
//
/**
//
/**
* 刷新TOKEN
//
* 刷新TOKEN
*
//
*
* @return
//
* @return
*/
//
*/
public
static
void
refresh
()
{
//
public static void refresh() {
TOKEN
=
getToken
();
//
TOKEN = getToken();
}
//
}
}
}
...
...
src/main/java/com/baosight/hpjx/hp/sc/domain/HPSC005.java
View file @
b711bbf5
...
@@ -32,6 +32,7 @@ public class HPSC005 extends DaoEPBase {
...
@@ -32,6 +32,7 @@ public class HPSC005 extends DaoEPBase {
public
static
final
String
FIELD_PRDT_NAME
=
"prdtName"
;
/* 部件名称*/
public
static
final
String
FIELD_PRDT_NAME
=
"prdtName"
;
/* 部件名称*/
public
static
final
String
FIELD_PLAN_COMPLETION_DATE
=
"planCompletionDate"
;
/* 计划完成日期*/
public
static
final
String
FIELD_PLAN_COMPLETION_DATE
=
"planCompletionDate"
;
/* 计划完成日期*/
public
static
final
String
FIELD_NUM
=
"num"
;
/* 计划数量*/
public
static
final
String
FIELD_NUM
=
"num"
;
/* 计划数量*/
public
static
final
String
FIELD_UNIT_WT
=
"unitWt"
;
/* 单重*/
public
static
final
String
FIELD_TOTAL_WT
=
"totalWt"
;
/* 计划重量*/
public
static
final
String
FIELD_TOTAL_WT
=
"totalWt"
;
/* 计划重量*/
public
static
final
String
FIELD_STATUS
=
"status"
;
/* 状态 0-未派工,1-已派工*/
public
static
final
String
FIELD_STATUS
=
"status"
;
/* 状态 0-未派工,1-已派工*/
public
static
final
String
FIELD_ORG_NO
=
"orgNo"
;
/* 生产组编码*/
public
static
final
String
FIELD_ORG_NO
=
"orgNo"
;
/* 生产组编码*/
...
@@ -59,6 +60,8 @@ public class HPSC005 extends DaoEPBase {
...
@@ -59,6 +60,8 @@ public class HPSC005 extends DaoEPBase {
public
static
final
String
COL_PRDT_NAME
=
"PRDT_NAME"
;
/* 部件名称*/
public
static
final
String
COL_PRDT_NAME
=
"PRDT_NAME"
;
/* 部件名称*/
public
static
final
String
COL_PLAN_COMPLETION_DATE
=
"PLAN_COMPLETION_DATE"
;
/* 计划完成日期*/
public
static
final
String
COL_PLAN_COMPLETION_DATE
=
"PLAN_COMPLETION_DATE"
;
/* 计划完成日期*/
public
static
final
String
COL_NUM
=
"NUM"
;
/* 计划数量*/
public
static
final
String
COL_NUM
=
"NUM"
;
/* 计划数量*/
public
static
final
String
COL_UNIT_WT
=
"UNIT_WT"
;
/* 单重*/
public
static
final
String
COL_TOTAL_WT
=
"TOTAL_WT"
;
/* 计划重量*/
public
static
final
String
COL_TOTAL_WT
=
"TOTAL_WT"
;
/* 计划重量*/
public
static
final
String
COL_STATUS
=
"STATUS"
;
/* 状态 0-未派工,1-已派工*/
public
static
final
String
COL_STATUS
=
"STATUS"
;
/* 状态 0-未派工,1-已派工*/
public
static
final
String
COL_ORG_NO
=
"ORG_NO"
;
/* 生产组编码*/
public
static
final
String
COL_ORG_NO
=
"ORG_NO"
;
/* 生产组编码*/
...
@@ -92,6 +95,8 @@ public class HPSC005 extends DaoEPBase {
...
@@ -92,6 +95,8 @@ public class HPSC005 extends DaoEPBase {
private
String
prdtName
=
" "
;
/* 部件名称*/
private
String
prdtName
=
" "
;
/* 部件名称*/
private
String
planCompletionDate
=
" "
;
/* 计划完成日期*/
private
String
planCompletionDate
=
" "
;
/* 计划完成日期*/
private
BigDecimal
num
=
new
BigDecimal
(
0.000
);
/* 计划数量*/
private
BigDecimal
num
=
new
BigDecimal
(
0.000
);
/* 计划数量*/
private
BigDecimal
unitWt
=
new
BigDecimal
(
0.000
);
/* 单重*/
private
BigDecimal
totalWt
=
new
BigDecimal
(
0.000
);
/* 计划重量*/
private
BigDecimal
totalWt
=
new
BigDecimal
(
0.000
);
/* 计划重量*/
private
Integer
status
=
new
Integer
(
0
);
/* 状态 0-未派工,1-已派工*/
private
Integer
status
=
new
Integer
(
0
);
/* 状态 0-未派工,1-已派工*/
private
String
orgNo
=
" "
;
/* 生产组编码*/
private
String
orgNo
=
" "
;
/* 生产组编码*/
...
@@ -170,6 +175,13 @@ public class HPSC005 extends DaoEPBase {
...
@@ -170,6 +175,13 @@ public class HPSC005 extends DaoEPBase {
eiColumn
.
setDescName
(
"计划数量"
);
eiColumn
.
setDescName
(
"计划数量"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_UNIT_WT
);
eiColumn
.
setType
(
"N"
);
eiColumn
.
setScaleLength
(
3
);
eiColumn
.
setFieldLength
(
15
);
eiColumn
.
setDescName
(
"计划单重"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_TOTAL_WT
);
eiColumn
=
new
EiColumn
(
FIELD_TOTAL_WT
);
eiColumn
.
setType
(
"N"
);
eiColumn
.
setType
(
"N"
);
eiColumn
.
setScaleLength
(
3
);
eiColumn
.
setScaleLength
(
3
);
...
@@ -303,6 +315,22 @@ public class HPSC005 extends DaoEPBase {
...
@@ -303,6 +315,22 @@ public class HPSC005 extends DaoEPBase {
eiColumn
.
setDescName
(
"产品-厚"
);
eiColumn
.
setDescName
(
"产品-厚"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiMetadata
.
addMeta
(
eiColumn
);
}
}
/**
* get the unitWt - 单重.
* @return the unitWt
*/
public
BigDecimal
getUnitWt
()
{
return
this
.
unitWt
;
}
/**
* set the unitWt - 单重.
*
* @param unitWt - 单重
*/
public
void
setUnitWt
(
BigDecimal
unitWt
)
{
this
.
unitWt
=
unitWt
;
}
public
String
getRemark1
()
{
public
String
getRemark1
()
{
return
this
.
remark1
;
return
this
.
remark1
;
}
}
...
@@ -906,6 +934,7 @@ public class HPSC005 extends DaoEPBase {
...
@@ -906,6 +934,7 @@ public class HPSC005 extends DaoEPBase {
setPartLength
(
NumberUtils
.
toBigDecimal
(
StringUtils
.
toString
(
map
.
get
(
"partLength"
)),
partLength
));
setPartLength
(
NumberUtils
.
toBigDecimal
(
StringUtils
.
toString
(
map
.
get
(
"partLength"
)),
partLength
));
setPartWidth
(
NumberUtils
.
toBigDecimal
(
StringUtils
.
toString
(
map
.
get
(
"partWidth"
)),
partWidth
));
setPartWidth
(
NumberUtils
.
toBigDecimal
(
StringUtils
.
toString
(
map
.
get
(
"partWidth"
)),
partWidth
));
setPartThick
(
NumberUtils
.
toBigDecimal
(
StringUtils
.
toString
(
map
.
get
(
"partThick"
)),
partThick
));
setPartThick
(
NumberUtils
.
toBigDecimal
(
StringUtils
.
toString
(
map
.
get
(
"partThick"
)),
partThick
));
setUnitWt
(
NumberUtils
.
toBigDecimal
(
StringUtils
.
toString
(
map
.
get
(
FIELD_UNIT_WT
)),
unitWt
));
}
}
...
@@ -954,6 +983,7 @@ public class HPSC005 extends DaoEPBase {
...
@@ -954,6 +983,7 @@ public class HPSC005 extends DaoEPBase {
map
.
put
(
"partLength"
,
StringUtils
.
toString
(
partLength
,
eiMetadata
.
getMeta
(
"partLength"
)));
map
.
put
(
"partLength"
,
StringUtils
.
toString
(
partLength
,
eiMetadata
.
getMeta
(
"partLength"
)));
map
.
put
(
"partWidth"
,
StringUtils
.
toString
(
partWidth
,
eiMetadata
.
getMeta
(
"partWidth"
)));
map
.
put
(
"partWidth"
,
StringUtils
.
toString
(
partWidth
,
eiMetadata
.
getMeta
(
"partWidth"
)));
map
.
put
(
"partThick"
,
StringUtils
.
toString
(
partThick
,
eiMetadata
.
getMeta
(
"partThick"
)));
map
.
put
(
"partThick"
,
StringUtils
.
toString
(
partThick
,
eiMetadata
.
getMeta
(
"partThick"
)));
map
.
put
(
FIELD_UNIT_WT
,
StringUtils
.
toString
(
unitWt
,
eiMetadata
.
getMeta
(
FIELD_UNIT_WT
)));
return
map
;
return
map
;
}
}
...
...
src/main/java/com/baosight/hpjx/hp/sc/service/ServiceHPSC002.java
View file @
b711bbf5
...
@@ -403,6 +403,7 @@ public class ServiceHPSC002 extends ServiceBase {
...
@@ -403,6 +403,7 @@ public class ServiceHPSC002 extends ServiceBase {
HPSC004
.
setRemark
(
HPSC002
.
getRemark
());
HPSC004
.
setRemark
(
HPSC002
.
getRemark
());
HPSC004
.
setNum
(
HPSC002
.
getNum
());
HPSC004
.
setNum
(
HPSC002
.
getNum
());
HPSC004
.
setUnitWt
(
HPSC002
.
getUnitWt
());
HPSC004
.
setUnitWt
(
HPSC002
.
getUnitWt
());
HPSC004
.
setTotalWt
(
HPSC002
.
getTotalWt
());
HPSC004
.
setFilePath1
(
HPSC002
.
getId
().
toString
());
HPSC004
.
setFilePath1
(
HPSC002
.
getId
().
toString
());
HPSC004
.
setPlanCommentDate
(
""
);
HPSC004
.
setPlanCommentDate
(
""
);
HPSC004
.
setPlanCompletionDate
(
""
);
HPSC004
.
setPlanCompletionDate
(
""
);
...
...
src/main/java/com/baosight/hpjx/hp/sc/service/ServiceHPSC003.java
View file @
b711bbf5
...
@@ -227,7 +227,8 @@ public class ServiceHPSC003 extends ServiceBase {
...
@@ -227,7 +227,8 @@ public class ServiceHPSC003 extends ServiceBase {
HPSC005
.
setRemark1
(
HPSC004
.
getRemark
());
HPSC005
.
setRemark1
(
HPSC004
.
getRemark
());
HPSC005
.
setPlanCompletionDate
(
HPSC004
.
getPlanCompletionDate
());
HPSC005
.
setPlanCompletionDate
(
HPSC004
.
getPlanCompletionDate
());
HPSC005
.
setNum
(
HPSC004
.
getNum
());
HPSC005
.
setNum
(
HPSC004
.
getNum
());
HPSC005
.
setTotalWt
(
HPSC004
.
getUnitWt
());
HPSC005
.
setUnitWt
(
HPSC004
.
getUnitWt
());
HPSC005
.
setTotalWt
(
HPSC004
.
getTotalWt
());
HPSC005
.
setStatus
(
0
);
HPSC005
.
setStatus
(
0
);
HPSC005
.
setFilePath1
(
HPSC004
.
getFilePath1
());
HPSC005
.
setFilePath1
(
HPSC004
.
getFilePath1
());
DaoUtils
.
insert
(
"HPSC005.insert"
,
HPSC005
.
toMap
());
DaoUtils
.
insert
(
"HPSC005.insert"
,
HPSC005
.
toMap
());
...
...
src/main/java/com/baosight/hpjx/hp/sc/service/ServiceHPSC098.java
View file @
b711bbf5
...
@@ -26,7 +26,7 @@ public class ServiceHPSC098 extends ServiceBase {
...
@@ -26,7 +26,7 @@ public class ServiceHPSC098 extends ServiceBase {
EiInfo
outInfo
=
new
EiInfo
();
EiInfo
outInfo
=
new
EiInfo
();
outInfo
.
set
(
"inqu_status-0-companyCode"
,
UserSessionUtils
.
getCompanyCode
());
outInfo
.
set
(
"inqu_status-0-companyCode"
,
UserSessionUtils
.
getCompanyCode
());
outInfo
.
set
(
"inqu_status-0-orgCname"
,
inInfo
.
get
(
"inqu_status-0-orgCname"
));
outInfo
.
set
(
"inqu_status-0-orgCname"
,
inInfo
.
get
(
"inqu_status-0-orgCname"
));
outInfo
=
super
.
query
(
outInfo
,
"
XSOG0801.queryOrgList
"
,
new
XSOG01
());
outInfo
=
super
.
query
(
outInfo
,
"
HPPZ011.query
"
,
new
XSOG01
());
EiBlock
r3Block
=
new
EiBlock
(
"result"
);
EiBlock
r3Block
=
new
EiBlock
(
"result"
);
r3Block
.
setRows
(
outInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
());
r3Block
.
setRows
(
outInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
());
outInfo
.
addBlock
(
r3Block
);
outInfo
.
addBlock
(
r3Block
);
...
@@ -42,7 +42,7 @@ public class ServiceHPSC098 extends ServiceBase {
...
@@ -42,7 +42,7 @@ public class ServiceHPSC098 extends ServiceBase {
HashMap
params
=
new
HashMap
();
HashMap
params
=
new
HashMap
();
params
.
put
(
"orgCname"
,
inInfo
.
get
(
"inqu_status-0-orgCname"
));
params
.
put
(
"orgCname"
,
inInfo
.
get
(
"inqu_status-0-orgCname"
));
params
.
put
(
"companyCode"
,
UserSessionUtils
.
getCompanyCode
());
params
.
put
(
"companyCode"
,
UserSessionUtils
.
getCompanyCode
());
List
list
=
dao
.
query
(
"
XSOG0801.queryOrgList
"
,
params
,
0
,-
999999
);
List
list
=
dao
.
query
(
"
query.query
"
,
params
,
0
,-
999999
);
outInfo
.
addBlock
(
EiConstant
.
resultBlock
).
addBlockMeta
(
XSOG01
.
eiMetadata
);
outInfo
.
addBlock
(
EiConstant
.
resultBlock
).
addBlockMeta
(
XSOG01
.
eiMetadata
);
outInfo
.
addBlock
(
EiConstant
.
resultBlock
).
addRows
(
list
);
outInfo
.
addBlock
(
EiConstant
.
resultBlock
).
addRows
(
list
);
outInfo
.
getBlock
(
EiConstant
.
resultBlock
).
set
(
"limit"
,
list
.
size
());
outInfo
.
getBlock
(
EiConstant
.
resultBlock
).
set
(
"limit"
,
list
.
size
());
...
...
src/main/java/com/baosight/hpjx/hp/sc/sql/HPSC005.xml
View file @
b711bbf5
...
@@ -123,6 +123,7 @@
...
@@ -123,6 +123,7 @@
PRDT_NAME as "prdtName",
<!-- 部件名称 -->
PRDT_NAME as "prdtName",
<!-- 部件名称 -->
PLAN_COMPLETION_DATE as "planCompletionDate",
<!-- 计划完成日期 -->
PLAN_COMPLETION_DATE as "planCompletionDate",
<!-- 计划完成日期 -->
NUM as "num",
<!-- 计划数量 -->
NUM as "num",
<!-- 计划数量 -->
UNIT_WT as "unitWt",
<!-- 单重 -->
TOTAL_WT as "totalWt",
<!-- 计划重量 -->
TOTAL_WT as "totalWt",
<!-- 计划重量 -->
STATUS as "status",
<!-- 状态 0-未派工,1-已派工 -->
STATUS as "status",
<!-- 状态 0-未派工,1-已派工 -->
ORG_NO as "orgNo",
<!-- 生产组编码 -->
ORG_NO as "orgNo",
<!-- 生产组编码 -->
...
@@ -240,6 +241,7 @@
...
@@ -240,6 +241,7 @@
PRDT_NAME,
<!-- 部件名称 -->
PRDT_NAME,
<!-- 部件名称 -->
PLAN_COMPLETION_DATE,
<!-- 计划完成日期 -->
PLAN_COMPLETION_DATE,
<!-- 计划完成日期 -->
NUM,
<!-- 计划数量 -->
NUM,
<!-- 计划数量 -->
UNIT_WT,
TOTAL_WT,
<!-- 计划重量 -->
TOTAL_WT,
<!-- 计划重量 -->
STATUS,
<!-- 状态 0-未派工,1-已派工 -->
STATUS,
<!-- 状态 0-未派工,1-已派工 -->
ORG_NO,
<!-- 生产组编码 -->
ORG_NO,
<!-- 生产组编码 -->
...
@@ -269,7 +271,7 @@
...
@@ -269,7 +271,7 @@
PART_THICK
<!-- 厚 -->
PART_THICK
<!-- 厚 -->
)
)
VALUES (#id#, #companyCode#, #projCode#, #projName#, #productionOrderNo#,#inventRecordId#, #prdtType#, #prdtCode#,
VALUES (#id#, #companyCode#, #projCode#, #projName#, #productionOrderNo#,#inventRecordId#, #prdtType#, #prdtCode#,
#prdtName#, #planCompletionDate#, #num#, #totalWt#, #status#, #orgNo#, #orgName#, #createdBy#, #createdTime#,
#prdtName#, #planCompletionDate#, #num#,
#unitWt#,
#totalWt#, #status#, #orgNo#, #orgName#, #createdBy#, #createdTime#,
#updatedBy#, #updatedTime#, #depCode#, #remark#, #filePath1#, #filePath2#, #filePath3#, #filePath4#, #filePath5#,
#updatedBy#, #updatedTime#, #depCode#, #remark#, #filePath1#, #filePath2#, #filePath3#, #filePath4#, #filePath5#,
#prdtSpec#,#partType#,#partCode#,#partName#,#partSpec#,#remark1#,
#prdtSpec#,#partType#,#partCode#,#partName#,#partSpec#,#remark1#,
#prdtLength#,#prdtWidth#,#prdtThick#,#partLength#,#partWidth#,#partThick#)
#prdtLength#,#prdtWidth#,#prdtThick#,#partLength#,#partWidth#,#partThick#)
...
@@ -292,6 +294,7 @@
...
@@ -292,6 +294,7 @@
PRDT_NAME = #prdtName#,
<!-- 部件名称 -->
PRDT_NAME = #prdtName#,
<!-- 部件名称 -->
PLAN_COMPLETION_DATE = #planCompletionDate#,
<!-- 计划完成日期 -->
PLAN_COMPLETION_DATE = #planCompletionDate#,
<!-- 计划完成日期 -->
NUM = #num#,
<!-- 计划数量 -->
NUM = #num#,
<!-- 计划数量 -->
UNIT_WT = #unitWt#,
<!-- 单重 -->
TOTAL_WT = #totalWt#,
<!-- 计划重量 -->
TOTAL_WT = #totalWt#,
<!-- 计划重量 -->
STATUS = #status#,
<!-- 状态 0-未派工,1-已派工 -->
STATUS = #status#,
<!-- 状态 0-未派工,1-已派工 -->
ORG_NO = #orgNo#,
<!-- 生产组编码 -->
ORG_NO = #orgNo#,
<!-- 生产组编码 -->
...
...
src/main/java/com/baosight/hpjx/util/HttpUtils.java
View file @
b711bbf5
...
@@ -6,11 +6,11 @@ import java.io.IOException;
...
@@ -6,11 +6,11 @@ import java.io.IOException;
import
java.util.Map
;
import
java.util.Map
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
okhttp3.Headers
;
//
import okhttp3.Headers;
import
okhttp3.MediaType
;
//
import okhttp3.MediaType;
import
okhttp3.OkHttpClient
;
//
import okhttp3.OkHttpClient;
import
okhttp3.Request
;
//
import okhttp3.Request;
import
okhttp3.RequestBody
;
//
import okhttp3.RequestBody;
/**
/**
* httpclient
* httpclient
...
@@ -20,94 +20,94 @@ import okhttp3.RequestBody;
...
@@ -20,94 +20,94 @@ import okhttp3.RequestBody;
*/
*/
@Slf4j
@Slf4j
public
class
HttpUtils
{
public
class
HttpUtils
{
//
public
static
final
MediaType
JSON_MEDIA_TYPE
=
MediaType
.
get
(
"application/json; charset=utf-8"
);
//
public static final MediaType JSON_MEDIA_TYPE = MediaType.get("application/json; charset=utf-8");
public
static
final
MediaType
FORM_MEDIA_TYPE
=
MediaType
.
get
(
"application/x-www-form-urlencoded"
);
//
public static final MediaType FORM_MEDIA_TYPE = MediaType.get("application/x-www-form-urlencoded");
//
/**
//
/**
* GET请求
//
* GET请求
*
//
*
* @param url
//
* @param url
* @return
//
* @return
* @throws IOException
//
* @throws IOException
*/
//
*/
public
static
String
get
(
String
url
)
throws
IOException
{
//
public static String get(String url) throws IOException {
return
get
(
url
,
null
);
//
return get(url, null);
}
//
}
//
/**
//
/**
* GET请求
//
* GET请求
*
//
*
* @param url
//
* @param url
* @param header
//
* @param header
* @return
//
* @return
* @throws IOException
//
* @throws IOException
*/
//
*/
public
static
String
get
(
String
url
,
Map
<
String
,
String
>
header
)
throws
IOException
{
//
public static String get(String url, Map<String, String> header) throws IOException {
return
request
(
RequestMethod
.
GET
,
url
,
header
,
null
,
JSON_MEDIA_TYPE
);
//
return request(RequestMethod.GET, url, header, null, JSON_MEDIA_TYPE);
}
//
}
//
/**
//
/**
* POST请求
//
* POST请求
*
//
*
* @param url
//
* @param url
* @return
//
* @return
* @throws IOException
//
* @throws IOException
*/
//
*/
public
static
String
post
(
String
url
)
throws
IOException
{
//
public static String post(String url) throws IOException {
return
post
(
url
,
null
,
JSON_MEDIA_TYPE
);
//
return post(url, null, JSON_MEDIA_TYPE);
}
//
}
//
/**
//
/**
* POST请求
//
* POST请求
*
//
*
* @param url
//
* @param url
* @param param
//
* @param param
* @return
//
* @return
* @throws IOException
//
* @throws IOException
*/
//
*/
public
static
String
post
(
String
url
,
String
param
,
MediaType
mediaType
)
throws
IOException
{
//
public static String post(String url, String param, MediaType mediaType) throws IOException {
return
post
(
url
,
null
,
param
,
mediaType
);
//
return post(url, null, param, mediaType);
}
//
}
//
/**
//
/**
* http请求(post)
//
* http请求(post)
*
//
*
* @param url
//
* @param url
* @param header
//
* @param header
* @param param
//
* @param param
* @return
//
* @return
*/
//
*/
public
static
String
post
(
String
url
,
Map
<
String
,
String
>
header
,
String
param
,
MediaType
mediaType
)
//
public static String post(String url, Map<String, String> header, String param, MediaType mediaType)
throws
IOException
{
//
throws IOException {
return
request
(
RequestMethod
.
POST
,
url
,
header
,
param
,
mediaType
);
//
return request(RequestMethod.POST, url, header, param, mediaType);
}
//
}
//
/**
//
/**
* 发送请求
//
* 发送请求
*
//
*
* @param requestMethod 请求类型POST OR GET
//
* @param requestMethod 请求类型POST OR GET
* @param url
//
* @param url
* @param header
//
* @param header
* @param param
//
* @param param
* @return
//
* @return
*/
//
*/
private
static
String
request
(
RequestMethod
requestMethod
,
String
url
,
Map
<
String
,
String
>
header
,
String
param
,
//
private static String request(RequestMethod requestMethod, String url, Map<String, String> header, String param,
MediaType
mediaType
)
throws
IOException
{
//
MediaType mediaType) throws IOException {
log
.
info
(
"请求开始:{},{},{}"
,
url
,
header
,
StringUtils
.
subStr
(
param
,
500
));
//
log.info("请求开始:{},{},{}", url, header, StringUtils.subStr(param, 500));
OkHttpClient
okHttpClient
=
new
OkHttpClient
();
//
OkHttpClient okHttpClient = new OkHttpClient();
Request
.
Builder
builder
=
new
Request
.
Builder
().
url
(
url
);
//
Request.Builder builder = new Request.Builder().url(url);
if
(
RequestMethod
.
POST
.
equals
(
requestMethod
))
{
//
if (RequestMethod.POST.equals(requestMethod)) {
builder
=
builder
.
post
(
RequestBody
.
create
(
StringUtils
.
isBlank
(
param
)
?
""
:
param
,
mediaType
));
//
builder = builder.post(RequestBody.create(StringUtils.isBlank(param) ? "" : param, mediaType));
}
else
{
//
} else {
builder
=
builder
.
get
();
//
builder = builder.get();
}
//
}
if
(
MapUtils
.
isNotEmpty
(
header
))
{
//
if (MapUtils.isNotEmpty(header)) {
builder
=
builder
.
headers
(
Headers
.
of
(
header
));
//
builder = builder.headers(Headers.of(header));
}
//
}
String
result
=
okHttpClient
.
newCall
(
builder
.
build
()).
execute
().
body
().
string
();
//
String result = okHttpClient.newCall(builder.build()).execute().body().string();
log
.
info
(
"请求结束:{}"
,
StringUtils
.
subStr
(
result
,
500
));
//
log.info("请求结束:{}", StringUtils.subStr(result, 500));
return
result
;
//
return result;
}
//
}
//
}
}
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