oa集成cbs

This commit is contained in:
xiang2lin 2024-06-17 13:41:57 +08:00
parent c89370ac0c
commit 6c48ee967b
8 changed files with 538 additions and 0 deletions

View File

@ -0,0 +1,12 @@
package com.hzya.frame.seeyon.cbs8.dao;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.seeyon.cbs8.entity.CbsLogEntity;
/**
* @Description cbs8支付日志
* @Author xiangerlin
* @Date 2024/6/14 17:30
**/
public interface ICbsLogDao extends IBaseDao<CbsLogEntity,String> {
}

View File

@ -0,0 +1,15 @@
package com.hzya.frame.seeyon.cbs8.dao.impl;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.seeyon.cbs8.dao.ICbsLogDao;
import com.hzya.frame.seeyon.cbs8.entity.CbsLogEntity;
import org.springframework.stereotype.Repository;
/**
* @Description
* @Author xiangerlin
* @Date 2024/6/14 17:31
**/
@Repository()
public class CbsLogDaoImpl extends MybatisGenericDao<CbsLogEntity,String> implements ICbsLogDao {
}

View File

@ -0,0 +1,151 @@
package com.hzya.frame.seeyon.cbs8.entity;
import com.hzya.frame.web.entity.BaseEntity;
/**
* @Description cbs支付日志
* @Author xiangerlin
* @Date 2024/6/14 17:16
**/
public class CbsLogEntity extends BaseEntity {
//流程标题
private String title;
//请款主体
private String pay_company;
//收款人
private String payee;
//金额
private String amount;
//cbs申请单号
private String cbs_apply_code;
//日志表id
private String id;
//oa单据id
private String oa_id;
//oa单据号
private String bill_code;
//英文表名
private String tab_name_en;
//中文表名
private String tab_name_ch;
//支付状态
private String pay_state;
//支付信息
private String message;
//支付申请状态
private String apply_state;
//成功标记
private String successed;
public String getOa_id() {
return oa_id;
}
public void setOa_id(String oa_id) {
this.oa_id = oa_id;
}
public String getBill_code() {
return bill_code;
}
public void setBill_code(String bill_code) {
this.bill_code = bill_code;
}
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 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 getPay_state() {
return pay_state;
}
public void setPay_state(String pay_state) {
this.pay_state = pay_state;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getApply_state() {
return apply_state;
}
public void setApply_state(String apply_state) {
this.apply_state = apply_state;
}
public String getSuccessed() {
return successed;
}
public void setSuccessed(String successed) {
this.successed = successed;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getPay_company() {
return pay_company;
}
public void setPay_company(String pay_company) {
this.pay_company = pay_company;
}
public String getPayee() {
return payee;
}
public void setPayee(String payee) {
this.payee = payee;
}
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public String getCbs_apply_code() {
return cbs_apply_code;
}
public void setCbs_apply_code(String cbs_apply_code) {
this.cbs_apply_code = cbs_apply_code;
}
}

View File

@ -0,0 +1,115 @@
<?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.seeyon.cbs8.entity.CbsLogEntity">
<resultMap id="get-CbsLogEntity-result" type="com.hzya.frame.seeyon.cbs8.entity.CbsLogEntity">
<result property="id" column="id" />
<result property="oa_id" column="oa_id" />
<result property="bill_code" column="bill_code" />
<result property="tab_name_en" column="tab_name_en" />
<result property="tab_name_ch" column="tab_name_ch" />
<result property="pay_state" column="pay_state" />
<result property="message" column="message" />
<result property="apply_state" column="apply_state" />
<result property="successed" column="successed" />
<result property="title" column="title" />
<result property="pay_company" column="pay_company" />
<result property="payee" column="payee" />
<result property="amount" column="amount" />
<result property="cbs_apply_code" column="cbs_apply_code" />
</resultMap>
<sql id="CbsLogEntity_Base_Column_List">
id,
field0001 as oa_id,
field0002 as bill_code,
field0003 as tab_name_en,
field0004 as tab_name_ch,
field0005 as pay_state,
field0006 as message,
field0007 as apply_state,
field0008 as successed,
field0009 as title,
field0010 as pay_company,
field0011 as payee,
field0012 as amount,
field0013 as cbs_apply_code
</sql>
<!-- 查询推送失败,用户手动发起请求 采用==查询 -->
<select id="CbsLogEntity_list_base" resultMap="get-CbsLogEntity-result" parameterType="com.hzya.frame.seeyon.cbs8.entity.CbsLogEntity">
select
<include refid="CbsLogEntity_Base_Column_List"/>
from
formmain_1283
<trim prefix="where" prefixOverrides="and">
<if test="oa_id != null and oa_id !='' "> field0001 = #{oa_id} </if>
<if test="id != null and id !='' "> and id = #{id} </if>
<if test="bill_code != null and bill_code !='' "> and field0002 = #{bill_code} </if>
<if test="tab_name_en != null and tab_name_en !='' "> and field0003 = #{tab_name_en} </if>
<if test="tab_name_ch != null and tab_name_ch !='' "> and field0004 = #{tab_name_ch} </if>
<if test="pay_state != null and pay_state !='' "> and field0005 = #{pay_state} </if>
<if test="message != null and message !='' "> and field0006 = #{message} </if>
<if test="apply_state != null and apply_state !='' "> and field0007 = #{apply_state} </if>
<if test="successed != null and successed !='' "> and field0008 = #{successed} </if>
</trim>
</select>
<select id="CbsLogEntity_list_like" resultMap="get-CbsLogEntity-result" parameterType="com.hzya.frame.seeyon.cbs8.entity.CbsLogEntity">
select
<include refid="CbsLogEntity_Base_Column_List"/>
from
formmain_1283
<trim prefix="where" prefixOverrides="and">
<if test="oa_id != null and oa_id !='' "> field0001 = #{oa_id} </if>
<if test="id != null and id !='' "> and id = #{id} </if>
<if test="bill_code != null and bill_code !='' "> and field0002 like '${bill_code}%' </if>
<if test="tab_name_en != null and tab_name_en !='' "> and field0003 like '${tab_name_en}%' </if>
<if test="tab_name_ch != null and tab_name_ch !='' "> and field0004 like '${tab_name_ch}%' </if>
<if test="pay_state != null and pay_state !='' "> and field0005 like '${pay_state}%' </if>
<if test="message != null and message !='' "> and field0006 like '${message}%' </if>
<if test="apply_state != null and apply_state !='' "> and field0007 like '${apply_state}%' </if>
<if test="successed != null and successed !='' "> and field0008 = #{successed} </if>
<if test="title != null and title !='' "> and field0009 like '${title}%' </if>
<if test="pay_company != null and pay_company !='' "> and field0010 like '${pay_company}%' </if>
<if test="payee != null and payee !='' "> and field0011 like '${payee}%' </if>
<if test="amount != null and amount !='' "> and field0012 like '${amount}%' </if>
<if test="cbs_apply_code != null and cbs_apply_code !='' "> and field0013 like '${cbs_apply_code}%' </if>
</trim>
</select>
<select id="CbsLogEntity_list_base_in_payment" resultMap="get-CbsLogEntity-result" parameterType="com.hzya.frame.seeyon.cbs8.entity.CbsLogEntity">
select
<include refid="CbsLogEntity_Base_Column_List"/>
from
formmain_1283
<trim prefix="where" prefixOverrides="and">
<if test="oa_id != null and oa_id !='' "> field0001 = #{oa_id} </if>
<if test="id != null and id !='' "> and id = #{id} </if>
<if test="bill_code != null and bill_code !='' "> and field0002 = #{bill_code} </if>
<if test="tab_name_en != null and tab_name_en !='' "> and field0003 = #{tab_name_en} </if>
<if test="tab_name_ch != null and tab_name_ch !='' "> and field0004 = #{tab_name_ch} </if>
<if test="pay_state != null and pay_state !='' "> and field0005 = #{pay_state} </if>
<if test="message != null and message !='' "> and field0006 = #{message} </if>
<if test="apply_state != null and apply_state !='' "> and field0007 = #{apply_state} </if>
<if test="successed != null and successed !='' "> and field0008 = #{successed} </if>
and (field0005='支付中'
or field0005 not in ('审批撤销','审批拒绝','处理失败','退票','支付成功','取消支付','修改支付','支付失败','推送失败','网银支付',''))
</trim>
</select>
<!--修改视图支付状态-->
<update id="CbsLogEntity_update" parameterType="com.hzya.frame.seeyon.cbs8.entity.CbsLogEntity">
update formmain_1283 set
<trim suffix="" suffixOverrides=",">
<if test="pay_state != null and pay_state !='' ">field0005 =#{pay_state},</if>
field0006 =#{message},
<if test="apply_state != null and apply_state !='' ">field0007 =#{apply_state},</if>
<if test="successed != null and successed !='' ">field0008 =#{successed}</if>
</trim>
where id = #{id}
</update>
</mapper>

View File

@ -0,0 +1,39 @@
package com.hzya.frame.seeyon.cbs8.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.seeyon.cbs8.entity.CbsLogEntity;
import java.util.List;
/**
* @Description cbs8支付日志
* @Author xiangerlin
* @Date 2024/6/14 17:22
**/
public interface ICbsLogService extends IBaseService<CbsLogEntity,String> {
/**
* 查询支付中的数据
* @param logEntity
* @return
*/
List<CbsLogEntity> queryInPayment(CbsLogEntity logEntity);
/**
* 保存日志通过rest接口的形式
* @param logEntity
*/
void saveLog(CbsLogEntity logEntity);
/**
* 补推从自己开发的页面或者APIpost
* 需要传oa表单id和表单编号
* @param entity
*/
void retry(CbsLogEntity entity);
/**
* 补推从OA页面
* 只需要传日志表id就行
* @param jsonObject
*/
void resend(JSONObject jsonObject);
}

View File

@ -20,4 +20,44 @@ public interface IPaymentService extends IBaseService<PaymentEntity,String> {
* @throws Exception
*/
List<PaymentEntity> queryUnpaid(PaymentEntity entity)throws Exception;
/**
* 查询交易成功的数据
* 内置了查询条件payResult = PayState.payStateGetValue("g"); 支付成功
* @param entity
* @return
* @throws Exception
*/
List<PaymentEntity> querySuccess(PaymentEntity entity)throws Exception;
/**
* 查询交易成功且电子回单为空的
* @param entity
* @return
* @throws Exception
*/
List<PaymentEntity> queryElecIsNull(PaymentEntity entity)throws Exception;
/**
* 查询支付中的数据
* 内置了查询条件 payResult = '支付中' or payResult not in ('审批撤销','审批拒绝','处理失败','退票','支付成功','取消支付','修改支付','支付失败')
* @param entity
* @return
* @throws Exception
*/
List<PaymentEntity> queryInPayment(PaymentEntity entity)throws Exception;
/**
* 更新支付状态
* @param entity
* @throws Exception
*/
void updatePayState(PaymentEntity entity)throws Exception;
/**
* 更新电子回单字段
* @param entity
* @throws Exception
*/
void updateElec(PaymentEntity entity)throws Exception;
}

View File

@ -0,0 +1,102 @@
package com.hzya.frame.seeyon.cbs8.service.impl;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.cbs8.util.PayState;
import com.hzya.frame.seeyon.cbs8.dao.ICbsLogDao;
import com.hzya.frame.seeyon.cbs8.entity.CbsLogEntity;
import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity;
import com.hzya.frame.seeyon.cbs8.service.ICbsLogService;
import com.hzya.frame.web.exception.BaseSystemException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description cbs8支付日志
* @Author xiangerlin
* @Date 2024/6/14 17:22
**/
@Service()
public class CbsLogServiceImpl extends BaseService<CbsLogEntity,String> implements ICbsLogService {
Logger log = LoggerFactory.getLogger(getClass());
private ICbsLogDao cbsLogDao;
@Autowired
public void setCbsLogDao(ICbsLogDao cbsLogDao) {
this.cbsLogDao = cbsLogDao;
this.dao = cbsLogDao;
}
/**
* 查询支付中的数据
*
* @param logEntity
* @return
*/
@Override
public List<CbsLogEntity> queryInPayment(CbsLogEntity logEntity) {
List<CbsLogEntity> logList = cbsLogDao.queryList(logEntity, "CbsLogEntity_list_base_in_payment");
return logList;
}
/**
* 保存日志通过rest接口的形式
*
* @param logEntity
*/
@Override
public void saveLog(CbsLogEntity logEntity) {
}
/**
* 补推从自己开发的页面或者APIpost
* 需要传oa表单id和表单编号
*
* @param entity
*/
@Override
public void retry(CbsLogEntity entity) {
PaymentEntity paymentEntity = new PaymentEntity();
paymentEntity.setOaId(entity.getOa_id());
paymentEntity.setReferenceNum(entity.getBill_code());
CbsLogEntity logEntity = new CbsLogEntity();
logEntity.setId(entity.getId());
logEntity = cbsLogDao.queryOne(logEntity);
String pay_state = logEntity.getPay_state();
if (PayState.h.getValue().equals(pay_state)
|| PayState.three.getValue().equals(pay_state)
|| PayState.k.getValue().equals(pay_state)
|| "推送失败".equals(pay_state)){
//todo 调用重试方法
}else {
throw new BaseSystemException("只允许补推支付失败的记录");
}
}
/**
* 补推从OA页面
* 只需要传日志表id就行
*
* @param jsonObject
*/
@Override
public void resend(JSONObject jsonObject) {
if (null != jsonObject && StrUtil.isNotEmpty(jsonObject.getString("id"))){
String id = jsonObject.getString("id");
CbsLogEntity cbsLogEntity = new CbsLogEntity();
cbsLogEntity.setId(id);
cbsLogEntity =cbsLogDao.queryOne(cbsLogEntity);
if (null != cbsLogEntity && StrUtil.isNotEmpty(cbsLogEntity.getOa_id()) && StrUtil.isNotEmpty(cbsLogEntity.getBill_code())){
retry(cbsLogEntity);
}
}
}
}

View File

@ -1,5 +1,6 @@
package com.hzya.frame.seeyon.cbs8.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.seeyon.cbs8.dao.IPaymentDao;
import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity;
@ -17,6 +18,8 @@ import java.util.List;
@Service("OAPaymentServiceImpl")
public class PaymentServiceImpl extends BaseService<PaymentEntity,String> implements IPaymentService {
public static final String oa_datasource_code = "123";
private IPaymentDao paymentDao;
@Autowired
@ -33,8 +36,69 @@ public class PaymentServiceImpl extends BaseService<PaymentEntity,String> implem
* @return
* @throws Exception
*/
@Override
public List<PaymentEntity> queryUnpaid(PaymentEntity entity) throws Exception {
return null;
}
/**
* 查询交易成功的数据
* 内置了查询条件payResult = PayState.payStateGetValue("g"); 支付成功
*
* @param entity
* @return
* @throws Exception
*/
@Override
public List<PaymentEntity> querySuccess(PaymentEntity entity) throws Exception {
return null;
}
/**
* 查询交易成功且电子回单为空的
*
* @param entity
* @return
* @throws Exception
*/
@Override
public List<PaymentEntity> queryElecIsNull(PaymentEntity entity) throws Exception {
return null;
}
/**
* 查询支付中的数据
* 内置了查询条件 payResult = '支付中' or payResult not in ('审批撤销','审批拒绝','处理失败','退票','支付成功','取消支付','修改支付','支付失败')
*
* @param entity
* @return
* @throws Exception
*/
@Override
public List<PaymentEntity> queryInPayment(PaymentEntity entity) throws Exception {
return null;
}
/**
* 更新支付状态
*
* @param entity
* @throws Exception
*/
@Override
public void updatePayState(PaymentEntity entity) throws Exception {
}
/**
* 更新电子回单字段
*
* @param entity
* @throws Exception
*/
@Override
public void updateElec(PaymentEntity entity) throws Exception {
}
}