bug:企标编号重复问题处理

This commit is contained in:
wxyclub
2023-08-09 16:13:39 +08:00
parent e2da9d3eb6
commit f286b6050b
2 changed files with 11 additions and 4 deletions
@@ -260,18 +260,25 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
}
}
// 没有已存在的记录则生成新的顺序号返回
String maxStandSn = iSarBussStandSnService.selectMaxStandSn(standSort);
// 顺序表中最大值
String maxSn = iSarBussStandSnService.selectMaxStandSn(standSort);
// 企标库中最大值
String standMaxSn = iSarBussionessStandService.selectMaxStandSn(standSort);
// 如果企标库中的值比顺序表中的值大则以企标库的值为准
if (Integer.parseInt(standMaxSn) > Integer.parseInt(maxSn)) {
maxSn = standMaxSn;
}
// 处理顺序号的格式
if (count >= 1000) {
StringBuilder formatBuilder = new StringBuilder();
for (int i = 0; i < maxStandSn.length(); i++) {
for (int i = 0; i < maxSn.length(); i++) {
formatBuilder.append("0");
}
String format = formatBuilder.toString();
decimalFormat = new DecimalFormat(format);
}
// 1.1.2.2 生成新的顺序号
String newStandSn = decimalFormat.format(Integer.parseInt(maxStandSn) + 1);
String newStandSn = decimalFormat.format(Integer.parseInt(maxSn) + 1);
// 1.1.2.3 新的顺序号 存入顺序号表中
saveBussStandSn(reviseStatus, standSort, newStandSn, taskId);
// 返回顺序号
@@ -1258,7 +1258,7 @@
select * from sar_bussioness_stand where stand_code = #{standCode} and VALID_FLAG = 0 limit 1
</select>
<select id="selectMaxStandSn" resultType="java.lang.String">
select max(STAND_NUMBER) from sar_bussioness_stand where STAND_SORT =#{standSort} and VALID_FLAG = 0
select MAX(DISTINCT CAST(STAND_NUMBER AS decimal(9))) from sar_bussioness_stand where STAND_SORT =#{standSort} and VALID_FLAG = 0
</select>
<update id="updateByIdInfo" >