Commit 9da8cd9d by fudahua

Merge remote-tracking branch 'origin/master'

parents c73a354d 6e0afeae
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<groupId>com.gic</groupId> <groupId>com.gic</groupId>
<artifactId>gic-pom-base</artifactId> <artifactId>gic-pom-base</artifactId>
<version>3.0-SNAPSHOT</version> <version>3.0-SNAPSHOT</version>
<relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -6,7 +6,8 @@ package com.gic.haoban.manage.api.enums; ...@@ -6,7 +6,8 @@ package com.gic.haoban.manage.api.enums;
public enum AlertTypeEnum { public enum AlertTypeEnum {
QYWX_TAG_SYNC(1, "企微标签同步", null), QYWX_TAG_SYNC(1, "企微标签同步", null),
QUNFA_MESSAGE(2, "企微群发", null), QUNFA_MESSAGE(2, "企微群发", null),
FRIEND_ADD(3, "企微好友添加", null),; FRIEND_ADD(3, "企微好友添加", null),
CLOUD_STORE_CHANGE(4, "观云台门店进回收站", null),;
private Integer type; private Integer type;
private String name; private String name;
private String dingUrl; private String dingUrl;
......
...@@ -11,19 +11,19 @@ public enum AppPageType { ...@@ -11,19 +11,19 @@ public enum AppPageType {
//任务详情(会话、话务、不良评价) //任务详情(会话、话务、不良评价)
TASK_DETAIL(3, "hbapp_task_detail"), TASK_DETAIL(3, "hbapp_task_detail"),
//日报详情 //日报详情
DAILY_DETAIL(4, "hbapp_task_daily_report_detail"), DAILY_DETAIL(4, "hbapp_task_daily_report_detail"),
//指标管理详情 //指标管理详情
PERFORMANCE_DETAIL(5, "hbapp_task_kpi_detail"), PERFORMANCE_DETAIL(5, "hbapp_task_kpi_detail"),
//顾客详情 //顾客详情
CUSTOMER_DETAIL(6, "hbapp_customer_detail"), CUSTOMER_DETAIL(6, "hbapp_customer_detail"),
//会员列表 //会员列表
MEMBER_LIST(7, "hbapp_customer_list"), MEMBER_LIST(7, "hbapp_customer_list"),
//分配会员 //分配会员
DISTRIBUTE_MEMBER(8, "hbapp_customer_distribute"), DISTRIBUTE_MEMBER(8, "hbapp_customer_distribute"),
//任务列表 //任务列表
TASK_LIST(9, "hbapp_task_list"), TASK_LIST(9, "hbapp_task_list_new"),
//商品详情 //商品详情
GOOD_DETAIL(10, "hbapp_commodity_detail"), GOOD_DETAIL(10, "hbapp_commodity_detail"),
//我的关联记录 //我的关联记录
MY_RELATED_RECORD(11, "store_relate_my_record_list"), MY_RELATED_RECORD(11, "store_relate_my_record_list"),
//门店关联记录 //门店关联记录
...@@ -34,9 +34,9 @@ public enum AppPageType { ...@@ -34,9 +34,9 @@ public enum AppPageType {
FACE_ARRIVAL(14, "hbapp_customer_bind_faceId"), FACE_ARRIVAL(14, "hbapp_customer_bind_faceId"),
//完善标签 //完善标签
PERFECT_TAG(15, "hbapp_customer_edit_tag"), PERFECT_TAG(15, "hbapp_customer_edit_tag"),
//销售线索任务列表 //销售线索任务列表(hbapp_sales_lead_main废弃,改为新的hbapp_marketing_task_list)
MARKET_CLUE_TASK(16, "hbapp_sales_lead_main"), MARKET_CLUE_TASK(16, "hbapp_marketing_task_list"),
//话务任务逾期提醒 //话务任务
TEL_WITHIN_TIME_LIMIT(17, "hbapp_marketing_task_list"), TEL_WITHIN_TIME_LIMIT(17, "hbapp_marketing_task_list"),
; ;
......
package com.gic.haoban.manage.api.service; package com.gic.haoban.manage.api.service;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
public interface StaffDepartmentRelatedApiService { public interface StaffDepartmentRelatedApiService {
...@@ -25,41 +25,49 @@ public interface StaffDepartmentRelatedApiService { ...@@ -25,41 +25,49 @@ public interface StaffDepartmentRelatedApiService {
*/ */
StaffDepartmentRelatedDTO getByStaffDepartmentRelatedId(String staffDepartmentRelatedId); StaffDepartmentRelatedDTO getByStaffDepartmentRelatedId(String staffDepartmentRelatedId);
void deleteCode(StaffDepartmentRelatedDTO dto); void deleteCode(StaffDepartmentRelatedDTO dto);
StaffDepartmentRelatedDTO getOneByClerkCodeAndDepartmentId(String clerkCode, String departmentId); StaffDepartmentRelatedDTO getOneByClerkCodeAndDepartmentId(String clerkCode, String departmentId);
StaffDepartmentRelatedDTO getOneByStaffIdAndDepartmentId(String staffId, String departmentId); StaffDepartmentRelatedDTO getOneByStaffIdAndDepartmentId(String staffId, String departmentId);
Map<String,String> getWxUserIdByClerkId(String clerkId); Map<String, String> getWxUserIdByClerkId(String clerkId);
String getPageUrl(int type,String data); String getPageUrl(int type, String data);
//发送消息,单人发送 /**
boolean sendSingleMessage(String clerkId,String title,String content,String pageUrl); * 发送消息,单人发送
*
* @param clerkId
* @param title
* @param content
* @param pageUrl
* @return
*/
boolean sendSingleMessage(String clerkId, String title, String content, String pageUrl);
/** /**
* 单人消息发送通用方法 * 单人消息发送通用方法
* *
* @param clerkId : 接收人id * @param clerkId : 接收人id
* @param title : 通知标题 * @param title : 通知标题
* @param contentMap : 时间集合, key 为类型, value : 内容(例如 接收事件 : 事件内容) * @param contentMap : 时间集合, key 为类型, value : 内容(例如 接收事件 : 事件内容)
* @param pageUrl : 跳转地址 * @param pageUrl : 跳转地址
* @return : 返回是否发送成功 * @return : 返回是否发送成功
*/ */
Boolean sendSingleMessage(String clerkId, String title, Map<String, String> contentMap, String pageUrl); Boolean sendSingleMessage(String clerkId, String title, Map<String, String> contentMap, String pageUrl);
//发送消息,带审核理由 //发送消息,带审核理由
public boolean sendAuditMessage(String clerkId, String title,String content, String pageUrl,int auditStatus, String auditReason); boolean sendAuditMessage(String clerkId, String title, String content, String pageUrl, int auditStatus, String auditReason);
List<StaffDepartmentRelatedDTO> listByStaffIds(List<String> staffIds); List<StaffDepartmentRelatedDTO> listByStaffIds(List<String> staffIds);
public void sendClerkBind(String staffId,String clerkCode,String storeId,int auditStatus,String auditReason);
public void sendStaffBind(String staffId,String clerkCode,String storeId,int auditStatus,String auditReason);
public void sendClerkAdd (String clerkName,String clerkCode,String storeId,int auditStatus,String auditReason); void sendClerkBind(String staffId, String clerkCode, String storeId, int auditStatus, String auditReason);
void sendStaffBind(String staffId, String clerkCode, String storeId, int auditStatus, String auditReason);
void sendClerkAdd(String clerkName, String clerkCode, String storeId, int auditStatus, String auditReason);
public void sendClerkDel (String clerkName,String clerkCode,String storeId,int auditStatus,String auditReason); void sendClerkDel(String clerkName, String clerkCode, String storeId, int auditStatus, String auditReason);
} }
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<groupId>com.gic</groupId> <groupId>com.gic</groupId>
<artifactId>gic-pom-base</artifactId> <artifactId>gic-pom-base</artifactId>
<version>3.0-SNAPSHOT</version> <version>3.0-SNAPSHOT</version>
<relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
...@@ -14,8 +15,6 @@ ...@@ -14,8 +15,6 @@
<packaging>war</packaging> <packaging>war</packaging>
<name>haoban-manage3-operation-web Maven Webapp</name> <name>haoban-manage3-operation-web Maven Webapp</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
......
...@@ -2,30 +2,28 @@ package com.gic.haoban.manage.web.controller.test; ...@@ -2,30 +2,28 @@ package com.gic.haoban.manage.web.controller.test;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page; import com.gic.commons.util.GICMQClientUtil;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.CheckContainUtil;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.TestDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.enums.QuartzEnum; import com.gic.haoban.manage.api.enums.QuartzEnum;
import com.gic.haoban.manage.api.enums.SyncTaskTypeEnum;
import com.gic.haoban.manage.api.service.DealSyncOperationApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.TestApiService; import com.gic.haoban.manage.api.service.TestApiService;
import com.gic.haoban.manage.api.service.TestService;
import com.gic.haoban.manage.web.controller.WebBaseController; import com.gic.haoban.manage.web.controller.WebBaseController;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.TestQo; import com.gic.haoban.manage.web.qo.QywxTagSyncInfoQo;
import com.gic.haoban.manage.web.vo.TestVo; import com.gic.mq.sdk.GicMQClient;
import com.gic.sharing.core.service.api.service.MqApiService; import com.gic.sharing.core.service.api.service.MqApiService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.stream.Collectors;
import static org.slf4j.LoggerFactory.getLogger; import static org.slf4j.LoggerFactory.getLogger;
...@@ -44,6 +42,12 @@ public class TestController extends WebBaseController { ...@@ -44,6 +42,12 @@ public class TestController extends WebBaseController {
@Autowired @Autowired
private MqApiService mqApiService; private MqApiService mqApiService;
@Autowired
private StaffApiService staffApiService;
@Autowired
private DealSyncOperationApiService dealSyncOperationApiService;
// //
// @RequestMapping("/testList") // @RequestMapping("/testList")
// @ResponseBody // @ResponseBody
...@@ -135,4 +139,56 @@ public class TestController extends WebBaseController { ...@@ -135,4 +139,56 @@ public class TestController extends WebBaseController {
} }
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
/**
* 刷新好友
*
* @return
*/
@RequestMapping("/flush-friend-batch")
@ResponseBody
public HaobanResponse flushFriend(String key) {
if (StringUtils.isBlank(key)) {
return resultResponse(HaoBanErrCode.ERR_0);
}
String[] split = key.split(",");
for (String staffId : split) {
StaffDTO staff = staffApiService.selectById(staffId);
if (null == staff) {
continue;
}
String wxEnterpriseId = staff.getWxEnterpriseId();
String wxUserId = staff.getWxUserId();
String taskName = "刷新企业微信好友(" + staff.getStaffName() + ")";
String taskId = dealSyncOperationApiService.createWxFriendTaskSingle(staff.getWxEnterpriseId(), taskName, staffId, staff.getStaffName(), SyncTaskTypeEnum.FRIEND_SINGLE.getType());
if (StringUtils.isNotBlank(taskId)) {
dealSyncOperationApiService.dealWxFriendClerkSingle(taskId, wxUserId, staffId, wxEnterpriseId);
}
}
return resultResponse(HaoBanErrCode.ERR_1);
}
/**
* 刷新单个标签同步到队列
*
* @return
*/
@RequestMapping("/qywx-tag-mq")
@ResponseBody
public HaobanResponse qywxTagMq(String key) {
if (StringUtils.isBlank(key)) {
return resultResponse(HaoBanErrCode.ERR_0);
}
JSONArray jsonArray = JSONArray.parseArray(key);
List<String> mqList = jsonArray.stream().map(qo -> JSONObject.toJSONString(qo)).collect(Collectors.toList());
GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
try {
clientInstance.sendBatchMessages("qywxTagSyncDeal", mqList);
} catch (Exception e) {
e.printStackTrace();
logger.info("批量异常:{}", e);
}
return resultResponse(HaoBanErrCode.ERR_1);
}
} }
package com.gic.haoban.manage.web.qo;
import java.io.Serializable;
import java.util.List;
/**
* Created 2021/7/19.
*
* @author hua
*/
public class QywxTagSyncInfoQo implements Serializable {
/**
* 任务id
*/
private String taskId;
/**
* 任务类型 0标签同步 1会员标签同步
* #taskTypeEnum
*/
private int taskType;
/**
* 数据id 对应memberId
*/
private String dataId;
/**
* 同步类型
*/
private int syncType;
private Integer times = 0;
/**
* 批量导入时
*/
private List<String> memberIds;
/**
* 非必传
*/
private String wxEnterpriseId;
/**
* 非必传
*/
private String enterpriseId;
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public List<String> getMemberIds() {
return memberIds;
}
public void setMemberIds(List<String> memberIds) {
this.memberIds = memberIds;
}
public int getSyncType() {
return syncType;
}
public void setSyncType(int syncType) {
this.syncType = syncType;
}
/**
* 同步的id
*/
private Integer syncLogId;
public Integer getTimes() {
return times;
}
public void setTimes(Integer times) {
this.times = times;
}
public Integer getSyncLogId() {
return syncLogId;
}
public void setSyncLogId(Integer syncLogId) {
this.syncLogId = syncLogId;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public int getTaskType() {
return taskType;
}
public void setTaskType(int taskType) {
this.taskType = taskType;
}
public String getDataId() {
return dataId;
}
public void setDataId(String dataId) {
this.dataId = dataId;
}
}
...@@ -51,6 +51,9 @@ ...@@ -51,6 +51,9 @@
<dubbo:reference interface="com.gic.haoban.manage.api.service.HandoverOperationApiService" <dubbo:reference interface="com.gic.haoban.manage.api.service.HandoverOperationApiService"
id="handoverOperationApiService"/> id="handoverOperationApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.DealSyncOperationApiService"
id="dealSyncOperationApiService"/>
<dubbo:reference interface="com.gic.sharing.core.service.api.service.MqApiService" <dubbo:reference interface="com.gic.sharing.core.service.api.service.MqApiService"
id="mqApiService"/> id="mqApiService"/>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<groupId>com.gic</groupId> <groupId>com.gic</groupId>
<artifactId>gic-pom-base</artifactId> <artifactId>gic-pom-base</artifactId>
<version>3.0-SNAPSHOT</version> <version>3.0-SNAPSHOT</version>
<relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -51,6 +51,6 @@ public interface StaffClerkBindLogMapper { ...@@ -51,6 +51,6 @@ public interface StaffClerkBindLogMapper {
public List<TabHaobanStaffClerkBindLog> listStaffClerkBindLog(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("clerkIds") List<String> clerkIds public List<TabHaobanStaffClerkBindLog> listStaffClerkBindLog(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("clerkIds") List<String> clerkIds
, @Param("staffIds") List<String> staffIds, @Param("enterpriseIds") List<String> enterpriseIds, @Param("optType") int optType, @Param("search") String search); , @Param("staffIds") List<String> staffIds, @Param("enterpriseIds") List<String> enterpriseIds, @Param("optType") int optType, @Param("search") String search);
public List<TabHaobanStaffClerkBindLog> StaffClerkUnBindLog(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("clerkId") String clerkIds public List<TabHaobanStaffClerkBindLog> staffClerkUnBindLog(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("clerkId") String clerkIds
, @Param("enterpriseId") String enterpriseIds, @Param("optType") int optType); , @Param("enterpriseId") String enterpriseIds, @Param("optType") int optType);
} }
\ No newline at end of file
...@@ -193,4 +193,12 @@ public interface TabHaobanExternalClerkRelatedMapper { ...@@ -193,4 +193,12 @@ public interface TabHaobanExternalClerkRelatedMapper {
* @return * @return
*/ */
List<TabHaobanExternalClerkRelated> listByExternalUserId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("externalUserId") String externalUserId); List<TabHaobanExternalClerkRelated> listByExternalUserId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("externalUserId") String externalUserId);
/**
* 根据会员id更新新老会员id
*
* @param memberId
* @return
*/
int updateMemberIdByMemberId(@Param("memberId") String memberId, @Param("oldMemberId") String oldMemberId);
} }
\ No newline at end of file
...@@ -58,4 +58,13 @@ public interface ExternalClerkRelatedService { ...@@ -58,4 +58,13 @@ public interface ExternalClerkRelatedService {
*/ */
List<TabHaobanExternalClerkRelated> listExternalByExternalUserid(String wxEnterpriseId, String externalUserid); List<TabHaobanExternalClerkRelated> listExternalByExternalUserid(String wxEnterpriseId, String externalUserid);
/**
* 校验会员id与unionid的对应 主要修复会员合并是没有更新会老的情况
*
* @param memberId
* @param unionId
* @return
*/
String checkAndUpdateMemberByUnonId(String enterpriseId, String memberId, String unionId);
} }
...@@ -5,6 +5,14 @@ import java.util.Date; ...@@ -5,6 +5,14 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import com.alibaba.fastjson.JSONObject;
import com.gic.member.api.dto.MemberDTO;
import com.gic.member.api.service.MemberService;
import com.gic.search.engine.api.dto.ESResponseQuerySingle;
import com.gic.search.engine.api.dto.dynamic.DynamicSearchDTO;
import com.gic.search.engine.api.service.dynamic.ESDataDynamicOperationApiService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.alibaba.dubbo.config.annotation.Service; import com.alibaba.dubbo.config.annotation.Service;
...@@ -16,12 +24,22 @@ import com.gic.haoban.manage.service.dao.mapper.TabHaobanExternalClerkRelatedMap ...@@ -16,12 +24,22 @@ import com.gic.haoban.manage.service.dao.mapper.TabHaobanExternalClerkRelatedMap
import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated; import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated;
import com.gic.haoban.manage.service.service.ExternalClerkRelatedService; import com.gic.haoban.manage.service.service.ExternalClerkRelatedService;
import static org.slf4j.LoggerFactory.getLogger;
@Service @Service
public class ExternalClerkRelatedServiceImpl implements ExternalClerkRelatedService { public class ExternalClerkRelatedServiceImpl implements ExternalClerkRelatedService {
private static final Logger logger = getLogger(ExternalClerkRelatedServiceImpl.class);
@Autowired @Autowired
private TabHaobanExternalClerkRelatedMapper mapper; private TabHaobanExternalClerkRelatedMapper mapper;
@Autowired
private ESDataDynamicOperationApiService esDataDynamicOperationApiService;
@Autowired
private MemberService memberService;
@Override @Override
public void insert(TabHaobanExternalClerkRelated related) { public void insert(TabHaobanExternalClerkRelated related) {
String clerkId = related.getClerkId(); String clerkId = related.getClerkId();
...@@ -110,4 +128,38 @@ public class ExternalClerkRelatedServiceImpl implements ExternalClerkRelatedServ ...@@ -110,4 +128,38 @@ public class ExternalClerkRelatedServiceImpl implements ExternalClerkRelatedServ
public List<TabHaobanExternalClerkRelated> listExternalByExternalUserid(String wxEnterpriseId, String externalUserid) { public List<TabHaobanExternalClerkRelated> listExternalByExternalUserid(String wxEnterpriseId, String externalUserid) {
return mapper.listByExternalUserId(wxEnterpriseId, externalUserid); return mapper.listByExternalUserId(wxEnterpriseId, externalUserid);
} }
@Override
public String checkAndUpdateMemberByUnonId(String enterpriseId, String memberId, String unionId) {
String returnFields = "id";
try {
JSONObject searchJson = new JSONObject();
searchJson.put("id", memberId);
DynamicSearchDTO search = new DynamicSearchDTO();
search.setSearchJson(searchJson);
search.setEnterpriseId(enterpriseId);
search.setColumnCategoryCode("member");
if (StringUtils.isNotBlank(returnFields)) {
search.setReturnFileds(returnFields);
}
ESResponseQuerySingle single = esDataDynamicOperationApiService.queryDataSingle(search);
JSONObject res = single.getRes();
logger.info("返回数据:{}", JSONObject.toJSONString(res));
if (res != null && res.size() > 0) {
return memberId;
}
MemberDTO memberDTO = memberService.getMemberByUnionid(unionId, enterpriseId);
if (null == memberDTO || memberDTO.getMemberId() == null) {
logger.info("会员不存在:{}", unionId);
return null;
}
//更新会员id
mapper.updateMemberIdByMemberId(memberDTO.getMemberId(), memberId);
return memberDTO.getMemberId();
} catch (Exception e) {
logger.info("异常:{}", e);
logger.info("从搜索引擎中搜索会员数据异常, memberId : {}", memberId);
}
return null;
}
} }
...@@ -95,7 +95,7 @@ public class StaffClerkBindLogServiceImpl implements StaffClerkBindLogService { ...@@ -95,7 +95,7 @@ public class StaffClerkBindLogServiceImpl implements StaffClerkBindLogService {
@Override @Override
public Page<StaffClerkBindLogDetailDTO> pageUnBindLog(String wxEnterpriseId, String clerkId, String enterpriseId, int optType, BasePageInfo pageInfo) { public Page<StaffClerkBindLogDetailDTO> pageUnBindLog(String wxEnterpriseId, String clerkId, String enterpriseId, int optType, BasePageInfo pageInfo) {
PageHelper.startPage(pageInfo); PageHelper.startPage(pageInfo);
List<TabHaobanStaffClerkBindLog> clerkBindLogList = staffClerkBindLogMapper.StaffClerkUnBindLog(wxEnterpriseId, clerkId, enterpriseId, optType); List<TabHaobanStaffClerkBindLog> clerkBindLogList = staffClerkBindLogMapper.staffClerkUnBindLog(wxEnterpriseId, clerkId, enterpriseId, optType);
Page<StaffClerkBindLogDetailDTO> retPage = PageUtil.changePageHelperToCurrentPage(new PageInfo<>(clerkBindLogList), StaffClerkBindLogDetailDTO.class); Page<StaffClerkBindLogDetailDTO> retPage = PageUtil.changePageHelperToCurrentPage(new PageInfo<>(clerkBindLogList), StaffClerkBindLogDetailDTO.class);
return retPage; return retPage;
} }
......
...@@ -136,7 +136,8 @@ public class CheckQywxSettingApiServiceImpl implements CheckQywxSettingApiServic ...@@ -136,7 +136,8 @@ public class CheckQywxSettingApiServiceImpl implements CheckQywxSettingApiServic
} }
//告警是否拦截重复告警 防止批量触发 //告警是否拦截重复告警 防止批量触发
if (StringUtils.isNotBlank(messageDTO.getKey())) { if (StringUtils.isNotBlank(messageDTO.getKey())) {
RBucket<Object> bucket = RedisUtil.getRedisClient().getBucket(messageDTO.getKey()); String key = messageDTO.getKey() + messageDTO.getAlertType();
RBucket<Object> bucket = RedisUtil.getRedisClient().getBucket(key);
boolean b = bucket.trySet(1, 60L, TimeUnit.SECONDS); boolean b = bucket.trySet(1, 60L, TimeUnit.SECONDS);
if (!b) { if (!b) {
return; return;
......
...@@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GICMQClientUtil; import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.app.customer.dto.SearchComputeDTO;
import com.gic.haoban.app.customer.dto.SearchDataDTO;
import com.gic.haoban.app.customer.enums.GicQywxSyncTypeEnum; import com.gic.haoban.app.customer.enums.GicQywxSyncTypeEnum;
import com.gic.haoban.app.customer.enums.QywxSyncTaskTypeEnum; import com.gic.haoban.app.customer.enums.QywxSyncTaskTypeEnum;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
...@@ -18,14 +20,26 @@ import com.gic.haoban.manage.service.dao.mapper.TabHaobanExternalClerkRelatedMap ...@@ -18,14 +20,26 @@ import com.gic.haoban.manage.service.dao.mapper.TabHaobanExternalClerkRelatedMap
import com.gic.haoban.manage.service.entity.MemberUnionidRelated; import com.gic.haoban.manage.service.entity.MemberUnionidRelated;
import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated; import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated;
import com.gic.haoban.manage.service.pojo.QywxTagSyncInfoPojo; import com.gic.haoban.manage.service.pojo.QywxTagSyncInfoPojo;
import com.gic.member.api.dto.MemberDTO;
import com.gic.member.api.service.MemberApiService;
import com.gic.member.api.service.MemberService;
import com.gic.mq.sdk.GicMQClient; import com.gic.mq.sdk.GicMQClient;
import com.gic.search.engine.api.constant.MemberDataEnum;
import com.gic.search.engine.api.constant.OperateEnum;
import com.gic.search.engine.api.dto.ESResponseQueryBatch;
import com.gic.search.engine.api.dto.ESResponseQuerySingle;
import com.gic.search.engine.api.dto.dynamic.DynamicSearchDTO;
import com.gic.search.engine.api.service.dynamic.ESDataDynamicOperationApiService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -217,4 +231,5 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA ...@@ -217,4 +231,5 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
List<TabHaobanExternalClerkRelated> list = tabHaobanExternalClerkRelatedMapper.listByMemberId(memberId); List<TabHaobanExternalClerkRelated> list = tabHaobanExternalClerkRelatedMapper.listByMemberId(memberId);
return EntityUtil.changeEntityListNew(ExternalClerkRelatedShortInfoDTO.class, list); return EntityUtil.changeEntityListNew(ExternalClerkRelatedShortInfoDTO.class, list);
} }
} }
...@@ -677,9 +677,13 @@ public class QywxTagApiServiceImpl implements QywxTagApiService { ...@@ -677,9 +677,13 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
logger.info("该企业下没有配置需要同步的:{},{}", externalUserId, clerkRelated.getEnterpriseId()); logger.info("该企业下没有配置需要同步的:{},{}", externalUserId, clerkRelated.getEnterpriseId());
continue; continue;
} }
String memberId = externalClerkRelatedService.checkAndUpdateMemberByUnonId(clerkRelated.getEnterpriseId(), clerkRelated.getMemberId(), clerkRelated.getUnionid());
if (null == memberId) {
logger.info("会员不存在:{}", externalUserId);
continue;
}
//该会员打的标签 //该会员打的标签
List<MemberTagDTO> gicItems = memberTagService.listMemberTag(clerkRelated.getEnterpriseId(), clerkRelated.getMemberId()); List<MemberTagDTO> gicItems = memberTagService.listMemberTag(clerkRelated.getEnterpriseId(), memberId);
Set<String> noSyncTagItemIds = new HashSet<>(); Set<String> noSyncTagItemIds = new HashSet<>();
if (!CollectionUtils.isEmpty(gicItems)) { if (!CollectionUtils.isEmpty(gicItems)) {
noSyncTagItemIds = gicItems.stream().filter(item -> !entQywxSyncTagItemIds.contains(item.getTagsId())).map(dto -> dto.getTagsId()).collect(Collectors.toSet()); noSyncTagItemIds = gicItems.stream().filter(item -> !entQywxSyncTagItemIds.contains(item.getTagsId())).map(dto -> dto.getTagsId()).collect(Collectors.toSet());
...@@ -692,9 +696,9 @@ public class QywxTagApiServiceImpl implements QywxTagApiService { ...@@ -692,9 +696,9 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
logger.info("该企业会员需要打的标签:{}", JSONObject.toJSONString(entMemberNeedSetQywxKeys)); logger.info("该企业会员需要打的标签:{}", JSONObject.toJSONString(entMemberNeedSetQywxKeys));
//更新标签 会自动同步 //更新标签 会自动同步
if (CollectionUtils.isEmpty(saveTagIds)) { if (CollectionUtils.isEmpty(saveTagIds)) {
saveMemberTags(new HashSet<>(), clerkRelated.getEnterpriseId(), clerkRelated.getMemberId(), clerkRelated.getClerkId()); saveMemberTags(new HashSet<>(), clerkRelated.getEnterpriseId(), memberId, clerkRelated.getClerkId());
} else { } else {
saveMemberTags(saveTagIds, clerkRelated.getEnterpriseId(), clerkRelated.getMemberId(), clerkRelated.getClerkId()); saveMemberTags(saveTagIds, clerkRelated.getEnterpriseId(), memberId, clerkRelated.getClerkId());
} }
// hasSaveMemberId.add(clerkRelated.getMemberId()); // hasSaveMemberId.add(clerkRelated.getMemberId());
// //同步企业的标签到企业微信 // //同步企业的标签到企业微信
......
...@@ -14,11 +14,9 @@ import com.gic.haoban.manage.service.config.Config; ...@@ -14,11 +14,9 @@ import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper; import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper; import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper; import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation; import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated; import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise; import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.service.DepartmentService;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService; import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
import com.gic.wechat.api.dto.qywx.ItemDTO; import com.gic.wechat.api.dto.qywx.ItemDTO;
import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO; import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO;
...@@ -37,7 +35,7 @@ import java.util.*; ...@@ -37,7 +35,7 @@ import java.util.*;
@Service @Service
public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRelatedApiService { public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRelatedApiService {
private static Logger logger= LoggerFactory.getLogger(StaffDepartmentRelatedApiServiceImpl.class); private static final Logger logger = LoggerFactory.getLogger(StaffDepartmentRelatedApiServiceImpl.class);
@Autowired @Autowired
private StaffDepartmentRelatedService staffDepartmentRelatedService; private StaffDepartmentRelatedService staffDepartmentRelatedService;
...@@ -50,10 +48,6 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -50,10 +48,6 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
@Autowired @Autowired
private WxEnterpriseMapper wxEnterpriseMapper; private WxEnterpriseMapper wxEnterpriseMapper;
@Autowired @Autowired
private WxEnterpriseRelatedMapper wxEnterpriseRelatedMapper;
@Autowired
private DepartmentService departmentService;
@Autowired
private Config config; private Config config;
@Autowired @Autowired
private TabHaobanStaffClerkRelationMapper tabHaobanStaffClerkRelationMapper; private TabHaobanStaffClerkRelationMapper tabHaobanStaffClerkRelationMapper;
...@@ -61,20 +55,19 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -61,20 +55,19 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
private StaffApiService staffApiService; private StaffApiService staffApiService;
@Override @Override
public List<StaffDepartmentRelatedDTO> listByDepartmentId( public List<StaffDepartmentRelatedDTO> listByDepartmentId(String departmentId) {
String departmentId) {
List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listByDepartmentId(departmentId); List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listByDepartmentId(departmentId);
List<StaffDepartmentRelatedDTO> resultList = EntityUtil.changeEntityListByJSON(StaffDepartmentRelatedDTO.class, list); List<StaffDepartmentRelatedDTO> resultList = EntityUtil.changeEntityListByJSON(StaffDepartmentRelatedDTO.class, list);
return resultList; return resultList;
} }
@Override @Override
public List<StaffDepartmentRelatedDTO> listByDepartmentIds( public List<StaffDepartmentRelatedDTO> listByDepartmentIds(List<String> departmentIds) {
List<String> departmentIds) {
List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedMapper.listByDepartmentIds(departmentIds); List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedMapper.listByDepartmentIds(departmentIds);
List<StaffDepartmentRelatedDTO> resultList = EntityUtil.changeEntityListByJSON(StaffDepartmentRelatedDTO.class, list); List<StaffDepartmentRelatedDTO> resultList = EntityUtil.changeEntityListByJSON(StaffDepartmentRelatedDTO.class, list);
return resultList; return resultList;
} }
@Override @Override
public void updateById(StaffDepartmentRelatedDTO dto) { public void updateById(StaffDepartmentRelatedDTO dto) {
TabHaobanStaffDepartmentRelated tab = EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, dto); TabHaobanStaffDepartmentRelated tab = EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, dto);
...@@ -187,13 +180,13 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -187,13 +180,13 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
String wxUserId = staffDTO.getWxUserId(); String wxUserId = staffDTO.getWxUserId();
String corpId = tabHaobanWxEnterprise.getCorpid(); String corpId = tabHaobanWxEnterprise.getCorpid();
String name = staffDTO.getStaffName(); String name = staffDTO.getStaffName();
if(content.length()>30){ if (content.length() > 30) {
content = content.substring(0, 26); content = content.substring(0, 26);
content = content+"..."; content = content + "...";
} }
//先发送下,试试 //先发送下,试试
QywxXcxSendMessageDTO messageDTO = new QywxXcxSendMessageDTO(); QywxXcxSendMessageDTO messageDTO = new QywxXcxSendMessageDTO();
List<ItemDTO> items = new ArrayList();; List<ItemDTO> items = new ArrayList();
ItemDTO dto1 = new ItemDTO(); ItemDTO dto1 = new ItemDTO();
ItemDTO dto2 = new ItemDTO(); ItemDTO dto2 = new ItemDTO();
ItemDTO dto3 = new ItemDTO(); ItemDTO dto3 = new ItemDTO();
...@@ -269,17 +262,18 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -269,17 +262,18 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
} }
//导购删除,,审核记录,,消息发送 //导购删除,,审核记录,,消息发送
public void sendClerkDel (String clerkName,String clerkCode,String storeId,int auditStatus,String auditReason){ @Override
//TODO huang 发送店长,门店关联记录列表 public void sendClerkDel(String clerkName, String clerkCode, String storeId, int auditStatus, String auditReason) {
String messageTitle = "门店导购变更"; //TODO huang 发送店长,门店关联记录列表
String messageContent ="删除导购:"+ clerkName+"("+clerkCode+")"; String messageTitle = "门店导购变更";
String messageContent = "删除导购:" + clerkName + "(" + clerkCode + ")";
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("storeId", storeId); jsonObject.put("storeId", storeId);
String data = jsonObject.toJSONString(); String data = jsonObject.toJSONString();
ClerkDTO gicClerk = clerkService.getClerkLeaderByStoreId(storeId); ClerkDTO gicClerk = clerkService.getClerkLeaderByStoreId(storeId);
if(gicClerk == null){ if (gicClerk == null) {
logger.info("店长不存在,发送消息失败{}",storeId); logger.info("店长不存在,发送消息失败{}", storeId);
return ; return;
} }
TabHaobanStaffClerkRelation tab = tabHaobanStaffClerkRelationMapper.getOneByClerkId(gicClerk.getClerkId()); TabHaobanStaffClerkRelation tab = tabHaobanStaffClerkRelationMapper.getOneByClerkId(gicClerk.getClerkId());
if(tab == null){ if(tab == null){
...@@ -301,17 +295,17 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -301,17 +295,17 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
String corpId = map.get("corpId"); String corpId = map.get("corpId");
String name = map.get("clerkName"); String name = map.get("clerkName");
if(jodd.util.StringUtil.isEmpty(wxUserId)){ if (jodd.util.StringUtil.isEmpty(wxUserId)) {
logger.info("wxUserId不存在============clerkId={}",clerkId); logger.info("wxUserId不存在============clerkId={}", clerkId);
return false; return false;
} }
if(content.length()>30){ if (content.length() > 30) {
content = content.substring(0, 26); content = content.substring(0, 26);
content = content+"..."; content = content + "...";
} }
//先发送下,试试 //先发送下,试试
QywxXcxSendMessageDTO messageDTO = new QywxXcxSendMessageDTO(); QywxXcxSendMessageDTO messageDTO = new QywxXcxSendMessageDTO();
List<ItemDTO> items = new ArrayList();; List<ItemDTO> items = new ArrayList();
ItemDTO dto1 = new ItemDTO(); ItemDTO dto1 = new ItemDTO();
ItemDTO dto2 = new ItemDTO(); ItemDTO dto2 = new ItemDTO();
dto1.setKey("接收人"); dto1.setKey("接收人");
...@@ -320,8 +314,8 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -320,8 +314,8 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
dto2.setValue(content); dto2.setValue(content);
items.add(dto1); items.add(dto1);
items.add(dto2); items.add(dto2);
ArrayList<String> list = new ArrayList<>(); ArrayList<String> list = new ArrayList<>();
list.add(wxUserId); list.add(wxUserId);
messageDTO.setAppid(config.getAppid()); messageDTO.setAppid(config.getAppid());
messageDTO.setUserIds(list); messageDTO.setUserIds(list);
messageDTO.setPage(pageUrl); messageDTO.setPage(pageUrl);
...@@ -391,22 +385,22 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -391,22 +385,22 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
@Override @Override
public boolean sendAuditMessage(String staffId, String title, public boolean sendAuditMessage(String staffId, String title,
String content, String pageUrl,int auditStatus, String auditReason) { String content, String pageUrl,int auditStatus, String auditReason) {
Map<String,String> map = getWxUserIdByStaffId(staffId); Map<String, String> map = getWxUserIdByStaffId(staffId);
String wxUserId = map.get("wxUserId"); String wxUserId = map.get("wxUserId");
String corpId = map.get("corpId"); String corpId = map.get("corpId");
String name = map.get("staffName"); String name = map.get("staffName");
if(jodd.util.StringUtil.isEmpty(wxUserId)){ if (StringUtils.isEmpty(wxUserId)) {
logger.info("wxUserId不存在============clerkId={}",staffId); logger.info("wxUserId不存在============clerkId={}", staffId);
return false; return false;
} }
if(content.length()>30){ if (content.length() > 30) {
content = content.substring(0, 26); content = content.substring(0, 26);
content = content+"..."; content = content + "...";
} }
//先发送下,试试 //先发送下,试试
QywxXcxSendMessageDTO messageDTO = new QywxXcxSendMessageDTO(); QywxXcxSendMessageDTO messageDTO = new QywxXcxSendMessageDTO();
List<ItemDTO> items = new ArrayList();; List<ItemDTO> items = new ArrayList();
ItemDTO dto1 = new ItemDTO(); ItemDTO dto1 = new ItemDTO();
ItemDTO dto2 = new ItemDTO(); ItemDTO dto2 = new ItemDTO();
ItemDTO dto3 = new ItemDTO(); ItemDTO dto3 = new ItemDTO();
...@@ -440,6 +434,7 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -440,6 +434,7 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
logger.info("发送===============》{}",b); logger.info("发送===============》{}",b);
return b; return b;
} }
@Override @Override
public String getPageUrl(int type, String data) { public String getPageUrl(int type, String data) {
String baseUrl = "/pages/route/index"; String baseUrl = "/pages/route/index";
......
...@@ -215,7 +215,7 @@ ...@@ -215,7 +215,7 @@
</if> </if>
order by create_time desc order by create_time desc
</select> </select>
<select id="StaffClerkUnBindLog" resultMap="BaseResultMap"> <select id="staffClerkUnBindLog" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from tab_haoban_staff_clerk_bind_log from tab_haoban_staff_clerk_bind_log
......
...@@ -437,7 +437,11 @@ ...@@ -437,7 +437,11 @@
and audit_type = 3 and audit_type = 3
and audit_status = 0 and audit_status = 0
and enterprise_id = #{enterpriseId,jdbcType=VARCHAR} and enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
and (related_Id = #{clerkCode} or old_value like concat ('%',#{phoneNumber},'%')) and (related_Id = #{clerkCode}
<if test="phoneNumber != null and phoneNumber != ''">
or old_value like concat ('%',#{phoneNumber},'%')
</if>
)
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -573,4 +573,15 @@ ...@@ -573,4 +573,15 @@
and status_flag = 1 and status_flag = 1
and external_user_id = #{externalUserId} and external_user_id = #{externalUserId}
</select> </select>
<update id="updateMemberIdByMemberId">
UPDATE
tab_haoban_external_clerk_related
SET
member_id=#{memberId},
update_time = now()
where
member_id = #{oldMemberId}
and status_flag = 1
</update>
</mapper> </mapper>
\ No newline at end of file
import com.gic.haoban.common.utils.UuidUtil; import com.gic.haoban.common.utils.UuidUtil;
import com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanOperationSettingMapper; import com.gic.haoban.manage.service.dao.mapper.TabHaobanOperationSettingMapper;
import com.gic.haoban.manage.service.entity.TabHaobanOperationSetting; import com.gic.haoban.manage.service.entity.TabHaobanOperationSetting;
import com.gic.haoban.manage.service.service.ExternalClerkRelatedService;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -22,14 +24,13 @@ public class TestOperDatabase { ...@@ -22,14 +24,13 @@ public class TestOperDatabase {
@Autowired @Autowired
private TabHaobanOperationSettingMapper tabHaobanOperationSettingMapper; private TabHaobanOperationSettingMapper tabHaobanOperationSettingMapper;
@Autowired
private ExternalClerkRelatedService externalClerkRelatedService;
@Test @Test
public void testOperSetting() { public void testOperSetting() {
TabHaobanOperationSetting setting = new TabHaobanOperationSetting(); String s = externalClerkRelatedService.checkAndUpdateMemberByUnonId("ff8080815dacd3a2015dacd3ef5c0000", "ff8080817b95cd7e017b95f2c0ec009d", "orXl9t9_320bmRutZoL8YEpPAc00");
setting.setClerkPhoneFlag(1); System.out.println(s);
setting.setCreateTime(new Date());
setting.setSettingId(UuidUtil.randomUUID());
setting.setWxEnterpriseId("123123");
tabHaobanOperationSettingMapper.insert(setting);
} }
} }
...@@ -6,17 +6,14 @@ ...@@ -6,17 +6,14 @@
<groupId>com.gic</groupId> <groupId>com.gic</groupId>
<artifactId>gic-pom-base</artifactId> <artifactId>gic-pom-base</artifactId>
<version>3.0-SNAPSHOT</version> <version>3.0-SNAPSHOT</version>
<relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>haoban-manage3-web</artifactId> <artifactId>haoban-manage3-web</artifactId>
<version>${libraryVersion}</version> <version>${libraryVersion}</version>
<packaging>war</packaging> <packaging>war</packaging>
<name>haoban-manage3-web Maven Webapp</name> <name>haoban-manage3-web Maven Webapp</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<haobanService>1.0-SNAPSHOT</haobanService> <haobanService>1.0-SNAPSHOT</haobanService>
......
package com.gic.haoban.manage.web.controller; package com.gic.haoban.manage.web.controller;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.gic.cloud.common.api.base.Page; import com.gic.cloud.common.api.base.Page;
import com.gic.cloud.data.api.dto.AdsGicLogHaobanStoreIntervalLoginDDTO; import com.gic.cloud.data.api.dto.*;
import com.gic.cloud.data.api.dto.AdsGicLogHaobanStoreLoginDDTO;
import com.gic.cloud.data.api.dto.AreaLoginDTO;
import com.gic.cloud.data.api.dto.HaobanClerkLoginDTO;
import com.gic.cloud.data.api.dto.HaobanLoginInfoDTO;
import com.gic.cloud.data.api.dto.MemberAnalyzeParamsDTO;
import com.gic.cloud.data.api.service.MaidianDataService; import com.gic.cloud.data.api.service.MaidianDataService;
import com.gic.cloud.web.service.api.dto.CloudStoreGroupDTO; import com.gic.cloud.web.service.api.dto.CloudStoreGroupDTO;
import com.gic.cloud.web.service.api.service.CloudStoreGroupService; import com.gic.cloud.web.service.api.service.CloudStoreGroupService;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.ExcelUtils; import com.gic.haoban.common.utils.ExcelUtils;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.*;
@RestController @RestController
@RequestMapping("web") @RequestMapping("web")
public class MaidianDataController extends WebBaseController{ public class MaidianDataController extends WebBaseController {
private static Logger logger = LoggerFactory.getLogger(MaidianDataController.class); private static final Logger logger = LoggerFactory.getLogger(MaidianDataController.class);
@Autowired @Autowired
private MaidianDataService maidianDataService; private MaidianDataService maidianDataService;
@Autowired @Autowired
private CloudStoreGroupService cloudStoreGroupService; private CloudStoreGroupService cloudStoreGroupService;
@Autowired
private WxEnterpriseRelatedApiService wxEnterpriseRelatedApiService; //首页-分组列表
//首页-分组列表
@RequestMapping("/use-haoban3-service") @RequestMapping("/use-haoban3-service")
public HaobanResponse useHaoban3Service(String wxEnterpriseId) { public HaobanResponse useHaoban3Service(String wxEnterpriseId) {
Object o = RedisUtil.getCache("usesMaidianWxEnterpriseId"); Object o = RedisUtil.getCache("usesMaidianWxEnterpriseId");
boolean b = false; boolean b = false;
if(o == null){ if (o != null) {
}else { String wxEnterpriseIds = o.toString();
String wxEnterpriseIds = o.toString(); if (wxEnterpriseIds.contains(wxEnterpriseId) || "-1".equals(wxEnterpriseIds)) {
if(wxEnterpriseIds.contains(wxEnterpriseId)||"-1".equals(wxEnterpriseIds)){ b = true;
b = true; }
} }
} return resultResponse(HaoBanErrCode.ERR_1, b);
return resultResponse(HaoBanErrCode.ERR_1,b);
} }
//首页-分组列表
//首页-分组列表
@RequestMapping("/cloud-grouplist-pid") @RequestMapping("/cloud-grouplist-pid")
public HaobanResponse cloudGrouplistPid(String enterpriseId) { public HaobanResponse cloudGrouplistPid(String enterpriseId) {
Map<String, Object> returnMap = new HashMap<String, Object>(); Map<String, Object> returnMap = new HashMap<String, Object>();
List<CloudStoreGroupDTO> list = cloudStoreGroupService.queryAllStoreGroupByStoreGroupId(enterpriseId); List<CloudStoreGroupDTO> list = cloudStoreGroupService.queryAllStoreGroupByStoreGroupId(enterpriseId);
if(CollectionUtil.isEmpty(list)){ if (CollectionUtil.isEmpty(list)) {
list = new ArrayList<>(); list = new ArrayList<>();
} }
returnMap.put("list", list); returnMap.put("list", list);
return resultResponse(HaoBanErrCode.ERR_1,returnMap); return resultResponse(HaoBanErrCode.ERR_1, returnMap);
} }
//首页-企业概况
//首页-企业概况
@RequestMapping("/total-activation-data") @RequestMapping("/total-activation-data")
public HaobanResponse totalActivationData(MemberAnalyzeParamsDTO paramsDTO) { public HaobanResponse totalActivationData(MemberAnalyzeParamsDTO paramsDTO) {
paramsDTO.setWebFlag(1); paramsDTO.setWebFlag(1);
Map<String, Object> returnMap = new HashMap<String, Object>(); Map<String, Object> returnMap = new HashMap<String, Object>();
AdsGicLogHaobanStoreLoginDDTO dto = maidianDataService.totalActivationData(paramsDTO); AdsGicLogHaobanStoreLoginDDTO dto = maidianDataService.totalActivationData(paramsDTO);
if(dto == null){ if (dto == null) {
return resultResponse(HaoBanErrCode.ERR_1,returnMap); return resultResponse(HaoBanErrCode.ERR_1, returnMap);
} }
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
paramsDTO.setStartDate(sdf.format(new Date())); paramsDTO.setStartDate(sdf.format(new Date()));
AdsGicLogHaobanStoreLoginDDTO today = maidianDataService.totalActivationData(paramsDTO); AdsGicLogHaobanStoreLoginDDTO today = maidianDataService.totalActivationData(paramsDTO);
if(today == null){ if (today == null) {
today = new AdsGicLogHaobanStoreLoginDDTO(); today = new AdsGicLogHaobanStoreLoginDDTO();
} }
returnMap.put("loginClerkCnt", dto.getLoginClerkCnt()) ; returnMap.put("loginClerkCnt", dto.getLoginClerkCnt());
returnMap.put("activeClerkCnt", dto.getActiveClerkCnt()) ; returnMap.put("activeClerkCnt", dto.getActiveClerkCnt());
returnMap.put("loginClerkTimes", dto.getLoginClerkTimes()) ; returnMap.put("loginClerkTimes", dto.getLoginClerkTimes());
returnMap.put("notActiveClerkCnt", dto.getNotActiveClerkCnt()) ; returnMap.put("notActiveClerkCnt", dto.getNotActiveClerkCnt());
returnMap.put("totalClerkCnt", dto.getTotalClerkCnt()) ; returnMap.put("totalClerkCnt", dto.getTotalClerkCnt());
returnMap.put("notLoginClerkCnt", dto.getNotLoginClerkCnt()) ; returnMap.put("notLoginClerkCnt", dto.getNotLoginClerkCnt());
if(dto.getLoginClerkCnt() == null||dto.getLoginClerkCnt()==0){ if (dto.getLoginClerkCnt() == null || dto.getLoginClerkCnt() == 0) {
returnMap.put("avgLoginTimes",0) ; returnMap.put("avgLoginTimes", 0);
returnMap.put("avgVisitTime", 0) ; returnMap.put("avgVisitTime", 0);
}else { } else {
returnMap.put("avgLoginTimes", dto.getLoginClerkTimes()/dto.getLoginClerkCnt()) ; returnMap.put("avgLoginTimes", dto.getLoginClerkTimes() / dto.getLoginClerkCnt());
returnMap.put("avgVisitTime", dto.getStayTime()/dto.getLoginClerkCnt()) ; returnMap.put("avgVisitTime", dto.getStayTime() / dto.getLoginClerkCnt());
} }
returnMap.put("toDayLoginClerkCnt", today.getLoginClerkCnt()) ; returnMap.put("toDayLoginClerkCnt", today.getLoginClerkCnt());
return resultResponse(HaoBanErrCode.ERR_1,returnMap); return resultResponse(HaoBanErrCode.ERR_1, returnMap);
} }
//首页-好办登陆信息总人数概况 //首页-好办登陆信息总人数概况
@RequestMapping("/total-login-data") @RequestMapping("/total-login-data")
public HaobanResponse totalLoginData(MemberAnalyzeParamsDTO paramsDTO,int datesType) { public HaobanResponse totalLoginData(MemberAnalyzeParamsDTO paramsDTO, int datesType) {
paramsDTO.setWebFlag(1); paramsDTO.setWebFlag(1);
Map<String, Object> returnMap = new HashMap<String, Object>(); Map<String, Object> returnMap = new HashMap<String, Object>();
List<HaobanLoginInfoDTO> resultList = new ArrayList<HaobanLoginInfoDTO>(); List<HaobanLoginInfoDTO> resultList = new ArrayList<HaobanLoginInfoDTO>();
if(datesType == 1){ if (datesType == 1) {
//近7日 //近7日
List<AdsGicLogHaobanStoreLoginDDTO> list = maidianDataService.totalLoginData(paramsDTO); List<AdsGicLogHaobanStoreLoginDDTO> list = maidianDataService.totalLoginData(paramsDTO);
resultList = EntityUtil.changeEntityListByJSON(HaobanLoginInfoDTO.class, list); resultList = EntityUtil.changeEntityListByJSON(HaobanLoginInfoDTO.class, list);
}else { } else {
//当日 //当日
List<AdsGicLogHaobanStoreIntervalLoginDDTO> list = maidianDataService.totalLoginInternalData(paramsDTO); List<AdsGicLogHaobanStoreIntervalLoginDDTO> list = maidianDataService.totalLoginInternalData(paramsDTO);
resultList = EntityUtil.changeEntityListByJSON(HaobanLoginInfoDTO.class, list); resultList = EntityUtil.changeEntityListByJSON(HaobanLoginInfoDTO.class, list);
} }
for(HaobanLoginInfoDTO dto : resultList){ for (HaobanLoginInfoDTO dto : resultList) {
if(dto.getLoginClerkCnt() == 0){ if (dto.getLoginClerkCnt() == 0) {
dto.setAvgVisitTime("0"); dto.setAvgVisitTime("0");
dto.setAvgLoginTimes("0"); dto.setAvgLoginTimes("0");
}else{ } else {
dto.setAvgVisitTime((double)dto.getStayTime()/dto.getLoginClerkCnt()+""); dto.setAvgVisitTime((double) dto.getStayTime() / dto.getLoginClerkCnt() + "");
dto.setAvgLoginTimes(dto.getLoginClerkTimes()/dto.getLoginClerkCnt()+""); dto.setAvgLoginTimes(dto.getLoginClerkTimes() / dto.getLoginClerkCnt() + "");
} }
} }
if(CollectionUtil.isEmpty(resultList)){ if (CollectionUtil.isEmpty(resultList)) {
resultList = new ArrayList<>(); resultList = new ArrayList<>();
} }
returnMap.put("result", resultList) ; returnMap.put("result", resultList);
return resultResponse(HaoBanErrCode.ERR_1,returnMap); return resultResponse(HaoBanErrCode.ERR_1, returnMap);
} }
//首页-区域排行 //首页-区域排行
@RequestMapping("/area-login-ranking") @RequestMapping("/area-login-ranking")
public HaobanResponse areaLoginRanking(MemberAnalyzeParamsDTO paramsDTO) { public HaobanResponse areaLoginRanking(MemberAnalyzeParamsDTO paramsDTO) {
paramsDTO.setWebFlag(1); paramsDTO.setWebFlag(1);
Map<String, Object> returnMap = new HashMap<String, Object>(); Map<String, Object> returnMap = new HashMap<String, Object>();
List<AreaLoginDTO> list = maidianDataService.areaLoginRanking(paramsDTO); List<AreaLoginDTO> list = maidianDataService.areaLoginRanking(paramsDTO);
if(CollectionUtil.isEmpty(list)){ if (CollectionUtil.isEmpty(list)) {
list = new ArrayList<>(); list = new ArrayList<>();
} }
returnMap.put("result", list) ; returnMap.put("result", list);
return resultResponse(HaoBanErrCode.ERR_1,returnMap); return resultResponse(HaoBanErrCode.ERR_1, returnMap);
} }
//激活明细-激活趋势图 //激活明细-激活趋势图
@RequestMapping("/activite-date") @RequestMapping("/activite-date")
public HaobanResponse activiteDate(MemberAnalyzeParamsDTO paramsDTO) { public HaobanResponse activiteDate(MemberAnalyzeParamsDTO paramsDTO) {
paramsDTO.setWebFlag(1); paramsDTO.setWebFlag(1);
Map<String, Object> returnMap = new HashMap<String, Object>(); Map<String, Object> returnMap = new HashMap<String, Object>();
List<HaobanLoginInfoDTO> resultList = new ArrayList<HaobanLoginInfoDTO>(); List<HaobanLoginInfoDTO> resultList = new ArrayList<HaobanLoginInfoDTO>();
//近7日 //近7日
List<AdsGicLogHaobanStoreLoginDDTO> list = maidianDataService.totalLoginData(paramsDTO); List<AdsGicLogHaobanStoreLoginDDTO> list = maidianDataService.totalLoginData(paramsDTO);
resultList = EntityUtil.changeEntityListByJSON(HaobanLoginInfoDTO.class, list); resultList = EntityUtil.changeEntityListByJSON(HaobanLoginInfoDTO.class, list);
if(CollectionUtil.isEmpty(resultList)){ if (CollectionUtil.isEmpty(resultList)) {
resultList = new ArrayList<>(); resultList = new ArrayList<>();
} }
returnMap.put("result", resultList) ; returnMap.put("result", resultList);
return resultResponse(HaoBanErrCode.ERR_1,returnMap); return resultResponse(HaoBanErrCode.ERR_1, returnMap);
} }
//激活明细-激活列表 //激活明细-激活列表
@RequestMapping("/activite-list") @RequestMapping("/activite-list")
public HaobanResponse activiteList(MemberAnalyzeParamsDTO paramsDTO) { public HaobanResponse activiteList(MemberAnalyzeParamsDTO paramsDTO) {
paramsDTO.setWebFlag(1); paramsDTO.setWebFlag(1);
Page<HaobanClerkLoginDTO> page= maidianDataService.pageActiviteList(paramsDTO); Page<HaobanClerkLoginDTO> page = maidianDataService.pageActiviteList(paramsDTO);
return resultResponse(HaoBanErrCode.ERR_1,page); return resultResponse(HaoBanErrCode.ERR_1, page);
} }
//导出-激活明细-激活列表 //导出-激活明细-激活列表
@RequestMapping("/export-activite-list") @RequestMapping("/export-activite-list")
public HaobanResponse exportActiviteList(HttpServletRequest request,HttpServletResponse response,MemberAnalyzeParamsDTO paramsDTO) { public HaobanResponse exportActiviteList(HttpServletRequest request, HttpServletResponse response, MemberAnalyzeParamsDTO paramsDTO) {
paramsDTO.setWebFlag(1); paramsDTO.setWebFlag(1);
paramsDTO.setCurrentPage(1); paramsDTO.setCurrentPage(1);
paramsDTO.setPageSize(Integer.MAX_VALUE); paramsDTO.setPageSize(Integer.MAX_VALUE);
Page<HaobanClerkLoginDTO> page= maidianDataService.pageActiviteList(paramsDTO); Page<HaobanClerkLoginDTO> page = maidianDataService.pageActiviteList(paramsDTO);
List<String> titleList = Arrays.asList( "导购姓名","导购代码","归属门店","最后登录时间","活跃状态"); List<String> titleList = Arrays.asList("导购姓名", "导购代码", "归属门店", "最后登录时间", "活跃状态");
List<String> fileList = Arrays.asList("clerkName", "clerkCode", "storeName", "lastLoginTime", "activationStatus"); List<String> fileList = Arrays.asList("clerkName", "clerkCode", "storeName", "lastLoginTime", "activationStatus");
try { try {
ExcelUtils.xls(response, request, "详情报表", page.getList(), fileList, titleList); ExcelUtils.xls(response, request, "详情报表", page.getList(), fileList, titleList);
} catch (Exception e) { } catch (Exception e) {
logger.info(e.getMessage(),e); logger.info(e.getMessage(), e);
} }
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
//导出-登陆明细-明细列表 //导出-登陆明细-明细列表
@RequestMapping("/export-login-detail-list") @RequestMapping("/export-login-detail-list")
public HaobanResponse exportLoginDetailList(HttpServletRequest request,HttpServletResponse response,MemberAnalyzeParamsDTO paramsDTO) { public HaobanResponse exportLoginDetailList(HttpServletRequest request, HttpServletResponse response, MemberAnalyzeParamsDTO paramsDTO) {
paramsDTO.setWebFlag(1); paramsDTO.setWebFlag(1);
//默认排序 //默认排序
if(StringUtils.isEmpty(paramsDTO.getSortColumn())) { if (StringUtils.isEmpty(paramsDTO.getSortColumn())) {
paramsDTO.setSortColumn("lastLoginTime"); paramsDTO.setSortColumn("lastLoginTime");
} }
if(StringUtils.isEmpty(paramsDTO.getSortType())) { if (StringUtils.isEmpty(paramsDTO.getSortType())) {
paramsDTO.setSortType("desc"); paramsDTO.setSortType("desc");
} }
paramsDTO.setCurrentPage(1); paramsDTO.setCurrentPage(1);
paramsDTO.setPageSize(Integer.MAX_VALUE); paramsDTO.setPageSize(Integer.MAX_VALUE);
Map<String, Object> returnMap = new HashMap<String, Object>(); Map<String, Object> returnMap = new HashMap<String, Object>();
Page<HaobanClerkLoginDTO> page= maidianDataService.pageClerkLogin(paramsDTO); Page<HaobanClerkLoginDTO> page = maidianDataService.pageClerkLogin(paramsDTO);
if(paramsDTO.getLoginStatus() == 1){ if (paramsDTO.getLoginStatus() == 1) {
//已登陆 //已登陆
try { try {
List<String> titleList = Arrays.asList( "导购姓名","导购代码","归属门店","最后登录时间","登录次数","平均访问总时长"); List<String> titleList = Arrays.asList("导购姓名", "导购代码", "归属门店", "最后登录时间", "登录次数", "平均访问总时长");
List<String> fileList = Arrays.asList("clerkName", "clerkCode", "storeName", "lastLoginTime", "loginTimes", "avgVisitTimeString"); List<String> fileList = Arrays.asList("clerkName", "clerkCode", "storeName", "lastLoginTime", "loginTimes", "avgVisitTimeString");
ExcelUtils.xls(response, request, "详情报表", page.getList(), fileList, titleList); ExcelUtils.xls(response, request, "详情报表", page.getList(), fileList, titleList);
} catch (Exception e) { } catch (Exception e) {
logger.info(e.getMessage(),e); logger.info(e.getMessage(), e);
} }
}else{ } else {
//未登陆 //未登陆
try { try {
List<String> titleList = Arrays.asList( "导购姓名","导购代码","归属门店","最后登录时间"); List<String> titleList = Arrays.asList("导购姓名", "导购代码", "归属门店", "最后登录时间");
List<String> fileList = Arrays.asList("clerkName", "clerkCode", "storeName", "lastLoginTime"); List<String> fileList = Arrays.asList("clerkName", "clerkCode", "storeName", "lastLoginTime");
ExcelUtils.xls(response, request, "详情报表", page.getList(), fileList, titleList); ExcelUtils.xls(response, request, "详情报表", page.getList(), fileList, titleList);
} catch (Exception e) { } catch (Exception e) {
logger.info(e.getMessage(),e); logger.info(e.getMessage(), e);
} }
} }
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
//登陆明细-明细列表 //登陆明细-明细列表
@RequestMapping("/login-detail-list") @RequestMapping("/login-detail-list")
public HaobanResponse loginDetailList(MemberAnalyzeParamsDTO paramsDTO) { public HaobanResponse loginDetailList(MemberAnalyzeParamsDTO paramsDTO) {
paramsDTO.setWebFlag(1); paramsDTO.setWebFlag(1);
//默认排序 //默认排序
if(StringUtils.isEmpty(paramsDTO.getSortColumn())) { if (StringUtils.isEmpty(paramsDTO.getSortColumn())) {
paramsDTO.setSortColumn("lastLoginTime"); paramsDTO.setSortColumn("lastLoginTime");
} }
if(StringUtils.isEmpty(paramsDTO.getSortType())) { if (StringUtils.isEmpty(paramsDTO.getSortType())) {
paramsDTO.setSortType("desc"); paramsDTO.setSortType("desc");
} }
Map<String, Object> returnMap = new HashMap<String, Object>(); Map<String, Object> returnMap = new HashMap<String, Object>();
Page<HaobanClerkLoginDTO> page= maidianDataService.pageClerkLogin(paramsDTO); Page<HaobanClerkLoginDTO> page = maidianDataService.pageClerkLogin(paramsDTO);
returnMap.put("result", page) ; returnMap.put("result", page);
return resultResponse(HaoBanErrCode.ERR_1,returnMap); return resultResponse(HaoBanErrCode.ERR_1, returnMap);
} }
//区域排行-区域图表 //区域排行-区域图表
@RequestMapping("area-ranking-date") @RequestMapping("area-ranking-date")
public HaobanResponse areaRankingDate(MemberAnalyzeParamsDTO paramsDTO) { public HaobanResponse areaRankingDate(MemberAnalyzeParamsDTO paramsDTO) {
paramsDTO.setWebFlag(1); paramsDTO.setWebFlag(1);
Map<String, Object> returnMap = new HashMap<String, Object>(); Map<String, Object> returnMap = new HashMap<String, Object>();
List<AreaLoginDTO> list = maidianDataService.areaRankingDate(paramsDTO); List<AreaLoginDTO> list = maidianDataService.areaRankingDate(paramsDTO);
returnMap.put("result", list) ; returnMap.put("result", list);
return resultResponse(HaoBanErrCode.ERR_1,returnMap); return resultResponse(HaoBanErrCode.ERR_1, returnMap);
} }
//区域排行-区域列表 //区域排行-区域列表
@RequestMapping("/area-ranking-list") @RequestMapping("/area-ranking-list")
public HaobanResponse areaRankingList(MemberAnalyzeParamsDTO paramsDTO) { public HaobanResponse areaRankingList(MemberAnalyzeParamsDTO paramsDTO) {
paramsDTO.setWebFlag(1); paramsDTO.setWebFlag(1);
//默认排序 //默认排序
if(StringUtils.isEmpty(paramsDTO.getSortColumn())) { if (StringUtils.isEmpty(paramsDTO.getSortColumn())) {
paramsDTO.setSortColumn("loginRate"); paramsDTO.setSortColumn("loginRate");
} }
if(StringUtils.isEmpty(paramsDTO.getSortType())) { if (StringUtils.isEmpty(paramsDTO.getSortType())) {
paramsDTO.setSortType("desc"); paramsDTO.setSortType("desc");
} }
paramsDTO.setAreaType("store"); paramsDTO.setAreaType("store");
Map<String, Object> returnMap = new HashMap<String, Object>(); Map<String, Object> returnMap = new HashMap<String, Object>();
Page<AreaLoginDTO> page = maidianDataService.areaRankingList(paramsDTO); Page<AreaLoginDTO> page = maidianDataService.areaRankingList(paramsDTO);
returnMap.put("result", page) ; returnMap.put("result", page);
return resultResponse(HaoBanErrCode.ERR_1,returnMap); return resultResponse(HaoBanErrCode.ERR_1, returnMap);
} }
//导出-区域排行-区域列表 //导出-区域排行-区域列表
@RequestMapping("/export-area-ranking-list") @RequestMapping("/export-area-ranking-list")
public HaobanResponse exportAreaRankingList(HttpServletRequest request,HttpServletResponse response,MemberAnalyzeParamsDTO paramsDTO) { public HaobanResponse exportAreaRankingList(HttpServletRequest request, HttpServletResponse response, MemberAnalyzeParamsDTO paramsDTO) {
paramsDTO.setWebFlag(1); paramsDTO.setWebFlag(1);
//默认排序 //默认排序
if(StringUtils.isEmpty(paramsDTO.getSortColumn())) { if (StringUtils.isEmpty(paramsDTO.getSortColumn())) {
paramsDTO.setSortColumn("loginRate"); paramsDTO.setSortColumn("loginRate");
} }
if(StringUtils.isEmpty(paramsDTO.getSortType())) { if (StringUtils.isEmpty(paramsDTO.getSortType())) {
paramsDTO.setSortType("desc"); paramsDTO.setSortType("desc");
} }
paramsDTO.setAreaType("store"); paramsDTO.setAreaType("store");
paramsDTO.setCurrentPage(1); paramsDTO.setCurrentPage(1);
paramsDTO.setPageSize(Integer.MAX_VALUE); paramsDTO.setPageSize(Integer.MAX_VALUE);
Page<AreaLoginDTO> page = maidianDataService.areaRankingList(paramsDTO); Page<AreaLoginDTO> page = maidianDataService.areaRankingList(paramsDTO);
List<String> titleList = Arrays.asList( "门店名称","门店code","分组名称","登录率","登录人数"); List<String> titleList = Arrays.asList("门店名称", "门店code", "分组名称", "登录率", "登录人数");
List<String> fileList = Arrays.asList("exportName", "storeCode", "storeGroupName", "loginRateString", "loginClerkCnt"); List<String> fileList = Arrays.asList("exportName", "storeCode", "storeGroupName", "loginRateString", "loginClerkCnt");
try { try {
ExcelUtils.xls(response, request, "详情报表", page.getList(), fileList, titleList); ExcelUtils.xls(response, request, "详情报表", page.getList(), fileList, titleList);
} catch (Exception e) { } catch (Exception e) {
logger.info(e.getMessage(),e); logger.info(e.getMessage(), e);
} }
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
} }
...@@ -5,6 +5,7 @@ import com.gic.haoban.manage.api.dto.OperationSettingDTO; ...@@ -5,6 +5,7 @@ import com.gic.haoban.manage.api.dto.OperationSettingDTO;
import com.gic.haoban.manage.api.service.OperationSettingApiService; import com.gic.haoban.manage.api.service.OperationSettingApiService;
import com.gic.haoban.manage.web.anno.HttpLimit; import com.gic.haoban.manage.web.anno.HttpLimit;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -30,7 +31,7 @@ public class SettingController extends WebBaseController { ...@@ -30,7 +31,7 @@ public class SettingController extends WebBaseController {
private HaobanResponse operationSettingSaveOrUpdate(OperationSettingDTO dto) { private HaobanResponse operationSettingSaveOrUpdate(OperationSettingDTO dto) {
// 保存或更新操作设置 // 保存或更新操作设置
if (Objects.isNull(dto) if (Objects.isNull(dto)
|| Objects.isNull(dto.getWxEnterpriseId())) { || StringUtils.isEmpty(dto.getWxEnterpriseId())) {
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
} }
operationSettingApiService.saveOrUpdate(dto); operationSettingApiService.saveOrUpdate(dto);
......
...@@ -9,25 +9,21 @@ import com.gic.clerk.api.service.ClerkNewService; ...@@ -9,25 +9,21 @@ import com.gic.clerk.api.service.ClerkNewService;
import com.gic.clerk.api.service.ClerkService; import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.DateUtil; import com.gic.commons.util.DateUtil;
import com.gic.commons.util.ExcelUtils; import com.gic.commons.util.ExcelUtils;
import com.gic.enterprise.api.dto.*; import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.service.*;
import com.gic.enterprise.api.service.EnterpriseService; import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.PageResult; import com.gic.haoban.base.api.common.PageResult;
import com.gic.haoban.base.api.common.ServiceResponse; import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.common.utils.EntityUtil; import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.*; import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.enums.BindTypeEnum;
import com.gic.haoban.manage.api.enums.ChannelCodeEnum; import com.gic.haoban.manage.api.enums.ChannelCodeEnum;
import com.gic.haoban.manage.api.service.*; import com.gic.haoban.manage.api.service.*;
import com.gic.haoban.manage.web.auth.AuthRequestUtil; import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.StaffEditJsonQO; import com.gic.haoban.manage.web.qo.StaffEditJsonQO;
import com.gic.haoban.manage.web.vo.ClerkInfoVo; import com.gic.haoban.manage.web.vo.ClerkInfoVo;
import com.gic.haoban.manage.web.vo.StaffExportVO; import com.gic.haoban.manage.web.vo.StaffExportVO;
import com.gic.haoban.manage.web.vo.StaffVO; import com.gic.haoban.manage.web.vo.StaffVO;
import com.gic.wechat.api.service.qywx.QywxUserApiService; import com.gic.wechat.api.service.qywx.QywxUserApiService;
...@@ -40,563 +36,521 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -40,563 +36,521 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.stream.Collectors;
@RestController @RestController
public class StaffController extends WebBaseController{ public class StaffController extends WebBaseController {
private static Logger logger = LoggerFactory.getLogger(StaffController.class); private static final Logger logger = LoggerFactory.getLogger(StaffController.class);
@Autowired @Autowired
private StaffApiService staffApiService; private StaffApiService staffApiService;
@Autowired @Autowired
private DepartmentApiService departmentApiService; private DepartmentApiService departmentApiService;
@Autowired @Autowired
private StaffDepartmentRelatedApiService staffDepartmentRelatedApiService; private StaffDepartmentRelatedApiService staffDepartmentRelatedApiService;
@Autowired @Autowired
private QywxUserApiService qywxUserApiService; private QywxUserApiService qywxUserApiService;
@Autowired @Autowired
private WxEnterpriseApiService wxEnterpriseApiService; private WxEnterpriseApiService wxEnterpriseApiService;
@Autowired @Autowired
private WxApplicationApiService wxApplicationApiService; private WxApplicationApiService wxApplicationApiService;
@Autowired @Autowired
private ClerkService clerkService; private ClerkService clerkService;
@Autowired @Autowired
private ClerkNewService clerkNewService; private ClerkNewService clerkNewService;
@Autowired @Autowired
private StoreService storeService; private StoreService storeService;
@Autowired @Autowired
private StaffClerkRelationApiService staffClerkRelationApiService; private StaffClerkRelationApiService staffClerkRelationApiService;
@Autowired @Autowired
private WxEnterpriseRelatedApiService wxEnterpriseRelatedApiService; private WxEnterpriseRelatedApiService wxEnterpriseRelatedApiService;
@Autowired @Autowired
private EnterpriseService enterpriseService; private EnterpriseService enterpriseService;
@Autowired @Autowired
private ClerkMainStoreRelatedApiService clerkMainStoreRelatedApiService; private ClerkMainStoreRelatedApiService clerkMainStoreRelatedApiService;
@RequestMapping("staff-add") @RequestMapping("staff-add")
public HaobanResponse staffAdd(StaffDTO staffDTO,String departmentIds){ public HaobanResponse staffAdd(StaffDTO staffDTO, String departmentIds) {
LoginDTO login = (LoginDTO) AuthRequestUtil.getLoginUser(); LoginDTO login = (LoginDTO) AuthRequestUtil.getLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId(); String wxEnterpriseId = login.getWxEnterpriseId();
String staffName = staffDTO.getStaffName(); String staffName = staffDTO.getStaffName();
String phoneNumber = staffDTO.getPhoneNumber(); String phoneNumber = staffDTO.getPhoneNumber();
String nationcode = staffDTO.getNationCode(); String nationcode = staffDTO.getNationCode();
staffDTO.setWxEnterpriseId(wxEnterpriseId); staffDTO.setWxEnterpriseId(wxEnterpriseId);
if(StringUtils.isBlank(staffName)) { if (StringUtils.isBlank(staffName)) {
return resultResponse(HaoBanErrCode.ERR_10004); return resultResponse(HaoBanErrCode.ERR_10004);
} }
StaffDTO staff = staffApiService.selectByNationcodeAndPhoneNumber(wxEnterpriseId,nationcode,phoneNumber); StaffDTO staff = staffApiService.selectByNationcodeAndPhoneNumber(wxEnterpriseId, nationcode, phoneNumber);
if(staff != null) { if (staff != null) {
return resultResponse(HaoBanErrCode.ERR_10005); return resultResponse(HaoBanErrCode.ERR_10005);
} }
ServiceResponse hr = staffApiService.add(staffDTO,departmentIds); ServiceResponse hr = staffApiService.add(staffDTO, departmentIds);
if(hr.getCode() == 0){ if (hr.getCode() == 0) {
return resultResponse(HaoBanErrCode.ERR_DEFINE, hr.getMessage(), null, hr.getMessage()); return resultResponse(HaoBanErrCode.ERR_DEFINE, hr.getMessage(), null, hr.getMessage());
} }
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
@RequestMapping("staff-sel") @RequestMapping("staff-sel")
public HaobanResponse staffSel(String staffId,String staffDepartmentRelatedId){ public HaobanResponse staffSel(String staffId) {
StaffDTO staff = staffApiService.selectById(staffId); StaffDTO staff = staffApiService.selectById(staffId);
List<StaffDepartmentRelatedDTO> list = staffApiService.listStaffDepartmentByStaffId(staffId); List<StaffDepartmentRelatedDTO> list = staffApiService.listStaffDepartmentByStaffId(staffId);
List<DepartmentDTO> departmentList = new ArrayList<DepartmentDTO>(); List<DepartmentDTO> departmentList = new ArrayList<DepartmentDTO>();
for (StaffDepartmentRelatedDTO staffDepartmentRelatedDTO : list) { for (StaffDepartmentRelatedDTO staffDepartmentRelatedDTO : list) {
DepartmentDTO dto = departmentApiService.selectById(staffDepartmentRelatedDTO.getDepartmentId()); DepartmentDTO dto = departmentApiService.selectById(staffDepartmentRelatedDTO.getDepartmentId());
departmentList.add(dto); departmentList.add(dto);
} }
staff.setDepartmentList(departmentList); staff.setDepartmentList(departmentList);
return resultResponse(HaoBanErrCode.ERR_1,staff); return resultResponse(HaoBanErrCode.ERR_1, staff);
} }
@RequestMapping("staff-list") @RequestMapping("staff-list")
public HaobanResponse staffList(String departmentId,Integer activeFlag,String keyWord,BasePageInfo pageInfo){ public HaobanResponse staffList(String departmentId, Integer activeFlag, String keyWord, BasePageInfo pageInfo) {
LoginDTO login = (LoginDTO) AuthRequestUtil.getLoginUser(); LoginDTO login = (LoginDTO) AuthRequestUtil.getLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId(); String wxEnterpriseId = login.getWxEnterpriseId();
List<String> departmentIdSet = new ArrayList<>(); List<String> departmentIdSet = new ArrayList<>();
departmentIdSet.add(departmentId); departmentIdSet.add(departmentId);
List<DepartmentDTO> sonDepartmentList = departmentApiService.listSonByDepartmentIds(departmentIdSet, wxEnterpriseId); List<DepartmentDTO> sonDepartmentList = departmentApiService.listSonByDepartmentIds(departmentIdSet, wxEnterpriseId);
List<String> departmentIds = sonDepartmentList.stream().map(DepartmentDTO::getDepartmentId).collect(Collectors.toList()); List<String> departmentIds = sonDepartmentList.stream().map(DepartmentDTO::getDepartmentId).collect(Collectors.toList());
Page<StaffDTO> page = staffApiService.pageStaff(departmentIds,activeFlag,keyWord,pageInfo); Page<StaffDTO> page = staffApiService.pageStaff(departmentIds, activeFlag, keyWord, pageInfo);
List<StaffDTO> list = page.getResult(); List<StaffDTO> list = page.getResult();
logger.info("pages={},totalPage={}",page.getCurrentPage(),page.getTotalPage()); logger.info("pages={},totalPage={}", page.getCurrentPage(), page.getTotalPage());
PageResult<StaffDTO> pageVo = new PageResult<>(); PageResult<StaffDTO> pageVo = new PageResult<>();
pageVo.setList(list); pageVo.setList(list);
pageVo.setPageNum(page.getCurrentPage()); pageVo.setPageNum(page.getCurrentPage());
pageVo.setPages(page.getPages()); pageVo.setPages(page.getPages());
pageVo.setPageSize(page.getPageSize()); pageVo.setPageSize(page.getPageSize());
pageVo.setTotal(page.getTotalCount()); pageVo.setTotal(page.getTotalCount());
return resultResponse(HaoBanErrCode.ERR_1, pageVo); return resultResponse(HaoBanErrCode.ERR_1, pageVo);
} }
@RequestMapping("staff-del") @RequestMapping("staff-del")
public HaobanResponse staffDel(String staffDepartmentStaffRelatedId){ public HaobanResponse staffDel(String staffDepartmentStaffRelatedId) {
StaffDepartmentRelatedDTO related = staffDepartmentRelatedApiService.getByStaffDepartmentRelatedId(staffDepartmentStaffRelatedId); StaffDepartmentRelatedDTO related = staffDepartmentRelatedApiService.getByStaffDepartmentRelatedId(staffDepartmentStaffRelatedId);
if(related == null){ if (related == null) {
return resultResponse(HaoBanErrCode.ERR_8); return resultResponse(HaoBanErrCode.ERR_8);
} }
DepartmentDTO department = departmentApiService.selectById(related.getDepartmentId()); DepartmentDTO department = departmentApiService.selectById(related.getDepartmentId());
if(department.getTempFlag() != null && department.getTempFlag() == 1){ if (department.getTempFlag() != null && department.getTempFlag() == 1) {
return resultResponse(HaoBanErrCode.ERR_10014); return resultResponse(HaoBanErrCode.ERR_10014);
} }
staffApiService.del(staffDepartmentStaffRelatedId); staffApiService.del(staffDepartmentStaffRelatedId);
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
@RequestMapping("staff-batch-del") @RequestMapping("staff-batch-del")
public HaobanResponse staffBatchDel(String staffDepartmentRelatedIds){ public HaobanResponse staffBatchDel(String staffDepartmentRelatedIds) {
if(StringUtils.isBlank(staffDepartmentRelatedIds)){ if (StringUtils.isBlank(staffDepartmentRelatedIds)) {
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
} }
String[] staffArr = staffDepartmentRelatedIds.split(","); String[] staffArr = staffDepartmentRelatedIds.split(",");
int size = staffArr.length; int size = staffArr.length;
for (String string : staffArr) { for (String string : staffArr) {
StaffDepartmentRelatedDTO related = staffDepartmentRelatedApiService.getByStaffDepartmentRelatedId(string); StaffDepartmentRelatedDTO related = staffDepartmentRelatedApiService.getByStaffDepartmentRelatedId(string);
if(related == null){ if (related == null) {
continue; continue;
} }
DepartmentDTO department = departmentApiService.selectById(related.getDepartmentId()); DepartmentDTO department = departmentApiService.selectById(related.getDepartmentId());
if(department.getTempFlag() != null && department.getTempFlag() == 1){ if (department.getTempFlag() != null && department.getTempFlag() == 1) {
if(size == 1){ if (size == 1) {
return resultResponse(HaoBanErrCode.ERR_10014); return resultResponse(HaoBanErrCode.ERR_10014);
} }
continue; continue;
} }
staffApiService.del(string); staffApiService.del(string);
} }
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
@RequestMapping("staff-edit") @RequestMapping("staff-edit")
public HaobanResponse staffEdit(StaffDTO staffDTO,String departmentIds){ public HaobanResponse staffEdit(StaffDTO staffDTO, String departmentIds) {
String staffId = staffDTO.getStaffId(); String staffId = staffDTO.getStaffId();
StaffDTO staff = staffApiService.selectById(staffId); StaffDTO staff = staffApiService.selectById(staffId);
if(staff == null) { if (staff == null) {
return resultResponse(HaoBanErrCode.ERR_10006); return resultResponse(HaoBanErrCode.ERR_10006);
} }
String phoneNumber = staffDTO.getPhoneNumber(); String phoneNumber = staffDTO.getPhoneNumber();
String nationcode = staffDTO.getNationCode(); String nationcode = staffDTO.getNationCode();
String wxEnterpriseId = staff.getWxEnterpriseId(); String wxEnterpriseId = staff.getWxEnterpriseId();
StaffDTO old = staffApiService.selectByNationcodeAndPhoneNumber(wxEnterpriseId,nationcode,phoneNumber); StaffDTO old = staffApiService.selectByNationcodeAndPhoneNumber(wxEnterpriseId, nationcode, phoneNumber);
if(old != null && !old.getStaffId().equals(staffId)){ if (old != null && !old.getStaffId().equals(staffId)) {
return resultResponse(HaoBanErrCode.ERR_10005); return resultResponse(HaoBanErrCode.ERR_10005);
} }
staffApiService.staffEdit(staffDTO,departmentIds); staffApiService.staffEdit(staffDTO, departmentIds);
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
@RequestMapping("staff-invite") @RequestMapping("staff-invite")
public HaobanResponse staffInvite(String staffIds){ public HaobanResponse staffInvite(String staffIds) {
if(StringUtils.isBlank(staffIds)){ if (StringUtils.isBlank(staffIds)) {
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
} }
String[] staffArr = staffIds.split(","); String[] staffArr = staffIds.split(",");
List<String> userArr = new ArrayList<>(); List<String> userArr = new ArrayList<>();
String wxEnterpriseId = ""; String wxEnterpriseId = "";
for (String staffId : staffArr) { for (String staffId : staffArr) {
StaffDTO staff = staffApiService.selectById(staffId); StaffDTO staff = staffApiService.selectById(staffId);
if(staff != null){ if (staff != null) {
String userId = staff.getWxUserId(); String userId = staff.getWxUserId();
wxEnterpriseId = staff.getWxEnterpriseId(); wxEnterpriseId = staff.getWxEnterpriseId();
userArr.add(userId); userArr.add(userId);
} }
} }
WxEnterpriseDTO enterpriseDTO = wxEnterpriseApiService.getOne(wxEnterpriseId); WxEnterpriseDTO enterpriseDTO = wxEnterpriseApiService.getOne(wxEnterpriseId);
WxApplicationDTO application = wxApplicationApiService.selectByWxEnterpriseIdAndApplicationType(wxEnterpriseId,1); WxApplicationDTO application = wxApplicationApiService.selectByWxEnterpriseIdAndApplicationType(wxEnterpriseId, 1);
if(enterpriseDTO != null) { if (enterpriseDTO != null) {
if(application != null) { if (application != null) {
qywxUserApiService.inviteUser(enterpriseDTO.getCorpid(), application.getSiteId(), userArr); qywxUserApiService.inviteUser(enterpriseDTO.getCorpid(), application.getSiteId(), userArr);
} }
} }
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
@RequestMapping("staff-batch-edit-department") @RequestMapping("staff-batch-edit-department")
public HaobanResponse staffBatchEditDepartment(String params){ public HaobanResponse staffBatchEditDepartment(String params) {
List<StaffEditJsonQO> list = JSON.parseArray(params, StaffEditJsonQO.class); List<StaffEditJsonQO> list = JSON.parseArray(params, StaffEditJsonQO.class);
for (StaffEditJsonQO staffEditJsonQO : list) { for (StaffEditJsonQO staffEditJsonQO : list) {
String staffDepartmentRelatedId = staffEditJsonQO.getStaffDepartmentRelatedId(); String staffDepartmentRelatedId = staffEditJsonQO.getStaffDepartmentRelatedId();
String departmentIds = staffEditJsonQO.getCurrDepartmentIds(); String departmentIds = staffEditJsonQO.getCurrDepartmentIds();
StaffDepartmentRelatedDTO related = staffDepartmentRelatedApiService.getByStaffDepartmentRelatedId(staffDepartmentRelatedId); StaffDepartmentRelatedDTO related = staffDepartmentRelatedApiService.getByStaffDepartmentRelatedId(staffDepartmentRelatedId);
if(related != null) { if (related != null) {
StaffDTO staff = staffApiService.selectById(related.getStaffId()); StaffDTO staff = staffApiService.selectById(related.getStaffId());
if(staff != null) { if (staff != null) {
staffApiService.staffEdit(staff, departmentIds); staffApiService.staffEdit(staff, departmentIds);
} }
} }
} }
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
@RequestMapping("get-clerk-info") @RequestMapping("get-clerk-info")
public HaobanResponse getClerkInfo(String clerkId){ public HaobanResponse getClerkInfo(String clerkId) {
StaffVO staffVO = new StaffVO(); StaffVO staffVO = new StaffVO();
ClerkDTO clerk = clerkService.getClerkByClerkId(clerkId); ClerkDTO clerk = clerkService.getClerkByClerkId(clerkId);
if(clerk != null) { if (clerk != null) {
String storeId = clerk.getStoreId(); String storeId = clerk.getStoreId();
StoreDTO storeDTO = storeService.getStore(storeId); StoreDTO storeDTO = storeService.getStore(storeId);
staffVO.setStaffName(clerk.getClerkName()); staffVO.setStaffName(clerk.getClerkName());
staffVO.setNationCode(clerk.getNationcode()); staffVO.setNationCode(clerk.getNationcode());
staffVO.setPhoneNumber(clerk.getPhoneNumber()); staffVO.setPhoneNumber(clerk.getPhoneNumber());
staffVO.setPosition(clerk.getPositionName()); staffVO.setPosition(clerk.getPositionName());
staffVO.setHeadImg(clerk.getHeadImgUrl()); staffVO.setHeadImg(clerk.getHeadImgUrl());
staffVO.setDepartmentName(storeDTO==null?"":storeDTO.getStoreName()); staffVO.setDepartmentName(storeDTO == null ? "" : storeDTO.getStoreName());
} }
return resultResponse(HaoBanErrCode.ERR_1,staffVO); return resultResponse(HaoBanErrCode.ERR_1, staffVO);
} }
@RequestMapping("get-staff-info") @RequestMapping("get-staff-info")
public HaobanResponse getStaffInfo(String staffId){ public HaobanResponse getStaffInfo(String staffId) {
StaffVO staffVO = new StaffVO(); StaffVO staffVO = new StaffVO();
StaffDTO staff = staffApiService.selectById(staffId); StaffDTO staff = staffApiService.selectById(staffId);
if(staff != null) { if (staff != null) {
List<StaffDepartmentRelatedDTO> list = staffDepartmentRelatedApiService.listByStaffId(staffId); List<StaffDepartmentRelatedDTO> list = staffDepartmentRelatedApiService.listByStaffId(staffId);
staffVO.setStaffName(staff.getStaffName()); staffVO.setStaffName(staff.getStaffName());
staffVO.setNationCode(staff.getNationCode()); staffVO.setNationCode(staff.getNationCode());
staffVO.setPhoneNumber(staff.getPhoneNumber()); staffVO.setPhoneNumber(staff.getPhoneNumber());
staffVO.setPosition(staff.getPostion()); staffVO.setPosition(staff.getPostion());
staffVO.setHeadImg(staff.getHeadImg()); staffVO.setHeadImg(staff.getHeadImg());
if(CollectionUtil.isNotEmpty(list)){ if (CollectionUtil.isNotEmpty(list)) {
String departmentId = list.get(0).getDepartmentId(); String departmentId = list.get(0).getDepartmentId();
DepartmentDTO departmentDTO = departmentApiService.selectById(departmentId); DepartmentDTO departmentDTO = departmentApiService.selectById(departmentId);
if(departmentDTO != null){ if (departmentDTO != null) {
staffVO.setDepartmentName(departmentDTO.getDepartmentName()); staffVO.setDepartmentName(departmentDTO.getDepartmentName());
} }
} }
} }
return resultResponse(HaoBanErrCode.ERR_1,staffVO); return resultResponse(HaoBanErrCode.ERR_1, staffVO);
} }
/** /**
* 成员关联关系接口 * 成员关联关系接口
* @param staffId *
* @return * @param staffId
*/ * @return
@RequestMapping("staff-clerk-relation") */
public HaobanResponse staffClerkList(String staffId){ @RequestMapping("staff-clerk-relation")
StaffDTO staff = staffApiService.selectById(staffId); public HaobanResponse staffClerkList(String staffId) {
if(staff == null) { StaffDTO staff = staffApiService.selectById(staffId);
return resultResponse(HaoBanErrCode.ERR_10007); if (staff == null) {
} return resultResponse(HaoBanErrCode.ERR_10007);
List<StaffClerkInfoDTO> retList = staffClerkRelationApiService.listBindDetailByStaffId(staffId); }
if (CollectionUtils.isEmpty(retList)) { List<StaffClerkInfoDTO> retList = staffClerkRelationApiService.listBindDetailByStaffId(staffId);
return resultResponse(HaoBanErrCode.ERR_1); if (CollectionUtils.isEmpty(retList)) {
} return resultResponse(HaoBanErrCode.ERR_1);
ClerkMainStoreRelatedDTO mainStoreRelatedDTO = clerkMainStoreRelatedApiService.getWxEnterpriseIdAndStaffId(staff.getWxEnterpriseId(), staffId); }
if (null != mainStoreRelatedDTO) { ClerkMainStoreRelatedDTO mainStoreRelatedDTO = clerkMainStoreRelatedApiService.getWxEnterpriseIdAndStaffId(staff.getWxEnterpriseId(), staffId);
retList.forEach(dto -> { if (null != mainStoreRelatedDTO) {
if (dto.getStoreId().equals(mainStoreRelatedDTO.getStoreId())) { retList.forEach(dto -> {
dto.setMainStoreFlag(1); if (dto.getStoreId().equals(mainStoreRelatedDTO.getStoreId())) {
} else { dto.setMainStoreFlag(1);
dto.setMainStoreFlag(0); } else {
} dto.setMainStoreFlag(0);
}); }
} });
return resultResponse(HaoBanErrCode.ERR_1,retList); }
} return resultResponse(HaoBanErrCode.ERR_1, retList);
}
/**
* 成员关联关系接口 /**
* @param staffId * 成员关联关系接口
* @return *
*/ * @param staffId
@RequestMapping("del-clerk-relation") * @return
public HaobanResponse delStaffClerkList(String staffId,String clerkId){ */
LoginDTO login = (LoginDTO) AuthRequestUtil.getLoginUser(); @RequestMapping("del-clerk-relation")
StaffDTO staffDTO = login.getStaffDTO(); public HaobanResponse delStaffClerkList(String staffId, String clerkId) {
if (staffDTO==null) { LoginDTO login = (LoginDTO) AuthRequestUtil.getLoginUser();
logger.info("登录异常"); StaffDTO staffDTO = login.getStaffDTO();
return resultResponse(HaoBanErrCode.ERR_4); if (staffDTO == null) {
} logger.info("登录异常");
StaffDTO staff = staffApiService.selectById(staffId); return resultResponse(HaoBanErrCode.ERR_4);
if(staff == null) { }
return resultResponse(HaoBanErrCode.ERR_10007); StaffDTO staff = staffApiService.selectById(staffId);
} if (staff == null) {
boolean b = staffClerkRelationApiService.unbindByStaffAndClerkId(staffDTO.getStaffId(), clerkId); return resultResponse(HaoBanErrCode.ERR_10007);
return resultResponse(HaoBanErrCode.ERR_1,b); }
} boolean b = staffClerkRelationApiService.unbindByStaffAndClerkId(staffDTO.getStaffId(), clerkId);
return resultResponse(HaoBanErrCode.ERR_1, b);
//获取门店详情 }
public boolean isEnterpriseOver(String eid) {
//获取门店详情
com.gic.enterprise.api.dto.EnterpriseDTO enterprise = enterpriseService.getEnterpriseByEid(eid); public boolean isEnterpriseOver(String eid) {
if (enterprise == null) {
return true; com.gic.enterprise.api.dto.EnterpriseDTO enterprise = enterpriseService.getEnterpriseByEid(eid);
} if (enterprise == null) {
if (enterprise.getExpireTime() == null) { return true;
if (enterprise.getEnabledState() == null) { }
return false; if (enterprise.getExpireTime() == null) {
} else if (enterprise.getEnabledState() == 1) { if (enterprise.getEnabledState() == null) {
return false; return false;
} else { } else return enterprise.getEnabledState() != 1;
return true; } else
} return enterprise.getExpireTime().getTime() <= System.currentTimeMillis() || enterprise.getEnabledState() != 1;
} else if (enterprise.getExpireTime().getTime() > System.currentTimeMillis() && enterprise.getEnabledState() == 1) {
return false; }
}
return true; /**
* 成员关联关系搜索接口
} *
* @param search
/** * @return
* 成员关联关系搜索接口 */
* @param search @RequestMapping("search-clerk-relation")
* @return public HaobanResponse staffClerkSearch(String search) {
*/ LoginDTO login = (LoginDTO) AuthRequestUtil.getLoginUser();
@RequestMapping("search-clerk-relation") String wxEnterpriseId = login.getWxEnterpriseId();
public HaobanResponse staffClerkSearch(String search){ if (null == wxEnterpriseId) {
LoginDTO login = (LoginDTO) AuthRequestUtil.getLoginUser(); return resultResponse(HaoBanErrCode.ERR_4);
String wxEnterpriseId = login.getWxEnterpriseId(); }
if (null == wxEnterpriseId) { List<EnterpriseDetailDTO> list = wxEnterpriseRelatedApiService.listEnterpriseByWxEnterpriseId(wxEnterpriseId);
return resultResponse(HaoBanErrCode.ERR_4); if (CollectionUtil.isEmpty(list)) {
} return resultResponse(HaoBanErrCode.ERR_10010);
List<EnterpriseDetailDTO> list = wxEnterpriseRelatedApiService.listEnterpriseByWxEnterpriseId(wxEnterpriseId); }
if (CollectionUtil.isEmpty(list)) { List<String> enterpriseIds = list.stream().filter(dto -> {
return resultResponse(HaoBanErrCode.ERR_10010); boolean over = isEnterpriseOver(dto.getEnterpriseId());
} return !over;
List<String> enterpriseIds = list.stream().filter(dto->{ }).map(EnterpriseDetailDTO::getEnterpriseId).collect(Collectors.toList());
boolean over = isEnterpriseOver(dto.getEnterpriseId());
return !over; List<String> storeIds = wxEnterpriseRelatedApiService.listStoreIdByWxEnterpriseId(wxEnterpriseId);
}).map(EnterpriseDetailDTO::getEnterpriseId).collect(Collectors.toList()); if (CollectionUtils.isEmpty(storeIds)) {
logger.info("没有权限门店");
List<String> storeIds = wxEnterpriseRelatedApiService.listStoreIdByWxEnterpriseId(wxEnterpriseId); return resultResponse(HaoBanErrCode.ERR_1);
if (CollectionUtils.isEmpty(storeIds)) { }
logger.info("没有权限门店"); List<ClerkDTO> clerkDTOList = clerkNewService.listClerkByEnterpriseIdAndSearch(enterpriseIds, storeIds, search);
return resultResponse(HaoBanErrCode.ERR_1); List<ClerkInfoVo> retList = EntityUtil.changeEntityListByJSON(ClerkInfoVo.class, clerkDTOList);
} if (CollectionUtils.isNotEmpty(retList)) {
List<ClerkDTO> clerkDTOList = clerkNewService.listClerkByEnterpriseIdAndSearch(enterpriseIds, storeIds, search); List<String> clerkIds = retList.stream().map(ClerkInfoVo::getClerkId).collect(Collectors.toList());
List<ClerkInfoVo> retList = EntityUtil.changeEntityListByJSON(ClerkInfoVo.class, clerkDTOList); List<StaffClerkRelationDTO> dtos = staffClerkRelationApiService.listByClerkIds(clerkIds);
if (CollectionUtils.isNotEmpty(retList)) { if (CollectionUtils.isNotEmpty(dtos)) {
List<String> clerkIds = retList.stream().map(ClerkInfoVo::getClerkId).collect(Collectors.toList()); Map<String, StaffClerkRelationDTO> hasRelationClerkIds = dtos.stream().collect(Collectors.toMap(StaffClerkRelationDTO::getClerkId, mid -> mid));
List<StaffClerkRelationDTO> dtos = staffClerkRelationApiService.listByClerkIds(clerkIds); retList.forEach(clerkInfoVo -> {
if (CollectionUtils.isNotEmpty(dtos)) { if (hasRelationClerkIds.containsKey(clerkInfoVo.getClerkId())) {
Map<String, StaffClerkRelationDTO> hasRelationClerkIds = dtos.stream().collect(Collectors.toMap(StaffClerkRelationDTO::getClerkId, mid -> mid)); clerkInfoVo.setRelationStatus(1);
retList.forEach(clerkInfoVo -> { StaffDTO staffDTO = staffApiService.selectById(hasRelationClerkIds.get(clerkInfoVo.getClerkId()).getStaffId());
if (hasRelationClerkIds.containsKey(clerkInfoVo.getClerkId())) { if (staffDTO != null) {
clerkInfoVo.setRelationStatus(1); clerkInfoVo.setStaffName(staffDTO.getStaffName());
StaffDTO staffDTO = staffApiService.selectById(hasRelationClerkIds.get(clerkInfoVo.getClerkId()).getStaffId()); clerkInfoVo.setStaffId(staffDTO.getStaffId());
if (staffDTO !=null) { }
clerkInfoVo.setStaffName(staffDTO.getStaffName()); }
clerkInfoVo.setStaffId(staffDTO.getStaffId()); StoreDTO store = storeService.getStore(clerkInfoVo.getStoreId());
} if (null != store) {
} clerkInfoVo.setStoreName(store.getStoreName());
StoreDTO store = storeService.getStore(clerkInfoVo.getStoreId());
if (null != store) { }
clerkInfoVo.setStoreName(store.getStoreName());
});
} }
}); }
} return resultResponse(HaoBanErrCode.ERR_1, retList);
}
}
return resultResponse(HaoBanErrCode.ERR_1,retList); /**
//todo 还没好 * 新建关联
} *
* @param staffId
/** * @return
* 新建关联 */
* @param staffId @RequestMapping("add-clerk-relation")
* @return public HaobanResponse staffClerkSearch(String staffId, String clerkId) {
*/ LoginDTO login = (LoginDTO) AuthRequestUtil.getLoginUser();
@RequestMapping("add-clerk-relation") StaffDTO loginStaffDTO = login.getStaffDTO();
public HaobanResponse staffClerkSearch(String staffId,String clerkId){ if (null == loginStaffDTO) {
LoginDTO login = (LoginDTO) AuthRequestUtil.getLoginUser(); return resultResponse(HaoBanErrCode.ERR_4);
StaffDTO loginStaffDTO = login.getStaffDTO(); }
if (null == loginStaffDTO) { if (StringUtils.isAnyBlank(staffId, clerkId)) {
return resultResponse(HaoBanErrCode.ERR_4); return resultResponse(HaoBanErrCode.ERR_2);
} }
if (StringUtils.isAnyBlank(staffId,clerkId)) { StaffDTO staffDTO = staffApiService.selectById(staffId);
return resultResponse(HaoBanErrCode.ERR_2); if (null == staffDTO) {
} return resultResponse(HaoBanErrCode.ERR_10007);
StaffDTO staffDTO = staffApiService.selectById(staffId); }
if (null == staffDTO) { ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId);
return resultResponse(HaoBanErrCode.ERR_10007); if (null == clerkDTO) {
} return resultResponse(HaoBanErrCode.ERR_5);
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId); }
if (null == clerkDTO) { StaffClerkRelationDTO relationDTO = new StaffClerkRelationDTO();
return resultResponse(HaoBanErrCode.ERR_5); relationDTO.setClerkCode(clerkDTO.getClerkCode());
} relationDTO.setClerkId(clerkId);
StaffClerkRelationDTO relationDTO = new StaffClerkRelationDTO(); relationDTO.setStaffId(staffId);
relationDTO.setClerkCode(clerkDTO.getClerkCode()); relationDTO.setEnterpriseId(clerkDTO.getEnterpriseId());
relationDTO.setClerkId(clerkId); relationDTO.setStoreId(clerkDTO.getStoreId());
relationDTO.setStaffId(staffId); relationDTO.setWxEnterpriseId(staffDTO.getWxEnterpriseId());
relationDTO.setEnterpriseId(clerkDTO.getEnterpriseId()); relationDTO.setWxUserId(staffDTO.getWxUserId());
relationDTO.setStoreId(clerkDTO.getStoreId());
relationDTO.setWxEnterpriseId(staffDTO.getWxEnterpriseId());
relationDTO.setWxUserId(staffDTO.getWxUserId()); ServiceResponse response = staffClerkRelationApiService.bindStaffClerk(relationDTO, loginStaffDTO.getStaffId(), ChannelCodeEnum.ADMIN_BIND.getCode());
logger.info("返回信息:{}", JSONObject.toJSONString(response));
if (response.getCode() == 1) {
ServiceResponse response = staffClerkRelationApiService.bindStaffClerk(relationDTO,loginStaffDTO.getStaffId(),ChannelCodeEnum.ADMIN_BIND.getCode()); return resultResponse(HaoBanErrCode.ERR_1);
logger.info("返回信息:{}", JSONObject.toJSONString(response)); } else {
if (response.getCode()==1) { HaoBanErrCode errDefine = HaoBanErrCode.ERR_DEFINE;
return resultResponse(HaoBanErrCode.ERR_1); errDefine.setMsg(response.getMessage());
}else{ return resultResponse(errDefine);
HaoBanErrCode errDefine = HaoBanErrCode.ERR_DEFINE; }
errDefine.setMsg(response.getMessage()); }
return resultResponse(errDefine);
} /**
} * 绑定日志
*
/** * @return
* 绑定日志 */
* @return @RequestMapping("staff-clerk-bind-log")
*/ public HaobanResponse bindLogs(String search, String enterpriseId, @RequestParam(defaultValue = "-1") Integer optType, BasePageInfo qo) {
@RequestMapping("staff-clerk-bind-log") LoginDTO login = (LoginDTO) AuthRequestUtil.getLoginUser();
public HaobanResponse bindLogs(String search,String enterpriseId,@RequestParam(defaultValue = "-1") Integer optType,BasePageInfo qo){ StaffDTO loginStaffDTO = login.getStaffDTO();
LoginDTO login = (LoginDTO) AuthRequestUtil.getLoginUser(); if (null == loginStaffDTO) {
StaffDTO loginStaffDTO = login.getStaffDTO(); return resultResponse(HaoBanErrCode.ERR_4);
if (null == loginStaffDTO) { }
return resultResponse(HaoBanErrCode.ERR_4); Page<StaffClerkBindLogDetailDTO> page = staffClerkRelationApiService.pageStaffClerkBindLog(loginStaffDTO.getWxEnterpriseId(), search, enterpriseId, optType, qo);
} return resultResponse(HaoBanErrCode.ERR_1, page);
Page<StaffClerkBindLogDetailDTO> page = staffClerkRelationApiService.pageStaffClerkBindLog(loginStaffDTO.getWxEnterpriseId(), search, enterpriseId, optType, qo); }
return resultResponse(HaoBanErrCode.ERR_1,page);
} /**
* @return 返回值类型: <pre>
/** * @author 作者: qwm
* * @date 时间: 2020年12月18日 上午11:11:35 <pre>
* @Description 会员导出 * @Description 会员导出
* @return 返回值类型: <pre> */
* @author 作者: qwm @RequestMapping("staff-export")
* @date 时间: 2020年12月18日 上午11:11:35 <pre> public HaobanResponse staffExport(HttpServletRequest request, HttpServletResponse response, String departmentId, Integer activeFlag, String keyWord, BasePageInfo pageInfo) {
*/ pageInfo.setPageSize(Integer.MAX_VALUE);
@RequestMapping("staff-export") List<String> departmentIdSet = new ArrayList<>();
public HaobanResponse staffExport(HttpServletResponse response, HttpServletRequest request){ departmentIdSet.add(departmentId);
BasePageInfo pageInfo = new BasePageInfo(); LoginDTO login = (LoginDTO) AuthRequestUtil.getLoginUser();
int pageSize = 1000; String wxEnterpriseId = login.getWxEnterpriseId();
int pageNum = 1; List<DepartmentDTO> relationList = departmentApiService.listSonByDepartmentIds(departmentIdSet, wxEnterpriseId);
pageInfo.setPageNum(pageNum); Map<String, DepartmentDTO> departmentMap = relationList.stream().collect(Collectors.toMap(DepartmentDTO::getDepartmentId, s -> s));
pageInfo.setPageSize(pageSize); List<String> departmentIds = relationList.stream().map(DepartmentDTO::getDepartmentId).collect(Collectors.toList());
String departmentId=request.getParameter("departmentId"); Page<StaffDTO> page = staffApiService.pageStaff(departmentIds, activeFlag, keyWord, pageInfo);
List<String> departmentIdSet = new ArrayList<>(); List<StaffDTO> list = page.getResult();
departmentIdSet.add(departmentId); List<StaffExportVO> voList = new ArrayList<>();
LoginDTO login = (LoginDTO) AuthRequestUtil.getLoginUser(); for (StaffDTO staffDTO : list) {
String wxEnterpriseId = login.getWxEnterpriseId(); StaffExportVO vo = new StaffExportVO();
WxEnterpriseDTO enterprise = wxEnterpriseApiService.getOne(wxEnterpriseId); vo.setStaffId(staffDTO.getStaffId());
String wxEnterpriseName = ""; vo.setPhoneNumber(staffDTO.getPhoneNumber());
if(enterprise != null){ vo.setStaffName(staffDTO.getStaffName());
wxEnterpriseName = enterprise.getCorpName(); vo.setPosition(staffDTO.getPostion());
} vo.setDepartmentName(departmentMap.get(staffDTO.getDepartmentIds()) == null ? null : departmentMap.get(staffDTO.getDepartmentIds()).getDepartmentName());
List<DepartmentDTO> relationList = departmentApiService.listSonByDepartmentIds(departmentIdSet,wxEnterpriseId); vo.setActiveFlag((staffDTO.getActiveFlag() == null || staffDTO.getActiveFlag() == 0) ? "否" : "是");
Map<String,DepartmentDTO> departmentMap = relationList.stream().collect(Collectors.toMap(DepartmentDTO::getDepartmentId, s -> s)); voList.add(vo);
List<String> departmentIds = relationList.stream().map(DepartmentDTO::getDepartmentId).collect(Collectors.toList()); }
Page<StaffDTO> page = staffApiService.pageStaff(departmentIds,null,null,pageInfo); //拼接导购信息
List<StaffDTO> list = page.getResult(); WxEnterpriseDTO enterprise = wxEnterpriseApiService.getOne(wxEnterpriseId);
logger.info("pages={},totalPage={}",page.getCurrentPage(),page.getTotalPage()); String wxEnterpriseName = "";
while(page.getCurrentPage() < page.getTotalPage()){ if (enterprise != null) {
pageNum ++ ; wxEnterpriseName = enterprise.getCorpName();
pageInfo.setPageNum(pageNum); }
page = staffApiService.pageStaff(departmentIds,null,null,pageInfo); mergeClerkInfo(voList, wxEnterpriseId);
List<StaffDTO> sonList = page.getResult(); String fileName = wxEnterpriseName + "通讯录" + DateUtil.dateToStr(new Date(), DateUtil.FORMAT_DATE_8);
if(CollectionUtils.isNotEmpty(sonList)){ List<String> titleList = Arrays.asList("姓名", "职务", "部门", "手机号", "使用状态", "关联导购");
list.addAll(sonList); List<String> fileList = Arrays.asList("staffName", "position", "departmentName", "phoneNumber", "activeFlag", "clerkName");
} try {
logger.info("sonList={}",sonList.size()); ExcelUtils.xls(response, request, fileName, voList, fileList, titleList);
} } catch (Exception e) {
List<StaffExportVO> voList = new ArrayList<>(); e.printStackTrace();
for (StaffDTO staffDTO : list) { logger.info("导出失败");
StaffExportVO vo = new StaffExportVO(); }
vo.setStaffId(staffDTO.getStaffId());
vo.setPhoneNumber(staffDTO.getPhoneNumber());
vo.setStaffName(staffDTO.getStaffName());
vo.setPosition(staffDTO.getPostion());
vo.setDepartmentName(departmentMap.get(staffDTO.getDepartmentIds()) == null?null:departmentMap.get(staffDTO.getDepartmentIds()).getDepartmentName());
String active = "是";
if(staffDTO.getActiveFlag() == null || staffDTO.getActiveFlag() == 0){
active = "否";
}
vo.setActiveFlag(active);
voList.add(vo);
}
//拼接导购信息
mergeClerkInfo(voList, wxEnterpriseId);
String fileName = wxEnterpriseName + "通讯录" + DateUtil.dateToStr(new Date(), DateUtil.FORMAT_DATE_8);
List<String> fileList = new ArrayList<>();
List<String> titleList = new ArrayList<>();
titleList.add("姓名");
titleList.add("职务");
titleList.add("部门");
titleList.add("手机号");
titleList.add("使用状态");
titleList.add("关联导购");
fileList.add("staffName");
fileList.add("position");
fileList.add("departmentName");
fileList.add("phoneNumber");
fileList.add("activeFlag");
fileList.add("clerkName");
try {
ExcelUtils.csv(response, request, fileName, voList, fileList, titleList);
} catch (Exception e) {
e.printStackTrace();
logger.info("导出失败");
}
return null; return null;
} }
private void mergeClerkInfo(List<StaffExportVO> list,String wxEnterpriseId){ private void mergeClerkInfo(List<StaffExportVO> list, String wxEnterpriseId) {
BasePageInfo pageInfoRelation = new BasePageInfo(); BasePageInfo pageInfoRelation = new BasePageInfo();
int pageSizeRelation = 1000; int pageSizeRelation = 1000;
int pageNumRelation = 1; int pageNumRelation = 1;
pageInfoRelation.setPageNum(pageNumRelation); pageInfoRelation.setPageNum(pageNumRelation);
pageInfoRelation.setPageSize(pageSizeRelation); pageInfoRelation.setPageSize(pageSizeRelation);
Page<StaffClerkRelationDTO> bindPage = staffClerkRelationApiService.pageByWxEnterpriseId(wxEnterpriseId,pageInfoRelation); Page<StaffClerkRelationDTO> bindPage = staffClerkRelationApiService.pageByWxEnterpriseId(wxEnterpriseId, pageInfoRelation);
List<StaffClerkRelationDTO> bindList = bindPage.getResult(); List<StaffClerkRelationDTO> bindList = bindPage.getResult();
Set<String> clerkIdList = bindList.stream().map(StaffClerkRelationDTO::getClerkId).collect(Collectors.toSet()); Set<String> clerkIdList = bindList.stream().map(StaffClerkRelationDTO::getClerkId).collect(Collectors.toSet());
List<ClerkDTO> clerkList = clerkService.getClerkByClerkIds(clerkIdList); List<ClerkDTO> clerkList = clerkService.getClerkByClerkIds(clerkIdList);
while (bindPage.getCurrentPage() < bindPage.getTotalPage()) { while (bindPage.getCurrentPage() < bindPage.getTotalPage()) {
pageNumRelation ++ ; pageNumRelation++;
pageInfoRelation.setPageNum(pageNumRelation); pageInfoRelation.setPageNum(pageNumRelation);
bindPage = staffClerkRelationApiService.pageByWxEnterpriseId(wxEnterpriseId,pageInfoRelation); bindPage = staffClerkRelationApiService.pageByWxEnterpriseId(wxEnterpriseId, pageInfoRelation);
List<StaffClerkRelationDTO> sonList = bindPage.getResult(); List<StaffClerkRelationDTO> sonList = bindPage.getResult();
Set<String> clerkSonIdList = sonList.stream().map(StaffClerkRelationDTO::getClerkId).collect(Collectors.toSet()); Set<String> clerkSonIdList = sonList.stream().map(StaffClerkRelationDTO::getClerkId).collect(Collectors.toSet());
List<ClerkDTO> sonClerkList = clerkService.getClerkByClerkIds(clerkSonIdList); List<ClerkDTO> sonClerkList = clerkService.getClerkByClerkIds(clerkSonIdList);
if(CollectionUtils.isNotEmpty(sonClerkList)){ if (CollectionUtils.isNotEmpty(sonClerkList)) {
clerkList.addAll(sonClerkList); clerkList.addAll(sonClerkList);
} }
if(CollectionUtils.isNotEmpty(sonList)){ if (CollectionUtils.isNotEmpty(sonList)) {
bindList.addAll(sonList); bindList.addAll(sonList);
} }
} }
Map<String,List<StaffClerkRelationDTO>> bindMap = bindList.stream().collect(Collectors.groupingBy(StaffClerkRelationDTO::getStaffId)); Map<String, List<StaffClerkRelationDTO>> bindMap = bindList.stream().collect(Collectors.groupingBy(StaffClerkRelationDTO::getStaffId));
Map<String,ClerkDTO> clerkMap = clerkList.stream().collect(Collectors.toMap(ClerkDTO::getClerkId, s -> s, (v1, v2) -> v2)); Map<String, ClerkDTO> clerkMap = clerkList.stream().collect(Collectors.toMap(ClerkDTO::getClerkId, s -> s, (v1, v2) -> v2));
for (StaffExportVO staffDTO : list) { for (StaffExportVO staffDTO : list) {
List<StaffClerkRelationDTO> relationList = bindMap.get(staffDTO.getStaffId()); List<StaffClerkRelationDTO> relationList = bindMap.get(staffDTO.getStaffId());
if(CollectionUtils.isNotEmpty(relationList)){ if (CollectionUtils.isNotEmpty(relationList)) {
String clerkName = ""; StringBuffer clerkName = new StringBuffer();
for (StaffClerkRelationDTO staffClerkRelationDTO : relationList) { for (StaffClerkRelationDTO staffClerkRelationDTO : relationList) {
ClerkDTO clerk = clerkMap.get(staffClerkRelationDTO.getClerkId()); ClerkDTO clerk = clerkMap.get(staffClerkRelationDTO.getClerkId());
if(clerk != null){ if (clerk != null) {
clerkName += clerk.getClerkName() + ","; clerkName.append(clerk.getClerkName()).append(",");
} }
} }
if(StringUtils.isNoneBlank(clerkName)){ if (StringUtils.isNoneBlank(clerkName.toString())) {
clerkName = clerkName.substring(0,clerkName.length() - 1); clerkName = new StringBuffer(clerkName.substring(0, clerkName.length() - 1));
} }
staffDTO.setClerkName(clerkName); staffDTO.setClerkName(clerkName.toString());
} }
} }
} }
} }
...@@ -9,27 +9,30 @@ ...@@ -9,27 +9,30 @@
http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/context/spring-context.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"> http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<context:component-scan base-package="com.gic.haoban" /> <context:component-scan base-package="com.gic.haoban"/>
<!-- 应用名称 --> <!-- 应用名称 -->
<dubbo:application name="haoban-manage3-web"/> <dubbo:application name="haoban-manage3-web"/>
<dubbo:protocol name="dubbo" port="30009"/> <dubbo:protocol name="dubbo" port="30009"/>
<!-- 使用zookeeper注册中心暴露服务地址 --> <!-- 使用zookeeper注册中心暴露服务地址 -->
<!-- <dubbo:registry address="zookeeper://192.168.1.118:2181" protocol="dubbo" id="localAdd"/> --> <!-- <dubbo:registry address="zookeeper://192.168.1.118:2181" protocol="dubbo" id="localAdd"/> -->
<!--<dubbo:registry address="zookeeper://115.159.182.172:2199" protocol="dubbo" id="remoteAdd"/>--> <!--<dubbo:registry address="zookeeper://115.159.182.172:2199" protocol="dubbo" id="remoteAdd"/>-->
<!--<dubbo:registry address="zookeeper://localhost:2181|zookeeper://115.159.182.172:2199" protocol="dubbo"/>--> <!--<dubbo:registry address="zookeeper://localhost:2181|zookeeper://115.159.182.172:2199" protocol="dubbo"/>-->
<dubbo:reference interface="com.gic.haoban.manage.api.service.StaffApiService" id="staffApiService"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.StaffApiService" id="staffApiService"
<dubbo:reference interface="com.gic.haoban.manage.api.service.StaffClerkRelationApiService" id="staffClerkRelationApiService"/> timeout="15000"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService" id="wxEnterpriseRelatedApiService" /> <dubbo:reference interface="com.gic.haoban.manage.api.service.StaffClerkRelationApiService"
id="staffClerkRelationApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService"
id="wxEnterpriseRelatedApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.ApplicationApiService" id="applicationApiService"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.ApplicationApiService" id="applicationApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.WxEnterpriseApiService" id="wxEnterpriseApiService"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.WxEnterpriseApiService" id="wxEnterpriseApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService" <dubbo:reference interface="com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService"
id="clerkMainStoreRelatedApiService"/> id="clerkMainStoreRelatedApiService"/>
<dubbo:reference interface="com.gic.enterprise.api.service.EnterpriseService" id="enterpriseService"/> <dubbo:reference interface="com.gic.enterprise.api.service.EnterpriseService" id="enterpriseService"/>
<dubbo:reference interface="com.gic.enterprise.api.service.StoreService" id="storeService"/> <dubbo:reference interface="com.gic.enterprise.api.service.StoreService" id="storeService"/>
<dubbo:reference interface="com.gic.enterprise.api.service.DepartmentService" id="departmentService"/> <dubbo:reference interface="com.gic.enterprise.api.service.DepartmentService" id="departmentService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.DepartmentApiService" id="departmentApiService"> <dubbo:reference interface="com.gic.haoban.manage.api.service.DepartmentApiService" id="departmentApiService">
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<groupId>com.gic</groupId> <groupId>com.gic</groupId>
<artifactId>gic-pom-base</artifactId> <artifactId>gic-pom-base</artifactId>
<version>3.0-SNAPSHOT</version> <version>3.0-SNAPSHOT</version>
<relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -112,9 +112,11 @@ public class AuditController extends WebBaseController { ...@@ -112,9 +112,11 @@ public class AuditController extends WebBaseController {
List<StaffClerkBindLogDetailDTO> list = page.getResult(); List<StaffClerkBindLogDetailDTO> list = page.getResult();
List<StaffClerkBindLogDetailVO> voList = new ArrayList<StaffClerkBindLogDetailVO>(); List<StaffClerkBindLogDetailVO> voList = new ArrayList<StaffClerkBindLogDetailVO>();
for (StaffClerkBindLogDetailDTO staffClerkBindLogDetailDTO : list) { for (StaffClerkBindLogDetailDTO staffClerkBindLogDetailDTO : list) {
StaffClerkBindLogDetailVO vo = EntityUtil.changeEntityByJSON(StaffClerkBindLogDetailVO.class, staffClerkBindLogDetailDTO); if (staffClerkBindLogDetailDTO.getChannelCode() != ChannelCodeEnum.AUDIT_BIND.getCode()) {
vo.setUnbindReason(ChannelCodeEnum.getNameByCode(vo.getChannelCode())); StaffClerkBindLogDetailVO vo = EntityUtil.changeEntityByJSON(StaffClerkBindLogDetailVO.class, staffClerkBindLogDetailDTO);
voList.add(vo); vo.setUnbindReason(ChannelCodeEnum.getNameByCode(vo.getChannelCode()));
voList.add(vo);
}
} }
Page<StaffClerkBindLogDetailVO> pageVO = new Page<>(); Page<StaffClerkBindLogDetailVO> pageVO = new Page<>();
pageVO.setCurrentPage(page.getCurrentPage()); pageVO.setCurrentPage(page.getCurrentPage());
......
...@@ -225,7 +225,11 @@ public class ClerkController extends WebBaseController{ ...@@ -225,7 +225,11 @@ public class ClerkController extends WebBaseController{
// 查询操作配置 // 查询操作配置
OperationSettingDTO dto = operationSettingApiService.getByWxEnterpriseId(wxEnterpriseId); OperationSettingDTO dto = operationSettingApiService.getByWxEnterpriseId(wxEnterpriseId);
if (Objects.isNull(dto)) { if (Objects.isNull(dto)) {
return resultResponse(HaoBanErrCode.ERR_8); OperationSettingVO vo = new OperationSettingVO();
vo.setWxEnterpriseId(wxEnterpriseId);
// 为空情况初始默认不生效
vo.setEffectFlag(0);
return resultResponse(HaoBanErrCode.ERR_1, vo);
} }
OperationSettingVO vo = EntityUtil.changeEntity(OperationSettingVO.class, dto); OperationSettingVO vo = EntityUtil.changeEntity(OperationSettingVO.class, dto);
// 是否开启导购编辑,如果不开启,默认无效 // 是否开启导购编辑,如果不开启,默认无效
...@@ -249,12 +253,20 @@ public class ClerkController extends WebBaseController{ ...@@ -249,12 +253,20 @@ public class ClerkController extends WebBaseController{
String nationcode = staffDTO.getNationCode(); String nationcode = staffDTO.getNationCode();
String postion = staffDTO.getPostion(); String postion = staffDTO.getPostion();
Integer sex = staffDTO.getSex(); Integer sex = staffDTO.getSex();
if(StringUtils.isAnyBlank(staffName,phoneNumber,commitName)) { if(StringUtils.isAnyBlank(staffName, commitName)) {
return resultResponse(HaoBanErrCode.ERR_10004); return resultResponse(HaoBanErrCode.ERR_10004);
} }
if(!GooglePhoneNumberUtil.checkPhoneNumber(phoneNumber, nationcode)){ if (StringUtils.isEmpty(clerkCode)) {
return resultResponse(HaoBanErrCode.ERR_111116);
}
if(StringUtils.isNotEmpty(phoneNumber) &&
!GooglePhoneNumberUtil.checkPhoneNumber(phoneNumber, nationcode)){
return resultResponse(HaoBanErrCode.ERR_10012); return resultResponse(HaoBanErrCode.ERR_10012);
} }
// 导购code校验-字母和数字
if (!clerkCode.matches("[a-zA-Z0-9]+")) {
return resultResponse(HaoBanErrCode.ERR_10023);
}
if(version == null){ if(version == null){
StaffDTO staff = staffApiService.selectByNationcodeAndPhoneNumber(wxEnterpriseId,nationcode,phoneNumber); StaffDTO staff = staffApiService.selectByNationcodeAndPhoneNumber(wxEnterpriseId,nationcode,phoneNumber);
if(staff != null) { if(staff != null) {
...@@ -278,7 +290,12 @@ public class ClerkController extends WebBaseController{ ...@@ -278,7 +290,12 @@ public class ClerkController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_10013); return resultResponse(HaoBanErrCode.ERR_10013);
} }
AuditSettingDTO dto = auditSettingApiService.findSettingByWxEnterpriseId(wxEnterpriseId); AuditSettingDTO dto = auditSettingApiService.findSettingByWxEnterpriseId(wxEnterpriseId);
if(dto.getClerkChangeFlag() == 1){ // 企业绑定详情-导购编辑权限
WxEnterpriseRelationDetailDTO enterpriseBindInfo = wxEnterpriseRelatedApiService
.getEnterpriseBindInfo(wxEnterpriseId, enterpriseId);
if(dto.getAuditFlag() == 1
&& dto.getClerkChangeFlag() == 1
&& enterpriseBindInfo.getClerkEditFlag() == 1) {
AuditDTO auditDTO =auditApiService.findByBindRelatedIdAndAuditType(clerkCode, AuditType.CLERK_ADD.getCode()); AuditDTO auditDTO =auditApiService.findByBindRelatedIdAndAuditType(clerkCode, AuditType.CLERK_ADD.getCode());
if(auditDTO !=null){ if(auditDTO !=null){
logger.info("已经存在了审核记录,待审核{}",clerkCode); logger.info("已经存在了审核记录,待审核{}",clerkCode);
......
...@@ -218,6 +218,8 @@ public enum HaoBanErrCode { ...@@ -218,6 +218,8 @@ public enum HaoBanErrCode {
ERR_10022(10022, "已有刷新在执行中,请不要重复刷新"), ERR_10022(10022, "已有刷新在执行中,请不要重复刷新"),
ERR_10023(10023, "code格式不正确"),
ERR_11122(11122,"手机号已存在"), ERR_11122(11122,"手机号已存在"),
ERR_11123(11123, "请到好办端刷新企业微信好友"), ERR_11123(11123, "请到好办端刷新企业微信好友"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment