报销接口编写
This commit is contained in:
parent
1a299b15f1
commit
0e717cd182
|
@ -9,4 +9,5 @@ import com.hzya.frame.basedao.dao.IBaseDao;
|
||||||
import com.hzya.frame.grpU8.nxproof.attachment.entity.AttachmentFileEntity;
|
import com.hzya.frame.grpU8.nxproof.attachment.entity.AttachmentFileEntity;
|
||||||
|
|
||||||
public interface IAttachmentFileDao extends IBaseDao<AttachmentFileEntity, String> {
|
public interface IAttachmentFileDao extends IBaseDao<AttachmentFileEntity, String> {
|
||||||
|
Integer saveData(AttachmentFileEntity entity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,19 @@ package com.hzya.frame.grpU8.nxproof.attachment.dao.impl;/*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||||
import com.hzya.frame.grpU8.nxproof.attachment.dao.IAttachmentFileDao;
|
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.entity.AttachmentFileEntity;
|
||||||
|
import com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public class AttachmentFileDaoImpl extends MybatisGenericDao<AttachmentFileEntity, String> implements IAttachmentFileDao {
|
public class AttachmentFileDaoImpl extends MybatisGenericDao<AttachmentFileEntity, String> implements IAttachmentFileDao {
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public Integer saveData(AttachmentFileEntity entity) {
|
||||||
|
Integer o = super.insert(getSqlIdPrifx() + "AttachmentFileEntity_insert", entity);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,4 +9,9 @@ import com.hzya.frame.basedao.dao.IBaseDao;
|
||||||
import com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity;
|
import com.hzya.frame.grpU8.nxproof.oerannex.entity.OerAnnexEntity;
|
||||||
|
|
||||||
public interface IOerAnnexDao extends IBaseDao<OerAnnexEntity, String> {
|
public interface IOerAnnexDao extends IBaseDao<OerAnnexEntity, String> {
|
||||||
|
Integer deleteAnnex(OerAnnexEntity delete);
|
||||||
|
|
||||||
|
OerAnnexEntity queryMaxId(OerAnnexEntity entity);
|
||||||
|
|
||||||
|
Integer saveData(OerAnnexEntity annexEntity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,35 @@ package com.hzya.frame.grpU8.nxproof.oerannex.dao.impl;/*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||||
import com.hzya.frame.grpU8.nxproof.oerannex.dao.IOerAnnexDao;
|
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.entity.OerAnnexEntity;
|
||||||
|
import com.hzya.frame.grpU8.nxproof.oerdjml.entity.OerDjmlEntity;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public class OerAnnexDaoImpl extends MybatisGenericDao<OerAnnexEntity, String> implements IOerAnnexDao {
|
public class OerAnnexDaoImpl extends MybatisGenericDao<OerAnnexEntity, String> implements IOerAnnexDao {
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public Integer deleteAnnex(OerAnnexEntity entity) {
|
||||||
|
Integer o = super.delete(getSqlIdPrifx() + "OerAnnexEntity_delete", entity);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public OerAnnexEntity queryMaxId(OerAnnexEntity entity) {
|
||||||
|
OerAnnexEntity o = super.query(entity,getSqlIdPrifx() + "OerAnnexEntity_max_id");
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public Integer saveData(OerAnnexEntity entity) {
|
||||||
|
Integer o = super.insert(getSqlIdPrifx() + "entity_insert",entity);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class OerAnnexServiceImpl extends BaseService<OerAnnexEntity,String> impl
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void deleteAnnex(OerAnnexEntity entity) throws Exception {
|
public void deleteAnnex(OerAnnexEntity entity){
|
||||||
if (null != entity && StrUtil.isNotEmpty(entity.getMlid()) && StrUtil.isNotEmpty(entity.getKjnd())){
|
if (null != entity && StrUtil.isNotEmpty(entity.getMlid()) && StrUtil.isNotEmpty(entity.getKjnd())){
|
||||||
oerAnnexDao.delete("OerAnnexEntity_delete",entity);
|
oerAnnexDao.delete("OerAnnexEntity_delete",entity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -480,6 +480,8 @@ GSDM,KJND,mlId
|
||||||
update OER_DJML set
|
update OER_DJML set
|
||||||
<trim suffix="" suffixOverrides=",">
|
<trim suffix="" suffixOverrides=",">
|
||||||
<if test="zt != null and zt != ''"> ZT = #{zt},</if>
|
<if test="zt != null and zt != ''"> ZT = #{zt},</if>
|
||||||
|
<if test="curshjd != null and curshjd != ''"> curshjd = #{curshjd},</if>
|
||||||
|
<if test="nextshjd != null and nextshjd != ''"> nextshjd = #{nextshjd},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where MLID = #{mlId} and DJBH = #{djbh}
|
where MLID = #{mlId} and DJBH = #{djbh}
|
||||||
</update>
|
</update>
|
||||||
|
|
|
@ -3,15 +3,22 @@ package com.hzya.frame.grpU8.nxproof.oerdjml.service.impl;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.hzya.frame.grpU8.nxproof.attachment.dao.IAttachmentFileDao;
|
||||||
|
import com.hzya.frame.grpU8.nxproof.attachment.entity.AttachmentFileEntity;
|
||||||
import com.hzya.frame.grpU8.nxproof.gbizbsyrec.dao.IGbiZbsyrecDao;
|
import com.hzya.frame.grpU8.nxproof.gbizbsyrec.dao.IGbiZbsyrecDao;
|
||||||
import com.hzya.frame.grpU8.nxproof.gbizbsyrec.entity.GbiZbsyrecEntity;
|
import com.hzya.frame.grpU8.nxproof.gbizbsyrec.entity.GbiZbsyrecEntity;
|
||||||
|
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.grpU8.nxproof.oerdjjsfs.dao.IOerDjjsfsDao;
|
import com.hzya.frame.grpU8.nxproof.oerdjjsfs.dao.IOerDjjsfsDao;
|
||||||
import com.hzya.frame.grpU8.nxproof.oerdjjsfs.entity.OerDjjsfsEntity;
|
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.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.GbiZbsyrecAllEntity;
|
||||||
import com.hzya.frame.grpU8.nxproof.oerdjml.entity.OerDjmlEntity;
|
import com.hzya.frame.grpU8.nxproof.oerdjml.entity.OerDjmlEntity;
|
||||||
import com.hzya.frame.grpU8.nxproof.oerdjml.service.IOerDjmlService;
|
import com.hzya.frame.grpU8.nxproof.oerdjml.service.IOerDjmlService;
|
||||||
|
@ -28,12 +35,15 @@ import com.hzya.frame.seeyon.enums.ColEventTypeEnum;
|
||||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||||
import com.hzya.frame.web.entity.BaseResult;
|
import com.hzya.frame.web.entity.BaseResult;
|
||||||
import com.hzya.frame.web.exception.BaseSystemException;
|
import com.hzya.frame.web.exception.BaseSystemException;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.net.URLDecoder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -56,6 +66,10 @@ public class OerDjmlServiceImpl implements IOerDjmlService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IOerDjmlDao iOerDjmlDao;
|
private IOerDjmlDao iOerDjmlDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private IOerAnnexDao oerAnnexDao;
|
||||||
|
@Autowired
|
||||||
|
private IAttachmentFileDao attachmentFileDao;
|
||||||
|
@Autowired
|
||||||
private IOerDjnrDao iOerDjnrDao;
|
private IOerDjnrDao iOerDjnrDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IOerYszbDao iOerYszbDao;
|
private IOerYszbDao iOerYszbDao;
|
||||||
|
@ -805,7 +819,57 @@ public class OerDjmlServiceImpl implements IOerDjmlService {
|
||||||
//修改状态
|
//修改状态
|
||||||
oerDjmlAllEntity.setMlId(oerDjmlAllEntities.get(0).getMlId());
|
oerDjmlAllEntity.setMlId(oerDjmlAllEntities.get(0).getMlId());
|
||||||
oerDjmlAllEntity.setZt(entity.getZt());
|
oerDjmlAllEntity.setZt(entity.getZt());
|
||||||
|
oerDjmlAllEntity.setCurshjd(entity.getCurshjd());
|
||||||
|
oerDjmlAllEntity.setNextshjd(entity.getNextshjd());
|
||||||
iOerDjmlDao.updateOerDjml(oerDjmlAllEntity);
|
iOerDjmlDao.updateOerDjml(oerDjmlAllEntity);
|
||||||
|
//保存附件
|
||||||
|
if(entity.getFileInfoList() != null && entity.getFileInfoList().size() > 0){
|
||||||
|
OerAnnexEntity delete = new OerAnnexEntity();
|
||||||
|
delete.setKjnd(oerDjmlAllEntities.get(0).getKjnd());
|
||||||
|
delete.setMlid(oerDjmlAllEntities.get(0).getMlId());
|
||||||
|
delete.setGsdm(oerDjmlAllEntities.get(0).getGsdm());
|
||||||
|
delete.setDataSourceCode(entity.getDataSourceCode());
|
||||||
|
oerAnnexDao.deleteAnnex(delete);
|
||||||
|
int no = 1;
|
||||||
|
for (FileInfoDTO fileInfo : entity.getFileInfoList()) {
|
||||||
|
try {
|
||||||
|
AttachmentFileEntity fileEntity = new AttachmentFileEntity();
|
||||||
|
fileEntity.setDataSourceCode(entity.getDataSourceCode());
|
||||||
|
String fileName = URLDecoder.decode(fileInfo.getFile_name(), "UTF-8");
|
||||||
|
fileEntity.setaTFileName(fileName);
|
||||||
|
fileEntity.setaTFile(fileInfo.getData());
|
||||||
|
saveAttachment(fileEntity);
|
||||||
|
//保存附件关系
|
||||||
|
OerAnnexEntity annexEntity = new OerAnnexEntity();
|
||||||
|
annexEntity.setDataSourceCode(entity.getDataSourceCode());
|
||||||
|
annexEntity.setMlid(oerDjmlAllEntities.get(0).getMlId());
|
||||||
|
annexEntity.setKjnd(oerDjmlAllEntities.get(0).getKjnd());
|
||||||
|
annexEntity.setAnnexName(fileName);
|
||||||
|
annexEntity.setAnnexSize(Convert.toLong(fileInfo.getFile_size()));
|
||||||
|
annexEntity.setOnlyid(fileEntity.getaTGuid());
|
||||||
|
annexEntity.setXh(String.valueOf(no));
|
||||||
|
annexEntity.setAnnexid(queryMaxId(annexEntity));
|
||||||
|
if (null != annexEntity.getAnnexSize()){
|
||||||
|
int fileSize = annexEntity.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";
|
||||||
|
}
|
||||||
|
annexEntity.setShowSize(showSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
annexEntity.setFjType("其它");
|
||||||
|
oerAnnexDao.saveData(annexEntity);
|
||||||
|
no++;
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.error("保存附件到grp出错:{}",e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
return BaseResult.getFailureMessageEntity("根据单据编号存在多条报销单");
|
return BaseResult.getFailureMessageEntity("根据单据编号存在多条报销单");
|
||||||
}
|
}
|
||||||
|
@ -815,6 +879,37 @@ public class OerDjmlServiceImpl implements IOerDjmlService {
|
||||||
return BaseResult.getSuccessMessageEntity("处理成功");
|
return BaseResult.getSuccessMessageEntity("处理成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String queryMaxId(OerAnnexEntity entity) {
|
||||||
|
if (null == entity){
|
||||||
|
entity = new OerAnnexEntity();
|
||||||
|
}
|
||||||
|
if (StrUtil.isEmpty(entity.getKjnd())){
|
||||||
|
entity.setKjnd(String.valueOf(DateUtil.year(new Date())));
|
||||||
|
}
|
||||||
|
OerAnnexEntity max = oerAnnexDao.queryMaxId(entity);
|
||||||
|
if (null != max){
|
||||||
|
Long max_value = Long.valueOf(max.getMaxAnnexid());
|
||||||
|
return String.valueOf(max_value+1);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
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.saveData(entity);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 保存方法前,先调这个方法 组装参数
|
* 保存方法前,先调这个方法 组装参数
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue