package com.ltkj.web.controller.readIdCard; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ltkj.common.core.domain.AjaxResult; import com.ltkj.hosp.domain.TjCustomer; import com.ltkj.hosp.service.ITjCustomerService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.List; /** * @Company: 西安路泰科技有限公司 * @Author: zjh * @Date: 2023/2/16 10:20 */ @Api(tags = "读取身份证信息") @RestController @RequestMapping("/read") @Slf4j public class readIdCardController { @Resource private ITjCustomerService customerService; /** * 查询小程序主页轮播图列表 */ @GetMapping @ApiOperation(value = "读取身份证信息接口") public AjaxResult getIdCard() { byte sid[] = new byte[37]; byte name[] = new byte[31]; byte sex[] = new byte[3]; byte folk[] = new byte[10]; byte birth[] = new byte[9]; byte code[] = new byte[19]; byte add[] = new byte[71]; byte agency[] = new byte[31]; byte expirestart[] = new byte[9]; byte expireend[] = new byte[9]; int ret = 0; if (CLibrary.sdtapi.InitComm(1001) == 1) { log.info("connect OK! 连接成功!!!!!"); ret = CLibrary.sdtapi.GetSAMIDToStr(sid); if (ret != 1) { log.info("GetSAMIDToStr=" + ret); return null; } while (true) { ret = CLibrary.sdtapi.Authenticate(); if (ret == 1) { log.info("======================================"); ret = CLibrary.sdtapi.ReadBaseInfosPhoto(name, sex, folk, birth, code, add, agency, expirestart, expireend, null); if (ret != 1) { return AjaxResult.success(null); } // CLibrary.sdtapi.HID_BeepLED(true,true,50); // CLibrary.sdtapi.HID_BeepLED(false,false,50); // CLibrary.sdtapi.HID_BeepLED(true,true,50); String s = new String(name); log.info(s.substring(0, s.length() - 1).trim()); String s1 = new String(sex); log.info(s1.substring(0, s1.length() - 1).trim()); String s2 = new String(folk); log.info(s2.substring(0, s2.length() - 1).trim()); String s3 = new String(birth); log.info(s3.substring(0, s3.length() - 1).trim()); String s4 = new String(code); log.info(s4.substring(0, s4.length() - 1).trim()); String s5 = new String(add); log.info(s5.substring(0, s5.length() - 1).trim()); String s6 = new String(agency); log.info(s6.substring(0, s6.length() - 1).trim()); String s7 = new String(expirestart); log.info(s7.substring(0, s7.length() - 1).trim()); String s8 = new String(expireend); log.info(s8.substring(0, s8.length() - 1).trim()); LambdaQueryWrapper wq = new LambdaQueryWrapper<>(); wq.eq(TjCustomer::getCusIdcard, code); TjCustomer one = customerService.getOne(wq); if (null == one) { log.info("数据库没有" + s.substring(0, s.length() - 1).trim() + "的信息"); } return AjaxResult.success(s.substring(0, s.length() - 1).trim(), one); } } } else { return AjaxResult.error(); } } }