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.io.IOException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -103,23 +105,46 @@ public class SarPublicIdeaAllController extends BaseController<SarPublicIdeaAll>
|
|||||||
try {
|
try {
|
||||||
response.setContentType("application/vnd.ms-excel");
|
response.setContentType("application/vnd.ms-excel");
|
||||||
response.setCharacterEncoding("utf-8");
|
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");
|
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||||
List<SarPublicIdeaAll> data=new ArrayList<>();
|
List<SarPublicIdeaAll> data=new ArrayList<>();
|
||||||
if (!StringUtils.isEmpty(cid)){
|
if (!StringUtils.isEmpty(cid)){
|
||||||
data=sarPublicIdeaAllDao.getPublicAllIdea(cid,type);
|
data=sarPublicIdeaAllDao.getPublicAllIdea(cid,type);
|
||||||
}
|
}
|
||||||
List<GetExcelDto> standExcel=new ArrayList<>();
|
List<GetExcelDto> standExcel=new ArrayList<>();
|
||||||
|
List<GetExcelDto2> standExcel2=new ArrayList<>();
|
||||||
for (SarPublicIdeaAll sarPublicIdeaAll:data){
|
for (SarPublicIdeaAll sarPublicIdeaAll:data){
|
||||||
GetExcelDto getExcelDto=GetExcelDto.builder()
|
if ("1".equals(type)) {
|
||||||
.partCode(sarPublicIdeaAll.getPartCode())
|
GetExcelDto2 getExcelDto = GetExcelDto2.builder()
|
||||||
.oldText(sarPublicIdeaAll.getOldText())
|
.partCode(sarPublicIdeaAll.getPartCode())
|
||||||
.newText(sarPublicIdeaAll.getNewText())
|
.oldText(sarPublicIdeaAll.getOldText())
|
||||||
.reason(sarPublicIdeaAll.getReason())
|
.newText(sarPublicIdeaAll.getNewText())
|
||||||
.userName(sarPublicIdeaAll.getUserName())
|
.reason(sarPublicIdeaAll.getReason())
|
||||||
.deptName(sarPublicIdeaAll.getDeptName())
|
.userName(sarPublicIdeaAll.getUserName())
|
||||||
.build();
|
.deptName(sarPublicIdeaAll.getDeptName())
|
||||||
standExcel.add(getExcelDto);
|
.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>>();
|
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("提出部门"));
|
headList.add(Lists.newArrayList("提出部门"));
|
||||||
headList.add(Lists.newArrayList("提出人"));
|
headList.add(Lists.newArrayList("提出人"));
|
||||||
|
if ("1".equals(type)){
|
||||||
EasyExcel.write(response.getOutputStream(),GetExcelDto.class).head(headList).autoCloseStream(Boolean.FALSE).sheet("sheet1")
|
headList.add(Lists.newArrayList("处理意见"));
|
||||||
.doWrite(standExcel);
|
}
|
||||||
|
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) {
|
} catch (Exception e) {
|
||||||
response.reset();
|
response.reset();
|
||||||
response.setContentType("application/json");
|
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")
|
@TableField("wk_flag")
|
||||||
private String wkFlag;
|
private String wkFlag;
|
||||||
|
|
||||||
|
@TableField("state")
|
||||||
|
private String state;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -33,16 +33,16 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getPublicAllIdea" resultType="com.adc.da.slrs.sarStandIdea.entity.SarPublicIdeaAll">
|
<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
|
FROM sar_public_idea_all
|
||||||
left join ts_user on ts_user.USID=sar_public_idea_all.user_id
|
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
|
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">
|
<if test="null==type or ''==type">
|
||||||
and sar_public_idea_all.wk_flag is null
|
and sar_public_idea_all.wk_flag is null
|
||||||
</if>
|
</if>
|
||||||
<if test="null!=type and type != ''">
|
<if test="null!=type and type != ''">
|
||||||
and sar_public_idea_all.wk_flag =='1'
|
and sar_public_idea_all.wk_flag ='1'
|
||||||
</if>
|
</if>
|
||||||
ORDER BY part_code ASC
|
ORDER BY part_code ASC
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
Reference in New Issue
Block a user