| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import com.vci.ubcs.code.entity.CodeClassify; |
| | | import com.vci.ubcs.code.mapper.CodeClassifyMapper; |
| | | import com.vci.ubcs.code.vo.CodeOsattributeVO; |
| | | import com.vci.ubcs.code.service.ICodeClassifyService; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.TreeQueryObject; |
| | | import com.vci.ubcs.com.vci.starter.util.LocalFileUtil; |
| | | import com.vci.ubcs.com.vci.starter.web.pagemodel.BaseQueryObject; |
| | | import com.vci.ubcs.com.vci.starter.web.pagemodel.DataGrid; |
| | | import com.vci.ubcs.com.vci.starter.web.pagemodel.Tree; |
| | | import com.vci.ubcs.com.vci.starter.web.util.ControllerUtil; |
| | | import com.vci.ubcs.com.vci.starter.web.util.LangBaseUtil; |
| | | import com.vci.ubcs.com.vci.starter.web.util.VciBaseUtil; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeImProtRusultVO; |
| | | import com.vci.ubcs.code.wrapper.CodeClassifyWrapper; |
| | | import com.vci.ubcs.omd.vo.BtmTypeAttributeVO; |
| | | import com.vci.ubcs.starter.revision.model.TreeQueryObject; |
| | | import com.vci.ubcs.starter.util.LocalFileUtil; |
| | | import com.vci.ubcs.starter.web.pagemodel.BaseQueryObject; |
| | | import com.vci.ubcs.starter.web.pagemodel.DataGrid; |
| | | import com.vci.ubcs.starter.web.pagemodel.Tree; |
| | | import com.vci.ubcs.starter.web.util.ControllerUtil; |
| | | import com.vci.ubcs.starter.web.util.LangBaseUtil; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import lombok.AllArgsConstructor; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | |
| | | import lombok.extern.log4j.Log4j; |
| | | import lombok.extern.log4j.Log4j2; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.IResultCode; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.vci.ubcs.code.wrapper.CodeClassifyWrapper; |
| | | import com.vci.ubcs.code.service.ICodeClassifyService; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.nio.charset.StandardCharsets; |
| | |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("ubcs-code/codeClassify") |
| | | @RequestMapping("/codeClassify") |
| | | @Api(value = "主题库定义表", tags = "主题库定义表接口") |
| | | @Log4j2 |
| | | public class CodeClassifyController extends BladeController { |
| | | |
| | | private final ICodeClassifyService codeClassifyService; |
| | |
| | | |
| | | /** |
| | | * 主题库定义表 新增 |
| | | * @param |
| | | */ |
| | | @PostMapping("/save") |
| | | @ApiOperationSupport(order = 4) |
| | |
| | | * @return 执行结果 success为true为可以删除,false表示有数据引用 |
| | | */ |
| | | @PostMapping( "/checkIsCanDelete") |
| | | public R checkIsCanDelete(CodeClassify codeClassify) { |
| | | public R checkIsCanDelete(@Valid @RequestBody CodeClassify codeClassify) { |
| | | return codeClassifyService.checkIsCanDelete(codeClassify); |
| | | } |
| | | |
| | |
| | | * @return 删除结果反馈::success:成功,fail:失败 |
| | | */ |
| | | @DeleteMapping( "/deleteData") |
| | | public R delCodeClassify(CodeClassify codeClassify) { |
| | | public R delCodeClassify(@Valid @RequestBody CodeClassify codeClassify) { |
| | | return codeClassifyService.deleteCodeClassify(codeClassify); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping( "/enableData") |
| | | public R enable(CodeClassify codeClassify) { |
| | | public R enable(@Valid @RequestBody CodeClassify codeClassify) { |
| | | return codeClassifyService.updateLcStatus(codeClassify.getOid(),FRAMEWORK_DATA_ENABLED); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping( "/disableData") |
| | | public R disable(CodeClassify codeClassify) { |
| | | public R disable(@Valid @RequestBody CodeClassify codeClassify) { |
| | | return codeClassifyService.updateLcStatus(codeClassify.getOid(),FRAMEWORK_DATA_DISABLED); |
| | | } |
| | | |
| | |
| | | * @param oid 分类主键 |
| | | */ |
| | | @GetMapping("/exportClassify") |
| | | public void exportClassify(String oid, HttpServletResponse response) throws IOException { |
| | | public void exportClassify(@ApiParam(value = "主键", required = true) @RequestParam String oid, HttpServletResponse response) throws IOException { |
| | | String excelName = codeClassifyService.exportClassify(oid); |
| | | try { |
| | | ControllerUtil.writeFileToResponse(response,excelName); |
| | |
| | | codeClassifyService.importClassify(file1); |
| | | return R.success("导入成功!"); |
| | | }catch (Throwable e) { |
| | | log.error("导入错误",e); |
| | | String errorFile = LocalFileUtil.getDefaultTempFolder() + File.separator + "错误信息.txt"; |
| | | LocalFileUtil.writeContentToFile(LangBaseUtil.getErrorMsg(e),errorFile); |
| | | //放到map里 |
| | | // R result = R.fail("导入失败"); |
| | | // result.(ControllerUtil.putErrorFile(errorFile)); |
| | | return R.data(400,errorFile,"导入失败"); |
| | | CodeImProtRusultVO codeImProtRusultVO =new CodeImProtRusultVO(); |
| | | codeImProtRusultVO.setRedisUuid(""); |
| | | codeImProtRusultVO.setFileOid(ControllerUtil.putErrorFile(errorFile)); |
| | | codeImProtRusultVO.setFilePath(errorFile); |
| | | R r = R.fail("导入失败"); |
| | | r.setData(codeImProtRusultVO); |
| | | return r; |
| | | }finally { |
| | | file1.delete(); |
| | | } |
| | |
| | | * @return 属性的信息,包含默认的属性 |
| | | */ |
| | | @GetMapping("/listClassifyLinkAttr") |
| | | public DataGrid<CodeOsattributeVO> listClassifyLinkAttr(BaseQueryObject baseQueryObject){ |
| | | public DataGrid<BtmTypeAttributeVO> listClassifyLinkAttr(BaseQueryObject baseQueryObject){ |
| | | return codeClassifyService.listClassifyLinkAttr(baseQueryObject); |
| | | } |
| | | |
| | | /** |
| | | * 主键获取主题库分类 |
| | | * @param oid 主键 |
| | | * @return 主题库分类显示对象 |
| | | */ |
| | | @GetMapping("/getObjectByOid") |
| | | public R<CodeClassifyVO> getObjectByOid(String oid){ |
| | | CodeClassifyVO codeClassifyVO = codeClassifyService.getObjectByOid(oid); |
| | | return R.data(codeClassifyVO); |
| | | } |
| | | |
| | | /** |
| | |
| | | public List<Tree> treeTopCodeClassify(TreeQueryObject treeQueryObject){ |
| | | return codeClassifyService.treeTopCodeClassify(treeQueryObject); |
| | | } |
| | | |
| | | /** |
| | | * 主题库定义表 详情 |
| | | */ |
| | | @GetMapping("/getObjectByClsfNamePath") |
| | | public R<CodeClassifyVO> getObjectByClsfNamePath(String clsfNamePath) { |
| | | CodeClassifyVO codeClassifyVO = codeClassifyService.getObjectByClsfNamePath(clsfNamePath); |
| | | return R.data(codeClassifyVO); |
| | | } |
| | | } |