From b76569ce56e2be9c0a1fab330edce0bd3cd2cdc1 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Thu, 15 Jun 2023 10:05:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=9F=A5=E8=AF=A2=E9=97=A8?= =?UTF-8?q?=E5=BA=97=E5=92=8C=E7=A7=AF=E5=88=86=E8=BF=94=E5=88=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/BsStoreCidServiceImpl.java | 51 +++++++++++-------- .../service/impl/BsTradeOrderServiceImpl.java | 11 +++- 2 files changed, 39 insertions(+), 23 deletions(-) diff --git a/service/src/main/java/com/hfkj/service/impl/BsStoreCidServiceImpl.java b/service/src/main/java/com/hfkj/service/impl/BsStoreCidServiceImpl.java index 7bc1396..b007da9 100644 --- a/service/src/main/java/com/hfkj/service/impl/BsStoreCidServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/impl/BsStoreCidServiceImpl.java @@ -12,6 +12,8 @@ import com.hfkj.tts.HWYunSisService; import com.hfkj.unipush.UniPushService; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -25,6 +27,8 @@ import java.util.Map; @Service("bsStoreCidService") public class BsStoreCidServiceImpl implements BsStoreCidService { + private static Logger log = LoggerFactory.getLogger(BsStoreCidService.class); + @Resource private BsStoreCidMapper bsStoreCidMapper; @@ -67,29 +71,34 @@ public class BsStoreCidServiceImpl implements BsStoreCidService { @Override public void storePush(JSONObject object) { - if (object == null || - object.getBigDecimal("price") == null || - object.getLong("storeId") == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); - } - - Map map = new HashMap<>(); - map.put("storeId", object.getLong("storeId")); - BsStoreCid bsStoreCid = findByMap(map); - if (bsStoreCid == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "不存在推送关系"); + try { + if (object == null || + object.getBigDecimal("price") == null || + object.getLong("storeId") == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + Map map = new HashMap<>(); + map.put("storeId", object.getLong("storeId")); + BsStoreCid bsStoreCid = findByMap(map); + + if (bsStoreCid == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "不存在推送关系"); + } + // 获取语音播报地址 + String auditPath = HWYunSisService.ttsCustomDemo(object); + + if (auditPath == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "生成语音失败"); + } + + object.put("cid", bsStoreCid.getCid()); + object.put("body", auditPath); + UniPushService.pushToSingleByCid(object); + } catch (Exception e) { + log.info("请求超时:" + e); } - // 获取语音播报地址 - String auditPath = HWYunSisService.ttsCustomDemo(object); - - if (auditPath == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "生成语音失败"); - } - - object.put("cid", bsStoreCid.getCid()); - object.put("body", auditPath); - UniPushService.pushToSingleByCid(object); } diff --git a/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java b/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java index b161153..172e1e0 100644 --- a/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java @@ -7,9 +7,7 @@ import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.SysCode; import com.hfkj.common.utils.DateUtil; -import com.hfkj.common.utils.HttpsUtils; import com.hfkj.common.utils.IDGenerator; -import com.hfkj.config.CommonSysConst; import com.hfkj.config.device.SoundService; import com.hfkj.dao.BsTradeOrderMapper; import com.hfkj.entity.*; @@ -39,6 +37,9 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService { @Resource private BsSalesmanService salesmanService; + @Resource + private BsStoreCidService bsStoreCidService; + @Resource private BsStoreService storeService; @@ -276,6 +277,12 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService { tradeOrder.getCreateTime()); } + JSONObject objectPush = new JSONObject(); + + objectPush.put("storeId" , tradeOrder.getStoreId()); + objectPush.put("price" , tradeOrder.getTradeAmount()); + bsStoreCidService.storePush(objectPush); + // 创建分账 if (tradeOrder.getProfitSharingStatus().equals(true)) { tradeOrderProfitSharingService.createProfitSharing(tradeOrder);