Commit 39df05c6 by 陶光胜

观云台小程序

parent 8d294c5e
...@@ -4,10 +4,14 @@ import com.gic.api.base.commons.Page; ...@@ -4,10 +4,14 @@ import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.cloud.dto.AttentionStoreDTO; import com.gic.cloud.dto.AttentionStoreDTO;
import java.util.Map;
public interface StoreAttentionApiService { public interface StoreAttentionApiService {
ServiceResponse addStoreAttenttion(Integer userId, Integer enterpriseId, Integer storeId); ServiceResponse addStoreAttenttion(Integer userId, Integer enterpriseId, Integer storeId);
ServiceResponse removeStoreAttenttion(Integer enterpriseId, Integer userId, String storeIds); ServiceResponse removeStoreAttenttion(Integer enterpriseId, Integer userId, String storeIds);
ServiceResponse<Page<AttentionStoreDTO>> pageStoreAttention(Integer userId, Integer enterpriseId, Integer pageNum, Integer pageSize); ServiceResponse<Page<AttentionStoreDTO>> pageStoreAttention(Integer userId, Integer enterpriseId, Integer pageNum, Integer pageSize);
ServiceResponse<Map<Integer, AttentionStoreDTO>> getAllAttenttionStore(Integer userId, Integer enterpriseId);
} }
...@@ -9,9 +9,14 @@ import com.gic.cloud.service.StoreAttenttionService; ...@@ -9,9 +9,14 @@ import com.gic.cloud.service.StoreAttenttionService;
import com.gic.commons.util.PageHelperUtils; import com.gic.commons.util.PageHelperUtils;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.google.inject.internal.asm.$AnnotationVisitor; import com.google.inject.internal.asm.$AnnotationVisitor;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service("storeAttentionApiService") @Service("storeAttentionApiService")
public class StoreAttentionApiServiceImpl implements StoreAttentionApiService { public class StoreAttentionApiServiceImpl implements StoreAttentionApiService {
@Autowired @Autowired
...@@ -39,4 +44,16 @@ public class StoreAttentionApiServiceImpl implements StoreAttentionApiService { ...@@ -39,4 +44,16 @@ public class StoreAttentionApiServiceImpl implements StoreAttentionApiService {
com.github.pagehelper.Page<TabAttentionStore> storePage = this.storeAttenttionService.pageStoreAttention(userId, enterpriseId); com.github.pagehelper.Page<TabAttentionStore> storePage = this.storeAttenttionService.pageStoreAttention(userId, enterpriseId);
return ServiceResponse.success(PageHelperUtils.changePageHelperToCurrentPage(storePage, AttentionStoreDTO.class)); return ServiceResponse.success(PageHelperUtils.changePageHelperToCurrentPage(storePage, AttentionStoreDTO.class));
} }
@Override
public ServiceResponse<Map<Integer, AttentionStoreDTO>> getAllAttenttionStore(Integer userId, Integer enterpriseId) {
List<AttentionStoreDTO> result = this.pageStoreAttention(userId, enterpriseId, 1, Integer.MAX_VALUE).getResult().getResult();
Map<Integer, AttentionStoreDTO> map = new HashMap<>();
if(CollectionUtils.isNotEmpty(result)){
for(AttentionStoreDTO storeDTO : result){
map.put(storeDTO.getStoreId(), storeDTO);
}
}
return ServiceResponse.success(map);
}
} }
...@@ -131,6 +131,7 @@ public class StoreWidgetController { ...@@ -131,6 +131,7 @@ public class StoreWidgetController {
storeSearchDTO.setStoreGroupId(parentId); storeSearchDTO.setStoreGroupId(parentId);
storeSearchDTO.setStoreResource(Long.valueOf(storeAuth.getStoreWidgetId())); storeSearchDTO.setStoreResource(Long.valueOf(storeAuth.getStoreWidgetId()));
ServiceResponse<Page<StoreDTO>> response = this.storeApiService.listStore(storeSearchDTO, pageNum, pageSize); ServiceResponse<Page<StoreDTO>> response = this.storeApiService.listStore(storeSearchDTO, pageNum, pageSize);
Map<Integer, AttentionStoreDTO> result = this.storeAttentionApiService.getAllAttenttionStore(userId, enterpriseId).getResult();
if(CollectionUtils.isNotEmpty(response.getResult().getResult())){ if(CollectionUtils.isNotEmpty(response.getResult().getResult())){
for(StoreDTO dto : response.getResult().getResult()){ for(StoreDTO dto : response.getResult().getResult()){
StoreGroupItemsVo itemsVo = new StoreGroupItemsVo(); StoreGroupItemsVo itemsVo = new StoreGroupItemsVo();
...@@ -139,6 +140,7 @@ public class StoreWidgetController { ...@@ -139,6 +140,7 @@ public class StoreWidgetController {
itemsVo.setIsStore(1); itemsVo.setIsStore(1);
itemsVo.setIdChain(map.get(dto.getStoreGroupId()).getIdChain() + dto.getStoreInfoId() + "_"); itemsVo.setIdChain(map.get(dto.getStoreGroupId()).getIdChain() + dto.getStoreInfoId() + "_");
itemsVo.setNameChain(map.get(dto.getStoreGroupId()).getNameChain() + dto.getStoreName() + "/"); itemsVo.setNameChain(map.get(dto.getStoreGroupId()).getNameChain() + dto.getStoreName() + "/");
itemsVo.setHasAttention(result.get(dto.getStoreInfoId()) == null ? 0 : 1);
items.add(itemsVo); items.add(itemsVo);
} }
groupVoPage.setTotalCount(response.getResult().getTotalCount()); groupVoPage.setTotalCount(response.getResult().getTotalCount());
...@@ -285,6 +287,7 @@ public class StoreWidgetController { ...@@ -285,6 +287,7 @@ public class StoreWidgetController {
storeSearchDTO.setEnterpriseId(enterpriseId); storeSearchDTO.setEnterpriseId(enterpriseId);
storeSearchDTO.setStoreInfoIds(StringUtils.join(storeAuth.getStoreInfoIdList(), " ")); storeSearchDTO.setStoreInfoIds(StringUtils.join(storeAuth.getStoreInfoIdList(), " "));
Page<StoreDTO> result = this.storeApiService.listStore(storeSearchDTO, pageNum, pageSize).getResult(); Page<StoreDTO> result = this.storeApiService.listStore(storeSearchDTO, pageNum, pageSize).getResult();
Map<Integer, AttentionStoreDTO> attentionStoreDTOMap = this.storeAttentionApiService.getAllAttenttionStore(userId, enterpriseId).getResult();
page.setTotalCount(result.getTotalCount()); page.setTotalCount(result.getTotalCount());
page.setTotalPage(result.getTotalPage()); page.setTotalPage(result.getTotalPage());
if(CollectionUtils.isNotEmpty(result.getResult())){ if(CollectionUtils.isNotEmpty(result.getResult())){
...@@ -295,6 +298,7 @@ public class StoreWidgetController { ...@@ -295,6 +298,7 @@ public class StoreWidgetController {
searchVo.setName(storeDTO.getStoreName()); searchVo.setName(storeDTO.getStoreName());
searchVo.setIdChain(map.get(storeDTO.getStoreGroupId()).getIdChain() + storeDTO.getStoreInfoId()+"_"); searchVo.setIdChain(map.get(storeDTO.getStoreGroupId()).getIdChain() + storeDTO.getStoreInfoId()+"_");
searchVo.setNameChain(map.get(storeDTO.getStoreGroupId()).getNameChain() + storeDTO.getStoreName() + "/"); searchVo.setNameChain(map.get(storeDTO.getStoreGroupId()).getNameChain() + storeDTO.getStoreName() + "/");
searchVo.setHasAttention(attentionStoreDTOMap.get(storeDTO.getStoreInfoId()) == null ? 0 : 1);
storeSearchVoList.add(searchVo); storeSearchVoList.add(searchVo);
} }
page.setResult(storeSearchVoList); page.setResult(storeSearchVoList);
......
...@@ -7,6 +7,7 @@ public class StoreGroupItemsVo { ...@@ -7,6 +7,7 @@ public class StoreGroupItemsVo {
private String nameChain; private String nameChain;
private Integer isStore = 0; private Integer isStore = 0;
private Integer hasChildren = 0; private Integer hasChildren = 0;
private Integer hasAttention = 0;
public Integer getId() { public Integer getId() {
return id; return id;
...@@ -55,4 +56,12 @@ public class StoreGroupItemsVo { ...@@ -55,4 +56,12 @@ public class StoreGroupItemsVo {
public void setNameChain(String nameChain) { public void setNameChain(String nameChain) {
this.nameChain = nameChain; this.nameChain = nameChain;
} }
public Integer getHasAttention() {
return hasAttention;
}
public void setHasAttention(Integer hasAttention) {
this.hasAttention = hasAttention;
}
} }
...@@ -7,6 +7,7 @@ public class StoreSearchVo { ...@@ -7,6 +7,7 @@ public class StoreSearchVo {
private String idChain; private String idChain;
private String nameChain; private String nameChain;
private Integer channel; private Integer channel;
private Integer hasAttention = 0;
public String getId() { public String getId() {
return id; return id;
...@@ -55,4 +56,12 @@ public class StoreSearchVo { ...@@ -55,4 +56,12 @@ public class StoreSearchVo {
public void setChannel(Integer channel) { public void setChannel(Integer channel) {
this.channel = channel; this.channel = channel;
} }
public Integer getHasAttention() {
return hasAttention;
}
public void setHasAttention(Integer hasAttention) {
this.hasAttention = hasAttention;
}
} }
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