【fix sonar】 JobCodeController.java文件

This commit is contained in:
tianwenbo
2023-03-10 13:44:58 +08:00
parent dae47b7a95
commit b5e60923aa
@@ -58,28 +58,28 @@ public class JobCodeController {
public ReturnT<String> save(Model model, int id, String glueSource, String glueRemark) { public ReturnT<String> save(Model model, int id, String glueSource, String glueRemark) {
// valid // valid
if (glueRemark==null) { if (glueRemark==null) {
return new ReturnT<String>(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) { if (glueRemark.length()<4 || glueRemark.length()>100) {
return new ReturnT<String>(500, I18nUtil.getString("jobinfo_glue_remark_limit")); return new ReturnT<>(500, I18nUtil.getString("jobinfo_glue_remark_limit"));
} }
XxlJobInfo exists_jobInfo = xxlJobInfoDao.loadById(id); XxlJobInfo existsJobInfo = xxlJobInfoDao.loadById(id);
if (exists_jobInfo == null) { if (existsJobInfo == null) {
return new ReturnT<String>(500, I18nUtil.getString("jobinfo_glue_jobid_unvalid")); return new ReturnT<>(500, I18nUtil.getString("jobinfo_glue_jobid_unvalid"));
} }
// update new code // update new code
exists_jobInfo.setGlueSource(glueSource); existsJobInfo.setGlueSource(glueSource);
exists_jobInfo.setGlueRemark(glueRemark); existsJobInfo.setGlueRemark(glueRemark);
exists_jobInfo.setGlueUpdatetime(new Date()); existsJobInfo.setGlueUpdatetime(new Date());
exists_jobInfo.setUpdateTime(new Date()); existsJobInfo.setUpdateTime(new Date());
xxlJobInfoDao.update(exists_jobInfo); xxlJobInfoDao.update(existsJobInfo);
// log old code // log old code
XxlJobLogGlue xxlJobLogGlue = new XxlJobLogGlue(); XxlJobLogGlue xxlJobLogGlue = new XxlJobLogGlue();
xxlJobLogGlue.setJobId(exists_jobInfo.getId()); xxlJobLogGlue.setJobId(existsJobInfo.getId());
xxlJobLogGlue.setGlueType(exists_jobInfo.getGlueType()); xxlJobLogGlue.setGlueType(existsJobInfo.getGlueType());
xxlJobLogGlue.setGlueSource(glueSource); xxlJobLogGlue.setGlueSource(glueSource);
xxlJobLogGlue.setGlueRemark(glueRemark); xxlJobLogGlue.setGlueRemark(glueRemark);
@@ -88,7 +88,7 @@ public class JobCodeController {
xxlJobLogGlueDao.save(xxlJobLogGlue); xxlJobLogGlueDao.save(xxlJobLogGlue);
// remove code backup more than 30 // remove code backup more than 30
xxlJobLogGlueDao.removeOld(exists_jobInfo.getId(), 30); xxlJobLogGlueDao.removeOld(existsJobInfo.getId(), 30);
return ReturnT.SUCCESS; return ReturnT.SUCCESS;
} }