Merge branch 'develop_master' into 'FOTON'
Develop master See merge request LiuChao/foton-slrs-system-rest!297
This commit is contained in:
+45
-13
@@ -23,7 +23,9 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -103,23 +105,46 @@ public class SarPublicIdeaAllController extends BaseController<SarPublicIdeaAll>
|
||||
try {
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
String fileName = URLEncoder.encode("意见详情", "UTF-8").replaceAll("\\+", "%20");
|
||||
String textName="";
|
||||
if ("1".equals(type)){
|
||||
textName= "流程意见详情";
|
||||
}else {
|
||||
textName="意见详情";
|
||||
}
|
||||
Map<String,String> map=new HashMap<>();
|
||||
map.put("1","上报");
|
||||
map.put("2","处理后上报");
|
||||
String fileName = URLEncoder.encode(textName, "UTF-8").replaceAll("\\+", "%20");
|
||||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||
List<SarPublicIdeaAll> data=new ArrayList<>();
|
||||
if (!StringUtils.isEmpty(cid)){
|
||||
data=sarPublicIdeaAllDao.getPublicAllIdea(cid,type);
|
||||
}
|
||||
List<GetExcelDto> standExcel=new ArrayList<>();
|
||||
List<GetExcelDto2> standExcel2=new ArrayList<>();
|
||||
for (SarPublicIdeaAll sarPublicIdeaAll:data){
|
||||
GetExcelDto getExcelDto=GetExcelDto.builder()
|
||||
.partCode(sarPublicIdeaAll.getPartCode())
|
||||
.oldText(sarPublicIdeaAll.getOldText())
|
||||
.newText(sarPublicIdeaAll.getNewText())
|
||||
.reason(sarPublicIdeaAll.getReason())
|
||||
.userName(sarPublicIdeaAll.getUserName())
|
||||
.deptName(sarPublicIdeaAll.getDeptName())
|
||||
.build();
|
||||
standExcel.add(getExcelDto);
|
||||
if ("1".equals(type)) {
|
||||
GetExcelDto2 getExcelDto = GetExcelDto2.builder()
|
||||
.partCode(sarPublicIdeaAll.getPartCode())
|
||||
.oldText(sarPublicIdeaAll.getOldText())
|
||||
.newText(sarPublicIdeaAll.getNewText())
|
||||
.reason(sarPublicIdeaAll.getReason())
|
||||
.userName(sarPublicIdeaAll.getUserName())
|
||||
.deptName(sarPublicIdeaAll.getDeptName())
|
||||
.state(map.get(sarPublicIdeaAll.getState()))
|
||||
.build();
|
||||
standExcel2.add(getExcelDto);
|
||||
}else {
|
||||
GetExcelDto getExcelDto = GetExcelDto.builder()
|
||||
.partCode(sarPublicIdeaAll.getPartCode())
|
||||
.oldText(sarPublicIdeaAll.getOldText())
|
||||
.newText(sarPublicIdeaAll.getNewText())
|
||||
.reason(sarPublicIdeaAll.getReason())
|
||||
.userName(sarPublicIdeaAll.getUserName())
|
||||
.deptName(sarPublicIdeaAll.getDeptName())
|
||||
.build();
|
||||
standExcel.add(getExcelDto);
|
||||
}
|
||||
}
|
||||
|
||||
List<List<String>> headList=new ArrayList<List<String>>();
|
||||
@@ -129,9 +154,16 @@ public class SarPublicIdeaAllController extends BaseController<SarPublicIdeaAll>
|
||||
headList.add(Lists.newArrayList("修改意见内容(包括理由或依据)","修改理由"));
|
||||
headList.add(Lists.newArrayList("提出部门"));
|
||||
headList.add(Lists.newArrayList("提出人"));
|
||||
|
||||
EasyExcel.write(response.getOutputStream(),GetExcelDto.class).head(headList).autoCloseStream(Boolean.FALSE).sheet("sheet1")
|
||||
.doWrite(standExcel);
|
||||
if ("1".equals(type)){
|
||||
headList.add(Lists.newArrayList("处理意见"));
|
||||
}
|
||||
if ("1".equals(type)) {
|
||||
EasyExcel.write(response.getOutputStream(), GetExcelDto2.class).head(headList).autoCloseStream(Boolean.FALSE).sheet("sheet1")
|
||||
.doWrite(standExcel2);
|
||||
}else {
|
||||
EasyExcel.write(response.getOutputStream(), GetExcelDto.class).head(headList).autoCloseStream(Boolean.FALSE).sheet("sheet1")
|
||||
.doWrite(standExcel);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
response.reset();
|
||||
response.setContentType("application/json");
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.adc.da.slrs.sarStandIdea.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;
|
||||
|
||||
/**
|
||||
* //用于导出
|
||||
*
|
||||
* @author ZhangZhiYuan
|
||||
* @date 2021-07-14
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@HeadRowHeight(20)
|
||||
@ColumnWidth(15)
|
||||
public class GetExcelDto2 {
|
||||
|
||||
// @ExcelProperty("章节编号")
|
||||
private String partCode;
|
||||
// @ExcelProperty("修改意见内容(包括理由或依据)")
|
||||
// private String content;
|
||||
private String oldText;
|
||||
|
||||
private String newText;
|
||||
|
||||
private String reason;
|
||||
// @ExcelProperty("提出部门")
|
||||
private String deptName;
|
||||
// @ExcelProperty("提出人")
|
||||
private String userName;
|
||||
|
||||
private String state;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -72,4 +72,7 @@ public class SarPublicIdeaAll extends BaseEntity {
|
||||
@TableField("wk_flag")
|
||||
private String wkFlag;
|
||||
|
||||
@TableField("state")
|
||||
private String state;
|
||||
|
||||
}
|
||||
|
||||
+3
-3
@@ -33,16 +33,16 @@
|
||||
</select>
|
||||
|
||||
<select id="getPublicAllIdea" resultType="com.adc.da.slrs.sarStandIdea.entity.SarPublicIdeaAll">
|
||||
SELECT sar_public_idea_all.id,reason,ts_institution.name as deptName,old_text,new_text,dept_id,part_code,user_name,user_id,content,idea_id,cid,chapter_name,wk_flag
|
||||
SELECT sar_public_idea_all.id,reason,ts_institution.name as deptName,old_text,new_text,dept_id,part_code,user_name,user_id,content,idea_id,cid,chapter_name,wk_flag,sar_public_idea_all.state
|
||||
FROM sar_public_idea_all
|
||||
left join ts_user on ts_user.USID=sar_public_idea_all.user_id
|
||||
left join ts_institution on ts_institution.id=ts_user.INSTITUTION_ID
|
||||
WHERE cid = #{cid}
|
||||
WHERE sar_public_idea_all.idea_id = #{cid}
|
||||
<if test="null==type or ''==type">
|
||||
and sar_public_idea_all.wk_flag is null
|
||||
</if>
|
||||
<if test="null!=type and type != ''">
|
||||
and sar_public_idea_all.wk_flag =='1'
|
||||
and sar_public_idea_all.wk_flag ='1'
|
||||
</if>
|
||||
ORDER BY part_code ASC
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user