销售合同附件和IPO附件上传BIP
This commit is contained in:
parent
cea5489383
commit
2bc08aa094
|
@ -37,6 +37,16 @@ public interface ISalesContractDao extends IBaseDao<SalesContractEntity,String>
|
|||
* **/
|
||||
List<SalesContractEntity> queryContractAnnexFile(SalesContractEntity salesContractEntity);
|
||||
|
||||
/**
|
||||
*
|
||||
* @content 查询未上传文件的销售合同IPO附件
|
||||
* @Param
|
||||
* @Return
|
||||
* @Author hecan
|
||||
* @Date 2025-04-16 14:40
|
||||
* **/
|
||||
List<SalesContractEntity> queryIPOAnnexFile(SalesContractEntity salesContractEntity);
|
||||
|
||||
/**
|
||||
*
|
||||
* @content 更新销售合同附件和ipo附件上传标识
|
||||
|
|
|
@ -26,6 +26,12 @@ public class SalesContractDaoImpl extends MybatisGenericDao<SalesContractEntity,
|
|||
return (List<SalesContractEntity>) super.selectList("queryContractAnnexFile",entity);
|
||||
}
|
||||
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public List<SalesContractEntity> queryIPOAnnexFile(SalesContractEntity entity) {
|
||||
return (List<SalesContractEntity>) super.selectList("queryIPOAnnexFile",entity);
|
||||
}
|
||||
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public Integer updateAnnexFile(SalesContractEntity entity) {
|
||||
|
|
|
@ -76,26 +76,45 @@
|
|||
<select id="queryContractAnnexFile" resultMap="get-SalesContractEntity-result" parameterType = "com.hzya.frame.plugin.salesContract.entity.SalesContractEntity">
|
||||
select
|
||||
formmain_8694.id as id,
|
||||
formmain_8694.id as billid, -- 单据主键
|
||||
-- formmain_8694.id as billid, -- 单据主键
|
||||
'HHHX0201' as billtype, -- 单据类型
|
||||
field0009 as billcode, -- 单据号 合同订单可以传合同号
|
||||
field0132 as pkOrg, -- 公司编码
|
||||
ipo_file.filename as ipofilename, -- ipo附件 文件名称
|
||||
htnr_file.filename as htnrfilename, --合同内容附件 文件名称
|
||||
htnr_file.id as htnrid, -- 合同内容附件id
|
||||
ipo_file.id as ipoid, -- IPO附件id
|
||||
field0153 as htnrpush, -- 合同附件上传标识
|
||||
field0154 as ipopush -- ipo附件上传标识
|
||||
field0153 as htnrpush -- 合同附件上传标识
|
||||
from
|
||||
formmain_8694
|
||||
LEFT JOIN COL_SUMMARY summary ON summary.FORM_RECORDID = formmain_8694.id
|
||||
left join CTP_ATTACHMENT htnr on htnr.sub_reference=field0020
|
||||
left join CTP_ATTACHMENT ipo on ipo.sub_reference=field0139
|
||||
left join ctp_file htnr_file on htnr_file.id=htnr.file_url
|
||||
where field0146 is not null and to_char(field0007,'yyyy-MM-dd HH24:mi:ss')>'2025-01-01'
|
||||
-- and summary.state in ('1','3')
|
||||
and field0132 is not null and field0153 is null and field0001='SW15-004-2025003497'
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
<!--查询未上传的数据,推送BIP新增-->
|
||||
<select id="queryIPOAnnexFile" resultMap="get-SalesContractEntity-result" parameterType = "com.hzya.frame.plugin.salesContract.entity.SalesContractEntity">
|
||||
select
|
||||
formmain_8694.id as id,
|
||||
-- formmain_8694.id as billid, -- 单据主键
|
||||
'HHHX0201' as billtype, -- 单据类型
|
||||
field0009 as billcode, -- 单据号 合同订单可以传合同号
|
||||
field0132 as pkOrg, -- 公司编码
|
||||
ipo_file.filename as ipofilename, -- ipo附件 文件名称
|
||||
ipo_file.id as ipoid, -- IPO附件id
|
||||
field0154 as ipopush -- ipo附件上传标识
|
||||
from
|
||||
formmain_8694
|
||||
LEFT JOIN COL_SUMMARY summary ON summary.FORM_RECORDID = formmain_8694.id
|
||||
left join CTP_ATTACHMENT ipo on ipo.sub_reference=field0139
|
||||
left join ctp_file ipo_file on ipo_file.id=ipo.file_url
|
||||
where field0146 is not null and to_char(field0007,'yyyy-MM-dd HH24:mi:ss')>'2025-01-01'
|
||||
-- and summary.state in ('1','3')
|
||||
and field0132 is not null and (field0153 is null or field0154 is null) and field0001='SW15-004-2025003467'
|
||||
and field0132 is not null and field0154 is null and field0001='SW15-004-2025003497'
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
</trim>
|
||||
|
|
|
@ -5,6 +5,7 @@ import cn.hutool.http.HttpRequest;
|
|||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.base.PluginBaseEntity;
|
||||
import com.hzya.frame.dateutil.DateUtil;
|
||||
|
@ -16,6 +17,7 @@ import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTa
|
|||
import com.hzya.frame.uuid.UUIDUtils;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -90,9 +92,13 @@ public class ContractAnnexFileUploadPluginInitializer extends PluginBaseEntity {
|
|||
logger.info("=====没有需要上传BIP的销售合同附件==========");
|
||||
return BaseResult.getSuccessMessageEntity("查询成功");
|
||||
}
|
||||
JSONObject resultJson=null;
|
||||
SalesContractEntity salesContract=new SalesContractEntity();
|
||||
salesContract.setDataSourceCode("SW-OA");
|
||||
for (SalesContractEntity contractEntity : salesContractEntities) {
|
||||
if(null !=contractEntity.getHtnrfilename()){
|
||||
if(null !=contractEntity.getHtnrfilename() && null==contractEntity.getHtnrpush()){
|
||||
contractEntity.setDataSourceCode("SW-OA");
|
||||
JSONArray jsonArray=new JSONArray();
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put("filename",contractEntity.getHtnrfilename());
|
||||
jsonObject.put("billtype",contractEntity.getBilltype());
|
||||
|
@ -105,49 +111,28 @@ public class ContractAnnexFileUploadPluginInitializer extends PluginBaseEntity {
|
|||
//本地文件转为base64
|
||||
String base64 = getBase64(newPath);
|
||||
jsonObject.put("file",base64);
|
||||
JSONObject resultJson = send(jsonObject, contractEntity);
|
||||
jsonArray.add(jsonObject);
|
||||
resultJson = send(jsonArray, contractEntity);
|
||||
logger.error("销售合同附件上传BIP返回结果:" + resultJson.toJSONString());
|
||||
salesContract.setId(contractEntity.getId());
|
||||
}
|
||||
}
|
||||
if(null !=resultJson ){
|
||||
if(!resultJson.getBoolean("flag")){
|
||||
logger.info("=========销售合同附件上传bip返回结果错误,开始修改销售合同附件上传推送标识为失败==========");
|
||||
contractEntity.setHtnrpush("0");
|
||||
salesContractDao.updateAnnexFile(contractEntity);
|
||||
salesContract.setHtnrpush("0");
|
||||
salesContractDao.updateAnnexFile(salesContract);
|
||||
logger.info("=========销售合同附件上传获取bip返回结果错误,修改销售合同附件上传推送标识为失败完毕==========");
|
||||
// saveTaskLivingDetails(contractEntity.getId(),contractEntity.getBillcode(),jsonObject.toString(),resultJson.toJSONString(),false);
|
||||
}else {
|
||||
logger.info("=========销售合同附件上传bip返回结果成功,开始修改销售合同附件上传推送标识为成功==========");
|
||||
contractEntity.setHtnrpush("1");
|
||||
salesContractDao.updateSalesContract(contractEntity);
|
||||
salesContract.setHtnrpush("1");
|
||||
salesContractDao.updateAnnexFile(salesContract);
|
||||
logger.info("=========销售合同附件上传bip返回结果成功,修改销售合同附件上传推送标识为成功完毕==========");
|
||||
// saveTaskLivingDetails(contractEntity.getId(),contractEntity.getBillcode(),jsonObject.toString(),resultJson.toJSONString(),true);
|
||||
}
|
||||
}
|
||||
if(null !=contractEntity.getIpofilename()){
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put("filename",contractEntity.getIpofilename());
|
||||
jsonObject.put("billtype",contractEntity.getBilltype());
|
||||
jsonObject.put("billid",contractEntity.getBillid());
|
||||
jsonObject.put("billcode",contractEntity.getBillcode());
|
||||
jsonObject.put("pk_org",contractEntity.getPkOrg());
|
||||
String file_url = contractEntity.getIpoid();
|
||||
String newPath = "E:\\yongansystem\\upload\\reuce\\"+contractEntity.getIpofilename();
|
||||
downOaFile(file_url,contractEntity.getIpofilename(),newPath);
|
||||
//本地文件转为base64
|
||||
String base64 = getBase64(newPath);
|
||||
jsonObject.put("file",base64);
|
||||
JSONObject resultJson = send(jsonObject, contractEntity);
|
||||
if(!resultJson.getBoolean("flag")){
|
||||
logger.info("=========销售合同ipo附件上传bip返回结果错误,开始修改销售合同ipo附件上传推送标识为失败==========");
|
||||
contractEntity.setIpopush("0");
|
||||
salesContractDao.updateSalesContract(contractEntity);
|
||||
logger.info("=========销售合同ipo附件上传获取bip返回结果错误,修改销售合同ipo附件上传推送标识为失败完毕==========");
|
||||
//saveTaskLivingDetails(contractEntity.getId(),contractEntity.getBillcode(),jsonObject.toString(),resultJson.toJSONString(),false);
|
||||
}else {
|
||||
logger.info("=========销售合同ipo附件上传bip返回结果成功,开始修改销售合同ipo附件上传推送标识为成功==========");
|
||||
contractEntity.setIpopush("1");
|
||||
salesContractDao.updateSalesContract(contractEntity);
|
||||
logger.info("=========销售合同ipo附件上传bip返回结果成功,修改销售合同ipo附件上传推送标识为成功完毕==========");
|
||||
// saveTaskLivingDetails(contractEntity.getId(),contractEntity.getBillcode(),jsonObject.toString(),resultJson.toJSONString(),true);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
logger.info("=======没有销售合同附件上传BIP=======");
|
||||
}
|
||||
logger.info("=======销售合同附件上传BIP执行成功=======");
|
||||
return BaseResult.getSuccessMessageEntity("销售合同附件上传执行成功");
|
||||
|
@ -202,8 +187,9 @@ public class ContractAnnexFileUploadPluginInitializer extends PluginBaseEntity {
|
|||
return null;
|
||||
}
|
||||
|
||||
private JSONObject send(JSONObject jsonObject,SalesContractEntity contractEntity){
|
||||
JSONObject token=new JSONObject();
|
||||
private JSONObject send(JSONArray jsonArray,SalesContractEntity contractEntity){
|
||||
if(CollectionUtils.isNotEmpty(jsonArray)) {
|
||||
JSONObject token = new JSONObject();
|
||||
//获取TOKEN
|
||||
String tokenResult = HttpRequest.post(url).
|
||||
header("appId", "800050").
|
||||
|
@ -213,9 +199,9 @@ public class ContractAnnexFileUploadPluginInitializer extends PluginBaseEntity {
|
|||
body(token.toString()).
|
||||
execute().
|
||||
body();
|
||||
logger.error("销售合同附件上传BIPtoken返回结果:"+tokenResult);
|
||||
logger.error("销售合同附件上传BIPtoken返回结果:" + tokenResult);
|
||||
JSONObject tokenResultJson = JSONObject.parseObject(tokenResult);
|
||||
if(!tokenResultJson.getBoolean("flag")){
|
||||
if (!tokenResultJson.getBoolean("flag")) {
|
||||
logger.info("=========销售合同上传附件获取biptoken错误,开始修改销售合同附件上传推送标识为失败==========");
|
||||
contractEntity.setIpopush("0");
|
||||
contractEntity.setHtnrpush("0");
|
||||
|
@ -224,7 +210,7 @@ public class ContractAnnexFileUploadPluginInitializer extends PluginBaseEntity {
|
|||
return null;
|
||||
}
|
||||
String tokenBody = tokenResultJson.getJSONObject("attribute").getJSONObject("data").getString("access_token");
|
||||
logger.error("销售合同附件上传推送BIP请求参数:"+jsonObject.toJSONString());
|
||||
logger.error("销售合同附件上传推送BIP请求参数:" + JSON.toJSONString(jsonArray));
|
||||
//发送数据
|
||||
String result = HttpRequest.post(url).
|
||||
header("appId", "800050").
|
||||
|
@ -232,13 +218,14 @@ public class ContractAnnexFileUploadPluginInitializer extends PluginBaseEntity {
|
|||
header("access_token", tokenBody).
|
||||
header("publicKey", "ZJYAQ/VtQ66PqKXlV0EowrrlKkhBHYgS/Zk39Q5ezIQne51Ce7eDIk+3zDUT+v578prj").
|
||||
header("secretKey", "iLLk424Bmzknbu+ROeJoiVDMYY5EFXtbZY/aU13HmVYIiQrIw9c0Ag4ipxbfpUqqj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
|
||||
body(jsonObject.toString()).
|
||||
body(JSON.toJSONString(jsonArray)).
|
||||
execute().
|
||||
body();
|
||||
logger.error("销售合同附件上传BIP返回结果:"+result);
|
||||
JSONObject resultJson = JSONObject.parseObject(result);
|
||||
return resultJson;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void saveTaskLivingDetails(String rootAppPk,String rootAppBill,String rootAppNewData,String newTransmitInfo,boolean flag) {
|
||||
try {
|
||||
|
|
|
@ -0,0 +1,252 @@
|
|||
package com.hzya.frame.plugin.salesContract.plugin;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.base.PluginBaseEntity;
|
||||
import com.hzya.frame.plugin.salesContract.dao.ISalesContractDao;
|
||||
import com.hzya.frame.plugin.salesContract.entity.SalesContractEntity;
|
||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
|
||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
|
||||
import com.hzya.frame.uuid.UUIDUtils;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.Base64;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class IpoAnnexFileUploadPluginInitializer extends PluginBaseEntity {
|
||||
Logger logger = LoggerFactory.getLogger(IpoAnnexFileUploadPluginInitializer.class);
|
||||
|
||||
@Autowired
|
||||
private ISalesContractDao salesContractDao;
|
||||
|
||||
@Autowired
|
||||
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
|
||||
|
||||
@Value("${zt.url}")
|
||||
private String url;
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginId() {
|
||||
return "IpoAnnexFileUploadPluginInitializer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "销售合同IPO附件上传";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginLabel() {
|
||||
return "IpoAnnexFileUploadPluginInitializer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginType() {
|
||||
return "1";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonResultEntity executeBusiness(JSONObject requestJson) {
|
||||
try {
|
||||
logger.info("======开始执行销售合同IPO附件上传BIP========");
|
||||
//重试方法
|
||||
if (null != requestJson) {
|
||||
//如果这个id不为空,说明是重试的
|
||||
String id = requestJson.getString("integration_task_living_details_id");
|
||||
//执行重新发送
|
||||
SalesContractEntity salesContractEntity = new SalesContractEntity();
|
||||
salesContractEntity.setDataSourceCode("SW-OA");
|
||||
if (StrUtil.isNotEmpty(id)) {
|
||||
salesContractEntity.setId(id);
|
||||
}
|
||||
//查询未上传的数据
|
||||
List<SalesContractEntity> salesContractEntities = salesContractDao.queryIPOAnnexFile(salesContractEntity);
|
||||
if(salesContractEntities == null || salesContractEntities.size() == 0){
|
||||
logger.info("=====没有需要上传BIP的销售合同IPO附件==========");
|
||||
return BaseResult.getSuccessMessageEntity("查询成功");
|
||||
}
|
||||
JSONObject resultJson=null;
|
||||
SalesContractEntity salesContract=new SalesContractEntity();
|
||||
salesContract.setDataSourceCode("SW-OA");
|
||||
for (SalesContractEntity contractEntity : salesContractEntities) {
|
||||
if(null !=contractEntity.getIpofilename() && null == contractEntity.getIpopush()){
|
||||
JSONArray jsonArray=new JSONArray();
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put("filename",contractEntity.getIpofilename());
|
||||
jsonObject.put("billtype",contractEntity.getBilltype());
|
||||
jsonObject.put("billid",contractEntity.getBillid());
|
||||
jsonObject.put("billcode",contractEntity.getBillcode());
|
||||
jsonObject.put("pk_org",contractEntity.getPkOrg());
|
||||
String file_url = contractEntity.getIpoid();
|
||||
String newPath = "E:\\yongansystem\\upload\\reuce\\"+contractEntity.getIpofilename();
|
||||
downOaFile(file_url,contractEntity.getIpofilename(),newPath);
|
||||
//本地文件转为base64
|
||||
String base64 = getBase64(newPath);
|
||||
jsonObject.put("file",base64);
|
||||
jsonArray.add(jsonObject);
|
||||
resultJson = send(jsonArray, contractEntity);
|
||||
logger.error("销售合同ipo附件上传BIP返回结果:" + resultJson.toJSONString());
|
||||
salesContract.setId(contractEntity.getId());
|
||||
}
|
||||
}
|
||||
if(null !=resultJson){
|
||||
if(!resultJson.getBoolean("flag")){
|
||||
logger.info("=========销售合同ipo附件上传bip返回结果错误,开始修改销售合同ipo附件上传推送标识为失败==========");
|
||||
salesContract.setIpopush("0");
|
||||
salesContractDao.updateAnnexFile(salesContract);
|
||||
logger.info("=========销售合同ipo附件上传获取bip返回结果错误,修改销售合同ipo附件上传推送标识为失败完毕==========");
|
||||
//saveTaskLivingDetails(contractEntity.getId(),contractEntity.getBillcode(),jsonObject.toString(),resultJson.toJSONString(),false);
|
||||
}else {
|
||||
logger.info("=========销售合同ipo附件上传bip返回结果成功,开始修改销售合同ipo附件上传推送标识为成功==========");
|
||||
salesContract.setIpopush("1");
|
||||
salesContractDao.updateAnnexFile(salesContract);
|
||||
logger.info("=========销售合同ipo附件上传bip返回结果成功,修改销售合同ipo附件上传推送标识为成功完毕==========");
|
||||
// saveTaskLivingDetails(contractEntity.getId(),contractEntity.getBillcode(),jsonObject.toString(),resultJson.toJSONString(),true);
|
||||
}
|
||||
}else{
|
||||
logger.info("=======没有销售合同IPO附件上传BIP=======");
|
||||
}
|
||||
logger.info("=======销售合同IPO附件上传BIP执行成功=======");
|
||||
return BaseResult.getSuccessMessageEntity("销售合同IPO附件上传执行成功");
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.info("======执行销售合同IPO附件上传BIP失败:{}========", e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void downOaFile(String fileUrl, String fileName,String newPath) {
|
||||
logger.info("开始下载附件"+newPath);
|
||||
String token = getToken();
|
||||
logger.info("获取的token信息");
|
||||
String baseUrl = "https://swoa.sunwave.com.cn:9999/seeyon/rest/attachment/file/"+fileUrl+"?fileName="+fileName+"&token="+token;
|
||||
logger.info("要下载附件的URL"+baseUrl);
|
||||
HttpResponse response = HttpRequest.get(baseUrl).timeout(20000).execute();
|
||||
File uploadFile = new File(newPath);
|
||||
response.writeBody(uploadFile);
|
||||
}
|
||||
|
||||
private String getToken() {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
HashMap<String,String> hashMap = new HashMap<>();
|
||||
hashMap.put("userName","hzyaRestUser");
|
||||
hashMap.put("password","hzya1314");
|
||||
hashMap.put("loginName","fkmanager");
|
||||
String result = HttpUtil.post("https://swoa.sunwave.com.cn:9999/seeyon/rest/token", JSON.toJSONString(hashMap));
|
||||
jsonObject = JSONObject.parseObject(result);
|
||||
if("".equals(result) || result == null){
|
||||
logger.info("获取token失败!");
|
||||
throw new RuntimeException("获取token失败!");
|
||||
}else{
|
||||
String token = jsonObject.get("id").toString();
|
||||
return token ;
|
||||
}
|
||||
}
|
||||
|
||||
//将本地文件转为base64编码
|
||||
private String getBase64(String filePath) {
|
||||
File file = new File(filePath);
|
||||
try {
|
||||
FileInputStream fileInputStream = new FileInputStream(file);
|
||||
byte[] bytes = new byte[(int) file.length()];
|
||||
fileInputStream.read(bytes);
|
||||
return Base64.getEncoder().encodeToString(bytes);
|
||||
}catch (Exception e){
|
||||
logger.info("========文件转base64失败:{}=====",e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private JSONObject send(JSONArray jsonArray,SalesContractEntity contractEntity){
|
||||
if(CollectionUtils.isNotEmpty(jsonArray)) {
|
||||
JSONObject token = new JSONObject();
|
||||
//获取TOKEN
|
||||
String tokenResult = HttpRequest.post(url).
|
||||
header("appId", "800050").
|
||||
header("apiCode", "8000500003").
|
||||
header("publicKey", "ZJYAQ/VtQ66PqKXlV0EowrrlKkhBHYgS/Zk39Q5ezIQne51Ce7eDIk+3zDUT+v578prj").
|
||||
header("secretKey", "iLLk424Bmzknbu+ROeJoiVDMYY5EFXtbZY/aU13HmVYIiQrIw9c0Ag4ipxbfpUqqj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
|
||||
body(token.toString()).
|
||||
execute().
|
||||
body();
|
||||
logger.error("销售合同IPO附件上传BIPtoken返回结果:" + tokenResult);
|
||||
JSONObject tokenResultJson = JSONObject.parseObject(tokenResult);
|
||||
if (!tokenResultJson.getBoolean("flag")) {
|
||||
logger.info("=========销售合同上传IPO附件获取biptoken错误,开始修改销售合同附件上传推送标识为失败==========");
|
||||
contractEntity.setIpopush("0");
|
||||
contractEntity.setHtnrpush("0");
|
||||
salesContractDao.updateAnnexFile(contractEntity);
|
||||
logger.info("=========销售合同IPO附件上传获取biptoken错误,修改销售合同附件上传推送标识完毕==========");
|
||||
return null;
|
||||
}
|
||||
String tokenBody = tokenResultJson.getJSONObject("attribute").getJSONObject("data").getString("access_token");
|
||||
logger.error("销售合同IPO附件上传推送BIP请求参数:" + JSON.toJSONString(jsonArray));
|
||||
//发送数据
|
||||
String result = HttpRequest.post(url).
|
||||
header("appId", "800050").
|
||||
header("apiCode", "8000500022").
|
||||
header("access_token", tokenBody).
|
||||
header("publicKey", "ZJYAQ/VtQ66PqKXlV0EowrrlKkhBHYgS/Zk39Q5ezIQne51Ce7eDIk+3zDUT+v578prj").
|
||||
header("secretKey", "iLLk424Bmzknbu+ROeJoiVDMYY5EFXtbZY/aU13HmVYIiQrIw9c0Ag4ipxbfpUqqj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
|
||||
body(JSON.toJSONString(jsonArray)).
|
||||
execute().
|
||||
body();
|
||||
JSONObject resultJson = JSONObject.parseObject(result);
|
||||
return resultJson;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void saveTaskLivingDetails(String rootAppPk,String rootAppBill,String rootAppNewData,String newTransmitInfo,boolean flag) {
|
||||
try {
|
||||
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
|
||||
integrationTaskLivingDetailsEntity.setId(UUIDUtils.getUUID());
|
||||
integrationTaskLivingDetailsEntity.setSts("Y");
|
||||
integrationTaskLivingDetailsEntity.setCreate_user_id("1");
|
||||
integrationTaskLivingDetailsEntity.setModify_user_id("1");
|
||||
integrationTaskLivingDetailsEntity.setCreate_time(new Date());
|
||||
integrationTaskLivingDetailsEntity.setModify_time(new Date());
|
||||
integrationTaskLivingDetailsEntity.setOrg_id("0");
|
||||
integrationTaskLivingDetailsEntity.setCompanyId("0");
|
||||
integrationTaskLivingDetailsEntity.setRootAppPk(rootAppPk);
|
||||
integrationTaskLivingDetailsEntity.setRootAppBill(rootAppBill);
|
||||
integrationTaskLivingDetailsEntity.setPluginId("SalesContractPluginInitializer");
|
||||
integrationTaskLivingDetailsEntity.setRootAppNewData(rootAppNewData);
|
||||
integrationTaskLivingDetailsEntity.setNewTransmitInfo(newTransmitInfo);
|
||||
if (flag) {
|
||||
taskLivingDetailsService.saveLogToSuccess(integrationTaskLivingDetailsEntity);
|
||||
} else {
|
||||
taskLivingDetailsService.saveLogToFail(integrationTaskLivingDetailsEntity);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.info("保存日志到集成任务日志明细中失败:{}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plugin>
|
||||
<id>SalesContractPluginInitializer</id>
|
||||
<name>SalesContractPluginInitializer插件</name>
|
||||
<category>90000099</category>
|
||||
</plugin>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans default-autowire="byName">
|
||||
<bean name="SalesContractDaoImpl" class="com.hzya.frame.plugin.salesContract.dao.impl.SalesContractDaoImpl" />
|
||||
</beans>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans default-autowire="byName">
|
||||
<bean name="SalesContractPluginInitializer" class="com.hzya.frame.plugin.salesContract.plugin.SalesContractPluginInitializer" />
|
||||
<bean name="ContractAnnexFileUploadPluginInitializer" class="com.hzya.frame.plugin.salesContract.plugin.ContractAnnexFileUploadPluginInitializer" />
|
||||
<bean name="IpoAnnexFileUploadPluginInitializer" class="com.hzya.frame.plugin.salesContract.plugin.IpoAnnexFileUploadPluginInitializer" />
|
||||
</beans>
|
Loading…
Reference in New Issue