Commit 93b7da6b by songyinghui

feat: 同城门店处理

parent a4114c33
......@@ -13,6 +13,7 @@ import com.gic.content.api.service.ContentColumnApiService;
import com.gic.content.api.service.ContentMaterialApiService;
import com.gic.content.api.service.ContentMaterialShareApiService;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.web.qo.content.ContentMaterialQO;
import com.gic.haoban.manage.web.qo.content.ContentMaterialShareQO;
import com.gic.haoban.manage.web.vo.content.ContentColumnInfoVO;
......@@ -20,6 +21,8 @@ import com.gic.haoban.manage.web.vo.content.ContentMaterialInfoVO;
import com.gic.haoban.manage.web.vo.content.ContentMaterialShareInfoVO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -40,6 +43,7 @@ import java.util.stream.Collectors;
@RestController
public class ContentMaterialController {
private static final Logger log = LoggerFactory.getLogger(ContentMaterialController.class);
@Autowired
private ContentColumnApiService contentColumnApiService;
@Autowired
......@@ -47,6 +51,9 @@ public class ContentMaterialController {
@Autowired
private ContentMaterialShareApiService contentMaterialShareApiService;
@Autowired
private StaffApiService staffApiService;
/**
* 获取栏目筛选条件
......@@ -84,6 +91,13 @@ public class ContentMaterialController {
contentMaterialPageFrontQDTO.setMaterialType(4);
}
}
if (StringUtils.isBlank(contentMaterialQO.getStoreId())){
// 区经 获取管辖的权限
List<String> storeIds = this.queryClerkStoreIds(contentMaterialQO.getClerkId(), contentMaterialQO.getWxEnterpriseId());
contentMaterialPageFrontQDTO.setStoreIdList(storeIds);
}else {
contentMaterialPageFrontQDTO.setStoreIdList(Collections.singletonList(contentMaterialQO.getStoreId()));
}
BasePageInfo pageInfo = new BasePageInfo();
pageInfo.setPageNum(contentMaterialQO.getPageNum());
pageInfo.setPageSize(contentMaterialQO.getPageSize());
......@@ -146,4 +160,22 @@ public class ContentMaterialController {
return RestResponse.successResult(shareInfoVO);
}
/**
* 查询区经角色下管辖的门店权限
* @param clerkId
* @param wxEnterpriseId
* @return
*/
public List<String> queryClerkStoreIds(String clerkId, String wxEnterpriseId){
List<String> storeIds = staffApiService.getHaoBanStoreIdsRolesByClerkId(clerkId, wxEnterpriseId);
if (CollectionUtils.isEmpty(storeIds)){
log.info("根据区经id查询管辖的门店为空 {} {}", clerkId, wxEnterpriseId);
return Collections.singletonList("-100");
}
if (storeIds.size() == 1 && StringUtils.equals(storeIds.get(0), "-1")){
// 全部门店权限
return Collections.emptyList();
}
return storeIds;
}
}
......@@ -22,6 +22,16 @@ public class ContentMaterialQO extends PageQo {
private String wxEnterpriseId;
/**
* 门店id
*/
private String storeId;
/**
* 导购id
*/
private String clerkId;
/**
* 1 最新; 2 最热; 3 视频
*/
private Integer sortType;
......@@ -76,4 +86,20 @@ public class ContentMaterialQO extends PageQo {
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
}
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