package com.codejie.pms.controller;
import com.codejie.pms.entity.*;
import com.codejie.pms.entity.dto.NameValueDto;
import com.codejie.pms.service.AdminService;
import com.codejie.pms.service.HrService;
import com.codejie.pms.service.UserService;
import com.codejie.pms.util.ImportExcelUtil;
import com.github.pagehelper.PageInfo;
import com.codejie.pms.util.DateUtil;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.xssf.streaming.SXSSFRow;
import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@EnableAutoConfiguration
@RequestMapping(value = "/admin")
public class AdminController {
@Resource
private HrService hrService;
@Resource
private AdminService adminService;
@Resource
private UserService userService;
/**
* Description 打开所有员工页面
*/
@RequestMapping("/all_user")
public ModelAndView allUser() {
ModelAndView mv = new ModelAndView("/admin/all_user");
mv.addObject("isSuccess","3");
return mv;
}
/**
* Description 打开所有绩效指标页面
*/
@RequestMapping("/all_kpi")
public ModelAndView allKpi() {
ModelAndView mv = new ModelAndView("/admin/all_kpi");
mv.addObject("isSuccess","3");
return mv;
}
/**
* Description 打开所有绩效指标页面2
*/
@RequestMapping("/add_kp2")
public ModelAndView allKpi2(AddPoint addPoint2) {
try{
adminService.kpAdd2(addPoint2);
}catch (Exception e){
System.out.println(e);
}
ModelAndView mv = new ModelAndView("/admin/add_kp2");
User user = new User();
user.setUserId(addPoint2.getUserId());
User user1 = userService.selectUser(user);
mv.addObject("user",user1);
mv.addObject("isSuccess","3");
return mv;
}
/**
* Description 打开所有绩效指标页面3
*/
@RequestMapping("/all_kpi3")
public ModelAndView allKpi3() {
ModelAndView mv = new ModelAndView("/admin/all_kpi3");
mv.addObject("isSuccess","3");
return mv;
}
/**
* Description 所有员工信息
*/
@RequestMapping("/getUserList")
@ResponseBody
public PageInfo<User> getDeletePoint(String userId, @RequestParam(defaultValue = "1") int pageNum,
@RequestParam(defaultValue = "10") int pageSize) {
User user = new User();
user.setUserId(userId);
List<User> list = userService.selectUserList(user, pageNum, pageSize);
return new PageInfo<>(list);
}
/**
* Description 所有绩效指标信息
*/
@RequestMapping("/getKpiList")
@ResponseBody
public PageInfo<Kpi> getKpiList(String kpiId, @RequestParam(defaultValue = "1") int pageNum,
@RequestParam(defaultValue = "10") int pageSize) {
Kpi kpi = new Kpi();
kpi.setKpiId(kpiId);
List<Kpi> list = userService.selectKpiList(kpi, pageNum, pageSize);
return new PageInfo<>(list);
}
/**
* Description 所有员工绩效指标信息
*/
@RequestMapping("/getKpiList1")
@ResponseBody
public PageInfo<Kpi> getKpiList1(String kpiId, @RequestParam(defaultValue = "1") int pageNum,
@RequestParam(defaultValue = "10") int pageSize) {
Kpi kpi = new Kpi();
kpi.setKpiId(kpiId);
List<Kpi> list = userService.selectKpiList1(kpi, pageNum, pageSize);
return new PageInfo<>(list);
}
/**
* Description 开发部绩效指标页面1
*/
@RequestMapping("/all_kpi4")
public ModelAndView allKpi4(AddPointDepartment addPointDepartment) {
try{
adminService.kpAdd4(addPointDepartment);
}catch (Exception e){
System.out.println(e);
}
ModelAndView mv = new ModelAndView("/admin/all_kpi4");
Department department = new Department();
department.setDepartmentId(addPointDepartment.getDepartmentId());
Department department1 = adminService.selectDepartment(department);
mv.addObject("department",department1);
mv.addObject("isSuccess","3");
return mv;
}
/**
* Description 开发部绩效指标页面2
*/
@RequestMapping("/all_kpi5")
public ModelAndView allKpi5(AddPointDepartment addPointDepartment) {
try{
adminService.kpAdd5(addPointDepartment);
}catch (Exception e){
System.out.println(e);
}
ModelAndView mv = new ModelAndView("/admin/all_kpi5");
Department department = new Department();
department.setDepartmentId(addPointDepartment.getDepartmentId());
Department department1 = adminService.selectDepartment(department);
mv.addObject("department",department1);
mv.addObject("isSuccess","3");
return mv;
}
/**
* Description 运营部绩效指标页面1
*/
@RequestMapping("/all_kpi6")
public ModelAndView allKpi6(AddPointDepartment addPointDepartment) {
try{
adminService.kpAdd6(addPointDepartment);
}catch (Exception e){
System.out.println(e);
}
ModelAndView mv = new ModelAndView("/admin/all_kpi6");
Department department = new Department();
department.setDepartmentId(addPointDepartment.getDepartmentId());
Department department1 = adminService.selectDepartment(department);
mv.addObject("department",department1);
mv.addObject("isSuccess","3");
return mv;
}
/**
* Description 运营部绩效指标页面2
*/
@RequestMapping("/all_kpi7")
public ModelAndView allKpi7(AddPointDepartment addPointDepartment) {
try{
adminService.kpAdd7(addPointDepartment);
}catch (Exception e){
System.out.println(e);
}
ModelAndView mv = new ModelAndView("/admin/all_kpi7");
Department department = new Department();
department.setDepartmentId(addPointDepartment.getDepartmentId());
Department department1 = adminService.selectDepartment(department);
mv.addObject("department",department1);
mv.addObject("isSuccess","3");
return mv;
}
/**
* Description 人事部绩效指标页面1
*/
@RequestMapping("/all_kpi8")
public ModelAndView allKpi8(AddPointDepartment addPointDepartment) {
try{
adminService.kpAdd8(addPointDepartment);
}catch (Exception e){
System.out.println(e);
}
ModelAndView mv = new ModelAndView("/admin/all_kpi8");
Department department = new Department();
department.setDepartmentId(addPointDepartment.getDepartmentId());
Department department1 = adminService.selectDepartment(department);
mv.addObject("department",department1);
mv.addObject("isSuccess","3");
return mv;
}
/**
* Description 人事部绩效指标页面2
*/
@RequestMapping("/all_kpi9")
public ModelAndView allKpi9(AddPointDepartment addPointDepartment) {
try{
adminService.kpAdd9(addPointDepartment);
}catch (Exception e){
System.out.println(e);
}
Mo