Commit e183e21f by 徐高华

活码

parent bc4f3641
...@@ -53,5 +53,5 @@ public interface HmLinkApiService { ...@@ -53,5 +53,5 @@ public interface HmLinkApiService {
* @throws * @throws
*/ */
public ServiceResponse<HmLinkWxaDTO> getLinkHmFromWxa(String enterpriseId, Integer whitchStore, String storeId, public ServiceResponse<HmLinkWxaDTO> getLinkHmFromWxa(String enterpriseId, Integer whitchStore, String storeId,
String clerkId, String linkShortCode, String mixPhone, String unionid); String clerkId, String linkShortCode, String mixPhone, String unionid , String memberId);
} }
...@@ -14,6 +14,7 @@ import com.gic.haoban.manage.api.dto.hm.HmLinkDTO; ...@@ -14,6 +14,7 @@ import com.gic.haoban.manage.api.dto.hm.HmLinkDTO;
import com.gic.haoban.manage.api.dto.hm.HmLinkStoreDTO; import com.gic.haoban.manage.api.dto.hm.HmLinkStoreDTO;
import com.gic.haoban.manage.api.dto.hm.HmLinkStoreSettingDTO; import com.gic.haoban.manage.api.dto.hm.HmLinkStoreSettingDTO;
import com.gic.haoban.manage.api.dto.hm.HmLinkWxaDTO; import com.gic.haoban.manage.api.dto.hm.HmLinkWxaDTO;
import com.gic.haoban.manage.api.dto.hm.HmPageDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmLinkSearchQDTO; import com.gic.haoban.manage.api.dto.qdto.hm.HmLinkSearchQDTO;
import com.gic.haoban.manage.api.service.hm.HmLinkApiService; import com.gic.haoban.manage.api.service.hm.HmLinkApiService;
import com.gic.haoban.manage.service.config.Config; import com.gic.haoban.manage.service.config.Config;
...@@ -126,7 +127,10 @@ public class HmLinkApiServiceImpl implements HmLinkApiService { ...@@ -126,7 +127,10 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
@Override @Override
public ServiceResponse<HmLinkWxaDTO> getLinkHmFromWxa(String enterpriseId, Integer whitchStore, String inStoreId, public ServiceResponse<HmLinkWxaDTO> getLinkHmFromWxa(String enterpriseId, Integer whitchStore, String inStoreId,
String inClerkId, String linkShortCode, String mixPhone, String unionid) { String inClerkId, String linkShortCode, String mixPhone, String unionid, String memberId) {
if ("-1".equals(memberId)) {
memberId = null;
}
HmQrcodeBO hm = null; HmQrcodeBO hm = null;
HmLinkWxaDTO retDTO = new HmLinkWxaDTO(); HmLinkWxaDTO retDTO = new HmLinkWxaDTO();
log.info("小程序获取活码={},linkShortCode={},mixPhone={}", enterpriseId, linkShortCode, mixPhone); log.info("小程序获取活码={},linkShortCode={},mixPhone={}", enterpriseId, linkShortCode, mixPhone);
...@@ -185,7 +189,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService { ...@@ -185,7 +189,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
} }
} }
// 会员门店 // 会员门店
if (null == hm && StringUtils.isNotEmpty(mixPhone)) { if (null == hm) {
HmLinkStoreSettingDTO fwStore = null; HmLinkStoreSettingDTO fwStore = null;
HmLinkStoreSettingDTO xgStore = null; HmLinkStoreSettingDTO xgStore = null;
if (StringUtils.isNotBlank(link.getStoreRuleJson())) { if (StringUtils.isNotBlank(link.getStoreRuleJson())) {
...@@ -200,53 +204,61 @@ public class HmLinkApiServiceImpl implements HmLinkApiService { ...@@ -200,53 +204,61 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
if (null == xgStore || xgStore.getOpen() == 0) { if (null == xgStore || xgStore.getOpen() == 0) {
xgStore = null; xgStore = null;
} }
String mobile = this.keyDataService.getMobile(mixPhone, String.valueOf(linkId)); if (StringUtils.isNotEmpty(mixPhone)) {
log.info("小程序获取活码mobile={}", mobile); String mobile = this.keyDataService.getMobile(mixPhone, String.valueOf(linkId));
String memberId = this.memberService.getMemberIdByPhoneNumber(mobile, enterpriseId); log.info("小程序获取活码mobile={},mixPhone={}", mobile, mixPhone);
log.info("小程序获取活码memberId={}", memberId); String mobileMemberId = this.memberService.getMemberIdByPhoneNumber(mobile, enterpriseId);
MemberDataDTO member = this.getMemberClerk(enterpriseId, memberId); if (StringUtils.isNotBlank(mobileMemberId)) {
String mainClerkId = member.getMainClerkId(); memberId = mobileMemberId;
String mainStoreId = member.getMainStoreId();
// 服务门店
if (null != fwStore) {
if (fwStore.getZs() == 1) {
hm = this.getHmFromClerk(mainClerkId, wxEnterpriseId);
}
if (null == hm) {
hm = this.getHmFormStore(wxEnterpriseId, mainStoreId, fwStore.getDz(), fwStore.getDy());
} }
} }
// 协管门店 log.info("小程序获取活码memberId={}", memberId);
if (null == hm && null != xgStore) { if (StringUtils.isNotBlank(memberId)) {
List<MemberStoreClerkDataDTO> list = member.getStoreClerkRel(); MemberDataDTO member = this.getMemberClerk(enterpriseId, memberId);
List<String> storeIdList = new ArrayList<>(); String mainClerkId = member.getMainClerkId();
// 协管导购 String mainStoreId = member.getMainStoreId();
for (MemberStoreClerkDataDTO item : list) { // 服务门店
String clerkId = item.getClerkIdRel(); if (null != fwStore) {
if (clerkId.equals(mainClerkId)) { if (fwStore.getZs() == 1 && StringUtils.isNotBlank(mainClerkId)) {
continue; hm = this.getHmFromClerk(mainClerkId, wxEnterpriseId);
} }
hm = this.getHmFromClerk(clerkId, wxEnterpriseId); if (null == hm && StringUtils.isNotBlank(mainStoreId)) {
if (null != hm) { hm = this.getHmFormStore(wxEnterpriseId, mainStoreId, fwStore.getDz(), fwStore.getDy());
break;
} }
storeIdList.add(item.getStoreIdRel());
} }
// 店长 // 协管门店
if (null == hm && xgStore.getDz() == 1) { List<MemberStoreClerkDataDTO> list = member.getStoreClerkRel();
for (String storeId : storeIdList) { if (null == hm && null != xgStore && CollectionUtils.isNotEmpty(list)) {
hm = this.getHmFormStore(wxEnterpriseId, storeId, 1, 0); List<String> storeIdList = new ArrayList<>();
// 协管导购
for (MemberStoreClerkDataDTO item : list) {
String clerkId = item.getClerkIdRel();
if (clerkId.equals(mainClerkId)) {
continue;
}
hm = this.getHmFromClerk(clerkId, wxEnterpriseId);
if (null != hm) { if (null != hm) {
storeIdList = null;
break; break;
} }
storeIdList.add(item.getStoreIdRel());
} }
} // 店长
// 店员 if (null == hm && xgStore.getDz() == 1 && CollectionUtils.isNotEmpty(storeIdList)) {
if (null == hm && xgStore.getDy() == 1) { for (String storeId : storeIdList) {
for (String storeId : storeIdList) { hm = this.getHmFormStore(wxEnterpriseId, storeId, 1, 0);
hm = this.getHmFormStore(wxEnterpriseId, storeId, 0, 1); if (null != hm) {
if (null != hm) { break;
break; }
}
}
// 店员
if (null == hm && xgStore.getDy() == 1 && CollectionUtils.isNotEmpty(storeIdList)) {
for (String storeId : storeIdList) {
hm = this.getHmFormStore(wxEnterpriseId, storeId, 0, 1);
if (null != hm) {
break;
}
} }
} }
} }
...@@ -278,13 +290,15 @@ public class HmLinkApiServiceImpl implements HmLinkApiService { ...@@ -278,13 +290,15 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
bo.setUnionid(unionid); bo.setUnionid(unionid);
bo.setLinkId(linkId); bo.setLinkId(linkId);
bo.setHmId(hm.getHmId()); bo.setHmId(hm.getHmId());
String key = this.keyDataService.saveDataForLink(enterpriseId, bo); String dthmKey = this.keyDataService.saveDataForLink(enterpriseId, bo);
if (null != key) { if (null != dthmKey) {
this.addQrcode(hm, key, wxEnterpriseDTO.getCorpid(), retDTO); this.addQrcode(hm, dthmKey, wxEnterpriseDTO.getCorpid(), retDTO);
} }
// 查询页面 // 查询页面
HmPageBO page = this.hmPageService.queryHmPageDetail(link.getPageId()); HmPageBO page = this.hmPageService.queryHmPageDetail(link.getPageId());
// retDTO.setPage(resp.getResult()); if (null != page) {
retDTO.setPage(EntityUtil.changeEntityByJSON(HmPageDTO.class, page));
}
} }
// 生成动态活码 // 生成动态活码
log.info(JSON.toJSONString(retDTO, true)); log.info(JSON.toJSONString(retDTO, true));
......
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