| | |
| | | import com.ks.lijin.service.LiJinExpendRecordService; |
| | | import com.ks.lijin.service.LiJinLinkService; |
| | | import com.ks.lijin.service.LijinCreateService; |
| | | import com.ks.vip.exception.LijinBalanceException; |
| | | import com.ks.vip.exception.OrderPayException; |
| | | import com.ks.vip.exception.VipOrderException; |
| | | import com.ks.vip.pojo.DO.*; |
| | | import com.ks.vip.pojo.DTO.PayWayInfoDTO; |
| | |
| | | import com.ks.vip.pojo.Enums.VIPEnum; |
| | | import com.ks.vip.service.*; |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.config.SystemConfigKeyEnum; |
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum; |
| | | import com.yeshi.fanli.lijin.dto.TodayLijinCreatedInfo; |
| | | import com.yeshi.fanli.lijin.vo.UserLijinLevelInfoVO; |
| | | import com.yeshi.fanli.service.inter.config.ConfigService; |
| | | import com.yeshi.fanli.service.inter.config.SystemConfigService; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService; |
| | | import com.yeshi.fanli.util.account.UserUtil; |
| | | import org.apache.dubbo.config.annotation.Reference; |
| | | import org.springframework.stereotype.Component; |
| | | import org.yeshi.utils.TimeUtil; |
| | |
| | | @Component |
| | | public class UserLijinMnager { |
| | | |
| | | @Reference(version = "1.0", check = false) |
| | | private LijinCreateService lijinCreateService; |
| | | // @Reference(version = "1.0", check = false, url = "dubbo://193.112.35.168:20904/com.ks.lijin.service.LijinCreateService") |
| | | // @Reference(version = "1.0", check = false, timeout = 30000) |
| | | // private LijinCreateService lijinCreateService; |
| | | |
| | | // @Reference(version = "1.0", check = false, url = "dubbo://193.112.35.168:20902/com.ks.vip.service.VipCenterService") |
| | | @Reference(version = "1.0", check = false) |
| | | private VipCenterService vipCenterService; |
| | | |
| | | // @Reference(version = "1.0", check = false,url="dubbo://193.112.35.168:20902/com.ks.vip.service.VipCenterRecordService") |
| | | @Reference(version = "1.0", check = false) |
| | | private VipCenterRecordService vipCenterRecordService; |
| | | |
| | | // @Reference(version = "1.0", check = false, url = "dubbo://193.112.35.168:20902/com.ks.vip.service.VipGradePotenceService") |
| | | @Reference(version = "1.0", check = false) |
| | | private VipGradePotenceService vipGradePotenceService; |
| | | |
| | | |
| | | // @Reference(version = "1.0", check = false, url = "dubbo://193.112.35.168:20902/com.ks.vip.service.VipGradeService") |
| | | @Reference(version = "1.0", check = false) |
| | | private VipGradeService vipGradeService; |
| | | |
| | | // @Reference(version = "1.0", check = false,url="dubbo://193.112.35.168:20902/com.ks.vip.service.VipComboService") |
| | | @Reference(version = "1.0", check = false) |
| | | private VipComboService vipComboService; |
| | | |
| | | // @Reference(version = "1.0", check = false, url = "dubbo://193.112.35.168:20904/com.ks.lijin.service.LiJinLinkService") |
| | | @Reference(version = "1.0", check = false) |
| | | private LiJinLinkService liJinLinkService; |
| | | |
| | | // @Reference(version = "1.0", check = false, url = "dubbo://193.112.35.168:20904/com.ks.lijin.service.LiJinExpendRecordService") |
| | | @Reference(version = "1.0", check = false) |
| | | private LiJinExpendRecordService liJinExpendRecordService; |
| | | |
| | | // @Reference(version = "1.0", check = false,url="dubbo://193.112.35.168:20902/com.ks.vip.service.VipOrederService") |
| | | @Reference(version = "1.0", check = false) |
| | | private VipOrederService vipOrederService; |
| | | |
| | | // @Reference(version = "1.0", check = false,url="dubbo://193.112.35.168:20902/com.ks.vip.service.VipOrederPayService") |
| | | @Reference(version = "1.0", check = false) |
| | | private VipOrederPayService vipOrederPayService; |
| | | // @Reference(version = "1.0", check = false,url="dubbo://193.112.35.168:20902/com.ks.vip.service.VipOrederPayService") |
| | | @Reference(version = "1.0", check = false) |
| | | private LijinBalanceService lijinBalanceService; |
| | | @Reference(version = "1.0", check = false) |
| | | private LijinRecordService lijinRecordService; |
| | | |
| | | |
| | | @Resource |
| | | private ConfigService configService; |
| | | |
| | | @Resource |
| | | private SystemConfigService systemConfigService; |
| | | |
| | | @Resource |
| | | private UserInfoService userInfoService; |
| | | |
| | | |
| | | private String getUid(Long uid) { |
| | | if (uid == null) |
| | | return null; |
| | | return "tejia-" + uid; |
| | | |
| | | SystemEnum system = userInfoService.getUserSystem(uid); |
| | | if (system == null) |
| | | return null; |
| | | return systemConfigService.getValueCache(SystemConfigKeyEnum.thirdAppUidPrefix, system) + uid; |
| | | } |
| | | |
| | | public VIPEnum getVIPRank(Long uid) { |
| | |
| | | * @return |
| | | */ |
| | | public UserLijinLevelInfoVO getUserLevelInfo(Long uid, SystemEnum system) { |
| | | if (system == SystemEnum.yhqjx) { |
| | | if (system == SystemEnum.yhqjx || system == SystemEnum.hsb) { |
| | | VIPEnum rank = getVIPRank(uid); |
| | | UserLijinLevelInfoVO vo = new UserLijinLevelInfoVO(); |
| | | vo.setUserLevel(getVIPRank(uid).name()); |
| | | vo.setLoadingAdInfo(new UserLijinLevelInfoVO.ADInfo("gdt2", "9041686956722647")); |
| | | if (rank == getDefaultRank()) { |
| | | //当前为默认等级,可以升级 |
| | | vo.setUpgradeRights(new UserLijinLevelInfoVO.UpgradeRights("铂金会员免广告,礼金提高100%", configService.getValue(ConfigKeyEnum.lijinVIPLink, system))); |
| | | vo.setUpgradeRights(new UserLijinLevelInfoVO.UpgradeRights("铂金会员免广告,礼金红包提高216%", configService.getValue(ConfigKeyEnum.lijinVIPLink, system))); |
| | | } |
| | | return vo; |
| | | } |
| | |
| | | dto.setPayAccount(null); |
| | | dto.setPayMoney(vipCombo.getDiscountPrice()); |
| | | dto.setPayWay(payWay); |
| | | dto.setThreeOrderId("tejia-vip-" + uid + "-" + TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMddHHmmssSSS")); |
| | | dto.setThreeOrderId("tv" + TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMddHHmmssSSS") + uid); |
| | | return vipOrederPayService.addOrderWithPay(dto, notifuUrl, resturnUrl, ip); |
| | | } |
| | | |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public VipOrder checkPay(Long id) { |
| | | public VipOrder checkPay(Long id) throws OrderPayException, VipOrderException { |
| | | return vipOrederPayService.checkOrderPayState(id); |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | public String getWXPaySuccessOutOrderNo(String notifyContent) throws Exception { |
| | | return vipOrederPayService.getWXPaySuccessOutOrderNo(notifyContent); |
| | | return vipOrederPayService.getWXPaySuccessOutOrderNo(notifyContent); |
| | | } |
| | | |
| | | |
| | | public String getAlipayPaySuccessOutOrderNo(Map<String, String> params) throws Exception { |
| | | return vipOrederPayService.getAlipayPaySuccessOutOrderNo(params); |
| | | return vipOrederPayService.getAlipayPaySuccessOutOrderNo(params); |
| | | } |
| | | |
| | | public void addLijin(Long uid, BigDecimal money, String title, String category) throws LijinBalanceException { |
| | | lijinBalanceService.addLijin(getUid(uid), money, title, category, null); |
| | | } |
| | | |
| | | public List<UserLijinRecord> getLijinRecord(Long uid, Integer type, int page, int pageSize) { |
| | | return lijinRecordService.listRecord(getUid(uid), type, page, pageSize); |
| | | } |
| | | |
| | | public long countLijinRecord(Long uid, Integer type) { |
| | | return lijinRecordService.countRecord(getUid(uid), type); |
| | | } |
| | | |
| | | public UserLijinRecord getLijinRecord(Long uid, Integer type, String category) { |
| | | return lijinRecordService.getRecord(getUid(uid), type, category, null); |
| | | } |
| | | |
| | | /** |
| | | * 获取礼金余额 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | public BigDecimal getLijinBalance(Long uid) { |
| | | return lijinBalanceService.getBalance(getUid(uid)); |
| | | } |
| | | |
| | | /** |
| | | * 获取使用中的礼金 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | public BigDecimal getUsingLijin(Long uid) { |
| | | return lijinBalanceService.getUsingLijin(getUid(uid)); |
| | | } |
| | | |
| | | /** |
| | | * 初始化余额 |
| | | * |
| | | * @param uid |
| | | */ |
| | | public void initBalance(Long uid) { |
| | | lijinBalanceService.init(getUid(uid)); |
| | | } |
| | | |
| | | |