|
|
@ -12,6 +12,8 @@ import com.hfkj.tts.HWYunSisService; |
|
|
|
import com.hfkj.unipush.UniPushService; |
|
|
|
import com.hfkj.unipush.UniPushService; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.annotation.Resource; |
|
|
@ -25,6 +27,8 @@ import java.util.Map; |
|
|
|
@Service("bsStoreCidService") |
|
|
|
@Service("bsStoreCidService") |
|
|
|
public class BsStoreCidServiceImpl implements BsStoreCidService { |
|
|
|
public class BsStoreCidServiceImpl implements BsStoreCidService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static Logger log = LoggerFactory.getLogger(BsStoreCidService.class); |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private BsStoreCidMapper bsStoreCidMapper; |
|
|
|
private BsStoreCidMapper bsStoreCidMapper; |
|
|
|
|
|
|
|
|
|
|
@ -67,29 +71,34 @@ public class BsStoreCidServiceImpl implements BsStoreCidService { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void storePush(JSONObject object) { |
|
|
|
public void storePush(JSONObject object) { |
|
|
|
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) { |
|
|
|
try { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "不存在推送关系"); |
|
|
|
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, "生成语音失败"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
object.put("cid", bsStoreCid.getCid()); |
|
|
|
|
|
|
|
object.put("body", auditPath); |
|
|
|
|
|
|
|
UniPushService.pushToSingleByCid(object); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.info("请求超时:" + e); |
|
|
|
} |
|
|
|
} |
|
|
|
// 获取语音播报地址
|
|
|
|
|
|
|
|
String auditPath = HWYunSisService.ttsCustomDemo(object); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (auditPath == null) { |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "生成语音失败"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
object.put("cid", bsStoreCid.getCid()); |
|
|
|
|
|
|
|
object.put("body", auditPath); |
|
|
|
|
|
|
|
UniPushService.pushToSingleByCid(object); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|