联动修改

master
wangweijia 6 years ago
parent 16e2b9b3e9
commit ca311e732d

@ -9,8 +9,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* *
@ -31,8 +33,11 @@ public class PoiStoreController extends BaseController {
*/ */
@RequestMapping(value = "/user/shop",method = RequestMethod.GET) @RequestMapping(value = "/user/shop",method = RequestMethod.GET)
@ResponseBody @ResponseBody
public Map<String,Object> getUserShop(@RequestParam("userId")long userId, @RequestParam(value = "customerIds[]",required =false)List<Long> customerIds){ public Map<String,Object> getUserShop(@RequestParam("userId")long userId, @RequestParam(value = "customerIds[]",required =false)List<Long> customerIds,String customerId){
try { try {
if((customerIds == null || customerIds.size() == 0)&& customerId != null){
customerIds = Arrays.asList(customerId.split(",")).stream().map(Long::parseLong).collect(Collectors.toList());;
}
return data(poiStoreService.getRegionShop(userId,customerIds)); return data(poiStoreService.getRegionShop(userId,customerIds));
}catch (Exception e){ }catch (Exception e){
log.error("获取用户店铺失败",e); log.error("获取用户店铺失败",e);

@ -30,9 +30,9 @@ public class PoiStoreStaffController extends BaseController {
*/ */
@ResponseBody @ResponseBody
@PostMapping("/user/seller") @PostMapping("/user/seller")
public Map<String,Object> getSellerData(@RequestParam("userId")long userId, Long shopId, Long regionId, Long companyId, List<Long> customers){ public Map<String,Object> getSellerData(@RequestParam("userId")long userId, Long shopId, Long regionId, Long companyId){
try { try {
return data(poiSellerService.getAllSeller(regionId, shopId, userId, companyId, customers)); return data(poiSellerService.getAllSeller(regionId, shopId, userId, companyId));
}catch (Exception e){ }catch (Exception e){
log.error("查找用户管辖的导购",e); log.error("查找用户管辖的导购",e);
return fail(); return fail();

@ -44,7 +44,7 @@ public class PoiSellerService {
/** /**
* *
*/ */
public List<PoiStoreStaffDTO> getAllSeller(Long regionId, Long shopId, long userId, Long companyId, List<Long> customers){ public List<PoiStoreStaffDTO> getAllSeller(Long regionId, Long shopId, long userId, Long companyId){
List<Long> shopIds = new ArrayList<>(); List<Long> shopIds = new ArrayList<>();
//先找到店铺 //先找到店铺
if(null != shopId){ if(null != shopId){
@ -59,13 +59,15 @@ public class PoiSellerService {
}else if(companyId != null){ }else if(companyId != null){
//有公司就查公司店铺 //有公司就查公司店铺
shopIds.addAll(customerViewService.getCompanyShop(companyId,userId)); shopIds.addAll(customerViewService.getCompanyShop(companyId,userId));
}else if(customers != null){ }
for(Long cp : customers){ // else if(customers != null){
//有公司就查公司店铺 // for(Long cp : customers){
shopIds.addAll(customerViewService.getCompanyShop(cp,userId)); // //有公司就查公司店铺
} // shopIds.addAll(customerViewService.getCompanyShop(cp,userId));
// }
}else { //
// }
else {
//什么都没有就全查 //什么都没有就全查
shopIds = privilageDomainService.listUserDatePermission(userId); shopIds = privilageDomainService.listUserDatePermission(userId);
} }

Loading…
Cancel
Save