|
@@ -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;
|
|
|
+ }
|
|
|
}
|