Commit a82db8a2 authored by 法拉51246's avatar 法拉51246

导入图片,省市区转id

前端归属机构全改为评价机构
parent 78549b1a
......@@ -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<TbExamRegistrationVO> 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);
}
/**
......
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<T>
}
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);
......
......@@ -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;
......
......@@ -1263,8 +1263,65 @@ public class TbExamRegistrationServiceImpl implements ITbExamRegistrationService
Map<String, String> 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<String> 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);
......
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 <T> void downloadTemplate(HttpServletResponse response, Class<T> clazz, String fileName, List<T> list) {
new ExcelUtil<T>(clazz).exportExcel(list, fileName,response);
}
}
......@@ -2,7 +2,7 @@
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="评价机构" prop="evaluateAgencyId" v-has-role-no="['evaluateAgency']">
<el-select v-model="queryParams.evaluateAgencyId" placeholder="请选择归属机构">
<el-select v-model="queryParams.evaluateAgencyId" placeholder="请选择评价机构">
<el-option v-for="(item, index) in evaluateAgencyOptions" :key="index" :label="item.evaluateAgencyName"
:value="item.evaluateAgencyId">
</el-option>
......@@ -185,7 +185,7 @@
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
<el-form-item label="评价机构" prop="evaluateAgencyId" v-has-role-no="['evaluateAgency']">
<el-select v-model="form.evaluateAgencyId" placeholder="请选择归属机构">
<el-select v-model="form.evaluateAgencyId" placeholder="请选择评价机构">
<el-option v-for="(item, index) in evaluateAgencyOptions" :key="index" :label="item.evaluateAgencyName"
:value="item.evaluateAgencyId">
</el-option>
......@@ -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: "请输入课程名" },
......
......@@ -103,7 +103,10 @@
<!-- 添加或修改课程章节对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="90px">
<el-form-item label="课程章节" prop="chapterName">
<el-form-item label="课程名称" prop="chapterName" v-if="form.pid === 0">
<el-input v-model="form.chapterName" placeholder="请输入课程名称" />
</el-form-item>
<el-form-item label="课程章节" prop="chapterName" v-if="form.pid !== 0">
<el-input v-model="form.chapterName" placeholder="请输入名称" />
</el-form-item>
<el-form-item label="链接类型" prop="urlType" v-if="form.pid !== 0">
......@@ -301,7 +304,7 @@ export default {
this.form.pid = 0;
}
this.open = true;
this.title = "添加课程章节";
this.title = "添加课程";
},
/** 展开/折叠操作 */
toggleExpandAll() {
......
......@@ -221,8 +221,8 @@
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="归属机构" prop="evaluateAgencyId">
<el-select v-model="form.evaluateAgencyId" placeholder="请选择归属机构" clearable>
<el-form-item label="评价机构" prop="evaluateAgencyId">
<el-select v-model="form.evaluateAgencyId" placeholder="请选择评价机构" clearable>
<el-option
v-for="(item, index) in evaluateAgencyOptions"
:key="index"
......
......@@ -35,8 +35,8 @@ module.exports = {
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
target: "http://192.168.0.133:8080",
// target: `http://localhost:8080`,
// target: "http://192.168.0.133:8080",
target: `http://localhost:8080`,
changeOrigin: true,
pathRewrite: {
["^" + process.env.VUE_APP_BASE_API]: "",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment