|
@@ -8,13 +8,17 @@ import com.persagy.dmp.common.model.response.CommonResult;
|
|
import com.persagy.dmp.common.utils.ResultHelper;
|
|
import com.persagy.dmp.common.utils.ResultHelper;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
+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.RequestParam;
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
-@CrossOrigin
|
|
|
|
@RequestMapping("template")
|
|
@RequestMapping("template")
|
|
public class TemplateController {
|
|
public class TemplateController {
|
|
|
|
|
|
@@ -23,63 +27,63 @@ public class TemplateController {
|
|
|
|
|
|
@ApiOperation("查询模板列表")
|
|
@ApiOperation("查询模板列表")
|
|
@GetMapping("getTemplates")
|
|
@GetMapping("getTemplates")
|
|
- public CommonResult<List<Folder>> getTemplates(){
|
|
|
|
|
|
+ public CommonResult<List<Folder>> getTemplates() {
|
|
return ResultHelper.single(templateManager.getTemplates());
|
|
return ResultHelper.single(templateManager.getTemplates());
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation("按系统图类型查询模板列表")
|
|
@ApiOperation("按系统图类型查询模板列表")
|
|
@GetMapping("getTemplatesByType")
|
|
@GetMapping("getTemplatesByType")
|
|
- public CommonResult<List<DiagramTemplate>> getTemplatesByType(@RequestParam String diagramType){
|
|
|
|
|
|
+ public CommonResult<List<DiagramTemplate>> getTemplatesByType(@RequestParam String diagramType) {
|
|
return ResultHelper.single(templateManager.getTemplates(diagramType));
|
|
return ResultHelper.single(templateManager.getTemplates(diagramType));
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("newTemplate")
|
|
@PostMapping("newTemplate")
|
|
- public CommonResult<DiagramTemplate> newTemplate(@RequestBody Map<String, String> params){
|
|
|
|
|
|
+ public CommonResult<DiagramTemplate> newTemplate(@RequestBody Map<String, String> params) {
|
|
return ResultHelper.single(templateManager.createTemplate(params.get("name"), params.get("type")));
|
|
return ResultHelper.single(templateManager.createTemplate(params.get("name"), params.get("type")));
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("delTemplate")
|
|
@PostMapping("delTemplate")
|
|
- public CommonResult<Boolean> delTemplate(@RequestBody Map<String, String> params){
|
|
|
|
|
|
+ public CommonResult<Boolean> delTemplate(@RequestBody Map<String, String> params) {
|
|
return ResultHelper.single(templateManager.deleteTemplate(params.get("id")));
|
|
return ResultHelper.single(templateManager.deleteTemplate(params.get("id")));
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("editTemplateInfo")
|
|
@PostMapping("editTemplateInfo")
|
|
- public CommonResult<Boolean> editTemplateInfo(@RequestBody Map<String, String> params){
|
|
|
|
|
|
+ public CommonResult<Boolean> editTemplateInfo(@RequestBody Map<String, String> params) {
|
|
return ResultHelper.single(templateManager.editTemplateInfo(params.remove("id"), params));
|
|
return ResultHelper.single(templateManager.editTemplateInfo(params.remove("id"), params));
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("addCon")
|
|
@PostMapping("addCon")
|
|
- public CommonResult<DiagramTemplate> addCon(@RequestBody EditRequest params){
|
|
|
|
|
|
+ public CommonResult<DiagramTemplate> addCon(@RequestBody EditRequest params) {
|
|
return ResultHelper.single(templateManager.addCon(params.getNewCompId(), params.getCurrentCompId(), params.getTemplateId()));
|
|
return ResultHelper.single(templateManager.addCon(params.getNewCompId(), params.getCurrentCompId(), params.getTemplateId()));
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("delCon")
|
|
@PostMapping("delCon")
|
|
- public CommonResult<DiagramTemplate> delCon(@RequestBody EditRequest params){
|
|
|
|
|
|
+ public CommonResult<DiagramTemplate> delCon(@RequestBody EditRequest params) {
|
|
return ResultHelper.single(templateManager.delCon(params.getCurrentCompId(), params.getTemplateId()));
|
|
return ResultHelper.single(templateManager.delCon(params.getCurrentCompId(), params.getTemplateId()));
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("moveCon")
|
|
@PostMapping("moveCon")
|
|
- public CommonResult<DiagramTemplate> moveCon(@RequestBody EditRequest params){
|
|
|
|
|
|
+ public CommonResult<DiagramTemplate> moveCon(@RequestBody EditRequest params) {
|
|
return ResultHelper.single(templateManager.moveCon(params.getCurrentCompId(), params.getTemplateId(), params.getMoveOffset()));
|
|
return ResultHelper.single(templateManager.moveCon(params.getCurrentCompId(), params.getTemplateId(), params.getMoveOffset()));
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("addMainPipe")
|
|
@PostMapping("addMainPipe")
|
|
- public CommonResult<DiagramTemplate> addMainPipe(@RequestBody EditRequest params){
|
|
|
|
|
|
+ public CommonResult<DiagramTemplate> addMainPipe(@RequestBody EditRequest params) {
|
|
return ResultHelper.single(templateManager.addMainPipe(params.getLines(), params.getTemplateId()));
|
|
return ResultHelper.single(templateManager.addMainPipe(params.getLines(), params.getTemplateId()));
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("delLine")
|
|
@PostMapping("delLine")
|
|
- public CommonResult<DiagramTemplate> delLine(@RequestBody EditRequest params){
|
|
|
|
|
|
+ public CommonResult<DiagramTemplate> delLine(@RequestBody EditRequest params) {
|
|
return ResultHelper.single(templateManager.delMainPipe(params.getCurrentCompId(), params.getTemplateId()));
|
|
return ResultHelper.single(templateManager.delMainPipe(params.getCurrentCompId(), params.getTemplateId()));
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("modifyCon")
|
|
@PostMapping("modifyCon")
|
|
- public CommonResult<DiagramTemplate> modifyCon(@RequestBody EditRequest params){
|
|
|
|
|
|
+ public CommonResult<DiagramTemplate> modifyCon(@RequestBody EditRequest params) {
|
|
return ResultHelper.single(templateManager.modifyCon(params.getTemplatePropsData(), params.getCurrentCompId(), params.getTemplateId()));
|
|
return ResultHelper.single(templateManager.modifyCon(params.getTemplatePropsData(), params.getCurrentCompId(), params.getTemplateId()));
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("modifyMainPipe")
|
|
@PostMapping("modifyMainPipe")
|
|
- public CommonResult<DiagramTemplate> modifyMainPipe(@RequestBody EditRequest params){
|
|
|
|
|
|
+ public CommonResult<DiagramTemplate> modifyMainPipe(@RequestBody EditRequest params) {
|
|
return ResultHelper.single(templateManager.modifyMainPipe(params.getTemplatePropsData(), params.getCurrentCompId(), params.getTemplateId()));
|
|
return ResultHelper.single(templateManager.modifyMainPipe(params.getTemplatePropsData(), params.getCurrentCompId(), params.getTemplateId()));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -87,7 +91,7 @@ public class TemplateController {
|
|
* 编辑设备过滤条件
|
|
* 编辑设备过滤条件
|
|
*/
|
|
*/
|
|
@PostMapping("modifyFilter")
|
|
@PostMapping("modifyFilter")
|
|
- public CommonResult<DiagramTemplate> modifyFilter(@RequestBody EditRequest params){
|
|
|
|
|
|
+ public CommonResult<DiagramTemplate> modifyFilter(@RequestBody EditRequest params) {
|
|
return ResultHelper.single(templateManager.modifyFilter(params.getDataFilter(), params.getCurrentCompId(), params.getTemplateId()));
|
|
return ResultHelper.single(templateManager.modifyFilter(params.getDataFilter(), params.getCurrentCompId(), params.getTemplateId()));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -95,7 +99,7 @@ public class TemplateController {
|
|
* 编辑设备打包配置
|
|
* 编辑设备打包配置
|
|
*/
|
|
*/
|
|
@PostMapping("modifyPack")
|
|
@PostMapping("modifyPack")
|
|
- public CommonResult<DiagramTemplate> modifyPack(@RequestBody EditRequest params){
|
|
|
|
|
|
+ public CommonResult<DiagramTemplate> modifyPack(@RequestBody EditRequest params) {
|
|
return ResultHelper.single(templateManager.modifyPack(params.getEquipPack(), params.getCurrentCompId(), params.getTemplateId()));
|
|
return ResultHelper.single(templateManager.modifyPack(params.getEquipPack(), params.getCurrentCompId(), params.getTemplateId()));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -103,7 +107,7 @@ public class TemplateController {
|
|
* 编辑容器的动态组配置
|
|
* 编辑容器的动态组配置
|
|
*/
|
|
*/
|
|
@PostMapping("modifyDynGroup")
|
|
@PostMapping("modifyDynGroup")
|
|
- public CommonResult<DiagramTemplate> modifyDynGroup(@RequestBody EditRequest params){
|
|
|
|
|
|
+ public CommonResult<DiagramTemplate> modifyDynGroup(@RequestBody EditRequest params) {
|
|
return ResultHelper.single(templateManager.modifyDynGroup(params.getDynGroup(), params.getCurrentCompId(), params.getTemplateId()));
|
|
return ResultHelper.single(templateManager.modifyDynGroup(params.getDynGroup(), params.getCurrentCompId(), params.getTemplateId()));
|
|
}
|
|
}
|
|
|
|
|