提交 8a33b5c1 authored 作者: zgy's avatar zgy

Merge remote-tracking branch 'origin/master'

......@@ -26,4 +26,6 @@ public interface TbCfPlatformOrderDao extends BaseDao<PlatformOrderVo> {
int getOrderId(String sid);
TbCfItemOrderREntity getOrdersId(String sid);
int findUserByExpressNumber(String[] sids);
}
......@@ -30,6 +30,10 @@ public class TbCfExpressTemplateEntity implements Serializable {
* 快递费
*/
private BigDecimal expressFee;
/**
* 快递费
*/
private BigDecimal continuationFee;
/**
* 国家编号
*/
......@@ -117,4 +121,12 @@ public class TbCfExpressTemplateEntity implements Serializable {
public Date getCreateTime() {
return createTime;
}
public BigDecimal getContinuationFee() {
return continuationFee;
}
public void setContinuationFee(BigDecimal continuationFee) {
this.continuationFee = continuationFee;
}
}
......@@ -34,9 +34,17 @@ public class TbCfItemOrderREntity implements Serializable {
private Integer deliveryFlag;
/**
* 是否已发送短信
*/
private Integer isSend;
private Date deliveryTime;
private Date closeTime;
private Date updateTime;
/**
* 设置:记录表
*/
......@@ -129,4 +137,12 @@ public class TbCfItemOrderREntity implements Serializable {
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getIsSend() {
return isSend;
}
public void setIsSend(Integer isSend) {
this.isSend = isSend;
}
}
......@@ -72,4 +72,6 @@ public interface TbCfPlatformOrderService {
int getOrderId(String sid);
TbCfItemOrderREntity getOrdersId(String sid);
int findUserByExpressNumber(String[] sids);
}
......@@ -38,7 +38,7 @@ public class TbCfExpressTemplateServiceImpl implements TbCfExpressTemplateServic
@Override
public int save(TbCfExpressTemplateEntity tbCfExpressTemplate) {
tbCfExpressTemplate.setTemplateId(IdUtil.createIdbyUUID());
tbCfExpressTemplate.setTemplateId(tbCfExpressTemplate.getTemplateId());
return tbCfExpressTemplateDao.save(tbCfExpressTemplate);
}
......
......@@ -78,4 +78,9 @@ public class TbCfPlatformOrderServiceImpl implements TbCfPlatformOrderService {
public TbCfItemOrderREntity getOrdersId(String sid) {
return tbCfPlatformOrderDao.getOrdersId(sid);
}
@Override
public int findUserByExpressNumber(String[] sids) {
return tbCfPlatformOrderDao.findUserByExpressNumber(sids);
}
}
......@@ -87,7 +87,8 @@ public class ExpressStatusTask {
sids[i]=object.getString("sid");
}
if (sids.length != 0) {
tbCfItemOrderRService.updateExpressStatuss(sids);
int i = tbCfItemOrderRService.updateExpressStatuss(sids);
// tbCfPlatformOrderService.findUserByExpressNumber(sids);
System.out.println("修改了:"+sids.length+"条数据");
}
long endTime = System.currentTimeMillis();
......
......@@ -8,6 +8,7 @@
<result property="templateTitle" column="template_title"/>
<result property="itemCategoryId" column="item_category_id"/>
<result property="expressFee" column="express_fee"/>
<result property="continuationFee" column="continuation_fee"/>
<result property="countryCode" column="country_code"/>
<result property="createTime" column="create_time"/>
</resultMap>
......@@ -19,7 +20,8 @@
`item_category_id`,
`express_fee`,
`country_code`,
`create_time`
`create_time`,
`continuation_fee`
from tb_cf_express_template
where template_id = #{id}
</select>
......@@ -30,6 +32,7 @@
`template_title`,
`item_category_id`,
`express_fee`,
`continuation_fee`,
`country_code`,
`create_time`
from tb_cf_express_template
......@@ -64,6 +67,7 @@
`template_title`,
`item_category_id`,
`express_fee`,
`continuation_fee`,
`country_code`,
`create_time`)
values(
......@@ -71,6 +75,7 @@
#{templateTitle},
#{itemCategoryId},
#{expressFee},
#{continuationFee},
#{countryCode},
#{createTime})
</insert>
......@@ -81,6 +86,7 @@
<if test="templateTitle != null">`template_title` = #{templateTitle}, </if>
<if test="itemCategoryId != null">`item_category_id` = #{itemCategoryId}, </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="createTime != null">`create_time` = #{createTime}</if>
</set>
......@@ -90,7 +96,7 @@
<delete id="delete">
delete from tb_cf_express_template where template_id = #{value}
</delete>
<delete id="deleteBatch">
delete from tb_cf_express_template where template_id in
<foreach item="templateId" collection="array" open="(" separator="," close=")">
......
......@@ -13,6 +13,7 @@
<result property="deliveryTime" column="delivery_time"/>
<result property="closeTime" column="close_time"/>
<result property="updateTime" column="update_time"/>
<result property="isSend" column="is_send"/>
</resultMap>
<select id="queryObject" resultType="com.platform.entity.TbCfItemOrderREntity">
......@@ -25,6 +26,7 @@
`delivery_flag`,
`delivery_time`,
`close_time`,
`is_send`,
`update_time`
from tb_cf_item_order_r
where order_item_id = #{id}
......@@ -40,6 +42,7 @@
`delivery_flag`,
`delivery_time`,
`close_time`,
`is_send`,
`update_time`
from tb_cf_item_order_r
WHERE 1=1
......@@ -77,6 +80,7 @@
`delivery_flag`,
`delivery_time`,
`close_time`,
`is_send`,
`update_time`)
values(
#{orderItemId},
......@@ -87,6 +91,7 @@
#{deliveryFlag},
#{deliveryTime},
#{closeTime},
#{isSend},
#{updateTime})
</insert>
......@@ -100,6 +105,7 @@
<if test="deliveryFlag != null">`delivery_flag` = #{deliveryFlag},</if>
<if test="deliveryTime != null">`delivery_time` = #{deliveryTime},</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>
</set>
where order_item_id = #{orderItemId}
......@@ -161,7 +167,7 @@
<update id="updateExpressStatuss">
UPDATE tb_cf_order o,tb_cf_platform_order p,tb_cf_item_order_r i
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=")">
#{sids}
</foreach>
......
......@@ -21,9 +21,9 @@
<i-button @click="reloadSearch">重置</i-button>
</div>
<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>&nbsp;新增</i-button>
#end
#end-->
#if($shiro.hasPermission("tbcfexpresstemplate:update"))
<i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
#end
......@@ -38,6 +38,9 @@
<Card v-show="!showList">
<p slot="title">{{title}}</p>
<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">
<i-input v-model="tbCfExpressTemplate.templateTitle" placeholder="模板标题"/>
</Form-item>
......@@ -47,6 +50,9 @@
<Form-item label="快递费" prop="expressFee">
<i-input v-model="tbCfExpressTemplate.expressFee" placeholder="快递费"/>
</Form-item>
<Form-item label="续件费" prop="expressFee">
<i-input v-model="tbCfExpressTemplate.continuationFee" placeholder="续件费"/>
</Form-item>
<!--<Form-item label="国家编号" prop="countryCode">
<i-input v-model="tbCfExpressTemplate.countryCode" placeholder="国家编号"/>
</Form-item>
......
......@@ -48,7 +48,7 @@
<i-input v-model="tbCfFee.feePercent" placeholder="收取费用百分比"/>
</Form-item>
<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>
<i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
......
......@@ -391,6 +391,6 @@ let vm = new Vue({
handleReset2: function (name) {
handleResetForm(this, name);
}
},
}
});
......@@ -6,6 +6,7 @@ $(function () {
{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: '快递费', 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: 'createTime', index: 'create_time', width: 80, hidden: true}]
});
......
......@@ -21,9 +21,14 @@
<qcloud-cos-version>4.4</qcloud-cos-version>
<jackson.version>2.5.0</jackson.version>
<poi.version>3.15</poi.version>
<yunpian-version>1.2.7</yunpian-version>
</properties>
<dependencies>
<dependency>
<groupId>com.yunpian.sdk</groupId>
<artifactId>yunpian-java-sdk</artifactId>
<version>${yunpian-version}</version>
</dependency>
<dependency>
<groupId>com.qiniu</groupId>
<artifactId>qiniu-java-sdk</artifactId>
......
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论