Browse Source

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

ld_liufl 9 years ago
parent
commit
d44447ea95

+ 58 - 31
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/webService/common/task/TaskInfoWebService.java

@@ -1,6 +1,5 @@
 package com.jtgh.yjpt.webService.common.task;
 
-
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -29,6 +28,8 @@ 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;
+import com.jtgh.yjpt.webService.WsResult;
+
 /**
  * 任务保存接口
  * 
@@ -37,7 +38,7 @@ import com.jtgh.yjpt.service.task.TaskService;
  */
 @Service
 @WebService(targetNamespace = "http://webService.yjpt.com/", serviceName = "taskInfoService")
-@HandlerChain(file="handle-chain.xml")
+@HandlerChain(file = "handle-chain.xml")
 public class TaskInfoWebService extends BaseController {
 	@Autowired
 	private TaskInfoService infoService;
@@ -45,19 +46,22 @@ public class TaskInfoWebService extends BaseController {
 	private WorkflowMangerService workflowMangerService;
 	@Autowired
 	private TaskService service;
+
 	/***
 	 * 保存
 	 */
-	public TaskInfoEntity save(TaskInfoEntity entity){
-	  return infoService.save(entity);
+	public TaskInfoEntity save(TaskInfoEntity entity) {
+		return infoService.save(entity);
 	}
-	
-	public List<TaskInfoEntity> getTaskListByIdAndBusKey(Long id,String busKey){
-		return infoService.findByBusIdAndBusKeyOrderByIdAsc(id.toString(), busKey);
+
+	public List<TaskInfoEntity> getTaskListByIdAndBusKey(Long id, String busKey) {
+		return infoService.findByBusIdAndBusKeyOrderByIdAsc(id.toString(),
+				busKey);
 	}
-	
+
 	/**
 	 * 获取待办任务
+	 * 
 	 * @param busKey
 	 * @param begin
 	 * @param end
@@ -66,30 +70,33 @@ public class TaskInfoWebService extends BaseController {
 	 * @return
 	 */
 	@SuppressWarnings("unchecked")
-	public List<WorkItem>  getTodoList(
-			String busKey, Date begin, Date end,int n, int pageCount) {
+	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");
+		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;
 	}
-	
+
 	/**
 	 * 统计登录用户的待办任务数量
+	 * 
 	 * @param busKey
 	 * @param begin
 	 * @param end
 	 * @return
 	 */
-	public int getTodoListCount(String busKey, Date begin, Date end){
-		return workflowMangerService.todoListCount(Utils.getWebServiceUser().getId().toString(), busKey==null?"":busKey, begin, end);
+	public int getTodoListCount(String busKey, Date begin, Date end) {
+		return workflowMangerService.todoListCount(Utils.getWebServiceUser()
+				.getId().toString(), busKey == null ? "" : busKey, begin, end);
 	}
-	
+
 	/**
 	 * 查询工作提醒数量
 	 * 
@@ -104,9 +111,9 @@ public class TaskInfoWebService extends BaseController {
 		}
 		// 工作提醒列表
 		List<Gztx> gztxs = service.findTxByUser(userEntity.getId());
-		return  gztxs==null?"":gztxs.size()+"";
+		return gztxs == null ? "" : gztxs.size() + "";
 	}
-	
+
 	/**
 	 * 消息关闭
 	 * 
@@ -120,27 +127,47 @@ public class TaskInfoWebService extends BaseController {
 	}
 
 	/**
+	 * 批量消息关闭
+	 * 
+	 * @return
+	 */
+	public WsResult doXxListClose(List<Gztx> gztxList) {
+		WsResult ws = new WsResult();
+		try {
+			if (gztxList != null) {
+				for (Gztx gztx : gztxList) {
+					gztx = service.findOne(gztx.getId());
+					gztx.setTxzt(Constants.NO);
+					service.saveGztx(gztx);
+				}
+			}
+
+			ws.setResultCode(WsResult.SUCCESS);
+		} catch (Exception e) {
+			e.printStackTrace();
+			ws.setResultCode(WsResult.FAILURE);
+		}
+		return ws;
+	}
+
+	/**
 	 * 列表查询
 	 * 
 	 * @return
 	 */
-	public List<Gztx> getGztxPageList(int n,int pageCount) {
+	public List<Gztx> getGztxPageList(int n, int pageCount) {
 		List<PredicateModel> filterList = new ArrayList<PredicateModel>();
-		addNotEmptyModel(filterList,"recordStatus",BaseEntity.RECORD_STATE_DELETE,Operator.NEQ);
+		addNotEmptyModel(filterList, "recordStatus",
+				BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
 		Specification<Gztx> spec = SpecificationCreater
 				.searchByPredicateModels(filterList);
-		SinglePageRequest page = new SinglePageRequest(pageCount, n,
-				"desc", "id");
+		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();
 	}
-	
-}
-
-
-
-
 
+}