Browse Source

支持后台取消商品,订单号改为时间关联

sj
1304317391@qq.com 2 years ago
parent
commit
10ccf471c5
  1. 2
      yudao-server/src/main/resources/application-local.yaml
  2. 5
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCombinationDto.java
  3. 4
      zsw-bxg/src/main/java/co/yixiang/modules/hotList/service/YxStoreHotListService.java
  4. 7
      zsw-bxg/src/main/java/co/yixiang/modules/hotList/service/impl/YxStoreHotListServiceImpl.java
  5. 11
      zsw-bxg/src/main/java/co/yixiang/modules/order/rest/StoreOrderController.java
  6. 62
      zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java
  7. 13
      zsw-bxg/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java

2
yudao-server/src/main/resources/application-local.yaml

@ -270,7 +270,7 @@ dubbo:
bxg: bxg:
shop: shop:
# API_URL: http://192.168.10.113:48080/bxgApp # API_URL: http://192.168.10.113:48080/bxgApp
API_URL: http://5205b509.r5.cpolar.top API_URL: http://7c539556.r5.cpolar.top
SITE_URL: http://192.168.10.113:48080/bxgApp SITE_URL: http://192.168.10.113:48080/bxgApp
UNI_SITE_URL: http://192.168.10.113:48080/bxgApp UNI_SITE_URL: http://192.168.10.113:48080/bxgApp
ADMIN_API_URL: http://192.168.10.113:48080/bxg ADMIN_API_URL: http://192.168.10.113:48080/bxg

5
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/dto/YxStoreCombinationDto.java

@ -63,9 +63,12 @@ public class YxStoreCombinationDto implements Serializable {
// 简介 // 简介
private String info; private String info;
// 价格 // 拼团价格
private BigDecimal price; private BigDecimal price;
//售价
private BigDecimal productPrice;
// 排序 // 排序
private Integer sort; private Integer sort;

4
zsw-bxg/src/main/java/co/yixiang/modules/hotList/service/YxStoreHotListService.java

@ -60,6 +60,10 @@ public interface YxStoreHotListService extends BaseService<YxStoreHotList> {
*/ */
List<YxStoreProduct> getList(YxStoreHotListRecordQueryParam QueryParam); List<YxStoreProduct> getList(YxStoreHotListRecordQueryParam QueryParam);
/**
* 首页榜单显示
*/
List<HotListDTO> getList(); List<HotListDTO> getList();
} }

7
zsw-bxg/src/main/java/co/yixiang/modules/hotList/service/impl/YxStoreHotListServiceImpl.java

@ -248,6 +248,7 @@ public class YxStoreHotListServiceImpl extends BaseServiceImpl<YxStoreHotListMap
pageList.getRecords().forEach(yxStoreHotListRecord -> { pageList.getRecords().forEach(yxStoreHotListRecord -> {
YxStoreProduct yxStoreProduct=storeProductMapper.selectById(yxStoreHotListRecord.getProductId()); YxStoreProduct yxStoreProduct=storeProductMapper.selectById(yxStoreHotListRecord.getProductId());
if (ObjectUtil.isNotNull(yxStoreProduct)){ if (ObjectUtil.isNotNull(yxStoreProduct)){
yxStoreProduct.setHotSales(yxStoreHotListRecord.getHotSales());
list.add(yxStoreProduct); list.add(yxStoreProduct);
} }
}); });
@ -267,7 +268,8 @@ public class YxStoreHotListServiceImpl extends BaseServiceImpl<YxStoreHotListMap
//获取月份 //获取月份
LinkedHashSet<String> mouthList=new LinkedHashSet<>(); LinkedHashSet<String> mouthList=new LinkedHashSet<>();
list.forEach(yxStoreHotListRecord -> mouthList.add(yxStoreHotListRecord.getMouth())); list.forEach(yxStoreHotListRecord -> mouthList.add(yxStoreHotListRecord.getMouth()));
String mouth=Collections.max(mouthList); String mouth=Collections.max(mouthList);//设定月份为最近的月份
//获取当前月份的榜单记录
List<YxStoreHotListRecord> recordList=yxStoreHotListRecordMapper.selectList(wrapper.eq(YxStoreHotListRecord::getMouth,mouth)); List<YxStoreHotListRecord> recordList=yxStoreHotListRecordMapper.selectList(wrapper.eq(YxStoreHotListRecord::getMouth,mouth));
LinkedHashSet<Integer> hotIdList=new LinkedHashSet<>(); LinkedHashSet<Integer> hotIdList=new LinkedHashSet<>();
//获得不重复的榜单id //获得不重复的榜单id
@ -282,6 +284,7 @@ public class YxStoreHotListServiceImpl extends BaseServiceImpl<YxStoreHotListMap
ArrayList <Integer> list1=new ArrayList<>(); ArrayList <Integer> list1=new ArrayList<>();
yxStoreHotListMapper.selectList(wrapperList).forEach(yxHotList->list1.add(yxHotList.getId())); yxStoreHotListMapper.selectList(wrapperList).forEach(yxHotList->list1.add(yxHotList.getId()));
ArrayList<HotListDTO> hotListDTOS=new ArrayList<>(); ArrayList<HotListDTO> hotListDTOS=new ArrayList<>();
//已经排序过的榜单
list1.forEach(hotId->{ list1.forEach(hotId->{
LambdaQueryWrapper<YxStoreHotListRecord> wrapper1= SerializationUtils.clone(wrapper); LambdaQueryWrapper<YxStoreHotListRecord> wrapper1= SerializationUtils.clone(wrapper);
//查出当前月份当前榜单的记录 //查出当前月份当前榜单的记录
@ -295,7 +298,7 @@ public class YxStoreHotListServiceImpl extends BaseServiceImpl<YxStoreHotListMap
if(ObjectUtil.isNotNull(storeCategoryMapper.selectById(cate.getCateId()))){ if(ObjectUtil.isNotNull(storeCategoryMapper.selectById(cate.getCateId()))){
cateIdList.add(cate.getCateId()); cateIdList.add(cate.getCateId());
} }
productInfo.add(storeProductMapper.selectById(cate.getProductId())); productInfo.add(storeProductMapper.selectById(cate.getProductId()).setHotSales(cate.getHotSales()));
}); });
ArrayList<CateDto> cateDtos=new ArrayList<>(); ArrayList<CateDto> cateDtos=new ArrayList<>();
//把该榜单下的分类封为一个数组 //把该榜单下的分类封为一个数组

11
zsw-bxg/src/main/java/co/yixiang/modules/order/rest/StoreOrderController.java

@ -215,7 +215,7 @@ public class StoreOrderController {
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
} }
@ApiOperation(value = "通过审核,准备发货") @ApiOperation(value = "通过审核,可以进行发货")
@PutMapping(value = "/ordercheck") @PutMapping(value = "/ordercheck")
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')") @PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
public ResponseEntity checkdate(@Validated @RequestBody YxStoreOrder resources) { public ResponseEntity checkdate(@Validated @RequestBody YxStoreOrder resources) {
@ -223,6 +223,15 @@ public class StoreOrderController {
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
} }
@ApiOperation(value = "未付款订单进行取消")
@PutMapping(value = "/orderCancel")
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
public ResponseEntity canceldate(@Validated @RequestBody YxStoreOrder resources) {
yxStoreOrderService.cancelOrder(resources.getOrderId(), resources.getUid());
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@ApiOperation(value = "修改快递单号") @ApiOperation(value = "修改快递单号")
@PutMapping(value = "/yxStoreOrder/updateDelivery") @PutMapping(value = "/yxStoreOrder/updateDelivery")

62
zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java

@ -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());

13
zsw-bxg/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java

@ -16,6 +16,8 @@ import co.yixiang.exception.ErrorRequestException;
import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; import co.yixiang.modules.cart.vo.YxStoreCartQueryVo;
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;
import co.yixiang.modules.order.service.YxStoreOrderService;
import co.yixiang.modules.order.service.impl.YxStoreOrderServiceImpl;
import co.yixiang.modules.order.service.mapper.StoreOrderCartInfoMapper; import co.yixiang.modules.order.service.mapper.StoreOrderCartInfoMapper;
import co.yixiang.modules.order.service.mapper.StoreOrderMapper; import co.yixiang.modules.order.service.mapper.StoreOrderMapper;
import co.yixiang.modules.sales.domain.StoreAfterSales; import co.yixiang.modules.sales.domain.StoreAfterSales;
@ -72,11 +74,15 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
@Autowired @Autowired
private ApplicationEventPublisher publisher; private ApplicationEventPublisher publisher;
@Autowired
private YxStoreOrderServiceImpl yxStoreOrderService;
@Override @Override
public void applyForAfterSales(Long userId, String nickname, StoreAfterSalesParam storeAfterSalesParam) { public void applyForAfterSales(Long userId, String nickname, StoreAfterSalesParam storeAfterSalesParam) {
YxStoreOrder yxStoreOrder = storeOrderMapper.selectOne(Wrappers.<YxStoreOrder>lambdaQuery().eq(YxStoreOrder::getOrderId, storeAfterSalesParam.getOrderCode()).eq(YxStoreOrder::getUid, userId)); YxStoreOrder yxStoreOrder = storeOrderMapper.selectOne(Wrappers.<YxStoreOrder>lambdaQuery().eq(YxStoreOrder::getOrderId, storeAfterSalesParam.getOrderCode()).eq(YxStoreOrder::getUid, userId));
checkOrder(yxStoreOrder); checkOrder(yxStoreOrder);
//商品除去优惠后的总价格 //商品除去优惠后的总价格
BigDecimal totalPrice = BigDecimal.ZERO; BigDecimal totalPrice = BigDecimal.ZERO;
//拿到所有的商品 //拿到所有的商品
@ -97,6 +103,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
} }
} }
Integer status=yxStoreOrder.getStatus(); //储存一下申请订单的状态,用于后面判断
//更新订单状态 //更新订单状态
yxStoreOrder.setStatus(OrderInfoEnum.STATUS_NE1.getValue()); yxStoreOrder.setStatus(OrderInfoEnum.STATUS_NE1.getValue());
yxStoreOrder.setRefundStatus(OrderInfoEnum.REFUND_STATUS_1.getValue()); yxStoreOrder.setRefundStatus(OrderInfoEnum.REFUND_STATUS_1.getValue());
@ -139,6 +146,11 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now())); storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now()));
storeAfterSalesStatus.setOperator(nickname); storeAfterSalesStatus.setOperator(nickname);
storeAfterSalesStatusMapper.insert(storeAfterSalesStatus); storeAfterSalesStatusMapper.insert(storeAfterSalesStatus);
//如果订单未发货,直接调用退款方法
if (yxStoreOrder.getStatus().equals(OrderInfoEnum.STATUS_0)|yxStoreOrder.getStatus().equals(OrderInfoEnum.STATUS_5)){
yxStoreOrderService.orderRefund(yxStoreOrder.getOrderId(),yxStoreOrder.getPayPrice(),
ShopCommonEnum.AGREE_1.getValue());
}else {
//模板消息发布事件 //模板消息发布事件
TemplateBean templateBean = TemplateBean.builder() TemplateBean templateBean = TemplateBean.builder()
.orderId(yxStoreOrder.getOrderId()) .orderId(yxStoreOrder.getOrderId())
@ -149,6 +161,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
.build(); .build();
publisher.publishEvent(new TemplateEvent(this, templateBean)); publisher.publishEvent(new TemplateEvent(this, templateBean));
} }
}
@Override @Override
public List<YxStoreOrderCartInfoVo> checkOrderDetails(String key) { public List<YxStoreOrderCartInfoVo> checkOrderDetails(String key) {

Loading…
Cancel
Save