From 07fb617c686699435cde29e8147f11a125d7d618 Mon Sep 17 00:00:00 2001 From: huliguo <2023611923@qq.com> Date: 星期一, 23 六月 2025 11:10:12 +0800 Subject: [PATCH] bug修改 --- ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/business/MerShopController.java | 231 +++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 189 insertions(+), 42 deletions(-) diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/business/MerShopController.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/business/MerShopController.java index d10738d..25a399c 100644 --- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/business/MerShopController.java +++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/business/MerShopController.java @@ -1,23 +1,37 @@ package com.ruoyi.shop.controller.business; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.*; +import com.ruoyi.shop.domain.pojo.shop.ShopRelUser; import com.ruoyi.shop.domain.vo.*; import com.ruoyi.shop.service.shop.*; -import com.ruoyi.system.api.domain.dto.*; +import com.ruoyi.system.api.domain.dto.MerBaseDto; +import com.ruoyi.system.api.domain.dto.MerBaseGetDto; +import com.ruoyi.system.api.domain.dto.MerEditUserDto; +import com.ruoyi.system.api.domain.dto.MerPageDto; +import com.ruoyi.system.api.domain.poji.shop.Shop; +import com.ruoyi.system.api.domain.poji.shop.ShopAppointableTime; +import com.ruoyi.system.api.domain.poji.shop.ShopNonAppointableTime; import com.ruoyi.system.api.domain.vo.MerHomeShopTotalVo; import com.ruoyi.system.api.domain.vo.MerStaffInfoVo; +import com.ruoyi.system.api.domain.vo.MgtSimpleShopVo; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -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 org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import java.time.format.DateTimeFormatter; +import java.util.Comparator; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * @author jqs34 @@ -32,31 +46,40 @@ public class MerShopController { - @Autowired + @Resource private ShopService shopService; - @Autowired + @Resource private ShopCertificateService shopCertificateService; - - @Autowired + + @Resource private ShopStaffService shopStaffService; - - @Autowired - private RecommendCooperationService recommendCooperationService; - - @Autowired + + @Resource + private ShopRelUserService shopRelUserService; + + @Resource private ShopSuggestService shopSuggestService; - + + @Resource + private ShopNonAppointableTimeService shopNonAppointableTimeService; + + @Resource + private ShopAppointableTimeService shopAppointableTimeService; + + /** * 未完成实际统计 + * * @param merBaseDto * @return */ @RequestMapping(value = "/getMerHomeTotal", method = RequestMethod.POST) - @ApiOperation(value = "获取商户端商业统计") + @ApiOperation(value = "获取商户端商业统计【2.0】") public R<MerHomeShopTotalVo> getMerHomeTotal(@RequestBody MerBaseDto merBaseDto) { Long userId = SecurityUtils.getUserId(); - MerHomeShopTotalVo merHomeShopTotalVo = shopService.getMerHomeTotal(userId); + merBaseDto.setUserId(userId); + MerHomeShopTotalVo merHomeShopTotalVo = shopService.getMerHomeTotal(merBaseDto); return R.ok(merHomeShopTotalVo); } @@ -95,12 +118,16 @@ shopCertificateService.deleteShopCertificate(Long.valueOf(merBaseGetDto.getId())); return R.ok(); } - + @RequestMapping(value = "/getShopStaffInfo", method = RequestMethod.POST) - @ApiOperation(value = "获取员工信息") - public R<MerStaffInfoVo> getShopStaffInfo() { + @ApiOperation(value = "获取员工信息【2.0】") + @ApiImplicitParams({ + @ApiImplicitParam(value = "当前商户id", name = "shopId", required = true, dataType = "Long", paramType = "query") + }) + public R<MerStaffInfoVo> getShopStaffInfo(@RequestParam("shopId") Long shopId) { Long userId = SecurityUtils.getUserId(); - MerStaffInfoVo merStaffInfoVo = shopStaffService.getShopStaffInfo(userId); + Shop shop = shopService.getByShopId(shopId); + MerStaffInfoVo merStaffInfoVo = shopStaffService.getShopStaffInfo(userId, shop); return R.ok(merStaffInfoVo); } @@ -108,30 +135,21 @@ @ApiOperation(value = "修改员工信息") public R editShopStaffInfo(@RequestBody MerEditUserDto merEditUserDto) { Long userId = SecurityUtils.getUserId(); - shopStaffService.editShopStaffInfo(merEditUserDto); + merEditUserDto.setUserId(userId); + if(merEditUserDto.getEditType()!=5){ + shopStaffService.editShopStaffInfo(merEditUserDto); + }else{ + Shop shop = shopService.getByShopId(merEditUserDto.getShopId()); + String editValue = merEditUserDto.getEditValue(); + String[] editArr = editValue.split("-"); + shop.setBusinessStartTime(editArr[0]); + shop.setBusinessEndTime(editArr[1]); + shopService.saveOrUpdate(shop); + } return R.ok(); } - @RequestMapping(value = "/pageMerShopRecommend", method = RequestMethod.POST) - @ApiOperation(value = "分页获取商户推荐列表") - public R<Page<MerShopRecommendPageVo>> pageMerShopRecommend(@RequestBody MerShopRecommendPageDto merShopRecommendPageDto) { - Long userId = SecurityUtils.getUserId(); - merShopRecommendPageDto.setUserId(userId); - Page<MerShopRecommendPageVo> page = new Page<>(); - page.setSize(merShopRecommendPageDto.getPageSize()); - page.setCurrent(merShopRecommendPageDto.getPageNum()); - List<MerShopRecommendPageVo> merShopRecommendPageVoList = recommendCooperationService.pageMerShopRecommend(page,merShopRecommendPageDto); - return R.ok(page.setRecords(merShopRecommendPageVoList)); - } - @RequestMapping(value = "/recommendCooperation", method = RequestMethod.POST) - @ApiOperation(value = "推荐合作") - public R recommendCooperation(@RequestBody MerRecommendCooperationDto merRecommendCooperationDto) { - Long userId = SecurityUtils.getUserId(); - merRecommendCooperationDto.setUserId(userId); - recommendCooperationService.recommendCooperation(merRecommendCooperationDto); - return R.ok(); - } @RequestMapping(value = "/pageMerShopSuggest", method = RequestMethod.POST) @ApiOperation(value = "分页获取商户建议") @@ -153,4 +171,133 @@ shopSuggestService.suggest(merShopSuggestDto); return R.ok(); } + + + @RequestMapping(value = "/listShopByShop", method = RequestMethod.POST) + @ApiOperation(value = "获取商户下属代理商") + public R<List<MgtSimpleShopVo>> listShopByShop(@RequestBody MerBaseDto merBaseDto) { + List<MgtSimpleShopVo> mgtShopListSimpleVos = shopService.listShopByShop(merBaseDto.getShopId()); + return R.ok(mgtShopListSimpleVos); + } + + + @RequestMapping(value = "/getShopMerchantBasicDataSettlement", method = RequestMethod.POST) + @ApiOperation(value = "获取提现记录(汇付天下)") + public R<List<MerchantBasicdataSettlementVo>> getMerchantBasicDataSettlement(@Validated @RequestBody MerchantBasicdataSettlementDto mgtShopShareRatioSetDto) { + return shopService.getMerchantBasicDataSettlement(mgtShopShareRatioSetDto); + } + + @RequestMapping(value = "/getUserShopList", method = RequestMethod.POST) + @ApiOperation(value = "获取切换门店列表【2.0】") + public R<List<Shop>> getUserShopList() { + List<ShopRelUser> shopRelUsers = shopRelUserService.getByUserId(SecurityUtils.getUserId()); + shopRelUsers.sort(Comparator.comparing(ShopRelUser::getIsDefault)); + List<Shop> collect = shopRelUsers.stream().map(shopRelUser -> { + Shop shop = shopService.getById(shopRelUser.getShopId()); + return shop; + }).collect(Collectors.toList()); + return R.ok(collect); + } + + + @RequestMapping(value = "/getShopReservationConfig/{shopId}", method = RequestMethod.POST) + @ApiOperation(value = "获取门店预约管理配置【2.0】") + public R<ShopReservationConfigVo> getShopReservationConfig(@PathVariable("shopId") Long shopId) { + Shop shop = shopService.getById(shopId); + Integer subscribe = shop.getSubscribe(); + ShopReservationConfigVo vo = new ShopReservationConfigVo(); + vo.setSubscribe(subscribe); + List<ShopNonAppointableTime> list = shopNonAppointableTimeService.list(new LambdaQueryWrapper<ShopNonAppointableTime>().eq(ShopNonAppointableTime::getShopId, shopId) + .orderByAsc(ShopNonAppointableTime::getNonAppointableStartTime)); + vo.setUnsubscribeTime(list.stream().map(shopNonAppointableTime -> { + Map<String, String> map = new HashMap<>(); + String time = shopNonAppointableTime.getNonAppointableStartTime().format(DateTimeFormatter.ofPattern("MM月dd日 HH:mm")) + "-" + shopNonAppointableTime.getNonAppointableEndTime().format(DateTimeFormatter.ofPattern("HH:mm")); + map.put("time", time); + map.put("id", shopNonAppointableTime.getId()); + return map; + }).collect(Collectors.toList())); + return R.ok(vo); + } + + @RequestMapping(value = "/addShopNonAppointableTime", method = RequestMethod.POST) + @ApiOperation(value = "门店添加不可预约时间段【2.0】") + public R addShopNonAppointableTime(@RequestBody ShopNonAppointableTimeDto dto) { + ShopNonAppointableTime shopNonAppointableTime = new ShopNonAppointableTime(); + shopNonAppointableTime.setShopId(dto.getShopId()); + shopNonAppointableTime.setNonAppointableStartTime(dto.getNonAppointableStartTime()); + shopNonAppointableTime.setNonAppointableEndTime(dto.getNonAppointableEndTime()); + shopNonAppointableTimeService.save(shopNonAppointableTime); + return R.ok(); + } + + + @RequestMapping(value = "/switchAppointment/{shopId}/{subscribe}", method = RequestMethod.POST) + @ApiOperation(value = "开关门店预约配置【2.0】") + @ApiImplicitParams({ + @ApiImplicitParam(value = "门店id", name = "shopId", required = true, dataType = "Long", paramType = "path"), + @ApiImplicitParam(value = "预约开关(0=关,1=开)", name = "subscribe", required = true, dataType = "Integer", paramType = "path") + }) + public R switchAppointment(@PathVariable("shopId") Long shopId, @PathVariable("subscribe") Integer subscribe) { + Shop shop = shopService.getById(shopId); + shop.setSubscribe(subscribe); + shopService.updateById(shop); + return R.ok(); + } + + @RequestMapping(value = "/getShopAppointableTimeList", method = RequestMethod.POST) + @ApiOperation(value = "商户获取预约列表【2.0】") + public R<Page<ShopAppointableTimeListVo>> getShopAppointableTimeList(@RequestBody ShopAppointableTimeListDto dto) { + Page<ShopAppointableTimeListVo> page = new Page<>(); + page.setSize(dto.getPageSize()); + page.setCurrent(dto.getPageNum()); + List<ShopAppointableTimeListVo> shopAppointableTimeList = shopAppointableTimeService.getShopAppointableTimeList(page, dto); + return R.ok(page.setRecords(shopAppointableTimeList)); + } + + + @RequestMapping(value = "/confirmReservation/{id}", method = RequestMethod.POST) + @ApiOperation(value = "商户确认预约【2.0】") + public R confirmReservation(@PathVariable("id") String id) { + ShopAppointableTime shopAppointableTime = shopAppointableTimeService.getById(id); + if (null == shopAppointableTime) { + return R.fail("预约不存在"); + } + if (1 != shopAppointableTime.getStatus()) { + return R.fail("确认预约失败"); + } + shopAppointableTime.setStatus(2); + shopAppointableTimeService.updateById(shopAppointableTime); + return R.ok(); + } + + + @RequestMapping(value = "/cancelReservation", method = RequestMethod.POST) + @ApiOperation(value = "商户取消预约【2.0】") + public R cancelReservation(@RequestBody CancelReservationDto dto) { + ShopAppointableTime shopAppointableTime = shopAppointableTimeService.getById(dto.getId()); + if (null == shopAppointableTime) { + return R.fail("预约不存在"); + } + if (0 == shopAppointableTime.getStatus()) { + return R.fail("不能重复操作"); + } + shopAppointableTime.setStatus(0); + shopAppointableTime.setReason(dto.getReason()); + shopAppointableTimeService.updateById(shopAppointableTime); + return R.ok(); + } + + @RequestMapping(value = "/getMyShopList", method = RequestMethod.POST) + @ApiOperation(value = "获取当前账户可切换的门店列表【2.0】") + public R<List<Shop>> getMyShopList() { + Long userId = SecurityUtils.getUserId(); + List<ShopRelUser> shopRelUser = shopRelUserService.getByUserId(userId); + List<Shop> collect = shopRelUser.stream().map(e -> { + Shop shop = shopService.getById(e.getShopId()); + return shop; + }).collect(Collectors.toList()); + return R.ok(collect); + } + + } -- Gitblit v1.7.1