diff --git a/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerController.java b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerController.java index 6fab8b7a20f2191431fdaaaa0c49e71002cb06c2..59b7f71005fb97b2f48dbd075b25ee0ea79e09f7 100644 --- a/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerController.java +++ b/linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerController.java @@ -1,27 +1,20 @@ package com.linkwechat.web.controller.wecom; -import java.util.List; - import com.linkwechat.common.annotation.Log; import com.linkwechat.common.constant.WeConstans; 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.vo.WeMakeCustomerTag; -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.linkwechat.wecom.domain.WeCustomer; +import com.linkwechat.wecom.domain.WeCustomerQuery; +import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag; import com.linkwechat.wecom.service.IWeCustomerService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; /** * 企业微信客户Controller @@ -40,11 +33,12 @@ public class WeCustomerController extends BaseController * 查询企业微信客户列表 */ @PreAuthorize("@ss.hasPermi('customerManage:customer:list')") - @GetMapping("/list") - public TableDataInfo list(WeCustomer weCustomer) + @PostMapping("/list") + public TableDataInfo list(@RequestBody WeCustomerQuery weCustomerQuery) { startPage(); - List list = weCustomerService.selectWeCustomerList(weCustomer); + List list = weCustomerService.selectWeCustomerList(weCustomerQuery); + return getDataTable(list); } diff --git a/linkwe-ui/src/api/customer/index.js b/linkwe-ui/src/api/customer/index.js index b1f8fd90cf8bcd8d12bc698abcdf3b997b5b07d0..83fa0978255444fdec059dfbeb424e36702397f1 100644 --- a/linkwe-ui/src/api/customer/index.js +++ b/linkwe-ui/src/api/customer/index.js @@ -14,10 +14,12 @@ const service = config.services.wecom + '/customer' "endTime": "结束时间" } */ +console.log(request) export function getList(params) { return request({ url: service + '/list', - params + method: 'post', + data: params }) } diff --git a/linkwe-ui/src/views/customerManage/customer.vue b/linkwe-ui/src/views/customerManage/customer.vue index 8c9bc1b3362c4690e8442f57076bace200c1bb23..1324c3ca01b1113800d5d2be2c92389760308fe2 100644 --- a/linkwe-ui/src/views/customerManage/customer.vue +++ b/linkwe-ui/src/views/customerManage/customer.vue @@ -12,13 +12,15 @@ export default { data() { return { query: { - pageNum: 1, - pageSize: 10, name: "", // "客户名称", - userId: "", // "添加人id", - tagIds: "", // "标签id,多个标签,id使用逗号隔开", - beginTime: "", // "开始时间", - endTime: "", // "结束时间" + params:{ + pageNum: 1, + pageSize: 10, + beginTime: "", // "开始时间", + endTime: "", // "结束时间", + userId: "", // "添加人id", + tagIds: "", // "标签id,多个标签,id使用逗号隔开", + } }, queryTag: [], // 搜索框选择的标签 queryUser: [], // 搜索框选择的添加人 @@ -92,12 +94,14 @@ export default { mounted() {}, methods: { getList(page) { - // console.log(this.dateRange); if (this.dateRange[0]) { - this.query.beginTime = this.dateRange[0]; - this.query.endTime = this.dateRange[1]; + this.query.params.beginTime = this.dateRange[0]; + this.query.params.endTime = this.dateRange[1]; + }else { + this.query.params.beginTime = ""; + this.query.params.endTime = ""; } - page && (this.query.pageNum = page); + page && (this.query.params.pageNum = page); this.loading = true; api .getList(this.query) @@ -173,15 +177,18 @@ export default { api.sync().then(() => { loading.close(); this.msgSuccess("后台开始同步数据,请稍后关注进度"); + }).catch(fail => { + loading.close(); + console.log(fail) }); }, selectedUser(list) { this.queryUser = list; - this.query.userId = list.map((d) => d.id) + ""; + this.query.params.userId = list.map((d) => d.id) + ""; }, submitSelectTag(formName) { if (this.tagDialogType.type === "query") { - this.query.tagIds = this.selectedTag.map((d) => d.tagId) + ""; + this.query.params.tagIds = this.selectedTag.map((d) => d.tagId) + ""; // debugger; this.queryTag = this.selectedTag; this.dialogVisible = false; @@ -366,8 +373,8 @@ export default { diff --git a/linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomer.java b/linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomer.java index 01ef177cc8a05fed6a59d888cc4b14e04fa56045..f6824cace934acbf7d7a4fc79a01eb58921e8bdd 100644 --- a/linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomer.java +++ b/linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomer.java @@ -27,10 +27,7 @@ import org.apache.commons.lang3.builder.ToStringStyle; @AllArgsConstructor @NoArgsConstructor @TableName("we_customer") -public class WeCustomer -{ - private static final long serialVersionUID = 1L; - +public class WeCustomer{ /** 外部联系人的userid */ @TableId diff --git a/linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomerQuery.java b/linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomerQuery.java new file mode 100644 index 0000000000000000000000000000000000000000..3c3fd84bff23670373cb3f5790093aa69e662869 --- /dev/null +++ b/linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomerQuery.java @@ -0,0 +1,76 @@ +package com.linkwechat.wecom.domain; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.linkwechat.common.core.domain.BaseEntity; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @author sunxiwang + * @description 客户查询入参实体 + * @date 2020/11/2 11:38 + **/ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class WeCustomerQuery extends BaseEntity { + + /** + * 外部联系人的userid + */ + private String externalUserid; + + /** + * 外部联系人名称 + */ + private String name; + + /** + * 外部联系人头像 + */ + private String avatar; + + /** + * 外部联系人的类型,1表示该外部联系人是微信用户,2表示该外部联系人是企业微信用户 + */ + private Integer type; + + /** + * 外部联系人性别 0-未知 1-男性 2-女性 + */ + private Integer gender; + + /** + * 外部联系人在微信开放平台的唯一身份标识,通过此字段企业可将外部联系人与公众号/小程序用户关联起来。 + */ + private String unionid; + + /** + * 生日 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date birthday; + + + /** + * 客户企业简称 + */ + private String corpName; + + /** + * 客户企业全称 + */ + private String corpFullName; + + /** + * 职位 + */ + private String position; +} diff --git a/linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeCustomerMapper.java b/linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeCustomerMapper.java index 8484e0827eca745dcb83dd74fbf71e745a9eb391..8303eecee8253a88a12641207569db2001630c19 100644 --- a/linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeCustomerMapper.java +++ b/linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeCustomerMapper.java @@ -4,6 +4,7 @@ import java.util.List; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.linkwechat.wecom.domain.WeCustomer; +import com.linkwechat.wecom.domain.WeCustomerQuery; import com.linkwechat.wecom.domain.WeUser; import org.apache.ibatis.annotations.Param; @@ -26,10 +27,10 @@ public interface WeCustomerMapper extends BaseMapper /** * 查询企业微信客户列表 * - * @param weCustomer 企业微信客户 + * @param weCustomerQuery 企业微信客户 * @return 企业微信客户集合 */ - public List selectWeCustomerList(WeCustomer weCustomer); + public List selectWeCustomerList(WeCustomerQuery weCustomerQuery); /** * 新增企业微信客户 diff --git a/linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerService.java b/linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerService.java index 1a289a31f026798a4710ea2fe86964b3a7fbd00c..0b7452f0bdf8785dae128187062b13d39066effc 100644 --- a/linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerService.java +++ b/linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerService.java @@ -2,6 +2,7 @@ package com.linkwechat.wecom.service; import com.baomidou.mybatisplus.extension.service.IService; import com.linkwechat.wecom.domain.WeCustomer; +import com.linkwechat.wecom.domain.WeCustomerQuery; import com.linkwechat.wecom.domain.WeUser; import com.linkwechat.wecom.domain.vo.WeLeaveUserInfoAllocateVo; import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag; @@ -27,10 +28,10 @@ public interface IWeCustomerService extends IService /** * 查询企业微信客户列表 * - * @param weCustomer 企业微信客户 + * @param weCustomerQuery 企业微信客户 * @return 企业微信客户集合 */ - public List selectWeCustomerList(WeCustomer weCustomer); + public List selectWeCustomerList(WeCustomerQuery weCustomerQuery); /** diff --git a/linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java b/linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java index 04a9232628823b3e87280e4b15fc5c6803de16a1..f6f1a1e3c276868ebb166bb2db61cb3b721ddfe1 100644 --- a/linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java +++ b/linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java @@ -95,13 +95,13 @@ public class WeCustomerServiceImpl extends ServiceImpl selectWeCustomerList(WeCustomer weCustomer) + public List selectWeCustomerList(WeCustomerQuery weCustomerQuery) { - return weCustomerMapper.selectWeCustomerList(weCustomer); + return weCustomerMapper.selectWeCustomerList(weCustomerQuery); } diff --git a/linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml b/linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml index cff5432bbeb30a67bd3002263e030ccc60cfb071..4de529ccdcb33d2a6bc6e31a59d0e7ad8733a3c1 100644 --- a/linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml +++ b/linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml @@ -40,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select id, external_userid, name, avatar, type, gender, unionid, birthday, corp_name, corp_full_name, position from we_customer - SELECT wc.external_userid, wc.`name`, @@ -73,6 +73,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN we_user wu ON wu.user_id=wfcr.user_id LEFT JOIN we_flower_customer_tag_rel wfcrf ON wfcrf.flower_customer_rel_id = wfcr.id LEFT JOIN we_tag wt ON wt.tag_id = wfcrf.tag_id + + + AND wc.name like concat('%', #{name}, '%') + + + AND wfcr.user_id = #{params.userId} + + + + + and wt.tag_id in + + #{item} + + + + and wt.tag_id=#{params.tagIds} + + + + AND date_format(wfcr.create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') + + + AND date_format(wfcr.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') + +