增加流程生产订单查询api
This commit is contained in:
parent
ec4263dde1
commit
5d22fa9cef
|
|
@ -8,8 +8,10 @@ import nc.bs.trade.business.HYPubBO;
|
|||
import nc.itf.mmpac.pmo.pac0002.IPMOBusinessService;
|
||||
import nc.itf.mmpac.pmo.pac0002.IPMOQueryService;
|
||||
import nc.jdbc.framework.SQLParameter;
|
||||
import nc.jdbc.framework.processor.ColumnProcessor;
|
||||
import nc.jdbc.framework.processor.MapListProcessor;
|
||||
import nc.util.mmf.framework.base.MMCollectionUtil;
|
||||
import nc.util.mmf.framework.base.MMValueCheck;
|
||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO;
|
||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOItemVO;
|
||||
import nc.vo.pub.BusinessException;
|
||||
|
|
@ -350,6 +352,84 @@ public class PmoResource extends AbstractNCCRestResource {
|
|||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("queryByCondition")
|
||||
@Consumes({"application/json"})
|
||||
@Produces({"application/json"})
|
||||
public JSONString queryByCondition(Map<String, Object> paramMap) {
|
||||
if (MMValueCheck.isEmpty(paramMap)) {
|
||||
return ResultMessageUtil.exceptionToJSON("传入数据异常,参数不能为空", APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||
}
|
||||
if (MMValueCheck.isEmpty(paramMap.get("pk_org"))) {
|
||||
return ResultMessageUtil.exceptionToJSON("传入数据异常,组织参数为空", APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||
}
|
||||
try {
|
||||
StringBuilder whereSql = new StringBuilder();
|
||||
|
||||
// 处理时间范围参数 ts
|
||||
if (paramMap.containsKey("ts") && paramMap.get("ts") != null) {
|
||||
String tsRange = paramMap.get("ts").toString();
|
||||
if (tsRange.contains("~")) {
|
||||
String[] dates = tsRange.split("~");
|
||||
if (dates.length == 2) {
|
||||
whereSql.append(" AND ts BETWEEN '")
|
||||
.append(dates[0].trim())
|
||||
.append("' AND '")
|
||||
.append(dates[1].trim())
|
||||
.append("' ");
|
||||
}
|
||||
}
|
||||
}
|
||||
// 处理修改时间范围参数 modifiedtime
|
||||
if (paramMap.containsKey("modifiedtime") && paramMap.get("modifiedtime") != null) {
|
||||
String tsRange = paramMap.get("modifiedtime").toString();
|
||||
if (tsRange.contains("~")) {
|
||||
String[] dates = tsRange.split("~");
|
||||
if (dates.length == 2) {
|
||||
whereSql.append(" AND modifiedtime BETWEEN '")
|
||||
.append(dates[0].trim())
|
||||
.append("' AND '")
|
||||
.append(dates[1].trim())
|
||||
.append("' ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 处理组织参数 pk_org
|
||||
if (paramMap.containsKey("pk_org") && paramMap.get("pk_org") != null) {
|
||||
String sql = " SELECT pk_factory FROM org_factory " +
|
||||
" WHERE nvl(dr,0)= 0 and code = '" + paramMap.get("pk_org") + "' ";
|
||||
String pkOrg = (String) BASE_DAO.executeQuery(sql, new ColumnProcessor());
|
||||
whereSql.append(" AND pk_org = '")
|
||||
.append(pkOrg)
|
||||
.append("' ");
|
||||
}
|
||||
|
||||
if (paramMap.containsKey("vbillcode") && paramMap.get("vbillcode") != null) {
|
||||
whereSql.append(" AND vbillcode = '")
|
||||
.append(paramMap.get("vbillcode").toString())
|
||||
.append("' ");
|
||||
}
|
||||
if (paramMap.containsKey("fbillstatus") && paramMap.get("fbillstatus") != null) {
|
||||
whereSql.append(" AND fbillstatus = '")
|
||||
.append(paramMap.get("fbillstatus").toString())
|
||||
.append("' ");
|
||||
}
|
||||
|
||||
String finalWhereSql = "";
|
||||
if (!whereSql.isEmpty()) {
|
||||
// 去掉开头的 " AND "
|
||||
finalWhereSql = whereSql.substring(5);
|
||||
}
|
||||
// NCCForUAPLogger.debug("查询流程生产订单参数:" + finalWhereSql);
|
||||
IPMOQueryService pmoQuery = NCLocator.getInstance().lookup(IPMOQueryService.class);
|
||||
PMOAggVO[] pmoAggVOS = pmoQuery.queryByWhereSql(finalWhereSql);
|
||||
return ResultMessageUtil.toJSON(pmoAggVOS, "流程生产订单查询成功");
|
||||
} catch (BusinessException e) {
|
||||
return ResultMessageUtil.exceptionToJSON(e);
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("queryPmos")
|
||||
@Consumes({"application/json"})
|
||||
|
|
|
|||
Loading…
Reference in New Issue