dongdingding
杜函宇 1 week ago
parent 383b2d4d9e
commit dcf308dfe8

@ -37,6 +37,8 @@ import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.nio.file.StandardOpenOption; import java.nio.file.StandardOpenOption;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
/** /**
@ -51,17 +53,6 @@ import java.util.*;
public class BasicInformationController extends BaseController { public class BasicInformationController extends BaseController {
@Value("${ruoyi.profile}") @Value("${ruoyi.profile}")
private String fileAddress; private String fileAddress;
// 1.审核通过之后再审核不要通知
// 2.项目评价配置和详情那边同步显示
// 3.换掉项目动态导出模板
// 6.项目不填项目起止日期导入失败
// 7.企业端统计项目总数有问题
// 9.项目基础信息时间查询改了格式
// 10.添加项目统计页面根据年份查找统计数据
// 4.项目汇编管理修改pdf
// 5.月度报告修改
// 8.企业和政务登录
@Resource @Resource
private SysDictDataMapper sysDictDataMapper; private SysDictDataMapper sysDictDataMapper;
@ -281,6 +272,7 @@ public class BasicInformationController extends BaseController {
} }
/** /**
* *
*/ */
@ -341,6 +333,32 @@ public class BasicInformationController extends BaseController {
// planInformationService.save(planInformation); // planInformationService.save(planInformation);
// }); // });
// return AjaxResult.success(); // return AjaxResult.success();
// }
// /**
// * 123
// */
// @ApiOperation("66666")
// @PostMapping("/a5")
// public void e1() {
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// // 待转换的字符串
// String dateTimeStr = "2025-04-11 16:52:19";
// // 转换为 LocalDateTime
// List<BasicInformation> list = basicInformationService.list();
// List<Mx> mx1 = mxService.list();
// list.forEach(x-> {
// //添加五要素模型信息
// List<WysmxInformation> wys = new ArrayList<>();
// mx1.forEach(y -> {
// WysmxInformation wysmxInformation = new WysmxInformation();
// wysmxInformation.setYsmc(y.getName());
// wysmxInformation.setZdname(y.getJtzb());
// wysmxInformation.setXmId(x.getId());
// wys.add(wysmxInformation);
// });
// wysmxInformationService.saveBatch(wys);
// });W
// } // }
@ApiOperation(value = "导出单片材料") @ApiOperation(value = "导出单片材料")

@ -0,0 +1,84 @@
package com.ruoyi.gysl.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.gysl.entity.GyslBqgl;
import com.ruoyi.gysl.entity.request.ZwIdPageReq;
import com.ruoyi.gysl.service.GyslBqglService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.Serializable;
import java.util.List;
/**
* (GyslBqgl)
*
* @author makejava
* @since 2025-04-15 09:18:33
*/
@Api(tags = "标签管理")
@RestController
@RequestMapping("/gysl/bqgl")
public class GyslBqglController extends BaseController {
/**
*
*/
@Resource
private GyslBqglService gyslBqglService;
/**
* id
*
* @param zwIdPageReq
* @return
*/
@ApiOperation("根据项目id查询项目标签管理")
@GetMapping("/searchId")
public AjaxResult selectAll(@Valid ZwIdPageReq zwIdPageReq) {
return success(gyslBqglService.searchId(zwIdPageReq));
}
/**
*
*
* @param gyslBqgl
* @return
*/
@PostMapping("/add")
@ApiOperation("新增数据")
public AjaxResult insert(@RequestBody GyslBqgl gyslBqgl) {
return success(gyslBqglService.save(gyslBqgl));
}
/**
*
*
* @param gyslBqgl
* @return
*/
@PostMapping("/edit")
@ApiOperation("修改数据")
public AjaxResult update(@RequestBody GyslBqgl gyslBqgl) {
return success(gyslBqglService.updateById(gyslBqgl));
}
/**
*
*
* @param idList
* @return
*/
@ApiOperation("删除数据")
@DeleteMapping("/delete")
public AjaxResult delete(@RequestParam("idList") List<Long> idList) {
return success(gyslBqglService.removeByIds(idList));
}
}

@ -3,18 +3,22 @@ package com.ruoyi.gysl.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.layout.Document;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.gysl.entity.GyslProjectHandbook; import com.ruoyi.gysl.entity.GyslProjectHandbook;
import com.ruoyi.gysl.service.GyslProjectHandbookService; import com.ruoyi.gysl.service.GyslProjectHandbookService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.io.File;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
import static com.ruoyi.common.core.domain.AjaxResult.success; import static com.ruoyi.common.core.domain.AjaxResult.success;
@ -28,12 +32,15 @@ import static com.ruoyi.common.core.domain.AjaxResult.success;
@RestController @RestController
@RequestMapping("/gysl/handbook") @RequestMapping("/gysl/handbook")
public class GyslProjectHandbookController { public class GyslProjectHandbookController {
/** /**
* *
*/ */
@Resource @Resource
private GyslProjectHandbookService gyslProjectHandbookService; private GyslProjectHandbookService gyslProjectHandbookService;
/** /**
* *
* *
@ -91,7 +98,7 @@ public class GyslProjectHandbookController {
*/ */
@ApiOperation("删除数据") @ApiOperation("删除数据")
@DeleteMapping("/delete") @DeleteMapping("/delete")
public AjaxResult delete(@RequestParam("idList") List<Long> idList) { public AjaxResult delete(@RequestParam("idList") java.util.List<Long> idList) {
return success(gyslProjectHandbookService.removeByIds(idList)); return success(gyslProjectHandbookService.removeByIds(idList));
} }
@ -103,8 +110,8 @@ public class GyslProjectHandbookController {
@PostMapping(value = "/export") @PostMapping(value = "/export")
public void export(HttpServletResponse response, @RequestParam Integer id) public void export(HttpServletResponse response, @RequestParam Integer id)
throws Exception { throws Exception {
gyslProjectHandbookService.generatePdfs(response,id);
} }
} }

@ -0,0 +1,45 @@
package com.ruoyi.gysl.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.io.Serializable;
import com.ruoyi.gysl.entity.baseModel.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* (GyslBqgl)
*
* @author makejava
* @since 2025-04-15 09:18:33
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("gysl_bqgl")
@ApiModel(value="标签管理")
public class GyslBqgl extends BaseModel {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "项目id")
private Long xmId;
@ApiModelProperty(value ="标签类型" )
private Integer type;
@ApiModelProperty(value ="标签名称" )
private String name;
}

@ -41,4 +41,7 @@ public class BasicInformationResponse {
@ApiModelProperty("其他信息") @ApiModelProperty("其他信息")
private List<ProjectOtherInfo> projectOtherInfos; private List<ProjectOtherInfo> projectOtherInfos;
@ApiModelProperty("标签管理")
private List<BqglResponse> bqglResponses;
} }

@ -0,0 +1,23 @@
package com.ruoyi.gysl.entity.response;
import com.ruoyi.gysl.entity.GyslBqgl;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* 1
* @author du
* @since 2025/4/15 9:47
*/
@Data
public class BqglResponse {
@ApiModelProperty(value ="标签类型" )
private Integer type;
@ApiModelProperty(value ="标签名称" )
private List<GyslBqgl> list;
}

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.gysl.entity.*; import com.ruoyi.gysl.entity.*;
import com.ruoyi.gysl.entity.request.BasicInformationPageReq; import com.ruoyi.gysl.entity.request.BasicInformationPageReq;
import com.ruoyi.gysl.entity.response.BasicInformationResponse;
import com.ruoyi.gysl.entity.response.ProjectExcelInfo; import com.ruoyi.gysl.entity.response.ProjectExcelInfo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -20,7 +21,7 @@ public interface BasicInformationMapper extends BaseMapper<BasicInformation> {
/** /**
* *
*/ */
List<ProjectExcelInfo> selectList(); List<ProjectExcelInfo> selectProjectList();
/** /**
* *
@ -62,5 +63,12 @@ public interface BasicInformationMapper extends BaseMapper<BasicInformation> {
List<WysmxInformation> select3(@Param("id") Long id); List<WysmxInformation> select3(@Param("id") Long id);
QyrzInformation select4(@Param("id") Long id); QyrzInformation select4(@Param("id") Long id);
List<ProjectOtherInfo> select5(@Param("id") Long id); List<ProjectOtherInfo> select5(@Param("id") Long id);
/**
* id
*/
List<BasicInformationResponse> idListToProject(@Param("idList") List<String> idList);
} }

@ -0,0 +1,29 @@
package com.ruoyi.gysl.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.gysl.entity.*;
import com.ruoyi.gysl.entity.request.BasicInformationPageReq;
import com.ruoyi.gysl.entity.request.ZwIdPageReq;
import com.ruoyi.gysl.entity.response.ProjectExcelInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* (gysl_bqgl)访
*
* @author makejava
* @since 2025-02-24 09:25:51
*/
public interface GyslBqglMapper extends BaseMapper<GyslBqgl> {
/**
* id
*
* @param zwIdPageReq
* @return
*/
List<GyslBqgl> searchId(@Param("req") ZwIdPageReq zwIdPageReq);
}

@ -0,0 +1,26 @@
package com.ruoyi.gysl.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.gysl.entity.GyslBqgl;
import com.ruoyi.gysl.entity.request.ZwIdPageReq;
import com.ruoyi.gysl.entity.response.BqglResponse;
import java.util.List;
/**
* (GyslBqgl)
*
* @author makejava
* @since 2025-04-15 09:18:33
*/
public interface GyslBqglService extends IService<GyslBqgl> {
/**
* id
*
* @param zwIdPageReq
* @return
*/
List<BqglResponse> searchId(ZwIdPageReq zwIdPageReq);
}

@ -1,7 +1,14 @@
package com.ruoyi.gysl.service; package com.ruoyi.gysl.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.itextpdf.layout.Document;
import com.ruoyi.gysl.entity.BasicInformation;
import com.ruoyi.gysl.entity.GyslProjectHandbook; import com.ruoyi.gysl.entity.GyslProjectHandbook;
import com.ruoyi.gysl.entity.response.BasicInformationResponse;
import javax.servlet.http.HttpServletResponse;
import java.io.FileNotFoundException;
import java.net.MalformedURLException;
/** /**
* (GyslProjectHandbook) * (GyslProjectHandbook)
@ -11,5 +18,29 @@ import com.ruoyi.gysl.entity.GyslProjectHandbook;
*/ */
public interface GyslProjectHandbookService extends IService<GyslProjectHandbook> { public interface GyslProjectHandbookService extends IService<GyslProjectHandbook> {
/**
* pdf
*/
void generatePdfs(HttpServletResponse response,Integer id) throws FileNotFoundException, MalformedURLException;
/**
*
*/
void addCoverPage(Document document, GyslProjectHandbook gyslProjectHandbook) throws MalformedURLException;
/**
*
*/
void addTableOfContents(Document document, java.util.List<BasicInformationResponse> basicInfoList);
/**
*
*/
void addProductPages(Document document, java.util.List<BasicInformationResponse> basicInfoList) throws MalformedURLException;
} }

@ -111,6 +111,9 @@ public class BasicInformationServiceImpl extends ServiceImpl<BasicInformationMap
@Resource @Resource
private EnterpriseService enterpriseService; private EnterpriseService enterpriseService;
@Resource
private GyslBqglService gyslBqglService;
/** /**
* *
* *
@ -129,7 +132,7 @@ public class BasicInformationServiceImpl extends ServiceImpl<BasicInformationMap
*/ */
@Override @Override
public List<ProjectExcelInfo> selectList() { public List<ProjectExcelInfo> selectList() {
return baseMapper.selectList(); return baseMapper.selectProjectList();
} }
@ -239,6 +242,8 @@ public class BasicInformationServiceImpl extends ServiceImpl<BasicInformationMap
basicInformationResponse.setProjectRemarks(projectRemarkService.list(remarkPageReq)); basicInformationResponse.setProjectRemarks(projectRemarkService.list(remarkPageReq));
//其他信息 //其他信息
basicInformationResponse.setProjectOtherInfos(otherInfoService.searchId(zwIdPageReq)); basicInformationResponse.setProjectOtherInfos(otherInfoService.searchId(zwIdPageReq));
//标签管理
basicInformationResponse.setBqglResponses(gyslBqglService.searchId(zwIdPageReq));
return basicInformationResponse; return basicInformationResponse;
} }
@ -269,6 +274,8 @@ public class BasicInformationServiceImpl extends ServiceImpl<BasicInformationMap
projectRemarkService.lambdaUpdate().eq(ProjectRemark::getXmId, x).remove(); projectRemarkService.lambdaUpdate().eq(ProjectRemark::getXmId, x).remove();
//删除其他信息 //删除其他信息
otherInfoService.lambdaUpdate().eq(ProjectOtherInfo::getXmId, x).remove(); otherInfoService.lambdaUpdate().eq(ProjectOtherInfo::getXmId, x).remove();
//删除标签管理
gyslBqglService.lambdaUpdate().eq(GyslBqgl::getXmId, x).remove();
}); });
} }
@ -353,6 +360,8 @@ public class BasicInformationServiceImpl extends ServiceImpl<BasicInformationMap
} else { } else {
basicInformationResponse.setProjectOtherInfos(otherInfoService.searchId(zwIdPageReq)); basicInformationResponse.setProjectOtherInfos(otherInfoService.searchId(zwIdPageReq));
} }
//标签管理
basicInformationResponse.setBqglResponses(gyslBqglService.searchId(zwIdPageReq));
return basicInformationResponse; return basicInformationResponse;
} }
@ -392,13 +401,13 @@ public class BasicInformationServiceImpl extends ServiceImpl<BasicInformationMap
* dict_typedict_value * dict_typedict_value
*/ */
@Override @Override
public String getDictLabel(String dictType, String dictValue,List<SysDictData> sysDictData) { public String getDictLabel(String dictType, String dictValue, List<SysDictData> sysDictData) {
List<SysDictData> collect = sysDictData.stream().filter(x -> List<SysDictData> collect = sysDictData.stream().filter(x ->
x.getDictType().equals(dictType) && x.getDictValue().equals(dictValue)) x.getDictType().equals(dictType) && x.getDictValue().equals(dictValue))
.collect(Collectors.toList()); .collect(Collectors.toList());
if (collect.isEmpty()){ if (collect.isEmpty()) {
return "/"; return "/";
}else { } else {
return collect.get(0).getDictLabel(); return collect.get(0).getDictLabel();
} }
} }

@ -0,0 +1,64 @@
package com.ruoyi.gysl.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.gysl.entity.GyslBqgl;
import com.ruoyi.gysl.entity.request.ZwIdPageReq;
import com.ruoyi.gysl.entity.response.BqglResponse;
import com.ruoyi.gysl.mapper.GyslBqglMapper;
import com.ruoyi.gysl.service.GyslBqglService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* (GyslBqgl)
*
* @author makejava
* @since 2025-04-15 09:18:33
*/
@Service("gyslBqglService")
public class GyslBqglServiceImpl extends ServiceImpl<GyslBqglMapper, GyslBqgl> implements GyslBqglService {
/**
* id
*
* @param zwIdPageReq
* @return
*/
@Override
public List<BqglResponse> searchId(ZwIdPageReq zwIdPageReq) {
List<GyslBqgl> lists = baseMapper.searchId(zwIdPageReq);
// 按 type 分组,并转换为 BqglResponsetype 是 Integer分组键类型需一致
Map<Integer, BqglResponse> groupedMap = lists.stream()
.filter(e -> e.getType() != null) // 过滤无效分组键type 为 null 的条目)
.collect(Collectors.groupingBy(
GyslBqgl::getType,
Collectors.collectingAndThen(
Collectors.toList(),
list -> {
BqglResponse data = new BqglResponse();
data.setType(list.get(0).getType()); // 取第一个元素的 type分组后 type 相同)
// 过滤并转换子项(仅保留 name 和 type 均非 null 的条目)
List<GyslBqgl> itemList = list.stream()
.filter(e -> e.getName() != null && e.getType() != null)
.map(e -> {
GyslBqgl item = new GyslBqgl();
item.setId(e.getId());
item.setName(e.getName());
item.setType(e.getType());
return item;
})
.collect(Collectors.toList());
data.setList(itemList);
return data;
}
)
));
return groupedMap.values().stream()
.filter(response -> !response.getList().isEmpty())
.collect(Collectors.toList());
}
}

@ -1,11 +1,36 @@
package com.ruoyi.gysl.service.impl; package com.ruoyi.gysl.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itextpdf.io.image.ImageData;
import com.itextpdf.io.image.ImageDataFactory;
import com.itextpdf.kernel.colors.ColorConstants;
import com.itextpdf.kernel.colors.DeviceRgb;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.layout.Document;
import com.itextpdf.layout.element.*;
import com.itextpdf.layout.properties.AreaBreakType;
import com.itextpdf.layout.properties.HorizontalAlignment;
import com.itextpdf.layout.properties.TextAlignment;
import com.itextpdf.layout.properties.UnitValue;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.gysl.entity.GyslProjectHandbook; import com.ruoyi.gysl.entity.GyslProjectHandbook;
import com.ruoyi.gysl.entity.response.BasicInformationResponse;
import com.ruoyi.gysl.mapper.BasicInformationMapper;
import com.ruoyi.gysl.mapper.ProjectHandBookMapper; import com.ruoyi.gysl.mapper.ProjectHandBookMapper;
import com.ruoyi.gysl.service.GyslProjectHandbookService; import com.ruoyi.gysl.service.GyslProjectHandbookService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.FileNotFoundException;
import java.net.MalformedURLException;
import java.util.Arrays;
/** /**
* (GyslProjectHandbook) * (GyslProjectHandbook)
* *
@ -15,5 +40,167 @@ import org.springframework.stereotype.Service;
@Service("gyslProjectHandbookService") @Service("gyslProjectHandbookService")
public class GyslProjectHandbookServiceImpl extends ServiceImpl<ProjectHandBookMapper, GyslProjectHandbook> implements GyslProjectHandbookService { public class GyslProjectHandbookServiceImpl extends ServiceImpl<ProjectHandBookMapper, GyslProjectHandbook> implements GyslProjectHandbookService {
@Resource
private BasicInformationMapper basicInformationMapper;
/**
* pdf
*/
@Override
public void generatePdfs(HttpServletResponse response, Integer id) throws FileNotFoundException, MalformedURLException {
//获取当前手册信息
GyslProjectHandbook byId = getById(id);
//获取手册对应项目信息
java.util.List<BasicInformationResponse> basicInfoList = basicInformationMapper.idListToProject
(Arrays.asList(byId.getXmId().split(",")));
// 设置响应头
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "attachment; filename=\"product_catalog.pdf\"");
try (
// 直接绑定到 response 的输出流(不再生成本地文件)
PdfDocument pdf = new PdfDocument(new PdfWriter(response.getOutputStream()));
Document document = new Document(pdf)
) {
addCoverPage(document, byId);
addTableOfContents(document, basicInfoList);
addProductPages(document, basicInfoList);
} catch (Exception e) {
response.reset(); // 清除已写入的内容
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
throw new RuntimeException("PDF生成失败", e);
}
}
/**
*
*/
@Override
public void addCoverPage(Document document, GyslProjectHandbook gyslProjectHandbook) throws MalformedURLException {
//添加手册名称
Paragraph coverTitle = new Paragraph(gyslProjectHandbook.getName())
.setFontSize(30)
.setBold()
.setFontColor(ColorConstants.BLUE)
.setTextAlignment(TextAlignment.CENTER)
.setMarginTop(200); // 垂直居中
document.add(coverTitle);
//添加副标题
Paragraph ft = new Paragraph(gyslProjectHandbook.getSubtitle())
.setFontSize(22)
.setFontColor(ColorConstants.BLUE)
.setTextAlignment(TextAlignment.RIGHT)
.setMarginTop(300); // 垂直居中
document.add(ft);
//添加封面图片
try {
if (!FileUtils.checkAllowDownload(gyslProjectHandbook.getCoverImg())) {
throw new ServiceException("资源文件({})非法! ");
}
// 本地资源路径
String localPath = RuoYiConfig.getProfile();
// 数据库资源地址
String downloadPath = localPath + StringUtils.substringAfter(gyslProjectHandbook.getCoverImg(), Constants.RESOURCE_PREFIX);
ImageData imageData = ImageDataFactory.create(downloadPath);
Image image = new Image(imageData).setWidth(300).setHorizontalAlignment(HorizontalAlignment.CENTER);
document.add(image);
} catch (Exception e) {
throw new ServiceException("下载文件失败! ");
}
document.add(new AreaBreak()); // 强制分页
}
/**
*
*/
@Override
public void addTableOfContents(Document document, java.util.List<BasicInformationResponse> basicInfoList) {
Paragraph tocTitle = new Paragraph("目录")
.setFontSize(20)
.setBold()
.setTextAlignment(TextAlignment.CENTER);
document.add(tocTitle);
List tocList = new List()
.setSymbolIndent(20);
basicInfoList.forEach(x -> tocList.add(x.getBasicInformation().getName()));
document.add(tocList);
document.add(new AreaBreak(AreaBreakType.NEXT_PAGE));
}
/**
*
*/
@Override
public void addProductPages(Document document, java.util.List<BasicInformationResponse> basicInfoList) throws MalformedURLException {
basicInfoList.forEach(x -> {
Paragraph chapter1 = new Paragraph(x.getBasicInformation().getName())
.setFontSize(18)
.setBold();
document.add(chapter1);
// 1. 添加园区信息表格
Table parkTable = new Table(UnitValue.createPercentArray(new float[]{30, 70}))
.setWidth(UnitValue.createPercentValue(100))
.setMarginBottom(20)
.setKeepTogether(true); // 保持表格在同一页;
// 园区信息标题(蓝色背景)
Cell cell = new Cell(1, 2)
.setBackgroundColor(new DeviceRgb(33, 150, 243))
.add(new Paragraph("园区信息")
.setFontColor(DeviceRgb.WHITE)
.setFontSize(16)
.setBold())
.setTextAlignment(TextAlignment.CENTER)
.setPadding(8);
parkTable.addCell(cell);
// 添加园区信息行
parkTable.addCell(new Cell().add(new Paragraph("总投资额")).setPadding(5));
parkTable.addCell(new Cell().add(new Paragraph("项目标签")).setPadding(5));
parkTable.addCell(new Cell().add(new Paragraph("项目标签")).setPadding(5));
parkTable.addCell(new Cell().add(new Paragraph("2.87万m²")).setPadding(5));
parkTable.addCell(new Cell().add(new Paragraph("现状分类")).setPadding(5));
parkTable.addCell(new Cell().add(new Paragraph("毛坯")).setPadding(5));
parkTable.addCell(new Cell().add(new Paragraph("重点发展产业")).setPadding(5));
parkTable.addCell(new Cell().add(new Paragraph("70个")).setPadding(5));
parkTable.addCell(new Cell().add(new Paragraph("建设模式")).setPadding(5));
parkTable.addCell(new Cell().add(new Paragraph("宿舍78间")).setPadding(5));
parkTable.addCell(new Cell().add(new Paragraph("所属功能区")).setPadding(5));
parkTable.addCell(new Cell().add(new Paragraph("A栋18900m²B栋5500m²整租价格可议")).setPadding(5));
document.add(parkTable);
// 2. 添加厂房信息表格
Table factoryTable = new Table(UnitValue.createPercentArray(new float[]{25, 35, 35}))
.setWidth(UnitValue.createPercentValue(100)).setKeepTogether(true); // 保持表格在同一页;
// 厂房信息标题(蓝色背景)
Cell cell2 = new Cell(1, 2)
.setBackgroundColor(new DeviceRgb(33, 150, 243))
.add(new Paragraph("厂房信息")
.setFontColor(DeviceRgb.WHITE)
.setFontSize(16)
.setBold())
.setTextAlignment(TextAlignment.CENTER)
.setPadding(8);
factoryTable.addCell(cell2);
// 子标题(浅灰色背景)
Cell z1 = new Cell()
.setBackgroundColor(new DeviceRgb(245, 245, 245))
.add(new Paragraph("A栋具体参数").setBold())
.setTextAlignment(TextAlignment.CENTER)
.setPadding(5);
factoryTable.addCell(z1);
Cell z2 = new Cell()
.setBackgroundColor(new DeviceRgb(245, 245, 245))
.add(new Paragraph("B栋具体参数").setBold())
.setTextAlignment(TextAlignment.CENTER)
.setPadding(5);
factoryTable.addCell(z2);
// 添加参数行
factoryTable.addCell(new Cell().add(new Paragraph("租金")).setPadding(5));
factoryTable.addCell(new Cell().add(new Paragraph("首层35元/m²2-3层30元/m²4-9层25元/m²")).setPadding(5));
factoryTable.addCell(new Cell().add(new Paragraph("首层32元/m²2-3层26元/m²4-5层25元/m²")).setPadding(5));
factoryTable.addCell(new Cell().add(new Paragraph("租金")).setPadding(5));
factoryTable.addCell(new Cell().add(new Paragraph("首层35元/m²2-3层30元/m²4-9层25元/m²")).setPadding(5));
factoryTable.addCell(new Cell().add(new Paragraph("首层32元/m²2-3层26元/m²4-5层25元/m²")).setPadding(5));
document.add(factoryTable);
});
}
} }

@ -78,6 +78,7 @@ public class CommonController
/** /**
* *
*/ */
@ApiOperation("通用上传请求")
@PostMapping("/upload") @PostMapping("/upload")
public AjaxResult uploadFile(MultipartFile file) throws Exception public AjaxResult uploadFile(MultipartFile file) throws Exception
{ {
@ -142,6 +143,7 @@ public class CommonController
* *
*/ */
@GetMapping("/download/resource") @GetMapping("/download/resource")
@ApiOperation("本地资源通用下载")
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response) public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
throws Exception throws Exception
{ {

@ -289,7 +289,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="select5" resultType="com.ruoyi.gysl.entity.ProjectOtherInfo"> <select id="select5" resultType="com.ruoyi.gysl.entity.ProjectOtherInfo">
select * from copy_gysl_project_other_info where xm_id =#{id} select * from copy_gysl_project_other_info where xm_id =#{id}
</select> </select>
<select id="selectList" resultMap="ProjectExcelInfoResult"> <select id="selectProjectList" resultMap="ProjectExcelInfoResult">
SELECT SELECT
a.xmfrdwxz, a.xmfrdwxz,
a.nature, a.nature,
@ -347,6 +347,59 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where a.longitude is not null and a.latitude is not null where a.longitude is not null and a.latitude is not null
</select> </select>
<resultMap type="com.ruoyi.gysl.entity.response.BasicInformationResponse" id="BasicInformationResponseMap">
<association property="basicInformation" javaType="BasicInformation" resultMap="BasicInfor"/>
<association property="qyrzInformation" javaType="QyrzInformation" resultMap="QyrzInfor"/>
<association property="planInformation" javaType="PlanInformation" resultMap="PlanInfor"/>
<collection ofType="com.ruoyi.gysl.entity.BuildingInformation" property="buildingInformation" javaType="java.util.List">
<result property="id" column="id"/>
</collection>
</resultMap>
<resultMap type="com.ruoyi.gysl.entity.BasicInformation" id="BasicInfor">
<result property="id" column="id"/>
<result property="ztze" column="ztze"/>
<result property="label" column="label"/>
<result property="xzfl" column="xzfl"/>
<result property="prioritize" column="prioritize"/>
<result property="ssgnq" column="ssgnq"/>
<result property="jsms" column="jsms"/>
</resultMap>
<resultMap type="com.ruoyi.gysl.entity.PlanInformation" id="PlanInfor">
<result property="id" column="id"/>
<result property="zjzmj" column="zjzmj"/>
<result property="zydmj" column="zydmj"/>
<result property="bzcjzmj" column="bzcjzmj"/>
<result property="zgjzgd" column="zgjzgd"/>
<result property="jzds" column="jzds"/>
<result property="zgjzcs" column="zgjzcs"/>
<result property="fhdj" column="fhdj"/>
<result property="jdctcw" column="jdctcw"/>
<result property="fjdctcw" column="fjdctcw"/>
</resultMap>
<resultMap type="com.ruoyi.gysl.entity.QyrzInformation" id="QyrzInfor">
<result property="id" column="id"/>
<result property="yczmj" column="yczmj"/>
<result property="kzczmj" column="kzczmj"/>
<result property="gycfpjzj" column="gycfpjzj"/>
<result property="gycfpjwyf" column="gycfpjwyf"/>
</resultMap>
<select id="idListToProject" resultMap="BasicInformationResponseMap">
SELECT a.*,b.*,
c.*
FROM gysl_basic_information a
left join gysl_plan_information b on a.id = b.xm_id
left join gysl_building_information c on a.id = c.xm_id
<where>
<if test="idList != null">
and a.id in
<foreach collection="idList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
order by a.create_time desc
</select>
</mapper> </mapper>

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.gysl.mapper.GyslBqglMapper">
<select id="searchId" resultType="com.ruoyi.gysl.entity.GyslBqgl">
select * from gysl_bqgl
<where>
<if test="req.xmId != null and req.xmId != ''">
AND xm_id = #{req.xmId}
</if>
</where>
</select>
</mapper>

@ -25,6 +25,43 @@
FROM gysl_basic_information a FROM gysl_basic_information a
LEFT JOIN gysl_plan_information b ON a.id = b.xm_id LEFT JOIN gysl_plan_information b ON a.id = b.xm_id
where a.tyshxydm = #{userName} where a.tyshxydm = #{userName}
SELECT COUNT(*) AS allProject,
ROUND(IFNULL(SUM(b.zjzmj), 0) / 10000, 1) AS allGrossArea,
IFNULL(SUM(CASE WHEN a.xzfl = 1 THEN 1 ELSE 0 END), 0) AS allBuilding1,
IFNULL(SUM(CASE WHEN a.xzfl = 2 THEN 1 ELSE 0 END), 0) AS allBuilding2,
IFNULL(SUM(CASE WHEN a.xzfl = 3 THEN 1 ELSE 0 END), 0) AS allBuilding3,
<!-- 当前新开工项目数 -->
IFNULL(SUM(
<choose>
<when test="years != null and years != ''">
CASE WHEN LEFT(a.begain_time, 4) = #{years} THEN 1 ELSE 0 END
</when>
<otherwise>
CASE WHEN LEFT(a.begain_time, 4) = YEAR(NOW()) THEN 1 ELSE 0 END
</otherwise>
</choose>
), 0) AS currentYearProject,
<!-- 当年_建筑面积 -->
ROUND(IFNULL(SUM(
CASE WHEN LEFT(a.begain_time, 4) = YEAR(NOW()) THEN b.zjzmj ELSE 0 END
), 0)/10000,1) AS currentYearGrossArea,
<!-- 当年_已建数量 -->
IFNULL(SUM(
CASE WHEN LEFT(a.begain_time, 4) = YEAR(NOW()) and a.xzfl = 1 THEN 1 ELSE 0 END
), 0) AS currentBuilding1,
<!-- 当年_在建数量 -->
IFNULL(SUM(
CASE WHEN LEFT(a.begain_time, 4) = YEAR(NOW()) and a.xzfl = 2 THEN 1 ELSE 0 END
), 0) AS currentBuilding2,
<!-- 当年_拟建数量 -->
IFNULL(SUM(
CASE WHEN LEFT(a.begain_time, 4) = YEAR(NOW()) and a.xzfl = 3 THEN 1 ELSE 0 END
), 0) AS currentBuilding3
FROM gysl_basic_information a
LEFT JOIN gysl_plan_information b ON a.id = b.xm_id
where a.tyshxydm = #{userName}
</select> </select>
<select id="relationalProject" resultType="com.ruoyi.gysl.entity.BasicInformation"> <select id="relationalProject" resultType="com.ruoyi.gysl.entity.BasicInformation">

@ -61,16 +61,16 @@
left join gysl_building_information b on a.id = b.xm_id and b.sfwzyld = 1 left join gysl_building_information b on a.id = b.xm_id and b.sfwzyld = 1
<where> <where>
<if test="req.xzfl != null"> <if test="req.xzfl != null">
AND xzfl = #{req.xzfl} AND a.xzfl = #{req.xzfl}
</if> </if>
<if test="req.name != null and req.name != '' "> <if test="req.name != null and req.name != '' ">
AND name like concat('%',#{req.name},'%') AND a.name like concat('%',#{req.name},'%')
</if> </if>
<if test="req.begainTime != null and req.begainTime!= ''"> <if test="req.begainTime != null and req.begainTime!= ''">
AND begain_time = #{req.begainTime} AND a.begain_time = #{req.begainTime}
</if> </if>
<if test="req.endTime != null and req.endTime!=''"> <if test="req.endTime != null and req.endTime!=''">
AND end_time = #{req.endTime} AND a.end_time = #{req.endTime}
</if> </if>
</where> </where>
group by a.id group by a.id

Loading…
Cancel
Save