|
|
|
@ -7,10 +7,7 @@ import com.psdc.service.ISecretKeyService; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.Optional; |
|
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @Author:戴仕崑 |
|
|
|
@ -77,6 +74,10 @@ public class SecretKeyController { |
|
|
|
|
@PostMapping("/upKeyData") |
|
|
|
|
public AjaxResult upKeyDate(@RequestBody Map<String, Object> requestBody){ |
|
|
|
|
List<String> cpuIds = (List<String>) requestBody.get("cpuIds"); |
|
|
|
|
List<String> thisCpuIds = new ArrayList<>(); |
|
|
|
|
for (String s : cpuIds){ |
|
|
|
|
thisCpuIds.add(secretKeyService.getString(s)); |
|
|
|
|
} |
|
|
|
|
String expiration = (String) requestBody.get("expiration"); |
|
|
|
|
String key = (String) requestBody.get("key"); |
|
|
|
|
String companyName = (String) requestBody.get("companyname"); |
|
|
|
@ -84,14 +85,14 @@ public class SecretKeyController { |
|
|
|
|
Map map = new HashMap(); |
|
|
|
|
map.put("companyname", companyName); |
|
|
|
|
map.put("expireTime", expiration); |
|
|
|
|
map.put("cpuIds", cpuIds.toString()); |
|
|
|
|
map.put("cpuIds", thisCpuIds.toString()); |
|
|
|
|
AjaxResult ajax = AjaxResult.success(); |
|
|
|
|
String s = generateKey.generateKey(map, key); |
|
|
|
|
ajax.put("key", s); |
|
|
|
|
SecretKey secretKey = new SecretKey(); |
|
|
|
|
secretKey.setKeyValue(s); |
|
|
|
|
secretKey.setId(id); |
|
|
|
|
secretKey.setCpuIds(cpuIds.toString()); |
|
|
|
|
secretKey.setCpuIds(thisCpuIds.toString()); |
|
|
|
|
secretKey.setExportDate(expiration); |
|
|
|
|
secretKey.setKeyUnit(companyName); |
|
|
|
|
secretKeyService.updateById(secretKey); |
|
|
|
|