|
|
@ -1,27 +1,19 @@
|
|
|
|
package com.xit.core.config.database;
|
|
|
|
package com.xit.core.config.database;
|
|
|
|
|
|
|
|
|
|
|
|
import com.plf.client.Client;
|
|
|
|
import com.plf.client.Client;
|
|
|
|
import com.xit.Application;
|
|
|
|
|
|
|
|
import com.xit.biz.cmm.dto.ComboCodeDto;
|
|
|
|
import com.xit.biz.cmm.dto.ComboCodeDto;
|
|
|
|
import com.xit.biz.ctgy.CtgyConstants;
|
|
|
|
|
|
|
|
import com.xit.biz.ctgy.dto.ParkingImageDto;
|
|
|
|
|
|
|
|
import com.xit.core.constant.ErrorCode;
|
|
|
|
import com.xit.core.constant.ErrorCode;
|
|
|
|
import com.xit.core.exception.MpowerException;
|
|
|
|
import com.xit.core.exception.MpowerException;
|
|
|
|
import com.xit.core.oauth2.config.properties.IDatabaseProperties;
|
|
|
|
import com.xit.core.oauth2.config.properties.IDatabaseProperties;
|
|
|
|
import com.xit.core.oauth2.config.properties.MasterDatabaseProperties;
|
|
|
|
|
|
|
|
import com.xit.core.oauth2.config.properties.SlaveDatabaseProperties;
|
|
|
|
|
|
|
|
import com.xit.core.util.Checks;
|
|
|
|
import com.xit.core.util.Checks;
|
|
|
|
import com.xit.core.util.CommUtil;
|
|
|
|
import com.xit.core.util.CommUtil;
|
|
|
|
import lombok.Getter;
|
|
|
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import lombok.Setter;
|
|
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.data.domain.Page;
|
|
|
|
import org.springframework.data.domain.Page;
|
|
|
|
import org.springframework.data.domain.PageImpl;
|
|
|
|
import org.springframework.data.domain.PageImpl;
|
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
|
import org.springframework.util.ResourceUtils;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
@ -481,106 +473,207 @@ public abstract class BaseMpowerDaoSupport {
|
|
|
|
return list;
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void fnDownFile(String fileName, String sessionId){
|
|
|
|
public List<Map<String,Object>> getParkingJudgeImgList(String photocode, String imgDiv){
|
|
|
|
|
|
|
|
|
|
|
|
try{
|
|
|
|
|
|
|
|
Client mp = new Client(fileHostIp, fileHostPort);
|
|
|
|
|
|
|
|
mp.getConnection(fileServiceName);
|
|
|
|
|
|
|
|
mp.setInput("dnfile1",picadPath + fileName); //터널링에 실질 존재하는 경로,파일명
|
|
|
|
|
|
|
|
mp.Request();
|
|
|
|
|
|
|
|
String result = mp.getString("result", 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (result.equals("true")){
|
|
|
|
|
|
|
|
mp.getFileName("imageA");
|
|
|
|
|
|
|
|
mp.savefile("imageA", savedImgPath);
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
throw new MpowerException("MPower File download error::"+result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
throw new MpowerException(e.getLocalizedMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
log.info("웹서버 저장되는 첨부파일 위치:"+savedImgPath);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<Map<String,Object>> getPicadImgList(String photocode){
|
|
|
|
|
|
|
|
List<Map<String,Object>> list = new ArrayList<>();
|
|
|
|
List<Map<String,Object>> list = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
Client client = new Client(fileHostIp, fileHostPort);
|
|
|
|
Client client = new Client(fileHostIp, fileHostPort);
|
|
|
|
String filePath = getAbsImgPath(photocode);
|
|
|
|
String filePath = getAbsImgPath(photocode);
|
|
|
|
String svrImgPath = picadPath + filePath; //터널링에 저장된 단속사진 경로
|
|
|
|
String svrImgPath = picadPath + filePath; //터널링에 저장된 단속사진 경로
|
|
|
|
|
|
|
|
String svrSavedPhotoPath = savedImgPath + "/" + filePath;
|
|
|
|
log.info("Mpower 이미지경로:::::" + svrImgPath);
|
|
|
|
log.info("Mpower 이미지경로:::::" + svrImgPath);
|
|
|
|
|
|
|
|
log.info("서버 download file path :::::" + svrSavedPhotoPath);
|
|
|
|
|
|
|
|
|
|
|
|
try{
|
|
|
|
try{
|
|
|
|
client.getConnection(fileServiceName);
|
|
|
|
client.getConnection(fileServiceName);
|
|
|
|
|
|
|
|
|
|
|
|
String mpowerFilePre = svrImgPath + "/P" + CommUtil.lpad(photocode, '0', 10);
|
|
|
|
String mpowerFilePre = String.format("%s%s%s", svrImgPath, "picad".equals(imgDiv)? "/P" : "/R", CommUtil.lpad(photocode, '0', 10));
|
|
|
|
log.info("Mpower 이미지 file name :::::" + mpowerFilePre + "A, B, C, D.jpg");
|
|
|
|
List<String> fileNames = Arrays.asList("A.jpg", "B.jpg", "C.jpg", "D.jpg", "E.jpg", "F.jpg", "G.jpg", "H.jpg", "I.jpg", "J.jpg", "K.jpg", "L.jpg", "M.jpg");
|
|
|
|
client.setInput("imageA",mpowerFilePre + "A.jpg"); //터널링에 실질 존재하는 경로,파일명
|
|
|
|
int index = 1;
|
|
|
|
client.setInput("imageB",mpowerFilePre + "B.jpg");
|
|
|
|
|
|
|
|
client.setInput("imageC",mpowerFilePre + "C.jpg");
|
|
|
|
if("picad".equals(imgDiv)){
|
|
|
|
client.setInput("imageD",mpowerFilePre + "D.jpg");
|
|
|
|
log.info("<<< ==== Mpower picad 이미지 file name ====>>>");
|
|
|
|
|
|
|
|
// A, B, C, D
|
|
|
|
|
|
|
|
for(int idx = 0; idx <=3; idx++) client.setInput("dnfile"+index++,mpowerFilePre + fileNames.get(idx));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else if("frecad".equals(imgDiv)) {
|
|
|
|
|
|
|
|
log.info("<<< ==== Mpower frecad 이미지 file name ====>>>");
|
|
|
|
|
|
|
|
index = 1;
|
|
|
|
|
|
|
|
// A, B, C, D
|
|
|
|
|
|
|
|
for (int idx = 0; idx <= 3; idx++) client.setInput("dnfile" + index++, mpowerFilePre + fileNames.get(idx));
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
log.info("<<< ==== Mpower contad 이미지 file name ====>>>");
|
|
|
|
|
|
|
|
index = 1;
|
|
|
|
|
|
|
|
// F, G, H, I
|
|
|
|
|
|
|
|
for (int idx = 5; idx <= 8; idx++) client.setInput("dnfile" + index++, mpowerFilePre + fileNames.get(idx));
|
|
|
|
|
|
|
|
}
|
|
|
|
client.Request();
|
|
|
|
client.Request();
|
|
|
|
String result = client.getString("result", 0, 0);
|
|
|
|
String result = client.getString("result", 0, 0);
|
|
|
|
|
|
|
|
File file = new File(svrSavedPhotoPath);
|
|
|
|
|
|
|
|
|
|
|
|
if (result.equals("true")){
|
|
|
|
if (result.equals("true")){
|
|
|
|
String svrSavedPhotoPath = savedImgPath + "/" + filePath;
|
|
|
|
fileDownAndSet(list, client, svrSavedPhotoPath, file);
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
throw new MpowerException("MPower File download error::"+result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------
|
|
|
|
|
|
|
|
// 단속사진 return
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------
|
|
|
|
|
|
|
|
if("picad".equals(imgDiv)) return list;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
disConnection(client);
|
|
|
|
|
|
|
|
client.getConnection(fileServiceName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------
|
|
|
|
|
|
|
|
// 진술서 return
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------
|
|
|
|
|
|
|
|
if("frecad".equals(imgDiv)) {
|
|
|
|
|
|
|
|
log.info("<<< ==== Mpower frecad 이미지 file name ====>>>");
|
|
|
|
|
|
|
|
// E
|
|
|
|
|
|
|
|
client.setInput("dnfile1", mpowerFilePre + "E.jpg");
|
|
|
|
|
|
|
|
client.Request();
|
|
|
|
|
|
|
|
result = client.getString("result", 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (result.equals("true")) {
|
|
|
|
if (Checks.isNotEmpty(client.getFileName("imageA"))) {
|
|
|
|
if (Checks.isNotEmpty(client.getFileName("imageA"))) {
|
|
|
|
if (!file.exists()) file.mkdirs();
|
|
|
|
if (!file.exists()) file.mkdirs();
|
|
|
|
|
|
|
|
if(!new File(svrSavedPhotoPath + "/" + client.getFileName("imageA")).exists()){
|
|
|
|
|
|
|
|
log.info("file download ::: {}", svrSavedPhotoPath + "/" + client.getFileName("imageA"));
|
|
|
|
client.savefile("imageA", svrSavedPhotoPath);
|
|
|
|
client.savefile("imageA", svrSavedPhotoPath);
|
|
|
|
setFileInfo(list, client.getFileName("imageA"), strpath);
|
|
|
|
}
|
|
|
|
log.info("서버 file name :::::" + strpath + client.getFileName("imageA"));
|
|
|
|
setFileInfo(list, client.getFileName("imageA"), svrSavedPhotoPath);
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
setNoFileInfo(list);
|
|
|
|
setNoFileInfo(list);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
disConnection(client);
|
|
|
|
|
|
|
|
client.getConnection(fileServiceName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------
|
|
|
|
|
|
|
|
// 참고자료 return
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------
|
|
|
|
|
|
|
|
log.info("<<< ==== Mpower contad 이미지 file name ====>>>");
|
|
|
|
|
|
|
|
index = 1;
|
|
|
|
|
|
|
|
// J, K, L, M
|
|
|
|
|
|
|
|
for (int idx = 9; idx <= 12; idx++) client.setInput("dnfile" + index++, mpowerFilePre + fileNames.get(idx));
|
|
|
|
|
|
|
|
client.Request();
|
|
|
|
|
|
|
|
result = client.getString("result", 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (result.equals("true")){
|
|
|
|
|
|
|
|
fileDownAndSet(list, client, svrSavedPhotoPath, file);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
throw new MpowerException("MPower File download error::"+result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
disConnection(client);
|
|
|
|
|
|
|
|
client.getConnection(fileServiceName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
client.setInput("dnfile1", mpowerFilePre + "N.jpg");
|
|
|
|
|
|
|
|
client.setInput("dnfile2", mpowerFilePre + "O.jpg");
|
|
|
|
|
|
|
|
client.Request();
|
|
|
|
|
|
|
|
result = client.getString("result", 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (result.equals("true")){
|
|
|
|
|
|
|
|
if(Checks.isNotEmpty(client.getFileName("imageA"))){
|
|
|
|
|
|
|
|
if(!file.exists()) file.mkdirs();
|
|
|
|
|
|
|
|
if(!new File(svrSavedPhotoPath + "/" + client.getFileName("imageA")).exists()){
|
|
|
|
|
|
|
|
log.info("file download ::: {}", svrSavedPhotoPath + "/" + client.getFileName("imageA"));
|
|
|
|
|
|
|
|
client.savefile("imageA", svrSavedPhotoPath);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
setFileInfo(list, client.getFileName("imageA"), svrSavedPhotoPath);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// else{
|
|
|
|
|
|
|
|
// setNoFileInfo(list);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
if(Checks.isNotEmpty(client.getFileName("imageB"))){
|
|
|
|
if(Checks.isNotEmpty(client.getFileName("imageB"))){
|
|
|
|
if(!file.exists()) file.mkdirs();
|
|
|
|
if(!file.exists()) file.mkdirs();
|
|
|
|
|
|
|
|
if(!new File(svrSavedPhotoPath + "/" + client.getFileName("imageB")).exists()){
|
|
|
|
|
|
|
|
log.info("file download ::: {}", svrSavedPhotoPath + "/" + client.getFileName("imageB"));
|
|
|
|
client.savefile("imageB", svrSavedPhotoPath);
|
|
|
|
client.savefile("imageB", svrSavedPhotoPath);
|
|
|
|
setFileInfo(list, client.getFileName("imageB"), strpath);
|
|
|
|
}
|
|
|
|
log.info("서버 file name :::::" + strpath + client.getFileName("imageB"));
|
|
|
|
setFileInfo(list, client.getFileName("imageB"), svrSavedPhotoPath);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// else{
|
|
|
|
|
|
|
|
// setNoFileInfo(list);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
setNoFileInfo(list);;
|
|
|
|
throw new MpowerException("MPower File download error::"+result);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
client = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
|
|
|
throw new MpowerException("MPower File download error::"+e.getLocalizedMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void fileDownAndSet(List<Map<String, Object>> list, Client client, String svrSavedPhotoPath, File file) throws IOException {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(Checks.isNotEmpty(client.getFileName("imageA"))){
|
|
|
|
|
|
|
|
if(!file.exists()) file.mkdirs();
|
|
|
|
|
|
|
|
if(!new File(svrSavedPhotoPath + "/" + client.getFileName("imageA")).exists()){
|
|
|
|
|
|
|
|
log.info("file download ::: {}", svrSavedPhotoPath + "/" + client.getFileName("imageA"));
|
|
|
|
|
|
|
|
client.savefile("imageA", svrSavedPhotoPath);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
setFileInfo(list, client.getFileName("imageA"), svrSavedPhotoPath);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// else{
|
|
|
|
|
|
|
|
// setNoFileInfo(list);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(Checks.isNotEmpty(client.getFileName("imageB"))){
|
|
|
|
|
|
|
|
if(!file.exists()) file.mkdirs();
|
|
|
|
|
|
|
|
if(!new File(svrSavedPhotoPath + "/" + client.getFileName("imageB")).exists()){
|
|
|
|
|
|
|
|
log.info("file download ::: {}", svrSavedPhotoPath + "/" + client.getFileName("imageB"));
|
|
|
|
|
|
|
|
client.savefile("imageB", svrSavedPhotoPath);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
setFileInfo(list, client.getFileName("imageB"), svrSavedPhotoPath);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// else{
|
|
|
|
|
|
|
|
// setNoFileInfo(list);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
if(Checks.isNotEmpty(client.getFileName("imageC"))){
|
|
|
|
if(Checks.isNotEmpty(client.getFileName("imageC"))){
|
|
|
|
if(!file.exists()) file.mkdirs();
|
|
|
|
if(!file.exists()) file.mkdirs();
|
|
|
|
|
|
|
|
if(!new File(svrSavedPhotoPath + "/" + client.getFileName("imageC")).exists()){
|
|
|
|
|
|
|
|
log.info("file download ::: {}", svrSavedPhotoPath + "/" + client.getFileName("imageC"));
|
|
|
|
client.savefile("imageC", svrSavedPhotoPath);
|
|
|
|
client.savefile("imageC", svrSavedPhotoPath);
|
|
|
|
setFileInfo(list, client.getFileName("imageC"), strpath);
|
|
|
|
}
|
|
|
|
log.info("서버 file name :::::" + strpath + client.getFileName("imageC"));
|
|
|
|
setFileInfo(list, client.getFileName("imageC"), svrSavedPhotoPath);
|
|
|
|
}else{
|
|
|
|
}
|
|
|
|
setNoFileInfo(list);;
|
|
|
|
// else{
|
|
|
|
};
|
|
|
|
// setNoFileInfo(list);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
if(Checks.isNotEmpty(client.getFileName("imageD"))){
|
|
|
|
if(Checks.isNotEmpty(client.getFileName("imageD"))){
|
|
|
|
if(!file.exists()) file.mkdirs();
|
|
|
|
if(!file.exists()) file.mkdirs();
|
|
|
|
|
|
|
|
if(!new File(svrSavedPhotoPath + "/" + client.getFileName("imageD")).exists()){
|
|
|
|
|
|
|
|
log.info("file download ::: {}", svrSavedPhotoPath + "/" + client.getFileName("imageD"));
|
|
|
|
client.savefile("imageD", svrSavedPhotoPath);
|
|
|
|
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);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}catch(Exception e){
|
|
|
|
setFileInfo(list, client.getFileName("imageD"), svrSavedPhotoPath);
|
|
|
|
throw new MpowerException("MPower File download error::"+e.getLocalizedMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//logger.debug(fph);
|
|
|
|
// else{
|
|
|
|
return list;
|
|
|
|
// setNoFileInfo(list);
|
|
|
|
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void setFileInfo(List<Map<String, Object>> list, String imgName, String strpath) {
|
|
|
|
private void setFileInfo(List<Map<String, Object>> list, String imgName, String strpath) {
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
map.put("imgName", imgName);
|
|
|
|
map.put("imgName", imgName);
|
|
|
|
map.put("url", strpath + imgName);
|
|
|
|
map.put("url", strpath + "/" + imgName);
|
|
|
|
list.add(map);
|
|
|
|
list.add(map);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|