| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.AllArgsConstructor; |
| | | import net.sourceforge.pinyin4j.PinyinHelper; |
| | | import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType; |
| | |
| | | import org.springblade.modules.exam.entity.ExamPaper; |
| | | import org.springblade.modules.exam.service.ExamPaperService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.text.SimpleDateFormat; |
| | | |
| | |
| | | @PostMapping("/submit") |
| | | public R submit(@RequestBody Apply apply) { |
| | | if (null==apply.getId()){ |
| | | //去生成准考证 |
| | | //去生成准考证号码 |
| | | apply.setCandidateNo(getCandidateNo(apply)); |
| | | //默认通过 |
| | | apply.setApplyStatus(2); |
| | | } |
| | | return R.status(applyService.saveOrUpdate(apply)); |
| | | } |
| | | |
| | | /** |
| | | * 生成准考证 |
| | | * 生成准考证号码 |
| | | * @param apply 考试报名信息对象 |
| | | */ |
| | | private String getCandidateNo(Apply apply) { |
| | |
| | | String examName |
| | | = examPaper.getExamName().replaceAll("\\s*", "").replaceAll("[^(\\u4e00-\\u9fa5)]", "").substring(0,1); |
| | | |
| | | //前缀 |
| | | //前缀 = 年的最后两位 + 月份(两位) + 考试名称(中文拼音)首字母(去除数字,字母) + 考试类型 + 季度拼音首字母大写(春季就是 C) |
| | | String result = year |
| | | + months |
| | | + toFirstChar(examName).toUpperCase() |