| | |
| | | import com.github.xiaoymin.knife4j.core.util.CollectionUtils; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | } |
| | | return urls; |
| | | } |
| | | private List<Multifile> getFileUrlsByidList(List<Integer> orderId, int objType, String prefix) { |
| | | if(orderId ==null || orderId.size()==0){ |
| | | return null; |
| | | } |
| | | List<Multifile> files = multifileMapper.selectList( |
| | | new QueryWrapper<Multifile>().lambda() |
| | | .in(Multifile::getObjId, orderId) |
| | | .eq(Multifile::getObjType, objType) |
| | | .eq(Multifile::getIsdeleted, Constants.ZERO) |
| | | .orderByAsc(Multifile::getSortnum)); |
| | | if (files != null) { |
| | | for (Multifile f : files) { |
| | | if (StringUtils.isNotBlank(f.getFileurl())) { |
| | | f.setFileurl(prefix + f.getFileurl()); |
| | | } |
| | | } |
| | | } |
| | | return files; |
| | | } |
| | | |
| | | /** |
| | | * 计算并设置订单薪酬分配(司机、存件门店、取件门店) |
| | |
| | | |
| | | IPage<Orders> orderPage = ordersMapper.selectJoinPage(p, Orders.class, wrapper); |
| | | List<MyOrderVO> voList = new ArrayList<>(); |
| | | if (orderPage != null && orderPage.getRecords() != null) { |
| | | |
| | | if (orderPage != null && orderPage.getRecords() != null && orderPage.getRecords().size()>0) { |
| | | String imgPrefix = getOrdersPrefix(); |
| | | List<Integer> idList =new ArrayList<>(); |
| | | for (Orders o : orderPage.getRecords()) { |
| | | idList.add(o.getId()); |
| | | } |
| | | List<Multifile> files = getFileUrlsByidList(idList,Constants.FileType.ORDER_FILE.getKey(), imgPrefix); |
| | | for (Orders o : orderPage.getRecords()) { |
| | | MyOrderVO vo = new MyOrderVO(); |
| | | vo.setId(o.getId()); |
| | |
| | | |
| | | // 评价状态 |
| | | vo.setCommentStatus(o.getCommentStatus()); |
| | | //序号 |
| | | vo.setSortnum(Constants.formatIntegerNum(o.getDepositShopId())+"-"+o.getId()); |
| | | if(o.getTakeShopId()!=null){ |
| | | vo.setSortnumTake(Constants.formatIntegerNum(o.getTakeShopId())+"-"+o.getId()); |
| | | } |
| | | |
| | | // 查询物品明细(一次查询,同时用于物品列表和逾期计算) |
| | | List<OrdersDetail> details = ordersDetailMapper.selectList( |
| | | new QueryWrapper<OrdersDetail>().lambda() |
| | | .eq(OrdersDetail::getOrderId, o.getId()) |
| | | .eq(OrdersDetail::getDeleted, Constants.ZERO)); |
| | | |
| | | // 物品明细 |
| | | vo.setDetailList(buildDetailList(details)); |
| | | |
| | | vo.setOrderImages(getFileUrlsFromList(o.getId(),files)); |
| | | // 逾期状态 |
| | | fillOverdueStatus(vo, o, details); |
| | | voList.add(vo); |
| | |
| | | pageData.setPage(orderPage.getCurrent()); |
| | | pageData.setCapacity(orderPage.getSize()); |
| | | return pageData; |
| | | } |
| | | |
| | | private List<String> getFileUrlsFromList(Integer id, List<Multifile> files) { |
| | | List<String> urls = new ArrayList<>(); |
| | | try { |
| | | if(files!=null){ |
| | | for(Multifile f : files){ |
| | | if(Constants.equalsInteger(f.getObjId(),id)){ |
| | | urls.add(f.getFileurl()); |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | } |
| | | |
| | | return urls; |
| | | } |
| | | |
| | | @Override |
| | |
| | | .eq(OrdersDetail::getDeleted, Constants.ZERO)); |
| | | |
| | | vo.setDetailList(buildDetailList(details)); |
| | | |
| | | |
| | | // 逾期状态 |
| | | fillOverdueStatus(vo, o, details); |
| | | |
| | |
| | | if (Constants.equalsInteger(order.getStatus(), Constants.OrderStatus.waitPay.getStatus())) { |
| | | vo.setPayCountdownMs(calcPayCountdownMs(order)); |
| | | } |
| | | |
| | | //序号 |
| | | vo.setSortnum(Constants.formatIntegerNum(order.getDepositShopId())+"-"+order.getId()); |
| | | if(order.getTakeShopId()!=null){ |
| | | vo.setSortnumTake(Constants.formatIntegerNum(order.getTakeShopId())+"-"+order.getId()); |
| | | } |
| | | // 存件门店 |
| | | if (order.getDepositShopId() != null) { |
| | | ShopInfo depositShop = shopInfoMapper.selectById(order.getDepositShopId()); |
| | |
| | | if (!Constants.equalsInteger(orders.getDepositShopId(), shopId)) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "当前门店不是该订单的存件门店"); |
| | | } |
| | | if (orders.getStatus() < 2 || orders.getStatus() > 5) { |
| | | if (orders.getStatus() < 1 || orders.getStatus() > 7) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "当前订单状态不允许打印"); |
| | | } |
| | | ShopInfo shop = shopInfoMapper.selectById(shopId); |
| | |
| | | userInfo += "(" + phone.substring(phone.length() - 4) + ")"; |
| | | } |
| | | } |
| | | String content = printService.getPrintContent(shop.getName(), detailList, userInfo, orders.getCode(), orders.getRemark(), |
| | | |
| | | //序号 |
| | | String sort = Constants.formatIntegerNum(shopId)+"-"+orders.getId(); |
| | | // String content = printService.getPrintContent(shop.getName(), detailList, userInfo, orders.getCode(), orders.getRemark(), |
| | | String content = printService.getPrintContent(shop.getName(), detailList, userInfo, orders.getCode(), sort, |
| | | orders.getTakeLocationRemark(), |
| | | orders.getPayTime() != null ? new SimpleDateFormat("yyyy-MM-dd HH:mm").format(orders.getPayTime()) : "", |
| | | orders.getExpectedTakeTime() != null ? new SimpleDateFormat("yyyy-MM-dd HH:mm").format(orders.getExpectedTakeTime()) : ""); |