diff --git a/src/main/java/com/peanut/common/utils/HttpsUtil.java b/src/main/java/com/peanut/common/utils/HttpsUtil.java new file mode 100644 index 00000000..555cfbfa --- /dev/null +++ b/src/main/java/com/peanut/common/utils/HttpsUtil.java @@ -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; + } +} diff --git a/src/main/java/com/peanut/modules/book/controller/ExpressController.java b/src/main/java/com/peanut/modules/book/controller/ExpressController.java index f5a2ed7b..6dc115d8 100644 --- a/src/main/java/com/peanut/modules/book/controller/ExpressController.java +++ b/src/main/java/com/peanut/modules/book/controller/ExpressController.java @@ -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 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 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 */ diff --git a/src/main/java/com/peanut/modules/book/entity/ExpressOrder.java b/src/main/java/com/peanut/modules/book/entity/ExpressOrder.java index dc3365dd..50e401a2 100644 --- a/src/main/java/com/peanut/modules/book/entity/ExpressOrder.java +++ b/src/main/java/com/peanut/modules/book/entity/ExpressOrder.java @@ -81,6 +81,12 @@ public class ExpressOrder { */ @TableField(exist = false) private List Commodity; + + /** + * 面单的string + */ + @TableField(exist = false) + private String printString; /** * 快递单号 */ diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index ad28466c..4b7d7a8c 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -11,7 +11,7 @@ connection-timeout: 6000000ms spring: # 环境 dev|test|prod profiles: - active: prod + active: dev # jackson时间格式化 jackson: time-zone: GMT+8 diff --git a/src/main/resources/weChatConfig.properties b/src/main/resources/weChatConfig.properties index a24fe685..4b45ba81 100644 --- a/src/main/resources/weChatConfig.properties +++ b/src/main/resources/weChatConfig.properties @@ -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