From 83c795e9d040110973df19a9a3d953518d27b35d Mon Sep 17 00:00:00 2001
From: Administrator <2863138610@qq.com>
Date: 星期三, 16 十一月 2022 09:52:44 +0800
Subject: [PATCH] 资源管理修改
---
src/main/java/com/qxueyou/scc/admin/schoolRoll/impl/SchoolRollServiceImpl.java | 100 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 98 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/qxueyou/scc/admin/schoolRoll/impl/SchoolRollServiceImpl.java b/src/main/java/com/qxueyou/scc/admin/schoolRoll/impl/SchoolRollServiceImpl.java
index 2c4c408..50c9114 100644
--- a/src/main/java/com/qxueyou/scc/admin/schoolRoll/impl/SchoolRollServiceImpl.java
+++ b/src/main/java/com/qxueyou/scc/admin/schoolRoll/impl/SchoolRollServiceImpl.java
@@ -1,24 +1,33 @@
package com.qxueyou.scc.admin.schoolRoll.impl;
import com.qxueyou.scc.admin.schoolRoll.ISchoolRollService;
+import com.qxueyou.scc.base.model.ExcelExportParam;
import com.qxueyou.scc.base.model.Pager;
+import com.qxueyou.scc.base.model.Result;
import com.qxueyou.scc.base.service.impl.CommonAppService;
import com.qxueyou.scc.base.util.ClientUtils;
import com.qxueyou.scc.base.util.CollectionUtils;
+import com.qxueyou.scc.base.util.ExcelExportUtils;
import com.qxueyou.scc.teach.student.model.StuStudent;
+import com.qxueyou.scc.user.model.UserRegistration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
import java.util.List;
@Service
public class SchoolRollServiceImpl extends CommonAppService implements ISchoolRollService {
- @Autowired
- CommonAppService commonAppService;
+
@Override
public List<StuStudent> findSchoolRollList(Integer limit, Integer pageNum, String keyword, String status) {
+
StringBuffer hql=new StringBuffer("from StuStudent where name like ? and status=? and deleteFlag is false");
List<Object> args = CollectionUtils.newList(keyword + "%", status);
@@ -38,4 +47,91 @@
return findCount(hql.toString(),args);
}
+
+ @Override
+ public String updateSchool(String StudentId, String ClassId) {
+ StringBuffer hql=new StringBuffer("from StuStudent where studentId=? and deleteFlag is false");
+
+ List<Object> args = CollectionUtils.newList(StudentId);
+
+ StuStudent stuStudent = findUnique(hql.toString(), args, StuStudent.class);
+
+ if(stuStudent!=null && ClassId!=null){
+ stuStudent.setClassId(ClassId);
+ save(stuStudent);
+ return "true";
+ }
+
+ return "false";
+ }
+
+ @Override
+ public void deriveStudentMessage() {
+ StringBuffer hql=new StringBuffer("from StuStudent where status=? and deleteFlag is false");
+
+ List<Object> args = CollectionUtils.newList("active");
+
+ List<StuStudent> stuStudents = find(hql.toString(), args, StuStudent.class);
+
+ ExcelExportUtils<StuStudent> ex = new ExcelExportUtils<StuStudent>();
+ String[] headers = { "姓名", "性别" ,"手机号" ,"身份证"};
+ List<StuStudent> dataset = new ArrayList<StuStudent>();
+ for (StuStudent stuStudent:
+ stuStudents) {
+ StuStudent u = new StuStudent();
+ u.setName(stuStudent.getName());
+ u.setSex(stuStudent.getSex());
+ u.setMobilePhone(stuStudent.getMobilePhone());
+ u.setStudentNo(stuStudent.getStudentNo());
+ dataset.add(u);
+ }
+
+ ExcelExportParam<StuStudent> obj = new ExcelExportParam<StuStudent>();
+ obj.setColData(dataset);
+ obj.setHeaders(headers);
+
+ try {
+ OutputStream out = new FileOutputStream("D://Student.xls");
+ obj.setOut(out);
+ ex.exportExcel(obj);
+ out.close();
+ System.out.println("excel导出成功!");
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ try {
+ OutputStream out = new FileOutputStream("D://Student.xls");
+ List<String> lst = new ArrayList<String>();
+ lst.add("className");
+ lst.add("userName");
+ obj.setLstColumn(lst);
+ obj.setOut(out);
+ ex.exportExcelByColomn(obj);
+ out.close();
+ System.out.println("excel指定列导出成功!");
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public Boolean auditStudent(String Student) {
+ StringBuffer hql=new StringBuffer("from StuStudent where studentId=? and deleteFlag is false");
+
+ List<Object> arg = CollectionUtils.newList(Student);
+
+ StuStudent stuStudent = findUnique(hql.toString(), arg, StuStudent.class);
+
+ stuStudent.setStatus(StuStudent.STATUS_ACTIVE);
+
+ Result save = save(stuStudent);
+
+ return save.isSuccess();
+ }
+
}
--
Gitblit v1.8.0