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/order/tb/TaoBaoPunishOrderServiceImpl.java | 322 ++++++++++++++++++++++++++-------------------------- 1 files changed, 161 insertions(+), 161 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/tb/TaoBaoPunishOrderServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/tb/TaoBaoPunishOrderServiceImpl.java index 4c095ee..4e6de95 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/tb/TaoBaoPunishOrderServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/tb/TaoBaoPunishOrderServiceImpl.java @@ -1,161 +1,161 @@ -package com.yeshi.fanli.service.impl.order.tb; - -import java.util.Date; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import javax.annotation.Resource; - -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoPunishOrderMapper; -import com.yeshi.fanli.entity.bus.user.HongBaoV2; -import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo; -import com.yeshi.fanli.entity.order.CommonOrder; -import com.yeshi.fanli.entity.order.HongBaoOrder; -import com.yeshi.fanli.entity.taobao.TaoBaoPunishOrder; -import com.yeshi.fanli.service.inter.order.CommonOrderService; -import com.yeshi.fanli.service.inter.order.HongBaoOrderService; -import com.yeshi.fanli.service.inter.order.HongBaoV2Service; -import com.yeshi.fanli.service.inter.order.tb.TaoBaoPunishOrderService; -import com.yeshi.fanli.service.inter.user.UserAccountService; -import com.yeshi.fanli.service.inter.user.UserInfoService; -import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService; -import com.yeshi.fanli.util.Constant; - -@Service -public class TaoBaoPunishOrderServiceImpl implements TaoBaoPunishOrderService { - - @Resource - private TaoBaoPunishOrderMapper taoBaoPunishOrderMapper; - - @Resource - private HongBaoV2Service hongBaoV2Service; - - @Resource - private HongBaoOrderService hongBaoOrderService; - - @Resource - private CommonOrderService commonOrderService; - - @Resource - private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService; - - @Resource - private UserInfoService userInfoService; - - @Resource - private UserAccountService userAccountService; - - @Transactional - @Override - public void doPunishOrder(TaoBaoPunishOrder order, Set<Long> uidSets) { - if (order == null) - return; - // 棣栧厛淇濆瓨 - if (taoBaoPunishOrderMapper.selectByTradeId(order.getTbTradeId()) == null) - savePunishOrder(order); - // 鐒跺悗 - CommonOrder co = commonOrderService.selectBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO, - order.getTbTradeId()); - if (co != null) { - uidSets.add(co.getUserInfo().getId()); - HongBaoOrder hongBaoOder = hongBaoOrderService.selectDetailByCommonOrderId(co.getId()); - if (hongBaoOder.getHongBaoV2() != null - && (hongBaoOder.getHongBaoV2().getState() == HongBaoV2.STATE_BUKELINGQU - || hongBaoOder.getHongBaoV2().getState() == HongBaoV2.STATE_KELINGQU)) { - HongBaoV2 updateHongBao = new HongBaoV2(hongBaoOder.getHongBaoV2().getId()); - updateHongBao.setUpdateTime(new Date()); - updateHongBao.setState(HongBaoV2.STATE_SHIXIAO); - updateHongBao.setBeizhu("鑱旂洘杩濊"); - hongBaoV2Service.updateByPrimaryKeySelective(updateHongBao); - // 鏌ヨ鏄惁鏈夊瓙绾㈠寘 - List<HongBaoV2> childList = hongBaoV2Service.listChildrenById(hongBaoOder.getHongBaoV2().getId()); - for (HongBaoV2 child : childList) { - if ((child.getState() == HongBaoV2.STATE_BUKELINGQU - || child.getState() == HongBaoV2.STATE_KELINGQU)) { - HongBaoV2 update = new HongBaoV2(child.getId()); - update.setUpdateTime(new Date()); - update.setState(HongBaoV2.STATE_SHIXIAO); - update.setBeizhu("鑱旂洘杩濊"); - hongBaoV2Service.updateByPrimaryKeySelective(update); - } - } - } else if (hongBaoOder.getHongBaoV2() != null - && hongBaoOder.getHongBaoV2().getState() == HongBaoV2.STATE_YILINGQU) { - List<HongBaoV2> childList = hongBaoV2Service.listChildrenById(hongBaoOder.getHongBaoV2().getId()); - for (HongBaoV2 child : childList) { - if ((child.getState() == HongBaoV2.STATE_BUKELINGQU - || child.getState() == HongBaoV2.STATE_KELINGQU)) { - //鏈埌璐︾殑瀛愮孩鍖呬篃闇�瑕佸け鏁� - HongBaoV2 update = new HongBaoV2(child.getId()); - update.setUpdateTime(new Date()); - update.setState(HongBaoV2.STATE_SHIXIAO); - update.setBeizhu("鑱旂洘杩濊"); - hongBaoV2Service.updateByPrimaryKeySelective(update); - } - } - } - } - } - - @Transactional - @Override - public void savePunishOrder(TaoBaoPunishOrder order) { - if (order == null) - return; - TaoBaoPunishOrder old = taoBaoPunishOrderMapper.selectByTradeId(order.getTbTradeId()); - if (old == null) { - if (order.getCreateTime() == null) - order.setCreateTime(new Date()); - } - taoBaoPunishOrderMapper.insertSelective(order); - } - - @Override - public void doPunishOrder(List<TaoBaoPunishOrder> orderList) { - Set<String> relationIdSets = new HashSet<>(); - Set<String> specialIdSets = new HashSet<>(); - Set<Long> uidSets = new HashSet<>(); - - // for (TaoBaoPunishOrder order : orderList) { - // if (!StringUtil.isNullOrEmpty(order.getRelationId())) - // relationIdSets.add(order.getRelationId()); - // - // if (!StringUtil.isNullOrEmpty(order.getSpecialId())) - // specialIdSets.add(order.getSpecialId()); - // - // doPunishOrder(order, uidSets); - // } - - for (Iterator<String> its = relationIdSets.iterator(); its.hasNext();) { - String relationId = its.next(); - UserExtraTaoBaoInfo info = userExtraTaoBaoInfoService.getByRelationId(relationId); - if (info != null && info.getUser() != null) - uidSets.add(info.getUser().getId()); - } - - for (Iterator<String> its = specialIdSets.iterator(); its.hasNext();) { - String specialId = its.next(); - UserExtraTaoBaoInfo info = userExtraTaoBaoInfoService.getBySpecialId(specialId); - if (info != null && info.getUser() != null) - uidSets.add(info.getUser().getId()); - } - // 灏佺鐢ㄦ埛 - - for (Iterator<Long> its = uidSets.iterator(); its.hasNext();) { - Long uid = its.next(); - userAccountService.forbiddenUserAll(uid, "浜х敓杩濊璁㈠崟鑷姩灏佺"); - } - - } - - @Override - public int countByTradeParentId(String orderId) { - return (int) (taoBaoPunishOrderMapper.countByParentTradeId(orderId)); - } - -} +package com.yeshi.fanli.service.impl.order.tb; + +import java.util.Date; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoPunishOrderMapper; +import com.yeshi.fanli.entity.bus.user.HongBaoV2; +import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo; +import com.yeshi.fanli.entity.order.CommonOrder; +import com.yeshi.fanli.entity.order.HongBaoOrder; +import com.yeshi.fanli.entity.taobao.TaoBaoPunishOrder; +import com.yeshi.fanli.service.inter.order.CommonOrderService; +import com.yeshi.fanli.service.inter.order.HongBaoOrderService; +import com.yeshi.fanli.service.inter.order.HongBaoV2Service; +import com.yeshi.fanli.service.inter.order.tb.TaoBaoPunishOrderService; +import com.yeshi.fanli.service.inter.user.UserAccountService; +import com.yeshi.fanli.service.inter.user.UserInfoService; +import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService; +import com.yeshi.fanli.util.Constant; + +@Service +public class TaoBaoPunishOrderServiceImpl implements TaoBaoPunishOrderService { + + @Resource + private TaoBaoPunishOrderMapper taoBaoPunishOrderMapper; + + @Resource + private HongBaoV2Service hongBaoV2Service; + + @Resource + private HongBaoOrderService hongBaoOrderService; + + @Resource + private CommonOrderService commonOrderService; + + @Resource + private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService; + + @Resource + private UserInfoService userInfoService; + + @Resource + private UserAccountService userAccountService; + + @Transactional + @Override + public void doPunishOrder(TaoBaoPunishOrder order, Set<Long> uidSets) { + if (order == null) + return; + // 棣栧厛淇濆瓨 + if (taoBaoPunishOrderMapper.selectByTradeId(order.getTbTradeId()) == null) + savePunishOrder(order); + // 鐒跺悗 + CommonOrder co = commonOrderService.selectBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO, + order.getTbTradeId()); + if (co != null) { + uidSets.add(co.getUserInfo().getId()); + HongBaoOrder hongBaoOder = hongBaoOrderService.selectDetailByCommonOrderId(co.getId()); + if (hongBaoOder.getHongBaoV2() != null + && (hongBaoOder.getHongBaoV2().getState() == HongBaoV2.STATE_BUKELINGQU + || hongBaoOder.getHongBaoV2().getState() == HongBaoV2.STATE_KELINGQU)) { + HongBaoV2 updateHongBao = new HongBaoV2(hongBaoOder.getHongBaoV2().getId()); + updateHongBao.setUpdateTime(new Date()); + updateHongBao.setState(HongBaoV2.STATE_SHIXIAO); + updateHongBao.setBeizhu("鑱旂洘杩濊"); + hongBaoV2Service.updateByPrimaryKeySelective(updateHongBao); + // 鏌ヨ鏄惁鏈夊瓙绾㈠寘 + List<HongBaoV2> childList = hongBaoV2Service.listChildrenById(hongBaoOder.getHongBaoV2().getId()); + for (HongBaoV2 child : childList) { + if ((child.getState() == HongBaoV2.STATE_BUKELINGQU + || child.getState() == HongBaoV2.STATE_KELINGQU)) { + HongBaoV2 update = new HongBaoV2(child.getId()); + update.setUpdateTime(new Date()); + update.setState(HongBaoV2.STATE_SHIXIAO); + update.setBeizhu("鑱旂洘杩濊"); + hongBaoV2Service.updateByPrimaryKeySelective(update); + } + } + } else if (hongBaoOder.getHongBaoV2() != null + && hongBaoOder.getHongBaoV2().getState() == HongBaoV2.STATE_YILINGQU) { + List<HongBaoV2> childList = hongBaoV2Service.listChildrenById(hongBaoOder.getHongBaoV2().getId()); + for (HongBaoV2 child : childList) { + if ((child.getState() == HongBaoV2.STATE_BUKELINGQU + || child.getState() == HongBaoV2.STATE_KELINGQU)) { + //鏈埌璐︾殑瀛愮孩鍖呬篃闇�瑕佸け鏁� + HongBaoV2 update = new HongBaoV2(child.getId()); + update.setUpdateTime(new Date()); + update.setState(HongBaoV2.STATE_SHIXIAO); + update.setBeizhu("鑱旂洘杩濊"); + hongBaoV2Service.updateByPrimaryKeySelective(update); + } + } + } + } + } + + @Transactional + @Override + public void savePunishOrder(TaoBaoPunishOrder order) { + if (order == null) + return; + TaoBaoPunishOrder old = taoBaoPunishOrderMapper.selectByTradeId(order.getTbTradeId()); + if (old == null) { + if (order.getCreateTime() == null) + order.setCreateTime(new Date()); + } + taoBaoPunishOrderMapper.insertSelective(order); + } + + @Override + public void doPunishOrder(List<TaoBaoPunishOrder> orderList) { + Set<String> relationIdSets = new HashSet<>(); + Set<String> specialIdSets = new HashSet<>(); + Set<Long> uidSets = new HashSet<>(); + + // for (TaoBaoPunishOrder order : orderList) { + // if (!StringUtil.isNullOrEmpty(order.getRelationId())) + // relationIdSets.add(order.getRelationId()); + // + // if (!StringUtil.isNullOrEmpty(order.getSpecialId())) + // specialIdSets.add(order.getSpecialId()); + // + // doPunishOrder(order, uidSets); + // } + + for (Iterator<String> its = relationIdSets.iterator(); its.hasNext();) { + String relationId = its.next(); + UserExtraTaoBaoInfo info = userExtraTaoBaoInfoService.getByRelationId(relationId,null); + if (info != null && info.getUser() != null) + uidSets.add(info.getUser().getId()); + } + + for (Iterator<String> its = specialIdSets.iterator(); its.hasNext();) { + String specialId = its.next(); + UserExtraTaoBaoInfo info = userExtraTaoBaoInfoService.getBySpecialId(specialId,null); + if (info != null && info.getUser() != null) + uidSets.add(info.getUser().getId()); + } + // 灏佺鐢ㄦ埛 + + for (Iterator<Long> its = uidSets.iterator(); its.hasNext();) { + Long uid = its.next(); + userAccountService.forbiddenUserAll(uid, "浜х敓杩濊璁㈠崟鑷姩灏佺"); + } + + } + + @Override + public int countByTradeParentId(String orderId) { + return (int) (taoBaoPunishOrderMapper.countByParentTradeId(orderId)); + } + +} -- Gitblit v1.8.0