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/service/impl/tlj/UserTaoLiJinReportServiceImpl.java | 242 +++++++++++++----------------------------------- 1 files changed, 65 insertions(+), 177 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinReportServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinReportServiceImpl.java index 58a9711..0301c01 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinReportServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinReportServiceImpl.java @@ -1,177 +1,65 @@ -package com.yeshi.fanli.service.impl.tlj; - -import java.math.BigDecimal; -import java.util.Date; -import java.util.List; - -import javax.annotation.Resource; - -import org.springframework.stereotype.Service; - -import com.yeshi.fanli.dao.mybatis.tlj.UserTaoLiJinReportMapper; -import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinReport; -import com.yeshi.fanli.exception.tlj.UserTaoLiJinOriginException; -import com.yeshi.fanli.log.LogHelper; -import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService; -import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinReportService; -import com.yeshi.fanli.util.MoneyBigDecimalUtil; -import com.yeshi.fanli.util.StringUtil; -import com.yeshi.fanli.util.taobao.TaoKeApiUtil; - -@Service -public class UserTaoLiJinReportServiceImpl implements UserTaoLiJinReportService{ - - @Resource - private UserTaoLiJinReportMapper userTaoLiJinReportMapper; - - @Resource - private UserTaoLiJinOriginService userTaoLiJinOriginService; - - @Override - public void insertDefault(String rightsId) { - if (StringUtil.isNullOrEmpty(rightsId)) { - return; - } - - UserTaoLiJinReport report = new UserTaoLiJinReport(); - report.setId(rightsId); - report.setUnfreezeAmount(new BigDecimal(0)); - report.setUnfreezeNum(0); - report.setRefundAmount(new BigDecimal(0)); - report.setRefundNum(0); - report.setAlipayAmount(new BigDecimal(0)); - report.setUseAmount(new BigDecimal(0)); - report.setUseNum(0); - report.setWinAmount(new BigDecimal(0)); - report.setWinNum(0); - report.setPreCommissionAmount(new BigDecimal(0)); - report.setCreateTime(new Date()); - report.setUpdateTime(new Date()); - userTaoLiJinReportMapper.insertSelective(report); - } - - - - - @Override - public void updateByPrimaryKeySelective(UserTaoLiJinReport record) { - if (record == null || record.getId() == null) { - return; - } - record.setUpdateTime(new Date()); - - userTaoLiJinReportMapper.updateByPrimaryKeySelective(record); - } - - @Override - public void needUpdateReport() { - List<UserTaoLiJinReport> list = userTaoLiJinReportMapper.needUpdateReport(); - if (list == null || list.size() == 0) { - return; - } - - for (UserTaoLiJinReport report: list) { - UserTaoLiJinReport taoLiJinReport = null; - try { - taoLiJinReport = TaoKeApiUtil.getTaoLiJinEffective(report.getId()); - } catch (Exception e) { - LogHelper.errorDetailInfo(e); - continue; - } - - if (taoLiJinReport == null) { - continue; - } - - // 鏄惁闇�瑕佹洿鏂� - boolean needUpdate = false; - - if(taoLiJinReport.getWinNum() != report.getWinNum()){ - needUpdate = true; - } - if(taoLiJinReport.getWinAmount() != report.getWinAmount()){ - needUpdate = true; - } - if(taoLiJinReport.getUnfreezeNum() != report.getUnfreezeNum()){ - needUpdate = true; - } - if(taoLiJinReport.getUnfreezeAmount() != report.getUnfreezeAmount()){ - needUpdate = true; - } - if(taoLiJinReport.getPreCommissionAmount() != report.getPreCommissionAmount()){ - needUpdate = true; - } - if(taoLiJinReport.getUseNum() != report.getUseNum()){ - needUpdate = true; - } - if(taoLiJinReport.getUseAmount() != report.getUseAmount()){ - needUpdate = true; - } - - if(taoLiJinReport.getAlipayAmount() != report.getAlipayAmount()){ - needUpdate = true; - } - - if(taoLiJinReport.getRefundNum() != report.getRefundNum()){ - needUpdate = true; - } - - // 澶辨晥閫�鍥為噾棰濆彂鐢熷彉鍖� - BigDecimal refundAmount = taoLiJinReport.getRefundAmount(); - if(refundAmount.compareTo(report.getRefundAmount()) > 0) { - needUpdate = true; - try { - userTaoLiJinOriginService.refundMoney(taoLiJinReport); - } catch (UserTaoLiJinOriginException e) { - e.printStackTrace(); - } - } - - // 鏇存柊鎶ュ憡 - if(needUpdate) { - taoLiJinReport.setUpdateTime(new Date()); - userTaoLiJinReportMapper.updateByPrimaryKeySelective(taoLiJinReport); - } - } - } - - - @Override - public void refundNotWin() { - List<UserTaoLiJinReport> list = userTaoLiJinReportMapper.refundNotWin(); - if (list == null || list.size() == 0) { - return; - } - - for (UserTaoLiJinReport report: list) { - // 鎬讳釜鏁� - Integer totalNum = report.getTotalNum(); - BigDecimal preFace = report.getPreFace(); - - // 鎬婚噾棰� - BigDecimal money = MoneyBigDecimalUtil.mul(new BigDecimal(totalNum), preFace); - - report.setRefundNum(totalNum); - report.setRefundAmount(money); - report.setUpdateTime(new Date()); - - try { - // 閫�鍥炴窐绀奸噾 - userTaoLiJinOriginService.refundMoney(report); - - } catch (UserTaoLiJinOriginException e) { - LogHelper.errorDetailInfo(e); - continue; - } - - // 鏇存柊鎶ュ憡 - userTaoLiJinReportMapper.updateByPrimaryKeySelective(report); - } - } - - @Override - public UserTaoLiJinReport selectByPrimaryKey(String id) { - return userTaoLiJinReportMapper.selectByPrimaryKey(id); - } - -} +package com.yeshi.fanli.service.impl.tlj; + +import java.math.BigDecimal; +import java.util.Date; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import com.yeshi.fanli.dao.mybatis.tlj.UserTaoLiJinReportMapper; +import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinReport; +import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService; +import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinReportService; +import com.yeshi.fanli.util.StringUtil; + +@Service +public class UserTaoLiJinReportServiceImpl implements UserTaoLiJinReportService{ + + @Resource + private UserTaoLiJinReportMapper userTaoLiJinReportMapper; + + @Resource + private UserTaoLiJinOriginService userTaoLiJinOriginService; + + @Override + public void insertDefault(String rightsId) { + if (StringUtil.isNullOrEmpty(rightsId)) { + return; + } + + UserTaoLiJinReport report = new UserTaoLiJinReport(); + report.setId(rightsId); + report.setUnfreezeAmount(new BigDecimal(0)); + report.setUnfreezeNum(0); + report.setRefundAmount(new BigDecimal(0)); + report.setRefundNum(0); + report.setAlipayAmount(new BigDecimal(0)); + report.setUseAmount(new BigDecimal(0)); + report.setUseNum(0); + report.setWinAmount(new BigDecimal(0)); + report.setWinNum(0); + report.setPreCommissionAmount(new BigDecimal(0)); + report.setCreateTime(new Date()); + report.setUpdateTime(new Date()); + userTaoLiJinReportMapper.insertSelective(report); + } + + + @Override + public void updateByPrimaryKeySelective(UserTaoLiJinReport record) { + if (record == null || record.getId() == null) { + return; + } + record.setUpdateTime(new Date()); + + userTaoLiJinReportMapper.updateByPrimaryKeySelective(record); + } + + + @Override + public UserTaoLiJinReport selectByPrimaryKey(String id) { + return userTaoLiJinReportMapper.selectByPrimaryKeyStr(id); + } + +} -- Gitblit v1.8.0