commit
09ecef5aac
@ -115,6 +115,7 @@ public class SysNutritionQuestionController extends BaseController
|
||||
/**
|
||||
* 重新生成知识问答索引
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:nutritionQuestion:regenerateIndex')")
|
||||
@Log(title = "重新生成知识问答索引", businessType = BusinessType.UPDATE)
|
||||
@GetMapping("/regenerateNutritionQuestionIndex")
|
||||
public AjaxResult regenerateNutritionQuestionIndex()
|
||||
|
@ -45,4 +45,7 @@ public class SysNutritionQuestion extends BaseEntity
|
||||
|
||||
//解答问题对应的ID
|
||||
private Long askQuestionId;
|
||||
|
||||
//创建人名称
|
||||
private String createByName;
|
||||
}
|
@ -28,4 +28,7 @@ public class NutritionQuestionResponse implements Serializable {
|
||||
private String showFlag;
|
||||
|
||||
private String createTime;
|
||||
|
||||
//创建人
|
||||
private String createByName;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.common.utils.SecurityUtils;
|
||||
import com.stdiet.common.utils.StringUtils;
|
||||
import com.stdiet.common.utils.reflect.ReflectUtils;
|
||||
import com.stdiet.custom.dto.response.NutritionQuestionResponse;
|
||||
@ -40,7 +41,7 @@ public class SysNutritionQuestionServiceImpl implements ISysNutritionQuestionSer
|
||||
public String index_path;
|
||||
|
||||
//建立索引的字段名称
|
||||
public static final String[] index_field_array = {"id", "title", "content", "key", "showFlag", "createTime"};
|
||||
public static final String[] index_field_array = {"id", "title", "content", "key", "showFlag", "createTime", "createByName"};
|
||||
//查询字段
|
||||
public static final String[] index_select_field_array = {"title", "content", "key"};
|
||||
|
||||
@ -87,6 +88,7 @@ public class SysNutritionQuestionServiceImpl implements ISysNutritionQuestionSer
|
||||
public int insertSysNutritionQuestion(SysNutritionQuestion sysNutritionQuestion)
|
||||
{
|
||||
sysNutritionQuestion.setCreateTime(DateUtils.getNowDate());
|
||||
sysNutritionQuestion.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUser().getUserId()));
|
||||
if(sysNutritionQuestionMapper.insertSysNutritionQuestion(sysNutritionQuestion) > 0){
|
||||
return createNutritionQuestionIndex(sysNutritionQuestion.getId()) ? 1 : 0;
|
||||
}
|
||||
@ -291,9 +293,10 @@ public class SysNutritionQuestionServiceImpl implements ISysNutritionQuestionSer
|
||||
for (String fieldName : index_field_array) {
|
||||
TextField field = null;
|
||||
if("createTime".equals(fieldName)){
|
||||
field = new TextField(fieldName, DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,sysNutritionQuestion.getCreateTime()), Field.Store.YES);
|
||||
field = new TextField(fieldName, sysNutritionQuestion.getCreateTime() == null ? "" : DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,sysNutritionQuestion.getCreateTime()), Field.Store.YES);
|
||||
} else{
|
||||
field = new TextField(fieldName, ReflectUtils.getFieldValue(sysNutritionQuestion, fieldName)+"", Field.Store.YES);
|
||||
Object v = ReflectUtils.getFieldValue(sysNutritionQuestion, fieldName);
|
||||
field = new TextField(fieldName, v == null ? "" : String.valueOf(v) , Field.Store.YES);
|
||||
}
|
||||
if(nutritionQuestionBoostMap.containsKey(fieldName)){
|
||||
field.setBoost(nutritionQuestionBoostMap.get(fieldName).floatValue());
|
||||
|
@ -16,6 +16,7 @@
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="createByName" column="createByName"></result>
|
||||
</resultMap>
|
||||
|
||||
<!-- 部分字段resultMap -->
|
||||
@ -28,6 +29,10 @@
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="base_field">
|
||||
id, title, content, `key`, title_content_index, show_flag, create_time, create_by, update_time, update_by, del_flag
|
||||
</sql>
|
||||
|
||||
<sql id="selectSysNutritionQuestionVo">
|
||||
select id, title, content, `key`, title_content_index, show_flag, create_time, create_by, update_time, update_by, del_flag from sys_nutrition_question
|
||||
</sql>
|
||||
@ -37,8 +42,11 @@
|
||||
</select>
|
||||
|
||||
<select id="selectSysNutritionQuestionById" parameterType="Long" resultMap="SysNutritionQuestionResult">
|
||||
<include refid="selectSysNutritionQuestionVo"/>
|
||||
where id = #{id} and del_flag = 0
|
||||
select
|
||||
nq.*,u.nick_name as createByName
|
||||
from sys_nutrition_question nq
|
||||
left join sys_user u on u.user_id = nq.create_by
|
||||
where nq.del_flag = 0 and nq.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSysNutritionQuestion" parameterType="SysNutritionQuestion" useGeneratedKeys="true" keyProperty="id">
|
||||
@ -115,7 +123,11 @@
|
||||
|
||||
<!-- 分页查询-->
|
||||
<select id="getNutritionQuestionListByPage" resultMap="SysNutritionQuestionResult">
|
||||
select * from sys_nutrition_question where del_flag = 0 order by id asc limit #{start},#{pageSize}
|
||||
select
|
||||
nq.*,u.nick_name as createByName
|
||||
from sys_nutrition_question nq
|
||||
left join sys_user u on u.user_id = nq.create_by
|
||||
where nq.del_flag = 0 order by id asc limit #{start},#{pageSize}
|
||||
</select>
|
||||
|
||||
|
||||
|
@ -473,21 +473,21 @@
|
||||
|
||||
<!-- 根据日期查询该日期中未打卡客户(根据食谱计划判断今日是否需要打卡) -->
|
||||
<select id="selectNotPunchCustomerByDate" parameterType="SysCustomer" resultType="SysCustomer">
|
||||
select plan.cus_id as id, cus.name, cus.main_dietitian as mainDietitian, cus.assistant_dietitian as assistantDietitian,cus.after_dietitian as afterDietitian from
|
||||
|
||||
select cus.id, cus.name, cus.main_dietitian as mainDietitian, cus.assistant_dietitian as assistantDietitian,cus.after_dietitian as afterDietitian from
|
||||
(
|
||||
select DISTINCT cus_id from sys_recipes_plan where end_date >= DATE_FORMAT(#{startDate},'%Y-%m-%d') and DATE_FORMAT(#{startDate},'%Y-%m-%d') >= start_date and del_flag = 0 and instr(pause_date, DATE_FORMAT(#{startDate},'%Y%m%d')) = 0
|
||||
) as plan
|
||||
|
||||
left join sys_customer cus on cus.id = plan.cus_id and cus.del_flag = 0
|
||||
|
||||
where plan.cus_id not in
|
||||
|
||||
(
|
||||
select info.cus_id from sys_wx_user_log log left join sys_wx_user_info info on info.openid = log.openid
|
||||
where log.del_flag = 0 and DATE_FORMAT(log.log_time,'%Y-%m-%d') = DATE_FORMAT(#{startDate},'%Y-%m-%d')
|
||||
select distinct info.cus_id from sys_wx_user_log log left join sys_wx_user_info info on info.openid = log.openid where log.del_flag = 0 and info.cus_id is not null
|
||||
)
|
||||
as punchCus
|
||||
left join sys_customer cus on cus.id = punchCus.cus_id
|
||||
where cus.del_flag = 0 and punchCus.cus_id in
|
||||
(
|
||||
select DISTINCT cus_id from sys_recipes_plan where end_date >= DATE_FORMAT(#{startDate},'%Y-%m-%d') and DATE_FORMAT(#{startDate},'%Y-%m-%d') >= start_date and del_flag = 0 and instr(pause_date, DATE_FORMAT('2021-08-26','%Y%m%d')) = 0
|
||||
)
|
||||
and punchCus.cus_id not in
|
||||
(
|
||||
select info.cus_id from sys_wx_user_log log left join sys_wx_user_info info on info.openid = log.openid
|
||||
where log.del_flag = 0 and DATE_FORMAT(log.log_time,'%Y-%m-%d') = DATE_FORMAT(#{startDate},'%Y-%m-%d')
|
||||
)
|
||||
|
||||
<if test="mainDietitian != null">
|
||||
and cus.main_dietitian = #{mainDietitian}
|
||||
</if>
|
||||
@ -498,7 +498,7 @@
|
||||
and cus.after_dietitian = #{afterDietitian}
|
||||
</if>
|
||||
|
||||
order by plan.cus_id desc
|
||||
order by cus.id desc
|
||||
</select>
|
||||
|
||||
<!-- 获取打卡详情(上一天、下一天) -->
|
||||
|
@ -106,7 +106,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
"/wap/**",
|
||||
"/investigate/**",
|
||||
"/common/customerUploadFile",
|
||||
"/custom/nutritionQuestion/regenerateNutritionQuestionIndex",
|
||||
"/web/**"
|
||||
).anonymous()
|
||||
.antMatchers(
|
||||
|
@ -60,3 +60,14 @@ export function updateWxShow(data){
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
//重新生成索引
|
||||
export function regenerateQuestionIndex(){
|
||||
return request({
|
||||
url: '/custom/nutritionQuestion/regenerateNutritionQuestionIndex',
|
||||
method: 'get',
|
||||
params: {}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,7 +70,16 @@
|
||||
</el-form>
|
||||
<div style="height: 550px; overflow: auto">
|
||||
<el-table v-loading="loading" :data="notPunchCustomerList">
|
||||
<el-table-column label="客户姓名" align="center" prop="name" />
|
||||
<el-table-column label="客户姓名" align="center" prop="name">
|
||||
<template slot-scope="scope">
|
||||
<div
|
||||
@click="handleOnNameClick(scope.row.name)"
|
||||
class="user_name_style"
|
||||
>
|
||||
{{ scope.row.name }}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="营养师" align="center" prop="mainDietitian" :formatter="nutritionistFormat"/>
|
||||
<el-table-column label="售后营养师" align="center" prop="afterDietitian" :formatter="afterDietitianFormat"/>
|
||||
</el-table>
|
||||
@ -199,10 +208,16 @@ export default {
|
||||
afterDietitianFormat(row, column) {
|
||||
return this.selectDictLabel(this.afterSaleIdOptions, row.afterDietitian);
|
||||
},
|
||||
handleOnNameClick(name) {
|
||||
// console.log({ name });
|
||||
this.$router.push(`/customer?cusName=${name}`);
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.user_name_style {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
@ -59,6 +59,14 @@
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
size="mini"
|
||||
@click="regenerateIndex"
|
||||
v-hasPermi="['custom:nutritionQuestion:regenerateIndex']"
|
||||
>重新生成索引</el-button>
|
||||
</el-col>
|
||||
<!--<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="mini"
|
||||
@ -66,7 +74,7 @@
|
||||
@click="handleAskQuestion"
|
||||
v-hasPermi="['custom:askQuestion:list']"
|
||||
>问题解答</el-button>
|
||||
</el-col>
|
||||
</el-col>-->
|
||||
<!--<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
@ -117,6 +125,9 @@
|
||||
<span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d} {h}:{i}") }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建人" align="center" prop="createByName">
|
||||
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
@ -212,7 +223,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listNutritionQuestion, getNutritionQuestion, delNutritionQuestion, addNutritionQuestion, updateNutritionQuestion, exportNutritionQuestion,updateWxShow } from "@/api/custom/nutritionQuestion";
|
||||
import { listNutritionQuestion, getNutritionQuestion, delNutritionQuestion, addNutritionQuestion, updateNutritionQuestion, exportNutritionQuestion,updateWxShow,regenerateQuestionIndex } from "@/api/custom/nutritionQuestion";
|
||||
import Editor from '@/components/Wangeditor';
|
||||
import AutoHideMessage from "@/components/AutoHideMessage";
|
||||
import AskQuestion from "../askQuestion";
|
||||
@ -437,6 +448,14 @@ export default {
|
||||
},
|
||||
onClosedAskQuestion(){
|
||||
console.log(this.$refs.askQuestionListRef.isUpdateFlag);
|
||||
},
|
||||
regenerateIndex(){
|
||||
regenerateQuestionIndex().then(response => {
|
||||
if(response.code == 200){
|
||||
this.msgSuccess("生成成功");
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user