Commit 9d346334 by guojx

Merge remote-tracking branch 'origin/developer' into developer

parents ad65461b f21b6fe9
...@@ -150,7 +150,7 @@ public class StaffClerkRelationDTO implements Serializable { ...@@ -150,7 +150,7 @@ public class StaffClerkRelationDTO implements Serializable {
public Integer getOpenConcatFlag() { public Integer getOpenConcatFlag() {
if(null == openConcatFlag) { if(null == openConcatFlag) {
return 0 ; return 1 ;
} }
return openConcatFlag; return openConcatFlag;
} }
......
...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.api.dto.hm; ...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.api.dto.hm;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* *
...@@ -17,6 +18,7 @@ public class HmLinkWxaDTO implements Serializable { ...@@ -17,6 +18,7 @@ public class HmLinkWxaDTO implements Serializable {
private static final long serialVersionUID = 6473795387449522116L; private static final long serialVersionUID = 6473795387449522116L;
private Long pageId ; private Long pageId ;
private Long hmId ;
private HmPageDTO page; private HmPageDTO page;
// 二维码 // 二维码
private String hmQrcode; private String hmQrcode;
...@@ -29,7 +31,15 @@ public class HmLinkWxaDTO implements Serializable { ...@@ -29,7 +31,15 @@ public class HmLinkWxaDTO implements Serializable {
// 推荐的门店列表 // 推荐的门店列表
private List<HmLinkStoreDTO> storeList; private List<HmLinkStoreDTO> storeList;
// 说明 // 说明
private String sm ; private Map<String,String> remarkMap ;
public Long getHmId() {
return hmId;
}
public void setHmId(Long hmId) {
this.hmId = hmId;
}
public HmPageDTO getPage() { public HmPageDTO getPage() {
return page; return page;
...@@ -47,12 +57,13 @@ public class HmLinkWxaDTO implements Serializable { ...@@ -47,12 +57,13 @@ public class HmLinkWxaDTO implements Serializable {
this.pageId = pageId; this.pageId = pageId;
} }
public String getSm() {
return sm; public Map<String, String> getRemarkMap() {
return remarkMap;
} }
public void setSm(String sm) { public void setRemarkMap(Map<String, String> remarkMap) {
this.sm = sm; this.remarkMap = remarkMap;
} }
public String getHmQrcode() { public String getHmQrcode() {
......
package com.gic.haoban.manage.api.service.hm; package com.gic.haoban.manage.api.service.hm;
import java.util.List;
import com.gic.api.base.commons.BasePageInfo; import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
...@@ -11,6 +9,8 @@ import com.gic.haoban.manage.api.dto.hm.HmQrcodeStoreDTO; ...@@ -11,6 +9,8 @@ import com.gic.haoban.manage.api.dto.hm.HmQrcodeStoreDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeListQDTO; import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeListQDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeQDTO; import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeQDTO;
import java.util.List;
/** /**
* @author mozhu * @author mozhu
* @date 2022/7/5 09:33 * @date 2022/7/5 09:33
...@@ -88,7 +88,7 @@ public interface HmQrcodeApiService { ...@@ -88,7 +88,7 @@ public interface HmQrcodeApiService {
* @author mozhu * @author mozhu
* @date 2022-07-06 15:39:01 * @date 2022-07-06 15:39:01
*/ */
ServiceResponse delByClerkId(String clerkId,String enterpriseId); ServiceResponse delByClerkId(String clerkId,String enterpriseId,String wxEnterpriseId);
/** /**
...@@ -220,4 +220,6 @@ public interface HmQrcodeApiService { ...@@ -220,4 +220,6 @@ public interface HmQrcodeApiService {
*/ */
ServiceResponse<List<String>> listHmIdForIndex(HmQrcodeListQDTO qdto) ; ServiceResponse<List<String>> listHmIdForIndex(HmQrcodeListQDTO qdto) ;
ServiceResponse<List<String>> listHasQrcodeClerk(String enterpriseId , List<String> clerkIdList) ;
} }
...@@ -129,5 +129,16 @@ public interface TabHaobanHmClerkRelationMapper { ...@@ -129,5 +129,16 @@ public interface TabHaobanHmClerkRelationMapper {
* @return * @return
*/ */
TabHaobanHmClerkRelation getHmClerkByHmIdAndStaffId(@Param("hmId") Long hmId, @Param("staffId") String staffId); TabHaobanHmClerkRelation getHmClerkByHmIdAndStaffId(@Param("hmId") Long hmId, @Param("staffId") String staffId);
/**
* 更新状态通过id
*
* @param status
* @param relationId
* @return int
* @author mozhu
* @date 2022-07-21 16:32:43
*/
int updateStatusById(@Param("status") Integer status, @Param("relationId") Long relationId);
} }
...@@ -168,7 +168,7 @@ public interface TabHaobanHmQrcodeMapper { ...@@ -168,7 +168,7 @@ public interface TabHaobanHmQrcodeMapper {
* @author mozhu * @author mozhu
* @date 2022-07-12 17:39:12 * @date 2022-07-12 17:39:12
*/ */
List<HmQrcodeGroupNumBO> getGroupIdNumByEnterpriseId(@Param("enterpriseId") String enterpriseId,@Param("groupIds") List<Long> groupIds, @Param("hmIds") List<String> hmIds); List<HmQrcodeGroupNumBO> getGroupIdNumByEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("enterpriseId") String enterpriseId,@Param("groupIds") List<Long> groupIds, @Param("hmIds") List<String> hmIds);
/** /**
* 获取总数 * 获取总数
...@@ -178,7 +178,7 @@ public interface TabHaobanHmQrcodeMapper { ...@@ -178,7 +178,7 @@ public interface TabHaobanHmQrcodeMapper {
* @author mozhu * @author mozhu
* @date 2022-07-12 15:10:09 * @date 2022-07-12 15:10:09
*/ */
int getTotalByEnterpriseId(@Param("enterpriseId") String enterpriseId, @Param("hmIds") List<String> hmIds); int getTotalByEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("enterpriseId") String enterpriseId, @Param("hmIds") List<String> hmIds);
/** /**
* 批量修改 活码所属分组 * 批量修改 活码所属分组
...@@ -206,5 +206,17 @@ public interface TabHaobanHmQrcodeMapper { ...@@ -206,5 +206,17 @@ public interface TabHaobanHmQrcodeMapper {
List<String> getHmStoreForWxa(@Param("enterpriseId") String enterpriseId); List<String> getHmStoreForWxa(@Param("enterpriseId") String enterpriseId);
List<String> listHmIdForIndex(HmQrcodeListQDTO qdto); List<String> listHmIdForIndex(HmQrcodeListQDTO qdto);
/**
*
* @Title: listHasQrcodeClerk
* @Description: 返回已有单人活码的clerkId
* @author xugh
* @param enterpriseId
* @param clerkId
* @return
* @throws
*/
List<String> listHasQrcodeClerk(@Param("enterpriseId")String enterpriseId , @Param("clerkIdList")List<String> clerkIdList) ;
} }
...@@ -147,4 +147,16 @@ public interface HmClerkRelationService { ...@@ -147,4 +147,16 @@ public interface HmClerkRelationService {
*/ */
HmClerkRelationBO getHmClerkByHmIdAndStaffId(Long hmId,String staffId); HmClerkRelationBO getHmClerkByHmIdAndStaffId(Long hmId,String staffId);
/**
* 更新状态通过id
*
* @param status 状态
* @param relationId 关系id
* @return int
* @author mozhu
* @date 2022-07-21 16:32:14
*/
int updateStatusById(Integer status, Long relationId);
} }
package com.gic.haoban.manage.service.service.hm; package com.gic.haoban.manage.service.service.hm;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeListQDTO; import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeListQDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeQDTO; import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeQDTO;
import com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeBO; import com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeBO;
...@@ -10,6 +9,8 @@ import com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeGroupNumBO; ...@@ -10,6 +9,8 @@ import com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeGroupNumBO;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param;
/** /**
* 活码(TabHaobanHmQrcode)表服务接口 * 活码(TabHaobanHmQrcode)表服务接口
...@@ -157,7 +158,7 @@ public interface HmQrcodeService { ...@@ -157,7 +158,7 @@ public interface HmQrcodeService {
* @author mozhu * @author mozhu
* @date 2022-07-12 17:38:43 * @date 2022-07-12 17:38:43
*/ */
List<HmQrcodeGroupNumBO> getGroupIdNumByEnterpriseId(String enterpriseId,List<Long> groupIds, List<String> hmIds); List<HmQrcodeGroupNumBO> getGroupIdNumByEnterpriseId(String wxEnterpriseId, String enterpriseId, List<Long> groupIds, List<String> hmIds);
/** /**
* 获取总数 * 获取总数
...@@ -167,7 +168,7 @@ public interface HmQrcodeService { ...@@ -167,7 +168,7 @@ public interface HmQrcodeService {
* @author mozhu * @author mozhu
* @date 2022-07-12 15:08:35 * @date 2022-07-12 15:08:35
*/ */
int getTotalByEnterpriseId(String enterpriseId, List<String> hmIds); int getTotalByEnterpriseId(String wxEnterpriseId, String enterpriseId, List<String> hmIds);
/** /**
* 批量修改活码分组 * 批量修改活码分组
...@@ -185,4 +186,6 @@ public interface HmQrcodeService { ...@@ -185,4 +186,6 @@ public interface HmQrcodeService {
List<String> getHmStoreForWxa(String enterpriseId); List<String> getHmStoreForWxa(String enterpriseId);
List<String> listHmIdForIndex(HmQrcodeListQDTO qdto); List<String> listHmIdForIndex(HmQrcodeListQDTO qdto);
List<String> listHasQrcodeClerk(String enterpriseId , List<String> clerkIdList) ;
} }
...@@ -106,4 +106,9 @@ public class HmClerkRelationServiceImpl implements HmClerkRelationService { ...@@ -106,4 +106,9 @@ public class HmClerkRelationServiceImpl implements HmClerkRelationService {
public HmClerkRelationBO getHmClerkByHmIdAndStaffId(Long hmId, String staffId) { public HmClerkRelationBO getHmClerkByHmIdAndStaffId(Long hmId, String staffId) {
return EntityUtil.changeEntityByOrika(HmClerkRelationBO.class,tabHaobanHmClerkRelationMapper.getHmClerkByHmIdAndStaffId(hmId,staffId)); return EntityUtil.changeEntityByOrika(HmClerkRelationBO.class,tabHaobanHmClerkRelationMapper.getHmClerkByHmIdAndStaffId(hmId,staffId));
} }
@Override
public int updateStatusById(Integer status, Long relationId) {
return tabHaobanHmClerkRelationMapper.updateStatusById(status,relationId);
}
} }
...@@ -123,13 +123,13 @@ public class HmQrcodeServiceImpl implements HmQrcodeService { ...@@ -123,13 +123,13 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
} }
@Override @Override
public List<HmQrcodeGroupNumBO> getGroupIdNumByEnterpriseId(String enterpriseId, List<Long> groupIds, List<String> hmIds) { public List<HmQrcodeGroupNumBO> getGroupIdNumByEnterpriseId(String wxEnterpriseId, String enterpriseId, List<Long> groupIds, List<String> hmIds) {
return tabHaobanHmQrcodeMapper.getGroupIdNumByEnterpriseId(enterpriseId, groupIds, hmIds); return tabHaobanHmQrcodeMapper.getGroupIdNumByEnterpriseId(wxEnterpriseId, enterpriseId, groupIds, hmIds);
} }
@Override @Override
public int getTotalByEnterpriseId(String enterpriseId, List<String> hmIds) { public int getTotalByEnterpriseId(String wxEnterpriseId, String enterpriseId, List<String> hmIds) {
return tabHaobanHmQrcodeMapper.getTotalByEnterpriseId(enterpriseId, hmIds); return tabHaobanHmQrcodeMapper.getTotalByEnterpriseId(wxEnterpriseId, enterpriseId, hmIds);
} }
@Override @Override
...@@ -180,4 +180,9 @@ public class HmQrcodeServiceImpl implements HmQrcodeService { ...@@ -180,4 +180,9 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
return tabHaobanHmQrcodeMapper.listHmIdForIndex(qdto) ; return tabHaobanHmQrcodeMapper.listHmIdForIndex(qdto) ;
} }
@Override
public List<String> listHasQrcodeClerk(String enterpriseId, List<String> clerkIdList) {
return this.tabHaobanHmQrcodeMapper.listHasQrcodeClerk(enterpriseId, clerkIdList);
}
} }
...@@ -82,7 +82,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -82,7 +82,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
staffClerkBindLogService.pushToMq(clerkRelation.getStaffId(), optStaffId, BindTypeEnum.UNBIND.getVal(), chanelCode, clerkRelation.getStaffClerkRelationId()); staffClerkBindLogService.pushToMq(clerkRelation.getStaffId(), optStaffId, BindTypeEnum.UNBIND.getVal(), chanelCode, clerkRelation.getStaffClerkRelationId());
//废弃活码 //废弃活码
hmQrcodeApiService.delByClerkId(clerkId, clerkRelation.getEnterpriseId()); hmQrcodeApiService.delByClerkId(clerkId, clerkRelation.getEnterpriseId(),clerkRelation.getWxEnterpriseId());
} }
return b; return b;
} }
...@@ -133,6 +133,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -133,6 +133,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
Date now = new Date(); Date now = new Date();
dto.setStaffClerkRelationId(ToolUtil.randomUUID()); dto.setStaffClerkRelationId(ToolUtil.randomUUID());
dto.setStatusFlag(1); dto.setStatusFlag(1);
dto.setOpenConcatFlag(1);
dto.setCreateTime(now); dto.setCreateTime(now);
dto.setUpdateTime(now); dto.setUpdateTime(now);
int insert = mapper.insert(EntityUtil.changeEntityByJSON(TabHaobanStaffClerkRelation.class, dto)); int insert = mapper.insert(EntityUtil.changeEntityByJSON(TabHaobanStaffClerkRelation.class, dto));
...@@ -189,6 +190,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -189,6 +190,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
staffClerkRelation.setCreateTime(new Date()); staffClerkRelation.setCreateTime(new Date());
staffClerkRelation.setUpdateTime(new Date()); staffClerkRelation.setUpdateTime(new Date());
staffClerkRelation.setStatusFlag(1); staffClerkRelation.setStatusFlag(1);
staffClerkRelation.setOpenConcatFlag(1);
TabHaobanStaffClerkRelation relation = EntityUtil.changeEntityByJSON(TabHaobanStaffClerkRelation.class, staffClerkRelation); TabHaobanStaffClerkRelation relation = EntityUtil.changeEntityByJSON(TabHaobanStaffClerkRelation.class, staffClerkRelation);
mapper.insert(relation); mapper.insert(relation);
return uuid; return uuid;
......
...@@ -52,11 +52,13 @@ import com.gic.haoban.manage.service.exception.WxApiLimitException; ...@@ -52,11 +52,13 @@ import com.gic.haoban.manage.service.exception.WxApiLimitException;
import com.gic.haoban.manage.service.pojo.DealQywxExternalUserPojo; import com.gic.haoban.manage.service.pojo.DealQywxExternalUserPojo;
import com.gic.haoban.manage.service.pojo.ExternalUserPojo; import com.gic.haoban.manage.service.pojo.ExternalUserPojo;
import com.gic.haoban.manage.service.pojo.QywxTagSyncInfoPojo; import com.gic.haoban.manage.service.pojo.QywxTagSyncInfoPojo;
import com.gic.haoban.manage.service.pojo.bo.hm.HmLinkBO;
import com.gic.haoban.manage.service.pojo.bo.hm.KeyDataLinkBO; import com.gic.haoban.manage.service.pojo.bo.hm.KeyDataLinkBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeDetailBO; import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeDetailBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeMediaBO; import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeMediaBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeReferBO; import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeReferBO;
import com.gic.haoban.manage.service.service.*; import com.gic.haoban.manage.service.service.*;
import com.gic.haoban.manage.service.service.hm.HmLinkService;
import com.gic.haoban.manage.service.service.hm.WxUserAddLogService; import com.gic.haoban.manage.service.service.hm.WxUserAddLogService;
import com.gic.haoban.manage.service.util.CommonUtil; import com.gic.haoban.manage.service.util.CommonUtil;
import com.gic.haoban.manage.service.util.EmojiFilterUtil; import com.gic.haoban.manage.service.util.EmojiFilterUtil;
...@@ -164,6 +166,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -164,6 +166,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
private KeyDataService keyDataService; private KeyDataService keyDataService;
@Autowired @Autowired
private MemberTagOpenApiService memberTagOpenApiService; private MemberTagOpenApiService memberTagOpenApiService;
@Autowired
private HmLinkService hmLinkService;
@Override @Override
public void dealQywxExternalUser(String params) { public void dealQywxExternalUser(String params) {
...@@ -315,7 +319,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -315,7 +319,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
String externalUserId = dto.getExternalUserid(); String externalUserId = dto.getExternalUserid();
String unionid = dto.getUnionid(); String unionid = dto.getUnionid();
String state = dto.getState(); String state = dto.getState();
boolean isHmUnionid = false ; boolean isHmUnionid = false;
log.info("新增外部联系人,wxEnterpriseId:{}", wxEnterpriseId); log.info("新增外部联系人,wxEnterpriseId:{}", wxEnterpriseId);
if (StringUtils.isAnyBlank(wxUserId, wxEnterpriseId, name, createTime, externalUserId)) { if (StringUtils.isAnyBlank(wxUserId, wxEnterpriseId, name, createTime, externalUserId)) {
log.error("新增外部联系人,缺少必须字段:wxUserId:{},wxEnterpriseId:{},name:{},createTime:{},externalUserId:{}", wxUserId, wxEnterpriseId, name, createTime, externalUserId); log.error("新增外部联系人,缺少必须字段:wxUserId:{},wxEnterpriseId:{},name:{},createTime:{},externalUserId:{}", wxUserId, wxEnterpriseId, name, createTime, externalUserId);
...@@ -333,24 +337,25 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -333,24 +337,25 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
return; return;
} }
String staffId = staff.getStaffId(); String staffId = staff.getStaffId();
String staffName = staff.getStaffName() ; String staffName = staff.getStaffName();
String staffWxUserId = staff.getWxUserId(); String staffWxUserId = staff.getWxUserId();
log.info("新增外部联系人,staff.getWxUserId():{}", staffWxUserId); log.info("新增外部联系人,staff.getWxUserId():{}", staffWxUserId);
dto.setWxUserId(staffWxUserId); dto.setWxUserId(staffWxUserId);
StaffClerkRelationDTO staffClerkRelationDTO = null; StaffClerkRelationDTO staffClerkRelationDTO = null;
//活码处理 "DT" "HM" //活码处理 "DT" "HM"
WxUserAddLogQDTO wxUserAddLogQDTO = new WxUserAddLogQDTO(); WxUserAddLogQDTO wxUserAddLogQDTO = new WxUserAddLogQDTO();
HmQrcodeDTO hmQrcodeDTO = null; String memberLabelId = "";
if (StringUtils.isNotBlank(state)) { if (StringUtils.isNotBlank(state)) {
String id = state.substring(2); String id = state.substring(2);
if (state.contains(Manage3Constants.HM)) { if (state.contains(Manage3Constants.HM)) {
Long hmId = Convert.toLong(id); Long hmId = Convert.toLong(id);
log.info("普通活码={}",hmId); log.info("普通活码={}", hmId);
hmQrcodeDTO = hmQrcodeApiService.getSimpleById(hmId); HmQrcodeDTO hmQrcodeDTO = hmQrcodeApiService.getSimpleById(hmId);
if (hmQrcodeDTO == null) { if (hmQrcodeDTO == null) {
log.error("活码为空:{}", hmId); log.error("活码为空:{}", hmId);
return; return;
} }
memberLabelId = hmQrcodeDTO.getMemberLabelId();
wxUserAddLogQDTO.setHmId(hmId); wxUserAddLogQDTO.setHmId(hmId);
hmQrcodeApiService.updateAddNumById(hmId, hmQrcodeDTO.getClerkId()); hmQrcodeApiService.updateAddNumById(hmId, hmQrcodeDTO.getClerkId());
//处理活码导购 //处理活码导购
...@@ -379,16 +384,20 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -379,16 +384,20 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
Long linkId = dataForHmLink.getLinkId(); Long linkId = dataForHmLink.getLinkId();
Long hmId = dataForHmLink.getHmId(); Long hmId = dataForHmLink.getHmId();
unionid = dataForHmLink.getUnionid(); unionid = dataForHmLink.getUnionid();
log.info("动态活码hmId={},linkId={},unionid={}",hmId,linkId,unionid); log.info("动态活码hmId={},linkId={},unionid={}", hmId, linkId, unionid);
isHmUnionid = true ; isHmUnionid = true;
wxUserAddLogQDTO.setLinkId(linkId); wxUserAddLogQDTO.setLinkId(linkId);
wxUserAddLogQDTO.setHmId(hmId); wxUserAddLogQDTO.setHmId(hmId);
hmQrcodeDTO = hmQrcodeApiService.getSimpleById(hmId); HmQrcodeDTO hmQrcodeDTO = hmQrcodeApiService.getSimpleById(hmId);
if (hmQrcodeDTO == null) { if (hmQrcodeDTO == null) {
log.error("活码动态为空{}", hmId); log.error("活码动态为空,hmId:{}", hmId);
return; return;
} }
staffClerkRelationDTO = staffClerkRelationService.getBindByClerkId(hmQrcodeDTO.getClerkId(), wxEnterpriseId); staffClerkRelationDTO = staffClerkRelationService.getBindByClerkId(hmQrcodeDTO.getClerkId(), wxEnterpriseId);
HmLinkBO hmLinkBO = hmLinkService.getByLinkId(wxEnterpriseId, null, linkId);
if (hmLinkBO != null) {
memberLabelId = hmLinkBO.getMemberLabelId();
}
} }
} else { } else {
TabHaobanClerkMainStoreRelated mainStoreRelated = clerkMainStoreRelatedService.getMainStoreByStaffId(staffId, wxEnterpriseId); TabHaobanClerkMainStoreRelated mainStoreRelated = clerkMainStoreRelatedService.getMainStoreByStaffId(staffId, wxEnterpriseId);
...@@ -411,18 +420,19 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -411,18 +420,19 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
return; return;
} }
String memberId = ""; String memberId = null;
if (StringUtils.isNotBlank(unionid)) { if (StringUtils.isNotBlank(unionid)) {
log.info("有unionid处理:wxEnterpriseId:{},unionid:{}", wxEnterpriseId, unionid); log.info("有unionid处理:wxEnterpriseId:{},unionid:{}", wxEnterpriseId, unionid);
dto.setUnionid(unionid); dto.setUnionid(unionid);
memberId = addExternalClerkRelated(dto, staffId, staffClerkRelationDTO, wxEnterpriseRelated,isHmUnionid); memberId = addExternalClerkRelated(dto, staffId, staffClerkRelationDTO, wxEnterpriseRelated, isHmUnionid);
} else { } else {
log.info("发送欢迎语逻辑:wxEnterpriseId:{}", wxEnterpriseId); log.info("发送欢迎语逻辑:wxEnterpriseId:{}", wxEnterpriseId);
addFriendByWelcome(dto,staffClerkRelationDTO); addFriendByWelcome(dto, staffClerkRelationDTO);
} }
if (StringUtils.isNotBlank(memberId) && hmQrcodeDTO != null) { if (StringUtils.isNoneBlank(memberId, memberLabelId)) {
setMemberTag(staffClerkRelationDTO, hmQrcodeDTO,memberId); //设置会员标签
setMemberTag(staffClerkRelationDTO, memberLabelId, memberId);
} }
log.info("插入加好友日志"); log.info("插入加好友日志");
...@@ -440,12 +450,13 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -440,12 +450,13 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
/** /**
* 设置活码标签 * 设置活码标签
*
* @param staffClerkRelationDTO * @param staffClerkRelationDTO
* @param hmQrcodeDTO * @param memberLabelId
* @param memberId * @param memberId
*/ */
private void setMemberTag(StaffClerkRelationDTO staffClerkRelationDTO, HmQrcodeDTO hmQrcodeDTO,String memberId) { private void setMemberTag(StaffClerkRelationDTO staffClerkRelationDTO, String memberLabelId, String memberId) {
String memberLabelId = hmQrcodeDTO.getMemberLabelId(); log.info("会员打标签,memberLabelId:{},memberId:{}",memberLabelId,memberId);
if (StringUtils.isNotBlank(memberLabelId)) { if (StringUtils.isNotBlank(memberLabelId)) {
MemberTagSingleDTO tagSingleDTO = new MemberTagSingleDTO(); MemberTagSingleDTO tagSingleDTO = new MemberTagSingleDTO();
tagSingleDTO.setEnterpriseId(staffClerkRelationDTO.getEnterpriseId()); tagSingleDTO.setEnterpriseId(staffClerkRelationDTO.getEnterpriseId());
...@@ -464,7 +475,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -464,7 +475,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
* @param staffClerkRelationDTO * @param staffClerkRelationDTO
* @param wxEnterpriseRelated * @param wxEnterpriseRelated
*/ */
private String addExternalClerkRelated(MemberUnionidRelatedDTO dto, String staffId, StaffClerkRelationDTO staffClerkRelationDTO, TabHaobanWxEnterpriseRelated wxEnterpriseRelated , boolean isHmUnionid) { private String addExternalClerkRelated(MemberUnionidRelatedDTO dto, String staffId, StaffClerkRelationDTO staffClerkRelationDTO, TabHaobanWxEnterpriseRelated wxEnterpriseRelated, boolean isHmUnionid) {
String wxUserId = dto.getWxUserId(); String wxUserId = dto.getWxUserId();
String wxEnterpriseId = dto.getWxEnterpriseId(); String wxEnterpriseId = dto.getWxEnterpriseId();
String name = dto.getExternalName(); String name = dto.getExternalName();
...@@ -648,9 +659,9 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -648,9 +659,9 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
WelcomeReferBO welcomeReferBo = getWelcomeReferBo(state); WelcomeReferBO welcomeReferBo = getWelcomeReferBo(state);
welcomeDetailBO = welcomeService.getMatchWelcomeWithReferId(staffId, wxEnterpriseId, welcomeReferBo); welcomeDetailBO = welcomeService.getMatchWelcomeWithReferId(staffId, wxEnterpriseId, welcomeReferBo);
//结束临时会话模式 //结束临时会话模式
log.info("结束临时会话模式:userid:{},externalUserid:{}",dto.getWxUserId(),dto.getExternalUserid()); log.info("结束临时会话模式:userid:{},externalUserid:{}", dto.getWxUserId(), dto.getExternalUserid());
QywxResponseDTO qywxResponseDTO = qywxUserApiService.closeTempChat(corpid, config.getWxSuiteid(), dto.getWxUserId(), dto.getExternalUserid()); QywxResponseDTO qywxResponseDTO = qywxUserApiService.closeTempChat(corpid, config.getWxSuiteid(), dto.getWxUserId(), dto.getExternalUserid());
log.info("结束临时会话返回结果:{}",JSON.toJSONString(qywxResponseDTO)); log.info("结束临时会话返回结果:{}", JSON.toJSONString(qywxResponseDTO));
} else { } else {
welcomeDetailBO = welcomeService.getMatchWelcome(staffId, wxEnterpriseId); welcomeDetailBO = welcomeService.getMatchWelcome(staffId, wxEnterpriseId);
} }
......
...@@ -323,7 +323,9 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -323,7 +323,9 @@ public class StaffApiServiceImpl implements StaffApiService {
if (staffThirdWxEnterpriseId.contains(corpid)) { if (staffThirdWxEnterpriseId.contains(corpid)) {
user = qywxUserApiService.getWorkWxUser(corpid, config.getWxSuiteid(), userId); user = qywxUserApiService.getWorkWxUser(corpid, config.getWxSuiteid(), userId);
UserDTO userSelf = qywxUserApiService.getSelfWorkWxUser(corpid, secretSetting.getSecretVal(), user.getOpen_userid()); UserDTO userSelf = qywxUserApiService.getSelfWorkWxUser(corpid, secretSetting.getSecretVal(), user.getOpen_userid());
if (user != null && userSelf != null) {
user.setName(userSelf.getName()); user.setName(userSelf.getName());
}
} else { } else {
user = qywxUserApiService.getSelfWorkWxUser(corpid, secretSetting.getSecretVal(), userId); user = qywxUserApiService.getSelfWorkWxUser(corpid, secretSetting.getSecretVal(), userId);
} }
......
...@@ -399,7 +399,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -399,7 +399,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
//删除主门店 //删除主门店
clerkMainStoreRelatedService.delMainStore(staffId, staffClerkRelation.getStoreId(), wxEnterpriseId); clerkMainStoreRelatedService.delMainStore(staffId, staffClerkRelation.getStoreId(), wxEnterpriseId);
//废弃活码 //废弃活码
hmQrcodeApiService.delByClerkId(clerkId,staffClerkRelation.getEnterpriseId()); hmQrcodeApiService.delByClerkId(clerkId,staffClerkRelation.getEnterpriseId(),wxEnterpriseId);
} }
@Override @Override
...@@ -485,7 +485,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -485,7 +485,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
ClerkSyncQDTO clerkSyncQDTO = JSON.parseObject(param, ClerkSyncQDTO.class); ClerkSyncQDTO clerkSyncQDTO = JSON.parseObject(param, ClerkSyncQDTO.class);
Integer type = clerkSyncQDTO.getType(); Integer type = clerkSyncQDTO.getType();
String clerkId = clerkSyncQDTO.getClerkId(); String clerkId = clerkSyncQDTO.getClerkId();
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId); ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId,-1);
if (clerkDTO == null) { if (clerkDTO == null) {
logger.error("导购为空"); logger.error("导购为空");
return; return;
......
...@@ -105,7 +105,6 @@ public class HmGroupApiServiceImpl implements HmGroupApiService { ...@@ -105,7 +105,6 @@ public class HmGroupApiServiceImpl implements HmGroupApiService {
HmGroupInfoQO groupInfoQo = new HmGroupInfoQO(); HmGroupInfoQO groupInfoQo = new HmGroupInfoQO();
BeanUtils.copyProperties(groupQueryDTO, groupInfoQo); BeanUtils.copyProperties(groupQueryDTO, groupInfoQo);
groupInfoQo.setWxEnterpriseId(null);
groupInfoQo.setStatus(HmGroupStatus.ENABLE.getCode()); groupInfoQo.setStatus(HmGroupStatus.ENABLE.getCode());
Page<HmGroupSettingBO> groupSettingPage = groupService.queryGroupSettingList(groupInfoQo); Page<HmGroupSettingBO> groupSettingPage = groupService.queryGroupSettingList(groupInfoQo);
...@@ -123,18 +122,27 @@ public class HmGroupApiServiceImpl implements HmGroupApiService { ...@@ -123,18 +122,27 @@ public class HmGroupApiServiceImpl implements HmGroupApiService {
log.info("导购拥有的门店权限 clerkId:{}, storeIds:{}", groupQueryDTO.getClerkId(), JSON.toJSONString(storeList)); log.info("导购拥有的门店权限 clerkId:{}, storeIds:{}", groupQueryDTO.getClerkId(), JSON.toJSONString(storeList));
if (!CollectionUtils.isEmpty(storeList)) { if (!CollectionUtils.isEmpty(storeList)) {
List<String> hmIds = null; List<String> hmIds = null;
boolean isStatic = Boolean.TRUE;
if (!storeList.contains("-1")) { if (!storeList.contains("-1")) {
HmQrcodeListQDTO hmQrcodeListQDTO = new HmQrcodeListQDTO(); // 非超关权限
hmQrcodeListQDTO.setEnterpriseId(groupQueryDTO.getEnterpriseId()); HmQrcodeListQDTO hmQrcodeListQdto = new HmQrcodeListQDTO();
hmQrcodeListQDTO.setStoreId(storeList); hmQrcodeListQdto.setEnterpriseId(groupQueryDTO.getEnterpriseId());
hmIds = qrcodeService.listHmIdForIndex(hmQrcodeListQDTO); hmQrcodeListQdto.setStoreId(storeList);
} hmQrcodeListQdto.setWxEnterpriseId(groupQueryDTO.getWxEnterpriseId());
List<HmQrcodeGroupNumBO> qrcodeGroupNumBoList = qrcodeService.getGroupIdNumByEnterpriseId(groupQueryDTO.getEnterpriseId(), groupIds, hmIds); hmIds = qrcodeService.listHmIdForIndex(hmQrcodeListQdto);
log.info("HMid列表={}", JSON.toJSONString(hmIds));
if (CollectionUtils.isEmpty(hmIds)){
isStatic = false;
}
}
if (isStatic) {
List<HmQrcodeGroupNumBO> qrcodeGroupNumBoList = qrcodeService.getGroupIdNumByEnterpriseId(groupQueryDTO.getWxEnterpriseId(), groupQueryDTO.getEnterpriseId(), groupIds, hmIds);
if (CollectionUtils.isNotEmpty(qrcodeGroupNumBoList)) { if (CollectionUtils.isNotEmpty(qrcodeGroupNumBoList)) {
qrcodeGroupNumMap = qrcodeGroupNumBoList.stream() qrcodeGroupNumMap = qrcodeGroupNumBoList.stream()
.collect(Collectors.toMap(HmQrcodeGroupNumBO::getHmGroupId, HmQrcodeGroupNumBO::getNum, (v1, v2) -> v1)); .collect(Collectors.toMap(HmQrcodeGroupNumBO::getHmGroupId, HmQrcodeGroupNumBO::getNum, (v1, v2) -> v1));
} }
} }
}
for (HmGroupDTO groupDTO : result) { for (HmGroupDTO groupDTO : result) {
Integer referNum = Optional.ofNullable(qrcodeGroupNumMap.get(groupDTO.getGroupId())).orElse(0); Integer referNum = Optional.ofNullable(qrcodeGroupNumMap.get(groupDTO.getGroupId())).orElse(0);
groupDTO.setReferNum(referNum); groupDTO.setReferNum(referNum);
...@@ -193,11 +201,15 @@ public class HmGroupApiServiceImpl implements HmGroupApiService { ...@@ -193,11 +201,15 @@ public class HmGroupApiServiceImpl implements HmGroupApiService {
HmQrcodeListQDTO hmQrcodeListQDTO = new HmQrcodeListQDTO(); HmQrcodeListQDTO hmQrcodeListQDTO = new HmQrcodeListQDTO();
hmQrcodeListQDTO.setEnterpriseId(enterpriseId); hmQrcodeListQDTO.setEnterpriseId(enterpriseId);
hmQrcodeListQDTO.setStoreId(storeList); hmQrcodeListQDTO.setStoreId(storeList);
hmQrcodeListQDTO.setWxEnterpriseId(wxEnterpriseId);
hmIds = qrcodeService.listHmIdForIndex(hmQrcodeListQDTO); hmIds = qrcodeService.listHmIdForIndex(hmQrcodeListQDTO);
log.info("导购拥有的活码权限列表:{}", JSON.toJSONString(hmIds)); log.info("导购拥有的活码权限列表:{}", JSON.toJSONString(hmIds));
if (CollectionUtils.isEmpty(hmIds)){
return ServiceResponse.success(0);
}
} }
} }
int totalReferCount = qrcodeService.getTotalByEnterpriseId(enterpriseId, hmIds); int totalReferCount = qrcodeService.getTotalByEnterpriseId(wxEnterpriseId, enterpriseId, hmIds);
return ServiceResponse.success(totalReferCount); return ServiceResponse.success(totalReferCount);
} }
......
...@@ -130,7 +130,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -130,7 +130,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
hmQrcodeQDTO.setHmGroupId(0L); hmQrcodeQDTO.setHmGroupId(0L);
} }
List<String> clerkIdList = setStoreClerk(hmQrcodeQDTO, wxEnterpriseId, hmId, hmType); List<String> clerkIdList = setStoreClerk(hmQrcodeQDTO, wxEnterpriseId, hmId, hmType, true);
if (CollectionUtils.isEmpty(clerkIdList)) { if (CollectionUtils.isEmpty(clerkIdList)) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "该导购已经生成过活码或未关联过好办"); return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "该导购已经生成过活码或未关联过好办");
} }
...@@ -185,7 +185,11 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -185,7 +185,11 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
if (clerkIdList.contains("-1")) { if (clerkIdList.contains("-1")) {
List<HmQrcodeClerkBO> hmQrcodeClerkBOS = hmQrcodeService.listCanAddClerk(wxEnterpriseId, enterpriseId, hmQrcodeQDTO.getCreatorId()); List<HmQrcodeClerkBO> hmQrcodeClerkBOS = hmQrcodeService.listCanAddClerk(wxEnterpriseId, enterpriseId, hmQrcodeQDTO.getCreatorId());
clerkIdList = hmQrcodeClerkBOS.stream().map(HmQrcodeClerkBO::getClerkId).collect(Collectors.toList()); clerkIdList = hmQrcodeClerkBOS.stream().map(HmQrcodeClerkBO::getClerkId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(clerkIdList)) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_5.getCode()), "无需要生成活码导购");
}
} }
for (String clerkId : clerkIdList) { for (String clerkId : clerkIdList) {
hmQrcodeQDTO.setClerkIdList(Collections.singletonList(clerkId)); hmQrcodeQDTO.setClerkIdList(Collections.singletonList(clerkId));
hmQrcodeQDTO.setInvokingType(3); hmQrcodeQDTO.setInvokingType(3);
...@@ -236,7 +240,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -236,7 +240,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "该活码不存在"); return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "该活码不存在");
} }
Integer hmType = hmQrcodeQDTO.getHmType(); Integer hmType = hmQrcodeQDTO.getHmType();
List<String> clerkIdList = setStoreClerk(hmQrcodeQDTO, wxEnterpriseId, hmId, hmType); List<String> clerkIdList = setStoreClerk(hmQrcodeQDTO, wxEnterpriseId, hmId, hmType, false);
if (CollectionUtils.isEmpty(clerkIdList)) { if (CollectionUtils.isEmpty(clerkIdList)) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "该导购已经生成过活码或未关联过好办"); return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "该导购已经生成过活码或未关联过好办");
} }
...@@ -318,11 +322,11 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -318,11 +322,11 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
String oldTagName = ""; String oldTagName = "";
String tagName = ""; String tagName = "";
if (tagItemOld != null) { if (tagItemOld != null) {
MemberTagDTO tag = this.memberTagApiService.getMemberTagById(tagItemOld.getTagId()) ; MemberTagDTO tag = this.memberTagApiService.getMemberTagById(tagItemOld.getTagId());
oldTagName = tag.getTagName() + "-" + tagItem.getTagItemName(); oldTagName = tag.getTagName() + "-" + tagItem.getTagItemName();
} }
if (tagItem != null) { if (tagItem != null) {
MemberTagDTO tag = this.memberTagApiService.getMemberTagById(tagItem.getTagId()) ; MemberTagDTO tag = this.memberTagApiService.getMemberTagById(tagItem.getTagId());
tagName = tag.getTagName() + "-" + tagItem.getTagItemName(); tagName = tag.getTagName() + "-" + tagItem.getTagItemName();
} }
logContent.append("活码标签「").append(oldTagName).append("」").append("变更为「").append(tagName).append("」"); logContent.append("活码标签「").append(oldTagName).append("」").append("变更为「").append(tagName).append("」");
...@@ -376,17 +380,24 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -376,17 +380,24 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
* @param hmType * @param hmType
* @return * @return
*/ */
private List<String> setStoreClerk(HmQrcodeQDTO hmQrcodeQDTO, String wxEnterpriseId, Long hmId, Integer hmType) { private List<String> setStoreClerk(HmQrcodeQDTO hmQrcodeQDTO, String wxEnterpriseId, Long hmId, Integer hmType, Boolean addFlag) {
List<String> clerkIdList = hmQrcodeQDTO.getClerkIdList(); List<String> clerkIdList = hmQrcodeQDTO.getClerkIdList();
if (CollectionUtils.isEmpty(clerkIdList)) { if (CollectionUtils.isEmpty(clerkIdList)) {
return null; return null;
} }
//单人活码
String clerkId = clerkIdList.get(0);
if (hmType == 2) { if (hmType == 2) {
//多人活码 //多人活码
insertHmClerkRelation(hmQrcodeQDTO, wxEnterpriseId, hmId, clerkIdList); insertHmClerkRelation(hmQrcodeQDTO, wxEnterpriseId, hmId, clerkIdList, addFlag);
} else if (hmType == 1) {
HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryByClerkId(clerkId, wxEnterpriseId);
if (addFlag && hmQrcodeBO != null) {
logger.error("已经生成过活码,clerkId:{}", clerkId);
return null;
} }
//单人活码 }
String clerkId = clerkIdList.get(0);
hmQrcodeQDTO.setClerkId(clerkId); hmQrcodeQDTO.setClerkId(clerkId);
ClerkDTO clerkDTO = clerkService.getclerkById(clerkId); ClerkDTO clerkDTO = clerkService.getclerkById(clerkId);
if (clerkDTO != null) { if (clerkDTO != null) {
...@@ -420,10 +431,15 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -420,10 +431,15 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
* @param hmId * @param hmId
* @param clerkIdList * @param clerkIdList
*/ */
private void insertHmClerkRelation(HmQrcodeQDTO hmQrcodeQDTO, String wxEnterpriseId, Long hmId, List<String> clerkIdList) { private void insertHmClerkRelation(HmQrcodeQDTO hmQrcodeQDTO, String wxEnterpriseId, Long hmId, List<String> clerkIdList, Boolean addFlag) {
List<HmClerkRelationQDTO> clerkRelationQDTOS = new ArrayList<>();
Date now = new Date(); Date now = new Date();
for (String clerkId : clerkIdList) { for (String clerkId : clerkIdList) {
HmClerkRelationBO hmClerkRelationBO = hmClerkRelationService.queryByHmIdAndClerkId(hmId, clerkId);
if (addFlag && hmClerkRelationBO != null) {
logger.error("该导购已经在该多人活码中,clerkId:{}", clerkId);
continue;
}
StaffClerkRelationDTO clerkRelationDTO = staffClerkRelationService.getByClerkId(clerkId); StaffClerkRelationDTO clerkRelationDTO = staffClerkRelationService.getByClerkId(clerkId);
HmClerkRelationQDTO hmClerkRelationQDTO = new HmClerkRelationQDTO(); HmClerkRelationQDTO hmClerkRelationQDTO = new HmClerkRelationQDTO();
hmClerkRelationQDTO.setRelationId(UniqueIdUtils.uniqueLong()); hmClerkRelationQDTO.setRelationId(UniqueIdUtils.uniqueLong());
...@@ -458,9 +474,8 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -458,9 +474,8 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
hmClerkRelationQDTO.setUpdateTime(now); hmClerkRelationQDTO.setUpdateTime(now);
hmClerkRelationQDTO.setOverFlag(0); hmClerkRelationQDTO.setOverFlag(0);
hmClerkRelationQDTO.setAddNum(0); hmClerkRelationQDTO.setAddNum(0);
clerkRelationQDTOS.add(hmClerkRelationQDTO); hmClerkRelationService.insert(hmClerkRelationQDTO);
} }
hmClerkRelationService.insertBatch(clerkRelationQDTOS);
} }
...@@ -474,8 +489,8 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -474,8 +489,8 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
} }
MemberTagItemDTO tagItem = this.memberTagApiService.findMemberTagItem(hmQrcodeBO.getMemberLabelId()); MemberTagItemDTO tagItem = this.memberTagApiService.findMemberTagItem(hmQrcodeBO.getMemberLabelId());
if (null != tagItem) { if (null != tagItem) {
String tagId = tagItem.getTagId() ; String tagId = tagItem.getTagId();
MemberTagDTO tag = this.memberTagApiService.getMemberTagById(tagId) ; MemberTagDTO tag = this.memberTagApiService.getMemberTagById(tagId);
hmQrcodeBO.setMemberLabelName(tag.getTagName() + "-" + tagItem.getTagItemName()); hmQrcodeBO.setMemberLabelName(tag.getTagName() + "-" + tagItem.getTagItemName());
hmQrcodeBO.setMemberLabelStatus(tagItem.getStatus()); hmQrcodeBO.setMemberLabelStatus(tagItem.getStatus());
} }
...@@ -537,9 +552,9 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -537,9 +552,9 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
} }
@Override @Override
public ServiceResponse delByClerkId(String clerkId, String enterpriseId) { public ServiceResponse delByClerkId(String clerkId, String enterpriseId, String wxEnterpriseId) {
// 单人活码 直接废弃,多人活码,更新 // 单人活码 直接废弃,多人活码,更新
HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryByClerkId(clerkId, enterpriseId); HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryByClerkId(clerkId, wxEnterpriseId);
if (hmQrcodeBO != null) { if (hmQrcodeBO != null) {
delById(hmQrcodeBO.getHmId()); delById(hmQrcodeBO.getHmId());
} }
...@@ -553,6 +568,9 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -553,6 +568,9 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
for (HmClerkRelationBO hmClerkRelationBO : hmClerkRelationBOS) { for (HmClerkRelationBO hmClerkRelationBO : hmClerkRelationBOS) {
Long hmId = hmClerkRelationBO.getHmId(); Long hmId = hmClerkRelationBO.getHmId();
List<String> clerkIds = hmClerkRelationService.getClerkIdByHmId(hmId); List<String> clerkIds = hmClerkRelationService.getClerkIdByHmId(hmId);
hmClerkRelationService.updateStatusById(0,hmClerkRelationBO.getRelationId());
clerkIds.remove(clerkId); clerkIds.remove(clerkId);
// 更新活码 // 更新活码
HmQrcodeQDTO hmQrcodeQDTO = new HmQrcodeQDTO(); HmQrcodeQDTO hmQrcodeQDTO = new HmQrcodeQDTO();
...@@ -647,6 +665,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -647,6 +665,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
logger.info("导购无活码,无需处理:clerkId:{}", clerkId); logger.info("导购无活码,无需处理:clerkId:{}", clerkId);
continue; continue;
} }
staffClerkRelationService.updateOpenConcatFlagById(0, relationDTO.getStaffClerkRelationId());
hmQrcodeService.updateStatusById(hmQrcodeBO.getHmId(), 3); hmQrcodeService.updateStatusById(hmQrcodeBO.getHmId(), 3);
} }
} }
...@@ -723,7 +742,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -723,7 +742,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
@Override @Override
public Page<HmClerkRelationDTO> getHmClerkByHmId(BasePageInfo basePageInfo, Long hmId) { public Page<HmClerkRelationDTO> getHmClerkByHmId(BasePageInfo basePageInfo, Long hmId) {
Page<HmClerkRelationBO> hmClerkByHmId = hmClerkRelationService.getHmClerkByHmId(basePageInfo, hmId); Page<HmClerkRelationBO> hmClerkByHmId = hmClerkRelationService.getHmClerkByHmId(basePageInfo, hmId);
return PageUtil.changeToCurrentPage(hmClerkByHmId,HmClerkRelationDTO.class); return PageUtil.changeToCurrentPage(hmClerkByHmId, HmClerkRelationDTO.class);
} }
/** /**
...@@ -762,4 +781,9 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -762,4 +781,9 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
public ServiceResponse<List<String>> listHmIdForIndex(HmQrcodeListQDTO qdto) { public ServiceResponse<List<String>> listHmIdForIndex(HmQrcodeListQDTO qdto) {
return ServiceResponse.success(hmQrcodeService.listHmIdForIndex(qdto)); return ServiceResponse.success(hmQrcodeService.listHmIdForIndex(qdto));
} }
@Override
public ServiceResponse<List<String>> listHasQrcodeClerk(String enterpriseId, List<String> clerkIdList) {
return ServiceResponse.success(hmQrcodeService.listHasQrcodeClerk(enterpriseId,clerkIdList));
}
} }
...@@ -182,5 +182,13 @@ ...@@ -182,5 +182,13 @@
where hm_id = #{hmId} and staff_id = #{staffId} and status = 1 limit 1 where hm_id = #{hmId} and staff_id = #{staffId} and status = 1 limit 1
</select> </select>
<update id="updateStatusById">
update tab_haoban_hm_clerk_relation
<set>
status = #{status},update_time = now()
</set>
where relation_id = #{relationId}
</update>
</mapper> </mapper>
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
</update> </update>
<update id="resetAddNumAndOverFlag"> <update id="resetAddNumAndOverFlag">
update update tab_haoban_hm_qrcode
<set> <set>
add_num = 0,over_flag = 0,update_time = now() add_num = 0,over_flag = 0,update_time = now()
</set> </set>
...@@ -330,6 +330,9 @@ ...@@ -330,6 +330,9 @@
select distinct(a.hm_id) select distinct(a.hm_id)
from tab_haoban_hm_qrcode a left join tab_haoban_hm_clerk_relation b on a.hm_id = b.hm_id and b.status = 1 from tab_haoban_hm_qrcode a left join tab_haoban_hm_clerk_relation b on a.hm_id = b.hm_id and b.status = 1
where a.enterprise_id = #{enterpriseId} and a.status_flag != 0 where a.enterprise_id = #{enterpriseId} and a.status_flag != 0
<if test="wxEnterpriseId != null and wxEnterpriseId != ''">
and a.wx_enterprise_id = #{wxEnterpriseId}
</if>
<if test="null != hmSelect and '' != hmSelect "> <if test="null != hmSelect and '' != hmSelect ">
and (a.hm_code=#{hmSelect} or a.name like '%${hmSelect}%' or a.creator_name like '%${hmSelect}%' ) and (a.hm_code=#{hmSelect} or a.name like '%${hmSelect}%' or a.creator_name like '%${hmSelect}%' )
</if> </if>
...@@ -371,6 +374,9 @@ ...@@ -371,6 +374,9 @@
from tab_haoban_hm_qrcode from tab_haoban_hm_qrcode
where status_flag != 0 where status_flag != 0
and enterprise_id = #{enterpriseId} and enterprise_id = #{enterpriseId}
<if test="wxEnterpriseId != null and wxEnterpriseId != ''">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
<if test="groupIds != null and groupIds.size > 0"> <if test="groupIds != null and groupIds.size > 0">
and hm_group_id IN and hm_group_id IN
<foreach collection="groupIds" item="id" index="index" open="(" close=")" separator=","> <foreach collection="groupIds" item="id" index="index" open="(" close=")" separator=",">
...@@ -391,6 +397,9 @@ ...@@ -391,6 +397,9 @@
from tab_haoban_hm_qrcode from tab_haoban_hm_qrcode
where status_flag != 0 where status_flag != 0
and enterprise_id = #{enterpriseId} and enterprise_id = #{enterpriseId}
<if test="wxEnterpriseId != null and wxEnterpriseId != ''">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
<if test="hmIds != null and hmIds.size > 0"> <if test="hmIds != null and hmIds.size > 0">
and hm_id in and hm_id in
<foreach collection="hmIds" open="(" close=")" separator="," item="hmId"> <foreach collection="hmIds" open="(" close=")" separator="," item="hmId">
...@@ -422,7 +431,7 @@ ...@@ -422,7 +431,7 @@
<sql id="canAddClerkSql"> <sql id="canAddClerkSql">
tab_haoban_staff_clerk_relation a LEFT JOIN tab_haoban_hm_qrcode b ON a.clerk_id = b.clerk_id and b.hm_type = 1 and b.status_flag in (1,3) tab_haoban_staff_clerk_relation a LEFT JOIN tab_haoban_hm_qrcode b ON a.clerk_id = b.clerk_id and b.hm_type = 1 and b.status_flag in (1,3)
WHERE a.enterprise_id = #{enterpriseId} AND a.status_flag = 1 AND a.open_concat_flag = 0 WHERE a.enterprise_id = #{enterpriseId} AND a.status_flag = 1 AND a.open_concat_flag = 1
<if test="null != storeIdList"> <if test="null != storeIdList">
and a.store_id in and a.store_id in
<foreach collection="storeIdList" item="id" index="index" open="(" close=")" separator=","> <foreach collection="storeIdList" item="id" index="index" open="(" close=")" separator=",">
...@@ -433,5 +442,14 @@ ...@@ -433,5 +442,14 @@
and b.hm_id is null and b.hm_id is null
</sql> </sql>
<select id="listHasQrcodeClerk" resultType="String">
select clerk_id from tab_haoban_hm_qrcode where enterprise_id=#{enterpriseId}
and clerk_id in
<foreach collection="clerkIdList" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
and hm_type = 1 and status_flag in (1,3)
</select>
</mapper> </mapper>
...@@ -137,6 +137,7 @@ public class HmQrcodeController { ...@@ -137,6 +137,7 @@ public class HmQrcodeController {
public RestResponse<StatisticsDTO> list(@RequestBody HmQrcodeListQO hmQrcodeListQO) { public RestResponse<StatisticsDTO> list(@RequestBody HmQrcodeListQO hmQrcodeListQO) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser(); WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
hmQrcodeListQO.getInFields().setEnterpriseId(loginUser.getEnterpriseId()); hmQrcodeListQO.getInFields().setEnterpriseId(loginUser.getEnterpriseId());
hmQrcodeListQO.getInFields().setWxEnterpriseId(loginUser.getWxEnterpriseId());
List<String> storeList = staffApiService.getHaoBanStoreIdsRolesByClerkId(loginUser.getClerkId(), loginUser.getWxEnterpriseId()); List<String> storeList = staffApiService.getHaoBanStoreIdsRolesByClerkId(loginUser.getClerkId(), loginUser.getWxEnterpriseId());
if (CollectionUtils.isEmpty(storeList)) { if (CollectionUtils.isEmpty(storeList)) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_100007.getCode()), HaoBanErrCode.ERR_100007.getMsg()); return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_100007.getCode()), HaoBanErrCode.ERR_100007.getMsg());
......
...@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.BasePageInfo; import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.clerk.api.dto.ClerkStoreListDTO; import com.gic.clerk.api.dto.ClerkStoreListDTO;
import com.gic.clerk.api.service.ClerkService; import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
...@@ -31,7 +32,6 @@ import com.gic.enterprise.api.service.StoreService; ...@@ -31,7 +32,6 @@ import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO; import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO;
import com.gic.haoban.common.utils.AuthWebRequestUtil; import com.gic.haoban.common.utils.AuthWebRequestUtil;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO; import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.hm.HmQrcodeListDTO;
import com.gic.haoban.manage.api.dto.hm.HmQrcodeStoreDTO; import com.gic.haoban.manage.api.dto.hm.HmQrcodeStoreDTO;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService; import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
...@@ -72,6 +72,7 @@ public class HmStoreController { ...@@ -72,6 +72,7 @@ public class HmStoreController {
@ResponseBody @ResponseBody
public RestResponse<Object> listStoreClerk(HttpServletRequest request, BasePageInfo basePageInfo) { public RestResponse<Object> listStoreClerk(HttpServletRequest request, BasePageInfo basePageInfo) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser(); WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String enterpriseId = loginUser.getEnterpriseId();
String wxEnterpriseId = loginUser.getWxEnterpriseId(); String wxEnterpriseId = loginUser.getWxEnterpriseId();
// 分组id // 分组id
String storeGroupId = request.getParameter("storeGroupId"); String storeGroupId = request.getParameter("storeGroupId");
...@@ -80,7 +81,7 @@ public class HmStoreController { ...@@ -80,7 +81,7 @@ public class HmStoreController {
// 导购参数 // 导购参数
String clerkSearchParams = request.getParameter("clerkSearchParams"); String clerkSearchParams = request.getParameter("clerkSearchParams");
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("enterpriseId", loginUser.getEnterpriseId()); params.put("enterpriseId", enterpriseId);
// 2线上 // 2线上
params.put("status", 2); params.put("status", 2);
params.put("storeGroupId", storeGroupId); params.put("storeGroupId", storeGroupId);
...@@ -117,12 +118,12 @@ public class HmStoreController { ...@@ -117,12 +118,12 @@ public class HmStoreController {
retPage.setTotalPage(page.getTotalPage()); retPage.setTotalPage(page.getTotalPage());
List<ClerkStoreListVO> result = EntityUtil.changeEntityListByJSON(ClerkStoreListVO.class, page.getResult()); List<ClerkStoreListVO> result = EntityUtil.changeEntityListByJSON(ClerkStoreListVO.class, page.getResult());
// 好办状态 // 好办状态
this.haobanStatus(result, wxEnterpriseId); this.haobanStatus(result, wxEnterpriseId, enterpriseId);
retPage.setResult(result); retPage.setResult(result);
return RestResponse.successResult(retPage); return RestResponse.successResult(retPage);
} }
private void haobanStatus(List<ClerkStoreListVO> list, String wxEnterpriseId) { private void haobanStatus(List<ClerkStoreListVO> list, String wxEnterpriseId, String enterpriseId) {
List<String> clerkIdList = new ArrayList<>(); List<String> clerkIdList = new ArrayList<>();
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
return; return;
...@@ -156,21 +157,16 @@ public class HmStoreController { ...@@ -156,21 +157,16 @@ public class HmStoreController {
} }
} }
if (CollectionUtils.isNotEmpty(statusList)) { if (CollectionUtils.isNotEmpty(statusList)) {
List<HmQrcodeListDTO> hmList = new ArrayList<>(); ServiceResponse<List<String>> hmClerkResp = this.hmQrcodeApiService.listHasQrcodeClerk(enterpriseId,
if (CollectionUtils.isNotEmpty(hmList)) { statusList);
status2List.addAll(hmList.stream().filter(dto -> dto.getStatusFlag() == 3).map(dto -> dto.getClerkId()) if (CollectionUtils.isNotEmpty(hmClerkResp.getResult())) {
.collect(Collectors.toList())); status3List.addAll(hmClerkResp.getResult());
status3List.addAll(hmList.stream().filter(dto -> dto.getStatusFlag() == 1).map(dto -> dto.getClerkId())
.collect(Collectors.toList()));
} }
status4List status4List
.addAll(statusList.stream().filter(id -> (!status2List.contains(id) && !status3List.contains(id))) .addAll(statusList.stream().filter(id -> (!status3List.contains(id)))
.collect(Collectors.toList())); .collect(Collectors.toList()));
} }
logger.info("导购列表未开启客户联系的={} , 已有单人活码的={}, 可以创建单人活码的={}", status2List, status3List, status4List);
logger.info("导购列表={}", status2List);
logger.info("导购列表={}", status3List);
logger.info("导购列表={}", status4List);
list.stream().forEach(item -> { list.stream().forEach(item -> {
for (ClerkListVO clerk : item.getClerkList()) { for (ClerkListVO clerk : item.getClerkList()) {
if (status2List.contains(clerk.getClerkId())) { if (status2List.contains(clerk.getClerkId())) {
...@@ -201,7 +197,7 @@ public class HmStoreController { ...@@ -201,7 +197,7 @@ public class HmStoreController {
@ResponseBody @ResponseBody
public RestResponse<Object> listStore(HttpServletRequest request, BasePageInfo basePageInfo) { public RestResponse<Object> listStore(HttpServletRequest request, BasePageInfo basePageInfo) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser(); WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId() ; String wxEnterpriseId = loginUser.getWxEnterpriseId();
String enterpriseId = loginUser.getEnterpriseId(); String enterpriseId = loginUser.getEnterpriseId();
String clerkId = loginUser.getClerkId(); String clerkId = loginUser.getClerkId();
// 如果有权限控制,进行管辖门店过0滤 // 如果有权限控制,进行管辖门店过0滤
...@@ -240,7 +236,7 @@ public class HmStoreController { ...@@ -240,7 +236,7 @@ public class HmStoreController {
page.setPageSize(basePageInfo.getPageSize()); page.setPageSize(basePageInfo.getPageSize());
page.setCurrentPage(basePageInfo.getPageNum()); page.setCurrentPage(basePageInfo.getPageNum());
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("searchDto", searchDTO) ; params.put("searchDto", searchDTO);
page.setParams(params); page.setParams(params);
logger.info("查询条件={}", JSON.toJSONString(page)); logger.info("查询条件={}", JSON.toJSONString(page));
Map<String, Object> result = storeService.getStoreListPage(page); Map<String, Object> result = storeService.getStoreListPage(page);
......
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