dev
parent
afb9e02b20
commit
ef56c68738
@ -0,0 +1,118 @@ |
|||||||
|
package com.order.controller.business; |
||||||
|
|
||||||
|
import com.github.pagehelper.PageInfo; |
||||||
|
import com.hfkj.common.security.SessionObject; |
||||||
|
import com.hfkj.common.security.UserCenter; |
||||||
|
import com.hfkj.common.utils.PageUtil; |
||||||
|
import com.hfkj.common.utils.ResponseMsgUtil; |
||||||
|
import com.hfkj.entity.BsOrderChild; |
||||||
|
import com.hfkj.entity.BsOrderStarbucks; |
||||||
|
import com.hfkj.model.ResponseData; |
||||||
|
import com.hfkj.model.SecUserSessionObject; |
||||||
|
import com.hfkj.model.order.OrderStarbucksModel; |
||||||
|
import com.hfkj.service.goods.BsOrderStarbucksService; |
||||||
|
import com.hfkj.service.order.BsOrderChildService; |
||||||
|
import com.hfkj.sysenum.SecUserObjectTypeEnum; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import org.slf4j.Logger; |
||||||
|
import org.slf4j.LoggerFactory; |
||||||
|
import org.springframework.beans.BeanUtils; |
||||||
|
import org.springframework.stereotype.Controller; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestMethod; |
||||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
@Controller |
||||||
|
@RequestMapping(value="/orderStarbucks") |
||||||
|
@Api(value="星巴克订单管理") |
||||||
|
public class BsOrderStarbucksController { |
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(BsOrderStarbucksController.class); |
||||||
|
|
||||||
|
@Resource |
||||||
|
private BsOrderChildService bsOrderChildService; |
||||||
|
|
||||||
|
@Resource |
||||||
|
private BsOrderStarbucksService bsOrderStarbucksService; |
||||||
|
|
||||||
|
@RequestMapping(value="/getListStarbucks",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "查询列表") |
||||||
|
public ResponseData getListStarbucks( |
||||||
|
@RequestParam(value = "orderNo" , required = false) String orderNo, |
||||||
|
@RequestParam(value = "childOrderNo" , required = false) String childOrderNo, |
||||||
|
@RequestParam(value = "userPhone" , required = false) String userPhone, |
||||||
|
@RequestParam(value = "productSpecName" , required = false) String productSpecName, |
||||||
|
@RequestParam(value = "storeAddress" , required = false) String storeAddress, |
||||||
|
@RequestParam(value = "storeName" , required = false) String storeName, |
||||||
|
@RequestParam(value = "productName" , required = false) String productName, |
||||||
|
@RequestParam(value = "payType" , required = false) Integer payType, |
||||||
|
@RequestParam(value = "status" , required = false) Integer status, |
||||||
|
@RequestParam(value = "createTimeS" , required = false) Long createTimeS, |
||||||
|
@RequestParam(value = "createTimeE" , required = false) Long createTimeE, |
||||||
|
@RequestParam(value = "pageNum" , required = true) Integer pageNum, |
||||||
|
@RequestParam(value = "pageSize" , required = true) Integer pageSize, HttpServletRequest request) { |
||||||
|
try { |
||||||
|
|
||||||
|
Map<String , Object> map = new HashMap<>(); |
||||||
|
map.put("orderNo", orderNo); |
||||||
|
map.put("childOrderNo", childOrderNo); |
||||||
|
map.put("productType", 4); |
||||||
|
map.put("productSpecName", productSpecName); |
||||||
|
map.put("productName", productName); |
||||||
|
map.put("createTimeS", createTimeS); |
||||||
|
map.put("createTimeE", createTimeE); |
||||||
|
map.put("status", status); |
||||||
|
|
||||||
|
List<BsOrderChild> list = bsOrderChildService.getList(map); |
||||||
|
List<BsOrderStarbucks> starbucksList = bsOrderStarbucksService.getList(new HashMap<>()); |
||||||
|
|
||||||
|
List<OrderStarbucksModel> starbucksModelList = new ArrayList<>(); |
||||||
|
|
||||||
|
for (BsOrderChild bsOrderChild : list) { |
||||||
|
OrderStarbucksModel starbucksModel = new OrderStarbucksModel(); |
||||||
|
BeanUtils.copyProperties(bsOrderChild, starbucksModel); |
||||||
|
|
||||||
|
List<BsOrderStarbucks> starbucks= starbucksList.stream().filter(s -> s.getOrderNo().equals(starbucksModel.getOrderNo())). |
||||||
|
collect(Collectors.toList()); |
||||||
|
if (!starbucks.isEmpty()) { |
||||||
|
starbucksModel.setStoreAddress(starbucks.get(0).getStoreAddress()); |
||||||
|
starbucksModel.setStoreName(starbucks.get(0).getStoreName()); |
||||||
|
starbucksModel.setUserPhone(starbucks.get(0).getUserPhone()); |
||||||
|
|
||||||
|
starbucksModelList.add(starbucksModel); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
if (storeAddress != null) { |
||||||
|
starbucksModelList = starbucksModelList.stream().filter(s -> s.getStoreAddress().contains(storeAddress)) // 使用contains方法进行模糊查询
|
||||||
|
.collect(Collectors.toList()); |
||||||
|
} |
||||||
|
if (storeName != null) { |
||||||
|
starbucksModelList = starbucksModelList.stream().filter(s -> s.getStoreName().contains(storeName)) // 使用contains方法进行模糊查询
|
||||||
|
.collect(Collectors.toList()); |
||||||
|
} |
||||||
|
if (userPhone != null) { |
||||||
|
starbucksModelList = starbucksModelList.stream().filter(s -> s.getUserPhone().contains(userPhone)) // 使用contains方法进行模糊查询
|
||||||
|
.collect(Collectors.toList()); |
||||||
|
} |
||||||
|
|
||||||
|
return ResponseMsgUtil.success(PageUtil.initPageInfoObj(pageNum, starbucksModelList.size(), pageSize, new PageInfo<>(starbucksModelList))); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
package com.hfkj.model.order; |
||||||
|
|
||||||
|
import com.hfkj.entity.BsOrderChild; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class OrderStarbucksModel extends BsOrderChild{ |
||||||
|
|
||||||
|
/** |
||||||
|
* 门店地址 |
||||||
|
*/ |
||||||
|
private String storeAddress; |
||||||
|
|
||||||
|
/** |
||||||
|
* 门店名称 |
||||||
|
*/ |
||||||
|
private String storeName; |
||||||
|
|
||||||
|
private String userPhone; |
||||||
|
} |
Loading…
Reference in new issue