| | |
| | | |
| | | import com.google.gson.*; |
| | | import com.yeshi.common.entity.PageEntity; |
| | | import com.yeshi.fanli.dao.mybatis.HongBaoV2Mapper; |
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderMapper; |
| | | import com.yeshi.fanli.dao.mybatis.order.HongBaoOrderMapper; |
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoOrderMapper; |
| | | import com.yeshi.fanli.dao.taobao.TaoBaoOrderBackUpDao; |
| | | import com.yeshi.fanli.entity.accept.AdminAcceptData; |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2; |
| | | import com.yeshi.fanli.entity.order.CommonOrder; |
| | | import com.yeshi.fanli.entity.order.HongBaoOrder; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrderBackUp; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder; |
| | |
| | | import com.yeshi.fanli.service.inter.order.OrderProcessService; |
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService; |
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoWeiQuanOrderService; |
| | | import com.yeshi.fanli.util.BeanUtil; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.ThreadUtil; |
| | |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.lang.reflect.Type; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | @Controller |
| | |
| | | |
| | | @Resource |
| | | private TaoBaoOrderUpdateJob taoBaoOrderUpdateJob; |
| | | |
| | | |
| | | @Resource |
| | | private CommonOrderMapper commonOrderMapper; |
| | | @Resource |
| | | private HongBaoOrderMapper hongBaoOrderMapper; |
| | | @Resource |
| | | private HongBaoV2Mapper hongBaoV2Mapper; |
| | | |
| | | /** |
| | | * 查询列表 - 新后台 |
| | |
| | | }); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * @return void |
| | | * @author hxh |
| | | * @description 违规订单处理 |
| | | * @date 15:06 2021/10/23 |
| | | * @param: acceptData |
| | | * @param: content |
| | | * @param: out |
| | | **/ |
| | | @RequestMapping(value = "weiGui") |
| | | public void weiGuiOrder(AdminAcceptData acceptData, String content, String callback, PrintWriter out) { |
| | | |
| | | if (StringUtil.isNullOrEmpty(content)) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请上传订单号")); |
| | | return; |
| | | } |
| | | |
| | | List<String> orderIdList = new ArrayList<>(); |
| | | Scanner scanner = new Scanner(content); |
| | | while (scanner.hasNextLine()) { |
| | | String line = scanner.nextLine(); |
| | | if (!StringUtil.isNullOrEmpty(line)) |
| | | orderIdList.add(line.trim()); |
| | | } |
| | | scanner.close(); |
| | | |
| | | if (orderIdList.size() == 0) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请上传订单号")); |
| | | return; |
| | | } |
| | | |
| | | BigDecimal fanliMoney = new BigDecimal(0); |
| | | BigDecimal unFanliMoney = new BigDecimal(0); |
| | | BigDecimal childFanliMoney = new BigDecimal(0); |
| | | int validCount = 0; |
| | | int inValidCount = 0; |
| | | Set<Long> uids = new HashSet<>(); |
| | | try { |
| | | for (int c = 0; c < orderIdList.size(); c++) { |
| | | String orderId = orderIdList.get(c); |
| | | List<CommonOrder> orderList = commonOrderMapper.listBySourceTypeAndOrderNo(Constant.SOURCE_TYPE_TAOBAO, |
| | | orderId); |
| | | if (orderList.size() > 0) { |
| | | validCount++; |
| | | for (CommonOrder commonOrder : orderList) { |
| | | uids.add(commonOrder.getUserInfo().getId()); |
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId()); |
| | | if (hongBaoOrder != null) { |
| | | HongBaoV2 v2 = hongBaoOrder.getHongBaoV2(); |
| | | if (v2.getState() == 3) { |
| | | fanliMoney = fanliMoney.add(v2.getMoney()); |
| | | // 查询上级是否到账 |
| | | List<HongBaoV2> children = hongBaoV2Mapper.listChildrenById(v2.getId()); |
| | | if (children != null && children.size() > 0) { |
| | | for (HongBaoV2 hongBao : children) { |
| | | if (hongBao.getState() == HongBaoV2.STATE_BUKELINGQU |
| | | || hongBao.getState() == HongBaoV2.STATE_KELINGQU) { |
| | | HongBaoV2 updateHongBao = new HongBaoV2(hongBao.getId()); |
| | | updateHongBao.setState(HongBaoV2.STATE_SHIXIAO); |
| | | updateHongBao.setBeizhu("联盟违规"); |
| | | updateHongBao.setUpdateTime(new Date()); |
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(updateHongBao); |
| | | } else {// |
| | | childFanliMoney = childFanliMoney.add(hongBao.getMoney()); |
| | | } |
| | | } |
| | | } |
| | | } else if (v2.getState() == 1 || v2.getState() == 2) { |
| | | unFanliMoney = unFanliMoney.add(v2.getMoney()); |
| | | HongBaoV2 update = new HongBaoV2(v2.getId()); |
| | | update.setState(HongBaoV2.STATE_SHIXIAO); |
| | | update.setBeizhu("联盟违规"); |
| | | update.setUpdateTime(new Date()); |
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(update); |
| | | // 发现子订单 |
| | | List<HongBaoV2> children = hongBaoV2Mapper.listChildrenById(v2.getId()); |
| | | if (children != null && children.size() > 0) { |
| | | for (HongBaoV2 hongBao : children) { |
| | | HongBaoV2 updateHongBao = new HongBaoV2(hongBao.getId()); |
| | | updateHongBao.setState(HongBaoV2.STATE_SHIXIAO); |
| | | updateHongBao.setBeizhu("联盟违规"); |
| | | updateHongBao.setUpdateTime(new Date()); |
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(updateHongBao); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } else |
| | | inValidCount++; |
| | | } |
| | | |
| | | System.out.println( |
| | | validCount + "-" + inValidCount + "-" + fanliMoney + "-" + unFanliMoney + "-" + childFanliMoney); |
| | | Iterator<Long> its = uids.iterator(); |
| | | while (its.hasNext()) { |
| | | System.out.println(its.next()); |
| | | } |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("处理成功")); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("处理出错:" + e.getMessage())); |
| | | } |
| | | } |
| | | |
| | | } |