From 0774ea976b6aa86a8a7de334fa24fbd7524295d5 Mon Sep 17 00:00:00 2001 From: 44323 <443237572@qq.com> Date: 星期五, 26 一月 2024 11:57:11 +0800 Subject: [PATCH] 看板统计 --- ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/management/MgtShopController.java | 579 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 556 insertions(+), 23 deletions(-) diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/management/MgtShopController.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/management/MgtShopController.java index 00fc1bb..408fcfc 100644 --- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/management/MgtShopController.java +++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/management/MgtShopController.java @@ -1,24 +1,40 @@ package com.ruoyi.shop.controller.management; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.shop.domain.dto.*; -import com.ruoyi.shop.domain.vo.MgtShopInfoVo; -import com.ruoyi.shop.domain.vo.MgtShopPageVo; -import com.ruoyi.shop.domain.vo.MgtShopTagVo; -import com.ruoyi.shop.service.shop.ShopRelTagService; -import com.ruoyi.shop.service.shop.ShopService; +import com.ruoyi.shop.domain.pojo.shop.BankBranchCode; +import com.ruoyi.shop.domain.vo.*; +import com.ruoyi.shop.service.shop.*; import com.ruoyi.system.api.domain.dto.MgtBaseGetDto; +import com.ruoyi.system.api.domain.poji.shop.Shop; +import com.ruoyi.system.api.domain.poji.sys.SysUser; +import com.ruoyi.system.api.domain.vo.MgtSimpleShopVo; +import com.ruoyi.system.api.service.RemoteUserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.validation.annotation.Validated; 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 javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * @author jqs34 @@ -32,58 +48,575 @@ @RequestMapping("/mgt/shop") public class MgtShopController { - @Autowired + Logger logger = LoggerFactory.getLogger(MgtShopController.class); + + @Resource private ShopService shopService; - @Autowired + @Resource private ShopRelTagService shopRelTagService; - @RequestMapping(value = "/pageShop", method = RequestMethod.POST) + @Resource + private ShopProportionService shopProportionService; + + @Resource + private ShopSuggestService shopSuggestService; + + @Resource + private ShopCertificateService shopCertificateService; + + @Resource + private BankBranchCodeService bankBranchCodeService; + @Resource + private RemoteUserService sysUserService; + + + + @RequestMapping(value = "/listMgtShopSimpleVo", method = RequestMethod.POST) + @ApiOperation(value = "获取简易商户列表") + public R<List<MgtShopListSimpleVo>> listMgtShopSimpleVo(@RequestBody MgtShopListDto mgtShopListDto) { + // 获取当前登陆人的可视权限 + SysUser sysUser = SecurityUtils.getSysUser(); + // 店铺ids + List<Long> scope = new ArrayList<>(); + if (sysUser!=null){ + String dataScope = sysUser.getDataScope(); + if (!sysUser.getUserName().equals("admin")){ + if (org.springframework.util.StringUtils.hasLength(dataScope)){ + switch (dataScope){ + case "3": + // 本部门数据 查询当前登陆人属于哪个部门 查询这个部门下所有员工关联的所有店铺 + // 根据用户id 查询同部门下所有员工id + List<Long> userIds = sysUserService.getUserIdsByDept(sysUser.getUserId()).getData(); + // 店铺ids + List<Long> data = shopService.list(new QueryWrapper<Shop>() + .in("belong_user_id", userIds) + .eq("del_flag", 0)) + .stream().map(Shop::getShopId).collect(Collectors.toList()); + if (data.size()==0){ + scope.add(0L); + }else{ + scope.addAll(data); + } + + break; + case "5": + // 仅个人数据 查询当前登陆人关联店铺下的用户 + List<Long> longs = new ArrayList<>(); + longs.add(sysUser.getUserId()); + // 获取店铺ids + List<Long> data1 = shopService.list(new QueryWrapper<Shop>() + .in("belong_user_id", longs) + .eq("del_flag", 0)) + .stream().map(Shop::getShopId).collect(Collectors.toList()); + if (data1.size()==0){ + scope.add(0L); + }else{ + scope.addAll(data1); + } + break; + } + } + } + } + List<MgtShopListSimpleVo> mgtShopListSimpleVoList = shopService.listMgtShopSimpleVo(mgtShopListDto,scope); + return R.ok(mgtShopListSimpleVoList); + } + + @RequestMapping(value = "/pageMgtShop", method = RequestMethod.POST) @ApiOperation(value = "分页获取商户列表") - public R<Page<MgtShopPageVo>> pageShop(@RequestBody MgtShopPageDto mgtShopPageDto) { + public R<Page<MgtShopPageVo>> pageMgtShop(@RequestBody MgtShopPageDto mgtShopPageDto) { + // 获取当前登陆人的可视权限 + SysUser sysUser = SecurityUtils.getSysUser(); + // 店铺ids + List<Long> scope = new ArrayList<>(); + if (sysUser!=null){ + String dataScope = sysUser.getDataScope(); + if (!sysUser.getUserName().equals("admin")){ + if (org.springframework.util.StringUtils.hasLength(dataScope)){ + switch (dataScope){ + case "3": + // 本部门数据 查询当前登陆人属于哪个部门 查询这个部门下所有员工关联的所有店铺 + // 根据用户id 查询同部门下所有员工id + List<Long> userIds = sysUserService.getUserIdsByDept(sysUser.getUserId()).getData(); + // 店铺ids + List<Long> data = shopService.list(new QueryWrapper<Shop>() + .in("belong_user_id", userIds) + .eq("del_flag", 0)) + .stream().map(Shop::getShopId).collect(Collectors.toList()); + if (data.size()==0){ + scope.add(0L); + }else{ + scope.addAll(data); + } + + break; + case "5": + // 仅个人数据 查询当前登陆人关联店铺下的用户 + List<Long> longs = new ArrayList<>(); + longs.add(sysUser.getUserId()); + // 获取店铺ids + List<Long> data1 = shopService.list(new QueryWrapper<Shop>() + .in("belong_user_id", longs) + .eq("del_flag", 0)) + .stream().map(Shop::getShopId).collect(Collectors.toList()); + if (data1.size()==0){ + scope.add(0L); + }else{ + scope.addAll(data1); + } + break; + } + } + } + } Page<MgtShopPageVo> page = new Page<>(); page.setSize(mgtShopPageDto.getPageSize()); page.setCurrent(mgtShopPageDto.getPageNum()); - List<MgtShopPageVo> mgtShopPageVoList = shopService.pageShop(page,mgtShopPageDto); + List<MgtShopPageVo> mgtShopPageVoList = shopService.pageMgtShop(page,mgtShopPageDto,scope); return R.ok(page.setRecords(mgtShopPageVoList)); } - @RequestMapping(value = "/createShop", method = RequestMethod.POST) - @ApiOperation(value = "创建商户") - public R createShop(@RequestBody MgtEditShopDto mgtEditShopDto) { + @RequestMapping(value = "/exportPageMgtShop", method = RequestMethod.POST) + @ApiOperation(value = "导出商户列表") + public void exportPageMgtShop(MgtShopPageDto mgtShopPageDto, HttpServletResponse response) { + Page<MgtShopPageVo> page = new Page<>(); + if(mgtShopPageDto.getPageSize() > 5000){ + page.setSize(5000); + page.setCurrent(1); + }else{ + page.setSize(mgtShopPageDto.getPageSize()); + page.setCurrent(mgtShopPageDto.getPageNum()); + } + // 获取当前登陆人的可视权限 + SysUser sysUser = SecurityUtils.getSysUser(); + // 店铺ids + List<Long> scope = new ArrayList<>(); + if (sysUser!=null){ + String dataScope = sysUser.getDataScope(); + if (!sysUser.getUserName().equals("admin")){ + if (org.springframework.util.StringUtils.hasLength(dataScope)){ + switch (dataScope){ + case "3": + // 本部门数据 查询当前登陆人属于哪个部门 查询这个部门下所有员工关联的所有店铺 + // 根据用户id 查询同部门下所有员工id + List<Long> userIds = sysUserService.getUserIdsByDept(sysUser.getUserId()).getData(); + // 店铺ids + List<Long> data = shopService.list(new QueryWrapper<Shop>() + .in("belong_user_id", userIds) + .eq("del_flag", 1)) + .stream().map(Shop::getShopId).collect(Collectors.toList()); + scope.addAll(data); + break; + case "5": + // 仅个人数据 查询当前登陆人关联店铺下的用户 + List<Long> longs = new ArrayList<>(); + longs.add(sysUser.getUserId()); + // 获取店铺ids + List<Long> data1 = shopService.list(new QueryWrapper<Shop>() + .in("belong_user_id", longs) + .eq("del_flag", 1)) + .stream().map(Shop::getShopId).collect(Collectors.toList()); + scope.addAll(data1); + break; + } + } + } + } + List<MgtShopPageVo> mgtShopPageVoList = shopService.pageMgtShop(page,mgtShopPageDto,scope); + ExcelUtil<MgtShopPageVo> util = new ExcelUtil<MgtShopPageVo>(MgtShopPageVo.class); + util.exportExcel(response, mgtShopPageVoList, "商户列表"); + } + + @RequestMapping(value = "/createMgtShop", method = RequestMethod.POST) + @Log(title = "商户管理", businessType = BusinessType.UPDATE,operContent = "编辑商户") + @ApiOperation(value = "平台编辑商户") + public R createMgtShop(@Validated @RequestBody MgtEditShopDto mgtEditShopDto) { Long userId = SecurityUtils.getUserId(); mgtEditShopDto.setUserId(userId); shopService.createShop(mgtEditShopDto); return R.ok(); } - @RequestMapping(value = "/getShopInfo", method = RequestMethod.POST) + @RequestMapping(value = "/getMgtShopInfo", method = RequestMethod.POST) @ApiOperation(value = "获取商户详情") - public R<MgtShopInfoVo> getShopInfo(@RequestBody MgtBaseGetDto mgtBaseGetDto) { + public R<MgtShopInfoVo> getMgtShopInfo(@RequestBody MgtBaseGetDto mgtBaseGetDto) { MgtShopInfoVo mgtShopInfoVo = shopService.getMgtShopInfo(Long.valueOf(mgtBaseGetDto.getId())); return R.ok(mgtShopInfoVo); } - @RequestMapping(value = "/getShopTag", method = RequestMethod.POST) + @RequestMapping(value = "/getMgtShopTag", method = RequestMethod.POST) @ApiOperation(value = "获取商户标签") - public R<List<MgtShopTagVo>> getShopTag(@RequestBody MgtBaseGetDto mgtBaseGetDto) { - List<MgtShopTagVo> mgtShopInfoVoList = shopRelTagService.listShopTagVo(Long.valueOf(mgtBaseGetDto.getId())); + public R<List<MgtShopTagVo>> getMgtShopTag(@RequestBody MgtBaseGetDto mgtBaseGetDto) { + List<MgtShopTagVo> mgtShopInfoVoList = shopRelTagService.listShopTagVo(mgtBaseGetDto); return R.ok(mgtShopInfoVoList); } - @RequestMapping(value = "/editShopTag", method = RequestMethod.POST) + @RequestMapping(value = "/editMgtShopTag", method = RequestMethod.POST) + @Log(title = "商户管理", businessType = BusinessType.UPDATE,operContent = "修改商户标签") @ApiOperation(value = "修改商户标签") - public R editShopTag(@RequestBody MgtEditShopTagDto mgtEditShopTagDto) { + public R editMgtShopTag(@RequestBody MgtEditShopTagDto mgtEditShopTagDto) { shopService.editShopTag(mgtEditShopTagDto); return R.ok(); } - @RequestMapping(value = "/changeCooperationTime", method = RequestMethod.POST) + @RequestMapping(value = "/transferMgtShop", method = RequestMethod.POST) + @Log(title = "商户管理", businessType = BusinessType.UPDATE,operContent = "转移客户") + @ApiOperation(value = "转移客户") + public R transferMgtShop(@RequestBody MgtTransferShopDto mgtTransferShopDto) { + shopService.transferMgtShop(mgtTransferShopDto); + return R.ok(); + } + + @RequestMapping(value = "/terminateMgtCooperation", method = RequestMethod.POST) + @Log(title = "商户管理", businessType = BusinessType.UPDATE,operContent = "终止合作") + @ApiOperation(value = "终止合作") + public R terminateMgtCooperation(@RequestBody MgtTerminateCooperationDto mgtTerminateCooperationDto) { + Long userId = SecurityUtils.getUserId(); + mgtTerminateCooperationDto.setUserId(userId); + shopService.terminateMgtCooperation(mgtTerminateCooperationDto); + return R.ok(); + } + + @RequestMapping(value = "/frozenMgtShop", method = RequestMethod.POST) + @Log(title = "商户管理", businessType = BusinessType.UPDATE,operContent = "终止合作") + @ApiOperation(value = "冻结商户") + public R frozenMgtShop(@RequestBody MgtFrozenShopDto mgtFrozenShopDto) { + Long userId = SecurityUtils.getUserId(); + mgtFrozenShopDto.setUserId(userId); + shopService.frozenMgtShop(mgtFrozenShopDto); + return R.ok(); + } + + @RequestMapping(value = "/changeMgtCooperationTime", method = RequestMethod.POST) + @Log(title = "商户管理", businessType = BusinessType.UPDATE,operContent = "修改合作时间") @ApiOperation(value = "修改合作时间") - public R changeCooperationTime(@RequestBody MgtChangeCoopDto mgtChangeCoopDto) { + public R changeMgtCooperationTime(@RequestBody MgtChangeCoopDto mgtChangeCoopDto) { Long userId = SecurityUtils.getUserId(); mgtChangeCoopDto.setUserId(userId); shopService.changeCooperationTime(mgtChangeCoopDto); return R.ok(); } + + @RequestMapping(value = "/pageMgtShopProportion", method = RequestMethod.POST) + @ApiOperation(value = "分页获取商户分成列表") + public R<Page<MgtShopProportionPageVo>> pageMgtShopProportion(@RequestBody MgtShopProportionPageDto mgtShopProportionPageDto) { + Page<MgtShopProportionPageVo> page = new Page<>(); + page.setSize(mgtShopProportionPageDto.getPageSize()); + page.setCurrent(mgtShopProportionPageDto.getPageNum()); + List<MgtShopProportionPageVo> mgtShopProportionPageVoList = shopService.pageMgtShopProportion(page,mgtShopProportionPageDto); + return R.ok(page.setRecords(mgtShopProportionPageVoList)); + } + + @RequestMapping(value = "/editMgtShopProportion", method = RequestMethod.POST) + @Log(title = "商户管理", businessType = BusinessType.UPDATE,operContent = "修改商户分成") + @ApiOperation(value = "修改商户分成") + public R editMgtShopProportion(@RequestBody MgtShopProportionEditDto mgtShopProportionEditDto) { + mgtShopProportionEditDto.setUserId(SecurityUtils.getUserId()); + shopProportionService.editMgtShopProportion(mgtShopProportionEditDto); + return R.ok(); + } + + @RequestMapping(value = "/pageMgtShopSuggest", method = RequestMethod.POST) + @ApiOperation(value = "平台获取商户建议列表") + public R<Page<MgtShopSuggestPageVo>> pageMgtShopSuggest(@RequestBody MgtShopSuggestPageDto mgtShopSuggestPageDto) { + Long userId = SecurityUtils.getUserId(); + mgtShopSuggestPageDto.setUserId(userId); + Page<MgtShopSuggestPageVo> page = new Page<>(); + page.setSize(mgtShopSuggestPageDto.getPageSize()); + page.setCurrent(mgtShopSuggestPageDto.getPageNum()); + List<MgtShopSuggestPageVo> mgtShopSuggestPageVoList = shopSuggestService.pageMgtShopSuggest(page,mgtShopSuggestPageDto); + return R.ok(page.setRecords(mgtShopSuggestPageVoList)); + } + + @RequestMapping(value = "/exportPageMgtShopSuggest", method = RequestMethod.POST) + @ApiOperation(value = "导出商户建议列表") + public void exportPageMgtShopSuggest(MgtShopSuggestPageDto mgtShopSuggestPageDto, HttpServletResponse response) { + Long userId = SecurityUtils.getUserId(); + mgtShopSuggestPageDto.setUserId(userId); + Page<MgtShopSuggestPageVo> page = new Page<>(); + if(mgtShopSuggestPageDto.getPageSize() > 5000){ + page.setSize(5000); + page.setCurrent(1); + }else{ + page.setSize(mgtShopSuggestPageDto.getPageSize()); + page.setCurrent(mgtShopSuggestPageDto.getPageNum()); + } + List<MgtShopSuggestPageVo> mgtShopSuggestPageVoList = shopSuggestService.pageMgtShopSuggest(page,mgtShopSuggestPageDto); + ExcelUtil<MgtShopSuggestPageVo> util = new ExcelUtil<MgtShopSuggestPageVo>(MgtShopSuggestPageVo.class); + util.exportExcel(response, mgtShopSuggestPageVoList, "商户建议列表"); + } + + @RequestMapping(value = "/mgtReplayShopSuggest", method = RequestMethod.POST) + @Log(title = "商户建议管理", businessType = BusinessType.UPDATE,operContent = "回复商户建议") + @ApiOperation(value = "平台回复建议") + public R mgtReplayShopSuggest(@RequestBody MgtReplayShopSuggestDto mgtReplayShopSuggestDto) { + Long userId = SecurityUtils.getUserId(); + mgtReplayShopSuggestDto.setUserId(userId); + shopSuggestService.mgtReplayShopSuggest(mgtReplayShopSuggestDto); + return R.ok(); + } + + @RequestMapping(value = "/listMgtShopSuggestTag", method = RequestMethod.POST) + @ApiOperation(value = "获取商户建议标签") + public R<List<MgtShopSuggestTagVo>> listMgtShopSuggestTag(@RequestBody MgtBaseGetDto mgtBaseGetDto) { + List<MgtShopSuggestTagVo> mgtShopSuggestTagVoList = shopSuggestService.listMgtShopSuggestTag(Long.valueOf(mgtBaseGetDto.getId())); + return R.ok(mgtShopSuggestTagVoList); + } + + @RequestMapping(value = "/mgtEditShopSuggestTag", method = RequestMethod.POST) + @Log(title = "商户建议管理", businessType = BusinessType.UPDATE,operContent = "编辑商户建议标签") + @ApiOperation(value = "平台编辑商户建议标签") + public R mgtEditShopSuggestTag(@RequestBody MgtTagShopSuggestDto mgtTagShopSuggestDto) { + Long userId = SecurityUtils.getUserId(); + mgtTagShopSuggestDto.setUserId(userId); + shopSuggestService.mgtEditShopSuggestTag(mgtTagShopSuggestDto); + return R.ok(); + } + + @RequestMapping(value = "/pageMgtShopCertificate", method = RequestMethod.POST) + @ApiOperation(value = "平台获取商户证书审核列表") + public R<Page<MgtShopCertificatePageVo>> pageMgtShopCertificate(@RequestBody MgtShopCertificatePageDto mgtShopCertificatePageDto) { + Long userId = SecurityUtils.getUserId(); + mgtShopCertificatePageDto.setUserId(userId); + Page<MgtShopCertificatePageVo> page = new Page<>(); + page.setSize(mgtShopCertificatePageDto.getPageSize()); + page.setCurrent(mgtShopCertificatePageDto.getPageNum()); + List<MgtShopCertificatePageVo> mgtShopCertificatePageVoList = shopCertificateService.pageMgtShopCertificate(page,mgtShopCertificatePageDto); + return R.ok(page.setRecords(mgtShopCertificatePageVoList)); + } + + @RequestMapping(value = "/mgtAuditShopCertificate", method = RequestMethod.POST) + @Log(title = "商户证书管理", businessType = BusinessType.UPDATE,operContent = "审核商户证书") + @ApiOperation(value = "平台审核商户证书") + public R mgtAuditShopCertificate(@RequestBody MgtAuditShopCertificateDto mgtAuditShopCertificateDto) { + Long userId = SecurityUtils.getUserId(); + mgtAuditShopCertificateDto.setUserId(userId); + shopCertificateService.mgtAuditShopCertificate(mgtAuditShopCertificateDto); + return R.ok(); + } + + @RequestMapping(value = "/pageMgtShopByCityCode", method = RequestMethod.POST) + @ApiOperation(value = "通过市code分页获取商户列表") + public R<Page<MgtSimpleShopVo>> pageMgtShopByCityCode(@RequestBody MgtShopByCodePageDto mgtShopByCodePageDto) { + Page<MgtSimpleShopVo> page = new Page<>(); + page.setSize(mgtShopByCodePageDto.getPageSize()); + page.setCurrent(mgtShopByCodePageDto.getPageNum()); + List<MgtSimpleShopVo> mgtSimpleShopVoList = shopService.pageMgtShopByCityCode(page,mgtShopByCodePageDto); + return R.ok(page.setRecords(mgtSimpleShopVoList)); + } + + @RequestMapping(value = "/pageMgtShopAuth", method = RequestMethod.POST) + @ApiOperation(value = "分页获取商户进件列表") + public R<Page<MgtShopAuthPageVo>> pageMgtShopAuth(@RequestBody MgtShopAuthPageDto mgtShopAuthPageDto) { + Page<MgtShopAuthPageVo> page = new Page<>(); + page.setSize(mgtShopAuthPageDto.getPageSize()); + page.setCurrent(mgtShopAuthPageDto.getPageNum()); + // 获取当前登陆人的可视权限 + SysUser sysUser = SecurityUtils.getSysUser(); + // 店铺ids + List<Long> scope = new ArrayList<>(); + if (sysUser!=null){ + String dataScope = sysUser.getDataScope(); + if (!sysUser.getUserName().equals("admin")){ + if (org.springframework.util.StringUtils.hasLength(dataScope)){ + switch (dataScope){ + case "3": + // 本部门数据 查询当前登陆人属于哪个部门 查询这个部门下所有员工关联的所有店铺 + // 根据用户id 查询同部门下所有员工id + List<Long> userIds = sysUserService.getUserIdsByDept(sysUser.getUserId()).getData(); + // 店铺ids + List<Long> data = shopService.list(new QueryWrapper<Shop>() + .in("belong_user_id", userIds) + .eq("del_flag", 0)) + .stream().map(Shop::getShopId).collect(Collectors.toList()); + if (data.size()==0){ + scope.add(0L); + }else{ + scope.addAll(data); + } + + break; + case "5": + // 仅个人数据 查询当前登陆人关联店铺下的用户 + List<Long> longs = new ArrayList<>(); + longs.add(sysUser.getUserId()); + // 获取店铺ids + List<Long> data1 = shopService.list(new QueryWrapper<Shop>() + .in("belong_user_id", longs) + .eq("del_flag", 0)) + .stream().map(Shop::getShopId).collect(Collectors.toList()); + if (data1.size()==0){ + scope.add(0L); + }else{ + scope.addAll(data1); + } + break; + } + } + } + } + List<MgtShopAuthPageVo> mgtShopAuthPageVoList = shopService.pageMgtShopAuth(page,mgtShopAuthPageDto,scope); + return R.ok(page.setRecords(mgtShopAuthPageVoList)); + } + + @RequestMapping(value = "/mgtShopAuth", method = RequestMethod.POST) + @Log(title = "商户进件管理", businessType = BusinessType.UPDATE,operContent = "商户进件") + @ApiOperation(value = "平台商户进件") + public R mgtShopAuth(@Validated @RequestBody MgtShopAuthDto mgtShopAuthDto) { + Long userId = SecurityUtils.getUserId(); + mgtShopAuthDto.setUserId(userId); + shopService.mgtShopAuth(mgtShopAuthDto); + return R.ok(); + } + + + @RequestMapping(value = "/getMgtShopAuth", method = RequestMethod.POST) + @ApiOperation(value = "获取商户进件信息") + public R<MgtShopAuthGetVo> getMgtShopAuth(@RequestBody MgtShopAuthGetDto mgtShopAuthGetDto) { + MgtShopAuthGetVo shopAuthGetVo = shopService.getMgtShopAuth(mgtShopAuthGetDto.getAuthId()); + return R.ok(shopAuthGetVo); + } + + @RequestMapping(value = "/getMgtShopAuthCode", method = RequestMethod.POST) + @ApiOperation(value = "获取商户进件验证信息") + public R<MgtShopAuthCodeVo> getMgtShopAuthCode(@RequestBody MgtShopAuthGetDto mgtShopAuthGetDto) { + MgtShopAuthCodeVo mgtShopAuthCodeVo = shopService.getMgtShopAuthCode(mgtShopAuthGetDto.getAuthId()); + return R.ok(mgtShopAuthCodeVo); + } + + @RequestMapping(value = "/mgtAddProfitSharingReceiver", method = RequestMethod.POST) + @Log(title = "商户进件管理", businessType = BusinessType.UPDATE,operContent = "商户添加分账方") + @ApiOperation(value = "平台商户添加分账方") + public R mgtAddProfitSharingReceiver(@RequestBody MgtShopAuthGetDto mgtShopAuthGetDto){ + Long userId = SecurityUtils.getUserId(); + mgtShopAuthGetDto.setUserId(userId); + shopService.addProfitSharingReceiver(mgtShopAuthGetDto); + return R.ok(); + } + + + @RequestMapping(value = "/pageMgtShopHFTXAuth", method = RequestMethod.POST) + @ApiOperation(value = "分页获取商户进件列表(汇付天下)") + public R<Page<MgtShopHFTXAuthPageVo>> pageMgtShopHFTXAuth(@RequestBody MgtShopHFTXAuthPageDto mgtShopAuthPageDto) { + // 获取当前登陆人的可视权限 + SysUser sysUser = SecurityUtils.getSysUser(); + // 店铺ids + List<Long> scope = new ArrayList<>(); + if (sysUser!=null){ + String dataScope = sysUser.getDataScope(); + if (!sysUser.getUserName().equals("admin")){ + if (org.springframework.util.StringUtils.hasLength(dataScope)){ + switch (dataScope){ + case "3": + // 本部门数据 查询当前登陆人属于哪个部门 查询这个部门下所有员工关联的所有店铺 + // 根据用户id 查询同部门下所有员工id + List<Long> userIds = sysUserService.getUserIdsByDept(sysUser.getUserId()).getData(); + // 店铺ids + List<Long> data = shopService.list(new QueryWrapper<Shop>() + .in("belong_user_id", userIds) + .eq("del_flag", 0)) + .stream().map(Shop::getShopId).collect(Collectors.toList()); + if (data.size()==0){ + scope.add(0L); + }else{ + scope.addAll(data); + } + break; + case "5": + // 仅个人数据 查询当前登陆人关联店铺下的用户 + List<Long> longs = new ArrayList<>(); + longs.add(sysUser.getUserId()); + // 获取店铺ids + List<Long> data1 = shopService.list(new QueryWrapper<Shop>() + .in("belong_user_id", longs) + .eq("del_flag", 0)) + .stream().map(Shop::getShopId).collect(Collectors.toList()); + if (data1.size()==0){ + scope.add(0L); + }else{ + scope.addAll(data1); + } + break; + } + } + } + } + Page<MgtShopHFTXAuthPageVo> page = new Page<>(); + page.setSize(mgtShopAuthPageDto.getPageSize()); + page.setCurrent(mgtShopAuthPageDto.getPageNum()); + List<MgtShopHFTXAuthPageVo> mgtShopHFTXAuthPageVos = shopService.pageMgtShopHFTXAuth(page, mgtShopAuthPageDto,scope); + return R.ok(page.setRecords(mgtShopHFTXAuthPageVos)); + } + + + @RequestMapping(value = "/mgtShopHFTXAuth", method = RequestMethod.POST) + @Log(title = "商户进件管理", businessType = BusinessType.UPDATE,operContent = "商户进件") + @ApiOperation(value = "平台商户进件(汇付天下)") + public R mgtShopHFTXAuth(@RequestBody MgtShopHFTXAuthDto mgtShopHFTXAuthDto) { + Long userId = SecurityUtils.getUserId(); + mgtShopHFTXAuthDto.setUserId(userId); + shopService.mgtShopHFTXAuth(mgtShopHFTXAuthDto); + return R.ok(); + } + + + @RequestMapping(value = "/merchantBasicdataNotify", method = RequestMethod.POST) + @Log(title = "商户进件回调通知(汇付天下)", businessType = BusinessType.UPDATE,operContent = "商户进件") + public void merchantBasicdataNotify(MerchantBasicDataNotifyDto dto, HttpServletResponse response){ + R<String> r = shopService.merchantBasicdataNotify(dto); + if(r.getCode() == 200){ + response.setStatus(200); + PrintWriter out = null; + try { + out = response.getWriter(); + out.print("RECV_ORD_ID_" + r.getData()); + out.flush(); + } catch (IOException e) { + e.printStackTrace(); + }finally { + out.close(); + } + } + } + + + + + @RequestMapping(value = "/getMgtShopHFTXAuthInfo", method = RequestMethod.POST) + @ApiOperation(value = "获取商户进件信息(汇付天下)") + public R<MgtShopHFTXAuthGetVo> getMgtShopHFTXAuthInfo(@Validated @RequestBody MgtShopHFTXAuthGetDto mgtShopHFTXAuthGetDto){ + MgtShopHFTXAuthGetVo mgtShopHFTXAuthInfo = shopService.getMgtShopHFTXAuthInfo(mgtShopHFTXAuthGetDto.getShopId()); + return R.ok(mgtShopHFTXAuthInfo); + } + + + @RequestMapping(value = "/setMgtShopShareRatio", method = RequestMethod.POST) + @ApiOperation(value = "设置分账比例(汇付天下)") + public R setMgtShopShareRatio(@Validated @RequestBody MgtShopShareRatioSetDto mgtShopShareRatioSetDto){ + return shopService.setMgtShopShareRatio(mgtShopShareRatioSetDto); + } + + + @RequestMapping(value = "/getMerchantBasicDataSettlement", method = RequestMethod.POST) + @ApiOperation(value = "获取提现记录(汇付天下)") + public R<List<MerchantBasicdataSettlementVo>> getMerchantBasicDataSettlement(@Validated @RequestBody MerchantBasicdataSettlementDto mgtShopShareRatioSetDto){ + return shopService.getMerchantBasicDataSettlement(mgtShopShareRatioSetDto); + } + + + @RequestMapping(value = "/getBankList", method = RequestMethod.POST) + @ApiOperation(value = "获取银行列表(汇付天下)") + public R<List<Map<String, String>>> getBankList(@Validated @RequestBody BankListGetDto dto){ + List<Map<String, String>> bankList = bankBranchCodeService.getBankList(dto.getName()); + return R.ok(bankList); + } + + + @RequestMapping(value = "/getBankBranchCode", method = RequestMethod.POST) + @ApiOperation(value = "获取银行分行列表(汇付天下)") + public R<List<Map<String, String>>> getBankBranchCode(@Validated @RequestBody BankBranchCodeGetDto dto){ + List<Map<String, String>> bankBranchCode = bankBranchCodeService.getBankBranchCode(dto.getBankNumber()); + return R.ok(bankBranchCode); + } } -- Gitblit v1.7.1