基于springboot redis vue前后端分离学生就业服务平台源码和论文

学生就业服务平台的设计与实现

随着大学生人数的不断增加,毕业生就业越来越难。为了更好地使大学生就业, 设计一个大学生就业服务平台是非常必要的。这个系统能够解决当前就业中存在 的问题,给大学生提供了更多的就业平台,也给企业单位提供了极大的帮助,同时增 进了大学生和企业间的联系。另外,设计大学生就业服务平台使得大学生就业工 作更加规范化、合理化和网络化,提高了有关大学生就业管理工作的效益。

本系统采用 Browser/Server 技术模式,在前台使用VUE开发技术,后

台使用Springboot开发技术。本系统主要是为了方便负责就业管理工作的老师使用,向毕业生提供一些招聘信息、就业指导及相关的政策信息, 以帮助同学们更好的就业。 本系统为毕业生提供了一个便捷、可靠的信息平台,有利于学校更好的对大 学生进行就业管理和指导.本系统是在网络上架构一个动态的网站,用 MySQL 作为数据库, Tomcat 作为应用服务器,采用 JSP(Java Server Pages) 技术开发的大学生就业管理信 息系统。

本论文的思路是:首先,介绍本系统开发的背景、来源和意义、最终目标和开发 系统所用的技术;其次,对系统进行需求分析;再次,对系统进行详细设计;然后, 对系统的实现和测试;最后,对系统的总结和对未来的展望。

【684】基于springboot redis vue前后端分离学生就业服务平台源码和论文

关键字: 就业管理;B/S模式;Springboot Vue;mysql

ABSTRACT

With the increasing number of college students, it is more and more difficult for graduates to obtain employment. In order to better enable college students to obtain employment, it is necessary to design an employment management information system for college students. This system can solve the problems existing in the current employment, provide more employment platforms for college students, and also provide great help to enterprises. At the same time, it enhances the relationship between college students and enterprises. In addition, the design of college students' employment management information system makes college students' employment work more standardized, rationalized and networked, and improves the efficiency of college students' employment management.

The system adopts Browser/Server technology mode, and uses SSM development technology in the foreground,The platform uses MYSQL database development technology. This system is mainly for the convenience of teachers in charge of employment management, providing graduates with some recruitment information, employment guidance and related policy information to help students better obtain employment. This system provides a convenient and reliable information platform for graduates, which is conducive to better employment management and guidance for college students This system is a dynamic website built on the network, using MySQL as the database, Tomcat as the application server, and JSP (Java Server Pages) technology to develop the college students' employment management information system

The idea of this paper is as follows: First, introduce the background, source, significance, ultimate Student employment managementl and technology used to develop the system; Secondly, the system needs analysis; Thirdly, the system is designed in detail; Then, the implementation and testing of the system; Finally, the summary of the system and future prospects.

Key words: employment management; B/S mode;springboot; mysql

 

package top.ludonghuang.controller;

import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.ludonghuang.entity.Resume;
import top.ludonghuang.entity.Send;
import top.ludonghuang.framework.redis.RedisUtil;
import top.ludonghuang.framework.role.RequiresRoles;
import top.ludonghuang.framework.role.Role;
import top.ludonghuang.service.*;
import top.ludonghuang.utils.Result;
import top.ludonghuang.utils.UserThreadLocal;
import top.ludonghuang.vo.UserData;

import java.util.Date;
import java.util.Map;

@RestController
@RequestMapping("/send")
public class SendController {

    @Autowired
    private SendService sendService;
    @Autowired
    private UserDataService userDataService;
    @Autowired
    private ResumeService resumeService;
    @Autowired
    private StudentService studentService;
    @Autowired
    private CompanyService companyService;
    @Autowired
    private PostService postService;
    @Autowired
    private RedisUtil redisUtil;

    @PostMapping("/create")
    public Result create(@RequestBody Map<String, Integer> map) {
        UserData userData = userDataService.getUser();
        //1、判断用户是否登录
        if (userData == null || userData.getType() != 2) {
            Result.success("非法登录不能操作");
        }
        Integer postId = map.get("postId");
        Integer companyId = map.get("companyId");
        //2、判断是否重复申请职位
        Send sendParam = new Send();
        sendParam.setStudentId(userData.getId());
        sendParam.setPostId(postId);
        sendParam.setCompanyId(companyId);
        PageInfo<Send> sendPageInfo = sendService.query(sendParam);
        if (sendPageInfo.getList() != null && sendPageInfo.getList().size() > 0) {
            return Result.error("请勿重复申请职位");
        }
        //构建send对象
        Send send = new Send();
        send.setPostId(postId);
        send.setCompanyId(companyId);
        send.setSendDate(new Date());
        send.setStatus(0);
        send.setStudentId(userData.getId());
        //3、查询学生简历,判断简历是否开放
        Resume param = new Resume();
        param.setStudentId(userData.getId());
        param.setStatus(1);
        PageInfo<Resume> pageInfo = resumeService.query(param);
        if (pageInfo.getList() != null && pageInfo.getList().size() > 0) {
            Resume resume = pageInfo.getList().get(0);
            send.setResumeId(resume.getId());
        } else {
            Result.error("请先完善简历");
        }
        //4、进行保存操作
        int row = sendService.create(send);
        if (row > 0) {
            return Result.success("操作成功");
        } else {
            return Result.error("操作失败");
        }
    }

    @PostMapping("/delete")
    public Result delete(String ids) {
        int flag = sendService.delete(ids);
        if (flag > 0) {
            return Result.success();
        } else {
            return Result.error();
        }
    }

    @PostMapping("/update")
    public Result update(@RequestBody Send send) {
        int flag = sendService.update(send);
        if (flag > 0) {
            return Result.success();
        } else {
            return Result.error();
        }
    }

    @PostMapping("/detail")
    public Result detail(Integer id) {
        return Result.success(sendService.detail(id));
    }

    @RequiresRoles(type = Role.COMPANY)
    @PostMapping("query")
    public Map<String, Object> query(@RequestBody Send send) {
        String token = UserThreadLocal.get();
        UserData userData = (UserData) redisUtil.get(token);
        send.setCompanyId(userData.getId());
        PageInfo<Send> pageInfo = sendService.query(send);
        pageInfo.getList().forEach(item -> {
            item.setCompany(companyService.detail(item.getCompanyId()));
            item.setResume(resumeService.detail(item.getResumeId()));
            item.setStudent(studentService.detail(item.getStudentId()));
            item.setPost(postService.detail(item.getPostId()));
        });
        return Result.success(pageInfo);
    }

    @RequiresRoles(type = Role.STUDENT)
    @PostMapping("student_send")
    public Map<String, Object> student_send(@RequestBody Send send) {
        String token = UserThreadLocal.get();
        UserData userData = (UserData) redisUtil.get(token);
        send.setStudentId(userData.getId());
        PageInfo<Send> pageInfo = sendService.query(send);
        pageInfo.getList().forEach(item -> {
            item.setCompany(companyService.detail(item.getCompanyId()));
            item.setResume(resumeService.detail(item.getResumeId()));
            item.setPost(postService.detail(item.getPostId()));
        });
        return Result.success(pageInfo);
    }
}
package top.ludonghuang.controller;

import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.ludonghuang.entity.Certificate;
import top.ludonghuang.entity.Resume;
import top.ludonghuang.service.CertificateService;
import top.ludonghuang.service.ResumeService;
import top.ludonghuang.service.UserDataService;
import top.ludonghuang.utils.Result;
import top.ludonghuang.vo.UserData;

import java.util.Map;

@RestController
@RequestMapping("/certificate")
public class CertificateController {

    @Autowired
    private CertificateService certificateService;
    @Autowired
    private ResumeService resumeService;
    @Autowired
    private UserDataService userDataService;

    @PostMapping("/create")
    public Result create(@RequestBody Certificate certificate) {
        int flag = certificateService.create(certificate);
        if (flag > 0) {
            return Result.success();
        } else {
            return Result.error();
        }
    }

    @PostMapping("/delete")
    public Result delete(String ids) {
        int flag = certificateService.delete(ids);
        if (flag > 0) {
            return Result.success();
        } else {
            return Result.error();
        }
    }

    @PostMapping("/update")
    public Result update(@RequestBody Certificate certificate) {
        int flag = certificateService.update(certificate);
        if (flag > 0) {
            return Result.success();
        } else {
            return Result.error();
        }
    }

    @PostMapping("/detail")
    public Result detail(Integer id) {
        return Result.success(certificateService.detail(id));
    }

    @PostMapping("/query")
    public Map<String, Object> query(@RequestBody Certificate certificate) {
        UserData user = userDataService.getUser();
        Resume resumeParam = resumeService.detail(user.getId());
        if(resumeParam == null) {
            return Result.success(new PageInfo<>());
        }
        certificate.setResumeId(resumeParam.getId());
        PageInfo<Certificate> pageInfo = certificateService.query(certificate);
        pageInfo.getList().forEach(item -> {
            Resume resume = resumeService.detail(item.getResumeId());
            item.setResume(resume);
        });
        return Result.success(pageInfo);
    }

}
package top.ludonghuang.controller;

import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.ludonghuang.entity.Experience;
import top.ludonghuang.entity.Resume;
import top.ludonghuang.service.ExperienceService;
import top.ludonghuang.service.ResumeService;
import top.ludonghuang.service.UserDataService;
import top.ludonghuang.utils.Result;
import top.ludonghuang.vo.UserData;

import java.util.Map;

@RestController
@RequestMapping("/experience")
public class ExperienceController {

    @Autowired
    private ExperienceService experienceService;
    @Autowired
    private ResumeService resumeService;
    @Autowired
    private UserDataService userDataService;

    @PostMapping("/create")
    public Result create(@RequestBody Experience experience) {
        int flag = experienceService.create(experience);
        if (flag > 0) {
            return Result.success();
        } else {
            return Result.error();
        }
    }

    @PostMapping("/delete")
    public Result delete(String ids) {
        int flag = experienceService.delete(ids);
        if (flag > 0) {
            return Result.success();
        } else {
            return Result.error();
        }
    }

    @PostMapping("/update")
    public Result update(@RequestBody Experience experience) {
        int flag = experienceService.update(experience);
        if (flag > 0) {
            return Result.success();
        } else {
            return Result.error();
        }
    }

    @PostMapping("/detail")
    public Result detail(Integer id) {
        return Result.success(experienceService.detail(id));
    }

    @PostMapping("/query")
    public Map<String, Object> query(@RequestBody Experience experience) {
        UserData user = userDataService.getUser();
        Resume resumeParam = resumeService.detail(user.getId());
        if(resumeParam == null) {
            return Result.success(new PageInfo<>());
        }
        experience.setResumeId(resumeParam.getId());
        PageInfo<Experience> pageInfo = experienceService.query(experience);
        pageInfo.getList().forEach(item -> {
            Resume resume = resumeService.detail(item.getResumeId());
            item.setResume(resume);
        });
        return Result.success(pageInfo);
    }

}
package com.controller;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;

import javax.servlet.http.HttpServletRequest;

import com.alibaba.fastjson.JSON;
import com.utils.StringUtil;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.annotation.IgnoreAuth;
import com.baidu.aip.face.AipFace;
import com.baidu.aip.face.MatchRequest;
import com.baidu.aip.util.Base64Util;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.ConfigEntity;
import com.service.CommonService;
import com.service.ConfigService;
import com.utils.BaiduUtil;
import com.utils.FileUtil;
import com.utils.R;

/**
 * 通用接口
 */
@RestController
public class CommonController{
	private static final Logger logger = LoggerFactory.getLogger(CommonController.class);
	@Autowired
	private CommonService commonService;
	
	@Autowired
	private ConfigService configService;
	
	private static AipFace client = null;
	
	private static String BAIDU_DITU_AK = null;
	
	@RequestMapping("/location")
	public R location(String lng,String lat) {
		if(BAIDU_DITU_AK==null) {
			BAIDU_DITU_AK = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "baidu_ditu_ak")).getValue();
			if(BAIDU_DITU_AK==null) {
				return R.error("请在配置管理中正确配置baidu_ditu_ak");
			}
		}
		Map<String, String> map = BaiduUtil.getCityByLonLat(BAIDU_DITU_AK, lng, lat);
		return R.ok().put("data", map);
	}
	
	/**
	 * 人脸比对
	 * 
	 * @param face1 人脸1
	 * @param face2 人脸2
	 * @return
	 */
	@RequestMapping("/matchFace")
	public R matchFace(String face1, String face2, HttpServletRequest request) {
		if(client==null) {
			/*String AppID = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "AppID")).getValue();*/
			String APIKey = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "APIKey")).getValue();
			String SecretKey = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "SecretKey")).getValue();
			String token = BaiduUtil.getAuth(APIKey, SecretKey);
			if(token==null) {
				return R.error("请在配置管理中正确配置APIKey和SecretKey");
			}
			client = new AipFace(null, APIKey, SecretKey);
			client.setConnectionTimeoutInMillis(2000);
			client.setSocketTimeoutInMillis(60000);
		}
		JSONObject res = null;
		try {
			File file1 = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+face1);
			File file2 = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+face2);
			String img1 = Base64Util.encode(FileUtil.FileToByte(file1));
			String img2 = Base64Util.encode(FileUtil.FileToByte(file2));
			MatchRequest req1 = new MatchRequest(img1, "BASE64");
			MatchRequest req2 = new MatchRequest(img2, "BASE64");
			ArrayList<MatchRequest> requests = new ArrayList<MatchRequest>();
			requests.add(req1);
			requests.add(req2);
			res = client.match(requests);
			System.out.println(res.get("result"));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
			return R.error("文件不存在");
		} catch (IOException e) {
			e.printStackTrace();
		} 
		return R.ok().put("data", com.alibaba.fastjson.JSONObject.parse(res.get("result").toString()));
	}
    
	/**
	 * 获取table表中的column列表(联动接口)
	 * @return
	 */
	@RequestMapping("/option/{tableName}/{columnName}")
	@IgnoreAuth
	public R getOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName,String level,String parent) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("table", tableName);
		params.put("column", columnName);
		if(StringUtils.isNotBlank(level)) {
			params.put("level", level);
		}
		if(StringUtils.isNotBlank(parent)) {
			params.put("parent", parent);
		}
		List<String> data = commonService.getOption(params);
		return R.ok().put("data", data);
	}
	
	/**
	 * 根据table中的column获取单条记录
	 * @return
	 */
	@RequestMapping("/follow/{tableName}/{columnName}")
	@IgnoreAuth
	public R getFollowByOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, @RequestParam String columnValue) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("table", tableName);
		params.put("column", columnName);
		params.put("columnValue", columnValue);
		Map<String, Object> result = commonService.getFollowByOption(params);
		return R.ok().put("data", result);
	}
	
	/**
	 * 修改table表的sfsh状态
	 * @param map
	 * @return
	 */
	@RequestMapping("/sh/{tableName}")
	public R sh(@PathVariable("tableName") String tableName, @RequestBody Map<String, Object> map) {
		map.put("table", tableName);
		commonService.sh(map);
		return R.ok();
	}
	
	/**
	 * 获取需要提醒的记录数
	 * @param tableName
	 * @param columnName
	 * @param type 1:数字 2:日期
	 * @param map
	 * @return
	 */
	@RequestMapping("/remind/{tableName}/{columnName}/{type}")
	@IgnoreAuth
	public R remindCount(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, 
						 @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
		map.put("table", tableName);
		map.put("column", columnName);
		map.put("type", type);
		
		if(type.equals("2")) {
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
			Calendar c = Calendar.getInstance();
			Date remindStartDate = null;
			Date remindEndDate = null;
			if(map.get("remindstart")!=null) {
				Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
				c.setTime(new Date()); 
				c.add(Calendar.DAY_OF_MONTH,remindStart);
				remindStartDate = c.getTime();
				map.put("remindstart", sdf.format(remindStartDate));
			}
			if(map.get("remindend")!=null) {
				Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
				c.setTime(new Date());
				c.add(Calendar.DAY_OF_MONTH,remindEnd);
				remindEndDate = c.getTime();
				map.put("remindend", sdf.format(remindEndDate));
			}
		}
		
		int count = commonService.remindCount(map);
		return R.ok().put("count", count);
	}

	/**
	 * 圖表统计
	 */
	@IgnoreAuth
	@RequestMapping("/group/{tableName}")
	public R group1(@PathVariable("tableName") String tableName, @RequestParam Map<String,Object> params) {
		params.put("table1", tableName);
		List<Map<String, Object>> result = commonService.chartBoth(params);
		return R.ok().put("data", result);
	}


	/**
	 * 单列求和
	 */
	@RequestMapping("/cal/{tableName}/{columnName}")
	@IgnoreAuth
	public R cal(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("table", tableName);
		params.put("column", columnName);
		Map<String, Object> result = commonService.selectCal(params);
		return R.ok().put("data", result);
	}
	
	/**
	 * 分组统计
	 */
	@RequestMapping("/group/{tableName}/{columnName}")
	@IgnoreAuth
	public R group(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("table", tableName);
		params.put("column", columnName);
		List<Map<String, Object>> result = commonService.selectGroup(params);
		return R.ok().put("data", result);
	}
	
	/**
	 * (按值统计)
	 */
	@RequestMapping("/value/{tableName}/{xColumnName}/{yColumnName}")
	@IgnoreAuth
	public R value(@PathVariable("tableName") String tableName, @PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("table", tableName);
		params.put("xColumn", xColumnName);
		params.put("yColumn", yColumnName);
		List<Map<String, Object>> result = commonService.selectValue(params);
		return R.ok().put("data", result);
	}


	/**
	 * 下面为新加的
	 *
	 *
	 *
	 */

	/**
	 * 查询字典表的分组求和
	 * tableName  		表名
	 * groupColumn  		分组字段
	 * sumCloum			统计字段
	 * @return
	 */
	@RequestMapping("/newSelectGroupSum")
	public R newSelectGroupSum(@RequestParam Map<String,Object> params) {
		logger.debug("newSelectGroupSum:,,Controller:{},,params:{}",this.getClass().getName(),params);
		List<Map<String, Object>> result = commonService.newSelectGroupSum(params);
		return R.ok().put("data", result);
	}


    /**
     tableName 查询表
     condition1 条件1
     condition1Value 条件1值
     average 计算平均评分

     取值
        有值 Number(res.data.value.toFixed(1))
        无值 if(res.data){}
     * */
    @IgnoreAuth
    @RequestMapping("/queryScore")
    public R queryScore(@RequestParam Map<String, Object> params) {
        logger.debug("queryScore:,,Controller:{},,params:{}",this.getClass().getName(),params);
        Map<String, Object> queryScore = commonService.queryScore(params);
        return R.ok().put("data", queryScore);
    }

	/**
	 * 查询字典表的分组统计总条数
	 *  tableName  		表名
	 *	groupColumn  	分组字段
	 * @return
	 */
	@RequestMapping("/newSelectGroupCount")
	public R newSelectGroupCount(@RequestParam Map<String,Object> params) {
		logger.debug("newSelectGroupCount:,,Controller:{},,params:{}",this.getClass().getName(),params);
		List<Map<String, Object>> result = commonService.newSelectGroupCount(params);
		return R.ok().put("data", result);
	}


	/**
	 * 当前表的日期分组求和
	 * tableName  		表名
	 * groupColumn  		分组字段
	 * sumCloum			统计字段
	 * dateFormatType	日期格式化类型   1:年 2:月 3:日
	 * @return
	 */
	@RequestMapping("/newSelectDateGroupSum")
	public R newSelectDateGroupSum(@RequestParam Map<String,Object> params) {
		logger.debug("newSelectDateGroupSum:,,Controller:{},,params:{}",this.getClass().getName(),params);
		String dateFormatType = String.valueOf(params.get("dateFormatType"));
		if("1".equals(dateFormatType)){
			params.put("dateFormat", "%Y");
		}else if("2".equals(dateFormatType)){
			params.put("dateFormat", "%Y-%m");
		}else if("3".equals(dateFormatType)){
			params.put("dateFormat", "%Y-%m-%d");
		}else{
			R.error("日期格式化不正确");
		}
		List<Map<String, Object>> result = commonService.newSelectDateGroupSum(params);
		return R.ok().put("data", result);
	}

	/**
	 *
	 * 查询字典表的分组统计总条数
	 * tableName  		表名
	 * groupColumn  		分组字段
	 * dateFormatType	日期格式化类型   1:年 2:月 3:日
	 * @return
	 */
	@RequestMapping("/newSelectDateGroupCount")
	public R newSelectDateGroupCount(@RequestParam Map<String,Object> params) {
		logger.debug("newSelectDateGroupCount:,,Controller:{},,params:{}",this.getClass().getName(),params);
		String dateFormatType = String.valueOf(params.get("dateFormatType"));
		if("1".equals(dateFormatType)){
			params.put("dateFormat", "%Y");
		}else if("2".equals(dateFormatType)){
			params.put("dateFormat", "%Y-%m");
		}else if("3".equals(dateFormatType)){
			params.put("dateFormat", "%Y-%m-%d");
		}else{
			R.error("日期格式化类型不正确");
		}
		List<Map<String, Object>> result = commonService.newSelectDateGroupCount(params);
		return R.ok().put("data", result);
	}
/**
 * 饼状图
 * -- 饼状图  查询当前表
 -- 				查询字典表【月】
 -- 				 统计   -- 查询某个月的每个类型的订单销售数量
 -- 				 求和   -- 查询某个月的每个类型的订单销售额
 -- 				查询某个字符串【月】
 -- 				 统计   -- 查询某个月的每个员工的订单销售数量
 -- 				 求和   -- 查询某个月的每个员工的订单销售额
 -- 				查询时间【年】
 -- 				 统计 	-- 查询每个月的订单销售数量
 -- 				 求和 	-- 查询每个月的订单销售额
 -- 饼状图  查询级联表
 -- 				查询字典表
 -- 				 统计  	-- 查询某个月的每个类型的订单销售数量
 -- 				 求和   -- 查询某个月的每个类型的订单销售额
 -- 				查询某个字符串
 -- 				 统计   -- 查询某个月的每个员工的订单销售数量
 -- 				 求和   -- 查询某个月的每个员工的订单销售额
 -- 				查询时间
 -- 				 统计 	-- 统计每个月的订单销售数量
 -- 				 求和 	-- 查询每个月的订单销售额
 */


/**
 * 柱状图
 -- 柱状图  查询当前表
 --             某个【年,月】
 -- 			 当前表 2 级联表 1
 -- 						统计
 --   						【日期,字符串,下拉框】
 -- 						求和
 --   						【日期,字符串,下拉框】
 -- 柱状图  查询级联表
 -- 					某个【年,月】
 -- 						统计
 --   						【日期,字符串,下拉框】
 -- 						求和
 --   						【日期,字符串,下拉框】
 */

    /**
     * 柱状图求和
     */
    @RequestMapping("/barSum")
    public R barSum(@RequestParam Map<String,Object> params) {
        logger.debug("barSum方法:,,Controller:{},,params:{}",this.getClass().getName(), com.alibaba.fastjson.JSONObject.toJSONString(params));
        Boolean isJoinTableFlag =  false;//是否有级联表相关
        String one =  "";//第一优先
        String two =  "";//第二优先

		//处理thisTable和joinTable 处理内容是把json字符串转为Map并把带有,的切割为数组
			//当前表
			Map<String,Object> thisTable = JSON.parseObject(String.valueOf(params.get("thisTable")),Map.class);
			params.put("thisTable",thisTable);

			//级联表
			String joinTableString = String.valueOf(params.get("joinTable"));
			if(StringUtil.isNotEmpty(joinTableString)) {
				Map<String, Object> joinTable = JSON.parseObject(joinTableString, Map.class);
				params.put("joinTable", joinTable);
				isJoinTableFlag = true;
			}

		if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("date")))){//当前表日期
			thisTable.put("date",String.valueOf(thisTable.get("date")).split(","));
			one = "thisDate0";
		}
		if(isJoinTableFlag){//级联表日期
			Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
			if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("date")))){
				joinTable.put("date",String.valueOf(joinTable.get("date")).split(","));
				if(StringUtil.isEmpty(one)){
					one ="joinDate0";
				}else{
					if(StringUtil.isEmpty(two)){
						two ="joinDate0";
					}
				}
			}
		}
		if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("string")))){//当前表字符串
			thisTable.put("string",String.valueOf(thisTable.get("string")).split(","));
			if(StringUtil.isEmpty(one)){
				one ="thisString0";
			}else{
				if(StringUtil.isEmpty(two)){
					two ="thisString0";
				}
			}
		}
		if(isJoinTableFlag){//级联表字符串
			Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
			if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("string")))){
				joinTable.put("string",String.valueOf(joinTable.get("string")).split(","));
				if(StringUtil.isEmpty(one)){
					one ="joinString0";
				}else{
					if(StringUtil.isEmpty(two)){
						two ="joinString0";
					}
				}
			}
		}
		if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("types")))){//当前表类型
			thisTable.put("types",String.valueOf(thisTable.get("types")).split(","));
			if(StringUtil.isEmpty(one)){
				one ="thisTypes0";
			}else{
				if(StringUtil.isEmpty(two)){
					two ="thisTypes0";
				}
			}
		}
		if(isJoinTableFlag){//级联表类型
			Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
			if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("types")))){
				joinTable.put("types",String.valueOf(joinTable.get("types")).split(","));
				if(StringUtil.isEmpty(one)){
					one ="joinTypes0";
				}else{
					if(StringUtil.isEmpty(two)){
						two ="joinTypes0";
					}
				}

			}
		}

		List<Map<String, Object>> result = commonService.barSum(params);

		List<String> xAxis = new ArrayList<>();//报表x轴
		List<List<String>> yAxis = new ArrayList<>();//y轴
		List<String> legend = new ArrayList<>();//标题

		if(StringUtil.isEmpty(two)){//不包含第二列
			List<String> yAxis0 = new ArrayList<>();
			yAxis.add(yAxis0);
			legend.add("数值");
			for(Map<String, Object> map :result){
				String oneValue = String.valueOf(map.get(one));
				String value = String.valueOf(map.get("value"));
				xAxis.add(oneValue);
				yAxis0.add(value);
			}
		}else{//包含第二列
			Map<String, HashMap<String, String>> dataMap = new LinkedHashMap<>();
			if(StringUtil.isNotEmpty(two)){
				for(Map<String, Object> map :result){
					String oneValue = String.valueOf(map.get(one));
					String twoValue = String.valueOf(map.get(two));
					String value = String.valueOf(map.get("value"));
					if(!legend.contains(twoValue)){
						legend.add(twoValue);//添加完成后 就是最全的第二列的类型
					}
					if(dataMap.containsKey(oneValue)){
						dataMap.get(oneValue).put(twoValue,value);
					}else{
						HashMap<String, String> oneData = new HashMap<>();
						oneData.put(twoValue,value);
						dataMap.put(oneValue,oneData);
					}

				}
			}

			for(int i =0; i<legend.size(); i++){
				yAxis.add(new ArrayList<String>());
			}

			Set<String> keys = dataMap.keySet();
			for(String key:keys){
				xAxis.add(key);
				HashMap<String, String> map = dataMap.get(key);
				for(int i =0; i<legend.size(); i++){
					List<String> data = yAxis.get(i);
					if(StringUtil.isNotEmpty(map.get(legend.get(i)))){
						data.add(map.get(legend.get(i)));
					}else{
						data.add("0");
					}
				}
			}
			System.out.println();
		}

		Map<String, Object> resultMap = new HashMap<>();
		resultMap.put("xAxis",xAxis);
		resultMap.put("yAxis",yAxis);
		resultMap.put("legend",legend);
		return R.ok().put("data", resultMap);
    }
	
	/**
     * 柱状图统计
     */
    @RequestMapping("/barCount")
    public R barCount(@RequestParam Map<String,Object> params) {
        logger.debug("barCount方法:,,Controller:{},,params:{}",this.getClass().getName(), com.alibaba.fastjson.JSONObject.toJSONString(params));
        Boolean isJoinTableFlag =  false;//是否有级联表相关
        String one =  "";//第一优先
        String two =  "";//第二优先

		//处理thisTable和joinTable 处理内容是把json字符串转为Map并把带有,的切割为数组
			//当前表
			Map<String,Object> thisTable = JSON.parseObject(String.valueOf(params.get("thisTable")),Map.class);
			params.put("thisTable",thisTable);

			//级联表
			String joinTableString = String.valueOf(params.get("joinTable"));
			if(StringUtil.isNotEmpty(joinTableString)) {
				Map<String, Object> joinTable = JSON.parseObject(joinTableString, Map.class);
				params.put("joinTable", joinTable);
				isJoinTableFlag = true;
			}

		if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("date")))){//当前表日期
			thisTable.put("date",String.valueOf(thisTable.get("date")).split(","));
			one = "thisDate0";
		}
		if(isJoinTableFlag){//级联表日期
			Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
			if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("date")))){
				joinTable.put("date",String.valueOf(joinTable.get("date")).split(","));
				if(StringUtil.isEmpty(one)){
					one ="joinDate0";
				}else{
					if(StringUtil.isEmpty(two)){
						two ="joinDate0";
					}
				}
			}
		}
		if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("string")))){//当前表字符串
			thisTable.put("string",String.valueOf(thisTable.get("string")).split(","));
			if(StringUtil.isEmpty(one)){
				one ="thisString0";
			}else{
				if(StringUtil.isEmpty(two)){
					two ="thisString0";
				}
			}
		}
		if(isJoinTableFlag){//级联表字符串
			Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
			if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("string")))){
				joinTable.put("string",String.valueOf(joinTable.get("string")).split(","));
				if(StringUtil.isEmpty(one)){
					one ="joinString0";
				}else{
					if(StringUtil.isEmpty(two)){
						two ="joinString0";
					}
				}
			}
		}
		if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("types")))){//当前表类型
			thisTable.put("types",String.valueOf(thisTable.get("types")).split(","));
			if(StringUtil.isEmpty(one)){
				one ="thisTypes0";
			}else{
				if(StringUtil.isEmpty(two)){
					two ="thisTypes0";
				}
			}
		}
		if(isJoinTableFlag){//级联表类型
			Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
			if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("types")))){
				joinTable.put("types",String.valueOf(joinTable.get("types")).split(","));
				if(StringUtil.isEmpty(one)){
					one ="joinTypes0";
				}else{
					if(StringUtil.isEmpty(two)){
						two ="joinTypes0";
					}
				}

			}
		}

		List<Map<String, Object>> result = commonService.barCount(params);

		List<String> xAxis = new ArrayList<>();//报表x轴
		List<List<String>> yAxis = new ArrayList<>();//y轴
		List<String> legend = new ArrayList<>();//标题

		if(StringUtil.isEmpty(two)){//不包含第二列
			List<String> yAxis0 = new ArrayList<>();
			yAxis.add(yAxis0);
			legend.add("数值");
			for(Map<String, Object> map :result){
				String oneValue = String.valueOf(map.get(one));
				String value = String.valueOf(map.get("value"));
				xAxis.add(oneValue);
				yAxis0.add(value);
			}
		}else{//包含第二列
			Map<String, HashMap<String, String>> dataMap = new LinkedHashMap<>();
			if(StringUtil.isNotEmpty(two)){
				for(Map<String, Object> map :result){
					String oneValue = String.valueOf(map.get(one));
					String twoValue = String.valueOf(map.get(two));
					String value = String.valueOf(map.get("value"));
					if(!legend.contains(twoValue)){
						legend.add(twoValue);//添加完成后 就是最全的第二列的类型
					}
					if(dataMap.containsKey(oneValue)){
						dataMap.get(oneValue).put(twoValue,value);
					}else{
						HashMap<String, String> oneData = new HashMap<>();
						oneData.put(twoValue,value);
						dataMap.put(oneValue,oneData);
					}

				}
			}

			for(int i =0; i<legend.size(); i++){
				yAxis.add(new ArrayList<String>());
			}

			Set<String> keys = dataMap.keySet();
			for(String key:keys){
				xAxis.add(key);
				HashMap<String, String> map = dataMap.get(key);
				for(int i =0; i<legend.size(); i++){
					List<String> data = yAxis.get(i);
					if(StringUtil.isNotEmpty(map.get(legend.get(i)))){
						data.add(map.get(legend.get(i)));
					}else{
						data.add("0");
					}
				}
			}
			System.out.println();
		}

		Map<String, Object> resultMap = new HashMap<>();
		resultMap.put("xAxis",xAxis);
		resultMap.put("yAxis",yAxis);
		resultMap.put("legend",legend);
		return R.ok().put("data", resultMap);
    }
}

  • 14
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
权限管理系统是一种用于管理用户权限和角色的系统,可以根据用户的身份和角色来控制其访问系统中的各种资源。基于SpringBootVueRedis前后端分离模式,可以更好地实现权限管理系统的功能。 在这个系统中,SpringBoot作为后端框架,提供了强大的功能和稳定的性能,可以处理用户的请求并进行权限验证。Vue作为前端框架,提供了友好的界面和良好的用户体验,可以让用户方便地进行权限管理操作。而Redis作为缓存数据库,可以用来存储权限信息和用户的登录状态,加快系统的响应速度和提高系统的性能。 在权限管理系统中,我们可以使用RBAC(基于角色的权限控制)模型,将用户分配到不同的角色,再将角色分配到不同的权限,从而实现对用户访问资源的控制。通过这种方式,可以实现灵活的权限管理,并且可以根据实际需求动态地调整用户的权限和角色。 通过使用SpringBootVue,我们可以实现前后端分离,让前端和后端分别进行开发和维护,降低了系统的耦合度,同时也增加了系统的灵活性和可维护性。而通过使用Redis,我们可以充分利用其高速的读取和写入能力,有效地提升系统的性能和响应速度。 综上所述,基于SpringBootVueRedis的权限管理系统,可以实现灵活、高效和安全的权限管理功能,满足用户对于权限管理的各种需求。同时,前后端分离模式也使得系统更加灵活和易于维护。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序猿毕业分享网

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值