|
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import org.jeecg.common.constant.SymbolConstant;
|
|
|
import org.jeecg.config.JeecgBaseConfig;
|
|
|
import org.jeecg.modules.baogao.convert.BaogaoConvert;
|
|
|
import org.jeecg.modules.baogao.dto.ItdmBaogaoCreateDTO;
|
|
@@ -13,6 +14,7 @@ import org.jeecg.modules.baogao.mapper.ItdmBaogaoMapper;
|
|
|
import org.jeecg.modules.baogao.service.IItdmBaogaoService;
|
|
|
import org.jeecg.modules.baogao.util.PoiTiUtils;
|
|
|
import org.jeecg.modules.baogao.vo.ItdmBaogaoListVO;
|
|
|
+import org.jeecg.modules.baogao.vo.ItdmBaogaoVO;
|
|
|
import org.jeecg.modules.chuanganqi.entity.ItdmChuanganqi;
|
|
|
import org.jeecg.modules.chuanganqi.mapper.ItdmChuanganqiMapper;
|
|
|
import org.jeecg.modules.itdmDevice.entity.ItdmDevice;
|
|
@@ -157,15 +159,16 @@ public class ItdmBaogaoServiceImpl extends ServiceImpl<ItdmBaogaoMapper, ItdmBao
|
|
|
|
|
|
ItdmMoban itdmMoban = mobanMapper.selectById(dto.getBaogaoType());
|
|
|
|
|
|
- String fileName = jeecgBaseConfig.getPath().getUpload() + File.separator + "word" + File.separator + System.currentTimeMillis() + ".docx";
|
|
|
- FileUtil.touch(fileName);
|
|
|
+ String fileName = "word" + File.separator + System.currentTimeMillis() + ".docx";
|
|
|
+ String filePath = jeecgBaseConfig.getPath().getUpload() + File.separator +fileName;
|
|
|
+ FileUtil.touch(filePath);
|
|
|
|
|
|
|
|
|
try {
|
|
|
Map map = getMap(dto, itdmWeituoInfo, yangpins, testItems, getChuanganqiList(dto.getTestItemsIds()), getDeviceList(dto.getTestItemsIds()));
|
|
|
|
|
|
PoiTiUtils.create(jeecgBaseConfig.getPath().getUpload() + File.separator + itdmMoban.getFilePath(), map,
|
|
|
- new FileOutputStream(fileName));
|
|
|
+ new FileOutputStream(filePath));
|
|
|
} catch (IOException e) {
|
|
|
throw new RuntimeException(e);
|
|
|
} catch (ParseException e) {
|
|
@@ -173,7 +176,12 @@ public class ItdmBaogaoServiceImpl extends ServiceImpl<ItdmBaogaoMapper, ItdmBao
|
|
|
}
|
|
|
|
|
|
|
|
|
- itdmBaogao.setFilePath(fileName);
|
|
|
+ if (fileName.contains(SymbolConstant.DOUBLE_BACKSLASH)) {
|
|
|
+ itdmBaogao.setFilePath(fileName.replace(SymbolConstant.DOUBLE_BACKSLASH, SymbolConstant.SINGLE_SLASH));
|
|
|
+ }else{
|
|
|
+ itdmBaogao.setFilePath(fileName);
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
this.baseMapper.insert(itdmBaogao);
|
|
|
}
|
|
@@ -265,4 +273,28 @@ public class ItdmBaogaoServiceImpl extends ServiceImpl<ItdmBaogaoMapper, ItdmBao
|
|
|
return jeecgBaseConfig.getPath().getUpload() + File.separator + filepath;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ItdmBaogaoVO wordById(String id) {
|
|
|
+ ItdmBaogao baoVo = this.baseMapper.selectById(id);
|
|
|
+
|
|
|
+ String filepath = baoVo.getFilePath();
|
|
|
+
|
|
|
+ String key = FileUtil.mainName(filepath);
|
|
|
+ String fileType = FileUtil.extName(filepath);
|
|
|
+ String url = filepath;
|
|
|
+ String title = FileUtil.getName(filepath);
|
|
|
+
|
|
|
+
|
|
|
+ return new ItdmBaogaoVO(key, url,fileType, title);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ String s = "temap\\user.docx";
|
|
|
+ System.out.println(s.replace(SymbolConstant.DOUBLE_BACKSLASH, SymbolConstant.SINGLE_SLASH));
|
|
|
+
|
|
|
+
|
|
|
+ System.out.println(FileUtil.mainName(s));
|
|
|
+ }
|
|
|
}
|