Commit 5beb14b9 authored by hanfeng's avatar hanfeng

修改车辆违章查询和app自动更新(19/7/03)

parent 1ec3d497
......@@ -79,21 +79,20 @@ public class AppVersionBiz extends BaseBiz<AppVersionMapper,AppVersion> {
}
public RestResponse uploadDrivingLicense(MultipartFile file) throws IOException {
//创建本日存放目录
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 = redisTemplate.opsForValue().increment(redisNoKey);
if(no.equals(1L)){
redisTemplate.expire(redisNoKey,1, TimeUnit.DAYS);
}
// Long no = redisTemplate.opsForValue().increment(redisNoKey);
// if(no.equals(1L)){
// redisTemplate.expire(redisNoKey,1, TimeUnit.DAYS);
// }
String fileName = file.getOriginalFilename();
String realFileRelPath = dirPathToday + File.separator + no + fileName.substring(fileName.lastIndexOf("."));
//文件存放路径
String realFileRelPath = dirPathToday + File.separator+fileName.substring(fileName.lastIndexOf("/"));
String filePath = uploadPath + realFileRelPath;
//将文件写入指定位置
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
return RestResponse.suc(realFileRelPath);
return RestResponse.suc(filePath);
}
......
......@@ -50,8 +50,8 @@ public class AppVersionController extends BaseController<AppVersionBiz,AppVersio
public RestResponse uploadInstallationPackage(@RequestParam("file") MultipartFile file)
throws Exception {
Assert.notNull(file);
String contentType = file.getContentType(); //图片文件类型
// String fileName = file.getOriginalFilename(); //图片名字
String contentType = file.getContentType(); //文件类型
//// String fileName = file.getOriginalFilename(); //文件名
if (!contentType.equals("apk") && !contentType.equals("ipa")) {
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
}
......
package com.xxfc.platform.vehicle.constant;
package com.xxfc.platform.universal.constant;
public class RedisKey {
......@@ -88,4 +88,5 @@ public class RedisKey {
*/
public static final String MILEAGE_LAST_DAY_PREFIX ="mileage:last_day:";
public static final String ILLEGAL_VEHICLE_ENQUIRIES ="cache:violation:";
}
......@@ -158,17 +158,17 @@ public class Vehicle {
/**
* 车牌类型
*/
private String type;
/**
* 车牌号码
*/
private String plateno;
/**
* 发动机号
*/
private String engineno;
/**
* 车架号
*/
private String frameno;
private String numberPlateType;
// /**
// * 车牌号码
// */
// private String plateno;
// /**
// * 发动机号
// */
// private String engineno;
// /**
// * 车架号
// */
// private String frameno;
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.xxfc.platform.universal.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.universal.feign.VehicleFeign;
import com.xxfc.platform.universal.feign.result.Vehicle;
import com.xxfc.platform.universal.service.TrafficViolationsService;
......@@ -11,8 +12,6 @@ import com.xxfc.platform.universal.vo.ViolationVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@RestController
......@@ -68,8 +67,14 @@ public class TrafficViolationsController {
@GetMapping("/getRentViolation")
public ObjectRestResponse<List<ViolationVO>> getRentViolation(RentViolationDTO rentViolationDTO) {
String vehicleId = rentViolationDTO.getVehicleId();
if (rentViolationDTO==null||rentViolationDTO.getVehicleId()==null) {
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"Vehicle information is empty");
}
Vehicle vehicle = vehicleFeign.get(vehicleId).getData();
if (vehicle==null) {
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"No corresponding vehicle information");
}
return ObjectRestResponse.succ(tvService.getRentViolation(rentViolationDTO,vehicle));
}
......
......@@ -3,11 +3,14 @@ package com.xxfc.platform.universal.service;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.xxfc.platform.universal.biz.LicensePlateTypeBiz;
import com.xxfc.platform.universal.constant.RedisKey;
import com.xxfc.platform.universal.entity.LicensePlateType;
import com.xxfc.platform.universal.feign.result.Vehicle;
import com.xxfc.platform.universal.utils.CertifHttpUtils;
import com.xxfc.platform.universal.vo.RentViolationDTO;
import com.xxfc.platform.universal.vo.TrafficViolations;
import com.xxfc.platform.universal.vo.ViolationVO;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
......@@ -16,6 +19,7 @@ import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.task.TaskExecutor;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
......@@ -62,6 +66,9 @@ public class TrafficViolationsService {
private static final String FRAMENO_NAME="frameno";
private static final String AUTHORIZATION="Authorization";
@Autowired
private RedisTemplate redisTemplate;
/**
* 支持查询的城市
......@@ -211,8 +218,18 @@ public class TrafficViolationsService {
licensePlateTypeBiz.insertLicensePlateType(finalLicensePlateTypes);
}
public Object getRentViolation(RentViolationDTO rentViolationDTO, Vehicle vehicle) {
/**
* 订单完成后调用接口获取车辆信息
* @param rentViolationDTO
* @param vehicle
* @return
*/
public String getRentViolation(RentViolationDTO rentViolationDTO, Vehicle vehicle) {
String stringViolationVOS = (String) redisTemplate.opsForValue()
.get(RedisKey.ILLEGAL_VEHICLE_ENQUIRIES+rentViolationDTO.getVehicleId());
if (StringUtils.isBlank(stringViolationVOS)) {
return null;
}
return null;
}
}
......@@ -2,7 +2,7 @@ package com.xxfc.platform.universal.service;
import com.github.wxiaoqi.security.common.util.process.SystemConfig;
import com.xxfc.platform.vehicle.constant.RedisKey;
import com.xxfc.platform.universal.constant.RedisKey;
import org.apache.commons.io.FileUtils;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
......
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