Browse Source

订单增加审核,秒杀商品显示修改

sj
1304317391@qq.com 2 years ago
parent
commit
fd57b0f92f
  1. 2
      yudao-server/src/main/resources/application-local.yaml
  2. 18
      zsw-bxg/src/main/java/co/yixiang/app/modules/order/rest/AppStoreOrderController.java
  3. 1
      zsw-bxg/src/main/java/co/yixiang/enums/OrderInfoEnum.java
  4. 55
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreSeckillServiceImpl.java
  5. 9
      zsw-bxg/src/main/java/co/yixiang/modules/activity/vo/SeckillConfigVo.java
  6. 1
      zsw-bxg/src/main/java/co/yixiang/modules/evaluation/domain/YxEvaluation.java
  7. 4
      zsw-bxg/src/main/java/co/yixiang/modules/order/domain/YxStoreOrder.java
  8. 62
      zsw-bxg/src/main/java/co/yixiang/modules/order/rest/StoreOrderController.java
  9. 19
      zsw-bxg/src/main/java/co/yixiang/modules/order/service/YxStoreOrderService.java
  10. 124
      zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java
  11. 7
      zsw-bxg/src/main/java/co/yixiang/modules/product/domain/YxStoreProduct.java
  12. 2
      zsw-bxg/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java
  13. 8
      zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/ProductDto.java
  14. 8
      zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/StoreProductDto.java
  15. 27
      zsw-bxg/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductServiceImpl.java
  16. 4
      zsw-bxg/src/main/java/co/yixiang/utils/OrderUtil.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: https://d85a-113-57-54-241.jp.ngrok.io API_URL: http://1cbbf622.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

18
zsw-bxg/src/main/java/co/yixiang/app/modules/order/rest/AppStoreOrderController.java

@ -422,6 +422,24 @@ public class AppStoreOrderController {
return ApiResult.ok(); return ApiResult.ok();
} }
/**
* 订单删除用户不可见但后台可见
*/
@AppLog(value = "订单删除", type = 1)
@NoRepeatSubmit
@AuthCheck
@PostMapping("/order/delete")
@ApiOperation(value = "用户进行订单删除", notes = "用户进行订单删除")
public ApiResult<Boolean> delOrder(@Validated @RequestBody HandleOrderParam param) {
Long uid = LocalUser.getUser().getUid();
YxStoreOrderQueryVo orderInfo = storeOrderService.getOrderInfo(param.getId(), uid);
if (ObjectUtil.isNull(orderInfo)) {
throw new YshopException("订单不存在");
}
storeOrderService.deleteOrder(param.getId(), uid);
return ApiResult.ok();
}
/** /**
* 获取物流信息 * 获取物流信息

1
zsw-bxg/src/main/java/co/yixiang/enums/OrderInfoEnum.java

@ -21,6 +21,7 @@ public enum OrderInfoEnum {
STATUS_NE1(-1,"申请退款"), STATUS_NE1(-1,"申请退款"),
STATUS_NE2(-2,"退款成功"), STATUS_NE2(-2,"退款成功"),
STATUS_0(0,"默认"), STATUS_0(0,"默认"),
STATUS_5(5,"通过审核"),
STATUS_1(1,"待收货"), STATUS_1(1,"待收货"),
STATUS_2(2,"已收货"), STATUS_2(2,"已收货"),
STATUS_3(3,"已完成"), STATUS_3(3,"已完成"),

55
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreSeckillServiceImpl.java

@ -31,7 +31,6 @@ import co.yixiang.modules.activity.service.mapper.YxStoreSeckillMapper;
import co.yixiang.modules.activity.vo.SeckillConfigVo; import co.yixiang.modules.activity.vo.SeckillConfigVo;
import co.yixiang.modules.activity.vo.StoreSeckillVo; import co.yixiang.modules.activity.vo.StoreSeckillVo;
import co.yixiang.modules.activity.vo.YxStoreSeckillQueryVo; import co.yixiang.modules.activity.vo.YxStoreSeckillQueryVo;
import co.yixiang.modules.product.domain.YxStoreProduct;
import co.yixiang.modules.product.domain.YxStoreProductAttrValue; import co.yixiang.modules.product.domain.YxStoreProductAttrValue;
import co.yixiang.modules.product.service.YxStoreProductAttrService; import co.yixiang.modules.product.service.YxStoreProductAttrService;
import co.yixiang.modules.product.service.YxStoreProductReplyService; import co.yixiang.modules.product.service.YxStoreProductReplyService;
@ -67,6 +66,7 @@ import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
/** /**
@ -101,18 +101,23 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
@Autowired @Autowired
private YxSystemGroupDataService yxSystemGroupDataService; private YxSystemGroupDataService yxSystemGroupDataService;
@Autowired
private YxStoreSeckillService yxStoreSeckillService;
@Override @Override
public SeckillConfigVo getStoreSeckil() { public SeckillConfigVo getStoreSeckil() {
//获取秒杀配置 //获取秒杀配置
AtomicInteger seckillTimeIndex = new AtomicInteger(); AtomicInteger seckillTimeIndex = new AtomicInteger();
seckillTimeIndex.set(-1);//初始值改为-1
SeckillConfigVo seckillConfigVo = new SeckillConfigVo(); SeckillConfigVo seckillConfigVo = new SeckillConfigVo();
seckillConfigVo.setIsCanbuy(false);
seckillConfigVo.setSeckillTimeIndex(seckillTimeIndex.get());
YxSystemGroupDataQueryCriteria queryCriteria = new YxSystemGroupDataQueryCriteria(); YxSystemGroupDataQueryCriteria queryCriteria = new YxSystemGroupDataQueryCriteria();
queryCriteria.setGroupName(ShopConstants.ZSW_SECKILL_TIME); queryCriteria.setGroupName(ShopConstants.ZSW_SECKILL_TIME);
queryCriteria.setStatus(1); queryCriteria.setStatus(1);
List<YxSystemGroupData> yxSystemGroupDataList = yxSystemGroupDataService.queryAll(queryCriteria); List<YxSystemGroupData> yxSystemGroupDataList = yxSystemGroupDataService.queryAll(queryCriteria);
List<SeckillTimeDto> list = new ArrayList<>(); List<SeckillTimeDto> list = new ArrayList<>();
AtomicInteger timeId = new AtomicInteger();
int today = OrderUtil.dateToTimestampT(DateUtil.beginOfDay(new Date())); int today = OrderUtil.dateToTimestampT(DateUtil.beginOfDay(new Date()));
yxSystemGroupDataList.forEach(i -> { yxSystemGroupDataList.forEach(i -> {
String jsonStr = i.getValue(); String jsonStr = i.getValue();
@ -144,7 +149,17 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
seckillTimeDto.setStatus(1); seckillTimeDto.setStatus(1);
seckillTimeDto.setRule(rule); seckillTimeDto.setRule(rule);
seckillTimeDto.setStop(today + activityEndHour * 3600); seckillTimeDto.setStop(today + activityEndHour * 3600);
seckillTimeIndex.set(yxSystemGroupDataList.indexOf(i)); // seckillTimeIndex.set(yxSystemGroupDataList.indexOf(i));
timeId.set(i.getId()); //存入抢购中的id,便于排序后进行索引
Long count=yxStoreSeckillService.lambdaQuery()
.eq(YxStoreSeckill::getStatus, ShopCommonEnum.IS_STATUS_1.getValue())
.le(YxStoreSeckill::getStartTime,new Date())
.ge(YxStoreSeckill::getStopTime,new Date())
.eq(YxStoreSeckill::getTimeId,seckillTimeDto.getId())
.count();
if (count>0){
seckillConfigVo.setIsCanbuy(true);
}
} else if (currentHour < time) { } else if (currentHour < time) {
seckillTimeDto.setState("即将开始"); seckillTimeDto.setState("即将开始");
seckillTimeDto.setTime(jsonObject.get("time").toString().length() > 1 ? jsonObject.get("time").toString() + ":00" : "0" + jsonObject.get("time").toString() + ":00"); seckillTimeDto.setTime(jsonObject.get("time").toString().length() > 1 ? jsonObject.get("time").toString() + ":00" : "0" + jsonObject.get("time").toString() + ":00");
@ -161,7 +176,12 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
} }
list.add(seckillTimeDto); list.add(seckillTimeDto);
}); });
seckillConfigVo.setSeckillTimeIndex(seckillTimeIndex.get()); list.sort(Comparator.comparing(SeckillTimeDto::getTime));
list.forEach(seckillTimeDto->{
if (seckillTimeDto.getId()==timeId.get()){
seckillConfigVo.setSeckillTimeIndex(list.indexOf(seckillTimeDto));
}
});
seckillConfigVo.setSeckillTime(list); seckillConfigVo.setSeckillTime(list);
return seckillConfigVo; return seckillConfigVo;
} }
@ -262,10 +282,33 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
Page<YxStoreSeckill> pageModel = new Page<>(page, limit); Page<YxStoreSeckill> pageModel = new Page<>(page, limit);
LambdaQueryWrapper<YxStoreSeckill> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<YxStoreSeckill> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(YxStoreSeckill::getStatus, ShopCommonEnum.IS_STATUS_1.getValue()) wrapper.eq(YxStoreSeckill::getStatus, ShopCommonEnum.IS_STATUS_1.getValue())
// .eq(YxStoreSeckill::getIsHot,1) // .eq(YxStoreSeckill::getIsHot,1)
.le(YxStoreSeckill::getStartTime,nowTime) .le(YxStoreSeckill::getStartTime,nowTime)
.ge(YxStoreSeckill::getStopTime,nowTime) .ge(YxStoreSeckill::getStopTime,nowTime)
.orderByDesc(YxStoreSeckill::getSort); .orderByDesc(YxStoreSeckill::getSort);
SeckillConfigVo seckillConfigVo=yxStoreSeckillService.getStoreSeckil();
if (seckillConfigVo.getSeckillTime().size()==0){
return null; //没有秒杀配置,不返回秒杀商品
}else if (seckillConfigVo.getSeckillTime().size()==1){ //只有1条不管是正在进行中还是未开始)
wrapper.eq(YxStoreSeckill::getTimeId,seckillConfigVo.getSeckillTime().get(0).getId());
}else{ //有多条
if (seckillConfigVo.getSeckillTimeIndex() != -1){ //不为-1,有进行中的
List<YxStoreSeckill> list=yxStoreSeckillService.lambdaQuery()
.eq(YxStoreSeckill::getStatus, ShopCommonEnum.IS_STATUS_1.getValue())
.le(YxStoreSeckill::getStartTime,nowTime)
.ge(YxStoreSeckill::getStopTime,nowTime)
.eq(YxStoreSeckill::getTimeId,seckillConfigVo.getSeckillTime().get(seckillConfigVo.getSeckillTimeIndex()).getId())
.list();
if (list.size()!=0){ //进行中的不为0
wrapper.eq(YxStoreSeckill::getStatus, ShopCommonEnum.IS_STATUS_1.getValue())
// .eq(YxStoreSeckill::getIsHot,1)
.le(YxStoreSeckill::getStartTime,nowTime)
.ge(YxStoreSeckill::getStopTime,nowTime)
.eq(YxStoreSeckill::getTimeId,seckillConfigVo.getSeckillTime().get(seckillConfigVo.getSeckillTimeIndex()).getId())
.orderByDesc(YxStoreSeckill::getSort);
}
}
}
List<YxStoreSeckillQueryVo> yxStoreSeckillQueryVos = generator.convert List<YxStoreSeckillQueryVo> yxStoreSeckillQueryVos = generator.convert
(yxStoreSeckillMapper.selectPage(pageModel,wrapper).getRecords(), (yxStoreSeckillMapper.selectPage(pageModel,wrapper).getRecords(),
YxStoreSeckillQueryVo.class); YxStoreSeckillQueryVo.class);

9
zsw-bxg/src/main/java/co/yixiang/modules/activity/vo/SeckillConfigVo.java

@ -5,10 +5,13 @@ import co.yixiang.modules.activity.service.dto.SeckillTimeDto;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
import java.util.List; import java.util.List;
@Data @Data
public class SeckillConfigVo { public class SeckillConfigVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "秒杀产品时间信息") @ApiModelProperty(value = "秒杀产品时间信息")
private List<SeckillTimeDto> seckillTime; private List<SeckillTimeDto> seckillTime;
@ -17,4 +20,8 @@ public class SeckillConfigVo {
@ApiModelProperty(value = "秒杀产品时间索引") @ApiModelProperty(value = "秒杀产品时间索引")
private Integer seckillTimeIndex; private Integer seckillTimeIndex;
@ApiModelProperty(value = "是否是进行中商品")
private Boolean isCanbuy; //1:true 0:false
} }

1
zsw-bxg/src/main/java/co/yixiang/modules/evaluation/domain/YxEvaluation.java

@ -48,7 +48,6 @@ public class YxEvaluation implements Serializable {
/** 关联商品信息 */ /** 关联商品信息 */
@NotNull
private String product; private String product;
/** 图文配置*/ /** 图文配置*/

4
zsw-bxg/src/main/java/co/yixiang/modules/order/domain/YxStoreOrder.java

@ -241,6 +241,10 @@ public class YxStoreOrder extends BaseDomain {
private Integer isSystemDel; private Integer isSystemDel;
/** 用户是否点击删除,删除后用户自己不可见 */
@TableField(fill= FieldFill.INSERT)
private Integer userDel;
@TableField(fill= FieldFill.INSERT) @TableField(fill= FieldFill.INSERT)
private Integer isDel; private Integer isDel;

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

@ -122,25 +122,17 @@ public class StoreOrderController {
Pageable pageable, Pageable pageable,
@RequestParam(name = "orderStatus") String orderStatus, @RequestParam(name = "orderStatus") String orderStatus,
@RequestParam(name = "orderType") String orderType) { @RequestParam(name = "orderType") String orderType) {
// String[] orderTypeList=orderType.split(","); //增加支持多选类型搜索
// Map<String,Object> result=new HashMap<>(); Map<String,Object> map;
// for (String type : orderTypeList) { String[] orderTypeList=orderType.split(",");
// YxStoreOrderQueryCriteria newCriteria = this.handleQuery(criteria,orderStatus,type); if(orderTypeList.length>1){//多选方法
// Map<String,Object> result1=yxStoreOrderService.queryAll(newCriteria, pageable); map=yxStoreOrderService.queryManyType(orderTypeList, pageable,criteria);
// if (result.isEmpty()){ }else {
// result.putAll(yxStoreOrderService.queryAll(newCriteria, pageable)); YxStoreOrderQueryCriteria newCriteria = this.handleQuery(criteria,orderStatus,orderType);
// }else { map=yxStoreOrderService.queryAll(newCriteria, pageable);
// List<YxStoreOrderDto> storeOrderDTOS= (List<YxStoreOrderDto>) result.get("content"); }
// Long totalElements=(Long)result.get("totalElements")+(Long)result1.get("totalElements"); return new ResponseEntity<>(map, HttpStatus.OK);
// storeOrderDTOS.addAll((List<YxStoreOrderDto>) result1.get("content")); }
// result.put("content",storeOrderDTOS);
// result.put("totalElements",totalElements);
// }
// }
YxStoreOrderQueryCriteria newCriteria = this.handleQuery(criteria,orderStatus,orderType);
return new ResponseEntity<>(yxStoreOrderService.queryAll(newCriteria, pageable), HttpStatus.OK);
// return new ResponseEntity<>(result,HttpStatus.OK);
}
@ApiOperation(value = "根据订单id获取订单详情") @ApiOperation(value = "根据订单id获取订单详情")
@GetMapping(value = "/getStoreOrderDetail/{id}") @GetMapping(value = "/getStoreOrderDetail/{id}")
@ -223,6 +215,15 @@ public class StoreOrderController {
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
} }
@ApiOperation(value = "通过审核,准备发货")
@PutMapping(value = "/ordercheck")
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
public ResponseEntity checkdate(@Validated @RequestBody YxStoreOrder resources) {
yxStoreOrderService.orderCheck(resources.getOrderId());
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@ApiOperation(value = "修改快递单号") @ApiOperation(value = "修改快递单号")
@PutMapping(value = "/yxStoreOrder/updateDelivery") @PutMapping(value = "/yxStoreOrder/updateDelivery")
@PreAuthorize("hasAnyAuthority('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')") @PreAuthorize("hasAnyAuthority('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
@ -393,17 +394,22 @@ public class StoreOrderController {
//订单状态查询 //订单状态查询
if (StrUtil.isNotEmpty(orderStatus)) { if (StrUtil.isNotEmpty(orderStatus)) {
switch (orderStatus) { switch (orderStatus) {
case "0": case "0": //未支付
criteria.setPaid(OrderInfoEnum.PAY_STATUS_0.getValue()); criteria.setPaid(OrderInfoEnum.PAY_STATUS_0.getValue());
criteria.setStatus(OrderInfoEnum.STATUS_0.getValue()); criteria.setStatus(OrderInfoEnum.STATUS_0.getValue());
criteria.setRefundStatus(OrderInfoEnum.REFUND_STATUS_0.getValue()); criteria.setRefundStatus(OrderInfoEnum.REFUND_STATUS_0.getValue());
break; break;
case "1": case "1": //未发货(待审核)
criteria.setPaid(OrderInfoEnum.PAY_STATUS_1.getValue()); criteria.setPaid(OrderInfoEnum.PAY_STATUS_1.getValue());
criteria.setStatus(OrderInfoEnum.STATUS_0.getValue()); criteria.setStatus(OrderInfoEnum.STATUS_0.getValue());
criteria.setRefundStatus(OrderInfoEnum.REFUND_STATUS_0.getValue()); criteria.setRefundStatus(OrderInfoEnum.REFUND_STATUS_0.getValue());
break; break;
case "2": case "5": //拣货中(通过审核,原未发货)
criteria.setPaid(OrderInfoEnum.PAY_STATUS_1.getValue());
criteria.setStatus(OrderInfoEnum.STATUS_5.getValue()); //审核通过后变成STATUS_5
criteria.setRefundStatus(OrderInfoEnum.REFUND_STATUS_0.getValue());
break;
case "2": //待收货
criteria.setPaid(OrderInfoEnum.PAY_STATUS_1.getValue()); criteria.setPaid(OrderInfoEnum.PAY_STATUS_1.getValue());
criteria.setStatus(OrderInfoEnum.STATUS_1.getValue()); criteria.setStatus(OrderInfoEnum.STATUS_1.getValue());
criteria.setRefundStatus(OrderInfoEnum.REFUND_STATUS_0.getValue()); criteria.setRefundStatus(OrderInfoEnum.REFUND_STATUS_0.getValue());
@ -435,24 +441,24 @@ public class StoreOrderController {
//订单类型查询 //订单类型查询
if (StrUtil.isNotEmpty(orderType)) { if (StrUtil.isNotEmpty(orderType)) {
switch (orderType) { switch (orderType) {
case "1": case "1": //普通
criteria.setBargainId(0); criteria.setBargainId(0);
criteria.setCombinationId(0); criteria.setCombinationId(0);
criteria.setSeckillId(0); criteria.setSeckillId(0);
break; break;
case "2": case "2": //拼团
criteria.setNewCombinationId(0); criteria.setNewCombinationId(0);
break; break;
case "3": case "3": //秒杀
criteria.setNewSeckillId(0); criteria.setNewSeckillId(0);
break; break;
case "4": case "4": //砍价
criteria.setNewBargainId(0); criteria.setNewBargainId(0);
break; break;
case "5": case "5": //核销
criteria.setShippingType(2); criteria.setShippingType(2);
break; break;
case "6": case "6": //积分
criteria.setPayIntegral(new BigDecimal("0.00")); criteria.setPayIntegral(new BigDecimal("0.00"));
break; break;
default: default:

19
zsw-bxg/src/main/java/co/yixiang/modules/order/service/YxStoreOrderService.java

@ -77,6 +77,12 @@ public interface YxStoreOrderService extends BaseService<YxStoreOrder>{
*/ */
void orderDelivery(String orderId,String deliveryId,String deliveryName,String deliveryType); void orderDelivery(String orderId,String deliveryId,String deliveryName,String deliveryType);
/**
* 订单审核
* @param orderId 单号
*/
void orderCheck(String orderId);
/** /**
* 修改快递单号 * 修改快递单号
* @param orderId 单号 * @param orderId 单号
@ -123,6 +129,12 @@ public interface YxStoreOrderService extends BaseService<YxStoreOrder>{
void cancelOrder(String orderId,Long uid); void cancelOrder(String orderId,Long uid);
/**
* 用户端删除订单
* @param orderId 订单号
* @param uid 用户id
*/
void deleteOrder(String orderId,Long uid);
/** /**
* 申请退款 * 申请退款
* @param explain 退款备注 * @param explain 退款备注
@ -239,6 +251,13 @@ public interface YxStoreOrderService extends BaseService<YxStoreOrder>{
/**
* 查询数据分页
* @param typeList 多种类型的数组
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryManyType(String[] typeList, Pageable pageable,YxStoreOrderQueryCriteria criteria);
/** /**
* 查询数据分页 * 查询数据分页

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

@ -84,6 +84,7 @@ import co.yixiang.tools.service.AlipayConfigService;
import co.yixiang.utils.FileUtil; import co.yixiang.utils.FileUtil;
import co.yixiang.utils.OrderUtil; import co.yixiang.utils.OrderUtil;
import co.yixiang.utils.RedisUtils; import co.yixiang.utils.RedisUtils;
import co.yixiang.utils.StringUtils;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -518,6 +519,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
storeOrder.setPinkId(Long.valueOf(param.getPinkId())); storeOrder.setPinkId(Long.valueOf(param.getPinkId()));
storeOrder.setSeckillId(seckillId); storeOrder.setSeckillId(seckillId);
storeOrder.setBargainId(bargainId); storeOrder.setBargainId(bargainId);
storeOrder.setUserDel(0); //用户可见
storeOrder.setCost(cacheDTO.getPriceGroup().getCostPrice()); storeOrder.setCost(cacheDTO.getPriceGroup().getCostPrice());
if (AppFromEnum.ROUNTINE.getValue().equals(param.getFrom())) { if (AppFromEnum.ROUNTINE.getValue().equals(param.getFrom())) {
storeOrder.setIsChannel(OrderInfoEnum.PAY_CHANNEL_1.getValue()); storeOrder.setIsChannel(OrderInfoEnum.PAY_CHANNEL_1.getValue());
@ -589,7 +591,6 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
// .build(); // .build();
// publisher.publishEvent(new TemplateEvent(this,templateBean)); // publisher.publishEvent(new TemplateEvent(this,templateBean));
return storeOrder; return storeOrder;
} }
@ -741,6 +742,21 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
} }
/**
* 订单审核
* @param orderId 订单号
*/
@Override
public void orderCheck(String orderId) {
if (StringUtils.isEmpty(orderId)) {
throw new YshopException("订单不存在");
}
YxStoreOrder storeOrder=yxStoreOrderService.lambdaQuery()
.eq(YxStoreOrder::getOrderId,orderId).one();
storeOrder.setStatus(OrderInfoEnum.STATUS_5.getValue());
yxStoreOrderService.update(storeOrder);
}
/** /**
* 订单发货 * 订单发货
@ -757,7 +773,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
throw new YshopException("订单不存在"); throw new YshopException("订单不存在");
} }
if (!OrderInfoEnum.STATUS_0.getValue().equals(orderQueryVo.getStatus()) || if (!OrderInfoEnum.STATUS_5.getValue().equals(orderQueryVo.getStatus()) ||
OrderInfoEnum.PAY_STATUS_0.getValue().equals(orderQueryVo.getPaid())) { OrderInfoEnum.PAY_STATUS_0.getValue().equals(orderQueryVo.getPaid())) {
throw new YshopException("订单状态错误"); throw new YshopException("订单状态错误");
} }
@ -908,6 +924,28 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
} }
/**
* 用户删除订单仅用户自己不可见
*
* @param orderId 订单号
* @param uid 用户id
*/
@Override
public void deleteOrder(String orderId, Long uid) {
YxStoreOrderQueryVo order = this.getOrderInfo(orderId, uid);
if (ObjectUtil.isNull(order)) {
throw new YshopException("订单不存在");
}
//更新订单状态
LambdaQueryWrapper<YxStoreOrder> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(YxStoreOrder::getOrderId, orderId);
YxStoreOrder storeOrder = new YxStoreOrder();
storeOrder.setUserDel(OrderStatusEnum.STATUS_1.getValue());//仅把user_del变为1
yxStoreOrderMapper.update(storeOrder, wrapper);
// yxStoreOrderMapper.deleteById(order.getId());
}
/** /**
* 未付款取消订单 * 未付款取消订单
* *
@ -1126,6 +1164,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
@Override @Override
public Map<String, Object> orderList(Long uid, int type, int page, int limit) { public Map<String, Object> orderList(Long uid, int type, int page, int limit) {
LambdaQueryWrapper<YxStoreOrder> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<YxStoreOrder> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(YxStoreOrder::getUserDel,0);//用户删除后则用户不可见
if (uid != null) { if (uid != null) {
wrapper.eq(YxStoreOrder::getUid, uid); wrapper.eq(YxStoreOrder::getUid, uid);
} }
@ -1401,8 +1440,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
if (uid != null) { if (uid != null) {
wrapperSeven.eq(YxStoreOrder::getUid, uid); wrapperSeven.eq(YxStoreOrder::getUid, uid);
} }
String[] strArr = {"1", "2"}; String[] strArr = {"0", "1"};
wrapperSeven.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()) wrapperSeven.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
.eq(YxStoreOrder::getCombinationId,0)
.in(YxStoreOrder::getRefundStatus, Arrays.asList(strArr)); .in(YxStoreOrder::getRefundStatus, Arrays.asList(strArr));
Long refundCount = yxStoreOrderMapper.selectCount(wrapperSeven); Long refundCount = yxStoreOrderMapper.selectCount(wrapperSeven);
@ -1707,6 +1747,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
} }
/** /**
* 奖励积分 * 奖励积分
* *
@ -2293,6 +2334,83 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
this.regressionCoupon(order, 1); this.regressionCoupon(order, 1);
} }
@Override
public Map<String, Object> queryManyType(String[] typeList, Pageable pageable,YxStoreOrderQueryCriteria criteria) {
LambdaQueryWrapper<YxStoreOrder> queryWrapper =new LambdaQueryWrapper<>();
if(StringUtils.isNotBlank(criteria.getOrderId())){
queryWrapper.and(wrapper->{
wrapper.like(YxStoreOrder::getOrderId,criteria.getOrderId());
});
// queryWrapper.like(YxStoreOrder::getOrderId,criteria.getOrderId());
}
if(StringUtils.isNotBlank(criteria.getUserPhone())){
queryWrapper.and(wrapper->{
wrapper.like(YxStoreOrder::getUserPhone,criteria.getUserPhone());
});
// queryWrapper.like(YxStoreOrder::getUserPhone,criteria.getUserPhone());
}
if(StringUtils.isNotBlank(criteria.getUserAddress())){
queryWrapper.like(YxStoreOrder::getUserAddress,criteria.getUserAddress());
}
for (String orderType:typeList){
switch (orderType) {
case "1": //普通
// criteria.setBargainId(0);
// criteria.setCombinationId(0);
// criteria.setSeckillId(0);
queryWrapper .or((wrapper)->{
wrapper.eq(YxStoreOrder::getBargainId,0)
.eq(YxStoreOrder::getCombinationId,0)
.eq(YxStoreOrder::getSeckillId,0);
});
break;
case "2": //拼团
// criteria.setNewCombinationId(0);
queryWrapper.or((wrapper)->{
wrapper.ne(YxStoreOrder::getCombinationId,0);
});
break;
case "3": //秒杀
// criteria.setNewSeckillId(0);
queryWrapper.or((wrapper)->{
wrapper.ne(YxStoreOrder::getSeckillId,0);
});
break;
case "4": //砍价
// criteria.setNewBargainId(0);
queryWrapper.or((wrapper)->{
wrapper.ne(YxStoreOrder::getBargainId,0);
});
break;
case "5": //核销
// criteria.setShippingType(2);
queryWrapper.or((wrapper)->{
wrapper.ne(YxStoreOrder::getShippingType,2);
});
break;
case "6": //积分
// criteria.setPayIntegral(new BigDecimal("0.00"));
queryWrapper.or((wrapper)->{
wrapper.gt(YxStoreOrder::getPayIntegral,new BigDecimal("0.00"));
});
break;
default:
}
}
getPage(pageable);
PageInfo<YxStoreOrder> page = new PageInfo<>(storeOrderMapper.selectList(queryWrapper));
List<YxStoreOrderDto> storeOrderDTOS = new ArrayList<>();
for (YxStoreOrder yxStoreOrder : page.getList()) {
this.orderList(storeOrderDTOS, yxStoreOrder);
}
Map<String, Object> map = new LinkedHashMap<>(2);
map.put("content", storeOrderDTOS);
map.put("totalElements", page.getTotal());
return map;
}
@Override @Override
public Map<String, Object> queryAll(YxStoreOrderQueryCriteria criteria, Pageable pageable) { public Map<String, Object> queryAll(YxStoreOrderQueryCriteria criteria, Pageable pageable) {
getPage(pageable); getPage(pageable);

7
zsw-bxg/src/main/java/co/yixiang/modules/product/domain/YxStoreProduct.java

@ -171,11 +171,18 @@ public class YxStoreProduct extends BaseDomain {
@ApiModelProperty(value = "是否猜你喜欢(0:否,1:是)") @ApiModelProperty(value = "是否猜你喜欢(0:否,1:是)")
private Integer isBenefit; private Integer isBenefit;
/** 猜你喜欢排序 */
@ApiModelProperty(value = "猜你喜欢排序")
private Integer benefitSort;
/** 是否精品 */ /** 是否精品 */
@ApiModelProperty(value = "是否精品(0:否,1:是)") @ApiModelProperty(value = "是否精品(0:否,1:是)")
private Integer isBest; private Integer isBest;
/** 精品排序 */
@ApiModelProperty(value = "精品排序")
private Integer bestSort;
/** 是否新品 */ /** 是否新品 */
@ApiModelProperty(value = "是否新品(0:否,1:是)") @ApiModelProperty(value = "是否新品(0:否,1:是)")

2
zsw-bxg/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java

@ -242,6 +242,8 @@ public class StoreProductController {
productDto.setIsHotList(yxStoreProduct.getIsHotList()); productDto.setIsHotList(yxStoreProduct.getIsHotList());
productDto.setHotListId(yxStoreProduct.getHotListId()); productDto.setHotListId(yxStoreProduct.getHotListId());
productDto.setHotSales(yxStoreProduct.getHotSales()); productDto.setHotSales(yxStoreProduct.getHotSales());
productDto.setBenefitSort(yxStoreProduct.getBenefitSort());
productDto.setBestSort(yxStoreProduct.getBestSort());
BeanUtil.copyProperties(yxStoreProduct,productDto,"sliderImage"); BeanUtil.copyProperties(yxStoreProduct,productDto,"sliderImage");
productDto.setSliderImage(Arrays.asList(yxStoreProduct.getSliderImage().split(","))); productDto.setSliderImage(Arrays.asList(yxStoreProduct.getSliderImage().split(",")));
YxStoreProductAttrResult storeProductAttrResult = yxStoreProductAttrResultService YxStoreProductAttrResult storeProductAttrResult = yxStoreProductAttrResultService

8
zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/ProductDto.java

@ -100,10 +100,18 @@ public class ProductDto {
@JsonProperty("is_benefit") @JsonProperty("is_benefit")
private Integer isBenefit; private Integer isBenefit;
/** 猜你喜欢排序 */
@JsonProperty(value = "benefit_sort")
private Integer benefitSort;
/** 是否精品 */ /** 是否精品 */
@JsonProperty("is_best") @JsonProperty("is_best")
private Integer isBest; private Integer isBest;
/** 精品排序 */
@JsonProperty(value = "best_sort")
private Integer bestSort;
/** 是否新品 */ /** 是否新品 */
@JsonProperty("is_new") @JsonProperty("is_new")
private Integer isNew; private Integer isNew;

8
zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/StoreProductDto.java

@ -106,10 +106,18 @@ public class StoreProductDto
@JsonProperty("is_benefit") @JsonProperty("is_benefit")
private Integer isBenefit; private Integer isBenefit;
/** 猜你喜欢排序 */
@JsonProperty(value = "benefit_sort")
private Integer benefitSort;
/** 是否精品 */ /** 是否精品 */
@JsonProperty("is_best") @JsonProperty("is_best")
private Integer isBest; private Integer isBest;
/** 精品排序 */
@JsonProperty(value = "best_sort")
private Integer bestSort;
/** 是否新品 */ /** 是否新品 */
@JsonProperty("is_new") @JsonProperty("is_new")
private Integer isNew; private Integer isNew;

27
zsw-bxg/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductServiceImpl.java

@ -459,32 +459,35 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
LambdaQueryWrapper<YxStoreProduct> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<YxStoreProduct> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue()) wrapper.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue())
.eq(YxStoreProduct::getIsDel,ShopCommonEnum.DELETE_0.getValue()) .eq(YxStoreProduct::getIsDel,ShopCommonEnum.DELETE_0.getValue());
.orderByDesc(YxStoreProduct::getSort); // .orderByDesc(YxStoreProduct::getSort);
wrapper.eq(YxStoreProduct::getIsIntegral,0); wrapper.eq(YxStoreProduct::getIsIntegral,0);
// order // order
switch (ProductEnum.toType(order)) { switch (ProductEnum.toType(order)) {
//精品推荐 //精品推荐
case TYPE_1: case TYPE_1:
wrapper.eq(YxStoreProduct::getIsBest, wrapper.eq(YxStoreProduct::getIsBest, ShopCommonEnum.IS_STATUS_1.getValue())
ShopCommonEnum.IS_STATUS_1.getValue()); .orderByDesc(YxStoreProduct::getBestSort);
break; break;
//首发新品 //首发新品
case TYPE_3: case TYPE_3:
wrapper.eq(YxStoreProduct::getIsNew, wrapper.eq(YxStoreProduct::getIsNew, ShopCommonEnum.IS_STATUS_1.getValue())
ShopCommonEnum.IS_STATUS_1.getValue()); .orderByDesc(YxStoreProduct::getSort);
break; break;
// 猜你喜欢 // 猜你喜欢
case TYPE_4: case TYPE_4:
wrapper.eq(YxStoreProduct::getIsBenefit, wrapper.eq(YxStoreProduct::getIsBenefit, ShopCommonEnum.IS_STATUS_1.getValue())
ShopCommonEnum.IS_STATUS_1.getValue()); .orderByDesc(YxStoreProduct::getBenefitSort);
break; break;
// 热门榜单 // 热门榜单
case TYPE_2: case TYPE_2:
wrapper.eq(YxStoreProduct::getIsHot, wrapper.eq(YxStoreProduct::getIsHot, ShopCommonEnum.IS_STATUS_1.getValue())
ShopCommonEnum.IS_STATUS_1.getValue()); .orderByDesc(YxStoreProduct::getSort);
break; break;
default: default:wrapper.orderByDesc(YxStoreProduct::getSort);
} }
Page<YxStoreProduct> pageModel = new Page<>(page, limit); Page<YxStoreProduct> pageModel = new Page<>(page, limit);
@ -631,6 +634,8 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
yxStoreProduct.setCost(BigDecimal.valueOf(resultDTO.getMinCost())); yxStoreProduct.setCost(BigDecimal.valueOf(resultDTO.getMinCost()));
yxStoreProduct.setIntegral(resultDTO.getMinIntegral()); yxStoreProduct.setIntegral(resultDTO.getMinIntegral());
yxStoreProduct.setStock(resultDTO.getStock()); yxStoreProduct.setStock(resultDTO.getStock());
yxStoreProduct.setBenefitSort(storeProductDto.getBenefitSort());
yxStoreProduct.setBestSort(storeProductDto.getBestSort());
yxStoreProduct.setSliderImage(String.join(",", storeProductDto.getSliderImage())); yxStoreProduct.setSliderImage(String.join(",", storeProductDto.getSliderImage()));
if (storeProductDto.getId() != null) { if (storeProductDto.getId() != null) {

4
zsw-bxg/src/main/java/co/yixiang/utils/OrderUtil.java

@ -209,7 +209,7 @@ public class OrderUtil {
* @return * @return
*/ */
public static int orderStatus(int paid, int status, int refund_status) { public static int orderStatus(int paid, int status, int refund_status) {
//todo 1-未付款 2-未发货 3-退款中 4-待收货 5-待评价 6-已完成 7-已退款 //todo 1-未付款 2-(已付款但未审核)未发货 3-退款中 4-待收货 5-待评价 6-已完成 7-已退款 8-审核通过未发货
int _status = 0; int _status = 0;
if (paid == 0 && status == 0 && refund_status == 0) { if (paid == 0 && status == 0 && refund_status == 0) {
@ -226,6 +226,8 @@ public class OrderUtil {
_status = 6; _status = 6;
} else if (paid == 1 && refund_status == 2) { } else if (paid == 1 && refund_status == 2) {
_status = 7; _status = 7;
}else if (paid == 1 && status == 5 && refund_status == 0){ //
_status = 8;
} }
return _status; return _status;

Loading…
Cancel
Save