| | |
| | | @Autowired |
| | | private TbShareholderService shareholderService; |
| | | |
| | | @Autowired |
| | | private TbAccountDetailService accountDetailService; |
| | | |
| | | |
| | | @Override |
| | | public Page<MyPushCompanyListVo> getMyOrderList(MyOrderListQuery query, Long userId) { |
| | |
| | | List<MyPushCompanyListVo> list = this.baseMapper.getMyOrderListNum(userId); |
| | | map.put("toBeConfirmed", list.stream().filter(e -> e.getStatus() == 2).count()); |
| | | map.put("pendingPayment", list.stream().filter(e -> e.getStatus() == 3).count()); |
| | | map.put("processing", list.stream().filter(e -> e.getStatus() == 4).count()); |
| | | map.put("processing", list.stream().filter(e -> e.getStatus() == 4).count()+list.stream().filter(e -> e.getStatus() == 5).count()); |
| | | map.put("completed", list.stream().filter(e -> e.getStatus() == 6).count()); |
| | | return map; |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void placeOrder(String companyId, TbCompany company,Long userId) { |
| | | public String placeOrder(String companyId, TbCompany company,Long userId) { |
| | | // 创建订单 |
| | | TbOrder tbOrder = new TbOrder(); |
| | | tbOrder.setCompanyId(companyId); |
| | |
| | | |
| | | company.setStatus(4); |
| | | company.updateById(); |
| | | return tbOrder.getId(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | order.setOutTradeNo(notifyResult.getOutTradeNo()); |
| | | order.setTransactionId(notifyResult.getTransactionId()); |
| | | TbCompany company = companyService.getById(order.getCompanyId()); |
| | | // 生成记录 看是否分佣 金额 |
| | | // 生成记录 看是否分佣 金额 发布人 |
| | | TbUser user = userService.getById(company.getUserId()); |
| | | TbSystemConfig config = configService.getOne(new LambdaQueryWrapper<TbSystemConfig>().eq(TbSystemConfig::getType, 3)); |
| | | if(config!=null){ |
| | |
| | | BigDecimal price = order.getPrice(); |
| | | BigDecimal divide = platformCommission.divide(new BigDecimal("100")); |
| | | BigDecimal platformCommissionMoney = divide.multiply(price).setScale(2, RoundingMode.HALF_UP); |
| | | |
| | | // 购买人是否绑定了用户 且次数足够 |
| | | if(StringUtils.isNotEmpty(user.getInviteId()) && user.getInviteNum()>0){ |
| | | BigDecimal divide1 = userCommission.divide(new BigDecimal("100")); |
| | | BigDecimal userCommissionMoney = divide1.multiply(price).setScale(2, RoundingMode.HALF_UP); |
| | | order.setCommissionPrice(userCommissionMoney); |
| | | if(userCommissionMoney.doubleValue()>0){ |
| | | TbUser shareUser = userService.getById(user.getInviteId()); |
| | | BigDecimal add = shareUser.getBalance().add(order.getCommissionPrice()); |
| | | shareUser.setBalance(add); |
| | | shareUser.updateById(); |
| | | |
| | | TbAccountDetail accountDetail = new TbAccountDetail(); |
| | | accountDetail.setUserId(user.getInviteId()); |
| | | accountDetail.setType(1); |
| | | accountDetail.setCategory(4); |
| | | accountDetail.setStatus(2); |
| | | accountDetail.setMoney(order.getCommissionPrice()); |
| | | accountDetail.setOrderPrice(order.getPrice()); |
| | | accountDetail.setSourceId(order.getUserId()); |
| | | accountDetail.insert(); |
| | | |
| | | user.setInviteNum(user.getInviteNum()-1); |
| | | user.updateById(); |
| | | } |
| | | } |
| | | order.setShareUserId(user.getInviteId()); |
| | | order.setCommissionPlatform(platformCommissionMoney); |
| | |
| | | tbAccountDetail1.insert(); |
| | | |
| | | |
| | | messageService.addMessage("下单成功,请及时发送快递", order.getUserId(),order.getId()); |
| | | messageService.addMessage("您发布的订单买家已支付,请尽快处理!", company.getUserId(),order.getId()); |
| | | messageService.addMessage("下单成功,请及时发送快递", order.getUserId(),order.getId(),2); |
| | | messageService.addMessage("您发布的订单买家已支付,请尽快处理!", company.getUserId(),order.getId(),1); |
| | | |
| | | // 生成办理进度 |
| | | TbSchedule tbSchedule = new TbSchedule(); |
| | | tbSchedule.setOrderId(order.getId()); |
| | | tbSchedule.setText("请及时快递发送所需资料"); |
| | | tbSchedule.setCreateTime(new Date()); |
| | | tbSchedule.setUserId(company.getUserId()); |
| | | tbSchedule.insert(); |
| | | return "<xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>"; |
| | | } |
| | | return null; |
| | |
| | | |
| | | @Override |
| | | public void commission(TbOrder order,String userId) { |
| | | String shareUserId = order.getShareUserId(); |
| | | if(StringUtils.isNotEmpty(shareUserId)){ |
| | | TbUser shareUser = userService.getById(shareUserId); |
| | | BigDecimal add = shareUser.getBalance().add(order.getCommissionPrice()); |
| | | shareUser.setBalance(add); |
| | | shareUser.updateById(); |
| | | |
| | | TbAccountDetail accountDetail = new TbAccountDetail(); |
| | | accountDetail.setUserId(shareUserId); |
| | | accountDetail.setType(1); |
| | | accountDetail.setCategory(4); |
| | | accountDetail.setStatus(2); |
| | | accountDetail.setMoney(order.getCommissionPrice()); |
| | | accountDetail.setOrderPrice(order.getPrice()); |
| | | accountDetail.setSourceId(order.getUserId()); |
| | | accountDetail.insert(); |
| | | |
| | | |
| | | } |
| | | BigDecimal decimal = order.getPrice().subtract(order.getCommissionPrice()).subtract(order.getCommissionPlatform()); |
| | | TbUser user = userService.getById(userId); |
| | | BigDecimal add = user.getBalance().add(decimal); |
| | | user.setBalance(add); |
| | | user.updateById(); |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | int addDay=0; |
| | | // 判断是否需要支付改名费 迁区费 |
| | | if(dto.getNeedRename()==1){ |
| | | if(company.getRenameMoney()!=null){ |
| | | addMoney = company.getRenameMoney(); |
| | | } |
| | | addDay=company.getRenameDay(); |
| | | } |
| | | if(dto.getNewDistrict()==1){ |
| | | if(company.getRelocationAreaMoney()!=null){ |
| | | addMoney = addMoney.add(company.getRelocationAreaMoney()); |
| | | } |
| | | addDay = addDay+company.getRelocationAreaDay(); |
| | | } |
| | | // 更新订单金额 |