智慧保安后台管理-外网项目备份
Administrator
2021-12-10 b9e7b481df7a89346a564d5c10d534745903d156
1.考试名单确认
2.保安单位查询修改
7 files modified
1 files added
157 ■■■■■ changed files
src/main/java/org/springblade/common/utils/TimeSwitchUtil.java 77 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/controller/ExamPaperController.java 19 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/entity/ExamPaper.java 14 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.xml 7 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/service/impl/ExamPaperServiceImpl.java 17 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/vo/ExamPaperVO.java 10 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml 8 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/vo/InformationVO.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/common/utils/TimeSwitchUtil.java
New file
@@ -0,0 +1,77 @@
package org.springblade.common.utils;
import bsh.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
 * 时间装换
 * @author zhongrj
 */
public class TimeSwitchUtil {
    public static void main(String[] args) {
        String time1 = secondToTime(85959);
        String time2 = dateToTime("2017/10/25 16:42:46", "yyyy/MM/dd HH:mm:ss");
        System.out.println(time1);
        System.out.println(time2);
    }
    /**
     * 将秒数转换为日时分秒,
     * @param second
     * @return
     */
    public static String secondToTime(long second){
        //转换天数
        long days = second / 86400000;
        //剩余秒数
        second = second % 86400000;
        //转换小时
        long hours = second / 3600000;
        //剩余秒数
        second = second % 3600000;
        //转换分钟
        long minutes = second /60000;
        //剩余秒数
        second = second % 60000;
        //装换秒
        long s = second /1000;
        if(days>0){
            return days + "天" + hours + "小时" + minutes + "分" + s + "秒";
        }else{
            return hours + "小时" + minutes + "分" + s + "秒";
        }
    }
    /**
     * 将日期转换为日时分秒
     * @param date
     * @return
     */
    public static String dateToTime(String date, String dateStyle){
        SimpleDateFormat format = new SimpleDateFormat(dateStyle);
        Date oldDate = null;
        try {
            oldDate = format.parse(date);
        } catch (java.text.ParseException e) {
            e.printStackTrace();
        }
        //输入日期转换为毫秒数
        long time = oldDate.getTime();
        long nowTime = System.currentTimeMillis();        //当前时间毫秒数
        long second = nowTime - time;                    //二者相差多少毫秒
        second = second / 1000;                            //毫秒转换为妙
        long days = second / 86400;
        second = second % 86400;
        long hours = second / 3600;
        second = second % 3600;
        long minutes = second /60;
        second = second % 60;
        if(days>0){
            return days + "天" + hours + "小时" + minutes + "分" + second + "秒";
        }else{
            return hours + "小时" + minutes + "分" + second + "秒";
        }
    }
}
src/main/java/org/springblade/modules/exam/controller/ExamPaperController.java
@@ -248,6 +248,25 @@
        return R.data(examPaperService.getExamDetail(userId));
    }
    /**
     * 考试名单确认
     * @param
     * @return
     */
    @PostMapping("/applyConfirm")
    public R applyConfirm(@RequestBody ExamPaper exam) {
        exam.setConfirmTime(new Date());
        boolean status = examPaperService.updateById(exam);
        //内网数据同步
        String s1 =
            "update ksxt_exam set confirm_user = " + "'" + exam.getConfirmUser()+ "'"
                + ",confirm_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(exam.getConfirmTime())+ "'"
                + " " +"where id = " + "'" + exam.getId() + "'";
        FtpUtil.sqlFileUpload(s1);
        //返回数据
        return R.data(status);
    }
    /**
     * 审核修改
src/main/java/org/springblade/modules/exam/entity/ExamPaper.java
@@ -129,5 +129,19 @@
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date auditTime;
    /**
     * 考试人员确认确认人
     */
    @TableField("confirm_user")
    private String confirmUser;
    /**
     * 确认时间
     */
    @TableField("confirm_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date confirmTime;
}
src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.xml
@@ -103,7 +103,8 @@
        SELECT
            ke.*,
            bu.real_name realName,
            bd.dept_name deptName
            bd.dept_name deptName,
            bu1.real_name confirmUserName
        FROM
            ksxt_exam ke
        left join
@@ -114,6 +115,10 @@
            blade_dept bd
        on
            bd.id = bu.dept_id
        left join
            blade_user bu1
        on
            ke.confirm_user = bu1.id
        where
        1=1
        <if test="paper.examType!=null and paper.examType!=''">
src/main/java/org/springblade/modules/exam/service/impl/ExamPaperServiceImpl.java
@@ -18,6 +18,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.common.utils.TimeSwitchUtil;
import org.springblade.core.mp.support.Condition;
import org.springblade.modules.apply.entity.Apply;
import org.springblade.modules.exam.entity.*;
@@ -32,6 +33,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@@ -81,6 +83,21 @@
            if (examPaperVO1.getExamType()==2) {
                examPaperVO1.setNum(baseMapper.getTrainNumber(examPaperVO1));
                examPaperVO1.setExamNum(baseMapper.getExamNumber(examPaperVO1));
                //计算截止时间
                long nowTime = System.currentTimeMillis();
                long examStartTime = examPaperVO1.getStartTime().getTime();
                long examEndTime = examPaperVO1.getEndTime().getTime();
                //判断时间
                if (nowTime-examEndTime>0){
                    //剩余时间大于1天
                    examPaperVO1.setDeadline("考试已结束");
                }else if(nowTime-examStartTime>=0 && nowTime-examEndTime<=0){
                    //已到考试时间
                    examPaperVO1.setDeadline("已到考试时间");
                }else {
                    long time = examStartTime - nowTime;
                    examPaperVO1.setDeadline(TimeSwitchUtil.secondToTime(time));
                }
            }
        });
        return examPaperVOIPage;
src/main/java/org/springblade/modules/exam/vo/ExamPaperVO.java
@@ -61,4 +61,14 @@
     * 考试人数
     */
    private Integer examNum;
    /**
     * 确认人员姓名
     */
    private String confirmUserName;
    /**
     * 计算截止时间
     */
    private String deadline;
}
src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
@@ -101,6 +101,10 @@
        blade_dept bd
        on
        bd.id = i.departmentid
        left join
        blade_user bu
        on
        bu.id = i.create_user_id
        where 1=1
        <if test="information.jurisdiction!=null and information.jurisdiction!='' and information.jurisdiction!='1372091709474910209'">
            and (sj.id=#{information.jurisdiction} or sj.parent_id=#{information.jurisdiction})
@@ -117,6 +121,10 @@
        <if test="information.departmentid!=null and information.departmentid!=''">
            and i.departmentid=#{information.departmentid}
        </if>
        <if test="information.createDeptId!=null and information.createDeptId!=''">
            and bu.dept_id =#{information.createDeptId}
        </if>
        order by i.id desc
    </select>
    <delete id="deleteIn">
src/main/java/org/springblade/modules/information/vo/InformationVO.java
@@ -42,6 +42,11 @@
    private String cnum;
    private String pnum;
    /**
     * 创建人部门id
     */
    private String createDeptId;
}