Merge branch 'pre' into gas

dev-discount
胡锐 2 years ago
commit 50f508ec90
  1. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  2. 6
      hai-bweb/src/main/java/com/bweb/excelListener/ImportRechargeOrderListener.java
  3. 2
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  4. 5
      hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java
  5. 15
      hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java
  6. 18
      hai-service/src/main/java/com/hai/config/SpPrinterTemplate.java
  7. 182
      hai-service/src/main/java/com/hai/config/ZkcPrinterTemplate.java
  8. 1
      hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java
  9. 59
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  10. 18
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java
  11. 10
      hai-service/src/main/resources/dev/commonConfig.properties
  12. 9
      hai-service/src/main/resources/prod-9401/commonConfig.properties
  13. 9
      hai-service/src/main/resources/prod/commonConfig.properties

File diff suppressed because one or more lines are too long

@ -40,12 +40,6 @@ public class ImportRechargeOrderListener extends AnalysisEventListener<ExportOut
OutRechargeOrder rechargeOrder = outRechargeOrderService.findByOrderNo(data.getOrderNo());
if (rechargeOrder.getRechargeStatus() != 203 || rechargeOrder.getRechargeType() != 2) {
data.setErrorMessage("当前订单状态错误。");
errorData.add(data);
return;
}
if (Objects.equals(data.getRechargeStatusName(), "成功")) {
outRechargeOrderService.finishOrder(rechargeOrder.getId());
} else if (Objects.equals(data.getRechargeStatusName(), "失败")){

File diff suppressed because one or more lines are too long

@ -292,6 +292,11 @@ public class CzOrderController {
return;
}
rechargeOrder.setRechargeStatus(203);
childOrder.setStatus(103);
outRechargeOrderService.updateOrder(rechargeOrder);
outRechargeChildOrderService.updateOrder(childOrder);
outRechargeOrderService.rechargeOrderToRefund(rechargeOrder.getId());
new Thread(() -> {

@ -23,6 +23,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* @Auther: 胡锐
@ -92,14 +93,15 @@ public class HighOrderSchedule {
* @Param []
* @return void
*/
@Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次
@Scheduled(cron="0 0/1 * * * ?") //每10分钟执行一次
public void initRechargeOrder() {
Map<String, Object> map = new HashMap<>();
map.put("payStatus" , String.valueOf(102));
map.put("rechargeStatus" , String.valueOf(204));
List<OutRechargeOrder> orderList = outRechargeOrderService.getListRechargeOrder(map);
System.out.println("订单数量------------------------------------------------------------------------------" + orderList.size());
System.out.println("话费定时任务 -> 开始循环数据:开始 需要操作的订单数量:" + orderList.size());
if (orderList.size() > 0) {
for (OutRechargeOrder order : orderList) {
try {
@ -110,6 +112,7 @@ public class HighOrderSchedule {
List<OutRechargeChildOrder> childOrderList = rechargeChildOrderService.getListRechargeChildOrder(childOrderMap);
System.out.println("话费定时任务 -> 判断是否存在已支付订单:订单id:" + order.getId());
if (childOrderList.size() == 0) {
Date rechargeTime = order.getCreateTimed();
Date currentTime = new Date();
@ -117,14 +120,17 @@ public class HighOrderSchedule {
// 判断快充 并且 充值时间小于6
if (order.getRechargeType() == 1 && hours < 6) {
System.out.println("话费定时任务 -> 请求快充:订单id:" + order.getId());
outRechargeOrderService.pollRequest(order);
return;
continue;
}
// 判断慢充 并且 充值时间小于72
if (order.getRechargeType() == 2 && hours < 72) {
System.out.println("话费定时任务 -> 请求慢充:订单id:" + order.getId());
outRechargeOrderService.pollRequest(order);
return;
continue;
}
System.out.println("话费定时任务 -> 退款任务" + order.getId());
outRechargeOrderService.rechargeOrderToRefund(order.getId());
}
@ -133,6 +139,7 @@ public class HighOrderSchedule {
}
}
}
System.out.println("话费定时任务 -> 结束任务");
}
/**

@ -1,5 +1,9 @@
package com.hai.config;
import com.hai.common.utils.DateUtil;
import java.util.Date;
/**
* 商鹏打印机模板
* @author hurui
@ -21,17 +25,20 @@ public class SpPrinterTemplate {
public static String oilCashierStubTemp(String gasName,
String orderNo,
String payTime,
String phone,
String source,
String gunNo,
String oilNo,
String oilLiters,
String orderPrice) {
String orderPrice) throws Exception {
String str = "<C><B>" + gasName + "</B></C> <BR> " +
"<C>(收银员存根)</C> <BR>" +
"------------------------------<BR>" +
"流水:" + orderNo + "<BR>" +
"------------------------------<BR>" +
"时间:" + payTime + "<BR>" +
"打印时间:" + DateUtil.date2String(new Date(), "yyyy-MM-dd HH:mm:ss") + "<BR>" +
"支付时间:" + payTime + "<BR>" +
"电话:" + phone.substring(0, 3) + "****" + phone.substring(7) + "<BR>" +
"来源:" + source + "<BR>" +
"油枪:"+ gunNo + "号<BR>" +
"油品:" + oilNo + "#<BR>" +
@ -60,17 +67,20 @@ public class SpPrinterTemplate {
public static String oilClientStubTemp(String gasName,
String orderNo,
String payTime,
String phone,
String source,
String gunNo,
String oilNo,
String oilLiters,
String orderPrice) {
String orderPrice) throws Exception {
String str = "<C><B>" + gasName + "</B></C> <BR> " +
"<C>(客户存根)</C> <BR>" +
"------------------------------<BR>" +
"流水:" + orderNo + "<BR>" +
"------------------------------<BR>" +
"时间:" + payTime + "<BR>" +
"打印时间:" + DateUtil.date2String(new Date(), "yyyy-MM-dd HH:mm:ss") + "<BR>" +
"支付时间:" + payTime + "<BR>" +
"电话:" + phone.substring(0, 3) + "****" + phone.substring(7) + "<BR>" +
"来源:" + source + "<BR>" +
"油枪:"+ gunNo + "号<BR>" +
"油品:" + oilNo + "#<BR>" +

@ -11,6 +11,180 @@ import java.util.Date;
*/
public class ZkcPrinterTemplate {
/**
* 加油站
* @param gasName 油站名称
* @param orderNo 订单号
* @param payTime 支付时间
* @param source 来源
* @param gunNo 抢号
* @param oilNo 油号
* @param oilLiters 升数
* @param orderPrice 加油金额
* @return
*/
public static byte[] oilTemp(String gasName,
String orderNo,
String payTime,
String phone,
String source,
String gunNo,
String oilNo,
String oilLiters,
String orderPrice) throws Exception {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
// 居中
stream.write(0x1B);
stream.write(0x61);
stream.write(0x01);
stream.write(gasName.getBytes("UTF-8"));
stream.write(0x0A);
stream.write("(收银员存根)".getBytes("UTF-8"));
stream.write(0x0A);
// 左对齐
stream.write(0x1B);
stream.write(0x61);
stream.write(0x00);
stream.write("--------------------------------".getBytes("UTF-8"));
stream.write(0x0A);
stream.write(("流水号:" + orderNo).getBytes("UTF-8"));
stream.write(0x0A);
stream.write("--------------------------------".getBytes("UTF-8"));
stream.write(0x0A);
stream.write(("打印时间:" + DateUtil.date2String(new Date(), "yyyy-MM-dd HH:mm:ss")).getBytes("UTF-8"));
stream.write(0x0A);
stream.write(("支付时间:" + payTime).getBytes("UTF-8"));
stream.write(0x0A);
stream.write(("电话:" + phone.substring(0, 3) + "****" + phone.substring(7)).getBytes("UTF-8"));
stream.write(0x0A);
stream.write("来源:嗨森逛".getBytes("UTF-8"));
stream.write(0x0A);
stream.write(("油枪:" + gunNo).getBytes("UTF-8"));
stream.write(0x0A);
stream.write(("油品:" + oilNo).getBytes("UTF-8"));
stream.write(0x0A);
stream.write(("升数:" + oilLiters + "升").getBytes("UTF-8"));
stream.write(0x0A);
stream.write("实际加油升数以加油机为准!".getBytes("UTF-8"));
stream.write(0x0A);
stream.write("--------------------------------".getBytes("UTF-8"));
stream.write(0x0A);
stream.write(0x1B);
stream.write(0x0E);
stream.write("加油金额".getBytes("UTF-8"));
stream.write(0x0A);
stream.write(("¥" + orderPrice).getBytes("UTF-8"));
stream.write(0x0A);
stream.write(0x1B);
stream.write(0x21);
stream.write(0x00);
stream.write("--------------------------------".getBytes("UTF-8"));
stream.write(0x0A);
stream.write(0x1B);
stream.write(0x61);
stream.write(0x01);
stream.write("开心又省钱;来“ 嗨森逛 ”".getBytes("UTF-8"));
stream.write(0x0A);
stream.write(0x0A);
stream.write(0x0A);
stream.write(0x0A);
// 居中
stream.write(0x1B);
stream.write(0x61);
stream.write(0x01);
stream.write(gasName.getBytes("UTF-8"));
stream.write(0x0A);
stream.write("(客户存根)".getBytes("UTF-8"));
stream.write(0x0A);
// 左对齐
stream.write(0x1B);
stream.write(0x61);
stream.write(0x00);
stream.write("--------------------------------".getBytes("UTF-8"));
stream.write(0x0A);
stream.write(("流水号:" + orderNo).getBytes("UTF-8"));
stream.write(0x0A);
stream.write("--------------------------------".getBytes("UTF-8"));
stream.write(0x0A);
stream.write(("打印时间:" + DateUtil.date2String(new Date(), "yyyy-MM-dd HH:mm:ss")).getBytes("UTF-8"));
stream.write(0x0A);
stream.write(("支付时间:" + payTime).getBytes("UTF-8"));
stream.write(0x0A);
stream.write(("电话:" + phone.substring(0, 3) + "****" + phone.substring(7)).getBytes("UTF-8"));
stream.write(0x0A);
stream.write("来源:嗨森逛".getBytes("UTF-8"));
stream.write(0x0A);
stream.write(("油枪:" + gunNo).getBytes("UTF-8"));
stream.write(0x0A);
stream.write(("油品:" + oilNo).getBytes("UTF-8"));
stream.write(0x0A);
stream.write(("升数:" + oilLiters + "升").getBytes("UTF-8"));
stream.write(0x0A);
stream.write("实际加油升数以加油机为准!".getBytes("UTF-8"));
stream.write(0x0A);
stream.write("--------------------------------".getBytes("UTF-8"));
stream.write(0x0A);
stream.write(0x1B);
stream.write(0x0E);
stream.write("加油金额".getBytes("UTF-8"));
stream.write(0x0A);
stream.write(("¥" + orderPrice).getBytes("UTF-8"));
stream.write(0x0A);
stream.write(0x1B);
stream.write(0x21);
stream.write(0x00);
stream.write("--------------------------------".getBytes("UTF-8"));
stream.write(0x0A);
stream.write(0x1B);
stream.write(0x61);
stream.write(0x01);
stream.write("开心又省钱;来“ 嗨森逛 ”".getBytes("UTF-8"));
stream.write(0x0A);
stream.write(0x0A);
stream.write(0x0A);
stream.write(0x0A);
stream.write(0x0A);
stream.write(0x0A);
stream.write(0x0A);
return getPrinterBytes(stream.toByteArray(), 1, "UTF-8");
}
/**
* 加油站收银员存根模板
* @param gasName 油站名称
@ -26,6 +200,7 @@ public class ZkcPrinterTemplate {
public static byte[] oilCashierStubTemp(String gasName,
String orderNo,
String payTime,
String phone,
String source,
String gunNo,
String oilNo,
@ -60,6 +235,9 @@ public class ZkcPrinterTemplate {
stream.write(("支付时间:" + payTime).getBytes("UTF-8"));
stream.write(0x0A);
stream.write(("电话:" + phone.substring(0, 3) + "****" + phone.substring(7)).getBytes("UTF-8"));
stream.write(0x0A);
stream.write("来源:嗨森逛".getBytes("UTF-8"));
stream.write(0x0A);
@ -119,6 +297,7 @@ public class ZkcPrinterTemplate {
public static byte[] oilClientStubTemp(String gasName,
String orderNo,
String payTime,
String phone,
String source,
String gunNo,
String oilNo,
@ -154,6 +333,9 @@ public class ZkcPrinterTemplate {
stream.write(("支付时间:" + payTime).getBytes("UTF-8"));
stream.write(0x0A);
stream.write(("电话:" + phone.substring(0, 3) + "****" + phone.substring(7)).getBytes("UTF-8"));
stream.write(0x0A);
stream.write("来源:嗨森逛".getBytes("UTF-8"));
stream.write(0x0A);

@ -68,6 +68,7 @@ public interface OutRechargeOrderMapperExt {
" operator_name as operatorName," +
" labor_union_card as laborUnionCard," +
" refund_time as refundTime," +
" create_timed as createTime," +
" case recharge_type when 1 then '快充' when 2 then '慢充' end rechargeTypeName ," +
" case pay_type when 2 then '微信支付' when 3 then '工会卡支付' when 4 then '银联支付' when null then '积分抵扣' end payTypeName," +
" recharge_content as rechargeContent,recharge_price as rechargePrice,pay_price as payPrice,discount_deduction_price as discountDeductionPrice,integral_deduction_price as integralDeductionPrice,pay_real_price as payRealPrice," +

@ -1684,31 +1684,42 @@ public class HighOrderServiceImpl implements HighOrderService {
new Thread(() -> {
try {
SpPrinterConfig sp = new SpPrinterConfig();
sp.print(device.getDeviceSn(),
SpPrinterTemplate.oilCashierStubTemp(
childOrder.getGoodsName(),
order.getOrderNo(),
DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
"嗨森逛",
childOrder.getGasGunNo(),
childOrder.getGasOilNo(),
childOrder.getGasOilLiters().toString(),
order.getTotalPrice().toString()
), 1);
Thread.sleep(6000);
sp.print(device.getDeviceSn(),
String printStr = SpPrinterTemplate.oilCashierStubTemp(
childOrder.getGoodsName(),
order.getOrderNo(),
DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
order.getMemPhone(),
"嗨森逛",
childOrder.getGasGunNo(),
childOrder.getGasOilNo(),
childOrder.getGasOilLiters().toString(),
order.getTotalPrice().toString()
) + "<BR><BR><BR><BR><BR>" +
SpPrinterTemplate.oilClientStubTemp(
childOrder.getGoodsName(),
order.getOrderNo(),
DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
order.getMemPhone(),
"嗨森逛",
childOrder.getGasGunNo(),
childOrder.getGasOilNo(),
childOrder.getGasOilLiters().toString(),
order.getTotalPrice().toString()
) + "<BR>";
sp.print(device.getDeviceSn(), printStr, 1);
/* sp.print(device.getDeviceSn(),
SpPrinterTemplate.oilClientStubTemp(
childOrder.getGoodsName(),
order.getOrderNo(),
DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
order.getMemPhone(),
"嗨森逛",
childOrder.getGasGunNo(),
childOrder.getGasOilNo(),
childOrder.getGasOilLiters().toString(),
order.getTotalPrice().toString()
), 1);
), 1);*/
} catch (Exception e) {
e.printStackTrace();
}
@ -1719,31 +1730,17 @@ public class HighOrderServiceImpl implements HighOrderService {
new Thread(() -> {
try {
mqttProviderConfig.publish(2, false, device.getDeviceImei(),
ZkcPrinterTemplate.oilCashierStubTemp(
ZkcPrinterTemplate.oilTemp(
childOrder.getGoodsName(),
order.getOrderNo(),
DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
order.getMemPhone(),
"嗨森逛",
childOrder.getGasGunNo(),
childOrder.getGasOilNo(),
childOrder.getGasOilLiters().toString(),
order.getTotalPrice().toString()
));
Thread.sleep(6000);
mqttProviderConfig.publish(2, false, device.getDeviceImei(),
ZkcPrinterTemplate.oilClientStubTemp(
childOrder.getGoodsName(),
order.getOrderNo(),
DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
"嗨森逛",
childOrder.getGasGunNo(),
childOrder.getGasOilNo(),
childOrder.getGasOilLiters().toString(),
order.getTotalPrice().toString()
));
} catch (Exception e) {
e.getMessage();
}

@ -30,6 +30,8 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
@ -41,10 +43,13 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
@Service("outRechargeOrderService")
public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
private static final Logger log = LoggerFactory.getLogger(OutRechargeOrderServiceImpl.class);
@Resource
private OutRechargeOrderMapper outRechargeOrderMapper;
@ -141,7 +146,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
DateUtil.format(MapUtils.getString(map, "createTimeE"), "yyyy-MM-dd HH:mm:ss"));
}
example.setOrderByClause("create_timed desc");
example.setOrderByClause("create_timed ASC");
return outRechargeOrderMapper.selectByExample(example);
}
@ -729,7 +734,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
// 查询充值产品
OutRechargePriceModel outRechargePrice = outRechargePriceService.findById(outRechargeOrder.getGoodsId(), null);
System.out.println("话费定时任务 -> 需要重新充值:开始");
// 查询充值子订单
Map<String, Object> childOrderMap = new HashMap<>();
@ -756,8 +761,8 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
// 查询充值子订单
Map<String, Object> childOrderMap103 = new HashMap<>();
childOrderMap.put("parent_order_id", outRechargeOrder.getId());
childOrderMap.put("status", 103);
childOrderMap103.put("parent_order_id", outRechargeOrder.getId());
childOrderMap103.put("status", 103);
List<OutRechargeChildOrder> childOrderList103 = outRechargeChildOrderService.getListRechargeChildOrder(childOrderMap103);
if (childOrderList103.size() > 0) {
@ -785,12 +790,12 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
for (String s : rechargePlatform) {
// 尖椒充值
System.out.println("话费定时任务 -> 需要重新充值:尖椒开始");
if (s.equals("1") && type == 1) {
object.put("out_order_id", orderNo);
object.put("amount", outRechargePrice.getRechargePrice());
object.put("mobile", outRechargeOrder.getRechargeContent());
object.put("notifyUrl", CommonSysConst.getSysConfig().getJjNotifyUrl());
System.out.println("outRechargeOrder-----------------------------------------------------------------------------------------------------------------------------------------------------" + outRechargePrice.getRechargeType());
if (outRechargeOrder.getRechargeType() == 1) {
object.put("is_fast", 1);
}
@ -806,12 +811,12 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
}
// 龙阅充值
if (s.equals("2") && type == 2) {
System.out.println("话费定时任务 -> 需要重新充值:龙阅开始");
object.put("out_trade_num", orderNo);
object.put("product_id", outRechargePrice.getGoodsId());
object.put("mobile", outRechargeOrder.getRechargeContent());
object.put("notifyUrl", CommonSysConst.getSysConfig().getLyNotifyUrl());
JSONObject returnObject = RechargeConfig.rechargeOrderByLy(object);
System.out.println("龙阅请求回调地址---------------------" + CommonSysConst.getSysConfig().getLyNotifyUrl());
object.put("return_content", returnObject);
if (returnObject != null && returnObject.getLong("errno") == 0) {
childOrder.setStatus(102);
@ -852,6 +857,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
outRechargeOrder.setRechargeStatus(204);
}
outRechargeOrderService.updateOrder(outRechargeOrder);
System.out.println("话费定时任务 -> 需要重新充值:结束");
}
@Override

@ -66,9 +66,13 @@ JjAppSecret = xkf9eoq2cjh6uvzp0mtrga134lnibdw8
#LY
LyNotifyUrl = https://hsgcs.dctpay.com/crest/czOrder/rechargeCallbackByLy
LyApiKey=CMdyxh2gJ7tbXc6rS0KADqPIfVpaQLjU
LyMemberId=18665
LyPostUrl=https://cz.31994.cn/yrapi.php/
#LyApiKey=CMdyxh2gJ7tbXc6rS0KADqPIfVpaQLjU
#LyMemberId=18665
#LyPostUrl=https://cz.31994.cn/yrapi.php/
LyApiKey=UzMxo9SIL1tmFvWTwys7pQRGJqO3EChK
LyMemberId=11236
LyPostUrl=http://cz.zt10010.com/yrapi.php/
unionAppId=7113783e75354df2a985efd3f31b9528
unionSecret=e2c731d2a026469aa6d218432f361653

@ -56,9 +56,12 @@ JjAppSecret = bf57pnqy8mkexr0v169c3g4odazwu2ij
#LY
LyNotifyUrl = https://hsg.dctpay.com/crest/czOrder/rechargeCallbackByLy
LyApiKey=CMdyxh2gJ7tbXc6rS0KADqPIfVpaQLjU
LyMemberId=18665
LyPostUrl=https://cz.31994.cn/yrapi.php/
#LyApiKey=CMdyxh2gJ7tbXc6rS0KADqPIfVpaQLjU
#LyMemberId=18665
#LyPostUrl=https://cz.31994.cn/yrapi.php/
LyApiKey=UzMxo9SIL1tmFvWTwys7pQRGJqO3EChK
LyMemberId=11236
LyPostUrl=http://cz.zt10010.com/yrapi.php/
unionAppId=ced46392acfe42be863fdfdd3e61164a
unionSecret=a0f380bb22cd4ce2a8d35f3bf437d6fa

@ -56,9 +56,12 @@ JjAppSecret = bf57pnqy8mkexr0v169c3g4odazwu2ij
#LY
LyNotifyUrl = https://hsg.dctpay.com/crest/czOrder/rechargeCallbackByLy
LyApiKey=CMdyxh2gJ7tbXc6rS0KADqPIfVpaQLjU
LyMemberId=18665
LyPostUrl=https://cz.31994.cn/yrapi.php/
#LyApiKey=CMdyxh2gJ7tbXc6rS0KADqPIfVpaQLjU
##LyMemberId=18665
##LyPostUrl=https://cz.31994.cn/yrapi.php/
LyApiKey=UzMxo9SIL1tmFvWTwys7pQRGJqO3EChK
LyMemberId=11236
LyPostUrl=http://cz.zt10010.com/yrapi.php/
unionAppId=ced46392acfe42be863fdfdd3e61164a
unionSecret=a0f380bb22cd4ce2a8d35f3bf437d6fa

Loading…
Cancel
Save