|
@@ -48,6 +48,7 @@ import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.apache.dubbo.config.annotation.DubboService;
|
|
import org.apache.dubbo.config.annotation.DubboService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
@@ -64,6 +65,7 @@ import java.util.stream.Collectors;
|
|
|
@DubboService(group = "design", version = "1.0.0")
|
|
@DubboService(group = "design", version = "1.0.0")
|
|
|
@RequiredArgsConstructor
|
|
@RequiredArgsConstructor
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
|
|
+@Service
|
|
|
public class RemoteContractServiceImpl implements RemoteContractService {
|
|
public class RemoteContractServiceImpl implements RemoteContractService {
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -319,10 +321,10 @@ public class RemoteContractServiceImpl implements RemoteContractService {
|
|
|
* 3. 筛选商品关联:在上述合同ID列表中,查找包含指定商品ID且未删除的合同商品记录。
|
|
* 3. 筛选商品关联:在上述合同ID列表中,查找包含指定商品ID且未删除的合同商品记录。
|
|
|
* 4. 构建映射:将合同商品记录以 contractId 为 key 建立映射,方便后续快速查找。
|
|
* 4. 构建映射:将合同商品记录以 contractId 为 key 建立映射,方便后续快速查找。
|
|
|
* 5. 确定有效合同:在筛选出的合同中,查找满足以下条件的唯一最新合同:
|
|
* 5. 确定有效合同:在筛选出的合同中,查找满足以下条件的唯一最新合同:
|
|
|
- * - 状态为已签约 (SIGNED)
|
|
|
|
|
- * - 未删除
|
|
|
|
|
- * - 指定时间在合同有效期内 (startTime <= time < endTime 或 endTime 为空)
|
|
|
|
|
- * - 按创建时间倒序排列,取第一条(即最近创建的符合条件的合同)
|
|
|
|
|
|
|
+ * - 状态为已签约 (SIGNED)
|
|
|
|
|
+ * - 未删除
|
|
|
|
|
+ * - 指定时间在合同有效期内 (startTime <= time < endTime 或 endTime 为空)
|
|
|
|
|
+ * - 按创建时间倒序排列,取第一条(即最近创建的符合条件的合同)
|
|
|
* 6. 返回结果:如果找到有效合同,返回对应的合同ID、商品ID和价格;否则返回 null。
|
|
* 6. 返回结果:如果找到有效合同,返回对应的合同ID、商品ID和价格;否则返回 null。
|
|
|
*
|
|
*
|
|
|
* @param entId 企业ID
|
|
* @param entId 企业ID
|
|
@@ -434,9 +436,9 @@ public class RemoteContractServiceImpl implements RemoteContractService {
|
|
|
* 1. 参数校验:确保 entId 和 time 不为空。
|
|
* 1. 参数校验:确保 entId 和 time 不为空。
|
|
|
* 2. 查找关联合同:查询该企业(作为供应商 SUPPLIER 或采购商 PURCHASER)参与的所有未删除的贸易合同单元,获取合同ID列表。
|
|
* 2. 查找关联合同:查询该企业(作为供应商 SUPPLIER 或采购商 PURCHASER)参与的所有未删除的贸易合同单元,获取合同ID列表。
|
|
|
* 3. 筛选有效合同:在上述合同ID列表中,筛选出满足以下条件的合同:
|
|
* 3. 筛选有效合同:在上述合同ID列表中,筛选出满足以下条件的合同:
|
|
|
- * - 未删除 (delFlag = 0)
|
|
|
|
|
- * - 状态为已签约 (status = SIGNED)
|
|
|
|
|
- * - 指定时间在合同有效期内 (startTime <= time < endTime 或 endTime 为空表示长期有效)
|
|
|
|
|
|
|
+ * - 未删除 (delFlag = 0)
|
|
|
|
|
+ * - 状态为已签约 (status = SIGNED)
|
|
|
|
|
+ * - 指定时间在合同有效期内 (startTime <= time < endTime 或 endTime 为空表示长期有效)
|
|
|
* 4. 提取商品ID:根据筛选出的有效合同ID,查询对应的合同商品记录,提取所有未删除的商品ID并去重。
|
|
* 4. 提取商品ID:根据筛选出的有效合同ID,查询对应的合同商品记录,提取所有未删除的商品ID并去重。
|
|
|
*
|
|
*
|
|
|
* @param entId 企业ID
|
|
* @param entId 企业ID
|
|
@@ -1009,21 +1011,21 @@ public class RemoteContractServiceImpl implements RemoteContractService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public BaseResult<List<TradeEntInfoResVo>> queryPrepaidTradeEntIds(TradeEntListQueryFeignDto queryFeignDto) {
|
|
|
|
|
- if(queryFeignDto.getCurEntId() == null){
|
|
|
|
|
|
|
+ public List<TradeEntInfoResVo> queryPrepaidTradeEntIds(TradeEntListQueryFeignDto queryFeignDto) {
|
|
|
|
|
+ if (queryFeignDto.getCurEntId() == null) {
|
|
|
queryFeignDto.setCurEntId(LoginUserHolder.getEntId());
|
|
queryFeignDto.setCurEntId(LoginUserHolder.getEntId());
|
|
|
}
|
|
}
|
|
|
- if(queryFeignDto.getTradeEntType() == null){
|
|
|
|
|
|
|
+ if (queryFeignDto.getTradeEntType() == null) {
|
|
|
String entTypes = LoginEntHolder.get().getEntTypes();
|
|
String entTypes = LoginEntHolder.get().getEntTypes();
|
|
|
if (entTypes.contains(String.valueOf(EntTypeEnum.SUPPLIER.getCode()))) {
|
|
if (entTypes.contains(String.valueOf(EntTypeEnum.SUPPLIER.getCode()))) {
|
|
|
queryFeignDto.setTradeEntType(EntTypeEnum.PURCHASER.getCode());
|
|
queryFeignDto.setTradeEntType(EntTypeEnum.PURCHASER.getCode());
|
|
|
} else if (entTypes.contains(String.valueOf(EntTypeEnum.PURCHASER.getCode()))) {
|
|
} else if (entTypes.contains(String.valueOf(EntTypeEnum.PURCHASER.getCode()))) {
|
|
|
queryFeignDto.setTradeEntType(EntTypeEnum.SUPPLIER.getCode());
|
|
queryFeignDto.setTradeEntType(EntTypeEnum.SUPPLIER.getCode());
|
|
|
} else {
|
|
} else {
|
|
|
- return BaseResult.success(Collections.emptyList());
|
|
|
|
|
|
|
+ return Collections.emptyList();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- return BaseResult.success(kwcContractTradeService.queryTradeEntList(queryFeignDto));
|
|
|
|
|
|
|
+ return kwcContractTradeService.queryTradeEntList(queryFeignDto);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|