This commit is contained in:
mashuai 2026-01-19 17:34:24 +08:00
parent d47ca17451
commit e365cae41c
5 changed files with 53 additions and 8 deletions

View File

@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import java.math.BigDecimal;
import java.util.Date;
@ -27,6 +28,10 @@ public class LeaseApplyDetailExport extends BaseEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "序号")
@Excel(name = "序号", isSequence = true, sort = 0, width = 5)
private Integer serialNumber;
/** ID */
private Long id;
@ -105,11 +110,11 @@ public class LeaseApplyDetailExport extends BaseEntity{
@ApiModelProperty(value = "领料数量")
@Excel(name = "领料数量",sort=12)
@Excel(name = "领料数量",sort=12, cellType = Excel.ColumnType.NUMERIC, align = HorizontalAlignment.RIGHT)
private BigDecimal alNum;
@ApiModelProperty(value = "出库数量")
@Excel(name = "出库数量",sort=13)
@Excel(name = "出库数量",sort=13, cellType = Excel.ColumnType.NUMERIC, align = HorizontalAlignment.RIGHT)
private BigDecimal outNum;
@ApiModelProperty(value = "开始时间")

View File

@ -28,6 +28,10 @@ public class LeaseApplyInfoExport extends BaseEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "序号")
@Excel(name = "序号", isSequence = true, sort = 0, width = 5)
private Integer serialNumber;
/** ID */
private Long id;

View File

@ -75,6 +75,8 @@ public class SelectController {
@ApiOperation(value = "领料申请往来单位下拉选")
@PostMapping("getMaterialUnitList")
public AjaxResult getMaterialUnitList(@RequestBody BmUnit bmUnit) {
Long deptId = typeService.getUserDeptId();
bmUnit.setCompanyId(deptId);
return service.getMaterialUnitList(bmUnit);
}
@ -145,6 +147,8 @@ public class SelectController {
@PostMapping("getMaterialProjectList")
public AjaxResult getMaterialProjectList(@RequestBody BmProject bmProject) {
try {
Long deptId = typeService.getUserDeptId();
bmProject.setCompanyId(deptId);
return service.getMaterialProjectList(bmProject);
} catch (Exception e) {
log.error("获取数据失败");

View File

@ -5,6 +5,7 @@ import com.bonus.common.biz.annotation.StoreLog;
import com.bonus.common.biz.config.ListPagingUtil;
import com.bonus.common.biz.config.PoiOutPage;
import com.bonus.common.biz.domain.lease.*;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.ServletUtils;
import com.bonus.common.core.utils.bean.BeanUtils;
import com.bonus.common.core.utils.poi.ExcelUtil;
@ -180,15 +181,21 @@ public class LeaseApplyInfoController extends BaseController {
public void exportLeaseOutRecord(HttpServletResponse response, LeaseApplyInfo leaseApplyInfo) {
Long deptId = typeService.getUserDeptId();
leaseApplyInfo.setCompanyId(deptId);
String fileName = "领料记录";
if (leaseApplyInfo.getStartTime() != null && leaseApplyInfo.getEndTime() != null) {
fileName = "领料记录" + leaseApplyInfo.getStartTime() + "" + leaseApplyInfo.getEndTime();
}
List<LeaseApplyInfo> list = leaseApplyInfoService.selectLeaseApplyInfoList(leaseApplyInfo);
List<LeaseApplyInfoExport> exportList = new ArrayList<>();
for (LeaseApplyInfo leaseApplyInfo1 : list) {
for (int i = 0; i < list.size(); i++) {
LeaseApplyInfoExport leaseApplyInfoExport = new LeaseApplyInfoExport();
BeanUtils.copyProperties(leaseApplyInfo1, leaseApplyInfoExport);
BeanUtils.copyProperties(list.get(i), leaseApplyInfoExport);
leaseApplyInfoExport.setSerialNumber(i + 1);
exportList.add(leaseApplyInfoExport);
}
String title = "领料出库列表" + "" + "导出时间:" + DateUtils.getTime() + "";
ExcelUtil<LeaseApplyInfoExport> util = new ExcelUtil<>(LeaseApplyInfoExport.class);
util.exportExcel(response, exportList, "领料出库数据");
util.exportExcel(response, exportList, fileName, title);
}
/**
@ -208,8 +215,12 @@ public class LeaseApplyInfoController extends BaseController {
if (leaseApplyInfo.getStartTime() != null && leaseApplyInfo.getEndTime() != null) {
fileName = "领料记录" + leaseApplyInfo.getStartTime() + "" + leaseApplyInfo.getEndTime();
}
for (int i = 0; i < list.size(); i++) {
list.get(i).setSerialNumber(i + 1);
}
String title = "领料明细" + "" + "导出时间:" + DateUtils.getTime() + "";
ExcelUtil<LeaseApplyDetailExport> util = new ExcelUtil<>(LeaseApplyDetailExport.class);
util.exportExcel(response, list, fileName);
util.exportExcel(response, list, fileName, title);
// expOutExcel(response, list, fileName);
} catch (Exception e) {
logger.error("导出领料明细失败", e);

View File

@ -412,7 +412,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND bu.type_id = #{typeId}
</if>
<if test="companyId != null">
AND bu.dept_id = #{companyId}
AND bu.company_id = #{companyId}
</if>
</if>
<if test="projectId == null">
@ -427,7 +427,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND bu.type_id = #{typeId}
</if>
<if test="companyId != null">
AND bu.dept_id = #{companyId}
AND bu.company_id = #{companyId}
</if>
</if>
</select>
@ -441,12 +441,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_agreement_info bai ON bu.unit_id = bai.unit_id AND bai.`status` = '1'
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id AND bp.del_flag = '0'
WHERE bu.unit_id = #{unitId} AND bu.del_flag = '0'
<if test="companyId != null ">
AND bp.company_id = #{companyId}
</if>
</if>
<if test="unitId == null">
SELECT pro_id AS proId,
pro_name AS proName
FROM bm_project
WHERE del_flag = '0'
<if test="companyId != null ">
AND company_id = #{companyId}
</if>
</if>
</select>
@ -1469,6 +1475,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null">
AND sd.dept_id = #{deptId}
</if>
<if test="companyId != null ">
AND bmp.company_id = #{companyId}
</if>
UNION
SELECT DISTINCT
concat( 'gs', sd.dept_id ) AS id,
@ -1492,6 +1501,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null">
AND sd.dept_id = #{deptId}
</if>
<if test="companyId != null ">
AND bmp.company_id = #{companyId}
</if>
) a
ORDER BY
level
@ -1527,6 +1539,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="unitId != null">
AND bu.unit_id = #{unitId}
</if>
<if test="companyId != null ">
AND bu.company_id = #{companyId}
</if>
UNION
@ -1554,6 +1569,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="unitId != null">
AND bu.unit_id = #{unitId}
</if>
<if test="companyId != null ">
AND bu.company_id = #{companyId}
</if>
UNION
SELECT
@ -1580,6 +1598,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="unitId != null">
AND bu.unit_id = #{unitId}
</if>
<if test="companyId != null ">
AND bu.company_id = #{companyId}
</if>
) ff
ORDER BY
LEVEL