Commit a9af589c authored by hanfeng's avatar hanfeng

修改租车订单

parent f8255d8b
...@@ -4,6 +4,7 @@ import com.github.wxiaoqi.security.admin.dto.UserInfoDTO; ...@@ -4,6 +4,7 @@ import com.github.wxiaoqi.security.admin.dto.UserInfoDTO;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.activity.dto.ActivityListDTO; import com.xxfc.platform.activity.dto.ActivityListDTO;
import com.xxfc.platform.activity.dto.ActivityPopularizeRelationDTO; import com.xxfc.platform.activity.dto.ActivityPopularizeRelationDTO;
import com.xxfc.platform.activity.entity.Coupon;
import com.xxfc.platform.activity.entity.IntegralUserTotal; import com.xxfc.platform.activity.entity.IntegralUserTotal;
import com.xxfc.platform.activity.vo.UserCouponVo; import com.xxfc.platform.activity.vo.UserCouponVo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -12,7 +13,9 @@ import org.springframework.cloud.openfeign.FeignClient; ...@@ -12,7 +13,9 @@ import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
...@@ -73,4 +76,9 @@ public interface ActivityFeign { ...@@ -73,4 +76,9 @@ public interface ActivityFeign {
@ApiOperation("查询活动的时间") @ApiOperation("查询活动的时间")
@GetMapping("/activityList/time/{activityId}") @GetMapping("/activityList/time/{activityId}")
ActivityListDTO findActivityStartTimeAndEndTimeById(@PathVariable(value = "activityId") Integer activityId); ActivityListDTO findActivityStartTimeAndEndTimeById(@PathVariable(value = "activityId") Integer activityId);
@ApiOperation("获取所用优惠卷")
@GetMapping("/coupon/coupons")
Map<Integer, Coupon> coupons();
} }
...@@ -2,6 +2,8 @@ package com.xxfc.platform.activity.biz; ...@@ -2,6 +2,8 @@ package com.xxfc.platform.activity.biz;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO; import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.xxfc.platform.activity.constant.CouponUsed; import com.xxfc.platform.activity.constant.CouponUsed;
import com.xxfc.platform.activity.dto.CouponDTO; import com.xxfc.platform.activity.dto.CouponDTO;
import com.xxfc.platform.activity.dto.CouponFindDTO; import com.xxfc.platform.activity.dto.CouponFindDTO;
...@@ -17,10 +19,9 @@ import org.springframework.util.CollectionUtils; ...@@ -17,10 +19,9 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import java.math.BigDecimal;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Objects;
/** /**
* 优惠券表 * 优惠券表
...@@ -122,4 +123,9 @@ public class CouponBiz extends BaseBiz<CouponMapper, Coupon> { ...@@ -122,4 +123,9 @@ public class CouponBiz extends BaseBiz<CouponMapper, Coupon> {
public List<CouponTitleVo> getCouponTitleList() { public List<CouponTitleVo> getCouponTitleList() {
return mapper.selectTitles(); return mapper.selectTitles();
} }
public Map<Integer, Coupon> getCoupons() {
Map<Integer, Coupon> coupons = mapper.getCoupons();
return coupons ;
}
} }
\ No newline at end of file
...@@ -4,7 +4,9 @@ import com.xxfc.platform.activity.entity.Coupon; ...@@ -4,7 +4,9 @@ import com.xxfc.platform.activity.entity.Coupon;
import com.xxfc.platform.activity.vo.CouponTitleVo; import com.xxfc.platform.activity.vo.CouponTitleVo;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 优惠券表 * 优惠券表
...@@ -16,4 +18,8 @@ import java.util.List; ...@@ -16,4 +18,8 @@ import java.util.List;
public interface CouponMapper extends Mapper<Coupon> { public interface CouponMapper extends Mapper<Coupon> {
List<CouponTitleVo> selectTitles(); List<CouponTitleVo> selectTitles();
Map<Integer, Coupon> getCoupons();
} }
...@@ -3,13 +3,22 @@ package com.xxfc.platform.activity.rest; ...@@ -3,13 +3,22 @@ package com.xxfc.platform.activity.rest;
import com.github.wxiaoqi.security.common.rest.BaseController; import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.activity.biz.CouponBiz; import com.xxfc.platform.activity.biz.CouponBiz;
import com.xxfc.platform.activity.entity.Coupon; import com.xxfc.platform.activity.entity.Coupon;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@RestController @RestController
@RequestMapping("coupon") @RequestMapping("coupon")
public class CouponController extends BaseController<CouponBiz, Coupon> { public class CouponController extends BaseController<CouponBiz, Coupon> {
@ApiOperation("获取所用优惠卷")
@RequestMapping("/coupons")
public Map<Integer, Coupon> coupons() {
return baseBiz.getCoupons();
}
} }
\ No newline at end of file
...@@ -40,4 +40,10 @@ ...@@ -40,4 +40,10 @@
<select id="selectTitles" resultType="com.xxfc.platform.activity.vo.CouponTitleVo"> <select id="selectTitles" resultType="com.xxfc.platform.activity.vo.CouponTitleVo">
select `id`,`title` from `coupon` where `is_del`=0 select `id`,`title` from `coupon` where `is_del`=0
</select> </select>
<select id="getCoupons" resultType="com.xxfc.platform.activity.entity.Coupon" >
select id ,title,used_amount from coupon
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -293,4 +293,19 @@ public class BaseOrder implements Serializable { ...@@ -293,4 +293,19 @@ public class BaseOrder implements Serializable {
@ApiModelProperty(value = "促成人联系方式") @ApiModelProperty(value = "促成人联系方式")
@Column(name = "facilitate_phone") @Column(name = "facilitate_phone")
String facilitatePhone; String facilitatePhone;
/**
* 1:微信公众号支付 2.支付宝即时到账,3,银联
*/
@ApiModelProperty(value = "1:微信公众号支付 2.支付宝即时到账,3,银联")
@Column(name = "pay_way")
private Integer payWay;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
@Column(name = "remark")
private Integer remark;
} }
package com.xxfc.platform.order.pojo.order; package com.xxfc.platform.order.pojo.order;
import com.xxfc.platform.activity.entity.Coupon;
import com.xxfc.platform.order.entity.*; import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.pojo.OrderAccompanyDTO;
import com.xxfc.platform.vehicle.entity.VehicleUserLicense; import com.xxfc.platform.vehicle.entity.VehicleUserLicense;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Data @Data
...@@ -52,5 +55,13 @@ public class OrderListVo extends BaseOrder { ...@@ -52,5 +55,13 @@ public class OrderListVo extends BaseOrder {
@ApiModelProperty(value = "用户会员名称") @ApiModelProperty(value = "用户会员名称")
private String memberName; private String memberName;
@ApiModelProperty(value = "随车物品")
private String carArticlesJson;
@ApiModelProperty(value = "使用优惠卷")
ArrayList<Coupon> couponList ;
@ApiModelProperty(value = "退还优惠卷")
ArrayList<Coupon> backCouponList;
} }
...@@ -3,7 +3,7 @@ package com.xxfc.platform.order.rest; ...@@ -3,7 +3,7 @@ package com.xxfc.platform.order.rest;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.druid.sql.visitor.functions.If; import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin; import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO; import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
...@@ -18,6 +18,9 @@ import com.github.wxiaoqi.security.common.rest.CommonBaseController; ...@@ -18,6 +18,9 @@ import com.github.wxiaoqi.security.common.rest.CommonBaseController;
import com.github.wxiaoqi.security.common.util.Query; import com.github.wxiaoqi.security.common.util.Query;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.google.common.collect.Lists;
import com.xxfc.platform.activity.entity.Coupon;
import com.xxfc.platform.activity.feign.ActivityFeign;
import com.xxfc.platform.order.biz.BaseOrderBiz; import com.xxfc.platform.order.biz.BaseOrderBiz;
import com.xxfc.platform.order.biz.OrderItemBiz; import com.xxfc.platform.order.biz.OrderItemBiz;
import com.xxfc.platform.order.biz.OrderRentVehicleBiz; import com.xxfc.platform.order.biz.OrderRentVehicleBiz;
...@@ -42,11 +45,13 @@ import io.swagger.annotations.Api; ...@@ -42,11 +45,13 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.Data; import lombok.Data;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.mockito.internal.util.collections.Sets; import org.mockito.internal.util.collections.Sets;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import tk.mybatis.mapper.entity.Example;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.Instant; import java.time.Instant;
...@@ -83,12 +88,16 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -83,12 +88,16 @@ public class BackStageOrderController extends CommonBaseController implements Us
@Autowired @Autowired
UserFeign userFeign; UserFeign userFeign;
@Autowired
ActivityFeign activityFeign;
@Autowired @Autowired
TourFeign tourFeign; TourFeign tourFeign;
@Resource @Resource
VehicleFeign vehicleFeign; VehicleFeign vehicleFeign;
@Override @Override
public UserFeign getUserFeign() { public UserFeign getUserFeign() {
return userFeign; return userFeign;
...@@ -105,12 +114,12 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -105,12 +114,12 @@ public class BackStageOrderController extends CommonBaseController implements Us
dto.setEndTime(new Date().getTime()); dto.setEndTime(new Date().getTime());
} }
} }
if (StringUtils.isNotBlank(dto.getPhone())||StringUtils.isNotBlank(dto.getRealName())) { if (StringUtils.isNotBlank(dto.getPhone()) || StringUtils.isNotBlank(dto.getRealName())) {
List<AppUserLogin> appUserLoins = userFeign.getOne(dto.getPhone(),dto.getRealName()); List<AppUserLogin> appUserLoins = userFeign.getOne(dto.getPhone(), dto.getRealName());
if (CollectionUtil.isNotEmpty(appUserLoins)) { if (CollectionUtil.isNotEmpty(appUserLoins)) {
List<Integer> collect = appUserLoins.parallelStream().map(AppUserLogin::getId).collect(Collectors.toList()); List<Integer> collect = appUserLoins.parallelStream().map(AppUserLogin::getId).collect(Collectors.toList());
dto.setUserIds(collect); dto.setUserIds(collect);
}else { } else {
return ObjectRestResponse.succ(new PageDataVO<>()); return ObjectRestResponse.succ(new PageDataVO<>());
} }
} }
...@@ -120,35 +129,36 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -120,35 +129,36 @@ public class BackStageOrderController extends CommonBaseController implements Us
if (userDTO == null) { if (userDTO == null) {
return ObjectRestResponse.succ(new PageDataVO<>()); return ObjectRestResponse.succ(new PageDataVO<>());
} }
if(dto.getType() != null && dto.getType() != 3) { if (dto.getType() != null && dto.getType() != 3) {
List<BranchCompany> branchCompanies = vehicleFeign.companyAll(userDTO.getDataAll(), userDTO.getDataCompany(), userDTO.getDataZone()); List<BranchCompany> branchCompanies = vehicleFeign.companyAll(userDTO.getDataAll(), userDTO.getDataCompany(), userDTO.getDataZone());
List<Integer> companyIds = branchCompanies.stream().map(BranchCompany::getId).collect(Collectors.toList()); List<Integer> companyIds = branchCompanies.stream().map(BranchCompany::getId).collect(Collectors.toList());
dto.setCompanyIds(companyIds); dto.setCompanyIds(companyIds);
} }
if (dto.getZoneId()!=null){ if (dto.getZoneId() != null) {
if (userDTO.getDataAll()!=1&&!dto.getZoneId().equals(userDTO.getZoneId())) { if (userDTO.getDataAll() != 1 && !dto.getZoneId().equals(userDTO.getZoneId())) {
return ObjectRestResponse.succ(new PageDataVO<>()); return ObjectRestResponse.succ(new PageDataVO<>());
}else { } else {
ArrayList<Integer> zoneIds = new ArrayList<>(); ArrayList<Integer> zoneIds = new ArrayList<>();
zoneIds.add(dto.getZoneId()); zoneIds.add(dto.getZoneId());
dto.setZoneIds(zoneIds); dto.setZoneIds(zoneIds);
} }
} }
if (dto.getStartCompanyId()!=null){ if (dto.getStartCompanyId() != null) {
if (userDTO.getDataAll()!=1&&!dto.getStartCompanyId().equals(userDTO.getId())) { if (userDTO.getDataAll() != 1 && !dto.getStartCompanyId().equals(userDTO.getId())) {
return ObjectRestResponse.succ(new PageDataVO<>()); return ObjectRestResponse.succ(new PageDataVO<>());
}else { } else {
ArrayList<Integer> companyIds = new ArrayList<>(); ArrayList<Integer> companyIds = new ArrayList<>();
companyIds.add(dto.getStartCompanyId()); companyIds.add(dto.getStartCompanyId());
dto.setCompanyIds(companyIds); dto.setCompanyIds(companyIds);
} }
} }
if (StringUtils.isNotEmpty(dto.getPlateNumber())||StringUtils.isNotEmpty(dto.getVehicleCode())){
List<String> vehicleIds = vehicleFeign.findbyPlateNumberAndVehicleCod(dto.getPlateNumber(),dto.getVehicleCode()); if (StringUtils.isNotEmpty(dto.getPlateNumber()) || StringUtils.isNotEmpty(dto.getVehicleCode())) {
dto.setVehicleIds(vehicleIds); List<String> vehicleIds = vehicleFeign.findbyPlateNumberAndVehicleCod(dto.getPlateNumber(), dto.getVehicleCode());
dto.setVehicleIds(vehicleIds);
} }
Query query = new Query(dto); Query query = new Query(dto);
PageDataVO pageDataVO = PageDataVO.pageInfo(query, () -> baseOrderBiz.listOrder(query.getSuper())); PageDataVO pageDataVO = PageDataVO.pageInfo(query, () -> baseOrderBiz.listOrder(query.getSuper()));
...@@ -158,23 +168,50 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -158,23 +168,50 @@ public class BackStageOrderController extends CommonBaseController implements Us
ObjectRestResponse<List<AppUserVo>> objectRestResponse = userFeign.getByUserIds(userIds); ObjectRestResponse<List<AppUserVo>> objectRestResponse = userFeign.getByUserIds(userIds);
log.info("获取用户信息:objectRestResponse = {}", objectRestResponse.getData()); log.info("获取用户信息:objectRestResponse = {}", objectRestResponse.getData());
Map<Integer, AppUserVo> appvoMap = new HashMap<Integer, AppUserVo>(); Map<Integer, AppUserVo> appvoMap = new HashMap<Integer, AppUserVo>();
if(objectRestResponse.getData() != null) { if (objectRestResponse.getData() != null) {
for(AppUserVo appUserVo : objectRestResponse.getData()) { for (AppUserVo appUserVo : objectRestResponse.getData()) {
if(appUserVo != null) { if (appUserVo != null) {
appvoMap.put(appUserVo.getUserid(), appUserVo); appvoMap.put(appUserVo.getUserid(), appUserVo);
} }
} }
} }
Map<Integer, Coupon> coupons = activityFeign.coupons();
for (OrderListVo orderPageVO : list) { for (OrderListVo orderPageVO : list) {
AppUserVo appUserVo = appvoMap.get(orderPageVO.getUserId()); AppUserVo appUserVo = appvoMap.get(orderPageVO.getUserId());
if(appUserVo != null) { if (appUserVo != null) {
orderPageVO.setTelephone(appUserVo.getUsername()); orderPageVO.setTelephone(appUserVo.getUsername());
orderPageVO.setUsername(appUserVo.getNickname()); orderPageVO.setUsername(appUserVo.getNickname());
orderPageVO.setRealName(appUserVo.getRealname()); orderPageVO.setRealName(appUserVo.getRealname());
orderPageVO.setJobTitle(appUserVo.getJobTitle()); orderPageVO.setJobTitle(appUserVo.getJobTitle());
orderPageVO.setMemberName(appUserVo.getMemberName()); orderPageVO.setMemberName(appUserVo.getMemberName());
} }
ArrayList<Coupon> couponList = Lists.newArrayList();
ArrayList<Coupon> backCouponList = Lists.newArrayList();
if (StringUtils.isNotBlank(orderPageVO.getCouponTickerNos())) {
String[] couponIds = orderPageVO.getCouponTickerNos().split(",");
for (String couponId : couponIds) {
couponList.add(coupons.get(couponId));
}
}
if (StringUtils.isNotBlank(orderPageVO.getBackCoupon())) {
String[] backCouponIds = orderPageVO.getBackCoupon().split(",");
for (String backCouponId : backCouponIds) {
backCouponList.add(coupons.get(backCouponId));
}
}
orderPageVO.setCouponList(couponList);
orderPageVO.setBackCouponList(backCouponList);
// String carArticlesJson = orderPageVO.getCarArticlesJson();
// if (StringUtils.isNotBlank(carArticlesJson)){
// List<OrderAccompanyDTO> orderAccompanyDTOS = JSONObject.parseArray(carArticlesJson, OrderAccompanyDTO.class);
// orderPageVO.setOrderAccompanyDTOS(orderAccompanyDTOS);
// if (CollectionUtils.isNotEmpty(orderAccompanyDTOS)) {
// List<String> collect = orderAccompanyDTOS.parallelStream().map(OrderAccompanyDTO::getName).collect(Collectors.toList());
// orderPageVO.setCarArticles(collect);
// }
// }
if (orderPageVO.getOrderRentVehicleDetail() != null && orderPageVO.getOrderRentVehicleDetail().getVehicleId() != null) { if (orderPageVO.getOrderRentVehicleDetail() != null && orderPageVO.getOrderRentVehicleDetail().getVehicleId() != null) {
RestResponse<Vehicle> restResponse = vehicleFeign.findById(orderPageVO.getOrderRentVehicleDetail().getVehicleId()); RestResponse<Vehicle> restResponse = vehicleFeign.findById(orderPageVO.getOrderRentVehicleDetail().getVehicleId());
log.info("获取车辆信息返回消息:{}", restResponse.getData()); log.info("获取车辆信息返回消息:{}", restResponse.getData());
...@@ -182,20 +219,20 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -182,20 +219,20 @@ public class BackStageOrderController extends CommonBaseController implements Us
orderPageVO.setVehicleNumberPlat(restResponse.getData().getNumberPlate()); orderPageVO.setVehicleNumberPlat(restResponse.getData().getNumberPlate());
} }
if (StringUtils.isNotBlank(orderPageVO.getOrderRentVehicleDetail().getMyDriverIds())) { if (StringUtils.isNotBlank(orderPageVO.getOrderRentVehicleDetail().getMyDriverIds())) {
try { try {
List<VehicleUserLicense> orderUserLicenses = vehicleFeign.getVehicleLicenseList(orderPageVO.getOrderRentVehicleDetail().getMyDriverIds()).getData(); List<VehicleUserLicense> orderUserLicenses = vehicleFeign.getVehicleLicenseList(orderPageVO.getOrderRentVehicleDetail().getMyDriverIds()).getData();
if (orderUserLicenses != null && orderUserLicenses.size() > 0) { if (orderUserLicenses != null && orderUserLicenses.size() > 0) {
OrderVehicleCrosstownDto orderVehicleCrosstownDto = new OrderVehicleCrosstownDto(); OrderVehicleCrosstownDto orderVehicleCrosstownDto = new OrderVehicleCrosstownDto();
orderVehicleCrosstownDto.setLicenseIdCard(orderUserLicenses.get(0).getIdCard()); orderVehicleCrosstownDto.setLicenseIdCard(orderUserLicenses.get(0).getIdCard());
orderVehicleCrosstownDto.setLicenseImg(orderUserLicenses.get(0).getImg()); orderVehicleCrosstownDto.setLicenseImg(orderUserLicenses.get(0).getImg());
orderVehicleCrosstownDto.setLicenseName(orderUserLicenses.get(0).getName()); orderVehicleCrosstownDto.setLicenseName(orderUserLicenses.get(0).getName());
orderVehicleCrosstownDto.setLicensePhone(orderUserLicenses.get(0).getPhone()); orderVehicleCrosstownDto.setLicensePhone(orderUserLicenses.get(0).getPhone());
orderPageVO.setOrderVehicleCrosstownDto(orderVehicleCrosstownDto); orderPageVO.setOrderVehicleCrosstownDto(orderVehicleCrosstownDto);
} }
} catch (Exception e) { } catch (Exception e) {
log.info("获取驾驶人信息失败!"); log.info("获取驾驶人信息失败!");
e.printStackTrace(); e.printStackTrace();
} }
} }
...@@ -217,7 +254,7 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -217,7 +254,7 @@ public class BackStageOrderController extends CommonBaseController implements Us
if (startResponse.getData() != null) { if (startResponse.getData() != null) {
orderPageVO.setStartCompanyName(startResponse.getData().getName()); orderPageVO.setStartCompanyName(startResponse.getData().getName());
} }
if(StringUtils.isNotBlank(orderPageVO.getOrderTourDetail().getTourUserIds())) { if (StringUtils.isNotBlank(orderPageVO.getOrderTourDetail().getTourUserIds())) {
List<TourUser> tourUsers = tourFeign.getTourUsers(orderPageVO.getOrderTourDetail().getTourUserIds()).getData(); List<TourUser> tourUsers = tourFeign.getTourUsers(orderPageVO.getOrderTourDetail().getTourUserIds()).getData();
orderPageVO.getOrderTourDetail().setUserVoList(tourUsers == null || tourUsers.size() <= 0 ? new ArrayList<>() : tourUsers); orderPageVO.getOrderTourDetail().setUserVoList(tourUsers == null || tourUsers.size() <= 0 ? new ArrayList<>() : tourUsers);
} }
...@@ -241,14 +278,14 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -241,14 +278,14 @@ public class BackStageOrderController extends CommonBaseController implements Us
} }
} }
List<Integer> userIds = new ArrayList<>(); List<Integer> userIds = new ArrayList<>();
if(StringUtils.isNotBlank(dto.getKeywords())) { if (StringUtils.isNotBlank(dto.getKeywords())) {
List<Integer> list = userFeign.getUserIdByUsername(dto.getKeywords()); List<Integer> list = userFeign.getUserIdByUsername(dto.getKeywords());
if(list != null) { if (list != null) {
userIds.addAll(list); userIds.addAll(list);
} }
if(userIds.size() <= 0) { if (userIds.size() <= 0) {
return ObjectRestResponse.succ(new PageDataVO<>()); return ObjectRestResponse.succ(new PageDataVO<>());
} }
} }
UserDTO userDTO = getAdminUserInfo(); UserDTO userDTO = getAdminUserInfo();
...@@ -257,9 +294,9 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -257,9 +294,9 @@ public class BackStageOrderController extends CommonBaseController implements Us
} }
List<BranchCompany> branchCompanies = vehicleFeign.companyAll(userDTO.getDataAll(), userDTO.getDataCompany(), userDTO.getDataZone()); List<BranchCompany> branchCompanies = vehicleFeign.companyAll(userDTO.getDataAll(), userDTO.getDataCompany(), userDTO.getDataZone());
List<Integer> companyIds = branchCompanies.stream().map(BranchCompany::getId).collect(Collectors.toList()); List<Integer> companyIds = branchCompanies.stream().map(BranchCompany::getId).collect(Collectors.toList());
if(dto.getStartCompanyId() != null) { if (dto.getStartCompanyId() != null) {
if(companyIds.size() > 0) { if (companyIds.size() > 0) {
if(companyIds.contains(dto.getStartCompanyId())) { if (companyIds.contains(dto.getStartCompanyId())) {
companyIds.clear(); companyIds.clear();
companyIds.add(dto.getStartCompanyId()); companyIds.add(dto.getStartCompanyId());
} else { } else {
...@@ -281,9 +318,9 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -281,9 +318,9 @@ public class BackStageOrderController extends CommonBaseController implements Us
orderPageVO.setCode(restResponse.getData().getCode()); orderPageVO.setCode(restResponse.getData().getCode());
} }
} }
if(orderPageVO.getUserId() != null) { if (orderPageVO.getUserId() != null) {
AppUserDTO appUserDTO = userFeign.userDetailById(orderPageVO.getUserId()).getData(); AppUserDTO appUserDTO = userFeign.userDetailById(orderPageVO.getUserId()).getData();
if(appUserDTO != null) { if (appUserDTO != null) {
orderPageVO.setUsername(appUserDTO.getUsername()); orderPageVO.setUsername(appUserDTO.getUsername());
orderPageVO.setRealName(appUserDTO.getRealname()); orderPageVO.setRealName(appUserDTO.getRealname());
} }
...@@ -355,20 +392,20 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -355,20 +392,20 @@ public class BackStageOrderController extends CommonBaseController implements Us
query.put("userId", null); query.put("userId", null);
PageDataVO<OrderPageVO> page = PageDataVO.pageInfo(query, () -> baseOrderBiz.pageByParm(query.getSuper())); PageDataVO<OrderPageVO> page = PageDataVO.pageInfo(query, () -> baseOrderBiz.pageByParm(query.getSuper()));
OrderPageVO orderPageVO = page.getData().get(0); OrderPageVO orderPageVO = page.getData().get(0);
if(null == orderPageVO) { if (null == orderPageVO) {
throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE, Sets.newSet("订单不存在")); throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE, Sets.newSet("订单不存在"));
} }
//预约新的车辆 //预约新的车辆
RentVehicleBO bo = BeanUtil.toBean(orderPageVO.getOrderRentVehicleDetail(), RentVehicleBO.class); RentVehicleBO bo = BeanUtil.toBean(orderPageVO.getOrderRentVehicleDetail(), RentVehicleBO.class);
bo.setOrder(orderPageVO); bo.setOrder(orderPageVO);
bo.setBookVehicleVO(new BookVehicleVO(){{ bo.setBookVehicleVO(new BookVehicleVO() {{
setBookStartDate(YMR_SLASH_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getStartTime()), ZoneOffset.ofHours(8)))); setBookStartDate(YMR_SLASH_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getStartTime()), ZoneOffset.ofHours(8))));
setBookEndDate(YMR_SLASH_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getEndTime()), ZoneOffset.ofHours(8)))); setBookEndDate(YMR_SLASH_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getEndTime()), ZoneOffset.ofHours(8))));
setBookStartDateTime(DATE_TIME_LINE_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getStartTime()), ZoneOffset.ofHours(8)))); setBookStartDateTime(DATE_TIME_LINE_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getStartTime()), ZoneOffset.ofHours(8))));
setBookEndDateTime(DATE_TIME_LINE_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getEndTime()), ZoneOffset.ofHours(8)))); setBookEndDateTime(DATE_TIME_LINE_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getEndTime()), ZoneOffset.ofHours(8))));
}}); }});
List<OrderAccompanyDTO> oads = JSONUtil.toList(JSONUtil.parseArray(orderItemBiz.selectOne(new OrderItem(){{ List<OrderAccompanyDTO> oads = JSONUtil.toList(JSONUtil.parseArray(orderItemBiz.selectOne(new OrderItem() {{
setOrderId(orderPageVO.getId()); setOrderId(orderPageVO.getId());
setType(ItemTypeEnum.ACCOMPANY.getCode()); setType(ItemTypeEnum.ACCOMPANY.getCode());
}}).getDetail()), OrderAccompanyDTO.class); }}).getDetail()), OrderAccompanyDTO.class);
...@@ -378,7 +415,7 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -378,7 +415,7 @@ public class BackStageOrderController extends CommonBaseController implements Us
//如果成功则取消旧车的预约 //如果成功则取消旧车的预约
RestResponse<Integer> rentUnbookResponse = vehicleFeign.rentUnbookVehicle(oldBookRecordId); RestResponse<Integer> rentUnbookResponse = vehicleFeign.rentUnbookVehicle(oldBookRecordId);
//设置新的vehicleId 和 record //设置新的vehicleId 和 record
orderRentVehicleBiz.updateSelectiveByIdRe(new OrderRentVehicleDetail(){{ orderRentVehicleBiz.updateSelectiveByIdRe(new OrderRentVehicleDetail() {{
setId(bo.getId()); setId(bo.getId());
setVehicleId(bo.getVehicleId()); setVehicleId(bo.getVehicleId());
setBookRecordId(bo.getBookRecordId()); setBookRecordId(bo.getBookRecordId());
......
...@@ -114,12 +114,14 @@ ...@@ -114,12 +114,14 @@
</select> </select>
<select id="listOrder" parameterType="Map" resultMap="orderListMap"> <select id="listOrder" parameterType="Map" resultMap="orderListMap">
select b.* select b.*,i.detail as carArticlesJson
from base_order b from base_order b
LEFT JOIN order_rent_vehicle_detail r on r.order_id = b.id LEFT JOIN order_rent_vehicle_detail r on r.order_id = b.id
LEFT JOIN order_tour_detail t on t.order_id = b.id LEFT JOIN order_tour_detail t on t.order_id = b.id
LEFT JOIN order_member_detail m on m.order_id = b.id LEFT JOIN order_member_detail m on m.order_id = b.id
LEFT JOIN order_item i on b.id = i.order_id
<where> <where>
i.type=104
<if test="crtUser != null"> <if test="crtUser != null">
and b.crt_user = #{crtUser} and b.crt_user = #{crtUser}
</if> </if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment