shiyunteng
2026-10-23 c5ea85558fea4d82b5368073c598a30f905c4bdc
feat:新增统计标注功能
1个文件已添加
13个文件已修改
221 ■■■■■ 已修改文件
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/ContractSubjectMatterAnnotateDTO.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/Contract.java 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractSubjectMatter.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractPageVo.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ContractInvoiceController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ContractSubjectMatterController.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/ContractInvoiceService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/ContractSubjectMatterService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/BusinessCustomerServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractInvoiceServiceImpl.java 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractSubjectMatterServiceImpl.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/OutBoundServiceImpl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml 1 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/ContractSubjectMatterAnnotateDTO.java
New file
@@ -0,0 +1,22 @@
package com.by4cloud.platformx.business.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class ContractSubjectMatterAnnotateDTO {
    private Long id;
    private Long contractId;
    @Schema(description = "产品板块")
    private String productSection;
    @Schema(description = "业务项目")
    private String businessProject;
    @Schema(description = "产品名称")
    private String productCategory;
}
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/Contract.java
@@ -454,4 +454,8 @@
    @Schema(description = "合同条款及主要内容")
    @Column(columnDefinition = "text comment '合同条款及主要内容'")
    private String summary;
    @Schema(description = "统计标记")
    @Column(columnDefinition = "tinyint(1) default 0 comment '统计标记'")
    private String annotateFlag;
}
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractSubjectMatter.java
@@ -186,4 +186,15 @@
    @Column(columnDefinition = "VARCHAR(64) comment '数据id工业泵用'")
    private String dataId;
    @Schema(description = "产品板块")
    @Column(columnDefinition = "VARCHAR(64) comment '产品板块'")
    private String productSection;
    @Schema(description = "业务项目")
    @Column(columnDefinition = "VARCHAR(64) comment '业务项目'")
    private String businessProject;
    @Schema(description = "产品名称")
    @Column(columnDefinition = "VARCHAR(64) comment '产品名称'")
    private String productCategory;
}
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractPageVo.java
@@ -201,6 +201,8 @@
    private String afterChange;
    private String annotateFlag;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "变更时间")
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ContractInvoiceController.java
@@ -257,6 +257,16 @@
    }
    /**
     * 通过key查询zb字典
     * @return R
     */
    @Operation(summary = "通过key查询zb字典" , description = "通过key查询zb字典" )
    @GetMapping("/selectZbByKey/{dictKey}" )
    public R selectZbByKey(@PathVariable("dictKey" ) String dictKey) {
        return contractInvoiceService.selectZbByKey(dictKey);
    }
    /**
     * 手动通过发票
     * @return
     */
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ContractSubjectMatterController.java
@@ -5,6 +5,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.by4cloud.platformx.business.dto.ContractSubjectMatterAnnotateDTO;
import com.by4cloud.platformx.business.entity.ContractSubjectMatter;
import com.by4cloud.platformx.business.vo.ProductExcelVO;
import com.by4cloud.platformx.business.vo.SubjectMatterExcelVO;
@@ -158,4 +159,17 @@
    public R smjProduct(@PathVariable("erpCode" ) String erpCode) {
        return contractSubjectMatterService.smjProduct(erpCode);
    }
    /**
     * 修改合同标的物明细表
     * @param annotateDTOList 合同标的物明细表
     * @return R
     */
    @Operation(summary = "合同标的物统计标注" , description = "合同标的物统计标注" )
    @SysLog("合同标的物统计标注" )
    @PostMapping("/annotate")
    public R annotate(@RequestBody List<ContractSubjectMatterAnnotateDTO> annotateDTOList) {
        return contractSubjectMatterService.annotate(annotateDTOList);
    }
}
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/ContractInvoiceService.java
@@ -53,4 +53,6 @@
    R genMergeInvoiceInfo(GenMergeInvoiceDTO mergeInvoiceDTO);
    R toMergeInvoice(ToMergeInvoiceDTO toMergeInvoiceDTO);
    R selectZbByKey(String dictKey);
}
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/ContractSubjectMatterService.java
@@ -2,6 +2,7 @@
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import com.by4cloud.platformx.business.dto.ContractSubjectMatterAnnotateDTO;
import com.by4cloud.platformx.business.entity.ContractSubjectMatter;
import com.by4cloud.platformx.business.vo.SubjectMatterExcelVO;
import com.by4cloud.platformx.common.core.util.R;
@@ -20,4 +21,6 @@
    R smjProduct(String erpCode);
    JSONObject syncProductBySMJ(String tenant1, String materialCode);
    R annotate(List<ContractSubjectMatterAnnotateDTO> annotateDTOList);
}
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/BusinessCustomerServiceImpl.java
@@ -16,6 +16,7 @@
import com.by4cloud.platformx.business.vo.*;
import com.by4cloud.platformx.common.core.util.R;
import com.by4cloud.platformx.common.excel.vo.ErrorMessage;
import com.by4cloud.platformx.common.security.util.SecurityUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -124,7 +125,9 @@
            return R.failed("客商名称或社会信用代码不能为空");
        }
        BusinessCustomer bc = baseMapper.selectOne(Wrappers.<BusinessCustomer>lambdaQuery().eq(BusinessCustomer::getCompanyName,addDTO.getCompanyName())
                .eq(BusinessCustomer::getCreditCode,addDTO.getCreditCode()).last("limit 1"));
                .eq(BusinessCustomer::getCreditCode,addDTO.getCreditCode())
                .eq(BusinessCustomer::getCompId, SecurityUtils.getUser().getCompId())
                .last("limit 1"));
        if (ObjUtil.isNotNull(bc)){
            return R.failed("客商已存在");
        }
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractInvoiceServiceImpl.java
@@ -234,12 +234,8 @@
                }
                List<String> smjList = new ArrayList<>();
                smjList.add(smj);
                smjList.add(smjsc);
                smjList.add(smjzt);
                smjList.add(smjhw);
                if (("" + SecurityUtils.getUser().getCompId()).equals(smj) || ("" + SecurityUtils.getUser().getCompId()).equals(smjsc) ||
                        ("" + SecurityUtils.getUser().getCompId()).equals(smjzt) ||
                        ("" + SecurityUtils.getUser().getCompId()).equals(smjhw)) {
                if (("" + SecurityUtils.getUser().getCompId()).equals(smj)||("" + SecurityUtils.getUser().getCompId()).equals(smjhw)) {
                    Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, subjectMatter.getMaterialCode())
                            .in(Product::getCompId, smjList).last("limit 1"));
                    if (ObjUtil.isNull(product) || StrUtil.isBlank(product.getTaxClass()) || StrUtil.isBlank(product.getTaxCode())) {
@@ -288,12 +284,8 @@
            ContractOutBound contractOutBound = contractOutBoundMapper.selectById(contractOutBoundInvoiceVo.getContractOutBoundId());
            List<String> smjList = new ArrayList<>();
            smjList.add(smj);
            smjList.add(smjsc);
            smjList.add(smjzt);
            smjList.add(smjhw);
            if (("" + SecurityUtils.getUser().getCompId()).equals(smj) || ("" + SecurityUtils.getUser().getCompId()).equals(smjsc) ||
                    ("" + SecurityUtils.getUser().getCompId()).equals(smjzt)||
                    ("" + SecurityUtils.getUser().getCompId()).equals(smjhw)) {
            if (("" + SecurityUtils.getUser().getCompId()).equals(smj) || ("" + SecurityUtils.getUser().getCompId()).equals(smjhw)) {
                Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, contractOutBound.getSubjectMatterCode())
                        .in(Product::getCompId, smjList).last("limit 1"));
                if (ObjUtil.isNull(product) || StrUtil.isBlank(product.getTaxClass()) || StrUtil.isBlank(product.getTaxCode())) {
@@ -351,12 +343,8 @@
            ContractOutBound contractOutBound = contractOutBoundMapper.selectById(contractOutBoundInvoiceVo.getContractOutBoundId());
            List<String> smjList = new ArrayList<>();
            smjList.add(smj);
            smjList.add(smjsc);
            smjList.add(smjzt);
            smjList.add(smjhw);
            if (("" + SecurityUtils.getUser().getCompId()).equals(smj) || ("" + SecurityUtils.getUser().getCompId()).equals(smjsc) ||
                    ("" + SecurityUtils.getUser().getCompId()).equals(smjzt) ||
                    ("" + SecurityUtils.getUser().getCompId()).equals(smjhw)) {
            if (("" + SecurityUtils.getUser().getCompId()).equals(smj) ||("" + SecurityUtils.getUser().getCompId()).equals(smjhw)) {
                Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, contractOutBound.getSubjectMatterCode())
                        .in(Product::getCompId, smjList).last("limit 1"));
                if (ObjUtil.isNull(product) || StrUtil.isBlank(product.getTaxClass()) || StrUtil.isBlank(product.getTaxCode())) {
@@ -414,12 +402,8 @@
                    Product product = new Product();
                    List<String> smjList = new ArrayList<>();
                    smjList.add(smj);
                    smjList.add(smjsc);
                    smjList.add(smjzt);
                    smjList.add(smjhw);
                    if (("" + SecurityUtils.getUser().getCompId()).equals(smj) || ("" + SecurityUtils.getUser().getCompId()).equals(smjsc) ||
                            ("" + SecurityUtils.getUser().getCompId()).equals(smjzt) ||
                            ("" + SecurityUtils.getUser().getCompId()).equals(smjhw)) {
                    if (("" + SecurityUtils.getUser().getCompId()).equals(smj) || ("" + SecurityUtils.getUser().getCompId()).equals(smjhw)) {
                        product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, contractOutBound.getSubjectMatterCode())
                                .in(Product::getCompId, smjList).last("limit 1"));
                    } else {
@@ -619,12 +603,8 @@
                Product product = new Product();
                List<String> smjList = new ArrayList<>();
                smjList.add(smj);
                smjList.add(smjsc);
                smjList.add(smjzt);
                smjList.add(smjhw);
                if (("" + SecurityUtils.getUser().getCompId()).equals(smj) || ("" + SecurityUtils.getUser().getCompId()).equals(smjsc) ||
                        ("" + SecurityUtils.getUser().getCompId()).equals(smjzt)||
                        ("" + SecurityUtils.getUser().getCompId()).equals(smjhw)) {
                if (("" + SecurityUtils.getUser().getCompId()).equals(smj) || ("" + SecurityUtils.getUser().getCompId()).equals(smjhw)) {
                    product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, contractOutBound.getSubjectMatterCode())
                            .in(Product::getCompId, smjList).last("limit 1"));
                } else {
@@ -690,12 +670,8 @@
                        Product product = new Product();
                        List<String> smjList = new ArrayList<>();
                        smjList.add(smj);
                        smjList.add(smjsc);
                        smjList.add(smjzt);
                        smjList.add(smjhw);
                        if (("" + SecurityUtils.getUser().getCompId()).equals(smj) || ("" + SecurityUtils.getUser().getCompId()).equals(smjsc) ||
                                ("" + SecurityUtils.getUser().getCompId()).equals(smjzt)||
                                ("" + SecurityUtils.getUser().getCompId()).equals(smjhw)) {
                        if (("" + SecurityUtils.getUser().getCompId()).equals(smj) ||("" + SecurityUtils.getUser().getCompId()).equals(smjhw)) {
                            product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, contractOutBound.getSubjectMatterCode())
                                    .in(Product::getCompId, smjList).last("limit 1"));
                        } else {
@@ -761,14 +737,24 @@
                        mergeVo.setMaterialInternalName(schedule.getSubjectMatterName());
                        mergeVo.setPriceAndTax(schedule.getPlannedAmount());
                        mergeVo.setQuantity(schedule.getInvoiceNum());
                        Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, schedule.getSubjectMatterCode())
                                .eq(Product::getCompId, SecurityUtils.getUser().getCompId()).last("limit 1"));
                        List<String> smjList = new ArrayList<>();
                        smjList.add(smj);
                        smjList.add(smjhw);
                        Product product = null;
                        if (("" + SecurityUtils.getUser().getCompId()).equals(smj) ||("" + SecurityUtils.getUser().getCompId()).equals(smjhw)) {
                            product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, schedule.getSubjectMatterCode())
                                    .in(Product::getCompId, smjList).last("limit 1"));
                        } else {
                            product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, schedule.getSubjectMatterCode())
                                    .eq(Product::getCompId, SecurityUtils.getUser().getCompId()).last("limit 1"));
                        }
                        if (ObjUtil.isNotNull(product)) {
                            mergeVo.setTaxClass(product.getTaxClass());
                            mergeVo.setSpecification(product.getProductType());
                            mergeVo.setTaxRate(new BigDecimal(product.getTaxRate()));
                            mergeVo.setTaxCode(product.getTaxCode());
                        }
                        ContractSubjectMatter subjectMatter = subjectMatterMapper.selectOne(Wrappers.<ContractSubjectMatter>lambdaQuery()
                                .eq(ContractSubjectMatter::getMaterialCode, schedule.getSubjectMatterCode())
                                .eq(ContractSubjectMatter::getContractId, contract.getId()).last("limit 1"));
@@ -846,8 +832,17 @@
                        mergeVo.setMaterialCode(subjectMatter.getMaterialCode());
                        mergeVo.setMaterialInternalName(subjectMatter.getMaterialName());
                        mergeVo.setQuantity(contractOutBoundInvoiceVo.getInvoiceNum());
                        Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, subjectMatter.getMaterialCode())
                                .eq(Product::getCompId, SecurityUtils.getUser().getCompId()).last("limit 1"));
                        List<String> smjList = new ArrayList<>();
                        smjList.add(smj);
                        smjList.add(smjhw);
                        Product product = null;
                        if (("" + SecurityUtils.getUser().getCompId()).equals(smj) ||("" + SecurityUtils.getUser().getCompId()).equals(smjhw)) {
                            product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, subjectMatter.getMaterialCode())
                                    .in(Product::getCompId, smjList).last("limit 1"));
                        } else {
                            product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, subjectMatter.getMaterialCode())
                                    .eq(Product::getCompId, SecurityUtils.getUser().getCompId()).last("limit 1"));
                        }
                        if (ObjUtil.isNotNull(product)) {
                            mergeVo.setTaxClass(product.getTaxClass());
                            mergeVo.setSpecification(product.getProductType());
@@ -2380,6 +2375,28 @@
    }
    @Override
    public R selectZbByKey(String dictKey) {
        List<BipDict> bipDictList = bipDictMapper.selectList(Wrappers.<BipDict>lambdaQuery().eq(BipDict::getDictKey, dictKey)
                .eq(BipDict::getCompId,SecurityUtils.getUser().getCompId()));
        if (CollUtil.isNotEmpty(bipDictList)) {
            // 权限内部门
            List<TreeNode<Long>> collect = bipDictList.stream()
                    .map(dict -> {
                        TreeNode<Long> treeNode = new TreeNode<>();
                        treeNode.setId(dict.getId());
                        treeNode.setParentId(dict.getParentId());
                        treeNode.setName(dict.getDictName());
                        treeNode.setWeight(dict.getDictCode());
                        return treeNode;
                    })
                    .collect(Collectors.toList());
            return R.ok(TreeUtil.build(collect, 0L));
        }
        return R.failed("字典获取失败");
    }
    @Override
    public R saveAndPush(ContractInvoiceUpateDTO upateDTO) {
        ContractInvoice invoice = baseMapper.selectById(upateDTO.getId());
        invoice.setInvoicePreview(upateDTO.getInvoicePreview());
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractServiceImpl.java
@@ -794,7 +794,8 @@
                    baseMapper.updateById(contract);
                }
                if ((StrUtil.equals(contract.getPartyBId() + "", smj) ||
                if ((StrUtil.equals(contract.getPartyBId() + "", smj) ||StrUtil.equals(contract.getPartyBId() + "", smjsc) ||
                        StrUtil.equals(contract.getPartyBId() + "", smjzt) ||
                        StrUtil.equals(contract.getPartyBId() + "", smjhw)) && StrUtil.isNotEmpty(smjErp)) {
                    request.put("customerCode", customer.getErpCompanyCode());
                    request.put("currencyId", "RMB");
@@ -812,8 +813,17 @@
                            subjectMatterItem.put("salePrice", contractSubjectMatter.getUnitPrice());
                            subjectMatterItem.put("qtyRequired", contractSubjectMatter.getQuantity());
                            subjectMatterItem.put("money", contractSubjectMatter.getQuantity().multiply(contractSubjectMatter.getUnitPrice()));
                            Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getCompId, contract.getCompId())
                                    .eq(Product::getErpCode, contractSubjectMatter.getMaterialCode()));
                            Product product = null;
                            List<String> smjList = new ArrayList<>();
                            smjList.add(smj);
                            smjList.add(smjhw);
                            if (("" + SecurityUtils.getUser().getCompId()).equals(smj)||("" + SecurityUtils.getUser().getCompId()).equals(smjhw)) {
                                 product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, contractSubjectMatter.getMaterialCode())
                                        .in(Product::getCompId, smjList).last("limit 1"));
                            } else {
                                 product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, contractSubjectMatter.getMaterialCode())
                                        .eq(Product::getCompId, SecurityUtils.getUser().getCompId()).last("limit 1"));
                            }
                            if (ObjUtil.isNotNull(product)) {
                                subjectMatterItem.put("taxRate", new BigDecimal(product.getTaxRate()).divide(new BigDecimal("100")));
                            }
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractSubjectMatterServiceImpl.java
@@ -13,9 +13,12 @@
import com.by4cloud.platformx.admin.api.entity.SysDept;
import com.by4cloud.platformx.admin.api.vo.DeptExcelVO;
import com.by4cloud.platformx.business.dto.ContractSubjectMatterAddDTO;
import com.by4cloud.platformx.business.dto.ContractSubjectMatterAnnotateDTO;
import com.by4cloud.platformx.business.entity.Contract;
import com.by4cloud.platformx.business.entity.ContractSubjectMatter;
import com.by4cloud.platformx.business.entity.Product;
import com.by4cloud.platformx.business.entity.TaxCode;
import com.by4cloud.platformx.business.mapper.ContractMapper;
import com.by4cloud.platformx.business.mapper.ContractSubjectMatterMapper;
import com.by4cloud.platformx.business.mapper.ProductMapper;
import com.by4cloud.platformx.business.mapper.TaxCodeMapper;
@@ -50,6 +53,8 @@
@RequiredArgsConstructor
@Slf4j
public class ContractSubjectMatterServiceImpl extends ServiceImpl<ContractSubjectMatterMapper, ContractSubjectMatter> implements ContractSubjectMatterService {
    private final ContractMapper contractMapper;
    private final ProductMapper productMapper;
@@ -376,4 +381,27 @@
        log.info("石煤机——tenant1合同新增产品导入查询回参:{}", response.body());
        return R.ok(response.body());
    }
    @Override
    public R annotate(List<ContractSubjectMatterAnnotateDTO> annotateDTOList) {
        if (CollUtil.isNotEmpty(annotateDTOList)){
            Long contractId = annotateDTOList.get(0).getContractId();
            annotateDTOList.stream().forEach(annotateDTO->{
                ContractSubjectMatter subjectMatter = baseMapper.selectById(annotateDTO.getId());
                subjectMatter.setProductSection(annotateDTO.getProductSection());
                subjectMatter.setBusinessProject(annotateDTO.getBusinessProject());
                subjectMatter.setProductCategory(annotateDTO.getProductCategory());
                baseMapper.updateById(subjectMatter);
            });
            List<ContractSubjectMatter> subjectMatterList = baseMapper.selectList(Wrappers.<ContractSubjectMatter>lambdaQuery()
                    .eq(ContractSubjectMatter::getContractId,contractId)
                    .and(wrapper -> wrapper.isNull(ContractSubjectMatter::getProductSection)
                            .or().isNull(ContractSubjectMatter::getBusinessProject)
                            .or().isNull(ContractSubjectMatter::getProductCategory)));
            if (CollUtil.isEmpty(subjectMatterList)){
                contractMapper.update(Wrappers.<Contract>lambdaUpdate().eq(Contract::getId,contractId).set(Contract::getAnnotateFlag,"1"));
            }
        }
        return R.ok();
    }
}
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/OutBoundServiceImpl.java
@@ -43,7 +43,7 @@
    private final ContractSubjectMatterMapper contractSubjectMatterMapper;
    private final PaymentConfirmMapper paymentConfirmMapper;
    private final ContractMapper contractMapper;
    private final ContractPaymentScheduleProcessMapper scheduleProcessMapper;
    private final ProductMapper productMapper;
    private final ContractOutBoundMapper contractOutBoundMapper;
    private final DeliveryOverdueMapper deliveryOverdueMapper;
    private final StringRedisTemplate redisTemplate;
@@ -616,6 +616,22 @@
        outBound.setOutBoundTime(ObjUtil.isNotNull(addDTO.getOutBoundTime()) ? addDTO.getOutBoundTime() : new Date());
        outBound.setSubjectMatterCode(outSubjectMatterAddDTO.getSubjectMatterCode());
        outBound.setSubjectMatterName(outSubjectMatterAddDTO.getSubjectMatterName());
        List<String> smjList = new ArrayList<>();
        smjList.add(smj);
        smjList.add(smjhw);
        if (("" + SecurityUtils.getUser().getCompId()).equals(smj)||("" + SecurityUtils.getUser().getCompId()).equals(smjhw)) {
            Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, outSubjectMatterAddDTO.getSubjectMatterCode())
                    .in(Product::getCompId, smjList).last("limit 1"));
            if (ObjUtil.isNotNull(product) ) {
                outBound.setSubjectMatterName(outSubjectMatterAddDTO.getSubjectMatterName());
            }
        } else {
            Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, outSubjectMatterAddDTO.getSubjectMatterCode())
                    .eq(Product::getCompId, SecurityUtils.getUser().getCompId()).last("limit 1"));
            if (ObjUtil.isNotNull(product) ) {
                outBound.setSubjectMatterName(outSubjectMatterAddDTO.getSubjectMatterName());
            }
        }
        outBound.setOutBoundType("1");
        if (StrUtil.isEmpty(addDTO.getOutBoundType())) {
            outBound.setOutBoundType("0");
platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml
@@ -1119,6 +1119,7 @@
            c.warranty_schedule_id,
            c.comp_id,
            c.center_push_flag,
            c.annotate_flag,
            c.last_attachment_url,
            (select sum(delivered_quantity*unit_price) from contract_subject_matter csm where csm.contract_id = c.id) outAmount
            FROM