Merge branch 'dev' of http://ufidahz.com.cn:9015/root/kangarooDataCenterV3 into dev
This commit is contained in:
commit
ac9205418d
|
@ -0,0 +1,12 @@
|
|||
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> {
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.hzya.frame.grpU8.nxproof.attachment.dao.impl;/*
|
||||
* @Description 附件
|
||||
* @Author xiangerlin
|
||||
@Date 2022-10-26 11:18
|
||||
*/
|
||||
|
||||
|
||||
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 org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class AttachmentFileDaoImpl extends MybatisGenericDao<AttachmentFileEntity, String> implements IAttachmentFileDao {
|
||||
}
|
|
@ -0,0 +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;
|
||||
}
|
||||
}
|
|
@ -0,0 +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>
|
|
@ -0,0 +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);
|
||||
}
|
|
@ -0,0 +1,232 @@
|
|||
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;
|
||||
@Autowired
|
||||
private IAttachmentFileService attachmentFileService;
|
||||
|
||||
/**
|
||||
* 保存附件
|
||||
* @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());
|
||||
attachmentFileService.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("=====压缩文件出错=====");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
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> {
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.hzya.frame.grpU8.nxproof.oerannex.dao.impl;/*
|
||||
* @Description 附件关系表
|
||||
* @Author xiangerlin
|
||||
@Date 2022-10-26 10:05
|
||||
*/
|
||||
|
||||
|
||||
|
||||
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 org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class OerAnnexDaoImpl extends MybatisGenericDao<OerAnnexEntity, String> implements IOerAnnexDao {
|
||||
}
|
|
@ -0,0 +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;
|
||||
}
|
||||
}
|
|
@ -0,0 +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>
|
|
@ -0,0 +1,51 @@
|
|||
package com.hzya.frame.grpU8.nxproof.oerannex.service;
|
||||
/*
|
||||
* @Description 附件关系表
|
||||
* @Author xiangerlin
|
||||
@Date 2022-10-26 10:06
|
||||
*/
|
||||
|
||||
|
||||
import com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IOerAnnexService {
|
||||
|
||||
/**
|
||||
* 查询附件关系
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
List<OerAnnexEntity> queryAnnex(OerAnnexEntity entity)throws Exception;
|
||||
/**
|
||||
* 查询最大id
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
String queryMaxId(OerAnnexEntity entity)throws Exception;
|
||||
|
||||
/**
|
||||
* 保存附件关系
|
||||
* @param entity
|
||||
* @throws Exception
|
||||
*/
|
||||
void saveAnnex(OerAnnexEntity entity)throws Exception;
|
||||
|
||||
/**
|
||||
* 删除附件关系
|
||||
* @param entity
|
||||
* @throws Exception
|
||||
*/
|
||||
void deleteAnnex(OerAnnexEntity entity)throws Exception;
|
||||
|
||||
/**
|
||||
* 查询附件关系,联查附件对象表
|
||||
* @param mlid
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
List<OerAnnexEntity> queryAnnexAndFile(String mlid)throws Exception;
|
||||
}
|
|
@ -0,0 +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) throws Exception {
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.hzya.frame.grpU8.nxproof.oerdjml.dto;
|
||||
|
||||
/**
|
||||
* @Description 附件对象
|
||||
* @Author xiangerlin
|
||||
* @Date 2024/8/16 10:28
|
||||
**/
|
||||
public class FileInfoDTO {
|
||||
private byte[] data;//附件压缩成zip后的数据
|
||||
private String file_name;//附件名字
|
||||
private String file_size;//附件大小
|
||||
|
||||
public byte[] getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(byte[] data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public String getFile_name() {
|
||||
return file_name;
|
||||
}
|
||||
|
||||
public void setFile_name(String file_name) {
|
||||
this.file_name = file_name;
|
||||
}
|
||||
|
||||
public String getFile_size() {
|
||||
return file_size;
|
||||
}
|
||||
|
||||
public void setFile_size(String file_size) {
|
||||
this.file_size = file_size;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.hzya.frame.grpU8.nxproof.oerdjml.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.hzya.frame.grpU8.nxproof.gbizbsyrec.entity.GbiZbsyrecEntity;
|
||||
import com.hzya.frame.grpU8.nxproof.oerdjjsfs.entity.OerDjjsfsEntity;
|
||||
import com.hzya.frame.grpU8.nxproof.oerdjnr.entity.OerDjnrEntity;
|
||||
|
@ -73,10 +74,14 @@ public class OerDjmlEntity extends BaseEntity {
|
|||
private String ssrid;
|
||||
//送审人
|
||||
private String ssr;
|
||||
private List<GbiZbsyrecEntity> gbiZbsyrecEntitylist;
|
||||
@JSONField(ordinal = 9996)
|
||||
private List<OerDjnrEntity> oerDjnrEntityList;
|
||||
@JSONField(ordinal = 9997)
|
||||
private List<OerYszbEntity> oerYszbEntityList;
|
||||
@JSONField(ordinal = 9998)
|
||||
private List<OerDjjsfsEntity> oerDjjsfsEntityList;
|
||||
@JSONField(ordinal = 9999)
|
||||
private List<GbiZbsyrecEntity> gbiZbsyrecEntitylist;
|
||||
|
||||
public String getMlId() {
|
||||
return mlId;
|
||||
|
|
|
@ -33,11 +33,4 @@ public interface IOerDjmlService {
|
|||
* @return java.lang.Object
|
||||
**/
|
||||
Object handleOerDjml(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
* 保存方法前,先调这个方法 组装参数
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
SysExtensionApiEntity saveExpensePre(SysExtensionApiEntity entity);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.hzya.frame.grpU8.nxproof.oerdjml.service.impl;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
@ -9,9 +10,11 @@ import com.alibaba.fastjson.JSONArray;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.grpU8.nxproof.gbizbsyrec.dao.IGbiZbsyrecDao;
|
||||
import com.hzya.frame.grpU8.nxproof.gbizbsyrec.entity.GbiZbsyrecEntity;
|
||||
import com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity;
|
||||
import com.hzya.frame.grpU8.nxproof.oerdjjsfs.dao.IOerDjjsfsDao;
|
||||
import com.hzya.frame.grpU8.nxproof.oerdjjsfs.entity.OerDjjsfsEntity;
|
||||
import com.hzya.frame.grpU8.nxproof.oerdjml.dao.IOerDjmlDao;
|
||||
import com.hzya.frame.grpU8.nxproof.oerdjml.dto.FileInfoDTO;
|
||||
import com.hzya.frame.grpU8.nxproof.oerdjml.entity.GbiZbsyrecAllEntity;
|
||||
import com.hzya.frame.grpU8.nxproof.oerdjml.entity.OerDjmlEntity;
|
||||
import com.hzya.frame.grpU8.nxproof.oerdjml.service.IOerDjmlService;
|
||||
|
@ -24,19 +27,28 @@ import com.hzya.frame.grpU8.nxproof.pubauditlog.entity.PubAuditLogEntity;
|
|||
import com.hzya.frame.grpU8.nxproof.pubobjflow.dao.IPubObjFlowDao;
|
||||
import com.hzya.frame.grpU8.nxproof.pubobjflow.entity.PubObjFlowEntity;
|
||||
import com.hzya.frame.mdm.entity.MdmDto;
|
||||
import com.hzya.frame.seeyon.entity.CollAttachmentResDTO;
|
||||
import com.hzya.frame.seeyon.enums.ColEventTypeEnum;
|
||||
import com.hzya.frame.seeyon.util.RestUtil;
|
||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
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.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* @Author:hecan
|
||||
|
@ -63,7 +75,10 @@ public class OerDjmlServiceImpl implements IOerDjmlService {
|
|||
private IPubAuditLogDao iPubAuditLogDao;
|
||||
@Autowired
|
||||
private IPubObjFlowDao iPubObjFlowDao;
|
||||
|
||||
@Autowired
|
||||
private RestUtil restUtil;
|
||||
@Value("${savefile.path}")
|
||||
public String DSK;
|
||||
@Override
|
||||
public String saveExpenseDocuments(JSONObject jsonObject) {
|
||||
|
||||
|
@ -815,196 +830,6 @@ public class OerDjmlServiceImpl implements IOerDjmlService {
|
|||
return BaseResult.getSuccessMessageEntity("处理成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存方法前,先调这个方法 组装参数
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SysExtensionApiEntity saveExpensePre(SysExtensionApiEntity entity) {
|
||||
try {
|
||||
String bodys = entity.getBodys();
|
||||
Map<String, String> headers = entity.getHeaders();
|
||||
String eventType = headers.get("eventType");
|
||||
String formmainTableName = headers.get("formmainTableName");
|
||||
String forsonTableName = headers.get("forsonTableName");
|
||||
String djlxid = headers.get("djlxid");
|
||||
String flowcode = headers.get("flowcode");
|
||||
JSONObject bodyObj = JSONObject.parseObject(bodys);
|
||||
JSONObject seeyonData = bodyObj.getJSONObject("businessDataStr");
|
||||
if (null != seeyonData){
|
||||
/**
|
||||
* 流程发起 保存/更新单据 要全部数据
|
||||
* 流程撤销 只更新状态,传单号和状态就好了
|
||||
* 流程终止 只更新状态,传单号和状态就好了
|
||||
* 流程结束 更新状态 并上传附件
|
||||
*/
|
||||
JSONObject formmainData = seeyonData.getJSONObject(formmainTableName);
|
||||
JSONArray forsonData = seeyonData.getJSONArray(forsonTableName);
|
||||
JSONObject forjsonData0 = forsonData.getJSONObject(0);
|
||||
OerDjmlEntity djml = new OerDjmlEntity();
|
||||
djml.setDjbh(formmainData.getString("field0001"));
|
||||
//流程发起
|
||||
if (ColEventTypeEnum.ONSTART.getType().equals(eventType)){
|
||||
djml.setGsdm(forjsonData0.getString("field0084"));
|
||||
djml.setKjnd(forjsonData0.getString("field0082"));
|
||||
djml.setDjlxId(djlxid);
|
||||
djml.setZt("2");
|
||||
djml.setCrerdm(formmainData.getString("field0107"));
|
||||
djml.setCrermc("");
|
||||
djml.setCrerdate(formmainData.getString("startDate"));
|
||||
djml.setDjdate(formmainData.getString("field0002"));
|
||||
djml.setJe(formmainData.getString("field0080"));
|
||||
djml.setJedx( Convert.numberToChinese(Double.valueOf(formmainData.getString("field0080")),true));
|
||||
djml.setYjje("0.00");
|
||||
djml.setThje("0.00");
|
||||
djml.setBlje(formmainData.getString("field0080"));
|
||||
djml.setFjs( formmainData.getString("field0004"));
|
||||
djml.setZy( formmainData.getString("field0009"));
|
||||
//部门代码
|
||||
djml.setBmdm( formmainData.getString("field0006"));
|
||||
djml.setBmmc( formmainData.getString("field0006"));
|
||||
//项目代码
|
||||
djml.setXmdm(forjsonData0.getString("field0074"));
|
||||
djml.setXmmc(forjsonData0.getString("field0075"));
|
||||
//个人代码
|
||||
djml.setGrdm(formmainData.getString("field0108"));
|
||||
djml.setGrmc("");
|
||||
//经济代码
|
||||
djml.setJjdm("");
|
||||
djml.setJjmc("");
|
||||
//银行帐号 开户银行
|
||||
djml.setYhzh(forjsonData0.getString("field0079"));
|
||||
djml.setKhyh(forjsonData0.getString("field0078"));
|
||||
//当前审核节点、下个审核节点 ,不在grp审批,是不是不用填了
|
||||
djml.setCurshjd("-9");
|
||||
djml.setNextshjd("999");
|
||||
djml.setFlowcode(flowcode);
|
||||
djml.setJsfs(spliceStr(forjsonData0.getString("field0095"),forjsonData0.getString("field0094")));
|
||||
//电话,oa上没有
|
||||
djml.setTel(formmainData.getString("field0110"));
|
||||
djml.setClf_ccr(formmainData.getString("field0010"));
|
||||
//送审日期
|
||||
djml.setSsrq( DateUtil.format(formmainData.getDate("startDate"),"yyyyMMddHHmmssSSS"));
|
||||
djml.setSsrid("");
|
||||
djml.setSsr("");
|
||||
|
||||
//报销明细
|
||||
List<OerDjnrEntity> djnrList = new ArrayList<>();
|
||||
//结算方式
|
||||
List<OerDjjsfsEntity> jsfsList = new ArrayList<>();
|
||||
//预算指标
|
||||
List<OerYszbEntity> yszbList = new ArrayList<>();
|
||||
//指标记录
|
||||
int xh = 1;
|
||||
for (int i=0; i<forsonData.size();i++) {
|
||||
JSONObject forson = forsonData.getJSONObject(i);
|
||||
String gsdm = forson.getString("field0084");
|
||||
String kjnd = forson.getString("field0082");
|
||||
String je = forson.getString("field0032");
|
||||
//单据内容
|
||||
OerDjnrEntity djnr = new OerDjnrEntity();
|
||||
djnr.setXh(String.valueOf(xh));
|
||||
djnr.setGsdm(gsdm);
|
||||
djnr.setKjnd(kjnd);
|
||||
djnr.setDjlxId(djlxid);
|
||||
djnr.setBnxId(headers.get("bxmx_bnxid"));
|
||||
djnr.setJe(je);
|
||||
djnr.setBmdm(forson.getString("field0088"));
|
||||
djnr.setBmmc(forson.getString("field0087"));
|
||||
djnr.setXmdm(forson.getString("field0074"));
|
||||
djnr.setXmmc(forson.getString("field0075"));
|
||||
djnr.setJjdm("");
|
||||
djnr.setJjmc("");
|
||||
//grp库里有,不知道是什么 1001基本支出 2001项目支出(网银)
|
||||
djnr.setFzx8dm("");
|
||||
djnr.setFzx8mc("");
|
||||
//指标id
|
||||
djnr.setZbId(forson.getString("field0085"));
|
||||
djnr.setJflxdm("");
|
||||
djnr.setJflxmc("");
|
||||
djnr.setZy(forson.getString("field0030"));
|
||||
djnr.setClf_startdate(forson.getString("field0016"));
|
||||
djnr.setClf_enddate(forson.getString("field0017"));
|
||||
djnr.setClf_ccdd(forson.getString("field0019"));
|
||||
djnr.setClf_ccksd(forson.getString("field0018"));
|
||||
djnr.setClf_djzs(djml.getFjs());
|
||||
djnr.setClf_ccts(forson.getString("field0023"));
|
||||
djnr.setClf_ccrs(forson.getString("field0021"));
|
||||
djnr.setClf_zw(forson.getString("field0092"));
|
||||
djnr.setClf_jtgj(forson.getString("field0020"));
|
||||
djnr.setClf_jtf(forson.getString("field0024"));
|
||||
djnr.setClf_zsbz(forson.getString("field0077"));
|
||||
djnr.setClf_zsf(forson.getString("field0025"));
|
||||
//伙食补助是 标准金额
|
||||
djnr.setCLF_HSBZ(forson.getString("field0026"));
|
||||
//伙食费是 实际报销的金额
|
||||
djnr.setClf_hsf(forson.getString("field0026"));
|
||||
djnr.setClf_jtbz(forson.getString("field0024"));
|
||||
djnr.setClf_qtf(forson.getString("field0028"));
|
||||
djnr.setFjs(djml.getFjs());
|
||||
djnrList.add(djnr);
|
||||
//结算方式
|
||||
OerDjjsfsEntity jsfs = new OerDjjsfsEntity();
|
||||
jsfs.setGsdm(gsdm);
|
||||
jsfs.setKjnd(kjnd);
|
||||
jsfs.setDjlxId(djlxid);
|
||||
jsfs.setBnxid(headers.get("jsfs_bnxid"));
|
||||
jsfs.setXh(String.valueOf(xh));
|
||||
jsfs.setJsfsdm(forson.getString("field0095"));
|
||||
jsfs.setJsfsmc(forson.getString("field0094"));
|
||||
jsfs.setKmdm(forson.getString("field0089"));
|
||||
jsfs.setKmmc(forson.getString("field0066"));
|
||||
jsfs.setSkr(forson.getString("field0096"));
|
||||
jsfs.setKhyh(forson.getString("field0078"));
|
||||
jsfs.setYhzh(forson.getString("field0079"));
|
||||
jsfs.setJe(je);
|
||||
jsfs.setYh("");
|
||||
jsfs.setYhhh("");
|
||||
jsfs.setProvince("");
|
||||
jsfs.setCity("");
|
||||
//支付方式为个人、公务卡时 可以选择 经办人、负责人、其他
|
||||
jsfs.setRytype("");
|
||||
//oa没有
|
||||
jsfs.setYt(forson.getString("field0030"));
|
||||
jsfsList.add(jsfs);
|
||||
//预算指标
|
||||
OerYszbEntity yszb = new OerYszbEntity();
|
||||
BeanUtil.copyProperties(djnr,yszb);
|
||||
yszb.setBnxId(headers.get("yszb_bnxid"));
|
||||
yszb.setZbdm(forson.getString("field0085"));
|
||||
yszb.setZy(forson.getString("field0111"));
|
||||
yszb.setKmdm(forson.getString("field0089"));
|
||||
yszb.setKmmc(forson.getString("field0066"));
|
||||
yszbList.add(yszb);
|
||||
xh++;
|
||||
}
|
||||
logger.info("报销单主表:{}",JSONObject.toJSONString(djml));
|
||||
logger.info("报销单明细表:{}",JSONObject.toJSONString(djnrList));
|
||||
logger.info("报销单结算方式:{}",JSONObject.toJSONString(jsfsList));
|
||||
logger.info("报销单预算指标:{}",JSONObject.toJSONString(yszbList));
|
||||
djml.setOerDjnrEntityList(djnrList);
|
||||
djml.setOerYszbEntityList(yszbList);
|
||||
String djmlStr = JSONObject.toJSONString(djml);
|
||||
JSONObject param = new JSONObject(new LinkedHashMap<>());
|
||||
param = JSONObject.parseObject(djmlStr);
|
||||
param.put("lclb",eventType);
|
||||
param.put("oerDjnrEntityList",djnrList);
|
||||
param.put("oerYszbEntityList",yszbList);
|
||||
param.put("oerDjjsfsEntityList",jsfsList);
|
||||
//param.put("gbiZbsyrecEntitylist",null);
|
||||
logger.info("差旅报销单报文:{}",param.toString());
|
||||
}
|
||||
}
|
||||
}catch (Exception ex ){
|
||||
logger.error("保存报销单之前组装参数出错",ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 保存或修改主表以及指标
|
||||
|
@ -1199,14 +1024,4 @@ public class OerDjmlServiceImpl implements IOerDjmlService {
|
|||
}
|
||||
return flag;
|
||||
}
|
||||
/**
|
||||
* code和name拼接[]
|
||||
* @param code
|
||||
* @param name
|
||||
* @return 格式:03[公务卡]
|
||||
*/
|
||||
private String spliceStr(String code,String name){
|
||||
String template = "{}[{}]";
|
||||
return StrUtil.format(template,code,name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -390,7 +390,7 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
object.put("eventType",eventType);
|
||||
object.put("businessDataStr",seeYonBean.toJSONString());
|
||||
object.put("affairId","");
|
||||
object.put("summaryId","");
|
||||
object.put("summaryId",interFaceEntity.getSummaryId());
|
||||
object.put("currentActivityId","");
|
||||
object.put("id",forMainId);
|
||||
object.put("hzyaExtData",requestData.getJSONObject("hzyaExtData"));
|
||||
|
@ -464,6 +464,7 @@ public class SeeYonInterFaceImpl implements ISeeYonInterFace {
|
|||
//数据源编码
|
||||
requestData.put("dataSourceCode",entity.getDataSourceCode());
|
||||
requestData.put("formMainIds",entity.getFormMainIds());
|
||||
requestData.put("summaryId",entity.getSummaryId());
|
||||
JSONObject jsonStr = new JSONObject();
|
||||
jsonStr.put("jsonStr",requestData);
|
||||
thirdInterfaceSeeYonDefinitionRePush(jsonStr);
|
||||
|
|
Loading…
Reference in New Issue