提交代码
This commit is contained in:
parent
cbae49fc0a
commit
6198069118
|
@ -0,0 +1,10 @@
|
|||
package com.hzya.frame.plugin.dgx.oa.dao;
|
||||
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
import com.hzya.frame.plugin.dgx.oa.entity.PaymentOrderEntity;
|
||||
|
||||
public interface IPaymentOrderDao extends IBaseDao<PaymentOrderEntity,String> {
|
||||
|
||||
//将U9C付款单号回写OA
|
||||
Integer updatePaymentOrderDocNo(PaymentOrderEntity paymentOrderEntity);
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.hzya.frame.plugin.dgx.oa.dao.impl;
|
||||
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
import com.hzya.frame.plugin.dgx.oa.dao.IPaymentOrderDao;
|
||||
import com.hzya.frame.plugin.dgx.oa.entity.PaymentOrderEntity;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository(value = "PaymentOrderDaoImpl")
|
||||
public class PaymentOrderDaoImpl extends MybatisGenericDao<PaymentOrderEntity,String> implements IPaymentOrderDao {
|
||||
|
||||
@Override
|
||||
public Integer updatePaymentOrderDocNo(PaymentOrderEntity paymentOrderEntity) {
|
||||
return super.update("PaymentOrderEntity_update_DocNo",paymentOrderEntity);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.hzya.frame.plugin.dgx.oa.entity;
|
||||
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @content 付款单
|
||||
* @Param
|
||||
* @Return
|
||||
* @Author hecan
|
||||
* @Date 2024-09-23 16:42
|
||||
* **/
|
||||
public class PaymentOrderEntity extends BaseEntity {
|
||||
|
||||
private String docNo;//单号
|
||||
|
||||
public String getDocNo() {
|
||||
return docNo;
|
||||
}
|
||||
|
||||
public void setDocNo(String docNo) {
|
||||
this.docNo = docNo;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?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.dgx.oa.dao.impl.PaymentOrderDaoImpl">
|
||||
|
||||
<resultMap id="get-SalesOrderEntity-result" type="com.hzya.frame.plugin.dgx.oa.entity.PaymentOrderEntity" >
|
||||
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="docNo" column="docNo" 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"/>
|
||||
</resultMap>
|
||||
<!-- 查询的字段-->
|
||||
<sql id = "PaymentOrderEntity_Base_Column_List">
|
||||
|
||||
</sql>
|
||||
|
||||
<!--通过主键修改方法-->
|
||||
<update id="entity_update" parameterType = "com.hzya.frame.plugin.dgx.oa.entity.PaymentOrderEntity" >
|
||||
update formmain_0673 set
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if>
|
||||
<if test="create_time != null"> create_time = #{create_time},</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if>
|
||||
<if test="modify_time != null"> modify_time = #{modify_time},</if>
|
||||
<if test="sts != null and sts != ''"> sts = #{sts},</if>
|
||||
<if test="org_id != null and org_id != ''"> org_id = #{org_id},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!--将U9C销售订单号传递到OA上-->
|
||||
<update id="PaymentOrderEntity_update_DocNo" parameterType = "com.hzya.frame.plugin.dgx.oa.entity.PaymentOrderEntity" >
|
||||
update formmain_0673 set xxx={docNo} where id= #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<?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.dgx.oa.dao.impl.SalesOrderDaoImpl">
|
||||
|
||||
<resultMap id="get-SalesOrderEntity-result" type="com.hzya.frame.plugin.dgx.oa.entity.SalesOrderEntity" >
|
||||
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="docNo" column="docNo" 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"/>
|
||||
</resultMap>
|
||||
<!-- 查询的字段-->
|
||||
<sql id = "SalesOrderEntity_Base_Column_List">
|
||||
|
||||
</sql>
|
||||
|
||||
<!--通过主键修改方法-->
|
||||
<update id="entity_update" parameterType = "com.hzya.frame.plugin.dgx.oa.entity.SalesOrderEntity" >
|
||||
update formmain_0666 set
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if>
|
||||
<if test="create_time != null"> create_time = #{create_time},</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if>
|
||||
<if test="modify_time != null"> modify_time = #{modify_time},</if>
|
||||
<if test="sts != null and sts != ''"> sts = #{sts},</if>
|
||||
<if test="org_id != null and org_id != ''"> org_id = #{org_id},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!--将U9C销售订单号传递到OA上-->
|
||||
<update id="SalesOrderEntity_update_DocNo" parameterType = "com.hzya.frame.plugin.dgx.oa.entity.SalesOrderEntity" >
|
||||
update formmain_0666 set xxx={docNo} where id= #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.hzya.frame.plugin.dgx.oa.enums;
|
||||
|
||||
/**
|
||||
*
|
||||
* @content 流程事件枚举类型
|
||||
* @Param
|
||||
* @Return
|
||||
* @Author hecan
|
||||
* @Date 2024-09-23 18:01
|
||||
* **/
|
||||
public enum ColEventTypeEnum {
|
||||
ONBEFORESTART("onBeforeStart","流程发起前"),
|
||||
ONSTART("onStart","流程发起"),
|
||||
ONBEFORESTOP("onBeforeStop","终止前事件"),
|
||||
ONSTOP("onStop","终止事件"),
|
||||
ONBEFORECANCEL("onBeforeCancel","撤销前事件"),
|
||||
ONCANCEL("onCancel","撤销事件"),
|
||||
ONPROCESSFINISHED("onProcessFinished","结束事件"),
|
||||
ONBEFOREFINISHWORKITEM("onBeforeFinishWorkitem","处理前事件"),
|
||||
ONFINISHWORKITEM("onFinishWorkitem","处理事件"),
|
||||
ONBEFORESTEPBACK("onBeforeStepBack","回退前事件"),
|
||||
ONSTEPBACK("onStepBack","回退事件"),
|
||||
ONBEFORETAKEBACK("onBeforeTakeBack","取回前事件"),
|
||||
ONTAKEBACK("onTakeBack","取回事件"),
|
||||
;
|
||||
private String type;
|
||||
private String name;
|
||||
|
||||
ColEventTypeEnum(String type, String name) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package com.hzya.frame.plugin.dgx.oa.seeyon.entity;
|
||||
|
||||
/**
|
||||
* @Description 保存交行日志用
|
||||
* @Author xiangerlin
|
||||
* @Date 2024/3/18 14:07
|
||||
**/
|
||||
public class CfsLogEntity {
|
||||
|
||||
private String tab_name_ch;//中文表名
|
||||
private String tab_name_en;//英文表名
|
||||
private OAWorkflowEventDataEntity oaWorkflowEventDataEntity;//无流程表单数据
|
||||
|
||||
private String result;//交通银行返回的参数(解析后的)
|
||||
public CfsLogEntity() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tab_name_ch 中文表名
|
||||
* @param tab_name_en 英文表名
|
||||
* @param oaWorkflowEventDataEntity 无流程表单数据
|
||||
*/
|
||||
public CfsLogEntity(String tab_name_ch, String tab_name_en, OAWorkflowEventDataEntity oaWorkflowEventDataEntity, String result) {
|
||||
this.tab_name_ch = tab_name_ch;
|
||||
this.tab_name_en = tab_name_en;
|
||||
this.oaWorkflowEventDataEntity = oaWorkflowEventDataEntity;
|
||||
this.result=result;
|
||||
}
|
||||
|
||||
public String getTab_name_ch() {
|
||||
return tab_name_ch;
|
||||
}
|
||||
|
||||
public void setTab_name_ch(String tab_name_ch) {
|
||||
this.tab_name_ch = tab_name_ch;
|
||||
}
|
||||
|
||||
public String getTab_name_en() {
|
||||
return tab_name_en;
|
||||
}
|
||||
|
||||
public void setTab_name_en(String tab_name_en) {
|
||||
this.tab_name_en = tab_name_en;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public OAWorkflowEventDataEntity getOaWorkflowEventDataEntity() {
|
||||
return oaWorkflowEventDataEntity;
|
||||
}
|
||||
|
||||
public void setOaWorkflowEventDataEntity(OAWorkflowEventDataEntity oaWorkflowEventDataEntity) {
|
||||
this.oaWorkflowEventDataEntity = oaWorkflowEventDataEntity;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,143 @@
|
|||
package com.hzya.frame.plugin.dgx.oa.seeyon.entity;
|
||||
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Content OA监听事件提供的表单内容
|
||||
* @Author 👻👻👻👻👻👻👻👻👻👻 gjh
|
||||
* @Date 2020-12-24 8:38
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class OAWorkflowEventDataEntity {
|
||||
private String id;//业务表单id
|
||||
private String eventType;//流程类型
|
||||
/** 流程ID*/
|
||||
private String summaryId;
|
||||
/** 节点ID*/
|
||||
private String affairId;
|
||||
private String currentActivityId;
|
||||
/** 表单表的FORM ID,用此字段标记是哪个流程*/
|
||||
private String formApp;
|
||||
/****/
|
||||
private String formViewOperation;
|
||||
private Object summaryObj;
|
||||
private String deeCfgId;
|
||||
private String currentNodeLast;
|
||||
private Map<String, Object> businessData;
|
||||
private Map<String, Object> extData;
|
||||
private String businessDataStr;
|
||||
|
||||
private String OnProcessFinished;
|
||||
public String getSummaryId() {
|
||||
return summaryId;
|
||||
}
|
||||
|
||||
public void setSummaryId(String summaryId) {
|
||||
this.summaryId = summaryId;
|
||||
}
|
||||
|
||||
public String getAffairId() {
|
||||
return affairId;
|
||||
}
|
||||
|
||||
public void setAffairId(String affairId) {
|
||||
this.affairId = affairId;
|
||||
}
|
||||
|
||||
public String getCurrentActivityId() {
|
||||
return currentActivityId;
|
||||
}
|
||||
|
||||
public void setCurrentActivityId(String currentActivityId) {
|
||||
this.currentActivityId = currentActivityId;
|
||||
}
|
||||
|
||||
public String getFormApp() {
|
||||
return formApp;
|
||||
}
|
||||
|
||||
public void setFormApp(String formApp) {
|
||||
this.formApp = formApp;
|
||||
}
|
||||
|
||||
public String getFormViewOperation() {
|
||||
return formViewOperation;
|
||||
}
|
||||
|
||||
public void setFormViewOperation(String formViewOperation) {
|
||||
this.formViewOperation = formViewOperation;
|
||||
}
|
||||
|
||||
public Object getSummaryObj() {
|
||||
return summaryObj;
|
||||
}
|
||||
|
||||
public void setSummaryObj(Object summaryObj) {
|
||||
this.summaryObj = summaryObj;
|
||||
}
|
||||
|
||||
public String getDeeCfgId() {
|
||||
return deeCfgId;
|
||||
}
|
||||
|
||||
public void setDeeCfgId(String deeCfgId) {
|
||||
this.deeCfgId = deeCfgId;
|
||||
}
|
||||
|
||||
public String getCurrentNodeLast() {
|
||||
return currentNodeLast;
|
||||
}
|
||||
|
||||
public void setCurrentNodeLast(String currentNodeLast) {
|
||||
this.currentNodeLast = currentNodeLast;
|
||||
}
|
||||
|
||||
public Map<String, Object> getBusinessData() {
|
||||
return businessData;
|
||||
}
|
||||
|
||||
public void setBusinessData(Map<String, Object> businessData) {
|
||||
this.businessData = businessData;
|
||||
}
|
||||
|
||||
public Map<String, Object> getExtData() {
|
||||
return extData;
|
||||
}
|
||||
|
||||
public void setExtData(Map<String, Object> extData) {
|
||||
this.extData = extData;
|
||||
}
|
||||
|
||||
public String getBusinessDataStr() {
|
||||
return businessDataStr;
|
||||
}
|
||||
|
||||
public void setBusinessDataStr(String businessDataStr) {
|
||||
this.businessDataStr = businessDataStr;
|
||||
}
|
||||
|
||||
public String getOnProcessFinished() {
|
||||
return OnProcessFinished;
|
||||
}
|
||||
|
||||
public void setOnProcessFinished(String onProcessFinished) {
|
||||
OnProcessFinished = onProcessFinished;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getEventType() {
|
||||
return eventType;
|
||||
}
|
||||
|
||||
public void setEventType(String eventType) {
|
||||
this.eventType = eventType;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.hzya.frame.plugin.dgx.oa.seeyon.service;
|
||||
|
||||
import com.hzya.frame.plugin.dgx.oa.seeyon.entity.CfsLogEntity;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
|
||||
/**
|
||||
* @Description oa单据推送交行日志
|
||||
* @Author xiangerlin
|
||||
* @Date 2024/3/18 13:40
|
||||
**/
|
||||
public interface ICfsLogService {
|
||||
|
||||
/**
|
||||
* 保存日志
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
JsonResultEntity importCfsLog(CfsLogEntity entity);
|
||||
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package com.hzya.frame.plugin.dgx.oa.seeyon.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.plugin.dgx.oa.seeyon.entity.CfsLogEntity;
|
||||
import com.hzya.frame.plugin.dgx.oa.seeyon.service.ICfsLogService;
|
||||
import com.hzya.frame.plugin.dgx.oa.service.impl.SeeYonInterFaceImpl;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @Description oa单据推送交行日志
|
||||
* @Author xiangerlin
|
||||
* @Date 2024/3/18 13:40
|
||||
**/
|
||||
@Service
|
||||
public class CfsLogServiceImpl implements ICfsLogService {
|
||||
|
||||
@Autowired
|
||||
private SeeYonInterFaceImpl seeYonInterFace;
|
||||
|
||||
/**
|
||||
* 保存日志
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public JsonResultEntity importCfsLog(CfsLogEntity entity) {
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("tab_name_ch",entity.getTab_name_ch());
|
||||
data.put("tab_name_en",entity.getTab_name_en());
|
||||
data.put("bill_code",entity.getOaWorkflowEventDataEntity().getBusinessDataStr());
|
||||
data.put("form_app_id",entity.getOaWorkflowEventDataEntity().getFormApp());
|
||||
data.put("event_type","onProcessFinished");
|
||||
data.put("id",entity.getOaWorkflowEventDataEntity().getId());
|
||||
data.put("title","");//流程标题,这个字段暂时取不到
|
||||
data.put("result",entity.getResult());//返回的报文
|
||||
if (StrUtil.isNotEmpty(entity.getResult())){
|
||||
JSONObject resultObj = JSONObject.parseObject(entity.getResult());
|
||||
JSONArray jsonArrayData = resultObj.getJSONArray("Data");
|
||||
JSONObject jsonData = JSON.parseObject(JSON.toJSONString(jsonArrayData.get(0)));
|
||||
String mErrorMsg = jsonData.getString("m_errorMsg");//返回的错误信息
|
||||
String mId = jsonData.getString("m_iD");//返回的m_id
|
||||
String mCode = jsonData.getString("m_code");//返回的单号
|
||||
data.put("m_errorMsg",mErrorMsg);
|
||||
data.put("m_iD",mId);
|
||||
data.put("m_code",mCode);
|
||||
}
|
||||
jsonArray.add(data);
|
||||
JSONObject jsonStr = new JSONObject();
|
||||
jsonStr.put("type","archives");
|
||||
jsonStr.put("templateCode","");
|
||||
jsonStr.put("attribute",jsonArray);
|
||||
//1、解析数据
|
||||
//2、保存日志
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("jsonStr",jsonStr);
|
||||
JsonResultEntity jsonResultEntity = seeYonInterFace.thirdInterfaceSend(jsonObject);
|
||||
//调用日志模板
|
||||
return jsonResultEntity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private String getCode(CfsLogEntity entity){
|
||||
if (null != entity && null != entity.getOaWorkflowEventDataEntity()){
|
||||
String tableName = entity.getTab_name_en();
|
||||
String jsonStr = entity.getOaWorkflowEventDataEntity().getBusinessDataStr();
|
||||
JSONObject jsonObject = JSONObject.parseObject(jsonStr);
|
||||
if (null != jsonObject){
|
||||
String bill_code=null;
|
||||
switch (tableName){
|
||||
case "formmain_0673"://付款单
|
||||
bill_code=jsonObject.getJSONObject("formmain_0673").getString("field0021");
|
||||
break;
|
||||
case "formmain_0666"://销售订单
|
||||
bill_code=jsonObject.getJSONObject("formmain_0666").getString("field0005");
|
||||
break;
|
||||
}
|
||||
return bill_code;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.hzya.frame.plugin.dgx.oa.service;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
|
||||
/**
|
||||
* 致远OA接口类
|
||||
* @author 👻👻👻👻👻👻👻👻👻👻 gjh
|
||||
* @version 1.0
|
||||
* @content
|
||||
* @date 2023-08-22 9:29
|
||||
*/
|
||||
public interface ISeeYonInterFace {
|
||||
|
||||
/***
|
||||
* 发起OA表单方法
|
||||
* @content:
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-22 9:31
|
||||
* @param requestData 请求json
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
JsonResultEntity thirdInterfaceSend(JSONObject requestData);
|
||||
}
|
|
@ -0,0 +1,289 @@
|
|||
package com.hzya.frame.plugin.dgx.oa.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.plugin.dgx.oa.entity.*;
|
||||
import com.hzya.frame.plugin.dgx.oa.enums.ColEventTypeEnum;
|
||||
import com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity;
|
||||
import com.hzya.frame.sysnew.application.database.service.ISysApplicationDatabaseService;
|
||||
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
|
||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @content 扩展类 解析参数并重新进行组装
|
||||
* @Param
|
||||
* @Return
|
||||
* @Author hecan
|
||||
* @Date 2024-09-23 17:18
|
||||
* **/
|
||||
@Service(value = "ParseAndAssembleService")
|
||||
public class ParseAndAssembleService {
|
||||
Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Autowired
|
||||
private ISysApplicationDatabaseService sysApplicationDatabaseService;
|
||||
|
||||
public SysExtensionApiEntity parseAndAssemble(SysExtensionApiEntity entity){
|
||||
try {
|
||||
String bodys = entity.getBodys();
|
||||
String dataSourceCode = "";
|
||||
SysApplicationEntity receiveApp = entity.getReceiveApp();
|
||||
if (null != receiveApp){
|
||||
SysApplicationDatabaseEntity sysDatabaseEntity = new SysApplicationDatabaseEntity();
|
||||
sysDatabaseEntity.setAppId(receiveApp.getId());
|
||||
List<SysApplicationDatabaseEntity> dataBaseList = sysApplicationDatabaseService.query(sysDatabaseEntity);
|
||||
if (CollectionUtils.isNotEmpty(dataBaseList)){
|
||||
dataSourceCode = dataBaseList.get(0).getSourceCode();
|
||||
}
|
||||
}
|
||||
Map<String, String> headers = entity.getHeaders();
|
||||
String formmainTableName = headers.get("formmainTableName");
|
||||
String forsonTableName = headers.get("forsonTableName");
|
||||
String forsonDetailsTableName = headers.get("forsonDetailsTableName");
|
||||
String djlx = headers.get("djlx");
|
||||
JSONObject bodyObj = JSONObject.parseObject(bodys);
|
||||
//事件类型
|
||||
String eventType = bodyObj.getString("eventType");
|
||||
//formApp 表单id
|
||||
String formApp = bodyObj.getString("formApp");
|
||||
//summaryId
|
||||
String summaryId = bodyObj.getString("summaryId");
|
||||
JSONObject jsonObject = bodyObj.getJSONObject("businessDataStr");
|
||||
if(null!=jsonObject){
|
||||
//得到主表和明细表
|
||||
JSONObject formmainData = jsonObject.getJSONObject(formmainTableName);
|
||||
JSONArray forsonData = jsonObject.getJSONArray(forsonTableName);
|
||||
JSONArray forsonDetails = jsonObject.getJSONArray(forsonDetailsTableName);
|
||||
String result="";
|
||||
//如果单据是销售订单
|
||||
if(DjlxEnum.SALES.type.equals(djlx)){
|
||||
result= sales(eventType,formmainData,forsonData,forsonDetails);
|
||||
}
|
||||
//如果是付款单
|
||||
else if(DjlxEnum.PAYMENT.type.equals(djlx)){
|
||||
result= payment(eventType,formmainData,forsonData,forsonDetails);
|
||||
}
|
||||
if(StrUtil.isNotEmpty(result)){
|
||||
JSONObject jsonStr = JSONObject.parseObject(result);
|
||||
jsonStr.put("formApp",formApp);
|
||||
jsonStr.put("id",formmainData.getString("id"));
|
||||
jsonStr.put("dataSourceCode",dataSourceCode);
|
||||
|
||||
String jsonString = jsonStr.toJSONString();
|
||||
entity.setBodys(jsonString);
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.info("======在调用接口之前,流程参数组装错误:{}===",e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @content 销售订单在调用之前参数组装
|
||||
* @Param headers:头部信息
|
||||
* eventType:事件类型
|
||||
* summaryId:流程id
|
||||
* dataSourceCode:数据库编码
|
||||
* formmainData:主表数据
|
||||
* forsonData:明细表数据
|
||||
* @Return
|
||||
* @Author hecan
|
||||
* @Date 2024-09-23 17:53
|
||||
* **/
|
||||
private String sales(String eventType, JSONObject formmainData, JSONArray forsonData,JSONArray forsonDetailsTableName){
|
||||
try {
|
||||
//流程结束
|
||||
if(ColEventTypeEnum.ONPROCESSFINISHED.getType().equals(eventType)){
|
||||
JSONObject jsonMain=new JSONObject();
|
||||
jsonMain.put("OrgCode",formmainData.getString(""));//组织
|
||||
jsonMain.put("DocumentType","SO1");//单据类型
|
||||
jsonMain.put("DocNo",formmainData.getString("field0005"));//单号
|
||||
jsonMain.put("OrderBy",formmainData.getString("field0009"));//客户
|
||||
jsonMain.put("BusinessDate",formmainData.getString("field0017"));//日期
|
||||
jsonMain.put("SaleDepartment",formmainData.getString("field0010"));//部门
|
||||
jsonMain.put("Seller",formmainData.getString("field0006"));//业务员
|
||||
jsonMain.put("IsPriceIncludeTax",true);//价格是否含税
|
||||
jsonMain.put("Memo",formmainData.getString("field0020"));//备注
|
||||
jsonMain.put("",formmainData.getString("field0003"));//合同号
|
||||
jsonMain.put("",formmainData.getString("field0004"));//需求分类
|
||||
jsonMain.put("",formmainData.getString("field0007"));//项目
|
||||
jsonMain.put("",formmainData.getString(""));//厂区
|
||||
jsonMain.put("",formmainData.getString("field0012"));//贸易方式
|
||||
if(CollectionUtils.isNotEmpty(forsonData)){
|
||||
JSONArray jsonArray=new JSONArray();
|
||||
for (Object forsonDatum : forsonData) {
|
||||
JSONObject jsonSOLineDTOList = JSON.parseObject(JSON.toJSONString(forsonDatum));
|
||||
JSONObject jsonDetails=new JSONObject();
|
||||
jsonDetails.put("ShipTogetherFlag","-1");//成套发货标志
|
||||
jsonDetails.put("TradePath",jsonSOLineDTOList.getString(""));//贸易路径
|
||||
jsonDetails.put("DocLineNo",jsonSOLineDTOList.getString("field0021"));//行号
|
||||
jsonDetails.put("ItemCode",jsonSOLineDTOList.getString("field0028"));//料号
|
||||
jsonDetails.put("OrderByQtyTU",jsonSOLineDTOList.getString("field0031"));//数量
|
||||
jsonDetails.put("OrderByQtyPU",jsonSOLineDTOList.getString(""));//计价数量
|
||||
jsonDetails.put("FinallyPriceTC",jsonSOLineDTOList.getString("field0036"));//最终价
|
||||
jsonDetails.put("NetMoneyTC",jsonSOLineDTOList.getString("field0039"));//未税价格
|
||||
jsonDetails.put("TaxMoneyTC",jsonSOLineDTOList.getString("field0040"));//税额
|
||||
jsonDetails.put("DiscountTC",jsonSOLineDTOList.getString("field0037"));//折扣率
|
||||
jsonDetails.put("TotalMoneyTC",jsonSOLineDTOList.getString("field0038"));//价税合计
|
||||
jsonDetails.put("PriceSource",jsonSOLineDTOList.getString(""));//价格来源
|
||||
//jsonDetails.put("TaxSchedule","YZ08");//税组合
|
||||
jsonDetails.put("Memo",jsonSOLineDTOList.getString("field0042"));//备注
|
||||
jsonDetails.put("FreeType",jsonSOLineDTOList.getString("field0034"));//免费品类型
|
||||
jsonDetails.put("Project",jsonSOLineDTOList.getString("field0026"));//项目编码
|
||||
JSONObject jsonDesc=new JSONObject();
|
||||
jsonDesc.put("PrivateDescSeg2",jsonSOLineDTOList.getString(""));//睿本云订单号
|
||||
jsonDetails.put("DescFlexField",jsonDesc);
|
||||
|
||||
if(CollectionUtils.isNotEmpty(forsonDetailsTableName)){
|
||||
JSONArray jsonArrayLineDTO=new JSONArray();
|
||||
for (Object o : forsonDetailsTableName) {
|
||||
JSONObject jsonSOShiplineDTOListObject = JSON.parseObject(JSON.toJSONString(o));
|
||||
JSONObject jsonObjectShiplineDTO=new JSONObject();
|
||||
jsonObjectShiplineDTO.put("ItemCode",jsonSOLineDTOList.getString("field0028"));//料号
|
||||
jsonObjectShiplineDTO.put("SupplySource",jsonSOShiplineDTOListObject.getString(""));//供应来源
|
||||
jsonObjectShiplineDTO.put("DemandTransformType",jsonSOShiplineDTOListObject.getString(""));//供应类型
|
||||
jsonObjectShiplineDTO.put("ShiperOrg",jsonSOShiplineDTOListObject.getString(""));//货主组织
|
||||
jsonObjectShiplineDTO.put("SupplyOrg",jsonSOShiplineDTOListObject.getString(""));//供应组织
|
||||
jsonObjectShiplineDTO.put("RequireDate",jsonSOShiplineDTOListObject.getString(""));//交期
|
||||
jsonObjectShiplineDTO.put("DemandType",jsonSOShiplineDTOListObject.getString(""));//需求分类
|
||||
jsonArrayLineDTO.add(jsonObjectShiplineDTO);
|
||||
jsonDetails.put("SOShiplineDTOList",jsonArrayLineDTO);
|
||||
}
|
||||
}
|
||||
|
||||
jsonArray.add(jsonDetails);
|
||||
jsonMain.put("SOLineDTOList",jsonArray);
|
||||
}
|
||||
}
|
||||
String jsonString = jsonMain.toJSONString();
|
||||
logger.info("====OA销售订单在流程结束组装的参数为:{}====",jsonString);
|
||||
return jsonString;
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.info("=====销售订单在调用之前参数组装失败:{}====",e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @content 付款单在调用之前参数组装
|
||||
* @Param headers:头部信息
|
||||
* eventType:事件类型
|
||||
* summaryId:流程id
|
||||
* dataSourceCode:数据库编码
|
||||
* formmainData:主表数据
|
||||
* forsonData:明细表数据
|
||||
* @Return
|
||||
* @Author hecan
|
||||
* @Date 2024-09-23 17:53
|
||||
* **/
|
||||
private String payment(String eventType, JSONObject formmainData, JSONArray forsonData,JSONArray forsonDetailsTableName){
|
||||
try {
|
||||
//流程结束
|
||||
if(ColEventTypeEnum.ONPROCESSFINISHED.getType().equals(eventType)){
|
||||
JSONObject jsonMain=new JSONObject();
|
||||
jsonMain.put("SrcBillOrgCode","1001");//来源组织
|
||||
jsonMain.put("BizOrgCode","1001");//业务组织
|
||||
jsonMain.put("DocumentTypeCode","APP001");//单据类型
|
||||
jsonMain.put("DocNo",formmainData.getString("field0021"));//单号
|
||||
jsonMain.put("PayObjType",formmainData.getString("field0027"));//付款对象
|
||||
jsonMain.put("SuppCode",formmainData.getString("field0030"));//供应商
|
||||
jsonMain.put("SuppName",formmainData.getString(""));//供应商名称
|
||||
jsonMain.put("SuppSiteCode",formmainData.getString("field0019"));//供应商位置
|
||||
jsonMain.put("SuppSiteName",formmainData.getString(""));//供应商位置名称
|
||||
jsonMain.put("CustCode",formmainData.getString(""));//客户
|
||||
jsonMain.put("CustName",formmainData.getString(""));//客户名称
|
||||
jsonMain.put("CustSiteCode",formmainData.getString(""));//客户位置
|
||||
jsonMain.put("CustSiteName",formmainData.getString(""));//客户位置名称
|
||||
jsonMain.put("PayDate",formmainData.getString("field0025"));//付款日期
|
||||
jsonMain.put("PCCode","C001");//币种
|
||||
jsonMain.put("Note","测试付款单");//备注
|
||||
if(CollectionUtils.isNotEmpty(forsonData)){
|
||||
JSONArray jsonArray=new JSONArray();
|
||||
for (Object forsonDatum : forsonData) {
|
||||
JSONObject jsonPayBillLines = JSON.parseObject(JSON.toJSONString(forsonDatum));
|
||||
JSONObject jsonDetails=new JSONObject();
|
||||
jsonDetails.put("LineNum",jsonPayBillLines.getString("field0001"));//行号
|
||||
jsonDetails.put("SettlementMethodCode",jsonPayBillLines.getString("field0002"));//结算方式
|
||||
jsonDetails.put("NoteNo",jsonPayBillLines.getString("field0003"));//票据号
|
||||
jsonDetails.put("PayBkAccCode",jsonPayBillLines.getString("field0007"));//付款银行账号
|
||||
jsonDetails.put("PayBACCode",jsonPayBillLines.getString("field0008"));//账户币种
|
||||
JSONObject jsonDesc=new JSONObject();
|
||||
jsonDesc.put("PrivateDescSeg2",jsonPayBillLines.getString(""));//睿本云订单号
|
||||
jsonDetails.put("DescFlexField",jsonDesc);
|
||||
|
||||
if(CollectionUtils.isNotEmpty(forsonDetailsTableName)){
|
||||
JSONArray jsonArrayUseLine=new JSONArray();
|
||||
for (Object o : forsonDetailsTableName) {
|
||||
JSONObject PayBillUseLine = JSON.parseObject(JSON.toJSONString(o));
|
||||
JSONObject jsonPayBillUse=new JSONObject();
|
||||
jsonPayBillUse.put("LineNum",PayBillUseLine.getString("field0047"));//行号
|
||||
jsonPayBillUse.put("BizOrgCode","1001");//业务组织
|
||||
jsonPayBillUse.put("Money",PayBillUseLine.getString("field0052"));//金额
|
||||
jsonPayBillUse.put("SettlementFee",jsonPayBillLines.getString("field0005"));//手续费
|
||||
jsonPayBillUse.put("PayProperty","0");//用途
|
||||
jsonArrayUseLine.add(jsonPayBillUse);
|
||||
jsonDetails.put("PayBillUseLines",jsonArrayUseLine);
|
||||
}
|
||||
}
|
||||
|
||||
jsonArray.add(jsonDetails);
|
||||
jsonMain.put("PayBillLines",jsonArray);
|
||||
}
|
||||
}
|
||||
String jsonString = jsonMain.toJSONString();
|
||||
logger.info("====OA付款单在流程结束组装的参数为:{}====",jsonString);
|
||||
return jsonString;
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.info("=====付款单在调用之前参数组装失败:{}====",e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private enum DjlxEnum {
|
||||
SALES("sales","销售订单"),
|
||||
PAYMENT("payment","付款单"),
|
||||
;
|
||||
|
||||
private String type;
|
||||
private String name;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
DjlxEnum(String type, String name) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
package com.hzya.frame.plugin.dgx.oa.service.impl;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.plugin.dgx.oa.service.ISeeYonInterFace;
|
||||
import com.hzya.frame.stringutil.StringUtil;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import com.hzya.frame.web.exception.BaseSystemException;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author 👻👻👻👻👻👻👻👻👻👻 gjh
|
||||
* @version 1.0
|
||||
* @content
|
||||
* @date 2023-08-22 9:30
|
||||
*/
|
||||
@Service(value = "seeYonInterFace")
|
||||
public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SeeYonInterFaceImpl.class);
|
||||
/*** rest 用户名*/
|
||||
private static final String RESTUSERNAME = "hzyaRest";
|
||||
/*** rest 密码*/
|
||||
private static final String RESTPASSWORD = "a5ce21b8-91db-4cec-b3e3-3e44719655fd";
|
||||
|
||||
private static final String sendUrl = "http://xxxx/seeyon/";
|
||||
|
||||
/****
|
||||
* @Content:发起无流程表单接口实现
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @Date 2019/12/23 17:03
|
||||
* @Param [templateCode 模版编码, sendLoginName 发送人登录帐号 ,xmlData ]
|
||||
* @return java.lang.Integer
|
||||
**/
|
||||
public static JsonResultEntity saveNoProcess(String templateCode , String interfaceUrl,String sendLoginName, String xmlData) {
|
||||
String token = getToken(RESTUSERNAME, RESTPASSWORD, sendLoginName);
|
||||
Map res = new HashMap();
|
||||
res.put("loginName", sendLoginName);
|
||||
res.put("dataXml", xmlData);
|
||||
res.put("token", token);
|
||||
String result = HttpRequest.post(sendUrl + interfaceUrl + templateCode).header("token", token).body(JSON.toJSONString(res)).execute().body();
|
||||
logger.info("无流程表单执行结果:" + result);
|
||||
return BaseResult.getFailureMessageEntity("执行成功", result);
|
||||
}
|
||||
|
||||
private static String getToken(String userName, String password, String loginName) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
/** 获取token*/
|
||||
|
||||
jsonObject.put("userName", userName);
|
||||
jsonObject.put("password", password);
|
||||
jsonObject.put("loginName", loginName);
|
||||
logger.info("请求获取token开始---------------------------------------------");
|
||||
logger.info("请求参数" + jsonObject.toJSONString());
|
||||
String result = HttpUtil.post(sendUrl + "rest/token", jsonObject.toJSONString());
|
||||
logger.info("获取token结果---------------------------------------------" + result);
|
||||
logger.info("获取token结果---------------------------------------------" + result);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JsonResultEntity thirdInterfaceSend(JSONObject requestData) {
|
||||
JSONObject jsonStr = requestData.getJSONObject("jsonStr");
|
||||
if (ObjectUtils.isEmpty(jsonStr)) {
|
||||
throw new BaseSystemException("jsonStr为空!请传递参数");
|
||||
}
|
||||
//类型 flow archives
|
||||
String type = jsonStr.getString("type");
|
||||
if (StringUtils.isEmpty(type)) {
|
||||
throw new BaseSystemException("请传递类型!type 流程表单:flow 基础档案:archives");
|
||||
}
|
||||
//模版编号
|
||||
String templateCode = jsonStr.getString("templateCode");
|
||||
if (StringUtils.isEmpty(templateCode)) {
|
||||
throw new BaseSystemException("请传入模版编号!templateCode不允许为空");
|
||||
}
|
||||
String attributeArrayStr = jsonStr.getString("attribute");
|
||||
if (StringUtils.isEmpty(attributeArrayStr)) {
|
||||
throw new BaseSystemException("attribute不允许为空");
|
||||
}
|
||||
List<JSONObject> attributeArray = JSON.parseArray(attributeArrayStr, JSONObject.class);
|
||||
JsonResultEntity result = null;
|
||||
for (JSONObject jsonObject : attributeArray){
|
||||
String dataXml = createCfsTempData(jsonObject);
|
||||
String loginName = "seeyon";
|
||||
Map res = new HashMap();
|
||||
res.put("loginName", loginName);
|
||||
res.put("dataXml", dataXml);
|
||||
result = saveNoProcess( "formmain_0527","rest/form/import/", loginName, dataXml);
|
||||
logger.info("日志模板发起无流程表单结果:" + result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private String createCfsTempData(JSONObject jsonObject){
|
||||
String xml = "<forms version=\"2.1\"><formExport><summary id=\"-8308614817594585886\" name=\"formmain_0527\"/><definitions><column id=\"field0004\" type=\"0\" name=\"表单名称\" isNullable=\"false\" length=\"100\"/><column id=\"field0005\" type=\"0\" name=\"数据库表名\" isNullable=\"false\" length=\"100\"/><column id=\"field0006\" type=\"0\" name=\"表单ID\" isNullable=\"false\" length=\"100\"/><column id=\"field0007\" type=\"0\" name=\"表单编号\" isNullable=\"false\" length=\"100\"/><column id=\"field0008\" type=\"0\" name=\"流程标题\" isNullable=\"false\" length=\"100\"/><column id=\"field0009\" type=\"0\" name=\"事件类型\" isNullable=\"false\" length=\"100\"/><column id=\"field0010\" type=\"0\" name=\"formApp\" isNullable=\"false\" length=\"100\"/><column id=\"field0011\" type=\"0\" name=\"推送结果\" isNullable=\"false\" length=\"100\"/><column id=\"field0012\" type=\"0\" name=\"流水号\" isNullable=\"false\" length=\"100\"/><column id=\"field0013\" type=\"0\" name=\"返回信息\" isNullable=\"false\" length=\"100\"/></definitions><values><column name=\"表单名称\"><value><![CDATA[{}]]></value></column><column name=\"数据库表名\"><value><![CDATA[{}]]></value></column><column name=\"表单ID\"><value><![CDATA[{}]]></value></column><column name=\"表单编号\"><value><![CDATA[{}]]></value></column><column name=\"流程标题\"><value><![CDATA[{}]]></value></column><column name=\"事件类型\"><value><![CDATA[{}]]></value></column><column name=\"formApp\"><value><![CDATA[{}]]></value></column><column name=\"推送结果\"><value><![CDATA[{}]]></value></column><column name=\"流水号\"><value><![CDATA[{}]]></value></column><column name=\"返回信息\"><value><![CDATA[{}]]></value></column></values><subForms/></formExport></forms>";
|
||||
String tabNameCh = StringUtil.nullConvert(jsonObject.getString("tab_name_ch"));
|
||||
String tabNameEn = StringUtil.nullConvert(jsonObject.getString("tab_name_en"));
|
||||
String id = StringUtil.nullConvert(jsonObject.getString("id"));
|
||||
String billCode = StringUtil.nullConvert(jsonObject.getString("bill_code"));
|
||||
String title = StringUtil.nullConvert(jsonObject.getString("title"));
|
||||
String eventType = StringUtil.nullConvert(jsonObject.getString("event_type"));
|
||||
String formApp = StringUtil.nullConvert(jsonObject.getString("form_app_id"));
|
||||
String mErrorMsg = StringUtil.nullConvert(jsonObject.getString("m_errorMsg"));
|
||||
String mId = StringUtil.nullConvert(jsonObject.getString("m_iD"));
|
||||
String mCode = StringUtil.nullConvert(jsonObject.getString("m_code"));
|
||||
String result = StringUtil.nullConvert(jsonObject.getString("result"));
|
||||
String dataXml = StrUtil.format(xml,tabNameCh,tabNameEn,id,billCode,title,eventType,formApp,mErrorMsg,mId,mCode,result);
|
||||
return dataXml;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.hzya.frame.plugin.dgx.u9c.service;
|
||||
|
||||
import com.hzya.frame.basedao.service.IBaseService;
|
||||
|
||||
/**
|
||||
*
|
||||
* @content 获取U9Ctoken
|
||||
* @Param
|
||||
* @Return
|
||||
* @Author hecan
|
||||
* @Date 2024-09-24 11:33
|
||||
* **/
|
||||
public interface IAcquireTokenService extends IBaseService {
|
||||
|
||||
/**
|
||||
*
|
||||
* @content 获取Token
|
||||
* @Param
|
||||
* @Return
|
||||
* @Author hecan
|
||||
* @Date 2024-09-24 11:36
|
||||
* **/
|
||||
String getToken();
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package com.hzya.frame.plugin.dgx.u9c.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
import com.hzya.frame.plugin.dgx.u9c.service.IAcquireTokenService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
*
|
||||
* @content 获取U9Ctoken
|
||||
* @Param
|
||||
* @Return
|
||||
* @Author hecan
|
||||
* @Date 2024-09-24 11:32
|
||||
* **/
|
||||
@Service(value = "AcquireTokenServiceImpl")
|
||||
public class AcquireTokenServiceImpl extends BaseService implements IAcquireTokenService {
|
||||
|
||||
private static String TOKENTEST="http://122.224.56.190:8082";
|
||||
private static String URL="/U9C/webapi/OAuth2/AuthLogin";
|
||||
@Override
|
||||
public String getToken() {
|
||||
String clientid="001";
|
||||
String clientsecret="1f8b947a5e7543d09ebb2a051d1725da";
|
||||
String entCode="002";
|
||||
String userCode="OA";
|
||||
String orgCode="1001";
|
||||
String result=null;
|
||||
try {
|
||||
String params="?clientid="+clientid+"&clientsecret="+clientsecret+"&entCode="+entCode+"&userCode="+userCode+"&orgCode="+orgCode;
|
||||
logger.info("======获取德广信U9Ctoken请求参数为:{}===",TOKENTEST + params);
|
||||
String body = HttpRequest.get(TOKENTEST+URL + params).execute().body();
|
||||
logger.info("======获取德广信U9Ctoken返回参数为:{}=====",body);
|
||||
if(StrUtil.isNotEmpty(body)){
|
||||
JSONObject jsonObject = JSONObject.parseObject(body);
|
||||
result = jsonObject.getString("Data");
|
||||
}
|
||||
return result;
|
||||
}catch (Exception e){
|
||||
logger.info("===获取德广信U9Ctoken失败:{}====",e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue