群发bug修复

1 parent 60859b9f
package com.linkwechat.web.controller.wecom;
import com.alibaba.fastjson.JSONObject;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.constant.Constants;
......@@ -10,10 +10,12 @@ import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.utils.poi.ExcelUtil;
import com.linkwechat.wecom.domain.*;
import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag;
import com.linkwechat.wecom.service.IWeCustomerService;
import com.linkwechat.wecom.service.IWeCustomerTrajectoryService;
import com.linkwechat.wecom.service.IWeFlowerCustomerRelService;
import com.linkwechat.wecom.service.IWeFlowerCustomerTagRelService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -21,6 +23,7 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -40,6 +43,12 @@ public class WeCustomerController extends BaseController
@Autowired
private IWeFlowerCustomerTagRelService weFlowerCustomerTagRelService;
@Autowired
private IWeFlowerCustomerRelService weFlowerCustomerRelService;
@Autowired
private IWeCustomerTrajectoryService iWeCustomerTrajectoryService;
......@@ -80,23 +89,47 @@ public class WeCustomerController extends BaseController
{
startPage();
List<WeCustomerList> list = weCustomerService.findWeCustomerList(weCustomerList);
if(CollectionUtil.isNotEmpty(list)){
list.stream().forEach(k->{
List<WeFlowerCustomerRel> relList = weFlowerCustomerRelService.list(new LambdaQueryWrapper<WeFlowerCustomerRel>()
.eq(WeFlowerCustomerRel::getUserId, k.getFirstUserId())
.eq(WeFlowerCustomerRel::getExternalUserid, k.getExternalUserid()));
if(CollectionUtil.isNotEmpty(relList)){
WeFlowerCustomerRel customerRel = relList.stream().findFirst().get();
if(customerRel !=null){
customerRel.setWeFlowerCustomerTagRels(
weFlowerCustomerTagRelService.list(new LambdaQueryWrapper<WeFlowerCustomerTagRel>()
.eq(WeFlowerCustomerTagRel::getUserId,k.getFirstUserId())
.eq(WeFlowerCustomerTagRel::getExternalUserid,k.getExternalUserid()))
);
}
k.setWeFlowerCustomerRels(ListUtil.toList(
customerRel
));
}
});
}
return getDataTable(list);
}
// /**
// * 导出企业微信客户列表
// */
// // @PreAuthorize("@ss.hasPermi('wecom:customer:export')")
// @Log(title = "企业微信客户", businessType = BusinessType.EXPORT)
// @GetMapping("/export")
// public AjaxResult export(WeCustomer weCustomer)
// {
// List<WeCustomer> list = weCustomerService.selectWeCustomerList(weCustomer);
// ExcelUtil<WeCustomer> util = new ExcelUtil<WeCustomer>(WeCustomer.class);
// return util.exportExcel(list, "customer");
// }
/**
* 导出企业微信客户列表
*/
// @PreAuthorize("@ss.hasPermi('wecom:customer:export')")
@Log(title = "企业微信客户", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(WeCustomer weCustomer)
{
List<WeCustomer> list = weCustomerService.selectWeCustomerList(weCustomer);
ExcelUtil<WeCustomer> util = new ExcelUtil<WeCustomer>(WeCustomer.class);
return util.exportExcel(list, "customer");
}
/**
* 获取企业微信客户详细信息
......@@ -111,17 +144,14 @@ public class WeCustomerController extends BaseController
/**
* 修改企业微信客户(目前只更新生日)
* 修改企业微信客户
*/
// @PreAuthorize("@ss.hasPermi('wecom:customer:edit')")
@Log(title = "企业微信客户", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody WeCustomer weCustomer)
{
weCustomerService.update(weCustomer,new LambdaQueryWrapper<WeCustomer>()
.eq(WeCustomer::getExternalUserid,weCustomer.getExternalUserid())
.eq(WeCustomer::getFirstUserId,weCustomer.getFirstUserId()));
weCustomerService.saveOrUpdate(weCustomer);
return AjaxResult.success();
}
......@@ -169,7 +199,7 @@ public class WeCustomerController extends BaseController
@DeleteMapping("/removeLabel")
public AjaxResult removeLabel(@RequestBody WeMakeCustomerTag weMakeCustomerTag){
weCustomerService.makeLabel(weMakeCustomerTag);
weCustomerService.removeLabel(weMakeCustomerTag);
return AjaxResult.success();
......@@ -215,16 +245,5 @@ public class WeCustomerController extends BaseController
);
}
/**
* 客户条件检索
* @param params 检索条件
* @return
*/
@ApiOperation(value = "客户条件检索",httpMethod = "POST")
@PostMapping(value = "/getCustomerByCondition")
public AjaxResult getCustomerByCondition(@RequestBody JSONObject params){
weCustomerService.getCustomerByCondition(params);
return AjaxResult.success("");
}
}
......@@ -24,7 +24,7 @@ public interface WeCustomerMessagePushClient {
*/
@Deprecated
@Request(url = "/externalcontact/add_msg_template", type = "POST")
SendMessageResultDto sendCustomerMessageToUser(@Body WeCustomerMessagePushDto customerMessagePushDto);
SendMessageResultDto sendCustomerMessageToUser(@JSONBody WeCustomerMessagePushDto customerMessagePushDto);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!