Browse Source

考核小程序

dev-pushdata-important
汤建军 1 year ago
parent
commit
4a69b61433
  1. 6
      blade-service-api/logpm-supervise-api/src/main/java/com/logpm/supervise/dto/IndicatorsDTO.java
  2. 1
      blade-service-api/logpm-supervise-api/src/main/java/com/logpm/supervise/vo/IndicatorsVO.java
  3. 15
      blade-service-api/logpm-supervise-api/src/main/java/com/logpm/supervise/vo/api/ClassifyApiVO.java
  4. 64
      blade-service/logpm-supervise/src/main/java/com/logpm/supervise/api/ClassifyApi.java
  5. 9
      blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/ClassifyMapper.java
  6. 11
      blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/ClassifyMapper.xml
  7. 11
      blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/IndicatorsMapper.java
  8. 12
      blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/IndicatorsMapper.xml
  9. 32
      blade-service/logpm-supervise/src/main/java/com/logpm/supervise/service/IClassifyService.java
  10. 83
      blade-service/logpm-supervise/src/main/java/com/logpm/supervise/service/impl/ClassifyServiceImpl.java
  11. 47
      blade-service/logpm-supervise/src/main/java/com/logpm/supervise/wrapper/IndicatorsWrapper.java

6
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<Map<String,Object>> resourceList;
private Date start;
private Date end;

1
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<IndicatorsAnnexEntity> pictures = new ArrayList<>();
private List<IndicatorsAnnexEntity> files = new ArrayList<>();
}

15
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<ClassifyApiVO> children;
}

64
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<List<ClassifyApiVO>> classifyList() {
List<ClassifyApiVO> 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<String, Object> params,Query query) {
IPage<IndicatorsVO> 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;
}

9
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<ClassifyEntity> {
List<ClassifyEntity> selectParentCalssifyList(@Param("param") ClassifyDTO classifyDTO);
List<ClassifyEntity> selectChildCalssifyList(@Param("param") ClassifyDTO classifyDTO);
/**
* 查询指标项列表
* @param pid
* @return
*/
List<ClassifyApiVO> selectAllClassifyList(Long pid);
}

11
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}
</select>
<select id="selectAllClassifyList" resultType="com.logpm.supervise.vo.api.ClassifyApiVO">
SELECT * FROM sup_classify WHERE is_deleted = 0
<if test="pid != null and pid = 0">
and p_id = 0
</if>
<if test="pid != null and pid != 0">
and p_id = #{pid}
</if>
</select>
</mapper>

11
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<IndicatorsEntity> {
@ -15,4 +18,12 @@ public interface IndicatorsMapper extends BaseMapper<IndicatorsEntity> {
IPage<IndicatorsVO> pageList(IPage<Object> page, @Param("param") IndicatorsDTO indicatorsDTO);
IndicatorsVO findIndicatorsDetail(@Param("id") Long id);
/**
* 查询我的考核列表
* @param page
* @param params
* @return
*/
Page<IndicatorsVO> selectMyApiIndicators(IPage<IndicatorsVO> page, Map<String, Object> params);
}

12
blade-service/logpm-supervise/src/main/java/com/logpm/supervise/mapper/IndicatorsMapper.xml

@ -44,5 +44,17 @@
where 1=1
and si.id = #{id}
</select>
<select id="selectMyApiIndicators" resultType="com.logpm.supervise.vo.IndicatorsVO">
SELECT * FROM sup_indicators WHERE is_deleted = 0 and
<if test="param.assessDept != null and param.assessDept != ''" >
and assess_dept = #{param.assessDept}
</if>
<if test="param.startTime != null and param.startTime != ''" >
and date_format(create_time,'%y%m%d%') >= date_format(#{param.startTime},'%y%m%d%')
</if>
<if test="param.endTime != null and param.endTime != ''" >
and date_format(create_time,'%y%m%d%') &lt;= date_format(#{param.endTime},'%y%m%d%')
</if>
</select>
</mapper>

32
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<ClassifyEntity> {
R selectPointList(ClassifyDTO classifyDTO);
/**
* 查询指标项列表
* @param classify
* @return
*/
List<ClassifyApiVO> selectClassifyList();
/**
* API保存考核信息
* @param instanceofDTO
* @return
*/
R saveApiIndicators(IndicatorsDTO instanceofDTO);
/**
* 查询我的考核列表
* @param params
* @return
*/
R selectMyApiIndicators(Map<String, Object> params, IPage<IndicatorsVO> page);
/**
* 查询我的考核详情
* @param id
* @return
*/
R myApiIndicatorsDetail(Long id);
}

83
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<ClassifyMapper, Classif
private final IPointsService pointsService;
private final IIndicatorsAnnexService indicatorsAnnexService;
private final IIndicatorsService iIndicatorsService;
private final IndicatorsMapper indicatorsMapper;
@Override
public IPage<ClassifyEntity> pageList(IPage<Object> page, Map<String, Object> classify) {
@ -147,4 +170,64 @@ public class ClassifyServiceImpl extends BaseServiceImpl<ClassifyMapper, Classif
return R.data(list);
}
@Override
public List<ClassifyApiVO> selectClassifyList() {
Long pid = 0L;
List<ClassifyApiVO> classifyEntities = getClassifyList(pid);
for (ClassifyApiVO classifyEntity : classifyEntities) {
List<ClassifyApiVO> 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<Map<String, Object>> resourceList = instanceofDTO.getResourceList();
for (Map<String, Object> 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<String, Object> params, IPage<IndicatorsVO> page) {
Long userId = AuthUtil.getUserId();
Page<IndicatorsVO> indicatorsVOPage = indicatorsMapper.selectMyApiIndicators(page,params);
return R.data(indicatorsVOPage);
}
@Override
public R myApiIndicatorsDetail(Long id) {
IndicatorsEntity indicatorsEntity = iIndicatorsService.getById(id);
//查询是否存在有附件
List<IndicatorsAnnexEntity> list = indicatorsAnnexService.list(Wrappers.<IndicatorsAnnexEntity>query().lambda().eq(IndicatorsAnnexEntity::getIndicatorsId, id));
IndicatorsVO indicatorsVO = IndicatorsWrapper.build().entityVO(indicatorsEntity);
if (Func.isNotEmpty(list)){
Map<Integer, List<IndicatorsAnnexEntity>> 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<ClassifyApiVO> getClassifyList(Long pid) {
return baseMapper.selectAllClassifyList(pid);
}
}

47
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<IndicatorsEntity, IndicatorsVO> {
public static IndicatorsWrapper build() {
return new IndicatorsWrapper();
}
@Override
public IndicatorsVO entityVO(IndicatorsEntity indicatorsEntity) {
IndicatorsVO classifyVO = Objects.requireNonNull(BeanUtil.copy(indicatorsEntity, IndicatorsVO.class));
return classifyVO;
}
}
Loading…
Cancel
Save