1、新增是否按分类合并分录。

2、优化字段检查,支持substr
This commit is contained in:
zhengyf 2025-07-16 16:03:56 +08:00
parent 081ed4f724
commit 554ffd1655
3 changed files with 103 additions and 58 deletions

View File

@ -153,6 +153,19 @@ public class AeConfVoucherTemplateEntity extends BaseEntity {
* 修改人 * 修改人
*/ */
private String modifyUser; private String modifyUser;
/**
* 是否按类型合并
*/
private String typeMerge;
public String getTypeMerge() {
return typeMerge;
}
public void setTypeMerge(String typeMerge) {
this.typeMerge = typeMerge;
}
private List<AeConfVoucherTemplateAssistEntity> assistEntityList; private List<AeConfVoucherTemplateAssistEntity> assistEntityList;

View File

@ -7,6 +7,7 @@
<result property="id" column="id" jdbcType="INTEGER"/> <result property="id" column="id" jdbcType="INTEGER"/>
<result property="mdmId" column="mdm_id" jdbcType="VARCHAR"/> <result property="mdmId" column="mdm_id" jdbcType="VARCHAR"/>
<result property="templateTypeId" column="template_type_id" jdbcType="VARCHAR"/> <result property="templateTypeId" column="template_type_id" jdbcType="VARCHAR"/>
<result property="typeMerge" column="type_merge" jdbcType="VARCHAR"/>
<result property="pkGlorgbook" column="pk_glorgbook" jdbcType="VARCHAR"/> <result property="pkGlorgbook" column="pk_glorgbook" jdbcType="VARCHAR"/>
<result property="glOrgbookCode" column="gl_orgbook_code" jdbcType="VARCHAR"/> <result property="glOrgbookCode" column="gl_orgbook_code" jdbcType="VARCHAR"/>
<result property="glOrgbookName" column="gl_orgbook_name" jdbcType="VARCHAR"/> <result property="glOrgbookName" column="gl_orgbook_name" jdbcType="VARCHAR"/>
@ -68,60 +69,61 @@
id id
,mdm_id ,mdm_id
,template_type_id ,template_type_id
,type_merge
,pk_glorgbook ,pk_glorgbook
,gl_orgbook_code ,gl_orgbook_code
,gl_orgbook_name ,gl_orgbook_name
,voucher_type_id ,voucher_type_id
,voucher_type_code ,voucher_type_code
,voucher_type_name ,voucher_type_name
,business_unit_id ,business_unit_id
,business_unit_code ,business_unit_code
,business_unit_name ,business_unit_name
,subject_classification_id ,subject_classification_id
,subject_classification_code ,subject_classification_code
,subject_classification_name ,subject_classification_name
,currency_field ,currency_field
,currency_field_code ,currency_field_code
,currency_field_name ,currency_field_name
,pk_currtype ,pk_currtype
,abstract_str ,abstract_str
,abstract_res ,abstract_res
,exchange_rate ,exchange_rate
,j_num_field ,j_num_field
,j_num_field_code ,j_num_field_code
,j_num_field_name ,j_num_field_name
,j_yb_sum_field ,j_yb_sum_field
,j_yb_sum_field_code ,j_yb_sum_field_code
,j_yb_sum_field_name ,j_yb_sum_field_name
,j_bb_sum_field ,j_bb_sum_field
,j_bb_sum_field_code ,j_bb_sum_field_code
,j_bb_sum_field_name ,j_bb_sum_field_name
,d_num_field ,d_num_field
,d_num_field_code ,d_num_field_code
,d_num_field_name ,d_num_field_name
,d_yb_sum_field ,d_yb_sum_field
,d_yb_sum_field_code ,d_yb_sum_field_code
,d_yb_sum_field_name ,d_yb_sum_field_name
,d_bb_sum_field ,d_bb_sum_field
,d_bb_sum_field_code ,d_bb_sum_field_code
,d_bb_sum_field_name ,d_bb_sum_field_name
,pk_cashflow ,pk_cashflow
,pk_subrelation ,pk_subrelation
,remark ,remark
,def1 ,def1
,def2 ,def2
,def3 ,def3
,def4 ,def4
,def5 ,def5
,def6 ,def6
,def7 ,def7
,def8 ,def8
,def9 ,def9
,def10 ,def10
,create_time ,create_time
,create_user ,create_user
,modify_time ,modify_time
,modify_user ,modify_user
,sts ,sts
</sql> </sql>
<!-- 查询 采用==查询 --> <!-- 查询 采用==查询 -->
@ -134,6 +136,7 @@
<if test="id != null">and id = #{id}</if> <if test="id != null">and id = #{id}</if>
<if test="mdmId != null and mdmId != ''">and mdm_id = #{mdmId}</if> <if test="mdmId != null and mdmId != ''">and mdm_id = #{mdmId}</if>
<if test="templateTypeId != null and templateTypeId != ''">and template_type_id = #{templateTypeId}</if> <if test="templateTypeId != null and templateTypeId != ''">and template_type_id = #{templateTypeId}</if>
<if test="typeMerge != null and typeMerge != ''">and type_merge = #{typeMerge}</if>
<if test="pkGlorgbook != null and pkGlorgbook != ''">and pk_glorgbook = #{pkGlorgbook}</if> <if test="pkGlorgbook != null and pkGlorgbook != ''">and pk_glorgbook = #{pkGlorgbook}</if>
<if test="glOrgbookCode != null and glOrgbookCode != ''">and gl_orgbook_code = #{glOrgbookCode}</if> <if test="glOrgbookCode != null and glOrgbookCode != ''">and gl_orgbook_code = #{glOrgbookCode}</if>
<if test="glOrgbookName != null and glOrgbookName != ''">and gl_orgbook_name = #{glOrgbookName}</if> <if test="glOrgbookName != null and glOrgbookName != ''">and gl_orgbook_name = #{glOrgbookName}</if>
@ -221,6 +224,7 @@
<if test="id != null">and id = #{id}</if> <if test="id != null">and id = #{id}</if>
<if test="mdmId != null and mdmId != ''">and mdm_id = #{mdmId}</if> <if test="mdmId != null and mdmId != ''">and mdm_id = #{mdmId}</if>
<if test="templateTypeId != null and templateTypeId != ''">and template_type_id = #{templateTypeId}</if> <if test="templateTypeId != null and templateTypeId != ''">and template_type_id = #{templateTypeId}</if>
<if test="typeMerge != null and typeMerge != ''">and type_merge = #{typeMerge}</if>
<if test="pkGlorgbook != null and pkGlorgbook != ''">and pk_glorgbook = #{pkGlorgbook}</if> <if test="pkGlorgbook != null and pkGlorgbook != ''">and pk_glorgbook = #{pkGlorgbook}</if>
<if test="glOrgbookCode != null and glOrgbookCode != ''">and gl_orgbook_code = #{glOrgbookCode}</if> <if test="glOrgbookCode != null and glOrgbookCode != ''">and gl_orgbook_code = #{glOrgbookCode}</if>
<if test="glOrgbookName != null and glOrgbookName != ''">and gl_orgbook_name = #{glOrgbookName}</if> <if test="glOrgbookName != null and glOrgbookName != ''">and gl_orgbook_name = #{glOrgbookName}</if>
@ -310,6 +314,7 @@
<if test="id != null">and id like concat('%',#{id},'%')</if> <if test="id != null">and id like concat('%',#{id},'%')</if>
<if test="mdmId != null and mdmId != ''">and mdm_id like concat('%',#{mdmId},'%')</if> <if test="mdmId != null and mdmId != ''">and mdm_id like concat('%',#{mdmId},'%')</if>
<if test="templateTypeId != null and templateTypeId != ''">and template_type_id like concat('%',#{templateTypeId},'%')</if> <if test="templateTypeId != null and templateTypeId != ''">and template_type_id like concat('%',#{templateTypeId},'%')</if>
<if test="typeMerge != null and typeMerge != ''">and type_merge like concat('%',#{typeMerge},'%')</if>
<if test="pkGlorgbook != null and pkGlorgbook != ''">and pk_glorgbook like concat('%',#{pkGlorgbook},'%') <if test="pkGlorgbook != null and pkGlorgbook != ''">and pk_glorgbook like concat('%',#{pkGlorgbook},'%')
</if> </if>
<if test="glOrgbookCode != null and glOrgbookCode != ''">and gl_orgbook_code like <if test="glOrgbookCode != null and glOrgbookCode != ''">and gl_orgbook_code like
@ -446,6 +451,7 @@
<if test="id != null">or id = #{id}</if> <if test="id != null">or id = #{id}</if>
<if test="mdmId != null and mdmId != ''">or mdm_id = #{mdmId}</if> <if test="mdmId != null and mdmId != ''">or mdm_id = #{mdmId}</if>
<if test="templateTypeId != null and templateTypeId != ''">or template_type_id = #{templateTypeId}</if> <if test="templateTypeId != null and templateTypeId != ''">or template_type_id = #{templateTypeId}</if>
<if test="typeMerge != null and typeMerge != ''">or type_merge = #{typeMerge}</if>
<if test="pkGlorgbook != null and pkGlorgbook != ''">or pk_glorgbook = #{pkGlorgbook}</if> <if test="pkGlorgbook != null and pkGlorgbook != ''">or pk_glorgbook = #{pkGlorgbook}</if>
<if test="glOrgbookCode != null and glOrgbookCode != ''">or gl_orgbook_code = #{glOrgbookCode}</if> <if test="glOrgbookCode != null and glOrgbookCode != ''">or gl_orgbook_code = #{glOrgbookCode}</if>
<if test="glOrgbookName != null and glOrgbookName != ''">or gl_orgbook_name = #{glOrgbookName}</if> <if test="glOrgbookName != null and glOrgbookName != ''">or gl_orgbook_name = #{glOrgbookName}</if>
@ -532,6 +538,7 @@
<if test="id != null">id ,</if> <if test="id != null">id ,</if>
<if test="mdmId != null and mdmId != ''">mdm_id ,</if> <if test="mdmId != null and mdmId != ''">mdm_id ,</if>
<if test="templateTypeId != null and templateTypeId != ''">template_type_id ,</if> <if test="templateTypeId != null and templateTypeId != ''">template_type_id ,</if>
<if test="typeMerge != null and typeMerge != ''">type_merge ,</if>
<if test="pkGlorgbook != null and pkGlorgbook != ''">pk_glorgbook ,</if> <if test="pkGlorgbook != null and pkGlorgbook != ''">pk_glorgbook ,</if>
<if test="glOrgbookCode != null and glOrgbookCode != ''">gl_orgbook_code ,</if> <if test="glOrgbookCode != null and glOrgbookCode != ''">gl_orgbook_code ,</if>
<if test="glOrgbookName != null and glOrgbookName != ''">gl_orgbook_name ,</if> <if test="glOrgbookName != null and glOrgbookName != ''">gl_orgbook_name ,</if>
@ -600,6 +607,7 @@
<if test="id != null">#{id} ,</if> <if test="id != null">#{id} ,</if>
<if test="mdmId != null and mdmId != ''">#{mdmId} ,</if> <if test="mdmId != null and mdmId != ''">#{mdmId} ,</if>
<if test="templateTypeId != null and templateTypeId != ''">#{templateTypeId} ,</if> <if test="templateTypeId != null and templateTypeId != ''">#{templateTypeId} ,</if>
<if test="typeMerge != null and typeMerge != ''">#{typeMerge} ,</if>
<if test="pkGlorgbook != null and pkGlorgbook != ''">#{pkGlorgbook} ,</if> <if test="pkGlorgbook != null and pkGlorgbook != ''">#{pkGlorgbook} ,</if>
<if test="glOrgbookCode != null and glOrgbookCode != ''">#{glOrgbookCode} ,</if> <if test="glOrgbookCode != null and glOrgbookCode != ''">#{glOrgbookCode} ,</if>
<if test="glOrgbookName != null and glOrgbookName != ''">#{glOrgbookName} ,</if> <if test="glOrgbookName != null and glOrgbookName != ''">#{glOrgbookName} ,</if>
@ -762,6 +770,7 @@
<trim suffix="" suffixOverrides=","> <trim suffix="" suffixOverrides=",">
<if test="mdmId != null and mdmId != ''">mdm_id = #{mdmId},</if> <if test="mdmId != null and mdmId != ''">mdm_id = #{mdmId},</if>
<if test="templateTypeId != null and templateTypeId != ''">template_type_id = #{templateTypeId},</if> <if test="templateTypeId != null and templateTypeId != ''">template_type_id = #{templateTypeId},</if>
<if test="typeMerge != null and typeMerge != ''">type_merge = #{typeMerge},</if>
<if test="pkGlorgbook != null and pkGlorgbook != ''">pk_glorgbook = #{pkGlorgbook},</if> <if test="pkGlorgbook != null and pkGlorgbook != ''">pk_glorgbook = #{pkGlorgbook},</if>
<if test="glOrgbookCode != null and glOrgbookCode != ''">gl_orgbook_code = #{glOrgbookCode},</if> <if test="glOrgbookCode != null and glOrgbookCode != ''">gl_orgbook_code = #{glOrgbookCode},</if>
<if test="glOrgbookName != null and glOrgbookName != ''">gl_orgbook_name = #{glOrgbookName},</if> <if test="glOrgbookName != null and glOrgbookName != ''">gl_orgbook_name = #{glOrgbookName},</if>

View File

@ -24,6 +24,8 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
@ -50,9 +52,6 @@ public class AeConfVoucherTemplateServiceImpl extends BaseService<AeConfVoucherT
@Autowired @Autowired
private IAeConfVoucherTemplateAssistService templateAssistService; private IAeConfVoucherTemplateAssistService templateAssistService;
private StringBuffer sb = new StringBuffer();
@Autowired @Autowired
public void setAeConfVoucherTemplateDao(IAeConfVoucherTemplateDao dao) { public void setAeConfVoucherTemplateDao(IAeConfVoucherTemplateDao dao) {
this.templateDao = dao; this.templateDao = dao;
@ -258,7 +257,32 @@ public class AeConfVoucherTemplateServiceImpl extends BaseService<AeConfVoucherT
String[] parts = abstractRes.split("\\+"); String[] parts = abstractRes.split("\\+");
for (String part : parts) { for (String part : parts) {
sb.append(part);
//判断substr公式
if (part.startsWith("substr(")) {
// 定义正则表达式模式
String regex = "substr\\(([^(),]+|([^()]*\\([^()]*\\)[^()]*)*),\\s*(\\d+),\\s*(\\d+)\\)";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(part);
if (matcher.find()) {
String param1 = matcher.group(1);
String param2 = matcher.group(3);
String param3 = matcher.group(4);
if (param1 == null || param2 == null || param3 == null) {
return false;
}
if (param1.startsWith("@@$")) {
String fieldPath = param1.substring(3); // 去除 @@$
if (!isValidFieldPath(entity.getMdmId(), fieldPath)) {
return false;
}
}
} else {
return false;
}
}
if (part.startsWith("@@$")) { if (part.startsWith("@@$")) {
String fieldPath = part.substring(3); // 去除 @@$ String fieldPath = part.substring(3); // 去除 @@$
if (!isValidFieldPath(entity.getMdmId(), fieldPath)) { if (!isValidFieldPath(entity.getMdmId(), fieldPath)) {
@ -499,7 +523,6 @@ public class AeConfVoucherTemplateServiceImpl extends BaseService<AeConfVoucherT
private void transformAbstract(AeConfVoucherTemplateEntity entity) { private void transformAbstract(AeConfVoucherTemplateEntity entity) {
sb.delete(0, sb.length());
} }