package com.ruoyi.shop.controller.staff;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.security.utils.SecurityUtils;
|
import com.ruoyi.shop.domain.dto.MgtShopPageDto;
|
import com.ruoyi.shop.domain.dto.MgtShopTaskPageDto;
|
import com.ruoyi.shop.domain.vo.MgtShopPageVo;
|
import com.ruoyi.shop.domain.vo.MgtShopTaskRecordPageVo;
|
import com.ruoyi.shop.service.shop.ShopService;
|
import com.ruoyi.system.api.domain.poji.shop.Shop;
|
import com.ruoyi.system.api.domain.vo.MerHomeShopTotalVo;
|
import com.ruoyi.system.api.service.RemoteSysStaffService;
|
import com.ruoyi.system.api.service.RemoteUserService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
|
|
@Api(value = "员工端商户接口", tags = "员工端商户接口", description = "员工端商户接口")
|
@RestController
|
@RequestMapping("/staff/shop")
|
public class StaffController {
|
|
@Resource
|
private ShopService shopService;
|
@Resource
|
private RemoteUserService sysUserService;
|
@Resource
|
private RemoteSysStaffService remoteSysStaffService;
|
|
/**
|
* 未完成实际统计
|
* @return
|
*/
|
@RequestMapping(value = "/getStaffHomeTotal", method = RequestMethod.POST)
|
@ApiOperation(value = "获取员工端商铺统计(首页)")
|
public R<MerHomeShopTotalVo> getStaffHomeTotal() {
|
Long userId = SecurityUtils.getUserId();
|
MerHomeShopTotalVo merHomeShopTotalVo = shopService.getStaffHomeTotal(userId);
|
return R.ok(merHomeShopTotalVo);
|
}
|
|
@RequestMapping(value = "/list", method = RequestMethod.POST)
|
@ApiOperation(value = "获取商户端商业统计")
|
public R getShopByUserId(@RequestBody MgtShopPageDto mgtShopPageDto) {
|
Long userId = SecurityUtils.getUserId();
|
if (remoteSysStaffService.isLeader()) {
|
Long deptId = sysUserService.getSysUser(userId).getData().getDeptId();
|
List<Long> userIds = remoteSysStaffService.getUserIds(deptId).getData();
|
if(userIds.size()==0){
|
return R.ok("未关联商户");
|
}
|
mgtShopPageDto.setIds(userIds);
|
} else {
|
mgtShopPageDto.setBelongUserId(userId);
|
}
|
Page<MgtShopPageVo> page = new Page<>();
|
page.setSize(mgtShopPageDto.getPageSize());
|
page.setCurrent(mgtShopPageDto.getPageNum());
|
List<MgtShopPageVo> mgtShopPageVoList = shopService.pageMgtShop(page,mgtShopPageDto);
|
return R.ok(page.setRecords(mgtShopPageVoList));
|
}
|
|
@RequestMapping(value = "/editShop", method = RequestMethod.POST)
|
@ApiOperation(value = "修改商户")
|
public R<Boolean> editShopStatus(Shop shop) {
|
return R.ok(shopService.updateById(shop));
|
}
|
}
|