Merge branch 'develop_master' of http://gitlab.91isoft.com:90/LiuChao/foton-slrs-system-rest into develop_master

This commit is contained in:
zhangyanduan
2022-10-13 18:09:32 +08:00
3 changed files with 109 additions and 1 deletions
@@ -5,14 +5,23 @@ import com.adc.da.base.web.BaseController;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarStandardsInfo.entity.ActSarItemsEO;
import com.adc.da.workFlow.entity.GetQBZXDExcelDto;
import com.adc.da.workFlow.service.ActSarItemsBussEOService;
import com.adc.da.workFlow.service.ActSarItemsLawsEOService;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.*;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/${restPath}/lawss/actSarItemsBuss")
@Api(description = "|ActSarItemsBuss|")
@@ -50,4 +59,66 @@ public class ActSarItemsBussEOController extends BaseController<ActSarItemsEO> {
public void autoUpdIndex(@RequestParam("pid") String pid,@RequestParam("bussId") String bussId) {
actSarItemsEOService.autoUpdIndex(pid,bussId);
}
@ApiOperation(value = "导出全部意见-企标制修订-技术标准-起草单位高级经理审核节点")
@PostMapping("/exportAllBZZXDJSBZ")
public void getAllStandYJCL(HttpServletResponse response, @RequestBody Map<String, String> params){
try {
net.sf.json.JSONArray jsonArray = net.sf.json.JSONArray.fromObject(params.get("json"));
List<Map<String, String>> data = (List<Map<String, String>>) jsonArray;
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf-8");
String textName="意见信息";
Map<String,String> map=new HashMap<>();
map.put("1","采纳");
map.put("2","部分采纳");
map.put("3","不采纳");
String fileName = URLEncoder.encode(textName, "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
data = data.stream().sorted(Comparator.comparing(m->m.get("modelNum"))).collect(Collectors.toList());
List<GetQBZXDExcelDto> standExcel=new ArrayList<>();
int i=0;
for (Map<String, String> idea : data){
i++;
GetQBZXDExcelDto getExcelDto = GetQBZXDExcelDto.builder()
.partCode(idea.get("modelNum"))
.oldText(idea.get("modelUpdBefore"))
.newText(idea.get("modelUpdAfter"))
.reason(idea.get("modelContent"))
.userName(idea.get("zrUserIdName"))
.deptName(idea.get("zrDeptIdName"))
.state(map.get(idea.get("opinionsAdopted")))
.cause(idea.get("opinionsAdoptedCont"))
.num(String.valueOf(i))
.build();
standExcel.add(getExcelDto);
}
List<List<String>> headList=new ArrayList<List<String>>();
headList.add(Lists.newArrayList("序号"));
headList.add(Lists.newArrayList("条款号"));
headList.add(Lists.newArrayList("修改前"));
headList.add(Lists.newArrayList("修改后"));
headList.add(Lists.newArrayList("修改理由"));
headList.add(Lists.newArrayList("提出部门"));
headList.add(Lists.newArrayList("责任人"));
headList.add(Lists.newArrayList("意见是否采纳"));
headList.add(Lists.newArrayList("采纳原因"));
EasyExcel.write(response.getOutputStream(), GetQBZXDExcelDto.class).head(headList).autoCloseStream(Boolean.FALSE).sheet("sheet1")
.doWrite(standExcel);
} catch (Exception e) {
response.reset();
response.setContentType("application/json");
response.setCharacterEncoding("utf-8");
try {
response.getWriter().println(JSON.toJSONString(Result.error()));
} catch (IOException ioException) {
ioException.printStackTrace();
}
}
}
}
@@ -0,0 +1,35 @@
package com.adc.da.workFlow.entity;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@HeadRowHeight(20)
@ColumnWidth(15)
public class GetQBZXDExcelDto {
private String num; // 序号
private String partCode; // 条款号
private String oldText; // 修改前
private String newText; // 修改后
private String reason; // 修改理由
private String deptName; // 提出部门
private String userName; // 责任人
private String state; // 意见是否采纳
private String cause; // 采纳理由
}
@@ -73,6 +73,8 @@ public class WebMvcConfig implements WebMvcConfigurer {
//从excl中导入标准
addInterceptor.excludePathPatterns("/api/ImportExcel/import");
//企标制修订-技术标准 意见导出
addInterceptor.excludePathPatterns("/api/lawss/actSarItemsBuss/exportAllBZZXDJSBZ");
//标准征求意见导出
addInterceptor.excludePathPatterns("/api/slrs/sar-public-idea-all/tuallStand");
// 标准征求意见流程意见导出