2020-11-12 18:59:15 +08:00

61 lines
2.1 KiB
Java

package com.amarsoft.app.base.businessobject;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
public class FtpDownloadFile {
public static List<BusinessObject> loadBusinessObjects_SQL() throws Exception{
List<BusinessObject> lst=new ArrayList<BusinessObject>();
List<Map<String, String>> docList = DataOperatorUtil.getDataBySql("select itemname from CODE_LIBRARY where CodeNo='DocList' and IsInUse='1' and length(itemno)=6 group by itemname");
if(docList!=null){
int docInt = 1;
for (Map<String, String> map : docList) {
String itemname = map.get("itemname");
String SortNo = getNo(docInt);
BusinessObject bo = BusinessObject.createBusinessObject();
bo.setAttributeValue("ID", SortNo);
bo.setAttributeValue("SortNo", SortNo);
bo.setAttributeValue("Name",itemname);
lst.add(bo);
docInt++;
int docNameInt = 1;
List<Map<String, String>> docNameList = DataOperatorUtil.getDataBySql("SELECT doc_name as docName FROM LB_DOCCONFIG WHERE DOC_CLASS_ITEMNO IN (SELECT itemno FROM CODE_LIBRARY WHERE CodeNo='DocList' AND IsInUse='1' AND itemname='"+
itemname+"') GROUP BY doc_name");
if(docNameList!=null){
for (Map<String, String> map2 : docNameList) {
String docNameno = SortNo+getNo(docNameInt);
BusinessObject docNameBo = BusinessObject.createBusinessObject();
docNameBo.setAttributeValue("ID", docNameno);
docNameBo.setAttributeValue("SortNo", docNameno);
docNameBo.setAttributeValue("Name",map2.get("docName"));
lst.add(docNameBo);
docNameInt++;
}
}
}
}
//Ìí¼Ó×â½ð¼Æ»®ÏÔʾ
BusinessObject docRent = BusinessObject.createBusinessObject();
docRent.setAttributeValue("ID", "RentPlan");
docRent.setAttributeValue("SortNo", "RentPlan");
docRent.setAttributeValue("Name","×â½ð¼Æ»®±í");
lst.add(docRent);
return lst;
}
private static String getNo (int number){
if(number<10){
return "00"+ number;
}else if(number<100){
return "0"+ number;
}else {
return number+"";
}
}
}