|
|
@ -8,6 +8,7 @@ import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.context.annotation.Scope;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
|
|
import cokr.xit.base.file.FileInfo;
|
|
|
|
import cokr.xit.base.file.FileInfo;
|
|
|
@ -16,11 +17,16 @@ import cokr.xit.interfaces.saeol.SOHNN00004;
|
|
|
|
import cokr.xit.interfaces.saeol.SOHNN00011;
|
|
|
|
import cokr.xit.interfaces.saeol.SOHNN00011;
|
|
|
|
|
|
|
|
|
|
|
|
@Component("minwonBean")
|
|
|
|
@Component("minwonBean")
|
|
|
|
|
|
|
|
@Scope("prototype")
|
|
|
|
public class MinwonBean extends SaeolBean {
|
|
|
|
public class MinwonBean extends SaeolBean {
|
|
|
|
private EPeople epeople = new EPeople();
|
|
|
|
private EPeople epeople = new EPeople();
|
|
|
|
@Resource(name = "fileBean")
|
|
|
|
@Resource(name = "fileBean")
|
|
|
|
private FileBean fileBean;
|
|
|
|
private FileBean fileBean;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public MinwonBean() {
|
|
|
|
|
|
|
|
log().debug("MinwonBean created");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Map<String, Object> getMinwons(String deptCode, String startDate, String endDate) {
|
|
|
|
public Map<String, Object> getMinwons(String deptCode, String startDate, String endDate) {
|
|
|
|
log().debug("Getting minwons: '{}', {} ~ {}", deptCode, startDate, endDate);
|
|
|
|
log().debug("Getting minwons: '{}', {} ~ {}", deptCode, startDate, endDate);
|
|
|
|
SOHNN00004.Req00004 req00004 = new SOHNN00004.Req00004();
|
|
|
|
SOHNN00004.Req00004 req00004 = new SOHNN00004.Req00004();
|
|
|
@ -35,12 +41,39 @@ public class MinwonBean extends SaeolBean {
|
|
|
|
result.put("success", true);
|
|
|
|
result.put("success", true);
|
|
|
|
result.put("minwonsReceived", resp00004.getResult().size());
|
|
|
|
result.put("minwonsReceived", resp00004.getResult().size());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
resp00004.getResult().stream()
|
|
|
|
|
|
|
|
.map(item -> {
|
|
|
|
|
|
|
|
String cnsl_qna_no = item.getCnsl_qna_no();
|
|
|
|
|
|
|
|
SOHNN00011 sohnn00011 = getSOHNN00011(cnsl_qna_no, item.getDetail());
|
|
|
|
|
|
|
|
result.put(cnsl_qna_no, !sohnn00011.getResponse().error() ? "success" : "fail");
|
|
|
|
|
|
|
|
return sohnn00011;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.forEach(sohnn00011 -> {
|
|
|
|
|
|
|
|
List<FileInfo> files = sohnn00011.getFileInfos();
|
|
|
|
|
|
|
|
if (Configuration.logToDatabase())
|
|
|
|
|
|
|
|
fileBean.create(files);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
epeople.write(files);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sohnn00011.getConverted().forEach(File::delete);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
.forEach(sohnn00011 -> {
|
|
|
|
|
|
|
|
List<FileInfo> files = sohnn00011.getFileInfos();
|
|
|
|
|
|
|
|
if (Configuration.logToDatabase())
|
|
|
|
|
|
|
|
fileBean.create(files);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
epeople.write(files);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sohnn00011.getConverted().forEach(File::delete);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
for (SOHNN00004.Item item: resp00004.getResult()) {
|
|
|
|
for (SOHNN00004.Item item: resp00004.getResult()) {
|
|
|
|
String cnsl_qna_no = item.getCnsl_qna_no();
|
|
|
|
String cnsl_qna_no = item.getCnsl_qna_no();
|
|
|
|
SOHNN00011 sohnn00011 = getSOHNN00011(cnsl_qna_no, item.getDetail());
|
|
|
|
SOHNN00011 sohnn00011 = getSOHNN00011(cnsl_qna_no, item.getDetail());
|
|
|
|
result.put(cnsl_qna_no, !sohnn00011.getResponse().error() ? "success" : "fail");
|
|
|
|
result.put(cnsl_qna_no, !sohnn00011.getResponse().error() ? "success" : "fail");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -96,13 +129,42 @@ public class MinwonBean extends SaeolBean {
|
|
|
|
.setInfoType(SOHNN00011.INF_TYPE)
|
|
|
|
.setInfoType(SOHNN00011.INF_TYPE)
|
|
|
|
.setInfoKey(result.infoKey());
|
|
|
|
.setInfoKey(result.infoKey());
|
|
|
|
|
|
|
|
|
|
|
|
create(relation, phoneNo, resp.getFileinfo_m());
|
|
|
|
create(msg, relation, phoneNo, resp.getFileinfo_m());
|
|
|
|
create(relation, phoneNo, resp.getFileinfo_p());
|
|
|
|
create(msg, relation, phoneNo, resp.getFileinfo_p());
|
|
|
|
|
|
|
|
// create(relation, phoneNo, resp.getFileinfo_m());
|
|
|
|
|
|
|
|
// create(relation, phoneNo, resp.getFileinfo_p());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return resp;
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void create(SOHNN00011 msg, FileInfo.Relation relation, String phoneNo, List<SOHNN00011.FileItem> fileItems) {
|
|
|
|
|
|
|
|
ArrayList<File> converted = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<FileInfo> files = fileItems.stream()
|
|
|
|
|
|
|
|
.map(fileItem -> {
|
|
|
|
|
|
|
|
FileInfo fileInfo = epeople.download(fileItem.getFile_path(), phoneNo);
|
|
|
|
|
|
|
|
if (fileInfo == null) return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
relation.setInfo(fileInfo);
|
|
|
|
|
|
|
|
String file_type = fileItem.getFile_type();
|
|
|
|
|
|
|
|
fileInfo.setSubType(file_type);
|
|
|
|
|
|
|
|
fileInfo.setSubCode("M".equals(file_type) ? fileItem.getFile_id_m() : fileItem.getFile_id_p());
|
|
|
|
|
|
|
|
fileInfo.setSortOrder(fileItem.getFile_seq());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
File jpg = epeople.pngToJpg(fileInfo);
|
|
|
|
|
|
|
|
if (jpg != null)
|
|
|
|
|
|
|
|
converted.add(jpg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return fileInfo;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.filter(fileInfo -> fileInfo != null)
|
|
|
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
msg.addFileInfos(files);
|
|
|
|
|
|
|
|
msg.addConverted(converted);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void create(FileInfo.Relation relation, String phoneNo, List<SOHNN00011.FileItem> fileItems) {
|
|
|
|
private void create(FileInfo.Relation relation, String phoneNo, List<SOHNN00011.FileItem> fileItems) {
|
|
|
|
ArrayList<File> converted = new ArrayList<>();
|
|
|
|
ArrayList<File> converted = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|