Merge remote-tracking branch 'origin/feature/mall_product' into feature/mall_product_new

pull/2/head
perry 2023-05-17 09:32:22 +08:00
commit 467c1dd402
47 changed files with 1317 additions and 150 deletions

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.framework.pay.config;
import cn.iocoder.yudao.framework.pay.properties.AliPayProperties;
import cn.iocoder.yudao.framework.pay.properties.WxPayProperties;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.github.binarywang.wxpay.service.WxPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @Title:AliPayConfig
* @Description: TODO
* @author: tangqian
* @date: 2023/5/16 13:29
* @version: V1.0.0
*/
@Configuration
@ConditionalOnClass(AlipayClient.class)
@EnableConfigurationProperties(AliPayProperties.class)
@ConditionalOnProperty(prefix = "ali.pay.one", value = "enabled", matchIfMissing = true)
public class AliPayConfig {
private AliPayProperties aliPayProperties;
@Autowired
public AliPayConfig(AliPayProperties aliPayProperties) {
this.aliPayProperties = aliPayProperties;
}
@Bean
@ConditionalOnMissingBean(AlipayClient.class)
public AlipayClient alipayClient() {
return new DefaultAlipayClient(aliPayProperties.getGatewayUrl(), aliPayProperties.getAppId(),
aliPayProperties.getMerchantPrivateKey(), "json", "UTF-8", aliPayProperties.getAlipayPublicKey(), "RSA2");
}
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.framework.pay.properties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @Title:AliPayProperties
* @Description: TODO
* @author: tangqian
* @date: 2023/5/16 13:35
* @version: V1.0.0
*/
@Data
@Component
@ConfigurationProperties(prefix = AliPayProperties.PREFIX)
public class AliPayProperties {
public static final String PREFIX = "ali.pay.one";
/**
* appId.
*/
private String appId;
/**
* .
*/
private String merchantPrivateKey;
/**
* .
*/
private String alipayPublicKey;
/**
* .
*/
private String gatewayUrl;
/**
* .
*/
private String notifyUrl;
}

View File

@ -1,3 +1,4 @@
cn.iocoder.yudao.framework.pay.config.YudaoPayAutoConfiguration
cn.iocoder.yudao.framework.pay.config.WxPayOneAutoConfiguration
cn.iocoder.yudao.framework.pay.config.WxPayTwoAutoConfiguration
cn.iocoder.yudao.framework.pay.config.WxPayTwoAutoConfiguration
cn.iocoder.yudao.framework.pay.config.AliPayConfig

View File

@ -0,0 +1,60 @@
package cn.iocoder.yudao.module.shop.request.member;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @Title:OrderContentRequest
* @Description:
* @author: tangqian
* @date: 2023/5/15 20:45
* @version: V1.0.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Schema(description="会员充值下单请求入参")
public class OrderContentRequest implements Serializable {
private static final long serialVersionUID = -9170167938995005780L;
@Schema(description = "用户电话")
private String userPhone;
@Schema(description = "确认手机号")
private String confirmPhone;
@Schema(description = "openid(支付者微信支付)")
private String openid;
@Schema(description = "支付类型 支付宝ALIPAY 微信WXPAY")
@NotEmpty(message = "支付类型不能为空")
private String payType;
@Schema(description = "订单信息")
private List<OrderInfo> orderInfos;
@Data
public static class OrderInfo implements Serializable{
private static final long serialVersionUID = -4967251473044468810L;
@Schema(description = "订单id")
@NotNull(message = "挡位id不能为空")
private Integer gearId;
@Schema(description = "档位名称")
@NotEmpty(message = "挡位名称不能为空")
private String name;
@Schema(description = "挡位备注不能为空")
@NotEmpty(message = "挡位备注不能为空")
private String gearRemarks;
@Schema(description = "挡位金额不能为空")
@NotNull(message = "挡位金额不能为空")
private Integer gearAmount;
}
}

View File

@ -0,0 +1,33 @@
package cn.iocoder.yudao.module.shop.request.member;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
/**
* @Title:OrderPayRequest
* @Description:
* @author: tangqian
* @date: 2023/5/15 20:54
* @version: V1.0.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Schema(description="订单选择支付方式发起支付入参")
public class OrderPayRequest implements Serializable {
private static final long serialVersionUID = 6720933184418303650L;
@Schema(description = "订单id")
@NotEmpty(message = "orderId不能为空")
private String orderId;
@Schema(description = "支付类型 支付宝ALIPAY 微信WXPAY")
@NotEmpty(message = "支付类型不能为空")
private String payType;
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.shop.request.member;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @Title:OrderContentRequest
* @Description: 退
* @author: tangqian
* @date: 2023/5/15 20:45
* @version: V1.0.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Schema(description="退款")
public class RefundRequest implements Serializable {
private static final long serialVersionUID = -9170167938995005780L;
@Schema(description = "数据id")
private String orderId;
}

View File

@ -0,0 +1,18 @@
package cn.iocoder.yudao.module.shop.response.member;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @Title:AliPayOrderResponse
* @Description: TODO
* @author: tangqian
* @date: 2023/5/15 21:09
* @version: V1.0.0
*/
@Data
@Accessors(chain = true)
public class AliPayOrderResponse extends PayResponse {
//支付宝统一下单返回参数
private String body;
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.shop.response.member;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* @Title:ChangeOrderPayTypeResponse
* @Description: -
* @author: tangqian
* @date: 2023/5/15 21:05
* @version: V1.0.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Schema(description="订单选择订单支付方式-返回参数")
public class ChangeOrderPayTypeResponse implements Serializable {
private static final long serialVersionUID = -4147278073881962962L;
@Schema(description = "订单id")
private String orderId;
@Schema(description = "支付类型 支付宝ALIPAY 微信WXPAY")
private String payType;
@Schema(description = "订单金额(分)")
private String orderPay;
@Schema(description = "需要支付金额(分)")
private String needPay;
@Schema(description = "商品名称")
private String goodsName;
@Schema(description = "此参数根据支付类型的不同,返回的参数有所不同。")
private PayResponse orderInfo;
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.shop.response.member;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;
/**
* @Title:InitOrderResponse
* @Description: TODO
* @author: tangqian
* @date: 2023/5/15 21:20
* @version: V1.0.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Schema(description="预下单返回参数")
public class InitOrderResponse implements Serializable {
private static final long serialVersionUID = 6894715033655337607L;
@Schema(description = "h5_url")
private String h5Url;
@Schema(description ="二维码链接")
private String codeUrl;
}

View File

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.shop.response.member;
import java.io.Serializable;
/**
* @Title:PayResponse
* @Description:
* @author: tangqian
* @date: 2023/5/15 21:06
* @version: V1.0.0
*/
public class PayResponse implements Serializable {
private static final long serialVersionUID = 9219937300257494629L;
}

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.shop.response.member;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @Title:WxPayOrderResponse
* @Description: TODO
* @author: tangqian
* @date: 2023/5/15 21:11
* @version: V1.0.0
*/
@Data
@Accessors(chain = true)
public class WxPayOrderResponse extends PayResponse{
//交易类型
private String tradeType;
//预支付ID
private String prepayId;
//支付跳转链接
private String mwebUrl;
}

View File

@ -2,11 +2,12 @@ package cn.iocoder.yudao.module.shop.controller.admin.express;
import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.module.shop.controller.admin.express.vo.ShippingTemplatesReqVO;
import cn.iocoder.yudao.module.shop.controller.admin.express.vo.ShippingTemplatesSearchReqVO;
import cn.iocoder.yudao.module.shop.dal.dataobject.express.ShippingTemplatesDO;
import cn.iocoder.yudao.module.shop.service.express.ShippingTemplatesService;
import com.github.pagehelper.PageInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -46,8 +47,8 @@ public class ShippingTemplatesController {
@PreAuthorize("@ss.hasPermission('admin:shipping:templates:list')")
@Operation(summary = "分页列表")
@GetMapping(value = "/list")
public CommonResult<PageResult<ShippingTemplatesDO>> getList(@Validated ShippingTemplatesSearchReqVO request){
PageResult<ShippingTemplatesDO> shippingTemplatesCommonPage = shippingTemplatesService.getList(request);
public CommonResult<PageInfo<ShippingTemplatesDO>> getList(@Validated ShippingTemplatesSearchReqVO request, @Validated PageParam pageParamRequest){
PageInfo<ShippingTemplatesDO> shippingTemplatesCommonPage = shippingTemplatesService.getList(request, pageParamRequest);
return CommonResult.success(shippingTemplatesCommonPage);
}

View File

@ -30,7 +30,7 @@ import java.util.List;
@Slf4j
@RestController
@RequestMapping("admin/express/shipping/no_delivery")
@Tag(name = "设置 -- 物流 -- 免费")
@Tag(name = "设置 -- 物流 -- 不送达")
public class ShippingTemplatesNoDeliveryController {
@Autowired

View File

@ -39,9 +39,6 @@ public class ShippingTemplatesFreeRespVO implements Serializable {
@Schema(description = "省ID, 多个逗号分割。 全国 all", required = true, example = "1,2,3,4")
private String provinceId;
@Schema(description = "城市名称描述")
private String title;
@Schema(description = "包邮件数", required = true, example = "1")
// @Min(value = 1, message = "请填写包邮件数")
@DecimalMin(value = "0.1", message = "包邮不能低于0.1")

View File

@ -38,8 +38,6 @@ public class ShippingTemplatesRegionRespVO implements Serializable {
@Schema(description = "省ID, 多个逗号分割。 全国 all", required = true, example = "1,2,3,4")
private String provinceId;
@Schema(description = "城市名称描述")
private String title;
@Schema(description = "首件", required = true, example = "0.1")
@DecimalMin(value = "0.1", message = "首件金额不能低于0.1")
@ -57,6 +55,4 @@ public class ShippingTemplatesRegionRespVO implements Serializable {
@DecimalMin(value = "0.1", message = "续件运费金额不能低于0.1")
private BigDecimal renewalPrice;
@Schema(description = "分组唯一值")
private String uniqid;
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.shop.controller.admin.notify;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.shop.service.order.StoreOrderService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/**
* @Title:AliPayNotifyController
* @Description: TODO
* @author: tangqian
* @date: 2023/5/16 16:45
* @version: V1.0.0
*/
@Slf4j
@RequestMapping("notify/ali")
@RestController
@Tag(name = "支付宝支付回调 - 订单支付")
public class AliPayNotifyController {
@Autowired
private StoreOrderService storeOrderService;
@PostMapping("pay_notify")
public CommonResult<Object> payNotify(HttpServletRequest request, @RequestBody Map<String, String> params) {
return CommonResult.success(storeOrderService.aliNotify(request, params));
}
@PostMapping("refund_notify")
public CommonResult<Object> refundNotify(HttpServletRequest request, @RequestBody Map<String, String> params) {
return CommonResult.success(storeOrderService.refundNotify(request, params));
}
}

View File

@ -0,0 +1,52 @@
package cn.iocoder.yudao.module.shop.controller.app.buy;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
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;
import cn.iocoder.yudao.module.shop.service.order.StoreOrderService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
/**
* @Title:TopUpOrderController
* @Description:
* @author: tangqian
* @date: 2023/5/15 20:12
* @version: V1.0.0
*/
@Slf4j
@RestController
@RequestMapping("api/order/member")
@Tag(name = "用户 APP - 会员充值订单管理")
public class TopUpOrderController {
@Autowired
private StoreOrderService storeOrderService;
@Operation(summary = "会员充值")
@RequestMapping(value = "/memberTopUp", method = RequestMethod.POST)
public CommonResult<InitOrderResponse> memberTopUp(@Valid @RequestBody OrderContentRequest request, HttpServletRequest servletRequest) throws Exception {
log.info("initOrder会员充值===>{}", request);
return CommonResult.success(storeOrderService.memberTopUp(request, servletRequest));
}
@Operation(summary = "退款")
@RequestMapping(value = "/memberRefund", method = RequestMethod.POST)
public CommonResult<Object> memberRefund(@Valid @RequestBody RefundRequest request, HttpServletRequest servletRequest) throws Exception {
log.info("memberRefund会员退款===>{}", request);
return CommonResult.success(storeOrderService.memberRefund(request, servletRequest));
}
}

View File

@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.shop.controller.app.product;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.module.shop.controller.app.product.vo.IndexProductResponse;
import cn.iocoder.yudao.module.shop.controller.app.product.vo.ProductDetailResponse;
import cn.iocoder.yudao.module.shop.controller.app.product.vo.IndexProductRespVO;
import cn.iocoder.yudao.module.shop.controller.app.product.vo.ProductDetailRespVO;
import cn.iocoder.yudao.module.shop.dal.dataobject.product.StoreProduct;
import cn.iocoder.yudao.module.shop.request.product.ProductListRequest;
import cn.iocoder.yudao.module.shop.request.product.ProductRequest;
@ -49,7 +49,7 @@ public class ProductController {
*/
@Operation(summary = "热门商品推荐")
@RequestMapping(value = "/product/hot", method = RequestMethod.GET)
public CommonResult<PageInfo<IndexProductResponse>> getHotProductList(@Validated PageParam pageParamRequest) {
public CommonResult<PageInfo<IndexProductRespVO>> getHotProductList(@Validated PageParam pageParamRequest) {
return CommonResult.success(productService.getHotProductList(pageParamRequest));
}
@ -58,7 +58,7 @@ public class ProductController {
*/
@Operation(summary = "优选商品推荐")
@RequestMapping(value = "/product/good", method = RequestMethod.GET)
public CommonResult<PageInfo<IndexProductResponse>> getGoodProductList() {
public CommonResult<PageInfo<IndexProductRespVO>> getGoodProductList() {
return CommonResult.success(productService.getGoodProductList());
}
@ -76,7 +76,7 @@ public class ProductController {
*/
@Operation(summary = "商品列表")
@RequestMapping(value = "/products", method = RequestMethod.GET)
public CommonResult<PageInfo<IndexProductResponse>> getList(@Validated ProductRequest request, @Validated PageParam pageParamRequest) {
public CommonResult<PageInfo<IndexProductRespVO>> getList(@Validated ProductRequest request, @Validated PageParam pageParamRequest) {
return CommonResult.success(productService.getList(request, pageParamRequest));
}
@ -86,7 +86,7 @@ public class ProductController {
@Operation(summary = "商品详情")
@RequestMapping(value = "/product/detail/{id}", method = RequestMethod.GET)
@Parameter(name = "type", description = "normal-正常video-视频")
public CommonResult<ProductDetailResponse> getDetail(@PathVariable Integer id, @RequestParam(value = "type", defaultValue = "normal") String type) {
public CommonResult<ProductDetailRespVO> getDetail(@PathVariable Integer id, @RequestParam(value = "type", defaultValue = "normal") String type) {
return CommonResult.success(productService.getDetail(id, type));
}
@ -124,7 +124,7 @@ public class ProductController {
*/
@Operation(summary = "商品列表(个别分类模型使用)")
@RequestMapping(value = "/product/list", method = RequestMethod.GET)
public CommonResult<PageInfo<IndexProductResponse>> getProductList(@Validated ProductListRequest request, @Validated PageParam pageParamRequest) {
public CommonResult<PageInfo<IndexProductRespVO>> getProductList(@Validated ProductListRequest request, @Validated PageParam pageParamRequest) {
return CommonResult.success(productService.getCategoryProductList(request, pageParamRequest));
}
@ -133,7 +133,7 @@ public class ProductController {
*/
@Operation(summary = "商品规格详情")
@RequestMapping(value = "/product/sku/detail/{id}", method = RequestMethod.GET)
public CommonResult<ProductDetailResponse> getSkuDetail(@PathVariable Integer id) {
public CommonResult<ProductDetailRespVO> getSkuDetail(@PathVariable Integer id) {
return CommonResult.success(productService.getSkuDetail(id));
}

View File

@ -6,6 +6,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
/**
@ -24,7 +25,7 @@ import java.math.BigDecimal;
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Schema(description="首页商品对象")
public class IndexProductResponse {
public class IndexProductRespVO implements Serializable {
@Schema(description = "商品id")

View File

@ -28,7 +28,7 @@ import java.util.List;
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Schema(description="商品详情H5")
public class ProductDetailResponse implements Serializable {
public class ProductDetailRespVO implements Serializable {
private static final long serialVersionUID=1L;

View File

@ -1,6 +1,6 @@
package cn.iocoder.yudao.module.shop.convert.product;
import cn.iocoder.yudao.module.shop.controller.app.product.vo.IndexProductResponse;
import cn.iocoder.yudao.module.shop.controller.app.product.vo.IndexProductRespVO;
import cn.iocoder.yudao.module.shop.dal.dataobject.product.StoreProduct;
import cn.iocoder.yudao.module.shop.vo.product.StoreProductVO;
import org.mapstruct.Mapper;
@ -14,5 +14,5 @@ public interface StoreProductConvert {
StoreProductVO convert(StoreProduct bean);
List<IndexProductResponse> convert1(List<StoreProduct> bean);
List<IndexProductRespVO> convert1(List<StoreProduct> bean);
}

View File

@ -45,11 +45,6 @@ public class ShippingTemplatesFreeDO implements Serializable {
*/
private Integer cityId;
/**
*
*/
private String title;
/**
*
*/

View File

@ -46,11 +46,6 @@ public class ShippingTemplatesRegionDO implements Serializable {
private Integer provinceId;
/**
*
*/
private String title;
/**
*
*/
@ -76,11 +71,6 @@ public class ShippingTemplatesRegionDO implements Serializable {
*/
private Integer type;
/**
*
*/
private String uniqid;
/**
*
*/

View File

@ -36,4 +36,6 @@ public interface ShippingTemplatesNoDeliveryService extends IService<ShippingTem
* @return
*/
ShippingTemplatesNoDeliveryDO getByTempIdAndCityId(Integer tempId, Integer cityId);
public Boolean delete(Integer tempId);
}

View File

@ -1,10 +1,11 @@
package cn.iocoder.yudao.module.shop.service.express;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.module.shop.controller.admin.express.vo.ShippingTemplatesReqVO;
import cn.iocoder.yudao.module.shop.controller.admin.express.vo.ShippingTemplatesSearchReqVO;
import cn.iocoder.yudao.module.shop.dal.dataobject.express.ShippingTemplatesDO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
@ -25,7 +26,7 @@ import org.springframework.validation.annotation.Validated;
@Validated
public interface ShippingTemplatesService extends IService<ShippingTemplatesDO> {
PageResult<ShippingTemplatesDO> getList(ShippingTemplatesSearchReqVO request);
PageInfo<ShippingTemplatesDO> getList(ShippingTemplatesSearchReqVO request, PageParam pageParamRequest);
/**
*

View File

@ -18,7 +18,6 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* ShippingTemplatesFreeServiceImpl
@ -68,7 +67,7 @@ public class ShippingTemplatesFreeServiceImpl extends ServiceImpl<ShippingTempla
for (Integer cityId: cityIdList) {
ShippingTemplatesFreeDO shippingTemplatesFreeDO = new ShippingTemplatesFreeDO();
shippingTemplatesFreeDO.setCityId(cityId);
shippingTemplatesFreeDO.setTitle(shippingTemplatesFreeRespVO.getTitle());
// shippingTemplatesFreeDO.setTitle(shippingTemplatesFreeRespVO.getTitle());
shippingTemplatesFreeDO.setUniqid(uniqueKey);
shippingTemplatesFreeDO.setTempId(tempId);
shippingTemplatesFreeDO.setType(type);
@ -82,7 +81,7 @@ public class ShippingTemplatesFreeServiceImpl extends ServiceImpl<ShippingTempla
saveBatch(shippingTemplatesFreesListDO);
//删除模板下的无效数据
delete(tempId);
deleteStatusFalse(tempId);
}
/**
@ -116,11 +115,21 @@ public class ShippingTemplatesFreeServiceImpl extends ServiceImpl<ShippingTempla
}
/**
*
*
* @param tempId Integer id
*/
@Override
public Boolean delete(Integer tempId) {
LambdaQueryWrapper<ShippingTemplatesFreeDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ShippingTemplatesFreeDO::getTempId, tempId);
return dao.delete(lambdaQueryWrapper) > 0;
}
/**
*
* @param tempId Integer id
*/
public Boolean deleteStatusFalse(Integer tempId) {
LambdaQueryWrapper<ShippingTemplatesFreeDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ShippingTemplatesFreeDO::getTempId, tempId);
lambdaQueryWrapper.eq(ShippingTemplatesFreeDO::getStatus, false);

View File

@ -11,14 +11,12 @@ import cn.iocoder.yudao.module.shop.dal.mysql.express.ShippingTemplatesNoDeliver
import cn.iocoder.yudao.module.shop.service.express.ShippingTemplatesNoDeliveryService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Service
@Validated
@ -41,6 +39,7 @@ public class ShippingTemplatesNoDeliveryServiceImpl extends ServiceImpl<Shipping
public void saveAll(List<ShippingTemplatesNoDeliveryRespVO> shippingTemplatesNoDeliveryRespVOS, Integer tempId) {
ArrayList<ShippingTemplatesNoDeliveryDO> shippingTemplatesNoDeliveryDOS = new ArrayList<>();
delete(tempId);
for (ShippingTemplatesNoDeliveryRespVO shippingTemplatesNoDeliveryRespVO : shippingTemplatesNoDeliveryRespVOS) {
if(shippingTemplatesNoDeliveryRespVO.getCityId().equals("all") || shippingTemplatesNoDeliveryRespVO.getCityId().equals("0")){
cityIdList = getCityIdList();
@ -58,6 +57,17 @@ public class ShippingTemplatesNoDeliveryServiceImpl extends ServiceImpl<Shipping
saveBatch(shippingTemplatesNoDeliveryDOS);
}
/**
*
* @param tempId Integer id
*/
@Override
public Boolean delete(Integer tempId) {
LambdaQueryWrapper<ShippingTemplatesNoDeliveryDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ShippingTemplatesNoDeliveryDO::getTempId, tempId);
return shippingTemplatesNoDeliveryMapper.delete(lambdaQueryWrapper) > 0;
}
/**
* cityId
* @author Mr.Zhang

View File

@ -20,7 +20,6 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
/**
* ShippingTemplatesRegionServiceImpl
@ -79,8 +78,7 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl<ShippingTemp
for (Integer cityId: cityIdList) {
ShippingTemplatesRegionDO shippingTemplatesRegionDO = new ShippingTemplatesRegionDO();
shippingTemplatesRegionDO.setCityId(cityId);
shippingTemplatesRegionDO.setTitle(shippingTemplatesRegionRespVO.getTitle());
shippingTemplatesRegionDO.setUniqid(uniqueKey);
// shippingTemplatesRegionDO.setTitle(shippingTemplatesRegionRespVO.getTitle());
shippingTemplatesRegionDO.setRenewal(shippingTemplatesRegionRespVO.getRenewal());
shippingTemplatesRegionDO.setRenewalPrice(shippingTemplatesRegionRespVO.getRenewalPrice());
shippingTemplatesRegionDO.setFirst(shippingTemplatesRegionRespVO.getFirst());
@ -95,7 +93,7 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl<ShippingTemp
saveBatch(shippingTemplatesRegionDOList);
//删除模板下的无效数据
delete(tempId);
deleteStatusFalse(tempId);
}
/**
@ -133,8 +131,7 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl<ShippingTemp
* @param tempId Integer id
* @return Boolean
*/
@Override
public Boolean delete(Integer tempId) {
public Boolean deleteStatusFalse(Integer tempId) {
LambdaQueryWrapper<ShippingTemplatesRegionDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ShippingTemplatesRegionDO::getTempId, tempId);
lambdaQueryWrapper.eq(ShippingTemplatesRegionDO::getStatus, false);
@ -152,7 +149,6 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl<ShippingTemp
LambdaQueryWrapper<ShippingTemplatesRegionDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ShippingTemplatesRegionDO::getTempId, tempId);
lambdaQueryWrapper.eq(ShippingTemplatesRegionDO::getCityId, cityId);
lambdaQueryWrapper.eq(ShippingTemplatesRegionDO::getStatus, true);
lambdaQueryWrapper.orderByDesc(ShippingTemplatesRegionDO::getId);
lambdaQueryWrapper.last(" limit 1");
return dao.selectOne(lambdaQueryWrapper);
@ -167,5 +163,12 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl<ShippingTemp
public List<ShippingTemplatesRegionRespVO> getListGroup(Integer tempId) {
return dao.getListGroup(tempId);
}
@Override
public Boolean delete(Integer tempId) {
LambdaQueryWrapper<ShippingTemplatesRegionDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ShippingTemplatesRegionDO::getTempId, tempId);
return dao.delete(lambdaQueryWrapper) > 0;
}
}

View File

@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.shop.service.express.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.module.shop.controller.admin.express.vo.*;
import cn.iocoder.yudao.module.shop.dal.dataobject.express.ShippingTemplatesDO;
import cn.iocoder.yudao.module.shop.dal.mysql.express.ShippingTemplatesMapper;
@ -13,6 +13,8 @@ import cn.iocoder.yudao.module.shop.service.express.ShippingTemplatesRegionServi
import cn.iocoder.yudao.module.shop.service.express.ShippingTemplatesService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -59,15 +61,16 @@ public class ShippingTemplatesServiceImpl extends ServiceImpl<ShippingTemplatesM
* @return List<ShippingTemplates>
*/
@Override
public PageResult<ShippingTemplatesDO> getList(ShippingTemplatesSearchReqVO request) {
public PageInfo<ShippingTemplatesDO> getList(ShippingTemplatesSearchReqVO request, PageParam pageParamRequest) {
PageHelper.startPage(pageParamRequest.getPageNo(), pageParamRequest.getPageSize());
LambdaQueryWrapper<ShippingTemplatesDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if(!StringUtils.isBlank(request.getKeywords())){
lambdaQueryWrapper.like(ShippingTemplatesDO::getName, request.getKeywords());
}
lambdaQueryWrapper.orderByDesc(ShippingTemplatesDO::getSort).orderByDesc(ShippingTemplatesDO::getId);
return dao.selectPage(request, lambdaQueryWrapper);
lambdaQueryWrapper.orderByDesc(ShippingTemplatesDO::getSort).orderByDesc(ShippingTemplatesDO::getId);
return new PageInfo<>(dao.selectList(lambdaQueryWrapper));
}
/**
@ -92,6 +95,7 @@ public class ShippingTemplatesServiceImpl extends ServiceImpl<ShippingTemplatesM
shippingTemplatesDO.setName(request.getName());
shippingTemplatesDO.setSort(request.getSort());
shippingTemplatesDO.setType(request.getType());
shippingTemplatesDO.setDeleted(false);
shippingTemplatesDO.setAppoint(request.getAppoint());
save(shippingTemplatesDO);
@ -183,7 +187,8 @@ public class ShippingTemplatesServiceImpl extends ServiceImpl<ShippingTemplatesM
return transactionTemplate.execute(e -> {
shippingTemplatesRegionService.delete(id);
shippingTemplatesFreeService.delete(id);
removeById(id);
shippingTemplatesNoDeliveryService.delete(id);
dao.deleteById(id);
return Boolean.TRUE;
});
}

View File

@ -2,15 +2,24 @@ package cn.iocoder.yudao.module.shop.service.order;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrder;
import cn.iocoder.yudao.module.shop.request.member.OrderContentRequest;
import cn.iocoder.yudao.module.shop.request.member.OrderPayRequest;
import cn.iocoder.yudao.module.shop.request.member.RefundRequest;
import cn.iocoder.yudao.module.shop.request.order.StoreOrderRefundRequest;
import cn.iocoder.yudao.module.shop.request.order.StoreOrderSearchRequest;
import cn.iocoder.yudao.module.shop.request.order.StoreOrderSendRequest;
import cn.iocoder.yudao.module.shop.request.order.StoreOrderUpdatePriceRequest;
import cn.iocoder.yudao.module.shop.response.member.ChangeOrderPayTypeResponse;
import cn.iocoder.yudao.module.shop.response.member.InitOrderResponse;
import cn.iocoder.yudao.module.shop.response.order.*;
import cn.iocoder.yudao.module.shop.vo.order.LogisticsResultVo;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.pagehelper.PageInfo;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@ -370,4 +379,23 @@ public interface StoreOrderService extends IService<StoreOrder> {
* @param spreadId 广uid
*/
OrderBrokerageData getBrokerageData(Integer uid, Integer spreadId);
/**
*
* @param request
* @return
*/
InitOrderResponse memberTopUp(OrderContentRequest request, HttpServletRequest servletRequest) throws WxPayException;
/**
*
* @param request
* @param params
* @return
*/
Object aliNotify(HttpServletRequest request, Map<String, String> params);
Object memberRefund(RefundRequest request, HttpServletRequest servletRequest);
Object refundNotify(HttpServletRequest request, Map<String, String> params);
}

View File

@ -9,28 +9,44 @@ import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.framework.common.pojo.DateLimitUtilVo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.pay.config.WxPayOneAutoConfiguration;
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.member.api.user.MemberUserApi;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrder;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderInfoDO;
import cn.iocoder.yudao.module.shop.dal.mysql.order.StoreOrderMapper;
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.OrderContentRequest;
import cn.iocoder.yudao.module.shop.request.member.RefundRequest;
import cn.iocoder.yudao.module.shop.request.order.StoreOrderRefundRequest;
import cn.iocoder.yudao.module.shop.request.order.StoreOrderSearchRequest;
import cn.iocoder.yudao.module.shop.request.order.StoreOrderSendRequest;
import cn.iocoder.yudao.module.shop.request.order.StoreOrderUpdatePriceRequest;
import cn.iocoder.yudao.module.shop.response.member.InitOrderResponse;
import cn.iocoder.yudao.module.shop.response.order.*;
import cn.iocoder.yudao.module.shop.service.order.StoreOrderInfoService;
import cn.iocoder.yudao.module.shop.service.order.StoreOrderRefundService;
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.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;
import com.alipay.api.AlipayApiException;
import com.alipay.api.internal.util.AlipaySignature;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
@ -40,14 +56,16 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -90,7 +108,15 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
private TransactionTemplate transactionTemplate;
@Autowired
private StoreOrderInfoService storeOrderInfoService;
private StrategySupport strategySupport;
@Autowired
private RechargeOrderMapper rechargeOrderMapper;
@Autowired
private RechargeOrderInfoMapper rechargeOrderInfoMapper;
@Autowired
private AliPayProperties aliPayProperties;
/**
* PC
@ -205,14 +231,14 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
public Long getTopDataUtil(Integer status, Integer userId) {
LambdaQueryWrapper<StoreOrder> lqw = new LambdaQueryWrapper<>();
orderUtil.statusApiByWhere(lqw, status);
lqw.eq(StoreOrder::getUid,userId);
lqw.eq(StoreOrder::getUid, userId);
return mapper.selectCount(lqw);
}
@Override
public List<StoreOrder> getOrderGroupByDate(String dateLimit, int lefTime) {
QueryWrapper<StoreOrder> queryWrapper = new QueryWrapper<>();
queryWrapper.select("sum(pay_price) as pay_price", "left(create_time, "+lefTime+") as orderId", "count(id) as id");
queryWrapper.select("sum(pay_price) as pay_price", "left(create_time, " + lefTime + ") as orderId", "count(id) as id");
if (StringUtils.isNotBlank(dateLimit)) {
DateLimitUtilVo dateLimitVo = DateUtils.getDateLimit(dateLimit);
queryWrapper.between("create_time", dateLimitVo.getStartTime(), dateLimitVo.getEndTime());
@ -421,20 +447,20 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
String dateStartD = dateRange.getStartTime();
String dateEndD = dateRange.getEndTime();
int days = DateUtils.daysBetween(
DateUtils.strToDate(dateStartD,Constants.DATE_FORMAT_DATE),
DateUtils.strToDate(dateEndD,Constants.DATE_FORMAT_DATE)
DateUtils.strToDate(dateStartD, Constants.DATE_FORMAT_DATE),
DateUtils.strToDate(dateEndD, Constants.DATE_FORMAT_DATE)
);
// 同时间区间的上一个时间起点
String perDateStart = DateUtils.addDay(
DateUtils.strToDate(dateStartD,Constants.DATE_FORMAT_DATE), -days, Constants.DATE_FORMAT_START);
DateUtils.strToDate(dateStartD, Constants.DATE_FORMAT_DATE), -days, Constants.DATE_FORMAT_START);
// 当前时间区间
String dateStart = DateUtils.addDay(
DateUtils.strToDate(dateStartD,Constants.DATE_FORMAT_DATE),0,Constants.DATE_FORMAT_START);
DateUtils.strToDate(dateStartD, Constants.DATE_FORMAT_DATE), 0, Constants.DATE_FORMAT_START);
String dateEnd = DateUtils.addDay(
DateUtils.strToDate(dateEndD,Constants.DATE_FORMAT_DATE),0,Constants.DATE_FORMAT_END);
DateUtils.strToDate(dateEndD, Constants.DATE_FORMAT_DATE), 0, Constants.DATE_FORMAT_END);
// 上一个时间段查询
List<StoreOrder> orderPerList = getOrderPayedByDateLimit(perDateStart,dateStart);
List<StoreOrder> orderPerList = getOrderPayedByDateLimit(perDateStart, dateStart);
// 当前时间段
List<StoreOrder> orderCurrentList = getOrderPayedByDateLimit(dateStart, dateEnd);
@ -443,23 +469,23 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
double perSumPrice = orderPerList.stream().mapToDouble(e -> e.getPayPrice().doubleValue()).sum();
double currentSumPrice = orderCurrentList.stream().mapToDouble(e -> e.getPayPrice().doubleValue()).sum();
response.setChart(mapper.getOrderStatisticsPriceDetail(new StoreDateRangeSqlPram(dateStart,dateEnd)));
response.setTime(BigDecimal.valueOf(currentSumPrice).setScale(2,BigDecimal.ROUND_HALF_UP));
response.setChart(mapper.getOrderStatisticsPriceDetail(new StoreDateRangeSqlPram(dateStart, dateEnd)));
response.setTime(BigDecimal.valueOf(currentSumPrice).setScale(2, BigDecimal.ROUND_HALF_UP));
// 当前营业额和上一个同比营业额增长区间
increasePrice = currentSumPrice - perSumPrice;
if (increasePrice <= 0) response.setGrowthRate(0);
else if (perSumPrice == 0) response.setGrowthRate((int) increasePrice * 100);
else response.setGrowthRate((int)((increasePrice * perSumPrice) * 100));
}else if (type ==2) {
response.setChart(mapper.getOrderStatisticsOrderCountDetail(new StoreDateRangeSqlPram(dateStart,dateEnd)));
else response.setGrowthRate((int) ((increasePrice * perSumPrice) * 100));
} else if (type == 2) {
response.setChart(mapper.getOrderStatisticsOrderCountDetail(new StoreDateRangeSqlPram(dateStart, dateEnd)));
response.setTime(BigDecimal.valueOf(orderCurrentList.size()));
increasePrice = orderCurrentList.size() - orderPerList.size();
if (increasePrice <= 0) response.setGrowthRate(0);
else if (orderPerList.size() == 0) response.setGrowthRate((int) increasePrice);
else response.setGrowthRate((int)((increasePrice / orderPerList.size()) * 100));
else response.setGrowthRate((int) ((increasePrice / orderPerList.size()) * 100));
}
response.setIncreaseTime(increasePrice+"");
response.setIncreaseTimeStatus(increasePrice >= 0 ? 1:2);
response.setIncreaseTime(increasePrice + "");
response.setIncreaseTimeStatus(increasePrice >= 0 ? 1 : 2);
return response;
}
@ -532,7 +558,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
lqw.set(StoreOrder::getPaid, true);
lqw.set(StoreOrder::getPayTime, DateUtils.nowDateTime());
lqw.eq(StoreOrder::getOrderId, orderNo);
lqw.eq(StoreOrder::getPaid,false);
lqw.eq(StoreOrder::getPaid, false);
return update(lqw);
}
@ -624,10 +650,10 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
throw new ServiceException("系统只支持一次改价");
}
// 修改价格和原来价格相同
if (existOrder.getPayPrice().compareTo(request.getPayPrice()) ==0) {
if (existOrder.getPayPrice().compareTo(request.getPayPrice()) == 0) {
throw new ServiceException(StrUtil.format("修改价格不能和原支付价格相同 原价 {} 修改价 {}", existOrder.getPayPrice(), request.getPayPrice()));
}
String oldPrice = existOrder.getPayPrice()+"";
String oldPrice = existOrder.getPayPrice() + "";
Boolean execute = transactionTemplate.execute(e -> {
// 修改订单价格
@ -640,7 +666,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
});
if (!execute) {
throw new ServiceException(Constants.RESULT_ORDER_EDIT_PRICE_SUCCESS
.replace("${orderNo}", existOrder.getOrderId()).replace("${price}", request.getPayPrice()+""));
.replace("${orderNo}", existOrder.getOrderId()).replace("${price}", request.getPayPrice() + ""));
}
// TODO 发送改价短信提醒
@ -1099,6 +1125,147 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
return null;
}
@Override
@Transactional
public InitOrderResponse memberTopUp(OrderContentRequest request, HttpServletRequest servletRequest) {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
Assert.notNull(loginUser, "登录失效,请重新登录!");
// 订单相关检查
orderCheck(request);
// 初始化订单
MemberUserRespDTO user = userService.getUser(loginUser.getId());
String code = generateBillNo("MEMBER");
RechargeOrderDO orderDO = initializeOrder(request, code, user);
// 获取支付策略
IPayStrategy payStrategy = strategySupport.getPayStrategy(request.getPayType());
return payStrategy.pay(orderDO, servletRequest, request.getOpenid());
}
@Override
public Object aliNotify(HttpServletRequest request, Map<String, String> params) {
boolean verifyResult = false;
try {
verifyResult = AlipaySignature.rsaCheckV1(params, aliPayProperties.getAlipayPublicKey(), "UTF-8", "RSA2");
} catch (AlipayApiException e) {
e.printStackTrace();
}
if (verifyResult) {
String orderId = params.get("out_trade_no");
RechargeOrderDO orderDO = rechargeOrderMapper.selectOne(Wrappers.<RechargeOrderDO>lambdaQuery().eq(RechargeOrderDO::getOrderId, orderId));
// 处理相关逻辑
}
return null;
}
@Override
public Object memberRefund(RefundRequest request, HttpServletRequest servletRequest) {
RechargeOrderDO orderDO = rechargeOrderMapper.selectById(request.getOrderId());
// 获取支付策略
IPayStrategy payStrategy = strategySupport.getPayStrategy(orderDO.getPayType());
payStrategy.refund(orderDO);
return null;
}
@Override
public Object refundNotify(HttpServletRequest request, Map<String, String> params1) {
// 解析支付宝回调参数
Map<String, String> params = new HashMap<>();
Map<String, String[]> requestParams = request.getParameterMap();
for (Map.Entry<String, String[]> entry : requestParams.entrySet()) {
String name = entry.getKey();
String[] values = entry.getValue();
StringBuilder sb = new StringBuilder();
for (String value : values) {
sb.append(value);
}
params.put(name, sb.toString());
}
// 验证签名
boolean isSignatureValid = false;
try {
isSignatureValid = AlipaySignature.rsaCheckV1(params, aliPayProperties.getAlipayPublicKey(), "UTF-8", "RSA2");
} catch (AlipayApiException e) {
e.printStackTrace();
}
if (isSignatureValid) {
// 验证通过,处理退款结果
String tradeStatus = params.get("trade_status");
if ("TRADE_SUCCESS".equals(tradeStatus)) {
// 退款成功逻辑
} else {
// 退款失败逻辑
}
return "success"; // 返回给支付宝表示接收成功
} else {
// 签名验证失败
return "failure";
}
}
private RechargeOrderDO initializeOrder(OrderContentRequest request, String code, MemberUserRespDTO user) {
RechargeOrderDO orderDO = new RechargeOrderDO();
List<OrderContentRequest.OrderInfo> orderInfos = request.getOrderInfos();
orderDO.setOrderId(code);
orderDO.setUid(user.getId().intValue());
orderDO.setRealName(user.getNickname());
orderDO.setUserPhone(StringUtils.isEmpty(request.getUserPhone()) ? user.getMobile() : request.getUserPhone());
orderDO.setConfirmPhone(StringUtils.isEmpty(request.getConfirmPhone()) ? user.getMobile() : request.getConfirmPhone());
orderDO.setTotalNum(orderInfos.size());
BigDecimal sum = new BigDecimal(orderInfos.stream().mapToDouble(OrderContentRequest.OrderInfo::getGearAmount).sum());
orderDO.setTotalPrice(sum);
orderDO.setPayPrice(sum);
orderDO.setPayTime(LocalDateTime.now());
orderDO.setPayType(request.getPayType());
orderDO.setMark("会员充值");
orderDO.setCost(sum);
orderDO.setProTotalPrice(sum);
orderDO.setBeforePayPrice(sum);
rechargeOrderMapper.insert(orderDO);
List<RechargeOrderInfoDO> infoDOS = new ArrayList<>();
orderInfos.forEach(info -> {
RechargeOrderInfoDO infoDO = new RechargeOrderInfoDO();
infoDO.setRechargeOrderId(orderDO.getId());
infoDO.setGiveIntegral(info.getGearId());
infoDO.setOrderNo(code);
infoDO.setProductName(info.getName());
infoDO.setPrice(new BigDecimal(info.getGearAmount()));
infoDO.setPayNum(1);
infoDO.setGiveIntegral(info.getGearAmount());
infoDOS.add(infoDO);
});
rechargeOrderInfoMapper.insertBatch(infoDOS);
return orderDO;
}
/**
*
*
* @param prefix
* @return
*/
public static String generateBillNo(String prefix) {
String idStr = IdWorker.getIdStr();
idStr = prefix + "_" + idStr;
return idStr;
}
private void orderCheck(OrderContentRequest request) {
Assert.isTrue(!CollectionUtils.isEmpty(request.getOrderInfos()), "订单信息不能为空!");
if (StringUtils.isNotBlank(request.getUserPhone()) && StringUtils.isNotBlank(request.getConfirmPhone())) {
Assert.isTrue(StringUtils.equals(request.getUserPhone(), request.getConfirmPhone()), "输入号码不一致!");
MemberUserRespDTO userByMobile = userService.getUserByMobile(request.getUserPhone());
// 初始化一个账号
if (Objects.isNull(userByMobile)) {
userService.saveMemberUser(request.getUserPhone());
}
}
}
private StoreOrder getInfoException(String orderNo) {
LambdaQueryWrapper<StoreOrder> lqw = Wrappers.lambdaQuery();
lqw.eq(StoreOrder::getOrderId, orderNo);
@ -1111,8 +1278,9 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
/**
*
*
* @param dateLimit
* @param type
* @param type
* @return Integer
*/
private BigDecimal getAmount(String dateLimit, String type) {
@ -1136,8 +1304,9 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
/**
*
*
* @param dateLimit
* @param status String
* @param status String
* @return Integer
*/
private Long getCount(String dateLimit, String status) {
@ -1153,8 +1322,9 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
/**
*
*
* @param dateLimit
* @param status String
* @param status String
* @return Integer
*/
private Long getCount(String dateLimit, String status, Integer type) {
@ -1173,8 +1343,9 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
/**
*
* @param orderNo
* @param price
*
* @param orderNo
* @param price
* @param oldPrice
*/
private Boolean orderEditPrice(String orderNo, BigDecimal price, BigDecimal oldPrice) {
@ -1189,17 +1360,20 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
/**
*
*
* @return
*/
private List<StoreOrder> getOrderPayedByDateLimit(String startTime, String endTime) {
LambdaQueryWrapper<StoreOrder> lqw = Wrappers.lambdaQuery();
lqw.eq(StoreOrder::getIsDel, false).eq(StoreOrder::getPaid, true).eq(StoreOrder::getRefundStatus,0)
lqw.eq(StoreOrder::getIsDel, false).eq(StoreOrder::getPaid, true).eq(StoreOrder::getRefundStatus, 0)
.between(StoreOrder::getCreateTime, startTime, endTime);
return mapper.selectList(lqw);
}
/**
* @param request StoreOrderSendRequest
/**
*
*
* @param request StoreOrderSendRequest
* @param storeOrder StoreOrder
*/
private void express(StoreOrderSendRequest request, StoreOrder storeOrder) {
@ -1259,19 +1433,22 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
/**
*
*
* @param storeOrder
*/
private void sendGoodsNotify(StoreOrder storeOrder) {
MemberUserRespDTO user = userService.getUser(storeOrder.getUid());
//TODO 发送发货短信提醒
//TODO 发送发货短信提醒
// 发送消息通知
// pushMessageOrder(storeOrder, user, notification);
}
/**
* @param request StoreOrderSendRequest
/**
*
*
* @param request StoreOrderSendRequest
* @param storeOrder StoreOrder
* @author Mr.Zhang
* @since 2020-06-10
@ -1315,8 +1492,10 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
// pushMessageDeliveryOrder(storeOrder, user, request, productNameList);
}
/**
* @param request StoreOrderSendRequest
/**
*
*
* @param request StoreOrderSendRequest
* @param storeOrder StoreOrder
* @author Mr.Zhang
* @since 2020-06-10
@ -1337,11 +1516,12 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
/**
*
*
* @param orderList List<StoreOrder>
* @return List<StoreOrderItemResponse>
*/
private List<StoreOrderDetailResponse> formatOrder1(List<StoreOrder> orderList) {
List<StoreOrderDetailResponse> detailResponseList = new ArrayList<>();
List<StoreOrderDetailResponse> detailResponseList = new ArrayList<>();
if (CollUtil.isEmpty(orderList)) {
return detailResponseList;
}
@ -1378,8 +1558,9 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
/**
* requestwhere
*
* @param queryWrapper QueryWrapper<StoreOrder>
* @param request StoreOrderSearchRequest
* @param request StoreOrderSearchRequest
*/
private void getRequestTimeWhere(QueryWrapper<StoreOrder> queryWrapper, StoreOrderSearchRequest request) {
if (StringUtils.isNotBlank(request.getDateLimit())) {
@ -1390,6 +1571,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
/**
*
*
* @param storeOrder StoreOrder
* @author Mr.Zhang
* @since 2020-06-12
@ -1505,8 +1687,9 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
/**
* where
*
* @param queryWrapper QueryWrapper<StoreOrder>
* @param status String
* @param status String
*/
private void getStatusWhereNew(QueryWrapper<StoreOrder> queryWrapper, String status) {
if (StrUtil.isBlank(status)) {
@ -1554,7 +1737,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
break;
case Constants.ORDER_STATUS_REFUNDING: //退款中
queryWrapper.eq("paid", 1);
queryWrapper.in("refund_status", 1,3);
queryWrapper.in("refund_status", 1, 3);
queryWrapper.eq("is_del", 0);
break;
case Constants.ORDER_STATUS_REFUNDED: //已退款
@ -1575,6 +1758,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
/**
*
*
* @param payType String
*/
private String getPayType(String payType) {
@ -1592,6 +1776,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
/**
*
*
* @param storeOrder
* @return String
*/
@ -1610,8 +1795,9 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
/**
* where
*
* @param queryWrapper QueryWrapper<StoreOrder>
* @param status String
* @param status String
*/
private void getStatusWhere(QueryWrapper<StoreOrder> queryWrapper, String status) {
if (StrUtil.isBlank(status)) {
@ -1657,7 +1843,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
break;
case Constants.ORDER_STATUS_REFUNDING: //退款中
queryWrapper.eq("paid", 1);
queryWrapper.in("refund_status", 1,3);
queryWrapper.in("refund_status", 1, 3);
queryWrapper.eq("is_del", 0);
break;
case Constants.ORDER_STATUS_REFUNDED: //已退款
@ -1677,6 +1863,5 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
}
}

View File

@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.shop.service.product;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.module.shop.controller.app.product.vo.IndexProductResponse;
import cn.iocoder.yudao.module.shop.controller.app.product.vo.ProductDetailResponse;
import cn.iocoder.yudao.module.shop.controller.app.product.vo.IndexProductRespVO;
import cn.iocoder.yudao.module.shop.controller.app.product.vo.ProductDetailRespVO;
import cn.iocoder.yudao.module.shop.dal.dataobject.product.StoreProduct;
import cn.iocoder.yudao.module.shop.request.product.ProductListRequest;
import cn.iocoder.yudao.module.shop.request.product.ProductRequest;
@ -41,7 +41,7 @@ public interface ProductService {
* @param pageParamRequest
* @return CommonPage
*/
PageInfo<IndexProductResponse> getList(ProductRequest request, PageParam pageParamRequest);
PageInfo<IndexProductRespVO> getList(ProductRequest request, PageParam pageParamRequest);
/**
*
@ -49,14 +49,14 @@ public interface ProductService {
* @param type normal-void-
* @return
*/
ProductDetailResponse getDetail(Integer id, String type);
ProductDetailRespVO getDetail(Integer id, String type);
/**
* SKU
* @param id
* @return
*/
ProductDetailResponse getSkuDetail(Integer id);
ProductDetailRespVO getSkuDetail(Integer id);
/**
*
@ -79,7 +79,7 @@ public interface ProductService {
* @param pageRequest
* @return CommonPage<IndexProductResponse>
*/
PageInfo<IndexProductResponse> getHotProductList(PageParam pageRequest);
PageInfo<IndexProductRespVO> getHotProductList(PageParam pageRequest);
/**
*
@ -92,7 +92,7 @@ public interface ProductService {
*
* @return CommonPage<IndexProductResponse>
*/
PageInfo<IndexProductResponse> getGoodProductList();
PageInfo<IndexProductRespVO> getGoodProductList();
/**
* (使)
@ -100,7 +100,7 @@ public interface ProductService {
* @param pageParamRequest
* @return CommonPage
*/
PageInfo<IndexProductResponse> getCategoryProductList(ProductListRequest request, PageParam pageParamRequest);
PageInfo<IndexProductRespVO> getCategoryProductList(ProductListRequest request, PageParam pageParamRequest);
/**
*

View File

@ -9,8 +9,8 @@ import cn.iocoder.yudao.module.infra.api.config.ApiConfigApi;
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
import cn.iocoder.yudao.module.shop.constants.SysConfigConstants;
import cn.iocoder.yudao.module.shop.controller.app.product.vo.IndexProductResponse;
import cn.iocoder.yudao.module.shop.controller.app.product.vo.ProductDetailResponse;
import cn.iocoder.yudao.module.shop.controller.app.product.vo.IndexProductRespVO;
import cn.iocoder.yudao.module.shop.controller.app.product.vo.ProductDetailRespVO;
import cn.iocoder.yudao.module.shop.convert.product.StoreProductConvert;
import cn.iocoder.yudao.module.shop.dal.dataobject.product.StoreProduct;
import cn.iocoder.yudao.module.shop.dal.dataobject.product.StoreProductAttr;
@ -107,18 +107,18 @@ public class ProductServiceImpl implements ProductService {
* @return CommonPage<IndexProductResponse>
*/
@Override
public PageInfo<IndexProductResponse> getList(ProductRequest request, PageParam pageRequest) {
public PageInfo<IndexProductRespVO> getList(ProductRequest request, PageParam pageRequest) {
List<StoreProduct> storeProductList = storeProductService.findH5List(request, pageRequest);
if (CollUtil.isEmpty(storeProductList)) {
return new PageInfo<>(new ArrayList<>());
}
Page<IndexProductResponse> productPage = PageHelper.startPage(pageRequest.getPageNo(), pageRequest.getPageSize());
Page<IndexProductRespVO> productPage = PageHelper.startPage(pageRequest.getPageNo(), pageRequest.getPageSize());
PageInfo<StoreProduct> storeProductCommonPage = CommonPage.copyPageInfo(productPage,storeProductList);
List<IndexProductResponse> productResponseArrayList = new ArrayList<>();
List<IndexProductRespVO> productResponseArrayList = new ArrayList<>();
for (StoreProduct storeProduct : storeProductList) {
IndexProductResponse productResponse = new IndexProductResponse();
IndexProductRespVO productResponse = new IndexProductRespVO();
List<Integer> activityList = CrmebUtil.stringToArrayInt(storeProduct.getActivity());
// 活动类型默认:直接跳过
if (activityList.get(0).equals(Constants.PRODUCT_TYPE_NORMAL)) {
@ -161,7 +161,7 @@ public class ProductServiceImpl implements ProductService {
productResponseArrayList.add(productResponse);
}
PageInfo<IndexProductResponse> productResponseCommonPage = CommonPage.copyPageInfo(productPage,productResponseArrayList);
PageInfo<IndexProductRespVO> productResponseCommonPage = CommonPage.copyPageInfo(productPage,productResponseArrayList);
BeanUtils.copyProperties(storeProductCommonPage, productResponseCommonPage, "list");
return productResponseCommonPage;
@ -174,22 +174,22 @@ public class ProductServiceImpl implements ProductService {
* @return
*/
@Override
public ProductDetailResponse getDetail(Integer id, String type) {
public ProductDetailRespVO getDetail(Integer id, String type) {
// 获取用户
MemberUserRespDTO user = userService.getUser(SecurityFrameworkUtils.getLoginUserId());
ProductDetailResponse productDetailResponse = new ProductDetailResponse();
ProductDetailRespVO productDetailRespVO = new ProductDetailRespVO();
// 查询商品
StoreProduct storeProduct = storeProductService.getH5Detail(id);
// 设置会员价
storeProduct.setVipPrice(storeProduct.getPrice());
productDetailResponse.setProductInfo(storeProduct);
productDetailRespVO.setProductInfo(storeProduct);
// 获取商品规格
List<StoreProductAttr> attrList = attrService.getListByProductIdAndType(storeProduct.getId(), Constants.PRODUCT_TYPE_NORMAL);
// 根据制式设置attr属性
productDetailResponse.setProductAttr(attrList);
productDetailRespVO.setProductAttr(attrList);
// 根据制式设置sku属性
HashMap<String, Object> skuMap = new HashMap<>();
@ -202,11 +202,11 @@ public class ProductServiceImpl implements ProductService {
skuMap.put(atr.getSuk(), atr);
}
productDetailResponse.setProductValue(skuMap);
productDetailRespVO.setProductValue(skuMap);
// 商品活动
List<ProductActivityItemResponse> activityAllH5 = productUtils.getProductAllActivity(storeProduct);
productDetailResponse.setActivityAllH5(activityAllH5);
productDetailRespVO.setActivityAllH5(activityAllH5);
// 商品浏览量+1
StoreProduct updateProduct = new StoreProduct();
@ -216,7 +216,7 @@ public class ProductServiceImpl implements ProductService {
// TODO 保存用户访问记录
return productDetailResponse;
return productDetailRespVO;
}
/**
@ -225,18 +225,18 @@ public class ProductServiceImpl implements ProductService {
* @return
*/
@Override
public ProductDetailResponse getSkuDetail(Integer id) {
public ProductDetailRespVO getSkuDetail(Integer id) {
// 获取用户
MemberUserRespDTO user = userService.getUser(SecurityFrameworkUtils.getLoginUserId());
ProductDetailResponse productDetailResponse = new ProductDetailResponse();
ProductDetailRespVO productDetailRespVO = new ProductDetailRespVO();
// 查询商品
StoreProduct storeProduct = storeProductService.getH5Detail(id);
// 获取商品规格
List<StoreProductAttr> attrList = attrService.getListByProductIdAndType(storeProduct.getId(), Constants.PRODUCT_TYPE_NORMAL);
// 根据制式设置attr属性
productDetailResponse.setProductAttr(attrList);
productDetailRespVO.setProductAttr(attrList);
// 根据制式设置sku属性
HashMap<String, Object> skuMap = new HashMap<>();
@ -248,9 +248,9 @@ public class ProductServiceImpl implements ProductService {
skuMap.put(atr.getSuk(), atr);
}
productDetailResponse.setProductValue(skuMap);
productDetailRespVO.setProductValue(skuMap);
return productDetailResponse;
return productDetailRespVO;
}
/**
@ -326,18 +326,18 @@ public class ProductServiceImpl implements ProductService {
* @return CommonPage<IndexProductResponse>
*/
@Override
public PageInfo<IndexProductResponse> getHotProductList(PageParam pageRequest) {
public PageInfo<IndexProductRespVO> getHotProductList(PageParam pageRequest) {
List<StoreProduct> storeProductList = storeProductService.getIndexProduct(Constants.INDEX_HOT_BANNER, pageRequest);
if (CollUtil.isEmpty(storeProductList)) {
return new PageInfo<>(new ArrayList<>());
}
Page<IndexProductResponse> productPage = PageHelper.startPage(pageRequest.getPageNo(), pageRequest.getPageSize());
Page<IndexProductRespVO> productPage = PageHelper.startPage(pageRequest.getPageNo(), pageRequest.getPageSize());
PageInfo<StoreProduct> storeProductCommonPage = CommonPage.copyPageInfo(productPage,storeProductList);
List<IndexProductResponse> productResponseArrayList = new ArrayList<>();
List<IndexProductRespVO> productResponseArrayList = new ArrayList<>();
for (StoreProduct storeProduct : storeProductList) {
IndexProductResponse productResponse = new IndexProductResponse();
IndexProductRespVO productResponse = new IndexProductRespVO();
List<Integer> activityList = CrmebUtil.stringToArrayInt(storeProduct.getActivity());
// 活动类型默认:直接跳过
if (activityList.get(0).equals(Constants.PRODUCT_TYPE_NORMAL)) {
@ -380,7 +380,7 @@ public class ProductServiceImpl implements ProductService {
productResponseArrayList.add(productResponse);
}
PageInfo<IndexProductResponse> productResponseCommonPage = CommonPage.copyPageInfo(productPage,productResponseArrayList);
PageInfo<IndexProductRespVO> productResponseCommonPage = CommonPage.copyPageInfo(productPage,productResponseArrayList);
BeanUtils.copyProperties(storeProductCommonPage, productResponseCommonPage, "list");
return new PageInfo<>(StoreProductConvert.INSTANCE.convert1(storeProductList));
@ -404,7 +404,7 @@ public class ProductServiceImpl implements ProductService {
* @return CommonPage<IndexProductResponse>
*/
@Override
public PageInfo<IndexProductResponse> getGoodProductList() {
public PageInfo<IndexProductRespVO> getGoodProductList() {
PageParam pageRequest = new PageParam();
pageRequest.setPageSize(9);
List<StoreProduct> storeProductList = storeProductService.getIndexProduct(Constants.INDEX_RECOMMEND_BANNER, pageRequest);
@ -412,12 +412,12 @@ public class ProductServiceImpl implements ProductService {
return new PageInfo<>(new ArrayList<>());
}
Page<IndexProductResponse> productPage = PageHelper.startPage(pageRequest.getPageNo(), pageRequest.getPageSize());
Page<IndexProductRespVO> productPage = PageHelper.startPage(pageRequest.getPageNo(), pageRequest.getPageSize());
PageInfo<StoreProduct> storeProductCommonPage = CommonPage.copyPageInfo(productPage,storeProductList);
List<IndexProductResponse> productResponseArrayList = new ArrayList<>();
List<IndexProductRespVO> productResponseArrayList = new ArrayList<>();
for (StoreProduct storeProduct : storeProductList) {
IndexProductResponse productResponse = new IndexProductResponse();
IndexProductRespVO productResponse = new IndexProductRespVO();
List<Integer> activityList = CrmebUtil.stringToArrayInt(storeProduct.getActivity());
// 活动类型默认:直接跳过
if (activityList.get(0).equals(Constants.PRODUCT_TYPE_NORMAL)) {
@ -460,7 +460,7 @@ public class ProductServiceImpl implements ProductService {
productResponseArrayList.add(productResponse);
}
PageInfo<IndexProductResponse> productResponseCommonPage = CommonPage.copyPageInfo(productPage,productResponseArrayList);
PageInfo<IndexProductRespVO> productResponseCommonPage = CommonPage.copyPageInfo(productPage,productResponseArrayList);
BeanUtils.copyProperties(storeProductCommonPage, productResponseCommonPage, "list");
return new PageInfo<>(StoreProductConvert.INSTANCE.convert1(storeProductList));
@ -473,7 +473,7 @@ public class ProductServiceImpl implements ProductService {
* @return CommonPage
*/
@Override
public PageInfo<IndexProductResponse> getCategoryProductList(ProductListRequest request, PageParam pageParamRequest) {
public PageInfo<IndexProductRespVO> getCategoryProductList(ProductListRequest request, PageParam pageParamRequest) {
ProductRequest searchRequest = new ProductRequest();
BeanUtils.copyProperties(searchRequest, request);
List<StoreProduct> storeProductList = storeProductService.findH5List(searchRequest, pageParamRequest);
@ -481,13 +481,13 @@ public class ProductServiceImpl implements ProductService {
return new PageInfo<>(new ArrayList<>());
}
Page<IndexProductResponse> productPage = PageHelper.startPage(pageParamRequest.getPageNo(), pageParamRequest.getPageSize());
Page<IndexProductRespVO> productPage = PageHelper.startPage(pageParamRequest.getPageNo(), pageParamRequest.getPageSize());
PageInfo<StoreProduct> storeProductCommonPage = CommonPage.copyPageInfo(productPage,storeProductList);
MemberUserRespDTO user = userService.getUser(SecurityFrameworkUtils.getLoginUserId());
List<IndexProductResponse> productResponseArrayList = new ArrayList<>();
List<IndexProductRespVO> productResponseArrayList = new ArrayList<>();
for (StoreProduct storeProduct : storeProductList) {
IndexProductResponse productResponse = new IndexProductResponse();
IndexProductRespVO productResponse = new IndexProductRespVO();
// 获取商品购物车数量
if (ObjectUtil.isNotNull(user)) {
productResponse.setCartNum(cartService.getProductNumByUidAndProductId(user.getId(), storeProduct.getId()));
@ -496,7 +496,7 @@ public class ProductServiceImpl implements ProductService {
productResponseArrayList.add(productResponse);
}
PageInfo<IndexProductResponse> productResponseCommonPage = CommonPage.copyPageInfo(productPage,productResponseArrayList);
PageInfo<IndexProductRespVO> productResponseCommonPage = CommonPage.copyPageInfo(productPage,productResponseArrayList);
BeanUtils.copyProperties(storeProductCommonPage, productResponseCommonPage, "list");
return new PageInfo<>(StoreProductConvert.INSTANCE.convert1(storeProductList));

View File

@ -0,0 +1,50 @@
package cn.iocoder.yudao.module.shop.support;
import cn.iocoder.yudao.module.shop.support.pay.AliPayStrategy;
import cn.iocoder.yudao.module.shop.support.pay.IPayStrategy;
import cn.iocoder.yudao.module.shop.support.pay.PayConfigConstant;
import cn.iocoder.yudao.module.shop.support.pay.WxPayStrategy;
import org.springframework.stereotype.Component;
import java.util.HashMap;
/**
* @Title:WxPayStrategy
* @Description:
* @author: tangqian
* @date: 2023/5/15 21:53
* @version: V1.0.0
*/
@Component
public class StrategySupport {
//支付策略
private HashMap<String, IPayStrategy> payMap = new HashMap<>();
public StrategySupport(WxPayStrategy wxPayStrategy,
AliPayStrategy aliPayStrategy
) {
//支付策略
payMap.put(PayConfigConstant.PAY_TYPE_ALIPAY,aliPayStrategy);
payMap.put(PayConfigConstant.PAY_TYPE_WXPAY,wxPayStrategy);
}
/**
*
* @param payType
* @return
*/
public IPayStrategy getPayStrategy(String payType){
if (PayConfigConstant.PAY_TYPE_LIST.contains(payType)){
return payMap.get(payType);
}
return null;
}
}

View File

@ -0,0 +1,87 @@
package cn.iocoder.yudao.module.shop.support.pay;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.pay.config.AliPayConfig;
import cn.iocoder.yudao.framework.pay.properties.AliPayProperties;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
import cn.iocoder.yudao.module.shop.response.member.InitOrderResponse;
import com.alibaba.fastjson.JSONObject;
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.request.AlipayTradeRefundRequest;
import com.alipay.api.request.AlipayTradeWapPayRequest;
import com.alipay.api.response.AlipayTradeRefundResponse;
import com.alipay.api.response.AlipayTradeWapPayResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import javax.servlet.http.HttpServletRequest;
/**
* @Title:AliPayStrategy
* @Description:
* @author: tangqian
* @date: 2023/5/15 21:52
* @version: V1.0.0
*/
@Component
@Slf4j
public class AliPayStrategy implements IPayStrategy {
@Autowired
private AliPayProperties aliPayProperties;
@Autowired
private AliPayConfig aliPayConfig;
@Override
public InitOrderResponse pay(RechargeOrderDO orderDO, HttpServletRequest servletRequest, String openId) {
AlipayClient alipayClient = aliPayConfig.alipayClient();
Assert.notNull(alipayClient, "获取支付宝支付配置失败!");
AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest();
//异步接收地址仅支持http/https公网可访问
request.setNotifyUrl(aliPayProperties.getNotifyUrl());
//同步跳转地址仅支持http/https
request.setReturnUrl("");
/******必传参数******/
JSONObject bizContent = new JSONObject();
//商户订单号,商家自定义,保持唯一性
bizContent.put("out_trade_no", orderDO.getOrderId());
//支付金额最小值0.01元
bizContent.put("total_amount", orderDO.getPayPrice());
//订单标题,不可使用特殊符号
bizContent.put("subject", "会员充值");
bizContent.put("product_code", "FAST_INSTANT_TRADE_PAY");
request.setBizContent(bizContent.toString());
AlipayTradeWapPayResponse response = null;
try {
response = alipayClient.pageExecute(request);
} catch (AlipayApiException e) {
e.printStackTrace();
}
if (response.isSuccess()) {
return new InitOrderResponse();
}
return null;
}
@Override
public void refund(RechargeOrderDO orderDO) {
AlipayClient alipayClient = aliPayConfig.alipayClient();;
AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();
JSONObject bizContent = new JSONObject();
bizContent.put("trade_no", orderDO.getPaySerialNumber());
bizContent.put("refund_amount", orderDO.getPayPrice());
bizContent.put("out_request_no", orderDO.getOrderId());
request.setBizContent(bizContent.toString());
AlipayTradeRefundResponse response = null;
try {
response = alipayClient.execute(request);
} catch (AlipayApiException e) {
e.printStackTrace();
}
log.info("退款回调[{}]", JSONUtil.toJsonPrettyStr(response));
}
}

View File

@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.shop.support.pay;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
import cn.iocoder.yudao.module.shop.response.member.InitOrderResponse;
import javax.servlet.http.HttpServletRequest;
/**
* @Title:IPayStrategy
* @Description:
* @author: tangqian
* @date: 2023/5/15 21:51
* @version: V1.0.0
*/
public interface IPayStrategy {
InitOrderResponse pay(RechargeOrderDO orderDO, HttpServletRequest servletRequest,String openId);
void refund(RechargeOrderDO orderDO);
}

View File

@ -0,0 +1,33 @@
package cn.iocoder.yudao.module.shop.support.pay;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Title:PayConfigConstant
* @Description: TODO
* @author: tangqian
* @date: 2023/5/15 21:54
* @version: V1.0.0
*/
public interface PayConfigConstant {
List<String> PAY_TYPE_LIST = Arrays.asList("ALIPAY", "WXPAY");
String PAY_TYPE_ALIPAY = "ALIPAY";
String PAY_TYPE_WXPAY = "WXPAY";
Map<String, String> PAY_NAMES_MAP = new HashMap() {
{
this.put("ALIPAY", "支付宝");
this.put("WXPAY", "微信");
}
};
String PAY_TYPE_ALIPAY_FIRST = "ALIPAY";
String PAY_TYPE_WXPAY_FIRST = "WXPAY";
Map<String, String> PAY_NAMES_MAP_FIRST = new HashMap() {
{
this.put("ALIPAY", "支付宝");
this.put("WXPAY", "微信");
}
};
}

View File

@ -0,0 +1,83 @@
package cn.iocoder.yudao.module.shop.support.pay;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
import cn.iocoder.yudao.framework.pay.config.WxPayOneAutoConfiguration;
import cn.iocoder.yudao.framework.pay.properties.WxPayProperties;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
import cn.iocoder.yudao.module.shop.response.member.InitOrderResponse;
import com.github.binarywang.wxpay.bean.request.WxPayRefundV3Request;
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request;
import com.github.binarywang.wxpay.bean.result.WxPayRefundV3Result;
import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderV3Result;
import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum;
import com.github.binarywang.wxpay.service.WxPayService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
/**
* @Title:WxPayStrategy
* @Description: TODO
* @author: tangqian
* @date: 2023/5/15 21:53
* @version: V1.0.0
*/
@Component
@Slf4j
public class WxPayStrategy implements IPayStrategy{
@Autowired
private WxPayOneAutoConfiguration wxPayOneAutoConfiguration;
@Autowired
private WxPayProperties payProperties;
@Override
public InitOrderResponse pay(RechargeOrderDO orderDO, HttpServletRequest servletRequest,String openid) {
InitOrderResponse response = new InitOrderResponse();
WxPayService wxPayService = wxPayOneAutoConfiguration.wxPayOneService();
Assert.notNull(wxPayService, "获取微信支付配置失败!");
WxPayUnifiedOrderV3Request wxPayRequest = new WxPayUnifiedOrderV3Request();
int sum = orderDO.getPayPrice().multiply(new BigDecimal("100")).intValue();
wxPayRequest.setAmount(new WxPayUnifiedOrderV3Request.Amount().setTotal(sum));
wxPayRequest.setDescription("会员充值");
wxPayRequest.setOutTradeNo(orderDO.getOrderId());
wxPayRequest.setNotifyUrl(payProperties.getNotifyUrl());
wxPayRequest.setPayer(new WxPayUnifiedOrderV3Request.Payer().setOpenid(openid));
wxPayRequest.setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp(ServletUtils.getClientIP(servletRequest)));
wxPayRequest.setAppid(payProperties.getAppId());
wxPayRequest.setMchid(payProperties.getMchId());
try {
WxPayUnifiedOrderV3Result wxPayUnifiedOrderV3Result = wxPayService.unifiedOrderV3(TradeTypeEnum.JSAPI, wxPayRequest);
BeanUtils.copyProperties(wxPayUnifiedOrderV3Result, response);
} catch (Exception e) {
log.error(e.getMessage());
}
return response;
}
@Override
public void refund(RechargeOrderDO orderDO) {
WxPayRefundV3Request wxPayRefundV3Request = new WxPayRefundV3Request();
wxPayRefundV3Request.setOutTradeNo(orderDO.getOrderId());
wxPayRefundV3Request.setOutRefundNo(orderDO.getPaySerialNumber());
wxPayRefundV3Request.setTransactionId(orderDO.getOrderId());
wxPayRefundV3Request.setReason("商品已售完");
wxPayRefundV3Request.setNotifyUrl(payProperties.getRefundNotifyUrl());
int sum = orderDO.getPayPrice().multiply(new BigDecimal("100")).intValue();
wxPayRefundV3Request.setAmount(new WxPayRefundV3Request.Amount().setTotal(sum).setRefund(sum).setCurrency("CNY"));
try {
WxPayService wxPayService = wxPayOneAutoConfiguration.wxPayOneService();
WxPayRefundV3Result wxPayRefundV3Result = wxPayService.refundV3(wxPayRefundV3Request);
log.info("退款回调[{}]", JSONUtil.toJsonPrettyStr(wxPayRefundV3Request));
}catch (Exception e){
log.error(e.getMessage(),e);
}
}
}

View File

@ -3,6 +3,6 @@
<mapper namespace="cn.iocoder.yudao.module.shop.dal.mysql.express.ShippingTemplatesFreeMapper">
<select id="getListGroup" resultType="cn.iocoder.yudao.module.shop.controller.admin.express.vo.ShippingTemplatesFreeRespVO" parameterType="integer">
SELECT group_concat(`city_id`) AS city_id, title, `number`, price, uniqid FROM eb_shipping_templates_free where temp_id = #{tempId, jdbcType=INTEGER} GROUP BY `uniqid` ORDER BY id ASC
SELECT group_concat(`city_id`) AS city_id, province_id, `number`, price FROM eb_shipping_templates_free where temp_id = #{tempId, jdbcType=INTEGER} GROUP BY `id` ORDER BY id ASC
</select>
</mapper>

View File

@ -3,6 +3,6 @@
<mapper namespace="cn.iocoder.yudao.module.shop.dal.mysql.express.ShippingTemplatesNoDeliveryMapper">
<select id="getList" resultType="cn.iocoder.yudao.module.shop.controller.admin.express.vo.ShippingTemplatesNoDeliveryRespVO" parameterType="integer">
SELECT group_concat(`city_id`) AS city_id, temp_id FROM eb_shipping_templates_no_delivery where temp_id = #{tempId, jdbcType=INTEGER} ORDER BY id ASC
SELECT group_concat(`city_id`) AS city_id, province_id FROM eb_shipping_templates_no_delivery WHERE temp_id = #{tempId, jdbcType=INTEGER} GROUP BY `id` ORDER BY id ASC
</select>
</mapper>

View File

@ -3,6 +3,6 @@
<mapper namespace="cn.iocoder.yudao.module.shop.dal.mysql.express.ShippingTemplatesRegionMapper">
<select id="getListGroup" resultType="cn.iocoder.yudao.module.shop.controller.admin.express.vo.ShippingTemplatesRegionRespVO" parameterType="integer">
SELECT group_concat(`city_id`) AS city_id, title, `first`, first_price, `renewal`, renewal_price, uniqid FROM eb_shipping_templates_region where temp_id = #{tempId, jdbcType=INTEGER} GROUP BY `uniqid` ORDER BY id ASC
SELECT group_concat(`city_id`) AS city_id, `first`, first_price, `renewal`, renewal_price FROM eb_shipping_templates_region where temp_id = #{tempId, jdbcType=INTEGER} GROUP BY `id` ORDER BY id ASC
</select>
</mapper>

View File

@ -1,5 +1,6 @@
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 java.util.Collection;
@ -76,4 +77,7 @@ public interface MemberUserApi {
Long getUserId();
MemberUserRespDTO getInfo();
void saveMemberUser(String phone);
}

View File

@ -92,6 +92,11 @@ public class MemberUserApiImpl implements MemberUserApi {
return UserConvert.INSTANCE.convert2(userService.getUser(getUserId()));
}
@Override
public void saveMemberUser(String phone) {
userService.saveMemberUser(phone);
}
/**
*
*

View File

@ -116,6 +116,7 @@ public interface MemberUserService {
*/
int updateById(MemberUserDO member);
void saveMemberUser(String phone);
}

View File

@ -170,6 +170,17 @@ public class MemberUserServiceImpl implements MemberUserService {
return memberUserMapper.updateById(member);
}
@Override
public void saveMemberUser(String phone) {
MemberUserDO memberUserDO = new MemberUserDO();
memberUserDO.setMobile(phone);
memberUserDO.setNickname("初始化人员");
memberUserDO.setAvatar("");
memberUserDO.setStatus(CommonStatusEnum.ENABLE.getStatus());
memberUserDO.setPassword(passwordEncoder.encode(phone.substring(phone.length() - 6)));
memberUserMapper.insert(memberUserDO);
}
/**
*
*

View File

@ -202,7 +202,14 @@ wx:
notify-url: http://yuxy.perrymake.com/app-api/pay/wxpay/pay_notify
refund-notify-url: http://yuxy.perrymake.com/app-api/pay/wxpay/refund_notify
--- #################### 芋道相关配置 ####################
ali:
pay:
one:
appId: 2021003194654312
merchantPrivateKey: MIIEwAIBADANBgkqhkiG9w0BAQEFAASCBKowggSmAgEAAoIBAQC+m33MrrmGiSBCBTQMkBH9AN7ZKi/ECmgpjIbVIzAbUThqfiKvuWe8haVq0/F5nETZVYKb3kqqcdt5NkUbGkCrCNCOPvQ2FI8VWOalXGSQNA6ItA644m1dv84Khs5K3Tpu6RgcrL5uqmfNzid7YpLlGeSxMq8uqu/adZnEbm+coJAvEH423pnMjsdkI93FUibaDkDQ06V7Z0Su6l4ZoVzLavvPeP/u8NCvelyf5h+BY159rU8XjCaSYYF/2u4DzDV1LqQcSC+fQg/aVd+QcpnhEF715fbNmN3TLuh1ysnfUSFdVMsdWDrOsgriJ7g0D32uWwhR4Brz3dAFs0KdWTmFAgMBAAECggEBAKdX2JCVbijhx0JvUw0ch856ryw2T41sHZss10vVAu1Y15EXgNiKjLsFEv/BaCX+vquY2XyDI0aVg7zdmrp6x//hU0kvmDTKw/xX+td/UIMSURhQDQThNmeyd/Dh/cfYhu7NEvBJ8T8zuMMFlcBMAO/HVfMErqzoQoCn8wJ0euUkxU+0yWjddC5QHdhPwPgfpmPvL/DCPfSCudFy80ix7CP3YID7RwgCy5niZg3e7aDK6DgYTmk2DmoC7B8ES/7Crvf04fH4XzGrSCzL9aGKOWql6dZisbDioRdm67DEWUSjQGTggEZ+eCd9Tr0gnndVWegG5HYJhSpB/JoLsc5J/dkCgYEA8Tumn60cfJU440LWaJ+40gJWcNrOlvpPEX69DRXKG3PlTAk62sSvVBos2nstqNjhHPQDG7rFerQhmSPeGyezVcwPCbWLvLC61vpbfau+RyWvMvm33A1hgP+zXlt9C3etb9w6LUfuqh0Lzi61K3ZNKQGo4ERxgGoMlNZWO0X/mBMCgYEAykZ9PH1b3be9M55BsnCnnrzENV5Bbfj7BToRleiUWA0f0Juurxy9ZACr8rU1oa7+UF32TpXAOL1Peri5vhYF7hdSnlSk5f9lyEzQijbtRytBC9Mexagb4BZWMlars9jMhhsdWiXA2O6Pz9ykLacGOr0DHM8/6HaVJRlPydXHywcCgYEAzwIgT1/vVR18jtD5SxjdMiJdaUTrCXZNSbcXplXvdLV0rFYzUi58QlCf8vDHUuCh9QWUcURKWKyhNFgqLeVYqKSOtwc6nbaO7xIyVtp9U3KMMNNIKqa06E0E8FDUMnYFuDslFVxn+0Unr0w3nc9MEYdiEunI+KiImWSA5SaBWk8CgYEAlbwshRS/ZpfXZVinhXJDgwx1qpQFl2USXUIpNnGfLrc4b/JvE44Q3PBqWRavhurFs7R62p2cV+Q767rHNOGUrjVxoWdDUkcHj4jdbxNN/rsUQa6dPvA9AltGn6jtHgtFC5kS12LPKUcgCl1o46qav+yfWzpIMstliLr+B4lLhw0CgYEA7Bpm0s2uoyC1XtYCqeWzbjODciq/hgIpmBjnP4Xs0ELB0VE95m9CVQk47dSngRqbkrEO2G2zdMTYj5Mr5bm5AXQfUpwMv89fxCxSXq1Andqe1/UphigltW/PXOfvpD1JcHNfalEcTOTdzENVYH4lN3HAoPobj04gCsFZFcqWfps=
alipayPublicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAw21teFhHze8ltibg/mBE0Lo1gTvcRUszQpsiTLWLoYvLxfaEVD+5bkpTYrVFczLNqOw93MJxwF0Pj62T3BZU6IXPdXtkKhcflKiZxleSIaTxPFml8mQ8dfdcT25BPidRaeztxv/FCL+0MUTMVh29Ffm9/DHqkjozs4o/Vcf/BoDssw9L7JQffwo/h69B0O688E+s+SivqvXGbiRdARzPrvuQjUMPwUf9vQZ4/ZgGNlwsEhnF90ESCuBZDm8atOoZlqYSNw6g+TZQH5CVS0WCR41TQoW+R8OsX1cv3ERvJXvh/50dEhl8b4CN3nvdaSYcw93o/nkkTZkdZ7BdcNuW2wIDAQAB
gatewayUrl: https://openapi.alipay.com/gateway.do
notify-url: http://yuxy.perrymake.com/app-api/pay/ali/pay_notify
# 芋道配置项,设置当前项目所有自定义的配置
yudao:
captcha:

View File

@ -0,0 +1,224 @@
server:
port: 48080
servlet:
context-path: /cyyywl-api
--- #################### 数据库相关配置 ####################
spring:
# 数据源配置项
autoconfigure:
exclude:
- com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源
- org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration # 排除积木报表带来的 MongoDB 的自动配置
datasource:
druid: # Druid 【监控】相关的全局配置
web-stat-filter:
enabled: true
stat-view-servlet:
enabled: true
allow: # 设置白名单,不填则允许所有访问
url-pattern: /druid/*
login-username: # 控制台管理用户名和密码
login-password:
filter:
stat:
enabled: true
log-slow-sql: true # 慢 SQL 记录
slow-sql-millis: 100
merge-sql: true
wall:
config:
multi-statement-allow: true
dynamic: # 多数据源配置
druid: # Druid 【连接池】相关的全局配置
initial-size: 5 # 初始连接数
min-idle: 10 # 最小连接池数量
max-active: 20 # 最大连接池数量
max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒
time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒
min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位:毫秒
max-evictable-idle-time-millis: 900000 # 配置一个连接在池中最大生存的时间,单位:毫秒
validation-query: SELECT 1 # 配置检测连接是否有效
test-while-idle: true
test-on-borrow: false
test-on-return: false
primary: master
datasource:
master:
name: cyywl
url: jdbc:mysql://117.33.142.185:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true
driver-class-name: com.mysql.jdbc.Driver
username: root
password: axzsd110
# slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改
# name: ruoyi-vue-pro
# url: jdbc:mysql://400-infra.server.iocoder.cn:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&serverTimezone=CTT&allowPublicKeyRetrieval=true
# driver-class-name: com.mysql.jdbc.Driver
# username: root
# password: 3WLiVUBEwTbvAfsh
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
redis:
host: 117.33.142.185 # 地址
port: 6369 # 端口
database: 6 # 数据库索引
password: 20221122@dev # 密码,建议生产环境开启
--- #################### 定时任务相关配置 ####################
# Quartz 配置项,对应 QuartzProperties 配置类
spring:
quartz:
auto-startup: true # 测试环境,需要开启 Job
scheduler-name: schedulerName # Scheduler 名字。默认为 schedulerName
job-store-type: jdbc # Job 存储器类型。默认为 memory 表示内存,可选 jdbc 使用数据库。
wait-for-jobs-to-complete-on-shutdown: true # 应用关闭时,是否等待定时任务执行完成。默认为 false ,建议设置为 true
properties: # 添加 Quartz Scheduler 附加属性,更多可以看 http://www.quartz-scheduler.org/documentation/2.4.0-SNAPSHOT/configuration.html 文档
org:
quartz:
# Scheduler 相关配置
scheduler:
instanceName: schedulerName
instanceId: AUTO # 自动生成 instance ID
# JobStore 相关配置
jobStore:
# JobStore 实现类。可见博客https://blog.csdn.net/weixin_42458219/article/details/122247162
class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
isClustered: true # 是集群模式
clusterCheckinInterval: 15000 # 集群检查频率,单位:毫秒。默认为 15000即 15 秒
misfireThreshold: 60000 # misfire 阀值,单位:毫秒。
# 线程池相关配置
threadPool:
threadCount: 25 # 线程池大小。默认为 10 。
threadPriority: 5 # 线程优先级
class: org.quartz.simpl.SimpleThreadPool # 线程池类型
jdbc: # 使用 JDBC 的 JobStore 的时候JDBC 的配置
initialize-schema: NEVER # 是否自动使用 SQL 初始化 Quartz 表结构。这里设置成 never ,我们手动创建表结构。
--- #################### 服务保障相关配置 ####################
# Lock4j 配置项
lock4j:
acquire-timeout: 3000 # 获取分布式锁超时时间,默认为 3000 毫秒
expire: 30000 # 分布式锁的超时时间,默认为 30 毫秒
# Resilience4j 配置项
resilience4j:
ratelimiter:
instances:
backendA:
limit-for-period: 1 # 每个周期内,允许的请求数。默认为 50
limit-refresh-period: 60s # 每个周期的时长,单位:微秒。默认为 500
timeout-duration: 1s # 被限流时,阻塞等待的时长,单位:微秒。默认为 5s
register-health-indicator: true # 是否注册到健康监测
--- #################### 监控相关配置 ####################
# Actuator 监控端点的配置项
management:
endpoints:
web:
base-path: /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator
exposure:
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
# Spring Boot Admin 配置项
spring:
boot:
admin:
# Spring Boot Admin Client 客户端的相关配置
client:
url: http://127.0.0.1:${server.port}/${spring.boot.admin.context-path} # 设置 Spring Boot Admin Server 地址
instance:
service-host-type: IP # 注册实例时,优先使用 IP [IP, HOST_NAME, CANONICAL_HOST_NAME]
# Spring Boot Admin Server 服务端的相关配置
context-path: /admin # 配置 Spring
# 日志文件配置
logging:
file:
name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径
--- #################### 微信公众号相关配置 ####################
wx: # 参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-mp-spring-boot-starter/README.md 文档
mp:
# 公众号配置(必填)
app-id: wx041349c6f39b268b
secret: 5abee519483bc9f8cb37ce280e814bd0
# 存储配置,解决 AccessToken 的跨节点的共享
config-storage:
type: RedisTemplate # 采用 RedisTemplate 操作 Redis会自动从 Spring 中获取
key-prefix: wx # Redis Key 的前缀 TODO 芋艿:解决下 Redis key 管理的配置
http-client-type: HttpClient # 采用 HttpClient 请求微信公众号平台
miniapp: # 小程序配置(必填),参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-miniapp-spring-boot-starter/README.md 文档
appid: wx63c280fe3248a3e7
secret: 6f270509224a7ae1296bbf1c8cb97aed
config-storage:
type: RedisTemplate # 采用 RedisTemplate 操作 Redis会自动从 Spring 中获取
key-prefix: wa # Redis Key 的前缀 TODO 芋艿:解决下 Redis key 管理的配置
http-client-type: HttpClient # 采用 HttpClient 请求微信公众号平台
pay:
one:
enabled: true
app-id: wxb1826c88da21d81e
mch-id: 1641993417
mch-key: qdn2I7Cmx4JeiKOt2CDjiu6UHgLTsOsM
apiv3-key: cyywl666666cyywl888888cyywl66666
private-cert-path: classpath:/1/apiclient_cert.pem
private-key-path: classpath:/1/apiclient_key.pem
key-path: classpath:/1/apiclient_cert.p12
cert-serial-no: 58FDB503F92B6C0E258C9940BB726C2BF6022E56
notify-url: http://yuxy.perrymake.com/app-api/pay/wxpay/pay_notify
refund-notify-url: http://yuxy.perrymake.com/app-api/pay/wxpay/refund_notify
two:
enabled: true
app-id: wxb1826c88da21d81e
mch-id: 1642042589
mch-key: qdn2I7Cmx4JeiKOt2CDjiu6UHgLTsOsM
apiv3-key: cyywl666666cyywl888888cyywl66666
private-cert-path: classpath:/2/apiclient_cert.pem
private-key-path: classpath:/2/apiclient_key.pem
key-path: classpath:/2/apiclient_cert.p12
cert-serial-no: 47F04D51F958FFEF56A6DFC25BDE83CF89353E19
notify-url: http://yuxy.perrymake.com/app-api/pay/wxpay/pay_notify
refund-notify-url: http://yuxy.perrymake.com/app-api/pay/wxpay/refund_notify
--- #################### 芋道相关配置 ####################
# 芋道配置项,设置当前项目所有自定义的配置
yudao:
xss:
enable: false
exclude-urls: # 如下两个 url仅仅是为了演示去掉配置也没关系
- ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求
- ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求
pay:
callback-url: http://yunai.natapp1.cc/admin-api/pay/notify/callback
return-url: http://yunai.natapp1.cc/admin-api/pay/notify/return
demo: false # 开启演示模式
justauth:
enabled: true
type:
DINGTALK: # 钉钉
client-id: dingvrnreaje3yqvzhxg
client-secret: i8E6iZyDvZj51JIb0tYsYfVQYOks9Cq1lgryEjFRqC79P3iJcrxEwT6Qk2QvLrLI
ignore-check-redirect-uri: true
WECHAT_ENTERPRISE: # 企业微信
client-id: wwd411c69a39ad2e54
client-secret: 1wTb7hYxnpT2TUbIeHGXGo7T0odav1ic10mLdyyATOw
agent-id: 1000004
ignore-check-redirect-uri: true
cache:
type: REDIS
prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE::
timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟
wx:
mp:
useRedis: false
defaultContent: \u60A8\u597D\uFF0C\u6709\u4EC0\u4E48\u95EE\u9898\uFF1F
redisConfig:
host: 117.33.142.185 # 地址
port: 6369 # 端口
database: 16 # 数据库索引
password: 20221122@dev # 密码,建议生产环境开启