导粉记录

This commit is contained in:
xiezhijun 2021-05-20 18:59:03 +08:00
parent 574c8b424e
commit 17df1db9e2
14 changed files with 135 additions and 26 deletions

View File

@ -79,8 +79,8 @@ public class SysCustomerController extends BaseController {
for (SysCustomer sysCus : list) { for (SysCustomer sysCus : list) {
if (StringUtils.isNotEmpty(sysCus.getPhone())) { if (StringUtils.isNotEmpty(sysCus.getPhone())) {
sysCus.setPhone(StringUtils.hiddenPhoneNumber(sysCus.getPhone())); sysCus.setPhone(StringUtils.hiddenPhoneNumber(sysCus.getPhone()));
sysCus.setEncId(sysCus.getId() != null ? AesUtils.encrypt(sysCus.getId() + "", null) : "");
} }
sysCus.setEncId(sysCus.getId() != null ? AesUtils.encrypt(sysCus.getId() + "", null) : "");
} }
} }
return getDataTable(list); return getDataTable(list);

View File

@ -1,8 +1,12 @@
package com.stdiet.web.controller.custom; package com.stdiet.web.controller.custom;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import com.stdiet.custom.domain.SysImportFanWxAccount;
import com.stdiet.custom.domain.SysWxSaleAccount; import com.stdiet.custom.domain.SysWxSaleAccount;
import com.stdiet.custom.service.ISysImportFanWxAccountService;
import com.stdiet.custom.service.ISysWxSaleAccountService; import com.stdiet.custom.service.ISysWxSaleAccountService;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -39,6 +43,9 @@ public class SysImportFanRecordController extends BaseController
@Autowired @Autowired
private ISysWxSaleAccountService sysWxSaleAccountService; private ISysWxSaleAccountService sysWxSaleAccountService;
@Autowired
private ISysImportFanWxAccountService sysImportFanWxAccountService;
/** /**
* 查询导粉管理列表 * 查询导粉管理列表
*/ */
@ -109,12 +116,16 @@ public class SysImportFanRecordController extends BaseController
/** /**
* 获取可接粉的微信号以及对应销售 * 获取可接粉的微信号以及对应销售
* @param sysWxSaleAccount
* @return * @return
*/ */
@PreAuthorize("@ss.hasPermi('custom:importFanRecord:add')") @PreAuthorize("@ss.hasPermi('custom:importFanRecord:add')")
@GetMapping(value = "/getWxAccountAndSale") @GetMapping(value = "/getWxAccountAndSale")
public TableDataInfo getWxAccountAndSale(SysWxSaleAccount sysWxSaleAccount){ public AjaxResult getWxAccountAndSale(SysImportFanWxAccount sysImportFanWxAccount){
return getDataTable(sysWxSaleAccountService.getWxAccountAndSale(sysWxSaleAccount)); Map<String, Object> result = new HashMap<>();
List<SysWxSaleAccount> list = sysWxSaleAccountService.getWxAccountAndSale();
List<Map<String,Object>> fanNumList = sysImportFanWxAccountService.getTotalImportFanNum(sysImportFanWxAccount);
result.put("wxSaleAccountList", list);
result.put("fanNumList", fanNumList);
return AjaxResult.success(result);
} }
} }

View File

@ -1,9 +1,12 @@
package com.stdiet.custom.domain; package com.stdiet.custom.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import com.stdiet.common.annotation.Excel; import com.stdiet.common.annotation.Excel;
import com.stdiet.common.core.domain.BaseEntity; import com.stdiet.common.core.domain.BaseEntity;
import java.util.Date;
/** /**
* 导粉记录中对应微信记录对象 sys_import_fan_wx_account * 导粉记录中对应微信记录对象 sys_import_fan_wx_account
* *
@ -32,4 +35,8 @@ public class SysImportFanWxAccount extends BaseEntity
/** 删除标识 0未删除 1已删除 */ /** 删除标识 0未删除 1已删除 */
private Long delFlag; private Long delFlag;
//导粉日期
@JsonFormat(pattern = "yyyy-MM-dd")
private Date importFanDate;
} }

View File

@ -1,6 +1,8 @@
package com.stdiet.custom.mapper; package com.stdiet.custom.mapper;
import java.util.List; import java.util.List;
import java.util.Map;
import com.stdiet.custom.domain.SysImportFanWxAccount; import com.stdiet.custom.domain.SysImportFanWxAccount;
/** /**
@ -65,4 +67,11 @@ public interface SysImportFanWxAccountMapper
* @return * @return
*/ */
public SysImportFanWxAccount getWxAccountByFanRecordId(SysImportFanWxAccount sysImportFanWxAccount); public SysImportFanWxAccount getWxAccountByFanRecordId(SysImportFanWxAccount sysImportFanWxAccount);
/**
* 根据微信号查询
* @param sysImportFanWxAccount
* @return
*/
List<Map<String,Object>> getTotalImportFanNum(SysImportFanWxAccount sysImportFanWxAccount);
} }

View File

@ -74,8 +74,7 @@ public interface SysWxSaleAccountMapper
/** /**
* 获取可接粉的微信号以及分配的销售昵称 * 获取可接粉的微信号以及分配的销售昵称
* @param sysWxSaleAccount
* @return * @return
*/ */
List<SysWxSaleAccount> getWxAccountAndSale(SysWxSaleAccount sysWxSaleAccount); List<SysWxSaleAccount> getWxAccountAndSale();
} }

View File

@ -1,7 +1,10 @@
package com.stdiet.custom.service; package com.stdiet.custom.service;
import java.util.List; import java.util.List;
import java.util.Map;
import com.stdiet.custom.domain.SysImportFanWxAccount; import com.stdiet.custom.domain.SysImportFanWxAccount;
import com.stdiet.custom.domain.SysWxSaleAccount;
/** /**
* 导粉记录中对应微信记录Service接口 * 导粉记录中对应微信记录Service接口
@ -65,4 +68,10 @@ public interface ISysImportFanWxAccountService
* @return * @return
*/ */
public SysImportFanWxAccount getWxAccountByFanRecordId(SysImportFanWxAccount sysImportFanWxAccount); public SysImportFanWxAccount getWxAccountByFanRecordId(SysImportFanWxAccount sysImportFanWxAccount);
/**
* 根据日期统计微信号导粉数量
* @return
*/
List<Map<String,Object>> getTotalImportFanNum(SysImportFanWxAccount sysImportFanWxAccount);
} }

View File

@ -75,8 +75,7 @@ public interface ISysWxSaleAccountService
/** /**
* 获取可接粉的微信号以及分配的销售昵称 * 获取可接粉的微信号以及分配的销售昵称
* @param sysWxSaleAccount
* @return * @return
*/ */
List<SysWxSaleAccount> getWxAccountAndSale(SysWxSaleAccount sysWxSaleAccount); List<SysWxSaleAccount> getWxAccountAndSale();
} }

View File

@ -1,7 +1,10 @@
package com.stdiet.custom.service.impl; package com.stdiet.custom.service.impl;
import java.util.List; import java.util.List;
import java.util.Map;
import com.stdiet.common.utils.DateUtils; import com.stdiet.common.utils.DateUtils;
import com.stdiet.custom.domain.SysWxSaleAccount;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.stdiet.custom.mapper.SysImportFanWxAccountMapper; import com.stdiet.custom.mapper.SysImportFanWxAccountMapper;
@ -102,4 +105,13 @@ public class SysImportFanWxAccountServiceImpl implements ISysImportFanWxAccountS
public SysImportFanWxAccount getWxAccountByFanRecordId(SysImportFanWxAccount sysImportFanWxAccount){ public SysImportFanWxAccount getWxAccountByFanRecordId(SysImportFanWxAccount sysImportFanWxAccount){
return sysImportFanWxAccountMapper.getWxAccountByFanRecordId(sysImportFanWxAccount); return sysImportFanWxAccountMapper.getWxAccountByFanRecordId(sysImportFanWxAccount);
} }
/**
* 根据日期统计微信号导粉数量
* @return
*/
public List<Map<String,Object>> getTotalImportFanNum(SysImportFanWxAccount sysImportFanWxAccount){
return sysImportFanWxAccountMapper.getTotalImportFanNum(sysImportFanWxAccount);
}
} }

View File

@ -9,7 +9,9 @@ import com.stdiet.custom.service.ISysWxSaleAccountService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 微信账号Service业务层处理 * 微信账号Service业务层处理
@ -134,7 +136,7 @@ public class SysWxSaleAccountServiceImpl implements ISysWxSaleAccountService {
* @param sysWxSaleAccount * @param sysWxSaleAccount
* @return * @return
*/ */
public List<SysWxSaleAccount> getWxAccountAndSale(SysWxSaleAccount sysWxSaleAccount){ public List<SysWxSaleAccount> getWxAccountAndSale(){
return sysWxSaleAccountMapper.getWxAccountAndSale(sysWxSaleAccount); return sysWxSaleAccountMapper.getWxAccountAndSale();
} }
} }

View File

@ -124,8 +124,8 @@
from sys_import_fan_wx_account fwc from sys_import_fan_wx_account fwc
left join sys_wx_sale_account wa on wa.id = fwc.import_wx_account_id and wa.del_flag = 0 left join sys_wx_sale_account wa on wa.id = fwc.import_wx_account_id and wa.del_flag = 0
left join sys_wx_distribution swd on swd.wechat_account = wa.id and swd.del_flag = 0 left join sys_wx_distribution swd on swd.wechat_account = wa.id and swd.del_flag = 0
left join sys_user su on swd.user_id = su.id and su.del_flag = 0 left join sys_user su on swd.user_id = su.user_id and su.del_flag = 0
where fwc.del_flag = 0 where fwc.del_flag = 0 and fwc.import_fan_record_id = #{id}
</select> </select>
</mapper> </mapper>

View File

@ -87,4 +87,22 @@
and import_wx_account_id = #{importWxAccountId} order by id desc limit 1 and import_wx_account_id = #{importWxAccountId} order by id desc limit 1
</select> </select>
<!-- 根据微信号ID查询导粉多少 -->
<select id="getTotalImportFanNum" parameterType="SysImportFanWxAccount" resultType="Map">
select w.import_wx_account_id as wxAccountId,sum(w.import_fan_num) as fanNum
from
(
select fwa.import_wx_account_id,fwa.import_fan_num from sys_import_fan_wx_account fwa
left join sys_import_fan_record ifr on fwa.import_fan_record_id = ifr.id and ifr.del_flag = 0
where fwa.del_flag = 0
<if test="importFanDate != null">
and ifr.import_fan_date = #{importFanDate}
</if>
<if test="importWxAccountId != null">
and fwa.import_wx_account_id = #{importWxAccountId}
</if>
) w
group by w.import_wx_account_id order by w.import_wx_account_id desc
</select>
</mapper> </mapper>

View File

@ -139,14 +139,13 @@
</insert> </insert>
<!-- 查询可以接粉的微信号以及对应销售,用于导粉记录管理 --> <!-- 查询可以接粉的微信号以及对应销售,用于导粉记录管理 -->
<select id="getWxAccountAndSale" parameterType="SysWxSaleAccount" resultMap="SysWxSaleAccountResult"> <select id="getWxAccountAndSale" resultMap="SysWxSaleAccountResult">
select wa.id, wa.wx_account, su.nick_name as sale_name select wa.id, wa.wx_account, su.nick_name as sale_name
from sys_wx_sale_account wa from sys_wx_sale_account wa
left join sys_wx_distribution swd on wa.id = swd.wechat_account and swd.del_flag = 0 left join sys_wx_distribution swd on wa.id = swd.wechat_account and swd.del_flag = 0
LEFT JOIN sys_user su ON su.user_id = swd.user_id AND su.del_flag = 0 LEFT JOIN sys_user su ON su.user_id = swd.user_id AND su.del_flag = 0
where wa.del_flag = 0 and wa.status = 0 where wa.del_flag = 0 and wa.status = 0
<if test="wxAccount != null and wxAccount != ''">and wa.wx_account like concat('%', #{wxAccount}, '%')</if> order by su.user_id asc
order by wa.id desc
</select> </select>
</mapper> </mapper>

View File

@ -4,7 +4,7 @@
<div style="height: 500px; overflow: auto"> <div style="height: 500px; overflow: auto">
<el-table v-loading="loading" :data="wxAccountList"> <el-table v-loading="loading" :data="wxAccountList">
<!--<el-table-column label="微信昵称" align="center" prop="wxNickName" />--> <!--<el-table-column label="微信昵称" align="center" prop="wxNickName" />-->
<el-table-column label="微信号" align="center" prop="wxAccount" width="120"/> <el-table-column label="微信号" align="center" prop="wxAccount" width="160"/>
<el-table-column label="销售" align="center" prop="saleName" width="120"/> <el-table-column label="销售" align="center" prop="saleName" width="120"/>
<el-table-column label="已导粉数量" align="center" prop="importFanNum" width="120"/> <el-table-column label="已导粉数量" align="center" prop="importFanNum" width="120"/>
<el-table-column label="进粉渠道" align="center" prop="importFanChannel" > <el-table-column label="进粉渠道" align="center" prop="importFanChannel" >
@ -48,7 +48,7 @@
<el-input-number v-model="scope.row.fanNum" :min="1" :max="10000" label="导粉数量" style="width:160px"></el-input-number> <el-input-number v-model="scope.row.fanNum" :min="1" :max="10000" label="导粉数量" style="width:160px"></el-input-number>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="normal" size="normal"
@ -91,7 +91,9 @@ export default {
wxAccountList:[], wxAccountList:[],
fanChanneloptions:[], fanChanneloptions:[],
// //
liveSchedukList:[] liveSchedukList:[],
//
fanNumList:[]
}; };
}, },
created(){ created(){
@ -129,16 +131,17 @@ export default {
// //
getListWxAccount() { getListWxAccount() {
this.loading = true; this.loading = true;
getWxAccountAndSale().then((response) => { getWxAccountAndSale({'importFanDate': this.data.importFanDate}).then((response) => {
response.rows.forEach((item,index) => { response.data.wxSaleAccountList.forEach((item,index) => {
item.fanNum = 1; item.fanNum = 1;
}) item.importFanNum = this.getTotalFanNum(response.data.fanNumList, item.id);
this.wxAccountList = response.rows; });
this.wxAccountList = response.data.wxSaleAccountList;
this.fanNumList = response.data.fanNumList;
this.loading = false; this.loading = false;
}); });
}, },
getAllLiveSchedulByDate(){ getAllLiveSchedulByDate(){
console.log("--");
getAllLiveSchedulByDate({'liveSchedulDate':this.data.importFanDate}).then((response) => { getAllLiveSchedulByDate({'liveSchedulDate':this.data.importFanDate}).then((response) => {
response.data.forEach((item,index) => { response.data.forEach((item,index) => {
item.liveRoomName = item.liveNutritionistName + " " + item.liveRoomName; item.liveRoomName = item.liveNutritionistName + " " + item.liveRoomName;
@ -146,6 +149,18 @@ export default {
this.liveSchedukList = response.data; this.liveSchedukList = response.data;
}); });
}, },
getTotalFanNum(fanNumList, wxAccountId){
if(wxAccountId == null || fanNumList == null){
return 0;
}
let num = 0;
fanNumList.forEach((item,index) => {
if(item.wxAccountId == wxAccountId){
num = item.fanNum;
}
});
return num;
},
addImportFanRecord(row){ addImportFanRecord(row){
// //
if(row.importFanChannel == undefined || row.importFanChannel == null){ if(row.importFanChannel == undefined || row.importFanChannel == null){
@ -177,6 +192,7 @@ export default {
row.importFanChannel = null; row.importFanChannel = null;
row.fanNum = 1; row.fanNum = 1;
row.importFanLive = null; row.importFanLive = null;
row.importFanNum += row.fanNum;
} }
}); });

View File

@ -92,10 +92,29 @@
<el-table-column label="进粉账号渠道" align="center" prop="importFanChannelName" /> <el-table-column label="进粉账号渠道" align="center" prop="importFanChannelName" />
<el-table-column label="所属直播间" align="center" prop="liveRoomName" > <el-table-column label="所属直播间" align="center" prop="liveRoomName" >
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.liveRoomName + "—" + scope.row.liveNutritionistName}} {{(scope.row.liveRoomName != null || scope.row.liveNutritionistName != null) ? (scope.row.liveRoomName + "—" + scope.row.liveNutritionistName) : ""}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="导粉总数" align="center" prop="wxAccountList" :formatter="getTotalFanNum">
</el-table-column>
<el-table-column label="导粉微信号" align="center" prop="wxAccountList" >
<template slot-scope="scope">
<el-popover
placement="left"
width="390"
trigger="click">
<el-table :data="scope.row.wxAccountList" style="width:370;height: 400px;overflow: auto;">
<el-table-column width="100" property="saleName" label="销售" align="center"></el-table-column>
<el-table-column width="160" property="wxAccount" label="微信号" align="center"></el-table-column>
<el-table-column width="80" property="importFanNum" label="导粉数量" align="center"></el-table-column>
</el-table>
<el-button slot="reference">详情</el-button>
</el-popover>
</template>
</el-table-column>
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
@ -112,7 +131,7 @@
v-hasPermi="['custom:importFanRecord:remove']" v-hasPermi="['custom:importFanRecord:remove']"
>删除</el-button> >删除</el-button>
</template> </template>
</el-table-column> </el-table-column>-->
</el-table> </el-table>
<pagination <pagination
@ -334,6 +353,15 @@ export default {
this.$refs.importFanRef.showDialog(data,()=>{ this.$refs.importFanRef.showDialog(data,()=>{
this.getList(); this.getList();
}, this.fanChanneloptions); }, this.fanChanneloptions);
},
getTotalFanNum(row, column){
let fanNum = 0;
if(row.wxAccountList != null){
row.wxAccountList.forEach((item,index) => {
fanNum += item.importFanNum == null ? 0 : item.importFanNum;
});
}
return fanNum;
} }
} }
}; };