!94 wsq-后端-20260727-新增功能-改善提案编号最新生成
Merge pull request !94 from 王淑勤/wsq-20260727
This commit is contained in:
+8
@@ -233,6 +233,14 @@ public class ImprovementProposalController {
|
||||
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
|
||||
*
|
||||
|
||||
+2
@@ -74,6 +74,7 @@ public class ImprovementProposal implements Serializable {
|
||||
/**提案类别*/
|
||||
@Excel(name = "提案类别", width = 15)
|
||||
@Schema(description = "提案类别")
|
||||
@Dict(dicCode = "proposal_category")
|
||||
private String proposalCategory;
|
||||
/**问题描述*/
|
||||
@Excel(name = "问题描述", width = 15)
|
||||
@@ -146,6 +147,7 @@ public class ImprovementProposal implements Serializable {
|
||||
/**业务展示状态*/
|
||||
@Excel(name = "业务展示状态", width = 15)
|
||||
@Schema(description = "业务展示状态")
|
||||
@Dict(dicCode = "bpm_status")
|
||||
private String bpmStatus;
|
||||
/**归档人ID*/
|
||||
@Excel(name = "归档人ID", width = 15)
|
||||
|
||||
+1
@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
*/
|
||||
public interface ImprovementProposalMapper extends BaseMapper<ImprovementProposal> {
|
||||
|
||||
String selectLatestProposalNoByYear(@Param("year") Integer year);
|
||||
/**
|
||||
* 锁定提案主表,串行化流程发起、编辑和删除操作,避免同一提案生成多个流程实例。
|
||||
*/
|
||||
|
||||
+8
@@ -2,4 +2,12 @@
|
||||
<!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">
|
||||
|
||||
<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>
|
||||
|
||||
+8
@@ -56,5 +56,13 @@ public interface IImprovementProposalService extends IService<ImprovementProposa
|
||||
* @param idList
|
||||
*/
|
||||
public void delBatchMain (Collection<? extends Serializable> idList);
|
||||
|
||||
/**
|
||||
* 获取指定年度最新提案编号中的XXXX部分
|
||||
*
|
||||
* @param year 年份
|
||||
* @return XXXX的int值,如果没有记录返回0
|
||||
*/
|
||||
public Integer getLatestProposalSequence(Integer year);
|
||||
|
||||
}
|
||||
|
||||
+24
@@ -17,6 +17,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @Description: improvement_proposal
|
||||
@@ -170,4 +172,26 @@ public class ImprovementProposalServiceImpl extends ServiceImpl<ImprovementPropo
|
||||
return proposal;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user