Commit a5d54a22 authored by sunsongtao's avatar sunsongtao

11

parent c54de2f1
......@@ -48,21 +48,22 @@ public class ApiChatNewController {
private RedisTemplate redisTemplate;
@Resource
private IMallMemberUserService mallMemberUserService;
@Value("${baidu.appKey}")
private String appKey;
@Value("${baidu.appId}")
private String appId;
private String APP_ID;
@Value("${baidu.appKey}")
private String APP_KEY;
// 读取超时为60s
private static final long READ_TIMEOUT = 60000;
// 写入超时为60s
private static final long WRITE_TIMEOUT = 60000;
// 连接超时为60s
private static final long CONNECT_TIMEOUT = 60000;
private static final long CALL_TIMEOUT = 60000;
private static final OkHttpClient HTTP_CLIENT = new OkHttpClient().newBuilder()
// 设置调用超时时间
.callTimeout(CALL_TIMEOUT, TimeUnit.MILLISECONDS)
......@@ -76,6 +77,7 @@ public class ApiChatNewController {
private static final ObjectMapper objectMapper = new ObjectMapper();
// 本次对话ID
private String conversation_id;
......@@ -262,14 +264,14 @@ public class ApiChatNewController {
logger.info("提问千帆App:" + question);
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);
// 请求
Request request = new Request.Builder()
.url("https://qianfan.baidubce.com/v2/app/conversation/runs")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("X-Appbuilder-Authorization", "Bearer " + appKey)
.addHeader("X-Appbuilder-Authorization", "Bearer " + APP_KEY)
.build();
Response response = HTTP_CLIENT.newCall(request).execute();
// 获取消息
......@@ -291,12 +293,12 @@ public class ApiChatNewController {
conversation_id = object.toString();
}else {
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()
.url("https://qianfan.baidubce.com/v2/app/conversation")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("X-Appbuilder-Authorization", "Bearer " + appKey)
.addHeader("X-Appbuilder-Authorization", "Bearer " + APP_KEY)
.build();
Response response = HTTP_CLIENT.newCall(request).execute();
String res = response.body().string();
......
......@@ -144,5 +144,5 @@ qiNiu:
baseUrl: https://image.xnszz.com/
baidu:
appId: a7234eb3-fc6b-4e8a-baae-e7f2df86a1f3
appKey: bce-v3/ALTAK-SJq4Dnyo31QJlajmyMT40/d806d48c7b7f2ec9675c7cbf2171e6dd0676b274
\ No newline at end of file
appId: 3c3927bd-2722-41eb-8363-7539177f4914
appKey: bce-v3/ALTAK-ZqT2bHLCdP4vVlnMk0d0s/67e7275c383eb772c85bffb939158f19e112f49f
\ No newline at end of file
......@@ -21,7 +21,7 @@ public class MallSchool extends BaseEntity
private static final long serialVersionUID = 1L;
/** 学校主键ID */
@Excel(name = "学校主键ID")
// @Excel(name = "学校主键ID")
private Long schoolId;
/** 学校名 */
......@@ -47,6 +47,13 @@ public class MallSchool extends BaseEntity
@Excel(name = "学校编号")
private String schoolNumber;
/** 办学层次id */
private Long configLevelId;
/** 办学层次 */
@Excel(name = "办学层次")
private String configLevelName;
/** 学校类型ID */
// @Excel(name = "学校类型ID")
private Long configTypeId;
......@@ -56,7 +63,7 @@ public class MallSchool extends BaseEntity
private String configTypeName;
/** 办学机构:0-公办,1-民办,3-中外合作办学,4其他 */
// @Excel(name = "办学机构:0-公办,1-民办,3-中外合作办学,4其他")
@Excel(name = "办学机构", readConverterExp = "0=公办,1=民办,3=中外合作办学,4=其他")
private String schoolInstitution;
/** 主管部门(教育部、各地市) */
......@@ -186,11 +193,6 @@ public class MallSchool extends BaseEntity
/** 批次id数组 */
private Long[] batchList;
/** 办学层次id */
private Long configLevelId;
/** 办学层次 */
private String configLevelName;
/** 推荐度id */
private Long suggestId;
......
......@@ -23,6 +23,7 @@ public interface MallSchoolLevelMapper
public MallSchoolLevel selectMallSchoolLevelBySchoolId(@Param("schoolId") Long schoolId);
public List<MallSchoolLevel> selectMallSchoolLevelBySchoolIds(@Param("schoolId") List<Long> schoolIds);
/**
* 查询学校办学层次列表
......
package com.ruoyi.mall.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
......@@ -190,16 +191,28 @@ public class MallSchoolServiceImpl implements IMallSchoolService {
@Override
public List<MallSchool> selectMallSchoolListForExcel(MallSchool mallSchool) {
List<MallSchool> list = mallSchoolMapper.selectMallSchoolList(mallSchool);
if (!list.isEmpty()){
for (MallSchool school : list) {
// 查询层次
MallSchoolLevel mallSchoolLevel = mallSchoolLevelMapper.selectMallSchoolLevelBySchoolId(school.getSchoolId());
if(ObjectUtils.isNotEmpty(mallSchoolLevel)){
school.setConfigLevelId(mallSchoolLevel.getConfigLevelId());
school.setConfigLevelName(mallSchoolLevel.getConfigLevelName());
}
}
}
// if (!list.isEmpty()){
// List<MallSchoolLevel> mallSchoolLevels = mallSchoolLevelMapper.selectMallSchoolLevelBySchoolIds(
// list.stream().map(MallSchool::getSchoolId).collect(Collectors.toList()));
// if (CollectionUtil.isNotEmpty(mallSchoolLevels)){
// Map<Long, MallSchoolLevel> collect = mallSchoolLevels.stream().collect(Collectors.toMap(MallSchoolLevel::getSchoolId, e -> e));
// list.stream().peek(l -> {
// 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;
}
......
......@@ -78,6 +78,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and del_flag = '0'
</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 into mall_school_level
<trim prefix="(" suffix=")" suffixOverrides=",">
......
......@@ -54,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="delFlag" column="del_flag" />
<result property="positionId" column="position_id" />
<result property="suggestId" column="suggest_id" />
<result property="configLevelId" column="config_level_id" />
<result property="configLevelName" column="config_level_name" />
<result property="isNewAccept" column="is_new_accept" />
<result property="hasNewLink" column="has_new_link" />
......@@ -64,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="sysUserName" column="sys_user_name" />
<result property="sysUserPassword" column="sys_user_password" />
<result property="sysUserStatus" column="sys_user_status" />
</resultMap>
<sql id="selectMallSchoolVo">
......@@ -78,11 +80,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<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
,ms.masters_degree_detail ,ms.doctorate_detail ,ms.ranking, ms.position_id,
ms.suggest_id, ms.accept_premise, 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
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,
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
left join mall_school_level msl on msl.school_id = ms.school_id
<where>
......@@ -120,6 +127,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="suggestId != null "> and ms.suggest_id = #{suggestId}</if>
<if test="configLevelId != null "> and msl.config_level_id = #{configLevelId}</if>
and ms.del_flag = '0'
and msl.del_flag = '0'
</where>
order by ms.create_at asc, ms.school_number asc
</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