Commit 8796ba17 authored by 技术总监-万宁's avatar 技术总监-万宁

修改bug

parent f872d9f9
package com.ssy.lingxi.order.api.model.vo.request;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import java.io.Serializable;
import java.util.List;
/**
* 售后服务 - 修改订单商品的换货、退货、维修数量
* @author 万宁
* @version 2.0.0
* @date 2021-08-06
*/
public class OrderAfterSaleVO implements Serializable {
private static final long serialVersionUID = 3492933630945033716L;
/**
* 订单Id
*/
@NotNull(message = "订单Id要大于0")
@Positive(message = "订单Id要大于0")
private Long orderId;
/**
* 订单商品列表
*/
@NotEmpty(message = "订单商品列表不能为空")
@Valid
private List<OrderProductAfterSaleVO> products;
public Long getOrderId() {
return orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
public List<OrderProductAfterSaleVO> getProducts() {
return products;
}
public void setProducts(List<OrderProductAfterSaleVO> products) {
this.products = products;
}
}
package com.ssy.lingxi.order.api.model.vo.request;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import java.io.Serializable;
/**
* 订单Id作为接口参数
* @author 万宁
* @version 2.0.0
* @date 2021-08-06
*/
public class OrderIdFeignVO implements Serializable {
private static final long serialVersionUID = 1503499935366204822L;
/**
* 订单Id
*/
@NotNull(message = "订单Id要大于0")
@Positive(message = "订单Id要大于0")
private Long orderId;
public Long getOrderId() {
return orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
}
package com.ssy.lingxi.order.api.model.vo.request;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author 万宁
* @version 2.0.0
* @date 2021-08-06
*/
public class OrderProductAfterSaleVO implements Serializable {
private static final long serialVersionUID = -828327298738792475L;
public OrderProductAfterSaleVO() {
this.productId = "";
this.exchangeCount = BigDecimal.ZERO;
this.returnCount = BigDecimal.ZERO;
this.maintainCount = BigDecimal.ZERO;
}
/**
* 商品SkuId或物料编号
*/
private String productId;
/**
* 换货数量
*/
private BigDecimal exchangeCount;
/**
* 退货数量
*/
private BigDecimal returnCount;
/**
* 维修数量
*/
private BigDecimal maintainCount;
public String getProductId() {
return productId;
}
public void setProductId(String productId) {
this.productId = productId;
}
public BigDecimal getExchangeCount() {
return exchangeCount;
}
public void setExchangeCount(BigDecimal exchangeCount) {
this.exchangeCount = exchangeCount;
}
public BigDecimal getReturnCount() {
return returnCount;
}
public void setReturnCount(BigDecimal returnCount) {
this.returnCount = returnCount;
}
public BigDecimal getMaintainCount() {
return maintainCount;
}
public void setMaintainCount(BigDecimal maintainCount) {
this.maintainCount = maintainCount;
}
}
......@@ -174,6 +174,12 @@ public class OrderProductDO implements Serializable {
private BigDecimal returnCount;
/**
* 维修数量
*/
@Column(columnDefinition = "numeric(15,4)")
private BigDecimal maintainCount;
/**
* 自提地址(如配送方式为自提,必填)
*/
@Column(columnDefinition = "varchar(200)")
......@@ -399,6 +405,14 @@ public class OrderProductDO implements Serializable {
this.returnCount = returnCount;
}
public BigDecimal getMaintainCount() {
return maintainCount;
}
public void setMaintainCount(BigDecimal maintainCount) {
this.maintainCount = maintainCount;
}
public String getAddress() {
return address;
}
......
......@@ -15,7 +15,7 @@ import java.math.BigDecimal;
public class OrderAfterSaleProductDetailVO implements Serializable {
private static final long serialVersionUID = -2975506613066526558L;
public OrderAfterSaleProductDetailVO(String processKey, Long skuId, String productNo, String name, String category, String brand, String unit, String spec, BigDecimal quantity, BigDecimal price, BigDecimal amount, BigDecimal exchangeCount, BigDecimal returnCount) {
public OrderAfterSaleProductDetailVO(String processKey, Long skuId, String productNo, String name, String category, String brand, String unit, String spec, BigDecimal quantity, BigDecimal price, BigDecimal amount, BigDecimal exchangeCount, BigDecimal returnCount, BigDecimal maintainCount) {
this.processKey = StringUtils.hasLength(processKey) ? processKey : "";
this.productId = StringUtils.hasLength(productNo) ? productNo : String.valueOf(skuId);
this.name = StringUtils.hasLength(spec) ? name.concat("/").concat(spec) : name;
......@@ -27,6 +27,7 @@ public class OrderAfterSaleProductDetailVO implements Serializable {
this.amount = NumberUtil.formatAmount(amount);
this.exchangeCount = NumberUtil.formatToInteger(exchangeCount);
this.returnCount = NumberUtil.formatToInteger(returnCount);
this.maintainCount = NumberUtil.formatToInteger(maintainCount);
}
/**
......@@ -84,6 +85,11 @@ public class OrderAfterSaleProductDetailVO implements Serializable {
*/
private String returnCount;
/**
* 维修数量
*/
private String maintainCount;
public String getProcessKey() {
return processKey;
}
......@@ -171,4 +177,12 @@ public class OrderAfterSaleProductDetailVO implements Serializable {
public void setReturnCount(String returnCount) {
this.returnCount = returnCount;
}
public String getMaintainCount() {
return maintainCount;
}
public void setMaintainCount(String maintainCount) {
this.maintainCount = maintainCount;
}
}
......@@ -3,6 +3,7 @@ package com.ssy.lingxi.order.service.feign;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.member.merchant.api.model.constant.MemberRightSpendTypeEnum;
import com.ssy.lingxi.member.merchant.api.model.vo.inner.request.MemberFeignVO;
import com.ssy.lingxi.order.entity.OrderDO;
import com.ssy.lingxi.order.model.vo.platform.response.PlatformProcessMemberQueryVO;
import org.springframework.stereotype.Service;
......@@ -19,6 +20,17 @@ import java.util.List;
public interface IMemberFeignService {
/**
* (异步)通知会员服务,计算等级、权益、积分
* @param buyerMemberId 采购商会员Id
* @param buyerRoleId 采购商会员角色Id
* @param vendorMemberId 供应商会员Id
* @param vendorRoleId 供应商会员角色Id
* @param amount 订单金额
* @param orderNo 订单号
*/
void calculateMemberLrcAsync(Long buyerMemberId, Long buyerRoleId, Long vendorMemberId, Long vendorRoleId, BigDecimal amount, String orderNo);
/**
* 通知会员服务,计算等级、权益、积分
* @param buyerMemberId 采购商会员Id
* @param buyerRoleId 采购商会员角色Id
......@@ -45,6 +57,12 @@ public interface IMemberFeignService {
Wrapper<Void> calculateMemberUsedRightPoint(Long buyerMemberId, Long buyerRoleId, Long vendorMemberId, Long vendorRoleId, Integer memberRelationType, String payPassword, MemberRightSpendTypeEnum memberRightSpendTypeEnum, String orderNo);
/**
* 订单完成后,向会员服务的订单评论功能发送订单数据
* @param order 订单
*/
void saveMemberOrderCommentAsync(OrderDO order);
/**
* 查询平台会员的信息
* @param name 会员名称
* @param members 会员Id和角色Id列表
......
package com.ssy.lingxi.order.service.feign;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.order.api.model.vo.request.OrderAfterSaleVO;
import com.ssy.lingxi.order.api.model.vo.request.OrderPurchaseProcessFeignVO;
import com.ssy.lingxi.order.api.model.vo.request.OrderTradeProcessFeignVO;
import com.ssy.lingxi.order.api.model.vo.response.OrderPurchaseProcessFeignDetailVO;
......@@ -20,11 +21,17 @@ public interface IOrderFeignService {
*/
Wrapper<OrderTradeProcessFeignDetailVO> findVendorTradeProcess(OrderTradeProcessFeignVO feignVO);
/**
* 查询(采购)会员采购流程规则配置
* @param feignVO 接口参数
* @return 查询结果
*/
Wrapper<OrderPurchaseProcessFeignDetailVO> findBuyerPurchaseProcess(OrderPurchaseProcessFeignVO feignVO);
/**
* 售后服务 - 更新订单商品的换货、退货、维修数量
* @param afterSaleVO 接口参数
* @return 更新结果
*/
Wrapper<Void> updateAfterSaleOrderProduct(OrderAfterSaleVO afterSaleVO);
}
......@@ -744,7 +744,10 @@ public class BaseOrderServiceImpl implements IBaseOrderService {
}
//通知会员服务,计算会员权益积分
memberFeignService.calculateMemberLrc(order.getBuyerMemberId(), order.getBuyerRoleId(), order.getVendorMemberId(), order.getVendorRoleId(), order.getTotalAmount(), order.getOrderNo());
memberFeignService.calculateMemberLrcAsync(order.getBuyerMemberId(), order.getBuyerRoleId(), order.getVendorMemberId(), order.getVendorRoleId(), order.getTotalAmount(), order.getOrderNo());
//通知会员服务,记录订单,待评论订单
memberFeignService.saveMemberOrderCommentAsync(order);
//Srm订单不需要交易记录、不需要更新成交数量
if(!order.getOrderKind().equals(OrderSourceKindEnum.SRM.getCode())) {
......
......@@ -4,14 +4,17 @@ import com.ssy.lingxi.common.response.ResponseCode;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.member.merchant.api.feign.inner.MemberInnerControllerFeign;
import com.ssy.lingxi.member.merchant.api.feign.inner.MemberLevelRightCreditControllerFeign;
import com.ssy.lingxi.member.merchant.api.feign.inner.MemberOrderCommentControllerFeign;
import com.ssy.lingxi.member.merchant.api.model.constant.MemberRightSpendTypeEnum;
import com.ssy.lingxi.member.merchant.api.model.vo.inner.request.MemberFeignOrderVO;
import com.ssy.lingxi.member.merchant.api.model.vo.inner.request.MemberFeignRightSpendVO;
import com.ssy.lingxi.member.merchant.api.model.vo.inner.request.MemberFeignVO;
import com.ssy.lingxi.member.merchant.api.model.vo.inner.request.*;
import com.ssy.lingxi.member.merchant.api.model.vo.inner.response.MemberFeignPageQueryVO;
import com.ssy.lingxi.member.merchant.api.model.vo.inner.response.MemberFeignReturnRightVO;
import com.ssy.lingxi.order.entity.OrderDO;
import com.ssy.lingxi.order.model.vo.platform.response.PlatformProcessMemberQueryVO;
import com.ssy.lingxi.order.service.feign.IMemberFeignService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
......@@ -31,12 +34,47 @@ import java.util.stream.Collectors;
*/
@Service
public class MemberFeignServiceImpl implements IMemberFeignService {
private static final Logger logger = LoggerFactory.getLogger(MemberFeignServiceImpl.class);
@Resource
private MemberLevelRightCreditControllerFeign memberLevelRightCreditControllerFeign;
@Resource
private MemberInnerControllerFeign memberInnerControllerFeign;
@Resource
private MemberOrderCommentControllerFeign memberOrderCommentControllerFeign;
/**
* (异步)通知会员服务,计算等级、权益、积分
*
* @param buyerMemberId 采购商会员Id
* @param buyerRoleId 采购商会员角色Id
* @param vendorMemberId 供应商会员Id
* @param vendorRoleId 供应商会员角色Id
* @param amount 订单金额
* @param orderNo 订单号
*/
@Async
@Override
public void calculateMemberLrcAsync(Long buyerMemberId, Long buyerRoleId, Long vendorMemberId, Long vendorRoleId, BigDecimal amount, String orderNo) {
try {
MemberFeignOrderVO orderVO = new MemberFeignOrderVO();
orderVO.setUpperMemberId(vendorMemberId);
orderVO.setUpperRoleId(vendorRoleId);
orderVO.setSubMemberId(buyerMemberId);
orderVO.setSubRoleId(buyerRoleId);
orderVO.setOrderNo(orderNo);
orderVO.setAmount(amount.doubleValue());
Wrapper<MemberFeignReturnRightVO> returnRight = memberLevelRightCreditControllerFeign.calculateMemberLrcByOrder(orderVO);
if (returnRight.getCode() != ResponseCode.SUCCESS.getCode()) {
logger.error("通知会员服务,计算等级、权益、积分错误:" + returnRight.getMessage());
}
} catch (Exception e) {
logger.error("通知会员服务,计算等级、权益、积分错误:" + e.getMessage());
}
}
/**
* 通知会员服务,计算等级、权益、积分
*
......@@ -93,6 +131,74 @@ public class MemberFeignServiceImpl implements IMemberFeignService {
}
/**
* 订单完成后,向会员服务的订单评论功能发送订单数据
*
* @param order 订单
*/
@Async
@Override
public void saveMemberOrderCommentAsync(OrderDO order) {
try {
MemberOrderCommentVO commentVO = new MemberOrderCommentVO();
commentVO.setId(order.getId());
commentVO.setCreateTime(order.getCreateTime());
commentVO.setBuyerMemberId(order.getBuyerMemberId());
commentVO.setBuyerRoleId(order.getBuyerRoleId());
commentVO.setBuyerMemberName(order.getBuyerMemberName());
commentVO.setVendorMemberId(order.getVendorMemberId());
commentVO.setVendorRoleId(order.getVendorRoleId());
commentVO.setVendorMemberName(order.getVendorMemberName());
commentVO.setOrderNo(order.getOrderNo());
commentVO.setShopId(order.getShopId());
commentVO.setShopType(order.getShopType());
commentVO.setShopEnvironment(order.getShopEnvironment());
commentVO.setShopName(order.getShopName());
commentVO.setOrderMode(order.getOrderMode());
commentVO.setOrderType(order.getOrderType());
commentVO.setOrderKind(order.getOrderKind());
commentVO.setPayType(order.getPayType());
commentVO.setPayChannel(order.getPayChannel());
commentVO.setQuoteNo(order.getQuoteNo());
commentVO.setDigest(order.getDigest());
commentVO.setProductAmount(order.getProductAmount());
commentVO.setFreight(order.getFreight());
commentVO.setPromotionAmount(order.getPromotionAmount());
commentVO.setCouponAmount(order.getCouponAmount());
commentVO.setTotalAmount(order.getTotalAmount());
commentVO.setBuyerInnerStatus(order.getBuyerInnerStatus());
commentVO.setVendorInnerStatus(order.getVendorInnerStatus());
commentVO.setOuterStatus(order.getOuterStatus());
commentVO.setProducts(order.getProducts().stream().map(product -> {
MemberOrderProductCommentVO productCommentVO = new MemberOrderProductCommentVO();
productCommentVO.setId(product.getId());
productCommentVO.setProductId(product.getProductId());
productCommentVO.setProductNo(product.getProductNo());
productCommentVO.setName(product.getName());
productCommentVO.setCategory(product.getCategory());
productCommentVO.setBrand(product.getBrand());
productCommentVO.setSpec(product.getSpec());
productCommentVO.setUnit(product.getUnit());
productCommentVO.setLogo(product.getLogo());
productCommentVO.setPrice(product.getPrice());
productCommentVO.setQuantity(product.getQuantity());
productCommentVO.setAmount(product.getAmount());
productCommentVO.setDeliverType(product.getDeliverType());
productCommentVO.setAddress(product.getAddress());
productCommentVO.setReceiver(product.getReceiver());
productCommentVO.setPhone(product.getPhone());
return productCommentVO;
}).collect(Collectors.toList()));
Wrapper<Void> result = memberOrderCommentControllerFeign.saveMemberOrderComment(commentVO);
if (result.getCode() != ResponseCode.SUCCESS.getCode()) {
logger.error("订单完成后,向会员服务的订单评论功能发送订单数据错误:" + result.getMessage());
}
} catch (Exception e) {
logger.error("订单完成后,向会员服务的订单评论功能发送订单数据错误:" + e.getMessage());
}
}
/**
* 查询平台会员的信息
*
* @param members 会员Id和角色Id列表
......
......@@ -2,6 +2,7 @@ package com.ssy.lingxi.order.serviceimpl.feign;
import com.ssy.lingxi.common.response.ResponseCode;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.order.api.model.vo.request.OrderAfterSaleVO;
import com.ssy.lingxi.order.api.model.vo.request.OrderPurchaseProcessFeignVO;
import com.ssy.lingxi.order.api.model.vo.request.OrderTradeProcessFeignVO;
import com.ssy.lingxi.order.api.model.vo.response.OrderPurchaseProcessFeignDetailVO;
......@@ -73,4 +74,15 @@ public class OrderFeignServiceImpl implements IOrderFeignService {
detailVO.setSkipFirstStep(result.getData().getSkipFirstStep());
return Wrapper.success(detailVO);
}
/**
* 售后服务 - 更新订单商品的换货、退货、维修数量
*
* @param afterSaleVO 接口参数
* @return 更新结果
*/
@Override
public Wrapper<Void> updateAfterSaleOrderProduct(OrderAfterSaleVO afterSaleVO) {
return null;
}
}
......@@ -181,7 +181,8 @@ public class OrderCommonServiceImpl implements IOrderCommonService {
qOrderProduct.price,
qOrderProduct.amount,
qOrderProduct.exchangeCount,
qOrderProduct.returnCount
qOrderProduct.returnCount,
qOrderProduct.maintainCount
)))));
return Wrapper.success(new PageData<>(totalCount, new ArrayList<>(transform.values())));
......@@ -260,7 +261,8 @@ public class OrderCommonServiceImpl implements IOrderCommonService {
qOrderProduct.price,
qOrderProduct.amount,
qOrderProduct.exchangeCount,
qOrderProduct.returnCount
qOrderProduct.returnCount,
qOrderProduct.maintainCount
)))));
return Wrapper.success(new PageData<>(totalCount, new ArrayList<>(transform.values())));
......
......@@ -9,7 +9,7 @@ spring:
main:
allow-bean-definition-overriding: true
datasource:
url: jdbc:postgresql://10.0.0.16:5432/scm-v2?stringtype=unspecified
url: jdbc:postgresql://10.0.0.16:5432/scm-v2?stringtype=unspecified&reWriteBatchedInserts=true
username: dbadmin
password: dbadmin
type: com.zaxxer.hikari.HikariDataSource
......@@ -28,6 +28,14 @@ spring:
database: postgresql
hibernate:
ddl-auto: update
properties:
hibernate:
enable_lazy_load_no_trans: true
jdbc:
batch_size: 50
batch_versioned_data: true
order_inserts: true
order_updates: true
# Consul Config
cloud:
kubernetes:
......@@ -45,6 +53,10 @@ spring:
enabled: true
health-check-timeout: 60s
instance-id: ${spring.application.name}-${spring.cloud.client.ip-address}-${server.port}
#健康检查失败多长时间取消注册
health-check-critical-timeout: 90s
#服务停止时取消注册
deregister: true
retry:
max-attempts: 100
# 禁止使用Ribbon,否则启动时会报Warning信息
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment