diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyDetailExport.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyDetailExport.java index 7a99097e..ceb4ad1d 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyDetailExport.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyDetailExport.java @@ -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 = "开始时间") diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfoExport.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfoExport.java index 26aec690..7ad1189b 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfoExport.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfoExport.java @@ -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; diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/controller/SelectController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/controller/SelectController.java index b5fd64c6..44ccf2c5 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/controller/SelectController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/controller/SelectController.java @@ -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("获取数据失败"); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java index 87fa96f5..a8553ae5 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java @@ -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 list = leaseApplyInfoService.selectLeaseApplyInfoList(leaseApplyInfo); List 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 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 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); diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml index ed8b8783..5f36cfd2 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml @@ -412,7 +412,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND bu.type_id = #{typeId} - AND bu.dept_id = #{companyId} + AND bu.company_id = #{companyId} @@ -427,7 +427,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND bu.type_id = #{typeId} - AND bu.dept_id = #{companyId} + AND bu.company_id = #{companyId} @@ -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' + + AND bp.company_id = #{companyId} + SELECT pro_id AS proId, pro_name AS proName FROM bm_project WHERE del_flag = '0' + + AND company_id = #{companyId} + @@ -1469,6 +1475,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND sd.dept_id = #{deptId} + + AND bmp.company_id = #{companyId} + UNION SELECT DISTINCT concat( 'gs', sd.dept_id ) AS id, @@ -1492,6 +1501,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND sd.dept_id = #{deptId} + + AND bmp.company_id = #{companyId} + ) a ORDER BY level @@ -1527,6 +1539,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND bu.unit_id = #{unitId} + + AND bu.company_id = #{companyId} + UNION @@ -1554,6 +1569,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND bu.unit_id = #{unitId} + + AND bu.company_id = #{companyId} + UNION SELECT @@ -1580,6 +1598,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND bu.unit_id = #{unitId} + + AND bu.company_id = #{companyId} + ) ff ORDER BY LEVEL