转换凭证

This commit is contained in:
lvleigang 2024-11-05 13:56:40 +08:00
parent af75461f14
commit 108dd57ad6
10 changed files with 582 additions and 0 deletions

View File

@ -0,0 +1,14 @@
package com.hzya.frame.bip.v3.v2207.dao;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.bip.v3.v2207.entity.BipArchivesEntity;
import com.hzya.frame.bip.v3.v2207.entity.BipOrgsEntity;
import java.util.List;
public interface IBipArchivesDao extends IBaseDao<BipArchivesEntity, String> {
List<BipArchivesEntity> queryArchivesData(BipArchivesEntity archivesEntity);
}

View File

@ -0,0 +1,21 @@
package com.hzya.frame.bip.v3.v2207.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.bip.v3.v2207.dao.IBipArchivesDao;
import com.hzya.frame.bip.v3.v2207.dao.IBipOrgsDao;
import com.hzya.frame.bip.v3.v2207.entity.BipArchivesEntity;
import com.hzya.frame.bip.v3.v2207.entity.BipOrgsEntity;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository("bipArchivesDaoImpl")
public class BipArchivesDaoImpl extends MybatisGenericDao<BipArchivesEntity,String> implements IBipArchivesDao {
@Override
public List<BipArchivesEntity> queryArchivesData(BipArchivesEntity entity) {
List<BipArchivesEntity> o = super.query(getSqlIdPrifx() + "queryArchivesData", entity);
return o;
}
}

View File

@ -0,0 +1,188 @@
package com.hzya.frame.bip.v3.v2207.entity;
import cn.dev33.satoken.stp.StpUtil;
import com.hzya.frame.uuid.UUIDUtils;
import com.hzya.frame.web.entity.BaseEntity;
import java.util.Date;
/**
* (BdCorp)实体类
*
* @author makejava
* @since 2023-09-06 14:47:18
*/
public class BipArchivesEntity extends BaseEntity {
private String archivesType;//类型
private String leftCode;//左编码
private String rightCode;//右编码
private String leftAppId;//左应用id
private String leftAppCode;//左应用编码
private String leftAppName;//左应用名称
private String leftApiId;//左接口ID
private String leftId;//左id
private String leftName;//左名称
private String rightAppId;//右应用id
private String rightAppCode;//右应用编码
private String rightAppName;//右应用名称
private String rightApiId;//右接口ID
private String rightId;//右id
private String rightName;//右名称
private String leftOrg;//左公司
private String rightOrg;//右公司
public String getArchivesType() {
return archivesType;
}
public void setArchivesType(String archivesType) {
this.archivesType = archivesType;
}
public String getLeftCode() {
return leftCode;
}
public void setLeftCode(String leftCode) {
this.leftCode = leftCode;
}
public String getRightCode() {
return rightCode;
}
public void setRightCode(String rightCode) {
this.rightCode = rightCode;
}
public String getLeftAppId() {
return leftAppId;
}
public void setLeftAppId(String leftAppId) {
this.leftAppId = leftAppId;
}
public String getLeftAppCode() {
return leftAppCode;
}
public void setLeftAppCode(String leftAppCode) {
this.leftAppCode = leftAppCode;
}
public String getLeftAppName() {
return leftAppName;
}
public void setLeftAppName(String leftAppName) {
this.leftAppName = leftAppName;
}
public String getLeftApiId() {
return leftApiId;
}
public void setLeftApiId(String leftApiId) {
this.leftApiId = leftApiId;
}
public String getLeftId() {
return leftId;
}
public void setLeftId(String leftId) {
this.leftId = leftId;
}
public String getLeftName() {
return leftName;
}
public void setLeftName(String leftName) {
this.leftName = leftName;
}
public String getRightAppId() {
return rightAppId;
}
public void setRightAppId(String rightAppId) {
this.rightAppId = rightAppId;
}
public String getRightAppCode() {
return rightAppCode;
}
public void setRightAppCode(String rightAppCode) {
this.rightAppCode = rightAppCode;
}
public String getRightAppName() {
return rightAppName;
}
public void setRightAppName(String rightAppName) {
this.rightAppName = rightAppName;
}
public String getRightApiId() {
return rightApiId;
}
public void setRightApiId(String rightApiId) {
this.rightApiId = rightApiId;
}
public String getRightId() {
return rightId;
}
public void setRightId(String rightId) {
this.rightId = rightId;
}
public String getRightName() {
return rightName;
}
public void setRightName(String rightName) {
this.rightName = rightName;
}
public String getLeftOrg() {
return leftOrg;
}
public void setLeftOrg(String leftOrg) {
this.leftOrg = leftOrg;
}
public String getRightOrg() {
return rightOrg;
}
public void setRightOrg(String rightOrg) {
this.rightOrg = rightOrg;
}
public void setCreate() {
this.setId(UUIDUtils.getUUID());
this.setSts("Y");
this.setCreate_user_id("1");
this.setModify_user_id("1");
this.setCreate_time(new Date());
this.setModify_time(new Date());
this.setOrg_id("0");
this.setCompanyId("0");
}
//修改信息
public void setUpdate() {
this.setModify_user_id("1");
this.setModify_time(new Date());
}
}

View File

@ -0,0 +1,54 @@
<?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.bip.v3.v2207.dao.impl.BipArchivesDaoImpl">
<resultMap id="get-ArchivesEntity-result" type="com.hzya.frame.bip.v3.v2207.entity.BipArchivesEntity" >
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="leftAppId" column="left_app_id" jdbcType="VARCHAR"/>
<result property="leftAppCode" column="left_app_code" jdbcType="VARCHAR"/>
<result property="leftAppName" column="left_app_name" jdbcType="VARCHAR"/>
<result property="leftApiId" column="left_api_id" jdbcType="VARCHAR"/>
<result property="leftId" column="left_id" jdbcType="VARCHAR"/>
<result property="leftCode" column="left_code" jdbcType="VARCHAR"/>
<result property="leftName" column="left_name" jdbcType="VARCHAR"/>
<result property="rightAppId" column="right_app_id" jdbcType="VARCHAR"/>
<result property="rightAppCode" column="right_app_code" jdbcType="VARCHAR"/>
<result property="rightAppName" column="right_app_name" jdbcType="VARCHAR"/>
<result property="rightApiId" column="right_api_id" jdbcType="VARCHAR"/>
<result property="rightId" column="right_id" jdbcType="VARCHAR"/>
<result property="rightCode" column="right_code" jdbcType="VARCHAR"/>
<result property="rightName" column="right_name" jdbcType="VARCHAR"/>
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
<result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
<result property="sts" column="sts" jdbcType="VARCHAR"/>
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
</resultMap>
<select id="queryArchivesData" resultMap="get-ArchivesEntity-result"
parameterType="com.hzya.frame.bip.v3.v2207.entity.BipArchivesEntity">
select
right_code
from
<choose>
<when test="archivesType == '1'.toString()"> sys_personnel_control </when>
<when test="archivesType == '2'.toString()"> sys_org_control </when>
<when test="archivesType == '6'.toString()"> sys_stock_control </when>
<when test="archivesType == '73'.toString()"> sys_merchant_control </when>
<when test="archivesType == 'D01'.toString()"> sys_taxrate_control </when>
<when test="archivesType == 'jobass'.toString()"> sys_project_control </when>
<when test="archivesType == '93'.toString()"> sys_bank_control </when>
<when test="archivesType == '96'.toString()"> sys_bankaccount_control </when>
<when test="archivesType == '22'.toString()"> sys_assets_control </when>
</choose>
<trim prefix="where" prefixOverrides="and">
<if test="leftCode != null and leftCode != ''">and left_code = #{leftCode}</if>
<if test="leftOrg != null and leftOrg != ''">and left_org = #{leftOrg}</if>
and sts='Y'
</trim>
</select>
</mapper>

View File

@ -0,0 +1,24 @@
package com.hzya.frame.bip.v3.v2207.entity;
public class BipAss {
private String checktypecode;
private String checkvaluecode;
public String getChecktypecode() {
return checktypecode;
}
public void setChecktypecode(String checktypecode) {
this.checktypecode = checktypecode;
}
public String getCheckvaluecode() {
return checkvaluecode;
}
public void setCheckvaluecode(String checkvaluecode) {
this.checkvaluecode = checkvaluecode;
}
}

View File

@ -0,0 +1,23 @@
package com.hzya.frame.bip.v3.v2207.entity;
public class BipCashflow {
private String money;
private String pk_cashflow;
public String getMoney() {
return money;
}
public void setMoney(String money) {
this.money = money;
}
public String getPk_cashflow() {
return pk_cashflow;
}
public void setPk_cashflow(String pk_cashflow) {
this.pk_cashflow = pk_cashflow;
}
}

View File

@ -0,0 +1,69 @@
package com.hzya.frame.bip.v3.v2207.entity;
import java.util.List;
public class BipVoucher {
private List<BipVoucherDetails> details;
private String no;
private String pk_corp;
private String pk_glorgbook;
private String pk_prepared;
private String pk_vouchertype;
private String pk_voucher;
public List<BipVoucherDetails> getDetails() {
return details;
}
public void setDetails(List<BipVoucherDetails> details) {
this.details = details;
}
public String getNo() {
return no;
}
public void setNo(String no) {
this.no = no;
}
public String getPk_corp() {
return pk_corp;
}
public void setPk_corp(String pk_corp) {
this.pk_corp = pk_corp;
}
public String getPk_glorgbook() {
return pk_glorgbook;
}
public void setPk_glorgbook(String pk_glorgbook) {
this.pk_glorgbook = pk_glorgbook;
}
public String getPk_prepared() {
return pk_prepared;
}
public void setPk_prepared(String pk_prepared) {
this.pk_prepared = pk_prepared;
}
public String getPk_vouchertype() {
return pk_vouchertype;
}
public void setPk_vouchertype(String pk_vouchertype) {
this.pk_vouchertype = pk_vouchertype;
}
public String getPk_voucher() {
return pk_voucher;
}
public void setPk_voucher(String pk_voucher) {
this.pk_voucher = pk_voucher;
}
}

View File

@ -0,0 +1,105 @@
package com.hzya.frame.bip.v3.v2207.entity;
import java.util.List;
public class BipVoucherDetails {
private List<BipAss> ass;
private List<BipCashflow> cashflow;
private String creditamount;
private String debitamount;
private String explanation;
private String localcreditamount;
private String localdebitamount;
private String pk_accsubj;
private String pk_currtype;
private String debitquantity;
private String price;
public List<BipAss> getAss() {
return ass;
}
public void setAss(List<BipAss> ass) {
this.ass = ass;
}
public List<BipCashflow> getCashflow() {
return cashflow;
}
public void setCashflow(List<BipCashflow> cashflow) {
this.cashflow = cashflow;
}
public String getCreditamount() {
return creditamount;
}
public void setCreditamount(String creditamount) {
this.creditamount = creditamount;
}
public String getDebitamount() {
return debitamount;
}
public void setDebitamount(String debitamount) {
this.debitamount = debitamount;
}
public String getExplanation() {
return explanation;
}
public void setExplanation(String explanation) {
this.explanation = explanation;
}
public String getLocalcreditamount() {
return localcreditamount;
}
public void setLocalcreditamount(String localcreditamount) {
this.localcreditamount = localcreditamount;
}
public String getLocaldebitamount() {
return localdebitamount;
}
public void setLocaldebitamount(String localdebitamount) {
this.localdebitamount = localdebitamount;
}
public String getPk_accsubj() {
return pk_accsubj;
}
public void setPk_accsubj(String pk_accsubj) {
this.pk_accsubj = pk_accsubj;
}
public String getPk_currtype() {
return pk_currtype;
}
public void setPk_currtype(String pk_currtype) {
this.pk_currtype = pk_currtype;
}
public String getDebitquantity() {
return debitquantity;
}
public void setDebitquantity(String debitquantity) {
this.debitquantity = debitquantity;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
}

View File

@ -0,0 +1,12 @@
package com.hzya.frame.bip.v3.v2207.service;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.bip.v3.v2207.entity.BipTokenVo;
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
public interface IBipPzService extends IBaseService<BipTokenVo,String>{
SysExtensionApiEntity getPz(SysExtensionApiEntity entity);
}

View File

@ -0,0 +1,72 @@
package com.hzya.frame.bip.v3.v2207.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.bip.v3.v2207.dao.IBipArchivesDao;
import com.hzya.frame.bip.v3.v2207.entity.BipArchivesEntity;
import com.hzya.frame.bip.v3.v2207.entity.BipAss;
import com.hzya.frame.bip.v3.v2207.entity.BipTokenVo;
import com.hzya.frame.bip.v3.v2207.entity.BipVoucher;
import com.hzya.frame.bip.v3.v2207.entity.BipVoucherDetails;
import com.hzya.frame.bip.v3.v2207.service.IBipPzService;
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
import com.hzya.frame.web.entity.BaseResult;
import jdk.nashorn.internal.ir.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
@Service(value = "bipV32207TokenService")
public class BipPzServiceImpl extends BaseService<BipTokenVo, String> implements IBipPzService {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Resource
private IBipArchivesDao bipArchivesDao;
/**
* @param entity
* @return com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity
* @Author lvleigang
* @Description 组装凭证数据
* @Date 10:52 上午 2024/11/5
**/
@Override
public SysExtensionApiEntity getPz(SysExtensionApiEntity entity) {
String bodys = entity.getBodys();
BipVoucher voucher = JSONObject.parseObject(bodys, BipVoucher.class);
List<String> fzhs = Arrays.asList(new String[]{"1", "2", "6", "73", "D01", "jobass", "93", "96", "22"});
if (voucher.getDetails() != null && voucher.getDetails().size() > 0) {
for (int a = 0; a < voucher.getDetails().size(); a++) {
BipVoucherDetails voucherDetails = voucher.getDetails().get(a);
if (voucherDetails.getAss() != null && voucherDetails.getAss().size() > 0) {
for (int b = 0; b < voucherDetails.getAss().size(); b++) {
BipAss ass = voucherDetails.getAss().get(b);
if (ass.getChecktypecode() != null && !"".equals(ass.getChecktypecode())) {
//存在需要转换的
if (fzhs.contains(ass.getChecktypecode())) {
BipArchivesEntity archivesEntity = new BipArchivesEntity();
archivesEntity.setArchivesType(ass.getChecktypecode());
archivesEntity.setLeftCode(ass.getCheckvaluecode());
archivesEntity.setLeftOrg(voucher.getPk_corp());
List<BipArchivesEntity> archivesEntities = bipArchivesDao.queryArchivesData(archivesEntity);
if (archivesEntities != null && archivesEntities.size() > 0) {
ass.setCheckvaluecode(archivesEntities.get(0).getRightCode());
}
}
}
}
}
}
}
bodys = JSON.toJSONString(voucher);
entity.setBodys(bodys);
return entity;
}
}