This commit is contained in:
476474485@qq.com 2024-09-11 15:15:22 +08:00
parent e70a5e8cc4
commit f56a4fe61b
172 changed files with 978 additions and 983 deletions

View File

@ -1,12 +1,11 @@
package com.hzya.frame.grpU8.acctVouchInfo.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity;
import com.hzya.frame.grpU8.acctVouchInfo.entity.AcctVouchInfoEntity;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.grpU8.acctVouchInfo.dao.IAcctVouchInfoDao;
import com.hzya.frame.grpU8.acctVouchInfo.entity.AcctVouchInfoEntity;
import com.hzya.frame.grpU8.acctVouchInfo.entity.AcctVouchInfoEntityVo;
import org.springframework.stereotype.Repository;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import java.util.List;

View File

@ -1,6 +1,5 @@
package com.hzya.frame.grpU8.acctVouchInfo.entity;
import java.util.Date;
import com.hzya.frame.web.entity.BaseEntity;
/**
* 子表(AcctVouchInfo)实体类
@ -9,7 +8,7 @@ import com.hzya.frame.web.entity.BaseEntity;
* @since 2024-07-09 11:25:15
*/
public class AcctVouchInfoEntity extends BaseEntity {
/** 年度 */
private String acct_year;
/** 月份 */

View File

@ -1,10 +1,9 @@
package com.hzya.frame.grpU8.acctVouchInfo.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
import com.hzya.frame.web.entity.JsonResultEntity;
import com.hzya.frame.grpU8.acctVouchInfo.entity.AcctVouchInfoEntity;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.grpU8.acctVouchInfo.entity.AcctVouchInfoEntity;
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
/**
* 子表(AcctVouchInfo)表服务接口
*

View File

@ -1,13 +1,11 @@
package com.hzya.frame.grpU8.dictCheckType.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.grpU8.dictAcctSubj.entity.DictAcctSubjEntity;
import com.hzya.frame.grpU8.dictAcctSubj.entity.DictAcctSubjEntityVo;
import com.hzya.frame.grpU8.dictCheckType.entity.DictCheckTypeEntity;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.grpU8.dictCheckType.dao.IDictCheckTypeDao;
import com.hzya.frame.grpU8.dictCheckType.entity.DictCheckTypeEntity;
import com.hzya.frame.grpU8.dictCheckType.entity.DictCheckTypeEntityVo;
import org.springframework.stereotype.Repository;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import java.util.List;

View File

@ -1,13 +1,13 @@
package com.hzya.frame.grpU8.nxproof.attachment.dao;/*
* @Description 附件
* @Author xiangerlin
@Date 2022-10-26 11:17
*/
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.grpU8.nxproof.attachment.entity.AttachmentFileEntity;
public interface IAttachmentFileDao extends IBaseDao<AttachmentFileEntity, String> {
Integer saveData(AttachmentFileEntity entity);
}
package com.hzya.frame.grpU8.nxproof.attachment.dao;/*
* @Description 附件
* @Author xiangerlin
@Date 2022-10-26 11:17
*/
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.grpU8.nxproof.attachment.entity.AttachmentFileEntity;
public interface IAttachmentFileDao extends IBaseDao<AttachmentFileEntity, String> {
Integer saveData(AttachmentFileEntity entity);
}

View File

@ -1,23 +1,23 @@
package com.hzya.frame.grpU8.nxproof.attachment.dao.impl;/*
* @Description 附件
* @Author xiangerlin
@Date 2022-10-26 11:18
*/
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.grpU8.nxproof.attachment.dao.IAttachmentFileDao;
import com.hzya.frame.grpU8.nxproof.attachment.entity.AttachmentFileEntity;
import com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity;
import org.springframework.stereotype.Repository;
@Repository
public class AttachmentFileDaoImpl extends MybatisGenericDao<AttachmentFileEntity, String> implements IAttachmentFileDao {
@DS("#entity.dataSourceCode")
@Override
public Integer saveData(AttachmentFileEntity entity) {
Integer o = super.insert("com.hzya.frame.grpU8.nxproof.attachment.entity.AttachmentFileEntity.AttachmentFileEntity_insert", entity);
return o;
}
}
package com.hzya.frame.grpU8.nxproof.attachment.dao.impl;/*
* @Description 附件
* @Author xiangerlin
@Date 2022-10-26 11:18
*/
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.grpU8.nxproof.attachment.dao.IAttachmentFileDao;
import com.hzya.frame.grpU8.nxproof.attachment.entity.AttachmentFileEntity;
import com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity;
import org.springframework.stereotype.Repository;
@Repository
public class AttachmentFileDaoImpl extends MybatisGenericDao<AttachmentFileEntity, String> implements IAttachmentFileDao {
@DS("#entity.dataSourceCode")
@Override
public Integer saveData(AttachmentFileEntity entity) {
Integer o = super.insert("com.hzya.frame.grpU8.nxproof.attachment.entity.AttachmentFileEntity.AttachmentFileEntity_insert", entity);
return o;
}
}

View File

@ -1,120 +1,120 @@
package com.hzya.frame.grpU8.nxproof.attachment.entity;/*
* @Description 附件表
* @Author xiangerlin
@Date 2022-10-26 10:40
*/
import com.hzya.frame.web.entity.BaseEntity;
public class AttachmentFileEntity extends BaseEntity {
private String aTGuid;//主键id
private String createDate;//创建日期
private String createID;//创建人id
private String updateDate;//更新日期
private String updateID;//更新人id
private String deleteDate;//删除日期
private String deleteID;//删除人
private String aTFileName;//附件名
private String aTExtName;//附件后缀名
private byte[] aTFile;//附件 二进制文件
private String relationApp;//固定传 OER
private String isDELETE;//删除标记 0是未删除
public String getaTGuid() {
return aTGuid;
}
public void setaTGuid(String aTGuid) {
this.aTGuid = aTGuid;
}
public String getCreateDate() {
return createDate;
}
public void setCreateDate(String createDate) {
this.createDate = createDate;
}
public String getCreateID() {
return createID;
}
public void setCreateID(String createID) {
this.createID = createID;
}
public String getUpdateDate() {
return updateDate;
}
public void setUpdateDate(String updateDate) {
this.updateDate = updateDate;
}
public String getUpdateID() {
return updateID;
}
public void setUpdateID(String updateID) {
this.updateID = updateID;
}
public String getDeleteDate() {
return deleteDate;
}
public void setDeleteDate(String deleteDate) {
this.deleteDate = deleteDate;
}
public String getDeleteID() {
return deleteID;
}
public void setDeleteID(String deleteID) {
this.deleteID = deleteID;
}
public String getaTFileName() {
return aTFileName;
}
public void setaTFileName(String aTFileName) {
this.aTFileName = aTFileName;
}
public String getaTExtName() {
return aTExtName;
}
public void setaTExtName(String aTExtName) {
this.aTExtName = aTExtName;
}
public byte[] getaTFile() {
return aTFile;
}
public void setaTFile(byte[] aTFile) {
this.aTFile = aTFile;
}
public String getRelationApp() {
return relationApp;
}
public void setRelationApp(String relationApp) {
this.relationApp = relationApp;
}
public String getIsDELETE() {
return isDELETE;
}
public void setIsDELETE(String isDELETE) {
this.isDELETE = isDELETE;
}
}
package com.hzya.frame.grpU8.nxproof.attachment.entity;/*
* @Description 附件表
* @Author xiangerlin
@Date 2022-10-26 10:40
*/
import com.hzya.frame.web.entity.BaseEntity;
public class AttachmentFileEntity extends BaseEntity {
private String aTGuid;//主键id
private String createDate;//创建日期
private String createID;//创建人id
private String updateDate;//更新日期
private String updateID;//更新人id
private String deleteDate;//删除日期
private String deleteID;//删除人
private String aTFileName;//附件名
private String aTExtName;//附件后缀名
private byte[] aTFile;//附件 二进制文件
private String relationApp;//固定传 OER
private String isDELETE;//删除标记 0是未删除
public String getaTGuid() {
return aTGuid;
}
public void setaTGuid(String aTGuid) {
this.aTGuid = aTGuid;
}
public String getCreateDate() {
return createDate;
}
public void setCreateDate(String createDate) {
this.createDate = createDate;
}
public String getCreateID() {
return createID;
}
public void setCreateID(String createID) {
this.createID = createID;
}
public String getUpdateDate() {
return updateDate;
}
public void setUpdateDate(String updateDate) {
this.updateDate = updateDate;
}
public String getUpdateID() {
return updateID;
}
public void setUpdateID(String updateID) {
this.updateID = updateID;
}
public String getDeleteDate() {
return deleteDate;
}
public void setDeleteDate(String deleteDate) {
this.deleteDate = deleteDate;
}
public String getDeleteID() {
return deleteID;
}
public void setDeleteID(String deleteID) {
this.deleteID = deleteID;
}
public String getaTFileName() {
return aTFileName;
}
public void setaTFileName(String aTFileName) {
this.aTFileName = aTFileName;
}
public String getaTExtName() {
return aTExtName;
}
public void setaTExtName(String aTExtName) {
this.aTExtName = aTExtName;
}
public byte[] getaTFile() {
return aTFile;
}
public void setaTFile(byte[] aTFile) {
this.aTFile = aTFile;
}
public String getRelationApp() {
return relationApp;
}
public void setRelationApp(String relationApp) {
this.relationApp = relationApp;
}
public String getIsDELETE() {
return isDELETE;
}
public void setIsDELETE(String isDELETE) {
this.isDELETE = isDELETE;
}
}

View File

@ -1,86 +1,86 @@
<?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.grpU8.nxproof.attachment.entity.AttachmentFileEntity">
<resultMap id="get-AttachmentFileEntity-result" type="com.hzya.frame.grpU8.nxproof.attachment.entity.AttachmentFileEntity">
<result property="aTGuid" column="aTGuid" />
<result property="createDate" column="createDate" />
<result property="createID" column="createID" />
<result property="updateDate" column="updateDate" />
<result property="updateID" column="updateID" />
<result property="deleteDate" column="deleteDate" />
<result property="deleteID" column="deleteID" />
<result property="aTFileName" column="aTFileName" />
<result property="aTExtName" column="aTExtName" />
<result column="aTFile" property="aTFile" jdbcType="BLOB" typeHandler="org.apache.ibatis.type.BlobTypeHandler" />
<result property="relationApp" column="relationApp" />
<result property="isDELETE" column="isDELETE" />
</resultMap>
<sql id="AttachmentFileEntity_Base_Column_List">
ATGuid,
CreateDate,
CreateID,
UpdateDate,
UpdateID,
DeleteDate,
DeleteID,
ATFileName,
ATExtName,
ATFile,
RelationApp,
ISDELETE
</sql>
<!-- 查询 采用==查询 -->
<select id="AttachmentFileEntity_list_base" resultMap="get-AttachmentFileEntity-result" parameterType="com.hzya.frame.grpU8.nxproof.attachment.entity.AttachmentFileEntity">
select
<include refid="AttachmentFileEntity_Base_Column_List" />
FROM
AT_AttachmentFile
<trim prefix="where" prefixOverrides="and">
<if test="aTGuid != null and aTGuid !='' "> aTGuid = #{aTGuid} </if>
<if test="aTFileName != null and aTFileName !='' ">and aTFileName = #{aTFileName} </if>
</trim>
</select>
<insert id="AttachmentFileEntity_insert" parameterType="com.hzya.frame.grpU8.nxproof.attachment.entity.AttachmentFileEntity">
insert into AT_AttachmentFile(
<trim suffix="" suffixOverrides=",">
<if test="aTGuid != null and aTGuid !='' ">aTGuid,</if>
<if test="createDate != null and createDate !='' "> createDate, </if>
<if test="createID != null and createID !='' "> createID, </if>
<if test="updateDate != null and updateDate !='' "> updateDate ,</if>
<if test="updateID != null and updateID !='' ">updateID,</if>
<if test="deleteDate != null and deleteDate !='' ">deleteDate,</if>
<if test="deleteID != null and deleteID !='' ">deleteID,</if>
<if test="aTFileName != null and aTFileName !='' ">aTFileName,</if>
<if test="aTExtName != null and aTExtName !='' ">aTExtName,</if>
<if test="aTFile != null and aTFile !='' ">aTFile,</if>
relationApp,
isDELETE
</trim>
)values
(
<trim suffix="" suffixOverrides=",">
<if test="aTGuid != null and aTGuid !='' ">#{aTGuid},</if>
<if test="createDate != null and createDate !='' "> #{createDate}, </if>
<if test="createID != null and createID !='' "> #{createID}, </if>
<if test="updateDate != null and updateDate !='' "> #{updateDate} ,</if>
<if test="updateID != null and updateID !='' ">#{updateID},</if>
<if test="deleteDate != null and deleteDate !='' ">#{deleteDate},</if>
<if test="deleteID != null and deleteID !='' ">#{deleteID},</if>
<if test="aTFileName != null and aTFileName !='' ">#{aTFileName},</if>
<if test="aTExtName != null and aTExtName !='' ">#{aTExtName},</if>
<if test="aTFile != null and aTFile !='' ">#{aTFile,typeHandler=org.apache.ibatis.type.BlobTypeHandler},</if>
'OER',
0
</trim>
)
</insert>
</mapper>
<?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.grpU8.nxproof.attachment.entity.AttachmentFileEntity">
<resultMap id="get-AttachmentFileEntity-result" type="com.hzya.frame.grpU8.nxproof.attachment.entity.AttachmentFileEntity">
<result property="aTGuid" column="aTGuid" />
<result property="createDate" column="createDate" />
<result property="createID" column="createID" />
<result property="updateDate" column="updateDate" />
<result property="updateID" column="updateID" />
<result property="deleteDate" column="deleteDate" />
<result property="deleteID" column="deleteID" />
<result property="aTFileName" column="aTFileName" />
<result property="aTExtName" column="aTExtName" />
<result column="aTFile" property="aTFile" jdbcType="BLOB" typeHandler="org.apache.ibatis.type.BlobTypeHandler" />
<result property="relationApp" column="relationApp" />
<result property="isDELETE" column="isDELETE" />
</resultMap>
<sql id="AttachmentFileEntity_Base_Column_List">
ATGuid,
CreateDate,
CreateID,
UpdateDate,
UpdateID,
DeleteDate,
DeleteID,
ATFileName,
ATExtName,
ATFile,
RelationApp,
ISDELETE
</sql>
<!-- 查询 采用==查询 -->
<select id="AttachmentFileEntity_list_base" resultMap="get-AttachmentFileEntity-result" parameterType="com.hzya.frame.grpU8.nxproof.attachment.entity.AttachmentFileEntity">
select
<include refid="AttachmentFileEntity_Base_Column_List" />
FROM
AT_AttachmentFile
<trim prefix="where" prefixOverrides="and">
<if test="aTGuid != null and aTGuid !='' "> aTGuid = #{aTGuid} </if>
<if test="aTFileName != null and aTFileName !='' ">and aTFileName = #{aTFileName} </if>
</trim>
</select>
<insert id="AttachmentFileEntity_insert" parameterType="com.hzya.frame.grpU8.nxproof.attachment.entity.AttachmentFileEntity">
insert into AT_AttachmentFile(
<trim suffix="" suffixOverrides=",">
<if test="aTGuid != null and aTGuid !='' ">aTGuid,</if>
<if test="createDate != null and createDate !='' "> createDate, </if>
<if test="createID != null and createID !='' "> createID, </if>
<if test="updateDate != null and updateDate !='' "> updateDate ,</if>
<if test="updateID != null and updateID !='' ">updateID,</if>
<if test="deleteDate != null and deleteDate !='' ">deleteDate,</if>
<if test="deleteID != null and deleteID !='' ">deleteID,</if>
<if test="aTFileName != null and aTFileName !='' ">aTFileName,</if>
<if test="aTExtName != null and aTExtName !='' ">aTExtName,</if>
<if test="aTFile != null and aTFile !='' ">aTFile,</if>
relationApp,
isDELETE
</trim>
)values
(
<trim suffix="" suffixOverrides=",">
<if test="aTGuid != null and aTGuid !='' ">#{aTGuid},</if>
<if test="createDate != null and createDate !='' "> #{createDate}, </if>
<if test="createID != null and createID !='' "> #{createID}, </if>
<if test="updateDate != null and updateDate !='' "> #{updateDate} ,</if>
<if test="updateID != null and updateID !='' ">#{updateID},</if>
<if test="deleteDate != null and deleteDate !='' ">#{deleteDate},</if>
<if test="deleteID != null and deleteID !='' ">#{deleteID},</if>
<if test="aTFileName != null and aTFileName !='' ">#{aTFileName},</if>
<if test="aTExtName != null and aTExtName !='' ">#{aTExtName},</if>
<if test="aTFile != null and aTFile !='' ">#{aTFile,typeHandler=org.apache.ibatis.type.BlobTypeHandler},</if>
'OER',
0
</trim>
)
</insert>
</mapper>

View File

@ -1,37 +1,37 @@
package com.hzya.frame.grpU8.nxproof.attachment.service;/*
* @Description
* @Author xiangerlin
@Date 2022-10-26 11:19
*/
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.grpU8.nxproof.attachment.entity.AttachmentFileEntity;
import java.util.List;
public interface IAttachmentFileService {
/**
* 保存附件
* @param entity
*/
void saveAttachment(AttachmentFileEntity entity);
List<AttachmentFileEntity> queryFile(AttachmentFileEntity entity)throws Exception;
/**
* 调用http接口查询单据附件
* @param billCode
* @return
* @throws Exception
*/
List<JSONObject> queryFileByCode(String billCode)throws Exception;
/**
* 附件上传
* @param fileList
* @param mlid
* @param kjnd
*/
void uploadAttachment(List<JSONObject> fileList,String mlid,String kjnd);
}
package com.hzya.frame.grpU8.nxproof.attachment.service;/*
* @Description
* @Author xiangerlin
@Date 2022-10-26 11:19
*/
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.grpU8.nxproof.attachment.entity.AttachmentFileEntity;
import java.util.List;
public interface IAttachmentFileService {
/**
* 保存附件
* @param entity
*/
void saveAttachment(AttachmentFileEntity entity);
List<AttachmentFileEntity> queryFile(AttachmentFileEntity entity)throws Exception;
/**
* 调用http接口查询单据附件
* @param billCode
* @return
* @throws Exception
*/
List<JSONObject> queryFileByCode(String billCode)throws Exception;
/**
* 附件上传
* @param fileList
* @param mlid
* @param kjnd
*/
void uploadAttachment(List<JSONObject> fileList,String mlid,String kjnd);
}

View File

@ -1,229 +1,229 @@
package com.hzya.frame.grpU8.nxproof.attachment.service.impl;/*
* @Description
* @Author xiangerlin
@Date 2022-10-26 11:20
*/
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.grpU8.nxproof.attachment.dao.IAttachmentFileDao;
import com.hzya.frame.grpU8.nxproof.attachment.entity.AttachmentFileEntity;
import com.hzya.frame.grpU8.nxproof.attachment.service.IAttachmentFileService;
import com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity;
import com.hzya.frame.grpU8.nxproof.oerannex.service.IOerAnnexService;
import com.hzya.frame.grpU8.nxproof.oerdjml.dto.FileInfoDTO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.*;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@Service
public class AttachmentFileServiceImpl extends BaseService<AttachmentFileEntity,String> implements IAttachmentFileService {
Logger logger = LogManager.getLogger(getClass());
protected IAttachmentFileDao attachmentFileDao;
@Autowired
public void setBillLogDao(IAttachmentFileDao dao) {
this.attachmentFileDao = dao;
this.dao=dao;
}
@Autowired
private IOerAnnexService oerAnnexService;
/**
* 保存附件
* @param entity
*/
@Override
public void saveAttachment(AttachmentFileEntity entity) {
entity.setaTGuid("A1:"+IdUtil.fastUUID());
String date = DateUtil.format(new Date(), "yyyyMMdd HH:mm:ss");
entity.setCreateDate(date);
entity.setUpdateDate(date);
String fileName = entity.getaTFileName();
if (StrUtil.isNotEmpty(fileName)){
int index = fileName.lastIndexOf(".");
if (index > 0){
String suffix = fileName.substring(index);
entity.setaTExtName(suffix);
String prefix = fileName.substring(0,index);
entity.setaTFileName(prefix);
}
}
attachmentFileDao.save("AttachmentFileEntity_insert",entity);
}
@Override
public List<AttachmentFileEntity> queryFile(AttachmentFileEntity entity) throws Exception {
List<AttachmentFileEntity> list = attachmentFileDao.query(entity);
return list;
}
/**
* 调用http接口查询单据附件
*
* @param billCode 单据号
* @return
* @throws Exception
*/
@Override
public List<JSONObject> queryFileByCode(String billCode) throws Exception {
List<JSONObject> list = new ArrayList<>();
if (StrUtil.isNotEmpty(billCode)){
JSONObject params = new JSONObject();
params.put("billNo",billCode);
String res = HttpRequest.post("/grp/af/findFilesBB").body(params.toString()).execute().body();
logger.info("根据单号:{},查询到到附件列表为:{}",billCode,res);
if (StrUtil.isNotEmpty(res)){
JSONObject resJson = JSONObject.parseObject(res);
int pageCount = resJson.getIntValue("pageCount");
boolean success = resJson.getBoolean("success");
if (success){
String dataStr = resJson.getString("data");
list = JSONObject.parseArray(dataStr,JSONObject.class);
if (null != list && list.size() >0){
for (JSONObject jsonObject : list) {
String fileName = jsonObject.getString("fileName");
if (StrUtil.isNotEmpty(fileName)){
// 使用indexOf找到"."的位置
int dotIndex = fileName.lastIndexOf('.');
// 确保找到了"."防止indexOf返回-1的情况
if (dotIndex != -1){
String ext_name = fileName.substring(dotIndex);
jsonObject.put("Ext",ext_name);
}
}
}
}
}
}
}
return list;
}
/**
* 附件上传
*
* @param fileList
* @param mlid
* @param kjnd
*/
@Override
public void uploadAttachment(List<JSONObject> fileList, String mlid, String kjnd) {
if (CollectionUtils.isNotEmpty(fileList) && StrUtil.isNotEmpty(mlid) && StrUtil.isNotEmpty(kjnd)){
try {
//附件下载
List<FileInfoDTO> fileInfoList = fileDownload(fileList);
//附件保存到grp库里
if (CollectionUtils.isNotEmpty(fileInfoList)){
//保存前先删一下历史附件
OerAnnexEntity delete = new OerAnnexEntity();
//delete.setGsdm(Constant.CONFIGMAP.get("gsdm"));
delete.setKjnd(kjnd);
delete.setMlid(mlid);
//oerAnnexService.deleteAnnex(delete);
int no = 1;
for (FileInfoDTO fileInfo : fileInfoList) {
try {
AttachmentFileEntity fileEntity = new AttachmentFileEntity();
String fileName = URLDecoder.decode(fileInfo.getFile_name(), "UTF-8");
fileEntity.setaTFileName(fileName);
fileEntity.setaTFile(fileInfo.getData());
this.saveAttachment(fileEntity);
//保存附件关系
OerAnnexEntity annexEntity = new OerAnnexEntity();
annexEntity.setMlid(mlid);
annexEntity.setKjnd(kjnd);
annexEntity.setAnnexName(fileName);
annexEntity.setAnnexSize(Convert.toLong(fileInfo.getFile_size()));
annexEntity.setOnlyid(fileEntity.getaTGuid());
annexEntity.setXh(String.valueOf(no));
oerAnnexService.saveAnnex(annexEntity);
no++;
}catch (Exception e){
logger.error("保存附件到grp出错:{}",e);
}
}
}
}catch (Exception e){
logger.error("保存附件到grp出错:{}",e);
}
}
}
private List<FileInfoDTO> fileDownload(List<JSONObject> fileList){
String dir = "1";
List<FileInfoDTO> files = new ArrayList<>();
//1下载附件
for (JSONObject fileObj : fileList) {
try {
FileInfoDTO fileInfoDTO = new FileInfoDTO();
String url = fileObj.getString("url");
String fileName = URLDecoder.decode(fileObj.getString("fileName"));
File file = HttpUtil.downloadFileFromUrl(url, dir);
if (null != file){
String zipPath = dir + File.separator + fileName.split("\\.")[0] + ".zip";
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipPath), Charset.forName("GBK"));
writeZipFile(file, zos,fileName);
zos.close();
// 获取压缩文件的字节数组
File zipFile = new File(zipPath);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream((int) zipFile.length());
BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(zipFile));
int buf_size = 1024;
byte[] buffer = new byte[buf_size];
int len = 0;
while (-1 != (len = bufferedInputStream.read(buffer, 0, buf_size))) {
byteArrayOutputStream.write(buffer, 0, len);
}
byte[] fileByte = byteArrayOutputStream.toByteArray();
fileInfoDTO.setData(fileByte);
fileInfoDTO.setFile_size(fileObj.getString("size"));
fileInfoDTO.setFile_name(fileName);
files.add(fileInfoDTO);
}
}catch (Exception e){
logger.error("上传附件出错:{}",e);
}
}
return files;
}
private void writeZipFile(File file,ZipOutputStream zos,String fileName){
if (null != file && null !=zos){
try {
logger.info("=====压缩文件=====");
zos.putNextEntry(new ZipEntry(fileName));
FileInputStream fos = new FileInputStream(file);
BufferedInputStream bis = new BufferedInputStream(fos);
int len;
byte[] buf = new byte[1024];
while ((len = bis.read(buf, 0, 1024)) != -1) {
zos.write(buf, 0, len);
}
bis.close();
fos.close();
logger.info("=====压缩完成=====");
}catch (Exception e){
e.printStackTrace();
logger.error("=====压缩文件出错=====");
}
}
}
}
package com.hzya.frame.grpU8.nxproof.attachment.service.impl;/*
* @Description
* @Author xiangerlin
@Date 2022-10-26 11:20
*/
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.grpU8.nxproof.attachment.dao.IAttachmentFileDao;
import com.hzya.frame.grpU8.nxproof.attachment.entity.AttachmentFileEntity;
import com.hzya.frame.grpU8.nxproof.attachment.service.IAttachmentFileService;
import com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity;
import com.hzya.frame.grpU8.nxproof.oerannex.service.IOerAnnexService;
import com.hzya.frame.grpU8.nxproof.oerdjml.dto.FileInfoDTO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.*;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@Service
public class AttachmentFileServiceImpl extends BaseService<AttachmentFileEntity,String> implements IAttachmentFileService {
Logger logger = LogManager.getLogger(getClass());
protected IAttachmentFileDao attachmentFileDao;
@Autowired
public void setBillLogDao(IAttachmentFileDao dao) {
this.attachmentFileDao = dao;
this.dao=dao;
}
@Autowired
private IOerAnnexService oerAnnexService;
/**
* 保存附件
* @param entity
*/
@Override
public void saveAttachment(AttachmentFileEntity entity) {
entity.setaTGuid("A1:"+IdUtil.fastUUID());
String date = DateUtil.format(new Date(), "yyyyMMdd HH:mm:ss");
entity.setCreateDate(date);
entity.setUpdateDate(date);
String fileName = entity.getaTFileName();
if (StrUtil.isNotEmpty(fileName)){
int index = fileName.lastIndexOf(".");
if (index > 0){
String suffix = fileName.substring(index);
entity.setaTExtName(suffix);
String prefix = fileName.substring(0,index);
entity.setaTFileName(prefix);
}
}
attachmentFileDao.save("AttachmentFileEntity_insert",entity);
}
@Override
public List<AttachmentFileEntity> queryFile(AttachmentFileEntity entity) throws Exception {
List<AttachmentFileEntity> list = attachmentFileDao.query(entity);
return list;
}
/**
* 调用http接口查询单据附件
*
* @param billCode 单据号
* @return
* @throws Exception
*/
@Override
public List<JSONObject> queryFileByCode(String billCode) throws Exception {
List<JSONObject> list = new ArrayList<>();
if (StrUtil.isNotEmpty(billCode)){
JSONObject params = new JSONObject();
params.put("billNo",billCode);
String res = HttpRequest.post("/grp/af/findFilesBB").body(params.toString()).execute().body();
logger.info("根据单号:{},查询到到附件列表为:{}",billCode,res);
if (StrUtil.isNotEmpty(res)){
JSONObject resJson = JSONObject.parseObject(res);
int pageCount = resJson.getIntValue("pageCount");
boolean success = resJson.getBoolean("success");
if (success){
String dataStr = resJson.getString("data");
list = JSONObject.parseArray(dataStr,JSONObject.class);
if (null != list && list.size() >0){
for (JSONObject jsonObject : list) {
String fileName = jsonObject.getString("fileName");
if (StrUtil.isNotEmpty(fileName)){
// 使用indexOf找到"."的位置
int dotIndex = fileName.lastIndexOf('.');
// 确保找到了"."防止indexOf返回-1的情况
if (dotIndex != -1){
String ext_name = fileName.substring(dotIndex);
jsonObject.put("Ext",ext_name);
}
}
}
}
}
}
}
return list;
}
/**
* 附件上传
*
* @param fileList
* @param mlid
* @param kjnd
*/
@Override
public void uploadAttachment(List<JSONObject> fileList, String mlid, String kjnd) {
if (CollectionUtils.isNotEmpty(fileList) && StrUtil.isNotEmpty(mlid) && StrUtil.isNotEmpty(kjnd)){
try {
//附件下载
List<FileInfoDTO> fileInfoList = fileDownload(fileList);
//附件保存到grp库里
if (CollectionUtils.isNotEmpty(fileInfoList)){
//保存前先删一下历史附件
OerAnnexEntity delete = new OerAnnexEntity();
//delete.setGsdm(Constant.CONFIGMAP.get("gsdm"));
delete.setKjnd(kjnd);
delete.setMlid(mlid);
//oerAnnexService.deleteAnnex(delete);
int no = 1;
for (FileInfoDTO fileInfo : fileInfoList) {
try {
AttachmentFileEntity fileEntity = new AttachmentFileEntity();
String fileName = URLDecoder.decode(fileInfo.getFile_name(), "UTF-8");
fileEntity.setaTFileName(fileName);
fileEntity.setaTFile(fileInfo.getData());
this.saveAttachment(fileEntity);
//保存附件关系
OerAnnexEntity annexEntity = new OerAnnexEntity();
annexEntity.setMlid(mlid);
annexEntity.setKjnd(kjnd);
annexEntity.setAnnexName(fileName);
annexEntity.setAnnexSize(Convert.toLong(fileInfo.getFile_size()));
annexEntity.setOnlyid(fileEntity.getaTGuid());
annexEntity.setXh(String.valueOf(no));
oerAnnexService.saveAnnex(annexEntity);
no++;
}catch (Exception e){
logger.error("保存附件到grp出错:{}",e);
}
}
}
}catch (Exception e){
logger.error("保存附件到grp出错:{}",e);
}
}
}
private List<FileInfoDTO> fileDownload(List<JSONObject> fileList){
String dir = "1";
List<FileInfoDTO> files = new ArrayList<>();
//1下载附件
for (JSONObject fileObj : fileList) {
try {
FileInfoDTO fileInfoDTO = new FileInfoDTO();
String url = fileObj.getString("url");
String fileName = URLDecoder.decode(fileObj.getString("fileName"));
File file = HttpUtil.downloadFileFromUrl(url, dir);
if (null != file){
String zipPath = dir + File.separator + fileName.split("\\.")[0] + ".zip";
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipPath), Charset.forName("GBK"));
writeZipFile(file, zos,fileName);
zos.close();
// 获取压缩文件的字节数组
File zipFile = new File(zipPath);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream((int) zipFile.length());
BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(zipFile));
int buf_size = 1024;
byte[] buffer = new byte[buf_size];
int len = 0;
while (-1 != (len = bufferedInputStream.read(buffer, 0, buf_size))) {
byteArrayOutputStream.write(buffer, 0, len);
}
byte[] fileByte = byteArrayOutputStream.toByteArray();
fileInfoDTO.setData(fileByte);
fileInfoDTO.setFile_size(fileObj.getString("size"));
fileInfoDTO.setFile_name(fileName);
files.add(fileInfoDTO);
}
}catch (Exception e){
logger.error("上传附件出错:{}",e);
}
}
return files;
}
private void writeZipFile(File file,ZipOutputStream zos,String fileName){
if (null != file && null !=zos){
try {
logger.info("=====压缩文件=====");
zos.putNextEntry(new ZipEntry(fileName));
FileInputStream fos = new FileInputStream(file);
BufferedInputStream bis = new BufferedInputStream(fos);
int len;
byte[] buf = new byte[1024];
while ((len = bis.read(buf, 0, 1024)) != -1) {
zos.write(buf, 0, len);
}
bis.close();
fos.close();
logger.info("=====压缩完成=====");
}catch (Exception e){
e.printStackTrace();
logger.error("=====压缩文件出错=====");
}
}
}
}

View File

@ -1,17 +1,17 @@
package com.hzya.frame.grpU8.nxproof.oerannex.dao;/*
* @Description 附件关系表
* @Author xiangerlin
@Date 2022-10-26 10:04
*/
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity;
public interface IOerAnnexDao extends IBaseDao<OerAnnexEntity, String> {
Integer deleteAnnex(OerAnnexEntity delete);
OerAnnexEntity queryMaxId(OerAnnexEntity entity);
Integer saveData(OerAnnexEntity annexEntity);
}
package com.hzya.frame.grpU8.nxproof.oerannex.dao;/*
* @Description 附件关系表
* @Author xiangerlin
@Date 2022-10-26 10:04
*/
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity;
public interface IOerAnnexDao extends IBaseDao<OerAnnexEntity, String> {
Integer deleteAnnex(OerAnnexEntity delete);
OerAnnexEntity queryMaxId(OerAnnexEntity entity);
Integer saveData(OerAnnexEntity annexEntity);
}

View File

@ -1,40 +1,40 @@
package com.hzya.frame.grpU8.nxproof.oerannex.dao.impl;/*
* @Description 附件关系表
* @Author xiangerlin
@Date 2022-10-26 10:05
*/
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.grpU8.nxproof.oerannex.dao.IOerAnnexDao;
import com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity;
import com.hzya.frame.grpU8.nxproof.oerdjml.entity.OerDjmlEntity;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class OerAnnexDaoImpl extends MybatisGenericDao<OerAnnexEntity, String> implements IOerAnnexDao {
@DS("#entity.dataSourceCode")
@Override
public Integer deleteAnnex(OerAnnexEntity entity) {
Integer o = super.delete( "com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity.OerAnnexEntity_delete", entity);
return o;
}
@DS("#entity.dataSourceCode")
@Override
public OerAnnexEntity queryMaxId(OerAnnexEntity entity) {
OerAnnexEntity o = super.query(entity,"com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity.OerAnnexEntity_max_id");
return o;
}
@DS("#entity.dataSourceCode")
@Override
public Integer saveData(OerAnnexEntity entity) {
Integer o = super.insert("com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity.OerAnnexEntity_insert",entity);
return o;
}
}
package com.hzya.frame.grpU8.nxproof.oerannex.dao.impl;/*
* @Description 附件关系表
* @Author xiangerlin
@Date 2022-10-26 10:05
*/
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.grpU8.nxproof.oerannex.dao.IOerAnnexDao;
import com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity;
import com.hzya.frame.grpU8.nxproof.oerdjml.entity.OerDjmlEntity;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class OerAnnexDaoImpl extends MybatisGenericDao<OerAnnexEntity, String> implements IOerAnnexDao {
@DS("#entity.dataSourceCode")
@Override
public Integer deleteAnnex(OerAnnexEntity entity) {
Integer o = super.delete( "com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity.OerAnnexEntity_delete", entity);
return o;
}
@DS("#entity.dataSourceCode")
@Override
public OerAnnexEntity queryMaxId(OerAnnexEntity entity) {
OerAnnexEntity o = super.query(entity,"com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity.OerAnnexEntity_max_id");
return o;
}
@DS("#entity.dataSourceCode")
@Override
public Integer saveData(OerAnnexEntity entity) {
Integer o = super.insert("com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity.OerAnnexEntity_insert",entity);
return o;
}
}

View File

@ -1,149 +1,149 @@
package com.hzya.frame.grpU8.nxproof.oerannex.entity;
import com.hzya.frame.web.entity.BaseEntity;
/*
* @Description 附件关系表
* @Author xiangerlin
@Date 2022-10-26 8:44
*/
public class OerAnnexEntity extends BaseEntity {
private String annexid; //主键id
private String mlid;//报销单id
private String gsdm;//公司代码 默认001
private String kjnd;//会计年度
private String bnxid;// 不知道是什么 填0
private String xh;//序号
private String onlyid;// AT_AttachmentFile 表的主键ATGuid
private String annexName;//附件名
private Long annexSize;//附件大小
private String showSize;//附件大小显示值
private String ole;// 不知道是什么填空
private String fjType;//附件类型 数据库中只有 其他其他其他(&Z)合同3种类型
private String fpid;//不知道是什么 填空
private String maxAnnexid;//最大id
private String aTextName;//后缀名
public String getAnnexid() {
return annexid;
}
public void setAnnexid(String annexid) {
this.annexid = annexid;
}
public String getMlid() {
return mlid;
}
public void setMlid(String mlid) {
this.mlid = mlid;
}
public String getGsdm() {
return gsdm;
}
public void setGsdm(String gsdm) {
this.gsdm = gsdm;
}
public String getKjnd() {
return kjnd;
}
public void setKjnd(String kjnd) {
this.kjnd = kjnd;
}
public String getBnxid() {
return bnxid;
}
public void setBnxid(String bnxid) {
this.bnxid = bnxid;
}
public String getXh() {
return xh;
}
public void setXh(String xh) {
this.xh = xh;
}
public String getOnlyid() {
return onlyid;
}
public void setOnlyid(String onlyid) {
this.onlyid = onlyid;
}
public String getAnnexName() {
return annexName;
}
public void setAnnexName(String annexName) {
this.annexName = annexName;
}
public Long getAnnexSize() {
return annexSize;
}
public void setAnnexSize(Long annexSize) {
this.annexSize = annexSize;
}
public String getShowSize() {
return showSize;
}
public void setShowSize(String showSize) {
this.showSize = showSize;
}
public String getOle() {
return ole;
}
public void setOle(String ole) {
this.ole = ole;
}
public String getFjType() {
return fjType;
}
public void setFjType(String fjType) {
this.fjType = fjType;
}
public String getFpid() {
return fpid;
}
public void setFpid(String fpid) {
this.fpid = fpid;
}
public String getMaxAnnexid() {
return maxAnnexid;
}
public void setMaxAnnexid(String maxAnnexid) {
this.maxAnnexid = maxAnnexid;
}
public String getaTextName() {
return aTextName;
}
public void setaTextName(String aTextName) {
this.aTextName = aTextName;
}
}
package com.hzya.frame.grpU8.nxproof.oerannex.entity;
import com.hzya.frame.web.entity.BaseEntity;
/*
* @Description 附件关系表
* @Author xiangerlin
@Date 2022-10-26 8:44
*/
public class OerAnnexEntity extends BaseEntity {
private String annexid; //主键id
private String mlid;//报销单id
private String gsdm;//公司代码 默认001
private String kjnd;//会计年度
private String bnxid;// 不知道是什么 填0
private String xh;//序号
private String onlyid;// AT_AttachmentFile 表的主键ATGuid
private String annexName;//附件名
private Long annexSize;//附件大小
private String showSize;//附件大小显示值
private String ole;// 不知道是什么填空
private String fjType;//附件类型 数据库中只有 其他其他其他(&Z)合同3种类型
private String fpid;//不知道是什么 填空
private String maxAnnexid;//最大id
private String aTextName;//后缀名
public String getAnnexid() {
return annexid;
}
public void setAnnexid(String annexid) {
this.annexid = annexid;
}
public String getMlid() {
return mlid;
}
public void setMlid(String mlid) {
this.mlid = mlid;
}
public String getGsdm() {
return gsdm;
}
public void setGsdm(String gsdm) {
this.gsdm = gsdm;
}
public String getKjnd() {
return kjnd;
}
public void setKjnd(String kjnd) {
this.kjnd = kjnd;
}
public String getBnxid() {
return bnxid;
}
public void setBnxid(String bnxid) {
this.bnxid = bnxid;
}
public String getXh() {
return xh;
}
public void setXh(String xh) {
this.xh = xh;
}
public String getOnlyid() {
return onlyid;
}
public void setOnlyid(String onlyid) {
this.onlyid = onlyid;
}
public String getAnnexName() {
return annexName;
}
public void setAnnexName(String annexName) {
this.annexName = annexName;
}
public Long getAnnexSize() {
return annexSize;
}
public void setAnnexSize(Long annexSize) {
this.annexSize = annexSize;
}
public String getShowSize() {
return showSize;
}
public void setShowSize(String showSize) {
this.showSize = showSize;
}
public String getOle() {
return ole;
}
public void setOle(String ole) {
this.ole = ole;
}
public String getFjType() {
return fjType;
}
public void setFjType(String fjType) {
this.fjType = fjType;
}
public String getFpid() {
return fpid;
}
public void setFpid(String fpid) {
this.fpid = fpid;
}
public String getMaxAnnexid() {
return maxAnnexid;
}
public void setMaxAnnexid(String maxAnnexid) {
this.maxAnnexid = maxAnnexid;
}
public String getaTextName() {
return aTextName;
}
public void setaTextName(String aTextName) {
this.aTextName = aTextName;
}
}

View File

@ -1,125 +1,125 @@
<?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.grpU8.nxproof.oerannex.entity.OerAnnexEntity">
<resultMap id="get-OerAnnexEntity-result" type="com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity">
<result property="annexid" column="annexid" />
<result property="mlid" column="mlid" />
<result property="gsdm" column="gsdm" />
<result property="kjnd" column="kjnd" />
<result property="bnxid" column="bnxid" />
<result property="xh" column="xh" />
<result property="onlyid" column="onlyid" />
<result property="annexName" column="annexName" />
<result property="annexSize" column="annexSize" />
<result property="showSize" column="showSize" />
<result property="ole" column="ole" />
<result property="fjType" column="fjType" />
<result property="fpid" column="fpid" />
<result property="maxAnnexid" column="maxAnnexid" />
<result property="aTextName" column="aTextName" />
</resultMap>
<sql id="OerAnnexEntity_Base_Column_List">
AnnexID,
MLID,
GSDM,
KJND,
BNXID,
XH,
OnlyID,
AnnexName,
AnnexSize,
ShowSize,
OLE,
FJType,
FPID
</sql>
<!-- 查询 采用==查询 -->
<select id="OerAnnexEntity_list_base" resultMap="get-OerAnnexEntity-result" parameterType="com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity">
select
<include refid="OerAnnexEntity_Base_Column_List" />
FROM
OER_ANNEX
<trim prefix="where" prefixOverrides="and">
<if test="mlid != null and mlid !='' "> MLID = #{mlid} </if>
<if test="kjnd != null and kjnd !='' ">and KJND = #{kjnd} </if>
<if test="gsdm != null and gsdm !='' ">and gsdm = #{gsdm} </if>
</trim>
</select>
<!-- 查询 采用==查询 联查附件表 -->
<select id="OerAnnexEntity_list_base_join_attachment" resultMap="get-OerAnnexEntity-result" parameterType="com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity">
select
OER_ANNEX.AnnexID,
OER_ANNEX.mlid,
OER_ANNEX.OnlyID,
OER_ANNEX.AnnexName,
OER_ANNEX.AnnexSize,
AT_AttachmentFile.AtextName
FROM
OER_ANNEX
LEFT JOIN AT_AttachmentFile ON AT_AttachmentFile.ATGuid = OER_ANNEX.OnlyID
<trim prefix="where" prefixOverrides="and">
<if test="mlid != null and mlid !='' "> MLID = #{mlid} </if>
<if test="kjnd != null and kjnd !='' ">and KJND = #{kjnd} </if>
<if test="gsdm != null and gsdm !='' ">and gsdm = #{gsdm} </if>
</trim>
</select>
<!--查询最大id-->
<select id="OerAnnexEntity_max_id" resultMap="get-OerAnnexEntity-result" parameterType="com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity">
SELECT
MAX(AnnexID) as maxAnnexid
FROM
OER_ANNEX
<trim prefix="where" prefixOverrides="and">
<if test="kjnd != null and kjnd !='' "> KJND = #{kjnd} </if>
<if test="gsdm != null and gsdm !='' ">and GSDM = #{gsdm} </if>
</trim>
</select>
<insert id="OerAnnexEntity_insert" parameterType="com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity">
insert into OER_ANNEX(
<trim suffix="" suffixOverrides=",">
<if test="annexid != null and annexid !='' ">AnnexID,</if>
<if test="mlid != null and mlid !='' "> MLID, </if>
<if test="gsdm != null and gsdm !='' "> gsdm, </if>
<if test="kjnd != null and kjnd !='' "> kjnd ,</if>
<if test="xh != null and xh !='' ">xh,</if>
<if test="onlyid != null and onlyid !='' ">onlyid,</if>
<if test="annexName != null and annexName !='' ">annexName,</if>
<if test="annexSize != null and annexSize !='' ">annexSize,</if>
<if test="showSize != null and showSize !='' ">showSize,</if>
<if test="fjType != null and fjType !='' ">fjType,</if>
bnxid,
ole,
fpid
</trim>
)values
(
<trim suffix="" suffixOverrides=",">
<if test="annexid != null and annexid !='' ">#{annexid},</if>
<if test="mlid != null and mlid !='' "> #{mlid}, </if>
<if test="gsdm != null and gsdm !='' "> #{gsdm}, </if>
<if test="kjnd != null and kjnd !='' "> #{kjnd} ,</if>
<if test="xh != null and xh !='' ">#{xh},</if>
<if test="onlyid != null and onlyid !='' ">#{onlyid},</if>
<if test="annexName != null and annexName !='' ">#{annexName},</if>
<if test="annexSize != null and annexSize !='' ">#{annexSize},</if>
<if test="showSize != null and showSize !='' ">#{showSize},</if>
<if test="fjType != null and fjType !='' ">#{fjType},</if>
0,
null,
''
</trim>
)
</insert>
<!-- 删除附件 -->
<delete id="OerAnnexEntity_delete" parameterType="com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity">
delete from OER_ANNEX where mlid = #{mlid} and kjnd = #{kjnd} and gsdm = #{gsdm}
</delete>
</mapper>
<?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.grpU8.nxproof.oerannex.entity.OerAnnexEntity">
<resultMap id="get-OerAnnexEntity-result" type="com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity">
<result property="annexid" column="annexid" />
<result property="mlid" column="mlid" />
<result property="gsdm" column="gsdm" />
<result property="kjnd" column="kjnd" />
<result property="bnxid" column="bnxid" />
<result property="xh" column="xh" />
<result property="onlyid" column="onlyid" />
<result property="annexName" column="annexName" />
<result property="annexSize" column="annexSize" />
<result property="showSize" column="showSize" />
<result property="ole" column="ole" />
<result property="fjType" column="fjType" />
<result property="fpid" column="fpid" />
<result property="maxAnnexid" column="maxAnnexid" />
<result property="aTextName" column="aTextName" />
</resultMap>
<sql id="OerAnnexEntity_Base_Column_List">
AnnexID,
MLID,
GSDM,
KJND,
BNXID,
XH,
OnlyID,
AnnexName,
AnnexSize,
ShowSize,
OLE,
FJType,
FPID
</sql>
<!-- 查询 采用==查询 -->
<select id="OerAnnexEntity_list_base" resultMap="get-OerAnnexEntity-result" parameterType="com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity">
select
<include refid="OerAnnexEntity_Base_Column_List" />
FROM
OER_ANNEX
<trim prefix="where" prefixOverrides="and">
<if test="mlid != null and mlid !='' "> MLID = #{mlid} </if>
<if test="kjnd != null and kjnd !='' ">and KJND = #{kjnd} </if>
<if test="gsdm != null and gsdm !='' ">and gsdm = #{gsdm} </if>
</trim>
</select>
<!-- 查询 采用==查询 联查附件表 -->
<select id="OerAnnexEntity_list_base_join_attachment" resultMap="get-OerAnnexEntity-result" parameterType="com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity">
select
OER_ANNEX.AnnexID,
OER_ANNEX.mlid,
OER_ANNEX.OnlyID,
OER_ANNEX.AnnexName,
OER_ANNEX.AnnexSize,
AT_AttachmentFile.AtextName
FROM
OER_ANNEX
LEFT JOIN AT_AttachmentFile ON AT_AttachmentFile.ATGuid = OER_ANNEX.OnlyID
<trim prefix="where" prefixOverrides="and">
<if test="mlid != null and mlid !='' "> MLID = #{mlid} </if>
<if test="kjnd != null and kjnd !='' ">and KJND = #{kjnd} </if>
<if test="gsdm != null and gsdm !='' ">and gsdm = #{gsdm} </if>
</trim>
</select>
<!--查询最大id-->
<select id="OerAnnexEntity_max_id" resultMap="get-OerAnnexEntity-result" parameterType="com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity">
SELECT
MAX(AnnexID) as maxAnnexid
FROM
OER_ANNEX
<trim prefix="where" prefixOverrides="and">
<if test="kjnd != null and kjnd !='' "> KJND = #{kjnd} </if>
<if test="gsdm != null and gsdm !='' ">and GSDM = #{gsdm} </if>
</trim>
</select>
<insert id="OerAnnexEntity_insert" parameterType="com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity">
insert into OER_ANNEX(
<trim suffix="" suffixOverrides=",">
<if test="annexid != null and annexid !='' ">AnnexID,</if>
<if test="mlid != null and mlid !='' "> MLID, </if>
<if test="gsdm != null and gsdm !='' "> gsdm, </if>
<if test="kjnd != null and kjnd !='' "> kjnd ,</if>
<if test="xh != null and xh !='' ">xh,</if>
<if test="onlyid != null and onlyid !='' ">onlyid,</if>
<if test="annexName != null and annexName !='' ">annexName,</if>
<if test="annexSize != null and annexSize !='' ">annexSize,</if>
<if test="showSize != null and showSize !='' ">showSize,</if>
<if test="fjType != null and fjType !='' ">fjType,</if>
bnxid,
ole,
fpid
</trim>
)values
(
<trim suffix="" suffixOverrides=",">
<if test="annexid != null and annexid !='' ">#{annexid},</if>
<if test="mlid != null and mlid !='' "> #{mlid}, </if>
<if test="gsdm != null and gsdm !='' "> #{gsdm}, </if>
<if test="kjnd != null and kjnd !='' "> #{kjnd} ,</if>
<if test="xh != null and xh !='' ">#{xh},</if>
<if test="onlyid != null and onlyid !='' ">#{onlyid},</if>
<if test="annexName != null and annexName !='' ">#{annexName},</if>
<if test="annexSize != null and annexSize !='' ">#{annexSize},</if>
<if test="showSize != null and showSize !='' ">#{showSize},</if>
<if test="fjType != null and fjType !='' ">#{fjType},</if>
0,
null,
''
</trim>
)
</insert>
<!-- 删除附件 -->
<delete id="OerAnnexEntity_delete" parameterType="com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity">
delete from OER_ANNEX where mlid = #{mlid} and kjnd = #{kjnd} and gsdm = #{gsdm}
</delete>
</mapper>

View File

@ -1,132 +1,132 @@
package com.hzya.frame.grpU8.nxproof.oerannex.service.impl;/*
* @Description 附件关系表
* @Author xiangerlin
@Date 2022-10-26 10:07
*/
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.grpU8.nxproof.oerannex.dao.IOerAnnexDao;
import com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity;
import com.hzya.frame.grpU8.nxproof.oerannex.service.IOerAnnexService;
import com.hzya.frame.web.exception.BaseSystemException;
import org.apache.commons.collections.CollectionUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Service
public class OerAnnexServiceImpl extends BaseService<OerAnnexEntity,String> implements IOerAnnexService {
Logger logger = LogManager.getLogger(getClass());
protected IOerAnnexDao oerAnnexDao;
@Autowired
public void setBillLogDao(IOerAnnexDao dao) {
this.oerAnnexDao = dao;
this.dao=dao;
}
/**
* 查询附件关系
*
* @param entity
* @return
* @throws Exception
*/
@Override
public List<OerAnnexEntity> queryAnnex(OerAnnexEntity entity) throws Exception {
List<OerAnnexEntity> annexList = oerAnnexDao.query(entity);
return annexList;
}
/**
* 删除附件关系
*
* @param entity
* @throws Exception
*/
@Override
public void deleteAnnex(OerAnnexEntity entity){
if (null != entity && StrUtil.isNotEmpty(entity.getMlid()) && StrUtil.isNotEmpty(entity.getKjnd())){
oerAnnexDao.delete("OerAnnexEntity_delete",entity);
}
}
/**
* 查询最大id
* @param entity
* @return
* @throws Exception
*/
@Override
public String queryMaxId(OerAnnexEntity entity) throws Exception {
if (null == entity){
entity = new OerAnnexEntity();
}
if (StrUtil.isEmpty(entity.getKjnd())){
entity.setKjnd(String.valueOf(DateUtil.year(new Date())));
}
OerAnnexEntity max = oerAnnexDao.query(entity,"OerAnnexEntity_max_id");
if (null != max){
Long max_value = Long.valueOf(max.getMaxAnnexid());
return String.valueOf(max_value+1);
}
return null;
}
/**
* 保存附件关系
* @param entity
* @throws Exception
*/
@Override
public void saveAnnex(OerAnnexEntity entity) throws Exception {
if (null == entity){
throw new BaseSystemException("参数不能为空");
}
//entity.setAcc_name(Constant.CONFIGMAP.get("file_acc_name"));
entity.setAnnexid(queryMaxId(entity));
if (null != entity.getAnnexSize()){
int fileSize = entity.getAnnexSize().intValue();
String showSize = "";
if (fileSize < 1000) {
showSize = fileSize + "b";
} else if (1000 < fileSize && fileSize < 1000000) {
showSize = (fileSize / 1000) + " KB";
} else {
showSize = (fileSize / 1000000) + " MB";
}
entity.setShowSize(showSize);
}
/* if (!entity.getAnnexName().contains("合同")) {
entity.setFjType("其它");
}else {
entity.setFjType("合同");
}*/
entity.setFjType("其它");
oerAnnexDao.save(entity);
}
/**
* 查询附件关系联查附件对象表
*
* @param mlid
* @return
* @throws Exception
*/
@Override
public List<OerAnnexEntity> queryAnnexAndFile(String mlid) throws Exception {
OerAnnexEntity entity = new OerAnnexEntity();
entity.setMlid(mlid);
List<OerAnnexEntity> oerAnnexList = oerAnnexDao.queryList(entity, "OerAnnexEntity_list_base_join_attachment");
return oerAnnexList;
}
}
package com.hzya.frame.grpU8.nxproof.oerannex.service.impl;/*
* @Description 附件关系表
* @Author xiangerlin
@Date 2022-10-26 10:07
*/
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.grpU8.nxproof.oerannex.dao.IOerAnnexDao;
import com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity;
import com.hzya.frame.grpU8.nxproof.oerannex.service.IOerAnnexService;
import com.hzya.frame.web.exception.BaseSystemException;
import org.apache.commons.collections.CollectionUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Service
public class OerAnnexServiceImpl extends BaseService<OerAnnexEntity,String> implements IOerAnnexService {
Logger logger = LogManager.getLogger(getClass());
protected IOerAnnexDao oerAnnexDao;
@Autowired
public void setBillLogDao(IOerAnnexDao dao) {
this.oerAnnexDao = dao;
this.dao=dao;
}
/**
* 查询附件关系
*
* @param entity
* @return
* @throws Exception
*/
@Override
public List<OerAnnexEntity> queryAnnex(OerAnnexEntity entity) throws Exception {
List<OerAnnexEntity> annexList = oerAnnexDao.query(entity);
return annexList;
}
/**
* 删除附件关系
*
* @param entity
* @throws Exception
*/
@Override
public void deleteAnnex(OerAnnexEntity entity){
if (null != entity && StrUtil.isNotEmpty(entity.getMlid()) && StrUtil.isNotEmpty(entity.getKjnd())){
oerAnnexDao.delete("OerAnnexEntity_delete",entity);
}
}
/**
* 查询最大id
* @param entity
* @return
* @throws Exception
*/
@Override
public String queryMaxId(OerAnnexEntity entity) throws Exception {
if (null == entity){
entity = new OerAnnexEntity();
}
if (StrUtil.isEmpty(entity.getKjnd())){
entity.setKjnd(String.valueOf(DateUtil.year(new Date())));
}
OerAnnexEntity max = oerAnnexDao.query(entity,"OerAnnexEntity_max_id");
if (null != max){
Long max_value = Long.valueOf(max.getMaxAnnexid());
return String.valueOf(max_value+1);
}
return null;
}
/**
* 保存附件关系
* @param entity
* @throws Exception
*/
@Override
public void saveAnnex(OerAnnexEntity entity) throws Exception {
if (null == entity){
throw new BaseSystemException("参数不能为空");
}
//entity.setAcc_name(Constant.CONFIGMAP.get("file_acc_name"));
entity.setAnnexid(queryMaxId(entity));
if (null != entity.getAnnexSize()){
int fileSize = entity.getAnnexSize().intValue();
String showSize = "";
if (fileSize < 1000) {
showSize = fileSize + "b";
} else if (1000 < fileSize && fileSize < 1000000) {
showSize = (fileSize / 1000) + " KB";
} else {
showSize = (fileSize / 1000000) + " MB";
}
entity.setShowSize(showSize);
}
/* if (!entity.getAnnexName().contains("合同")) {
entity.setFjType("其它");
}else {
entity.setFjType("合同");
}*/
entity.setFjType("其它");
oerAnnexDao.save(entity);
}
/**
* 查询附件关系联查附件对象表
*
* @param mlid
* @return
* @throws Exception
*/
@Override
public List<OerAnnexEntity> queryAnnexAndFile(String mlid) throws Exception {
OerAnnexEntity entity = new OerAnnexEntity();
entity.setMlid(mlid);
List<OerAnnexEntity> oerAnnexList = oerAnnexDao.queryList(entity, "OerAnnexEntity_list_base_join_attachment");
return oerAnnexList;
}
}

Some files were not shown because too many files have changed in this diff Show More