Commit 5b214118 authored by wangxl's avatar wangxl

Merge remote-tracking branch 'origin/master'

parents b8c1b70e 69600a6e
package com.yiboshi.science.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yiboshi.science.base.BaseDAO;
import com.yiboshi.science.entity.ComProjectKpit;
import com.yiboshi.science.param.dto.ComProjectKpitDTO;
import com.yiboshi.science.param.query.ComProjectKpitQueryVO;
import java.util.List;
public interface ComProjectKpitDAO extends BaseMapper<ComProjectKpit>, BaseDAO<ComProjectKpitQueryVO, ComProjectKpitDTO, ComProjectKpit> {
List<ComProjectKpitDTO> getProjectKpit();
}
package com.yiboshi.science.entity;
import com.yiboshi.science.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
@Data
@EqualsAndHashCode(callSuper=true)
@ApiModel(description = "项目绩效指标表VO")
public class ComProjectKpit extends BaseEntity {
/** 级别Id */
@ApiModelProperty(value = "级别Id", position = 8)
@Length(max=36, message = "级别Id不能大于36")
private String levelId;
/** 类型Id */
@ApiModelProperty(value = "类型Id", position = 7)
private Integer typeId;
/** 父Id */
@ApiModelProperty(value = "父Id", position = 8)
@Length(max=36, message = "父Id不能大于36")
private String parentId;
/** 绩效类型名称 */
@ApiModelProperty(value = "绩效类型名称", position = 1 )
@Length(max=200, message = "绩效类型名称不能大于200")
private String kpitName;
/** 指标值 */
@ApiModelProperty(value = "指标值", position = 7)
private Integer targetValue;
/** 绩效标准 */
@ApiModelProperty(value = "绩效标准", position = 7)
private Integer performanceStandard;
/** 显示顺序 */
@ApiModelProperty(value = "显示顺序", position = 7)
private Integer displayOrder;
/** 一级指标显示 */
@ApiModelProperty(value = "一级指标显示", position = 7)
private boolean oneDisplay;
/** 二级指标显示 */
@ApiModelProperty(value = "二级指标显示", position = 7)
private boolean towDisplay;
/** 一级指标行合并数 */
@ApiModelProperty(value = "一级指标行合并数", position = 7)
private Integer oneRowSpan;
/** 二级指标行合并数 */
@ApiModelProperty(value = "二级指标行合并数", position = 7)
private Integer towRowSpan;
}
package com.yiboshi.science.param.dto;
import com.yiboshi.science.base.BaseDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
@Data
@EqualsAndHashCode(callSuper=true)
@ApiModel(description = "项目绩效指标表DTO")
public class ComProjectKpitDTO extends BaseDTO {
/** 一级指标名称 */
@ApiModelProperty(value = "一级指标名称", position = 8)
private String oneLevelName;
/** 二级指标名称 */
@ApiModelProperty(value = "二级指标名称", position = 8)
private String towLevelName;
/** 级别Id */
@ApiModelProperty(value = "级别Id", position = 8)
@Length(max=36, message = "级别Id不能大于36")
private String levelId;
/** 类型Id */
@ApiModelProperty(value = "类型Id", position = 7)
private Integer typeId;
/** 父Id */
@ApiModelProperty(value = "父Id", position = 8)
@Length(max=36, message = "父Id不能大于36")
private String parentId;
/** 绩效类型名称 */
@ApiModelProperty(value = "绩效类型名称", position = 1 )
@Length(max=200, message = "绩效类型名称不能大于200")
private String kpitName;
/** 指标值 */
@ApiModelProperty(value = "指标值", position = 7)
private Integer targetValue;
/** 绩效标准 */
@ApiModelProperty(value = "绩效标准", position = 7)
private Integer performanceStandard;
/** 显示顺序 */
@ApiModelProperty(value = "显示顺序", position = 7)
private Integer displayOrder;
/** 一级指标显示 */
@ApiModelProperty(value = "一级指标显示", position = 7)
private boolean oneDisplay;
/** 二级指标显示 */
@ApiModelProperty(value = "二级指标显示", position = 7)
private boolean towDisplay;
/** 一级指标行合并数 */
@ApiModelProperty(value = "一级指标行合并数", position = 7)
private Integer oneRowSpan;
/** 二级指标行合并数 */
@ApiModelProperty(value = "二级指标行合并数", position = 7)
private Integer towRowSpan;
/** 年度1指标 */
@ApiModelProperty(value = "年度1指标", position = 7)
private Integer yearValue1;
/** 年度2指标 */
@ApiModelProperty(value = "年度2指标", position = 7)
private Integer yearValue2;
/** 年度3指标 */
@ApiModelProperty(value = "年度3指标", position = 7)
private Integer yearValue3;
}
package com.yiboshi.science.param.dto;
import com.yiboshi.science.base.BaseDTO;
import lombok.Data;
import java.util.List;
@Data
public class ProjectKPIStatisticDTO extends BaseDTO {
private Integer totalRowSpan; //总合并行数
private Integer outTarget; //一级指标(产出指标)
private Integer benefitTarget; //一级指标(效益指标)
private Integer satisfactionDegree; //一级指标(满意度指标)
private Integer quantityTarget; //二级指标(数量指标)
private Integer qualityTarget; //二级指标(质量指标)
private Integer validityTarget; //二级指标(时效指标)
private Integer costTarget; //二级指标(成本指标)
private Integer economicTarget; //二级指标(经济效益指标)
private Integer socialTarget; //二级指标(社会效益指标)
private Integer ecologicalTarget; //二级指标(生态效益指标)
private Integer sustainableTarget; //二级指标(可持续影响指标)
private Integer serviceTarget; //二级指标(服务对象满意度指标)
private List<ComProjectKpitDTO> threeLevel;
}
package com.yiboshi.science.param.query;
import com.yiboshi.science.base.PaginationVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
@Data
@EqualsAndHashCode(callSuper=true)
@ApiModel(description = "查询项目绩效指标表VO")
public class ComProjectKpitQueryVO extends PaginationVO {
/** 级别Id */
@ApiModelProperty(value = "级别Id", position = 8)
@Length(max=36, message = "级别Id不能大于36")
private String levelId;
/** 类型Id */
@ApiModelProperty(value = "类型Id", position = 7)
private Integer typeId;
/** 父Id */
@ApiModelProperty(value = "父Id", position = 8)
@Length(max=36, message = "父Id不能大于36")
private String parentId;
/** 绩效类型名称 */
@ApiModelProperty(value = "绩效类型名称", position = 1 )
@Length(max=200, message = "绩效类型名称不能大于200")
private String kpitName;
/** 指标值 */
@ApiModelProperty(value = "指标值", position = 7)
private Integer targetValue;
/** 绩效标准 */
@ApiModelProperty(value = "绩效标准", position = 7)
private Integer performanceStandard;
/** 显示顺序 */
@ApiModelProperty(value = "显示顺序", position = 7)
private Integer displayOrder;
/** 一级指标显示 */
@ApiModelProperty(value = "一级指标显示", position = 7)
private boolean oneDisplay;
/** 二级指标显示 */
@ApiModelProperty(value = "二级指标显示", position = 7)
private boolean towDisplay;
/** 一级指标行合并数 */
@ApiModelProperty(value = "一级指标行合并数", position = 7)
private Integer oneRowSpan;
/** 二级指标行合并数 */
@ApiModelProperty(value = "二级指标行合并数", position = 7)
private Integer towRowSpan;
}
package com.yiboshi.science.rest.v1;
import com.yiboshi.arch.base.ResponseDataModel;
import com.yiboshi.science.entity.ComProjectKpit;
import com.yiboshi.science.param.dto.ComProjectKpitDTO;
import com.yiboshi.science.param.dto.ProjectKPIStatisticDTO;
import com.yiboshi.science.param.query.ComProjectKpitQueryVO;
import com.yiboshi.science.rest.BaseController;
import com.yiboshi.science.service.ComProjectKpitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Api(tags = "com-project-kpit", description = "项目表")
@RestController
@RequestMapping("/v1/science-admin/com-project-kpit")
public class ComProjectKpitController extends BaseController<ComProjectKpitService, ComProjectKpitQueryVO, ComProjectKpitDTO, ComProjectKpit> {
@Autowired
private ComProjectKpitService comProjectKpitService;
@ApiOperation(value = "获取未分配的项目列表", httpMethod = "GET", notes = "获取未分配的项目列表")
@GetMapping
@RequestMapping("/getProjectKpitStatistic")
public ResponseDataModel<ProjectKPIStatisticDTO> getProjectKpitStatistic() {
List<ComProjectKpitDTO> ProjectKPIList = comProjectKpitService.getProjectKpitStatistic();
ProjectKPIStatisticDTO dto = new ProjectKPIStatisticDTO();
dto.setTotalRowSpan(ProjectKPIList.size() + 2);
dto.setThreeLevel(ProjectKPIList);
return ResponseDataModel.ok(dto);
}
}
package com.yiboshi.science.service;
import com.yiboshi.science.base.BaseService;
import com.yiboshi.science.entity.ComProjectKpit;
import com.yiboshi.science.param.dto.ComProjectKpitDTO;
import com.yiboshi.science.param.query.ComProjectKpitQueryVO;
import java.util.List;
public interface ComProjectKpitService extends BaseService<ComProjectKpitQueryVO, ComProjectKpitDTO, ComProjectKpit> {
List<ComProjectKpitDTO> getProjectKpitStatistic();
}
package com.yiboshi.science.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yiboshi.science.base.BaseServiceImpl;
import com.yiboshi.science.dao.ComProjectKpitDAO;
import com.yiboshi.science.entity.ComProjectKpit;
import com.yiboshi.science.entity.SystemParameter;
import com.yiboshi.science.param.dto.ComProjectKpitDTO;
import com.yiboshi.science.param.query.ComProjectKpitQueryVO;
import com.yiboshi.science.service.ComProjectKpitService;
import com.yiboshi.science.utils.RedisKey;
import com.yiboshi.science.utils.RedisUtils;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@Service
@AllArgsConstructor
public class ComProjectKpitServiceImpl extends BaseServiceImpl<ComProjectKpitDAO, ComProjectKpitQueryVO, ComProjectKpitDTO, ComProjectKpit> implements ComProjectKpitService {
private final RedisUtils redisUtils;
@Autowired
private ComProjectKpitDAO comProjectKpitDAO;
@Override
protected void setCriteriaForQuery(ComProjectKpitQueryVO vo, QueryWrapper<ComProjectKpitQueryVO> criteria) {
}
public List<ComProjectKpitDTO> getProjectKpitStatistic() {
//一级指标名称
List<ComProjectKpitDTO> oneLevelList = getProjectKpitByTypeId(2);
//二级指标名称
List<ComProjectKpitDTO> towLevelList = getProjectKpitByTypeId(3);
//三级指标名称
List<ComProjectKpitDTO> threeLevelList = getProjectKpitByTypeId(4);
threeLevelList.forEach(e -> {
List<ComProjectKpitDTO> findList1 = towLevelList.stream().filter(f -> e.getLevelId().equals(f.getId())).collect(Collectors.toList());
ComProjectKpitDTO oneModel = findList1.get(0);
e.setOneLevelName(oneModel.getKpitName());
List<ComProjectKpitDTO> findList2 = oneLevelList.stream().filter(f -> oneModel.getLevelId().equals(f.getId())).collect(Collectors.toList());
ComProjectKpitDTO towModel = findList1.get(0);
e.setTowLevelName(towModel.getKpitName());
});
return threeLevelList;
}
public List<ComProjectKpitDTO> getProjectKpitByTypeId(int typeId) {
List<ComProjectKpitDTO> list = this.getProjectKpit();
List<ComProjectKpitDTO> findList = list.stream().filter(e -> e.getTypeId().equals(typeId)).collect(Collectors.toList());
return findList;
}
//threeLevelList
public List<ComProjectKpitDTO> getProjectKpit() {
List<ComProjectKpitDTO> list = null;
Object obj = redisUtils.get(RedisKey.ProjectKPIList + "all");
if (null != obj)
list = (List<ComProjectKpitDTO>) redisUtils.get(RedisKey.ProjectKPIList + "all");
else {
list = comProjectKpitDAO.getProjectKpit();
redisUtils.set(RedisKey.ProjectKPIList + "all", list, 7, TimeUnit.DAYS);
}
return list;
}
}
......@@ -16,4 +16,6 @@ public class RedisKey {
public final static String UnitList = "unit-list";
//角色表缓存key
public final static String RoleList = "role-list";
//项目KPI绩效指标
public final static String ProjectKPIList = "project-kpi-list";
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yiboshi.science.dao.ComProjectKpitDAO">
<sql id="allColumns">
t.id, t.level_id, t.type_id, t.parent_id, t.kpit_name, t.target_value, t.performance_standard, t.display_order, t.one_display,
t.tow_display, t.one_row_span, t.tow_row_span, t.created, t.updated
</sql>
<select id="getProjectKpit" resultType="com.yiboshi.science.param.dto.ComProjectKpitDTO">
select * from com_project_kpit order by type_id, id
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment