From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 25 二月 2025 16:41:22 +0800 Subject: [PATCH] 淘宝转链接口更新 --- fanli/src/main/java/com/yeshi/fanli/lijin/manager/UserLijinMnager.java | 191 ++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 186 insertions(+), 5 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/lijin/manager/UserLijinMnager.java b/fanli/src/main/java/com/yeshi/fanli/lijin/manager/UserLijinMnager.java index 6476f8a..e734f08 100644 --- a/fanli/src/main/java/com/yeshi/fanli/lijin/manager/UserLijinMnager.java +++ b/fanli/src/main/java/com/yeshi/fanli/lijin/manager/UserLijinMnager.java @@ -3,67 +3,118 @@ 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.DTO.VipOrderDTO; +import com.ks.vip.pojo.Enums.PayWayEnum; 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; import javax.annotation.Resource; import java.math.BigDecimal; +import java.util.Date; import java.util.List; +import java.util.Map; @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) { VIPEnum rank = null; if (uid != null) rank = vipCenterService.getVIPEnumByUid(getUid(uid)); + if (rank == null) + rank = vipGradeService.getDefaultGrade().getIdentity(); + return rank; + } + + + public VIPEnum getVIPRank(Long uid, Date date) { + VIPEnum rank = null; + if (uid != null) + rank = vipCenterService.getVIPEnumByUid(getUid(uid), date); if (rank == null) rank = vipGradeService.getDefaultGrade().getIdentity(); return rank; @@ -128,14 +179,14 @@ * @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; } @@ -174,4 +225,134 @@ } + /** + * 鑾峰彇鐢ㄦ埛鐨勮繑鍒╂瘮渚� + * + * @param uid + * @param date + * @return + */ + public BigDecimal getUserFanliRate(Long uid, Date date) { + VIPEnum vipRank = getVIPRank(uid, date); + VipGradePotence potence = vipGradePotenceService.getPotenceByVipEnum(vipRank, date); + return potence.getRebatePercent(); + } + + /** + * 鍒涘缓璁㈠崟 + * + * @param uid + * @param cid + * @param payWay + * @return + */ + public PayWayInfoDTO createVIPOrder(Long uid, Long cid, PayWayEnum payWay, String ip) throws VipOrderException { + VipCombo vipCombo = vipComboService.selectByPrimaryKey(cid); + if (vipCombo == null) { + throw new VipOrderException(1, "濂楅涓虹┖"); + } + String notifuUrl = "http://api.tejia.yeshitv.com/fanli/alipay/pay/lijinvip"; + String resturnUrl = "http://vip.tejia.yeshitv.com/pay_success.html"; + if (payWay == PayWayEnum.weChat) { + resturnUrl = "http://vip.tejia.yeshitv.com/pay_finish.html"; + notifuUrl = "http://api.tejia.yeshitv.com/fanli/wx/pay/lijinvip"; + } + + VipOrderDTO dto = new VipOrderDTO(); + dto.setUid(getUid(uid)); + dto.setComboId(cid); + dto.setPayAccount(null); + dto.setPayMoney(vipCombo.getDiscountPrice()); + dto.setPayWay(payWay); + dto.setThreeOrderId("tv" + TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMddHHmmssSSS") + uid); + return vipOrederPayService.addOrderWithPay(dto, notifuUrl, resturnUrl, ip); + } + + /** + * 鑾峰彇鏀粯瀹濈殑鏀粯琛ㄥ崟 + * + * @param formId + * @return + */ + public String getAlipayPayForm(String formId) { + return vipOrederPayService.getAlipayForm(formId); + } + + /** + * 妫�鏌ユ槸鍚︽敮浠� + * + * @param id + * @return + */ + public VipOrder checkPay(Long id) throws OrderPayException, VipOrderException { + return vipOrederPayService.checkOrderPayState(id); + } + + + /** + * 鏍规嵁涓夋柟鏀粯璁㈠崟ID鏌ヨ + * + * @param threeOrderId + * @return + */ + public VipOrder selectVipOrderByThreeOrderId(String threeOrderId) { + return vipOrederService.selectByThreeOrderId(threeOrderId); + } + + + public String getWXPaySuccessOutOrderNo(String notifyContent) throws Exception { + return vipOrederPayService.getWXPaySuccessOutOrderNo(notifyContent); + } + + + public String getAlipayPaySuccessOutOrderNo(Map<String, String> params) throws Exception { + 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)); + } + + } -- Gitblit v1.8.0