Commit 74a30011 by 阳浪

消息优化

parent 05834675
...@@ -264,13 +264,6 @@ public class ResearchController { ...@@ -264,13 +264,6 @@ public class ResearchController {
BaseModel<Page<com.yizhi.research.application.vo.domain.ResearchVo>> model = new BaseModel<>(); BaseModel<Page<com.yizhi.research.application.vo.domain.ResearchVo>> model = new BaseModel<>();
model.setContext(ContextHolder.get()); model.setContext(ContextHolder.get());
model.setObj(page); model.setObj(page);
RequestContext context = ContextHolder.get();
// 添加调研埋点
if(request.getHeader("Cookie")!=null&&Objects.equals(redisCache.get(request.getHeader("Cookie").replace("JSESSIONID=","")),"2")){
eventTrackApiClients.addEvent("event_research",context.getAccountId());
}
return Response.ok(researchClient.listPage(model)); return Response.ok(researchClient.listPage(model));
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("", e); LOGGER.error("", e);
......
...@@ -2,6 +2,7 @@ package com.yizhi.application.research.controller; ...@@ -2,6 +2,7 @@ package com.yizhi.application.research.controller;
import com.yizhi.application.point.constant.MQqueuesEnum; import com.yizhi.application.point.constant.MQqueuesEnum;
import com.yizhi.application.point.constant.PointEventEnum; import com.yizhi.application.point.constant.PointEventEnum;
import com.yizhi.core.application.cache.RedisCache;
import com.yizhi.core.application.context.ContextHolder; import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.core.application.context.RequestContext; import com.yizhi.core.application.context.RequestContext;
import com.yizhi.point.application.feign.PointRedisFeignClients; import com.yizhi.point.application.feign.PointRedisFeignClients;
...@@ -12,6 +13,7 @@ import com.yizhi.research.application.model.AnswerModel; ...@@ -12,6 +13,7 @@ import com.yizhi.research.application.model.AnswerModel;
import com.yizhi.research.application.vo.api.AnswerVo; import com.yizhi.research.application.vo.api.AnswerVo;
import com.yizhi.research.application.vo.api.ViewAnswerVo; import com.yizhi.research.application.vo.api.ViewAnswerVo;
import com.yizhi.research.application.vo.domain.ResearchVo; import com.yizhi.research.application.vo.domain.ResearchVo;
import com.yizhi.site.application.feign.api.EventTrackApiClients;
import com.yizhi.util.application.domain.Response; import com.yizhi.util.application.domain.Response;
import com.yizhi.util.application.enums.i18n.Constants; import com.yizhi.util.application.enums.i18n.Constants;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -23,7 +25,9 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -23,7 +25,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Date; import java.util.Date;
import java.util.Objects;
/** /**
* @Author: shengchenglong * @Author: shengchenglong
...@@ -42,12 +46,17 @@ public class ResearchAnswerController { ...@@ -42,12 +46,17 @@ public class ResearchAnswerController {
private ResearchClient researchClient; private ResearchClient researchClient;
@Autowired @Autowired
private PointRedisFeignClients pointRedisFeignClients; private PointRedisFeignClients pointRedisFeignClients;
@Autowired
private EventTrackApiClients eventTrackApiClients;
@Autowired
private RedisCache redisCache;
/*@Autowired /*@Autowired
private AmqpTemplate amqpTemplate;*/ private AmqpTemplate amqpTemplate;*/
@PostMapping("/submit") @PostMapping("/submit")
@ApiOperation(value = "学员提交调研答案") @ApiOperation(value = "学员提交调研答案")
public Response<Integer> submitAnswer( public Response<Integer> submitAnswer(HttpServletRequest request,
@ApiParam(name = "answerVo", value = "答案vo", required = true) @RequestBody AnswerVo answerVo @ApiParam(name = "answerVo", value = "答案vo", required = true) @RequestBody AnswerVo answerVo
) { ) {
try { try {
...@@ -106,6 +115,10 @@ public class ResearchAnswerController { ...@@ -106,6 +115,10 @@ public class ResearchAnswerController {
if (num == -3) { if (num == -3) {
return Response.fail(Constants.RESEARCH_MSG_ANSWER_TOO_SHORT); return Response.fail(Constants.RESEARCH_MSG_ANSWER_TOO_SHORT);
} }
// 添加调研埋点
if(request.getHeader("Cookie")!=null&& Objects.equals(redisCache.get(request.getHeader("Cookie").replace("JSESSIONID=","")),"2")){
eventTrackApiClients.addEvent("event_research",ContextHolder.get().getAccountId());
}
return Response.fail(Constants.RESEARCH_MSG_BIZ_ERROR); return Response.fail(Constants.RESEARCH_MSG_BIZ_ERROR);
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("", e); LOGGER.error("", e);
......
...@@ -40,14 +40,9 @@ public class ResearchController { ...@@ -40,14 +40,9 @@ public class ResearchController {
@Autowired @Autowired
private ResearchClient researchClient; private ResearchClient researchClient;
@Autowired
private EventTrackApiClients eventTrackApiClients;
@Autowired
private RedisCache redisCache;
@GetMapping("/page/list") @GetMapping("/page/list")
@ApiOperation(value = "分页查询学员能看到的调研", notes = "分两种状态", response = ResearchVo.class) @ApiOperation(value = "分页查询学员能看到的调研", notes = "分两种状态", response = ResearchVo.class)
public Response<ResearchVo> listPage(HttpServletRequest request, public Response<ResearchVo> listPage(
@ApiParam(name = "state", value = "状态:1已完成,2进行中", required = false) @RequestParam(name = "state", required = false) Integer state, @ApiParam(name = "state", value = "状态:1已完成,2进行中", required = false) @RequestParam(name = "state", required = false) Integer state,
@ApiParam(name = "bizType", value = "业务类型:1调研;2投票,为空查询所有", required = false) @RequestParam(name = "bizType", required = false) Integer bizType, @ApiParam(name = "bizType", value = "业务类型:1调研;2投票,为空查询所有", required = false) @RequestParam(name = "bizType", required = false) Integer bizType,
@ApiParam(name = "pageNo", value = "跳转页数,默认第一页", required = true) @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @ApiParam(name = "pageNo", value = "跳转页数,默认第一页", required = true) @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
...@@ -67,10 +62,7 @@ public class ResearchController { ...@@ -67,10 +62,7 @@ public class ResearchController {
model.setDate(new Date()); model.setDate(new Date());
model.setObj(pageVo); model.setObj(pageVo);
model.setContext(ContextHolder.get()); model.setContext(ContextHolder.get());
// 添加调研埋点
if(request.getHeader("Cookie")!=null&& Objects.equals(redisCache.get(request.getHeader("Cookie").replace("JSESSIONID=","")),"2")){
eventTrackApiClients.addEvent("event_research",ContextHolder.get().getAccountId());
}
return Response.ok(researchClient.apiListPage(model)); return Response.ok(researchClient.apiListPage(model));
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("", e); LOGGER.error("", e);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment