Browse Source

【绩效考核】民生评价打分后台管理-王公峰-2020-12-22

feature/dangjian
wanggongfeng 5 years ago
parent
commit
94a9493ea8
  1. 116
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/KpiPeopleEvaluateDTO.java
  2. 116
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/KpiPeopleEvaluateController.java
  3. 54
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/KpiPeopleEvaluateDao.java
  4. 86
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/entity/KpiPeopleEvaluateEntity.java
  5. 83
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/excel/KpiPeopleEvaluateExcel.java
  6. 47
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/redis/KpiPeopleEvaluateRedis.java
  7. 125
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/KpiPeopleEvaluateService.java
  8. 2
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/KpiCaseHandlingServiceImpl.java
  9. 360
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/KpiPeopleEvaluateServiceImpl.java
  10. 89
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/KpiPeopleEvaluateDao.xml

116
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/KpiPeopleEvaluateDTO.java

@ -0,0 +1,116 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 民生评价打分表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2020-12-22
*/
@Data
public class KpiPeopleEvaluateDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 部门id
*/
private String deptId;
/**
* 部门名称
*/
private String deptName;
/**
* 部门类别
*/
private String deptTypeKey;
/**
*
*/
private String year;
/**
* 民生评价打分
*/
private String peopleEvaluate;
/**
* 上级部门id
*/
private String parentDeptIds;
/**
* 上级部门名称
*/
private String parentDeptNames;
/**
* 所有部门id
*/
private String allDeptIds;
/**
* 所有部门名称
*/
private String allDeptNames;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 逻辑删除标识
*/
private String delFlag;
}

116
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/KpiPeopleEvaluateController.java

@ -0,0 +1,116 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.controller;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.dto.KpiCaseHandlingDTO;
import com.elink.esua.epdc.dto.KpiPeopleEvaluateDTO;
import com.elink.esua.epdc.excel.KpiCaseHandlingExcel;
import com.elink.esua.epdc.excel.KpiPeopleEvaluateExcel;
import com.elink.esua.epdc.service.KpiPeopleEvaluateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 民生评价打分表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2020-12-22
*/
@RestController
@RequestMapping("kpipeopleevaluate")
public class KpiPeopleEvaluateController {
@Autowired
private KpiPeopleEvaluateService kpiPeopleEvaluateService;
@GetMapping("page")
public Result<PageData<KpiPeopleEvaluateDTO>> page(@RequestParam Map<String, Object> params){
// PageData<KpiPeopleEvaluateDTO> page = kpiPeopleEvaluateService.page(params);
PageData<KpiPeopleEvaluateDTO> page = kpiPeopleEvaluateService.getInfoPage(params);
return new Result<PageData<KpiPeopleEvaluateDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<KpiPeopleEvaluateDTO> get(@PathVariable("id") String id){
KpiPeopleEvaluateDTO data = kpiPeopleEvaluateService.get(id);
return new Result<KpiPeopleEvaluateDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody KpiPeopleEvaluateDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
kpiPeopleEvaluateService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody KpiPeopleEvaluateDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
kpiPeopleEvaluateService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
kpiPeopleEvaluateService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<KpiPeopleEvaluateDTO> list = kpiPeopleEvaluateService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, KpiPeopleEvaluateExcel.class);
}
@GetMapping("exportTemplate")
public void exportTemplate(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<KpiPeopleEvaluateDTO> list = kpiPeopleEvaluateService.exportTemplate(params);
ExcelUtils.exportExcelToTarget(response, null, list, KpiPeopleEvaluateExcel.class);
}
/**
* @Description: 导入治理排行管理-民生评价打分
* @Param: [file]
* @return: Result
* @Author: wanggongfeng
* @Date: 2020-12-22
*/
@PostMapping("importManualScoreExcel")
public Result importManualScoreExcel(@RequestParam("file") MultipartFile file) {
return kpiPeopleEvaluateService.importManualScoreExcel(file);
}
}

54
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/KpiPeopleEvaluateDao.java

@ -0,0 +1,54 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.dto.KpiMassEvaluationDTO;
import com.elink.esua.epdc.dto.KpiPeopleEvaluateDTO;
import com.elink.esua.epdc.dto.form.CheckIsScoredByYearFormDTO;
import com.elink.esua.epdc.dto.form.CheckIsScoredFormDTO;
import com.elink.esua.epdc.entity.KpiPeopleEvaluateEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* 民生评价打分表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2020-12-22
*/
@Mapper
public interface KpiPeopleEvaluateDao extends BaseDao<KpiPeopleEvaluateEntity> {
/**
* 条件查询
* @param params
* @return
*/
List<KpiPeopleEvaluateDTO> getInfoPage(Map<String, Object> params);
/**
* 查询已打分部门提示
* @param checkIsScoredByYearFormDTO
* @return
*/
List<KpiPeopleEvaluateDTO> getDuplicateData(CheckIsScoredByYearFormDTO checkIsScoredByYearFormDTO);
}

86
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/entity/KpiPeopleEvaluateEntity.java

@ -0,0 +1,86 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 民生评价打分表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2020-12-22
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epdc_kpi_people_evaluate")
public class KpiPeopleEvaluateEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 部门id
*/
private String deptId;
/**
* 部门名称
*/
private String deptName;
/**
* 部门类别
*/
private String deptTypeKey;
/**
*
*/
private String year;
/**
* 民生评价打分
*/
private String peopleEvaluate;
/**
* 上级部门id
*/
private String parentDeptIds;
/**
* 上级部门名称
*/
private String parentDeptNames;
/**
* 所有部门id
*/
private String allDeptIds;
/**
* 所有部门名称
*/
private String allDeptNames;
}

83
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/excel/KpiPeopleEvaluateExcel.java

@ -0,0 +1,83 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 民生评价打分表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2020-12-22
*/
@Data
public class KpiPeopleEvaluateExcel {
// @Excel(name = "主键")
// private String id;
@Excel(name = "部门id")
private String deptId;
@Excel(name = "部门名称")
private String deptName;
@Excel(name = "部门类别")
private String deptTypeKey;
@Excel(name = "年")
private String year;
@Excel(name = "民生评价打分")
private String peopleEvaluate;
// @Excel(name = "上级部门id")
// private String parentDeptIds;
//
// @Excel(name = "上级部门名称")
// private String parentDeptNames;
//
// @Excel(name = "所有部门id")
// private String allDeptIds;
//
// @Excel(name = "所有部门名称")
// private String allDeptNames;
//
// @Excel(name = "乐观锁")
// private Integer revision;
//
// @Excel(name = "创建人")
// private String createdBy;
//
// @Excel(name = "创建时间")
// private Date createdTime;
//
// @Excel(name = "更新人")
// private String updatedBy;
//
// @Excel(name = "更新时间")
// private Date updatedTime;
//
// @Excel(name = "逻辑删除标识")
// private String delFlag;
}

47
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/redis/KpiPeopleEvaluateRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.redis;
import com.elink.esua.epdc.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 民生评价打分表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2020-12-22
*/
@Component
public class KpiPeopleEvaluateRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

125
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/KpiPeopleEvaluateService.java

@ -0,0 +1,125 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.service;
import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.KpiCaseHandlingDTO;
import com.elink.esua.epdc.dto.KpiPeopleEvaluateDTO;
import com.elink.esua.epdc.entity.KpiPeopleEvaluateEntity;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
/**
* 民生评价打分表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2020-12-22
*/
public interface KpiPeopleEvaluateService extends BaseService<KpiPeopleEvaluateEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<KpiPeopleEvaluateDTO>
* @author generator
* @date 2020-12-22
*/
PageData<KpiPeopleEvaluateDTO> page(Map<String, Object> params);
/**
* 分页条件查询
* @param params
* @return
*/
PageData<KpiPeopleEvaluateDTO> getInfoPage(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<KpiPeopleEvaluateDTO>
* @author generator
* @date 2020-12-22
*/
List<KpiPeopleEvaluateDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return KpiPeopleEvaluateDTO
* @author generator
* @date 2020-12-22
*/
KpiPeopleEvaluateDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-12-22
*/
void save(KpiPeopleEvaluateDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-12-22
*/
void update(KpiPeopleEvaluateDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-12-22
*/
void delete(String[] ids);
/**
* 网格化平台案件处置情况导出模板
*
* @param params
* @return java.util.List<KpiPeopleEvaluateDTO>
* @author wanggongfeng
* @date 2020-12-22
*/
List<KpiPeopleEvaluateDTO> exportTemplate(Map<String, Object> params);
/**
* 网格化平台案件处置情况打分导入
*
* @param file
* @return Result
* @author wanggongfeng
* @date 2020-12-22
*/
Result importManualScoreExcel(MultipartFile file);
}

2
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/KpiCaseHandlingServiceImpl.java

@ -181,7 +181,7 @@ public class KpiCaseHandlingServiceImpl extends BaseServiceImpl<KpiCaseHandlingD
* @param params
* @return java.util.List<KpiCaseHandlingDTO>
* @author wanggongfeng
* @date 2020-06-15
* @date 2020-12-21
*/
@Override
public List<KpiCaseHandlingDTO> exportTemplate(Map<String, Object> params) {

360
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/KpiPeopleEvaluateServiceImpl.java

@ -0,0 +1,360 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.service.impl;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.StrConstant;
import com.elink.esua.epdc.commons.tools.enums.YesOrNoEnum;
import com.elink.esua.epdc.commons.tools.exception.RenException;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.security.user.SecurityUser;
import com.elink.esua.epdc.commons.tools.security.user.UserDetail;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.utils.DateUtils;
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dao.KpiPeopleEvaluateDao;
import com.elink.esua.epdc.dto.*;
import com.elink.esua.epdc.dto.epdc.form.ExportTemplateInfoFormDTO;
import com.elink.esua.epdc.dto.epdc.result.ExportKpiResultDTO;
import com.elink.esua.epdc.dto.form.CheckIsScoredByYearFormDTO;
import com.elink.esua.epdc.entity.KpiPeopleEvaluateEntity;
import com.elink.esua.epdc.excel.KpiPeopleEvaluateExcel;
import com.elink.esua.epdc.feign.AdminFeignClient;
import com.elink.esua.epdc.redis.KpiPeopleEvaluateRedis;
import com.elink.esua.epdc.service.KpiPeopleEvaluateService;
import com.elink.esua.epdc.utils.DeptUtils;
import com.elink.esua.epdc.utils.StreamUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 民生评价打分表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2020-12-22
*/
@Service
public class KpiPeopleEvaluateServiceImpl extends BaseServiceImpl<KpiPeopleEvaluateDao, KpiPeopleEvaluateEntity> implements KpiPeopleEvaluateService {
@Autowired
private KpiPeopleEvaluateRedis kpiPeopleEvaluateRedis;
@Autowired
private AdminFeignClient adminFeignClient;
@Autowired
private DeptUtils deptUtils;
@Override
public PageData<KpiPeopleEvaluateDTO> page(Map<String, Object> params) {
IPage<KpiPeopleEvaluateEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, KpiPeopleEvaluateDTO.class);
}
/**
* 条件查询
* @param params
* @return
*/
@Override
public PageData<KpiPeopleEvaluateDTO> getInfoPage(Map<String, Object> params) {
IPage<KpiPeopleEvaluateDTO> page = getPage(params);
List<KpiPeopleEvaluateDTO> list = baseDao.getInfoPage(params);
return new PageData<>(list, page.getTotal());
}
@Override
public List<KpiPeopleEvaluateDTO> list(Map<String, Object> params) {
List<KpiPeopleEvaluateEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, KpiPeopleEvaluateDTO.class);
}
private QueryWrapper<KpiPeopleEvaluateEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<KpiPeopleEvaluateEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public KpiPeopleEvaluateDTO get(String id) {
KpiPeopleEvaluateEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, KpiPeopleEvaluateDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(KpiPeopleEvaluateDTO dto) {
String deptId = dto.getDeptId();
List<String> checkList = new ArrayList<String>();
checkList.add(deptId);
// 判断录入年份是否为当前年份
if(!dto.getYear().equals(DateUtils.getCurrentYear())){
throw new RenException("只能对当前年份进行打分,请维护后重试!");
}
// 检测excel中是否存在已打分部门
StringBuffer deptErrorInfo = this.getDuplicateData(checkList,dto.getYear());
if (deptErrorInfo.length() > 0) {
throw new RenException(deptErrorInfo + " 已打分, 不可重复打分!");
}
// 查询机构类型键值
Result<SysDeptDTO> result = adminFeignClient.get(Long.valueOf(deptId));
SysDeptDTO sysDeptDTO = result.getData();
// 设置部门类别
dto.setDeptTypeKey(sysDeptDTO.getTypeKey());
KpiPeopleEvaluateEntity entity = ConvertUtils.sourceToTarget(dto, KpiPeopleEvaluateEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(KpiPeopleEvaluateDTO dto) {
KpiPeopleEvaluateEntity entity = ConvertUtils.sourceToTarget(dto, KpiPeopleEvaluateEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* 获取导出模板
*
* @param params
* @return java.util.List<KpiPeopleEvaluateDTO>
* @author wanggongfeng
* @date 2020-12-22
*/
@Override
public List<KpiPeopleEvaluateDTO> exportTemplate(Map<String, Object> params) {
List<Long> deptIdList = SecurityUser.getUser().getDeptIdList(); //获取用户权限
ExportTemplateInfoFormDTO exportTemplateInfoFormDTO = new ExportTemplateInfoFormDTO();
exportTemplateInfoFormDTO.setDeptIdList(deptIdList);
exportTemplateInfoFormDTO.setDeptId(params.get("deptId") == null ? "" : params.get("deptId").toString());
exportTemplateInfoFormDTO.setDeptTypeKey(params.get("deptTypeKey") == null ? "" : params.get("deptTypeKey").toString());
exportTemplateInfoFormDTO.setYear(params.get("year") == null ? "" : params.get("year").toString());
Result<List<ExportKpiResultDTO>> result = adminFeignClient.getExportTemplateInfo(exportTemplateInfoFormDTO);
List<ExportKpiResultDTO> resultList = result.getData();
return ConvertUtils.sourceToTarget(resultList, KpiPeopleEvaluateDTO.class);
}
/**
* @Description: 导入治理排行管理-民生评价打分
* @Param: [file]
* @return: Result
* @Author: wanggongfeng
* @Date: 2020-12-22
*/
@Override
public Result importManualScoreExcel(MultipartFile file) {
File f = StreamUtils.conversionFile(file);
try {
//判断上传文件类型
String originalFilename = file.getOriginalFilename();
if (!originalFilename.endsWith(StrConstant.EXCEL_SUFFIX_2003) && !originalFilename.endsWith(StrConstant.EXCEL_SUFFIX_2007)) {
return new Result().error("请选择.xls或者.xlsx格式文件");
}
List<KpiPeopleEvaluateExcel> recordList = ExcelImportUtil.importExcel(f, KpiPeopleEvaluateExcel.class, new ImportParams());
if (CollUtil.isEmpty(recordList)) {
return new Result().error("导入内容不能为空");
}
// 存储检测excel是否存在重复ID使用
List<String> checkList = new ArrayList<String>();
StringBuffer checkInfo = new StringBuffer();
String year = "";
for(int i = 0 ; i < recordList.size() ; i++){
KpiPeopleEvaluateExcel kpiPeopleEvaluateExcel = recordList.get(i);
// 校验是否存在空单元格
if(checkNullCell(kpiPeopleEvaluateExcel)){
return new Result().error("导入文件中存在空单元格或模板格式不匹配,请完善表格或核对模板是否正确!");
}
// 校验是否存在分数范围不正确的打分
if(checkScoreCell(kpiPeopleEvaluateExcel)){
return new Result().error("存在不符合分值范围的部门,请维护后重试!");
}
// 校验月份是否不一致
if(i == 0){
year = kpiPeopleEvaluateExcel.getYear();
}else{
if(!year.equals(kpiPeopleEvaluateExcel.getYear())){
return new Result().error("导入文件中年份不一致,请修改一致后重试!");
}
year = kpiPeopleEvaluateExcel.getYear();
}
// 校验ID是否存在重复
if(checkList.contains(kpiPeopleEvaluateExcel.getDeptId())){
return new Result().error(kpiPeopleEvaluateExcel.getDeptName() + "ID重复,请维护唯一ID后重试!");
}
checkList.add(kpiPeopleEvaluateExcel.getDeptId());
// 拼接部门ID不在当前用户权限内的部门名称
checkInfo.append(splicingErrorDeptName(i,kpiPeopleEvaluateExcel,recordList));
}
// 判断导入年份是否为当前年份
if(!year.equals(DateUtils.getCurrentYear())){
return new Result().error("只能对当前年份进行打分,请维护后重试!");
}
// 校验部门ID是否存在当前用户权限内
if (checkInfo.length() > 0) {
return new Result().error(checkInfo.append("部门ID错误,请维护后重试!").toString());
}
// 检测excel中是否存在已打分部门
StringBuffer deptErrorInfo = this.getDuplicateData(checkList,year);
if (deptErrorInfo.length() > 0) {
return new Result().error(deptErrorInfo + " 已打分, 不可重复打分!");
}
// 插入群众评价打分数据(必要时可改为批量插入)
for (KpiPeopleEvaluateExcel kpiPeopleEvaluateExcel : recordList) {
KpiPeopleEvaluateEntity entity = splicingEntity(kpiPeopleEvaluateExcel);
insert(entity);
}
} catch (Exception e) {
return new Result().error("数据异常,解析excel文件失败");
} finally {
// 删除文件
ExcelUtils.deleteAllFilesOfDir(f);
}
return new Result();
}
/**
* 拼接已打分部门提示信息
* @param checkList
* @return
*/
private StringBuffer getDuplicateData(List<String> checkList ,String year){
CheckIsScoredByYearFormDTO checkIsScoredByYearFormDTO = new CheckIsScoredByYearFormDTO();
checkIsScoredByYearFormDTO.setCheckList(checkList);
checkIsScoredByYearFormDTO.setYear(year);
StringBuffer deptErrorInfo = new StringBuffer();
List<KpiPeopleEvaluateDTO> list = baseDao.getDuplicateData(checkIsScoredByYearFormDTO);
for(int i = 0 ; i < list.size() ; i++){
KpiPeopleEvaluateDTO kpiPeopleEvaluateDTO = list.get(i);
if(i == (list.size()-1)){
deptErrorInfo.append(kpiPeopleEvaluateDTO.getDeptName());
}else{
deptErrorInfo.append(kpiPeopleEvaluateDTO.getDeptName()).append("、");
}
}
return deptErrorInfo;
}
/**
* 拼接网格建设打分实体
* @param kpiPeopleEvaluateExcel
* @return
*/
private KpiPeopleEvaluateEntity splicingEntity(KpiPeopleEvaluateExcel kpiPeopleEvaluateExcel){
KpiPeopleEvaluateEntity entity = ConvertUtils.sourceToTarget(kpiPeopleEvaluateExcel, KpiPeopleEvaluateEntity.class);
// 查询设置部门类别和部门名称
String deptId = entity.getDeptId();
Result<SysDeptDTO> result = adminFeignClient.get(Long.valueOf(deptId));
SysDeptDTO sysDeptDTO = result.getData();
entity.setDeptTypeKey(sysDeptDTO.getTypeKey());
entity.setDeptName(sysDeptDTO.getName());
// 查询设置上级部门信息
DeptLevelAndLeaderDTO deptLevelInfo = deptUtils.getDeptLevelInfo(Long.valueOf(deptId), YesOrNoEnum.YES);
entity.setAllDeptIds(deptLevelInfo.getAllDeptIds());
entity.setAllDeptNames(deptLevelInfo.getAllDeptNames());
entity.setParentDeptIds(deptLevelInfo.getParentDeptIds());
entity.setParentDeptNames(deptLevelInfo.getParentDeptNames());
return entity;
}
/**
* 拼接部门ID不在当前用户权限内的部门名称
* @param index
* @param kpiPeopleEvaluateExcel
* @param recordList
* @return
*/
private String splicingErrorDeptName(int index,KpiPeopleEvaluateExcel kpiPeopleEvaluateExcel,List<KpiPeopleEvaluateExcel> recordList){
UserDetail user = SecurityUser.getUser();
List<Long> deptIdList = user.getDeptIdList();
if(!deptIdList.contains(Long.valueOf(kpiPeopleEvaluateExcel.getDeptId()))){
if(index == (recordList.size()-1)){
return kpiPeopleEvaluateExcel.getDeptName();
}else{
return kpiPeopleEvaluateExcel.getDeptName() + "、";
}
}
return "";
}
/**
* 校验分数是否规范
* @param kpiPeopleEvaluateExcel
* @return
*/
private Boolean checkScoreCell(KpiPeopleEvaluateExcel kpiPeopleEvaluateExcel){
// 民生评价分数(10分)
String peopleEvaluate = kpiPeopleEvaluateExcel.getPeopleEvaluate();
if(ExcelUtils.checkNumber(peopleEvaluate)){
return true;
}
Double peopleEvaluateDouble = Double.parseDouble(peopleEvaluate);
if(peopleEvaluateDouble < 0 || peopleEvaluateDouble > 10){
return true;
}
return false;
}
/**
* 校验是否存在空单元格
* @param kpiPeopleEvaluateExcel
* @return
*/
private Boolean checkNullCell(KpiPeopleEvaluateExcel kpiPeopleEvaluateExcel){
if(StringUtils.isBlank(kpiPeopleEvaluateExcel.getDeptId()) || StringUtils.isBlank(kpiPeopleEvaluateExcel.getDeptName()) || StringUtils.isBlank(kpiPeopleEvaluateExcel.getYear())
|| StringUtils.isBlank(kpiPeopleEvaluateExcel.getPeopleEvaluate())){
return true;
}
return false;
}
}

89
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/KpiPeopleEvaluateDao.xml

@ -0,0 +1,89 @@
<?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.elink.esua.epdc.dao.KpiPeopleEvaluateDao">
<resultMap type="com.elink.esua.epdc.entity.KpiPeopleEvaluateEntity" id="kpiPeopleEvaluateMap">
<result property="id" column="ID"/>
<result property="deptId" column="DEPT_ID"/>
<result property="deptName" column="DEPT_NAME"/>
<result property="deptTypeKey" column="DEPT_TYPE_KEY"/>
<result property="year" column="YEAR"/>
<result property="peopleEvaluate" column="PEOPLE_EVALUATE"/>
<result property="parentDeptIds" column="PARENT_DEPT_IDS"/>
<result property="parentDeptNames" column="PARENT_DEPT_NAMES"/>
<result property="allDeptIds" column="ALL_DEPT_IDS"/>
<result property="allDeptNames" column="ALL_DEPT_NAMES"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
<result property="delFlag" column="DEL_FLAG"/>
</resultMap>
<select id="getInfoPage" resultType="com.elink.esua.epdc.dto.KpiPeopleEvaluateDTO">
select
sd.ID,
sd.DEPT_ID,
sd.DEPT_NAME,
sd.DEPT_TYPE_KEY,
sd.YEAR,
sd.PEOPLE_EVALUATE,
sd.PARENT_DEPT_IDS,
sd.PARENT_DEPT_NAMES,
sd.ALL_DEPT_IDS,
sd.ALL_DEPT_NAMES,
sd.REVISION,
sd.CREATED_BY,
sd.CREATED_TIME,
sd.UPDATED_BY,
sd.UPDATED_TIME,
sd.DEL_FLAG
from epdc_kpi_people_evaluate sd
where sd.DEL_FLAG = '0'
<if test="deptId != null and deptId != ''">
and FIND_IN_SET(#{deptId},ALL_DEPT_IDS)
</if>
<if test="year != null and year != ''">
and YEAR = #{year}
</if>
<if test="deptTypeKey != null and deptTypeKey != ''">
and DEPT_TYPE_KEY = #{deptTypeKey}
</if>
order by sd.UPDATED_TIME desc
</select>
<select id="getDuplicateData" resultType="com.elink.esua.epdc.dto.KpiPeopleEvaluateDTO" parameterType="com.elink.esua.epdc.dto.form.CheckIsScoredByYearFormDTO">
select
ID,
DEPT_ID,
DEPT_NAME,
DEPT_TYPE_KEY,
YEAR,
PEOPLE_EVALUATE,
PARENT_DEPT_IDS,
PARENT_DEPT_NAMES,
ALL_DEPT_IDS,
ALL_DEPT_NAMES,
REVISION,
CREATED_BY,
CREATED_TIME,
UPDATED_BY,
UPDATED_TIME,
DEL_FLAG
from epdc_kpi_people_evaluate
where DEL_FLAG = '0'
<if test="checkList != null and checkList.size() > 0">
AND DEPT_ID IN
<foreach collection="checkList" item="deptId" index="index" open="(" close=")" separator=",">
#{deptId}
</foreach>
</if>
<if test="year != null and year != ''">
and YEAR = #{year}
</if>
</select>
</mapper>
Loading…
Cancel
Save