提交查询门店和积分返利

yy_dev
袁野 1 year ago
parent 923e3291b8
commit 0b71573faf
  1. 7
      cweb/src/main/java/com/cweb/controller/BsStoreCidController.java
  2. 11
      service/src/main/java/com/hfkj/service/BsStoreCidService.java
  3. 21
      service/src/main/java/com/hfkj/service/impl/BsStoreCidServiceImpl.java
  4. 38
      service/src/main/java/com/hfkj/unipush/UniPushService.java

@ -79,8 +79,6 @@ public class BsStoreCidController {
bsStoreCidService.editStoreCid(bsStoreCid);
}
bsStoreCidService.getPushRecord(storeCid.getStoreId());
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
@ -92,10 +90,11 @@ public class BsStoreCidController {
@RequestMapping(value="/voiceSucceed",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "语音播报成功")
public ResponseData voiceSucceed(@RequestParam(value = "storeId", required = true) Long storeId) {
public ResponseData voiceSucceed(@RequestParam(value = "storeId", required = true) Long storeId,
@RequestParam(value = "taskNo", required = true) String taskNo) {
try {
bsStoreCidService.voiceSucceed(storeId);
bsStoreCidService.voiceSucceed(storeId , taskNo);
return ResponseMsgUtil.success("操作成功");

@ -53,17 +53,8 @@ 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);
void voiceSucceed(Long storeId);
void voiceSucceed(Long storeId , String taskNo);
/**
* @Author Sum1Dream

@ -4,7 +4,6 @@ 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;
@ -21,7 +20,6 @@ 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;
@ -101,15 +99,10 @@ public class BsStoreCidServiceImpl implements BsStoreCidService {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "生成语音失败");
}
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);
object.put("cid", bsStoreCid.getCid());
object.put("body", auditPath);
UniPushService.pushToSingleByCid(object);
storePushRecordMapper.insert(storePushRecord);
getPushRecord(bsStoreCid.getStoreId());
} catch (Exception e) {
log.info("请求超时:" + e);
@ -117,8 +110,7 @@ public class BsStoreCidServiceImpl implements BsStoreCidService {
}
@Override
public void getPushRecord(Long storeId) {
private void getPushRecord(Long storeId) {
Map<String, Object> map = new HashMap<>();
map.put("storeId", storeId);
@ -145,14 +137,17 @@ public class BsStoreCidServiceImpl implements BsStoreCidService {
}
@Override
public void voiceSucceed(Long storeId) {
public void voiceSucceed(Long storeId , String taskNo) {
Map<String , Object> pushMap = new HashMap<>();
pushMap.put("storeId" , storeId);
pushMap.put("ext1" , storeId);
pushMap.put("status" , 2);
BsStorePushRecord storePushRecord = findPushRecordByMap(pushMap);
storePushRecord.setStatus(1);
storePushRecordMapper.updateByPrimaryKey(storePushRecord);
getPushRecord(storeId);
}
@Override

@ -9,10 +9,18 @@ import com.getui.push.v2.sdk.common.ApiResult;
import com.getui.push.v2.sdk.dto.req.Audience;
import com.getui.push.v2.sdk.dto.req.message.PushDTO;
import com.getui.push.v2.sdk.dto.req.message.PushMessage;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.IDGenerator;
import com.hfkj.config.CommonSysConst;
import com.hfkj.entity.BsStorePushRecord;
import com.hfkj.service.BsStoreCidService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Resource;
import java.util.Date;
import java.util.Map;
import java.util.Random;
/**
* @author sum1dream
@ -20,6 +28,9 @@ import java.util.Map;
public class UniPushService {
private static Logger log = LoggerFactory.getLogger(UniPushService.class);
@Resource
private static BsStoreCidService bsStoreCidService;
/**
* 创建请求
* @return
@ -49,7 +60,7 @@ public class UniPushService {
* @Param [uniPushModel]
* @Return void
*/
public static String pushToSingleByCid(JSONObject object) {
public static void pushToSingleByCid(JSONObject object) {
log.info("========= START 个推手机端推送 START ===========");
@ -74,13 +85,28 @@ public class UniPushService {
log.info("========= END 个推手机端推送 END ===========");
if (apiResult.isSuccess()) {
return apiResult.getData().toString();
// success
} else {
return "code:" + apiResult.getCode() + ", msg: " + apiResult.getMsg();
// failed
if (apiResult.getData().toString().contains("successed_online")) {
BsStorePushRecord storePushRecord = new BsStorePushRecord();
storePushRecord.setStoreId(object.getLong("storeid"));
storePushRecord.setCreateTime(new Date());
storePushRecord.setUpdateTime(new Date());
storePushRecord.setStatus(2);
storePushRecord.setExt1(generateOrderNo());
storePushRecord.setVoiceUrl(CommonSysConst.getSysConfig().getDomainName() + object.getString("body") + "!@#PUSH#@!" + storePushRecord.getExt1());
bsStoreCidService.insertStorePushRecord(storePushRecord);
}
}
}
public static String generateOrderNo(){
try {
// 5位随机数 + 1位线程生成数
String randomNum = (new Random().nextInt(8999) + 1000) + IDGenerator.nextId(1);
// 生成订单号
return DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + randomNum;
} catch (Exception e) {
return null;
}
}
}

Loading…
Cancel
Save