Commit 3cd4d3a9 authored by youjj's avatar youjj

车辆管理相关修改

parent cba67f5a
...@@ -56,8 +56,9 @@ public class VehicleActiveService { ...@@ -56,8 +56,9 @@ public class VehicleActiveService {
ResCode.VEHICLE_DEPARTURE_VEHICLE_DISABLE.getCode()); ResCode.VEHICLE_DEPARTURE_VEHICLE_DISABLE.getCode());
} }
// 写入车辆公里数 // 写入车辆公里数,预计目的地
vehicle.setMileageLastUpdate(departureVo.getMileage()); vehicle.setMileageLastUpdate(departureVo.getMileage());
vehicle.setExpectDestinationBranchCompanyId(departureVo.getExpectArrivalBranchCompanyId());
vehicleMapper.updateByPrimaryKeySelective(vehicle); vehicleMapper.updateByPrimaryKeySelective(vehicle);
// 修改车辆状态,确认是空闲状态 // 修改车辆状态,确认是空闲状态
...@@ -100,8 +101,10 @@ public class VehicleActiveService { ...@@ -100,8 +101,10 @@ public class VehicleActiveService {
ResCode.VEHICLE_DEPARTURE_VEHICLE_UNDEPARTURE.getCode()); ResCode.VEHICLE_DEPARTURE_VEHICLE_UNDEPARTURE.getCode());
} }
// 写入车辆公里数 // 写入车辆公里数,还车分公司id
vehicle.setMileageLastUpdate(arrivalVo.getMileage()); vehicle.setMileageLastUpdate(arrivalVo.getMileage());
vehicle.setParkBranchCompanyId(arrivalVo.getArrivalBranchCompanyId());
vehicle.setExpectDestinationBranchCompanyId(0);
vehicleMapper.updateByPrimaryKeySelective(vehicle); vehicleMapper.updateByPrimaryKeySelective(vehicle);
// 修改状态,确认是出车状态 // 修改状态,确认是出车状态
......
...@@ -83,7 +83,6 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -83,7 +83,6 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
/** /**
* 写入上传文件,返回相对路径 * 写入上传文件,返回相对路径
* @param file * @param file
* @param vehicleId
* @return * @return
*/ */
public RestResponse<String> uploadDrivingLicense(MultipartFile file) throws Exception{ public RestResponse<String> uploadDrivingLicense(MultipartFile file) throws Exception{
...@@ -793,6 +792,32 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -793,6 +792,32 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
PageInfo<QueryVehicleVo> vehiclePageInfo = new PageInfo<>(vehicles); PageInfo<QueryVehicleVo> vehiclePageInfo = new PageInfo<>(vehicles);
return PageDataVo.pageInfo(vehiclePageInfo); return PageDataVo.pageInfo(vehiclePageInfo);
} }
/**
* 按页查询(非所有数据,过滤分公司信息)
* @param vehiclePageQueryVo
* @return
* @throws Exception
*/
public PageDataVo<QueryVehicleVo> getByPageNotAllData(VehiclePageQueryVo vehiclePageQueryVo, List<Integer> companyList) throws Exception{
Map<String, Object> params = PropertyUtils.describe(vehiclePageQueryVo);
Integer pageSize = (Integer) params.get("limit");
params.remove("pageSize");
Integer pageNo = (Integer) params.get("page");
params.remove("pageNo");
//处理预定日期相关参数
adjustBookedInfoParam(params,vehiclePageQueryVo);
if (companyList != null && companyList.size() > 0) {
params.put("companyList", companyList);
} else {
params.put("companyList", Arrays.asList(-1));
}
PageHelper.startPage(pageNo,pageSize);
List<QueryVehicleVo> vehicles = mapper.getByPageNotAllData(params);
PageInfo<QueryVehicleVo> vehiclePageInfo = new PageInfo<>(vehicles);
return PageDataVo.pageInfo(vehiclePageInfo);
}
public List<Integer> dataCompany(String dataZone, String dataCompany) { public List<Integer> dataCompany(String dataZone, String dataCompany) {
List<BranchCompany> zoneCompanys = branchCompanyBiz.dataCompany(dataZone); List<BranchCompany> zoneCompanys = branchCompanyBiz.dataCompany(dataZone);
......
...@@ -13,6 +13,9 @@ import com.xinxincaravan.caravan.vehicle.vo.VehicleDepartureStatisticDataVo; ...@@ -13,6 +13,9 @@ import com.xinxincaravan.caravan.vehicle.vo.VehicleDepartureStatisticDataVo;
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 java.util.Arrays;
import java.util.List;
@Service @Service
public class VehicleDepartureService { public class VehicleDepartureService {
...@@ -27,6 +30,14 @@ public class VehicleDepartureService { ...@@ -27,6 +30,14 @@ public class VehicleDepartureService {
return new PageInfo<>(vehicleDepartureLogMapper.selectVoAll(numberPlate)); return new PageInfo<>(vehicleDepartureLogMapper.selectVoAll(numberPlate));
} }
public PageInfo<VehicleDepartureLogVo> pageNotAllData(String numberPlate, Integer page, Integer limit, List<Integer> companyList) {
PageHelper.startPage(page, limit);
if (companyList == null || companyList.size() == 0) {
companyList = Arrays.asList(-1);
}
return new PageInfo<>(vehicleDepartureLogMapper.selectVoAllNotAllData(numberPlate, companyList));
}
public PageInfo<VehicleDepartureLogVo> findByVehicle(String vehicleId, Integer page, Integer limit) { public PageInfo<VehicleDepartureLogVo> findByVehicle(String vehicleId, Integer page, Integer limit) {
PageHelper.startPage(page, limit); PageHelper.startPage(page, limit);
return new PageInfo<>(vehicleDepartureLogMapper.selectByVehicleId(vehicleId)); return new PageInfo<>(vehicleDepartureLogMapper.selectByVehicleId(vehicleId));
......
...@@ -64,7 +64,8 @@ public class WebConfiguration implements WebMvcConfigurer { ...@@ -64,7 +64,8 @@ public class WebConfiguration implements WebMvcConfigurer {
ArrayList<String> list = new ArrayList<>(); ArrayList<String> list = new ArrayList<>();
String[] urls = { String[] urls = {
"/vehicleInfo/**", "/vehicleInfo/**",
"/branchCompany/**" "/branchCompany/**",
"/departure/**"
}; };
Collections.addAll(list, urls); Collections.addAll(list, urls);
return list; return list;
......
...@@ -127,5 +127,13 @@ public class Vehicle { ...@@ -127,5 +127,13 @@ public class Vehicle {
* 最后更新里程数 * 最后更新里程数
*/ */
private Integer mileageLastUpdate; private Integer mileageLastUpdate;
/**
* 停车分公司id
*/
private Integer parkBranchCompanyId;
/**
* 预计目的地分公司id
*/
private Integer expectDestinationBranchCompanyId;
} }
\ No newline at end of file
...@@ -15,6 +15,8 @@ public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLo ...@@ -15,6 +15,8 @@ public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLo
List<VehicleDepartureLogVo> selectVoAll(@Param("numberPlate") String numberPlate); List<VehicleDepartureLogVo> selectVoAll(@Param("numberPlate") String numberPlate);
List<VehicleDepartureLogVo> selectVoAllNotAllData(@Param("numberPlate") String numberPlate, @Param("companyList") List<Integer> companyList);
Integer selectMileageByVehicleId(String vehicleId); Integer selectMileageByVehicleId(String vehicleId);
Integer selectDayByVehicleId(String vehicleId); Integer selectDayByVehicleId(String vehicleId);
......
...@@ -12,6 +12,7 @@ import java.util.Map; ...@@ -12,6 +12,7 @@ import java.util.Map;
public interface VehicleMapper extends Mapper<Vehicle> { public interface VehicleMapper extends Mapper<Vehicle> {
public List<QueryVehicleVo> getByPage(Map<String,Object> params); public List<QueryVehicleVo> getByPage(Map<String,Object> params);
public List<QueryVehicleVo> getByPageNotAllData(Map<String,Object> params);
public int updateStatusById(Map<String,Object> params); public int updateStatusById(Map<String,Object> params);
......
...@@ -19,6 +19,8 @@ import com.xinxincaravan.caravan.vehicle.constant.VehicleBookRecordStatus; ...@@ -19,6 +19,8 @@ import com.xinxincaravan.caravan.vehicle.constant.VehicleBookRecordStatus;
import com.xinxincaravan.caravan.vehicle.entity.Vehicle; import com.xinxincaravan.caravan.vehicle.entity.Vehicle;
import com.xinxincaravan.caravan.vehicle.entity.VehicleBookInfo; import com.xinxincaravan.caravan.vehicle.entity.VehicleBookInfo;
import com.xinxincaravan.caravan.vehicle.entity.VehicleBookRecord; import com.xinxincaravan.caravan.vehicle.entity.VehicleBookRecord;
import com.xinxincaravan.caravan.vehicle.feign.UserFeign;
import com.xinxincaravan.caravan.vehicle.feign.dto.UserDTO;
import com.xinxincaravan.caravan.vehicle.vo.*; import com.xinxincaravan.caravan.vehicle.vo.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
...@@ -36,6 +38,7 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -36,6 +38,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@RestController @RestController
...@@ -47,52 +50,70 @@ public class VehicleController extends BaseController<VehicleBiz> { ...@@ -47,52 +50,70 @@ public class VehicleController extends BaseController<VehicleBiz> {
@Autowired @Autowired
private VehicleBookRecordBiz vehicleBookRecordBiz; private VehicleBookRecordBiz vehicleBookRecordBiz;
private static Integer MAX_DRIVING_LICENSE_SIZE = 10*1024*1024;//10M @Autowired
VehicleBiz vehicleBiz;
@Autowired
UserFeign userFeign;
@Autowired
private UserAuthConfig userAuthConfig;
private static Integer MAX_DRIVING_LICENSE_SIZE = 10 * 1024 * 1024;//10M
public static final DateTimeFormatter DEFAULT_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss"); public static final DateTimeFormatter DEFAULT_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
@RequestMapping(value ="/{id}",method = RequestMethod.GET) @RequestMapping(value = "/{id}", method = RequestMethod.GET)
public RestResponse<Vehicle> get(@PathVariable String id) { public RestResponse<Vehicle> get(@PathVariable String id) {
return RestResponse.data(baseBiz.get(id)); return RestResponse.data(baseBiz.get(id));
} }
@RequestMapping(value ="",method = RequestMethod.POST) @RequestMapping(value = "", method = RequestMethod.POST)
public RestResponse add(@RequestBody List<AddOrUpdateVehicleVo> addOrUpdateVehicleVoList) throws Exception{ public RestResponse add(@RequestBody List<AddOrUpdateVehicleVo> addOrUpdateVehicleVoList) throws Exception {
return baseBiz.add(addOrUpdateVehicleVoList); return baseBiz.add(addOrUpdateVehicleVoList);
} }
@RequestMapping(value ="",method = RequestMethod.PUT) @RequestMapping(value = "", method = RequestMethod.PUT)
public RestResponse update(@RequestBody List<AddOrUpdateVehicleVo> addOrUpdateVehicleVoList) throws Exception{ public RestResponse update(@RequestBody List<AddOrUpdateVehicleVo> addOrUpdateVehicleVoList) throws Exception {
return baseBiz.update(addOrUpdateVehicleVoList); return baseBiz.update(addOrUpdateVehicleVoList);
} }
@RequestMapping(value ="",method = RequestMethod.DELETE) @RequestMapping(value = "", method = RequestMethod.DELETE)
public RestResponse discard(@RequestBody List<String> idList) throws Exception{ public RestResponse discard(@RequestBody List<String> idList) throws Exception {
return baseBiz.discard(idList); return baseBiz.discard(idList);
} }
@RequestMapping(value ="/page",method = RequestMethod.GET) @RequestMapping(value = "/page", method = RequestMethod.GET)
public RestResponse<PageDataVo<QueryVehicleVo>> getByPage(@RequestParam String vehiclePageQueryVoJson) throws Exception{ public RestResponse<PageDataVo<QueryVehicleVo>> getByPage(@RequestParam String vehiclePageQueryVoJson) throws Exception {
VehiclePageQueryVo vehiclePageQueryVo = null; VehiclePageQueryVo vehiclePageQueryVo = null;
try { try {
vehiclePageQueryVo = JSON.parseObject(vehiclePageQueryVoJson,VehiclePageQueryVo.class); vehiclePageQueryVo = JSON.parseObject(vehiclePageQueryVoJson, VehiclePageQueryVo.class);
return RestResponse.data(baseBiz.getByPage(vehiclePageQueryVo));
UserDTO userDTO = userFeign.userinfoByToken(userAuthConfig.getToken(request)).getData();
if (userDTO != null) {
if (userDTO.getDataAll() == 2) {
List<Integer> companyList = vehicleBiz.dataCompany(userDTO.getDataZone(), userDTO.getDataCompany());
return RestResponse.data(baseBiz.getByPageNotAllData(vehiclePageQueryVo, companyList));
}
}
return RestResponse.data(baseBiz.getByPage(vehiclePageQueryVo));
} catch (JSONException ex) { } catch (JSONException ex) {
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode()); return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
} catch (CustomIllegalParamException ex){ } catch (CustomIllegalParamException ex) {
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode()); return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
} }
} }
@RequestMapping(value ="/upload/drivingLicense",method = RequestMethod.POST) @RequestMapping(value = "/upload/drivingLicense", method = RequestMethod.POST)
public RestResponse uploadDrivingLicense(@RequestParam("file") MultipartFile file) public RestResponse uploadDrivingLicense(@RequestParam("file") MultipartFile file)
throws Exception{ throws Exception {
String contentType = file.getContentType(); //图片文件类型 String contentType = file.getContentType(); //图片文件类型
// String fileName = file.getOriginalFilename(); //图片名字 // String fileName = file.getOriginalFilename(); //图片名字
if(!contentType.equals("image/jpeg") && !contentType.equals("image/gif")){ if (!contentType.equals("image/jpeg") && !contentType.equals("image/gif")) {
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode()); return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
} }
if(file.getSize() > MAX_DRIVING_LICENSE_SIZE){ if (file.getSize() > MAX_DRIVING_LICENSE_SIZE) {
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode()); return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
} }
return baseBiz.uploadDrivingLicense(file); return baseBiz.uploadDrivingLicense(file);
...@@ -100,55 +121,58 @@ public class VehicleController extends BaseController<VehicleBiz> { ...@@ -100,55 +121,58 @@ public class VehicleController extends BaseController<VehicleBiz> {
@IgnoreUserToken @IgnoreUserToken
@RequestMapping(value="/download/drivingLicense",method=RequestMethod.GET) //匹配的是href中的download请求 @RequestMapping(value = "/download/drivingLicense", method = RequestMethod.GET) //匹配的是href中的download请求
public ResponseEntity<byte[]> downloadDrivingLicense(@RequestParam("realFileRelPath") String realFileRelPath) throws Exception { public ResponseEntity<byte[]> downloadDrivingLicense(@RequestParam("realFileRelPath") String realFileRelPath) throws Exception {
return baseBiz.downloadDrivingLicense(realFileRelPath); return baseBiz.downloadDrivingLicense(realFileRelPath);
} }
@RequestMapping(value ="/bookedInfo/{vehicleId}/{yearMonth}",method = RequestMethod.GET) @RequestMapping(value = "/bookedInfo/{vehicleId}/{yearMonth}", method = RequestMethod.GET)
public RestResponse<VehicleBookInfo> getBookedInfo(@PathVariable String vehicleId, @PathVariable String yearMonth) { public RestResponse<VehicleBookInfo> getBookedInfo(@PathVariable String vehicleId, @PathVariable String yearMonth) {
return RestResponse.data(baseBiz.getByVehicleIdAndYearMonth(vehicleId,yearMonth)); return RestResponse.data(baseBiz.getByVehicleIdAndYearMonth(vehicleId, yearMonth));
} }
@RequestMapping(value ="/bookedInfo/{vehicleId}",method = RequestMethod.GET) @RequestMapping(value = "/bookedInfo/{vehicleId}", method = RequestMethod.GET)
public RestResponse<List<VehicleBookInfo>> getBookedInfo(@PathVariable String vehicleId) { public RestResponse<List<VehicleBookInfo>> getBookedInfo(@PathVariable String vehicleId) {
return RestResponse.data(baseBiz.getByVehicleIdAndYearMonth(vehicleId)); return RestResponse.data(baseBiz.getByVehicleIdAndYearMonth(vehicleId));
} }
/** /**
* 申请预定车辆 * 申请预定车辆
*
* @param bookVehicleVo * @param bookVehicleVo
* @return * @return
*/ */
@RequestMapping(value ="/book/4employee",method = RequestMethod.POST) @RequestMapping(value = "/book/4employee", method = RequestMethod.POST)
public RestResponse<Integer> applyVehicle(@RequestBody BookVehicleVo bookVehicleVo) throws Exception{ public RestResponse<Integer> applyVehicle(@RequestBody BookVehicleVo bookVehicleVo) throws Exception {
Integer operatorId = Integer.parseInt(BaseContextHandler.getUserID()); Integer operatorId = Integer.parseInt(BaseContextHandler.getUserID());
String userName = BaseContextHandler.getName(); String userName = BaseContextHandler.getName();
return baseBiz.applyVehicle4Employee(operatorId,bookVehicleVo,userName); return baseBiz.applyVehicle4Employee(operatorId, bookVehicleVo, userName);
} }
/** /**
* 批准预定车辆预定 * 批准预定车辆预定
*
* @param bookRecordId * @param bookRecordId
* @return * @return
*/ */
@RequestMapping(value ="/book/4employee/prove/{bookRecordId}",method = RequestMethod.PUT) @RequestMapping(value = "/book/4employee/prove/{bookRecordId}", method = RequestMethod.PUT)
public RestResponse<Integer> proveVehicleBooking(@PathVariable Long bookRecordId) throws Exception{ public RestResponse<Integer> proveVehicleBooking(@PathVariable Long bookRecordId) throws Exception {
Integer operatorId = Integer.parseInt(BaseContextHandler.getUserID()); Integer operatorId = Integer.parseInt(BaseContextHandler.getUserID());
String userName = BaseContextHandler.getName(); String userName = BaseContextHandler.getName();
return baseBiz.reviewVehicleBooking(operatorId, bookRecordId, VehicleBookRecordStatus.APPROVE.getCode(),userName); return baseBiz.reviewVehicleBooking(operatorId, bookRecordId, VehicleBookRecordStatus.APPROVE.getCode(), userName);
} }
/** /**
* 拒绝预定车辆申请 * 拒绝预定车辆申请
*
* @param bookRecordId * @param bookRecordId
* @return * @return
*/ */
@RequestMapping(value ="/book/4employee/reject/{bookRecordId}",method = RequestMethod.PUT) @RequestMapping(value = "/book/4employee/reject/{bookRecordId}", method = RequestMethod.PUT)
public RestResponse<Integer> rejectVehicleBooking(@PathVariable Long bookRecordId) throws Exception{ public RestResponse<Integer> rejectVehicleBooking(@PathVariable Long bookRecordId) throws Exception {
Integer operatorId = Integer.parseInt(BaseContextHandler.getUserID()); Integer operatorId = Integer.parseInt(BaseContextHandler.getUserID());
String userName = BaseContextHandler.getName(); String userName = BaseContextHandler.getName();
return baseBiz.reviewVehicleBooking(operatorId, bookRecordId, VehicleBookRecordStatus.REJECTED.getCode(),userName); return baseBiz.reviewVehicleBooking(operatorId, bookRecordId, VehicleBookRecordStatus.REJECTED.getCode(), userName);
} }
// /** // /**
...@@ -167,40 +191,41 @@ public class VehicleController extends BaseController<VehicleBiz> { ...@@ -167,40 +191,41 @@ public class VehicleController extends BaseController<VehicleBiz> {
/** /**
* 取消车辆预订 * 取消车辆预订
*
* @param bookRecordId * @param bookRecordId
* @return * @return
*/ */
@RequestMapping(value ="/unbook/4employee/{bookRecordId}",method = RequestMethod.DELETE) @RequestMapping(value = "/unbook/4employee/{bookRecordId}", method = RequestMethod.DELETE)
public RestResponse<Integer> unbookVehicle(@PathVariable Long bookRecordId) throws Exception{ public RestResponse<Integer> unbookVehicle(@PathVariable Long bookRecordId) throws Exception {
Integer operatorId = Integer.parseInt(BaseContextHandler.getUserID()); Integer operatorId = Integer.parseInt(BaseContextHandler.getUserID());
String userName = BaseContextHandler.getName(); String userName = BaseContextHandler.getName();
return baseBiz.unbookVehicle4Employee(operatorId,bookRecordId,userName); return baseBiz.unbookVehicle4Employee(operatorId, bookRecordId, userName);
} }
@RequestMapping(value ="/bookedRecord/{bookEndDate}/{id}",method = RequestMethod.GET) @RequestMapping(value = "/bookedRecord/{bookEndDate}/{id}", method = RequestMethod.GET)
public RestResponse<QueryVehicleBookRecordVo> getBookedRecord(@PathVariable String bookEndDate,@PathVariable Long id) throws Exception{ public RestResponse<QueryVehicleBookRecordVo> getBookedRecord(@PathVariable String bookEndDate, @PathVariable Long id) throws Exception {
try { try {
return RestResponse.codeAndData(RestResponse.SUC_CODE,vehicleBookRecordBiz.getById(id, DateTime.parse(bookEndDate,DEFAULT_FORMATTER))); return RestResponse.codeAndData(RestResponse.SUC_CODE, vehicleBookRecordBiz.getById(id, DateTime.parse(bookEndDate, DEFAULT_FORMATTER)));
} catch (JSONException ex) { } catch (JSONException ex) {
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode()); return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
} catch (CustomIllegalParamException ex){ } catch (CustomIllegalParamException ex) {
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode()); return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
} }
} }
@RequestMapping(value ="/bookedRecord",method = RequestMethod.GET) @RequestMapping(value = "/bookedRecord", method = RequestMethod.GET)
public RestResponse<PageDataVo<QueryVehicleBookRecordVo>> getBookedRecord(@RequestParam String vehicleBookRecordQueryVoJson) throws Exception{ public RestResponse<PageDataVo<QueryVehicleBookRecordVo>> getBookedRecord(@RequestParam String vehicleBookRecordQueryVoJson) throws Exception {
VehicleBookRecordQueryVo vehicleBookRecordQueryVo = null; VehicleBookRecordQueryVo vehicleBookRecordQueryVo = null;
try { try {
vehicleBookRecordQueryVo = JSON.parseObject(vehicleBookRecordQueryVoJson,VehicleBookRecordQueryVo.class); vehicleBookRecordQueryVo = JSON.parseObject(vehicleBookRecordQueryVoJson, VehicleBookRecordQueryVo.class);
return RestResponse.data(vehicleBookRecordBiz.page(vehicleBookRecordQueryVo)); return RestResponse.data(vehicleBookRecordBiz.page(vehicleBookRecordQueryVo));
} catch (JSONException ex) { } catch (JSONException ex) {
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode()); return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
} catch (CustomIllegalParamException ex){ } catch (CustomIllegalParamException ex) {
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode()); return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
} }
...@@ -208,26 +233,28 @@ public class VehicleController extends BaseController<VehicleBiz> { ...@@ -208,26 +233,28 @@ public class VehicleController extends BaseController<VehicleBiz> {
/** /**
* 提车 * 提车
*
* @param liftVehicleVo * @param liftVehicleVo
* @return * @return
*/ */
@RequestMapping(value ="/book/4employee/lift",method = RequestMethod.PUT) @RequestMapping(value = "/book/4employee/lift", method = RequestMethod.PUT)
public RestResponse<Integer> liftVehicle(@RequestBody LiftVehicleVo liftVehicleVo) throws Exception{ public RestResponse<Integer> liftVehicle(@RequestBody LiftVehicleVo liftVehicleVo) throws Exception {
Integer operatorId = Integer.parseInt(BaseContextHandler.getUserID()); Integer operatorId = Integer.parseInt(BaseContextHandler.getUserID());
String userName = BaseContextHandler.getName(); String userName = BaseContextHandler.getName();
return vehicleBookRecordBiz.lift(operatorId,userName,liftVehicleVo); return vehicleBookRecordBiz.lift(operatorId, userName, liftVehicleVo);
} }
/** /**
* 还车 * 还车
*
* @param retVehicleVo * @param retVehicleVo
* @return * @return
*/ */
@RequestMapping(value ="/book/4employee/ret",method = RequestMethod.PUT) @RequestMapping(value = "/book/4employee/ret", method = RequestMethod.PUT)
public RestResponse<Integer> retVehicle(@RequestBody RetVehicleVo retVehicleVo) throws Exception{ public RestResponse<Integer> retVehicle(@RequestBody RetVehicleVo retVehicleVo) throws Exception {
Integer operatorId = Integer.parseInt(BaseContextHandler.getUserID()); Integer operatorId = Integer.parseInt(BaseContextHandler.getUserID());
String userName = BaseContextHandler.getName(); String userName = BaseContextHandler.getName();
return vehicleBookRecordBiz.retVehicle(operatorId,userName,retVehicleVo); return vehicleBookRecordBiz.retVehicle(operatorId, userName, retVehicleVo);
} }
......
package com.xinxincaravan.caravan.vehicle.rest; package com.xinxincaravan.caravan.vehicle.rest;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken; import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.xinxincaravan.caravan.vehicle.biz.VehicleBiz;
import com.xinxincaravan.caravan.vehicle.biz.VehicleDepartureService; import com.xinxincaravan.caravan.vehicle.biz.VehicleDepartureService;
import com.xinxincaravan.caravan.vehicle.common.RestResponse; import com.xinxincaravan.caravan.vehicle.common.RestResponse;
import com.xinxincaravan.caravan.vehicle.constant.ResCode.ResCode; import com.xinxincaravan.caravan.vehicle.constant.ResCode.ResCode;
import com.xinxincaravan.caravan.vehicle.feign.UserFeign;
import com.xinxincaravan.caravan.vehicle.feign.dto.UserDTO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
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 javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
@IgnoreClientToken @IgnoreClientToken
@RestController @RestController
@RequestMapping("departure") @RequestMapping("departure")
...@@ -16,13 +24,28 @@ public class VehicleDepartureController { ...@@ -16,13 +24,28 @@ public class VehicleDepartureController {
@Autowired @Autowired
VehicleDepartureService vehicleDepartureService; VehicleDepartureService vehicleDepartureService;
@Autowired
VehicleBiz vehicleBiz;
@Autowired
UserFeign userFeign;
@Autowired
private UserAuthConfig userAuthConfig;
@GetMapping("page") @GetMapping("page")
public RestResponse page(String numberPlate, Integer page, Integer limit) { public RestResponse page(String numberPlate, Integer page, Integer limit, HttpServletRequest request) {
if (page == null || limit == null) { if (page == null || limit == null) {
page = 1; page = 1;
limit = 10; limit = 10;
} }
UserDTO userDTO = userFeign.userinfoByToken(userAuthConfig.getToken(request)).getData();
if (userDTO != null) {
if (userDTO.getDataAll() == 2) {
List<Integer> companyList = vehicleBiz.dataCompany(userDTO.getDataZone(), userDTO.getDataCompany());
return RestResponse.data(vehicleDepartureService.pageNotAllData(numberPlate, page, limit, companyList));
}
}
return RestResponse.suc(vehicleDepartureService.page(numberPlate, page, limit)); return RestResponse.suc(vehicleDepartureService.page(numberPlate, page, limit));
} }
......
...@@ -27,6 +27,34 @@ ...@@ -27,6 +27,34 @@
</trim> </trim>
order by create_time desc order by create_time desc
</select> </select>
<select id="selectVoAllNotAllData" resultType="com.xinxincaravan.caravan.vehicle.vo.VehicleDepartureLogVo">
select vehicle_departure_log.*,vehicle.number_plate
from vehicle_departure_log
left join vehicle on vehicle_departure_log.vehicle_id = vehicle.id
<trim prefix="where" suffixOverrides="and">
<if test="numberPlate != null and numberPlate != ''">
vehicle.number_plate = #{numberPlate} and
</if>
<if test="companyList != null">
( vehicle.park_branch_company_id in (
<foreach collection="companyList" item="companyId">
<trim suffixOverrides=",">
#{companyId},
</trim>
</foreach>
)
or vehicle.expect_destination_branch_company_id in (
<foreach collection="companyList" item="companyId">
<trim suffixOverrides=",">
#{companyId},
</trim>
</foreach>
)
)
</if>
</trim>
order by create_time desc
</select>
<select id="selectMileageByVehicleId" resultType="int"> <select id="selectMileageByVehicleId" resultType="int">
select sum(mileage_end - mileage_start) select sum(mileage_end - mileage_start)
from vehicle_departure_log from vehicle_departure_log
......
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.xinxincaravan.caravan.vehicle.mapper.VehicleMapper" > <mapper namespace="com.xinxincaravan.caravan.vehicle.mapper.VehicleMapper">
<update id="updateStatusById" parameterType="java.util.Map" > <update id="updateStatusById" parameterType="java.util.Map">
update vehicle set status = #{status} where id in update vehicle set status = #{status} where id in
<foreach collection="idList" index="i" item="item" separator="," open="(" close=")"> <foreach collection="idList" index="i" item="item" separator="," open="(" close=")">
#{item} #{item}
...@@ -10,98 +10,209 @@ ...@@ -10,98 +10,209 @@
</update> </update>
<select id="getByPage" parameterType="java.util.Map" resultType="com.xinxincaravan.caravan.vehicle.vo.QueryVehicleVo"> <select id="getByPage" parameterType="java.util.Map"
select v.`id`, resultType="com.xinxincaravan.caravan.vehicle.vo.QueryVehicleVo">
v.`code`, select v.`id`,
v.`status`, v.`code`,
v.number_plate, v.`status`,
v.brand, v.number_plate,
v.subordinate_branch, v.brand,
bc.name as subBranchName, v.subordinate_branch,
v.use_type, bc.name as subBranchName,
v.remark, v.use_type,
v.create_time, v.remark,
v.vin, v.create_time,
v.insurance_company, v.vin,
v.insurance_no, v.insurance_company,
v.insurance_start_date, v.insurance_no,
v.insurance_end_date, v.insurance_start_date,
v.annual_verification_date, v.insurance_end_date,
v.maintenance_date, v.annual_verification_date,
v.maintenance_mileage, v.maintenance_date,
v.belong_to, v.maintenance_mileage,
v.belong_to_name, v.belong_to,
v.driving_license_path, v.belong_to_name,
v.engine_num, v.driving_license_path,
v.manufacturer, v.engine_num,
v.receive_time, v.manufacturer,
v.update_time v.receive_time,
<if test=" yearMonthAndParam !=null "> v.update_time
,vbi.booked_date <if test=" yearMonthAndParam !=null ">
</if> ,vbi.booked_date
from vehicle v </if>
<if test=" yearMonthAndParam !=null "> from vehicle v
left join <if test=" yearMonthAndParam !=null ">
vehicle_book_info vbi on v.`id` = vbi.vehicle left join
</if> vehicle_book_info vbi on v.`id` = vbi.vehicle
left join branch_company bc on v.`subordinate_branch` = bc.id </if>
where left join branch_company bc on v.`subordinate_branch` = bc.id
where
1=1
<if test="mRangeDateEnd !=null">
and v.maintenance_date &lt;= #{mRangeDateEnd}
</if>
<if test="mRangeDateStart !=null">
and v.maintenance_date &gt;= #{mRangeDateStart}
</if>
<if test="aVRangeDateStart !=null">
and v.annual_verification_date &lt;= #{aVRangeDateEnd}
</if>
<if test="aVRangeDateEnd !=null">
and v.annual_verification_date &gt;= #{aVRangeDateStart}
</if>
<if test="insuranceDateRangeStart !=null">
and v.insurance_end_date &lt;= #{insuranceDateRangeEnd}
</if>
<if test="insuranceDateRangeEnd !=null">
and v.insurance_end_date &gt;= #{insuranceDateRangeStart}
</if>
<if test="insuranceCompany !=null">
and v.insurance_company = #{insuranceCompany}
</if>
<if test="vin !=null and vin != ''">
and v.vin = #{vin}
</if>
<if test="subordinateBranch !=null">
and v.subordinate_branch = #{subordinateBranch}
</if>
<if test="code !=null">
and v.code = #{code}
</if>
<if test="status !=null">
and v.status = #{status}
</if>
<if test="numberPlate !=null and numberPlate != ''">
and v.number_plate = #{numberPlate}
</if>
<if test="brand !=null">
and v.brand = #{brand}
</if>
<if test="useType !=null">
and v.use_type = #{useType}
</if>
<!-- 若需根据预定日期条件查询,针对换为位操作 -->
<if test=" yearMonthAndParam !=null ">
<foreach collection="yearMonthAndParam" index="yearMonth" item="andOperation">
and
( (vbi.`year_month` = #{yearMonth} or vbi.`year_month` is null) and
ifnull(vbi.`booked_date`,0) &amp; #{andOperation.andOperationFactor} = #{andOperation.andOperationRs}
)
</foreach>
</if>
order by v.code
</select>
<select id="getByPageNotAllData" parameterType="java.util.Map"
resultType="com.xinxincaravan.caravan.vehicle.vo.QueryVehicleVo">
select v.`id`,
v.`code`,
v.`status`,
v.number_plate,
v.brand,
v.subordinate_branch,
bc.name as subBranchName,
v.use_type,
v.remark,
v.create_time,
v.vin,
v.insurance_company,
v.insurance_no,
v.insurance_start_date,
v.insurance_end_date,
v.annual_verification_date,
v.maintenance_date,
v.maintenance_mileage,
v.belong_to,
v.belong_to_name,
v.driving_license_path,
v.engine_num,
v.manufacturer,
v.receive_time,
v.update_time
<if test=" yearMonthAndParam !=null ">
,vbi.booked_date
</if>
from vehicle v
<if test=" yearMonthAndParam !=null ">
left join
vehicle_book_info vbi on v.`id` = vbi.vehicle
</if>
left join branch_company bc on v.`subordinate_branch` = bc.id
where
1=1 1=1
<if test="mRangeDateEnd !=null"> <if test="companyList != null">
and v.maintenance_date &lt;= #{mRangeDateEnd} and ( v.park_branch_company_id in (
</if> <foreach collection="companyList" item="companyId">
<if test="mRangeDateStart !=null"> <trim suffixOverrides=",">
and v.maintenance_date &gt;= #{mRangeDateStart} #{companyId},
</if> </trim>
<if test="aVRangeDateStart !=null"> </foreach>
and v.annual_verification_date &lt;= #{aVRangeDateEnd} )
</if> or v.expect_destination_branch_company_id in (
<if test="aVRangeDateEnd !=null"> <foreach collection="companyList" item="companyId">
and v.annual_verification_date &gt;= #{aVRangeDateStart} <trim suffixOverrides=",">
</if> #{companyId},
<if test="insuranceDateRangeStart !=null"> </trim>
and v.insurance_end_date &lt;= #{insuranceDateRangeEnd} </foreach>
</if> )
<if test="insuranceDateRangeEnd !=null"> )
and v.insurance_end_date &gt;= #{insuranceDateRangeStart} </if>
</if> <if test="mRangeDateEnd !=null">
<if test="insuranceCompany !=null"> and v.maintenance_date &lt;= #{mRangeDateEnd}
and v.insurance_company = #{insuranceCompany} </if>
</if> <if test="mRangeDateStart !=null">
<if test="vin !=null and vin != ''"> and v.maintenance_date &gt;= #{mRangeDateStart}
and v.vin = #{vin} </if>
</if> <if test="aVRangeDateStart !=null">
<if test="subordinateBranch !=null"> and v.annual_verification_date &lt;= #{aVRangeDateEnd}
and v.subordinate_branch = #{subordinateBranch} </if>
</if> <if test="aVRangeDateEnd !=null">
<if test="code !=null"> and v.annual_verification_date &gt;= #{aVRangeDateStart}
and v.code = #{code} </if>
</if> <if test="insuranceDateRangeStart !=null">
<if test="status !=null"> and v.insurance_end_date &lt;= #{insuranceDateRangeEnd}
and v.status = #{status} </if>
</if> <if test="insuranceDateRangeEnd !=null">
<if test="numberPlate !=null and numberPlate != ''"> and v.insurance_end_date &gt;= #{insuranceDateRangeStart}
and v.number_plate = #{numberPlate} </if>
</if> <if test="insuranceCompany !=null">
<if test="brand !=null"> and v.insurance_company = #{insuranceCompany}
and v.brand = #{brand} </if>
</if> <if test="vin !=null and vin != ''">
<if test="useType !=null"> and v.vin = #{vin}
and v.use_type = #{useType} </if>
</if> <if test="subordinateBranch !=null">
<!-- 若需根据预定日期条件查询,针对换为位操作 --> and v.subordinate_branch = #{subordinateBranch}
<if test=" yearMonthAndParam !=null "> </if>
<foreach collection="yearMonthAndParam" index="yearMonth" item="andOperation" > <if test="code !=null">
and and v.code = #{code}
</if>
<if test="status !=null">
and v.status = #{status}
</if>
<if test="numberPlate !=null and numberPlate != ''">
and v.number_plate = #{numberPlate}
</if>
<if test="brand !=null">
and v.brand = #{brand}
</if>
<if test="useType !=null">
and v.use_type = #{useType}
</if>
<!-- 若需根据预定日期条件查询,针对换为位操作 -->
<if test=" yearMonthAndParam !=null ">
<foreach collection="yearMonthAndParam" index="yearMonth" item="andOperation">
and
( (vbi.`year_month` = #{yearMonth} or vbi.`year_month` is null) and ( (vbi.`year_month` = #{yearMonth} or vbi.`year_month` is null) and
ifnull(vbi.`booked_date`,0) &amp; #{andOperation.andOperationFactor} = #{andOperation.andOperationRs} ifnull(vbi.`booked_date`,0) &amp; #{andOperation.andOperationFactor} = #{andOperation.andOperationRs}
) )
</foreach> </foreach>
</if> </if>
order by v.code order by v.code
</select> </select>
<select id="lockByCode" resultType="com.xinxincaravan.caravan.vehicle.entity.Vehicle" parameterType="com.xinxincaravan.caravan.vehicle.vo.AddOrUpdateVehicleVo"> <select id="lockByCode" resultType="com.xinxincaravan.caravan.vehicle.entity.Vehicle"
parameterType="com.xinxincaravan.caravan.vehicle.vo.AddOrUpdateVehicleVo">
select select
v.`id`, v.`id`,
v.`code`, v.`code`,
......
...@@ -47,13 +47,13 @@ ...@@ -47,13 +47,13 @@
<property name="enableSubPackages" value="true"/> <property name="enableSubPackages" value="true"/>
</javaClientGenerator> </javaClientGenerator>
<table tableName="member_info" domainObjectName="MemberInfo" enableCountByExample="false" <!-- <table tableName="member_info" domainObjectName="MemberInfo" enableCountByExample="false"-->
enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" <!-- enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"-->
selectByExampleQueryId="false"/> <!-- selectByExampleQueryId="false"/>-->
<table tableName="member_family_info" domainObjectName="MemberFamilyInfo" enableCountByExample="false" <!-- <table tableName="member_family_info" domainObjectName="MemberFamilyInfo" enableCountByExample="false"-->
enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" <!-- enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"-->
selectByExampleQueryId="false"/> <!-- selectByExampleQueryId="false"/>-->
</context> </context>
</generatorConfiguration> </generatorConfiguration>
\ No newline at end of file
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