|
@@ -256,7 +256,7 @@ public class GkjyrCtl extends BaseWebCtl {
|
|
|
list.add(cb.exists(subquery2));
|
|
|
}
|
|
|
// 企业性质
|
|
|
- if (StringUtils.isNotEmpty(qyxz)) {
|
|
|
+ /*if (StringUtils.isNotEmpty(qyxz)) {
|
|
|
list.add(cb.like(root.get("qyxz").as(String.class), "%" + qyxz + "%"));
|
|
|
} else {
|
|
|
String qyxzval = (String) CacheSearchCondition.cacheSCmapVal(cacheSCmap, "qyxz");
|
|
@@ -265,7 +265,7 @@ public class GkjyrCtl extends BaseWebCtl {
|
|
|
|
|
|
}
|
|
|
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
// 危货附证有效期
|
|
|
if (fzstartDate != null) {
|
|
@@ -2751,7 +2751,174 @@ public class GkjyrCtl extends BaseWebCtl {
|
|
|
|
|
|
@RequestMapping(value = "/exportExcelAll")
|
|
|
public String exportExcelAll(HttpServletResponse response, final String bwyt, final String whfzbh, final String sfcswhzy, final String sfcyxkz, final String gkjyr, final String szdid, final String szgkid, final String szgqid, final String gkjyxkzh, final String fddbr, final Date xkzstartDate, final Date xkzendDate, final Date fzstartDate, final Date fzendDate, final String jyrxkzsfdq) {
|
|
|
- Specification<GkjyrEntity> spec = new Specification<GkjyrEntity>() {
|
|
|
+ // 查询条件
|
|
|
+ Specification<GkjyrEntity> spec = new Specification<GkjyrEntity>() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Predicate toPredicate(Root<GkjyrEntity> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
|
|
|
+
|
|
|
+ boolean xkzflag = false;
|
|
|
+ boolean bwflag = false;
|
|
|
+
|
|
|
+ List<Predicate> list = new ArrayList<Predicate>();
|
|
|
+ //
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(gkjyr)) {
|
|
|
+
|
|
|
+ list.add(cb.like(root.get("gkjyr").as(String.class), "%" + gkjyr + "%"));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(szdid)) {
|
|
|
+ list.add(cb.like(root.get("szd").get("id").as(String.class), "%" + szdid + "%"));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(szgkid)) {
|
|
|
+ list.add(cb.like(root.get("szgk").get("id").as(String.class), "%" + szgkid + "%"));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(szgqid)) {
|
|
|
+ list.add(cb.like(root.get("szgq").get("id").as(String.class), "%" + szgqid + "%"));
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ * if (StringUtils.isNotEmpty(gkjyxkzh)) {
|
|
|
+ * list.add(cb.like(root.get("gkjyxkzh").as(String.class), "%" +
|
|
|
+ * gkjyxkzh + "%")); } else if (isGET(request)) {
|
|
|
+ * CacheSearchCondition.predicateList(list, cacheSCmap, root,
|
|
|
+ * cb, null, "gkjyxkzh"); }
|
|
|
+ */
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(fddbr)) {
|
|
|
+ list.add(cb.like(root.get("fddbr").as(String.class), "%" + fddbr + "%"));
|
|
|
+ }
|
|
|
+ // 危货附证编号
|
|
|
+ if (StringUtils.isNotEmpty(whfzbh)) {
|
|
|
+ list.add(cb.like(root.get("gkwxhwzyfzbh").as(String.class), "%" + whfzbh + "%"));
|
|
|
+ }
|
|
|
+ // 是否危货企业
|
|
|
+ if (StringUtils.isNotEmpty(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)))));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Subquery<BwEntity> subquery2 = query.subquery(BwEntity.class);
|
|
|
+ Root<BwEntity> dpRoot2 = subquery2.from(BwEntity.class);
|
|
|
+ subquery2.select(dpRoot2);
|
|
|
+ List<Predicate> subQueryPredicates2 = new ArrayList<Predicate>();
|
|
|
+ subQueryPredicates2.add(cb.equal(root.get("id").as(String.class), dpRoot2.get("ssjyr").get("id").as(String.class)));
|
|
|
+ // 泊位用途
|
|
|
+ if (StringUtils.isNotEmpty(bwyt)) {
|
|
|
+ subQueryPredicates2.add(cb.like(dpRoot2.get("bwyt").as(String.class), "%" + bwyt + "%"));
|
|
|
+ bwflag = true;
|
|
|
+ }
|
|
|
+ if (bwflag) {
|
|
|
+ subquery2.where(subQueryPredicates2.toArray(new Predicate[] {}));
|
|
|
+ list.add(cb.exists(subquery2));
|
|
|
+ }
|
|
|
+ /*// 企业性质
|
|
|
+ if (StringUtils.isNotEmpty(qyxz)) {
|
|
|
+ list.add(cb.like(root.get("qyxz").as(String.class), "%" + qyxz + "%"));
|
|
|
+ } */
|
|
|
+ // 危货附证有效期
|
|
|
+ if (fzstartDate != null) {
|
|
|
+ list.add(cb.greaterThanOrEqualTo(root.get("fzyxq").as(Date.class), fzstartDate));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (fzendDate != null) {
|
|
|
+ list.add(cb.lessThanOrEqualTo(root.get("fzyxq").as(Date.class), fzendDate));
|
|
|
+ }
|
|
|
+
|
|
|
+ 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 (!"all".equals(sfcyxkz)) {
|
|
|
+ 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));
|
|
|
+ subquery1.where(subQueryPredicates1.toArray(new Predicate[] {}));
|
|
|
+ list.add(cb.exists(subquery1));
|
|
|
+ } else {
|
|
|
+ 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));
|
|
|
+ subquery1.where(subQueryPredicates1.toArray(new Predicate[] {}));
|
|
|
+ list.add(cb.not(cb.exists(subquery1)));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 子查询
|
|
|
+ Subquery<XkzxxEntity> subquery = query.subquery(XkzxxEntity.class);
|
|
|
+ Root<XkzxxEntity> dpRoot = subquery.from(XkzxxEntity.class);
|
|
|
+ subquery.select(dpRoot);
|
|
|
+ List<Predicate> subQueryPredicates = new ArrayList<Predicate>();
|
|
|
+ Date now = new Date();
|
|
|
+ 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));
|
|
|
+ if (StringUtils.isNotEmpty(gkjyxkzh)) {
|
|
|
+ subQueryPredicates.add(cb.like(dpRoot.get("gkjyxkzh").as(String.class), "%" + gkjyxkzh + "%"));
|
|
|
+ xkzflag = true;
|
|
|
+ }
|
|
|
+ // 许可证有效期
|
|
|
+ if (xkzstartDate != null) {
|
|
|
+ subQueryPredicates.add(cb.greaterThanOrEqualTo(dpRoot.get("yxqz").as(Date.class), xkzstartDate));
|
|
|
+ xkzflag = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (xkzendDate != null) {
|
|
|
+ subQueryPredicates.add(cb.lessThanOrEqualTo(dpRoot.get("yxqz").as(Date.class), xkzendDate));
|
|
|
+ xkzflag = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 许可证是否将到期
|
|
|
+ if (StringUtils.isNotEmpty(jyrxkzsfdq)) {
|
|
|
+ if ((jyrxkzsfdq).equals("6103")) {
|
|
|
+ subQueryPredicates.add(cb.lessThanOrEqualTo(dpRoot.get("yxqz").as(Date.class), now));
|
|
|
+ subQueryPredicates.add(cb.equal(dpRoot.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
|
|
|
+ xkzflag = true;
|
|
|
+ } else if ((jyrxkzsfdq).equals("6101")) {
|
|
|
+ subQueryPredicates.add(cb.greaterThan(dpRoot.get("yxqz").as(Date.class), now));
|
|
|
+ subQueryPredicates.add(cb.equal(dpRoot.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
|
|
|
+ xkzflag = true;
|
|
|
+ } else {
|
|
|
+ subQueryPredicates.add(cb.lessThanOrEqualTo(dpRoot.get("yxqz").as(Date.class), DateTime.addDays(now, 30)));
|
|
|
+ subQueryPredicates.add(cb.greaterThan(dpRoot.get("yxqz").as(Date.class), now));
|
|
|
+ subQueryPredicates.add(cb.equal(dpRoot.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
|
|
|
+ xkzflag = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (xkzflag) {
|
|
|
+ subquery.where(subQueryPredicates.toArray(new Predicate[] {}));
|
|
|
+ list.add(cb.exists(subquery));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 经营人只能查看自己企业下的数据,非经营人只能查看自己所在地的数据
|
|
|
+ if (isJyr()) {
|
|
|
+ list.add(cb.like(root.get("id").as(String.class), "%" + getSsjyr().getId() + "%"));
|
|
|
+ } else {
|
|
|
+ In<String> in = cb.in(root.get("szgq").get("id").as(String.class));
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ List<String> gqlist = (List<String>) Utils.getSession().getAttribute("gqList");
|
|
|
+ if (gqlist != null && gqlist.size() > 0) {
|
|
|
+ for (int i = 0; i < gqlist.size(); i++) {
|
|
|
+ in.value(gqlist.get(i));
|
|
|
+ }
|
|
|
+ list.add(in);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 状态为0,9,10,11不显示
|
|
|
+ list.add(cb.notEqual(root.get("recordStatus").as(Integer.class), BaseEntity.RECORE_STATE_COPY));
|
|
|
+ list.add(cb.notEqual(root.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_DELETE));
|
|
|
+ list.add(cb.notEqual(root.get("recordStatus").as(Integer.class), BaseEntity.RECORE_STATE_BGFLAG));
|
|
|
+ list.add(cb.notEqual(root.get("recordStatus").as(Integer.class), BaseEntity.RECORE_STATE_ZXFLAG));
|
|
|
+
|
|
|
+ return cb.and(list.toArray(new Predicate[] {}));
|
|
|
+ }
|
|
|
+ };
|
|
|
+ /*Specification<GkjyrEntity> spec = new Specification<GkjyrEntity>() {
|
|
|
// 查询条件
|
|
|
@Override
|
|
|
public Predicate toPredicate(Root<GkjyrEntity> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
|
|
@@ -2896,7 +3063,8 @@ public class GkjyrCtl extends BaseWebCtl {
|
|
|
|
|
|
return cb.and(list.toArray(new Predicate[] {}));
|
|
|
}
|
|
|
- };
|
|
|
+ };*/
|
|
|
+
|
|
|
List<GkjyrEntity> list = query.findAll(spec, GkjyrEntity.class);
|
|
|
List<GkjyrVo> voList = entityToVo(list);
|
|
|
|