修改打卡详情页面,支持前一天后一天翻页查看

This commit is contained in:
xiezhijun
2021-08-25 18:19:55 +08:00
parent e815da39cd
commit b3c7d68705
18 changed files with 213 additions and 38 deletions

View File

@ -14,10 +14,7 @@ import com.stdiet.custom.domain.SysCustomer;
import com.stdiet.custom.domain.SysWxUserInfo;
import com.stdiet.custom.domain.SysWxUserLog;
import com.stdiet.custom.page.WxLogInfo;
import com.stdiet.custom.service.ISysMessageNoticeService;
import com.stdiet.custom.service.ISysOrderService;
import com.stdiet.custom.service.ISysWxUserInfoService;
import com.stdiet.custom.service.ISysWxUserLogService;
import com.stdiet.custom.service.*;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@ -48,6 +45,9 @@ public class SysWxUserLogController extends BaseController {
@Autowired
private ISysMessageNoticeService sysMessageNoticeService;
@Autowired
private ISysCustomerService sysCustomerService;
/**
* 查询微信用户记录列表
*/
@ -164,40 +164,50 @@ public class SysWxUserLogController extends BaseController {
/**
* 获取微信用户记录详细信息
* @param id 打卡记录ID
* @param nextFlag 0当前 -1上一条 1下一条
* @return
*/
@PreAuthorize("@ss.hasPermi('custom:wxUserLog:query')")
@GetMapping(value = "/getPunchLogDetail/{id}")
public AjaxResult getPunchLogDetail(@PathVariable("id") String id) {
public AjaxResult getPunchLogDetail(@PathVariable("id") String id,
@RequestParam(value = "cusId", required = false)Long cusId,
@RequestParam(value = "nextFlag", required = false, defaultValue = "0")int nextFlag) {
SysWxUserLog sysWxUserLog = null;
//根据ID查询
SysWxUserLog param = new SysWxUserLog();
param.setId(Long.parseLong(id));
List<SysWxUserLog> sysWxUserLogList = sysWxUserLogService.selectSysWxUserLogList(param);
if(sysWxUserLogList != null && sysWxUserLogList.size() > 0){
sysWxUserLog = sysWxUserLogList.get(0);
param.setNextFlag(nextFlag);
param.setCustomerId(cusId);
sysWxUserLog = sysWxUserLogService.getPunchLogDetail(param);
if(sysWxUserLog != null){
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.setImagesUrl(downUrlList);
//查询对应对应客户性别
if(sysWxUserLog.getCustomerId() != null){
sysWxUserLog.setSex( sysCustomerService.getCustomerSex(sysWxUserLog.getCustomerId()));
}
}
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.setImagesUrl(downUrlList);
return AjaxResult.success(sysWxUserLog);
}

View File

@ -206,6 +206,12 @@ public class SysWxUserLog extends BaseEntity {
//图片预览路径
private Map<String, List<String>> imagesUrl;
//获取详情标识
private Integer nextFlag;
//客户性别
private Integer sex;
public void setDefecation(String defecation) {
if (defecation.equals("Y") || defecation.equals("N")) {
// this.defecation = defecation.equals("Y") ? "是" : "否";

View File

@ -88,4 +88,11 @@ public interface SysCustomerHealthyMapper
* @return
*/
public List<SysDictData> selectDictDataByTypeAndValue(SysDictData sysDictData);
/**
* 查询客户性别
* @param cusId
* @return
*/
Integer getCustomerSexByCusId(Long cusId);
}

View File

@ -73,4 +73,11 @@ public interface SysCustomerPhysicalSignsMapper
* @return
*/
int delCustomerSignByCustomerId(@Param("customerId")Long customerId);
/**
* 查询客户性别
* @param cusId
* @return
*/
Integer getCustomerSexByCusId(Long cusId);
}

View File

@ -123,4 +123,11 @@ public interface SysWxUserLogMapper
*/
List<SysCustomer> selectNotPunchCustomerByDate(SysCustomer sysCustomer);
/**
* 查询打卡详情(下一条、上一条)
* @param sysWxUserLog
* @return
*/
SysWxUserLog getPunchLogDetail(SysWxUserLog sysWxUserLog);
}

View File

@ -94,4 +94,11 @@ public interface ISysCustomerHealthyService
* @return
*/
public List<SysDictData> selectDictDataByTypeAndValue(SysDictData sysDictData);
/**
* 查询客户性别
* @param cusId
* @return
*/
Integer getCustomerSexByCusId(Long cusId);
}

View File

@ -92,4 +92,11 @@ public interface ISysCustomerPhysicalSignsService {
*/
int delCustomerSignByCustomerId(Long customerId);
/**
* 获取客户性别
* @param cusId
* @return
*/
Integer getCustomerSexByCusId(Long cusId);
}

View File

@ -88,4 +88,11 @@ public interface ISysCustomerService
*/
SysCustomer getCustomerByOpenId(String openid);
/**
* 根据客户ID查询性别
* @param cusId 客户ID
* @return
*/
Integer getCustomerSex(Long cusId);
}

View File

@ -124,4 +124,11 @@ public interface ISysWxUserLogService
*/
List<SysCustomer> selectNotPunchCustomerByDate(SysCustomer sysCustomer);
/**
* 查询打卡详情(下一条、上一条)
* @param sysWxUserLog
* @return
*/
SysWxUserLog getPunchLogDetail(SysWxUserLog sysWxUserLog);
}

View File

@ -272,4 +272,13 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService
public List<SysDictData> selectDictDataByTypeAndValue(SysDictData sysDictData){
return sysCustomerHealthyMapper.selectDictDataByTypeAndValue(sysDictData);
}
/**
* 查询客户性别
* @param cusId
* @return
*/
public Integer getCustomerSexByCusId(Long cusId){
return sysCustomerHealthyMapper.getCustomerSexByCusId(cusId);
}
}

View File

@ -192,4 +192,14 @@ public class SysCustomerPhysicalSignsServiceImpl implements ISysCustomerPhysical
public int delCustomerSignByCustomerId(Long customerId){
return sysCustomerPhysicalSignsMapper.delCustomerSignByCustomerId(customerId);
}
/**
* 查询客户性别
* @param cusId
* @return
*/
@Override
public Integer getCustomerSexByCusId(Long cusId){
return sysCustomerPhysicalSignsMapper.getCustomerSexByCusId(cusId);
}
}

View File

@ -231,4 +231,17 @@ public class SysCustomerServiceImpl implements ISysCustomerService {
}
}
}
/**
* 根据客户ID查询性别
* @param cusId 客户ID
* @return
*/
public Integer getCustomerSex(Long cusId){
Integer sex = sysCustomerHealthyService.getCustomerSexByCusId(cusId);
if(sex == null){
sex = sysCustomerPhysicalSignsService.getCustomerSexByCusId(cusId);
}
return sex;
}
}

View File

@ -182,4 +182,13 @@ public class SysWxUserLogServiceImpl implements ISysWxUserLogService {
return sysWxUserLogMapper.selectNotPunchCustomerByDate(sysCustomer);
}
/**
* 查询打卡详情(下一条、上一条)
* @param sysWxUserLog
* @return
*/
public SysWxUserLog getPunchLogDetail(SysWxUserLog sysWxUserLog){
return sysWxUserLogMapper.getPunchLogDetail(sysWxUserLog);
}
}

View File

@ -583,4 +583,9 @@
from sys_customer_healthy_extended where del_flag = 0 and healthy_id = #{id} limit 1
</select>
<!-- 查询客户性别 -->
<select id="getCustomerSexByCusId" parameterType="Long" resultType="Integer">
select sex from sys_customer_healthy where del_flag = 0 and customer_id = #{cusId} limit 1
</select>
</mapper>

View File

@ -222,4 +222,9 @@
update sys_customer_physical_signs set del_flag = 1 where customer_id = #{customerId}
</update>
<!-- 查询客户性别 -->
<select id="getCustomerSexByCusId" parameterType="Long" resultType="Integer">
select sex from sys_customer_physical_signs where del_flag = 0 and customer_id = #{cusId} limit 1
</select>
</mapper>

View File

@ -49,6 +49,7 @@
<result property="menstrualPeriod" column="menstrual_period"/>
<!-- 非持久字段 -->
<result property="customerName" column="customer_name"/>
<result property="customerId" column="cus_id"/>
<!-- 营养师 -->
<result property="nutritionist" column="nutritionist"/>
<result property="afterNutritionist" column="after_nutritionist"/>
@ -495,5 +496,41 @@
order by plan.cus_id desc
</select>
<!-- 获取打卡详情(上一天、下一天) -->
<select id="getPunchLogDetail" parameterType="SysWxUserLog" resultMap="SysWxUserLogResult">
SELECT
wxlog.id,wxinfo.appid,wxinfo.openid,wxinfo.avatar_url,wxinfo.phone,wxlog.weight,wxlog.log_time,wxlog.sleep_time,
wxlog.wakeup_time,wxlog.defecation, wxlog.defecation_desc, wxlog.water, wxlog.insomnia,wxlog.sport,
wxlog.sport_desc,wxlog.diet, wxlog.diet_desc,wxlog.remark,
wxlog.emotion, wxlog.menstrual_period,
wxlog.emotion_desc,wxlog.sly_eat_food,wxlog.constipation,wxlog.ingredient_desc,wxlog.breakfast_images,
wxlog.lunch_images,wxlog.dinner_images,wxlog.extra_meal_images,wxlog.body_images,wxlog.body_desc,
wxlog.suggest,wxlog.execution_score,wxlog.comment,wxlog.health_manifesto, wxlog.log_time,
sc.id as cus_id,sc.name as customer_name
FROM sys_wx_user_log wxlog
left join sys_wx_user_info wxinfo on wxinfo.openid = wxlog.openid
left join sys_customer sc on sc.id = wxinfo.cus_id and sc.del_flag = 0
where wxlog.del_flag = 0
<if test="nextFlag == 0">
and wxlog.id = #{id}
</if>
<if test="nextFlag == -1">
and #{id} > wxlog.id
</if>
<if test="nextFlag == 1">
and wxlog.id > #{id}
</if>
<if test="customerId != null">
and sc.id = #{customerId}
</if>
<if test="nextFlag == -1">
order by id desc
</if>
<if test="nextFlag == 1">
order by id asc
</if>
limit 1
</select>
</mapper>

View File

@ -53,11 +53,11 @@ export function exportWxUserLog(query) {
}
// 根据ID查询打卡日志详情
export function getPunchLogDetail(id) {
export function getPunchLogDetail(id, cusId, nextFlag) {
return request({
url: '/custom/wxUserLog/getPunchLogDetail/' + id,
method: 'get',
params: {}
params: {'cusId': cusId ? cusId : null, 'nextFlag': nextFlag ? nextFlag : 0}
})
}

View File

@ -12,7 +12,7 @@
<div
:style="'float: left; width: ' + (commentVisible ? '900px' : '950px')"
>
<div style="float: right; margin-bottom: 10px">
<div style="float: right; margin-right:30px;">
<el-button
v-hasPermi="['custom:wxUserLog:query']"
type="primary"
@ -21,10 +21,11 @@
>打卡点评</el-button
>
</div>
<div style="height: 600px; overflow: auto; width:100%">
<h3>基础信息</h3>
<TableDetailMessage :data="punchLogDetail" :maxLength="10" />
<h3>食物以及对比照信息</h3>
<div style="height: 370px; overflow: auto">
<div>
<div v-if="punchLog != null && punchLog.ingredientDesc">
<h4>食物描述</h4>
<div>
@ -115,6 +116,7 @@
</div>
</div>
</div>
</div>
</div>
<div
style="width: 200px; margin-left: 40px; margin-top: 50px"
@ -140,7 +142,7 @@
<el-form-item label="点评内容" prop="comment">
<el-input
type="textarea"
:rows="20"
:rows="15"
maxlength="200"
show-word-limit
placeholder="请输入点评内容"
@ -155,7 +157,12 @@
</div>
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" plain style="float:left" @click="getPunchLogById(punchLog.customerId, -1)">前一天</el-button>
<el-button type="primary" plain @click="getPunchLogById(punchLog.customerId,1)">后一天</el-button>
</div>
</el-dialog>
</template>
<script>
@ -225,23 +232,38 @@ export default {
},
showDialog(data, callback) {
this.data = data;
if (data.sex) {
//性别判断改为根据id查询时返回的性别为准
/*if (data.sex) {
this.punchTitleData[0] = ["体重(斤)", "饮水量(ml)", "生理期"];
this.punchValueData[0] = ["weight", "water", "menstrualPeriod"];
} else {
this.punchTitleData[0] = ["体重(斤)", "饮水量(ml)"];
this.punchValueData[0] = ["weight", "water"];
}
}*/
this.callback = callback;
this.commentFlag = false;
this.title = `${data.customerName}` + " " + `${data.logTime}」打卡记录`;
this.getPunchLogById();
},
getPunchLogById() {
getPunchLogDetail(this.data.id).then((res) => {
getPunchLogById(cusId, nextFlag) {
getPunchLogDetail(this.punchLog == null ? this.data.id : this.punchLog.id, cusId, nextFlag).then((res) => {
if (res.code == 200) {
if(res.data == null){
if(nextFlag && nextFlag != null){
this.msgInfo("打卡记录已到尽头");
}
return;
}
this.visible = true;
this.punchLog = res.data;
this.title = `${res.data.customerName}` + " " + `${res.data.logTime}」打卡记录`;
if (res.data.sex != null && res.data.sex == 1) {
this.punchTitleData[0] = ["体重(斤)", "饮水量(ml)", "生理期"];
this.punchValueData[0] = ["weight", "water", "menstrualPeriod"];
} else {
this.punchTitleData[0] = ["体重(斤)", "饮水量(ml)"];
this.punchValueData[0] = ["weight", "water"];
}
res.data.sport = res.data.sport === "Y" ? "是" : "否";
res.data.diet = res.data.diet === "Y" ? "是" : "否";
res.data.insomnia = res.data.insomnia === "Y" ? "是" : "否";