提交 615ed935 authored 作者: 李炎's avatar 李炎

完成1废弃2付款接口

上级 ec771d38
...@@ -99,14 +99,14 @@ public class Swagger2Config implements WebMvcConfigurer { ...@@ -99,14 +99,14 @@ public class Swagger2Config implements WebMvcConfigurer {
private ApiInfo apiInfo() { private ApiInfo apiInfo() {
return new ApiInfoBuilder() return new ApiInfoBuilder()
// //大标题 // //大标题
.title("Jeecg-Boot 后台服务API接口文档") .title("后台服务API接口文档")
// 版本号 // 版本号
.version("1.0") .version("1.0")
// .termsOfServiceUrl("NO terms of service") // .termsOfServiceUrl("NO terms of service")
// 描述 // 描述
.description("后台API接口") .description("后台API接口")
// 作者 // 作者
.contact("JEECG团队") // .contact("JEECG团队")
.license("The Apache License, Version 2.0") .license("The Apache License, Version 2.0")
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html") .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
.build(); .build();
......
...@@ -76,11 +76,11 @@ ...@@ -76,11 +76,11 @@
<artifactId>fastjson</artifactId> <artifactId>fastjson</artifactId>
<version>1.2.47</version> <version>1.2.47</version>
</dependency> </dependency>
<dependency> <!--<dependency>-->
<groupId>org.apache.httpcomponents</groupId> <!--<groupId>org.apache.httpcomponents</groupId>-->
<artifactId>httpmime</artifactId> <!--<artifactId>httpmime</artifactId>-->
<version>4.1.1</version> <!--<version>4.1.1</version>-->
</dependency> <!--</dependency>-->
</dependencies> </dependencies>
<build> <build>
......
...@@ -12,12 +12,14 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer ...@@ -12,12 +12,14 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
@Slf4j @Slf4j
@SpringBootApplication @SpringBootApplication
@EnableAsync//开启异步
public class JeecgSystemApplication extends SpringBootServletInitializer { public class JeecgSystemApplication extends SpringBootServletInitializer {
@Override @Override
......
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.stereotype.Component;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description: OA借款接口
*/
@Component
public class BusinessTripInterfaceApi implements API {
// private String url = "http://test.qywx.kingsware.cn";//正式接口
private String url = "https://b02ba329-ac3e-4144-a744-25abca96b290.mock.pstmn.io/";
private List<Map<String, Object>> lists = new ArrayList<Map<String, Object>>();
private Map<String, String> hreader = new HashMap<>();
public BusinessTripInterfaceApi() {
// hreader.put("Content-Type", "application/json");
}
@Override
public String add(Map<String, String> map) {
Map params = map;
String result = HttpUtils.getRequest(url + "/OA/erpTravelAction.do", hreader, params);
return result;
}
@Override
public String select() {
Map params = new HashMap() {{
put("method", "getTravel");
}};
String result = HttpUtils.getRequest(url + "/OA/erpTravelAction.do", hreader, params);
return result;
}
}
...@@ -5,6 +5,7 @@ import org.jeecg.modules.iost.API.ExternalInterface.Interface.API; ...@@ -5,6 +5,7 @@ import org.jeecg.modules.iost.API.ExternalInterface.Interface.API;
import org.jeecg.modules.iost.API.Util.HttpUtil; import org.jeecg.modules.iost.API.Util.HttpUtil;
import org.jeecg.modules.iost.API.Util.HttpUtils; import org.jeecg.modules.iost.API.Util.HttpUtils;
import org.jeecg.modules.iost.API.Util.JsonUtil; import org.jeecg.modules.iost.API.Util.JsonUtil;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.IOException; import java.io.IOException;
...@@ -13,10 +14,10 @@ import java.util.*; ...@@ -13,10 +14,10 @@ import java.util.*;
/** /**
* @Description: OA借款接口 * @Description: OA借款接口
*/ */
@Service @Component
public class LoanInterfaceApi 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";//正式接口
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>>();
......
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.stereotype.Component;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description: OA其他报销接口
*/
@Component
public class OtherReimbursementInterfaceApi implements API {
// private String url = "http://test.qywx.kingsware.cn";//正式接口
private String url = "https://b02ba329-ac3e-4144-a744-25abca96b290.mock.pstmn.io/";
private List<Map<String, Object>> lists = new ArrayList<Map<String, Object>>();
private Map<String, String> hreader = new HashMap<>();
public OtherReimbursementInterfaceApi() {
// hreader.put("Content-Type", "application/json");
}
@Override
public String add(Map<String, String> map) {
Map params = map;
String result = HttpUtils.getRequest(url + "/OA/otherExpensesAction.do", hreader, params);
return result;
}
@Override
public String select() {
Map params = new HashMap() {{
put("method", "OtherExpenses_Query");
}};
String result = HttpUtils.getRequest(url + "/OA/otherExpensesAction.doo", hreader, params);
return result;
}
}
...@@ -24,7 +24,7 @@ public class ApiTestContrller { ...@@ -24,7 +24,7 @@ public class ApiTestContrller {
@Autowired @Autowired
private LQKJ_t_IMSSyncDetailsWebapi webapi; private LQKJ_t_IMSSyncDetailsWebapi webapi;
@GetMapping("/s") @GetMapping("/OA/erpBorrowAction.do")
public Object tes() throws IOException, ParseException { public Object tes() throws IOException, ParseException {
System.out.println(123456456); System.out.println(123456456);
Map<String, List<Map>> synchronization = webapi.synchronization(new HashMap(){{put("F_LQKJ_SyncCheck = ",0);}}); Map<String, List<Map>> synchronization = webapi.synchronization(new HashMap(){{put("F_LQKJ_SyncCheck = ",0);}});
......
package org.jeecg.modules.iost.API.dto;
import java.util.HashMap;
import java.util.Map;
public class OABusiness {
public static final Map<Integer, String> entity = new HashMap<Integer, String>() {{
put(1, "同步借款");
put(2, "金蝶借款");
put(3, "借款废弃");
put(4, "借款付款");
put(5, "同步差旅");
put(6, "金蝶差旅");
put(7, "差旅废弃");
put(8, "差旅付款");
put(9, "同步其他报销");
put(10, "金蝶其他报销");
put(11, "其他报销废弃");
put(12, "其他报销付款");
}};
public static String getBusiness(Integer id) {
return entity.get(id);
}
}
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 BusinessTripDetails implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**同步到金蝶费用申请单后金蝶返回的实体主键
* 实体主键
*/
private String fid;
// /**同步到金蝶费用申请单后金蝶返回的单据编号
// *单据编号fbillno
// */
@ApiModelProperty(value = "工单号")
private String worknumber;
}
...@@ -12,7 +12,7 @@ import lombok.experimental.Accessors; ...@@ -12,7 +12,7 @@ import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
/** /**
* @Description: 借款废弃 * @Description: 借款
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2021-07-09 * @Date: 2021-07-09
* @Version: V1.0 * @Version: V1.0
...@@ -21,7 +21,7 @@ import java.io.Serializable; ...@@ -21,7 +21,7 @@ import java.io.Serializable;
@TableName("") @TableName("")
@Accessors(chain = true) @Accessors(chain = true)
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@ApiModel(value = "对象", description = "借款废弃信息-明细") @ApiModel(value = "对象", description = "借款信息")
public class LoanDiscardDetails implements Serializable { public class LoanDiscardDetails implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
......
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 OtherReimbursementDetails 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;
}
...@@ -16,7 +16,7 @@ import java.io.Serializable; ...@@ -16,7 +16,7 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* @Description: 实物ID信息明细 * @Description: 查询借款信息明细
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2021-07-09 * @Date: 2021-07-09
* @Version: V1.0 * @Version: V1.0
......
...@@ -21,11 +21,11 @@ import java.util.Date; ...@@ -21,11 +21,11 @@ import java.util.Date;
* @Version: V1.0 * @Version: V1.0
*/ */
@Data @Data
@TableName("") @TableName("oa_select_journal")
@Accessors(chain = true) @Accessors(chain = true)
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@ApiModel(value="对象", description="传入到OA-日志") @ApiModel(value="对象", description="查询到OA-日志")
public class OaSaveJournal implements Serializable { public class OaSelectJournal implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**主键*/ /**主键*/
@TableId(type = IdType.ASSIGN_ID) @TableId(type = IdType.ASSIGN_ID)
...@@ -43,7 +43,7 @@ public class OaSaveJournal implements Serializable { ...@@ -43,7 +43,7 @@ public class OaSaveJournal implements Serializable {
//传入OA数据 //传入OA数据
private String requestjson; private String requestjson;
//OA响应数据 //OA响应数据
private String responsejson; private String result;
/**数据同步:失败:0,成功:1*/ /**数据同步:失败:0,成功:1*/
private Integer synchronization; private Integer synchronization;
/** /**
......
...@@ -15,16 +15,16 @@ import java.io.Serializable; ...@@ -15,16 +15,16 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* @Description: 国网日志 * @Description: 传入OA-日志,用作更新
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2021-07-14 * @Date: 2021-09-24
* @Version: V1.0 * @Version: V1.0
*/ */
@Data @Data
@TableName("oa_update_journal") @TableName("oa_update_journal")
@Accessors(chain = true) @Accessors(chain = true)
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@ApiModel(value="对象", description="查询OA-日志") @ApiModel(value="对象", description="传入OA-日志")
public class OaUpdateJournal implements Serializable { public class OaUpdateJournal implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**主键*/ /**主键*/
...@@ -35,15 +35,15 @@ public class OaUpdateJournal implements Serializable { ...@@ -35,15 +35,15 @@ public class OaUpdateJournal implements Serializable {
private String code; private String code;
/**返回信息*/ /**返回信息*/
private String message; private String message;
//传入OA数据
private String requestjson;
//OA响应数据
private String result;
/**创建日期*/ /**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期") @ApiModelProperty(value = "创建日期")
private Date createtime; private Date createtime;
//传入OA数据
private String requestjson;
//OA响应数据
private String responsejson;
/**数据同步:失败:0,成功:1*/ /**数据同步:失败:0,成功:1*/
private Integer synchronization; private Integer synchronization;
/** /**
......
package org.jeecg.modules.iost.API.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.iost.API.entity.BusinessTripDetails;
public interface BusinessTripDetailsMapper extends BaseMapper<BusinessTripDetails> {
}
package org.jeecg.modules.iost.API.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.iost.API.entity.OtherReimbursementDetails;
public interface OtherReimbursementDetailsMapper extends BaseMapper<OtherReimbursementDetails> {
}
package org.jeecg.modules.iost.API.mapper.oajournal;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.iost.API.entity.oajournal.OaUpdateJournal;
public interface OaUpdateJournalMapper extends BaseMapper<OaUpdateJournal> {
}
<?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.oajournal.OaUpdateJournalMapper">
</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.BusinessTripDetailsMapper">
</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.OtherReimbursementDetailsMapper">
</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.BusinessTripDetails;
import java.io.IOException;
import java.text.ParseException;
import java.util.Map;
public interface IBusinessTripDetailsService extends IService<BusinessTripDetails> {
public void SyncStart() throws IOException, ParseException;
public Object synchronization(Map object) throws IOException, ParseException;
public Boolean manual(Map<String, Object> map, String ReturnProcessId) throws ParseException;
}
...@@ -8,6 +8,8 @@ import java.text.ParseException; ...@@ -8,6 +8,8 @@ import java.text.ParseException;
import java.util.Map; import java.util.Map;
public interface ILoanDiscardDetailsService extends IService<LoanDiscardDetails> { public interface ILoanDiscardDetailsService extends IService<LoanDiscardDetails> {
public void SyncStart();
public Object synchronization(Map object) throws IOException, ParseException; public Object synchronization(Map object) throws IOException, ParseException;
public Boolean manual(Map<String, Object> map, String ReturnProcessId) throws ParseException; public Boolean manual(Map<String, Object> map, String ReturnProcessId) throws ParseException;
......
package org.jeecg.modules.iost.API.service;
import org.jeecg.modules.iost.API.entity.OtherReimbursementDetails;
import java.io.IOException;
import java.text.ParseException;
import java.util.Map;
public interface IOtherReimbursementDetailsService extends com.baomidou.mybatisplus.extension.service.IService<OtherReimbursementDetails> {
public void SyncStart() throws IOException, ParseException;
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.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.iost.API.ExternalInterface.BusinessTripInterfaceApi;
import org.jeecg.modules.iost.API.entity.BusinessTripDetails;
import org.jeecg.modules.iost.API.entity.LQKJ_t_IMSSyncDetails;
import org.jeecg.modules.iost.API.mapper.BusinessTripDetailsMapper;
import org.jeecg.modules.iost.API.service.IBusinessTripDetailsService;
import org.jeecg.modules.iost.API.service.ILQKJ_t_IMSSyncDetailsService;
import org.jeecg.modules.iost.API.service.kingdeejournal.IKingdeeSelectJournalService;
import org.jeecg.modules.iost.API.service.oajournal.IOaUpdateJournalService;
import org.jeecg.modules.iost.API.webapi.BusinessTripInterfaceWebapi;
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 BusinessTripDetailsServiceImpl extends ServiceImpl<BusinessTripDetailsMapper, BusinessTripDetails> implements IBusinessTripDetailsService {
@Autowired
private BusinessTripInterfaceWebapi businessTripWebapi;
@Autowired
private BusinessTripInterfaceApi businessTripInterfaceApi;
@Autowired
private IKingdeeSelectJournalService kingdeeSelectJournalService;
@Autowired
private IOaUpdateJournalService oaUpdateJournalService;
@Autowired
private ILQKJ_t_IMSSyncDetailsService t_imsSyncDetailsService;
@Override
public void SyncStart() throws IOException, ParseException {
QueryWrapper<LQKJ_t_IMSSyncDetails> queryWrapper = new QueryWrapper<LQKJ_t_IMSSyncDetails>();
queryWrapper.eq("F_LQKJ_Syncbill", "ER_ExpReimbursement_Travel").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) throws IOException, ParseException {
Map<String, List<Map>> synchronization = null;
if (0 < object.size()) {
synchronization = businessTripWebapi.synchronization(object);
}
if (null != synchronization)
for (String key : synchronization.keySet()) {
List<Map> lists = synchronization.get(key);
if (null != lists)
for (Map list : lists) {
if (list.get("FCancelStatus").toString().equals("B")) {//判断废弃状态 -已废弃
Map params = new LinkedHashMap() {{
put("method", "discardWorknumber");
put("worknumber", list.get("FBillNo").toString());
}};
String select = businessTripInterfaceApi.add(params);
oaUpdateJournalService.setOaUpdateJournal(key, select, 7);
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 = businessTripInterfaceApi.add(params);
oaUpdateJournalService.setOaUpdateJournal(key, select, 8);
}
}
String kingdeeRequest = key;
Integer BusinessNo = 6;
List<Map> kingdeeResponse = lists;
kingdeeSelectJournalService.setKingdeeSelect(kingdeeRequest, kingdeeResponse, BusinessNo);
continue;
}
return synchronization;
}
@Override
public Boolean manual(Map<String, Object> map, String ReturnProcessId) throws ParseException {
return null;
}
}
...@@ -22,25 +22,42 @@ public class LQKJ_t_IMSSyncDetailsServiceImpl extends ServiceImpl<LQKJ_t_IMSSync ...@@ -22,25 +22,42 @@ public class LQKJ_t_IMSSyncDetailsServiceImpl extends ServiceImpl<LQKJ_t_IMSSync
@Autowired @Autowired
private LQKJ_t_IMSSyncDetailsWebapi webapi; private LQKJ_t_IMSSyncDetailsWebapi webapi;
//限制一百条 //限制一百条
public Object synchronization() { public Object synchronization() {
Map<String, List<Map>> synchronization = webapi.synchronization(new HashMap(){{put("F_LQKJ_SyncCheck = ",0);}}); Map<String, List<Map>> synchronization = webapi.synchronization(new HashMap() {{
put("F_LQKJ_SyncCheck = ", 0);
}});
if (synchronization != null) if (synchronization != null)
for (String key : synchronization.keySet()) { for (String key : synchronization.keySet()) {
List<Map> lists = synchronization.get(key); List<Map> lists = synchronization.get(key);
List<LQKJ_t_IMSSyncDetails> SyncDetails=new ArrayList<>(); List<LQKJ_t_IMSSyncDetails> SyncDetails = new ArrayList<>();
Map<String, String> fidMap = new IdentityHashMap<String, String>(); Map<String, String> fidMap = new IdentityHashMap<String, String>();
for (Map o : lists) { for (Map o : lists) {
if (o.containsKey("F_LQKJ_Syncbill"))//判断是否有字段 if (o.containsKey("F_LQKJ_Syncbill"))//判断是否有字段
if (o.get("F_LQKJ_Syncbill").equals("ER_ExpenseRequest")) {//判断收费单 if ("ER_ExpenseRequest".equals(o.get("F_LQKJ_Syncbill"))) {//判断收费单
LQKJ_t_IMSSyncDetails lqkj_t_imsSync = JSON.parseObject(JSON.toJSONString(o), LQKJ_t_IMSSyncDetails.class).setCreatetime(new Date()); LQKJ_t_IMSSyncDetails lqkj_t_imsSync = JSON.parseObject(JSON.toJSONString(o), LQKJ_t_IMSSyncDetails.class).setCreatetime(new Date());
SyncDetails.add(lqkj_t_imsSync);//收费单保存到本地同步记录 SyncDetails.add(lqkj_t_imsSync);//收费单保存到本地同步记录
fidMap.put("FID", "'" + o.get("FID") + "'");//修改同步状态拼接 in语句 fidMap.put("FID", "'" + o.get("FID") + "'");//修改同步状态拼接 in语句
continue; continue;
} }
if ("ER_ExpReimbursement_Travel".equals(o.get("F_LQKJ_Syncbill"))) {//判断差旅费用报销单
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 ("ER_ExpReimbursement".equals(o.get("F_LQKJ_Syncbill"))) {//判断费用报销单
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);//数据保存到本地用作同步
if (0<SyncDetails.size()) this.saveBatch(SyncDetails);//数据保存到本地用作同步 if (0 < fidMap.size()) webapi.updateMap(fidMap);//修改同步状态
} }
return synchronization; return synchronization;
} }
......
...@@ -3,11 +3,14 @@ package org.jeecg.modules.iost.API.service.impl; ...@@ -3,11 +3,14 @@ package org.jeecg.modules.iost.API.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.iost.API.ExternalInterface.LoanInterfaceApi; import org.jeecg.modules.iost.API.ExternalInterface.LoanInterfaceApi;
import org.jeecg.modules.iost.API.Util.JsonUtil;
import org.jeecg.modules.iost.API.entity.LQKJ_t_IMSSyncDetails; import org.jeecg.modules.iost.API.entity.LQKJ_t_IMSSyncDetails;
import org.jeecg.modules.iost.API.entity.LoanDiscardDetails; import org.jeecg.modules.iost.API.entity.LoanDiscardDetails;
import org.jeecg.modules.iost.API.mapper.LoanDiscardDetailsMapper; 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.ILQKJ_t_IMSSyncDetailsService;
import org.jeecg.modules.iost.API.service.ILoanDiscardDetailsService; import org.jeecg.modules.iost.API.service.ILoanDiscardDetailsService;
import org.jeecg.modules.iost.API.service.kingdeejournal.IKingdeeSelectJournalService;
import org.jeecg.modules.iost.API.service.oajournal.IOaUpdateJournalService;
import org.jeecg.modules.iost.API.webapi.LQKJ_t_IMSSyncDetailsWebapi; import org.jeecg.modules.iost.API.webapi.LQKJ_t_IMSSyncDetailsWebapi;
import org.jeecg.modules.iost.API.webapi.LoanInterfaceWebapi; import org.jeecg.modules.iost.API.webapi.LoanInterfaceWebapi;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -22,24 +25,27 @@ public class LoanDiscardDetailsServiceImpl extends ServiceImpl<LoanDiscardDetail ...@@ -22,24 +25,27 @@ public class LoanDiscardDetailsServiceImpl extends ServiceImpl<LoanDiscardDetail
@Autowired @Autowired
private LoanInterfaceWebapi loanInterfaceWebapi; private LoanInterfaceWebapi loanInterfaceWebapi;
@Autowired @Autowired
private LoanInterfaceApi loanInterfaceApi; private LoanInterfaceApi loanInterfaceApi;
@Autowired @Autowired
private IKingdeeSelectJournalService kingdeeSelectJournalService;
@Autowired
private IOaUpdateJournalService oaUpdateJournalService;
@Autowired
private ILQKJ_t_IMSSyncDetailsService t_imsSyncDetailsService; private ILQKJ_t_IMSSyncDetailsService t_imsSyncDetailsService;
public void getExpenseRequest() throws IOException, ParseException { @Override
public void SyncStart() {
QueryWrapper<LQKJ_t_IMSSyncDetails> queryWrapper = new QueryWrapper<LQKJ_t_IMSSyncDetails>(); 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本地记录筛选收费单,未同步 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> lqkj_t_imsSyncDetails = t_imsSyncDetailsService.getBaseMapper().selectList(queryWrapper);
List<LQKJ_t_IMSSyncDetails> SyncDetails=new ArrayList<>(); List<LQKJ_t_IMSSyncDetails> SyncDetails = new ArrayList<>();
Map<String, String> fidMap = new IdentityHashMap<String, String>(); Map<String, String> fidMap = new IdentityHashMap<String, String>();
for (LQKJ_t_IMSSyncDetails lqkj_t_imsSyncDetail : lqkj_t_imsSyncDetails) {//遍历同步 for (LQKJ_t_IMSSyncDetails lqkj_t_imsSyncDetail : lqkj_t_imsSyncDetails) {//遍历同步
String f_lqkj_syncDataId = lqkj_t_imsSyncDetail.getF_LQKJ_SyncDataId();//获取未同步收费单的fid String f_lqkj_syncDataId = lqkj_t_imsSyncDetail.getF_LQKJ_SyncDataId();//获取未同步收费单的fid
SyncDetails.add(lqkj_t_imsSyncDetail.setF_LQKJ_SyncCheck(1));//设置同步状态为已同步 SyncDetails.add(lqkj_t_imsSyncDetail.setF_LQKJ_SyncCheck(1));//设置同步状态为已同步
fidMap.put(new String("FID"), "'"+f_lqkj_syncDataId+"'");//允许同key的map做in语句 fidMap.put(new String("FID"), "'" + f_lqkj_syncDataId + "'");//允许同key的map做in语句
} }
t_imsSyncDetailsService.updateBatchById(SyncDetails);//更新收费单同步状态 t_imsSyncDetailsService.updateBatchById(SyncDetails);//更新收费单同步状态
...@@ -47,35 +53,41 @@ public class LoanDiscardDetailsServiceImpl extends ServiceImpl<LoanDiscardDetail ...@@ -47,35 +53,41 @@ public class LoanDiscardDetailsServiceImpl extends ServiceImpl<LoanDiscardDetail
} }
@Override @Override
public Object synchronization(Map object){ public Object synchronization(Map object) {
Map<String, List<Map>> synchronization = null; Map<String, List<Map>> synchronization = null;
if (0<object.size()) { if (0 < object.size()) {
synchronization = loanInterfaceWebapi.synchronization(object); synchronization = loanInterfaceWebapi.synchronization(object);
} }
if (null !=synchronization) if (null != synchronization)
for (String key : synchronization.keySet()) { for (String key : synchronization.keySet()) {
List<Map> lists = synchronization.get(key); List<Map> lists = synchronization.get(key);
for (Map list : lists) { if (null != lists)
if (list.get("FCancelStatus").toString().equals("B")) {//判断废弃状态 -已废弃 for (Map list : lists) {
Map params = new LinkedHashMap() {{ if (list.get("FCancelStatus").toString().equals("B")) {//判断废弃状态 -已废弃
put("method", "discardWorknumber"); Map params = new LinkedHashMap() {{
put("worknumber", list.get("FBillNo")); put("method", "discardWorknumber");
}}; put("worknumber", list.get("FBillNo").toString());
String select = loanInterfaceApi.add(params); }};
continue; String select = loanInterfaceApi.add(params);
} oaUpdateJournalService.setOaUpdateJournal(key, select, 3);
if (list.get("FDocumentStatus").toString().equals("C")) {//判断付款状态 -已付款 continue;
Map params = new LinkedHashMap() {{ }
put("method", "paymentStatus"); if (list.get("FDocumentStatus").toString().equals("C")) {//判断付款状态 -已付款
put("worknumber", list.get("FBillNo").toString()); Map params = new LinkedHashMap() {{
put("status", "已付款"); put("method", "paymentStatus");
}}; put("worknumber", list.get("FBillNo").toString());
String select = loanInterfaceApi.add(params); put("status", "已付款");
} }};
String select = loanInterfaceApi.add(params);
oaUpdateJournalService.setOaUpdateJournal(key, select, 4);
}
}
String kingdeeRequest = key;
Integer BusinessNo = 2;
List<Map> kingdeeResponse = lists;
kingdeeSelectJournalService.setKingdeeSelect(kingdeeRequest, kingdeeResponse, BusinessNo);
continue;
} }
}
return synchronization; return synchronization;
} }
......
package org.jeecg.modules.iost.API.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.jeecg.modules.iost.API.ExternalInterface.OtherReimbursementInterfaceApi;
import org.jeecg.modules.iost.API.entity.BusinessTripDetails;
import org.jeecg.modules.iost.API.entity.LQKJ_t_IMSSyncDetails;
import org.jeecg.modules.iost.API.mapper.BusinessTripDetailsMapper;
import org.jeecg.modules.iost.API.service.IBusinessTripDetailsService;
import org.jeecg.modules.iost.API.service.ILQKJ_t_IMSSyncDetailsService;
import org.jeecg.modules.iost.API.service.kingdeejournal.IKingdeeSelectJournalService;
import org.jeecg.modules.iost.API.service.oajournal.IOaUpdateJournalService;
import org.jeecg.modules.iost.API.webapi.OtherReimbursementInterfaceWebapi;
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 OtherReimbursementDetailsServiceImpl extends com.baomidou.mybatisplus.extension.service.impl.ServiceImpl<BusinessTripDetailsMapper, BusinessTripDetails> implements IBusinessTripDetailsService {
@Autowired
private OtherReimbursementInterfaceWebapi otherReimbursementInterfaceWebapi;
@Autowired
private OtherReimbursementInterfaceApi otherReimbursementInterfaceApi;
@Autowired
private IKingdeeSelectJournalService kingdeeSelectJournalService;
@Autowired
private IOaUpdateJournalService oaUpdateJournalService;
@Autowired
private ILQKJ_t_IMSSyncDetailsService t_imsSyncDetailsService;
@Override
public void SyncStart() throws IOException, ParseException {
QueryWrapper<LQKJ_t_IMSSyncDetails> queryWrapper = new QueryWrapper<LQKJ_t_IMSSyncDetails>();
queryWrapper.eq("F_LQKJ_Syncbill", "ER_ExpReimbursement").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) throws IOException, ParseException {
Map<String, List<Map>> synchronization = null;
if (0 < object.size()) {
synchronization = otherReimbursementInterfaceWebapi.synchronization(object);
}
if (null != synchronization)
for (String key : synchronization.keySet()) {
List<Map> lists = synchronization.get(key);
if (null != lists)
for (Map list : lists) {
if (list.get("FCancelStatus").toString().equals("B")) {//判断废弃状态 -已废弃
Map params = new LinkedHashMap() {{
put("method", "OtherExpenses_Discard");
put("worknumber", list.get("FBillNo").toString());
}};
String select = otherReimbursementInterfaceApi.add(params);
oaUpdateJournalService.setOaUpdateJournal(key, select, 11);
continue;
}
if (list.get("FDocumentStatus").toString().equals("C")) {//判断付款状态 -已付款
Map params = new LinkedHashMap() {{
put("method", "OtherExpenses_Update");
put("worknumber", list.get("FBillNo").toString());
put("status", "已付款");
}};
String select = otherReimbursementInterfaceApi.add(params);
oaUpdateJournalService.setOaUpdateJournal(key, select, 12);
}
}
String kingdeeRequest = key;
Integer BusinessNo = 10;
List<Map> kingdeeResponse = lists;
kingdeeSelectJournalService.setKingdeeSelect(kingdeeRequest, kingdeeResponse, BusinessNo);
continue;
}
return synchronization;
}
@Override
public Boolean manual(Map<String, Object> map, String ReturnProcessId) throws ParseException {
return null;
}
}
package org.jeecg.modules.iost.API.service.kingdeejournal; package org.jeecg.modules.iost.API.service.kingdeejournal;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.poi.ss.formula.functions.T;
import org.jeecg.modules.iost.API.entity.kingdeejournal.KingdeeSelectJournal; import org.jeecg.modules.iost.API.entity.kingdeejournal.KingdeeSelectJournal;
import java.util.List;
public interface IKingdeeSelectJournalService extends IService<KingdeeSelectJournal> { public interface IKingdeeSelectJournalService extends IService<KingdeeSelectJournal> {
public void setKingdeeSelect(String kingdeeRequest, List kingdeeResponse, Integer BusinessNo);
} }
...@@ -2,14 +2,49 @@ package org.jeecg.modules.iost.API.service.kingdeejournal.impl; ...@@ -2,14 +2,49 @@ package org.jeecg.modules.iost.API.service.kingdeejournal.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.sf.json.JSONObject;
import org.apache.poi.ss.formula.functions.T;
import org.jeecg.modules.iost.API.Util.JsonUtil;
import org.jeecg.modules.iost.API.dto.OABusiness;
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.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.util.Date;
import java.util.List;
@Service @Service
public class KingdeeSelectJournalServiceImpl extends ServiceImpl<KingdeeSelectJournalMapper, KingdeeSelectJournal> implements IKingdeeSelectJournalService { public class KingdeeSelectJournalServiceImpl extends ServiceImpl<KingdeeSelectJournalMapper, KingdeeSelectJournal> implements IKingdeeSelectJournalService {
@Override
/**
*返回null为请求失败
* boolean为判断是否保存
*/
@Async
public void setKingdeeSelect(String kingdeeRequest, List kingdeeResponse, Integer BusinessNo) {
KingdeeSelectJournal kingdeeSelectJournal = new KingdeeSelectJournal();
kingdeeSelectJournal.setRequest(kingdeeRequest);
kingdeeSelectJournal.setBusinessNo(BusinessNo);
kingdeeSelectJournal.setBusinessName(OABusiness.entity.get(BusinessNo));
kingdeeSelectJournal.setCreatetime(new Date());
kingdeeSelectJournal.setRequest(kingdeeRequest);
kingdeeSelectJournal.setSuccessagain(0);
if (0 == kingdeeResponse.size()) {//判断是否保存日志
return ;
}
if (null == kingdeeResponse) {
kingdeeSelectJournal.setResponse("请求失败");
kingdeeSelectJournal.setSynchronization(0);
} else if (null != kingdeeResponse && 0 < kingdeeResponse.size()) {
kingdeeSelectJournal.setResponse(JsonUtil.Listjson(kingdeeResponse));
kingdeeSelectJournal.setSynchronization(1);
}
boolean save = this.save(kingdeeSelectJournal);
}
} }
package org.jeecg.modules.iost.API.service.oajournal;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.iost.API.entity.oajournal.OaUpdateJournal;
import java.io.IOException;
import java.text.ParseException;
import java.util.Map;
public interface IOaUpdateJournalService extends IService<OaUpdateJournal> {
public void setOaUpdateJournal(String requestjson, String responsejson, Integer BusinessNo);
}
package org.jeecg.modules.iost.API.service.oajournal.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.iost.API.Util.JsonUtil;
import org.jeecg.modules.iost.API.dto.OABusiness;
import org.jeecg.modules.iost.API.entity.kingdeejournal.KingdeeSelectJournal;
import org.jeecg.modules.iost.API.entity.oajournal.OaUpdateJournal;
import org.jeecg.modules.iost.API.mapper.oajournal.OaUpdateJournalMapper;
import org.jeecg.modules.iost.API.service.oajournal.IOaUpdateJournalService;
import org.jeecg.modules.iost.API.vo.OaRequest;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service
public class OaUpdateJournalServiceImpl extends ServiceImpl<OaUpdateJournalMapper, OaUpdateJournal> implements IOaUpdateJournalService {
/**
* 返回null为请求失败
* boolean为判断是否保存
*/
@Override
@Async
public void setOaUpdateJournal(String requestjson, String responsejson, Integer BusinessNo) {
OaUpdateJournal oaUpdateJournal = new OaUpdateJournal();
OaRequest<String> listOaRequest =null;
try {
listOaRequest=JSONObject.parseObject(responsejson, OaRequest.class);
oaUpdateJournal.setCode(listOaRequest.getCode());
oaUpdateJournal.setMessage(listOaRequest.getMessage());
oaUpdateJournal.setResult(listOaRequest.getResult());
oaUpdateJournal.setSynchronization("成功"!=listOaRequest.getMessage()?0:1);
}catch (Exception e){
oaUpdateJournal.setSynchronization(0);
}finally {
oaUpdateJournal.setBusinessNo(BusinessNo);
oaUpdateJournal.setBusinessName(OABusiness.entity.get(BusinessNo));
oaUpdateJournal.setRequestjson(requestjson);
oaUpdateJournal.setCreatetime(new Date());
oaUpdateJournal.setSuccessagain(0);
this.save(oaUpdateJournal);
}
}
}
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 BusinessTripInterfaceWebapi implements web_api {
/**
* 操作的单据体名称
* 费用申请单
*/
private String sFormId = "ER_ExpReimbursement_Travel";
private String sFormId_t = "T_ER_ExpReimbursement_Travel";
private Map<String, String> key = new LinkedHashMap<>();
@Autowired
private CategoryDao categoryDao;
@Autowired
private CategoryDaoSql categoryDaoSql;
BusinessTripInterfaceWebapi() {
key.put("FID", "FID");//实体主键0
key.put("FBillNo","FBillNo");//单据编号1 -worknumber
key.put("FDocumentStatus","FDocumentStatus");//单据状态2
key.put("FCancelStatus","FCancelStatus");//作废状态 3
}
@Override
public String add(Object object) {
return null;
}
@Override
public List<Map<String, String>> select(Map<String, String> map, String where) {
return null;
}
@Override
public String update(Object object) {
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;
}
}
...@@ -13,7 +13,7 @@ import java.util.List; ...@@ -13,7 +13,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* @Description: 采购订单 * @Description:
*/ */
@Component @Component
public class LoanInterfaceWebapi implements web_api { public class LoanInterfaceWebapi implements web_api {
......
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.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@Component
public class OtherReimbursementInterfaceWebapi implements web_api {
/**
* 操作的单据体名称
* 费用申请单
*/
private String sFormId = "ER_ExpReimbursement";
private String sFormId_t = "T_ER_ExpReimbursement";
private Map<String, String> key = new LinkedHashMap<>();
@Autowired
private CategoryDao categoryDao;
@Autowired
private CategoryDaoSql categoryDaoSql;
OtherReimbursementInterfaceWebapi() {
key.put("FID", "FID");//实体主键0
key.put("FBillNo","FBillNo");//单据编号1 -worknumber
key.put("FDocumentStatus","FDocumentStatus");//单据状态2
key.put("FCancelStatus","FCancelStatus");//作废状态 3
}
@Override
public String add(Object object) {
return null;
}
@Override
public List<Map<String, String>> select(Map<String, String> map, String where) {
return null;
}
@Override
public String update(Object object) {
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;
}
}
...@@ -5,6 +5,7 @@ package org.jeecg; ...@@ -5,6 +5,7 @@ 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 net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.hibernate.annotations.AnyMetaDef;
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.LoanInterfaceApi; import org.jeecg.modules.iost.API.ExternalInterface.LoanInterfaceApi;
...@@ -13,8 +14,10 @@ import org.jeecg.modules.iost.API.vo.OaRequest; ...@@ -13,8 +14,10 @@ import org.jeecg.modules.iost.API.vo.OaRequest;
import org.jeecg.modules.iost.API.webapi.LQKJ_t_IMSSyncDetailsWebapi; 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.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
...@@ -114,34 +117,59 @@ public class SecurityToolsTest { ...@@ -114,34 +117,59 @@ public class SecurityToolsTest {
try { try {
Boolean result = client.login(dbId, uid, pwd, lang); Boolean result = client.login(dbId, uid, pwd, lang);
if(result){ if(result){
String sql="SELECT * FROM LQKJ_t_IMSSync where F_LQKJ_SyncCheck = 1;"; String sql="SELECT F_LQKJ_SYNCCHECK,ds FROM LQKJ_t_IMSSync where F_LQKJ_SyncCheck = 3;";
System.out.println(sql); System.out.println(sql);
String[] strings = new String[]{sql}; String[] strings = new String[]{sql};
List<Map> execute = client.execute(servicenameMap, strings, List.class); // List execute = client.execute(servicenameMap, strings, List.class);
for (Map o : execute) {
System.out.println(o.get("F_LQKJ_SYNCCHECK")); List execute = client.execute(servicenameMap, strings, List.class);
System.out.println(execute);
for (Object o : execute) {
System.out.println(execute);
}
if (null==execute) {
System.out.println("你好");
}else {
System.out.println("你好2");
} }
System.out.println(execute.size());
// for (Map o : execute) {
// System.out.println(o.get("F_LQKJ_SYNCCHECK"));
// }
} }
} catch (Exception e) { } catch (Exception e) {
System.out.println("nb");
e.printStackTrace(); e.printStackTrace();
} }
System.out.println("end");
} }
@Test @Test
// @Scheduled(fixedDelay = 5000) // @Scheduled(fixedDelay = 5000)
public void timdsaded() { public void timdsaded() throws InterruptedException {
LoanInterfaceApi queryLoanDetailsApi = new LoanInterfaceApi(); LoanInterfaceApi queryLoanDetailsApi = new LoanInterfaceApi();
String select = queryLoanDetailsApi.add(null); Map params = new LinkedHashMap() {{
put("method", "discardWorknumber");
put("worknumber", "1");
put("status", "已付款");
}};
String select = queryLoanDetailsApi.add(params);
System.out.println(select); System.out.println(select);
OaRequest<List<Map>> listOaRequest = com.alibaba.fastjson.JSONObject.parseObject(select, OaRequest.class); OaRequest<String> listOaRequest = com.alibaba.fastjson.JSONObject.parseObject(select, OaRequest.class);
List<Map> result = listOaRequest.getResult(); // List<Map> result = listOaRequest.getResult();
// new ToolsTest().Async();
System.out.println(listOaRequest); System.out.println(listOaRequest);
System.out.println(result.get(0).size()); // System.out.println(result.get(0).size());
}
@Async
public void dassdadsdads() throws InterruptedException {
Thread.sleep(50000);
System.out.println("nkklkjnlkkkkkkk");
} }
@Autowired @Autowired
private LQKJ_t_IMSSyncDetailsWebapi webapi; private LQKJ_t_IMSSyncDetailsWebapi webapi;
@Test @Test
......
package org.jeecg;
import kingdee.bos.webapi.client.K3CloudApiClient;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;
import org.jeecg.common.util.security.SecurityTools;
import org.jeecg.common.util.security.entity.*;
import org.jeecg.modules.iost.API.ExternalInterface.LoanInterfaceApi;
import org.jeecg.modules.iost.API.Util.HttpUtils;
import org.jeecg.modules.iost.API.vo.OaRequest;
import org.jeecg.modules.iost.API.webapi.LQKJ_t_IMSSyncDetailsWebapi;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Service;
import java.util.*;
@Slf4j
@EnableScheduling
@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 int lang = 2052;
K3CloudApiClient client = new K3CloudApiClient(K3CloudURL);
@Test
public void Test() {
MyKeyPair mkeyPair = SecurityTools.generateKeyPair();
JSONObject msg = new JSONObject();
msg.put("name", "党政辉");
msg.put("age", 50);
JSONObject identity = new JSONObject();
identity.put("type", "01");
identity.put("no", "210882165896524512");
msg.put("identity", identity);
// 签名加密部分
SecuritySignReq signReq = new SecuritySignReq();
// data为要加密的报文字符串
signReq.setData(msg.toString());
// 为rsa私钥
signReq.setPrikey(mkeyPair.getPriKey());
// 调用签名方法
SecuritySignResp sign = SecurityTools.sign(signReq);
// 打印出来加密数据
// signData为签名数据
// data为aes加密数据
// asekey为ras加密过的aeskey
//System.out.println(new JSONObject(sign).toStringPretty());
// 验签解密部分
SecurityReq req = new SecurityReq();
//对方传过来的数据一一对应
req.setAesKey(sign.getAesKey());
req.setData(sign.getData());
req.setSignData(sign.getSignData());
//我们的公钥
req.setPubKey(mkeyPair.getPubKey());
//验签方法调用
SecurityResp securityResp = SecurityTools.valid(req);
//解密报文data为解密报文
//sucess 为验签成功失败标志 true代码验签成功,false代表失败
// System.out.println(new JSONObject(securityResp).toStringPretty());
}
@Test
public void request() {
List<Map<String, Object>> lists = new ArrayList<Map<String, Object>>();
String url = "http://192.168.1.19:8080/wmssystem/API/eip-prod-store/list";
Map<String, String> hreader = new HashMap<>();
hreader.put("operatetype", "add");
hreader.put("transno", "201910086843218<Az2eV3>");
hreader.put("orisys", "0");
hreader.put("X-Access-Token", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MjY0MDkyMDAsInVzZXJuYW1lIjoiYWRtaW4ifQ.bERvQx5MmxZdtwcM6NqI9yng95EPmhF9OgtUBBIyOqs");
String result = HttpUtils.getRequest(url, hreader, null);
S(result);
}
public static JSONObject S(String data) {
JSONObject jsonObject = JSONObject.fromObject(data);
System.out.println(jsonObject.get("data"));
log.info(jsonObject.get(data).toString());
return jsonObject;
}
@Test
public void S() {
Random r = new Random();
// 第一种方法
// int num = (int) (Math.random() * 5 + 1);
// System.out.println("num:" + num);
// 第二种方法
int a = r.nextInt(5) + 1;
System.out.println("a:" + a);
}
/**
* 测试定时
*/
@Test
// @Scheduled(fixedDelay = 5000)
public void timed() {
String servicenameTable="LQKJ.WebApi.Stub.CustomWebApiService.ExecutDataSet,LQKJ.WebApi.Stub";
String servicenameMap="LQKJ.WebApi.Stub.CustomWebApiService.ExecuteDynamicObject,LQKJ.WebApi.Stub";
log.info("123");
List<List<Object>> list = null;
try {
Boolean result = client.login(dbId, uid, pwd, lang);
if(result){
String sql="SELECT F_LQKJ_SYNCCHECK,ds FROM LQKJ_t_IMSSync where F_LQKJ_SyncCheck = 3;";
System.out.println(sql);
String[] strings = new String[]{sql};
// List execute = client.execute(servicenameMap, strings, List.class);
List execute = client.execute(servicenameMap, strings, List.class);
System.out.println(execute);
for (Object o : execute) {
System.out.println(execute);
}
if (null==execute) {
System.out.println("你好");
}else {
System.out.println("你好2");
}
System.out.println(execute.size());
// for (Map o : execute) {
// System.out.println(o.get("F_LQKJ_SYNCCHECK"));
// }
}
} catch (Exception e) {
System.out.println("nb");
e.printStackTrace();
}
System.out.println("end");
}
@Test
// @Scheduled(fixedDelay = 5000)
public void timdsaded() throws InterruptedException {
LoanInterfaceApi queryLoanDetailsApi = new LoanInterfaceApi();
String select = queryLoanDetailsApi.add(null);
System.out.println(select);
OaRequest<List<Map>> listOaRequest = com.alibaba.fastjson.JSONObject.parseObject(select, OaRequest.class);
List<Map> result = listOaRequest.getResult();
System.out.println(listOaRequest);
System.out.println(result.get(0).size());
}
@Async
public void Async() throws InterruptedException {
Thread.sleep(50000);
System.out.println("nkklkjnlkkkkkkk");
}
@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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论