Merge branch 'lc20240808'

This commit is contained in:
liang.chao 2024-08-16 10:48:47 +08:00
commit 5271ebe0bd
7 changed files with 365 additions and 82 deletions

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.base.api.domain;
import com.alibaba.excel.annotation.ExcelProperty;
import com.bonus.sgzb.common.core.annotation.Excel;
import lombok.Data;
@ -21,15 +22,15 @@ public class SltAgreementInfo {
*/
private String ids;
/**
*协议id
* 协议id
*/
private String agreementId;
/**
*编码
* 编码
*/
private String maCode;
/**
*当前在用量
* 当前在用量
*/
private Integer useNum;
/**
@ -37,55 +38,59 @@ public class SltAgreementInfo {
*/
private String typeModelName;
/**
*机具规格id
* 机具规格id
*/
private String typeId;
/**
*机具id
* 机具id
*/
private String maId;
/**
*配件单价
* 配件单价
*/
private String partPrice;
/**
*领料数量
* 领料数量
*/
@Excel(name = "数量")
// @Excel(name = "数量",sort = 4)
@ExcelProperty(index = 4, value = "数量")
private String num;
/**
*领料时间
* 领料时间
*/
@Excel(name = "开始日期")
// @Excel(name = "开始日期",sort = 6)
@ExcelProperty(index = 6, value = "开始日期")
private String startTime;
/**
*退料时间
* 退料时间
*/
@Excel(name = "结算日期")
// @Excel(name = "结算日期",sort = 7)
@ExcelProperty(index = 7, value = "结算日期")
private String endTime;
/**
*0在用1退回
* 0在用1退回
*/
private String status;
/**
*领料id
* 领料id
*/
private String leaseId;
/**
*配件数量
* 配件数量
*/
private String partNum;
/**
*退料id
* 退料id
*/
private String backId;
/**
*租赁单价
* 租赁单价
*/
@Excel(name = "台班费单价(元/天)")
// @Excel(name = "台班费单价(元/天)",sort = 5)
@ExcelProperty(index = 5, value = "台班费单价(元/天)")
private String leasePrice;
/**
*原值
* 原值
*/
private String buyPrice;
/**
@ -95,37 +100,44 @@ public class SltAgreementInfo {
/**
* 项目名称
*/
@Excel(name = "领用单位")
// @Excel(name = "领用单位")
@ExcelProperty(value = "领用单位")
private String unitName;
/**
* 工程名称
*/
@Excel(name = "工程名称")
// @Excel(name = "工程名称")
@ExcelProperty(value = "工程名称")
private String projectName;
/**
* 设备名称
*/
@Excel(name = "设备名称")
// @Excel(name = "设备名称",sort = 1)
@ExcelProperty(index = 1, value = "设备名称")
private String typeName;
/**
* 规格型号
*/
@Excel(name = "规格型号")
// @Excel(name = "规格型号", sort = 2)
@ExcelProperty(index = 2, value = "规格型号")
private String modelName;
/**
* 计量单位
*/
@Excel(name = "单位")
// @Excel(name = "单位", sort = 3)
@ExcelProperty(index = 3, value = "单位")
private String nuitName;
/**
* 租赁天数
*/
@Excel(name = "结算天数")
// @Excel(name = "结算天数",sort = 8)
@ExcelProperty(index = 8, value = "结算天数")
private String leaseDays;
/**
* 租赁费用
*/
@Excel(name = "结算金额")
// @Excel(name = "结算金额",sort = 9)
@ExcelProperty(index = 9, value = "结算金额")
private String costs;
/**
* 配件总价
@ -138,7 +150,8 @@ public class SltAgreementInfo {
/**
* 真实租赁费用
*/
@Excel(name = "本月暂计金额")
// @Excel(name = "本月暂计金额",sort = 10)
@ExcelProperty(index = 10, value = "本月暂计金额")
private String realCosts;
/**
* 类型0不收费1收费
@ -161,7 +174,8 @@ public class SltAgreementInfo {
/**
* 费用承担方
*/
@Excel(name = "费用承担方(01项目,03分包)")
// @Excel(name = "费用承担方(01项目,03分包)")
@ExcelProperty(value = "费用承担方(01项目,03分包)")
private String costBearingParty;
/**
* 调整天数
@ -172,19 +186,21 @@ public class SltAgreementInfo {
*/
private BigDecimal realDays;
/**
* 是否结算0 未结算 1已结算
* 是否结算0 未结算 1已结算
*/
private String isSlt;
/**
* 月份
* 月份
*/
// @Excel(name = "月份")
@ExcelProperty(value = "月份")
private String month;
/**
* 月份
* 月份
*/
private String nextMonth;
/**
* 委外维修费用
* 委外维修费用
*/
private String outSourceCosts;
private String beginTime;

View File

@ -2,6 +2,9 @@ package com.bonus.sgzb.material.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.bonus.sgzb.base.api.domain.SltAgreementApply;
import com.bonus.sgzb.base.api.domain.SltAgreementDetails;
import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
@ -15,11 +18,14 @@ import com.bonus.sgzb.common.log.enums.BusinessType;
import com.bonus.sgzb.material.domain.*;
import com.bonus.sgzb.material.service.SltAgreementInfoService;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
@ -63,33 +69,58 @@ public class SltAgreementInfoController extends BaseController {
return AjaxResult.success(sltAgreementInfoService.getSltInfoMonth(list));
}
@ApiOperation(value = "月结明细导出")
/* @ApiOperation(value = "月结明细导出")
@PostMapping("/exportSltInfoMonth")
public void exportSltInfoMonth(HttpServletResponse response, @RequestBody List<AgreementInfo> list) {
List<SltAgreementInfo> sltInfoMonth = sltAgreementInfoService.getSltInfoMonth(list);
for (AgreementInfo agreementInfo : list) {
for (SltAgreementInfo sltAgreementInfo : sltInfoMonth) {
String[] split = agreementInfo.getCodeNum().split(",");
for (String s : split) {
if (s.equals(sltAgreementInfo.getCodeNum().toString())) {
List<SltAgreementInfo> node = sltAgreementInfo.getNode();
ExcelUtil<SltAgreementInfo> util = new ExcelUtil<SltAgreementInfo>(SltAgreementInfo.class);
util.exportExcel(response, node, "月结明细导出数据");
// 单个协议导出
if (StringUtils.isNotBlank(agreementInfo.getCodeNum())) {
String[] split = agreementInfo.getCodeNum().split(",");
for (String s : split) {
if (s.equals(sltAgreementInfo.getCodeNum().toString())) {
List<SltAgreementInfo> node = sltAgreementInfo.getNode();
ExcelUtil<SltAgreementInfo> util = new ExcelUtil<SltAgreementInfo>(SltAgreementInfo.class);
util.exportExcel(response, node, "月结明细导出数据");
}
}
} else {
// 多个协议导出
List<SltAgreementInfo> node = sltAgreementInfo.getNode();
ExcelUtil<SltAgreementInfo> util = new ExcelUtil<SltAgreementInfo>(SltAgreementInfo.class);
util.exportExcel(response, node, "月结明细导出数据");
}
}
}
}
}*/
@ApiOperation(value = "批量月结明细导出")
@PostMapping("/exportBatchSltInfoMonth")
public void exportBatchSltInfoMonth(HttpServletResponse response, @RequestBody List<AgreementInfo> list) {
@ApiOperation(value = "月结明细导出")
@PostMapping("/exportSltInfoMonth")
public void exportSltInfoMonth(HttpServletResponse response, @RequestBody List<AgreementInfo> list) throws IOException {
List<SltAgreementInfo> sltInfoMonth = sltAgreementInfoService.getSltInfoMonth(list);
for (SltAgreementInfo sltAgreementInfo : sltInfoMonth) {
List<SltAgreementInfo> node = sltAgreementInfo.getNode();
ExcelUtil<SltAgreementInfo> util = new ExcelUtil<SltAgreementInfo>(SltAgreementInfo.class);
util.exportExcel(response, node, "月结明细导出数据");
List<List<MonthRepairInfo>> allLists = new ArrayList<>();
for (AgreementInfo agreementInfo : list) {
for (SltAgreementInfo sltAgreementInfo : sltInfoMonth) {
// 单个协议导出
if (StringUtils.isNotBlank(agreementInfo.getCodeNum())) {
String[] split = agreementInfo.getCodeNum().split(",");
for (String s : split) {
if (s.equals(sltAgreementInfo.getCodeNum().toString())) {
List<SltAgreementInfo> node = sltAgreementInfo.getNode();
List<MonthRepairInfo> leaseInfoList = Convert.toList(MonthRepairInfo.class, node);
allLists.add(leaseInfoList);
}
}
} else {
// 多个协议导出
List<SltAgreementInfo> node = sltAgreementInfo.getNode();
List<MonthRepairInfo> leaseInfoList = Convert.toList(MonthRepairInfo.class, node);
allLists.add(leaseInfoList);
}
}
}
exportMultipleLists(allLists, response);
}
/**
@ -146,7 +177,7 @@ public class SltAgreementInfoController extends BaseController {
*/
@Log(title = "维修明细导出", businessType = BusinessType.EXPORT)
@PostMapping("/exportRepair")
public void exportRepair(HttpServletResponse response, List<AgreementInfo> list) {
public void exportRepair(HttpServletResponse response, @RequestBody List<AgreementInfo> list) {
List<SltAgreementInfo> explist = sltAgreementInfoService.getRepairList(list);
List<RepairInfo> leaseInfoList = Convert.toList(RepairInfo.class, explist);
ExcelUtil<RepairInfo> util = new ExcelUtil<RepairInfo>(RepairInfo.class);
@ -158,7 +189,7 @@ public class SltAgreementInfoController extends BaseController {
*/
@Log(title = "报废明细导出", businessType = BusinessType.EXPORT)
@PostMapping("/exportScrap")
public void exportScrap(HttpServletResponse response, List<AgreementInfo> list) {
public void exportScrap(HttpServletResponse response, @RequestBody List<AgreementInfo> list) {
List<SltAgreementInfo> explist = sltAgreementInfoService.getScrapList(list);
List<ScrapInfo> leaseInfoList = Convert.toList(ScrapInfo.class, explist);
ExcelUtil<ScrapInfo> util = new ExcelUtil<ScrapInfo>(ScrapInfo.class);
@ -170,7 +201,7 @@ public class SltAgreementInfoController extends BaseController {
*/
@Log(title = "预报废明细导出", businessType = BusinessType.EXPORT)
@PostMapping("/exportPreScrap")
public void exportPreScrap(HttpServletResponse response, List<AgreementInfo> list) {
public void exportPreScrap(HttpServletResponse response, @RequestBody List<AgreementInfo> list) {
List<SltAgreementInfo> explist = sltAgreementInfoService.getPreScrapList(list);
List<preScrapInfo> leaseInfoList = Convert.toList(preScrapInfo.class, explist);
ExcelUtil<preScrapInfo> util = new ExcelUtil<preScrapInfo>(preScrapInfo.class);
@ -243,5 +274,20 @@ public class SltAgreementInfoController extends BaseController {
return toAjax(sltAgreementInfoService.settlementReview(apply));
}
public void exportMultipleLists(List<List<MonthRepairInfo>> lists, HttpServletResponse response) throws IOException {
String fileName = "月结明细导出数据.xlsx";
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(fileName, "UTF-8"));
// 使用 EasyExcel 创建一个写入器
ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), MonthRepairInfo.class).build();
for (int i = 0; i < lists.size(); i++) {
WriteSheet writeSheet = EasyExcel.writerSheet("Sheet" + (i + 1)).build();
excelWriter.write(lists.get(i), writeSheet);
}
// 关闭写入器
excelWriter.finish();
}
}

View File

@ -0,0 +1,215 @@
package com.bonus.sgzb.material.domain;
import com.alibaba.excel.annotation.ExcelProperty;
import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* @Authorliang.chao
* @Date2024/8/15 - 19:44
*/
public class MonthRepairInfo {
/**
* 领料数量
*/
// @Excel(name = "数量",sort = 4)
@ExcelProperty(index = 4, value = "数量")
private String num;
public String getNum() {
return num;
}
public void setNum(String num) {
this.num = num;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public String getLeasePrice() {
return leasePrice;
}
public void setLeasePrice(String leasePrice) {
this.leasePrice = leasePrice;
}
public String getUnitName() {
return unitName;
}
public void setUnitName(String unitName) {
this.unitName = unitName;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public String getModelName() {
return modelName;
}
public void setModelName(String modelName) {
this.modelName = modelName;
}
public String getNuitName() {
return nuitName;
}
public void setNuitName(String nuitName) {
this.nuitName = nuitName;
}
public String getLeaseDays() {
return leaseDays;
}
public void setLeaseDays(String leaseDays) {
this.leaseDays = leaseDays;
}
public String getCosts() {
return costs;
}
public void setCosts(String costs) {
this.costs = costs;
}
public String getRealCosts() {
return realCosts;
}
public void setRealCosts(String realCosts) {
this.realCosts = realCosts;
}
public String getCostBearingParty() {
return costBearingParty;
}
public void setCostBearingParty(String costBearingParty) {
this.costBearingParty = costBearingParty;
}
public String getMonth() {
return month;
}
public void setMonth(String month) {
this.month = month;
}
/**
* 领料时间
*/
// @Excel(name = "开始日期",sort = 6)
@ExcelProperty(index = 6, value = "开始日期")
private String startTime;
/**
* 退料时间
*/
// @Excel(name = "结算日期",sort = 7)
@ExcelProperty(index = 7, value = "结算日期")
private String endTime;
/**
* 租赁单价
*/
// @Excel(name = "台班费单价(元/天)",sort = 5)
@ExcelProperty(index = 5, value = "台班费单价(元/天)")
private String leasePrice;
/**
* 项目名称
*/
// @Excel(name = "领用单位")
@ExcelProperty(index = 11,value = "领用单位")
private String unitName;
/**
* 工程名称
*/
// @Excel(name = "工程名称")
@ExcelProperty(index = 12,value = "工程名称")
private String projectName;
/**
* 设备名称
*/
// @Excel(name = "设备名称",sort = 1)
@ExcelProperty(index = 1, value = "设备名称")
private String typeName;
/**
* 规格型号
*/
// @Excel(name = "规格型号", sort = 2)
@ExcelProperty(index = 2, value = "规格型号")
private String modelName;
/**
* 计量单位
*/
// @Excel(name = "单位", sort = 3)
@ExcelProperty(index = 3, value = "单位")
private String nuitName;
/**
* 租赁天数
*/
// @Excel(name = "结算天数",sort = 8)
@ExcelProperty(index = 8, value = "结算天数")
private String leaseDays;
/**
* 租赁费用
*/
// @Excel(name = "结算金额",sort = 9)
@ExcelProperty(index = 9, value = "结算金额")
private String costs;
/**
* 真实租赁费用
*/
// @Excel(name = "本月暂计金额",sort = 10)
@ExcelProperty(index = 10, value = "本月暂计金额")
private String realCosts;
/**
* 费用承担方
*/
// @Excel(name = "费用承担方(01项目,03分包)")
@ExcelProperty(value = "费用承担方(01项目,03分包)")
private String costBearingParty;
/**
* 月份
*/
// @Excel(name = "月份")
@ExcelProperty(value = "月份")
private String month;
}

View File

@ -49,37 +49,35 @@ public class RepairInfo {
/**
* 配件名称
*/
@Excel(name = "配件名称")
@Excel(name = "配件名称",sort = 4)
private String partName;
/**
*配件型号
*/
@Excel(name = "配件型号")
@Excel(name = "配件型号",sort = 5)
private String partModelName;
/**
* 项目名称
*/
@Excel(name = "结算单位名称")
private String unitName;
/**
* 工程名称
*/
@Excel(name = "结算工程名称")
private String projectName;
/**
* 设备名称
*/
@Excel(name = "设备名称")
@Excel(name = "设备名称",sort = 1)
private String typeName;
/**
* 规格型号
*/
@Excel(name = "规格型号")
@Excel(name = "规格型号",sort = 2)
private String modelName;
/**
* 计量单位
*/
@Excel(name = "计量单位")
@Excel(name = "计量单位",sort = 3)
private String nuitName;
/**
*租赁单价
@ -88,8 +86,12 @@ public class RepairInfo {
/**
*领料数量
*/
@Excel(name = "数量")
private String num;
/**
*领料数量
*/
@Excel(name = "配件数量",sort = 6)
private String partNum;
/**
*领料时间
*/
@ -109,27 +111,29 @@ public class RepairInfo {
/**
* 应结算金额
*/
@Excel(name = "配件单价")
private String costs;
@Excel(name = "配件单价",sort = 7)
private String partPrice;
/**
* 实际结算金额
*/
@Excel(name = "实际结算金额(元)")
// @Excel(name = "实际结算金额(元)")
private String realCosts;
/**
* 配件总价
*/
@Excel(name = "配件总价(元)")
@Excel(name = "配件总价(元)",sort = 8)
private String partAllCosts;
/**
* 费用总价
*/
@Excel(name = "费用总价")
// @Excel(name = "费用总价")
private String allCosts;
/**
* 委外维修费用
*/
@Excel(name = "委外维修费用")
// @Excel(name = "委外维修费用")
private String outSourceCosts;
/**
* 实际结算金额

View File

@ -28,7 +28,7 @@ public class ScrapInfo {
/**
*设备编码
*/
@Excel(name = "设备编码")
@Excel(name = "设备编码",sort = 4)
private String maCode;
/**
@ -46,7 +46,7 @@ public class ScrapInfo {
/**
*原值
*/
@Excel(name = "赔偿单价")
@Excel(name = "赔偿单价",sort = 6)
private String buyPrice;
/**
*
@ -55,27 +55,25 @@ public class ScrapInfo {
/**
* 项目名称
*/
@Excel(name = "结算单位名称")
private String unitName;
/**
* 工程名称
*/
@Excel(name = "结算工程名称")
private String projectName;
/**
* 设备名称
*/
@Excel(name = "设备名称")
@Excel(name = "设备名称",sort = 1)
private String typeName;
/**
* 规格型号
*/
@Excel(name = "规格型号")
@Excel(name = "规格型号",sort = 2)
private String modelName;
/**
* 计量单位
*/
@Excel(name = "计量单位")
@Excel(name = "计量单位",sort = 3)
private String nuitName;
/**
*租赁单价
@ -84,7 +82,7 @@ public class ScrapInfo {
/**
*领料数量
*/
@Excel(name = "报废数量")
@Excel(name = "报废数量",sort = 5)
private String num;
/**
*领料时间
@ -105,7 +103,7 @@ public class ScrapInfo {
/**
* 租赁费用
*/
@Excel(name = "报废费用")
@Excel(name = "赔偿金额",sort = 7)
private String costs;
/**
* 类型0不收费1收费

View File

@ -28,12 +28,13 @@ public class preScrapInfo {
/**
*设备编码
*/
@Excel(name = "设备编码")
@Excel(name = "设备编码",sort = 4)
private String maCode;
/**
*0在用1退回
*/
@Excel(name = "状态",defaultValue = "待报废",sort = 100)
private String status;
/**
*领料id
@ -62,26 +63,28 @@ public class preScrapInfo {
/**
* 设备名称
*/
@Excel(name = "设备名称")
@Excel(name = "设备名称",sort = 1)
private String typeName;
/**
* 规格型号
*/
@Excel(name = "规格型号")
@Excel(name = "规格型号",sort = 2)
private String modelName;
/**
* 计量单位
*/
@Excel(name = "计量单位")
@Excel(name = "计量单位",sort = 3)
private String nuitName;
/**
*租赁单价
*/
private String leasePrice;
/**
*领料数量
*/
@Excel(name = "报废数量")
@Excel(name = "报废数量",sort = 5)
private String num;
/**
*领料时间

View File

@ -1,5 +1,7 @@
package com.bonus.sgzb.material.service.impl;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.bonus.sgzb.base.api.domain.SltAgreementApply;
import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
import com.bonus.sgzb.base.api.domain.SltAgreementRelation;
@ -11,8 +13,6 @@ import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.security.utils.SecurityUtils;
import com.bonus.sgzb.material.domain.AgreementInfo;
import com.bonus.sgzb.material.domain.ProjectMonthCosts;
import com.bonus.sgzb.material.domain.ProjectMonthDetail;
import com.bonus.sgzb.material.domain.TmTask;
import com.bonus.sgzb.material.mapper.CalMonthlyMapper;
@ -20,11 +20,12 @@ import com.bonus.sgzb.material.mapper.SltAgreementInfoMapper;
import com.bonus.sgzb.material.service.SltAgreementInfoService;
import com.bonus.sgzb.material.vo.GlobalContants;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@ -481,7 +482,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
agreementInfo.setCostBearingParty(sltAgreementInfo.getCostBearingParty());
agreementInfo.setStartTime(sltAgreementInfo.getBeginTime());
agreementInfo.setIds(sltAgreementInfo.getIds());
sltAgreementInfo.setMonth(bean.getMonth());
sltAgreementInfo.setMonth(DateTimeHelper.getNowMonth(DateTimeHelper.parse(bean.getEndTime(), "yyyy-MM")));
sltAgreementInfo.setCodeNum(num++);
agreementInfo.setEndTime(sltAgreementInfo.getOffTime());
List<SltAgreementInfo> leaseListOneMonth = getLeaseListOneMonth(agreementInfo, sltAgreementInfo);