|
@@ -1,39 +1,24 @@
|
|
|
package com.dragoninfo.dcuc.app.service.sub.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
-import com.dragoninfo.dcuc.app.entity.sub.DataLevel;
|
|
|
import com.dragoninfo.dcuc.app.enumresources.DataAuthTypeCodeEnum;
|
|
|
-import com.dragoninfo.dcuc.app.dto.sub.DataSecDTO;
|
|
|
-import com.dragoninfo.dcuc.app.dto.sub.ExcelDataSec;
|
|
|
-import com.dragoninfo.dcuc.app.entity.sub.DataSec;
|
|
|
+import com.dragoninfo.dcuc.app.dto.sub.FieldSecDTO;
|
|
|
+import com.dragoninfo.dcuc.app.entity.sub.FieldSec;
|
|
|
import com.dragoninfo.dcuc.app.mapper.sub.DataSecMapper;
|
|
|
import com.dragoninfo.dcuc.app.service.sub.IDataSecService;
|
|
|
-import com.dragoninfo.dcuc.app.util.ImportUtil;
|
|
|
import com.dragoninfo.dcuc.app.vo.DataLevelVo;
|
|
|
-import com.dragoninfo.dcuc.duceap.facade.IDuceapUploadFacade;
|
|
|
-import com.dragoninfo.dcuc.duceap.upload.dto.DocContentDTO;
|
|
|
import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
|
|
|
import com.dragonsoft.duceap.base.entity.search.SearchDTO;
|
|
|
import com.dragonsoft.duceap.base.enums.BooleanEnum;
|
|
|
-import com.dragonsoft.duceap.base.utils.UserContextUtils;
|
|
|
import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
|
|
|
import com.dragonsoft.duceap.commons.util.string.StringUtils;
|
|
|
import com.dragonsoft.duceap.core.search.Searchable;
|
|
|
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
-import org.apache.poi.ss.usermodel.Cell;
|
|
|
-import org.apache.poi.ss.usermodel.Row;
|
|
|
-import org.apache.poi.ss.usermodel.Sheet;
|
|
|
-import org.apache.poi.ss.usermodel.Workbook;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageImpl;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.io.ByteArrayInputStream;
|
|
|
-import java.io.IOException;
|
|
|
-import java.io.InputStream;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -49,14 +34,14 @@ public class DataSecServiceImpl implements IDataSecService {
|
|
|
private DataSecMapper dataSecMapper;
|
|
|
|
|
|
@Override
|
|
|
- public ResponseStatus dataLevelAdd(DataSecDTO dto) {
|
|
|
+ public ResponseStatus dataLevelAdd(FieldSecDTO dto) {
|
|
|
String id = dto.getId();
|
|
|
String code = dto.getSecCode();
|
|
|
dto.setDataType(DataAuthTypeCodeEnum.AUTH_DATA_SEC.value);
|
|
|
if(StringUtils.isBlank(code)) {
|
|
|
return ResponseStatus.fail("代码不能为空");
|
|
|
}
|
|
|
- DataSec exist = getByCode(code);
|
|
|
+ FieldSec exist = getByCode(code);
|
|
|
if(StringUtils.isBlank(id)) {
|
|
|
if(null != exist) {
|
|
|
return ResponseStatus.fail("代码已存在");
|
|
@@ -73,8 +58,8 @@ public class DataSecServiceImpl implements IDataSecService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public DataSec update(DataSecDTO dto) {
|
|
|
- DataSec dataSec = dataSecMapper.selectById(dto.getId());
|
|
|
+ public FieldSec update(FieldSecDTO dto) {
|
|
|
+ FieldSec dataSec = dataSecMapper.selectById(dto.getId());
|
|
|
if (null == dataSec) {
|
|
|
return null;
|
|
|
}
|
|
@@ -85,8 +70,8 @@ public class DataSecServiceImpl implements IDataSecService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public DataSec save(DataSecDTO dto) {
|
|
|
- DataSec dataSec = new DataSec();
|
|
|
+ public FieldSec save(FieldSecDTO dto) {
|
|
|
+ FieldSec dataSec = new FieldSec();
|
|
|
BeanUtils.copyProperties(dto, dataSec);
|
|
|
dataSec.setCreateTime(new Date());
|
|
|
dataSec.setDeleted(BooleanEnum.FALSE.value);
|
|
@@ -95,7 +80,7 @@ public class DataSecServiceImpl implements IDataSecService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public DataSec getById(String id) {
|
|
|
+ public FieldSec getById(String id) {
|
|
|
return dataSecMapper.selectById(id);
|
|
|
}
|
|
|
|
|
@@ -105,11 +90,11 @@ public class DataSecServiceImpl implements IDataSecService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public DataSecDTO detailByCode(String secCode) {
|
|
|
- LambdaQueryWrapper<DataSec> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.select().eq(DataSec::getSecCode, secCode);
|
|
|
- DataSec dataSec = dataSecMapper.selectOne(queryWrapper);
|
|
|
- DataSecDTO dto = new DataSecDTO();
|
|
|
+ public FieldSecDTO detailByCode(String secCode) {
|
|
|
+ LambdaQueryWrapper<FieldSec> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.select().eq(FieldSec::getSecCode, secCode);
|
|
|
+ FieldSec dataSec = dataSecMapper.selectOne(queryWrapper);
|
|
|
+ FieldSecDTO dto = new FieldSecDTO();
|
|
|
if (null == dataSec) {
|
|
|
return dto;
|
|
|
}
|
|
@@ -118,15 +103,15 @@ public class DataSecServiceImpl implements IDataSecService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Page<DataSecDTO> pageSearch(SearchDTO searchDTO) {
|
|
|
- Page<DataSec> dataSecs = dataSecMapper.pagingBySearchable(Searchable.toSearchable(searchDTO));
|
|
|
- List<DataSec> pageContent = dataSecs.getContent();
|
|
|
- List<DataSecDTO> collect = pageContent.stream().map(item -> {
|
|
|
- DataSecDTO dto = new DataSecDTO();
|
|
|
+ public Page<FieldSecDTO> pageSearch(SearchDTO searchDTO) {
|
|
|
+ Page<FieldSec> dataSecs = dataSecMapper.pagingBySearchable(Searchable.toSearchable(searchDTO));
|
|
|
+ List<FieldSec> pageContent = dataSecs.getContent();
|
|
|
+ List<FieldSecDTO> collect = pageContent.stream().map(item -> {
|
|
|
+ FieldSecDTO dto = new FieldSecDTO();
|
|
|
BeanUtils.copyProperties(item, dto);
|
|
|
return dto;
|
|
|
}).collect(Collectors.toList());
|
|
|
- Page<DataSecDTO> page = new PageImpl<>(collect, dataSecs.getPageable(), dataSecs.getTotalElements());
|
|
|
+ Page<FieldSecDTO> page = new PageImpl<>(collect, dataSecs.getPageable(), dataSecs.getTotalElements());
|
|
|
return page;
|
|
|
}
|
|
|
|
|
@@ -141,7 +126,7 @@ public class DataSecServiceImpl implements IDataSecService {
|
|
|
.collect(Collectors.toMap(DataLevelVo::getLevelCode, item -> item, (old, last) -> last));
|
|
|
List<DataLevelVo> vos = new ArrayList<>(collect.values());
|
|
|
for (DataLevelVo vo : vos) {
|
|
|
- DataSec dataSec = new DataSec();
|
|
|
+ FieldSec dataSec = new FieldSec();
|
|
|
dataSec.setSecCode(vo.getLevelCode());
|
|
|
dataSec.setSecName(vo.getLevelName());
|
|
|
dataSec.setDataType(vo.getTypeCode());
|
|
@@ -152,29 +137,29 @@ public class DataSecServiceImpl implements IDataSecService {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public List<DataSec> getByCodes(List<String> codes) {
|
|
|
- LambdaQueryWrapper<DataSec> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.select().in(DataSec::getSecCode, codes);
|
|
|
+ public List<FieldSec> getByCodes(List<String> codes) {
|
|
|
+ LambdaQueryWrapper<FieldSec> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.select().in(FieldSec::getSecCode, codes);
|
|
|
return dataSecMapper.selectList(queryWrapper);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<DataSec> getAll() {
|
|
|
+ public List<FieldSec> getAll() {
|
|
|
return dataSecMapper.selectList(null);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<DataSec> getByIds(List<String> ids) {
|
|
|
+ public List<FieldSec> getByIds(List<String> ids) {
|
|
|
if(CollectionUtils.isEmpty(ids)) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
- LambdaQueryWrapper<DataSec> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.select().in(DataSec::getId, ids);
|
|
|
+ LambdaQueryWrapper<FieldSec> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.select().in(FieldSec::getId, ids);
|
|
|
return dataSecMapper.selectList(queryWrapper);
|
|
|
}
|
|
|
|
|
|
- private void saveByCode(DataSec dataSec) {
|
|
|
- DataSec exist = this.getByCode(dataSec.getSecCode());
|
|
|
+ private void saveByCode(FieldSec dataSec) {
|
|
|
+ FieldSec exist = this.getByCode(dataSec.getSecCode());
|
|
|
if(null == exist) {
|
|
|
dataSec.setDeleted(BooleanEnum.FALSE.value);
|
|
|
dataSec.setCreateTime(new Date());
|
|
@@ -187,9 +172,9 @@ public class DataSecServiceImpl implements IDataSecService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private DataSec getByCode(String secCode) {
|
|
|
- LambdaQueryWrapper<DataSec> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.select().eq(DataSec::getSecCode, secCode);
|
|
|
+ private FieldSec getByCode(String secCode) {
|
|
|
+ LambdaQueryWrapper<FieldSec> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.select().eq(FieldSec::getSecCode, secCode);
|
|
|
return dataSecMapper.selectOne(queryWrapper);
|
|
|
}
|
|
|
}
|