发货相关更新

This commit is contained in:
wangjinlei
2023-10-31 11:53:01 +08:00
parent 890577d545
commit f037f9c2f5
5 changed files with 51 additions and 6 deletions

View File

@@ -0,0 +1,30 @@
package com.peanut.common.utils;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
public class HttpsUtil {
public static String getHttps(String httpsURL) throws IOException {
URL myurl = new URL(httpsURL);
HttpsURLConnection con = (HttpsURLConnection) myurl.openConnection();
con.setRequestProperty ( "User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0" );
InputStream ins = con.getInputStream();
InputStreamReader isr = new InputStreamReader(ins);
BufferedReader in = new BufferedReader(isr);
String flag = new String();
String inputLine;
while ((inputLine = in.readLine()) != null) {
flag += inputLine;
}
in.close();
return flag;
}
}

View File

@@ -3,7 +3,9 @@ package com.peanut.modules.book.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.peanut.common.utils.HttpsUtil;
import com.peanut.common.utils.R;
import com.peanut.modules.book.entity.ExpressCompany;
import com.peanut.modules.book.entity.ExpressOrder;
@@ -16,6 +18,7 @@ import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -53,10 +56,10 @@ public class ExpressController {
* @return
*/
@RequestMapping("/getExpressPrints")
public R getExpressPrints(@RequestBody ExpressPrintDto expressPrintDto){
public R getExpressPrints(@RequestBody ExpressPrintDto expressPrintDto) throws IOException {
LambdaQueryWrapper<ExpressOrder> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(expressPrintDto.getExpressOrderSn()!=null,ExpressOrder::getExpressOrderSn,expressPrintDto.getExpressOrderSn());
if(expressPrintDto.getDate()!=null){
wrapper.eq(StringUtils.isBlank(expressPrintDto.getExpressOrderSn()),ExpressOrder::getExpressOrderSn,expressPrintDto.getExpressOrderSn());
if(expressPrintDto.getDate()!=null&&expressPrintDto.getDate()!=""){
String startDate = expressPrintDto.getDate()+" 00:00:00";
String endDate = expressPrintDto.getDate()+" 23:59:59";
wrapper.between(ExpressOrder::getCreateTime,startDate,endDate);
@@ -64,11 +67,17 @@ public class ExpressController {
wrapper.eq(expressPrintDto.getType()!=0,ExpressOrder::getTemplatePrinted,expressPrintDto.getType()==1?1:0);
wrapper.orderByDesc(ExpressOrder::getCreateTime);
Page<ExpressOrder> expressOrderPage = expressOrderService.getBaseMapper().selectPage(new Page<>(expressPrintDto.getPage(), expressPrintDto.getLimit()), wrapper);
for (ExpressOrder e :expressOrderPage.getRecords()){
if(e.getPrintTemplate()!=null){
String c_string = HttpsUtil.getHttps(e.getPrintTemplate());
e.setPrintString(c_string);
}
}
return R.ok().put("page",expressOrderPage);
}
/**
* 获取快递面单列表
* 获取快递面单列表(废弃)
*
* @return R
*/

View File

@@ -81,6 +81,12 @@ public class ExpressOrder {
*/
@TableField(exist = false)
private List<ExpressCommodity> Commodity;
/**
* 面单的string
*/
@TableField(exist = false)
private String printString;
/**
* 快递单号
*/

View File

@@ -11,7 +11,7 @@ connection-timeout: 6000000ms
spring:
# 环境 dev|test|prod
profiles:
active: prod
active: dev
# jackson时间格式化
jackson:
time-zone: GMT+8

View File

@@ -5,7 +5,7 @@ wxpay.mchId:1612860909
# ?? URL
wxpay.payUrl:https://api.mch.weixin.qq.com/v3/pay/transactions/app
# ????
wxpay.notifyUrl:https://api.nuttyreading.com/pay/payNotify
wxpay.notifyUrl:https://testapi.nuttyreading.com/pay/payNotify
# ?? url
wxpay.refundNotifyUrl:http://pjm6m9.natappfree.cc/pay/refundNotify
# key pem