Commit 9da8cd9d by fudahua

Merge remote-tracking branch 'origin/master'

parents c73a354d 6e0afeae
......@@ -6,6 +6,7 @@
<groupId>com.gic</groupId>
<artifactId>gic-pom-base</artifactId>
<version>3.0-SNAPSHOT</version>
<relativePath/>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -6,7 +6,8 @@ package com.gic.haoban.manage.api.enums;
public enum AlertTypeEnum {
QYWX_TAG_SYNC(1, "企微标签同步", null),
QUNFA_MESSAGE(2, "企微群发", null),
FRIEND_ADD(3, "企微好友添加", null),;
FRIEND_ADD(3, "企微好友添加", null),
CLOUD_STORE_CHANGE(4, "观云台门店进回收站", null),;
private Integer type;
private String name;
private String dingUrl;
......
......@@ -21,7 +21,7 @@ public enum AppPageType {
//分配会员
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"),
//我的关联记录
......@@ -34,9 +34,9 @@ public enum AppPageType {
FACE_ARRIVAL(14, "hbapp_customer_bind_faceId"),
//完善标签
PERFECT_TAG(15, "hbapp_customer_edit_tag"),
//销售线索任务列表
MARKET_CLUE_TASK(16, "hbapp_sales_lead_main"),
//话务任务逾期提醒
//销售线索任务列表(hbapp_sales_lead_main废弃,改为新的hbapp_marketing_task_list)
MARKET_CLUE_TASK(16, "hbapp_marketing_task_list"),
//话务任务
TEL_WITHIN_TIME_LIMIT(17, "hbapp_marketing_task_list"),
;
......
package com.gic.haoban.manage.api.service;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import java.util.List;
import java.util.Map;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
public interface StaffDepartmentRelatedApiService {
......@@ -31,12 +31,20 @@ public interface StaffDepartmentRelatedApiService {
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);
/**
* 单人消息发送通用方法
......@@ -50,16 +58,16 @@ public interface StaffDepartmentRelatedApiService {
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);
public void sendClerkBind(String staffId,String clerkCode,String storeId,int auditStatus,String auditReason);
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);
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 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 @@
<groupId>com.gic</groupId>
<artifactId>gic-pom-base</artifactId>
<version>3.0-SNAPSHOT</version>
<relativePath/>
</parent>
<modelVersion>4.0.0</modelVersion>
......@@ -14,8 +15,6 @@
<packaging>war</packaging>
<name>haoban-manage3-operation-web Maven Webapp</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
......
......@@ -2,30 +2,28 @@ package com.gic.haoban.manage.web.controller.test;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.CheckContainUtil;
import com.gic.commons.util.GICMQClientUtil;
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.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.TestService;
import com.gic.haoban.manage.web.controller.WebBaseController;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.TestQo;
import com.gic.haoban.manage.web.vo.TestVo;
import com.gic.haoban.manage.web.qo.QywxTagSyncInfoQo;
import com.gic.mq.sdk.GicMQClient;
import com.gic.sharing.core.service.api.service.MqApiService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
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.ResponseBody;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static org.slf4j.LoggerFactory.getLogger;
......@@ -44,6 +42,12 @@ public class TestController extends WebBaseController {
@Autowired
private MqApiService mqApiService;
@Autowired
private StaffApiService staffApiService;
@Autowired
private DealSyncOperationApiService dealSyncOperationApiService;
//
// @RequestMapping("/testList")
// @ResponseBody
......@@ -135,4 +139,56 @@ public class TestController extends WebBaseController {
}
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 @@
<dubbo:reference interface="com.gic.haoban.manage.api.service.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"
id="mqApiService"/>
......
......@@ -6,6 +6,7 @@
<groupId>com.gic</groupId>
<artifactId>gic-pom-base</artifactId>
<version>3.0-SNAPSHOT</version>
<relativePath/>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -51,6 +51,6 @@ public interface StaffClerkBindLogMapper {
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);
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);
}
\ No newline at end of file
......@@ -193,4 +193,12 @@ public interface TabHaobanExternalClerkRelatedMapper {
* @return
*/
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 {
*/
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;
import java.util.List;
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 com.alibaba.dubbo.config.annotation.Service;
......@@ -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.service.ExternalClerkRelatedService;
import static org.slf4j.LoggerFactory.getLogger;
@Service
public class ExternalClerkRelatedServiceImpl implements ExternalClerkRelatedService {
private static final Logger logger = getLogger(ExternalClerkRelatedServiceImpl.class);
@Autowired
private TabHaobanExternalClerkRelatedMapper mapper;
@Autowired
private ESDataDynamicOperationApiService esDataDynamicOperationApiService;
@Autowired
private MemberService memberService;
@Override
public void insert(TabHaobanExternalClerkRelated related) {
String clerkId = related.getClerkId();
......@@ -110,4 +128,38 @@ public class ExternalClerkRelatedServiceImpl implements ExternalClerkRelatedServ
public List<TabHaobanExternalClerkRelated> listExternalByExternalUserid(String wxEnterpriseId, String 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 {
@Override
public Page<StaffClerkBindLogDetailDTO> pageUnBindLog(String wxEnterpriseId, String clerkId, String enterpriseId, int optType, BasePageInfo 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);
return retPage;
}
......
......@@ -136,7 +136,8 @@ public class CheckQywxSettingApiServiceImpl implements CheckQywxSettingApiServic
}
//告警是否拦截重复告警 防止批量触发
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);
if (!b) {
return;
......
......@@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil;
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.QywxSyncTaskTypeEnum;
import com.gic.haoban.base.api.common.BasePageInfo;
......@@ -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.TabHaobanExternalClerkRelated;
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.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.PageInfo;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
......@@ -217,4 +231,5 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
List<TabHaobanExternalClerkRelated> list = tabHaobanExternalClerkRelatedMapper.listByMemberId(memberId);
return EntityUtil.changeEntityListNew(ExternalClerkRelatedShortInfoDTO.class, list);
}
}
......@@ -677,9 +677,13 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
logger.info("该企业下没有配置需要同步的:{},{}", externalUserId, clerkRelated.getEnterpriseId());
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<>();
if (!CollectionUtils.isEmpty(gicItems)) {
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 {
logger.info("该企业会员需要打的标签:{}", JSONObject.toJSONString(entMemberNeedSetQywxKeys));
//更新标签 会自动同步
if (CollectionUtils.isEmpty(saveTagIds)) {
saveMemberTags(new HashSet<>(), clerkRelated.getEnterpriseId(), clerkRelated.getMemberId(), clerkRelated.getClerkId());
saveMemberTags(new HashSet<>(), clerkRelated.getEnterpriseId(), memberId, clerkRelated.getClerkId());
} else {
saveMemberTags(saveTagIds, clerkRelated.getEnterpriseId(), clerkRelated.getMemberId(), clerkRelated.getClerkId());
saveMemberTags(saveTagIds, clerkRelated.getEnterpriseId(), memberId, clerkRelated.getClerkId());
}
// hasSaveMemberId.add(clerkRelated.getMemberId());
// //同步企业的标签到企业微信
......
......@@ -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.TabHaobanStaffClerkRelationMapper;
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.TabHaobanStaffDepartmentRelated;
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.wechat.api.dto.qywx.ItemDTO;
import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO;
......@@ -37,7 +35,7 @@ import java.util.*;
@Service
public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRelatedApiService {
private static Logger logger= LoggerFactory.getLogger(StaffDepartmentRelatedApiServiceImpl.class);
private static final Logger logger = LoggerFactory.getLogger(StaffDepartmentRelatedApiServiceImpl.class);
@Autowired
private StaffDepartmentRelatedService staffDepartmentRelatedService;
......@@ -50,10 +48,6 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
@Autowired
private WxEnterpriseMapper wxEnterpriseMapper;
@Autowired
private WxEnterpriseRelatedMapper wxEnterpriseRelatedMapper;
@Autowired
private DepartmentService departmentService;
@Autowired
private Config config;
@Autowired
private TabHaobanStaffClerkRelationMapper tabHaobanStaffClerkRelationMapper;
......@@ -61,20 +55,19 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
private StaffApiService staffApiService;
@Override
public List<StaffDepartmentRelatedDTO> listByDepartmentId(
String departmentId) {
public List<StaffDepartmentRelatedDTO> listByDepartmentId(String departmentId) {
List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listByDepartmentId(departmentId);
List<StaffDepartmentRelatedDTO> resultList = EntityUtil.changeEntityListByJSON(StaffDepartmentRelatedDTO.class, list);
return resultList;
}
@Override
public List<StaffDepartmentRelatedDTO> listByDepartmentIds(
List<String> departmentIds) {
public List<StaffDepartmentRelatedDTO> listByDepartmentIds(List<String> departmentIds) {
List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedMapper.listByDepartmentIds(departmentIds);
List<StaffDepartmentRelatedDTO> resultList = EntityUtil.changeEntityListByJSON(StaffDepartmentRelatedDTO.class, list);
return resultList;
}
@Override
public void updateById(StaffDepartmentRelatedDTO dto) {
TabHaobanStaffDepartmentRelated tab = EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, dto);
......@@ -187,13 +180,13 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
String wxUserId = staffDTO.getWxUserId();
String corpId = tabHaobanWxEnterprise.getCorpid();
String name = staffDTO.getStaffName();
if(content.length()>30){
if (content.length() > 30) {
content = content.substring(0, 26);
content = content+"...";
content = content + "...";
}
//先发送下,试试
QywxXcxSendMessageDTO messageDTO = new QywxXcxSendMessageDTO();
List<ItemDTO> items = new ArrayList();;
List<ItemDTO> items = new ArrayList();
ItemDTO dto1 = new ItemDTO();
ItemDTO dto2 = new ItemDTO();
ItemDTO dto3 = new ItemDTO();
......@@ -269,17 +262,18 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
}
//导购删除,,审核记录,,消息发送
public void sendClerkDel (String clerkName,String clerkCode,String storeId,int auditStatus,String auditReason){
@Override
public void sendClerkDel(String clerkName, String clerkCode, String storeId, int auditStatus, String auditReason) {
//TODO huang 发送店长,门店关联记录列表
String messageTitle = "门店导购变更";
String messageContent ="删除导购:"+ clerkName+"("+clerkCode+")";
String messageContent = "删除导购:" + clerkName + "(" + clerkCode + ")";
JSONObject jsonObject = new JSONObject();
jsonObject.put("storeId", storeId);
String data = jsonObject.toJSONString();
ClerkDTO gicClerk = clerkService.getClerkLeaderByStoreId(storeId);
if(gicClerk == null){
logger.info("店长不存在,发送消息失败{}",storeId);
return ;
if (gicClerk == null) {
logger.info("店长不存在,发送消息失败{}", storeId);
return;
}
TabHaobanStaffClerkRelation tab = tabHaobanStaffClerkRelationMapper.getOneByClerkId(gicClerk.getClerkId());
if(tab == null){
......@@ -301,17 +295,17 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
String corpId = map.get("corpId");
String name = map.get("clerkName");
if(jodd.util.StringUtil.isEmpty(wxUserId)){
logger.info("wxUserId不存在============clerkId={}",clerkId);
if (jodd.util.StringUtil.isEmpty(wxUserId)) {
logger.info("wxUserId不存在============clerkId={}", clerkId);
return false;
}
if(content.length()>30){
if (content.length() > 30) {
content = content.substring(0, 26);
content = content+"...";
content = content + "...";
}
//先发送下,试试
QywxXcxSendMessageDTO messageDTO = new QywxXcxSendMessageDTO();
List<ItemDTO> items = new ArrayList();;
List<ItemDTO> items = new ArrayList();
ItemDTO dto1 = new ItemDTO();
ItemDTO dto2 = new ItemDTO();
dto1.setKey("接收人");
......@@ -391,22 +385,22 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
@Override
public boolean sendAuditMessage(String staffId, String title,
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 corpId = map.get("corpId");
String name = map.get("staffName");
if(jodd.util.StringUtil.isEmpty(wxUserId)){
logger.info("wxUserId不存在============clerkId={}",staffId);
if (StringUtils.isEmpty(wxUserId)) {
logger.info("wxUserId不存在============clerkId={}", staffId);
return false;
}
if(content.length()>30){
if (content.length() > 30) {
content = content.substring(0, 26);
content = content+"...";
content = content + "...";
}
//先发送下,试试
QywxXcxSendMessageDTO messageDTO = new QywxXcxSendMessageDTO();
List<ItemDTO> items = new ArrayList();;
List<ItemDTO> items = new ArrayList();
ItemDTO dto1 = new ItemDTO();
ItemDTO dto2 = new ItemDTO();
ItemDTO dto3 = new ItemDTO();
......@@ -440,6 +434,7 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
logger.info("发送===============》{}",b);
return b;
}
@Override
public String getPageUrl(int type, String data) {
String baseUrl = "/pages/route/index";
......
......@@ -215,7 +215,7 @@
</if>
order by create_time desc
</select>
<select id="StaffClerkUnBindLog" resultMap="BaseResultMap">
<select id="staffClerkUnBindLog" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_staff_clerk_bind_log
......
......@@ -437,7 +437,11 @@
and audit_type = 3
and audit_status = 0
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>
</mapper>
\ No newline at end of file
......@@ -573,4 +573,15 @@
and status_flag = 1
and external_user_id = #{externalUserId}
</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>
\ No newline at end of file
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.entity.TabHaobanOperationSetting;
import com.gic.haoban.manage.service.service.ExternalClerkRelatedService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -22,14 +24,13 @@ public class TestOperDatabase {
@Autowired
private TabHaobanOperationSettingMapper tabHaobanOperationSettingMapper;
@Autowired
private ExternalClerkRelatedService externalClerkRelatedService;
@Test
public void testOperSetting() {
TabHaobanOperationSetting setting = new TabHaobanOperationSetting();
setting.setClerkPhoneFlag(1);
setting.setCreateTime(new Date());
setting.setSettingId(UuidUtil.randomUUID());
setting.setWxEnterpriseId("123123");
tabHaobanOperationSettingMapper.insert(setting);
String s = externalClerkRelatedService.checkAndUpdateMemberByUnonId("ff8080815dacd3a2015dacd3ef5c0000", "ff8080817b95cd7e017b95f2c0ec009d", "orXl9t9_320bmRutZoL8YEpPAc00");
System.out.println(s);
}
}
......@@ -6,17 +6,14 @@
<groupId>com.gic</groupId>
<artifactId>gic-pom-base</artifactId>
<version>3.0-SNAPSHOT</version>
<relativePath/>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>haoban-manage3-web</artifactId>
<version>${libraryVersion}</version>
<packaging>war</packaging>
<name>haoban-manage3-web Maven Webapp</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<haobanService>1.0-SNAPSHOT</haobanService>
......
......@@ -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.web.anno.HttpLimit;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -30,7 +31,7 @@ public class SettingController extends WebBaseController {
private HaobanResponse operationSettingSaveOrUpdate(OperationSettingDTO dto) {
// 保存或更新操作设置
if (Objects.isNull(dto)
|| Objects.isNull(dto.getWxEnterpriseId())) {
|| StringUtils.isEmpty(dto.getWxEnterpriseId())) {
return resultResponse(HaoBanErrCode.ERR_2);
}
operationSettingApiService.saveOrUpdate(dto);
......
......@@ -9,19 +9,22 @@
http://www.springframework.org/schema/context/spring-context.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:protocol name="dubbo" port="30009"/>
<!-- 使用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://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.StaffClerkRelationApiService" id="staffClerkRelationApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService" id="wxEnterpriseRelatedApiService" />
<dubbo:reference interface="com.gic.haoban.manage.api.service.StaffApiService" id="staffApiService"
timeout="15000"/>
<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.WxEnterpriseApiService" id="wxEnterpriseApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService"
......
......@@ -6,6 +6,7 @@
<groupId>com.gic</groupId>
<artifactId>gic-pom-base</artifactId>
<version>3.0-SNAPSHOT</version>
<relativePath/>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -112,10 +112,12 @@ public class AuditController extends WebBaseController {
List<StaffClerkBindLogDetailDTO> list = page.getResult();
List<StaffClerkBindLogDetailVO> voList = new ArrayList<StaffClerkBindLogDetailVO>();
for (StaffClerkBindLogDetailDTO staffClerkBindLogDetailDTO : list) {
if (staffClerkBindLogDetailDTO.getChannelCode() != ChannelCodeEnum.AUDIT_BIND.getCode()) {
StaffClerkBindLogDetailVO vo = EntityUtil.changeEntityByJSON(StaffClerkBindLogDetailVO.class, staffClerkBindLogDetailDTO);
vo.setUnbindReason(ChannelCodeEnum.getNameByCode(vo.getChannelCode()));
voList.add(vo);
}
}
Page<StaffClerkBindLogDetailVO> pageVO = new Page<>();
pageVO.setCurrentPage(page.getCurrentPage());
pageVO.setPageSize(page.getPageSize());
......
......@@ -225,7 +225,11 @@ public class ClerkController extends WebBaseController{
// 查询操作配置
OperationSettingDTO dto = operationSettingApiService.getByWxEnterpriseId(wxEnterpriseId);
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);
// 是否开启导购编辑,如果不开启,默认无效
......@@ -249,12 +253,20 @@ public class ClerkController extends WebBaseController{
String nationcode = staffDTO.getNationCode();
String postion = staffDTO.getPostion();
Integer sex = staffDTO.getSex();
if(StringUtils.isAnyBlank(staffName,phoneNumber,commitName)) {
if(StringUtils.isAnyBlank(staffName, commitName)) {
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);
}
// 导购code校验-字母和数字
if (!clerkCode.matches("[a-zA-Z0-9]+")) {
return resultResponse(HaoBanErrCode.ERR_10023);
}
if(version == null){
StaffDTO staff = staffApiService.selectByNationcodeAndPhoneNumber(wxEnterpriseId,nationcode,phoneNumber);
if(staff != null) {
......@@ -278,7 +290,12 @@ public class ClerkController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_10013);
}
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());
if(auditDTO !=null){
logger.info("已经存在了审核记录,待审核{}",clerkCode);
......
......@@ -218,6 +218,8 @@ public enum HaoBanErrCode {
ERR_10022(10022, "已有刷新在执行中,请不要重复刷新"),
ERR_10023(10023, "code格式不正确"),
ERR_11122(11122,"手机号已存在"),
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