记得上下班打卡 | git大法好,push需谨慎

Commit f418ee88 authored by jiangxiulong's avatar jiangxiulong

快递

parent 97db5662
...@@ -2,6 +2,8 @@ package com.liquidnet.service.kylin.dto.param; ...@@ -2,6 +2,8 @@ package com.liquidnet.service.kylin.dto.param;
import lombok.Data; import lombok.Data;
import java.util.List;
@Data @Data
public class PerformanceExpressSearchAdminParam { public class PerformanceExpressSearchAdminParam {
...@@ -24,4 +26,6 @@ public class PerformanceExpressSearchAdminParam { ...@@ -24,4 +26,6 @@ public class PerformanceExpressSearchAdminParam {
private String expressContacts; private String expressContacts;
private String expressPhone; private String expressPhone;
private List<String> ids;
} }
package com.liquidnet.client.admin.web.controller.zhengzai.kylin; package com.liquidnet.client.admin.web.controller.zhengzai.kylin;
import com.liquidnet.client.admin.common.core.controller.BaseController; import com.liquidnet.client.admin.common.core.controller.BaseController;
import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.client.admin.common.core.page.TableDataInfo; import com.liquidnet.client.admin.common.core.page.TableDataInfo;
import com.liquidnet.client.admin.zhengzai.kylin.service.impl.PerformancesExpressServiceImpl; import com.liquidnet.client.admin.zhengzai.kylin.service.impl.PerformancesExpressServiceImpl;
import com.liquidnet.client.admin.zhengzai.kylin.utils.ShunfengSignUtils; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.dao.PerformanceExpressPerformanceListAdminDao; import com.liquidnet.service.kylin.dao.PerformanceExpressPerformanceListAdminDao;
import com.liquidnet.service.kylin.dao.PerformanceExpressPerformanceOrderListAdminDao; import com.liquidnet.service.kylin.dao.PerformanceExpressPerformanceOrderListAdminDao;
import com.liquidnet.service.kylin.dto.param.PerformanceExpressSearchAdminParam; import com.liquidnet.service.kylin.dto.param.PerformanceExpressSearchAdminParam;
...@@ -13,6 +14,7 @@ import org.springframework.stereotype.Controller; ...@@ -13,6 +14,7 @@ import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List; import java.util.List;
/** /**
...@@ -40,8 +42,6 @@ public class PerformancesExpressController extends BaseController { ...@@ -40,8 +42,6 @@ public class PerformancesExpressController extends BaseController {
@Autowired @Autowired
private PerformancesExpressServiceImpl performancesExpressServiceImpl; private PerformancesExpressServiceImpl performancesExpressServiceImpl;
private ShunfengSignUtils shunfengSignUtils;
/** /**
* 查询演出列表 * 查询演出列表
*/ */
...@@ -83,17 +83,17 @@ public class PerformancesExpressController extends BaseController { ...@@ -83,17 +83,17 @@ public class PerformancesExpressController extends BaseController {
@RequiresPermissions("kylin:performancesExpress:placeOrder") @RequiresPermissions("kylin:performancesExpress:placeOrder")
@PostMapping("/placeOrder") @PostMapping("/placeOrder")
@ResponseBody @ResponseBody
public boolean placeOrder() { public AjaxResult placeOrder(PerformanceExpressSearchAdminParam performanceExpressSearchAdminParam) {
// 请求body companyId参数值和APPID一致!!! ResponseDto res = performancesExpressServiceImpl.placeOrder(performanceExpressSearchAdminParam);
String body="{\"dContact\":\"王昆\",\"companyId\":{{APP_ID}},\"jContact\":\"顺丰\",\"jTel\":\"111\",\"jMobile\":null,\"jAddress\":\"马甸\",\"dTel\":\"064756935\",\"dMobile\":null,\"dAddress\":\"北京市朝阳区花家地金兴路1号院5号楼1单元202\",\"custid\":\"7551234567\",\"payMethod\":\"0\",\"expressType\":\"1\",\"packagesNo\":\"1\",\"depositumInfo\":\"TCL空调\",\"depositumNo\":\"1\",\"remark\":null,\"isCollection\":\"1\",\"collectionMoney\":\"10.00\",\"isReceipt\":\"0\",\"receipt\":null}"; try {
// 时间戳 if (res.isSuccess()) {
long currentTimeMillis = System.currentTimeMillis(); return success();
System.out.println("时间戳:"+currentTimeMillis); } else {
return error(res.getMessage());
// 生成签名并请求 }
String result = shunfengSignUtils.generateSignatureAndRequest(currentTimeMillis + "", body, "/order/v1/placeOrder"); } catch (Exception e) {
System.out.println("响应:"+result); return error(e.getMessage());
return true; }
} }
} }
...@@ -68,6 +68,8 @@ ...@@ -68,6 +68,8 @@
</div> </div>
<th:block th:include="include :: footer"/> <th:block th:include="include :: footer"/>
<script th:inline="javascript"> <script th:inline="javascript">
var placeOrderFlag = [[${@permission.hasPermi('kylin:performancesExpress:placeOrder')}]];
var prefix = ctx + "kylin/performancesExpress"; var prefix = ctx + "kylin/performancesExpress";
var orderStatusDic = [[${@dict.getType('zhengzai_order_status')}]]; var orderStatusDic = [[${@dict.getType('zhengzai_order_status')}]];
...@@ -76,6 +78,7 @@ ...@@ -76,6 +78,7 @@
var options = { var options = {
url: prefix + "/performanceOrderList", url: prefix + "/performanceOrderList",
modalName: "演出订单", modalName: "演出订单",
placeOrderUrl: prefix + "/placeOrder",
columns: [{ columns: [{
checkbox: true checkbox: true
}, },
...@@ -121,7 +124,6 @@ ...@@ -121,7 +124,6 @@
field: '', field: '',
title: '收获用户', title: '收获用户',
formatter: function(value, row, index) { formatter: function(value, row, index) {
console.log(row)
var expressContacts = row.expressContacts; var expressContacts = row.expressContacts;
var expressAddress = row.expressAddress; var expressAddress = row.expressAddress;
var expressPhone = row.expressPhone; var expressPhone = row.expressPhone;
...@@ -133,7 +135,7 @@ ...@@ -133,7 +135,7 @@
align: 'center', align: 'center',
formatter: function (value, row, index) { formatter: function (value, row, index) {
var actions = []; var actions = [];
// actions.push('<a class="btn btn-warning btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.orderTicketsId + '\')"><i class="fa fa-search"></i>详细</a>'); actions.push('<a class="btn btn-danger btn-xs ' + placeOrderFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.orderTicketsId + '\', \'确定下单吗?\', table.options.placeOrderUrl)"></i>下单</a> ');
return actions.join(''); return actions.join('');
} }
}] }]
......
package com.liquidnet.client.admin.zhengzai.kylin.service.impl; package com.liquidnet.client.admin.zhengzai.kylin.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.client.admin.zhengzai.kylin.utils.ShunfengSignUtils;
import com.liquidnet.commons.lang.util.BeanUtil; import com.liquidnet.commons.lang.util.BeanUtil;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.dao.*; import com.liquidnet.service.kylin.dao.*;
import com.liquidnet.service.kylin.dto.param.*; import com.liquidnet.service.kylin.dto.param.*;
import com.liquidnet.service.kylin.entity.*; import com.liquidnet.service.kylin.entity.*;
...@@ -11,7 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -11,7 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -30,11 +38,21 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinPerformance ...@@ -30,11 +38,21 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinPerformance
@Autowired @Autowired
MongoTemplate mongoTemplate; MongoTemplate mongoTemplate;
@Autowired
private ShunfengSignUtils shunfengSignUtils;
@Autowired @Autowired
private KylinPerformancesMapper performancesMapper; private KylinPerformancesMapper performancesMapper;
@Autowired @Autowired
private KylinOrderTicketsMapper kylinOrderTicketsMapper; private KylinOrderTicketsMapper kylinOrderTicketsMapper;
@Autowired
private KylinOrderExpressMapper kylinOrderExpressMapper;
@Autowired
private KylinOrderExpress kylinOrderExpress;
public List<PerformanceExpressPerformanceListAdminDao> getPerformancesList(PerformanceExpressSearchAdminParam performanceExpressSearchAdminParam) { public List<PerformanceExpressPerformanceListAdminDao> getPerformancesList(PerformanceExpressSearchAdminParam performanceExpressSearchAdminParam) {
List<PerformanceExpressPerformanceListAdminDao> voList = new ArrayList(); List<PerformanceExpressPerformanceListAdminDao> voList = new ArrayList();
try { try {
...@@ -56,4 +74,64 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinPerformance ...@@ -56,4 +74,64 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinPerformance
} }
return voList; return voList;
} }
public ResponseDto placeOrder(PerformanceExpressSearchAdminParam performanceExpressSearchAdminParam) {
List<String> ids = performanceExpressSearchAdminParam.getIds();
for (String orderTicketsId : ids) {
KylinOrderTickets orderInfo = kylinOrderTicketsMapper.selectOne(
new QueryWrapper<KylinOrderTickets>().eq("order_tickets_id", orderTicketsId)
);
HashMap<String, Object> hBody = new HashMap<>();
hBody.put("orderId", orderInfo.getOrderCode());
hBody.put("jCompany", "摩登天空");
hBody.put("jContact", "姜秀龙");
// hBody.put("jTel", "010");
hBody.put("jMobile", "15811009011");
hBody.put("jProvince", "北京");
hBody.put("jCity", "北京市");
hBody.put("jAddress", "摩登天空");
hBody.put("dContact", "张红梅");
hBody.put("dMobile", "15010806631");
hBody.put("dProvince", "北京");
hBody.put("dCity", "北京市");
hBody.put("dAddress", "华通大厦");
hBody.put("custid", "7551234567");
hBody.put("payMethod", 0);// 运费付款方式:0-寄付月结;1-寄付现结;2-收方付;3-第三方付;
hBody.put("expressType", 1);// 顺丰特快
hBody.put("depositumInfo", "票");
hBody.put("depositumNo", 1);
// 时间戳
long currentTimeMillis = System.currentTimeMillis();
// 生成签名并请求
String result = shunfengSignUtils.generateSignatureAndRequest(currentTimeMillis + "", hBody, "/public/order/v1/placeOrder");
HashMap hashMap = JsonUtils.fromJson(result, HashMap.class);
System.out.println(result);
if (hashMap.get("succ").equals("fail")) {
String msg = (String) hashMap.get("msg");
return ResponseDto.failure(msg);
} else {
String orderExpressId = IDGenerator.nextSnowId();
kylinOrderExpress.setOrderExpressId(orderExpressId);
kylinOrderExpress.setOrderTicketsId(orderTicketsId);
kylinOrderExpress.setMailno((String) hashMap.get("mailno"));
kylinOrderExpress.setExpressType(1);
kylinOrderExpress.setFilterResult((Integer) hashMap.get("filter_result"));
kylinOrderExpress.setRemark((String) hashMap.get("remark"));
kylinOrderExpress.setOrigincode((String) hashMap.get("origincode"));
kylinOrderExpress.setDestcode((String) hashMap.get("destcode"));
kylinOrderExpress.setPrintIcon((String) hashMap.get("printIcon"));
kylinOrderExpress.setPrintFlag((String) hashMap.get("printFlag"));
kylinOrderExpress.setTwoDimensionCode((String) hashMap.get("twoDimensionCode"));
kylinOrderExpress.setCreatedAt(DateUtil.getNowTime());
kylinOrderExpressMapper.insert(kylinOrderExpress);
}
}
return ResponseDto.success();
}
} }
package com.liquidnet.client.admin.zhengzai.kylin.utils; package com.liquidnet.client.admin.zhengzai.kylin.utils;
import com.liquidnet.client.admin.common.json.JSONObject;
import com.liquidnet.commons.lang.util.JsonUtils;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -11,9 +13,11 @@ import org.apache.http.impl.client.CloseableHttpClient; ...@@ -11,9 +13,11 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap;
/** /**
* <p> * <p>
...@@ -23,6 +27,7 @@ import java.io.IOException; ...@@ -23,6 +27,7 @@ import java.io.IOException;
* @author jiangxiulong * @author jiangxiulong
* @since 2021-06-24 8:00 下午 * @since 2021-06-24 8:00 下午
*/ */
@Component
public class ShunfengSignUtils { public class ShunfengSignUtils {
/** /**
* appId * appId
...@@ -47,18 +52,18 @@ public class ShunfengSignUtils { ...@@ -47,18 +52,18 @@ public class ShunfengSignUtils {
/** /**
* 生成签名并请求 * 生成签名并请求
* @param timestamp 时间戳 * @param timestamp 时间戳
* @param body 请求body * @param hbody 请求body
* @return * @return
*/ */
public String generateSignatureAndRequest(String timestamp, String body, String url) { public String generateSignatureAndRequest(String timestamp, HashMap<String, Object> hbody, String url) {
hbody.put("companyId", APP_ID);
String body = JsonUtils.toJson(hbody);
// 生成签名 // 生成签名
String sign = genSign(timestamp,body); String sign = genSign(timestamp,body);
System.out.println("签名:"+sign);
CloseableHttpClient client = HttpClients.createDefault(); CloseableHttpClient client = HttpClients.createDefault();
// 请求下单地址 // 请求下单地址
HttpPost httpPost = new HttpPost(URL + url); HttpPost httpPost = new HttpPost(URL + url);
System.out.println("请求的url:"+URL + url);
// sendAppId(sendAppId需赋值appId) // sendAppId(sendAppId需赋值appId)
httpPost.addHeader("sendAppId", APP_ID); httpPost.addHeader("sendAppId", APP_ID);
// 时间戳需和获取验签时一致!!! // 时间戳需和获取验签时一致!!!
...@@ -66,6 +71,7 @@ public class ShunfengSignUtils { ...@@ -66,6 +71,7 @@ public class ShunfengSignUtils {
// 签名 // 签名
httpPost.addHeader("sign", sign); httpPost.addHeader("sign", sign);
httpPost.addHeader("Content-Type", "application/json;charset=utf-8"); httpPost.addHeader("Content-Type", "application/json;charset=utf-8");
httpPost.addHeader("Accept", "application/json");
// 请求body体需和获取验签时一致且编码UTF8!!! // 请求body体需和获取验签时一致且编码UTF8!!!
httpPost.setEntity(new StringEntity(body, "utf-8")); httpPost.setEntity(new StringEntity(body, "utf-8"));
CloseableHttpResponse response = null; CloseableHttpResponse response = null;
......
...@@ -744,3 +744,26 @@ CREATE TABLE `kylin_order_refund_entities` ...@@ -744,3 +744,26 @@ CREATE TABLE `kylin_order_refund_entities`
) ENGINE = InnoDB ) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT '退款入场人表'; COLLATE = utf8mb4_unicode_ci COMMENT '退款入场人表';
drop TABLE if exists `kylin_order_express`;
CREATE TABLE `kylin_order_express`
(
`mid` int unsigned NOT NULL AUTO_INCREMENT,
`order_express_id` varchar(255) NOT NULL DEFAULT '' COMMENT 'order_express_id',
`order_tickets_id` varchar(255) NOT NULL DEFAULT '' COMMENT '订单id',
`mailno` varchar(255) NOT NULL DEFAULT '' COMMENT '顺丰运单号',
`express_type` tinyint NOT NULL DEFAULT '0' COMMENT '快件产品类型 1顺丰特快...',
`filter_result` tinyint NOT NULL DEFAULT '0' COMMENT '1-人工确认;2-可收派;3-不可以收派',
`remark` varchar(255) NOT NULL DEFAULT '' COMMENT 'filter_result=3时返回不可以收派的原因代码',
`origincode` varchar(255) NOT NULL DEFAULT '' COMMENT '原寄地区域代码 可用于顺丰电子面单标签打印',
`destcode` varchar(255) NOT NULL DEFAULT '' COMMENT '目的地区域代码 可用于顺丰电子面单标签打印',
`print_icon` varchar(255) NOT NULL DEFAULT '' COMMENT '打印图标',
`print_flag` varchar(255) NOT NULL DEFAULT '' COMMENT '打印标志',
`two_dimension_code` varchar(255) NOT NULL DEFAULT '' COMMENT '二维码',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
KEY `kylin_order_express_order_express_id_index` (`order_express_id`),
PRIMARY KEY (`mid`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT '订单快递表';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment