Browse Source

接口

git-svn-id: https://192.168.57.71/svn/lyggkj@83 1a6f6e3a-4066-fe46-b609-79c204482ece
ld_liufl 9 years ago
parent
commit
853b9784af

+ 18 - 0
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/webService/common/CodeWebService.java

@@ -48,4 +48,22 @@ public class CodeWebService {
 		}
 		return null;
 	}
+
+	/**
+	 * 根据组编码获取公共代码
+	 * @param groupcode
+	 * @return
+	 */
+	public List<CodeEntity> findByGroupcode(String groupcode) {
+		return InitServlet.groupcodeMap.get(groupcode);
+	}
+	
+	/**
+	 * 根据父编码获取公共代码
+	 * @param code
+	 * @return
+	 */
+	public List<CodeEntity> findByParentCode(String code) {
+		return InitServlet.parentMap.get(Long.parseLong(code));
+	}
 }

+ 94 - 2
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/webService/common/task/TaskInfoWebService.java

@@ -1,16 +1,34 @@
 package com.jtgh.yjpt.webService.common.task;
 
 
+import java.util.ArrayList;
+import java.util.Date;
 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.PredicateModel.Operator;
+import com.jtgh.yjpt.common.SinglePageRequest;
+import com.jtgh.yjpt.common.SpecificationCreater;
+import com.jtgh.yjpt.common.Utils;
+import com.jtgh.yjpt.common.WorkItem;
+import com.jtgh.yjpt.controller.BaseController;
+import com.jtgh.yjpt.entity.BaseEntity;
+import com.jtgh.yjpt.entity.auth.RoleEntity;
+import com.jtgh.yjpt.entity.auth.UserEntity;
 import com.jtgh.yjpt.entity.common.TaskInfoEntity;
+import com.jtgh.yjpt.entity.task.Gztx;
 import com.jtgh.yjpt.service.common.TaskInfoService;
+import com.jtgh.yjpt.service.common.WorkflowMangerService;
+import com.jtgh.yjpt.service.task.TaskService;
 /**
  * 任务保存接口
  * 
@@ -20,11 +38,15 @@ import com.jtgh.yjpt.service.common.TaskInfoService;
 @Service
 @WebService(targetNamespace = "http://webService.yjpt.com/", serviceName = "taskInfoService")
 @HandlerChain(file="handle-chain.xml")
-public class TaskInfoWebService {
+public class TaskInfoWebService extends BaseController {
 	@Autowired
 	private TaskInfoService infoService;
+	@Autowired
+	private WorkflowMangerService workflowMangerService;
+	@Autowired
+	private TaskService service;
 	/***
-	 * 保存附件
+	 * 保存
 	 */
 	public TaskInfoEntity save(TaskInfoEntity entity){
 	  return infoService.save(entity);
@@ -34,6 +56,76 @@ public class TaskInfoWebService {
 		return infoService.findByBusIdAndBusKeyOrderByIdAsc(id.toString(), busKey);
 	}
 	
+	/**
+	 * 获取待办任务
+	 * @param busKey
+	 * @param begin
+	 * @param end
+	 * @param n
+	 * @param pageCount
+	 * @return
+	 */
+	@SuppressWarnings("unchecked")
+	public List<WorkItem>  getTodoList(
+			String busKey, Date begin, Date end,int n, int pageCount) {
+		if (busKey != null && busKey.trim().equals("")) {
+			busKey = null;
+		}
+		SinglePageRequest page = new SinglePageRequest(pageCount, n,
+				"desc", "id");
+		List<WorkItem> list= (List<WorkItem>) workflowMangerService.todoList(page,
+				String.valueOf(Utils.getWebServiceUser().getId()), busKey,
+				Utils.getDateFirstTime(begin), Utils.getDateLastTime(end)).getAttribute("todo");
+		return list;
+	}
+	
+	/**
+	 * 查询工作提醒数量
+	 * 
+	 * @return
+	 */
+	public String findGztxs() {
+		UserEntity userEntity = Utils.getWebServiceUser();
+		List<RoleEntity> yhssjss = userEntity.getRoles();
+		List<Long> roleIds = new ArrayList<Long>();
+		for (RoleEntity yhssjs : yhssjss) {
+			roleIds.add(yhssjs.getId());
+		}
+		// 工作提醒列表
+		List<Gztx> gztxs = service.findTxByUser(userEntity.getId());
+		return  gztxs==null?"":gztxs.size()+"";
+	}
+	
+	/**
+	 * 消息关闭
+	 * 
+	 * @return
+	 */
+	public Gztx doXxClose(Gztx gztx) {
+		gztx = service.findOne(gztx.getId());
+		gztx.setTxzt(Constants.NO);
+		service.saveGztx(gztx);
+		return gztx;
+	}
+
+	/**
+	 * 列表查询
+	 * 
+	 * @return
+	 */
+	public List<Gztx> getGztxPageList(int n,int pageCount) {
+		List<PredicateModel> filterList = new ArrayList<PredicateModel>();
+		addNotEmptyModel(filterList,"recordStatus",BaseEntity.RECORD_STATE_DELETE,Operator.NEQ);
+		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) {
+			return new ArrayList<Gztx>();
+		}
+		return pageList.getContent();
+	}
 	
 }
 

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

@@ -1,15 +1,35 @@
 package com.jtgh.yjpt.webService.gg;
 
+import java.util.ArrayList;
+import java.util.Date;
+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.GlobalData;
+import com.jtgh.yjpt.common.PredicateModel;
+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.entity.BaseEntity;
+import com.jtgh.yjpt.entity.common.AccessoryEntity;
 import com.jtgh.yjpt.entity.gg.GgEntity;
+import com.jtgh.yjpt.entity.gg.GgViewEntity;
+import com.jtgh.yjpt.entity.jyr.JyrEntity;
 import com.jtgh.yjpt.service.common.AccessoryService;
+import com.jtgh.yjpt.service.common.CodeService;
 import com.jtgh.yjpt.service.gg.GgService;
+import com.jtgh.yjpt.service.gg.GgViewService;
+import com.jtgh.yjpt.service.jyr.JyrService;
 /**
  * 港口信息接口
  * 
@@ -19,13 +39,19 @@ import com.jtgh.yjpt.service.gg.GgService;
 @Service
 @WebService(targetNamespace = "http://webService.yjpt.com/", serviceName = "ggService")
 @HandlerChain(file = "handle-chain.xml")
-public class GgWebService {
+public class GgWebService extends BaseController {
 
     @Autowired
     private GgService service;
-
+    @Autowired
+    private GgViewService ggViewService;
     @Autowired
     private AccessoryService accessoryService;
+    @Autowired
+    private JyrService jyrService;
+    @Autowired
+    private CodeService codeService;
+    
 
     public void save(GgEntity entity) {
 	entity.setSzd(entity.getSzd());
@@ -34,6 +60,129 @@ public class GgWebService {
 	service.save(entity);
 	if (null != entity.getAccessory()) {
 	    accessoryService.save(entity.getAccessory());
-	}
+	    }
+    }
+    
+    /**
+     * 公告保存
+     * @param entity
+     * @param jyrList
+     * @param jyrDelList
+     * @return
+     */
+    public GgEntity saveEntity(GgEntity entity,
+    		List<JyrEntity> jyrList, List<JyrEntity> jyrDelList){
+    	if (null == entity.getId()) {
+			if (!GlobalData.CITY_CODE.equals("")
+					&& GlobalData.DEPLOY_MODE
+							.equals(Constants.DEPLOY_MODE_CITY)) {
+				entity.setSzd(codeService.findOne(Long
+						.parseLong(GlobalData.CITY_CODE)));
+			}
+			entity.setRecordCode("100100100100");
+			entity.setAddUser(Utils.getCurrentUser());
+			entity.setAddDate(new Date());
+		} else {
+			// 修改
+			GgEntity vo = service.findById(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 = service.save(entity);
+		if (jyrDelList != null) {
+			for (JyrEntity delEntity : jyrDelList) {
+				ggViewService.logicDelete(ggViewService.findKjByGgidAndQymc(
+						entity, delEntity));
+			}
+		}
+		if (jyrList != null) {
+			for (JyrEntity jyrEntity : jyrList) {
+				List<GgViewEntity> ggViewEntities = ggViewService.findKjByGgidAndQymc(
+						entity, jyrEntity);
+				GgViewEntity ggViewEntity = new GgViewEntity();				
+				if(ggViewEntities!=null && ggViewEntities.size()>0) {
+					ggViewEntity= ggViewEntities.get(0);
+					ggViewEntity.setUpdateDate(new Date());
+					ggViewEntity.setUpdateUser(Utils.getCurrentUser());
+				}else{
+					ggViewEntity.setAddUser(Utils.getCurrentUser());
+					ggViewEntity.setAddDate(new Date());
+					ggViewEntity.setGgid(entity);
+					ggViewEntity.setQymc(jyrEntity);
+					ggViewEntity.setSfkj("Y");	
+				}						
+				ggViewService.save(ggViewEntity);
+			}
+		}
+		return entity;
+    }
+    
+    /**
+     * 分页查询公告信息
+     * @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(filterList, "entityType.id",
+					Constants.FJSSLX_T_YJPT_GG, Operator.EQ);
+			addNotEmptyModel(filterList, "recordStatus",
+					BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
+			addNotEmptyModel(filterList, "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
+     * @return
+     */
+    public GgEntity findById(Long id){
+    	GgEntity entity = service.findById(id);
+    	return entity;
+    }
+    
+    /**
+     * 根据公告查询可见的经营人列表
+     * @param entity
+     * @return
+     */
+    public List<JyrEntity> findJyrByGg(GgEntity entity){
+    	return jyrService.findByGg(entity.getId());
     }
 }

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

@@ -1,6 +1,7 @@
 package com.jtgh.yjpt.webService.jyr;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 import javax.jws.HandlerChain;
@@ -11,9 +12,9 @@ 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.PredicateModel.Operator;
-import com.jtgh.yjpt.common.Constants;
 import com.jtgh.yjpt.common.SinglePageRequest;
 import com.jtgh.yjpt.common.SpecificationCreater;
 import com.jtgh.yjpt.common.Utils;
@@ -26,6 +27,7 @@ import com.jtgh.yjpt.entity.jyrxxgl.JyrckxxEntity;
 import com.jtgh.yjpt.entity.jyrxxgl.JyrdcxxEntity;
 import com.jtgh.yjpt.entity.jyrxxgl.RyjbxxEntity;
 import com.jtgh.yjpt.entity.jyrxxgl.RyjbxxZSEntity;
+import com.jtgh.yjpt.service.common.AccessoryService;
 import com.jtgh.yjpt.service.jyr.BwService;
 import com.jtgh.yjpt.service.jyr.JyrService;
 import com.jtgh.yjpt.service.jyrxxgl.RyjbxxService;
@@ -48,6 +50,8 @@ public class JyrxxglWebService extends BaseController {
 	private RyjbxxService ryjbxxService;
 	@Autowired
 	private BwService bwService;
+	@Autowired
+	private AccessoryService accessoryService;
 
 	/**
 	 * 保存信息
@@ -259,6 +263,64 @@ public class JyrxxglWebService extends BaseController {
 	}
 	
 	/**
+	 * 人员基本信息保存
+	 * @param ryjbxxEntity
+	 * @param zsList
+	 * @param deleteZsList
+	 * @param accId
+	 * @return
+	 */
+	public RyjbxxEntity saveRyjbxx(RyjbxxEntity ryjbxxEntity,
+			List<RyjbxxZSEntity> zsList, List<RyjbxxZSEntity> deleteZsList, Long accId) {
+		if (null == ryjbxxEntity.getId()) {
+			// 新增
+			ryjbxxEntity.setAddDate(new Date());
+			ryjbxxEntity.setAddUser(Utils.getCurrentUser());
+			ryjbxxEntity.setRecordCode("90");
+		} else {
+			// 修改
+			RyjbxxEntity vo = ryjbxxService.findOne(ryjbxxEntity.getId());
+			ryjbxxEntity.setAddDate(vo.getAddDate());
+			ryjbxxEntity.setAddUser(vo.getAddUser());
+			ryjbxxEntity.setRecordCode(vo.getRecordCode());
+			ryjbxxEntity.setRecordStatus(vo.getRecordStatus());
+			ryjbxxEntity.setSftb(vo.getSftb());
+			ryjbxxEntity.setTbzt(vo.getTbzt());
+			ryjbxxEntity.setQylb(vo.getQylb());
+			ryjbxxEntity.setTbdyid(vo.getTbdyid());
+			ryjbxxEntity.setUpdateDate(new Date());
+			ryjbxxEntity.setUpdateUser(Utils.getWebServiceUser());
+		}
+		RyjbxxEntity ryjbxx = new RyjbxxEntity();
+		ryjbxx = ryjbxxService.save(ryjbxxEntity, zsList, deleteZsList, accId);
+		return ryjbxx;
+	}
+	
+	/**
+	 * 人员信息删除
+	 * @param ryjbxxEntity
+	 * @return
+	 */
+	public WsResult deleteRyjbxx(RyjbxxEntity ryjbxxEntity) {
+		WsResult ws = new WsResult();
+		try {
+			// 删除证书
+			List<RyjbxxZSEntity> zsEntities = ryjbxxService.findZsBySfzh(
+					ryjbxxEntity.getSfzh(), sort);
+			for (RyjbxxZSEntity entity : zsEntities) {
+				if (entity.getAccessory() != null)
+					accessoryService.delete(entity.getAccessory().getId());
+			}
+			ryjbxxService.delete(ryjbxxEntity, zsEntities);
+			ws.setResultCode(WsResult.SUCCESS);
+		} catch (Exception e) {
+			e.printStackTrace();
+			ws.setResultCode(WsResult.FAILURE);
+		}
+		return ws;
+	}
+	
+	/**
 	 * 获取泊位分页信息
 	 * @param entity
 	 * @param n

+ 26 - 0
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/webService/user/UserWebService.java

@@ -2,6 +2,8 @@ package com.jtgh.yjpt.webService.user;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import javax.jws.HandlerChain;
 import javax.jws.WebService;
@@ -127,6 +129,11 @@ public class UserWebService extends BaseWebService {
 		try {
 			UserEntity user = list.get(0);
 			//传过来的密码需解密。
+			Pattern p = Pattern.compile(Constants.PASSWORD_REGEX);  	
+			Matcher m = p.matcher(password);  
+			if(!m.find()) {
+				result = "0-密码复杂度不够,必须包含8位以上并含有数字,字母和特殊字符!";
+			}
 			String psw=Des.decrypt(password);
 			user.setPassword(Utils.encrypt(psw));
 			userService.save(user);
@@ -159,4 +166,23 @@ public class UserWebService extends BaseWebService {
 		return result;
 	}
 	
+	/**
+	 * 修改用户名
+	 * @param userCode
+	 * @param userName
+	 * @return
+	 */
+	public String changeUsername(String userCode,String userName ){
+		String result = "1";
+		List<UserEntity> list = userService.findByCode(userCode);
+		if (list == null || list.size() == 0) {
+			result = "0-用户不存在";
+			return result;
+		}
+		UserEntity user=list.get(0);
+		user.setName(userName);
+		userService.save(user);
+		return result;
+	}
+	
 }

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

@@ -163,6 +163,11 @@ public class CgxxglWebService extends BaseController {
 		Specification<CgEntity> spec = SpecificationCreater
 				.searchByPredicateModels(filterList);
 		List<CgEntity> list = cgService.findAll(spec);
+		for (CgEntity vo : list) {
+			// 检索储罐状态
+			vo.setCgzt(cgztService.findByCg(vo));
+			vo.setCgsy(cgsyService.findByCg(vo));
+		}
 		return list;
 	}
 
@@ -333,5 +338,40 @@ public class CgxxglWebService extends BaseController {
 		}
 		return entity;
 	}
+	
+	/**
+	 *根据经营人列表 查询储罐信息
+	 * 
+	 * @param jyrs
+	 * @param cgmc
+	 * @return
+	 */
+	public List<CgEntity> findCgByJyrs(final List<Long> jyrs) {
+		List<PredicateModel> filterList = new ArrayList<PredicateModel>();
+		addNotEmptyModel(filterList, "dwmc", jyrs, Operator.IN);
+		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, "dwmc", user.getJyrjcxx(),
+						Operator.EQ);
+			} else {
+				// 行政人员根据权限过滤(储罐列表菜单ID=26)
+				addRecordCodeFilter(19l, filterList);
+			}
+		}
+		Specification<CgEntity> spec = SpecificationCreater
+				.searchByPredicateModels(filterList);
+		List<CgEntity> list = cgService.findAll(spec);
+		for (CgEntity vo : list) {
+			// 检索储罐状态
+			vo.setCgzt(cgztService.findByCg(vo));
+			vo.setCgsy(cgsyService.findByCg(vo));
+		}
+		return list;
+	}
 
 }

+ 30 - 0
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/webService/zysqbp/WhsqbpWebService.java

@@ -961,4 +961,34 @@ public class WhsqbpWebService extends BaseController {
 		}
 		return list.getContent();
 	}
+	
+	/**
+	 * 根据泊位获取申报记录(已完成)
+	 * @param cm
+	 * @param n
+	 * @param pageCount
+	 * @return
+	 */
+	public List<ZysqbpEntity> getZysqbpPageListByBw( BwEntity entity,int n, int pageCount) {
+		List<PredicateModel> filterList = new ArrayList<PredicateModel>();
+		List<PredicateModel> recordList = new ArrayList<PredicateModel>();
+		// 只检索已完成和变更已完成的数据
+		addNotEmptyModel(recordList, "recordStatus",
+						BaseEntity.RECORD_STATE_BGCOMPLETED, Operator.EQ);
+		addNotEmptyModel(recordList, "recordStatus",
+				BaseEntity.RECORD_STATE_COMPLETED, Operator.EQ);
+		filterList.add(new PredicateModel(JoinType.OR, recordList));
+		// 根据泊位,只查询泊位
+		addNotEmptyModel(filterList, "zyddqybh.qynbbh", entity.getId(), Operator.EQ);
+		addNotEmptyModel(filterList, "zydd.id", "10000501", Operator.EQ);
+		Specification<ZysqbpEntity> spec = SpecificationCreater
+				.searchByPredicateModels(filterList);
+		SinglePageRequest page = new SinglePageRequest(pageCount, n, "desc",
+				"bgsj");
+		Page<ZysqbpEntity> list = zysqbpService.findAll(spec, page);
+		if(list==null||list.getTotalPages()<pageCount){
+			return  new ArrayList<ZysqbpEntity>();
+		}
+		return list.getContent();
+	}
 }