diff --git a/blade-service-api/logpm-supervise-api/src/main/java/com/logpm/supervise/dto/IndicatorsDTO.java b/blade-service-api/logpm-supervise-api/src/main/java/com/logpm/supervise/dto/IndicatorsDTO.java index 1245e0937..5e7465f30 100644 --- a/blade-service-api/logpm-supervise-api/src/main/java/com/logpm/supervise/dto/IndicatorsDTO.java +++ b/blade-service-api/logpm-supervise-api/src/main/java/com/logpm/supervise/dto/IndicatorsDTO.java @@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; +import java.util.List; +import java.util.Map; @Data public class IndicatorsDTO extends IndicatorsEntity { @@ -18,6 +20,10 @@ public class IndicatorsDTO extends IndicatorsEntity { private String startDateStr; private String endDateStr; + //资源列表,图片和附件 + private List> resourceList; + + private Date start; private Date end; diff --git a/blade-service-api/logpm-supervise-api/src/main/java/com/logpm/supervise/vo/IndicatorsVO.java b/blade-service-api/logpm-supervise-api/src/main/java/com/logpm/supervise/vo/IndicatorsVO.java index 95ea4134a..436e67133 100644 --- a/blade-service-api/logpm-supervise-api/src/main/java/com/logpm/supervise/vo/IndicatorsVO.java +++ b/blade-service-api/logpm-supervise-api/src/main/java/com/logpm/supervise/vo/IndicatorsVO.java @@ -19,6 +19,7 @@ public class IndicatorsVO extends IndicatorsEntity { private String parentClassifyName; private List pictures = new ArrayList<>(); + private List files = new ArrayList<>(); } diff --git a/blade-service-api/logpm-supervise-api/src/main/java/com/logpm/supervise/vo/api/ClassifyApiVO.java b/blade-service-api/logpm-supervise-api/src/main/java/com/logpm/supervise/vo/api/ClassifyApiVO.java new file mode 100644 index 000000000..f07fff9da --- /dev/null +++ b/blade-service-api/logpm-supervise-api/src/main/java/com/logpm/supervise/vo/api/ClassifyApiVO.java @@ -0,0 +1,15 @@ +package com.logpm.supervise.vo.api; + + +import com.logpm.supervise.entity.ClassifyEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +@Data +@EqualsAndHashCode(callSuper = true) +public class ClassifyApiVO extends ClassifyEntity { + + private List children; +} diff --git a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/api/ClassifyApi.java b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/api/ClassifyApi.java index d03f93091..923f924f6 100644 --- a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/api/ClassifyApi.java +++ b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/api/ClassifyApi.java @@ -1,9 +1,24 @@ package com.logpm.supervise.api; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.logpm.supervise.dto.IndicatorsDTO; +import com.logpm.supervise.entity.ClassifyEntity; +import com.logpm.supervise.service.IClassifyService; +import com.logpm.supervise.vo.ClassifyVO; +import com.logpm.supervise.vo.IndicatorsVO; +import com.logpm.supervise.vo.api.ClassifyApiVO; +import com.logpm.supervise.wrapper.ClassifyWrapper; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; @RestController @AllArgsConstructor @@ -11,6 +26,51 @@ import org.springframework.web.bind.annotation.RestController; @Api(value = "分类指标表", tags = "分类指标表接口") public class ClassifyApi { + private final IClassifyService classifyService; + + + + @GetMapping("/classifyList") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "小程序指标项列表", notes = "传入classify") + public R> classifyList() { + List detail = classifyService.selectClassifyList(); + return R.data(detail); + } + + + + + @PostMapping("/saveApiIndicators") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "小程序保存考核内容", notes = "传入classify") + public R saveApiIndicators(@RequestBody IndicatorsDTO instanceofDTO) { + R r = classifyService.saveApiIndicators(instanceofDTO); + return r; + } + + + @GetMapping("/myApiIndicators") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "我的考核列表") + public R myApiIndicators(@RequestParam Map params,Query query) { + IPage page = Condition.getPage(query); + R r = classifyService.selectMyApiIndicators(params,page); + return r; + } + + @GetMapping("/myApiIndicatorsDetail") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "我的考核列表") + public R myApiIndicatorsDetail(@RequestParam Long Id) { + R r = classifyService.myApiIndicatorsDetail(Id); + return r; + } + + + + + 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 0f8de1df8..3a63c4543 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.api.ClassifyApiVO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -17,4 +18,12 @@ public interface ClassifyMapper extends BaseMapper { List selectParentCalssifyList(@Param("param") ClassifyDTO classifyDTO); List selectChildCalssifyList(@Param("param") ClassifyDTO classifyDTO); + + + /** + * 查询指标项列表 + * @param pid + * @return + */ + List selectAllClassifyList(Long pid); } 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 0bdceda1a..d3aab6e88 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 @@ -51,6 +51,13 @@ from sup_classify where p_id = #{param.pId} - - + diff --git a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/IndicatorsMapper.java b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/IndicatorsMapper.java index 0a45188f0..fbc16ad0d 100644 --- a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/IndicatorsMapper.java +++ b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/IndicatorsMapper.java @@ -2,12 +2,15 @@ package com.logpm.supervise.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.logpm.supervise.dto.IndicatorsDTO; import com.logpm.supervise.entity.IndicatorsEntity; import com.logpm.supervise.vo.IndicatorsVO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.Map; + @Mapper public interface IndicatorsMapper extends BaseMapper { @@ -15,4 +18,12 @@ public interface IndicatorsMapper extends BaseMapper { IPage pageList(IPage page, @Param("param") IndicatorsDTO indicatorsDTO); IndicatorsVO findIndicatorsDetail(@Param("id") Long id); + + /** + * 查询我的考核列表 + * @param page + * @param params + * @return + */ + Page selectMyApiIndicators(IPage page, Map params); } diff --git a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/IndicatorsMapper.xml b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/IndicatorsMapper.xml index abf3d999a..4e9a28282 100644 --- a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/IndicatorsMapper.xml +++ b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/IndicatorsMapper.xml @@ -44,5 +44,17 @@ where 1=1 and si.id = #{id} + 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 0b5e1d4b5..aec0c6dec 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 @@ -17,11 +17,16 @@ package com.logpm.supervise.service; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.logpm.supervise.dto.ClassifyDTO; +import com.logpm.supervise.dto.IndicatorsDTO; import com.logpm.supervise.entity.ClassifyEntity; +import com.logpm.supervise.vo.IndicatorsVO; +import com.logpm.supervise.vo.api.ClassifyApiVO; import org.springblade.core.mp.base.BaseService; import org.springblade.core.tool.api.R; +import java.util.List; import java.util.Map; /** @@ -47,4 +52,31 @@ public interface IClassifyService extends BaseService { R selectPointList(ClassifyDTO classifyDTO); + /** + * 查询指标项列表 + * @param classify + * @return + */ + List selectClassifyList(); + + /** + * API保存考核信息 + * @param instanceofDTO + * @return + */ + R saveApiIndicators(IndicatorsDTO instanceofDTO); + + /** + * 查询我的考核列表 + * @param params + * @return + */ + R selectMyApiIndicators(Map params, IPage page); + + /** + * 查询我的考核详情 + * @param id + * @return + */ + R myApiIndicatorsDetail(Long id); } 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 77128c35c..bbae5ba9b 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 @@ -18,22 +18,38 @@ package com.logpm.supervise.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.logpm.supervise.dto.ClassifyDTO; +import com.logpm.supervise.dto.IndicatorsDTO; import com.logpm.supervise.entity.ClassifyEntity; +import com.logpm.supervise.entity.IndicatorsAnnexEntity; +import com.logpm.supervise.entity.IndicatorsEntity; import com.logpm.supervise.entity.PointsEntity; import com.logpm.supervise.mapper.ClassifyMapper; +import com.logpm.supervise.mapper.IndicatorsMapper; 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.ClassifyVO; +import com.logpm.supervise.vo.IndicatorsVO; +import com.logpm.supervise.vo.api.ClassifyApiVO; +import com.logpm.supervise.wrapper.IndicatorsWrapper; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.core.tool.utils.Func; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; /** * 分类指标表 服务实现类 @@ -48,6 +64,13 @@ public class ClassifyServiceImpl extends BaseServiceImpl pageList(IPage page, Map classify) { @@ -147,4 +170,64 @@ public class ClassifyServiceImpl extends BaseServiceImpl selectClassifyList() { + Long pid = 0L; + List classifyEntities = getClassifyList(pid); + for (ClassifyApiVO classifyEntity : classifyEntities) { + List classifyList = getClassifyList(classifyEntity.getId()); + if (!Objects.isNull(classifyList)){ + classifyEntity.setChildren(classifyList); + } + } + return classifyEntities; + } + + @Override + @Transactional + public R saveApiIndicators(IndicatorsDTO instanceofDTO) { + if (Func.isNotEmpty(instanceofDTO.getResourceList())){ + //存在附件进行保存 + List> resourceList = instanceofDTO.getResourceList(); + for (Map map : resourceList) { + IndicatorsAnnexEntity indicatorsAnnexEntity = Func.copy(map, IndicatorsAnnexEntity.class); + indicatorsAnnexService.save(indicatorsAnnexEntity); + } + } + //保存考核内容 + IndicatorsEntity indicatorsEntity = Func.copy(instanceofDTO, IndicatorsEntity.class); + return R.status(iIndicatorsService.save(indicatorsEntity)); + } + + @Override + public R selectMyApiIndicators(Map params, IPage page) { + Long userId = AuthUtil.getUserId(); + Page indicatorsVOPage = indicatorsMapper.selectMyApiIndicators(page,params); + return R.data(indicatorsVOPage); + } + + @Override + public R myApiIndicatorsDetail(Long id) { + IndicatorsEntity indicatorsEntity = iIndicatorsService.getById(id); + //查询是否存在有附件 + List list = indicatorsAnnexService.list(Wrappers.query().lambda().eq(IndicatorsAnnexEntity::getIndicatorsId, id)); + IndicatorsVO indicatorsVO = IndicatorsWrapper.build().entityVO(indicatorsEntity); + if (Func.isNotEmpty(list)){ + Map> resourceMap = list.stream().collect(Collectors.groupingBy(IndicatorsAnnexEntity::getType)); + if (Func.isNotEmpty(resourceMap.get(1))){ + //存在图片资源 + indicatorsVO.setPictures(resourceMap.get(1)); + } + if (Func.isNotEmpty(resourceMap.get(2))){ + //存在附件资源 + indicatorsVO.setPictures(resourceMap.get(2)); + } + } + return R.data(indicatorsVO); + } + + private List getClassifyList(Long pid) { + return baseMapper.selectAllClassifyList(pid); + } } diff --git a/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/wrapper/IndicatorsWrapper.java b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/wrapper/IndicatorsWrapper.java new file mode 100644 index 000000000..c62f71751 --- /dev/null +++ b/blade-service/logpm-supervise/src/main/java/com/logpm/supervise/wrapper/IndicatorsWrapper.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package com.logpm.supervise.wrapper; + +import com.logpm.supervise.entity.ClassifyEntity; +import com.logpm.supervise.entity.IndicatorsEntity; +import com.logpm.supervise.vo.ClassifyVO; +import com.logpm.supervise.vo.IndicatorsVO; +import org.springblade.core.mp.support.BaseEntityWrapper; +import org.springblade.core.tool.utils.BeanUtil; + +import java.util.Objects; + +/** + * 分类指标表 包装类,返回视图层所需的字段 + * + * @author BladeX + * @since 2024-01-23 + */ +public class IndicatorsWrapper extends BaseEntityWrapper { + + public static IndicatorsWrapper build() { + return new IndicatorsWrapper(); + } + + @Override + public IndicatorsVO entityVO(IndicatorsEntity indicatorsEntity) { + IndicatorsVO classifyVO = Objects.requireNonNull(BeanUtil.copy(indicatorsEntity, IndicatorsVO.class)); + return classifyVO; + } + + +}