Commit 643572c6 authored by 164003836@qq.con's avatar 164003836@qq.con

增加扯脸信息字段

parent 2577fce7
...@@ -7,11 +7,8 @@ import com.google.common.collect.Lists; ...@@ -7,11 +7,8 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.xinxincaravan.caravan.vehicle.common.CustomIllegalParamException; import com.xinxincaravan.caravan.vehicle.common.CustomIllegalParamException;
import com.xinxincaravan.caravan.vehicle.common.RestResponse; import com.xinxincaravan.caravan.vehicle.common.RestResponse;
import com.xinxincaravan.caravan.vehicle.constant.BookType; import com.xinxincaravan.caravan.vehicle.constant.*;
import com.xinxincaravan.caravan.vehicle.constant.ConstantType;
import com.xinxincaravan.caravan.vehicle.constant.ResCode.ResCode; import com.xinxincaravan.caravan.vehicle.constant.ResCode.ResCode;
import com.xinxincaravan.caravan.vehicle.constant.VehicleBookRecordStatus;
import com.xinxincaravan.caravan.vehicle.constant.VehicleStatus;
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;
...@@ -25,16 +22,27 @@ import org.apache.commons.beanutils.BeanUtils; ...@@ -25,16 +22,27 @@ import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
@Service @Service
@Slf4j @Slf4j
...@@ -57,12 +65,56 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -57,12 +65,56 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
private BranchCompanyBiz branchCompanyBiz; private BranchCompanyBiz branchCompanyBiz;
@Autowired @Autowired
private BookRecordAccItemMapper bookRecordAccItemMapper; private BookRecordAccItemMapper bookRecordAccItemMapper;
@Autowired
private RedisTemplate customRedisTemplate;
@Value("${vehicle.baseUploadPath}")
private String baseUploadPath ;
/** /**
* 每批次最大更、插入车辆最大条目数 * 每批次最大更、插入车辆最大条目数
*/ */
public static final Integer MAX_BATCH_SIZE_VEHICLE = 1;//使用了悲观锁,不开放批量更新 public static final Integer MAX_BATCH_SIZE_VEHICLE = 1;//使用了悲观锁,不开放批量更新
/**
* 写入上传文件,返回相对路径
* @param file
* @param vehicleId
* @return
*/
public RestResponse<String> uploadDrivingLicense(MultipartFile file) throws Exception{
//创建本日存放目录
DateTime now = DateTime.now();
String dirPathToday = File.separator + now.toString(DEFAULT_DATE_TIME_FORMATTER);
String redisNoKey = RedisKey.UPLOAD_FILE_NO_PREFIX + now.toString(DEFAULT_DATE_TIME_FORMATTER);
Long no = customRedisTemplate.opsForValue().increment(redisNoKey);
if(no.equals(1l)){
customRedisTemplate.expire(redisNoKey,1, TimeUnit.DAYS);
}
String fileName = file.getOriginalFilename();
String realFileRelPath = dirPathToday + File.separator + no + fileName.substring(fileName.lastIndexOf("."));
//文件存放路径
String filePath = baseUploadPath + realFileRelPath;
//将文件写入指定位置
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
return RestResponse.suc(realFileRelPath);
}
/**
* 下载行驶证图片
* @param realFileRelPath
* @return
* @throws Exception
*/
public ResponseEntity<byte[]> downloadDrivingLicense(String realFileRelPath) throws Exception{
String filePath = baseUploadPath + realFileRelPath;
File file = new File(filePath);//新建一个文件
HttpHeaders headers = new HttpHeaders();//http头信息
String downloadFileName = new String(file.getName());//设置编码
headers.setContentDispositionFormData("attachment", downloadFileName);
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
}
public Vehicle get(String id){ public Vehicle get(String id){
return mapper.selectByPrimaryKey(id); return mapper.selectByPrimaryKey(id);
...@@ -216,7 +268,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -216,7 +268,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
* @return * @return
*/ */
@Transactional @Transactional
public RestResponse applyVehicle4Employee(Integer userId,BookVehicleVo bookVehicleVo,String userName){ public RestResponse applyVehicle4Employee(Integer userId,BookVehicleVo bookVehicleVo,String userName) throws Exception{
//检查车辆信息是否合法 //检查车辆信息是否合法
checkIfVehicleExists(bookVehicleVo.getVehicle()); checkIfVehicleExists(bookVehicleVo.getVehicle());
//提取日期和相应的预定目标日期 //提取日期和相应的预定目标日期
......
...@@ -79,6 +79,7 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic ...@@ -79,6 +79,7 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
params.put("reviewerNameLift", userName); params.put("reviewerNameLift", userName);
params.put("targetStatus", VehicleBookRecordStatus.LIFTED.getCode()); params.put("targetStatus", VehicleBookRecordStatus.LIFTED.getCode());
params.put("conditionStatus", VehicleBookRecordStatus.APPROVE.getCode()); params.put("conditionStatus", VehicleBookRecordStatus.APPROVE.getCode());
params.put("mileageLift", liftVehicleVo.getMileageLift());
Integer effected = mapper.liftOrRet(params); Integer effected = mapper.liftOrRet(params);
if(effected == 0){ if(effected == 0){
return RestResponse.code(ResCode.VEHICLE_BOOKED_RECORD_STATUS_CHANGED.getCode()); return RestResponse.code(ResCode.VEHICLE_BOOKED_RECORD_STATUS_CHANGED.getCode());
...@@ -92,6 +93,8 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic ...@@ -92,6 +93,8 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
params.put("conditionStatus", VehicleBookRecordStatus.LIFTED.getCode()); params.put("conditionStatus", VehicleBookRecordStatus.LIFTED.getCode());
params.put("reviewerReturn", operatorId); params.put("reviewerReturn", operatorId);
params.put("reviewerNameReturn", userName); params.put("reviewerNameReturn", userName);
params.put("mileageRet", retVehicleVo.getMileageRet());
params.put("haveViolation", retVehicleVo.getHaveViolation());
Integer effected = mapper.liftOrRet(params); Integer effected = mapper.liftOrRet(params);
if(effected == 0){ if(effected == 0){
return RestResponse.code(ResCode.VEHICLE_BOOKED_RECORD_STATUS_CHANGED.getCode()); return RestResponse.code(ResCode.VEHICLE_BOOKED_RECORD_STATUS_CHANGED.getCode());
...@@ -172,14 +175,18 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic ...@@ -172,14 +175,18 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
*/ */
@Scheduled(cron = "0 0 1 1 * ?")//每月1号1点触发 @Scheduled(cron = "0 0 1 1 * ?")//每月1号1点触发
public void transfer2HistoryTb(){ public void transfer2HistoryTb(){
try {
//获取表格名称 //获取表格名称
DateTime now = DateTime.now();//当前获取的时间为标准 DateTime now = DateTime.now();//当前获取的时间为标准
log.info("开始预定记录迁移至历史表的定时任务。"); log.info("开始预定记录迁移至历史表的定时任务。");
Boolean needRun= copyDataLastMoth(now); Boolean needRun = copyDataLastMoth(now);
if(needRun) { if (needRun) {
//每月初将上上月数据从当前信息表中删除 //每月初将上上月数据从当前信息表中删除
delDataTheMonthBeforeLast(now); delDataTheMonthBeforeLast(now);
} }
}catch(Exception e){
log.error(e.getMessage());
}
} }
...@@ -188,7 +195,7 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic ...@@ -188,7 +195,7 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
* 获取上月数据,并复制到历史表 * 获取上月数据,并复制到历史表
*/ */
@Transactional @Transactional
public Boolean copyDataLastMoth(DateTime now){ public Boolean copyDataLastMoth(DateTime now) throws Exception{
String lastMonthStr = now.plusMonths(-1).toString(YEARMONTH_DATE_TIME_FORMATTER); String lastMonthStr = now.plusMonths(-1).toString(YEARMONTH_DATE_TIME_FORMATTER);
String redisKey = RedisKey.TRANSFER_BOOK_RECORD_LOCK_PREFIX +lastMonthStr; String redisKey = RedisKey.TRANSFER_BOOK_RECORD_LOCK_PREFIX +lastMonthStr;
String tbName = getTbName(now.plusMonths(-1).toString("yyyy")); String tbName = getTbName(now.plusMonths(-1).toString("yyyy"));
...@@ -217,32 +224,10 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic ...@@ -217,32 +224,10 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
if(CollectionUtils.isNotEmpty(vehicleBookRecords)){ if(CollectionUtils.isNotEmpty(vehicleBookRecords)){
//插入数据到历史表 //插入数据到历史表
for(VehicleBookRecord vehicleBookRecord : vehicleBookRecords){ for(VehicleBookRecord vehicleBookRecord : vehicleBookRecords){
Map<String, Object> insertHisParams = Maps.newHashMap(); VehicleBookRecordAndTbNameVo vehicleBookRecordAndTbNameVo = new VehicleBookRecordAndTbNameVo();
insertHisParams.put("tbName", tbName); BeanUtils.copyProperties(vehicleBookRecordAndTbNameVo,vehicleBookRecord);
insertHisParams.put("id", vehicleBookRecord.getId()); vehicleBookRecordAndTbNameVo.setTbName(tbName);
insertHisParams.put("vehicle", vehicleBookRecord.getVehicle()); mapper.insertHis(vehicleBookRecordAndTbNameVo);
insertHisParams.put("status", vehicleBookRecord.getStatus());
insertHisParams.put("bookType", vehicleBookRecord.getBookType());
insertHisParams.put("bookUser", vehicleBookRecord.getBookUser());
insertHisParams.put("contactInfo", vehicleBookRecord.getContactInfo());
insertHisParams.put("bookStartDate", vehicleBookRecord.getBookStartDate());
insertHisParams.put("bookEndDate", vehicleBookRecord.getBookEndDate());
insertHisParams.put("liftLocation", vehicleBookRecord.getLiftLocation());
insertHisParams.put("liftAddr", vehicleBookRecord.getLiftAddr());
insertHisParams.put("remark", vehicleBookRecord.getRemark());
insertHisParams.put("destination", vehicleBookRecord.getDestination());
insertHisParams.put("reviewerApply", vehicleBookRecord.getReviewerApply());
insertHisParams.put("reviewerReturn", vehicleBookRecord.getReviewerReturn());
insertHisParams.put("reviewerCancel", vehicleBookRecord.getReviewerCancel());
insertHisParams.put("actualStartDate", vehicleBookRecord.getActualStartDate());
insertHisParams.put("actualEndDate", vehicleBookRecord.getActualEndDate());
insertHisParams.put("reviewerLift", vehicleBookRecord.getReviewerLift());
insertHisParams.put("reviewerNameLift", vehicleBookRecord.getReviewerNameLift());
insertHisParams.put("liftCompany", vehicleBookRecord.getLiftCompany());
insertHisParams.put("liftRemark", vehicleBookRecord.getLiftRemark());
insertHisParams.put("retCompany", vehicleBookRecord.getRetCompany());
insertHisParams.put("retRemark", vehicleBookRecord.getRetRemark());
mapper.insertHis(insertHisParams);
} }
} }
curPageNo++; curPageNo++;
......
...@@ -44,6 +44,12 @@ public class RestResponse<T> extends BaseResponse { ...@@ -44,6 +44,12 @@ public class RestResponse<T> extends BaseResponse {
return new RestResponse<M>(); return new RestResponse<M>();
} }
public static <M> RestResponse<M> suc(M data){
RestResponse<M> restResponse = new RestResponse<M>();
restResponse.setData(data);
return restResponse;
}
public static <M> RestResponse<M> code(Integer code){ public static <M> RestResponse<M> code(Integer code){
RestResponse<M> restResponse = new RestResponse<M>(); RestResponse<M> restResponse = new RestResponse<M>();
restResponse.setCode(code); restResponse.setCode(code);
......
package com.xinxincaravan.caravan.vehicle.constant;
import com.google.common.collect.Maps;
import java.util.Map;
public enum BranchCompanyStatus {
PREPARING(1,"筹备中"),
SOFT_OPING(2,"试业中"),
ADD_SELECTION(3,"选址中"),
OPEN(4,"已开业"),
RENOVATION(5,"装修中"),
;
/**
* 编码
*/
private Integer code;
/**
* 类型描述
*/
private String desc;
private static Map<Integer,String> codeAndDesc = Maps.newHashMap();
static{
for(VehicleBookRecordStatus constantType : VehicleBookRecordStatus.values()){
codeAndDesc.put(constantType.getCode(),constantType.getDesc());
}
}
BranchCompanyStatus(Integer code, String desc){
this.code=code;
this.desc=desc;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public static Boolean exists(Integer code){
return codeAndDesc.containsKey(code);
}
}
...@@ -46,4 +46,9 @@ public class RedisKey { ...@@ -46,4 +46,9 @@ public class RedisKey {
// 随车物品相关key // 随车物品相关key
public static final String ACCOMPANYING_ITEM_CACHE_ALL ="cache:accompanyItem:all"; public static final String ACCOMPANYING_ITEM_CACHE_ALL ="cache:accompanyItem:all";
/**
* 服务器上传文件序号
*/
public static final String UPLOAD_FILE_NO_PREFIX ="upload:file:no:";
} }
package com.xinxincaravan.caravan.vehicle.constant;
import com.google.common.collect.Maps;
import java.util.Map;
public enum VehicleBelong2Type {
OWN(1,"欣新房车有限公司"),//自有
TRUST(2,"托管"),
RENTAL(3,"租赁"),
;
/**
* 编码
*/
private Integer code;
/**
* 类型描述
*/
private String desc;
private static Map<Integer,String> codeAndDesc = Maps.newHashMap();
static{
for(VehicleBelong2Type constantType : VehicleBelong2Type.values()){
codeAndDesc.put(constantType.getCode(),constantType.getDesc());
}
}
VehicleBelong2Type(Integer code, String desc){
this.code=code;
this.desc=desc;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public static Boolean exists(Integer code){
return codeAndDesc.containsKey(code);
}
}
...@@ -6,6 +6,7 @@ import javax.persistence.Column; ...@@ -6,6 +6,7 @@ import javax.persistence.Column;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
@Table(name = "branch_company") @Table(name = "branch_company")
...@@ -32,10 +33,6 @@ public class BranchCompany { ...@@ -32,10 +33,6 @@ public class BranchCompany {
@Column(name = "subordinate_branch") @Column(name = "subordinate_branch")
private Integer subordinateBranch; private Integer subordinateBranch;
/**
* 分支机构地址:经纬度
*/
private String location;
/** /**
* 地址-省/直辖市(编码) * 地址-省/直辖市(编码)
...@@ -65,5 +62,27 @@ public class BranchCompany { ...@@ -65,5 +62,27 @@ public class BranchCompany {
private Date updateTime; private Date updateTime;
/**
* 负责人
*/
private String leader;
/**
* 负责人联系方式
*/
private String leaderContactInfo;
/**
* 分公司状态
*/
private Integer status;
/**
*公司地址-纬度
*/
private BigDecimal latitude;
/**
* 公司地址-经度
*/
private BigDecimal longitude;
} }
\ No newline at end of file
...@@ -56,10 +56,6 @@ public class Vehicle { ...@@ -56,10 +56,6 @@ public class Vehicle {
* 车架号 * 车架号
*/ */
private String vin; private String vin;
/**
* 里程数
*/
private Integer mileage;
/** /**
* 保险公司,见常量表 * 保险公司,见常量表
...@@ -98,8 +94,35 @@ public class Vehicle { ...@@ -98,8 +94,35 @@ public class Vehicle {
private Integer maintenanceMileage; private Integer maintenanceMileage;
/** /**
* 是否违章 * 车辆所属人-类型
*/
private Integer belongTo;
/**
* 所属人 名称
*/ */
private Integer haveViolation; private String belongToName;
/**
* 行驶证路径
*/
private String drivingLicensePath;
/**
* 发动机号
*/
private String engineNum;
/**
* 生产商
*/
private String manufacturer;
/**
* 收车时间
*/
private Date receiveTime;
} }
\ No newline at end of file
...@@ -160,4 +160,20 @@ public class VehicleBookRecord { ...@@ -160,4 +160,20 @@ public class VehicleBookRecord {
*/ */
private String retRemark; private String retRemark;
/**
* 提车阶段里程数
*/
private Integer mileageLift;
/**
* 还车阶段里程数
*/
private Integer mileageRet;
/**
* 是否违章
*/
private Integer haveViolation;
} }
\ No newline at end of file
...@@ -21,7 +21,6 @@ public class CorsInterceptor extends HandlerInterceptorAdapter { ...@@ -21,7 +21,6 @@ public class CorsInterceptor extends HandlerInterceptorAdapter {
response.addHeader("Access-Control-Allow-Credentials", "true"); response.addHeader("Access-Control-Allow-Credentials", "true");
response.addHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE, PUT, HEAD"); response.addHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE, PUT, HEAD");
response.addHeader("Access-Control-Allow-Headers", "Content-Type,authorization"); response.addHeader("Access-Control-Allow-Headers", "Content-Type,authorization");
response.addHeader("Access-Control-Max-Age", "3600"); response.addHeader("Access-Control-Max-Age", "3600");
} }
if(CorsUtils.isPreFlightRequest(request)){//是否跨域前option请求,使得话不执行后面拦截器 if(CorsUtils.isPreFlightRequest(request)){//是否跨域前option请求,使得话不执行后面拦截器
......
...@@ -2,6 +2,7 @@ package com.xinxincaravan.caravan.vehicle.mapper; ...@@ -2,6 +2,7 @@ package com.xinxincaravan.caravan.vehicle.mapper;
import com.xinxincaravan.caravan.vehicle.entity.VehicleBookRecord; import com.xinxincaravan.caravan.vehicle.entity.VehicleBookRecord;
import com.xinxincaravan.caravan.vehicle.vo.QueryVehicleBookRecordVo; import com.xinxincaravan.caravan.vehicle.vo.QueryVehicleBookRecordVo;
import com.xinxincaravan.caravan.vehicle.vo.VehicleBookRecordAndTbNameVo;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.util.List; import java.util.List;
...@@ -13,7 +14,7 @@ public interface VehicleBookRecordMapper extends Mapper<VehicleBookRecord> { ...@@ -13,7 +14,7 @@ public interface VehicleBookRecordMapper extends Mapper<VehicleBookRecord> {
public List<VehicleBookRecord> getByPage4Month(Map<String,Object> params); public List<VehicleBookRecord> getByPage4Month(Map<String,Object> params);
public Integer insertHis(Map<String,Object> params); public Integer insertHis(VehicleBookRecordAndTbNameVo vehicleBookRecordAndTbNameVo);
public Integer del4YearMoth(Map<String,Object> params); public Integer del4YearMoth(Map<String,Object> params);
......
...@@ -3,6 +3,7 @@ package com.xinxincaravan.caravan.vehicle.rest; ...@@ -3,6 +3,7 @@ package com.xinxincaravan.caravan.vehicle.rest;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException; import com.alibaba.fastjson.JSONException;
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.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig; import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo; import com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo;
import com.github.wxiaoqi.security.auth.common.util.jwt.JWTHelper; import com.github.wxiaoqi.security.auth.common.util.jwt.JWTHelper;
...@@ -20,12 +21,21 @@ import com.xinxincaravan.caravan.vehicle.entity.VehicleBookInfo; ...@@ -20,12 +21,21 @@ 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.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.joda.time.DateTime; import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.util.List; import java.util.List;
@RestController @RestController
...@@ -37,6 +47,8 @@ public class VehicleController extends BaseController<VehicleBiz> { ...@@ -37,6 +47,8 @@ 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
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)
...@@ -72,6 +84,27 @@ public class VehicleController extends BaseController<VehicleBiz> { ...@@ -72,6 +84,27 @@ public class VehicleController extends BaseController<VehicleBiz> {
} }
} }
@RequestMapping(value ="/upload/drivingLicense",method = RequestMethod.POST)
public RestResponse uploadDrivingLicense(@RequestParam("file") MultipartFile file)
throws Exception{
String contentType = file.getContentType(); //图片文件类型
// String fileName = file.getOriginalFilename(); //图片名字
if(!contentType.equals("image/jpeg") && !contentType.equals("image/gif")){
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
}
if(file.getSize() > MAX_DRIVING_LICENSE_SIZE){
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
}
return baseBiz.uploadDrivingLicense(file);
}
@IgnoreUserToken
@RequestMapping(value="/download/drivingLicense",method=RequestMethod.GET) //匹配的是href中的download请求
public ResponseEntity<byte[]> downloadDrivingLicense(@RequestParam("realFileRelPath") String realFileRelPath) throws Exception {
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));
...@@ -88,7 +121,7 @@ public class VehicleController extends BaseController<VehicleBiz> { ...@@ -88,7 +121,7 @@ public class VehicleController extends BaseController<VehicleBiz> {
* @return * @return
*/ */
@RequestMapping(value ="/book/4employee",method = RequestMethod.POST) @RequestMapping(value ="/book/4employee",method = RequestMethod.POST)
public RestResponse<Integer> applyVehicle(@RequestBody BookVehicleVo bookVehicleVo){ 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);
......
...@@ -57,10 +57,6 @@ public class AddOrUpdateVehicleVo { ...@@ -57,10 +57,6 @@ public class AddOrUpdateVehicleVo {
* 车架号 * 车架号
*/ */
private String vin; private String vin;
/**
* 里程数
*/
private Integer mileage;
/** /**
* 保险公司,见常量表 * 保险公司,见常量表
...@@ -99,9 +95,32 @@ public class AddOrUpdateVehicleVo { ...@@ -99,9 +95,32 @@ public class AddOrUpdateVehicleVo {
private Integer maintenanceMileage; private Integer maintenanceMileage;
/** /**
* 是否违章 * 车辆所属人-类型
*/
private Integer belongTo;
/**
* 所属人 名称
*/ */
private Integer haveViolation; private String belongToName;
/**
* 行驶证路径
*/
private String drivingLicensePath;
/**
* 发动机号
*/
private String engineNum;
/**
* 生产商
*/
private String manufacturer;
/**
* 生产商
*/
private Date receiveTime;
} }
\ No newline at end of file
...@@ -57,4 +57,20 @@ public class BookVehicleVo { ...@@ -57,4 +57,20 @@ public class BookVehicleVo {
*/ */
Map<Integer,Integer> selectedAccItem; Map<Integer,Integer> selectedAccItem;
/**
* 提车阶段里程数
*/
private Integer mileageLift;
/**
* 还车阶段里程数
*/
private Integer mileageRet;
/**
* 是否违章
*/
private Integer haveViolation;
} }
\ No newline at end of file
...@@ -51,6 +51,18 @@ public class BranchCompanyVo { ...@@ -51,6 +51,18 @@ public class BranchCompanyVo {
*/ */
private String addrDetail; private String addrDetail;
/**
* 负责人
*/
private String leader;
/**
* 负责人联系方式
*/
private String leaderContactInfo;
/**
* 分公司状态
*/
private Integer status;
} }
\ No newline at end of file
...@@ -19,4 +19,9 @@ public class LiftVehicleVo { ...@@ -19,4 +19,9 @@ public class LiftVehicleVo {
*/ */
private String liftRemark; private String liftRemark;
/**
* 提车阶段里程数
*/
private Integer mileageLift;
} }
\ No newline at end of file
...@@ -189,5 +189,20 @@ public class QueryVehicleBookRecordVo { ...@@ -189,5 +189,20 @@ public class QueryVehicleBookRecordVo {
*/ */
Map<Integer,Integer> accItemAndAmount; Map<Integer,Integer> accItemAndAmount;
/**
* 提车阶段里程数
*/
private Integer mileageLift;
/**
* 还车阶段里程数
*/
private Integer mileageRet;
/**
* 是否违章
*/
private Integer haveViolation;
} }
\ No newline at end of file
...@@ -60,10 +60,6 @@ public class QueryVehicleVo { ...@@ -60,10 +60,6 @@ public class QueryVehicleVo {
* 车架号 * 车架号
*/ */
private String vin; private String vin;
/**
* 里程数
*/
private Integer mileage;
/** /**
* 保险公司,见常量表 * 保险公司,见常量表
...@@ -102,8 +98,33 @@ public class QueryVehicleVo { ...@@ -102,8 +98,33 @@ public class QueryVehicleVo {
private Integer maintenanceMileage; private Integer maintenanceMileage;
/** /**
* 是否违章 * 车辆所属人-类型
*/
private Integer belongTo;
/**
* 所属人 名称
*/ */
private Integer haveViolation; private String belongToName;
/**
* 行驶证路径
*/
private String drivingLicensePath;
/**
* 发动机号
*/
private String engineNum;
/**
* 生产商
*/
private String manufacturer;
/**
* 生产商
*/
private Date receiveTime;
} }
\ No newline at end of file
...@@ -19,4 +19,13 @@ public class RetVehicleVo { ...@@ -19,4 +19,13 @@ public class RetVehicleVo {
*/ */
private String retRemark; private String retRemark;
/**
* 还车阶段里程数
*/
private Integer mileageRet;
/**
* 是否违章
*/
private Integer haveViolation;
} }
\ No newline at end of file
package com.xinxincaravan.caravan.vehicle.vo;
import lombok.Data;
import javax.persistence.*;
import java.util.Date;
@Data
public class VehicleBookRecordAndTbNameVo {
/**
* 表格名称
*/
private String tbName;
/**
* 主键
*/
private Long id;
/**
* 车辆id
*/
private String vehicle;
/**
* 申请状态:1-申请中 2-已通过 3-已归还 4-拒绝 5-逾期归还
*/
private Integer status;
/**
* 预定类型,1-用户租赁、2-分公司使用、3-维修
*/
private Integer bookType;
/**
* 预定用户id
*/
private Integer bookUser;
/**
* 预定用户姓名
*/
private String bookUserName;
/**
* 联系信息,比如电话、联系人姓名等(json)
*/
@Column(name = "contact_info")
private String contactInfo;
/**
* 申请开始日期
*/
private Date bookStartDate;
/**
* 提车地点(经纬度)
*/
private String liftLocation;
/**
* 提车地址
*/
private String liftAddr;
private String remark;
/**
* 目的地
*/
private String destination;
/**
* 申请审核人,-1代表系统
*/
private Integer reviewerApply;
/**
* 申请审核人姓名
*/
private String reviewerNameApply;
/**
* 归还审核人,-1代表系统
*/
private Integer reviewerReturn;
/**
* 归还审核人姓名
*/
private String reviewerNameReturn;
/**
* 取消人,-1代表系统
*/
private Integer reviewerCancel;
/**
* 取消人姓名
*/
private String reviewerNameCancel;
/**
* 提车审核人,-1代表系统
*/
private Integer reviewerLift;
/**
* 提车审核人姓名
*/
private String reviewerNameLift;
/**
* 申请结束日期
*/
@Column(name = "book_end_date")
private Date bookEndDate;
/**
* 实际开始日期
*/
private Date actualStartDate;
/**
* 实际结束日期
*/
private Date actualEndDate;
/**
* 提车公司
*/
private Integer liftCompany;
/**
* 提车备注
*/
private String liftRemark;
/**
* 还车公司
*/
private Integer retCompany;
/**
* 还车备注
*/
private String retRemark;
/**
* 提车阶段里程数
*/
private Integer mileageLift;
/**
* 还车阶段里程数
*/
private Integer mileageRet;
/**
* 是否违章
*/
private Integer haveViolation;
}
\ No newline at end of file
...@@ -43,7 +43,7 @@ spring: ...@@ -43,7 +43,7 @@ spring:
#--------------------以下为redis相关配置---------------------- #--------------------以下为redis相关配置----------------------
redis: redis:
database: 2 database: 2
host: ${REDIS_HOST:10.5.52.2} host: ${REDIS_HOST:10.5.52.3}
port: ${REDIS_PORT:6379} port: ${REDIS_PORT:6379}
password: xx2019fc password: xx2019fc
jedis: jedis:
......
...@@ -22,6 +22,16 @@ ...@@ -22,6 +22,16 @@
<if test="reviewerNameCancel != null and reviewerNameCancel !=''"> <if test="reviewerNameCancel != null and reviewerNameCancel !=''">
reviewer_name_cancel =#{reviewerNameCancel}, reviewer_name_cancel =#{reviewerNameCancel},
</if> </if>
<if test="mileageLift != null">
mileage_lift =#{mileageLift},
</if>
<if test="mileageRet != null ">
mileage_ret =#{mileageRet},
</if>
<if test="haveViolation != null">
have_violation =#{haveViolation},
</if>
`status` = #{status} `status` = #{status}
where id = #{id} and `status` = #{statusCondition} where id = #{id} and `status` = #{statusCondition}
</update> </update>
...@@ -57,7 +67,15 @@ ...@@ -57,7 +67,15 @@
<if test="liftCompany != null"> <if test="liftCompany != null">
`lift_company` = #{liftCompany}, `lift_company` = #{liftCompany},
</if> </if>
<if test="mileageLift != null">
mileage_lift =#{mileageLift},
</if>
<if test="mileageRet != null ">
mileage_ret =#{mileageRet},
</if>
<if test="haveViolation != null">
have_violation =#{haveViolation},
</if>
<choose> <choose>
<when test="targetStatus == 7"> `actual_start_date` = now() </when> <when test="targetStatus == 7"> `actual_start_date` = now() </when>
<when test="targetStatus == 3"> `actual_end_date` = now() </when> <when test="targetStatus == 3"> `actual_end_date` = now() </when>
...@@ -94,6 +112,9 @@ ...@@ -94,6 +112,9 @@
lift_company, lift_company,
lift_remark, lift_remark,
ret_company, ret_company,
mileage_lift,
mileage_ret,
have_violation,
ret_remark ret_remark
) )
values( values(
...@@ -123,6 +144,9 @@ ...@@ -123,6 +144,9 @@
#{liftCompany}, #{liftCompany},
#{liftRemark}, #{liftRemark},
#{retCompany}, #{retCompany},
#{mileageLift},
#{mileageRet},
#{haveViolation},
#{retRemark} #{retRemark}
); );
</insert> </insert>
...@@ -157,6 +181,9 @@ ...@@ -157,6 +181,9 @@
lift_company, lift_company,
lift_remark, lift_remark,
ret_company, ret_company,
mileage_lift,
mileage_ret,
have_violation,
ret_remark ret_remark
from from
vehicle_book_record vehicle_book_record
...@@ -198,6 +225,9 @@ ...@@ -198,6 +225,9 @@
vbr.lift_remark, vbr.lift_remark,
vbr.ret_company, vbr.ret_company,
bcr.name as retCompanyName , bcr.name as retCompanyName ,
vbr.mileage_lift,
vbr.mileage_ret,
vbr.have_violation,
vbr.ret_remark, vbr.ret_remark,
v.`code` as vehicleCode, v.`code` as vehicleCode,
v.number_plate as numberPlate, v.number_plate as numberPlate,
...@@ -270,6 +300,9 @@ ...@@ -270,6 +300,9 @@
vbr.lift_company, vbr.lift_company,
vbr.lift_remark, vbr.lift_remark,
vbr.ret_company, vbr.ret_company,
vbr.mileage_lift,
vbr.mileage_ret,
vbr.have_violation,
vbr.ret_remark vbr.ret_remark
from ${tbName} vbr from ${tbName} vbr
where id = #{id} where id = #{id}
...@@ -309,6 +342,9 @@ ...@@ -309,6 +342,9 @@
`ret_remark` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '还车备注', `ret_remark` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '还车备注',
`reviewer_lift` int(10) NULL DEFAULT NULL COMMENT '提车审核人', `reviewer_lift` int(10) NULL DEFAULT NULL COMMENT '提车审核人',
`reviewer_name_lift` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '提车审核人姓名', `reviewer_name_lift` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '提车审核人姓名',
`mileage_lift` int(10) NULL DEFAULT NULL COMMENT '提车里程数',
`mileage_ret` int(10) NULL DEFAULT NULL COMMENT '还车里程数',
`have_violation` tinyint(4) NULL DEFAULT NULL COMMENT '是否违章',
PRIMARY KEY (`id`) USING BTREE, PRIMARY KEY (`id`) USING BTREE,
INDEX `i_vehicle`(`vehicle`) USING BTREE, INDEX `i_vehicle`(`vehicle`) USING BTREE,
INDEX `i_book_user`(`book_user`) USING BTREE, INDEX `i_book_user`(`book_user`) USING BTREE,
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
v.remark, v.remark,
v.create_time, v.create_time,
v.vin, v.vin,
v.mileage,
v.insurance_company, v.insurance_company,
v.insurance_no, v.insurance_no,
v.insurance_start_date, v.insurance_start_date,
...@@ -30,7 +29,12 @@ ...@@ -30,7 +29,12 @@
v.annual_verification_date, v.annual_verification_date,
v.maintenance_date, v.maintenance_date,
v.maintenance_mileage, v.maintenance_mileage,
v.have_violation, v.belong_to,
v.belong_to_name,
v.driving_license_path,
v.engine_num,
v.manufacturer,
v.receive_time,
v.update_time v.update_time
<if test=" yearMonthAndParam !=null "> <if test=" yearMonthAndParam !=null ">
,vbi.booked_date ,vbi.booked_date
...@@ -43,9 +47,6 @@ ...@@ -43,9 +47,6 @@
left join branch_company bc on v.`subordinate_branch` = bc.id left join branch_company bc on v.`subordinate_branch` = bc.id
where where
1=1 1=1
<if test="haveViolation !=null">
and v.have_violation = #{haveViolation}
</if>
<if test="mRangeDateEnd !=null"> <if test="mRangeDateEnd !=null">
and v.maintenance_date &lt;= #{mRangeDateEnd} and v.maintenance_date &lt;= #{mRangeDateEnd}
</if> </if>
...@@ -67,12 +68,6 @@ ...@@ -67,12 +68,6 @@
<if test="insuranceCompany !=null"> <if test="insuranceCompany !=null">
and v.insurance_company = #{insuranceCompany} and v.insurance_company = #{insuranceCompany}
</if> </if>
<if test="mileageRangeEnd !=null">
and v.mileage &lt;= #{mileageRangeEnd}
</if>
<if test="mileageRangeStart !=null">
and v.mileage &gt;= #{mileageRangeStart}
</if>
<if test="vin !=null and vin != ''"> <if test="vin !=null and vin != ''">
and v.vin = #{vin} and v.vin = #{vin}
</if> </if>
...@@ -110,14 +105,7 @@ ...@@ -110,14 +105,7 @@
select select
v.`id`, v.`id`,
v.`code`, v.`code`,
v.`status`, v.number_plate
v.number_plate,
v.brand,
v.subordinate_branch,
v.use_type,
v.remark,
v.create_time,
v.update_time
from vehicle v from vehicle v
where where
`code` = #{code} `code` = #{code}
......
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