package com.vci.web.controller;
|
|
import com.vci.corba.common.PLException;
|
import com.vci.dto.*;
|
import com.vci.starter.web.exception.VciBaseException;
|
import com.vci.starter.web.pagemodel.BaseResult;
|
import com.vci.starter.web.util.VciBaseUtil;
|
import com.vci.web.service.OsActionServiceI;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.multipart.MultipartFile;
|
|
import javax.servlet.http.HttpServletResponse;
|
import java.io.IOException;
|
import java.util.Arrays;
|
import java.util.List;
|
|
/**
|
* Action管理的控制器
|
* @author yuxc
|
* @date 2024-8-16
|
*/
|
@RequestMapping("/actionController")
|
@RestController
|
public class OsActionController {
|
|
/**
|
* Action服务
|
*/
|
@Autowired
|
private OsActionServiceI osActionServiceI;
|
|
/**
|
* 保存Action分类信息
|
* @param pLActionCls Action分类信息
|
* @return 保存结果
|
*/
|
@PostMapping("/saveActionCls")
|
public BaseResult saveActionCls(@RequestBody PLActionClsDTO pLActionCls){
|
try {
|
return osActionServiceI.saveActionCls(pLActionCls);
|
} catch (PLException e) {
|
BaseResult objectBaseResult = new BaseResult<>();
|
objectBaseResult.setCode(Integer.parseInt(e.code));
|
objectBaseResult.setMsg(Arrays.toString(e.messages));
|
return objectBaseResult;
|
}
|
}
|
|
/**
|
* 修改Action分类信息
|
* @param pLActionCls Action分类信息
|
* @return 修改结果
|
*/
|
@PostMapping("/updateActionCls")
|
public BaseResult updateActionCls(@RequestBody PLActionClsDTO pLActionCls){
|
try {
|
return osActionServiceI.updateActionCls(pLActionCls);
|
} catch (PLException e) {
|
BaseResult objectBaseResult = new BaseResult<>();
|
objectBaseResult.setCode(Integer.parseInt(e.code));
|
objectBaseResult.setMsg(Arrays.toString(e.messages));
|
return objectBaseResult;
|
}
|
}
|
|
/**
|
* 获取Action分类树
|
* isExp 是否用户导出 true是,false否
|
* @return 查询结果
|
*/
|
@GetMapping("/getActionTree")
|
public BaseResult getActionTree(boolean isExp){
|
try {
|
return osActionServiceI.getActionTree(isExp);
|
} catch (PLException e) {
|
BaseResult objectBaseResult = new BaseResult<>();
|
objectBaseResult.setCode(Integer.parseInt(e.code));
|
objectBaseResult.setMsg(Arrays.toString(e.messages));
|
return objectBaseResult;
|
}
|
}
|
|
/**
|
* 删除分类
|
* @param dto 分类对象
|
* @return 处理结果
|
* @throws PLException
|
*/
|
@DeleteMapping("/deleteActionCls")
|
public BaseResult deleteActionCls(@RequestBody PLActionClsDTO dto){
|
try {
|
return osActionServiceI.deleteActionCls(dto);
|
} catch (PLException e) {
|
BaseResult objectBaseResult = new BaseResult<>();
|
objectBaseResult.setCode(Integer.parseInt(e.code));
|
objectBaseResult.setMsg(Arrays.toString(e.messages));
|
return objectBaseResult;
|
}
|
}
|
|
/**
|
* 获取Action表格数据
|
* dto 查询条件
|
* @return 查询结果
|
*/
|
@PostMapping("/getActionTableData")
|
public BaseResult getActionTableData(@RequestBody PLActionQueryDTO dto){
|
try {
|
return osActionServiceI.getActionTableData(dto);
|
} catch (PLException e) {
|
BaseResult objectBaseResult = new BaseResult<>();
|
objectBaseResult.setCode(Integer.parseInt(e.code));
|
objectBaseResult.setMsg(Arrays.toString(e.messages));
|
return objectBaseResult;
|
}
|
}
|
|
/**
|
* 保存Action数据
|
* dto action传输对象
|
* @return 保存结果
|
*/
|
@PostMapping("/saveAction")
|
public BaseResult saveAction(@RequestBody PLActionDTO dto){
|
try {
|
return osActionServiceI.saveAction(dto);
|
} catch (PLException e) {
|
BaseResult objectBaseResult = new BaseResult<>();
|
objectBaseResult.setCode(Integer.parseInt(e.code));
|
objectBaseResult.setMsg(Arrays.toString(e.messages));
|
return objectBaseResult;
|
}
|
}
|
|
/**
|
* 修改Action数据
|
* dto action传输对象
|
* @return 修改结果
|
*/
|
@PostMapping("/updateAction")
|
public BaseResult updateAction(@RequestBody PLActionDTO dto){
|
try {
|
return osActionServiceI.updateAction(dto);
|
} catch (PLException e) {
|
BaseResult objectBaseResult = new BaseResult<>();
|
objectBaseResult.setCode(Integer.parseInt(e.code));
|
objectBaseResult.setMsg(Arrays.toString(e.messages));
|
return objectBaseResult;
|
}
|
}
|
|
/**
|
* 删除Action数据
|
* dto action传输对象
|
* @return 删除结果
|
*/
|
@DeleteMapping("/deleteAction")
|
public BaseResult deleteAction(@RequestBody PLActionDTO dto){
|
try {
|
return osActionServiceI.deleteAction(dto);
|
} catch (PLException e) {
|
BaseResult objectBaseResult = new BaseResult<>();
|
objectBaseResult.setCode(Integer.parseInt(e.code));
|
objectBaseResult.setMsg(Arrays.toString(e.messages));
|
return objectBaseResult;
|
}
|
}
|
|
/**
|
* 导出Action分类
|
* @return
|
*/
|
@PostMapping("/exportBeans")
|
public void exportBeans(@RequestBody List<String> actionOid, HttpServletResponse response) throws PLException, IOException {
|
osActionServiceI.exportBeans(actionOid, response);
|
}
|
|
/**
|
* 导入Action
|
* @param file 上传的文件
|
* @return
|
*/
|
@PostMapping("/impData")
|
public BaseResult impData(MultipartFile file){
|
try {
|
return osActionServiceI.impData(file);
|
}catch (Throwable e) {
|
throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e);
|
}
|
}
|
|
/**
|
* 导出Action
|
* @param plActionExpDTO 导出属性设置对象
|
*/
|
@PostMapping("/exportAction")
|
public void exportAction(@RequestBody PLActionExpDTO plActionExpDTO, HttpServletResponse response) throws PLException {
|
try {
|
osActionServiceI.exportAction(plActionExpDTO, response);
|
}catch (Throwable e) {
|
throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e);
|
}
|
}
|
|
/**
|
* 保存Action参数数据
|
* dto action传输对象
|
* @return 保存结果
|
*/
|
@PostMapping("/savePLActionParam")
|
public BaseResult savePLActionParam(@RequestBody PLActionParamDTO dto){
|
try {
|
return osActionServiceI.savePLActionParam(dto);
|
} catch (PLException e) {
|
BaseResult objectBaseResult = new BaseResult<>();
|
objectBaseResult.setCode(Integer.parseInt(e.code));
|
objectBaseResult.setMsg(Arrays.toString(e.messages));
|
return objectBaseResult;
|
}
|
}
|
|
/**
|
* 修改Action参数数据
|
* dto action传输对象
|
* @return 保存结果
|
*/
|
@PostMapping("/updatePLActionParam")
|
public BaseResult updatePLActionParam(@RequestBody PLActionParamDTO dto){
|
try {
|
return osActionServiceI.updatePLActionParam(dto);
|
} catch (PLException e) {
|
BaseResult objectBaseResult = new BaseResult<>();
|
objectBaseResult.setCode(Integer.parseInt(e.code));
|
objectBaseResult.setMsg(Arrays.toString(e.messages));
|
return objectBaseResult;
|
}
|
}
|
/**
|
* 删除Action参数数据
|
* oid 参数主键
|
* @return 保存结果
|
*/
|
@DeleteMapping("/deletePLActionParam")
|
public BaseResult deletePLActionParam(String oid){
|
try {
|
return osActionServiceI.deletePLActionParam(oid);
|
} catch (PLException e) {
|
BaseResult objectBaseResult = new BaseResult<>();
|
objectBaseResult.setCode(Integer.parseInt(e.code));
|
objectBaseResult.setMsg(Arrays.toString(e.messages));
|
return objectBaseResult;
|
}
|
}
|
/**
|
* 查询Action参数列表数据
|
* actionOid 参数主键
|
* @return 保存结果
|
*/
|
@GetMapping("/getPLActionParam")
|
public BaseResult getPLActionParam(String actionOid){
|
try {
|
return osActionServiceI.getPLActionParam(actionOid);
|
} catch (PLException e) {
|
BaseResult objectBaseResult = new BaseResult<>();
|
objectBaseResult.setCode(Integer.parseInt(e.code));
|
objectBaseResult.setMsg(Arrays.toString(e.messages));
|
return objectBaseResult;
|
}
|
}
|
}
|