From 912d2e62391b1459952375a60ba87cfa842f1c41 Mon Sep 17 00:00:00 2001 From: luodangjia <luodangjia> Date: 星期二, 17 十二月 2024 10:26:54 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RedPackegeSetController.java | 34 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/dto/RedPackegeSetDto.java | 11 aa.json | 7 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserPoint.java | 3 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/excel/ShopPointEX.java | 37 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java | 36 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BaseSettingController.java | 29 + ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/RefundPassService.java | 41 ++ ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java | 3 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java | 25 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopGoodsListVo.java | 21 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsShopServiceImpl.java | 30 + ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassList.java | 34 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/RefundPassSettingVo.java | 22 + ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java | 2 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/OrderGood.java | 2 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java | 57 ++ ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml | 48 ++ ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java | 5 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/RefundPassMapper.xml | 35 + ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java | 6 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/RefundPassInfo.java | 65 +++ ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipSettingController.java | 5 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java | 69 +++ ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopPointController.java | 59 ++ ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassListVo.java | 25 + ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/RedPackegeSet.java | 6 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java | 1 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java | 1 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java | 141 +++++++ ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/MyShoppingCartVo.java | 2 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java | 10 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopPoint.java | 41 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsShopController.java | 22 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsShopService.java | 12 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsArea.java | 10 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/Price.java | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java | 5 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml | 32 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsBargainPriceController.java | 8 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsShopMapper.xml | 24 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopPointStatistics.java | 3 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsShopMapper.java | 19 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java | 7 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/RefundPassMapper.java | 17 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopPointService.java | 3 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/dto/GoodsAreaDto.java | 4 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsVip.java | 4 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopPointMapper.java | 4 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopGoodsList.java | 20 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java | 64 ++ 51 files changed, 1,082 insertions(+), 91 deletions(-) diff --git a/aa.json b/aa.json new file mode 100644 index 0000000..cd2e2d8 --- /dev/null +++ b/aa.json @@ -0,0 +1,7 @@ + +{ + "province": "", + "city":"", + "area": "", + "vip": [] +} \ No newline at end of file diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java index 741226b..ca8a349 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java @@ -95,7 +95,8 @@ } @Override - public List<AppUser> listByIds(List<String> list) { + public List<AppUser> listByIds(List<Long> list) { + log.error("获取用户失败: "+cause.getMessage()); return Collections.emptyList(); } }; diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java index 41b5740..a9d893c 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java @@ -60,8 +60,8 @@ @GetMapping("/app-user/listByIds") - List<AppUser> listByIds(List<String> list); - + List<AppUser> listByIds(@RequestParam("ids") List<Long> list); + /** * 根据用户名称模糊搜索用户列表 * @param name @@ -69,7 +69,7 @@ */ @PostMapping("/app-user/getAppUserByName") R<List<AppUser>> getAppUserByName(@RequestParam("name") String name); - + /** * 根据用户电话模糊搜索用户列表 * @param phone @@ -77,8 +77,8 @@ */ @PostMapping("/app-user/getAppUserByPhone") R<List<AppUser>> getAppUserByPhone(@RequestParam("phone") String phone); - - + + @PostMapping("/app-user/getAppUserByPhone1") R<AppUser> getAppUserByPhone1(String phone); } diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java index 071b668..5a0c169 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java @@ -72,7 +72,6 @@ @ApiModelProperty(value = "添加时间") @TableField("create_time") - @JsonFormat(pattern = "yyyy-MM-dd") private LocalDateTime createTime; @ApiModelProperty(value = "删除(0=否,1=是)") diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserPoint.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserPoint.java index fd2cebb..fb58e18 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserPoint.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserPoint.java @@ -9,6 +9,7 @@ import io.swagger.annotations.ApiParam; import lombok.Data; import lombok.EqualsAndHashCode; +import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.RequestParam; import java.io.Serializable; @@ -76,11 +77,13 @@ @ApiModelProperty(value = "开始时间") @TableField(exist = false) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime startTime; @ApiModelProperty(value = "结束时间") @TableField(exist = false) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime endTime; @TableField(exist = false) diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/OrderGood.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/OrderGood.java index fff54b2..6545aff 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/OrderGood.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/OrderGood.java @@ -76,7 +76,7 @@ @ApiModelProperty(value = "获取返佣积分上级类型(1=直推上级,2=直帮上级)") @TableField("superior_type") - private Integer superiorType; + private String superiorType; @ApiModelProperty(value = "获取分佣金额上级类型(1=直推上级,2=直帮上级)") @TableField("superior_price_type") diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/MyShoppingCartVo.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/MyShoppingCartVo.java index dbf7ed5..df3d45f 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/MyShoppingCartVo.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/MyShoppingCartVo.java @@ -56,7 +56,7 @@ /** * 获取返佣积分上级类型(1=直推上级,2=直帮上级) */ - private Integer superiorType; + private String superiorType; /** * 核销门店可获得服务费 */ diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/Price.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/Price.java index 729ea24..c834d14 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/Price.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/Price.java @@ -41,7 +41,7 @@ /** * 获取返佣积分上级类型(1=直推上级,2=直帮上级) */ - private Integer superiorType; + private String superiorType; /** * 核销门店可获得服务费 */ diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsArea.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsArea.java index 880312c..9e951a6 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsArea.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsArea.java @@ -11,6 +11,7 @@ import java.io.Serializable; import java.math.BigDecimal; +import java.util.List; /** * <p> @@ -94,7 +95,11 @@ @ApiModelProperty(value = "获取返佣积分上级类型(1=直推上级,2=直帮上级)") @TableField("superior_type") - private Integer superiorType; + private String superiorType; + + @ApiModelProperty(value = "获取分佣金额上级类型(1=直推上级,2=直帮上级)") + @TableField("superior_price_type") + private String superiorPriceType; @ApiModelProperty(value = "核销门店可获得服务费") @TableField("servuce_shop_charges") @@ -124,5 +129,8 @@ @TableField("bound_shop_superiors_points") private Integer boundShopSuperiorsPoints; + @TableField(exist = false) + private List<GoodsArea> goodsAreaList; + } diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsVip.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsVip.java index 07d0eb0..4828120 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsVip.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsVip.java @@ -70,11 +70,11 @@ @ApiModelProperty(value = "获取返佣积分上级类型(1=直推上级,2=直帮上级)") @TableField("superior_type") - private Integer superiorType; + private String superiorType; @ApiModelProperty(value = "获取分佣金额上级类型(1=直推上级,2=直帮上级)") @TableField("superior_price_type") - private Integer superiorPriceType; + private String superiorPriceType; @ApiModelProperty(value = "核销门店可获得服务费") @TableField("servuce_shop_charges") diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/RedPackegeSet.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/RedPackegeSet.java index bef21ce..408cd1f 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/RedPackegeSet.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/RedPackegeSet.java @@ -1,10 +1,12 @@ package com.ruoyi.other.api.domain; import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; +import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.math.BigDecimal; @@ -41,10 +43,14 @@ @ApiModelProperty(value = "开始时间") @TableField("start_time") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime startTime; @ApiModelProperty(value = "结束时间") @TableField("end_time") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime endTime; @ApiModelProperty(value = "红包金额") diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopPoint.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopPoint.java index 86ada89..49eda6f 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopPoint.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopPoint.java @@ -3,14 +3,17 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; +import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.List; /** * <p> @@ -42,11 +45,11 @@ @ApiModelProperty(value = "历史余额") @TableField("historical_point") - private BigDecimal historicalPoint; + private Integer historicalPoint; @ApiModelProperty(value = "变动金额") @TableField("variable_point") - private BigDecimal variablePoint; + private Integer variablePoint; @ApiModelProperty(value = "变动时间") @TableField("create_time") @@ -60,5 +63,39 @@ @TableField("object_id") private Long objectId; + @ApiModelProperty(value = "门店名称") + @TableField(exist = false) + private String shopName; + + @ApiModelProperty(value = "店长姓名") + @TableField(exist = false) + private String shopLeaderName; + + @ApiModelProperty(value = "联系电话") + @TableField(exist = false) + private String phone; + + @TableField(exist = false) + private List<Integer> shopIds; + + @ApiModelProperty(value = "开始时间") + @TableField(exist = false) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime startTime; + + @ApiModelProperty(value = "结束时间") + @TableField(exist = false) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime endTime; + + @TableField(exist = false) + private List<Long> userIds; + @TableField(exist = false) + private Integer pageNum; + @TableField(exist = false) + private Integer pageSize; + } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java index ce599a6..315b847 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java @@ -516,8 +516,9 @@ @GetMapping("/listByIds") - List<AppUser> listByIds(List<String> list){ - return appUserService.listByIds(list); + List<AppUser> listByIds(@RequestParam("ids") List<Long> ids){ + List<AppUser> appUsers = appUserService.listByIds(ids); + return appUsers; } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java index 780bc3d..fcd824e 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java @@ -129,7 +129,6 @@ @GetMapping("/list") @ApiOperation(value = "积分变更记录", tags = "管理后台-财务统计-用户积分统计") public R<IPage<UserPoint>> list(UserPoint userPoint) { - System.out.println("1111111111111111111111"); IPage<UserPoint> userPointPage = userPointService.getUserPointPage(Page.of(userPoint.getPageNum(), userPoint.getPageSize()), userPoint); return R.ok(userPointPage); } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java index 893ae60..2c2a3cc 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java @@ -3,12 +3,17 @@ 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.page.TableDataInfo; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.order.model.Order; import com.ruoyi.order.model.RefundPass; import com.ruoyi.order.service.OrderService; import com.ruoyi.order.service.RefundPassService; import com.ruoyi.order.vo.ApplyRefundPass; +import com.ruoyi.order.vo.OrderRefundPassList; +import com.ruoyi.order.vo.OrderRefundPassListVo; +import com.ruoyi.order.vo.RefundPassInfo; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; @@ -16,6 +21,7 @@ import javax.annotation.Resource; import java.util.Arrays; +import java.util.List; /** * <p> @@ -27,7 +33,7 @@ */ @RestController @RequestMapping("/refund-pass") -public class RefundPassController { +public class RefundPassController extends BaseController { @Resource @@ -119,5 +125,54 @@ return R.ok(); } + + + @ResponseBody + @GetMapping("/getOrderRefundPassList") + @ApiOperation(value = "获取售后列表数据", tags = {"管理后台-售后管理", "门店后台-售后管理"}) + public TableDataInfo<OrderRefundPassList> getOrderRefundPassList(OrderRefundPassListVo refundPassListVo){ + startPage(); + List<OrderRefundPassList> orderRefundPassList = refundPassService.getOrderRefundPassList(refundPassListVo); + return getDataTable(orderRefundPassList); + } + + + @ResponseBody + @PostMapping("/authPassStatus/{id}/{status}") + @ApiOperation(value = "审核售后", tags = {"管理后台-售后管理", "门店后台-售后管理"}) + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "售后数据id", required = true, dataType = "long"), + @ApiImplicitParam(name = "status", value = "审核状态(2=同意,3=拒绝)", required = true, dataType = "int"), + @ApiImplicitParam(name = "passRemark", value = "审核备注", required = false, dataType = "string"), + }) + public R authPassStatus(@PathVariable("id") Long id, @PathVariable("status") Integer status, @RequestParam("passRemark") String passRemark){ + return refundPassService.authPassStatus(id, status, passRemark); + } + + + @ResponseBody + @PutMapping("/refundPassReceive/{id}") + @ApiOperation(value = "售后确认收货操作", tags = {"管理后台-售后管理"}) + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "售后数据id", required = true, dataType = "long"), + }) + public R refundPassReceive(@PathVariable("id") Long id){ + return refundPassService.refundPassReceive(id); + } + + + + @ResponseBody + @GetMapping("/getRefundPassInfo/{id}") + @ApiOperation(value = "获取售后数据详情", tags = {"管理后台-售后管理", "门店后台-售后管理"}) + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "售后数据id", required = true, dataType = "long"), + }) + public R<RefundPassInfo> getRefundPassInfo(@PathVariable("id") Long id){ + RefundPassInfo refundPassInfo = refundPassService.getRefundPassInfo(id); + return R.ok(refundPassInfo); + } + + } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/RefundPassMapper.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/RefundPassMapper.java index f735924..afbd8e1 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/RefundPassMapper.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/RefundPassMapper.java @@ -2,6 +2,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.order.model.RefundPass; +import com.ruoyi.order.vo.OrderRefundPassList; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * <p> @@ -12,5 +16,18 @@ * @since 2024-11-21 */ public interface RefundPassMapper extends BaseMapper<RefundPass> { + + + /** + * 管理后台获取售后管理列表数据 + * @param code 订单号 + * @param appUserIds 下单用户id + * @param refundMethod 售后类型 + * @param status 售后状态 + * @return + */ + List<OrderRefundPassList> getOrderRefundPassList(@Param("code") String code, @Param("appUserIds") List<Long> appUserIds, + @Param("shopId") Integer shopId, @Param("refundMethod") Integer refundMethod, + @Param("status") Integer status); } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java index 4ee3d67..e4474a9 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java @@ -52,6 +52,13 @@ /** + * 返回订单支付金额和回退积分和会员等级 + * @param order + */ + void refundPayMoney(Order order); + + + /** * 收货操作 * @param orderId * @return diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/RefundPassService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/RefundPassService.java index f14246e..90355f6 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/RefundPassService.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/RefundPassService.java @@ -4,6 +4,13 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.order.model.RefundPass; import com.ruoyi.order.vo.ApplyRefundPass; +import com.ruoyi.order.vo.OrderRefundPassList; +import com.ruoyi.order.vo.OrderRefundPassListVo; +import com.ruoyi.order.vo.RefundPassInfo; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; /** * <p> @@ -21,5 +28,37 @@ * @return */ R applyRefundPass(ApplyRefundPass applyRefundPass); - + + + /** + * 管理后台获取售后管理列表数据 + * @return + */ + List<OrderRefundPassList> getOrderRefundPassList(OrderRefundPassListVo refundPassListVo); + + + /** + * 售后订单审核操作 + * @param id + * @param status + * @param passRemark + * @return + */ + R authPassStatus(Long id, Integer status, String passRemark); + + + /** + * 售后确认收货操作 + * @param id + * @return + */ + R refundPassReceive(Long id); + + + /** + * 获取售后详情 + * @param id + * @return + */ + RefundPassInfo getRefundPassInfo(Long id); } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java index b31cce9..4bedbeb 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java @@ -95,8 +95,8 @@ for (OrderGood og : v) {// 累计分销金额 // 直推上级分佣金额 - Integer superiorType = og.getSuperiorType(); - if (superiorType == 1 && inviteUser != null){ + String superiorType = og.getSuperiorType(); + if (superiorType.contains("1") && inviteUser != null){ // 分佣金额 BigDecimal superiorSubcommission = og.getSuperiorSubcommission(); BigDecimal totalDistributionAmount = inviteUser.getTotalDistributionAmount(); @@ -112,7 +112,7 @@ appUserClient.editAppUserById(inviteUser); }else // 直帮上级分佣金额 - if (superiorType == 2 && superiorLeader != null){ + if (superiorType.contains("2") && superiorLeader != null){ // 分佣金额 BigDecimal superiorSubcommission = og.getSuperiorSubcommission(); BigDecimal totalDistributionAmount = superiorLeader.getTotalDistributionAmount(); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java index ac220ed..f68a9d5 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java @@ -341,6 +341,16 @@ } order.setOrderStatus(5); this.updateById(order); + refundPayMoney(order); + return R.ok(); + } + + + /** + * 返回订单支付金额和回退积分和会员等级 + * @param order + */ + public void refundPayMoney(Order order){ //开始退款 Integer payMethod = order.getPayMethod(); BigDecimal paymentAmount = order.getPaymentAmount(); @@ -350,16 +360,16 @@ } if(2 == payMethod){ //余额退款 - OrderBalancePayment orderBalancePayment = orderBalancePaymentService.getOne(new LambdaQueryWrapper<OrderBalancePayment>().eq(OrderBalancePayment::getOrderId, orderId)); + OrderBalancePayment orderBalancePayment = orderBalancePaymentService.getOne(new LambdaQueryWrapper<OrderBalancePayment>().eq(OrderBalancePayment::getOrderId, order.getId())); BigDecimal balance = appUser.getBalance(); appUser.setTotalRedPacketAmount(appUser.getTotalRedPacketAmount().add(orderBalancePayment.getRedPacketAmount()).setScale(2, RoundingMode.HALF_EVEN)); appUser.setTotalDistributionAmount(appUser.getTotalDistributionAmount().add(orderBalancePayment.getDistributionAmount()).setScale(2, RoundingMode.HALF_EVEN)); appUser.setBalance(balance.add(paymentAmount).setScale(2, RoundingMode.HALF_EVEN)); appUser.setShopAmount(appUser.getShopAmount().subtract(paymentAmount).setScale(2, RoundingMode.HALF_EVEN)); - + //构建账户余额流水明细 BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord(); - balanceChangeRecord.setOrderId(orderId); + balanceChangeRecord.setOrderId(order.getId()); balanceChangeRecord.setAppUserId(order.getAppUserId()); balanceChangeRecord.setChangeType(6); balanceChangeRecord.setBeforeAmount(balance); @@ -373,7 +383,7 @@ if(3 == payMethod){ //积分退款 appUser.setLavePoint(appUser.getLavePoint() + order.getPoint()); - + //开始运费退款,积分支付,运费是单独进行支付的,所以需要单独退款 if(null != order.getExpressAmount() && BigDecimal.ZERO.compareTo(order.getExpressAmount()) < 0){ BigDecimal expressAmount = order.getExpressAmount(); @@ -382,14 +392,14 @@ } if(2 == order.getExpressPayMethod()){ //余额退款 - OrderBalancePayment orderBalancePayment = orderBalancePaymentService.getOne(new LambdaQueryWrapper<OrderBalancePayment>().eq(OrderBalancePayment::getOrderId, orderId)); + OrderBalancePayment orderBalancePayment = orderBalancePaymentService.getOne(new LambdaQueryWrapper<OrderBalancePayment>().eq(OrderBalancePayment::getOrderId, order.getId())); BigDecimal balance = appUser.getBalance(); appUser.setTotalRedPacketAmount(appUser.getTotalRedPacketAmount().add(orderBalancePayment.getRedPacketAmount()).setScale(2, RoundingMode.HALF_EVEN)); appUser.setTotalDistributionAmount(appUser.getTotalDistributionAmount().add(orderBalancePayment.getDistributionAmount()).setScale(2, RoundingMode.HALF_EVEN)); appUser.setBalance(balance.add(expressAmount).setScale(2, RoundingMode.HALF_EVEN)); //构建账户余额流水明细 BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord(); - balanceChangeRecord.setOrderId(orderId); + balanceChangeRecord.setOrderId(order.getId()); balanceChangeRecord.setAppUserId(order.getAppUserId()); balanceChangeRecord.setChangeType(6); balanceChangeRecord.setBeforeAmount(balance); @@ -425,10 +435,9 @@ userPoint.setBalance(appUser.getLavePoint()); userPoint.setCreateTime(LocalDateTime.now()); userPoint.setAppUserId(order.getAppUserId()); - userPoint.setObjectId(orderId); + userPoint.setObjectId(order.getId()); userPointClient.saveUserPoint(userPoint); appUserClient.editAppUserById(appUser); - return R.ok(); } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java index b468e51..8e36fdf 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java @@ -4,20 +4,33 @@ import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +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.utils.StringUtils; +import com.ruoyi.common.core.utils.bean.BeanUtils; +import com.ruoyi.common.security.service.TokenService; import com.ruoyi.order.mapper.RefundPassMapper; import com.ruoyi.order.model.Order; import com.ruoyi.order.model.RefundPass; import com.ruoyi.order.service.OrderService; import com.ruoyi.order.service.RefundPassService; -import com.ruoyi.order.vo.ApplyRefundPass; +import com.ruoyi.order.vo.*; import com.ruoyi.other.api.domain.BaseSetting; import com.ruoyi.other.api.feignClient.BaseSettingClient; +import com.ruoyi.other.api.feignClient.ShopClient; +import com.ruoyi.other.api.feignClient.TechnicianClient; +import com.ruoyi.system.api.domain.SysUser; +import com.ruoyi.system.api.feignClient.SysUserClient; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.time.LocalDateTime; import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; /** * <p> @@ -35,6 +48,13 @@ @Resource private BaseSettingClient baseSettingClient; + @Resource + private AppUserClient appUserClient; + @Resource + private TokenService tokenService; + + @Resource + private SysUserClient sysUserClient; @@ -80,4 +100,123 @@ orderService.updateById(order); return R.ok(); } + + + /** + * 管理后台获取售后管理列表数据 + * @return + */ + @Override + public List<OrderRefundPassList> getOrderRefundPassList(OrderRefundPassListVo refundPassListVo) { + Long userid = tokenService.getLoginUser().getUserid(); + SysUser sysUser = sysUserClient.getSysUser(userid).getData(); + Integer shopId = null; + if(2 == sysUser.getRoleType()){ + shopId = sysUser.getObjectId(); + } + List<Long> appUserIds = new ArrayList<>(); + //搜索条件,用户姓名 + if(StringUtils.isNotEmpty(refundPassListVo.getName())){ + List<AppUser> data = appUserClient.getAppUserByName(refundPassListVo.getName()).getData(); + List<Long> collect = data.stream().map(AppUser::getId).collect(Collectors.toList()); + appUserIds.addAll(collect); + } + //搜索条件,用户电话 + if(StringUtils.isNotEmpty(refundPassListVo.getPhone())){ + List<AppUser> data = appUserClient.getAppUserByPhone(refundPassListVo.getPhone()).getData(); + List<Long> collect = data.stream().map(AppUser::getId).collect(Collectors.toList()); + appUserIds.addAll(collect); + } + List<OrderRefundPassList> orderRefundPassList = this.baseMapper.getOrderRefundPassList(refundPassListVo.getCode(), appUserIds, shopId, refundPassListVo.getRefundMethod(), refundPassListVo.getStatus()); + for (OrderRefundPassList refundPassList : orderRefundPassList) { + AppUser appUser = appUserClient.getAppUserById(refundPassList.getAppUserId()); + refundPassList.setUserName(appUser.getName()); + refundPassList.setPhone(appUser.getPhone()); + } + return orderRefundPassList; + } + + + /** + * 售后订单审核操作 + * @param id + * @param status + * @param passRemark + * @return + */ + @Override + public R authPassStatus(Long id, Integer status, String passRemark) { + RefundPass refundPass = this.getById(id); + if(refundPass.getPassStatus() != 1){ + return R.fail("不能重复操作"); + } + refundPass.setPassStatus(status); + //退货退款 + if(refundPass.getRefundMethod() == 1 && 2 == status){ + refundPass.setStatus(4); + } + if(refundPass.getRefundMethod() == 2 && 2 == status){ + refundPass.setStatus(2); + } + refundPass.setPassRemark(passRemark); + this.updateById(refundPass); + //仅退款的售后需要将支付金额原路返回,然后再扣减支付获得的积分 + if(refundPass.getRefundMethod() == 2 && 2 == status){ + Order order = orderService.getById(refundPass.getOrderId()); + order.setOrderStatus(6); + orderService.updateById(order); + //返回订单支付金额和回退积分和会员等级 + orderService.refundPayMoney(order); + } + return R.ok(); + } + + + /** + * 售后确认收货操作 + * @param id + * @return + */ + @Override + public R refundPassReceive(Long id) { + RefundPass refundPass = this.getById(id); + if(refundPass.getPassStatus() != 2){ + return R.fail("操作失败"); + } + if(refundPass.getStatus() != 5){ + return R.fail("操作失败"); + } + refundPass.setStatus(2); + this.updateById(refundPass); + //仅退款的售后需要将支付金额原路返回,然后再扣减支付获得的积分 + Order order = orderService.getById(refundPass.getOrderId()); + order.setOrderStatus(6); + orderService.updateById(order); + //返回订单支付金额和回退积分和会员等级 + orderService.refundPayMoney(order); + return R.ok(); + } + + + /** + * 获取售后详情 + * @param id + * @return + */ + @Override + public RefundPassInfo getRefundPassInfo(Long id) { + RefundPass refundPass = this.getById(id); + OrderInfoVo orderInfo = orderService.getOrderInfo(refundPass.getOrderId()); + RefundPassInfo refundPassInfo = new RefundPassInfo(); + BeanUtils.copyBeanProp(refundPassInfo, orderInfo); + refundPassInfo.setId(id.toString()); + refundPassInfo.setPassStatus(refundPassInfo.getPassStatus()); + refundPassInfo.setPassRemark(refundPassInfo.getPassRemark()); + refundPassInfo.setPassCreateTime(refundPass.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + refundPassInfo.setRefundMethod(refundPass.getRefundMethod()); + refundPassInfo.setRefundReason(refundPass.getRefundReason()); + refundPassInfo.setUserRemark(refundPass.getUserRemark()); + refundPassInfo.setPics(refundPass.getPics()); + return refundPassInfo; + } } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java index 9519d05..08a06b7 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java @@ -258,7 +258,7 @@ price.setEarnSpendingPoints(goodsSeckill.getEarnSpendingPoints()); price.setSuperiorSubcommission(goodsSeckill.getSuperiorSubcommission()); price.setSuperiorRebatePoints(goodsSeckill.getSuperiorRebatePoints()); - price.setSuperiorType(goodsSeckill.getSuperiorType()); + price.setSuperiorType(String.valueOf(goodsSeckill.getSuperiorType())); price.setServuceShopCharges(goodsSeckill.getServuceShopCharges()); price.setServuceShopPoints(goodsSeckill.getServuceShopPoints()); price.setTechnicianPoints(goodsSeckill.getTechnicianPoints()); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassList.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassList.java new file mode 100644 index 0000000..9d4a048 --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassList.java @@ -0,0 +1,34 @@ +package com.ruoyi.order.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @Date 2024/12/16 16:09 + */ +@Data +@ApiModel +public class OrderRefundPassList { + @ApiModelProperty("售后数据id") + private String id; + @ApiModelProperty("订单编号") + private String orderNumber; + @ApiModelProperty("下单用户") + private String userName; + @ApiModelProperty("联系电话") + private String phone; + @ApiModelProperty("申请时间") + private String createTime; + @ApiModelProperty("售后类型(1退货退款2仅退款)") + private Integer refundMethod; + @ApiModelProperty("申请原因") + private String refundReason; + @ApiModelProperty("状态(1待审核2同意3拒绝)") + private Integer passStatus; + /** + * 用户id + */ + private Long appUserId; +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassListVo.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassListVo.java new file mode 100644 index 0000000..2b9ea96 --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderRefundPassListVo.java @@ -0,0 +1,25 @@ +package com.ruoyi.order.vo; + +import com.ruoyi.common.core.web.page.BasePage; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @Date 2024/12/16 16:09 + */ +@Data +@ApiModel +public class OrderRefundPassListVo extends BasePage { + @ApiModelProperty("订单编号") + private String code; + @ApiModelProperty("下单用户姓名") + private String name; + @ApiModelProperty("联系电话") + private String phone; + @ApiModelProperty("售后类型(1退货退款2仅退款)") + private Integer refundMethod; + @ApiModelProperty("售后状态(1待审核2已完成3已拒绝4待退货5待平台收货)") + private Integer status; +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/RefundPassInfo.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/RefundPassInfo.java new file mode 100644 index 0000000..36e81d5 --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/RefundPassInfo.java @@ -0,0 +1,65 @@ +package com.ruoyi.order.vo; + +import com.ruoyi.order.util.vo.QueryKD100Vo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author zhibing.pu + * @Date 2024/12/16 17:11 + */ +@Data +@ApiModel +public class RefundPassInfo { + @ApiModelProperty("数据id") + private String id; + @ApiModelProperty("订单编号") + private String orderNumber; + @ApiModelProperty("下单时间") + private String createTime; + @ApiModelProperty("订单状态(1待发货2待收货3待使用4已完成5已取消6已退款7售后中8已评价)") + private Integer orderStatus; + @ApiModelProperty("下单用户") + private String userName; + @ApiModelProperty("联系电话") + private String phone; + @ApiModelProperty("订单类型") + private String orderType; + @ApiModelProperty("核销门店") + private String shopName; + @ApiModelProperty("支付方式(1=微信,2=余额,3=积分)") + private Integer paymentMethod; + @ApiModelProperty("订单总金额") + private BigDecimal totalAmount; + @ApiModelProperty("优惠券") + private String couponName; + @ApiModelProperty("抵扣金额") + private BigDecimal discountAmount; + @ApiModelProperty("快递费") + private BigDecimal expressAmount; + @ApiModelProperty("支付金额") + private BigDecimal paymentAmount; + @ApiModelProperty("获得积分") + private Integer point; + @ApiModelProperty("商品数量") + private Integer goodsNum; + @ApiModelProperty("商品信息") + private String goodsJson; + @ApiModelProperty("审核状态(1待审核2同意3拒绝)") + private Integer passStatus; + @ApiModelProperty("审核注释") + private Integer passRemark; + @ApiModelProperty("售后申请时间") + private String passCreateTime; + @ApiModelProperty("售后类型(1退货退款2仅退款)") + private Integer refundMethod; + @ApiModelProperty("申请原因") + private String refundReason; + @ApiModelProperty("备注") + private String userRemark; + @ApiModelProperty("申请图片") + private String pics; +} diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/RefundPassMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/RefundPassMapper.xml index 2033fa7..270358b 100644 --- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/RefundPassMapper.xml +++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/RefundPassMapper.xml @@ -1,7 +1,38 @@ <?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.RefundPassMapper"> +<mapper namespace="com.ruoyi.order.mapper.RefundPassMapper"> - + <select id="getOrderRefundPassList" resultType="com.ruoyi.order.vo.OrderRefundPassList"> + select + a.id, + b.order_number as orderNumber, + b.app_user_id as appUserId, + DATE_FORMAT(a.create_time, '%Y-%m-%d %H:%m:%s') as createTime, + a.refund_method as refundMethod, + a.refund_reason as refundReason, + a.pass_status as passStatus + from t_refund_pass a + left join t_order b on (a.order_id = b.id) + where a.del_flag = 0 + <if test="null != code and '' != code"> + and b.order_number like CONCAT('%', #{code}, '%') + </if> + <if test="null != appUserIds and appUserIds.size() > 0"> + and b.app_user_id in + <foreach collection="appUserIds" item="item" index="index" open="(" separator="," close=")"> + #{item} + </foreach> + </if> + <if test="null != refundMethod"> + and a.refund_method = #{refundMethod} + </if> + <if test="null != status"> + and a.status = #{status} + </if> + <if test="null != shopId"> + and b.shop_id = #{shopId} and b.order_type = 1 + </if> + order by a.create_time desc + </select> </mapper> diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BaseSettingController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BaseSettingController.java index 18a4626..2e4356d 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BaseSettingController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BaseSettingController.java @@ -1,10 +1,13 @@ package com.ruoyi.other.controller; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.common.core.domain.R; import com.ruoyi.other.api.domain.BaseSetting; import com.ruoyi.other.service.BaseSettingService; +import com.ruoyi.other.vo.RefundPassSettingVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; @@ -56,7 +59,33 @@ } + @PostMapping("/setRefundPassSetting") + @ApiOperation(value = "保存售后设置", tags = {"管理后台-售后管理"}) + public R setRefundPassSetting(@RequestBody RefundPassSettingVo settingVo){ + BaseSetting one = baseSettingService.getOne(new LambdaQueryWrapper<BaseSetting>().eq(BaseSetting::getId, 5)); + if(null == one){ + one = new BaseSetting(); + one.setId(5); + one.setContent(JSON.toJSONString(settingVo)); + baseSettingService.save(one); + }else{ + one.setContent(JSON.toJSONString(settingVo)); + baseSettingService.updateById(one); + } + return R.ok(); + } + + @PostMapping("/getRefundPassSetting") + @ApiOperation(value = "获取售后设置", tags = {"管理后台-售后管理"}) + public R<RefundPassSettingVo> getRefundPassSetting(){ + BaseSetting one = baseSettingService.getOne(new LambdaQueryWrapper<BaseSetting>().eq(BaseSetting::getId, 5)); + if(null != one){ + RefundPassSettingVo refundPassSettingVo = JSON.parseObject(one.getContent(), RefundPassSettingVo.class); + return R.ok(refundPassSettingVo); + } + return R.ok(); + } } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java index 606861f..26e2585 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java @@ -26,10 +26,12 @@ import javax.annotation.Resource; import java.util.Arrays; +import java.util.Collection; import java.util.List; import java.time.LocalDateTime; import java.util.ArrayList; +import java.util.stream.Collectors; /** * <p> @@ -80,7 +82,8 @@ } String personIds = byId.getPersonIds(); if (StringUtils.isNotEmpty(personIds)){ - List<AppUser> appUserList = appUserClient.listByIds(Arrays.asList(personIds.split(","))); + List<Long> ids = Arrays.stream(personIds.split(",")).map(Long::valueOf).collect(Collectors.toList()); + List<AppUser> appUserList = appUserClient.listByIds(ids); byId.setAppUserList(appUserList); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsBargainPriceController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsBargainPriceController.java index 9867001..12d044e 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsBargainPriceController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsBargainPriceController.java @@ -7,10 +7,14 @@ import com.ruoyi.account.api.model.AppUser; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.page.TableDataInfo; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.other.api.domain.*; import com.ruoyi.other.api.vo.GetGoodsBargainPrice; import com.ruoyi.other.service.*; +import com.ruoyi.other.vo.ShopGoodsList; +import com.ruoyi.other.vo.ShopGoodsListVo; import com.ruoyi.system.api.model.LoginUser; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -195,5 +199,9 @@ } + + + + } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsShopController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsShopController.java index 48dfc60..00f0857 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsShopController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsShopController.java @@ -3,9 +3,14 @@ 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.page.TableDataInfo; import com.ruoyi.other.api.domain.GoodsShop; import com.ruoyi.other.api.vo.GetGoodsShopByGoodsIds; import com.ruoyi.other.service.GoodsShopService; +import com.ruoyi.other.vo.ShopGoodsList; +import com.ruoyi.other.vo.ShopGoodsListVo; +import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -21,7 +26,7 @@ */ @RestController @RequestMapping("/goods-shop") -public class GoodsShopController { +public class GoodsShopController extends BaseController { @Resource private GoodsShopService goodsShopService; @@ -54,5 +59,20 @@ .in(goodsIds.getGoodsIds() !=null ,GoodsShop::getGoodsId, goodsIds.getGoodsIds())); return R.ok(list); } + + + + @ResponseBody + @GetMapping("/getShopGoodsList") + @ApiOperation(value = "获取商品管理列表", tags = {"门店后台-商品管理"}) + public TableDataInfo<ShopGoodsList> getShopGoodsList(ShopGoodsListVo shopGoodsListVo){ + startPage(); + List<ShopGoodsList> shopGoodsList = goodsShopService.getShopGoodsList(shopGoodsListVo); + return getDataTable(shopGoodsList); + } + + + + } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RedPackegeSetController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RedPackegeSetController.java index dfef420..9a5e192 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RedPackegeSetController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RedPackegeSetController.java @@ -4,17 +4,16 @@ import com.ruoyi.account.api.model.AppUser; import com.ruoyi.common.core.domain.R; import com.ruoyi.other.api.domain.RedPackegeSet; +import com.ruoyi.other.dto.RedPackegeSetDto; import com.ruoyi.other.service.RedPackegeSetService; import io.swagger.annotations.ApiOperation; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.List; /** * <p> @@ -49,8 +48,11 @@ */ @ApiOperation(value = "获取红包配置", tags = {"管理后台-活动管理-签到红包"}) @GetMapping("/getRedPackegeSet") - public R<RedPackegeSet> getRedPackegeSet(){ - return R.ok(redPackegeSetService.getOne(null)); + public R<RedPackegeSetDto> getRedPackegeSet(){ + List<RedPackegeSet> redPackegeSetList = redPackegeSetService.list(); + RedPackegeSetDto redPackegeSetDto = new RedPackegeSetDto(); + redPackegeSetDto.setRedPackegeSets(redPackegeSetList); + return R.ok(redPackegeSetDto); } @@ -58,18 +60,12 @@ * 添加红包配置 */ @ApiOperation(value = "添加红包配置", tags = {"管理后台-活动管理-签到红包"}) - @GetMapping("/addRedPackegeSet") - public R<Void> addRedPackegeSet(RedPackegeSet redPackegeSet){ - RedPackegeSet one = redPackegeSetService.getOne(null); - if (one==null){ - redPackegeSet.setId(1); - redPackegeSetService.save(redPackegeSet); - }else { - if (one.getId()==null){ - return R.fail("参数错误"); - } - redPackegeSetService.updateById(redPackegeSet); - } + @PostMapping("/addRedPackegeSet") + @Transactional(rollbackFor = Exception.class) + public R<Void> addRedPackegeSet(@RequestBody RedPackegeSetDto redPackegeSets){ + redPackegeSetService.remove(null); + List<RedPackegeSet> redPackegeSetList = redPackegeSets.getRedPackegeSets(); + redPackegeSetService.saveBatch(redPackegeSetList); return R.ok(); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java index ecb2180..607cb6c 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java @@ -16,6 +16,8 @@ import com.ruoyi.other.service.ShopService; import com.ruoyi.other.vo.NearbyShopVO; import com.ruoyi.other.vo.ShopDetailVO; +import com.ruoyi.system.api.domain.SysUser; +import com.ruoyi.system.api.feignClient.SysUserClient; import com.ruoyi.system.api.model.LoginUser; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -51,6 +53,8 @@ private ShopScoreService shopScoreService; @Resource private TokenService tokenService; + @Resource + private SysUserClient sysUserClient; @@ -129,6 +133,38 @@ return R.ok(shopService.cheUserByPhone(phone)); } + /** + * 重置密码 + */ + @GetMapping ("/resetPassword") + @ApiOperation(value = "重置密码", tags = {"管理后台-门店管理"}) + public R<Void> resetPassword(@RequestParam(value = "ids") String ids) { + String[] idsArr = ids.split(","); + for (String id : idsArr) { + Shop shop = shopService.getById(Integer.valueOf(id)); + R<SysUser> sysUser = sysUserClient.getSysUser(shop.getAppUserId()); + SysUser userData = sysUser.getData(); + userData.setPassword(getLastSixDigits(userData.getPhonenumber())); + sysUserClient.resetPassword(userData); + } + return R.ok(); + } + + /** + * 获取手机号的后六位。 + * + * @param phoneNumber 以字符串形式提供的手机号 + * @return 手机号的后六位 + * @throws IllegalArgumentException 如果手机号长度不足六位 + */ + public String getLastSixDigits(String phoneNumber) { + if (phoneNumber == null || phoneNumber.length() < 6) { + throw new IllegalArgumentException("手机号长度不足六位"); + } + // 取字符串的最后六位 + return phoneNumber.substring(phoneNumber.length() - 6); + } + /** * 附近门店列表 diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopPointController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopPointController.java index 380d4ba..9833fce 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopPointController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopPointController.java @@ -1,12 +1,25 @@ package com.ruoyi.other.controller; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.utils.bean.BeanUtils; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.other.api.domain.ShopPoint; +import com.ruoyi.other.excel.ShopPointEX; import com.ruoyi.other.service.ShopPointService; +import com.ruoyi.other.vo.ShopPointStatistics; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModelProperty; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.List; /** * <p> @@ -27,8 +40,50 @@ /** * 门店积分统计 */ - public Object statistics() { - return shopPointService.statistics(); + @GetMapping("/statistics") + @ApiModelProperty("门店积分统计") + public R<ShopPointStatistics> statistics(ShopPoint shopPoint) { + ShopPointStatistics statistics = shopPointService.statistics(Page.of(shopPoint.getPageNum(), shopPoint.getPageSize()), shopPoint); + return R.ok(statistics); + } + + /** + * 导出门店积分统计 + */ + @GetMapping("/export") + @ApiModelProperty("导出门店积分统计") + public void export(HttpServletResponse response , ShopPoint shopPoint) { + ShopPointStatistics statistics = shopPointService.statistics(Page.of(1, Integer.MAX_VALUE), shopPoint); + if (statistics!=null){ + IPage<ShopPoint> shopPointIPage = statistics.getShopPointIPage(); + List<ShopPointEX> shopPointEXList = new ArrayList<>(); + if (shopPointIPage!=null){ + List<ShopPoint> records = shopPointIPage.getRecords(); + if (records!=null){ + for (ShopPoint record : records) { + ShopPointEX shopPointEX = new ShopPointEX(); + BeanUtils.copyBeanProp(shopPointEX, record); + Integer type = record.getType(); + switch (type) { + case 1: + shopPointEX.setType("门店业绩"); + break; + case 2: + shopPointEX.setType("门店返佣"); + break; + default: + shopPointEX.setType("下级门店返佣"); + break; + } + shopPointEXList.add(shopPointEX); + } + } + + ExcelUtil<ShopPointEX> util = new ExcelUtil<>(ShopPointEX.class); + util.exportExcel(response, shopPointEXList, "用户积分统计"); + } + } + } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipSettingController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipSettingController.java index 0fd2778..c7f9387 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipSettingController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipSettingController.java @@ -9,6 +9,7 @@ import com.ruoyi.other.api.domain.VipGood; import com.ruoyi.other.api.domain.VipSetting; import com.ruoyi.other.api.feignClient.GoodsClient; +import com.ruoyi.other.dto.SetDto; import com.ruoyi.other.dto.VipSetDto; import com.ruoyi.other.service.BaseSettingService; import com.ruoyi.other.service.VipGoodService; @@ -195,8 +196,8 @@ } @PostMapping("/manage/level/set") @ApiOperation(value = "设置", tags = {"后台-会员等级设置"}) - public R<Void> managelevelset(@RequestBody List<VipSetting> vipSettingList) { - vipSettingService.updateBatchById(vipSettingList); + public R<Void> managelevelset(@RequestBody SetDto setDto) { + vipSettingService.updateBatchById(setDto.getVipSettingList()); return R.ok(); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/dto/GoodsAreaDto.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/dto/GoodsAreaDto.java new file mode 100644 index 0000000..e020603 --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/dto/GoodsAreaDto.java @@ -0,0 +1,4 @@ +package com.ruoyi.other.dto; + +public class GoodsAreaDto { +} diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/dto/RedPackegeSetDto.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/dto/RedPackegeSetDto.java new file mode 100644 index 0000000..9744a8d --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/dto/RedPackegeSetDto.java @@ -0,0 +1,11 @@ +package com.ruoyi.other.dto; + +import com.ruoyi.other.api.domain.RedPackegeSet; +import lombok.Data; + +import java.util.List; + +@Data +public class RedPackegeSetDto { + private List<RedPackegeSet> redPackegeSets; +} diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/excel/ShopPointEX.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/excel/ShopPointEX.java new file mode 100644 index 0000000..7376059 --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/excel/ShopPointEX.java @@ -0,0 +1,37 @@ +package com.ruoyi.other.excel; + +import com.ruoyi.common.core.annotation.Excel; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class ShopPointEX { + @Excel(name = "变动类型") + private String type; + + @Excel(name = "历史余额") + private Integer historicalPoint; + + @Excel(name = "变动金额") + private Integer variablePoint; + + @Excel(name = "变动时间") + private LocalDateTime createTime; + + @Excel(name = "变动用户id") + private Long createUserId; + + @Excel(name = "关联对象id") + private Long objectId; + + @Excel(name = "门店名称") + private String shopName; + + @Excel(name = "店长姓名") + private String shopLeaderName; + + @Excel(name = "联系电话") + private String phone; + +} diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsShopMapper.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsShopMapper.java index 981cb2f..cdaa202 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsShopMapper.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsShopMapper.java @@ -2,6 +2,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.other.api.domain.GoodsShop; +import com.ruoyi.other.vo.ShopGoodsList; +import com.ruoyi.other.vo.ShopGoodsListVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * <p> @@ -12,5 +17,17 @@ * @since 2024-11-20 */ public interface GoodsShopMapper extends BaseMapper<GoodsShop> { - + + + /** + * 获取门店授权的服务商品 + * @param shopId + * @param goodsId + * @param goodsName + * @param goodsCategoryId + * @return + */ + List<ShopGoodsList> getShopGoodsList(@Param("shopId") Integer shopId, @Param("goodsId") String goodsId, + @Param("goodsName") String goodsName, @Param("goodsCategoryId") Integer goodsCategoryId); + } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopPointMapper.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopPointMapper.java index f1e5685..02355d9 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopPointMapper.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopPointMapper.java @@ -3,6 +3,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.other.api.domain.ShopPoint; +import java.util.List; + /** * <p> * Mapper 接口 @@ -13,4 +15,6 @@ */ public interface ShopPointMapper extends BaseMapper<ShopPoint> { + List<ShopPoint> findLatestChangeByType(ShopPoint shopPoint); + } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsShopService.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsShopService.java index d0e6b12..fcad894 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsShopService.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsShopService.java @@ -2,6 +2,10 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.other.api.domain.GoodsShop; +import com.ruoyi.other.vo.ShopGoodsList; +import com.ruoyi.other.vo.ShopGoodsListVo; + +import java.util.List; /** * <p> @@ -12,5 +16,11 @@ * @since 2024-11-20 */ public interface GoodsShopService extends IService<GoodsShop> { - + + /** + * 获取门店授权的服务商品 + * @param shopGoodsListVo + * @return + */ + List<ShopGoodsList> getShopGoodsList(ShopGoodsListVo shopGoodsListVo); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopPointService.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopPointService.java index efcf878..521a1b9 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopPointService.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopPointService.java @@ -1,5 +1,6 @@ package com.ruoyi.other.service; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.other.api.domain.ShopPoint; import com.ruoyi.other.vo.ShopPointStatistics; @@ -14,5 +15,5 @@ */ public interface ShopPointService extends IService<ShopPoint> { - ShopPointStatistics statistics(); + ShopPointStatistics statistics(IPage<ShopPoint> page, ShopPoint shopPoint); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java index 6e1ea7f..b080dee 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java @@ -27,10 +27,7 @@ import javax.annotation.Resource; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Objects; +import java.util.*; import java.util.stream.Collectors; /** @@ -170,24 +167,50 @@ if (CollectionUtils.isEmpty(goodsShopList)){ throw new NullPointerException("请选择指定门店"); } + for (GoodsShop goodsShop : goodsShopList) { + goodsShop.setGoodsId(goods.getId()); + goodsShop.setId(null); + } goodsShopService.saveBatch(goodsShopList); } // 指定用户 List<GoodsAppUser> goodsAppUserList = goods.getGoodsAppUserList(); if (!CollectionUtils.isEmpty(goodsAppUserList)){ + for (GoodsAppUser goodsAppUser : goodsAppUserList) { + goodsAppUser.setId(null ); + goodsAppUser.setGoodsId(goods.getId()); + } goodsAppUserService.saveBatch(goodsAppUserList); } // 会员价格配置 List<GoodsVip> goodsVipList = goods.getGoodsVipList(); + for (GoodsVip goodsVip : goodsVipList) { + goodsVip.setId(null); + goodsVip.setGoodsId(goods.getId()); + } goodsVipService.saveBatch(goodsVipList); // 特殊地区售价设置 List<GoodsArea> goodsAreaList = goods.getGoodsAreaList(); if (!CollectionUtils.isEmpty(goodsAreaList)){ - goodsAreaService.saveBatch(goodsAreaList); + for (GoodsArea goodsArea : goodsAreaList) { + List<GoodsArea> goodsAreaList1 = goodsArea.getGoodsAreaList(); + for (GoodsArea area : goodsAreaList1) { + area.setGoodsId(goods.getId()); + area.setProvince(goodsArea.getProvince()); + area.setCity(goodsArea.getCity()); + area.setDistricts(goodsArea.getDistricts()); + area.setProvinceCode(goodsArea.getProvinceCode()); + area.setCityCode(goodsArea.getCityCode()); + area.setDistrictsCode(goodsArea.getDistrictsCode()); + goodsAreaList1.add(area); + } + goodsAreaService.saveBatch(goodsAreaList1); + } } + } @Override @@ -207,7 +230,22 @@ // 特殊地区售价设置 List<GoodsArea> goodsAreaList = goods.getGoodsAreaList(); - goodsAreaService.updateBatchById(goodsAreaList); + if (!CollectionUtils.isEmpty(goodsAreaList)){ + for (GoodsArea goodsArea : goodsAreaList) { + List<GoodsArea> goodsAreaList1 = goodsArea.getGoodsAreaList(); + for (GoodsArea area : goodsAreaList1) { + area.setGoodsId(goods.getId()); + area.setProvince(goodsArea.getProvince()); + area.setCity(goodsArea.getCity()); + area.setDistricts(goodsArea.getDistricts()); + area.setProvinceCode(goodsArea.getProvinceCode()); + area.setCityCode(goodsArea.getCityCode()); + area.setDistrictsCode(goodsArea.getDistrictsCode()); + goodsAreaList1.add(area); + } + goodsAreaService.updateBatchById(goodsAreaList1); + } + } } @Override @@ -231,7 +269,19 @@ // 特殊地区售价设置 List<GoodsArea> goodsAreaList = goodsAreaService.list(new LambdaQueryWrapper<GoodsArea>() .eq(GoodsArea::getGoodsId, goodsId)); - goods.setGoodsAreaList(goodsAreaList); + + Map<String, List<GoodsArea>> listMap = goodsAreaList.stream() + .collect(Collectors.groupingBy(goodsArea -> + goodsArea.getProvinceCode() + goodsArea.getCityCode() + goodsArea.getDistrictsCode())); + + List<GoodsArea> goodsAreaList1 = new ArrayList<>(); + listMap.forEach((s, goodsAreas) -> { + GoodsArea goodsArea = goodsAreas.get(0); + goodsArea.setGoodsAreaList(goodsAreas); + goodsAreaList1.add(goodsArea); + }); + + goods.setGoodsAreaList(goodsAreaList1); return goods; } } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsShopServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsShopServiceImpl.java index 19363c4..233b2b1 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsShopServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsShopServiceImpl.java @@ -1,10 +1,18 @@ package com.ruoyi.other.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.security.service.TokenService; import com.ruoyi.other.mapper.GoodsShopMapper; import com.ruoyi.other.api.domain.GoodsShop; import com.ruoyi.other.service.GoodsShopService; +import com.ruoyi.other.vo.ShopGoodsList; +import com.ruoyi.other.vo.ShopGoodsListVo; +import com.ruoyi.system.api.domain.SysUser; +import com.ruoyi.system.api.feignClient.SysUserClient; import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; /** * <p> @@ -16,5 +24,25 @@ */ @Service public class GoodsShopServiceImpl extends ServiceImpl<GoodsShopMapper, GoodsShop> implements GoodsShopService { - + + @Resource + private TokenService tokenService; + + @Resource + private SysUserClient sysUserClient; + + + + /** + * 获取门店授权的服务商品 + * @param shopGoodsListVo + * @return + */ + @Override + public List<ShopGoodsList> getShopGoodsList(ShopGoodsListVo shopGoodsListVo) { + Long userid = tokenService.getLoginUser().getUserid(); + SysUser sysUser = sysUserClient.getSysUser(userid).getData(); + List<ShopGoodsList> shopGoodsList = this.baseMapper.getShopGoodsList(sysUser.getObjectId(), shopGoodsListVo.getId(), shopGoodsListVo.getName(), shopGoodsListVo.getGoodsCategoryId()); + return shopGoodsList; + } } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java index accf87f..9e2354a 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java @@ -1,15 +1,27 @@ package com.ruoyi.other.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.account.api.feignClient.AppUserClient; +import com.ruoyi.account.api.model.AppUser; +import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.other.api.domain.Shop; import com.ruoyi.other.mapper.ShopPointMapper; import com.ruoyi.other.api.domain.ShopPoint; import com.ruoyi.other.service.ShopPointService; +import com.ruoyi.other.service.ShopService; import com.ruoyi.other.vo.ShopPointStatistics; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import javax.annotation.Resource; +import java.util.List; +import java.util.stream.Collectors; /** * <p> - * 服务实现类 + * 服务实现类 * </p> * * @author luodangjia @@ -17,10 +29,61 @@ */ @Service public class ShopPointServiceImpl extends ServiceImpl<ShopPointMapper, ShopPoint> implements ShopPointService { + @Resource + private ShopPointMapper shopPointMapper; + @Resource + private ShopService shopService; @Override - public ShopPointStatistics statistics() { + public ShopPointStatistics statistics(IPage<ShopPoint> page, ShopPoint shopPoint) { + + String shopName = shopPoint.getShopName(); + String phone = shopPoint.getPhone(); + String shopLeaderName = shopPoint.getShopLeaderName(); + if (StringUtils.isNotEmpty(shopName) || StringUtils.isNotEmpty(phone) || StringUtils.isNotEmpty(shopLeaderName)) { + List<Integer> shopIds = shopService.listObjs(new LambdaQueryWrapper<Shop>() + .select(Shop::getId) + .like(StringUtils.isNotEmpty(shopName), Shop::getName, shopName) + .like(StringUtils.isNotEmpty(phone), Shop::getPhone, phone) + .like(StringUtils.isNotEmpty(shopLeaderName), Shop::getShopManager, shopLeaderName)) + .stream().map(o -> (Integer) o).collect(Collectors.toList()); + + shopPoint.setShopIds(shopIds); + } + + ShopPointStatistics shopPointStatistics = new ShopPointStatistics(); - return null; + List<ShopPoint> latestChangeByType = shopPointMapper.findLatestChangeByType(shopPoint); + for (ShopPoint sp : latestChangeByType) { + switch (sp.getType()) { + case 1: + shopPointStatistics.setShopPoint(sp.getVariablePoint()); + break; + case 2: + shopPointStatistics.setShopCommissionPoint(sp.getVariablePoint()); + break; + case 3: + shopPointStatistics.setSubShopCommissionPoint(sp.getVariablePoint()); + break; + } + } + shopPointStatistics.setTotalPoint(shopPointStatistics.getShopPoint() + shopPointStatistics.getShopCommissionPoint() + shopPointStatistics.getSubShopCommissionPoint()); + + + boolean condition = shopPoint.getStartTime() != null && shopPoint.getEndTime() != null; + IPage<ShopPoint> shopPointIPage = page(page, new LambdaQueryWrapper<ShopPoint>() + .in(!CollectionUtils.isEmpty(shopPoint.getShopIds()), ShopPoint::getShopId, shopPoint.getShopIds()) + .eq(shopPoint.getType() != null, ShopPoint::getType, shopPoint.getType()) + .between(condition, ShopPoint::getCreateTime, shopPoint.getStartTime(), shopPoint.getEndTime()) + .orderByDesc(ShopPoint::getCreateTime)); + List<ShopPoint> shopPoints = shopPointIPage.getRecords(); + for (ShopPoint sp : shopPoints) { + Shop shop = shopService.getById(sp.getShopId()); + sp.setShopName(shop.getName()); + sp.setShopLeaderName(shop.getShopManager()); + sp.setPhone(shop.getPhone()); + } + shopPointStatistics.setShopPointIPage(shopPointIPage); + return shopPointStatistics; } } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/RefundPassSettingVo.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/RefundPassSettingVo.java new file mode 100644 index 0000000..04206a8 --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/RefundPassSettingVo.java @@ -0,0 +1,22 @@ +package com.ruoyi.other.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @Date 2024/12/16 15:55 + */ +@Data +@ApiModel +public class RefundPassSettingVo { + @ApiModelProperty("收货人姓名") + private String name; + @ApiModelProperty("收货人电话") + private String phone; + @ApiModelProperty("收货地址") + private String address; + @ApiModelProperty("售后周期") + private Integer days; +} diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopGoodsList.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopGoodsList.java new file mode 100644 index 0000000..53c21eb --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopGoodsList.java @@ -0,0 +1,20 @@ +package com.ruoyi.other.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @Date 2024/12/16 17:32 + */ +@Data +@ApiModel +public class ShopGoodsList { + @ApiModelProperty("商品id") + private String id; + @ApiModelProperty("商品名称") + private String name; + @ApiModelProperty("商品分类") + private String goodsCategory; +} diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopGoodsListVo.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopGoodsListVo.java new file mode 100644 index 0000000..37052b1 --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopGoodsListVo.java @@ -0,0 +1,21 @@ +package com.ruoyi.other.vo; + +import com.ruoyi.common.core.web.page.BasePage; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @Date 2024/12/16 17:32 + */ +@Data +@ApiModel +public class ShopGoodsListVo extends BasePage { + @ApiModelProperty("商品id") + private String id; + @ApiModelProperty("商品名称") + private String name; + @ApiModelProperty("商品分类id") + private Integer goodsCategoryId; +} diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopPointStatistics.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopPointStatistics.java index 6cae81e..79f8376 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopPointStatistics.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopPointStatistics.java @@ -1,5 +1,6 @@ package com.ruoyi.other.vo; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.ruoyi.other.api.domain.ShopPoint; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -35,5 +36,5 @@ @ApiModelProperty("下级门店返佣积分") private Integer subShopCommissionPoint; - private List<ShopPoint> shopPointList; + private IPage<ShopPoint> shopPointIPage; } diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml index 2991551..da58bb9 100644 --- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml @@ -31,28 +31,28 @@ tgc.`name`, tg.operating_cost, tg.shop_cost, - tg.`status` + tg.`status`, + tg.purchase_limit, + tg.sale_num FROM t_goods tg LEFT JOIN t_goods_category tgc ON tg.goods_category_id = tgc.id <where> tg.del_flag = 0 <if test="goods.id != null"> - <if test="goods.id != null"> - and tg.id = #{goods.id} - </if> - <if test="goods.name != null and goods.name != ''"> - and tg.`name` like concat('%',#{goods.name},'%') - </if> - <if test="goods.type != null"> - and tg.type = #{goods.type} - </if> - <if test="goods.goodsCategoryId != null"> - and tg.goodsCategoryId = #{goods.goodsCategoryId} - </if> - <if test="goods.status != null"> - and tg.`status` = #{goods.status} - </if> + and tg.id = #{goods.id} + </if> + <if test="goods.name != null and goods.name != ''"> + and tg.`name` like concat('%',#{goods.name},'%') + </if> + <if test="goods.type != null"> + and tg.type = #{goods.type} + </if> + <if test="goods.goodsCategoryId != null"> + and tg.goods_category_id = #{goods.goodsCategoryId} + </if> + <if test="goods.status != null"> + and tg.`status` = #{goods.status} </if> </where> </select> diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsShopMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsShopMapper.xml new file mode 100644 index 0000000..b752a2b --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsShopMapper.xml @@ -0,0 +1,24 @@ +<?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.GoodsShopMapper"> + + <select id="getShopGoodsList" resultType="com.ruoyi.other.vo.ShopGoodsList"> + select + a.id, + a.name, + b.name as goodsCategory + from t_goods a + left join t_goods_category b on (a.goods_category_id = b.id) + where a.type = 1 and a.del_flag = 0 and a.status = 2 and (a.appoint_store = 2 or a.id in (select goods_id from t_goods_shop where shop_id = #{shopId})) + <if test="null != goodsId and '' != goodsId"> + and a.id like CONCAT('%', #{goodsId}, '%') + </if> + <if test="null != goodsName and '' != goodsName"> + and a.name like CONCAT('%', #{goodsName}, '%') + </if> + <if test="null != goodsCategoryId"> + and a.goods_category_id = #{goodsCategoryId} + </if> + order by a.create_time desc + </select> +</mapper> \ No newline at end of file diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml new file mode 100644 index 0000000..51e5f7e --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml @@ -0,0 +1,48 @@ +<?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.ShopPointMapper"> + + <select id="findLatestChangeByType" resultType="com.ruoyi.other.api.domain.ShopPoint"> + SELECT + id, + shop_id, + type, + historical_point, + variable_point, + create_time, + create_user_id, + object_id + FROM + ( + SELECT + id, + shop_id, + type, + historical_point, + variable_point, + create_time, + create_user_id, + object_id, + ROW_NUMBER() OVER ( PARTITION BY type ORDER BY create_time DESC ) AS rn + FROM + t_shop_point + + <where> + <if test="shopIds != null and shopIds.size() > 0"> + AND shop_id IN + <foreach collection="shopIds" item="shopId" open="(" close=")" separator=","> + #{shopId} + </foreach> + </if> + <if test="type != null"> + AND `type` = #{type} + </if> + <if test="startTime != null and endTime != null"> + AND create_time BETWEEN #{startTime} AND #{endTime} + </if> + </where> + ) AS subquery + WHERE + rn = 1 + </select> +</mapper> \ No newline at end of file -- Gitblit v1.7.1