ssm学生请假系统源码和论文

news2024/10/5 13:03:32

ssm学生请假系统034


 开发工具:idea 
 数据库mysql5.7+
 数据库链接工具:navcat,小海豚等
  技术:ssm 

摘  要

现代经济快节奏发展以及不断完善升级的信息化技术,让传统数据信息的管理升级为软件存储,归纳,集中处理数据信息的管理方式。本学生请假系统就是在这样的大环境下诞生,其可以帮助管理者在短时间内处理完毕庞大的数据信息,使用这种软件工具可以帮助管理人员提高事务处理效率,达到事半功倍的效果。此学生请假系统利用当下成熟完善的SSM框架,使用跨平台的可开发大型商业网站的Java语言,以及最受欢迎的RDBMS应用软件之一的Mysql数据库进行程序开发。实现了学的请假的一个申请功能,老师和管理员可以对学生的请求做出处理,学生请假系统的开发根据操作人员需要设计的界面简洁美观,在功能模块布局上跟同类型网站保持一致,程序在实现基本要求功能时,也为数据信息面临的安全问题提供了一些实用的解决方案。可以说该程序在帮助管理者高效率地处理工作事务的同时,也实现了数据信息的整体化,规范化与自动化。

关键词:学生请假系统;SSM框架;Mysql;自动化

package com.controller;


import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.StringUtil;
import java.lang.reflect.InvocationTargetException;

import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;

import com.entity.ChuqinEntity;

import com.service.ChuqinService;
import com.entity.view.ChuqinView;
import com.service.YonghuService;
import com.entity.YonghuEntity;
import com.utils.PageUtils;
import com.utils.R;

/**
 * 考勤
 * 后端接口
 * @author
 * @email
 * @date 2021-02-25
*/
@RestController
@Controller
@RequestMapping("/chuqin")
public class ChuqinController {
    private static final Logger logger = LoggerFactory.getLogger(ChuqinController.class);

    @Autowired
    private ChuqinService chuqinService;


    @Autowired
    private TokenService tokenService;


    //级联表service
    @Autowired
    private YonghuService yonghuService;

    //字典表map
    Map<String, Map<Integer, String>> dictionaryMap;

    /**
    * 后端列表
    */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(StringUtil.isNotEmpty(role) && "用户".equals(role)){
            params.put("yonghuId",request.getSession().getAttribute("userId"));
        }
        PageUtils page = chuqinService.queryPage(params);

        //字典表数据转换
        List<ChuqinView> list =(List<ChuqinView>)page.getList();
        ServletContext servletContext = ContextLoader.getCurrentWebApplicationContext().getServletContext();
        dictionaryMap = (Map<String, Map<Integer, String>>) servletContext.getAttribute("dictionaryMap");
        for(ChuqinView c:list){
            this.dictionaryConvert(c);
        }
        return R.ok().put("data", page);
    }
    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        ChuqinEntity chuqin = chuqinService.selectById(id);
        if(chuqin !=null){
            //entity转view
            ChuqinView view = new ChuqinView();
            BeanUtils.copyProperties( chuqin , view );//把实体数据重构到view中

            //级联表
            YonghuEntity yonghu = yonghuService.selectById(chuqin.getYonghuId());
            if(yonghu != null){
                BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
            }
            //字典表字典转换
            ServletContext servletContext = ContextLoader.getCurrentWebApplicationContext().getServletContext();
            dictionaryMap = (Map<String, Map<Integer, String>>) servletContext.getAttribute("dictionaryMap");
            this.dictionaryConvert(view);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }



    /**
    * 打卡
    */
    @RequestMapping("/clockIn")
    public R clockIn(String flag, HttpServletRequest request){
        logger.debug("clockIn方法:,,Controller:{},,flag:{}",this.getClass().getName(),flag);
        try {
            Integer id = (Integer)request.getSession().getAttribute("userId");
            String role = String.valueOf(request.getSession().getAttribute("role"));
            if(StringUtil.isEmpty(role) || "管理员".equals(role)){
                return R.error(511,"没有打卡权限");
            }
            Date d = new Date();
            SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd");
            String date = format1.format(d);
            List<ChuqinEntity> chuqinList = new ArrayList<ChuqinEntity>();//要生成的list数据
            List<String> s = new ArrayList<>();
            s.add("yonghu_id+0");
            Wrapper<ChuqinEntity> queryWrapper3 = new EntityWrapper<ChuqinEntity>().eq("yonghu_id",id).orderDesc(s);
            List<ChuqinEntity> oldChuqinList = chuqinService.selectList(queryWrapper3);
            if("1".equals(flag)){
                //上班卡
                Date date1 = new Date();
                date1.setHours(8);
                date1.setMinutes(0);
                date1.setSeconds(0);
                //上班打卡
                //新增前先查看当前用户最大打卡时间

                if(oldChuqinList != null && oldChuqinList.size()>0){
                    ChuqinEntity entity = oldChuqinList.get(0);
                    String today = entity.getToday();//获取出勤表最大出勤
                    //把日期加一天
                    Date todayTime = format1.parse(today);
                    Calendar   calendar = new GregorianCalendar();
                    calendar.setTime(todayTime);
                    calendar.add(calendar.DATE,1);
                    String newToday = format1.format(calendar.getTime());
                    if(date.equals(today)){
                        return R.error(511,"已经打过上班卡了");
                    }else if(!date.equals(newToday)){//当天日期 不是出勤最大日期加一天的话   就是补充缺勤日期
                        chuqinList = this.getQueQin(d, format1, today, id);
                    }

                    if(chuqinList !=null && chuqinList.size() >0){
                        chuqinService.insertBatch(chuqinList);
                    }


                    //插入当天的上班卡
                    ChuqinEntity chuqin = new ChuqinEntity();
                    chuqin.setOnTime(d);
                    if(d.compareTo(date1)>0){//当前时间d 大于规定时间date1
                        chuqin.setChuqinTypes(6);//设置为迟到
                    }else if(d.compareTo(date1)<=0){//当前时间d 小于等于规定时间date1
                        chuqin.setChuqinTypes(3);//设置为未打下班卡
                    }
                    chuqin.setCreateTime(d);
                    chuqin.setToday(date);
                    chuqin.setYonghuId(id);
                    chuqinService.insert(chuqin);
                }else{
                    //第一次打卡
                    ChuqinEntity chuqin = new ChuqinEntity();
                    chuqin.setOnTime(d);
                    if(d.compareTo(date1)>0){//当前时间d 大于规定时间date1
                        chuqin.setChuqinTypes(6);//设置为迟到
                    }else if(d.compareTo(date1)<=0){//当前时间d 小于等于规定时间date1
                        chuqin.setChuqinTypes(3);//设置为未打下班卡
                    }
                    chuqin.setCreateTime(d);
                    chuqin.setToday(date);
                    chuqin.setYonghuId(id);
                    chuqinService.insert(chuqin);
                }

            }else if("2".equals(flag)){
                //下班卡
                Date date1 = new Date();
                date1.setHours(19);
                date1.setMinutes(00);
                date1.setSeconds(0);
                Date date2 = new Date();
                date2.setHours(18);
                date2.setMinutes(00);
                date2.setSeconds(0);
                //下班打卡
                if(oldChuqinList!=null){//不是第一次打卡
                    //查询当前用户是否生成了上班打卡
                    Wrapper<ChuqinEntity> queryWrapper = new EntityWrapper<ChuqinEntity>().eq("yonghu_id",id).eq("today",date).orderDesc(s);
                    ChuqinEntity chuqinEntity = chuqinService.selectOne(queryWrapper);
                    if(chuqinEntity !=null){//生成了上班打卡
                        chuqinEntity.setDownTime(d);
                        if("6".equals(String.valueOf(chuqinEntity.getChuqinTypes()))){
                        }else if(d.compareTo(date1)>0){//当前时间d 大于规定时间   加班
                            int hours = d.getHours();
                            int i = hours - 19+1;
                            if(i>0){
                                chuqinEntity.setOvertimeNumber(i);
                            }
                            chuqinEntity.setChuqinTypes(5);//设置为迟到
                        }else if(d.compareTo(date2)<0){//当前时间d 小于等于规定时间 早退
                            chuqinEntity.setChuqinTypes(7);//设置为未打下班卡
                        }else{
                            chuqinEntity.setChuqinTypes(1);
                        }
                        chuqinService.updateById(chuqinEntity);
                    }else{
                        //当天上午没有生成上班打卡,要防止用户昨天及之前没有生成打卡记录
                        Wrapper<ChuqinEntity> queryWrapper1 = new EntityWrapper<ChuqinEntity>().eq("yonghu_id",id).orderDesc(s);
                        List<ChuqinEntity> list = chuqinService.selectList(queryWrapper1);
                        if(list != null && list.size()>0){
                            ChuqinEntity entity = list.get(0);
                            String today = entity.getToday();//获取出勤表最大出勤
                            Date todayTime = format1.parse(today);
                            Calendar calendar = new GregorianCalendar();
                            calendar.setTime(todayTime);
                            calendar.add(calendar.DATE,1);
                            String newToday = format1.format(calendar.getTime());
                            if(date.equals(today)){
                                //昨天id+1  等于今天的话  就是直接新增下午打卡
                                ChuqinEntity chuqin = new ChuqinEntity();
                                chuqin.setDownTime(d);
                                chuqin.setChuqinTypes(2);
                                chuqinService.insert(chuqin);
                            }else if(!date.equals(newToday)){//当天日期 不是出勤最大日期加一天的话   就是补充缺勤日期
                                chuqinList = this.getQueQin(d, format1, today, id);
                            }

                            if(chuqinList !=null && chuqinList.size() >0){
                                chuqinService.insertBatch(chuqinList);
                            }
                        }
                    }
                }else{
                    //第一次打卡
                    ChuqinEntity chuqin = new ChuqinEntity();
                    chuqin.setDownTime(d);
                    chuqin.setChuqinTypes(2);
                    chuqinService.insert(chuqin);
                }
            }else {
                return R.error(511,"未知错误");
            }
        } catch (ParseException e) {
            e.printStackTrace();
        }catch (Exception e) {
            e.printStackTrace();
        }
        return R.ok();
    }
//
//
//
// /**
//    * 后端保存
//    */
//    @RequestMapping("/save")
//    public R save(@RequestBody ChuqinEntity chuqin, HttpServletRequest request){
//        logger.debug("save方法:,,Controller:{},,chuqin:{}",this.getClass().getName(),chuqin.toString());
//        Wrapper<ChuqinEntity> queryWrapper = new EntityWrapper<ChuqinEntity>()
//            .eq("yonghu_id", chuqin.getYonghuId())
//            .eq("today", chuqin.getToday())
//            .eq("chuqin_types", chuqin.getChuqinTypes())
//            .eq("overtimeNumber", chuqin.getOvertimeNumber())
//            ;
//        logger.info("sql语句:"+queryWrapper.getSqlSegment());
//        ChuqinEntity chuqinEntity = chuqinService.selectOne(queryWrapper);
//        if(chuqinEntity==null){
//            chuqin.setCreateTime(new Date());
//        //  String role = String.valueOf(request.getSession().getAttribute("role"));
//        //  if("".equals(role)){
//        //      chuqin.set
//        //  }
//            chuqinService.insert(chuqin);
//            return R.ok();
//        }else {
//            return R.error(511,"表中有相同数据");
//        }
//    }
//
//    /**
//    * 修改
//    */
//    @RequestMapping("/update")
//    public R update(@RequestBody ChuqinEntity chuqin, HttpServletRequest request){
//        logger.debug("update方法:,,Controller:{},,chuqin:{}",this.getClass().getName(),chuqin.toString());
//        //根据字段查询是否有相同数据
//        Wrapper<ChuqinEntity> queryWrapper = new EntityWrapper<ChuqinEntity>()
//            .notIn("id",chuqin.getId())
//            .eq("yonghu_id", chuqin.getYonghuId())
//            .eq("today", chuqin.getToday())
//            .eq("chuqin_types", chuqin.getChuqinTypes())
//            .eq("overtimeNumber", chuqin.getOvertimeNumber())
//            ;
//        logger.info("sql语句:"+queryWrapper.getSqlSegment());
//        ChuqinEntity chuqinEntity = chuqinService.selectOne(queryWrapper);
//                chuqin.setOnTime(new Date());
//                chuqin.setDownTime(new Date());
//        if(chuqinEntity==null){
//            //  String role = String.valueOf(request.getSession().getAttribute("role"));
//            //  if("".equals(role)){
//            //      chuqin.set
//            //  }
//            chuqinService.updateById(chuqin);//根据id更新
//            return R.ok();
//        }else {
//            return R.error(511,"表中有相同数据");
//        }
//    }


    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        chuqinService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }

    /**
    *字典表数据转换
    */
    public void dictionaryConvert(ChuqinView chuqinView){
        //当前表的字典字段
        if(StringUtil.isNotEmpty(String.valueOf(chuqinView.getChuqinTypes()))){
            chuqinView.setChuqinValue(dictionaryMap.get("chuqin_types").get(chuqinView.getChuqinTypes()));
        }

        //级联表的字典字段
        if(StringUtil.isNotEmpty(String.valueOf(chuqinView.getZhiwuTypes()))){
            chuqinView.setZhiwuValue(dictionaryMap.get("zhiwu_types").get(chuqinView.getZhiwuTypes()));
        }
        if(StringUtil.isNotEmpty(String.valueOf(chuqinView.getZhichengTypes()))){
            chuqinView.setZhichengValue(dictionaryMap.get("zhicheng_types").get(chuqinView.getZhichengTypes()));
        }
        if(StringUtil.isNotEmpty(String.valueOf(chuqinView.getSexTypes()))){
            chuqinView.setSexValue(dictionaryMap.get("sex_types").get(chuqinView.getSexTypes()));
        }
        if(StringUtil.isNotEmpty(String.valueOf(chuqinView.getPoliticsTypes()))){
            chuqinView.setPoliticsValue(dictionaryMap.get("politics_types").get(chuqinView.getPoliticsTypes()));
        }
        if(StringUtil.isNotEmpty(String.valueOf(chuqinView.getMarriageTypes()))){
            chuqinView.setMarriageValue(dictionaryMap.get("marriage_types").get(chuqinView.getMarriageTypes()));
        }
        if(StringUtil.isNotEmpty(String.valueOf(chuqinView.getEducationTypes()))){
            chuqinView.setEducationValue(dictionaryMap.get("education_types").get(chuqinView.getEducationTypes()));
        }
    }


    /**
     *
     * @param d   当前日期
     * @param format1 "yyyy-MM-dd"
     * @param newToday 数据库存的最大打卡日期 加一天
     * @param id    打卡人id
     * @return
     * @throws ParseException
     */
    public static  List<ChuqinEntity> getQueQin(Date d,SimpleDateFormat format1,String newToday,Integer id) throws ParseException {
        List<ChuqinEntity> list = new ArrayList<>();
        // 返回的日期集合
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date start = dateFormat.parse(newToday);
        Calendar   calendar = new GregorianCalendar();
        calendar.setTime(d);
        calendar.add(calendar.DATE,-1); //当前时间减去一天,即一天前的时间
        Date end = dateFormat.parse(format1.format(calendar.getTime()));

        Calendar tempStart = Calendar.getInstance();
        tempStart.setTime(start);

        Calendar tempEnd = Calendar.getInstance();
        tempEnd.setTime(end);
        tempEnd.add(Calendar.DATE, +1);// 日期加1(包含结束)
        while (tempStart.before(tempEnd)) {
            ChuqinEntity chuqinEntity = new ChuqinEntity();
            chuqinEntity.setYonghuId(id);
            chuqinEntity.setToday(dateFormat.format(tempStart.getTime()));
            chuqinEntity.setCreateTime(d);
            chuqinEntity.setChuqinTypes(4);
            list.add(chuqinEntity);
            tempStart.add(Calendar.DAY_OF_YEAR, 1);
        }
        return list;
    }

}

package com.controller;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;

import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
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.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;

import com.entity.ShequyonghuEntity;
import com.entity.view.ShequyonghuView;

import com.service.ShequyonghuService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;


/**
 * 社区用户
 * 后端接口
 * @author 
 * @email 
 * @date 2021-02-27 15:35:54
 */
@RestController
@RequestMapping("/shequyonghu")
public class ShequyonghuController {
    @Autowired
    private ShequyonghuService shequyonghuService;
    
	@Autowired
	private TokenService tokenService;
	
	/**
	 * 登录
	 */
	@IgnoreAuth
	@RequestMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		ShequyonghuEntity user = shequyonghuService.selectOne(new EntityWrapper<ShequyonghuEntity>().eq("yonghuzhanghao", username));
		if(user==null || !user.getMima().equals(password)) {
			return R.error("账号或密码不正确");
		}
		String token = tokenService.generateToken(user.getId(), username,"shequyonghu",  "社区用户" );
		return R.ok().put("token", token);
	}
	
	/**
     * 注册
     */
	@IgnoreAuth
    @RequestMapping("/register")
    public R register(@RequestBody ShequyonghuEntity shequyonghu){
    	//ValidatorUtils.validateEntity(shequyonghu);
    	ShequyonghuEntity user = shequyonghuService.selectOne(new EntityWrapper<ShequyonghuEntity>().eq("yonghuzhanghao", shequyonghu.getYonghuzhanghao()));
		if(user!=null) {
			return R.error("注册用户已存在");
		}
		Long uId = new Date().getTime();
		shequyonghu.setId(uId);
        shequyonghuService.insert(shequyonghu);
        return R.ok();
    }
	
	/**
	 * 退出
	 */
	@RequestMapping("/logout")
	public R logout(HttpServletRequest request) {
		request.getSession().invalidate();
		return R.ok("退出成功");
	}
	
	/**
     * 获取用户的session用户信息
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
    	Long id = (Long)request.getSession().getAttribute("userId");
        ShequyonghuEntity user = shequyonghuService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * 密码重置
     */
    @IgnoreAuth
	@RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
    	ShequyonghuEntity user = shequyonghuService.selectOne(new EntityWrapper<ShequyonghuEntity>().eq("yonghuzhanghao", username));
    	if(user==null) {
    		return R.error("账号不存在");
    	}
        user.setMima("123456");
        shequyonghuService.updateById(user);
        return R.ok("密码已重置为:123456");
    }


    /**
     * 后端列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,ShequyonghuEntity shequyonghu, HttpServletRequest request){

        EntityWrapper<ShequyonghuEntity> ew = new EntityWrapper<ShequyonghuEntity>();
    	PageUtils page = shequyonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shequyonghu), params), params));
		request.setAttribute("data", page);
        return R.ok().put("data", page);
    }
    
    /**
     * 前端列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params,ShequyonghuEntity shequyonghu, HttpServletRequest request){
        EntityWrapper<ShequyonghuEntity> ew = new EntityWrapper<ShequyonghuEntity>();
    	PageUtils page = shequyonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shequyonghu), params), params));
		request.setAttribute("data", page);
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/lists")
    public R list( ShequyonghuEntity shequyonghu){
       	EntityWrapper<ShequyonghuEntity> ew = new EntityWrapper<ShequyonghuEntity>();
      	ew.allEq(MPUtil.allEQMapPre( shequyonghu, "shequyonghu")); 
        return R.ok().put("data", shequyonghuService.selectListView(ew));
    }

	 /**
     * 查询
     */
    @RequestMapping("/query")
    public R query(ShequyonghuEntity shequyonghu){
        EntityWrapper< ShequyonghuEntity> ew = new EntityWrapper< ShequyonghuEntity>();
 		ew.allEq(MPUtil.allEQMapPre( shequyonghu, "shequyonghu")); 
		ShequyonghuView shequyonghuView =  shequyonghuService.selectView(ew);
		return R.ok("查询社区用户成功").put("data", shequyonghuView);
    }
	
    /**
     * 后端详情
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        ShequyonghuEntity shequyonghu = shequyonghuService.selectById(id);
        return R.ok().put("data", shequyonghu);
    }

    /**
     * 前端详情
     */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id){
        ShequyonghuEntity shequyonghu = shequyonghuService.selectById(id);
        return R.ok().put("data", shequyonghu);
    }
    



    /**
     * 后端保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody ShequyonghuEntity shequyonghu, HttpServletRequest request){
    	shequyonghu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(shequyonghu);
    	ShequyonghuEntity user = shequyonghuService.selectOne(new EntityWrapper<ShequyonghuEntity>().eq("yonghuzhanghao", shequyonghu.getYonghuzhanghao()));
		if(user!=null) {
			return R.error("用户已存在");
		}

		shequyonghu.setId(new Date().getTime());
        shequyonghuService.insert(shequyonghu);
        return R.ok();
    }
    
    /**
     * 前端保存
     */
    @RequestMapping("/add")
    public R add(@RequestBody ShequyonghuEntity shequyonghu, HttpServletRequest request){
    	shequyonghu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(shequyonghu);
    	ShequyonghuEntity user = shequyonghuService.selectOne(new EntityWrapper<ShequyonghuEntity>().eq("yonghuzhanghao", shequyonghu.getYonghuzhanghao()));
		if(user!=null) {
			return R.error("用户已存在");
		}

		shequyonghu.setId(new Date().getTime());
        shequyonghuService.insert(shequyonghu);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody ShequyonghuEntity shequyonghu, HttpServletRequest request){
        //ValidatorUtils.validateEntity(shequyonghu);
        shequyonghuService.updateById(shequyonghu);//全部更新
        return R.ok();
    }
    

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        shequyonghuService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
    
    /**
     * 提醒接口
     */
	@RequestMapping("/remind/{columnName}/{type}")
	public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, 
						 @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
		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));
			}
		}
		
		Wrapper<ShequyonghuEntity> wrapper = new EntityWrapper<ShequyonghuEntity>();
		if(map.get("remindstart")!=null) {
			wrapper.ge(columnName, map.get("remindstart"));
		}
		if(map.get("remindend")!=null) {
			wrapper.le(columnName, map.get("remindend"));
		}


		int count = shequyonghuService.selectCount(wrapper);
		return R.ok().put("count", count);
	}
	
	


}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/888943.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

知了汇智与西南石油大学合作开展网络安全生产实习,培养实战型人才

近年来&#xff0c;随着互联网的快速发展和数字化转型的推进&#xff0c;网络安全问题日益突出。然而&#xff0c;网络安全应用型人才的供给却严重不足&#xff0c;导致行业面临着巨大的挑战和风险。面对这一现状&#xff0c;开展校企合作&#xff0c;培养优秀的网络安全行业人…

Talk | ICCV‘23 HumanMAC:简洁易拓展的人体动作预测新框架

​ 本期为TechBeat人工智能社区第522期线上Talk&#xff01; 北京时间8月16日(周三)20:00&#xff0c;清华大学博士生—陈凌灏的Talk已准时在TechBeat人工智能社区开播&#xff01; 他与大家分享的主题是: “HumanMAC-简洁易拓展的人体动作预测新框架”&#xff0c;介绍了人体动…

使用爱校对提升公文材料准确性的必要性

在我们的工作中&#xff0c;公文材料的准确性往往决定了我们的工作效果。无论是内部的报告、计划&#xff0c;还是外部的公告、通知&#xff0c;都需要准确无误才能达到我们预期的效果。为此&#xff0c;我们需要使用强大的工具——爱校对&#xff0c;来提升公文材料的准确性。…

Yii2 advanced 框架,自定义Log日志方案

背景 近期在使用 【Yii2 advanced】框架时 在接触到 微信支付回调操作时&#xff0c;想要将微信服务器请求的参数信息记录下来 但是&#xff0c;不喜欢框架自带的日志配置方式 在此&#xff0c;推荐使用一种自定义文件目录与log记录形式的方案 希望有此需求的道友&#xff0c;能…

IDEA下方工具栏SideBar没有Services解决方法 IDEA配合微服务学习多端口管理打开Services栏方法

问题 微服务学习时&#xff0c;一次要打开多个端口&#xff0c;比如8080给order模块、8081给user模块……这就需要用idea管理多端口。 这时候就可以用到Services栏进行管理。 解决 首先看下方Sidebar没有Services。 打开Services 打开方式一&#xff1a;手动打开 在IDEA中…

智能语音开放平台选哪家,启英泰伦提供硬件、软件一体化服务

离线智能语音产品方案的开发主要包含两个方面&#xff1a;硬件和软件。这里硬件是指采用语音芯片等电子元器件为该产品设计的电路板&#xff0c;软件是指基于电路板上主控芯片的种类及产品功能需求所开发的代码&#xff0c;再经过编译工具等生成可下载到主控芯片中的语音固件&a…

【云原生、k8s】Calico网络策略

第四阶段 时 间&#xff1a;2023年8月17日 参加人&#xff1a;全班人员 内 容&#xff1a; Calico网络策略 目录 一、前提配置 二、Calico网络策略基础 1、创建服务 2、启用网络隔离 3、测试网络隔离 4、允许通过网络策略进行访问 三、Calico网络策略进阶 1、创…

【RP2040】香瓜树莓派RP2040之搭建开发环境(windows)

本文最后修改时间&#xff1a;2022年08月23日 01:57 一、本节简介 本节以树莓派pico开发板为例&#xff0c;搭建windows下的编译环境。 二、实验平台 1、硬件平台 1&#xff09;树莓派pico开发板 ①树莓派pico开发板 ②micro usb数据线 2&#xff09;电脑 2、软件平台 …

绝对值函数的可导性

绝对值函数的可导性 声明&#xff1a;下面截图来自《考研数学常考题型解题方法技巧归纳》

无涯教程-Perl - syswrite函数

描述 此函数尝试将SCALAR中的LENGTH个字节写入与FILEHANDLE相关的文件。如果指定了OFFSET,则从提供的SCALAR中的OFFSET字节中读取信息。该函数使用C /操作系统的write()函数,该函数绕过普通缓冲。 语法 以下是此函数的简单语法- syswrite FILEHANDLE, SCALAR, LENGTH, OFFS…

[oneAPI] 手写数字识别-GAN

[oneAPI] 手写数字识别-GAN 手写数字识别参数与包加载数据模型训练过程结果 oneAPI 比赛&#xff1a;https://marketing.csdn.net/p/f3e44fbfe46c465f4d9d6c23e38e0517 Intel DevCloud for oneAPI&#xff1a;https://devcloud.intel.com/oneapi/get_started/aiAnalyticsToolki…

高德地图1.4.15楼层处理

前因&#xff1a; 接入了高德1.4.15JS API的项目中使用了mapStyle: ‘amap://styles/grey’,在这个模式下楼层几近透明&#xff0c;方案一是升级到2.0然后加wallColor &#xff08;表示建筑物墙面的颜色&#xff09;和roofColor &#xff08;表示建筑物屋顶的颜色&#xff09;…

机器学习与模型识别1:SVM(支持向量机)

一、简介 SVM是一种二类分类模型&#xff0c;在特征空间中寻找间隔最大的分离超平面&#xff0c;使得数据得到高效的二分类。 二、SVM损失函数 SVM 的三种损失函数衡量模型的性能。 1. 0-1 损失&#xff1a; 当正例样本落在 y0 下方则损失为 0&#xff0c;否则损失为…

uniapp小程序实现上传图片功能,并显示上传进度

效果图&#xff1a; 实现方法&#xff1a; 一、通过uni.chooseMedia(OBJECT)方法&#xff0c;拍摄或从手机相册中选择图片或视频。 官方文档链接: https://uniapp.dcloud.net.cn/api/media/video.html#choosemedia uni.chooseMedia({count: 9,mediaType: [image,video],so…

如何最大利用WhatsApp高效拓客引流?

对话式商务盛行&#xff0c;WhatsApp是许多国家最受欢迎的聊天应用程序&#xff0c;包括巴西、德国、印尼、泰国、新加坡等。用户渗透率超过80%&#xff0c;作为一个无敌社交APP&#xff0c;自然也是跨境业务的首选。 以下是使用 WhatsApp 进行电子商务时需要记住的一些策略。…

做好需求管理的四个最佳实践

改进您的需求管理过程可以对你的开发过程产生重大影响&#xff0c;所带来的益处包括&#xff1a;提高效率、缩短上市时间&#xff0c;以及节省宝贵的预算和资源。需求是最能向工程师说明要构建什么&#xff0c;以及向测试人员说明要测试什么的信息。 需求具有三个主要功能&…

数据结构——栈(C语言)

需求&#xff1a;无 栈的概念&#xff1a; 栈&#xff1a;一种特殊的线性表&#xff0c;其只允许在固定的一端进行插入和删除元素操作。进行数据插入和删除操作的一端称为栈顶&#xff0c;另一端为栈底。栈中的数据元素遵守后进先出&#xff08;LIFO&#xff09;原则。压栈&…

FPGA应用学习笔记-----布线布局优化

优化约束&#xff1a; 设置到最坏情况下会过多 布局和布线之间的关系&#xff1a; 最重要的是与处理器努力的&#xff0c;挂钩允许设计者调整处理器努力的程度 逻辑复制&#xff1a; 不能放置多个负载&#xff0c;只使用在关键路径钟 减少布线延时&#xff0c;但会增加面积&a…

大规模SFT微调指令数据的生成

前言 想要微调一个大模型&#xff0c;前提是得有一份高质量的SFT数据&#xff0c;可以这么说其多么高质量都不过分&#xff0c;关于其重要性已经有很多工作得以验证&#xff0c;感兴趣的小伙伴可以穿梭笔者之前的一篇文章&#xff1a; 《大模型时代下数据的重要性》&#xff…

【AI】百度AI助力开发,测试一下百度搜索的AI能力如何

百度搜索页面有个AI对话&#xff0c;点击进去看看&#xff1a; 是不是文心一言&#xff1f;它说不是。 测试一下辅助写代码功能&#xff1a; 1、写个爬虫&#xff1a; 代码&#xff1a; import requests from bs4 import BeautifulSoup# 目标网站的URL url "http:/…