|
|
|
@ -84,18 +84,19 @@ public class StoreOrderController {
|
|
|
|
|
this.yxStoreOrderStatusService = yxStoreOrderStatusService; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**@Valid |
|
|
|
|
* 根据商品分类统计订单占比 |
|
|
|
|
/** |
|
|
|
|
* @Valid 根据商品分类统计订单占比 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/yxStoreOrder/orderCount") |
|
|
|
|
@ApiOperation(value = "根据商品分类统计订单占比",notes = "根据商品分类统计订单占比",response = ExpressParam.class) |
|
|
|
|
public ResponseEntity orderCount(){ |
|
|
|
|
OrderCountDto orderCountDto = yxStoreOrderService.getOrderCount(); |
|
|
|
|
@ApiOperation(value = "根据商品分类统计订单占比", notes = "根据商品分类统计订单占比", response = ExpressParam.class) |
|
|
|
|
public ResponseEntity orderCount() { |
|
|
|
|
OrderCountDto orderCountDto = yxStoreOrderService.getOrderCount(); |
|
|
|
|
return new ResponseEntity<>(orderCountDto, HttpStatus.OK); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 首页订单/用户等统计 |
|
|
|
|
* |
|
|
|
|
* @return OrderTimeDataDto |
|
|
|
|
*/ |
|
|
|
|
@GetMapping(value = "/data/count") |
|
|
|
@ -106,6 +107,7 @@ public class StoreOrderController {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 返回本月订单金额与数量chart |
|
|
|
|
* |
|
|
|
|
* @return map |
|
|
|
|
*/ |
|
|
|
|
@GetMapping(value = "/data/chart") |
|
|
|
@ -118,21 +120,21 @@ public class StoreOrderController {
|
|
|
|
|
@ApiOperation(value = "查询订单") |
|
|
|
|
@GetMapping(value = "/yxStoreOrder") |
|
|
|
|
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_SELECT','YXEXPRESS_SELECT')") |
|
|
|
|
public ResponseEntity getYxStoreOrders(YxStoreOrderQueryCriteria criteria, |
|
|
|
|
Pageable pageable, |
|
|
|
|
@RequestParam(name = "orderStatus") String orderStatus, |
|
|
|
|
@RequestParam(name = "orderType") String orderType) { |
|
|
|
|
public ResponseEntity<AdminOrderDto> getYxStoreOrders(YxStoreOrderQueryCriteria criteria, |
|
|
|
|
Pageable pageable, |
|
|
|
|
@RequestParam(name = "orderStatus") String orderStatus, |
|
|
|
|
@RequestParam(name = "orderType") String orderType) { |
|
|
|
|
//增加支持多选类型搜索
|
|
|
|
|
Map<String,Object> map; |
|
|
|
|
String[] orderTypeList=orderType.split(","); |
|
|
|
|
if(orderTypeList.length>1){//多选方法
|
|
|
|
|
map=yxStoreOrderService.queryManyType(orderTypeList, pageable,criteria,orderStatus); |
|
|
|
|
}else { |
|
|
|
|
YxStoreOrderQueryCriteria newCriteria = this.handleQuery(criteria,orderStatus,orderType); |
|
|
|
|
map=yxStoreOrderService.queryAll(newCriteria, pageable); |
|
|
|
|
AdminOrderDto dto; |
|
|
|
|
String[] orderTypeList = orderType.split(","); |
|
|
|
|
if (orderTypeList.length > 1) {//多选方法
|
|
|
|
|
dto = yxStoreOrderService.queryManyType(orderTypeList, pageable, criteria, orderStatus); |
|
|
|
|
} else { |
|
|
|
|
YxStoreOrderQueryCriteria newCriteria = this.handleQuery(criteria, orderStatus, orderType); |
|
|
|
|
dto = yxStoreOrderService.queryAll(newCriteria, pageable); |
|
|
|
|
} |
|
|
|
|
return new ResponseEntity<>(map, HttpStatus.OK); |
|
|
|
|
} |
|
|
|
|
return new ResponseEntity<>(dto, HttpStatus.OK); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "根据订单id获取订单详情") |
|
|
|
|
@GetMapping(value = "/getStoreOrderDetail/{id}") |
|
|
|
@ -140,6 +142,7 @@ public class StoreOrderController {
|
|
|
|
|
public ResponseEntity getYxStoreOrders(@PathVariable Long id) { |
|
|
|
|
return new ResponseEntity<>(yxStoreOrderService.getOrderDetail(id), HttpStatus.OK); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "查询订单当前状态流程") |
|
|
|
|
@GetMapping(value = "/getNowOrderStatus/{id}") |
|
|
|
|
public ResponseEntity getNowOrderStatus(@PathVariable Long id) { |
|
|
|
@ -173,7 +176,7 @@ public class StoreOrderController {
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
statusList = new ArrayList<>(); |
|
|
|
|
statusList = new ArrayList<>(); |
|
|
|
|
statusList.add(OrderLogEnum.REFUND_ORDER_APPLY.getValue()); |
|
|
|
|
statusList.add(OrderLogEnum.REFUND_ORDER_SUCCESS.getValue()); |
|
|
|
|
orderStatusLogList = yxStoreOrderStatusService.list(new LambdaQueryWrapper<YxStoreOrderStatus>().eq(YxStoreOrderStatus::getOid, id).in(YxStoreOrderStatus::getChangeType, statusList).orderByDesc(YxStoreOrderStatus::getChangeTime)); |
|
|
|
@ -190,6 +193,7 @@ public class StoreOrderController {
|
|
|
|
|
|
|
|
|
|
return new ResponseEntity(yxOrderNowOrderStatusDto, HttpStatus.OK); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public List<YxStoreOrderStatusDto> getOrderStatusDto(List<YxStoreOrderStatus> orderStatusLogList) { |
|
|
|
|
List<YxStoreOrderStatusDto> dtoList = orderStatusLogList.stream().map(log -> { |
|
|
|
|
YxStoreOrderStatusDto dto = generator.convert(log, YxStoreOrderStatusDto.class); |
|
|
|
@ -199,6 +203,7 @@ public class StoreOrderController {
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
return dtoList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "发货") |
|
|
|
|
@PutMapping(value = "/yxStoreOrder") |
|
|
|
|
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')") |
|
|
|
@ -210,8 +215,8 @@ public class StoreOrderController {
|
|
|
|
|
throw new BadRequestException("快递单号不能为空"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
yxStoreOrderService.orderDelivery(resources.getOrderId(),resources.getDeliveryId(), |
|
|
|
|
resources.getDeliveryName(),resources.getDeliveryType()); |
|
|
|
|
yxStoreOrderService.orderDelivery(resources.getOrderId(), resources.getDeliveryId(), |
|
|
|
|
resources.getDeliveryName(), resources.getDeliveryType()); |
|
|
|
|
return new ResponseEntity(HttpStatus.NO_CONTENT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -232,7 +237,6 @@ public class StoreOrderController {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "修改快递单号") |
|
|
|
|
@PutMapping(value = "/yxStoreOrder/updateDelivery") |
|
|
|
|
@PreAuthorize("hasAnyAuthority('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')") |
|
|
|
@ -244,13 +248,12 @@ public class StoreOrderController {
|
|
|
|
|
throw new BadRequestException("快递单号不能为空"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
yxStoreOrderService.updateDelivery(resources.getOrderId(),resources.getDeliveryId(), |
|
|
|
|
resources.getDeliveryName(),resources.getDeliveryType()); |
|
|
|
|
yxStoreOrderService.updateDelivery(resources.getOrderId(), resources.getDeliveryId(), |
|
|
|
|
resources.getDeliveryName(), resources.getDeliveryType()); |
|
|
|
|
return new ResponseEntity(HttpStatus.NO_CONTENT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "订单核销") |
|
|
|
|
@PutMapping(value = "/yxStoreOrder/check") |
|
|
|
|
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')") |
|
|
|
@ -258,16 +261,16 @@ public class StoreOrderController {
|
|
|
|
|
if (StrUtil.isBlank(resources.getVerifyCode())) { |
|
|
|
|
throw new BadRequestException("核销码不能为空"); |
|
|
|
|
} |
|
|
|
|
YxStoreOrderDto storeOrderDTO = generator.convert(yxStoreOrderService.getById(resources.getId()),YxStoreOrderDto.class); |
|
|
|
|
if(!resources.getVerifyCode().equals(storeOrderDTO.getVerifyCode())){ |
|
|
|
|
YxStoreOrderDto storeOrderDTO = generator.convert(yxStoreOrderService.getById(resources.getId()), YxStoreOrderDto.class); |
|
|
|
|
if (!resources.getVerifyCode().equals(storeOrderDTO.getVerifyCode())) { |
|
|
|
|
throw new BadRequestException("核销码不对"); |
|
|
|
|
} |
|
|
|
|
if(OrderInfoEnum.PAY_STATUS_0.getValue().equals(storeOrderDTO.getPaid())){ |
|
|
|
|
if (OrderInfoEnum.PAY_STATUS_0.getValue().equals(storeOrderDTO.getPaid())) { |
|
|
|
|
throw new BadRequestException("订单未支付"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
yxStoreOrderService.verifyOrder(resources.getVerifyCode(), |
|
|
|
|
OrderInfoEnum.CONFIRM_STATUS_1.getValue(),null); |
|
|
|
|
OrderInfoEnum.CONFIRM_STATUS_1.getValue(), null); |
|
|
|
|
|
|
|
|
|
return new ResponseEntity(HttpStatus.NO_CONTENT); |
|
|
|
|
} |
|
|
|
@ -277,7 +280,7 @@ public class StoreOrderController {
|
|
|
|
|
@PostMapping(value = "/yxStoreOrder/refund") |
|
|
|
|
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')") |
|
|
|
|
public ResponseEntity refund(@Validated @RequestBody YxStoreOrder resources) { |
|
|
|
|
yxStoreOrderService.orderRefund(resources.getOrderId(),resources.getPayPrice(), |
|
|
|
|
yxStoreOrderService.orderRefund(resources.getOrderId(), resources.getPayPrice(), |
|
|
|
|
ShopCommonEnum.AGREE_1.getValue()); |
|
|
|
|
return new ResponseEntity(HttpStatus.NO_CONTENT); |
|
|
|
|
} |
|
|
|
@ -305,7 +308,7 @@ public class StoreOrderController {
|
|
|
|
|
if (resources.getPayPrice().doubleValue() < 0) { |
|
|
|
|
throw new BadRequestException("金额不能低于0"); |
|
|
|
|
} |
|
|
|
|
YxStoreOrderDto storeOrder = generator.convert(yxStoreOrderService.getById(resources.getId()),YxStoreOrderDto.class); |
|
|
|
|
YxStoreOrderDto storeOrder = generator.convert(yxStoreOrderService.getById(resources.getId()), YxStoreOrderDto.class); |
|
|
|
|
//判断金额是否有变动,生成一个额外订单号去支付
|
|
|
|
|
int res = NumberUtil.compare(storeOrder.getPayPrice().doubleValue(), resources.getPayPrice().doubleValue()); |
|
|
|
|
if (res != 0) { |
|
|
|
@ -315,7 +318,7 @@ public class StoreOrderController {
|
|
|
|
|
|
|
|
|
|
yxStoreOrderService.saveOrUpdate(resources); |
|
|
|
|
|
|
|
|
|
yxStoreOrderStatusService.create(resources.getId(),OrderLogEnum.ORDER_EDIT.getValue(), |
|
|
|
|
yxStoreOrderStatusService.create(resources.getId(), OrderLogEnum.ORDER_EDIT.getValue(), |
|
|
|
|
"修改订单价格为:" + resources.getPayPrice()); |
|
|
|
|
return new ResponseEntity(HttpStatus.OK); |
|
|
|
|
} |
|
|
|
@ -338,8 +341,8 @@ public class StoreOrderController {
|
|
|
|
|
* 快递查询 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/yxStoreOrder/express") |
|
|
|
|
@ApiOperation(value = "获取物流信息",notes = "获取物流信息",response = ExpressParam.class) |
|
|
|
|
public ResponseEntity express( @RequestBody ExpressParam expressInfoDo){ |
|
|
|
|
@ApiOperation(value = "获取物流信息", notes = "获取物流信息", response = ExpressParam.class) |
|
|
|
|
public ResponseEntity express(@RequestBody ExpressParam expressInfoDo) { |
|
|
|
|
|
|
|
|
|
ExpressInfo expressInfo = expressService.getExpressInfo(expressInfoDo.getOrderCode(), |
|
|
|
|
expressInfoDo.getShipperCode(), expressInfoDo.getLogisticCode()); |
|
|
|
@ -361,43 +364,44 @@ public class StoreOrderController {
|
|
|
|
|
@RequestParam(name = "orderType") String orderType, |
|
|
|
|
@RequestParam(name = "listContent") String listContent) throws IOException, ParseException { |
|
|
|
|
List<YxStoreOrderDto> list; |
|
|
|
|
if(StringUtils.isEmpty(listContent)){ |
|
|
|
|
list = (List)getYxStoreList(criteria, pageable, orderStatus, orderType).get("content"); |
|
|
|
|
}else { |
|
|
|
|
if (StringUtils.isEmpty(listContent)) { |
|
|
|
|
list = getYxStoreList(criteria, pageable, orderStatus, orderType).getContent(); |
|
|
|
|
} else { |
|
|
|
|
List<String> idList = JSONArray.parseArray(listContent).toJavaList(String.class); |
|
|
|
|
list = (List)yxStoreOrderService.queryAll(idList).get("content"); |
|
|
|
|
list = yxStoreOrderService.queryAll(idList).getContent(); |
|
|
|
|
} |
|
|
|
|
yxStoreOrderService.download(list, response); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 下载数据 |
|
|
|
|
* @param criteria criteria |
|
|
|
|
* @param pageable pageable |
|
|
|
|
* |
|
|
|
|
* @param criteria criteria |
|
|
|
|
* @param pageable pageable |
|
|
|
|
* @param orderStatus orderStatus |
|
|
|
|
* @param orderType orderType |
|
|
|
|
* @param orderType orderType |
|
|
|
|
* @return Map |
|
|
|
|
*/ |
|
|
|
|
private Map<String,Object> getYxStoreList(YxStoreOrderQueryCriteria criteria, |
|
|
|
|
Pageable pageable, |
|
|
|
|
String orderStatus, |
|
|
|
|
String orderType){ |
|
|
|
|
private AdminOrderDto getYxStoreList(YxStoreOrderQueryCriteria criteria, |
|
|
|
|
Pageable pageable, |
|
|
|
|
String orderStatus, |
|
|
|
|
String orderType) { |
|
|
|
|
|
|
|
|
|
YxStoreOrderQueryCriteria newCriteria = this.handleQuery(criteria,orderStatus,orderType); |
|
|
|
|
YxStoreOrderQueryCriteria newCriteria = this.handleQuery(criteria, orderStatus, orderType); |
|
|
|
|
return yxStoreOrderService.queryAll(newCriteria, pageable); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 处理订单查询 |
|
|
|
|
* @param criteria YxStoreOrderQueryCriteria |
|
|
|
|
* |
|
|
|
|
* @param criteria YxStoreOrderQueryCriteria |
|
|
|
|
* @param orderStatus 订单状态 |
|
|
|
|
* @param orderType 订单类型 |
|
|
|
|
* @param orderType 订单类型 |
|
|
|
|
* @return YxStoreOrderQueryCriteria |
|
|
|
|
*/ |
|
|
|
|
private YxStoreOrderQueryCriteria handleQuery(YxStoreOrderQueryCriteria criteria,String orderStatus, |
|
|
|
|
String orderType){ |
|
|
|
|
private YxStoreOrderQueryCriteria handleQuery(YxStoreOrderQueryCriteria criteria, String orderStatus, |
|
|
|
|
String orderType) { |
|
|
|
|
|
|
|
|
|
//默认查询所有快递订单
|
|
|
|
|
// criteria.setShippingType(OrderInfoEnum.SHIPPIING_TYPE_1.getValue());
|
|
|
|
@ -450,29 +454,29 @@ public class StoreOrderController {
|
|
|
|
|
} |
|
|
|
|
//订单类型查询
|
|
|
|
|
if (StrUtil.isNotEmpty(orderType)) { |
|
|
|
|
switch (orderType) { |
|
|
|
|
case "1": //普通
|
|
|
|
|
criteria.setBargainId(0); |
|
|
|
|
criteria.setCombinationId(0); |
|
|
|
|
criteria.setSeckillId(0); |
|
|
|
|
break; |
|
|
|
|
case "2": //拼团
|
|
|
|
|
criteria.setNewCombinationId(0); |
|
|
|
|
break; |
|
|
|
|
case "3": //秒杀
|
|
|
|
|
criteria.setNewSeckillId(0); |
|
|
|
|
break; |
|
|
|
|
case "4": //砍价
|
|
|
|
|
criteria.setNewBargainId(0); |
|
|
|
|
break; |
|
|
|
|
case "5": //核销
|
|
|
|
|
criteria.setShippingType(2); |
|
|
|
|
break; |
|
|
|
|
case "6": //积分
|
|
|
|
|
criteria.setPayIntegral(new BigDecimal("0.00")); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
} |
|
|
|
|
switch (orderType) { |
|
|
|
|
case "1": //普通
|
|
|
|
|
criteria.setBargainId(0); |
|
|
|
|
criteria.setCombinationId(0); |
|
|
|
|
criteria.setSeckillId(0); |
|
|
|
|
break; |
|
|
|
|
case "2": //拼团
|
|
|
|
|
criteria.setNewCombinationId(0); |
|
|
|
|
break; |
|
|
|
|
case "3": //秒杀
|
|
|
|
|
criteria.setNewSeckillId(0); |
|
|
|
|
break; |
|
|
|
|
case "4": //砍价
|
|
|
|
|
criteria.setNewBargainId(0); |
|
|
|
|
break; |
|
|
|
|
case "5": //核销
|
|
|
|
|
criteria.setShippingType(2); |
|
|
|
|
break; |
|
|
|
|
case "6": //积分
|
|
|
|
|
criteria.setPayIntegral(new BigDecimal("0.00")); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -480,5 +484,4 @@ public class StoreOrderController {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|