瀏覽代碼

git-svn-id: https://192.168.57.71/svn/jsgkj@1370 931142cf-59ea-a443-aa0e-51397b428577

ld_liqk 8 年之前
父節點
當前提交
12a9db9058

+ 1 - 1
gkjsjy/trunk/src/com/xt/jygl/common/Constants.java

@@ -132,7 +132,7 @@ public class Constants {
 	/**
 	 * 泊位所在水域类型
 	 */
-	public static final String GROUP_CODE_GQSZSYLX = "BWSZSX";
+	public static final String GROUP_CODE_BWSZSYLX = "BWSZSYLX";
 	/**
 	 * 港区所在水域类型
 	 */

+ 34 - 34
gkjsjy/trunk/src/com/xt/jygl/gkjygl/gkjyr/jyrbw/ctl/BwCtl.java

@@ -201,7 +201,7 @@ public class BwCtl extends BaseWebCtl {
 							list.add(cb.like(root.get("bwyt").as(String.class), "%" + v + "%"));
 						}
 					}
-					
+
 				}
 				// 经营人只能查看自己企业下的数据,非经营人只能查看自己所在地的数据
 				if (isJyr()) {
@@ -249,9 +249,9 @@ public class BwCtl extends BaseWebCtl {
 		}
 		Utils.getSession().setAttribute("user", user2);
 
-		 if (page.getPage() < 1) {
-		 page.setPage(SearchCondition.bwpage);
-		 }
+		if (page.getPage() < 1) {
+			page.setPage(SearchCondition.bwpage);
+		}
 		page.setSort("id");
 		page.setOrder("desc");
 
@@ -323,10 +323,9 @@ public class BwCtl extends BaseWebCtl {
 
 		}
 
-	
 		if (isPOST(request)) {
-			SearchCondition.bwpage=page.getPage();
-			//cacheSCmap.put("bwpage", page.getPage());
+			SearchCondition.bwpage = page.getPage();
+			// cacheSCmap.put("bwpage", page.getPage());
 			CacheSearchCondition.putCacheSCmap(request.getParameterMap(), cacheSCmap);
 		}
 
@@ -388,7 +387,7 @@ public class BwCtl extends BaseWebCtl {
 	@RequestMapping(value = "/save")
 	@ResponseBody
 	@RequiresPermissions("bwxx:add")
-	public WebJsonResult save(Model model, String path, BwEntity code, String bwszhdid, String szdid, String szgkid, String szgqid, String ssjyrid, String ssmtid, String bwsxid, String fwlxid, String wxpbwid, String zyhbwflid, String sffzid, String sfdwkfid, String bwszsxid, String sclxid, String jgxsid, String sszyqid, String zlsid, String xpid, String kbcblxid,String sfwygkghaxnid,String abid) {
+	public WebJsonResult save(Model model, String path, BwEntity code, String bwszhdid, String szdid, String szgkid, String szgqid, String ssjyrid, String ssmtid, String bwsxid, String fwlxid, String wxpbwid, String zyhbwflid, String sffzid, String sfdwkfid, String bwszsxid, String sclxid, String jgxsid, String sszyqid, String zlsid, String xpid, String kbcblxid, String sfwygkghaxnid, String abid) {
 		WebJsonResult wr = success();
 		if (StringUtils.isEmpty(szdid)) {
 			wr.setSuccess(false);
@@ -410,10 +409,10 @@ public class BwCtl extends BaseWebCtl {
 			wr.setSuccess(false);
 			wr.setMessage("请选择所属码头");
 		}
-/*		if (StringUtils.isEmpty(sszyqid)) {
-			wr.setSuccess(false);
-			wr.setMessage("请选择所在作业区");
-		}*/
+		/*
+		 * if (StringUtils.isEmpty(sszyqid)) { wr.setSuccess(false);
+		 * wr.setMessage("请选择所在作业区"); }
+		 */
 		if (StringUtils.isEmpty(sffzid)) {
 			wr.setSuccess(false);
 			wr.setMessage("请选择是否取得港口设施保安证书");
@@ -472,19 +471,19 @@ public class BwCtl extends BaseWebCtl {
 			entity.setBwdm(code.getBwdm());
 
 			entity.setGkaxsyzh(code.getGkaxsyzh());
-			
-			if(!StringUtils.isEmpty(sfwygkghaxnid)){
+
+			if (!StringUtils.isEmpty(sfwygkghaxnid)) {
 				CodeEntity sfwygkghaxn = new CodeEntity();
 				sfwygkghaxn.setId(sfwygkghaxnid);
 				entity.setSfwygkghaxn(sfwygkghaxn);
 			}
-			
-			if(!StringUtils.isEmpty(abid)){
+
+			if (!StringUtils.isEmpty(abid)) {
 				CodeEntity ab = new CodeEntity();
 				ab.setId(abid);
 				entity.setAb(ab);
 			}
-			
+
 			CodeEntity szd = new CodeEntity(szdid);
 			entity.setSzd(szd);
 
@@ -577,17 +576,18 @@ public class BwCtl extends BaseWebCtl {
 			}
 			bwService.save(entity);
 			// 如果是市级新增或者修改,保存后同步到省级
-//			try {
-//				if (GlobalData.DEPLOY_MODE.equals(Constants.DEPLOY_MODE_CITY) && needWS()) {
-//					BwWebService webService = bwService.getWebService(null);
-//					webService.save(code);
-//					code.setTbzt(Constants.YES);
-//					bwService.save(code);
-//				}
-//			} catch (Exception e) {
-//				code.setTbzt(Constants.NO);
-//				bwService.save(code);
-//			}
+			// try {
+			// if (GlobalData.DEPLOY_MODE.equals(Constants.DEPLOY_MODE_CITY) &&
+			// needWS()) {
+			// BwWebService webService = bwService.getWebService(null);
+			// webService.save(code);
+			// code.setTbzt(Constants.YES);
+			// bwService.save(code);
+			// }
+			// } catch (Exception e) {
+			// code.setTbzt(Constants.NO);
+			// bwService.save(code);
+			// }
 		} catch (Exception e) {
 			wr.setSuccess(false);
 			wr.setMessage("操作失败!");
@@ -913,7 +913,7 @@ public class BwCtl extends BaseWebCtl {
 	@RequestMapping(value = "/selectBwszsx")
 	@ResponseBody
 	public List<CodeEntity> selectBwszsx() {
-		List<CodeEntity> list = securityMgr.codeService().findValidCodesByGroupCode(Constants.GROUP_CODE_GQSZSYLX);
+		List<CodeEntity> list = securityMgr.codeService().findValidCodesByGroupCode(Constants.GROUP_CODE_BWSZSYLX);
 		return list;
 	}
 
@@ -1153,7 +1153,7 @@ public class BwCtl extends BaseWebCtl {
 				vo.setXp(entity.getXp() != null ? entity.getXp().getId() : "");
 				vo.setXpzw(entity.getXp() != null ? entity.getXp().getText() : "");
 				vo.setBwszhd(entity.getBwszhd() != null ? entity.getBwszhd().getText() : "");
-				
+
 				if (entity.getBwyt() != null) {
 					String bwytzw = "";
 					String[] s = entity.getBwyt().split(",");
@@ -1168,7 +1168,7 @@ public class BwCtl extends BaseWebCtl {
 						}
 					}
 					vo.setBwytzw(bwytzw);
-				}else{
+				} else {
 					vo.setBwytzw("");
 				}
 				vo.setSzd(entity.getSzd() != null ? entity.getSzd().getId() : "");
@@ -1194,14 +1194,14 @@ public class BwCtl extends BaseWebCtl {
 
 	@RequestMapping(value = "selectAb")
 	@ResponseBody
-	public List<CodeEntity> selectAb(){
+	public List<CodeEntity> selectAb() {
 		List<CodeEntity> list = securityMgr.codeService().findValidCodesByGroupCode("AB");
 		return list;
 	}
-	
+
 	@RequestMapping(value = "selectSfwygkghaxn")
 	@ResponseBody
-	public List<CodeEntity> selectSfwyghaxn(){
+	public List<CodeEntity> selectSfwyghaxn() {
 		List<CodeEntity> list = securityMgr.codeService().findValidCodesByGroupCode("SF");
 		return list;
 	}

+ 62 - 43
gkjsjy/trunk/src/com/xt/jygl/gkjygl/gkjyr/jyrjbxx/ctl/GkjyrCtl.java

@@ -170,6 +170,7 @@ public class GkjyrCtl extends BaseWebCtl {
 			public Predicate toPredicate(Root<GkjyrEntity> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
 
 				boolean xkzflag = false;
+				boolean xkzflag1 = false;
 				boolean bwflag = false;
 
 				List<Predicate> list = new ArrayList<Predicate>();
@@ -217,13 +218,17 @@ public class GkjyrCtl extends BaseWebCtl {
 				}
 				// 是否危货企业
 				if (StringUtils.isNotEmpty(sfcswhzy)) {
-					if (!sfcswhzy.equals("all")) {
-						list.add(cb.like(root.get("sfwhqy").get("id").as(String.class), "%" + sfcswhzy + "%"));
+					if ("201".equals(sfcswhzy)) {
+						list.add(cb.equal(root.get("sfwhqy").get("id").as(String.class), "201"));
+					} else if ("202".equals(sfcswhzy)) {
+						list.add((cb.or(cb.equal(root.get("sfwhqy").get("id").as(String.class), "202"), cb.isNotNull(root.get("sfwhqy").get("id").as(String.class)))));
 					}
 				} else if (isGET(request)) {
 					String sfcswhzy = (String) CacheSearchCondition.cacheSCmapVal(cacheSCmap, "sfcswhzy");
-					if (!"all".equals(sfcswhzy)) {
-						CacheSearchCondition.predicateList(list, cacheSCmap, root, cb, "id", "sfwhqy", "sfcswhzy");
+					if ("201".equals(sfcswhzy)) {
+						list.add(cb.equal(root.get("sfwhqy").get("id").as(String.class), "201"));
+					} else if ("202".equals(sfcswhzy)) {
+						list.add((cb.or(cb.equal(root.get("sfwhqy").get("id").as(String.class), "202"), cb.isNull(root.get("sfwhqy").get("id").as(String.class)))));
 					}
 				}
 
@@ -296,6 +301,54 @@ public class GkjyrCtl extends BaseWebCtl {
 					}
 
 				}
+
+				Subquery<XkzxxEntity> subquery1 = query.subquery(XkzxxEntity.class);
+				Root<XkzxxEntity> dpRoot1 = subquery1.from(XkzxxEntity.class);
+				subquery1.select(dpRoot1);
+				List<Predicate> subQueryPredicates1 = new ArrayList<Predicate>();
+				// 是否有许可证
+				if (StringUtils.isNotEmpty(sfcyxkz)) {
+					if (!sfcyxkz.equals("all")) {
+						if ("201".equals(sfcyxkz)) {
+							subQueryPredicates1.add(cb.equal(dpRoot1.get("gkjyr").as(String.class), root.get("id").as(String.class)));
+							subQueryPredicates1.add(cb.equal(dpRoot1.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
+							subQueryPredicates1.add(cb.equal(dpRoot1.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
+							xkzflag1 = true;
+						} else {
+							// subQueryPredicates.add(cb.or(cb.notEqual(dpRoot.get("gkjyr").as(String.class),
+							// root.get("id").as(String.class)),
+							// cb.and(cb.equal(dpRoot.get("gkjyr").as(String.class),
+							// root.get("id").as(String.class))),
+							// cb.notEqual(dpRoot.get("recordStatus").as(Integer.class),
+							// BaseEntity.RECORD_STATE_VALID)));
+							Predicate p1 = cb.notEqual(dpRoot1.get("gkjyr").as(String.class), root.get("id").as(String.class));
+							Predicate p2 = cb.and(cb.equal(dpRoot1.get("gkjyr").as(String.class), root.get("id").as(String.class)), cb.notEqual(dpRoot1.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
+							Predicate p3 = cb.and(cb.equal(dpRoot1.get("gkjyr").as(String.class), root.get("id").as(String.class)), cb.equal(dpRoot1.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_VALID), cb.notEqual(dpRoot1.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
+							subQueryPredicates1.add(cb.or(p1, p2, p3));
+							xkzflag1 = true;
+						}
+					}
+				} else if (isGET(request)) {
+					String sfcyxkzval = (String) CacheSearchCondition.cacheSCmapVal(cacheSCmap, "sfcyxkz");
+					if (!"all".equals(sfcyxkzval) && StringUtils.isNotEmpty(sfcyxkzval)) {
+						if ("201".equals(sfcyxkzval)) {
+							subQueryPredicates1.add(cb.equal(dpRoot1.get("gkjyr").as(String.class), root.get("id").as(String.class)));
+							subQueryPredicates1.add(cb.equal(dpRoot1.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
+							subQueryPredicates1.add(cb.equal(dpRoot1.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
+							xkzflag1 = true;
+						} else {
+							Predicate p1 = cb.notEqual(dpRoot1.get("gkjyr").as(String.class), root.get("id").as(String.class));
+							Predicate p2 = cb.and(cb.equal(dpRoot1.get("gkjyr").as(String.class), root.get("id").as(String.class)), cb.notEqual(dpRoot1.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
+							Predicate p3 = cb.and(cb.equal(dpRoot1.get("gkjyr").as(String.class), root.get("id").as(String.class)), cb.equal(dpRoot1.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_VALID), cb.notEqual(dpRoot1.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
+							subQueryPredicates1.add(cb.or(p1, p2, p3));
+							xkzflag1 = true;
+						}
+					}
+				}
+				if (xkzflag1) {
+					subquery1.where(subQueryPredicates1.toArray(new Predicate[] {}));
+					list.add(cb.exists(subquery1));
+				}
 				// 子查询
 				Subquery<XkzxxEntity> subquery = query.subquery(XkzxxEntity.class);
 				Root<XkzxxEntity> dpRoot = subquery.from(XkzxxEntity.class);
@@ -338,39 +391,6 @@ public class GkjyrCtl extends BaseWebCtl {
 						xkzflag = true;
 					}
 				}
-				// 是否有许可证
-				if (StringUtils.isNotEmpty(sfcyxkz)) {
-					if (!sfcyxkz.equals("all")) {
-						if (!sfcyxkz.equals("201")) {
-							subQueryPredicates.add(cb.equal(dpRoot.get("gkjyr").as(String.class), root.get("id").as(String.class)));
-							subQueryPredicates.add(cb.equal(dpRoot.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
-							subQueryPredicates.add(cb.equal(dpRoot.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
-							xkzflag = true;
-						} else {
-							// subQueryPredicates.add(cb.or(cb.notEqual(dpRoot.get("gkjyr").as(String.class),
-							// root.get("id").as(String.class)),
-							// cb.and(cb.equal(dpRoot.get("gkjyr").as(String.class),
-							// root.get("id").as(String.class))),
-							// cb.notEqual(dpRoot.get("recordStatus").as(Integer.class),
-							// BaseEntity.RECORD_STATE_VALID)));
-							subQueryPredicates.add(cb.not(cb.and(cb.equal(dpRoot.get("gkjyr").as(String.class), root.get("id").as(String.class)), cb.equal(dpRoot.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_VALID), cb.equal(dpRoot.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID))));
-							xkzflag = true;
-						}
-					}
-				} else if (isGET(request)) {
-					String sfcyxkzval = (String) CacheSearchCondition.cacheSCmapVal(cacheSCmap, "sfcyxkz");
-					if (!"all".equals(sfcyxkzval) && StringUtils.isNotEmpty(sfcyxkzval)) {
-						if (!"201".equals(sfcyxkzval)) {
-							subQueryPredicates.add(cb.equal(dpRoot.get("gkjyr").as(String.class), root.get("id").as(String.class)));
-							subQueryPredicates.add(cb.equal(dpRoot.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
-							subQueryPredicates.add(cb.equal(dpRoot.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
-							xkzflag = true;
-						} else {
-							subQueryPredicates.add(cb.not(cb.and(cb.equal(dpRoot.get("gkjyr").as(String.class), root.get("id").as(String.class)), cb.equal(dpRoot.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_VALID), cb.equal(dpRoot.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID))));
-							xkzflag = true;
-						}
-					}
-				}
 
 				// 许可证是否将到期
 				if (StringUtils.isNotEmpty(jyrxkzsfdq)) {
@@ -381,8 +401,8 @@ public class GkjyrCtl extends BaseWebCtl {
 						subQueryPredicates.add(cb.greaterThan(dpRoot.get("yxqz").as(Date.class), now));
 						xkzflag = true;
 					} else {
-						// subQueryPredicates.add(cb.lessThanOrEqualTo(dpRoot.get("yxqz").as(Date.class),
-						// DateTime.addDays(now, 30)));
+						subQueryPredicates.add(cb.lessThanOrEqualTo(dpRoot.get("yxqz").as(Date.class), DateTime.addDays(now, 30)));
+						xkzflag = true;
 					}
 				} else {
 					String jyrxkzsfdqval = (String) CacheSearchCondition.cacheSCmapVal(cacheSCmap, "jyrxkzsfdq");
@@ -394,8 +414,8 @@ public class GkjyrCtl extends BaseWebCtl {
 							subQueryPredicates.add(cb.greaterThan(dpRoot.get("yxqz").as(Date.class), now));
 							xkzflag = true;
 						} else {
-							// subQueryPredicates.add(cb.lessThanOrEqualTo(dpRoot.get("yxqz").as(Date.class),
-							// DateTime.addDays(now, 30)));
+							subQueryPredicates.add(cb.lessThanOrEqualTo(dpRoot.get("yxqz").as(Date.class), DateTime.addDays(now, 30)));
+							xkzflag = true;
 						}
 					}
 				}
@@ -2599,8 +2619,7 @@ public class GkjyrCtl extends BaseWebCtl {
 						subQueryPredicates.add(cb.greaterThan(dpRoot.get("yxqz").as(Date.class), now));
 						xkzflag = true;
 					} else {
-						// subQueryPredicates.add(cb.lessThanOrEqualTo(dpRoot.get("yxqz").as(Date.class),
-						// DateTime.addDays(now, 30)));
+						subQueryPredicates.add(cb.lessThanOrEqualTo(dpRoot.get("yxqz").as(Date.class), DateTime.addDays(now, 30)));
 					}
 				}
 				if (xkzflag) {