Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
C
chinafrica
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
zhengfg
chinafrica
Commits
f51fc563
提交
f51fc563
authored
12月 05, 2019
作者:
luojie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
汇率实时更新
上级
ea9817b1
显示空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
263 行增加
和
10 行删除
+263
-10
TbCfPlatformOrderDao.java
.../src/main/java/com/platform/dao/TbCfPlatformOrderDao.java
+2
-0
TbCfExpressTemplateEntity.java
...n/java/com/platform/entity/TbCfExpressTemplateEntity.java
+12
-0
TbCfItemOrderREntity.java
...c/main/java/com/platform/entity/TbCfItemOrderREntity.java
+16
-0
TbCfPlatformOrderService.java
...n/java/com/platform/service/TbCfPlatformOrderService.java
+2
-0
TbCfExpressTemplateServiceImpl.java
...platform/service/impl/TbCfExpressTemplateServiceImpl.java
+1
-1
TbCfPlatformOrderServiceImpl.java
...m/platform/service/impl/TbCfPlatformOrderServiceImpl.java
+5
-0
ExpressStatusTask.java
...in/src/main/java/com/platform/task/ExpressStatusTask.java
+2
-1
TbCfExpressTemplateDao.xml
...ain/resources/com/platform/dao/TbCfExpressTemplateDao.xml
+8
-2
TbCfItemOrderRDao.xml
...src/main/resources/com/platform/dao/TbCfItemOrderRDao.xml
+7
-1
tbcfexpresstemplate.html
...src/main/webapp/WEB-INF/page/sys/tbcfexpresstemplate.html
+8
-2
tbcffee.html
platform-admin/src/main/webapp/WEB-INF/page/sys/tbcffee.html
+1
-1
tbcfcoupon.js
platform-admin/src/main/webapp/js/sys/tbcfcoupon.js
+1
-1
tbcfexpresstemplate.js
platform-admin/src/main/webapp/js/sys/tbcfexpresstemplate.js
+1
-0
pom.xml
platform-common/pom.xml
+6
-1
SMSUtils.java
...orm-common/src/main/java/com/platform/utils/SMSUtils.java
+191
-0
没有找到文件。
platform-admin/src/main/java/com/platform/dao/TbCfPlatformOrderDao.java
浏览文件 @
f51fc563
...
@@ -26,4 +26,6 @@ public interface TbCfPlatformOrderDao extends BaseDao<PlatformOrderVo> {
...
@@ -26,4 +26,6 @@ public interface TbCfPlatformOrderDao extends BaseDao<PlatformOrderVo> {
int
getOrderId
(
String
sid
);
int
getOrderId
(
String
sid
);
TbCfItemOrderREntity
getOrdersId
(
String
sid
);
TbCfItemOrderREntity
getOrdersId
(
String
sid
);
int
findUserByExpressNumber
(
String
[]
sids
);
}
}
platform-admin/src/main/java/com/platform/entity/TbCfExpressTemplateEntity.java
浏览文件 @
f51fc563
...
@@ -30,6 +30,10 @@ public class TbCfExpressTemplateEntity implements Serializable {
...
@@ -30,6 +30,10 @@ public class TbCfExpressTemplateEntity implements Serializable {
* 快递费
* 快递费
*/
*/
private
BigDecimal
expressFee
;
private
BigDecimal
expressFee
;
/**
* 快递费
*/
private
BigDecimal
continuationFee
;
/**
/**
* 国家编号
* 国家编号
*/
*/
...
@@ -117,4 +121,12 @@ public class TbCfExpressTemplateEntity implements Serializable {
...
@@ -117,4 +121,12 @@ public class TbCfExpressTemplateEntity implements Serializable {
public
Date
getCreateTime
()
{
public
Date
getCreateTime
()
{
return
createTime
;
return
createTime
;
}
}
public
BigDecimal
getContinuationFee
()
{
return
continuationFee
;
}
public
void
setContinuationFee
(
BigDecimal
continuationFee
)
{
this
.
continuationFee
=
continuationFee
;
}
}
}
platform-admin/src/main/java/com/platform/entity/TbCfItemOrderREntity.java
浏览文件 @
f51fc563
...
@@ -34,9 +34,17 @@ public class TbCfItemOrderREntity implements Serializable {
...
@@ -34,9 +34,17 @@ public class TbCfItemOrderREntity implements Serializable {
private
Integer
deliveryFlag
;
private
Integer
deliveryFlag
;
/**
* 是否已发送短信
*/
private
Integer
isSend
;
private
Date
deliveryTime
;
private
Date
deliveryTime
;
private
Date
closeTime
;
private
Date
closeTime
;
private
Date
updateTime
;
private
Date
updateTime
;
/**
/**
* 设置:记录表
* 设置:记录表
*/
*/
...
@@ -129,4 +137,12 @@ public class TbCfItemOrderREntity implements Serializable {
...
@@ -129,4 +137,12 @@ public class TbCfItemOrderREntity implements Serializable {
public
void
setUpdateTime
(
Date
updateTime
)
{
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
this
.
updateTime
=
updateTime
;
}
}
public
Integer
getIsSend
()
{
return
isSend
;
}
public
void
setIsSend
(
Integer
isSend
)
{
this
.
isSend
=
isSend
;
}
}
}
platform-admin/src/main/java/com/platform/service/TbCfPlatformOrderService.java
浏览文件 @
f51fc563
...
@@ -72,4 +72,6 @@ public interface TbCfPlatformOrderService {
...
@@ -72,4 +72,6 @@ public interface TbCfPlatformOrderService {
int
getOrderId
(
String
sid
);
int
getOrderId
(
String
sid
);
TbCfItemOrderREntity
getOrdersId
(
String
sid
);
TbCfItemOrderREntity
getOrdersId
(
String
sid
);
int
findUserByExpressNumber
(
String
[]
sids
);
}
}
platform-admin/src/main/java/com/platform/service/impl/TbCfExpressTemplateServiceImpl.java
浏览文件 @
f51fc563
...
@@ -38,7 +38,7 @@ public class TbCfExpressTemplateServiceImpl implements TbCfExpressTemplateServic
...
@@ -38,7 +38,7 @@ public class TbCfExpressTemplateServiceImpl implements TbCfExpressTemplateServic
@Override
@Override
public
int
save
(
TbCfExpressTemplateEntity
tbCfExpressTemplate
)
{
public
int
save
(
TbCfExpressTemplateEntity
tbCfExpressTemplate
)
{
tbCfExpressTemplate
.
setTemplateId
(
IdUtil
.
createIdbyUUID
());
tbCfExpressTemplate
.
setTemplateId
(
tbCfExpressTemplate
.
getTemplateId
());
return
tbCfExpressTemplateDao
.
save
(
tbCfExpressTemplate
);
return
tbCfExpressTemplateDao
.
save
(
tbCfExpressTemplate
);
}
}
...
...
platform-admin/src/main/java/com/platform/service/impl/TbCfPlatformOrderServiceImpl.java
浏览文件 @
f51fc563
...
@@ -78,4 +78,9 @@ public class TbCfPlatformOrderServiceImpl implements TbCfPlatformOrderService {
...
@@ -78,4 +78,9 @@ public class TbCfPlatformOrderServiceImpl implements TbCfPlatformOrderService {
public
TbCfItemOrderREntity
getOrdersId
(
String
sid
)
{
public
TbCfItemOrderREntity
getOrdersId
(
String
sid
)
{
return
tbCfPlatformOrderDao
.
getOrdersId
(
sid
);
return
tbCfPlatformOrderDao
.
getOrdersId
(
sid
);
}
}
@Override
public
int
findUserByExpressNumber
(
String
[]
sids
)
{
return
tbCfPlatformOrderDao
.
findUserByExpressNumber
(
sids
);
}
}
}
platform-admin/src/main/java/com/platform/task/ExpressStatusTask.java
浏览文件 @
f51fc563
...
@@ -87,7 +87,8 @@ public class ExpressStatusTask {
...
@@ -87,7 +87,8 @@ public class ExpressStatusTask {
sids
[
i
]=
object
.
getString
(
"sid"
);
sids
[
i
]=
object
.
getString
(
"sid"
);
}
}
if
(
sids
.
length
!=
0
)
{
if
(
sids
.
length
!=
0
)
{
tbCfItemOrderRService
.
updateExpressStatuss
(
sids
);
int
i
=
tbCfItemOrderRService
.
updateExpressStatuss
(
sids
);
// tbCfPlatformOrderService.findUserByExpressNumber(sids);
System
.
out
.
println
(
"修改了:"
+
sids
.
length
+
"条数据"
);
System
.
out
.
println
(
"修改了:"
+
sids
.
length
+
"条数据"
);
}
}
long
endTime
=
System
.
currentTimeMillis
();
long
endTime
=
System
.
currentTimeMillis
();
...
...
platform-admin/src/main/resources/com/platform/dao/TbCfExpressTemplateDao.xml
浏览文件 @
f51fc563
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
<result
property=
"templateTitle"
column=
"template_title"
/>
<result
property=
"templateTitle"
column=
"template_title"
/>
<result
property=
"itemCategoryId"
column=
"item_category_id"
/>
<result
property=
"itemCategoryId"
column=
"item_category_id"
/>
<result
property=
"expressFee"
column=
"express_fee"
/>
<result
property=
"expressFee"
column=
"express_fee"
/>
<result
property=
"continuationFee"
column=
"continuation_fee"
/>
<result
property=
"countryCode"
column=
"country_code"
/>
<result
property=
"countryCode"
column=
"country_code"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"createTime"
column=
"create_time"
/>
</resultMap>
</resultMap>
...
@@ -19,7 +20,8 @@
...
@@ -19,7 +20,8 @@
`item_category_id`,
`item_category_id`,
`express_fee`,
`express_fee`,
`country_code`,
`country_code`,
`create_time`
`create_time`,
`continuation_fee`
from tb_cf_express_template
from tb_cf_express_template
where template_id = #{id}
where template_id = #{id}
</select>
</select>
...
@@ -30,6 +32,7 @@
...
@@ -30,6 +32,7 @@
`template_title`,
`template_title`,
`item_category_id`,
`item_category_id`,
`express_fee`,
`express_fee`,
`continuation_fee`,
`country_code`,
`country_code`,
`create_time`
`create_time`
from tb_cf_express_template
from tb_cf_express_template
...
@@ -64,6 +67,7 @@
...
@@ -64,6 +67,7 @@
`template_title`,
`template_title`,
`item_category_id`,
`item_category_id`,
`express_fee`,
`express_fee`,
`continuation_fee`,
`country_code`,
`country_code`,
`create_time`)
`create_time`)
values(
values(
...
@@ -71,6 +75,7 @@
...
@@ -71,6 +75,7 @@
#{templateTitle},
#{templateTitle},
#{itemCategoryId},
#{itemCategoryId},
#{expressFee},
#{expressFee},
#{continuationFee},
#{countryCode},
#{countryCode},
#{createTime})
#{createTime})
</insert>
</insert>
...
@@ -81,6 +86,7 @@
...
@@ -81,6 +86,7 @@
<if
test=
"templateTitle != null"
>
`template_title` = #{templateTitle},
</if>
<if
test=
"templateTitle != null"
>
`template_title` = #{templateTitle},
</if>
<if
test=
"itemCategoryId != null"
>
`item_category_id` = #{itemCategoryId},
</if>
<if
test=
"itemCategoryId != null"
>
`item_category_id` = #{itemCategoryId},
</if>
<if
test=
"expressFee != null"
>
`express_fee` = #{expressFee},
</if>
<if
test=
"expressFee != null"
>
`express_fee` = #{expressFee},
</if>
<if
test=
"continuationFee != null"
>
`continuation_fee` = #{continuationFee},
</if>
<if
test=
"countryCode != null"
>
`country_code` = #{countryCode},
</if>
<if
test=
"countryCode != null"
>
`country_code` = #{countryCode},
</if>
<if
test=
"createTime != null"
>
`create_time` = #{createTime}
</if>
<if
test=
"createTime != null"
>
`create_time` = #{createTime}
</if>
</set>
</set>
...
...
platform-admin/src/main/resources/com/platform/dao/TbCfItemOrderRDao.xml
浏览文件 @
f51fc563
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
<result
property=
"deliveryTime"
column=
"delivery_time"
/>
<result
property=
"deliveryTime"
column=
"delivery_time"
/>
<result
property=
"closeTime"
column=
"close_time"
/>
<result
property=
"closeTime"
column=
"close_time"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"isSend"
column=
"is_send"
/>
</resultMap>
</resultMap>
<select
id=
"queryObject"
resultType=
"com.platform.entity.TbCfItemOrderREntity"
>
<select
id=
"queryObject"
resultType=
"com.platform.entity.TbCfItemOrderREntity"
>
...
@@ -25,6 +26,7 @@
...
@@ -25,6 +26,7 @@
`delivery_flag`,
`delivery_flag`,
`delivery_time`,
`delivery_time`,
`close_time`,
`close_time`,
`is_send`,
`update_time`
`update_time`
from tb_cf_item_order_r
from tb_cf_item_order_r
where order_item_id = #{id}
where order_item_id = #{id}
...
@@ -40,6 +42,7 @@
...
@@ -40,6 +42,7 @@
`delivery_flag`,
`delivery_flag`,
`delivery_time`,
`delivery_time`,
`close_time`,
`close_time`,
`is_send`,
`update_time`
`update_time`
from tb_cf_item_order_r
from tb_cf_item_order_r
WHERE 1=1
WHERE 1=1
...
@@ -77,6 +80,7 @@
...
@@ -77,6 +80,7 @@
`delivery_flag`,
`delivery_flag`,
`delivery_time`,
`delivery_time`,
`close_time`,
`close_time`,
`is_send`,
`update_time`)
`update_time`)
values(
values(
#{orderItemId},
#{orderItemId},
...
@@ -87,6 +91,7 @@
...
@@ -87,6 +91,7 @@
#{deliveryFlag},
#{deliveryFlag},
#{deliveryTime},
#{deliveryTime},
#{closeTime},
#{closeTime},
#{isSend},
#{updateTime})
#{updateTime})
</insert>
</insert>
...
@@ -100,6 +105,7 @@
...
@@ -100,6 +105,7 @@
<if
test=
"deliveryFlag != null"
>
`delivery_flag` = #{deliveryFlag},
</if>
<if
test=
"deliveryFlag != null"
>
`delivery_flag` = #{deliveryFlag},
</if>
<if
test=
"deliveryTime != null"
>
`delivery_time` = #{deliveryTime},
</if>
<if
test=
"deliveryTime != null"
>
`delivery_time` = #{deliveryTime},
</if>
<if
test=
"closeTime != null"
>
`close_time` = #{closeTime},
</if>
<if
test=
"closeTime != null"
>
`close_time` = #{closeTime},
</if>
<if
test=
"isSend != null"
>
`is_send` = #{isSend},
</if>
<if
test=
"updateTime != null"
>
`update_time` = #{updateTime}
</if>
<if
test=
"updateTime != null"
>
`update_time` = #{updateTime}
</if>
</set>
</set>
where order_item_id = #{orderItemId}
where order_item_id = #{orderItemId}
...
@@ -161,7 +167,7 @@
...
@@ -161,7 +167,7 @@
<update
id=
"updateExpressStatuss"
>
<update
id=
"updateExpressStatuss"
>
UPDATE tb_cf_order o,tb_cf_platform_order p,tb_cf_item_order_r i
UPDATE tb_cf_order o,tb_cf_platform_order p,tb_cf_item_order_r i
SET i.delivery_flag = 40
SET i.delivery_flag = 40
WHERE o.order_id=p.order_id and i.order_id=o.order_id and i.delivery_flag=20 and p.p_express_number in
WHERE o.order_id=p.order_id and i.order_id=o.order_id and i.delivery_flag=20 and
i.is_send=0 and
p.p_express_number in
<foreach
collection=
"array"
item=
"sids"
open=
"("
separator=
","
close=
")"
>
<foreach
collection=
"array"
item=
"sids"
open=
"("
separator=
","
close=
")"
>
#{sids}
#{sids}
</foreach>
</foreach>
...
...
platform-admin/src/main/webapp/WEB-INF/page/sys/tbcfexpresstemplate.html
浏览文件 @
f51fc563
...
@@ -21,9 +21,9 @@
...
@@ -21,9 +21,9 @@
<i-button
@
click=
"reloadSearch"
>
重置
</i-button>
<i-button
@
click=
"reloadSearch"
>
重置
</i-button>
</div>
</div>
<div
class=
"buttons-group"
>
<div
class=
"buttons-group"
>
#if($shiro.hasPermission("tbcfexpresstemplate
:save"))
<!-- #if($shiro.hasPermission("tbcfcoupon
:save"))
<i-button type="info" @click="add"><i class="fa fa-plus"></i> 新增</i-button>
<i-button type="info" @click="add"><i class="fa fa-plus"></i> 新增</i-button>
#end
#end
-->
#if($shiro.hasPermission("tbcfexpresstemplate:update"))
#if($shiro.hasPermission("tbcfexpresstemplate:update"))
<i-button
type=
"warning"
@
click=
"update"
><i
class=
"fa fa-pencil-square-o"
></i>
修改
</i-button>
<i-button
type=
"warning"
@
click=
"update"
><i
class=
"fa fa-pencil-square-o"
></i>
修改
</i-button>
#end
#end
...
@@ -38,6 +38,9 @@
...
@@ -38,6 +38,9 @@
<Card
v-show=
"!showList"
>
<Card
v-show=
"!showList"
>
<p
slot=
"title"
>
{{title}}
</p>
<p
slot=
"title"
>
{{title}}
</p>
<i-form
ref=
"formValidate"
:model=
"tbCfExpressTemplate"
:rules=
"ruleValidate"
:label-width=
"80"
>
<i-form
ref=
"formValidate"
:model=
"tbCfExpressTemplate"
:rules=
"ruleValidate"
:label-width=
"80"
>
<Form-item
label=
"模板ID"
prop=
"templateId"
>
<i-input
v-model=
"tbCfExpressTemplate.templateId"
placeholder=
"模板ID"
/>
</Form-item>
<Form-item
label=
"模板标题"
prop=
"templateTitle"
>
<Form-item
label=
"模板标题"
prop=
"templateTitle"
>
<i-input
v-model=
"tbCfExpressTemplate.templateTitle"
placeholder=
"模板标题"
/>
<i-input
v-model=
"tbCfExpressTemplate.templateTitle"
placeholder=
"模板标题"
/>
</Form-item>
</Form-item>
...
@@ -47,6 +50,9 @@
...
@@ -47,6 +50,9 @@
<Form-item
label=
"快递费"
prop=
"expressFee"
>
<Form-item
label=
"快递费"
prop=
"expressFee"
>
<i-input
v-model=
"tbCfExpressTemplate.expressFee"
placeholder=
"快递费"
/>
<i-input
v-model=
"tbCfExpressTemplate.expressFee"
placeholder=
"快递费"
/>
</Form-item>
</Form-item>
<Form-item
label=
"续件费"
prop=
"expressFee"
>
<i-input
v-model=
"tbCfExpressTemplate.continuationFee"
placeholder=
"续件费"
/>
</Form-item>
<!--<Form-item label="国家编号" prop="countryCode">
<!--<Form-item label="国家编号" prop="countryCode">
<i-input v-model="tbCfExpressTemplate.countryCode" placeholder="国家编号"/>
<i-input v-model="tbCfExpressTemplate.countryCode" placeholder="国家编号"/>
</Form-item>
</Form-item>
...
...
platform-admin/src/main/webapp/WEB-INF/page/sys/tbcffee.html
浏览文件 @
f51fc563
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
<i-input
v-model=
"tbCfFee.feePercent"
placeholder=
"收取费用百分比"
/>
<i-input
v-model=
"tbCfFee.feePercent"
placeholder=
"收取费用百分比"
/>
</Form-item>
</Form-item>
<Form-item
label=
"设置美元转换"
prop=
"feeRate"
>
<Form-item
label=
"设置美元转换"
prop=
"feeRate"
>
<i-input
v-model=
"tbCfFee.feeRate"
placeholder=
"设置美元转换"
/>
<i-input
v-model=
"tbCfFee.feeRate"
placeholder=
"设置美元转换"
disabled=
"true"
/>
</Form-item>
</Form-item>
<Form-item>
<Form-item>
<i-button
type=
"primary"
@
click=
"handleSubmit('formValidate')"
>
提交
</i-button>
<i-button
type=
"primary"
@
click=
"handleSubmit('formValidate')"
>
提交
</i-button>
...
...
platform-admin/src/main/webapp/js/sys/tbcfcoupon.js
浏览文件 @
f51fc563
...
@@ -391,6 +391,6 @@ let vm = new Vue({
...
@@ -391,6 +391,6 @@ let vm = new Vue({
handleReset2
:
function
(
name
)
{
handleReset2
:
function
(
name
)
{
handleResetForm
(
this
,
name
);
handleResetForm
(
this
,
name
);
}
}
,
}
}
});
});
platform-admin/src/main/webapp/js/sys/tbcfexpresstemplate.js
浏览文件 @
f51fc563
...
@@ -6,6 +6,7 @@ $(function () {
...
@@ -6,6 +6,7 @@ $(function () {
{
label
:
'模板标题'
,
name
:
'templateTitle'
,
index
:
'template_title'
,
width
:
80
},
{
label
:
'模板标题'
,
name
:
'templateTitle'
,
index
:
'template_title'
,
width
:
80
},
{
label
:
'商品类型 暂无用,用tb_cf_exp_cat_rel关联'
,
name
:
'itemCategoryId'
,
index
:
'item_category_id'
,
width
:
80
,
hidden
:
true
},
{
label
:
'商品类型 暂无用,用tb_cf_exp_cat_rel关联'
,
name
:
'itemCategoryId'
,
index
:
'item_category_id'
,
width
:
80
,
hidden
:
true
},
{
label
:
'快递费'
,
name
:
'expressFee'
,
index
:
'express_fee'
,
width
:
80
},
{
label
:
'快递费'
,
name
:
'expressFee'
,
index
:
'express_fee'
,
width
:
80
},
{
label
:
'续件费'
,
name
:
'continuationFee'
,
index
:
'continuation_fee'
,
width
:
80
},
{
label
:
'国家编号'
,
name
:
'countryCode'
,
index
:
'country_code'
,
width
:
80
,
hidden
:
true
},
{
label
:
'国家编号'
,
name
:
'countryCode'
,
index
:
'country_code'
,
width
:
80
,
hidden
:
true
},
{
label
:
'创建日期'
,
name
:
'createTime'
,
index
:
'create_time'
,
width
:
80
,
hidden
:
true
}]
{
label
:
'创建日期'
,
name
:
'createTime'
,
index
:
'create_time'
,
width
:
80
,
hidden
:
true
}]
});
});
...
...
platform-common/pom.xml
浏览文件 @
f51fc563
...
@@ -21,9 +21,14 @@
...
@@ -21,9 +21,14 @@
<qcloud-cos-version>
4.4
</qcloud-cos-version>
<qcloud-cos-version>
4.4
</qcloud-cos-version>
<jackson.version>
2.5.0
</jackson.version>
<jackson.version>
2.5.0
</jackson.version>
<poi.version>
3.15
</poi.version>
<poi.version>
3.15
</poi.version>
<yunpian-version>
1.2.7
</yunpian-version>
</properties>
</properties>
<dependencies>
<dependencies>
<dependency>
<groupId>
com.yunpian.sdk
</groupId>
<artifactId>
yunpian-java-sdk
</artifactId>
<version>
${yunpian-version}
</version>
</dependency>
<dependency>
<dependency>
<groupId>
com.qiniu
</groupId>
<groupId>
com.qiniu
</groupId>
<artifactId>
qiniu-java-sdk
</artifactId>
<artifactId>
qiniu-java-sdk
</artifactId>
...
...
platform-common/src/main/java/com/platform/utils/SMSUtils.java
0 → 100644
浏览文件 @
f51fc563
package
com
.
platform
.
utils
;
import
com.platform.utils.util.SMSUtil
;
import
com.yunpian.sdk.YunpianClient
;
import
com.yunpian.sdk.constant.YunpianConstant
;
import
com.yunpian.sdk.model.SmsBatchSend
;
import
org.apache.commons.lang3.RandomStringUtils
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.NameValuePair
;
import
org.apache.http.client.entity.UrlEncodedFormEntity
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.http.message.BasicNameValuePair
;
import
org.apache.http.util.EntityUtils
;
import
java.io.IOException
;
import
java.net.URISyntaxException
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 短信接口类
*
* @author lyl
* <p>
* 2018年4月18日
*/
public
class
SMSUtils
{
//查账户信息的http地址
private
static
String
URI_GET_USER_INFO
=
"https://sms.yunpian.com/v2/user/get.json"
;
//模板发送接口的http地址
private
static
String
URI_TPL_SEND_SMS
=
"https://sms.yunpian.com/v2/sms/tpl_single_send.json"
;
private
static
String
URI_SINGLE_SEND_SMS
=
"https://sms.yunpian.com/v2/sms/single_send.json"
;
//编码格式。发送编码格式统一用UTF-8
private
static
String
ENCODING
=
"UTF-8"
;
private
static
String
API_KEY
=
"cb20310db0e7dcc76a827afbd2ba548f"
;
/**
* 查询用户信息
*
* @param apikey
* @return
* @throws IOException
* @throws URISyntaxException
*/
public
static
String
getUserInfo
(
String
apikey
)
throws
IOException
,
URISyntaxException
{
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
params
.
put
(
"apikey"
,
apikey
);
return
post
(
URI_GET_USER_INFO
,
params
);
}
/**
* 提交响应
*
* @param url
* @param paramsMap
* @return
*/
public
static
String
post
(
String
url
,
Map
<
String
,
String
>
paramsMap
)
{
CloseableHttpClient
client
=
HttpClients
.
createDefault
();
String
responseText
=
""
;
CloseableHttpResponse
response
=
null
;
try
{
HttpPost
method
=
new
HttpPost
(
url
);
if
(
paramsMap
!=
null
)
{
List
<
NameValuePair
>
paramList
=
new
ArrayList
<
NameValuePair
>();
for
(
Map
.
Entry
<
String
,
String
>
param
:
paramsMap
.
entrySet
())
{
NameValuePair
pair
=
new
BasicNameValuePair
(
param
.
getKey
(),
param
.
getValue
());
paramList
.
add
(
pair
);
}
method
.
setEntity
(
new
UrlEncodedFormEntity
(
paramList
,
ENCODING
));
}
response
=
client
.
execute
(
method
);
HttpEntity
entity
=
response
.
getEntity
();
if
(
entity
!=
null
)
{
responseText
=
EntityUtils
.
toString
(
entity
,
ENCODING
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
response
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
return
responseText
;
}
/**
* 发送验证码
*
* @return
* @throws IOException
*/
public
static
String
yzCode
(
String
phone
)
throws
IOException
{
if
(
phone
.
equals
(
null
))
{
return
"error"
;
}
//编码格式。发送编码格式统一用UTF-8
String
ENCODING
=
"UTF-8"
;
long
tpl_id
=
3253208
;
//模板ID
String
code
=
RandomStringUtils
.
randomNumeric
(
6
);
// 生成6位随机验证码
String
tpl_value
=
URLEncoder
.
encode
(
"#code#"
,
ENCODING
)
+
"="
+
URLEncoder
.
encode
(
code
,
ENCODING
);
System
.
out
.
println
(
tpl_value
);
System
.
out
.
println
(
SMSUtil
.
tplSendSms
(
API_KEY
,
tpl_id
,
tpl_value
,
phone
));
return
code
;
}
/**
* 通过模板发送短信
*
* @param apikey
* @param tpl_id
* @param tpl_value
* @param mobile
* @return
* @throws IOException
*/
public
static
String
tplSendSms
(
String
apikey
,
long
tpl_id
,
String
tpl_value
,
String
mobile
)
throws
IOException
{
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
params
.
put
(
"apikey"
,
apikey
);
params
.
put
(
"tpl_id"
,
String
.
valueOf
(
tpl_id
));
params
.
put
(
"tpl_value"
,
tpl_value
);
params
.
put
(
"mobile"
,
mobile
);
return
post
(
URI_TPL_SEND_SMS
,
params
);
}
/**
* 通过模板群发(新版)
*
* @param phone
* @param tplId
* @param tplVal
*/
public
static
void
sendMessageByTpl
(
String
phone
,
String
tplId
,
String
tplVal
)
{
YunpianClient
clnt
=
new
YunpianClient
(
API_KEY
).
init
();
Map
<
String
,
String
>
param
=
clnt
.
newParam
(
5
);
param
.
put
(
YunpianConstant
.
MOBILE
,
phone
);
param
.
put
(
YunpianConstant
.
TPL_ID
,
tplId
);
String
code
=
RandomStringUtils
.
randomNumeric
(
6
);
param
.
put
(
YunpianConstant
.
TPL_VALUE
,
tplVal
);
com
.
yunpian
.
sdk
.
model
.
Result
<
SmsBatchSend
>
r
=
clnt
.
sms
().
tpl_batch_send
(
param
);
System
.
out
.
println
(
r
);
}
/**
* 群发短信(新版)
*
* @param phone
* @param text
*/
public
static
void
sendMessageByText
(
String
phone
,
String
text
)
{
YunpianClient
clnt
=
new
YunpianClient
(
API_KEY
).
init
();
Map
<
String
,
String
>
param
=
clnt
.
newParam
(
5
);
param
.
put
(
YunpianConstant
.
MOBILE
,
phone
);
String
code
=
RandomStringUtils
.
randomNumeric
(
6
);
param
.
put
(
YunpianConstant
.
TEXT
,
text
);
com
.
yunpian
.
sdk
.
model
.
Result
<
SmsBatchSend
>
result
=
clnt
.
sms
().
batch_send
(
param
);
System
.
out
.
println
(
result
);
}
/**
* 发送物流短信
*
* @param phone
*/
public
static
void
sendLogisticsMessage
(
String
phone
)
{
String
message
=
"【Afrishop】Thank you for shopping with Afrishop! Your parcel has arrived in Zambia."
;
sendMessageByText
(
phone
,
message
);
}
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
phone
=
"13751400455,18607444177"
;
SMSUtils
.
sendLogisticsMessage
(
phone
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论