From f2070facdb5715e7349df69cfe257289c680d292 Mon Sep 17 00:00:00 2001 From: huliguo <2023611923@qq.com> Date: 星期三, 23 四月 2025 18:12:46 +0800 Subject: [PATCH] 前端联调 --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java | 86 ++++++++++++++++++++++++++++--------------- 1 files changed, 56 insertions(+), 30 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java index 666e57f..076abfc 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java @@ -223,41 +223,57 @@ @PutMapping("/editShop") @ApiOperation(value = "门店管理-编辑门店", tags = {"管理后台-门店管理"}) public R<Void> editShop(@RequestBody Shop shop){ - //修改店长 + + //判断是否修改店长 + Shop byId = shopService.getById(shop.getId()); + String phone = shop.getPhone(); - AppUser appUser = appUserClient.getAppUserByPhone1(phone).getData(); - if (appUser == null){ - return R.fail("该手机号未注册"); + if (!phone.equals(byId.getPhone())){ + //修改店长 + AppUser appUser = appUserClient.getAppUserByPhone1(phone).getData(); + if (appUser == null){ + return R.fail("该手机号未注册"); + } + + Long originalUserId = byId.getAppUserId(); + //添加用户id到shop信息中 + shop.setAppUserId(appUser.getId()); + //删除店铺关系 + R deleteR = appUserShopClient.delete(shop.getId(), originalUserId); + if (deleteR.getCode()!=200){ + throw new RuntimeException("删除用户门店关系失败"); + } + //添加shopuser + AppUserShop appUserShop = new AppUserShop(); + appUserShop.setAppUserId(appUser.getId()); + appUserShop.setShopId(shop.getId()); + R appUserShopR = appUserShopClient.insert(appUserShop); + if (appUserShopR.getCode()!=200){ + throw new RuntimeException("添加用户门店关系失败"); + } + } - Long originalUserId = shop.getAppUserId(); - //添加用户id到shop信息中 - shop.setAppUserId(appUser.getId()); - //删除店铺关系 - R deleteR = appUserShopClient.delete(shop.getId(), originalUserId); - if (deleteR.getCode()!=200){ - throw new RuntimeException("删除用户门店关系失败"); - } + + //删除客服电话 QueryWrapper<Phone> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("shop_id", shop.getId()); - phoneService.remove(queryWrapper); + Phone one = phoneService.getOne(queryWrapper); + if (!one.getPhoneOne().equals(shop.getServiceTel())){ + phoneService.removeById(one.getId()); + //添加客服phone + Phone phone1 = new Phone(); + phone1.setType(2);//门店 + phone1.setPhoneOne(shop.getServiceTel()); + phone1.setShopId(shop.getId()); + phoneService.save(phone1); + } + //修改店铺 shopService.updateById(shop); - //添加shopuser - AppUserShop appUserShop = new AppUserShop(); - appUserShop.setAppUserId(appUser.getId()); - appUserShop.setShopId(shop.getId()); - R appUserShopR = appUserShopClient.insert(appUserShop); - if (appUserShopR.getCode()!=200){ - throw new RuntimeException("添加用户门店关系失败"); - } - //添加客服phone - Phone phone1 = new Phone(); - phone1.setType(2);//门店 - phone1.setPhoneOne(shop.getServiceTel()); - phone1.setShopId(shop.getId()); - phoneService.save(phone1); + + return R.ok(); } @@ -637,9 +653,9 @@ /** * 获取所有门店 */ - @PostMapping("/getAllShop") + @GetMapping("/getAllShop") public R<List<Shop>> getAllShop(){ - List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>().eq(Shop::getDelFlag, 0)); + List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>().select(Shop::getName,Shop::getId).eq(Shop::getDelFlag, 0)); return R.ok(list); } @@ -680,6 +696,16 @@ List<ReceiverBankChannel> list = receiverBankChannelService.list(new LambdaQueryWrapper<ReceiverBankChannel>() .like(ReceiverBankChannel::getName, name)); return R.ok(list); + } + + @GetMapping("/getServiceProvider") + R<List<String>> getServiceProvider(@RequestParam("appUserId") Long appUserId){ + LambdaQueryWrapper<Shop> queryWrapper=new LambdaQueryWrapper<>(); + queryWrapper.eq(Shop::getAppUserId, appUserId); + queryWrapper.eq(Shop::getDelFlag,0); + List<Shop> shops = shopMapper.selectList(queryWrapper); + List<String> collect = shops.stream().map(Shop::getName).distinct().collect(Collectors.toList()); + return R.ok(collect); } @@ -734,7 +760,7 @@ @GetMapping("/getBalanceList") @ApiOperation(value = "门店余额列表", tags = {"后台-财务统计-余额列表"}) - R<PageInfo<ShopBalanceListVO>> getBalanceList(@ApiParam("门店名称")@RequestParam("name") String name, + R<PageInfo<ShopBalanceListVO>> getBalanceList(@ApiParam("门店名称")@RequestParam(value = "name",required = false) String name, @ApiParam("当前页")@RequestParam("pageCurr") Integer pageCurr, @ApiParam("分页大小")@RequestParam("pageSize") Integer pageSize){ PageInfo<ShopBalanceListVO> pageInfo=shopService.getBalanceList(name,pageCurr,pageSize); -- Gitblit v1.7.1