Merge branch 'dev' into uat

This commit is contained in:
lxu75
2025-03-10 18:54:24 +08:00
2 changed files with 16 additions and 43 deletions

View File

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.volvo.ai.analytic.center.dto.req.CallItem; import com.volvo.ai.analytic.center.dto.req.CallItem;
import com.volvo.ai.analytic.center.dto.req.DiFyReq; import com.volvo.ai.analytic.center.dto.req.DiFyReq;
import com.volvo.ai.analytic.center.dto.req.DiffDefeatanAlysis; import com.volvo.ai.analytic.center.dto.req.DiffDefeatanAlysis;
import com.volvo.ai.analytic.center.dto.req.DifyImageWorkFlow;
import com.volvo.ai.analytic.center.dto.resp.DiffDefeatAnalyseOutputResult; import com.volvo.ai.analytic.center.dto.resp.DiffDefeatAnalyseOutputResult;
import com.volvo.ai.analytic.center.feign.DiFyFeign; import com.volvo.ai.analytic.center.feign.DiFyFeign;
import com.volvo.ai.analytic.center.service.DiFyService; import com.volvo.ai.analytic.center.service.DiFyService;
@@ -45,53 +46,25 @@ public class TestController {
@Autowired @Autowired
private RocketMQTemplate rocketMQTemplate; private RocketMQTemplate rocketMQTemplate;
/* @PostMapping("/runWorkflows")
@PostMapping("/runWorkflows2")
@ApiOperation(value = "测试Dify") @ApiOperation(value = "测试Dify")
public ResultMsg<Object> runWorkflows2(@RequestBody String contentStr) { public ResultMsg<Object> runWorkflows2(@RequestBody String contentStr) {
//"1语音电话2024-11-09 12:10:57客服姚先生你好打扰到您了蹦蹦沃沃赛练呢。客户喂你好。客服对对小明那个昨天看了车不要着急走今天可有时间到店来接待您试驾感受一下呢。客户我现在已经开工了我现在没时间过去啊。客服好的那等你忙完这段时间好吧。客户好的好的好的好再见啊。客服那这边先不打扰您再见。"; //"1语音电话2024-11-09 12:10:57客服姚先生你好打扰到您了蹦蹦沃沃赛练呢。客户喂你好。客服对对小明那个昨天看了车不要着急走今天可有时间到店来接待您试驾感受一下呢。客户我现在已经开工了我现在没时间过去啊。客服好的那等你忙完这段时间好吧。客户好的好的好的好再见啊。客服那这边先不打扰您再见。";
Map<String, Object> record = new HashMap<>(); //构建图片分析请求对象
record.put("record",contentStr); DifyImageWorkFlow diFyImageWorkFlow = new DifyImageWorkFlow();
log.info("contentStr {}", contentStr); diFyImageWorkFlow.setImageUrl("https://newbie-assets.digitalvolvo.com/images/2025/02/21/174011708518185205a49d2aead89b9aa8918c72fe5c08dcc66777df1f9df95535d991fbc8533.1740117074777.386.png");
DiFyReq diFyReq = new DiFyReq();
diFyReq.setUser(user); DiFyReq diFyImageReq = new DiFyReq();
diFyReq.setFlowId(flowId); diFyImageReq.setUser("admin");
diFyReq.setInputs(record); diFyImageReq.setFlowId("app-ZcRTduhbcyu9qzXs2GAnXo0v");
Object difyResult = diFyService.getDiFyObject(diFyReq); JSONObject imageInputs = new JSONObject();
imageInputs.put("image", JSON.toJSONString(diFyImageWorkFlow));
diFyImageReq.setInputs(imageInputs.toJSONString());
Object difyResult = diFyService.getDiFyObject(diFyImageReq);
JSONObject dify = JSONObject.parseObject(difyResult.toString()); JSONObject dify = JSONObject.parseObject(difyResult.toString());
String resultStr = dify.getString("result").replace("\n", "").replaceAll(" ", ""); return ResultMsg.ok(dify);
return ResultMsg.ok(resultStr);
} }
@PostMapping("/runWorkflows3")
@ApiOperation(value = "测试Dify")
public ResultMsg<Object> runWorkflows3(@RequestBody String contentStr) {
//[{"sessionId":"1","sourceId":"1","audioTime":"2024-11-09 12:10:57","audioBillsec":"10"},{"sessionId":"2","sourceId":"2","audioTime":"2024-11-09 12:11:57","audioBillsec":"20"}]
log.info("contentStr {}", contentStr);
List<CallItem> callList = JSON.parseArray(contentStr, CallItem.class);
DiffDefeatanAlysis input = new DiffDefeatanAlysis();
input.setCallList(callList);
DiffDefeatAnalyseOutputResult diffDefeatAnalyseOutputResult = mqMessageRecordService.processChatRecord(input);
return ResultMsg.ok(diffDefeatAnalyseOutputResult);
}
@PostMapping("/runWorkflows4")
@ApiOperation(value = "测试Dify")
public ResultMsg<Object> runWorkflows4(@RequestBody String contentStr) {
//{"formId": "123456789","sinceType": 2,"subSinceType": 51,"data": {"businessId": "123456789","vdqwUserId": "123","vdqwCustomerId": "uuid","defeatTime": "2024-10-27 08:09:09","callList": [{"sessionId": "123456789","sourceId": "123456789","audioTime": "2024-10-27 08:09:09","audioBillsec": 1800}, {"sessionId": "123456789","sourceId": "123456789","audioTime": "2024-10-27 08:09:09","audioBillsec": 1800}]} }
//{"formId": "123456789","sinceType": 2,"subSinceType": 52,"data": {"businessId": "123456789", "approveCode": "10001", "approveResult": "审批通过", "approveOpinion": "" } }
log.info("contentStr {}", contentStr);
boolean result = mqMessageRecordService.processMessageByMQ(contentStr);
return ResultMsg.ok(result);
}*/
@PostMapping("/runWorkflows5")
@ApiOperation(value = "补偿处理消息")
public ResultMsg<Object> runWorkflows5() {
mqMessageRecordService.processMessageByTask();
return ResultMsg.ok("");
}
@PostMapping("/mockMq") @PostMapping("/mockMq")

View File

@@ -110,8 +110,8 @@ public class MqMessageRecordServiceImpl extends ServiceImpl<MqMessageRecordMappe
diFyImageReq.setUser(user); diFyImageReq.setUser(user);
diFyImageReq.setFlowId(imageFlowId); diFyImageReq.setFlowId(imageFlowId);
JSONObject imageInputs = new JSONObject(); JSONObject imageInputs = new JSONObject();
imageInputs.put("image", diFyImageWorkFlow); imageInputs.put("image", JSON.toJSONString(diFyImageWorkFlow));
diFyImageReq.setInputs(imageInputs); diFyImageReq.setInputs(imageInputs.toJSONString());
//调用dify图片分析workflow //调用dify图片分析workflow
JSONObject difImageResult = (JSONObject) diFyService.getDiFyObject(diFyImageReq); JSONObject difImageResult = (JSONObject) diFyService.getDiFyObject(diFyImageReq);