From 6ca76e0473e86afa9db2d85f6c74c6256bce1b16 Mon Sep 17 00:00:00 2001
From: huangdeliang <huangdeliang@skieer.com>
Date: Sat, 31 Jul 2021 15:22:06 +0800
Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8D=A1=E7=82=B9=E8=B5=9E?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../stdiet/custom/domain/SysWxUserLog.java    | 155 +++++++++++++-----
 .../com/stdiet/custom/page/WxLogInfo.java     |   8 +-
 .../mapper/custom/SysWxUserLogMapper.xml      |  42 +++--
 .../PunchLog/PunchLogDetail/index.vue         |  26 +--
 4 files changed, 167 insertions(+), 64 deletions(-)

diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysWxUserLog.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysWxUserLog.java
index dc188c0fe..7c3100fc9 100644
--- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysWxUserLog.java
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysWxUserLog.java
@@ -1,15 +1,15 @@
 package com.stdiet.custom.domain;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.stdiet.common.annotation.Excel;
+import com.stdiet.common.utils.StringUtils;
+import lombok.Data;
+
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
-import com.fasterxml.jackson.annotation.JsonFormat;
-import lombok.Data;
-import com.stdiet.common.annotation.Excel;
-import com.stdiet.common.core.domain.BaseEntity;
-
 /**
  * 微信用户记录对象 sys_wx_user_log
  *
@@ -17,56 +17,91 @@ import com.stdiet.common.core.domain.BaseEntity;
  * @date 2020-11-29
  */
 @Data
-public class SysWxUserLog extends BaseEntity
-{
-    private static final long serialVersionUID = 1L;
+public class SysWxUserLog {
 
     private Long id;
 
-    /** 微信openid */
+    /**
+     * 微信openid
+     */
     private String openid;
 
-    /** 体重 */
+    /**
+     * 体重
+     */
     @Excel(name = "体重")
     private BigDecimal weight;
 
-    /** 微信appid */
+    /**
+     * 微信appid
+     */
     @Excel(name = "微信appid")
     private String appid;
 
-    /** 电话 */
+    /**
+     * 电话
+     */
     @Excel(name = "电话")
     private String phone;
 
-    /** 睡觉时间 */
+    /**
+     * 睡觉时间
+     */
     @Excel(name = "睡觉时间")
     private String sleepTime;
 
-    /** 起床时间 */
+    /**
+     * 起床时间
+     */
     @Excel(name = "起床时间")
     private String wakeupTime;
 
-    /** 运动情况(Y是 N否) */
+    /**
+     * 运动情况(Y是 N否)
+     */
     @Excel(name = "运动情况", readConverterExp = "Y=是,N=否")
     private String sport;
 
-    /** 用户头像 */
+    private String sportDesc;
+
+    /**
+     * 用户头像
+     */
     @Excel(name = "用户头像")
     private String avatarUrl;
 
-    /** 饮食情况(Y是 N否) */
+    /**
+     * 饮食情况(Y是 N否)
+     */
     @Excel(name = "饮食情况", readConverterExp = "Y=是,N=否")
     private String diet;
 
-    /** 熬夜失眠(Y是 N否) */
+    /**
+     * 熬夜失眠(Y是 N否)
+     */
     @Excel(name = "熬夜失眠", readConverterExp = "Y=是,N=否")
     private String insomnia;
 
-    /** 排便情况(Y是 N否) */
+    /**
+     * 排便情况(Y是 N否)
+     */
     @Excel(name = "排便情况", readConverterExp = "Y=是,N=否")
     private String defecation;
 
-    /** 饮水量 */
+    public void setDefecation(String defecation) {
+        if (StringUtils.isAlpha(defecation)) {
+//            this.defecation = defecation.equals("Y") ? "是" : "否";
+            this.defecation = defecation.equals("Y") ? "顺畅" : "其他";
+        } else {
+            this.defecation = defecation;
+        }
+    }
+
+    private String defecationDesc;
+
+    /**
+     * 饮水量
+     */
     @Excel(name = "饮水量")
     private Long water;
 
@@ -94,67 +129,101 @@ public class SysWxUserLog extends BaseEntity
     @Excel(name = "营养师")
     private String nutritionist;
 
-    /** 情绪 */
+    /**
+     * 情绪
+     */
     @Excel(name = "情绪")
     private String emotion;
 
-    /** 食谱之外的食物 */
+    private String emotionDesc;
+
+    /**
+     * 食谱之外的食物
+     */
     @Excel(name = "食谱之外的食物")
     private String slyEatFood;
 
-    /** 是否便秘(Y是 N否) */
+    /**
+     * 是否便秘(Y是 N否)
+     */
     @Excel(name = "是否便秘", readConverterExp = "Y=是,N=否")
     private String constipation;
 
-    /** 食材描述 */
+    /**
+     * 食材描述
+     */
     @Excel(name = "食材描述")
-    private String ingredientDescribe;
+    private String ingredientDesc;
 
-    /** 早餐照片 */
+    /**
+     * 早餐照片
+     */
     @Excel(name = "早餐照片")
     private String breakfastImages;
 
-    /** 午餐照片 */
+    /**
+     * 午餐照片
+     */
     @Excel(name = "午餐照片")
     private String lunchImages;
 
-    /** 午餐照片 */
+    /**
+     * 午餐照片
+     */
     @Excel(name = "午餐照片")
     private String dinnerImages;
 
-    /** 加餐照片 */
+    /**
+     * 加餐照片
+     */
     @Excel(name = "加餐照片")
     private String extraMealImages;
 
-    /** 体型对比照 */
+    /**
+     * 体型对比照
+     */
     @Excel(name = "体型对比照")
     private String bodyImages;
 
-    /** 服务建议 */
+    /**
+     * 服务建议
+     */
     @Excel(name = "服务建议")
     private String suggest;
 
-    /** 目标体重 */
+    /**
+     * 目标体重
+     */
     @Excel(name = "目标体重")
     private BigDecimal targetWeight;
 
-    /** 执行评分,五分制 */
+    /**
+     * 执行评分,五分制
+     */
     @Excel(name = "执行评分,五分制")
     private BigDecimal executionScore;
 
-    /** 点评 */
+    /**
+     * 点评
+     */
     @Excel(name = "点评")
     private String comment;
 
-    /** 点赞数量 */
+    /**
+     * 点赞数量
+     */
     @Excel(name = "点赞数量")
     private Long thumbsupNum;
 
-    /** 健康宣言 */
+    /**
+     * 健康宣言
+     */
     @Excel(name = "健康宣言")
     private String healthManifesto;
 
-    /** 删除标识 0未删除 1已删除 */
+    /**
+     * 删除标识 0未删除 1已删除
+     */
     private Long delFlag;
 
     //售后营养师ID
@@ -166,4 +235,16 @@ public class SysWxUserLog extends BaseEntity
 
     //图片预览路径
     private Map<String, List<String>> imagesUrl;
+
+    private Date createTime;
+
+    private String createBy;
+
+    private Date updateTime;
+
+    private String updateBy;
+
+    private Date beginTime;
+
+    private Date endTime;
 }
\ No newline at end of file
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/page/WxLogInfo.java b/stdiet-custom/src/main/java/com/stdiet/custom/page/WxLogInfo.java
index f16af162b..ac730b673 100644
--- a/stdiet-custom/src/main/java/com/stdiet/custom/page/WxLogInfo.java
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/page/WxLogInfo.java
@@ -1,6 +1,7 @@
 package com.stdiet.custom.page;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.stdiet.common.utils.StringUtils;
 import lombok.Data;
 
 import java.math.BigDecimal;
@@ -115,7 +116,12 @@ public class WxLogInfo {
     private String healthManifesto;
 
     public void setDefecation(String defecation) {
-        this.defecation = defecation.equals("Y") ? "是" : "否";
+        if (StringUtils.isAlpha(defecation)) {
+//            this.defecation = defecation.equals("Y") ? "是" : "否";
+            this.defecation = defecation.equals("Y") ? "顺畅" : "其他";
+        } else {
+            this.defecation = defecation;
+        }
     }
 
     public void setDiet(String diet) {
diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysWxUserLogMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysWxUserLogMapper.xml
index 7562a6bbf..bfb4944fb 100644
--- a/stdiet-custom/src/main/resources/mapper/custom/SysWxUserLogMapper.xml
+++ b/stdiet-custom/src/main/resources/mapper/custom/SysWxUserLogMapper.xml
@@ -15,10 +15,12 @@
         <result property="wakeupTime" column="wakeup_time"/>
         <result property="sleepTime" column="sleep_time"/>
         <result property="sport" column="sport"/>
+        <result property="sportDesc" column="sport_desc"/>
         <result property="avatarUrl" column="avatar_url"/>
         <result property="diet" column="diet"/>
         <result property="insomnia" column="insomnia"/>
         <result property="defecation" column="defecation"/>
+        <result property="defecationDesc" column="defecation_desc"/>
         <result property="water" column="water"/>
         <result property="createBy" column="create_by"/>
         <result property="createTime" column="create_time"/>
@@ -26,9 +28,10 @@
         <result property="updateTime" column="update_time"/>
         <result property="remark" column="remark"/>
         <result property="emotion" column="emotion"/>
+        <result property="emotionDesc" column="emotion_desc"/>
         <result property="slyEatFood" column="sly_eat_food"/>
         <result property="constipation" column="constipation"/>
-        <result property="ingredientDescribe" column="ingredient_describe"/>
+        <result property="ingredientDesc" column="ingredient_desc"/>
         <result property="breakfastImages" column="breakfast_images"/>
         <result property="lunchImages" column="lunch_images"/>
         <result property="dinnerImages" column="dinner_images"/>
@@ -54,16 +57,19 @@
         <result property="sleepTime" column="sleep_time"/>
         <result property="wakeupTime" column="wakeup_time"/>
         <result property="sport" column="sport"/>
+        <result property="sportDesc" column="sport_desc"/>
         <result property="diet" column="diet"/>
         <result property="insomnia" column="insomnia"/>
         <result property="defecation" column="defecation"/>
+        <result property="defecationDesc" column="defecation_desc"/>
         <result property="water" column="water"/>
         <result property="date" column="log_time"/>
         <result property="emotion" column="emotion"/>
+        <result property="emotionDesc" column="emotion_desc"/>
         <result property="slyEatFood" column="sly_eat_food"/>
         <result property="constipation" column="constipation"/>
         <result property="remark" column="remark"/>
-        <result property="ingredientDescribe" column="ingredient_describe"/>
+        <result property="ingredientDesc" column="ingredient_desc"/>
 <!--        <result property="breakfastImages" column="breakfast_images"/>-->
         <result property="breakfastImagesUrl" column="breakfast_images" typeHandler="com.stdiet.custom.typehandler.ImagesHandler"/>
 <!--        <result property="lunchImages" column="lunch_images"/>-->
@@ -83,8 +89,8 @@
     </resultMap>
 
     <sql id="selectSysWxUserLogVo">
-        select id,openid, weight, appid, phone, log_time, sleep_time, wakeup_time, sport, avatar_url, diet, insomnia, defecation, water, create_by, create_time, update_by, update_time, remark,
-         emotion,sly_eat_food,constipation,ingredient_describe,breakfast_images,lunch_images,dinner_images,extra_meal_images,body_images,suggest,execution_score,comment,health_manifesto
+        select id,openid, weight, appid, phone, log_time, sleep_time, wakeup_time, sport, sport_desc, avatar_url, diet, insomnia, defecation, defecation_desc, water, create_by, create_time, update_by, update_time, remark,
+         emotion, emotion_desc,sly_eat_food,constipation,ingredient_desc,breakfast_images,lunch_images,dinner_images,extra_meal_images,body_images,suggest,execution_score,comment,health_manifesto
          from sys_wx_user_log
     </sql>
 
@@ -96,8 +102,9 @@
     <select id="selectSysWxUserLogList" 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.water, wxlog.insomnia,wxlog.sport,wxlog.diet,wxlog.remark,
-        wxlog.emotion,wxlog.sly_eat_food,wxlog.constipation,wxlog.ingredient_describe,wxlog.breakfast_images,wxlog.lunch_images,wxlog.dinner_images,wxlog.extra_meal_images,wxlog.body_images,
+        wxlog.wakeup_time,wxlog.defecation, wxlog.defecation_desc, wxlog.water, wxlog.insomnia,wxlog.sport, wxlog.sport_desc,wxlog.diet,wxlog.remark,
+        wxlog.emotion, 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.suggest,wxlog.execution_score,wxlog.comment,sc.name as customer_name, su.nick_name as nutritionist,
         su_atferSale.nick_name as after_nutritionist, wxlog.health_manifesto, wxlog.log_time
         FROM sys_wx_user_log wxlog
@@ -163,10 +170,12 @@
             <if test="sleepTime != null">sleep_time,</if>
             <if test="wakeupTime != null">wakeup_time,</if>
             <if test="sport != null">sport,</if>
+            <if test="sportDesc != null">sport_desc,</if>
             <if test="avatarUrl != null">avatar_url,</if>
             <if test="diet != null">diet,</if>
             <if test="insomnia != null">insomnia,</if>
             <if test="defecation != null">defecation,</if>
+            <if test="defecationDesc != null">defecation_desc,</if>
             <if test="water != null">water,</if>
             <if test="createBy != null">create_by,</if>
             <if test="true">create_time,</if>
@@ -174,9 +183,10 @@
             <if test="true">update_time,</if>
             <if test="remark != null">remark,</if>
             <if test="emotion != null">emotion,</if>
+            <if test="emotionDesc != null">emotion_desc,</if>
             <if test="slyEatFood != null">sly_eat_food,</if>
             <if test="constipation != null">constipation,</if>
-            <if test="ingredientDescribe != null">ingredient_describe,</if>
+            <if test="ingredientDesc != null">ingredient_desc,</if>
             <if test="breakfastImages != null">breakfast_images,</if>
             <if test="lunchImages != null">lunch_images,</if>
             <if test="dinnerImages != null">dinner_images,</if>
@@ -199,10 +209,12 @@
             <if test="sleepTime != null">#{sleepTime},</if>
             <if test="wakeupTime != null">#{wakeupTime},</if>
             <if test="sport != null">#{sport},</if>
+            <if test="sportDesc != null">#{sportDesc},</if>
             <if test="avatarUrl != null">#{avatarUrl},</if>
             <if test="diet != null">#{diet},</if>
             <if test="insomnia != null">#{insomnia},</if>
             <if test="defecation != null">#{defecation},</if>
+            <if test="defecationDesc != null">#{defecationDesc},</if>
             <if test="water != null">#{water},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="true">now(),</if>
@@ -210,9 +222,10 @@
             <if test="true">now(),</if>
             <if test="remark != null">#{remark},</if>
             <if test="emotion != null">#{emotion},</if>
+            <if test="emotionDesc != null">#{emotionDesc},</if>
             <if test="slyEatFood != null">#{slyEatFood},</if>
             <if test="constipation != null">#{constipation},</if>
-            <if test="ingredientDescribe != null">#{ingredientDescribe},</if>
+            <if test="ingredientDesc != null">#{ingredientDesc},</if>
             <if test="breakfastImages != null">#{breakfastImages},</if>
             <if test="lunchImages != null">#{lunchImages},</if>
             <if test="dinnerImages != null">#{dinnerImages},</if>
@@ -238,18 +251,21 @@
             <if test="sleepTime != null">sleep_time = #{sleepTime},</if>
             <if test="wakeupTime != null">wakeup_time = #{wakeupTime},</if>
             <if test="sport != null">sport = #{sport},</if>
+            <if test="sportDesc != null">sport_desc = #{sportDesc},</if>
             <if test="avatarUrl != null">avatar_url = #{avatarUrl},</if>
             <if test="diet != null">diet = #{diet},</if>
             <if test="insomnia != null">insomnia = #{insomnia},</if>
             <if test="defecation != null">defecation = #{defecation},</if>
+            <if test="defecationDesc != null">defecation_desc = #{defecationDesc},</if>
             <if test="water != null">water = #{water},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = now(),</if>
             <if test="remark != null">remark = #{remark},</if>
             <if test="emotion != null">emotion = #{emotion},</if>
+            <if test="emotionDesc != null">emotion_desc = #{emotionDesc},</if>
             <if test="slyEatFood != null">sly_eat_food = #{slyEatFood},</if>
             <if test="constipation != null">constipation = #{constipation},</if>
-            <if test="ingredientDescribe != null">ingredient_describe = #{ingredientDescribe},</if>
+            <if test="ingredientDesc != null">ingredient_desc = #{ingredientDesc},</if>
             <if test="breakfastImages != null">breakfast_images = #{breakfastImages},</if>
             <if test="lunchImages != null">lunch_images = #{lunchImages},</if>
             <if test="dinnerImages != null">dinner_images = #{dinnerImages},</if>
@@ -279,8 +295,8 @@
 
     <!-- 根据openid和手机号查询对应打卡记录 -->
     <select id="getWxLogInfoList" parameterType="SysWxUserLog" resultMap="WxLogInfo">
-        SELECT wxlog.id,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.ingredient_describe,wxlog.breakfast_images,wxlog.lunch_images,wxlog.dinner_images,wxlog.extra_meal_images,wxlog.body_images
+        SELECT wxlog.id,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.emotion, 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.remark,wxlog.execution_score,wxlog.comment, wxlog.health_manifesto
         FROM sys_wx_user_log wxlog
         where wxlog.del_flag = 0 and wxlog.openid = #{openid}
@@ -324,8 +340,8 @@
 
     <!-- 根据openid和手机号查询对应打卡记录 -->
     <select id="getWxLogInfoDetailById" parameterType="SysWxUserLog" resultMap="WxLogInfo">
-        SELECT wxlog.id,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.ingredient_describe,wxlog.breakfast_images,wxlog.lunch_images,wxlog.dinner_images,wxlog.extra_meal_images,wxlog.body_images
+        SELECT wxlog.id,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.emotion, 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.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}
diff --git a/stdiet-ui/src/components/PunchLog/PunchLogDetail/index.vue b/stdiet-ui/src/components/PunchLog/PunchLogDetail/index.vue
index a28a5cb26..2a9cde5be 100644
--- a/stdiet-ui/src/components/PunchLog/PunchLogDetail/index.vue
+++ b/stdiet-ui/src/components/PunchLog/PunchLogDetail/index.vue
@@ -10,28 +10,28 @@
         <div
           style="float: right;  margin-bottom:10px"
         >
-         
-         <el-button 
+
+         <el-button
             v-hasPermi="['custom:wxUserLog:query']"
             type="primary"
             plain
             @click="clickComment()"
             >打卡点评</el-button
           >
-          
-          
+
+
         </div>
         <!-- 打卡信息详情 -->
         <div>
-          
+
             <h3>一、基础信息</h3>
             <TableDetailMessage :data="punchLogDetail"></TableDetailMessage>
             <h3>二、食物以及对比照信息</h3>
             <div style="height: 370px; overflow: auto">
-              <div v-if="punchLog != null && punchLog.ingredientDescribe != null && punchLog.ingredientDescribe != ''">
+              <div v-if="punchLog != null && punchLog.ingredientDesc != null && punchLog.ingredientDesc != ''">
                 <h4>食物描述</h4>
                 <div>
-                  {{punchLog.ingredientDescribe}}
+                  {{punchLog.ingredientDesc}}
                 </div>
               </div>
               <div v-if="punchLog != null && (punchLog.imagesUrl.breakfastImages.length > 0 || punchLog.imagesUrl.lunchImages.length > 0 || punchLog.imagesUrl.dinnerImages.length > 0
@@ -102,7 +102,7 @@
               </div>
             </div>
         </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">
@@ -115,9 +115,9 @@
               >
             </el-rate>
             </el-form-item>
-          
+
           <el-form-item label="点评内容" prop="comment" >
-            
+
             <el-input
               type="textarea"
               :rows="4"
@@ -154,7 +154,7 @@ export default {
       title: "",
       data: null,
       callback: null,
-      punchLog: null,  
+      punchLog: null,
       imageUrl: [],
       punchLogDetail: [],
       //打卡详情的标题,按竖显示
@@ -185,7 +185,7 @@ export default {
     };
   },
   methods: {
-    
+
     // 自定义列背景色
     columnStyle({ row, column, rowIndex, columnIndex }) {
       if (columnIndex % 2 === 0) {
@@ -260,7 +260,7 @@ export default {
         }
         this.commentTitle = "点评「"+this.punchLog.customerName+" "+ this.punchLog.logTime +"」打卡";
         this.commentVisible = true;
-        
+
     },
     commentClosed(){
        this.commentVisible = false;