fix
This commit is contained in:
parent
90750ac3b9
commit
d003b1d971
@ -5,7 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.sunyard.chsm.utils.JsonUtils;
|
||||||
import com.sunyard.ssp.common.Result;
|
import com.sunyard.ssp.common.Result;
|
||||||
import com.sunyard.ssp.constv.Alg;
|
import com.sunyard.ssp.constv.Alg;
|
||||||
import com.sunyard.ssp.modules.monitor.log.entity.AuditLog;
|
import com.sunyard.ssp.modules.monitor.log.entity.AuditLog;
|
||||||
@ -19,7 +19,6 @@ import com.sunyard.ssp.modules.user.entity.UkeyLoginParm;
|
|||||||
import com.sunyard.ssp.modules.user.service.IScUserRoleService;
|
import com.sunyard.ssp.modules.user.service.IScUserRoleService;
|
||||||
import com.sunyard.ssp.modules.user.service.IScUserService;
|
import com.sunyard.ssp.modules.user.service.IScUserService;
|
||||||
import com.sunyard.ssp.util.BytesUtil;
|
import com.sunyard.ssp.util.BytesUtil;
|
||||||
import com.sunyard.ssp.utils.FileUtil;
|
|
||||||
import com.sunyard.ssp.utils.IpUtil;
|
import com.sunyard.ssp.utils.IpUtil;
|
||||||
import com.sunyard.ssp.utils.ResultUtil;
|
import com.sunyard.ssp.utils.ResultUtil;
|
||||||
import com.sunyard.ssp.utils.SecurityUtil;
|
import com.sunyard.ssp.utils.SecurityUtil;
|
||||||
@ -31,8 +30,14 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import io.swagger.annotations.ApiParam;
|
import io.swagger.annotations.ApiParam;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.core.io.ByteArrayResource;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
import org.springframework.util.FileCopyUtils;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
@ -41,12 +46,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.InputStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -81,17 +82,10 @@ public class ScUShieldController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SecurityUtil securityUtil;
|
private SecurityUtil securityUtil;
|
||||||
|
|
||||||
@Value("${file.path}")
|
|
||||||
private String filePath;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private FileUtil fileUtil;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IParamConfService iParamConfService;
|
private IParamConfService iParamConfService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SdkApiService sdkApiService;
|
private SdkApiService sdkApiService;
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IAuditLogService auditLogService;
|
private IAuditLogService auditLogService;
|
||||||
|
|
||||||
@ -118,7 +112,7 @@ public class ScUShieldController {
|
|||||||
UkeyLoginParm ukeyLoginParm = new UkeyLoginParm(loginDto.getRa(), loginDto.getRb(), loginDto.getSignInfo(), loginDto.getUserId(), loginDto.getSignData(), loginDto.getRa() + loginDto.getRb() + loginDto.getSignData());
|
UkeyLoginParm ukeyLoginParm = new UkeyLoginParm(loginDto.getRa(), loginDto.getRb(), loginDto.getSignInfo(), loginDto.getUserId(), loginDto.getSignData(), loginDto.getRa() + loginDto.getRb() + loginDto.getSignData());
|
||||||
list.add(ukeyLoginParm);
|
list.add(ukeyLoginParm);
|
||||||
}
|
}
|
||||||
auditLog.setRequestParam(mapper.writeValueAsString(list));
|
auditLog.setRequestParam(JsonUtils.toJsonString(list));
|
||||||
//Ip信息
|
//Ip信息
|
||||||
auditLog.setIpAddress(IpUtil.getIpAddress(request));
|
auditLog.setIpAddress(IpUtil.getIpAddress(request));
|
||||||
auditLog.setIpInfo("未知");
|
auditLog.setIpInfo("未知");
|
||||||
@ -394,38 +388,24 @@ public class ScUShieldController {
|
|||||||
|
|
||||||
@RequestMapping(value = "/dowloadFile", method = RequestMethod.GET)
|
@RequestMapping(value = "/dowloadFile", method = RequestMethod.GET)
|
||||||
@ApiOperation(value = "下载U盾插件接口")
|
@ApiOperation(value = "下载U盾插件接口")
|
||||||
public void dowloadFile(@RequestParam("fileName") @ApiParam(value = "文件名") String fileName,
|
public ResponseEntity<Resource> dowloadFile(@RequestParam("fileName") @ApiParam(value = "文件名") String fileName) {
|
||||||
HttpServletResponse response) {
|
try (InputStream is = getClass().getResourceAsStream("/files/" + fileName)) {
|
||||||
String url = filePath + "/" + fileName;
|
Assert.notNull(is, "文件不存在");
|
||||||
File file = new File(url);
|
byte[] bytes = FileCopyUtils.copyToByteArray(is);
|
||||||
FileInputStream i = null;
|
// 设置下载响应的 headers
|
||||||
OutputStream o = null;
|
HttpHeaders headers = new HttpHeaders();
|
||||||
try {
|
headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + URLEncoder.encode(fileName, "UTF-8") + "\"");
|
||||||
response.setContentType("application/octet-stream");
|
|
||||||
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
|
// 返回带文件内容的响应
|
||||||
} catch (UnsupportedEncodingException e) {
|
return ResponseEntity.ok()
|
||||||
e.printStackTrace();
|
.headers(headers)
|
||||||
|
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
|
.body(new ByteArrayResource(bytes));
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("", e);
|
||||||
|
throw new IllegalArgumentException("读取文件出错");
|
||||||
}
|
}
|
||||||
if (file.exists()) {
|
|
||||||
try {
|
|
||||||
i = new FileInputStream(file);
|
|
||||||
o = response.getOutputStream();
|
|
||||||
|
|
||||||
byte[] buf = new byte[1024];
|
|
||||||
int bytesRead;
|
|
||||||
|
|
||||||
while ((bytesRead = i.read(buf)) > 0) {
|
|
||||||
o.write(buf, 0, bytesRead);
|
|
||||||
o.flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
i.close();
|
|
||||||
o.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.error(e.toString());
|
|
||||||
throw new RuntimeException("读取文件出错");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ public class SM2Util {
|
|||||||
ECPublicKeyParameters pubKey = BCECUtils.createECPublicKeyParameters(xHex, yHex, SM2Util.CURVE, SM2Util.DOMAIN_PARAMS);
|
ECPublicKeyParameters pubKey = BCECUtils.createECPublicKeyParameters(xHex, yHex, SM2Util.CURVE, SM2Util.DOMAIN_PARAMS);
|
||||||
|
|
||||||
|
|
||||||
byte[] s = com.sunyard.ssp.util.BytesUtil.decodeBase64( sign );
|
byte[] s = Base64.getDecoder().decode( sign );
|
||||||
log.info( com.sunyard.ssp.util.BytesUtil.bytes2HexString( s ) );
|
log.info( com.sunyard.ssp.util.BytesUtil.bytes2HexString( s ) );
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,7 +109,6 @@ captcha:
|
|||||||
# 忽略鉴权url
|
# 忽略鉴权url
|
||||||
ignored:
|
ignored:
|
||||||
urls:
|
urls:
|
||||||
- /**
|
|
||||||
- /common/captcha/**
|
- /common/captcha/**
|
||||||
- /swagger/**
|
- /swagger/**
|
||||||
- /**/v2/api-docs
|
- /**/v2/api-docs
|
||||||
|
BIN
chsm-web-manage/src/main/resources/files/Setup_V1.0.1.exe
Normal file
BIN
chsm-web-manage/src/main/resources/files/Setup_V1.0.1.exe
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user