Commit 719b75c2 by songyinghui

Merge branch 'bugfix_multi_area' into developer

parents faa5ccde 16525c02
...@@ -62,6 +62,11 @@ public class MaterialReportContext { ...@@ -62,6 +62,11 @@ public class MaterialReportContext {
private String clerkId; private String clerkId;
/** /**
* 是否是区经
*/
private boolean isManager;
/**
* 主门店 * 主门店
*/ */
private String mainStoreId; private String mainStoreId;
...@@ -97,8 +102,8 @@ public class MaterialReportContext { ...@@ -97,8 +102,8 @@ public class MaterialReportContext {
log.info("成员未绑定导购, staffId: {}", this.staffId); log.info("成员未绑定导购, staffId: {}", this.staffId);
return Collections.emptyList(); return Collections.emptyList();
} }
if (StringUtils.isBlank(this.mainStoreId)) { if (this.isManager) {
log.info("成员 {} 没有主门店数据, 区经角色不发送小程序消息通知 ", this.staffId); log.info("成员{}为区经角色, 不发送小程序消息通知 ", this.staffId);
return Collections.emptyList(); return Collections.emptyList();
} }
return this.staffClerkRelations return this.staffClerkRelations
......
...@@ -82,12 +82,17 @@ public class MaterialReportBuilder { ...@@ -82,12 +82,17 @@ public class MaterialReportBuilder {
if (context.getStaffClerkRelations().size() == 1) { if (context.getStaffClerkRelations().size() == 1) {
StaffClerkRelationDTO staffClerkRelationDTO = context.getStaffClerkRelations().get(0); StaffClerkRelationDTO staffClerkRelationDTO = context.getStaffClerkRelations().get(0);
if (staffClerkRelationDTO.getClerkType() != null && staffClerkRelationDTO.getClerkType() == 2) { if (staffClerkRelationDTO.getClerkType() != null && staffClerkRelationDTO.getClerkType() == 2) {
log.info("成员clerId:{}, staffId: {} 为区经角色", staffClerkRelationDTO.getClerkId(), staffClerkRelationDTO.getStaffId()); log.info("成员clerkId:{}, staffId: {} 为区经角色", staffClerkRelationDTO.getClerkId(), staffClerkRelationDTO.getStaffId());
// 区经无主门店 // 区经无主门店
context.setClerkId(staffClerkRelationDTO.getClerkId()); context.setClerkId(staffClerkRelationDTO.getClerkId());
// 是区经角色
context.setManager(true);
return; return;
} }
} }
log.info("成员{}为导购角色", context.getStaffId());
context.setManager(false);
// 获取成员主门店
TabHaobanClerkMainStoreRelated mainStoreInfo = clerkMainStoreRelatedService.getMainStoreByStaffId(context.getStaffId(), context.getStaffInfo().getWxEnterpriseId()); TabHaobanClerkMainStoreRelated mainStoreInfo = clerkMainStoreRelatedService.getMainStoreByStaffId(context.getStaffId(), context.getStaffInfo().getWxEnterpriseId());
if (mainStoreInfo != null) { if (mainStoreInfo != null) {
context.setMainStoreId(mainStoreInfo.getStoreId()); context.setMainStoreId(mainStoreInfo.getStoreId());
...@@ -96,7 +101,7 @@ public class MaterialReportBuilder { ...@@ -96,7 +101,7 @@ public class MaterialReportBuilder {
.filter(item -> StringUtils.equals(item.getStoreId(), mainStoreInfo.getStoreId())) .filter(item -> StringUtils.equals(item.getStoreId(), mainStoreInfo.getStoreId()))
.findFirst(); .findFirst();
if (!mainClerkInfo.isPresent()) { if (!mainClerkInfo.isPresent()) {
log.info("成员{}与主门店{}不存在导购关联关系", context.getStaffId(), context.getMainStoreId()); log.info("成员{}的主门店{}不在当前企业{}的绑定关系中", context.getStaffId(), context.getMainStoreId(), context.getEnterpriseId());
return; return;
} }
// 成员在主门店时的clerkId // 成员在主门店时的clerkId
...@@ -111,6 +116,10 @@ public class MaterialReportBuilder { ...@@ -111,6 +116,10 @@ public class MaterialReportBuilder {
*/ */
public void buildMaterialReportData(MaterialReportContext context) { public void buildMaterialReportData(MaterialReportContext context) {
// 获取该导购/店长/区经 的周报/月报数据 // 获取该导购/店长/区经 的周报/月报数据
if (StringUtils.isBlank(context.getClerkId())) {
log.info("成员{} 默认主门店的clerkId不存在 不发送应用消息", context.getStaffId());
return;
}
String clerkId = context.getClerkId(); String clerkId = context.getClerkId();
String enterpriseId = context.getEnterpriseId(); String enterpriseId = context.getEnterpriseId();
MaterialDataAdaptor.MaterialDataResult materialDataResult; MaterialDataAdaptor.MaterialDataResult materialDataResult;
......
...@@ -18,6 +18,7 @@ import com.gic.wechat.api.dto.qywx.QywxNewsSendMessageDTO; ...@@ -18,6 +18,7 @@ import com.gic.wechat.api.dto.qywx.QywxNewsSendMessageDTO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService; import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -90,6 +91,10 @@ public class MaterialReportServiceImpl implements MaterialReportService { ...@@ -90,6 +91,10 @@ public class MaterialReportServiceImpl implements MaterialReportService {
if (CollectionUtils.isNotEmpty(noticeMessageBos)) { if (CollectionUtils.isNotEmpty(noticeMessageBos)) {
noticeMessageService.addNoticeMessageBatch(noticeMessageBos); noticeMessageService.addNoticeMessageBatch(noticeMessageBos);
} }
if (StringUtils.isBlank(context.getClerkId())) {
log.info("成员{}在企业{}中不存在主门店, 不推送企微应用消息", staffId, enterpriseId);
return;
}
// 发送企微消息 // 发送企微消息
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(staffInfo.getWxEnterpriseId()); WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(staffInfo.getWxEnterpriseId());
QywxNewsSendMessageDTO newsSendMessageDTO = materialReportBuilder.buildQywxNewsMessage(context, qwDTO); QywxNewsSendMessageDTO newsSendMessageDTO = materialReportBuilder.buildQywxNewsMessage(context, qwDTO);
......
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