项目推送oa
This commit is contained in:
parent
b2ea277b87
commit
498f547ca0
|
@ -0,0 +1,20 @@
|
||||||
|
package com.hzya.frame.plugin.ht.dao;
|
||||||
|
|
||||||
|
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||||
|
import com.hzya.frame.plugin.ht.entity.BipProjectEntity;
|
||||||
|
import com.hzya.frame.plugin.ht.entity.FundsAllocationEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description bip项目传递oa
|
||||||
|
* @Author xiangerlin
|
||||||
|
* @Date 2025/6/21 14:23
|
||||||
|
**/
|
||||||
|
public interface IBipProjectDao extends IBaseDao<BipProjectEntity,String> {
|
||||||
|
List<BipProjectEntity> getBipProject(BipProjectEntity bipProjectEntity);
|
||||||
|
|
||||||
|
List<BipProjectEntity> getOaData(BipProjectEntity oadata);
|
||||||
|
|
||||||
|
int updateOaData(BipProjectEntity updateData);
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.hzya.frame.plugin.ht.dao.impl;
|
||||||
|
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
|
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||||
|
import com.hzya.frame.plugin.ht.dao.IBipProjectDao;
|
||||||
|
import com.hzya.frame.plugin.ht.entity.BipProjectEntity;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description bip项目传递oa
|
||||||
|
* @Author xiangerlin
|
||||||
|
* @Date 2025/6/21 14:24
|
||||||
|
**/
|
||||||
|
@Repository(value = "bipProjectDaoImpl")
|
||||||
|
public class BipProjectDaoImpl extends MybatisGenericDao<BipProjectEntity,String> implements IBipProjectDao {
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public List<BipProjectEntity> getBipProject(BipProjectEntity entity) {
|
||||||
|
return super.query(getSqlIdPrifx() + "getBipProject",entity);
|
||||||
|
}
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public List<BipProjectEntity> getOaData(BipProjectEntity entity) {
|
||||||
|
return super.query(getSqlIdPrifx() + "getOaData",entity);
|
||||||
|
|
||||||
|
}
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public int updateOaData(BipProjectEntity entity) {
|
||||||
|
return super.update(getSqlIdPrifx() + "updateOaData",entity);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
package com.hzya.frame.plugin.ht.entity;
|
||||||
|
|
||||||
|
import com.hzya.frame.web.entity.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description bip项目传递oa
|
||||||
|
* @Author xiangerlin
|
||||||
|
* @Date 2025/6/21 14:19
|
||||||
|
**/
|
||||||
|
public class BipProjectEntity extends BaseEntity {
|
||||||
|
|
||||||
|
private String field0001;
|
||||||
|
private String field0002;
|
||||||
|
private String field0003;
|
||||||
|
private String field0004;
|
||||||
|
private String startTime;
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
public String getField0001() {
|
||||||
|
return field0001;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setField0001(String field0001) {
|
||||||
|
this.field0001 = field0001;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getField0002() {
|
||||||
|
return field0002;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setField0002(String field0002) {
|
||||||
|
this.field0002 = field0002;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getField0003() {
|
||||||
|
return field0003;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setField0003(String field0003) {
|
||||||
|
this.field0003 = field0003;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getField0004() {
|
||||||
|
return field0004;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setField0004(String field0004) {
|
||||||
|
this.field0004 = field0004;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStartTime() {
|
||||||
|
return startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartTime(String startTime) {
|
||||||
|
this.startTime = startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEndTime() {
|
||||||
|
return endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndTime(String endTime) {
|
||||||
|
this.endTime = endTime;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?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="com.hzya.frame.plugin.ht.dao.impl.BipProjectDaoImpl">
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getBipProject" resultType="com.hzya.frame.plugin.ht.entity.BipProjectEntity"
|
||||||
|
parameterType="com.hzya.frame.plugin.ht.entity.BipProjectEntity">
|
||||||
|
SELECT
|
||||||
|
project_code as field0001,
|
||||||
|
REPLACE(project_name, '~', '') as field0002,
|
||||||
|
REPLACE(def2, '~', '') as field0003,
|
||||||
|
REPLACE(def3, '~', '') as field0004,
|
||||||
|
ts
|
||||||
|
FROM
|
||||||
|
BD_PROJECT
|
||||||
|
<trim prefix="where" prefixOverrides="and">
|
||||||
|
<if test="startTime != null and startTime != ''">and ts >= #{startTime}</if>
|
||||||
|
<if test="endTime != null and endTime != ''">and ts <= #{endTime}</if>
|
||||||
|
</trim>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getOaData" resultType="com.hzya.frame.plugin.ht.entity.BipProjectEntity"
|
||||||
|
parameterType="com.hzya.frame.plugin.ht.entity.BipProjectEntity">
|
||||||
|
SELECT
|
||||||
|
field0001 as field0001,
|
||||||
|
field0002 as field0002,
|
||||||
|
field0003 as field0003,
|
||||||
|
field0004 as field0004
|
||||||
|
FROM
|
||||||
|
formmain_0730
|
||||||
|
<trim prefix="where" prefixOverrides="and">
|
||||||
|
<if test="field0001 != null and field0001 != ''">and field0001 = #{field0001}</if>
|
||||||
|
</trim>
|
||||||
|
</select>
|
||||||
|
<update id="updateOaData" parameterType="com.hzya.frame.plugin.ht.entity.BipProjectEntity">
|
||||||
|
update formmain_0730 set
|
||||||
|
<trim suffix="" suffixOverrides=",">
|
||||||
|
<if test="field0001 != null and field0001 !='' ">field0001 = #{field0001},</if>
|
||||||
|
<if test="field0002 != null and field0002 !='' ">field0002 = #{field0002},</if>
|
||||||
|
<if test="field0003 != null and field0003 !='' ">field0003 = #{field0003},</if>
|
||||||
|
<if test="field0004 != null and field0004 !='' ">field0004 = #{field0004},</if>
|
||||||
|
</trim>
|
||||||
|
where field0001 = #{field0001}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,103 @@
|
||||||
|
package com.hzya.frame.plugin.ht.plugin;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.hzya.frame.base.PluginBaseEntity;
|
||||||
|
import com.hzya.frame.plugin.ht.service.IBipProjectService;
|
||||||
|
import com.hzya.frame.plugin.ht.service.IFundsAllocationPluginService;
|
||||||
|
import com.hzya.frame.web.entity.BaseResult;
|
||||||
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description bip项目传递oa
|
||||||
|
* @Author xiangerlin
|
||||||
|
* @Date 2025/6/21 14:06
|
||||||
|
**/
|
||||||
|
public class BipProjectPluginInitializer extends PluginBaseEntity {
|
||||||
|
Logger logger = LoggerFactory.getLogger(BipProjectPluginInitializer.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IBipProjectService bipProjectService;
|
||||||
|
/***
|
||||||
|
* 插件初始化方法
|
||||||
|
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||||
|
* @Date 2023-08-02 10:48
|
||||||
|
* @Param []
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public void initialize() {
|
||||||
|
logger.info(getPluginLabel() + "执行初始化方法initialize()");
|
||||||
|
}
|
||||||
|
|
||||||
|
/****
|
||||||
|
* 插件销毁方法
|
||||||
|
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||||
|
* @date 2023-08-02 10:48
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public void destroy() {
|
||||||
|
logger.info(getPluginLabel() + "执行销毁方法destroy()");
|
||||||
|
}
|
||||||
|
|
||||||
|
/****
|
||||||
|
* 插件的ID
|
||||||
|
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||||
|
* @date 2023-08-02 10:48
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public String getPluginId() {
|
||||||
|
return "BipProjectPlugin";
|
||||||
|
}
|
||||||
|
|
||||||
|
/****
|
||||||
|
* 插件的名称
|
||||||
|
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||||
|
* @date 2023-08-02 10:48
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public String getPluginName() {
|
||||||
|
return "bip项目传递oa";
|
||||||
|
}
|
||||||
|
|
||||||
|
/****
|
||||||
|
* 插件的显示值
|
||||||
|
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||||
|
* @date 2023-08-02 10:48
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public String getPluginLabel() {
|
||||||
|
return "bip项目传递oa";
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 插件类型 1、场景插件
|
||||||
|
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||||
|
* @Date 2023-08-02 14:01
|
||||||
|
* @Param []
|
||||||
|
* @return java.lang.String
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public String getPluginType() {
|
||||||
|
return "1";
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 执行业务代码
|
||||||
|
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||||
|
* @Date 2023-08-07 11:20
|
||||||
|
* @param requestJson 执行业务代码的参数
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||||
|
logger.info("======开始执行bip项目传递oa插件========");
|
||||||
|
return bipProjectService.sendBipProject(requestJson);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.hzya.frame.plugin.ht.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.hzya.frame.basedao.service.IBaseService;
|
||||||
|
import com.hzya.frame.plugin.ht.entity.BipProjectEntity;
|
||||||
|
import com.hzya.frame.plugin.ht.entity.FundsAllocationEntity;
|
||||||
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description bip项目传递oa
|
||||||
|
* @Author xiangerlin
|
||||||
|
* @Date 2025/6/21 15:01
|
||||||
|
**/
|
||||||
|
public interface IBipProjectService extends IBaseService<BipProjectEntity,String> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author lvleigang
|
||||||
|
* @Description bip项目传递oa
|
||||||
|
* @Date 2:51 下午 2025/8/11
|
||||||
|
* @param requestJson
|
||||||
|
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||||
|
**/
|
||||||
|
JsonResultEntity sendBipProject(JSONObject requestJson);
|
||||||
|
}
|
|
@ -0,0 +1,226 @@
|
||||||
|
package com.hzya.frame.plugin.ht.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
|
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||||
|
import com.hzya.frame.plugin.ht.dao.IBipProjectDao;
|
||||||
|
import com.hzya.frame.plugin.ht.dao.IFundsAllocationDao;
|
||||||
|
import com.hzya.frame.plugin.ht.entity.BipProjectEntity;
|
||||||
|
import com.hzya.frame.plugin.ht.entity.FundsAllocationEntity;
|
||||||
|
import com.hzya.frame.plugin.ht.service.IBipProjectService;
|
||||||
|
import com.hzya.frame.plugin.ht.service.IFundsAllocationService;
|
||||||
|
import com.hzya.frame.web.entity.BaseResult;
|
||||||
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description bip项目传递oa
|
||||||
|
* @Author xiangerlin
|
||||||
|
* @Date 2025/6/21 15:03
|
||||||
|
**/
|
||||||
|
@Service(value = "bipProjectServiceImpl")
|
||||||
|
public class BipProjectServiceImpl extends BaseService<BipProjectEntity, String> implements IBipProjectService {
|
||||||
|
|
||||||
|
private IBipProjectDao bipProjectDao;
|
||||||
|
@Value("${zt.url}")
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
private static final Random random = new Random();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public void setBipProjectDao(IBipProjectDao dao) {
|
||||||
|
this.bipProjectDao = dao;
|
||||||
|
this.dao = dao;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param requestJson
|
||||||
|
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||||
|
* @Author lvleigang
|
||||||
|
* @Description bip项目传递oa
|
||||||
|
* @Date 2:51 下午 2025/8/11
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public JsonResultEntity sendBipProject(JSONObject requestJson) {
|
||||||
|
|
||||||
|
logger.error("bip项目传递oa入参"+requestJson.toJSONString());
|
||||||
|
String startTime = DateUtil.format(requestJson.getDate("startTime"), "yyyy-MM-dd HH:mm:ss");//定时任务执行时传入的开始时间
|
||||||
|
String endTime = DateUtil.format(requestJson.getDate("endTime"), "yyyy-MM-dd HH:mm:ss");//定时任务执行时传入的结束时间
|
||||||
|
|
||||||
|
BipProjectEntity bipProjectEntity = new BipProjectEntity();
|
||||||
|
bipProjectEntity.setDataSourceCode("htBip");
|
||||||
|
bipProjectEntity.setStartTime(startTime);
|
||||||
|
bipProjectEntity.setEndTime(endTime);
|
||||||
|
List<BipProjectEntity> bipProjectEntityList = bipProjectDao.getBipProject(bipProjectEntity);
|
||||||
|
logger.error("bip查询最新的项目返回"+bipProjectEntityList.size());
|
||||||
|
|
||||||
|
if(bipProjectEntityList != null && bipProjectEntityList.size() > 0){
|
||||||
|
for (int i = 0; i < bipProjectEntityList.size(); i++) {
|
||||||
|
//查询是否有存在数据
|
||||||
|
BipProjectEntity oadata = new BipProjectEntity();
|
||||||
|
oadata.setDataSourceCode("HT-OA");
|
||||||
|
oadata.setField0001(bipProjectEntityList.get(i).getField0001());
|
||||||
|
logger.error("bip查询是否存在项目"+bipProjectEntityList.get(i).getField0001());
|
||||||
|
|
||||||
|
List<BipProjectEntity> oaList = bipProjectDao.getOaData(oadata);
|
||||||
|
logger.error("bip查询是否存在项目返回"+oaList.size());
|
||||||
|
|
||||||
|
if(oaList != null && oaList.size() > 0){
|
||||||
|
if(oaList.size() == 1){
|
||||||
|
//修改数据
|
||||||
|
BipProjectEntity updateData = new BipProjectEntity();
|
||||||
|
updateData.setDataSourceCode("HT-OA");
|
||||||
|
updateData.setField0001(bipProjectEntityList.get(i).getField0001());
|
||||||
|
updateData.setField0002(bipProjectEntityList.get(i).getField0002());
|
||||||
|
updateData.setField0003(bipProjectEntityList.get(i).getField0003());
|
||||||
|
updateData.setField0004(bipProjectEntityList.get(i).getField0004());
|
||||||
|
bipProjectDao.updateOaData(updateData);
|
||||||
|
}else {
|
||||||
|
logger.error("根据"+bipProjectEntityList.get(i).getField0001()+"项目编码,获取OA项目编码存在多个,请联系管理员");
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
//新增
|
||||||
|
//获取token
|
||||||
|
logger.error("bip项目获取token");
|
||||||
|
|
||||||
|
String token = getToken();
|
||||||
|
logger.error("bip项目获取token"+token);
|
||||||
|
|
||||||
|
//组装数据
|
||||||
|
String sendData = getSendData(bipProjectEntityList.get(i));
|
||||||
|
logger.error("bip项目无流程表单发送数据"+sendData);
|
||||||
|
|
||||||
|
String result = HttpRequest.post(url)
|
||||||
|
.header("appId", "8000590012")
|
||||||
|
.header("apiCode", "800059")
|
||||||
|
.header("token", token)
|
||||||
|
.header("publicKey", "ZJYAVJ/+Tb3icrp2wpcI/85OZ2BilQRX54aDI3vRjQZkHABCe7eDIk+3zDUT+v578prj")//OA公钥
|
||||||
|
.header("secretKey", "IA/w5YOFCFQVHBsbyjL2D7DAQnOEOFd1ZvcFkCqCTgCheYBevXC7hZOd0OUhGcHdj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//OA密钥
|
||||||
|
.body(sendData)//表单内容
|
||||||
|
.timeout(30000)//超时,毫秒
|
||||||
|
.execute().body();
|
||||||
|
logger.info("bip项目Oa无流程表单返回报文:{}",result);
|
||||||
|
if (StrUtil.isNotEmpty(result)){
|
||||||
|
JSONObject tokenObj = JSONObject.parseObject(result);
|
||||||
|
String code = tokenObj.getString("status");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return BaseResult.getSuccessMessageEntity("执行成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getSendData(BipProjectEntity entity) {
|
||||||
|
JSONObject sendData = new JSONObject();
|
||||||
|
|
||||||
|
// 添加顶层基本字段
|
||||||
|
sendData.put("formCode", "formmain_0730");
|
||||||
|
sendData.put("loginName", "hzya");
|
||||||
|
sendData.put("rightId", "-5289104417975482331.5120195071596839780");
|
||||||
|
sendData.put("doTrigger", true);
|
||||||
|
|
||||||
|
// 创建dataList数组
|
||||||
|
JSONArray dataList = new JSONArray();
|
||||||
|
|
||||||
|
// 创建数组中的对象
|
||||||
|
JSONObject dataItem = new JSONObject();
|
||||||
|
|
||||||
|
// 创建masterTable对象
|
||||||
|
JSONObject masterTable = new JSONObject();
|
||||||
|
masterTable.put("name", "formmain_0730");
|
||||||
|
|
||||||
|
// 创建record对象
|
||||||
|
JSONObject record = new JSONObject();
|
||||||
|
record.put("id", random.nextLong());
|
||||||
|
|
||||||
|
// 创建fields数组并添加字段对象
|
||||||
|
JSONArray fields = new JSONArray();
|
||||||
|
|
||||||
|
// 添加field0001
|
||||||
|
JSONObject field1 = new JSONObject();
|
||||||
|
field1.put("name", "field0001");
|
||||||
|
field1.put("value", entity.getField0001());
|
||||||
|
field1.put("showValue", "");
|
||||||
|
fields.add(field1);
|
||||||
|
|
||||||
|
// 添加field0002
|
||||||
|
JSONObject field2 = new JSONObject();
|
||||||
|
field2.put("name", "field0002");
|
||||||
|
field2.put("value", entity.getField0002());
|
||||||
|
field2.put("showValue", "");
|
||||||
|
fields.add(field2);
|
||||||
|
|
||||||
|
// 添加field0003
|
||||||
|
JSONObject field3 = new JSONObject();
|
||||||
|
field3.put("name", "field0003");
|
||||||
|
field3.put("value", entity.getField0003());
|
||||||
|
field3.put("showValue", "");
|
||||||
|
fields.add(field3);
|
||||||
|
|
||||||
|
// 添加field0004
|
||||||
|
JSONObject field4 = new JSONObject();
|
||||||
|
field4.put("name", "field0004");
|
||||||
|
field4.put("value", entity.getField0004());
|
||||||
|
field4.put("showValue", "");
|
||||||
|
fields.add(field4);
|
||||||
|
|
||||||
|
// 将fields数组放入record
|
||||||
|
record.put("fields", fields);
|
||||||
|
|
||||||
|
// 将record放入masterTable
|
||||||
|
masterTable.put("record", record);
|
||||||
|
|
||||||
|
// 将masterTable放入dataItem
|
||||||
|
dataItem.put("masterTable", masterTable);
|
||||||
|
|
||||||
|
// 将dataItem放入dataList数组
|
||||||
|
dataList.add(dataItem);
|
||||||
|
|
||||||
|
// 将dataList放入最外层对象
|
||||||
|
sendData.put("dataList", dataList);
|
||||||
|
|
||||||
|
|
||||||
|
return sendData.toJSONString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getToken() {
|
||||||
|
String token = null;
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
// 向JSON对象中添加键值对
|
||||||
|
param.put("password", "b19afb1a-5a72-43db-84e1-e84aa4c571b5");
|
||||||
|
param.put("userName", "YDRest");
|
||||||
|
param.put("loginName", "13868833280");
|
||||||
|
|
||||||
|
String result = HttpRequest.post(url)
|
||||||
|
.header("appId", "800059")
|
||||||
|
.header("apiCode", "8000590001")
|
||||||
|
.header("publicKey", "ZJYAVJ/+Tb3icrp2wpcI/85OZ2BilQRX54aDI3vRjQZkHABCe7eDIk+3zDUT+v578prj")//OA公钥
|
||||||
|
.header("secretKey", "IA/w5YOFCFQVHBsbyjL2D7DAQnOEOFd1ZvcFkCqCTgCheYBevXC7hZOd0OUhGcHdj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//OA密钥
|
||||||
|
.body(param.toJSONString())//表单内容
|
||||||
|
.timeout(30000)//超时,毫秒
|
||||||
|
.execute().body();
|
||||||
|
logger.info("OaToken返回报文:{}",result);
|
||||||
|
if (StrUtil.isNotEmpty(result)){
|
||||||
|
JSONObject tokenObj = JSONObject.parseObject(result);
|
||||||
|
String code = tokenObj.getString("status");
|
||||||
|
if ("200".equals(code)){
|
||||||
|
JSONObject attribute = tokenObj.getJSONObject("attribute");
|
||||||
|
if (null != attribute){
|
||||||
|
token = attribute.getString("id");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,5 +6,6 @@
|
||||||
<bean name="QueryInvoiceResultPluginInitializer" class="com.hzya.frame.plugin.ht.plugin.QueryInvoiceResultPluginInitializer" />
|
<bean name="QueryInvoiceResultPluginInitializer" class="com.hzya.frame.plugin.ht.plugin.QueryInvoiceResultPluginInitializer" />
|
||||||
<bean name="QueryInputInvoiceResultPluginInitializer" class="com.hzya.frame.plugin.ht.plugin.QueryInputInvoiceResultPluginInitializer" />
|
<bean name="QueryInputInvoiceResultPluginInitializer" class="com.hzya.frame.plugin.ht.plugin.QueryInputInvoiceResultPluginInitializer" />
|
||||||
<bean name="fundsAllocationPluginInitializer" class="com.hzya.frame.plugin.ht.plugin.FundsAllocationPluginInitializer" />
|
<bean name="fundsAllocationPluginInitializer" class="com.hzya.frame.plugin.ht.plugin.FundsAllocationPluginInitializer" />
|
||||||
|
<bean name="bipProjectPluginInitializer" class="com.hzya.frame.plugin.ht.plugin.BipProjectPluginInitializer" />
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
|
Loading…
Reference in New Issue