|
@@ -2,7 +2,9 @@ package com.ydd.web.controller;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.ydd.common.annotation.BindAgent;
|
|
|
import com.ydd.common.annotation.Log;
|
|
|
+import com.ydd.common.constant.Constants;
|
|
|
import com.ydd.common.core.controller.BaseController;
|
|
|
import com.ydd.common.core.domain.Result;
|
|
|
import com.ydd.common.core.domain.entity.SysUser;
|
|
@@ -12,6 +14,7 @@ import com.ydd.common.enums.BusinessType;
|
|
|
import com.ydd.common.enums.UserTypeEnums;
|
|
|
import com.ydd.common.utils.poi.ExcelUtil;
|
|
|
import com.ydd.module.domain.Agent;
|
|
|
+import com.ydd.ecloud.core.utils.HttpContextUtils;
|
|
|
import com.ydd.module.domain.DspDelivery;
|
|
|
import com.ydd.module.domain.Merchant;
|
|
|
import com.ydd.module.domain.MerchantCategory;
|
|
@@ -22,9 +25,9 @@ import lombok.RequiredArgsConstructor;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.compress.utils.Lists;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -88,6 +91,7 @@ public class MerchantController extends BaseController {
|
|
|
*/
|
|
|
// @PreAuthorize("@ss.hasPermi('module:merchant:list')")
|
|
|
@GetMapping("/list")
|
|
|
+ @BindAgent
|
|
|
public TableDataInfo list(SystemMerchantDto merchantDto) {
|
|
|
SysUser user = getSysUser();
|
|
|
|
|
@@ -113,6 +117,20 @@ public class MerchantController extends BaseController {
|
|
|
return getDataTable(new ArrayList<>());
|
|
|
}
|
|
|
}
|
|
|
+ // 允许查看的代理商数据
|
|
|
+ List<Long> agentIds = new ArrayList<>();
|
|
|
+ HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
|
|
|
+ Object obj = request.getAttribute(Constants.SYS_USER_BIND_AGENT);
|
|
|
+ if (obj instanceof List) {
|
|
|
+ agentIds = (List) obj;
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(agentIds)) {
|
|
|
+ if (CollectionUtils.isNotEmpty(agents)) {
|
|
|
+ agents.retainAll(agentIds);
|
|
|
+ } else {
|
|
|
+ agents.addAll(agentIds);
|
|
|
+ }
|
|
|
+ }
|
|
|
startPage();
|
|
|
List<Merchant> list = iMerchantService.queryList(merchantDto, agents, agentList);
|
|
|
return getDataTable(list);
|
|
@@ -121,8 +139,16 @@ public class MerchantController extends BaseController {
|
|
|
* 查询客户商家配送平台列表(达达和顺丰)
|
|
|
*/
|
|
|
@GetMapping("/shop/delivery/list")
|
|
|
+ @BindAgent
|
|
|
public Result getShopDeliveryList(Page page, Merchant merchant) {
|
|
|
- PageResult pageResult = iShopDeliveryBindService.getShopDeliveryList(page,merchant);
|
|
|
+ // 允许查看的代理商数据
|
|
|
+ List<Long> agentIds = new ArrayList<>();
|
|
|
+ HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
|
|
|
+ Object obj = request.getAttribute(Constants.SYS_USER_BIND_AGENT);
|
|
|
+ if (obj instanceof List) {
|
|
|
+ agentIds = (List) obj;
|
|
|
+ }
|
|
|
+ PageResult pageResult = iShopDeliveryBindService.getShopDeliveryList(page,merchant, agentIds);
|
|
|
Map map = new HashMap();
|
|
|
map.put("page",pageResult);
|
|
|
Result result = Result.success();
|
|
@@ -142,8 +168,16 @@ public class MerchantController extends BaseController {
|
|
|
return result;
|
|
|
}
|
|
|
@GetMapping("/shop/delivery/verify")
|
|
|
+ @BindAgent
|
|
|
public Result verify(Page page, Merchant merchant) {
|
|
|
SysUser user = getSysUser();
|
|
|
+ // 允许查看的代理商数据
|
|
|
+ HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
|
|
|
+ Object obj = request.getAttribute(Constants.SYS_USER_BIND_AGENT);
|
|
|
+ if (obj instanceof List) {
|
|
|
+ List<Long> agentIds = (List) obj;
|
|
|
+ user.setAgentIds(agentIds);
|
|
|
+ }
|
|
|
PageResult pageResult = iShopDeliveryService.verify(page,merchant,user);
|
|
|
Map map = new HashMap();
|
|
|
map.put("page",pageResult);
|
|
@@ -183,9 +217,9 @@ public class MerchantController extends BaseController {
|
|
|
*/
|
|
|
@PostMapping("/shop/delivery/handle")
|
|
|
public Result shopDeliveryHandle(@RequestBody ShopDeliveryDto shopDeliveryDto) {
|
|
|
- String flg = "";//iShopDeliveryService.shopDeliveryHandle(shopDeliveryDto);
|
|
|
+// String flg = iShopDeliveryService.shopDeliveryHandle(shopDeliveryDto);
|
|
|
Result result = Result.success();
|
|
|
- result.put("data",flg);
|
|
|
+ result.put("data", "");
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -206,6 +240,7 @@ public class MerchantController extends BaseController {
|
|
|
// @PreAuthorize("@ss.hasPermi('module:merchant:export')" )
|
|
|
@Log(title = "客户商家" , businessType = BusinessType.EXPORT)
|
|
|
@GetMapping("/export" )
|
|
|
+ @BindAgent
|
|
|
public Result export(MerchantExportDto merchant) {
|
|
|
SysUser user = getSysUser();
|
|
|
if (user.getType().equals(UserTypeEnums.AGENT.getCode()) && merchant.getAgentId() == null){
|
|
@@ -216,6 +251,20 @@ public class MerchantController extends BaseController {
|
|
|
if (merchant.getAgentId() != null) {
|
|
|
agents = iAgentService.listAgent(merchant.getAgentId());
|
|
|
}
|
|
|
+ // 允许查看的代理商数据
|
|
|
+ List<Long> agentIds = Lists.newArrayList();
|
|
|
+ HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
|
|
|
+ Object obj = request.getAttribute(Constants.SYS_USER_BIND_AGENT);
|
|
|
+ if (obj instanceof List) {
|
|
|
+ agentIds = (List) obj;
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(agentIds)) {
|
|
|
+ if (CollectionUtils.isNotEmpty(agents)) {
|
|
|
+ agents.retainAll(agentIds);
|
|
|
+ } else {
|
|
|
+ agents.addAll(agentIds);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
List<MerchantExportDto> list = iMerchantService.selectExportList(merchant, agents);
|
|
|
ExcelUtil<MerchantExportDto> util = new ExcelUtil<>(MerchantExportDto.class);
|