提交代码

dev-discount
胡锐 3 years ago
parent c8f129252c
commit e68e5dde5c
  1. 5
      .gitignore
  2. 10
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java
  3. 2
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  4. 56
      hai-msg/target/classes/application.yml
  5. BIN
      hai-msg/target/classes/com/MsgApplication.class
  6. BIN
      hai-msg/target/classes/com/msg/controller/HighMegController.class
  7. 4
      hai-msg/target/classes/config.properties
  8. 72
      hai-msg/target/classes/logback.xml
  9. BIN
      hai-msg/target/hai-msg-1.0-SNAPSHOT.jar
  10. BIN
      hai-msg/target/hai-msg-1.0-SNAPSHOT.jar.original
  11. 4
      hai-msg/target/maven-archiver/pom.properties
  12. 2
      hai-msg/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
  13. 2
      hai-msg/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
  14. 271
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  15. 66
      hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java

5
.gitignore vendored

@ -18,6 +18,11 @@ hai-order/log/*
hai-order/hai-order.iml
hai-msg/target/*
hai-msg/log/*
hai-msg/hai-msg.iml
hai-schedule/target/*
hai-schedule/log/*
hai-schedule/hai-schedule.iml

@ -13,6 +13,8 @@ import com.hai.common.security.UserCenter;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.IDGenerator;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonSysConfig;
import com.hai.config.CommonSysConst;
import com.hai.config.TuanYouConfig;
import com.hai.entity.*;
import com.hai.enum_type.DiscountUseScope;
@ -264,7 +266,13 @@ public class HighOrderController {
childOrder.setGasLitersPreferences(priceModel.getLitersPreferences());
childOrder.setGasPricePreferences(priceModel.getPricePreferences());
childOrder.setGoodsImg(store.getStoreLogo());
// 来源类型 1:平台自建 2:团油
if (store.getSourceType().equals(2)) {
childOrder.setGoodsImg(store.getStoreLogo());
} else {
childOrder.setGoodsImg(CommonSysConst.getSysConfig().getHsgDomainName()+"/filesystem/"+store.getStoreLogo());
}
childOrder.setGoodsName(store.getStoreName());
childOrder.setGoodsSpecName("默认");
childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString())));

File diff suppressed because one or more lines are too long

@ -0,0 +1,56 @@
server:
port: 9901
servlet:
context-path: /msg
#配置是否为debug模式,debug模式下,不开启权限校验
debug: false
#datasource数据源设置
spring:
datasource:
url: jdbc:mysql://139.159.177.244:3306/hfkj?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
password: HF123456.
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
filters: stat
maxActive: 10
initialSize: 5
maxWait: 60000
minIdle: 5
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: select 'x'
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
redis:
database: 0
host: 139.159.177.244
port: 36379
password: HF123456.Redis
timeout: 36000000
jedis:
pool:
max-active: 20
max-wait: -1
max-idle: 10
min-idle: 0
#配置日期返回至前台为时间戳
jackson:
serialization:
write-dates-as-timestamps: true
mybatis:
mapperLocations:
- classpath*:sqlmap*/*.xml
type-aliases-package:
org.springboot.sample.entity
pagehelper:
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
params: count=countSql

@ -0,0 +1,4 @@
fileUrl=/home/project/hsg/filesystem
cmsPath=/home/project/hsg/filesystem/cmsPath
agentQrCode=/home/project/hsg/filesystem/agentQrCode
agentQrCodeWxUrl=https://hsgcs.dctpay.com/wx/?action=ic&id=

@ -0,0 +1,72 @@
<configuration>
<!-- %m输出的信息,%p日志级别,%t线程名,%d日期,%c类的全名,,,, -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d %p (%file:%line\)- %m%n</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<appender name="baselog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/base.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/base.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<appender name="daolog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/dao.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/dao.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<appender name="errorlog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/error.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/error.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="STDOUT" />
</root>
<logger name="com.hai" level="DEBUG">
<appender-ref ref="baselog" />
</logger>
<logger name="com.hai.dao" level="DEBUG">
<appender-ref ref="daolog" />
</logger>
<logger name="com.hai" level="ERROR">
<appender-ref ref="errorlog" />
</logger>
</configuration>

@ -0,0 +1,4 @@
#Created by Apache Maven 3.6.3
version=1.0-SNAPSHOT
groupId=com.hgj
artifactId=hai-msg

@ -0,0 +1,2 @@
com\msg\controller\HighMegController.class
com\MsgApplication.class

@ -0,0 +1,2 @@
D:\hurui\huifu\hai-server\hai-msg\src\main\java\com\MsgApplication.java
D:\hurui\huifu\hai-server\hai-msg\src\main\java\com\msg\controller\HighMegController.java

@ -7,6 +7,7 @@ import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.HttpsUtils;
import com.hai.config.*;
import com.hai.dao.*;
import com.hai.entity.*;
@ -362,6 +363,7 @@ public class HighOrderServiceImpl implements HighOrderService {
// 来源类型 1:平台自建 2:团油
if (store.getSourceType().equals(1)) {
// 预存类型 0:非预存 1:预存门店
if (store.getPrestoreType() != null && store.getPrestoreType().equals(1)) {
Map<String, Object> pushParam = new HashMap<>();
@ -472,13 +474,16 @@ public class HighOrderServiceImpl implements HighOrderService {
updateOrder(highOrder);
new Thread(() -> {
if (highOrder.getHighChildOrderList().get(0).getGoodsType().equals(3)) {
Map<String, Object> message = new HashMap<>();
message.put("order", highOrderService.getGasOrderDetail(highOrder.getOrderNo()));
message.put("voice", baiduVoiceService.text2audio(highOrder.getHighChildOrderList().get(0).getGoodsName() + "加油站,收款:" + highOrder.getTotalPrice()));
Map<String, Object> pushMsg = new HashMap<>();
pushMsg.put("userId", highOrder.getHighChildOrderList().get(0).getGoodsId());
Map<String, Object> msgContent = new HashMap<>();
msgContent.put("order", highOrderService.getGasOrderDetail(highOrder.getOrderNo()));
msgContent.put("voice", baiduVoiceService.text2audio(highOrder.getHighChildOrderList().get(0).getGoodsName() + "加油站,收款:" + highOrder.getTotalPrice()));
pushMsg.put("message", JSONObject.toJSONString(msgContent));
HttpsUtils.doGet("http://127.0.0.1:9901/msg/websocket/websocket", pushMsg);
}
}).start();
}
@ -648,45 +653,109 @@ public class HighOrderServiceImpl implements HighOrderService {
if (highChildOrder.getGoodsType() == 3) {
highChildOrder.setChildOrdeStatus(3);
order.setOrderStatus(3);
HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId());
// 推送团油订单
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("gasId", store.getStoreKey());
paramMap.put("oilNo", highChildOrder.getGasOilNo());
paramMap.put("gunNo", highChildOrder.getGasGunNo());
BigDecimal priceGun = highChildOrder.getGasPriceGun();
BigDecimal priceVip = highChildOrder.getGasPriceVip();
paramMap.put("priceGun", priceGun); // 枪单价
paramMap.put("priceVip", priceVip); // 优惠价
paramMap.put("driverPhone", order.getMemPhone());
paramMap.put("thirdSerialNo", order.getOrderNo());
paramMap.put("refuelingAmount", highChildOrder.getTotalPrice());
// 油品类型 1:汽油:2:柴油;3:天然气
if (highChildOrder.getGasOilType() == 1) {
paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouGasolineAccount());
} else if (highChildOrder.getGasOilType() == 2) {
paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouDieselAccount());
}
JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(paramMap);
// 推送团油订单记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type1.getType());
highGasOrderPush.setOrderNo(order.getOrderNo());
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setCode(orderPushObject.getString("code"));
highGasOrderPush.setRequestContent(JSONObject.toJSONString(paramMap));
highGasOrderPush.setReturnContent(orderPushObject.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
if (orderPushObject != null && orderPushObject.getString("code").equals("200")) {
highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo"));
// 来源类型 1:平台自建 2:团油
if (store.getSourceType().equals(1)) {
// 预存类型 0:非预存 1:预存门店
if (store.getPrestoreType() != null && store.getPrestoreType().equals(1)) {
Map<String, Object> pushParam = new HashMap<>();
pushParam.put("businessType", MerStoreAmountTypeEnum.type2.getType());
pushParam.put("storeId", highChildOrder.getGoodsId());
pushParam.put("price", order.getTotalPrice());
pushParam.put("sourceType", MerStoreAmountSourceTypeEnum.type2.getType());
pushParam.put("sourceId", order.getId());
pushParam.put("sourceContent", "订单号:" + order.getOrderNo() + ",加油金额:¥" + order.getTotalPrice());
pushParam.put("opUserId", order.getMemId());
pushParam.put("opUserName", order.getMemName());
// 扣预存款
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam);
}
new Thread(() -> {
try {
SpPrinterConfig sp = new SpPrinterConfig();
sp.print(store.getDeviceSn(),
SpPrinterTemplate.oilCashierStubTemp(
highChildOrder.getGoodsName(),
order.getOrderNo(),
DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
"嗨森逛",
highChildOrder.getGasGunNo(),
highChildOrder.getGasOilNo(),
highChildOrder.getGasOilLiters().toString(),
order.getTotalPrice().toString()
), 1);
sp.print(store.getDeviceSn(),
SpPrinterTemplate.oilClientStubTemp(
highChildOrder.getGoodsName(),
order.getOrderNo(),
DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
"嗨森逛",
highChildOrder.getGasGunNo(),
highChildOrder.getGasOilNo(),
highChildOrder.getGasOilLiters().toString(),
order.getTotalPrice().toString()
), 1);
} catch (Exception e) {
e.printStackTrace();
}
}).start();
} else if (store.getSourceType().equals(2)) {
// 推送团油订单
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("gasId", store.getStoreKey());
paramMap.put("oilNo", highChildOrder.getGasOilNo());
paramMap.put("gunNo", highChildOrder.getGasGunNo());
BigDecimal priceGun = highChildOrder.getGasPriceGun();
BigDecimal priceVip = highChildOrder.getGasPriceVip();
paramMap.put("priceGun", priceGun); // 枪单价
paramMap.put("priceVip", priceVip); // 优惠价
paramMap.put("driverPhone", order.getMemPhone());
paramMap.put("thirdSerialNo", order.getOrderNo());
paramMap.put("refuelingAmount", highChildOrder.getTotalPrice());
// 油品类型 1:汽油:2:柴油;3:天然气
if (highChildOrder.getGasOilType() == 1) {
paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouGasolineAccount());
} else if (highChildOrder.getGasOilType() == 2) {
paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouDieselAccount());
}
JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(paramMap);
// 推送团油订单记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type1.getType());
highGasOrderPush.setOrderNo(order.getOrderNo());
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setCode(orderPushObject.getString("code"));
highGasOrderPush.setRequestContent(JSONObject.toJSONString(paramMap));
highGasOrderPush.setReturnContent(orderPushObject.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
if (orderPushObject != null && orderPushObject.getString("code").equals("200")) {
highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo"));
}
}
}
}
updateOrder(order);
new Thread(() -> {
if (order.getHighChildOrderList().get(0).getGoodsType().equals(3)) {
Map<String, Object> pushMsg = new HashMap<>();
pushMsg.put("userId", order.getHighChildOrderList().get(0).getGoodsId());
Map<String, Object> msgContent = new HashMap<>();
msgContent.put("order", highOrderService.getGasOrderDetail(order.getOrderNo()));
msgContent.put("voice", baiduVoiceService.text2audio(order.getHighChildOrderList().get(0).getGoodsName() + "加油站,收款:" + order.getTotalPrice()));
pushMsg.put("message", JSONObject.toJSONString(msgContent));
HttpsUtils.doGet("http://127.0.0.1:9901/msg/websocket/websocket", pushMsg);
}
}).start();
}
@Override
@ -916,39 +985,90 @@ public class HighOrderServiceImpl implements HighOrderService {
if (highChildOrder.getGoodsType() == 3) {
highChildOrder.setChildOrdeStatus(3);
order.setOrderStatus(3);
HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId());
// 推送团油订单
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("gasId", store.getStoreKey());
paramMap.put("oilNo", highChildOrder.getGasOilNo());
paramMap.put("gunNo", highChildOrder.getGasGunNo());
BigDecimal priceGun = highChildOrder.getGasPriceGun();
BigDecimal priceVip = highChildOrder.getGasPriceVip();
paramMap.put("priceGun", priceGun); // 枪单价
paramMap.put("priceVip", priceVip); // 优惠价
paramMap.put("driverPhone", order.getMemPhone());
paramMap.put("thirdSerialNo", order.getOrderNo());
paramMap.put("refuelingAmount", highChildOrder.getTotalPrice());
// 油品类型 1:汽油:2:柴油;3:天然气
if (highChildOrder.getGasOilType() == 1) {
paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouGasolineAccount());
} else if (highChildOrder.getGasOilType() == 2) {
paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouDieselAccount());
}
JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(paramMap);
// 推送团油订单记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type1.getType());
highGasOrderPush.setOrderNo(order.getOrderNo());
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setCode(orderPushObject.getString("code"));
highGasOrderPush.setRequestContent(JSONObject.toJSONString(paramMap));
highGasOrderPush.setReturnContent(orderPushObject.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
if (orderPushObject != null && orderPushObject.getString("code").equals("200")) {
highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo"));
// 来源类型 1:平台自建 2:团油
if (store.getSourceType().equals(1)) {
// 预存类型 0:非预存 1:预存门店
if (store.getPrestoreType() != null && store.getPrestoreType().equals(1)) {
Map<String, Object> pushParam = new HashMap<>();
pushParam.put("businessType", MerStoreAmountTypeEnum.type2.getType());
pushParam.put("storeId", highChildOrder.getGoodsId());
pushParam.put("price", order.getTotalPrice());
pushParam.put("sourceType", MerStoreAmountSourceTypeEnum.type2.getType());
pushParam.put("sourceId", order.getId());
pushParam.put("sourceContent", "订单号:" + order.getOrderNo() + ",加油金额:¥" + order.getTotalPrice());
pushParam.put("opUserId", order.getMemId());
pushParam.put("opUserName", order.getMemName());
// 扣预存款
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam);
}
new Thread(() -> {
try {
SpPrinterConfig sp = new SpPrinterConfig();
sp.print(store.getDeviceSn(),
SpPrinterTemplate.oilCashierStubTemp(
highChildOrder.getGoodsName(),
order.getOrderNo(),
DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
"嗨森逛",
highChildOrder.getGasGunNo(),
highChildOrder.getGasOilNo(),
highChildOrder.getGasOilLiters().toString(),
order.getTotalPrice().toString()
), 1);
sp.print(store.getDeviceSn(),
SpPrinterTemplate.oilClientStubTemp(
highChildOrder.getGoodsName(),
order.getOrderNo(),
DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
"嗨森逛",
highChildOrder.getGasGunNo(),
highChildOrder.getGasOilNo(),
highChildOrder.getGasOilLiters().toString(),
order.getTotalPrice().toString()
), 1);
} catch (Exception e) {
e.printStackTrace();
}
}).start();
} else if (store.getSourceType().equals(2)) {
// 推送团油订单
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("gasId", store.getStoreKey());
paramMap.put("oilNo", highChildOrder.getGasOilNo());
paramMap.put("gunNo", highChildOrder.getGasGunNo());
BigDecimal priceGun = highChildOrder.getGasPriceGun();
BigDecimal priceVip = highChildOrder.getGasPriceVip();
paramMap.put("priceGun", priceGun); // 枪单价
paramMap.put("priceVip", priceVip); // 优惠价
paramMap.put("driverPhone", order.getMemPhone());
paramMap.put("thirdSerialNo", order.getOrderNo());
paramMap.put("refuelingAmount", highChildOrder.getTotalPrice());
// 油品类型 1:汽油:2:柴油;3:天然气
if (highChildOrder.getGasOilType() == 1) {
paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouGasolineAccount());
} else if (highChildOrder.getGasOilType() == 2) {
paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouDieselAccount());
}
JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(paramMap);
// 推送团油订单记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type1.getType());
highGasOrderPush.setOrderNo(order.getOrderNo());
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setCode(orderPushObject.getString("code"));
highGasOrderPush.setRequestContent(JSONObject.toJSONString(paramMap));
highGasOrderPush.setReturnContent(orderPushObject.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
if (orderPushObject != null && orderPushObject.getString("code").equals("200")) {
highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo"));
}
}
}
@ -980,6 +1100,19 @@ public class HighOrderServiceImpl implements HighOrderService {
}
updateOrder(order);
new Thread(() -> {
if (order.getHighChildOrderList().get(0).getGoodsType().equals(3)) {
Map<String, Object> pushMsg = new HashMap<>();
pushMsg.put("userId", order.getHighChildOrderList().get(0).getGoodsId());
Map<String, Object> msgContent = new HashMap<>();
msgContent.put("order", highOrderService.getGasOrderDetail(order.getOrderNo()));
msgContent.put("voice", baiduVoiceService.text2audio(order.getHighChildOrderList().get(0).getGoodsName() + "加油站,收款:" + order.getTotalPrice()));
pushMsg.put("message", JSONObject.toJSONString(msgContent));
HttpsUtils.doGet("http://127.0.0.1:9901/msg/websocket/websocket", pushMsg);
}
}).start();
}
@Override

@ -8,11 +8,10 @@ import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.pay.util.XmlUtil;
import com.hai.common.pay.util.sdk.WXPayConstants;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.HttpsUtils;
import com.hai.common.utils.WxUtils;
import com.hai.config.CommonSysConst;
import com.hai.config.HuiLianTongConfig;
import com.hai.config.HuiLianTongUnionCardConfig;
import com.hai.config.TuanYouConfig;
import com.hai.config.*;
import com.hai.dao.HighCouponCodeOtherMapper;
import com.hai.dao.HighDiscountPackageRecordMapper;
import com.hai.dao.HighGasOrderPushMapper;
@ -122,6 +121,9 @@ public class GoodsOrderServiceImpl implements PayService {
@Resource
private HighMerchantStoreAccountService merchantStoreAccountService;
@Resource
private BaiduVoiceService baiduVoiceService;
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void paySuccess(Map<String, String> map, String payType) throws Exception {
@ -276,23 +278,56 @@ public class GoodsOrderServiceImpl implements PayService {
if (highChildOrder.getGoodsType() == 3) {
highChildOrder.setChildOrdeStatus(3);
order.setOrderStatus(3);
HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId());
// 来源类型 1:平台自建 2:团油
if (store.getSourceType().equals(1)) {
// 预存类型 0:非预存 1:预存门店
if (store.getPrestoreType() != null && store.getPrestoreType().equals(1)) {
Map<String, Object> otherParam = new HashMap<>();
otherParam.put("sourceType", MerStoreAmountSourceTypeEnum.type2.getType());
otherParam.put("sourceId", order.getId());
otherParam.put("sourceContent", "订单号:" + order.getOrderNo() + ",加油金额:¥" + order.getTotalPrice());
// merchantStoreAccountService.consume(store.getId(), order.getTotalPrice(), otherParam);
Map<String, Object> pushParam = new HashMap<>();
pushParam.put("businessType", MerStoreAmountTypeEnum.type2.getType());
pushParam.put("object", otherParam);
pushParam.put("storeId", highChildOrder.getGoodsId());
pushParam.put("price", order.getTotalPrice());
pushParam.put("sourceType", MerStoreAmountSourceTypeEnum.type2.getType());
pushParam.put("sourceId", order.getId());
pushParam.put("sourceContent", "订单号:" + order.getOrderNo() + ",加油金额:¥" + order.getTotalPrice());
pushParam.put("opUserId", order.getMemId());
pushParam.put("opUserName", order.getMemName());
// 扣预存款
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam);
}
new Thread(() -> {
try {
SpPrinterConfig sp = new SpPrinterConfig();
sp.print(store.getDeviceSn(),
SpPrinterTemplate.oilCashierStubTemp(
highChildOrder.getGoodsName(),
order.getOrderNo(),
DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
"嗨森逛",
highChildOrder.getGasGunNo(),
highChildOrder.getGasOilNo(),
highChildOrder.getGasOilLiters().toString(),
order.getTotalPrice().toString()
), 1);
sp.print(store.getDeviceSn(),
SpPrinterTemplate.oilClientStubTemp(
highChildOrder.getGoodsName(),
order.getOrderNo(),
DateUtil.date2String(order.getPayTime(), "yyyy-MM-dd HH:mm:ss"),
"嗨森逛",
highChildOrder.getGasGunNo(),
highChildOrder.getGasOilNo(),
highChildOrder.getGasOilLiters().toString(),
order.getTotalPrice().toString()
), 1);
} catch (Exception e) {
e.printStackTrace();
}
}).start();
} else if (store.getSourceType().equals(2)) {
// 推送团油订单
Map<String,Object> paramMap = new HashMap<>();
@ -404,7 +439,16 @@ public class GoodsOrderServiceImpl implements PayService {
highOrderService.updateOrder(order);
if (order.getHighChildOrderList().get(0).getGoodsType().equals(3)) {
new Thread(() -> {
Map<String, Object> message = new HashMap<>();
message.put("order", highOrderService.getGasOrderDetail(order.getOrderNo()));
message.put("voice", baiduVoiceService.text2audio(order.getHighChildOrderList().get(0).getGoodsName() + "加油站,收款:" + order.getTotalPrice()));
HttpsUtils.doGet("http://127.0.0.1:9901/msg/test/websocket", message);
}).start();
new Thread(() -> {
try {
Thread.sleep(120*1000);

Loading…
Cancel
Save