| | |
| | | for (TOrder order : orders) { |
| | | TGoods tGoods = goodsService.selectOne(new EntityWrapper<TGoods>().eq("order_id", order.getId())); |
| | | goods.add(tGoods); |
| | | bigDecimal=bigDecimal.add(order.getAllTotal()); |
| | | List<TPrice> prices = priceService.selectList(new EntityWrapper<TPrice>().eq("order_id", order.getId())); |
| | | tPrices.addAll(prices); |
| | | bigDecimal=bigDecimal.add(prices.stream().map(TPrice::getPrice).reduce(BigDecimal.ZERO,BigDecimal::add)); |
| | | } |
| | | Map<String, BigDecimal> sumMap = tPrices.stream() |
| | | .collect(Collectors.groupingBy(TPrice::getType, Collectors.reducing(BigDecimal.ZERO, TPrice::getPrice, BigDecimal::add))); |
| | |
| | | @Autowired |
| | | private TUserBankService userBankService; |
| | | |
| | | @Autowired |
| | | private ITPriceService priceService; |
| | | |
| | | |
| | | @ApiOperation(value = "用户端-invocie",notes="用户端-invocie") |
| | | @ApiImplicitParams({ |
| | |
| | | BigDecimal all = new BigDecimal(0); |
| | | ArrayList<TGoods> goods = new ArrayList<>(); |
| | | for (TOrder order : orders) { |
| | | BigDecimal allTotal = order.getAllTotal(); |
| | | BigDecimal allTotal = priceService.selectList(new EntityWrapper<TPrice>().eq("order_id", order.getId())).stream().map(TPrice::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal paid = order.getPaid(); |
| | | BigDecimal subtract = allTotal.subtract(paid); |
| | | all = all.add(subtract); |
| | |
| | | // 总金额 |
| | | BigDecimal bigDecimal = new BigDecimal(0); |
| | | for (TOrder order : orders) { |
| | | bigDecimal = bigDecimal.add(order.getAllTotal()); |
| | | List<TPrice> prices = priceService.selectList(new EntityWrapper<TPrice>().eq("order_id", order.getId())); |
| | | bigDecimal = bigDecimal.add(prices.stream().map(TPrice::getPrice).reduce(BigDecimal.ZERO,BigDecimal::add)); |
| | | } |
| | | if (type == 1) { |
| | | // 可用额度 |
| | |
| | | // String method = PaymentProcessor.getMethod(tUser.getUserNumber()); |
| | | // JSONObject jsonObject = JSON.parseObject(method); |
| | | // Object id1 = jsonObject.get("id"); |
| | | long l = bigDecimal.multiply(new BigDecimal(100)).longValue(); |
| | | Boolean pay = PaymentProcessor.pay(tUser.getUserNumber(), cardToken, l); |
| | | Boolean pay = StripePayUtils.charge(tUser.getUserNumber(), bigDecimal, "","Continental Cargo Association, Inc."); |
| | | if (pay) { |
| | | orders.forEach(e -> { |
| | | e.setStatus("2"); |
| | |
| | | TQuote quote = tQuoteService.selectOne(new EntityWrapper<TQuote>().eq("order_id", s)); |
| | | quote.setState(4); |
| | | tQuotes.add(quote); |
| | | BigDecimal allTotal = order.getAllTotal(); |
| | | // BigDecimal allTotal = order.getAllTotal(); |
| | | List<TPrice> prices = priceService.selectList(new EntityWrapper<TPrice>().eq("order_id", order.getId())); |
| | | BigDecimal allTotal = prices.stream().map(TPrice::getPrice).reduce(BigDecimal.ZERO,BigDecimal::add); |
| | | BigDecimal paid = order.getPaid(); |
| | | BigDecimal subtract = allTotal.subtract(paid); |
| | | all = all.add(subtract); |
| | |
| | | JSONObject jsonObject = JSON.parseObject(method); |
| | | Object id1 = jsonObject.get("id"); |
| | | long l = all.multiply(new BigDecimal(100)).longValue(); |
| | | Boolean pay = PaymentProcessor.pay(tUser.getUserNumber(), id1.toString(), l); |
| | | Boolean pay = StripePayUtils.charge(tUser.getUserNumber(), all, "","Continental Cargo Association, Inc."); |
| | | if (pay) { |
| | | orders.forEach(e -> { |
| | | e.setStatus("2"); |
| | |
| | | orderService.updateBatchById(orders); |
| | | List<TQuote> collect = tQuotes.stream().collect(Collectors.toList()); |
| | | tQuoteService.updateBatchById(collect); |
| | | }else { |
| | | return new ErrorTip(5010, "payment failure"); |
| | | } |
| | | |
| | | } |
| | | return new SuccessTip(); |
| | | } catch (Exception e) { |
| | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.modular.system.model.IndexInfo; |
| | | import com.stylefeng.guns.modular.system.model.IndexMonth; |
| | | import com.stylefeng.guns.modular.system.model.TOrder; |
| | | import com.stylefeng.guns.modular.system.model.TUser; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.model.dto.UserAddInfoDto; |
| | | import com.stylefeng.guns.modular.system.service.ITOrderService; |
| | | import com.stylefeng.guns.modular.system.service.ITPriceService; |
| | | import com.stylefeng.guns.modular.system.service.ITUserAddressService; |
| | | import com.stylefeng.guns.modular.system.service.ITUserService; |
| | | import com.stylefeng.guns.modular.system.utils.tips.SuccessTip; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private ITUserAddressService userAddressService; |
| | | |
| | | @Autowired |
| | | private ITPriceService priceService; |
| | | /** |
| | | * 完善信息 |
| | | */ |
| | |
| | | public Object list(String time,int type,int userId) { |
| | | TUser tUser = userService.selectById(userId); |
| | | IndexInfo indexInfo = new IndexInfo(); |
| | | int numberOfOrder = orderService.selectCount(new EntityWrapper<TOrder>().eq("user_id", userId)); |
| | | int numberOfOrder = orderService.selectCount(new EntityWrapper<TOrder>().eq("user_id", userId).ne("status",17)); |
| | | int dispatching = orderService.selectCount(new EntityWrapper<TOrder>().eq("user_id", userId).eq("status",0)); |
| | | int pendingPickup = orderService.selectCount(new EntityWrapper<TOrder>().eq("user_id", userId).eq("status",2)); |
| | | int inTransit = orderService.selectCount(new EntityWrapper<TOrder>().eq("user_id", userId).eq("status",7)); |
| | | int toBeUnloaded = orderService.selectCount(new EntityWrapper<TOrder>().eq("user_id", userId).eq("status",8)); |
| | | int unloaded = orderService.selectCount(new EntityWrapper<TOrder>().eq("user_id", userId).eq("status",9)); |
| | | int unpaidBills = orderService.selectCount(new EntityWrapper<TOrder>().eq("user_id", userId).isNull("pay_time")); |
| | | List<TOrder> orders = orderService.selectList(new EntityWrapper<TOrder>().eq("user_id", userId).isNull("pay_time").ne("status",17)); |
| | | BigDecimal bigDecimal = new BigDecimal(0); |
| | | for (TOrder order : orders) { |
| | | List<TPrice> prices = priceService.selectList(new EntityWrapper<TPrice>().eq("order_id", order.getId())); |
| | | BigDecimal reduce = prices.stream().map(TPrice::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | bigDecimal = bigDecimal.add(reduce); |
| | | } |
| | | indexInfo.setNumberOfOrder(numberOfOrder); |
| | | indexInfo.setDispatching(dispatching); |
| | | indexInfo.setPendingPickup(pendingPickup); |
| | | indexInfo.setInTransit(inTransit); |
| | | indexInfo.setToBeUnloaded(toBeUnloaded); |
| | | indexInfo.setUnloaded(unloaded); |
| | | indexInfo.setUnpaidBills(unpaidBills); |
| | | indexInfo.setUnpaidBills(bigDecimal); |
| | | indexInfo.setAllQuota(tUser.getReditLimit()); |
| | | indexInfo.setResidueQuota(tUser.getResidueLimit()); |
| | | indexInfo.setPaymentDay(Integer.valueOf(tUser.getPaymentDays())); |
| | |
| | | TUser tUser = itUserService.selectById(userId); |
| | | List<TPrice> prices = priceService.selectList(new EntityWrapper<TPrice>().eq("order_id", tOrder.getId())); |
| | | ArrayList<PriceInfo> priceInfos = new ArrayList<>(); |
| | | if(tUser.getGroupId()!=null){ |
| | | if(false){ |
| | | TGroup tGroup = groupService.selectById(tUser.getGroupId()); |
| | | User user = service.selectById(tGroup.getSalesId()); |
| | | |
| | |
| | | record.setType(type); |
| | | } |
| | | TOrder tOrder = orderService.selectById(orderId); |
| | | if("9".equals(tOrder.getStatus()) || "18".equals(tOrder.getStatus())){ |
| | | if(true){ |
| | | ArrayList<TOrderFile> tOrderFiles = new ArrayList<>(); |
| | | TOrderFile tOrderFile = new TOrderFile(); |
| | | tOrderFile.setName("Bill of lading.pdf"); |
| | |
| | | try { |
| | | OrderLading orderLading = new OrderLading(); |
| | | TOrder tOrder = orderService.selectById(orderId); |
| | | |
| | | orderLading.setOrderId(tOrder.getId()); |
| | | // 找出用户 |
| | | TUser tUser = itUserService.selectById(tOrder.getUserId()); |
| | | orderLading.setCustomerName(tUser.getCompanyName()); |
| | |
| | | orderLading.setPo(tGoods.getPo()); |
| | | orderLading.setCustRef(tGoods.getCustRef()); |
| | | orderLading.setEntry(tGoods.getEntry()); |
| | | orderLading.setLbNo(tGoods.getBillNumber()); |
| | | String time =""; |
| | | if(ToolUtil.isNotEmpty(tGoods.getShipmentId()) && !"0".equals(tGoods.getShipmentId())){ |
| | | time= FortyNineUtil.getContainerNoOne(tGoods.getShipmentId(), tGoods.getContainerNumber()); |
| | | }else { |
| | | String shippingLine = tGoods.getShippingLine(); |
| | | SCACEnum scacEnum = SCACEnum.fromCode(shippingLine); |
| | | String s; |
| | | if(ToolUtil.isEmpty(tGoods.getTrackingId()) || "0".equals(tGoods.getTrackingId())){ |
| | | s = FortyNineUtil.trackingRequest(tGoods.getBillNumber(), scacEnum.getDesc()); |
| | | if(ToolUtil.isEmpty(s)){ |
| | | s = FortyNineUtil.trackingList(tGoods.getBillNumber()); |
| | | } |
| | | tGoods.setTrackingId(s); |
| | | goodsService.updateById(tGoods); |
| | | }else { |
| | | s = tGoods.getTrackingId(); |
| | | } |
| | | String shipmentId = FortyNineUtil.getShipmentId(s); |
| | | if(ToolUtil.isNotEmpty(shipmentId)){ |
| | | tGoods.setShipmentId(shipmentId); |
| | | goodsService.updateById(tGoods); |
| | | }else { |
| | | tGoods.setShipmentId("0"); |
| | | tGoods.setTrackingId("0"); |
| | | goodsService.updateById(tGoods); |
| | | } |
| | | time = FortyNineUtil.getContainerNoOne(shipmentId, tGoods.getContainerNumber()); |
| | | } |
| | | |
| | | orderLading.setEta(time); |
| | | String billNumber = tGoods.getBillNumber(); |
| | | List<TGoods> goods = goodsService.selectList(new EntityWrapper<TGoods>().eq("bill_number", billNumber)); |
| | | ArrayList<Map<String, String>> maps = new ArrayList<>(); |
| | | for (TGoods good : goods) { |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | map.put("containerNo",good.getContainerNumber()); |
| | | map.put("size",good.getSize()); |
| | | map.put("weight",good.getKg()); |
| | | maps.add(map); |
| | | } |
| | | orderLading.setGoodsInfo(maps); |
| | | // 获取收货信息 |
| | | orderLading.setEndCompanyName(tOrder.geteCompanyName()); |
| | | orderLading.setEndCompanyAddress(tOrder.geteAddress()); |
| | |
| | | if(ToolUtil.isEmpty(tUser.getUserNumber())){ |
| | | // 需要创建初始用户 |
| | | try { |
| | | createUser = stripePayUtils.createStripeCustomNoCard("createUser"); |
| | | createUser = stripePayUtils.createStripeCustomNoCard(tUser.getAccount()); |
| | | tUser.setUserNumber(createUser); |
| | | userService.updateById(tUser); |
| | | } catch (StripeException e) { |
| | |
| | | ProductCreateParams productParams = |
| | | ProductCreateParams.builder() |
| | | .setName("Starter Subscription") |
| | | .setDescription("$12/Month subscription") |
| | | .setDescription("10/Month subscription") |
| | | .build(); |
| | | Product product = Product.create(productParams); |
| | | System.out.println("Success! Here is your starter subscription product id: " + product.getId()); |
| | |
| | | update t_order set pay_status =1 where id =#{number} |
| | | </update> |
| | | |
| | | <select id="getReceivable" resultType="com.stylefeng.guns.modular.system.model.ReceivableVo"> |
| | | select id,invoice_number invoiceNumber,pay_time invoiceTime ,allTotal total, case 1 when paid=allTotal THEN 1 else 2 end as state ,change from t_order |
| | | <select id="getReceivable" resultType="com.stylefeng.guns.modular.system.model.ReceivableVo"> |
| | | select id,invoice_number invoiceNumber,pay_time invoiceTime ,allTotal total, case 1 when paid=allTotal THEN 1 else 2 end as state ,`change` from t_order |
| | | where user_id =#{userId} and status !=17 |
| | | <if test="sTime !=null"> |
| | | and pay_time between #{sTime} and #{eTime} |
| | |
| | | FROM |
| | | t_order t1 |
| | | LEFT JOIN t_goods t2 ON t1.id = t2.order_id |
| | | LEFT JOIN t_user t3 on t1.company_id =t3.id |
| | | LEFT JOIN t_user t3 on t1.user_id =t3.id |
| | | LEFT JOIN t_port t4 on t1.`port` = t4.id |
| | | LEFT JOIN t_group t5 on t3.group_id = t5.id |
| | | where t1.user_id = #{companyId} and t1.status !=0 |
| | | where t1.user_id = #{companyId} and t1.status !=17 and t1.status !=0 |
| | | <if test="sTime !=null"> |
| | | and (t1.shipment_date between #{sTime} and #{eTime} or t1.delivery_date between #{sTime} and #{eTime}) |
| | | </if> |
| | |
| | | </if> |
| | | GROUP BY |
| | | t1.id |
| | | order by t1.create_time desc |
| | | |
| | | |
| | | </select> |
| | |
| | | </if> |
| | | </select> |
| | | <select id="getNoPayOrder" resultType="com.stylefeng.guns.modular.system.model.TOrder"> |
| | | select * from t_order where user_id =#{userId} and allTotal > paid and status !=17 |
| | | select * from t_order where user_id =#{userId} and allTotal > paid and status !=17 and pay_time is null |
| | | </select> |
| | | |
| | | <select id="getLonLat" resultType="java.util.Map"> |
| | |
| | | t1.e_phone eContactPhone, |
| | | t1.paid paid, |
| | | (t1.allTotal-t1.paid) unPaid, |
| | | t1.pay_info_state status |
| | | t1.pay_info_state status, |
| | | t1.type type |
| | | FROM |
| | | t_order t1 |
| | | LEFT JOIN t_company t2 ON t1.company_id = t2.id |
| | |
| | | private Integer inTransit; |
| | | private Integer toBeUnloaded; |
| | | private Integer unloaded; |
| | | private Integer unpaidBills; |
| | | private BigDecimal unpaidBills; |
| | | |
| | | private String residueQuota; |
| | | private String AllQuota; |
| | |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Data |
| | | public class OrderLading { |
| | |
| | | |
| | | private String endContactPhone; |
| | | |
| | | private String lbNo; |
| | | |
| | | private String eta; |
| | | |
| | | private Long orderId; |
| | | |
| | | |
| | | private List<Map<String,String>> goodsInfo; |
| | | |
| | | |
| | | } |
| | |
| | | sTime=time.split(" - ")[0]+" 00:00:00"; |
| | | eTime=time.split(" - ")[1]+" 23:59:59"; |
| | | } |
| | | return this.baseMapper.getReceivable(receivableVoPage,sTime,eTime,id,state,userId); |
| | | List<ReceivableVo> receivable = this.baseMapper.getReceivable(receivableVoPage, sTime, eTime, id, state, userId); |
| | | for (ReceivableVo receivableVo : receivable) { |
| | | List<TPrice> prices = priceMapper.selectList(new EntityWrapper<TPrice>().eq("order_id", receivableVo.getId())); |
| | | BigDecimal reduce = prices.stream().map(TPrice::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | receivableVo.setTotal(reduce.doubleValue()); |
| | | } |
| | | return receivable; |
| | | } |
| | | |
| | | @Override |
| | |
| | | // 还柜码头 |
| | | TTransportation tTransportation = tTransportationService.selectOne(new EntityWrapper<TTransportation>().eq("order_id", id).eq("type", 4)); |
| | | Integer portId = tTransportation.getPortId(); |
| | | TPort tPort = portService.selectById(portId); |
| | | info.setEPortName(tPort.getAddress()); |
| | | if(portId!=null){ |
| | | TPort tPort = portService.selectById(portId); |
| | | info.setEPortName(tPort.getAddress()); |
| | | } |
| | | } |
| | | if(!"0".equals(tOrder.getWarehouse())){ |
| | | TWarehouse code = warehouseService.selectList(new EntityWrapper<TWarehouse>().eq("code", tOrder.getWarehouse())).get(0); |
| | |
| | | orderInfo.setDriverLat(value); |
| | | ArrayList<Map<String,String>> maps = new ArrayList<>(); |
| | | TTransportation tTransportations = tTransportationService.selectOne(new EntityWrapper<TTransportation>().eq("order_id", orderId).eq("type",1)); |
| | | if(tTransportations!=null) { |
| | | TPort tPort1 = portMapper.selectById(tOrder.getPort()); |
| | | maps.add(getLat(tPort1.getAddress())); |
| | | } |
| | | |
| | | if(tOrder.getExamSite()!=null){ |
| | | Integer examSite = tOrder.getExamSite(); |
| | |
| | | if(tOrder.geteAddress()!=null){ |
| | | maps.add(getLat(tOrder.geteAddress())); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | @Override |
| | | public List<IndexMonth> index(int userId) { |
| | | ArrayList<IndexMonth> list = new ArrayList<>(); |
| | | List<TOrder> orders = this.baseMapper.selectList(new EntityWrapper<TOrder>().eq("user_id", userId).isNotNull("company_id")); |
| | | List<TOrder> orders = this.baseMapper.selectList(new EntityWrapper<TOrder>().eq("user_id", userId).isNotNull("company_id").ne("status",17)); |
| | | for (TOrder order : orders) { |
| | | IndexMonth indexMonth = new IndexMonth(); |
| | | indexMonth.setTime(order.getPayTime()); |
| | | indexMonth.setOrderNumber(order.getId()); |
| | | indexMonth.setAmount(order.getAllTotal()); |
| | | BigDecimal order_id = priceMapper.selectList(new EntityWrapper<TPrice>().eq("order_id", order.getId())).stream().map(TPrice::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | indexMonth.setAmount(order_id); |
| | | list.add(indexMonth); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | public static void main(String[] args) throws ParseException { |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.add(Calendar.DATE,1); |
| | | System.out.println(instance.getTime()); |
| | | } |
| | | |
| | | @Override |
| | | public List<IndexMonth> indexYear(int i,int userId) { |
| | | ArrayList<IndexMonth> list = new ArrayList<>(); |
| | | List<TOrder> orders = this.baseMapper.selectList(new EntityWrapper<TOrder>().eq("user_id", userId).isNotNull("company_id").like("pay_time",String.valueOf(i))); |
| | | List<TOrder> orders = this.baseMapper.selectList(new EntityWrapper<TOrder>().eq("user_id", userId).isNotNull("company_id").like("pay_time",String.valueOf(i)).ne("status",17)); |
| | | for (TOrder order : orders) { |
| | | IndexMonth indexMonth = new IndexMonth(); |
| | | indexMonth.setTime(order.getPayTime()); |
| | | indexMonth.setOrderNumber(order.getId()); |
| | | indexMonth.setAmount(order.getAllTotal()); |
| | | BigDecimal order_id = priceMapper.selectList(new EntityWrapper<TPrice>().eq("order_id", order.getId())).stream().map(TPrice::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | indexMonth.setAmount(order_id); |
| | | list.add(indexMonth); |
| | | } |
| | | return list; |
| | |
| | | @Override |
| | | public List<IndexMonth> indexTime(String sTime, String eTime,int userId) { |
| | | ArrayList<IndexMonth> list = new ArrayList<>(); |
| | | List<TOrder> orders = this.baseMapper.selectList(new EntityWrapper<TOrder>().eq("user_id", userId).isNotNull("company_id").between("pay_time",sTime,eTime)); |
| | | List<TOrder> orders = this.baseMapper.selectList(new EntityWrapper<TOrder>().eq("user_id", userId).isNotNull("company_id").between("pay_time",sTime,eTime).ne("status",17)); |
| | | for (TOrder order : orders) { |
| | | IndexMonth indexMonth = new IndexMonth(); |
| | | indexMonth.setTime(order.getPayTime()); |
| | | indexMonth.setOrderNumber(order.getId()); |
| | | indexMonth.setAmount(order.getAllTotal()); |
| | | BigDecimal order_id = priceMapper.selectList(new EntityWrapper<TPrice>().eq("order_id", order.getId())).stream().map(TPrice::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | indexMonth.setAmount(order_id); |
| | | list.add(indexMonth); |
| | | } |
| | | return list; |
| | |
| | | package com.stylefeng.guns.modular.system.utils; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.stripe.Stripe; |
| | | import com.stripe.exception.*; |
| | | import com.stripe.model.Customer; |
| | |
| | | import com.stripe.param.PaymentIntentUpdateParams; |
| | | import com.stripe.param.PaymentMethodListParams; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.HashMap; |
| | | import java.util.logging.Logger; |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | try { |
| | | |
| | | String cus_odnGgggJJ7iEJh = getMethod("cus_OdnGgggJJ7iEJh"); |
| | | JSONObject jsonObject = JSON.parseObject(cus_odnGgggJJ7iEJh); |
| | | Object id1 = jsonObject.get("id"); |
| | | long l = 1; |
| | | Boolean pay = PaymentProcessor.pay("cus_odnGgggJJ7iEJh", id1.toString(), l); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | public static Boolean pay(String cus,String method,Long money) throws StripeException { |
| | | Stripe.apiKey = "sk_test_51Mu5D0KDN0sswRVwUNL5998QrX1VJkNrLsflVUXkEFH0cY2l9StrCc5O4c9gtzs7tLbVmeaTfyNL6pnrtw1tRClA00ZVfbNb3d"; |
| | | // Stripe.apiKey = "sk_test_51Mu5D0KDN0sswRVwUNL5998QrX1VJkNrLsflVUXkEFH0cY2l9StrCc5O4c9gtzs7tLbVmeaTfyNL6pnrtw1tRClA00ZVfbNb3d"; |
| | | Stripe.apiKey = "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"; |
| | | PaymentIntentCreateParams params = |
| | | PaymentIntentCreateParams.builder() |
| | | .setCurrency("usd") |
| | |
| | | lfd= getTime(lfd); |
| | | terminaleDataWarpper.setLfd(lfd); |
| | | }catch (Exception e){ |
| | | terminaleDataWarpper.setLfd(lfd); |
| | | } |
| | | |
| | | String available = JSONObject.parseObject(attributes.toString()).get("available_for_pickup").toString(); |
| | |
| | | terminaleDataWarpper.setCtf(CTF); |
| | | } |
| | | } |
| | | if("PENDING".equals(terminaleDataWarpper.getLineHold()) && ToolUtil.isNotEmpty(lfd)){ |
| | | if("PENDING".equals(terminaleDataWarpper.getLineHold()) && !"null".equals(lfd)){ |
| | | terminaleDataWarpper.setLineHold("RELEASE"); |
| | | } |
| | | if("PENDING".equals(terminaleDataWarpper.getCustomHold()) && ToolUtil.isNotEmpty(lfd)){ |
| | | if("PENDING".equals(terminaleDataWarpper.getCustomHold()) && !"null".equals(lfd)){ |
| | | terminaleDataWarpper.setCustomHold("RELEASE"); |
| | | } |
| | | if("PENDING".equals(terminaleDataWarpper.getPierpass()) && ToolUtil.isNotEmpty(lfd)){ |
| | | if("PENDING".equals(terminaleDataWarpper.getPierpass()) && !"null".equals(lfd)){ |
| | | terminaleDataWarpper.setPierpass("RELEASE"); |
| | | } |
| | | if("PENDING".equals(terminaleDataWarpper.getCtf()) && ToolUtil.isNotEmpty(lfd)){ |
| | | if("PENDING".equals(terminaleDataWarpper.getCtf()) && !"null".equals(lfd)){ |
| | | terminaleDataWarpper.setCtf("RELEASE"); |
| | | } |
| | | if(ToolUtil.isEmpty(location) && "null".equals(lfd)){ |
| | | terminaleDataWarpper.setClosedArea("ON VESSEL"); |
| | | } |
| | | break; |
| | | } |
| | |
| | | return terminaleDataWarpper; |
| | | } |
| | | |
| | | |
| | | |
| | | public static String getContainerNoOne(String shipmentId, String containerNo) { |
| | | int i=0; |
| | | String s = HttpRequest.sendGet("https://api.terminal49.com/v2/shipments/"+shipmentId, ""); |
| | | TerminaleDataWarpper terminaleDataWarpper = new TerminaleDataWarpper(); |
| | | try { |
| | | JSONObject jsonObject = JSONObject.parseObject(s); |
| | | Object data = jsonObject.get("data"); |
| | | Object attributes = JSONObject.parseObject(data.toString()).get("attributes"); |
| | | Object time = JSONObject.parseObject(attributes.toString()).get("pod_eta_at"); |
| | | return String.valueOf(time).substring(0,10); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | TerminaleDataWarpper tcnu6817755 = getContainerNo("7e4c2878-235f-4414-8804-9dd6568a5d6f", "TCNU6817755"); |
| | | System.out.println(tcnu6817755); |
| | | } |
| | | |
| | | public static String getTime(String time) throws ParseException { |
| | | String t = time.substring(0, time.indexOf("T"))+" 00:00:00"; |
| | | Date parse = new SimpleDateFormat("yyyy-MM-dd").parse(t); |
| | | String format = new SimpleDateFormat("dd/MM/yyyy").format(parse); |
| | | String format = new SimpleDateFormat("MM/dd/yyyy").format(parse); |
| | | return format; |
| | | } |
| | | } |
| | |
| | | @Component |
| | | public class StripePayUtils { |
| | | |
| | | private static final String key = "sk_test_51Mu5D0KDN0sswRVwUNL5998QrX1VJkNrLsflVUXkEFH0cY2l9StrCc5O4c9gtzs7tLbVmeaTfyNL6pnrtw1tRClA00ZVfbNb3d"; |
| | | // private static final String key = "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"; |
| | | // private static final String key = "sk_test_51Mu5D0KDN0sswRVwUNL5998QrX1VJkNrLsflVUXkEFH0cY2l9StrCc5O4c9gtzs7tLbVmeaTfyNL6pnrtw1tRClA00ZVfbNb3d"; |
| | | private static final String key = "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"; |
| | | |
| | | /** |
| | | * 创建初始用户 |
| | |
| | | } |
| | | // cus_NtikoSLGuD5goQ tok_1N8HCEKDN0sswRVwd8fQmIq6 |
| | | public static void main(String[] args) throws StripeException { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("number","4242424242424242"); |
| | | map.put("exp_month","12"); |
| | | map.put("exp_year","34"); |
| | | map.put("cvc","541"); |
| | | |
| | | // String stripeCustomNoCard = createStripeCustomNoCard("286988043@qq.com"); |
| | | // System.out.println(stripeCustomNoCard); |
| | | // HashMap<String, Object> map = new HashMap<>(); |
| | | // map.put("number","4147202602480020"); |
| | | // map.put("exp_month","04"); |
| | | // map.put("exp_year","28"); |
| | | // map.put("cvc","541"); |
| | | // String cardToken = createCardToken(map); |
| | | // System.out.println(cardToken); |
| | | // |
| | | String cus_ntikoSLGuD5goQ = updateStripeCustomWithCard("cus_NtikoSLGuD5goQ", map); |
| | | System.out.println(cus_ntikoSLGuD5goQ); |
| | | // boolean charge = charge("cus_NtikoSLGuD5goQ", new BigDecimal(0.01), "aud", "测试"); |
| | | // String cus_ntikoSLGuD5goQ = updateStripeCustomWithCard("cus_OdnGgggJJ7iEJh", map); |
| | | // System.out.println(cus_ntikoSLGuD5goQ); |
| | | // boolean charge = charge("cus_OdnGgggJJ7iEJh", new BigDecimal(0.01), "aud", "测试"); |
| | | |
| | | try { |
| | | boolean charge = charge("cus_OdnGgggJJ7iEJh", new BigDecimal(1), "c", "cs"); |
| | | System.out.println(charge); |
| | | } catch (StripeException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | //发起支付 |
| | | Map<String, Object> payParams = new HashMap<>(); |
| | | //1元=100 |
| | | payParams.put("amount", money.multiply(new BigDecimal(100)).longValue()); |
| | | payParams.put("currency", moneyType); |
| | | payParams.put("amount", (money.multiply(new BigDecimal(100)).multiply(new BigDecimal(1.035))).longValue()); |
| | | payParams.put("currency", "usd"); |
| | | payParams.put("description", description); |
| | | payParams.put("customer", stripeMemberId); |
| | | payParams.put("capture", true); |