|
|
|
@ -1,9 +1,11 @@ |
|
|
|
|
package com.hfkj.service.impl; |
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.hfkj.common.Base64Util; |
|
|
|
|
import com.hfkj.common.exception.ErrorCode; |
|
|
|
|
import com.hfkj.common.exception.ErrorHelp; |
|
|
|
|
import com.hfkj.common.exception.SysCode; |
|
|
|
|
import com.hfkj.config.CommonSysConst; |
|
|
|
|
import com.hfkj.dao.BsStoreCidMapper; |
|
|
|
|
import com.hfkj.dao.BsStorePushRecordMapper; |
|
|
|
|
import com.hfkj.entity.BsStoreCid; |
|
|
|
@ -20,6 +22,7 @@ import org.slf4j.LoggerFactory; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
@ -92,6 +95,7 @@ public class BsStoreCidServiceImpl implements BsStoreCidService { |
|
|
|
|
if (bsStoreCid == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "不存在推送关系"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 获取语音播报地址
|
|
|
|
|
String auditPath = HWYunSisService.ttsCustomDemo(object); |
|
|
|
|
|
|
|
|
@ -99,9 +103,22 @@ public class BsStoreCidServiceImpl implements BsStoreCidService { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "生成语音失败"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String taskNo = Base64Util.generateOrderNo(); |
|
|
|
|
object.put("taskNo", taskNo); |
|
|
|
|
object.put("cid", bsStoreCid.getCid()); |
|
|
|
|
object.put("body", auditPath); |
|
|
|
|
UniPushService.pushToSingleByCid(object); |
|
|
|
|
String msg = CommonSysConst.getSysConfig().getDomainName() + auditPath + "!@#PUSH#@!" + taskNo; |
|
|
|
|
object.put("body", msg); |
|
|
|
|
if (UniPushService.pushToSingleByCid(object)) { |
|
|
|
|
BsStorePushRecord storePushRecord = new BsStorePushRecord(); |
|
|
|
|
storePushRecord.setStoreId(object.getLong("storeId")); |
|
|
|
|
storePushRecord.setCreateTime(new Date()); |
|
|
|
|
storePushRecord.setUpdateTime(new Date()); |
|
|
|
|
storePushRecord.setStatus(2); |
|
|
|
|
storePushRecord.setExt1(taskNo); |
|
|
|
|
storePushRecord.setVoiceUrl(msg); |
|
|
|
|
insertStorePushRecord(storePushRecord); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
@ -110,6 +127,8 @@ public class BsStoreCidServiceImpl implements BsStoreCidService { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void getPushRecord(Long storeId) { |
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
@ -130,6 +149,7 @@ public class BsStoreCidServiceImpl implements BsStoreCidService { |
|
|
|
|
if (storePushRecord != null) { |
|
|
|
|
JSONObject object = new JSONObject(); |
|
|
|
|
object.put("cid", bsStoreCid.getCid()); |
|
|
|
|
object.put("storeId", bsStoreCid.getCid()); |
|
|
|
|
object.put("body", storePushRecord.getVoiceUrl()); |
|
|
|
|
UniPushService.pushToSingleByCid(object); |
|
|
|
|
} |
|
|
|
@ -144,8 +164,10 @@ public class BsStoreCidServiceImpl implements BsStoreCidService { |
|
|
|
|
pushMap.put("status" , 2); |
|
|
|
|
BsStorePushRecord storePushRecord = findPushRecordByMap(pushMap); |
|
|
|
|
|
|
|
|
|
storePushRecord.setStatus(1); |
|
|
|
|
storePushRecordMapper.updateByPrimaryKey(storePushRecord); |
|
|
|
|
if (storePushRecord != null) { |
|
|
|
|
storePushRecord.setStatus(1); |
|
|
|
|
storePushRecordMapper.updateByPrimaryKey(storePushRecord); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getPushRecord(storeId); |
|
|
|
|
} |
|
|
|
|