|
@@ -30,6 +30,7 @@ import org.springblade.core.tool.utils.ResourceUtil;
|
|
import org.springblade.manager.dto.WbsTreeContractDTO2;
|
|
import org.springblade.manager.dto.WbsTreeContractDTO2;
|
|
import org.springblade.manager.entity.ContractInfo;
|
|
import org.springblade.manager.entity.ContractInfo;
|
|
import org.springblade.manager.entity.WbsTreeContract;
|
|
import org.springblade.manager.entity.WbsTreeContract;
|
|
|
|
+import org.springblade.manager.entity.WbsTreePrivate;
|
|
import org.springblade.manager.feign.ContractClient;
|
|
import org.springblade.manager.feign.ContractClient;
|
|
import org.springblade.manager.service.IWbsTreeContractService;
|
|
import org.springblade.manager.service.IWbsTreeContractService;
|
|
import org.springblade.manager.service.impl.WbsTreeContractServiceImpl;
|
|
import org.springblade.manager.service.impl.WbsTreeContractServiceImpl;
|
|
@@ -38,6 +39,7 @@ import org.springblade.manager.vo.*;
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
|
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -325,10 +327,21 @@ public class WbsTreeContractController extends BladeController {
|
|
@ApiOperation(value = "客户端-下载元素表对应的excel模板", notes = "传入表的pKeyId")
|
|
@ApiOperation(value = "客户端-下载元素表对应的excel模板", notes = "传入表的pKeyId")
|
|
public void downloadExcel(@RequestParam String pKeyId, HttpServletResponse response) {
|
|
public void downloadExcel(@RequestParam String pKeyId, HttpServletResponse response) {
|
|
com.spire.xls.Workbook workbook = null;
|
|
com.spire.xls.Workbook workbook = null;
|
|
|
|
+ String htmlUrl = "";
|
|
try {
|
|
try {
|
|
WbsTreeContract tab = iWbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, pKeyId));
|
|
WbsTreeContract tab = iWbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, pKeyId));
|
|
- if (ObjectUtil.isEmpty(tab) || ObjectUtil.isEmpty(tab.getHtmlUrl())) {
|
|
|
|
- throw new ServiceException("未获取到对应的表信息");
|
|
|
|
|
|
+ if (ObjectUtil.isEmpty(tab)) {
|
|
|
|
+ //如果合同段没查询到,那么有可能是试验的数据,试验从项目获取树的表信息
|
|
|
|
+ WbsTreePrivate treePrivateTab = jdbcTemplate.query("select * from m_wbs_tree_private where p_key_id = " + pKeyId, new BeanPropertyRowMapper<>(WbsTreePrivate.class)).stream().findAny().orElse(null);
|
|
|
|
+ if (treePrivateTab != null && treePrivateTab.getHtmlUrl() != null) {
|
|
|
|
+ htmlUrl = treePrivateTab.getHtmlUrl();
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ htmlUrl = tab.getHtmlUrl();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (ObjectUtil.isEmpty(htmlUrl)) {
|
|
|
|
+ throw new ServiceException("未获取到对应的表的html信息");
|
|
}
|
|
}
|
|
|
|
|
|
//将html转换为excel
|
|
//将html转换为excel
|