打卡优化

This commit is contained in:
xiezhijun 2021-04-15 09:27:16 +08:00
parent 8d8dc77642
commit 5c048db222
9 changed files with 177 additions and 15 deletions

View File

@ -10,6 +10,7 @@ import com.stdiet.custom.mapper.SysNutritionQuestionMapper;
import com.stdiet.custom.mapper.SysWxUserInfoMapper;
import com.stdiet.custom.mapper.SysWxUserLogMapper;
import com.stdiet.custom.service.ISysNutritionQuestionService;
import com.stdiet.custom.service.ISysWxUserLogService;
import com.stdiet.custom.utils.LuceneIndexUtils;
import com.stdiet.framework.web.domain.server.Sys;
import org.apache.lucene.document.Document;
@ -37,6 +38,9 @@ public class MyApplicationRunner implements ApplicationRunner {
@Autowired
private ISysNutritionQuestionService sysNutritionQuestionService;
@Autowired
private ISysWxUserLogService sysWxUserLogService;
@Override
public void run(ApplicationArguments args) throws Exception {
System.out.println("项目启动调用方法");
@ -47,7 +51,6 @@ public class MyApplicationRunner implements ApplicationRunner {
sysNutritionQuestion.setKey("猝死");
sysNutritionQuestionService.insertSysNutritionQuestion(sysNutritionQuestion);*/
}

View File

@ -33,6 +33,7 @@ import java.util.*;
@RestController
@RequestMapping("/custom/wxUserLog")
public class SysWxUserLogController extends BaseController {
@Autowired
private ISysWxUserLogService sysWxUserLogService;

View File

@ -132,7 +132,7 @@ public class WechatAppletController extends BaseController {
}
}
for (WxLogInfo wxLogInfo : list) {
/*for (WxLogInfo wxLogInfo : list) {
Map<String, List<String>> imageUrlMap = new HashMap<>();
List<String> breakfastImagesUrlList = StringUtils.isNotEmpty(wxLogInfo.getBreakfastImages()) ? Arrays.asList(wxLogInfo.getBreakfastImages().split("\\|")) : new ArrayList<>();
@ -158,7 +158,7 @@ public class WechatAppletController extends BaseController {
wxLogInfo.setDinnerImagesUrl(downUrlList.get("dinnerImages"));
wxLogInfo.setExtraMealImagesUrl(downUrlList.get("extraMealImages"));
wxLogInfo.setBodyImagesUrl(downUrlList.get("bodyImages"));
}
}*/
Collections.reverse(list);
TableDataInfo tableDataInfo = getDataTable(list);
@ -202,6 +202,47 @@ public class WechatAppletController extends BaseController {
return toAjax(sysWxUserLogService.insertSysWxUserLog(sysWxUserLog));
}
/**
* 获取微信用户记录详细信息
*/
@GetMapping(value = "/getPunchLogDetail/{id}")
public AjaxResult getPunchLogDetail(@PathVariable("id") String id) {
WxLogInfo sysWxUserLog = null;
//根据ID查询
SysWxUserLog param = new SysWxUserLog();
param.setId(Long.parseLong(id));
sysWxUserLog = sysWxUserLogService.getWxLogInfoDetailById(param);
if(sysWxUserLog == null){
return AjaxResult.error("打卡记录不存在");
}
Map<String, List<String>> imageUrlMap = new HashMap<>();
List<String> breakfastImagesUrlList = StringUtils.isNotEmpty(sysWxUserLog.getBreakfastImages()) ? Arrays.asList(sysWxUserLog.getBreakfastImages().split("\\|")) : new ArrayList<>();
imageUrlMap.put("breakfastImages", breakfastImagesUrlList);
List<String> lunchImagesUrlList = StringUtils.isNotEmpty(sysWxUserLog.getLunchImages()) ? Arrays.asList(sysWxUserLog.getLunchImages().split("\\|")) : new ArrayList<>();
imageUrlMap.put("lunchImages", lunchImagesUrlList);
List<String> dinnerImagesUrlList = StringUtils.isNotEmpty(sysWxUserLog.getDinnerImages()) ? Arrays.asList(sysWxUserLog.getDinnerImages().split("\\|")) : new ArrayList<>();
imageUrlMap.put("dinnerImages", dinnerImagesUrlList);
List<String> extraMealImagesUrlList = StringUtils.isNotEmpty(sysWxUserLog.getExtraMealImages()) ? Arrays.asList(sysWxUserLog.getExtraMealImages().split("\\|")) : new ArrayList<>();
imageUrlMap.put("extraMealImages", extraMealImagesUrlList);
List<String> bodyImagesUrlList = StringUtils.isNotEmpty(sysWxUserLog.getBodyImages()) ? Arrays.asList(sysWxUserLog.getBodyImages().split("\\|")) : new ArrayList<>();
imageUrlMap.put("bodyImages", bodyImagesUrlList );
//生成预览链接
Map<String,List<String>> downUrlList = AliyunOSSUtils.generatePresignedUrl(imageUrlMap);
sysWxUserLog.setBreakfastImagesUrl(downUrlList.get("breakfastImages"));
sysWxUserLog.setLunchImagesUrl(downUrlList.get("lunchImages"));
sysWxUserLog.setDinnerImagesUrl(downUrlList.get("dinnerImages"));
sysWxUserLog.setExtraMealImagesUrl(downUrlList.get("extraMealImages"));
sysWxUserLog.setBodyImagesUrl(downUrlList.get("bodyImages"));
return AjaxResult.success(sysWxUserLog);
}
/**
* 处理返回值的ID加密
* @param list

View File

@ -85,4 +85,11 @@ public interface SysWxUserLogMapper
*/
List<SysWxUserLog> getWxUserLogListByCustomerId(SysWxUserLog sysWxUserLog);
/**
* 根据ID查询打卡详情
* @param sysWxUserLog
* @return
*/
WxLogInfo getWxLogInfoDetailById(SysWxUserLog sysWxUserLog);
}

View File

@ -87,4 +87,11 @@ public interface ISysWxUserLogService
*/
List<SysWxUserLog> getWxUserLogListByCustomerId(SysWxUserLog sysWxUserLog);
/**
* 根据ID查询打卡详情
* @param sysWxUserLog
* @return
*/
WxLogInfo getWxLogInfoDetailById(SysWxUserLog sysWxUserLog);
}

View File

@ -133,4 +133,13 @@ public class SysWxUserLogServiceImpl implements ISysWxUserLogService {
return sysWxUserLogMapper.getWxUserLogListByCustomerId(sysWxUserLog);
}
/**
* 根据ID查询打卡详情
* @param sysWxUserLog
* @return
*/
public WxLogInfo getWxLogInfoDetailById(SysWxUserLog sysWxUserLog){
return sysWxUserLogMapper.getWxLogInfoDetailById(sysWxUserLog);
}
}

View File

@ -253,7 +253,7 @@
<select id="getWxLogInfoList" parameterType="SysWxUserLog" resultMap="WxLogInfo">
SELECT wxlog.weight,wxlog.log_time,wxlog.sleep_time, wxlog.wakeup_time,wxlog.defecation, wxlog.water, wxlog.insomnia,wxlog.sport,wxlog.diet,
wxlog.emotion,wxlog.sly_eat_food,wxlog.constipation,wxlog.breakfast_images,wxlog.lunch_images,wxlog.dinner_images,wxlog.extra_meal_images,wxlog.body_images
,wxlog.suggest,wxlog.execution_score,wxlog.comment
,wxlog.remark,wxlog.execution_score,wxlog.comment
FROM sys_wx_user_log wxlog left join sys_wx_user_info wxinfo on wxinfo.openid = wxlog.openid
where wxlog.del_flag = 0 and (wxinfo.openid = #{openid} or wxinfo.phone = #{phone})
order by wxlog.log_time desc
@ -290,4 +290,14 @@
order by wxlog.log_time asc
</select>
<!-- 根据openid和手机号查询对应打卡记录 -->
<select id="getWxLogInfoDetailById" parameterType="SysWxUserLog" resultMap="WxLogInfo">
SELECT wxlog.weight,wxlog.log_time,wxlog.sleep_time, wxlog.wakeup_time,wxlog.defecation, wxlog.water, wxlog.insomnia,wxlog.sport,wxlog.diet,
wxlog.emotion,wxlog.sly_eat_food,wxlog.constipation,wxlog.breakfast_images,wxlog.lunch_images,wxlog.dinner_images,wxlog.extra_meal_images,wxlog.body_images
,wxlog.remark,wxlog.execution_score,wxlog.comment
FROM sys_wx_user_log wxlog left join sys_wx_user_info wxinfo on wxinfo.openid = wxlog.openid
where wxlog.del_flag = 0 and wxlog.id = #{id}
order by wxlog.log_time desc
</select>
</mapper>

View File

@ -15,6 +15,7 @@
v-hasPermi="['custom:wxUserLog:query']"
type="primary"
plain
@click="clickComment()"
>打卡点评</el-button
>
@ -26,12 +27,12 @@
<h3>基础信息</h3>
<TableDetailMessage :data="punchLogDetail"></TableDetailMessage>
<h3>图片信息</h3>
<div style="height: 400px; overflow: auto">
<div style="height: 370px; overflow: auto">
<div v-if="punchLog != null && punchLog.imagesUrl.breakfastImages.length > 0">
<h4>早餐</h4>
<div>
<el-image v-for="(item, index) in punchLog.imagesUrl.breakfastImages" title="点击大图预览" :key="index"
style="width: 300px; height: 380px"
style="width: 300px; height: 300px"
:src="item"
:preview-src-list="imageUrl">
</el-image>
@ -41,7 +42,7 @@
<h4>午餐</h4>
<div>
<el-image v-for="(item, index) in punchLog.imagesUrl.lunchImages" title="点击大图预览" :key="index"
style="width: 300px; height: 400px"
style="width: 300px; height: 300px"
:src="item"
:preview-src-list="imageUrl">
</el-image>
@ -51,7 +52,7 @@
<h4>晚餐</h4>
<div>
<el-image v-for="(item, index) in punchLog.imagesUrl.dinnerImages" title="点击大图预览" :key="index"
style="width: 300px; height: 400px"
style="width: 300px; height: 300px"
:src="item"
:preview-src-list="imageUrl">
</el-image>
@ -61,7 +62,7 @@
<h4>加餐</h4>
<div>
<el-image v-for="(item, index) in punchLog.imagesUrl.extraMealImages" title="点击大图预览" :key="index"
style="width: 300px; height: 400px"
style="width: 300px; height: 300px"
:src="item"
:preview-src-list="imageUrl">
</el-image>
@ -71,7 +72,7 @@
<h4>体型对比照</h4>
<div>
<el-image v-for="(item, index) in punchLog.imagesUrl.bodyImages" title="点击大图预览" :key="index"
style="width: 300px; height: 400px"
style="width: 300px; height: 300px"
:src="item"
:preview-src-list="imageUrl">
</el-image>
@ -80,7 +81,39 @@
</div>
</div>
</div>
<el-dialog :visible.sync="commentVisible" :title="commentTitle" width="500px" append-to-body @closed="commentClosed">
<el-form ref="form" :model="commentForm" :rules="commentRules" label-position="top" label-width="100px">
<el-form-item label="打卡评分" prop="executionScore" >
<el-rate
v-model="commentForm.executionScore"
show-score
allow-half
text-color="#ff9900"
>
</el-rate>
</el-form-item>
<el-form-item label="点评内容" prop="comment" >
<el-input
type="textarea"
:rows="4"
maxlength="200"
show-word-limit
placeholder="请输入点评内容"
v-model="commentForm.comment">
</el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer" >
<el-button type="primary" @click="commentSubmit()"> </el-button>
<el-button @click="commentClosed()"> </el-button>
</div>
</el-dialog>
</el-dialog>
</template>
<script>
import {
@ -106,15 +139,26 @@ export default {
["姓名", "体重(斤)","饮水量(ml)"],
["睡觉时间", "起床时间","运动锻炼"],
["情绪","按食谱进食","其他食物"],
["熬夜失眠", "起床排便","是否便秘"]
["熬夜失眠", "起床排便","是否便秘"],
["服务建议", "评分","点评内容"]
],
//
punchValueData: [
["customerName","weight","water"],
["sleepTime", "wakeupTime","sport"],
["emotion", "diet","slyEatFood"],
["insomnia","defecation", "constipation"]
["insomnia","defecation", "constipation"],
["remark","executionScore","comment"],
],
commentVisible: false,
commentTitle: "",
commentForm:{
},
commentRules:{},
scoreArray:[0.5,1,1.5,2,2.5,3,3.5,4,4.5,5]
};
},
methods: {
@ -152,6 +196,8 @@ export default {
res.data.insomnia = res.data.insomnia === "Y" ? "是" : "否";
res.data.defecation = res.data.defecation === "Y" ? "是" : "否";
res.data.constipation = res.data.constipation === "Y" ? "是" : "否";
res.data.isScore = res.data.executionScore == null ? "否" : "是";
this.punchLogDetail = [];
for (let i = 0; i < this.punchTitleData.length; i++) {
this.punchLogDetail.push({
attr_name_one: this.punchTitleData[i][0],
@ -177,6 +223,35 @@ export default {
this.punchLog = null,
this.imageUrl = [],
this.punchLogDetail = []
},
clickComment(){
console.log(this.punchLog.executionScore);
this.commentForm = {
id: this.punchLog.id,
comment: this.punchLog.comment,
executionScore: this.punchLog.executionScore == null ? 0 : this.punchLog.executionScore,
}
this.commentTitle = "点评「"+this.punchLog.customerName+" "+ this.punchLog.logTime +"」打卡";
this.commentVisible = true;
},
commentClosed(){
this.commentVisible = false;
},
commentSubmit(){
/*if(this.commentForm.executionScore == null || this.commentForm.executionScore == 0){
this.msgError("评分不能为0");
return;
}*/
commentPunchContent(this.commentForm).then((res) => {
if(res.code == 200){
this.msgSuccess("点评成功");
this.commentVisible = false;
this.getPunchLogById();
}else{
this.msgSuccess("点评失败");
}
});
}
},
};

View File

@ -197,7 +197,7 @@
label="情绪"
align="center"
prop="emotion"
width="160"
width="120"
>
<template slot-scope="scope">
<AutoHideMessage :maxLength="4" :data="scope.row.emotion"></AutoHideMessage>
@ -214,7 +214,7 @@
label="其他食物"
align="center"
prop="slyEatFood"
width="160"
width="120"
>
<template slot-scope="scope">
<AutoHideMessage :maxLength="4" :data="scope.row.slyEatFood"></AutoHideMessage>
@ -243,6 +243,15 @@
<span>{{ `${scope.row.water} ml` }}</span>
</template>
</el-table-column>
<el-table-column label="是否点评" align="center" prop="executionScore">
<template slot-scope="scope">
<el-tag
:type="scope.row.executionScore == null ? 'danger' : 'success'"
>
{{ scope.row.executionScore == null ? "未点评" : "已点评" }}
</el-tag>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"