From 4c198f9dbce1cfb057b8ed09d00367643844c7c6 Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Wed, 6 Mar 2024 11:00:04 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=80=83=E6=A0=B8-=E6=8C=87=E6=A0=87?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=A2=9E=E5=8A=A0=E5=88=86=E5=80=BC=202.?= =?UTF-8?q?=E8=80=83=E6=A0=B8-=E6=8C=87=E6=A0=87=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../logpm/supervise/vo/ClassifyExportVO.java | 52 ++++++++++++++++ .../com/logpm/supervise/vo/ClassifyVO.java | 2 + .../controller/ClassifyController.java | 14 +++++ .../supervise/mapper/ClassifyMapper.java | 3 + .../logpm/supervise/mapper/ClassifyMapper.xml | 38 ++++++++++++ .../supervise/service/IClassifyService.java | 2 + .../service/impl/ClassifyServiceImpl.java | 62 ++++++++++++++++++- 7 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 blade-service-api/logpm-supervise-api/src/main/java/com/logpm/supervise/vo/ClassifyExportVO.java diff --git a/blade-service-api/logpm-supervise-api/src/main/java/com/logpm/supervise/vo/ClassifyExportVO.java b/blade-service-api/logpm-supervise-api/src/main/java/com/logpm/supervise/vo/ClassifyExportVO.java new file mode 100644 index 000000000..43414a24b --- /dev/null +++ b/blade-service-api/logpm-supervise-api/src/main/java/com/logpm/supervise/vo/ClassifyExportVO.java @@ -0,0 +1,52 @@ +package com.logpm.supervise.vo; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class ClassifyExportVO implements Serializable { + + @ExcelIgnore + private Long id; + + @ExcelIgnore + private Long createUser; + + @ExcelIgnore + private Long createDept; + + @ExcelProperty(value = "创建时间") + private Date createTime; + + @ExcelIgnore + private Long updateUser; + + @ExcelProperty(value = "指标名称") + private String name; + + @ExcelProperty(value = "指标描述") + private String description; + + @ExcelProperty(value = "指标备注") + private String remark; + + @ExcelIgnore + private Long pId; + + @ExcelProperty(value = "考核范围") + private String examineDeptName; + + @ExcelProperty(value = "指标分类") + private String parentClassifyName; + + @ExcelProperty(value = "考核归属部门") + private String createDeptName; + + @ExcelProperty(value = "考核分值") + private String pointStr; + +} diff --git a/blade-service-api/logpm-supervise-api/src/main/java/com/logpm/supervise/vo/ClassifyVO.java b/blade-service-api/logpm-supervise-api/src/main/java/com/logpm/supervise/vo/ClassifyVO.java index 4fe374ae1..50192c4c0 100644 --- a/blade-service-api/logpm-supervise-api/src/main/java/com/logpm/supervise/vo/ClassifyVO.java +++ b/blade-service-api/logpm-supervise-api/src/main/java/com/logpm/supervise/vo/ClassifyVO.java @@ -44,4 +44,6 @@ public class ClassifyVO extends ClassifyEntity { private Integer isEdit; + private String pointStr; + } diff --git a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/controller/ClassifyController.java b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/controller/ClassifyController.java index 6e343d0df..e52ab7550 100644 --- a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/controller/ClassifyController.java +++ b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/controller/ClassifyController.java @@ -21,6 +21,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.logpm.supervise.dto.ClassifyDTO; import com.logpm.supervise.entity.ClassifyEntity; import com.logpm.supervise.service.IClassifyService; +import com.logpm.supervise.vo.ClassifyExportVO; import com.logpm.supervise.vo.ClassifyVO; import com.logpm.supervise.wrapper.ClassifyWrapper; import io.swagger.annotations.Api; @@ -30,15 +31,19 @@ import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.common.exception.CustomerException; import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.excel.util.ExcelUtil; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import springfox.documentation.annotations.ApiIgnore; +import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; +import java.util.List; import java.util.Map; import java.util.Objects; @@ -80,6 +85,15 @@ public class ClassifyController extends BladeController { } + @GetMapping("/export-list") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "导出列表", notes = "传入classify") + public void exportlist(@ApiIgnore @RequestParam Map classify, HttpServletResponse response) { + List list = classifyService.exportList(classify); + ExcelUtil.export(response,"指标管理"+ DateUtil.time(),"指标管理",list,ClassifyExportVO.class); + } + + /** * 分类指标表 新增 */ diff --git a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/ClassifyMapper.java b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/ClassifyMapper.java index 769b02227..68b565715 100644 --- a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/ClassifyMapper.java +++ b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/ClassifyMapper.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.logpm.supervise.dto.ClassifyDTO; import com.logpm.supervise.entity.ClassifyEntity; +import com.logpm.supervise.vo.ClassifyExportVO; import com.logpm.supervise.vo.ClassifyVO; import com.logpm.supervise.vo.api.ClassifyApiVO; import org.apache.ibatis.annotations.Mapper; @@ -27,4 +28,6 @@ public interface ClassifyMapper extends BaseMapper { * @return */ List selectAllClassifyList(@Param("pid") Long pid,@Param("list")List list); + + List exportList(@Param("param") ClassifyDTO classifyDTO); } diff --git a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/ClassifyMapper.xml b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/ClassifyMapper.xml index f13c59a86..7a55b6322 100644 --- a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/ClassifyMapper.xml +++ b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/ClassifyMapper.xml @@ -75,4 +75,42 @@ + + + + diff --git a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/service/IClassifyService.java b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/service/IClassifyService.java index 57638bd72..544b5ce91 100644 --- a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/service/IClassifyService.java +++ b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/service/IClassifyService.java @@ -20,6 +20,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.logpm.supervise.dto.ClassifyDTO; import com.logpm.supervise.dto.IndicatorsDTO; import com.logpm.supervise.entity.ClassifyEntity; +import com.logpm.supervise.vo.ClassifyExportVO; import com.logpm.supervise.vo.ClassifyVO; import com.logpm.supervise.vo.IndicatorsVO; import com.logpm.supervise.vo.api.ClassifyApiVO; @@ -104,4 +105,5 @@ public interface IClassifyService extends BaseService { R importClassify(MultipartFile file) throws IOException; + List exportList(Map classify); } diff --git a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/service/impl/ClassifyServiceImpl.java b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/service/impl/ClassifyServiceImpl.java index 09afaed50..e9f09946c 100644 --- a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/service/impl/ClassifyServiceImpl.java +++ b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/service/impl/ClassifyServiceImpl.java @@ -36,6 +36,7 @@ import com.logpm.supervise.service.IClassifyService; import com.logpm.supervise.service.IIndicatorsAnnexService; import com.logpm.supervise.service.IIndicatorsService; import com.logpm.supervise.service.IPointsService; +import com.logpm.supervise.vo.ClassifyExportVO; import com.logpm.supervise.vo.ClassifyVO; import com.logpm.supervise.vo.IndicatorsVO; import com.logpm.supervise.vo.api.BeIndicatorsVO; @@ -45,7 +46,6 @@ import com.logpm.supervise.wrapper.IndicatorsWrapper; import com.logpm.supervise.wrapper.PointsWrapper; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springblade.common.constant.common.IsOrNoConstant; import org.springblade.common.exception.CustomerException; import org.springblade.common.utils.CommonUtil; import org.springblade.core.mp.base.BaseServiceImpl; @@ -145,6 +145,15 @@ public class ClassifyServiceImpl extends BaseServiceImpl list = pointsService.list(queryWrapper); + String pointStr = ""; + for (PointsEntity pointsEntity : list) { + if(StringUtil.isBlank(pointStr)){ + pointStr = pointStr + pointsEntity.getPoint(); + }else{ + pointStr = pointStr + "," + pointsEntity.getPoint(); + } + } + record.setPointStr(pointStr); record.setPointsEntities(list); } } @@ -592,6 +601,57 @@ public class ClassifyServiceImpl extends BaseServiceImpl exportList(Map classify) { + String pId = (String) classify.get("pid"); + String name = (String) classify.get("name"); + String isPid = (String) classify.get("isPid"); + String createDeptName = (String) classify.get("createDeptName"); + String examineDeptName = (String) classify.get("examineDeptName"); + + ClassifyDTO classifyDTO = new ClassifyDTO(); + if (StringUtil.isNotBlank(pId)) { + classifyDTO.setPId(Long.parseLong(pId)); + } + + Long createDept = deptClient.findIdByName(createDeptName); + + classifyDTO.setName(name); + classifyDTO.setIsPid(Integer.parseInt(isPid)); + classifyDTO.setCreateDept(createDept); + classifyDTO.setExamineDeptName(examineDeptName); + + List records = baseMapper.exportList(classifyDTO); + + for (ClassifyExportVO record : records) { + Long deptId = record.getCreateDept(); + String deptName = deptClient.findNameById(deptId); + record.setCreateDeptName(deptName); + + if (!"1".equals(isPid)) { + Long classifyId = record.getId(); + Long pId1 = record.getPId(); + ClassifyEntity classifyEntity = getById(pId1); + record.setParentClassifyName(classifyEntity.getName()); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("classify_id", classifyId) + .eq("is_deleted", 0); + List list = pointsService.list(queryWrapper); + String pointStr = ""; + for (PointsEntity pointsEntity : list) { + if(StringUtil.isBlank(pointStr)){ + pointStr = pointStr + pointsEntity.getPoint(); + }else{ + pointStr = pointStr + "," + pointsEntity.getPoint(); + } + } + record.setPointStr(pointStr); + } + } + + return records; + } + private List getClassifyList(Long pid,String exAdminDeptId) { List list = null; if (Func.isNotEmpty(exAdminDeptId)){