wsq-后端-20260727-新增功能-改善提案编号最新生成

This commit is contained in:
王淑勤
2026-07-27 11:08:14 +08:00
parent a3ff3d66e7
commit af9ec149ab
6 changed files with 52 additions and 0 deletions
@@ -202,6 +202,14 @@ public class ImprovementProposalController {
return Result.OK(improvementInstituteVoteList); return Result.OK(improvementInstituteVoteList);
} }
@AutoLog(value = "improvement_proposal-获取年度最新提案编号序列")
@Operation(summary="获取年度最新提案编号序列")
@GetMapping(value = "/getLatestProposalSequence")
public Result<Integer> getLatestProposalSequence(@RequestParam(name="year", required=true) Integer year) {
Integer sequence = improvementProposalService.getLatestProposalSequence(year);
return Result.OK("查询成功", sequence);
}
/** /**
* 导出excel * 导出excel
* *
@@ -74,6 +74,7 @@ public class ImprovementProposal implements Serializable {
/**提案类别*/ /**提案类别*/
@Excel(name = "提案类别", width = 15) @Excel(name = "提案类别", width = 15)
@Schema(description = "提案类别") @Schema(description = "提案类别")
@Dict(dicCode = "proposal_category")
private String proposalCategory; private String proposalCategory;
/**问题描述*/ /**问题描述*/
@Excel(name = "问题描述", width = 15) @Excel(name = "问题描述", width = 15)
@@ -142,6 +143,7 @@ public class ImprovementProposal implements Serializable {
/**业务展示状态*/ /**业务展示状态*/
@Excel(name = "业务展示状态", width = 15) @Excel(name = "业务展示状态", width = 15)
@Schema(description = "业务展示状态") @Schema(description = "业务展示状态")
@Dict(dicCode = "bpm_status")
private String bpmStatus; private String bpmStatus;
/**归档人ID*/ /**归档人ID*/
@Excel(name = "归档人ID", width = 15) @Excel(name = "归档人ID", width = 15)
@@ -14,4 +14,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface ImprovementProposalMapper extends BaseMapper<ImprovementProposal> { public interface ImprovementProposalMapper extends BaseMapper<ImprovementProposal> {
String selectLatestProposalNoByYear(@Param("year") Integer year);
} }
@@ -2,4 +2,12 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.improvementproposal.mapper.ImprovementProposalMapper"> <mapper namespace="org.jeecg.modules.improvementproposal.mapper.ImprovementProposalMapper">
<select id="selectLatestProposalNoByYear" resultType="java.lang.String">
SELECT proposal_no FROM improvement_proposal
WHERE del_flag = '0'
AND YEAR(create_time) = #{year}
ORDER BY create_time DESC
LIMIT 1
</select>
</mapper> </mapper>
@@ -48,4 +48,12 @@ public interface IImprovementProposalService extends IService<ImprovementProposa
*/ */
public void delBatchMain (Collection<? extends Serializable> idList); public void delBatchMain (Collection<? extends Serializable> idList);
/**
* 获取指定年度最新提案编号中的XXXX部分
*
* @param year 年份
* @return XXXX的int值,如果没有记录返回0
*/
public Integer getLatestProposalSequence(Integer year);
} }
@@ -14,6 +14,8 @@ import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.Collection; import java.util.Collection;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* @Description: improvement_proposal * @Description: improvement_proposal
@@ -112,4 +114,26 @@ public class ImprovementProposalServiceImpl extends ServiceImpl<ImprovementPropo
} }
} }
@Override
public Integer getLatestProposalSequence(Integer year) {
String proposalNo = improvementProposalMapper.selectLatestProposalNoByYear(year);
if (proposalNo == null) {
return 0;
}
String patternStr = ".*-" + year + "年-(\\d+)";
Pattern pattern = Pattern.compile(patternStr);
Matcher matcher = pattern.matcher(proposalNo);
if (matcher.find()) {
try {
return Integer.parseInt(matcher.group(1));
} catch (NumberFormatException e) {
return 0;
}
}
return 0;
}
} }