Commit 39df05c6 by 陶光胜

观云台小程序

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