Commit acc20215 by 陶光胜

观云台小程序

parent b1e6fa20
package com.gic.cloud.web.controller;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.cloud.web.qo.DateTypeQo;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.data.api.dto.BaseSalesDTO;
import com.gic.data.api.dto.BaseSalesParamsDTO;
import com.gic.data.api.service.BaseSalesApiService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -12,13 +18,31 @@ import java.util.List;
public class BaseSalesController {
@Autowired
private StoreSearchUtils storeSearchUtils;
@Autowired
private BaseSalesApiService baseSalesApiService;
@RequestMapping("base-sales")
public RestResponse baseSales(Integer channel, Integer userId, Integer enterpriseId, String searchJSON,
DateTypeQo dateTypeQo, String mbrAreaId, Integer level, Integer parentId){
DateTypeQo dateTypeQo, String mbrAreaId, Integer level, Integer parentId,
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);
return null;
BaseSalesParamsDTO dto = new BaseSalesParamsDTO();
dto.setChannel(channel);
dto.setEnterpriseId(enterpriseId);
dto.setStoreInfoIdList(list);
dto.setOnLine(onLine);
dto.setMbrAreaId(StringUtils.isBlank(mbrAreaId) ? null : Long.valueOf(mbrAreaId));
dto.setType(dateTypeQo.getType());
dto.setDate(dateTypeQo.getDate());
dto.setChildrenStoreGroupIdList(childrenStoreGroupIdList);
dto.setLevel(level);
dto.setPageNum(pageNum);
dto.setPageSize(pageSize);
ServiceResponse<Page<BaseSalesDTO>> response = this.baseSalesApiService.pageBaseSales(dto);
return RestResponse.success(response.getResult());
}
}
......@@ -8,17 +8,21 @@ import com.gic.cloud.service.FunctionModuleApiService;
import com.gic.cloud.service.IndexApiService;
import com.gic.cloud.web.auth.DataAuthUtils;
import com.gic.cloud.web.qo.DateTypeQo;
import com.gic.cloud.web.vo.FunctionModuleVo;
import com.gic.cloud.web.vo.LevelVo;
import com.gic.cloud.web.vo.MbrVo;
import com.gic.cloud.web.vo.index.IndexSalesVo;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.data.api.dto.IndexSalesDTO;
import com.gic.data.api.service.IndexSalesApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
@RestController
......@@ -52,7 +56,21 @@ public class IndexController {
@RequestMapping("function-list")
public RestResponse functionList(Integer userId){
ServiceResponse<List<FunctionModuleDTO>> response = this.functionApiService.getFunctionByUserId(userId);
return RestResponse.success(response.getResult());
List<FunctionModuleVo> list = new ArrayList<>();
if(response.isSuccess() && CollectionUtils.isNotEmpty(response.getResult())){
for(FunctionModuleDTO dto : response.getResult()){
if(dto != null){
list.add(EntityUtil.changeEntityByJSON(FunctionModuleVo.class, dto));
}
}
}
return RestResponse.success(list);
}
@RequestMapping("get-level")
public RestResponse getLevel(Integer userId, Integer enterpriseId, String searchJSON){
LevelVo level = this.storeSearchUtils.getLevel(userId, enterpriseId, searchJSON);
return RestResponse.success(level);
}
}
......@@ -14,6 +14,7 @@ import com.gic.cloud.web.auth.OnLineStore;
import com.gic.cloud.web.auth.StoreAuth;
import com.gic.cloud.web.constant.StoreChannelEnum;
import com.gic.cloud.web.qo.StoreSearchQo;
import com.gic.cloud.web.vo.LevelVo;
import com.gic.store.dto.StoreDTO;
import com.gic.store.dto.StoreGroupDTO;
import com.gic.store.dto.StoreSearchDTO;
......@@ -23,6 +24,7 @@ import com.gic.store.service.StoreWidgetApiService;
import com.google.inject.internal.cglib.core.$ClassEmitter;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.reflections.Store;
......@@ -119,12 +121,17 @@ public class StoreSearchUtils {
return list;
}
public Integer getLevel(Integer userId, Integer enterpriseId, String searchJson){
public LevelVo getLevel(Integer userId, Integer enterpriseId, String searchJson){
LevelVo vo = new LevelVo();
List<Integer> list = this.storeSearch(userId, enterpriseId, searchJson);
StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
storeSearchDTO.setEnterpriseId(enterpriseId);
storeSearchDTO.setStoreInfoIds(StringUtils.join(list, ","));
List<StoreDTO> result = this.storeApiService.listStore(storeSearchDTO, 1, 20000).getResult().getResult();
storeSearchDTO.setStoreInfoIds(StringUtils.join(list, " "));
ServiceResponse<Page<StoreDTO>> response = this.storeApiService.listStore(storeSearchDTO, 1, 20000);
if(!response.isSuccess() && response.getResult() == null){
return vo;
}
List<StoreDTO> result = response.getResult().getResult();
Map<Integer, Integer> map = new HashMap<>();
result.forEach(storeDTO -> {
List<Integer> storeGroupIdList = storeDTO.getStoreGroupIdList();
......@@ -135,24 +142,30 @@ public class StoreSearchUtils {
List<StoreGroupDTO> allStoreGroupIdList = this.storeGroupApiService.listStoreGroupByIds(null, enterpriseId).getResult();
Map<Integer, Integer> levelMap = new HashMap<>();
allStoreGroupIdList.forEach(storeGroupDTO -> {
levelMap.put(storeGroupDTO.getGroupLevel(), levelMap.get(storeGroupDTO.getGroupLevel())== null ? 1 : levelMap.get(storeGroupDTO.getGroupLevel())+1);
if(map.containsKey(storeGroupDTO.getStoreGroupId())){
levelMap.put(storeGroupDTO.getGroupLevel(), levelMap.get(storeGroupDTO.getGroupLevel())== null ? 1 : levelMap.get(storeGroupDTO.getGroupLevel())+1);
}
});
int start = 0;
while (true){
if(levelMap.get(start) != null && levelMap.get(start).intValue() > 1){
return start;
vo.setLevel(start);
break;
}
start++;
}
vo.setMaxLevel(levelMap.size() - 1);
return vo;
}
public List<Integer> getChildrenStoreGroupIdList(Integer storeGroupId){
List<StoreGroupDTO> result = this.storeGroupApiService.listStoreGroupAndChildren(storeGroupId).getResult();
if(CollectionUtils.isNotEmpty(result)){
return result.stream().map(storeGroupDTO -> storeGroupDTO.getStoreGroupId()).collect(Collectors.toList());
}else {
return new ArrayList<>();
if(storeGroupId != null){
List<StoreGroupDTO> result = this.storeGroupApiService.listStoreGroupAndChildren(storeGroupId).getResult();
if(CollectionUtils.isNotEmpty(result)){
return result.stream().map(storeGroupDTO -> storeGroupDTO.getStoreGroupId()).collect(Collectors.toList());
}
}
return new ArrayList<>();
}
private void getOnlineStoreIds(String searchJson, OnLineAuth onlineStoreAuth, List<String> list, Integer channel){
......
package com.gic.cloud.web.vo;
import java.io.Serializable;
import java.util.Date;
/**
* 功能组件模块
* @ClassName: FunctionModuleDTO

* @Description: 

* @author guojuxing

* @date 2020/7/8 3:35 PM

*/
public class FunctionModuleVo implements Serializable{
private static final long serialVersionUID = 1359760668258180981L;
/**
* ID
*/
private Integer functionModuleId;
/**
* 名称
*/
private String functionModuleName;
/**
* 功能编码
*/
private String functionModuleCode;
/**
* 功能模块说明
*/
private String functionModuleDesc;
/**
* 运维操作人ID
*/
private String operationId;
/**
* 运维操作人name
*/
private String operationName;
private String logo;
/**
* 1:有效 0:无效
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
public Integer getFunctionModuleId() {
return functionModuleId;
}
public FunctionModuleVo setFunctionModuleId(Integer functionModuleId) {
this.functionModuleId = functionModuleId;
return this;
}
public String getFunctionModuleName() {
return functionModuleName;
}
public FunctionModuleVo setFunctionModuleName(String functionModuleName) {
this.functionModuleName = functionModuleName;
return this;
}
public String getFunctionModuleCode() {
return functionModuleCode;
}
public FunctionModuleVo setFunctionModuleCode(String functionModuleCode) {
this.functionModuleCode = functionModuleCode;
return this;
}
public String getFunctionModuleDesc() {
return functionModuleDesc;
}
public FunctionModuleVo setFunctionModuleDesc(String functionModuleDesc) {
this.functionModuleDesc = functionModuleDesc;
return this;
}
public String getOperationId() {
return operationId;
}
public FunctionModuleVo setOperationId(String operationId) {
this.operationId = operationId;
return this;
}
public String getOperationName() {
return operationName;
}
public FunctionModuleVo setOperationName(String operationName) {
this.operationName = operationName;
return this;
}
public Integer getStatus() {
return status;
}
public FunctionModuleVo setStatus(Integer status) {
this.status = status;
return this;
}
public Date getCreateTime() {
return createTime;
}
public FunctionModuleVo setCreateTime(Date createTime) {
this.createTime = createTime;
return this;
}
public Date getUpdateTime() {
return updateTime;
}
public FunctionModuleVo setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
return this;
}
public String getLogo() {
return logo;
}
public FunctionModuleVo setLogo(String logo) {
this.logo = logo;
return this;
}
}
package com.gic.cloud.web.vo;
public class LevelVo {
private Integer level = 1;
private Integer maxLevel = 1;
public Integer getLevel() {
return level;
}
public void setLevel(Integer level) {
this.level = level;
}
public Integer getMaxLevel() {
return maxLevel;
}
public void setMaxLevel(Integer maxLevel) {
this.maxLevel = maxLevel;
}
}
......@@ -150,4 +150,5 @@
<dubbo:reference interface="com.gic.cloud.service.FunctionModuleApiService" id="functionModuleApiService" timeout="6000" retries="0"/>
<dubbo:reference interface="com.gic.data.api.service.performanceoverview.PerformanceOverviewApiService" id="performanceOverviewApiService" timeout="6000" retries="0"/>
<dubbo:reference interface="com.gic.data.api.service.consumestructure.ConsumeStructureApiService" id="consumeStructureApiService" timeout="6000" retries="0"/>
<dubbo:reference interface="com.gic.data.api.service.BaseSalesApiService" id="baseSalesApiService" timeout="6000" retries="0"/>
</beans>
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