提交查询门店和积分返利

yy_dev
袁野 1 year ago
parent da8cf31979
commit 8ab50f8ec0
  1. 2
      cweb/src/main/java/com/cweb/controller/BsStoreCidController.java
  2. 53
      service/src/main/java/com/hfkj/service/BsStoreCidService.java
  3. 94
      service/src/main/java/com/hfkj/service/impl/BsStoreCidServiceImpl.java

@ -81,6 +81,8 @@ public class BsStoreCidController {
bsStoreCidService.editStoreCid(bsStoreCid);
}
bsStoreCidService.getPushRecord(storeCid.getStoreId());
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {

@ -2,7 +2,9 @@ package com.hfkj.service;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.entity.BsStoreCid;
import com.hfkj.entity.BsStorePushRecord;
import java.util.List;
import java.util.Map;
/**
@ -51,5 +53,56 @@ public interface BsStoreCidService {
*/
void storePush(JSONObject object);
/**
* @Author Sum1Dream
* @Name getPushRecord
* @Description // 推送播报记录
* @Date 10:56 2023/6/15
* @Param [storeId]
* @Return void
*/
void getPushRecord(Long storeId);
/**
* @Author Sum1Dream
* @Name insertStoreCid
* @Description // 新增门店语音播报推送记录
* @Date 15:14 2023/6/14
* @Param [storeCid]
* @Return void
*/
void insertStorePushRecord(BsStorePushRecord storePushRecord);
/**
* @Author Sum1Dream
* @Name editStoreCid
* @Description // 编辑门店语音播报推送记录
* @Date 15:15 2023/6/14
* @Param [storeCid]
* @Return void
*/
void editStorePushRecord(BsStorePushRecord storePushRecord);
/**
* @Author Sum1Dream
* @Name findByMap
* @Description // 查询门店语音播报推送记录
* @Date 15:40 2023/6/14
* @Param [map]
* @Return com.hfkj.entity.BsStoreCid
*/
BsStorePushRecord findPushRecordByMap(Map<String , Object> map);
/**
* @Author Sum1Dream
* @Name getList
* @Description // 查询门店语音播报推送记录列表
* @Date 10:41 2023/6/15
* @Param [map]
* @Return java.util.List<com.hfkj.entity.BsStorePushRecord>
*/
List<BsStorePushRecord> getList(Map<String , Object> map);
}

@ -4,9 +4,13 @@ import com.alibaba.fastjson.JSONObject;
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;
import com.hfkj.entity.BsStoreCidExample;
import com.hfkj.entity.BsStorePushRecord;
import com.hfkj.entity.BsStorePushRecordExample;
import com.hfkj.service.BsStoreCidService;
import com.hfkj.tts.HWYunSisService;
import com.hfkj.unipush.UniPushService;
@ -17,6 +21,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;
@ -32,6 +37,9 @@ public class BsStoreCidServiceImpl implements BsStoreCidService {
@Resource
private BsStoreCidMapper bsStoreCidMapper;
@Resource
private BsStorePushRecordMapper storePushRecordMapper;
@Override
public void insertStoreCid(BsStoreCid storeCid) {
bsStoreCidMapper.insert(storeCid);
@ -93,13 +101,93 @@ public class BsStoreCidServiceImpl implements BsStoreCidService {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "生成语音失败");
}
object.put("cid", bsStoreCid.getCid());
object.put("body", auditPath);
UniPushService.pushToSingleByCid(object);
BsStorePushRecord storePushRecord = new BsStorePushRecord();
storePushRecord.setStoreId(bsStoreCid.getStoreId());
storePushRecord.setCreateTime(new Date());
storePushRecord.setUpdateTime(new Date());
storePushRecord.setStatus(2);
storePushRecord.setVoiceUrl(CommonSysConst.getSysConfig().getDomainName() + auditPath);
storePushRecordMapper.insert(storePushRecord);
getPushRecord(bsStoreCid.getStoreId());
} catch (Exception e) {
log.info("请求超时:" + e);
}
}
@Override
public void getPushRecord(Long storeId) {
Map<String, Object> map = new HashMap<>();
map.put("storeId", storeId);
BsStoreCid bsStoreCid = findByMap(map);
if (bsStoreCid == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "不存在推送关系");
}
// 查询可推送语音
Map<String , Object> pushMap = new HashMap<>();
pushMap.put("storeId" , storeId);
pushMap.put("status" , 2);
BsStorePushRecord storePushRecord = findPushRecordByMap(pushMap);
if (storePushRecord != null) {
JSONObject object = new JSONObject();
object.put("cid", bsStoreCid.getCid());
object.put("body", storePushRecord.getVoiceUrl());
UniPushService.pushToSingleByCid(object);
}
}
@Override
public void insertStorePushRecord(BsStorePushRecord storePushRecord) {
storePushRecordMapper.insert(storePushRecord);
}
@Override
public void editStorePushRecord(BsStorePushRecord storePushRecord) {
storePushRecordMapper.updateByPrimaryKey(storePushRecord);
}
@Override
public BsStorePushRecord findPushRecordByMap(Map<String, Object> map) {
BsStorePushRecordExample example = new BsStorePushRecordExample();
BsStorePushRecordExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "storeId") != null) {
criteria.andStoreIdEqualTo(MapUtils.getLong(map, "storeId"));
}
if (MapUtils.getInteger(map, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status"));
}
List<BsStorePushRecord> list = storePushRecordMapper.selectByExample(example);
if (list.size() > 0) {
return list.get(0);
}
return null;
}
@Override
public List<BsStorePushRecord> getList(Map<String, Object> map) {
BsStorePushRecordExample example = new BsStorePushRecordExample();
BsStorePushRecordExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "storeId") != null) {
criteria.andStoreIdEqualTo(MapUtils.getLong(map, "storeId"));
}
if (MapUtils.getInteger(map, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status"));
}
return storePushRecordMapper.selectByExample(example);
}
}

Loading…
Cancel
Save