Commit a5d54a22 authored by sunsongtao's avatar sunsongtao

11

parent c54de2f1
...@@ -49,10 +49,11 @@ public class ApiChatNewController { ...@@ -49,10 +49,11 @@ public class ApiChatNewController {
@Resource @Resource
private IMallMemberUserService mallMemberUserService; private IMallMemberUserService mallMemberUserService;
@Value("${baidu.appKey}")
private String appKey;
@Value("${baidu.appId}") @Value("${baidu.appId}")
private String appId; private String APP_ID;
@Value("${baidu.appKey}")
private String APP_KEY;
// 读取超时为60s // 读取超时为60s
private static final long READ_TIMEOUT = 60000; private static final long READ_TIMEOUT = 60000;
...@@ -76,6 +77,7 @@ public class ApiChatNewController { ...@@ -76,6 +77,7 @@ public class ApiChatNewController {
private static final ObjectMapper objectMapper = new ObjectMapper(); private static final ObjectMapper objectMapper = new ObjectMapper();
// 本次对话ID // 本次对话ID
private String conversation_id; private String conversation_id;
...@@ -262,14 +264,14 @@ public class ApiChatNewController { ...@@ -262,14 +264,14 @@ public class ApiChatNewController {
logger.info("提问千帆App:" + question); logger.info("提问千帆App:" + question);
MediaType mediaType = MediaType.parse("application/json"); MediaType mediaType = MediaType.parse("application/json");
// 消息体 // 消息体
String json = objectMapper.writeValueAsString(new BaiduAppRequest(appId, question, conversation_id)); String json = objectMapper.writeValueAsString(new BaiduAppRequest(APP_ID, question, conversation_id));
RequestBody body = RequestBody.create(mediaType, json); RequestBody body = RequestBody.create(mediaType, json);
// 请求 // 请求
Request request = new Request.Builder() Request request = new Request.Builder()
.url("https://qianfan.baidubce.com/v2/app/conversation/runs") .url("https://qianfan.baidubce.com/v2/app/conversation/runs")
.method("POST", body) .method("POST", body)
.addHeader("Content-Type", "application/json") .addHeader("Content-Type", "application/json")
.addHeader("X-Appbuilder-Authorization", "Bearer " + appKey) .addHeader("X-Appbuilder-Authorization", "Bearer " + APP_KEY)
.build(); .build();
Response response = HTTP_CLIENT.newCall(request).execute(); Response response = HTTP_CLIENT.newCall(request).execute();
// 获取消息 // 获取消息
...@@ -291,12 +293,12 @@ public class ApiChatNewController { ...@@ -291,12 +293,12 @@ public class ApiChatNewController {
conversation_id = object.toString(); conversation_id = object.toString();
}else { }else {
MediaType mediaType = MediaType.parse("application/json"); MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"appId\":\"" + appId + "\"}"); RequestBody body = RequestBody.create(mediaType, "{\"app_id\":\"" + APP_ID + "\"}");
Request request = new Request.Builder() Request request = new Request.Builder()
.url("https://qianfan.baidubce.com/v2/app/conversation") .url("https://qianfan.baidubce.com/v2/app/conversation")
.method("POST", body) .method("POST", body)
.addHeader("Content-Type", "application/json") .addHeader("Content-Type", "application/json")
.addHeader("X-Appbuilder-Authorization", "Bearer " + appKey) .addHeader("X-Appbuilder-Authorization", "Bearer " + APP_KEY)
.build(); .build();
Response response = HTTP_CLIENT.newCall(request).execute(); Response response = HTTP_CLIENT.newCall(request).execute();
String res = response.body().string(); String res = response.body().string();
......
...@@ -144,5 +144,5 @@ qiNiu: ...@@ -144,5 +144,5 @@ qiNiu:
baseUrl: https://image.xnszz.com/ baseUrl: https://image.xnszz.com/
baidu: baidu:
appId: a7234eb3-fc6b-4e8a-baae-e7f2df86a1f3 appId: 3c3927bd-2722-41eb-8363-7539177f4914
appKey: bce-v3/ALTAK-SJq4Dnyo31QJlajmyMT40/d806d48c7b7f2ec9675c7cbf2171e6dd0676b274 appKey: bce-v3/ALTAK-ZqT2bHLCdP4vVlnMk0d0s/67e7275c383eb772c85bffb939158f19e112f49f
\ No newline at end of file \ No newline at end of file
...@@ -21,7 +21,7 @@ public class MallSchool extends BaseEntity ...@@ -21,7 +21,7 @@ public class MallSchool extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 学校主键ID */ /** 学校主键ID */
@Excel(name = "学校主键ID") // @Excel(name = "学校主键ID")
private Long schoolId; private Long schoolId;
/** 学校名 */ /** 学校名 */
...@@ -47,6 +47,13 @@ public class MallSchool extends BaseEntity ...@@ -47,6 +47,13 @@ public class MallSchool extends BaseEntity
@Excel(name = "学校编号") @Excel(name = "学校编号")
private String schoolNumber; private String schoolNumber;
/** 办学层次id */
private Long configLevelId;
/** 办学层次 */
@Excel(name = "办学层次")
private String configLevelName;
/** 学校类型ID */ /** 学校类型ID */
// @Excel(name = "学校类型ID") // @Excel(name = "学校类型ID")
private Long configTypeId; private Long configTypeId;
...@@ -56,7 +63,7 @@ public class MallSchool extends BaseEntity ...@@ -56,7 +63,7 @@ public class MallSchool extends BaseEntity
private String configTypeName; private String configTypeName;
/** 办学机构:0-公办,1-民办,3-中外合作办学,4其他 */ /** 办学机构:0-公办,1-民办,3-中外合作办学,4其他 */
// @Excel(name = "办学机构:0-公办,1-民办,3-中外合作办学,4其他") @Excel(name = "办学机构", readConverterExp = "0=公办,1=民办,3=中外合作办学,4=其他")
private String schoolInstitution; private String schoolInstitution;
/** 主管部门(教育部、各地市) */ /** 主管部门(教育部、各地市) */
...@@ -186,11 +193,6 @@ public class MallSchool extends BaseEntity ...@@ -186,11 +193,6 @@ public class MallSchool extends BaseEntity
/** 批次id数组 */ /** 批次id数组 */
private Long[] batchList; private Long[] batchList;
/** 办学层次id */
private Long configLevelId;
/** 办学层次 */
private String configLevelName;
/** 推荐度id */ /** 推荐度id */
private Long suggestId; private Long suggestId;
......
...@@ -23,6 +23,7 @@ public interface MallSchoolLevelMapper ...@@ -23,6 +23,7 @@ public interface MallSchoolLevelMapper
public MallSchoolLevel selectMallSchoolLevelBySchoolId(@Param("schoolId") Long schoolId); public MallSchoolLevel selectMallSchoolLevelBySchoolId(@Param("schoolId") Long schoolId);
public List<MallSchoolLevel> selectMallSchoolLevelBySchoolIds(@Param("schoolId") List<Long> schoolIds);
/** /**
* 查询学校办学层次列表 * 查询学校办学层次列表
......
package com.ruoyi.mall.service.impl; package com.ruoyi.mall.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
...@@ -190,16 +191,28 @@ public class MallSchoolServiceImpl implements IMallSchoolService { ...@@ -190,16 +191,28 @@ public class MallSchoolServiceImpl implements IMallSchoolService {
@Override @Override
public List<MallSchool> selectMallSchoolListForExcel(MallSchool mallSchool) { public List<MallSchool> selectMallSchoolListForExcel(MallSchool mallSchool) {
List<MallSchool> list = mallSchoolMapper.selectMallSchoolList(mallSchool); List<MallSchool> list = mallSchoolMapper.selectMallSchoolList(mallSchool);
if (!list.isEmpty()){ // if (!list.isEmpty()){
for (MallSchool school : list) { // List<MallSchoolLevel> mallSchoolLevels = mallSchoolLevelMapper.selectMallSchoolLevelBySchoolIds(
// 查询层次 // list.stream().map(MallSchool::getSchoolId).collect(Collectors.toList()));
MallSchoolLevel mallSchoolLevel = mallSchoolLevelMapper.selectMallSchoolLevelBySchoolId(school.getSchoolId()); // if (CollectionUtil.isNotEmpty(mallSchoolLevels)){
if(ObjectUtils.isNotEmpty(mallSchoolLevel)){ // Map<Long, MallSchoolLevel> collect = mallSchoolLevels.stream().collect(Collectors.toMap(MallSchoolLevel::getSchoolId, e -> e));
school.setConfigLevelId(mallSchoolLevel.getConfigLevelId()); // list.stream().peek(l -> {
school.setConfigLevelName(mallSchoolLevel.getConfigLevelName()); // MallSchoolLevel mallSchoolLevel = collect.get(l.getSchoolId());
} // if (ObjectUtils.isNotEmpty(mallSchoolLevel)){
} // l.setConfigLevelId(mallSchoolLevel.getConfigLevelId());
} // l.setConfigLevelName(mallSchoolLevel.getConfigLevelName());
// }
// }).collect(Collectors.toList());
// }
// // for (MallSchool school : list) {
// // // 查询层次
// // MallSchoolLevel mallSchoolLevel = mallSchoolLevelMapper.selectMallSchoolLevelBySchoolId(school.getSchoolId());
// // if(ObjectUtils.isNotEmpty(mallSchoolLevel)){
// // school.setConfigLevelId(mallSchoolLevel.getConfigLevelId());
// // school.setConfigLevelName(mallSchoolLevel.getConfigLevelName());
// // }
// // }
// }
return list; return list;
} }
......
...@@ -78,6 +78,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -78,6 +78,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and del_flag = '0' and del_flag = '0'
</select> </select>
<select id="selectMallSchoolLevelBySchoolIds" parameterType="string" resultType="MallSchoolLevel">
select msl.school_level_id schoolLevelId,
msl.school_id schoolId,
msl.config_level_id configLevelId,
msl.config_level_name configLevelName,
msl.sort sort,
msl.remarks remarks,
msl.create_at createAt,
msl.update_at updateAt,
msl.del_flag delFlag
from mall_school_level msl
where msl.school_id in
<foreach item="schoolId" collection="list" open="(" separator="," close=")">
#{schoolId}
</foreach>
and del_flag = '0'
</select>
<insert id="insertMallSchoolLevel" parameterType="MallSchoolLevel" useGeneratedKeys="true" keyProperty="schoolLevelId"> <insert id="insertMallSchoolLevel" parameterType="MallSchoolLevel" useGeneratedKeys="true" keyProperty="schoolLevelId">
insert into mall_school_level insert into mall_school_level
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
......
...@@ -54,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -54,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="delFlag" column="del_flag" /> <result property="delFlag" column="del_flag" />
<result property="positionId" column="position_id" /> <result property="positionId" column="position_id" />
<result property="suggestId" column="suggest_id" /> <result property="suggestId" column="suggest_id" />
<result property="configLevelId" column="config_level_id" />
<result property="configLevelName" column="config_level_name" /> <result property="configLevelName" column="config_level_name" />
<result property="isNewAccept" column="is_new_accept" /> <result property="isNewAccept" column="is_new_accept" />
<result property="hasNewLink" column="has_new_link" /> <result property="hasNewLink" column="has_new_link" />
...@@ -64,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -64,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="sysUserName" column="sys_user_name" /> <result property="sysUserName" column="sys_user_name" />
<result property="sysUserPassword" column="sys_user_password" /> <result property="sysUserPassword" column="sys_user_password" />
<result property="sysUserStatus" column="sys_user_status" /> <result property="sysUserStatus" column="sys_user_status" />
</resultMap> </resultMap>
<sql id="selectMallSchoolVo"> <sql id="selectMallSchoolVo">
...@@ -78,11 +80,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -78,11 +80,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql> </sql>
<select id="selectMallSchoolList" parameterType="MallSchool" resultMap="MallSchoolResult"> <select id="selectMallSchoolList" parameterType="MallSchool" resultMap="MallSchoolResult">
select ms.school_id, ms.school_name, ms.school_icon, ms.background_image, ms.school_introduce, ms.school_introduce_short, ms.school_number, ms.config_type_id, ms.config_type_name, ms.school_institution, ms.competent_department, ms.province_id, ms.province_name, ms.city_id, ms.city_name, ms.area_id, ms.area_name, ms.address, ms.remarks, ms.tags, ms.school_web, ms.accept_phone, ms.school_mail, ms.school_birthday, ms.area_size, ms.male_ratio, ms.female_ratio, ms.postgraduate_ratio, ms.offer_ratio, ms.change_major_ratio,ms.masters_degree,ms.doctorate,ms.ace, ms.create_at, ms.update_at, ms.del_flag select ms.school_id, ms.school_name, ms.school_icon, ms.background_image, ms.school_introduce,
,ms.masters_degree_detail ,ms.doctorate_detail ,ms.ranking, ms.position_id, ms.school_introduce_short, ms.school_number, ms.config_type_id, ms.config_type_name,
ms.suggest_id, ms.accept_premise, msl.config_level_name, ms.doctorate_type, ms.school_institution, ms.competent_department, ms.province_id, ms.province_name,
ms.masters_degree_type,ms.is_new_accept, ms.has_new_link, ms.is_change, ms.no_plan ms.city_id, ms.city_name, ms.area_id, ms.area_name, ms.address, ms.remarks,
, ms.qr_code, ms.sys_user_id ms.tags, ms.school_web, ms.accept_phone, ms.school_mail, ms.school_birthday,
ms.area_size, ms.male_ratio, ms.female_ratio, ms.postgraduate_ratio, ms.offer_ratio,
ms.change_major_ratio,ms.masters_degree,ms.doctorate,ms.ace, ms.create_at, ms.update_at, ms.del_flag,
ms.masters_degree_detail ,ms.doctorate_detail ,ms.ranking, ms.position_id,
ms.suggest_id, ms.accept_premise, msl.config_level_id ,msl.config_level_name, ms.doctorate_type,
ms.masters_degree_type,ms.is_new_accept, ms.has_new_link, ms.is_change, ms.no_plan,ms.qr_code, ms.sys_user_id
from mall_school ms from mall_school ms
left join mall_school_level msl on msl.school_id = ms.school_id left join mall_school_level msl on msl.school_id = ms.school_id
<where> <where>
...@@ -120,6 +127,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -120,6 +127,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="suggestId != null "> and ms.suggest_id = #{suggestId}</if> <if test="suggestId != null "> and ms.suggest_id = #{suggestId}</if>
<if test="configLevelId != null "> and msl.config_level_id = #{configLevelId}</if> <if test="configLevelId != null "> and msl.config_level_id = #{configLevelId}</if>
and ms.del_flag = '0' and ms.del_flag = '0'
and msl.del_flag = '0'
</where> </where>
order by ms.create_at asc, ms.school_number asc order by ms.create_at asc, ms.school_number asc
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment