update:车型项目库导出

This commit is contained in:
zj
2021-07-27 15:55:51 +08:00
parent d5ed912644
commit f23df40628
6 changed files with 45 additions and 54 deletions
@@ -60,6 +60,7 @@ public class TsInstitution extends BaseEntity {
private String hasChild;
@TableField(exist = false)
@ApiModelProperty("用户")
private TsUserVO tsUserVO;
@@ -64,5 +64,16 @@ public class SarPublicIdeaController extends BaseController<SarPublicIdea> {
return Result.success(publicList);
}
@ApiOperation(value = "发起标准征求意见流程后自动公开征求意见")
@PostMapping("/addSarPublicIdea")
public ResponseMessage addSarPublicIdea(@RequestBody SarPublicIdea sarPublicIdea){
try{
sarPublicIdeaService.save(sarPublicIdea);
}catch(Exception e){
return Result.error();
}
return Result.success();
}
}
@@ -109,14 +109,14 @@ public class SarStandProjectLibraryController extends BaseController<SarStandPro
@ApiOperation("查询标准信息")
public ResponseMessage queryStandInfo(@RequestParam(defaultValue = "1", value = "current")int current, @RequestParam(defaultValue = "10", value = "PageSize") int pageSize,
String id){
List<SarStandProjectLibrary> list = sarStandProjectLibraryService.queryStandId(id);
List<String> list1 = new ArrayList();
for(SarStandProjectLibrary s:list){
list1.add(s.getStandId());
}
System.out.println(list1);
IPage<StandAttrInfoDto> list2 = sarStandProjectLibraryService.queryStandInfo(current,pageSize,id);
return Result.success("200",list2);
// List<SarStandProjectLibrary> list = sarStandProjectLibraryService.queryStandId(id);
// List<String> list1 = new ArrayList();
// for(SarStandProjectLibrary s:list){
// list1.add(s.getStandId());
// }
// System.out.println(list1);
IPage<StandAttrInfoDto> list = sarStandProjectLibraryService.queryStandInfo(current,pageSize,id);
return Result.success("200",list);
}
/**
*
@@ -156,7 +156,7 @@ public class SarStandProjectLibraryController extends BaseController<SarStandPro
**/
@ApiOperation("导出Excel表")
@GetMapping(value = "/exportStandAttrInfoExcel")
public void exportStandAttrInfoExcel(StandAttrInfoExcelDto standAttrInfoExcelDto, HttpServletResponse response) throws Exception {
public void exportStandAttrInfoExcel(StandAttrInfoExcelDto standAttrInfoExcelDto, HttpServletResponse response,String id) throws Exception {
try {
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf-8");
@@ -166,9 +166,9 @@ public class SarStandProjectLibraryController extends BaseController<SarStandPro
}
String fileName = URLEncoder.encode(standAttrInfoExcelDto.getExportName(), "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
List<StandAttrInfoDto> data= sarStandProjectLibraryService.exportStandAttrInfoExcel(standAttrInfoExcelDto);
List<StandAttrInfoDto> data= sarStandProjectLibraryService.exportStandAttrInfoExcel(standAttrInfoExcelDto,id);
// 这里需要设置不关闭流
EasyExcel.write(response.getOutputStream(), StandAttrInfoDto.class).autoCloseStream(Boolean.FALSE).sheet("sheet1")
EasyExcel.write(response.getOutputStream(), StandAttrInfoDto.class).useDefaultStyle(false).autoCloseStream(Boolean.FALSE).sheet("sheet1")
.doWrite(data);
} catch (Exception e) {
System.out.println(e);
@@ -1,5 +1,6 @@
package com.adc.da.slrs.sarStandProjectLibrary.entity;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
@@ -18,11 +19,13 @@ import java.time.LocalDateTime;
@Data
@HeadRowHeight(35)
@ColumnWidth(30)
@ExcelIgnoreUnannotated
public class StandAttrInfoDto {
//标准编号
@ExcelProperty("标准编号")
private String standId;
//标准编号
@ExcelProperty("标准号")
private String standNumber;
//中文名称
@ExcelProperty("中文名称")
private String standName;
@@ -16,6 +16,6 @@ public interface SarStandProjectLibraryService {
IPage<StandAttrInfoDto> queryStandInfo(int current, int pageSize, String standId);
void deleteByIds(List<String> ids);
void batchInsert(@Param("ids") List<StandProjectRelationDto> list);
List<StandAttrInfoDto> exportStandAttrInfoExcel(StandAttrInfoExcelDto standAttrInfoExcelDto);
List<StandAttrInfoDto> exportStandAttrInfoExcel(StandAttrInfoExcelDto standAttrInfoExcelDto,String standId);
}
@@ -165,7 +165,7 @@ public class SarStandProjectLibraryServiceImpl extends ServiceImpl<SarStandProje
@Override
public IPage<StandAttrInfoDto> queryStandInfo(int current, int pageSize, String standId) {
QueryWrapper<SarStandardsInfo> wrapper1 = new QueryWrapper<>();
wrapper1.select("ID","STAND_NAME","STAND_EN_NAME");
wrapper1.select("ID","STAND_NUMBER","STAND_NAME","STAND_EN_NAME");
wrapper1.last("INNER JOIN sar_stand_project_relation r ON r.stand_id = sar_standards_info.ID WHERE r.project_id ='"+ standId+"'");
Page<SarStandardsInfo> page1 = new Page<>(current, pageSize);
IPage<SarStandardsInfo> userIPage1 = SarStandardsInfoDao.selectPage(page1, wrapper1);
@@ -186,6 +186,7 @@ public class SarStandProjectLibraryServiceImpl extends ServiceImpl<SarStandProje
for(SarStandardsInfo s:list1){
StandAttrInfoDto p =new StandAttrInfoDto();
p.setStandId(s.getId());
p.setStandNumber(s.getStandNumber());
p.setStandName(s.getStandName());
p.setStandEnName(s.getStandEnName());
for (SarStandAttrInfo a:list2){
@@ -201,7 +202,6 @@ public class SarStandProjectLibraryServiceImpl extends ServiceImpl<SarStandProje
}
}
list.add(p);
System.out.println(list);
}
IPage<StandAttrInfoDto> userIPage = new Page<>();
userIPage.setRecords(list);
@@ -222,60 +222,37 @@ public class SarStandProjectLibraryServiceImpl extends ServiceImpl<SarStandProje
}
@Override
public List<StandAttrInfoDto> exportStandAttrInfoExcel(StandAttrInfoExcelDto standAttrInfoExcelDto) {
public List<StandAttrInfoDto> exportStandAttrInfoExcel(StandAttrInfoExcelDto standAttrInfoExcelDto ,String id) {
List<String> ids = standAttrInfoExcelDto.getIds();
List<StandAttrInfoDto> list = new ArrayList<>();
if (ids==null||ids.size()==0){
QueryWrapper<SarStandardsInfo> wrapper1 = new QueryWrapper<>();
wrapper1.select("ID","STAND_NAME","STAND_EN_NAME");
wrapper1.last("INNER JOIN sar_stand_project_relation r ON r.stand_id = sar_standards_info.ID");
List<SarStandardsInfo> userList1 = SarStandardsInfoDao.selectList(wrapper1);
QueryWrapper<SarStandAttrInfo> wrapper2 = new QueryWrapper<>();
wrapper2.select("r.STAND_ID","SSRQ","XCXSSRQGJ","ZCCSSRQGJ","ZRBM","KCCVPPSBM","KCCVPPSCN","CYCVPPSBM","CYCVPPSCN");
wrapper2.last("INNER JOIN sar_stand_project_relation r ON r.stand_id = sar_stand_attr_info.STAND_ID");
List<SarStandAttrInfo> userList2 = sarStandAttrInfoDao.selectList(wrapper2);
for(SarStandardsInfo s:userList1){
StandAttrInfoDto p =new StandAttrInfoDto();
p.setStandId(s.getId());
p.setStandName(s.getStandName());
p.setStandEnName(s.getStandEnName());
for (SarStandAttrInfo a:userList2){
if(s.getId().equals(a.getStandId())){
p.setCYCVPPSBM(a.getCycvppsbm());
p.setCYCVPPSCN(a.getCycvppscn());
p.setSSRQ(a.getSsrq());
p.setXCXSSRQGJ(a.getXcxssrqgj());
p.setZCCSSRQGJ(a.getZccssrqgj());
p.setKCCVPPSBM(a.getKccvppsbm());
p.setKCCVPPSCN(a.getKccvppscn());
p.setZRBM(a.getZrbm());
}
}
list.add(p);
}
}else {
String idmis=String.join(",",ids);
System.out.println(idmis);
QueryWrapper<SarStandardsInfo> wrapper1 = new QueryWrapper<>();
wrapper1.select("ID","STAND_NAME","STAND_EN_NAME");
wrapper1.last("INNER JOIN sar_stand_project_relation r ON r.stand_id = sar_standards_info.ID WHERE r.stand_id in ("+ idmis +")");
wrapper1.select("ID","STAND_NUMBER","STAND_NAME","STAND_EN_NAME");
wrapper1.last("INNER JOIN sar_stand_project_relation r ON r.stand_id = sar_standards_info.ID WHERE r.stand_id in ("+ idmis +") and r.project_id = '"+ id+"'");
List<SarStandardsInfo> userList1 = SarStandardsInfoDao.selectList(wrapper1);
QueryWrapper<SarStandAttrInfo> wrapper2 = new QueryWrapper<>();
wrapper2.select("r.STAND_ID","SSRQ","XCXSSRQGJ","ZCCSSRQGJ","ZRBM","KCCVPPSBM","KCCVPPSCN","CYCVPPSBM","CYCVPPSCN");
wrapper2.last("INNER JOIN sar_stand_project_relation r ON r.stand_id = sar_stand_attr_info.STAND_ID WHERE r.stand_id in ("+ idmis +")");
wrapper2.last("INNER JOIN sar_stand_project_relation r ON r.stand_id = sar_stand_attr_info.STAND_ID WHERE r.stand_id in ("+ idmis +") and r.project_id = '"+ id+"'");
List<SarStandAttrInfo> userList2 = sarStandAttrInfoDao.selectList(wrapper2);
for(SarStandardsInfo s:userList1){
StandAttrInfoDto p =new StandAttrInfoDto();
p.setStandId(s.getId());
p.setStandNumber(s.getStandNumber());
p.setStandName(s.getStandName());
p.setStandEnName(s.getStandEnName());
for (SarStandAttrInfo a:userList2){
if(s.getId().equals(a.getStandId())){
p.setCYCVPPSBM(a.getCycvppsbm());
p.setCYCVPPSCN(a.getCycvppscn());
p.setSSRQ(a.getSsrq());
p.setXCXSSRQGJ(a.getXcxssrqgj());
p.setZCCSSRQGJ(a.getZccssrqgj());
if (a.getSsrq()!=null){
p.setSSRQ(a.getSsrq().substring(0,10));
}
if (a.getXcxssrqgj()!=null){
p.setXCXSSRQGJ(a.getXcxssrqgj().substring(0,10));
}
if (a.getZccssrqgj()!=null){
p.setZCCSSRQGJ(a.getZccssrqgj().substring(0,10));
}
p.setKCCVPPSBM(a.getKccvppsbm());
p.setKCCVPPSCN(a.getKccvppscn());
p.setZRBM(a.getZrbm());
@@ -283,7 +260,6 @@ public class SarStandProjectLibraryServiceImpl extends ServiceImpl<SarStandProje
}
list.add(p);
}
}
return list;
}