| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.constant.OrderConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.GaoDeMapUtil; |
| | | import com.ruoyi.common.core.vo.AddressDto; |
| | | import com.ruoyi.common.core.vo.PaperInVo; |
| | | import com.ruoyi.common.core.vo.Path; |
| | | import com.ruoyi.order.entity.ChangeDispatch; |
| | | import com.ruoyi.order.entity.Order; |
| | |
| | | import com.ruoyi.order.request.UserOrderRequest; |
| | | import com.ruoyi.order.service.ChangeDispatchService; |
| | | import com.ruoyi.order.service.OrderService; |
| | | import com.ruoyi.order.vo.*; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import com.ruoyi.order.vo.MoneyQueryRequest; |
| | | import com.ruoyi.order.vo.OrderCountRequest; |
| | | import com.ruoyi.order.vo.OrderCountVO; |
| | | import com.ruoyi.order.vo.OrderPageCountVO; |
| | | import com.ruoyi.order.vo.OrderQueryRequest; |
| | | import com.ruoyi.order.vo.OrderQueryVO; |
| | | import com.ruoyi.order.vo.OrderResultVO; |
| | | import com.ruoyi.order.vo.WorkerOrderCountVO; |
| | | import com.ruoyi.order.vo.WorkerOrderRankVO; |
| | | import com.ruoyi.user.api.feignClient.UserClient; |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @Resource |
| | | private ChangeDispatchService changeDispatchService; |
| | | @Resource |
| | | private UserClient userClient; |
| | | |
| | | @Override |
| | | public OrderResultVO orderCountHome(OrderCountRequest orderCount) { |
| | |
| | | // 计算订单总额及总订单数量 |
| | | BigDecimal totalMoney; |
| | | int orderNumber; |
| | | int fakeNumber; |
| | | if (list.isEmpty()) { |
| | | totalMoney = BigDecimal.ZERO; |
| | | orderNumber = 0; |
| | | fakeNumber = 0; |
| | | } else { |
| | | totalMoney = list.stream().map(OrderQueryVO::getTotalPrice) |
| | | .filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | orderNumber = list.stream().filter(order -> order.getNumber() != null) |
| | | .mapToInt(OrderQueryVO::getNumber).sum(); |
| | | } |
| | | return new |
| | | fakeNumber = list.stream().filter(order -> order.getFakeCount() != null) |
| | | .mapToInt(OrderQueryVO::getFakeCount).sum(); |
| | | |
| | | OrderResultVO(totalMoney, orderNumber, list); |
| | | } |
| | | return new OrderResultVO(totalMoney, orderNumber, list,fakeNumber); |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public Boolean placeOrder(UserOrderRequest userOrderRequest) { |
| | | |
| | | R<AddressDto> cityCode = userClient.getCityCode(userOrderRequest.getAddressId()); |
| | | |
| | | // 下单参数 |
| | | String orderNumber = userOrderRequest.getOrderNumber(); |
| | | Integer serveId = userOrderRequest.getServeId(); |
| | |
| | | order.setUserId(userId); |
| | | order.setReservationName(reservationName); |
| | | order.setReservationPhone(reservationPhone); |
| | | order.setReservationAddress(address); |
| | | order.setReservationAddress(address+cityCode.getData().getName()); |
| | | order.setTime(time); |
| | | order.setReservationRemark(reservationRemark); |
| | | order.setOrderMoney(defaultPrice.add(new BigDecimal(String.valueOf(subsidy)))); |
| | |
| | | order.setIsWithdrawal(Constants.ZERO); |
| | | order.setSubsidy(subsidy); |
| | | order.setAddress(addressDetail); |
| | | order.setIsEvaluate(Constants.ZERO); |
| | | |
| | | order.setCity(cityCode.getData().getCity()); |
| | | order.setCityCode(cityCode.getData().getCityCode()); |
| | | return this.save(order); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public String orderEstimate(UserOrderRequest userOrderRequest) { |
| | | R<AddressDto> cityCode = userClient.getCityCode(userOrderRequest.getAddressId()); |
| | | R<BigDecimal> servePrice = userClient.getServePrice(userOrderRequest.getServeId(), cityCode.getData().getCityCode()); |
| | | if (servePrice.getData()!=null){ |
| | | userOrderRequest.setDefaultPrice(servePrice.getData()); |
| | | } |
| | | |
| | | |
| | | // 下单参数 |
| | | String orderNumber = userOrderRequest.getOrderNumber(); |
| | | Integer serveId = userOrderRequest.getServeId(); |
| | |
| | | order.setReservationName(reservationName); |
| | | order.setReservationPhone(reservationPhone); |
| | | if (null == userOrderRequest.getAddressId()) { |
| | | order.setReservationAddress(addressDetail); |
| | | order.setReservationAddress(cityCode.getData().getName()+address+cityCode.getData().getDetail()); |
| | | } else { |
| | | order.setReservationAddress(address); |
| | | order.setReservationAddress(address+cityCode.getData().getName()+cityCode.getData().getDetail()); |
| | | } |
| | | order.setTime(time); |
| | | order.setReservationRemark(reservationRemark); |
| | |
| | | order.setLatitude(latitude); |
| | | order.setIsWithdrawal(Constants.ZERO); |
| | | order.setSubsidy(subsidy); |
| | | order.setAddress(addressDetail); |
| | | order.setAddress(""); |
| | | order.setCity(cityCode.getData().getCity()); |
| | | order.setCityCode(cityCode.getData().getCityCode()); |
| | | this.save(order); |
| | | return String.valueOf(order.getId()); |
| | | } |
| | | |
| | | @Override |
| | | public List<PaperInVo> papercout(String workId,String date) { |
| | | return this.baseMapper.papercout(workId,date); |
| | | } |
| | | |
| | | /** |
| | |
| | | return Month.OCTOBER; |
| | | } |
| | | } |
| | | /** |
| | | * 增加发送短信次数 |
| | | * @param orderId 订单id |
| | | */ |
| | | @Override |
| | | public void messageCount(String orderId) { |
| | | Order byId = this.getById(orderId); |
| | | byId.setMsgCount(byId.getMsgCount()==null?1:byId.getMsgCount()+1); |
| | | this.updateById(byId); |
| | | } |
| | | } |