From 05ae94ea868f4bc85984b0e6d38512c163dc3c33 Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期一, 26 一月 2026 17:25:09 +0800
Subject: [PATCH] yys 采购台账模板导入,模板下载接口
---
src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java | 1
src/main/resources/static/采购台账导入模板.xlsx | 0
src/main/java/com/ruoyi/purchase/service/IPurchaseLedgerService.java | 3
src/main/java/com/ruoyi/sales/dto/SalesLedgerImportDto.java | 3
src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerProductImportDto.java | 83 +++++++++++++
src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java | 145 ++++++++++++++++++++++-
src/main/java/com/ruoyi/basic/pojo/SupplierManage.java | 2
src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerController.java | 59 +++++++++
src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerImportDto.java | 53 ++++++++
9 files changed, 334 insertions(+), 15 deletions(-)
diff --git a/src/main/java/com/ruoyi/basic/pojo/SupplierManage.java b/src/main/java/com/ruoyi/basic/pojo/SupplierManage.java
index a18a47b..aa33cbf 100644
--- a/src/main/java/com/ruoyi/basic/pojo/SupplierManage.java
+++ b/src/main/java/com/ruoyi/basic/pojo/SupplierManage.java
@@ -14,7 +14,7 @@
public class SupplierManage {
@TableId(value = "id", type = IdType.AUTO)
- private Integer id;
+ private Long id;
@ApiModelProperty(value = "渚涘簲鍟嗗悕绉�")
@Excel(name = "渚涘簲鍟嗗悕绉�")
diff --git a/src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerController.java b/src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerController.java
index 4dc2f7a..a3c0adf 100644
--- a/src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerController.java
+++ b/src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerController.java
@@ -22,12 +22,19 @@
import com.ruoyi.sales.service.ISalesLedgerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
+import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.math.BigDecimal;
+import java.net.URLEncoder;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@@ -42,6 +49,7 @@
@RequestMapping("/purchase/ledger")
@AllArgsConstructor
@Api(tags = "閲囪喘鍙拌处")
+@Slf4j
public class PurchaseLedgerController extends BaseController {
private IPurchaseLedgerService purchaseLedgerService;
@@ -52,6 +60,57 @@
private SalesLedgerProductTemplateMapper salesLedgerProductTemplateMapper;
+
+ /**
+ * 瀵煎叆閲囪喘鍙拌处
+ */
+ @Log(title = "瀵煎叆閲囪喘鍙拌处", businessType = BusinessType.INSERT)
+ @PostMapping("/import")
+ @ApiOperation("瀵煎叆閲囪喘鍙拌处")
+ public AjaxResult importData(@RequestParam("file")
+ @ApiParam(value = "Excel鏂囦欢", required = true)
+ MultipartFile file) {
+ return purchaseLedgerService.importData(file);
+ }
+
+ @ApiOperation("瀵煎嚭閲囪喘鍙拌处妯℃澘")
+ @PostMapping("/exportTemplate")
+ public void exportTemplate(HttpServletResponse response) {
+ // 1. 妯℃澘鏂囦欢鍦╮esources/static涓嬬殑璺緞
+ String templatePath = "static/閲囪喘鍙拌处瀵煎叆妯℃澘.xlsx";
+
+ // 2. 鑾峰彇妯℃澘鏂囦欢鐨勮緭鍏ユ祦
+ try (InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(templatePath)) {
+ if (inputStream == null) {
+ throw new FileNotFoundException("妯℃澘鏂囦欢涓嶅瓨鍦細" + templatePath);
+ }
+
+ // 3. 璁剧疆鍝嶅簲澶达紝瑙﹀彂娴忚鍣ㄤ笅杞�
+ response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+ response.setCharacterEncoding("utf-8");
+ String fileName = URLEncoder.encode("閲囪喘鍙拌处瀵煎叆妯℃澘.xlsx", "utf-8").replaceAll("\\+", "%20");
+ response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName);
+
+ // 4. 灏嗘ā鏉挎枃浠跺啓鍏ュ搷搴旇緭鍑烘祦
+ try (OutputStream outputStream = response.getOutputStream()) {
+ byte[] buffer = new byte[1024];
+ int len;
+ while ((len = inputStream.read(buffer)) > 0) {
+ outputStream.write(buffer, 0, len);
+ }
+ outputStream.flush();
+ }
+ } catch (IOException e) {
+ log.error("瀵煎嚭閿�鍞彴璐︽ā鏉垮け璐�", e);
+ // 鑻ユā鏉挎枃浠惰鍙栧け璐ワ紝杩斿洖閿欒鎻愮ず
+ try {
+ response.getWriter().write("妯℃澘瀵煎嚭澶辫触锛�" + e.getMessage());
+ } catch (IOException ex) {
+ log.error("鍝嶅簲杈撳嚭閿欒", ex);
+ }
+ }
+ }
+
/**
* 鏌ヨ閲囪喘鍙拌处鍒楄〃
*/
diff --git a/src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerImportDto.java b/src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerImportDto.java
new file mode 100644
index 0000000..f915051
--- /dev/null
+++ b/src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerImportDto.java
@@ -0,0 +1,53 @@
+package com.ruoyi.purchase.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author :yys
+ * @date : 2026/1/26 16:01
+ */
+@Data
+public class PurchaseLedgerImportDto extends PurchaseLedgerProductImportDto{
+
+ @Excel(name = "閲囪喘鍗曞彿")
+ private String purchaseContractNumber;
+ @Excel(name = "閿�鍞崟鍙�")
+ private String salesContractNo;
+
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "褰曞叆鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date entryDate;
+
+ @Excel(name = "渚涘簲鍟嗗悕绉�")
+ private String supplierName;
+ @Excel(name = "椤圭洰鍚嶇О")
+ private String projectName;
+ /**
+ * 褰曞叆浜哄鍚�
+ */
+ @Excel(name = "褰曞叆浜�")
+ private String recorderName;
+ @Excel(name = "澶囨敞")
+ private String remarks;
+
+ @ApiModelProperty(value = "绛捐鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "绛捐鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date executionDate;
+
+ @ApiModelProperty(value = "浠樻鏂瑰紡")
+ @Excel(name = "浠樻鏂瑰紡")
+ private String paymentMethod;
+
+ @ApiModelProperty(value = "瀹℃牳浜�(澶氫釜鐢紝闅斿紑)")
+ @Excel(name = "瀹℃牳浜�(澶氫釜鐢紝闅斿紑)")
+ private String approveUserIds;
+
+
+
+}
diff --git a/src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerProductImportDto.java b/src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerProductImportDto.java
new file mode 100644
index 0000000..3db4abe
--- /dev/null
+++ b/src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerProductImportDto.java
@@ -0,0 +1,83 @@
+package com.ruoyi.purchase.dto;
+
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import com.ruoyi.sales.dto.SalesLedgerProductImportDto;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author :yys
+ * @date : 2026/1/26 16:03
+ */
+@Data
+public class PurchaseLedgerProductImportDto{
+
+ @Excel(name = "閲囪喘鍗曞彿")
+ private String purchaseContractNumber;
+
+ /**
+ * 棰勮鏁伴噺
+ */
+ @Excel(name = "搴撳瓨棰勮鏁伴噺")
+ private BigDecimal warnNum;
+
+ @Excel(name = "閿�鍞崟鍙�")
+ private String salesContractNo;
+
+
+ /**
+ * 浜у搧澶х被
+ */
+ @Excel(name = "浜у搧澶х被")
+ private String productCategory;
+
+ /**
+ * 瑙勬牸鍨嬪彿
+ */
+ @Excel(name = "瑙勬牸鍨嬪彿")
+ private String specificationModel;
+
+ /**
+ * 鍗曚綅
+ */
+ @Excel(name = "鍗曚綅")
+ private String unit;
+
+ /**
+ * 鏁伴噺
+ */
+ @Excel(name = "鏁伴噺")
+ private BigDecimal quantity;
+
+ /**
+ * 绋庣巼
+ */
+ @Excel(name = "绋庣巼")
+ private BigDecimal taxRate;
+
+ /**
+ * 鍚◣鍗曚环
+ */
+ @Excel(name = "鍚◣鍗曚环")
+ private BigDecimal taxInclusiveUnitPrice;
+
+ /**
+ * 鍚◣鎬讳环
+ */
+ @Excel(name = "鍚◣鎬讳环")
+ private BigDecimal taxInclusiveTotalPrice;
+
+ /**
+ * 鍙戠エ绫诲瀷
+ */
+ @Excel(name = "鍙戠エ绫诲瀷")
+ private String invoiceType;
+
+ /**
+ * 鏄惁璐ㄦ
+ */
+ @Excel(name = "鏄惁璐ㄦ", readConverterExp = "0=鍚�,1=鏄�")
+ private Integer isChecked;
+
+}
diff --git a/src/main/java/com/ruoyi/purchase/service/IPurchaseLedgerService.java b/src/main/java/com/ruoyi/purchase/service/IPurchaseLedgerService.java
index a998d0e..2976eb6 100644
--- a/src/main/java/com/ruoyi/purchase/service/IPurchaseLedgerService.java
+++ b/src/main/java/com/ruoyi/purchase/service/IPurchaseLedgerService.java
@@ -3,9 +3,11 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.purchase.dto.PurchaseLedgerDto;
import com.ruoyi.purchase.pojo.PurchaseLedger;
import com.ruoyi.sales.pojo.InvoiceRegistrationProduct;
+import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.List;
@@ -40,4 +42,5 @@
String getPurchaseNo();
+ AjaxResult importData(MultipartFile file);
}
diff --git a/src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java b/src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java
index a32b6f6..7ab6c61 100644
--- a/src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java
+++ b/src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java
@@ -344,7 +344,6 @@
List<Long> supplierIds = suppliers.stream()
.map(SupplierManage::getId) // 鍏堣幏鍙朓nteger绫诲瀷鐨処D
.filter(Objects::nonNull) // 杩囨护鎺夊彲鑳界殑null鍊�
- .map(Integer::longValue) // 灏咺nteger杞崲涓篖ong
.collect(Collectors.toList());
// 鑾峰彇褰撴湀鐨勫紑濮嬪拰缁撴潫鏃ユ湡
diff --git a/src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java b/src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java
index c4fef55..e500744 100644
--- a/src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java
@@ -17,6 +17,7 @@
import com.ruoyi.basic.mapper.ProductMapper;
import com.ruoyi.basic.mapper.ProductModelMapper;
import com.ruoyi.basic.mapper.SupplierManageMapper;
+import com.ruoyi.basic.pojo.Customer;
import com.ruoyi.basic.pojo.Product;
import com.ruoyi.basic.pojo.ProductModel;
import com.ruoyi.basic.pojo.SupplierManage;
@@ -25,7 +26,9 @@
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.security.LoginUser;
+import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.other.mapper.TempFileMapper;
import com.ruoyi.other.pojo.TempFile;
import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper;
@@ -33,11 +36,15 @@
import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.mapper.SysUserMapper;
import com.ruoyi.purchase.dto.PurchaseLedgerDto;
+import com.ruoyi.purchase.dto.PurchaseLedgerImportDto;
+import com.ruoyi.purchase.dto.PurchaseLedgerProductImportDto;
import com.ruoyi.purchase.mapper.*;
import com.ruoyi.purchase.pojo.*;
import com.ruoyi.purchase.service.IPurchaseLedgerService;
import com.ruoyi.quality.mapper.*;
import com.ruoyi.quality.pojo.*;
+import com.ruoyi.sales.dto.SalesLedgerImportDto;
+import com.ruoyi.sales.dto.SalesLedgerProductImportDto;
import com.ruoyi.sales.mapper.*;
import com.ruoyi.sales.pojo.CommonFile;
import com.ruoyi.sales.pojo.InvoiceRegistrationProduct;
@@ -51,9 +58,12 @@
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
+import java.io.InputStream;
import java.math.BigDecimal;
+import java.math.RoundingMode;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -93,6 +103,8 @@
private final ProductMapper productMapper;
private final ProductModelMapper productModelMapper;
+
+ private final SysUserMapper sysUserMapper;
private final TicketRegistrationMapper ticketRegistrationMapper;
@@ -155,7 +167,7 @@
if (purchaseLedger.getId() == null) {
purchaseLedgerMapper.insert(purchaseLedger);
} else {
- // 鍒犻櫎閲囪喘瀹℃壒锛岄噸鏂版彁浜�
+ // 鍒犻櫎閲囪喘瀹℃牳锛岄噸鏂版彁浜�
ApproveProcess one = approveProcessService.getOne(new LambdaQueryWrapper<ApproveProcess>()
.eq(ApproveProcess::getApproveType, 5)
.eq(ApproveProcess::getApproveReason, purchaseLedger.getPurchaseContractNumber())
@@ -166,15 +178,9 @@
}
purchaseLedgerMapper.updateById(purchaseLedger);
}
- // 6.閲囪喘瀹℃壒鏂板
- ApproveProcessVO approveProcessVO = new ApproveProcessVO();
- approveProcessVO.setApproveType(5);
- approveProcessVO.setApproveDeptId(loginUser.getCurrentDeptId());
- approveProcessVO.setApproveReason(purchaseLedger.getPurchaseContractNumber());
- approveProcessVO.setApproveUserIds(purchaseLedgerDto.getApproveUserIds());
- approveProcessVO.setApproveUser(loginUser.getUserId());
- approveProcessVO.setApproveTime(LocalDate.now().toString());
- approveProcessService.addApprove(approveProcessVO);
+ // 6.閲囪喘瀹℃牳鏂板
+ addApproveByPurchase(loginUser, purchaseLedger);
+
// 4. 澶勭悊瀛愯〃鏁版嵁
List<SalesLedgerProduct> productList = purchaseLedgerDto.getProductData();
if (productList != null && !productList.isEmpty()) {
@@ -610,6 +616,125 @@
return purchaseNo + String.format("%03d", sequence);
}
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public AjaxResult importData(MultipartFile file) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ try {
+ InputStream inputStream = file.getInputStream();
+ ExcelUtil<PurchaseLedgerImportDto> salesLedgerImportDtoExcelUtil = new ExcelUtil<>(PurchaseLedgerImportDto.class);
+ Map<String, List<PurchaseLedgerImportDto>> stringListMap = salesLedgerImportDtoExcelUtil.importExcelMultiSheet(Arrays.asList("閲囪喘鍙拌处鏁版嵁", "閲囪喘浜у搧鏁版嵁"), inputStream, 0);
+ if (CollectionUtils.isEmpty(stringListMap)) return AjaxResult.error("閲囪喘琛ㄦ牸涓虹┖锛�");
+ // 涓氬姟灞傚悎骞�
+ List<PurchaseLedgerImportDto> salesLedgerImportDtoList = stringListMap.get("閲囪喘鍙拌处鏁版嵁");
+ if (CollectionUtils.isEmpty(salesLedgerImportDtoList)) return AjaxResult.error("閲囪喘鍙拌处鏁版嵁涓虹┖锛�");
+ List<PurchaseLedgerImportDto> salesLedgerProductImportDtoList = stringListMap.get("閲囪喘浜у搧鏁版嵁");
+ if (CollectionUtils.isEmpty(salesLedgerProductImportDtoList)) return AjaxResult.error("閲囪喘浜у搧鏁版嵁涓虹┖锛�");
+ // 渚涘簲鍟嗘暟鎹�
+ List<SupplierManage> customers = supplierManageMapper.selectList(new LambdaQueryWrapper<SupplierManage>().in(SupplierManage::getSupplierName,
+ salesLedgerImportDtoList.stream().map(PurchaseLedgerImportDto::getSupplierName).collect(Collectors.toList())));
+ List<Map<String,Object>> list = productModelMapper.getProductAndModelList();
+ // 褰曞叆浜烘暟鎹�
+ List<SysUser> sysUsers = sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>().in(SysUser::getNickName,
+ salesLedgerImportDtoList.stream().map(PurchaseLedgerImportDto::getRecorderName).collect(Collectors.toList())));
+ for (PurchaseLedgerImportDto salesLedgerImportDto : salesLedgerImportDtoList) {
+ PurchaseLedger salesLedger = new PurchaseLedger();
+ BeanUtils.copyProperties(salesLedgerImportDto, salesLedger);
+ // 閫氳繃渚涘簲鍟嗗悕绉版煡璇D
+ salesLedger.setSupplierId(customers.stream()
+ .filter(customer -> customer.getSupplierName().equals(salesLedger.getSupplierName()))
+ .findFirst()
+ .map(SupplierManage::getId)
+ .orElse(null));
+ Long aLong = sysUsers.stream()
+ .filter(sysUser -> sysUser.getNickName().equals(salesLedger.getRecorderName()))
+ .findFirst()
+ .map(SysUser::getUserId)
+ .orElse(null);
+ if (aLong == null)
+ throw new RuntimeException("褰曞叆浜�:" + salesLedger.getRecorderName() + ",鏃犲搴旂敤鎴凤紒");
+ salesLedger.setRecorderId(aLong);
+ // 閲囪喘浜у搧鏁版嵁缁戝畾锛岄�氳繃閲囪喘鍗曞彿鑾峰彇瀵瑰簲閲囪喘浜у搧鏁版嵁
+ List<PurchaseLedgerProductImportDto> salesLedgerProductImportDtos = salesLedgerProductImportDtoList.stream()
+ .filter(salesLedgerProductImportDto -> salesLedgerProductImportDto.getPurchaseContractNumber().equals(salesLedger.getPurchaseContractNumber()))
+ .collect(Collectors.toList());
+ if (CollectionUtils.isEmpty(salesLedgerProductImportDtos))
+ throw new RuntimeException("閲囪喘鍗曞彿:" + salesLedgerImportDto.getPurchaseContractNumber() + ",鏃犲搴斾骇鍝佹暟鎹紒");
+ salesLedger.setContractAmount(salesLedgerProductImportDtos.stream()
+ .map(PurchaseLedgerProductImportDto::getTaxInclusiveTotalPrice)
+ .reduce(BigDecimal.ZERO,BigDecimal::add));
+ // 閫氳繃閿�鍞崟鍙风粦瀹氶攢鍞�
+ SalesLedger salesLedger1 = salesLedgerMapper.selectOne(new LambdaQueryWrapper<SalesLedger>()
+ .eq(SalesLedger::getSalesContractNo, salesLedger.getSalesContractNo())
+ .last("LIMIT 1"));
+ if(salesLedger1 != null){
+ salesLedger.setSalesLedgerId(salesLedger1.getId());
+ }
+ // 閲囪喘瀹℃牳
+ // 閫氳繃鏄电О鑾峰彇鐢ㄦ埛ID
+ String[] split = salesLedger.getApproveUserIds().split("锛�");
+ List<Long> ids = new ArrayList<>();
+ for (int i = 0; i < split.length; i++) {
+ SysUser sysUser = sysUserMapper.selectOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getNickName, split[i])
+ .last("LIMIT 1"));
+ if (sysUser != null) {
+ ids.add(sysUser.getUserId());
+ }
+ }
+ // 灏嗛泦鍚堣浆涓哄瓧绗︿覆锛岄殧寮�
+ String collect = ids.stream().map(Object::toString).collect(Collectors.joining(","));
+ salesLedger.setApproveUserIds(collect);
+ purchaseLedgerMapper.insert(salesLedger);
+
+ for (PurchaseLedgerProductImportDto salesLedgerProductImportDto : salesLedgerProductImportDtos) {
+ SalesLedgerProduct salesLedgerProduct = new SalesLedgerProduct();
+ BeanUtils.copyProperties(salesLedgerProductImportDto, salesLedgerProduct);
+ salesLedgerProduct.setSalesLedgerId(salesLedger.getId());
+ salesLedgerProduct.setType(2);
+ // 璁$畻涓嶅惈绋庢�讳环
+ salesLedgerProduct.setTaxExclusiveTotalPrice(salesLedgerProduct.getTaxInclusiveTotalPrice().divide(new BigDecimal(1).add(salesLedgerProduct.getTaxRate().divide(new BigDecimal(100))), 2, RoundingMode.HALF_UP));
+ salesLedgerProduct.setFutureTickets(salesLedgerProduct.getQuantity());
+ salesLedgerProduct.setFutureTicketsAmount(salesLedgerProduct.getTaxExclusiveTotalPrice());
+ list.stream()
+ .filter(map -> map.get("productName").equals(salesLedgerProduct.getProductCategory()) && map.get("model").equals(salesLedgerProduct.getSpecificationModel()))
+ .findFirst()
+ .ifPresent(map -> {
+ salesLedgerProduct.setProductModelId(Long.parseLong(map.get("modelId").toString()));
+ salesLedgerProduct.setProductId(Long.parseLong(map.get("id").toString()));
+ });
+ salesLedgerProduct.setRegister(loginUser.getNickName());
+ salesLedgerProduct.setRegisterDate(LocalDateTime.now());
+ salesLedgerProduct.setApproveStatus(0);
+ salesLedgerProduct.setPendingTicketsTotal(salesLedgerProductImportDto.getTaxInclusiveTotalPrice());
+ // 鏄惁璐ㄦ鍒ゆ柇
+ salesLedgerProduct.setIsChecked(salesLedgerProductImportDto.getIsChecked() == 1);
+ if(salesLedgerProductImportDto.getIsChecked() == 1){
+ addQualityInspect(salesLedger, salesLedgerProduct);
+ }
+ salesLedgerProductMapper.insert(salesLedgerProduct);
+ }
+ // 閲囪喘瀹℃牳
+ addApproveByPurchase(loginUser,salesLedger);
+ }
+
+ return AjaxResult.success("瀵煎叆鎴愬姛");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return AjaxResult.success("瀵煎叆澶辫触");
+ }
+
+ public void addApproveByPurchase(LoginUser loginUser,PurchaseLedger purchaseLedger) throws Exception {
+ ApproveProcessVO approveProcessVO = new ApproveProcessVO();
+ approveProcessVO.setApproveType(5);
+ approveProcessVO.setApproveDeptId(loginUser.getCurrentDeptId());
+ approveProcessVO.setApproveReason(purchaseLedger.getPurchaseContractNumber());
+ approveProcessVO.setApproveUserIds(purchaseLedger.getApproveUserIds());
+ approveProcessVO.setApproveUser(loginUser.getUserId());
+ approveProcessVO.setApproveTime(LocalDate.now().toString());
+ approveProcessService.addApprove(approveProcessVO);
+ }
+
/**
* 涓嬪垝绾垮懡鍚嶈浆椹煎嘲鍛藉悕
*/
diff --git a/src/main/java/com/ruoyi/sales/dto/SalesLedgerImportDto.java b/src/main/java/com/ruoyi/sales/dto/SalesLedgerImportDto.java
index 74615bf..a4c585b 100644
--- a/src/main/java/com/ruoyi/sales/dto/SalesLedgerImportDto.java
+++ b/src/main/java/com/ruoyi/sales/dto/SalesLedgerImportDto.java
@@ -43,9 +43,6 @@
@Excel(name = "绛捐鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd")
private Date executionDate;
- @Excel(name = "鍚堝悓閲戦")
- private BigDecimal contractAmount;
-
@ApiModelProperty(value = "浠樻鏂瑰紡")
@Excel(name = "浠樻鏂瑰紡")
private String paymentMethod;
diff --git "a/src/main/resources/static/\351\207\207\350\264\255\345\217\260\350\264\246\345\257\274\345\205\245\346\250\241\346\235\277.xlsx" "b/src/main/resources/static/\351\207\207\350\264\255\345\217\260\350\264\246\345\257\274\345\205\245\346\250\241\346\235\277.xlsx"
new file mode 100644
index 0000000..7c08b61
--- /dev/null
+++ "b/src/main/resources/static/\351\207\207\350\264\255\345\217\260\350\264\246\345\257\274\345\205\245\346\250\241\346\235\277.xlsx"
Binary files differ
--
Gitblit v1.9.3