From c5ea85558fea4d82b5368073c598a30f905c4bdc Mon Sep 17 00:00:00 2001
From: shiyunteng <shiyunteng@example.com>
Date: 星期五, 23 十月 2026 17:11:49 +0800
Subject: [PATCH] feat:新增统计标注功能

---
 platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractSubjectMatterServiceImpl.java |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractSubjectMatterServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractSubjectMatterServiceImpl.java
index 022e1ae..fe0192c 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractSubjectMatterServiceImpl.java
+++ b/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("鐭崇叅鏈衡�斺�攖enant1鍚堝悓鏂板浜у搧瀵煎叆鏌ヨ鍥炲弬锛歿}", 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();
+	}
 }
\ No newline at end of file

--
Gitblit v1.9.1