Commit 81334198 by 李辅翼

v14

parent 47740b2e
...@@ -47,16 +47,17 @@ public class PicController { ...@@ -47,16 +47,17 @@ public class PicController {
* 插入指定贵阳驾驶人头像 * 插入指定贵阳驾驶人头像
*/ */
@GetMapping("/insertDrvPhotoById") @GetMapping("/insertDrvPhotoById")
public void insertDrvPhotoById(@RequestParam("sfzmhm") String sfzmhm){ public void insertDrvPhotoById(@RequestParam("sfzmhm") String sfzmhm) {
drvPhoto.insertDrvPhotoById(sfzmhm); drvPhoto.insertDrvPhotoById(sfzmhm);
} }
/** /**
* 车辆历史图片 * 车辆历史图片
*
* @param time * @param time
*/ */
@GetMapping("/getHisVehPic") @GetMapping("/getHisVehPic")
public void getHisVehPic(@RequestParam("time") String time){ public void getHisVehPic(@RequestParam("time") String time) {
vehicle.getHisVehPic(time); vehicle.getHisVehPic(time);
} }
...@@ -64,17 +65,16 @@ public class PicController { ...@@ -64,17 +65,16 @@ public class PicController {
* 同步指定时间段车辆图片数据 * 同步指定时间段车辆图片数据
*/ */
@GetMapping("/getVehPicStage") @GetMapping("/getVehPicStage")
public void getVehPicStage(@RequestParam("start") String start,@RequestParam("end") String end){ public void getVehPicStage(@RequestParam("start") String start, @RequestParam("end") String end) {
vehicle.getVehPicStage(start,end); vehicle.getVehPicStage(start, end);
} }
/** /**
* 车辆增量图片 * 车辆增量图片
*/ */
@GetMapping("/getIncrementVehPic") @GetMapping("/getIncrementVehPic")
public void getIncrementVehPic(){ public void getIncrementVehPic() {
vehicle.getIncrementVehPic(); vehicle.getIncrementVehPic();
} }
...@@ -83,33 +83,44 @@ public class PicController { ...@@ -83,33 +83,44 @@ public class PicController {
*/ */
@GetMapping("/insertVehPicByCar") @GetMapping("/insertVehPicByCar")
@ResponseBody @ResponseBody
public ResponseEntity insertVehPicByCar(@RequestParam("hphm") String hphm,@RequestParam("hpzl") String hpzl){ public ResponseEntity insertVehPicByCar(@RequestParam("hphm") String hphm, @RequestParam("hpzl") String hpzl) {
vehicle.insertVehPicByCar(hphm,hpzl); vehicle.insertVehPicByCar(hphm, hpzl);
return new ResponseEntity("sucess", HttpStatus.OK); return new ResponseEntity("sucess", HttpStatus.OK);
} }
/** /**
* 根据序号插入车辆图片 * 根据序号插入车辆图片
*
* @param xh * @param xh
*/ */
@GetMapping("/insertVehPicByXh") @GetMapping("/insertVehPicByXh")
public void insertVehPicByXh(@RequestParam("xh") String xh){ public void insertVehPicByXh(@RequestParam("xh") String xh) {
vehicle.insertVehPicByXh(xh); vehicle.insertVehPicByXh(xh);
} }
/** /**
* 指定时间段驾驶人头像同步 * 指定时间段驾驶人头像同步
*
* @param start * @param start
* @param end * @param end
*/ */
@GetMapping("/increDrvPic") @GetMapping("/increDrvPic")
public void increDrvPic(@RequestParam("start") String start,@RequestParam("end") String end){ public void increDrvPic(@RequestParam("start") String start, @RequestParam("end") String end) {
drvPhoto.increDrvPic(start,end); drvPhoto.increDrvPic(start, end);
} }
/**
* 根据地址删除图片
* @param url
*/
@GetMapping("/deletePicByUrl")
public void deletePicByUrl(@RequestParam("url") String url) {
try {
fileService.deleteFile(url);
} catch (Exception e) {
e.printStackTrace();
}
}
@GetMapping("/drvPhotoHis") @GetMapping("/drvPhotoHis")
...@@ -131,7 +142,7 @@ public class PicController { ...@@ -131,7 +142,7 @@ public class PicController {
* @return * @return
*/ */
@GetMapping("/getVioPic") @GetMapping("/getVioPic")
public synchronized PicByte getVioPicByUrl(@RequestParam("url") String url){ public synchronized PicByte getVioPicByUrl(@RequestParam("url") String url) {
PicByte picByte = new PicByte(); PicByte picByte = new PicByte();
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>(); MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
...@@ -141,13 +152,13 @@ public class PicController { ...@@ -141,13 +152,13 @@ public class PicController {
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(params, headers); HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(params, headers);
Map<String, byte[]> map; Map<String, byte[]> map;
if(url.startsWith("ftp")){ if (url.startsWith("ftp")) {
ResponseEntity<PicByte> resp = restTemplate.exchange(ftpUrl, method, requestEntity, PicByte.class); ResponseEntity<PicByte> resp = restTemplate.exchange(ftpUrl, method, requestEntity, PicByte.class);
map =resp.getBody().getMap(); map = resp.getBody().getMap();
}else if(url.startsWith("http")){ } else if (url.startsWith("http")) {
ResponseEntity<PicByte> resp = restTemplate.exchange(httpUrl, method, requestEntity, PicByte.class); ResponseEntity<PicByte> resp = restTemplate.exchange(httpUrl, method, requestEntity, PicByte.class);
map =resp.getBody().getMap(); map = resp.getBody().getMap();
}else { } else {
return null; return null;
} }
picByte.setMap(map); picByte.setMap(map);
...@@ -155,7 +166,6 @@ public class PicController { ...@@ -155,7 +166,6 @@ public class PicController {
} }
@GetMapping("/testHttp") @GetMapping("/testHttp")
public void testHttp(@RequestParam("param") String param, HttpServletResponse response) { public void testHttp(@RequestParam("param") String param, HttpServletResponse response) {
try { try {
...@@ -189,5 +199,4 @@ public class PicController { ...@@ -189,5 +199,4 @@ public class PicController {
} }
} }
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