导出优化
This commit is contained in:
parent
2a9eea531c
commit
d9cbc0b1d5
|
|
@ -5,6 +5,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import com.bonus.common.biz.config.ListPagingUtil;
|
import com.bonus.common.biz.config.ListPagingUtil;
|
||||||
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
import com.bonus.common.core.utils.ServletUtils;
|
import com.bonus.common.core.utils.ServletUtils;
|
||||||
import com.bonus.common.log.enums.OperaType;
|
import com.bonus.common.log.enums.OperaType;
|
||||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||||
|
|
@ -238,9 +239,19 @@ public class ScrapApplyDetailsController extends BaseController {
|
||||||
@SysLog(title = "报废任务详细", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出报废任务详细")
|
@SysLog(title = "报废任务详细", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出报废任务详细")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, ScrapApplyDetails scrapApplyDetails) {
|
public void export(HttpServletResponse response, ScrapApplyDetails scrapApplyDetails) {
|
||||||
|
String fileName = "报废审核列表";
|
||||||
|
if (scrapApplyDetails.getStartTime() != null && scrapApplyDetails.getEndTime() != null) {
|
||||||
|
fileName = "报废审核列表"+ "(时间" +scrapApplyDetails.getStartTime() + "至" + scrapApplyDetails.getEndTime()+ ")";
|
||||||
|
}
|
||||||
List<ScrapTaskListVo> list = scrapApplyDetailsService.selectScrapApplyDetailsList(scrapApplyDetails);
|
List<ScrapTaskListVo> list = scrapApplyDetailsService.selectScrapApplyDetailsList(scrapApplyDetails);
|
||||||
|
// 根据list集合数,去填充序号
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
list.get(i).setSeq(i + 1);
|
||||||
|
}
|
||||||
ExcelUtil<ScrapTaskListVo> util = new ExcelUtil<>(ScrapTaskListVo.class);
|
ExcelUtil<ScrapTaskListVo> util = new ExcelUtil<>(ScrapTaskListVo.class);
|
||||||
util.exportExcel(response, list, "报废任务详细数据");
|
// 获取当前年月日时分秒导出时间,用括号拼接在后面
|
||||||
|
String title = "报废审核列表" + "(" + "导出时间:" + DateUtils.getTime() + ")";
|
||||||
|
util.exportExcel(response, list, fileName, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,13 @@ public class ScrapTaskListVo {
|
||||||
|
|
||||||
@ApiModelProperty(value = "规格型号")
|
@ApiModelProperty(value = "规格型号")
|
||||||
private String typeName;
|
private String typeName;
|
||||||
|
@ApiModelProperty(value = "序号")
|
||||||
|
@Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC, width = 5)
|
||||||
|
private Integer seq;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "分公司")
|
||||||
|
@Excel(name = "分公司")
|
||||||
|
private String impUnitName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "退料单位名称")
|
@ApiModelProperty(value = "退料单位名称")
|
||||||
@Excel(name = "退料单位")
|
@Excel(name = "退料单位")
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
AND CHAR_LENGTH(sad.create_by) * 3 = LENGTH(sad.create_by)
|
AND CHAR_LENGTH(sad.create_by) * 3 = LENGTH(sad.create_by)
|
||||||
THEN sad.create_by -- 视为纯汉字,取sad.create_by
|
THEN sad.create_by -- 视为纯汉字,取sad.create_by
|
||||||
ELSE COALESCE(su.nick_name, '未知创建人') -- 否则取su.nick_name
|
ELSE COALESCE(su.nick_name, '未知创建人') -- 否则取su.nick_name
|
||||||
END AS createName
|
END AS createName,
|
||||||
|
sd.dept_name as impUnitName
|
||||||
FROM
|
FROM
|
||||||
scrap_apply_details sad
|
scrap_apply_details sad
|
||||||
LEFT JOIN ma_type mt on sad.type_id = mt.type_id
|
LEFT JOIN ma_type mt on sad.type_id = mt.type_id
|
||||||
|
|
@ -67,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
left join repair_audit_details rad ON sad.parent_id = rad.id
|
left join repair_audit_details rad ON sad.parent_id = rad.id
|
||||||
left join tm_task tt2 ON tt2.task_id = rad.task_id
|
left join tm_task tt2 ON tt2.task_id = rad.task_id
|
||||||
LEFT JOIN sys_user su ON su.user_name = sad.create_by
|
LEFT JOIN sys_user su ON su.user_name = sad.create_by
|
||||||
|
left join sys_dept sd on sd.dept_id = bpi.imp_unit
|
||||||
where
|
where
|
||||||
sad.scrap_source = '2'
|
sad.scrap_source = '2'
|
||||||
<if test="typeId != null "> and type_id = #{typeId}</if>
|
<if test="typeId != null "> and type_id = #{typeId}</if>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue