提交 f43d4d36 authored 作者: inroi's avatar inroi

完成同步

上级 6a814982
...@@ -2,6 +2,8 @@ package com.shr.controller; ...@@ -2,6 +2,8 @@ package com.shr.controller;
import com.shr.annotion.AccessLog; import com.shr.annotion.AccessLog;
import com.shr.common.response.RestResponse; import com.shr.common.response.RestResponse;
import com.shr.serivce.IAdminOrgService;
import com.shr.serivce.IToDoTaskService;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
...@@ -26,14 +28,18 @@ public class ToDoTaskController { ...@@ -26,14 +28,18 @@ public class ToDoTaskController {
@Autowired @Autowired
DataSourceProperties dataSource; DataSourceProperties dataSource;
@Autowired
private IToDoTaskService toDoTaskService;
@AccessLog("待办任务列表总数") @AccessLog("待办任务列表总数")
@GetMapping("/assign") @GetMapping("/assign")
public RestResponse toDoTaskList() { public RestResponse toDoTaskList() {
DBHelper dbHelper = DBHelper.createDBHelper(dataSource); DBHelper dbHelper = DBHelper.createDBHelper(dataSource);
ResultSet result = dbHelper.executeQuery("select * from t_wfr_assign_view", null); ResultSet result = dbHelper.executeQuery("select * from t_wfr_assign_view", null);
toDoTaskService.toDoTaskList(result);
return RestResponse.success(resultToJson(result)); return RestResponse.success("同步成功");
} }
...@@ -41,18 +47,15 @@ public class ToDoTaskController { ...@@ -41,18 +47,15 @@ public class ToDoTaskController {
{ {
String result = ""; String result = "";
try { try {
Console.log("beginPraseJson"); toDoTaskService.
while(rs.next()){ while(rs.next()){
Console.log("PrasingJson");
//Retrieve by column name //Retrieve by column name
String courseid = rs.getString("FSUBJECT_L1"); String courseid = rs.getString("FSUBJECT_L1");
String name = rs.getString("FSUBJECT_L2"); String name = rs.getString("FSUBJECT_L2");
String prerequisites = rs.getString("FSUBJECT_L3"); String prerequisites = rs.getString("FSUBJECT_L3");
result += "<tr><td>"+courseid+"</td><td>"+name+"</td><td>"+prerequisites + "</td></tr>"; result += "<tr><td>"+courseid+"</td><td>"+name+"</td><td>"+prerequisites + "</td></tr>";
Console.log(result);
} }
Console.log("endPraseJson");
} catch (SQLException e) { } catch (SQLException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
...@@ -64,8 +67,9 @@ public class ToDoTaskController { ...@@ -64,8 +67,9 @@ public class ToDoTaskController {
@GetMapping("/assigndetial") @GetMapping("/assigndetial")
public RestResponse toDoTaskDetailList() { public RestResponse toDoTaskDetailList() {
DBHelper dbHelper = DBHelper.createDBHelper(dataSource); DBHelper dbHelper = DBHelper.createDBHelper(dataSource);
ResultSet result = dbHelper.executeQuery("select * from t_wfr_assigndetial_view", null); ResultSet result = dbHelper.executeQuery("select * from t_wfr_assigndetail_view", null);
return RestResponse.success(resultToJson(result)); toDoTaskService.toDoTaskDetailList(result);
return RestResponse.success("同步成功");
} }
......
package com.shr.serivce; package com.shr.serivce;
import java.sql.ResultSet;
import com.shr.transfer.task.ToDoTaskDetailListInVo; import com.shr.transfer.task.ToDoTaskDetailListInVo;
import com.shr.transfer.task.ToDoTaskDetailListOutVo; import com.shr.transfer.task.ToDoTaskDetailListOutVo;
import com.shr.transfer.task.ToDoTaskListInVo; import com.shr.transfer.task.ToDoTaskListInVo;
...@@ -16,7 +18,7 @@ public interface IToDoTaskService { ...@@ -16,7 +18,7 @@ public interface IToDoTaskService {
* @param inVo 条件 * @param inVo 条件
* @return 列表 * @return 列表
*/ */
ToDoTaskListOutVo toDoTaskList(ToDoTaskListInVo inVo); void toDoTaskList(ResultSet rs);
/** /**
* 待办任务明细列表 * 待办任务明细列表
...@@ -24,7 +26,7 @@ public interface IToDoTaskService { ...@@ -24,7 +26,7 @@ public interface IToDoTaskService {
* @param inVo 条件 * @param inVo 条件
* @return 列表 * @return 列表
*/ */
ToDoTaskDetailListOutVo toDoTaskDetailList(ToDoTaskDetailListInVo inVo); void toDoTaskDetailList(ResultSet rs);
} }
...@@ -14,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -14,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -31,34 +33,26 @@ public class ToDoTaskServiceImpl implements IToDoTaskService { ...@@ -31,34 +33,26 @@ public class ToDoTaskServiceImpl implements IToDoTaskService {
@Override @Override
public ToDoTaskListOutVo toDoTaskList(ToDoTaskListInVo inVo) { public void toDoTaskList(ResultSet rs) {
Response totalResponse = callShrOsfApi.callShrOsf("getUnProcessAssignCount", null); try {
Map<String, Object> map = JsonUtil.toMap(JsonUtil.toString(totalResponse.getData()), String.class, Object.class); this.toDoTaskSynchronization(rs);
Map<String, Object> temp = new HashMap<>(); } catch (SQLException e) {
temp.put("total", Integer.parseInt((String) map.get("total"))); // TODO Auto-generated catch block
temp.put("page", 1); e.printStackTrace();
temp.put("rows", 9999); }
Response detailResponse = callShrOsfApi.callShrOsf("getUnProcessAssign", temp);
ToDoTaskListOutVo outVo = new ToDoTaskListOutVo();
outVo.setTotal(Integer.parseInt((String) map.get("total")));
outVo.setTotalRecords(JsonUtil.toList(JsonUtil.toString(map.get("categoryCount")), Object.class));
outVo.setDetailRecords(JsonUtil.toList(JsonUtil.toString(detailResponse.getData()), Object.class));
this.toDoTaskSynchronization(outVo);
return outVo;
} }
@Override @Override
public ToDoTaskDetailListOutVo toDoTaskDetailList(ToDoTaskDetailListInVo inVo) { public void toDoTaskDetailList(ResultSet rs) {
Response response = callShrOsfApi.callShrOsf("getUnProcessAssign", null); try {
this.toDoTaskSynchronization(rs);
ToDoTaskDetailListOutVo outVo = new ToDoTaskDetailListOutVo(); } catch (SQLException e) {
outVo.setRecords(JsonUtil.toList(JsonUtil.toString(response.getData()), Object.class)); // TODO Auto-generated catch block
return outVo; e.printStackTrace();
}
} }
public RestResponse toDoTaskSynchronization(ToDoTaskListOutVo outVo) { public RestResponse toDoTaskSynchronization(ResultSet rs) throws SQLException {
String url = "http://172.16.1.78:81"; String url = "http://172.16.1.78:81";
String json = "{\"userName\":\"hrrest\",\"password\":\"hrhdrest123\"}"; String json = "{\"userName\":\"hrrest\",\"password\":\"hrhdrest123\"}";
String toekn = HttpClientUtil.sendPost(url + "/seeyon/rest/token", json); String toekn = HttpClientUtil.sendPost(url + "/seeyon/rest/token", json);
...@@ -68,21 +62,20 @@ public class ToDoTaskServiceImpl implements IToDoTaskService { ...@@ -68,21 +62,20 @@ public class ToDoTaskServiceImpl implements IToDoTaskService {
} }
List<Map<String, Object>> tempList = new ArrayList<>(); List<Map<String, Object>> tempList = new ArrayList<>();
for (Object object : outVo.getDetailRecords()) { while (rs.next()) {
Map<String, Object> map = JsonUtil.toMap(JsonUtil.toString(object), String.class, Object.class);
Map<String, Object> reqeust = new HashMap<>(15); Map<String, Object> reqeust = new HashMap<>(15);
reqeust.put("taskId", map.get("id")); reqeust.put("taskId",rs.getString("FASSIGNID"));
reqeust.put("registerCode", "3001"); reqeust.put("registerCode", "3001");
reqeust.put("title", map.get("subject")); reqeust.put("title",rs.getString("FSUBJECT_L1"));
reqeust.put("classify", "erp"); reqeust.put("classify", "erp");
reqeust.put("contentType", "erp"); reqeust.put("contentType", "erp");
reqeust.put("thirdSenderId", ""); reqeust.put("thirdSenderId", "");
reqeust.put("senderName", map.get("sender")); reqeust.put("senderName", "");
reqeust.put("thirdReceiverId", ""); reqeust.put("thirdReceiverId", "");
reqeust.put("noneBindingReceiver", map.get("priorPerform")); reqeust.put("noneBindingReceiver", "1881");
reqeust.put("noneBindingSender", map.get("sender")); reqeust.put("noneBindingSender", "0009");
reqeust.put("creationDate", map.get("createdTime")); reqeust.put("creationDate", rs.getDate("FCreatedTime"));
reqeust.put("state", map.get("state")); reqeust.put("state", "0");
reqeust.put("subState", "0"); reqeust.put("subState", "0");
reqeust.put("content", ""); reqeust.put("content", "");
reqeust.put("url", "http://ericbing/K3Cloud7.5/html5/index.aspx"); reqeust.put("url", "http://ericbing/K3Cloud7.5/html5/index.aspx");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论