|
|
@ -4,9 +4,13 @@ import com.alibaba.fastjson.JSONObject; |
|
|
|
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.config.CommonSysConst; |
|
|
|
import com.hfkj.dao.BsStoreCidMapper; |
|
|
|
import com.hfkj.dao.BsStoreCidMapper; |
|
|
|
|
|
|
|
import com.hfkj.dao.BsStorePushRecordMapper; |
|
|
|
import com.hfkj.entity.BsStoreCid; |
|
|
|
import com.hfkj.entity.BsStoreCid; |
|
|
|
import com.hfkj.entity.BsStoreCidExample; |
|
|
|
import com.hfkj.entity.BsStoreCidExample; |
|
|
|
|
|
|
|
import com.hfkj.entity.BsStorePushRecord; |
|
|
|
|
|
|
|
import com.hfkj.entity.BsStorePushRecordExample; |
|
|
|
import com.hfkj.service.BsStoreCidService; |
|
|
|
import com.hfkj.service.BsStoreCidService; |
|
|
|
import com.hfkj.tts.HWYunSisService; |
|
|
|
import com.hfkj.tts.HWYunSisService; |
|
|
|
import com.hfkj.unipush.UniPushService; |
|
|
|
import com.hfkj.unipush.UniPushService; |
|
|
@ -17,6 +21,7 @@ import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.annotation.Resource; |
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
@ -32,6 +37,9 @@ public class BsStoreCidServiceImpl implements BsStoreCidService { |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private BsStoreCidMapper bsStoreCidMapper; |
|
|
|
private BsStoreCidMapper bsStoreCidMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private BsStorePushRecordMapper storePushRecordMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void insertStoreCid(BsStoreCid storeCid) { |
|
|
|
public void insertStoreCid(BsStoreCid storeCid) { |
|
|
|
bsStoreCidMapper.insert(storeCid); |
|
|
|
bsStoreCidMapper.insert(storeCid); |
|
|
@ -93,13 +101,93 @@ public class BsStoreCidServiceImpl implements BsStoreCidService { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "生成语音失败"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "生成语音失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
object.put("cid", bsStoreCid.getCid()); |
|
|
|
BsStorePushRecord storePushRecord = new BsStorePushRecord(); |
|
|
|
object.put("body", auditPath); |
|
|
|
storePushRecord.setStoreId(bsStoreCid.getStoreId()); |
|
|
|
UniPushService.pushToSingleByCid(object); |
|
|
|
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) { |
|
|
|
} catch (Exception e) { |
|
|
|
log.info("请求超时:" + 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); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|