Commit d3077062 by fudahua

根据手机号查看列表

parent 684979bc
...@@ -56,6 +56,12 @@ ...@@ -56,6 +56,12 @@
<artifactId>java-jwt</artifactId> <artifactId>java-jwt</artifactId>
<version>${jwt.version}</version> <version>${jwt.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-commons</artifactId>
<version>3.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
package com.gic.haoban.manage.api.dto.notify.qdto;
import java.io.Serializable;
import java.util.Map;
/**
* Created 2021/12/17.
*
* @author hua
*/
public class NoticeMessageQDTO implements Serializable {
private String enterpriseId;
private String clerkId;
private String storeId;
private int messageType;
private String templateCode;
private Map<String, String> contentMap;
/**
* 拓展内容
*/
private Map<String, Object> extendContent;
public Map<String, Object> getExtendContent() {
return extendContent;
}
public void setExtendContent(Map<String, Object> extendContent) {
this.extendContent = extendContent;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public int getMessageType() {
return messageType;
}
public void setMessageType(int messageType) {
this.messageType = messageType;
}
public String getTemplateCode() {
return templateCode;
}
public void setTemplateCode(String templateCode) {
this.templateCode = templateCode;
}
public Map<String, String> getContentMap() {
return contentMap;
}
public void setContentMap(Map<String, String> contentMap) {
this.contentMap = contentMap;
}
}
package com.gic.haoban.manage.api.enums;
/**
* Created 2021/12/17.
*
* @author hua
*/
public enum NoticeMessageCategoryTypeEnum {
ALL(-1, "全部"),
CUSTOMER(0, "客户相关"),
TASK(1, "任务相关"),
ACTIVITY(2, "活动相关"),
OTHER(3, "其它"),;
private int type;
private String name;
NoticeMessageCategoryTypeEnum(int type, String name) {
this.type = type;
this.name = name;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package com.gic.haoban.manage.api.enums;
/**
* Created by hua on 2021/12/17.
*/
public enum NoticeMessageTypeEnum {
ACTIVITY_START(1001, "活动开始通知", NoticeMessageCategoryTypeEnum.ACTIVITY.getType()),
ACTIVITY_NEW(1002, "活动上新通知", NoticeMessageCategoryTypeEnum.ACTIVITY.getType()),
ACTIVITY_DEL(1003, "活动删除通知", NoticeMessageCategoryTypeEnum.ACTIVITY.getType()),
ACTIVITY_OFFLINE(1004, "活动下线通知", NoticeMessageCategoryTypeEnum.ACTIVITY.getType()),
ACTIVITY_END(1005, "活动结束通知", NoticeMessageCategoryTypeEnum.ACTIVITY.getType()),
ACTIVITY_RANK(1006, "活动排名通知", NoticeMessageCategoryTypeEnum.ACTIVITY.getType()),
ACTIVITY_AWARD(1007, "活动奖励通知", NoticeMessageCategoryTypeEnum.ACTIVITY.getType());
/**
* 消息类型
*/
private int type;
/**
* 消息名称
*/
private String name;
/**
* 大类
*/
private int category;
NoticeMessageTypeEnum(int type, String name, int category) {
this.type = type;
this.name = name;
this.category = category;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getCategory() {
return category;
}
public void setCategory(int category) {
this.category = category;
}
}
package com.gic.haoban.manage.api.service.notify;
/**
* Created 2021/12/17.
*
* @author hua
*/
public interface NoticeMessageApiService {
public void noticeMessageMq(String json);
}
\ No newline at end of file
package com.gic.haoban.manage.api.util.notify;
import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.manage.api.dto.notify.qdto.NoticeMessageQDTO;
import com.gic.mq.sdk.GicMQClient;
import org.slf4j.Logger;
import java.util.Map;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Created 2021/12/17.
*
* @author hua
*/
public class NoticeMessageUtil {
private static final Logger logger = getLogger(NoticeMessageUtil.class);
private static final String NOTICE_MESSAGE = "haobanNoticeMessage";
/**
* 发送消息
*
* @param enterpriseId 企业id
* @param clerkId 执行人导购
* @param messageType 消息类型 NoticeMessageTypeEnum
* @param templateCode 模板code
* @param fieldMap 解析模板的字段
* @param extendField 拓展字段给前端使用 没有可以为null
*/
public static void sendNoticeMessage(String enterpriseId, String clerkId, int messageType, String templateCode, Map<String, String> fieldMap, Map<String, Object> extendField) {
NoticeMessageQDTO noticeMessageQDTO = new NoticeMessageQDTO();
noticeMessageQDTO.setEnterpriseId(enterpriseId);
noticeMessageQDTO.setClerkId(clerkId);
noticeMessageQDTO.setMessageType(messageType);
noticeMessageQDTO.setTemplateCode(templateCode);
noticeMessageQDTO.setContentMap(fieldMap);
noticeMessageQDTO.setExtendContent(extendField);
String ret = JSONObject.toJSONString(noticeMessageQDTO);
logger.info("发送消息:{}", ret);
GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
try {
clientInstance.sendMessage(NOTICE_MESSAGE, ret);
} catch (Exception e) {
logger.info("发送消息异常:{}", e);
}
}
}
package com.gic.haoban.manage.service.service.notify.out;
import com.gic.haoban.manage.api.service.notify.NoticeMessageApiService;
import org.slf4j.Logger;
import org.springframework.stereotype.Service;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Created 2021/12/17.
*
* @author hua
*/
@Service
public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
private static final Logger logger = getLogger(NoticeMessageApiServiceImpl.class);
@Override
public void noticeMessageMq(String json) {
logger.info("Notice message");
}
}
...@@ -634,8 +634,8 @@ public class ClerkController extends WebBaseController{ ...@@ -634,8 +634,8 @@ public class ClerkController extends WebBaseController{
//精确查,根据手机号或者code,查找 //精确查,根据手机号或者code,查找
@RequestMapping("query-clerk-list-by-code") @RequestMapping("query-clerk-list-by-code")
public HaobanResponse queryClerkListByCode(String keyword,String wxEnterpriseId){ public HaobanResponse queryClerkListByCode(String keyword, String wxEnterpriseId, String staffId) {
if(StringUtils.isAnyBlank(keyword,wxEnterpriseId)){ if (StringUtils.isAnyBlank(staffId, wxEnterpriseId)) {
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
} }
List<EnterpriseDetailDTO> list = wxEnterpriseRelatedApiService.listEnterpriseByWxEnterpriseId(wxEnterpriseId); List<EnterpriseDetailDTO> list = wxEnterpriseRelatedApiService.listEnterpriseByWxEnterpriseId(wxEnterpriseId);
...@@ -647,8 +647,9 @@ public class ClerkController extends WebBaseController{ ...@@ -647,8 +647,9 @@ public class ClerkController extends WebBaseController{
return !over; return !over;
}).map(s->s.getEnterpriseId()).collect(Collectors.toList()); }).map(s->s.getEnterpriseId()).collect(Collectors.toList());
List<String> storeIds = wxEnterpriseRelatedApiService.listStoreIdByWxEnterpriseId(wxEnterpriseId); List<String> storeIds = wxEnterpriseRelatedApiService.listStoreIdByWxEnterpriseId(wxEnterpriseId);
List<ClerkDTO> clerkList = clerkNewService.listClerkByEnterpriseIdAndSearch(enterpriseIdList, storeIds, keyword); List<ClerkDTO> clerkList = this.getClerkListBySearch(enterpriseIdList, storeIds, keyword, staffId);
List<ClerkStoreVO> clerkStoreList = new ArrayList<>(); // List<ClerkDTO> clerkList = clerkNewService.listClerkByEnterpriseIdAndSearch(enterpriseIdList, storeIds, keyword);
List<ClerkStoreVO> clerkStoreList = new ArrayList<>();
if(CollectionUtil.isEmpty(clerkList)){ if(CollectionUtil.isEmpty(clerkList)){
return resultResponse(HaoBanErrCode.ERR_1,clerkStoreList); return resultResponse(HaoBanErrCode.ERR_1,clerkStoreList);
} }
...@@ -685,6 +686,47 @@ public class ClerkController extends WebBaseController{ ...@@ -685,6 +686,47 @@ public class ClerkController extends WebBaseController{
} }
return resultResponse(HaoBanErrCode.ERR_1,clerkStoreList); return resultResponse(HaoBanErrCode.ERR_1,clerkStoreList);
} }
/**
* @param enterpriseIdList
* @param storeIdList
* @param search
* @param staffId
* @return
*/
private List<ClerkDTO> getClerkListBySearch(List<String> enterpriseIdList, List<String> storeIdList, String search, String staffId) {
List<ClerkDTO> ret = new ArrayList<ClerkDTO>();
if (StringUtils.isBlank(search)) {
StaffDTO staffDTO = staffApiService.selectById(staffId);
if (staffDTO != null) {
List<ClerkDTO> clerkList = clerkNewService.listClerkByEnterpriseIdAndSearch(enterpriseIdList, storeIdList, staffDTO.getPhoneNumber());
if (CollectionUtils.isEmpty(clerkList)) {
ret.addAll(clerkList);
}
}
List<StaffClerkInfoDTO> staffClerkInfoDTOS = staffClerkRelationApiService.listBindDetailByStaffId(staffId);
if (CollectionUtils.isEmpty(staffClerkInfoDTOS)) {
return ret;
}
Set<String> clerkIds = staffClerkInfoDTOS.stream().map(mid -> mid.getClerkId()).collect(Collectors.toSet());
List<ClerkDTO> clerkDTOS = clerkService.getClerkByClerkIds(clerkIds);
for (ClerkDTO clerkDTO : clerkDTOS) {
List<ClerkDTO> clerkList = clerkNewService.listClerkByEnterpriseIdAndSearch(enterpriseIdList, storeIdList, clerkDTO.getPhoneNumber());
if (CollectionUtils.isEmpty(clerkList)) {
ret.addAll(clerkList);
}
}
} else {
List<ClerkDTO> clerkList = clerkNewService.listClerkByEnterpriseIdAndSearch(enterpriseIdList, storeIdList, search);
if (CollectionUtils.isEmpty(clerkList)) {
ret.addAll(clerkList);
}
}
return ret;
}
//绑定 //绑定
@HttpLimit @HttpLimit
@RequestMapping("bind-staff") @RequestMapping("bind-staff")
......
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