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

完成同步

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