1.完善swagger配置配置信息
2.shop实体类添加字段:1.封面图 2.详情图
3.添加购物车实体类、mapper、service、controller
| | |
| | | @TableField("custom_order_number") |
| | | private Integer customOrderNumber; |
| | | |
| | | @ApiModelProperty(value = "总评分") |
| | | @TableField("score") |
| | | private Integer score; |
| | | |
| | | @ApiModelProperty(value = "评分数量") |
| | | @TableField("score_number") |
| | | private Integer scoreNumber; |
| | | |
| | | @ApiModelProperty(value = "删除(0=否,1=是)") |
| | | @TableField("del_flag") |
| | | @TableLogic |
New file |
| | |
| | | package com.ruoyi.other.api.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_goods_evaluate") |
| | | @ApiModel(value="GoodsEvaluate对象", description="") |
| | | public class TechnicianScore implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | @ApiModelProperty(value = "主键") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "app_user_id") |
| | | private Long appUserId; |
| | | |
| | | @ApiModelProperty(value = "技师id") |
| | | private Long technicianId; |
| | | |
| | | @ApiModelProperty(value = "评分") |
| | | private BigDecimal score; |
| | | |
| | | @ApiModelProperty(value = "添加时间") |
| | | private LocalDateTime createTime; |
| | | } |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/user-point") |
| | | @Api("用户积分") |
| | | public class UserPointController { |
| | | |
| | | /** |
| | | * 积分 |
| | | */ |
| | | } |
| | | |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.model.Agreement; |
| | | import com.ruoyi.other.service.IAgreementService; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "类型(1=用户协议,2=隐私协议,3=技师上门免责声明,4=注销协议,5门店提现免责声明)", name = "type", required = true, dataType = "int"), |
| | | }) |
| | | public AjaxResult<String> getAgreement(@PathVariable("type") Integer type){ |
| | | public R<String> getAgreement(@PathVariable("type") Integer type){ |
| | | Agreement one = agreementService.getOne(new LambdaQueryWrapper<Agreement>().eq(Agreement::getType, type)); |
| | | return AjaxResult.success(null == one ? "" : one.getContent()); |
| | | return R.ok(null == one ? "" : one.getContent()); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.GoodsCategory; |
| | | import com.ruoyi.other.service.GoodsCategoryService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "商品分类列表", tags = {"小程序-商城-商城-首页-筛选"}) |
| | | public AjaxResult list(){ |
| | | return AjaxResult.success(goodsCategoryService.list()); |
| | | public R<List<GoodsCategory>> list(){ |
| | | return R.ok(goodsCategoryService.list()); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.service.GoodsService; |
| | | import com.ruoyi.other.vo.GoodsVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | return getDataTable(goodsService.goodsList(goods)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 指定门店商品 |
| | | */ |
| | | @GetMapping("/getGoodsListByShopId") |
| | | @ApiOperation(value = "商品列表", tags = {"小程序-首页-门店详情-商品购买列表"}) |
| | | public TableDataInfo getGoodsListByShopId(@ApiParam("门店id") @RequestParam Integer shopId) { |
| | | startPage(); |
| | | List<Goods> goods = goodsService.getGoodsListByShopId(shopId); |
| | | return getDataTable(goods); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 商品详情 |
| | | */ |
| | | @GetMapping("/goodsDetail/{goodsId}") |
| | | @ApiOperation(value = "商品详情", tags = {"小程序-商城-首页-商品详情"}) |
| | | public AjaxResult goodsDetail(@PathVariable("goodsId") Long goodsId){ |
| | | return success(goodsService.goodsDetail(goodsId)); |
| | | public R<GoodsVO> goodsDetail(@PathVariable("goodsId") Long goodsId){ |
| | | return R.ok(goodsService.goodsDetail(goodsId)); |
| | | } |
| | | |
| | | |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.other.api.domain.Phone; |
| | | import com.ruoyi.other.enums.PhoneType; |
| | | import com.ruoyi.other.service.PhoneService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/phone") |
| | | public class PhoneController { |
| | | @Api("手机") |
| | | public class PhoneController extends BaseController { |
| | | @Resource |
| | | private PhoneService phoneService; |
| | | |
| | | /** |
| | | * 查询指定门店手机号 |
| | | */ |
| | | @RequestMapping("/selectPhoneByShopId") |
| | | @ApiOperation(value = "查询指定门店手机号", tags = {"小程序-门店详情"}) |
| | | public R<List<Phone>> getPhoneByShopId(@ApiParam("门店id") @RequestParam Integer shopId) { |
| | | return R.ok(phoneService.list(new LambdaQueryWrapper<Phone>() |
| | | .eq(Phone::getType, PhoneType.SHOP.getCode()) |
| | | .eq(Phone::getShopId, shopId))); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.other.enums.ShareAddType; |
| | | import com.ruoyi.other.api.domain.Share; |
| | | import com.ruoyi.other.enums.ShareAddType; |
| | | import com.ruoyi.other.enums.ShareAuditStatus; |
| | | import com.ruoyi.other.service.ShareService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @ApiImplicitParam(value = "对象id(addType=1:平台添加,addType=2:推广人添加,addType=3:门店添加)", name = "objectId", required = true, dataType = "int"), |
| | | }) |
| | | @GetMapping("/list") |
| | | public AjaxResult list(@RequestParam Integer objectId){ |
| | | return AjaxResult.success(shareService.list(new LambdaQueryWrapper<Share>() |
| | | public R<List<Share>> list(@RequestParam Integer objectId){ |
| | | return R.ok(shareService.list(new LambdaQueryWrapper<Share>() |
| | | .eq(Share::getObjectId, objectId))); |
| | | } |
| | | |
| | |
| | | */ |
| | | @ApiOperation(value = "小程序-个人中心-门店管理-分享添加", tags = {"分享添加-小程序"}) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody Share share){ |
| | | public R<Void> add(@RequestBody Share share){ |
| | | share.setAddType(ShareAddType.STORE.getCode()); |
| | | share.setAuditStatus(ShareAuditStatus.WAIT.getCode()); |
| | | share.setDelFlag(0); |
| | | share.setAppletShare(1); |
| | | return toAjax(shareService.save(share)); |
| | | shareService.save(share); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @ApiOperation(value = "分享删除", tags = {"小程序-个人中心-门店管理-分享删除-小程序"}) |
| | | @DeleteMapping |
| | | public AjaxResult delete(@RequestBody Share share){ |
| | | return toAjax(shareService.removeById(share)); |
| | | public R<Void> delete(@RequestBody Share share){ |
| | | shareService.removeById(share); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @ApiOperation(value = "分享编辑", tags = {"小程序-个人中心-门店管理-分享编辑-小程序"}) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody Share share){ |
| | | public R<Void> edit(@RequestBody Share share){ |
| | | share.setAuditStatus(ShareAuditStatus.WAIT.getCode()); |
| | | return toAjax(shareService.updateById(share)); |
| | | shareService.updateById(share); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @ApiOperation(value = "分享详情", tags = {"小程序-个人中心-门店管理-分享详情-小程序"}) |
| | | @GetMapping("/detail/{id}") |
| | | public AjaxResult detail(@PathVariable("id") Integer id){ |
| | | return AjaxResult.success(shareService.getById(id)); |
| | | public R<Void> detail(@PathVariable("id") Integer id){ |
| | | shareService.getById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.domain.Technician; |
| | | import com.ruoyi.other.enums.ShopStatus; |
| | | import com.ruoyi.other.service.ShopService; |
| | | import com.ruoyi.other.service.TechnicianService; |
| | | import com.ruoyi.other.vo.NearbyShopVO; |
| | | import com.ruoyi.other.vo.ShopDetailVO; |
| | | import com.ruoyi.other.vo.VerifiableShopVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | |
| | | */ |
| | | @GetMapping("/nearbyShopList") |
| | | @ApiOperation(value = "附近门店列表", tags = {"小程序-首页-附近门店列表"}) |
| | | public AjaxResult nearbyShopList(@ApiParam("经度") @RequestParam String longitude, |
| | | @ApiParam("纬度") @RequestParam String latitude){ |
| | | return success(shopService.nearbyShopList(longitude,latitude)); |
| | | public R<List<NearbyShopVO>> nearbyShopList(@ApiParam("经度") @RequestParam String longitude, |
| | | @ApiParam("纬度") @RequestParam String latitude) { |
| | | return R.ok(shopService.nearbyShopList(longitude, latitude)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 指定门店技师列表 |
| | | * 门店详情 |
| | | */ |
| | | @GetMapping("/technicianList") |
| | | @ApiOperation(value = "技师列表", tags = {"技师列表-小程序"}) |
| | | public AjaxResult technicianList(@ApiParam("门店id") @RequestParam String shopId){ |
| | | return success(technicianService.list(new LambdaQueryWrapper<Technician>() |
| | | .eq(Technician::getShopId,shopId) |
| | | .eq(Technician::getStatus,2) |
| | | .eq(Technician::getSubscribeStatus,1))); |
| | | @GetMapping("/shopDetail") |
| | | @ApiOperation(value = "门店详情", tags = {"门店详情-小程序"}) |
| | | public R<ShopDetailVO> shopDetail(@ApiParam("门店id") @RequestParam Integer shopId, |
| | | @ApiParam("经度") @RequestParam String longitude, |
| | | @ApiParam("纬度") @RequestParam String latitude) { |
| | | return R.ok(shopService.getShopDetail(shopId, longitude, latitude)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/shopByUser") |
| | | @ApiOperation(value = "查询当前店长所属门店", tags = {"小程序-个人中心-首页-关联门店列表"}) |
| | | public AjaxResult shopByUser(){ |
| | | public R<List<Shop>> shopByUser() { |
| | | List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>() |
| | | .eq(Shop::getAppUserId, SecurityUtils.getUserId()) |
| | | .eq(Shop::getStatus, ShopStatus.SHOP_STATUS_NORMAL.getCode())); |
| | | return success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/bindShop") |
| | | @ApiOperation(value = "绑定门店", tags = {"小程序-个人中心-绑定门店"}) |
| | | public AjaxResult bindShop(@ApiParam("门店id") @RequestParam Long shopId){ |
| | | public R<Void> bindShop(@ApiParam("门店id") @RequestParam Long shopId) { |
| | | AppUser appUser = appUserClient.getAppUserById(SecurityUtils.getUserId()); |
| | | appUser.setShopId(shopId); |
| | | appUserClient.editAppUserById(appUser); |
| | | return success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | |
| | | @ResponseBody |
| | | @GetMapping("/getVerifiableShop") |
| | | @ApiOperation(value = "获取可核销门店列表", tags = {"购物车-小程序"}) |
| | | public AjaxResult<List<VerifiableShopVo>> getVerifiableShop(){ |
| | | public R<List<VerifiableShopVo>> getVerifiableShop(){ |
| | | // todo 待完善 pu |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.other.service.TechnicianService; |
| | | import com.ruoyi.other.vo.TechnicianDetailVO; |
| | | import com.ruoyi.other.vo.TechnicianVO; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/technician") |
| | | public class TechnicianController { |
| | | public class TechnicianController extends BaseController { |
| | | @Resource |
| | | private TechnicianService technicianService; |
| | | |
| | | /** |
| | | * 指定门店技师列表 |
| | | */ |
| | | @GetMapping("/technicianListByShopId") |
| | | @ApiOperation(value = "技师列表", tags = {"技师列表-小程序"}) |
| | | public R<List<TechnicianVO>> technicianListByShopId(@ApiParam("门店id") @RequestParam Long shopId) { |
| | | return R.ok(technicianService.getTechnicianListByShopId(shopId)); |
| | | } |
| | | |
| | | /** |
| | | * 技师详情 |
| | | */ |
| | | @GetMapping("/technicianDetail") |
| | | @ApiOperation(value = "技师详情", tags = {"技师详情-小程序"}) |
| | | public R<TechnicianDetailVO> technicianDetail(@ApiParam("技师id") @RequestParam Long technicianId) { |
| | | return R.ok(technicianService.technicianDetail(technicianId)); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.domain.TechnicianSubscribe; |
| | |
| | | */ |
| | | @GetMapping("/cancel") |
| | | @ApiOperation(value = "取消服务", notes = "取消服务", tags = {"小程序-个人中心-门店管理-预约列表-取消服务"}) |
| | | public AjaxResult cancel(@ApiParam(value = "预约id") @RequestParam Long id){ |
| | | public R<Void> cancel(@ApiParam(value = "预约id") @RequestParam Long id){ |
| | | |
| | | TechnicianSubscribe subscribe = technicianSubscribeService.getOne(new LambdaQueryWrapper<TechnicianSubscribe>() |
| | | .eq(TechnicianSubscribe::getId, id) |
| | | .eq(TechnicianSubscribe::getStatus, 0)); |
| | | if (null == subscribe){ |
| | | return error("不满足取消条件"); |
| | | return R.fail("不满足取消条件"); |
| | | } |
| | | subscribe.setStatus(2); |
| | | technicianSubscribeService.updateById(subscribe); |
| | | return success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.enums; |
| | | |
| | | public enum PhoneType { |
| | | PLATFORM(1, "平台"), |
| | | SHOP(2, "门店"); |
| | | |
| | | private Integer code; |
| | | private String desc; |
| | | |
| | | PhoneType(Integer code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public Integer getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface GoodsMapper extends BaseMapper<Goods> { |
| | | |
| | | List<Goods> selectListByShopId(Integer shopId); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.vo.NearbyShopVO; |
| | | import com.ruoyi.other.vo.ShopDetailVO; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | public interface ShopMapper extends BaseMapper<Shop> { |
| | | |
| | | List<NearbyShopVO> selectNearbyShopList(String longitude, String latitude); |
| | | |
| | | ShopDetailVO selectShopDetail(Integer shopId); |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.Technician; |
| | | import com.ruoyi.other.vo.TechnicianDetailVO; |
| | | import com.ruoyi.other.vo.TechnicianVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TechnicianMapper extends BaseMapper<Technician> { |
| | | |
| | | List<TechnicianVO> selectTechnicianListByShopId(Long shopId); |
| | | |
| | | TechnicianDetailVO selectTechnicianDetail(Long technicianId); |
| | | |
| | | } |
| | |
| | | List<GoodsVO> goodsList(Goods goods); |
| | | |
| | | GoodsVO goodsDetail(Long goodsId); |
| | | |
| | | List<Goods> getGoodsListByShopId(Integer shopId); |
| | | } |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.vo.NearbyShopVO; |
| | | import com.ruoyi.other.vo.ShopDetailVO; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | public interface ShopService extends IService<Shop> { |
| | | |
| | | List<NearbyShopVO> nearbyShopList(String longitude, String latitude); |
| | | |
| | | ShopDetailVO getShopDetail(Integer shopId,String longitude, String latitude); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.Technician; |
| | | import com.ruoyi.other.vo.TechnicianDetailVO; |
| | | import com.ruoyi.other.vo.TechnicianVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface TechnicianService extends IService<Technician> { |
| | | List<TechnicianVO> getTechnicianListByShopId(Long shopId); |
| | | |
| | | TechnicianDetailVO technicianDetail(Long technicianId); |
| | | } |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | |
| | | import com.ruoyi.other.mapper.GoodsMapper; |
| | | import com.ruoyi.other.service.GoodsService; |
| | | import com.ruoyi.other.vo.GoodsVO; |
| | | import feignClient.RemoteOrderGoodsClient; |
| | | import model.OrderGood; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements GoodsService { |
| | | @Resource |
| | | private RemoteOrderGoodsClient orderGoodsClient; |
| | | private GoodsMapper goodsMapper; |
| | | |
| | | @Override |
| | | public List<GoodsVO> goodsList(Goods search) { |
| | |
| | | } |
| | | return new GoodsVO(); |
| | | } |
| | | |
| | | @Override |
| | | public List<Goods> getGoodsListByShopId(Integer shopId) { |
| | | return goodsMapper.selectListByShopId(shopId); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.GeodesyUtil; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.mapper.GoodsMapper; |
| | | import com.ruoyi.other.mapper.ShopMapper; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.service.ShopService; |
| | | import com.ruoyi.other.vo.NearbyShopVO; |
| | | import com.ruoyi.other.vo.ShopDetailVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.NoSuchElementException; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public List<NearbyShopVO> nearbyShopList(String longitude, String latitude) { |
| | | return shopMapper.selectNearbyShopList(longitude,latitude); |
| | | } |
| | | |
| | | @Override |
| | | public ShopDetailVO getShopDetail(Integer shopId, String longitude, String latitude) { |
| | | // 查询店铺详情 |
| | | ShopDetailVO shopDetailVO = shopMapper.selectShopDetail(shopId); |
| | | if (shopDetailVO == null) { |
| | | throw new ServiceException("查询店铺不存在"); |
| | | } |
| | | |
| | | // 计算距离 |
| | | String shopLocation = String.format("%s,%s", shopDetailVO.getLongitude(), shopDetailVO.getLatitude()); |
| | | String userLocation = String.format("%s,%s", longitude, latitude); |
| | | Map<String, Double> distanceMap = GeodesyUtil.getDistance(userLocation, shopLocation); |
| | | Double wGs84 = distanceMap.get("WGs84"); |
| | | shopDetailVO.setDistance(wGs84); |
| | | return shopDetailVO; |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.other.mapper.TechnicianMapper; |
| | | import com.ruoyi.other.api.domain.Technician; |
| | | import com.ruoyi.other.service.TechnicianService; |
| | | import com.ruoyi.other.vo.TechnicianDetailVO; |
| | | import com.ruoyi.other.vo.TechnicianVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Service |
| | | public class TechnicianServiceImpl extends ServiceImpl<TechnicianMapper, Technician> implements TechnicianService { |
| | | @Resource |
| | | private TechnicianMapper technicianMapper; |
| | | |
| | | @Override |
| | | public List<TechnicianVO> getTechnicianListByShopId(Long shopId) { |
| | | return technicianMapper.selectTechnicianListByShopId(shopId); |
| | | } |
| | | |
| | | @Override |
| | | public TechnicianDetailVO technicianDetail(Long technicianId) { |
| | | return technicianMapper.selectTechnicianDetail(technicianId); |
| | | } |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value="首页用户信息", description="") |
| | | public class Home { |
| | |
| | | * 评分 |
| | | */ |
| | | @ApiModelProperty(value = "评分") |
| | | private Integer score; |
| | | private BigDecimal score; |
| | | |
| | | /** |
| | | * 经度 |
| | |
| | | |
| | | @ApiModelProperty(value = "详细地址") |
| | | private String address; |
| | | |
| | | @ApiModelProperty(value = "距离") |
| | | private String distance; |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "门店详情") |
| | | public class ShopDetailVO { |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @ApiModelProperty(value = "主键") |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 门店名称 |
| | | */ |
| | | @ApiModelProperty(value = "门店名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "详情图,多个逗号分隔") |
| | | private String detailsPicture; |
| | | |
| | | @ApiModelProperty(value = "资质证书图片") |
| | | private String certification; |
| | | |
| | | @ApiModelProperty(value = "营业星期(1,2,3,4,5,6,7)") |
| | | private String businessDate; |
| | | |
| | | @ApiModelProperty(value = "开始时间(HH:mm)") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty(value = "结束时间(HH:mm)") |
| | | private String endTime; |
| | | |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | @ApiModelProperty(value = "联系电话") |
| | | private List<String> phones; |
| | | |
| | | /** |
| | | * 评分 |
| | | */ |
| | | @ApiModelProperty(value = "评分") |
| | | private BigDecimal score; |
| | | |
| | | /** |
| | | * 地址 |
| | | */ |
| | | @ApiModelProperty(value = "地址") |
| | | private String address; |
| | | |
| | | /** |
| | | * 距离 |
| | | */ |
| | | @ApiModelProperty(value = "距离") |
| | | private Double distance; |
| | | |
| | | @ApiModelProperty(value = "经度") |
| | | private String longitude; |
| | | |
| | | @ApiModelProperty(value = "纬度") |
| | | private String latitude; |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class TechnicianDetailVO { |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @ApiModelProperty(value = "主键") |
| | | private Long id; |
| | | |
| | | /** |
| | | * 技师姓名 |
| | | */ |
| | | @ApiModelProperty(value = "技师姓名") |
| | | private String name; |
| | | |
| | | /** |
| | | * 服务次数 |
| | | */ |
| | | @ApiModelProperty(value = "服务次数") |
| | | private Integer serviceCount; |
| | | |
| | | /** |
| | | * 评分 |
| | | */ |
| | | @ApiModelProperty(value = "评分") |
| | | private BigDecimal score; |
| | | |
| | | /** |
| | | * 简介 |
| | | */ |
| | | @ApiModelProperty(value = "简介") |
| | | private String introduction; |
| | | |
| | | /** |
| | | * 技师封面图 |
| | | */ |
| | | @ApiModelProperty(value = "技师封面图") |
| | | private String homePicture; |
| | | |
| | | @ApiModelProperty(value = "技师详情图") |
| | | private String infoPicture; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class TechnicianVO { |
| | | @ApiModelProperty(value = "主键") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "技师姓名") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "简介") |
| | | private String introduction; |
| | | |
| | | @ApiModelProperty(value = "服务次数") |
| | | private Integer serviceCount; |
| | | |
| | | @ApiModelProperty(value = "技师封面图") |
| | | private String homePicture; |
| | | |
| | | @ApiModelProperty(value = "评分") |
| | | private BigDecimal score; |
| | | } |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.other.mapper.GoodsMapper"> |
| | | |
| | | <select id="selectListByShopId" resultType="com.ruoyi.other.api.domain.Goods"> |
| | | SELECT |
| | | tg.id, |
| | | tg.`name`, |
| | | tg.type, |
| | | tg.introduction, |
| | | tg.selling_price, |
| | | tg.original_price, |
| | | tg.sale_num, |
| | | tg.home_page_picture |
| | | FROM |
| | | t_shop ts |
| | | LEFT JOIN t_goods_shop tgs ON ts.id = tgs.shop_id |
| | | LEFT JOIN t_goods tg ON tg.id = tgs.goods_id |
| | | where ts.id = #{shopId} |
| | | ORDER BY tg.sale_num DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | <mapper namespace="com.ruoyi.other.mapper.ShopMapper"> |
| | | |
| | | <select id="selectNearbyShopList" resultType="com.ruoyi.other.vo.NearbyShopVO"> |
| | | |
| | | SELECT id, |
| | | home_picture, |
| | | name, |
| | | address, |
| | | ( |
| | | 6371 * acos( |
| | | cos( |
| | | radians(#{latitude})) * cos( |
| | | radians(latitude)) * cos( |
| | | radians(longitude) - radians(#{longitude})) + sin( |
| | | radians(#{latitude})) * sin( |
| | | radians(latitude)) |
| | | )) AS distance |
| | | FROM t_shop |
| | | where del_flag = 0 and status = 1 |
| | | ORDER BY distance |
| | | </select> |
| | | <select id="selectShopDetail" resultType="com.ruoyi.other.vo.ShopDetailVO"> |
| | | SELECT |
| | | ts.id, |
| | | ts.details_picture, |
| | | ts.certification, |
| | | ts.`name`, |
| | | ts.address, |
| | | ts.business_date, |
| | | ts.start_time, |
| | | ts.end_time, |
| | | AVG( tss.score ) score |
| | | FROM |
| | | t_shop ts |
| | | LEFT JOIN t_shop_score tss ON ts.id = tss.shop_id |
| | | WHERE |
| | | ts.del_flag = 0 |
| | | AND ts.`status` = 1 |
| | | AND id = #{id} |
| | | GROUP BY |
| | | ts.id, |
| | | ts.details_picture, |
| | | ts.certification, |
| | | ts.`name`, |
| | | ts.address, |
| | | ts.business_date, |
| | | ts.start_time, |
| | | ts.end_time |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.other.mapper.TechnicianMapper"> |
| | | <select id="selectTechnicianListByShopId" resultType="com.ruoyi.other.vo.TechnicianVO"> |
| | | SELECT |
| | | tt.id, |
| | | tt.`name`, |
| | | tt.introduction, |
| | | tt.home_picture, |
| | | COUNT(tts.id) AS serviceCount, |
| | | AVG(ttsc.score) AS score |
| | | FROM |
| | | t_technician tt |
| | | LEFT JOIN t_technician_subscribe tts ON tt.id = tts.technician_id |
| | | LEFT JOIN t_technician_score ttsc ON ttsc.technician_id = tt.id |
| | | WHERE |
| | | tts.`status` != 0 |
| | | AND tt.`status` = 2 |
| | | AND tt.del_flag = 0 |
| | | AND tt.subscribe_status = 1 |
| | | AND tt.shop_id = #{shopId} |
| | | GROUP BY |
| | | tt.id, |
| | | tt.`name`, |
| | | tt.introduction, |
| | | tt.home_picture |
| | | </select> |
| | | <select id="selectTechnicianDetail" resultType="com.ruoyi.other.vo.TechnicianDetailVO"> |
| | | SELECT |
| | | tt.id, |
| | | tt.`name`, |
| | | tt.introduction, |
| | | tt.home_picture, |
| | | COUNT(tts.id) AS serviceCount, |
| | | AVG(ttsc.score) AS score, |
| | | tt.info_picture |
| | | FROM |
| | | t_technician tt |
| | | LEFT JOIN t_technician_subscribe tts ON tt.id = tts.technician_id |
| | | LEFT JOIN t_technician_score ttsc ON ttsc.technician_id = tt.id |
| | | WHERE |
| | | tts.`status` != 0 |
| | | AND tt.`status` = 2 |
| | | AND tt.del_flag = 0 |
| | | AND tt.subscribe_status = 1 |
| | | AND tt.id = #{technicianId} |
| | | GROUP BY |
| | | tt.id, |
| | | tt.`name`, |
| | | tt.introduction, |
| | | tt.home_picture, |
| | | tt.introduction |
| | | </select> |
| | | </mapper> |