| | |
| | | import com.ruoyi.basic.mapper.BaseParamMapper; |
| | | import com.ruoyi.basic.pojo.BaseParam; |
| | | import com.ruoyi.basic.service.BaseParamService; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import io.swagger.annotations.Api; |
| | |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | |
| | | // 处理日期格式展示 |
| | | paramPage.getRecords().forEach(item -> { |
| | | if (Integer.valueOf(4).equals(item.getParamType()) && StringUtils.isNotEmpty(item.getParamFormat())) { |
| | | item.setParamFormat(toUpperCasePattern(item.getParamFormat())); |
| | | item.setParamFormat(DateUtils.toUpperCasePattern(item.getParamFormat())); |
| | | } |
| | | }); |
| | | |
| | |
| | | throw new RuntimeException("日期类型必须配置参数格式(如: yyyy-MM-dd)"); |
| | | } |
| | | try { |
| | | String standardPattern = normalizePattern(baseParam.getParamFormat()); |
| | | String standardPattern = DateUtils.normalizePattern(baseParam.getParamFormat()); |
| | | DateTimeFormatter.ofPattern(standardPattern); |
| | | baseParam.setParamFormat(standardPattern); |
| | | } catch (Exception e) { |
| | |
| | | } |
| | | } |
| | | return prefix + String.format("%04d", nextNum); |
| | | } |
| | | |
| | | /** |
| | | * 日期格式化 |
| | | */ |
| | | private String normalizePattern(String pattern) { |
| | | if (StringUtils.isEmpty(pattern)) return "yyyy-MM-dd"; |
| | | return pattern.replace("YYYY", "yyyy") |
| | | .replace("DD", "dd") |
| | | .replace("SS", "ss"); |
| | | } |
| | | |
| | | /** |
| | | * 转换为全大写显示 |
| | | */ |
| | | private String toUpperCasePattern(String pattern) { |
| | | if (StringUtils.isEmpty(pattern)) return ""; |
| | | return pattern.replace("yyyy", "YYYY") |
| | | .replace("dd", "DD") |
| | | .replace("ss", "SS"); |
| | | } |
| | | |
| | | @Override |