更新
This commit is contained in:
parent
747ab9fdef
commit
65c5812203
@ -14,7 +14,10 @@ import cn.iocoder.yudao.module.infra.service.file.FileService;
|
||||
import cn.iocoder.yudao.module.shop.entity.PartnerDetail;
|
||||
import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
|
||||
import cn.iocoder.yudao.module.shop.service.IShopMallPartnersService;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import cn.iocoder.yudao.module.system.service.permission.PermissionService;
|
||||
import cn.iocoder.yudao.module.system.service.permission.RoleService;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import cn.iocoder.yudao.util.ExcelUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -31,6 +34,8 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Controller
|
||||
@ -40,26 +45,28 @@ import java.util.Map;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/admin-api")
|
||||
public class AppSwiperController extends BaseController
|
||||
{
|
||||
public class AppSwiperController extends BaseController {
|
||||
@Autowired
|
||||
private IAppSwiperService appSwiperService;
|
||||
@Autowired
|
||||
private IShopMallPartnersService partnersService;
|
||||
@Autowired
|
||||
private AdminUserService userService;
|
||||
|
||||
@Autowired
|
||||
private PermissionService permissionService;
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
@Resource
|
||||
private FileService fileService;
|
||||
|
||||
@PostMapping({"/common/uploadImg","/common/upload"})
|
||||
@PostMapping({"/common/uploadImg", "/common/upload"})
|
||||
@Operation(summary = "上传文件")
|
||||
public CommonResult uploadFile(AppFileUploadReqVO uploadReqVO) throws Exception {
|
||||
MultipartFile file = uploadReqVO.getFile();
|
||||
String path = uploadReqVO.getPath();
|
||||
String url = fileService.createFile(file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream()));
|
||||
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("url", url);
|
||||
map.put("fileName", file.getName());
|
||||
map.put("newFileName", FileUtil.getName(url));
|
||||
@ -74,11 +81,10 @@ public class AppSwiperController extends BaseController
|
||||
|
||||
@GetMapping("/system/appSwiper/list")
|
||||
public CommonResult list(AppSwiper appSwiper,
|
||||
@RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize)
|
||||
{
|
||||
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
|
||||
Page<AppSwiper> page = new Page<>(pageNum, pageSize);
|
||||
IPage<AppSwiper> list = appSwiperService.selectAppSwiperList(page,appSwiper);
|
||||
IPage<AppSwiper> list = appSwiperService.selectAppSwiperList(page, appSwiper);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@ -88,11 +94,10 @@ public class AppSwiperController extends BaseController
|
||||
|
||||
@PostMapping("/system/appSwiper/export")
|
||||
public void export(HttpServletResponse response, AppSwiper appSwiper,
|
||||
@RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize)
|
||||
{
|
||||
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
|
||||
Page<AppSwiper> page = new Page<>(pageNum, pageSize);
|
||||
IPage<AppSwiper> list = appSwiperService.selectAppSwiperList(page,appSwiper);
|
||||
IPage<AppSwiper> list = appSwiperService.selectAppSwiperList(page, appSwiper);
|
||||
ExcelUtil<AppSwiper> util = new ExcelUtil<AppSwiper>(AppSwiper.class);
|
||||
util.exportExcel(response, list.getRecords(), "【请填写功能名称】数据");
|
||||
}
|
||||
@ -102,8 +107,7 @@ public class AppSwiperController extends BaseController
|
||||
*/
|
||||
|
||||
@GetMapping(value = "/system/appSwiper/{swiperId}")
|
||||
public CommonResult getInfo(@PathVariable("swiperId") Long swiperId)
|
||||
{
|
||||
public CommonResult getInfo(@PathVariable("swiperId") Long swiperId) {
|
||||
return success(appSwiperService.selectAppSwiperBySwiperId(swiperId));
|
||||
}
|
||||
|
||||
@ -112,8 +116,7 @@ public class AppSwiperController extends BaseController
|
||||
*/
|
||||
|
||||
@PostMapping("/system/appSwiper/add")
|
||||
public CommonResult add(@RequestBody AppSwiper appSwiper)
|
||||
{
|
||||
public CommonResult add(@RequestBody AppSwiper appSwiper) {
|
||||
return toAjax(appSwiperService.insertAppSwiper(appSwiper));
|
||||
}
|
||||
|
||||
@ -121,34 +124,39 @@ public class AppSwiperController extends BaseController
|
||||
* 修改【请填写功能名称】
|
||||
*/
|
||||
@PostMapping("/system/appSwiper/edit")
|
||||
public CommonResult edit(@RequestBody AppSwiper appSwiper)
|
||||
{
|
||||
public CommonResult edit(@RequestBody AppSwiper appSwiper) {
|
||||
return toAjax(appSwiperService.updateAppSwiper(appSwiper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】
|
||||
*/
|
||||
@PostMapping("/system/appSwiper/del")
|
||||
public CommonResult remove(@RequestParam("idList") Long[] idList)
|
||||
{
|
||||
@PostMapping("/system/appSwiper/del")
|
||||
public CommonResult remove(@RequestParam("idList") Long[] idList) {
|
||||
return toAjax(appSwiperService.deleteAppSwiperBySwiperIds(idList));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getJcPartnerInfo")
|
||||
public CommonResult getJcPartnerInfo()
|
||||
{
|
||||
LambdaQueryWrapper<ShopMallPartners> queryWrapper =new LambdaQueryWrapper<>();
|
||||
public CommonResult getJcPartnerInfo() {
|
||||
LambdaQueryWrapper<ShopMallPartners> queryWrapper = new LambdaQueryWrapper<>();
|
||||
LoginUser user = SecurityFrameworkUtils.getLoginUser();
|
||||
queryWrapper.orderByAsc(ShopMallPartners::getPartnerId).eq(ShopMallPartners::getType,"jc").eq(ShopMallPartners::getIsBanned,"0").last("limit 1");
|
||||
queryWrapper.orderByAsc(ShopMallPartners::getPartnerId).eq(ShopMallPartners::getType, "jc").eq(ShopMallPartners::getIsBanned, "0").last("limit 1");
|
||||
ShopMallPartners partner = partnersService.getOne(queryWrapper);
|
||||
if (ObjectUtil.isEmpty(partner)){
|
||||
if (ObjectUtil.isEmpty(partner)) {
|
||||
return error("信息有误");
|
||||
}
|
||||
AdminUserDO sysUser = userService.getUser(user.getId());
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("user", sysUser);
|
||||
Set<Long> userRoleIdListByUserId = permissionService.getUserRoleIdListByUserId(user.getId());
|
||||
List<RoleDO> roleList = roleService.getRoleList(userRoleIdListByUserId);
|
||||
List<String> roles = roleList.stream().map(RoleDO::getCode).collect(Collectors.toList());
|
||||
if (roles.contains("jcshop") || roles.contains("jiance")) {
|
||||
map.put("shop", true);
|
||||
} else {
|
||||
map.put("shop", false);
|
||||
}
|
||||
return CommonResult.success(map);
|
||||
}
|
||||
// @GetMapping("/getJcWorkerInfo")
|
||||
|
Loading…
Reference in New Issue
Block a user