影像资料清单校验采用数量统计校验所有必填
This commit is contained in:
parent
6b76dc6075
commit
c368a71270
@ -0,0 +1,99 @@
|
||||
package com.tenwa.lease.flow.project.commcheck;
|
||||
|
||||
import com.amarsoft.app.alarm.AlarmBiz;
|
||||
import com.amarsoft.awe.util.Transaction;
|
||||
import com.ample.icms.query.ImageCount;
|
||||
import com.ample.icms.util.GetInfoUtil;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentHelper;
|
||||
import org.dom4j.Element;
|
||||
import org.dom4j.Node;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资料清单检查
|
||||
* @author 20170524
|
||||
*
|
||||
*/
|
||||
public class IcmsDocListCheckAll extends AlarmBiz {
|
||||
@Override
|
||||
public Object run(Transaction Sqlca) throws Exception {
|
||||
String responseCode = "";
|
||||
String responseMsg = "资料未初始化,请联系IT管理员!";
|
||||
String flowUnid = this.getAttribute("ObjectNo").toString();
|
||||
GetInfoUtil gif = new GetInfoUtil();
|
||||
String projectNo = gif.getProjectNoByFlowUnid(flowUnid);
|
||||
if (projectNo == null) {
|
||||
setPass(false);
|
||||
putMsg("未找到匹配的项目编号,请联系IT管理员!");
|
||||
return null;
|
||||
}
|
||||
String app = gif.getAppInfoByFlowUnid(flowUnid);
|
||||
String[] appInfo = app.split("@");
|
||||
String appCode = appInfo[0];
|
||||
String appName = appInfo[1];
|
||||
if ("0000".equals(appCode)) {
|
||||
setPass(false);
|
||||
putMsg(appName);
|
||||
return null;
|
||||
}
|
||||
ImageCount ic = new ImageCount();
|
||||
ic.setAppCode(appCode);
|
||||
ic.setAppName(appName);
|
||||
ic.setBusiNo(projectNo);
|
||||
String result = ic.getResult();
|
||||
//校验链接是否成功
|
||||
if ("0000".equals(result)) {
|
||||
setPass(false);
|
||||
putMsg("连接影像系统失败,请及时联系IT管理员!");
|
||||
return null;
|
||||
}
|
||||
Document dom = DocumentHelper.parseText(result);
|
||||
Element root = dom.getRootElement();
|
||||
responseCode = root.element("RESPONSE_CODE").getTextTrim();
|
||||
//校验返回结果
|
||||
if ("400".equals(responseCode)) {
|
||||
setPass(false);
|
||||
responseMsg = root.element("RESPONSE_MSG").getTextTrim();
|
||||
putMsg(responseMsg);
|
||||
return null;
|
||||
}
|
||||
//校验总个数
|
||||
String sumImgs = root.element("RETURN_DATA").element("SUM_IMGS").getTextTrim();
|
||||
if ("0".equals(sumImgs)) {
|
||||
setPass(false);
|
||||
responseMsg = root.element("RESPONSE_MSG").getTextTrim();
|
||||
putMsg(responseMsg);
|
||||
return null;
|
||||
}
|
||||
List nodes = root.element("ATREE_ALL").elements("NODE");
|
||||
for (Iterator it = nodes.iterator(); it.hasNext(); ) {
|
||||
Element elm = (Element) it.next();
|
||||
String isMust = elm.element("IS_MUST").getTextTrim();
|
||||
String docName = elm.element("DOC_NAME").getTextTrim();
|
||||
if ("0".equals(isMust)) {
|
||||
continue;
|
||||
}
|
||||
String docCode = elm.element("DOC_CODE").getTextTrim();
|
||||
Node node = root.element("RETURN_DATA").element("NODES").selectSingleNode("//NODE/NODE_ID[text()='" + docCode + "']");
|
||||
if (node == null) {
|
||||
setPass(false);
|
||||
putMsg( docName + ":未上传");
|
||||
return null;
|
||||
}
|
||||
Element test = node.getParent();
|
||||
String imgNum = test.elementText("IMG_NUM");
|
||||
if (Integer.parseInt(imgNum)<=0) {
|
||||
setPass(false);
|
||||
putMsg(docName + ":未上传");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
setPass(true);
|
||||
putMsg("资料已按规则上传完成");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user