bug修改销货清单excel导入
This commit is contained in:
@ -6,6 +6,7 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 投标文件-商务标对象 xzd_tbwj_business_bid
|
* 投标文件-商务标对象 xzd_tbwj_business_bid
|
||||||
@ -29,7 +30,7 @@ public class XzdTbwjBusinessBid {
|
|||||||
/**
|
/**
|
||||||
* 标底价
|
* 标底价
|
||||||
*/
|
*/
|
||||||
private Long bidPrice;
|
private BigDecimal bidPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 投标文件ID
|
* 投标文件ID
|
||||||
@ -39,37 +40,37 @@ public class XzdTbwjBusinessBid {
|
|||||||
/**
|
/**
|
||||||
* 折扣率
|
* 折扣率
|
||||||
*/
|
*/
|
||||||
private Long discountRate;
|
private BigDecimal discountRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最高限价
|
* 最高限价
|
||||||
*/
|
*/
|
||||||
private Long ceilingPrice;
|
private BigDecimal ceilingPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 成本价
|
* 成本价
|
||||||
*/
|
*/
|
||||||
private Long costPrice;
|
private BigDecimal costPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 投标报价
|
* 投标报价
|
||||||
*/
|
*/
|
||||||
private Long totalBidPrice;
|
private BigDecimal totalBidPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 毛利率
|
* 毛利率
|
||||||
*/
|
*/
|
||||||
private Long feeRate;
|
private BigDecimal feeRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 投标税率
|
* 投标税率
|
||||||
*/
|
*/
|
||||||
private Long bidTaxRate;
|
private BigDecimal bidTaxRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备用金
|
* 备用金
|
||||||
*/
|
*/
|
||||||
private Long pettyCash;
|
private BigDecimal pettyCash;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编制部门
|
* 编制部门
|
||||||
|
|||||||
@ -30,7 +30,7 @@ public class XzdTbwjBusinessBidBo extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 标底价
|
* 标底价
|
||||||
*/
|
*/
|
||||||
private Long bidPrice;
|
private BigDecimal bidPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 折扣率
|
* 折扣率
|
||||||
@ -40,18 +40,18 @@ public class XzdTbwjBusinessBidBo extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 最高限价
|
* 最高限价
|
||||||
*/
|
*/
|
||||||
private Long ceilingPrice;
|
private BigDecimal ceilingPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 成本价
|
* 成本价
|
||||||
*/
|
*/
|
||||||
private Long costPrice;
|
private BigDecimal costPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 投标报价
|
* 投标报价
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "投标报价不能为空", groups = { AddGroup.class, EditGroup.class })
|
@NotNull(message = "投标报价不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
private Long totalBidPrice;
|
private BigDecimal totalBidPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 毛利率
|
* 毛利率
|
||||||
@ -71,7 +71,7 @@ public class XzdTbwjBusinessBidBo extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 备用金
|
* 备用金
|
||||||
*/
|
*/
|
||||||
private Long pettyCash;
|
private BigDecimal pettyCash;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编制部门
|
* 编制部门
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import org.dromara.xzd.biddingManagement.biddingDocumentList.domain.XzdTbwjBusin
|
|||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
@ -43,49 +44,49 @@ public class XzdTbwjBusinessBidVo implements Serializable {
|
|||||||
* 标底价
|
* 标底价
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "标底价")
|
@ExcelProperty(value = "标底价")
|
||||||
private Long bidPrice;
|
private BigDecimal bidPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 折扣率
|
* 折扣率
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "折扣率")
|
@ExcelProperty(value = "折扣率")
|
||||||
private Long discountRate;
|
private BigDecimal discountRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最高限价
|
* 最高限价
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "最高限价")
|
@ExcelProperty(value = "最高限价")
|
||||||
private Long ceilingPrice;
|
private BigDecimal ceilingPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 成本价
|
* 成本价
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "成本价")
|
@ExcelProperty(value = "成本价")
|
||||||
private Long costPrice;
|
private BigDecimal costPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 投标报价
|
* 投标报价
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "投标报价")
|
@ExcelProperty(value = "投标报价")
|
||||||
private Long totalBidPrice;
|
private BigDecimal totalBidPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 毛利率
|
* 毛利率
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "毛利率")
|
@ExcelProperty(value = "毛利率")
|
||||||
private Long feeRate;
|
private BigDecimal feeRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 投标税率
|
* 投标税率
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "投标税率")
|
@ExcelProperty(value = "投标税率")
|
||||||
private Long bidTaxRate;
|
private BigDecimal bidTaxRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备用金
|
* 备用金
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "备用金")
|
@ExcelProperty(value = "备用金")
|
||||||
private Long pettyCash;
|
private BigDecimal pettyCash;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编制部门
|
* 编制部门
|
||||||
|
|||||||
@ -201,9 +201,9 @@ public class XzdBiddingDocumentServiceImpl extends ServiceImpl<XzdBiddingDocumen
|
|||||||
xzdTbwjTechnicalBidService.save(xzdTbwjTechnicalBid);
|
xzdTbwjTechnicalBidService.save(xzdTbwjTechnicalBid);
|
||||||
|
|
||||||
// 投标文件-商务标
|
// 投标文件-商务标
|
||||||
XzdTbwjBusinessBidBo xzdTbwjBusinessBidVo = bo.getXzdTbwjBusinessBidVo();
|
XzdTbwjBusinessBidBo xzdTbwjBusinessBidBo = bo.getXzdTbwjBusinessBidVo();
|
||||||
XzdTbwjBusinessBid xzdTbwjBusinessBid = new XzdTbwjBusinessBid();
|
XzdTbwjBusinessBid xzdTbwjBusinessBid = new XzdTbwjBusinessBid();
|
||||||
BeanUtils.copyProperties(xzdTbwjBusinessBidVo, xzdTbwjBusinessBid);
|
BeanUtils.copyProperties(xzdTbwjBusinessBidBo, xzdTbwjBusinessBid);
|
||||||
xzdTbwjBusinessBid.setBiddingDocumentId(xzdBiddingDocument.getId());
|
xzdTbwjBusinessBid.setBiddingDocumentId(xzdBiddingDocument.getId());
|
||||||
xzdTbwjBusinessBidService.save(xzdTbwjBusinessBid);
|
xzdTbwjBusinessBidService.save(xzdTbwjBusinessBid);
|
||||||
|
|
||||||
|
|||||||
@ -195,7 +195,7 @@ public class XzdSubcontractVo implements Serializable {
|
|||||||
* 执行项目经理名称
|
* 执行项目经理名称
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "执行项目经理名称")
|
@ExcelProperty(value = "执行项目经理名称")
|
||||||
@Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "executiveProjectManager")
|
@Translation(type = TransConstant.XZD_PROJECT_MANAGER_APPROVAL_ID_TO_NAME, mapper = "executiveProjectManager")
|
||||||
private String executiveProjectManagerName;
|
private String executiveProjectManagerName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -48,6 +48,11 @@ public class XzdFbhtzbjth extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包合同保证金
|
||||||
|
*/
|
||||||
|
private BigDecimal fenbaoEarnestMoney;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单据日期
|
* 单据日期
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -104,6 +104,10 @@ public class XzdFbhtzbjthBo extends BaseEntity {
|
|||||||
* 质保金比例(%)
|
* 质保金比例(%)
|
||||||
*/
|
*/
|
||||||
private BigDecimal qualityDepositRatio;
|
private BigDecimal qualityDepositRatio;
|
||||||
|
/**
|
||||||
|
* 分包合同保证金
|
||||||
|
*/
|
||||||
|
private BigDecimal fenbaoEarnestMoney;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 申请单位
|
* 申请单位
|
||||||
|
|||||||
@ -62,6 +62,11 @@ public class XzdFbhtzbjthVo implements Serializable {
|
|||||||
@ExcelProperty(value = "标题")
|
@ExcelProperty(value = "标题")
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分包合同保证金
|
||||||
|
*/
|
||||||
|
private BigDecimal fenbaoEarnestMoney;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单据日期
|
* 单据日期
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.constraints.*;
|
import jakarta.validation.constraints.*;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.dromara.xzd.fapiaotaizhang.zengzhishui.domain.vo.XzdXhqdVo;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
@ -21,6 +22,7 @@ import org.dromara.xzd.fapiaotaizhang.zengzhishui.domain.vo.AppreciationInvoiceV
|
|||||||
import org.dromara.xzd.fapiaotaizhang.zengzhishui.domain.bo.AppreciationInvoiceBo;
|
import org.dromara.xzd.fapiaotaizhang.zengzhishui.domain.bo.AppreciationInvoiceBo;
|
||||||
import org.dromara.xzd.fapiaotaizhang.zengzhishui.service.IAppreciationInvoiceService;
|
import org.dromara.xzd.fapiaotaizhang.zengzhishui.service.IAppreciationInvoiceService;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 增值税发票
|
* 增值税发票
|
||||||
@ -102,4 +104,15 @@ public class AppreciationInvoiceController extends BaseController {
|
|||||||
@PathVariable Long[] ids) {
|
@PathVariable Long[] ids) {
|
||||||
return toAjax(appreciationInvoiceService.deleteWithValidByIds(List.of(ids), true));
|
return toAjax(appreciationInvoiceService.deleteWithValidByIds(List.of(ids), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* excel导入
|
||||||
|
*/
|
||||||
|
@Log(title = "excel导入")
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping("/excel")
|
||||||
|
public R<List<XzdXhqdVo>> addExcel(@RequestParam("file") MultipartFile files) {
|
||||||
|
return R.ok(appreciationInvoiceService.addExcel(files));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,16 +73,23 @@ public class XzdXhqd extends BaseEntity {
|
|||||||
* 税率
|
* 税率
|
||||||
*/
|
*/
|
||||||
private BigDecimal taxRate;
|
private BigDecimal taxRate;
|
||||||
|
/**
|
||||||
|
* 折扣金额
|
||||||
|
*/
|
||||||
|
private BigDecimal discountAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 税额
|
* 优惠政策类型
|
||||||
*/
|
*/
|
||||||
private BigDecimal taxAmount;
|
private String preferentialPolicy;
|
||||||
|
|
||||||
|
|
||||||
|
// 煤炭种类
|
||||||
|
private String typesCoal;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件ID
|
* 文件ID
|
||||||
|
|||||||
@ -73,15 +73,18 @@ public class XzdXhqdBo extends BaseEntity {
|
|||||||
private BigDecimal taxRate;
|
private BigDecimal taxRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 税额
|
* 折扣金额
|
||||||
*/
|
*/
|
||||||
private BigDecimal taxAmount;
|
private BigDecimal discountAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 优惠政策类型
|
||||||
*/
|
*/
|
||||||
private String remark;
|
private String preferentialPolicy;
|
||||||
|
|
||||||
|
|
||||||
|
// 煤炭种类
|
||||||
|
private String typesCoal;
|
||||||
/**
|
/**
|
||||||
* 文件ID
|
* 文件ID
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -89,17 +89,18 @@ public class XzdXhqdVo implements Serializable {
|
|||||||
private BigDecimal taxRate;
|
private BigDecimal taxRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 税额
|
* 折扣金额
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "税额")
|
private BigDecimal discountAmount;
|
||||||
private BigDecimal taxAmount;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 优惠政策类型
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "备注")
|
private String preferentialPolicy;
|
||||||
private String remark;
|
|
||||||
|
|
||||||
|
|
||||||
|
// 煤炭种类
|
||||||
|
private String typesCoal;
|
||||||
/**
|
/**
|
||||||
* 文件ID
|
* 文件ID
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -7,6 +7,9 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.dromara.xzd.fapiaotaizhang.zengzhishui.domain.vo.XzdXhqdVo;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -67,4 +70,7 @@ public interface IAppreciationInvoiceService extends IService<AppreciationInvoic
|
|||||||
* @return 是否删除成功
|
* @return 是否删除成功
|
||||||
*/
|
*/
|
||||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
|
||||||
|
|
||||||
|
List<XzdXhqdVo> addExcel(MultipartFile files);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,12 +24,14 @@ import org.dromara.xzd.fapiaotaizhang.zengzhishui.domain.TaxInfo;
|
|||||||
import org.dromara.xzd.fapiaotaizhang.zengzhishui.domain.XzdXhqd;
|
import org.dromara.xzd.fapiaotaizhang.zengzhishui.domain.XzdXhqd;
|
||||||
import org.dromara.xzd.fapiaotaizhang.zengzhishui.domain.bo.XzdXhqdBo;
|
import org.dromara.xzd.fapiaotaizhang.zengzhishui.domain.bo.XzdXhqdBo;
|
||||||
import org.dromara.xzd.fapiaotaizhang.zengzhishui.domain.vo.TaxInfoVo;
|
import org.dromara.xzd.fapiaotaizhang.zengzhishui.domain.vo.TaxInfoVo;
|
||||||
|
import org.dromara.xzd.fapiaotaizhang.zengzhishui.domain.vo.XzdXhqdVo;
|
||||||
import org.dromara.xzd.fapiaotaizhang.zengzhishui.service.ITaxInfoService;
|
import org.dromara.xzd.fapiaotaizhang.zengzhishui.service.ITaxInfoService;
|
||||||
import org.dromara.xzd.fapiaotaizhang.zengzhishui.service.IXzdXhqdService;
|
import org.dromara.xzd.fapiaotaizhang.zengzhishui.service.IXzdXhqdService;
|
||||||
import org.dromara.xzd.service.IXzdContractDetailsService;
|
import org.dromara.xzd.service.IXzdContractDetailsService;
|
||||||
import org.dromara.xzd.service.IXzdCorrespondentList;
|
import org.dromara.xzd.service.IXzdCorrespondentList;
|
||||||
import org.dromara.xzd.service.IXzdProjectService;
|
import org.dromara.xzd.service.IXzdProjectService;
|
||||||
import org.dromara.xzd.service.impl.XzdProjectServiceImpl;
|
import org.dromara.xzd.service.impl.XzdProjectServiceImpl;
|
||||||
|
import org.dromara.xzd.utilS.ExcelXhqdProcessor;
|
||||||
import org.dromara.xzd.zijinjihua.yueduzijinbiangeng.domain.FinancialRevenuePlanAlteration;
|
import org.dromara.xzd.zijinjihua.yueduzijinbiangeng.domain.FinancialRevenuePlanAlteration;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
@ -39,7 +41,10 @@ import org.dromara.xzd.fapiaotaizhang.zengzhishui.domain.vo.AppreciationInvoiceV
|
|||||||
import org.dromara.xzd.fapiaotaizhang.zengzhishui.domain.AppreciationInvoice;
|
import org.dromara.xzd.fapiaotaizhang.zengzhishui.domain.AppreciationInvoice;
|
||||||
import org.dromara.xzd.fapiaotaizhang.zengzhishui.mapper.AppreciationInvoiceMapper;
|
import org.dromara.xzd.fapiaotaizhang.zengzhishui.mapper.AppreciationInvoiceMapper;
|
||||||
import org.dromara.xzd.fapiaotaizhang.zengzhishui.service.IAppreciationInvoiceService;
|
import org.dromara.xzd.fapiaotaizhang.zengzhishui.service.IAppreciationInvoiceService;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
@ -264,6 +269,22 @@ public class AppreciationInvoiceServiceImpl extends ServiceImpl<AppreciationInvo
|
|||||||
return baseMapper.deleteByIds(ids) > 0;
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<XzdXhqdVo> addExcel(MultipartFile file) {
|
||||||
|
|
||||||
|
|
||||||
|
List<XzdXhqdVo> res = new ArrayList<>();
|
||||||
|
String name = file.getOriginalFilename();
|
||||||
|
try {
|
||||||
|
InputStream inputStream = file.getInputStream();
|
||||||
|
res = ExcelXhqdProcessor.parseExcel(inputStream, name);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成,单任务完成等)
|
* 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成,单任务完成等)
|
||||||
* 正常使用只需#processEvent.flowCode=='leave1'
|
* 正常使用只需#processEvent.flowCode=='leave1'
|
||||||
|
|||||||
@ -81,7 +81,7 @@ public class XzdXhqdServiceImpl extends ServiceImpl<XzdXhqdMapper, XzdXhqd> impl
|
|||||||
lqw.eq(bo.getUnitPrice() != null, XzdXhqd::getUnitPrice, bo.getUnitPrice());
|
lqw.eq(bo.getUnitPrice() != null, XzdXhqd::getUnitPrice, bo.getUnitPrice());
|
||||||
lqw.eq(bo.getAmount() != null, XzdXhqd::getAmount, bo.getAmount());
|
lqw.eq(bo.getAmount() != null, XzdXhqd::getAmount, bo.getAmount());
|
||||||
lqw.eq(bo.getTaxRate() != null, XzdXhqd::getTaxRate, bo.getTaxRate());
|
lqw.eq(bo.getTaxRate() != null, XzdXhqd::getTaxRate, bo.getTaxRate());
|
||||||
lqw.eq(bo.getTaxAmount() != null, XzdXhqd::getTaxAmount, bo.getTaxAmount());
|
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getFileId()), XzdXhqd::getFileId, bo.getFileId());
|
lqw.eq(StringUtils.isNotBlank(bo.getFileId()), XzdXhqd::getFileId, bo.getFileId());
|
||||||
return lqw;
|
return lqw;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,107 @@
|
|||||||
|
package org.dromara.xzd.utilS;
|
||||||
|
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||||
|
import org.apache.poi.ss.usermodel.*;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
import org.dromara.xzd.fapiaotaizhang.zengzhishui.domain.vo.XzdXhqdVo;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ExcelXhqdProcessor {
|
||||||
|
|
||||||
|
|
||||||
|
public static List<XzdXhqdVo> parseExcel(InputStream inputStream, String fileName) throws Exception {
|
||||||
|
List<XzdXhqdVo> xzdXhqdVos = new ArrayList<>();
|
||||||
|
|
||||||
|
Workbook workbook;
|
||||||
|
if (fileName.endsWith(".xlsx")) {
|
||||||
|
workbook = new XSSFWorkbook(inputStream);
|
||||||
|
} else if (fileName.endsWith(".xls")) {
|
||||||
|
workbook = new HSSFWorkbook(inputStream);
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("不支持的Excel格式");
|
||||||
|
}
|
||||||
|
|
||||||
|
Sheet sheet = workbook.getSheetAt(0);
|
||||||
|
Boolean flow =false;
|
||||||
|
|
||||||
|
// 从第二行开始读取(跳过标题行)
|
||||||
|
for (int i = 0; i <= sheet.getLastRowNum(); i++) {
|
||||||
|
Row row = sheet.getRow(i);
|
||||||
|
if (!flow){
|
||||||
|
if(!"项目名称".equals(getCellValue(row.getCell(0)))){
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}else {
|
||||||
|
i++;
|
||||||
|
flow=true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (row == null) continue;
|
||||||
|
|
||||||
|
XzdXhqdVo xhqdVo = new XzdXhqdVo();
|
||||||
|
|
||||||
|
// 读取单元格数据
|
||||||
|
xhqdVo.setName(getCellValue(row.getCell(0)));
|
||||||
|
xhqdVo.setMaterialCode(getCellValue(row.getCell(1)));
|
||||||
|
xhqdVo.setSpec(getCellValue(row.getCell(2)));
|
||||||
|
xhqdVo.setUnit(getCellValue(row.getCell(3)));
|
||||||
|
xhqdVo.setQuantity(convertBasic(getCellValue(row.getCell(4))));
|
||||||
|
xhqdVo.setUnitPrice(convertBasic(getCellValue(row.getCell(5))));
|
||||||
|
xhqdVo.setAmount(convertBasic(getCellValue(row.getCell(6))));
|
||||||
|
xhqdVo.setTaxRate(convertBasic(getCellValue(row.getCell(7))));
|
||||||
|
xhqdVo.setDiscountAmount(convertBasic(getCellValue(row.getCell(8))));
|
||||||
|
xhqdVo.setPreferentialPolicy(getCellValue(row.getCell(9)));
|
||||||
|
xhqdVo.setTypesCoal(getCellValue(row.getCell(10)));
|
||||||
|
|
||||||
|
xzdXhqdVos.add(xhqdVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
workbook.close();
|
||||||
|
return xzdXhqdVos;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getCellValue(Cell cell) {
|
||||||
|
if (cell == null) return "";
|
||||||
|
|
||||||
|
switch (cell.getCellType()) {
|
||||||
|
case STRING:
|
||||||
|
return cell.getStringCellValue().trim();
|
||||||
|
case NUMERIC:
|
||||||
|
if (DateUtil.isCellDateFormatted(cell)) {
|
||||||
|
return cell.getDateCellValue().toString();
|
||||||
|
} else {
|
||||||
|
return String.valueOf((int) cell.getNumericCellValue());
|
||||||
|
}
|
||||||
|
case BOOLEAN:
|
||||||
|
return String.valueOf(cell.getBooleanCellValue());
|
||||||
|
case FORMULA:
|
||||||
|
return cell.getCellFormula();
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Integer parseInt(String value) {
|
||||||
|
try {
|
||||||
|
return Integer.parseInt(value);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static BigDecimal convertBasic(String numberStr) {
|
||||||
|
if (numberStr == null || numberStr.trim().isEmpty()) {
|
||||||
|
return null; // 或者抛出异常
|
||||||
|
}
|
||||||
|
return new BigDecimal(numberStr.trim());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user