查询 备份
/**
* easyui AJAX请求数据
*
* @param request
* @param response
* @param dataGrid
* @param user
*/
@RequestMapping(params = "datagrid")
public void datagrid(DecMainEntity decMain, HttpServletRequest request, HttpServletResponse response,
DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(DecMainEntity.class, dataGrid);
String clientNo1 = request.getParameter("clientNo1");
String billNo1 = request.getParameter("billNo1");
String erpNo1 = request.getParameter("erpNo1");
String entryId1 = request.getParameter("entryId1");
String tradeMode = request.getParameter("tradeMode");
String contrNo = request.getParameter("contrNo");
String remark = request.getParameter("remark");
String shipment = request.getParameter("shipment");
String tradeAreaCode = request.getParameter("tradeAreaCode");
String declarationData = request.getParameter("declarationData");
// 是否删改单
String isdeetechange = request.getParameter("isdeetechange");
//商检日期值是否有
String sjsearch = request.getParameter("sjsearch");
//海关日期值是否有
String hgsearch = request.getParameter("hgsearch");
String goodsname = request.getParameter("goodsname");
String agentname = request.getParameter("agentname");
String overseasConsignorEname = request.getParameter("overseasConsignorEname");
String goodscode = request.getParameter("goodscode");
// 查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, decMain, request.getParameterMap());
try {
cq.eq("ieFlag", "I");
List<String> sss = new ArrayList<String>();
sss.add("1");
sss.add("6");
String[] strings = new String[sss.size()];
cq.in("bpmStatus", sss.toArray(strings));
if (StringUtil.isNotEmpty(clientNo1)) {
cq.like("clientNo", "%" + clientNo1 + "%");
}
if (StringUtil.isNotEmpty(contrNo)) {
cq.like("contrNo", "%" + contrNo + "%");
}
if(StringUtil.isNotEmpty(remark)) {
String remark2 = "%"+remark+"%";
String sql = "select route_order_code from ld_order_route where route_comment like ?";
List<String> ordercode = jdbcTemplate.queryForList(sql, String.class, remark2);
if (ordercode == null || ordercode.size() == 0) {
ordercode.add("2boycs");
}
String[] strings2 = new String[ordercode.size()];
cq.in("clientNo", ordercode.toArray(strings2));
}
if (StringUtil.isNotEmpty(shipment)) {
String a = ""shipment"" + ":" + """ + shipment + """;
cq.like("content", "%" + a + "%");
}
if (StringUtil.isNotEmpty(isdeetechange)) {
List<String> ordercode = jdbcTemplate.queryForList(
"select route_order_code from ld_order_route where route_des=?", String.class, isdeetechange);
if (ordercode == null || ordercode.size() == 0) {
ordercode.add("2boycs");
}
String[] strings3 = new String[ordercode.size()];
cq.in("clientNo", ordercode.toArray(strings3));
}
//商检日期是否有
if(StringUtil.isNotEmpty(sjsearch)) {
List<String> ordercode1 = jdbcTemplate.queryForList(
"select route_order_code from ld_order_route where route_state = '4' and route_time IS NOT NULL and route_time !=''", String.class);
String[] strings4 = new String[ordercode1.size()];
if("yes".equals(sjsearch)) {
cq.in("clientNo", ordercode1.toArray(strings4));
}
if("no".equals(sjsearch)) {
for(String s : ordercode1.toArray(strings4)) {
cq.notEq("clientNo", s);
}
}
}
//海关日期是否有
if(StringUtil.isNotEmpty(hgsearch)) {
List<String> ordercode1 = jdbcTemplate.queryForList(
"select route_order_code from ld_order_route where route_state = '5' and route_time IS NOT NULL and route_time !=''", String.class);
String[] strings5 = new String[ordercode1.size()];
if("yes".equals(hgsearch)) {
cq.in("clientNo", ordercode1.toArray(strings5));
}
if("no".equals(hgsearch)) {
for(String s : ordercode1.toArray(strings5)) {
cq.notEq("clientNo", s);
}
}
}
if (StringUtil.isNotEmpty(goodsname)) {
cq.like("content", "%" +goodsname+ "%");
}
if (StringUtil.isNotEmpty(agentname)) {
String a = ""agentName"" + ":" + """ + agentname + """;
cq.like("content", "%" + a + "%");
}
if (StringUtil.isNotEmpty(overseasConsignorEname)) {
String a = ""overseasConsignorEname"" + ":" + """ + overseasConsignorEname + """;
cq.like("content", "%" +overseasConsignorEname+ "%");
}
if (StringUtil.isNotEmpty(goodscode)) {
cq.like("content", "%" +goodscode+ "%");
}
if (StringUtil.isNotEmpty(entryId1)) {
cq.like("entryId", "%" + entryId1 + "%");
}
if (StringUtil.isNotEmpty(billNo1)) {
cq.like("billNo", "%" + billNo1 + "%");
}
if (StringUtil.isNotEmpty(erpNo1)) {
cq.like("erpNo", "%" + erpNo1 + "%");
}
if (StringUtil.isNotEmpty(tradeMode)) {
String a = ""tradeMode"" + ":" + """ + tradeMode + """;
cq.like("content", "%" + a + "%");
}
if (StringUtil.isNotEmpty(tradeAreaCode)) {
// cq.like("content", "%'tradeMode':'0110'%");
String a = ""tradeAreaCode"" + ":" + """ + tradeAreaCode + """;
cq.like("content", "%" + a + "%");
}
String contrNo1 = request.getParameter("contrNo1");
if (StringUtil.isNotEmpty(contrNo1)) {
cq.like("contrNo", "%" + contrNo1 + "%");
}
// 自定义追加查询条件
} catch (Exception e) {
throw new BusinessException(e.getMessage());
}
cq.add();
this.decMainService.getDataGridReturn(cq, true);
List<DecMainEntity> list = dataGrid.getResults();
Map<String, Map<String, Object>> extMap = new HashMap<String, Map<String, Object>>();
for (DecMainEntity temp : list) {
// 此为针对原来的行数据,拓展的新字段
Map m = new HashMap();
DecMainPage decmainpage1 = JSONObject.parseObject(temp.getContent(), DecMainPage.class);
m.put("tradeName", decmainpage1.getOwnerName());
m.put("tradeMode", decmainpage1.getTradeMode_value());
String clientNo = temp.getClientNo();
String sql = "select * from ld_order_route where route_order_code = '"+clientNo+"'";
RowMapper<LdOrderRouteEntity> rowMapper1=new BeanPropertyRowMapper<LdOrderRouteEntity>(LdOrderRouteEntity.class);
List<LdOrderRouteEntity> list2= jdbcTemplate.query(sql, rowMapper1);
if(list2!=null && list2.size()>0) {
LdOrderRouteEntity ldOrderRouteEntity = list2.get(0);
if(StringUtils.isNotEmpty(ldOrderRouteEntity.getRouteComment())) {
m.put("remark",ldOrderRouteEntity.getRouteComment() );
}
}
m.put("ownerName", decmainpage1.getOwnerName());
m.put("agentName", decmainpage1.getAgentName());
m.put("tradeAreaCode", decmainpage1.getTradeAreaCode_value());
m.put("tradeMode", decmainpage1.getTradeMode_value());
m.put("shipment", decmainpage1.getShipment());
String attnum=jdbcTemplate.queryForObject("select count(*) from t_s_attachment where note=?", String.class,temp.getClientNo());
m.put("attachmentCount", attnum);
extMap.put(temp.getId(), m);
}
TagUtil.datagrid(response, dataGrid, extMap);
}