Browse Source

git-svn-id: https://192.168.57.71/svn/lyggkj@131 1a6f6e3a-4066-fe46-b609-79c204482ece

xt_xuhao 8 years ago
parent
commit
6d6f191560

+ 1 - 1
gkaq/yjpt-java/trunk/.classpath

@@ -10,7 +10,7 @@
 			<attribute name="owner.project.facets" value="jst.web"/>
 		</attributes>
 	</classpathentry>
-	<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_45"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
 	<classpathentry kind="output" path="yjpt/WEB-INF/classes"/>
 </classpath>

+ 2 - 4
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/controller/gg/GgController.java

@@ -128,10 +128,8 @@ public class GgController extends BaseController {
 				Page<GgEntity> pageList = ggService.findAll(spec, pageable);
 				bc = createBusinessContext(pageList);
 			} else {
-				addNotEmptyModel(filterList, "recordStatus",
-						BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
-				Specification<GgEntity> spec = SpecificationCreater
-						.searchByPredicateModels(filterList);
+				addNotEmptyModel(filterList, "recordStatus", BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
+				Specification<GgEntity> spec = SpecificationCreater.searchByPredicateModels(filterList);
 				Page<GgEntity> pageList = ggService.findAll(spec, pageable);
 				for (GgEntity gg : pageList) {
 					gg = loadAccessory(gg);

+ 1 - 2
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/service/gg/GgService.java

@@ -24,8 +24,7 @@ public interface GgService {
 
     public List<GgEntity> findAllGg();
 
-    public Page<GgEntity> findAll(Specification<GgEntity> spec,
-	    Pageable pageable);
+    public Page<GgEntity> findAll(Specification<GgEntity> spec, Pageable pageable);
 
     public <S extends GgEntity> S save(S entity);
 

+ 76 - 36
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/webService/gg/GgWebService.java

@@ -6,6 +6,11 @@ import java.util.List;
 
 import javax.jws.HandlerChain;
 import javax.jws.WebService;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+import javax.persistence.criteria.Subquery;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
@@ -21,6 +26,7 @@ import com.jtgh.yjpt.common.SpecificationCreater;
 import com.jtgh.yjpt.common.Utils;
 import com.jtgh.yjpt.controller.BaseController;
 import com.jtgh.yjpt.entity.BaseEntity;
+import com.jtgh.yjpt.entity.auth.UserEntity;
 import com.jtgh.yjpt.entity.common.AccessoryEntity;
 import com.jtgh.yjpt.entity.gg.GgEntity;
 import com.jtgh.yjpt.entity.gg.GgViewEntity;
@@ -126,47 +132,81 @@ public class GgWebService extends BaseController {
     }
     
     /**
-     * 分页查询公告信息
-     * @param lkr
-     * @param title
-     * @param n
-     * @param pageCount
+     * 分页查询公告信息--公告管理
+     * @param lkr		 落款人	
+     * @param title		 标题
+     * @param n			 每页数据条数
+     * @param pageCount 页码
      * @return
      */
-    public List<GgEntity> getGgPageListByParams(String lkr, String title,int n, int pageCount){
-    	List<PredicateModel> filterList = new ArrayList<PredicateModel>();
-		addNotEmptyModel(filterList, "lkr", lkr, PredicateModel.Operator.LIKE);
-		addNotEmptyModel(filterList, "title", title,
-				PredicateModel.Operator.LIKE);
-		// 只检索非删除状态记录
-		addNotEmptyModel(filterList, "recordStatus",
-				BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
-		Specification<GgEntity> spec = SpecificationCreater
-				.searchByPredicateModels(filterList);
-		SinglePageRequest page = new SinglePageRequest(pageCount, n,
-				"desc", "id");
-		Page<GgEntity> pageList = service.findAll(spec, page);
-		if (pageList == null || pageList.getTotalPages() <= pageCount) {
-			return new ArrayList<GgEntity>();
-		}
-		for (GgEntity gg : pageList) {
-			List<PredicateModel> filterList2 = new ArrayList<PredicateModel>();
-			addNotEmptyModel(filterList2, "entityType.id",
-					Constants.FJSSLX_T_YJPT_GG, Operator.EQ);
-			addNotEmptyModel(filterList2, "recordStatus",
-					BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
-			addNotEmptyModel(filterList2, "entityId", gg.getId(),
-					PredicateModel.Operator.EQ);
-			Specification<AccessoryEntity> accSpec = SpecificationCreater
-					.searchByPredicateModels(filterList2);
-			List<AccessoryEntity> acc = accessoryService.findAll(accSpec);
-			if (acc != null && acc.size() > 0) {
-				gg.setAccessory(acc.get(0));
+    public List<GgEntity> getGgPageListByParams(final String lkr,final String title,int n, int pageCount){
+    	final UserEntity user = Utils.getWebServiceUser(); 
+    	SinglePageRequest page = new SinglePageRequest(pageCount, n, "desc", "id");
+    	if (user.getSfjyr().equals(Constants.YES) && !user.getSfcd().equals(Constants.YES)) {
+			//是经营人&&非船代
+			
+			// ----------------------------------specification经营人只能看经营人可见的公告----------------------------------
+			Specification<GgEntity> spec = new Specification<GgEntity>() {
+				@Override
+				public Predicate toPredicate(Root<GgEntity> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
+					List<Predicate> list = new ArrayList<Predicate>();
+					list.add(cb.equal(root.get("qykj").as(String.class), "Y"));
+					list.add(cb.notEqual(root.get("recordStatus").as(String.class),BaseEntity.RECORD_STATE_DELETE));
+					list.add(cb.like(root.get("lkr").as(String.class),"%" + lkr +"%"));
+					list.add(cb.like(root.get("title").as(String.class),"%" + title +"%"));
+					Subquery<GgViewEntity> subquery = query.subquery(GgViewEntity.class);
+					Root<GgViewEntity> ggviewRoot = subquery.from(GgViewEntity.class);
+					subquery.select(ggviewRoot);
+					List<Predicate> subQueryPredicates = new ArrayList<Predicate>();
+					subQueryPredicates.add(cb.equal(root.get("id").as(String.class),ggviewRoot.get("ggid").get("id").as(String.class)));
+					subQueryPredicates.add(cb.equal(ggviewRoot.get("sfkj").as(String.class), "Y"));
+					if (user.getJyrjcxx() != null) {
+						subQueryPredicates.add(cb.equal(ggviewRoot.get("qymc").get("id").as(String.class), user.getJyrjcxx().getId().toString()));
+					}
+					subQueryPredicates.add(cb.notEqual(ggviewRoot.get("recordStatus").as(String.class),BaseEntity.RECORD_STATE_DELETE));
+					subquery.where(subQueryPredicates.toArray(new Predicate[] {}));			
+					list.add(cb.or(new Predicate[] { cb.exists(subquery), cb.equal(root.get("byzd3").as(String.class), "Y") }));
+					return cb.and(list.toArray(new Predicate[] {}));
+				}
+			};
+			//-------------------------------------------------------------------------------------------------------------
+			
+			Page<GgEntity> pageList = service.findAll(spec, page);
+			if (pageList == null || pageList.getTotalPages() <= pageCount) {
+				return new ArrayList<GgEntity>();
 			}
-		}		
-		return pageList.getContent();
+			else{
+				return pageList.getContent();
+			}
+		}//end if 是经营人&&非船代
+		else {
+    	
+			List<PredicateModel> filterList = new ArrayList<PredicateModel>();
+			addNotEmptyModel(filterList, "recordStatus", BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);// 只检索非删除状态记录
+			addNotEmptyModel(filterList, "lkr", lkr, PredicateModel.Operator.LIKE);
+			addNotEmptyModel(filterList, "title", title, PredicateModel.Operator.LIKE);
+			Specification<GgEntity> spec = SpecificationCreater.searchByPredicateModels(filterList);
+			Page<GgEntity> pageList = service.findAll(spec, page);
+			if (pageList == null || pageList.getTotalPages() <= pageCount) {
+				return new ArrayList<GgEntity>();
+			}
+			for (GgEntity gg : pageList) {
+				List<PredicateModel> filterList2 = new ArrayList<PredicateModel>();
+				addNotEmptyModel(filterList2, "entityType.id",Constants.FJSSLX_T_YJPT_GG, Operator.EQ);
+				addNotEmptyModel(filterList2, "recordStatus",BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
+				addNotEmptyModel(filterList2, "entityId", gg.getId(),PredicateModel.Operator.EQ);
+				Specification<AccessoryEntity> accSpec = SpecificationCreater.searchByPredicateModels(filterList2);
+				List<AccessoryEntity> acc = accessoryService.findAll(accSpec);
+				if (acc != null && acc.size() > 0) {
+					gg.setAccessory(acc.get(0));
+				}
+			}		
+			return pageList.getContent();
+		}
     }
     
+ 
+    
     /**
      * 查询公告详细信息
      * @param id

+ 2 - 2
gkaq/yjpt-java/trunk/resources/spring/application.properties

@@ -21,7 +21,7 @@ hibernate.hbm2ddl.auto=
 
 
 # local WebService
-web.service.url=192.168.57.40
+web.service.url=localhost
 web.service.port=8087
 
 # Province WebService 
@@ -47,7 +47,7 @@ zysb.check=N
 #\u5bc6\u94a5
 my_yjpt_gkj=yjpt_gkj
 #\u5bc6\u7801\u6709\u6548\u671f\u9650
-password.yxq=20161001
+password.yxq=20161230
 
 #\u9644\u8bc1\u4e8c\u7ef4\u7801\u5730\u5740
 fz.qrcode=http://m.yuanxd.com:8091/weixinoa/mobile/fuzheng/wxhwzyfz.jsp?code=

+ 2 - 2
gkaq/yjpt-java/trunk/resources/sql/init/1.table.sql

@@ -4565,7 +4565,7 @@ create table T_YJPT_JYRJCXX
   gjjgdm        VARCHAR2(20),
   sfzdsp        CHAR(1) default 'N' not null,
   parent_jyr_id   NUMBER,
-  xzqh              NUMBER
+  xzqh              NUMBER,
   zdspsjq   TIMESTAMP(6),
   zdspsjz   TIMESTAMP(6)
 )
@@ -6546,7 +6546,7 @@ create table T_YJPT_WXHWGKZYSBD
   SL40T     NUMBER,
   TEU     NUMBER,
   BZ VARCHAR2(20),
-  JZXXH	VARHCAR2(500)
+  JZXXH	VARCHAR2(500)
 );
 comment on table T_YJPT_WXHWGKZYSBD
   is '危险货物港口作业申请';

+ 1 - 1
gkaq/yjpt-java/trunk/yjpt/WEB-INF/web.xml.ftl

@@ -7,7 +7,7 @@
 	<context-param>
 		<description>系统版本</description>
 		<param-name>version</param-name>
-		<param-value>4.1.7</param-value>
+		<param-value>4.1.8</param-value>
 	</context-param>	
 	<context-param>
 		<description>0:省级;1:市级</description>