jsk
This commit is contained in:
parent
696f147ef4
commit
dca38f442f
|
|
@ -11,6 +11,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
|
@ -19,7 +20,7 @@ import java.nio.charset.StandardCharsets;
|
|||
public class AesEncryptUtil {
|
||||
private static final Logger log = LoggerFactory.getLogger(AesEncryptUtil.class);
|
||||
private static final String KEY_ALGORITHM = "AES";
|
||||
private static final String AES_ENCRYPT_KEY = "pigxpigxpigxpigx";
|
||||
private static final String AES_ENCRYPT_KEY ="loqvpd0iqazwsxed";// "pigxpigxpigxpigx";
|
||||
|
||||
|
||||
// @Resource
|
||||
|
|
@ -30,12 +31,17 @@ public class AesEncryptUtil {
|
|||
// }
|
||||
|
||||
public static String aesEncrypt(String encryptStr) {
|
||||
if (StrUtil.isBlank(encryptStr)) {
|
||||
return encryptStr;
|
||||
} else {
|
||||
AES aes = new AES(Mode.CBC, Padding.ZeroPadding, new SecretKeySpec(AES_ENCRYPT_KEY.getBytes(), "AES"), new IvParameterSpec(AES_ENCRYPT_KEY.getBytes()));
|
||||
return aes.encryptBase64(encryptStr);
|
||||
try{
|
||||
if (StrUtil.isBlank(encryptStr)) {
|
||||
return encryptStr;
|
||||
} else {
|
||||
AES aes = new AES(Mode.ECB, Padding.PKCS5Padding, new SecretKeySpec(AES_ENCRYPT_KEY.getBytes(), "AES"));
|
||||
return aes.encryptBase64(encryptStr);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return encryptStr;
|
||||
}
|
||||
|
||||
public static String aesDecode(String decodeStr) {
|
||||
|
|
|
|||
|
|
@ -1,39 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-bootstrap:3.1.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter:3.1.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.7.18" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.7.18" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.3.33" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.3.33" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.3.33" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.3.33" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.7.18" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.7.18" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.36" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.17.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.17.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.36" level="project" />
|
||||
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.3.33" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.3.33" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.30" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-context:3.1.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-crypto:5.7.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-commons:3.1.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-rsa:1.0.11.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.69" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.69" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.bouncycastle:bcutil-jdk15on:1.69" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -278,11 +278,6 @@
|
|||
<orderEntry type="library" scope="RUNTIME" name="Maven: io.opentelemetry:opentelemetry-exporter-otlp-common:1.29.0" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: io.opentelemetry:opentelemetry-exporter-common:1.29.0" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: io.opentelemetry:opentelemetry-exporter-sender-okhttp:1.29.0" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: com.squareup.okhttp3:okhttp:4.9.3" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: com.squareup.okio:okio:2.8.0" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.jetbrains.kotlin:kotlin-stdlib:1.6.21" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.jetbrains:annotations:13.0" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi:1.29.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.opentelemetry:opentelemetry-exporter-prometheus:1.29.0-alpha" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.opentelemetry:opentelemetry-exporter-logging:1.29.0" level="project" />
|
||||
|
|
@ -370,6 +365,11 @@
|
|||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-redis:2.7.18" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.redisson:redisson-spring-data-27:3.17.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jsoup:jsoup:1.17.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.squareup.okhttp3:okhttp:4.9.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.squareup.okio:okio:2.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib:1.6.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jetbrains:annotations:13.0" level="project" />
|
||||
<orderEntry type="module-library">
|
||||
<library name="Maven: com.arcsoft.face:arcsoft-sdk-face:3.0.0.0-linux">
|
||||
<CLASSES>
|
||||
|
|
|
|||
|
|
@ -210,6 +210,12 @@
|
|||
<version>1.17.2</version> <!-- 检查最新版本 -->
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.12.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.arcsoft.face</groupId>
|
||||
<artifactId>arcsoft-sdk-face</artifactId>
|
||||
|
|
@ -275,6 +281,10 @@
|
|||
<version>0.0.20131108.vaadin1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,90 @@
|
|||
package com.bonus.canteen.core.certificate.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.canteen.core.certificate.mapper.CertificateReturnManageMapper;
|
||||
import com.bonus.canteen.core.certificate.service.CertificateManageService;
|
||||
import com.bonus.canteen.core.certificate.service.CertificateReturnManageService;
|
||||
import com.bonus.canteen.core.certificate.vo.CertificateInfo;
|
||||
import com.bonus.canteen.core.certificate.vo.CertificateRefill;
|
||||
import com.bonus.canteen.core.config.SmUtils;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Api(tags = "证件信息回填接口")
|
||||
@RestController
|
||||
@RequestMapping("/certificate_refill")
|
||||
public class CertificateRefillController extends BaseController {
|
||||
@Resource
|
||||
private CertificateReturnManageService certificateReturnManageService;
|
||||
|
||||
@Resource
|
||||
private CertificateReturnManageMapper certificateInfoMapper;
|
||||
|
||||
/**
|
||||
* 证件信息回填接口
|
||||
*/
|
||||
@ApiOperation(value = "证件信息回填接口")
|
||||
@GetMapping("/refill")
|
||||
public Map<String, Object> refill(@RequestBody CertificateRefill certificateRefill) {
|
||||
Map<String, Object> map=new HashMap<>();
|
||||
try{
|
||||
String taskcode=certificateRefill.getTaskcode();
|
||||
if("C0201".equals(taskcode)){
|
||||
String params=certificateRefill.getParams();
|
||||
String paramstr= SmUtils.decryptBySm42(params);
|
||||
JSONObject jsonObject = JSONObject.parseObject(paramstr);
|
||||
String taskno=jsonObject.getString("taskno");
|
||||
String actiontype=jsonObject.getString("actiontype");
|
||||
String operaTime=jsonObject.getString("operaTime");
|
||||
String operator=jsonObject.getString("operator");
|
||||
String opeidnumber=jsonObject.getString("opeidnumber");
|
||||
String cardno=jsonObject.getString("cardno");
|
||||
String deviceno=jsonObject.getString("deviceno");
|
||||
String savepos=jsonObject.getString("savepos");
|
||||
CertificateInfo certificateInfo=new CertificateInfo();
|
||||
if(actiontype.contains("Save")){
|
||||
certificateInfo.setCertificateNo(cardno);
|
||||
certificateInfo.setTaskNo(taskno);
|
||||
certificateInfo.setOpeidnumber(opeidnumber);
|
||||
certificateInfo.setOperator(operator);
|
||||
certificateInfo.setOperaTime(operaTime);
|
||||
certificateInfo.setState("2");
|
||||
certificateInfo.setProcessState("1");
|
||||
certificateInfo.setRealProcessDate(operaTime);
|
||||
certificateInfoMapper.updateCertificateSave(certificateInfo);
|
||||
certificateInfoMapper.updateCertificateState(certificateInfo);
|
||||
map.put("Message","执行成功");
|
||||
map.put("Success","1");
|
||||
}else{
|
||||
certificateInfo.setCertificateNo(cardno);
|
||||
certificateInfo.setTaskNo(taskno);
|
||||
certificateInfo.setOpeidnumber(opeidnumber);
|
||||
certificateInfo.setOperator(operator);
|
||||
certificateInfo.setOperaTime(operaTime);
|
||||
certificateInfo.setState("4");
|
||||
certificateInfo.setProcessState("1");
|
||||
certificateInfo.setRealProcessDate(operaTime);
|
||||
certificateInfoMapper.updateCertificateSave(certificateInfo);
|
||||
certificateInfoMapper.updateCertificateState(certificateInfo);
|
||||
map.put("Message","执行成功");
|
||||
map.put("Success","1");
|
||||
}
|
||||
|
||||
}else{
|
||||
map.put("Success","0");
|
||||
map.put("Message","功能代码不正确,回馈接口代码C0201!");
|
||||
}
|
||||
}catch (Exception e){
|
||||
map.put("Success","0");
|
||||
map.put("Message",e.toString());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -10,13 +10,16 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
|||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Api(tags = "证件信息接口")
|
||||
@RestController
|
||||
|
|
@ -35,6 +38,22 @@ public class CertificateReturnManageController extends BaseController {
|
|||
List<CertificateInfo> list = certificateInfoService.selectCertificateSaveList(deviceInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
/**
|
||||
* 证件存入信息
|
||||
*/
|
||||
@ApiOperation(value = "证件存入")
|
||||
@SysLog(title = "证件存入", businessType = OperaType.INSERT, logType = 1,module = "借退管理->证件存入")
|
||||
@PostMapping("/certificateSave/add")
|
||||
public AjaxResult addCertificateSave(@RequestBody CertificateInfo certificateInfo) {
|
||||
String username = SecurityUtils.getUsername();
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
try {
|
||||
return toAjax(certificateInfoService.addCertificateSave(certificateInfo));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询证件信息列表
|
||||
|
|
@ -46,7 +65,21 @@ public class CertificateReturnManageController extends BaseController {
|
|||
List<CertificateInfo> list = certificateInfoService.selectCertificateAtakeList(deviceInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 证件取出信息
|
||||
*/
|
||||
@ApiOperation(value = "证件取出")
|
||||
@SysLog(title = "证件取出", businessType = OperaType.INSERT, logType = 1,module = "借退管理->证件取出")
|
||||
@PostMapping("/certificateTake/add")
|
||||
public AjaxResult certificateTake(@RequestBody CertificateInfo certificateInfo) {
|
||||
String username = SecurityUtils.getUsername();
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
try {
|
||||
return toAjax(certificateInfoService.addCertificateTake(certificateInfo));
|
||||
} catch (Exception e) {
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 查询证件信息列表
|
||||
*/
|
||||
|
|
@ -57,5 +90,21 @@ public class CertificateReturnManageController extends BaseController {
|
|||
List<CertificateTask> list = certificateInfoService.selectCertificateTaskList(deviceInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
/**
|
||||
* 证件取出信息
|
||||
*/
|
||||
@ApiOperation(value = "证件任务撤回")
|
||||
@SysLog(title = "证件任务撤回", businessType = OperaType.INSERT, logType = 1,module = "借退管理->证件任务撤回")
|
||||
@PostMapping("/certificateTask/return")
|
||||
public AjaxResult certificateReturn(@RequestBody CertificateInfo certificateInfo) {
|
||||
String username = SecurityUtils.getUsername();
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
try {
|
||||
return toAjax(certificateInfoService.addCertificateReturn(certificateInfo));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,13 +13,6 @@ import java.util.List;
|
|||
* @date 2025-05-25
|
||||
*/
|
||||
public interface CertificateReturnManageMapper {
|
||||
/**
|
||||
* 查询证件信息
|
||||
*
|
||||
* @param deviceId 证件信息主键
|
||||
* @return 证件信息
|
||||
*/
|
||||
public CertificateInfo selectCertificateInfoByDeviceId(Long deviceId);
|
||||
|
||||
/**
|
||||
* 查询证件信息列表
|
||||
|
|
@ -33,123 +26,11 @@ public interface CertificateReturnManageMapper {
|
|||
|
||||
public List<CertificateInfo> selectCertificateAtakeList(CertificateInfo certificateInfo);
|
||||
|
||||
/**
|
||||
* 新增证件信息
|
||||
*
|
||||
* @param certificateInfo 证件信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCertificateInfo(CertificateInfo certificateInfo);
|
||||
public int addCertificateSave(CertificateInfo certificateInfo);
|
||||
public int updateCertificateState(CertificateInfo certificateInfo);
|
||||
|
||||
/**
|
||||
* 修改证件信息
|
||||
*
|
||||
* @param certificateInfo 证件信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCertificateInfo(CertificateInfo certificateInfo);
|
||||
public CertificateInfo selectCertificateInfoByCertificateNo(@Param("certificateNo") String certificateNo);
|
||||
public CertificateInfo selectCertificateTaskByCertificateNo(@Param("taskNo") String taskNo);
|
||||
public int updateCertificateSave(CertificateInfo certificateInfo);
|
||||
|
||||
/**
|
||||
* 删除证件信息
|
||||
*
|
||||
* @param deviceId 证件信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCertificateInfoByDeviceId(Long deviceId);
|
||||
|
||||
/**
|
||||
* 批量删除证件信息
|
||||
*
|
||||
* @param deviceIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCertificateInfoByDeviceIds(@Param("deviceIds") Long[] deviceIds);
|
||||
|
||||
/**
|
||||
* 校验设备名称是否唯一
|
||||
*
|
||||
* @param certificateInfo 设备名称
|
||||
* @return 结果
|
||||
*/
|
||||
int checkDeviceNameUnique(CertificateInfo certificateInfo);
|
||||
|
||||
/**
|
||||
* 校验设备编号是否唯一
|
||||
*
|
||||
* @param certificateInfo 设备编号
|
||||
* @return 结果
|
||||
*/
|
||||
int checkDeviceNumberUnique(CertificateInfo certificateInfo);
|
||||
|
||||
/**
|
||||
* 校验设备序列号是否唯一
|
||||
*
|
||||
* @param certificateInfo 设备序列号
|
||||
* @return 结果
|
||||
*/
|
||||
int checkDeviceSnUnique(CertificateInfo certificateInfo);
|
||||
|
||||
/**
|
||||
* 新增设备绑定关系
|
||||
*
|
||||
* @param certificateInfo 设备绑定关系
|
||||
* @return 结果
|
||||
*/
|
||||
int insertDeviceBinding(CertificateInfo certificateInfo);
|
||||
|
||||
/**
|
||||
* 修改设备绑定关系
|
||||
*
|
||||
* @param certificateInfo 设备绑定关系
|
||||
* @return 结果
|
||||
*/
|
||||
int updateDeviceBinding(CertificateInfo certificateInfo);
|
||||
|
||||
/**
|
||||
* 新增设备菜谱关系
|
||||
*
|
||||
* @param certificateInfo 设备菜谱关系
|
||||
* @return 结果
|
||||
*/
|
||||
int insertDeviceRecipeBinding(CertificateInfo certificateInfo);
|
||||
|
||||
/**
|
||||
* 修改设备菜谱关系
|
||||
*
|
||||
* @param certificateInfo 设备菜谱关系
|
||||
* @return 结果
|
||||
*/
|
||||
int updateDeviceRecipeBinding(CertificateInfo certificateInfo);
|
||||
|
||||
/**
|
||||
* 查询设备菜谱关系
|
||||
*
|
||||
* @param certificateInfo 设备菜谱关系
|
||||
* @return 结果
|
||||
*/
|
||||
String selectDeviceRecipeBinding(CertificateInfo certificateInfo);
|
||||
|
||||
/**
|
||||
* 批量删除设备绑定关系
|
||||
*
|
||||
* @param deviceIds 需要删除的数据主键集合
|
||||
*/
|
||||
void deleteDeviceBinding(@Param("deviceIds") Long[] deviceIds);
|
||||
|
||||
/**
|
||||
* 批量删除设备菜谱关系
|
||||
*
|
||||
* @param deviceIds 需要删除的数据主键集合
|
||||
*/
|
||||
void deleteDeviceRecipeBinding(@Param("deviceIds") Long[] deviceIds);
|
||||
|
||||
/**
|
||||
* 更新设备在线状态
|
||||
*
|
||||
* @param sn 设备序列号
|
||||
* @return 结果
|
||||
*/
|
||||
int updateTimeBySn(String sn);
|
||||
|
||||
int updateTimeByKitchenSn(String sn);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,61 +13,23 @@ import java.util.List;
|
|||
*/
|
||||
public interface CertificateReturnManageService {
|
||||
/**
|
||||
* 查询证件信息
|
||||
*
|
||||
* @param deviceId 证件信息主键
|
||||
* @return 证件信息
|
||||
*/
|
||||
public CertificateInfo selectCertificateInfoByDeviceId(Long deviceId);
|
||||
|
||||
/**
|
||||
* 查询证件信息列表
|
||||
* 查询证件任务信息列表
|
||||
*
|
||||
* @param certificateInfo 证件信息
|
||||
* @return 证件信息集合
|
||||
*/
|
||||
public List<CertificateTask> selectCertificateTaskList(CertificateInfo certificateInfo);
|
||||
|
||||
public int addCertificateReturn(CertificateInfo certificateInfo);
|
||||
/**
|
||||
* 存证信息列表
|
||||
*
|
||||
* @param certificateInfo 证件信息
|
||||
* @return 证件信息集合
|
||||
*/
|
||||
public List<CertificateInfo> selectCertificateSaveList(CertificateInfo certificateInfo);
|
||||
public int addCertificateSave(CertificateInfo certificateInfo);
|
||||
|
||||
public List<CertificateInfo> selectCertificateAtakeList(CertificateInfo certificateInfo);
|
||||
/**
|
||||
* 新增证件信息
|
||||
*
|
||||
* @param deviceInfo 证件信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCertificateInfo(CertificateInfo deviceInfo);
|
||||
public int addCertificateTake(CertificateInfo certificateInfo);
|
||||
|
||||
/**
|
||||
* 修改证件信息
|
||||
*
|
||||
* @param deviceInfo 证件信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCertificateInfo(CertificateInfo deviceInfo);
|
||||
|
||||
/**
|
||||
* 批量删除证件信息
|
||||
*
|
||||
* @param deviceIds 需要删除的证件信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCertificateInfoByDeviceIds(Long[] deviceIds);
|
||||
|
||||
/**
|
||||
* 删除证件信息信息
|
||||
*
|
||||
* @param deviceId 证件信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCertificateInfoByDeviceId(Long deviceId);
|
||||
|
||||
/**
|
||||
* 根据设备sn码更新设备最后使用时间
|
||||
* @param deviceSn 设备sn码
|
||||
*/
|
||||
void updateTimeBySn(String deviceSn);
|
||||
|
||||
void updateTimeByKitchenSn(String deviceSn);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,25 @@
|
|||
package com.bonus.canteen.core.certificate.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.canteen.core.certificate.mapper.CertificateReturnManageMapper;
|
||||
import com.bonus.canteen.core.certificate.service.CertificateReturnManageService;
|
||||
import com.bonus.canteen.core.certificate.vo.CertificateInfo;
|
||||
import com.bonus.canteen.core.certificate.vo.CertificateTask;
|
||||
import com.bonus.canteen.core.config.SmUtils;
|
||||
import com.bonus.canteen.core.utils.BnsUtils;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.houqin.utils.AesEncryptUtil;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* 设备资料Service业务层处理
|
||||
|
|
@ -19,24 +27,14 @@ import java.util.List;
|
|||
* @author xsheng
|
||||
* @date 2025-05-25
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class CertificateReturnManageServiceImpl implements CertificateReturnManageService {
|
||||
@Resource
|
||||
private CertificateReturnManageMapper certificateInfoMapper;
|
||||
|
||||
private static final Long DEVICE_TYPE_STALL = 20L;
|
||||
|
||||
/**
|
||||
* 查询设备资料
|
||||
*
|
||||
* @param deviceId 设备资料主键
|
||||
* @return 设备资料
|
||||
*/
|
||||
@Override
|
||||
public CertificateInfo selectCertificateInfoByDeviceId(Long deviceId) {
|
||||
return certificateInfoMapper.selectCertificateInfoByDeviceId(deviceId);
|
||||
}
|
||||
|
||||
private static final String certificateUrl="http://124.220.39.153:8090/externaltask/accessfunction";
|
||||
/**
|
||||
* 查询设备资料列表
|
||||
*
|
||||
|
|
@ -47,53 +45,182 @@ public class CertificateReturnManageServiceImpl implements CertificateReturnMana
|
|||
public List<CertificateTask> selectCertificateTaskList(CertificateInfo certificateInfo) {
|
||||
return certificateInfoMapper.selectCertificateTaskList(certificateInfo);
|
||||
}
|
||||
|
||||
//任务回撤接口
|
||||
@Override
|
||||
public int addCertificateReturn(CertificateInfo certificateInfo) {
|
||||
int res=0;
|
||||
String[] nos=certificateInfo.getCertificateNos();
|
||||
if(nos!=null&&nos.length>0){
|
||||
for(int i=0;i<nos.length;i++){
|
||||
CertificateInfo vo=certificateInfoMapper.selectCertificateTaskByCertificateNo(nos[i]);
|
||||
String paramstr="{\n" +
|
||||
" \"taskno\": \""+vo.getTaskNo()+"\", \n" +
|
||||
" \"cardnos\": \""+vo.getCertificateNo()+"\"\n" +
|
||||
"}";
|
||||
System.out.println("{\"taskcode\":\"C0103\",\"params\":"+paramstr+"}");
|
||||
String aesparamstr= SmUtils.smEncrypt(paramstr);
|
||||
String jonstr="{\"taskcode\":\"C0103\",\"params\":\""+aesparamstr+"\"}";
|
||||
System.out.println(jonstr);
|
||||
String restr=BnsUtils.sendMsgByUrl(certificateUrl,jonstr);
|
||||
JSONObject jsonObject = JSONObject.parseObject(restr);
|
||||
if("0".equals(jsonObject.getString("success"))){
|
||||
res=1;
|
||||
vo.setTaskNo(vo.getTaskNo());
|
||||
vo.setCertificateNo(vo.getCertificateNo());
|
||||
vo.setProcessState("2");//待处理
|
||||
if("1".equals(vo.getTaskType())){
|
||||
vo.setState("0");
|
||||
}else if("2".equals(vo.getTaskType())){
|
||||
vo.setState("2");
|
||||
}
|
||||
certificateInfoMapper.updateCertificateSave(vo);
|
||||
certificateInfoMapper.updateCertificateState(vo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CertificateInfo> selectCertificateSaveList(CertificateInfo certificateInfo) {
|
||||
return certificateInfoMapper.selectCertificateSaveList(certificateInfo);
|
||||
}
|
||||
|
||||
//存证接口
|
||||
@Override
|
||||
public int addCertificateSave(CertificateInfo certificateInfo) {
|
||||
int res=0;
|
||||
String[] nos=certificateInfo.getCertificateNos();
|
||||
SimpleDateFormat sdf =new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
||||
if(nos!=null&&nos.length>0){
|
||||
for(int i=0;i<nos.length;i++){
|
||||
CertificateInfo vo=certificateInfoMapper.selectCertificateInfoByCertificateNo(nos[i]);
|
||||
// ASave:自助存证
|
||||
// Save:管理员存证
|
||||
String saveType="ASave";
|
||||
if("1".equals(certificateInfo.getType())){
|
||||
saveType="ASave";
|
||||
}else{
|
||||
saveType="Save";
|
||||
}
|
||||
String taskNo="S_"+sdf.format(new Date());
|
||||
String verificationCode=randNum();
|
||||
String paramstr="{ " +
|
||||
" \"taskno\":\""+taskNo+"\", " +
|
||||
" \"actiontype\":\""+saveType+"\", " +
|
||||
" \"deviceno\":\"\", " +
|
||||
" \"operator\":\""+vo.getName()+"\", " +
|
||||
" \"opeidnumber\":\""+vo.getIdNumber()+"\", " +
|
||||
" \"qrcode\":\""+verificationCode+"\", " +
|
||||
" \"captcha\":\""+verificationCode+"\", " +
|
||||
" \"dockey\":[ " +
|
||||
" { " +
|
||||
" \"idnumber\":\""+vo.getIdNumber()+"\", " +
|
||||
" \"cardno\":\""+vo.getCertificateNo()+"\", " +
|
||||
" \"cardtype\":\""+vo.getCertificateTypeName()+"\", " +
|
||||
" \"name\":\""+vo.getName()+"\", " +
|
||||
" \"sex\":\""+BnsUtils.gender(vo.getIdNumber())+"\", " +
|
||||
" \"birthdate\":\""+vo.getBirthday()+"\", " +
|
||||
" \"issuedate\":\""+vo.getIssueDay()+"\", " +
|
||||
" \"issueplace\":\""+vo.getIssueAddr()+"\", " +
|
||||
" \"expirydate\":\""+vo.getIssueLifespan()+"\", " +
|
||||
" \"ischips\":"+vo.getIsEle()+" " +
|
||||
" } " +
|
||||
" ] " +
|
||||
"}";
|
||||
System.out.println("{\"taskcode\":\"C0101\",\"params\":"+paramstr+"}");
|
||||
String aesparamstr= SmUtils.smEncrypt(paramstr);
|
||||
String jonstr="{\"taskcode\":\"C0101\",\"params\":\""+aesparamstr+"\"}";
|
||||
System.out.println(jonstr);
|
||||
String restr=BnsUtils.sendMsgByUrl(certificateUrl,jonstr);
|
||||
JSONObject jsonObject = JSONObject.parseObject(restr);
|
||||
System.out.println(jsonObject.getString("success"));
|
||||
if("0".equals(jsonObject.getString("success")+"")){
|
||||
res=1;
|
||||
vo.setType(certificateInfo.getType());
|
||||
vo.setTaskNo(taskNo);
|
||||
vo.setTaskType("1");
|
||||
vo.setProcessState("0");//待处理
|
||||
vo.setState("1");//存证中
|
||||
certificateInfoMapper.addCertificateSave(vo);
|
||||
certificateInfoMapper.updateCertificateState(vo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CertificateInfo> selectCertificateAtakeList(CertificateInfo certificateInfo) {
|
||||
return certificateInfoMapper.selectCertificateAtakeList(certificateInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备资料
|
||||
*
|
||||
* @param certificateInfo 设备资料
|
||||
* @return 结果
|
||||
*/
|
||||
//取证接口
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int insertCertificateInfo(CertificateInfo certificateInfo) {
|
||||
certificateInfo.setCreateTime(DateUtils.getNowDate());
|
||||
certificateInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
try {
|
||||
checkParam(certificateInfo,false);
|
||||
return certificateInfoMapper.insertCertificateInfo(certificateInfo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException(e.getMessage());
|
||||
public int addCertificateTake(CertificateInfo certificateInfo) {
|
||||
int res=0;
|
||||
String[] nos=certificateInfo.getCertificateNos();
|
||||
SimpleDateFormat sdf =new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
||||
if(nos!=null&&nos.length>0){
|
||||
for(int i=0;i<nos.length;i++){
|
||||
CertificateInfo vo=certificateInfoMapper.selectCertificateInfoByCertificateNo(nos[i]);
|
||||
// ATake:自助取证
|
||||
// Take :管理员取证
|
||||
// Emergency:应急取证
|
||||
String saveType="ATake";
|
||||
if("3".equals(certificateInfo.getType())){
|
||||
saveType="ATake";
|
||||
}else if("4".equals(certificateInfo.getType())){
|
||||
saveType="Take";
|
||||
}else if("5".equals(certificateInfo.getType())){
|
||||
saveType="Emergency";
|
||||
}else if("6".equals(certificateInfo.getType())){
|
||||
saveType="";
|
||||
}
|
||||
if("".equals(saveType)){
|
||||
return 0;
|
||||
}
|
||||
String taskNo="T_"+sdf.format(new Date());
|
||||
String verificationCode=randNum();
|
||||
String paramstr="{" +
|
||||
" \"taskno\": \""+taskNo+"\", " +
|
||||
" \"actiontype\": \""+saveType+"\", " +
|
||||
" \"operator\": \""+vo.getName()+"\", " +
|
||||
" \"opeidnumber\": \""+vo.getIdNumber()+"\", " +
|
||||
" \"qrcode\": \""+verificationCode+"\", " +
|
||||
" \"captcha\": \""+verificationCode+"\", " +
|
||||
" \"cardnos\": \""+vo.getCertificateNo()+"\"" +
|
||||
"}";
|
||||
System.out.println("{\"taskcode\":\"C0102\",\"params\":"+paramstr+"}");
|
||||
String aesparamstr= SmUtils.smEncrypt(paramstr);
|
||||
String jonstr="{\"taskcode\":\"C0102\",\"params\":\""+aesparamstr+"\"}";
|
||||
System.out.println(jonstr);
|
||||
String restr=BnsUtils.sendMsgByUrl(certificateUrl,jonstr);
|
||||
JSONObject jsonObject = JSONObject.parseObject(restr);
|
||||
if("0".equals(jsonObject.getString("success"))){
|
||||
res=1;
|
||||
vo.setType(certificateInfo.getType());
|
||||
vo.setTaskNo(taskNo);
|
||||
vo.setTaskType("2");
|
||||
vo.setProcessState("0");//待处理
|
||||
vo.setState("3");//取证中
|
||||
certificateInfoMapper.addCertificateSave(vo);
|
||||
certificateInfoMapper.updateCertificateState(vo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备资料
|
||||
*
|
||||
* @param certificateInfo 设备资料
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateCertificateInfo(CertificateInfo certificateInfo) {
|
||||
certificateInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
try {
|
||||
checkParam(certificateInfo,true);
|
||||
return certificateInfoMapper.updateCertificateInfo(certificateInfo);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String randNum(){
|
||||
Random random = new Random();
|
||||
int randomNumber = random.nextInt(900000) + 100000; // 生成100000到999999之间的随机数
|
||||
return randomNumber+"";
|
||||
}
|
||||
private void checkParam(CertificateInfo certificateInfo, boolean isUpdate){
|
||||
if (StringUtils.isEmpty(certificateInfo.getDeptId())) {
|
||||
throw new ServiceException("单位不能为空");
|
||||
|
|
@ -118,61 +245,4 @@ public class CertificateReturnManageServiceImpl implements CertificateReturnMana
|
|||
}
|
||||
}
|
||||
|
||||
private void checkDeviceUnique(CertificateInfo certificateInfo){
|
||||
if (certificateInfoMapper.checkDeviceNameUnique(certificateInfo) > 0) {
|
||||
throw new ServiceException("设备名称已存在");
|
||||
}
|
||||
if (certificateInfoMapper.checkDeviceNumberUnique(certificateInfo) > 0) {
|
||||
throw new ServiceException("设备编号已存在");
|
||||
}
|
||||
if (certificateInfoMapper.checkDeviceSnUnique(certificateInfo) > 0) {
|
||||
throw new ServiceException("设备SN已存在");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除设备资料
|
||||
*
|
||||
* @param deviceIds 需要删除的设备资料主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteCertificateInfoByDeviceIds(Long[] deviceIds) {
|
||||
certificateInfoMapper.deleteDeviceBinding(deviceIds);
|
||||
certificateInfoMapper.deleteDeviceRecipeBinding(deviceIds);
|
||||
return certificateInfoMapper.deleteCertificateInfoByDeviceIds(deviceIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备资料信息
|
||||
*
|
||||
* @param deviceId 设备资料主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCertificateInfoByDeviceId(Long deviceId) {
|
||||
return certificateInfoMapper.deleteCertificateInfoByDeviceId(deviceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据sn更新时间
|
||||
*
|
||||
* @param sn 设备sn码
|
||||
*/
|
||||
@Override
|
||||
public void updateTimeBySn(String sn) {
|
||||
int code = certificateInfoMapper.updateTimeBySn(sn);
|
||||
if (code == 0) {
|
||||
throw new ServiceException("更新时间失败");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void updateTimeByKitchenSn(String sn) {
|
||||
int code = certificateInfoMapper.updateTimeByKitchenSn(sn);
|
||||
if (code == 0) {
|
||||
throw new ServiceException("更新时间失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,6 +150,17 @@ public class CertificateInfo extends BaseEntity {
|
|||
private String taskTypeName;
|
||||
|
||||
private String email;
|
||||
// 1 自主存证 2管理员存证 3自助取证 4 管理员取证 5应急取证 6代人取证
|
||||
private String type;
|
||||
private String typeName;
|
||||
|
||||
private String[] certificateNos;
|
||||
|
||||
private String keyWord;
|
||||
|
||||
private String operator;
|
||||
private String operaTime;
|
||||
private String opeidnumber;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
package com.bonus.canteen.core.certificate.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* 设备资料对象 device_info
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2025-05-25
|
||||
*/
|
||||
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class CertificateRefill {
|
||||
private String taskcode;
|
||||
private String params;
|
||||
}
|
||||
|
|
@ -108,6 +108,8 @@ public class CertificateTask extends BaseEntity {
|
|||
private String taskTypeName;
|
||||
|
||||
private String email;
|
||||
private String type;
|
||||
private String typeName;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@ import cn.hutool.core.codec.Base64Decoder;
|
|||
import cn.hutool.core.codec.Base64Encoder;
|
||||
import cn.hutool.core.util.PrimitiveArrayUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.Mode;
|
||||
import cn.hutool.crypto.Padding;
|
||||
import cn.hutool.crypto.SmUtil;
|
||||
import cn.hutool.crypto.asymmetric.KeyType;
|
||||
import cn.hutool.crypto.symmetric.AES;
|
||||
import cn.hutool.crypto.symmetric.SM4;
|
||||
import com.bonus.canteen.core.common.utils.SpringContextHolder;
|
||||
import com.google.common.base.Joiner;
|
||||
|
|
@ -17,6 +19,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import javax.crypto.KeyGenerator;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.PrintStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
|
@ -24,6 +27,37 @@ import java.util.SortedMap;
|
|||
|
||||
public class SmUtils {
|
||||
private static final Logger log = LoggerFactory.getLogger(SmUtils.class);
|
||||
private static final String SM_ENCRYPT_KEY ="loqvpd0iqazwsxed";
|
||||
|
||||
public static String smEncrypt(String encryptStr) {
|
||||
try{
|
||||
if (StrUtil.isBlank(encryptStr)) {
|
||||
return encryptStr;
|
||||
} else {
|
||||
SM4 sm4=new SM4(Mode.ECB, Padding.PKCS5Padding,SM_ENCRYPT_KEY.getBytes());
|
||||
return sm4.encryptBase64(encryptStr);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return encryptStr;
|
||||
}
|
||||
|
||||
public static String decryptBySm42(String data) {
|
||||
try{
|
||||
byte[] key=SM_ENCRYPT_KEY.getBytes();
|
||||
byte[] decodedData = Base64Decoder.decode(data);
|
||||
if (decodedData.length <= 16) {
|
||||
throw new IllegalArgumentException("Encrypted data byte length must greater than 16");
|
||||
} else {
|
||||
return (new SM4(Mode.ECB, Padding.PKCS5Padding, key)).decryptStr(decodedData);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
private static SecureProperties secureProperties = SpringContextHolder.getBean(SecureProperties.class);
|
||||
public static void setSecureProperties(SecureProperties secureProperties) {
|
||||
if (SmUtils.secureProperties == null) {
|
||||
|
|
@ -31,6 +65,7 @@ public class SmUtils {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static String signBySm3(SortedMap<String, String> data, String clientKey) {
|
||||
data.put(secureProperties.getSecurity().getClientKeySignParamName(), clientKey);
|
||||
String joinedParam = Joiner.on("&").useForNull("").withKeyValueSeparator("=").join(data);
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
package com.bonus.canteen.core.utils;
|
||||
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import okhttp3.*;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.BeanWrapper;
|
||||
import org.springframework.beans.BeanWrapperImpl;
|
||||
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.io.IOException;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
|
@ -41,4 +44,102 @@ public class BnsUtils {
|
|||
String[] result = new String[emptyNames.size()];
|
||||
return (String[])emptyNames.toArray(result);
|
||||
}
|
||||
public static String sendMsgByUrl(String url,String jsonstr){
|
||||
String responseString="";
|
||||
try{
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody requestBody = RequestBody.create(mediaType, jsonstr);
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.post(requestBody)
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
responseString = response.body().string();
|
||||
System.out.println("Response: " + responseString);
|
||||
response.close();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return responseString;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据身份证号获取年龄
|
||||
*/
|
||||
public static int countAge(String sfzjh){
|
||||
sfzjh = sfzjh.trim();
|
||||
if(sfzjh == null || "".equals(sfzjh) || sfzjh.contains("*")){
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sfzjh.length() != 15 && sfzjh.length() != 18){
|
||||
return 0;
|
||||
}
|
||||
int age = 0;
|
||||
Calendar cal = Calendar.getInstance();
|
||||
int yearNow = cal.get(Calendar.YEAR);
|
||||
int monthNow = cal.get(Calendar.MONTH)+1;
|
||||
int dayNow = cal.get(Calendar.DATE);
|
||||
|
||||
int year = Integer.valueOf(sfzjh.substring(6, 10));
|
||||
int month = Integer.valueOf(sfzjh.substring(10,12));
|
||||
int day = Integer.valueOf(sfzjh.substring(12,14));
|
||||
|
||||
if ((month < monthNow) || (month == monthNow && day<= dayNow) ){
|
||||
age = yearNow - year;
|
||||
}else {
|
||||
age = yearNow - year-1;
|
||||
}
|
||||
return age;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据身份证号判断性别 奇数代表男 偶数代表女
|
||||
* @param idNumber
|
||||
* @return
|
||||
*/
|
||||
public static String gender(String idNumber) {
|
||||
int gender = 0;
|
||||
if(idNumber.length() == 18){
|
||||
//如果身份证号18位,取身份证号倒数第二位
|
||||
char c = idNumber.charAt(idNumber.length() - 2);
|
||||
gender = Integer.parseInt(String.valueOf(c));
|
||||
}else{
|
||||
//如果身份证号15位,取身份证号最后一位
|
||||
char c = idNumber.charAt(idNumber.length() - 1);
|
||||
gender = Integer.parseInt(String.valueOf(c));
|
||||
}
|
||||
if(gender % 2 == 1){
|
||||
return "男";
|
||||
// return "1";
|
||||
}else{
|
||||
return "女";
|
||||
// return "2";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据身份证号判断性别 奇数代表男 偶数代表女
|
||||
* @param idNumber
|
||||
* @return
|
||||
*/
|
||||
public static int getIntTypeGender(String idNumber) {
|
||||
int gender = 0;
|
||||
if(idNumber.length() == 18){
|
||||
//如果身份证号18位,取身份证号倒数第二位
|
||||
char c = idNumber.charAt(idNumber.length() - 2);
|
||||
gender = Integer.parseInt(String.valueOf(c));
|
||||
}else{
|
||||
//如果身份证号15位,取身份证号最后一位
|
||||
char c = idNumber.charAt(idNumber.length() - 1);
|
||||
gender = Integer.parseInt(String.valueOf(c));
|
||||
}
|
||||
if(gender % 2 == 1){
|
||||
return 1;
|
||||
}else{
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="certificateNo != null and certificateNo != ''">
|
||||
and bc.certificate_no like concat('%', #{certificateNo}, '%')
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and (bc.certificate_no like concat('%', #{keyWord}, '%') or bc.name like concat('%', #{name}, '%')
|
||||
or bc.id_number like concat('%', #{idNumber}, '%')
|
||||
)
|
||||
</if>
|
||||
order by bc.update_time desc
|
||||
</select>
|
||||
|
||||
|
|
|
|||
|
|
@ -14,20 +14,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
when bc.state='1' then '存入中'
|
||||
when bc.state='2' then '已存入'
|
||||
when bc.state='3' then '取出中'
|
||||
when bc.state='3' then '已取出 '
|
||||
when bc.state='4' then '已取出 '
|
||||
end as statename,
|
||||
bct.process_state as processstate,
|
||||
bct.real_process_date as realprocessdate,
|
||||
bct.verification_code as verificationcode,
|
||||
case when bct.process_state='0' then '未执行' else '已执行' end processstatename,
|
||||
case when bct.process_state='0' then '未执行' when bct.process_state='1' then '已执行' else '已撤销' end processstatename,
|
||||
bct.task_type as tasktype,bct.task_no as taskno,
|
||||
case when bct.task_type='1' then '存证' else '取证' end tasktypename,
|
||||
bct.process_date as processdate,bct.create_time as createTime
|
||||
from basic_certificate bc
|
||||
bct.process_date as processdate,bct.create_time as createTime,bct.type,
|
||||
case when bct.type='1' then '自主存证'
|
||||
when bct.type='2' then '管理员存证'
|
||||
when bct.type='3' then '自助取证'
|
||||
when bct.type='4' then '管理员取证'
|
||||
when bct.type='5' then '应急取证'
|
||||
when bct.type='6' then '代人取证' end as typename
|
||||
from basic_certificate_task bct
|
||||
left join basic_certificate bc on bc.certificate_no=bct.certificate_no
|
||||
left join sys_dept sd on bc.dept_id=sd.dept_id
|
||||
left join (select * from sys_dict_data where dict_type='sys_certificate_type') sdd on bc.certificate_type=sdd.dict_value
|
||||
left join basic_certificate_task bct on bc.certificate_no=bct.certificate_no
|
||||
where bct.task_type in ('1','2') and bc.del_flag='0'
|
||||
where bct.task_type in ('1','2') and bc.del_flag='0' and bct.del_flag='0'
|
||||
<if test="idNumber != null and idNumber != ''">
|
||||
and bc.id_number like concat('%', #{idNumber}, '%')
|
||||
</if>
|
||||
|
|
@ -37,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="certificateNo != null and certificateNo != ''">
|
||||
and bc.certificate_no like concat('%', #{certificateNo}, '%')
|
||||
</if>
|
||||
order by bc.create_time desc
|
||||
order by bct.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectCertificateSaveList" parameterType="com.bonus.canteen.core.certificate.vo.CertificateInfo" resultType="com.bonus.canteen.core.certificate.vo.CertificateInfo">
|
||||
|
|
@ -56,7 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
from basic_certificate bc
|
||||
left join sys_dept sd on bc.dept_id=sd.dept_id
|
||||
left join (select * from sys_dict_data where dict_type='sys_certificate_type') sdd on bc.certificate_type=sdd.dict_value
|
||||
where bc.del_flag='0'
|
||||
where bc.del_flag='0' and (bc.state='0' or bc.state='4')
|
||||
<if test="idNumber != null and idNumber != ''">
|
||||
and bc.id_number like concat('%', #{idNumber}, '%')
|
||||
</if>
|
||||
|
|
@ -76,16 +82,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
,bc.is_ele as isele,sd.dept_name as deptname,case when bc.is_ele='0' then '否' else '是' end as iselename
|
||||
,bc.state,case
|
||||
when bc.state='0' then '未上交'
|
||||
when bc.state='1' then '未执行'
|
||||
when bc.state='2' then '已执行'
|
||||
when bc.state='3' then '未执行'
|
||||
when bc.state='4' then '已执行'
|
||||
when bc.state='5' then '已取消'
|
||||
when bc.state='1' then '存入中'
|
||||
when bc.state='2' then '已存入'
|
||||
when bc.state='3' then '取出中'
|
||||
when bc.state='4' then '已取出'
|
||||
end as statename
|
||||
from basic_certificate bc
|
||||
left join sys_dept sd on bc.dept_id=sd.dept_id
|
||||
left join (select * from sys_dict_data where dict_type='sys_certificate_type') sdd on bc.certificate_type=sdd.dict_value
|
||||
where bc.del_flag='0'
|
||||
where bc.del_flag='0' and bc.state='2'
|
||||
<if test="idNumber != null and idNumber != ''">
|
||||
and bc.id_number like concat('%', #{idNumber}, '%')
|
||||
</if>
|
||||
|
|
@ -97,8 +102,66 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
order by bc.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectCertificateInfoByDeviceId" parameterType="Long" resultType="com.bonus.canteen.core.certificate.vo.CertificateInfo">
|
||||
|
||||
<insert id="addCertificateSave" parameterType="com.bonus.canteen.core.certificate.vo.CertificateInfo" >
|
||||
insert into basic_certificate_task
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="certificateNo != null">certificate_no,</if>
|
||||
<if test="processDate != null">process_date,</if>
|
||||
<if test="realProcessDate != null">real_process_date,</if>
|
||||
<if test="deviceId != null">device_id,</if>
|
||||
<if test="slotId != null">slot_id,</if>
|
||||
<if test="verificationCode != null">verification_code,</if>
|
||||
<if test="taskNo != null">task_no,</if>
|
||||
<if test="processState != null">process_state,</if>
|
||||
<if test="taskType != null">task_type,</if>
|
||||
<if test="email != null and isEle != ''">email,</if>
|
||||
<if test="type != null and type != ''">type,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="certificateNo != null"> #{certificateNo} ,</if>
|
||||
<if test="processDate != null"> #{processDate} ,</if>
|
||||
<if test="realProcessDate != null"> #{realProcessDate} ,</if>
|
||||
<if test="deviceId != null"> #{deviceId} ,</if>
|
||||
<if test="slotId != null"> #{slotId} ,</if>
|
||||
<if test="verificationCode != null"> #{verificationCode} ,</if>
|
||||
<if test="taskNo != null"> #{taskNo} ,</if>
|
||||
<if test="processState != null"> #{processState} ,</if>
|
||||
<if test="taskType != null"> #{taskType} ,</if>
|
||||
<if test="email != null and email != ''"> #{email} ,</if>
|
||||
<if test="type != null and type != ''"> #{type} ,</if>
|
||||
<if test="createBy != null"> #{createBy} ,</if>
|
||||
<if test="createTime != null"> #{createTime} ,</if>
|
||||
<if test="updateBy != null"> #{updateBy} ,</if>
|
||||
<if test="updateTime != null"> #{updateTime} ,</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateCertificateState" parameterType="com.bonus.canteen.core.certificate.vo.CertificateInfo">
|
||||
update basic_certificate
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="state != null and state != ''">state = #{state},</if>
|
||||
</trim>
|
||||
where certificate_no = #{certificateNo}
|
||||
</update>
|
||||
|
||||
<update id="updateCertificateSave" parameterType="com.bonus.canteen.core.certificate.vo.CertificateInfo">
|
||||
update basic_certificate_task
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="processState != null and processState != ''">process_state = #{processState},</if>
|
||||
<if test="operator != null and operator != ''">operator = #{operator},</if>
|
||||
<if test="operaTime != null and operaTime != ''">opera_time = #{operaTime},</if>
|
||||
<if test="opeidnumber != null and opeidnumber != ''">ope_idnumber = #{opeidnumber},</if>
|
||||
<if test="operaTime != null and operaTime != ''">real_process_date = #{operaTime},</if>
|
||||
</trim>
|
||||
where task_no = #{taskNo}
|
||||
</update>
|
||||
|
||||
<select id="selectCertificateInfoByCertificateNo" parameterType="String" resultType="com.bonus.canteen.core.certificate.vo.CertificateInfo">
|
||||
select bc.dept_id as deptid,bc.name,bc.birthday,bc.birth_addr as birthaddr
|
||||
,bc.certificate_type as certificatetype,bc.id_number as idnumber,sdd.dict_label as certificatetypename
|
||||
,bc.certificate_no as certificateno,bc.issue_addr as issueaddr,bc.issue_day as issueday
|
||||
|
|
@ -106,137 +169,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
from basic_certificate bc
|
||||
left join sys_dept sd on bc.dept_id=sd.dept_id
|
||||
left join (select * from sys_dict_data where dict_type='sys_certificate_type') sdd on bc.certificate_type=sdd.dict_value
|
||||
where di.device_id = #{deviceId}
|
||||
where bc.certificate_no=#{certificateNo}
|
||||
</select>
|
||||
<select id="checkDeviceNameUnique" resultType="java.lang.Integer">
|
||||
select count(1) from device_info where device_name = #{deviceName}
|
||||
<if test="deviceId != null">and device_id != #{deviceId}</if>
|
||||
|
||||
<select id="selectCertificateTaskByCertificateNo" parameterType="String" resultType="com.bonus.canteen.core.certificate.vo.CertificateInfo">
|
||||
select bc.dept_id as deptid,bc.name,bc.birthday,bc.birth_addr as birthaddr
|
||||
,bc.certificate_type as certificatetype,bc.id_number as idnumber,sdd.dict_label as certificatetypename
|
||||
,bc.certificate_no as certificateno,bc.issue_addr as issueaddr,bc.issue_day as issueday
|
||||
,bc.issue_lifespan as issuelifespan,bc.is_ele as isele,sd.dept_name as deptname,bct.task_no as taskno,
|
||||
bct.task_type as tasktype
|
||||
from basic_certificate_task bct
|
||||
left join basic_certificate bc on bct.certificate_no=bc.certificate_no
|
||||
left join sys_dept sd on bc.dept_id=sd.dept_id
|
||||
left join (select * from sys_dict_data where dict_type='sys_certificate_type') sdd on bc.certificate_type=sdd.dict_value
|
||||
where bct.task_no=#{taskNo}
|
||||
</select>
|
||||
<select id="checkDeviceNumberUnique" resultType="java.lang.Integer">
|
||||
select count(1) from device_info where device_number = #{deviceNumber}
|
||||
<if test="deviceId != null">and device_id != #{deviceId}</if>
|
||||
</select>
|
||||
<select id="checkDeviceSnUnique" resultType="java.lang.Integer">
|
||||
select count(1) from device_info where device_sn = #{deviceSn}
|
||||
<if test="deviceId != null">and device_id != #{deviceId}</if>
|
||||
</select>
|
||||
<select id="selectDeviceRecipeBinding" resultType="java.lang.String">
|
||||
select recipe_id from cook_recipe_bind_device where stall_id = #{stallId} and recipe_id is not null
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertCertificateInfo" parameterType="com.bonus.canteen.core.certificate.vo.CertificateInfo" >
|
||||
insert into basic_certificate
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="deptId != null and deptId != ''">dept_id,</if>
|
||||
<if test="name != null">name,</if>
|
||||
<if test="idNumber != null">id_number,</if>
|
||||
<if test="birthday != null">birthday,</if>
|
||||
<if test="birthAddr != null">birth_addr,</if>
|
||||
<if test="certificateType != null">certificate_type,</if>
|
||||
<if test="certificateNo != null">certificate_no,</if>
|
||||
<if test="issueAddr != null">issue_addr,</if>
|
||||
<if test="issueDay != null">issue_day,</if>
|
||||
<if test="issueLifespan != null">issue_lifespan,</if>
|
||||
<if test="isEle != null and isEle != ''">is_ele,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deptId != null and deptId != ''">#{deptId},</if>
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="idNumber != null">#{idNumber},</if>
|
||||
<if test="birthday != null">#{birthday},</if>
|
||||
<if test="birthAddr != null">#{birthAddr},</if>
|
||||
<if test="certificateType != null">#{certificateType},</if>
|
||||
<if test="certificateNo != null">#{certificateNo},</if>
|
||||
<if test="issueAddr != null">#{issueAddr},</if>
|
||||
<if test="issueDay != null">#{issueDay},</if>
|
||||
<if test="issueLifespan != null">#{issueLifespan},</if>
|
||||
<if test="isEle != null and isEle != ''">#{isEle},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateCertificateInfo" parameterType="com.bonus.canteen.core.certificate.vo.CertificateInfo">
|
||||
update basic_certificate
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="deptId != null and deptId != ''">dept_id = #{deptId},</if>
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="birthday != null">birthday = #{birthday},</if>
|
||||
<if test="birthAddr != null">birth_addr = #{birthAddr},</if>
|
||||
<if test="certificateType != null">certificate_type = #{certificateType},</if>
|
||||
<if test="certificateNo != null">certificate_no = #{certificateNo},</if>
|
||||
<if test="issueAddr != null">issue_addr = #{issueAddr},</if>
|
||||
<if test="issueDay != null">issue_day = #{issueDay},</if>
|
||||
<if test="issueLifespan != null">issue_lifespan = #{issueLifespan},</if>
|
||||
<if test="isEle != null and isEle != ''">is_ele = #{isEle},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where certificate_no = #{certificateNo}
|
||||
</update>
|
||||
<update id="updateDeviceBinding">
|
||||
update device_bind
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="areaId != null and areaId != ''">area_id = #{areaId},</if>
|
||||
<if test="canteenId != null and canteenId != ''">canteen_id = #{canteenId},</if>
|
||||
<if test="stallId != null and stallId != ''">stall_id = #{stallId},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where device_id = #{deviceId}
|
||||
</update>
|
||||
<update id="updateDeviceRecipeBinding">
|
||||
update cook_recipe_bind_device
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="canteenId != null and canteenId != ''">canteen_id = #{canteenId},</if>
|
||||
<if test="stallId != null and stallId != ''">stall_id = #{stallId},</if>
|
||||
<if test="recipeId != null and recipeId != ''">recipe_id = #{recipeId},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where device_id = #{deviceId}
|
||||
</update>
|
||||
<update id="updateTimeBySn">
|
||||
update device_info
|
||||
set last_update_time = unix_timestamp()
|
||||
where device_sn = #{sn}
|
||||
</update>
|
||||
|
||||
<delete id="deleteCertificateInfoByDeviceId" parameterType="Long">
|
||||
delete from device_info where device_id = #{deviceId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteCertificateInfoByDeviceIds" parameterType="String">
|
||||
delete from device_info where device_id in
|
||||
<foreach item="deviceId" collection="deviceIds" open="(" separator="," close=")">
|
||||
#{deviceId}
|
||||
</foreach>
|
||||
</delete>
|
||||
<delete id="deleteDeviceBinding">
|
||||
delete from device_bind where device_id in
|
||||
<foreach item="deviceId" collection="deviceIds" open="(" separator="," close=")">
|
||||
#{deviceId}
|
||||
</foreach>
|
||||
</delete>
|
||||
<delete id="deleteDeviceRecipeBinding">
|
||||
delete from cook_recipe_bind_device where device_id in
|
||||
<foreach item="deviceId" collection="deviceIds" open="(" separator="," close=")">
|
||||
#{deviceId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="updateTimeByKitchenSn">
|
||||
update kitchen_device_info
|
||||
set last_update_time = unix_timestamp()
|
||||
where device_sn = #{sn}
|
||||
</update>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue