|
@@ -1,10 +1,15 @@
|
|
|
package com.ruoyi.system.service.impl;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
import com.ruoyi.common.utils.ClassUtils;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
+import com.ruoyi.common.utils.SecurityUtils;
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.system.domain.StudentInfoOld;
|
|
|
import com.ruoyi.system.domain.StudentLiveOld;
|
|
|
import com.ruoyi.system.domain.StudentMindOld;
|
|
@@ -57,6 +62,15 @@ public class StudentInfoServiceImpl implements IStudentInfoService
|
|
|
@Override
|
|
|
public List<StudentInfo> selectStudentInfoList(StudentInfo studentInfo)
|
|
|
{
|
|
|
+ SysUser user = SecurityUtils.getLoginUser().getUser();
|
|
|
+ Map<String, Object> params = studentInfo.getParams();
|
|
|
+ String role = "";
|
|
|
+ if (params != null && params.size() > 0) {
|
|
|
+ role = (String) params.get("role");
|
|
|
+ }
|
|
|
+ if("parents".equals(role)){
|
|
|
+ studentInfo.setParentsId(user.getUserId());
|
|
|
+ }
|
|
|
return studentInfoMapper.selectStudentInfoList(studentInfo);
|
|
|
}
|
|
|
|
|
@@ -75,7 +89,7 @@ public class StudentInfoServiceImpl implements IStudentInfoService
|
|
|
student.setStudentId(studentInfo.getStudentId());
|
|
|
List<StudentInfo> studentInfos = studentInfoMapper.selectStudentInfoList(student);
|
|
|
if(studentInfos!=null && studentInfos.size()>0){
|
|
|
- return AjaxResult.error("参数错误");
|
|
|
+ return AjaxResult.error("该学生已存在,请勿重复添加");
|
|
|
}
|
|
|
studentInfo.setCreateTime(DateUtils.getNowDate());
|
|
|
//新增 心理健康
|
|
@@ -91,6 +105,8 @@ public class StudentInfoServiceImpl implements IStudentInfoService
|
|
|
studentLiveOld.setCreateTime(DateUtils.getNowDate());
|
|
|
studentLiveOld.setUpdateTime(DateUtils.getNowDate());
|
|
|
studentLiveOldMapper.insertStudentLiveOld(studentLiveOld);
|
|
|
+
|
|
|
+ studentInfoMapper.deleteStudentInfoById(studentInfo.getId());
|
|
|
int rows = studentInfoMapper.insertStudentInfo(studentInfo);
|
|
|
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
|
|
|
|
@@ -141,4 +157,48 @@ public class StudentInfoServiceImpl implements IStudentInfoService
|
|
|
{
|
|
|
return studentInfoMapper.deleteStudentInfoById(id);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult statistics(StudentInfo studentInfo) {
|
|
|
+
|
|
|
+ if(StringUtils.isEmpty(studentInfo.getClassId())){
|
|
|
+ return AjaxResult.error("请选择班级");
|
|
|
+ }
|
|
|
+ int zs = 0;
|
|
|
+ int nan = 0;
|
|
|
+ int nv = 0;
|
|
|
+ int js = 0;
|
|
|
+ int ls = 0;
|
|
|
+ int pk = 0;
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ List<StudentInfo> studentInfoList = studentInfoMapper.selectStudentInfoList(studentInfo);
|
|
|
+ if(studentInfoList!=null && studentInfoList.size()>0){
|
|
|
+ for (StudentInfo info : studentInfoList) {
|
|
|
+ zs++;
|
|
|
+ if(StringUtils.isNotEmpty(info.getSex()) && info.getSex().equals("1")){
|
|
|
+ nan++;
|
|
|
+ }else{
|
|
|
+ nv++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(info.getIsNearsightedness()) && info.getIsNearsightedness().equals("1")){
|
|
|
+ js++;
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(info.getIsLset()) && info.getIsLset().equals("1")){
|
|
|
+ ls++;
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(info.getIsPoverty()) && info.getIsPoverty().equals("1")){
|
|
|
+ pk++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ map.put("zs",zs);
|
|
|
+ map.put("nan",nan);
|
|
|
+ map.put("nv",nv);
|
|
|
+ map.put("js",js);
|
|
|
+ map.put("ls",ls);
|
|
|
+ map.put("pk",pk);
|
|
|
+
|
|
|
+ return AjaxResult.success("成功",map);
|
|
|
+ }
|
|
|
}
|