ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/ApplyForAdmission.java
@@ -20,34 +20,34 @@ @ApiModelProperty(value = "主键") @TableId("id") private Long id; private int id; @ApiModelProperty(value = "申请用户id") @TableId("apply_user_id") @TableField("apply_user_id") private Long applyUserId; @ApiModelProperty("商家名称") @TableId("shop_name") @TableField("shop_name") private String shopName; @ApiModelProperty("商家封面图") @TableId("home_picture") @TableField("home_picture") private String homePicture; @ApiModelProperty("店铺详情图") @TableId("details_picture") @TableField("details_picture") private String detailsPicture; @ApiModelProperty("资质证书图片") @TableId("certification") @TableField("certification") private String certification; @ApiModelProperty("店长姓名") @TableId("shop_manager") @TableField("shop_manager") private String shopManager; @ApiModelProperty("电话") @TableId("phone") @TableField("phone") private String phone; @ApiModelProperty(value = "客服电话(同步到t_phone表)") @@ -55,19 +55,19 @@ private String serviceTel; @ApiModelProperty(value = "营业星期:1-周一到周日 2-周一周五 3-仅周末") @TableId("business_date") @TableField("business_date") private Integer businessDate; @ApiModelProperty(value = "经度") @TableId("longitude") @TableField("longitude") private String longitude; @ApiModelProperty(value = "纬度") @TableId("latitude") @TableField("latitude") private String latitude; @ApiModelProperty(value = "详细地址") @TableId("address") @TableField("address") private String address; @ApiModelProperty(value = "省") ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserPoint.java
@@ -66,7 +66,7 @@ private Long appUserId; @ApiModelProperty(value = "关联对象id") @TableField("object_id") @TableField("`object_id`") private Long objectId; @ApiModelProperty(value = "拓展字段") ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/Order.java
@@ -66,8 +66,7 @@ @ApiModelProperty(value = "商品数量") @TableField("num") private Integer num; //todo 商品封面 @ApiModelProperty(value = "商品封面(多张逗号隔开,最多三张))") @TableField("good_pics") private String goodPics; ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Shop.java
@@ -106,7 +106,7 @@ @TableField("withdraw_money") private BigDecimal withdrawMoney; @ApiModelProperty(value = "审核中金额") @TableField(exist = false) @TableField("withdraw_audit_money") private BigDecimal withdrawAuditMoney; @ApiModelProperty(value = "余额") ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/GoodsEvaluateClientFallbackFactory.java
@@ -18,8 +18,8 @@ public GoodsEvaluateClient create(Throwable cause) { return new GoodsEvaluateClient(){ @Override public R<Long> getEvaluateIdByUserIdAndGoodId(Integer goodId, Long userId) { return R.fail("根据用户id和门店id获取评论id失败:" + cause.getMessage()); public R<Long> getEvaluateIdByOrderId( Long orderId) { return R.fail("根据订单id获取评论id失败:" + cause.getMessage()); } }; } ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/GoodsEvaluateClient.java
@@ -21,6 +21,6 @@ /** * 通过用户id和商品id查询评价id */ @GetMapping("/getEvaluateIdByUserIdAndGoodId") R<Long> getEvaluateIdByUserIdAndGoodId(@RequestParam("goodId") Integer goodId, @RequestParam("userId") Long userId); @GetMapping("/goods-evaluate/getEvaluateIdByOrderId") R<Long> getEvaluateIdByOrderId(@RequestParam("orderId") Long orderId); } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserApplyForAdmissionController.java
@@ -7,16 +7,13 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @Api(tags = {"申请入驻"}) @RestController @RequestMapping("/user-applyForAdmission") @RequestMapping("/applyForAdmission") @Slf4j public class UserApplyForAdmissionController { @@ -25,7 +22,7 @@ @PostMapping("/apply") @ApiOperation(value = "入驻申请", tags = {"小程序-个人中心首页-申请合作"}) public R apply(ApplyForAdmissionDTO applyForAdmissionDTO) { public R apply(@RequestBody ApplyForAdmissionDTO applyForAdmissionDTO) { return userApplyForAdmissionService.apply(applyForAdmissionDTO); } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/AppUserBankMapper.java
@@ -2,6 +2,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.account.api.model.AppUserBank; import org.apache.ibatis.annotations.Mapper; import javax.validation.constraints.Max; @Mapper public interface AppUserBankMapper extends BaseMapper<AppUserBank> { } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/ApplyForAdmissionMapper.java
@@ -3,6 +3,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.account.api.model.AppUserBank; import com.ruoyi.account.api.model.ApplyForAdmission; import org.apache.ibatis.annotations.Mapper; @Mapper public interface ApplyForAdmissionMapper extends BaseMapper<ApplyForAdmission> { } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserApplyForAdmissionServiceImpl.java
@@ -41,7 +41,7 @@ @Override public R apply(ApplyForAdmissionDTO applyForAdmissionDTO) { Long userid = tokenService.getLoginUserApplet().getUserid(); AppUser appUser = appUserService.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0).ne(AppUser::getStatus, 3) AppUser appUser = appUserService.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0).eq(AppUser::getStatus, 1) .eq(AppUser::getPhone, applyForAdmissionDTO.getPhone())); if (appUser == null){ return R.fail("该手机号未注册"); ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java
@@ -70,12 +70,16 @@ for (UserPointDetailVO userPointDetailVO : userPointDetail) { Integer type1 = userPointDetailVO.getType(); if (type1 != null && type1.equals(12)){ AppUser appUser = appUserService.getById(userPointDetailVO.getReceiveUserId()); //他人赠送 AppUser appUser = appUserService.getById(userPointDetailVO.getObjectId()); userPointDetailVO.setName(appUser.getName()); userPointDetailVO.setTransferUserId(appUser.getId()); } if (type1 != null && type1.equals(13)){ AppUser appUser = appUserService.getById(userPointDetailVO.getTransferUserId()); //赠予他人 AppUser appUser = appUserService.getById(userPointDetailVO.getObjectId()); userPointDetailVO.setName(appUser.getName()); userPointDetailVO.setReceiveUserId(appUser.getId()); } Integer historicalPoint = userPointDetailVO.getHistoricalPoint(); Integer balance = userPointDetailVO.getBalance(); @@ -123,7 +127,7 @@ Integer balance = historicalPoint +point;//变动后积分 appUserForPhoe.setAvailablePoint(balance);//可用积分增加 appUserForPhoe.setTotalPoint(appUserForPhoe.getUserTotalPoint() + point);//总积分增加 appUserForPhoe.setTotalPoint(appUserForPhoe.getTotalPoint() + point);//总积分增加 appUserForPhoe.setTransferableInPoint(appUserForPhoe.getTransferableInPoint() + point);//转入积分增加 appUserService.updateById(appUserForPhoe); @@ -141,11 +145,12 @@ userPointService.save(userPoint); } Integer historicalPoint2 = appUserForPhoe.getAvailablePoint();//历史积分 Integer balance2 = historicalPoint - point;//变动后积分 Integer historicalPoint2 = appUser.getAvailablePoint();//历史积分 Integer balance2 = historicalPoint2 - point;//变动后积分 appUser.setAvailablePoint(balance);//可用积分减少 appUser.setTransferableOutPoint(appUserForPhoe.getTransferableOutPoint() + point);//转出积分增加 appUser.setAvailablePoint(balance2);//可用积分减少 appUser.setTotalPoint(appUser.getTotalPoint() + point);//总积分增加 appUser.setTransferableOutPoint(appUser.getTransferableOutPoint() + point);//转出积分增加 appUserService.updateById(appUser); //构建积分流水记录 ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserBankMapper.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.AppUserBankMapper"> </mapper> ruoyi-service/ruoyi-account/src/main/resources/mapper/account/ApplyForAdmissionMapper.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.ApplyForAdmissionMapper"> </mapper> ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserPointMapper.xml
@@ -58,15 +58,13 @@ <select id="getUserPointDetail" resultType="com.ruoyi.account.vo.UserPointDetailVO"> select * from ( select type, historical_point as historicalPoint, balance, variable_point as variablePoint, DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') as createTime, transfer_user_id as transferUserId, receive_user_id as receiveUserId, object_id as objectId from t_user_point where app_user_id = #{userId} <if test="null != startTime and null != endTime"> @@ -75,23 +73,7 @@ <if test="null != type"> and type = #{type} </if> union all select type, historical_point as historicalPoint, balance, variable_point as variablePoint, DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') as createTime, transfer_user_id as transferUserId, receive_user_id as receiveUserId, object_id as objectId from t_user_point_copy where app_user_id = #{userId} <if test="null != startTime and null != endTime"> and create_time between #{startTime} and #{endTime} </if> <if test="null != type"> and type = #{type} </if> ) as a order by a.createTime desc order by create_time desc </select> </mapper> ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -59,6 +59,7 @@ import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; import java.util.*; @@ -145,14 +146,22 @@ OrderGood orderGood = orderGoodMapper.selectOne(new LambdaQueryWrapper<OrderGood>().eq(OrderGood::getOrderId, orderId)); String goodJson = orderGood.getGoodJson(); Goods goods = JSONObject.parseObject(goodJson, Goods.class); GoodsSeckill goodsSeckill = JSON.parseObject(orderGood.getSeckillJson(), GoodsSeckill.class); OrderGoodsVO orderGoodsVO = new OrderGoodsVO(); orderGoodsVO.setGoodsId(goods.getId()); orderGoodsVO.setGoodsName(goods.getName()); orderGoodsVO.setGoodsPic(goods.getHomePagePicture()); orderGoodsVO.setNum(order.getNum()); orderGoodsVO.setSellingPrice(goods.getSellingPrice()); orderGoodsVO.setIntegral(goods.getIntegral()); if (null!=goodsSeckill){ orderGoodsVO.setSellingPrice(goodsSeckill.getSellingPrice()); orderGoodsVO.setIntegral(goodsSeckill.getIntegral()); }else { orderGoodsVO.setSellingPrice(goods.getSellingPrice()); orderGoodsVO.setIntegral(goods.getIntegral()); } orderGoodsVO.setOriginalPrice(goods.getOriginalPrice()); OrderDetailVO orderDetailVO = new OrderDetailVO(); @@ -181,7 +190,7 @@ throw new ServiceException("生成核销码失败"); } //该商品是否被用户评论 Long evaluateId = goodsEvaluateClient.getEvaluateIdByUserIdAndGoodId(goods.getId(), order.getAppUserId()).getData(); Long evaluateId = goodsEvaluateClient.getEvaluateIdByOrderId(order.getId()).getData(); orderDetailVO.setEvaluateId(evaluateId); return orderDetailVO; @@ -207,6 +216,9 @@ } if (!order.getShopId().equals(shopId)) { throw new ServiceException("该订单与当前扫码门店不一致"); } if (order.getOrderStatus()!=3){ throw new ServiceException("订单已被核销过"); } @@ -396,7 +408,15 @@ */ public R refundPayMoney(Order order) { //开始退款 //先回退积分 BigDecimal paymentAmount = order.getPaymentAmount(); if (BigDecimal.ZERO.compareTo(order.getPaymentAmount()) < 0) {//支付的金额是否大于0 //微信退款 RefundResult refund = PaymentUtil.refund(order.getOrderNumber(), "R" + order.getOrderNumber(), paymentAmount.doubleValue(), "/order/order/refundPayMoneyCallback"); if (!"100".equals(refund.getRa_Status())) { return R.fail(refund.getRc_CodeMsg());//退款失败 } } //退款成功再回退积分 AppUser appUser = appUserClient.getAppUserById(order.getAppUserId()); if (order.getPoint()>0) { //返回订单抵扣积分 @@ -406,6 +426,7 @@ appUser.setAvailablePoint(availablePoint); appUser.setCancelPoint(cancelPoint); appUser.setTotalPoint(appUser.getTotalPoint() + order.getPoint()); appUserClient.editAppUserById(appUser); //构建积分流水 UserPoint userPoint = new UserPoint(); @@ -419,15 +440,6 @@ userPointClient.saveUserPoint(userPoint); } BigDecimal paymentAmount = order.getPaymentAmount(); if (BigDecimal.ZERO.compareTo(order.getPaymentAmount()) < 0) {//支付的金额是否大于0 //微信退款 RefundResult refund = PaymentUtil.refund(order.getOrderNumber(), "R" + order.getOrderNumber(), paymentAmount.doubleValue(), "/order/order/refundPayMoneyCallback"); if (!"100".equals(refund.getRa_Status())) { return R.fail(refund.getRc_CodeMsg());//退款失败 } } order.setRefundStatus(2); order.setRefundTime(LocalDateTime.now()); @@ -436,13 +448,20 @@ goodsClient.editGoodsNum(orderGood.getGoodsId(), -1); //获取商品json Goods good = JSON.parseObject(orderGood.getGoodJson(), Goods.class); GoodsSeckill goodsSeckill = JSON.parseObject(orderGood.getSeckillJson(), GoodsSeckill.class); //门店减少冻结资金 即减少余额, 冻结资金=余额-可用资金 Shop shop = shopClient.getShopById(order.getShopId()).getData(); BigDecimal historicalBalance=shop.getBalance();//历史余额 BigDecimal variableAmount=good.getSellingPrice();//变动金额 BigDecimal balance=shop.getBalance().subtract(good.getSellingPrice());//变动后余额 BigDecimal variableAmount=BigDecimal.ZERO;//变动金额 if (null != goodsSeckill) { variableAmount=goodsSeckill.getSellingPrice(); }else { variableAmount=good.getSellingPrice(); } BigDecimal balance=shop.getBalance().subtract(variableAmount);//变动后余额 shop.setBalance(balance); shopClient.updateShop(shop); @@ -658,6 +677,7 @@ confirmOrderVo.setCash(goodsSeckill.getSellingPrice());//秒杀活动价格 confirmOrderVo.setPoint(goodsSeckill.getIntegral());//秒杀活动积分价格 confirmOrderVo.setPurchaseLimitNum(activityInfo.getMaxNum());//限购数量 confirmOrderVo.setEndTimeStamp(activityInfo.getEndTime().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());//结束时间戳 } @@ -672,7 +692,7 @@ } //限购检查 //判断当前数量是否已经超出限购数量(需要计算已经购买的数量) if(null == good.getPurchaseLimit() || -1 == good.getPurchaseLimit()){ if(null == confirmOrderVo.getPurchaseLimitNum() || -1 == confirmOrderVo.getPurchaseLimitNum()){ confirmOrderVo.setIsPurchaseLimit(false); confirmOrderVo.setPurchaseLimitNum(-1); }else{ @@ -687,7 +707,7 @@ sum = orderGoodList.stream().mapToInt(OrderGood::getNum).sum(); } confirmOrderVo.setIsPurchaseLimit((1 + sum) > good.getPurchaseLimit()); confirmOrderVo.setPurchaseLimitNum(good.getPurchaseLimit() - sum); confirmOrderVo.setPurchaseLimitNum(confirmOrderVo.getPurchaseLimitNum() - sum); } return confirmOrderVo; @@ -703,6 +723,7 @@ int type=1;//商品类型 1=普通商品,2=秒杀商品 //商品信息 Goods goods = goodsClient.getGoodsById(orderPayment.getGoodId()).getData(); String goodsJson= JSON.toJSONString(goods); if (null == goods || 1==goods.getDelFlag()){ return R.fail( "商品不存在"); } @@ -796,7 +817,8 @@ order.setDelFlag(0); order.setCreateTime(LocalDateTime.now()); orderMapper.insert(order); this.save(order); //构建订单明细数据 OrderGood orderGood = new OrderGood(); @@ -807,7 +829,7 @@ if (2==type){ orderGood.setSeckillJson(JSON.toJSONString(goodsSeckill)); } orderGood.setGoodJson(JSON.toJSONString(goods)); orderGood.setGoodJson(goodsJson); orderGood.setDelFlag(0); orderGood.setCreateTime(LocalDateTime.now()); orderGood.setCashPayment(orderPayment.getPaymentType()==1 ? 1 : 0); @@ -829,6 +851,7 @@ //扣减订单支付积分 appUser.setAvailablePoint(availablePoint); appUser.setExchangePoint(exchangePoint ); appUser.setTotalPoint(appUser.getTotalPoint() + order.getPoint());//总积分 //构建积分流水记录 UserPoint userPoint = new UserPoint(); userPoint.setType(4);//兑换商品 @@ -927,11 +950,16 @@ //商品销量增加 goodsClient.editGoodsNum(orderGood.getGoodsId(), 1); Goods goods = JSON.parseObject(orderGood.getGoodJson(), Goods.class); GoodsSeckill goodsSeckill = JSON.parseObject(orderGood.getSeckillJson(), GoodsSeckill.class); //门店增加冻结资金 即增加金额, 冻结资金=余额-可用资金 Shop shop = shopClient.getShopById(order.getShopId()).getData(); BigDecimal historicalBalance=shop.getBalance();//历史余额 BigDecimal variableAmount=goods.getSellingPrice();//变动余额 BigDecimal variableAmount=BigDecimal.ZERO;//变动金额 if (null != goodsSeckill) { variableAmount=goodsSeckill.getSellingPrice(); }else { variableAmount=goods.getSellingPrice(); } BigDecimal balance=shop.getBalance().add(variableAmount);//变动后余额 shop.setBalance(balance); @@ -989,6 +1017,7 @@ Integer cancelPoint = appUser.getCancelPoint() + order.getPoint();//取消订单积分 appUser.setAvailablePoint(availablePoint); appUser.setCancelPoint(cancelPoint); appUser.setTotalPoint(appUser.getTotalPoint() + order.getPoint()); //构建积分流水记录 UserPoint userPoint = new UserPoint(); @@ -1061,7 +1090,6 @@ OrderPageListVo vo = new OrderPageListVo(); // 复制属性 BeanUtils.copyProperties(order, vo); // 查询用户信息 AppUser user = appUserClient.getAppUserById(order.getAppUserId()); if (user != null) { ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderPageListVo.java
@@ -7,6 +7,7 @@ import lombok.Data; import java.math.BigDecimal; import java.time.LocalDateTime; /** * @author zhibing.pu @@ -16,16 +17,15 @@ @ApiModel public class OrderPageListVo { @ApiModelProperty("订单id") private String id; private Long id; @ApiModelProperty("订单编号") @Excel(name = "订单编号") private String orderNumber; @ApiModelProperty("订单状态(3待使用4已完成5已取消6已退款7售后中8已评价)") @Excel(name = "订单状态", readConverterExp = "3=待使用,4=已完成,5=已取消,6=已退款,7=售后中,8=已评价") private Integer orderStatus; @ApiModelProperty("下单时间") @Excel(name = "下单时间") private String createTime; @ApiModelProperty(value = "下单时间") private LocalDateTime createTime; @ApiModelProperty(value = "商品名称(多个名称逗号隔开))") private String goodName; @ApiModelProperty(value = "商品封面(多张逗号隔开,最多三张))") @@ -37,12 +37,11 @@ @ApiModelProperty(value = "用户手机号") private String phone; @ApiModelProperty("售后截止时间") private String afterSaleTime; @ApiModelProperty(value = "售后截止日期") private LocalDateTime afterSaleTime; @ApiModelProperty("订单金额") @Excel(name = "支付金额") private BigDecimal orderMoney; @ApiModelProperty(value = "实际支付价格") private BigDecimal paymentAmount; } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java
@@ -56,12 +56,12 @@ /** * 通过用户id和商品id查询评价id * 通过订单id查询评价id */ @GetMapping("/getEvaluateIdByUserIdAndGoodId") public R<Long> getEvaluateIdByUserIdAndGoodId(@RequestParam("goodId") Integer goodId, @RequestParam("userId") Long userId) { @GetMapping("/getEvaluateIdByOrderId") public R<Long> getEvaluateIdByOrderId( @RequestParam("orderId") Long orderId) { GoodsEvaluate evaluate = goodsEvaluateMapper.selectOne(new LambdaQueryWrapper<GoodsEvaluate>() .eq(GoodsEvaluate::getGoodsId, goodId).eq(GoodsEvaluate::getAppUserId, userId)); .eq(GoodsEvaluate::getOrderId, orderId).eq(GoodsEvaluate::getDelFlag,0).eq(GoodsEvaluate::getStatus,2)); if (evaluate != null) { return R.ok(evaluate.getId()); } @@ -205,6 +205,9 @@ @ApiOperation(value = "评论详情", tags = {"管理后台-商品管理-评价管理","门店后台-订单-查看用户评价详情"}) public R<GoodsEvaluate> getDetail(@PathVariable("id") Long id){ GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(id); if (null==goodsEvaluate){ return R.fail("未找到该评论"); } buildDetail(goodsEvaluate); return R.ok(goodsEvaluate); } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -541,8 +541,8 @@ @GetMapping("/shopDetail") @ApiOperation(value = "门店详情", tags = {"小程序-首页"}) public R<ShopDetailVO> shopDetail(@ApiParam("门店id") @RequestParam Integer shopId, @ApiParam("经度") @RequestParam BigDecimal longitude, @ApiParam("纬度") @RequestParam BigDecimal latitude) { @ApiParam("经度") @RequestParam(required = false) BigDecimal longitude, @ApiParam("纬度") @RequestParam(required = false) BigDecimal latitude) { return R.ok(shopService.getShopDetail(shopId, longitude, latitude)); } @@ -665,16 +665,22 @@ @ResponseBody @GetMapping("/getSysUserShop") @ApiOperation(value = "获取可切换的门店列表", tags = {"门店后台-首页"}) public R<List<VerifiableShopVo>> getSysUserShop(@ApiParam("经度") @RequestParam BigDecimal longitude, @ApiParam("纬度") @RequestParam BigDecimal latitude){ 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(); if (null == data || data.isEmpty()) { return R.ok(); } List<Integer> collect = data.stream().map(UserShop::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(); } List<VerifiableShopVo> list = new ArrayList<>(); for (Shop shop : shops) { VerifiableShopVo vo = new VerifiableShopVo(); @@ -770,9 +776,8 @@ */ @PostMapping("/addGoods") @ApiOperation(value = "发布商品", tags = {"门店后台-商品管理"}) public R<Void> addGoods(@RequestBody AddGoodsDTO addGoodsDTO) { shopService.addGoodsByShop(addGoodsDTO); return R.ok(); public R<Integer> addGoods(@RequestBody AddGoodsDTO addGoodsDTO) { return R.ok( shopService.addGoodsByShop(addGoodsDTO)); } /** @@ -787,7 +792,6 @@ } goodsService.update(new UpdateWrapper<Goods>() .setSql("status = CASE status WHEN 1 THEN 2 WHEN 2 THEN 1 ELSE status END") .set("update_time", LocalDateTime.now()) .eq("id", goodsId)); return R.ok(); } @@ -796,13 +800,15 @@ * 删除商品 */ @DeleteMapping("/del/{goodsId}") @ApiOperation(value = "发布商品", tags = {"门店后台-商品管理"}) public R<Void> addGoods(@PathVariable Integer goodsId) { Goods goods = goodsService.getById(goodsId); @ApiOperation(value = "删除商品", tags = {"门店后台-商品管理"}) public R<Void> delGoods(@PathVariable Integer goodsId) { Goods goods = goodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getId, goodsId) .eq(Goods::getStatus, 2).eq(Goods::getDelFlag,0)); if (goods == null) { return R.fail("商品不存在"); } goodsService.removeById(goodsId); goodsService.update(new LambdaUpdateWrapper<Goods>().eq(Goods::getId, goodsId).set(Goods::getDelFlag,1)); return R.ok(); } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java
@@ -202,7 +202,7 @@ BigDecimal withdrawMoney = shop.getWithdrawMoney();//审核中金额 shop.setBalance(balance.subtract(money).setScale(2, RoundingMode.HALF_EVEN));//余额减少 shop.setCanWithdrawMoney(canWithdrawMoney.subtract(money).setScale(2, RoundingMode.HALF_EVEN));//可提现金额减少 shop.setWithdrawMoney(withdrawMoney.add(money).setScale(2, RoundingMode.HALF_EVEN));//审核中金额增加 shop.setWithdrawAuditMoney(withdrawMoney.add(money).setScale(2, RoundingMode.HALF_EVEN));//审核中金额增加 shopService.updateById(shop); //添加余额变动明细 ShopBalanceStatement shopBalanceStatement = new ShopBalanceStatement(); ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/dto/AddGoodsDTO.java
@@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -46,9 +47,11 @@ private Integer isActivity; @ApiModelProperty(value = "活动开始时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime startTime; @ApiModelProperty(value = "活动结束时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime endTime; @ApiModelProperty(value = "活动价格") ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java
@@ -57,5 +57,5 @@ GoodsVO goodsDetail(Long goodsId); void addGoodsByShop(AddGoodsDTO addGoodsDTO); Integer addGoodsByShop(AddGoodsDTO addGoodsDTO); } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
@@ -37,6 +37,7 @@ import javax.annotation.Resource; import java.math.BigDecimal; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.*; import java.util.stream.Collectors; @@ -92,6 +93,12 @@ } //查找满足条件的商品 分类、名称、附近十家店 List<GoodsVO> list = this.baseMapper.goodsList(search.getGoodsCategoryId(), search.getName(),shopIds); //去重 Map<Integer, GoodsVO> uniqueGoodsMap = new LinkedHashMap<>(); for (GoodsVO goods : list) { uniqueGoodsMap.putIfAbsent(goods.getGoodsId(), goods); } list = new ArrayList<>(uniqueGoodsMap.values()); for (GoodsVO goods : list) { //计算所需价格和积分 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java
@@ -63,8 +63,6 @@ @Override public TableDataInfo<SeckillActivityVO> listSeckillActivity(Goods goods) { LoginUser loginUserApplet = tokenService.getLoginUserApplet(); AppUser appUser = appUserClient.getAppUserById(loginUserApplet.getUserid()); goods.setVipId(appUser.getVipId()); List<SeckillActivityVO> seckillActivityVOS = seckillActivityInfoMapper.listSeckillActivity(goods); for (SeckillActivityVO seckillActivityVO : seckillActivityVOS) { ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java
@@ -158,7 +158,8 @@ } // 计算距离 if (shopDetailVO.getLongitude() != null && shopDetailVO.getLatitude() != null){ if (shopDetailVO.getLongitude() != null && shopDetailVO.getLatitude() != null && longitude != null && latitude != null) { String shopLocation = String.format("%s,%s", shopDetailVO.getLongitude(), shopDetailVO.getLatitude()); String userLocation = String.format("%s,%s", longitude.toString(), latitude.toString()); Map<String, Double> distanceMap = GeodesyUtil.getDistance(userLocation, shopLocation); @@ -307,7 +308,7 @@ * 发布商品 门店后台-商品管理 */ @Override public void addGoodsByShop(AddGoodsDTO addGoodsDTO) { public Integer addGoodsByShop(AddGoodsDTO addGoodsDTO) { if(addGoodsDTO.getPurchaseLimit()==null){ addGoodsDTO.setPurchaseLimit(-1); } @@ -330,7 +331,7 @@ goodsShop.setAddress(shop.getAddress()); goodsShopService.save(goodsShop); //判断是否参加秒杀活动 if (addGoodsDTO.isActivity()){ if (addGoodsDTO.getIsActivity()==1){ //秒杀活动 SeckillActivityInfo seckillActivityInfo = new SeckillActivityInfo(); seckillActivityInfo.setDelFlag(0); @@ -348,6 +349,7 @@ goodsSeckill.setSeckillActivityInfoId(seckillActivityInfo.getId()); goodsSeckillService.save(goodsSeckill); } return goods.getId(); } /** ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/GoodsVO.java
@@ -65,6 +65,7 @@ @ApiModelProperty(value = "活动结束时间") private LocalDateTime endTime; @ApiModelProperty(value = "状态(1=下架,2=上架)") private Integer status; ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopDetailVO.java
@@ -74,4 +74,31 @@ @ApiModelProperty(value = "状态(1=正常,2=冻结)") private Integer status; @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; } ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopBalanceStatementMapper.xml
@@ -42,10 +42,10 @@ <select id="getShopBalanceStatementList" resultType="com.ruoyi.other.vo.ShopBalanceStatementVO"> select type, historical_balance as historicalBalance historical_balance as historicalBalance, variable_amount as variableAmount, balance, DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') as createTime, DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') as createTime from t_shop_balance_statement where shop_id = #{shopId} <if test="null != startTime and null != endTime"> and create_time between #{startTime} and #{endTime} ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml
@@ -30,6 +30,9 @@ ts.latitude, ts.status, ts.phone, ts.province, ts.city, ts.district, (select ROUND(AVG(score), 1) from t_shop_score where shop_id = ts.id) as score FROM t_shop ts