fix(企标稽查计划): 79625
This commit is contained in:
+1
-1
@@ -231,6 +231,6 @@
|
||||
</select>
|
||||
|
||||
<select id="findUserByCalcNameWorkNo" resultType="com.jero.modules.system.entity.SysUser">
|
||||
select * from sys_user where concat(realname, '(', username, ')') = #{inspectUser}
|
||||
select * from sys_user where concat(realname, '(', username, ')') = #{inspectUser}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
+3
-2
@@ -24,6 +24,7 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -171,8 +172,8 @@ public class ProcessEsInspectPlanController extends JeroController<ProcessEsInsp
|
||||
*
|
||||
*/
|
||||
@GetMapping(value = "/templateDownload")
|
||||
public ModelAndView templateDownload() {
|
||||
return processEsInspectPlanService.templateDownload();
|
||||
public void templateDownload(HttpServletResponse response) throws IOException {
|
||||
processEsInspectPlanService.templateDownload(response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+9
-10
@@ -33,24 +33,24 @@ public class ProcessEsInspectPlan extends BaseEntity {
|
||||
@ApiModelProperty(value = "项目id")
|
||||
private String projectId;
|
||||
/**稽查依据标准号*/
|
||||
@Excel(name = "稽查依据标准号", width = 15)
|
||||
@Excel(name = "*稽查依据标准号", width = 15)
|
||||
@ApiModelProperty(value = "稽查依据标准号")
|
||||
private String inspectNo;
|
||||
/**稽查依据标准名称*/
|
||||
@Excel(name = "稽查依据标准名称", width = 16)
|
||||
@Excel(name = "*稽查依据标准名称", width = 16)
|
||||
@ApiModelProperty(value = "稽查依据标准名称")
|
||||
private String inspectName;
|
||||
/**计划稽查对象*/
|
||||
@Excel(name = "计划稽查对象", width = 15)
|
||||
@Excel(name = "*计划稽查对象", width = 15)
|
||||
@ApiModelProperty(value = "计划稽查对象")
|
||||
@Dict(dictTable ="sys_depart",dicText = "depart_name",dicCode = "id")
|
||||
private String inspectObject;
|
||||
/**主责标准化工作组*/
|
||||
@Excel(name = "主责标准化工作组", width = 16)
|
||||
@Excel(name = "*主责标准化工作组", width = 16)
|
||||
@ApiModelProperty(value = "主责标准化工作组")
|
||||
private String standardizationWorkGroup;
|
||||
/**所属部门*/
|
||||
@Excel(name = "所属部门", width = 15)
|
||||
@Excel(name = "*所属部门", width = 15)
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
@Dict(dictTable ="sys_depart",dicText = "depart_name",dicCode = "id")
|
||||
private String belongDept;
|
||||
@@ -61,12 +61,12 @@ public class ProcessEsInspectPlan extends BaseEntity {
|
||||
@ApiModelProperty(value = "计划稽查日期")
|
||||
private Date planInspectDate;
|
||||
/**计划稽查日期 导入用*/
|
||||
@Excel(name = "计划稽查日期", width = 15, format = "yyyy-MM-dd")
|
||||
@Excel(name = "*计划稽查日期", width = 15, format = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "计划稽查日期 导入用")
|
||||
@TableField(exist = false)
|
||||
private String planInspectDates;
|
||||
/**稽查负责人*/
|
||||
@Excel(name = "稽查负责人", width = 15)
|
||||
@Excel(name = "*稽查负责人", width = 15)
|
||||
@ApiModelProperty(value = "稽查负责人")
|
||||
private String inspectUser;
|
||||
/**稽查负责人 翻译*/
|
||||
@@ -74,7 +74,7 @@ public class ProcessEsInspectPlan extends BaseEntity {
|
||||
@TableField(exist = false)
|
||||
private String inspectUserDictText;
|
||||
/**标准化组对接人*/
|
||||
@Excel(name = "标准化组对接人", width = 15)
|
||||
@Excel(name = "*标准化组对接人", width = 15)
|
||||
@ApiModelProperty(value = "标准化组对接人")
|
||||
private String standardizationDockingUser;
|
||||
/**标准化组对接人 翻译*/
|
||||
@@ -82,7 +82,7 @@ public class ProcessEsInspectPlan extends BaseEntity {
|
||||
@TableField(exist = false)
|
||||
private String standardizationDockingUserDictText;
|
||||
/**征求意见对象*/
|
||||
@Excel(name = "征求意见对象", width = 15)
|
||||
@Excel(name = "*征求意见对象", width = 15)
|
||||
@ApiModelProperty(value = "征求意见对象")
|
||||
private String objectOfConsultation;
|
||||
/**征求意见对象 翻译*/
|
||||
@@ -90,7 +90,6 @@ public class ProcessEsInspectPlan extends BaseEntity {
|
||||
@TableField(exist = false)
|
||||
private String objectOfConsultationDictText;
|
||||
/**备注*/
|
||||
@Excel(name = "备注", width = 15)
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remarks;
|
||||
|
||||
|
||||
+2
-2
@@ -4,10 +4,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.modules.activiti.process.esinspectplan.entity.ProcessEsInspectPlan;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -100,5 +100,5 @@ public interface IProcessEsInspectPlanService extends IService<ProcessEsInspectP
|
||||
* 下载导入模板
|
||||
* @return
|
||||
*/
|
||||
ModelAndView templateDownload();
|
||||
void templateDownload(HttpServletResponse response) throws IOException;
|
||||
}
|
||||
|
||||
+34
-23
@@ -24,23 +24,21 @@ import com.jero.modules.system.entity.SysUser;
|
||||
import com.jero.modules.system.service.ISysDepartService;
|
||||
import com.jero.modules.system.service.ISysUserService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@@ -213,20 +211,22 @@ public class ProcessEsInspectPlanServiceImpl extends ServiceImpl<ProcessEsInspec
|
||||
// 获取上传文件对象
|
||||
MultipartFile file = entity.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
params.setHeadRows(1);
|
||||
// excel表格头部校验
|
||||
excelHeadVerify(file, ProcessEsInspectPlan.class, params.getTitleRows(), 0);
|
||||
excelHeadVerify(file, ProcessEsInspectPlan.class, 0, 0);
|
||||
List<ProcessEsInspectPlan> lists = ExcelImportUtil.importExcel(file.getInputStream(), ProcessEsInspectPlan.class, params);
|
||||
if (CollectionUtils.isEmpty(lists)) {
|
||||
if (CollectionUtils.isEmpty(lists) || lists.size() <= 2) {
|
||||
return Result.error("没有数据可导入!");
|
||||
}
|
||||
lists.remove(0);
|
||||
lists.remove(0);
|
||||
List<ProcessEsInspectPlan> list = BeanCopyUtils.copyBeanList(lists, ProcessEsInspectPlan.class);
|
||||
StringBuilder errorMSG = new StringBuilder();
|
||||
// 字段校验
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).setProjectId(projectId);
|
||||
String head = "第" + (i + 2) + "行:";
|
||||
String head = "第" + (i + 4) + "行:";
|
||||
List<String> firstVerify = firstVerify(list.get(i));
|
||||
List<String> secondVerify = secondVerify(list.get(i));
|
||||
List<String> thirdVerify = thirdVerify(list.get(i));
|
||||
@@ -254,19 +254,22 @@ public class ProcessEsInspectPlanServiceImpl extends ServiceImpl<ProcessEsInspec
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelAndView templateDownload() {
|
||||
// AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
String title = "企标稽查计划导入模板";
|
||||
//此处设置的filename无效 ,前端会重更新设置一下
|
||||
mv.addObject("fileName", title);
|
||||
mv.addObject("entity", ProcessEsInspectPlan.class);
|
||||
ExportParams exportParams = new ExportParams(null, title);
|
||||
// 导出xlsx
|
||||
exportParams.setType(ExcelType.HSSF);
|
||||
mv.addObject("params", exportParams);
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, new ArrayList<T>());
|
||||
return mv;
|
||||
public void templateDownload(HttpServletResponse response) throws IOException {
|
||||
File file = ResourceUtils.getFile("classpath:excelTemplate/企标稽查计划导入模板.xls");
|
||||
// 设置HTTP响应头,包括文件大小和内容类型
|
||||
response.setContentType("application/vnd.ms-excel"); // 根据实际文件类型设置内容类型
|
||||
response.setHeader("Content-Disposition", "attachment; filename=企标稽查计划导入模板.xls");
|
||||
response.setContentLength((int) Files.size(file.toPath()));
|
||||
|
||||
// 将文件内容写入HTTP响应输出流中
|
||||
try (InputStream in = Files.newInputStream(file.toPath());
|
||||
ServletOutputStream out = response.getOutputStream()) {
|
||||
byte[] buffer = new byte[4096];
|
||||
int bytesRead;
|
||||
while ((bytesRead = in.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, bytesRead);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> sixthVerify(ProcessEsInspectPlan processEsInspectPlan) {
|
||||
@@ -367,14 +370,22 @@ public class ProcessEsInspectPlanServiceImpl extends ServiceImpl<ProcessEsInspec
|
||||
|
||||
private List<String> firstVerify(ProcessEsInspectPlan processEsInspectPlan) {
|
||||
List<String> errorList = new ArrayList<>();
|
||||
boolean flag = false;
|
||||
if (StringUtils.isBlank(processEsInspectPlan.getInspectNo())){
|
||||
errorList.add("稽查依据标准号不能为空!");
|
||||
flag = true;
|
||||
}
|
||||
if (StringUtils.isNotBlank(processEsInspectPlan.getInspectName())){
|
||||
List<LawsEnterpriseStandard> list = lawsEnterpriseStandardService.list(new LambdaQueryWrapper<LawsEnterpriseStandard>()
|
||||
.eq(LawsEnterpriseStandard::getStandardName, processEsInspectPlan.getInspectName()));
|
||||
if (list.isEmpty()) {
|
||||
errorList.add("稽查依据标准名称不存在!");
|
||||
}else if (flag){
|
||||
long count = list.stream().filter(v -> v.getStandardNumber().equals(processEsInspectPlan.getInspectNo())
|
||||
&& v.getStandardName().equals(processEsInspectPlan.getInspectName())).count();
|
||||
if (count == 0){
|
||||
errorList.add("稽查依据标准号和稽查依据标准名称不匹配!");
|
||||
}
|
||||
}
|
||||
}else {
|
||||
errorList.add("稽查依据标准名称不能为空!");
|
||||
|
||||
-8
@@ -60,14 +60,6 @@ public class EnterpriseStandardDeclareController extends JeroController<Enterpri
|
||||
esDeclareService.export(response, esQueryCommonDTO, "企标宣贯", "企标宣贯");
|
||||
}
|
||||
|
||||
// @RequiresPermissions("enterpriseStandardLibrary:publicize:fileExport")
|
||||
// @AutoLog(value = "企标宣贯-带文件导出")
|
||||
// @ApiOperation(value="企标宣贯-带文件导出", notes="企标宣贯-带文件导出")
|
||||
// @GetMapping("/exportDataWithFile")
|
||||
// public void exportDataWithFile(HttpServletResponse response, ESQueryCommonDTO esQueryCommonDTO) {
|
||||
// esDeclareService.exportDataWithFile(response, esQueryCommonDTO, "企标宣贯", "企标宣贯");
|
||||
// }
|
||||
|
||||
@RequiresPermissions("enterpriseStandardLibrary:publicize:fileExport")
|
||||
@AutoLog(value = "企标宣贯-带文件导出")
|
||||
@ApiOperation(value="企标宣贯-带文件导出", notes="企标宣贯-带文件导出")
|
||||
|
||||
Binary file not shown.
@@ -354,6 +354,7 @@
|
||||
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
|
||||
<nonFilteredFileExtension>svg</nonFilteredFileExtension>
|
||||
<nonFilteredFileExtension>xlsx</nonFilteredFileExtension>
|
||||
<nonFilteredFileExtension>xls</nonFilteredFileExtension>
|
||||
</nonFilteredFileExtensions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
Reference in New Issue
Block a user