Commit b657dbc9 by guojx

好办小程序埋点趋势图时间补零修复

parent 465aa02a
......@@ -152,6 +152,7 @@ public class EventTrackingController extends NewBaseController {
storeAuthUtils.setStoreGroupJsonParam(jsonObject, qo);
jsonObject.put("apolloKey", "data_point_anal_hb_app_store");
DataPageVO vo = storeAuthUtils.getDataCommon(jsonObject.toJSONString(), qo.getPageNum(), "data_point_anal_hb_app_store", qo.getPageSize(), true);
storeAuthUtils.deleteTotalData(vo);
if (CollectionUtils.isNotEmpty(vo.getRows())) {
vo.setRows(JSONArray.parseArray(JSON.toJSONString(vo.getRows()), WechatEventTrackingStoreGroupVO.class));
}
......
......@@ -28,6 +28,7 @@ public class WechatEventTrackingStoreGroupHandle extends DownloadHandlerAbstract
public List<WechatEventTrackingStoreGroupVO> getData(Context context, String searchDataParams, Integer currentPage) {
List<JSONObject> list = storeAuthUtils.getDataCommon(searchDataParams, currentPage,
"数据-登录数据-好办使用详情导出日志进来", getPageSize(), false).getRows();
list = storeAuthUtils.deleteTotalData(list);
if (CollectionUtils.isNotEmpty(list)) {
List<WechatEventTrackingStoreGroupVO> result = JSONObject.parseArray(JSON.toJSONString(list), WechatEventTrackingStoreGroupVO.class);
return result;
......
......@@ -53,6 +53,11 @@ public class WechatEventTrackingClerkDetailQO implements Serializable {
private String storeGroupId;
/**
* 0:未登录
*/
private Integer isLogin;
/**
* 门店ID。可为空
*/
private String storeId;
......@@ -74,7 +79,7 @@ public class WechatEventTrackingClerkDetailQO implements Serializable {
public Integer getDataApiOrderField() {
Map<String, Integer> map = new HashMap<>(8);
map.put("visitTime", 1);
map.put("avgVisitTime", 1);
map.put("lastVisitTime", 2);
return map.get(orderByFields) == null ? 1 : map.get(orderByFields);
}
......@@ -98,6 +103,9 @@ public class WechatEventTrackingClerkDetailQO implements Serializable {
if (orderByFields != null) {
jsonObject.put("orderByFields", getDataApiOrderField());
}
if (isLogin != null) {
jsonObject.put("isLogin", isLogin);
}
jsonObject.put("pageNum", pageNum);
jsonObject.put("pageSize", pageSize);
if (StringUtils.isNotBlank(vagueQueryClerk)) {
......
......@@ -45,6 +45,7 @@ public class StoreAuthUtils {
}
WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
jsonObject.put("enterpriseId", login.getEnterpriseId());
jsonObject.put("wxEnterpriseId ", login.getWxEnterpriseId());
}
public List<String> getAuthStoreId(StoreGroupCommonQO storeCommonQO) {
......@@ -166,46 +167,12 @@ public class StoreAuthUtils {
JSONObject jsonObject = JSONObject.parseObject(searchDataParams);
Integer storeGroup = jsonObject.getInteger("storeGroup");
boolean isStore = storeGroup != null && storeGroup == 7;
boolean isRecycle = storeGroup == null || storeGroup == 8;
boolean isFirstGroup = storeGroup != null && storeGroup == 1;
jsonObject.put("pageNum", currentPage);
jsonObject.put("pageSize", pageSize);
String apolloKey = jsonObject.getString("apolloKey");
String allApolloKey = jsonObject.getString("allApolloKey");
if (isRecycle) {
jsonObject.put("storeGroup", 8);
JSONObject recycle = getTotalJson(jsonObject, apolloKey);
if (recycle == null) {
recycle = new JSONObject();
recycle.put("storeGroupName", "合计(0)");
vo.setTotalNum(0);
} else {
recycle.put("storeGroupName", "合计(1)");
vo.setTotalNum(1);
}
recycle.put("storeGroupId", "all");
List<JSONObject> list = new ArrayList<>();
list.add(recycle);
JSONObject temp = JSONObject.parseObject(recycle.toJSONString());
temp.put("storeGroupName", "回收站门店");
temp.put("storeGroupId", "-3");
list.add(temp);
vo.setRows(list);
return vo;
}
List<String> getRecycleStore = null;
List<String> storeIdListParam = (List<String>) jsonObject.get("storeId");
boolean hasRecycle = jsonObject.getInteger("recycleFlag") != null && jsonObject.getInteger("recycleFlag") == 1;
if (hasRecycle) {
getRecycleStore = (List<String>) jsonObject.get("recycleStoreIdList");
}
Map<String, Object> res = DataApiUtils.http(jsonObject.toJSONString(), apolloKey);
Page page = DataApiUtils.getPageData(res);
......@@ -219,11 +186,7 @@ public class StoreAuthUtils {
list = new ArrayList<>();
}
jsonObject.put("pageNum", 1);
if (hasRecycle) {
//回收站门店,加回去
storeIdListParam.addAll(getRecycleStore);
jsonObject.put("storeId", storeIdListParam.stream().collect(Collectors.joining(",")));
}
jsonObject.put("storeGroup", 8);
String totalApolloKey = apolloKey;
if (StringUtils.isNotBlank(allApolloKey)) {
......@@ -241,21 +204,29 @@ public class StoreAuthUtils {
total.put("storeGroupId", "all");
list.add(0, total);
}
vo.setRows(list);
return vo;
}
if (hasRecycle) {
jsonObject.put("storeId", getRecycleStore.stream().collect(Collectors.joining(",")));
JSONObject recycle = getTotalJson(jsonObject, apolloKey);
if (recycle == null) {
recycle = new JSONObject();
}
recycle.put("storeGroupName", "回收站门店");
recycle.put("storeGroupId", "-3");
/**
* 删除合计的那条数据
* @param vo
*/
public void deleteTotalData(DataPageVO vo) {
deleteTotalData(vo.getRows());
}
list.add(1, recycle);
public List<JSONObject> deleteTotalData(List<JSONObject> list) {
if (CollectionUtils.isNotEmpty(list)) {
if (list.size() == 1 && "all".equals(list.get(0).getString("storeGroupId"))) {
return Collections.EMPTY_LIST;
} else {
//删除合计的那条数据
list.remove(0);
}
}
vo.setRows(list);
return vo;
return list;
}
private List<String> getStore(String enterpriseId, String userId, String search, List<String> storeGroupIdList, List<String> status, List<String> storeIdList) {
......
......@@ -15,7 +15,7 @@ public class WechatEventTrackingClerkVO extends StoreGroupCommonVO implements Se
/**
* 1访问时长 单位秒
*/
private Long visitTime;
private Long avgVisitTime;
/**
* 访问时长 00:00:00格式
......@@ -52,21 +52,21 @@ public class WechatEventTrackingClerkVO extends StoreGroupCommonVO implements Se
private String clerkCode;
public String getVisitTimeStr() {
if (visitTime != null) {
int hour = (int) (visitTime / 3600);
if (avgVisitTime != null) {
int hour = (int) (avgVisitTime / 3600);
String str = getTimeStr(hour);
if (hour > 0) {
visitTime = visitTime - (3600 * hour);
avgVisitTime = avgVisitTime - (3600 * hour);
}
int minute = (int) (visitTime / 60);
int minute = (int) (avgVisitTime / 60);
str = str + ":" + getTimeStr(minute);
if (minute > 0) {
visitTime = visitTime - (60 * minute);
avgVisitTime = avgVisitTime - (60 * minute);
}
str = str +":"+ getTimeStr(visitTime.shortValue());
str = str +":"+ getTimeStr(avgVisitTime.shortValue());
return str;
}
return visitTimeStr;
......
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