diff --git a/ruoyi-admin/src/main/java/com/ruoyi/hezhi/controller/TbExamRegistrationController.java b/ruoyi-admin/src/main/java/com/ruoyi/hezhi/controller/TbExamRegistrationController.java index 2398e76cb80a8c076c1f84a51762def893520754..6c9dd9b45ff2442cb3dcb70c653fb27d8cf8fb8b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/hezhi/controller/TbExamRegistrationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/hezhi/controller/TbExamRegistrationController.java @@ -25,6 +25,7 @@ import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.io.InputStream; import java.io.OutputStream; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -140,7 +141,34 @@ public class TbExamRegistrationController extends BaseController */ @PostMapping("/importTemplate") public void importTemplate(HttpServletResponse response) { - ImportTemplateUtil.downloadTemplate(response, TbExamRegistrationVO.class, "考试报名导入模板"); + //示例数据 + List templateList = new ArrayList<>(); + TbExamRegistrationVO tbExamRegistrationVO = new TbExamRegistrationVO(); + tbExamRegistrationVO.setName("张三"); + tbExamRegistrationVO.setFormerName("曾用名"); + tbExamRegistrationVO.setSex(0); + tbExamRegistrationVO.setNation("汉族"); + tbExamRegistrationVO.setIdentityCard("110101199001011234"); + tbExamRegistrationVO.setBirthday("1990-01-01"); + tbExamRegistrationVO.setNativePlace("河北省,唐山市,路北区"); + tbExamRegistrationVO.setEducation("本科"); + tbExamRegistrationVO.setMajor("计算机科学与技术"); + tbExamRegistrationVO.setGraduationSchool("河南大学"); + tbExamRegistrationVO.setEntranceYear("2018"); + tbExamRegistrationVO.setContactInformation("13677777777"); + tbExamRegistrationVO.setProvinceName("河南省"); + tbExamRegistrationVO.setCityName("郑州市"); + tbExamRegistrationVO.setAreaName("中原区"); + tbExamRegistrationVO.setAddress("中原区金水路"); + tbExamRegistrationVO.setContactPhone("13677777777"); + tbExamRegistrationVO.setAgencyName("机构名称"); + tbExamRegistrationVO.setCareerName("职业名称"); + tbExamRegistrationVO.setExamLevel("初级"); + tbExamRegistrationVO.setRegistrationBatch("报名批次"); + tbExamRegistrationVO.setStudyCenter("学习中心名称"); + tbExamRegistrationVO.setAgencyCode("机构代码"); + templateList.add(tbExamRegistrationVO); + ImportTemplateUtil.downloadTemplate(response, TbExamRegistrationVO.class, "考试报名导入模板",templateList); } /** diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index 5d743c54a63d89c4aaac1eb9cfbfd0d70a72605a..008f750f7edc0c6954e24e6ce17b930097177aa7 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -1,5 +1,6 @@ package com.ruoyi.common.utils.poi; +import cn.hutool.core.util.IdUtil; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel.ColumnType; import com.ruoyi.common.annotation.Excel.Type; @@ -10,11 +11,13 @@ import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.exception.UtilException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.ImgUpload; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.file.FileTypeUtils; import com.ruoyi.common.utils.file.FileUtils; import com.ruoyi.common.utils.file.ImageUtils; import com.ruoyi.common.utils.reflect.ReflectUtils; +import com.ruoyi.common.utils.uuid.Seq; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.RegExUtils; import org.apache.commons.lang3.reflect.FieldUtils; @@ -447,8 +450,12 @@ public class ExcelUtil } else { + byte[] data = image.getData(); - val = FileUtils.writeImportBytes(data); +// val = FileUtils.writeImportBytes(data); + // 文件名称 + String key = StringUtils.format("{}/{}/{}.{}", "xxks", DateUtils.datePath(), IdUtil.getSnowflakeNextIdStr(), image.suggestFileExtension()); + val = new ImgUpload().upload(data, key); } } ReflectUtils.invokeSetter(entity, propertyName, val); diff --git a/ruoyi-system/src/main/java/com/ruoyi/hezhi/domain/vo/TbExamRegistrationVO.java b/ruoyi-system/src/main/java/com/ruoyi/hezhi/domain/vo/TbExamRegistrationVO.java index 773d1e2f9ac2764aa5e1bff92d5c03ae592567c4..455cb9e90c43c6efc4d0b138f7bbdf778361b3ca 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/hezhi/domain/vo/TbExamRegistrationVO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/hezhi/domain/vo/TbExamRegistrationVO.java @@ -111,6 +111,29 @@ public class TbExamRegistrationVO { @Excel(name = "机构代码") private String agencyCode; + /** 蓝底证件照 */ + @Excel(name = "蓝底证件照", cellType = Excel.ColumnType.IMAGE) + private String idPhoto; + + /** 身份证国徽面(正面) */ + @Excel(name = "身份证国徽面", cellType = Excel.ColumnType.IMAGE) + private String identityCardBadge; + + /** 身份证人像面(反面) */ + @Excel(name = "身份证人像面", cellType = Excel.ColumnType.IMAGE) + private String identityCardPortrait; + + /** 毕业证书(多个用英文逗号隔开) */ + @Excel(name = "毕业证书", cellType = Excel.ColumnType.IMAGE) + private String graduationCertificate; + + @Excel(name = "毕业证书2", cellType = Excel.ColumnType.IMAGE) + private String graduationCertificate2; + + @Excel(name = "毕业证书3", cellType = Excel.ColumnType.IMAGE) + private String graduationCertificate3; + + // /** 订单编号 */ // @Excel(name = "订单编号") // private String orderNo; diff --git a/ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbExamRegistrationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbExamRegistrationServiceImpl.java index 41ddc549325b94af2aa969242ed5fc1aff5da11c..23d8fe86234b2cd8d6b4524d2c2b1392d54dca4f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbExamRegistrationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbExamRegistrationServiceImpl.java @@ -1263,8 +1263,65 @@ public class TbExamRegistrationServiceImpl implements ITbExamRegistrationService Map erreList = new HashMap<>(); int successRow = 0; for (TbExamRegistrationVO item : collect) { + //首先校验数据 + //生日必须有两个-链接 + if (item.getBirthday().split("-").length != 3){ + erreList.put(item.getContactInformation(), "生日格式有误,正确格式:1999-09-09"); + continue; + } TbExamRegistration tbExamRegistration = new TbExamRegistration(); BeanUtils.copyProperties(item, tbExamRegistration); + //毕业证书有最多三张图,需要合并url + List images = new ArrayList<>(); + if (StringUtils.isNotBlank(item.getGraduationCertificate())) { + images.add(item.getGraduationCertificate()); + } + if (StringUtils.isNotBlank(item.getGraduationCertificate2())) { + images.add(item.getGraduationCertificate2()); + } + if (StringUtils.isNotBlank(item.getGraduationCertificate3())) { + images.add(item.getGraduationCertificate3()); + } + tbExamRegistration.setGraduationCertificate(String.join(",", images)); + + //省市区的id根据名称查出来 + if (StringUtils.isNotBlank(item.getProvinceName())) { + Long provinceCode = tbRegionMapper.selectIdByName1(item.getProvinceName()); + if (provinceCode == null) { + erreList.put(item.getContactInformation(), "省名称有误"); + continue; + } else { + tbExamRegistration.setProvinceId(provinceCode); + } + if (StringUtils.isNotBlank(item.getCityName())) { + Long cityCode = tbRegionMapper.selectIdByName2(item.getCityName()); + if (cityCode == null) { + erreList.put(item.getContactInformation(), "市名称有误"); + continue; + } else { + tbExamRegistration.setCityId(cityCode); + } + if (StringUtils.isNotBlank(item.getAreaName())) { + Long areaCode = tbRegionMapper.selectIdByName3(item.getAreaName(),cityCode); + if (areaCode == null) { + erreList.put(item.getContactInformation(), "区名称有误"); + continue; + } else { + tbExamRegistration.setAreaId(areaCode); + } + }else { + erreList.put(item.getContactInformation(), "区名称未填"); + continue; + } + }else{ + erreList.put(item.getContactInformation(), "市名称未填"); + continue; + } + }else{ + erreList.put(item.getContactInformation(), "省名称未填"); + continue; + } + tbExamRegistration.setCreateTime(DateUtils.getNowDate()); tbExamRegistration.setIsPay(0); tbExamRegistration.setPayType(0); diff --git a/ruoyi-system/src/main/java/com/ruoyi/hezhi/util/ImportTemplateUtil.java b/ruoyi-system/src/main/java/com/ruoyi/hezhi/util/ImportTemplateUtil.java index c2f947c3a2a2999fbd2cad53753f66cbeffb1832..cd303462df3099344a7de476cafc984f15bab619 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/hezhi/util/ImportTemplateUtil.java +++ b/ruoyi-system/src/main/java/com/ruoyi/hezhi/util/ImportTemplateUtil.java @@ -1,9 +1,11 @@ package com.ruoyi.hezhi.util; import com.ruoyi.common.utils.poi.ExcelUtil; +import org.apache.poi.ss.formula.functions.T; import javax.servlet.http.HttpServletResponse; import java.util.Collections; +import java.util.List; public class ImportTemplateUtil { @@ -17,4 +19,14 @@ public class ImportTemplateUtil { new ExcelUtil<>(clazz).exportExcel(Collections.emptyList(), fileName,response); } + /** + * 下载导入模板 + * @param response 响应对象 + * @param clazz 带@Excel注解的实体类 + * @param fileName 下载文件名(不需要后缀) + */ + public static void downloadTemplate(HttpServletResponse response, Class clazz, String fileName, List list) { + new ExcelUtil(clazz).exportExcel(list, fileName,response); + } + } diff --git a/ruoyi-ui/src/views/hezhi/course/index.vue b/ruoyi-ui/src/views/hezhi/course/index.vue index c36e61d4d37657aae267740a2b21fbe29b78e9c5..12fee3d8ad769c7fc58337b2d71034226c263382 100644 --- a/ruoyi-ui/src/views/hezhi/course/index.vue +++ b/ruoyi-ui/src/views/hezhi/course/index.vue @@ -2,7 +2,7 @@
- + @@ -185,7 +185,7 @@ - + @@ -378,7 +378,7 @@ export default { // { required: true, trigger: "blur", message: "请选择课程分类" }, // ], evaluateAgencyId: [ - { required: true, trigger: "blur", message: "归属机构不能为空" }, + { required: true, trigger: "blur", message: "评价机构不能为空" }, ], courseName: [ { required: true, trigger: "blur", message: "请输入课程名" }, diff --git a/ruoyi-ui/src/views/hezhi/courseChapter/index.vue b/ruoyi-ui/src/views/hezhi/courseChapter/index.vue index e3a48e6afbb5be9cdae551f8294d3a8aab041437..0f58160f2ae777c44e9d0a8353bf2768023bf9ef 100644 --- a/ruoyi-ui/src/views/hezhi/courseChapter/index.vue +++ b/ruoyi-ui/src/views/hezhi/courseChapter/index.vue @@ -103,7 +103,10 @@ - + + + + @@ -301,7 +304,7 @@ export default { this.form.pid = 0; } this.open = true; - this.title = "添加课程章节"; + this.title = "添加课程"; }, /** 展开/折叠操作 */ toggleExpandAll() { diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue index 9f2800f19d3ec0d845384ccbaab47e27e32d9e3d..85c1e33ab6c48d1e7ee4bdb90cce208e4a5ec355 100644 --- a/ruoyi-ui/src/views/system/user/index.vue +++ b/ruoyi-ui/src/views/system/user/index.vue @@ -221,8 +221,8 @@ - - + +