|
|
@ -39,6 +39,8 @@ import co.yixiang.modules.cart.domain.YxStoreCart; |
|
|
|
import co.yixiang.modules.cart.service.YxStoreCartService; |
|
|
|
import co.yixiang.modules.cart.service.YxStoreCartService; |
|
|
|
import co.yixiang.modules.cart.service.mapper.StoreCartMapper; |
|
|
|
import co.yixiang.modules.cart.service.mapper.StoreCartMapper; |
|
|
|
import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; |
|
|
|
import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; |
|
|
|
|
|
|
|
import co.yixiang.modules.category.domain.YxStoreCategory; |
|
|
|
|
|
|
|
import co.yixiang.modules.category.service.YxStoreCategoryService; |
|
|
|
import co.yixiang.modules.order.domain.YxExpress; |
|
|
|
import co.yixiang.modules.order.domain.YxExpress; |
|
|
|
import co.yixiang.modules.order.domain.YxStoreOrder; |
|
|
|
import co.yixiang.modules.order.domain.YxStoreOrder; |
|
|
|
import co.yixiang.modules.order.domain.YxStoreOrderCartInfo; |
|
|
|
import co.yixiang.modules.order.domain.YxStoreOrderCartInfo; |
|
|
@ -51,6 +53,7 @@ import co.yixiang.modules.order.service.YxStoreOrderStatusService; |
|
|
|
import co.yixiang.modules.order.service.dto.*; |
|
|
|
import co.yixiang.modules.order.service.dto.*; |
|
|
|
import co.yixiang.modules.order.service.mapper.StoreOrderMapper; |
|
|
|
import co.yixiang.modules.order.service.mapper.StoreOrderMapper; |
|
|
|
import co.yixiang.modules.order.vo.*; |
|
|
|
import co.yixiang.modules.order.vo.*; |
|
|
|
|
|
|
|
import co.yixiang.modules.product.domain.YxStoreProduct; |
|
|
|
import co.yixiang.modules.product.domain.YxStoreProductReply; |
|
|
|
import co.yixiang.modules.product.domain.YxStoreProductReply; |
|
|
|
import co.yixiang.modules.product.service.YxStoreProductReplyService; |
|
|
|
import co.yixiang.modules.product.service.YxStoreProductReplyService; |
|
|
|
import co.yixiang.modules.product.service.YxStoreProductService; |
|
|
|
import co.yixiang.modules.product.service.YxStoreProductService; |
|
|
@ -61,6 +64,7 @@ import co.yixiang.modules.shop.domain.YxSystemStore; |
|
|
|
import co.yixiang.modules.shop.service.YxSystemConfigService; |
|
|
|
import co.yixiang.modules.shop.service.YxSystemConfigService; |
|
|
|
import co.yixiang.modules.shop.service.YxSystemStoreService; |
|
|
|
import co.yixiang.modules.shop.service.YxSystemStoreService; |
|
|
|
import co.yixiang.modules.shop.service.YxSystemStoreStaffService; |
|
|
|
import co.yixiang.modules.shop.service.YxSystemStoreStaffService; |
|
|
|
|
|
|
|
import co.yixiang.modules.store.service.YxStoreBrandService; |
|
|
|
import co.yixiang.modules.template.domain.YxShippingTemplates; |
|
|
|
import co.yixiang.modules.template.domain.YxShippingTemplates; |
|
|
|
import co.yixiang.modules.template.domain.YxShippingTemplatesFree; |
|
|
|
import co.yixiang.modules.template.domain.YxShippingTemplatesFree; |
|
|
|
import co.yixiang.modules.template.domain.YxShippingTemplatesRegion; |
|
|
|
import co.yixiang.modules.template.domain.YxShippingTemplatesRegion; |
|
|
@ -103,6 +107,7 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
@ -198,6 +203,15 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private YxStoreOrderService yxStoreOrderService; |
|
|
|
private YxStoreOrderService yxStoreOrderService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private YxStoreBrandService yxStoreBrandService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private YxStoreCategoryService yxStoreCategoryService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private YxStoreProductService yxStoreProductService; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 返回订单确认数据 |
|
|
|
* 返回订单确认数据 |
|
|
|
* |
|
|
|
* |
|
|
@ -486,8 +500,13 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y |
|
|
|
gainIntegral = BigDecimal.ZERO; |
|
|
|
gainIntegral = BigDecimal.ZERO; |
|
|
|
isIntegral = true; |
|
|
|
isIntegral = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
SimpleDateFormat dmDate = new SimpleDateFormat("yyyyMMddHHmmss"); // 获取当前时间
|
|
|
|
|
|
|
|
Date date = new Date(); |
|
|
|
|
|
|
|
String dateran = dmDate.format(date); |
|
|
|
|
|
|
|
int ran=(int)((Math.random() * 9 + 1) * 10000); //生成随机数防止重复
|
|
|
|
//生成分布式唯一值
|
|
|
|
//生成分布式唯一值
|
|
|
|
String orderSn = IdUtil.getSnowflake(0, 0).nextIdStr(); |
|
|
|
// String orderSn = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
|
|
|
|
|
String orderSn=dateran+ran; |
|
|
|
//组合数据
|
|
|
|
//组合数据
|
|
|
|
YxStoreOrder storeOrder = new YxStoreOrder(); |
|
|
|
YxStoreOrder storeOrder = new YxStoreOrder(); |
|
|
|
storeOrder.setUid(Long.valueOf(String.valueOf(uid))); |
|
|
|
storeOrder.setUid(Long.valueOf(String.valueOf(uid))); |
|
|
@ -696,7 +715,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y |
|
|
|
YxStoreOrder storeOrder = new YxStoreOrder(); |
|
|
|
YxStoreOrder storeOrder = new YxStoreOrder(); |
|
|
|
//修改状态
|
|
|
|
//修改状态
|
|
|
|
storeOrder.setId(orderQueryVo.getId()); |
|
|
|
storeOrder.setId(orderQueryVo.getId()); |
|
|
|
if (ShopCommonEnum.AGREE_2.getValue().equals(type)) { |
|
|
|
if (ShopCommonEnum.AGREE_2.getValue().equals(type)) {//同意退款
|
|
|
|
storeOrder.setRefundStatus(OrderInfoEnum.REFUND_STATUS_0.getValue()); |
|
|
|
storeOrder.setRefundStatus(OrderInfoEnum.REFUND_STATUS_0.getValue()); |
|
|
|
yxStoreOrderMapper.updateById(storeOrder); |
|
|
|
yxStoreOrderMapper.updateById(storeOrder); |
|
|
|
StoreAfterSales storeAfterSales = storeAfterSalesService.lambdaQuery() |
|
|
|
StoreAfterSales storeAfterSales = storeAfterSalesService.lambdaQuery() |
|
|
@ -1158,15 +1177,18 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y |
|
|
|
orderStatusService.create(order.getId(), |
|
|
|
orderStatusService.create(order.getId(), |
|
|
|
OrderLogEnum.REFUND_ORDER_APPLY.getValue(), |
|
|
|
OrderLogEnum.REFUND_ORDER_APPLY.getValue(), |
|
|
|
"用户申请退款,原因:" + text); |
|
|
|
"用户申请退款,原因:" + text); |
|
|
|
//模板消息发布事件
|
|
|
|
//这里调用退款方法,直接进行退款
|
|
|
|
TemplateBean templateBean = TemplateBean.builder() |
|
|
|
yxStoreOrderService.orderRefund(order.getOrderId(),order.getPayPrice(), |
|
|
|
.orderId(order.getOrderId()) |
|
|
|
ShopCommonEnum.AGREE_1.getValue()); |
|
|
|
.price(order.getPayPrice().toString()) |
|
|
|
//取消拼团不进行模板消息发布事件
|
|
|
|
.uid(order.getUid()) |
|
|
|
// TemplateBean templateBean = TemplateBean.builder()
|
|
|
|
.templateType(TemplateListenEnum.TYPE_9.getValue()) |
|
|
|
// .orderId(order.getOrderId())
|
|
|
|
.time(DateUtil.formatTime(new Date())) |
|
|
|
// .price(order.getPayPrice().toString())
|
|
|
|
.build(); |
|
|
|
// .uid(order.getUid())
|
|
|
|
publisher.publishEvent(new TemplateEvent(this, templateBean)); |
|
|
|
// .templateType(TemplateListenEnum.TYPE_9.getValue())
|
|
|
|
|
|
|
|
// .time(DateUtil.formatTime(new Date()))
|
|
|
|
|
|
|
|
// .build();
|
|
|
|
|
|
|
|
// publisher.publishEvent(new TemplateEvent(this, templateBean));
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -2495,6 +2517,8 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y |
|
|
|
map.put("订单号", yxStoreOrder.getOrderId()); |
|
|
|
map.put("订单号", yxStoreOrder.getOrderId()); |
|
|
|
map.put("用户id", yxStoreOrder.getUid()); |
|
|
|
map.put("用户id", yxStoreOrder.getUid()); |
|
|
|
StringBuilder pname = new StringBuilder(); |
|
|
|
StringBuilder pname = new StringBuilder(); |
|
|
|
|
|
|
|
StringBuilder pBrand=new StringBuilder(); |
|
|
|
|
|
|
|
StringBuilder pCate=new StringBuilder(); |
|
|
|
yxStoreOrder.getCartInfoList().forEach(c->{ |
|
|
|
yxStoreOrder.getCartInfoList().forEach(c->{ |
|
|
|
Object info = c.getCartInfoMap().get("productInfo"); |
|
|
|
Object info = c.getCartInfoMap().get("productInfo"); |
|
|
|
YxStoreProductQueryVo vo = JSONUtil.toBean(info.toString(), YxStoreProductQueryVo.class); |
|
|
|
YxStoreProductQueryVo vo = JSONUtil.toBean(info.toString(), YxStoreProductQueryVo.class); |
|
|
@ -2505,10 +2529,26 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y |
|
|
|
.append(ObjectUtil.isNotEmpty(vo.getAttrInfo()) ? vo.getAttrInfo().getSku() : "") |
|
|
|
.append(ObjectUtil.isNotEmpty(vo.getAttrInfo()) ? vo.getAttrInfo().getSku() : "") |
|
|
|
.append(" ,\r\n"); |
|
|
|
.append(" ,\r\n"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Integer productId=Integer.valueOf(c.getCartInfoMap().get("productId").toString()); |
|
|
|
|
|
|
|
YxStoreProduct yxStoreProduct=yxStoreProductService.getById(productId); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotNull(yxStoreBrandService.getById(yxStoreProduct.getBrandId()))){ |
|
|
|
|
|
|
|
pBrand.append(yxStoreBrandService.getById(yxStoreProduct.getBrandId()).getBrandName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (ObjectUtil.isNotNull(yxStoreCategoryService.getById(yxStoreProduct.getCateId()))){ |
|
|
|
|
|
|
|
YxStoreCategory yxStoreCategory=yxStoreCategoryService.getById(yxStoreProduct.getCateId()); |
|
|
|
|
|
|
|
pCate.append(yxStoreCategoryService.getById(yxStoreProduct.getCateId()).getCateName()); |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
map.put("商品名称",pname); |
|
|
|
map.put("商品名称",pname); |
|
|
|
|
|
|
|
map.put("商品品牌",pBrand); |
|
|
|
|
|
|
|
map.put("商品分类",pCate); |
|
|
|
|
|
|
|
map.put("用户id",yxStoreOrder.getUid()); |
|
|
|
map.put("用户姓名", yxStoreOrder.getRealName()); |
|
|
|
map.put("用户姓名", yxStoreOrder.getRealName()); |
|
|
|
map.put("用户电话", yxStoreOrder.getUserPhone()); |
|
|
|
map.put("用户电话", yxStoreOrder.getUserPhone()); |
|
|
|
|
|
|
|
map.put("省",yxStoreOrder.getUserAddress().split(" ")[0]); |
|
|
|
|
|
|
|
map.put("市",yxStoreOrder.getUserAddress().split(" ")[1]); |
|
|
|
|
|
|
|
map.put("区",yxStoreOrder.getUserAddress().split(" ")[2]); |
|
|
|
map.put("详细地址", yxStoreOrder.getUserAddress()); |
|
|
|
map.put("详细地址", yxStoreOrder.getUserAddress()); |
|
|
|
map.put("购物车id", yxStoreOrder.getCartId()); |
|
|
|
map.put("购物车id", yxStoreOrder.getCartId()); |
|
|
|
map.put("运费金额", yxStoreOrder.getFreightPrice()); |
|
|
|
map.put("运费金额", yxStoreOrder.getFreightPrice()); |
|
|
|