Commit dd118785 by wangjian

2025-07-26 规范建设 V3.5

parent a9d5dce3
......@@ -155,7 +155,7 @@ public class SjGfjsYdjcjlController extends BaseController
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception{
public AjaxResult importData(MultipartFile file, boolean updateSupport, SjGfjsYdjcjl jl) throws Exception{
XSSFWorkbook workbook = null;
List<SysDept> deptList = sysDeptMapper.selectDeptList(new SysDept());
......@@ -170,7 +170,7 @@ public class SjGfjsYdjcjlController extends BaseController
List<SjGfjsZsdwwtcj> list=new ArrayList<>();
// 通过循环,逐行取出表中每行数据
for(int i=0;i<=lastRowNum;i++) {//跳过第一行和第二行
if(i==0 || i==1){
if(i==0 ){
continue;
}
// 获取行
......@@ -178,59 +178,59 @@ public class SjGfjsYdjcjlController extends BaseController
SjGfjsZsdwwtcj zsdwwtcj=new SjGfjsZsdwwtcj();
System.out.println(row);
//日期
String rq=new DataFormatter().formatCellValue(row.getCell(1));
String rq = jl.getRq();
if(StringUtils.isEmpty(rq)){
return AjaxResult.error("导入失败,第"+(i+1)+"行日期不能为空");
return AjaxResult.error("导入失败,日期不能为空,请在录入界面中选择日期");
}
Date date = DateUtils.parseDate(rq);
if(date==null){
return AjaxResult.error("导入失败,第"+(i+1)+"行日期格式错误");
return AjaxResult.error("导入失败,日期格式错误");
}
zsdwwtcj.setRq(DateUtils.parseDateToStr("yyyy-MM",date));
//单位
String dw=new DataFormatter().formatCellValue(row.getCell(2)) ;
if(StringUtils.isEmpty(dw)){
return AjaxResult.error("导入失败,第"+(i+1)+"行单位不能为空");
Long dw = jl.getDeptId();
if(dw == null){
return AjaxResult.error("导入失败,单位不能为空,请在录入界面中选择单位");
}
//查询单位id
String[] split = dw.split("/");
if(split.length<2){
return AjaxResult.error("导入失败,第"+(i+1)+"行输入的单位格式有误!");
}
String ejdw=split[0];
SysDept ejdept = deptList.stream().filter(dept -> dept.getDeptName().equals(ejdw)).findFirst().orElse(null);
if(ejdept==null){
return AjaxResult.error("导入失败,第"+(i+1)+"行未匹配到二级单位");
}
String sjdw=split[1];
SysDept sjdept = deptList.stream().filter(dept -> dept.getDeptName().equals(sjdw) && dept.getParentId().equals(ejdept.getDeptId())).findFirst().orElse(null);
if(sjdept==null){
return AjaxResult.error("导入失败,第"+(i+1)+"行未匹配到三级单位");
}
zsdwwtcj.setDeptId(sjdept.getDeptId());
zsdwwtcj.setYl3(sjdept.getDeptId());
// //查询单位id
// String[] split = dw.split("/");
// if(split.length<2){
// return AjaxResult.error("导入失败,第"+(i+1)+"行输入的单位格式有误!");
// }
// String ejdw=split[0];
// SysDept ejdept = deptList.stream().filter(dept -> dept.getDeptName().equals(ejdw)).findFirst().orElse(null);
// if(ejdept==null){
// return AjaxResult.error("导入失败,第"+(i+1)+"行未匹配到二级单位");
// }
// String sjdw=split[1];
// SysDept sjdept = deptList.stream().filter(dept -> dept.getDeptName().equals(sjdw) && dept.getParentId().equals(ejdept.getDeptId())).findFirst().orElse(null);
// if(sjdept==null){
// return AjaxResult.error("导入失败,第"+(i+1)+"行未匹配到三级单位");
// }
zsdwwtcj.setDeptId(jl.getDeptId());
zsdwwtcj.setYl3(jl.getDeptId());
//问题描述
String wtms=new DataFormatter().formatCellValue(row.getCell(3)) ;
String wtms=new DataFormatter().formatCellValue(row.getCell(1)) ;
if(StringUtils.isEmpty(wtms)){
return AjaxResult.error("导入失败,第"+(i+1)+"行问题描述不能为空");
}
zsdwwtcj.setWtmc(wtms);
//考核内容
String khnr=new DataFormatter().formatCellValue(row.getCell(4)) ;
String khnr=new DataFormatter().formatCellValue(row.getCell(2)) ;
if(StringUtils.isEmpty(khnr)){
return AjaxResult.error("导入失败,第"+(i+1)+"行考核内容不能为空");
return AjaxResult.error("导入失败,第"+(i+1)+"行实施路径不能为空");
}
zsdwwtcj.setKhnr(khnr);
//考核项点
String khxd=new DataFormatter().formatCellValue(row.getCell(5)) ;
String khxd=new DataFormatter().formatCellValue(row.getCell(3)) ;
if(StringUtils.isEmpty(khxd)){
return AjaxResult.error("导入失败,第"+(i+1)+"行考核项点不能为空");
return AjaxResult.error("导入失败,第"+(i+1)+"行重点工作不能为空");
}
zsdwwtcj.setKhxd(khxd);
String pjbz=new DataFormatter().formatCellValue(row.getCell(6)) ;
String pjbz=new DataFormatter().formatCellValue(row.getCell(4)) ;
if(StringUtils.isEmpty(pjbz)){
return AjaxResult.error("导入失败,第"+(i+1)+"行评价标准不能为空");
return AjaxResult.error("导入失败,第"+(i+1)+"行主要工作要求不能为空");
}
//匹配评价标准
String substring = pjbz.substring(6);
......@@ -239,20 +239,20 @@ public class SjGfjsYdjcjlController extends BaseController
sjGfjsZdGzCb.setKhxd(khxd);
sjGfjsZdGzCb.setKhnr(khnr);
sjGfjsZdGzCb.setPx(l);
sjGfjsZdGzCb.setNd(rq.substring(0,4));
sjGfjsZdGzCb.setNd(jl.getRq().substring(0,4));
SjGfjsZdgzCb cb=sjGfjsZdgzMapper.selectSjGfjsZdgzCb(sjGfjsZdGzCb);
if(cb==null){
return AjaxResult.error("导入失败,第"+(i+1)+"行未匹配到评价标准");
return AjaxResult.error("导入失败,第"+(i+1)+"行未匹配到主要工作要求");
}
zsdwwtcj.setPjbzid(cb.getId()+"");
zsdwwtcj.setPjbzmc(cb.getPjbz());
String zgzrr=new DataFormatter().formatCellValue(row.getCell(7)) ;
String zgzrr=new DataFormatter().formatCellValue(row.getCell(5)) ;
zsdwwtcj.setZgzrr(zgzrr);
String zgcs=new DataFormatter().formatCellValue(row.getCell(8)) ;
String zgcs=new DataFormatter().formatCellValue(row.getCell(6)) ;
zsdwwtcj.setZgcs(zgcs);
String zgqx=new DataFormatter().formatCellValue(row.getCell(9)) ;
String zgqx=new DataFormatter().formatCellValue(row.getCell(7)) ;
zsdwwtcj.setZgqx(zgqx);
String zgzt=new DataFormatter().formatCellValue(row.getCell(10)) ;
String zgzt=new DataFormatter().formatCellValue(row.getCell(8)) ;
zsdwwtcj.setZgzt(zgzt);
zsdwwtcj.setJcjb("基层单位自查");
zsdwwtcj.setCreateTime(DateUtils.getNowDate());
......
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