Commit 51877012 authored by 周健威's avatar 周健威

Merge remote-tracking branch 'origin/master-modify-cutAmount' into master-modify-cutAmount

# Conflicts:
#	xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/BaseOrderBiz.java
parents 798ba695 c608e6ab
...@@ -52,6 +52,9 @@ public interface UserFeign { ...@@ -52,6 +52,9 @@ public interface UserFeign {
public ObjectRestResponse<AppUserDTO> userDetailById(@RequestParam("id") Integer id); public ObjectRestResponse<AppUserDTO> userDetailById(@RequestParam("id") Integer id);
@GetMapping("/app/user/app/unauth/getUserIdByUsername")
public List<Integer> getUserIdByUsername(@RequestParam(value="keywords")String keywords);
/** /**
*status:0-判断是否认证过,1-认证成功后修改用户认证状态 *status:0-判断是否认证过,1-认证成功后修改用户认证状态
*userId:用户登录时的id,必须 *userId:用户登录时的id,必须
......
...@@ -144,4 +144,9 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail ...@@ -144,4 +144,9 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
appUserInfoVo.setNickname(userDetail.getNickname()); appUserInfoVo.setNickname(userDetail.getNickname());
return appUserInfoVo; return appUserInfoVo;
} }
public List<Integer> getUserIdByUsername(String keywords) {
return mapper.getUserIdByUsername(keywords);
}
} }
...@@ -19,4 +19,6 @@ public interface AppUserDetailMapper extends Mapper<AppUserDetail> { ...@@ -19,4 +19,6 @@ public interface AppUserDetailMapper extends Mapper<AppUserDetail> {
void updateUserMemberStatusByUserId(@Param("userId") Integer userId,@Param("status") Integer status); void updateUserMemberStatusByUserId(@Param("userId") Integer userId,@Param("status") Integer status);
void updateUserPositionByUserId(@Param("userId") Integer id, @Param("positionId") Integer positionId); void updateUserPositionByUserId(@Param("userId") Integer id, @Param("positionId") Integer positionId);
List<Integer> getUserIdByUsername(@Param("keywords") String keywords);
} }
\ No newline at end of file
...@@ -280,6 +280,14 @@ public class AppUserController extends CommonBaseController{ ...@@ -280,6 +280,14 @@ public class AppUserController extends CommonBaseController{
return ObjectRestResponse.succ(appUserInfoVo); return ObjectRestResponse.succ(appUserInfoVo);
} }
@GetMapping("/app/unauth/getUserIdByUsername")
@IgnoreUserToken
@IgnoreClientToken
public List<Integer> getUserIdByUsername(@RequestParam("keywords") String keywords){
List<Integer> userIds = userDetailBiz.getUserIdByUsername(keywords);
return userIds;
}
@GetMapping("/app/unauth/test") @GetMapping("/app/unauth/test")
@IgnoreUserToken @IgnoreUserToken
@IgnoreClientToken @IgnoreClientToken
......
...@@ -42,6 +42,15 @@ ...@@ -42,6 +42,15 @@
where d.userid = #{userId} limit 1 where d.userid = #{userId} limit 1
</select> </select>
<select id="getUserIdByUsername" resultType="java.lang.Integer" parameterType="java.lang.String">
select d.userid from app_user_login l
left join app_user_detail d
on d.userid = l.id
where d.realname like concat("%", #{keywords}, "%") or l.username like concat("%", #{keywords}, "%")
</select>
<select id="selectAppUserManage" parameterType="com.github.wxiaoqi.security.admin.dto.AppUserManageDTO" <select id="selectAppUserManage" parameterType="com.github.wxiaoqi.security.admin.dto.AppUserManageDTO"
resultType="com.github.wxiaoqi.security.admin.vo.AppUserManageVo"> resultType="com.github.wxiaoqi.security.admin.vo.AppUserManageVo">
select select
......
package com.xxfc.platform.order.pojo.order; package com.xxfc.platform.order.pojo.order;
import com.xxfc.platform.order.entity.*; import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.pojo.DedDetailDTO;
import com.xxfc.platform.vehicle.entity.VehicleUserLicense; import com.xxfc.platform.vehicle.entity.VehicleUserLicense;
import lombok.Data; import lombok.Data;
...@@ -24,6 +25,8 @@ public class OrderPageVO extends BaseOrder { ...@@ -24,6 +25,8 @@ public class OrderPageVO extends BaseOrder {
* 用户名 * 用户名
*/ */
private String username; private String username;
//用户姓名
private String realName;
private String startCompanyName; private String startCompanyName;
...@@ -31,6 +34,9 @@ public class OrderPageVO extends BaseOrder { ...@@ -31,6 +34,9 @@ public class OrderPageVO extends BaseOrder {
private String telephone; private String telephone;
//订单违约金
private DedDetailDTO dedDetailDTO;
/** /**
* 車輛編碼 * 車輛編碼
*/ */
......
...@@ -2,6 +2,7 @@ package com.xxfc.platform.order.biz; ...@@ -2,6 +2,7 @@ package com.xxfc.platform.order.biz;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.admin.dto.UserMemberDTO; import com.github.wxiaoqi.security.admin.dto.UserMemberDTO;
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;
...@@ -14,13 +15,18 @@ import com.github.wxiaoqi.security.common.util.Query; ...@@ -14,13 +15,18 @@ 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.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.xxfc.platform.activity.feign.ActivityFeign; import com.xxfc.platform.activity.feign.ActivityFeign;
import com.xxfc.platform.order.biz.inner.OrderCalculateBiz;
import com.xxfc.platform.order.biz.inner.OrderMsgBiz; import com.xxfc.platform.order.biz.inner.OrderMsgBiz;
import com.xxfc.platform.order.contant.enumerate.AccountTypeEnum; import com.xxfc.platform.order.contant.enumerate.AccountTypeEnum;
import com.xxfc.platform.order.contant.enumerate.ItemTypeEnum;
import com.xxfc.platform.order.contant.enumerate.OrderStatusEnum; import com.xxfc.platform.order.contant.enumerate.OrderStatusEnum;
import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum; import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import com.xxfc.platform.order.contant.enumerate.OrderViolateEnum;
import com.xxfc.platform.order.entity.*; import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.mapper.BaseOrderMapper; import com.xxfc.platform.order.mapper.BaseOrderMapper;
import com.xxfc.platform.order.pojo.account.OrderAccountDetail; import com.xxfc.platform.order.pojo.account.OrderAccountDetail;
import com.xxfc.platform.order.pojo.DedDetailDTO;
import com.xxfc.platform.order.pojo.calculate.InProgressVO;
import com.xxfc.platform.order.pojo.mq.OrderMQDTO; import com.xxfc.platform.order.pojo.mq.OrderMQDTO;
import com.xxfc.platform.order.pojo.order.OrderListVo; import com.xxfc.platform.order.pojo.order.OrderListVo;
import com.xxfc.platform.order.pojo.order.OrderPageVO; import com.xxfc.platform.order.pojo.order.OrderPageVO;
...@@ -43,6 +49,9 @@ import com.xxfc.platform.vehicle.pojo.CompanyDetail; ...@@ -43,6 +49,9 @@ import com.xxfc.platform.vehicle.pojo.CompanyDetail;
import lombok.Data; import lombok.Data;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -113,6 +122,12 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> { ...@@ -113,6 +122,12 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> {
@Autowired @Autowired
ActivityFeign activityFeign; ActivityFeign activityFeign;
@Autowired
OrderCalculateBiz orderCalculateBiz;
public static final DateTimeFormatter DEFAULT_DATE_TIME_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd");
public List<OrderPageVO> pageByParm(Map<String, Object> paramMap) { public List<OrderPageVO> pageByParm(Map<String, Object> paramMap) {
return mapper.pageByParm(paramMap); return mapper.pageByParm(paramMap);
} }
...@@ -147,7 +162,7 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> { ...@@ -147,7 +162,7 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> {
AppUserDTO appUserVo = userFeign.userDetailById(orderPageVo.getUserId()).getData(); AppUserDTO appUserVo = userFeign.userDetailById(orderPageVo.getUserId()).getData();
if(appUserVo != null) { if(appUserVo != null) {
orderPageVo.setTelephone(appUserVo.getUsername()); orderPageVo.setTelephone(appUserVo.getUsername());
orderPageVo.setUsername(appUserVo.getNickname()); orderPageVo.setUsername(appUserVo.getRealname());
} }
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());
...@@ -181,13 +196,17 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> { ...@@ -181,13 +196,17 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> {
RestResponse<Vehicle> response = vehicleFeign.findById(orderPageVo.getOrderRentVehicleDetail().getVehicleId()); RestResponse<Vehicle> response = vehicleFeign.findById(orderPageVo.getOrderRentVehicleDetail().getVehicleId());
if (response.getData() != null) { if (response.getData() != null) {
orderPageVo.setVehicalNumberPlat(response.getData().getNumberPlate()); orderPageVo.setVehicalNumberPlat(response.getData().getNumberPlate());
orderPageVo.setCode(response.getData().getCode());
} }
//设置违约金金额
updateCrossRefund(orderPageVo);
} else if (orderPageVo.getOrderTourDetail() != null) { } else if (orderPageVo.getOrderTourDetail() != null) {
if(StringUtils.isNotBlank(orderPageVo.getOrderTourDetail().getTourUserIds())) { if(StringUtils.isNotBlank(orderPageVo.getOrderTourDetail().getTourUserIds())) {
List<TourUser> list = tourFeign.getTourUsers(orderPageVo.getOrderTourDetail().getTourUserIds()).getData(); List<TourUser> list = tourFeign.getTourUsers(orderPageVo.getOrderTourDetail().getTourUserIds()).getData();
orderPageVo.getOrderTourDetail().setUserVoList(list == null || list.size() <= 0 ? new ArrayList<>() : list); orderPageVo.getOrderTourDetail().setUserVoList(list == null || list.size() <= 0 ? new ArrayList<>() : list);
} }
} }
//设置保留金 //设置保留金
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData(); Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
BigDecimal illegalReserve = new BigDecimal(dictionaryMap.get(APP_ORDER + "_" + DictionaryKey.ILLEGAL_RESERVE).getDetail()); BigDecimal illegalReserve = new BigDecimal(dictionaryMap.get(APP_ORDER + "_" + DictionaryKey.ILLEGAL_RESERVE).getDetail());
...@@ -198,6 +217,104 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> { ...@@ -198,6 +217,104 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> {
return ObjectRestResponse.succ(orderPageVo); return ObjectRestResponse.succ(orderPageVo);
} }
//获取两个日期之间的天数
public int getDaysBetweenDateTime(DateTime startDay, DateTime endDay) {
int a = 0;
for (DateTime curDate = startDay.plusDays(1); curDate.compareTo(endDay) < 0; curDate = curDate.plusDays(1)) {
a++;
}
return a;
}
public void updateCrossRefund(OrderPageVO orderPageVO) {
//计算延期费用
DedDetailDTO dedDetailDTO = new DedDetailDTO();
//提前还车,结束时间大于当前时间
DateTime nowTime = DateTime.parse(DateTime.now().toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER);
DateTime endTime = DateTime.parse(new DateTime(orderPageVO.getOrderRentVehicleDetail().getEndTime()).toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER);
DateTime startTime = DateTime.parse(new DateTime(orderPageVO.getOrderRentVehicleDetail().getStartTime()).toString(DEFAULT_DATE_TIME_FORMATTER), DEFAULT_DATE_TIME_FORMATTER);
//设置使用天数
int userUsedDay = getDaysBetweenDateTime(startTime, nowTime);
orderPageVO.getOrderRentVehicleDetail().setUsedDay(userUsedDay);
orderRentVehicleBiz.updateSelectiveById(orderPageVO.getOrderRentVehicleDetail());
//实际预定的天数
int actualDay = getDaysBetweenDateTime(startTime, endTime);
Integer orderId = orderPageVO.getId();
List<OrderItem> items = orderItemBiz.selectList(new OrderItem() {{
setOrderId(orderId);
}});
//租车车辆单价
BigDecimal amount = new BigDecimal(0);
if (items != null && items.size() > 0) {
for (OrderItem orderItem : items) {
if (orderItem.getType() == ItemTypeEnum.VEHICLE_MODEL.getCode()) {
amount = orderItem.getUnitPrice();
break;
}
}
}
if (orderPageVO.getOrderRentVehicleDetail().getEndTime() > nowTime.getMillis()) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("实际消费超额");
//提前的天数, 当天就算使用一天
int noUsedDay = getDaysBetweenDateTime(nowTime, endTime) - 1;
//退还未使用的天数,或者金额,扣除违约金,实际未使用天数的金额,最多3000元
InProgressVO inProgressVO = new InProgressVO();
inProgressVO.setViolateAmount(new BigDecimal(200));
inProgressVO.setExtraAmount(new BigDecimal(200));
//InProgressVO inProgressVO = orderCalculateBiz.inProgressCalculate(orderPageVO, actualDay - noUsedDay);
if (inProgressVO != null) {
stringBuilder.append(inProgressVO.getExtraAmount());
stringBuilder.append("元 + ");
stringBuilder.append("违约金( ¥");
stringBuilder.append(amount);
stringBuilder.append(" x ");
stringBuilder.append(actualDay - noUsedDay);
stringBuilder.append("天) = ");
BigDecimal cost = (inProgressVO.getExtraAmount()).add(inProgressVO.getViolateAmount());
stringBuilder.append(cost);
initDedDetail(dedDetailDTO, OrderViolateEnum.BEFORE.getCode(), cost, stringBuilder);
}
//延期还车,结束时间小于当前时间
} else if (orderPageVO.getOrderRentVehicleDetail().getEndTime() < nowTime.getMillis()) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("实际消费超额");
stringBuilder.append(0);
stringBuilder.append("元 + ");
stringBuilder.append("违约金( ¥");
//延期的天数, 延期违约金是延期天数*200%
int usedDay = getDaysBetweenDateTime(endTime, nowTime);
stringBuilder.append(amount);
stringBuilder.append(" x ");
stringBuilder.append(usedDay);
stringBuilder.append("(天)");
stringBuilder.append(" x 2");
BigDecimal cost = amount.multiply(new BigDecimal(usedDay)).multiply(new BigDecimal(2));
stringBuilder.append(" = ");
stringBuilder.append(cost);
stringBuilder.append("元");
initDedDetail(dedDetailDTO, OrderViolateEnum.AFTER.getCode(), cost, stringBuilder);
}
orderPageVO.setDedDetailDTO(dedDetailDTO);
}
public void initDedDetail(DedDetailDTO dedDetailDTO, Integer type, BigDecimal cost, StringBuilder stringBuilder) {
String detailName = null;
if (type == OrderViolateEnum.BEFORE.getCode()) {
dedDetailDTO.setType(OrderViolateEnum.BEFORE.getCode());
detailName = "提前还车违约金";
} else if (type == OrderViolateEnum.AFTER.getCode()) {
dedDetailDTO.setType(OrderViolateEnum.AFTER.getCode());
detailName = "延期还车违约金";
}
//900元+违约金(¥900x2天=)1800元
dedDetailDTO.setDeductions(stringBuilder.toString());
dedDetailDTO.setCost(cost);
dedDetailDTO.setId(1);
dedDetailDTO.setStatusIndex(1);
dedDetailDTO.setStatusName(detailName);
}
public void getUserLicense(OrderPageVO orderPageVo) { public void getUserLicense(OrderPageVO orderPageVo) {
OrderVehicleCrosstownDto orderVehicleCrosstownDto = new OrderVehicleCrosstownDto(); OrderVehicleCrosstownDto orderVehicleCrosstownDto = new OrderVehicleCrosstownDto();
orderVehicleCrosstownDto.setOrderId(orderPageVo.getId()); orderVehicleCrosstownDto.setOrderId(orderPageVo.getId());
......
...@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
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.UserDTO; import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface; import com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface;
import com.github.wxiaoqi.security.admin.vo.AppUserVo; import com.github.wxiaoqi.security.admin.vo.AppUserVo;
...@@ -120,6 +121,11 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -120,6 +121,11 @@ public class BackStageOrderController extends CommonBaseController implements Us
dto.setCompanyIds(companyIds); dto.setCompanyIds(companyIds);
} }
if (StringUtils.isNotEmpty(dto.getPlateNumber())){
List<String> vehicleIds = vehicleFeign.findbyPlateNumber(dto.getPlateNumber().trim());
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()));
List<OrderListVo> list = pageDataVO.getData(); List<OrderListVo> list = pageDataVO.getData();
...@@ -208,6 +214,14 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -208,6 +214,14 @@ public class BackStageOrderController extends CommonBaseController implements Us
dto.setEndTime(new Date().getTime()); dto.setEndTime(new Date().getTime());
} }
} }
List<Integer> userIds = new ArrayList<>();
if(StringUtils.isNotBlank(dto.getKeywords())) {
List<Integer> list = userFeign.getUserIdByUsername(dto.getKeywords());
if(list != null) {
userIds.addAll(list);
}
}
dto.setUserIds(userIds);
UserDTO userDTO = getAdminUserInfo(); UserDTO userDTO = getAdminUserInfo();
if (userDTO == null) { if (userDTO == null) {
return ObjectRestResponse.succ(new PageDataVO<>()); return ObjectRestResponse.succ(new PageDataVO<>());
...@@ -238,7 +252,13 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -238,7 +252,13 @@ public class BackStageOrderController extends CommonBaseController implements Us
orderPageVO.setCode(restResponse.getData().getCode()); orderPageVO.setCode(restResponse.getData().getCode());
} }
} }
if(orderPageVO.getUserId() != null) {
AppUserDTO appUserDTO = userFeign.userDetailById(orderPageVO.getUserId()).getData();
if(appUserDTO != null) {
orderPageVO.setUsername(appUserDTO.getUsername());
orderPageVO.setRealName(appUserDTO.getRealname());
}
}
} }
return new ObjectRestResponse<>().data(pageDataVO); return new ObjectRestResponse<>().data(pageDataVO);
} }
......
...@@ -309,6 +309,18 @@ public class BaseOrderController extends CommonBaseController implements UserRes ...@@ -309,6 +309,18 @@ public class BaseOrderController extends CommonBaseController implements UserRes
private String phone; private String phone;
private List<String> vehicleIds;
//订单用户ID列表
private List<Integer> userIds;
//订单用户手机号或订单用户真实姓名
private String keywords;
/**
* 车牌号
*/
private String plateNumber;
@ApiModelProperty("当前页码") @ApiModelProperty("当前页码")
Integer page; Integer page;
@ApiModelProperty("每页限制") @ApiModelProperty("每页限制")
......
...@@ -142,6 +142,11 @@ ...@@ -142,6 +142,11 @@
and (r.start_time between #{startTime} and #{endTime} and (r.start_time between #{startTime} and #{endTime}
or t.start_time between #{startTime} and #{endTime}) or t.start_time between #{startTime} and #{endTime})
</if> </if>
<if test="vehicleIds != null and vehicleIds.size() > 0">
AND r.vehicle_id IN <foreach collection="vehicleIds" item="vehicleId" open="(" close=")" separator=",">
#{vehicleId}
</foreach>
</if>
<if test="companyIds != null and companyIds.size > 0"> <if test="companyIds != null and companyIds.size > 0">
and (r.start_company_id in and (r.start_company_id in
<foreach collection="companyIds" item="id" open="(" separator="," close=")"> <foreach collection="companyIds" item="id" open="(" separator="," close=")">
......
...@@ -31,7 +31,7 @@ public enum ResCode { ...@@ -31,7 +31,7 @@ public enum ResCode {
VEHICLE_DEPARTURE_VEHICLE_DISABLE(104002,"车辆不可用"), VEHICLE_DEPARTURE_VEHICLE_DISABLE(104002,"车辆不可用"),
VEHICLE_DEPARTURE_VEHICLE_DELETE(104007,"车辆已下架"), VEHICLE_DEPARTURE_VEHICLE_DELETE(104007,"车辆已下架"),
VEHICLE_DEPARTURE_VEHICLE_UNDEPARTURE(104003,"车辆未出车"), VEHICLE_DEPARTURE_VEHICLE_UNDEPARTURE(104003,"车辆未出车"),
VEHICLE_DEPARTURE_DATE_IS_NOT_ABLED(104006,"车辆不在出车范围内,请按照预定日期出车!"), VEHICLE_DEPARTURE_DATE_IS_NOT_ABLED(104006,"请按照预定的日期出车!"),
VEHICLE_BOOK_RECORD_IS_NOT_EXIST(104004, "预约记录不存在"), VEHICLE_BOOK_RECORD_IS_NOT_EXIST(104004, "预约记录不存在"),
VEHICLE_UNBOOK_FAIL(104005, "取消预定失败!"), VEHICLE_UNBOOK_FAIL(104005, "取消预定失败!"),
......
...@@ -149,4 +149,7 @@ public interface VehicleFeign { ...@@ -149,4 +149,7 @@ public interface VehicleFeign {
*/ */
@GetMapping("/cata/add/getCatasByIds/{ids}") @GetMapping("/cata/add/getCatasByIds/{ids}")
public ObjectRestResponse<List<VehiclePlatCata>> getCatasByIds(@PathVariable("ids") String ids); public ObjectRestResponse<List<VehiclePlatCata>> getCatasByIds(@PathVariable("ids") String ids);
@GetMapping("/vehicleInfo/findwith_plate_number")
List<String> findbyPlateNumber(@RequestParam(value = "plateNumber") String plateNumber);
} }
...@@ -18,6 +18,11 @@ public class VehicleBookRecordQueryVo extends PageParam { ...@@ -18,6 +18,11 @@ public class VehicleBookRecordQueryVo extends PageParam {
*/ */
private String numberPlate; private String numberPlate;
/**
* 车牌和车辆编号的关键字
*/
private String keywords;
/** /**
* 所属分支机构(id) * 所属分支机构(id)
*/ */
......
...@@ -39,6 +39,8 @@ public class VehiclePlanDto extends PageParam { ...@@ -39,6 +39,8 @@ public class VehiclePlanDto extends PageParam {
*/ */
private Integer useType; private Integer useType;
private String keywords;
/** /**
* 车型id * 车型id
*/ */
......
...@@ -1446,4 +1446,16 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -1446,4 +1446,16 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
public List<String> findExistVehicleIds() { public List<String> findExistVehicleIds() {
return mapper.findExistVehicleIds(); return mapper.findExistVehicleIds();
} }
public List<String> findVehicleIdsByPlateNumber(String plateNumber) {
List<String> vehicleIds = Lists.newArrayList();
Example example = new Example(Vehicle.class);
Example.Criteria criteria = example.createCriteria();
criteria.andLike("numberPlate",String.format("%%%s%%",plateNumber.trim()));
List<Vehicle> vehicles = mapper.selectByExample(example);
if (CollectionUtils.isEmpty(vehicles)){
return vehicleIds;
}
return vehicles.stream().map(Vehicle::getId).collect(Collectors.toList());
}
} }
...@@ -192,10 +192,26 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic ...@@ -192,10 +192,26 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
} }
} }
vehicleBookRecordQueryVo.setCompanyIds(companyList); vehicleBookRecordQueryVo.setCompanyIds(companyList);
Query query = new Query(vehicleBookRecordQueryVo); if (vehicleBookRecordQueryVo.getStatus() != null && vehicleBookRecordQueryVo.getStatus() == 3) { //待出行
if (vehicleBookRecordQueryVo.getStatus() != null && vehicleBookRecordQueryVo.getStatus() == 2) { vehicleBookRecordQueryVo.setStatus(2);
Query query = new Query(vehicleBookRecordQueryVo);
List<VehicleBookRecordVo> list = mapper.getBookRecordInfo(query.getSuper());
removeStatus3(list);
PageInfo<VehicleBookRecordVo> vehicleBookRecordVoPageInfo = new PageInfo<>(list);
getupKeeps(vehicleBookRecordVoPageInfo.getList());
PageDataVO<VehicleBookRecordVo> vehicleBookRecordVoPageDataVO = PageDataVO.pageInfo(vehicleBookRecordVoPageInfo);
vehicleBookRecordVoPageDataVO.setPageNum(pageNo);
vehicleBookRecordVoPageDataVO.setPageSize(pageSize);
vehicleBookRecordVoPageDataVO.setTotalCount((long) vehicleBookRecordVoPageInfo.getList().size());
vehicleBookRecordVoPageDataVO.setTotalPage((vehicleBookRecordVoPageInfo.getList().size() + pageSize - 1) / pageSize);
vehicleBookRecordVoPageDataVO.setData(getData(vehicleBookRecordVoPageInfo.getList(), pageNo, pageSize));
return RestResponse.suc(vehicleBookRecordVoPageDataVO);
}
if (vehicleBookRecordQueryVo.getStatus() != null && vehicleBookRecordQueryVo.getStatus() == 5) { //出行中
vehicleBookRecordQueryVo.setStatus(2);
Query query = new Query(vehicleBookRecordQueryVo);
List<VehicleBookRecordVo> list = mapper.getBookRecordInfo(query.getSuper()); List<VehicleBookRecordVo> list = mapper.getBookRecordInfo(query.getSuper());
removeStatus2(list); removeStatus5(list);
PageInfo<VehicleBookRecordVo> vehicleBookRecordVoPageInfo = new PageInfo<>(list); PageInfo<VehicleBookRecordVo> vehicleBookRecordVoPageInfo = new PageInfo<>(list);
getupKeeps(vehicleBookRecordVoPageInfo.getList()); getupKeeps(vehicleBookRecordVoPageInfo.getList());
PageDataVO<VehicleBookRecordVo> vehicleBookRecordVoPageDataVO = PageDataVO.pageInfo(vehicleBookRecordVoPageInfo); PageDataVO<VehicleBookRecordVo> vehicleBookRecordVoPageDataVO = PageDataVO.pageInfo(vehicleBookRecordVoPageInfo);
...@@ -206,22 +222,80 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic ...@@ -206,22 +222,80 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
vehicleBookRecordVoPageDataVO.setData(getData(vehicleBookRecordVoPageInfo.getList(), pageNo, pageSize)); vehicleBookRecordVoPageDataVO.setData(getData(vehicleBookRecordVoPageInfo.getList(), pageNo, pageSize));
return RestResponse.suc(vehicleBookRecordVoPageDataVO); return RestResponse.suc(vehicleBookRecordVoPageDataVO);
} }
if (vehicleBookRecordQueryVo.getStatus() != null && vehicleBookRecordQueryVo.getStatus() == 7) { //已完成
vehicleBookRecordQueryVo.setStatus(2);
Query query = new Query(vehicleBookRecordQueryVo);
List<VehicleBookRecordVo> list = mapper.getBookRecordInfo(query.getSuper());
removeStatus7(list);
PageInfo<VehicleBookRecordVo> vehicleBookRecordVoPageInfo = new PageInfo<>(list);
getupKeeps(vehicleBookRecordVoPageInfo.getList());
PageDataVO<VehicleBookRecordVo> vehicleBookRecordVoPageDataVO = PageDataVO.pageInfo(vehicleBookRecordVoPageInfo);
vehicleBookRecordVoPageDataVO.setPageNum(pageNo);
vehicleBookRecordVoPageDataVO.setPageSize(pageSize);
vehicleBookRecordVoPageDataVO.setTotalCount((long) vehicleBookRecordVoPageInfo.getList().size());
vehicleBookRecordVoPageDataVO.setTotalPage((vehicleBookRecordVoPageInfo.getList().size() + pageSize - 1) / pageSize);
vehicleBookRecordVoPageDataVO.setData(getData(vehicleBookRecordVoPageInfo.getList(), pageNo, pageSize));
return RestResponse.suc(vehicleBookRecordVoPageDataVO);
}
Query query = new Query(vehicleBookRecordQueryVo);
PageDataVO<VehicleBookRecordVo> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.getBookRecordInfo(query.getSuper())); PageDataVO<VehicleBookRecordVo> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.getBookRecordInfo(query.getSuper()));
getupKeeps(pageDataVO.getData()); getupKeeps(pageDataVO.getData());
return RestResponse.suc(pageDataVO); return RestResponse.suc(pageDataVO);
} }
//筛选未出车的记录
public void removeStatus2(List<VehicleBookRecordVo> list) { public void removeStatus2(List<VehicleBookRecordVo> list) {
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
Iterator<VehicleBookRecordVo> iterator = list.iterator(); Iterator<VehicleBookRecordVo> iterator = list.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
if (iterator.next().getVehicleDepartureLogVo() != null) { VehicleBookRecordVo vehicleBookRecordVo = iterator.next();
if (vehicleBookRecordVo.getVehicleDepartureLogVo() != null) {
iterator.remove();
}
}
}
}
//筛选未出车的记录
public void removeStatus3(List<VehicleBookRecordVo> list) {
if (list != null && list.size() > 0) {
Iterator<VehicleBookRecordVo> iterator = list.iterator();
while (iterator.hasNext()) {
VehicleBookRecordVo vehicleBookRecordVo = iterator.next();
if (vehicleBookRecordVo.getVehicleDepartureLogVo() != null) {
iterator.remove(); iterator.remove();
} }
vehicleBookRecordVo.setState(3);
} }
} }
} }
//筛选已出车未还车记录
public void removeStatus5(List<VehicleBookRecordVo> list) {
if (list != null && list.size() > 0) {
Iterator<VehicleBookRecordVo> iterator = list.iterator();
while (iterator.hasNext()) {
VehicleBookRecordVo vehicleBookRecordVo = iterator.next();
if (vehicleBookRecordVo.getVehicleDepartureLogVo() == null || (vehicleBookRecordVo.getVehicleDepartureLogVo() != null && vehicleBookRecordVo.getVehicleDepartureLogVo().getState() ==1)) {
iterator.remove();
}
vehicleBookRecordVo.setState(5);
}
}
}
//筛选已完成记录
public void removeStatus7(List<VehicleBookRecordVo> list) {
if (list != null && list.size() > 0) {
Iterator<VehicleBookRecordVo> iterator = list.iterator();
while (iterator.hasNext()) {
VehicleBookRecordVo vehicleBookRecordVo = iterator.next();
if (vehicleBookRecordVo.getVehicleDepartureLogVo() == null || (vehicleBookRecordVo.getVehicleDepartureLogVo() != null && vehicleBookRecordVo.getVehicleDepartureLogVo().getState() !=1)) {
iterator.remove();
}
vehicleBookRecordVo.setState(5);
}
}
}
/** /**
* 获取随身物品 * 获取随身物品
*/ */
......
...@@ -517,4 +517,9 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use ...@@ -517,4 +517,9 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use
public ObjectRestResponse checkBookHourInfo() { public ObjectRestResponse checkBookHourInfo() {
return vehicleBookHourInfoBiz.checkBookHourInfo(); return vehicleBookHourInfoBiz.checkBookHourInfo();
} }
@GetMapping("/findwith_plate_number")
List<String> findbyPlateNumber(@RequestParam(value = "plateNumber") String plateNumber){
return vehicleBiz.findVehicleIdsByPlateNumber(plateNumber);
}
} }
...@@ -327,7 +327,7 @@ ...@@ -327,7 +327,7 @@
<select id="selectByVehicleIdAndTime" parameterType="java.util.Map" resultMap="searchBookRecord"> <select id="selectByVehicleIdAndTime" parameterType="java.util.Map" resultMap="searchBookRecord">
select v1.* from vehicle_book_record v1 select v1.* from vehicle_book_record v1
where v1.vehicle_id = #{vehicleId} and v1.book_end_date &lt;= #{bookedEndDate} and v1.status BETWEEN 1 and 2 where v1.vehicle_id = #{vehicleId} and v1.book_end_date >= #{time} and v1.status BETWEEN 1 and 2
</select> </select>
<select id="selectZeroHourRecord" resultMap="searchBookRecord" parameterType="java.util.Map"> <select id="selectZeroHourRecord" resultMap="searchBookRecord" parameterType="java.util.Map">
...@@ -478,6 +478,9 @@ ...@@ -478,6 +478,9 @@
<if test="bookType != null"> <if test="bookType != null">
and v1.book_type = #{bookType} and v1.book_type = #{bookType}
</if> </if>
<if test="keywords != null and keywords != ''">
and (v3.code like concat("%", #{keywords},"%") or v3.number_plate like concat("%", #{keywords},"%"))
</if>
<if test="companyIds != null and companyIds.size > 0"> <if test="companyIds != null and companyIds.size > 0">
and (v1.lift_company in and (v1.lift_company in
<foreach collection="companyIds" item="id" open="(" separator="," close=")"> <foreach collection="companyIds" item="id" open="(" separator="," close=")">
......
...@@ -420,6 +420,12 @@ ...@@ -420,6 +420,12 @@
<if test="numberPlate != null and numberPlate != ''"> <if test="numberPlate != null and numberPlate != ''">
and v1.number_plate = #{numberPlate} and v1.number_plate = #{numberPlate}
</if> </if>
<if test="code != null and code != ''">
and v1.code = #{code}
</if>
<if test="keywords != null and keywords != ''">
and (v1.code like concat("%", #{keywords},"%") or v1.number_plate like concat("%", #{keywords},"%"))
</if>
<if test="companyIds != null and companyIds.size > 0"> <if test="companyIds != null and companyIds.size > 0">
and v1.park_branch_company_id in and v1.park_branch_company_id in
<foreach collection="companyIds" item="id" open="(" separator="," close=")"> <foreach collection="companyIds" item="id" open="(" separator="," close=")">
......
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