|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.xit.core.config.database;
|
|
|
|
|
|
|
|
|
|
import com.plf.client.Client;
|
|
|
|
|
import com.xit.Application;
|
|
|
|
|
import com.xit.biz.cmm.dto.ComboCodeDto;
|
|
|
|
|
import com.xit.biz.ctgy.CtgyConstants;
|
|
|
|
|
import com.xit.biz.ctgy.dto.ParkingImageDto;
|
|
|
|
@ -22,6 +23,7 @@ import org.springframework.data.domain.PageImpl;
|
|
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
|
|
import org.springframework.util.ResourceUtils;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.lang.reflect.Field;
|
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
|
@ -501,41 +503,66 @@ public abstract class BaseMpowerDaoSupport {
|
|
|
|
|
log.info("웹서버 저장되는 첨부파일 위치:"+savedImgPath);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ParkingImageDto getPicadImgList(String photocode){
|
|
|
|
|
ParkingImageDto dto = new ParkingImageDto();
|
|
|
|
|
public List<Map<String,Object>> getPicadImgList(String photocode){
|
|
|
|
|
List<Map<String,Object>> list = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
Client client = new Client(fileHostIp, fileHostPort);
|
|
|
|
|
|
|
|
|
|
String imgPath = picadPath + getAbsImgPath(photocode); //터널링에 저장된 단속사진 경로
|
|
|
|
|
log.info("최종이미지경로:::::" + imgPath);
|
|
|
|
|
String filePath = getAbsImgPath(photocode);
|
|
|
|
|
String svrImgPath = picadPath + filePath; //터널링에 저장된 단속사진 경로
|
|
|
|
|
log.info("Mpower 이미지경로:::::" + svrImgPath);
|
|
|
|
|
|
|
|
|
|
try{
|
|
|
|
|
client.getConnection(fileServiceName);
|
|
|
|
|
client.setInput("dnfile1",imgPath+ "/P" + CommUtil.lpad(photocode, '0', 10) + "A.jpg"); //터널링에 실질 존재하는 경로,파일명
|
|
|
|
|
log.info("사진이름:" + CommUtil.lpad(photocode, '0', 10));
|
|
|
|
|
client.setInput("dnfile2",imgPath+ "/P" + CommUtil.lpad(photocode, '0', 10) + "B.jpg");
|
|
|
|
|
client.setInput("dnfile3",imgPath+ "/P" + CommUtil.lpad(photocode, '0', 10) + "C.jpg");
|
|
|
|
|
client.setInput("dnfile4",imgPath+ "/P" + CommUtil.lpad(photocode, '0', 10) + "D.jpg");
|
|
|
|
|
|
|
|
|
|
String mpowerFilePre = svrImgPath + "/P" + CommUtil.lpad(photocode, '0', 10);
|
|
|
|
|
log.info("Mpower 이미지 file name :::::" + mpowerFilePre + "A, B, C, D.jpg");
|
|
|
|
|
client.setInput("imageA",mpowerFilePre + "A.jpg"); //터널링에 실질 존재하는 경로,파일명
|
|
|
|
|
client.setInput("imageB",mpowerFilePre + "B.jpg");
|
|
|
|
|
client.setInput("imageC",mpowerFilePre + "C.jpg");
|
|
|
|
|
client.setInput("imageD",mpowerFilePre + "D.jpg");
|
|
|
|
|
client.Request();
|
|
|
|
|
String result = client.getString("result", 0, 0);
|
|
|
|
|
|
|
|
|
|
if (result.equals("true")){
|
|
|
|
|
client.getFileName("imageA");
|
|
|
|
|
client.getFileName("imageB");
|
|
|
|
|
client.getFileName("imageC");
|
|
|
|
|
client.getFileName("imageD");
|
|
|
|
|
client.savefile("imageA", savedImgPath);
|
|
|
|
|
client.savefile("imageB", savedImgPath);
|
|
|
|
|
client.savefile("imageC", savedImgPath);
|
|
|
|
|
client.savefile("imageD", savedImgPath);
|
|
|
|
|
|
|
|
|
|
//String strpath = "/vioPhoto/"+sessionId+"/P" + CommUtil.lpad(photocode, '0', 10);
|
|
|
|
|
String strpath = savedImgPath + "/P" + CommUtil.lpad(photocode, '0', 10);
|
|
|
|
|
log.info("strPath ::: " + strpath);
|
|
|
|
|
dto.setScPicad1(strpath + "A.jpg");
|
|
|
|
|
dto.setScPicad1(strpath + "B.jpg");
|
|
|
|
|
dto.setScPicad1(strpath + "C.jpg");
|
|
|
|
|
dto.setScPicad1(strpath + "D.jpg");
|
|
|
|
|
String svrSavedPhotoPath = savedImgPath + "/" + filePath;
|
|
|
|
|
String strpath = svrSavedPhotoPath + "/P" + CommUtil.lpad(photocode, '0', 10);
|
|
|
|
|
log.info("서버 download file path :::::" + svrSavedPhotoPath);
|
|
|
|
|
log.info("서버 download file name :::::" + strpath + "A, B, C, D.jpg");
|
|
|
|
|
|
|
|
|
|
File file = new File(svrSavedPhotoPath);
|
|
|
|
|
if(!file.exists()) file.mkdirs();
|
|
|
|
|
|
|
|
|
|
if(Checks.isNotEmpty(client.getFileName("imageA"))){
|
|
|
|
|
client.savefile("imageA", svrSavedPhotoPath);
|
|
|
|
|
setFileInfo(list, client.getFileName("imageA"), strpath);
|
|
|
|
|
log.info("서버 file name :::::" + strpath + client.getFileName("imageA"));
|
|
|
|
|
}else{
|
|
|
|
|
setNoFileInfo(list);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if(Checks.isNotEmpty(client.getFileName("imageB"))){
|
|
|
|
|
client.savefile("imageB", svrSavedPhotoPath);
|
|
|
|
|
setFileInfo(list, client.getFileName("imageB"), strpath);
|
|
|
|
|
log.info("서버 file name :::::" + strpath + client.getFileName("imageB"));
|
|
|
|
|
}else{
|
|
|
|
|
setNoFileInfo(list);;
|
|
|
|
|
};
|
|
|
|
|
if(Checks.isNotEmpty(client.getFileName("imageC"))){
|
|
|
|
|
client.savefile("imageC", svrSavedPhotoPath);
|
|
|
|
|
setFileInfo(list, client.getFileName("imageC"), strpath);
|
|
|
|
|
log.info("서버 file name :::::" + strpath + client.getFileName("imageC"));
|
|
|
|
|
}else{
|
|
|
|
|
setNoFileInfo(list);;
|
|
|
|
|
};
|
|
|
|
|
if(Checks.isNotEmpty(client.getFileName("imageD"))){
|
|
|
|
|
client.savefile("imageD", svrSavedPhotoPath);
|
|
|
|
|
setFileInfo(list, client.getFileName("imageD"), strpath);
|
|
|
|
|
log.info("서버 file name :::::" + strpath + client.getFileName("imageD"));
|
|
|
|
|
}else{
|
|
|
|
|
setNoFileInfo(list);;
|
|
|
|
|
};
|
|
|
|
|
log.info("서버로 다운로드된 file ::: {}{}{}{}", client.getFileName("imageA"), client.getFileName("imageB"), client.getFileName("imageC"), client.getFileName("imageD"));
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
throw new MpowerException("MPower File download error::"+result);
|
|
|
|
|
}
|
|
|
|
@ -543,9 +570,83 @@ public abstract class BaseMpowerDaoSupport {
|
|
|
|
|
throw new MpowerException("MPower File download error::"+e.getLocalizedMessage());
|
|
|
|
|
}
|
|
|
|
|
//logger.debug(fph);
|
|
|
|
|
return dto;
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setFileInfo(List<Map<String, Object>> list, String imgName, String strpath) {
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("imgName", imgName);
|
|
|
|
|
map.put("url", strpath + imgName);
|
|
|
|
|
list.add(map);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setNoFileInfo(List<Map<String, Object>> list) {
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("imgName", "");
|
|
|
|
|
map.put("url", "/images/noFile.png");
|
|
|
|
|
list.add(map);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// public ParkingImageDto getPicadImgList2(String photocode){
|
|
|
|
|
// ParkingImageDto dto = new ParkingImageDto();
|
|
|
|
|
//
|
|
|
|
|
// Client client = new Client(fileHostIp, fileHostPort);
|
|
|
|
|
//
|
|
|
|
|
// String path = Application.class.getResource("").getPath();
|
|
|
|
|
// path = path.replace("WEB-INF/classes/com/xit", "vioPhoto/picad/");
|
|
|
|
|
// if(path.substring(0,1).equals("/")){
|
|
|
|
|
// path = path.substring(1);
|
|
|
|
|
// }
|
|
|
|
|
// File file = new File(path);
|
|
|
|
|
// if(!file.exists()) file.mkdirs();
|
|
|
|
|
//
|
|
|
|
|
// String imgPath = picadPath + getAbsImgPath(photocode); //터널링에 저장된 단속사진 경로
|
|
|
|
|
// log.info("최종이미지경로:::::" + imgPath);
|
|
|
|
|
//
|
|
|
|
|
// try{
|
|
|
|
|
// client.getConnection(fileServiceName);
|
|
|
|
|
// client.setInput("dnfile1",imgPath+ "/P" + CommUtil.lpad(photocode, '0', 10) + "A.jpg"); //터널링에 실질 존재하는 경로,파일명
|
|
|
|
|
// log.info("사진이름:" + CommUtil.lpad(photocode, '0', 10));
|
|
|
|
|
//
|
|
|
|
|
// client.setInput("dnfile2",imgPath+ "/P" + CommUtil.lpad(photocode, '0', 10) + "B.jpg");
|
|
|
|
|
// client.setInput("dnfile3",imgPath+ "/P" + CommUtil.lpad(photocode, '0', 10) + "C.jpg");
|
|
|
|
|
// client.setInput("dnfile4",imgPath+ "/P" + CommUtil.lpad(photocode, '0', 10) + "D.jpg");
|
|
|
|
|
//
|
|
|
|
|
// client.Request();
|
|
|
|
|
// String result = client.getString("result", 0, 0);
|
|
|
|
|
//
|
|
|
|
|
// if (result.equals("true")){
|
|
|
|
|
// log.info("{}{}{}{}", client.getFileName("dnfile1"), client.getFileName("dnfile2"), client.getFileName("dnfile3"), client.getFileName("dnfile4"));
|
|
|
|
|
// log.info("{}{}{}{}", client.getFileName("imageA"), client.getFileName("imageB"), client.getFileName("imageC"), client.getFileName("imageD"));
|
|
|
|
|
//
|
|
|
|
|
// client.getFileName("imageA");
|
|
|
|
|
// client.getFileName("imageB");
|
|
|
|
|
// client.getFileName("imageC");
|
|
|
|
|
// client.getFileName("imageD");
|
|
|
|
|
// client.savefile("imageA", path);
|
|
|
|
|
// client.savefile("imageB", path);
|
|
|
|
|
// client.savefile("imageC", path);
|
|
|
|
|
// client.savefile("imageD", path);
|
|
|
|
|
// log.info("{}{}{}{}", client.getFileName("dnfile1"), client.getFileName("dnfile2"), client.getFileName("dnfile3"), client.getFileName("dnfile4"));
|
|
|
|
|
// log.info("{}{}{}{}", client.getFileName("imageA"), client.getFileName("imageB"), client.getFileName("imageC"), client.getFileName("imageD"));
|
|
|
|
|
//
|
|
|
|
|
// //String strpath = "/vioPhoto/"+sessionId+"/P" + CommUtil.lpad(photocode, '0', 10);
|
|
|
|
|
// String strpath = "/vioPhoto/picad" + "/P" + CommUtil.lpad(photocode, '0', 10);
|
|
|
|
|
// log.info("strPath ::: " + strpath);
|
|
|
|
|
// dto.setScPicad1(strpath + "A.jpg");
|
|
|
|
|
// dto.setScPicad2(strpath + "B.jpg");
|
|
|
|
|
// dto.setScPicad3(strpath + "C.jpg");
|
|
|
|
|
// dto.setScPicad4(strpath + "D.jpg");
|
|
|
|
|
// }else{
|
|
|
|
|
// throw new MpowerException("MPower File download error::"+result);
|
|
|
|
|
// }
|
|
|
|
|
// }catch(Exception e){
|
|
|
|
|
// throw new MpowerException("MPower File download error::"+e.getLocalizedMessage());
|
|
|
|
|
// }
|
|
|
|
|
// //logger.debug(fph);
|
|
|
|
|
// return dto;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Mpower 단속사진 저장 경로
|
|
|
|
|
* @param code
|
|
|
|
@ -562,26 +663,22 @@ public abstract class BaseMpowerDaoSupport {
|
|
|
|
|
|
|
|
|
|
private String getImgPath(double intCode, String baseDir, int baseValue){
|
|
|
|
|
|
|
|
|
|
String tmpDir = "";
|
|
|
|
|
if(intCode <= baseValue) return baseDir;
|
|
|
|
|
|
|
|
|
|
if(intCode <= baseValue){
|
|
|
|
|
tmpDir = baseDir;
|
|
|
|
|
}else{
|
|
|
|
|
int tmpL = (int)intCode/baseValue; //나눈값
|
|
|
|
|
double dtmpL = intCode/baseValue; //나눈값
|
|
|
|
|
int tmpL = (int)intCode/baseValue; //나눈값
|
|
|
|
|
double dtmpL = intCode/baseValue; //나눈값
|
|
|
|
|
|
|
|
|
|
String tmpS = String.valueOf(dtmpL);
|
|
|
|
|
tmpS = tmpS.substring(tmpS.indexOf(".")+1);
|
|
|
|
|
String tmpS = String.valueOf(dtmpL);
|
|
|
|
|
tmpS = tmpS.substring(tmpS.indexOf(".")+1);
|
|
|
|
|
|
|
|
|
|
int tmpM = Integer.parseInt(tmpS);
|
|
|
|
|
int tmpM = Integer.parseInt(tmpS);
|
|
|
|
|
|
|
|
|
|
if(tmpM > 0) tmpL = tmpL+1;
|
|
|
|
|
if(tmpM > 0) tmpL = tmpL+1;
|
|
|
|
|
|
|
|
|
|
StringBuilder stmpL = new StringBuilder(String.valueOf(tmpL));
|
|
|
|
|
int tmpCnt = baseDir.length() - stmpL.length();
|
|
|
|
|
for(int i = 0; i < tmpCnt; i++) stmpL.insert(0, "0");
|
|
|
|
|
}
|
|
|
|
|
return tmpDir;
|
|
|
|
|
StringBuilder stmpL = new StringBuilder(String.valueOf(tmpL));
|
|
|
|
|
int tmpCnt = baseDir.length() - stmpL.length();
|
|
|
|
|
for(int i = 0; i < tmpCnt; i++) stmpL.insert(0, "0");
|
|
|
|
|
return stmpL.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|