Merge branch 'dongj' of http://ufidahz.com.cn:9015/root/kangarooDataCenterV3 into dongj
This commit is contained in:
commit
3fa71d45f6
|
@ -0,0 +1,36 @@
|
|||
package com.hzya.frame.plugin.a8bill.dao;
|
||||
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity;
|
||||
import com.hzya.frame.plugin.a8bill.entity.PayBillEntity;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 组织档案(mdm_org: table)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-07 18:30:04
|
||||
*/
|
||||
public interface IPayBillPluginInitializerDao extends IBaseDao<PayBillEntity, String> {
|
||||
/**
|
||||
*
|
||||
* @content 通用获取OA数据接口
|
||||
* @author laborer
|
||||
* @date 2024/7/10 0010 16:06
|
||||
*
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.hzya.frame.plugin.a8bill.dao.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
import com.hzya.frame.execsql.service.IExecSqlService;
|
||||
import com.hzya.frame.plugin.a8bill.dao.IPayBillPluginInitializerDao;
|
||||
import com.hzya.frame.plugin.a8bill.entity.PayBillEntity;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 组织档案(MdmOrg)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-07 18:30:04
|
||||
*/
|
||||
public class PayBillPluginInitializerDaoImpl extends MybatisGenericDao<PayBillEntity, String> implements IPayBillPluginInitializerDao {
|
||||
@Autowired
|
||||
private IExecSqlService execSqlService;
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public List<HashMap<String, Object>> getOaBillData(String str, PayBillEntity entity)throws Exception {
|
||||
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
|
||||
*/
|
||||
public class PayBillEntity extends BaseEntity {
|
||||
private String sql;
|
||||
|
||||
public String getSql() {
|
||||
return sql;
|
||||
}
|
||||
|
||||
public void setSql(String sql) {
|
||||
this.sql = sql;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,21 @@
|
|||
<?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.a8bill.dao.impl.PayBillDaoImpl">
|
||||
<mapper namespace="com.hzya.frame.plugin.a8bill.dao.impl.PayBillPluginInitializerDaoImpl">
|
||||
|
||||
<resultMap id="get-PayBillEntity-result" type="com.hzya.frame.plugin.a8bill.entity.PayBillEntity" >
|
||||
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||
|
||||
</resultMap>
|
||||
</resultMap>
|
||||
<!-- 查询的字段-->
|
||||
<sql id = "PayBillEntity_Base_Column_List">
|
||||
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>
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ import com.hzya.frame.base.PluginBaseEntity;
|
|||
import com.hzya.frame.ningboBankTreasury.dto.req.AccTransactionReq;
|
||||
import com.hzya.frame.ningboBankTreasury.dto.res.AccTransactionRes;
|
||||
import com.hzya.frame.ningboBankTreasury.util.NingboBankUtil;
|
||||
import com.hzya.frame.plugin.a8bill.dao.IPayBillPluginInitializerDao;
|
||||
import com.hzya.frame.plugin.a8bill.entity.PayBillEntity;
|
||||
import com.hzya.frame.plugin.a8bill.service.INingboBankPluginService;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
|
@ -16,7 +18,10 @@ 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.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -29,6 +34,10 @@ public class AccLogPluginInitializer extends PluginBaseEntity {
|
|||
Logger logger = LoggerFactory.getLogger(getClass());
|
||||
@Autowired
|
||||
private INingboBankPluginService ningboBankPluginService;
|
||||
@Value("${OA.data_source_code}")
|
||||
private String oa_data_source_code;
|
||||
@Autowired
|
||||
private IPayBillPluginInitializerDao payBillDao;
|
||||
/***
|
||||
* 插件初始化方法
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
|
@ -106,11 +115,21 @@ public class AccLogPluginInitializer extends PluginBaseEntity {
|
|||
**/
|
||||
@Override
|
||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||
PayBillEntity oaBillEntity = new PayBillEntity();
|
||||
oaBillEntity.setDataSourceCode(oa_data_source_code);
|
||||
List<HashMap<String, Object>> hashMaps = payBillDao.getOaBillData("SELECT field0002 from formmain_0053",oaBillEntity);
|
||||
List<String> accList = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(hashMaps)){
|
||||
for (HashMap<String, Object> hashMap : hashMaps) {
|
||||
String field0002 = String.valueOf(hashMap.get("field0002"));
|
||||
accList.add(field0002);
|
||||
}
|
||||
}
|
||||
//1、查询宁波银行的交易记录
|
||||
AccTransactionReq accTransactionReq = new AccTransactionReq();
|
||||
accTransactionReq.setCdSign(NingboBankUtil.SHOURU);
|
||||
accTransactionReq.setBeginDate("2024-05-01");
|
||||
accTransactionReq.setEndDate("2024-05-30");
|
||||
accTransactionReq.setBeginDate("2024-07-01");
|
||||
accTransactionReq.setEndDate("2024-07-30");
|
||||
accTransactionReq.setBankAccList(Convert.toList(String.class,"86041110000110293,86041110000109337,6223160030547665,6214180002001411023,6214180000002609736"));
|
||||
Map<String, String> headerMap = MapBuilder.<String, String>create(true)
|
||||
.put("apiCode", "8000360002")
|
||||
|
|
|
@ -0,0 +1,218 @@
|
|||
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.service.INingboBankPluginService;
|
||||
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 org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description
|
||||
* @Author xiangerlin
|
||||
* @Date 2024/7/29 11:08
|
||||
**/
|
||||
public class NingboBankPayPluginInitializer extends PluginBaseEntity {
|
||||
Logger logger = LoggerFactory.getLogger(getClass());
|
||||
@Autowired
|
||||
private INingboBankPluginService ningboBankPluginService;
|
||||
@Resource
|
||||
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
|
||||
@Autowired
|
||||
private IPayBillPluginInitializerDao payBillDao;
|
||||
|
||||
@Value("${OA.data_source_code}")
|
||||
private String oa_data_source_code;
|
||||
/***
|
||||
* 插件初始化方法
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @Date 2023-08-02 10:48
|
||||
* @Param []
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public void initialize() {
|
||||
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件销毁方法
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public void destroy() {
|
||||
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件的ID
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public String getPluginId() {
|
||||
return "NingboBankPayPlugin";
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件的名称
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "宁波银行转账插件";
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件的显示值
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public String getPluginLabel() {
|
||||
return "宁波银行转账插件";
|
||||
}
|
||||
|
||||
/***
|
||||
* 插件类型 1、场景插件
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @Date 2023-08-02 14:01
|
||||
* @Param []
|
||||
* @return java.lang.String
|
||||
**/
|
||||
@Override
|
||||
public String getPluginType() {
|
||||
return "1";
|
||||
}
|
||||
|
||||
/***
|
||||
* 执行业务代码
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @Date 2023-08-07 11:20
|
||||
* @param requestJson 执行业务代码的参数
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||
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(StrUtil.isNotEmpty(rootAppPk)){
|
||||
String code = requestJson.getString("code");
|
||||
sb.append(" and id = '"+rootAppPk+"'");
|
||||
}else{
|
||||
sb.append(" and payState is null");
|
||||
}
|
||||
|
||||
PayBillEntity oaBillEntity = new PayBillEntity();
|
||||
oaBillEntity.setDataSourceCode(oa_data_source_code);
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
|
||||
//备用金申请单
|
||||
stringBuffer.append("select * from v_hzya_pay 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 result = ningboBankPluginService.executeEsb(main.toString(),"8000360000");
|
||||
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("NingboBankPayPlugin");
|
||||
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 payMsg = main.getString("payMsg");
|
||||
// String subMsg = main.getString("subMsg");
|
||||
String str = "";
|
||||
String sync_flag = "";
|
||||
try {
|
||||
if(StrUtil.isEmpty(interId)){// 银行状态 1支付中 2 支付失败 null 未提交支付 0支付成功
|
||||
logDetails.setCreate_time(new Date());
|
||||
logDetails.setModify_time(new Date());
|
||||
if(flag){
|
||||
subState = "1";
|
||||
sync_flag = " ,"+payMsg+" = '支付中'";
|
||||
taskLivingDetailsService.saveLogToSuccess(logDetails);
|
||||
}else{
|
||||
subState = "2";
|
||||
String resMsg = JSONObject.parseObject(attribute).getString("retMsg");
|
||||
sync_flag = " ,"+payMsg+" = '"+resMsg+"'";
|
||||
taskLivingDetailsService.saveLogToFail(logDetails);
|
||||
}
|
||||
}else{
|
||||
logDetails.setId(interId);
|
||||
logDetails.setModify_time(new Date());
|
||||
if(flag){
|
||||
subState = "1";
|
||||
sync_flag = " ,"+payMsg+" = '支付中'";
|
||||
taskLivingDetailsService.saveLogFailToSuccess(logDetails);
|
||||
}else{
|
||||
subState = "2";
|
||||
String resMsg = JSONObject.parseObject(attribute).getString("retMsg");
|
||||
sync_flag = " ,"+payMsg+" = '"+resMsg+"'";
|
||||
taskLivingDetailsService.updateLogFailToSuccess(logDetails);
|
||||
}
|
||||
}
|
||||
|
||||
str = "update "+tableName+" set " + fieldName + "= '" +subState+"'" +sync_flag+"where id = '"+main.getString("id")+"'";
|
||||
} catch (Exception e) {
|
||||
subState = "N";
|
||||
str = "update "+tableName+" set " + fieldName + "= '" +subState+"'" +payMsg+" = '"+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());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,186 @@
|
|||
package com.hzya.frame.plugin.a8bill.plugin;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
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.ningboBankTreasury.enums.PayStatusEnum;
|
||||
import com.hzya.frame.plugin.a8bill.dao.IPayBillPluginInitializerDao;
|
||||
import com.hzya.frame.plugin.a8bill.entity.PayBillEntity;
|
||||
import com.hzya.frame.plugin.a8bill.service.INingboBankPluginService;
|
||||
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.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description 宁波银行 单笔付款交易结果查询
|
||||
* @Author xiangerlin
|
||||
* @Date 2024/7/29 16:59
|
||||
**/
|
||||
public class NingboBankPayResultPluginInitializer extends PluginBaseEntity {
|
||||
Logger logger = LoggerFactory.getLogger(getClass());
|
||||
@Value("${OA.data_source_code}")
|
||||
private String oa_data_source_code;
|
||||
@Autowired
|
||||
private IPayBillPluginInitializerDao payBillDao;
|
||||
@Autowired
|
||||
private INingboBankPluginService ningboBankPluginService;
|
||||
/***
|
||||
* 插件初始化方法
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @Date 2023-08-02 10:48
|
||||
* @Param []
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public void initialize() {
|
||||
|
||||
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件销毁方法
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public void destroy() {
|
||||
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件的ID
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public String getPluginId() {
|
||||
return "NingboBankPayResultPlugin";
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件的名称
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "宁波银行转账结果查询插件";
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件的显示值
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public String getPluginLabel() {
|
||||
return "宁波银行转账结果查询插件";
|
||||
}
|
||||
|
||||
/***
|
||||
* 插件类型 1、场景插件
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @Date 2023-08-02 14:01
|
||||
* @Param []
|
||||
* @return java.lang.String
|
||||
**/
|
||||
@Override
|
||||
public String getPluginType() {
|
||||
return "1";
|
||||
}
|
||||
|
||||
/***
|
||||
* 执行业务代码
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @Date 2023-08-07 11:20
|
||||
* @param requestJson 执行业务代码的参数
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||
PayBillEntity oaBillEntity = new PayBillEntity();
|
||||
oaBillEntity.setDataSourceCode(oa_data_source_code);
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("select * from v_hzya_pay where payState ='1'");
|
||||
try {
|
||||
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));
|
||||
}
|
||||
String tableName = main.getString("tableName");
|
||||
String fieldName = main.getString("fieldName");
|
||||
String payDate = main.getString("payDate");
|
||||
String payMsg = main.getString("payMsg");
|
||||
try {
|
||||
|
||||
logger.info("获取到付款单状态的数据"+main.toString());
|
||||
JSONObject reMain = new JSONObject();
|
||||
reMain.put("serialNo",main.getString("serialNo"));
|
||||
String result = ningboBankPluginService.executeEsb(reMain.toString(),"8000360001");
|
||||
logger.info("获取付款状态结果"+result);
|
||||
|
||||
JSONObject resultObj = JSON.parseObject(result);
|
||||
JSONObject attribute = resultObj.getJSONObject("attribute");
|
||||
boolean flag = resultObj.getBoolean("flag");
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("update "+tableName);
|
||||
if(flag){
|
||||
JSONObject data = attribute.getJSONObject("Data");
|
||||
JSONObject transferDtl = data.getJSONObject("transferDtl");
|
||||
String status = transferDtl.getString("status");
|
||||
String msg = PayStatusEnum.getByCode(status);
|
||||
if(StrUtil.isEmpty(msg)){
|
||||
msg ="未知交易状态,请联系管理员查证";
|
||||
sb.append(" set "+payMsg+" = '"+msg+"'");
|
||||
sb.append(" , "+fieldName+" = '2'");
|
||||
}
|
||||
sb.append(" set "+payMsg+" = '"+msg+"'");
|
||||
//收否最终态
|
||||
if(PayStatusEnum.isFinally(status)){
|
||||
sb.append(" , "+fieldName+" = '0'");
|
||||
String payDateStr = DateUtil.now();
|
||||
sb.append(" , "+payDate+" = '"+payDateStr+"'");
|
||||
}
|
||||
}else {
|
||||
sb.append(" set "+payMsg+" = '查询失败,请联系管理员'");
|
||||
sb.append(" ,"+fieldName+" = '2'");
|
||||
|
||||
}
|
||||
sb.append(" where id = '"+main.getString("id")+"'");
|
||||
//修改推送状态,防止重复推送
|
||||
oaBillEntity.setSql(sb.toString());
|
||||
payBillDao.updateStateForId(sb.toString(),oaBillEntity);
|
||||
} catch (Exception e) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("update "+tableName );
|
||||
sb.append(" set "+payMsg+" = '获取交易状态失败'");
|
||||
sb.append(" , "+fieldName+" = '2'");
|
||||
sb.append(" where id = '"+main.getString("id")+"'");
|
||||
logger.info("获取交易状态失败,更新交易信息为失败状态,后续不在查询");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new JsonResultEntity("成功",true,new JsonResultEntity());
|
||||
}
|
||||
}
|
|
@ -11,6 +11,15 @@ import java.util.List;
|
|||
**/
|
||||
public interface INingboBankPluginService {
|
||||
|
||||
/**
|
||||
* 调用宁波银行esb接口
|
||||
* @param params
|
||||
* @param apiCode
|
||||
* @return
|
||||
*/
|
||||
String executeEsb(String params,String apiCode);
|
||||
|
||||
|
||||
/**
|
||||
* 保存收款日志到oa底表
|
||||
* @param accTransactionResList
|
||||
|
|
|
@ -12,6 +12,8 @@ import com.hzya.frame.seeyon.dongj.entity.Formmain0044Entity;
|
|||
import com.hzya.frame.seeyon.dongj.service.IFormmain0044Service;
|
||||
import com.hzya.frame.stringutil.StringUtil;
|
||||
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;
|
||||
|
||||
|
@ -29,9 +31,30 @@ public class NingboBankPluginServiceImpl implements INingboBankPluginService {
|
|||
|
||||
@Autowired
|
||||
private IFormmain0044Service formmain0044Service;
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(getClass());
|
||||
@Value("${OA.data_source_code}")
|
||||
private String oa_data_source_code;
|
||||
|
||||
/**
|
||||
* 调用宁波银行esb接口
|
||||
*
|
||||
* @param params
|
||||
* @param apiCode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String executeEsb(String params, String apiCode) {
|
||||
logger.info("请求apiCode:{},参数:{}",apiCode,params);
|
||||
Map<String, String> header = MapBuilder.<String, String>create(true)
|
||||
.put("apiCode", apiCode)
|
||||
.put("publicKey","ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj")
|
||||
.put("secretKey","fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")
|
||||
.put("appId","800036")
|
||||
.build();
|
||||
String res = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface").addHeaders(header).body(params).timeout(60000).execute().body();
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存收款日志到oa底表
|
||||
* @param accTransactionResList
|
||||
|
@ -68,7 +91,9 @@ private IFormmain0044Service formmain0044Service;
|
|||
String serialNo = StringUtil.nullConvert(accTransactionRes.getSerialNo());
|
||||
String currency = StringUtil.nullConvert(CurrencyEnum.getNameByCode(accTransactionRes.getCurCode()));
|
||||
String uses = StringUtil.nullConvert(accTransactionRes.getUses());
|
||||
String curCode = StringUtil.nullConvert(accTransactionRes.getCurCode());
|
||||
//String curCode = StringUtil.nullConvert(accTransactionRes.getCurCode());
|
||||
//这里转换成货币符号
|
||||
String curCode = StringUtil.nullConvert(CurrencyEnum.getSymbolByCode(accTransactionRes.getCurCode()));
|
||||
String postScript = StringUtil.nullConvert(accTransactionRes.getPostScript());
|
||||
String data = StrUtil.format(getAccLogXmlTemplate(),bankAcc,bankName,accName,oppAccNo,oppAccName,oppAccBank,transTime,serialId,amt,abs,bankType,serialNo,currency,uses,postScript,curCode);
|
||||
JSONObject paramsTemplate = new JSONObject();
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plugin>
|
||||
<id>NingboBankPlugin</id>
|
||||
<name>宁波银行财资大管家插件</name>
|
||||
<category>202407250001</category>
|
||||
</plugin>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans default-autowire="byName">
|
||||
<bean name="payBillPluginInitializerDaoImpl" class="com.hzya.frame.plugin.a8bill.dao.impl.PayBillPluginInitializerDaoImpl" />
|
||||
</beans>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans default-autowire="byName">
|
||||
<bean name="accLogPluginInitializer" class="com.hzya.frame.plugin.a8bill.plugin.AccLogPluginInitializer" />
|
||||
<bean name="ningboBankPayPluginInitializer" class="com.hzya.frame.plugin.a8bill.plugin.NingboBankPayPluginInitializer" />
|
||||
<bean name="ningboBankPayResultPluginInitializer" class="com.hzya.frame.plugin.a8bill.plugin.NingboBankPayResultPluginInitializer" />
|
||||
</beans>
|
|
@ -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="ningboBankPluginServiceImpl" class="com.hzya.frame.plugin.a8bill.service.impl.NingboBankPluginServiceImpl" />
|
||||
</beans>
|
|
@ -65,10 +65,11 @@ public class temButtom {
|
|||
@Test
|
||||
public void accDetailTest(){
|
||||
AccTransactionReq accTransactionReq = new AccTransactionReq();
|
||||
accTransactionReq.setBeginDate("2024-06-01");
|
||||
accTransactionReq.setEndDate("2024-06-30");
|
||||
accTransactionReq.setBeginDate("2024-07-01");
|
||||
accTransactionReq.setEndDate("2024-07-30");
|
||||
accTransactionReq.setPageSize("10");
|
||||
accTransactionReq.setCustId("0000112058");
|
||||
//accTransactionReq.setBankAccList(Convert.toList(String.class,"86041110000110293,86041110000109337,6223160030547665,6214180002001411023,6214180000002609736"));
|
||||
accTransactionReq.setBankAccList(Convert.toList(String.class,"86041110000110293,86041110000109337,6223160030547665,6214180002001411023,6214180000002609736"));
|
||||
List<AccTransactionRes> list = ningboxService.queryAccDetails(accTransactionReq);
|
||||
System.out.println("查询到的条数"+list.size());
|
||||
|
|
|
@ -0,0 +1,209 @@
|
|||
package com.hzya.frame.ningboBankTreasury.dto.req;
|
||||
|
||||
/**
|
||||
* @Description 单笔转账请求参数
|
||||
* @Author xiangerlin
|
||||
* @Date 2024/7/26 16:27
|
||||
**/
|
||||
public class SingleTransferReq {
|
||||
//客户号 必填
|
||||
private String custId;
|
||||
//付款账号 必填
|
||||
private String payAcc;
|
||||
//用途 必填,长度不能超过70
|
||||
private String purpose;
|
||||
//收款账号 必填
|
||||
private String rcvAcc;
|
||||
//收款方行名 和联行号二者必须填一个
|
||||
private String rcvBankName;
|
||||
//收款方联行号 对公支付必填
|
||||
private String rcvBankNo;
|
||||
//金额 必填
|
||||
private String amt;
|
||||
//同城异地标识 0同城 1异地
|
||||
private String areaSign;
|
||||
//单位代码 必填
|
||||
private String corpCode;
|
||||
//是否同行转账 0他行 1同行
|
||||
private String difBank;
|
||||
//交易流水号
|
||||
private String serialNo;
|
||||
//对公对私标识 0对公 1对丝
|
||||
private String isForIndividual;
|
||||
//是否预约支付 0非预约 1预约
|
||||
private String isSubscribe;
|
||||
//是否短信通知收款人 0不通知 1通知,只支持宁波银行付款的情况
|
||||
private String isTellRcv;
|
||||
//收款方手机号
|
||||
private String rcvMobile;
|
||||
//收款户名
|
||||
private String rcvName;
|
||||
//备注
|
||||
private String remark;
|
||||
//预约转账时间
|
||||
private String wishPayTime;
|
||||
//支付方式 0直接付款 1代理支付 2联动支付 3自动请款 ,为空时默认直接付款
|
||||
private String payType;
|
||||
//代理/联动账号/拨款账号
|
||||
private String remarkAcc;
|
||||
|
||||
public String getCustId() {
|
||||
return custId;
|
||||
}
|
||||
|
||||
public void setCustId(String custId) {
|
||||
this.custId = custId;
|
||||
}
|
||||
|
||||
public String getPayAcc() {
|
||||
return payAcc;
|
||||
}
|
||||
|
||||
public void setPayAcc(String payAcc) {
|
||||
this.payAcc = payAcc;
|
||||
}
|
||||
|
||||
public String getPurpose() {
|
||||
return purpose;
|
||||
}
|
||||
|
||||
public void setPurpose(String purpose) {
|
||||
this.purpose = purpose;
|
||||
}
|
||||
|
||||
public String getRcvAcc() {
|
||||
return rcvAcc;
|
||||
}
|
||||
|
||||
public void setRcvAcc(String rcvAcc) {
|
||||
this.rcvAcc = rcvAcc;
|
||||
}
|
||||
|
||||
public String getRcvBankName() {
|
||||
return rcvBankName;
|
||||
}
|
||||
|
||||
public void setRcvBankName(String rcvBankName) {
|
||||
this.rcvBankName = rcvBankName;
|
||||
}
|
||||
|
||||
public String getRcvBankNo() {
|
||||
return rcvBankNo;
|
||||
}
|
||||
|
||||
public void setRcvBankNo(String rcvBankNo) {
|
||||
this.rcvBankNo = rcvBankNo;
|
||||
}
|
||||
|
||||
public String getAmt() {
|
||||
return amt;
|
||||
}
|
||||
|
||||
public void setAmt(String amt) {
|
||||
this.amt = amt;
|
||||
}
|
||||
|
||||
public String getAreaSign() {
|
||||
return areaSign;
|
||||
}
|
||||
|
||||
public void setAreaSign(String areaSign) {
|
||||
this.areaSign = areaSign;
|
||||
}
|
||||
|
||||
public String getCorpCode() {
|
||||
return corpCode;
|
||||
}
|
||||
|
||||
public void setCorpCode(String corpCode) {
|
||||
this.corpCode = corpCode;
|
||||
}
|
||||
|
||||
public String getDifBank() {
|
||||
return difBank;
|
||||
}
|
||||
|
||||
public void setDifBank(String difBank) {
|
||||
this.difBank = difBank;
|
||||
}
|
||||
|
||||
public String getSerialNo() {
|
||||
return serialNo;
|
||||
}
|
||||
|
||||
public void setSerialNo(String serialNo) {
|
||||
this.serialNo = serialNo;
|
||||
}
|
||||
|
||||
public String getIsForIndividual() {
|
||||
return isForIndividual;
|
||||
}
|
||||
|
||||
public void setIsForIndividual(String isForIndividual) {
|
||||
this.isForIndividual = isForIndividual;
|
||||
}
|
||||
|
||||
public String getIsSubscribe() {
|
||||
return isSubscribe;
|
||||
}
|
||||
|
||||
public void setIsSubscribe(String isSubscribe) {
|
||||
this.isSubscribe = isSubscribe;
|
||||
}
|
||||
|
||||
public String getIsTellRcv() {
|
||||
return isTellRcv;
|
||||
}
|
||||
|
||||
public void setIsTellRcv(String isTellRcv) {
|
||||
this.isTellRcv = isTellRcv;
|
||||
}
|
||||
|
||||
public String getRcvMobile() {
|
||||
return rcvMobile;
|
||||
}
|
||||
|
||||
public void setRcvMobile(String rcvMobile) {
|
||||
this.rcvMobile = rcvMobile;
|
||||
}
|
||||
|
||||
public String getRcvName() {
|
||||
return rcvName;
|
||||
}
|
||||
|
||||
public void setRcvName(String rcvName) {
|
||||
this.rcvName = rcvName;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public String getWishPayTime() {
|
||||
return wishPayTime;
|
||||
}
|
||||
|
||||
public void setWishPayTime(String wishPayTime) {
|
||||
this.wishPayTime = wishPayTime;
|
||||
}
|
||||
|
||||
public String getPayType() {
|
||||
return payType;
|
||||
}
|
||||
|
||||
public void setPayType(String payType) {
|
||||
this.payType = payType;
|
||||
}
|
||||
|
||||
public String getRemarkAcc() {
|
||||
return remarkAcc;
|
||||
}
|
||||
|
||||
public void setRemarkAcc(String remarkAcc) {
|
||||
this.remarkAcc = remarkAcc;
|
||||
}
|
||||
}
|
|
@ -7,25 +7,28 @@ package com.hzya.frame.ningboBankTreasury.enums;
|
|||
**/
|
||||
public enum CurrencyEnum {
|
||||
|
||||
人民币("01","人民币"),
|
||||
美元("02","美元"),
|
||||
澳元("03","澳元"),
|
||||
欧元("04","欧元"),
|
||||
日元("05","日元"),
|
||||
英镑("06","英镑"),
|
||||
港币("07","港币"),
|
||||
新加坡元("08","新加坡元"),
|
||||
加拿大元("09","加拿大元"),
|
||||
瑞士("10","瑞士"),
|
||||
泰铢("23","泰铢"),
|
||||
新台币("92","新台币"),
|
||||
ALL("ALL","多币");
|
||||
private final String name;
|
||||
private final String code;
|
||||
人民币("01","人民币","CNY"),
|
||||
美元("02","美元","USD"),
|
||||
澳元("03","澳元","AUD"),
|
||||
欧元("04","欧元","EUR"),
|
||||
日元("05","日元","JPY"),
|
||||
英镑("06","英镑","GBP"),
|
||||
港币("07","港币","HKD"),
|
||||
新加坡元("08","新加坡元","SGD"),
|
||||
加拿大元("09","加拿大元","CAD"),
|
||||
瑞士("10","瑞士","CHF"),
|
||||
泰铢("23","泰铢","THB"),
|
||||
新台币("92","新台币","TWD"),
|
||||
ALL("ALL","多币","ALL");
|
||||
|
||||
CurrencyEnum(String name, String code) {
|
||||
this.name = name;
|
||||
private final String code;
|
||||
private final String name;
|
||||
//英文代码 CNY USD之类的
|
||||
private final String symbol;
|
||||
CurrencyEnum(String code,String name,String symbol) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
this.symbol = symbol;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
@ -35,6 +38,10 @@ public enum CurrencyEnum {
|
|||
return code;
|
||||
}
|
||||
|
||||
public String getSymbol() {
|
||||
return symbol;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取币种名字
|
||||
* @param code
|
||||
|
@ -48,4 +55,18 @@ public enum CurrencyEnum {
|
|||
}
|
||||
return null; // 或者抛出异常,表示找不到对应的币种
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取币种符号
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public static String getSymbolByCode(String code){
|
||||
for (CurrencyEnum currency : values()) {
|
||||
if (currency.code.equals(code)) {
|
||||
return currency.symbol;
|
||||
}
|
||||
}
|
||||
return null; // 或者抛出异常,表示找不到对应的币种
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
package com.hzya.frame.ningboBankTreasury.enums;
|
||||
|
||||
/**
|
||||
* @Description 转账状态
|
||||
* @Author xiangerlin
|
||||
* @Date 2024/7/29 17:11
|
||||
**/
|
||||
public enum PayStatusEnum {
|
||||
SUCCESS("0","交易成功"),
|
||||
// 失败状态
|
||||
FAILED_DELETED("-2", "已删除"),
|
||||
APPROVAL_REJECTED_CLOSED("-3", "审批打回交易关闭"),
|
||||
TRANSACTION_FAILED("2", "交易失败"),
|
||||
FUND_ALLOCATION_FAILED("4", "交易失败,资金下拨失败"),
|
||||
LINKAGE_PAYMENT_FAILED_REFUNDED("5", "联动支付失败,资金退回成功"),
|
||||
LINKAGE_PAYMENT_FAILED_REFUND_PENDING("6", "联动支付失败,资金退回查证中"),
|
||||
LINKAGE_PAYMENT_FAILED_REFUND_FAILED("96", "联动支付失败,资金退回失败"),
|
||||
PAYMENT_REQUEST_FAILED("112", "请款失败"),
|
||||
|
||||
// 其他状态
|
||||
REJECTED("-1", "驳回"),
|
||||
PENDING_VERIFICATION("1", "交易待查证"),
|
||||
PENDING_SEND("3", "待发送"),
|
||||
PENDING_APPROVAL("11", "待审批"),
|
||||
APPROVAL_THROUGH("95", "审批通过"),
|
||||
TEMPORARY_STORAGE("7", "暂存"),
|
||||
WITHDRAWN_BY_OPERATOR("-4", "经办撤回"),
|
||||
PAYMENT_REQUEST_PENDING("111", "请款查证中"),
|
||||
PAYMENT_REQUEST_SUCCEEDED_PENDING_SEND("113", "请款成功,交易待发送"),
|
||||
LINKAGE_PAYMENT_SUCCEEDED_PENDING_SEND("114", "联动支付成功,智能支付交易待发送");
|
||||
|
||||
// 枚举属性
|
||||
private final String code;
|
||||
private final String description;
|
||||
// 枚举构造函数
|
||||
PayStatusEnum(String code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
// 获取状态码
|
||||
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
// 获取状态描述
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
// 根据状态码查找枚举
|
||||
public static PayStatusEnum fromCode(String code) {
|
||||
for (PayStatusEnum status : PayStatusEnum.values()) {
|
||||
if (status.getCode().equals(code)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unknown code: " + code);
|
||||
}
|
||||
|
||||
public static String getByCode(String code){
|
||||
for (PayStatusEnum status : PayStatusEnum.values()) {
|
||||
if (status.getCode().equals(code)) {
|
||||
return status.getDescription();
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unknown code: " + code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为最终态
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public static boolean isFinally(String code){
|
||||
return SUCCESS.code.equals(code)
|
||||
|| FAILED_DELETED.code.equals(code)
|
||||
|| APPROVAL_REJECTED_CLOSED.code.equals(code)
|
||||
|| TRANSACTION_FAILED.code.equals(code)
|
||||
|| FUND_ALLOCATION_FAILED.code.equals(code)
|
||||
|| LINKAGE_PAYMENT_FAILED_REFUNDED.code.equals(code)
|
||||
|| LINKAGE_PAYMENT_FAILED_REFUND_PENDING.code.equals(code)
|
||||
|| LINKAGE_PAYMENT_FAILED_REFUND_FAILED.code.equals(code)
|
||||
|| PAYMENT_REQUEST_FAILED.code.equals(code);
|
||||
}
|
||||
}
|
|
@ -32,7 +32,7 @@ public class NingboBankTreasuryServiceImpl implements INingboBankTreasuryService
|
|||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 单笔查证接口
|
||||
* @Description 单笔转账查证接口
|
||||
* @Date 4:45 下午 2024/7/9
|
||||
**/
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue