TAuditController.java 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. package com.ruoyi.web.controller.rc;
  2. import java.math.BigDecimal;
  3. import java.math.BigInteger;
  4. import java.math.RoundingMode;
  5. import java.text.SimpleDateFormat;
  6. import java.util.Calendar;
  7. import java.util.Date;
  8. import java.util.HashMap;
  9. import java.util.List;
  10. import javax.servlet.http.HttpServletResponse;
  11. import com.ruoyi.common.core.domain.entity.SysDept;
  12. import com.ruoyi.common.core.domain.entity.SysUser;
  13. import com.ruoyi.common.core.domain.model.LoginUser;
  14. import com.ruoyi.common.utils.StringUtils;
  15. import com.ruoyi.rc.domain.*;
  16. import com.ruoyi.rc.mapper.TAuditMapper;
  17. import com.ruoyi.rc.service.*;
  18. import com.ruoyi.system.service.ISysDeptService;
  19. import org.springframework.security.access.prepost.PreAuthorize;
  20. import org.springframework.beans.factory.annotation.Autowired;
  21. import org.springframework.web.bind.annotation.GetMapping;
  22. import org.springframework.web.bind.annotation.PostMapping;
  23. import org.springframework.web.bind.annotation.PutMapping;
  24. import org.springframework.web.bind.annotation.DeleteMapping;
  25. import org.springframework.web.bind.annotation.PathVariable;
  26. import org.springframework.web.bind.annotation.RequestBody;
  27. import org.springframework.web.bind.annotation.RequestMapping;
  28. import org.springframework.web.bind.annotation.RestController;
  29. import com.ruoyi.common.annotation.Log;
  30. import com.ruoyi.common.core.controller.BaseController;
  31. import com.ruoyi.common.core.domain.AjaxResult;
  32. import com.ruoyi.common.enums.BusinessType;
  33. import com.ruoyi.common.utils.poi.ExcelUtil;
  34. import com.ruoyi.common.core.page.TableDataInfo;
  35. import sun.util.resources.cldr.es.CalendarData_es_AR;
  36. /**
  37. * 审计记录Controller
  38. *
  39. * @author ruoyi
  40. * @date 2024-07-19
  41. */
  42. @RestController
  43. @RequestMapping("/rc/audit")
  44. public class TAuditController extends BaseController
  45. {
  46. @Autowired
  47. private ITAuditService tAuditService;
  48. @Autowired
  49. private ISysDeptService deptService;
  50. @Autowired
  51. private ITChapterService tChapterService;
  52. @Autowired
  53. private ITQuestionnaireService tQuestionnaireService;
  54. @Autowired
  55. private ITChapterTemplateService tChapterTemplateService;
  56. @Autowired
  57. private ITQuestionnaireTemplateService tQuestionnaireTemplateService;
  58. @Autowired
  59. private ITProgressService tProgressService;
  60. @Autowired
  61. private ITOpenItemService itOpenItemService;
  62. @Autowired
  63. private TAuditMapper tAuditMapper;
  64. /**
  65. * 查询最近一次审计信息
  66. *
  67. * @return
  68. */
  69. @GetMapping("/getRecentAudit")
  70. public AjaxResult getRecentAudit() {
  71. TAudit audit = new TAudit();
  72. audit.setDeptId(getLoginUser().getDeptId().toString());
  73. return AjaxResult.success(tAuditService.selectTAuditLatest(audit));
  74. }
  75. /**
  76. * 查询装置下次审计时间列表
  77. */
  78. @GetMapping("/getNextAuditTimeList")
  79. public AjaxResult getNextAuditTimeList() {
  80. HashMap<String, String> map = new HashMap<>();
  81. List<TAudit> tAudits = tAuditMapper.selectNextAuditTimeList();
  82. for (TAudit tAudit : tAudits) {
  83. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  84. map.put(tAudit.getDeptId(), sdf.format(tAudit.getAuditTime()));
  85. }
  86. return success(map);
  87. }
  88. /**
  89. * 查询装置上次审计时间列表
  90. */
  91. @GetMapping("/getLastAuditTimeList")
  92. public AjaxResult getLastAuditTimeList() {
  93. HashMap<String, String> map = new HashMap<>();
  94. List<TAudit> tAudits = tAuditMapper.selectLastAuditTimeList();
  95. for (TAudit tAudit : tAudits) {
  96. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  97. map.put(tAudit.getDeptId(), sdf.format(tAudit.getAuditTime()));
  98. }
  99. return success(map);
  100. }
  101. /**
  102. * 查询当前年份审计装置列表
  103. */
  104. @GetMapping("/getAuditDeptList")
  105. public AjaxResult getAuditDeptList() {
  106. TAudit audit = new TAudit();
  107. Calendar calendar = Calendar.getInstance();
  108. int i = calendar.get(Calendar.YEAR);
  109. audit.setYear(i+"");
  110. List<TAudit> tAudits = tAuditMapper.selectAllTAuditList(audit);
  111. return success(tAudits);
  112. }
  113. /**
  114. * 上级领导页面:查询首页顶部四个方框数据
  115. */
  116. @GetMapping("/homeData")
  117. public AjaxResult getHomeData() {
  118. HashMap map = new HashMap();
  119. // 当前登录用户所在部门最近一次审计记录
  120. TAudit audit = new TAudit();
  121. audit.setDeptId(getLoginUser().getDeptId().toString());
  122. TAudit latest = tAuditService.selectTAuditLatest(audit);
  123. if (latest != null) {
  124. Long auditId = latest.getId();
  125. int homeData1 = tAuditMapper.selectHomeData1();
  126. BigDecimal homeData2 = tAuditMapper.selectHomeData2();
  127. int homeData3 = tAuditMapper.selectHomeData3(auditId);
  128. int homeData4 = tAuditMapper.selectHomeData4(auditId);
  129. map.put("homeData1", homeData1);
  130. map.put("homeData2", homeData2);
  131. map.put("homeData3", homeData3);
  132. map.put("homeData4", homeData4);
  133. return AjaxResult.success(map);
  134. } else {
  135. return AjaxResult.success();
  136. }
  137. }
  138. /**
  139. * 普通员工页面:查询首页柱状图数据
  140. */
  141. @GetMapping("/bar")
  142. public AjaxResult getBar() {
  143. TAudit audit = new TAudit();
  144. audit.setDeptId(getLoginUser().getDeptId().toString());
  145. TAudit latest = tAuditService.selectTAuditLatest(audit);
  146. HashMap<String, String> map = new HashMap<String, String>();
  147. if(latest != null) {
  148. int code0Count = 0;
  149. int code1Count = 0;
  150. int code2Count = 0;
  151. int code3Count = 0;
  152. int code4Count = 0;
  153. int code5Count = 0;
  154. int code6Count = 0;
  155. int code7Count = 0;
  156. int code8Count = 0;
  157. int code9Count = 0;
  158. int code0CompleteCount = 0;
  159. int code1CompleteCount = 0;
  160. int code2CompleteCount = 0;
  161. int code3CompleteCount = 0;
  162. int code4CompleteCount = 0;
  163. int code5CompleteCount = 0;
  164. int code6CompleteCount = 0;
  165. int code7CompleteCount = 0;
  166. int code8CompleteCount = 0;
  167. int code9CompleteCount = 0;
  168. BigDecimal code0CompleteProgress = new BigDecimal(BigInteger.ZERO);
  169. BigDecimal code1CompleteProgress = new BigDecimal(BigInteger.ZERO);
  170. BigDecimal code2CompleteProgress = new BigDecimal(BigInteger.ZERO);
  171. BigDecimal code3CompleteProgress = new BigDecimal(BigInteger.ZERO);
  172. BigDecimal code4CompleteProgress = new BigDecimal(BigInteger.ZERO);
  173. BigDecimal code5CompleteProgress = new BigDecimal(BigInteger.ZERO);
  174. BigDecimal code6CompleteProgress = new BigDecimal(BigInteger.ZERO);
  175. BigDecimal code7CompleteProgress = new BigDecimal(BigInteger.ZERO);
  176. BigDecimal code8CompleteProgress = new BigDecimal(BigInteger.ZERO);
  177. BigDecimal code9CompleteProgress = new BigDecimal(BigInteger.ZERO);
  178. Long auditId = latest.getId();
  179. TChapter chapter = new TChapter();
  180. chapter.setAuditId(auditId);
  181. List<TChapter> tChapters = tChapterService.selectTChapterList(chapter);
  182. for (TChapter tChapter : tChapters) {
  183. String code = tChapter.getCode();
  184. int index = code.indexOf(".");
  185. if (index != -1) {
  186. code = code.substring(0, index);
  187. TQuestionnaire questionnaire = new TQuestionnaire();
  188. questionnaire.setChapterId(tChapter.getId());
  189. List<TQuestionnaire> tQuestionnaires = tQuestionnaireService.selectTQuestionnaireList(questionnaire);
  190. for (TQuestionnaire tQuestionnaire : tQuestionnaires) {
  191. boolean flag = "1".equals(tQuestionnaire.getCompletionStatus());
  192. switch (code) {
  193. case "0": code0Count++; if (flag) {code0CompleteCount++;} break;
  194. case "1": code1Count++; if (flag) {code1CompleteCount++;} break;
  195. case "2": code2Count++; if (flag) {code2CompleteCount++;} break;
  196. case "3": code3Count++; if (flag) {code3CompleteCount++;} break;
  197. case "5": code4Count++; if (flag) {code4CompleteCount++;} break;
  198. case "6": code5Count++; if (flag) {code5CompleteCount++;} break;
  199. case "7": code6Count++; if (flag) {code6CompleteCount++;} break;
  200. case "8": code7Count++; if (flag) {code7CompleteCount++;} break;
  201. case "9": code8Count++; if (flag) {code8CompleteCount++;} break;
  202. case "10": code9Count++; if (flag) {code9CompleteCount++;} break;
  203. }
  204. }
  205. }
  206. }
  207. if (code0Count != 0) {code0CompleteProgress = new BigDecimal(code0CompleteCount).divide(new BigDecimal(code0Count), 4, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.TEN).multiply(BigDecimal.TEN);}
  208. if (code1Count != 0) {code1CompleteProgress = new BigDecimal(code1CompleteCount).divide(new BigDecimal(code1Count), 4, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.TEN).multiply(BigDecimal.TEN);}
  209. if (code2Count != 0) {code2CompleteProgress = new BigDecimal(code2CompleteCount).divide(new BigDecimal(code2Count), 4, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.TEN).multiply(BigDecimal.TEN);}
  210. if (code3Count != 0) {code3CompleteProgress = new BigDecimal(code3CompleteCount).divide(new BigDecimal(code3Count), 4, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.TEN).multiply(BigDecimal.TEN);}
  211. if (code4Count != 0) {code4CompleteProgress = new BigDecimal(code4CompleteCount).divide(new BigDecimal(code4Count), 4, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.TEN).multiply(BigDecimal.TEN);}
  212. if (code5Count != 0) {code5CompleteProgress = new BigDecimal(code5CompleteCount).divide(new BigDecimal(code5Count), 4, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.TEN).multiply(BigDecimal.TEN);}
  213. if (code6Count != 0) {code6CompleteProgress = new BigDecimal(code6CompleteCount).divide(new BigDecimal(code6Count), 4, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.TEN).multiply(BigDecimal.TEN);}
  214. if (code7Count != 0) {code7CompleteProgress = new BigDecimal(code7CompleteCount).divide(new BigDecimal(code7Count), 4, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.TEN).multiply(BigDecimal.TEN);}
  215. if (code8Count != 0) {code8CompleteProgress = new BigDecimal(code8CompleteCount).divide(new BigDecimal(code8Count), 4, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.TEN).multiply(BigDecimal.TEN);}
  216. if (code9Count != 0) {code9CompleteProgress = new BigDecimal(code9CompleteCount).divide(new BigDecimal(code9Count), 4, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.TEN).multiply(BigDecimal.TEN);}
  217. map.put("code0", code0CompleteProgress.toString());
  218. map.put("code1", code1CompleteProgress.toString());
  219. map.put("code2", code2CompleteProgress.toString());
  220. map.put("code3", code3CompleteProgress.toString());
  221. map.put("code5", code4CompleteProgress.toString());
  222. map.put("code6", code5CompleteProgress.toString());
  223. map.put("code7", code6CompleteProgress.toString());
  224. map.put("code8", code7CompleteProgress.toString());
  225. map.put("code9", code8CompleteProgress.toString());
  226. map.put("code10", code9CompleteProgress.toString());
  227. map.put("auditId", latest.getId().toString());
  228. } else {
  229. map.put("code0", "0");
  230. map.put("code1", "0");
  231. map.put("code2", "0");
  232. map.put("code3", "0");
  233. map.put("code5", "0");
  234. map.put("code6", "0");
  235. map.put("code7", "0");
  236. map.put("code8", "0");
  237. map.put("code9", "0");
  238. map.put("code10", "0");
  239. }
  240. return success(map);
  241. }
  242. /**
  243. * 普通员工页面:查询首页饼图数据
  244. */
  245. @GetMapping("/pie")
  246. public AjaxResult getPie() {
  247. // int count = 0;
  248. // int completeCount = 0;
  249. // BigDecimal progress = new BigDecimal(BigInteger.ZERO);
  250. // TAudit audit = new TAudit();
  251. // audit.setDeptId(getLoginUser().getDeptId().toString());
  252. // TAudit latest = tAuditService.selectTAuditLatest(audit);
  253. // if (latest != null) {
  254. // Long auditId = latest.getId();
  255. // TChapter chapter = new TChapter();
  256. // chapter.setAuditId(auditId);
  257. // List<TChapter> tChapters = tChapterService.selectTChapterList(chapter);
  258. // for (TChapter tChapter : tChapters) {
  259. // TQuestionnaire questionnaire = new TQuestionnaire();
  260. // questionnaire.setChapterId(tChapter.getId());
  261. // List<TQuestionnaire> tQuestionnaires = tQuestionnaireService.selectTQuestionnaireList(questionnaire);
  262. // for (TQuestionnaire tQuestionnaire : tQuestionnaires) {
  263. // TOpenItem openItem = new TOpenItem();
  264. // openItem.setQuestionnaireId(tQuestionnaire.getId());
  265. // List<TOpenItem> tOpenItems = itOpenItemService.selectTOpenItemList(openItem);
  266. // for (TOpenItem tOpenItem : tOpenItems) {
  267. // count++;
  268. // String status = tOpenItem.getStatus();
  269. // if ("4".equals(status)) {
  270. // completeCount++;
  271. // }
  272. // }
  273. // }
  274. // }
  275. // if (count != 0) {
  276. // progress = new BigDecimal(completeCount).divide(new BigDecimal(count), 4, BigDecimal.ROUND_HALF_UP);
  277. // }
  278. //
  279. // }
  280. TAudit audit = new TAudit();
  281. audit.setDeptId(getLoginUser().getDeptId().toString());
  282. TAudit latest = tAuditService.selectTAuditLatest(audit);
  283. Double result = new Double("0");
  284. if (latest != null) {
  285. result = tAuditMapper.selectHomeDataPie(latest.getId());
  286. }
  287. return success(result);
  288. }
  289. /**
  290. * 查询当前登录用户所在部门最近一次审计记录
  291. */
  292. @GetMapping("/current")
  293. public AjaxResult getCurrent() {
  294. TAudit audit = new TAudit();
  295. audit.setDeptId(getLoginUser().getDeptId().toString());
  296. TAudit latest = tAuditService.selectTAuditLatest(audit);
  297. return success(latest);
  298. }
  299. /**
  300. * 查询审计记录列表
  301. */
  302. @PreAuthorize("@ss.hasPermi('rc:audit:list')")
  303. @GetMapping("/list")
  304. public TableDataInfo list(TAudit tAudit)
  305. {
  306. startPage();
  307. List<TAudit> list = tAuditService.selectTAuditList(tAudit);
  308. for (TAudit obj : list) {
  309. String deptId = obj.getDeptId();
  310. if (StringUtils.isNotEmpty(deptId)) {
  311. if (deptId.indexOf(",") != -1) {
  312. StringBuffer sb = new StringBuffer();
  313. String[] ids = deptId.split(",");
  314. for (String id : ids) {
  315. SysDept sysDept = deptService.selectDeptById(Long.parseLong(id));
  316. sb.append(sysDept.getDeptName()).append(" / ");
  317. }
  318. obj.setDeptName(sb.toString().substring(0, sb.length() - 3));
  319. } else {
  320. obj.setDeptName(deptService.selectDeptById(Long.parseLong(deptId)).getDeptName());
  321. }
  322. }
  323. }
  324. return getDataTable(list);
  325. }
  326. /**
  327. * 查询审计记录列表(全部)
  328. */
  329. @PreAuthorize("@ss.hasPermi('rc:audit:list')")
  330. @GetMapping("/listAll")
  331. public AjaxResult listAll(TAudit tAudit)
  332. {
  333. List<TAudit> list = tAuditService.selectTAuditList(tAudit);
  334. for (TAudit obj : list) {
  335. String deptId = obj.getDeptId();
  336. if (StringUtils.isNotEmpty(deptId)) {
  337. if (deptId.indexOf(",") != -1) {
  338. StringBuffer sb = new StringBuffer();
  339. String[] ids = deptId.split(",");
  340. for (String id : ids) {
  341. SysDept sysDept = deptService.selectDeptById(Long.parseLong(id));
  342. sb.append(sysDept.getDeptName()).append(" / ");
  343. }
  344. obj.setDeptName(sb.toString().substring(0, sb.length() - 3));
  345. } else {
  346. obj.setDeptName(deptService.selectDeptById(Long.parseLong(deptId)).getDeptName());
  347. }
  348. }
  349. }
  350. return AjaxResult.success(list);
  351. }
  352. /**
  353. * 导出审计记录列表
  354. */
  355. @PreAuthorize("@ss.hasPermi('rc:audit:export')")
  356. @Log(title = "审计记录", businessType = BusinessType.EXPORT)
  357. @PostMapping("/export")
  358. public void export(HttpServletResponse response, TAudit tAudit)
  359. {
  360. List<TAudit> list = tAuditService.selectTAuditList(tAudit);
  361. ExcelUtil<TAudit> util = new ExcelUtil<TAudit>(TAudit.class);
  362. util.exportExcel(response, list, "审计记录数据");
  363. }
  364. /**
  365. * 获取审计记录详细信息
  366. */
  367. @PreAuthorize("@ss.hasPermi('rc:audit:query')")
  368. @GetMapping(value = "/{id}")
  369. public AjaxResult getInfo(@PathVariable("id") Long id)
  370. {
  371. TAudit tAudit = tAuditService.selectTAuditById(id);
  372. String year = tAudit.getYear();
  373. if (year.length() > 4) {
  374. tAudit.setYear(year.substring(0, year.indexOf("-")));
  375. }
  376. return success(tAudit);
  377. }
  378. /**
  379. * 新增审计记录
  380. */
  381. @PreAuthorize("@ss.hasPermi('rc:audit:add')")
  382. @Log(title = "审计记录", businessType = BusinessType.INSERT)
  383. @PostMapping
  384. public AjaxResult add(@RequestBody TAudit tAudit)
  385. {
  386. if (StringUtils.isNull(tAudit.getDeptId()) || "".equals(tAudit.getDeptId())) {
  387. tAudit.setDeptId(getLoginUser().getDeptId().toString());
  388. }
  389. int result = tAuditService.insertTAudit(tAudit);
  390. // 章节list
  391. List<TChapterTemplate> tChapterTemplates = tChapterTemplateService.selectTChapterTemplateList(new TChapterTemplate());
  392. for (TChapterTemplate tChapterTemplate : tChapterTemplates) {
  393. // 新增章节
  394. TChapter chapter = new TChapter();
  395. chapter.setAuditId(tAudit.getId());
  396. chapter.setCode(tChapterTemplate.getCode());
  397. chapter.setName(tChapterTemplate.getName());
  398. chapter.setDeptId(tAudit.getDeptId());
  399. tChapterService.insertTChapter(chapter);
  400. TQuestionnaireTemplate questionnaireTemplate = new TQuestionnaireTemplate();
  401. questionnaireTemplate.setChapterId(tChapterTemplate.getId());
  402. // 每个章节对应的问卷list
  403. List<TQuestionnaireTemplate> tQuestionnaireTemplates = tQuestionnaireTemplateService.selectTQuestionnaireTemplateList(questionnaireTemplate);
  404. for (TQuestionnaireTemplate tQuestionnaireTemplate : tQuestionnaireTemplates) {
  405. // 新增问卷
  406. TQuestionnaire questionnaire = new TQuestionnaire();
  407. questionnaire.setAuditId(tAudit.getId());
  408. questionnaire.setChapterId(chapter.getId());
  409. questionnaire.setType(tQuestionnaireTemplate.getType());
  410. questionnaire.setDirectory(tQuestionnaireTemplate.getDirectory());
  411. questionnaire.setCode(tQuestionnaireTemplate.getCode());
  412. questionnaire.setName(tQuestionnaireTemplate.getName());
  413. questionnaire.setDeptId(tAudit.getDeptId());
  414. questionnaire.setCompletionStatus("2");
  415. questionnaire.setYear(tAudit.getYear());
  416. tQuestionnaireService.insertTQuestionnaire(questionnaire);
  417. // 新增进度
  418. TProgress progress = new TProgress();
  419. progress.setAuditId(tAudit.getId());
  420. progress.setQuestionnaireId(questionnaire.getId());
  421. progress.setCode(questionnaire.getCode()+"");
  422. progress.setName(questionnaire.getName());
  423. progress.setPreparation("1");
  424. progress.setApplyStatus("1");
  425. String name = chapter.getName();
  426. String code = chapter.getCode();
  427. if (StringUtils.isNotNull(code) && StringUtils.isNotNull(name)) {
  428. int dotNum = this.getDotNum(code);
  429. if (dotNum == 0) {//章节
  430. progress.setSecSubChapName("-");
  431. progress.setSubChapName("-");
  432. progress.setChapName(code + " " + name);
  433. } else if (dotNum == 1) {//细分章节
  434. progress.setSecSubChapName("-");
  435. progress.setSubChapName(code + " " + name);
  436. String chapCode = code.substring(0, code.indexOf("."));
  437. progress.setChapName(chapCode + " " + tChapterTemplateService.selectNameByCode(chapCode));
  438. } else {//二级细分章节
  439. progress.setSecSubChapName(code + " " + name);
  440. String subChapCode = code.substring(0, code.lastIndexOf("."));
  441. progress.setSubChapName(subChapCode + " " + tChapterTemplateService.selectNameByCode(subChapCode));
  442. String chapCode = subChapCode.substring(0, subChapCode.indexOf("."));
  443. progress.setChapName(chapCode + " " + tChapterTemplateService.selectNameByCode(chapCode));
  444. }
  445. }
  446. tProgressService.insertTProgress(progress);
  447. }
  448. }
  449. return toAjax(result);
  450. }
  451. public int getDotNum(String code) {
  452. int num = 0;
  453. int i = code.indexOf(".");
  454. if (i != -1) {
  455. String[] split = code.split("\\.");
  456. num = split.length - 1;
  457. }
  458. return num;
  459. }
  460. /**
  461. * 修改审计记录
  462. */
  463. @PreAuthorize("@ss.hasPermi('rc:audit:edit')")
  464. @Log(title = "审计记录", businessType = BusinessType.UPDATE)
  465. @PutMapping
  466. public AjaxResult edit(@RequestBody TAudit tAudit)
  467. {
  468. return toAjax(tAuditService.updateTAudit(tAudit));
  469. }
  470. /**
  471. * 删除审计记录
  472. */
  473. @PreAuthorize("@ss.hasPermi('rc:audit:remove')")
  474. @Log(title = "审计记录", businessType = BusinessType.DELETE)
  475. @DeleteMapping("/{ids}")
  476. public AjaxResult remove(@PathVariable Long[] ids)
  477. {
  478. return toAjax(tAuditService.deleteTAuditByIds(ids));
  479. }
  480. }