Merge branch 'master' of gitee.com:darlk/ShengTangManage into develop
This commit is contained in:
@ -1,9 +1,13 @@
|
||||
package com.stdiet.custom.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.stdiet.common.annotation.Excel;
|
||||
import com.stdiet.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 导粉管理对象 sys_import_fan_record
|
||||
@ -11,6 +15,7 @@ import com.stdiet.common.core.domain.BaseEntity;
|
||||
* @author xzj
|
||||
* @date 2021-05-17
|
||||
*/
|
||||
@Data
|
||||
public class SysImportFanRecord extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -33,4 +38,31 @@ public class SysImportFanRecord extends BaseEntity
|
||||
|
||||
/** 删除标识,0未删除 1已删除 */
|
||||
private Long delFlag;
|
||||
|
||||
//微信ID
|
||||
private Long wxAccountId;
|
||||
|
||||
//进粉数量
|
||||
private Long fanNum;
|
||||
|
||||
private String importFanChannelName;
|
||||
|
||||
private String liveRoomName;
|
||||
|
||||
private String liveNutritionistName;
|
||||
|
||||
private List<Map<String,Object>> wxAccountList;
|
||||
|
||||
|
||||
private String importFanChannels;
|
||||
|
||||
private String importFanLives;
|
||||
|
||||
private String wxAccountIds;
|
||||
|
||||
private String fanNums;
|
||||
|
||||
|
||||
//总进粉数量
|
||||
private Integer totalFanNum;
|
||||
}
|
@ -1,9 +1,12 @@
|
||||
package com.stdiet.custom.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import com.stdiet.common.annotation.Excel;
|
||||
import com.stdiet.common.core.domain.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 导粉记录中对应微信记录对象 sys_import_fan_wx_account
|
||||
*
|
||||
@ -32,4 +35,8 @@ public class SysImportFanWxAccount extends BaseEntity
|
||||
|
||||
/** 删除标识 0未删除 1已删除 */
|
||||
private Long delFlag;
|
||||
|
||||
//导粉日期
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date importFanDate;
|
||||
}
|
@ -44,4 +44,7 @@ public class SysWxSaleAccount extends BaseEntity
|
||||
private Integer status;
|
||||
|
||||
private Integer useCount;
|
||||
|
||||
//销售昵称
|
||||
private String saleName;
|
||||
}
|
@ -58,4 +58,14 @@ public interface SysImportFanRecordMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysImportFanRecordByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据日期渠道、直播间获取进粉记录
|
||||
* @param sysImportFanRecord
|
||||
* @return
|
||||
*/
|
||||
public SysImportFanRecord getFanRecordByChannelLive(SysImportFanRecord sysImportFanRecord);
|
||||
|
||||
//查询总导粉数量
|
||||
int selectTotalSysImportFanNum(SysImportFanRecord sysImportFanRecord);
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
package com.stdiet.custom.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.stdiet.custom.domain.SysImportFanWxAccount;
|
||||
|
||||
/**
|
||||
@ -58,4 +60,25 @@ public interface SysImportFanWxAccountMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysImportFanWxAccountByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据导粉记录ID、微信ID查询对应微信记录
|
||||
* @param sysImportFanWxAccount
|
||||
* @return
|
||||
*/
|
||||
public SysImportFanWxAccount getWxAccountByFanRecordId(SysImportFanWxAccount sysImportFanWxAccount);
|
||||
|
||||
/**
|
||||
* 根据微信号查询
|
||||
* @param sysImportFanWxAccount
|
||||
* @return
|
||||
*/
|
||||
List<Map<String,Object>> getTotalImportFanNum(SysImportFanWxAccount sysImportFanWxAccount);
|
||||
|
||||
/**
|
||||
* 根据记录ID删除对应所有微信
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
int deleteSysImportFanWxAccountByFanRecordIds(Long[] ids);
|
||||
}
|
@ -71,4 +71,10 @@ public interface SysWxSaleAccountMapper
|
||||
SysWxSaleAccount selectWxAdId();
|
||||
|
||||
int insertWxAdLog(SysWxAdLog sysWxAdLog);
|
||||
|
||||
/**
|
||||
* 获取可接粉的微信号以及分配的销售昵称
|
||||
* @return
|
||||
*/
|
||||
List<SysWxSaleAccount> getWxAccountAndSale();
|
||||
}
|
@ -2,6 +2,7 @@ package com.stdiet.custom.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.stdiet.custom.domain.SysWxUserInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 微信用户Mapper接口
|
||||
@ -62,4 +63,11 @@ public interface SysWxUserInfoMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysWxUserInfoByIds(String[] openids);
|
||||
|
||||
/**
|
||||
* 根据手机号查询微信用户
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
public SysWxUserInfo getSysWxUserInfoByPhone(@Param("phone")String phone);
|
||||
}
|
@ -58,4 +58,7 @@ public interface ISysImportFanRecordService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysImportFanRecordById(Long id);
|
||||
|
||||
//查询总导粉数量
|
||||
int selectTotalSysImportFanNum(SysImportFanRecord sysImportFanRecord);
|
||||
}
|
@ -1,7 +1,10 @@
|
||||
package com.stdiet.custom.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.stdiet.custom.domain.SysImportFanWxAccount;
|
||||
import com.stdiet.custom.domain.SysWxSaleAccount;
|
||||
|
||||
/**
|
||||
* 导粉记录中对应微信记录Service接口
|
||||
@ -58,4 +61,24 @@ public interface ISysImportFanWxAccountService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysImportFanWxAccountById(Long id);
|
||||
|
||||
/**
|
||||
* 根据导粉记录ID、微信ID查询对应微信记录
|
||||
* @param sysImportFanWxAccount
|
||||
* @return
|
||||
*/
|
||||
public SysImportFanWxAccount getWxAccountByFanRecordId(SysImportFanWxAccount sysImportFanWxAccount);
|
||||
|
||||
/**
|
||||
* 根据日期统计微信号导粉数量
|
||||
* @return
|
||||
*/
|
||||
List<Map<String,Object>> getTotalImportFanNum(SysImportFanWxAccount sysImportFanWxAccount);
|
||||
|
||||
/**
|
||||
* 根据记录ID删除对应所有微信
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
int deleteSysImportFanWxAccountByFanRecordIds(Long[] ids);
|
||||
}
|
@ -72,4 +72,10 @@ public interface ISysWxSaleAccountService
|
||||
String getWxAdId(SysWxAdLog sysWxAdLog);
|
||||
|
||||
Integer logWxAd(SysWxAdLog sysWxAdLog);
|
||||
|
||||
/**
|
||||
* 获取可接粉的微信号以及分配的销售昵称
|
||||
* @return
|
||||
*/
|
||||
List<SysWxSaleAccount> getWxAccountAndSale();
|
||||
}
|
@ -63,5 +63,12 @@ public interface ISysWxUserInfoService
|
||||
*/
|
||||
public int deleteSysWxUserInfoById(String openid);
|
||||
|
||||
/**
|
||||
* 根据手机号查询微信用户
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
public SysWxUserInfo getSysWxUserInfoByPhone(String phone);
|
||||
|
||||
|
||||
}
|
@ -33,7 +33,7 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
|
||||
private SysOrderMapper sysOrderMapper;
|
||||
|
||||
@Autowired
|
||||
private SysOrderPauseMapper sysOrderPauseMapper;
|
||||
private SysOrderPauseMapper sysOrderPauseMapper ;
|
||||
|
||||
@Autowired
|
||||
private ISysOrderNutritionistReplaceRecordService sysOrderNutritionistReplaceRecordService;
|
||||
|
@ -14,6 +14,7 @@ import com.stdiet.custom.domain.SysCustomer;
|
||||
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
|
||||
import com.stdiet.custom.dto.request.HealthyDetailRequest;
|
||||
import com.stdiet.custom.dto.response.NutritionalCalories;
|
||||
import com.stdiet.custom.mapper.SysCustomerMapper;
|
||||
import com.stdiet.custom.service.ISysCustomerService;
|
||||
import com.stdiet.custom.utils.NutritionalUtils;
|
||||
import com.stdiet.custom.utils.PdfUtils;
|
||||
@ -36,7 +37,7 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService
|
||||
private SysCustomerHealthyMapper sysCustomerHealthyMapper;
|
||||
|
||||
@Autowired
|
||||
private ISysCustomerService sysCustomerService;
|
||||
private SysCustomerMapper sysCustomerMapper;
|
||||
|
||||
public static final String reportDownFileNameFormat = "%s超重%s斤%s";
|
||||
|
||||
@ -78,7 +79,7 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService
|
||||
return AjaxResult.error("客户不存在");
|
||||
}
|
||||
//判断客户是否存在
|
||||
SysCustomer sysCustomer = sysCustomerService.selectSysCustomerById(Long.parseLong(customerId));
|
||||
SysCustomer sysCustomer = sysCustomerMapper.selectSysCustomerById(Long.parseLong(customerId));
|
||||
if(sysCustomer == null){
|
||||
return AjaxResult.error("客户不存在");
|
||||
}
|
||||
|
@ -6,10 +6,14 @@ import com.stdiet.common.utils.sign.AesUtils;
|
||||
import com.stdiet.custom.domain.SysCustomer;
|
||||
import com.stdiet.custom.domain.SysCustomerHealthy;
|
||||
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
|
||||
import com.stdiet.custom.domain.SysWxUserInfo;
|
||||
import com.stdiet.custom.mapper.SysCustomerMapper;
|
||||
import com.stdiet.custom.mapper.SysCustomerPhysicalSignsMapper;
|
||||
import com.stdiet.custom.mapper.SysWxUserInfoMapper;
|
||||
import com.stdiet.custom.service.ISysCustomerService;
|
||||
import com.stdiet.custom.service.ISysWxUserInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -38,6 +42,9 @@ public class SysCustomerServiceImpl implements ISysCustomerService {
|
||||
@Autowired
|
||||
private SysCustomerPhysicalSignsServiceImpl sysCustomerPhysicalSignsService;
|
||||
|
||||
@Autowired
|
||||
private ISysWxUserInfoService sysWxUserInfoService;
|
||||
|
||||
/**
|
||||
* 查询客户信息
|
||||
*
|
||||
@ -69,7 +76,11 @@ public class SysCustomerServiceImpl implements ISysCustomerService {
|
||||
@Override
|
||||
public int insertSysCustomer(SysCustomer sysCustomer) {
|
||||
sysCustomer.setCreateTime(DateUtils.getNowDate());
|
||||
return sysCustomerMapper.insertSysCustomer(sysCustomer);
|
||||
int row = sysCustomerMapper.insertSysCustomer(sysCustomer);
|
||||
if(row > 0){
|
||||
updateWxInfoMessage(sysCustomer);
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -81,7 +92,11 @@ public class SysCustomerServiceImpl implements ISysCustomerService {
|
||||
@Override
|
||||
public int updateSysCustomer(SysCustomer sysCustomer) {
|
||||
sysCustomer.setUpdateTime(DateUtils.getNowDate());
|
||||
return sysCustomerMapper.updateSysCustomer(sysCustomer);
|
||||
int row = sysCustomerMapper.updateSysCustomer(sysCustomer);
|
||||
if(row > 0){
|
||||
updateWxInfoMessage(sysCustomer);
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -177,4 +192,17 @@ public class SysCustomerServiceImpl implements ISysCustomerService {
|
||||
public SysCustomer getCustomerByOpenId(String openid){
|
||||
return sysCustomerMapper.getCustomerByOpenId(openid);
|
||||
}
|
||||
|
||||
@Async
|
||||
public void updateWxInfoMessage(SysCustomer newCustomer){
|
||||
if(newCustomer == null || newCustomer.getId() == null || StringUtils.isEmpty(newCustomer.getPhone())){
|
||||
return;
|
||||
}
|
||||
//根据手机号查询微信用户记录
|
||||
SysWxUserInfo wxUserInfo = sysWxUserInfoService.getSysWxUserInfoByPhone(newCustomer.getPhone());
|
||||
if(wxUserInfo != null && (wxUserInfo.getCusId() == null || wxUserInfo.getCusId().longValue() != newCustomer.getId())){
|
||||
wxUserInfo.setCusId(newCustomer.getId());
|
||||
sysWxUserInfoService.updateSysWxUserInfo(wxUserInfo);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,10 @@
|
||||
package com.stdiet.custom.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.custom.domain.SysImportFanWxAccount;
|
||||
import com.stdiet.custom.service.ISysImportFanWxAccountService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.stdiet.custom.mapper.SysImportFanRecordMapper;
|
||||
@ -20,6 +23,9 @@ public class SysImportFanRecordServiceImpl implements ISysImportFanRecordService
|
||||
@Autowired
|
||||
private SysImportFanRecordMapper sysImportFanRecordMapper;
|
||||
|
||||
@Autowired
|
||||
private ISysImportFanWxAccountService sysImportFanWxAccountService;
|
||||
|
||||
/**
|
||||
* 查询导粉管理
|
||||
*
|
||||
@ -54,7 +60,29 @@ public class SysImportFanRecordServiceImpl implements ISysImportFanRecordService
|
||||
public int insertSysImportFanRecord(SysImportFanRecord sysImportFanRecord)
|
||||
{
|
||||
sysImportFanRecord.setCreateTime(DateUtils.getNowDate());
|
||||
return sysImportFanRecordMapper.insertSysImportFanRecord(sysImportFanRecord);
|
||||
//根据账号渠道、直播间判断是否已存在该渠道的导粉记录
|
||||
SysImportFanRecord record = sysImportFanRecordMapper.getFanRecordByChannelLive(sysImportFanRecord);
|
||||
int row = 0;
|
||||
if(record == null){
|
||||
row = sysImportFanRecordMapper.insertSysImportFanRecord(sysImportFanRecord);
|
||||
}
|
||||
if(record != null || row > 0){
|
||||
//添加微信号对应记录
|
||||
SysImportFanWxAccount sysImportFanWxAccount = new SysImportFanWxAccount();
|
||||
sysImportFanWxAccount.setImportFanRecordId(record != null ? record.getId() : sysImportFanRecord.getId());
|
||||
sysImportFanWxAccount.setImportWxAccountId(sysImportFanRecord.getWxAccountId());
|
||||
sysImportFanWxAccount.setImportFanNum(sysImportFanRecord.getFanNum());
|
||||
sysImportFanWxAccount.setCreateTime(new Date());
|
||||
//根据微信号、导粉记录查询是否存在
|
||||
SysImportFanWxAccount oldFanWxAccount = sysImportFanWxAccountService.getWxAccountByFanRecordId(sysImportFanWxAccount);
|
||||
if(oldFanWxAccount == null){
|
||||
row = sysImportFanWxAccountService.insertSysImportFanWxAccount(sysImportFanWxAccount);
|
||||
}else{
|
||||
oldFanWxAccount.setImportFanNum((oldFanWxAccount.getImportFanNum() == null ? 0 : oldFanWxAccount.getImportFanNum()) + sysImportFanWxAccount.getImportFanNum());
|
||||
row = sysImportFanWxAccountService.updateSysImportFanWxAccount(oldFanWxAccount);
|
||||
}
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -79,7 +107,11 @@ public class SysImportFanRecordServiceImpl implements ISysImportFanRecordService
|
||||
@Override
|
||||
public int deleteSysImportFanRecordByIds(Long[] ids)
|
||||
{
|
||||
return sysImportFanRecordMapper.deleteSysImportFanRecordByIds(ids);
|
||||
int row = sysImportFanRecordMapper.deleteSysImportFanRecordByIds(ids);
|
||||
if(row > 0){
|
||||
sysImportFanWxAccountService.deleteSysImportFanWxAccountByFanRecordIds(ids);
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -91,6 +123,16 @@ public class SysImportFanRecordServiceImpl implements ISysImportFanRecordService
|
||||
@Override
|
||||
public int deleteSysImportFanRecordById(Long id)
|
||||
{
|
||||
return sysImportFanRecordMapper.deleteSysImportFanRecordById(id);
|
||||
int row = sysImportFanRecordMapper.deleteSysImportFanRecordById(id);
|
||||
if(row > 0){
|
||||
Long[] ids = {id};
|
||||
sysImportFanWxAccountService.deleteSysImportFanWxAccountByFanRecordIds(ids);
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
//查询总导粉数量
|
||||
public int selectTotalSysImportFanNum(SysImportFanRecord sysImportFanRecord){
|
||||
return sysImportFanRecordMapper.selectTotalSysImportFanNum(sysImportFanRecord);
|
||||
}
|
||||
}
|
@ -1,7 +1,10 @@
|
||||
package com.stdiet.custom.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.custom.domain.SysWxSaleAccount;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.stdiet.custom.mapper.SysImportFanWxAccountMapper;
|
||||
@ -93,4 +96,31 @@ public class SysImportFanWxAccountServiceImpl implements ISysImportFanWxAccountS
|
||||
{
|
||||
return sysImportFanWxAccountMapper.deleteSysImportFanWxAccountById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据导粉记录ID、微信ID查询对应微信记录
|
||||
* @param sysImportFanWxAccount
|
||||
* @return
|
||||
*/
|
||||
public SysImportFanWxAccount getWxAccountByFanRecordId(SysImportFanWxAccount sysImportFanWxAccount){
|
||||
return sysImportFanWxAccountMapper.getWxAccountByFanRecordId(sysImportFanWxAccount);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据日期统计微信号导粉数量
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String,Object>> getTotalImportFanNum(SysImportFanWxAccount sysImportFanWxAccount){
|
||||
return sysImportFanWxAccountMapper.getTotalImportFanNum(sysImportFanWxAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据记录ID删除对应所有微信
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
public int deleteSysImportFanWxAccountByFanRecordIds(Long[] ids){
|
||||
return sysImportFanWxAccountMapper.deleteSysImportFanWxAccountByFanRecordIds(ids);
|
||||
}
|
||||
}
|
@ -64,7 +64,10 @@ public class SysRecipesServiceImpl implements ISysRecipesService {
|
||||
|
||||
@Override
|
||||
public List<SysRecipes> selectSysRecipesByRecipesId(Long id) {
|
||||
return sysRecipesMapper.selectSysRecipesByRecipesId(id);
|
||||
long t = System.currentTimeMillis();
|
||||
List<SysRecipes> list = sysRecipesMapper.selectSysRecipesByRecipesId(id);
|
||||
System.out.println(System.currentTimeMillis() - t);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -9,7 +9,9 @@ import com.stdiet.custom.service.ISysWxSaleAccountService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 微信账号Service业务层处理
|
||||
@ -128,4 +130,13 @@ public class SysWxSaleAccountServiceImpl implements ISysWxSaleAccountService {
|
||||
public Integer logWxAd(SysWxAdLog sysWxAdLog) {
|
||||
return sysWxSaleAccountMapper.insertWxAdLog(sysWxAdLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取可接粉的微信号以及分配的销售昵称
|
||||
* @param sysWxSaleAccount
|
||||
* @return
|
||||
*/
|
||||
public List<SysWxSaleAccount> getWxAccountAndSale(){
|
||||
return sysWxSaleAccountMapper.getWxAccountAndSale();
|
||||
}
|
||||
}
|
@ -97,4 +97,13 @@ public class SysWxUserInfoServiceImpl implements ISysWxUserInfoService {
|
||||
public int deleteSysWxUserInfoById(String openid) {
|
||||
return sysWxUserInfoMapper.deleteSysWxUserInfoById(openid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据手机号查询微信用户
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
public SysWxUserInfo getSysWxUserInfoByPhone(String phone){
|
||||
return sysWxUserInfoMapper.getSysWxUserInfoByPhone(phone);
|
||||
}
|
||||
}
|
@ -14,18 +14,56 @@
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
|
||||
<result property="importFanChannelName" column="import_fan_channel_name"></result>
|
||||
<result property="liveRoomName" column="live_room_name"></result>
|
||||
<result property="liveNutritionistName" column="live_nutritionist_name"></result>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="SysImportFanRecord" id="SysImportFanRecordResultExtended">
|
||||
<result property="id" column="id" />
|
||||
<result property="importFanDate" column="import_fan_date" />
|
||||
<result property="importFanChannel" column="import_fan_channel" />
|
||||
<result property="importFanLive" column="import_fan_live" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
|
||||
<result property="importFanChannelName" column="import_fan_channel_name"></result>
|
||||
<result property="liveRoomName" column="live_room_name"></result>
|
||||
<result property="liveNutritionistName" column="live_nutritionist_name"></result>
|
||||
|
||||
<!-- 查询该渠道已导粉的微信号 -->
|
||||
<association property="wxAccountList" column="id" select="getWxAccountListByFanRecordId"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysImportFanRecordVo">
|
||||
select id, import_fan_date, import_fan_channel, import_fan_live, create_time, create_by, update_time, update_by, del_flag from sys_import_fan_record
|
||||
</sql>
|
||||
|
||||
<select id="selectSysImportFanRecordList" parameterType="SysImportFanRecord" resultMap="SysImportFanRecordResult">
|
||||
<include refid="selectSysImportFanRecordVo"/>
|
||||
where del_flag = 0
|
||||
<if test="importFanDate != null "> and import_fan_date = #{importFanDate}</if>
|
||||
<if test="importFanChannel != null "> and import_fan_channel = #{importFanChannel}</if>
|
||||
<if test="importFanLive != null "> and import_fan_live = #{importFanLive}</if>
|
||||
<select id="selectSysImportFanRecordList" parameterType="SysImportFanRecord" resultMap="SysImportFanRecordResultExtended">
|
||||
select fc.id, fc.import_fan_date, fc.import_fan_channel, fc.import_fan_live, fc.create_time,
|
||||
ca.dict_label as import_fan_channel_name, slt.dict_label as live_room_name,su_nutritionist.nick_name as live_nutritionist_name
|
||||
from sys_import_fan_record as fc
|
||||
left join (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_account') AS ca ON ca.dict_value = fc.import_fan_channel
|
||||
left join sys_live_schedul as slc on slc.id = fc.import_fan_live and slc.del_flag = 0
|
||||
left join (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'sys_live_type') AS slt ON slt.dict_value = slc.live_room
|
||||
left join sys_user as su_nutritionist on su_nutritionist.user_id = slc.live_nutritionist_id and su_nutritionist.del_flag = 0
|
||||
where fc.del_flag = 0
|
||||
<if test="importFanDate != null "> and fc.import_fan_date = #{importFanDate}</if>
|
||||
<if test="importFanChannel != null "> and fc.import_fan_channel = #{importFanChannel}</if>
|
||||
order by fc.import_fan_date desc,fc.import_fan_channel asc
|
||||
</select>
|
||||
|
||||
<select id="selectTotalSysImportFanNum" parameterType="SysImportFanRecord" resultType="int">
|
||||
select sum(fwa.import_fan_num)
|
||||
from sys_import_fan_record as fc
|
||||
left join sys_import_fan_wx_account fwa on fwa.import_fan_record_id = fc.id and fwa.del_flag = 0
|
||||
where fc.del_flag = 0
|
||||
<if test="importFanDate != null "> and fc.import_fan_date = #{importFanDate}</if>
|
||||
<if test="importFanChannel != null "> and fc.import_fan_channel = #{importFanChannel}</if>
|
||||
</select>
|
||||
|
||||
<select id="selectSysImportFanRecordById" parameterType="Long" resultMap="SysImportFanRecordResult">
|
||||
@ -83,4 +121,20 @@
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="getFanRecordByChannelLive" parameterType="SysImportFanRecord" resultMap="SysImportFanRecordResult">
|
||||
select * from sys_import_fan_record where del_flag = 0 and import_fan_date = #{importFanDate} and import_fan_channel = #{importFanChannel}
|
||||
and import_fan_live = #{importFanLive}
|
||||
order by id desc limit 1
|
||||
</select>
|
||||
|
||||
<select id="getWxAccountListByFanRecordId" parameterType="Long" resultType="Map">
|
||||
select fwc.id, fwc.import_fan_record_id as importFanRecordId, fwc.import_wx_account_id as importWxAccountId, fwc.import_fan_num as importFanNum,
|
||||
su.nick_name as saleName,wa.wx_account as wxAccount
|
||||
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_distribution swd on swd.wechat_account = wa.id and swd.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 and fwc.import_fan_record_id = #{id}
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -82,4 +82,35 @@
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="getWxAccountByFanRecordId" parameterType="SysImportFanWxAccount" resultMap="SysImportFanWxAccountResult">
|
||||
select * from sys_import_fan_wx_account where del_flag = 0 and import_fan_record_id = #{importFanRecordId}
|
||||
and import_wx_account_id = #{importWxAccountId} order by id desc limit 1
|
||||
</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>
|
||||
|
||||
<!-- 根据导粉ID删除对应所有微信记录 -->
|
||||
<update id="deleteSysImportFanWxAccountByFanRecordIds" parameterType="String">
|
||||
update sys_import_fan_wx_account set del_flag = 1 where import_fan_record_id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
</mapper>
|
@ -28,7 +28,7 @@
|
||||
<result property="fanChannelName" column="fan_channel_name"></result>
|
||||
|
||||
<!-- 根据渠道查询对应微信号(微信账号分配表中) -->
|
||||
<!--<association property="wxAccountList" column="fan_channel" select="getWxAccountListByFanChannel"/>-->
|
||||
<association property="wxAccountList" column="id" select="getWxAccountListByLiveId"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="SysLiveSchedul" id="SysLiveSchedulResultSigle">
|
||||
@ -74,9 +74,9 @@
|
||||
<if test="fanChannel != null">
|
||||
and slc.fan_channel = #{fanChannel}
|
||||
</if>
|
||||
<if test="wxAccountId != null">
|
||||
<!--<if test="wxAccountId != null">
|
||||
and slc.fan_channel = (SELECT swd.account_id FROM sys_wx_distribution AS swd where swd.wechat_account = #{wxAccountId} and swd.del_flag = 0 limit 1)
|
||||
</if>
|
||||
</if>-->
|
||||
order by slc.live_schedul_date desc,slc.live_start_time desc ,slc.live_room asc
|
||||
</select>
|
||||
|
||||
@ -162,14 +162,15 @@
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- 根据渠道查询该渠道下分配的微信号 -->
|
||||
<select id="getWxAccountListByFanChannel" parameterType="Integer" resultType="Map">
|
||||
SELECT su.nick_name as nickName,swsa.wx_account as wxAccount,asg.dict_label as saleGroupName
|
||||
FROM sys_wx_distribution AS swd
|
||||
lEFT JOIN sys_wx_sale_account swsa ON swsa.id = swd.wechat_account and swsa.del_flag = 0
|
||||
LEFT JOIN sys_user su ON su.user_id = swd.user_id AND su.del_flag = 0
|
||||
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'sale_group') AS asg ON asg.dict_value = swd.sale_group_id
|
||||
where swd.account_id = #{fan_channel} and swd.del_flag = 0
|
||||
<!-- 根据直播ID查询该渠道下分配的微信号 -->
|
||||
<select id="getWxAccountListByLiveId" parameterType="Long" resultType="Map">
|
||||
SELECT su.nick_name as saleName,w.wx_account as wxAccount, sum(wa.import_fan_num) as fanNum from sys_import_fan_record as fc
|
||||
left join sys_import_fan_wx_account as wa on wa.import_fan_record_id = fc.id and wa.del_flag = 0
|
||||
left join sys_wx_sale_account as w on w.id = wa.import_wx_account_id and w.del_flag = 0
|
||||
left join sys_wx_distribution swd on swd.wechat_account = w.id and swd.del_flag = 0
|
||||
left join sys_user su on swd.user_id = su.user_id and su.del_flag = 0
|
||||
where fc.import_fan_live = #{id} and fc.del_flag = 0
|
||||
group by w.wx_account,su.nick_name
|
||||
</select>
|
||||
|
||||
<!-- 查询直播时间范围是否重叠 -->
|
||||
|
@ -198,12 +198,16 @@
|
||||
</select>
|
||||
|
||||
<select id="selectDishesByMenuIdShow" parameterType="Long" resultMap="SysDishesResultShow">
|
||||
SELECT * FROM (SELECT id, menu_id, dishes_id, type, detail, remark FROM sys_customer_menu_dishes WHERE menu_id = #{id}) AS menu
|
||||
LEFT JOIN sys_dishes ON menu.dishes_id = sys_dishes.id
|
||||
SELECT
|
||||
menu.id, menu.menu_id, menu.dishes_id, menu.type, menu.detail, menu.remark, sd.is_main,sd.name,sd.methods
|
||||
FROM (SELECT id, menu_id, dishes_id, type, detail, remark FROM sys_customer_menu_dishes WHERE menu_id = #{id}) AS menu
|
||||
LEFT JOIN sys_dishes as sd ON menu.dishes_id = sd.id
|
||||
</select>
|
||||
|
||||
<select id="selectIngredientsByDishesIdShow" parameterType="Long" resultMap="SysIgdsResultShow">
|
||||
SELECT * FROM(
|
||||
SELECT
|
||||
ing.id,ing.name,ing.type.ing.protein_ratio,ing.fat_ratio,ing.carbon_ratio.ing.area,dishes.cus_weight,dishes.cus_unit,dishes.weight
|
||||
FROM(
|
||||
SELECT ingredient_id AS id, ingredient_weight AS weight, cus_weight, cus_unit, remark
|
||||
FROM sys_dishes_ingredient
|
||||
WHERE dishes_id = #{id}
|
||||
|
@ -19,6 +19,9 @@
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="useCount" column="use_count"/>
|
||||
|
||||
<!-- 销售 -->
|
||||
<result property="saleName" column="sale_name"></result>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysWxSaleAccountVo">
|
||||
@ -31,6 +34,7 @@
|
||||
<if test="wxNickName != null and wxNickName != ''">and wx_nick_name like concat('%', #{wxNickName}, '%')</if>
|
||||
<if test="wxAccount != null and wxAccount != ''">and wx_account like concat('%', #{wxAccount}, '%')</if>
|
||||
<if test="wxPhone != null and wxPhone != ''">and wx_phone like concat('%', #{wxPhone}, '%')</if>
|
||||
<if test="status != null">and status = #{status}</if>
|
||||
order by id desc
|
||||
</select>
|
||||
|
||||
@ -134,4 +138,14 @@
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- 查询可以接粉的微信号以及对应销售,用于导粉记录管理 -->
|
||||
<select id="getWxAccountAndSale" resultMap="SysWxSaleAccountResult">
|
||||
select wa.id, wa.wx_account, su.nick_name as sale_name
|
||||
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_user su ON su.user_id = swd.user_id AND su.del_flag = 0
|
||||
where wa.del_flag = 0 and wa.status = 0
|
||||
order by su.user_id asc
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -129,4 +129,10 @@
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 根据手机号查询微信用户 -->
|
||||
<select id="getSysWxUserInfoByPhone" parameterType="String" resultMap="SysWxUserInfoResult">
|
||||
<include refid="selectSysWxUserInfoVo"/>
|
||||
where phone = #{phone} order by create_time desc limit 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user