diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java index 3333e7ca9..22340761d 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java @@ -173,39 +173,14 @@ public class WechatAppletController extends BaseController { * @return */ @GetMapping(value = "/getPunchLogs") - public AjaxResult getPunchLogs(SysWxUserLog sysWxUserLog) { - if (StringUtils.isEmpty(sysWxUserLog.getPhone()) && StringUtils.isEmpty(sysWxUserLog.getOpenid())) { - return AjaxResult.error(5001, "缺少参数"); - } - //查询是否下单 - SysCustomer param = new SysCustomer(); - param.setPhone(sysWxUserLog.getPhone()); - int orderCount = sysOrderService.getOrderCountByCustomer(param); - if (orderCount > 0) { - Map<String, Object> result = new HashMap<>(); - //今日是否已打卡 - boolean isPunch = false; - startPage(); - List<WxLogInfo> list = sysWxUserLogService.getWxLogInfoList(sysWxUserLog); - if (list.size() > 0) { - WxLogInfo lastLog = list.get(0); - if (lastLog.getDate() != null && ChronoUnit.DAYS.between(DateUtils.stringToLocalDate(lastLog.getDate(), "yyyy-MM-dd"), LocalDate.now()) == 0) { - isPunch = true; - } - } + public TableDataInfo getPunchLogs(SysWxUserLog sysWxUserLog) { - /*for (WxLogInfo log : list) { - log.setId(AesUtils.encrypt(log.getId()+"", null)); - }*/ + startPage(); + List<WxLogInfo> list = sysWxUserLogService.getWxLogInfoList(sysWxUserLog); + + + return getDataTable(list); - Collections.reverse(list); - TableDataInfo tableDataInfo = getDataTable(list); - result.put("isPunch", isPunch); - result.put("tableDataInfo", tableDataInfo); - return AjaxResult.success(result); - } else { - return AjaxResult.error(5002, "未查询到相关订单信息"); - } } /** @@ -232,19 +207,19 @@ public class WechatAppletController extends BaseController { @PostMapping(value = "/addPunchLog") public AjaxResult addPunchLog(@RequestBody SysWxUserLog sysWxUserLog) { // 查询微信用户 - SysWxUserInfo userInfo = StringUtils.isEmpty(sysWxUserLog.getOpenid()) ? null : sysWxUserInfoService.selectSysWxUserInfoById(sysWxUserLog.getOpenid()); - if (userInfo == null || StringUtils.isEmpty(userInfo.getPhone())) { - return AjaxResult.error("打卡失败"); - } +// SysWxUserInfo userInfo = StringUtils.isEmpty(sysWxUserLog.getOpenid()) ? null : sysWxUserInfoService.selectSysWxUserInfoById(sysWxUserLog.getOpenid()); +// if (userInfo == null || StringUtils.isEmpty(userInfo.getPhone())) { +// return AjaxResult.error("打卡失败"); +// } if (sysWxUserLog.getId() == null) { - //查询今日是否已打卡 - if (sysWxUserLog.getLogTime() == null) { - sysWxUserLog.setLogTime(new Date()); - } - int count = sysWxUserLogService.checkWxLogInfoCount(sysWxUserLog); - if (count > 0) { - return AjaxResult.error("今日已打卡,不可重复打卡"); - } +// //查询今日是否已打卡 +// if (sysWxUserLog.getLogTime() == null) { +// sysWxUserLog.setLogTime(new Date()); +// } +// int count = sysWxUserLogService.checkWxLogInfoCount(sysWxUserLog); +// if (count > 0) { +// return AjaxResult.error("今日已打卡,不可重复打卡"); +// } return toAjax(sysWxUserLogService.insertSysWxUserLog(sysWxUserLog)); } else { return toAjax(sysWxUserLogService.updateSysWxUserLog(sysWxUserLog)); @@ -265,42 +240,14 @@ public class WechatAppletController extends BaseController { 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(imageName[0], breakfastImagesUrlList); - List<String> lunchImagesUrlList = StringUtils.isNotEmpty(sysWxUserLog.getLunchImages()) ? Arrays.asList(sysWxUserLog.getLunchImages().split("\\|")) : new ArrayList<>(); - imageUrlMap.put(imageName[1], lunchImagesUrlList); - - List<String> dinnerImagesUrlList = StringUtils.isNotEmpty(sysWxUserLog.getDinnerImages()) ? Arrays.asList(sysWxUserLog.getDinnerImages().split("\\|")) : new ArrayList<>(); - imageUrlMap.put(imageName[2], dinnerImagesUrlList); - - List<String> extraMealImagesUrlList = StringUtils.isNotEmpty(sysWxUserLog.getExtraMealImages()) ? Arrays.asList(sysWxUserLog.getExtraMealImages().split("\\|")) : new ArrayList<>(); - imageUrlMap.put(imageName[3], extraMealImagesUrlList); - - List<String> bodyImagesUrlList = StringUtils.isNotEmpty(sysWxUserLog.getBodyImages()) ? Arrays.asList(sysWxUserLog.getBodyImages().split("\\|")) : new ArrayList<>(); - imageUrlMap.put(imageName[4], bodyImagesUrlList); - - //生成预览链接 - Map<String, List<String>> downUrlList = AliyunOSSUtils.generatePresignedUrl(imageUrlMap); - - sysWxUserLog.setBreakfastImagesUrl(downUrlList.get(imageName[0])); - sysWxUserLog.setLunchImagesUrl(downUrlList.get(imageName[1])); - sysWxUserLog.setDinnerImagesUrl(downUrlList.get(imageName[2])); - sysWxUserLog.setExtraMealImagesUrl(downUrlList.get(imageName[3])); - sysWxUserLog.setBodyImagesUrl(downUrlList.get(imageName[4])); - - List<String> allImagesList = new ArrayList<>(); List<String> allUrlList = new ArrayList<>(); - - for (String key : imageName) { - if (!"bodyImages".equals(key)) { - allUrlList.addAll(downUrlList.get(key)); - allImagesList.addAll(imageUrlMap.get(key)); - } - } + allUrlList.addAll(sysWxUserLog.getBreakfastImagesUrl()); + allUrlList.addAll(sysWxUserLog.getLunchImagesUrl()); + allUrlList.addAll(sysWxUserLog.getDinnerImagesUrl()); + allUrlList.addAll(sysWxUserLog.getExtraMealImagesUrl()); sysWxUserLog.setAllImagesUrl(allUrlList); - sysWxUserLog.setAllImages(StringUtils.join(allImagesList, "|")); + sysWxUserLog.setAllImages(StringUtils.join(allUrlList, "|")); return AjaxResult.success(sysWxUserLog); } @@ -811,26 +758,27 @@ public class WechatAppletController extends BaseController { /** * 打卡社区点赞 + * * @return */ @PostMapping("/thumbsupPunch") public AjaxResult getCommunityPunch(@RequestBody SysPunchThumbsup sysPunchThumbsup) { - if(StringUtils.isEmpty(sysPunchThumbsup.getCusOpenid(),sysPunchThumbsup.getEncPunchId()) || sysPunchThumbsup.getThumbsupFlag() == null){ + if (StringUtils.isEmpty(sysPunchThumbsup.getCusOpenid(), sysPunchThumbsup.getEncPunchId()) || sysPunchThumbsup.getThumbsupFlag() == null) { return AjaxResult.error("缺少必要参数"); } sysPunchThumbsup.setPunchId(Long.parseLong(AesUtils.decrypt(sysPunchThumbsup.getEncPunchId()))); SysPunchThumbsup existPunchThumbsup = sysPunchThumbsupService.getThumbsupByPunchIdAndOpenid(sysPunchThumbsup); - if(existPunchThumbsup != null && sysPunchThumbsup.getThumbsupFlag()){ + if (existPunchThumbsup != null && sysPunchThumbsup.getThumbsupFlag()) { return AjaxResult.error("已点过暂,无法重复点赞"); } - if(existPunchThumbsup == null && !sysPunchThumbsup.getThumbsupFlag()){ + if (existPunchThumbsup == null && !sysPunchThumbsup.getThumbsupFlag()) { return AjaxResult.error("还未未点赞,无法取消点赞"); } int row = 0; - try{ + try { row = sysPunchThumbsup.getThumbsupFlag() ? sysPunchThumbsupService.insertSysPunchThumbsup(sysPunchThumbsup) : sysPunchThumbsupService.deleteThumbsupByPunchIdAndOpenid(sysPunchThumbsup); - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } return toAjax(row); 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 19f763858..f16af162b 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,20 +1,18 @@ package com.stdiet.custom.page; -import com.stdiet.common.annotation.Excel; -import com.stdiet.common.utils.DateUtils; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; -import java.io.Serializable; import java.math.BigDecimal; -import java.util.ArrayList; import java.util.Date; import java.util.List; -public class WxLogInfo implements Serializable { - private static final long serialVersionUID = 1L; - +@Data +public class WxLogInfo { private Long id; - private String date; + @JsonFormat(pattern = "yyyy-MM-dd") + private Date date; private Long water; @@ -34,46 +32,72 @@ public class WxLogInfo implements Serializable { private String remark; - /** 情绪 */ + /** + * 情绪 + */ private String emotion; - /** 食谱之外的食物 */ + /** + * 食谱之外的食物 + */ private String slyEatFood; - /** 是否便秘(Y是 N否) */ + /** + * 是否便秘(Y是 N否) + */ private String constipation; - /** 食材描述 */ + /** + * 食材描述 + */ private String ingredientDescribe; //全部食材照片 private String allImages; - /** 早餐照片 */ - private String breakfastImages; + /** + * 早餐照片 + */ +// private String breakfastImages; - /** 午餐照片 */ - private String lunchImages; + /** + * 午餐照片 + */ +// private String lunchImages; - /** 午餐照片 */ - private String dinnerImages; + /** + * 午餐照片 + */ +// private String dinnerImages; - /** 加餐照片 */ - private String extraMealImages; + /** + * 加餐照片 + */ +// private String extraMealImages; - /** 体型对比照 */ - private String bodyImages; + /** + * 体型对比照 + */ +// private String bodyImages; - /** 服务建议 */ + /** + * 服务建议 + */ private String suggest; - /** 目标体重 */ + /** + * 目标体重 + */ private BigDecimal targetWeight; - /** 执行评分,五分制 */ + /** + * 执行评分,五分制 + */ private BigDecimal executionScore; - /** 点评 */ + /** + * 点评 + */ private String comment; private List<String> allImagesUrl; @@ -88,266 +112,26 @@ public class WxLogInfo implements Serializable { private List<String> bodyImagesUrl; - public String getDate() { - return date; - } + private String healthManifesto; - public String getDefecation() { - return defecation; - } - - public String getDiet() { - return diet; - } - - public String getSleepTime() { - return sleepTime; - } - - public Long getWater() { - return water; - } - - public String getInsomnia() { - return insomnia; - } - - public String getSport() { - return sport; - } - - public String getWakeupTime() { - return wakeupTime; - } - - public BigDecimal getWeight() { - return weight; - } - - public void setWeight(BigDecimal weight) { - this.weight = weight; - } - - public void setDate(Date date) { - this.date = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, date); + public void setDefecation(String defecation) { + this.defecation = defecation.equals("Y") ? "是" : "否"; } public void setDiet(String diet) { - this.diet = diet == "Y" ? "是" : "否"; - } - - public void setWater(Long water) { - this.water = water; - } - - public void setWakeupTime(String wakeupTime) { - this.wakeupTime = wakeupTime; - } - - public void setDefecation(String defecation) { - this.defecation = defecation == "Y" ? "是" : "否"; - } - - public void setSport(String sport) { - this.sport = sport == "Y" ? "是" : "否"; + this.diet = diet.equals("Y") ? "是" : "否"; } public void setInsomnia(String insomnia) { - this.insomnia = insomnia == "Y" ? "是" : "否"; + this.insomnia = insomnia.equals("Y") ? "是" : "否"; } - public void setSleepTime(String sleepTime) { - this.sleepTime = sleepTime; - } - - public String getEmotion() { - return emotion; - } - - public void setEmotion(String emotion) { - this.emotion = emotion; - } - - public String getSlyEatFood() { - return slyEatFood; - } - - public void setSlyEatFood(String slyEatFood) { - this.slyEatFood = slyEatFood; - } - - public String getConstipation() { - return constipation; + public void setSport(String sport) { + this.sport = sport.equals("Y") ? "是" : "否"; } public void setConstipation(String constipation) { - this.constipation = constipation == "Y" ? "是" : "否"; + this.constipation = constipation.equals("Y") ? "是" : "否"; } - public String getBreakfastImages() { - return breakfastImages; - } - - public void setBreakfastImages(String breakfastImages) { - this.breakfastImages = breakfastImages; - } - - public String getLunchImages() { - return lunchImages; - } - - public void setLunchImages(String lunchImages) { - this.lunchImages = lunchImages; - } - - public String getDinnerImages() { - return dinnerImages; - } - - public void setDinnerImages(String dinnerImages) { - this.dinnerImages = dinnerImages; - } - - public String getExtraMealImages() { - return extraMealImages; - } - - public void setExtraMealImages(String extraMealImages) { - this.extraMealImages = extraMealImages; - } - - public String getBodyImages() { - return bodyImages; - } - - public void setBodyImages(String bodyImages) { - this.bodyImages = bodyImages; - } - - public String getSuggest() { - return suggest; - } - - public void setSuggest(String suggest) { - this.suggest = suggest; - } - - public BigDecimal getTargetWeight() { - return targetWeight; - } - - public void setTargetWeight(BigDecimal targetWeight) { - this.targetWeight = targetWeight; - } - - public BigDecimal getExecutionScore() { - return executionScore; - } - - public void setExecutionScore(BigDecimal executionScore) { - this.executionScore = executionScore; - } - - public String getComment() { - return comment; - } - - public void setComment(String comment) { - this.comment = comment; - } - - public List<String> getBreakfastImagesUrl() { - return breakfastImagesUrl; - } - - public void setBreakfastImagesUrl(List<String> breakfastImagesUrl) { - this.breakfastImagesUrl = breakfastImagesUrl; - } - - public List<String> getLunchImagesUrl() { - return lunchImagesUrl; - } - - public void setLunchImagesUrl(List<String> lunchImagesUrl) { - this.lunchImagesUrl = lunchImagesUrl; - } - - public List<String> getDinnerImagesUrl() { - return dinnerImagesUrl; - } - - public void setDinnerImagesUrl(List<String> dinnerImagesUrl) { - this.dinnerImagesUrl = dinnerImagesUrl; - } - - public List<String> getExtraMealImagesUrl() { - return extraMealImagesUrl; - } - - public void setExtraMealImagesUrl(List<String> extraMealImagesUrl) { - this.extraMealImagesUrl = extraMealImagesUrl; - } - - public List<String> getBodyImagesUrl() { - return bodyImagesUrl; - } - - public void setBodyImagesUrl(List<String> bodyImagesUrl) { - this.bodyImagesUrl = bodyImagesUrl; - } - - public String getRemark() { - return remark; - } - - public void setRemark(String remark) { - this.remark = remark; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getIngredientDescribe() { - return ingredientDescribe; - } - - public void setIngredientDescribe(String ingredientDescribe) { - this.ingredientDescribe = ingredientDescribe; - } - - public List<String> getAllImagesUrl() { - return this.allImagesUrl; - } - - public void setAllImagesUrl(List<String> allImagesUrl) { - this.allImagesUrl = allImagesUrl; - } - - public String getAllImages() { - return this.allImages; - } - - public void setAllImages(String allImages) { - this.allImages = allImages; - } - - @Override - public String toString() { - return "WxLogInfo{" + - "date='" + date + '\'' + - ", water='" + water + '\'' + - ", sleepTime='" + sleepTime + '\'' + - ", wakeupTime='" + wakeupTime + '\'' + - ", sport='" + sport + '\'' + - ", weight='" + weight + '\'' + - ", diet='" + diet + '\'' + - ", insomnia='" + insomnia + '\'' + - ", defecation='" + defecation + '\'' + - '}'; - } } diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysWxUserLogServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysWxUserLogServiceImpl.java index 3100965e4..72a8a2e6e 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysWxUserLogServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysWxUserLogServiceImpl.java @@ -67,7 +67,6 @@ public class SysWxUserLogServiceImpl implements ISysWxUserLogService { */ @Override public int insertSysWxUserLog(SysWxUserLog sysWxUserLog) { - sysWxUserLog.setCreateTime(DateUtils.getNowDate()); return sysWxUserLogMapper.insertSysWxUserLog(sysWxUserLog); } @@ -79,7 +78,6 @@ public class SysWxUserLogServiceImpl implements ISysWxUserLogService { */ @Override public int updateSysWxUserLog(SysWxUserLog sysWxUserLog) { - sysWxUserLog.setUpdateTime(DateUtils.getNowDate()); return sysWxUserLogMapper.updateSysWxUserLog(sysWxUserLog); } diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/typehandler/ImagesHandler.java b/stdiet-custom/src/main/java/com/stdiet/custom/typehandler/ImagesHandler.java new file mode 100644 index 000000000..d444ceb7d --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/typehandler/ImagesHandler.java @@ -0,0 +1,53 @@ +package com.stdiet.custom.typehandler; + +import com.google.api.client.repackaged.com.google.common.base.Joiner; +import com.stdiet.common.utils.StringUtils; +import com.stdiet.common.utils.oss.AliyunOSSUtils; +import org.apache.ibatis.type.BaseTypeHandler; +import org.apache.ibatis.type.JdbcType; +import org.apache.ibatis.type.MappedJdbcTypes; +import org.apache.ibatis.type.MappedTypes; + +import java.sql.CallableStatement; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +@MappedTypes({List.class}) +@MappedJdbcTypes({JdbcType.VARCHAR}) +public class ImagesHandler extends BaseTypeHandler<List<String>> { + + @Override + public void setNonNullParameter(PreparedStatement preparedStatement, int i, List<String> strings, JdbcType jdbcType) throws SQLException { + String str = Joiner.on("\\|").skipNulls().join(strings); + preparedStatement.setString(i, str); + } + + @Override + public List<String> getNullableResult(ResultSet resultSet, String s) throws SQLException { + return this.stringToList(resultSet.getString(s)); + } + + @Override + public List<String> getNullableResult(ResultSet resultSet, int i) throws SQLException { + return this.stringToList(resultSet.getString(i)); + } + + @Override + public List<String> getNullableResult(CallableStatement callableStatement, int i) throws SQLException { + return this.stringToList(callableStatement.getString(i)); + } + + private List<String> stringToList(String string) { + List<String> list = new ArrayList<>(); + if (StringUtils.isNotEmpty(string)) { + String[] urls = string.split("\\|"); + for (String url : urls) { + list.add(AliyunOSSUtils.generatePresignedUrl(url)); + } + } + return list; + } +} diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysWxUserLogMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysWxUserLogMapper.xml index faed261e5..7ed3de323 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysWxUserLogMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysWxUserLogMapper.xml @@ -5,7 +5,7 @@ <mapper namespace="com.stdiet.custom.mapper.SysWxUserLogMapper"> <resultMap type="SysWxUserLog" id="SysWxUserLogResult"> - <result property="id" column="id" /> + <result property="id" column="id"/> <result property="openid" column="openid"/> <result property="weight" column="weight"/> <result property="appid" column="appid"/> @@ -25,22 +25,22 @@ <result property="updateBy" column="update_by"/> <result property="updateTime" column="update_time"/> <result property="remark" column="remark"/> - <result property="emotion" column="emotion" /> - <result property="slyEatFood" column="sly_eat_food" /> - <result property="constipation" column="constipation" /> - <result property="ingredientDescribe" column="ingredient_describe" /> - <result property="breakfastImages" column="breakfast_images" /> - <result property="lunchImages" column="lunch_images" /> - <result property="dinnerImages" column="dinner_images" /> - <result property="extraMealImages" column="extra_meal_images" /> - <result property="bodyImages" column="body_images" /> - <result property="suggest" column="suggest" /> - <result property="targetWeight" column="target_weight" /> - <result property="executionScore" column="execution_score" /> - <result property="comment" column="comment" /> - <result property="thumbsupNum" column="thumbsup_num" /> - <result property="healthManifesto" column="health_manifesto" /> - <result property="delFlag" column="del_flag" /> + <result property="emotion" column="emotion"/> + <result property="slyEatFood" column="sly_eat_food"/> + <result property="constipation" column="constipation"/> + <result property="ingredientDescribe" column="ingredient_describe"/> + <result property="breakfastImages" column="breakfast_images"/> + <result property="lunchImages" column="lunch_images"/> + <result property="dinnerImages" column="dinner_images"/> + <result property="extraMealImages" column="extra_meal_images"/> + <result property="bodyImages" column="body_images"/> + <result property="suggest" column="suggest"/> + <result property="targetWeight" column="target_weight"/> + <result property="executionScore" column="execution_score"/> + <result property="comment" column="comment"/> + <result property="thumbsupNum" column="thumbsup_num"/> + <result property="healthManifesto" column="health_manifesto"/> + <result property="delFlag" column="del_flag"/> <!-- 非持久字段 --> <result property="customerName" column="customer_name"></result> <!-- 营养师 --> @@ -49,7 +49,7 @@ </resultMap> <resultMap type="com.stdiet.custom.page.WxLogInfo" id="WxLogInfo"> - <result property="id" column="id" /> + <result property="id" column="id"/> <result property="weight" column="weight"/> <result property="sleepTime" column="sleep_time"/> <result property="wakeupTime" column="wakeup_time"/> @@ -59,27 +59,32 @@ <result property="defecation" column="defecation"/> <result property="water" column="water"/> <result property="date" column="log_time"/> - <result property="emotion" column="emotion" /> - <result property="slyEatFood" column="sly_eat_food" /> - <result property="constipation" column="constipation" /> - <result property="remark" column="remark"></result> - <result property="ingredientDescribe" column="ingredient_describe" /> - <result property="breakfastImages" column="breakfast_images" /> - <result property="lunchImages" column="lunch_images" /> - <result property="dinnerImages" column="dinner_images" /> - <result property="extraMealImages" column="extra_meal_images" /> - <result property="bodyImages" column="body_images" /> - <result property="suggest" column="suggest" /> - <result property="targetWeight" column="target_weight" /> - <result property="executionScore" column="execution_score" /> - <result property="comment" column="comment" /> - <result property="thumbsupNum" column="thumbsup_num" /> - <result property="healthManifesto" column="health_manifesto" /> + <result property="emotion" column="emotion"/> + <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="breakfastImages" column="breakfast_images"/>--> + <result property="breakfastImagesUrl" column="breakfast_images" typeHandler="com.stdiet.custom.typehandler.ImagesHandler"/> +<!-- <result property="lunchImages" column="lunch_images"/>--> + <result property="lunchImagesUrl" column="lunch_images" typeHandler="com.stdiet.custom.typehandler.ImagesHandler"/> +<!-- <result property="dinnerImages" column="dinner_images"/>--> + <result property="dinnerImagesUrl" column="dinner_images" typeHandler="com.stdiet.custom.typehandler.ImagesHandler"/> +<!-- <result property="extraMealImages" column="extra_meal_images"/>--> + <result property="extraMealImagesUrl" column="extra_meal_images" typeHandler="com.stdiet.custom.typehandler.ImagesHandler"/> +<!-- <result property="bodyImages" column="body_images"/>--> + <result property="bodyImagesUrl" column="body_images" typeHandler="com.stdiet.custom.typehandler.ImagesHandler"/> + <result property="suggest" column="suggest"/> + <result property="targetWeight" column="target_weight"/> + <result property="executionScore" column="execution_score"/> + <result property="comment" column="comment"/> + <result property="thumbsupNum" column="thumbsup_num"/> + <result property="healthManifesto" column="health_manifesto"/> </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 + emotion,sly_eat_food,constipation,ingredient_describe,breakfast_images,lunch_images,dinner_images,extra_meal_images,body_images,suggest,execution_score,comment,health_manifesto from sys_wx_user_log </sql> @@ -89,11 +94,14 @@ <!-- 后台查询 --> <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, + 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.suggest,wxlog.execution_score,wxlog.comment,sc.name as customer_name, su.nick_name as nutritionist, su_atferSale.nick_name as after_nutritionist + 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 - left join sys_wx_user_info wxinfo on wxinfo.openid = wxlog.openid + left join sys_wx_user_info wxinfo on wxinfo.openid = wxlog.openid left join sys_customer sc on sc.phone = wxinfo.phone and sc.del_flag = 0 left join sys_user su on su.user_id = sc.main_dietitian and su.del_flag = '0' left join sys_user su_atferSale on su_atferSale.user_id = sc.after_dietitian and su_atferSale.del_flag = '0' @@ -104,7 +112,9 @@ <if test="customerId != null"> and sc.id = #{customerId} </if> - <if test="phone != null and phone != ''">and (sc.name like concat('%',#{phone},'%') or wxinfo.phone like concat('%',#{phone},'%') )</if> + <if test="phone != null and phone != ''">and (sc.name like concat('%',#{phone},'%') or wxinfo.phone like + concat('%',#{phone},'%') ) + </if> <if test="appid != null"> and wxinfo.appid = #{appid} </if> @@ -114,8 +124,12 @@ <if test="afterNutritionistId != null"> and su_atferSale.user_id = #{afterNutritionistId} </if> - <if test="beginTime != null and beginTime != ''">and date_format(wxlog.log_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')</if> - <if test="endTime != null and endTime != ''">and date_format(wxlog.log_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')</if> + <if test="beginTime != null and beginTime != ''">and date_format(wxlog.log_time,'%y%m%d') >= + date_format(#{beginTime},'%y%m%d') + </if> + <if test="endTime != null and endTime != ''">and date_format(wxlog.log_time,'%y%m%d') <= + date_format(#{endTime},'%y%m%d') + </if> order by wxlog.log_time desc </select> @@ -145,7 +159,7 @@ <if test="weight != null">weight,</if> <if test="appid != null">appid,</if> <if test="phone != null">phone,</if> - <if test="logTime != null">log_time,</if> + <if test="true">log_time,</if> <if test="sleepTime != null">sleep_time,</if> <if test="wakeupTime != null">wakeup_time,</if> <if test="sport != null">sport,</if> @@ -155,9 +169,9 @@ <if test="defecation != null">defecation,</if> <if test="water != null">water,</if> <if test="createBy != null">create_by,</if> - <if test="createTime != null">create_time,</if> + <if test="true">create_time,</if> <if test="updateBy != null">update_by,</if> - <if test="updateTime != null">update_time,</if> + <if test="true">update_time,</if> <if test="remark != null">remark,</if> <if test="emotion != null">emotion,</if> <if test="slyEatFood != null">sly_eat_food,</if> @@ -181,7 +195,7 @@ <if test="weight != null">#{weight},</if> <if test="appid != null">#{appid},</if> <if test="phone != null">#{phone},</if> - <if test="logTime != null">#{logTime},</if> + <if test="true">now(),</if> <if test="sleepTime != null">#{sleepTime},</if> <if test="wakeupTime != null">#{wakeupTime},</if> <if test="sport != null">#{sport},</if> @@ -191,9 +205,9 @@ <if test="defecation != null">#{defecation},</if> <if test="water != null">#{water},</if> <if test="createBy != null">#{createBy},</if> - <if test="createTime != null">#{createTime},</if> + <if test="true">now(),</if> <if test="updateBy != null">#{updateBy},</if> - <if test="updateTime != null">#{updateTime},</if> + <if test="true">now(),</if> <if test="remark != null">#{remark},</if> <if test="emotion != null">#{emotion},</if> <if test="slyEatFood != null">#{slyEatFood},</if> @@ -221,7 +235,6 @@ <if test="weight != null">weight = #{weight},</if> <if test="appid != null">appid = #{appid},</if> <if test="phone != null">phone = #{phone},</if> - <if test="logTime != null">log_time = #{logTime},</if> <if test="sleepTime != null">sleep_time = #{sleepTime},</if> <if test="wakeupTime != null">wakeup_time = #{wakeupTime},</if> <if test="sport != null">sport = #{sport},</if> @@ -230,10 +243,8 @@ <if test="insomnia != null">insomnia = #{insomnia},</if> <if test="defecation != null">defecation = #{defecation},</if> <if test="water != null">water = #{water},</if> - <if test="createBy != null">create_by = #{createBy},</if> - <if test="createTime != null">create_time = #{createTime},</if> <if test="updateBy != null">update_by = #{updateBy},</if> - <if test="updateTime != null">update_time = #{updateTime},</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="slyEatFood != null">sly_eat_food = #{slyEatFood},</if> @@ -260,7 +271,7 @@ </update> <update id="deleteSysWxUserLogByIds" parameterType="String"> - update sys_wx_user_log set del_flag = 1 where id in + update sys_wx_user_log set del_flag = 1 where id in <foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach> @@ -270,13 +281,13 @@ <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 - ,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 + ,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} + order by wxlog.log_time asc </select> - <select id="selectSysWxUserLogByDateAndOpenId" parameterType="SysWxUserLog" resultMap="SysWxUserLogResult"> + <select id="selectSysWxUserLogByDateAndOpenId" parameterType="SysWxUserLog" resultMap="SysWxUserLogResult"> select id from sys_wx_user_log where del_flag = 0 and to_days(log_time) = to_days(#{logTime}) and openid = #{openid} limit 1 </select> @@ -299,11 +310,15 @@ <!-- 后台根据用户ID查询该用户的打卡体重 --> <select id="getWxUserLogListByCustomerId" parameterType="SysWxUserLog" resultMap="SysWxUserLogResult"> SELECT wxlog.id,wxlog.log_time,wxlog.weight FROM sys_wx_user_log wxlog - left join sys_wx_user_info wxinfo on wxinfo.openid = wxlog.openid + left join sys_wx_user_info wxinfo on wxinfo.openid = wxlog.openid left join sys_customer sc on sc.phone = wxinfo.phone and sc.del_flag = 0 where wxlog.del_flag = 0 and wxinfo.phone is not null and sc.id = #{customerId} - <if test="beginTime != null and beginTime != ''">and date_format(wxlog.log_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')</if> - <if test="endTime != null and endTime != ''">and date_format(wxlog.log_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')</if> + <if test="beginTime != null and beginTime != ''">and date_format(wxlog.log_time,'%y%m%d') >= + date_format(#{beginTime},'%y%m%d') + </if> + <if test="endTime != null and endTime != ''">and date_format(wxlog.log_time,'%y%m%d') <= + date_format(#{endTime},'%y%m%d') + </if> order by wxlog.log_time asc </select> @@ -319,8 +334,8 @@ <resultMap id="punchReponseMap" type="com.stdiet.custom.dto.response.CommunityPunchReponse"> - <result property="id" column="id" /> - <result property="openid" column="openid" /> + <result property="id" column="id"/> + <result property="openid" column="openid"/> <result property="cusId" column="cus_id"/> <result property="nickName" column="nick_name"/> <result property="avatarUrl" column="avatar_url"/>