提交查询门店和积分返利

yy_dev
袁野 1 year ago
parent 1dea5e98e0
commit 8c7f1e8067
  1. 20
      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.ErrorCode;
import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode; import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.RedisUtil;
import com.hfkj.config.CommonSysConst; import com.hfkj.config.CommonSysConst;
import com.hfkj.dao.BsStoreCidMapper; import com.hfkj.dao.BsStoreCidMapper;
import com.hfkj.dao.BsStorePushRecordMapper; import com.hfkj.dao.BsStorePushRecordMapper;
@ -41,6 +42,9 @@ public class BsStoreCidServiceImpl implements BsStoreCidService {
@Resource @Resource
private BsStorePushRecordMapper storePushRecordMapper; private BsStorePushRecordMapper storePushRecordMapper;
@Resource
private RedisUtil redisUtil;
@Override @Override
public void insertStoreCid(BsStoreCid storeCid) { public void insertStoreCid(BsStoreCid storeCid) {
bsStoreCidMapper.insert(storeCid); bsStoreCidMapper.insert(storeCid);
@ -82,9 +86,12 @@ public class BsStoreCidServiceImpl implements BsStoreCidService {
public void storePush(JSONObject object) { public void storePush(JSONObject object) {
try { try {
if (object == null ||
object.getBigDecimal("price") == null || String key = "APP_PUSH" + object.getLong("storeId");
object.getLong("storeId") == null) {
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, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
} }
@ -118,8 +125,9 @@ public class BsStoreCidServiceImpl implements BsStoreCidService {
storePushRecord.setVoiceUrl(msg); storePushRecord.setVoiceUrl(msg);
insertStorePushRecord(storePushRecord); insertStorePushRecord(storePushRecord);
} }
} else {
storePush(object);
}
} catch (Exception e) { } catch (Exception e) {
log.info("请求超时:" + e); log.info("请求超时:" + e);
@ -167,6 +175,8 @@ public class BsStoreCidServiceImpl implements BsStoreCidService {
if (storePushRecord != null) { if (storePushRecord != null) {
storePushRecord.setStatus(1); storePushRecord.setStatus(1);
storePushRecordMapper.updateByPrimaryKey(storePushRecord); storePushRecordMapper.updateByPrimaryKey(storePushRecord);
redisUtil.del("APP_PUSH" + storePushRecord.getStoreId());
} }
getPushRecord(storeId); getPushRecord(storeId);

Loading…
Cancel
Save