报废导出和查询bug代码提交

This commit is contained in:
liang.chao 2024-05-16 17:59:05 +08:00
parent ecc0dc1ecf
commit 876e346a7e
7 changed files with 495 additions and 59 deletions

View File

@ -1,39 +1,34 @@
package com.bonus.sgzb.material.controller; package com.bonus.sgzb.material.controller;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.bonus.sgzb.common.core.enums.ScrapSourceEnum; import cn.hutool.core.convert.Convert;
import com.bonus.sgzb.common.core.utils.ListPagingUtil;
import com.bonus.sgzb.common.core.utils.ServletUtils;
import com.bonus.sgzb.material.domain.*; import com.bonus.sgzb.material.domain.*;
import com.bonus.sgzb.material.service.IScrapApplyDetailsService; import com.bonus.sgzb.material.service.IScrapApplyDetailsService;
import com.bonus.sgzb.material.vo.ForecastWasteExcel; import com.bonus.sgzb.material.vo.*;
import com.bonus.sgzb.material.vo.ScrapApplyDetailsVO;
import com.bonus.sgzb.material.vo.ScrapAudit;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.bonus.sgzb.common.log.annotation.Log; import com.bonus.sgzb.common.log.annotation.Log;
import com.bonus.sgzb.common.log.enums.BusinessType; import com.bonus.sgzb.common.log.enums.BusinessType;
import com.bonus.sgzb.common.security.annotation.RequiresPermissions;
import com.bonus.sgzb.common.core.web.controller.BaseController; import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.core.utils.poi.ExcelUtil; import com.bonus.sgzb.common.core.utils.poi.ExcelUtil;
import com.bonus.sgzb.common.core.web.page.TableDataInfo; import com.bonus.sgzb.common.core.web.page.TableDataInfo;
import static com.bonus.sgzb.common.core.constant.Constants.PAGE_NUM;
import static com.bonus.sgzb.common.core.constant.Constants.PAGE_SIZE;
/** /**
* 报废任务详细 * 报废任务详细
* *
@ -66,24 +61,7 @@ public class ScrapApplyDetailsController extends BaseController {
return getDataTable(list); return getDataTable(list);
} }
/**
* 导出报废任务列表
*/
@Log(title = "导出报废任务列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ScrapApplyDetails bean) {
Map<String, Object> params = bean.getParams();
if (params != null && !params.isEmpty()) {
String beginTime = (String) params.get("beginTime");
String endTime = (String) params.get("endTime");
params.put("beginTime", beginTime + " 00:00:00");
params.put("endTime", endTime + " 23:59:59");
bean.setParams(params);
}
List<ScrapApplyDetailsVO> list = scrapApplyDetailsService.exportScrapApplyDetailsList(bean);
ExcelUtil<ScrapApplyDetailsVO> util = new ExcelUtil<ScrapApplyDetailsVO>(ScrapApplyDetailsVO.class);
util.exportExcel(response, list, "报废任务列表");
}
/** /**
* 查看报废任务详细列表 * 查看报废任务详细列表
@ -172,22 +150,17 @@ public class ScrapApplyDetailsController extends BaseController {
* 查询报废审核任务列表 * 查询报废审核任务列表
*/ */
@ApiOperation("查询报废审核任务列表") @ApiOperation("查询报废审核任务列表")
@PostMapping("/scrapTaskReviewList") @GetMapping("/scrapTaskReviewList")
public TableDataInfo scrapTaskReviewList(ScrapApplyDetails scrapApplyDetails) { public AjaxResult scrapTaskReviewList(ScrapApplyDetails scrapApplyDetails) {
startPage();
Map<String, Object> params = scrapApplyDetails.getParams();
if (!params.isEmpty()) {
String beginTime = (String) params.get("beginTime");
String endTime = (String) params.get("endTime");
params.put("beginTime", beginTime + " 00:00:00");
params.put("endTime", endTime + " 23:59:59");
scrapApplyDetails.setParams(params);
}
List<ScrapApplyDetailsVO> list = scrapApplyDetailsService.scrapTaskReviewList(scrapApplyDetails); List<ScrapApplyDetailsVO> list = scrapApplyDetailsService.scrapTaskReviewList(scrapApplyDetails);
return getDataTable(list); Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
} }
/** /**
* 报废任务审核----宁夏 * 报废任务审核----宁夏
*/ */
@ -204,18 +177,13 @@ public class ScrapApplyDetailsController extends BaseController {
*/ */
@ApiOperation("获取处置列表----宁夏") @ApiOperation("获取处置列表----宁夏")
@Log(title = "获取处置列表----宁夏", businessType = BusinessType.UPDATE) @Log(title = "获取处置列表----宁夏", businessType = BusinessType.UPDATE)
@PostMapping("/obtainDisposalList") @GetMapping("/obtainDisposalList")
public TableDataInfo obtainDisposalList(@RequestBody ScrapApplyDetails scrapApplyDetails) { public TableDataInfo obtainDisposalList(ScrapApplyDetails scrapApplyDetails) {
startPage(); startPage();
Map<String, Object> params = scrapApplyDetails.getParams();
if (!params.isEmpty()) {
String beginTime = (String) params.get("beginTime");
String endTime = (String) params.get("endTime");
params.put("beginTime", beginTime + " 00:00:00");
params.put("endTime", endTime + " 23:59:59");
scrapApplyDetails.setParams(params);
}
List<ScrapApplyDetailsVO> list = scrapApplyDetailsService.obtainDisposalList(scrapApplyDetails); List<ScrapApplyDetailsVO> list = scrapApplyDetailsService.obtainDisposalList(scrapApplyDetails);
// Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
// Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
// return AjaxResult.success(ListPagingUtil.paging(pageIndex,pageSize, list));
return getDataTable(list); return getDataTable(list);
} }
@ -227,14 +195,48 @@ public class ScrapApplyDetailsController extends BaseController {
@Log(title = "处置----宁夏", businessType = BusinessType.UPDATE) @Log(title = "处置----宁夏", businessType = BusinessType.UPDATE)
@PostMapping("/obtainDisposal") @PostMapping("/obtainDisposal")
public AjaxResult obtainDisposal(@RequestBody List<TmTask> tmTaskList) { public AjaxResult obtainDisposal(@RequestBody List<TmTask> tmTaskList) {
return toAjax(scrapApplyDetailsService.obtainDisposal(tmTaskList)); return toAjax(scrapApplyDetailsService.obtainDisposal(tmTaskList));
} }
/**
* 导出报废任务列表
*/
@Log(title = "导出预报废管理-报废列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ScrapApplyDetails bean) {
List<ScrapApplyDetailsVO> list = scrapApplyDetailsService.selectScrapApplyDetailsList(bean);
List<ScrapApplyDetailsBFLB> tmTaskDtos = Convert.toList(ScrapApplyDetailsBFLB.class, list);
ExcelUtil<ScrapApplyDetailsBFLB> util = new ExcelUtil<ScrapApplyDetailsBFLB>(ScrapApplyDetailsBFLB.class);
util.exportExcel(response, tmTaskDtos, "报废列表");
}
/**
* 导出报废审核任务列表
*/
@ApiOperation("导出报废管理-报废审核列表")
@PostMapping("/exportScrapTaskReviewList")
public void exportScrapTaskReviewList(HttpServletResponse response, ScrapApplyDetails scrapApplyDetails) {
List<ScrapApplyDetailsVO> list = scrapApplyDetailsService.scrapTaskReviewList(scrapApplyDetails);
List<ScrapApplyDetailsBFSH> tmTaskDtos = Convert.toList(ScrapApplyDetailsBFSH.class, list);
ExcelUtil<ScrapApplyDetailsBFSH> util = new ExcelUtil<ScrapApplyDetailsBFSH>(ScrapApplyDetailsBFSH.class);
util.exportExcel(response, tmTaskDtos, "报废审核列表");
}
/**
* 导出报废处置任务列表
*/
@ApiOperation("导出报废管理-报废处置列表")
@PostMapping("/exportObtainDisposalList")
public void exportObtainDisposalList(HttpServletResponse response, ScrapApplyDetails scrapApplyDetails) {
List<ScrapApplyDetailsVO> list = scrapApplyDetailsService.obtainDisposalList(scrapApplyDetails);
List<ScrapApplyDetailsBFCZ> tmTaskDtos = Convert.toList(ScrapApplyDetailsBFCZ.class, list);
ExcelUtil<ScrapApplyDetailsBFCZ> util = new ExcelUtil<ScrapApplyDetailsBFCZ>(ScrapApplyDetailsBFCZ.class);
util.exportExcel(response, tmTaskDtos, "报废处置列表");
}
/** /**
* 导出预报废审核列表 * 导出预报废审核列表
*/ */
@Log(title = "导出预报废审核列表", businessType = BusinessType.EXPORT) @Log(title = "导出预报废管理-预报废审核列表", businessType = BusinessType.EXPORT)
@PostMapping("/exportForecastWaste") @PostMapping("/exportForecastWaste")
public void exportForecastWaste(HttpServletResponse response, ScrapApplyDetails scrapApplyDetails) { public void exportForecastWaste(HttpServletResponse response, ScrapApplyDetails scrapApplyDetails) {
Map<String, Object> params = scrapApplyDetails.getParams(); Map<String, Object> params = scrapApplyDetails.getParams();

View File

@ -35,6 +35,7 @@ public class ScrapApplyDetails extends BaseEntity
* 审核状态 * 审核状态
*/ */
private Integer taskStatus; private Integer taskStatus;
private Integer disposition;
/** 上级ID */ /** 上级ID */
@ApiModelProperty(value = "上级ID") @ApiModelProperty(value = "上级ID")

View File

@ -0,0 +1,140 @@
package com.bonus.sgzb.material.vo;
import com.bonus.sgzb.common.core.annotation.Excel;
import com.bonus.sgzb.material.domain.ScrapAuditorSet;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**报废列表导出dto
* @Author 阮世耀
* @Create 2023/12/13 15:45
* @Version 1.0
*/
@Data
public class ScrapApplyDetailsBFCZ implements Serializable {
private static final long serialVersionUID = -4135112109792782142L;
/**
* 任务id
*/
private Long taskId;
/**
* 报废审核单号
*/
@Excel(name = "报废单号",sort = 1)
private String scrapNum;
/**
* 单位名称
*/
@Excel(name = "退料单位名称",sort = 4)
private String unitName;
/**
* 工程名称
*/
@Excel(name = "退料工程名称",sort = 5)
private String projectName;
/**
* 任务创建人
*/
@Excel(name = "任务创建人",sort = 7)
private String createBy;
/**
* 机具类型
*/
@Excel(name = "机具类型",sort = 6)
private String itemType;
/**
* 创建时间
*/
@Excel(name = "任务创建时间",sort = 8)
private String createTime;
/**
* 维修单号
*/
@Excel(name = "预报废单号",sort = 3)
private String repairNum;
/**
* 单位id
*/
private String unitId;
/**
* 工程id
*/
private String projectId;
/**
* 审核状态
*/
private Integer taskStatus;
/**
* 审核状态
*/
private String taskStatusName;
/**
* 不通过原因
*/
private String remark;
/**
* 机具类型
*/
private String type;
/**
* 规格型号
*/
private String typeName;
@ApiModelProperty(value = "机具编号")
private String maCode;
/** 报废数量 */
private BigDecimal scrapNum2;
/**
* 报废来源
*/
@Excel(name = "报废来源",sort = 2,readConverterExp = "1=退料,2=维修")
private Integer scrapSource;
/**
*退料单号
*/
private String repairCode;
/**
* 审核部门列表
*/
private List<ScrapAuditorSet> scrapAuditorSetList;
/**
* 处置
*/
@Excel(name = "处置状态",sort = 9,readConverterExp = "0=未处置,1=已处置")
private Integer disposition;
/**
* 文件地址
*/
private String dispositionFileUrl;
/**
* 文件名称
*/
private String dispositionFileName;
private String companyId;
}

View File

@ -0,0 +1,145 @@
package com.bonus.sgzb.material.vo;
import com.bonus.sgzb.common.core.annotation.Excel;
import com.bonus.sgzb.material.domain.ScrapAuditorSet;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* 报废列表导出dto
*
* @Author 阮世耀
* @Create 2023/12/13 15:45
* @Version 1.0
*/
@Data
public class ScrapApplyDetailsBFLB implements Serializable {
private static final long serialVersionUID = -4135112109792782142L;
/**
* 任务id
*/
private Long taskId;
/**
* 报废审核单号
*/
@Excel(name = "报废单号", sort = 1)
private String scrapNum;
/**
* 单位名称
*/
@Excel(name = "退料单位名称", sort = 4)
private String unitName;
/**
* 工程名称
*/
@Excel(name = "退料工程名称", sort = 5)
private String projectName;
/**
* 任务创建人
*/
@Excel(name = "任务创建人", sort = 7)
private String createBy;
/**
* 机具类型
*/
@Excel(name = "机具类型", sort = 6)
private String itemType;
/**
* 创建时间
*/
@Excel(name = "任务创建时间", sort = 8)
private String createTime;
/**
* 维修单号
*/
@Excel(name = "预报废单号", sort = 3)
private String repairNum;
/**
* 单位id
*/
private String unitId;
/**
* 工程id
*/
private String projectId;
/**
* 审核状态
*/
@Excel(name = "审核状态", sort = 9, readConverterExp = "58=审核中,59=已通过,61=已驳回,124=待提交")
private Integer taskStatus;
/**
* 审核状态
*/
private String taskStatusName;
/**
* 不通过原因
*/
private String remark;
/**
* 机具类型
*/
private String type;
/**
* 规格型号
*/
private String typeName;
@ApiModelProperty(value = "机具编号")
private String maCode;
/**
* 报废数量
*/
private BigDecimal scrapNum2;
/**
* 报废来源
*/
@Excel(name = "报废来源", sort = 2, readConverterExp = "1=退料,2=维修")
private Integer scrapSource;
/**
* 退料单号
*/
private String repairCode;
/**
* 审核部门列表
*/
private List<ScrapAuditorSet> scrapAuditorSetList;
/**
* 处置
*/
private Integer disposition;
/**
* 文件地址
*/
private String dispositionFileUrl;
/**
* 文件名称
*/
private String dispositionFileName;
private String companyId;
}

View File

@ -0,0 +1,140 @@
package com.bonus.sgzb.material.vo;
import com.bonus.sgzb.common.core.annotation.Excel;
import com.bonus.sgzb.material.domain.ScrapAuditorSet;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**报废审核导出dto
* @Author 阮世耀
* @Create 2023/12/13 15:45
* @Version 1.0
*/
@Data
public class ScrapApplyDetailsBFSH implements Serializable {
private static final long serialVersionUID = -4135112109792782142L;
/**
* 任务id
*/
private Long taskId;
/**
* 报废审核单号
*/
@Excel(name = "报废单号",sort = 1)
private String scrapNum;
/**
* 单位名称
*/
@Excel(name = "退料单位名称",sort = 4)
private String unitName;
/**
* 工程名称
*/
@Excel(name = "退料工程名称",sort = 5)
private String projectName;
/**
* 任务创建人
*/
@Excel(name = "任务创建人",sort = 7)
private String createBy;
/**
* 机具类型
*/
@Excel(name = "机具类型",sort = 6)
private String itemType;
/**
* 创建时间
*/
@Excel(name = "任务创建时间",sort = 8)
private String createTime;
/**
* 维修单号
*/
@Excel(name = "预报废单号",sort = 3)
private String repairNum;
/**
* 单位id
*/
private String unitId;
/**
* 工程id
*/
private String projectId;
/**
* 审核状态
*/
private Integer taskStatus;
/**
* 审核状态
*/
@Excel(name = "审核状态",sort = 9)
private String taskStatusName;
/**
* 不通过原因
*/
private String remark;
/**
* 机具类型
*/
private String type;
/**
* 规格型号
*/
private String typeName;
@ApiModelProperty(value = "机具编号")
private String maCode;
/** 报废数量 */
private BigDecimal scrapNum2;
/**
* 报废来源
*/
@Excel(name = "报废来源",sort = 2,readConverterExp = "1=退料,2=维修")
private Integer scrapSource;
/**
*退料单号
*/
private String repairCode;
/**
* 审核部门列表
*/
private List<ScrapAuditorSet> scrapAuditorSetList;
/**
* 处置
*/
private Integer disposition;
/**
* 文件地址
*/
private String dispositionFileUrl;
/**
* 文件名称
*/
private String dispositionFileName;
private String companyId;
}

View File

@ -564,11 +564,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null and type != ''"> <if test="type != null and type != ''">
and mt1.type_id = #{type} and mt1.type_id = #{type}
</if> </if>
<if test="taskStatus != null and taskStatus != ''">
and dic.id = #{taskStatus}
</if>
<if test="scrapSource != null and scrapSource != ''">
and sad.scrap_source = #{scrapSource}
</if>
<if test="backCode != null and backCode != ''"> <if test="backCode != null and backCode != ''">
and locate(#{backCode}, tk.code) > 0 and locate(#{backCode}, tk.code) > 0
</if> </if>
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
and tk.create_time between #{params.beginTime} and #{params.endTime} and tk.create_time between #{beginTime} and #{endTime}
</if> </if>
GROUP BY tk.CODE GROUP BY tk.CODE
order by tk.create_time desc order by tk.create_time desc

View File

@ -255,7 +255,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY create_time DESC LIMIT 1 ORDER BY create_time DESC LIMIT 1
</select> </select>
<select id="selectTmTaskListByDisposition" resultType="com.bonus.sgzb.material.vo.ScrapApplyDetailsVO"> <select id="selectTmTaskListByDisposition" resultType="com.bonus.sgzb.material.vo.ScrapApplyDetailsVO">
SELECT SELECT
tk.CODE scrapNum, tk.CODE scrapNum,
tk.task_status taskStatus, tk.task_status taskStatus,
@ -312,14 +311,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="backPro != null and backPro != ''"> <if test="backPro != null and backPro != ''">
and bpl.lot_id = #{backPro} and bpl.lot_id = #{backPro}
</if> </if>
<if test="disposition != null">
and tk.disposition = #{disposition}
</if>
<if test="type != null and type != ''"> <if test="type != null and type != ''">
and mt1.type_id = #{type} and mt1.type_id = #{type}
</if> </if>
<if test="backCode != null and backCode != ''"> <if test="backCode != null and backCode != ''">
and locate(#{backCode}, tk.code) > 0 and locate(#{backCode}, tk.code) > 0
</if> </if>
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
and tk.create_time between #{params.beginTime} and #{params.endTime} and tk.create_time between #{beginTime} and #{endTime}
</if> </if>
GROUP BY tk.CODE GROUP BY tk.CODE
order by tk.create_time desc order by tk.create_time desc