package com.gang.service.impl;
import com.gang.dao.ClassMapper;
import com.gang.dao.SCRealationMapper;
import com.gang.pojo.Class;
import com.gang.pojo.SCRealation;
import com.gang.service.ISCRealationService;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.InputSourceEditor;
import org.springframework.stereotype.Service;
import javax.print.attribute.standard.Sides;
import javax.servlet.http.HttpServletRequest;
/**
* Created by 吕港 on 2017/11/10.
*/
@Service("ISCRealationService")
public class SCRealationServiceImpl implements ISCRealationService {
@Autowired
private SCRealationMapper scRealation;
@Autowired
private ClassMapper classes;
@Override
public JSONArray findClassByStuId(int id) {
List<Class> classes=scRealation.selectByStuId(id);
JSONArray judge=new JSONArray(classes);
return judge;
}
@Override
public JSONArray findStudentsByClaId(int CId,int TId) {
List<SCRealation> students=scRealation.selectByClaId(CId,TId);
JSONArray judge=new JSONArray(students);
return judge;
}
@Override
public JSONObject findBaseAll(HttpServletRequest request) {
JSONObject judge;
int CId=Integer.parseInt(request.getParameter("CId"));
int SId=Integer.parseInt(request.getParameter("SId"));
int SignCount=Integer.parseInt(request.getParameter("countSign"));
SCRealation scRealation1=scRealation.selectBaseAll(CId,SId,SignCount);
if(scRealation1==null){
String msg="{'state':0}";
judge=new JSONObject(msg);
}else {
judge=new JSONObject(scRealation1);
}
return judge;
}
@Override
public JSONObject findBaseOverAll(HttpServletRequest request) {
JSONObject judge;
int CId=Integer.parseInt(request.getParameter("CId"));
int SId=Integer.parseInt(request.getParameter("SId"));
int SignCount=Integer.parseInt(request.getParameter("countSign"));
SCRealation scRealation1=scRealation.selectBaseAll(CId,SId,SignCount);
if(scRealation1.getIfSign() == null){
String msg="{'state':2}";
judge=new JSONObject(msg);
}else if(scRealation1==null || scRealation1.getIfSign()<1){
String msg="{'state':0}";
judge=new JSONObject(msg);
}else if(scRealation1.getOversignlocation()==null || scRealation1.getOversignlocation().trim().equals("")){
String msg="{'state':1}";
judge=new JSONObject(msg);
}else{
judge=new JSONObject(scRealation1);
}
return judge;
}
@Override
public JSONObject insertSCR(HttpServletRequest request) {
int CId=Integer.parseInt(request.getParameter("CId"));
int SId= Integer.parseInt(request.getParameter("SId"));
int countSign=Integer.parseInt(request.getParameter("countSign"));
String signLocation=request.getParameter("signLocation");
String currentTime=request.getParameter("currentTime");
Long current=Long.parseLong(currentTime);
Long attendTime = null;
Class aclass=classes.selectClassByCId(CId);
String classAttendTime=aclass.getAttendtime();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = null;
try {
date = format.parse(classAttendTime);
attendTime=Long.parseLong(String.valueOf(date.getTime()));
} catch (ParseException e) {
e.printStackTrace();
}
Long diffTime=(current-attendTime)/1000;
SCRealation scRealation1=new SCRealation(SId,CId,"1","1",signLocation,countSign);
SCRealation scRealation2=scRealation.selectBaseAll(CId,SId,countSign);
String msg="";
if(diffTime>7200){
msg="{'status':0}";
}else{
if(scRealation2==null){
scRealation.insertSelective(scRealation1);
msg="{'status':1,'msg':"+'"'+"同学,成功定位到你现在的位置了哦!快去继续完成上课签到吧!"+'"'+'}';
}else{
scRealation.updateByCSSignCount(scRealation1);
msg="{'status':1,'msg':"+'"'+"同学,成功修改你这次上课的定位位置了哦!快去继续完成上课签到吧!"+'"'+'}';
}
}
JSONObject judge=new JSONObject(msg);
return judge;
}
@Override
public JSONObject insertOverSCR(HttpServletRequest request) {
int CId=Integer.parseInt(request.getParameter("CId"));
int SId= Integer.parseInt(request.getParameter("SId"));
int countSign=Integer.parseInt(request.getParameter("countSign"));
String OverSignLocation=request.getParameter("OverSignLocation");
String currentTime=request.getParameter("currentTime");
Long current=Long.parseLong(currentTime);
Long overTime = null;
Class aclass=classes.selectClassByCId(CId);
String classOttendTime=aclass.getOvertime();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = null;
try {
date = format.parse(classOttendTime);
overTime=Long.parseLong(String.valueOf(date.getTime()));
} catch (ParseException e) {
e.printStackTrace();
}
Long diffTime=(current-overTime)/1000;
SCRealation scRealation1=new SCRealation(SId,CId,"1","1",countSign,OverSignLocation);
SCRealation scRealation2=scRealation.selectBaseAll(CId,SId,countSign);
String msg=null;
String a=scRealation2.getOversignlocation();
if(diffTime>7200){
msg="{'status':0}";
}else{
if(scRealation2==null){
msg="{'status':1,'msg':"+'"'+"同学,你还没有完成上课签到吧!"+'"'+'}';
}else if(a==null || a.trim().equals("")){
scRealation.updateByCSSignCount(scRealation1);
msg="{'status':1,'msg':"+'"'+"同学,成功定位到你现在的位置了哦!快去继续完成下课签到吧!"+'"'+'}';
}else{
scRealation.updateByCSSignCount(scRealation1);
msg="{'status':1,'msg':"+'"'+"同学,成功修改你这次上课的定位位置了哦!快去继续完成下课签到吧!"+'"'+'}';
}
}
JSONObject judge=new JSONObject(msg);
return judge;
}
@Override
public JSONObject updateSCR(HttpServletRequest request) {
int SId= Integer.parseInt(request.getParameter("SId"));
int CId=Integer.parseInt(request.getParameter("CId"));
int countSign=Integer.parseInt(request.getParameter("countSign"));
int SignState=Integer.parseInt(request.getParameter("SignState"));
int IfSign=Integer.parseInt(request.getParameter("IfSign"));
String ifAttend=request.getParameter("ifAttend");
String msg=null;
SCRealation scRealation1=new SCRealation(SId,CId,"1",countSign,SignState,IfSign);
SCRealation scRealation2=scRealation.selectBaseAll(CId,SId,countSign);
if(ifAttend.equals("true")){
if(scRealation2.getIfSign()==null){
scRealation.updateByCSSignCount(scRealation1);
if(SignState==3){
msg="{'msg':'同学,你迟到了,下次来早点上课吧!耐心等到下课再来签到吧!'}";
}else{
msg="{'msg':'同学,你按时来上课了哦!继续加油哦!耐心等到下课再来签到吧!'}";
}
}else if(scRealation2.getIfSign()>=1){
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
教育部认可的大学生竞赛备赛资料代码,源码,竞赛总结,所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通 计算机设计大赛、全国电子设计大赛、全国大学生智能汽车竞赛、蓝桥杯、集成电路创新创业大赛、光电设计竞赛、挑战杯、大创项目、互联网+、三创赛、计算机设计竞赛、创新创业大赛、ACM-ICPC国际大学生程序设计竞赛、全国大学生数学建模竞赛、全国大学生电子商务“创新、创意及创业”挑战赛、全国大学生节能减排社会实践与科技竞赛、全国大学生工程训练综合能力竞赛、全国大学生机器人大赛-RoboMaster、RoboCon、“西门子杯”中国智能制造挑战赛、中国大学生计算机设计大赛、世界技能大赛、中国高校计算机大赛-大数据挑战赛、团体程序设计天梯赛、移动应用创新赛、网络技术挑战赛、全国大学生信息安全竞赛、“中国软件杯”大学生软件设计大赛、全国大学生光电设计竞赛、中国机器人及人工智能大赛、“大唐杯”全国大学生移动通信5G技术大赛、华为ICT大赛、全国大学生嵌入式芯片与系统设计竞赛、中国高校智能机器人创意大赛
资源推荐
资源详情
资源评论
收起资源包目录
竞赛资料源码-计算机设计大赛faceSchool项目.zip (723个子文件)
SCRealationServiceImpl.class 9KB
SCRealationServiceImpl.class 9KB
mkDirAndPicture.class 8KB
mkDirAndPicture.class 8KB
TeacherController.class 7KB
TeacherController.class 7KB
StudentController.class 7KB
StudentController.class 7KB
ClassServiceImpl.class 7KB
ClassServiceImpl.class 7KB
Clawer.class 7KB
Clawer.class 7KB
StudentServiceImpl.class 7KB
StudentServiceImpl.class 7KB
TeacherServiceImpl.class 7KB
TeacherServiceImpl.class 7KB
AdministratorServiceImpl.class 6KB
AdministratorServiceImpl.class 6KB
Main_ex.class 6KB
Main_ex.class 6KB
CommentController.class 6KB
CommentController.class 6KB
StuClaController.class 5KB
StuClaController.class 5KB
AdministratorController.class 5KB
AdministratorController.class 5KB
CommentServiceImpl.class 5KB
CommentServiceImpl.class 5KB
Teacher.class 5KB
Teacher.class 5KB
SCRealation.class 5KB
SCRealation.class 5KB
Class.class 5KB
Class.class 5KB
StuClaServiceImpl.class 4KB
StuClaServiceImpl.class 4KB
Comment.class 4KB
Comment.class 4KB
sendEmail.class 4KB
sendEmail.class 4KB
Student.class 4KB
Student.class 4KB
ClassController.class 4KB
ClassController.class 4KB
mkPictureUrl.class 4KB
mkPictureUrl.class 4KB
ServerResponse.class 4KB
ServerResponse.class 4KB
StuCla.class 3KB
StuCla.class 3KB
SCRealationController.class 3KB
SCRealationController.class 3KB
Administrator.class 3KB
Administrator.class 3KB
StudentsDetail.class 3KB
StudentsDetail.class 3KB
superAdministratorFilter.class 3KB
superAdministratorFilter.class 3KB
administratorFilter.class 3KB
administratorFilter.class 3KB
teacherFilter.class 3KB
studentFilter.class 3KB
teacherFilter.class 3KB
studentFilter.class 3KB
Main.class 2KB
Main.class 2KB
Course.class 2KB
Course.class 2KB
ExcelWrite.class 2KB
ExcelWrite.class 2KB
Course.class 2KB
Course.class 2KB
tengxunFace.class 2KB
tengxunFace.class 2KB
Connector.class 2KB
Connector.class 2KB
ResponseCode.class 1KB
ResponseCode.class 1KB
test.class 1KB
test.class 1KB
StuClaMapper.class 988B
StuClaMapper.class 988B
IStudentService.class 948B
IStudentService.class 948B
TeacherMapper.class 941B
TeacherMapper.class 941B
Student.class 923B
Student.class 923B
Status.class 904B
Status.class 904B
ITeacherService.class 732B
ITeacherService.class 732B
sendEmail$1.class 725B
sendEmail$1.class 725B
SCRealationMapper.class 724B
SCRealationMapper.class 724B
ClassMapper.class 722B
ClassMapper.class 722B
IClassService.class 672B
IClassService.class 672B
共 723 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
妄北y
- 粉丝: 1w+
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 毕业设计基于Python卷积神经网络CNN的图像分类系统源码+模型+说明文档+全部数据资料.zip
- matlab 基于SVM的手写字体识别源代码+详细教程
- 课程管理平台 JAVA+Vue.js+SpringBoot+MySQL
- 毕业设计 基于Python卷积神经网络CNN的图像分类系统源码+模型+说明文档+全部数据资料.zip
- matlab 基于SVM的图像分割-真彩色图像分割源代码+详细教程
- go-admin框架vue权限字符-全网最透彻讲解
- matlab 基于SVM的信息粒化时序回归预测-上证指数开盘指数变化趋势和变化空间预测源代码+详细教程
- OBS多平台推流支持插件
- matlab 基于SVM的回归预测分析-上证指数开盘指数预测源代码+详细教程
- comfyui的BrushNet电商公司和摄影公司都在用的AI工作流
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功