| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- package com.ktg.iscs.controller;
- import cn.hutool.core.convert.Convert;
- import cn.hutool.core.lang.Assert;
- import com.baomidou.mybatisplus.core.toolkit.Wrappers;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import com.ktg.common.annotation.Log;
- import com.ktg.common.core.controller.BaseController;
- import com.ktg.common.enums.BusinessType;
- import com.ktg.common.pojo.CommonResult;
- import com.ktg.common.utils.poi.ExcelUtil;
- import com.ktg.common.utils.FingerprintComparisonByImg;
- import com.ktg.iscs.domain.TestIscs;
- import com.ktg.common.vo.VerificationVO;
- import com.ktg.iscs.service.IIsTicketOperLogService;
- import com.ktg.iscs.service.ITestIscsService;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.v3.oas.annotations.Parameter;
- import io.swagger.v3.oas.annotations.Parameters;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.web.bind.annotation.*;
- import javax.servlet.http.HttpServletResponse;
- import java.util.Arrays;
- import java.util.HashSet;
- import java.util.List;
- /**
- * 测试用Controller
- *
- * @author cgj
- * @date 2024-12-18
- */
- @Api(tags = "测试用")
- @RestController
- @RequestMapping("/iscs/iscs")
- public class TestIscsController extends BaseController
- {
- @Autowired
- private ITestIscsService testIscsService;
- @Autowired
- private IIsTicketOperLogService isTicketOperLogService;
- /**
- * 查询测试用分页
- */
- @ApiOperation("查询测试用-分页")
- @Parameters({
- @Parameter(name = "page", description = "Page"),
- @Parameter(name = "testIscs", description = "实体参数")
- })
- @PreAuthorize("@ss.hasPermi('iscs:iscs:list')")
- @GetMapping("/getTestIscsPage")
- public CommonResult<Page<TestIscs>> getTestIscsPage(Page<TestIscs> page, TestIscs testIscs)
- {
- Page<TestIscs> result = testIscsService.page(page, Wrappers.<TestIscs>lambdaQuery()
- .orderByDesc(TestIscs::getId));
- return CommonResult.success(result);
- }
- /**
- * 导出测试用列表
- */
- @ApiOperation("导出测试用列表")
- @Parameter(name = "testIscs", description = "实体参数")
- @PreAuthorize("@ss.hasPermi('iscs:iscs:export')")
- @Log(title = "测试用", businessType = BusinessType.EXPORT)
- @PostMapping("/exportTestIscs")
- public void exportTestIscs(HttpServletResponse response, TestIscs testIscs)
- {
- Page<TestIscs> page = new Page<>();
- page.setSize(-1);
- page.setCurrent(1);
- List<TestIscs> list = testIscsService.page(page, Wrappers.<TestIscs>lambdaQuery()
- .orderByDesc(TestIscs::getId)).getRecords();
- ExcelUtil<TestIscs> util = new ExcelUtil<TestIscs>(TestIscs.class);
- util.exportExcel(response, list, "测试用数据");
- }
- /**
- * 获取测试用详细信息
- */
- @ApiOperation("获取测试用详细信息")
- @Parameter(name = "id", description = "id")
- @PreAuthorize("@ss.hasPermi('iscs:iscs:query')")
- @GetMapping(value = "/selectTestIscsById")
- public CommonResult<TestIscs> selectTestIscsById(Long id)
- {
- return CommonResult.success(testIscsService.getById(id));
- }
- /**
- * 新增测试用
- */
- @ApiOperation("新增测试用")
- @PreAuthorize("@ss.hasPermi('iscs:iscs:add')")
- @Log(title = "测试用", businessType = BusinessType.INSERT)
- @PostMapping("/insertTestIscs")
- public CommonResult<Boolean> insertTestIscs(@RequestBody @Parameter(name = "testIscs", description = "新增数据类,放到body") TestIscs testIscs)
- {
- return CommonResult.success(testIscsService.save(testIscs));
- }
- /**
- * 修改测试用
- */
- @ApiOperation("修改测试用")
- @PreAuthorize("@ss.hasPermi('iscs:iscs:edit')")
- @Log(title = "测试用", businessType = BusinessType.UPDATE)
- @PostMapping("/updateTestIscs")
- public CommonResult<Boolean> updateTestIscs(@RequestBody @Parameter(name = "testIscs", description = "修改数据类,放到body") TestIscs testIscs)
- {
- return CommonResult.success(testIscsService.updateById(testIscs));
- }
- /**
- * 删除测试用
- */
- @ApiOperation("删除测试用")
- @PreAuthorize("@ss.hasPermi('iscs:iscs:remove')")
- @Log(title = "测试用", businessType = BusinessType.DELETE)
- @PostMapping("/deleteTestIscsByIds")
- public CommonResult<Boolean> deleteTestIscsByIds(String ids)
- {
- Assert.notBlank(ids, "请选择需要删除的数据!");
- Long[] longIds = Convert.toLongArray(ids);
- return CommonResult.success(testIscsService.removeBatchByIds(Arrays.asList(longIds)));
- }
- @ApiOperation("指纹测试-----------")
- @GetMapping(value = "/testFingerprint")
- public CommonResult<VerificationVO> testFingerprint(String a, String b) {
- // a = "C:\\Users\\车车\\Desktop\\指纹\\6.png";
- // 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";
- String[] strArray = Convert.toStrArray(b);
- List<String> list = Arrays.asList(strArray);
- VerificationVO verificationVO = FingerprintComparisonByImg.completableFutureComparison(a, new HashSet<>(list));
- return CommonResult.success(verificationVO);
- }
- @ApiOperation("测试websocket-----------")
- @GetMapping(value = "/testWebsocketLog")
- public CommonResult<Boolean> testWebsocketLog(Long id, String name) {
- Boolean b = isTicketOperLogService.addLog1(id, name);
- return CommonResult.success(b);
- }
- }
|