feat(app): 添加消息中心功能并优化AI助手体验
- 集成消息中心屏幕和未读消息徽章显示 - 实现消息中心后台轮询和应用状态监听 - 添加应用启动时的消息刷新逻辑 - 更新导航标题配置增加消息中心选项 - 在助手界面改进报价更正说明显示 - 增强AI助手报价单处理和文档识别功能 - 添加管理员消息发送权限控制和验证 - 优化采购参考价格操作的业务规则说明 - 修复AI助手权限验证中的通知操作检查
This commit is contained in:
parent
966df3ed57
commit
aa7da5d58c
@ -241,7 +241,8 @@ public class AssistantModelClient {
|
||||
mapped=call(prompt()+"本阶段只给literalQuotationRows附加采购匹配建议,不再转写文件,不输出单价、金额、原因等业务字段。"
|
||||
+"sourceKey是服务器给每条原报价分配的不可变标识,必须原样返回,不能用序号替代、重排编号或合并相似物品。"
|
||||
+"逐项按名称、规格、品牌匹配quotationTargets,唯一明确时id填其真实采购明细ID;不确定或系统中不存在则id填null,仍保留该sourceKey。"
|
||||
+"输出purchase.correctPrice的draft,仅有sourceKey和id两列。总共"+source.size()+"项,禁止新增采购;原报价与行数由服务器保留。",
|
||||
+"输出purchase.correctPrice的draft,仅有sourceKey和id两列。未匹配项的JSON示意:{kind:'draft',action:'purchase.correctPrice',message:'匹配建议',columns:['sourceKey','id'],rows:[['原样抄录的sourceKey',null]]};匹配项的id必须从quotationTargets原样选取。"
|
||||
+"总共"+source.size()+"项,禁止新增采购;原报价与行数由服务器保留。",
|
||||
content(matching,List.of()),List.of(matchDefinition),"QUOTE_MATCH",trace,Math.min(60000,remaining(started)),Math.max(4096,Math.min(maxOutputTokens,16384)),false,List.of());
|
||||
} catch(ModelFailure failure) {
|
||||
log.warn("Assistant quotation matching needs manual review trace={} category={} sourceRows={}",trace,failure.category,source.size());
|
||||
@ -520,6 +521,7 @@ public class AssistantModelClient {
|
||||
throw failure("HTTP_ERROR", "模型服务暂时不可用,请稍后重新识别;本次未执行业务操作。", diagnosticId);
|
||||
metrics = responseMetrics(response.body());
|
||||
Map<String, Object> proposal = routing ? parseRouteResponse(response.body(), actions, diagnosticId)
|
||||
: "QUOTE_MATCH".equals(stage) ? parseQuotationMatchesResponse(response.body(),diagnosticId)
|
||||
: parseResponse(response.body(), actions, diagnosticId);
|
||||
if("TRANSCRIBE_SOURCE_COLUMNS".equals(stage)&&"draft".equals(proposal.get("kind")))
|
||||
proposal.put("_sourceHeaders", AssistantImageSourceRows.headers(responseOutput(response.body(),diagnosticId)));
|
||||
@ -863,6 +865,40 @@ public class AssistantModelClient {
|
||||
}
|
||||
}
|
||||
|
||||
/** Matching suggestions are not executable business rows. Retain valid key/id pairs only;
|
||||
* a short/null/unmatched row must not invalidate the other suggestions or the source ledger. */
|
||||
static Map<String,Object> parseQuotationMatchesResponse(String body,String diagnosticId) {
|
||||
String output=responseOutput(body,diagnosticId).trim();
|
||||
if(output.startsWith("```"))output=output.replaceFirst("^```(?:json)?\\s*","").replaceFirst("\\s*```$","");
|
||||
try {
|
||||
var value=JSON.parseObject(output);
|
||||
if(value==null||value.get("action")!=null&&!"purchase.correctPrice".equals(value.getString("action")))
|
||||
throw new IllegalArgumentException();
|
||||
var rows=value.getJSONArray("rows");var columns=value.getJSONArray("columns");
|
||||
if(rows==null||rows.size()>300)throw new IllegalArgumentException();
|
||||
int keyColumn=-1,idColumn=-1;
|
||||
if(columns!=null) {
|
||||
for(int i=0;i<columns.size();i++) {
|
||||
if("sourceKey".equals(columns.get(i))){if(keyColumn!=-1)throw new IllegalArgumentException();keyColumn=i;}
|
||||
if("id".equals(columns.get(i))){if(idColumn!=-1)throw new IllegalArgumentException();idColumn=i;}
|
||||
}
|
||||
}
|
||||
var result=new ArrayList<Map<String,Object>>();
|
||||
for(Object row:rows) {
|
||||
Object key=null,id=null;
|
||||
if(row instanceof Map<?,?> fields){key=fields.get("sourceKey");id=fields.get("id");}
|
||||
else if(row instanceof List<?> cells&&keyColumn>=0&&keyColumn<cells.size()) {
|
||||
key=cells.get(keyColumn);if(idColumn>=0&&idColumn<cells.size())id=cells.get(idColumn);
|
||||
}
|
||||
if(!(key instanceof String text)||!text.matches("q[0-9a-f]{12}"))continue;
|
||||
var pair=new LinkedHashMap<String,Object>();pair.put("sourceKey",text);
|
||||
if(id instanceof Number||id instanceof String number&&number.matches("[0-9]{1,19}"))pair.put("id",id);
|
||||
result.add(pair);
|
||||
}
|
||||
return Map.of("kind","draft","action","purchase.correctPrice","message","匹配建议待服务器逐项核对","rows",result);
|
||||
} catch(Exception invalid) {throw failure("QUOTE_MATCH_INVALID","报价已读取,匹配建议需在确认表中核对;未执行改价。",diagnosticId);}
|
||||
}
|
||||
|
||||
static Map<String, Object> parseRouteResponse(String body, List<Map<String, Object>> actions, String diagnosticId) {
|
||||
String output = responseOutput(body, diagnosticId);
|
||||
try {
|
||||
|
||||
@ -29,7 +29,7 @@ public class AssistantQuotationContext {
|
||||
var result=new ArrayList<Map<String,Object>>();
|
||||
for(String code:codes) {
|
||||
var ids=db.queryForList("select id from purchase_batch where batch_no=?",code);
|
||||
if(ids.size()!=1)continue;
|
||||
if(ids.size()!=1)throw new ServiceException("未找到指定采购批次"+code+",请核对编号后继续;不会匹配到其他批次");
|
||||
var sheet=sheets.load(((Number)ids.get(0).get("id")).longValue());
|
||||
// Validate the complete scope before exposing any of its rows to the model.
|
||||
for(var row:sheet.getRows())projects.requireProjectAccess(row.getProjectId());
|
||||
|
||||
@ -42,6 +42,7 @@ final class AssistantQuotationRows {
|
||||
}
|
||||
var allowed=new HashMap<String,Object>();
|
||||
for(var target:targets)if(target.get("id")!=null)allowed.put(target.get("id").toString(),target.get("id"));
|
||||
var batches=targets.stream().map(row->row.get("purchaseBatchId")).filter(Objects::nonNull).distinct().toList();
|
||||
var sourceKeys=new HashSet<String>();var sourceIndexes=new HashSet<Integer>();var output=new ArrayList<Map<String,Object>>();int unresolved=0;
|
||||
for(var original:source) {
|
||||
int n=index(original);String key=Objects.toString(original.get("sourceKey"),"");
|
||||
@ -55,8 +56,11 @@ final class AssistantQuotationRows {
|
||||
unresolved++;
|
||||
var reference=new LinkedHashMap<String,Object>();reference.put("name",original.get("sourceName"));
|
||||
if(original.get("sourceSpec")!=null&&!original.get("sourceSpec").toString().isBlank())reference.put("spec",original.get("sourceSpec"));
|
||||
result.put("id",reference);
|
||||
// A source-name lookup may auto-resolve only inside one server-verified batch.
|
||||
// Without that bound scope, keep the target empty for explicit selection, never search other batches.
|
||||
result.put("id",batches.size()==1?reference:null);
|
||||
}
|
||||
if(batches.size()==1)result.put("purchaseBatchId",batches.get(0));
|
||||
result.put("finalUnitPrice",original.get("finalUnitPrice"));result.put("attachmentId",original.get("attachmentId"));
|
||||
result.put("_sourceText","报价第"+n+"项:"+original.get("sourceName")+";规格:"+Objects.toString(original.get("sourceSpec"),"")+";品牌:"+Objects.toString(original.get("sourceBrand"),"")+";报价数量:"+Objects.toString(original.get("sourceQuantity"),"未识别")+";含税单价:"+Objects.toString(original.get("finalUnitPrice"),"待核对"));
|
||||
result.put("reason","依据供应商报价文件更正");output.add(result);
|
||||
@ -65,5 +69,5 @@ final class AssistantQuotationRows {
|
||||
"已完整保留报价文件的"+source.size()+"项,未执行改价。"+(unresolved>0?"其中"+unresolved+"项尚需核对匹配,请在确认表选择对应采购,或勾选本项暂不更正;不会遗漏或新增采购。":"请核对逐项报价与金额后确认。"));
|
||||
}
|
||||
private static int index(Map<String,Object> row){try{return new BigDecimal(Objects.toString(row.get("_sourceRow"),"")).intValueExact();}catch(Exception e){throw invalid();}}
|
||||
private static ServiceException invalid(){return new ServiceException("报价明细识别不完整或匹配时遗漏了原文件行,尚未生成可执行确认单,请重新识别或拆分报价文件");}
|
||||
private static ServiceException invalid(){return new ServiceException("报价原文的行号、名称或单价格式不完整,尚未生成确认单。请重新识别或核对文件清晰度;采购数据未修改");}
|
||||
}
|
||||
|
||||
@ -17,6 +17,14 @@ import static org.mockito.ArgumentMatchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
class AssistantModelRoutingTest {
|
||||
@Test void quotationSuggestionParserKeepsGoodPairsDespiteMissingExplanationExtraColumnsAndShortNullRows() {
|
||||
var output=Map.of("action","purchase.correctPrice","columns",List.of("sourceKey","id","reason"),"rows",List.of(
|
||||
List.of("q111111111111",7,"不应变成业务原因"),List.of("q222222222222"),List.of("forged-key",999),Map.of("sourceKey","q333333333333","id",8,"finalUnitPrice",999,"attachmentId","foreign")));
|
||||
var result=AssistantModelClient.parseQuotationMatchesResponse(body(output),"suggestion-parse");
|
||||
var rows=AssistantConversationService.maps(result.get("rows"));assertEquals(3,rows.size());assertEquals(7,rows.get(0).get("id"));
|
||||
assertFalse(rows.get(1).containsKey("id"));assertEquals(8,rows.get(2).get("id"));assertTrue(rows.stream().allMatch(row->Set.of("sourceKey","id").containsAll(row.keySet())));
|
||||
assertThrows(AssistantModelClient.ModelFailure.class,()->AssistantModelClient.parseQuotationMatchesResponse(body(Map.of("action","user.create","rows",List.of())),"wrong-action"));
|
||||
}
|
||||
@Test void conversationalPatchCannotAcknowledgeHistoricalCostRiskOnBehalfOfTheUser() {
|
||||
var proposal=Map.<String,Object>of("kind","patch","action","purchase.referencePrice","changes",Map.of("acknowledgeArchiveOnly",true));
|
||||
var reply=AssistantModelClient.guardDraftPatch(proposal,Map.of("action","purchase.referencePrice","rows",List.of(Map.of("purchaseBatchId",316))),"确定");
|
||||
@ -114,7 +122,7 @@ class AssistantModelRoutingTest {
|
||||
var definition=List.<Map<String,Object>>of(Map.of("key","purchase.correctPrice","allowed",true,"fields",List.of(Map.of("key","id"),Map.of("key","finalUnitPrice"),Map.of("key","reason"),Map.of("key","attachmentId"))));
|
||||
var result=client.propose(List.of(Map.of("role","user","content","根据PDF更新采购报价")),definition,Map.of(),Map.of(),List.of(Map.of("id","owned-pdf","name","报价.pdf","type","document")));
|
||||
assertEquals("draft",result.get("kind"));var rows=AssistantConversationService.maps(result.get("rows"));assertEquals(1,rows.size());
|
||||
assertEquals(12,rows.get(0).get("finalUnitPrice"));assertEquals(Map.of("name","水泵","spec","P100"),rows.get(0).get("id"));assertEquals(false,rows.get(0).get("skipCorrection"));
|
||||
assertEquals(12,rows.get(0).get("finalUnitPrice"));assertNull(rows.get(0).get("id"));assertEquals(false,rows.get(0).get("skipCorrection"));assertTrue(rows.get(0).get("_sourceText").toString().contains("水泵"));
|
||||
}
|
||||
@Test void bareWarehouseRequestsAskForConcreteBusinessDetailsWithoutModelGuessingOrWriting() {
|
||||
HttpClient http=mock(HttpClient.class);
|
||||
|
||||
@ -0,0 +1,35 @@
|
||||
package com.ruoyi.web.service.assistant;
|
||||
|
||||
import java.util.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.warehouse.domain.PurchaseSheet;
|
||||
import com.ruoyi.warehouse.service.impl.PurchaseSheetService;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
class AssistantQuotationContextTest {
|
||||
@Test void unknownExplicitBatchStopsBeforeAnyGlobalNameMatchingOrFileReading() {
|
||||
var context=new AssistantQuotationContext();var db=mock(JdbcTemplate.class);var sheets=mock(PurchaseSheetService.class);
|
||||
ReflectionTestUtils.setField(context,"db",db);ReflectionTestUtils.setField(context,"sheets",sheets);
|
||||
try(var security=mockStatic(SecurityUtils.class)) {
|
||||
security.when(SecurityUtils::isAdmin).thenReturn(true);
|
||||
assertTrue(assertThrows(ServiceException.class,()->context.targets(List.of(Map.of("role","user","content","CG2026109999 按PDF更新价格")))).getMessage().contains("不会匹配到其他批次"));
|
||||
verifyNoInteractions(sheets);
|
||||
}
|
||||
}
|
||||
@Test void latestExplicitBatchDoesNotSilentlyIncludeTheEarlierBatch() {
|
||||
var context=new AssistantQuotationContext();var db=mock(JdbcTemplate.class);var sheets=mock(PurchaseSheetService.class);
|
||||
ReflectionTestUtils.setField(context,"db",db);ReflectionTestUtils.setField(context,"sheets",sheets);
|
||||
when(db.queryForList(anyString(),any(Object[].class))).thenReturn(List.of(Map.of("id",316L)));
|
||||
var sheet=new PurchaseSheet();sheet.setRows(List.of());when(sheets.load(316L)).thenReturn(sheet);
|
||||
try(var security=mockStatic(SecurityUtils.class)) {
|
||||
security.when(SecurityUtils::isAdmin).thenReturn(true);
|
||||
assertTrue(context.targets(List.of(Map.of("role","user","content","CG2026100001"),Map.of("role","user","content","改为CG2026100002"))).isEmpty());
|
||||
verify(db).queryForList(anyString(),eq("CG2026100002"));verifyNoMoreInteractions(db);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,7 +4,8 @@ import java.nio.file.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.RepeatedTest;
|
||||
import org.junit.jupiter.api.RepetitionInfo;
|
||||
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
import com.ruoyi.projectdev.ProfileConfiguration;
|
||||
@ -14,7 +15,7 @@ import static org.mockito.Mockito.*;
|
||||
/** Opt-in real model/PDF regression. Frozen local fixtures only; no live database/session/execution. */
|
||||
@EnabledIfSystemProperty(named="assistantQuotationModelLive",matches="true")
|
||||
class AssistantQuotationModelLiveTest {
|
||||
@Test void originalMultiItemPdfWithFullCatalogProducesPriceCorrectionInsteadOfExcelImport() throws Exception {
|
||||
@RepeatedTest(3) void originalMultiItemPdfWithFullCatalogProducesPriceCorrectionInsteadOfExcelImport(RepetitionInfo repetition) throws Exception {
|
||||
Path root=Path.of(System.getProperty("quotationFixtureDirectory"));
|
||||
Path pdf=root.resolve("重庆鸥睿珂报价单和营业执照.pdf");byte[] original=Files.readAllBytes(pdf);
|
||||
var scope=JSON.parseObject(Files.readString(root.resolve("batch-scope.json"))).getJSONObject("cmvr-project-prod");
|
||||
@ -43,16 +44,20 @@ class AssistantQuotationModelLiveTest {
|
||||
List.of(Map.of("id","owned-original-pdf","name",pdf.getFileName().toString(),"type","document")));
|
||||
assertEquals("draft",proposal.get("kind"));assertEquals("purchase.correctPrice",proposal.get("action"));
|
||||
var rows=AssistantConversationService.maps(proposal.get("rows"));assertEquals(35,rows.size());
|
||||
Long[] expectedIds={852L,859L,860L,861L,862L,873L,874L,875L,876L,877L,878L,879L,880L,881L,882L,883L,884L,885L,886L,887L,888L,889L,892L,null,891L,890L,893L,850L,851L,854L,855L,856L,857L,858L,853L};
|
||||
var expected=JSON.parseObject(Files.readString(root.resolve("real-pdf-verification.json"))).getJSONArray("items");
|
||||
for(var row:rows) {
|
||||
int line=((Number)row.get("_sourceRow")).intValue();
|
||||
assertEquals(0,new BigDecimal(expected.getJSONObject(line-1).get("price").toString()).compareTo(new BigDecimal(row.get("finalUnitPrice").toString())),"PDF第"+line+"项价格");
|
||||
assertEquals(false,row.get("acknowledgeArchiveOnly"));assertEquals(316L,((Number)row.get("purchaseBatchId")).longValue());
|
||||
if(expectedIds[line-1]!=null)assertEquals(expectedIds[line-1].longValue(),((Number)row.get("id")).longValue(),"PDF第"+line+"项采购匹配");
|
||||
else assertTrue(row.get("id") instanceof Map,"未匹配的原报价必须保留待选择");
|
||||
}
|
||||
var ids=targets.stream().map(row->row.get("id").toString()).collect(java.util.stream.Collectors.toSet());
|
||||
long matched=rows.stream().filter(row->ids.contains(Objects.toString(row.get("id"),""))).count();assertEquals(34,matched);
|
||||
assertArrayEquals(original,Files.readAllBytes(pdf));verifyNoInteractions(db);
|
||||
Path output=root.getParent().resolve("quote-clear-pdf-live-result.json");
|
||||
assertEquals(34,rows.stream().filter(row->row.get("id") instanceof Number).map(row->row.get("id").toString()).distinct().count());
|
||||
Path output=root.getParent().resolve("quote-source-ledger-live-v2-result-"+repetition.getCurrentRepetition()+".json");
|
||||
Files.writeString(output,JSON.toJSONString(Map.of("action",proposal.get("action"),"pdfRows",rows.size(),"matched",matched,"allPricesMatchReviewedOriginal",true,"executed",false,"rows",rows)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,14 +8,14 @@ class AssistantQuotationRowsTest {
|
||||
private List<Map<String,Object>> source(){return List.of(Map.of("_sourceRow",1,"sourceName","水泵","sourceSpec","H06A","finalUnitPrice",221.2,"attachmentId","mine"),Map.of("_sourceRow",2,"sourceName","管道","sourceSpec","N8","finalUnitPrice",6.5,"attachmentId","mine"));}
|
||||
@Test void missingMatchRetainsOriginalRowAndMatchingCannotRewritePricesOrAttachment(){
|
||||
var keyed=AssistantQuotationRows.keyed(source());
|
||||
var value=AssistantQuotationRows.ground(proposal(List.of(Map.of("sourceKey",keyed.get(0).get("sourceKey"),"id",7,"finalUnitPrice",1,"attachmentId","someone-else"))),keyed,List.of(Map.of("id",7)));
|
||||
var value=AssistantQuotationRows.ground(proposal(List.of(Map.of("sourceKey",keyed.get(0).get("sourceKey"),"id",7,"finalUnitPrice",1,"attachmentId","someone-else"))),keyed,List.of(Map.of("id",7,"purchaseBatchId",316)));
|
||||
var rows=AssistantConversationService.maps(value.get("rows"));assertEquals(221.2,rows.get(0).get("finalUnitPrice"));assertEquals("mine",rows.get(1).get("attachmentId"));assertTrue(rows.get(0).get("_sourceText").toString().contains("H06A"));
|
||||
assertEquals(2,rows.size());assertEquals(7,rows.get(0).get("id"));assertEquals(Map.of("name","管道","spec","N8"),rows.get(1).get("id"));
|
||||
assertFalse(rows.get(1).containsKey("skipCorrection"));assertFalse(rows.get(0).containsKey("sourceKey"));
|
||||
}
|
||||
@Test void screenshot35Read34MatchedRetainsUnmatchedItem24WithoutShiftingLaterPrices() {
|
||||
var original=new ArrayList<Map<String,Object>>();var targets=new ArrayList<Map<String,Object>>();
|
||||
for(int i=1;i<=35;i++){original.add(Map.of("_sourceRow",i,"sourceName","报价物品"+i,"finalUnitPrice",i*10,"attachmentId","mine"));targets.add(Map.of("id",1000+i));}
|
||||
for(int i=1;i<=35;i++){original.add(Map.of("_sourceRow",i,"sourceName","报价物品"+i,"finalUnitPrice",i*10,"attachmentId","mine"));targets.add(Map.of("id",1000+i,"purchaseBatchId",316));}
|
||||
var keyed=AssistantQuotationRows.keyed(original);var suggestions=new ArrayList<Map<String,Object>>();
|
||||
for(int i=1;i<=35;i++)if(i!=24)suggestions.add(Map.of("sourceKey",keyed.get(i-1).get("sourceKey"),"id",1000+i,"_sourceRow",i>24?i-1:i));
|
||||
var rows=AssistantConversationService.maps(AssistantQuotationRows.ground(proposal(suggestions),keyed,targets).get("rows"));
|
||||
@ -26,15 +26,22 @@ class AssistantQuotationRowsTest {
|
||||
@Test void renumberedRowsWithoutSourceKeysNeverAttachTheirIdsToWrongPrices() {
|
||||
var keyed=AssistantQuotationRows.keyed(source());
|
||||
var rows=AssistantConversationService.maps(AssistantQuotationRows.ground(proposal(List.of(Map.of("_sourceRow",1,"id",7),Map.of("_sourceRow",2,"id",8))),keyed,List.of(Map.of("id",7),Map.of("id",8))).get("rows"));
|
||||
assertTrue(rows.stream().allMatch(row->row.get("id") instanceof Map));assertEquals(221.2,rows.get(0).get("finalUnitPrice"));
|
||||
assertTrue(rows.stream().allMatch(row->row.get("id")==null));assertEquals(221.2,rows.get(0).get("finalUnitPrice"));
|
||||
}
|
||||
@Test void duplicateOrUnknownKeysAndForeignIdsLeaveOnlyAffectedRowsForManualMatching() {
|
||||
var keyed=AssistantQuotationRows.keyed(source());var first=keyed.get(0).get("sourceKey");var second=keyed.get(1).get("sourceKey");
|
||||
var suggestions=List.of(Map.<String,Object>of("sourceKey",first,"id",7),Map.<String,Object>of("sourceKey",first,"id",8),Map.<String,Object>of("sourceKey",second,"id",999),Map.<String,Object>of("sourceKey","forged-key","id",8));
|
||||
var rows=AssistantConversationService.maps(AssistantQuotationRows.ground(proposal(suggestions),keyed,List.of(Map.of("id",7),Map.of("id",8))).get("rows"));
|
||||
assertEquals(2,rows.size());assertTrue(rows.stream().allMatch(row->row.get("id") instanceof Map));
|
||||
assertEquals(2,rows.size());assertTrue(rows.stream().allMatch(row->row.get("id")==null));
|
||||
rows=AssistantConversationService.maps(AssistantQuotationRows.ground(Map.of("rows",List.of()),keyed,List.of()).get("rows"));assertEquals(2,rows.size());
|
||||
}
|
||||
@Test void unresolvedNameCannotAutomaticallyMatchRecordsOutsideTheExplicitBatchScope() {
|
||||
var keyed=AssistantQuotationRows.keyed(source());
|
||||
var noScope=AssistantConversationService.maps(AssistantQuotationRows.ground(Map.of("rows",List.of()),keyed,List.of()).get("rows"));
|
||||
assertTrue(noScope.stream().allMatch(row->row.get("id")==null));
|
||||
var multiple=List.<Map<String,Object>>of(Map.of("id",7,"purchaseBatchId",316),Map.of("id",8,"purchaseBatchId",317));
|
||||
assertTrue(AssistantConversationService.maps(AssistantQuotationRows.ground(Map.of("rows",List.of()),keyed,multiple).get("rows")).stream().allMatch(row->row.get("id")==null));
|
||||
}
|
||||
@Test void duplicateOrMissingSourceIndexesCannotBecomeAConfirmableQuotation(){
|
||||
assertThrows(ServiceException.class,()->AssistantQuotationRows.literal(proposal(List.of(source().get(0),source().get(0)))));
|
||||
assertThrows(ServiceException.class,()->AssistantQuotationRows.literal(proposal(List.of(source().get(1)))));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user