Forráskód Böngészése

任务描述:
1、外销合同、样品单添加时,在产品右侧增加“上传附件”功能;
2、交接单中增加“查看附件”功能;
3、采购合同明细中,增加“查看附件”功能;

caozj 2 éve
szülő
commit
3a18215cb0

+ 16 - 1
bladex-saas-project/saas-business-tradeerp/src/main/java/com/fjhx/contract/service/impl/ContractFlowServiceImpl.java

@@ -11,6 +11,7 @@ import com.fjhx.activiti.feign.IActivitiApi;
 import com.fjhx.calculator.entity.ProfitlossCalculator;
 import com.fjhx.calculator.service.IProfitlossCalculatorService;
 import com.fjhx.coderule.enums.CodeRuleTypeEnum;
+import com.fjhx.common.attachment.IAttachmentApi;
 import com.fjhx.common.seq.feign.ISequenceApi;
 import com.fjhx.contract.constant.ContractConstant;
 import com.fjhx.contract.constant.ContractTrackLogConstant;
@@ -34,15 +35,18 @@ import org.apache.commons.lang3.StringUtils;
 import org.redisson.api.RLock;
 import org.springblade.common.constant.ActivitiConstant;
 import org.springblade.common.constant.ApiConstant;
+import org.springblade.common.constant.AttachmentConstant;
 import org.springblade.common.enums.YesOrNoEnum;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.redis.lock.RedisLockClient;
 import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.CollectionUtil;
 import org.springblade.core.tool.utils.id.IdUtils;
 import org.springblade.resource.entity.Base64ToUrl;
 import org.springblade.resource.feign.IObsClient;
+import org.springblade.system.attachment.entity.Attachment;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -95,6 +99,9 @@ public class ContractFlowServiceImpl implements IContractFlowService {
     @Autowired
     private RedisLockClient redisLockClient;
 
+    @Autowired
+    private IAttachmentApi attachmentApi;
+
     /**
      * 新增、编辑草稿
      *
@@ -545,7 +552,6 @@ public class ContractFlowServiceImpl implements IContractFlowService {
                     String remark = obsClient.base64ToUrl(new Base64ToUrl(product.getRemark(), AuthUtil.getTenantId()));
                     product.setRemark(remark);
                 }
-
                 product.setId(IdUtils.fastSimpleUUID());
                 //父id=0
                 product.setParentId("0");
@@ -586,6 +592,15 @@ public class ContractFlowServiceImpl implements IContractFlowService {
                         calculatorList.add(calculator);
                     }
                 }
+                //产品附件
+                if(CollectionUtils.isNotEmpty(product.getAttachments())){
+                    for(Attachment a :product.getAttachments()){
+                        a.setBusiId(product.getId());
+                        a.setBusiType(AttachmentConstant.BusiType.PRODUCT);
+                    }
+                    //保存附件
+                    attachmentApi.batchInsert(product.getAttachments());
+                }
             }
             if (CollectionUtils.isNotEmpty(childs)) {
                 products.addAll(childs);

+ 10 - 2
bladex-saas-project/saas-business-tradeerp/src/main/java/com/fjhx/contract/service/impl/ContractProductServiceImpl.java

@@ -123,6 +123,11 @@ public class ContractProductServiceImpl extends BasicsServiceImpl<ContractProduc
                     if (CollectionUtils.isNotEmpty(mianImags)) {
                         contractProduct.setProductMainImg(mianImags.get(0).getPath());
                     }
+                    //获取其他产品附件
+                    List<Attachment> attr = attachments.stream().filter(obj -> obj.getBusiType() == AttachmentConstant.BusiType.PRODUCT).collect(Collectors.toList());
+                    if (CollectionUtils.isNotEmpty(attr)) {
+                        contractProduct.setAttachments(attr);
+                    }
                 }
             }
         }
@@ -262,13 +267,16 @@ public class ContractProductServiceImpl extends BasicsServiceImpl<ContractProduc
             if (MapUtils.isNotEmpty(attsMap)) {
                 List<Attachment> attachments = attsMap.get(product.getProductId());
                 if (CollectionUtils.isNotEmpty(attachments)) {
-                    product.setAttachments(attachments);
-
                     //获取出主图
                     List<Attachment> mianImags = attachments.stream().filter(obj -> obj.getBusiType() == AttachmentConstant.BusiType.MIAN_IMAG).collect(Collectors.toList());
                     if (CollectionUtils.isNotEmpty(mianImags)) {
                         product.setProductMainImg(mianImags.get(0).getPath());
                     }
+                    //获取产品附件
+                    List<Attachment> attr = attachments.stream().filter(obj -> obj.getBusiType() == AttachmentConstant.BusiType.PRODUCT).collect(Collectors.toList());
+                    if (CollectionUtils.isNotEmpty(attr)) {
+                        product.setAttachments(attr);
+                    }
                 }
             }
         }

+ 15 - 0
bladex-saas-project/saas-business-tradeerp/src/main/java/com/fjhx/contract/service/impl/ContractSampleFlowServiceImpl.java

@@ -10,6 +10,7 @@ import com.fjhx.activiti.feign.IActivitiApi;
 import com.fjhx.calculator.entity.ProfitlossCalculator;
 import com.fjhx.calculator.service.IProfitlossCalculatorService;
 import com.fjhx.coderule.enums.CodeRuleTypeEnum;
+import com.fjhx.common.attachment.IAttachmentApi;
 import com.fjhx.contract.constant.ContractConstant;
 import com.fjhx.contract.constant.ContractTrackLogConstant;
 import com.fjhx.contract.entity.Contract;
@@ -32,6 +33,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.redisson.api.RLock;
 import org.springblade.common.constant.ActivitiConstant;
 import org.springblade.common.constant.ApiConstant;
+import org.springblade.common.constant.AttachmentConstant;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.redis.lock.RedisLockClient;
 import org.springblade.core.secure.BladeUser;
@@ -40,6 +42,7 @@ import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.id.IdUtils;
 import org.springblade.resource.entity.Base64ToUrl;
 import org.springblade.resource.feign.IObsClient;
+import org.springblade.system.attachment.entity.Attachment;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -89,6 +92,9 @@ public class ContractSampleFlowServiceImpl implements IContractSampleFlowService
     @Autowired
     private RedisLockClient redisLockClient;
 
+    @Autowired
+    private IAttachmentApi attachmentApi;
+
     /**
      * 新增、编辑草稿
      *
@@ -579,6 +585,15 @@ public class ContractSampleFlowServiceImpl implements IContractSampleFlowService
                         calculatorList.add(calculator);
                     }
                 }
+                //产品附件
+                if(CollectionUtils.isNotEmpty(product.getAttachments())){
+                    for(Attachment a :product.getAttachments()){
+                        a.setBusiId(product.getId());
+                        a.setBusiType(AttachmentConstant.BusiType.PRODUCT);
+                    }
+                    //保存附件
+                    attachmentApi.batchInsert(product.getAttachments());
+                }
             }
             if (CollectionUtils.isNotEmpty(calculatorList)) {
                 iProfitlossCalculatorService.saveBatch(calculatorList);

+ 5 - 0
bladex-saas-project/saas-business-tradeerp/src/main/java/com/fjhx/purchase/service/impl/PurchaseContractProductServiceImpl.java

@@ -80,6 +80,11 @@ public class PurchaseContractProductServiceImpl extends BasicsServiceImpl<Purcha
                     if (CollectionUtils.isNotEmpty(mianImags)) {
                         purchaseProduct.setProductMainImg(mianImags.get(0).getPath());
                     }
+                    //获取产品附件
+                    List<Attachment> attr = attachments.stream().filter(obj -> obj.getBusiType() == AttachmentConstant.BusiType.PRODUCT).collect(Collectors.toList());
+                    if (CollectionUtils.isNotEmpty(attr)) {
+                        purchaseProduct.setAttachments(attr);
+                    }
                 }
             }
         }

+ 10 - 0
bladex-saas-project/saas-business-tradeerp/src/main/java/com/fjhx/purchase/service/impl/PurchaseContractServiceImpl.java

@@ -61,6 +61,7 @@ import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springblade.common.constant.ApiConstant;
+import org.springblade.common.constant.AttachmentConstant;
 import org.springblade.common.constant.UserConstants;
 import org.springblade.common.enums.YesOrNoEnum;
 import org.springblade.core.log.exception.ServiceException;
@@ -366,6 +367,15 @@ public class PurchaseContractServiceImpl extends BasicsServiceImpl<PurchaseContr
                 if (StringUtils.isNotBlank(product.getParentId()) && !StringUtils.equals(product.getParentId(), "0")) {
                     product.setParentId(productIdsMap.get(product.getParentId()));
                 }
+                //产品附件
+                if(CollectionUtils.isNotEmpty(product.getAttachments())){
+                    for(Attachment a :product.getAttachments()){
+                        a.setBusiId(product.getId());
+                        a.setBusiType(AttachmentConstant.BusiType.PRODUCT);
+                    }
+                    //保存附件
+                    attachmentApi.batchInsert(product.getAttachments());
+                }
             }
             //保存产品
             iPurchaseContractProductService.saveBatch(purchaseContract.getProducts());

+ 3 - 0
bladex/blade-common/src/main/java/org/springblade/common/constant/AttachmentConstant.java

@@ -129,6 +129,9 @@ public class AttachmentConstant {
         // 服务记录
         public static final int SERVICE_CONTRACT_RECORD = 40;
 
+        // 产品附件
+        public static final int PRODUCT = 41;
+
         // 99:普通附件
         public static final int OTHER = 99;
     }