Bläddra i källkod

微信调用webService

git-svn-id: https://192.168.57.71/svn/jsgkj@32 931142cf-59ea-a443-aa0e-51397b428577
ld_liufl 9 år sedan
förälder
incheckning
06bee64f8c

+ 7 - 0
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/webService/common/accessory/AccessoryWebService.java

@@ -49,6 +49,13 @@ public class AccessoryWebService {
 		return accessoryService.findOne(id);
 	}
 
+	/**
+	 * 获取附件
+	 * @param entityId 所属对象id
+	 * @param sslx  所属对象类型
+	 * @param lx 附件类型
+	 * @return
+	 */
 	public List<AccessoryEntity> findByEntityIdAndEntityTypeAndType(
 			long entityId, long sslx, long lx) {
 		List<AccessoryEntity> list = accessoryService

+ 141 - 6
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/webService/zyfzbl/ZyfzblWebService.java

@@ -1,14 +1,23 @@
 package com.jtgh.yjpt.webService.zyfzbl;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import javax.jws.HandlerChain;
 import javax.jws.WebService;
 
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.jpa.domain.Specification;
 import org.springframework.stereotype.Service;
 
+import com.jtgh.yjpt.common.Constants;
+import com.jtgh.yjpt.common.PredicateModel;
+import com.jtgh.yjpt.common.SinglePageRequest;
+import com.jtgh.yjpt.common.SpecificationCreater;
 import com.jtgh.yjpt.common.Utils;
+import com.jtgh.yjpt.common.PredicateModel.Operator;
+import com.jtgh.yjpt.controller.BaseController;
 import com.jtgh.yjpt.dao.jlrxxgl.GlzdxxDao;
 import com.jtgh.yjpt.dao.jyrxxgl.RyjbxxDao;
 import com.jtgh.yjpt.dao.yjgl.YjyaDao;
@@ -18,6 +27,8 @@ import com.jtgh.yjpt.dao.zyfzndjy.GkwxhwzyfzDao;
 import com.jtgh.yjpt.dao.zyfzndjy.Gkwxhwzyfzbl_fzbDao;
 import com.jtgh.yjpt.dao.zyfzndjy.GkwxhwzyfzblhhzbDao;
 import com.jtgh.yjpt.dao.zyfzndjy.GkwxhwzyfzblhhzbzbDao;
+import com.jtgh.yjpt.entity.BaseEntity;
+import com.jtgh.yjpt.entity.auth.UserEntity;
 import com.jtgh.yjpt.entity.jlrxxgl.GlzdxxEntity;
 import com.jtgh.yjpt.entity.jyrxxgl.RyjbxxEntity;
 import com.jtgh.yjpt.entity.yjgl.YjyaEntity;
@@ -36,7 +47,7 @@ import com.jtgh.yjpt.service.zyfzndjy.GkwxhwzyfzblhhzService;
 @Service
 @WebService(targetNamespace = "http://webService.yjpt.com/", serviceName = "zyfzblService")
 @HandlerChain(file = "handle-chain.xml")
-public class ZyfzblWebService {
+public class ZyfzblWebService extends BaseController {
 	@Autowired
 	private GkwxhwzyfzblhhzbDao gkwxhwzyfzblhhzDao;
 	@Autowired
@@ -108,11 +119,6 @@ public class ZyfzblWebService {
 			List<GkwxhwzyfzblFzEntity> saveList) {
 		List<GkwxhwzyfzblFzEntity> list = dao.findByFzsq(vo);
 		vo = gkwxhwzyfzblhhzService.saveAllFz(vo, saveList, list);
-		// vo = gkwxhwzyfzblhhzDao.save(vo);
-		// for (int i = 0; i < saveList.size(); i++) {
-		// GkwxhwzyfzblFzEntity zd = saveList.get(i);
-		// dao.save(zd);
-		// }
 		return vo;
 	}
 
@@ -122,4 +128,133 @@ public class ZyfzblWebService {
 				name);
 		return list;
 	}
+	
+	/**
+	 * 初始化分页查询
+	 * 
+	 * @param count
+	 * @param pageCount
+	 * @return
+	 */
+	public List<GkwxhwzyfzblhhzEntity> findPageList(int count, int pageCount) {
+		try {
+			UserEntity user = Utils.getWebServiceUser();
+			// 经营人
+			if (user != null && user.getSfjyr().equals("Y")
+					&& user.getJyrjcxx() != null) {
+				List<PredicateModel> filterList = new ArrayList<PredicateModel>();
+				// 根据 申请单位 过滤
+				addNotEmptyModel(filterList, "zydw", user.getJyrjcxx(),
+						Operator.EQ);
+				// 只检索非删除状态记录
+				addNotEmptyModel(filterList, "recordStatus",
+						BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
+				Specification<GkwxhwzyfzblhhzEntity> spec = SpecificationCreater
+						.searchByPredicateModels(filterList);
+				SinglePageRequest page = new SinglePageRequest(pageCount,
+						count, "desc", "id");
+				Page<GkwxhwzyfzblhhzEntity> list = gkwxhwzyfzblhhzService
+						.findAll(spec, page);
+				return list.getContent();
+			}
+			String szd = "";
+			if (user.getSzd() == null)
+				szd = "";
+			else
+				szd = user.getSzd().getByzd2();
+			// 行政人员
+			if (user != null && user.getSfjyr().equals("N")
+					&& user.getSfcd().equals("N")) {
+				List<PredicateModel> filterList = new ArrayList<PredicateModel>();
+				// 过滤掉已删除的附证
+				addNotEmptyModel(filterList, "recordStatus",
+						BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
+				// 根据所在地过滤
+				addNotEmptyModel(filterList, "szd.id", szd, Operator.LIKE);
+				Specification<GkwxhwzyfzblhhzEntity> spec = SpecificationCreater
+						.searchByPredicateModels(filterList);
+				SinglePageRequest page = new SinglePageRequest(pageCount,
+						count, "desc", "id");
+				Page<GkwxhwzyfzblhhzEntity> list = gkwxhwzyfzblhhzService
+						.findAll(spec, page);
+				return list.getContent();
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+	/**
+	 * 根据条件分页查询
+	 * @param szd
+	 * @param ssgq
+	 * @param gkjyr
+	 * @param whdj
+	 * @param fddbr
+	 * @param count
+	 * @param pageCount
+	 * @return
+	 */
+	public List<GkwxhwzyfzblhhzEntity> findPageListByParmas(String szd,
+			String ssgq, String gkjyr, String whdj, String fddbr, int count,
+			int pageCount) {
+		try {
+			List<PredicateModel> filterList = new ArrayList<PredicateModel>();
+			// 只检索非删除状态记录
+			addNotEmptyModel(filterList, "recordStatus",
+					BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
+			// 根据所在地过滤
+			if (szd != null)
+				addNotEmptyModel(filterList, "szd.id", szd, Operator.EQ);
+			// 根据港区过滤
+			if (ssgq != null && !ssgq.equals("")) {
+				addNotEmptyModel(filterList, "ssgq.id", ssgq, Operator.EQ);
+			}
+			// 根据港口经营人过滤
+			if (gkjyr != null && !gkjyr.equals("")) {
+				addNotEmptyModel(filterList, "jyrVo.gkjyr", gkjyr, Operator.LIKE);
+			}
+			// 根据危货等级过滤
+			if (whdj != null && !whdj.equals("")) {
+				addNotEmptyModel(filterList, "whdj.id", whdj, Operator.EQ);
+			}
+			// 根据法定代表人过滤
+			if (fddbr != null && !fddbr.equals("")) {
+				addNotEmptyModel(filterList, "fddbr", fddbr, Operator.LIKE);
+			}
+			if (Utils.getWebServiceUser() != null) {
+				UserEntity user = Utils.getWebServiceUser();
+				// 经营人只能查自己的
+				if (Constants.YES.equals(user.getSfjyr())
+						&& user.getJyrjcxx() != null) {
+					addNotEmptyModel(filterList, "zydw", user.getJyrjcxx(),
+							Operator.EQ);
+				} else {
+					// 行政人员根据权限过滤(附证列表菜单ID=29)
+					addRecordCodeFilter(29l, filterList);
+				}
+			}
+			Specification<GkwxhwzyfzblhhzEntity> spec = SpecificationCreater
+					.searchByPredicateModels(filterList);
+			SinglePageRequest page = new SinglePageRequest(pageCount, count,
+					"desc", "id");
+			Page<GkwxhwzyfzblhhzEntity> list = gkwxhwzyfzblhhzService.findAll(
+					spec, page);
+			return list.getContent();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+	
+	/**
+	 * 根据附证id查询附证信息
+	 * @param id
+	 * @return
+	 */
+	public List<GkwxhwzyfzblFzEntity> findByFzsq(Long id){
+		return gkwxhwzyfzblhhzService.findByFzsq(id);	
+	}
+		
 }

+ 101 - 6
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/webService/zysqbp/WhsqbpWebService.java

@@ -4,8 +4,12 @@ import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Calendar;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 import javax.jws.HandlerChain;
 import javax.jws.WebService;
@@ -28,12 +32,17 @@ import com.jtgh.yjpt.controller.BaseController;
 import com.jtgh.yjpt.controller.zysqbp.ZysqbpController;
 import com.jtgh.yjpt.entity.BaseEntity;
 import com.jtgh.yjpt.entity.auth.UserEntity;
+import com.jtgh.yjpt.entity.hs.CbEntity;
+import com.jtgh.yjpt.entity.hs.ZysqbphsdbEntity;
+import com.jtgh.yjpt.entity.jyr.BwEntity;
 import com.jtgh.yjpt.entity.jyr.JyrEntity;
 import com.jtgh.yjpt.entity.jyr.JyrNsEntity;
 import com.jtgh.yjpt.entity.jyr.WxhwpmEntity;
 import com.jtgh.yjpt.entity.zyfzndjy.GkwxhwzyfzblFzEntity;
 import com.jtgh.yjpt.entity.zysqbp.ZysqbpBgEntity;
 import com.jtgh.yjpt.entity.zysqbp.ZysqbpEntity;
+import com.jtgh.yjpt.service.hs.CbService;
+import com.jtgh.yjpt.service.hs.HsCompareService;
 import com.jtgh.yjpt.service.jyr.BwService;
 import com.jtgh.yjpt.service.jyr.CkService;
 import com.jtgh.yjpt.service.jyr.DcService;
@@ -79,8 +88,11 @@ public class WhsqbpWebService extends BaseController {
 	@Autowired
 	private DcService dcService;
 	@Autowired
-	private CkService ckService;
-
+	private CkService ckService;	
+	@Autowired
+	private CbService cbService;
+	@Autowired
+	private HsCompareService compareService;
 	// @Autowired
 	// private WorkflowMangerService workService;
 	// @Autowired
@@ -186,7 +198,7 @@ public class WhsqbpWebService extends BaseController {
 		addNotEmptyModel(filterList, "szd.id", szd, Operator.LIKE);
 		// 根据港区过滤
 		addNotEmptyModel(filterList, "szgq.id", szgq, Operator.EQ);
-		// 根据危货品编号
+		// 根据船名
 		addNotEmptyModel(filterList, "cm", cm, Operator.LIKE);
 		// 根据危货品编号
 		addNotEmptyModel(filterList, "wxwpmc", wxhwbh, Operator.LIKE);
@@ -498,6 +510,7 @@ public class WhsqbpWebService extends BaseController {
 
 	public ZysqbpEntity qxAudit(String shyj, boolean auditflag,
 			ZysqbpEntity entity) throws CloneNotSupportedException {
+		entity = zysqbpService.findOne(entity.getId());
 		zysqbpController.qxAduit(shyj, new Date(), auditflag, entity);
 		entity = zysqbpService.findOne(entity.getId());
 		return entity;
@@ -506,6 +519,8 @@ public class WhsqbpWebService extends BaseController {
 	public ZysqbpBgEntity bgAudit(String shyj, boolean auditflag,
 			ZysqbpEntity entity, ZysqbpBgEntity bgVo)
 			throws CloneNotSupportedException {
+		entity = zysqbpService.findOne(entity.getId());
+		bgVo = zysqbgService.findBgzyByZysqbp(entity);
 		zysqbpController.bgAduit(shyj, new Date(), auditflag, entity, bgVo);
 		bgVo = zysqbgService.findBgzyByZysqbp(entity);
 		return bgVo;
@@ -513,6 +528,7 @@ public class WhsqbpWebService extends BaseController {
 
 	public ZysqbpEntity aduit(String shyj, String shsj, boolean auditflag,
 			ZysqbpEntity entity) throws CloneNotSupportedException {
+		entity =zysqbpService.findOne(entity.getId());
 		// 确保entity有重新查一下
 		zysqbpController.aduit(shyj, new Date(), auditflag, entity);
 		entity = zysqbpService.findOne(entity.getId());
@@ -625,8 +641,11 @@ public class WhsqbpWebService extends BaseController {
 	 * 取消作业
 	 * 
 	 */
-	public ZysqbpEntity doQxzy(ZysqbpEntity entity) {
+	public ZysqbpEntity doQxzy(ZysqbpEntity vo) {
+		ZysqbpEntity entity =  zysqbpService.findOne(vo.getId());
 		try {
+			//存取取消原因
+			entity.setByzd1(vo.getByzd1());
 			zysqqxService.submitQxWebService(entity);
 			entity.setRecordStatus(BaseEntity.RECORD_STATE_QXSUBMIT);// 提交过后,状态改为取消审核中
 			entity.setUpdateDate(new Date());
@@ -711,10 +730,10 @@ public class WhsqbpWebService extends BaseController {
 	}
 
 	/**
-	 * 判断当前用户是否有审批权限 之判断 提交(不判断取消变更)
+	 * 判断当前用户是否有审批权限 之判断 
 	 * 
 	 * @param id
-	 * @return
+	 * @return 0 表示未签收,代办理,1表示已签收待办理 ,""表示 无流程
 	 */
 	public String getTaskStateByid(Long id) {
 		ZysqbpEntity ba = zysqbpService.findOne(id);
@@ -748,5 +767,81 @@ public class WhsqbpWebService extends BaseController {
 		}
 		return "";
 	}
+	
+	/**
+	 * 获取泊位信息
+	 * @param zycs 作业场所类型
+	 * @param id 场所id
+	 * @return
+	 */
+	public BwEntity findByZycsAndId(String zycs,Long id) {
+		//只查询泊位的信息
+		if(Constants.GGDM_ID_ZYDD_BW.equals(Long.parseLong(zycs))) {
+			return bwService.findOne(id);
+		}
+		return null;
+	}
 
+	
+	/**
+	 * 根据中文 船名和英文船名分页获取船舶信息
+	 * @param zwcm
+	 * @param ywcm
+	 * @param n
+	 * @param pageCount
+	 * @return
+	 */
+	public List<CbEntity> getCbPageListByCm(String zwcm,String ywcm,int n ,int pageCount){
+		List<PredicateModel> filterList = new ArrayList<PredicateModel>();
+		addNotEmptyModel(filterList, "zwcm", zwcm, PredicateModel.Operator.LIKE);
+		addNotEmptyModel(filterList, "ywcm", ywcm, PredicateModel.Operator.LIKE);
+		Specification<CbEntity> spec = SpecificationCreater
+				.searchByPredicateModels(filterList);
+		SinglePageRequest page = new SinglePageRequest(pageCount, n,
+				"asc", "cbbh");
+		Page<CbEntity> list =cbService.findAll(spec,
+				page);	
+		return list.getContent();
+	}
+	
+	/**
+	 * 查询对比结果详细
+	 * 
+	 * @param id 作业申报id
+	 * @return
+	 */
+	public List<ZysqbphsdbEntity>  queryDb(Long id) {
+		List<ZysqbphsdbEntity> list = new ArrayList<ZysqbphsdbEntity>();
+		Map<String, Map<String, String>> map = compareService.mergeInfo(id);
+		if (map == null) {
+			return list;
+		}
+		Set<String> set = map.keySet();
+		if (set != null && set.size() > 0) {
+			for (String str : set) {
+				ZysqbphsdbEntity temp = new ZysqbphsdbEntity();
+				temp.setName(str);
+				temp.setGkj(map.get(str).get("GK"));
+				temp.setHs(map.get(str).get("HS"));
+				temp.setZt(map.get(str).get("ZT"));
+				String xh = map.get(str).get("XH");
+				if (org.springframework.util.StringUtils.hasText(xh)) {
+					temp.setXh(new Integer(xh));
+				} else {
+					temp.setXh(Integer.MAX_VALUE);
+				}
+				list.add(temp);
+			}
+			Collections.sort(list, new Comparator<ZysqbphsdbEntity>() {
+
+				@Override
+				public int compare(ZysqbphsdbEntity o1, ZysqbphsdbEntity o2) {
+					return o1.getXh().compareTo(o2.getXh());
+				}
+			});
+		}
+		return list;
+	}
+	
+	
 }