Browse Source

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

ld_liufl 9 years ago
parent
commit
6e216edbcb

+ 5 - 1
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/webService/common/task/TaskInfoWebService.java

@@ -159,12 +159,16 @@ public class TaskInfoWebService extends BaseController {
 		List<PredicateModel> filterList = new ArrayList<PredicateModel>();
 		addNotEmptyModel(filterList, "recordStatus",
 				BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
+		addNotEmptyModel(filterList, "txzt",Constants.YES, Operator.EQ);
+		if(Utils.getWebServiceUser() != null){
+			addNotEmptyModel(filterList, "jsUser.id",Utils.getWebServiceUser().getId(), Operator.EQ);
+		}	
 		Specification<Gztx> spec = SpecificationCreater
 				.searchByPredicateModels(filterList);
 		SinglePageRequest page = new SinglePageRequest(pageCount, n, "desc",
 				"id");
 		Page<Gztx> pageList = service.findAllGztx(spec, page);
-		if (pageList == null || pageList.getTotalPages() < pageCount) {
+		if (pageList == null || pageList.getTotalPages() <= pageCount) {
 			return new ArrayList<Gztx>();
 		}
 		return pageList.getContent();

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

@@ -146,7 +146,7 @@ public class GgWebService extends BaseController {
 		SinglePageRequest page = new SinglePageRequest(pageCount, n,
 				"desc", "id");
 		Page<GgEntity> pageList = service.findAll(spec, page);
-		if (pageList == null || pageList.getTotalPages() < pageCount) {
+		if (pageList == null || pageList.getTotalPages() <= pageCount) {
 			return new ArrayList<GgEntity>();
 		}
 		for (GgEntity gg : pageList) {

+ 3 - 3
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/webService/jyr/JyrxxglWebService.java

@@ -151,7 +151,7 @@ public class JyrxxglWebService extends BaseController {
 			SinglePageRequest page = new SinglePageRequest(pageCount, n,
 					"desc", "id");
 			Page<JyrEntity> pageList = service.findAll(spec, page);
-			if (pageList == null || pageList.getTotalPages() < pageCount) {
+			if (pageList == null || pageList.getTotalPages() <= pageCount) {
 				return new ArrayList<JyrEntity>();
 			}
 			for (JyrEntity jyrEntity : pageList) {
@@ -272,7 +272,7 @@ public class JyrxxglWebService extends BaseController {
 			SinglePageRequest page = new SinglePageRequest(pageCount, n,
 					"desc", "id");
 			Page<RyjbxxEntity> pageList = ryjbxxService.findAll(spec, page);
-			if (pageList == null || pageList.getTotalPages() < pageCount) {
+			if (pageList == null || pageList.getTotalPages() <= pageCount) {
 				return new ArrayList<RyjbxxEntity>();
 			}
 			for (RyjbxxEntity ryjbxxEntity : pageList) {
@@ -411,7 +411,7 @@ public class JyrxxglWebService extends BaseController {
 		SinglePageRequest page = new SinglePageRequest(pageCount, n,
 				"desc", "id");
 		Page<BwEntity> pageList = bwService.findAll(spec, page);
-		if (pageList == null || pageList.getTotalPages() < pageCount) {
+		if (pageList == null || pageList.getTotalPages() <= pageCount) {
 			return new ArrayList<BwEntity>();
 		}
 		return pageList.getContent();

+ 1 - 1
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/webService/yjgl/cg/CgxxglWebService.java

@@ -209,7 +209,7 @@ public class CgxxglWebService extends BaseController {
 		SinglePageRequest page = new SinglePageRequest(pageCount, n, "desc",
 				"id");
 		Page<CgEntity> list = cgService.findAll(spec, page);
-		if (list == null || list.getTotalPages() < pageCount) {
+		if (list == null || list.getTotalPages() <= pageCount) {
 			return new ArrayList<CgEntity>();
 		}
 		for (CgEntity vo : list) {

+ 228 - 5
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/webService/yjzyxxgl/YjzyxxglWebService.java

@@ -1,6 +1,7 @@
 package com.jtgh.yjpt.webService.yjzyxxgl;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 import javax.jws.HandlerChain;
@@ -11,17 +12,19 @@ import org.springframework.data.domain.Page;
 import org.springframework.data.jpa.domain.Specification;
 import org.springframework.stereotype.Service;
 
+import com.jtgh.yjpt.common.BusinessContext;
 import com.jtgh.yjpt.common.Constants;
 import com.jtgh.yjpt.common.PredicateModel;
-import com.jtgh.yjpt.common.Utils;
 import com.jtgh.yjpt.common.PredicateModel.Operator;
 import com.jtgh.yjpt.common.SinglePageRequest;
 import com.jtgh.yjpt.common.SpecificationCreater;
+import com.jtgh.yjpt.common.Utils;
 import com.jtgh.yjpt.controller.BaseController;
 import com.jtgh.yjpt.controller.yjzyxxgl.ZyyjjydwController;
 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.yjgl.YjyaEntity;
 import com.jtgh.yjpt.entity.yjzyxxgl.JzyjjydwryhzEntity;
 import com.jtgh.yjpt.entity.yjzyxxgl.YjwlEntity;
 import com.jtgh.yjpt.entity.yjzyxxgl.YjwzFlxxEntity;
@@ -30,6 +33,7 @@ import com.jtgh.yjpt.entity.yjzyxxgl.YjzjkEntity;
 import com.jtgh.yjpt.entity.yjzyxxgl.ZyyjjydwEntity;
 import com.jtgh.yjpt.entity.yjzyxxgl.ZyyjjydwryhzEntity;
 import com.jtgh.yjpt.service.common.AccessoryService;
+import com.jtgh.yjpt.service.yjgl.YjyaService;
 import com.jtgh.yjpt.service.yjzyxxgl.YjwlService;
 import com.jtgh.yjpt.service.yjzyxxgl.YjwzFlxxService;
 import com.jtgh.yjpt.service.yjzyxxgl.YjwzxxService;
@@ -61,6 +65,8 @@ public class YjzyxxglWebService extends BaseController {
 	private ZyyjjydwService zyjjydwService;
 	@Autowired
 	private ZyyjjydwController zyyjjydwController;
+	@Autowired
+	private YjyaService yjyaService;
 
 	/**
 	 * 获取应急专家库分页信息
@@ -98,13 +104,44 @@ public class YjzyxxglWebService extends BaseController {
 		SinglePageRequest page = new SinglePageRequest(pageCount, n, "desc",
 				"id");
 		Page<YjzjkEntity> list = yjzjkService.findAll(spec, page);
-		if (list == null || list.getTotalPages() < pageCount) {
+		if (list == null || list.getTotalPages() <= pageCount) {
 			return new ArrayList<YjzjkEntity>();
 		}
 		return list.getContent();
 	}
 
 	/**
+	 * 保存应急专家库
+	 * 
+	 * @param entity
+	 * @param fileId
+	 * @return
+	 */
+	public YjzjkEntity saveYjzjk(YjzjkEntity entity, Long fileId) {
+		if (null == entity.getId() || entity.getId().equals(0l)) {
+			entity.setAddDate(new Date());
+			entity.setAddUser(Utils.getWebServiceUser());
+			entity.setRecordCode("90");
+		} else {
+			YjzjkEntity vo = yjzjkService.queryYjzjk(entity.getId());
+			entity.setAddDate(vo.getAddDate());
+			entity.setAddUser(vo.getAddUser());
+			entity.setRecordCode(vo.getRecordCode());
+			entity.setRecordStatus(vo.getRecordStatus());
+			entity.setSftb(vo.getSftb());
+			entity.setTbzt(vo.getTbzt());
+			entity.setQylb(vo.getQylb());
+			entity.setTbdyid(vo.getTbdyid());
+			entity.setUpdateDate(new Date());
+			entity.setUpdateUser(Utils.getWebServiceUser());
+		}
+		if (fileId == null)
+			fileId = 0l;
+		entity = yjzjkService.saveEntity(entity, fileId);
+		return entity;
+	}
+
+	/**
 	 * 获取应急专家库信息(返回附件)
 	 * 
 	 * @param id
@@ -165,13 +202,47 @@ public class YjzyxxglWebService extends BaseController {
 		SinglePageRequest page = new SinglePageRequest(pageCount, n, "desc",
 				"id");
 		Page<YjwzxxEntity> list = yjwzxxService.findAll(spec, page);
-		if (list == null || list.getTotalPages() < pageCount) {
+		if (list == null || list.getTotalPages() <= pageCount) {
 			return new ArrayList<YjwzxxEntity>();
 		}
 		return list.getContent();
 	}
 
 	/**
+	 * 保存应急物资
+	 * 
+	 * @param entity
+	 * @param ssList
+	 * @param deleteSsList
+	 * @return
+	 * @throws CloneNotSupportedException
+	 */
+	public YjwzxxEntity saveYjwz(YjwzxxEntity entity,
+			List<YjwzFlxxEntity> ssList, List<YjwzFlxxEntity> deleteSsList)
+			throws CloneNotSupportedException {
+		if (null == entity.getId() || entity.getId().equals(0l)) {
+			entity.setAddDate(new Date());
+			entity.setAddUser(Utils.getWebServiceUser());
+			entity.setRecordCode("90");
+		} else {
+			YjwzxxEntity vo = yjwzxxService.findOne(entity.getId());
+			entity.setAddDate(vo.getAddDate());
+			entity.setAddUser(vo.getAddUser());
+			entity.setRecordCode(vo.getRecordCode());
+			entity.setRecordStatus(vo.getRecordStatus());
+			entity.setSftb(vo.getSftb());
+			entity.setTbzt(vo.getTbzt());
+			entity.setQylb(vo.getQylb());
+			entity.setTbdyid(vo.getTbdyid());
+			entity.setUpdateDate(new Date());
+			entity.setUpdateUser(Utils.getWebServiceUser());
+		}
+		entity = yjwzxxService.saveEntity(entity, ssList, deleteSsList);
+		return entity;
+
+	}
+
+	/**
 	 * 获取应急物资详细信息
 	 * 
 	 * @param id
@@ -258,12 +329,39 @@ public class YjzyxxglWebService extends BaseController {
 		SinglePageRequest page = new SinglePageRequest(pageCount, n, "desc",
 				"id");
 		Page<ZyyjjydwEntity> list = zyjjydwService.findAll(spec, page);
-		if (list == null || list.getTotalPages() < pageCount) {
+		if (list == null || list.getTotalPages() <= pageCount) {
 			return new ArrayList<ZyyjjydwEntity>();
 		}
 		return list.getContent();
 	}
 
+	public BusinessContext saveYjdw(ZyyjjydwEntity entity,
+			List<ZyyjjydwryhzEntity> zyList, List<JzyjjydwryhzEntity> jzList,
+			List<ZyyjjydwryhzEntity> zyDelete, List<JzyjjydwryhzEntity> jzDelete)
+			throws CloneNotSupportedException {
+		// 验证该企业是否已经添加了应急队伍救援信息
+		if (null == entity.getId() || entity.getId().equals(0l)) {
+			entity.setAddDate(new Date());
+			entity.setAddUser(Utils.getWebServiceUser());
+			entity.setRecordCode("90");
+		} else {
+			ZyyjjydwEntity vo = zyjjydwService.findOne(entity.getId());
+			entity.setAddDate(vo.getAddDate());
+			entity.setAddUser(vo.getAddUser());
+			entity.setRecordCode(vo.getRecordCode());
+			entity.setRecordStatus(vo.getRecordStatus());
+			entity.setSftb(vo.getSftb());
+			entity.setTbzt(vo.getTbzt());
+			entity.setQylb(vo.getQylb());
+			entity.setTbdyid(vo.getTbdyid());
+			entity.setUpdateDate(new Date());
+			entity.setUpdateUser(Utils.getWebServiceUser());
+		}
+		entity = zyjjydwService.saveEntity(entity, zyList, jzList, zyDelete,
+				jzDelete);
+		return createBusinessContext(entity);
+	}
+
 	/**
 	 * 获取应急队伍详细信息
 	 * 
@@ -322,7 +420,7 @@ public class YjzyxxglWebService extends BaseController {
 				"id");
 		try {
 			Page<YjwlEntity> list = yjwlService.findAll(spec, page);
-			if (list == null || list.getTotalPages() < pageCount) {
+			if (list == null || list.getTotalPages() <= pageCount) {
 				return new ArrayList<YjwlEntity>();
 			}
 			return list.getContent();
@@ -333,6 +431,35 @@ public class YjzyxxglWebService extends BaseController {
 	}
 
 	/**
+	 * 保存应急网络
+	 * 
+	 * @param vo
+	 * @return
+	 */
+	public YjwlEntity saveYjwl(YjwlEntity vo) {
+		// 待保存的角色对象
+		YjwlEntity entity = null;
+		if (vo.getId() == null || vo.getId() == 0) { // 新增模式
+			entity = new YjwlEntity();
+			entity.setRecordCode("90");
+			entity.setAddDate(new Date());
+			entity.setAddUser(Utils.getCurrentUser());
+		} else {
+			// 从数据库中取出角色,防止字表关联丢失
+			entity = yjwlService.findOne(vo.getId());
+		}
+		entity.setName(vo.getName());
+		entity.setType(vo.getType());
+		entity.setAddress(vo.getAddress());
+		entity.setTel(vo.getTel());
+		entity.setRemark(vo.getRemark());
+		entity.setSzd(vo.getSzd());
+		entity.setGq(vo.getGq());
+		entity = yjwlService.save(entity);
+		return entity;
+	}
+
+	/**
 	 * 获取应急网络详细信息
 	 * 
 	 * @param id
@@ -342,4 +469,100 @@ public class YjzyxxglWebService extends BaseController {
 		return yjwlService.findOne(id);
 	}
 
+	/**
+	 * 获取应急预案分页信息
+	 * 
+	 * @param szd
+	 * @param szgq
+	 * @param yajb
+	 * @param qymc
+	 * @param xdsjq
+	 * @param xdsjz
+	 * @param yamc
+	 * @param gkdw
+	 * @param lb
+	 * @param n
+	 * @param pageCount
+	 * @return
+	 */
+	public List<YjyaEntity> getYjyaPageListByParams(Long szd, Long szgq,
+			Long yajb, Long qymc, Date xdsjq, Date xdsjz, String yamc,
+			String gkdw, String lb, int n, int pageCount) {
+		List<PredicateModel> filterList = new ArrayList<PredicateModel>();
+		addNotEmptyModel(filterList, "yajb", yajb, PredicateModel.Operator.EQ);
+		addNotEmptyModel(filterList, "szd.id", szd + "%", Operator.LIKE_R);
+		addNotEmptyModel(filterList, "byzd1", lb, PredicateModel.Operator.EQ);
+		addNotEmptyModel(filterList, "gq", szgq, PredicateModel.Operator.EQ);
+		addNotEmptyModel(filterList, "qymc", qymc, PredicateModel.Operator.EQ);
+		addNotEmptyModel(filterList, "xdsj", Utils.getDateFirstTime(xdsjq),
+				PredicateModel.Operator.GTE);
+		addNotEmptyModel(filterList, "xdsj", Utils.getDateLastTime(xdsjz),
+				PredicateModel.Operator.LTE);
+		addNotEmptyModel(filterList, "yamc", yamc, PredicateModel.Operator.LIKE);
+		addNotEmptyModel(filterList, "gkdw", gkdw, PredicateModel.Operator.LIKE);
+		// 只检索非删除状态记录
+		addNotEmptyModel(filterList, "recordStatus",
+				BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
+		// 权限过滤
+		if (Utils.getWebServiceUser() != null) {
+			UserEntity user = Utils.getWebServiceUser();
+			// 经营人只能查自己的
+			if (Constants.YES.equals(user.getSfjyr())
+					&& user.getJyrjcxx() != null) {
+				addNotEmptyModel(filterList, "qymc", user.getJyrjcxx(),
+						Operator.EQ);
+			} else {
+				// 行政人员根据权限过滤(应急预案列表菜单ID=20)
+				addRecordCodeFilter(20l, filterList);
+			}
+		}
+		Specification<YjyaEntity> spec = SpecificationCreater
+				.searchByPredicateModels(filterList);
+		SinglePageRequest page = new SinglePageRequest(pageCount, n, "desc",
+				"id");
+		Page<YjyaEntity> pageList = yjyaService.findAll(spec, page);
+		if (pageList == null || pageList.getTotalPages() <= pageCount) {
+			return new ArrayList<YjyaEntity>();
+		}
+
+		for (YjyaEntity entity : pageList) {
+			// 检索附件
+			filterList = new ArrayList<PredicateModel>();
+			addNotEmptyModel(filterList, "entityType.id",
+					Constants.ACCESSORY_ENTITY_TYPE_YJYA, Operator.EQ);
+			addNotEmptyModel(filterList, "recordStatus",
+					BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
+			addNotEmptyModel(filterList, "entityId", entity.getId(),
+					PredicateModel.Operator.EQ);
+			Specification<AccessoryEntity> accSpec = SpecificationCreater
+					.searchByPredicateModels(filterList);
+			List<AccessoryEntity> acc = accessoryService.findAll(accSpec);
+			if (acc != null && acc.size() > 0)
+				entity.setAccessory(acc.get(0));
+		}
+		return pageList.getContent();
+	}
+
+	/**
+	 * 根据id查找应急预案
+	 * 
+	 * @param id
+	 * @return
+	 */
+	public YjyaEntity findYjyaById(Long id) {
+		YjyaEntity entity = yjyaService.findOne(id);
+		List<PredicateModel> filterList = new ArrayList<PredicateModel>();
+		addNotEmptyModel(filterList, "entityType.id",
+				Constants.ACCESSORY_ENTITY_TYPE_YJYA, Operator.EQ);
+		addNotEmptyModel(filterList, "recordStatus",
+				BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
+		addNotEmptyModel(filterList, "entityId", entity.getId(),
+				PredicateModel.Operator.EQ);
+		Specification<AccessoryEntity> accSpec = SpecificationCreater
+				.searchByPredicateModels(filterList);
+		List<AccessoryEntity> acc = accessoryService.findAll(accSpec);
+		if (acc != null && acc.size() > 0)
+			entity.setAccessory(acc.get(0));
+		return entity;
+	}
 }

+ 1 - 1
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/webService/zcdc/zc/ZczbWebService.java

@@ -428,7 +428,7 @@ public class ZczbWebService extends BaseController {
 		SinglePageRequest page = new SinglePageRequest(pageCount, n, "desc",
 				"id");
 		Page<ZcEntity> pageList = zcService.findAll(spec, page);
-		if (pageList == null || pageList.getTotalPages() < pageCount) {
+		if (pageList == null || pageList.getTotalPages() <= pageCount) {
 			return new ArrayList<ZcEntity>();
 		}
 		for (ZcEntity zc : pageList) {