bug:企标编号重复问题处理
This commit is contained in:
+10
-3
@@ -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) {
|
if (count >= 1000) {
|
||||||
StringBuilder formatBuilder = new StringBuilder();
|
StringBuilder formatBuilder = new StringBuilder();
|
||||||
for (int i = 0; i < maxStandSn.length(); i++) {
|
for (int i = 0; i < maxSn.length(); i++) {
|
||||||
formatBuilder.append("0");
|
formatBuilder.append("0");
|
||||||
}
|
}
|
||||||
String format = formatBuilder.toString();
|
String format = formatBuilder.toString();
|
||||||
decimalFormat = new DecimalFormat(format);
|
decimalFormat = new DecimalFormat(format);
|
||||||
}
|
}
|
||||||
// 1.1.2.2 生成新的顺序号
|
// 1.1.2.2 生成新的顺序号
|
||||||
String newStandSn = decimalFormat.format(Integer.parseInt(maxStandSn) + 1);
|
String newStandSn = decimalFormat.format(Integer.parseInt(maxSn) + 1);
|
||||||
// 1.1.2.3 新的顺序号 存入顺序号表中
|
// 1.1.2.3 新的顺序号 存入顺序号表中
|
||||||
saveBussStandSn(reviseStatus, standSort, newStandSn, taskId);
|
saveBussStandSn(reviseStatus, standSort, newStandSn, taskId);
|
||||||
// 返回顺序号
|
// 返回顺序号
|
||||||
|
|||||||
+1
-1
@@ -1258,7 +1258,7 @@
|
|||||||
select * from sar_bussioness_stand where stand_code = #{standCode} and VALID_FLAG = 0 limit 1
|
select * from sar_bussioness_stand where stand_code = #{standCode} and VALID_FLAG = 0 limit 1
|
||||||
</select>
|
</select>
|
||||||
<select id="selectMaxStandSn" resultType="java.lang.String">
|
<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>
|
</select>
|
||||||
|
|
||||||
<update id="updateByIdInfo" >
|
<update id="updateByIdInfo" >
|
||||||
|
|||||||
Reference in New Issue
Block a user