提交 2e2c0b53 authored 作者: 李炎's avatar 李炎

修改金蝶访问到测试环境,提供手动同步接口

上级 3aa0aacb
......@@ -13,10 +13,15 @@ import java.util.*;
@Slf4j
@Component
public class CategoryDao {
static String K3CloudURL = "http://192.168.2.243/k3cloud/";//指定地址
static String dbId = "6136b7c51f0e4f";
static String uid = "Administrator";
static String pwd = "888888";
// static String K3CloudURL = "http://192.168.2.243/k3cloud/";//指定地址
// static String dbId = "6136b7c51f0e4f";
// static String uid = "Administrator";
// static String pwd = "888888";
// static int lang = 2052;
static String K3CloudURL = "https://cwxt.kingsware.cn/k3cloud/";//指定地址
static String dbId = "613ef0b02c911d";
static String uid = "kingdee";
static String pwd = "123456";
static int lang = 2052;
K3CloudApiClient client = new K3CloudApiClient(K3CloudURL);
private String Stringwhere(Map<String,String> map){
......
......@@ -12,10 +12,15 @@ import java.util.Map;
@Slf4j
@Component
public class CategoryDaoSql {
static String K3CloudURL = "http://192.168.2.243/k3cloud/";//指定地址
static String dbId = "6136b7c51f0e4f";
static String uid = "Administrator";
static String pwd = "888888";
// static String K3CloudURL = "http://192.168.2.243/k3cloud/";//指定地址
// static String dbId = "6136b7c51f0e4f";
// static String uid = "Administrator";
// static String pwd = "888888";
// static int lang = 2052;
static String K3CloudURL = "https://cwxt.kingsware.cn/k3cloud/";//指定地址
static String dbId = "613ef0b02c911d";
static String uid = "kingdee";
static String pwd = "123456";
static int lang = 2052;
K3CloudApiClient client = new K3CloudApiClient(K3CloudURL);
String servicenameTable = "LQKJ.WebApi.Stub.CustomWebApiService.ExecutDataSet,LQKJ.WebApi.Stub";
......
......@@ -2,6 +2,7 @@ package org.jeecg.modules.iost.API.ExternalInterface;
import org.jeecg.modules.iost.API.ExternalInterface.Interface.API;
import org.jeecg.modules.iost.API.Util.HttpUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
......@@ -16,8 +17,8 @@ import java.util.Map;
@Component
public class BusinessTripInterfaceApi implements API {
private String url = "http://test.qywx.kingsware.cn";//正式接口
@Value("${oa.url}")
private String url;
// private String url = "https://b02ba329-ac3e-4144-a744-25abca96b290.mock.pstmn.io/";
private Map<String, String> hreader = new HashMap<>();
......
......@@ -2,6 +2,7 @@ package org.jeecg.modules.iost.API.ExternalInterface;
import org.jeecg.modules.iost.API.ExternalInterface.Interface.API;
import org.jeecg.modules.iost.API.Util.HttpUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
......@@ -15,8 +16,8 @@ import java.util.Map;
@Component
public class OtherReimbursementInterfaceApi implements API {
private String url = "http://test.qywx.kingsware.cn";//正式接口
@Value("${oa.url}")
private String url;
// private String url = "https://b02ba329-ac3e-4144-a744-25abca96b290.mock.pstmn.io/";
private Map<String, String> hreader = new HashMap<>();
......
......@@ -24,7 +24,7 @@ import java.util.*;
@Api(tags = "")
@RestController
@RequestMapping("/API/test")
@RequestMapping("/API/OA")
@Slf4j
public class ApiTestContrller {
@Autowired
......@@ -34,7 +34,7 @@ public class ApiTestContrller {
@Autowired
LoanInterfaceWebapi loanInterfaceWebapi;
@GetMapping("/OA")
@GetMapping("/test")
public Object dtr() {
Map returnResult = new HashMap();
Map params = new LinkedHashMap() {{
......
package org.jeecg.modules.iost.API.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.modules.iost.API.service.IQueryBusinessTripDetailsService;
import org.jeecg.modules.iost.API.service.IQueryLoanDetailsService;
import org.jeecg.modules.iost.API.service.IQueryOtherDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@Api(tags = "业务手动同步")
@RestController
@RequestMapping("/API/manual")
@Slf4j
public class ManualController {
@Autowired
private IQueryLoanDetailsService queryLoanDetailsService;
@Autowired
private IQueryBusinessTripDetailsService queryBusinessTripDetailsService;
@Autowired
private IQueryOtherDetailsService queryOtherDetailsService;
@AutoLog(value = "查询借款接口")
@ApiOperation(value = "查询借款接口", notes = "查询借款接口")
@GetMapping("/queryLoan")
public Map QueryLoan(@RequestParam Map map){
Map manual = queryLoanDetailsService.manual(map);
return manual;
}
@AutoLog(value = "查询差旅接口")
@ApiOperation(value = "查询差旅接口", notes = "查询差旅接口")
@GetMapping("/queryBusinessTrip")
public Map QueryBusinessTrip(@RequestParam Map map){
Map manual = queryBusinessTripDetailsService.manual(map);
return manual;
}
@AutoLog(value = "查询其他接口")
@ApiOperation(value = "查询其他接口", notes = "查询其他接口")
@GetMapping("/queryOther")
public Map QueryOther(@RequestParam Map map){
Map manual = queryOtherDetailsService.manual(map);
return manual;
}
}
......@@ -10,5 +10,5 @@ import java.util.Map;
public interface IQueryBusinessTripDetailsService extends IService<QueryBusinessTripDetails> {
public Map synchronization(Map object) throws IOException, ParseException;
public Boolean manual(Map<String, Object> map, String ReturnProcessId) throws ParseException;
public Map manual(Map map);
}
......@@ -12,5 +12,5 @@ public interface IQueryLoanDetailsService extends IService<QueryLoanDetails> {
public Map synchronization(Map object) throws IOException, ParseException;
public Boolean manual(Map<String, Object> map, String ReturnProcessId) throws ParseException;
public Map manual(Map map);
}
......@@ -11,5 +11,5 @@ public interface IQueryOtherDetailsService extends IService<QueryOtherDetails> {
public Map synchronization(Map object) throws IOException, ParseException;
public Boolean manual(Map<String, Object> map, String ReturnProcessId) throws ParseException;
public Map manual(Map map);
}
......@@ -28,45 +28,72 @@ public class QueryBusinessTripDetailsServiceImpl extends ServiceImpl<QueryBusine
private IOaSelectJournalService oaSelectJournalService;
@Autowired
private IKingdeeSaveJournalService KingdeeSaveJournalService;
private int BusinessNo=5;
private int BusinessNo = 5;
@Override
public Map synchronization(Map object) throws IOException, ParseException {
Map returnResult = new HashMap();
returnResult.put("message", "请求数据报错");
returnResult.put("result", "同步完成");
Map params = new LinkedHashMap() {{
put("method", "queryConcludeData");
put("type","ER_ExpReimbursement_Travel");
put("type", "ER_ExpReimbursement_Travel");
put("date", beforeDayByNowDay());
}};
try {
if (null != object && null != object.get("date")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String date = sdf.format(sdf.parse(object.get("date").toString()));
params = new LinkedHashMap() {{
put("method", "queryConcludeData");
put("type", "ER_ExpReimbursement_Travel");
put("date", date);
}};
}
}catch (Exception e){
returnResult.put("message", "手动同步失败");
returnResult.put("result", "参数无法解析");
return returnResult;
}
String responsejson = "";
String requestJson = JsonUtil.Mapjson(params);
boolean faceApiCatch = true;
boolean webApiCatch = true;
String add = "";
try {
responsejson = businessTripInterfaceApi.getSelect(params);//获取差旅
oaSelectJournalService.setOaSelectJournal(requestJson, responsejson, BusinessNo);
responsejson = businessTripInterfaceApi.getSelect(params);//获取借款
} catch (Exception e) {
faceApiCatch = false;
responsejson = e.toString();
oaSelectJournalService.setOaSelectJournalError(requestJson, responsejson, BusinessNo);
returnResult.put("message", "请求数据报错");
returnResult.put("result", responsejson);
return returnResult;
}
if (faceApiCatch) oaSelectJournalService.setOaSelectJournal(requestJson, responsejson, BusinessNo);
JSONObject jsonObject = JSONObject.fromObject(responsejson);
Object result = jsonObject.get("result");
returnResult.put("result", "同步完成");
String s = result.toString();
String add = "";
try {
add = businessTripInterfaceWebapi.batchAdd(s);
KingdeeSaveJournalService.setKingdeeSave(s, add, BusinessNo);
} catch (Exception e) {
add = e.toString();
KingdeeSaveJournalService.setKingdeeSaveError(s, add, BusinessNo);
returnResult.put("result", "同步完成,部分数据未同步");
}
String s = result.toString();
try {
add = businessTripInterfaceWebapi.batchAdd(s);
} catch (Exception e) {
webApiCatch = false;
e.printStackTrace();
add = e.toString();
KingdeeSaveJournalService.setKingdeeSaveError(s, add, BusinessNo);
returnResult.put("message", "保存数据报错");
returnResult.put("result", add);
}
if (webApiCatch) KingdeeSaveJournalService.setKingdeeSave(s, add, BusinessNo);
return returnResult;
}
/**
* 获取当前日期的前一天
* 需要返回的日期格式,例如:yyyy-MM-dd HH:mm:ss
......@@ -81,7 +108,15 @@ public class QueryBusinessTripDetailsServiceImpl extends ServiceImpl<QueryBusine
}
@Override
public Boolean manual(Map<String, Object> map, String ReturnProcessId) throws ParseException {
return null;
public Map manual(Map map) {
Map synchronization = null;
try {
synchronization = this.synchronization(map);
} catch (IOException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
}
return synchronization;
}
}
......@@ -30,40 +30,67 @@ public class QueryLoanDetailsServiceImpl extends ServiceImpl<QueryLoanDetailsMap
private IOaSelectJournalService oaSelectJournalService;
@Autowired
private IKingdeeSaveJournalService KingdeeSaveJournalService;
private int BusinessNo=1;
private int BusinessNo = 1;
@Override
public Map synchronization(Map object) throws IOException, ParseException {
Map returnResult = new HashMap();
returnResult.put("message", "请求数据报错");
returnResult.put("result", "同步完成");
Map params = new LinkedHashMap() {{
put("method", "queryConcludeData");
put("type", "ER_ExpenseRequest");
put("date", beforeDayByNowDay());
}};
try {
if (null != object && null != object.get("date")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String date = sdf.format(sdf.parse(object.get("date").toString()));
params = new LinkedHashMap() {{
put("method", "queryConcludeData");
put("type", "ER_ExpenseRequest");
put("date", date);
}};
}
}catch (Exception e){
returnResult.put("message", "手动同步失败");
returnResult.put("result", "参数无法解析");
return returnResult;
}
String responsejson = "";
String requestJson = JsonUtil.Mapjson(params);
boolean faceApiCatch = true;
boolean webApiCatch = true;
String add = "";
try {
responsejson = loanInterfaceApi.getSelect(params);//获取借款
oaSelectJournalService.setOaSelectJournal(requestJson, responsejson, BusinessNo);
} catch (Exception e) {
faceApiCatch = false;
responsejson = e.toString();
oaSelectJournalService.setOaSelectJournalError(requestJson, responsejson, BusinessNo);
returnResult.put("message", "请求数据报错");
returnResult.put("result", responsejson);
return returnResult;
}
if (faceApiCatch) oaSelectJournalService.setOaSelectJournal(requestJson, responsejson, BusinessNo);
JSONObject jsonObject = JSONObject.fromObject(responsejson);
Object result = jsonObject.get("result");
returnResult.put("result", "同步完成");
String s = result.toString();
String add = "";
try {
add = loanInterfaceWebapi.batchAdd(s);
KingdeeSaveJournalService.setKingdeeSave(s, add, BusinessNo);
} catch (Exception e) {
e.printStackTrace();
add = e.toString();
KingdeeSaveJournalService.setKingdeeSaveError(s, add, BusinessNo);
returnResult.put("result", "同步完成,部分数据未同步");
}
String s = result.toString();
try {
add = loanInterfaceWebapi.batchAdd(s);
} catch (Exception e) {
webApiCatch = false;
e.printStackTrace();
add = e.toString();
KingdeeSaveJournalService.setKingdeeSaveError(s, add, BusinessNo);
returnResult.put("message", "保存数据报错");
returnResult.put("result", add);
}
if (webApiCatch) KingdeeSaveJournalService.setKingdeeSave(s, add, BusinessNo);
return returnResult;
}
......@@ -81,10 +108,17 @@ public class QueryLoanDetailsServiceImpl extends ServiceImpl<QueryLoanDetailsMap
}
@Override
public Boolean manual(Map<String, Object> map, String ReturnProcessId) throws ParseException {
return null;
public Map manual(Map map) {
Map synchronization = null;
try {
synchronization = this.synchronization(map);
} catch (IOException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
}
return synchronization;
}
}
......@@ -28,44 +28,67 @@ public class QueryOtherDetailsServiceImpl extends ServiceImpl<QueryOtherDetailsM
private IOaSelectJournalService oaSelectJournalService;
@Autowired
private IKingdeeSaveJournalService KingdeeSaveJournalService;
private int BusinessNo=9;
private int BusinessNo = 9;
@Override
public Map synchronization(Map object) throws IOException, ParseException {
Map returnResult = new HashMap();
returnResult.put("message", "请求数据报错");
returnResult.put("result", "同步完成");
Map params = new LinkedHashMap() {{
put("method", "queryConcludeData");
put("type","ER_ExpReimbursement");
put("type", "ER_ExpReimbursement");
put("date", beforeDayByNowDay());
}};
try {
if (null != object && null != object.get("date")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String date = sdf.format(sdf.parse(object.get("date").toString()));
params = new LinkedHashMap() {{
put("method", "queryConcludeData");
put("type", "ER_ExpReimbursement");
put("date", date);
}};
}
} catch (Exception e) {
returnResult.put("message", "手动同步失败");
returnResult.put("result", "参数无法解析");
return returnResult;
}
String responsejson = "";
String requestJson = JsonUtil.Mapjson(params);
boolean faceApiCatch = true;
boolean webApiCatch = true;
String add = "";
try {
responsejson = interfaceApi.getSelect(params);//获取借款
oaSelectJournalService.setOaSelectJournal(requestJson, responsejson, BusinessNo);
} catch (Exception e) {
faceApiCatch = false;
responsejson = e.toString();
oaSelectJournalService.setOaSelectJournalError(requestJson, responsejson, BusinessNo);
returnResult.put("message", "请求数据报错");
returnResult.put("result", responsejson);
return returnResult;
}
if (faceApiCatch) oaSelectJournalService.setOaSelectJournal(requestJson, responsejson, BusinessNo);
JSONObject jsonObject = JSONObject.fromObject(responsejson);
Object result = jsonObject.get("result");
returnResult.put("result", "同步完成");
String s = result.toString();
String add = "";
try {
add = webapi.batchAdd(s);
KingdeeSaveJournalService.setKingdeeSave(s, add, BusinessNo);
} catch (Exception e) {
add = e.toString();
KingdeeSaveJournalService.setKingdeeSaveError(s, add, BusinessNo);
returnResult.put("result", "同步完成,部分数据未同步");
}
String s = result.toString();
try {
add = webapi.batchAdd(s);
} catch (Exception e) {
webApiCatch = false;
e.printStackTrace();
add = e.toString();
KingdeeSaveJournalService.setKingdeeSaveError(s, add, BusinessNo);
returnResult.put("message", "保存数据报错");
returnResult.put("result", add);
}
if (webApiCatch) KingdeeSaveJournalService.setKingdeeSave(s, add, BusinessNo);
return returnResult;
}
......@@ -84,7 +107,15 @@ public class QueryOtherDetailsServiceImpl extends ServiceImpl<QueryOtherDetailsM
@Override
public Boolean manual(Map<String, Object> map, String ReturnProcessId) throws ParseException {
return null;
public Map manual(Map map) {
Map synchronization = null;
try {
synchronization = this.synchronization(map);
} catch (IOException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
}
return synchronization;
}
}
......@@ -18,6 +18,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -27,10 +28,10 @@ import java.util.*;
@Service
public class ToolsTest {
static String K3CloudURL = "http://192.168.2.243/k3cloud/";//指定地址
static String dbId = "6136b7c51f0e4f";
static String uid = "Administrator";
static String pwd = "888888";
static String K3CloudURL = "https://cwxt.kingsware.cn:8090/k3cloud/";//指定地址
static String dbId = "613ef0b02c911d";
static String uid = "kingdee";
static String pwd = "123456";
static int lang = 2052;
K3CloudApiClient client = new K3CloudApiClient(K3CloudURL);
......@@ -153,16 +154,12 @@ public class ToolsTest {
@Test
// @Scheduled(fixedDelay = 5000)
public void timdsaded() throws InterruptedException {
List objects = new ArrayList<>();
for (int i = 0; i < 10; i++) {
objects.add(i);
}
for (int i = 0; i < objects.size(); i++) {
if (i == 3) {
objects.remove(i);
}
System.out.println(objects.get(i));
public void timdsaded() throws InterruptedException, ParseException {
try {
Boolean result = client.login(dbId, uid, pwd, lang);
System.out.println(result);
} catch (Exception e) {
e.printStackTrace();
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论