维护虚拟清单增加校验
This commit is contained in:
+4
-3
@@ -127,8 +127,9 @@ public class DummyInventoryInfoEOController extends JeroController<DummyInventor
|
||||
@AutoLog(value = "虚拟清单详情表-批量删除")
|
||||
@ApiOperation(value="虚拟清单详情表-批量删除", notes="虚拟清单详情表-批量删除")
|
||||
@GetMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.dummyInventoryInfoEOService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids,
|
||||
@RequestParam(name="cut",required=true) String cut) {
|
||||
this.dummyInventoryInfoEOService.deleteByIds(Arrays.asList(ids.split(",")), cut);
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@@ -228,7 +229,7 @@ public class DummyInventoryInfoEOController extends JeroController<DummyInventor
|
||||
public Result<?> copyInfoByIds(@RequestParam(name="ids",required=true) String ids,
|
||||
@RequestParam(name="cut",required=true) String cut) {
|
||||
try {
|
||||
dummyInventoryInfoEOService.copyInfoByIds(ids);
|
||||
dummyInventoryInfoEOService.copyInfoByIds(ids,cut);
|
||||
} catch (Exception e) {
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
return Result.error("复制失败");
|
||||
|
||||
+2
-2
@@ -47,7 +47,7 @@ public interface IDummyInventoryInfoEOService extends IService<DummyInventoryInf
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
void deleteByIds(List<String> ids,String cut);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
@@ -57,7 +57,7 @@ public interface IDummyInventoryInfoEOService extends IService<DummyInventoryInf
|
||||
*/
|
||||
DummyInventoryInfoEO queryById(String id);
|
||||
|
||||
void copyInfoByIds(String ids);
|
||||
void copyInfoByIds(String ids,String cut);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
|
||||
+91
-30
@@ -16,6 +16,7 @@ import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.DateUtils;
|
||||
import com.jero.modules.document.entity.BussDocumentLibraryEO;
|
||||
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
|
||||
import com.jero.modules.dummy.entity.DummyInventoryBaseEO;
|
||||
import com.jero.modules.dummy.entity.DummyInventoryInfoEO;
|
||||
import com.jero.modules.dummy.entity.DummyInventoryInfoEOEn;
|
||||
import com.jero.modules.dummy.enums.DummyInventoryBaseFieldEnum;
|
||||
@@ -32,23 +33,13 @@ import com.jero.modules.system.mapper.SysCategoryMapper;
|
||||
import com.jero.modules.system.service.impl.SysCategoryServiceImpl;
|
||||
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.SerializationUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
||||
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
||||
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
@@ -66,20 +57,10 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.*;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl.copyFile;
|
||||
@@ -130,6 +111,11 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
*/
|
||||
@Override
|
||||
public void add(DummyInventoryInfoEO dummyInventoryInfoEO) {
|
||||
//检查虚拟清单是否存在
|
||||
QueryWrapper<DummyInventoryBaseEO> infoEOQueryWrapper = new QueryWrapper<>();
|
||||
List<DummyInventoryBaseEO> baseList = dummyInventoryBaseEOService.list(infoEOQueryWrapper.eq("id", dummyInventoryInfoEO.getDummyInventoryBaseId()));
|
||||
if(CollectionUtils.isNotEmpty(baseList)){
|
||||
|
||||
if(StringUtils.isNotBlank(dummyInventoryInfoEO.getIds())){
|
||||
//虚拟清单详情数据
|
||||
LambdaQueryWrapper<DummyInventoryInfoEO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
@@ -181,6 +167,13 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
dummyLogEOService.updateLog(contentLog, dummyInventoryInfoEO.getDummyInventoryBaseId(),CutEnum.CN.getValue());
|
||||
dummyLogEOService.updateLog(enContentLog, dummyInventoryInfoEO.getDummyInventoryBaseId(),CutEnum.EN.getValue());
|
||||
}
|
||||
}else{
|
||||
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
|
||||
throw new JeroBootException("该虚拟清单不存在,新增失败");
|
||||
}else{
|
||||
throw new JeroBootException("The virtual list does not exist, and adding failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -191,7 +184,12 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
*/
|
||||
@Override
|
||||
public void editById(DummyInventoryInfoEO dummyInventoryInfoEO) {
|
||||
Date now = new Date();
|
||||
//检查虚拟清单是否存在
|
||||
QueryWrapper<DummyInventoryBaseEO> infoEOQueryWrapper = new QueryWrapper<>();
|
||||
List<DummyInventoryBaseEO> baseList = dummyInventoryBaseEOService.list(infoEOQueryWrapper.eq("id", dummyInventoryInfoEO.getDummyInventoryBaseId()));
|
||||
if(CollectionUtils.isNotEmpty(baseList)){
|
||||
|
||||
Date now = new Date();
|
||||
dummyInventoryInfoEO.setUpdateTime(now);
|
||||
DummyInventoryInfoEO dummyInventoryInfoEOCopy = SerializationUtils.clone(dummyInventoryInfoEO);//复制
|
||||
|
||||
@@ -242,6 +240,13 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
dummyLogEOService.updateLog(contentLog, dummyInventoryInfoEO.getDummyInventoryBaseId(),CutEnum.CN.getValue());
|
||||
dummyLogEOService.updateLog(enContentLog, dummyInventoryInfoEO.getDummyInventoryBaseId(),CutEnum.EN.getValue());
|
||||
}
|
||||
}else{
|
||||
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
|
||||
throw new JeroBootException("该虚拟清单不存在,编辑失败");
|
||||
}else{
|
||||
throw new JeroBootException("The virtual inventory does not exist, and editing failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 通过id删除
|
||||
@@ -252,7 +257,6 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -262,7 +266,12 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
public void deleteByIds(List<String> ids,String cut) {
|
||||
DummyInventoryInfoEO infoEO = queryById(ids.get(0));
|
||||
|
||||
//检查虚拟清单是否存在
|
||||
if(infoEO != null){
|
||||
|
||||
//文件同步删除
|
||||
LambdaQueryWrapper<DummyInventoryInfoEO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(DummyInventoryInfoEO::getId,ids);
|
||||
@@ -291,6 +300,13 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
String enContentLog = username+" deleted “"+serialNumber+"” from the list";
|
||||
dummyLogEOService.updateLog(contentLog, projectId,CutEnum.CN.getValue());
|
||||
dummyLogEOService.updateLog(enContentLog, projectId,CutEnum.EN.getValue());
|
||||
}else{
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
throw new JeroBootException("该虚拟清单不存在,删除失败");
|
||||
}else{
|
||||
throw new JeroBootException("The virtual inventory does not exist, and deletion failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -327,7 +343,13 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
* @param ids
|
||||
*/
|
||||
@Override
|
||||
public void copyInfoByIds(String ids) {
|
||||
public void copyInfoByIds(String ids,String cut) {
|
||||
List<String> idsList = Arrays.asList(ids.split(","));
|
||||
|
||||
DummyInventoryInfoEO infoEO = queryById(idsList.get(0));
|
||||
|
||||
//检查虚拟清单是否存在
|
||||
if(infoEO != null){
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
LambdaQueryWrapper<DummyInventoryInfoEO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(DummyInventoryInfoEO::getId,Arrays.asList(ids.split(",")));
|
||||
@@ -347,6 +369,13 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
dummyLogEOService.updateLog(contentLog, projectId,CutEnum.CN.getValue());
|
||||
dummyLogEOService.updateLog(enContentLog, projectId,CutEnum.EN.getValue());
|
||||
}
|
||||
}else{
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
throw new JeroBootException("该虚拟清单不存在,复制失败");
|
||||
}else{
|
||||
throw new JeroBootException("The virtual inventory does not exist, and copy failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -356,6 +385,10 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
*/
|
||||
@Override
|
||||
public void setBatch(DummyInventoryInfoEO dummyInventoryInfoEO) {
|
||||
//检查虚拟清单是否存在
|
||||
QueryWrapper<DummyInventoryBaseEO> infoEOQueryWrapper = new QueryWrapper<>();
|
||||
List<DummyInventoryBaseEO> baseList = dummyInventoryBaseEOService.list(infoEOQueryWrapper.in("id", dummyInventoryInfoEO.getIds()));
|
||||
if(CollectionUtils.isNotEmpty(baseList)){
|
||||
if(StringUtils.isNotBlank(dummyInventoryInfoEO.getIds())){
|
||||
//根据id查询数据库中完整信息,翻译
|
||||
List<String> idList = Arrays.asList(dummyInventoryInfoEO.getIds().split(","));
|
||||
@@ -539,6 +572,13 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
dummyLogEOService.updateLog(contentLog, projectId,CutEnum.CN.getValue());
|
||||
dummyLogEOService.updateLog(enContentLog, projectId,CutEnum.EN.getValue());
|
||||
}
|
||||
}else{
|
||||
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
|
||||
throw new JeroBootException("该虚拟清单不存在,批量编辑失败");
|
||||
}else{
|
||||
throw new JeroBootException("The virtual inventory does not exist, and batch editing failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
private void setDateNull(DummyInventoryInfoEO inventoryInfoEO, LambdaUpdateWrapper<DummyInventoryInfoEO> updateWrapper) {
|
||||
if(ObjectUtils.isEmpty(inventoryInfoEO.getXin1Che1Xing2Shi2Shi1Ri4Qi1())){
|
||||
@@ -831,6 +871,10 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public void importData(MultipartFile file, DummyInventoryInfoEO dummyInventoryInfoEO) {
|
||||
//检查虚拟清单是否存在
|
||||
QueryWrapper<DummyInventoryBaseEO> infoEOQueryWrapper = new QueryWrapper<>();
|
||||
List<DummyInventoryBaseEO> baseList = dummyInventoryBaseEOService.list(infoEOQueryWrapper.eq("id", dummyInventoryInfoEO.getDummyInventoryBaseId()));
|
||||
if(CollectionUtils.isNotEmpty(baseList)){
|
||||
String title = "";
|
||||
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
|
||||
title = "*编号,子标题,实施类别,WVTA ID,认证类型,*认证级别,适用增补件,*责任领域,备注," +
|
||||
@@ -1066,7 +1110,13 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
importDatas(datas, categoryList, dictItemList, zipEntryName,saveDirectory,dummyInventoryInfoEO);
|
||||
//删除原上传文件
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
|
||||
}else{
|
||||
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
|
||||
throw new JeroBootException("该虚拟清单不存在,导入失败");
|
||||
}else{
|
||||
throw new JeroBootException("The virtual inventory does not exist, and the import failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1709,6 +1759,10 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public void exportData(HttpServletResponse response, HttpServletRequest request, DummyInventoryInfoEO dummyInventoryInfoEO) {
|
||||
//检查虚拟清单是否存在
|
||||
QueryWrapper<DummyInventoryBaseEO> infoEOQueryWrapper = new QueryWrapper<>();
|
||||
List<DummyInventoryBaseEO> baseList = dummyInventoryBaseEOService.list(infoEOQueryWrapper.eq("id", dummyInventoryInfoEO.getDummyInventoryBaseId()));
|
||||
if(CollectionUtils.isNotEmpty(baseList)){
|
||||
List<DummyInventoryInfoEO> dataList = new ArrayList<>();
|
||||
QueryWrapper<DummyInventoryInfoEO> queryWrapper = QueryGenerator.initQueryWrapper(dummyInventoryInfoEO,request.getParameterMap());
|
||||
queryWrapper.in("dummy_inventory_base_id",dummyInventoryInfoEO.getDummyInventoryBaseId());
|
||||
@@ -1778,6 +1832,13 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
File file = new File(uploadpath + "/tempZip");
|
||||
FileUtil.deleteContents(file);
|
||||
}
|
||||
}else{
|
||||
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
|
||||
throw new JeroBootException("该虚拟清单不存在,导出失败");
|
||||
}else{
|
||||
throw new JeroBootException("The virtual inventory does not exist, and the export failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void transition(List<DummyInventoryInfoEOEn> dataListEn){
|
||||
|
||||
Reference in New Issue
Block a user