ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserShopFallbackFactory.java
New file @@ -0,0 +1,29 @@ package com.ruoyi.account.api.factory; import com.ruoyi.account.api.feignClient.AppUserShopClient; import com.ruoyi.account.api.feignClient.UserPointClient; import com.ruoyi.account.api.model.AppUserShop; import com.ruoyi.account.api.model.UserPoint; import com.ruoyi.account.api.model.UserPointCopy; import com.ruoyi.common.core.domain.R; import org.springframework.cloud.openfeign.FallbackFactory; import java.util.List; /** * @author zhibing.pu * @Date 2024/12/2 15:04 */ public class AppUserShopFallbackFactory implements FallbackFactory<AppUserShopClient> { @Override public AppUserShopClient create(Throwable cause) { return new AppUserShopClient() { @Override public R<List<AppUserShop>> getUserShopListByUserId(Long userId) { return R.fail("根据userId获取appUserShopList失败:" + cause.getMessage()); } }; } } ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserShopClient.java
New file @@ -0,0 +1,25 @@ package com.ruoyi.account.api.feignClient; import com.ruoyi.account.api.factory.AppUserShopFallbackFactory; import com.ruoyi.account.api.factory.UserPointFallbackFactory; import com.ruoyi.account.api.model.AppUser; import com.ruoyi.account.api.model.AppUserShop; import com.ruoyi.account.api.model.UserPoint; import com.ruoyi.account.api.model.UserPointCopy; import com.ruoyi.common.core.constant.ServiceNameConstants; import com.ruoyi.common.core.domain.R; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; import java.util.List; /** * @author zhibing.pu * @Date 2024/12/2 15:04 */ @FeignClient(contextId = "AppUserShopClient", value = ServiceNameConstants.ACCOUNT_SERVICE, fallbackFactory = AppUserShopFallbackFactory.class) public interface AppUserShopClient { @GetMapping("/appUserShop/getUserShopListByUserId") public R<List<AppUserShop>> getUserShopListByUserId(@RequestParam("userId") Long userId); } ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java
@@ -197,20 +197,14 @@ @TableField(exist = false) private Set<Long> userIds; @TableField(exist = false) private Integer excludeStatus; public String getIdStr(){ return String.valueOf(id); } public Integer getUserTotalPoint(){ totalPoint = rechargePoint+cancelPoint+exchangePoint+transferableInPoint+transferableOutPoint; return totalPoint ; } ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUserShop.java
New file @@ -0,0 +1,36 @@ package com.ruoyi.account.api.model; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; /** * @author zhibing.pu * @Date 2024/12/2 9:18 */ @Data @TableName("t_app_user_shop") public class AppUserShop { /** * 主键 */ @TableId(value = "id", type = IdType.AUTO) private Integer id; /** * 用户id */ @TableField("app_user_id") private Long appUserId; /** * 门店id */ @TableField("shop_id") private Integer shopId; /** * 角色(1=店长,2=店员,3=技师) */ @TableField("role_type") private Integer roleType; } ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/ApplyForAdmission.java
@@ -54,9 +54,9 @@ @TableField("service_tel") private String serviceTel; @ApiModelProperty(value = "营业星期:1-周一到周日 2-周一周五 3-仅周末") @TableField("business_date") private Integer businessDate; @ApiModelProperty(value = "营业时间") @TableField("business_time") private String businessTime; @ApiModelProperty(value = "经度") @TableField("longitude") @@ -67,32 +67,12 @@ private String latitude; @ApiModelProperty(value = "详细地址") @TableField("detail_address") private String detailAddress; @ApiModelProperty(value = "商家地址") @TableField("address") private String address; @ApiModelProperty(value = "省") @TableField("province") private String province; @ApiModelProperty(value = "省编号") @TableField("province_code") private String provinceCode; @ApiModelProperty(value = "市") @TableField("city") private String city; @ApiModelProperty(value = "市编号") @TableField("city_code") private String cityCode; @ApiModelProperty(value = "区") @TableField("district") private String district; @ApiModelProperty(value = "区编号") @TableField("district_code") private String districtCode; @ApiModelProperty(value = "状态(0-待审核,1-审核通过,2-审核不通过)") ruoyi-api/ruoyi-api-account/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -1,2 +1,3 @@ com.ruoyi.account.api.factory.AppUserClientFallbackFactory com.ruoyi.account.api.factory.UserPointFallbackFactory com.ruoyi.account.api.factory.AppUserShopFallbackFactory ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/VerifiableShopVo.java
@@ -17,8 +17,10 @@ private String name; @ApiModelProperty("距离") private Long distance; @ApiModelProperty("地址") @ApiModelProperty("详细地址") private String address; @ApiModelProperty("商家地址") private String detailAddress; @ApiModelProperty("图片") private String homePicture; ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsEvaluate.java
@@ -70,6 +70,11 @@ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private LocalDateTime createTime; @ApiModelProperty(value = "修改时间") @TableField("update_time") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private LocalDateTime updateTime; @ApiModelProperty(value = "头像") @TableField(exist = false) ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Shop.java
@@ -34,13 +34,11 @@ @TableField("name") private String name; @ApiModelProperty(value = "上级门店id") @TableField("pid") private Integer pid; @ApiModelProperty(value = "营业星期:1-周一到周日 2-周一周五 3-仅周末") @TableField("business_date") private Integer businessDate; @ApiModelProperty(value = "营业时间") @TableField("business_time") private String businessTime; @ApiModelProperty(value = "开始时间(HH:mm)") @TableField("start_time") @@ -70,7 +68,7 @@ @TableField("app_user_id") private Long appUserId; @ApiModelProperty(value = "客户电话(同步到t_phone表)") @ApiModelProperty(value = "客服电话(同步到t_phone表)") @TableField("service_tel") private String serviceTel; @@ -86,9 +84,15 @@ @TableField("latitude") private String latitude; @ApiModelProperty(value = "商家地址") @TableField("detail_address") private String detailAddress; @ApiModelProperty(value = "详细地址") @TableField("address") private String address; @ApiModelProperty(value = "状态(1=正常,2=冻结)") @TableField("status") @@ -105,7 +109,7 @@ @ApiModelProperty(value = "已提现金额") @TableField("withdraw_money") private BigDecimal withdrawMoney; @ApiModelProperty(value = "审核中金额") @ApiModelProperty(value = "c") @TableField("withdraw_audit_money") private BigDecimal withdrawAuditMoney; @@ -148,29 +152,6 @@ private String receiverBankChannelNo; @ApiModelProperty(value = "省") @TableField("province") private String province; @ApiModelProperty(value = "省编号") @TableField("province_code") private String provinceCode; @ApiModelProperty(value = "市") @TableField("city") private String city; @ApiModelProperty(value = "市编号") @TableField("city_code") private String cityCode; @ApiModelProperty(value = "区") @TableField("district") private String district; @ApiModelProperty(value = "区编号") @TableField("district_code") private String districtCode; @TableField(exist = false) private Double distance; ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysDeptController.java
@@ -33,7 +33,7 @@ * 获取部门列表 */ @GetMapping("/list") @ApiOperation(value = "获取部门列表", tags = {"管理后台-部门管理", "门店后台-部门管理"}) @ApiOperation(value = "获取部门列表", tags = {"管理后台-部门管理"}) public AjaxResult list(SysDept dept) { List<SysDept> depts = deptService.selectDeptList(dept); return success(depts); ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java
@@ -101,7 +101,7 @@ permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(","))); } } }else{ }/*else{ List<UserShop> list = userShopService.list(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, user.getUserId()) .eq(UserShop::getShopId, user.getObjectId())); for (UserShop userShop : list) { @@ -109,7 +109,7 @@ permsSet.add(userShop.getRoleId() + ""); } } } }*/ return permsSet; } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -57,7 +57,7 @@ * @author luodangjia * @since 2024-11-21 */ @Api(tags = {"登录注册-小程序"}) @Api(tags = {"用户端-小程序"}) @RestController @RequestMapping("/app-user") @Slf4j @@ -319,7 +319,7 @@ shopId = sysUser.getObjectId(); userId = orderClient.getAppUserByShoppingShop(shopId).getData(); } appUser.setExcludeStatus(3); // appUser.setExcludeStatus(3); IPage<AppUser> appuserPage = appUserService.getAppuserPage(pageNum, pageSize, appUser, shopId, userId); for (AppUser record : appuserPage.getRecords()) { Shop shop1 = shopClient.getServiceProvider(record.getId()).getData(); @@ -327,7 +327,6 @@ record.setShopName(shop1.getName()); record.setShopId(shop1.getId()); } record.setTotalPoint(record.getUserTotalPoint()); } return R.ok(appuserPage); } @@ -362,7 +361,7 @@ record.setShopName(shopById.getData().getName()); } } record.setTotalPoint(record.getUserTotalPoint()); } return R.ok(appuserPage); } @@ -629,14 +628,14 @@ * @return */ @PostMapping("/upload") public String upload(MultipartFile file){ public R upload(MultipartFile file){ String s = null; try { s = ObsUploadUtil.obsUpload(file); } catch (IOException e) { throw new RuntimeException(e); } return s; return R.ok(s); } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserShopController.java
New file @@ -0,0 +1,101 @@ package com.ruoyi.account.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.account.api.model.AppUserShop; import com.ruoyi.account.mapper.AppUserMapper; import com.ruoyi.account.mapper.AppUserShopMapper; import com.ruoyi.account.service.AppUserService; import com.ruoyi.account.service.AppUserShopService; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.system.api.model.LoginUser; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; /** * @author zhibing.pu * @Date 2024/12/2 9:21 */ @RestController @RequestMapping("/appUserShop") public class AppUserShopController { @Resource private AppUserShopService appUserShopService; @Resource private AppUserService appUserService; @Resource private AppUserShopMapper appUserShopMapper; @Resource private TokenService tokenService; @GetMapping("/getUserShopListByUserId") public R<List<AppUserShop>> getUserShopListByUserId(@RequestParam("userId") Long userId){ return R.ok(appUserShopMapper.selectList(new LambdaQueryWrapper<AppUserShop>().eq(AppUserShop::getAppUserId, userId))); } @PostMapping("/addAppUserShop") public R<Void> add(@RequestBody AppUserShop appUserShop) { long count = appUserShopService.count(new LambdaQueryWrapper<AppUserShop>() .eq(AppUserShop::getAppUserId, appUserShop.getAppUserId()).eq(AppUserShop::getShopId, appUserShop.getShopId())); if(0 == count){ appUserShopService.save(appUserShop); } return R.ok(); } @GetMapping("/shop/{userId}") public R<List<AppUserShop>> getAppUserShop(@PathVariable("userId") Long userId) { return R.ok(appUserShopService.list(new LambdaQueryWrapper<AppUserShop>() .eq(AppUserShop::getAppUserId,userId))); } /** * 删除门店用户关系数据 * @param appUserShop * @return */ @PostMapping("/delAppUserShop") public R delAppUserShop(@RequestBody AppUserShop appUserShop){ LambdaQueryWrapper<AppUserShop> wrapper = new LambdaQueryWrapper<>(); if(null != appUserShop.getAppUserId()){ wrapper.eq(AppUserShop::getAppUserId, appUserShop.getAppUserId()); } if(null != appUserShop.getShopId()){ wrapper.eq(AppUserShop::getShopId, appUserShop.getShopId()); } if(null != appUserShop.getRoleType()){ wrapper.eq(AppUserShop::getRoleType, appUserShop.getRoleType()); } appUserShopService.remove(wrapper); return R.ok(); } /** * 保存关系数据 * @param appUserShop */ @PostMapping("/saveAppUserShop") public void saveAppUserShop(@RequestBody AppUserShop appUserShop){ appUserShopService.save(appUserShop); } /** * 校验登录用户是否为门店店长 */ @GetMapping("/checkUserIsShopManager") public R<Boolean> checkUserIsShopManager(){ LoginUser loginUserApplet = tokenService.getLoginUserApplet(); List<AppUserShop> list = appUserShopService.list(new LambdaQueryWrapper<AppUserShop>() .eq(AppUserShop::getAppUserId, loginUserApplet.getUserid()) .eq(AppUserShop::getRoleType, 1)); return R.ok(!CollectionUtils.isEmpty(list)); } } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/dto/ApplyForAdmissionDTO.java
@@ -30,8 +30,8 @@ @ApiModelProperty(value = "客服电话(同步到t_phone表)") private String serviceTel; @ApiModelProperty(value = "营业星期:1-周一到周日 2-周一周五 3-仅周末") private Integer businessDate; @ApiModelProperty(value = "营业时间") private String businessTime; @ApiModelProperty(value = "经度") private String longitude; @@ -40,6 +40,9 @@ private String latitude; @ApiModelProperty(value = "详细地址") private String detailAddress; @ApiModelProperty(value = "商家地址") private String address; } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/AppUserShopMapper.java
New file @@ -0,0 +1,11 @@ package com.ruoyi.account.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.account.api.model.AppUserShop; /** * @author zhibing.pu * @Date 2024/12/2 9:20 */ public interface AppUserShopMapper extends BaseMapper<AppUserShop> { } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserShopService.java
New file @@ -0,0 +1,11 @@ package com.ruoyi.account.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.account.api.model.AppUserShop; /** * @author zhibing.pu * @Date 2024/12/2 9:20 */ public interface AppUserShopService extends IService<AppUserShop> { } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java
@@ -521,7 +521,12 @@ user.setShopStatus(0);//未拥有门店 if (shopList != null && !shopList.isEmpty()) { for (Shop shop : shopList) { user.setShopStatus(shop.getStatus());//门店状态 if (shop.getStatus()==1) { user.setShopStatus(1);//门店状态 } user.getShopIds().add(shop.getId()); user.setShopIds(user.getShopIds()); } } return user; ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserShopServiceImpl.java
New file @@ -0,0 +1,15 @@ package com.ruoyi.account.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.account.api.model.AppUserShop; import com.ruoyi.account.mapper.AppUserShopMapper; import com.ruoyi.account.service.AppUserShopService; import org.springframework.stereotype.Service; /** * @author zhibing.pu * @Date 2024/12/2 9:21 */ @Service public class AppUserShopServiceImpl extends ServiceImpl<AppUserShopMapper, AppUserShop> implements AppUserShopService { } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserApplyForAdmissionServiceImpl.java
@@ -51,20 +51,7 @@ applyForAdmission.setCreateTime(LocalDateTime.now()); applyForAdmission.setApplyUserId(userid); applyForAdmission.setStatus(0); String city = TencentMapUtil.inverseGeographicalAnalysis(applyForAdmission.getLongitude(), applyForAdmission.getLatitude(), false); if(!StringUtils.hasLength(city)){ city = "510100"; } applyForAdmission.setProvinceCode(city.substring(0, 2) + "0000"); Region provinceRegion = regionClient.getRegionBiCode(applyForAdmission.getProvinceCode()).getData(); applyForAdmission.setCityCode(city.substring(0, 4) + "00"); Region cityRegion = regionClient.getRegionBiCode(applyForAdmission.getCityCode()).getData(); applyForAdmission.setDistrictCode(city); Region districtRegion = regionClient.getRegionBiCode(applyForAdmission.getDistrictCode()).getData(); applyForAdmission.setProvince(provinceRegion.getName()); applyForAdmission.setCity(cityRegion.getName()); applyForAdmission.setDistrict(districtRegion.getName()); this.save(applyForAdmission); return R.ok(); ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java
@@ -51,7 +51,7 @@ public UserPointVO getUserPoint(Long userId) { AppUser appUser = appUserService.getById(userId); UserPointVO userPointVO = new UserPointVO(); userPointVO.setTotalPoint(appUser.getUserTotalPoint() ); userPointVO.setTotalPoint(appUser.getTotalPoint() ); userPointVO.setConsumePoint(appUser.getAvailablePoint()); userPointVO.setRechargePoint(appUser.getRechargePoint()); userPointVO.setCancelPoint(appUser.getCancelPoint()); @@ -123,10 +123,21 @@ return R.fail("不能转增给自己"); } if (null==appUserForPhoe.getTotalPoint()){ appUserForPhoe.setTotalPoint(0); } if (null==appUserForPhoe.getTransferableInPoint()){ appUserForPhoe.setTransferableInPoint(0); } if(null==appUserForPhoe.getAvailablePoint()){ appUserForPhoe.setAvailablePoint(0); } Integer historicalPoint = appUserForPhoe.getAvailablePoint();//历史积分 Integer balance = historicalPoint +point;//变动后积分 appUserForPhoe.setAvailablePoint(balance);//可用积分增加 appUserForPhoe.setTotalPoint(appUserForPhoe.getTotalPoint() + point);//总积分增加 appUserForPhoe.setTransferableInPoint(appUserForPhoe.getTransferableInPoint() + point);//转入积分增加 @@ -145,9 +156,19 @@ userPointService.save(userPoint); } if (null==appUser.getTotalPoint()){ appUser.setTotalPoint(0); } if (null==appUser.getTransferableOutPoint()){ appUser.setTransferableOutPoint(0); } if (null==appUser.getAvailablePoint()){ appUser.setAvailablePoint(0); } Integer historicalPoint2 = appUser.getAvailablePoint();//历史积分 Integer balance2 = historicalPoint2 - point;//变动后积分 appUser.setAvailablePoint(balance2);//可用积分减少 appUser.setTotalPoint(appUser.getTotalPoint() + point);//总积分增加 appUser.setTransferableOutPoint(appUser.getTransferableOutPoint() + point);//转出积分增加 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/UserPointDetailVO.java
@@ -12,8 +12,7 @@ @ApiModel("UserPointDetail对象") public class UserPointDetailVO { @ApiModelProperty(value = "变动类型(1-消费,2-返佣,3-拉新,4-每日分享,5-每日签到,6-使用时长, 7-注册积分, 8-门店业绩,\" +\n" + " \"9-门店返佣,14-下级门店返佣,10-技师业绩,11-兑换商品,12-他人赠送,13-赠与他人,15-兑换券)") @ApiModelProperty(value = "变动类型(4=兑换商品,12=他人赠送,13=赠与他人,16=取消订单,17=充值 )") private Integer type; @ApiModelProperty(value = "变动金额") ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserShopMapper.xml
New file @@ -0,0 +1,6 @@ <?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.account.mapper.AppUserShopMapper"> </mapper> ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java
@@ -92,9 +92,9 @@ */ @PostMapping("/addGoodsEvaluate") @ApiOperation(value = "发布商品评价", tags = {"小程序-个人中心-我的订单"}) public R<Void> addGoodsEvaluate(@RequestBody GoodsEvaluate goodsEvaluate){ goodsEvaluateService.addGoodsEvaluate(goodsEvaluate); return R.ok(); public R addGoodsEvaluate(@RequestBody GoodsEvaluate goodsEvaluate){ return goodsEvaluateService.addGoodsEvaluate(goodsEvaluate); } /** @@ -107,6 +107,9 @@ .eq(GoodsEvaluate::getStatus, 2) .eq(GoodsEvaluate::getDelFlag, 0) .eq(GoodsEvaluate::getOrderId, orderId)); if(evaluate==null){ return R.fail("未评价"); } Goods goods = goodsService.getById(evaluate.getGoodsId()); evaluate.setGoodsName(goods.getName()); evaluate.setGoodsImg(goods.getHomePagePicture()); @@ -195,6 +198,7 @@ Goods goods = goodsService.getById(item.getGoodsId()); if(null != goods){ item.setGoodsName(goods.getName()); item.setGoodsImg(goods.getHomePagePicture()); } } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -8,8 +8,11 @@ import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.ruoyi.account.api.feignClient.AppUserClient; import com.ruoyi.account.api.feignClient.AppUserShopClient; import com.ruoyi.account.api.model.AppUser; import com.ruoyi.account.api.model.AppUserShop; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.bean.BeanUtils; import com.ruoyi.common.core.web.controller.BaseController; import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.common.security.service.TokenService; @@ -80,7 +83,7 @@ @Resource private ShopScoreMapper shopScoreMapper; @Resource private UserShopClient userShopClient; private AppUserShopClient appUserShopClient; @Resource private GoodsService goodsService; @Resource @@ -153,12 +156,12 @@ @ApiOperation(value = "新增门店", tags = {"管理后台-门店管理"}) @Transactional(rollbackFor = Exception.class) public R<Void> add(@RequestBody Shop shop){ String phone = shop.getPhone(); /*String phone = shop.getPhone(); AppUser appUser = appUserClient.getAppUserByPhone1(phone).getData(); if (appUser == null){ return R.fail("该手机号未注册"); } /* shop.setShopAllPoint(0); *//* shop.setShopAllPoint(0); shop.setLowerLevelSharePoint(0); shop.setSharePoint(0); shop.setServerPoint(0); @@ -166,20 +169,20 @@ shop.setGiveawayAllMoney(BigDecimal.ZERO); shop.setGiveawayMoney(BigDecimal.ZERO); shop.setLowerLevelGiveawayMoney(BigDecimal.ZERO); shop.setServerGiveawayMoney(BigDecimal.ZERO);*/ shop.setServerGiveawayMoney(BigDecimal.ZERO);*//* shop.setCanWithdrawMoney(BigDecimal.ZERO); shop.setWithdrawMoney(BigDecimal.ZERO); shop.setOrderNumber(0); /* shop.setServerOrderNumber(0); shop.setCustomOrderNumber(0);*/ *//* shop.setServerOrderNumber(0); shop.setCustomOrderNumber(0);*//* shop.setAppUserId(appUser.getId()); String city = TencentMapUtil.inverseGeographicalAnalysis(shop.getLongitude(), shop.getLatitude(), false); if(!StringUtils.hasLength(city)){ city = "510100"; } shop.setProvinceCode(city.substring(0, 2) + "0000"); *//*shop.setProvinceCode(city.substring(0, 2) + "0000"); shop.setCityCode(city.substring(0, 4) + "00"); shop.setDistrictCode(city); shop.setDistrictCode(city);*//* shopService.save(shop); Integer shopId = shop.getId(); @@ -249,7 +252,7 @@ R<List<AppUser>> lowerShopR = appUserClient.setLowerUserShop(appUser.getId(), shopId); if (R.isError(lowerShopR)){ throw new RuntimeException("更换下级会员绑定门店失败"); } }*/ return R.ok(); } @@ -258,9 +261,7 @@ @ApiOperation(value = "门店详情", tags = {"管理后台-门店管理"}) public R<Shop> getDetailById(@RequestParam("id") Integer id){ Shop shop = shopService.getById(id); if (null != shop.getPid() && shop.getPid()==0){ shop.setPid(null); } return R.ok(shop); } @@ -301,23 +302,17 @@ @PutMapping("/editShop") @ApiOperation(value = "门店管理-编辑门店", tags = {"管理后台-门店管理"}) public R<Void> editShop(@RequestBody Shop shop){ String phone = shop.getPhone(); /*String phone = shop.getPhone(); if (!shopService.cheUserByPhone(phone)) { return R.fail("该手机号未注册"); } if (shop.getPid() != null && shop.getPid() != 0){ Shop shopP = shopService.getById(shop.getPid()); if (shopP.getPid()!=null&&shopP.getPid()!=0&& shopP.getPid().equals(shop.getId())){ return R.fail("门店之间不能互相作为上级门店"); } } String city = TencentMapUtil.inverseGeographicalAnalysis(shop.getLongitude(), shop.getLatitude(), false); if(!StringUtils.hasLength(city)){ city = "510100"; } shop.setProvinceCode(city.substring(0, 2) + "0000"); *//*shop.setProvinceCode(city.substring(0, 2) + "0000"); shop.setCityCode(city.substring(0, 4) + "00"); shop.setDistrictCode(city); shop.setDistrictCode(city);*//* Shop old_shop = shopService.getById(shop.getId()); shopService.updateById(shop); //修改管理员 @@ -397,7 +392,7 @@ userShop.setCreateTime(LocalDateTime.now()); userShopClient.saveUserShop(userShop); } } }*/ return R.ok(); } @@ -409,7 +404,7 @@ @PutMapping("/freezingOrThawing") @ApiOperation(value = "门店管理-冻结/解冻门店", tags = {"管理后台-门店管理"}) public R freezingOrThawing(@RequestParam("id") Integer id, @RequestParam("status") Integer status){ Shop shop = shopService.getById(id); /* Shop shop = shopService.getById(id); if(shop.getStatus().equals(status)){ return R.fail("不能重复操作"); } @@ -460,7 +455,7 @@ } } } } }*/ return R.ok(); } @@ -493,7 +488,7 @@ @GetMapping ("/resetPassword") @ApiOperation(value = "重置密码", tags = {"管理后台-门店管理"}) public R<Void> resetPassword(@RequestParam(value = "ids") String ids) { String[] idsArr = ids.split(","); /* String[] idsArr = ids.split(","); for (String id : idsArr) { Shop shop = shopService.getById(Integer.valueOf(id)); UserShop userShop = new UserShop(); @@ -504,7 +499,7 @@ String s = MD5Generator.generateMD5(userData.getPhonenumber().substring(5)); userData.setPassword(s); sysUserClient.resetPassword(userData); } }*/ return R.ok(); } @@ -601,11 +596,7 @@ return R.ok(one); } /* @PostMapping("/getShopByUserIds") public R<List<Shop>> getShopByUserIds(@RequestBody List<Long> userIds){ List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>().in(Shop::getAppUserId, userIds)); return R.ok(list); }*/ /** * 根据名称查询门店id @@ -667,28 +658,27 @@ @ApiOperation(value = "获取可切换的门店列表", tags = {"门店后台-首页"}) public R<List<VerifiableShopVo>> getSysUserShop(@ApiParam("经度") @RequestParam(required = false) BigDecimal longitude, @ApiParam("纬度") @RequestParam(required = false) BigDecimal latitude){ Long userid = tokenService.getLoginUser().getUserid(); UserShop userShop = new UserShop(); userShop.setUserId(userid); List<UserShop> data = userShopClient.getUserShop(userShop).getData(); Long userid = tokenService.getLoginUserApplet().getUserid(); List<AppUserShop> data = appUserShopClient.getUserShopListByUserId(userid).getData(); if (null == data || data.isEmpty()) { return R.ok(); return R.fail("暂无其他门店可切换"); } List<Integer> collect = data.stream().map(UserShop::getShopId).collect(Collectors.toList()); List<Integer> collect = data.stream().map(AppUserShop::getShopId).collect(Collectors.toList()); List<Shop> shops = shopService.list(new LambdaQueryWrapper<Shop>() .in(!CollectionUtils.isEmpty(collect),Shop::getId, collect) .eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1)); if (shops == null || shops.isEmpty()) { return R.ok(); return R.fail("暂无其他门店可切换"); } List<VerifiableShopVo> list = new ArrayList<>(); for (Shop shop : shops) { VerifiableShopVo vo = new VerifiableShopVo(); BeanUtils.copyProperties(shop, vo); vo.setId(shop.getId()); vo.setName(shop.getName()); vo.setHomePicture(shop.getHomePicture()); String address = shop.getProvince() + shop.getCity() + shop.getDistrict()+ shop.getAddress(); vo.setAddress(address); if (null != latitude && null != longitude) { Double wgs84 = GeodesyUtil.getDistance(longitude + "," + latitude, shop.getLongitude() + "," + shop.getLatitude()).get("WGS84"); vo.setDistance(wgs84.longValue()); @@ -756,7 +746,9 @@ @ResponseBody @GetMapping("/getGoodsListByShopId") @ApiOperation(value = "获取门店内商品列表", tags = {"门店后台-首页"}) public R<PageInfo<GoodsVO>> getGoodsListByShopId(@ApiParam("门店id") Integer shopId, Integer pageCurr, Integer pageSize) { public R<PageInfo<GoodsVO>> getGoodsListByShopId(@ApiParam("门店id")@RequestParam("shopId") Integer shopId, @ApiParam("门店id")@RequestParam("pageCurr") Integer pageCurr, @ApiParam("门店id")@RequestParam("pageSize") Integer pageSize) { PageInfo<GoodsVO> pageInfo = new PageInfo<>(pageCurr, pageSize); List<GoodsVO> goodsList = shopService.getGoodsListByShopId(pageInfo, shopId); return R.ok(pageInfo.setRecords(goodsList)); ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java
@@ -79,7 +79,7 @@ * 提现申请列表 */ @GetMapping("/list") @ApiOperation("提现申请列表") @ApiOperation(value = "提现申请列表" ) public R<IPage<ShopWithdraw>> list(@ApiParam("页码") @RequestParam Integer pageNum, @ApiParam("每一页数据大小") Integer pageSize, ShopWithdraw shopWithdraw) { @@ -120,7 +120,6 @@ .eq(auditStatus!=null,ShopWithdraw::getAuditStatus,auditStatus) .orderByDesc(ShopWithdraw::getCreateTime) ); page.getRecords().forEach(s->s.setIdStr(s.getId().toString())); return R.ok(page); } @@ -191,6 +190,8 @@ } ShopWithdraw shopWithdraw = new ShopWithdraw(); shopWithdraw.setShopId(shopId); shopWithdraw.setShopName(shop.getName()); shopWithdraw.setCreateUserId(userId); shopWithdraw.setMoney(money); shopWithdraw.setAuditStatus(0);//待审核 shopWithdraw.setStatus(1);//申请中 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopMapper.java
@@ -32,5 +32,5 @@ ShopStatistics getShopStatistics(@Param("shopId") Integer shopId); List<GoodsVO> selectListByShopId(PageInfo<GoodsVO> pageInfo, Integer shopId); List<GoodsVO> selectListByShopId(PageInfo<GoodsVO> pageInfo, @Param("shopId") Integer shopId); } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsEvaluateService.java
@@ -1,6 +1,7 @@ package com.ruoyi.other.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.common.core.domain.R; import com.ruoyi.other.api.domain.GoodsEvaluate; import com.ruoyi.other.vo.GoodsEvaluateVO; import org.springframework.web.bind.annotation.RequestBody; @@ -14,5 +15,5 @@ * @since 2024-11-20 */ public interface GoodsEvaluateService extends IService<GoodsEvaluate> { void addGoodsEvaluate(@RequestBody GoodsEvaluate GoodsEvaluate); R addGoodsEvaluate(@RequestBody GoodsEvaluate GoodsEvaluate); } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java
@@ -1,6 +1,7 @@ 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; @@ -41,21 +42,22 @@ @Override @Transactional(rollbackFor = Exception.class) public void addGoodsEvaluate(GoodsEvaluate goodsEvaluate) { public R addGoodsEvaluate(GoodsEvaluate goodsEvaluate) { goodsEvaluate.setStatus(2); if (StringUtils.isNotEmpty(goodsEvaluate.getIdStr())){ goodsEvaluate.setId(Long.valueOf(goodsEvaluate.getIdStr())); updateById(goodsEvaluate); }else { LoginUser loginUserApplet = tokenService.getLoginUserApplet(); goodsEvaluate.setAppUserId(loginUserApplet.getUserid()); goodsEvaluate.setCreateTime(LocalDateTime.now()); save(goodsEvaluate); if (goodsEvaluate.getId() == null) { //新增 GoodsEvaluate evaluate = this.getOne(new LambdaQueryWrapper<GoodsEvaluate>() .eq(GoodsEvaluate::getStatus, 2) .eq(GoodsEvaluate::getDelFlag, 0) .eq(GoodsEvaluate::getOrderId, goodsEvaluate.getId())); if (evaluate != null) { return R.fail("已评价过"); } goodsEvaluate.setStatus(2); LoginUser loginUserApplet = tokenService.getLoginUserApplet(); goodsEvaluate.setAppUserId(loginUserApplet.getUserid()); goodsEvaluate.setCreateTime(LocalDateTime.now()); save(goodsEvaluate); Long orderId = goodsEvaluate.getOrderId(); Order data = orderClient.getOrderById(orderId).getData(); Order order = new Order(); @@ -63,10 +65,14 @@ order.setOldOrderStatus(data.getOrderStatus()); order.setOrderStatus(8); R<Void> r = remoteOrderGoodsClient.updateOrderStatus(order); if (R.isError(r)){ if (R.isError(r)) { throw new RuntimeException("修改订单状态失败"); } } else { //修改 goodsEvaluate.setUpdateTime(LocalDateTime.now()); updateById(goodsEvaluate); } return R.ok(); } } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
@@ -196,6 +196,7 @@ } Goods goods = this.getById(goodsId); if(null == goods || goods.getDelFlag() == 1){ throw new RuntimeException("商品不存在"); } @@ -226,9 +227,8 @@ GoodsShop goodsShop = goodsShopMapper.selectOne(new LambdaQueryWrapper<GoodsShop>() .eq(GoodsShop::getGoodsId, goodsId)); Shop shop1 = shopMapper.selectById(goodsShop.getShopId()); ArrayList<Shop> shops = new ArrayList<>(); shops.add(shop1); goodsVO.setShopList(shops); goodsVO.setShop(shop1); //已售数量 Integer integer = orderClient.getGoodsSaleNum(goods.getId(), 1).getData(); goodsVO.setSaleNum(integer); ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java
@@ -62,8 +62,6 @@ private OrderClient orderClient; @Override public TableDataInfo<SeckillActivityVO> listSeckillActivity(Goods goods) { LoginUser loginUserApplet = tokenService.getLoginUserApplet(); List<SeckillActivityVO> seckillActivityVOS = seckillActivityInfoMapper.listSeckillActivity(goods); for (SeckillActivityVO seckillActivityVO : seckillActivityVOS) { Integer data = orderClient.getGoodsSaleNum(seckillActivityVO.getGoodsId(), 2).getData(); ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java
@@ -244,6 +244,9 @@ public List<GoodsVO> getGoodsListByShopId(PageInfo<GoodsVO> pageInfo, Integer shopId) { //查询该门店商品 List<GoodsVO> goods = shopMapper.selectListByShopId(pageInfo, shopId); if(null == goods){ return null; } for (GoodsVO good : goods) { //价格 Price price = getPrice( good.getGoodsId()); @@ -294,9 +297,7 @@ GoodsShop goodsShop = goodsShopMapper.selectOne(new LambdaQueryWrapper<GoodsShop>() .eq(GoodsShop::getGoodsId, goodsId)); Shop shop1 = shopMapper.selectById(goodsShop.getShopId()); ArrayList<Shop> shops = new ArrayList<>(); shops.add(shop1); goodsVO.setShopList(shops); goodsVO.setShop(shop1); //已售数量 Integer integer = orderClient.getGoodsSaleNum(goods.getId(), 1).getData(); goodsVO.setSaleNum(integer); ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/GoodsVO.java
@@ -22,9 +22,6 @@ @ApiModelProperty(value = "限购数量(-1不限购)") private Integer purchaseLimit; @ApiModelProperty(value = "类型(1=服务商品,2=单品商品)") private Integer type; @ApiModelProperty(value = "商品简介") private String introduction; @@ -38,11 +35,6 @@ private String detailPicture; @ApiModelProperty(value = "现金支付(0=否,1=是)") private Integer cashPayment; @ApiModelProperty(value = "积分支付(0=否,1=是)") private Integer pointPayment; @ApiModelProperty(value = "基础积分") private Integer integral; @@ -69,9 +61,7 @@ @ApiModelProperty(value = "状态(1=下架,2=上架)") private Integer status; @ApiModelProperty(value = "门店列表") private List<Shop> shopList; @ApiModelProperty(value = "门店") private Shop shop; } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/SeckillActivityVO.java
@@ -29,11 +29,6 @@ @ApiModelProperty(value = "商品分类名称") private String goodsCategoryName; @ApiModelProperty(value = "运营成本") private BigDecimal operatingCost; @ApiModelProperty(value = "门店成本") private BigDecimal shopCost; @ApiModelProperty(value = "限购数量") private Integer maxNum; ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopDetailVO.java
@@ -30,8 +30,8 @@ @ApiModelProperty(value = "资质证书图片") private String certification; @ApiModelProperty(value = "营业星期:1-周一到周日 2-周一周五 3-仅周末") private Long businessDate; @ApiModelProperty(value = "营业时间") private String businessTime; @ApiModelProperty(value = "开始时间(HH:mm)") private String startTime; @@ -57,8 +57,10 @@ /** * 地址 */ @ApiModelProperty(value = "地址") @ApiModelProperty(value = "商家地址") private String address; @ApiModelProperty(value = "详细地址") private String detailAddress; /** * 距离 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml
@@ -6,7 +6,7 @@ SELECT tg.id as goodsId, tg.`name` as goodsName, tg.purchase_limit as purchaseLimit tg.purchase_limit as purchaseLimit, tg.integral, tg.introduction, tg.selling_price as sellingPrice, ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml
@@ -13,13 +13,14 @@ tgs.selling_price as sellingPrice, tgs.integral as integral, tg.sale_num as saleNum, tsai.max_num as maxNum, tg.type goodsType, tsai.start_time as startTime, tsai.end_time as endTime FROM t_seckill_activity_info tsai LEFT JOIN t_goods tg ON tsai.good_id = tg.id LEFT JOIN t_goods_seckill tgs ON tgs.seckill_activity_info_id = tsai.id and tgs.vip = #{vipId} LEFT JOIN t_goods_seckill tgs ON tgs.seckill_activity_info_id = tsai.id WHERE tsai.is_shelves = 1 AND tsai.del_flag = 0 and tsai.end_time >= now() <if test="name != null and name != ''"> AND tg.`name` LIKE concat('%',#{name},'%') @@ -27,12 +28,7 @@ <if test="goodsCategoryId != null"> AND tg.goods_category_id = #{goodsCategoryId} </if> <if test="vipId != null"> AND tgs.vip in (0, -1, #{vipId}) </if> <if test="vipId == null"> AND tgs.vip in (0, -1) </if> </select> <select id="selectDetail" resultType="com.ruoyi.other.vo.SeckillActivityDetailVO"> SELECT @@ -53,7 +49,7 @@ FROM t_seckill_activity_info tsai LEFT JOIN t_goods tg ON tsai.good_id = tg.id LEFT JOIN t_goods_seckill tgs ON tgs.seckill_activity_info_id = tsai.id and tgs.vip = #{vip} LEFT JOIN t_goods_seckill tgs ON tgs.seckill_activity_info_id = tsai.id WHERE tsai.id = #{seckillActivityId} AND tsai.del_flag = 0 </select> <select id="querySeckillActivity" resultType="com.ruoyi.other.vo.SeckillActivityVO"> @@ -63,12 +59,10 @@ tg.`name` goodsName, tg.introduction, tgc.`name` goodsCategoryName, tg.operating_cost, tg.shop_cost, tsai.max_num maxNum, tg.home_page_picture, tg.original_price, tg.`type` goodsType, tsai.start_time, tsai.end_time, tsai.is_shelves showStatus @@ -89,12 +83,6 @@ <if test="goods.categoryName != null and goods.categoryName != ''"> AND tgc.name = #{goods.categoryName} </if> <if test="goods.showStatus != null"> AND tsai.is_shelves = #{goods.showStatus} </if> <if test="goods.type != null"> AND tg.type = #{goods.type} </if> <if test="goods.status != null and goods.status ==1"> AND tsai.start_time <![CDATA[>]]> NOW() </if> @@ -103,9 +91,6 @@ </if> <if test="goods.status != null and goods.status ==3"> AND tsai.end_time <![CDATA[<]]> NOW() </if> <if test="goods.vipId != null"> AND find_in_set(#{goods.vipId},tgs.vip) > 0 </if> order by tsai.create_time desc </select> ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml
@@ -7,6 +7,7 @@ home_picture, name, score, detail_address, address, longitude, latitude @@ -23,7 +24,8 @@ ts.certification, ts.`name`, ts.address, ts.business_date, ts.detail_address, ts.business_time, ts.start_time, ts.end_time, ts.longitude, @@ -86,9 +88,11 @@ SELECT tg.id as goodsId, tg.`name` as goodsName, tg.purchase_limit as purchaseLimit tg.purchase_limit as purchaseLimit, tg.detail, tg.detail_picture, tg.integral, tg.introduction, tg.introduction, tg.selling_price as sellingPrice, tg.original_price as originalPrice, tg.sale_num as saleNum,