提交查询门店和积分返利

yy_dev
袁野 1 year ago
parent 1dea5e98e0
commit 8c7f1e8067
  1. 82
      service/src/main/java/com/hfkj/service/impl/BsStoreCidServiceImpl.java

@ -5,6 +5,7 @@ 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.common.utils.RedisUtil;
import com.hfkj.config.CommonSysConst;
import com.hfkj.dao.BsStoreCidMapper;
import com.hfkj.dao.BsStorePushRecordMapper;
@ -41,6 +42,9 @@ public class BsStoreCidServiceImpl implements BsStoreCidService {
@Resource
private BsStorePushRecordMapper storePushRecordMapper;
@Resource
private RedisUtil redisUtil;
@Override
public void insertStoreCid(BsStoreCid storeCid) {
bsStoreCidMapper.insert(storeCid);
@ -82,45 +86,49 @@ public class BsStoreCidServiceImpl implements BsStoreCidService {
public void storePush(JSONObject object) {
try {
if (object == null ||
object.getBigDecimal("price") == null ||
object.getLong("storeId") == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
Map<String, Object> 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, "生成语音失败");
String key = "APP_PUSH" + object.getLong("storeId");
if (redisUtil.get(key) == null) {
redisUtil.set(key,object.getLong("storeId"), 5);
if (object.getBigDecimal("price") == null || object.getLong("storeId") == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
Map<String, Object> 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, "生成语音失败");
}
String taskNo = Base64Util.generateOrderNo();
object.put("taskNo", taskNo);
object.put("cid", bsStoreCid.getCid());
String msg = CommonSysConst.getSysConfig().getDomainName() + auditPath + "!@#PUSH#@!" + taskNo + "!@#PUSH#@!" + "惠支付收款:" + object.getBigDecimal("price");
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);
}
} else {
storePush(object);
}
String taskNo = Base64Util.generateOrderNo();
object.put("taskNo", taskNo);
object.put("cid", bsStoreCid.getCid());
String msg = CommonSysConst.getSysConfig().getDomainName() + auditPath + "!@#PUSH#@!" + taskNo + "!@#PUSH#@!" + "惠支付收款:" + object.getBigDecimal("price");
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) {
log.info("请求超时:" + e);
}
@ -167,6 +175,8 @@ public class BsStoreCidServiceImpl implements BsStoreCidService {
if (storePushRecord != null) {
storePushRecord.setStatus(1);
storePushRecordMapper.updateByPrimaryKey(storePushRecord);
redisUtil.del("APP_PUSH" + storePushRecord.getStoreId());
}
getPushRecord(storeId);

Loading…
Cancel
Save