Merge remote-tracking branch 'origin/master'

master
river 4 years ago
commit a68287bcb7
  1. 6
      src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java
  2. 4
      src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java
  3. 4
      src/main/java/com/yipin/liuwanr/service/ExperimentallearningService.java
  4. 52
      src/test/java/com/yipin/liuwanr/Mian.java

@ -103,9 +103,9 @@ public interface ExperimentalClassMapper {
* 学生签到次数
* @return
*/
@Select("select COUNT(a.experimentId) from attendance a,hr_project_management p,hr_course_tc tc where p.projectId=tc.projectId and p.projectId=a.experimentId and a.courseId=tc.courseId \n" +
"and p.isdel=0 and p.projectPermissions=0 and p.isAttendance=0 and tc.courseId=#{courseId} and a.studentId=#{studentId}")
Integer getAttendance(@Param("studentId")Integer studentId,@Param("courseId")Integer courseId);
@Select("select count(a.id) from attendance a left join teacher_project tp on (a.experimentalClassId=tp.experimentalClassId and a.experimentId=tp.projectId) " +
" where a.studentId=#{studentId} and a.experimentalClassId=#{experimentalClassId} and tp.courseId=#{courseId} and tp.isAttendance=1")
Integer getAttendance(@Param("studentId")Integer studentId,@Param("courseId")Integer courseId,@Param("experimentalClassId") Integer experimentalClassId);
/**

@ -157,13 +157,13 @@ public class ExperimentalClassService {
Integer experimentalClassId = Integer.parseInt(student.getExperimentalClassId());
//学生信息
List<Student> students = experimentalClassMapper.getExperimentalClassDetails(student);
//考勤数量
//考勤总数量数量
List<Project_Management> project = projectAndCourseMapper.getBySystemId(courseId, experimentalClassId);
int denominator = project.size();
for (int i = 0; i < students.size(); i++) {
Student stu = students.get(i);
Integer studentId = stu.getStudentId();
int molecule = experimentalClassMapper.getAttendance(studentId, courseId);
int molecule = experimentalClassMapper.getAttendance(studentId, courseId,experimentalClassId);
stu.setAttendance(molecule + "/" + denominator);
}
resp.put("retvalue", students);

@ -77,6 +77,10 @@ public class ExperimentallearningService {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
Attendance attendance2 = mapper.getByProjectIdAndStudentId(attendance);
Integer courseId = attendance.getCourseId();
Integer studentId = attendance.getStudentId();
Integer experimentalClassId=mapper.queryExperimentalClassId(courseId,studentId);
attendance.setExperimentalClassId(experimentalClassId);
if (null != attendance2 && attendance2.getSignIn() == 1) {
// 修改考勤状态
attendance2.setSignIn(attendance.getSignIn());

@ -0,0 +1,52 @@
package com.yipin.liuwanr;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Mian {
public static void main(String[] args) {
//将字符串与正式表达式进行匹配
//start()返回匹配到的子字符串在字符串中的索引位置.
//end()返回匹配到的子字符串的最后一个字符在字符串中的索引位置.
//group()返回匹配到的子字符串
String[] arg = {"5"};//前端【输入框输入的数据】
//【代码】
String str="i = input(\"请输入\")\n" +
"b = input(\"请输入\")";
StringBuilder builder = new StringBuilder(str);
String regex = "input\\((.*?)\\)";
Pattern pattern = Pattern.compile(regex);
Matcher m = pattern.matcher(builder);
int j = 0;
while (m.find()) {
if(j<arg.length){
int start = m.start();
int end = m.end();
String str2 = m.group();
String result=null;
if(str2.contains("'")){
result="'"+arg[j]+"'";
}else if(str2.contains("\"")){
result="\""+arg[j]+"\"";
}
if(!StringUtils.isEmpty(result)){
builder.replace(start,end,result);
}
m = pattern.matcher(builder);
j++;
}else{
break;
}
}
System.out.println(builder.toString());
}
}
Loading…
Cancel
Save