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/user/integral/IntegralExchangeRecordServiceImpl.java | 296 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 148 insertions(+), 148 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/IntegralExchangeRecordServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/IntegralExchangeRecordServiceImpl.java index c096e15..f36013f 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/IntegralExchangeRecordServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/IntegralExchangeRecordServiceImpl.java @@ -1,148 +1,148 @@ -package com.yeshi.fanli.service.impl.user.integral; - -import java.util.Date; -import java.util.List; - -import javax.annotation.Resource; - -import org.springframework.stereotype.Service; - -import com.yeshi.fanli.dao.mybatis.integral.IntegralExchangeRecordMapper; -import com.yeshi.fanli.entity.bus.user.UserInfoExtra; -import com.yeshi.fanli.entity.integral.IntegralExchange; -import com.yeshi.fanli.entity.integral.IntegralExchange.ExchangeTypeEnum; -import com.yeshi.fanli.entity.integral.IntegralExchangeRecord; -import com.yeshi.fanli.log.LogHelper; -import com.yeshi.fanli.service.inter.user.UserInfoExtraService; -import com.yeshi.fanli.service.inter.user.integral.CodePublishRecordService; -import com.yeshi.fanli.service.inter.user.integral.IntegralExchangeRecordService; -import com.yeshi.fanli.service.inter.user.integral.IntegralExchangeService; -import com.yeshi.fanli.util.StringUtil; - -@Service -public class IntegralExchangeRecordServiceImpl implements IntegralExchangeRecordService { - - @Resource - private IntegralExchangeRecordMapper integralExchangeRecordMapper; - - @Resource - private IntegralExchangeService integralExchangeService; - - @Resource - private UserInfoExtraService userInfoExtraService; - - @Resource - private CodePublishRecordService codePublishRecordService; - - - - @Override - public List<IntegralExchange> listExchange(long start, int count, Long uid){ - List<IntegralExchange> listValid = integralExchangeService.listValidCache(start, count); - if (listValid == null || listValid.size() == 0) { - return listValid; - } - - boolean hasCode = false; - try { - UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid); - if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) { - hasCode = true; - } - } catch (Exception e) { - LogHelper.errorDetailInfo(e); - } - - for(int i = 0; i < listValid.size(); i++) { - IntegralExchange exchange = listValid.get(i); - - ExchangeTypeEnum type = exchange.getType(); - if (type == null) { - listValid.remove(i); - i --; - continue; - } - - Long id = exchange.getId(); - if (type == ExchangeTypeEnum.freeCouponBuy) { - // 娉細鍥犺嚜璐厤鍗曞埜锛屼竴涓敤鎴峰彧鑳藉厬鎹竴娆★紝鍒欏綋鍓嶇敤鎴蜂竴鏃﹀厬鎹㈡垚鍔燂紝鑷喘鍏嶅崟鍒稿厬鎹㈠叆鍙f案涔呭湪褰撳墠鐢ㄦ埛閲戝竵鍏戞崲鍒楄〃涓秷澶便�� - long num = integralExchangeRecordMapper.countRecordByUid(id, uid, null); - if (num >= 1) { - listValid.remove(i); - i --; - continue; - } - } - - // 閭�璇风爜婵�娲诲崱锛屽厬鎹㈤」锛屽鏋滃綋鍓嶇敤鎴峰凡缁忔縺娲讳簡閭�璇峰姛鑳斤紝鍒欎笉闇�瑕佹樉绀鸿鍏戞崲椤广�� - if (type == ExchangeTypeEnum.inviteCodeActivate) { - if (hasCode) { - listValid.remove(i); - i --; - continue; - } - - // 鍏戞崲涓�娆′箣鍚庨殣钘� - long num = integralExchangeRecordMapper.countRecordByUid(id, uid, null); - if (num >= 1) { - listValid.remove(i); - i --; - continue; - } - } - - // 閭�璇风爜鍙戝竷鍗★紝鍏戞崲椤癸紝濡傛灉褰撳墠鐢ㄦ埛鏈縺娲婚個璇峰姛鑳斤紝鍒欎笉闇�瑕佹樉绀鸿鍏戞崲椤广�� - if (type == ExchangeTypeEnum.inviteCodePublish) { - if (!hasCode) { - listValid.remove(i); - i --; - continue; - } - - if(codePublishRecordService.countValidRecord(uid) > 0) { - exchange.setBtnName("鍘绘煡鐪�"); - exchange.setNeedJump(true); - } - } - - String progress = exchange.getProgress(); - if (StringUtil.isNullOrEmpty(progress)) - continue; - - // 鑷喘鍏嶅崟鍒�-鍙兘鍏戞崲涓�娆� - if (type == ExchangeTypeEnum.freeCouponBuy) { - long num = integralExchangeRecordMapper.countRecordByUid(id, uid, null); - if (num >= 1) { - listValid.remove(i); - i --; - continue; - } - } - - // 浠婃棩鍏戞崲鎯呭喌 - long num = integralExchangeRecordMapper.countRecordByUid(id, uid, 1); - Integer upperLimit = exchange.getUpperLimit(); - if (upperLimit == null) { - progress = progress.replace("{宸插厬鎹", num + "").replace("/{涓婇檺鏁皚", ""); - } else { - progress = progress.replace("{宸插厬鎹", num + "").replace("{涓婇檺鏁皚", exchange.getUpperLimit() + ""); - } - exchange.setProgress(progress); - } - return listValid; - } - - @Override - public long countRecordByUid(long exchangeid, Long uid, Integer today){ - return integralExchangeRecordMapper.countRecordByUid(exchangeid, uid, today); - } - - @Override - public void addExchangeRecord(long exchangeid, Long uid){ - IntegralExchangeRecord record = new IntegralExchangeRecord(); - record.setExchangeId(exchangeid); - record.setUid(uid); - record.setCreateTime(new Date()); - integralExchangeRecordMapper.insertSelective(record); - } -} +package com.yeshi.fanli.service.impl.user.integral; + +import java.util.Date; +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import com.yeshi.fanli.dao.mybatis.integral.IntegralExchangeRecordMapper; +import com.yeshi.fanli.entity.bus.user.UserInfoExtra; +import com.yeshi.fanli.entity.integral.IntegralExchange; +import com.yeshi.fanli.entity.integral.IntegralExchange.ExchangeTypeEnum; +import com.yeshi.fanli.entity.integral.IntegralExchangeRecord; +import com.yeshi.fanli.log.LogHelper; +import com.yeshi.fanli.service.inter.user.UserInfoExtraService; +import com.yeshi.fanli.service.inter.user.integral.CodePublishRecordService; +import com.yeshi.fanli.service.inter.user.integral.IntegralExchangeRecordService; +import com.yeshi.fanli.service.inter.user.integral.IntegralExchangeService; +import com.yeshi.fanli.util.StringUtil; + +@Service +public class IntegralExchangeRecordServiceImpl implements IntegralExchangeRecordService { + + @Resource + private IntegralExchangeRecordMapper integralExchangeRecordMapper; + + @Resource + private IntegralExchangeService integralExchangeService; + + @Resource + private UserInfoExtraService userInfoExtraService; + + @Resource + private CodePublishRecordService codePublishRecordService; + + + + @Override + public List<IntegralExchange> listExchange(long start, int count, Long uid){ + List<IntegralExchange> listValid = integralExchangeService.listValidCache(start, count); + if (listValid == null || listValid.size() == 0) { + return listValid; + } + + boolean hasCode = false; + try { + UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid); + if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) { + hasCode = true; + } + } catch (Exception e) { + LogHelper.errorDetailInfo(e); + } + + for(int i = 0; i < listValid.size(); i++) { + IntegralExchange exchange = listValid.get(i); + + ExchangeTypeEnum type = exchange.getType(); + if (type == null) { + listValid.remove(i); + i --; + continue; + } + + Long id = exchange.getId(); + if (type == ExchangeTypeEnum.freeCouponBuy) { + // 娉細鍥犺嚜璐厤鍗曞埜锛屼竴涓敤鎴峰彧鑳藉厬鎹竴娆★紝鍒欏綋鍓嶇敤鎴蜂竴鏃﹀厬鎹㈡垚鍔燂紝鑷喘鍏嶅崟鍒稿厬鎹㈠叆鍙f案涔呭湪褰撳墠鐢ㄦ埛閲戝竵鍏戞崲鍒楄〃涓秷澶便�� + long num = integralExchangeRecordMapper.countRecordByUid(id, uid, null); + if (num >= 1) { + listValid.remove(i); + i --; + continue; + } + } + + // 閭�璇风爜婵�娲诲崱锛屽厬鎹㈤」锛屽鏋滃綋鍓嶇敤鎴峰凡缁忔縺娲讳簡閭�璇峰姛鑳斤紝鍒欎笉闇�瑕佹樉绀鸿鍏戞崲椤广�� + if (type == ExchangeTypeEnum.inviteCodeActivate) { + if (hasCode) { + listValid.remove(i); + i --; + continue; + } + + // 鍏戞崲涓�娆′箣鍚庨殣钘� + long num = integralExchangeRecordMapper.countRecordByUid(id, uid, null); + if (num >= 1) { + listValid.remove(i); + i --; + continue; + } + } + + // 閭�璇风爜鍙戝竷鍗★紝鍏戞崲椤癸紝濡傛灉褰撳墠鐢ㄦ埛鏈縺娲婚個璇峰姛鑳斤紝鍒欎笉闇�瑕佹樉绀鸿鍏戞崲椤广�� + if (type == ExchangeTypeEnum.inviteCodePublish) { + if (!hasCode) { + listValid.remove(i); + i --; + continue; + } + + if(codePublishRecordService.countValidRecord(uid) > 0) { + exchange.setBtnName("鍘绘煡鐪�"); + exchange.setNeedJump(true); + } + } + + String progress = exchange.getProgress(); + if (StringUtil.isNullOrEmpty(progress)) + continue; + + // 鑷喘鍏嶅崟鍒�-鍙兘鍏戞崲涓�娆� + if (type == ExchangeTypeEnum.freeCouponBuy) { + long num = integralExchangeRecordMapper.countRecordByUid(id, uid, null); + if (num >= 1) { + listValid.remove(i); + i --; + continue; + } + } + + // 浠婃棩鍏戞崲鎯呭喌 + long num = integralExchangeRecordMapper.countRecordByUid(id, uid, 1); + Integer upperLimit = exchange.getUpperLimit(); + if (upperLimit == null) { + progress = progress.replace("{宸插厬鎹", num + "").replace("/{涓婇檺鏁皚", ""); + } else { + progress = progress.replace("{宸插厬鎹", num + "").replace("{涓婇檺鏁皚", exchange.getUpperLimit() + ""); + } + exchange.setProgress(progress); + } + return listValid; + } + + @Override + public long countRecordByUid(long exchangeid, Long uid, Integer today){ + return integralExchangeRecordMapper.countRecordByUid(exchangeid, uid, today); + } + + @Override + public void addExchangeRecord(long exchangeid, Long uid){ + IntegralExchangeRecord record = new IntegralExchangeRecord(); + record.setExchangeId(exchangeid); + record.setUid(uid); + record.setCreateTime(new Date()); + integralExchangeRecordMapper.insertSelective(record); + } +} -- Gitblit v1.8.0