From f202876630baab6778935373e81e542b65172e29 Mon Sep 17 00:00:00 2001 From: Gitea Date: Thu, 21 Nov 2024 15:17:06 +0800 Subject: [PATCH] =?UTF-8?q?GST002=E7=B2=BE=E7=AE=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BasicsskillController.java | 319 ------------------ .../controller/CompskillController.java | 265 --------------- 2 files changed, 584 deletions(-) delete mode 100644 jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/basicsskill/controller/BasicsskillController.java delete mode 100644 jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compskill/controller/CompskillController.java diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/basicsskill/controller/BasicsskillController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/basicsskill/controller/BasicsskillController.java deleted file mode 100644 index 5761a310..00000000 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/basicsskill/controller/BasicsskillController.java +++ /dev/null @@ -1,319 +0,0 @@ -package org.jeecg.modules.demo.basicsskill.controller; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.jeecg.common.api.vo.Result; -import org.jeecg.common.system.query.QueryGenerator; -import org.jeecg.common.util.oConvertUtils; -import org.jeecg.common.system.vo.SelectTreeModel; -import org.jeecg.modules.demo.basicsskill.entity.Basicsskill; -import org.jeecg.modules.demo.basicsskill.service.IBasicsskillService; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import lombok.extern.slf4j.Slf4j; - -import org.jeecgframework.poi.excel.ExcelImportUtil; -import org.jeecgframework.poi.excel.def.NormalExcelConstants; -import org.jeecgframework.poi.excel.entity.ExportParams; -import org.jeecgframework.poi.excel.entity.ImportParams; -import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; -import org.jeecg.common.system.base.controller.JeecgController; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.MultipartHttpServletRequest; -import org.springframework.web.servlet.ModelAndView; -import com.alibaba.fastjson.JSON; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.jeecg.common.aspect.annotation.AutoLog; -import org.apache.shiro.authz.annotation.RequiresPermissions; - - /** - * @Description: 基础能力设置 - * @Author: jeecg-boot - * @Date: 2023-08-17 - * @Version: V1.0 - */ -@Api(tags="基础能力设置") -@RestController -@RequestMapping("/basicsskill/basicsskill") -@Slf4j -public class BasicsskillController extends JeecgController{ - @Autowired - private IBasicsskillService basicsskillService; - - /** - * 分页列表查询 - * - * @param basicsskill - * @param pageNo - * @param pageSize - * @param req - * @return - */ - //@AutoLog(value = "基础能力设置-分页列表查询") - @ApiOperation(value="基础能力设置-分页列表查询", notes="基础能力设置-分页列表查询") - @GetMapping(value = "/rootList") - public Result> queryPageList(Basicsskill basicsskill, - @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, - @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, - HttpServletRequest req) { - String hasQuery = req.getParameter("hasQuery"); - if(hasQuery != null && "true".equals(hasQuery)){ - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(basicsskill, req.getParameterMap()); - List list = basicsskillService.queryTreeListNoPage(queryWrapper); - IPage pageList = new Page<>(1, 10, list.size()); - pageList.setRecords(list); - return Result.OK(pageList); - }else{ - String parentId = basicsskill.getPid(); - if (oConvertUtils.isEmpty(parentId)) { - parentId = "0"; - } - basicsskill.setPid(null); - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(basicsskill, req.getParameterMap()); - // 使用 in 防止模糊查询 - queryWrapper.in("pid", "0","1"); - Page page = new Page(pageNo, pageSize); - IPage pageList = basicsskillService.page(page, queryWrapper); - for(Basicsskill basicsskill1:pageList.getRecords()){ - if(basicsskill1.getPid().equals("0")){ - basicsskill1.setPid("专业认证能力评价体系"); - }else{ - basicsskill1.setPid("创新能力评价体系"); - } - - } - - return Result.OK(pageList); - } - } - - /** - * 【vue3专用】加载节点的子数据 - * - * @param pid - * @return - */ - @RequestMapping(value = "/loadTreeChildren", method = RequestMethod.GET) - public Result> loadTreeChildren(@RequestParam(name = "pid") String pid) { - Result> result = new Result<>(); - try { - List ls = basicsskillService.queryListByPid(pid); - result.setResult(ls); - result.setSuccess(true); - } catch (Exception e) { - e.printStackTrace(); - result.setMessage(e.getMessage()); - result.setSuccess(false); - } - return result; - } - - /** - * 【vue3专用】加载一级节点/如果是同步 则所有数据 - * - * @param async - * @param pcode - * @return - */ - @RequestMapping(value = "/loadTreeRoot", method = RequestMethod.GET) - public Result> loadTreeRoot(@RequestParam(name = "async") Boolean async, @RequestParam(name = "pcode") String pcode) { - Result> result = new Result<>(); - try { - List ls = basicsskillService.queryListByCode(pcode); - if (!async) { - loadAllChildren(ls); - } - result.setResult(ls); - result.setSuccess(true); - } catch (Exception e) { - e.printStackTrace(); - result.setMessage(e.getMessage()); - result.setSuccess(false); - } - return result; - } - - /** - * 【vue3专用】递归求子节点 同步加载用到 - * - * @param ls - */ - private void loadAllChildren(List ls) { - for (SelectTreeModel tsm : ls) { - List temp = basicsskillService.queryListByPid(tsm.getKey()); - if (temp != null && temp.size() > 0) { - tsm.setChildren(temp); - loadAllChildren(temp); - } - } - } - - /** - * 获取子数据 - * @param basicsskill - * @param req - * @return - */ - //@AutoLog(value = "基础能力设置-获取子数据") - @ApiOperation(value="基础能力设置-获取子数据", notes="基础能力设置-获取子数据") - @GetMapping(value = "/childList") - public Result> queryPageList(Basicsskill basicsskill,HttpServletRequest req) { - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(basicsskill, req.getParameterMap()); - List list = basicsskillService.list(queryWrapper); - IPage pageList = new Page<>(1, 10, list.size()); - for(Basicsskill basicsskill1: list){ - Basicsskill basicsskill2=basicsskillService.query().eq("id",basicsskill1.getPid()).one(); - if(basicsskill2!=null) - basicsskill1.setPid(basicsskill2.getName()); - } - pageList.setRecords(list); - return Result.OK(pageList); - } - - /** - * 批量查询子节点 - * @param parentIds 父ID(多个采用半角逗号分割) - * @return 返回 IPage - * @param parentIds - * @return - */ - //@AutoLog(value = "基础能力设置-批量获取子数据") - @ApiOperation(value="基础能力设置-批量获取子数据", notes="基础能力设置-批量获取子数据") - @GetMapping("/getChildListBatch") - public Result getChildListBatch(@RequestParam("parentIds") String parentIds) { - try { - QueryWrapper queryWrapper = new QueryWrapper<>(); - List parentIdList = Arrays.asList(parentIds.split(",")); - queryWrapper.in("pid", parentIdList); - List list = basicsskillService.list(queryWrapper); - IPage pageList = new Page<>(1, 10, list.size()); - pageList.setRecords(list); - return Result.OK(pageList); - } catch (Exception e) { - log.error(e.getMessage(), e); - return Result.error("批量查询子节点失败:" + e.getMessage()); - } - } - - /** - * 添加 - * - * @param basicsskill - * @return - */ - @AutoLog(value = "基础能力设置-添加") - @ApiOperation(value="基础能力设置-添加", notes="基础能力设置-添加") - //@RequiresPermissions("basicsskill:basicsskill:add") - @PostMapping(value = "/add") - public Result add(@RequestBody Basicsskill basicsskill) { - basicsskillService.addBasicsskill(basicsskill); - return Result.OK("添加成功!"); - } - - /** - * 编辑 - * - * @param basicsskill - * @return - */ - @AutoLog(value = "基础能力设置-编辑") - @ApiOperation(value="基础能力设置-编辑", notes="基础能力设置-编辑") - // @RequiresPermissions("basicsskill:basicsskill:edit") - @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) - public Result edit(@RequestBody Basicsskill basicsskill) { - if(basicsskill.getPid().equals("专业认证能力评价体系")){ - basicsskill.setPid("0"); - }else if(basicsskill.getPid().equals("创新能力评价体系")){ - basicsskill.setPid("1"); - }else { - basicsskill.setPid(basicsskillService.getById(basicsskill.getId()).getPid()); - } - basicsskillService.updateBasicsskill(basicsskill); - return Result.OK("编辑成功!"); - } - - /** - * 通过id删除 - * - * @param id - * @return - */ - @AutoLog(value = "基础能力设置-通过id删除") - @ApiOperation(value="基础能力设置-通过id删除", notes="基础能力设置-通过id删除") - //@RequiresPermissions("basicsskill:basicsskill:delete") - @DeleteMapping(value = "/delete") - public Result delete(@RequestParam(name="id",required=true) String id) { - basicsskillService.deleteBasicsskill(id); - return Result.OK("删除成功!"); - } - - /** - * 批量删除 - * - * @param ids - * @return - */ - @AutoLog(value = "基础能力设置-批量删除") - @ApiOperation(value="基础能力设置-批量删除", notes="基础能力设置-批量删除") - //@RequiresPermissions("basicsskill:basicsskill:deleteBatch") - @DeleteMapping(value = "/deleteBatch") - public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { - this.basicsskillService.removeByIds(Arrays.asList(ids.split(","))); - return Result.OK("批量删除成功!"); - } - - /** - * 通过id查询 - * - * @param id - * @return - */ - //@AutoLog(value = "基础能力设置-通过id查询") - @ApiOperation(value="基础能力设置-通过id查询", notes="基础能力设置-通过id查询") - @GetMapping(value = "/queryById") - public Result queryById(@RequestParam(name="id",required=true) String id) { - Basicsskill basicsskill = basicsskillService.getById(id); - if(basicsskill==null) { - return Result.error("未找到对应数据"); - } - return Result.OK(basicsskill); - } - - /** - * 导出excel - * - * @param request - * @param basicsskill - */ -// @RequiresPermissions("basicsskill:basicsskill:exportXls") - @RequestMapping(value = "/exportXls") - public ModelAndView exportXls(HttpServletRequest request, Basicsskill basicsskill) { - return super.exportXls(request, basicsskill, Basicsskill.class, "基础能力设置"); - } - - /** - * 通过excel导入数据 - * - * @param request - * @param response - * @return - */ -/* @RequiresPermissions("basicsskill:basicsskill:importExcel")*/ - @RequestMapping(value = "/importExcel", method = RequestMethod.POST) - public Result importExcel(HttpServletRequest request, HttpServletResponse response) { - return super.importExcel(request, response, Basicsskill.class); - } - -} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compskill/controller/CompskillController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compskill/controller/CompskillController.java deleted file mode 100644 index 2d20780a..00000000 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compskill/controller/CompskillController.java +++ /dev/null @@ -1,265 +0,0 @@ -package org.jeecg.modules.demo.compskill.controller; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.apache.shiro.SecurityUtils; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.apache.shiro.subject.Subject; -import org.jeecg.common.api.vo.Result; -import org.jeecg.common.aspect.annotation.AutoLog; -import org.jeecg.common.system.base.controller.JeecgController; -import org.jeecg.common.system.vo.LoginUser; -import org.jeecg.modules.demo.annual.entity.Annual; -import org.jeecg.modules.demo.annual.service.IAnnualService; -import org.jeecg.modules.demo.annualCompPoint.entity.AnnualCompPoint; -import org.jeecg.modules.demo.annualCompPoint.service.IAnnualCompPointService; -import org.jeecg.modules.demo.annualcomp.entity.AnnualComp; -import org.jeecg.modules.demo.annualcomp.service.IAnnualCompService; -import org.jeecg.modules.demo.basicsskill.entity.Basicsskill; -import org.jeecg.modules.demo.basicsskill.service.IBasicsskillService; -import org.jeecg.modules.demo.comp.entity.Comp; -import org.jeecg.modules.demo.comp.service.ICompService; -import org.jeecg.modules.demo.compskill.entity.Compskill; -import org.jeecg.modules.demo.compskill.entity.Compskillvo; -import org.jeecg.modules.demo.compskill.service.ICompskillService; -import org.jeecg.modules.system.entity.SysRole; -import org.jeecg.modules.system.service.ISysUserRoleService; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.util.ObjectUtils; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.servlet.ModelAndView; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.*; -import java.util.stream.Collectors; - -/** - * @Description: 项目能力设置 - * @Author: jeecg-boot - * @Date: 2023-08-17 - * @Version: V1.0 - */ -@Api(tags = "项目能力设置") -@RestController -@RequestMapping("/compskill/compskill") -@Slf4j -public class CompskillController extends JeecgController { - @Autowired - private ICompskillService compskillService; - @Autowired - private IAnnualCompPointService annualCompPointService; - @Autowired - private IBasicsskillService basicsskillService; - @Autowired - private IAnnualService annualService; - @Autowired - private IAnnualCompService annualCompService; - - @Autowired - private ICompService iCompService; - - @Autowired - private ISysUserRoleService iSysUserRoleService; - - - /** - * 分页列表查询 - * - * @param compskill - * @param pageNo - * @param pageSize - * @param req - * @return - */ - //@AutoLog(value = "项目能力设置-分页列表查询") - @ApiOperation(value = "项目能力设置-分页列表查询", notes = "项目能力设置-分页列表查询") - @GetMapping(value = "/list") - public Result> queryPageList(Compskill compskill, - @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, - @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, - HttpServletRequest req) { - - Subject subject = SecurityUtils.getSubject(); - // 获取当前登录用户 - LoginUser loginUser = (LoginUser) subject.getPrincipal(); - List roleList = iSysUserRoleService.getUserRoleByUserId(loginUser.getId()); - Map roleMap = Optional.ofNullable(roleList).orElse(new LinkedList<>()).stream().collect(Collectors.toMap(SysRole::getRoleCode, SysRole::getRoleCode)); - //角色编码 管理员&组委会&学校管理员 可以看到所有,其它用户可见到所属自己数据 - Map efficientRoleMap = new LinkedHashMap<>(); - efficientRoleMap.put("admin", "admin"); - efficientRoleMap.put("committee", "committee"); - efficientRoleMap.put("superAdmin", "superAdmin"); - - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - // 查询所属当前登录用户数据 - if (efficientRoleMap.containsValue(roleMap.get("admin")) - || efficientRoleMap.containsValue(roleMap.get("committee")) - || efficientRoleMap.containsValue(roleMap.get("superAdmin"))) { - List compList = iCompService.list(new LambdaQueryWrapper().eq(Comp::getCompAdmin, loginUser.getUsername())); - if (!ObjectUtils.isEmpty(compList)) { - Set compIds = compList.stream().map(c -> c.getId()).collect(Collectors.toSet()); - List annualCompList = annualCompService.list(new LambdaQueryWrapper().in(AnnualComp::getCompid, compIds)); - if (!ObjectUtils.isEmpty(annualCompList)) { - Set annualCompIds = annualCompList.stream().map(d -> d.getId()).collect(Collectors.toSet()); - List annualCompPointList = annualCompPointService.list(new LambdaQueryWrapper().in(AnnualCompPoint::getAnnualCompId, annualCompIds)); - if (!ObjectUtils.isEmpty(annualCompPointList)) { - Set annualCompPointIds = annualCompPointList.stream().map(e -> e.getId()).collect(Collectors.toSet()); - queryWrapper.in(Compskill::getAnnucompid, annualCompPointIds); - } - } - } - } - - - Page page = new Page(pageNo, pageSize); - Page page1 = new Page<>(); - compskillService.page(page, queryWrapper); - BeanUtils.copyProperties(page, page1, "records"); - List list = page.getRecords().stream().map((item) -> { - Compskillvo compskill1 = new Compskillvo(); - BeanUtils.copyProperties(item, compskill1); - AnnualCompPoint annualCompPoint = annualCompPointService.query().eq("id", compskill1.getAnnucompid()).one(); - AnnualComp annualComp = null; - Annual annual = null; - if (annualCompPoint != null) { - annualComp = annualCompService.query().eq("id", annualCompPoint.getAnnualCompId()).one(); - } - if (annualComp != null) { - annual = annualService.query().eq("id", annualComp.getAnnualid()).one(); - } - List basicsskillList= basicsskillService.query().eq("id", compskill1.getCapacityid()).list(); - Basicsskill basicsskill=null; - if(basicsskillList.size()>0) - { - basicsskill=basicsskillList.get(0); - } - - if (annualCompPoint != null && basicsskill != null && annualComp != null && annual != null) { - compskill1.setAnnucompid(annualCompPoint.getObjName()); - compskill1.setCapacityid(basicsskill.getName()); - compskill1.setComp(annualComp.getName()); - compskill1.setAnnual(annual.getAnnualName()); - } - return compskill1; - }).collect(Collectors.toList()); - page1.setRecords(list); - return Result.OK(page1); - } - - /** - * 添加 - * - * @param compskill - * @return - */ - @AutoLog(value = "项目能力设置-添加") - @ApiOperation(value = "项目能力设置-添加", notes = "项目能力设置-添加") - //@RequiresPermissions("compskill:compskill:add") - @PostMapping(value = "/add") - public Result add(@RequestBody Compskill compskill) { - /* if (compskill != null) { - AnnualCompPoint annualCompPoint = annualCompPointService.query().eq("obj_name", compskill.getAnnucompid()).one(); - Basicsskill basicsskill = basicsskillService.query().eq("name", compskill.getCapacityid()).one(); - if (annualCompPoint != null && basicsskill != null) { - compskill.setAnnucompid(annualCompPoint.getId()); - compskill.setCapacityid(basicsskill.getId()); - } - }*/ - compskillService.save(compskill); - return Result.OK("添加成功!"); - } - - /** - * 编辑 - * - * @param compskill - * @return - */ - @AutoLog(value = "项目能力设置-编辑") - @ApiOperation(value = "项目能力设置-编辑", notes = "项目能力设置-编辑") - //@RequiresPermissions("compskill:compskill:edit") - @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) - public Result edit(@RequestBody Compskill compskill) { - compskillService.updateById(compskill); - return Result.OK("编辑成功!"); - } - - /** - * 通过id删除 - * - * @param id - * @return - */ - @AutoLog(value = "项目能力设置-通过id删除") - @ApiOperation(value = "项目能力设置-通过id删除", notes = "项目能力设置-通过id删除") - //@RequiresPermissions("compskill:compskill:delete") - @DeleteMapping(value = "/delete") - public Result delete(@RequestParam(name = "id", required = true) String id) { - compskillService.removeById(id); - return Result.OK("删除成功!"); - } - - /** - * 批量删除 - * - * @param ids - * @return - */ - @AutoLog(value = "项目能力设置-批量删除") - @ApiOperation(value = "项目能力设置-批量删除", notes = "项目能力设置-批量删除") - //@RequiresPermissions("compskill:compskill:deleteBatch") - @DeleteMapping(value = "/deleteBatch") - public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { - this.compskillService.removeByIds(Arrays.asList(ids.split(","))); - return Result.OK("批量删除成功!"); - } - - /** - * 通过id查询 - * - * @param id - * @return - */ - //@AutoLog(value = "项目能力设置-通过id查询") - @ApiOperation(value = "项目能力设置-通过id查询", notes = "项目能力设置-通过id查询") - @GetMapping(value = "/queryById") - public Result queryById(@RequestParam(name = "id", required = true) String id) { - Compskill compskill = compskillService.getById(id); - if (compskill == null) { - return Result.error("未找到对应数据"); - } - return Result.OK(compskill); - } - - /** - * 导出excel - * - * @param request - * @param compskill - */ -// @RequiresPermissions("compskill:compskill:exportXls") - @RequestMapping(value = "/exportXls") - public ModelAndView exportXls(HttpServletRequest request, Compskill compskill) { - return super.exportXls(request, compskill, Compskill.class, "项目能力设置"); - } - - /** - * 通过excel导入数据 - * - * @param request - * @param response - * @return - */ - @RequiresPermissions("compskill:compskill:importExcel") - @RequestMapping(value = "/importExcel", method = RequestMethod.POST) - public Result importExcel(HttpServletRequest request, HttpServletResponse response) { - return super.importExcel(request, response, Compskill.class); - } - -}