This commit is contained in:
lvleigang 2025-06-10 16:07:28 +08:00
commit f2762e767c
41 changed files with 2282 additions and 58 deletions

View File

@ -56,6 +56,12 @@
<profile.active>hclocal</profile.active>
</properties>
</profile>
<profile>
<id>xel</id> <!--何灿-->
<properties>
<profile.active>xel</profile.active>
</properties>
</profile>
</profiles>
<build>
<finalName>kangarooDataCenterV3</finalName>

View File

@ -185,7 +185,9 @@ public class SendContractPluginInitializer extends PluginBaseEntity {
billhead.put("pk_group","SW01");
billhead.put("pk_org","666");
billhead.put("project_code",sendContractEntity.getProjectCode());
billhead.put("project_name",sendContractEntity.getProjectName());
//billhead.put("project_name",sendContractEntity.getProjectName());
//2025年6月6日17:46:45 相二林修改 三维通信BIP-致远OA接口群 胡飞洲让改的
billhead.put("project_name",sendContractEntity.getProjectCode());
billhead.put("def1",sendContractEntity.getKhcode());//BIP客户编码
bill.put("billhead",billhead);
ufinterface.put("bill",bill);

View File

@ -0,0 +1,29 @@
package com.hzya.frame.plugin.c4project.dao;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.plugin.c4project.entity.C4ProjectEntity;
import java.util.List;
public interface IC4ProjectDao extends IBaseDao<C4ProjectEntity,String> {
/**
*
* @content 查询研发项目立项数据推送C4项目档案
* @Param
* @Return
* @Author hecan
* @Date 2025-05-14 11:48
* **/
List<C4ProjectEntity> queryProjectToC4(C4ProjectEntity entity);
/**
*
* @content 新增数据到C4项目档案
* @Param
* @Return
* @Author hecan
* @Date 2025-05-14 11:53
* **/
Integer saveC4Project(C4ProjectEntity entity);
}

View File

@ -0,0 +1,22 @@
package com.hzya.frame.plugin.c4project.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.plugin.c4project.dao.IC4ProjectDao;
import com.hzya.frame.plugin.c4project.entity.C4ProjectEntity;
import java.util.List;
public class C4ProjectDaoImpl extends MybatisGenericDao<C4ProjectEntity,String> implements IC4ProjectDao {
@DS("#entity.dataSourceCode")
@Override
public List<C4ProjectEntity> queryProjectToC4(C4ProjectEntity entity) {
return (List<C4ProjectEntity>) super.selectList("queryProjectToC4",entity);
}
@DS("#entity.dataSourceCode")
@Override
public Integer saveC4Project(C4ProjectEntity entity) {
return super.insert("saveC4Project",entity);
}
}

View File

@ -0,0 +1,142 @@
package com.hzya.frame.plugin.c4project.entity;
import com.hzya.frame.web.entity.BaseEntity;
public class C4ProjectEntity extends BaseEntity {
private String caNo;//项目编号
private String caName;//项目名称
private String caTypenm;//项目类型
private String caManagernm;//项目负责人
private String caBegindate;//项目开始时间
private String caEnddate;//项目结束时间
private String caBudgetamt;//项目预算总额
private String caBudgetorg;//公司id
private String caBudgetornm;//公司名称
private String caFathernm;//项目档案
private String caFactmat;//项目实际到账额
private String caCoveramt;//项目实际报销额
private String caFulllevelno;//
private String startTime;//开始时间
private String endTime;//结束时间
public String getCaBudgetorg() {
return caBudgetorg;
}
public void setCaBudgetorg(String caBudgetorg) {
this.caBudgetorg = caBudgetorg;
}
public String getCaBudgetornm() {
return caBudgetornm;
}
public void setCaBudgetornm(String caBudgetornm) {
this.caBudgetornm = caBudgetornm;
}
public String getCaFathernm() {
return caFathernm;
}
public void setCaFathernm(String caFathernm) {
this.caFathernm = caFathernm;
}
public String getCaFactmat() {
return caFactmat;
}
public void setCaFactmat(String caFactmat) {
this.caFactmat = caFactmat;
}
public String getCaCoveramt() {
return caCoveramt;
}
public void setCaCoveramt(String caCoveramt) {
this.caCoveramt = caCoveramt;
}
public String getCaFulllevelno() {
return caFulllevelno;
}
public void setCaFulllevelno(String caFulllevelno) {
this.caFulllevelno = caFulllevelno;
}
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;
}
public String getCaNo() {
return caNo;
}
public void setCaNo(String caNo) {
this.caNo = caNo;
}
public String getCaName() {
return caName;
}
public void setCaName(String caName) {
this.caName = caName;
}
public String getCaTypenm() {
return caTypenm;
}
public void setCaTypenm(String caTypenm) {
this.caTypenm = caTypenm;
}
public String getCaManagernm() {
return caManagernm;
}
public void setCaManagernm(String caManagernm) {
this.caManagernm = caManagernm;
}
public String getCaBegindate() {
return caBegindate;
}
public void setCaBegindate(String caBegindate) {
this.caBegindate = caBegindate;
}
public String getCaEnddate() {
return caEnddate;
}
public void setCaEnddate(String caEnddate) {
this.caEnddate = caEnddate;
}
public String getCaBudgetamt() {
return caBudgetamt;
}
public void setCaBudgetamt(String caBudgetamt) {
this.caBudgetamt = caBudgetamt;
}
}

View File

@ -0,0 +1,86 @@
<?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.c4project.dao.impl.C4ProjectDaoImpl">
<resultMap id="get-C4ProjectEntity-result" type="com.hzya.frame.plugin.c4project.entity.C4ProjectEntity" >
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
<result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
<result property="sts" column="sts" jdbcType="VARCHAR"/>
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
</resultMap>
<sql id = "C4ProjectEntity_Base_Column_List">
main.id as id,
main.MODIFY_DATE as MODIFY_DATE,
'formmain_9555' as tab_name,
field0047 as caNo,
field0012 as caName,
field0080 as caTypenm,
ORG_MEMBER.name as caManagernm,
field0044 as caBegindate,
field0045 as caEnddate,
field0077 as caBudgetamt,
'670869647114347' as caBudgetorg,
'三维通信股份有限公司' as caBudgetornm,
'项目档案' as caFathernm,
'0' as caFactmat,
'0' as caCoveramt
</sql>
<!--查询研发项目立项推送BC4项目档案-->
<select id="queryProjectToC4" resultMap="get-C4ProjectEntity-result" parameterType = "com.hzya.frame.plugin.c4project.entity.C4ProjectEntity">
select
<include refid="C4ProjectEntity_Base_Column_List" />
from formmain_9555 main
-- LEFT JOIN COL_SUMMARY summary ON summary.FORM_RECORDID = main.id
left join ORG_MEMBER on ORG_MEMBER.id=field0020
WHERE 1=1 -- and summary.state in ('1','3') -- 2回退
AND MODIFY_DATE &gt;= TO_DATE('2025-03-07 11:00:00','yyyy-MM-dd HH24:mi:ss')
AND MODIFY_DATE &gt;= TO_DATE(#{startTime},'yyyy-MM-dd HH24:mi:ss')
and field0047 ='L120250503-R'
</select>
<!--新增所有列-->
<insert id="saveC4Project" parameterType="com.hzya.frame.plugin.c4project.entity.C4ProjectEntity">
insert into LEXMISC4_case(
<trim suffix="" suffixOverrides=",">
<if test="caBudgetorg != null and caBudgetorg != ''">CA_BUDGETORG ,</if>
<if test="caBudgetornm != null and caBudgetornm !='' ">CA_BUDGETORGNM ,</if>
<if test="caNo != null and caNo != '' ">CA_NO ,</if>
<if test="caName != null and caName != ''">CA_NAME ,</if>
<if test="caTypenm != null and caTypenm != ''">CA_TYPENM ,</if>
<if test="caManagernm != null and caManagernm != ''">CA_MANAGERNM ,</if>
<if test="caBegindate != null and caBegindate != ''">CA_BEGINDATE ,</if>
<if test="caEnddate != null and caEnddate != ''">CA_ENDDATE ,</if>
<if test="caFathernm != null and caFathernm != ''">CA_FATHERNM ,</if>
<if test="caBudgetamt != null and caBudgetamt != ''">CA_BUDGETAMT ,</if>
<if test="caFactmat != null and caFactmat != ''">CA_FACTAMT ,</if>
<if test="caCoveramt != null and caCoveramt != ''">CA_COVERAMT ,</if>
<if test="caFulllevelno != null and caFulllevelno != ''">CA_FULLLEVELNO </if>
</trim>
)values(
<trim suffix="" suffixOverrides=",">
<if test="caBudgetorg != null and caBudgetorg != ''">#{caBudgetorg} ,</if>
<if test="caBudgetornm != null and caBudgetornm !='' ">#{caBudgetornm} ,</if>
<if test="caNo != null and caNo != '' ">#{caNo} ,</if>
<if test="caName != null and caName != ''">#{caName} ,</if>
<if test="caTypenm != null and caTypenm != ''">#{caTypenm} ,</if>
<if test="caManagernm != null and caManagernm != ''">#{caManagernm} ,</if>
<if test="caBegindate != null and caBegindate != ''">TO_TIMESTAMP(#{caBegindate}, 'SYYYY-MM-DD HH24:MI:SS:FF6') ,</if>
<if test="caEnddate != null and caEnddate != ''">TO_TIMESTAMP(#{caEnddate}, 'SYYYY-MM-DD HH24:MI:SS:FF6') ,</if>
<if test="caFathernm != null and caFathernm != ''">#{caFathernm} ,</if>
<if test="caBudgetamt != null and caBudgetamt != ''">#{caBudgetamt} ,</if>
<if test="caFactmat != null and caFactmat != ''">#{caFactmat} ,</if>
<if test="caCoveramt != null and caCoveramt != ''">#{caCoveramt} ,</if>
<if test="caFulllevelno != null and caFulllevelno != ''">#{caFulllevelno} </if>
</trim>
)
</insert>
</mapper>

View File

@ -0,0 +1,124 @@
package com.hzya.frame.plugin.c4project.plugin;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.plugin.c4project.dao.IC4ProjectDao;
import com.hzya.frame.plugin.c4project.dao.impl.C4ProjectDaoImpl;
import com.hzya.frame.plugin.c4project.entity.C4ProjectEntity;
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 java.util.Date;
import java.util.List;
public class C4ProjectPluginInitializer extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(C4ProjectPluginInitializer.class);
@Autowired
private IC4ProjectDao ic4ProjectDao;
@Autowired
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
@Override
public void initialize() {
logger.info(getPluginLabel() + "執行初始化方法initialize()");
}
@Override
public void destroy() {
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
}
@Override
public String getPluginId() {
return "C4ProjectPluginInitializer";
}
@Override
public String getPluginName() {
return "研发项目立项生成C4项目档案";
}
@Override
public String getPluginLabel() {
return "C4ProjectPluginInitializer";
}
@Override
public String getPluginType() {
return "1";
}
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
try {
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");//定时任务执行时传入的开始时间
logger.info("=======研发项目立项推送C4项目档案的开始时间为{}=======",startTime);
logger.info("=======研发项目立项推送C4项目档案的结束时间为{}=======",endTime);
if(StrUtil.isEmpty(startTime)){
DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss");
}
logger.info("=======在:{}时间查询研发项目立项推送C4项目档案=======",startTime);
C4ProjectEntity c4ProjectEntity=new C4ProjectEntity();
c4ProjectEntity.setStartTime(startTime);
c4ProjectEntity.setDataSourceCode("SW-OA");
List<C4ProjectEntity> c4ProjectEntities = ic4ProjectDao.queryProjectToC4(c4ProjectEntity);
if(c4ProjectEntities == null || c4ProjectEntities.size() == 0){
logger.info("=====查询研发项目立项推送C4项目档案数据有:{}条",c4ProjectEntities.size());
return BaseResult.getSuccessMessageEntity("查询成功");
}
for (C4ProjectEntity projectEntity : c4ProjectEntities) {
projectEntity.setDataSourceCode("SW-OA");
projectEntity.setCaFulllevelno("@"+projectEntity.getCaNo()+"@");
projectEntity.setCaTypenm(projectEntity.getCaTypenm()==null?"项目类型":projectEntity.getCaTypenm());
logger.info("======开始将项目编号:{},项目名称:{}新增到C4项目档案中=======",projectEntity.getCaNo(),projectEntity.getCaName());
Integer integer = ic4ProjectDao.saveC4Project(projectEntity);
logger.info("======将项目编号:{},项目名称:{}新增到C4项目档案中完毕=======",projectEntity.getCaNo(),projectEntity.getCaName());
saveTaskLivingDetails(projectEntity.getId(),projectEntity.getCaNo(),JSONObject.parseObject(projectEntity.toString()).toJSONString(),String.valueOf(integer),true);
}
logger.info("=======研发项目立项推送C4项目档案执行成功=======");
return BaseResult.getSuccessMessageEntity("研发项目立项推送C4项目档案执行成功");
}catch (Exception e){
logger.info("========研发项目立项推送C4项目档案失败,:{}",e.getMessage());
e.printStackTrace();
}
return BaseResult.getFailureMessageEntity("研发项目立项推送C4项目档案执行成功");
}
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("C4ProjectPluginInitializer");
integrationTaskLivingDetailsEntity.setRootAppNewData(rootAppNewData);
integrationTaskLivingDetailsEntity.setNewTransmitInfo(newTransmitInfo);
if(flag){
taskLivingDetailsService.saveLogToSuccess(integrationTaskLivingDetailsEntity);
}else {
taskLivingDetailsService.saveLogToFail(integrationTaskLivingDetailsEntity);
}
}catch (Exception e){
logger.info("保存日志到集成任务日志明细中失败:{}",e.getMessage());
}
}
}

View File

@ -743,7 +743,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
map1.put("tableName",mainDb);
//map1.put("dataStatus", "F");
map1.put("updateStatus", "0");
map1.put("size", 50);
//map1.put("size", 50);
objects = mdmModuleDao.queryMdmSTs(map1);
objects = toLowerCaseKeys(objects);
@ -892,16 +892,30 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
if(jsonResultEntity.isFlag()){
//保存日志
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"2");
logger.info("=========主数据修改下发成功,修改下发状态为成功======");
Map<String, Object> updateMap = new HashMap<>();
updateMap.put("tableName",mainDb);
//updateMap.put("dataStatus", "F");
updateMap.put("updateStatus", "1");
updateMap.put("id", objects.get(i).getString("id"));
mdmModuleDao.updateMdmSTs(updateMap);
continue;
}else {
//保存日志
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败:"+jsonResultEntity.getAttribute(),mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"2");
logger.info("=========主数据修改下发失败,修改下发状态为失败======");
Map<String, Object> updateMap = new HashMap<>();
updateMap.put("tableName",mainDb);
//updateMap.put("dataStatus", "F");
updateMap.put("updateStatus", "2");
updateMap.put("id", objects.get(i).getString("id"));
mdmModuleDao.updateMdmSTs(updateMap);
continue;
}
}
}
//所有下发发送完成修改数据状态
/* //所有下发发送完成修改数据状态
for (int i = 0; i < objects.size(); i++) {
Map<String, Object> updateMap = new HashMap<>();
updateMap.put("tableName",mainDb);
@ -909,7 +923,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
updateMap.put("updateStatus", "1");
updateMap.put("id", objects.get(i).getString("id"));
mdmModuleDao.updateMdmSTs(updateMap);
}
}*/
}
/**
@ -937,7 +951,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
map1.put("tableName",mainDb);
//map1.put("dataStatus", "Y");
map1.put("addStatus", "0");
map1.put("size", 50);
//map1.put("size", 50);
objects = mdmModuleDao.queryMdmSTs(map1);
objects = toLowerCaseKeys(objects);
@ -1129,6 +1143,21 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
mdmModuleDistributeTripartiteEntity.setAppId(sysApplicationEntity.getId());
mdmModuleDistributeTripartiteEntity.setTripartiteId(backJsonResultEntity.getString("tripartiteId"));
mdmModuleDistributeTripartiteDao.save(mdmModuleDistributeTripartiteEntity);
logger.info("=========主数据下发成功,修改下发状态为成功======");
Map<String, Object> updateMap = new HashMap<>();
updateMap.put("tableName",mainDb);
//updateMap.put("dataStatus", "Y");
updateMap.put("addStatus", "1");
updateMap.put("id", objects.get(i).getString("id"));
mdmModuleDao.updateMdmSTs(updateMap);
}else{
logger.info("=========主数据下发失败,修改下发状态为失败======");
Map<String, Object> updateMap = new HashMap<>();
updateMap.put("tableName",mainDb);
//updateMap.put("dataStatus", "Y");
updateMap.put("addStatus", "2");
updateMap.put("id", objects.get(i).getString("id"));
mdmModuleDao.updateMdmSTs(updateMap);
}
}
} catch (Exception e) {
@ -1147,12 +1176,19 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败:"+jsonResultEntity.getAttribute(),mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
objects.get(i).put("sendsanfzt123",false);
logger.info("========主数据新增下发完成,日志保存为失败============");
logger.info("=========主数据下发失败,修改下发状态为失败======");
Map<String, Object> updateMap = new HashMap<>();
updateMap.put("tableName",mainDb);
//updateMap.put("dataStatus", "Y");
updateMap.put("addStatus", "2");
updateMap.put("id", objects.get(i).getString("id"));
mdmModuleDao.updateMdmSTs(updateMap);
continue;
}
}
}
//所有下发发送完成修改数据状态
/* //所有下发发送完成修改数据状态
for (int i = 0; i < objects.size(); i++) {
if(objects.get(i).getBoolean("sendsanfzt123")){
Map<String, Object> updateMap = new HashMap<>();
@ -1162,7 +1198,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
updateMap.put("id", objects.get(i).getString("id"));
mdmModuleDao.updateMdmSTs(updateMap);
}
}
}*/
}
private void saveMdmModuleSendLogEntity(Long mdmCode,String distributeId,String dataType,String remark,String dbname,String formmain_id, String target_app, String appId, String target_api,String apiID, String source_data, String option_type) throws Exception {

View File

@ -36,6 +36,24 @@ public class ProjectMainFlowEntity extends BaseEntity {
private String archivistStatus;//归档推送状态
private String def8;//完工服务额
private String def7;//J审定服务金额
private String def9;//D分包施工费率
private String def10;//D辅材费率
public String getDef9() {
return def9;
}
public void setDef9(String def9) {
this.def9 = def9;
}
public String getDef10() {
return def10;
}
public void setDef10(String def10) {
this.def10 = def10;
}
public String getDef8() {
return def8;

View File

@ -48,6 +48,8 @@
,field0428 as auditResult -- 审定推送结果
,field0426 as archivistResult -- 归档推送结果
,field0425 as archivistStatus -- 归档推送状态
,field0032 as def9 -- D分包施工费率
,field0033 as def10 -- D辅材费率
</sql>
<!--查询审计完成的数据推送BIP新增-->
@ -64,6 +66,7 @@
WHERE 1=1
and CTP_AFFAIR.node_policy = '审计完成' AND CTP_AFFAIR.complete_time is not null
and CTP_AFFAIR.state = '4' and CTP_AFFAIR.sub_state = '0' and field0427 is null
and rownum &lt; 100 -- and field0274 in ('浙S-QZWLJS2402YXZ001-05','浙S-QZWLJS2402YXZ001-04','浙D-NB2412TH15001')
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
</trim>
@ -82,7 +85,8 @@
LEFT JOIN org_member m4 ON m4.id=field0081
WHERE 1=1
and CTP_AFFAIR.node_policy = '归档' AND CTP_AFFAIR.complete_time is not null
and CTP_AFFAIR.state = '4' and CTP_AFFAIR.sub_state = '0' and field0425 is null and formmain_0219.id='4000079310249084585'
and CTP_AFFAIR.state = '4' and CTP_AFFAIR.sub_state = '0' and field0425 is null
and rownum &lt; 100 -- and field0274 in ('浙S-QZWLJS2402YXZ001-05','浙S-QZWLJS2402YXZ001-04','浙D-NB2412TH15001')
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
</trim>

View File

@ -110,7 +110,7 @@ public class ProjectMainFlowArchivistPluginInitializer extends PluginBaseEntity
//发送数据
String result = HttpRequest.post(url).
header("appId", "800050").
header("apiCode", "8000500016").
header("apiCode", "8000500011").
header("access_token", tokenBody).
header("publicKey", "ZJYAQ/VtQ66PqKXlV0EowrrlKkhBHYgS/Zk39Q5ezIQne51Ce7eDIk+3zDUT+v578prj").
header("secretKey", "iLLk424Bmzknbu+ROeJoiVDMYY5EFXtbZY/aU13HmVYIiQrIw9c0Ag4ipxbfpUqqj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
@ -184,6 +184,8 @@ public class ProjectMainFlowArchivistPluginInitializer extends PluginBaseEntity
htdd01slave4_htdd01slave4.put("def6",projectMainFlowEntity.getDef6());
htdd01slave4_htdd01slave4.put("def7",projectMainFlowEntity.getDef7());
htdd01slave4_htdd01slave4.put("def8",projectMainFlowEntity.getDef8());
htdd01slave4_htdd01slave4.put("def9",projectMainFlowEntity.getDef9());
htdd01slave4_htdd01slave4.put("def10",projectMainFlowEntity.getDef10());
jsonArray.add(htdd01slave4_htdd01slave4);
bill.put("htdd01Master",htdd01Master);
bill.put("htdd01slave4_htdd01slave4",jsonArray);

View File

@ -111,7 +111,7 @@ public class ProjectMainFlowAuditPluginInitializer extends PluginBaseEntity {
//发送数据
String result = HttpRequest.post(url).
header("appId", "800050").
header("apiCode", "8000500016").
header("apiCode", "8000500011").
header("access_token", tokenBody).
header("publicKey", "ZJYAQ/VtQ66PqKXlV0EowrrlKkhBHYgS/Zk39Q5ezIQne51Ce7eDIk+3zDUT+v578prj").
header("secretKey", "iLLk424Bmzknbu+ROeJoiVDMYY5EFXtbZY/aU13HmVYIiQrIw9c0Ag4ipxbfpUqqj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
@ -176,6 +176,8 @@ public class ProjectMainFlowAuditPluginInitializer extends PluginBaseEntity {
htdd01slave4_htdd01slave4.put("def6",projectMainFlowEntity.getDef6());
htdd01slave4_htdd01slave4.put("def7",projectMainFlowEntity.getDef7());
htdd01slave4_htdd01slave4.put("def8",projectMainFlowEntity.getDef8());
htdd01slave4_htdd01slave4.put("def9",projectMainFlowEntity.getDef9());
htdd01slave4_htdd01slave4.put("def10",projectMainFlowEntity.getDef10());
jsonArray.add(htdd01slave4_htdd01slave4);
bill.put("htdd01Master",htdd01Master);
bill.put("htdd01slave4_htdd01slave4",jsonArray);

View File

@ -0,0 +1,59 @@
package com.hzya.frame.plugin.salesContract.dao;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.plugin.salesContract.entity.SalesContractEntity;
import java.util.List;
public interface ISalesContractDao extends IBaseDao<SalesContractEntity,String> {
/**
*
* @content 查询未推送的销售合同
* @Param
* @Return
* @Author hecan
* @Date 2025-04-03 11:07
* **/
List<SalesContractEntity> querySalesContract(SalesContractEntity salesContractEntity);
/**
*
* @content 更新销售合同的推送标识
* @Param
* @Return
* @Author hecan
* @Date 2025-04-03 11:09
* **/
Integer updateSalesContract(SalesContractEntity entity);
/**
*
* @content 查询未上传文件的销售合同
* @Param
* @Return
* @Author hecan
* @Date 2025-04-16 14:40
* **/
List<SalesContractEntity> queryContractAnnexFile(SalesContractEntity salesContractEntity);
/**
*
* @content 查询未上传文件的销售合同IPO附件
* @Param
* @Return
* @Author hecan
* @Date 2025-04-16 14:40
* **/
List<SalesContractEntity> queryIPOAnnexFile(SalesContractEntity salesContractEntity);
/**
*
* @content 更新销售合同附件和ipo附件上传标识
* @Param
* @Return
* @Author hecan
* @Date 2025-04-16 16:48
* **/
Integer updateAnnexFile(SalesContractEntity entity);
}

View File

@ -0,0 +1,40 @@
package com.hzya.frame.plugin.salesContract.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.plugin.salesContract.dao.ISalesContractDao;
import com.hzya.frame.plugin.salesContract.entity.SalesContractEntity;
import java.util.List;
public class SalesContractDaoImpl extends MybatisGenericDao<SalesContractEntity,String> implements ISalesContractDao {
@DS("#entity.dataSourceCode")
@Override
public List<SalesContractEntity> querySalesContract(SalesContractEntity entity) {
return (List<SalesContractEntity>) super.selectList("querySalesContract",entity);
}
@DS("#entity.dataSourceCode")
@Override
public Integer updateSalesContract(SalesContractEntity entity) {
return super.update("updateSalesContract",entity);
}
@DS("#entity.dataSourceCode")
@Override
public List<SalesContractEntity> queryContractAnnexFile(SalesContractEntity entity) {
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) {
return super.update("updateAnnexFile",entity);
}
}

View File

@ -0,0 +1,402 @@
package com.hzya.frame.plugin.salesContract.entity;
import com.hzya.frame.web.entity.BaseEntity;
public class SalesContractEntity extends BaseEntity {
private String pkGroup;//集团编码
private String pkOrg;//公司编码
private String contractno;//合同号
private String contractName;//合同名称
private String creator;//创建人用户
private String creationtime;//创建时间
private String contractor;//订单负责人名称
private String cdeptid;//事业部
private String approvestatus;//审批状态默认-1
private String belongtodeptid;//单据归属部门
private String dpk_custclass;//合同对应客户大类
private String dcustomerid;//合同对应客户大类
private String zcustomerid;//
private String cinvoicecustid;//开票客户名称
private String cemployeeid;//业务人员
private String ccurrencyid;//币种
private String totalamount;//原币总金额
private String rmbtotalamount;//人民币总金额
private String presentrate;//汇率 CPO汇率
private String def13;//IPO合同号
private String def16;//IPO汇率
private String def8;//贸易方式
private String def27;//IPO币种
private String def17;//收款账期
private String def18;//账簿本币金额
private String def26;//当前账簿兑人民币汇率
private String pushStatus;//推送标识
private String billdate;//申请日期
private String custbillno;//CPO订单编码
private String placementdate;//CPO下达日期
private String country;//国家地区编码
private String vnote;//备注
private String def9;//合同类型
private String def2;//合同性质
private String def41;//单据归属区域
private String billid;//单据主键
private String billtype;//单据类型
private String billcode;//单据号
private String ipofilename;//ipo附件 文件名称
private String htnrfilename;//合同内容附件 文件名称
private String htnrid;//合同内容附件id
private String ipoid;//IPO附件id
private String htnrpush;//合同附件上传标识
private String ipopush;//ipo附件上传标识
public String getHtnrpush() {
return htnrpush;
}
public void setHtnrpush(String htnrpush) {
this.htnrpush = htnrpush;
}
public String getIpopush() {
return ipopush;
}
public void setIpopush(String ipopush) {
this.ipopush = ipopush;
}
public String getHtnrid() {
return htnrid;
}
public void setHtnrid(String htnrid) {
this.htnrid = htnrid;
}
public String getIpoid() {
return ipoid;
}
public void setIpoid(String ipoid) {
this.ipoid = ipoid;
}
public String getBillid() {
return billid;
}
public void setBillid(String billid) {
this.billid = billid;
}
public String getBilltype() {
return billtype;
}
public void setBilltype(String billtype) {
this.billtype = billtype;
}
public String getBillcode() {
return billcode;
}
public void setBillcode(String billcode) {
this.billcode = billcode;
}
public String getIpofilename() {
return ipofilename;
}
public void setIpofilename(String ipofilename) {
this.ipofilename = ipofilename;
}
public String getHtnrfilename() {
return htnrfilename;
}
public void setHtnrfilename(String htnrfilename) {
this.htnrfilename = htnrfilename;
}
public String getCustbillno() {
return custbillno;
}
public void setCustbillno(String custbillno) {
this.custbillno = custbillno;
}
public String getPlacementdate() {
return placementdate;
}
public void setPlacementdate(String placementdate) {
this.placementdate = placementdate;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getVnote() {
return vnote;
}
public void setVnote(String vnote) {
this.vnote = vnote;
}
public String getDef9() {
return def9;
}
public void setDef9(String def9) {
this.def9 = def9;
}
public String getDef2() {
return def2;
}
public void setDef2(String def2) {
this.def2 = def2;
}
public String getDef41() {
return def41;
}
public void setDef41(String def41) {
this.def41 = def41;
}
public String getBilldate() {
return billdate;
}
public void setBilldate(String billdate) {
this.billdate = billdate;
}
public String getPushStatus() {
return pushStatus;
}
public void setPushStatus(String pushStatus) {
this.pushStatus = pushStatus;
}
public String getPkGroup() {
return pkGroup;
}
public void setPkGroup(String pkGroup) {
this.pkGroup = pkGroup;
}
public String getPkOrg() {
return pkOrg;
}
public void setPkOrg(String pkOrg) {
this.pkOrg = pkOrg;
}
public String getContractno() {
return contractno;
}
public void setContractno(String contractno) {
this.contractno = contractno;
}
public String getContractName() {
return contractName;
}
public void setContractName(String contractName) {
this.contractName = contractName;
}
public String getCreator() {
return creator;
}
public void setCreator(String creator) {
this.creator = creator;
}
public String getCreationtime() {
return creationtime;
}
public void setCreationtime(String creationtime) {
this.creationtime = creationtime;
}
public String getContractor() {
return contractor;
}
public void setContractor(String contractor) {
this.contractor = contractor;
}
public String getCdeptid() {
return cdeptid;
}
public void setCdeptid(String cdeptid) {
this.cdeptid = cdeptid;
}
public String getApprovestatus() {
return approvestatus;
}
public void setApprovestatus(String approvestatus) {
this.approvestatus = approvestatus;
}
public String getBelongtodeptid() {
return belongtodeptid;
}
public void setBelongtodeptid(String belongtodeptid) {
this.belongtodeptid = belongtodeptid;
}
public String getDpk_custclass() {
return dpk_custclass;
}
public void setDpk_custclass(String dpk_custclass) {
this.dpk_custclass = dpk_custclass;
}
public String getDcustomerid() {
return dcustomerid;
}
public void setDcustomerid(String dcustomerid) {
this.dcustomerid = dcustomerid;
}
public String getZcustomerid() {
return zcustomerid;
}
public void setZcustomerid(String zcustomerid) {
this.zcustomerid = zcustomerid;
}
public String getCinvoicecustid() {
return cinvoicecustid;
}
public void setCinvoicecustid(String cinvoicecustid) {
this.cinvoicecustid = cinvoicecustid;
}
public String getCemployeeid() {
return cemployeeid;
}
public void setCemployeeid(String cemployeeid) {
this.cemployeeid = cemployeeid;
}
public String getCcurrencyid() {
return ccurrencyid;
}
public void setCcurrencyid(String ccurrencyid) {
this.ccurrencyid = ccurrencyid;
}
public String getTotalamount() {
return totalamount;
}
public void setTotalamount(String totalamount) {
this.totalamount = totalamount;
}
public String getRmbtotalamount() {
return rmbtotalamount;
}
public void setRmbtotalamount(String rmbtotalamount) {
this.rmbtotalamount = rmbtotalamount;
}
public String getPresentrate() {
return presentrate;
}
public void setPresentrate(String presentrate) {
this.presentrate = presentrate;
}
public String getDef13() {
return def13;
}
public void setDef13(String def13) {
this.def13 = def13;
}
public String getDef16() {
return def16;
}
public void setDef16(String def16) {
this.def16 = def16;
}
public String getDef8() {
return def8;
}
public void setDef8(String def8) {
this.def8 = def8;
}
public String getDef27() {
return def27;
}
public void setDef27(String def27) {
this.def27 = def27;
}
public String getDef17() {
return def17;
}
public void setDef17(String def17) {
this.def17 = def17;
}
public String getDef18() {
return def18;
}
public void setDef18(String def18) {
this.def18 = def18;
}
public String getDef26() {
return def26;
}
public void setDef26(String def26) {
this.def26 = def26;
}
}

View File

@ -0,0 +1,140 @@
<?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.salesContract.dao.impl.SalesContractDaoImpl">
<resultMap id="get-SalesContractEntity-result" type="com.hzya.frame.plugin.salesContract.entity.SalesContractEntity" >
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
<result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
<result property="sts" column="sts" jdbcType="VARCHAR"/>
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
</resultMap>
<sql id = "SalesContractEntity_Base_Column_List">
formmain_8694.id as id,
'SW01' as pkGroup, -- 集团编码
field0132 as pkOrg, -- 公司编码
field0009 as contractno, -- 合同号
field0010 as contractName, -- 合同名称
'field0146' as pushStatusFiald, -- 推送标识字段
field0146 as pushStatus, -- 推送标识
'OA' as creator, -- 创建人用户
to_char(field0007,'yyyy-MM-dd HH24:mi:ss') as creationtime, -- 创建时间
to_char(field0007,'yyyy-MM-dd') as billdate, -- 申请日期
field0144 as contractor, -- 订单负责人名称
'' as cdeptid, -- 事业部
'-1' as approvestatus, -- 审批状态默认
field0152 as belongtodeptid, -- 单据归属部门
'' as dpk_custclass, -- 合同对应客户大类
field0133 as dcustomerid, -- 合同对应客户大类
'' as zcustomerid,
'' as cinvoicecustid, -- 开票客户名称
field0145 as cemployeeid, -- 业务人员
field0143 as ccurrencyid, -- 币种
field0012 as totalamount, -- 原币总金额
'' as rmbtotalamount, -- 人民币总金额
'' as presentrate, -- 汇率
field0148 as def13, -- IPO合同号
'' as def16, -- IPO汇率
myfs.SORTNUMBER as def8, -- 贸易方式
'' as def27, -- IPO币种
skzq.SORTNUMBER as def17, -- 收款账期
'' as def18, -- 账簿本币金额
'' as def26, -- 当前账簿兑人民币汇率
field0147 as custbillno, -- CPO订单编码
field0155 as placementdate, -- CPO下达日期
field0151 as country, -- 国家地区编码
'' as vnote, --备注
field0140 as def9, -- 合同类型
htxz.SORTNUMBER as def2, -- 合同性质
djgsqy.SORTNUMBER as def41 -- 单据归属区域
</sql>
<!--查询未推送的数据推送BIP新增-->
<select id="querySalesContract" resultMap="get-SalesContractEntity-result" parameterType = "com.hzya.frame.plugin.salesContract.entity.SalesContractEntity">
select
<include refid="SalesContractEntity_Base_Column_List" />
from
formmain_8694
LEFT JOIN COL_SUMMARY summary ON summary.FORM_RECORDID = formmain_8694.id
left join CTP_ENUM_ITEM myfs on myfs.id=field0141
left join CTP_ENUM_ITEM skzq on skzq.id=field0138
left join CTP_ENUM_ITEM htxz on htxz.id=field0149
left join CTP_ENUM_ITEM djgsqy on djgsqy.id=field0135
where field0146 is 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 field0001='SW15-004-2025003467'
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
</trim>
</select>
<!--查询未上传的数据推送BIP新增-->
<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, -- 单据主键
'HHHX0201' as billtype, -- 单据类型
field0009 as billcode, -- 单据号 合同订单可以传合同号
field0132 as pkOrg, -- 公司编码
htnr_file.filename as htnrfilename, --合同内容附件 文件名称
htnr_file.id as htnrid, -- 合同内容附件id
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_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 field0154 is null and field0001='SW15-004-2025003497'
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
</trim>
</select>
<update id="updateSalesContract" parameterType="com.hzya.frame.plugin.salesContract.entity.SalesContractEntity">
update formmain_8694 set field0146 = #{pushStatus} where id = #{id}
</update>
<update id="updateAnnexFile" parameterType="com.hzya.frame.plugin.salesContract.entity.SalesContractEntity">
update formmain_8694 set
<trim suffix="" suffixOverrides=",">
<if test="ipopush != null and ipopush !='' "> field0154 = #{ipopush},</if>
<if test="htnrpush != null and htnrpush != ''"> field0153 = #{htnrpush}</if>
</trim>
where id = #{id}
</update>
</mapper>

View File

@ -0,0 +1,255 @@
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.dateutil.DateUtil;
import com.hzya.frame.plugin.salesContract.dao.ISalesContractDao;
import com.hzya.frame.plugin.salesContract.entity.SalesContractEntity;
import com.hzya.frame.seeyon.util.OARestUtil;
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 ContractAnnexFileUploadPluginInitializer extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(ContractAnnexFileUploadPluginInitializer.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 "ContractAnnexFileUploadPluginInitializer";
}
@Override
public String getPluginName() {
return "销售合同附件上传";
}
@Override
public String getPluginLabel() {
return "ContractAnnexFileUploadPluginInitializer";
}
@Override
public String getPluginType() {
return "1";
}
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) {
try {
logger.info("======开始执行销售合同附件上传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.queryContractAnnexFile(salesContractEntity);
if(salesContractEntities == null || salesContractEntities.size() == 0){
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() && 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());
jsonObject.put("billid",contractEntity.getBillid());
jsonObject.put("billcode",contractEntity.getBillcode());
jsonObject.put("pk_org",contractEntity.getPkOrg());
String file_url = contractEntity.getHtnrid();
String newPath = "E:\\yongansystem\\upload\\reuce\\"+contractEntity.getHtnrfilename();
downOaFile(file_url,contractEntity.getHtnrfilename(),newPath);
//本地文件转为base64
String base64 = getBase64(newPath);
jsonObject.put("file",base64);
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返回结果错误开始修改销售合同附件上传推送标识为失败==========");
salesContract.setHtnrpush("0");
salesContractDao.updateAnnexFile(salesContract);
logger.info("=========销售合同附件上传获取bip返回结果错误修改销售合同附件上传推送标识为失败完毕==========");
// saveTaskLivingDetails(contractEntity.getId(),contractEntity.getBillcode(),jsonObject.toString(),resultJson.toJSONString(),false);
}else {
logger.info("=========销售合同附件上传bip返回结果成功开始修改销售合同附件上传推送标识为成功==========");
salesContract.setHtnrpush("1");
salesContractDao.updateAnnexFile(salesContract);
logger.info("=========销售合同附件上传bip返回结果成功修改销售合同附件上传推送标识为成功完毕==========");
// saveTaskLivingDetails(contractEntity.getId(),contractEntity.getBillcode(),jsonObject.toString(),resultJson.toJSONString(),true);
}
}else{
logger.info("=======没有销售合同附件上传BIP=======");
}
logger.info("=======销售合同附件上传BIP执行成功=======");
return BaseResult.getSuccessMessageEntity("销售合同附件上传执行成功");
}
}catch (Exception e){
logger.info("======执行销售合同附件上传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("销售合同附件上传BIPtoken返回结果" + tokenResult);
JSONObject tokenResultJson = JSONObject.parseObject(tokenResult);
if (!tokenResultJson.getBoolean("flag")) {
logger.info("=========销售合同上传附件获取biptoken错误开始修改销售合同附件上传推送标识为失败==========");
contractEntity.setIpopush("0");
contractEntity.setHtnrpush("0");
salesContractDao.updateAnnexFile(contractEntity);
logger.info("=========销售合同附件上传获取biptoken错误修改销售合同附件上传推送标识完毕==========");
return null;
}
String tokenBody = tokenResultJson.getJSONObject("attribute").getJSONObject("data").getString("access_token");
logger.error("销售合同附件上传推送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());
}
}
}

View File

@ -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());
}
}
}

View File

@ -0,0 +1,223 @@
package com.hzya.frame.plugin.salesContract.plugin;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.plugin.projectMainFlow.entity.ProjectMainFlowEntity;
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.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;
public class SalesContractPluginInitializer extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(SalesContractPluginInitializer.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 "SalesContractPluginInitializer";
}
@Override
public String getPluginName() {
return "销售合同新增";
}
@Override
public String getPluginLabel() {
return "SalesContractPluginInitializer";
}
@Override
public String getPluginType() {
return "1";
}
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) {
try {
logger.info("======开始执行销售合同推送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.querySalesContract(salesContractEntity);
if(salesContractEntities == null || salesContractEntities.size() == 0){
logger.info("=====没有需要推送BIP的销售合同==========");
return BaseResult.getSuccessMessageEntity("查询成功");
}
for (SalesContractEntity contractEntity : salesContractEntities) {
//组装数据
JSONObject sendData = getSendData(contractEntity);
JSONObject tokenData = getBipTokenData();
contractEntity.setDataSourceCode("SW-OA");
//获取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(tokenData.toString()).
execute().
body();
logger.error("销售合同推送BIPtoken返回结果"+tokenResult);
JSONObject tokenResultJson = JSONObject.parseObject(tokenResult);
if(!tokenResultJson.getBoolean("flag")){
logger.info("=========销售合同获取biptoken错误开始修改销售合同推送标识为失败==========");
contractEntity.setPushStatus("0");
salesContractDao.updateSalesContract(contractEntity);
logger.info("=========销售合同获取biptoken错误修改销售合同推送标识完毕==========");
continue;
}
String tokenBody = tokenResultJson.getJSONObject("attribute").getJSONObject("data").getString("access_token");
logger.error("销售合同推送BIP请求参数"+sendData.toJSONString());
//发送数据
String result = HttpRequest.post(url).
header("appId", "800050").
header("apiCode", "8000500012").
header("access_token", tokenBody).
header("publicKey", "ZJYAQ/VtQ66PqKXlV0EowrrlKkhBHYgS/Zk39Q5ezIQne51Ce7eDIk+3zDUT+v578prj").
header("secretKey", "iLLk424Bmzknbu+ROeJoiVDMYY5EFXtbZY/aU13HmVYIiQrIw9c0Ag4ipxbfpUqqj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
body(sendData.toString()).
execute().
body();
logger.error("销售合同推送BIP返回结果"+result);
JSONObject resultJson = JSONObject.parseObject(result);
if(!resultJson.getBoolean("flag")){
logger.info("=========销售合同获取bip返回结果错误开始修改销售合同推送标识为失败==========");
contractEntity.setPushStatus("0");
salesContractDao.updateSalesContract(contractEntity);
logger.info("=========销售合同获取bip返回结果错误修改销售合同推送标识为失败完毕==========");
saveTaskLivingDetails(contractEntity.getId(),contractEntity.getContractno(),sendData.toString(),resultJson.toJSONString(),false);
}else {
logger.info("=========销售合同获取bip返回结果成功开始修改销售合同推送标识为成功==========");
contractEntity.setPushStatus("1");
salesContractDao.updateSalesContract(contractEntity);
logger.info("=========销售合同获取bip返回结果成功修改销售合同推送标识为成功完毕==========");
saveTaskLivingDetails(contractEntity.getId(),contractEntity.getContractno(),sendData.toString(),resultJson.toJSONString(),true);
}
}
}
logger.info("=======销售合同推送BIP执行成功=======");
return BaseResult.getSuccessMessageEntity("销售合同执行成功");
}catch (Exception e){
logger.info("======执行销售合同推送BIP失败:{}========", e.getMessage());
e.printStackTrace();
}
return BaseResult.getFailureMessageEntity("销售合同执行失败");
}
private JSONObject getSendData(SalesContractEntity contractEntity) {
JSONObject bill = new JSONObject();
bill.put("pk_group",contractEntity.getPkGroup());//集团编码
bill.put("pk_org",contractEntity.getPkOrg());//公司编码
bill.put("contractno",contractEntity.getContractno());//合同号
bill.put("name",contractEntity.getContractName());//合同名称
bill.put("creator",contractEntity.getCreator());//创建人用户
bill.put("creationtime",contractEntity.getCreationtime());//创建时间
bill.put("billdate",contractEntity.getBilldate());//申请日期
bill.put("contractor",contractEntity.getContractor());//订单负责人名称
bill.put("cdeptid",contractEntity.getCdeptid());//事业部
bill.put("approvestatus",contractEntity.getApprovestatus());//审批状态默认
bill.put("belongtodeptid",contractEntity.getBelongtodeptid());//单据归属部门
bill.put("dpk_custclass",contractEntity.getDpk_custclass());//合同对应客户大类
bill.put("dcustomerid",contractEntity.getDcustomerid());//合同对应客户大类
bill.put("zcustomerid",contractEntity.getZcustomerid());
bill.put("cinvoicecustid",contractEntity.getCinvoicecustid());//开票客户名称
bill.put("cemployeeid",contractEntity.getCemployeeid());//业务人员
bill.put("ccurrencyid",contractEntity.getCcurrencyid());//币种
bill.put("totalamount",contractEntity.getTotalamount());//原币总金额
bill.put("rmbtotalamount",contractEntity.getRmbtotalamount());//人民币总金额
bill.put("presentrate",contractEntity.getPresentrate());//汇率
bill.put("def13",contractEntity.getDef13());//IPO合同号
bill.put("def16",contractEntity.getDef16());//IPO汇率
bill.put("def8",contractEntity.getDef8());//贸易方式
bill.put("def27",contractEntity.getDef27());//IPO币种
bill.put("def17",contractEntity.getDef17());//收款账期
bill.put("def18",contractEntity.getDef18());//账簿本币金额
bill.put("def26",contractEntity.getDef26());//当前账簿兑人民币汇率
bill.put("custbillno",contractEntity.getCustbillno());//CPO订单编码
bill.put("placementdate",contractEntity.getPlacementdate());//CPO下达日期
bill.put("country",contractEntity.getCountry());//国家地区编码
bill.put("vnote",contractEntity.getVnote());//备注
bill.put("def9",contractEntity.getDef9());//合同类型
bill.put("def2",contractEntity.getDef2());//合同性质
bill.put("def41",contractEntity.getDef41());//单据归属区域
JSONObject htdd01Master=new JSONObject();
htdd01Master.put("htdd01Master",bill);
return htdd01Master;
}
private JSONObject getBipTokenData() {
JSONObject jsonObject = new JSONObject();
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("SalesContractPluginInitializer");
integrationTaskLivingDetailsEntity.setRootAppNewData(rootAppNewData);
integrationTaskLivingDetailsEntity.setNewTransmitInfo(newTransmitInfo);
if (flag) {
taskLivingDetailsService.saveLogToSuccess(integrationTaskLivingDetailsEntity);
} else {
taskLivingDetailsService.saveLogToFail(integrationTaskLivingDetailsEntity);
}
} catch (Exception e) {
logger.info("保存日志到集成任务日志明细中失败:{}", e.getMessage());
}
}
}

View File

@ -0,0 +1,7 @@
package com.hzya.frame.plugin.salesContract.service;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.plugin.salesContract.entity.SalesContractEntity;
public interface ISalesContractService extends IBaseService<SalesContractEntity,String> {
}

View File

@ -0,0 +1,18 @@
package com.hzya.frame.plugin.salesContract.service.impl;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.plugin.salesContract.dao.ISalesContractDao;
import com.hzya.frame.plugin.salesContract.entity.SalesContractEntity;
import com.hzya.frame.plugin.salesContract.service.ISalesContractService;
import org.springframework.beans.factory.annotation.Autowired;
public class SalesContractServiceImpl extends BaseService<SalesContractEntity,String> implements ISalesContractService {
private ISalesContractDao salesContractDao;
@Autowired
public void setSalesContractDao(ISalesContractDao dao) {
this.salesContractDao = dao;
this.dao = dao;
}
}

View File

@ -53,6 +53,15 @@ public class MarginPaymentPluginInitializer extends PluginBaseEntity{
public String getPluginType() {
return "1";
}
/**
*
* @content 保证金付款申请到哪同步BIP
* @className: Administrator
* @author laborer
* @date 2025-04-17 9:06
*
*/
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) {
try {

View File

@ -0,0 +1,73 @@
package com.hzya.frame.plugin.serviceData.plugin;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.seeyon.paybill.service.IPayBillService;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Resource;
/**
* 业务数据同步
*
* @author makejava
* @since 2024-06-21 13:52:35
*/
public class PayReceivedPluginInitializer extends PluginBaseEntity{
Logger logger = LoggerFactory.getLogger(PayReceivedPluginInitializer.class);
@Resource
private IPayBillService payBillService;
@Override
public void initialize() {
logger.info(getPluginLabel() + "執行初始化方法initialize()");
}
@Override
public void destroy() {
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
}
@Override
public String getPluginId() {
return "PayReceivedPluginInitializer";
}
@Override
public String getPluginName() {
return "业务数据抽取";
}
@Override
public String getPluginLabel() {
return "PayReceivedPluginInitializer";
}
@Override
public String getPluginType() {
return "1";
}
/**
*
* @content 付款申请单SW-D同步更新BIP
* @className: Administrator
* @author laborer
* @date 2025-04-17 9:08
*
*/
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) {
try {
logger.info("======开始执行业务数据信息同步========");
return payBillService.sendPayReceivedToBip(requestJson);
}catch (Exception e){
logger.info("======执行业务数据同步失败:{}========",e.getMessage());
e.printStackTrace();
}
return BaseResult.getSuccessMessageEntity("操作成功");
}
}

View File

@ -50,6 +50,15 @@ public class ReceivedPluginInitializer extends PluginBaseEntity{
public String getPluginType() {
return "1";
}
/**
*
* @content 保证金付款申请同步更新BIP
* @className: Administrator
* @author laborer
* @date 2025-04-17 9:06
*
*/
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) {
try {

View File

@ -612,7 +612,7 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{
map1.put("tableName",mainDb);
map1.put("dataStatus", "N");
map1.put("deleteStatus", "0");
map1.put("size", 50);
//map1.put("size", 50);
objects = mdmModuleDao.queryMdmSTs(map1);
objects = toLowerCaseKeys(objects);
@ -807,7 +807,7 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{
map1.put("tableName",mainDb);
//map1.put("dataStatus", "F");
map1.put("updateStatus", "0");
map1.put("size", 50);
//map1.put("size", 50);
objects = mdmModuleDao.queryMdmSTs(map1);
objects = toLowerCaseKeys(objects);
@ -995,7 +995,7 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{
map1.put("tableName",mainDb);
//map1.put("dataStatus", "Y");
map1.put("addStatus", "0");
map1.put("size", 50);
//map1.put("size", 50);
objects = mdmModuleDao.queryMdmSTs(map1);
objects = toLowerCaseKeys(objects);
@ -1024,21 +1024,21 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{
if(mdmModuleDistributeEntities.get(i1).getAddApi() == null || "".equals(mdmModuleDistributeEntities.get(i1).getAddApi())){
for (int i = 0; i < doObjects.size(); i++) {
//taskLivingDetailsService.saveLogToSuccess();
saveMdmModuleSendLogEntity( mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","新增接口未设置",mainDb,objects.get(i).getString("id"),null,null,null,null,doObjects.get(i).toJSONString(),"1");
// saveMdmModuleSendLogEntity( mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","新增接口未设置",mainDb,objects.get(i).getString("id"),null,null,null,null,null,"1");
}
return ;
}
SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(mdmModuleDistributeEntities.get(i1).getAddApi());
if(apiEntity == null || apiEntity.getId() == null ){
for (int i = 0; i < doObjects.size(); i++) {
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","新增接口未查找到",mainDb,objects.get(i).getString("id"),null,null,null,null,doObjects.get(i).toJSONString(),"1");
//saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","新增接口未查找到",mainDb,objects.get(i).getString("id"),null,null,null,null,null,"1");
}
return ;
}
SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId());
if(sysApplicationEntity == null || sysApplicationEntity.getId() == null ){
for (int i = 0; i < doObjects.size(); i++) {
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","应用未查找到",mainDb,objects.get(i).getString("id"),null,null,apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
//saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","应用未查找到",mainDb,objects.get(i).getString("id"),null,null,apiEntity.getApiName(),apiEntity.getId(),null,"1");
}
return ;
}
@ -1048,7 +1048,7 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{
scriptEntity = sysApplicationScriptDao.get(mdmModuleDistributeEntities.get(i1).getAddScript());
if(scriptEntity == null || scriptEntity.getId() == null ){
for (int i = 0; i < doObjects.size(); i++) {
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","脚本未查找到",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
// saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","脚本未查找到",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),null,"1");
}
return ;
}
@ -1112,7 +1112,7 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{
querys = jsonResultEntity.getString("querys");
bodys = jsonResultEntity.getString("bodys");
}catch (Exception e){
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","脚本处理失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
// saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","脚本处理失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),null,"1");
continue;
}
}
@ -1129,7 +1129,7 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{
//找到登陆接口
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
if (null == loginApi) {
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","发送错误,认证接口不存在",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
// saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","发送错误,认证接口不存在",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),null,"1");
continue;
}
String rzquerys = getQuery(loginApi,null,null);
@ -1142,7 +1142,7 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{
String rzbodys = getBodys(loginApi,null,null);
JsonResultEntity rzjsonResultEntity = sendData(loginApi,rzheaders,rzbodys,rzquerys);
if (!rzjsonResultEntity.isFlag()) {
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","发送错误,认证接口错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
// saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","发送错误,认证接口错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),null,"1");
continue;
}
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
@ -1155,6 +1155,15 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{
//组装数据发送
logger.info("=========开始执行正常业务数据下发脚本,第二次==============");
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
//根据OA单据编号更新BIP付款申请单号
JSONObject jsonObjectBody = JSONObject.parseObject(bodys);
String parent = jsonObjectBody.getString("parent");
JSONObject jsonObjectParent = JSONObject.parseObject(parent);
ServiceDataEntity serviceDataEntity=new ServiceDataEntity();
serviceDataEntity.setBillCode(jsonObjectParent.getString("vdef1"));
serviceDataEntity.setDataSourceCode("SW-OA");
logger.info("========正常业务数据下发开始根据单据编号:{}查询数据==========",jsonObjectParent.getString("vdef1"));
List<ServiceDataEntity> query = serviceDataDao.query(serviceDataEntity);
logger.info("=====业务数据下发调用BIP付款申请返回结果为:{}",JSONObject.parseObject(jsonResultEntity.getAttribute().toString()).toJSONString());
if(jsonResultEntity.isFlag()){
if (scriptEntity != null && scriptEntity.getId() != null && scriptEntity.getBackScriptData() != null ) {
@ -1187,15 +1196,7 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{
mdmModuleDistributeTripartiteEntity.setAppId(sysApplicationEntity.getId());
mdmModuleDistributeTripartiteEntity.setTripartiteId(backJsonResultEntity.getString("vbillno"));
mdmModuleDistributeTripartiteDao.save(mdmModuleDistributeTripartiteEntity);
//根据OA单据编号更新BIP付款申请单号
JSONObject jsonObjectBody = JSONObject.parseObject(bodys);
String parent = jsonObjectBody.getString("parent");
JSONObject jsonObjectParent = JSONObject.parseObject(parent);
ServiceDataEntity serviceDataEntity=new ServiceDataEntity();
serviceDataEntity.setBillCode(jsonObjectParent.getString("vdef1"));
serviceDataEntity.setDataSourceCode("SW-OA");
logger.info("========正常业务数据下发开始根据单据编号:{}查询数据==========",jsonObjectParent.getString("vdef1"));
List<ServiceDataEntity> query = serviceDataDao.query(serviceDataEntity);
if(CollectionUtils.isNotEmpty(query)){
logger.info("===正常下发时候开始根据OA单据编号{}更新BIP付款申请单号:{}",jsonObjectParent.getString("vdef1"),backJsonResultEntity.getString("vbillno"));
serviceDataEntity.setTabName(query.get(0).getTabName());
@ -1203,6 +1204,14 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{
serviceDataEntity.setBipPaymentNumber(backJsonResultEntity.getString("vbillno"));
serviceDataEntity.setId(query.get(0).getId());
serviceDataDao.updateBipPaymentNumber(serviceDataEntity);
//更新支付结果为待支付
serviceDataEntity.setPayResult("待支付");
serviceDataEntity.setPayResultFiled(query.get(0).getPayResultFiled());
serviceDataEntity.setDataSourceCode("SW-OA");
logger.info("====开始根据单据号:{},表名称:{},表单id:{}更新支付状态为待支付======", serviceDataEntity.getBillCode(), serviceDataEntity.getTabName(), serviceDataEntity.getId());
serviceDataDao.updatePayResult(serviceDataEntity);
logger.info("====根据单据号:{},表名称:{},表单id:{}更新支付状态为待支付完成======", serviceDataEntity.getBillCode(), serviceDataEntity.getTabName(), serviceDataEntity.getId());
//修改下发状态
logger.info("===正常下发时候根据OA单据编号{}更新BIP付款申请单号:{}完毕",jsonObjectParent.getString("vdef1"),backJsonResultEntity.getString("vbillno"));
Map<String, Object> updateMap = new HashMap<>();
updateMap.put("tableName",mainDb);
@ -1213,24 +1222,73 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{
}else{
logger.info("======正常下发时候根据单据编号:{}未能在三维OA查询到数据Bip付款申请单号不回写",jsonObjectParent.getString("vdef1"));
}
}else {
if (CollectionUtils.isNotEmpty(query)) {
//保存推送BIP返回的错误信息
//将BIP返回的失败信息保存到支付结果中
serviceDataEntity.setPayResult(backJsonResultEntity.getString("message"));
serviceDataEntity.setDataSourceCode("SW-OA");
serviceDataEntity.setPayResultFiled(query.get(0).getPayResultFiled());
serviceDataEntity.setId(query.get(0).getId());
serviceDataEntity.setTabName(query.get(0).getTabName());
logger.info("====开始根据单据号:{},表名称:{},表单id:{}更新支付状态为BIP返回的失败信息======", serviceDataEntity.getBillCode(), serviceDataEntity.getTabName(), serviceDataEntity.getId());
serviceDataDao.updatePayResult(serviceDataEntity);
logger.info("====根据单据号:{},表名称:{},表单id:{}更新支付状态为BIP返回的失败信息======", serviceDataEntity.getBillCode(), serviceDataEntity.getTabName(), serviceDataEntity.getId());
//修改下发状态
logger.info("===下发失败时候根据OA单据编号{}更新下发状态",jsonObjectParent.getString("vdef1"));
Map<String, Object> updateMap = new HashMap<>();
updateMap.put("tableName",mainDb);
//updateMap.put("dataStatus", "Y");
updateMap.put("addStatus", "2");
updateMap.put("id", objects.get(i).getString("id"));
mdmModuleDao.updateMdmSTs(updateMap);
}else{
logger.info("======正常下发时候根据单据编号:{}未能在三维OA查询到数据不将BIP返回的失败信息体现在支付结果中",jsonObjectParent.getString("vdef1"));
}
}
}
} catch (Exception e) {
logger.error("新增返回脚本解析保存三方id错误"+jsonResultEntity.getAttribute());
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","新增返回脚本解析保存三方id错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
// saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","新增返回脚本解析保存三方id错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),null,"1");
continue;
}
}
//保存日志
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
// saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),null,"1");
objects.get(i).put("sendsanfzt123",true);
logger.info("========业务数据下发完成,日志保存为成功============");
continue;
}else {
//保存日志
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败:"+jsonResultEntity.getAttribute(),mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
// saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败:"+jsonResultEntity.getAttribute(),mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),null,"1");
objects.get(i).put("sendsanfzt123",false);
logger.info("========业务数据下发完成,日志保存为失败============");
if (CollectionUtils.isNotEmpty(query)) {
//保存推送BIP返回的错误信息
//将BIP返回的失败信息保存到支付结果中
String str = JSONObject.parseObject(jsonResultEntity.getAttribute().toString()).toJSONString();
JSONObject jsonObject = JSONObject.parseObject(str);
String attribute = jsonObject.getString("attribute");
JSONObject jsonAttribute = JSONObject.parseObject(attribute);
serviceDataEntity.setPayResult(jsonAttribute.getString("message"));
serviceDataEntity.setDataSourceCode("SW-OA");
serviceDataEntity.setPayResultFiled(query.get(0).getPayResultFiled());
serviceDataEntity.setId(query.get(0).getId());
serviceDataEntity.setTabName(query.get(0).getTabName());
logger.info("====开始根据单据号:{},表名称:{},表单id:{}更新支付状态为BIP返回的失败信息======", serviceDataEntity.getBillCode(), serviceDataEntity.getTabName(), serviceDataEntity.getId());
serviceDataDao.updatePayResult(serviceDataEntity);
logger.info("====根据单据号:{},表名称:{},表单id:{}更新支付状态为BIP返回的失败信息======", serviceDataEntity.getBillCode(), serviceDataEntity.getTabName(), serviceDataEntity.getId());
//修改下发状态
logger.info("===下发失败时候根据OA单据编号{}更新下发状态",jsonObjectParent.getString("vdef1"));
Map<String, Object> updateMap = new HashMap<>();
updateMap.put("tableName",mainDb);
//updateMap.put("dataStatus", "Y");
updateMap.put("addStatus", "2");
updateMap.put("id", objects.get(i).getString("id"));
mdmModuleDao.updateMdmSTs(updateMap);
}else{
logger.info("======正常下发时候根据单据编号:{}未能在三维OA查询到数据不将BIP返回的失败信息体现在支付结果中",jsonObjectParent.getString("vdef1"));
}
continue;
}
}

View File

@ -19,17 +19,5 @@ spring:
savefile:
# 文件保存路径
path: /Users/xiangerlin/work/app/file/dev
cbs8:
appId: 1P4AGrpz
appSecret: 2c2369ae5dc04382844bbe3a5abf39e1bea9cd3a
url: https://cbs8-openapi-reprd.csuat.cmburl.cn
# 测试用这个 这个是银行给的,和下面的公钥不是一对密钥
ya_private_key: 83BA7EC821D35F4CB31FF9A51C1EFA520FC52AF828C2337F88E91CF119B07F44
# 这个私钥到时候上传到cbs和下面到是同一对
#ya_private_key: e1eacfdee9b8d4184437d5a2071e17ce31befc3d93395f9f05709ed562e8dc46
ya_public_key: 044fa399d2223760f17b81b863cb482b009294c4516f8a605dea1475ec09e720eaa98468715e5ad509a592a0b426061551c5a3df236966c23253a7d894eac0dcde
cbs_public_key: 0469146F06BF3B01236E84632441E826F3067A6B93BC3839C836A06007869CD351FBBE388B51F742859388BBC1DE089923AAFBC69E448F15141DDF30EE6CE90185
#电子回单下载临时存放位置
elec_path: /Users/xiangerlin/Downloads/
OA:
data_source_code: yc-test
zt:
url: http://127.0.0.1:9011/kangarooDataCenterV3/entranceController/externalCallInterface

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<id>C4ProjectPluginInitializer</id>
<name>C4ProjectPluginInitializer</name>
<category>90000098</category>
</plugin>

View File

@ -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="C4ProjectDaoImpl" class="com.hzya.frame.plugin.c4project.dao.impl.C4ProjectDaoImpl" />
</beans>

View File

@ -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="C4ProjectPluginInitializer" class="com.hzya.frame.plugin.c4project.plugin.C4ProjectPluginInitializer" />
</beans>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<id>SalesContractPluginInitializer</id>
<name>SalesContractPluginInitializer插件</name>
<category>90000099</category>
</plugin>

View File

@ -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>

View File

@ -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>

View File

@ -5,4 +5,5 @@
<bean name="ServiceDataDistributePluginInitializer" class="com.hzya.frame.plugin.serviceData.plugin.ServiceDataDistributePluginInitializer" />
<bean name="MarginPaymentPluginInitializer" class="com.hzya.frame.plugin.serviceData.plugin.MarginPaymentPluginInitializer" />
<bean name="ReceivedPluginInitializer" class="com.hzya.frame.plugin.serviceData.plugin.ReceivedPluginInitializer" />
<bean name="PayReceivedPluginInitializer" class="com.hzya.frame.plugin.serviceData.plugin.PayReceivedPluginInitializer" />
</beans>

View File

@ -87,4 +87,24 @@ public interface IServiceDataDao extends IBaseDao<ServiceDataEntity,String> {
* @Date 2024-12-19 10:49
* **/
List<ServiceDataEntity> queryDataByVdef1(ServiceDataEntity entity);
/**
*
* @content 查询支付成功但是没有做凭证的数据
* @Param
* @Return
* @Author hecan
* @Date 2025-05-09 17:15
* **/
List<ServiceDataEntity> queryVoucherIsNull(ServiceDataEntity entity);
/**
*
* @content 凭证号和凭证期间回写
* @Param
* @Return
* @Author hecan
* @Date 2025-05-09 17:39
* **/
Integer updateVoucherResult(ServiceDataEntity entity);
}

View File

@ -74,4 +74,16 @@ public class ServiceDataDaoImpl extends MybatisGenericDao<ServiceDataEntity,Stri
public List<ServiceDataEntity> queryDataByVdef1(ServiceDataEntity entity) {
return super.query("queryDataByVdef1",entity);
}
@DS("#entity.dataSourceCode")
@Override
public List<ServiceDataEntity> queryVoucherIsNull(ServiceDataEntity entity) {
return (List<ServiceDataEntity>) super.selectList("queryVoucherIsNull",entity);
}
@DS("#entity.dataSourceCode")
@Override
public Integer updateVoucherResult(ServiceDataEntity entity) {
return super.update("updateVoucherResult",entity);
}
}

View File

@ -20,6 +20,60 @@ public class ServiceDataEntity extends BaseEntity {
private String bipAmountField;//BIP打款金额字段
private String bipAmount;//BIP打款金额
private String bipCbsDateFiled;//BIP推CBS时间字段
private String voucherPeriodFiled;//凭证期间字段
private String voucherNumberFiled;//凭证号字段
private String bipCbsDate;//BIP推CBS时间
private String voucherPeriod;//凭证期间
private String voucherNumber;//凭证号
public String getBipCbsDateFiled() {
return bipCbsDateFiled;
}
public void setBipCbsDateFiled(String bipCbsDateFiled) {
this.bipCbsDateFiled = bipCbsDateFiled;
}
public String getVoucherPeriodFiled() {
return voucherPeriodFiled;
}
public void setVoucherPeriodFiled(String voucherPeriodFiled) {
this.voucherPeriodFiled = voucherPeriodFiled;
}
public String getVoucherNumberFiled() {
return voucherNumberFiled;
}
public void setVoucherNumberFiled(String voucherNumberFiled) {
this.voucherNumberFiled = voucherNumberFiled;
}
public String getBipCbsDate() {
return bipCbsDate;
}
public void setBipCbsDate(String bipCbsDate) {
this.bipCbsDate = bipCbsDate;
}
public String getVoucherPeriod() {
return voucherPeriod;
}
public void setVoucherPeriod(String voucherPeriod) {
this.voucherPeriod = voucherPeriod;
}
public String getVoucherNumber() {
return voucherNumber;
}
public void setVoucherNumber(String voucherNumber) {
this.voucherNumber = voucherNumber;
}
public String getBipAmountField() {
return bipAmountField;

View File

@ -14,7 +14,7 @@
</resultMap>
<sql id = "ServiceDataEntity_Base_Column_List">
oa_id as id
data_id as id
,tab_name as tabName
,pay_result_field as payResultFiled
,pay_result as payResult
@ -27,6 +27,12 @@
,bip_payment_number as bipPaymentNumber
,bip_amount_field as bipAmountField
,bip_amount as bipAmount
,bip_cbs_date_filed as bipCbsDateFiled
,voucher_period_filed as voucherPeriodFiled
,voucher_number_filed as voucherNumberFiled
,bip_cbs_date as bipCbsDate
,voucher_period as voucherPeriod
,voucher_number as voucherNumber
</sql>
<select id="entity_list_base" resultMap="get-ServiceDataEntity-result" parameterType = "com.hzya.frame.sysnew.comparison.serviceData.entity.ServiceDataEntity">
@ -57,6 +63,17 @@
</trim>
</select>
<!-- 查询 采用==查询 -->
<select id="queryVoucherIsNull" resultMap="get-ServiceDataEntity-result" parameterType = "com.hzya.frame.sysnew.comparison.serviceData.entity.ServiceDataEntity">
select
<include refid="ServiceDataEntity_Base_Column_List" />
from V_CMP_APPLY
<trim prefix="where" prefixOverrides="and">
<if test="billCode != null and billCode != ''"> and vdef1 = #{billCode} </if>
and pay_result ='支付成功' and voucher_number is null AND rownum &lt; 51
</trim>
</select>
<!-- 查询 采用==查询 -->
<select id="queryDataByVdef1" resultMap="get-ServiceDataEntity-result" parameterType = "com.hzya.frame.sysnew.comparison.serviceData.entity.ServiceDataEntity">
select
@ -92,6 +109,7 @@
<trim suffix="" suffixOverrides=",">
<if test="payDate != null and payDate != ''"> ${payDateFiled} = to_date(#{payDate},'YYYY-MM-DD HH24:MI:SS'),</if>
<if test="bipAmount != null and bipAmount != ''"> ${bipAmountField} = #{bipAmount},</if>
<if test="bipCbsDate != null and bipCbsDate != ''"> ${bipCbsDateFiled} = to_date(#{bipCbsDate},'YYYY-MM-DD HH24:MI:SS'),</if>
<if test="payResult != null and payResult != ''"> ${payResultFiled} = #{payResult}</if>
</trim>
where id=#{id}
@ -104,6 +122,15 @@
where id=#{id}
</update>
<!--通过主键修改方法-->
<update id="updateVoucherResult" parameterType = "com.hzya.frame.sysnew.comparison.serviceData.entity.ServiceDataEntity" >
update ${tabName} set
<trim suffix="" suffixOverrides=",">
<if test="voucherPeriod != null and voucherPeriod != ''"> ${voucherPeriodFiled} = #{voucherPeriod},</if>
<if test="voucherNumber != null and voucherNumber != ''"> ${voucherNumberFiled} = #{voucherNumber}</if>
</trim>
where id=#{id}
</update>
</mapper>

View File

@ -40,4 +40,13 @@ public interface IServiceDataService extends IBaseService<ComparisonEntity,Strin
SysExtensionApiEntity getToken(SysExtensionApiEntity entity);
/**
*
* @content 查询支付成功并且没有做凭证的单子
* @Param
* @Return
* @Author hecan
* @Date 2025-05-09 17:21
* **/
JsonResultEntity queryVoucherIsNull(JSONObject json);
}

View File

@ -163,6 +163,7 @@ public class ServiceDataServiceImpl extends BaseService<ComparisonEntity,String>
serviceDataEntity.setPayResult(jsonObject.getString("payResult"));
serviceDataEntity.setPayDate(jsonObject.getString("payDate"));
serviceDataEntity.setBipAmount(jsonObject.getString("bipAmount"));
serviceDataEntity.setBipCbsDate(jsonObject.getString("bipCbsDate"));
serviceDataEntity.setDataSourceCode(jsonObject.getString("dataSourceCode"));
logger.info("====开始根据单据号:{},表名称:{},表单id:{}更新支付状态和时间======", serviceDataEntity.getBillCode(), serviceDataEntity.getTabName(), serviceDataEntity.getId());
integer = serviceDataDao.updatePayResult(serviceDataEntity);
@ -246,6 +247,56 @@ public class ServiceDataServiceImpl extends BaseService<ComparisonEntity,String>
return null;
}
@Override
public JsonResultEntity queryVoucherIsNull(JSONObject json) {
try {
JSONObject jsonObject = json.getJSONObject("jsonStr");
/* if (!checkStr(jsonObject.getString("voucherNumber"))) {
logger.info("====传递的凭证号为空====");
return BaseResult.getFailureMessageEntity("请传递凭证号");
}
if (!checkStr(jsonObject.getString("voucherPeriod"))) {
logger.info("====传递的凭证期间为空====");
return BaseResult.getFailureMessageEntity("请传递凭证期间");
}*/
if (!checkStr(jsonObject.getString("billCode"))) {
logger.info("====传递的OA单据编号为空====");
return BaseResult.getFailureMessageEntity("请传递OA单据编号");
}
//查询支付状态为空的数据
ServiceDataEntity serviceData = new ServiceDataEntity();
serviceData.setBillCode(jsonObject.getString("billCode"));
serviceData.setDataSourceCode(jsonObject.getString("dataSourceCode"));
List<ServiceDataEntity> serviceDataEntities = serviceDataDao.queryVoucherIsNull(serviceData);
Integer integer = null;
if (CollectionUtils.isNotEmpty(serviceDataEntities)) {
for (ServiceDataEntity serviceDataEntity : serviceDataEntities) {
if(serviceDataEntity.getBillCode().equals(jsonObject.getString("billCode"))){
serviceDataEntity.setVoucherNumber(jsonObject.getString("voucherNumber"));
serviceDataEntity.setVoucherPeriod(jsonObject.getString("voucherPeriod"));
serviceDataEntity.setDataSourceCode(jsonObject.getString("dataSourceCode"));
if(null != jsonObject.getString("voucherNumber") || null !=jsonObject.getString("voucherPeriod")){
logger.info("====开始根据表名称:{},表单id:{}更新凭证号:{}和凭证期间:{}======", serviceDataEntity.getTabName(), serviceDataEntity.getId(),jsonObject.getString("voucherNumber"),jsonObject.getString("voucherPeriod"));
integer = serviceDataDao.updateVoucherResult(serviceDataEntity);
logger.info("====根据表名称:{},表单id:{}更新凭证号:{}和凭证期间:{}完成======", serviceDataEntity.getTabName(), serviceDataEntity.getId(),jsonObject.getString("voucherNumber"),jsonObject.getString("voucherPeriod"));
}else{
logger.info("=====传递的凭证号和凭证期间都为空======");
}
}else{
logger.info("======传递的OA单据编号与查询出来的OA单据编号不一致=========");
}
}
return BaseResult.getSuccessMessageEntity("更新成功", integer);
} else {
logger.info("=========没有支付成功并且凭证号为空的数据=======");
return BaseResult.getSuccessMessageEntity("查询成功,没有支付成功并且凭证号为空数据");
}
}catch (Exception e){
logger.info("查询三维支付成功并且凭证号为空的数据失败:{}",e.getMessage());
}
return null;
}
@Override
public SysExtensionApiEntity addDataSourceCode(SysExtensionApiEntity entity) {
try {
@ -294,17 +345,14 @@ public class ServiceDataServiceImpl extends BaseService<ComparisonEntity,String>
return entity;
}
private List<JSONObject> bindingDocument(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode) {
String formmainId=null;
String vdef1=null;
List<JSONObject> list = new ArrayList<>();
try {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("select oa_id as data_id,tab_name,title,pay_company,bill_name,pay_result_field,pay_date_field,receipt_filed,\n" +
"push_status_field,summary_id,bip_payment_number_field,bip_amount_field,\n" +
"vdef1,pk_acceptorg,creator,pk_group,pk_org,applydate,pk_trantypecode,pk_busitype,vdef2,pk_currtype,\n" +
"pk_supplier,pk_bankacc_r,pk_bankacc_p,pk_decidedept,vdef10,vdef12,vdef3,vdef4,vdef5,vdef6,applysum,\n" +
"vdef7,vdef8,vdef9,vdef21,vdef11,vdef17,vdef20 from v_cmp_apply where 1=1 and vdef1 is not null and push_status is null and applysum >0");
stringBuffer.append("select * from v_cmp_apply where 1=1 and vdef1 is not null and push_status is null ");
mdmModuleSourceEntity.setDataSourceCode(dbCode);
List<HashMap<String, Object>> hashMaps = serviceDataDao.queryListBySWSource(stringBuffer.toString(), mdmModuleSourceEntity);
int i = 0;
@ -319,9 +367,7 @@ public class ServiceDataServiceImpl extends BaseService<ComparisonEntity,String>
formmainId = cmp_apply.getString("data_id");
vdef1=cmp_apply.getString("vdef1");
StringBuffer stringBufferDetails = new StringBuffer();
stringBufferDetails.append("select d_id as data_id,tab_name,pk_balatype,pk_acceptorg,pk_org,pk_group,pk_busitype,rowno,\n" +
"pk_supplier,pk_bankacc_r,customer,pk_currtype,pk_decidedept,gllcrate,applysum,applymny,vdef1,pk_project,vdef2,vdef3,\n" +
"vdef4,vdef10,vdef14 from v_cmp_apply_b where formmain_id= '"+formmainId+"' " );
stringBufferDetails.append("select * from v_cmp_apply_b where f_id= '"+formmainId+"' " );
List<HashMap<String, Object>> hashMapsDetails = serviceDataDao.queryListBySWSource(stringBufferDetails.toString(),mdmModuleSourceEntity);
JSONArray cmp_apply_b = new JSONArray();
if(CollectionUtils.isNotEmpty(hashMapsDetails)){
@ -374,7 +420,7 @@ public class ServiceDataServiceImpl extends BaseService<ComparisonEntity,String>
Object object = comparisonServiceimpl.saveEntity(jsonStr);
logger.info("单据视图新增结果为:{}", JSON.toJSONString(object));
result.add(object);
} else {
}/* else {
hashMap.put("appName","数智中台");
hashMap.put("appCode","800004");
hashMap.put("mdmCode", mdmCode);
@ -383,7 +429,7 @@ public class ServiceDataServiceImpl extends BaseService<ComparisonEntity,String>
Object object = comparisonServiceimpl.updateEntity(jsonStr);
logger.info("单据视图更新结果为:{}", JSON.toJSONString(result));
result.add(object);
}
}*/
}
return result;
}catch (Exception e){

View File

@ -48,4 +48,14 @@ JsonResultEntity sendEngineerPayBillToBip(JSONObject requestJson);
*/
JsonResultEntity sendReceivedToBip(JSONObject requestJson);
/**
*
* @content 付款申请单SW-D同步更新BIP
* @className: Administrator
* @author laborer
* @date 2025-04-17 9:09
*
*/
JsonResultEntity sendPayReceivedToBip(JSONObject requestJson);
}

View File

@ -165,6 +165,11 @@ public class PayBillServiceImpl extends BaseService<PaymentEntity,String> implem
return null;
}
@Override
public JsonResultEntity sendPayReceivedToBip(JSONObject requestJson) {
return null;
}
// private JSONObject bindingReceivedRLAdd(PayBillEntity pay) {
// JSONObject head = new JSONObject();
// head.put("c_bill_type","F9");//单据类型 保证金付款申请单固定F9
@ -195,7 +200,7 @@ public class PayBillServiceImpl extends BaseService<PaymentEntity,String> implem
JSONObject head = new JSONObject();
head.put("c_bill_type","F9");//单据类型 保证金付款申请单固定F9
head.put("formCode",pay.getFormCode());//单据号NC有重复校验
head.put("orgCode",pay.getOrgCode());//公司编码
head.put("orgCode",pay.getOrgCode());//公司编码fanc
head.put("deptCode",pay.getDeptCode());//事业部大类编码
head.put("fklxName",pay.getFklxName());//付款类型
head.put("zffsName",pay.getZffsName());//支付方式