| @@ -4,6 +4,7 @@ import java.util.Date; | ||||
| import java.util.List; | ||||
|  | ||||
| import com.stdiet.common.utils.DateUtils; | ||||
| import com.stdiet.common.utils.StringUtils; | ||||
| import org.springframework.security.access.prepost.PreAuthorize; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
| @@ -242,4 +243,22 @@ public class SysLiveSchedulController extends BaseController | ||||
|         List<SysLiveSchedul> list = sysLiveSchedulService.selectSysLiveSchedulList(sysLiveSchedul); | ||||
|         return AjaxResult.success(list); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 根据日期查询直播记录 | ||||
|      */ | ||||
|     @GetMapping(value = "/getLiveSchedulByTime") | ||||
|     public AjaxResult getLiveSchedulByTime(SysLiveSchedul sysLiveSchedul){ | ||||
|         SysLiveSchedul live = null; | ||||
|         try { | ||||
|             if(sysLiveSchedul.getFanChannel() != null && StringUtils.isNotEmpty(sysLiveSchedul.getLiveStartTimeString())){ | ||||
|                 sysLiveSchedul.setLiveStartTimeString(java.net.URLDecoder.decode(sysLiveSchedul.getLiveStartTimeString(), "UTF-8")); | ||||
|                 sysLiveSchedul.setLiveStartTime(DateUtils.parseDate(sysLiveSchedul.getLiveStartTimeString())); | ||||
|                 live = sysLiveSchedulService.getLiveSchedulByTime(sysLiveSchedul); | ||||
|             } | ||||
|         }catch (Exception e){ | ||||
|             e.printStackTrace(); | ||||
|         } | ||||
|         return AjaxResult.success(live); | ||||
|     } | ||||
| } | ||||
| @@ -37,6 +37,8 @@ public class SysLiveSchedul extends BaseEntity | ||||
|     @Excel(name = "直播开始时间", width = 30, dateFormat = "yyyy-MM-dd") | ||||
|     private Date liveStartTime; | ||||
|  | ||||
|     private String liveStartTimeString; | ||||
|  | ||||
|     /** 直播结束时间 */ | ||||
|     @JsonFormat(pattern = "yyyy-MM-dd HH:mm") | ||||
|     @Excel(name = "直播结束时间", width = 30, dateFormat = "yyyy-MM-dd") | ||||
|   | ||||
| @@ -90,4 +90,10 @@ public interface SysLiveSchedulMapper | ||||
|      * @return | ||||
|      */ | ||||
|     public SysLiveSchedul getLastLiveSchedul(); | ||||
|  | ||||
|     /** | ||||
|      * 根据时间确定最近的直播记录 | ||||
|      * @return | ||||
|      */ | ||||
|     public SysLiveSchedul getLiveSchedulByTime(SysLiveSchedul sysLiveSchedul); | ||||
| } | ||||
| @@ -85,4 +85,10 @@ public interface ISysLiveSchedulService | ||||
|      * @return | ||||
|      */ | ||||
|     public AjaxResult copyLastTimeLiveSchedul(); | ||||
|  | ||||
|     /** | ||||
|      * 根据时间确定最近的直播记录 | ||||
|      * @return | ||||
|      */ | ||||
|     public SysLiveSchedul getLiveSchedulByTime(SysLiveSchedul sysLiveSchedul); | ||||
| } | ||||
| @@ -178,4 +178,12 @@ public class SysLiveSchedulServiceImpl implements ISysLiveSchedulService | ||||
|         } | ||||
|         return result; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 根据时间确定最近的直播记录 | ||||
|      * @return | ||||
|      */ | ||||
|     public SysLiveSchedul getLiveSchedulByTime(SysLiveSchedul sysLiveSchedul){ | ||||
|         return sysLiveSchedulMapper.getLiveSchedulByTime(sysLiveSchedul); | ||||
|     } | ||||
| } | ||||
| @@ -211,5 +211,14 @@ | ||||
|         where del_flag = 0 order by live_schedul_date  desc limit 1 | ||||
|     </select> | ||||
|  | ||||
|     <!-- 根据渠道、进粉时间确实进粉来源哪个直播间,取最近的 --> | ||||
|     <select id="getLiveSchedulByTime" parameterType="SysLiveSchedul" resultMap="SysLiveSchedulResultSigle"> | ||||
|         select | ||||
|         <include refid="selectSysLiveSchedulVo"/> | ||||
|         from sys_live_schedul where del_flag = 0 | ||||
|         and   fan_channel = #{fanChannel} | ||||
|         and  #{liveStartTime} >= live_start_time order by live_start_time desc limit 1 | ||||
|     </select> | ||||
|  | ||||
|  | ||||
| </mapper> | ||||
| @@ -80,5 +80,14 @@ export function getAllLiveSchedulByDate(data) { | ||||
|   }) | ||||
| } | ||||
|  | ||||
| // 根据进粉时间查询最近直播记录 | ||||
| export function getLiveSchedulByTime(data) { | ||||
|   return request({ | ||||
|     url: '/custom/liveSchedul/getLiveSchedulByTime', | ||||
|     method: 'get', | ||||
|     params: data | ||||
|   }) | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,8 @@ | ||||
| <template> | ||||
|     <!--  --> | ||||
|     <!-- 添加或修改导粉管理对话框 --> | ||||
|     <el-dialog :title="title" :visible.sync="open" width="1100px" :close-on-click-modal="false" append-to-body @closed="cancel"> | ||||
|     <el-dialog :title="title" :visible.sync="open" width="1000px" :close-on-click-modal="false" append-to-body @closed="cancel"> | ||||
|       <div style="margin-bottom: 20px;color:red">1、添加导粉记录时会根据进粉渠道、当前时间来自动确定所属直播间,当前时间段没有直播,则取上一次直播,若账号从未直播过,则为空</div> | ||||
|         <div style="height: 500px; overflow: auto"> | ||||
|             <el-table v-loading="loading" :data="wxAccountList"> | ||||
|                 <!--<el-table-column label="微信昵称" align="center" prop="wxNickName" />--> | ||||
| @@ -27,7 +28,7 @@ | ||||
|                         </el-select> | ||||
|                     </template> | ||||
|                 </el-table-column> | ||||
|                 <el-table-column label="直播间" align="center" prop="importFanLive" > | ||||
|                 <!--<el-table-column label="直播间" align="center" prop="importFanLive" > | ||||
|                     <template slot-scope="scope"> | ||||
|                         <el-select | ||||
|                           v-model="scope.row.importFanLive" | ||||
| @@ -44,7 +45,7 @@ | ||||
|                         /> | ||||
|                         </el-select> | ||||
|                     </template> | ||||
|                 </el-table-column> | ||||
|                 </el-table-column>--> | ||||
|                 <el-table-column label="导粉数量" align="center" prop="fanNum" width="200"> | ||||
|                     <template slot-scope="scope"> | ||||
|                             <el-input-number v-model="scope.row.fanNum" :min="1" :max="10000" label="导粉数量" style="width:160px"></el-input-number> | ||||
| @@ -74,7 +75,7 @@ | ||||
| </template> | ||||
| <script> | ||||
| import { addImportFanRecord,getWxAccountAndSale } from "@/api/custom/importFanRecord"; | ||||
| import { getAllLiveSchedulByDate } from "@/api/custom/liveSchedul"; | ||||
| import { getAllLiveSchedulByDate,getLiveSchedulByTime } from "@/api/custom/liveSchedul"; | ||||
| import dayjs from "dayjs"; | ||||
| const nowTime = dayjs().format("YYYY-MM-DD HH:mm"); | ||||
| export default { | ||||
| @@ -125,7 +126,7 @@ export default { | ||||
|       this.reset(); | ||||
|       this.callback = callback; | ||||
|       this.getListWxAccount(); | ||||
|       this.getAllLiveSchedulByDate(); | ||||
|       //this.getAllLiveSchedulByDate(); | ||||
|       this.open = true; | ||||
|     }, | ||||
|     reset(){ | ||||
| @@ -268,7 +269,24 @@ export default { | ||||
|       return (value == undefined || value == null || value == "") ? "" : value; | ||||
|     }, | ||||
|     autoSelectLive(row){ | ||||
|         if(row.importFanLive == undefined || row.importFanLive == null || row.importFanLive == ""){ | ||||
|         if(row.importFanChannel == undefined || row.importFanChannel == null || row.importFanChannel == ""){ | ||||
|            row.importFanLive = null; | ||||
|            return; | ||||
|         } | ||||
|         getLiveSchedulByTime({'fanChannel':row.importFanChannel,'liveStartTimeString':encodeURIComponent(dayjs().format("YYYY-MM-DD HH:mm"))}).then((response) => { | ||||
|               if (response.code === 200) { | ||||
|                  let live = response.data; | ||||
|                  if(live != undefined && live != null){ | ||||
|                     row.importFanLive = live.id; | ||||
|                  }else{ | ||||
|                    row.importFanLive = null; | ||||
|                  } | ||||
|               }else{ | ||||
|                 row.importFanLive = null; | ||||
|               } | ||||
|         }); | ||||
|  | ||||
|         /*if(row.importFanLive == undefined || row.importFanLive == null || row.importFanLive == ""){ | ||||
|             if(row.importFanChannel == undefined || row.importFanChannel == null || row.importFanChannel == ""){ | ||||
|               row.importFanLive = null; | ||||
|             }else{ | ||||
| @@ -286,7 +304,7 @@ export default { | ||||
|                   }); | ||||
|               } | ||||
|             } | ||||
|         }  | ||||
|         } */ | ||||
|     } | ||||
|   }, | ||||
| }; | ||||
|   | ||||
| @@ -57,6 +57,8 @@ | ||||
|             <el-select | ||||
|               v-model="form.accountId" | ||||
|               placeholder="请选择" | ||||
|               filterable | ||||
|               clearable | ||||
|               @change="handleOnChanelIdChange" | ||||
|             > | ||||
|               <el-option | ||||
| @@ -96,6 +98,8 @@ | ||||
|           <el-form-item label="调理项目" prop="conditioningProjectId"> | ||||
|             <el-select | ||||
|               v-model="form.conditioningProjectId" | ||||
|               filterable | ||||
|               clearable | ||||
|               placeholder="请选择" | ||||
|             > | ||||
|               <el-option | ||||
| @@ -109,7 +113,8 @@ | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="售前" prop="preSaleId"> | ||||
|             <el-select v-model="form.preSaleId" placeholder="请选择"> | ||||
|             <el-select v-model="form.preSaleId" placeholder="请选择" filterable | ||||
|               clearable> | ||||
|               <el-option | ||||
|                 v-for="dict in preSaleIdOptions" | ||||
|                 :key="dict.dictValue" | ||||
| @@ -133,7 +138,8 @@ | ||||
|         </el-col> | ||||
|         <el-col :span="8" v-show="afterNutiShow"> | ||||
|           <el-form-item label="售后" prop="afterSaleId"> | ||||
|             <el-select v-model="form.afterSaleId" placeholder="请选择"> | ||||
|             <el-select v-model="form.afterSaleId" placeholder="请选择" filterable | ||||
|               clearable> | ||||
|               <el-option | ||||
|                 v-for="dict in afterSaleIdOptions" | ||||
|                 :key="dict.dictValue" | ||||
| @@ -148,6 +154,7 @@ | ||||
|             <el-select | ||||
|               v-model="form.nutritionistIdList" | ||||
|               multiple | ||||
|               filterable | ||||
|               placeholder="请选择" | ||||
|             > | ||||
|               <el-option | ||||
| @@ -173,7 +180,8 @@ | ||||
|         </el-col> | ||||
|         <el-col :span="8" v-show="afterNutiShow"> | ||||
|           <el-form-item label="助理营养师" prop="nutriAssisId"> | ||||
|             <el-select v-model="form.nutriAssisId" placeholder="请选择"> | ||||
|             <el-select v-model="form.nutriAssisId" placeholder="请选择" filterable | ||||
|               clearable> | ||||
|               <el-option | ||||
|                 v-for="dict in nutriAssisIdOptions" | ||||
|                 :key="dict.dictValue" | ||||
| @@ -185,7 +193,8 @@ | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="策划" prop="plannerId"> | ||||
|             <el-select v-model="form.plannerId" placeholder="请选择"> | ||||
|             <el-select v-model="form.plannerId" placeholder="请选择" filterable | ||||
|               clearable>  | ||||
|               <el-option | ||||
|                 v-for="dict in plannerIdOptions" | ||||
|                 :key="dict.dictValue" | ||||
| @@ -197,7 +206,8 @@ | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="策划助理" prop="plannerAssisId"> | ||||
|             <el-select v-model="form.plannerAssisId" placeholder="请选择"> | ||||
|             <el-select v-model="form.plannerAssisId" placeholder="请选择" filterable | ||||
|               clearable> | ||||
|               <el-option | ||||
|                 v-for="dict in plannerAssisIdOptions" | ||||
|                 :key="dict.dictValue" | ||||
| @@ -209,7 +219,8 @@ | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="运营" prop="operatorId"> | ||||
|             <el-select v-model="form.operatorId" placeholder="请选择"> | ||||
|             <el-select v-model="form.operatorId" placeholder="请选择" filterable | ||||
|               clearable> | ||||
|               <el-option | ||||
|                 v-for="dict in operatorIdOptions" | ||||
|                 :key="dict.dictValue" | ||||
| @@ -221,7 +232,8 @@ | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="运营助理" prop="operatorAssisId"> | ||||
|             <el-select v-model="form.operatorAssisId" placeholder="请选择"> | ||||
|             <el-select v-model="form.operatorAssisId" placeholder="请选择" filterable | ||||
|               clearable> | ||||
|               <el-option | ||||
|                 v-for="dict in operatorAssisIdOptions" | ||||
|                 :key="dict.dictValue" | ||||
|   | ||||
| @@ -326,16 +326,42 @@ | ||||
|     /> | ||||
|  | ||||
|     <!-- 添加或修改客户档案对话框 --> | ||||
|     <el-dialog :title="title" :visible.sync="open" width="520px" append-to-body> | ||||
|     <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body> | ||||
|       <el-row :gutter="15"> | ||||
|         <el-form ref="form" :model="form" :rules="rules" label-width="100px"> | ||||
|           <el-col :span="12"> | ||||
|             <el-form-item label="客户名字" prop="name"> | ||||
|             <el-form-item label="进粉渠道" prop="channelId" style="width:400px"> | ||||
|               <el-select v-model="form.channelId" placeholder="请选择" filterable clearable @change="channelAutoSelectNutritionist"> | ||||
|                 <el-option | ||||
|                   v-for="dict in accountIdOptions" | ||||
|                   :key="dict.dictValue" | ||||
|                   :label="dict.dictLabel" | ||||
|                   :value="parseInt(dict.dictValue)" | ||||
|                 /> | ||||
|               </el-select> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|           <el-col :span="12"> | ||||
|             <el-form-item label="进粉时间" prop="fansTime"> | ||||
|               <el-date-picker | ||||
|                 v-model="form.fansTime" | ||||
|                 type="datetime" | ||||
|                 placeholder="选择进粉时间" | ||||
|                 format="yyyy-MM-dd HH:mm" | ||||
|                 value-format="yyyy-MM-dd HH:mm" | ||||
|                 :picker-options="fanPickerOptions" | ||||
|                 @change="fanTimeAutoSelectNutritionist" | ||||
|               > | ||||
|               </el-date-picker> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|           <el-col :span="12"> | ||||
|             <el-form-item label="客户名字" prop="name" style="width:300px"> | ||||
|               <el-input v-model.trim="form.name" placeholder="请输入名字" /> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|           <el-col :span="12"> | ||||
|             <el-form-item label="手机号" prop="phone"> | ||||
|             <el-form-item label="手机号" prop="phone" style="width:300px"> | ||||
|               <el-input v-model.trim="form.phone" placeholder="请输入手机号" /> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
| @@ -387,31 +413,8 @@ | ||||
|               </el-select> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|           <el-col :span="24"> | ||||
|             <el-form-item label="进粉时间" prop="fansTime"> | ||||
|               <el-date-picker | ||||
|                 v-model="form.fansTime" | ||||
|                 type="date" | ||||
|                 placeholder="选择进粉时间" | ||||
|                 format="yyyy-MM-dd" | ||||
|                 value-format="yyyy-MM-dd" | ||||
|                 :picker-options="fanPickerOptions" | ||||
|               > | ||||
|               </el-date-picker> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|           <el-col :span="12"> | ||||
|             <el-form-item label="进粉渠道" prop="channelId"> | ||||
|               <el-select v-model="form.channelId" placeholder="请选择"> | ||||
|                 <el-option | ||||
|                   v-for="dict in accountIdOptions" | ||||
|                   :key="dict.dictValue" | ||||
|                   :label="dict.dictLabel" | ||||
|                   :value="parseInt(dict.dictValue)" | ||||
|                 /> | ||||
|               </el-select> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|            | ||||
|            | ||||
|         </el-form> | ||||
|       </el-row> | ||||
|       <div slot="footer" class="dialog-footer"> | ||||
| @@ -446,6 +449,7 @@ import { | ||||
|   listCustomer, | ||||
|   updateCustomer, | ||||
| } from "@/api/custom/customer"; | ||||
| import { getLiveSchedulByTime } from "@/api/custom/liveSchedul"; | ||||
|  | ||||
| import store from "@/store"; | ||||
| import OrderDrawer from "@/components/OrderDrawer"; | ||||
| @@ -785,6 +789,52 @@ export default { | ||||
|         }) | ||||
|         .catch(function () {}); | ||||
|     }, | ||||
|     channelAutoSelectNutritionist(channelValue){ | ||||
|         this.form.fansChannel = channelValue == "" ? null : channelValue; | ||||
|         if(channelValue == undefined || channelValue == null || channelValue == ""){ | ||||
|             this.form.mainDietitian = null; | ||||
|             return; | ||||
|         } | ||||
|         if(this.form.fansTime == undefined || this.form.fansTime == null){ | ||||
|             this.form.mainDietitian = null; | ||||
|             return; | ||||
|         }       | ||||
|         this.autoSelectNutritionist(); | ||||
|     }, | ||||
|     fanTimeAutoSelectNutritionist(fansTime){ | ||||
|         this.form.fansTime = fansTime; | ||||
|         if(fansTime == undefined || fansTime == null){ | ||||
|             this.form.mainDietitian = null; | ||||
|             return; | ||||
|         } | ||||
|         if(this.form.fansChannel == undefined || this.form.fansChannel == null || this.form.fansChannel == ""){ | ||||
|             this.form.mainDietitian = null; | ||||
|             return; | ||||
|         } | ||||
|         this.autoSelectNutritionist(); | ||||
|     }, | ||||
|     autoSelectNutritionist(){ | ||||
|         getLiveSchedulByTime({'fanChannel':this.form.fansChannel,'liveStartTimeString':encodeURIComponent(this.form.fansTime)}).then((response) => { | ||||
|               if (response.code === 200) { | ||||
|                  let live = response.data; | ||||
|                  if(live != undefined && live != null && live.liveNutritionistId != null && this.nutritionistIdOptions != null){ | ||||
|                     let mainDietitian = null; | ||||
|                      this.nutritionistIdOptions.forEach((item,index) => { | ||||
|                         if(live.liveNutritionistId == item.dictValue){ | ||||
|                            mainDietitian = live.liveNutritionistId; | ||||
|                         } | ||||
|                         if(index == this.nutritionistIdOptions.length - 1){ | ||||
|                           this.form.mainDietitian = mainDietitian; | ||||
|                         } | ||||
|                      }); | ||||
|                  }else{ | ||||
|                    this.form.mainDietitian = null; | ||||
|                  } | ||||
|               }else{ | ||||
|                 this.form.mainDietitian = null; | ||||
|               } | ||||
|         }); | ||||
|     } | ||||
|   }, | ||||
| }; | ||||
| </script> | ||||
|   | ||||
| @@ -233,6 +233,7 @@ | ||||
| <script> | ||||
| import { listImportFanRecord, getImportFanRecord, delImportFanRecord, addImportFanRecord, updateImportFanRecord, exportImportFanRecord,removeFanWxAccount,saveWxAccountFanNum } from "@/api/custom/importFanRecord"; | ||||
| import ImportFan from "@/components/ImportFanRecord/ImportFan"; | ||||
| import { getLiveSchedulByTime } from "@/api/custom/liveSchedul"; | ||||
| import dayjs from "dayjs"; | ||||
| const nowDate = dayjs().format("YYYY-MM-DD"); | ||||
| const nowTime = dayjs().format("YYYY-MM-DD HH:mm"); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user