提交 59eeb082 authored 作者: 李炎's avatar 李炎

流程完成

上级 cf43e2bc
差异被折叠。
...@@ -3,11 +3,8 @@ package org.jeecg.modules.iost.API.Dao; ...@@ -3,11 +3,8 @@ package org.jeecg.modules.iost.API.Dao;
import kingdee.bos.webapi.client.K3CloudApiClient; import kingdee.bos.webapi.client.K3CloudApiClient;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.Today;
import org.jeecg.modules.iost.API.webapi.Util.ConditionalSplicing;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
/** /**
...@@ -30,7 +27,7 @@ public class CategoryDao { ...@@ -30,7 +27,7 @@ public class CategoryDao {
if (where!=null){ if (where!=null){
where = where + " AND " + key + "=" + value; where = where + " AND " + key + "=" + value;
}else { }else {
where = key + "='" + value+"'"; where = key + "=" + value+"";
} }
} }
} }
...@@ -94,5 +91,46 @@ public class CategoryDao { ...@@ -94,5 +91,46 @@ public class CategoryDao {
} }
return list; return list;
} }
public Map<String,List<List<Object>>> selectMapWhereMap(String sFormId, Map<String,String> key,Map<String,String> where){
List<List<Object>> list = null;
Map<String, List<List<Object>>> stringListHashMap = new HashMap<String, List<List<Object>>>();
try {
Boolean result = client.login(dbId, uid, pwd, lang);
if(result){
String content;
if(where!=null){
content= "{\"FormId\":\""+sFormId+"\","+Stringkey(key)+Stringwhere(where)+"}";
}else{
content = "{\"FormId\":\""+sFormId+"\","+Stringkey(key)+"}";
}
list = client.executeBillQuery(content);
stringListHashMap.put(content,list);
}
} catch (Exception e) {
e.printStackTrace();
}
return stringListHashMap;
}
public Map<String,List<List<Object>>> selectMapWhereString(String sFormId, Map<String,String> key,String where){
List<List<Object>> list = null;
Map<String, List<List<Object>>> stringListHashMap = new HashMap<String, List<List<Object>>>();
try {
Boolean result = client.login(dbId, uid, pwd, lang);
if(result){
String content;
if(where!=null){
content= "{\"FormId\":\""+sFormId+"\","+Stringkey(key)+ ",\"FilterString\":\""+where+"\"" +"}";
}else{
content = "{\"FormId\":\""+sFormId+"\","+Stringkey(key)+"}";
}
list = client.executeBillQuery(content);
stringListHashMap.put(content,list);
}
} catch (Exception e) {
e.printStackTrace();
}
return stringListHashMap;
}
} }
package org.jeecg.modules.iost.API.Dao;
import kingdee.bos.webapi.client.K3CloudApiClient;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.iost.API.Util.HttpUtil;
import org.jeecg.modules.iost.API.Util.HttpUtils;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
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 int lang = 2052;
K3CloudApiClient client = new K3CloudApiClient(K3CloudURL);
String servicenameTable = "LQKJ.WebApi.Stub.CustomWebApiService.ExecutDataSet,LQKJ.WebApi.Stub";
String servicenameMap = "LQKJ.WebApi.Stub.CustomWebApiService.ExecuteDynamicObject,LQKJ.WebApi.Stub";
String updateService = "LQKJ.WebApi.Stub.CustomWebApiService.ExecutBatch,LQKJ.WebApi.Stub";
private String StringkeyMap(Map<String, String> map) {
String Keys = null;
for (String key : map.keySet()) {
String value = String.valueOf(key);
if (value != null && value != "") {
if (Keys != null) {
Keys = Keys + " , " + key;
} else {
Keys = key;
}
}
}
if (Keys != null) {
return Keys;
}
return "";
}
private String StringWhereCompare(Map<String, String> map) {
String where = null;
for (String key : map.keySet()) {
String value = String.valueOf(map.get(key));
if (value != null && value != "") {
if (where != null) {
where = where + " AND " + key + value;
} else {
where = key + "" + value + "";
}
}
}
if (where != null) {
return " where " + where + "";
}
return "";
}
private String StringOrCompare(Map<String, String> map) {
String where = null;
for (String key : map.keySet()) {
String value = String.valueOf(map.get(key));
if (value != null && value != "") {
if (where != null) {
where = where + " OR " + key + value;
} else {
where = key + "" + value + "";
}
}
}
if (where != null) {
return " where " + where + "";
}
return "";
}
private String StringCompareIn(Map<String, String> map) {
String where = null;
for (String key : map.keySet()) {
String value = String.valueOf(map.get(key));
if (value != null && value != "") {
if (where != null) {
where = where + "," + value;
} else {
where = key + " in (" + value + "";
}
}
}
if (where != null) {
return " where " + where + ")";
}
return "";
}
private String updateSetMap(Map<String, String> map) {
String Keys = null;
for (String key : map.keySet()) {
String value = String.valueOf(key);
if (value != null && value != "") {
if (Keys != null) {
Keys = Keys + " , " + key + " = " + "'" + map.get(key) + "'";
} else {
Keys = key + " = " + "'" + map.get(key) + "'";
}
}
}
if (Keys != null) {
return Keys;
}
return "";
}
public Map<String, List<Map>> selectInMap(String f_sFormId, Map<String, String> key, Map<String, String> where) {
Map<String, List<Map>> log = new HashMap<>();//返回k请求v相应
String content = null;//请求
List<Map> list = null;//响应
try {
Boolean result = client.login(dbId, uid, pwd, lang);
if (result) {
if (where != null) {
content = "SELECT top 100 " + StringkeyMap(key) + " FROM " + f_sFormId + StringWhereCompare(where) + ";";
} else {
content = "SELECT top 100 " + StringkeyMap(key) + " FROM " + f_sFormId + ";";
}
String[] strings = new String[]{content};
System.out.println("content " + content);
list = client.execute(servicenameMap, strings, List.class);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
log.put(content, list);//请求数据做key,返回做value
}
return log;
}
public Map<String, List<Map>> selectInMapOR(String f_sFormId, Map<String, String> key, Map<String, String> where) {
Map<String, List<Map>> log = new HashMap<>();//返回k请求v相应
String content = null;//请求
List<Map> list = null;//响应
try {
Boolean result = client.login(dbId, uid, pwd, lang);
if (result) {
if (where != null) {
content = "SELECT " + StringkeyMap(key) + " FROM " + f_sFormId + StringOrCompare(where) + ";";
} else {
content = "SELECT " + StringkeyMap(key) + " FROM " + f_sFormId + ";";
}
String[] strings = new String[]{content};
list = client.execute(servicenameMap, strings, List.class);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
log.put(content, list);//请求数据做key,返回做value
}
return log;
}
public Map<String, List<Map>> selectMapIn(String f_sFormId, Map<String, String> key, Map<String, String> where) {
Map<String, List<Map>> log = new HashMap<>();//返回k请求v相应
String content = null;//请求
List<Map> list = null;//响应
try {
Boolean result = client.login(dbId, uid, pwd, lang);
if (result) {
if (where != null) {
content = "SELECT top 100 " + StringkeyMap(key) + " FROM " + f_sFormId + StringCompareIn(where) + ";";
} else {
content = "SELECT top 100 " + StringkeyMap(key) + " FROM " + f_sFormId + ";";
}
String[] strings = new String[]{content};
list = client.execute(servicenameMap, strings, List.class);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
log.put(content, list);//请求数据做key,返回做value
}
return log;
}
public Map<String, Object> updateInMap(String f_sFormId, Map<String, String> set, Map<String, String> where) {
Map<String, Object> log = new HashMap<>();//返回k请求v相应
String content = null;//请求
Object list = null;//响应
try {
content = "UPDATE " + f_sFormId + " SET " + updateSetMap(set) + " " + StringCompareIn(where);
Map<String, String> hreader = new HashMap<>();
hreader.put("Cookie", "ASP.NET_SessionId=w1um3b2stpbkovaacfz55oh1; kdservice-sessionid=fb84160d-d8e3-4d21-bcf7-3fc9e2851837");
String finalContent = content;
String url = "http://192.168.2.243/k3cloud/LQKJ.WebApi.Stub.CustomWebApiService.ExecutBatch,LQKJ.WebApi.Stub.common.kdsvc";
list = HttpUtil.postForm(url, new HashMap<String, String>() {{
put("sql", finalContent);
}}, hreader);
System.out.println("list" + list);
} catch (Exception e) {
e.printStackTrace();
} finally {
log.put(content, list);//请求数据做key,返回做value
}
return log;
}
}
...@@ -11,30 +11,34 @@ import java.io.IOException; ...@@ -11,30 +11,34 @@ import java.io.IOException;
import java.util.*; import java.util.*;
/** /**
* @Description: 供应商重点原材料库存 * @Description: OA借款接口
*/ */
@Service @Service
public class QueryLoanDetailsApi implements API { public class LoanInterfaceApi implements API {
// private String url = "http://test.qywx.kingsware.cn/OA/erpBorrowAction.do/";//正式接口 // private String url = "http://test.qywx.kingsware.cn/OA/erpBorrowAction.do/";//正式接口
private String url = "https://b02ba329-ac3e-4144-a744-25abca96b290.mock.pstmn.io/"; private String url = "https://b02ba329-ac3e-4144-a744-25abca96b290.mock.pstmn.io/";
private List<Map<String, Object>> lists = new ArrayList<Map<String, Object>>(); private List<Map<String, Object>> lists = new ArrayList<Map<String, Object>>();
Map<String, String> hreader = new HashMap<>(); private Map<String, String> hreader = new HashMap<>();
public QueryLoanDetailsApi() { public LoanInterfaceApi() {
// hreader.put("Content-Type", "application/json"); // hreader.put("Content-Type", "application/json");
} }
@Override @Override
public String add(Map<String, String> map) { public String add(Map<String, String> map) {
return null; Map params = map;
String result = HttpUtils.getRequest(url + "/OA/erpBorrowAction.do", hreader, params);
return result;
} }
@Override @Override
public String select() { public String select() {
Map params = new HashMap(){{put("method","getBorrow");}}; Map params = new HashMap() {{
String result = HttpUtils.getRequest(url+"/OA/erpBorrowAction.do", hreader, params); put("method", "getBorrow");
}};
String result = HttpUtils.getRequest(url + "/OA/erpBorrowAction.do", hreader, params);
return result; return result;
} }
} }
package org.jeecg.modules.iost.API.controller;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.iost.API.entity.LQKJ_t_IMSSyncDetails;
import org.jeecg.modules.iost.API.service.ILQKJ_t_IMSSyncDetailsService;
import org.jeecg.modules.iost.API.vo.LQKJ_t_IMSSync;
import org.jeecg.modules.iost.API.webapi.LQKJ_t_IMSSyncDetailsWebapi;
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.RestController;
import com.alibaba.fastjson.JSON;
import java.io.IOException;
import java.text.ParseException;
import java.util.*;
@Api(tags = "")
@RestController
@RequestMapping("/API/test")
@Slf4j
public class ApiTestContrller {
@Autowired
private LQKJ_t_IMSSyncDetailsWebapi webapi;
@GetMapping("/s")
public Object tes() throws IOException, ParseException {
System.out.println(123456456);
Map<String, List<Map>> synchronization = webapi.synchronization(new HashMap(){{put("F_LQKJ_SyncCheck = ",0);}});
if (synchronization != null)
for (String key : synchronization.keySet()) {
List<Map> lists = synchronization.get(key);
List<LQKJ_t_IMSSyncDetails> SyncDetails=new ArrayList<>();
Map<String, String> fidMap = new IdentityHashMap<String, String>();
for (Map o : lists) {
if (o.containsKey("F_LQKJ_Syncbill"))//判断是否有字段
if (o.get("F_LQKJ_Syncbill").equals("ER_ExpenseRequest")) {//判断收费单
LQKJ_t_IMSSyncDetails lqkj_t_imsSync = JSON.parseObject(JSON.toJSONString(o), LQKJ_t_IMSSyncDetails.class).setCreatetime(new Date());
SyncDetails.add(lqkj_t_imsSync);//收费单保存到本地同步记录
fidMap.put("FID", "'" + o.get("FID") + "'");//修改同步状态拼接 in语句
continue;
}
}
System.out.println("lists.size() "+lists.size());
System.out.println("fidMap.size() "+fidMap.size());
// if (0<fidMap.size()) webapi.updateMap(fidMap);//修改同步状态
}
return synchronization;
}
}
package org.jeecg.modules.iost.API.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("LQKJ_t_IMSSync_Details")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "对象", description = "Ims同步记录")
public class LQKJ_t_IMSSyncDetails implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 实体主键:FID
* 同步记录数据内码:F_LQKJ_SyncDataId
* 同步记录表单:F_LQKJ_Syncbill
* 同步日期:F_LQKJ_SyndDatetime
* 创建人:FCreatorId
* 修改人:FModifierId
* 创建日期:FCreateDate
* 修改日期:FModifyDate
* 同步:F_LQKJ_SyncCheck
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String FID;//实体主键
@ApiModelProperty(value = "同步记录数据内码")
private String F_LQKJ_SyncDataId;//F_LQKJ_SyncDataId
@ApiModelProperty(value = "同步记录表单")
private String F_LQKJ_Syncbill;//F_LQKJ_Syncbill
@ApiModelProperty(value = "同步")
private Integer F_LQKJ_SyncCheck;//F_LQKJ_SyncCheck
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private Date createtime;
}
package org.jeecg.modules.iost.API.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* @Description: 借款废弃
* @Author: jeecg-boot
* @Date: 2021-07-09
* @Version: V1.0
*/
@Data
@TableName("")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "对象", description = "借款废弃信息-明细")
public class LoanDiscardDetails implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**同步到金蝶费用申请单后金蝶返回的实体主键
* 实体主键
*/
private String fid;
// /**同步到金蝶费用申请单后金蝶返回的单据编号
// *单据编号
// */
// private String fbillno ;
@ApiModelProperty(value = "工单号")
private String worknumber;
}
package org.jeecg.modules.iost.API.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.iost.API.entity.LQKJ_t_IMSSyncDetails;
public interface LQKJ_t_IMSSyncDetailsMapper extends BaseMapper<LQKJ_t_IMSSyncDetails> {
}
package org.jeecg.modules.iost.API.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.iost.API.entity.LoanDiscardDetails;
public interface LoanDiscardDetailsMapper extends BaseMapper<LoanDiscardDetails> {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.iost.API.mapper.LQKJ_t_IMSSyncDetailsMapper">
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.iost.API.mapper.LoanDiscardDetailsMapper">
</mapper>
\ No newline at end of file
package org.jeecg.modules.iost.API.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.iost.API.entity.LQKJ_t_IMSSyncDetails;
import java.io.IOException;
import java.text.ParseException;
import java.util.Map;
public interface ILQKJ_t_IMSSyncDetailsService extends IService<LQKJ_t_IMSSyncDetails> {
public Object synchronization() throws IOException, ParseException;
}
package org.jeecg.modules.iost.API.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.iost.API.entity.LoanDiscardDetails;
import java.io.IOException;
import java.text.ParseException;
import java.util.Map;
public interface ILoanDiscardDetailsService extends IService<LoanDiscardDetails> {
public Object synchronization(Map object) throws IOException, ParseException;
public Boolean manual(Map<String, Object> map, String ReturnProcessId) throws ParseException;
}
package org.jeecg.modules.iost.API.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.iost.API.entity.LQKJ_t_IMSSyncDetails;
import org.jeecg.modules.iost.API.mapper.LQKJ_t_IMSSyncDetailsMapper;
import org.jeecg.modules.iost.API.service.ILQKJ_t_IMSSyncDetailsService;
import org.jeecg.modules.iost.API.service.ILoanDiscardDetailsService;
import org.jeecg.modules.iost.API.vo.LQKJ_t_IMSSync;
import org.jeecg.modules.iost.API.webapi.LQKJ_t_IMSSyncDetailsWebapi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import java.io.IOException;
import java.text.ParseException;
import java.util.*;
@Service
public class LQKJ_t_IMSSyncDetailsServiceImpl extends ServiceImpl<LQKJ_t_IMSSyncDetailsMapper, LQKJ_t_IMSSyncDetails> implements ILQKJ_t_IMSSyncDetailsService {
@Autowired
private LQKJ_t_IMSSyncDetailsWebapi webapi;
//限制一百条
public Object synchronization() {
Map<String, List<Map>> synchronization = webapi.synchronization(new HashMap(){{put("F_LQKJ_SyncCheck = ",0);}});
if (synchronization != null)
for (String key : synchronization.keySet()) {
List<Map> lists = synchronization.get(key);
List<LQKJ_t_IMSSyncDetails> SyncDetails=new ArrayList<>();
Map<String, String> fidMap = new IdentityHashMap<String, String>();
for (Map o : lists) {
if (o.containsKey("F_LQKJ_Syncbill"))//判断是否有字段
if (o.get("F_LQKJ_Syncbill").equals("ER_ExpenseRequest")) {//判断收费单
LQKJ_t_IMSSyncDetails lqkj_t_imsSync = JSON.parseObject(JSON.toJSONString(o), LQKJ_t_IMSSyncDetails.class).setCreatetime(new Date());
SyncDetails.add(lqkj_t_imsSync);//收费单保存到本地同步记录
fidMap.put("FID", "'" + o.get("FID") + "'");//修改同步状态拼接 in语句
continue;
}
}
if (0<fidMap.size()) webapi.updateMap(fidMap);//修改同步状态
if (0<SyncDetails.size()) this.saveBatch(SyncDetails);//数据保存到本地用作同步
}
return synchronization;
}
}
package org.jeecg.modules.iost.API.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.iost.API.ExternalInterface.LoanInterfaceApi;
import org.jeecg.modules.iost.API.entity.LQKJ_t_IMSSyncDetails;
import org.jeecg.modules.iost.API.entity.LoanDiscardDetails;
import org.jeecg.modules.iost.API.mapper.LoanDiscardDetailsMapper;
import org.jeecg.modules.iost.API.service.ILQKJ_t_IMSSyncDetailsService;
import org.jeecg.modules.iost.API.service.ILoanDiscardDetailsService;
import org.jeecg.modules.iost.API.webapi.LQKJ_t_IMSSyncDetailsWebapi;
import org.jeecg.modules.iost.API.webapi.LoanInterfaceWebapi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.text.ParseException;
import java.util.*;
@Service
public class LoanDiscardDetailsServiceImpl extends ServiceImpl<LoanDiscardDetailsMapper, LoanDiscardDetails> implements ILoanDiscardDetailsService {
@Autowired
private LoanInterfaceWebapi loanInterfaceWebapi;
@Autowired
private LoanInterfaceApi loanInterfaceApi;
@Autowired
private ILQKJ_t_IMSSyncDetailsService t_imsSyncDetailsService;
public void getExpenseRequest() throws IOException, ParseException {
QueryWrapper<LQKJ_t_IMSSyncDetails> queryWrapper = new QueryWrapper<LQKJ_t_IMSSyncDetails>();
queryWrapper.eq("F_LQKJ_Syncbill", "ER_ExpenseRequest").and(wq -> wq.eq("F_LQKJ_SyncCheck", 0));//get本地记录筛选收费单,未同步
List<LQKJ_t_IMSSyncDetails> lqkj_t_imsSyncDetails = t_imsSyncDetailsService.getBaseMapper().selectList(queryWrapper);
List<LQKJ_t_IMSSyncDetails> SyncDetails=new ArrayList<>();
Map<String, String> fidMap = new IdentityHashMap<String, String>();
for (LQKJ_t_IMSSyncDetails lqkj_t_imsSyncDetail : lqkj_t_imsSyncDetails) {//遍历同步
String f_lqkj_syncDataId = lqkj_t_imsSyncDetail.getF_LQKJ_SyncDataId();//获取未同步收费单的fid
SyncDetails.add(lqkj_t_imsSyncDetail.setF_LQKJ_SyncCheck(1));//设置同步状态为已同步
fidMap.put(new String("FID"), "'"+f_lqkj_syncDataId+"'");//允许同key的map做in语句
}
t_imsSyncDetailsService.updateBatchById(SyncDetails);//更新收费单同步状态
Object synchronization = synchronization(fidMap);
}
@Override
public Object synchronization(Map object){
Map<String, List<Map>> synchronization = null;
if (0<object.size()) {
synchronization = loanInterfaceWebapi.synchronization(object);
}
if (null !=synchronization)
for (String key : synchronization.keySet()) {
List<Map> lists = synchronization.get(key);
for (Map list : lists) {
if (list.get("FCancelStatus").toString().equals("B")) {//判断废弃状态 -已废弃
Map params = new LinkedHashMap() {{
put("method", "discardWorknumber");
put("worknumber", list.get("FBillNo"));
}};
String select = loanInterfaceApi.add(params);
continue;
}
if (list.get("FDocumentStatus").toString().equals("C")) {//判断付款状态 -已付款
Map params = new LinkedHashMap() {{
put("method", "paymentStatus");
put("worknumber", list.get("FBillNo").toString());
put("status", "已付款");
}};
String select = loanInterfaceApi.add(params);
}
}
}
return synchronization;
}
@Override
public Boolean manual(Map<String, Object> map, String ReturnProcessId) throws ParseException {
return null;
}
}
...@@ -5,9 +5,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -5,9 +5,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.iost.API.entity.kingdeejournal.KingdeeSelectJournal; import org.jeecg.modules.iost.API.entity.kingdeejournal.KingdeeSelectJournal;
import org.jeecg.modules.iost.API.mapper.kingdeejournal.KingdeeSelectJournalMapper; import org.jeecg.modules.iost.API.mapper.kingdeejournal.KingdeeSelectJournalMapper;
import org.jeecg.modules.iost.API.service.kingdeejournal.IKingdeeSelectJournalService; import org.jeecg.modules.iost.API.service.kingdeejournal.IKingdeeSelectJournalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class KingdeeSelectJournalServiceImpl extends ServiceImpl<KingdeeSelectJournalMapper, KingdeeSelectJournal> implements IKingdeeSelectJournalService { public class KingdeeSelectJournalServiceImpl extends ServiceImpl<KingdeeSelectJournalMapper, KingdeeSelectJournal> implements IKingdeeSelectJournalService {
} }
package org.jeecg.modules.iost.API.vo;
import lombok.Data;
@Data
public class LQKJ_t_IMSSync {
/**
* 实体主键:FID
* 同步记录数据内码:F_LQKJ_SyncDataId
* 同步记录表单:F_LQKJ_Syncbill
* 同步日期:F_LQKJ_SyndDatetime
* 创建人:FCreatorId
* 修改人:FModifierId
* 创建日期:FCreateDate
* 修改日期:FModifyDate
* 同步:F_LQKJ_SyncCheck
*/
private String FID;//实体主键
private String F_LQKJ_SyncDataId;//F_LQKJ_SyncDataId
private String F_LQKJ_Syncbill;//F_LQKJ_Syncbill
private String F_LQKJ_SyncCheck;//F_LQKJ_SyncCheck
}
package org.jeecg.modules.iost.API.webapi;
import org.jeecg.modules.iost.API.Dao.CategoryDao;
import org.jeecg.modules.iost.API.Dao.CategoryDaoSql;
import org.jeecg.modules.iost.API.webapi.Interface.web_api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.text.ParseException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@Component
public class LQKJ_t_IMSSyncDetailsWebapi implements web_api {
/**
* 操作的单据体名称
* ims同步记录
*/
private String sFormId = "LQKJ_IMSSync";
private String sFormId_t = "LQKJ_t_IMSSync";
private Map<String, String> key = new LinkedHashMap<>();
@Autowired
private CategoryDao categoryDao;
@Autowired
private CategoryDaoSql categoryDaoSql;
/**
* 实体主键:FID
* 同步记录数据内码:F_LQKJ_SyncDataId
* 同步记录表单:F_LQKJ_Syncbill
* 同步日期:F_LQKJ_SyndDatetime
* 创建人:FCreatorId
* 修改人:FModifierId
* 创建日期:FCreateDate
* 修改日期:FModifyDate
* 同步:F_LQKJ_SyncCheck
*/
public LQKJ_t_IMSSyncDetailsWebapi() {
key.put("FID", "FID");//实体主键0
key.put("F_LQKJ_SyncDataId", "F_LQKJ_SyncDataId");//同步记录数据内码1
key.put("F_LQKJ_Syncbill", "F_LQKJ_Syncbill");//同步记录表单2
key.put("F_LQKJ_SyncCheck", "F_LQKJ_SyncCheck");//同步3 否为0 ,是为1
}
@Override
public String add(Object object) {
return null;
}
@Override
public List<Map<String, String>> select(Map<String, String> map, String where) throws ParseException {
return null;
}
@Override
public String update(Object object) { return null; }
public Map<String, List<Object>> updateMap(Map where) {
Map<String, String> set = new LinkedHashMap(){{put("F_LQKJ_SyncCheck","1");}};
Map<String, List<Object>> map = categoryDaoSql.updateInMap(sFormId_t, set, where);
return map;
}
public Map<String, List<List<Object>>> synchronization(String where) {//手动同步用
Map<String, List<List<Object>>> stringListMap = categoryDao.selectMapWhereString(sFormId, key, where);
return stringListMap;
}
public Map<String, List<Map>> synchronization(Map where) {//自动同步用
// Map<String, List<List<Object>>> stringListMap = categoryDaoSql.selectInMap(sFormId_t, key, where);
Map<String, List<Map>> stringListMap = categoryDaoSql.selectInMap(sFormId_t, key, where);
return stringListMap;
}
}
package org.jeecg.modules.iost.API.webapi; package org.jeecg.modules.iost.API.webapi;
import org.jeecg.modules.iost.API.Dao.CategoryDao; import org.jeecg.modules.iost.API.Dao.CategoryDao;
import org.jeecg.modules.iost.API.Dao.CategoryDaoSql;
import org.jeecg.modules.iost.API.Util.JsonUtil; import org.jeecg.modules.iost.API.Util.JsonUtil;
import org.jeecg.modules.iost.API.webapi.Interface.web_api; import org.jeecg.modules.iost.API.webapi.Interface.web_api;
import org.jeecg.modules.iost.API.webapi.Util.FieldConversion; import org.jeecg.modules.iost.API.webapi.Util.FieldConversion;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* @Description: 采购订单 * @Description: 采购订单
*/ */
public class QueryLoanDetailsrWebapi implements web_api { @Component
public class LoanInterfaceWebapi implements web_api {
/** /**
* 操作的单据体名称 * 操作的单据体名称
* 费用申请单 * 费用申请单
* */ */
private String sFormId = "ER_ExpenseRequest"; private String sFormId = "ER_ExpenseRequest";
private String sFormId_t = "T_ER_ExpenseRequest";
private Map<String, String> key = new LinkedHashMap<>();
@Autowired @Autowired
private CategoryDao categoryDao; private CategoryDao categoryDao;
@Autowired
private CategoryDaoSql categoryDaoSql;
LoanInterfaceWebapi() {
key.put("FID", "FID");//实体主键0
key.put("FBillNo","FBillNo");//单据编号1 -worknumber
key.put("FDocumentStatus","FDocumentStatus");//单据状态2
key.put("FCancelStatus","FCancelStatus");//作废状态 3
}
@Override @Override
public String add(Object object) { public String add(Object object) {
String json = categoryDao.add(sFormId, JsonUtil.Objectjson(object));
return json; return null;
} }
@Override @Override
public List<Map<String,String>>select(Map<String,String> map,String where) { public List<Map<String, String>> select(Map<String, String> map, String where) {
return null; return null;
} }
...@@ -36,4 +51,14 @@ public class QueryLoanDetailsrWebapi implements web_api { ...@@ -36,4 +51,14 @@ public class QueryLoanDetailsrWebapi implements web_api {
public String update(Object object) { public String update(Object object) {
return null; return null;
} }
public Map<String, List<List<Object>>> synchronization(String where) {//手动同步用
Map<String, List<List<Object>>> stringListMap = categoryDao.selectMapWhereString(sFormId, key, where);
return stringListMap;
}
public Map<String, List<Map>> synchronization(Map where) {//自动同步用
Map<String, List<Map>> stringListMap = categoryDaoSql.selectMapIn(sFormId_t, key, where);
return stringListMap;
}
} }
package org.jeecg.modules.iost.API.webapi.Util;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component
public class ConditionalSplicing {
public String selectInList(String sFormId, List<String> lists, Map<String, String> where) {
String content = null;//请求
if (where != null) {
content = "{\"FormId\":\"" + sFormId + "\"," + StringkeyByList(lists) + StringWhereCompare(where) + "}";
} else {
content = "{\"FormId\":\"" + sFormId + "\"," + StringkeyByList(lists) + "}";
}
return content;
}
private String Stringwhere(Map<String,String> map){
String where = null;
for (String key : map.keySet()) {
String value = String.valueOf(map.get(key));
if(value!=null && value!="") {
if (where!=null){
where = where + " AND " + key + "=" + value;
}else {
where = key + "='" + value+"'";
}
}
}
if (where!=null){
return ",\"FilterString\":\""+where+"\"";
}
return "";
}
private String Stringkey(Map<String,String> map){
String Keys = null;
for (String key : map.keySet()) {
String value = String.valueOf(map.get(key));
if(value!=null && value!="") {
if (Keys!=null){
Keys = Keys + " , " + key ;
}else {
Keys = key;
}
}
}
if (Keys!=null){
return "\"FieldKeys\":\""+Keys+"\"";
}
return "";
}
public static String StringWhereCompare(Map<String,String> map) {
String where = null;
for (String key : map.keySet()) {
String value = String.valueOf(map.get(key));
if(value!=null && value!="") {
if (where!=null){
where = where + " AND " + key + value;
}else {
where = key + "'" + value+"'";
}
}
}
if (where!=null){
return ",\"FilterString\":\""+where+"\"";
}
return "";
}
private String StringkeyByList(List<String> list) {
String Keys = null;
for (String key : list) {
String value = String.valueOf(key);
if (value != null && value != "") {
if (Keys != null) {
Keys = Keys + " , " + key;
} else {
Keys = key;
}
}
}
if (Keys != null) {
return "\"FieldKeys\":\"" + Keys + "\"";
}
return "";
}
}
...@@ -4,25 +4,26 @@ package org.jeecg; ...@@ -4,25 +4,26 @@ package org.jeecg;
import kingdee.bos.webapi.client.K3CloudApiClient; import kingdee.bos.webapi.client.K3CloudApiClient;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import lombok.val;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.jeecg.common.util.security.SecurityTools; import org.jeecg.common.util.security.SecurityTools;
import org.jeecg.common.util.security.entity.*; import org.jeecg.common.util.security.entity.*;
import org.jeecg.modules.iost.API.ExternalInterface.QueryLoanDetailsApi; import org.jeecg.modules.iost.API.ExternalInterface.LoanInterfaceApi;
import org.jeecg.modules.iost.API.Util.HttpUtils; import org.jeecg.modules.iost.API.Util.HttpUtils;
import org.jeecg.modules.iost.API.vo.OaRequest; import org.jeecg.modules.iost.API.vo.OaRequest;
import org.jeecg.modules.iost.API.webapi.LQKJ_t_IMSSyncDetailsWebapi;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
@Slf4j @Slf4j
@EnableScheduling @EnableScheduling
public class SecurityToolsTest { public class SecurityToolsTest {
static String K3CloudURL = "http://192.168.2.243/k3cloud/";//指定地址 static String K3CloudURL = "http://192.168.2.243/k3cloud/";//指定地址
static String dbId = "608102e4df263c"; static String dbId = "6136b7c51f0e4f";
static String uid = "Administrator"; static String uid = "Administrator";
static String pwd = "888888"; static String pwd = "888888";
static int lang = 2052; static int lang = 2052;
...@@ -91,12 +92,12 @@ public class SecurityToolsTest { ...@@ -91,12 +92,12 @@ public class SecurityToolsTest {
public void S() { public void S() {
Random r = new Random(); Random r = new Random();
// 第一种方法 // 第一种方法
// int num = (int) (Math.random() * 5 + 1); // int num = (int) (Math.random() * 5 + 1);
// System.out.println("num:" + num); // System.out.println("num:" + num);
// 第二种方法 // 第二种方法
int a = r.nextInt(5) + 1; int a = r.nextInt(5) + 1;
System.out.println("a:" + a); System.out.println("a:" + a);
} }
...@@ -108,23 +109,21 @@ public class SecurityToolsTest { ...@@ -108,23 +109,21 @@ public class SecurityToolsTest {
public void timed() { public void timed() {
String servicenameTable="LQKJ.WebApi.Stub.CustomWebApiService.ExecutDataSet,LQKJ.WebApi.Stub"; String servicenameTable="LQKJ.WebApi.Stub.CustomWebApiService.ExecutDataSet,LQKJ.WebApi.Stub";
String servicenameMap="LQKJ.WebApi.Stub.CustomWebApiService.ExecuteDynamicObject,LQKJ.WebApi.Stub"; String servicenameMap="LQKJ.WebApi.Stub.CustomWebApiService.ExecuteDynamicObject,LQKJ.WebApi.Stub";
String sFormId = "PRD_INSTOCK";
log.info("123"); log.info("123");
List<List<Object>> list = null; List<List<Object>> list = null;
try { try {
Boolean result = client.login(dbId, uid, pwd, lang); Boolean result = client.login(dbId, uid, pwd, lang);
if(result){ if(result){
String content; String sql="SELECT * FROM LQKJ_t_IMSSync where F_LQKJ_SyncCheck = 1;";
System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()));
String format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").format(new Date());
// FBILLNO,FDATE,FMaterialId,FDESCRIPTION,FCreateDate,FApproveDate,FID
String sql="SELECT * FROM T_PRD_INSTOCKENTRY;";
System.out.println(sql); System.out.println(sql);
String[] strings = new String[]{sql}; String[] strings = new String[]{sql};
Object execute = client.execute(servicenameMap, strings, Object.class); List<Map> execute = client.execute(servicenameMap, strings, List.class);
for (Map o : execute) {
System.out.println(o.get("F_LQKJ_SYNCCHECK"));
}
System.out.println();
System.out.println(execute);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -133,11 +132,48 @@ public class SecurityToolsTest { ...@@ -133,11 +132,48 @@ public class SecurityToolsTest {
@Test @Test
// @Scheduled(fixedDelay = 5000) // @Scheduled(fixedDelay = 5000)
public void timdsaded() { public void timdsaded() {
QueryLoanDetailsApi queryLoanDetailsApi = new QueryLoanDetailsApi(); LoanInterfaceApi queryLoanDetailsApi = new LoanInterfaceApi();
String select = queryLoanDetailsApi.select(); String select = queryLoanDetailsApi.add(null);
System.out.println(select); System.out.println(select);
OaRequest<List> listOaRequest = com.alibaba.fastjson.JSONObject.parseObject(select, OaRequest.class); OaRequest<List<Map>> listOaRequest = com.alibaba.fastjson.JSONObject.parseObject(select, OaRequest.class);
List<Map> result = listOaRequest.getResult();
System.out.println(listOaRequest); System.out.println(listOaRequest);
System.out.println(result.get(0).size());
} }
@Autowired
private LQKJ_t_IMSSyncDetailsWebapi webapi;
@Test
// @Scheduled(fixedDelay = 5000)
public void sadsad() {
Map<String, String> fid = new IdentityHashMap<String, String>();
for (int i1 = 0; i1 < 10; i1++) {
fid.put(new String("fid"), String.valueOf(i1));
}
if (0<fid.size()) {
Map Obj=fid;
String s = StringCompareIn(Obj);
System.out.println(s);
}
}
// fid in ('0fb6a3a7-9c09-4720-820e-8c64618b7cbe','16cde038-2101-4eea-a05c-78becc60f0a9')
private String StringCompareIn(Map<String, String> map) {
String where = null;
for (String key : map.keySet()) {
String value = String.valueOf(map.get(key));
if (value != null && value != "") {
if (where != null) {
where = where + "," + value;
} else {
where = key + " in (" + value + "";
}
}
}
if (where != null) {
return " where " + where + ")";
}
return "";
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论