Commit 454cf6a9 by xiehongfei

feat:新增区经角色好办访问数据

parent c42aa1bb
...@@ -35,10 +35,7 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -35,10 +35,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -64,7 +61,20 @@ public class EventTrackingController extends NewBaseController { ...@@ -64,7 +61,20 @@ public class EventTrackingController extends NewBaseController {
*/ */
@RequestMapping(value = "overview") @RequestMapping(value = "overview")
public RestResponse<WechatEventTrackingOverviewVO> overview(@RequestBody WechatOverviewQO qo) { public RestResponse<WechatEventTrackingOverviewVO> overview(@RequestBody WechatOverviewQO qo) {
Map<String, Object> res = DataApiUtils.http(getOverviewParam(qo).toJSONString(), "data_point_anal_hb_app_overview"); String jsonParam = null;
String apolloKey = "data_point_anal_hb_app_overview";
if (Objects.equals(qo.getClerkBizType(), 2)) {
apolloKey = "data_point_anal_hb_app_manage_overview";
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(qo);
WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
jsonObject.put("enterpriseId", login.getEnterpriseId());
jsonObject.put("wxEnterpriseId", login.getWxEnterpriseId());
jsonParam = jsonObject.toJSONString();
} else {
jsonParam = getOverviewParam(qo).toJSONString();
}
Map<String, Object> res = DataApiUtils.http(jsonParam, apolloKey);
List<JSONObject> list = DataApiUtils.getDataList(res); List<JSONObject> list = DataApiUtils.getDataList(res);
return RestResponse.successResult(CollectionUtils.isEmpty(list) ? new WechatEventTrackingOverviewVO() : JSONObject.parseObject(JSON.toJSONString(list.get(0)), WechatEventTrackingOverviewVO.class)); return RestResponse.successResult(CollectionUtils.isEmpty(list) ? new WechatEventTrackingOverviewVO() : JSONObject.parseObject(JSON.toJSONString(list.get(0)), WechatEventTrackingOverviewVO.class));
} }
...@@ -76,7 +86,20 @@ public class EventTrackingController extends NewBaseController { ...@@ -76,7 +86,20 @@ public class EventTrackingController extends NewBaseController {
*/ */
@RequestMapping(value = "trend") @RequestMapping(value = "trend")
public RestResponse<List<TrendVO>> trend(@RequestBody WechatOverviewQO qo) { public RestResponse<List<TrendVO>> trend(@RequestBody WechatOverviewQO qo) {
Map<String, Object> res = DataApiUtils.http(getOverviewParam(qo).toJSONString(), "data_point_anal_hb_app_trend"); String jsonParam = null;
String apolloKey = "data_point_anal_hb_app_trend";
if (Objects.equals(qo.getClerkBizType(), 2)) {
apolloKey = "data_point_anal_hb_app_manage_trend";
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(qo);
WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
jsonObject.put("enterpriseId", login.getEnterpriseId());
jsonObject.put("wxEnterpriseId", login.getWxEnterpriseId());
jsonParam = jsonObject.toJSONString();
} else {
jsonParam = getOverviewParam(qo).toJSONString();
}
Map<String, Object> res = DataApiUtils.http(jsonParam, apolloKey);
List<JSONObject> list = DataApiUtils.getDataList(res); List<JSONObject> list = DataApiUtils.getDataList(res);
Map<String, JSONObject> map = new HashMap<>(); Map<String, JSONObject> map = new HashMap<>();
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
...@@ -107,15 +130,26 @@ public class EventTrackingController extends NewBaseController { ...@@ -107,15 +130,26 @@ public class EventTrackingController extends NewBaseController {
*/ */
@RequestMapping(value = "view-module") @RequestMapping(value = "view-module")
public RestResponse<List<ViewModuleVO>> viewModule(@RequestBody WechatOverviewQO qo) { public RestResponse<List<ViewModuleVO>> viewModule(@RequestBody WechatOverviewQO qo) {
JSONObject jsonParam = getOverviewParam(qo); JSONObject jsonParam = null;
String apolloKey = "data_point_anal_hb_app_module";
if (Objects.equals(qo.getClerkBizType(), 2)) {
apolloKey = "data_point_anal_hb_app_manage_module";
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(qo);
WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
jsonObject.put("enterpriseId", login.getEnterpriseId());
jsonObject.put("wxEnterpriseId", login.getWxEnterpriseId());
jsonParam = jsonObject;
} else {
jsonParam = getOverviewParam(qo);
}
List<MapThreadHandlerRequest> list = new ArrayList<>(); List<MapThreadHandlerRequest> list = new ArrayList<>();
// 1 访问次数 2 访问人数 3 访问时长 // 1 访问次数 2 访问人数 3 访问时长
jsonParam.put("orderByFields", 1); jsonParam.put("orderByFields", 1);
list.add(new MapThreadHandlerRequest(jsonParam, "data_point_anal_hb_app_module", "1_visitCnt")); list.add(new MapThreadHandlerRequest(jsonParam, apolloKey, "1_visitCnt"));
jsonParam.put("orderByFields", 2); jsonParam.put("orderByFields", 2);
list.add(new MapThreadHandlerRequest(jsonParam, "data_point_anal_hb_app_module", "2_visitNum")); list.add(new MapThreadHandlerRequest(jsonParam, apolloKey, "2_visitNum"));
jsonParam.put("orderByFields", 3); jsonParam.put("orderByFields", 3);
list.add(new MapThreadHandlerRequest(jsonParam, "data_point_anal_hb_app_module", "3_visitTime")); list.add(new MapThreadHandlerRequest(jsonParam, apolloKey, "3_visitTime"));
Map<String, List<JSONObject>> map = ConcurrencyUtils.concurrencyDataForMap(list); Map<String, List<JSONObject>> map = ConcurrencyUtils.concurrencyDataForMap(list);
...@@ -229,7 +263,7 @@ public class EventTrackingController extends NewBaseController { ...@@ -229,7 +263,7 @@ public class EventTrackingController extends NewBaseController {
} }
/** /**
* 导购明细 * 导购/区经/督导明细
* @param qo * @param qo
* @return * @return
*/ */
...@@ -237,12 +271,20 @@ public class EventTrackingController extends NewBaseController { ...@@ -237,12 +271,20 @@ public class EventTrackingController extends NewBaseController {
public RestResponse<DataPageVO<WechatEventTrackingClerkVO>> clerk(@RequestBody WechatEventTrackingClerkDetailQO qo) { public RestResponse<DataPageVO<WechatEventTrackingClerkVO>> clerk(@RequestBody WechatEventTrackingClerkDetailQO qo) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
qo.dealWithParam(jsonObject); qo.dealWithParam(jsonObject);
List<String> statusList = new ArrayList<>(); String apolloKey = "data_point_anal_hb_app_clerk";
statusList.add("2"); if (Objects.equals(qo.getClerkBizType(), 2)) {
storeAuthUtils.setStoreGroupJsonParam(jsonObject, new StoreGroupCommonQO() WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
.setStoreGroupId(qo.getStoreGroupId()).setStoreId(qo.getStoreId()).setStatusList(statusList)); jsonObject.put("enterpriseId", login.getEnterpriseId());
jsonObject.put("wxEnterpriseId", login.getWxEnterpriseId());
apolloKey = "data_point_anal_hb_app_manage";
} else {
List<String> statusList = new ArrayList<>();
statusList.add("2");
storeAuthUtils.setStoreGroupJsonParam(jsonObject, new StoreGroupCommonQO()
.setStoreGroupId(qo.getStoreGroupId()).setStoreId(qo.getStoreId()).setStatusList(statusList));
}
Map<String, Object> res = DataApiUtils.http(jsonObject.toJSONString(), "data_point_anal_hb_app_clerk"); Map<String, Object> res = DataApiUtils.http(jsonObject.toJSONString(), apolloKey);
DataPageVO<WechatEventTrackingClerkVO> vo = new DataPageVO<>(); DataPageVO<WechatEventTrackingClerkVO> vo = new DataPageVO<>();
Page page = DataApiUtils.getPageData(res); Page page = DataApiUtils.getPageData(res);
vo.setTotalNum(page.getTotalCount()); vo.setTotalNum(page.getTotalCount());
...@@ -286,23 +328,40 @@ public class EventTrackingController extends NewBaseController { ...@@ -286,23 +328,40 @@ public class EventTrackingController extends NewBaseController {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
qo.dealWithParam(jsonObject); qo.dealWithParam(jsonObject);
List<String> statusList = new ArrayList<>();
statusList.add("2");
storeAuthUtils.setStoreGroupJsonParam(jsonObject, new StoreGroupCommonQO()
.setStoreGroupId(qo.getStoreGroupId()).setStoreId(qo.getStoreId()).setStatusList(statusList));
jsonObject.put("apolloKey", "data_point_anal_hb_app_clerk");
//Excel的标题是字段进行计算 //Excel的标题是字段进行计算
List<String> indexList = new ArrayList<>(); List<String> indexList = new ArrayList<>();
List<String> fieldList = new ArrayList<>(); List<String> fieldList = new ArrayList<>();
indexList.add("导购code"); if (Objects.equals(qo.getClerkBizType(), 2)) {
fieldList.add("clerkCode"); WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
indexList.add("导购名称"); jsonObject.put("enterpriseId", login.getEnterpriseId());
fieldList.add("clerkName"); jsonObject.put("wxEnterpriseId", login.getWxEnterpriseId());
indexList.add("归属门店名称"); jsonObject.put("apolloKey", "data_point_anal_hb_app_manage");
fieldList.add("storeName");
indexList.add("归属门店code"); indexList.add("区经/督导code");
fieldList.add("storeCode"); fieldList.add("clerkCode");
indexList.add("区经/督导名称");
fieldList.add("clerkName");
task.setFileName("区经/督导明细数据-" + qo.getStartDate() + (StringUtils.isNotBlank(qo.getEndDate()) ? "_" + qo.getEndDate() : ""));
} else {
List<String> statusList = new ArrayList<>();
statusList.add("2");
storeAuthUtils.setStoreGroupJsonParam(jsonObject, new StoreGroupCommonQO()
.setStoreGroupId(qo.getStoreGroupId()).setStoreId(qo.getStoreId()).setStatusList(statusList));
jsonObject.put("apolloKey", "data_point_anal_hb_app_clerk");
indexList.add("导购code");
fieldList.add("clerkCode");
indexList.add("导购名称");
fieldList.add("clerkName");
indexList.add("归属门店名称");
fieldList.add("storeName");
indexList.add("归属门店code");
fieldList.add("storeCode");
task.setFileName("导购明细数据-" + qo.getStartDate() + (StringUtils.isNotBlank(qo.getEndDate()) ? "_" + qo.getEndDate() : ""));
}
indexList.add("是否绑定"); indexList.add("是否绑定");
fieldList.add("isBinding"); fieldList.add("isBinding");
...@@ -316,7 +375,6 @@ public class EventTrackingController extends NewBaseController { ...@@ -316,7 +375,6 @@ public class EventTrackingController extends NewBaseController {
fieldList.add("lastVisitTime"); fieldList.add("lastVisitTime");
task.setFileName("导购明细数据-" + qo.getStartDate() + (StringUtils.isNotBlank(qo.getEndDate()) ? "_" + qo.getEndDate() : ""));
task.setChannelName("数据-登录数据-好办使用详情"); task.setChannelName("数据-登录数据-好办使用详情");
task.setBucketName(BucketNameEnum.REPORT_50000.getName()); task.setBucketName(BucketNameEnum.REPORT_50000.getName());
jsonObject.put("indexList", indexList); jsonObject.put("indexList", indexList);
......
...@@ -77,6 +77,11 @@ public class WechatEventTrackingClerkDetailQO implements Serializable { ...@@ -77,6 +77,11 @@ public class WechatEventTrackingClerkDetailQO implements Serializable {
*/ */
private String requestProject; private String requestProject;
/**
* 业务类型:1:导购,2:区经/督导
*/
private Integer clerkBizType = 1;
public Integer getDataApiOrderField() { public Integer getDataApiOrderField() {
Map<String, Integer> map = new HashMap<>(8); Map<String, Integer> map = new HashMap<>(8);
map.put("avgVisitTime", 1); map.put("avgVisitTime", 1);
......
...@@ -34,4 +34,9 @@ public class WechatOverviewQO implements Serializable { ...@@ -34,4 +34,9 @@ public class WechatOverviewQO implements Serializable {
* 门店ID。可为空 * 门店ID。可为空
*/ */
private String storeId; private String storeId;
/**
* 业务类型:1:导购,2:区经/督导
*/
private Integer clerkBizType = 1;
} }
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