增加根据code获取影像name方法(影像接口)

This commit is contained in:
zhanglei@ap-leasing.com.cn 2023-06-26 14:53:41 +08:00
parent 646ee76b8e
commit 804ce361cc

View File

@ -18,6 +18,7 @@ import org.dom4j.Element;
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class ImageUploadService {
@ -50,24 +51,30 @@ public class ImageUploadService {
}
return files;
}
public List<ImagePage> getPages(List<BizObject> bos) throws Exception {
public List<ImagePage> getPages(List<BizObject> bos,String remark) throws Exception {
List<ImagePage> pages = new ArrayList<>();
for(BizObject bo : bos){
String fileName = bo.getAttribute("filename").toString();
String inputUserId = bo.getAttribute("inputuserid").toString();
String inputOrgId = bo.getAttribute("inputorgid").toString();
ImagePage page = new ImagePage();
page.setFileName(fileName);
page.setUpUser(inputUserId);
page.setUpUserName(NameManager.getUserName(inputUserId));
page.setUpOrg(inputOrgId);
page.setUpOrgName(NameManager.getOrgName(inputOrgId));
page.setUpTime(StringFunction.getTodayNow());
ImagePage page = getPage(bo);
//备注默认为文件目录名
page.setRemark(remark);
pages.add(page);
}
return pages;
}
public ImagePage getPage(BizObject bo) throws Exception {
String fileName = bo.getAttribute("filename").toString();
String inputUserId = bo.getAttribute("inputuserid").toString();
String inputOrgId = bo.getAttribute("inputorgid").toString();
ImagePage page = new ImagePage();
page.setFileName(fileName);
page.setUpUser(inputUserId);
page.setUpUserName(NameManager.getUserName(inputUserId));
page.setUpOrg(inputOrgId);
page.setUpOrgName(NameManager.getOrgName(inputOrgId));
page.setUpTime(StringFunction.getTodayNow());
return page;
}
public void getAppInfo(JBOTransaction tx) throws Exception {
GetInfoUtil gif = new GetInfoUtil();
String appInfo = gif.getAppInfoByProjectNo(projectNo,flowNo,tx);
@ -88,6 +95,7 @@ public class ImageUploadService {
if(this.isHasContractFolder()){
fileCode = "APZLJJ000080";
}
ImageUpload imageUp = new ImageUpload();
imageUp.setAppCode(appCode);
imageUp.setAppName(appName);
@ -95,7 +103,7 @@ public class ImageUploadService {
imageUp.setNodeId(fileCode);
List<BizObject> boList = this.getFileBo(tx);
List<File> files = this.getFile(boList);
List<ImagePage> pageList = this.getPages(boList);
List<ImagePage> pageList = this.getPages(boList,this.getFileNameByCode(fileCode));
imageUp.setPageList(pageList);
String xmlUrl = imageUp.createXMl();
@ -122,6 +130,14 @@ public class ImageUploadService {
}
public boolean isHasContractFolder() throws Exception {
//APZLJJ000400为其它,APZLJJ000080为合同套系在影像系统查找核心系统已经没有对应信息
if("0000".equals(this.getFileNameByCode("APZLJJ000080"))){
return false;
}else{
return true;
}
}
public String getFileNameByCode(String fileCode) throws Exception {
ImageCount ic = new ImageCount();
ic.setAppCode(appCode);
ic.setAppName(appName);
@ -139,25 +155,19 @@ public class ImageUploadService {
throw new Exception(responseMsg);
}
if(countResult.contains("APZLJJ000080")){
return true;
}
//todo
/* 以后再改良先用上面的判断下
String fileCode = "APZLJJ000400";//APZLJJ000400为其它,APZLJJ000080为合同套系在影像系统查找核心系统已经没有对应信息
String docName = "0000";
List nodes = root.element("ATREE_ALL").elements("NODE");
for (Iterator it = nodes.iterator(); it.hasNext();) {
Element elm = (Element) it.next();
String newFileCode = elm.element("DOC_CODE").getTextTrim();
String newFileName = elm.element("DOC_NAME").getTextTrim();
//APZLJJ000080为合同套系
if("APZLJJ000080".equals(newFileCode)||newFileName.contains("合同套系")){
fileCode = "APZLJJ000080";
break;
if(fileCode.equals(elm.element("DOC_CODE").getTextTrim())){
return elm.element("DOC_NAME").getTextTrim();
}else{
continue;
}
}
*/
return false;
return docName;
}
public String getProjectId() {
return projectId;