package com.dsh.course.controller; import com.dsh.course.entity.PushOrder; import com.dsh.course.model.vo.PushOrderListReq; import com.dsh.course.model.vo.PushOrderListRes; import com.dsh.course.model.vo.PushOrderListWapper; import com.dsh.course.service.IPushOrderService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.ArrayList; import java.util.List; @RestController @RequestMapping("/pushOrder") public class PushOrderController { @Autowired private IPushOrderService pushOrderService; /** * 获取企业推单规则 * @param req * @return */ @PostMapping("/queryPushOrderList") public PushOrderListWapper queryPushOrderList(PushOrderListReq req){ try { List querys = pushOrderService.querys(req.getType(), req.getPushType(), req.getCompanyId()); List listRes = new ArrayList<>(); for (PushOrder query : querys) { PushOrderListRes res = new PushOrderListRes(); BeanUtils.copyProperties(query, res); listRes.add(res); } PushOrderListWapper listWapper = new PushOrderListWapper(); listWapper.setListRes(listRes); return listWapper; }catch (Exception e){ e.printStackTrace(); return null; } } }