zxl
2025-12-02 4f2c9b54c8d0f358f3b7c6821f091a493b24e006
ycl-server/src/main/java/com/ycl/platform/service/impl/CheckTemplateServiceImpl.java
@@ -166,7 +166,18 @@
        checkTemplateMapper.updateCheckTemplate(checkTemplate);
        return i;
    }
    public static BigDecimal safeConvert(String str) {
        // 处理空值/空字符串
        if (str == null || str.trim().isEmpty()) {
            return BigDecimal.ZERO;
        }
        try {
            return new BigDecimal(str.trim());
        } catch (NumberFormatException e) {
            System.out.println("字符串格式非法,无法转为BigDecimal:" + str);
            return BigDecimal.ZERO;
        }
    }
    /**
     * 修改考核模板
     *
@@ -178,6 +189,8 @@
    public AjaxResult updateCheckTemplate(CheckTemplateQuery checkTemplateDTO) throws SchedulerException, TaskException {
        CheckTemplate checkTemplate = new CheckTemplate();
        BeanUtils.copyProperties(checkTemplateDTO, checkTemplate);
        BigDecimal bigDecimal = safeConvert(checkTemplateDTO.getAlarmScore());
        checkTemplate.setAlarmScore(bigDecimal);
        checkTemplate.setUpdateUserName(SecurityUtils.getUsername());
        List<Integer> deptId = checkTemplateDTO.getDeptId();
        Collections.sort(deptId);