考试成绩录入
考试成绩批量导入导出 考试中心首页搜索功能 bug修改
This commit is contained in:
parent
53a86197a4
commit
6ef0b9bbe2
@ -1,7 +1,14 @@
|
||||
package cn.com.tenlion.controller.api.applystudents;
|
||||
|
||||
import cn.com.tenlion.listener.ImportExcelListener;
|
||||
import cn.com.tenlion.pojo.dtos.excel.ImportFailDto;
|
||||
import cn.com.tenlion.pojo.model.ApplyStudentsModel;
|
||||
import cn.com.tenlion.service.handleimportexcel.IHandleImportExcelService;
|
||||
import cn.com.tenlion.util.ExcelUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.result.ErrorResult;
|
||||
@ -12,9 +19,15 @@ import cn.com.tenlion.pojo.dtos.applystudents.ApplyStudentsDTO;
|
||||
import cn.com.tenlion.pojo.vos.applystudents.ApplyStudentsVO;
|
||||
import cn.com.tenlion.service.applystudents.IApplyStudentsService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -33,6 +46,9 @@ public class ApplyStudentsController extends DefaultBaseController {
|
||||
|
||||
@Autowired
|
||||
private IApplyStudentsService applyStudentsService;
|
||||
@Autowired
|
||||
private IHandleImportExcelService handleImportExcelService;
|
||||
private List<ImportFailDto> failDtoList;
|
||||
|
||||
@ApiOperation(value = "获取班级学生列表", notes = "获取班级学生列表接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@ -117,4 +133,87 @@ public class ApplyStudentsController extends DefaultBaseController {
|
||||
return new SuccessResultData<>(applyStudentsService.count(params));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导入考试成绩", notes = "导入考试成绩接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("importexcel")
|
||||
public SuccessResultData importExcel(@RequestParam("file") MultipartFile file, HttpServletResponse response) throws Exception {
|
||||
ImportExcelListener listener = new ImportExcelListener(handleImportExcelService, ApplyStudentsModel.class);
|
||||
// 读取数据
|
||||
ExcelUtil.readExcel(file, 0, 1, listener, ApplyStudentsModel.class);
|
||||
// 错误集
|
||||
List<ImportFailDto> importFailDtoList = listener.getImportFailDtoList();
|
||||
if(!importFailDtoList.isEmpty()) {
|
||||
failDtoList = importFailDtoList;
|
||||
return new SuccessResultData(importFailDtoList.size());
|
||||
}
|
||||
return new SuccessResultData("success");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导出考试成绩失败信息", notes = "导入考试成绩失败接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("exportexcel")
|
||||
public void exportExcel(HttpServletResponse response) throws IOException {
|
||||
String excelName = "学员成绩失败数据";
|
||||
String fileName = URLEncoder.encode(excelName, "UTF-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
|
||||
String [] headers = {"班号", "姓名", "考生身份证号码", "成绩", "失败原因"};
|
||||
List<List<String>> listHeader = new ArrayList<>();
|
||||
for(String item : headers) {
|
||||
List<String> title = new ArrayList<>();
|
||||
title.add(item);
|
||||
listHeader.add(title);
|
||||
}
|
||||
|
||||
List<List<Object>> listData = new ArrayList<>();
|
||||
for (ImportFailDto dto : failDtoList) {
|
||||
List<Object> data = new ArrayList<>();
|
||||
ApplyStudentsModel applyStudentsModel = new ApplyStudentsModel();
|
||||
BeanUtils.copyProperties(dto.getObject(), applyStudentsModel);
|
||||
data.add(applyStudentsModel.getPlanNumber());
|
||||
data.add(applyStudentsModel.getUserName());
|
||||
data.add(applyStudentsModel.getCardNumber());
|
||||
data.add(applyStudentsModel.getScore());
|
||||
data.add(dto.getErrMsg());
|
||||
listData.add(data);
|
||||
}
|
||||
EasyExcel.write(response.getOutputStream()).sheet("学员成绩导入失败数据").head(listHeader).doWrite(listData);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导出考试成绩失败信息", notes = "导入考试成绩失败接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("export-excel-more")
|
||||
public void exportExcelMore(HttpServletResponse response) throws IOException {
|
||||
Map<String, Object> params = requestParams();
|
||||
String excelName = "学员成绩数据";
|
||||
String fileName = URLEncoder.encode(excelName, "UTF-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
|
||||
String [] headers = {"班号", "姓名", "考生身份证号码", "考试机构", "考试开始时间", "考试结束时间", "成绩", "失败原因"};
|
||||
List<List<String>> listHeader = new ArrayList<>();
|
||||
for(String item : headers) {
|
||||
List<String> title = new ArrayList<>();
|
||||
title.add(item);
|
||||
listHeader.add(title);
|
||||
}
|
||||
|
||||
List<ApplyStudentsDTO> applyStudentsDTOS = applyStudentsService.list(params);
|
||||
if(null == applyStudentsDTOS || applyStudentsDTOS.size() <= 0) {
|
||||
throw new SearchException("暂无数据,导出失败");
|
||||
}
|
||||
List<List<Object>> listData = new ArrayList<>();
|
||||
for (ApplyStudentsDTO dto : applyStudentsDTOS) {
|
||||
List<Object> data = new ArrayList<>();
|
||||
data.add(dto.getClassPlanDTO().getPlanNumber());
|
||||
data.add(dto.getApplyName());
|
||||
data.add(dto.getApplyCardNumber());
|
||||
data.add(dto.getClassPlanDTO().getOrgName());
|
||||
data.add(dto.getExamStartTime());
|
||||
data.add(dto.getExamEndTime());
|
||||
data.add(dto.getApplyTestScores());
|
||||
listData.add(data);
|
||||
}
|
||||
EasyExcel.write(response.getOutputStream()).sheet("学员成绩数据").head(listHeader).doWrite(listData);
|
||||
}
|
||||
|
||||
}
|
@ -36,6 +36,8 @@ public class IndexWebController extends DefaultBaseController {
|
||||
private final static String ROLE_CODE_2 = "0002";
|
||||
/*考试机构角色*/
|
||||
private final static String ROLE_CODE_3 = "0003";
|
||||
/*考试中心角色*/
|
||||
private final static String ROLE_CODE_4 = "0004";
|
||||
|
||||
|
||||
@ApiOperation(value = "角色统计页面", notes = "角色统计页面接口")
|
||||
@ -60,6 +62,10 @@ public class IndexWebController extends DefaultBaseController {
|
||||
mv.setViewName("index3");
|
||||
break;
|
||||
}
|
||||
if (ROLE_CODE_4.equals(role.getRoleCode())){
|
||||
mv.setViewName("index4");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return mv;
|
||||
}
|
||||
|
38
src/main/java/cn/com/tenlion/dao/excel/IExcelDao.java
Normal file
38
src/main/java/cn/com/tenlion/dao/excel/IExcelDao.java
Normal file
@ -0,0 +1,38 @@
|
||||
package cn.com.tenlion.dao.excel;
|
||||
|
||||
import cn.com.tenlion.pojo.dtos.excel.ExcelDTO;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: IExcelDao
|
||||
* @Description: 导入excel时相关操作
|
||||
* @Author: renpc
|
||||
* @Date: 2021-02-28 15:38
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Repository
|
||||
public interface IExcelDao {
|
||||
|
||||
/**
|
||||
* 字段比对数据库(字典)
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
ExcelDTO checkDataFromDict(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 字段比对数据库(区域)
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
ExcelDTO checkDataFromArea(Map<String, Object> params) throws SearchException;
|
||||
|
||||
|
||||
}
|
216
src/main/java/cn/com/tenlion/listener/ImportExcelListener.java
Normal file
216
src/main/java/cn/com/tenlion/listener/ImportExcelListener.java
Normal file
@ -0,0 +1,216 @@
|
||||
package cn.com.tenlion.listener;
|
||||
|
||||
import cn.com.tenlion.pojo.dtos.excel.ImportFailDto;
|
||||
import cn.com.tenlion.pojo.dtos.excel.ImportSuccessDto;
|
||||
import cn.com.tenlion.pojo.model.ApplyStudentsModel;
|
||||
import cn.com.tenlion.service.handleimportexcel.IHandleImportExcelService;
|
||||
import cn.com.tenlion.util.ImportExcelHelper;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import com.alibaba.excel.exception.ExcelAnalysisException;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 导入excel的监听处理类
|
||||
* @author renpc
|
||||
*/
|
||||
public class ImportExcelListener<T> extends AnalysisEventListener<T>{
|
||||
|
||||
private static final int BATCH_COUNT = 1000;
|
||||
|
||||
/**
|
||||
* 导入成功的数据
|
||||
*/
|
||||
private List<ImportSuccessDto> importSuccessDtoList = new ArrayList<>();
|
||||
/**
|
||||
* 导入失败的数据
|
||||
*/
|
||||
private List<ImportFailDto> importFailDtoList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 保存数据库专用list
|
||||
*/
|
||||
private List<T> list = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 去重专用list
|
||||
*/
|
||||
private List<T> listForDistinct = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 处理导入数据的逻辑
|
||||
*/
|
||||
private IHandleImportExcelService handleImportExcelService;
|
||||
|
||||
private Class<T> tClass;
|
||||
|
||||
public List<ImportSuccessDto> getImportSuccessDtoList() {
|
||||
return importSuccessDtoList;
|
||||
}
|
||||
|
||||
public void setImportSuccessDtoList(List<ImportSuccessDto> importSuccessDtoList) {
|
||||
this.importSuccessDtoList = importSuccessDtoList;
|
||||
}
|
||||
|
||||
public List<ImportFailDto> getImportFailDtoList() {
|
||||
return importFailDtoList;
|
||||
}
|
||||
|
||||
public void setImportFailDtoList(List<ImportFailDto> importFailDtoList) {
|
||||
this.importFailDtoList = importFailDtoList;
|
||||
}
|
||||
|
||||
public List<T> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<T> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public IHandleImportExcelService getHandleImportExcelService() {
|
||||
return handleImportExcelService;
|
||||
}
|
||||
|
||||
public void setHandleImportExcelService(IHandleImportExcelService handleImportExcelService) {
|
||||
this.handleImportExcelService = handleImportExcelService;
|
||||
}
|
||||
|
||||
public Class<T> gettClass() {
|
||||
return tClass;
|
||||
}
|
||||
|
||||
public void settClass(Class<T> tClass) {
|
||||
this.tClass = tClass;
|
||||
}
|
||||
|
||||
public ImportExcelListener(IHandleImportExcelService handleImportExcelService) {
|
||||
this.handleImportExcelService = handleImportExcelService;
|
||||
}
|
||||
|
||||
public ImportExcelListener(IHandleImportExcelService handleImportExcelService, Class<T> tClass) {
|
||||
this.handleImportExcelService = handleImportExcelService;
|
||||
this.tClass = tClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据的处理逻辑
|
||||
* @param t
|
||||
* @param analysisContext
|
||||
*/
|
||||
@Override
|
||||
public void invoke(T t, AnalysisContext analysisContext) {
|
||||
// 错误提示
|
||||
String msg = "";
|
||||
try {
|
||||
msg = ImportExcelHelper.checkDataValid(t);
|
||||
}catch (Exception e){
|
||||
msg = "存在空数据";
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// 如果校验失败
|
||||
if(msg.length() != 0){
|
||||
ImportFailDto importFailDto = new ImportFailDto(t, msg);
|
||||
importFailDtoList.add(importFailDto);
|
||||
}else{
|
||||
ImportExcelHelper.checkDataFromDatabase(t);
|
||||
list.add(t);
|
||||
listForDistinct.add(t);
|
||||
}
|
||||
|
||||
if(list.size() > BATCH_COUNT){
|
||||
try {
|
||||
insertData();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 所有数据处理完之后的处理方法
|
||||
* @param analysisContext
|
||||
*/
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
|
||||
// PS:之所以最后这里还进行处理是防止最后一次的数据量没有达到批量值
|
||||
if(list.size() > 0) {
|
||||
try {
|
||||
insertData();
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验导入的表格的头是否匹配
|
||||
* @param headMap
|
||||
* @param analysisContext
|
||||
*/
|
||||
@Override
|
||||
public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext analysisContext){
|
||||
super.invokeHeadMap(headMap, analysisContext);
|
||||
if(tClass != null){
|
||||
try {
|
||||
// 获取Excel导入实体的单元格内容
|
||||
Map<Integer, String> indexNameMap = getIndexName(tClass);
|
||||
Set<Integer> keySet = indexNameMap.keySet();
|
||||
for (Integer key: keySet) {
|
||||
// 头表是否存在空值
|
||||
if(headMap.get(key).length() == 0){
|
||||
throw new ExcelAnalysisException("Excel格式非法");
|
||||
}
|
||||
// 对比导入Excel实体模板和当前上传Excel是否匹配
|
||||
/*if(!headMap.get(key).equals(indexNameMap.get(key))){
|
||||
throw new ExcelAnalysisException("Excel格式非法");
|
||||
}*/
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Map<Integer, String> getIndexName(Class<T> tClass) throws NoSuchFieldException {
|
||||
Map<Integer, String> result = new HashMap<>();
|
||||
Field[] declaredFields = tClass.getDeclaredFields();
|
||||
for (Field currentField: declaredFields) {
|
||||
currentField.setAccessible(true);
|
||||
ExcelProperty annotation = currentField.getAnnotation(ExcelProperty.class);
|
||||
if(annotation != null){
|
||||
int index =annotation.index();
|
||||
String[] value = annotation.value();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String cur : value) {
|
||||
sb.append(cur);
|
||||
}
|
||||
result.put(index, sb.toString());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将数据插入数据库操作
|
||||
*/
|
||||
private void insertData() throws Exception {
|
||||
String value = "";
|
||||
// 出租房
|
||||
if(list.get(0) instanceof ApplyStudentsModel) {
|
||||
List<ApplyStudentsModel> applyStudentsModelList = (List<ApplyStudentsModel>) list;
|
||||
handleImportExcelService.updateApplyStudents(applyStudentsModelList, importFailDtoList);
|
||||
}
|
||||
listForDistinct.clear();
|
||||
list.clear();
|
||||
}
|
||||
|
||||
|
||||
}
|
57
src/main/java/cn/com/tenlion/pojo/dtos/excel/ExcelDTO.java
Normal file
57
src/main/java/cn/com/tenlion/pojo/dtos/excel/ExcelDTO.java
Normal file
@ -0,0 +1,57 @@
|
||||
package cn.com.tenlion.pojo.dtos.excel;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ClassName: ExcelDTO
|
||||
* @Description: 导入excel相关DTO
|
||||
* @Author: renpc
|
||||
* @Date: 2021-02-28 15:38
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class ExcelDTO {
|
||||
|
||||
@ApiModelProperty(name = "dictId", value = "字典表ID")
|
||||
private String dictId;
|
||||
@ApiModelProperty(name = "dictName", value = "字典表名称")
|
||||
private String dictName;
|
||||
@ApiModelProperty(name = "areaId", value = "区域表ID")
|
||||
private String areaId;
|
||||
@ApiModelProperty(name = "areaName", value = "字典表名称")
|
||||
private String areaName;
|
||||
|
||||
public String getDictId() {
|
||||
return dictId == null ? "" : dictId;
|
||||
}
|
||||
|
||||
public void setDictId(String dictId) {
|
||||
this.dictId = dictId;
|
||||
}
|
||||
|
||||
public String getDictName() {
|
||||
return dictName == null ? "" : dictName;
|
||||
}
|
||||
|
||||
public void setDictName(String dictName) {
|
||||
this.dictName = dictName;
|
||||
}
|
||||
|
||||
public String getAreaId() {
|
||||
return areaId == null ? "" : areaId;
|
||||
}
|
||||
|
||||
public void setAreaId(String areaId) {
|
||||
this.areaId = areaId;
|
||||
}
|
||||
|
||||
public String getAreaName() {
|
||||
return areaName == null ? "" : areaName;
|
||||
}
|
||||
|
||||
public void setAreaName(String areaName) {
|
||||
this.areaName = areaName;
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package cn.com.tenlion.pojo.dtos.excel;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 批量导入失败实体类
|
||||
* @author renpc
|
||||
*/
|
||||
public class ImportFailDto implements Serializable {
|
||||
|
||||
/**
|
||||
*导入实体信息
|
||||
*/
|
||||
private Object object;
|
||||
/**
|
||||
* 导入错误提示
|
||||
*/
|
||||
private String errMsg;
|
||||
|
||||
public ImportFailDto(Object object, String errMsg) {
|
||||
this.object = object;
|
||||
this.errMsg = errMsg;
|
||||
}
|
||||
|
||||
public Object getObject() {
|
||||
return object;
|
||||
}
|
||||
|
||||
public void setObject(Object object) {
|
||||
this.object = object;
|
||||
}
|
||||
|
||||
public String getErrMsg() {
|
||||
return errMsg == null ? "" : errMsg;
|
||||
}
|
||||
|
||||
public void setErrMsg(String errMsg) {
|
||||
this.errMsg = errMsg;
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package cn.com.tenlion.pojo.dtos.excel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 批量导入结果实体类
|
||||
* @author renpc
|
||||
*/
|
||||
public class ImportResultDto {
|
||||
|
||||
/**
|
||||
* 导入成功的消息列表
|
||||
*/
|
||||
private List<ImportSuccessDto> successDtoList;
|
||||
|
||||
/**
|
||||
* 导入失败的消息列表
|
||||
*/
|
||||
private List<ImportFailDto> failDtoList;
|
||||
|
||||
public ImportResultDto(List<ImportSuccessDto> successDtoList, List<ImportFailDto> failDtoList) {
|
||||
this.successDtoList = successDtoList;
|
||||
this.failDtoList = failDtoList;
|
||||
}
|
||||
|
||||
public ImportResultDto(List<ImportFailDto> failDtoList) {
|
||||
this.failDtoList = failDtoList;
|
||||
this.successDtoList = new ArrayList<>();
|
||||
}
|
||||
|
||||
public List<ImportSuccessDto> getSuccessDtoList() {
|
||||
if (successDtoList == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return successDtoList;
|
||||
}
|
||||
|
||||
public void setSuccessDtoList(List<ImportSuccessDto> successDtoList) {
|
||||
this.successDtoList = successDtoList;
|
||||
}
|
||||
|
||||
public List<ImportFailDto> getFailDtoList() {
|
||||
if (failDtoList == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return failDtoList;
|
||||
}
|
||||
|
||||
public void setFailDtoList(List<ImportFailDto> failDtoList) {
|
||||
this.failDtoList = failDtoList;
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package cn.com.tenlion.pojo.dtos.excel;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 批量导入成功实体类
|
||||
* @author renpc
|
||||
*/
|
||||
public class ImportSuccessDto implements Serializable {
|
||||
|
||||
private Object object;
|
||||
|
||||
public ImportSuccessDto(Object object) {
|
||||
this.object = object;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package cn.com.tenlion.pojo.model;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
/**
|
||||
* @author 29492
|
||||
* 考生成绩
|
||||
*/
|
||||
@ApiModel
|
||||
public class ApplyStudentsModel {
|
||||
|
||||
@ExcelProperty(index = 0)
|
||||
private String planNumber;
|
||||
@ExcelProperty(index = 1)
|
||||
private String userName;
|
||||
@ExcelProperty(index = 2)
|
||||
private String cardNumber;
|
||||
@ExcelProperty(index = 3)
|
||||
private String score;
|
||||
|
||||
public String getPlanNumber() {
|
||||
return planNumber;
|
||||
}
|
||||
|
||||
public void setPlanNumber(String planNumber) {
|
||||
this.planNumber = planNumber;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getCardNumber() {
|
||||
return cardNumber;
|
||||
}
|
||||
|
||||
public void setCardNumber(String cardNumber) {
|
||||
this.cardNumber = cardNumber;
|
||||
}
|
||||
|
||||
public String getScore() {
|
||||
return score;
|
||||
}
|
||||
|
||||
public void setScore(String score) {
|
||||
this.score = score;
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ import cn.com.tenlion.pojo.bos.applystudents.ApplyStudentsBO;
|
||||
import cn.com.tenlion.pojo.dtos.applystudents.ApplyStudentsDTO;
|
||||
import cn.com.tenlion.pojo.dtos.classplan.ClassPlanDTO;
|
||||
import cn.com.tenlion.pojo.dtos.examapply.ExamApplyDTO;
|
||||
import cn.com.tenlion.pojo.dtos.worktype.WorkTypeDTO;
|
||||
import cn.com.tenlion.pojo.pos.apply.ApplyPO;
|
||||
import cn.com.tenlion.pojo.pos.applystudents.ApplyStudentsPO;
|
||||
import cn.com.tenlion.pojo.vos.applystudents.ApplyStudentsVO;
|
||||
@ -14,6 +15,7 @@ import cn.com.tenlion.service.apply.IApplyService;
|
||||
import cn.com.tenlion.service.applystudents.IApplyStudentsService;
|
||||
import cn.com.tenlion.service.classplan.IClassPlanService;
|
||||
import cn.com.tenlion.service.examapply.IExamApplyService;
|
||||
import cn.com.tenlion.service.worktype.IWorkTypeService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
@ -27,10 +29,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @ClassName: ApplyStudentsServiceImpl
|
||||
@ -52,6 +51,8 @@ public class ApplyStudentsServiceImpl extends DefaultBaseService implements IApp
|
||||
private IInstitutionService iInstitutionService;
|
||||
@Autowired
|
||||
private IExamApplyService examApplyService;
|
||||
@Autowired
|
||||
private IWorkTypeService workTypeService;
|
||||
|
||||
|
||||
public String saveRelationReturnId(ApplyStudentsVO applyStudentsVO){
|
||||
@ -95,10 +96,6 @@ public class ApplyStudentsServiceImpl extends DefaultBaseService implements IApp
|
||||
return this.list(params);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void save(ApplyStudentsVO applyStudentsVO) {
|
||||
saveReturnId(applyStudentsVO);
|
||||
@ -207,16 +204,35 @@ public class ApplyStudentsServiceImpl extends DefaultBaseService implements IApp
|
||||
|
||||
@Override
|
||||
public List<ApplyStudentsDTO> list(Map<String, Object> params) {
|
||||
ClassPlanDTO searchClassPlanDto = null;
|
||||
if(!com.alibaba.excel.util.StringUtils.isEmpty(params.get("planNumber"))) {
|
||||
searchClassPlanDto = classPlanService.get(params);
|
||||
}
|
||||
if(null != searchClassPlanDto) {
|
||||
params.remove("keywords");
|
||||
}
|
||||
List<ApplyStudentsDTO> list = applyStudentsDao.list(params);
|
||||
if(null != list && list.size() > 0) {
|
||||
for(ApplyStudentsDTO applyStudentsDTO: list) {
|
||||
Iterator<ApplyStudentsDTO> applyStudentsDTOIterator = list.iterator();
|
||||
while (applyStudentsDTOIterator.hasNext()) {
|
||||
ApplyStudentsDTO applyStudentsDTO = applyStudentsDTOIterator.next();
|
||||
if(null != searchClassPlanDto) {
|
||||
if(!searchClassPlanDto.getClassPlanId().equals(applyStudentsDTO.getApplyClassId())) {
|
||||
applyStudentsDTOIterator.remove();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
ClassPlanDTO classPlanDTO = classPlanService.get(applyStudentsDTO.getApplyClassId());
|
||||
applyStudentsDTO.setClassPlanDTO(classPlanDTO);
|
||||
if(null != classPlanDTO) {
|
||||
/*if(null != classPlanDTO) {
|
||||
InstitutionDTO institutionDTO = iInstitutionService.get(classPlanDTO.getOrgId());
|
||||
if(null != institutionDTO) {
|
||||
applyStudentsDTO.setApplyWorkTypeName(institutionDTO.getInstitutionName());
|
||||
}
|
||||
}*/
|
||||
WorkTypeDTO workTypeDTO = workTypeService.get(applyStudentsDTO.getApplyWorkTypeId());
|
||||
if(null != workTypeDTO) {
|
||||
applyStudentsDTO.setApplyWorkTypeName(workTypeDTO.getWorkTypeName());
|
||||
}
|
||||
params.put("examId", applyStudentsDTO.getApplyClassId());
|
||||
ExamApplyDTO examApplyDTO = examApplyService.get(params);
|
||||
|
@ -0,0 +1,33 @@
|
||||
package cn.com.tenlion.service.handleimportexcel;
|
||||
|
||||
import cn.com.tenlion.pojo.dtos.excel.ImportFailDto;
|
||||
import cn.com.tenlion.pojo.dtos.excel.ImportResultDto;
|
||||
import cn.com.tenlion.pojo.model.ApplyStudentsModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: IHandleImportExcelService
|
||||
* @Description: 导入excel service
|
||||
* @Author: renpc
|
||||
* @Date: 2021-02-27 14:40
|
||||
* @Version: 1.0
|
||||
**/
|
||||
public interface IHandleImportExcelService {
|
||||
|
||||
/**
|
||||
* 数据校验
|
||||
*
|
||||
* @param list
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public <T> ImportResultDto checkImportData(List<T> list);
|
||||
|
||||
/**
|
||||
* 批量导入学员成绩
|
||||
* @param applyStudentsModelList
|
||||
* @param importFailDtoList
|
||||
*/
|
||||
void updateApplyStudents(List<ApplyStudentsModel> applyStudentsModelList, List<ImportFailDto> importFailDtoList);
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package cn.com.tenlion.service.handleimportexcel.impl;
|
||||
|
||||
import cn.com.tenlion.dao.applystudents.IApplyStudentsDao;
|
||||
import cn.com.tenlion.dao.classplan.IClassPlanDao;
|
||||
import cn.com.tenlion.pojo.dtos.classplan.ClassPlanDTO;
|
||||
import cn.com.tenlion.pojo.dtos.excel.ImportFailDto;
|
||||
import cn.com.tenlion.pojo.dtos.excel.ImportResultDto;
|
||||
import cn.com.tenlion.pojo.model.ApplyStudentsModel;
|
||||
import cn.com.tenlion.service.handleimportexcel.IHandleImportExcelService;
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: HandleImportExcelServiceImpl
|
||||
* @Description: 导入excel service
|
||||
* @Author: renpc
|
||||
* @Date: 2021-02-27 14:40
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Service
|
||||
public class HandleImportExcelServiceImpl extends DefaultBaseService implements IHandleImportExcelService {
|
||||
|
||||
@Autowired
|
||||
private IApplyStudentsDao applyStudentsDao;
|
||||
@Autowired
|
||||
private IClassPlanDao classPlanDao;
|
||||
|
||||
@Override
|
||||
public <T> ImportResultDto checkImportData(List<T> list) {
|
||||
return new ImportResultDto(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateApplyStudents(List<ApplyStudentsModel> applyStudentsModelList, List<ImportFailDto> importFailDtoList) {
|
||||
Map<String, Object> params = new HashMap<>(1);
|
||||
if(null != applyStudentsModelList) {
|
||||
for(ApplyStudentsModel applyStudentsModel: applyStudentsModelList) {
|
||||
// 通过班级编号获取班级ID
|
||||
params.put("planNumber", applyStudentsModel.getPlanNumber());
|
||||
ClassPlanDTO classPlanDTO = classPlanDao.get(params);
|
||||
if(null != classPlanDTO) {
|
||||
params.put("classPlanId", classPlanDTO.getClassPlanId());
|
||||
setUpdateInfo(params);
|
||||
}else {
|
||||
String msg = "班级编号不存在";
|
||||
ImportFailDto importFailDto = new ImportFailDto(applyStudentsModel, msg);
|
||||
importFailDtoList.add(importFailDto);
|
||||
continue;
|
||||
}
|
||||
params.put("applyTestScores", applyStudentsModel.getScore());
|
||||
applyStudentsDao.update(params);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
77
src/main/java/cn/com/tenlion/util/ExcelUtil.java
Normal file
77
src/main/java/cn/com/tenlion/util/ExcelUtil.java
Normal file
@ -0,0 +1,77 @@
|
||||
package cn.com.tenlion.util;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import com.alibaba.excel.support.ExcelTypeEnum;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* excel工具类
|
||||
* @author renpc
|
||||
*/
|
||||
public class ExcelUtil {
|
||||
|
||||
/**
|
||||
* 默认excel文件名和单元sheet名一样的 Excel文件导出
|
||||
* @param httpServletResponse
|
||||
* @param data
|
||||
* @param fileName
|
||||
* @param clazz
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void writeExcel(HttpServletResponse httpServletResponse, List data, String fileName, Class clazz) throws IOException {
|
||||
writeExcel(httpServletResponse, data, fileName, fileName, clazz);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据为Excel文件
|
||||
* @param response 响应实体
|
||||
* @param data 导出数据
|
||||
* @param fileName 文件名
|
||||
* @param sheetName 单元格名
|
||||
* @param clazz 定义excel导出的实体
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void writeExcel(HttpServletResponse response, List data, String fileName, String sheetName, Class clazz) throws IOException {
|
||||
//防止中文乱码
|
||||
fileName = URLEncoder.encode(fileName, "UTF-8");
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
//防止导入excel文件名中文不乱码
|
||||
response.setHeader("Content-disposition", "attachment;fileName=" + fileName + ".xlsx" + ";fileName*=utf-8''" + fileName + ".xlsx");
|
||||
EasyExcel.write(response.getOutputStream(), clazz).sheet(sheetName).doWrite(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* easyExcel处理上传的文件
|
||||
* @param sheetNo 单元格
|
||||
* @param rowNumber 行数
|
||||
* @param analysisEventListener 上传处理监听
|
||||
* @param clazz 上传处理excel类
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static List<Object> readExcel(MultipartFile file, Integer sheetNo, Integer rowNumber, AnalysisEventListener analysisEventListener, Class clazz) throws Exception {
|
||||
if(null != file) {
|
||||
String originalFilename = file.getOriginalFilename();
|
||||
if(StringUtils.isEmpty(originalFilename)){
|
||||
throw new Exception("上传的文件不能为空");
|
||||
}
|
||||
if(!originalFilename.toLowerCase().endsWith(ExcelTypeEnum.XLS.getValue()) &&
|
||||
!originalFilename.toLowerCase().endsWith(ExcelTypeEnum.XLSX.getValue())){
|
||||
throw new Exception("上传的文件格式不匹配");
|
||||
}
|
||||
InputStream inputStream = file.getInputStream();
|
||||
return EasyExcel.read(inputStream, clazz, analysisEventListener).sheet(sheetNo).headRowNumber(rowNumber).doReadSync();
|
||||
}
|
||||
throw new Exception("上传的文件不能为空");
|
||||
}
|
||||
|
||||
}
|
15
src/main/java/cn/com/tenlion/util/ImportErrorData.java
Normal file
15
src/main/java/cn/com/tenlion/util/ImportErrorData.java
Normal file
@ -0,0 +1,15 @@
|
||||
package cn.com.tenlion.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author xwangs
|
||||
* @create 2021-03-23 17:52
|
||||
* @description
|
||||
*/
|
||||
public class ImportErrorData {
|
||||
|
||||
public static Map<String, Object> errorData = new HashMap<>(36);
|
||||
|
||||
}
|
106
src/main/java/cn/com/tenlion/util/ImportExcelHelper.java
Normal file
106
src/main/java/cn/com/tenlion/util/ImportExcelHelper.java
Normal file
@ -0,0 +1,106 @@
|
||||
package cn.com.tenlion.util;
|
||||
|
||||
import cn.com.tenlion.dao.excel.IExcelDao;
|
||||
import cn.com.tenlion.pojo.model.ApplyStudentsModel;
|
||||
import cn.com.tenlion.service.handleimportexcel.IHandleImportExcelService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 导入excel数据的校验类
|
||||
* @author renpc
|
||||
*/
|
||||
@Component
|
||||
public class ImportExcelHelper {
|
||||
|
||||
@Autowired
|
||||
private IHandleImportExcelService handleImportExcelService;
|
||||
|
||||
|
||||
/**
|
||||
* excelDao
|
||||
*/
|
||||
private static IExcelDao excelDao;
|
||||
|
||||
|
||||
@Autowired
|
||||
public void init(IExcelDao excelDao) {
|
||||
ImportExcelHelper.excelDao = excelDao;
|
||||
}
|
||||
|
||||
public static <T> String checkDataValid(T obj) {
|
||||
if(null == obj) {
|
||||
return null;
|
||||
}
|
||||
String returnStr = isMustInput(obj);
|
||||
return returnStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查数据是否必填项缺失
|
||||
* @param obj
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
private static <T> String isMustInput(T obj) {
|
||||
// 出租房
|
||||
if(obj instanceof ApplyStudentsModel) {
|
||||
Object temp = obj;
|
||||
ApplyStudentsModel rentalHousingModel = (ApplyStudentsModel) temp;
|
||||
return checkApplyStudentsData(rentalHousingModel);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 从数据库比对数据,并转换为数据库数据
|
||||
* @param obj
|
||||
* @param <T>
|
||||
*/
|
||||
public static <T> void checkDataFromDatabase(T obj) {
|
||||
// 出租房
|
||||
if(obj instanceof ApplyStudentsModel) {
|
||||
Object temp = obj;
|
||||
ApplyStudentsModel applyStudentsModel = (ApplyStudentsModel) temp;
|
||||
applyStudentsCheck(applyStudentsModel);
|
||||
temp = applyStudentsModel;
|
||||
obj = (T) temp;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查数据是否必填项缺失(考生成绩)
|
||||
* @param applyStudentsModel
|
||||
* @return
|
||||
*/
|
||||
private static String checkApplyStudentsData(ApplyStudentsModel applyStudentsModel) {
|
||||
if(StringUtils.isEmpty(applyStudentsModel.getPlanNumber())) {
|
||||
return "班号必填";
|
||||
}
|
||||
if(StringUtils.isEmpty(applyStudentsModel.getUserName())) {
|
||||
return "考生姓名必填";
|
||||
}
|
||||
if(StringUtils.isEmpty(applyStudentsModel.getCardNumber())) {
|
||||
return "考生身份证号码必填";
|
||||
}
|
||||
if(StringUtils.isEmpty(applyStudentsModel.getScore())) {
|
||||
return "考生成绩必填";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 从数据库比对数据,并转换为数据库数据(考生成绩)
|
||||
* @param applyStudentsModel
|
||||
*/
|
||||
private static void applyStudentsCheck(ApplyStudentsModel applyStudentsModel) {
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -269,7 +269,13 @@
|
||||
gmt_modified = #{gmtModified},
|
||||
modifier = #{modifier}
|
||||
WHERE
|
||||
apply_id = #{applyId}
|
||||
1 = 1
|
||||
<if test="applyId != null and applyId != ''">
|
||||
AND apply_id = #{applyId}
|
||||
</if>
|
||||
<if test="classPlanId != null and classPlanId != ''">
|
||||
AND apply_class_id = #{classPlanId}
|
||||
</if>
|
||||
</update>
|
||||
|
||||
<!-- 班级学生表详情 -->
|
||||
@ -419,8 +425,7 @@
|
||||
t1.is_delete = 0
|
||||
<if test="keywords != null and keywords != ''">
|
||||
AND (
|
||||
<!-- 这里添加其他条件 -->
|
||||
t1.id LIKE CONCAT('%', #{keywords}, '%')
|
||||
t1.apply_card_number LIKE CONCAT('%', #{keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="applyClassId != null and applyClassId != ''">
|
||||
|
@ -485,6 +485,7 @@
|
||||
for(var i = 0, item; item = checkDatas[i++];) {
|
||||
if(item.checkStatus === 1 || item.checkStatus === 2) {
|
||||
top.dialog.msg('当前选择存在已经审核完成数据,请重新选择');
|
||||
reloadTable();
|
||||
return false;
|
||||
}
|
||||
if (i > 1) {
|
||||
|
@ -433,7 +433,11 @@
|
||||
} else {
|
||||
var ids = '';
|
||||
for(var i = 0, item; item = checkDatas[i++];) {
|
||||
debugger
|
||||
if(item.checkStatus != 0) {
|
||||
top.dialog.msg('当前选择存在已经审核完成数据,请重新选择');
|
||||
reloadTable();
|
||||
return false;
|
||||
}
|
||||
if(item.checkStatus == 0) {
|
||||
if(i > 1) {
|
||||
ids += '_';
|
||||
@ -443,8 +447,8 @@
|
||||
}
|
||||
if(ids.length <= 0) {
|
||||
top.dialog.msg('当前选择数据已经审核完成,请重新选择');
|
||||
reloadTable();
|
||||
return false;
|
||||
reloadTable();
|
||||
}
|
||||
checkMore(ids);
|
||||
}
|
||||
|
445
src/main/resources/static/route/insertscore/score-handle.html
Normal file
445
src/main/resources/static/route/insertscore/score-handle.html
Normal file
@ -0,0 +1,445 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<base href="/signup/">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="keywords" class="layui-input search-item" placeholder="身份证号/班级编号">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="startTime" class="layui-input search-item" placeholder="开始时间" readonly>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="endTime" class="layui-input search-item" placeholder="结束时间" readonly>
|
||||
</div>
|
||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||
<i class="fa fa-lg fa-search"></i> 搜索
|
||||
</button>
|
||||
</div>
|
||||
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
||||
<!-- 表头按钮组 -->
|
||||
<script type="text/html" id="headerToolBar">
|
||||
<div class="layui-btn-group">
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="importExcel">
|
||||
<i class="layui-icon-import"></i> 批量导入
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="exportExcel">
|
||||
<i class="layui-icon-export"></i> 批量导出
|
||||
</button>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
index: 'lib/index'
|
||||
}).use(['index', 'table', 'laydate', 'common' ,'upload'], function() {
|
||||
var $ = layui.$;
|
||||
var $win = $(window);
|
||||
var table = layui.table;
|
||||
var admin = layui.admin;
|
||||
var laydate = layui.laydate;
|
||||
var common = layui.common;
|
||||
var resizeTimeout = null;
|
||||
var tableUrl = 'api/applystudents/listpage';
|
||||
|
||||
// 初始化表格
|
||||
function initTable() {
|
||||
table.render({
|
||||
elem: '#dataTable',
|
||||
id: 'dataTable',
|
||||
url: top.restAjax.path(tableUrl, []),
|
||||
width: admin.screen() > 1 ? '100%' : '',
|
||||
height: $win.height() - 90,
|
||||
limit: 20,
|
||||
limits: [20, 40, 60, 80, 100, 200],
|
||||
request: {
|
||||
pageName: 'page',
|
||||
limitName: 'rows'
|
||||
},
|
||||
cols: [
|
||||
[
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field: 'planName', width: 180, title: '班级名称', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row.classPlanDTO[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'planNumber', width: 180, title: '班级编号', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row.classPlanDTO[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'planType', width: 180, title: '计划类型', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row.classPlanDTO[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
if('1' == rowData) {
|
||||
rowData = '初训';
|
||||
}else if('2' == rowData) {
|
||||
rowData = '复训';
|
||||
}else if('3' == rowData) {
|
||||
rowData = '换证 ';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'orgName', width: 180, title: '考试机构', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row.classPlanDTO[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'planStartTime', width: 180, title: '计划开始时间', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row.classPlanDTO[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'planEndTime', width: 180, title: '计划结束时间', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row.classPlanDTO[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'chargePerson', width: 180, title: '负责人', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row.classPlanDTO[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'chargePersonTel', width: 180, title: '联系方式', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row.classPlanDTO[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyWorkTypeName', width: 180, title: '报名工种', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyName', width: 180, title: '报名人姓名', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applySex', width: 180, title: '报名人性别 1男 2女【数据字典】', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyDataBirth', width: 180, title: '报名人出生日期', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyCardType', width: 180, title: '报名人证件类型【数据字典】', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyCardNumber', width: 180, title: '报名人证件号码', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyPhone', width: 180, title: '报名人手机号码', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyAddress', width: 180, title: '报名人通讯地址', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyCultureLevel', width: 180, title: '报名人文化程度【数据字典】', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyPostcode', width: 180, title: '报名人邮编', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyPhysicalState', width: 180, title: '报名人身体状态【数据字典】', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyUnitName', width: 180, title: '报名人单位名称', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyUnitPhone', width: 180, title: '报名人单位电话', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyUnitAddress', width: 180, title: '报名人单位地址', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyPosition', width: 180, title: '报名人职务', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyMajorYear', width: 180, title: '报名人从事专业年限', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyTechnicalTitles', width: 180, title: '报名人技术职称', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyTestScores', fixed: 'right', width: 180, title: '考试成绩', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '成绩暂未录入';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
page: true,
|
||||
parseData: function(data) {
|
||||
return {
|
||||
'code': 0,
|
||||
'msg': '',
|
||||
'count': data.total,
|
||||
'data': data.rows
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
// 重载表格
|
||||
function reloadTable(currentPage) {
|
||||
table.reload('dataTable', {
|
||||
url: top.restAjax.path(tableUrl, []),
|
||||
where: {
|
||||
keywords: $('#keywords').val(),
|
||||
planNumber: $('#keywords').val(),
|
||||
startTime: $('#startTime').val(),
|
||||
endTime: $('#endTime').val()
|
||||
},
|
||||
page: {
|
||||
curr: currentPage
|
||||
},
|
||||
height: $win.height() - 90,
|
||||
});
|
||||
}
|
||||
// 初始化日期
|
||||
function initDate() {
|
||||
// 日期选择
|
||||
laydate.render({
|
||||
elem: '#startTime',
|
||||
format: 'yyyy-MM-dd'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#endTime',
|
||||
format: 'yyyy-MM-dd'
|
||||
});
|
||||
}
|
||||
initTable();
|
||||
initDate();
|
||||
// 事件 - 页面变化
|
||||
$win.on('resize', function() {
|
||||
clearTimeout(resizeTimeout);
|
||||
resizeTimeout = setTimeout(function() {
|
||||
reloadTable();
|
||||
}, 500);
|
||||
});
|
||||
// 事件 - 搜索
|
||||
$(document).on('click', '#search', function() {
|
||||
reloadTable(1);
|
||||
});
|
||||
|
||||
// 导入功能
|
||||
function importExcel() {
|
||||
var uploadLoading;
|
||||
layui.upload.render({
|
||||
elem: '#importExcel'
|
||||
,url: 'api/applystudents/importexcel'
|
||||
,accept: 'file'
|
||||
,exts: 'xls|xlsx'
|
||||
,before: function() {
|
||||
uploadLoading = layer.msg('正在上传,请稍后...', {icon: 16, time: 0, shade: 0.3});
|
||||
}
|
||||
,done: function(data) {
|
||||
layer.close(uploadLoading);
|
||||
if(data.data != 'success') {
|
||||
layer.msg('导入成功,存在' + data.data + '条失败数据', {time: 2000}, function() {
|
||||
window.open(top.restAjax.path('api/applystudents/exportexcel', []));
|
||||
});
|
||||
} else {
|
||||
layer.msg('导入成功', {time: 2000}, function() {
|
||||
closeBox();
|
||||
reloadTable();
|
||||
});
|
||||
}
|
||||
}
|
||||
,error: function(data, index){
|
||||
layer.close(uploadLoading);
|
||||
if(data != null) {
|
||||
top.dialog.msg(data.msg);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
importExcel();
|
||||
|
||||
$(document).on('click', '#exportExcel', function() {
|
||||
excel();
|
||||
});
|
||||
|
||||
function excel(){
|
||||
top.dialog.msg('确定要导出数据吗?', {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function (index) {
|
||||
top.dialog.close(index);
|
||||
window.open(top.restAjax.path('api/applystudents/export-excel-more?keywords={keywords}&planNumber={planNumber}&startTime={startTime}&endTime={endTime}',
|
||||
[$('#keywords').val(), $('#keywords').val(), $('#startTime').val(), $('#endTime').val()]));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 事件 - 增删改
|
||||
table.on('toolbar(dataTable)', function(obj) {
|
||||
var layEvent = obj.event;
|
||||
var checkStatus = table.checkStatus('dataTable');
|
||||
var checkDatas = checkStatus.data;
|
||||
if(layEvent === 'importExcel') {
|
||||
importExcel();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
455
src/main/resources/static/route/insertscore/search-score.html
Normal file
455
src/main/resources/static/route/insertscore/search-score.html
Normal file
@ -0,0 +1,455 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<base href="/signup/">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="keywords" class="layui-input search-item" placeholder="身份证号/班级编号">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="startTime" class="layui-input search-item" placeholder="开始时间" readonly>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="endTime" class="layui-input search-item" placeholder="结束时间" readonly>
|
||||
</div>
|
||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||
<i class="fa fa-lg fa-search"></i> 搜索
|
||||
</button>
|
||||
</div>
|
||||
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
||||
<!-- 表头按钮组 -->
|
||||
<script type="text/html" id="headerToolBar">
|
||||
<div class="layui-btn-group">
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="importExcel">
|
||||
<i class="layui-icon-import"></i> 批量导入
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="exportExcel">
|
||||
<i class="layui-icon-export"></i> 批量导出
|
||||
</button>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
index: 'lib/index'
|
||||
}).use(['index', 'table', 'laydate', 'common' ,'upload'], function() {
|
||||
var $ = layui.$;
|
||||
var $win = $(window);
|
||||
var table = layui.table;
|
||||
var admin = layui.admin;
|
||||
var laydate = layui.laydate;
|
||||
var common = layui.common;
|
||||
var resizeTimeout = null;
|
||||
var tableUrl = 'api/applystudents/listpage';
|
||||
var keywords = top.restAjax.params(window.location.href).keywords;
|
||||
if(null != keywords && '' != keywords && typeof(keywords) != 'undefined') {
|
||||
$('#keywords').val(keywords)
|
||||
}
|
||||
|
||||
// 初始化表格
|
||||
function initTable() {
|
||||
table.render({
|
||||
elem: '#dataTable',
|
||||
id: 'dataTable',
|
||||
url: top.restAjax.path(tableUrl, []),
|
||||
width: admin.screen() > 1 ? '100%' : '',
|
||||
height: $win.height() - 90,
|
||||
limit: 20,
|
||||
limits: [20, 40, 60, 80, 100, 200],
|
||||
request: {
|
||||
pageName: 'page',
|
||||
limitName: 'rows'
|
||||
},
|
||||
where: {
|
||||
keywords: $('#keywords').val(),
|
||||
planNumber: $('#keywords').val(),
|
||||
startTime: $('#startTime').val(),
|
||||
endTime: $('#endTime').val()
|
||||
},
|
||||
cols: [
|
||||
[
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field: 'planName', width: 180, title: '班级名称', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row.classPlanDTO[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'planNumber', width: 180, title: '班级编号', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row.classPlanDTO[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'planType', width: 180, title: '计划类型', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row.classPlanDTO[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
if('1' == rowData) {
|
||||
rowData = '初训';
|
||||
}else if('2' == rowData) {
|
||||
rowData = '复训';
|
||||
}else if('3' == rowData) {
|
||||
rowData = '换证 ';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'orgName', width: 180, title: '考试机构', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row.classPlanDTO[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'planStartTime', width: 180, title: '计划开始时间', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row.classPlanDTO[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'planEndTime', width: 180, title: '计划结束时间', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row.classPlanDTO[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'chargePerson', width: 180, title: '负责人', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row.classPlanDTO[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'chargePersonTel', width: 180, title: '联系方式', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row.classPlanDTO[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyWorkTypeName', width: 180, title: '报名工种', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyName', width: 180, title: '报名人姓名', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applySex', width: 180, title: '报名人性别 1男 2女【数据字典】', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyDataBirth', width: 180, title: '报名人出生日期', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyCardType', width: 180, title: '报名人证件类型【数据字典】', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyCardNumber', width: 180, title: '报名人证件号码', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyPhone', width: 180, title: '报名人手机号码', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyAddress', width: 180, title: '报名人通讯地址', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyCultureLevel', width: 180, title: '报名人文化程度【数据字典】', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyPostcode', width: 180, title: '报名人邮编', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyPhysicalState', width: 180, title: '报名人身体状态【数据字典】', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyUnitName', width: 180, title: '报名人单位名称', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyUnitPhone', width: 180, title: '报名人单位电话', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyUnitAddress', width: 180, title: '报名人单位地址', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyPosition', width: 180, title: '报名人职务', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyMajorYear', width: 180, title: '报名人从事专业年限', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyTechnicalTitles', width: 180, title: '报名人技术职称', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'applyTestScores', fixed: 'right', width: 180, title: '考试成绩', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '成绩暂未录入';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
page: true,
|
||||
parseData: function(data) {
|
||||
return {
|
||||
'code': 0,
|
||||
'msg': '',
|
||||
'count': data.total,
|
||||
'data': data.rows
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
// 重载表格
|
||||
function reloadTable(currentPage) {
|
||||
table.reload('dataTable', {
|
||||
url: top.restAjax.path(tableUrl, []),
|
||||
where: {
|
||||
keywords: $('#keywords').val(),
|
||||
planNumber: $('#keywords').val(),
|
||||
startTime: $('#startTime').val(),
|
||||
endTime: $('#endTime').val()
|
||||
},
|
||||
page: {
|
||||
curr: currentPage
|
||||
},
|
||||
height: $win.height() - 90,
|
||||
});
|
||||
}
|
||||
// 初始化日期
|
||||
function initDate() {
|
||||
// 日期选择
|
||||
laydate.render({
|
||||
elem: '#startTime',
|
||||
format: 'yyyy-MM-dd'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#endTime',
|
||||
format: 'yyyy-MM-dd'
|
||||
});
|
||||
}
|
||||
initTable();
|
||||
initDate();
|
||||
// 事件 - 页面变化
|
||||
$win.on('resize', function() {
|
||||
clearTimeout(resizeTimeout);
|
||||
resizeTimeout = setTimeout(function() {
|
||||
reloadTable();
|
||||
}, 500);
|
||||
});
|
||||
// 事件 - 搜索
|
||||
$(document).on('click', '#search', function() {
|
||||
reloadTable(1);
|
||||
});
|
||||
|
||||
// 导入功能
|
||||
function importExcel() {
|
||||
var uploadLoading;
|
||||
layui.upload.render({
|
||||
elem: '#importExcel'
|
||||
,url: 'api/applystudents/importexcel'
|
||||
,accept: 'file'
|
||||
,exts: 'xls|xlsx'
|
||||
,before: function() {
|
||||
uploadLoading = layer.msg('正在上传,请稍后...', {icon: 16, time: 0, shade: 0.3});
|
||||
}
|
||||
,done: function(data) {
|
||||
layer.close(uploadLoading);
|
||||
if(data.data != 'success') {
|
||||
layer.msg('导入成功,存在' + data.data + '条失败数据', {time: 2000}, function() {
|
||||
window.open(top.restAjax.path('api/applystudents/exportexcel', []));
|
||||
});
|
||||
} else {
|
||||
layer.msg('导入成功', {time: 2000}, function() {
|
||||
closeBox();
|
||||
reloadTable();
|
||||
});
|
||||
}
|
||||
}
|
||||
,error: function(data, index){
|
||||
layer.close(uploadLoading);
|
||||
if(data != null) {
|
||||
top.dialog.msg(data.msg);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
importExcel();
|
||||
|
||||
$(document).on('click', '#exportExcel', function() {
|
||||
excel();
|
||||
});
|
||||
|
||||
function excel(){
|
||||
top.dialog.msg('确定要导出数据吗?', {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function (index) {
|
||||
top.dialog.close(index);
|
||||
window.open(top.restAjax.path('api/applystudents/export-excel-more?keywords={keywords}&planNumber={planNumber}&startTime={startTime}&endTime={endTime}',
|
||||
[$('#keywords').val(), $('#keywords').val(), $('#startTime').val(), $('#endTime').val()]));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 事件 - 增删改
|
||||
table.on('toolbar(dataTable)', function(obj) {
|
||||
var layEvent = obj.event;
|
||||
var checkStatus = table.checkStatus('dataTable');
|
||||
var checkDatas = checkStatus.data;
|
||||
if(layEvent === 'importExcel') {
|
||||
importExcel();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
69
src/main/resources/templates/index4.html
Normal file
69
src/main/resources/templates/index4.html
Normal file
@ -0,0 +1,69 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
<style>
|
||||
*{padding:0;margin:0;}
|
||||
.container{position: absolute;top:40%;left:50%;transform: translate(-50%,-50%);}
|
||||
.title{text-align: center;font-size: 28px;color: #000;margin-bottom: 20px;}
|
||||
.search{overflow: hidden;white-space: nowrap;text-align: center;min-width:800px;}
|
||||
.search input{width: 700px;height: 40px;padding: 0 10px;box-sizing: border-box;border: 1px solid #DDD;vertical-align: top;outline: none;font-size: 16px;float: left;}
|
||||
.search button{border: none;outline: none;cursor: pointer;width: 90px;height: 40px;color: #fff;font-size: 16px;background: #4e6ef2;vertical-align: top;float: left;}
|
||||
.tip{text-align: center;font-size: 14px;margin-top: 20px;color: #CCC;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="LAY-app" class="layui-fluid">
|
||||
<div class="container">
|
||||
<div class="title">标题</div>
|
||||
<div class="search">
|
||||
<input type="text" id="kw"/>
|
||||
<button @click="searchData">搜索</button>
|
||||
</div>
|
||||
<div class="tip">请输入班级编号/考生身份证号码查询</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="assets/js/vue.min.js"></script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script src="assets/js/vendor/safety/jutils.min.js"></script>
|
||||
<script src="assets/js/vendor/safety/echarts.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'animate-numbers', 'table'], function() {
|
||||
var $ = layui.$;
|
||||
var table = layui.table;
|
||||
new Vue({
|
||||
el: '#LAY-app',
|
||||
data: {},
|
||||
methods: {
|
||||
searchData: function() {
|
||||
var keywords = $('#kw').val();
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/insertscore/search-score.html?keywords={keywords}', [keywords]),
|
||||
title: "查看考生信息",
|
||||
width: '80%',
|
||||
height: '80%',
|
||||
onClose: function() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
mounted: function() {
|
||||
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user