报销单修改功能

This commit is contained in:
xiang2lin 2025-05-18 18:01:06 +08:00
parent 7f0994bd93
commit d1d3eba5a6
2 changed files with 32 additions and 47 deletions

View File

@ -49,6 +49,13 @@ GSDM,KJND,mlId
<!--select ATFile as Rpt_Rt_content from AT_AttachmentFile where ATGuid='A1:00367df4-d5d6-4abb-82f6-e3bd1ca9e070'--> <!--select ATFile as Rpt_Rt_content from AT_AttachmentFile where ATGuid='A1:00367df4-d5d6-4abb-82f6-e3bd1ca9e070'-->
</select> </select>
<select id="entity_list_base" resultMap="get-OerDjmlEntity-result" parameterType="com.hzya.frame.grpU8.nxproof.oerdjml.entity.OerDjmlEntity">
select * from oer_djml
<trim prefix="where" prefixOverrides="and">
<if test="djbh != null and djbh != ''"> djbh = #{djbh}</if>
<if test="mlid != null and mlid != ''">and mlid = #{mlId}</if>
</trim>
</select>
<!-- 查询最大单据编号+1--> <!-- 查询最大单据编号+1-->
<select id="OerDjmlEntity_list_base_djbhMax" resultMap="get-OerDjmlEntity-result" parameterType="com.hzya.frame.grpU8.nxproof.oerdjml.entity.OerDjmlEntity"> <select id="OerDjmlEntity_list_base_djbhMax" resultMap="get-OerDjmlEntity-result" parameterType="com.hzya.frame.grpU8.nxproof.oerdjml.entity.OerDjmlEntity">
select select
@ -227,8 +234,8 @@ GSDM,KJND,mlId
<update id="OerDjmlEntity_update_data" parameterType="com.hzya.frame.grpU8.nxproof.oerdjml.entity.OerDjmlEntity"> <update id="OerDjmlEntity_update_data" parameterType="com.hzya.frame.grpU8.nxproof.oerdjml.entity.OerDjmlEntity">
update oer_djml set update OER_DJML set
<trim prefixOverrides="," suffixOverrides=","> <trim suffix="" suffixOverrides=",">
<if test="gsdm != null and gsdm !='' "> GSDM = #{gsdm}, </if> <if test="gsdm != null and gsdm !='' "> GSDM = #{gsdm}, </if>
<if test="kjnd != null and kjnd !='' "> KJND = #{kjnd}, </if> <if test="kjnd != null and kjnd !='' "> KJND = #{kjnd}, </if>
<if test="djlxId != null and djlxId !='' "> DJLXID = #{djlxId}, </if> <if test="djlxId != null and djlxId !='' "> DJLXID = #{djlxId}, </if>
@ -267,6 +274,11 @@ GSDM,KJND,mlId
<if test="yhzh != null and yhzh !='' "> yhzh = #{yhzh}, </if> <if test="yhzh != null and yhzh !='' "> yhzh = #{yhzh}, </if>
<if test="xmdm != null and xmdm !='' "> xmdm = #{xmdm}, </if> <if test="xmdm != null and xmdm !='' "> xmdm = #{xmdm}, </if>
<if test="xmmc != null and xmmc !='' "> xmmc = #{xmmc}, </if> <if test="xmmc != null and xmmc !='' "> xmmc = #{xmmc}, </if>
<if test="WX00000051 != null and WX00000051 !='' "> WX00000051 =#{WX00000051}, </if>
<if test="WX00000054 != null and WX00000054 !='' "> WX00000054 = #{WX00000054}, </if>
<if test="WX00000055 != null and WX00000055 !='' "> WX00000055 = #{WX00000055}, </if>
<if test="WX00000056 != null and WX00000056 !='' "> WX00000056 = #{WX00000056}, </if>
<if test="WX00000057 != null and WX00000057 !='' "> WX00000057 = #{WX00000057}</if>
</trim> </trim>
where DJBH = #{djbh} and MLID=${mlId} where DJBH = #{djbh} and MLID=${mlId}
</update> </update>

View File

@ -1155,70 +1155,43 @@ public class OerDjmlServiceImpl implements IOerDjmlService {
if(StrUtil.isEmpty(entity.getDjdate())){ if(StrUtil.isEmpty(entity.getDjdate())){
return BaseResult.getFailureMessageEntity("单据日期不能为空请排查参数djdate"); return BaseResult.getFailureMessageEntity("单据日期不能为空请排查参数djdate");
} }
if(StrUtil.isEmpty(entity.getDjbh())){
return BaseResult.getFailureMessageEntity("单据编号不能为空请排查参数djbh");
}
if(entity.getOerDjnrEntityList() == null || entity.getOerDjnrEntityList().size() == 0 ){ if(entity.getOerDjnrEntityList() == null || entity.getOerDjnrEntityList().size() == 0 ){
return BaseResult.getFailureMessageEntity("报销单明细数据为空!请检查参数"); return BaseResult.getFailureMessageEntity("报销单明细数据为空!请检查参数");
} }
if(entity.getOerDjjsfsEntityList() == null || entity.getOerDjjsfsEntityList().size() == 0 ){ if(entity.getOerDjjsfsEntityList() == null || entity.getOerDjjsfsEntityList().size() == 0 ){
return BaseResult.getFailureMessageEntity("报销单结算明细数据为空!请检查参数"); return BaseResult.getFailureMessageEntity("报销单结算明细数据为空!请检查参数");
} }
boolean flag = false; String maxDjbh = entity.getDjbh();
String maxDjbh = null;
String maxMlId = null; String maxMlId = null;
// if (entity.getDjbh() == null || "".equals(entity.getDjbh())) { boolean flag = false;
// OerDjmlEntity oerDjmlEntity = new OerDjmlEntity(); //根据单号查一下 有没有保存过
// oerDjmlEntity.setDataSourceCode(dataSourceCode); OerDjmlEntity oer = new OerDjmlEntity();
// oerDjmlEntity.setGsdm(gsdm); oer.setDjbh(entity.getDjbh());
// oerDjmlEntity.setDjdate(entity.getDjdate()); oer.setGsdm(entity.getGsdm());
// oerDjmlEntity.setFph(nullConvert(entity.getFph())); oer.setDataSourceCode(dataSourceCode);
// maxDjbh = iOerDjmlDao.getMaxDjbgByGsdm(oerDjmlEntity); List<OerDjmlEntity> oerList = iOerDjmlDao.queryOerDjml(oer);
// entity.setDjbh(maxDjbh); if (CollectionUtils.isNotEmpty(oerList) && oerList.size() == 1){
// }else {
// OerDjmlEntity oerDjmlAllEntity = new OerDjmlEntity();
// oerDjmlAllEntity.setDataSourceCode(dataSourceCode);
// oerDjmlAllEntity.setDjbh(entity.getDjbh());
// List<OerDjmlEntity> oerDjmlAllEntities = iOerDjmlDao.queryOerDjml(oerDjmlAllEntity);
// if(oerDjmlAllEntities != null && oerDjmlAllEntities.size() == 1){
// flag = true;
// maxDjbh = oerDjmlAllEntities.get(0).getDjbh();
// maxMlId = oerDjmlAllEntities.get(0).getMlId();
// }
// }
//查询最大单据号
OerDjmlEntity maxDjml = new OerDjmlEntity();
maxDjml.setDataSourceCode(dataSourceCode);
maxDjml.setGsdm(gsdm);
maxDjml.setDjdate(entity.getDjdate());
maxDjbh = iOerDjmlDao.getMaxDjbgByGsdm(maxDjml);
Assert.notEmpty(maxDjbh,"生成单号出错");
OerDjmlEntity oerDjmlAllEntity = new OerDjmlEntity();
oerDjmlAllEntity.setDataSourceCode(dataSourceCode);
oerDjmlAllEntity.setDjbh(maxDjbh);
List<OerDjmlEntity> oerDjmlAllEntities = iOerDjmlDao.queryOerDjml(oerDjmlAllEntity);
if(oerDjmlAllEntities != null && oerDjmlAllEntities.size() == 1){
flag = true; flag = true;
maxDjbh = oerDjmlAllEntities.get(0).getDjbh(); maxDjbh = oerList.get(0).getDjbh();
maxMlId = oerDjmlAllEntities.get(0).getMlId(); maxMlId = oerList.get(0).getMlId();
} }else {
//查最大MLID
if(!flag){
//logger.info("获取最大单据编号");
OerDjmlEntity oerDjmlEntity = new OerDjmlEntity(); OerDjmlEntity oerDjmlEntity = new OerDjmlEntity();
oerDjmlEntity.setDataSourceCode(dataSourceCode); oerDjmlEntity.setDataSourceCode(dataSourceCode);
oerDjmlEntity.setGsdm(gsdm); oerDjmlEntity.setGsdm(gsdm);
oerDjmlEntity.setDjdate(entity.getDjdate()); oerDjmlEntity.setDjdate(entity.getDjdate());
oerDjmlEntity.setFph(nullConvert(entity.getFph()));
//maxDjbh = iOerDjmlDao.getMaxDjbgByGsdm(oerDjmlEntity);
maxDjbh = entity.getDjbh();
logger.info("获取到最大单据编号:------>"+maxDjbh);
//查询最大单据ID mlid //查询最大单据ID mlid
maxMlId = iOerDjmlDao.getMaxMlIdByGsdm(oerDjmlEntity); maxMlId = iOerDjmlDao.getMaxMlIdByGsdm(oerDjmlEntity);
logger.info("获取到最大单据ID MLID:------>"+maxMlId); logger.info("获取到最大单据ID MLID:------>"+maxMlId);
} }
logger.info("组装单据主表数据开始:------>"); logger.info("组装单据主表数据开始:------>");
OerDjmlEntity oerdjml = setMainData(entity,maxDjbh,maxMlId); OerDjmlEntity oerdjml = setMainData(entity,maxDjbh,maxMlId);
logger.info("保存主表信息:------>"); logger.info("保存主表信息:------>");
if(flag){ if(oerList != null && oerList.size() == 1){
logger.info("已经保存过单据走修改逻辑。mlid:{},djbh:{}",oerList.get(0).getMlId(),oerList.get(0).getDjbh());
oerdjml.setDataSourceCode(dataSourceCode); oerdjml.setDataSourceCode(dataSourceCode);
iOerDjmlDao.updateData(oerdjml); iOerDjmlDao.updateData(oerdjml);
//删除明细 //删除明细