This commit is contained in:
xiang2lin 2024-06-18 18:02:13 +08:00
parent a60e6675b6
commit bc2290c9a0
15 changed files with 701 additions and 6 deletions

View File

@ -0,0 +1,91 @@
package com.hzya.frame.seeyon.cbs8.entity;
import com.hzya.frame.web.entity.BaseEntity;
/**
* @Description 代发代扣明细表
* @Author xiangerlin
* @Date 2024/6/18 14:58
**/
public class AgentPaymentDetailEntity extends BaseEntity {
private String dtlAmount;
//收款账号
private String dtlRevAccount;
//联行号 同行可不传跨行必传
private String dtlCnapsCode;
//收款账户名称
private String dtlRevName;
//收款开户行 ,如果传的联行号能匹配到对应到开户行cbs8会自动带出
private String dtlRevBankName;
//主表id
private String formmainId;
//表名
private String tabName;
//明细序号从1开始递增
private int dtlSeqNum;
public String getDtlAmount() {
return dtlAmount;
}
public void setDtlAmount(String dtlAmount) {
this.dtlAmount = dtlAmount;
}
public String getDtlRevAccount() {
return dtlRevAccount;
}
public void setDtlRevAccount(String dtlRevAccount) {
this.dtlRevAccount = dtlRevAccount;
}
public String getDtlCnapsCode() {
return dtlCnapsCode;
}
public void setDtlCnapsCode(String dtlCnapsCode) {
this.dtlCnapsCode = dtlCnapsCode;
}
public String getDtlRevName() {
return dtlRevName;
}
public void setDtlRevName(String dtlRevName) {
this.dtlRevName = dtlRevName;
}
public String getDtlRevBankName() {
return dtlRevBankName;
}
public void setDtlRevBankName(String dtlRevBankName) {
this.dtlRevBankName = dtlRevBankName;
}
public String getFormmainId() {
return formmainId;
}
public void setFormmainId(String formmainId) {
this.formmainId = formmainId;
}
public String getTabName() {
return tabName;
}
public void setTabName(String tabName) {
this.tabName = tabName;
}
public int getDtlSeqNum() {
return dtlSeqNum;
}
public void setDtlSeqNum(int dtlSeqNum) {
this.dtlSeqNum = dtlSeqNum;
}
}

View File

@ -0,0 +1,97 @@
package com.hzya.frame.seeyon.cbs8.entity;
import com.hzya.frame.web.entity.BaseEntity;
/**
* @Description 代发代扣 主表
* @Author xiangerlin
* @Date 2024/6/18 14:44
**/
public class AgentPaymentEntity extends BaseEntity {
//业务参考号
private String referenceNum;
/**
* 业务类型
* 201-代扣
* 203-代发
* 代发工资传203
*/
private String busType;
//总金额 小数位2位
private String amount;
//币种
private String currency;
//付款账号
private String payAccount;
//用途
private String purpose;
private String tableName;//表名称
private String billName;//单据名称
public String getReferenceNum() {
return referenceNum;
}
public void setReferenceNum(String referenceNum) {
this.referenceNum = referenceNum;
}
public String getBusType() {
return busType;
}
public void setBusType(String busType) {
this.busType = busType;
}
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public String getPayAccount() {
return payAccount;
}
public void setPayAccount(String payAccount) {
this.payAccount = payAccount;
}
public String getPurpose() {
return purpose;
}
public void setPurpose(String purpose) {
this.purpose = purpose;
}
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public String getBillName() {
return billName;
}
public void setBillName(String billName) {
this.billName = billName;
}
}

View File

@ -0,0 +1,31 @@
package com.hzya.frame.seeyon.cbs8.service;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.seeyon.cbs8.entity.AgentPaymentDetailEntity;
import com.hzya.frame.seeyon.cbs8.entity.AgentPaymentEntity;
import java.util.List;
/**
* @Description OA代发代扣
* @Author xiangerlin
* @Date 2024/6/18 15:04
**/
public interface IAgentPaymentService extends IBaseService<AgentPaymentEntity,String> {
/**
* 查询待支付待代发代扣 主表
* @param entity
* @return
* @throws Exception
*/
List<AgentPaymentEntity> queryUnpaid(AgentPaymentEntity entity) throws Exception;
/**
* 查询明细表
* @param entity
* @return
* @throws Exception
*/
List<AgentPaymentDetailEntity> queryDetails(AgentPaymentDetailEntity entity)throws Exception;
}

View File

@ -0,0 +1,41 @@
package com.hzya.frame.seeyon.cbs8.service.impl;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.seeyon.cbs8.entity.AgentPaymentDetailEntity;
import com.hzya.frame.seeyon.cbs8.entity.AgentPaymentEntity;
import com.hzya.frame.seeyon.cbs8.service.IAgentPaymentService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description
* @Author xiangerlin
* @Date 2024/6/18 15:06
**/
@Service(value = "cbs8AgentPaymentServiceImpl")
public class AgentPaymentServiceImpl extends BaseService<AgentPaymentEntity,String> implements IAgentPaymentService {
/**
* 查询待支付待代发代扣 主表
*
* @param entity
* @return
* @throws Exception
*/
@Override
public List<AgentPaymentEntity> queryUnpaid(AgentPaymentEntity entity) throws Exception {
return null;
}
/**
* 查询明细表
*
* @param entity
* @return
* @throws Exception
*/
@Override
public List<AgentPaymentDetailEntity> queryDetails(AgentPaymentDetailEntity entity) throws Exception {
return null;
}
}

View File

@ -8,14 +8,14 @@ import java.util.List;
public interface ICtpAttachmentDao extends IBaseDao<CtpAttachmentEntity,String> {
//更新数据
@DS("ht_oa_sqlserver")
@DS("#ctpAttachmentEntity.dataSourceCode")
int updateCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity);
//根据fiel_url查询附件业务记录如果存在则更新如果不存在则新增
@DS("ht_oa_sqlserver")
@DS("#ctpAttachmentEntity.dataSourceCode")
List<CtpAttachmentEntity> queryCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity);
//新增
@DS("ht_oa_sqlserver")
@DS("#ctpAttachmentEntity.dataSourceCode")
CtpAttachmentEntity saveCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity);
}

View File

@ -0,0 +1,12 @@
package com.hzya.frame.seeyon.dao;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.seeyon.entity.CtpFileEntity;
/**
* @Description seeyon 附件对象
* @Author xiangerlin
* @Date 2024/6/17 15:21
**/
public interface ICtpFileDao extends IBaseDao<CtpFileEntity,String> {
}

View File

@ -11,19 +11,19 @@ import java.util.List;
@Repository(value = "ctpAttachmentDaoImpl")
public class
CtpAttachmentDaoImpl extends MybatisGenericDao<CtpAttachmentEntity,String> implements ICtpAttachmentDao {
@DS("ht_oa_sqlserver")
@DS("#ctpAttachmentEntity.dataSourceCode")
@Override
public int updateCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity) {
return super.update("com.hzya.frame.seeyon.dao.impl.CtpAttachmentDaoImpl.entity_update",ctpAttachmentEntity);
}
@DS("ht_oa_sqlserver")
@DS("#ctpAttachmentEntity.dataSourceCode")
@Override
public List<CtpAttachmentEntity> queryCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity) {
return (List<CtpAttachmentEntity>) super.selectList("com.hzya.frame.seeyon.dao.impl.CtpAttachmentDaoImpl.entity_list_base",ctpAttachmentEntity);
}
@DS("ht_oa_sqlserver")
@DS("#ctpAttachmentEntity.dataSourceCode")
@Override
public CtpAttachmentEntity saveCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity) {
return super.save("com.hzya.frame.seeyon.dao.impl.CtpAttachmentDaoImpl.entity_insert",ctpAttachmentEntity);

View File

@ -0,0 +1,17 @@
package com.hzya.frame.seeyon.dao.impl;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.seeyon.dao.ICtpAttachmentDao;
import com.hzya.frame.seeyon.dao.ICtpFileDao;
import com.hzya.frame.seeyon.entity.CtpAttachmentEntity;
import com.hzya.frame.seeyon.entity.CtpFileEntity;
import org.springframework.stereotype.Repository;
/**
* @Description
* @Author xiangerlin
* @Date 2024/6/17 15:22
**/
@Repository()
public class CtpFileDaoImpl extends MybatisGenericDao<CtpFileEntity,String> implements ICtpFileDao {
}

View File

@ -0,0 +1,113 @@
package com.hzya.frame.seeyon.entity;
import com.hzya.frame.web.entity.BaseEntity;
import java.io.File;
/**
* @Description OA附件表
* @Author xiangerlin
* @Date 2021/10/29 08:56
**/
public class CtpFileEntity extends BaseEntity {
private String category;//应用类别
private String type;//类型
private String filename;//文件名
private String mime_type;//文件类型
private String create_date;
private String create_member;
private String file_size;//大小
private String description;//描述
private String update_date;
private String account_id;
private File file;//临时用
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
public String getMime_type() {
return mime_type;
}
public void setMime_type(String mime_type) {
this.mime_type = mime_type;
}
public String getCreate_date() {
return create_date;
}
public void setCreate_date(String create_date) {
this.create_date = create_date;
}
public String getCreate_member() {
return create_member;
}
public void setCreate_member(String create_member) {
this.create_member = create_member;
}
public String getFile_size() {
return file_size;
}
public void setFile_size(String file_size) {
this.file_size = file_size;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getUpdate_date() {
return update_date;
}
public void setUpdate_date(String update_date) {
this.update_date = update_date;
}
public String getAccount_id() {
return account_id;
}
public void setAccount_id(String account_id) {
this.account_id = account_id;
}
public File getFile() {
return file;
}
public void setFile(File file) {
this.file = file;
}
}

View File

@ -0,0 +1,49 @@
<?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.entity.CtpFileEntity">
<resultMap id="get-CtpFileEntity-result" type="com.hzya.frame.seeyon.entity.CtpFileEntity">
<!--主键 -->
<result property="id" column="id" />
<result property="category" column="category" />
<result property="type" column="type" />
<result property="filename" column="filename" />
<result property="mime_type" column="mime_type" />
<result property="create_date" column="create_date" />
<result property="create_member" column="create_member" />
<result property="file_size" column="file_size" />
<result property="description" column="description" />
<result property="update_date" column="update_date" />
<result property="account_id" column="account_id" />
</resultMap>
<sql id="CtpFileEntity_sql">
id,
category,
type,
filename,
mime_type,
create_date,
create_member,
file_size,
description,
update_date,
account_id
</sql>
<!-- 查询 采用==查询 -->
<select id="CtpFileEntity_list_base" resultMap="get-CtpFileEntity-result" parameterType="com.hzya.frame.seeyon.entity.CtpFileEntity">
select
<include refid="CtpFileEntity_sql"/>
from
ctp_file
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''">id = #{id}</if>
<if test="filename != null and filename != ''">and filename = #{filename}</if>
</trim>
</select>
</mapper>

View File

@ -0,0 +1,20 @@
package com.hzya.frame.seeyon.service;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.seeyon.entity.CtpAttachmentEntity;
/**
* @Description seeyon 附件关系
* @Author xiangerlin
* @Date 2024/6/17 15:30
**/
public interface ICtpAttachmentService extends IBaseService<CtpAttachmentEntity, String> {
/**
* 保存附件关系表
* @param fileUrl ctp_file id
* @param col_summary_id col_summary id
* @param sub_reference 随机uuid
* @return
*/
CtpAttachmentEntity saveAttachment(String fileUrl, String col_summary_id, String sub_reference)throws Exception;
}

View File

@ -0,0 +1,12 @@
package com.hzya.frame.seeyon.service;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.seeyon.entity.CtpFileEntity;
/**
* @Description seeyon 附件
* @Author xiangerlin
* @Date 2024/6/17 15:23
**/
public interface ICtpFileService extends IBaseService<CtpFileEntity, String> {
}

View File

@ -0,0 +1,70 @@
package com.hzya.frame.seeyon.service.impl;
import cn.hutool.core.date.DateUtil;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.seeyon.dao.ICtpAttachmentDao;
import com.hzya.frame.seeyon.entity.CtpAttachmentEntity;
import com.hzya.frame.seeyon.entity.CtpFileEntity;
import com.hzya.frame.seeyon.service.ICtpAttachmentService;
import com.hzya.frame.seeyon.service.ICtpFileService;
import com.hzya.frame.uuid.UUIDLong;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* @Description
* @Author xiangerlin
* @Date 2024/6/17 15:31
**/
@Service(value = "ctpAttachmentService")
public class CtpAttachmentServiceImpl extends BaseService<CtpAttachmentEntity, String> implements ICtpAttachmentService {
private ICtpAttachmentDao ctpAttachmentDao;
@Autowired
private ICtpFileService ctpFileService;
@Autowired
public void setCtpAttachmentDao(ICtpAttachmentDao dao) {
this.ctpAttachmentDao = dao;
this.dao = dao;
}
/**
* 保存附件关系表
*
* @param fileUrl ctp_file id
* @param col_summary_id col_summary id
* @param sub_reference 随机uuid
* @return
*/
@Override
public CtpAttachmentEntity saveAttachment(String fileUrl, String col_summary_id, String sub_reference)throws Exception {
//查一下附件
CtpFileEntity ctpFileEntity = new CtpFileEntity();
ctpFileEntity.setId(fileUrl);
ctpFileEntity.setDataSourceCode("");
List<CtpFileEntity> ctpFileList = ctpFileService.query(ctpFileEntity);
if (CollectionUtils.isNotEmpty(ctpFileList)){
CtpFileEntity ctpFile = ctpFileList.get(0);
if (null != ctpFile){
CtpAttachmentEntity ctpAttachmentEntity = new CtpAttachmentEntity();
ctpAttachmentEntity.setId(String.valueOf(UUIDLong.longUUID()));
ctpAttachmentEntity.setFile_url(ctpFile.getId());//ctp_file表的id
ctpAttachmentEntity.setAtt_reference(col_summary_id);//业务表单的id
ctpAttachmentEntity.setSub_reference(sub_reference);//这个字段要保存到业务表附件到字段上
ctpAttachmentEntity.setCategory("66");//这里写66 才可以显示图片
ctpAttachmentEntity.setFilename(ctpFile.getFilename());
ctpAttachmentEntity.setType(ctpFile.getType());
ctpAttachmentEntity.setMime_type(ctpFile.getMime_type());
ctpAttachmentEntity.setAttachment_size(ctpFile.getFile_size());
ctpAttachmentEntity.setCreatedate(new Date());
this.save(ctpAttachmentEntity);
return ctpAttachmentEntity;
}
}
return null;
}
}

View File

@ -0,0 +1,15 @@
package com.hzya.frame.seeyon.service.impl;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.seeyon.entity.CtpFileEntity;
import com.hzya.frame.seeyon.service.ICtpFileService;
import org.springframework.stereotype.Service;
/**
* @Description
* @Author xiangerlin
* @Date 2024/6/17 15:24
**/
@Service()
public class CtpFileServiceImpl extends BaseService<CtpFileEntity, String> implements ICtpFileService {
}

View File

@ -0,0 +1,127 @@
package com.hzya.frame.seeyon.util;
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.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.seeyon.entity.CtpFileEntity;
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity;
import com.hzya.frame.sysnew.application.api.service.ISysApplicationApiService;
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.Component;
import java.io.File;
import java.util.HashMap;
/**
* @Description 致远rest接口工具类
* @Author xiangerlin
* @Date 2024/6/17 15:49
**/
@Component
public class RestUtil {
@Autowired
private ISysApplicationApiService sysApplicationApiService;
static Logger logger = LoggerFactory.getLogger(RestUtil.class);
private RestUtil() {
}
/**
* 附件上传
* @param file 附件对象
* @param api_code 接口编码
* @return
*/
public JSONObject fileUpload(File file,String api_code) {
if (StrUtil.isNotEmpty(api_code)){
//1查询附件上传api接口信息
SysApplicationApiEntity sysApp = getByCode(api_code);
if (null != sysApp){
String app_url = sysApp.getAppUrl();
String url = app_url+"/seeyon/rest/attachment?token=@token@";
String token = getToken(null,"8000240000");
url = url.replaceAll("@token@",token);
HashMap<String, Object> paramMap = new HashMap<>();
paramMap.put("file", file);
String result = HttpUtil.post(url, paramMap);
if (StrUtil.isNotBlank(result)) {
logger.info("附件上传结果"+result);
JSONObject jsonObject = JSONObject.parseObject(result);
String atts = jsonObject.get("atts").toString();
if (StrUtil.isNotEmpty(atts)) {
JSONArray jsonArray = JSONArray.parseArray(atts);
JSONObject res = (JSONObject) jsonArray.get(0);
return res;
}
}
}
}else {
throw new BaseSystemException("api_code不能为空");
}
return null;
}
/**
* 获取token
* @param login_name
* @param api_code
* @return
*/
public String getToken(String login_name,String api_code){
if (StrUtil.isNotEmpty(api_code)){
SysApplicationApiEntity sysApp = getByCode(api_code);
if (null != sysApp){
HashMap<String, String> hashMap = new HashMap<>();
String app_url = sysApp.getAppUrl();
String url = app_url+"/seeyon/rest/token";
String headerIn = sysApp.getHeaderIn();
JSONArray headers = JSON.parseArray(headerIn);
for (int i = 0; i < headers.size(); i++) {
JSONObject object1 = headers.getJSONObject(i);
String parameterName = object1.getString("parameterName");
if ("userName".equals(parameterName) || "password".equals(parameterName) || "loginName".equals(parameterName)){
String example = object1.getString("example");
hashMap.put(parameterName,example);
}
}
if (StrUtil.isNotEmpty(login_name)){
hashMap.put("loginName",login_name);
}
String result = HttpRequest.post(url).body(JSON.toJSONString(hashMap)).execute().body();
JSONObject jsonObject = JSONObject.parseObject(result);
if (null != jsonObject) {
logger.info("======token{}======" ,jsonObject.getString("id"));
return jsonObject.getString("id");
}
}
}else {
throw new BaseSystemException("api_code不能为空");
}
return null;
}
private SysApplicationApiEntity getByCode(String api_code){
if (StrUtil.isNotEmpty(api_code)){
SysApplicationApiEntity sysApp = new SysApplicationApiEntity();
sysApp.setApiCode(Long.valueOf(api_code));
sysApp = sysApplicationApiService.queryOne(sysApp);
if (null != sysApp && StrUtil.isNotEmpty(sysApp.getId())){
sysApp = sysApplicationApiService.get(sysApp.getId());
if (null != sysApp){
return sysApp;
}
}
}else {
throw new BaseSystemException("api_code不能为空");
}
return null;
}
}