Merge remote-tracking branch 'origin/feature/mall_product'
commit
496ffbe2f9
|
@ -36,5 +36,9 @@ public class AliPayProperties {
|
|||
* 回调地址.
|
||||
*/
|
||||
private String notifyUrl;
|
||||
/**
|
||||
* 回调地址.
|
||||
*/
|
||||
private String refundNotify;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
package cn.iocoder.yudao.module.shop.request.member;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Title:AlipayNotifyParamRequest
|
||||
* @Description: TODO
|
||||
* @author: tangqian
|
||||
* @date: 2023/5/19 10:27
|
||||
* @version: V1.0.0
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AlipayNotifyParamRequest implements Serializable {
|
||||
private static final long serialVersionUID = 5839750515063699319L;
|
||||
private String appId;
|
||||
private String tradeNo; // 支付宝交易凭证号
|
||||
private String outTradeNo; // 原支付请求的商户订单号
|
||||
private String outBizNo; // 商户业务ID,主要是退款通知中返回退款申请的流水号
|
||||
private String buyerId; // 买家支付宝账号对应的支付宝唯一用户号。以2088开头的纯16位数字
|
||||
private String buyerLogonId; // 买家支付宝账号
|
||||
private String sellerId; // 卖家支付宝用户号
|
||||
private String sellerEmail; // 卖家支付宝账号
|
||||
private String tradeStatus; // 交易目前所处的状态,见交易状态说明
|
||||
private String totalAmount; // 本次交易支付的订单金额
|
||||
private String receiptAmount; // 商家在交易中实际收到的款项
|
||||
private String buyerPayAmount; // 用户在交易中支付的金额
|
||||
private String refundFee; // 退款通知中,返回总退款金额,单位为元,支持两位小数
|
||||
private String subject; // 商品的标题/交易标题/订单标题/订单关键字等
|
||||
private String body; // 该订单的备注、描述、明细等。对应请求时的body参数,原样通知回来
|
||||
private Date gmtCreate; // 该笔交易创建的时间。格式为yyyy-MM-dd HH:mm:ss
|
||||
private Date gmtPayment; // 该笔交易的买家付款时间。格式为yyyy-MM-dd HH:mm:ss
|
||||
private Date notifyTime; // 通知时间。格式为yyyy-MM-dd HH:mm:ss
|
||||
private Date gmtRefund; // 该笔交易的退款时间。格式为yyyy-MM-dd HH:mm:ss.S
|
||||
private Date gmtClose; // 该笔交易结束时间。格式为yyyy-MM-dd HH:mm:ss
|
||||
private String fundBillList; // 支付成功的各个渠道金额信息,array
|
||||
private String passbackParams; // 公共回传参数,如果请求时传递了该参数,则返回给商户时会在异步通知时将该参数原样返回。
|
||||
private String authAppId;
|
||||
private String notifyId;
|
||||
private String notifyType;
|
||||
private String version;
|
||||
private String invoiceAmount;//交易中可给用户开具发票的金额
|
||||
}
|
|
@ -7,6 +7,7 @@ import lombok.experimental.Accessors;
|
|||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -43,7 +44,7 @@ public class OrderContentRequest implements Serializable {
|
|||
private static final long serialVersionUID = -4967251473044468810L;
|
||||
@Schema(description = "订单id")
|
||||
@NotNull(message = "挡位id不能为空")
|
||||
private String gearId;
|
||||
private Long gearId;
|
||||
|
||||
@Schema(description = "档位名称")
|
||||
@NotEmpty(message = "挡位名称不能为空")
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
package cn.iocoder.yudao.module.shop.controller.admin.notify;
|
||||
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
|
||||
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderMapper;
|
||||
import cn.iocoder.yudao.module.shop.service.order.StoreOrderService;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.binarywang.wxpay.bean.notify.OriginNotifyResponse;
|
||||
import com.github.binarywang.wxpay.bean.notify.SignatureHeader;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result;
|
||||
|
@ -19,6 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -38,6 +43,8 @@ public class WxPayNotifyController {
|
|||
|
||||
@Autowired
|
||||
private StoreOrderService storeOrderService;
|
||||
@Autowired
|
||||
private RechargeOrderMapper rechargeOrderMapper;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -113,13 +120,21 @@ public class WxPayNotifyController {
|
|||
log.info("退款原始通知=" + JSONUtil.toJsonPrettyStr(jsonData));
|
||||
try {
|
||||
//解密后的数据
|
||||
v3Result = wxPayService.parseRefundNotifyV3Result(JSONUtil.toJsonPrettyStr(notifyResponse), this.getRequestHeader(request));
|
||||
v3Result = wxPayService.parseRefundNotifyV3Result(jsonData, this.getRequestHeader(request));
|
||||
WxPayRefundNotifyV3Result.DecryptNotifyResult result = v3Result.getResult();
|
||||
log.info("退款通知=" + JSONUtil.toJsonPrettyStr(result));
|
||||
//退款状态
|
||||
if (StringUtils.equals("SUCCESS", result.getRefundId())) {
|
||||
if (StringUtils.equals("SUCCESS", result.getRefundStatus())) {
|
||||
log.info("微信退款回调成功");
|
||||
// 验证相关参数-金额
|
||||
// 用户支付金额
|
||||
BigDecimal payerTotal = NumberUtil.div(result.getAmount().getPayerTotal() + "", "100", 2);
|
||||
// 处理相关逻辑
|
||||
RechargeOrderDO orderDO = rechargeOrderMapper.selectOne(Wrappers.<RechargeOrderDO>lambdaQuery().eq(RechargeOrderDO::getOrderId, result.getOutRefundNo()));
|
||||
if (payerTotal.compareTo(orderDO.getPayPrice()) != 0) {
|
||||
log.error("支付金额不匹配,订单实际支付金额:{},微信入参验证金额:{}", orderDO.getPayPrice(), payerTotal);
|
||||
return "failure";
|
||||
}
|
||||
// 修改订单状态
|
||||
// 写入
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package cn.iocoder.yudao.module.shop.controller.admin.recharge;
|
||||
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.method.Excel;
|
||||
import cn.iocoder.yudao.module.shop.convert.recharge.RechargeOrderInfoConvert;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderInfoDO;
|
||||
|
@ -46,7 +48,7 @@ public class RechargeOrderController {
|
|||
@PostMapping("/create")
|
||||
@Operation(summary = "创建订单")
|
||||
@PreAuthorize("@ss.hasPermission('shop:recharge-order:create')")
|
||||
public CommonResult<Integer> createRechargeOrder(@Valid @RequestBody RechargeOrderCreateReqVO createReqVO) {
|
||||
public CommonResult<Long> createRechargeOrder(@Valid @RequestBody RechargeOrderCreateReqVO createReqVO) {
|
||||
return success(rechargeOrderService.createRechargeOrder(createReqVO));
|
||||
}
|
||||
|
||||
|
@ -88,7 +90,9 @@ public class RechargeOrderController {
|
|||
@GetMapping("/page")
|
||||
@Operation(summary = "获得订单分页")
|
||||
@PreAuthorize("@ss.hasPermission('shop:recharge-order:query')")
|
||||
@TenantIgnore
|
||||
public CommonResult<PageResult<RechargeOrderRespVO>> getRechargeOrderPage(@Valid RechargeOrderPageReqVO pageVO) {
|
||||
pageVO.setTenantId(SecurityFrameworkUtils.getLoginUser().getTenantId());
|
||||
PageResult<RechargeOrderRespVO> pageResult = rechargeOrderService.getRechargeOrderPage(pageVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
@ -98,18 +102,17 @@ public class RechargeOrderController {
|
|||
@Operation(summary = "导出订单 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('shop:recharge-order:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
@TenantIgnore
|
||||
public void exportRechargeOrderExcel(@Valid RechargeOrderExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<RechargeOrderDO> list = rechargeOrderService.getRechargeOrderList(exportReqVO);
|
||||
ArrayList<String> s = new ArrayList<>();
|
||||
List<RechargeOrderExcelVO> list = rechargeOrderService.findListExcel(exportReqVO);
|
||||
ArrayList<Long> s = new ArrayList<>();
|
||||
list.forEach(x -> {
|
||||
s.add(x.getOrderId());
|
||||
s.add(x.getId());
|
||||
});
|
||||
List<RechargeOrderInfoDO> infoList = rechargeOrderInfoService.getRechargeOrderInfoList(s);
|
||||
List<RechargeOrderInfoExcelVO> infoList = rechargeOrderInfoService.getRechargeOrderInfoListExcel(s);
|
||||
// 导出 Excel
|
||||
List<RechargeOrderExcelVO> datas = RechargeOrderConvert.INSTANCE.convertList02(list);
|
||||
List<RechargeOrderInfoExcelVO> infoDatas = RechargeOrderInfoConvert.INSTANCE.convertList02(infoList);
|
||||
|
||||
Excel.orderExport(response, datas, infoDatas);
|
||||
Excel.orderExport(response, list, infoList);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*;
|
|||
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderInfoDO;
|
||||
import cn.iocoder.yudao.module.shop.convert.recharge.RechargeOrderInfoConvert;
|
||||
import cn.iocoder.yudao.module.shop.service.recharge.RechargeOrderInfoService;
|
||||
import sun.rmi.runtime.Log;
|
||||
|
||||
@Tag(name = "管理后台 - 订单购物详情")
|
||||
@RestController
|
||||
|
@ -40,7 +41,7 @@ public class RechargeOrderInfoController {
|
|||
@PostMapping("/create")
|
||||
@Operation(summary = "创建订单购物详情")
|
||||
@PreAuthorize("@ss.hasPermission('shop:recharge-order-info:create')")
|
||||
public CommonResult<Integer> createRechargeOrderInfo(@Valid @RequestBody RechargeOrderInfoCreateReqVO createReqVO) {
|
||||
public CommonResult<Long> createRechargeOrderInfo(@Valid @RequestBody RechargeOrderInfoCreateReqVO createReqVO) {
|
||||
return success(rechargeOrderInfoService.createRechargeOrderInfo(createReqVO));
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo;
|
|||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
|
@ -24,6 +26,13 @@ public class RechargeGearBaseVO {
|
|||
|
||||
@Schema(description = "档位显示金额", required = true)
|
||||
@NotNull(message = "档位显示金额不能为空")
|
||||
private Integer gearAmount;
|
||||
private BigDecimal gearAmount;
|
||||
|
||||
/**
|
||||
* 返费金额
|
||||
*/
|
||||
@Schema(description = "返费金额", required = true)
|
||||
@NotNull(message = "返费金额不能为空")
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import java.time.LocalDateTime;
|
|||
public class RechargeGearRespVO extends RechargeGearBaseVO {
|
||||
|
||||
@Schema(description = "主键", required = true, example = "3324")
|
||||
private String id;
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
|
|
@ -14,36 +14,43 @@ import java.time.LocalDateTime;
|
|||
@Data
|
||||
public class RechargeOrderExcelVO {
|
||||
|
||||
@ExcelProperty("订单号")
|
||||
|
||||
@ExcelProperty("订单id")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("订单编号")
|
||||
private String orderId;
|
||||
|
||||
@ExcelProperty("第三方支付流水号")
|
||||
@ExcelProperty("交易流水号")
|
||||
private String paySerialNumber;
|
||||
@ExcelProperty("商户名称")
|
||||
private String tenantName;
|
||||
|
||||
@ExcelProperty("支付时间")
|
||||
@ExcelProperty("订单支付时间")
|
||||
private LocalDateTime payTime;
|
||||
//:0-普通订单,1-视频号订单
|
||||
|
||||
@ExcelProperty("交易完成时间")
|
||||
private LocalDateTime payCompleteTime;
|
||||
@ExcelProperty("订单类型")
|
||||
private Integer type;
|
||||
//(0:待发货;1:待收货;2:已收货,待评价;3:已完成;)
|
||||
private String type="普通订单";
|
||||
@ExcelProperty("订单状态")
|
||||
private String status;
|
||||
private String status="已经完成";
|
||||
|
||||
@ExcelProperty("配送方式")
|
||||
private String deliveryType;
|
||||
private String deliveryType="快递(系统快递)(系统快递)";
|
||||
|
||||
@ExcelProperty("用户姓名")
|
||||
@ExcelProperty("姓名")
|
||||
private String realName;
|
||||
|
||||
@ExcelProperty("用户电话")
|
||||
@ExcelProperty("充值号码")
|
||||
private String userPhone;
|
||||
|
||||
@ExcelProperty("确认手机号")
|
||||
@ExcelProperty("确认号码")
|
||||
private String confirmPhone;
|
||||
@ExcelProperty("地址")
|
||||
private String address;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
@ExcelProperty("给卖家留言")
|
||||
private String mark;
|
||||
|
||||
@ExcelProperty("取货地址")
|
||||
|
@ -59,7 +66,7 @@ public class RechargeOrderExcelVO {
|
|||
private String remark;
|
||||
|
||||
@ExcelProperty("产品合计金额")
|
||||
private BigDecimal proTotalPrice;
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
@ExcelProperty("运费")
|
||||
private BigDecimal shipPrice;
|
||||
|
@ -74,6 +81,6 @@ public class RechargeOrderExcelVO {
|
|||
private String promoter;
|
||||
|
||||
@ExcelProperty("组织名称")
|
||||
private Integer depName;
|
||||
private String depName;
|
||||
|
||||
}
|
||||
|
|
|
@ -18,12 +18,19 @@ public class RechargeOrderExportReqVO {
|
|||
@Schema(description = "订单号", example = "3697")
|
||||
private String orderId;
|
||||
|
||||
@Schema(description = "租户id")
|
||||
private Long tenantId;
|
||||
|
||||
@Schema(description = "用户id", example = "28969")
|
||||
private Integer uid;
|
||||
|
||||
@Schema(description = "用户姓名", example = "张三")
|
||||
private String realName;
|
||||
|
||||
|
||||
@Schema(description = "推广员名称", example = "张三")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "用户电话")
|
||||
private String userPhone;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import com.alibaba.excel.annotation.ExcelProperty;
|
|||
@Data
|
||||
public class RechargeOrderInfoExcelVO {
|
||||
|
||||
@ExcelProperty("订单号")
|
||||
@ExcelProperty("订单编号")
|
||||
private String orderNo;
|
||||
|
||||
@ExcelProperty("商户名称")
|
||||
|
@ -31,18 +31,19 @@ public class RechargeOrderInfoExcelVO {
|
|||
private String shopOption;
|
||||
|
||||
@ExcelProperty("产品分类")
|
||||
private String productCategory;
|
||||
private String productCategory="话费";
|
||||
|
||||
@ExcelProperty("产品价格")
|
||||
@ExcelProperty("产品单价")
|
||||
private BigDecimal price;
|
||||
|
||||
@ExcelProperty("产品数量")
|
||||
private Integer payNum;
|
||||
|
||||
private Integer payNum=1;
|
||||
@ExcelProperty("配送价格/运费")
|
||||
private BigDecimal freight=new BigDecimal(0);
|
||||
@ExcelProperty("合计金额")
|
||||
private BigDecimal proTotalPrice;
|
||||
|
||||
@ExcelProperty("支付金额")
|
||||
@ExcelProperty("实付金额")
|
||||
private BigDecimal payPrice;
|
||||
|
||||
@ExcelProperty("售后状态")
|
||||
|
|
|
@ -20,6 +20,9 @@ public class RechargeOrderPageReqVO extends PageParam {
|
|||
@Schema(description = "订单号", example = "3697")
|
||||
private String orderId;
|
||||
|
||||
@Schema(description = "租户id")
|
||||
private Long tenantId;
|
||||
|
||||
@Schema(description = "用户id", example = "28969")
|
||||
private Integer uid;
|
||||
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package cn.iocoder.yudao.module.shop.controller.app.banner;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.banner.vo.BannerPageReqVO;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.banner.vo.BannerRespVO;
|
||||
import cn.iocoder.yudao.module.shop.convert.banner.BannerConvert;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.banner.BannerDO;
|
||||
import cn.iocoder.yudao.module.shop.service.banner.BannerService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "用户APP - 商户Banner 管理")
|
||||
@RestController
|
||||
@RequestMapping("/market/banner")
|
||||
@Validated
|
||||
public class AppBannerController {
|
||||
|
||||
@Resource
|
||||
private BannerService bannerService;
|
||||
|
||||
|
||||
|
||||
@PostMapping("/list")
|
||||
@Operation(summary = "获得 Banner 列表")
|
||||
public CommonResult<PageResult<BannerRespVO>> getBannerList(@RequestBody@Valid BannerPageReqVO pageVO) {
|
||||
pageVO.setTenantId(TenantContextHolder.getTenantId());
|
||||
pageVO.setPageSize(5);
|
||||
PageResult<BannerDO> pageResult = bannerService.getBannerPage(pageVO);
|
||||
return success(BannerConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.shop.controller.app.buy;
|
|||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.module.shop.request.member.OrderContentRequest;
|
||||
import cn.iocoder.yudao.module.shop.request.member.RefundRequest;
|
||||
import cn.iocoder.yudao.module.shop.response.member.InitOrderResponse;
|
||||
|
@ -38,6 +39,7 @@ public class TopUpOrderController {
|
|||
log.info("initOrder会员充值===>{}", request);
|
||||
return CommonResult.success(storeOrderService.memberTopUp(request, servletRequest));
|
||||
}
|
||||
@TenantIgnore
|
||||
@PreAuthenticated
|
||||
@Operation(summary = "退款")
|
||||
@RequestMapping(value = "/memberRefund", method = RequestMethod.POST)
|
||||
|
@ -45,6 +47,7 @@ public class TopUpOrderController {
|
|||
log.info("memberRefund会员退款===>{}", request);
|
||||
return CommonResult.success(storeOrderService.memberRefund(request, servletRequest));
|
||||
}
|
||||
@TenantIgnore
|
||||
@PreAuthenticated
|
||||
@Operation(summary = "申请退款")
|
||||
@RequestMapping(value = "/memberApplyRefund", method = RequestMethod.POST)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package cn.iocoder.yudao.module.shop.dal.dataobject.recharge;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
|
@ -38,6 +40,12 @@ public class RechargeGearDO extends BaseDO {
|
|||
/**
|
||||
* 档位显示金额
|
||||
*/
|
||||
private Integer gearAmount;
|
||||
private BigDecimal gearAmount;
|
||||
|
||||
/**
|
||||
* 返费金额
|
||||
*/
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cn.iocoder.yudao.module.shop.dal.dataobject.recharge;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
|
@ -29,13 +30,13 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
|||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RechargeOrderDO extends BaseDO {
|
||||
public class RechargeOrderDO extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
@TableId
|
||||
private Integer id;
|
||||
@TableId(type=IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
|
@ -169,4 +170,14 @@ public class RechargeOrderDO extends BaseDO {
|
|||
private String updater;
|
||||
private Boolean deleted;
|
||||
|
||||
/**
|
||||
* 推广员id
|
||||
*/
|
||||
private Long promoterId;
|
||||
|
||||
/**
|
||||
* 组织id
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cn.iocoder.yudao.module.shop.dal.dataobject.recharge;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
@ -22,21 +23,21 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
|||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RechargeOrderInfoDO extends BaseDO {
|
||||
public class RechargeOrderInfoDO extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Integer id;
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 充值订单id
|
||||
*/
|
||||
private Integer rechargeOrderId;
|
||||
private Long rechargeOrderId;
|
||||
/**
|
||||
* 充值档位
|
||||
*/
|
||||
private Integer rechargeGearId;
|
||||
private Long rechargeGearId;
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
|
@ -74,5 +75,19 @@ public class RechargeOrderInfoDO extends BaseDO {
|
|||
private String updater;
|
||||
private LocalDateTime createTime;
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 推广员id
|
||||
*/
|
||||
private Long promoterId;
|
||||
|
||||
/**
|
||||
* 组织id
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long uid;
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class RefundFeeRecordDO extends BaseDO {
|
|||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 档位记录id
|
||||
|
|
|
@ -8,6 +8,7 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
|||
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderInfoDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 订单购物详情 Mapper
|
||||
|
@ -54,4 +55,7 @@ public interface RechargeOrderInfoMapper extends BaseMapperX<RechargeOrderInfoDO
|
|||
|
||||
}
|
||||
|
||||
List<RechargeOrderInfoExcelVO> getRechargeOrderInfoListExcel(@Param("ids") List<Long> ids);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -57,6 +57,9 @@ public interface RechargeOrderMapper extends BaseMapperX<RechargeOrderDO> {
|
|||
.orderByDesc(RechargeOrderDO::getId));
|
||||
}
|
||||
IPage<RechargeOrderRespVO> findListPage(IPage<RechargeOrderRespVO> page, @Param("data") RechargeOrderPageReqVO data);
|
||||
|
||||
|
||||
List<RechargeOrderExcelVO> findListExcel(@Param("data") RechargeOrderExportReqVO data);
|
||||
default List<RechargeOrderDO> selectList(RechargeOrderExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<RechargeOrderDO>()
|
||||
.eqIfPresent(RechargeOrderDO::getOrderId, reqVO.getOrderId())
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package cn.iocoder.yudao.module.shop.service.order.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
@ -15,9 +14,11 @@ import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
|||
import cn.iocoder.yudao.framework.pay.properties.AliPayProperties;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.infra.api.config.ApiConfigApi;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||
import cn.iocoder.yudao.module.member.api.user.dto.PromoterDTO;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.express.ExpressDO;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrder;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.PhoneRecordDO;
|
||||
|
@ -27,7 +28,6 @@ import cn.iocoder.yudao.module.shop.dal.mysql.order.StoreOrderMapper;
|
|||
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.PhoneRecordMapper;
|
||||
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderInfoMapper;
|
||||
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderMapper;
|
||||
import cn.iocoder.yudao.module.shop.request.member.AlipayNotifyParamRequest;
|
||||
import cn.iocoder.yudao.module.shop.request.member.OrderContentRequest;
|
||||
import cn.iocoder.yudao.module.shop.request.member.RefundRequest;
|
||||
import cn.iocoder.yudao.module.shop.request.order.StoreOrderRefundRequest;
|
||||
|
@ -43,7 +43,9 @@ import cn.iocoder.yudao.module.shop.service.order.StoreOrderService;
|
|||
import cn.iocoder.yudao.module.shop.service.order.StoreOrderStatusService;
|
||||
import cn.iocoder.yudao.module.shop.support.StrategySupport;
|
||||
import cn.iocoder.yudao.module.shop.support.pay.IPayStrategy;
|
||||
import cn.iocoder.yudao.module.shop.utils.*;
|
||||
import cn.iocoder.yudao.module.shop.utils.CommonPage;
|
||||
import cn.iocoder.yudao.module.shop.utils.OrderUtil;
|
||||
import cn.iocoder.yudao.module.shop.utils.RedisUtil;
|
||||
import cn.iocoder.yudao.module.shop.vo.order.LogisticsResultVo;
|
||||
import cn.iocoder.yudao.module.shop.vo.order.StoreDateRangeSqlPram;
|
||||
import cn.iocoder.yudao.module.shop.vo.order.StoreOrderInfoOldVo;
|
||||
|
@ -61,7 +63,6 @@ import com.github.pagehelper.PageInfo;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.service.WxOAuth2Service;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
@ -75,12 +76,12 @@ import org.springframework.util.CollectionUtils;
|
|||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -1150,16 +1151,18 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|||
}
|
||||
|
||||
@Override
|
||||
@TenantIgnore
|
||||
@Transactional
|
||||
public InitOrderResponse memberTopUp(OrderContentRequest request, HttpServletRequest servletRequest) {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
Assert.notNull(loginUser, "登录失效,请重新登录!");
|
||||
// 订单相关检查
|
||||
orderCheck(request);
|
||||
// 初始化订单
|
||||
MemberUserRespDTO user = userService.getUser(loginUser.getId());
|
||||
PromoterDTO promoterDTO = userService.getPromoterDOByUserId(user.getId());
|
||||
// 订单相关检查
|
||||
orderCheck(request, user);
|
||||
// 初始化订单
|
||||
String code = OrderUtil.generateBillNo("MEMBER");
|
||||
RechargeOrderDO orderDO = initializeOrder(request, code, user);
|
||||
RechargeOrderDO orderDO = initializeOrder(request, code, user, promoterDTO);
|
||||
// 获取支付策略
|
||||
IPayStrategy payStrategy = strategySupport.getPayStrategy(request.getPayType());
|
||||
|
||||
|
@ -1193,17 +1196,28 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|||
return "failure";
|
||||
}
|
||||
// 验证相关参数-金额
|
||||
String amount = params.get("receipt_amount");
|
||||
String amount;
|
||||
if (null == params.get("receipt_amount")) {
|
||||
amount = params.get("refund_fee");
|
||||
orderDO.setPaid(2);
|
||||
orderDO.setRefundStatus(2);
|
||||
// 表示退款
|
||||
} else {
|
||||
// 表示支付
|
||||
amount = params.get("receipt_amount");
|
||||
orderDO.setPaySerialNumber(params.get("trade_no"));
|
||||
orderDO.setPaid(1);
|
||||
}
|
||||
if (new BigDecimal(amount).compareTo(orderDO.getPayPrice()) != 0) {
|
||||
log.error("支付金额不匹配,订单实际支付金额:{},支付宝入参验证金额:{}", orderDO.getPayPrice(), amount);
|
||||
return "failure";
|
||||
}
|
||||
// 修改订单状态
|
||||
orderDO.setPaid(1);
|
||||
orderDO.setPaySerialNumber(params.get("trade_no"));
|
||||
rechargeOrderMapper.updateById(orderDO);
|
||||
// 写入 充值档位记录表
|
||||
addPhoneRecord(orderDO, orderId);
|
||||
if (null != params.get("receipt_amount")) {
|
||||
addPhoneRecord(orderDO, orderId);
|
||||
}
|
||||
log.debug(">>>>>>>>>>>>>>支付宝订单交易成功!订单号:{}<<<<<<<<<<<<<<<<<<<<", orderId);
|
||||
return "success";
|
||||
} else {
|
||||
|
@ -1253,6 +1267,8 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|||
|
||||
@Override
|
||||
public Object refundNotify(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
Map requestParams = request.getParameterMap();
|
||||
for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext(); ) {
|
||||
|
@ -1338,7 +1354,8 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|||
}
|
||||
|
||||
|
||||
private RechargeOrderDO initializeOrder(OrderContentRequest request, String code, MemberUserRespDTO user) {
|
||||
private RechargeOrderDO initializeOrder(OrderContentRequest request, String code, MemberUserRespDTO user, PromoterDTO promoterDTO) {
|
||||
Long tenantId = TenantContextHolder.getTenantId();
|
||||
RechargeOrderDO orderDO = new RechargeOrderDO();
|
||||
List<OrderContentRequest.OrderInfo> orderInfos = request.getOrderInfos();
|
||||
orderDO.setOrderId(code);
|
||||
|
@ -1357,6 +1374,9 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|||
orderDO.setCost(sum);
|
||||
orderDO.setProTotalPrice(sum);
|
||||
orderDO.setBeforePayPrice(sum);
|
||||
orderDO.setPromoterId(user.getPromoterId());
|
||||
orderDO.setDeptId(promoterDTO.getDeptId());
|
||||
orderDO.setTenantId(tenantId);
|
||||
rechargeOrderMapper.insert(orderDO);
|
||||
List<RechargeOrderInfoDO> infoDOS = new ArrayList<>();
|
||||
orderInfos.forEach(info -> {
|
||||
|
@ -1368,16 +1388,32 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|||
infoDO.setPayNum(1);
|
||||
infoDO.setGiveIntegral(info.getGearAmount());
|
||||
infoDO.setVipPrice(new BigDecimal(info.getGearAmount()));
|
||||
infoDO.setPromoterId(user.getPromoterId());
|
||||
infoDO.setDeptId(promoterDTO.getDeptId());
|
||||
infoDO.setUid(user.getId());
|
||||
infoDO.setRechargeGearId(info.getGearId());
|
||||
infoDO.setTenantId(tenantId);
|
||||
infoDOS.add(infoDO);
|
||||
});
|
||||
rechargeOrderInfoMapper.insertBatch(infoDOS);
|
||||
return orderDO;
|
||||
}
|
||||
|
||||
private void orderCheck(OrderContentRequest request) {
|
||||
Assert.isTrue(!CollectionUtils.isEmpty(request.getOrderInfos()), "订单信息不能为空!");
|
||||
private void orderCheck(OrderContentRequest request, MemberUserRespDTO user) {
|
||||
List<OrderContentRequest.OrderInfo> orderInfos = request.getOrderInfos();
|
||||
Assert.isTrue(!CollectionUtils.isEmpty(orderInfos), "订单信息不能为空!");
|
||||
List<Long> collect = orderInfos.stream().map(OrderContentRequest.OrderInfo::getGearId).collect(Collectors.toList());
|
||||
List<RechargeOrderInfoDO> infoDOS = rechargeOrderInfoMapper.selectList(Wrappers.<RechargeOrderInfoDO>lambdaQuery()
|
||||
.eq(RechargeOrderInfoDO::getUid, user.getId())
|
||||
.in(RechargeOrderInfoDO::getRechargeGearId, collect));
|
||||
if (!CollectionUtils.isEmpty(infoDOS)) {
|
||||
Map<Long, List<RechargeOrderInfoDO>> collect1 = infoDOS.stream().collect(Collectors.groupingBy(RechargeOrderInfoDO::getRechargeGearId));
|
||||
orderInfos.forEach(info -> {
|
||||
Assert.isTrue(CollectionUtils.isEmpty(collect1.get(info.getGearId())), "该挡位:" + info.getName() + "你已购买,请勿重复操作");
|
||||
});
|
||||
}
|
||||
if (StringUtils.isNotBlank(request.getUserPhone()) && StringUtils.isNotBlank(request.getConfirmPhone())) {
|
||||
Assert.isTrue(StringUtils.equals(request.getUserPhone(), request.getConfirmPhone()), "输入号码不一致!");
|
||||
Assert.isTrue(Pattern.matches("^[1][3,4,5,7,8][0,1,2,4,5,6,7,8,9][0-9]{8}$", request.getUserPhone()), "手机号前三位不能是190或193!");
|
||||
MemberUserRespDTO userByMobile = userService.getUserByMobile(request.getUserPhone());
|
||||
// 初始化一个账号
|
||||
if (Objects.isNull(userByMobile)) {
|
||||
|
|
|
@ -106,7 +106,7 @@ public class RechargeGearServiceImpl implements RechargeGearService {
|
|||
RechargeOrderDO orderDO = orderMapper.selectOne(Wrappers.<RechargeOrderDO>lambdaQuery().eq(RechargeOrderDO::getUid, loginUser.getId()).last("LIMIT 1"));
|
||||
if (Objects.nonNull(orderDO)) {
|
||||
List<RechargeOrderInfoDO> infoDOS = orderInfoMapper.selectList(Wrappers.<RechargeOrderInfoDO>lambdaQuery().eq(RechargeOrderInfoDO::getOrderNo, orderDO.getOrderId()));
|
||||
Map<Integer, List<RechargeOrderInfoDO>> collect = infoDOS.stream().collect(Collectors.groupingBy(RechargeOrderInfoDO::getRechargeGearId));
|
||||
Map<Long, List<RechargeOrderInfoDO>> collect = infoDOS.stream().collect(Collectors.groupingBy(RechargeOrderInfoDO::getRechargeGearId));
|
||||
rechargeGearRespVOS.forEach(vo -> {
|
||||
List<RechargeOrderInfoDO> infoDOS1 = collect.get(vo.getId());
|
||||
if (!CollectionUtils.isEmpty(infoDOS1)) {
|
||||
|
|
|
@ -19,7 +19,7 @@ public interface RechargeOrderInfoService {
|
|||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Integer createRechargeOrderInfo(@Valid RechargeOrderInfoCreateReqVO createReqVO);
|
||||
Long createRechargeOrderInfo(@Valid RechargeOrderInfoCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新订单购物详情
|
||||
|
@ -67,6 +67,6 @@ public interface RechargeOrderInfoService {
|
|||
*/
|
||||
List<RechargeOrderInfoDO> getRechargeOrderInfoList(RechargeOrderInfoExportReqVO exportReqVO);
|
||||
|
||||
List<RechargeOrderInfoDO> getRechargeOrderInfoList(List<String> ids);
|
||||
List<RechargeOrderInfoExcelVO> getRechargeOrderInfoListExcel(List<Long> ids);
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public class RechargeOrderInfoServiceImpl implements RechargeOrderInfoService {
|
|||
private RechargeOrderInfoMapper rechargeOrderInfoMapper;
|
||||
|
||||
@Override
|
||||
public Integer createRechargeOrderInfo(RechargeOrderInfoCreateReqVO createReqVO) {
|
||||
public Long createRechargeOrderInfo(RechargeOrderInfoCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
RechargeOrderInfoDO rechargeOrderInfo = RechargeOrderInfoConvert.INSTANCE.convert(createReqVO);
|
||||
rechargeOrderInfoMapper.insert(rechargeOrderInfo);
|
||||
|
@ -81,8 +81,8 @@ public class RechargeOrderInfoServiceImpl implements RechargeOrderInfoService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<RechargeOrderInfoDO> getRechargeOrderInfoList(List<String> s) {
|
||||
return rechargeOrderInfoMapper.selectList(s);
|
||||
public List<RechargeOrderInfoExcelVO> getRechargeOrderInfoListExcel(List<Long> s) {
|
||||
return rechargeOrderInfoMapper.getRechargeOrderInfoListExcel(s);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*;
|
|||
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.shop.response.member.MemberHeadResponse;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 订单 Service 接口
|
||||
|
@ -20,7 +21,7 @@ public interface RechargeOrderService {
|
|||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Integer createRechargeOrder(@Valid RechargeOrderCreateReqVO createReqVO);
|
||||
Long createRechargeOrder(@Valid RechargeOrderCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新订单
|
||||
|
@ -68,6 +69,8 @@ public interface RechargeOrderService {
|
|||
*/
|
||||
List<RechargeOrderDO> getRechargeOrderList(RechargeOrderExportReqVO exportReqVO);
|
||||
|
||||
List<RechargeOrderExcelVO> findListExcel(RechargeOrderExportReqVO data);
|
||||
|
||||
List<RechargeOrderRespVO> memberOrderInfo();
|
||||
|
||||
MemberHeadResponse memberHeadInfo();
|
||||
|
|
|
@ -45,7 +45,7 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
|
|||
private RechargeOrderInfoMapper infoMapper;
|
||||
|
||||
@Override
|
||||
public Integer createRechargeOrder(RechargeOrderCreateReqVO createReqVO) {
|
||||
public Long createRechargeOrder(RechargeOrderCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
RechargeOrderDO rechargeOrder = RechargeOrderConvert.INSTANCE.convert(createReqVO);
|
||||
rechargeOrderMapper.insert(rechargeOrder);
|
||||
|
@ -98,6 +98,11 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
|
|||
return rechargeOrderMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RechargeOrderExcelVO> findListExcel(RechargeOrderExportReqVO data) {
|
||||
return rechargeOrderMapper.findListExcel(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RechargeOrderRespVO> memberOrderInfo() {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
|
|
|
@ -72,7 +72,7 @@ public class AliPayStrategy implements IPayStrategy {
|
|||
bizContent.put("trade_no", orderDO.getPaySerialNumber());
|
||||
bizContent.put("refund_amount", orderDO.getPayPrice());
|
||||
bizContent.put("out_request_no", orderDO.getOrderId());
|
||||
|
||||
bizContent.put("notify_url",aliPayProperties.getRefundNotify());
|
||||
request.setBizContent(bizContent.toString());
|
||||
AlipayTradeRefundResponse response = null;
|
||||
try {
|
||||
|
|
|
@ -9,4 +9,33 @@
|
|||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="getRechargeOrderInfoListExcel" resultType="cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RechargeOrderInfoExcelVO">
|
||||
select
|
||||
a.order_id as 'orderNo',
|
||||
e.name as tenantName,
|
||||
f.product_name as 'productName',
|
||||
f.price,
|
||||
f.price as proTotalPrice,
|
||||
f.price as payPrice,
|
||||
a.refund_status as afterStatus,
|
||||
f.price as refundPrice,
|
||||
a.uid as 'vipAccount',
|
||||
a.real_name as vipName
|
||||
from cy_recharge_order_info f
|
||||
left join cy_recharge_order a on a.id = f.recharge_order_id
|
||||
left join member_user b on a.promoter_id = b.id
|
||||
left join system_dept d on d.id = a.dept_id
|
||||
left join system_tenant e on a.promoter_id = b.id
|
||||
<where>
|
||||
<if test="ids!=null and ids.size>0">
|
||||
f.recharge_order_id in
|
||||
<foreach collection="ids" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
a.user_phone,
|
||||
a.confirm_phone,
|
||||
a.pay_type,
|
||||
a.total_price,
|
||||
a.pay_price,
|
||||
a.paid,
|
||||
d.parent_organization_name
|
||||
from cy_recharge_order a
|
||||
|
@ -33,11 +35,14 @@
|
|||
<if test="data.orderId !=null and data.orderId!=''">
|
||||
and a.order_id like CONCAT('%',#{data.orderId},'%')
|
||||
</if>
|
||||
<if test="data.payserialNumber !=null and data.payserialNumber!=''">
|
||||
and a.pay_serial_number like CONCAT('%',#{data.payserialNumber},'%')
|
||||
<if test="data.tenantId !=null and data.tenantId!=1">
|
||||
and a.tenant_id =#{data.tenantId}
|
||||
</if>
|
||||
<if test="data.paySerialNumber !=null and data.paySerialNumber!=''">
|
||||
and a.pay_serial_number like CONCAT('%',#{data.paySerialNumber},'%')
|
||||
</if>
|
||||
<if test="data.nickname !=null and data.nickname!=''">
|
||||
and a.nickname like CONCAT('%',#{data.nickname},'%')
|
||||
and b.nickname like CONCAT('%',#{data.nickname},'%')
|
||||
</if>
|
||||
<if test="data.realName !=null and data.realName!=''">
|
||||
and a.real_name like CONCAT('%',#{data.realName},'%')
|
||||
|
@ -53,4 +58,82 @@
|
|||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="findListPage" resultType="cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RechargeOrderRespVO">
|
||||
select
|
||||
a.order_id,
|
||||
a.pay_serial_number,
|
||||
a.out_trade_no,
|
||||
a.pay_time,
|
||||
b.nickname,
|
||||
a.real_name,
|
||||
a.uid,
|
||||
a.user_phone,
|
||||
a.confirm_phone,
|
||||
a.pay_type,
|
||||
a.total_price,
|
||||
a.pay_price,
|
||||
a.paid,
|
||||
d.parent_organization_name
|
||||
from cy_recharge_order a
|
||||
left join member_user b on a.promoter_id = b.id
|
||||
left join member_promoter c on a.promoter_id=c.user_id
|
||||
left join system_dept d on d.id = c.dept_id
|
||||
<include refid="baseWhere">
|
||||
</include>
|
||||
</select>
|
||||
<select id="findListExcel" resultType="cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RechargeOrderExcelVO">
|
||||
select
|
||||
a.id,
|
||||
a.order_id,
|
||||
a.pay_serial_number,
|
||||
e.name as tenantName,
|
||||
a.pay_time,
|
||||
a.pay_time as payCompleteTime,
|
||||
a.real_name,
|
||||
a.user_phone,
|
||||
a.confirm_phone,
|
||||
a.pay_type,
|
||||
a.total_price,
|
||||
a.pay_price,
|
||||
a.uid,
|
||||
a.real_name as vipName,
|
||||
a.out_trade_no,
|
||||
b.nickname as promoter,
|
||||
d.parent_organization_name as 'depName'
|
||||
from cy_recharge_order a
|
||||
left join member_user b on a.promoter_id = b.id
|
||||
left join system_dept d on d.id = a.dept_id
|
||||
left join system_tenant e on a.promoter_id = b.id
|
||||
<include refid="baseWhere">
|
||||
</include>
|
||||
</select>
|
||||
<sql id="baseWhere">
|
||||
<where>
|
||||
and a.paid=1
|
||||
<if test="data.orderId !=null and data.orderId!=''">
|
||||
and a.order_id like CONCAT('%',#{data.orderId},'%')
|
||||
</if>
|
||||
<if test="data.tenantId !=null and data.tenantId!=1">
|
||||
and a.tenant_id =#{data.tenantId}
|
||||
</if>
|
||||
<if test="data.paySerialNumber !=null and data.paySerialNumber!=''">
|
||||
and a.pay_serial_number like CONCAT('%',#{data.paySerialNumber},'%')
|
||||
</if>
|
||||
<if test="data.nickname !=null and data.nickname!=''">
|
||||
and b.nickname like CONCAT('%',#{data.nickname},'%')
|
||||
</if>
|
||||
<if test="data.realName !=null and data.realName!=''">
|
||||
and a.real_name like CONCAT('%',#{data.realName},'%')
|
||||
</if>
|
||||
<if test="data.userPhone !=null and data.userPhone!=''">
|
||||
and a.user_phone like CONCAT('%',#{data.userPhone},'%')
|
||||
</if>
|
||||
<if test="data.payTime !=null ">
|
||||
and a.pay_time >=#{data.payTime[0]}
|
||||
</if>
|
||||
<if test="data.payTime !=null ">
|
||||
and a.pay_time <=#{data.payTime[1]}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.member.api.user;
|
|||
|
||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserBillDTO;
|
||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||
import cn.iocoder.yudao.module.member.api.user.dto.PromoterDTO;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
@ -80,4 +81,6 @@ public interface MemberUserApi {
|
|||
|
||||
|
||||
void saveMemberUser(String phone);
|
||||
|
||||
PromoterDTO getPromoterDOByUserId(Long userId);
|
||||
}
|
||||
|
|
|
@ -36,5 +36,8 @@ public class MemberUserRespDTO {
|
|||
*/
|
||||
private String mobile;
|
||||
|
||||
|
||||
/**
|
||||
* 推广员id
|
||||
*/
|
||||
private Long promoterId;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package cn.iocoder.yudao.module.member.api.user.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Title:PromoterDTO
|
||||
* @Description: TODO
|
||||
* @author: tangqian
|
||||
* @date: 2023/5/19 14:06
|
||||
* @version: V1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class PromoterDTO {
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 组织id
|
||||
*/
|
||||
private Long deptId;
|
||||
/**
|
||||
* 会员id
|
||||
*/
|
||||
private Long userId;
|
||||
}
|
|
@ -4,8 +4,11 @@ import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
|||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||
import cn.iocoder.yudao.module.member.api.user.dto.PromoterDTO;
|
||||
import cn.iocoder.yudao.module.member.convert.user.UserConvert;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.promoter.PromoterDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import cn.iocoder.yudao.module.member.service.promoter.PromoterService;
|
||||
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||
import com.thoughtworks.xstream.core.SecurityUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -26,6 +29,8 @@ public class MemberUserApiImpl implements MemberUserApi {
|
|||
|
||||
@Resource
|
||||
private MemberUserService userService;
|
||||
@Resource
|
||||
private PromoterService promoterService;
|
||||
|
||||
@Override
|
||||
@TenantIgnore
|
||||
|
@ -102,6 +107,16 @@ public class MemberUserApiImpl implements MemberUserApi {
|
|||
userService.saveMemberUser(phone);
|
||||
}
|
||||
|
||||
@Override
|
||||
@TenantIgnore
|
||||
public PromoterDTO getPromoterDOByUserId(Long userId) {
|
||||
PromoterDTO promoterDTO = new PromoterDTO();
|
||||
PromoterDO promoterDO = promoterService.getPromoterDOByUserId(userId);
|
||||
promoterDTO.setDeptId(promoterDO.getDeptId());
|
||||
promoterDO.setId(promoterDO.getId());
|
||||
return promoterDTO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取个人资料
|
||||
*
|
||||
|
|
|
@ -13,6 +13,9 @@ public class PromoterRespVO extends PromoterBaseVO {
|
|||
private Long id;
|
||||
@Schema(description = "组织名称", required = true, example = "18443")
|
||||
private String orgName;
|
||||
@Schema(description = "组织名称", required = true, example = "18443")
|
||||
@Schema(description = "用户id", required = true, example = "18443")
|
||||
private String userId;
|
||||
|
||||
@Schema(description = "组织简称", required = true, example = "18443")
|
||||
private String deptName;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
|||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.promoter.vo.PromoterRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserInfoReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserInfoRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserUpdateMobileReqVO;
|
||||
|
@ -76,6 +77,9 @@ public class AppUserController {
|
|||
AppUserInfoRespVO appUserInfoRespVO = UserConvert.INSTANCE.convert(user);
|
||||
if(promoterService.checkIsPromoterByUserId(getLoginUserId())){
|
||||
appUserInfoRespVO.setUserType(UserTypeEnum.PROMOTER);
|
||||
PromoterRespVO promoterRespVO = promoterService.getPromoterInfo(getLoginUserId());
|
||||
appUserInfoRespVO.setDeptName(promoterRespVO.getDeptName());
|
||||
appUserInfoRespVO.setParentDeptName(promoterRespVO.getOrgName());
|
||||
}else{
|
||||
appUserInfoRespVO.setUserType(UserTypeEnum.MEMBER);
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@ import lombok.NoArgsConstructor;
|
|||
@AllArgsConstructor
|
||||
public class AppUserInfoRespVO {
|
||||
|
||||
@Schema(description = "用户id", required = true, example = "芋艿")
|
||||
private Long userId;
|
||||
@Schema(description = "用户昵称", required = true, example = "芋艿")
|
||||
private String nickname;
|
||||
|
||||
|
@ -23,4 +25,10 @@ public class AppUserInfoRespVO {
|
|||
|
||||
@Schema(description = "用户类型", required = true, example = "15601691300")
|
||||
private UserTypeEnum userType;
|
||||
|
||||
@Schema(description = "组织", required = true, example = "15601691300")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "组织全称", required = true, example = "15601691300")
|
||||
private String parentDeptName;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.member.dal.dataobject.user;
|
|||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
@ -29,7 +30,7 @@ public class MemberUserDO extends TenantBaseDO {
|
|||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@TableId
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 用户昵称
|
||||
|
|
|
@ -25,6 +25,9 @@ public interface PromoterMapper extends BaseMapperX<PromoterDO> {
|
|||
.orderByDesc(PromoterDO::getId));
|
||||
}
|
||||
IPage<PromoterRespVO> findListPage(IPage<PromoterRespVO> page, @Param("data") PromoterPageReqVO data);
|
||||
|
||||
PromoterRespVO getPromoterInfo(@Param("userId") Long userId);
|
||||
|
||||
default List<PromoterDO> selectList(PromoterExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<PromoterDO>()
|
||||
.eqIfPresent(PromoterDO::getDeptId, reqVO.getDeptId())
|
||||
|
|
|
@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.member.controller.app.auth.vo.*;
|
|||
import cn.iocoder.yudao.module.member.convert.auth.AuthConvert;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper;
|
||||
import cn.iocoder.yudao.module.member.service.promoter.PromoterService;
|
||||
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||
import cn.iocoder.yudao.module.system.api.logger.LoginLogApi;
|
||||
import cn.iocoder.yudao.module.system.api.logger.dto.LoginLogCreateReqDTO;
|
||||
|
@ -39,6 +40,7 @@ import java.util.Objects;
|
|||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
|
@ -69,6 +71,9 @@ public class MemberAuthServiceImpl implements MemberAuthService {
|
|||
@Resource
|
||||
private MemberUserMapper userMapper;
|
||||
|
||||
@Resource
|
||||
private PromoterService promoterService;
|
||||
|
||||
@Override
|
||||
public AppAuthLoginRespVO login(AppAuthLoginReqVO reqVO) {
|
||||
// 使用手机 + 密码,进行登录。
|
||||
|
|
|
@ -77,6 +77,8 @@ public interface PromoterService {
|
|||
*/
|
||||
List<PromoterDO> getPromoterList(PromoterExportReqVO exportReqVO);
|
||||
|
||||
PromoterRespVO getPromoterInfo(Long userId);
|
||||
|
||||
/**
|
||||
* 批量导入推广员列表
|
||||
*
|
||||
|
@ -85,5 +87,5 @@ public interface PromoterService {
|
|||
* @return 导入结果
|
||||
*/
|
||||
PromoterImportRespVO importUserList(List<PromoterImportExcelVO> importUsers, boolean isUpdateSupport);
|
||||
|
||||
PromoterDO getPromoterDOByUserId(Long userId);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import com.github.pagehelper.PageHelper;
|
|||
import com.github.pagehelper.PageInfo;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Validator;
|
||||
|
||||
|
@ -24,6 +25,7 @@ import org.springframework.validation.annotation.Validated;
|
|||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.module.member.controller.admin.promoter.vo.*;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.promoter.PromoterDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
@ -62,20 +64,20 @@ public class PromoterServiceImpl implements PromoterService {
|
|||
public Long createPromoter(PromoterCreateReqVO createReqVO) {
|
||||
//判断手机号是否注册
|
||||
MemberUserDO memberUserDO = memberUserService.getUserByMobile(createReqVO.getMobile());
|
||||
if(memberUserDO==null){
|
||||
if (memberUserDO == null) {
|
||||
//创建用户
|
||||
memberUserDO = new MemberUserDO();
|
||||
memberUserDO.setNickname(createReqVO.getNickname());
|
||||
memberUserDO.setMobile(createReqVO.getMobile());
|
||||
memberUserDO.setStatus(createReqVO.getStatus());
|
||||
memberUserDO.setPassword(createReqVO.getMobile().substring(createReqVO.getMobile().length()-6));
|
||||
memberUserService.createUserIfAbsent(createReqVO.getMobile(),createReqVO.getNickname(),getClientIP());
|
||||
memberUserDO.setPassword(createReqVO.getMobile().substring(createReqVO.getMobile().length() - 6));
|
||||
memberUserService.createUserIfAbsent(createReqVO.getMobile(), createReqVO.getNickname(), getClientIP());
|
||||
}
|
||||
// 插入
|
||||
PromoterDO promoter = PromoterConvert.INSTANCE.convert(createReqVO);
|
||||
promoter.setTenantId(SecurityFrameworkUtils.getLoginUser().getTenantId());
|
||||
Long count = promoterMapper.selectCount(Wrappers.lambdaQuery(PromoterDO.class).eq(PromoterDO::getUserId,memberUserDO.getId()));
|
||||
if(count>0){
|
||||
Long count = promoterMapper.selectCount(Wrappers.lambdaQuery(PromoterDO.class).eq(PromoterDO::getUserId, memberUserDO.getId()));
|
||||
if (count > 0) {
|
||||
throw new ServiceException(PROMOTER_EXISTS);
|
||||
}
|
||||
promoter.setUserId(memberUserDO.getId());
|
||||
|
@ -94,9 +96,9 @@ public class PromoterServiceImpl implements PromoterService {
|
|||
PromoterDO updateObj = PromoterConvert.INSTANCE.convert(updateReqVO);
|
||||
promoterMapper.updateById(updateObj);
|
||||
MemberUserDO memberUserDO = memberUserService.getUserByMobile(updateReqVO.getMobile());
|
||||
if(memberUserDO!=null&&!promoterDO.getUserId().equals(memberUserDO.getId())){
|
||||
if (memberUserDO != null && !promoterDO.getUserId().equals(memberUserDO.getId())) {
|
||||
throw new ServiceException(ErrorCodeConstants.USER_PHONE_EXISTS);
|
||||
}else {
|
||||
} else {
|
||||
memberUserDO.setMobile(updateReqVO.getMobile());
|
||||
memberUserDO.setNickname(updateReqVO.getNickname());
|
||||
memberUserService.updateById(memberUserDO);
|
||||
|
@ -131,8 +133,8 @@ public class PromoterServiceImpl implements PromoterService {
|
|||
*/
|
||||
@Override
|
||||
public Boolean checkIsPromoterByUserId(Long userId) {
|
||||
Long count = this.promoterMapper.selectCount(Wrappers.lambdaQuery(PromoterDO.class).eq(PromoterDO::getUserId,userId));
|
||||
return count>0;
|
||||
Long count = this.promoterMapper.selectCount(Wrappers.lambdaQuery(PromoterDO.class).eq(PromoterDO::getUserId, userId));
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -143,14 +145,14 @@ public class PromoterServiceImpl implements PromoterService {
|
|||
@Override
|
||||
public PageResult<PromoterRespVO> getPromoterPage(PromoterPageReqVO pageReqVO) {
|
||||
Page<PromoterRespVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
if(StrUtil.isNotBlank(pageReqVO.getDeptId())){
|
||||
if (StrUtil.isNotBlank(pageReqVO.getDeptId())) {
|
||||
DeptRespDTO deptRespDTO = deptApi.getDept(Long.parseLong(pageReqVO.getDeptId()));
|
||||
if(deptRespDTO!=null){
|
||||
if (deptRespDTO != null) {
|
||||
pageReqVO.setDeptId(deptRespDTO.getParentOrganizationIds());
|
||||
}
|
||||
}
|
||||
|
||||
promoterMapper.findListPage(page,pageReqVO);
|
||||
promoterMapper.findListPage(page, pageReqVO);
|
||||
return new PageResult<>(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
|
@ -159,6 +161,11 @@ public class PromoterServiceImpl implements PromoterService {
|
|||
return promoterMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PromoterRespVO getPromoterInfo(Long userId) {
|
||||
return promoterMapper.getPromoterInfo(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入推广员列表
|
||||
*
|
||||
|
@ -174,37 +181,37 @@ public class PromoterServiceImpl implements PromoterService {
|
|||
PromoterImportRespVO respVO = PromoterImportRespVO.builder().createUsernames(new ArrayList<>())
|
||||
.updateUsernames(new ArrayList<>()).failureUsernames(new LinkedHashMap<>()).build();
|
||||
List<DeptRespDTO> deptRespDTOList = deptApi.getDeptList();
|
||||
Map<String,DeptRespDTO> nameList = deptRespDTOList.stream().collect(toMap(DeptRespDTO::getParentOrganizationName, value -> value,(value1,value2)->value1));
|
||||
Map<String, DeptRespDTO> nameList = deptRespDTOList.stream().collect(toMap(DeptRespDTO::getParentOrganizationName, value -> value, (value1, value2) -> value1));
|
||||
importUsers.forEach(importUser -> {
|
||||
try {
|
||||
ValidationUtils.validate(validator,importUser);
|
||||
ValidationUtils.validate(validator, importUser);
|
||||
} catch (ServiceException ex) {
|
||||
respVO.getFailureUsernames().put(importUser.getNickName(), ex.getMessage());
|
||||
return;
|
||||
}
|
||||
//判断手机号是否注册
|
||||
MemberUserDO memberUserDO = memberUserService.getUserByMobile(importUser.getMobile());
|
||||
if(memberUserDO==null){
|
||||
if (memberUserDO == null) {
|
||||
//创建用户
|
||||
memberUserDO = new MemberUserDO();
|
||||
memberUserDO.setNickname(importUser.getNickName());
|
||||
memberUserDO.setMobile(importUser.getMobile());
|
||||
memberUserDO.setPassword(importUser.getMobile().substring(importUser.getMobile().length()-6));
|
||||
memberUserDO.setPassword(importUser.getMobile().substring(importUser.getMobile().length() - 6));
|
||||
memberUserDO.setStatus(1);
|
||||
memberUserService.createUserIfAbsent(importUser.getMobile(),importUser.getNickName(),getClientIP());
|
||||
memberUserService.createUserIfAbsent(importUser.getMobile(), importUser.getNickName(), getClientIP());
|
||||
}
|
||||
// 插入
|
||||
PromoterDO promoter = new PromoterDO();
|
||||
promoter.setTenantId(SecurityFrameworkUtils.getLoginUser().getTenantId());
|
||||
promoter.setUserId(memberUserDO.getId());
|
||||
promoter.setCreateTime(LocalDateTime.now());
|
||||
Long count = promoterMapper.selectCount(Wrappers.lambdaQuery(PromoterDO.class).eq(PromoterDO::getUserId,memberUserDO.getId()));
|
||||
if(count>0){
|
||||
Long count = promoterMapper.selectCount(Wrappers.lambdaQuery(PromoterDO.class).eq(PromoterDO::getUserId, memberUserDO.getId()));
|
||||
if (count > 0) {
|
||||
respVO.getFailureUsernames().put(importUser.getNickName(), "已经是推广员");
|
||||
return;
|
||||
}
|
||||
DeptRespDTO deptRespDTO = nameList.get(importUser.getOrgName());
|
||||
if(deptRespDTO==null){
|
||||
if (deptRespDTO == null) {
|
||||
respVO.getFailureUsernames().put(importUser.getNickName(), "组织不存在");
|
||||
return;
|
||||
}
|
||||
|
@ -215,6 +222,12 @@ public class PromoterServiceImpl implements PromoterService {
|
|||
});
|
||||
return respVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PromoterDO getPromoterDOByUserId(Long userId) {
|
||||
return promoterMapper.selectOne(Wrappers.<PromoterDO>lambdaQuery().eq(PromoterDO::getUserId, userId).last("LIMIT 1"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 对密码进行加密
|
||||
*
|
||||
|
|
|
@ -29,4 +29,14 @@
|
|||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getPromoterInfo" resultType="cn.iocoder.yudao.module.member.controller.admin.promoter.vo.PromoterRespVO">
|
||||
select a.id,a.user_id,a.dept_id,b.nickname,b.status,b.mobile,c.parent_organization_name as 'orgName',c.name as 'deptName' from member_promoter a
|
||||
left join member_user b on a.user_id = b.id
|
||||
left join system_dept c on c.id=a.dept_id
|
||||
<where>
|
||||
a.user_id=#{userId}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -115,6 +115,10 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mail</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>wx-java-mp-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.system.service.tenant.TenantService;
|
|||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -36,6 +37,7 @@ public class TenantController {
|
|||
@Resource
|
||||
private TenantService tenantService;
|
||||
|
||||
|
||||
@GetMapping("/get-id-by-name")
|
||||
@PermitAll
|
||||
@Operation(summary = "使用租户名,获得租户编号", description = "登录界面,根据用户的租户名,获得租户编号")
|
||||
|
@ -108,6 +110,4 @@ public class TenantController {
|
|||
List<TenantExcelVO> datas = TenantConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "租户.xls", "数据", TenantExcelVO.class, datas);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
<el-table-column label="档位名称" align="center" prop="name" />
|
||||
<el-table-column label="档位备注" align="center" prop="gearRemarks" />
|
||||
<el-table-column label="档位显示金额" align="center" prop="gearAmount" />
|
||||
<el-table-column label="返费金额" align="center" prop="refundAmount" />
|
||||
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
|
@ -58,6 +60,9 @@
|
|||
<el-form-item label="显示金额" prop="gearAmount">
|
||||
<el-input v-model="form.gearAmount" placeholder="请输入显示金额" />
|
||||
</el-form-item>
|
||||
<el-form-item label="返费金额" prop="refundAmount">
|
||||
<el-input v-model="form.refundAmount" placeholder="请输入返费金额" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="gearRemarks">
|
||||
<el-input v-model="form.gearRemarks" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
|
@ -107,6 +112,7 @@ export default {
|
|||
name: [{ required: true, message: "档位名称不能为空", trigger: "blur" }],
|
||||
gearRemarks: [{ required: true, message: "档位备注不能为空", trigger: "blur" }],
|
||||
gearAmount: [{ required: true, message: "档位显示金额不能为空", trigger: "blur" }],
|
||||
refundAmount: [{ required: true, message: "档位显示金额不能为空", trigger: "blur" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="app-container">
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="98px">
|
||||
<el-form-item label="订单编号" prop="orderId">
|
||||
<el-input v-model="queryParams.orderId" placeholder="请输入订单号" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
|
@ -45,7 +45,11 @@
|
|||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="订单编号" align="center" prop="orderId" />
|
||||
<el-table-column label="交易流水号" align="center" prop="paySerialNumber" />
|
||||
<el-table-column label="订单支付时间" align="center" prop="payTime" width="180"/>
|
||||
<el-table-column label="订单支付时间" align="center" prop="payTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.payTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="推广员" align="center" prop="parentOrganizationName" >
|
||||
<template v-slot="scope">
|
||||
<span>{{ scope.row.parentOrganizationName }}-{{ scope.row.nickname }}</span>
|
||||
|
|
|
@ -173,27 +173,30 @@
|
|||
// #endif
|
||||
},
|
||||
computed: mapGetters(['tenantId']),
|
||||
async mounted() {
|
||||
this.isQRCode()
|
||||
if (this.$store.getters.isLogin && !this.$Cache.get('USER_INFO')) {
|
||||
await this.$store.dispatch('USERINFO');
|
||||
}
|
||||
if (!this.$Cache.get('TENANT_ID') || this.$route.query.tenantId) {
|
||||
this.getTenantId()
|
||||
} else {
|
||||
this.getTenantInfo()
|
||||
}
|
||||
if (!this.$Cache.get('OPEN_ID') && this.$route.query.code) {
|
||||
this.getWxChatCode()
|
||||
}
|
||||
this.setSpreadId()
|
||||
setInterval(() => {
|
||||
if (this.$store.getters.isLogin) {
|
||||
this.setRefreshToken()
|
||||
}
|
||||
}, 60000)
|
||||
mounted() {
|
||||
this.initLoad()
|
||||
},
|
||||
methods: {
|
||||
async initLoad(){
|
||||
this.isQRCode()
|
||||
this.setSpreadId()
|
||||
if (this.$store.getters.isLogin && !this.$Cache.get('USER_INFO')) {
|
||||
await this.$store.dispatch('USERINFO');
|
||||
}
|
||||
if (!this.$Cache.get('TENANT_ID') || this.$route.query.tenantId) {
|
||||
this.getTenantId()
|
||||
} else {
|
||||
this.getTenantInfo()
|
||||
}
|
||||
if (!this.$Cache.get('OPEN_ID') && this.$route.query.code) {
|
||||
this.getWxChatCode()
|
||||
}
|
||||
setInterval(() => {
|
||||
if (this.$store.getters.isLogin) {
|
||||
this.setRefreshToken()
|
||||
}
|
||||
}, 60000)
|
||||
},
|
||||
// 是否扫码跳转
|
||||
isQRCode() {
|
||||
const redirectUrl = this.$route.query.redirectUrl || ''
|
||||
|
@ -225,6 +228,7 @@
|
|||
// 获取推广员ID
|
||||
setSpreadId() {
|
||||
const spreadId = this.$route.query.spreadId || ''
|
||||
console.log('spreadId', spreadId)
|
||||
if (spreadId) {
|
||||
this.$store.commit("SET_SPREADID", spreadId);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ module.exports = {
|
|||
TENANT_ID: 'TENANT_ID',
|
||||
// 微信openId
|
||||
OPEN_ID: 'OPEN_ID',
|
||||
// 推广员ID
|
||||
SPREAD_ID: 'SPREAD_ID',
|
||||
//用户信息
|
||||
USER_INFO: 'USER_INFO',
|
||||
//租户信息
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
realName: '',
|
||||
mobile: '',
|
||||
code: '',
|
||||
spreadId: ''
|
||||
promoterId: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -69,7 +69,7 @@
|
|||
async onRegister() {
|
||||
this.loading = true
|
||||
try {
|
||||
this.registerForm.spreadId = store.state.app.spreadId || ''
|
||||
this.registerForm.promoterId = store.state.app.spreadId || ''
|
||||
const res = await register(this.registerForm)
|
||||
this.$util.Tips({
|
||||
title: res.code === 0 ? '注册成功' : res.msg
|
||||
|
|
|
@ -59,10 +59,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<button class='modifyBnt bg-color' formType="submit">保存修改</button>
|
||||
<!-- #ifdef H5 -->
|
||||
<view class="logOut cart-color acea-row row-center-wrapper" @click="outLogin"
|
||||
v-if="!this.$wechat.isWeixin()">退出登录</view>
|
||||
<!-- #endif -->
|
||||
<view class="logOut cart-color acea-row row-center-wrapper" @click="outLogin">退出登录</view>
|
||||
</view>
|
||||
</form>
|
||||
<!-- #ifdef MP -->
|
||||
|
|
|
@ -203,8 +203,10 @@
|
|||
let that = this;
|
||||
let href = '';
|
||||
// href = window.location.href.split('/pages')[0];
|
||||
console.log('uid', that.uid)
|
||||
const baseUrl = 'http://yuxy.perrymake.com';
|
||||
const url =`${baseUrl}/pages/index/index?redirectUrl=${baseUrl}&tenantId=${that.tenantId}&spreadId=${that.uid}`
|
||||
console.log('url', url)
|
||||
uQRCode.make({
|
||||
canvasId: 'qrcode',
|
||||
// text: href + '/pages/index/index?spreadId=' + that.uid,
|
||||
|
@ -212,7 +214,6 @@
|
|||
size: this.qrcodeSize,
|
||||
margin: 10,
|
||||
success: res => {
|
||||
console.log('res', res)
|
||||
that.PromotionCode = res;
|
||||
setTimeout(() => {
|
||||
that.PosterCanvas(this.base64List[0], that.PromotionCode, that.userInfo
|
||||
|
|
|
@ -7,6 +7,7 @@ import {
|
|||
UID,
|
||||
TENANT_ID,
|
||||
OPEN_ID,
|
||||
SPREAD_ID,
|
||||
PLATFORM
|
||||
} from '../../config/cache';
|
||||
import Cache from '../../utils/cache';
|
||||
|
@ -23,7 +24,7 @@ const state = {
|
|||
tenantInfo: Cache.get(TENANT_INFO)?JSON.parse(Cache.get(TENANT_INFO)):null,
|
||||
uid: Cache.get(UID) || null,
|
||||
tenantId: Cache.get(TENANT_ID) || '',
|
||||
spreadId: '',
|
||||
spreadId: Cache.get(SPREAD_ID) || '',
|
||||
openId: Cache.get(OPEN_ID) || '',
|
||||
homeActive: false,
|
||||
chatUrl: Cache.get('chatUrl') || '',
|
||||
|
@ -52,6 +53,7 @@ const mutations = {
|
|||
},
|
||||
SET_SPREADID(state, val){
|
||||
state.spreadId = val;
|
||||
Cache.set(SPREAD_ID, val);
|
||||
},
|
||||
SET_OPENID(state, val){
|
||||
state.openId = val;
|
||||
|
|
Loading…
Reference in New Issue