Commit 8e01e681 by 王祖波

使用素材明细

parent 60a0f555
......@@ -27,12 +27,7 @@ import com.gic.haoban.manage.web.export.ContentMaterialStoreUsedDataHandler;
import com.gic.haoban.manage.web.qo.content.ContentMaterialBaseQO;
import com.gic.haoban.manage.web.qo.content.statistics.*;
import com.gic.haoban.manage.web.utils.storestatusfilter.StoreStatusFilterUtils;
import com.gic.haoban.manage.web.vo.content.statistics.MaterialAreaUsedDataVO;
import com.gic.haoban.manage.web.vo.content.statistics.MaterialClerkUsedDataVO;
import com.gic.haoban.manage.web.vo.content.statistics.MaterialDataOverviewVO;
import com.gic.haoban.manage.web.vo.content.statistics.MaterialIndexDataVO;
import com.gic.haoban.manage.web.vo.content.statistics.MaterialRealDataVO;
import com.gic.haoban.manage.web.vo.content.statistics.MaterialStoreUsedDataVO;
import com.gic.haoban.manage.web.vo.content.statistics.*;
import com.gic.haoban.manage.web.vo.content.statistics.bo.MaterialTodayDataBO;
import com.gic.haoban.manage.web.vo.content.statistics.report.MaterialPersonalUsedDataVO;
import com.gic.qcloud.BucketNameEnum;
......@@ -157,6 +152,25 @@ public class MaterialDataStaticsController {
}
/**
* 素材使用分析页面-实时数据统计-详情
* @param materialStatisticsBaseQO
* @return
*/
@RequestMapping(path = "/content/material/real/detail/data")
public RestResponse<Page<MaterialRealDetailDataVO>> queryMaterialTodayDataDetail(@RequestBody MaterialTodayDetailDataQO materialStatisticsBaseQO) {
List<String> storeIds = new ArrayList<>();
if (StringUtils.isBlank(materialStatisticsBaseQO.getStoreId())) {
storeIds = clerkStoreAdaptor.queryClerkStoreIds(materialStatisticsBaseQO.getClerkId(), materialStatisticsBaseQO.getWxEnterpriseId(),
StoreStatusFilterUtils.getStoreStatusList(materialStatisticsBaseQO.getStoreStatusFilter()));
} else {
storeIds.add(materialStatisticsBaseQO.getStoreId());
}
Page<MaterialRealDetailDataVO> page = materialDataAdaptor.queryMaterialTodayDataDetail(materialStatisticsBaseQO, storeIds);
return RestResponse.successResult(page);
}
/**
* 素材使用分析页面-数据概览
*
* @param materialStatisticsBaseQO
......
package com.gic.haoban.manage.web.controller.content.adaptor;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.dto.StoreInfoDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.manage.api.dto.StaffClerkInfoDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
......@@ -17,6 +20,8 @@ import org.springframework.stereotype.Component;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Author MUSI
......@@ -34,6 +39,8 @@ public class ClerkStoreAdaptor {
private StaffClerkRelationApiService staffClerkRelationApiService;
@Autowired
private ClerkService clerkService;
@Autowired
private StoreService storeService;
/**
* 查询区经角色下管辖的门店权限
......@@ -99,4 +106,26 @@ public class ClerkStoreAdaptor {
return clerkDTOS;
}
public Map<String, ClerkDTO> queryClerkMap(List<String> clerkIds) {
if (CollectionUtils.isEmpty(clerkIds)) {
return Collections.emptyMap();
}
List<ClerkDTO> clerkDTOS = queryClerkInfos(clerkIds);
if (CollectionUtils.isEmpty(clerkDTOS)) {
return Collections.emptyMap();
}
return clerkDTOS.stream().collect(Collectors.toMap(ClerkDTO::getClerkId, clerkDTO -> clerkDTO));
}
public Map<String, StoreDTO> queryStoreMap(List<String> storeIds) {
if (CollectionUtils.isEmpty(storeIds)) {
return Collections.emptyMap();
}
String[] storeIdsArry = new String[storeIds.size()];
List<StoreDTO> storeDTOS = storeService.getStores(storeIds.toArray(storeIdsArry));
if (CollectionUtils.isEmpty(storeDTOS)) {
return Collections.emptyMap();
}
return storeDTOS.stream().collect(Collectors.toMap(StoreDTO::getStoreId, storeDTO -> storeDTO));
}
}
......@@ -7,16 +7,14 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.commons.util.DataApiUtils;
import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.manage.api.enums.content.MaterialReportType;
import com.gic.haoban.manage.web.qo.content.statistics.MaterialAnalyzeDataQO;
import com.gic.haoban.manage.web.qo.content.statistics.MaterialReportQO;
import com.gic.haoban.manage.web.qo.content.statistics.MaterialStoreAnalyzeDataQO;
import com.gic.haoban.manage.web.qo.content.statistics.MaterialStoreReportQO;
import com.gic.haoban.manage.web.qo.content.statistics.*;
import com.gic.haoban.manage.web.vo.content.creative.ContentMaterialConvsVO;
import com.gic.haoban.manage.web.vo.content.statistics.*;
import com.gic.haoban.manage.web.vo.content.statistics.bo.MaterialTodayDataBO;
......@@ -110,6 +108,8 @@ public class MaterialDataAdaptor {
private EnterpriseService enterpriseService;
@Autowired
private StoreService storeService;
@Autowired
private ClerkStoreAdaptor clerkStoreAdaptor;
/**
......@@ -121,6 +121,7 @@ public class MaterialDataAdaptor {
public MaterialTodayDataBO queryMaterialTodayData(String enterpriseId, List<String> storeIds) {
Map<String, Object> inlineParams = new HashMap<>();
inlineParams.put("enterpriseId", enterpriseId);
inlineParams.put("dataType", 1);
if (CollectionUtil.isNotEmpty(storeIds)) {
inlineParams.put("storeId", StringUtils.join(storeIds, ","));
}
......@@ -128,7 +129,7 @@ public class MaterialDataAdaptor {
if (result.get("data") == null) {
return MaterialTodayDataBO.empty();
}
List<MaterialTodayDataBO> datas = DataApiUtils.parseDataList(result, MaterialTodayDataBO.class);
List<MaterialTodayDataBO> datas = DataApiUtils.parsePageDataList(result, MaterialTodayDataBO.class);
if (CollectionUtils.isEmpty(datas)) {
return MaterialTodayDataBO.empty();
}
......@@ -163,6 +164,60 @@ public class MaterialDataAdaptor {
return datas.get(0);
}
/**
* 查询当天数据明细
* @param dataQO
* @param storeIds
* @return
*/
public Page<MaterialRealDetailDataVO> queryMaterialTodayDataDetail(MaterialTodayDetailDataQO dataQO, List<String> storeIds) {
int pageNum = dataQO.getPageNum();
int pageSize = dataQO.getPageSize();
String enterpriseId = dataQO.getEnterpriseId();
String order = dataQO.getOrder();
Map<String, Object> inlineParams = new HashMap<>();
inlineParams.put("pageNum", pageNum);
inlineParams.put("pageSize", pageSize);
inlineParams.put("enterpriseId", enterpriseId);
int orderByFields = DataApiUtils.getOrderByFields(dataQO.getOrderByField(), dataQO.getDefaultFields(), dataQO.getFieldsOrder());
inlineParams.put("orderByFields", orderByFields);
inlineParams.put("orderByType", DataApiUtils.getOrderByType(order));
inlineParams.put("dataType", dataQO.getDataType());
if (CollectionUtil.isNotEmpty(storeIds)) {
inlineParams.put("storeId", StringUtils.join(storeIds, ","));
}
Map<String, Object> result = DataApiUtils.http(JSON.toJSONString(inlineParams), MATERIAL_INDEX_DATA);
Page<MaterialRealDetailDataVO> pageData = DataApiUtils.getPageData(result, MaterialRealDetailDataVO.class);
if (CollectionUtils.isEmpty(pageData.getResult())) {
return pageData;
}
List<String> clerkIdList = new ArrayList<>();
List<String> storeIdList = new ArrayList<>();
pageData.getResult().forEach(item -> {
clerkIdList.add(item.getClerkId());
storeIdList.add(item.getStoreId());
});
Map<String, ClerkDTO> clerkMap = new HashMap<>();
Map<String, StoreDTO> storeMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(clerkIdList)) {
clerkMap = clerkStoreAdaptor.queryClerkMap(clerkIdList);
}
if (CollectionUtils.isNotEmpty(storeIdList)) {
storeMap = clerkStoreAdaptor.queryStoreMap(storeIdList);
}
for (MaterialRealDetailDataVO item : pageData.getResult()) {
Optional.ofNullable(clerkMap.get(item.getClerkId())).ifPresent(clerk -> {
item.setClerkCode(clerk.getClerkCode());
item.setClerkName(clerk.getClerkName());
});
Optional.ofNullable(storeMap.get(item.getStoreId())).ifPresent(store -> {
item.setStoreCode(store.getStoreCode());
item.setStoreName(store.getStoreName());
});
}
return pageData;
}
/**
* 导购纬度数据统计
......
package com.gic.haoban.manage.web.qo.content.statistics;
import lombok.Data;
import java.util.HashMap;
import java.util.Map;
@Data
public class MaterialTodayDetailDataQO extends MaterialStatisticsBaseQO {
private static final long serialVersionUID = 3422937373665522931L;
/**
* 1企业2门店3导购
*/
private Integer dataType = 1;
/**
* 排序字段
* 日均使用导购占比
* 转化客户数
*/
private String orderByField;
/**
* asc
* desc
*/
private String order;
public Map<String, Integer> getFieldsOrder() {
Map<String, Integer> map = new HashMap<>();
map.put("convUserNum", 1);
map.put("convSalesAmt", 2);
map.put("offlineConvUserNum", 3);
map.put("offlineConvSalesAmt", 4);
map.put("clickUserNum", 5);
map.put("useMatluserCnt", 6);
map.put("useMatlClerkNum", 7);
map.put("unusedMatlClerkNum", 8);
return map;
}
public String getDefaultFields() {
return "useMatluserCnt";
}
}
......@@ -26,6 +26,11 @@ public class MaterialRealDataVO implements Serializable {
private Integer clickUserNum;
/**
* 使用次数
*/
private Integer useMatluserCnt;
/**
* 转换客户数
*/
private Integer convUserNum;
......@@ -82,6 +87,14 @@ public class MaterialRealDataVO implements Serializable {
this.clickUserNum = clickUserNum;
}
public Integer getUseMatluserCnt() {
return useMatluserCnt;
}
public void setUseMatluserCnt(Integer useMatluserCnt) {
this.useMatluserCnt = useMatluserCnt;
}
public Integer getConvUserNum() {
return convUserNum;
}
......
package com.gic.haoban.manage.web.vo.content.statistics;
import java.io.Serializable;
public class MaterialRealDetailDataVO extends MaterialRealDataVO implements Serializable {
/**
* 门店id
*/
private String storeId;
/**
* 门店code
*/
private String storeCode;
/**
* 门店名称
*/
private String storeName;
/**
* 导购id
*/
private String clerkId;
/**
* 导购名称
*/
private String clerkName;
/**
* 导购code
*/
private String clerkCode;
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public String getStoreCode() {
return storeCode;
}
public void setStoreCode(String storeCode) {
this.storeCode = storeCode;
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public String getClerkName() {
return clerkName;
}
public void setClerkName(String clerkName) {
this.clerkName = clerkName;
}
public String getClerkCode() {
return clerkCode;
}
public void setClerkCode(String clerkCode) {
this.clerkCode = clerkCode;
}
}
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