Commit 8e78223f by 陶光胜

门店控件修复

parent cede3f35
......@@ -62,8 +62,8 @@ public class IndexController {
@RequestMapping("index-mbr")
public RestResponse indexMbr(Integer enterpriseId, Integer userId){
List<MbrVo> mbrArea = this.dataAuthUtils.getMbrArea(userId, enterpriseId);
return RestResponse.success(mbrArea);
//List<MbrVo> mbrArea = this.dataAuthUtils.getMbrArea(userId, enterpriseId);
return RestResponse.success();
}
@RequestMapping("index-sales")
......@@ -91,10 +91,10 @@ public class IndexController {
list.add(-1);
onLine.add("-1");
}
List<Long> mbrAreaIdList = this.dataAuthUtils.getMbrAreaId(userId, enterpriseId);
//List<Long> mbrAreaIdList = this.dataAuthUtils.getMbrAreaId(userId, enterpriseId);
ServiceResponse<IndexMemberDTO> indexMember = this.indexSalesApiService.getIndexMember(enterpriseId, list, onLine,
StringUtils.isNoneBlank(mbrAreaId) ? Long.valueOf(mbrAreaId) : null,
mbrAreaIdList, dateTypeQo.getType(), dateTypeQo.getDate());
null, dateTypeQo.getType(), dateTypeQo.getDate());
return RestResponse.success(indexMember.getResult());
}
......@@ -108,19 +108,19 @@ public class IndexController {
list.add(-1);
onLine.add("-1");
}
List<Long> mbrAreaIdList = this.dataAuthUtils.getMbrAreaId(userId, enterpriseId);
//List<Long> mbrAreaIdList = this.dataAuthUtils.getMbrAreaId(userId, enterpriseId);
ServiceResponse<IndexMemberOrderCntDTO> allMemberOrderCntResponse = this.indexSalesApiService.getIndexMemberOrderCnt(enterpriseId, list, onLine,
StringUtils.isNoneBlank(mbrAreaId) ? Long.valueOf(mbrAreaId) : null,
mbrAreaIdList, dateTypeQo.getType(), dateTypeQo.getDate(), 1);
null, dateTypeQo.getType(), dateTypeQo.getDate(), 1);
ServiceResponse<IndexMemberOrderCntDTO> memberOrderCntResponse = this.indexSalesApiService.getIndexMemberOrderCnt(enterpriseId, list, onLine,
StringUtils.isNoneBlank(mbrAreaId) ? Long.valueOf(mbrAreaId) : null,
mbrAreaIdList, dateTypeQo.getType(), dateTypeQo.getDate(), 2);
null, dateTypeQo.getType(), dateTypeQo.getDate(), 2);
ServiceResponse<IndexMemberOldOrderCnt> oldOrderCnt = this.indexSalesApiService.getIndexMemberOldOrderCnt(enterpriseId, list, onLine,
StringUtils.isNoneBlank(mbrAreaId) ? Long.valueOf(mbrAreaId) : null, mbrAreaIdList,
StringUtils.isNoneBlank(mbrAreaId) ? Long.valueOf(mbrAreaId) : null, null,
dateTypeQo.getType(), dateTypeQo.getDate());
ServiceResponse<IndexMemberBirthCntDTO> birthOrderCnt = this.indexSalesApiService.getIndexMemberBirthOrderCnt(enterpriseId, list, onLine,
StringUtils.isNoneBlank(mbrAreaId) ? Long.valueOf(mbrAreaId) : null,
mbrAreaIdList, dateTypeQo.getType(), dateTypeQo.getDate());
null, dateTypeQo.getType(), dateTypeQo.getDate());
log.info("allMemberOrderCntResponse:{}", JSON.toJSONString(allMemberOrderCntResponse));
log.info("memberOrderCntResponse:{}", JSON.toJSONString(memberOrderCntResponse));
log.info("oldOrderCnt:{}", JSON.toJSONString(oldOrderCnt));
......
......@@ -4,6 +4,8 @@ import com.alibaba.druid.sql.ast.statement.SQLForeignKeyImpl;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.dto.MenuDTO;
import com.gic.auth.service.MenuApiService;
import com.gic.cloud.dto.AttentionStoreDTO;
import com.gic.cloud.dto.DataAuthDTO;
import com.gic.cloud.service.DataAuthApiService;
......@@ -41,7 +43,7 @@ import java.util.*;
@RestController
public class StoreWidgetController {
private static final Logger log = LogManager.getLogger(StoreWidgetController.class);
private static final String WGSCODE = "WGS";
@Autowired
private DataAuthUtils dataAuthUtils;
@Autowired
......@@ -65,7 +67,9 @@ public class StoreWidgetController {
@Autowired
private StoreSearchUtils storeSearchUtils;
@Autowired
private DataAuthApiService dataAuthApiService;
private MenuApiService menuApiService;
@Autowired
private StoreBrandApiService storeBrandApiService;
@RequestMapping("store-widget-index")
public RestResponse storeWidgetIndex(Integer userId, Integer enterpriseId){
......@@ -110,9 +114,13 @@ public class StoreWidgetController {
if(CollectionUtils.isNotEmpty(result.getResult())){
vo.setAttentionCount(result.getTotalCount());
}
DataAuthDTO dataAuthDTO = this.dataAuthApiService.ggetDataAuthByUserId(enterpriseId, userId).getResult();
if(dataAuthDTO != null){
vo.setHasWgs(dataAuthDTO.getNoOwnerStore() == null ? 0 : dataAuthDTO.getNoOwnerStore());
List<MenuDTO> listMenu = this.menuApiService.getUserMenuOfAppNotTree(enterpriseId, userId, null, getAppId("gyt-app")).getResult();
if(CollectionUtils.isNotEmpty(listMenu)){
for(MenuDTO menu : listMenu){
if(WGSCODE.equals(menu.getMenuCode())){
vo.setHasWgs(1);
}
}
}
return RestResponse.success(vo);
}
......@@ -186,6 +194,8 @@ public class StoreWidgetController {
int typeOfStoreRegion = 3;
//门店标签
int typeOfStoreTag = 4;
//门店品牌
int storeBrand = 5;
if(type == typeOfStore){
if(storeColumnSet != null){
Set<Integer> storeType = storeColumnSet.getStoreType();
......@@ -237,41 +247,26 @@ public class StoreWidgetController {
}
}
return RestResponse.success(list);
} else {
return otherType(storeColumnSet);
}
}
private RestResponse otherType(StoreColumnSet storeColumnSet) {
List<StoreTypeVo> list = new ArrayList<>();
if (storeColumnSet != null) {
Set<Integer> status = storeColumnSet.getStatus();
if (CollectionUtils.isEmpty(status)) {
return RestResponse.success();
} else if(type == storeBrand){
List<StoreTypeVo> list = new ArrayList<>();
List<StoreBrandDTO> brandDTOS = null;
if(storeColumnSet != null){
Set<Integer> brandIds = storeColumnSet.getBrandId();
brandDTOS = this.storeBrandApiService.listStoreBrandByIds(new ArrayList<>(brandIds)).getResult();
} else {
List<Integer> statusList = new ArrayList<Integer>(status);
for (Integer s : statusList){
brandDTOS = this.storeBrandApiService.listAllStoreBrand(enterpriseId, null).getResult();
}
if(CollectionUtils.isNotEmpty(brandDTOS)){
brandDTOS.stream().forEach(storeBrandDTO -> {
StoreTypeVo storeTypeVo = new StoreTypeVo();
storeTypeVo.setId(s+"");
if(s.equals(1)){
storeTypeVo.setName("启用");
}else {
storeTypeVo.setName("不启用");
}
storeTypeVo.setId(storeBrandDTO.getStoreBrandId()+"");
storeTypeVo.setName(storeBrandDTO.getStoreBrandName());
list.add(storeTypeVo);
}
});
}
} else {
StoreTypeVo storeTypeVo = new StoreTypeVo();
storeTypeVo.setId("1");
storeTypeVo.setName("启用");
list.add(storeTypeVo);
StoreTypeVo storeTypeVoNot = new StoreTypeVo();
storeTypeVoNot.setId("2");
storeTypeVoNot.setName("不启用");
list.add(storeTypeVoNot);
return RestResponse.success(list);
}
return RestResponse.success(list);
return RestResponse.success();
}
@RequestMapping("on-store-list")
......@@ -516,6 +511,8 @@ public class StoreWidgetController {
return list;
}
private String getChannelName(Integer channel){
StoreChannelEnum[] values = StoreChannelEnum.values();
for(StoreChannelEnum storeChannelEnum : values){
......@@ -535,4 +532,14 @@ public class StoreWidgetController {
items.add(onLine);
}
}
private String getAppId(String menuCode) {
//根据menuCode去查询对应的appId
ServiceResponse<MenuDTO> resp = menuApiService.getMenuByMenuCode(menuCode);
if (resp.isSuccess()) {
MenuDTO tempDTO = resp.getResult();
return tempDTO.getProject();
}
return null;
}
}
......@@ -155,4 +155,7 @@
<dubbo:reference interface="com.gic.data.api.service.member.MemberCloudDataApiService" id="memberCloudDataApiService" timeout="6000" retries="0"/>
<dubbo:reference interface="com.gic.open.api.service.EnterpriseLicenseApiService" id="enterpriseLicenseApiService" timeout="6000" retries="0"/>
<dubbo:reference interface="com.gic.auth.service.UserResourceApiService" id="userResourceApiService" timeout="6000" retries="0"/>
<dubbo:reference interface="com.gic.member.config.api.service.UserListFieldApiService" id="userListFieldApiService" timeout="6000" retries="0"/>
<dubbo:reference interface="com.gic.enterprise.service.UnionEnterpriseAuthApiService" id="unionEnterpriseAuthApiService" 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