Merge branch 'sw' of http://192.168.2.237:3000/root/kangarooDataCenterV3 into sw
This commit is contained in:
commit
ceffbf034a
|
@ -0,0 +1,17 @@
|
|||
package com.hzya.frame.plugin.SendContract.dao;
|
||||
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
import com.hzya.frame.plugin.SendContract.entity.SendContractEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ISendContractDao extends IBaseDao<SendContractEntity, String> {
|
||||
|
||||
Integer updateData(SendContractEntity updatedata);
|
||||
|
||||
List<SendContractEntity> querySend(SendContractEntity sendContractEntity);
|
||||
|
||||
List<SendContractEntity> querySendHtdd(SendContractEntity sendContractEntity);
|
||||
|
||||
Integer updatehtddData(SendContractEntity updatedata);
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.hzya.frame.plugin.SendContract.dao.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
import com.hzya.frame.plugin.SendContract.dao.ISendContractDao;
|
||||
import com.hzya.frame.plugin.SendContract.entity.SendContractEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class SendContractDaoImpl extends MybatisGenericDao<SendContractEntity, String> implements ISendContractDao {
|
||||
|
||||
@DS("#o.dataSourceCode")
|
||||
@Override
|
||||
public Integer updateData(SendContractEntity o) {
|
||||
return super.update(getSqlIdPrifx() + "updateData", o);
|
||||
}
|
||||
@DS("#o.dataSourceCode")
|
||||
@Override
|
||||
public List<SendContractEntity> querySend(SendContractEntity o) {
|
||||
return super.queryBase(o);
|
||||
}
|
||||
@DS("#o.dataSourceCode")
|
||||
@Override
|
||||
public List<SendContractEntity> querySendHtdd(SendContractEntity o) {
|
||||
return super.query(getSqlIdPrifx() + "querySendHtdd", o);
|
||||
}
|
||||
@DS("#o.dataSourceCode")
|
||||
@Override
|
||||
public Integer updatehtddData(SendContractEntity o) {
|
||||
return super.update(getSqlIdPrifx() + "updatehtddData", o);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package com.hzya.frame.plugin.SendContract.entity;
|
||||
|
||||
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
|
||||
public class SendContractEntity extends BaseEntity {
|
||||
|
||||
//id 重试使用
|
||||
private String id;
|
||||
//项目编码
|
||||
private String projectCode;
|
||||
//项目名称
|
||||
private String projectName;
|
||||
//状态 空是未发送 0、失败 1、成功
|
||||
private String status;
|
||||
//描述
|
||||
private String msg;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getProjectCode() {
|
||||
return projectCode;
|
||||
}
|
||||
|
||||
public void setProjectCode(String projectCode) {
|
||||
this.projectCode = projectCode;
|
||||
}
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
<?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.SendContract.dao.impl.SendContractDaoImpl">
|
||||
|
||||
|
||||
|
||||
<select id="entity_list_base" resultType="com.hzya.frame.plugin.SendContract.entity.SendContractEntity"
|
||||
parameterType="com.hzya.frame.plugin.SendContract.entity.SendContractEntity">
|
||||
SELECT
|
||||
id,
|
||||
field0007 as projectCode,
|
||||
field0009 as projectName
|
||||
FROM
|
||||
formmain_0219
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
field0429 is null
|
||||
<if test="id != null and id !='' ">and id = #{id}</if>
|
||||
<![CDATA[ and ROWNUM <= 50 ]]>
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<update id="updateData" parameterType="com.hzya.frame.plugin.SendContract.entity.SendContractEntity">
|
||||
update formmain_0219 set
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="status != null and status != ''"> field0429 = #{status},</if>
|
||||
<if test="msg != null and msg != ''"> field0430 = #{msg},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
<select id="querySendHtdd" resultType="com.hzya.frame.plugin.SendContract.entity.SendContractEntity"
|
||||
parameterType="com.hzya.frame.plugin.SendContract.entity.SendContractEntity">
|
||||
SELECT
|
||||
id
|
||||
|
||||
FROM
|
||||
formmain_8694
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
field0129 is null
|
||||
<if test="id != null and id !='' ">id = #{id}</if>
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
|
||||
<update id="updatehtddData" parameterType="com.hzya.frame.plugin.SendContract.entity.SendContractEntity">
|
||||
update formmain_8694 set
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="status != null and status != ''"> field0129 = #{status},</if>
|
||||
<if test="msg != null and msg != ''"> field0130 = #{msg},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,214 @@
|
|||
package com.hzya.frame.plugin.SendContract.plugin;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.base.PluginBaseEntity;
|
||||
import com.hzya.frame.plugin.SendContract.dao.ISendContractDao;
|
||||
import com.hzya.frame.plugin.SendContract.entity.SendContractEntity;
|
||||
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.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 业务数据同步
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-21 13:52:35
|
||||
*/
|
||||
public class SendContractOrderGoodsPluginInitializer extends PluginBaseEntity {
|
||||
Logger logger = LoggerFactory.getLogger(SendContractOrderGoodsPluginInitializer.class);
|
||||
@Autowired
|
||||
private ISendContractDao sendContractDao;
|
||||
|
||||
@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 "SendContractOrderGoodsPluginInitializer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "业务数据抽取";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginLabel() {
|
||||
return "SendContractOrderGoodsPluginInitializer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginType() {
|
||||
return "1";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JsonResultEntity executeBusiness(JSONObject requestJson) {
|
||||
try {
|
||||
logger.info("======开始执行OA合同数据信息同步========");
|
||||
//重试方法
|
||||
if (null != requestJson) {
|
||||
//如果这个id不为空,说明是重试的
|
||||
String id = requestJson.getString("integration_task_living_details_id");
|
||||
//执行重新发送
|
||||
SendContractEntity sendContractEntity = new SendContractEntity();
|
||||
sendContractEntity.setDataSourceCode("SW-OA");
|
||||
if (StrUtil.isNotEmpty(id)) {
|
||||
sendContractEntity.setId(id);
|
||||
}
|
||||
//查询数据
|
||||
List<SendContractEntity> sendContractEntityList = sendContractDao.querySendHtdd(sendContractEntity);
|
||||
if(sendContractEntityList == null || sendContractEntityList.size() == 0){
|
||||
return BaseResult.getSuccessMessageEntity("执行成功");
|
||||
}
|
||||
for (int i = 0; i < sendContractEntityList.size(); i++) {
|
||||
//组装数据
|
||||
JSONObject sendData = getSendData(sendContractEntityList.get(i));
|
||||
JSONObject tokenData = getBipTokenData();
|
||||
SendContractEntity updatedata = new SendContractEntity();
|
||||
updatedata.setDataSourceCode("SW-OA");
|
||||
updatedata.setId(sendContractEntityList.get(i).getId());
|
||||
//获取TOKEN
|
||||
String tokenResult = HttpRequest.post(url).
|
||||
header("appId", "800050").
|
||||
header("apiCode", "8000500003").
|
||||
header("publicKey", "ZJYAM2YFEIsIaI1e4wMagkS2Q7SFgGk0RvsPhEES45m/OVFCe7eDIk+3zDUT+v578prj").
|
||||
header("secretKey", "lR6+uf94mvNMclAB43oIwmhJSMDzQaViTkfXLeNvmGdpLfbFiUvbgbU+p43zO25Zj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
|
||||
body(tokenData.toString()).
|
||||
execute().
|
||||
body();
|
||||
logger.error("合同BIPtoken返回:"+tokenResult);
|
||||
JSONObject tokenResultJson = JSONObject.parseObject(tokenResult);
|
||||
if(!tokenResultJson.getBoolean("flag")){
|
||||
updatedata.setStatus("0");
|
||||
updatedata.setMsg("执行失败,Token获取失败");
|
||||
sendContractDao.updateData(updatedata);
|
||||
continue;
|
||||
}
|
||||
String tokenBody = tokenResultJson.getJSONObject("attribute").getJSONObject("data").getString("access_token");
|
||||
//发送数据
|
||||
String result = HttpRequest.post(url).
|
||||
header("appId", "800050").
|
||||
header("apiCode", "8000500010").
|
||||
header("access_token", tokenBody).
|
||||
header("publicKey", "ZJYAM2YFEIsIaI1e4wMagkS2Q7SFgGk0RvsPhEES45m/OVFCe7eDIk+3zDUT+v578prj").
|
||||
header("secretKey", "lR6+uf94mvNMclAB43oIwmhJSMDzQaViTkfXLeNvmGdpLfbFiUvbgbU+p43zO25Zj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
|
||||
body(sendData.toString()).
|
||||
execute().
|
||||
body();
|
||||
JSONObject resultJson = JSONObject.parseObject(result);
|
||||
if(!resultJson.getBoolean("flag")){
|
||||
updatedata.setStatus("0");
|
||||
updatedata.setMsg("发送失败"+resultJson.getString("msg"));
|
||||
sendContractDao.updatehtddData(updatedata);
|
||||
saveTaskLivingDetails(sendContractEntityList.get(i).getId(),sendContractEntityList.get(i).getId(),sendContractEntityList.get(i).getId(),tokenBody,false);
|
||||
}else {
|
||||
updatedata.setStatus("1");
|
||||
updatedata.setMsg("发送成功");
|
||||
sendContractDao.updatehtddData(updatedata);
|
||||
saveTaskLivingDetails(sendContractEntityList.get(i).getId(),sendContractEntityList.get(i).getId(),sendContractEntityList.get(i).getId(),tokenBody,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.info("执行成功");
|
||||
return BaseResult.getSuccessMessageEntity("执行成功");
|
||||
} catch (Exception e) {
|
||||
logger.info("======执行OA合同数据同步失败:{}========", e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return BaseResult.getFailureMessageEntity("执行失败");
|
||||
}
|
||||
|
||||
private JSONObject getBipTokenData() {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
||||
|
||||
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 组装数据
|
||||
* @Date 2:21 下午 2025/1/6
|
||||
* @param sendContractEntity
|
||||
* @return com.alibaba.fastjson.JSONObject
|
||||
**/
|
||||
private JSONObject getSendData(SendContractEntity sendContractEntity) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
JSONObject htdd01Master = new JSONObject();
|
||||
|
||||
htdd01Master.put("pk_group","SW01");
|
||||
htdd01Master.put("pk_org","666");//公司编码
|
||||
htdd01Master.put("contractno","合同号编码");
|
||||
htdd01Master.put("name","合同档案名称");
|
||||
htdd01Master.put("creator","sw02");
|
||||
htdd01Master.put("creationtime","2024-12-06 09:32:44");
|
||||
htdd01Master.put("contractor","订单负责人");
|
||||
htdd01Master.put("cdeptid","60");
|
||||
htdd01Master.put("approvestatus","-1");//审批状态默认-1
|
||||
htdd01Master.put("belongtodeptid","600219");
|
||||
htdd01Master.put("dpk_custclass","01");
|
||||
htdd01Master.put("dcustomerid","0100009");
|
||||
htdd01Master.put("zcustomerid","0100009");
|
||||
htdd01Master.put("cinvoicecustid","0100009");
|
||||
htdd01Master.put("cemployeeid","66601");
|
||||
htdd01Master.put("ccurrencyid","SGD");
|
||||
htdd01Master.put("totalamount","2000");
|
||||
htdd01Master.put("rmbtotalamount","2200");
|
||||
htdd01Master.put("presentrate","1.1");
|
||||
|
||||
jsonObject.put("htdd01Master",htdd01Master);
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
|
||||
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("SendContractOrderGoodsPluginInitializer");
|
||||
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,217 @@
|
|||
package com.hzya.frame.plugin.SendContract.plugin;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.base.PluginBaseEntity;
|
||||
import com.hzya.frame.plugin.SendContract.dao.ISendContractDao;
|
||||
import com.hzya.frame.plugin.SendContract.entity.SendContractEntity;
|
||||
import com.hzya.frame.plugin.SendContract.service.ISendContractService;
|
||||
import com.hzya.frame.sysnew.comparison.serviceData.service.IServiceDataService;
|
||||
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.bson.json.JsonObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 业务数据同步
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-21 13:52:35
|
||||
*/
|
||||
public class SendContractPluginInitializer extends PluginBaseEntity {
|
||||
Logger logger = LoggerFactory.getLogger(SendContractPluginInitializer.class);
|
||||
@Autowired
|
||||
private ISendContractDao sendContractDao;
|
||||
|
||||
@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 "SendContractPluginInitializer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "业务数据抽取";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginLabel() {
|
||||
return "SendContractPluginInitializer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginType() {
|
||||
return "1";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonResultEntity executeBusiness(JSONObject requestJson) {
|
||||
try {
|
||||
logger.info("======开始执行OA合同数据信息同步========");
|
||||
//重试方法
|
||||
if (null != requestJson) {
|
||||
//如果这个id不为空,说明是重试的
|
||||
String id = requestJson.getString("integration_task_living_details_id");
|
||||
//执行重新发送
|
||||
SendContractEntity sendContractEntity = new SendContractEntity();
|
||||
sendContractEntity.setDataSourceCode("SW-OA");
|
||||
if (StrUtil.isNotEmpty(id)) {
|
||||
sendContractEntity.setId(id);
|
||||
}
|
||||
//查询数据
|
||||
List<SendContractEntity> sendContractEntityList = sendContractDao.querySend(sendContractEntity);
|
||||
if(sendContractEntityList == null || sendContractEntityList.size() == 0){
|
||||
return BaseResult.getSuccessMessageEntity("执行成功");
|
||||
}
|
||||
for (int i = 0; i < sendContractEntityList.size(); i++) {
|
||||
//组装数据
|
||||
JSONObject sendData = getSendData(sendContractEntityList.get(i));
|
||||
JSONObject tokenData = getBipTokenData();
|
||||
SendContractEntity updatedata = new SendContractEntity();
|
||||
updatedata.setDataSourceCode("SW-OA");
|
||||
updatedata.setId(sendContractEntityList.get(i).getId());
|
||||
//获取TOKEN
|
||||
String tokenResult = HttpRequest.post(url).
|
||||
header("appId", "800050").
|
||||
header("apiCode", "8000500003").
|
||||
header("publicKey", "ZJYAM2YFEIsIaI1e4wMagkS2Q7SFgGk0RvsPhEES45m/OVFCe7eDIk+3zDUT+v578prj").
|
||||
header("secretKey", "lR6+uf94mvNMclAB43oIwmhJSMDzQaViTkfXLeNvmGdpLfbFiUvbgbU+p43zO25Zj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
|
||||
body(tokenData.toString()).
|
||||
execute().
|
||||
body();
|
||||
logger.error("合同BIPtoken返回:"+tokenResult);
|
||||
JSONObject tokenResultJson = JSONObject.parseObject(tokenResult);
|
||||
if(!tokenResultJson.getBoolean("flag")){
|
||||
updatedata.setStatus("0");
|
||||
updatedata.setMsg("执行失败,Token获取失败");
|
||||
sendContractDao.updateData(updatedata);
|
||||
continue;
|
||||
}
|
||||
String tokenBody = tokenResultJson.getJSONObject("attribute").getJSONObject("data").getString("access_token");
|
||||
//发送数据
|
||||
String result = HttpRequest.post(url).
|
||||
header("appId", "800050").
|
||||
header("apiCode", "8000500010").
|
||||
header("access_token", tokenBody).
|
||||
header("publicKey", "ZJYAM2YFEIsIaI1e4wMagkS2Q7SFgGk0RvsPhEES45m/OVFCe7eDIk+3zDUT+v578prj").
|
||||
header("secretKey", "lR6+uf94mvNMclAB43oIwmhJSMDzQaViTkfXLeNvmGdpLfbFiUvbgbU+p43zO25Zj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
|
||||
body(sendData.toString()).
|
||||
execute().
|
||||
body();
|
||||
JSONObject resultJson = JSONObject.parseObject(result);
|
||||
if(!resultJson.getBoolean("flag")){
|
||||
updatedata.setStatus("0");
|
||||
updatedata.setMsg("发送失败"+resultJson.getString("msg"));
|
||||
sendContractDao.updateData(updatedata);
|
||||
saveTaskLivingDetails(sendContractEntityList.get(i).getId(),sendContractEntityList.get(i).getId(),sendContractEntityList.get(i).getId(),tokenBody,false);
|
||||
}else {
|
||||
updatedata.setStatus("1");
|
||||
updatedata.setMsg("发送成功");
|
||||
sendContractDao.updateData(updatedata);
|
||||
saveTaskLivingDetails(sendContractEntityList.get(i).getId(),sendContractEntityList.get(i).getId(),sendContractEntityList.get(i).getId(),tokenBody,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.info("执行成功");
|
||||
return BaseResult.getSuccessMessageEntity("执行成功");
|
||||
} catch (Exception e) {
|
||||
logger.info("======执行OA合同数据同步失败:{}========", e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return BaseResult.getFailureMessageEntity("执行失败");
|
||||
}
|
||||
|
||||
private JSONObject getBipTokenData() {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
||||
|
||||
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 组装数据
|
||||
* @Date 2:21 下午 2025/1/6
|
||||
* @param sendContractEntity
|
||||
* @return com.alibaba.fastjson.JSONObject
|
||||
**/
|
||||
private JSONObject getSendData(SendContractEntity sendContractEntity) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
JSONObject ufinterface = new JSONObject();
|
||||
JSONObject bill = new JSONObject();
|
||||
JSONObject billhead = new JSONObject();
|
||||
ufinterface.put("account","SW01");
|
||||
ufinterface.put("billtype","project");
|
||||
ufinterface.put("groupcode","SW01");
|
||||
ufinterface.put("isexchange","Y");
|
||||
ufinterface.put("replace","Y");
|
||||
ufinterface.put("sender","default");
|
||||
ufinterface.put("id",sendContractEntity.getId());
|
||||
ufinterface.put("pk_defdoclist","HHWDH");
|
||||
|
||||
billhead.put("filesource","1");
|
||||
billhead.put("creator","OA01");
|
||||
billhead.put("transi_type","4D10-01");
|
||||
billhead.put("bill_type","4D10");
|
||||
billhead.put("pk_eps","0202");
|
||||
billhead.put("pk_group","SW01");
|
||||
billhead.put("pk_org","666");
|
||||
billhead.put("project_code",sendContractEntity.getProjectCode());
|
||||
billhead.put("project_name",sendContractEntity.getProjectName());
|
||||
bill.put("billhead",billhead);
|
||||
ufinterface.put("bill",bill);
|
||||
jsonObject.put("ufinterface",ufinterface);
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
|
||||
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("SendContractPluginInitializer");
|
||||
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,9 @@
|
|||
package com.hzya.frame.plugin.SendContract.service;
|
||||
|
||||
|
||||
import com.hzya.frame.basedao.service.IBaseService;
|
||||
import com.hzya.frame.plugin.SendContract.entity.SendContractEntity;
|
||||
|
||||
public interface ISendContractService extends IBaseService<SendContractEntity, String> {
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.hzya.frame.plugin.SendContract.service.impl;
|
||||
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
import com.hzya.frame.plugin.SendContract.dao.ISendContractDao;
|
||||
import com.hzya.frame.plugin.SendContract.entity.SendContractEntity;
|
||||
import com.hzya.frame.plugin.SendContract.service.ISendContractService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
public class SendContractServiceImpl extends BaseService<SendContractEntity, String> implements ISendContractService {
|
||||
|
||||
private ISendContractDao sendContractDao;
|
||||
|
||||
@Autowired
|
||||
public void setPushMessageDao(ISendContractDao dao) {
|
||||
this.sendContractDao = dao;
|
||||
this.dao = dao;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plugin>
|
||||
<id>SendContractPluginInitializer</id>
|
||||
<name>SendContractPluginInitializer插件</name>
|
||||
<category>90000003</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="sendContractDao" class="com.hzya.frame.plugin.SendContract.dao.impl.SendContractDaoImpl" />
|
||||
</beans>
|
|
@ -0,0 +1,6 @@
|
|||
<?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="SendContractPluginInitializer" class="com.hzya.frame.plugin.SendContract.plugin.SendContractPluginInitializer" />
|
||||
<bean name="SendContractOrderGoodsPluginInitializer" class="com.hzya.frame.plugin.SendContract.plugin.SendContractOrderGoodsPluginInitializer" />
|
||||
</beans>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plugin>
|
||||
<id>SendContractOrderGoodsPluginInitializer</id>
|
||||
<name>SendContractOrderGoodsPluginInitializer插件</name>
|
||||
<category>90000004</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="SendContractOrderGoodsPluginInitializer" class="com.hzya.frame.plugin.SendContract.plugin.SendContractOrderGoodsPluginInitializer" />
|
||||
</beans>
|
Loading…
Reference in New Issue