Merge branch 'master' of gitee.com:darlk/ShengTangManage into develop

This commit is contained in:
huangdeliang 2021-02-09 14:17:37 +08:00
commit 5f4b1ec33f
36 changed files with 3042 additions and 769 deletions

@ -0,0 +1,117 @@
package com.stdiet.web.controller.custom;
import java.util.List;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.stdiet.common.annotation.Log;
import com.stdiet.common.core.controller.BaseController;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.common.enums.BusinessType;
import com.stdiet.custom.domain.SysWxDistribution;
import com.stdiet.custom.service.ISysWxDistributionService;
import com.stdiet.common.utils.poi.ExcelUtil;
import com.stdiet.common.core.page.TableDataInfo;
/**
* 微信分配管理Controller
*
* @author xiezhijun
* @date 2021-02-03
*/
@RestController
@RequestMapping("/custom/wxDistribution")
public class SysWxDistributionController extends BaseController
{
@Autowired
private ISysWxDistributionService sysWxDistributionService;
/**
* 查询微信分配管理列表
*/
@PreAuthorize("@ss.hasPermi('custom:wxDistribution:list')")
@GetMapping("/list")
public TableDataInfo list(SysWxDistribution sysWxDistribution)
{
startPage();
List<SysWxDistribution> list = sysWxDistributionService.selectSysWxDistributionList(sysWxDistribution);
return getDataTable(list);
}
/**
* 导出微信分配管理列表
*/
@PreAuthorize("@ss.hasPermi('custom:wxDistribution:export')")
@Log(title = "微信分配管理", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(SysWxDistribution sysWxDistribution)
{
List<SysWxDistribution> list = sysWxDistributionService.selectSysWxDistributionList(sysWxDistribution);
ExcelUtil<SysWxDistribution> util = new ExcelUtil<SysWxDistribution>(SysWxDistribution.class);
return util.exportExcel(list, "wxDistribution");
}
/**
* 获取微信分配管理详细信息
*/
@PreAuthorize("@ss.hasPermi('custom:wxDistribution:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(sysWxDistributionService.selectSysWxDistributionById(id));
}
/**
* 新增微信分配管理
*/
@PreAuthorize("@ss.hasPermi('custom:wxDistribution:add')")
@Log(title = "微信分配管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysWxDistribution sysWxDistribution)
{
if(sysWxDistribution.getWechatAccount() != null){
SysWxDistribution wxIdDistribution = sysWxDistributionService.selectWxDistributionByWxId(sysWxDistribution.getWechatAccount());
if(wxIdDistribution != null){
return AjaxResult.error("该微信号已分配,无法重复分配");
}
}
return toAjax(sysWxDistributionService.insertSysWxDistribution(sysWxDistribution));
}
/**
* 修改微信分配管理
*/
@PreAuthorize("@ss.hasPermi('custom:wxDistribution:edit')")
@Log(title = "微信分配管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysWxDistribution sysWxDistribution)
{
if(sysWxDistribution.getWechatAccount() != null){
SysWxDistribution wxIdDistribution = sysWxDistributionService.selectWxDistributionByWxId(sysWxDistribution.getWechatAccount());
if(wxIdDistribution != null && wxIdDistribution.getId().intValue() != sysWxDistribution.getId().intValue()){
return AjaxResult.error("该微信号已分配,无法重复分配");
}
}
return toAjax(sysWxDistributionService.updateSysWxDistribution(sysWxDistribution));
}
/**
* 删除微信分配管理
*/
@PreAuthorize("@ss.hasPermi('custom:wxDistribution:remove')")
@Log(title = "微信分配管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sysWxDistributionService.deleteSysWxDistributionByIds(ids));
}
}

@ -0,0 +1,155 @@
package com.stdiet.web.controller.custom;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.stdiet.common.utils.DateUtils;
import com.stdiet.custom.domain.SysWxDistribution;
import com.stdiet.custom.dto.request.FanStatisticsRequest;
import com.stdiet.custom.dto.response.ExportFanStatisticsResponse;
import com.stdiet.custom.service.ISysWxDistributionService;
import com.stdiet.framework.web.domain.server.Sys;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.stdiet.common.annotation.Log;
import com.stdiet.common.core.controller.BaseController;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.common.enums.BusinessType;
import com.stdiet.custom.domain.SysWxFanStatistics;
import com.stdiet.custom.service.ISysWxFanStatisticsService;
import com.stdiet.common.utils.poi.ExcelUtil;
import com.stdiet.common.core.page.TableDataInfo;
/**
* 进粉统计Controller
*
* @author xiezhijun
* @date 2021-02-03
*/
@RestController
@RequestMapping("/custom/fanStatistics")
public class SysWxFanStatisticsController extends BaseController
{
@Autowired
private ISysWxFanStatisticsService sysWxFanStatisticsService;
@Autowired
private ISysWxDistributionService sysWxDistributionService;
/**
* 查询进粉统计列表
*/
@PreAuthorize("@ss.hasPermi('custom:fanStatistics:list')")
@GetMapping("/list")
public TableDataInfo list(SysWxFanStatistics sysWxFanStatistics)
{
startPage();
List<SysWxFanStatistics> list = sysWxFanStatisticsService.selectSysWxFanStatisticsList(sysWxFanStatistics);
if(list != null && list.size() > 0){
int totalFanNum = sysWxFanStatisticsService.selectFanNumCount(sysWxFanStatistics);
list.get(0).setTotalFanNum(totalFanNum);
}
return getDataTable(list);
}
/**
* 导出进粉统计列表
*/
@PreAuthorize("@ss.hasPermi('custom:fanStatistics:export')")
@Log(title = "进粉统计", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(SysWxFanStatistics sysWxFanStatistics)
{
sysWxFanStatistics.setSortFlag(1);
List<SysWxFanStatistics> list = sysWxFanStatisticsService.selectSysWxFanStatisticsList(sysWxFanStatistics);
List<ExportFanStatisticsResponse> responsesList = new ArrayList<>();
ExportFanStatisticsResponse exportFanStatisticsResponse = null;
int groupId = 0;
int index = 0;
int totalFanNum = 0;
for(SysWxFanStatistics sysWxFan : list){
int wxGroupId = sysWxFan.getSaleGroupId() != null ? sysWxFan.getSaleGroupId().intValue() : 0;
if(wxGroupId != groupId && groupId != 0){
responsesList.add(new ExportFanStatisticsResponse());
index = 0;
}
groupId = wxGroupId;
exportFanStatisticsResponse = new ExportFanStatisticsResponse();
exportFanStatisticsResponse.setId(++index);
exportFanStatisticsResponse.setAccount(sysWxFan.getAccount());
exportFanStatisticsResponse.setSaleName(sysWxFan.getUserName());
exportFanStatisticsResponse.setWxAccount(sysWxFan.getWxAccount());
exportFanStatisticsResponse.setFanNum(sysWxFan.getFanNum());
responsesList.add(exportFanStatisticsResponse);
totalFanNum += exportFanStatisticsResponse.getFanNum().intValue();
}
responsesList.add(new ExportFanStatisticsResponse());
ExportFanStatisticsResponse total = new ExportFanStatisticsResponse();
total.setWxAccount("总计进粉量");
total.setFanNum(totalFanNum);
responsesList.add(total);
ExcelUtil<ExportFanStatisticsResponse> util = new ExcelUtil<ExportFanStatisticsResponse>(ExportFanStatisticsResponse.class);
return util.exportExcel(responsesList, DateUtils.getDate());
}
/**
* 获取进粉统计详细信息
*/
@PreAuthorize("@ss.hasPermi('custom:fanStatistics:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(sysWxFanStatisticsService.selectSysWxFanStatisticsById(id));
}
/**
* 新增进粉统计
*/
@PreAuthorize("@ss.hasPermi('custom:fanStatistics:add')")
@Log(title = "进粉统计", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody FanStatisticsRequest fanStatisticsRequest)
{
return sysWxFanStatisticsService.addWxFanNum(fanStatisticsRequest);
}
/**
* 修改进粉统计
*/
@PreAuthorize("@ss.hasPermi('custom:fanStatistics:edit')")
@Log(title = "进粉统计", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysWxFanStatistics sysWxFanStatistics)
{
List<SysWxFanStatistics> wxIdFanStatistics = sysWxFanStatisticsService.getWxFanStatisticsByUserIdAndFanTime(sysWxFanStatistics);
System.out.println(wxIdFanStatistics.size());
if(wxIdFanStatistics != null && wxIdFanStatistics.size() > 0 && sysWxFanStatistics.getId().intValue() != wxIdFanStatistics.get(0).getId().intValue()){
return AjaxResult.error("当前日期、微信号下已存在进粉记录");
}
return toAjax(sysWxFanStatisticsService.updateSysWxFanStatistics(sysWxFanStatistics));
}
/**
* 删除进粉统计
*/
@PreAuthorize("@ss.hasPermi('custom:fanStatistics:remove')")
@Log(title = "进粉统计", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sysWxFanStatisticsService.deleteSysWxFanStatisticsByIds(ids));
}
/**
* 获取当前用户被分配的微信号
*/
@RequestMapping("/getWxByUserId")
public AjaxResult getWxByUserId(@RequestParam("userId")Long userId){
List<SysWxDistribution> list = sysWxDistributionService.selectDistributionWxByUserId(userId);
return AjaxResult.success(list);
}
}

@ -1,151 +1,127 @@
package com.stdiet.web.controller.custom;
import java.util.List;
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;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.stdiet.common.annotation.Log;
import com.stdiet.common.config.RuoYiConfig;
import com.stdiet.common.core.controller.BaseController;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.common.core.page.TableDataInfo;
import com.stdiet.common.core.redis.RedisCache;
import com.stdiet.common.enums.BusinessType;
import com.stdiet.common.utils.StringUtils;
import com.stdiet.common.utils.file.FileUploadUtils;
import com.stdiet.common.utils.poi.ExcelUtil;
import com.stdiet.custom.domain.SysWxSaleAccount;
import com.stdiet.custom.domain.wechat.WxAccessToken;
import com.stdiet.custom.domain.wechat.WxFileUploadResult;
import com.stdiet.custom.service.ISysWxSaleAccountService;
import com.stdiet.custom.utils.WxTokenUtils;
import com.stdiet.framework.config.ServerConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.concurrent.TimeUnit;
import com.stdiet.common.utils.poi.ExcelUtil;
import com.stdiet.common.core.page.TableDataInfo;
/**
* 微信销售账号Controller
* 微信账号Controller
*
* @author wonder
* @date 2021-01-29
* @author xiezhijun
* @date 2021-02-03
*/
@RestController
@RequestMapping("/custom/WxAccount")
public class SysWxSaleAccountController extends BaseController {
@RequestMapping("/custom/wxAccount")
public class SysWxSaleAccountController extends BaseController
{
@Autowired
private ISysWxSaleAccountService sysWxSaleAccountService;
@Autowired
private RedisCache redisCache;
@Autowired
private ServerConfig serverConfig;
/**
* 查询微信销售账号列表
* 查询微信账号列表
*/
@PreAuthorize("@ss.hasPermi('custom:WxAccount:list')")
@PreAuthorize("@ss.hasPermi('custom:wxAccount:list')")
@GetMapping("/list")
public TableDataInfo list(SysWxSaleAccount sysWxSaleAccount) {
public TableDataInfo list(SysWxSaleAccount sysWxSaleAccount)
{
startPage();
List<SysWxSaleAccount> list = sysWxSaleAccountService.selectSysWxSaleAccountList(sysWxSaleAccount);
return getDataTable(list);
}
/**
* 导出微信销售账号列表
* 导出微信账号列表
*/
@PreAuthorize("@ss.hasPermi('custom:WxAccount:export')")
@Log(title = "微信销售账号", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('custom:wxAccount:export')")
@Log(title = "微信账号", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(SysWxSaleAccount sysWxSaleAccount) {
public AjaxResult export(SysWxSaleAccount sysWxSaleAccount)
{
List<SysWxSaleAccount> list = sysWxSaleAccountService.selectSysWxSaleAccountList(sysWxSaleAccount);
ExcelUtil<SysWxSaleAccount> util = new ExcelUtil<SysWxSaleAccount>(SysWxSaleAccount.class);
return util.exportExcel(list, "WxAccount");
return util.exportExcel(list, "wxAccount");
}
/**
* 获取微信销售账号详细信息
* 获取微信账号详细信息
*/
@PreAuthorize("@ss.hasPermi('custom:WxAccount:query')")
@PreAuthorize("@ss.hasPermi('custom:wxAccount:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(sysWxSaleAccountService.selectSysWxSaleAccountById(id));
}
/**
* 新增微信销售账号
* 新增微信账号
*/
@PreAuthorize("@ss.hasPermi('custom:WxAccount:add')")
@Log(title = "微信销售账号", businessType = BusinessType.INSERT)
@PreAuthorize("@ss.hasPermi('custom:wxAccount:add')")
@Log(title = "微信账号", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysWxSaleAccount sysWxSaleAccount) {
public AjaxResult add(@RequestBody SysWxSaleAccount sysWxSaleAccount)
{
if(StringUtils.isNotEmpty(sysWxSaleAccount.getWxAccount())){
if(sysWxSaleAccountService.selectWxAccountByAccountOrPhone(sysWxSaleAccount.getWxAccount(), 0) != null){
return AjaxResult.error("微信号已存在,无法重复添加");
}
}
if(StringUtils.isNotEmpty(sysWxSaleAccount.getWxPhone())){
if(sysWxSaleAccountService.selectWxAccountByAccountOrPhone(sysWxSaleAccount.getWxPhone(), 1) != null){
return AjaxResult.error("手机号已存在,无法重复添加");
}
}
return toAjax(sysWxSaleAccountService.insertSysWxSaleAccount(sysWxSaleAccount));
}
/**
* 修改微信销售账号
* 修改微信账号
*/
@PreAuthorize("@ss.hasPermi('custom:WxAccount:edit')")
@Log(title = "微信销售账号", businessType = BusinessType.UPDATE)
@PreAuthorize("@ss.hasPermi('custom:wxAccount:edit')")
@Log(title = "微信账号", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysWxSaleAccount sysWxSaleAccount) {
public AjaxResult edit(@RequestBody SysWxSaleAccount sysWxSaleAccount)
{
if(StringUtils.isNotEmpty(sysWxSaleAccount.getWxAccount())){
SysWxSaleAccount accountWx = sysWxSaleAccountService.selectWxAccountByAccountOrPhone(sysWxSaleAccount.getWxAccount(), 0);
if(accountWx != null && accountWx.getId().intValue() != sysWxSaleAccount.getId().intValue()){
return AjaxResult.error("微信号已存在,无法修改");
}
}
if(StringUtils.isNotEmpty(sysWxSaleAccount.getWxPhone())){
SysWxSaleAccount accountWx = sysWxSaleAccountService.selectWxAccountByAccountOrPhone(sysWxSaleAccount.getWxPhone(), 1);
if(accountWx != null && accountWx.getId().intValue() != sysWxSaleAccount.getId().intValue()){
return AjaxResult.error("手机号已存在,无法修改");
}
}
return toAjax(sysWxSaleAccountService.updateSysWxSaleAccount(sysWxSaleAccount));
}
/**
* 删除微信销售账号
* 删除微信账号
*/
@PreAuthorize("@ss.hasPermi('custom:WxAccount:remove')")
@Log(title = "微信销售账号", businessType = BusinessType.DELETE)
@PreAuthorize("@ss.hasPermi('custom:wxAccount:remove')")
@Log(title = "微信账号", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sysWxSaleAccountService.deleteSysWxSaleAccountByIds(ids));
}
@GetMapping("/redisTest")
public AjaxResult redisTest() {
String accessToken = redisCache.getCacheObject(WxTokenUtils.KEY_ACCESS_TOKEN);
if (StringUtils.isEmpty(accessToken)) {
WxAccessToken wxAccessToken = WxTokenUtils.fetchAccessToken();
redisCache.setCacheObject(WxTokenUtils.KEY_ACCESS_TOKEN, wxAccessToken.getAccessToken(), wxAccessToken.getExpiresIn(), TimeUnit.SECONDS);
}
return AjaxResult.success(accessToken);
}
/**
* 上传图片
*/
@PostMapping("/upload")
public AjaxResult wxAccountUpload(MultipartFile file) throws Exception {
try {
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
String oriFileName = file.getOriginalFilename();
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
// String url = serverConfig.getUrl() + fileName;
String oriFilePath = filePath + fileName.substring(fileName.indexOf("upload") + 6);
String accessToken = redisCache.getCacheObject(WxTokenUtils.KEY_ACCESS_TOKEN);
if (StringUtils.isEmpty(accessToken)) {
WxAccessToken wxAccessToken = WxTokenUtils.fetchAccessToken();
accessToken = wxAccessToken.getAccessToken();
redisCache.setCacheObject(WxTokenUtils.KEY_ACCESS_TOKEN, accessToken, wxAccessToken.getExpiresIn(), TimeUnit.SECONDS);
}
WxFileUploadResult result = WxTokenUtils.uploadImage(oriFilePath, oriFileName, accessToken);
AjaxResult ajax = AjaxResult.success();
ajax.put("fileName", fileName);
ajax.put("mediaId", result.getMediaId());
ajax.put("mediaUrl", result.getUrl());
return ajax;
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
}
}

@ -4,6 +4,7 @@ import lombok.Data;
import com.stdiet.common.annotation.Excel;
import com.stdiet.common.core.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.List;
/**
@ -57,7 +58,7 @@ public class SysCustomerHealthy extends BaseEntity
/** 体重 */
@Excel(name = "体重")
private Long weight;
private BigDecimal weight;
/** 调味品种类,使用 , 隔开 */
@Excel(name = "调味品种类,使用 , 隔开")
@ -429,6 +430,9 @@ public class SysCustomerHealthy extends BaseEntity
@Excel(name = "气血数据")
private String bloodData;
//备注
private String remark;
/** 湿气数据 */
@Excel(name = "湿气数据")
private String moistureDate;

@ -0,0 +1,66 @@
package com.stdiet.custom.domain;
import com.stdiet.common.annotation.Excel;
import com.stdiet.common.core.domain.BaseEntity;
import lombok.Data;
/**
* 微信分配管理对象 sys_wx_distribution
*
* @author xiezhijun
* @date 2021-02-03
*/
@Data
public class SysWxDistribution extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* $column.columnComment
*/
private Long id;
/**
* 后台用户id
*/
private Long userId;
@Excel(name = "销售")
private String userName;
/**
* 字典表中销售小组对应键值
*/
private Integer saleGroupId;
@Excel(name = "销售组别")
private String saleGroup;
/**
* 字典表中账号对应键值
*/
private Integer accountId;
@Excel(name = "收款账号")
private String account;
/**
* 微信账号id
*/
private Long wechatAccount;
@Excel(name = "微信昵称")
private String wxNickName;
@Excel(name = "微信号")
private String wxAccount;
/**
* 微信账号类型0接粉号 1新号默认0
*/
private Integer wechatAccountType;
/**
* 删除标识 0未删除 1已删除默认0
*/
private Integer delFlag;
}

@ -0,0 +1,64 @@
package com.stdiet.custom.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.stdiet.common.annotation.Excel;
import com.stdiet.common.core.domain.BaseEntity;
import lombok.Data;
/**
* 进粉统计对象 sys_wx_fan_statistics
*
* @author xiezhijun
* @date 2021-02-03
*/
@Data
public class SysWxFanStatistics extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
@Excel(name = "销售")
private String userName;
//销售ID
private Long userId;
@Excel(name = "进粉账号")
private String account;
//销售组别
private String saleGroup;
/** 微信号ID */
private Long wxId;
@Excel(name = "微信昵称")
private String wxNickName;
@Excel(name = "微信号")
private String wxAccount;
/** 进粉时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "进粉时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date fanTime;
/** 进粉个数 */
@Excel(name = "进粉个数")
private Integer fanNum;
/** 删除标识 0未删除 1已删除默认0 */
private Integer delFlag;
//进粉总数量
private Integer totalFanNum;
//销售组别ID
private Integer saleGroupId;
//排序参数null或者0按照id倒序 1按照组别IDid顺序正序
private Integer sortFlag;
}

@ -1,18 +1,16 @@
package com.stdiet.custom.domain;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.stdiet.common.annotation.Excel;
import com.stdiet.common.core.domain.BaseEntity;
/**
* 微信销售账号对象 sys_wx_sale_account
*
* @author wonder
* @date 2021-01-29
* 微信账号对象 sys_wx_sale_account
*
* @author xiezhijun
* @date 2021-02-03
*/
@Data
public class SysWxSaleAccount extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -20,28 +18,106 @@ public class SysWxSaleAccount extends BaseEntity
/** $column.columnComment */
private Long id;
/** 账号名称 */
@Excel(name = "账号名称")
private String nickName;
/** 账号id */
@Excel(name = "账号id")
private Long accountId;
/** 微信昵称 */
@Excel(name = "微信昵称")
private String wxNickName;
/** 微信号 */
@Excel(name = "微信号")
private String wxId;
private String wxAccount;
/** 手机号 */
@Excel(name = "手机号")
private String phone;
/** 微信手机号 */
@Excel(name = "微信手机号")
private String wxPhone;
private String imgUrl;
/** 二维码图片 */
private String wxCodeUrl;
private String mediaId;
/** 微信类型 */
private Integer wxType;
private String remark;
/** 删除标识 0未删除 1已删除默认0 */
private Integer delFlag;
private Integer count;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setWxNickName(String wxNickName)
{
this.wxNickName = wxNickName;
}
public String getWxNickName()
{
return wxNickName;
}
public void setWxAccount(String wxAccount)
{
this.wxAccount = wxAccount;
}
public String getWxAccount()
{
return wxAccount;
}
public void setWxPhone(String wxPhone)
{
this.wxPhone = wxPhone;
}
public String getWxPhone()
{
return wxPhone;
}
public void setWxCodeUrl(String wxCodeUrl)
{
this.wxCodeUrl = wxCodeUrl;
}
public String getWxCodeUrl()
{
return wxCodeUrl;
}
public void setWxType(Integer wxType)
{
this.wxType = wxType;
}
public Integer getWxType()
{
return wxType;
}
public void setDelFlag(Integer delFlag)
{
this.delFlag = delFlag;
}
public Integer getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("wxNickName", getWxNickName())
.append("wxAccount", getWxAccount())
.append("wxPhone", getWxPhone())
.append("wxCodeUrl", getWxCodeUrl())
.append("remark", getRemark())
.append("wxType", getWxType())
.append("createTime", getCreateTime())
.append("createBy", getCreateBy())
.append("updateTime", getUpdateTime())
.append("updateBy", getUpdateBy())
.append("delFlag", getDelFlag())
.toString();
}
}

@ -0,0 +1,25 @@
package com.stdiet.custom.dto.request;
import com.stdiet.common.core.domain.BaseEntity;
import lombok.Data;
import java.util.Date;
@Data
public class FanStatisticsRequest extends BaseEntity {
private static final long serialVersionUID = 1L;
//销售用户ID
private Long userId;
//进粉统计日期
private Date fanTime;
//微信ID数组
private Long[] wxId;
//微信进粉量数组
private Integer[] fanNum;
}

@ -0,0 +1,28 @@
package com.stdiet.custom.dto.response;
import com.stdiet.common.annotation.Excel;
import lombok.Data;
@Data
public class ExportFanStatisticsResponse {
//序号
@Excel(name = "序号")
private Integer id;
//销售姓名
@Excel(name = "销售姓名")
private String saleName;
//账号
@Excel(name = "账号")
private String account;
//微信号
@Excel(name = "微信号")
private String wxAccount;
//进粉量
@Excel(name = "进粉量")
private Integer fanNum;
}

@ -0,0 +1,76 @@
package com.stdiet.custom.mapper;
import java.util.List;
import com.stdiet.custom.domain.SysWxDistribution;
import org.apache.ibatis.annotations.Param;
/**
* 微信分配管理Mapper接口
*
* @author xiezhijun
* @date 2021-02-03
*/
public interface SysWxDistributionMapper
{
/**
* 查询微信分配管理
*
* @param id 微信分配管理ID
* @return 微信分配管理
*/
public SysWxDistribution selectSysWxDistributionById(Long id);
/**
* 查询微信分配管理列表
*
* @param sysWxDistribution 微信分配管理
* @return 微信分配管理集合
*/
public List<SysWxDistribution> selectSysWxDistributionList(SysWxDistribution sysWxDistribution);
/**
* 新增微信分配管理
*
* @param sysWxDistribution 微信分配管理
* @return 结果
*/
public int insertSysWxDistribution(SysWxDistribution sysWxDistribution);
/**
* 修改微信分配管理
*
* @param sysWxDistribution 微信分配管理
* @return 结果
*/
public int updateSysWxDistribution(SysWxDistribution sysWxDistribution);
/**
* 删除微信分配管理
*
* @param id 微信分配管理ID
* @return 结果
*/
public int deleteSysWxDistributionById(Long id);
/**
* 批量删除微信分配管理
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysWxDistributionByIds(Long[] ids);
/**
* 根据微信ID查询是否分配记录
* @param wxId
* @return
*/
SysWxDistribution selectWxDistributionByWxId(@Param("wxId")Long wxId);
/**
* 根据用户ID查询该用户被分配的微信号
* @param userId
* @return
*/
List<SysWxDistribution> selectDistributionWxByUserId(@Param("userId")Long userId);
}

@ -0,0 +1,73 @@
package com.stdiet.custom.mapper;
import java.util.List;
import com.stdiet.custom.domain.SysWxFanStatistics;
/**
* 进粉统计Mapper接口
*
* @author xiezhijun
* @date 2021-02-03
*/
public interface SysWxFanStatisticsMapper
{
/**
* 查询进粉统计
*
* @param id 进粉统计ID
* @return 进粉统计
*/
public SysWxFanStatistics selectSysWxFanStatisticsById(Long id);
/**
* 查询进粉统计列表
*
* @param sysWxFanStatistics 进粉统计
* @return 进粉统计集合
*/
public List<SysWxFanStatistics> selectSysWxFanStatisticsList(SysWxFanStatistics sysWxFanStatistics);
/**
* 新增进粉统计
*
* @param sysWxFanStatistics 进粉统计
* @return 结果
*/
public int insertSysWxFanStatistics(SysWxFanStatistics sysWxFanStatistics);
/**
* 修改进粉统计
*
* @param sysWxFanStatistics 进粉统计
* @return 结果
*/
public int updateSysWxFanStatistics(SysWxFanStatistics sysWxFanStatistics);
/**
* 删除进粉统计
*
* @param id 进粉统计ID
* @return 结果
*/
public int deleteSysWxFanStatisticsById(Long id);
/**
* 批量删除进粉统计
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysWxFanStatisticsByIds(Long[] ids);
/**
* 根据用户ID和进粉统计日期查询进粉统计记录
*/
public List<SysWxFanStatistics> getWxFanStatisticsByUserIdAndFanTime(SysWxFanStatistics sysWxFanStatistics);
/**
* 查询总进粉数量
* @param sysWxFanStatistics
* @return
*/
public int selectFanNumCount(SysWxFanStatistics sysWxFanStatistics);
}

@ -4,58 +4,65 @@ import java.util.List;
import com.stdiet.custom.domain.SysWxSaleAccount;
/**
* 微信销售账号Mapper接口
*
* @author wonder
* @date 2021-01-29
* 微信账号Mapper接口
*
* @author xiezhijun
* @date 2021-02-03
*/
public interface SysWxSaleAccountMapper
public interface SysWxSaleAccountMapper
{
/**
* 查询微信销售账号
*
* @param id 微信销售账号ID
* @return 微信销售账号
* 查询微信账号
*
* @param id 微信账号ID
* @return 微信账号
*/
public SysWxSaleAccount selectSysWxSaleAccountById(Long id);
/**
* 查询微信销售账号列表
*
* @param sysWxSaleAccount 微信销售账号
* @return 微信销售账号集合
* 查询微信账号列表
*
* @param sysWxSaleAccount 微信账号
* @return 微信账号集合
*/
public List<SysWxSaleAccount> selectSysWxSaleAccountList(SysWxSaleAccount sysWxSaleAccount);
/**
* 新增微信销售账号
*
* @param sysWxSaleAccount 微信销售账号
* 新增微信账号
*
* @param sysWxSaleAccount 微信账号
* @return 结果
*/
public int insertSysWxSaleAccount(SysWxSaleAccount sysWxSaleAccount);
/**
* 修改微信销售账号
*
* @param sysWxSaleAccount 微信销售账号
* 修改微信账号
*
* @param sysWxSaleAccount 微信账号
* @return 结果
*/
public int updateSysWxSaleAccount(SysWxSaleAccount sysWxSaleAccount);
/**
* 删除微信销售账号
*
* @param id 微信销售账号ID
* 删除微信账号
*
* @param id 微信账号ID
* @return 结果
*/
public int deleteSysWxSaleAccountById(Long id);
/**
* 批量删除微信销售账号
*
* 批量删除微信账号
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysWxSaleAccountByIds(Long[] ids);
/**
* 根据微信号或手机号查询是否已存在
* @param sysWxSaleAccount
* @return
*/
SysWxSaleAccount selectWxAccountByAccountOrPhone(SysWxSaleAccount sysWxSaleAccount);
}

@ -0,0 +1,75 @@
package com.stdiet.custom.service;
import java.util.List;
import com.stdiet.custom.domain.SysWxDistribution;
/**
* 微信分配管理Service接口
*
* @author xiezhijun
* @date 2021-02-03
*/
public interface ISysWxDistributionService
{
/**
* 查询微信分配管理
*
* @param id 微信分配管理ID
* @return 微信分配管理
*/
public SysWxDistribution selectSysWxDistributionById(Long id);
/**
* 查询微信分配管理列表
*
* @param sysWxDistribution 微信分配管理
* @return 微信分配管理集合
*/
public List<SysWxDistribution> selectSysWxDistributionList(SysWxDistribution sysWxDistribution);
/**
* 新增微信分配管理
*
* @param sysWxDistribution 微信分配管理
* @return 结果
*/
public int insertSysWxDistribution(SysWxDistribution sysWxDistribution);
/**
* 修改微信分配管理
*
* @param sysWxDistribution 微信分配管理
* @return 结果
*/
public int updateSysWxDistribution(SysWxDistribution sysWxDistribution);
/**
* 批量删除微信分配管理
*
* @param ids 需要删除的微信分配管理ID
* @return 结果
*/
public int deleteSysWxDistributionByIds(Long[] ids);
/**
* 删除微信分配管理信息
*
* @param id 微信分配管理ID
* @return 结果
*/
public int deleteSysWxDistributionById(Long id);
/**
* 根据微信ID查询是否分配记录
* @param wxId
* @return
*/
SysWxDistribution selectWxDistributionByWxId(Long wxId);
/**
* 根据用户ID查询该用户被分配的微信号
* @param userId
* @return
*/
List<SysWxDistribution> selectDistributionWxByUserId(Long userId);
}

@ -0,0 +1,85 @@
package com.stdiet.custom.service;
import java.util.List;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.custom.domain.SysWxFanStatistics;
import com.stdiet.custom.dto.request.FanStatisticsRequest;
/**
* 进粉统计Service接口
*
* @author xiezhijun
* @date 2021-02-03
*/
public interface ISysWxFanStatisticsService
{
/**
* 查询进粉统计
*
* @param id 进粉统计ID
* @return 进粉统计
*/
public SysWxFanStatistics selectSysWxFanStatisticsById(Long id);
/**
* 查询进粉统计列表
*
* @param sysWxFanStatistics 进粉统计
* @return 进粉统计集合
*/
public List<SysWxFanStatistics> selectSysWxFanStatisticsList(SysWxFanStatistics sysWxFanStatistics);
/**
* 新增进粉统计
*
* @param sysWxFanStatistics 进粉统计
* @return 结果
*/
public int insertSysWxFanStatistics(SysWxFanStatistics sysWxFanStatistics);
/**
* 修改进粉统计
*
* @param sysWxFanStatistics 进粉统计
* @return 结果
*/
public int updateSysWxFanStatistics(SysWxFanStatistics sysWxFanStatistics);
/**
* 批量删除进粉统计
*
* @param ids 需要删除的进粉统计ID
* @return 结果
*/
public int deleteSysWxFanStatisticsByIds(Long[] ids);
/**
* 删除进粉统计信息
*
* @param id 进粉统计ID
* @return 结果
*/
public int deleteSysWxFanStatisticsById(Long id);
/**
* 同时给多个微信号添加进粉量统计
* @param fanStatisticsRequest
* @return
*/
AjaxResult addWxFanNum(FanStatisticsRequest fanStatisticsRequest);
/**
* 根据用户ID微信ID进粉时间查询统计
* @param sysWxFanStatistics
* @return
*/
List<SysWxFanStatistics> getWxFanStatisticsByUserIdAndFanTime(SysWxFanStatistics sysWxFanStatistics);
/**
* 查询总进粉数量
* @param sysWxFanStatistics
* @return
*/
public int selectFanNumCount(SysWxFanStatistics sysWxFanStatistics);
}

@ -1,64 +1,69 @@
package com.stdiet.custom.service;
import java.util.List;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.custom.domain.SysWxSaleAccount;
/**
* 微信销售账号Service接口
*
* @author wonder
* @date 2021-01-29
* 微信账号Service接口
*
* @author xiezhijun
* @date 2021-02-03
*/
public interface ISysWxSaleAccountService
public interface ISysWxSaleAccountService
{
/**
* 查询微信销售账号
*
* @param id 微信销售账号ID
* @return 微信销售账号
* 查询微信账号
*
* @param id 微信账号ID
* @return 微信账号
*/
public SysWxSaleAccount selectSysWxSaleAccountById(Long id);
/**
* 查询微信销售账号列表
*
* @param sysWxSaleAccount 微信销售账号
* @return 微信销售账号集合
* 查询微信账号列表
*
* @param sysWxSaleAccount 微信账号
* @return 微信账号集合
*/
public List<SysWxSaleAccount> selectSysWxSaleAccountList(SysWxSaleAccount sysWxSaleAccount);
/**
* 新增微信销售账号
*
* @param sysWxSaleAccount 微信销售账号
* 新增微信账号
*
* @param sysWxSaleAccount 微信账号
* @return 结果
*/
public int insertSysWxSaleAccount(SysWxSaleAccount sysWxSaleAccount);
/**
* 修改微信销售账号
*
* @param sysWxSaleAccount 微信销售账号
* 修改微信账号
*
* @param sysWxSaleAccount 微信账号
* @return 结果
*/
public int updateSysWxSaleAccount(SysWxSaleAccount sysWxSaleAccount);
/**
* 批量删除微信销售账号
*
* @param ids 需要删除的微信销售账号ID
* 批量删除微信账号
*
* @param ids 需要删除的微信账号ID
* @return 结果
*/
public int deleteSysWxSaleAccountByIds(Long[] ids);
/**
* 删除微信销售账号信息
*
* @param id 微信销售账号ID
* 删除微信账号信息
*
* @param id 微信账号ID
* @return 结果
*/
public int deleteSysWxSaleAccountById(Long id);
/**
* 根据微信号或手机号查询是否已存在
* @param accountOrPhone 手机号或微信号
* @param type 0微信号 1手机号
* @return
*/
SysWxSaleAccount selectWxAccountByAccountOrPhone(String accountOrPhone, int type);
}

@ -0,0 +1,115 @@
package com.stdiet.custom.service.impl;
import java.util.List;
import com.stdiet.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.stdiet.custom.mapper.SysWxDistributionMapper;
import com.stdiet.custom.domain.SysWxDistribution;
import com.stdiet.custom.service.ISysWxDistributionService;
/**
* 微信分配管理Service业务层处理
*
* @author xiezhijun
* @date 2021-02-03
*/
@Service
public class SysWxDistributionServiceImpl implements ISysWxDistributionService
{
@Autowired
private SysWxDistributionMapper sysWxDistributionMapper;
/**
* 查询微信分配管理
*
* @param id 微信分配管理ID
* @return 微信分配管理
*/
@Override
public SysWxDistribution selectSysWxDistributionById(Long id)
{
return sysWxDistributionMapper.selectSysWxDistributionById(id);
}
/**
* 查询微信分配管理列表
*
* @param sysWxDistribution 微信分配管理
* @return 微信分配管理
*/
@Override
public List<SysWxDistribution> selectSysWxDistributionList(SysWxDistribution sysWxDistribution)
{
return sysWxDistributionMapper.selectSysWxDistributionList(sysWxDistribution);
}
/**
* 新增微信分配管理
*
* @param sysWxDistribution 微信分配管理
* @return 结果
*/
@Override
public int insertSysWxDistribution(SysWxDistribution sysWxDistribution)
{
sysWxDistribution.setCreateTime(DateUtils.getNowDate());
return sysWxDistributionMapper.insertSysWxDistribution(sysWxDistribution);
}
/**
* 修改微信分配管理
*
* @param sysWxDistribution 微信分配管理
* @return 结果
*/
@Override
public int updateSysWxDistribution(SysWxDistribution sysWxDistribution)
{
sysWxDistribution.setUpdateTime(DateUtils.getNowDate());
return sysWxDistributionMapper.updateSysWxDistribution(sysWxDistribution);
}
/**
* 批量删除微信分配管理
*
* @param ids 需要删除的微信分配管理ID
* @return 结果
*/
@Override
public int deleteSysWxDistributionByIds(Long[] ids)
{
return sysWxDistributionMapper.deleteSysWxDistributionByIds(ids);
}
/**
* 删除微信分配管理信息
*
* @param id 微信分配管理ID
* @return 结果
*/
@Override
public int deleteSysWxDistributionById(Long id)
{
return sysWxDistributionMapper.deleteSysWxDistributionById(id);
}
/**
* 根据微信ID查询是否分配记录
* @param wxId
* @return
*/
@Override
public SysWxDistribution selectWxDistributionByWxId(Long wxId){
return sysWxDistributionMapper.selectWxDistributionByWxId(wxId);
}
/**
* 根据用户ID查询该用户被分配的微信号
* @param userId
* @return
*/
public List<SysWxDistribution> selectDistributionWxByUserId(Long userId){
return sysWxDistributionMapper.selectDistributionWxByUserId(userId);
}
}

@ -0,0 +1,147 @@
package com.stdiet.custom.service.impl;
import java.util.List;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.common.utils.DateUtils;
import com.stdiet.custom.dto.request.FanStatisticsRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.stdiet.custom.mapper.SysWxFanStatisticsMapper;
import com.stdiet.custom.domain.SysWxFanStatistics;
import com.stdiet.custom.service.ISysWxFanStatisticsService;
/**
* 进粉统计Service业务层处理
*
* @author xiezhijun
* @date 2021-02-03
*/
@Service
public class SysWxFanStatisticsServiceImpl implements ISysWxFanStatisticsService
{
@Autowired
private SysWxFanStatisticsMapper sysWxFanStatisticsMapper;
/**
* 查询进粉统计
*
* @param id 进粉统计ID
* @return 进粉统计
*/
@Override
public SysWxFanStatistics selectSysWxFanStatisticsById(Long id)
{
return sysWxFanStatisticsMapper.selectSysWxFanStatisticsById(id);
}
/**
* 查询进粉统计列表
*
* @param sysWxFanStatistics 进粉统计
* @return 进粉统计
*/
@Override
public List<SysWxFanStatistics> selectSysWxFanStatisticsList(SysWxFanStatistics sysWxFanStatistics)
{
return sysWxFanStatisticsMapper.selectSysWxFanStatisticsList(sysWxFanStatistics);
}
/**
* 新增进粉统计
*
* @param sysWxFanStatistics 进粉统计
* @return 结果
*/
@Override
public int insertSysWxFanStatistics(SysWxFanStatistics sysWxFanStatistics)
{
sysWxFanStatistics.setCreateTime(DateUtils.getNowDate());
return sysWxFanStatisticsMapper.insertSysWxFanStatistics(sysWxFanStatistics);
}
/**
* 修改进粉统计
*
* @param sysWxFanStatistics 进粉统计
* @return 结果
*/
@Override
public int updateSysWxFanStatistics(SysWxFanStatistics sysWxFanStatistics)
{
sysWxFanStatistics.setUpdateTime(DateUtils.getNowDate());
return sysWxFanStatisticsMapper.updateSysWxFanStatistics(sysWxFanStatistics);
}
/**
* 批量删除进粉统计
*
* @param ids 需要删除的进粉统计ID
* @return 结果
*/
@Override
public int deleteSysWxFanStatisticsByIds(Long[] ids)
{
return sysWxFanStatisticsMapper.deleteSysWxFanStatisticsByIds(ids);
}
/**
* 删除进粉统计信息
*
* @param id 进粉统计ID
* @return 结果
*/
@Override
public int deleteSysWxFanStatisticsById(Long id)
{
return sysWxFanStatisticsMapper.deleteSysWxFanStatisticsById(id);
}
/**
* 根据用户ID微信ID进粉时间查询统计
* @param sysWxFanStatistics
* @return
*/
@Override
public List<SysWxFanStatistics> getWxFanStatisticsByUserIdAndFanTime(SysWxFanStatistics sysWxFanStatistics){
return sysWxFanStatisticsMapper.getWxFanStatisticsByUserIdAndFanTime(sysWxFanStatistics);
}
/**
* 同时给多个微信号添加进粉量统计
* @param fanStatisticsRequest
* @return
*/
public AjaxResult addWxFanNum(FanStatisticsRequest fanStatisticsRequest){
int row = 0;
if(fanStatisticsRequest.getWxId() != null && fanStatisticsRequest.getUserId() != null){
SysWxFanStatistics param = new SysWxFanStatistics();
param.setUserId(fanStatisticsRequest.getUserId());
param.setFanTime(fanStatisticsRequest.getFanTime());
//查询今日是否已添加
List<SysWxFanStatistics> oldWxFanStatisticsList = getWxFanStatisticsByUserIdAndFanTime(param);
if(oldWxFanStatisticsList != null && oldWxFanStatisticsList.size() > 0){
return AjaxResult.error("今日已添加过进粉统计,无法重复添加");
}
int index = 0;
for (Long wxId : fanStatisticsRequest.getWxId()) {
SysWxFanStatistics sysWxFanStatistics = new SysWxFanStatistics();
sysWxFanStatistics.setWxId(wxId);
sysWxFanStatistics.setFanTime(fanStatisticsRequest.getFanTime());
sysWxFanStatistics.setFanNum(fanStatisticsRequest.getFanNum()[index++]);
sysWxFanStatistics.setUserId(fanStatisticsRequest.getUserId());
row = insertSysWxFanStatistics(sysWxFanStatistics);
}
}
return row > 0 ? AjaxResult.success() : AjaxResult.error("添加失败");
}
/**
* 查询总进粉数量
* @param sysWxFanStatistics
* @return
*/
public int selectFanNumCount(SysWxFanStatistics sysWxFanStatistics){
return sysWxFanStatisticsMapper.selectFanNumCount(sysWxFanStatistics);
}
}

@ -1,6 +1,8 @@
package com.stdiet.custom.service.impl;
import java.util.List;
import com.stdiet.common.utils.DateUtils;
import com.stdiet.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.stdiet.custom.mapper.SysWxSaleAccountMapper;
@ -8,22 +10,22 @@ import com.stdiet.custom.domain.SysWxSaleAccount;
import com.stdiet.custom.service.ISysWxSaleAccountService;
/**
* 微信销售账号Service业务层处理
*
* @author wonder
* @date 2021-01-29
* 微信账号Service业务层处理
*
* @author xiezhijun
* @date 2021-02-03
*/
@Service
public class SysWxSaleAccountServiceImpl implements ISysWxSaleAccountService
public class SysWxSaleAccountServiceImpl implements ISysWxSaleAccountService
{
@Autowired
private SysWxSaleAccountMapper sysWxSaleAccountMapper;
/**
* 查询微信销售账号
*
* @param id 微信销售账号ID
* @return 微信销售账号
* 查询微信账号
*
* @param id 微信账号ID
* @return 微信账号
*/
@Override
public SysWxSaleAccount selectSysWxSaleAccountById(Long id)
@ -32,10 +34,10 @@ public class SysWxSaleAccountServiceImpl implements ISysWxSaleAccountService
}
/**
* 查询微信销售账号列表
*
* @param sysWxSaleAccount 微信销售账号
* @return 微信销售账号
* 查询微信账号列表
*
* @param sysWxSaleAccount 微信账号
* @return 微信账号
*/
@Override
public List<SysWxSaleAccount> selectSysWxSaleAccountList(SysWxSaleAccount sysWxSaleAccount)
@ -44,33 +46,35 @@ public class SysWxSaleAccountServiceImpl implements ISysWxSaleAccountService
}
/**
* 新增微信销售账号
*
* @param sysWxSaleAccount 微信销售账号
* 新增微信账号
*
* @param sysWxSaleAccount 微信账号
* @return 结果
*/
@Override
public int insertSysWxSaleAccount(SysWxSaleAccount sysWxSaleAccount)
{
sysWxSaleAccount.setCreateTime(DateUtils.getNowDate());
return sysWxSaleAccountMapper.insertSysWxSaleAccount(sysWxSaleAccount);
}
/**
* 修改微信销售账号
*
* @param sysWxSaleAccount 微信销售账号
* 修改微信账号
*
* @param sysWxSaleAccount 微信账号
* @return 结果
*/
@Override
public int updateSysWxSaleAccount(SysWxSaleAccount sysWxSaleAccount)
{
sysWxSaleAccount.setUpdateTime(DateUtils.getNowDate());
return sysWxSaleAccountMapper.updateSysWxSaleAccount(sysWxSaleAccount);
}
/**
* 批量删除微信销售账号
*
* @param ids 需要删除的微信销售账号ID
* 批量删除微信账号
*
* @param ids 需要删除的微信账号ID
* @return 结果
*/
@Override
@ -80,9 +84,9 @@ public class SysWxSaleAccountServiceImpl implements ISysWxSaleAccountService
}
/**
* 删除微信销售账号信息
*
* @param id 微信销售账号ID
* 删除微信账号信息
*
* @param id 微信账号ID
* @return 结果
*/
@Override
@ -90,4 +94,21 @@ public class SysWxSaleAccountServiceImpl implements ISysWxSaleAccountService
{
return sysWxSaleAccountMapper.deleteSysWxSaleAccountById(id);
}
/**
* 根据微信号或手机号查询是否已存在
* @param accountOrPhone 手机号或微信号
* @param type 0微信号 1手机号
* @return
*/
@Override
public SysWxSaleAccount selectWxAccountByAccountOrPhone(String accountOrPhone, int type){
SysWxSaleAccount param = new SysWxSaleAccount();
if(type == 0){
param.setWxAccount(accountOrPhone);
}else{
param.setWxPhone(accountOrPhone);
}
return sysWxSaleAccountMapper.selectWxAccountByAccountOrPhone(param);
}
}

@ -111,6 +111,7 @@
<result property="otherPhysicalSigns" column="other_physical_signs" />
<result property="bloodData" column="blood_data" />
<result property="moistureDate" column="moisture_date" />
<result property="remark" column="remark"></result>
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
@ -122,7 +123,7 @@
<sql id="selectSysCustomerHealthyVo">
select sch.id, customer_id, conditioning_project_id, sex, age, weight, tall, condiment, other_condiment, cooking_style, cooking_style_rate, wash_vegetables_style, other_wash_vegetables_style, breakfast_type, breakfast_food, lunch_type, dinner, vegetable_rate, common_meat, dinner_time, supper_num, supper_food, diet_hot_and_cold, diet_flavor, vegetables_num, vegetables_rate_type, fruits_num, fruits_time, fruits_rate, rice_num, rice_full, eating_speed, snacks, other_snacks, health_products_flag, health_products_brand, health_products_name, health_products_week_rate, health_products_day_rate, water_num, water_type, water_habit, drinks_num, drink_wine_flag, drink_wine_classify, other_wine_classify, drink_wine_amount, smoke_flag, smoke_rate, second_smoke, work_industry, work_type, defecation_num, other_defecation_num, defecation_time, defecation_shape, defecation_smell, defecation_speed, defecation_color, motion_num, motion_duration, motion_time, aerobic_motion_classify, anaerobic_motion_classify, anaerobic_aerobic_motion_classify, other_motion_classify, motion_field, other_motion_field, sleep_time, sleep_quality, sleep_drug_flag, sleep_drug, stayup_late_flag, stayup_late_week_num, family_illness_history, other_family_illness_history, operation_history, other_operation_history, near_operation_flag, recoverye_situation, long_eat_drug_flag, long_eat_drug_classify, other_long_eat_drug_classify, allergy_flag, allergy_situation, allergen, other_allergen, medical_report, medical_report_name,
position,experience,rebound,difficulty,crux,dishes_ingredient,make_food_type,physical_signs_id,other_physical_signs,blood_data,moisture_date,
position,experience,rebound,difficulty,crux,dishes_ingredient,make_food_type,physical_signs_id,other_physical_signs,blood_data,moisture_date,sch.remark,
sch.create_time, sch.create_by,sch. update_time, sch.update_by, sch.del_flag
</sql>
@ -259,6 +260,7 @@
<if test="otherPhysicalSigns != null">other_physical_signs,</if>
<if test="bloodData != null">blood_data,</if>
<if test="moistureDate != null">moisture_date,</if>
<if test="remark != null">remark,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
@ -366,6 +368,7 @@
<if test="otherPhysicalSigns != null">#{otherPhysicalSigns},</if>
<if test="bloodData != null">#{bloodData},</if>
<if test="moistureDate != null">#{moistureDate},</if>
<if test="remark != null">#{remark},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
@ -476,6 +479,7 @@
<if test="otherPhysicalSigns != null">other_physical_signs = #{otherPhysicalSigns},</if>
<if test="bloodData != null">blood_data = #{bloodData},</if>
<if test="moistureDate != null">moisture_date = #{moistureDate},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.stdiet.custom.mapper.SysWxDistributionMapper">
<resultMap type="SysWxDistribution" id="SysWxDistributionResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="saleGroupId" column="sale_group_id" />
<result property="accountId" column="account_id" />
<result property="wechatAccount" column="wechat_account" />
<result property="wechatAccountType" column="wechat_account_type" />
<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="userName" column="user_name"></result>
<result property="account" column="account"></result>
<result property="wxNickName" column="wx_nick_name"></result>
<result property="wxAccount" column="wx_account"></result>
<result property="saleGroup" column="sale_group"></result>
</resultMap>
<sql id="selectSysWxDistributionVo">
select id, user_id, sale_group_id, account_id, wechat_account, wechat_account_type, create_time, create_by, update_time, update_by, del_flag from sys_wx_distribution
</sql>
<sql id="selectSysWxDistributionVoExtended">
SELECT swd.id, swd.user_id, swd.sale_group_id, swd.account_id, swd.wechat_account,swd.create_time,
su.nick_name as user_name,acc.dict_label as account,asg.dict_label as sale_group,
swsa.wx_nick_name,swsa.wx_account
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 = 'fan_channel') AS acc ON acc.dict_value = swd.account_id
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.del_flag = 0
</sql>
<select id="selectSysWxDistributionList" parameterType="SysWxDistribution" resultMap="SysWxDistributionResult">
<include refid="selectSysWxDistributionVoExtended"/>
<if test="userId != null"> and swd.user_id = #{userId}</if>
<if test="saleGroupId != null"> and swd.sale_group_id = #{saleGroupId}</if>
<if test="accountId != null"> and swd.account_id = #{accountId}</if>
ORDER BY swd.id DESC
</select>
<select id="selectSysWxDistributionById" parameterType="Long" resultMap="SysWxDistributionResult">
<include refid="selectSysWxDistributionVo"/>
where id = #{id} and del_flag = 0
</select>
<insert id="insertSysWxDistribution" parameterType="SysWxDistribution" useGeneratedKeys="true" keyProperty="id">
insert into sys_wx_distribution
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="saleGroupId != null">sale_group_id,</if>
<if test="accountId != null">account_id,</if>
<if test="wechatAccount != null">wechat_account,</if>
<if test="wechatAccountType != null">wechat_account_type,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="saleGroupId != null">#{saleGroupId},</if>
<if test="accountId != null">#{accountId},</if>
<if test="wechatAccount != null">#{wechatAccount},</if>
<if test="wechatAccountType != null">#{wechatAccountType},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updateSysWxDistribution" parameterType="SysWxDistribution">
update sys_wx_distribution
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="saleGroupId != null">sale_group_id = #{saleGroupId},</if>
<if test="accountId != null">account_id = #{accountId},</if>
<if test="wechatAccount != null">wechat_account = #{wechatAccount},</if>
<if test="wechatAccountType != null">wechat_account_type = #{wechatAccountType},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where id = #{id}
</update>
<update id="deleteSysWxDistributionById" parameterType="Long">
update sys_wx_distribution set del_flag = 1 where id = #{id}
</update>
<update id="deleteSysWxDistributionByIds" parameterType="String">
update sys_wx_distribution set del_flag = 1 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<!-- 根据微信号ID查询分配记录 -->
<select id="selectWxDistributionByWxId" parameterType="Long" resultMap="SysWxDistributionResult">
<include refid="selectSysWxDistributionVo"/>
where wechat_account = #{wxId} and del_flag = 0 limit 1
</select>
<!-- 根据用户ID查询被分配的微信号 -->
<select id="selectDistributionWxByUserId" parameterType="Long" resultMap="SysWxDistributionResult">
SELECT swd.id, swd.user_id, swd.sale_group_id, swd.account_id, swd.wechat_account,swd.create_time,
swsa.wx_nick_name,swsa.wx_account
FROM sys_wx_distribution AS swd
lEFT JOIN sys_wx_sale_account swsa ON swsa.id = swd.wechat_account and swsa.del_flag = 0
where swd.del_flag = 0 and swd.user_id = #{userId} order by swd.id asc
</select>
</mapper>

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.stdiet.custom.mapper.SysWxFanStatisticsMapper">
<resultMap type="SysWxFanStatistics" id="SysWxFanStatisticsResult">
<result property="id" column="id" />
<result property="wxId" column="wx_id" />
<result property="fanTime" column="fan_time" />
<result property="fanNum" column="fan_num" />
<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="saleGroupId" column="sale_group_id"></result>
<result property="userId" column="user_id"></result>
<result property="userName" column="user_name"></result>
<result property="account" column="account"></result>
<result property="saleGroup" column="sale_group"></result>
<result property="wxNickName" column="wx_nick_name"></result>
<result property="wxAccount" column="wx_account"></result>
</resultMap>
<sql id="selectSysWxFanStatisticsVo">
select id, wx_id, fan_time, fan_num, create_time, create_by, update_time, update_by, del_flag from sys_wx_fan_statistics
</sql>
<sql id="selectSysWxFanStatisticsVoExtended">
select
swfs.id, swfs.wx_id, swfs.fan_time, swfs.fan_num, swfs.create_time, swfs.create_by, swfs.update_time, swfs.update_by, swfs.del_flag,
su.nick_name as user_name,acc.dict_label as account,asg.dict_label as sale_group,swsa.wx_nick_name,swsa.wx_account,swd.sale_group_id
from sys_wx_fan_statistics swfs
left join sys_wx_sale_account swsa on swsa.id = swfs.wx_id and swsa.del_flag = 0
left join sys_wx_distribution swd on swd.wechat_account = swfs.wx_id and swd.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 = 'fan_channel') AS acc ON acc.dict_value = swd.account_id
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
</sql>
<select id="selectSysWxFanStatisticsList" parameterType="SysWxFanStatistics" resultMap="SysWxFanStatisticsResult">
<include refid="selectSysWxFanStatisticsVoExtended"/> where swfs.del_flag = 0
<if test="fanTime != null ">and swfs.fan_time = #{fanTime}</if>
<if test="userId != null">and su.user_id = #{userId}</if>
<if test="sortFlag == null or sortFlag == 0">
order by swfs.id desc
</if>
<if test="sortFlag != null and sortFlag == 1">
order by swd.sale_group_id asc,swd.user_id asc
</if>
</select>
<!-- 查询总进粉数量 -->
<select id="selectFanNumCount" parameterType="SysWxFanStatistics" resultType="int">
select ifnull(sum(swfs.fan_num),0) from sys_wx_fan_statistics swfs
left join sys_wx_distribution swd on swd.wechat_account = swfs.wx_id and swd.del_flag = 0
left join sys_user su on su.user_id = swd.user_id and su.del_flag = 0
where swfs.del_flag = 0
<if test="fanTime != null ">and swfs.fan_time = #{fanTime}</if>
<if test="userId != null">and su.user_id = #{userId}</if>
</select>
<select id="selectSysWxFanStatisticsById" parameterType="Long" resultMap="SysWxFanStatisticsResult">
<include refid="selectSysWxFanStatisticsVo"/>
where id = #{id} and del_flag = 0
</select>
<insert id="insertSysWxFanStatistics" parameterType="SysWxFanStatistics" useGeneratedKeys="true" keyProperty="id">
insert into sys_wx_fan_statistics
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="wxId != null">wx_id,</if>
<if test="fanTime != null">fan_time,</if>
<if test="fanNum != null">fan_num,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="wxId != null">#{wxId},</if>
<if test="fanTime != null">#{fanTime},</if>
<if test="fanNum != null">#{fanNum},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updateSysWxFanStatistics" parameterType="SysWxFanStatistics">
update sys_wx_fan_statistics
<trim prefix="SET" suffixOverrides=",">
<if test="wxId != null">wx_id = #{wxId},</if>
<if test="fanTime != null">fan_time = #{fanTime},</if>
<if test="fanNum != null">fan_num = #{fanNum},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where id = #{id}
</update>
<update id="deleteSysWxFanStatisticsById" parameterType="Long">
update sys_wx_fan_statistics set del_flag = 1 where id = #{id}
</update>
<update id="deleteSysWxFanStatisticsByIds" parameterType="String">
update sys_wx_fan_statistics set del_flag = 1 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<select id="getWxFanStatisticsByUserIdAndFanTime" parameterType="SysWxFanStatistics" resultMap="SysWxFanStatisticsResult">
select swfs.id, swfs.wx_id, swfs.fan_time, swfs.fan_num, swfs.create_time, swfs.create_by, swfs.update_time, swfs.update_by, swfs.del_flag
from sys_wx_fan_statistics swfs
left join sys_wx_distribution swd on swd.wechat_account = swfs.wx_id and swd.del_flag = 0
where swfs.del_flag = 0
<if test="userId != null">and swd.user_id = #{userId} </if>
<if test="fanTime != null"> and swfs.fan_time = #{fanTime}</if>
<if test="wxId != null">and swfs.wx_id = #{wxId}</if>
</select>
</mapper>

@ -6,82 +6,99 @@
<resultMap type="SysWxSaleAccount" id="SysWxSaleAccountResult">
<result property="id" column="id" />
<result property="nickName" column="nick_name" />
<result property="accountId" column="account_id" />
<result property="wxId" column="wx_id" />
<result property="phone" column="phone" />
<result property="wxNickName" column="wx_nick_name" />
<result property="wxAccount" column="wx_account" />
<result property="wxPhone" column="wx_phone" />
<result property="wxCodeUrl" column="wx_code_url" />
<result property="remark" column="remark" />
<result property="imgUrl" column="img_url" />
<result property="count" column="count" />
<result property="mediaId" column="media_id" />
<result property="wxType" column="wx_type" />
<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" />
</resultMap>
<sql id="selectSysWxSaleAccountVo">
select id, nick_name, account_id, wx_id, phone, remark, img_url, count, media_id from sys_wx_sale_account
select id, wx_nick_name, wx_account, wx_phone, wx_code_url, remark, wx_type, create_time, create_by, update_time, update_by, del_flag from sys_wx_sale_account
</sql>
<select id="selectSysWxSaleAccountList" parameterType="SysWxSaleAccount" resultMap="SysWxSaleAccountResult">
<include refid="selectSysWxSaleAccountVo"/>
<where>
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
<if test="accountId != null "> and account_id = #{accountId}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
</where>
<include refid="selectSysWxSaleAccountVo"/> where del_flag = 0
<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>
</select>
<select id="selectSysWxSaleAccountById" parameterType="Long" resultMap="SysWxSaleAccountResult">
<include refid="selectSysWxSaleAccountVo"/>
where id = #{id}
where id = #{id} and del_flag = 0
</select>
<insert id="insertSysWxSaleAccount" parameterType="SysWxSaleAccount" useGeneratedKeys="true" keyProperty="id">
insert into sys_wx_sale_account
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="nickName != null">nick_name,</if>
<if test="accountId != null">account_id,</if>
<if test="wxId != null">wx_id,</if>
<if test="phone != null">phone,</if>
<if test="wxNickName != null">wx_nick_name,</if>
<if test="wxAccount != null">wx_account,</if>
<if test="wxPhone != null">wx_phone,</if>
<if test="wxCodeUrl != null">wx_code_url,</if>
<if test="remark != null">remark,</if>
<if test="imgUrl != null">img_url,</if>
<if test="count != null">count,</if>
<if test="mediaId != null">media_id,</if>
<if test="wxType != null">wx_type,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="nickName != null">#{nickName},</if>
<if test="accountId != null">#{accountId},</if>
<if test="wxId != null">#{wxId},</if>
<if test="phone != null">#{phone},</if>
<if test="wxNickName != null">#{wxNickName},</if>
<if test="wxAccount != null">#{wxAccount},</if>
<if test="wxPhone != null">#{wxPhone},</if>
<if test="wxCodeUrl != null">#{wxCodeUrl},</if>
<if test="remark != null">#{remark},</if>
<if test="imgUrl != null">#{imgUrl},</if>
<if test="count != null">#{count},</if>
<if test="mediaId != null">#{mediaId},</if>
<if test="wxType != null">#{wxType},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updateSysWxSaleAccount" parameterType="SysWxSaleAccount">
update sys_wx_sale_account
<trim prefix="SET" suffixOverrides=",">
<if test="nickName != null">nick_name = #{nickName},</if>
<if test="accountId != null">account_id = #{accountId},</if>
<if test="wxId != null">wx_id = #{wxId},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="wxNickName != null">wx_nick_name = #{wxNickName},</if>
<if test="wxAccount != null">wx_account = #{wxAccount},</if>
<if test="wxPhone != null">wx_phone = #{wxPhone},</if>
<if test="wxCodeUrl != null">wx_code_url = #{wxCodeUrl},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="imgUrl != null">img_url = #{imgUrl},</if>
<if test="count != null">count = #{count},</if>
<if test="mediaId != null">media_id = #{mediaId},</if>
<if test="wxType != null">wx_type = #{wxType},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysWxSaleAccountById" parameterType="Long">
delete from sys_wx_sale_account where id = #{id}
</delete>
<update id="deleteSysWxSaleAccountById" parameterType="Long">
update sys_wx_sale_account set del_flag = 1 where id = #{id}
</update>
<delete id="deleteSysWxSaleAccountByIds" parameterType="String">
delete from sys_wx_sale_account where id in
<update id="deleteSysWxSaleAccountByIds" parameterType="String">
update sys_wx_sale_account set del_flag = 1 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</update>
<select id="selectWxAccountByAccountOrPhone" parameterType="SysWxSaleAccount" resultMap="SysWxSaleAccountResult">
<include refid="selectSysWxSaleAccountVo"/> where del_flag = 0
<if test="wxAccount != null and wxAccount != ''"> and wx_account = #{wxAccount}</if>
<if test="wxPhone != null and wxPhone != ''"> and wx_phone = #{wxPhone} </if>
limit 1
</select>
</mapper>

@ -104,7 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) AS up GROUP BY user_id ) AS ups USING(user_id)
WHERE del_flag = '0'
<if test="userName != null and userName != ''">
AND user_name like concat('%', #{userName}, '%')
AND (user_name like concat('%', #{userName}, '%') OR nick_name like concat('%', #{userName}, '%'))
</if>
<if test="status != null and status != ''">
AND status = #{status}

@ -0,0 +1,65 @@
import request from '@/utils/request'
// 查询进粉统计列表
export function listFanStatistics(query) {
return request({
url: '/custom/fanStatistics/list',
method: 'get',
params: query
})
}
// 查询进粉统计详细
export function getFanStatistics(id) {
return request({
url: '/custom/fanStatistics/' + id,
method: 'get'
})
}
// 新增进粉统计
export function addFanStatistics(data) {
return request({
url: '/custom/fanStatistics',
method: 'post',
data: data
})
}
// 修改进粉统计
export function updateFanStatistics(data) {
return request({
url: '/custom/fanStatistics',
method: 'put',
data: data
})
}
// 删除进粉统计
export function delFanStatistics(id) {
return request({
url: '/custom/fanStatistics/' + id,
method: 'delete'
})
}
// 导出进粉统计
export function exportFanStatistics(query) {
return request({
url: '/custom/fanStatistics/export',
method: 'get',
params: query
})
}
// 获取
export function getWxByUserId(userId) {
return request({
url: '/custom/fanStatistics/getWxByUserId',
method: 'get',
params: {"userId": userId}
})
}

@ -1,55 +1,53 @@
import request from '@/utils/request'
// 查询微信销售账号列表
// 查询微信账号列表
export function listWxAccount(query) {
return request({
url: '/custom/WxAccount/list',
url: '/custom/wxAccount/list',
method: 'get',
params: query
})
}
// 查询微信销售账号详细
// 查询微信账号详细
export function getWxAccount(id) {
return request({
url: '/custom/WxAccount/' + id,
url: '/custom/wxAccount/' + id,
method: 'get'
})
}
// 新增微信销售账号
// 新增微信账号
export function addWxAccount(data) {
return request({
url: '/custom/WxAccount',
url: '/custom/wxAccount',
method: 'post',
data: data
})
}
// 修改微信销售账号
// 修改微信账号
export function updateWxAccount(data) {
return request({
url: '/custom/WxAccount',
url: '/custom/wxAccount',
method: 'put',
data: data
})
}
// 删除微信销售账号
// 删除微信账号
export function delWxAccount(id) {
return request({
url: '/custom/WxAccount/' + id,
url: '/custom/wxAccount/' + id,
method: 'delete'
})
}
// 导出微信销售账号
// 导出微信账号
export function exportWxAccount(query) {
return request({
url: '/custom/WxAccount/export',
url: '/custom/wxAccount/export',
method: 'get',
params: query
})
}

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询微信分配管理列表
export function listWxDistribution(query) {
return request({
url: '/custom/wxDistribution/list',
method: 'get',
params: query
})
}
// 查询微信分配管理详细
export function getWxDistribution(id) {
return request({
url: '/custom/wxDistribution/' + id,
method: 'get'
})
}
// 新增微信分配管理
export function addWxDistribution(data) {
return request({
url: '/custom/wxDistribution',
method: 'post',
data: data
})
}
// 修改微信分配管理
export function updateWxDistribution(data) {
return request({
url: '/custom/wxDistribution',
method: 'put',
data: data
})
}
// 删除微信分配管理
export function delWxDistribution(id) {
return request({
url: '/custom/wxDistribution/' + id,
method: 'delete'
})
}
// 导出微信分配管理
export function exportWxDistribution(query) {
return request({
url: '/custom/wxDistribution/export',
method: 'get',
params: query
})
}

@ -15,13 +15,13 @@
</el-radio-group>
</el-form-item>
<el-form-item label="年龄" prop="age" >
<el-input type="number" v-model="form.age" placeholder="请输入年龄" autocomplete="off" ></el-input>
<el-input type="number" v-model="form.age" placeholder="请输入年龄(整数)" autocomplete="off" ></el-input>
</el-form-item>
<el-form-item label="身高(厘米)" prop="tall" >
<el-input type="number" v-model="form.tall" placeholder="请输入身高" autocomplete="off" ></el-input>
<el-input type="number" v-model="form.tall" placeholder="请输入身高(整数)" autocomplete="off" ></el-input>
</el-form-item>
<el-form-item label="体重(斤)" prop="weight" >
<el-input type="number" v-model="form.weight" placeholder="请输入体重" autocomplete="off" ></el-input>
<el-input v-model="form.weight" placeholder="请输入体重(可保留一位小数)" autocomplete="off" ></el-input>
</el-form-item>
<el-form-item label="调理项目" prop="conditioningProjectId">
<el-select v-model="form.conditioningProjectId" filterable clearable placeholder="请选择">

@ -46,10 +46,10 @@
</el-checkbox-group>
</el-form-item>
<p class="p_title_2">4生食果蔬状况</p>
<el-form-item :label="'(1) 平均每周吃生/拌菜几次'" prop="vegetablesNum" class="margin-left">
<el-form-item :label="'(1) 平均每周吃生菜几次'" prop="vegetablesNum" class="margin-left">
<el-input-number v-model="form.vegetablesNum" :step="1" :min="0"></el-input-number>
</el-form-item>
<el-form-item :label="'(2) 每周吃生/拌菜的频次'" prop="vegetablesRateType" class="margin-left">
<el-form-item :label="'(2) 每周吃生菜的频次'" prop="vegetablesRateType" class="margin-left">
<el-radio-group v-model="form.vegetablesRateType">
<el-radio v-for="(item,index) in healthyData['vegetablesRateTypeArray']" :label="item.value" :key="index">{{item.name}}</el-radio>
</el-radio-group>

@ -3,7 +3,8 @@
<div v-if="showFlag">
<div style="float:right;margin-top:-10px;margin-bottom: 10px;" v-show="dataList.length > 0">
<!-- 只有新版健康评估信息才可修改旧的体征数据不支持修改 -->
<el-button v-hasPermi="['custom:healthy:edit']" type="primary" v-show="dataType == 0" @click="handleEditHealthyClick()" plain>修改信息</el-button>
<el-button v-hasPermi="['custom:healthy:edit']" type="info" v-show="dataType == 0" @click="handleEditRemarkClick()" plain>修改备注</el-button>
<el-button v-hasPermi="['custom:healthy:edit']" type="warning" v-show="dataType == 0" @click="handleEditHealthyClick()" plain>修改信息</el-button>
<el-button type="danger" v-hasPermi="['custom:healthy:remove']" @click="handleDelete()" plain>删除信息</el-button>
</div>
<!-- 客户健康评估 -->
@ -14,6 +15,15 @@
<p class="p_title_1" style="margin-top: 5px;">{{titleArray[index]}}</p>
<table-detail-message :data="item" ></table-detail-message>
</div>
<!-- 备注 -->
<el-table :data="remarkList" :show-header="false" border :cell-style="remarkColumnStyle" style="width: 100%;">
<el-table-column width="140" prop="remarkTitle">
</el-table-column>
<el-table-column prop="remarkValue">
<template slot-scope="scope">
<auto-hide-message :data="scope.row.remarkValue" :maxLength="100"/></template>
</el-table-column>
</el-table>
</div>
<!-- 其他信息 -->
<div style="height:400px;overflow: auto">
@ -59,7 +69,8 @@
</div>
<!-- 编辑 -->
<physicalSigns-edit ref="physicalSignsEditDialog" @refreshHealthyData="getCustomerHealthyByCusId()"></physicalSigns-edit>
<!-- 编辑备注 -->
<physicalSigns-remark ref="physicalSignsRemarkDialog" @refreshHealthyData="getCustomerHealthyByCusId()"></physicalSigns-remark>
</el-dialog>
</template>
<script>
@ -69,13 +80,14 @@ import AutoHideMessage from "@/components/AutoHideMessage";
import * as healthyData from "@/utils/healthyData";
import Clipboard from 'clipboard';
import PhysicalSignsEdit from "@/components/PhysicalSignsEdit";
import PhysicalSignsRemark from "@/components/PhysicalSignsRemark";
export default {
name: "PhysicalSignsDialog",
components: {
"auto-hide-message": AutoHideMessage,
"table-detail-message": TableDetailMessage,
"physicalSigns-edit":PhysicalSignsEdit
"physicalSigns-edit":PhysicalSignsEdit,
"physicalSigns-remark":PhysicalSignsRemark
},
data() {
return {
@ -86,6 +98,7 @@ export default {
dataList: [],
dataType: 0,
healthyData: null,
remarkList:[{"remarkTitle": "备注信息", "remarkValue": ""}],
//
signTitleData: [
["创建时间", "姓名", "年龄"],
@ -127,8 +140,8 @@ export default {
],
[
["早餐习惯","早餐吃的食物","午餐习惯"],["晚餐习惯","正餐中素菜占比","最常吃的肉类"],
["晚餐时间","每周吃夜宵次数","夜宵通常吃的食物"],["食物的冷热偏好","食物的口味偏好","平均每周吃生菜几次"],
["每周吃生菜的频次类型","平均每天吃水果次数","吃水果的时间段"],["平时吃水果的频次","一餐吃几碗饭","吃几成饱"],
["晚餐时间","每周吃夜宵次数","夜宵通常吃的食物"],["食物的冷热偏好","食物的口味偏好","平均每周吃生菜几次"],
["每周吃生菜的频次类型","平均每天吃水果次数","吃水果的时间段"],["平时吃水果的频次","一餐吃几碗饭","吃几成饱"],
["吃饭速度","饮食特点","常吃的零食"],["有无服用营养保健品","营养保健品品牌名","营养保健品产品名"],
["服用营养保健品频次","忌口过敏食物",""]
],
@ -204,13 +217,21 @@ export default {
return "background:#ffffff;";
}
},
//
remarkColumnStyle({ row, column, rowIndex, columnIndex }) {
if (columnIndex % 2 === 0) {
//23
return "background:#f3f6fc;font-weight:bold";
} else {
return "background:#ffffff;";
}
},
showDialog(data) {
this.data = data;
this.title = `${data.name}」客户健康评估信息`;
this.getCustomerHealthyByCusId();
},
getCustomerHealthyByCusId(){
getCustomerPhysicalSignsByCusId(this.data.id).then((res) => {
this.showFlag = false;
if (res.data.customerHealthy) {
@ -218,6 +239,7 @@ export default {
this.dataType = res.data.type;
if(this.dataType == 0){
this.healthyData = Object.assign({}, res.data.customerHealthy);
this.remarkList[0].remarkValue = this.healthyData.remark;
this.getDataListByHealthyMessage(res.data.customerHealthy);
}else{
this.getDataListBySignMessage(res.data.customerHealthy)
@ -443,6 +465,9 @@ export default {
handleEditHealthyClick() {
//console.log(JSON.stringify(this.healthyData));
this.$refs["physicalSignsEditDialog"].showDialog(this.data, this.healthyData);
},
handleEditRemarkClick(){
this.$refs["physicalSignsRemarkDialog"].showDialog(this.data, this.healthyData);
}
}
};

@ -20,7 +20,7 @@
<healthy-form7 v-show="stepArray[6]" :form.sync="form"></healthy-form7>
<healthy-form8 v-show="stepArray[7]" :flag="1" :form.sync="form"></healthy-form8>
<edit-file v-show="stepArray[8]" ref="editFile" :form.sync="form"></edit-file>
<el-form-item style="text-align: center; margin: 30px auto" >
<el-form-item style="text-align: center; margin: 30px auto" v-show="submitShow">
<el-button type="primary" @click="submit()" style="width: 40%" >提交</el-button>
<el-button @click="onClosed()" style="width: 40%" >取消</el-button>
</el-form-item>
@ -61,6 +61,7 @@ export default {
healthyData:healthyData,
showModuleArray:[0],
stepArray: [true,false,false,false,false,false,false,false,false],
submitShow: true,
visible: false,
title: "",
data: undefined,
@ -90,7 +91,7 @@ export default {
{
required: true,
trigger: "blur",
pattern: /^[1-9]\d*$/,
pattern: /^(\d+)(\.\d{1})?$/,
message: "体重格式不正确",
},
],
@ -162,12 +163,14 @@ export default {
});
},
changeShowModule(){
// console.log("---------------");
let allShow = false;
for(var i = 0; i < this.stepArray.length; i++){
let flag = this.showModuleArray.find((opt) => opt === i);
// console.log(flag != null && flag != undefined);
this.$set(this.stepArray, i, (flag != null && flag != undefined));
let showFlag = flag != null && flag != undefined
this.$set(this.stepArray, i, showFlag);
allShow = showFlag ? showFlag : allShow;
}
this.submitShow = allShow;
}
}
};

@ -0,0 +1,88 @@
<template>
<el-dialog :visible.sync="visible" :title="title" width="500px" append-to-body @closed="onClosed">
<el-form ref="form" :model="form" :rules="rules" label-position="top" label-width="100px">
<el-form-item label="" prop="remark" >
<el-input
type="textarea"
:rows="5"
maxlength="300"
show-word-limit
placeholder="请输入备注"
v-model="form.remark">
</el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit()"> </el-button>
<el-button @click="onClosed()"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { getCustomerPhysicalSignsByCusId } from "@/api/custom/customer";
import { updateHealthy } from "@/api/custom/healthy";
export default {
name: "PhysicalSignsRemark",
components: {
},
data() {
return {
visible: false,
title: "",
data: undefined,
form: {
id: null,
remark: null
},
rules: {
}
};
},
methods: {
showDialog(data, healthy) {
this.data = data;
this.title = "修改"+`${data.name}`+"备注";
this.form.id = healthy.id;
this.form.remark = healthy.remark;
this.visible = true;
},
onClosed() {
this.visible = false;
this.data = null;
},
submit(){
this.$refs.form.validate((valid) => {
if (valid) {
this.editCustomerHealthy();
} else {
this.$message({message: "数据未填写完整", type: "warning"});
}
});
},
editCustomerHealthy(){
updateHealthy(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.onClosed();
this.$emit('refreshHealthyData');
}
}).catch(function() {
console.log("error");
});
}
}
};
</script>
<style>
.margin-top-20{
margin-top:20px;
}
.p_title_1{
font-size: 18px;
font-weight: bold;
margin-top: 20px;
}
</style>

@ -1,496 +0,0 @@
<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="账号名称" prop="nickName">
<el-input
v-model="queryParams.nickName"
placeholder="请输入账号名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="账号id" prop="accountId">
<el-select
v-model="queryParams.accountId"
placeholder="请选择账号id"
clearable
size="small"
>
<el-option
v-for="dict in accountIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input
v-model="queryParams.phone"
placeholder="请输入手机号"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</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>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['custom:WxAccount:add']"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['custom:WxAccount:edit']"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['custom:WxAccount:remove']"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['custom:WxAccount:export']"
>导出
</el-button>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="WxAccountList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="手机号" align="center" prop="id" />
<el-table-column label="账号名称" align="center" prop="nickName" />
<el-table-column
label="账号id"
align="center"
prop="accountId"
:formatter="accountIdFormat"
/>
<el-table-column label="微信号" align="center" prop="wxId" />
<el-table-column label="手机号" align="center" prop="phone" />
<el-table-column label="手机号" align="center" prop="remark" />
<el-table-column label="二维码图片" align="center" prop="imgUrl" />
<el-table-column label="使用次数" align="center" prop="count" />
<el-table-column label="微信资源id" align="center" prop="mediaId" />
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['custom:WxAccount:edit']"
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['custom:WxAccount:remove']"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改微信销售账号对话框 -->
<el-dialog
:title="title"
:visible.sync="open"
:close-on-click-modal="false"
width="500px"
append-to-body
>
<el-form ref="form" :model="form" :rules="rules" label-width="90px">
<el-form-item label="账号昵称" prop="nickName">
<el-input v-model="form.nickName" placeholder="请输入账号名称" />
</el-form-item>
<el-form-item label="账号id" prop="accountId">
<el-select v-model="form.accountId" placeholder="请选择账号id">
<el-option
v-for="dict in accountIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="微信号" prop="wxId">
<el-input v-model="form.wxId" placeholder="请输入微信号" />
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input v-model="form.phone" placeholder="请输入手机号" />
</el-form-item>
<el-form-item label="二维码图片" prop="imgUrl">
<el-upload
:class="`upload-demo ${
upload.fileList.length ? 'has-file' : ''
}`"
ref="upload"
drag
:action="upload.url"
:limit="upload.limit"
:headers="upload.headers"
:disabled="upload.isUploading"
:file-list="upload.fileList"
:multiple="upload.multiple"
:on-change="handleFileChange"
:on-remove="handleFileRemove"
:on-exceed="handleFileexceed"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:on-error="handleFileFail"
:data="upload.data"
:auto-upload="true"
list-type="picture"
>
<i class="el-icon-upload" />
<div class="el-upload__text">
将文件拖到此处<em>点击上传</em>
</div>
<div class="el-upload__tip" slot="tip">
只能上传jpg/png文件且不超过500kb
</div>
</el-upload>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
addWxAccount,
delWxAccount,
exportWxAccount,
getWxAccount,
listWxAccount,
updateWxAccount,
} from "@/api/custom/WxAccount";
import { getToken } from "@/utils/auth";
export default {
name: "WxAccount",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
WxAccountList: [],
//
title: "",
//
open: false,
// id
accountIdOptions: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
nickName: null,
accountId: null,
phone: null,
},
upload: {
//
isUploading: false,
//
url: process.env.VUE_APP_BASE_API + "/custom/WxAccount/upload",
//
headers: {
Authorization: "Bearer " + getToken(),
},
//
data: {},
//
fileList: [],
//
limit: 1,
//
fileSize: 1024 * 500,
//
multiple: false,
},
//
form: {},
//
rules: {},
};
},
created() {
this.getList();
this.getDicts("cus_account").then((response) => {
this.accountIdOptions = response.data;
});
},
methods: {
/** 查询微信销售账号列表 */
getList() {
this.loading = true;
listWxAccount(this.queryParams).then((response) => {
this.WxAccountList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// id
accountIdFormat(row, column) {
return this.selectDictLabel(this.accountIdOptions, row.accountId);
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
nickName: null,
accountId: null,
wxId: null,
phone: null,
remark: null,
imgUrl: null,
count: null,
mediaId: null,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加微信销售账号";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getWxAccount(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改微信销售账号";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != null) {
updateWxAccount(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addWxAccount(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm(
'是否确认删除微信销售账号编号为"' + ids + '"的数据项?',
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
)
.then(function () {
return delWxAccount(ids);
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
})
.catch(function () {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm("是否确认导出所有微信销售账号数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return exportWxAccount(queryParams);
})
.then((response) => {
this.download(response.msg);
})
.catch(function () {});
},
//
handleFileChange(file, fileList) {
let sizeFlag = file.size > this.upload.fileSize;
if (sizeFlag) {
this.$message({
message: "当前文件过大",
type: "warning",
});
fileList.pop();
}
this.upload.fileList = fileList;
},
handleFileRemove(file, fileList) {
this.upload.fileList = fileList;
},
//
handleFileexceed(file, fileList) {
//console.log(this.upload.fileList.length);
this.$message({
message: "最多可上传" + this.upload.limit + "份文件",
type: "warning",
});
},
//
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
//
handleFileSuccess(response, file, fileList) {
if (response != null && response.code === 200) {
this.form.imgUrl = response.fileName;
// console.log(response);
} else {
this.fail();
this.$message.error(response.msg);
}
},
//
handleFileFail(err, file, fileList) {
if (err) {
this.$message.error("文件上传失败,请检查文件格式");
this.fail();
}
},
fail() {
this.submitFlag = false;
this.upload.isUploading = false;
},
},
};
</script>
<style>
.has-file .el-upload--picture {
display: none;
}
.has-file .el-upload__tip {
display: none;
}
</style>

@ -0,0 +1,449 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="进粉日期" prop="fanTime">
<el-date-picker clearable style="width: 200px"
v-model="queryParams.fanTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
<el-form-item label="销售" prop="userId">
<el-select v-model="queryParams.userId" placeholder="请选择销售" filterable clearable>
<el-option
v-for="dict in preSaleIdOptions"
: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>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['custom:fanStatistics:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['custom:fanStatistics:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['custom:fanStatistics:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['custom:fanStatistics:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="fanStatisticsList" stripe @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="进粉日期" align="center" prop="fanTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.fanTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="销售" align="center" prop="userName" />
<el-table-column label="进粉渠道" align="center" prop="account" />
<el-table-column label="微信昵称" align="center" prop="wxNickName" />
<el-table-column label="微信号" align="center" prop="wxAccount" />
<el-table-column label="进粉数量" align="center" prop="fanNum" />
<!--<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['custom:fanStatistics:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['custom:fanStatistics:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
layout="total, slot, sizes, prev, pager, next, jumper"
@pagination="getList"
>
<span style="margin-right: 12px;font-size:13px;color:rgb(134 136 140)">总计进粉量 {{totalFanNum}}</span>
</pagination>
<!-- 添加进粉统计对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="进粉日期" prop="fanTime">
<el-date-picker clearable style="width: 200px"
v-model="form.fanTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
<el-form-item label="销售" prop="userId">
<el-select v-model="form.userId" placeholder="请选择销售" filterable clearable size="small" @change="getWxByUserId">
<el-option
v-for="dict in preSaleIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
<p style="margin: 20px auto 20px 40px;font-size: 16px;">请先选择销售再填写每个微信号对应进粉数量</p>
<div v-if="showWxFlag">
<div v-for="(item, index) in wxList" style="margin: 10px auto auto 40px;">
<span>{{item.wxAccount}}</span><el-input-number controls-position="right" v-model="form.fanNum[index]" style="width: 150px;margin-left: 10px" :min="0" :max="1000000000"></el-input-number>
</div>
</div>
</el-form>
<div slot="footer" class="dialog-footer" >
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 修改进粉统计对话框 -->
<el-dialog :title="title" :visible.sync="editOpen" width="500px" append-to-body>
<el-form ref="editForm" :model="editForm" :rules="editRules">
<el-form-item label="进粉日期" prop="fanTime">
<el-date-picker clearable style="width: 200px"
v-model="editForm.fanTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
<el-form-item label="进粉数量" prop="fanNum">
<el-input-number controls-position="right" v-model="editForm.fanNum" :min="0" :max="1000000000"></el-input-number>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer" >
<el-button type="primary" @click="editSubmit"> </el-button>
<el-button @click="editCancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listFanStatistics, getFanStatistics, delFanStatistics, addFanStatistics, updateFanStatistics, exportFanStatistics, getWxByUserId } from "@/api/custom/fanStatistics";
import { getOptions } from "@/api/custom/order";
import store from "@/store";
import dayjs from "dayjs";
const loginUserId = store.getters && store.getters.userId;
const nowDate = dayjs().subtract(1, 'day').format("YYYY-MM-DD");
export default {
name: "FanStatistics",
data() {
const checkOrderTime = (rule, value, callback) => {
if (!value) {
return callback(new Error("成交时间不能为空"));
}
callback();
};
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
totalFanNum: 0,
//
fanStatisticsList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
fanTime: nowDate,
userId: null
},
//
form: {},
//
rules: {
fanTime: [{ required: true, trigger: "blur", message: "请选择日期" }],
userId: [{ required: true, trigger: "blur", message: "请选择销售" }]
},
showWxFlag:false,
//
wxList:[],
//
preSaleIdOptions:[],
editOpen: false,
editForm:{},
//
editRules: {
fanTime: [{ required: true, trigger: "blur", message: "请选择日期" }],
fanNum: [{ required: true, trigger: "blur", message: "请输入进粉数量" }],
},
};
},
created() {
this.getList();
this.getSaleUserList();
},
methods: {
/** 查询进粉统计列表 */
getList() {
this.loading = true;
listFanStatistics(this.queryParams).then(response => {
this.fanStatisticsList = response.rows;
this.totalFanNum = 0;
if(this.fanStatisticsList != null && this.fanStatisticsList.length > 0){
this.totalFanNum = this.fanStatisticsList[0].totalFanNum;
}
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
editCancel() {
this.editOpen = false;
this.editFormReset();
},
//
reset() {
this.form = {
userId: null,
fanTime: nowDate,
wxId: [],
fanNum: []
};
this.wxList = [];
this.showWxFlag = false;
this.resetForm("form");
},
editFormReset(){
this.editForm = {
id: null,
wxId: null,
fanTime: null,
fanNum: 0
};
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
//
const defaultUserId = this.preSaleIdOptions.find(
(opt) => opt.dictValue === loginUserId
);
if (defaultUserId){
this.form.userId = defaultUserId.dictValue;
}
this.open = true;
this.title = "添加进粉统计";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.editFormReset();
const id = row.id || this.ids
getFanStatistics(id).then(response => {
this.editForm.id = response.data.id;
this.editForm.wxId = response.data.wxId;
this.editForm.fanTime = response.data.fanTime;
this.editForm.fanNum = response.data.fanNum;
this.editOpen = true;
this.title = "修改「"+row.wxAccount+"」的进粉统计";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if(this.form.wxId.length == 0){
this.msgError("该销售未被分配微信");
return;
}
let flag = true;
this.form.fanNum.forEach( (value, index) => {
if(value == null || value == undefined){
this.msgError("请填写进粉数量");
flag = false;
return;
}
});
if(flag){
addFanStatistics(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}else{
this.msgError("数据未填写完整");
}
});
},
editSubmit(){
this.$refs["editForm"].validate(valid => {
if (valid) {
updateFanStatistics(this.editForm).then(response => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.editOpen = false;
this.getList();
}
});
}else{
this.msgError("数据未填写完整");
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除进粉统计编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delFanStatistics(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(function() {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有进粉统计数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportFanStatistics(queryParams);
}).then(response => {
this.download(response.msg);
}).catch(function() {});
},
//
getSaleUserList(){
getOptions().then((response) => {
const options = response.data.reduce((opts, cur) => {
if (!opts[cur.postCode]) {
opts[cur.postCode] = [];
}
opts[cur.postCode].push({
dictValue: cur.userId,
dictLabel: cur.userName,
remark: cur.remark,
});
return opts;
}, {});
this.preSaleIdOptions = options["pre_sale"] || [];
});
},
//ID
getWxByUserId(userId){
this.showWxFlag = false;
this.form.wxId = [];
this.form.fanNum = [];
this.wxList = [];
if(userId == null || userId == undefined || userId == ""){
return;
}
getWxByUserId(userId).then(response => {
if (response.code === 200) {
this.wxList = response.data ? response.data : [];
if(this.wxList.length > 0){
for(let i=0; i < this.wxList.length; i++){
this.form.wxId[i] = this.wxList[i].wechatAccount;
this.form.fanNum[i] = 0;
}
this.showWxFlag = true;
}
}
});
},
}
};
</script>

@ -1,9 +1,9 @@
<template>
<section>
<div style="padding: 16px; text-align: center">
<img :src="logo" style="width: 258px; height: 80px" alt="logo" />
<div style="padding: 5px; text-align: center">
<img :src="logo" style="width: 150px; height: 35px" alt="logo" />
</div>
<div style="margin: 20px 15px 20px 15px;" >
<div style="margin: 10px 15px 10px 15px;" >
<el-steps :active="stepActive" finish-status="success">
<el-step v-for="(item,index) in stepArray" title=""></el-step>
</el-steps>
@ -184,7 +184,7 @@ export default {
{
required: true,
trigger: "blur",
pattern: /^[1-9]\d*$/,
pattern: /^(\d+)(\.\d{1})?$/,
message: "体重格式不正确",
},
],

@ -0,0 +1,317 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="微信昵称" prop="wxNickName">
<el-input
v-model="queryParams.wxNickName"
placeholder="请输入微信昵称"
clearable
size="small"
/>
</el-form-item>
<el-form-item label="微信号" prop="wxAccount">
<el-input
v-model="queryParams.wxAccount"
placeholder="请输入微信号"
clearable
size="small"
/>
</el-form-item>
<el-form-item label="手机号" prop="wxPhone">
<el-input
v-model="queryParams.wxPhone"
placeholder="请输入手机号"
clearable
size="small"
/>
</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>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['custom:wxAccount:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['custom:wxAccount:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['custom:wxAccount:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['custom:wxAccount:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="wxAccountList" stripe @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="微信昵称" align="center" prop="wxNickName" />
<el-table-column label="微信号" align="center" prop="wxAccount" />
<el-table-column label="手机号" align="center" prop="wxPhone" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['custom:wxAccount:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['custom:wxAccount:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改微信账号对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="微信昵称" prop="wxNickName">
<el-input v-model="form.wxNickName" maxlength="100" placeholder="请输入微信昵称" />
</el-form-item>
<el-form-item label="微信号" prop="wxAccount">
<el-input v-model="form.wxAccount" maxlength="100" placeholder="请输入微信号" />
</el-form-item>
<el-form-item label="手机号" prop="wxPhone">
<el-input v-model="form.wxPhone" maxlength="20" placeholder="请输入手机号" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input
type="textarea"
:rows="3"
show-word-limit
maxlength="100"
placeholder="请输入备注"
v-model="form.remark">
</el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listWxAccount, getWxAccount, delWxAccount, addWxAccount, updateWxAccount, exportWxAccount } from "@/api/custom/wxAccount";
export default {
name: "WxAccount",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
wxAccountList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
wxNickName: null,
wxAccount:null,
wxPhone:null
},
//
form: {},
//
rules: {
wxNickName: [{ required: true, trigger: "blur", message: "请输入微信昵称" }],
wxAccount: [{ required: true, trigger: "blur", message: "请输入微信号" }],
wxPhone: [
{
required: false,
trigger: "blur",
pattern: /^[0-9]{5,11}$/,
message: "手机号格式不正确",
},
]
}
};
},
created() {
this.getList();
},
methods: {
/** 查询微信账号列表 */
getList() {
this.loading = true;
listWxAccount(this.queryParams).then(response => {
this.wxAccountList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
wxNickName: null,
wxAccount: null,
wxPhone: null,
wxCodeUrl: null,
remark: null,
wxType: null,
createTime: null,
createBy: null,
updateTime: null,
updateBy: null,
delFlag: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加微信账号";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getWxAccount(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改微信账号";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateWxAccount(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addWxAccount(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除微信账号编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delWxAccount(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(function() {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有微信账号数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportWxAccount(queryParams);
}).then(response => {
this.download(response.msg);
}).catch(function() {});
}
}
};
</script>

@ -0,0 +1,376 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="销售" prop="userId">
<el-select v-model="queryParams.userId" placeholder="请选择销售" filterable clearable size="small">
<el-option
v-for="dict in preSaleIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
<el-form-item label="销售组别" prop="saleGroupId">
<el-select v-model="queryParams.saleGroupId" placeholder="请选择组别" filterable clearable size="small">
<el-option
v-for="dict in saleGroupOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
<el-form-item label="进粉渠道" prop="accountId">
<el-select v-model="queryParams.accountId" filterable placeholder="请选择渠道" clearable size="small">
<el-option
v-for="dict in accountIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
<!--<el-form-item label="微信号" prop="wechatAccount">
<el-input
v-model="queryParams.wechatAccount"
placeholder="请输入微信号"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</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>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['custom:wxDistribution:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['custom:wxDistribution:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['custom:wxDistribution:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['custom:wxDistribution:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="wxDistributionList" stripe @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="销售姓名" align="center" prop="userName" />
<el-table-column label="微信昵称" align="center" prop="wxNickName" />
<el-table-column label="微信号" align="center" prop="wxAccount" />
<el-table-column label="进粉渠道" align="center" prop="account" />
<el-table-column label="销售组别" align="center" prop="saleGroup" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['custom:wxDistribution:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['custom:wxDistribution:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改微信分配管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="销售" prop="userId">
<el-select v-model="form.userId" placeholder="请选择销售" filterable clearable size="small">
<el-option
v-for="dict in preSaleIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
<el-form-item label="销售组别" prop="saleGroupId">
<el-select v-model="form.saleGroupId" placeholder="请选择组别" filterable clearable size="small">
<el-option
v-for="dict in saleGroupOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
<el-form-item label="进粉渠道" prop="accountId">
<el-select v-model="form.accountId" filterable placeholder="请选择渠道" clearable size="small">
<el-option
v-for="dict in accountIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
<el-form-item label="微信号" prop="wechatAccount">
<el-select v-model="form.wechatAccount" filterable placeholder="请选择微信号" clearable size="small">
<el-option
v-for="dict in wxAccountList"
:key="dict.id"
:label="dict.wxAccount"
:value="parseInt(dict.id)"
/>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listWxDistribution, getWxDistribution, delWxDistribution, addWxDistribution, updateWxDistribution, exportWxDistribution } from "@/api/custom/wxDistribution";
import {getOptions} from "@/api/custom/order";
import { listWxAccount } from "@/api/custom/wxAccount";
export default {
name: "WxDistribution",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
wxDistributionList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
userId: null,
saleGroupId: null,
accountId: null,
wechatAccount: null,
},
//
form: {},
//
rules: {
userId: [{ required: true, trigger: "blur", message: "请选择销售" }],
saleGroupId: [{ required: true, trigger: "blur", message: "请选择组别" }],
accountId: [{ required: true, trigger: "blur", message: "请选择进粉账号" }],
wechatAccount: [{ required: true, trigger: "blur", message: "请选择微信号" }]
},
//
preSaleIdOptions:[],
//
accountIdOptions:[],
//
saleGroupOptions:[],
//
wxAccountList:[]
};
},
created() {
this.getList();
getOptions().then((response) => {
const options = response.data.reduce((opts, cur) => {
if (!opts[cur.postCode]) {
opts[cur.postCode] = [];
}
opts[cur.postCode].push({
dictValue: cur.userId,
dictLabel: cur.userName,
remark: cur.remark,
});
return opts;
}, {});
this.preSaleIdOptions = options["pre_sale"] || [];
});
this.getDicts("fan_channel").then((response) => {
this.accountIdOptions = response.data;
});
this.getDicts("sale_group").then((response) => {
this.saleGroupOptions = response.data;
});
this.getListWxAccount();
},
methods: {
/** 查询微信分配管理列表 */
getList() {
this.loading = true;
listWxDistribution(this.queryParams).then(response => {
this.wxDistributionList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
userId: null,
saleGroupId: null,
accountId: null,
wechatAccount: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加微信分配";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getWxDistribution(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改微信分配";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateWxDistribution(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addWxDistribution(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除微信号为"' + row.wxNickName + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delWxDistribution(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(function() {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有微信分配数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportWxDistribution(queryParams);
}).then(response => {
this.download(response.msg);
}).catch(function() {});
},
getListWxAccount() {
listWxAccount(this.queryParams).then(response => {
this.wxAccountList = response.rows;
});
}
}
};
</script>