From b5e60923aadb061f60ca6881c564190445cdc691 Mon Sep 17 00:00:00 2001 From: tianwenbo Date: Fri, 10 Mar 2023 13:44:58 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90fix=20sonar=E3=80=91=20JobCodeControll?= =?UTF-8?q?er.java=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/JobCodeController.java | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/jero-boot/jero-cloud-module/jero-cloud-xxljob/src/main/java/com/xxl/job/admin/controller/JobCodeController.java b/jero-boot/jero-cloud-module/jero-cloud-xxljob/src/main/java/com/xxl/job/admin/controller/JobCodeController.java index fe4a0e84..b1eb7365 100644 --- a/jero-boot/jero-cloud-module/jero-cloud-xxljob/src/main/java/com/xxl/job/admin/controller/JobCodeController.java +++ b/jero-boot/jero-cloud-module/jero-cloud-xxljob/src/main/java/com/xxl/job/admin/controller/JobCodeController.java @@ -24,7 +24,7 @@ import java.util.List; @Controller @RequestMapping("/jobcode") public class JobCodeController { - + @Resource private XxlJobInfoDao xxlJobInfoDao; @Resource @@ -52,34 +52,34 @@ public class JobCodeController { model.addAttribute("jobLogGlues", jobLogGlues); return "jobcode/jobcode.index"; } - + @RequestMapping("/save") @ResponseBody public ReturnT save(Model model, int id, String glueSource, String glueRemark) { // valid if (glueRemark==null) { - return new ReturnT(500, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_glue_remark")) ); + return new ReturnT<>(500, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_glue_remark")) ); } if (glueRemark.length()<4 || glueRemark.length()>100) { - return new ReturnT(500, I18nUtil.getString("jobinfo_glue_remark_limit")); + return new ReturnT<>(500, I18nUtil.getString("jobinfo_glue_remark_limit")); } - XxlJobInfo exists_jobInfo = xxlJobInfoDao.loadById(id); - if (exists_jobInfo == null) { - return new ReturnT(500, I18nUtil.getString("jobinfo_glue_jobid_unvalid")); + XxlJobInfo existsJobInfo = xxlJobInfoDao.loadById(id); + if (existsJobInfo == null) { + return new ReturnT<>(500, I18nUtil.getString("jobinfo_glue_jobid_unvalid")); } - - // update new code - exists_jobInfo.setGlueSource(glueSource); - exists_jobInfo.setGlueRemark(glueRemark); - exists_jobInfo.setGlueUpdatetime(new Date()); - exists_jobInfo.setUpdateTime(new Date()); - xxlJobInfoDao.update(exists_jobInfo); + // update new code + existsJobInfo.setGlueSource(glueSource); + existsJobInfo.setGlueRemark(glueRemark); + existsJobInfo.setGlueUpdatetime(new Date()); + + existsJobInfo.setUpdateTime(new Date()); + xxlJobInfoDao.update(existsJobInfo); // log old code XxlJobLogGlue xxlJobLogGlue = new XxlJobLogGlue(); - xxlJobLogGlue.setJobId(exists_jobInfo.getId()); - xxlJobLogGlue.setGlueType(exists_jobInfo.getGlueType()); + xxlJobLogGlue.setJobId(existsJobInfo.getId()); + xxlJobLogGlue.setGlueType(existsJobInfo.getGlueType()); xxlJobLogGlue.setGlueSource(glueSource); xxlJobLogGlue.setGlueRemark(glueRemark); @@ -88,9 +88,9 @@ public class JobCodeController { xxlJobLogGlueDao.save(xxlJobLogGlue); // remove code backup more than 30 - xxlJobLogGlueDao.removeOld(exists_jobInfo.getId(), 30); + xxlJobLogGlueDao.removeOld(existsJobInfo.getId(), 30); return ReturnT.SUCCESS; } - + }