Commit cf882948 by 陶光胜

观云台小程序

parent 26d637e5
......@@ -5,7 +5,9 @@ import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.cloud.web.auth.DataAuthUtils;
import com.gic.cloud.web.constant.StoreChannelEnum;
import com.gic.cloud.web.qo.BaseSalesParamQo;
import com.gic.cloud.web.qo.DateTypeQo;
import com.gic.cloud.web.utils.LevelUtil;
import com.gic.cloud.web.vo.BaseSalesVo;
import com.gic.cloud.web.vo.LevelVo;
import com.gic.commons.webapi.reponse.RestResponse;
......@@ -40,42 +42,49 @@ public class BaseSalesController {
private WmStoreApiService wmStoreApiService;
@RequestMapping("base-sales")
public RestResponse baseSales(Integer channel, Integer userId, Integer enterpriseId, String searchJSON,
DateTypeQo dateTypeQo, String mbrAreaId, Integer level, Integer parentId,
String sortField, Integer sortType, Integer pageNum, Integer pageSize){
List<Integer> list = this.storeSearchUtils.storeSearch(userId, enterpriseId, searchJSON);
List<String> onLine = this.storeSearchUtils.onLineStoreSearch(userId, enterpriseId, searchJSON);
List<Integer> childrenStoreGroupIdList = this.storeSearchUtils.getChildrenStoreGroupIdList(parentId);
List<Long> mbrAreaIdList = this.dataAuthUtils.getMbrAreaId(userId, enterpriseId);
public RestResponse baseSales(BaseSalesParamQo qo){
BaseSalesVo vo = new BaseSalesVo();
List<Integer> list = this.storeSearchUtils.storeSearch(qo.getUserId(), qo.getEnterpriseId(), qo.getSearchJSON());
List<String> onLine = this.storeSearchUtils.onLineStoreSearch(qo.getUserId(), qo.getEnterpriseId(), qo.getSearchJSON());
List<Integer> childrenStoreGroupIdList = this.storeSearchUtils.getChildrenStoreGroupIdList(qo.getParentId());
List<Long> mbrAreaIdList = this.dataAuthUtils.getMbrAreaId(qo.getUserId(), qo.getEnterpriseId());
Integer maxLevel = 0;
/******线下渠道需要点击下钻,该值只会在线下时才会使用********/
if(level == null){
LevelVo levelVo = this.storeSearchUtils.getLevel(userId, enterpriseId, searchJSON);
level = levelVo.getLevel();
if(qo.getLevel() == null){
LevelVo levelVo = this.storeSearchUtils.getLevel(qo.getUserId(), qo.getEnterpriseId(), qo.getSearchJSON());
qo.setLevel(levelVo.getLevel());
maxLevel = levelVo.getMaxLevel();
}
/****首页进入基础页面时,如果渠道为空,根据当前条件判断渠道,channel==null表示多渠道***/
if(channel == null){
channel = this.storeSearchUtils.getChannel(userId, enterpriseId, searchJSON);
if(qo.getChannel() == null){
/**********设置层级名称,只有在首次进入页面会展示,下钻均显示返回上一级*********/
Integer newChannel = this.storeSearchUtils.getChannel(qo.getUserId(), qo.getEnterpriseId(), qo.getSearchJSON());
if(newChannel == null){
vo.setLevelName("所有渠道");
} else if(newChannel == StoreChannelEnum.OFFLINE.getChannel()){
vo.setLevelName(LevelUtil.getLevelName(qo.getLevel()));
} else {
vo.setLevelName("店铺层级");
}
qo.setChannel(newChannel);
}
BaseSalesParamsDTO dto = new BaseSalesParamsDTO();
dto.setChannel(channel);
dto.setEnterpriseId(enterpriseId);
dto.setChannel(qo.getChannel());
dto.setEnterpriseId(qo.getEnterpriseId());
dto.setStoreInfoIdList(list);
dto.setOnLine(onLine);
dto.setMbrAreaId(StringUtils.isBlank(mbrAreaId) ? null : Long.valueOf(mbrAreaId));
dto.setMbrAreaId(StringUtils.isBlank(qo.getMbrAreaId()) ? null : Long.valueOf(qo.getMbrAreaId()));
dto.setMbrAreaIdList(mbrAreaIdList);
dto.setType(dateTypeQo.getType());
dto.setDate(dateTypeQo.getDate());
dto.setType(qo.getType());
dto.setDate(qo.getDate());
dto.setChildrenStoreGroupIdList(childrenStoreGroupIdList);
dto.setLevel(level);
dto.setSortField(sortField);
dto.setSortType(sortType == null ? 1 : sortType);
dto.setPageNum(pageNum);
dto.setPageSize(pageSize);
dto.setLevel(qo.getLevel());
dto.setSortField(qo.getSortField());
dto.setSortType(qo.getSortType() == null ? 1 : qo.getSortType());
dto.setPageNum(qo.getPageNum());
dto.setPageSize(qo.getPageSize());
ServiceResponse<Page<BaseSalesDTO>> response = this.baseSalesApiService.pageBaseSales(dto);
BaseSalesVo vo = new BaseSalesVo();
vo.setPage(this.parseData(response.getResult(), channel, enterpriseId, level, maxLevel));
vo.setPage(this.parseData(response.getResult(), qo.getChannel(), qo.getEnterpriseId(), qo.getLevel(), maxLevel));
dto.setCountType(2);//合计
ServiceResponse<Page<BaseSalesDTO>> response1 = this.baseSalesApiService.pageBaseSales(dto);
if(response1.isSuccess() && response1.getResult() != null && CollectionUtils.isNotEmpty(response1.getResult().getResult())){
......@@ -86,7 +95,7 @@ public class BaseSalesController {
vo.setTotal(total);
}
}
if(channel != null && channel == 1 && parentId == null){
if(qo.getChannel() != null && qo.getChannel() == 1 && qo.getParentId() == null){
dto.setCountType(3); //无归属
ServiceResponse<Page<BaseSalesDTO>> response2 = this.baseSalesApiService.pageBaseSales(dto);
if(response2.isSuccess() && response2.getResult() != null && CollectionUtils.isNotEmpty(response2.getResult().getResult())){
......
package com.gic.cloud.web.qo;
public class BaseSalesParamQo {
private Integer channel;
private Integer userId;
private Integer enterpriseId;
private String searchJSON;
private Integer type;
private String date;
private String mbrAreaId;
private Integer level;
private Integer parentId;
private String sortField;
private Integer sortType;
private Integer pageNum;
private Integer pageSize;
public Integer getChannel() {
return channel;
}
public void setChannel(Integer channel) {
this.channel = channel;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getSearchJSON() {
return searchJSON;
}
public void setSearchJSON(String searchJSON) {
this.searchJSON = searchJSON;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getMbrAreaId() {
return mbrAreaId;
}
public void setMbrAreaId(String mbrAreaId) {
this.mbrAreaId = mbrAreaId;
}
public Integer getLevel() {
return level;
}
public void setLevel(Integer level) {
this.level = level;
}
public Integer getParentId() {
return parentId;
}
public void setParentId(Integer parentId) {
this.parentId = parentId;
}
public String getSortField() {
return sortField;
}
public void setSortField(String sortField) {
this.sortField = sortField;
}
public Integer getSortType() {
return sortType;
}
public void setSortType(Integer sortType) {
this.sortType = sortType;
}
public Integer getPageNum() {
return pageNum;
}
public void setPageNum(Integer pageNum) {
this.pageNum = pageNum;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
}
package com.gic.cloud.web.utils;
import java.util.HashMap;
import java.util.Map;
public class LevelUtil {
private static Map<Integer, String> levelMap = new HashMap<>();
static {
levelMap.put(1, "第一层级");
levelMap.put(2, "第二层级");
levelMap.put(3, "第三层级");
levelMap.put(4, "第四层级");
levelMap.put(5, "第五层级");
levelMap.put(6, "第六层级");
levelMap.put(7, "第七层级");
levelMap.put(8, "第八层级");
}
public static String getLevelName(Integer level){
return levelMap.get(level);
}
}
......@@ -7,6 +7,7 @@ public class BaseSalesVo {
private Page<BaseSalesDTO> page;
private BaseSalesDTO total;
private BaseSalesDTO wgs;
private String levelName;
public Page<BaseSalesDTO> getPage() {
return page;
......@@ -31,4 +32,12 @@ public class BaseSalesVo {
public void setWgs(BaseSalesDTO wgs) {
this.wgs = wgs;
}
public String getLevelName() {
return levelName;
}
public void setLevelName(String levelName) {
this.levelName = levelName;
}
}
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