| @@ -45,7 +45,7 @@ public class WxTagsController extends BaseController { | |||
| @SystemControllerLog(description = "会员管理-查询会员用户人群") | |||
| public Result findCountByTag(Long[] tagIds) { | |||
| logger.debug("[" + getIpAddr() + "] WxTagsController::findCountByTag"); | |||
| return new ResultData(wxCUserTagsService.findTagList(getTenantId(), Arrays.asList(tagIds))); | |||
| return new ResultData(wxCUserTagsService.findTagList(getTenantInfo(), Arrays.asList(tagIds))); | |||
| } | |||
| @@ -8,6 +8,7 @@ import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.dto.WxCUserBasicInfoDto; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.UserCountVo; | |||
| import com.iformall.domain.vo.UserStructureVo; | |||
| import com.iformall.enums.*; | |||
| @@ -192,8 +193,9 @@ public class WxUserStructureController extends BaseController { | |||
| @SystemControllerLog(description = "会员管理-查询会员手机品牌结构") | |||
| public ResultData findUserPhoneBandStructure(Date startTime, Date endTime) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserPhoneBandStructure"); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(getTenantInfo()); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| dto.setStartTime(startTime); | |||
| dto.setEndTime(endTime); | |||
| long total = wxCUserBasicInfoService.findCount(dto); | |||
| @@ -210,7 +212,7 @@ public class WxUserStructureController extends BaseController { | |||
| for (int i = 0; i < tags.length; i++) { | |||
| WxTags tag = new WxTags(); | |||
| tag.setName(tags[i].getMessage()); | |||
| tag.setCount(wxCUserTagsService.countUser(getTenantId(), tags[i].getCode(), startTime, endTime)); | |||
| tag.setCount(wxCUserTagsService.countUser(tenantEntity, tags[i].getCode(), startTime, endTime)); | |||
| tagList.add(tag); | |||
| total -= tag.getCount(); | |||
| } | |||
| @@ -229,8 +231,9 @@ public class WxUserStructureController extends BaseController { | |||
| @SystemControllerLog(description = "会员管理-查询会员活跃结构") | |||
| public ResultData findUserActivityStructure(Date startTime, Date endTime) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserActivityStructure"); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(getTenantInfo()); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| dto.setStartTime(startTime); | |||
| dto.setEndTime(endTime); | |||
| long total = wxCUserBasicInfoService.findCount(dto); | |||
| @@ -246,7 +249,7 @@ public class WxUserStructureController extends BaseController { | |||
| for (int i = 0; i < tags.length; i++) { | |||
| WxTags tag = new WxTags(); | |||
| tag.setName(tags[i].getMessage()); | |||
| tag.setCount(wxCUserTagsService.countUser(getTenantId(), tags[i].getCode(), startTime, endTime)); | |||
| tag.setCount(wxCUserTagsService.countUser(tenantEntity, tags[i].getCode(), startTime, endTime)); | |||
| tagList.add(tag); | |||
| total -= tag.getCount(); | |||
| } | |||
| @@ -110,7 +110,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| WxCUserTags uTag = wxCUserTagsService.getById(info.getTagId()); | |||
| if (uTag != null && StringUtils.isNotBlank(uTag.getTags())) { | |||
| List<Long> ids = JSONObject.parseArray(uTag.getTags(), Long.class); | |||
| info.setTagsList(wxCUserTagsService.findTagList(getTenantId(), ids)); | |||
| info.setTagsList(wxCUserTagsService.findTagList(info.getTenantInfo(), ids)); | |||
| } | |||
| } | |||
| } | |||
| @@ -56,9 +56,8 @@ public class WxLevelConfigController extends BaseController { | |||
| @SystemControllerLog(description = "会员等级权益-新增") | |||
| public ResultData add(@RequestBody List<WxLevelConfig> levelConfigs) { | |||
| logger.debug("[" + getIpAddr() + "] WxLevelConfigController::add"); | |||
| String tenantId = getTenantId(); | |||
| try { | |||
| wxLevelConfigService.batchSave(tenantId, levelConfigs); | |||
| wxLevelConfigService.batchSave(getTenantInfo(), levelConfigs); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(ErrorCode.DB_FAIL); | |||
| @@ -71,9 +70,8 @@ public class WxLevelConfigController extends BaseController { | |||
| @SystemControllerLog(description = "会员等级权益-更改会员权益") | |||
| public ResultData updateCapabilities(@RequestBody List<WxLevelConfig> levelConfigs) { | |||
| logger.debug("[" + getIpAddr() + "] WxLevelConfigController::add"); | |||
| String tenantId = getTenantId(); | |||
| try { | |||
| wxLevelConfigService.batchUpdateCapabilities(tenantId, levelConfigs); | |||
| wxLevelConfigService.batchUpdateCapabilities(getTenantInfo(), levelConfigs); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(ErrorCode.DB_FAIL); | |||
| @@ -28,7 +28,7 @@ public class WxScoreRulesController extends BaseController { | |||
| @SystemControllerLog(description = "成长值-配置") | |||
| public ResultData list() { | |||
| logger.debug("[" + getIpAddr() + "] WxScoreRulesController::list"); | |||
| WxScoreRules scoreRules = wxScoreRulesService.getScoreRules(getTenantId()); | |||
| WxScoreRules scoreRules = wxScoreRulesService.getScoreRules(getTenantInfo()); | |||
| if (scoreRules.getCreditLocked() == null) { | |||
| scoreRules.setCreditLocked(EnumCreditLockedStatus.OPEN.getCode()); | |||
| } | |||
| @@ -50,7 +50,7 @@ public class WxScoreRulesController extends BaseController { | |||
| @SystemControllerLog(description = "积分-配置") | |||
| public ResultData creditRulesList() { | |||
| logger.debug("[" + getIpAddr() + "] WxScoreRulesController::list"); | |||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(getTenantId()); | |||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(getTenantInfo()); | |||
| return new ResultData(scoreRules); | |||
| } | |||
| @@ -77,7 +77,7 @@ public class WxMerchantBUserController extends BaseController { | |||
| } | |||
| resultMap.put("creditLocked", merchant.getCreditLocked()); | |||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(user.getTenantId()); | |||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(user); | |||
| if (scoreRules.getCreditLocked().equals(EnumCreditLockedStatus.CLOSE.getCode())) { | |||
| resultMap.put("creditLocked", EnumCreditLockedStatus.CLOSE.getCode()); | |||
| } | |||
| @@ -5,6 +5,7 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| import com.iformall.enums.EnumMerchantStatus; | |||
| import com.iformall.service.*; | |||
| @@ -94,10 +95,11 @@ public class WxMallController extends BaseController { | |||
| @ApiOperation("成长值相关信息") | |||
| @GetMapping("/scoreLevelInfo") | |||
| public ResultData getScoreLevelInfo() { | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| Map map = new HashMap(); | |||
| WxScoreRules scoreRules = wxScoreRulesService.getScoreRules(getTenantId()); | |||
| WxScoreRules scoreRules = wxScoreRulesService.getScoreRules(tenantEntity); | |||
| map.put("score", scoreRules); | |||
| List<WxLevelConfig> levelConfigList = wxLevelConfigService.getByTenantId(getTenantId()); | |||
| List<WxLevelConfig> levelConfigList = wxLevelConfigService.getByTenantInfo(tenantEntity); | |||
| boolean disscountEnable = false; | |||
| for(WxLevelConfig levelConfig: levelConfigList) { | |||
| if (levelConfig.getDiscountEnable() > 0 ) { | |||
| @@ -331,7 +331,7 @@ public class CouponSendSchedule { | |||
| } | |||
| } | |||
| int birthdayScale = CreditUtil.getBirthdayScoreScale(mall.getTenantId(), wxScoreRulesService); | |||
| int birthdayScale = CreditUtil.getBirthdayScoreScale(tenantEntity, wxScoreRulesService); | |||
| for (WxCUserBasicInfo cu : couponSendedUsers) { | |||
| // 记录积分倍率日期 | |||
| try { | |||
| @@ -20,4 +20,10 @@ public class BaseTenantEntity extends BaseEntity { | |||
| public void updateTenantInfo(BaseTenantEntity info) { | |||
| setTenantId(info.getTenantId()); | |||
| } | |||
| public TenantEntity getTenantInfo() { | |||
| return new TenantEntity() {{ | |||
| setTenantId(tenantId); | |||
| }}; | |||
| } | |||
| } | |||
| @@ -4,6 +4,7 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxCUserTags; | |||
| import com.iformall.domain.po.WxTags; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumAssignTagsTrigger; | |||
| import java.util.Date; | |||
| @@ -41,9 +42,9 @@ public interface WxCUserTagsService { | |||
| */ | |||
| void deleteById(Long id); | |||
| long countUser(String tenantId, Long tagId, Date startTime, Date endTime ); | |||
| long countUser(TenantEntity tenantEntity, Long tagId, Date startTime, Date endTime ); | |||
| List<WxTags> findTagList(String tenantId, List<Long> tagIds); | |||
| List<WxTags> findTagList(TenantEntity tenantEntity, List<Long> tagIds); | |||
| List<WxTags> assignTags(List<Long> tagIdList, WxCUserBasicInfo user); | |||
| @@ -33,7 +33,10 @@ public interface WxLevelConfigService { | |||
| * @param tenantId | |||
| * @return | |||
| */ | |||
| @Deprecated | |||
| List<WxLevelConfig> getByTenantId(String tenantId); | |||
| List<WxLevelConfig> getByTenantInfo(TenantEntity tenantEntity); | |||
| /** | |||
| * 根据Id获得实体 | |||
| @@ -53,13 +56,13 @@ public interface WxLevelConfigService { | |||
| /** | |||
| * 批量保存 | |||
| */ | |||
| void batchSave(String tenantId, List<WxLevelConfig> records); | |||
| void batchSave(TenantEntity tenantEntity, List<WxLevelConfig> records); | |||
| /** | |||
| * 批量更新 | |||
| */ | |||
| void batchUpdateCapabilities(String tenantId, List<WxLevelConfig> records); | |||
| void batchUpdateCapabilities(TenantEntity tenantEntity, List<WxLevelConfig> records); | |||
| Long getCapabilitiesOfSendCarConpon(JSONObject jo); | |||
| /** | |||
| * 根据Id删除实体 | |||
| @@ -69,14 +72,14 @@ public interface WxLevelConfigService { | |||
| void deleteById(Long id); | |||
| void deleteAll(String tenantId); | |||
| void deleteAll(TenantEntity tenantEntity); | |||
| /** | |||
| * 根据积分获取会员等级 | |||
| * @param tenantId | |||
| * @param tenantEntity | |||
| * @param score | |||
| * @return | |||
| */ | |||
| String getLevel(String tenantId,int score); | |||
| String getLevel(TenantEntity tenantEntity,int score); | |||
| /** | |||
| @@ -4,6 +4,7 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxProfitSharingReceiver; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import java.util.List; | |||
| @@ -49,6 +50,6 @@ public interface WxProfitSharingReceiverService { | |||
| ResultData updateReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver); | |||
| void sendMsg(String phone, String account, String merchant, String time, Integer modelType, String tenantId); | |||
| void sendMsg(String phone, String account, String merchant, String time, Integer modelType, TenantEntity tenantEntity); | |||
| } | |||
| @@ -2,6 +2,7 @@ package com.iformall.service; | |||
| import com.iformall.domain.po.WxScoreHistory; | |||
| import com.iformall.domain.po.WxScoreRules; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumScoreType; | |||
| import java.util.List; | |||
| @@ -10,17 +11,17 @@ public interface WxScoreRulesService { | |||
| /** | |||
| * 获取租户的ScoreRules | |||
| * @param tenantId | |||
| * @param tenantEntity | |||
| * @return | |||
| */ | |||
| WxScoreRules getScoreRules(String tenantId); | |||
| WxScoreRules getScoreRules(TenantEntity tenantEntity); | |||
| /** | |||
| * 获取租户的积分规则 | |||
| * @param tenantId | |||
| * @param tenantEntity | |||
| * @return | |||
| */ | |||
| WxScoreRules getCreditRules(String tenantId); | |||
| WxScoreRules getCreditRules(TenantEntity tenantEntity); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| @@ -7,6 +7,7 @@ import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.WxCUserTagsService; | |||
| @@ -87,21 +88,21 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { | |||
| @Override | |||
| public long countUser(String tenantId, Long tagId, Date startTime, Date endTime ) { | |||
| public long countUser(TenantEntity tenantEntity, Long tagId, Date startTime, Date endTime ) { | |||
| String str = JSON.toJSONString(tagId); | |||
| return wxCUserTagsMapper.countUser(str, tenantId, startTime, endTime); | |||
| return wxCUserTagsMapper.countUser(str, tenantEntity.getTenantId(), startTime, endTime); | |||
| } | |||
| @Override | |||
| public List<WxTags> findTagList(String tenantId, List<Long> tagIds) { | |||
| public List<WxTags> findTagList(TenantEntity tenantEntity, List<Long> tagIds) { | |||
| if (tagIds == null || tagIds.isEmpty()) | |||
| return new ArrayList<WxTags>(); | |||
| WxTags wxTags =new WxTags(); | |||
| wxTags.setIds(tagIds); | |||
| List<WxTags> list = wxTagsMapper.findList(wxTags); | |||
| for (WxTags t : list) { | |||
| t.setCount(countUser(tenantId,t.getId(),null,null)); | |||
| t.setCount(countUser(tenantEntity,t.getId(),null,null)); | |||
| } | |||
| return list; | |||
| } | |||
| @@ -125,17 +125,17 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| } | |||
| //清除缓存 | |||
| clearCache(record.getTenantId()); | |||
| clearCache(record); | |||
| return new ResultData(); | |||
| } | |||
| /** | |||
| * 清除c端首页券列表缓存 | |||
| * @param tenantId | |||
| * @param tenantEntity | |||
| */ | |||
| public void clearCache(String tenantId){ | |||
| public void clearCache(TenantEntity tenantEntity){ | |||
| for (int i = 1; i <=5 ; i++) { | |||
| String key = EnumCacheKey.C_INDEX_PAGE_LIST.getMessage()+tenantId+"_" + i + ":"; | |||
| String key = EnumCacheKey.C_INDEX_PAGE_LIST.getMessage()+tenantEntity.getTenantId()+"_" + i + ":"; | |||
| cdRedisTemplate.delete(key); | |||
| } | |||
| } | |||
| @@ -408,28 +408,28 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||
| return 0; | |||
| } | |||
| // 1. 获取当前租户下积分的增加规则 | |||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record); | |||
| // 2. 增长的积分 | |||
| return wxScoreRules.getRule(EnumScoreType.LOGIN, WxScoreRules.SCORE); | |||
| } | |||
| private int bindCarAddCredit(WxCreditHistory record) { | |||
| // 1. 获取score rules | |||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record); | |||
| // 2. 增长的积分 | |||
| return wxScoreRules.getRule(EnumScoreType.BIND_CAR, WxScoreRules.SCORE); | |||
| } | |||
| private int personAddCredit(WxCreditHistory record) { | |||
| // 1. 获取score rules | |||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record); | |||
| // 2. 增长的积分 | |||
| return wxScoreRules.getRule(EnumScoreType.WECHAT_PERSION, WxScoreRules.SCORE); | |||
| } | |||
| private int phoneAddCredit(WxCreditHistory record) { | |||
| // 1. 获取score rules | |||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record); | |||
| // 2. 获取成长值 | |||
| return wxScoreRules.getRule(EnumScoreType.WECHAT_PHONE, WxScoreRules.SCORE); | |||
| } | |||
| @@ -447,7 +447,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||
| if (user == null || checkCompleteInfoScoreCount(user) > 0) | |||
| return 0; | |||
| // 1. 获取score rules | |||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(user.getTenantId()); | |||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(record); | |||
| // 2. 获取成长值 | |||
| return scoreRules.getRule(EnumScoreType.COMPLETE_INFO, WxScoreRules.SCORE); | |||
| } | |||
| @@ -476,7 +476,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||
| if (record.getCreditNum() != null && record.getCreditNum() == 0) | |||
| return 0; | |||
| // 1. 获取score rules | |||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(record); | |||
| // 2. 获取成长值 by id | |||
| JSONObject payRule = scoreRules.getRuleObj(EnumScoreType.CONSUMPTION); | |||
| @@ -119,6 +119,14 @@ public class WxLevelConfigServiceImpl implements WxLevelConfigService { | |||
| return wxLevelConfigMapper.findList(wxLevelConfig); | |||
| } | |||
| @Override | |||
| public List<WxLevelConfig> getByTenantInfo(TenantEntity tenantEntity) { | |||
| WxLevelConfig wxLevelConfig = new WxLevelConfig(); | |||
| wxLevelConfig.updateTenantInfo(tenantEntity); | |||
| wxLevelConfig.setSortColumns(BaseEntity.SortField.Points_ASC); | |||
| return wxLevelConfigMapper.findList(wxLevelConfig); | |||
| } | |||
| @Override | |||
| public WxLevelConfig getById(Long id) { | |||
| return wxLevelConfigMapper.selectById(id); | |||
| @@ -138,9 +146,9 @@ public class WxLevelConfigServiceImpl implements WxLevelConfigService { | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| @Override | |||
| public void batchSave(String tenantId, List<WxLevelConfig> records) { | |||
| public void batchSave(TenantEntity tenantEntity, List<WxLevelConfig> records) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| wxLevelConfigMapper.deleteAll(tenantId); | |||
| wxLevelConfigMapper.deleteAll(tenantEntity.getTenantId()); | |||
| List<WxLevelConfig> levelConfigs = new ArrayList<>(); | |||
| for(WxLevelConfig levelConfig: records) { | |||
| if(levelConfig.getId() == null) { | |||
| @@ -150,18 +158,18 @@ public class WxLevelConfigServiceImpl implements WxLevelConfigService { | |||
| } else { | |||
| levelConfig.setUpdateDate(new Date()); | |||
| } | |||
| levelConfig.setTenantId(tenantId); | |||
| levelConfig.updateTenantInfo(tenantEntity); | |||
| levelConfigs.add(levelConfig); | |||
| } | |||
| wxLevelConfigMapper.insertBatch(levelConfigs); | |||
| } | |||
| @Override | |||
| public void batchUpdateCapabilities(String tenantId, List<WxLevelConfig> records) { | |||
| public void batchUpdateCapabilities(TenantEntity tenantEntity, List<WxLevelConfig> records) { | |||
| List<WxLevelConfig> levelConfigs = new ArrayList<WxLevelConfig>(); | |||
| for(WxLevelConfig levelConfig: records) { | |||
| if(levelConfig.getId() != null && levelConfig.getCount() != null) { | |||
| levelConfig.setTenantId(tenantId); | |||
| levelConfig.updateTenantInfo(tenantEntity); | |||
| levelConfig.setUpdateDate(new Date()); | |||
| JSONObject jo = new JSONObject(); | |||
| jo.put(CAPABILITY_SEND_CAR_COUPON,levelConfig.getCount()); | |||
| @@ -183,14 +191,14 @@ public class WxLevelConfigServiceImpl implements WxLevelConfigService { | |||
| } | |||
| @Override | |||
| public void deleteAll(String tenantId) { | |||
| wxLevelConfigMapper.deleteAll(tenantId); | |||
| public void deleteAll(TenantEntity tenantEntity) { | |||
| wxLevelConfigMapper.deleteAll(tenantEntity.getTenantId()); | |||
| } | |||
| @Override | |||
| public String getLevel(String tenantId, int score) { | |||
| return wxLevelConfigMapper.getLevel(tenantId,score); | |||
| public String getLevel(TenantEntity tenantEntity, int score) { | |||
| return wxLevelConfigMapper.getLevel(tenantEntity.getTenantId(),score); | |||
| } | |||
| @Override | |||
| @@ -706,7 +706,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| if (isUse.equals(EnumProfitSharingUse.NO.getCode())) { | |||
| type = EnumMsgModel.ACCEPT_SHARING_ACCOUNT_NOTIFY_MANAGER.getCode(); | |||
| } | |||
| wxProfitSharingReceiverService.sendMsg(linkPhone, accout, merchantName, null, type, tenantId); | |||
| wxProfitSharingReceiverService.sendMsg(linkPhone, accout, merchantName, null, type, wxMerchant); | |||
| return new ResultData(Result.SUCCESS, "操作成功"); | |||
| } | |||
| @@ -13,6 +13,7 @@ import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxPayAccount; | |||
| import com.iformall.domain.po.WxProfitSharingReceiver; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.msg.WxMsgRecord; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| import com.iformall.enums.*; | |||
| @@ -108,13 +109,13 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| public ResultData addReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver, List<WxProfitSharingReceiver> delList) { | |||
| WxAppinfo appInfo = new WxAppinfo(); | |||
| appInfo.setTenantId(merchant.getTenantId()); | |||
| appInfo.updateTenantInfo(merchant); | |||
| appInfo.setType(EnumAppType.C.getCode()); | |||
| appInfo = wxAppinfoMapper.findList(appInfo).get(0); | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); | |||
| receiver.setTenantId(merchant.getTenantId()); | |||
| receiver.updateTenantInfo(merchant); | |||
| receiver.setMerchantId(merchant.getId()); | |||
| receiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT.getCode()); | |||
| receiver.setId(IdWorker.get().nextId()); | |||
| @@ -186,15 +187,15 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| if (size == 0) { | |||
| //发送添加短信 | |||
| sendMsgByType(EnumMsgModel.ADD_SHARING_ACCOUNT_NOTIFY_MERCHANT.getCode(), merchant.getId(), receiver.getReceiverAccount(), receiver.getTenantId()); | |||
| sendMsgByType(EnumMsgModel.ADD_SHARING_ACCOUNT_NOTIFY_MERCHANT.getCode(), merchant.getId(), receiver.getReceiverAccount(), receiver); | |||
| } else { | |||
| //添加变更短信 | |||
| sendMsgByType(EnumMsgModel.UPDATE_SHARING_ACCOUNT_NOTIFY_MERCHANT.getCode(), merchant.getId(), receiver.getReceiverAccount(), receiver.getTenantId()); | |||
| sendMsgByType(EnumMsgModel.UPDATE_SHARING_ACCOUNT_NOTIFY_MERCHANT.getCode(), merchant.getId(), receiver.getReceiverAccount(), receiver); | |||
| } | |||
| return new ResultData(returnMap); | |||
| } | |||
| private void sendMsgByType(Integer type, Long merchantId, String account, String tenantId) { | |||
| private void sendMsgByType(Integer type, Long merchantId, String account, TenantEntity tenantEntity) { | |||
| WxMerchantDto wxMerchantDto = new WxMerchantDto(); | |||
| wxMerchantDto.setId(merchantId); | |||
| List<WxMerchantVo> listCVo = wxMerchantMapper.findListCVo(wxMerchantDto); | |||
| @@ -211,12 +212,12 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| } | |||
| String time = DateUtils.getSystemTime("yyyy年MM月dd日HH时mm分"); | |||
| String merchantName = wxMerchant.getMerchantName(); | |||
| sendMsg(phone, account, merchantName, time, type, tenantId); | |||
| sendMsg(phone, account, merchantName, time, type, tenantEntity); | |||
| } | |||
| @Override | |||
| public void sendMsg(String phone, String account, String merchant, String time, Integer modelType, String tenantId) { | |||
| public void sendMsg(String phone, String account, String merchant, String time, Integer modelType, TenantEntity tenantEntity) { | |||
| // 发送短信 | |||
| logger.info("》》》》》》》》》》》"); | |||
| logger.info("商户分账账户发送短信开始"); | |||
| @@ -239,7 +240,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| wxMsgRecord.setMsgType(EnumMsgRecordType.SMS.getCode()); | |||
| wxMsgRecord.setModelType(modelType); | |||
| wxMsgRecord.setReceiver(phone); | |||
| wxMsgRecord.setTenantId(tenantId); | |||
| wxMsgRecord.updateTenantInfo(tenantEntity); | |||
| wxMsgRecord.setDynamicContentMap(msgReplaceMap); | |||
| mqBaseProducer.sendMessage(wxMsgRecord, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| logger.info("》》》》》》》》》》》"); | |||
| @@ -250,7 +251,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| @Override | |||
| public ResultData delReceiver(WxProfitSharingReceiver receiver, Integer send) { | |||
| WxAppinfo appInfo = new WxAppinfo(); | |||
| appInfo.setTenantId(receiver.getTenantId()); | |||
| appInfo.updateTenantInfo(receiver); | |||
| appInfo.setType(EnumAppType.C.getCode()); | |||
| appInfo = wxAppinfoMapper.findList(appInfo).get(0); | |||
| @@ -264,7 +265,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| //检查此接受者是否注册在同一个商场的别的商户下 | |||
| final WxProfitSharingReceiver receiverParam = receiver; | |||
| WxProfitSharingReceiver params = new WxProfitSharingReceiver(); | |||
| params.setTenantId(receiver.getTenantId()); | |||
| params.updateTenantInfo(receiver); | |||
| params.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| List<WxProfitSharingReceiver> receiverList = wxProfitSharingReceiverMapper.findList(params); | |||
| if (receiverList.stream().anyMatch(r -> ( | |||
| @@ -328,7 +329,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| //发送短信 | |||
| if (send.equals(EnumMsgSend.MSG_SEND_IMMEDIATELY.getCode())) { | |||
| sendMsgByType(EnumMsgModel.DELETE_SHARING_ACCOUNT_NOTIFY_MERCHANT.getCode(), receiver.getMerchantId(), receiver.getReceiverAccount(), receiver.getTenantId()); | |||
| sendMsgByType(EnumMsgModel.DELETE_SHARING_ACCOUNT_NOTIFY_MERCHANT.getCode(), receiver.getMerchantId(), receiver.getReceiverAccount(), receiver); | |||
| } | |||
| return new ResultData(); | |||
| @@ -338,7 +339,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||
| public ResultData updateReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver) { | |||
| WxProfitSharingReceiver oldReceiver = new WxProfitSharingReceiver(); | |||
| oldReceiver.setTenantId(merchant.getTenantId()); | |||
| oldReceiver.updateTenantInfo(merchant); | |||
| oldReceiver.setMerchantId(merchant.getId()); | |||
| oldReceiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT.getCode()); | |||
| oldReceiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumBusiness; | |||
| import com.iformall.enums.EnumCUserBasicInfoStatus; | |||
| import com.iformall.enums.EnumScoreRules; | |||
| @@ -47,9 +48,9 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||
| WxMerchantMapper wxMerchantMapper; | |||
| @Override | |||
| public WxScoreRules getScoreRules(String tenantId) { | |||
| public WxScoreRules getScoreRules(TenantEntity tenantEntity) { | |||
| // get pushLime from cache | |||
| String key = Constant.SCORE_RULES_KEY_PREV + tenantId; | |||
| String key = Constant.SCORE_RULES_KEY_PREV + tenantEntity.getTenantId(); | |||
| // 缓存存在 | |||
| if (scoreRulesRedisTemplate.hasKey(key)) { | |||
| @@ -59,7 +60,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||
| } | |||
| WxScoreRules scoreRules = new WxScoreRules(); | |||
| scoreRules.setTenantId(tenantId); | |||
| scoreRules.updateTenantInfo(tenantEntity); | |||
| scoreRules.setType(EnumScoreRules.SCORE.getCode()); | |||
| List<WxScoreRules> list = wxScoreRulesMapper.findList(scoreRules); | |||
| if (list.size() > 0) { | |||
| @@ -123,9 +124,9 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||
| } | |||
| @Override | |||
| public WxScoreRules getCreditRules(String tenantId) { | |||
| public WxScoreRules getCreditRules(TenantEntity tenantEntity) { | |||
| // get pushLime from cache | |||
| String key = Constant.CREDIT_RULES_KEY_PREV + tenantId; | |||
| String key = Constant.CREDIT_RULES_KEY_PREV + tenantEntity.getTenantId(); | |||
| // 缓存存在 | |||
| if (scoreRulesRedisTemplate.hasKey(key)) { | |||
| @@ -135,7 +136,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||
| } | |||
| WxScoreRules scoreRules = new WxScoreRules(); | |||
| scoreRules.setTenantId(tenantId); | |||
| scoreRules.updateTenantInfo(tenantEntity); | |||
| scoreRules.setType(EnumScoreRules.CREDIT.getCode()); | |||
| List<WxScoreRules> list = wxScoreRulesMapper.findList(scoreRules); | |||
| if (list.size() > 0) { | |||
| @@ -319,7 +320,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||
| return 0; | |||
| // 1. score_rules | |||
| WxScoreRules scoreRules = getScoreRules(user.getTenantId()); | |||
| WxScoreRules scoreRules = getScoreRules(user); | |||
| // 2. 增长的成长值 | |||
| addScoreNumber = scoreRules.getRule(EnumScoreType.LOGIN,WxScoreRules.SCORE); | |||
| @@ -338,7 +339,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||
| if (order.getPayment() == 0) | |||
| return 0; | |||
| // 1. 获取score rules | |||
| WxScoreRules scoreRules = getScoreRules(order.getTenantId()); | |||
| WxScoreRules scoreRules = getScoreRules(order); | |||
| // 2. 获取成长值 by id | |||
| JSONObject payRule = scoreRules.getRuleObj(EnumScoreType.CONSUMPTION); | |||
| @@ -394,7 +395,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||
| private int bindCarAddScore(WxCUserCar userCar) { | |||
| int addScoreNumber = 0; | |||
| // 1. 获取score rules | |||
| WxScoreRules scoreRules = getScoreRules(userCar.getTenantId()); | |||
| WxScoreRules scoreRules = getScoreRules(userCar.getTenantInfo()); | |||
| // 2. 获取成长值 | |||
| addScoreNumber = scoreRules.getRule(EnumScoreType.BIND_CAR,WxScoreRules.SCORE); | |||
| @@ -410,7 +411,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||
| private int personAddScore(WxCUser user) { | |||
| int addScoreNumber = 0; | |||
| // 1. 获取score rules | |||
| WxScoreRules scoreRules = getScoreRules(user.getTenantId()); | |||
| WxScoreRules scoreRules = getScoreRules(user); | |||
| // 2. 获取成长值 | |||
| addScoreNumber = scoreRules.getRule(EnumScoreType.WECHAT_PERSION,WxScoreRules.SCORE); | |||
| @@ -426,7 +427,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||
| private int phoneAddScore(WxCUser user) { | |||
| int addScoreNumber = 0; | |||
| // 1. 获取score rules | |||
| WxScoreRules scoreRules = getScoreRules(user.getTenantId()); | |||
| WxScoreRules scoreRules = getScoreRules(user); | |||
| // 2. 获取成长值 | |||
| addScoreNumber = scoreRules.getRule(EnumScoreType.WECHAT_PHONE,WxScoreRules.SCORE); | |||
| @@ -455,7 +456,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||
| return 0; | |||
| // 1. 获取score rules | |||
| WxScoreRules scoreRules = getScoreRules(user.getTenantId()); | |||
| WxScoreRules scoreRules = getScoreRules(user); | |||
| // 2. 获取成长值 | |||
| addScoreNumber = scoreRules.getRule(EnumScoreType.COMPLETE_INFO,WxScoreRules.SCORE); | |||
| @@ -1,6 +1,7 @@ | |||
| package com.iformall.utils; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.mapper.WxLevelConfigMapper; | |||
| import com.iformall.service.WxScoreRulesService; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| @@ -102,14 +103,14 @@ public class CreditUtil { | |||
| if(Objects.isNull(wxCUserBasicInfo.getScoreDate())) { | |||
| //设置过生日的用户 | |||
| if (Objects.nonNull(wxCUserBasicInfo.getBirthdate()) && DateUtils.birthdaysBetween(wxCUserBasicInfo.getBirthdate()) == 0) { | |||
| birthdayScale = getBirthdayScoreScale(wxCUserBasicInfo.getTenantId(), wxScoreRulesService); | |||
| birthdayScale = getBirthdayScoreScale(wxCUserBasicInfo.getTenantInfo(), wxScoreRulesService); | |||
| } else { | |||
| log.info("积分倍率计算:未设置生日或生日条件未匹配={}", wxCUserBasicInfo.getScoreDate()); | |||
| } | |||
| } else { | |||
| //发过生日券的用户或者享受过生日积分倍率的用户 | |||
| if (Objects.nonNull(wxCUserBasicInfo.getScoreDate()) && DateUtils.birthdaysBetween(wxCUserBasicInfo.getScoreDate()) == 0) { | |||
| birthdayScale = getBirthdayScoreScale(wxCUserBasicInfo.getTenantId(), wxScoreRulesService); | |||
| birthdayScale = getBirthdayScoreScale(wxCUserBasicInfo.getTenantInfo(), wxScoreRulesService); | |||
| } | |||
| } | |||
| @@ -123,13 +124,13 @@ public class CreditUtil { | |||
| /** | |||
| * 获取生日积分倍率 | |||
| * | |||
| * @param tenantId | |||
| * @param tenantEntity | |||
| * @param wxScoreRulesService | |||
| * @return | |||
| */ | |||
| public static int getBirthdayScoreScale(String tenantId, WxScoreRulesService wxScoreRulesService) { | |||
| public static int getBirthdayScoreScale(TenantEntity tenantEntity, WxScoreRulesService wxScoreRulesService) { | |||
| int birthdayScale = WxScoreRules.DEFAULT_SCALE; | |||
| WxScoreRules rules = wxScoreRulesService.getCreditRules(tenantId); | |||
| WxScoreRules rules = wxScoreRulesService.getCreditRules(tenantEntity); | |||
| if (Objects.nonNull(rules) && Objects.nonNull(rules.getScale())) { | |||
| //规则存使用积分倍率 | |||
| birthdayScale = rules.getScale(); | |||