夏文涛 1 рік тому
батько
коміт
93b3de242d

+ 4 - 0
src/main/java/com/template/api/LoginControllerAPI.java

@@ -35,4 +35,8 @@ public interface LoginControllerAPI {
     @PostMapping(value = "/mobileLogin")
     @ApiOperation(value = "移动端登录", notes = "移动端登录", httpMethod = "POST")
     CommonResult mobileLogin(@Validated @RequestBody mobileLoginRequest mlr, BindingResult bindingResult);
+
+    @GetMapping(value = "/writeCarInfo")
+    @ApiOperation(value = "写入车闸", notes = "写入车闸", httpMethod = "GetMapping")
+    CommonResult writeCarInfo();
 }

+ 24 - 0
src/main/java/com/template/api/WelcomeStudentControllerAPI.java

@@ -3,12 +3,18 @@ package com.template.api;
 import com.template.model.request.InfoCollectionRequest;
 import com.template.model.request.InsertStudentRequest;
 import com.template.model.request.RegisterRequest;
+import com.template.model.request.updateStudentRequest;
 import com.template.model.result.CommonResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.validation.BindingResult;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.text.ParseException;
 
 @RequestMapping("/api/welcomeStudent")
 @Api(tags = {"WelcomeStudentController"}, value = "学生信息管理")
@@ -18,6 +24,10 @@ public interface WelcomeStudentControllerAPI {
     @ApiOperation(value = "添加学生信息", notes = "添加学生信息", httpMethod = "POST")
     CommonResult insertStudentInfo(@Validated @RequestBody InsertStudentRequest isr, BindingResult bindingResult) throws Exception;
 
+    @PostMapping(value = "/updateStudentInfo")
+    @ApiOperation(value = "编辑学生信息", notes = "编辑学生信息", httpMethod = "POST")
+    CommonResult updateStudentInfo(@Validated @RequestBody updateStudentRequest usr, BindingResult bindingResult) throws Exception;
+
     @GetMapping(value = "/queryPageStudents")
     @ApiOperation(value = "学生信息分页数据", notes = "学生信息分页数据", httpMethod = "GET")
     CommonResult queryPageStudents(@RequestParam int currentPage, @RequestParam int pageCount, Integer collegeId, Integer majorId, Integer classstrId, String trafficMethod, String name);
@@ -33,4 +43,18 @@ public interface WelcomeStudentControllerAPI {
     @GetMapping(value = "/deleteStudentInfo")
     @ApiOperation(value = "删除学生信息", notes = "删除学生信息", httpMethod = "GET")
     CommonResult deleteStudentInfo(@RequestParam int id) throws Exception;
+
+    @PostMapping(value = "/importStudentExcel")
+    @ApiOperation(value = "导入学生基本信息数据", notes = "导入学生基本信息数据", httpMethod = "POST")
+    CommonResult importStudentExcel(@RequestParam("file") MultipartFile file) throws IOException, ParseException;
+
+    @GetMapping(value = "/downloadStudentExcel")
+    @ApiOperation(value = "学生信息导出模板", notes = "学生信息导出模板", httpMethod = "GET")
+    CommonResult downloadStudentExcel();
+
+    @GetMapping(value = "jgcloudProjectExport")
+    @ApiOperation(value = "导出学生信息数据", notes = "导出学生信息数据", httpMethod = "GET")
+    void jgcloudProjectExport(HttpServletResponse response, Integer collegeId, Integer majorId, Integer classstrId, String trafficMethod, String name);
+
+
 }

+ 43 - 0
src/main/java/com/template/common/utils/CreateSign1.java

@@ -0,0 +1,43 @@
+package com.template.common.utils;
+
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+public class CreateSign1 {
+    private static final char hexDigits[] = { '0', '1', '2', '3', '4', '5',
+            '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+
+    public static String MD5(String s) {
+        return MD5(s,"utf-8");
+    }
+
+    public static String MD5(String s, String charset) {
+        try{
+            MessageDigest messagedigest = MessageDigest.getInstance("MD5");
+            messagedigest.reset();
+            byte abyte0[] = messagedigest.digest(s.getBytes(charset));
+            return byteToString(abyte0);
+        } catch (NoSuchAlgorithmException e) {
+            e.printStackTrace();
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+        return "";
+    }
+
+    private static String byteToString(byte abyte0[]) {
+        int i = abyte0.length;
+        char ac[] = new char[i * 2];
+        int j = 0;
+        for (int k = 0; k < i; k++) {
+            byte byte0 = abyte0[k];
+            ac[j++] = hexDigits[byte0 >>> 4 & 0xf];
+            ac[j++] = hexDigits[byte0 & 0xf];
+        }
+        return new String(ac);
+    }
+
+
+}

+ 210 - 0
src/main/java/com/template/common/utils/HttpsClientCar.java

@@ -0,0 +1,210 @@
+package com.template.common.utils;
+
+import com.alibaba.fastjson.JSONObject;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocketFactory;
+import javax.net.ssl.TrustManager;
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * HttpsClient类
+ * @author lujunjie
+ * @date   2018/03/01
+ */
+public class HttpsClientCar {
+
+    /**
+     * GET请求方式
+     */
+    public static final String METHOD_GET = "GET";
+    /**
+     * POST请求方式
+     */
+    public static final String METHOD_POST = "POST";
+    /**
+     * 连接超时时间
+     */
+    private static Integer CONNECTION_TIMEOUT = WxConfig.connectionTimeout;
+    /**
+     * 请求超时时间
+     */
+    private static Integer READ_TIMEOUT = WxConfig.readTimeout;
+
+    public static void get(String url, Map<String, String> params) {
+        CloseableHttpClient httpClient = null;
+        HttpGet httpGet = null;
+        try {
+            httpClient = HttpClients.createDefault();
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(20000).setConnectTimeout(20000).build();
+            String ps = "";
+            for (String pKey : params.keySet()) {
+                if (!"".equals(ps)) {
+                    ps = ps + "&";
+                }
+                ps = pKey + "=" + params.get(pKey);
+            }
+            if (!"".equals(ps)) {
+                url = url + "?" + ps;
+            }
+            httpGet = new HttpGet(url);
+            httpGet.setConfig(requestConfig);
+            CloseableHttpResponse response = httpClient.execute(httpGet);
+            HttpEntity httpEntity = response.getEntity();
+            System.out.println(EntityUtils.toString(httpEntity, "utf-8"));
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (httpGet != null) {
+                    httpGet.releaseConnection();
+                }
+                if (httpClient != null) {
+                    httpClient.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    public static String get(String strURL) throws Exception {
+
+        URL url = new URL(strURL);
+        HttpURLConnection httpConn = (HttpURLConnection)
+                url.openConnection();
+        httpConn.setRequestMethod("GET");
+        httpConn.connect();
+        System.out.println("bbb: " + httpConn.getResponseCode());
+        BufferedReader reader = new BufferedReader(new InputStreamReader(
+                httpConn.getInputStream(), "utf-8"));
+        String line;
+        StringBuffer buffer = new StringBuffer();
+        while ((line = reader.readLine()) != null) {
+            buffer.append(line);
+        }
+        reader.close();
+        httpConn.disconnect();
+
+        return buffer.toString();
+    }
+
+    //url表示请求链接,param表示json格式的请求参数		//自定义菜单创建访问方式
+    public static String sendPost(String url, String param) {
+        PrintWriter out = null;
+        BufferedReader in = null;
+        String result = "";
+        try {
+            URL realUrl = new URL(url);
+            // 打开和URL之间的连接
+            URLConnection conn = realUrl.openConnection();
+            // 设置通用的请求属性 注意Authorization生成
+            // conn.setRequestProperty("Content-Type",
+            // "application/x-www-form-urlencoded");
+            // 发送POST请求必须设置如下两行
+            conn.setDoOutput(true);
+            conn.setDoInput(true);
+            // 获取URLConnection对象对应的输出流
+            out = new PrintWriter(new OutputStreamWriter(conn.getOutputStream(), "utf-8"));
+            // 发送请求参数
+            out.print("&" + param);
+            // flush输出流的缓冲
+            out.flush();
+            // 定义BufferedReader输入流来读取URL的响应
+            in = new BufferedReader(
+                    new InputStreamReader(conn.getInputStream(), "utf-8"));
+            String line;
+            while ((line = in.readLine()) != null) {
+                result += line;
+            }
+        } catch (Exception e) {
+            System.out.println("发送 请求出现异常!" + e);
+            e.printStackTrace();
+        }
+        // 使用finally块来关闭输出流、输入流
+        finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (in != null) {
+                    in.close();
+                }
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+    public static String sendJson(String request_url, JSONObject json) {
+        OutputStreamWriter out = null;
+        InputStream is = null;
+        String result = "";
+        try {
+            URL url = new URL(request_url);// 创建连接
+            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+            connection.setDoOutput(true);
+            connection.setDoInput(true);
+            connection.setUseCaches(false);
+            connection.setInstanceFollowRedirects(true);
+            connection.setRequestMethod("POST"); // 设置请求方式
+            // 设置接收数据的格式
+            connection.setRequestProperty("Accept", "application/json");
+            // 设置发送数据的格式
+            connection.setRequestProperty("Content-Type", "application/json");
+            connection.connect();
+            out = new OutputStreamWriter(connection.getOutputStream(), "UTF-8");
+            out.append(json.toString());
+            out.flush();
+            out.close();
+            // 读取响应
+            is = connection.getInputStream();
+            int length = (int) connection.getContentLength();// 获取长度
+            if (length != -1) {
+                byte[] data = new byte[length];
+                byte[] temp = new byte[512];
+                int readLen = 0;
+                int destPos = 0;
+                while ((readLen = is.read(temp)) > 0) {
+                    System.arraycopy(temp, 0, data, destPos, readLen);
+                    destPos += readLen;
+                }
+                result = new String(data, "UTF-8"); // utf-8编码
+                System.out.println("主机返回:" + result);
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                is.close();
+                out.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+}

+ 25 - 0
src/main/java/com/template/controller/LoginController.java

@@ -24,6 +24,7 @@ import org.apache.commons.io.IOUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.configurationprocessor.json.JSONObject;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 import org.springframework.validation.BindingResult;
@@ -223,6 +224,7 @@ public class LoginController implements LoginControllerAPI {
                 student.setAdmissNum(card_number);
                 student.setName(user_name);
                 student.setPhone(phone);
+                student.setSchool(campus);
                 student.setCollege(college);
                 student.setMajor(profession);
                 student.setClassstr(classStr);
@@ -242,6 +244,7 @@ public class LoginController implements LoginControllerAPI {
             student.setAdmissNum(card_number);
             student.setName(user_name);
             student.setPhone(phone);
+            student.setSchool(campus);
             student.setCollege(college);
             student.setMajor(profession);
             student.setClassstr(classStr);
@@ -279,6 +282,7 @@ public class LoginController implements LoginControllerAPI {
         wlv.setPicture(student.getPicture());
         wlv.setCardId(id_card);
         wlv.setSex(student.getSex());
+        wlv.setSchool(campus);
 
         wlv.setPhone(student.getPhone().replace("(+86)", ""));
         wlv.setCollege(college == null ? "微校获取不到院校" : college);
@@ -306,4 +310,25 @@ public class LoginController implements LoginControllerAPI {
         }
         return CommonResult.ok(student);
     }
+
+    @Override
+    @PassToken
+    public CommonResult writeCarInfo() {
+        com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
+        String ukey = "6VMZEC5C6HZM7EO8";
+        com.alibaba.fastjson.JSONObject datas = new com.alibaba.fastjson.JSONObject();
+        datas.put("car_number", "赣A0AY39");
+        datas.put("begin_time", "2025-06-16 10:00:00");
+        datas.put("end_time", "2025-06-16 18:00:00");
+        datas.put("mobile", "18279193722");
+        // 生成带签名的字符串并使用MD5生成签名,然后转大写
+        String sign = datas.toJSONString() + "key=" + ukey;
+        sign = CreateSign1.MD5(sign).toUpperCase();
+        json.put("service_name", "visitor_sync");
+        json.put("sign", sign);
+        json.put("park_id", "10033845");
+        json.put("data", datas);
+        String msg = HttpsClient.sendJson("http://istparking.sciseetech.com/public/visitor/do", json);
+        return CommonResult.ok(msg);
+    }
 }

+ 827 - 22
src/main/java/com/template/controller/WelcomeStudentController.java

@@ -3,31 +3,44 @@ package com.template.controller;
 
 import com.alibaba.fastjson.JSON;
 import com.template.api.WelcomeStudentControllerAPI;
+import com.template.common.utils.ExcelUtils;
 import com.template.common.utils.paramUtils;
+import com.template.model.enumModel.eFileType;
+import com.template.model.enumModel.eProjectType;
 import com.template.model.pojo.*;
-import com.template.model.request.InfoCollectionRequest;
-import com.template.model.request.InsertAccompanyRequest;
-import com.template.model.request.InsertFamilyRequest;
-import com.template.model.request.InsertStudentRequest;
+import com.template.model.request.*;
 import com.template.model.result.CommonResult;
 import com.template.model.result.PageUtils;
 import com.template.model.vo.*;
 import com.template.services.*;
-import io.swagger.annotations.ApiModelProperty;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.hssf.usermodel.HSSFRow;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.DataFormatter;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFRow;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RestController;
-import springfox.documentation.spring.web.json.Json;
+import org.springframework.web.multipart.MultipartFile;
 
-import java.math.BigDecimal;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.ParseException;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -55,6 +68,12 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
     @Autowired
     private WelcomeArriveSettingService welcomeArriveSettingService;
 
+    @Autowired
+    private WelcomeOrgService welcomeOrgService;
+
+    @Autowired
+    private WelcomeCityService welcomeCityService;
+
     private static Logger logger = LoggerFactory.getLogger(WelcomeStudentController.class);
 
     @Override
@@ -79,6 +98,7 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
         ws.setCardId(isr.getCardId());
         ws.setSex(isr.getSex());
         ws.setBirthday(isr.getBirthday());
+        ws.setSchool(isr.getSchool());
         ws.setCollege(isr.getCollege());
         ws.setMajor(isr.getMajor());
         ws.setClassstr(isr.getClassstr());
@@ -184,6 +204,147 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
     }
 
     @Override
+    public CommonResult updateStudentInfo(updateStudentRequest usr, BindingResult bindingResult) throws Exception {
+        if (bindingResult.hasErrors()) {
+            String st = paramUtils.getParamError(bindingResult);
+            return CommonResult.fail(st);
+        }
+
+        WelcomeStudent student = welcomeStudentService.getManageById(usr.getId());
+        if (student == null) {
+            return CommonResult.fail("学生数据已失效,编辑失败!");
+        }
+
+        //region 学生信息
+        student.setAdmissNum(usr.getAdmissNum());
+        student.setName(usr.getName());
+        student.setPicture(usr.getPicture());
+        student.setCardId(usr.getCardId());
+        student.setSex(usr.getSex());
+        student.setBirthday(usr.getBirthday());
+        student.setSchool(usr.getSchool());
+        student.setCollege(usr.getCollege());
+        student.setMajor(usr.getMajor());
+        student.setClassstr(usr.getClassstr());
+        student.setCollegeId(usr.getCollegeId());
+        student.setMajorId(usr.getMajorId());
+        student.setClassstrId(usr.getClassstrId());
+        student.setExamNum(usr.getExamNum());
+        student.setEduSystem(usr.getEduSystem());
+        student.setGraduationSchool(usr.getGraduationSchool());
+        student.setBatchValue(usr.getBatchValue());
+        student.setPoliticalStatu(usr.getPoliticalStatu());
+        student.setNationality(usr.getNationality());
+        student.setPhone(usr.getPhone());
+        student.setOprovinceId(usr.getOprovinceId());
+        student.setOcityId(usr.getOcityId());
+        student.setOdistrictId(usr.getOdistrictId());
+        student.setProvinceId(usr.getProvinceId());
+        student.setCityId(usr.getCityId());
+        student.setDistrictId(usr.getDistrictId());
+        student.setAddress(usr.getAddress());
+        student.setTrafficMethod(usr.getTrafficMethod());
+        student.setArrive(usr.getArrive());
+        student.setArrvieDate(usr.getArrvieDate());
+        student.setArriveTime(usr.getArriveTime());
+        //ws.setAmountPayable(isr.getAmountPayable());
+        //ws.setPayAmount(isr.getPayAmount());
+        //ws.setIsDrive(isr.getIsDrive());
+        //ws.setCarNumber(isr.getCarNumber());
+        //endregion
+
+        //region 家庭成员数据
+
+        List<WelcomeFamily> wfs = new ArrayList<>();
+        if (usr.getFamilys() != null && usr.getFamilys().size() > 0) {
+            for (InsertFamilyRequest family : usr.getFamilys()) {
+                WelcomeFamily wf = new WelcomeFamily();
+                wf.setStudentCard(student.getCardId());
+                wf.setFamilyShip(family.getFamilyShip());
+                wf.setName(family.getName());
+                wf.setWorkUnit(family.getWorkUnit());
+                wf.setPhone(family.getPhone());
+                wfs.add(wf);
+            }
+        }
+        //endregion
+
+        //region 陪同人员数据
+        List<WelcomeAccompany> was = new ArrayList<>();
+        if (usr.getAccompanys() != null && usr.getAccompanys().size() > 0) {
+            for (InsertAccompanyRequest accompany : usr.getAccompanys()) {
+                WelcomeAccompany wa = new WelcomeAccompany();
+                wa.setStudentCard(student.getCardId());
+                wa.setName(accompany.getName());
+                wa.setPhone(accompany.getPhone());
+                was.add(wa);
+            }
+        }
+
+        //endregion
+
+        //region 宿舍信息
+        WelcomeStudentDormitory wsd = new WelcomeStudentDormitory();
+        wsd.setStudentCard(usr.getCardId());
+        wsd.setBuilding(usr.getBilding());
+        wsd.setDormitory(usr.getDormitory());
+        wsd.setBedNum(usr.getBednum());
+        //endregion
+
+        try {
+
+            int studentId = welcomeStudentService.updateWelcomeStudent(student);
+            if (studentId <= 0) {
+                logger.error("编辑学生失败,参数:" + JSON.toJSON(usr));
+                throw new Exception("编辑失败!");
+            }
+
+            int deleteF = welcomeFamilyService.deleteWelcomeFamilyByCard(student.getCardId());
+            if (wfs != null && wfs.size() > 0) {
+                boolean insertBatch = welcomeFamilyService.saveBatch(wfs);
+                if (!insertBatch) {
+                    logger.error("编辑家庭成员失败,参数:" + JSON.toJSON(wfs));
+                    throw new Exception("编辑失败!");
+                }
+            }
+
+            int deleteA = welcomeAccompanyService.deleteWelcomeAccompanyByCard(student.getCardId());
+            if (was != null && was.size() > 0) {
+                boolean insertBatch = welcomeAccompanyService.saveBatch(was);
+                if (!insertBatch) {
+                    logger.error("编辑陪同人员失败,参数:" + JSON.toJSON(was));
+                    throw new Exception("编辑失败!");
+                }
+            }
+
+            WelcomeStudentDormitory wsds = welcomeStudentDormitoryService.getManageByCardId(student.getCardId());
+            if(wsds == null){
+                int insertStudentDormitory = welcomeStudentDormitoryService.insertWelcomeStudentDormitory(wsd);
+                if (insertStudentDormitory <= 0) {
+                    logger.error("添加宿舍信息失败,参数:" + JSON.toJSON(wsd));
+                    throw new Exception("添加失败!");
+                }
+            }else{
+                wsds.setStudentCard(usr.getCardId());
+                wsds.setBuilding(usr.getBilding());
+                wsds.setDormitory(usr.getDormitory());
+                wsds.setBedNum(usr.getBednum());
+                int updateStudentDormitory = welcomeStudentDormitoryService.updateWelcomeStudentDormitory(wsds);
+                if (updateStudentDormitory < 0) {
+                    logger.error("编辑宿舍信息失败,参数:" + JSON.toJSON(wsd));
+                    throw new Exception("编辑失败!");
+                }
+            }
+
+        } catch (Exception e) {
+            logger.error(e.getMessage());
+            throw new Exception("编辑失败!");
+        }
+
+        return CommonResult.ok("编辑成功");
+    }
+
+    @Override
     public CommonResult queryPageStudents(int currentPage, int pageCount, Integer collegeId, Integer majorId, Integer classstrId, String trafficMethod, String name) {
         PageUtils<StudentPageVo> result = welcomeStudentService.queryStudentPageList(currentPage, pageCount, collegeId, majorId, classstrId, trafficMethod, name);
         return CommonResult.ok(result);
@@ -254,6 +415,7 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
         result.setAtvs(atvs);
 
         result.setId(ws.getId());
+        result.setSchool(ws.getSchool());
         result.setAdmissNum(ws.getAdmissNum());
         result.setName(ws.getName());
         result.setPicture(ws.getPicture());
@@ -312,6 +474,7 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
         if (ws == null) {
             ws = new WelcomeStudent();
         }
+        ws.setSchool(icr.getSchool());
         ws.setAdmissNum(icr.getAdmissNum());
         ws.setName(icr.getName());
         ws.setPicture(icr.getPicture());
@@ -350,8 +513,8 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
         ws.setFillStatus("已填报");
         //家庭成员
         List<WelcomeFamily> wfs = new ArrayList<>();
-        if(icr.getFvs() != null && icr.getFvs().size() > 0){
-            for (FamilyVo fv:icr.getFvs()) {
+        if (icr.getFvs() != null && icr.getFvs().size() > 0) {
+            for (FamilyVo fv : icr.getFvs()) {
                 WelcomeFamily wf = new WelcomeFamily();
                 wf.setName(fv.getName());
                 wf.setPhone(fv.getPhone());
@@ -364,8 +527,8 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
 
         //陪同人员
         List<WelcomeAccompany> was = new ArrayList<>();
-        if(icr.getAvs() != null && icr.getAvs().size() > 0){
-            for (AccompanyVo av:icr.getAvs()) {
+        if (icr.getAvs() != null && icr.getAvs().size() > 0) {
+            for (AccompanyVo av : icr.getAvs()) {
                 WelcomeAccompany wa = new WelcomeAccompany();
                 wa.setName(av.getName());
                 wa.setPhone(av.getPhone());
@@ -374,23 +537,23 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
             }
         }
 
-        try{
+        try {
             boolean resultWs = welcomeStudentService.saveOrUpdate(ws);
-            if(!resultWs){
+            if (!resultWs) {
                 logger.error("采集学生信息失败,ws参数:" + JSON.toJSON(ws));
                 throw new Exception("采集学生信息失败!");
             }
             boolean resultWf = welcomeFamilyService.saveBatch(wfs);
-            if(!resultWf){
+            if (!resultWf) {
                 logger.error("采集学生信息失败,wfs参数:" + JSON.toJSON(wfs));
                 throw new Exception("采集学生信息失败!");
             }
             boolean resultWa = welcomeAccompanyService.saveBatch(was);
-            if(!resultWa){
+            if (!resultWa) {
                 logger.error("采集学生信息失败,was参数:" + JSON.toJSON(was));
                 throw new Exception("采集学生信息失败!");
             }
-        }catch (Exception e){
+        } catch (Exception e) {
             logger.error(e.getMessage());
             throw new Exception("采集失败!");
         }
@@ -400,16 +563,16 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
 
     @Override
     @Transactional(rollbackFor = {Exception.class})
-    public CommonResult deleteStudentInfo( int id) throws Exception {
+    public CommonResult deleteStudentInfo(int id) throws Exception {
 
         WelcomeStudent ws = welcomeStudentService.getManageById(id);
-        if(ws == null){
+        if (ws == null) {
             return CommonResult.fail("学生信息已失效,无法进行删除操作!");
         }
         try {
             //删除学生数据
             int deleteStudent = welcomeStudentService.deleteWelcomeStudentById(id);
-            if(deleteStudent <= 0){
+            if (deleteStudent <= 0) {
                 logger.error("删除学生信息失败,id参数:" + JSON.toJSON(id));
                 throw new Exception("删除学生信息失败!");
             }
@@ -420,12 +583,654 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
             //删除家庭成员
             int deletef = welcomeFamilyService.deleteWelcomeFamilyByCard(ws.getCardId());
 
-        }catch (Exception e){
+        } catch (Exception e) {
             logger.error(e.getMessage());
             throw new Exception("删除失败!");
         }
 
         return CommonResult.ok("删除成功");
     }
+
+    @Override
+    public CommonResult importStudentExcel(MultipartFile file) throws IOException, ParseException {
+        System.out.println("导入学生信息");
+        if (file.isEmpty() || file.getSize() == 0) {
+            return CommonResult.fail("导入文件不能为空");
+        }
+        String ContentType = file.getContentType();
+        InputStream inputStream = file.getInputStream();
+        List<WelcomeStudent> result = new ArrayList<>();
+
+        //xls格式文件
+        if (ContentType.equals(eFileType.Xls.getValue())) {
+
+            CommonResult<List<WelcomeStudent>> resultData = readXls(inputStream);
+            if (!resultData.isSuccess()) {
+                return resultData;
+            }
+            result = resultData.getData();
+
+        } else if (ContentType.equals(eFileType.Xlsx.getValue())) {
+            CommonResult<List<WelcomeStudent>> resultData = readXlsx(inputStream);
+            if (!resultData.isSuccess()) {
+                return resultData;
+            }
+            result = resultData.getData();
+
+        } else {
+            return CommonResult.fail("学生信息数据导入只支持Xls或Xlsx格式文件");
+        }
+
+        List<String> cardIds = result.stream().map(WelcomeStudent::getCardId).collect(Collectors.toList());
+        List<WelcomeStudent> existStudents = welcomeStudentService.queryStudentByCardId(cardIds);
+        if (existStudents != null && existStudents.size() > 0) {
+            for (WelcomeStudent ws : result) {
+                Optional<WelcomeStudent> ows = existStudents.stream().filter(e -> e.getCardId().equals(ws.getCardId())).findFirst();
+                if (ows != null && ows.isPresent()) {
+                    ws.setId(ws.getId());
+                    ws.setAdmissNum(ws.getAdmissNum());//录取号
+                    ws.setName(ws.getName());//姓名
+                    ws.setCardId(ws.getCardId());//身份证号
+                    ws.setSchool(ws.getSchool());//校区
+                    ws.setCollege(ws.getCollege());
+                    ws.setCollegeId(ws.getCollegeId());
+                    ws.setMajor(ws.getMajor());
+                    ws.setMajorId(ws.getMajorId());
+                    ws.setClassstr(ws.getClassstr());
+                    ws.setClassstrId(ws.getClassstrId());
+                    ws.setExamNum(ws.getExamNum());//考生号
+                    ws.setEduSystem(ws.getEduSystem());//学制
+                    ws.setGraduationSchool(ws.getGraduationSchool());//毕业中学
+                    ws.setBatchValue(ws.getBatchValue());//批次
+                    ws.setPoliticalStatu(ws.getPoliticalStatu());//政治面貌
+                    ws.setNationality(ws.getNationality());//民族
+                    ws.setPhone(ws.getPhone());//手机号码
+                    ws.setOprovince(ws.getOprovince());
+                    ws.setOprovinceId(ws.getOprovinceId());
+                    ws.setOcity(ws.getOcity());
+                    ws.setOcityId(ws.getOcityId());
+                    ws.setOdistrict(ws.getOdistrict());
+                    ws.setOdistrictId(ws.getOdistrictId());
+                    ws.setProvince(ws.getProvince());
+                    ws.setProvinceId(ws.getProvinceId());
+                    ws.setCity(ws.getCity());
+                    ws.setCityId(ws.getCityId());
+                    ws.setDistrict(ws.getDistrict());
+                    ws.setDistrictId(ws.getDistrictId());
+                    ws.setAddress(ws.getAddress());
+                    ws.setZipCode(ws.getZipCode());
+                }
+            }
+        }
+
+        boolean resultBool = welcomeStudentService.saveOrUpdateBatch(result);
+
+        System.out.println("导入学生1");
+        return resultBool ? CommonResult.ok("导入成功") : CommonResult.fail("导入失败");
+    }
+
+    /**
+     * xls文件读取方法
+     *
+     * @param inputStream
+     * @return
+     * @throws IOException
+     * @throws ParseException
+     */
+    private CommonResult<List<WelcomeStudent>> readXls(InputStream inputStream) throws IOException, ParseException {
+        List<WelcomeStudent> result = new ArrayList<>();
+        HSSFWorkbook sheets = new HSSFWorkbook(inputStream);
+
+        List<WelcomeOrg> ws = welcomeOrgService.list(null);
+        List<WelcomeCity> citys = welcomeCityService.list(null);
+
+        //读取第一张sheet
+        HSSFSheet sheetAt = sheets.getSheetAt(0);
+        DataFormatter dataFormatter = new DataFormatter();
+
+        try {
+            //rowNum = 3 从第三行开始获取值
+            //sheetAt.getLastRowNum():从0开始统计数量 所以得+1
+            for (int rowNum = 0; rowNum < sheetAt.getLastRowNum() + 1; rowNum++) {
+
+                HSSFRow row = sheetAt.getRow(rowNum);
+
+                if (row != null) {
+                    //使用了getStringCellValue()方法来获取值,POI会判断单元格的类型,如果非字符串类型就会抛出上面的异常。
+                    //所以先使用setCellType()方法先将该单元格的类型设置为STRING
+                    //然后poi会根据字符串读取它
+                    //第一行数据获取月份
+                    if (rowNum == 0) {
+                        String number = dataFormatter.formatCellValue(row.getCell(0));//序号
+                        if (!number.equals("序号")) {
+                            return CommonResult.fail("导入数据第一列为序号");
+                        }
+                        String assNum = dataFormatter.formatCellValue(row.getCell(1));//录取号
+                        if (!assNum.equals("录取号")) {
+                            return CommonResult.fail("导入数据第二列为录取号");
+                        }
+                        String name = dataFormatter.formatCellValue(row.getCell(2));//姓名
+                        if (!name.equals("姓名")) {
+                            return CommonResult.fail("导入数据第三列为姓名");
+                        }
+                        String cardId = dataFormatter.formatCellValue(row.getCell(3));//身份证号
+                        if (!cardId.equals("身份证号")) {
+                            return CommonResult.fail("导入数据第四列为身份证号");
+                        }
+                        String school = dataFormatter.formatCellValue(row.getCell(4));//校区
+                        if (!school.equals("校区")) {
+                            return CommonResult.fail("导入数据第五列为校区");
+                        }
+                        String college = dataFormatter.formatCellValue(row.getCell(5));//院系
+                        if (!college.equals("院系")) {
+                            return CommonResult.fail("导入数据第六列为院系");
+                        }
+                        String major = dataFormatter.formatCellValue(row.getCell(6));//专业
+                        if (!major.equals("专业")) {
+                            return CommonResult.fail("导入数据第七列为专业");
+                        }
+                        String classstr = dataFormatter.formatCellValue(row.getCell(7));//班级
+                        if (!classstr.equals("班级")) {
+                            return CommonResult.fail("导入数据第八列为班级");
+                        }
+                        String examNum = dataFormatter.formatCellValue(row.getCell(8));//考生号
+                        if (!examNum.equals("考生号")) {
+                            return CommonResult.fail("导入数据第九列为考生号");
+                        }
+                        String eduSystem = dataFormatter.formatCellValue(row.getCell(9));//学制
+                        if (!eduSystem.equals("学制")) {
+                            return CommonResult.fail("导入数据第十列为学制");
+                        }
+                        String graSchool = dataFormatter.formatCellValue(row.getCell(10));//毕业中学
+                        if (!graSchool.equals("毕业中学")) {
+                            return CommonResult.fail("导入数据第十一列为毕业中学批次");
+                        }
+                        String batchValue = dataFormatter.formatCellValue(row.getCell(11));//批次
+                        if (!batchValue.equals("批次")) {
+                            return CommonResult.fail("导入数据第十一列为批次");
+                        }
+                        String politicalStatu = dataFormatter.formatCellValue(row.getCell(12));//政治面貌
+                        if (!politicalStatu.equals("政治面貌")) {
+                            return CommonResult.fail("导入数据第十一列为政治面貌");
+                        }
+                        String nationality = dataFormatter.formatCellValue(row.getCell(13));//民族
+                        if (!nationality.equals("民族")) {
+                            return CommonResult.fail("导入数据第十一列为民族");
+                        }
+                        String phone = dataFormatter.formatCellValue(row.getCell(14));//手机号码
+                        if (!phone.equals("手机号码")) {
+                            return CommonResult.fail("导入数据第十一列为手机号码");
+                        }
+                        String nativePlace = dataFormatter.formatCellValue(row.getCell(15));//籍贯
+                        if (!nativePlace.equals("籍贯")) {
+                            return CommonResult.fail("导入数据第十一列为籍贯");
+                        }
+                        String addressPlace = dataFormatter.formatCellValue(row.getCell(16));//家庭住址
+                        if (!addressPlace.equals("家庭住址")) {
+                            return CommonResult.fail("导入数据第十一列为家庭住址");
+                        }
+                        String addressDetail = dataFormatter.formatCellValue(row.getCell(17));//详细住址
+                        if (!addressDetail.equals("详细住址")) {
+                            return CommonResult.fail("导入数据第十一列为详细住址");
+                        }
+                        String zipCode = dataFormatter.formatCellValue(row.getCell(18));//邮编
+                        if (!zipCode.equals("邮编")) {
+                            return CommonResult.fail("导入数据第十一列为邮编");
+                        }
+
+                    } else {
+                        WelcomeStudent studentData = new WelcomeStudent();
+
+                        String assNum = dataFormatter.formatCellValue(row.getCell(1));//录取号
+                        studentData.setAdmissNum(assNum);
+                        String name = dataFormatter.formatCellValue(row.getCell(2));//姓名
+                        studentData.setName(name);
+                        String cardId = dataFormatter.formatCellValue(row.getCell(3));//身份证号
+                        studentData.setCardId(cardId);
+
+                        String school = dataFormatter.formatCellValue(row.getCell(4));//校区
+                        studentData.setSchool(school);
+
+                        //region 院系专业
+                        String college = dataFormatter.formatCellValue(row.getCell(5));//院系
+                        Optional<WelcomeOrg> owo = ws.stream().filter(e -> e.getName().equals(college)).findFirst();
+                        if (owo != null && owo.isPresent()) {
+                            studentData.setCollege(college);
+                            studentData.setCollegeId(owo.get().getId());
+                        }
+
+                        String major = dataFormatter.formatCellValue(row.getCell(6));//专业
+                        Optional<WelcomeOrg> omwo = ws.stream().filter(e -> e.getName().equals(major)).findFirst();
+                        if (omwo != null && omwo.isPresent()) {
+                            studentData.setMajor(major);
+                            studentData.setMajorId(omwo.get().getId());
+                        }
+
+                        String classstr = dataFormatter.formatCellValue(row.getCell(7));//班级
+                        Optional<WelcomeOrg> ocwo = ws.stream().filter(e -> e.getName().equals(classstr)).findFirst();
+                        if (ocwo != null && ocwo.isPresent()) {
+                            studentData.setClassstr(classstr);
+                            studentData.setClassstrId(ocwo.get().getId());
+                        }
+                        //endregion
+
+                        String examNum = dataFormatter.formatCellValue(row.getCell(8));//考生号
+                        studentData.setExamNum(examNum);
+
+                        String eduSystem = dataFormatter.formatCellValue(row.getCell(9));//学制
+                        studentData.setEduSystem(eduSystem);
+
+                        String graSchool = dataFormatter.formatCellValue(row.getCell(10));//毕业中学
+                        studentData.setGraduationSchool(graSchool);
+
+                        String batchValue = dataFormatter.formatCellValue(row.getCell(11));//批次
+                        studentData.setBatchValue(batchValue);
+
+                        String politicalStatu = dataFormatter.formatCellValue(row.getCell(12));//政治面貌
+                        studentData.setPoliticalStatu(politicalStatu);
+
+                        String nationality = dataFormatter.formatCellValue(row.getCell(13));//民族
+                        studentData.setNationality(nationality);
+
+                        String phone = dataFormatter.formatCellValue(row.getCell(14));//手机号码
+                        studentData.setPhone(phone);
+
+                        //region 籍贯
+                        String nativePlace = dataFormatter.formatCellValue(row.getCell(15));//籍贯
+                        String[] addressDatas = nativePlace.split("/");
+                        if (citys != null && citys.size() > 0) {
+                            if (addressDatas != null && addressDatas.length >= 1) {
+                                if (!addressDatas[0].contains("省")) {
+                                    return CommonResult.fail("录取编号为\" + assNum + \"的籍贯格式应该是 省/市/县");
+                                }
+                                Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getDistrictZh().equals(addressDatas[0])).findFirst();
+                                if (oProvince != null && oProvince.isPresent()) {
+                                    studentData.setOprovince(addressDatas[0]);
+                                    studentData.setOprovinceId(oProvince.get().getId());
+                                } else {
+                                    return CommonResult.fail("录取编号为" + assNum + "的籍贯格式应该是 省/市/县");
+                                }
+                            }
+                            if (addressDatas != null && addressDatas.length >= 2) {
+                                Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getDistrictZh().equals(addressDatas[1])).findFirst();
+                                if (oProvince != null && oProvince.isPresent()) {
+                                    studentData.setOcity(addressDatas[1]);
+                                    studentData.setOcityId(oProvince.get().getId());
+                                } else {
+                                    return CommonResult.fail("录取编号为" + assNum + "的籍贯格式应该是 省/市/县");
+                                }
+                            }
+                            if (addressDatas != null && addressDatas.length >= 3) {
+                                Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getCityZh().equals(addressDatas[1]) && e.getDistrictZh().equals(addressDatas[2])).findFirst();
+                                if (oProvince != null && oProvince.isPresent()) {
+                                    studentData.setOdistrict(addressDatas[2]);
+                                    studentData.setOdistrictId(oProvince.get().getId());
+                                } else {
+                                    return CommonResult.fail("录取编号为" + assNum + "的籍贯格式应该是 省/市/县");
+                                }
+                            }
+                        }
+                        //endregion
+
+                        //region 家庭住址
+                        String addressPlace = dataFormatter.formatCellValue(row.getCell(16));//家庭住址
+                        String[] addressPlaces = addressPlace.split("/");
+                        if (citys != null && citys.size() > 0) {
+                            if (addressPlaces != null && addressPlaces.length >= 1) {
+                                if (!addressPlaces[0].contains("省")) {
+                                    return CommonResult.fail("录取编号为" + assNum + "的家庭住址格式应该是 省/市/县");
+                                }
+                                Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getDistrictZh().equals(addressPlaces[0])).findFirst();
+                                if (oProvince != null && oProvince.isPresent()) {
+                                    studentData.setProvince(addressPlaces[0]);
+                                    studentData.setProvinceId(oProvince.get().getId());
+                                } else {
+                                    return CommonResult.fail("录取编号为" + assNum + "的家庭住址格式应该是 省/市/县");
+                                }
+                            }
+                            if (addressPlaces != null && addressPlaces.length >= 2) {
+                                Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getDistrictZh().equals(addressPlaces[1])).findFirst();
+                                if (oProvince != null && oProvince.isPresent()) {
+                                    studentData.setCity(addressPlaces[1]);
+                                    studentData.setCityId(oProvince.get().getId());
+                                } else {
+                                    return CommonResult.fail("录取编号为" + assNum + "的家庭住址格式应该是 省/市/县");
+                                }
+                            }
+                            if (addressPlaces != null && addressPlaces.length >= 3) {
+                                Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getCityZh().equals(addressPlaces[1]) && e.getDistrictZh().equals(addressPlaces[2])).findFirst();
+                                if (oProvince != null && oProvince.isPresent()) {
+                                    studentData.setDistrict(addressPlaces[2]);
+                                    studentData.setDistrictId(oProvince.get().getId());
+                                } else {
+                                    return CommonResult.fail("录取编号为" + assNum + "的家庭住址格式应该是 省/市/县");
+                                }
+                            }
+                        }
+                        //endregion
+
+                        String addressDetail = dataFormatter.formatCellValue(row.getCell(17));//详细住址
+                        studentData.setAddress(addressDetail);
+
+                        String zipCode = dataFormatter.formatCellValue(row.getCell(18));//邮编
+                        studentData.setZipCode(zipCode);
+
+                        result.add(studentData);
+                    }
+                }
+            }
+        } catch (Exception e) {
+            return CommonResult.fail("请按模板格式导入数据");
+        }
+
+        return CommonResult.ok(result);
+    }
+
+    /**
+     * xls文件读取方法
+     *
+     * @param inputStream
+     * @return
+     * @throws IOException
+     * @throws ParseException
+     */
+    private CommonResult<List<WelcomeStudent>> readXlsx(InputStream inputStream) throws IOException, ParseException {
+        List<WelcomeStudent> result = new ArrayList<>();
+        XSSFWorkbook sheets = new XSSFWorkbook(inputStream);
+
+        List<WelcomeOrg> ws = welcomeOrgService.list(null);
+        List<WelcomeCity> citys = welcomeCityService.list(null);
+
+        //读取第一张sheet
+        XSSFSheet sheetAt = sheets.getSheetAt(0);
+        DataFormatter dataFormatter = new DataFormatter();
+
+        try {
+            //rowNum = 3 从第三行开始获取值
+            //sheetAt.getLastRowNum():从0开始统计数量 所以得+1
+            for (int rowNum = 0; rowNum < sheetAt.getLastRowNum() + 1; rowNum++) {
+
+                XSSFRow row = sheetAt.getRow(rowNum);
+
+                if (row != null) {
+                    //使用了getStringCellValue()方法来获取值,POI会判断单元格的类型,如果非字符串类型就会抛出上面的异常。
+                    //所以先使用setCellType()方法先将该单元格的类型设置为STRING
+                    //然后poi会根据字符串读取它
+                    //第一行数据获取月份
+                    if (rowNum == 0) {
+                        String number = dataFormatter.formatCellValue(row.getCell(0));//序号
+                        if (!number.equals("序号")) {
+                            return CommonResult.fail("导入数据第一列为序号");
+                        }
+                        String assNum = dataFormatter.formatCellValue(row.getCell(1));//录取号
+                        if (!assNum.equals("录取号")) {
+                            return CommonResult.fail("导入数据第二列为录取号");
+                        }
+                        String name = dataFormatter.formatCellValue(row.getCell(2));//姓名
+                        if (!name.equals("姓名")) {
+                            return CommonResult.fail("导入数据第三列为姓名");
+                        }
+                        String cardId = dataFormatter.formatCellValue(row.getCell(3));//身份证号
+                        if (!cardId.equals("身份证号")) {
+                            return CommonResult.fail("导入数据第四列为身份证号");
+                        }
+                        String school = dataFormatter.formatCellValue(row.getCell(4));//校区
+                        if (!school.equals("校区")) {
+                            return CommonResult.fail("导入数据第五列为校区");
+                        }
+                        String college = dataFormatter.formatCellValue(row.getCell(5));//院系
+                        if (!college.equals("院系")) {
+                            return CommonResult.fail("导入数据第六列为院系");
+                        }
+                        String major = dataFormatter.formatCellValue(row.getCell(6));//专业
+                        if (!major.equals("专业")) {
+                            return CommonResult.fail("导入数据第七列为专业");
+                        }
+                        String classstr = dataFormatter.formatCellValue(row.getCell(7));//班级
+                        if (!classstr.equals("班级")) {
+                            return CommonResult.fail("导入数据第八列为班级");
+                        }
+                        String examNum = dataFormatter.formatCellValue(row.getCell(8));//考生号
+                        if (!examNum.equals("考生号")) {
+                            return CommonResult.fail("导入数据第九列为考生号");
+                        }
+                        String eduSystem = dataFormatter.formatCellValue(row.getCell(9));//学制
+                        if (!eduSystem.equals("学制")) {
+                            return CommonResult.fail("导入数据第十列为学制");
+                        }
+                        String graSchool = dataFormatter.formatCellValue(row.getCell(10));//毕业中学
+                        if (!graSchool.equals("毕业中学")) {
+                            return CommonResult.fail("导入数据第十一列为毕业中学批次");
+                        }
+                        String batchValue = dataFormatter.formatCellValue(row.getCell(11));//批次
+                        if (!batchValue.equals("批次")) {
+                            return CommonResult.fail("导入数据第十一列为批次");
+                        }
+                        String politicalStatu = dataFormatter.formatCellValue(row.getCell(12));//政治面貌
+                        if (!politicalStatu.equals("政治面貌")) {
+                            return CommonResult.fail("导入数据第十一列为政治面貌");
+                        }
+                        String nationality = dataFormatter.formatCellValue(row.getCell(13));//民族
+                        if (!nationality.equals("民族")) {
+                            return CommonResult.fail("导入数据第十一列为民族");
+                        }
+                        String phone = dataFormatter.formatCellValue(row.getCell(14));//手机号码
+                        if (!phone.equals("手机号码")) {
+                            return CommonResult.fail("导入数据第十一列为手机号码");
+                        }
+                        String nativePlace = dataFormatter.formatCellValue(row.getCell(15));//籍贯
+                        if (!nativePlace.equals("籍贯")) {
+                            return CommonResult.fail("导入数据第十一列为籍贯");
+                        }
+                        String addressPlace = dataFormatter.formatCellValue(row.getCell(16));//家庭住址
+                        if (!addressPlace.equals("家庭住址")) {
+                            return CommonResult.fail("导入数据第十一列为家庭住址");
+                        }
+                        String addressDetail = dataFormatter.formatCellValue(row.getCell(17));//详细住址
+                        if (!addressDetail.equals("详细住址")) {
+                            return CommonResult.fail("导入数据第十一列为详细住址");
+                        }
+                        String zipCode = dataFormatter.formatCellValue(row.getCell(18));//邮编
+                        if (!zipCode.equals("邮编")) {
+                            return CommonResult.fail("导入数据第十一列为邮编");
+                        }
+
+                    } else {
+                        WelcomeStudent studentData = new WelcomeStudent();
+
+                        String assNum = dataFormatter.formatCellValue(row.getCell(1));//录取号
+                        studentData.setAdmissNum(assNum);
+                        String name = dataFormatter.formatCellValue(row.getCell(2));//姓名
+                        studentData.setName(name);
+                        String cardId = dataFormatter.formatCellValue(row.getCell(3));//身份证号
+                        studentData.setCardId(cardId);
+
+                        String school = dataFormatter.formatCellValue(row.getCell(4));//校区
+                        studentData.setSchool(school);
+
+                        //region 院系专业
+                        String college = dataFormatter.formatCellValue(row.getCell(5));//院系
+                        Optional<WelcomeOrg> owo = ws.stream().filter(e -> e.getName().equals(college)).findFirst();
+                        if (owo != null && owo.isPresent()) {
+                            studentData.setCollege(college);
+                            studentData.setCollegeId(owo.get().getId());
+                        }
+
+                        String major = dataFormatter.formatCellValue(row.getCell(6));//专业
+                        Optional<WelcomeOrg> omwo = ws.stream().filter(e -> e.getName().equals(major)).findFirst();
+                        if (omwo != null && omwo.isPresent()) {
+                            studentData.setMajor(major);
+                            studentData.setMajorId(omwo.get().getId());
+                        }
+
+                        String classstr = dataFormatter.formatCellValue(row.getCell(7));//班级
+                        Optional<WelcomeOrg> ocwo = ws.stream().filter(e -> e.getName().equals(classstr)).findFirst();
+                        if (ocwo != null && ocwo.isPresent()) {
+                            studentData.setClassstr(classstr);
+                            studentData.setClassstrId(ocwo.get().getId());
+                        }
+                        //endregion
+
+                        String examNum = dataFormatter.formatCellValue(row.getCell(8));//考生号
+                        studentData.setExamNum(examNum);
+
+                        String eduSystem = dataFormatter.formatCellValue(row.getCell(9));//学制
+                        studentData.setEduSystem(eduSystem);
+
+                        String graSchool = dataFormatter.formatCellValue(row.getCell(10));//毕业中学
+                        studentData.setGraduationSchool(graSchool);
+
+                        String batchValue = dataFormatter.formatCellValue(row.getCell(11));//批次
+                        studentData.setBatchValue(batchValue);
+
+                        String politicalStatu = dataFormatter.formatCellValue(row.getCell(12));//政治面貌
+                        studentData.setPoliticalStatu(politicalStatu);
+
+                        String nationality = dataFormatter.formatCellValue(row.getCell(13));//民族
+                        studentData.setNationality(nationality);
+
+                        String phone = dataFormatter.formatCellValue(row.getCell(14));//手机号码
+                        studentData.setPhone(phone);
+
+                        //region 籍贯
+                        String nativePlace = dataFormatter.formatCellValue(row.getCell(15));//籍贯
+                        String[] addressDatas = nativePlace.split("/");
+                        if (citys != null && citys.size() > 0) {
+                            if (addressDatas != null && addressDatas.length >= 1) {
+                                if (!addressDatas[0].contains("省")) {
+                                    return CommonResult.fail("录取编号为\" + assNum + \"的籍贯格式应该是 省/市/县");
+                                }
+                                Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getDistrictZh().equals(addressDatas[0])).findFirst();
+                                if (oProvince != null && oProvince.isPresent()) {
+                                    studentData.setOprovince(addressDatas[0]);
+                                    studentData.setOprovinceId(oProvince.get().getId());
+                                } else {
+                                    return CommonResult.fail("录取编号为" + assNum + "的籍贯格式应该是 省/市/县");
+                                }
+                            }
+                            if (addressDatas != null && addressDatas.length >= 2) {
+                                Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getDistrictZh().equals(addressDatas[1])).findFirst();
+                                if (oProvince != null && oProvince.isPresent()) {
+                                    studentData.setOcity(addressDatas[1]);
+                                    studentData.setOcityId(oProvince.get().getId());
+                                } else {
+                                    return CommonResult.fail("录取编号为" + assNum + "的籍贯格式应该是 省/市/县");
+                                }
+                            }
+                            if (addressDatas != null && addressDatas.length >= 3) {
+                                Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getCityZh().equals(addressDatas[1]) && e.getDistrictZh().equals(addressDatas[2])).findFirst();
+                                if (oProvince != null && oProvince.isPresent()) {
+                                    studentData.setOdistrict(addressDatas[2]);
+                                    studentData.setOdistrictId(oProvince.get().getId());
+                                } else {
+                                    return CommonResult.fail("录取编号为" + assNum + "的籍贯格式应该是 省/市/县");
+                                }
+                            }
+                        }
+                        //endregion
+
+                        //region 家庭住址
+                        String addressPlace = dataFormatter.formatCellValue(row.getCell(16));//家庭住址
+                        String[] addressPlaces = addressPlace.split("/");
+                        if (citys != null && citys.size() > 0) {
+                            if (addressPlaces != null && addressPlaces.length >= 1) {
+                                if (!addressPlaces[0].contains("省")) {
+                                    return CommonResult.fail("录取编号为" + assNum + "的家庭住址格式应该是 省/市/县");
+                                }
+                                Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getDistrictZh().equals(addressPlaces[0])).findFirst();
+                                if (oProvince != null && oProvince.isPresent()) {
+                                    studentData.setProvince(addressPlaces[0]);
+                                    studentData.setProvinceId(oProvince.get().getId());
+                                } else {
+                                    return CommonResult.fail("录取编号为" + assNum + "的家庭住址格式应该是 省/市/县");
+                                }
+                            }
+                            if (addressPlaces != null && addressPlaces.length >= 2) {
+                                Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getDistrictZh().equals(addressPlaces[1])).findFirst();
+                                if (oProvince != null && oProvince.isPresent()) {
+                                    studentData.setCity(addressPlaces[1]);
+                                    studentData.setCityId(oProvince.get().getId());
+                                } else {
+                                    return CommonResult.fail("录取编号为" + assNum + "的家庭住址格式应该是 省/市/县");
+                                }
+                            }
+                            if (addressPlaces != null && addressPlaces.length >= 3) {
+                                Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getCityZh().equals(addressPlaces[1]) && e.getDistrictZh().equals(addressPlaces[2])).findFirst();
+                                if (oProvince != null && oProvince.isPresent()) {
+                                    studentData.setDistrict(addressPlaces[2]);
+                                    studentData.setDistrictId(oProvince.get().getId());
+                                } else {
+                                    return CommonResult.fail("录取编号为" + assNum + "的家庭住址格式应该是 省/市/县");
+                                }
+                            }
+                        }
+                        //endregion
+
+                        String addressDetail = dataFormatter.formatCellValue(row.getCell(17));//详细住址
+                        studentData.setAddress(addressDetail);
+
+                        String zipCode = dataFormatter.formatCellValue(row.getCell(18));//邮编
+                        studentData.setZipCode(zipCode);
+
+                        result.add(studentData);
+                    }
+                }
+            }
+        } catch (Exception e) {
+            return CommonResult.fail("请按模板格式导入数据");
+        }
+
+        return CommonResult.ok(result);
+    }
+
+
+    @Override
+    public CommonResult downloadStudentExcel() {
+        return CommonResult.ok("200", "操作成功", "https://chtech.ncjti.edu.cn/alumnus/homeimage/学生信息管理.xlsx");
+    }
+
+    @Override
+    public void jgcloudProjectExport(HttpServletResponse response, Integer collegeId, Integer majorId, Integer classstrId, String trafficMethod, String name) {
+        List<StudentPageVo> result = welcomeStudentService.queryStudentList(collegeId, majorId, classstrId, trafficMethod, name);
+        //导出
+        Workbook workbook = new XSSFWorkbook();
+        Sheet sheet = workbook.createSheet("学生信息");
+
+        Row headerRow = sheet.createRow(0);
+        headerRow.createCell(0).setCellValue("序号");
+        headerRow.createCell(1).setCellValue("录取号");
+        headerRow.createCell(2).setCellValue("姓名");
+        headerRow.createCell(3).setCellValue("身份证号");
+        headerRow.createCell(4).setCellValue("院系");
+        headerRow.createCell(5).setCellValue("专业");
+        headerRow.createCell(6).setCellValue("班级");
+        headerRow.createCell(7).setCellValue("交通方式");
+        headerRow.createCell(8).setCellValue("到站地点");
+        headerRow.createCell(9).setCellValue("陪同人数");
+        headerRow.createCell(10).setCellValue("填报状态");
+        headerRow.createCell(11).setCellValue("应缴金额");
+        headerRow.createCell(12).setCellValue("实付金额");
+        headerRow.createCell(13).setCellValue("宿舍信息");
+        for (int i = 0; i < result.size(); i++) {
+            StudentPageVo studentData = result.get(i);
+            Row dataRow = sheet.createRow(i + 1);
+            dataRow.createCell(0).setCellValue(i + 1);
+            dataRow.createCell(1).setCellValue(studentData.getAdmissNum());
+            dataRow.createCell(2).setCellValue(studentData.getName());
+            dataRow.createCell(3).setCellValue(studentData.getCardId());
+            dataRow.createCell(4).setCellValue(studentData.getCollege());
+            dataRow.createCell(5).setCellValue(studentData.getMajor());
+            dataRow.createCell(6).setCellValue(studentData.getClassstr());
+            dataRow.createCell(7).setCellValue(studentData.getTrafficMethod());
+            dataRow.createCell(8).setCellValue(studentData.getArrive());
+            dataRow.createCell(9).setCellValue(studentData.getAccompanyNum());
+            dataRow.createCell(10).setCellValue(studentData.getFillStatus());
+            dataRow.createCell(11).setCellValue(String.valueOf(studentData.getAmountPayable()));
+            dataRow.createCell(12).setCellValue(String.valueOf(studentData.getPayAmount()));
+            dataRow.createCell(13).setCellValue(studentData.getDormitory());
+        }
+        // 将工作簿写入文件
+        ExcelUtils.excelDownload(workbook, "学生信息.xlsx", response);
+    }
 }
 

+ 4 - 0
src/main/java/com/template/mapper/WelcomeStudentMapper.java

@@ -7,6 +7,8 @@ import com.template.model.vo.StudentPageVo;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
  * <p>
  *  Mapper 接口
@@ -18,4 +20,6 @@ import org.springframework.stereotype.Repository;
 @Repository
 public interface WelcomeStudentMapper extends BaseMapper<WelcomeStudent> {
     IPage<StudentPageVo> queryStudentPageList(IPage<StudentPageVo> page, @Param("collegeId") Integer collegeId,@Param("majorId") Integer majorId,@Param("classstrId") Integer classstrId,@Param("trafficMethod") String trafficMethod ,@Param("name") String name);
+
+    List<StudentPageVo> queryStudentList(@Param("collegeId") Integer collegeId, @Param("majorId") Integer majorId, @Param("classstrId") Integer classstrId, @Param("trafficMethod") String trafficMethod , @Param("name") String name);
 }

+ 32 - 0
src/main/java/com/template/model/enumModel/eFileType.java

@@ -0,0 +1,32 @@
+package com.template.model.enumModel;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/7/17 星期一 9:50
+ * @Description: com.repair.model.enumModel
+ * @Version: 1.0
+ */
+public enum eFileType {
+    Xls("application/vnd.ms-excel"),//非超级管理员
+    Xlsx("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");//超级管理员
+
+    private String value;
+
+    eFileType(String value){
+        this.value = value;
+    }
+
+    public String getValue() {
+        return value;
+    }
+    public static eFileType typeValueOf(String value) {
+        switch (value) {
+            case "application/vnd.ms-excel":
+                return eFileType.Xls;
+            case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
+                return eFileType.Xlsx;
+            default:
+                return null;
+        }
+    }
+}

+ 3 - 0
src/main/java/com/template/model/pojo/WelcomeStudent.java

@@ -53,6 +53,9 @@ public class WelcomeStudent implements Serializable {
     @ApiModelProperty(value = "出生年月")
     private String birthday;
 
+    @ApiModelProperty(value = "校区")
+    private String school;
+
     @ApiModelProperty(value = "院系")
     private String college;
 

+ 3 - 0
src/main/java/com/template/model/request/InfoCollectionRequest.java

@@ -40,6 +40,9 @@ public class InfoCollectionRequest {
     @ApiModelProperty(value = "出生年月")
     private String birthday;
 
+    @ApiModelProperty(value = "校区")
+    private String school;
+
     @ApiModelProperty(value = "院系")
     private String college;
 

+ 3 - 0
src/main/java/com/template/model/request/InsertStudentRequest.java

@@ -41,6 +41,9 @@ public class InsertStudentRequest implements Serializable {
     @ApiModelProperty(value = "出生年月")
     private String birthday;
 
+    @ApiModelProperty(value = "校区")
+    private String school;
+
     @ApiModelProperty(value = "院系")
     private String college;
 

+ 146 - 0
src/main/java/com/template/model/request/updateStudentRequest.java

@@ -0,0 +1,146 @@
+package com.template.model.request;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @author ceshi
+ * @since 2025-06-13
+ */
+@Data
+public class updateStudentRequest implements Serializable {
+
+    @ApiModelProperty(value = "数据ID")
+    private Integer id;
+
+    @ApiModelProperty(value = "录取号")
+    private String admissNum;
+
+    @ApiModelProperty(value = "姓名")
+    private String name;
+
+    @ApiModelProperty(value = "照片")
+    private String picture;
+
+    @ApiModelProperty(value = "身份证号")
+    private String cardId;
+
+    @ApiModelProperty(value = "性别")
+    private String sex;
+
+    @ApiModelProperty(value = "出生年月")
+    private String birthday;
+
+    @ApiModelProperty(value = "校区")
+    private String school;
+
+    @ApiModelProperty(value = "院系")
+    private String college;
+
+    @ApiModelProperty(value = "专业")
+    private String major;
+
+    @ApiModelProperty(value = "班级")
+    private String classstr;
+
+    @ApiModelProperty(value = "院系ID")
+    private Integer collegeId;
+
+    @ApiModelProperty(value = "专业ID")
+    private Integer majorId;
+
+    @ApiModelProperty(value = "班级ID")
+    private Integer classstrId;
+
+    @ApiModelProperty(value = "考生号")
+    private String examNum;
+
+    @ApiModelProperty(value = "学制")
+    private String eduSystem;
+
+    @ApiModelProperty(value = "毕业中学")
+    private String graduationSchool;
+
+    @ApiModelProperty(value = "批次")
+    private String batchValue;
+
+    @ApiModelProperty(value = "政治面貌")
+    private String politicalStatu;
+
+    @ApiModelProperty(value = "民族")
+    private String nationality;
+
+    @ApiModelProperty(value = "手机号码")
+    private String phone;
+
+    @ApiModelProperty(value = "籍贯省")
+    private Integer oprovinceId;
+
+    @ApiModelProperty(value = "籍贯市")
+    private Integer ocityId;
+
+    @ApiModelProperty(value = "籍贯区")
+    private Integer odistrictId;
+
+    @ApiModelProperty(value = "省ID")
+    private Integer provinceId;
+
+    @ApiModelProperty(value = "市ID")
+    private Integer cityId;
+
+    @ApiModelProperty(value = "区ID")
+    private Integer districtId;
+
+    @ApiModelProperty(value = "家庭住址")
+    private String address;
+
+    @ApiModelProperty(value = "交通方式")
+    private String trafficMethod;
+
+    @ApiModelProperty(value = "到站地点")
+    private String arrive;
+
+    @ApiModelProperty(value = "到站日期")
+    private Date arrvieDate;
+
+    @ApiModelProperty(value = "到站时间")
+    private String arriveTime;
+
+//    @ApiModelProperty(value = "应缴金额")
+//    private BigDecimal amountPayable;
+//
+//    @ApiModelProperty(value = "实付金额")
+//    private BigDecimal payAmount;
+//
+//    @ApiModelProperty(value = "是否自驾")
+//    private Integer isDrive;
+//
+//    @ApiModelProperty(value = "车牌号")
+//    private String carNumber;
+
+    //家庭成员
+    private List<InsertFamilyRequest> familys;
+
+    //陪同人员
+    private List<InsertAccompanyRequest> accompanys;
+
+    //楼栋
+    private String bilding;
+
+    //寝室号
+    private String dormitory;
+
+    //床位号
+    private String bednum;
+
+
+
+}

+ 3 - 0
src/main/java/com/template/model/vo/StudentDetailVo.java

@@ -39,6 +39,9 @@ public class StudentDetailVo {
     @ApiModelProperty(value = "出生年月")
     private String birthday;
 
+    @ApiModelProperty(value = "校区")
+    private String school;
+
     @ApiModelProperty(value = "院系")
     private String college;
 

+ 3 - 0
src/main/java/com/template/model/vo/wxLoginVo.java

@@ -36,6 +36,9 @@ public class wxLoginVo {
     @ApiModelProperty(value = "出生年月")
     private String birthday;
 
+    @ApiModelProperty(value = "校区")
+    private String school;
+
     @ApiModelProperty(value = "院系")
     private String college;
 

+ 10 - 4
src/main/java/com/template/services/WelcomeStudentService.java

@@ -8,9 +8,11 @@ import com.template.model.result.PageUtils;
 import com.template.model.vo.StudentPageVo;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 /**
  * <p>
- *  服务类
+ * 服务类
  * </p>
  *
  * @author ceshi
@@ -25,11 +27,15 @@ public interface WelcomeStudentService extends IService<WelcomeStudent> {
 
     WelcomeStudent getManageById(Integer id);
 
-    int existStudentInfo(String admissNum,String cardId);
+    int existStudentInfo(String admissNum, String cardId);
 
     WelcomeStudent getDataByIdcard(String cardId);
 
-    PageUtils<StudentPageVo> queryStudentPageList(int currentPage, int pageCount, Integer collegeId, Integer majorId, Integer classstrId, String trafficMethod ,String name);
+    PageUtils<StudentPageVo> queryStudentPageList(int currentPage, int pageCount, Integer collegeId, Integer majorId, Integer classstrId, String trafficMethod, String name);
+
+    WelcomeStudent getDataByIdcardOrNum(String admissNum, String cardId);
+
+    List<WelcomeStudent> queryStudentByCardId(List<String> cardIds);
 
-    WelcomeStudent getDataByIdcardOrNum(String admissNum,String cardId);
+    List<StudentPageVo> queryStudentList(Integer collegeId, Integer majorId, Integer classstrId, String trafficMethod, String name);
 }

+ 16 - 0
src/main/java/com/template/services/impl/WelcomeStudentServiceImpl.java

@@ -84,6 +84,13 @@ public class WelcomeStudentServiceImpl extends ServiceImpl<WelcomeStudentMapper,
     }
 
     @Override
+    public List<StudentPageVo> queryStudentList( Integer collegeId, Integer majorId, Integer classstrId, String trafficMethod, String name) {
+
+        List<StudentPageVo> result = welcomeStudentMapper.queryStudentList(collegeId, majorId, classstrId, trafficMethod, name);
+        return result;
+    }
+
+    @Override
     public WelcomeStudent getDataByIdcardOrNum(String admissNum, String cardId) {
         QueryWrapper<WelcomeStudent> queryWrapper = new QueryWrapper<>();
         queryWrapper.and(e -> e.eq(StringUtils.hasText(admissNum), "admiss_num", admissNum)
@@ -92,4 +99,13 @@ public class WelcomeStudentServiceImpl extends ServiceImpl<WelcomeStudentMapper,
         List<WelcomeStudent> result = welcomeStudentMapper.selectList(queryWrapper);
         return (result != null && result.size() > 0) ? result.get(0) : new WelcomeStudent();
     }
+
+    @Override
+    public List<WelcomeStudent> queryStudentByCardId(List<String> cardIds) {
+        QueryWrapper<WelcomeStudent> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in(cardIds != null && cardIds.size() > 0, "card_id", cardIds);//身份证号
+        List<WelcomeStudent> result = welcomeStudentMapper.selectList(queryWrapper);
+        return (cardIds != null && cardIds.size() > 0) ? result : null;
+    }
+
 }