|
|
|
@ -123,6 +123,10 @@ public class CustomerService {
|
|
|
|
|
private IPmnPromotionFriendsSrcService pmnPromotionFriendsSrcService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private RedisUtil redisUtil;
|
|
|
|
|
@Autowired
|
|
|
|
|
private IPmnActivityInstanceConfigService pmnActivityInstanceConfigService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private IPmnActivityPromotionParamService pmnActivityPromotionParamService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* token
|
|
|
|
@ -204,14 +208,59 @@ public class CustomerService {
|
|
|
|
|
public Map<String, Object> turnBack(TurnBackDTO turnBackDTOS) throws Exception {
|
|
|
|
|
String eaCode = turnBackDTOS.getEaCode();
|
|
|
|
|
Map<String, Object> returnValue = new HashMap<>();
|
|
|
|
|
log.info("回调参数: {}", turnBackDTOS);
|
|
|
|
|
// TODO 测试用
|
|
|
|
|
Map<String, Object> mp = new HashMap<>();
|
|
|
|
|
mp.put("title", "点击进入 解锁春夏新品限时惊喜“派对价”");
|
|
|
|
|
mp.put("pic_media_id", "3FATKOzsf_ZvET8_znnVUgjfYht3VlewPs1TtDYRTmKzSxorJDjDra0fZyluqlCxh");
|
|
|
|
|
mp.put("appid", "wxdbee4d231d47d0bf");
|
|
|
|
|
mp.put("page", "pages/springPumping/login/login");
|
|
|
|
|
returnValue.put("welcome_code", "WELCOMECODE");
|
|
|
|
|
returnValue.put("miniprogram", mp);
|
|
|
|
|
Long storeId;
|
|
|
|
|
if (turnBackDTOS.getUserId().equals("mayifei")) {
|
|
|
|
|
storeId = 1962L;
|
|
|
|
|
} else {
|
|
|
|
|
PoiStoreStaff storeStaff = poiStoreStaffDOMapper.selectOne(Wrappers.<PoiStoreStaff>lambdaQuery().eq(PoiStoreStaff::getStaffCode, turnBackDTOS.getUserId()));
|
|
|
|
|
storeId = storeStaff.getStoreId();
|
|
|
|
|
}
|
|
|
|
|
List<PmnActivityStoreRelation> storeRelations = pmnActivityStoreRelationService.list(Wrappers.<PmnActivityStoreRelation>lambdaQuery().eq(PmnActivityStoreRelation::getStoreId, storeId).eq(PmnActivityStoreRelation::getStatus, 1).select(PmnActivityStoreRelation::getInstanceId).orderByDesc(PmnActivityStoreRelation::getCreateTime));
|
|
|
|
|
if (storeRelations.size() > 0) {
|
|
|
|
|
Set<Long> instanceIds = storeRelations.stream().map(PmnActivityStoreRelation::getInstanceId).collect(Collectors.toSet());
|
|
|
|
|
List<PmnActivityInstance> instance = pmnActivityInstanceService.list(Wrappers.<PmnActivityInstance>lambdaQuery().in(PmnActivityInstance::getId, instanceIds).eq(PmnActivityInstance::getCategoryCode, "promotion").eq(PmnActivityInstance::getStatus, 2));
|
|
|
|
|
if (instance.size() > 0) {
|
|
|
|
|
//TODO 有活动,返回活动
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
//没有活动,返回欢迎语
|
|
|
|
|
List<PmnActivityInstance> welcomes = pmnActivityInstanceService.list(Wrappers.<PmnActivityInstance>lambdaQuery().in(PmnActivityInstance::getId, instanceIds).eq(PmnActivityInstance::getCategoryCode, "welcome"));
|
|
|
|
|
if (welcomes.size() > 0) {
|
|
|
|
|
PmnActivityInstance welcome = welcomes.get(0);
|
|
|
|
|
List<PmnActivityInstanceConfig> configs = pmnActivityInstanceConfigService.list(Wrappers.<PmnActivityInstanceConfig>lambdaQuery().eq(PmnActivityInstanceConfig::getInstanceId, welcome.getId()));
|
|
|
|
|
List<PmnActivityPromotionParam> params = pmnActivityPromotionParamService.listByIds(configs.stream().map(PmnActivityInstanceConfig::getParamId).collect(Collectors.toSet()));
|
|
|
|
|
Map<String, Object> content = new HashMap<>();
|
|
|
|
|
content.put("content", welcome.getContent());
|
|
|
|
|
returnValue.put("text", content);
|
|
|
|
|
for (PmnActivityPromotionParam param : params) {
|
|
|
|
|
if (param.getType().equals(1)) {
|
|
|
|
|
//图片
|
|
|
|
|
Map<String, Object> image = new HashMap<>();
|
|
|
|
|
image.put("media_id", param.getDefaultVal());
|
|
|
|
|
returnValue.put("image", image);
|
|
|
|
|
} else if (param.getType().equals(2)) {
|
|
|
|
|
//网页
|
|
|
|
|
Map<String, Object> link = new HashMap<>();
|
|
|
|
|
link.put("title", welcome.getContent());
|
|
|
|
|
link.put("picurl", null);
|
|
|
|
|
link.put("desc", param.getDescription());
|
|
|
|
|
link.put("url", param.getDefaultVal());
|
|
|
|
|
returnValue.put("link", link);
|
|
|
|
|
} else if (param.getType().equals(3)) {
|
|
|
|
|
Map<String, Object> mini = new HashMap<>();
|
|
|
|
|
mini.put("title", welcome.getContent());
|
|
|
|
|
mini.put("pic_media_id", null);
|
|
|
|
|
mini.put("app_id", param.getDefaultVal());
|
|
|
|
|
mini.put("page", param.getDescription());
|
|
|
|
|
returnValue.put("miniprogram", mini);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (eaCode != null) {
|
|
|
|
|
// 判断是否是活动扫码
|
|
|
|
|
if (eaCode.contains(Constants.ACTIVITY_QR_CODE_PREFIX)) {
|
|
|
|
@ -526,7 +575,7 @@ public class CustomerService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
insertRelation.setType(3);
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
PoiStore poiStore = poiStoreDOMapper.selectById(shopId);
|
|
|
|
|
insertRelation.setStoreCode(poiStore.getCode());
|
|
|
|
|
}
|
|
|
|
@ -652,16 +701,16 @@ public class CustomerService {
|
|
|
|
|
Long shopId = stafferInfoVOS.get(0).getStoreId();
|
|
|
|
|
IPage<FriendDTO> thisList;
|
|
|
|
|
// PageHelper.startPage(pageNum, pageSize);
|
|
|
|
|
com.baomidou.mybatisplus.extension.plugins.pagination.Page<FriendDTO> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(pageNum,pageSize);
|
|
|
|
|
com.baomidou.mybatisplus.extension.plugins.pagination.Page<FriendDTO> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(pageNum, pageSize);
|
|
|
|
|
|
|
|
|
|
if(startDate.getTime() == endDate.getTime()){
|
|
|
|
|
if (startDate.getTime() == endDate.getTime()) {
|
|
|
|
|
endDate = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (roleCode.equals(RoleEnum.ROLE_CODE_DZ.getRoleCode())) {
|
|
|
|
|
// 0、新增好友 1、累计好友
|
|
|
|
|
if (flag == 0) {
|
|
|
|
|
thisList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(page,shopId, sellerId, search, startDate, endDate, type);
|
|
|
|
|
thisList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(page, shopId, sellerId, search, startDate, endDate, type);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
thisList = opSellerCustomerRelationDOMapper.selectFriendListByShopIdAndDate(page, shopId, sellerId, search, startDate, endDate, type);
|
|
|
|
|