You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

218 lines
8.3 KiB
Java

package com.kiisoo.ic.generalize.controller;
import com.kiisoo.ic.common.BaseController;
import com.kiisoo.ic.generalize.bean.OrganizationVO;
import com.kiisoo.ic.generalize.bean.RetailOrganizationalVO;
import com.kiisoo.ic.generalize.bean.SellerOrganizationalVO;
import com.kiisoo.ic.generalize.bean.StoreOrganizationalVO;
import com.kiisoo.ic.generalize.entity.PrivilageOrganizational;
import com.kiisoo.ic.generalize.service.RetailCompanyService;
import com.kiisoo.ic.store.entity.PoiStore;
import com.kiisoo.ic.system.entity.PrivilageUserDO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @ClassName: RetailCompanyController
* @Description: 零售公司
* @Auther: Caps
* @Date: 2020/4/15 0015 10:47
* @Version: v1
*/
@RestController
@RequestMapping("/retail")
@Slf4j
public class RetailCompanyController extends BaseController {
private final RetailCompanyService retailCompanyService;
@Autowired
public RetailCompanyController(RetailCompanyService retailCompanyService) {
this.retailCompanyService = retailCompanyService;
}
/**
* 查询用户零售公司
* @param parentId 父区域id
* @param userId 用户id
* @param level 区域等级
* @return
*/
@ResponseBody
@GetMapping("/user/company")
public Map<String,Object> getUserOrg(Long parentId,@RequestParam("userId") long userId,@RequestParam("level") int level){
try{
List<PrivilageOrganizational> privilageOrganizationals = retailCompanyService.getUserOrg(parentId,userId,level);
return data(privilageOrganizationals);
}catch (Exception e){
log.error("查询用户零售公司",e);
return fail();
}
}
/**
* 查询所有的组织数据
* @return 组织数据集合
*/
@ResponseBody
@GetMapping("/org")
public Map<String,Object> listOfRetailCompany(@RequestParam("userId") long userId, Long regionId, Long companyId, Long customerId){
try{
List<PrivilageOrganizational> privilageOrganizationals = retailCompanyService.listOfRetailOrg(userId, regionId, companyId, customerId);
return data(privilageOrganizationals);
}catch (Exception e){
log.error("查询所有的组织数据失败",e);
return fail();
}
}
/**
* 查询所有的零售公司数据
* @return 零售公司数据集合
*/
@ResponseBody
@GetMapping("/company")
public Map<String,Object> listOfRetailCompany(@RequestParam("userId") long userId,
@RequestParam(value = "bigRegionId",required = false) Long bigRegionId){
try{
List<PrivilageOrganizational> privilageOrganizationals = retailCompanyService.listOfRetailCompany(userId,bigRegionId);
return data(privilageOrganizationals);
}catch (Exception e){
log.error("查询所有的零售公司的数据失败",e);
return fail();
}
}
/**
* 查询所有的零售公司数据
* @return 零售公司数据集合
*/
@ResponseBody
@GetMapping("/big/region")
public Map<String,Object> listOfBigRetailCompany(@RequestParam("userId") long userId){
try{
List<PrivilageOrganizational> privilageOrganizationals = retailCompanyService.listOfBigRetailCompany(userId);
return data(privilageOrganizationals);
}catch (Exception e){
log.error("查询所有的零售公司的数据失败",e);
return fail();
}
}
/**
* 查询零售公司下的店铺
* @param orgId 零售公司id
* @return 店铺集合
*/
@ResponseBody
@GetMapping("/store/company")
public Map<String,Object> listOfStore(@RequestParam(value = "orgId",required = false) Long orgId){
try{
List<PoiStore> list = retailCompanyService.selectShopByCompany(orgId);
return data(list);
}catch (Exception e){
log.error("查询零售公司下的店铺失败",e);
return fail();
}
}
/**
* 查询店铺下的导购
* @param shopId 门店id
* @return 导购集合
*/
@ResponseBody
@GetMapping("/seller/store")
public Map<String,Object> listOfSeller(@RequestParam(value = "shopId",required = false) Long shopId){
try{
List<PrivilageUserDO> list = retailCompanyService.selectSellerByShop(shopId);
return data(list);
}catch (Exception e){
log.error("查询零售公司下的店铺失败",e);
return fail();
}
}
/**
* 查询零售公司的推广数据
* @param startTime 日期
* @param endTime 日期
* @param orgId 零售公司
* @return 返回数据
*/
@ResponseBody
@GetMapping("/retail")
public Map<String,Object> generalizeOfRetail(@RequestParam(value = "startTime",required = false) String startTime,
@RequestParam(value = "endTime",required = false) String endTime,
@RequestParam(value = "orgId",required = false) Long orgId,
@RequestParam("pageNum") int pageNum,
@RequestParam("pageSize") int pageSize){
try{
OrganizationVO list = retailCompanyService.generalizeOfRetail(startTime,endTime,orgId,pageNum,pageSize);
return data(list);
}catch (Exception e){
log.error("查询零售哦公司的推广数据失败",e);
return fail();
}
}
/**
* 查询门店的推广数据
* @param startTime 日期
* @param endTime 日期
* @param orgId 零售公司
* @param shopId 店铺
* @return 返回数据
*/
@ResponseBody
@GetMapping("/store")
public Map<String,Object> generalizeOfStore(@RequestParam(value = "startTime",required = false) String startTime,
@RequestParam(value = "endTime",required = false) String endTime,
@RequestParam(value = "orgId",required = false) Long orgId,
@RequestParam(value = "shopId",required = false) Long shopId,
@RequestParam("pageNum") int pageNum,
@RequestParam("pageSize") int pageSize){
try{
OrganizationVO list = retailCompanyService.generalizeOfStore(startTime,endTime,orgId,shopId,pageNum,pageSize);
return data(list);
}catch (Exception e){
log.error("查询零售哦公司的推广数据失败",e);
return fail();
}
}
/**
* 查询导购的推广数据
* @param startTime 日期
* @param endTime 日期
* @param orgId 零售哦给弄死id
* @param shopId 门店id
* @param pageNum 页码
* @param pageSize 页面个数
* @return 导购的推广数据
*/
@ResponseBody
@GetMapping("/seller")
public Map<String,Object> generalizeOfSeller(@RequestParam(value = "startTime",required = false) String startTime,
@RequestParam(value = "endTime",required = false) String endTime,
@RequestParam(value = "orgId",required = false) Long orgId,
@RequestParam(value = "shopId",required = false) Long shopId,
@RequestParam(value = "sellerId",required = false) Long sellerId,
@RequestParam("pageNum") int pageNum,
@RequestParam("pageSize") int pageSize){
try{
OrganizationVO list = retailCompanyService.generalizeOfSeller(startTime,endTime,orgId,shopId,sellerId,pageNum,pageSize);
return data(list);
}catch (Exception e){
log.error("查询零售哦公司的推广数据失败",e);
return fail();
}
}
}