堃博OA对接宁波银行
This commit is contained in:
parent
c8972b3ac7
commit
5202887be0
|
@ -23,5 +23,14 @@ public interface IPayBillPluginInitializerDao extends IBaseDao<PayBillEntity, St
|
||||||
*/
|
*/
|
||||||
|
|
||||||
List<HashMap<String, Object>> getOaBillData(String str , PayBillEntity entity)throws Exception;
|
List<HashMap<String, Object>> getOaBillData(String str , PayBillEntity entity)throws Exception;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @content 通过ID修改单据状态
|
||||||
|
* @author laborer
|
||||||
|
* @date 2024/7/10 0010 17:32
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
int updateStateForId(String str , PayBillEntity entity)throws Exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,5 +24,10 @@ public class PayBillPluginInitializerDaoImpl extends MybatisGenericDao<PayBillEn
|
||||||
public List<HashMap<String, Object>> getOaBillData(String str, PayBillEntity entity)throws Exception {
|
public List<HashMap<String, Object>> getOaBillData(String str, PayBillEntity entity)throws Exception {
|
||||||
return execSqlService.execSelectSql(str, "");
|
return execSqlService.execSelectSql(str, "");
|
||||||
}
|
}
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public int updateStateForId(String str , PayBillEntity entity)throws Exception {
|
||||||
|
return super.update("com.hzya.frame.plugin.a8bill.dao.impl.PayBillPluginInitializerDaoImpl.PayBillEntity_update",entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,14 @@ import com.hzya.frame.web.entity.BaseEntity;
|
||||||
* @since 2024-06-07 18:30:04
|
* @since 2024-06-07 18:30:04
|
||||||
*/
|
*/
|
||||||
public class PayBillEntity extends BaseEntity {
|
public class PayBillEntity extends BaseEntity {
|
||||||
|
private String sql;
|
||||||
|
|
||||||
|
public String getSql() {
|
||||||
|
return sql;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSql(String sql) {
|
||||||
|
this.sql = sql;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,11 @@
|
||||||
id
|
id
|
||||||
|
|
||||||
</sql>
|
</sql>
|
||||||
|
<!--执行update语句-->
|
||||||
|
<update id="PayBillEntity_update" parameterType="com.hzya.frame.plugin.a8bill.entity.PayBillEntity">
|
||||||
|
<if test="null != sql and sql != ''">
|
||||||
|
${sql}
|
||||||
|
</if>
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.hzya.frame.plugin.a8bill.plugin;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.hzya.frame.base.PluginBaseEntity;
|
||||||
|
import com.hzya.frame.plugin.a8bill.dao.IPayBillPluginInitializerDao;
|
||||||
|
import com.hzya.frame.plugin.a8bill.entity.PayBillEntity;
|
||||||
|
import com.hzya.frame.plugin.a8bill.util.NingBBankUtil;
|
||||||
|
import com.hzya.frame.seeyon.paybill.service.IPayBillService;
|
||||||
|
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 java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 堃博OA单据推送宁波银行
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2024年7月10日14:13:18
|
||||||
|
*/
|
||||||
|
public class KunBNingBBankPluginInitializer extends PluginBaseEntity{
|
||||||
|
Logger logger = LoggerFactory.getLogger(KunBNingBBankPluginInitializer.class);
|
||||||
|
@Autowired
|
||||||
|
private IPayBillPluginInitializerDao payBillDao;
|
||||||
|
@Override
|
||||||
|
public void initialize() {
|
||||||
|
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() {
|
||||||
|
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPluginId() {
|
||||||
|
return "KunBNingBBankPluginInitializer";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPluginName() {
|
||||||
|
return "KunBNingBBankPluginInitializer插件";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPluginLabel() {
|
||||||
|
return "KunBNingBBankPluginInitializer";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPluginType() {
|
||||||
|
return "1";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public JsonResultEntity executeBusiness(JSONObject requestJson) {
|
||||||
|
|
||||||
|
return new JsonResultEntity("成功",true,new JsonResultEntity());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,176 @@
|
||||||
|
package com.hzya.frame.plugin.a8bill.plugin;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.hzya.frame.base.PluginBaseEntity;
|
||||||
|
import com.hzya.frame.plugin.a8bill.dao.IPayBillPluginInitializerDao;
|
||||||
|
import com.hzya.frame.plugin.a8bill.entity.PayBillEntity;
|
||||||
|
import com.hzya.frame.plugin.a8bill.util.NingBBankUtil;
|
||||||
|
import com.hzya.frame.seeyon.paybill.service.IPayBillService;
|
||||||
|
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
|
||||||
|
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
|
||||||
|
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 javax.annotation.Resource;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 堃博OA单据推送宁波银行
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2024年7月10日14:13:18
|
||||||
|
*/
|
||||||
|
public class KunBPayBillPluginInitializer extends PluginBaseEntity{
|
||||||
|
Logger logger = LoggerFactory.getLogger(KunBPayBillPluginInitializer.class);
|
||||||
|
@Autowired
|
||||||
|
private IPayBillService payBillService;
|
||||||
|
@Resource
|
||||||
|
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
|
||||||
|
@Autowired
|
||||||
|
private IPayBillPluginInitializerDao payBillDao;
|
||||||
|
@Override
|
||||||
|
public void initialize() {
|
||||||
|
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() {
|
||||||
|
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPluginId() {
|
||||||
|
return "KunBPayBillPluginInitializer";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPluginName() {
|
||||||
|
return "KunBPayBillPluginInitializer插件";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPluginLabel() {
|
||||||
|
return "KunBPayBillPluginInitializer";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPluginType() {
|
||||||
|
return "1";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public JsonResultEntity executeBusiness(JSONObject requestJson) {
|
||||||
|
JSONObject requestJsonObj = JSON.parseObject(requestJson.toString(),JSONObject.class);
|
||||||
|
String interId = requestJsonObj.getString("integration_task_living_details_id");
|
||||||
|
IntegrationTaskLivingDetailsEntity oldMsg = new IntegrationTaskLivingDetailsEntity();
|
||||||
|
if(StrUtil.isNotEmpty(interId)){
|
||||||
|
oldMsg = taskLivingDetailsService.get(interId);
|
||||||
|
}
|
||||||
|
String rootAppPk = oldMsg.getRootAppPk();
|
||||||
|
|
||||||
|
try {
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
if(null != requestJson && StrUtil.isNotEmpty(requestJson.getString("code"))){
|
||||||
|
String code = requestJson.getString("code");
|
||||||
|
sb.append(" and id = '"+rootAppPk+"'");
|
||||||
|
}else{
|
||||||
|
sb.append(" and subState is null");
|
||||||
|
}
|
||||||
|
|
||||||
|
PayBillEntity oaBillEntity = new PayBillEntity();
|
||||||
|
String dataSourceCode = requestJson.getString("sourceCode");
|
||||||
|
oaBillEntity.setDataSourceCode(dataSourceCode);
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("select \n" +
|
||||||
|
"id as id,\n" +
|
||||||
|
"serialno as serialNo,\n" +
|
||||||
|
"corpcode as corpCode,\n" +
|
||||||
|
"payacc as payAcc,\n" +
|
||||||
|
"rcvacc as rcvAcc,\n" +
|
||||||
|
"rcvbankname as rcvBankName,\n" +
|
||||||
|
"rcvbankno as rcvBankNo,\n" +
|
||||||
|
"rcvname as rcvName,\n" +
|
||||||
|
"purpose as purpose,\n" +
|
||||||
|
"remark as remark,\n" +
|
||||||
|
"issubscribe as isSubscribe,\n" +
|
||||||
|
"difbank as difBank,\n" +
|
||||||
|
"areasign as areaSign,\n" +
|
||||||
|
"amt as amt,\n" +
|
||||||
|
"'subState' as fieldName,\n" +
|
||||||
|
"'formmain_bank' as tableName,\n" +
|
||||||
|
"amt as amt,\n" +
|
||||||
|
"wishpaytime as wishPayTime,\n" +
|
||||||
|
"isforindividual as isForIndividual\n" +
|
||||||
|
"from formmain_bank where 1=1 " );
|
||||||
|
stringBuffer.append(sb.toString());
|
||||||
|
List<HashMap<String, Object>> hashMaps = payBillDao.getOaBillData(stringBuffer.toString(),oaBillEntity);
|
||||||
|
if(CollectionUtils.isNotEmpty(hashMaps)){
|
||||||
|
for (HashMap<String, Object> hashMap : hashMaps) {
|
||||||
|
JSONObject main = new JSONObject();
|
||||||
|
for(String key:hashMap.keySet()) {
|
||||||
|
main.put(key, hashMap.get(key));
|
||||||
|
}
|
||||||
|
logger.info("获取到付款单的数据"+main.toString());
|
||||||
|
String apiCode = "8000310000";
|
||||||
|
String result = NingBBankUtil.sendU9cTOCrmEsb(main.toString(),apiCode);
|
||||||
|
logger.info("推送宁波银行的返回结果"+result);
|
||||||
|
IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity();
|
||||||
|
logDetails.setRootAppPk(main.getString("id"));
|
||||||
|
logDetails.setRootAppBill(main.getString("serialNo"));
|
||||||
|
logDetails.setNewTransmitInfo(result);
|
||||||
|
logDetails.setNewPushDate(new Date());
|
||||||
|
logDetails.setRootAppNewData(JSON.toJSONString(main));
|
||||||
|
logDetails.setPluginId("KunBPayBillPluginInitializer");
|
||||||
|
JSONObject resultObj = JSON.parseObject(result);
|
||||||
|
String attribute = resultObj.getString("attribute");
|
||||||
|
boolean flag = resultObj.getBoolean("flag");
|
||||||
|
String subState = "";
|
||||||
|
String fieldName = main.getString("fieldName");
|
||||||
|
String tableName = main.getString("tableName");
|
||||||
|
String str = "";
|
||||||
|
try {
|
||||||
|
if(StrUtil.isEmpty(interId)){
|
||||||
|
if(flag){
|
||||||
|
subState = "Y";
|
||||||
|
taskLivingDetailsService.saveLogToSuccess(logDetails);
|
||||||
|
}else{
|
||||||
|
subState = "N";
|
||||||
|
taskLivingDetailsService.saveLogToFail(logDetails);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
logDetails.setId(interId);
|
||||||
|
if(flag){
|
||||||
|
subState = "Y";
|
||||||
|
taskLivingDetailsService.saveLogFailToSuccess(logDetails);
|
||||||
|
}else{
|
||||||
|
subState = "N";
|
||||||
|
taskLivingDetailsService.updateLogFailToSuccess(logDetails);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str = "update "+tableName+" set " + fieldName + "= '" +subState+"'," +"subMsg = '"+attribute+"'"+"where id = '"+main.getString("id")+"'";
|
||||||
|
} catch (Exception e) {
|
||||||
|
subState = "N";
|
||||||
|
str = "update "+tableName+" set " + fieldName + "= '" +subState+"'," +"subMsg = '"+attribute+"'"+"where id = '"+main.getString("id")+"'";
|
||||||
|
logger.info("保存日志失败"+e.getMessage());
|
||||||
|
oaBillEntity.setSql(str);
|
||||||
|
payBillDao.updateStateForId(str,oaBillEntity);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
//修改推送状态,防止重复推送
|
||||||
|
oaBillEntity.setSql(str);
|
||||||
|
payBillDao.updateStateForId(str,oaBillEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.info("获取OA数据失败"+e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return new JsonResultEntity("成功",true,new JsonResultEntity());
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,7 +24,7 @@ public class NingBBankUtil {
|
||||||
String baseUrl = "http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface";
|
String baseUrl = "http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface";
|
||||||
System.out.println("推送参数"+parm);
|
System.out.println("推送参数"+parm);
|
||||||
String result = HttpRequest.post(baseUrl)
|
String result = HttpRequest.post(baseUrl)
|
||||||
.header("appId", "800009")//头信息,多个头信息多次调用此方法即可
|
.header("appId", "800031")//头信息,多个头信息多次调用此方法即可
|
||||||
.header("apiCode", apiCode)//头信息,多个头信息多次调用此方法即可
|
.header("apiCode", apiCode)//头信息,多个头信息多次调用此方法即可
|
||||||
.header("publicKey", "ZJYAFwrMhQyJ5AHRyroAsMjt7//GlcLHuD2xA6dXN5mq45pCe7eDIk+3zDUT+v578prj")//头信息,多个头信息多次调用此方法即可
|
.header("publicKey", "ZJYAFwrMhQyJ5AHRyroAsMjt7//GlcLHuD2xA6dXN5mq45pCe7eDIk+3zDUT+v578prj")//头信息,多个头信息多次调用此方法即可
|
||||||
.header("secretKey", "m6imCUH9V8RKiWIu93SVqbMHfmBaAVZTZTdh7tWIyqnznOZ19jU47zDL5uOs0qQyj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息,多个头信息多次调用此方法即可
|
.header("secretKey", "m6imCUH9V8RKiWIu93SVqbMHfmBaAVZTZTdh7tWIyqnznOZ19jU47zDL5uOs0qQyj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息,多个头信息多次调用此方法即可
|
||||||
|
|
|
@ -4,4 +4,5 @@
|
||||||
<bean name="PayBillPluginInitializer" class="com.hzya.frame.plugin.a8bill.plugin.PayBillPluginInitializer" />
|
<bean name="PayBillPluginInitializer" class="com.hzya.frame.plugin.a8bill.plugin.PayBillPluginInitializer" />
|
||||||
<bean name="RecBillPluginInitializer" class="com.hzya.frame.plugin.a8bill.plugin.RecBillPluginInitializer" />
|
<bean name="RecBillPluginInitializer" class="com.hzya.frame.plugin.a8bill.plugin.RecBillPluginInitializer" />
|
||||||
<bean name="KunBPayBillPluginInitializer" class="com.hzya.frame.plugin.a8bill.plugin.KunBPayBillPluginInitializer" />
|
<bean name="KunBPayBillPluginInitializer" class="com.hzya.frame.plugin.a8bill.plugin.KunBPayBillPluginInitializer" />
|
||||||
|
<bean name="KunBNingBBankPluginInitializer" class="com.hzya.frame.plugin.a8bill.plugin.KunBNingBBankPluginInitializer" />
|
||||||
</beans>
|
</beans>
|
||||||
|
|
|
@ -80,13 +80,14 @@ public class ExecSqlServiceImpl implements IExecSqlService {
|
||||||
@Override
|
@Override
|
||||||
public int execUpdateSql(String sql, String data_source_code) throws Exception {
|
public int execUpdateSql(String sql, String data_source_code) throws Exception {
|
||||||
logger.info("=============进入execUpdateSql方法============");
|
logger.info("=============进入execUpdateSql方法============");
|
||||||
if (ObjectUtils.isEmpty(sql)) {
|
if (!ObjectUtils.isEmpty(sql)) {
|
||||||
if (sql.contains("where") || sql.contains("WHERE")) {
|
if (sql.contains("where") || sql.contains("WHERE")) {
|
||||||
// SqlSession sqlSession = getSqlSession(data_source_code);
|
// SqlSession sqlSession = getSqlSession(data_source_code);
|
||||||
// SqlSession sqlSession = new DataSourceUtil().getDefaultSqlSession();
|
// SqlSession sqlSession = new DataSourceUtil().getDefaultSqlSession();
|
||||||
logger.info("=============execUpdateSql方法要执行的sql:============" + sql);
|
logger.info("=============execUpdateSql方法要执行的sql:============" + sql);
|
||||||
ExecSqlEntity entity = new ExecSqlEntity();
|
ExecSqlEntity entity = new ExecSqlEntity();
|
||||||
entity.setSql(sql);
|
entity.setSql(sql);
|
||||||
|
entity.setDatasource_code(data_source_code);
|
||||||
int result = sqlSession.update("com.hzya.frame.sysnew.execsql.entity.ExecSqlEntity.ExecSqlEntity_execsql_update", entity);
|
int result = sqlSession.update("com.hzya.frame.sysnew.execsql.entity.ExecSqlEntity.ExecSqlEntity_execsql_update", entity);
|
||||||
logger.info("update受影响行数:" + result);
|
logger.info("update受影响行数:" + result);
|
||||||
//sqlSession.close();
|
//sqlSession.close();
|
||||||
|
|
Loading…
Reference in New Issue