diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWxUserLogController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWxUserLogController.java index 9d8872060..102f99f8b 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWxUserLogController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWxUserLogController.java @@ -10,6 +10,7 @@ import com.stdiet.common.utils.DateUtils; import com.stdiet.common.utils.StringUtils; import com.stdiet.common.utils.oss.AliyunOSSUtils; import com.stdiet.common.utils.poi.ExcelUtil; +import com.stdiet.custom.domain.SysCustomer; import com.stdiet.custom.domain.SysWxUserInfo; import com.stdiet.custom.domain.SysWxUserLog; import com.stdiet.custom.page.WxLogInfo; @@ -223,4 +224,16 @@ public class SysWxUserLogController extends BaseController { } return toAjax(row); } + + /** + * 查询指定日期未打卡用户 + */ + @PreAuthorize("@ss.hasPermi('custom:wxUserLog:list')") + @GetMapping("/selectNotPunchCustomerByDate") + public TableDataInfo selectNotPunchCustomerByDate(SysCustomer sysCustomer) { + startPage(); + List<SysCustomer> list = sysWxUserLogService.selectNotPunchCustomerByDate(sysCustomer); + return getDataTable(list); + } + } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysWxUserLogMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysWxUserLogMapper.java index dde05bf26..f405ae17b 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysWxUserLogMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysWxUserLogMapper.java @@ -2,9 +2,11 @@ package com.stdiet.custom.mapper; import java.util.List; +import com.stdiet.custom.domain.SysCustomer; import com.stdiet.custom.domain.SysWxUserInfo; import com.stdiet.custom.domain.SysWxUserLog; import com.stdiet.custom.dto.response.CommunityPunchReponse; +import com.stdiet.custom.dto.response.CustomerListResponse; import com.stdiet.custom.page.WxLogInfo; /** @@ -113,4 +115,10 @@ public interface SysWxUserLogMapper */ int getPunchCustomerTotalNum(); + /** + * 根据日期、营养师、助理、售后查询指定日期未打卡的客户信息 + * @return + */ + List<SysCustomer> selectNotPunchCustomerByDate(SysCustomer sysCustomer); + } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysWxUserLogService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysWxUserLogService.java index 9de3c3f8b..c92604067 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysWxUserLogService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysWxUserLogService.java @@ -2,6 +2,7 @@ package com.stdiet.custom.service; import java.util.List; +import com.stdiet.custom.domain.SysCustomer; import com.stdiet.custom.domain.SysWxUserInfo; import com.stdiet.custom.domain.SysWxUserLog; import com.stdiet.custom.dto.response.CommunityPunchReponse; @@ -115,4 +116,10 @@ public interface ISysWxUserLogService */ int getPunchCustomerTotalNum(); + /** + * 根据日期、营养师、助理、售后查询指定日期未打卡的客户信息 + * @return + */ + List<SysCustomer> selectNotPunchCustomerByDate(SysCustomer sysCustomer); + } \ No newline at end of file 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 72a8a2e6e..b7b8cc838 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 @@ -8,6 +8,7 @@ import com.stdiet.common.utils.DateUtils; import com.stdiet.common.utils.file.FileUploadUtils; import com.stdiet.common.utils.file.MimeTypeUtils; import com.stdiet.common.utils.oss.AliyunOSSUtils; +import com.stdiet.custom.domain.SysCustomer; import com.stdiet.custom.domain.SysMessageNotice; import com.stdiet.custom.domain.SysWxUserInfo; import com.stdiet.custom.domain.entityEnum.MessageNoticeEnum; @@ -170,4 +171,13 @@ public class SysWxUserLogServiceImpl implements ISysWxUserLogService { return sysWxUserLogMapper.getPunchCustomerTotalNum(); } + /** + * 根据日期、营养师、助理、售后查询指定日期未打卡的客户信息 + * @return + */ + @Override + public List<SysCustomer> selectNotPunchCustomerByDate(SysCustomer sysCustomer){ + return sysWxUserLogMapper.selectNotPunchCustomerByDate(sysCustomer); + } + } \ No newline at end of file diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysWxUserLogMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysWxUserLogMapper.xml index bfb4944fb..9de9118b1 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysWxUserLogMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysWxUserLogMapper.xml @@ -414,5 +414,35 @@ select count(wxlog.openid) from sys_wx_user_log wxlog where wxlog.del_flag = 0 and to_days(log_time) = to_days(now()) </select> + <!-- 根据日期查询该日期中未打卡客户(根据食谱计划判断今日是否需要打卡) --> + <select id="selectNotPunchCustomerByDate" parameterType="SysCustomer" resultType="SysCustomer"> + select plan.cus_id as id, cus.name, cus.main_dietitian as mainDietitian, cus.assistant_dietitian as assistantDietitian,cus.after_dietitian as afterDietitian from + + ( + select DISTINCT cus_id from sys_recipes_plan where end_date >= DATE_FORMAT(#{startDate},'%Y-%m-%d') and DATE_FORMAT(#{startDate},'%Y-%m-%d') >= start_date and del_flag = 0 and instr(pause_date, DATE_FORMAT(#{startDate},'%Y%m%d')) = 0 + ) as plan + + left join sys_customer cus on cus.id = plan.cus_id and cus.del_flag = 0 + + where plan.cus_id not in + + ( + select info.cus_id from sys_wx_user_log log left join sys_wx_user_info info on info.openid = log.openid + where log.del_flag = 0 and DATE_FORMAT(log.log_time,'%Y-%m-%d') = DATE_FORMAT(#{startDate},'%Y-%m-%d') + ) + + <if test="mainDietitian != null"> + and cus.main_dietitian = #{mainDietitian} + </if> + <if test="assistantDietitian != null"> + and cus.assistant_dietitian = #{assistantDietitian} + </if> + <if test="afterDietitian != null"> + and cus.after_dietitian = #{afterDietitian} + </if> + + order by plan.cus_id desc + </select> + </mapper> \ No newline at end of file diff --git a/stdiet-ui/src/api/custom/wxUserLog.js b/stdiet-ui/src/api/custom/wxUserLog.js index cbaeb5abf..621eadc34 100644 --- a/stdiet-ui/src/api/custom/wxUserLog.js +++ b/stdiet-ui/src/api/custom/wxUserLog.js @@ -79,6 +79,17 @@ export function commentPunchContent(data) { }) } +// 查询未打卡用户列表 +export function getNotPunchCustomer(query) { + return request({ + url: '/custom/wxUserLog/selectNotPunchCustomerByDate', + method: 'get', + params: query + }) +} + + + diff --git a/stdiet-ui/src/components/PunchLog/NotPunchCustomer/index.vue b/stdiet-ui/src/components/PunchLog/NotPunchCustomer/index.vue new file mode 100644 index 000000000..a79a05f46 --- /dev/null +++ b/stdiet-ui/src/components/PunchLog/NotPunchCustomer/index.vue @@ -0,0 +1,208 @@ +<template> + <!-- --> + <!-- 查询未打卡客户信息 --> + <el-dialog :title="title" :visible.sync="open" width="1050px" :close-on-click-modal="false" append-to-body @closed="cancel"> + <!--<div style="margin-bottom: 20px;color:red"></div>--> + <el-form :model="queryParams" ref="queryForm" :inline="true" > + <el-form-item label="打卡日期" prop="startDate" > + <el-date-picker + v-model="queryParams.startDate" + align="right" + type="date" + placeholder="选择打卡日期" + value-format="yyyy-MM-dd" + :picker-options="pickerOptions"> + </el-date-picker> + </el-form-item> + <el-form-item label="营养师" prop="mainDietitian" > + <el-select + v-model="queryParams.mainDietitian" + placeholder="请选择销售" + clearable + filterable + size="small" + > + <el-option + v-for="dict in nutritionistIdOptions" + :key="dict.dictValue" + :label="dict.dictLabel" + :value="parseInt(dict.dictValue)" + /> + </el-select> + </el-form-item> + + <!--<el-form-item label="营养师助理" prop="assistantDietitian" label-width="50px"> + <el-select + v-model="queryParams.assistantDietitian" + placeholder="请选择销售" + clearable + filterable + size="small" + > + <el-option + v-for="dict in nutriAssisIdOptions" + :key="dict.dictValue" + :label="dict.dictLabel" + :value="parseInt(dict.dictValue)" + /> + </el-select> + </el-form-item>--> + <el-form-item label="售后" prop="afterDietitian" > + <el-select + v-model="queryParams.afterDietitian" + placeholder="请选择销售" + clearable + filterable + size="small" + > + <el-option + v-for="dict in afterSaleIdOptions" + :key="dict.dictValue" + :label="dict.dictLabel" + :value="parseInt(dict.dictValue)" + /> + </el-select> + </el-form-item> + <el-form-item> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> + </el-form-item> + </el-form> + <div style="height: 550px; overflow: auto"> + <el-table v-loading="loading" :data="notPunchCustomerList"> + <el-table-column label="客户姓名" align="center" prop="name" /> + <el-table-column label="营养师" align="center" prop="mainDietitian" :formatter="nutritionistFormat"/> + <el-table-column label="售后营养师" align="center" prop="afterDietitian" :formatter="afterDietitianFormat"/> + </el-table> + <pagination + v-show="total > 0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getNotLunchCustomer" + /> + </div> + + <div slot="footer" class="dialog-footer"> + <el-button @click="cancel">取消</el-button> + </div> + </el-dialog> +</template> +<script> +import { getNotPunchCustomer } from "@/api/custom/wxUserLog"; +import { mapGetters } from "vuex"; +import dayjs from "dayjs"; +const nowTime = dayjs().format("YYYY-MM-DD"); +export default { + name: "NotPunchCustomer", + components: { + + }, + data() { + return { + // 遮罩层 + loading: true, + // 弹出层标题 + title: "", + // 是否显示弹出层 + open: false, + total: 0, + // 表单校验 + rules: { + + }, + queryParams:{ + startDate: nowTime, + mainDietitian: null, + assistantDietitian: null, + afterDietitian: null, + pageNum: 1, + pageSize: 10 + }, + pickerOptions: { + disabledDate(time) { + return time.getTime() > Date.now(); + }, + }, + notPunchCustomerList: [], + nutritionistIdOptions: [], + afterSaleIdOptions: [] + }; + }, + created(){ + + + }, + computed: { + ...mapGetters([ + // 售前字典 + //"preSaleIdOptions" + ]), + }, + methods: { + showDialog(queryParams, nutritionistIdOptions, afterSaleIdOptions) { + this.nutritionistIdOptions = nutritionistIdOptions != null ? nutritionistIdOptions.slice(1) : []; + this.afterSaleIdOptions = afterSaleIdOptions != null ? afterSaleIdOptions.slice(1) : []; + this.queryParams.startDate = queryParams.startDate != null ? queryParams.startDate : nowTime; + this.queryParams.mainDietitian = queryParams.nutritionistId != null ? queryParams.nutritionistId : null; + this.queryParams.afterDietitian = queryParams.afterNutritionistId != null ? queryParams.afterNutritionistId : null; + this.title = "未打卡用户列表"; + this.reset(); + this.getNotLunchCustomer(); + this.open = true; + }, + reset(){ + + }, + /** 提交按钮 */ + submitForm() { + + }, + onClosed() { + this.reset(); + }, + cancel(){ + this.open = false; + this.reset(); + }, + //获取未打卡用户 + getNotLunchCustomer() { + getNotPunchCustomer(this.queryParams).then((response) => { + /*response.data.forEach((item,index) => { + item.liveRoomName = item.liveNutritionistName + " " + item.liveRoomName; + });*/ + this.notPunchCustomerList = response.rows; + this.total = response.total; + this.loading = false; + }); + }, + handleQuery(){ + this.getNotLunchCustomer(); + }, + resetQuery(){ + this.queryParams = { + startDate: nowTime, + mainDietitian: null, + assistantDietitian: null, + afterDietitian: null + }; + }, + // 营养师字典翻译 + nutritionistFormat(row, column) { + return this.selectDictLabel(this.nutritionistIdOptions, row.mainDietitian); + }, + // 营养师助理字典翻译 + nutriAssisFormat(row, column) { + return this.selectDictLabel(this.nutriAssisIdOptions, row.assistantDietitian); + }, + // 售后营养师字典翻译 + afterDietitianFormat(row, column) { + return this.selectDictLabel(this.afterSaleIdOptions, row.afterDietitian); + }, + } +}; +</script> + +<style lang="scss" scoped> + +</style> diff --git a/stdiet-ui/src/views/custom/wxUserLog/index.vue b/stdiet-ui/src/views/custom/wxUserLog/index.vue index b1c034ccd..4c1a87f42 100644 --- a/stdiet-ui/src/views/custom/wxUserLog/index.vue +++ b/stdiet-ui/src/views/custom/wxUserLog/index.vue @@ -81,16 +81,15 @@ </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" + icon="el-icon-s-flag" size="mini" - @click="handleAdd" - v-hasPermi="['custom:wxUserLog:add']" - >新增 + @click="showNotLunch()" + >未打卡客户列表 </el-button> - </el-col>--> + </el-col> <!-- <el-col :span="1.5">--> <!-- <el-button--> <!-- type="success"--> @@ -298,6 +297,8 @@ <PunchLogEdit ref="punchLogEditRef"></PunchLogEdit> <!-- 详情 --> <PunchLogDetail ref="punchLogDetailRef"></PunchLogDetail> + <!-- 未打卡用户 --> + <NotPunchCustomer ref="notPunchCustomerRef"></NotPunchCustomer> </div> </template> @@ -314,6 +315,7 @@ import { mapGetters } from "vuex"; import PunchLogDetail from "@/components/PunchLog/PunchLogDetail"; import PunchLogEdit from "@/components/PunchLog/PunchLogEdit"; import AutoHideMessage from "@/components/AutoHideMessage"; +import NotPunchCustomer from "@/components/PunchLog/NotPunchCustomer" import dayjs from "dayjs"; export default { name: "WxUserLog", @@ -369,7 +371,7 @@ export default { }; }, components:{ - PunchLogDetail,AutoHideMessage,PunchLogEdit + PunchLogDetail,AutoHideMessage,PunchLogEdit,NotPunchCustomer }, created() { this.getList(); @@ -563,6 +565,10 @@ export default { }) .catch(function () {}); }, + showNotLunch(){ + this.queryParams.startDate = this.logTimeScope && this.logTimeScope.length > 0 ? this.logTimeScope[0] : null; + this.$refs.notPunchCustomerRef.showDialog(this.queryParams, this.nutritionistIdOptions,this.afterSaleIdOptions); + } }, }; </script>