TestIscsController.java 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. package com.ktg.iscs.controller;
  2. import cn.hutool.core.convert.Convert;
  3. import cn.hutool.core.lang.Assert;
  4. import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  6. import com.ktg.common.annotation.Log;
  7. import com.ktg.common.core.controller.BaseController;
  8. import com.ktg.common.enums.BusinessType;
  9. import com.ktg.common.pojo.CommonResult;
  10. import com.ktg.common.utils.poi.ExcelUtil;
  11. import com.ktg.common.utils.FingerprintComparisonByImg;
  12. import com.ktg.iscs.domain.TestIscs;
  13. import com.ktg.common.vo.VerificationVO;
  14. import com.ktg.iscs.service.IIsTicketOperLogService;
  15. import com.ktg.iscs.service.ITestIscsService;
  16. import io.swagger.annotations.Api;
  17. import io.swagger.annotations.ApiOperation;
  18. import io.swagger.v3.oas.annotations.Parameter;
  19. import io.swagger.v3.oas.annotations.Parameters;
  20. import org.springframework.beans.factory.annotation.Autowired;
  21. import org.springframework.security.access.prepost.PreAuthorize;
  22. import org.springframework.web.bind.annotation.*;
  23. import javax.servlet.http.HttpServletResponse;
  24. import java.util.Arrays;
  25. import java.util.HashSet;
  26. import java.util.List;
  27. /**
  28. * 测试用Controller
  29. *
  30. * @author cgj
  31. * @date 2024-12-18
  32. */
  33. @Api(tags = "测试用")
  34. @RestController
  35. @RequestMapping("/iscs/iscs")
  36. public class TestIscsController extends BaseController
  37. {
  38. @Autowired
  39. private ITestIscsService testIscsService;
  40. @Autowired
  41. private IIsTicketOperLogService isTicketOperLogService;
  42. /**
  43. * 查询测试用分页
  44. */
  45. @ApiOperation("查询测试用-分页")
  46. @Parameters({
  47. @Parameter(name = "page", description = "Page"),
  48. @Parameter(name = "testIscs", description = "实体参数")
  49. })
  50. @PreAuthorize("@ss.hasPermi('iscs:iscs:list')")
  51. @GetMapping("/getTestIscsPage")
  52. public CommonResult<Page<TestIscs>> getTestIscsPage(Page<TestIscs> page, TestIscs testIscs)
  53. {
  54. Page<TestIscs> result = testIscsService.page(page, Wrappers.<TestIscs>lambdaQuery()
  55. .orderByDesc(TestIscs::getId));
  56. return CommonResult.success(result);
  57. }
  58. /**
  59. * 导出测试用列表
  60. */
  61. @ApiOperation("导出测试用列表")
  62. @Parameter(name = "testIscs", description = "实体参数")
  63. @PreAuthorize("@ss.hasPermi('iscs:iscs:export')")
  64. @Log(title = "测试用", businessType = BusinessType.EXPORT)
  65. @PostMapping("/exportTestIscs")
  66. public void exportTestIscs(HttpServletResponse response, TestIscs testIscs)
  67. {
  68. Page<TestIscs> page = new Page<>();
  69. page.setSize(-1);
  70. page.setCurrent(1);
  71. List<TestIscs> list = testIscsService.page(page, Wrappers.<TestIscs>lambdaQuery()
  72. .orderByDesc(TestIscs::getId)).getRecords();
  73. ExcelUtil<TestIscs> util = new ExcelUtil<TestIscs>(TestIscs.class);
  74. util.exportExcel(response, list, "测试用数据");
  75. }
  76. /**
  77. * 获取测试用详细信息
  78. */
  79. @ApiOperation("获取测试用详细信息")
  80. @Parameter(name = "id", description = "id")
  81. @PreAuthorize("@ss.hasPermi('iscs:iscs:query')")
  82. @GetMapping(value = "/selectTestIscsById")
  83. public CommonResult<TestIscs> selectTestIscsById(Long id)
  84. {
  85. return CommonResult.success(testIscsService.getById(id));
  86. }
  87. /**
  88. * 新增测试用
  89. */
  90. @ApiOperation("新增测试用")
  91. @PreAuthorize("@ss.hasPermi('iscs:iscs:add')")
  92. @Log(title = "测试用", businessType = BusinessType.INSERT)
  93. @PostMapping("/insertTestIscs")
  94. public CommonResult<Boolean> insertTestIscs(@RequestBody @Parameter(name = "testIscs", description = "新增数据类,放到body") TestIscs testIscs)
  95. {
  96. return CommonResult.success(testIscsService.save(testIscs));
  97. }
  98. /**
  99. * 修改测试用
  100. */
  101. @ApiOperation("修改测试用")
  102. @PreAuthorize("@ss.hasPermi('iscs:iscs:edit')")
  103. @Log(title = "测试用", businessType = BusinessType.UPDATE)
  104. @PostMapping("/updateTestIscs")
  105. public CommonResult<Boolean> updateTestIscs(@RequestBody @Parameter(name = "testIscs", description = "修改数据类,放到body") TestIscs testIscs)
  106. {
  107. return CommonResult.success(testIscsService.updateById(testIscs));
  108. }
  109. /**
  110. * 删除测试用
  111. */
  112. @ApiOperation("删除测试用")
  113. @PreAuthorize("@ss.hasPermi('iscs:iscs:remove')")
  114. @Log(title = "测试用", businessType = BusinessType.DELETE)
  115. @PostMapping("/deleteTestIscsByIds")
  116. public CommonResult<Boolean> deleteTestIscsByIds(String ids)
  117. {
  118. Assert.notBlank(ids, "请选择需要删除的数据!");
  119. Long[] longIds = Convert.toLongArray(ids);
  120. return CommonResult.success(testIscsService.removeBatchByIds(Arrays.asList(longIds)));
  121. }
  122. @ApiOperation("指纹测试-----------")
  123. @GetMapping(value = "/testFingerprint")
  124. public CommonResult<VerificationVO> testFingerprint(String a, String b) {
  125. // a = "C:\\Users\\车车\\Desktop\\指纹\\6.png";
  126. // b = "C:\\Users\\车车\\Desktop\\指纹\\1.jpg,C:\\Users\\车车\\Desktop\\指纹\\2.jpg,C:\\Users\\车车\\Desktop\\指纹\\3.jpg,C:\\Users\\车车\\Desktop\\指纹\\4.jpg,C:\\Users\\车车\\Desktop\\指纹\\5.png,C:\\Users\\车车\\Desktop\\指纹\\6.png,C:\\Users\\车车\\Desktop\\指纹\\7.jpg";
  127. String[] strArray = Convert.toStrArray(b);
  128. List<String> list = Arrays.asList(strArray);
  129. VerificationVO verificationVO = FingerprintComparisonByImg.completableFutureComparison(a, new HashSet<>(list));
  130. return CommonResult.success(verificationVO);
  131. }
  132. @ApiOperation("测试websocket-----------")
  133. @GetMapping(value = "/testWebsocketLog")
  134. public CommonResult<Boolean> testWebsocketLog(Long id, String name) {
  135. Boolean b = isTicketOperLogService.addLog1(id, name);
  136. return CommonResult.success(b);
  137. }
  138. }