fix
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package com.sunyard.chsm.controller;
|
||||
|
||||
import com.sunyard.chsm.auth.AuthCode;
|
||||
import com.sunyard.chsm.constant.AuthCodeConst;
|
||||
import com.sunyard.chsm.model.R;
|
||||
import com.sunyard.chsm.param.HashReq;
|
||||
import com.sunyard.chsm.param.HashResp;
|
||||
import com.sunyard.chsm.sdf.SdfApiService;
|
||||
import com.sunyard.chsm.utils.CodecUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 杂凑运算类接口
|
||||
*
|
||||
* @author liulu
|
||||
* @since 2024/12/19
|
||||
*/
|
||||
@RestController
|
||||
public class HashController {
|
||||
|
||||
@Resource
|
||||
private SdfApiService sdfApiService;
|
||||
|
||||
/**
|
||||
* 计算Hash
|
||||
*
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/hash")
|
||||
@AuthCode(AuthCodeConst.cal_hash)
|
||||
public R<HashResp> hash(@Valid @RequestBody HashReq req) {
|
||||
byte[] bytes = CodecUtils.decodeBase64(req.getPlainData());
|
||||
byte[] hash = sdfApiService.hash(bytes);
|
||||
HashResp resp = new HashResp();
|
||||
resp.setHash(CodecUtils.encodeBase64(hash));
|
||||
return R.data(resp);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user