Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
Aidea
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
sa_aidea
Aidea
Commits
e1a7deba
Commit
e1a7deba
authored
Oct 23, 2020
by
谢希宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Aidea product update by Strive Date 2020-10-23
parent
50664c26
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
286 additions
and
133 deletions
+286
-133
orderDetailslist.html
...n/webapp/WEB-INF/views/orderDetails/orderDetailslist.html
+2
-2
OrderDetailsMapper.xml
...in/java/com/cftech/orderdetail/dao/OrderDetailsMapper.xml
+5
-5
OrderDetailsService.java
...a/com/cftech/orderdetail/service/OrderDetailsService.java
+14
-0
OrderDetailsServiceImpl.java
...ech/orderdetail/service/impl/OrderDetailsServiceImpl.java
+18
-0
OrderDetailsController.java
...va/com/cftech/orderdetail/web/OrderDetailsController.java
+11
-4
productDetaillist.html
...webapp/WEB-INF/views/productDetail/productDetaillist.html
+1
-1
waybillform.html
...eb/src/main/webapp/WEB-INF/views/waybill/waybillform.html
+4
-4
waybilllist.html
...eb/src/main/webapp/WEB-INF/views/waybill/waybilllist.html
+61
-45
WaybillMapper.xml
...le/src/main/java/com/cftech/waybill/dao/WaybillMapper.xml
+127
-56
Waybill.java
...odule/src/main/java/com/cftech/waybill/model/Waybill.java
+11
-1
ExpressOrderInfoUtils.java
.../java/com/cftech/waybill/utils/ExpressOrderInfoUtils.java
+5
-5
FqHttpUtils.java
...e/src/main/java/com/cftech/waybill/utils/FqHttpUtils.java
+27
-10
No files found.
aidea-modules/order-detail-module-web/src/main/webapp/WEB-INF/views/orderDetails/orderDetailslist.html
View file @
e1a7deba
...
...
@@ -214,7 +214,7 @@
"mData"
:
"drugsCode"
},
{
"mData"
:
"
product
Name"
"mData"
:
"
drugs
Name"
},
{
"mData"
:
"price"
...
...
@@ -262,7 +262,7 @@
}
},{
"aTargets"
:
[
3
],
"mData"
:
"
product
Name"
,
"mData"
:
"
drugs
Name"
,
"mRender"
:
function
(
a
,
b
,
c
,
d
)
{
return
a
;
...
...
aidea-modules/order-detail-module/src/main/java/com/cftech/orderdetail/dao/OrderDetailsMapper.xml
View file @
e1a7deba
...
...
@@ -7,7 +7,7 @@
<result
column=
"order_id"
property=
"orderId"
/>
<result
column=
"order_code"
property=
"orderCode"
/>
<result
column=
"drugs_id"
property=
"drugsId"
/>
<result
column=
"drugs_n
um"
property=
"drugsNum
"
/>
<result
column=
"drugs_n
ame"
property=
"drugsName
"
/>
<result
column=
"openid"
property=
"openid"
/>
<result
column=
"price"
property=
"price"
/>
<result
column=
"amount"
property=
"amount"
/>
...
...
@@ -72,7 +72,7 @@
d.description,
d.create_by,
d.update_by,
p
.drugs_name
d
.drugs_name
</sql>
...
...
@@ -117,7 +117,6 @@
<select
id=
"count"
parameterType=
"java.util.Map"
resultType=
"java.lang.Integer"
>
SELECT COUNT(1) FROM t_order_details d
LEFT JOIN t_aidea_product p ON p.id = d.drugs_id
<include
refid=
"sqlWhere"
/>
</select>
...
...
@@ -126,8 +125,9 @@
SELECT
<include
refid=
"sqlColumns"
/>
FROM t_order_details d
LEFT JOIN t_
aidea_product p ON p.id = d.drugs
_id
LEFT JOIN t_
order o ON o.id = d.order
_id
<include
refid=
"sqlWhere"
/>
<if
test=
"userId!=null"
>
AND (o.service_id = ${userId} OR o.clerk_id = ${userId} OR o.doctor_id = ${userId})
</if>
<if
test=
"sort!=null"
>
ORDER BY ${sort.param} ${sort.type}
</if>
<if
test=
"limit>0"
>
limit #{offset},#{limit}
</if>
</select>
...
...
aidea-modules/order-detail-module/src/main/java/com/cftech/orderdetail/service/OrderDetailsService.java
View file @
e1a7deba
package
com
.
cftech
.
orderdetail
.
service
;
import
com.cftech.core.sql.Conds
;
import
com.cftech.core.sql.Sort
;
import
com.cftech.orderdetail.model.OrderDetails
;
import
com.cftech.core.generic.GenericService
;
import
java.util.List
;
/**
* 订单管理Service
*
...
...
@@ -11,4 +16,13 @@ import com.cftech.core.generic.GenericService;
public
interface
OrderDetailsService
extends
GenericService
<
OrderDetails
>
{
/**
* 通过客服、药师、订单员获取列表
* @param userId
* @param conds
* @param sort
* @param iDisplayStart
* @param iDisplayLength
*/
List
<
OrderDetails
>
fetchSearchByPageByUser
(
String
userId
,
Conds
conds
,
Sort
sort
,
int
iDisplayStart
,
int
iDisplayLength
);
}
aidea-modules/order-detail-module/src/main/java/com/cftech/orderdetail/service/impl/OrderDetailsServiceImpl.java
View file @
e1a7deba
package
com
.
cftech
.
orderdetail
.
service
.
impl
;
import
com.cftech.core.sql.Sort
;
import
com.cftech.core.util.StringUtils
;
import
com.cftech.orderdetail.model.OrderDetails
;
import
com.cftech.orderdetail.dao.OrderDetailsMapper
;
import
com.cftech.orderdetail.service.OrderDetailsService
;
...
...
@@ -10,6 +12,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 订单管理ServiceImpl
*
...
...
@@ -28,4 +34,16 @@ public GenericDao<OrderDetails> getGenericMapper() {
return
orderDetailsMapper
;
}
@Override
public
List
<
OrderDetails
>
fetchSearchByPageByUser
(
String
userId
,
Conds
conds
,
Sort
sort
,
int
page
,
int
pageSize
)
{
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
if
(!
StringUtils
.
equals
(
userId
,
"1"
))
{
params
.
put
(
"userId"
,
userId
);
}
params
.
put
(
"conds"
,
conds
);
params
.
put
(
"offset"
,
page
>
0
?
page
:
0
);
params
.
put
(
"limit"
,
pageSize
>
0
?
pageSize
:
0
);
params
.
put
(
"sort"
,
sort
);
return
getGenericMapper
().
fetchSearchByPage
(
params
);
}
}
\ No newline at end of file
aidea-modules/order-detail-module/src/main/java/com/cftech/orderdetail/web/OrderDetailsController.java
View file @
e1a7deba
...
...
@@ -11,11 +11,11 @@ import com.cftech.core.util.Constants;
import
com.cftech.sys.security.PermissionSign
;
import
com.cftech.sys.security.UserUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.multipart.MultipartFile
;
...
...
@@ -103,14 +103,21 @@ public class OrderDetailsController {
@ResponseBody
public
JSONObject
listData
(
int
iDisplayStart
,
int
iDisplayLength
,
OrderDetails
orderDetails
,
HttpServletRequest
request
)
{
Long
accountsId
=
UserUtils
.
getmpaccounts
(
request
);
String
userId
=
String
.
valueOf
(
UserUtils
.
getUser
().
getId
());
Conds
conds
=
new
Conds
();
conds
.
equal
(
"d.del_flag"
,
Constants
.
DEL_FLAG_0
);
conds
.
equal
(
"d.accounts_id"
,
accountsId
);
conds
.
like
(
"d.order_code"
,
orderDetails
.
getOrderCode
());
conds
.
like
(
"d.drugs_code"
,
orderDetails
.
getDrugsCode
());
if
(
StringUtils
.
isNoneBlank
(
orderDetails
.
getDrugsCode
()))
conds
.
like
(
"d.drugs_code"
,
orderDetails
.
getDrugsCode
());
if
(
StringUtils
.
isNoneBlank
(
orderDetails
.
getOrderCode
()))
conds
.
like
(
"d.order_code"
,
orderDetails
.
getOrderCode
());
Sort
sort
=
new
Sort
(
"d.create_time"
,
OrderType
.
DESC
);
List
<
OrderDetails
>
list
=
orderDetailsService
.
fetchSearchByPage
(
conds
,
sort
,
iDisplayStart
,
iDisplayLength
);
List
<
OrderDetails
>
list
=
orderDetailsService
.
fetchSearchByPageByUser
(
userId
,
conds
,
sort
,
iDisplayStart
,
iDisplayLength
);
Integer
counts
=
orderDetailsService
.
count
(
conds
);
JSONObject
rtnJson
=
new
JSONObject
();
rtnJson
.
put
(
"iTotalRecords"
,
counts
);
...
...
aidea-modules/product-detail-module-web/src/main/webapp/WEB-INF/views/productDetail/productDetaillist.html
View file @
e1a7deba
...
...
@@ -213,7 +213,7 @@
},{
"mData"
:
"productNumber"
},{
"mData"
:
"
productName
"
"mData"
:
""
},{
"mData"
:
"productImg"
},{
...
...
aidea-modules/waybill-module-web/src/main/webapp/WEB-INF/views/waybill/waybillform.html
View file @
e1a7deba
aidea-modules/waybill-module-web/src/main/webapp/WEB-INF/views/waybill/waybilllist.html
View file @
e1a7deba
...
...
@@ -91,7 +91,11 @@
<table
id=
"table"
class=
"table table-bordered table-striped"
>
<thead>
<tr>
<td
hidden=
"true"
>
Id
</td><th>
创建时间
</th>
<td
hidden=
"true"
>
Id
</td>
<th>
物流单编码
</th>
<th>
顺丰运单号
</th>
<th>
会员名称
</th>
<th>
联系人
</th>
<th>
操作
</th>
</tr>
</thead>
...
...
@@ -188,6 +192,18 @@
{
"mData"
:
"id"
},
{
"mData"
:
"number"
},
{
"mData"
:
"waybillNo"
},
{
"mData"
:
"memberName"
},
{
"mData"
:
"contact"
},
{
"mData"
:
"createTime"
},
...
...
@@ -201,7 +217,7 @@
},
{
"aTargets"
:
[
1
],
"aTargets"
:
[
5
],
"mData"
:
"createTime"
,
"mRender"
:
function
(
a
,
b
,
c
,
d
)
{
return
'<a href="#springUrl("/a/waybill/form?id='
+
c
.
id
+
'")" data-id="'
+
c
.
id
+
'" data-action="view">'
+
formatDates
(
a
,
"yyyy-MM-dd HH:mm:ss"
);
...
...
aidea-modules/waybill-module/src/main/java/com/cftech/waybill/dao/WaybillMapper.xml
View file @
e1a7deba
...
...
@@ -6,7 +6,7 @@
<id
column=
"id"
property=
"id"
/>
<result
column=
"consult_id"
property=
"consultId"
/>
<result
column=
"order_id"
property=
"orderId"
/>
<result
column=
"numbe
tr"
property=
"numbet
r"
/>
<result
column=
"numbe
r"
property=
"numbe
r"
/>
<result
column=
"member_id"
property=
"memberId"
/>
<result
column=
"open_id"
property=
"openId"
/>
<result
column=
"storage_manage"
property=
"storageManage"
/>
...
...
@@ -66,7 +66,40 @@
id,
consult_id,
order_id,
numbetr,
number,
member_id,
open_id,
storage_manage,
waybill_no,
language,
monthly_card,
express_type_id,
temperature_range,
AES_DECRYPT(contact, 'aideakey') contact,
AES_DECRYPT(mobile, 'aideakey') mobile,
AES_DECRYPT(province, 'aideakey') province,
AES_DECRYPT(city, 'aideakey') city,
AES_DECRYPT(county, 'aideakey') county,
AES_DECRYPT(address, 'aideakey') address,
address_id,
send_express_date,
accept_express_date,
waybill_remark,
accounts_id,
del_flag,
status,
create_time,
update_time,
description,
create_by,
update_by
</sql>
<sql
id=
"insertSqlColumns"
>
id,
consult_id,
order_id,
number,
member_id,
open_id,
storage_manage,
...
...
@@ -79,7 +112,7 @@
mobile,
province,
city,
AES_DECRYPT(county, 'aideakey')
,
county
,
address,
address_id,
send_express_date,
...
...
@@ -98,16 +131,16 @@
<insert
id=
"save"
parameterType=
"com.cftech.waybill.model.Waybill"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into t_
mp
_waybill
insert into t_
aidea
_waybill
(
<include
refid=
"
s
qlColumns"
/>
<include
refid=
"
insertS
qlColumns"
/>
)
values
(
#{id, jdbcType=BIGINT},
#{consultId, jdbcType=BIGINT},
#{orderId, jdbcType=BIGINT},
#{numbe
t
r, jdbcType=VARCHAR},
#{number, jdbcType=VARCHAR},
#{memberId, jdbcType=VARCHAR},
#{openId, jdbcType=VARCHAR},
#{storageManage, jdbcType=VARCHAR},
...
...
@@ -116,12 +149,12 @@
#{monthlyCard, jdbcType=VARCHAR},
#{expressTypeId, jdbcType=VARCHAR},
#{temperatureRange, jdbcType=VARCHAR},
#{contact, jdbcType=VARCHAR}
,
#{mobile, jdbcType=VARCHAR}
,
#{province, jdbcType=VARCHAR}
,
#{city, jdbcType=VARCHAR}
,
#{county, jdbcType=VARCHAR}
,
AES_ENCRYPT(#{
county, jdbcType=BINARY}, 'aideakey')
,
AES_ENCRYPT(#{contact, jdbcType=BINARY}, 'aideakey')
,
AES_ENCRYPT(#{mobile, jdbcType=BINARY}, 'aideakey')
,
AES_ENCRYPT(#{province, jdbcType=BINARY}, 'aideakey')
,
AES_ENCRYPT(#{city, jdbcType=BINARY}, 'aideakey')
,
AES_ENCRYPT(#{county, jdbcType=BINARY}, 'aideakey')
,
AES_ENCRYPT(#{
address, jdbcType=BINARY}, 'aideakey')
,
#{addressId, jdbcType=VARCHAR},
now(),
now(),
...
...
@@ -140,27 +173,65 @@
<select
id=
"fetchById"
parameterType=
"java.lang.Long"
resultMap=
"resultMap"
>
SELECT
<include
refid=
"sqlColumns"
/>
FROM t_
mp
_waybill t
FROM t_
aidea
_waybill t
WHERE t.id=#{id}
</select>
<select
id=
"count"
parameterType=
"java.util.Map"
resultType=
"java.lang.Integer"
>
SELECT COUNT(1) FROM t_
mp
_waybill
SELECT COUNT(1) FROM t_
aidea
_waybill
<include
refid=
"sqlWhere"
/>
</select>
<select
id=
"fetchSearchByPage"
parameterType=
"java.util.Map"
result
Map=
"resultMap
"
>
<select
id=
"fetchSearchByPage"
parameterType=
"java.util.Map"
result
Type=
"com.cftech.waybill.model.Waybill
"
>
SELECT
<include
refid=
"sqlColumns"
/>
FROM t_mp_waybill
t.id,
t.consult_id consultId,
t.order_id orderId,
t.number,
t.member_id memberId,
t.open_id openId,
t.storage_manage storageManage,
t.waybill_no waybillNo,
t.language,
t.monthly_card monthlyCard,
t.express_type_id expressTypeId,
t.temperature_range temperatureRange,
AES_DECRYPT(t.contact, 'aideakey') contact,
AES_DECRYPT(t.mobile, 'aideakey') mobile,
AES_DECRYPT(t.province, 'aideakey') province,
AES_DECRYPT(t.city, 'aideakey') city,
AES_DECRYPT(t.county, 'aideakey') county,
AES_DECRYPT(t.address, 'aideakey') address,
t.address_id addressId,
t.send_express_date sendExpressDate,
t.accept_express_date acceptExpressDate,
t.waybill_remark waybillRemark,
t.accounts_id accountsId,
t.del_flag delFlag,
t.status,
t.create_time createTime,
t.update_time updateTime,
t.description,
t.create_by,
t.update_by,
o.number orderCode,
od.drugs_num drugsNum,
od.drugs_name drugsName,
od.drugs_code drugsCode,
od.price,
AES_DECRYPT(m.name, 'aideakey') memberName
FROM t_aidea_waybill t
LEFT JOIN t_order o ON t.order_id = o.id
LEFT JOIN t_order_details od ON o.id = order_id
LEFT JOIN wx_mp_member m ON t.member_id = m.id
<include
refid=
"sqlWhere"
/>
<if
test=
"sort!=null"
>
ORDER BY ${sort.param} ${sort.type}
</if>
<if
test=
"limit>0"
>
limit #{offset},#{limit}
</if>
</select>
<update
id=
"update"
parameterType=
"com.cftech.waybill.model.Waybill"
>
update t_
mp
_waybill
update t_
aidea
_waybill
<set>
<if
test=
"id != null"
>
id = #{id, jdbcType=BIGINT},
...
...
@@ -171,8 +242,8 @@
<if
test=
"orderId != null"
>
order_id = #{orderId, jdbcType=BIGINT},
</if>
<if
test=
"numbe
t
r != null"
>
numbe
tr = #{numbet
r, jdbcType=VARCHAR},
<if
test=
"number != null"
>
numbe
r = #{numbe
r, jdbcType=VARCHAR},
</if>
<if
test=
"memberId != null"
>
member_id = #{memberId, jdbcType=VARCHAR},
...
...
@@ -199,22 +270,22 @@
temperature_range = #{temperatureRange, jdbcType=VARCHAR},
</if>
<if
test=
"contact != null"
>
contact =
#{contact, jdbcType=VARCHAR}
,
contact =
AES_ENCRYPT(#{contact, jdbcType=BINARY}, 'aideakey')
,
</if>
<if
test=
"mobile != null"
>
mobile =
#{mobile, jdbcType=VARCHAR}
,
mobile =
AES_ENCRYPT(#{mobile, jdbcType=BINARY}, 'aideakey')
,
</if>
<if
test=
"province != null"
>
province =
#{province, jdbcType=VARCHAR}
,
province =
AES_ENCRYPT(#{province, jdbcType=BINARY}, 'aideakey')
,
</if>
<if
test=
"city != null"
>
city =
#{city, jdbcType=VARCHAR}
,
city =
AES_ENCRYPT(#{city, jdbcType=BINARY}, 'aideakey')
,
</if>
<if
test=
"county != null"
>
county =
#{county, jdbcType=VARCHAR}
,
county =
AES_ENCRYPT(#{county, jdbcType=BINARY}, 'aideakey')
,
</if>
<if
test=
"address != null"
>
address =
#{address, jdbcType=VARCHAR}
,
address =
AES_ENCRYPT(#{address, jdbcType=BINARY}, 'aideakey')
,
</if>
<if
test=
"addressId != null"
>
address_id = #{addressId, jdbcType=VARCHAR},
...
...
@@ -254,6 +325,6 @@
</update>
<update
id=
"delete"
parameterType=
"java.lang.Long"
>
update t_
mp
_waybill set del_flag=1 where id=#{id,jdbcType=BIGINT}
update t_
aidea
_waybill set del_flag=1 where id=#{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
aidea-modules/waybill-module/src/main/java/com/cftech/waybill/model/Waybill.java
View file @
e1a7deba
...
...
@@ -25,7 +25,7 @@ public class Waybill implements Serializable {
private
Long
orderId
;
/* 物流单编码 */
@ExportConfig
(
value
=
"物流单编码"
,
width
=
100
,
showLevel
=
1
)
private
String
numbe
t
r
;
private
String
number
;
/* 会员Id */
@ExportConfig
(
value
=
"会员Id"
,
width
=
100
,
showLevel
=
1
)
private
String
memberId
;
...
...
@@ -97,6 +97,16 @@ public class Waybill implements Serializable {
/* 更新人 */
private
Long
updateBy
;
/**
* 非数据库字段
*/
private
String
orderCode
;
private
String
drugsNum
;
private
String
drugsName
;
private
String
drugsCode
;
private
String
price
;
private
String
memberName
;
public
Waybill
()
{
this
.
delFlag
=
false
;
this
.
status
=
"0"
;
...
...
aidea-modules/waybill-module/src/main/java/com/cftech/waybill/utils/ExpressOrderInfoUtils.java
View file @
e1a7deba
...
...
@@ -47,11 +47,11 @@ public class ExpressOrderInfoUtils {
//业务需要增加
waybill
.
put
(
"isReturnQRCode"
,
"1"
);
//是否返回用来推送业务的二维码 1:返回 0:不返回
waybill
.
put
(
"specialDeliveryTypeCode"
,
"1"
);
//特殊派送类型代码 1:身份验证
waybill
.
put
(
"specialDeliveryValue"
,
"12345678"
);
//特殊派件具体表述 证件类型:证件后8位如:1:09296231(1 表示身份证,暂不支持其他证件)
waybill
.
put
(
"isReturnSignBackRoutelabel"
,
"1
"
);
//是否返回签回单路由标签: 默认0, 1:返回路由标签,0:不返回
waybill
.
put
(
"isReturnRoutelabel"
,
"
1
"
);
//是否返回路由标签: 默认0, 1:返回路由标签, 0:不返回
waybill
.
put
(
"podModelAddress"
,
"url"
);
//签单返回范本地址
//
waybill.put("specialDeliveryTypeCode", "1");//特殊派送类型代码 1:身份验证
//
waybill.put("specialDeliveryValue", "12345678");//特殊派件具体表述 证件类型:证件后8位如:1:09296231(1 表示身份证,暂不支持其他证件)
//waybill.put("isReturnSignBackRoutelabel", "0
");//是否返回签回单路由标签: 默认0, 1:返回路由标签,0:不返回
waybill
.
put
(
"isReturnRoutelabel"
,
"
0
"
);
//是否返回路由标签: 默认0, 1:返回路由标签, 0:不返回
//
waybill.put("podModelAddress", "url");//签单返回范本地址
//特殊需求药品,需冷冻、冷藏
if
(
StringUtils
.
isNoneBlank
(
waybillObj
.
getExpressTypeId
()))
{
...
...
aidea-modules/waybill-module/src/main/java/com/cftech/waybill/utils/FqHttpUtils.java
View file @
e1a7deba
...
...
@@ -15,13 +15,20 @@ import org.apache.http.client.entity.UrlEncodedFormEntity;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpGet
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.conn.ssl.SSLConnectionSocketFactory
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClientBuilder
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.http.message.BasicNameValuePair
;
import
org.apache.http.ssl.SSLContextBuilder
;
import
org.apache.http.util.EntityUtils
;
import
javax.net.ssl.SSLContext
;
import
java.io.*
;
import
java.security.KeyManagementException
;
import
java.security.KeyStoreException
;
import
java.security.NoSuchAlgorithmException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
...
...
@@ -41,7 +48,8 @@ public class FqHttpUtils {
/**
* 顺丰合作伙伴Id
*/
private
static
final
String
partnerId
=
SystemConfig
.
p
.
getProperty
(
"sf.partnerID"
);
//private static final String partnerId = SystemConfig.p.getProperty("sf.partnerID");
private
static
final
String
partnerId
=
"XXYZ"
;
private
static
Map
<
String
,
String
>
headers
=
new
HashMap
<>();
...
...
@@ -168,15 +176,12 @@ public class FqHttpUtils {
}
public
static
CloseableHttpEntity
sendHttpPost
(
String
url
,
List
<
BasicNameValuePair
>
content
)
{
if
(!
url
.
contains
(
"/"
))
{
return
null
;
}
String
dateStr
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
new
Date
());
//构建HttpClient实例
CloseableHttpClient
http
c
lient
=
null
;
CloseableHttpClient
http
C
lient
=
null
;
CloseableHttpResponse
httpResponse
=
null
;
try
{
httpclient
=
HttpClients
.
createDefault
();
SSLContext
sslContext
=
SSLContextBuilder
.
create
().
useProtocol
(
SSLConnectionSocketFactory
.
SSL
).
loadTrustMaterial
((
x
,
y
)
->
true
).
build
();
httpClient
=
HttpClientBuilder
.
create
().
setDefaultRequestConfig
(
requestConfig
).
setSSLContext
(
sslContext
).
setSSLHostnameVerifier
((
x
,
y
)
->
true
).
build
();
//指定POST请求
HttpPost
httpPost
=
new
HttpPost
(
url
);
httpPost
.
setConfig
(
requestConfig
);
...
...
@@ -196,23 +201,35 @@ public class FqHttpUtils {
//发送请求
httpPost
.
setEntity
(
request
);
httpResponse
=
http
c
lient
.
execute
(
httpPost
);
httpResponse
=
http
C
lient
.
execute
(
httpPost
);
//读取响应
HttpEntity
entity
=
httpResponse
.
getEntity
();
if
(
entity
!=
null
)
{
String
result
=
EntityUtils
.
toString
(
entity
,
CHARACTER_CODE_UTF8
);
System
.
out
.
println
(
result
);
log
.
info
(
result
);
return
new
CloseableHttpEntity
(
httpResponse
.
getStatusLine
().
getStatusCode
(),
result
==
null
?
null
:
JSONObject
.
parseObject
(
result
));
}
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
log
.
error
(
"API HTTP POST UnsupportedEncodingException 请求异常 url={"
+
url
+
"}; error = "
+
e
.
getMessage
()
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
log
.
error
(
"API HTTP POST IOException 请求异常 url={"
+
url
+
"}; error = "
+
e
.
getMessage
()
);
}
catch
(
NoSuchAlgorithmException
e
)
{
e
.
printStackTrace
();
log
.
error
(
"API HTTP POST NoSuchAlgorithmException 请求异常 url={"
+
url
+
"}; error = "
+
e
.
getMessage
()
);
}
catch
(
KeyStoreException
e
)
{
e
.
printStackTrace
();
log
.
error
(
"API HTTP POST KeyStoreException 请求异常 url={"
+
url
+
"}; error = "
+
e
.
getMessage
()
);
}
catch
(
KeyManagementException
e
)
{
e
.
printStackTrace
();
log
.
error
(
"API HTTP POST KeyManagementException 请求异常 url={"
+
url
+
"}; error = "
+
e
.
getMessage
()
);
}
finally
{
if
(
http
c
lient
!=
null
)
{
if
(
http
C
lient
!=
null
)
{
try
{
http
c
lient
.
close
();
http
C
lient
.
close
();
}
catch
(
IOException
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