parent
1c1208419a
commit
8e79cdfce8
@ -1,3 +1,3 @@ |
||||
spring: |
||||
profiles: |
||||
active: prod |
||||
active: dev |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,19 @@ |
||||
package com.psdc.service.model; |
||||
|
||||
import cn.hutool.json.JSONArray; |
||||
import cn.hutool.json.JSONObject; |
||||
|
||||
/** |
||||
* @Author:戴仕崑 |
||||
* @Project:psdc |
||||
* @Filename:IBuildHeatingService |
||||
* @Slogan 致敬大师,致敬未来的你 |
||||
* @Date:2024/2/1 17:32 |
||||
* @Version 1.0 |
||||
*/ |
||||
public interface IBuildHeatingService { |
||||
|
||||
JSONObject exeModel2Report(JSONArray devSpecList, JSONObject jsonObject, String key); |
||||
|
||||
|
||||
} |
@ -0,0 +1,29 @@ |
||||
package com.psdc.service.model.impl; |
||||
|
||||
import cn.hutool.json.JSONArray; |
||||
import cn.hutool.json.JSONObject; |
||||
import com.dky.tool.ModelTool; |
||||
import com.psdc.service.model.IBuildHeatingService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* @Author:戴仕崑 |
||||
* @Project:psdc |
||||
* @Filename:BuildHeatingServiceImpl |
||||
* @Slogan 致敬大师,致敬未来的你 |
||||
* @Date:2024/2/1 17:32 |
||||
* @Version 1.0 |
||||
*/ |
||||
@Service |
||||
public class BuildHeatingServiceImpl implements IBuildHeatingService { |
||||
|
||||
|
||||
@Override |
||||
public JSONObject exeModel2Report(JSONArray devSpecList, JSONObject param, String key) { |
||||
JSONObject list = new JSONObject(); |
||||
list.put("devSpecList",devSpecList); |
||||
new ModelTool(list); |
||||
|
||||
return ModelTool.exeModel2Report(param, key); |
||||
} |
||||
} |
@ -0,0 +1,101 @@ |
||||
package com.psdc.controller.key; |
||||
|
||||
import com.psdc.core.domain.AjaxResult; |
||||
import com.psdc.entity.SecretKey; |
||||
import com.psdc.service.IGenerateKey; |
||||
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; |
||||
|
||||
/** |
||||
* @Author:戴仕崑 |
||||
* @Project:psdc |
||||
* @Filename:SecretKeyController |
||||
* @Slogan 致敬大师,致敬未来的你 |
||||
* @Date:2024/1/30 10:09 |
||||
* @Version 1.0 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/system/secret/key") |
||||
public class SecretKeyController { |
||||
|
||||
@Autowired |
||||
ISecretKeyService secretKeyService; |
||||
|
||||
@Autowired |
||||
IGenerateKey generateKey; |
||||
|
||||
/** |
||||
* 通过ID查询单条数据 |
||||
* |
||||
* @param id 主键 |
||||
* @return 实例对象 |
||||
*/ |
||||
@GetMapping("/byId") |
||||
public AjaxResult queryById(@RequestParam(value = "id") Integer id){ |
||||
AjaxResult ajax = new AjaxResult(); |
||||
ajax.put("data", secretKeyService.selOneById(id)); |
||||
return ajax; |
||||
} |
||||
|
||||
/** |
||||
* 通过ID删除单条数据 |
||||
* |
||||
* @param requestBody 参数 |
||||
* @return 实例对象 |
||||
*/ |
||||
@PostMapping("/delById") |
||||
public AjaxResult delById(@RequestBody Map<String, Object> requestBody){ |
||||
AjaxResult ajax = new AjaxResult(); |
||||
Integer id = (Integer) requestBody.get("id"); |
||||
ajax.put("data", secretKeyService.deleteById(id)); |
||||
return ajax; |
||||
} |
||||
|
||||
/** |
||||
* 分页查询 |
||||
* |
||||
* @param requestBody 筛选条件 |
||||
* @return 查询结果 |
||||
*/ |
||||
@PostMapping("/byPage") |
||||
public AjaxResult paginQuery(@RequestBody Map<String, Object> requestBody){ |
||||
String unit = (String) requestBody.get("keyUnit"); |
||||
String startDateTime = (String) requestBody.get("startDateTime"); |
||||
String endDateTime = (String) requestBody.get("endDateTime"); |
||||
Integer pageCurrent = (Integer) requestBody.get("pageCurrent"); |
||||
Integer pageSize = (Integer) requestBody.get("pageSize"); |
||||
return secretKeyService.queryAllByLimit(unit, startDateTime, endDateTime, pageCurrent, pageSize); |
||||
} |
||||
|
||||
|
||||
@PostMapping("/upKeyData") |
||||
public AjaxResult upKeyDate(@RequestBody Map<String, Object> requestBody){ |
||||
List<String> cpuIds = (List<String>) requestBody.get("cpuIds"); |
||||
String expiration = (String) requestBody.get("expiration"); |
||||
String key = (String) requestBody.get("key"); |
||||
String companyName = (String) requestBody.get("companyname"); |
||||
Integer id = (Integer) requestBody.get("id"); |
||||
Map map = new HashMap(); |
||||
map.put("companyname", companyName); |
||||
map.put("expireTime", expiration); |
||||
map.put("cpuIds", cpuIds.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.setExportDate(expiration); |
||||
secretKey.setKeyUnit(companyName); |
||||
secretKeyService.updateById(secretKey); |
||||
return ajax; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,50 @@ |
||||
package com.psdc.controller.model; |
||||
|
||||
import cn.hutool.json.JSONArray; |
||||
import cn.hutool.json.JSONObject; |
||||
import com.dky.utils.entity.SysDeviceHeatScene; |
||||
import com.psdc.core.domain.AjaxResult; |
||||
import com.psdc.entity.SecretKey; |
||||
import com.psdc.service.model.IBuildHeatingService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.PostMapping; |
||||
import org.springframework.web.bind.annotation.RequestBody; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
import java.text.SimpleDateFormat; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import java.util.Optional; |
||||
|
||||
/** |
||||
* @Author:戴仕崑 |
||||
* @Project:psdc |
||||
* @Filename:BuildHeatingController |
||||
* @Slogan 致敬大师,致敬未来的你 |
||||
* @Date:2024/2/2 8:55 |
||||
* @Version 1.0 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/system/model") |
||||
public class BuildHeatingController { |
||||
|
||||
@Autowired |
||||
IBuildHeatingService buildHeatingService; |
||||
|
||||
@PostMapping("/getReport") |
||||
public AjaxResult getGenerateKey(@RequestBody Map<String, Object> requestBody) { |
||||
List<SysDeviceHeatScene> devSpecList = (List<SysDeviceHeatScene>) requestBody.get("devSpecList"); |
||||
JSONArray objects = new JSONArray(); |
||||
objects.addAll(devSpecList); |
||||
HashMap<String, Object> param = (HashMap<String, Object>) requestBody.get("param"); |
||||
JSONObject jsonObject = new JSONObject(); |
||||
jsonObject.putAll(param); |
||||
String key = (String) requestBody.get("key"); |
||||
AjaxResult ajax = AjaxResult.success(); |
||||
ajax.put("report", buildHeatingService.exeModel2Report(objects, jsonObject, key)); |
||||
return ajax; |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue