dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dto/UserLoginDTO.java
@@ -36,6 +36,10 @@ * 用户单位 */ private String unit; /** * 用户单位类型 */ private int unitType; /** * 用户部门 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtAccountService.java
@@ -262,7 +262,8 @@ CtUnit ctUnit = ctUnitService.getById(ctUser.getUnitId()); if (ObjectUtils.isNotEmpty(ctUnit)) { if (ctUnit.getUnitGrade() == UserBaseConsts.UNIT_GRADE_3 && ctUnit.getUnitType() == UserBaseConsts.UNIT_TYPE_102) { userLoginDTO.setUnit(ctUnit.getUnitDes()); userLoginDTO.setUnit(ctUnit.getUnitName()); userLoginDTO.setUnitType(ctUnit.getUnitType()); // CtUnit parentCtUnit = ctUnitService.getById(ctUnit.getParentId()); // if (ObjectUtils.isNotEmpty(parentCtUnit)) {1 // userLoginDTO.setUnit(parentCtUnit.getUnitName()); @@ -271,6 +272,7 @@ // } } else { userLoginDTO.setUnit(ctUnit.getUnitName()); userLoginDTO.setUnitType(ctUnit.getUnitType()); } } else { userLoginDTO.setUnit(ctUser.getUnitName()); @@ -578,6 +580,7 @@ log.info("xsdctUnit:{}", ctUnit); ctUnitService.saveCtUnit(ctUnit); userLoginDTO.setUnit(ctUnit.getUnitName()); userLoginDTO.setUnitType(ctUnit.getUnitType()); ctUser.setUnitName(ctUnit.getUnitName()); ctUser.setUnitId(ctUnit.getId()); ctUserService.updateCtUser(ctUser); @@ -639,6 +642,10 @@ userLoginDTO.setUserId(ctUser.getId()); userLoginDTO.setTrueName(ctUser.getTrueName()); userLoginDTO.setUnit(ctUser.getUnitName()); CtUnit byId = ctUnitService.getById(ctUser.getUnitId()); if (byId != null) { userLoginDTO.setUnitType(byId.getUnitType()); } userLoginDTO.setDept(ctUser.getDeptName()); userLoginDTO.setPhone(ctUser.getMobile()); userLoginDTO.setCustId(ctUser.getCustId()); dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/controller/web/CaseInfoWebController.java
@@ -179,6 +179,12 @@ terms.put("systemSource", systemSource); } //市民编码 String cityCode = request.getParameter("cityCode"); if (StringUtils.isNotBlank(cityCode)) { terms.put("cityCode", cityCode); } String peopleNum = request.getParameter("peopleNum"); if (StringUtils.isNotBlank(peopleNum)) { String[] split = peopleNum.split("-"); @@ -1368,10 +1374,11 @@ /** * 查询重复事项 * @url {ctx}/api/web/caseInfo/listRepeatCase * * @param caseId 案件编号 * @param userId 登录用户 * @return Object * @url {ctx}/api/web/caseInfo/listRepeatCase */ @GetMapping("/listRepeatCase") public Object listRepeatCase( @RequestParam(value = "caseId") String caseId, @CurrentUser String userId) { @@ -1384,8 +1391,8 @@ } /** * * 协同推送-网格推送案件入库 * * @param registerSaveDTO 实体对象 * @url {ctx}/api/web/caseInfo/gridCaseRegister */ @@ -1398,4 +1405,9 @@ return ReturnFailUtils.getRepInfo(e.getMessage()); } } @GetMapping("/getCaseNo") public R<String> getCaseNo(@CurrentUser String userId) { return service.createCaseNo(userId); } } dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml
@@ -139,7 +139,10 @@ <!-- 表 --> <sql id='table-name'>dyh_case_info</sql> <sql id="column-part-all"> a.id, a . id , a.status, a.status_name, a.canal, @@ -187,7 +190,8 @@ </sql> <!-- 字段 --> <sql id="column-part"> id, id , case_title, case_ref, case_level, @@ -392,7 +396,8 @@ </if> <if test="terms.caseTypeFirstList != null and terms.caseTypeFirstList.size > 0"> and a.case_type_first in <foreach collection="terms.caseTypeFirstList" item="caseTypeFirst" index="index" open="(" separator="," close=")"> <foreach collection="terms.caseTypeFirstList" item="caseTypeFirst" index="index" open="(" separator="," close=")"> #{caseTypeFirst} </foreach> </if> @@ -415,7 +420,8 @@ and (b.belong_unit_id is not null and c.city = #{terms.queCity} <if test="terms.unitGrades != null and terms.unitGrades.size > 0"> and c.unit_grade in <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator="," close=")"> <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator="," close=")"> #{unitGrade} </foreach> </if> @@ -430,7 +436,8 @@ close=")"> #{unitGrade} </foreach> </if>) </if> ) or (b.belong_unit_id is null and a.que_city = #{terms.queCity}) ) </if> @@ -438,7 +445,8 @@ and (b.belong_unit_id is not null and c.area = #{terms.queArea} <if test="terms.unitGrades != null and terms.unitGrades.size > 0"> and c.unit_grade in <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator="," close=")"> <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator="," close=")"> #{unitGrade} </foreach> </if> @@ -448,7 +456,8 @@ and ((b.belong_unit_id is not null and c.area = #{terms.queArea} <if test="terms.unitGrades != null and terms.unitGrades.size > 0"> and c.unit_grade in <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator="," close=")"> <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator="," close=")"> #{unitGrade} </foreach> </if> @@ -461,7 +470,8 @@ and (b.belong_unit_id is not null and c.road = #{terms.queRoad} <if test="terms.unitGrades != null and terms.unitGrades.size > 0"> and c.unit_grade in <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator="," close=")"> <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator="," close=")"> #{unitGrade} </foreach> </if> @@ -472,7 +482,8 @@ and ((b.belong_unit_id is not null and c.road = #{terms.queRoad} <if test="terms.unitGrades != null and terms.unitGrades.size > 0"> and c.unit_grade in <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator="," close=")"> <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator="," close=")"> #{unitGrade} </foreach> </if> @@ -483,7 +494,8 @@ and (b.belong_unit_id is not null and c.village = #{terms.queVillage} <if test="terms.unitGrades != null and terms.unitGrades.size > 0"> and c.unit_grade in <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator="," close=")"> <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator="," close=")"> #{unitGrade} </foreach> </if> @@ -576,6 +588,9 @@ <if test="terms.fileStart != null and terms.fileStart !='' and terms.fileEnd != null and terms.fileEnd !=''"> and (DATE_FORMAT(b.file_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{terms.fileStart} and DATE_FORMAT(b.file_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{terms.fileEnd}) </if> <if test="terms.cityCode != null and terms.cityCode !=''"> and e.citizen_event_code = #{terms.cityCode} </if> </where> </if> @@ -962,7 +977,8 @@ <select id="pageTermsCaseRegister" resultType="cn.huge.module.cases.domain.dto.CaseRegisterDTO"> SELECT t1.id as caseId,t1.create_time as createTime,t1.input_user_name as inputUserName,t1.status_name as statusName,t1.case_level as t1.id as caseId,t1.create_time as createTime,t1.input_user_name as inputUserName,t1.status_name as statusName,t1.case_level as caseLevel,t1.canal_name as canalName, t1.case_type_first_name as caseTypeFirstName,t1.case_type_name as caseTypeName,t1.plaintiffs as plaintiffs,t1.defendants as defendants,t2.medi_result_name as mediResultName, @@ -1001,6 +1017,9 @@ from dyh_case_info a LEFT JOIN dyh_case_info_unfold b on a.id = b.id LEFT JOIN dyh_ct_unit c ON b.belong_unit_id = c.id <if test="terms.cityCode != null and terms.cityCode !=''"> left join dyh_th_grid_citizen_event e on e.case_id = a.id </if> <include refid="where-part-all"/> </select> @@ -1012,6 +1031,9 @@ dyh_case_info a LEFT JOIN dyh_case_info_unfold b on a.id = b.id LEFT JOIN dyh_ct_unit c ON b.belong_unit_id = c.id left join (select id ,case_id from dyh_case_task group by case_id) d on a.id = d.case_id <if test="terms.cityCode != null and terms.cityCode !=''"> left join dyh_th_grid_citizen_event e on e.case_id = a.id </if> <include refid="where-part-all"/> <if test="page.sort != null"> <foreach collection="page.sort" item="s" index="index" separator="," open="order by "> @@ -1066,16 +1088,20 @@ <select id="statisticsArea" resultType="cn.huge.module.cases.domain.dto.CaseStatisticsAreaDTO"> SELECT <if test='terms.areaType == null or terms.areaType =="1"'> IF(c.city is null,a.que_city,c.city) as areaCode,IF(c.city_name is null,a.que_city_name,c.city_name) as areaName, IF(c.city is null,a.que_city,c.city) as areaCode,IF(c.city_name is null,a.que_city_name,c.city_name) as areaName, </if> <if test='terms.areaType != null and terms.areaType =="2"'> IF(c.area is null,a.que_area,c.area) as areaCode,IF(c.area_name is null,a.que_area_name,c.area_name) as areaName, IF(c.area is null,a.que_area,c.area) as areaCode,IF(c.area_name is null,a.que_area_name,c.area_name) as areaName, </if> <if test='terms.areaType != null and terms.areaType =="3"'> IF(c.road is null,a.que_road,c.road) as areaCode,IF(c.road_name is null,a.que_road_name,c.road_name) as areaName, IF(c.road is null,a.que_road,c.road) as areaCode,IF(c.road_name is null,a.que_road_name,c.road_name) as areaName, </if> <if test='terms.areaType != null and terms.areaType =="4"'> IF(c.village is null,a.que_village,c.village) as areaCode,IF(c.village_name is null,a.que_village_name,c.village_name) as areaName, IF(c.village is null,a.que_village,c.village) as areaCode,IF(c.village_name is null,a.que_village_name,c.village_name) as areaName, </if> c.unit_grade as unitGrade, count(1) as caseNum, @@ -1278,14 +1304,20 @@ <if test='terms.areaType != null and terms.areaType =="4"'> ifnull(t2.village_name, '本级') as areaName,ifnull(t2.village, '1') as areaCode, </if> count(distinct case when (t1.node_id = 'DSRPJ' or t1.node_id = 'JAGD' or t1.node_id = 'ZJ_DFP' or t1.node_id = 'QJ_DFP' or t1.node_id = 'SJ_DFP' or t1.node_id = 'DFP' or t1.node_id = 'ZJ_DSL' or t1.node_id = 'QJ_DSL' or t1.node_id = 'SJ_DSL' or t1.node_id = 'DSL' or t1.node_id = 'QJ_SBSH' or t1.node_id = 'SJ_SBSH' or t1.node_id = 'HTSH' or t1.node_id = 'ZJ_HTSH' count(distinct case when (t1.node_id = 'DSRPJ' or t1.node_id = 'JAGD' or t1.node_id = 'ZJ_DFP' or t1.node_id = 'QJ_DFP' or t1.node_id = 'SJ_DFP' or t1.node_id = 'DFP' or t1.node_id = 'ZJ_DSL' or t1.node_id = 'QJ_DSL' or t1.node_id = 'SJ_DSL' or t1.node_id = 'DSL' or t1.node_id = 'QJ_SBSH' or t1.node_id = 'SJ_SBSH' or t1.node_id = 'HTSH' or t1.node_id = 'ZJ_HTSH' or t1.node_id = 'QJ_HTSH' or t1.node_id = 'SJ_HTSH')then t1.id end) as flowAllNum, count(distinct case when (t1.node_id = 'ZJ_DFP' or t1.node_id = 'QJ_DFP' or t1.node_id = 'SJ_DFP' or t1.node_id = 'DFP') then t1.id end) as flowJbNum, count(distinct case when (t1.node_id = 'ZJ_DSL' or t1.node_id = 'QJ_DSL' or t1.node_id = 'SJ_DSL' or t1.node_id = 'DSL') then t1.id end) as flowSlNum, count(distinct case when (t1.node_id = 'ZJ_DFP' or t1.node_id = 'QJ_DFP' or t1.node_id = 'SJ_DFP' or t1.node_id = 'DFP') then t1.id end) as flowJbNum, count(distinct case when (t1.node_id = 'ZJ_DSL' or t1.node_id = 'QJ_DSL' or t1.node_id = 'SJ_DSL' or t1.node_id = 'DSL') then t1.id end) as flowSlNum, count(distinct case when (t1.node_id = 'QJ_SBSH' or t1.node_id = 'SJ_SBSH') then t1.id end) as flowSbNum, count(distinct case when (t1.node_id = 'HTSH' or t1.node_id = 'ZJ_HTSH' or t1.node_id = 'QJ_HTSH' or t1.node_id = 'SJ_HTSH') then t1.id end) as flowHtNum, count(distinct case when (t1.node_id = 'HTSH' or t1.node_id = 'ZJ_HTSH' or t1.node_id = 'QJ_HTSH' or t1.node_id = 'SJ_HTSH') then t1.id end) as flowHtNum, count(distinct case when (t1.node_id = 'DSRPJ' or t1.node_id = 'JAGD') then t1.id end) as flowBjNum from (SELECT case_id, node_id, handle_time, create_time, cande_unit_id, id, status @@ -1296,9 +1328,11 @@ where status = 2 or (status = 1 and (node_id = 'DSRPJ' or node_id = 'JAGD')) ) s WHERE rn = 1 AND ((DATE_FORMAT(s.handle_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.startDate} and DATE_FORMAT(s.handle_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.endDate}) OR DATE_FORMAT(s.create_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.startDate} and DATE_FORMAT(s.handle_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.endDate}) OR DATE_FORMAT(s.create_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.startDate} and DATE_FORMAT(s.create_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.endDate}) group by s.case_id) t1 left join dyh_ct_unit t2 on (t1.cande_unit_id = t2.id) or (t1.cande_unit_id is null and t2.id = (select mediate_unit_id from dyh_case_info_unfold where id = t1.case_id)) left join dyh_ct_unit t2 on (t1.cande_unit_id = t2.id) or (t1.cande_unit_id is null and t2.id = (select mediate_unit_id from dyh_case_info_unfold where id = t1.case_id)) <where> <if test="terms.queCity != null and terms.queCity !=''"> and t2.city = #{terms.queCity} @@ -1362,7 +1396,8 @@ </if> count(distinct case when t2.info_process = 1 or t2.info_process = 2 then t2.id end) as sourceHjzNum, count(distinct case when t2.info_process = 3 and t3.medi_result = '22_00025-1' then t2.id end) as sourceHjcgNum, count(distinct case when t2.info_process = 3 and t3.medi_result = '22_00025-2' then t2.id end) as sourceHjbcgNum, count(distinct case when t2.info_process = 3 and t3.medi_result = '22_00025-2' then t2.id end) as sourceHjbcgNum, count(distinct case when t2.info_process = 4 then t2.id end) as sourceByslNum from (SELECT case_id, node_id, create_time, cande_unit_id, id, status,handle_result FROM ( @@ -1370,7 +1405,8 @@ ROW_NUMBER() OVER (PARTITION BY case_id ORDER BY node_type desc, create_time DESC) AS rn FROM dyh_case_task where node_id != 'DSRPJ' and delete_status = 0 ) s WHERE rn = 1 group by s.case_id)t1 left join dyh_case_info t2 on t2.id = t1.case_id left join dyh_case_info_unfold t3 on t2.id = t3.id WHERE rn = 1 group by s.case_id)t1 left join dyh_case_info t2 on t2.id = t1.case_id left join dyh_case_info_unfold t3 on t2.id = t3.id left join dyh_ct_unit t4 on t3.belong_unit_id = t4.id <where> and t2.delete_status = 0 and t4.delete_status = 0 @@ -1453,7 +1489,10 @@ </select> <update id="deleteCaseById"> update dyh_case_info set delete_status = 1,update_time = #{updateTime} where id = #{id} update dyh_case_info set delete_status = 1, update_time = #{updateTime} where id = #{id} </update> <!-- 统计指定canal值下按canal_second分组的案件数量 --> dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/dto/CaseInfoDTO.java
@@ -61,5 +61,7 @@ */ private String tcqk; private String cityCode; } dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseInfoService.java
@@ -1,5 +1,6 @@ package cn.huge.module.cases.service; import cn.huge.base.common.bo.R; import cn.huge.base.common.exception.ServiceException; import cn.huge.base.common.utils.*; import cn.huge.module.casebook.consts.ByCaseTypeEnum; @@ -119,6 +120,8 @@ private CaseWindupApplyService caseWindupApplyService; @Autowired private CasePersonService casePersonService; @Autowired private ThGridCitizenEventService thGridCitizenEventService; /** @@ -317,7 +320,7 @@ generateQrCodeRequestVo.setGridCode(area); caseInfo.setCaseRef(sysClient.getCaseRefByGenerateQrCode(generateQrCodeRequestVo)); // 获取调解案号 caseInfo.setCaseNo(utilsClient.createCaseNo(ctUnitDTO.getArea())); // caseInfo.setCaseNo(utilsClient.createCaseNo(ctUnitDTO.getArea())); caseInfo.setVisitWay(CaseBaseConstsEnum.getVisitWayByCanal(caseInfo.getCanal()).getIndex()); caseInfo.setVisitWayName(CaseBaseConstsEnum.getVisitWayByCanal(caseInfo.getCanal()).getDes()); if (caseInfo.getCanal().equals(CaseBaseConstsEnum.CASE_CANAL_3.getIndex())) { @@ -607,6 +610,10 @@ caseInfoDTO.setIsRisk(caseInfoUnfold.getIsRisk()); caseInfoDTO.setTcqk(caseInfoUnfold.getTcqk()); } ThGridCitizenEvent thGridCitizenEvent = thGridCitizenEventService.getByCaseId(caseId); if (thGridCitizenEvent != null) { caseInfoDTO.setCityCode(thGridCitizenEvent.getCitizenEventCode()); } } else { CasebookInfo casebookInfo = casebookInfoService.getById(caseId); if (ObjectUtils.isNotEmpty(casebookInfo)) { @@ -824,7 +831,7 @@ generateQrCodeRequestVo.setGridCode(area); caseInfo.setCaseRef(sysClient.getCaseRefByGenerateQrCode(generateQrCodeRequestVo)); // 生产调解案号 caseInfo.setCaseNo(utilsClient.createCaseNo(caseInfo.getQueArea())); // caseInfo.setCaseNo(utilsClient.createCaseNo(caseInfo.getQueArea())); log.info("xsdcaseInfo:{}", caseInfo); caseInfoUnfold.setId(caseInfo.getId()); caseInfoUnfold.setCreateTime(nowDate); @@ -2695,7 +2702,7 @@ } // 获取调解案号 caseInfo.setCaseNo(utilsClient.createCaseNo(ctUnitDTO.getArea())); // caseInfo.setCaseNo(utilsClient.createCaseNo(ctUnitDTO.getArea())); caseInfo.setVisitWay(CaseBaseConstsEnum.VISIT_WAY_4.getIndex()); caseInfo.setVisitWayName(CaseBaseConstsEnum.VISIT_WAY_4.getDes()); if (StringUtils.isEmpty(caseInfo.getCanal())) { @@ -2770,4 +2777,9 @@ .insert(5, "-") .toString(); } public R<String> createCaseNo(String userId) { CtUnitDTO unitByUserId = custClient.getUnitByUserId(userId); return R.ok(utilsClient.createCaseNo(unitByUserId.getArea())); } } dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/ThGridCitizenEventService.java
@@ -1,6 +1,8 @@ package cn.huge.module.cases.service; import cn.huge.module.cases.domain.dto.CaseAndEventInfoDTO; import cn.huge.module.cases.domain.po.ThGridCitizenEvent; import org.apache.ibatis.annotations.Param; /** * @title: 市民工单事件表服务接口 @@ -18,4 +20,6 @@ * @return 整合后的案件和工单信息 */ CaseAndEventInfoDTO integrateCaseAndEventInfo(String caseId); ThGridCitizenEvent getByCaseId(String caseId); } dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/impl/ThGridCitizenEventServiceImpl.java
@@ -63,4 +63,9 @@ return dto; } @Override public ThGridCitizenEvent getByCaseId(String caseId) { return thGridCitizenEventMapper.getByCaseId(caseId); } } dyh-service/dyh-sys/src/main/java/cn/huge/module/ai/AiChatController.java
New file @@ -0,0 +1,109 @@ package cn.huge.module.ai; import cn.huge.base.common.bo.R; import cn.huge.base.common.utils.HttpClientUtils; import cn.huge.base.common.utils.ReturnFailUtils; import cn.huge.base.common.utils.ReturnSucUtils; import cn.huge.module.ai.domain.AiBodyDto; import cn.huge.module.ai.domain.AiRequestVo; import cn.huge.module.sy.domain.po.SyTimeLimit; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.net.http.HttpClient; import java.util.HashMap; import java.util.Map; @RestController @RequestMapping("/api/web/ai/chat") @Slf4j public class AiChatController { private String url = "http://10.202.1.102:9002/"; @PostMapping("/risk") public R<String> risk(@RequestBody AiRequestVo aiRequestVo) { String postUrl = url + "v1/workflows/run"; initHead("Bearer app-8ylvZOHf2fOgTGfe28MYtHDD"); String s = ""; try { s = HttpClientUtils.httpPostRaw(postUrl, JSON.toJSONString(aiRequestVo), initHead("Bearer app-8ylvZOHf2fOgTGfe28MYtHDD"), "utf-8"); } catch (Exception e) { throw new RuntimeException(e); } JSONObject object = JSONObject.parseObject(s); if (object != null) { JSONObject data = object.getJSONObject("data"); if (data != null) { JSONObject outputs = data.getJSONObject("outputs"); if (outputs != null) { JSONObject body = outputs.getJSONObject("body"); if (body != null) { return R.ok(body.getJSONObject("data").getString("is_risk_ai")); } } } } log.info("xsd:{}", object); return R.ok("0"); } @PostMapping("/chat") public R<AiBodyDto> chat(@RequestBody AiRequestVo aiRequestVo) { String postUrl = url + "v1/chat-messages"; String s = ""; AiBodyDto aiBodyDto = new AiBodyDto(); try { s = HttpClientUtils.httpPostRaw(postUrl, JSON.toJSONString(aiRequestVo), initHead("Bearer app-8naZjGyj8a129EuUP2Jb6n7T"), "utf-8"); } catch (Exception e) { throw new RuntimeException(e); } JSONObject object = JSONObject.parseObject(s); if (object != null) { String conversation_id = object.getString("conversation_id"); String answer = object.getString("answer"); aiBodyDto.setAnswer(answer); aiBodyDto.setConversationId(conversation_id); } log.info("xsd:{}", aiBodyDto); return R.ok(aiBodyDto); } @PostMapping("/strategy") public R<AiBodyDto> strategy(@RequestBody AiRequestVo aiRequestVo) { String postUrl = url + "v1/workflows/run"; String s = ""; AiBodyDto aiBodyDto = new AiBodyDto(); try { s = HttpClientUtils.httpPostRaw(postUrl, JSON.toJSONString(aiRequestVo), initHead("Bearer app-WMriHFsAozx0FECkopW2Z6X1"), "utf-8"); } catch (Exception e) { throw new RuntimeException(e); } JSONObject object = JSONObject.parseObject(s); if (object != null) { JSONObject data = object.getJSONObject("data"); if (data != null) { JSONObject outputs = data.getJSONObject("outputs"); if (outputs != null) { String text = outputs.getString("text"); aiBodyDto.setAnswer(text); } } } log.info("xsd:{}", aiBodyDto); return R.ok(aiBodyDto); } private Map<String, String> initHead(String token) { Map<String, String> head = new HashMap<>(); head.put("Content-Type", "application/json"); head.put("Authorization", token); return head; } } dyh-service/dyh-sys/src/main/java/cn/huge/module/ai/domain/AiBodyDto.java
New file @@ -0,0 +1,10 @@ package cn.huge.module.ai.domain; import lombok.Data; @Data public class AiBodyDto { private String response_mode; private String conversationId; private String answer; } dyh-service/dyh-sys/src/main/java/cn/huge/module/ai/domain/AiRequestVo.java
New file @@ -0,0 +1,17 @@ package cn.huge.module.ai.domain; import lombok.Data; @Data public class AiRequestVo { private Inputs inputs; private String response_mode; private String user; private String query; private String conversation_id; @Data public static class Inputs{ private String caseId; private String caseText; } }