打卡后台,小程序接口
This commit is contained in:
parent
354e464ebb
commit
0ab35ed6c7
@ -14,6 +14,7 @@ import com.stdiet.custom.page.WxLogInfo;
|
||||
import com.stdiet.custom.service.ISysOrderService;
|
||||
import com.stdiet.custom.service.ISysWxUserInfoService;
|
||||
import com.stdiet.custom.service.ISysWxUserLogService;
|
||||
import org.aspectj.weaver.loadtime.Aj;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -47,14 +48,8 @@ public class SysWxUserLogController extends BaseController {
|
||||
List<SysWxUserLog> list = sysWxUserLogService.selectSysWxUserLogList(sysWxUserLog);
|
||||
|
||||
for (SysWxUserLog userLog : list) {
|
||||
if(userLog.getCustomerMessage() != null){
|
||||
String[] message = userLog.getCustomerMessage().split(",");
|
||||
userLog.setCustomer(message[0]);
|
||||
userLog.setNutritionist(message.length > 1 ? message[1] : "");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(userLog.getPhone())) {
|
||||
userLog.setPhone(StringUtils.hiddenPhoneNumber(userLog.getPhone()));
|
||||
//userLog.setPhone(userLog.getPhone().replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,6 +64,11 @@ public class SysWxUserLogController extends BaseController {
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SysWxUserLog sysWxUserLog) {
|
||||
List<SysWxUserLog> list = sysWxUserLogService.selectSysWxUserLogList(sysWxUserLog);
|
||||
for (SysWxUserLog userLog : list) {
|
||||
if (StringUtils.isNotEmpty(userLog.getPhone())) {
|
||||
userLog.setPhone(StringUtils.hiddenPhoneNumber(userLog.getPhone()));
|
||||
}
|
||||
}
|
||||
ExcelUtil<SysWxUserLog> util = new ExcelUtil<SysWxUserLog>(SysWxUserLog.class);
|
||||
return util.exportExcel(list, "wxUserLog");
|
||||
}
|
||||
@ -77,9 +77,11 @@ public class SysWxUserLogController extends BaseController {
|
||||
* 获取微信用户记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:wxUserLog:query')")
|
||||
@GetMapping(value = "/{openid}")
|
||||
public AjaxResult getInfo(@PathVariable("openid") String openid) {
|
||||
return AjaxResult.success(sysWxUserLogService.selectSysWxUserLogById(openid));
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id) {
|
||||
SysWxUserLog sysWxUserLog = sysWxUserLogService.selectSysWxUserLogById(id);
|
||||
System.out.println(sysWxUserLog.getPhone());
|
||||
return AjaxResult.success(sysWxUserLog);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,7 +91,9 @@ public class SysWxUserLogController extends BaseController {
|
||||
@Log(title = "微信用户记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysWxUserLog sysWxUserLog) {
|
||||
return toAjax(sysWxUserLogService.insertSysWxUserLog(sysWxUserLog));
|
||||
//暂时不开放后台增加打卡,因为无法获取到openid
|
||||
//return toAjax(sysWxUserLogService.insertSysWxUserLog(sysWxUserLog));
|
||||
return AjaxResult.error("新增打卡功能暂时关闭");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -99,7 +103,15 @@ public class SysWxUserLogController extends BaseController {
|
||||
@Log(title = "微信用户记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysWxUserLog sysWxUserLog) {
|
||||
if( sysWxUserLog != null && StringUtils.isNotEmpty(sysWxUserLog.getOpenid())){
|
||||
SysWxUserLog dateLog = sysWxUserLogService.selectSysWxUserLogByDateAndOpenId(sysWxUserLog);
|
||||
if(dateLog != null && dateLog.getId().intValue() != sysWxUserLog.getId().intValue()){
|
||||
return AjaxResult.error("今日该用户已打卡,无法重复打卡");
|
||||
}
|
||||
return toAjax(sysWxUserLogService.updateSysWxUserLog(sysWxUserLog));
|
||||
}else{
|
||||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -107,9 +119,9 @@ public class SysWxUserLogController extends BaseController {
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:wxUserLog:remove')")
|
||||
@Log(title = "微信用户记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{openids}")
|
||||
public AjaxResult remove(@PathVariable String[] openids) {
|
||||
return toAjax(sysWxUserLogService.deleteSysWxUserLogByIds(openids));
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids) {
|
||||
return toAjax(sysWxUserLogService.deleteSysWxUserLogByIds(ids));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/wx/logs/list")
|
||||
|
@ -3,6 +3,7 @@ package com.stdiet.custom.domain;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.stdiet.common.annotation.Excel;
|
||||
@ -14,10 +15,13 @@ import com.stdiet.common.core.domain.BaseEntity;
|
||||
* @author wonder
|
||||
* @date 2020-11-29
|
||||
*/
|
||||
@Data
|
||||
public class SysWxUserLog extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
/** 微信openid */
|
||||
private String openid;
|
||||
|
||||
@ -68,183 +72,18 @@ public class SysWxUserLog extends BaseEntity
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date logTime;
|
||||
|
||||
/** 非持久字段,客户姓名 + 营养师姓名,使用 , 隔开,用于接收sql查询返回字段 */
|
||||
private String customerMessage;
|
||||
|
||||
/**
|
||||
* 非持久化字段,营养师
|
||||
* 非持久化字段,客户姓名
|
||||
*/
|
||||
@Excel(name = "姓名")
|
||||
private String customer;
|
||||
private String customerName;
|
||||
|
||||
//营养师ID
|
||||
private Long nutritionistId;
|
||||
|
||||
/**
|
||||
* 非持久化字段,营养师
|
||||
*/
|
||||
@Excel(name = "营养师")
|
||||
private String nutritionist;
|
||||
|
||||
public void setLogTime(Date logTime) {
|
||||
this.logTime = logTime;
|
||||
}
|
||||
|
||||
public Date getLogTime() {
|
||||
return logTime;
|
||||
}
|
||||
|
||||
public void setOpenid(String openid)
|
||||
{
|
||||
this.openid = openid;
|
||||
}
|
||||
|
||||
public String getOpenid()
|
||||
{
|
||||
return openid;
|
||||
}
|
||||
public void setWeight(BigDecimal weight)
|
||||
{
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public BigDecimal getWeight()
|
||||
{
|
||||
return weight;
|
||||
}
|
||||
public void setAppid(String appid)
|
||||
{
|
||||
this.appid = appid;
|
||||
}
|
||||
|
||||
public String getAppid()
|
||||
{
|
||||
return appid;
|
||||
}
|
||||
public void setPhone(String phone)
|
||||
{
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getPhone()
|
||||
{
|
||||
return phone;
|
||||
}
|
||||
public void setSleepTime(String sleepTime)
|
||||
{
|
||||
this.sleepTime = sleepTime;
|
||||
}
|
||||
|
||||
public String getSleepTime()
|
||||
{
|
||||
return sleepTime;
|
||||
}
|
||||
public void setWakeupTime(String wakeupTime)
|
||||
{
|
||||
this.wakeupTime = wakeupTime;
|
||||
}
|
||||
|
||||
public String getWakeupTime()
|
||||
{
|
||||
return wakeupTime;
|
||||
}
|
||||
public void setSport(String sport)
|
||||
{
|
||||
this.sport = sport;
|
||||
}
|
||||
|
||||
public String getSport()
|
||||
{
|
||||
return sport;
|
||||
}
|
||||
public void setAvatarUrl(String avatarUrl)
|
||||
{
|
||||
this.avatarUrl = avatarUrl;
|
||||
}
|
||||
|
||||
public String getAvatarUrl()
|
||||
{
|
||||
return avatarUrl;
|
||||
}
|
||||
public void setDiet(String diet)
|
||||
{
|
||||
this.diet = diet;
|
||||
}
|
||||
|
||||
public String getDiet()
|
||||
{
|
||||
return diet;
|
||||
}
|
||||
public void setInsomnia(String insomnia)
|
||||
{
|
||||
this.insomnia = insomnia;
|
||||
}
|
||||
|
||||
public String getInsomnia()
|
||||
{
|
||||
return insomnia;
|
||||
}
|
||||
public void setDefecation(String defecation)
|
||||
{
|
||||
this.defecation = defecation;
|
||||
}
|
||||
|
||||
public String getDefecation()
|
||||
{
|
||||
return defecation;
|
||||
}
|
||||
public void setWater(Long water)
|
||||
{
|
||||
this.water = water;
|
||||
}
|
||||
|
||||
public Long getWater()
|
||||
{
|
||||
return water;
|
||||
}
|
||||
|
||||
public String getCustomerMessage() {
|
||||
return customerMessage;
|
||||
}
|
||||
|
||||
public void setCustomerMessage(String customerMessage) {
|
||||
this.customerMessage = customerMessage;
|
||||
}
|
||||
|
||||
public String getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
|
||||
public void setCustomer(String customer) {
|
||||
this.customer = customer;
|
||||
}
|
||||
|
||||
public String getNutritionist() {
|
||||
return nutritionist;
|
||||
}
|
||||
|
||||
public void setNutritionist(String nutritionist) {
|
||||
this.nutritionist = nutritionist;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("openid", getOpenid())
|
||||
.append("weight", getWeight())
|
||||
.append("appid", getAppid())
|
||||
.append("phone", getPhone())
|
||||
.append("sleepTime", getSleepTime())
|
||||
.append("wakeupTime", getWakeupTime())
|
||||
.append("sport", getSport())
|
||||
.append("avatarUrl", getAvatarUrl())
|
||||
.append("diet", getDiet())
|
||||
.append("insomnia", getInsomnia())
|
||||
.append("defecation", getDefecation())
|
||||
.append("water", getWater())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.append("logTime", getLogTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -41,7 +41,7 @@ public interface SysWxUserLogMapper
|
||||
public int insertSysWxUserLog(SysWxUserLog sysWxUserLog);
|
||||
|
||||
/**
|
||||
* 修改微信用户记录
|
||||
* 修改微信用户打卡记录
|
||||
*
|
||||
* @param sysWxUserLog 微信用户记录
|
||||
* @return 结果
|
||||
@ -49,20 +49,19 @@ public interface SysWxUserLogMapper
|
||||
public int updateSysWxUserLog(SysWxUserLog sysWxUserLog);
|
||||
|
||||
/**
|
||||
* 删除微信用户记录
|
||||
*
|
||||
* @param openid 微信用户记录ID
|
||||
* @return 结果
|
||||
* 根据ID删除打卡记录
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public int deleteSysWxUserLogById(String openid);
|
||||
public int deleteSysWxUserLogById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除微信用户记录
|
||||
* 批量删除微信用户打卡记录
|
||||
*
|
||||
* @param openids 需要删除的数据ID
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysWxUserLogByIds(String[] openids);
|
||||
public int deleteSysWxUserLogByIds(String[] ids);
|
||||
|
||||
public int checkWxLogInfoCount(String openid);
|
||||
|
||||
@ -72,4 +71,11 @@ public interface SysWxUserLogMapper
|
||||
*/
|
||||
public List<WxLogInfo> getWxLogInfoList(SysWxUserLog sysWxUserLog);
|
||||
|
||||
/**
|
||||
* 根据日期和openid查询打卡记录
|
||||
* @param sysWxUserLog
|
||||
* @return
|
||||
*/
|
||||
SysWxUserLog selectSysWxUserLogByDateAndOpenId(SysWxUserLog sysWxUserLog);
|
||||
|
||||
}
|
@ -17,10 +17,10 @@ public interface ISysWxUserLogService
|
||||
/**
|
||||
* 查询微信用户记录
|
||||
*
|
||||
* @param openid 微信用户记录ID
|
||||
* @param id 微信用户记录ID
|
||||
* @return 微信用户记录
|
||||
*/
|
||||
public SysWxUserLog selectSysWxUserLogById(String openid);
|
||||
public SysWxUserLog selectSysWxUserLogById(String id);
|
||||
|
||||
/**
|
||||
* 查询微信用户记录列表
|
||||
@ -51,18 +51,18 @@ public interface ISysWxUserLogService
|
||||
/**
|
||||
* 批量删除微信用户记录
|
||||
*
|
||||
* @param openids 需要删除的微信用户记录ID
|
||||
* @param ids 需要删除的微信用户记录ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysWxUserLogByIds(String[] openids);
|
||||
public int deleteSysWxUserLogByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 删除微信用户记录信息
|
||||
*
|
||||
* @param openid 微信用户记录ID
|
||||
* @param id 微信用户记录ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysWxUserLogById(String openid);
|
||||
public int deleteSysWxUserLogById(Long id);
|
||||
|
||||
public int checkWxLogInfoCount(String openid);
|
||||
|
||||
@ -71,4 +71,12 @@ public interface ISysWxUserLogService
|
||||
* @return
|
||||
*/
|
||||
public List<WxLogInfo> getWxLogInfoList(SysWxUserLog sysWxUserLog);
|
||||
|
||||
/**
|
||||
* 根据日期和openid查询打卡记录
|
||||
* @param sysWxUserLog
|
||||
* @return
|
||||
*/
|
||||
SysWxUserLog selectSysWxUserLogByDateAndOpenId(SysWxUserLog sysWxUserLog);
|
||||
|
||||
}
|
@ -25,12 +25,12 @@ public class SysWxUserLogServiceImpl implements ISysWxUserLogService {
|
||||
/**
|
||||
* 查询微信用户记录
|
||||
*
|
||||
* @param openid 微信用户记录ID
|
||||
* @param id 微信用户记录ID
|
||||
* @return 微信用户记录
|
||||
*/
|
||||
@Override
|
||||
public SysWxUserLog selectSysWxUserLogById(String openid) {
|
||||
return sysWxUserLogMapper.selectSysWxUserLogById(openid);
|
||||
public SysWxUserLog selectSysWxUserLogById(String id) {
|
||||
return sysWxUserLogMapper.selectSysWxUserLogById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,23 +76,23 @@ public class SysWxUserLogServiceImpl implements ISysWxUserLogService {
|
||||
/**
|
||||
* 批量删除微信用户记录
|
||||
*
|
||||
* @param openids 需要删除的微信用户记录ID
|
||||
* @param ids 需要删除的微信用户记录ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysWxUserLogByIds(String[] openids) {
|
||||
return sysWxUserLogMapper.deleteSysWxUserLogByIds(openids);
|
||||
public int deleteSysWxUserLogByIds(String[] ids) {
|
||||
return sysWxUserLogMapper.deleteSysWxUserLogByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除微信用户记录信息
|
||||
*
|
||||
* @param openid 微信用户记录ID
|
||||
* @param id 微信用户记录ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysWxUserLogById(String openid) {
|
||||
return sysWxUserLogMapper.deleteSysWxUserLogById(openid);
|
||||
public int deleteSysWxUserLogById(Long id) {
|
||||
return sysWxUserLogMapper.deleteSysWxUserLogById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -108,4 +108,14 @@ public class SysWxUserLogServiceImpl implements ISysWxUserLogService {
|
||||
public List<WxLogInfo> getWxLogInfoList(SysWxUserLog sysWxUserLog){
|
||||
return sysWxUserLogMapper.getWxLogInfoList(sysWxUserLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据日期和openid查询打卡记录
|
||||
* @param sysWxUserLog
|
||||
* @return
|
||||
*/
|
||||
public SysWxUserLog selectSysWxUserLogByDateAndOpenId(SysWxUserLog sysWxUserLog){
|
||||
return sysWxUserLogMapper.selectSysWxUserLogByDateAndOpenId(sysWxUserLog);
|
||||
}
|
||||
|
||||
}
|
@ -35,15 +35,15 @@
|
||||
<select id="selectSysCustomerList" parameterType="SysCustomer" resultMap="SysCustomerResult">
|
||||
<include refid="selectSysCustomerVo"/>
|
||||
where del_flag = 0
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%') or phone like concat('%', #{name}, '%')</if>
|
||||
<if test="name != null and name != ''"> and (name like concat('%', #{name}, '%') or phone like concat('%', #{name}, '%'))</if>
|
||||
<if test="mainDietitian != null and mainDietitian != ''"> and main_dietitian = #{mainDietitian}</if>
|
||||
<if test="mainDietitian == 0"> and isnull(main_dietitian) or main_dietitian=0</if>
|
||||
<if test="mainDietitian == 0"> and (isnull(main_dietitian) or main_dietitian=0)</if>
|
||||
<if test="salesman != null and salesman != ''"> and salesman = #{salesman}</if>
|
||||
<if test="salesman == 0"> and isnull(salesman) or salesman=0</if>
|
||||
<if test="salesman == 0"> and (isnull(salesman) or salesman=0)</if>
|
||||
<if test="afterDietitian != null and afterDietitian != ''"> and after_dietitian = #{afterDietitian}</if>
|
||||
<if test="afterDietitian == 0"> and isnull(after_dietitian) or after_dietitian=0</if>
|
||||
<if test="afterDietitian == 0"> and (isnull(after_dietitian) or after_dietitian=0)</if>
|
||||
<if test="assistantDietitian != null and assistantDietitian != ''"> and assistant_dietitian = #{assistantDietitian}</if>
|
||||
<if test="assistantDietitian == 0"> and isnull(assistant_dietitian) or assistant_dietitian=0</if>
|
||||
<if test="assistantDietitian == 0"> and (isnull(assistant_dietitian) or assistant_dietitian=0)</if>
|
||||
<if test="fansChannel != null "> and fans_channel = #{fansChannel}</if>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
@ -5,6 +5,7 @@
|
||||
<mapper namespace="com.stdiet.custom.mapper.SysWxUserLogMapper">
|
||||
|
||||
<resultMap type="SysWxUserLog" id="SysWxUserLogResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="openid" column="openid"/>
|
||||
<result property="weight" column="weight"/>
|
||||
<result property="appid" column="appid"/>
|
||||
@ -25,7 +26,9 @@
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<!-- 非持久字段 -->
|
||||
<result property="customerMessage" column="customer_message"></result>
|
||||
<result property="customerName" column="customer_name"></result>
|
||||
<!-- 营养师 -->
|
||||
<result property="nutritionist" column="nutritionist"></result>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.stdiet.custom.page.WxLogInfo" id="WxLogInfo">
|
||||
@ -41,28 +44,30 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysWxUserLogVo">
|
||||
select 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 from sys_wx_user_log
|
||||
</sql>
|
||||
|
||||
<sql id="selectBaseField">
|
||||
swul.openid, swul.weight, swul.appid, swul.phone, swul.log_time, swul.sleep_time, swul.wakeup_time, swul.sport, swul.avatar_url, swul.diet, swul.insomnia,
|
||||
swul.defecation, swul.water, swul.create_by, swul.create_time, swul.update_by, swul.update_time, swul.remark
|
||||
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 from sys_wx_user_log
|
||||
</sql>
|
||||
|
||||
<select id="checkWxLogInfoCount" parameterType="String" resultType="Integer">
|
||||
select count(*) from sys_wx_user_log where to_days(log_time) = to_days(now()) and openid = #{openid}
|
||||
</select>
|
||||
|
||||
<!-- 后台查询 -->
|
||||
<select id="selectSysWxUserLogList" parameterType="SysWxUserLog" resultMap="SysWxUserLogResult">
|
||||
select <include refid="selectBaseField"></include>,
|
||||
(select CONCAT(IFNULL(so.customer,''),',',IFNULL(su.nick_name,'')) from (select * from sys_order s where s.phone = swul.phone order by order_id desc limit 1) as so
|
||||
left join sys_user su on su.user_id = so.nutritionist_id and su.del_flag = 0) as customer_message
|
||||
from sys_wx_user_log swul
|
||||
<where>
|
||||
<if test="openid != null and openid != ''">and swul.openid = #{openid}</if>
|
||||
<if test="phone != null and phone != ''">or swul.phone = #{phone}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
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,
|
||||
sc.name as customer_name, su.nick_name as nutritionist
|
||||
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.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'
|
||||
where wxinfo.phone is not null
|
||||
<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>
|
||||
<if test="nutritionistId != null">
|
||||
and su.user_id = #{nutritionistId}
|
||||
</if>
|
||||
order by wxlog.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectWxLogInfoList" parameterType="SysWxUserLog" resultMap="WxLogInfo">
|
||||
@ -83,7 +88,7 @@
|
||||
|
||||
<select id="selectSysWxUserLogById" parameterType="String" resultMap="SysWxUserLogResult">
|
||||
<include refid="selectSysWxUserLogVo"/>
|
||||
where openid = #{openid}
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSysWxUserLog" parameterType="SysWxUserLog">
|
||||
@ -155,22 +160,27 @@
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysWxUserLogById" parameterType="String">
|
||||
delete from sys_wx_user_log where openid = #{openid}
|
||||
<delete id="deleteSysWxUserLogById" parameterType="Long">
|
||||
delete from sys_wx_user_log where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSysWxUserLogByIds" parameterType="String">
|
||||
delete from sys_wx_user_log where openid in
|
||||
<foreach item="openid" collection="array" open="(" separator="," close=")">
|
||||
#{openid}
|
||||
delete from sys_wx_user_log where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 根据openid或手机号查询对应打卡记录 -->
|
||||
<select id="getWxLogInfoList" parameterType="SysWxUserLog" resultMap="WxLogInfo">
|
||||
SELECT wxlog.weight,wxlog.log_time,wxlog.sleep_time, wxlog.wakeup_time,wxlog.defecation, wxlog.water, wxlog.sport FROM sys_wx_user_log wxlog left join sys_wx_user_info wxinfo on wxinfo.openid = wxlog.openid
|
||||
SELECT wxlog.weight,wxlog.log_time,wxlog.sleep_time, wxlog.wakeup_time,wxlog.defecation, wxlog.water, wxlog.insomnia,wxlog.sport,wxlog.diet
|
||||
FROM sys_wx_user_log wxlog left join sys_wx_user_info wxinfo on wxinfo.openid = wxlog.openid
|
||||
where wxinfo.openid = #{openid} or wxinfo.phone = #{phone}
|
||||
order by wxlog.log_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectSysWxUserLogByDateAndOpenId" parameterType="SysWxUserLog" resultMap="SysWxUserLogResult">
|
||||
select id from sys_wx_user_log where to_days(log_time) = to_days(#{logTime}) and openid = #{openid} limit 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -11,10 +11,10 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-form-item label="客户信息" prop="phone">
|
||||
<el-input
|
||||
v-model="queryParams.phone"
|
||||
placeholder="请输入电话"
|
||||
placeholder="请输入姓名或手机号"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
@ -27,7 +27,7 @@
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<!--<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@ -36,7 +36,7 @@
|
||||
v-hasPermi="['custom:wxUserLog:add']"
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-col>-->
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="success"-->
|
||||
@ -86,21 +86,21 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="微信应用" align="center" prop="appid" width="120" :formatter="appidFormat"/>
|
||||
<el-table-column label="姓名" align="center" prop="customer"/>
|
||||
<el-table-column label="姓名" align="center" prop="customerName"/>
|
||||
|
||||
<el-table-column label="手机号" align="center" prop="phone" width="180"/>
|
||||
<el-table-column label="营养师" align="center" prop="nutritionist"/>
|
||||
<el-table-column label="打卡日期" align="center" prop="logTime" width="180">
|
||||
<el-table-column label="打卡日期" align="center" prop="logTime" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.logTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="睡觉时间" align="center" prop="sleepTime" width="180">
|
||||
<el-table-column label="睡觉时间" align="center" prop="sleepTime" width="120">
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <span>{{ parseTime(scope.row.sleepTime, '{y}-{m}-{d}') }}</span>-->
|
||||
<!-- </template>-->
|
||||
</el-table-column>
|
||||
<el-table-column label="起床时间" align="center" prop="wakeupTime" width="180">
|
||||
<el-table-column label="起床时间" align="center" prop="wakeupTime" width="120">
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <span>{{ parseTime(scope.row.wakeupTime, '{y}-{m}-{d}') }}</span>-->
|
||||
<!-- </template>-->
|
||||
@ -114,7 +114,6 @@
|
||||
<span>{{`${scope.row.water} ml`}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark"/>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
@ -154,11 +153,7 @@
|
||||
<el-input v-model="form.weight" placeholder="请输入体重"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="电话" prop="phone">
|
||||
<el-input v-model="form.phone" placeholder="请输入电话"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="打卡日期" prop="logTime">
|
||||
<el-date-picker clearable size="small" style="width: 200px"
|
||||
@ -249,18 +244,7 @@
|
||||
<el-input v-model="form.water" placeholder="请输入饮水量"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col>
|
||||
<el-form-item label="微信应用" prop="appid">
|
||||
<el-select v-model="form.appid" placeholder="请选择微信appid">
|
||||
<el-option
|
||||
v-for="dict in appidOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
|
||||
@ -441,8 +425,8 @@
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const openid = row.openid || this.ids
|
||||
getWxUserLog(openid).then(response => {
|
||||
const id = row.id || this.ids
|
||||
getWxUserLog(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改微信用户记录";
|
||||
@ -475,13 +459,13 @@
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const openids = row.openid || this.ids;
|
||||
this.$confirm('是否确认删除微信用户记录编号为"' + openids + '"的数据项?', "警告", {
|
||||
const ids = row.id || this.ids;
|
||||
this.$confirm('是否确认删除微信用户记录编号为"' + ids + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function () {
|
||||
return delWxUserLog(openids);
|
||||
return delWxUserLog(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
|
Loading…
x
Reference in New Issue
Block a user