From 21d204b9523d892c4718753c3a126c8f48c8ef53 Mon Sep 17 00:00:00 2001 From: zhangsiqi <2825463979@qq.com> Date: Wed, 15 May 2024 17:32:05 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=E9=87=87=E8=B4=AD=E6=8A=A5=E4=BB=B7?= =?UTF-8?q?=E5=8D=95=E7=89=A9=E6=96=99=E4=BF=A1=E6=81=AF=E8=A1=A8=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=AD=97=E6=AE=B5filestr=EF=BC=8CphotoAttachId?= =?UTF-8?q?=EF=BC=8CfileIdStr=EF=BC=8CremoveFileIdStr=EF=BC=8CpurchaseQuot?= =?UTF-8?q?eChildList?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/purchase/domain/PurchaseQuote.java | 64 +++++++++++++++++-- .../impl/PurchaseQuoteServiceImpl.java | 35 +++++++++- 2 files changed, 93 insertions(+), 6 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseQuote.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseQuote.java index 63980996..d3f95436 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseQuote.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseQuote.java @@ -1,6 +1,9 @@ package com.ruoyi.purchase.domain; import java.math.BigDecimal; +import java.util.List; + +import com.ruoyi.system.domain.SysPurchaseQuoteChild; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; @@ -36,7 +39,7 @@ public class PurchaseQuote extends BaseEntity private String supplierName; /** 税率 */ - private BigDecimal taxRate; + private Double taxRate; /** 物料合计 */ @Excel(name = "物料合计") @@ -70,7 +73,60 @@ public class PurchaseQuote extends BaseEntity @Excel(name = "使用状态") private String useStatus; - public void setPurchaseQuoteId(Long purchaseQuoteId) + //图片索引id + private Long photoAttachId; + + /** 照片 */ + private String photoUrl; + + private String fileIdStr; + + private String removeFileIdStr; + + private List purchaseQuoteChildList; + + + public List getPurchaseQuoteChildList() { + return purchaseQuoteChildList; + } + + public void setPurchaseQuoteChildList(List purchaseQuoteChildList) { + this.purchaseQuoteChildList = purchaseQuoteChildList; + } + + public Long getPhotoAttachId() { + return photoAttachId; + } + + public void setPhotoAttachId(Long photoAttachId) { + this.photoAttachId = photoAttachId; + } + + public String getPhotoUrl() { + return photoUrl; + } + + public void setPhotoUrl(String photoUrl) { + this.photoUrl = photoUrl; + } + + public String getFileIdStr() { + return fileIdStr; + } + + public void setFileIdStr(String fileIdStr) { + this.fileIdStr = fileIdStr; + } + + public String getRemoveFileIdStr() { + return removeFileIdStr; + } + + public void setRemoveFileIdStr(String removeFileIdStr) { + this.removeFileIdStr = removeFileIdStr; + } + + public void setPurchaseQuoteId(Long purchaseQuoteId) { this.purchaseQuoteId = purchaseQuoteId; } @@ -115,12 +171,12 @@ public class PurchaseQuote extends BaseEntity { return supplierName; } - public void setTaxRate(BigDecimal taxRate) + public void setTaxRate(Double taxRate) { this.taxRate = taxRate; } - public BigDecimal getTaxRate() + public Double getTaxRate() { return taxRate; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteServiceImpl.java index 6fc498a5..0597010a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteServiceImpl.java @@ -11,9 +11,11 @@ import com.ruoyi.common.utils.StringUtils; import com.ruoyi.process.general.service.IProcessService; import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper; import com.ruoyi.system.domain.SysAttach; +import com.ruoyi.system.domain.SysPurchaseQuoteChild; import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.service.ISysAttachFileService; import com.ruoyi.system.service.ISysAttachService; +import com.ruoyi.system.service.ISysPurchaseQuoteChildService; import com.ruoyi.system.service.ISysRoleService; import org.activiti.engine.TaskService; import org.springframework.beans.factory.annotation.Autowired; @@ -22,6 +24,7 @@ import com.ruoyi.purchase.mapper.PurchaseQuoteMapper; import com.ruoyi.purchase.domain.PurchaseQuote; import com.ruoyi.purchase.service.IPurchaseQuoteService; import com.ruoyi.common.core.text.Convert; +import org.springframework.transaction.annotation.Transactional; /** * 采购报价单Service业务层处理 @@ -58,6 +61,9 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService @Autowired private ISysRoleService roleService; + + @Autowired + private ISysPurchaseQuoteChildService purchaseQuoteChildService; /** * 查询采购报价单 * @@ -89,6 +95,7 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService * @return 结果 */ @Override + @Transactional(rollbackFor = Exception.class) public int insertPurchaseQuote(PurchaseQuote purchaseQuote) { String loginName = ShiroUtils.getLoginName(); @@ -102,7 +109,7 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService SysAttach attach = new SysAttach(); attach.setCreateBy(loginName); attach.setCreateTime(DateUtils.getNowDate()); - attach.setSourceType("PurchaseQuote"); + attach.setSourceType("purchaseQuote"); attach.setSourceSubType("photo"); attach.setRelId(id); attachService.insertSysAttach(attach); @@ -111,6 +118,17 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService List fileIdList = Arrays.asList(fileIdStr.split(";")); attachFileService.updateAttachIdByIdList(attachId,fileIdList); } + List childList = purchaseQuote.getPurchaseQuoteChildList(); + int childResult = childList.size(); + if(childResult >= 1){ + for(SysPurchaseQuoteChild child : purchaseQuote.getPurchaseQuoteChildList()){ + child.setPurchaseQuoteCode(purchaseQuote.getPurchaseQuoteCode()); + child.setCreateBy(loginName); + child.setCreateTime(DateUtils.getNowDate()); + child.setTaxRate(purchaseQuote.getTaxRate()); + purchaseQuoteChildService.insertSysPurchaseQuoteChild(child); + } + } return result; } @@ -121,6 +139,7 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService * @return 结果 */ @Override + @Transactional(rollbackFor = Exception.class) public int updatePurchaseQuote(PurchaseQuote purchaseQuote) { String loginName = ShiroUtils.getLoginName(); @@ -142,7 +161,7 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService SysAttach attach = new SysAttach(); attach.setCreateBy(loginName); attach.setCreateTime(DateUtils.getNowDate()); - attach.setSourceType("PurchaseQuote"); + attach.setSourceType("purchaseQuote"); attach.setSourceSubType("photo"); attach.setRelId(id); attachService.insertSysAttach(attach); @@ -150,6 +169,17 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService } attachFileService.updateAttachIdByIdList(photoAttachId, fileIdList); } + List childList = purchaseQuote.getPurchaseQuoteChildList(); + int childResult = childList.size(); + if(childResult >= 1){ + for(SysPurchaseQuoteChild child : purchaseQuote.getPurchaseQuoteChildList()){ + child.setPurchaseQuoteCode(purchaseQuote.getPurchaseQuoteCode()); + child.setCreateBy(loginName); + child.setCreateTime(DateUtils.getNowDate()); + child.setTaxRate(purchaseQuote.getTaxRate()); + purchaseQuoteChildService.updateSysPurchaseQuoteChild(child); + } + } return purchaseQuoteMapper.updatePurchaseQuote(purchaseQuote); } @@ -173,6 +203,7 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService * @return 结果 */ @Override + @Transactional public int deletePurchaseQuoteById(Long purchaseQuoteId) { return purchaseQuoteMapper.deletePurchaseQuoteById(purchaseQuoteId);