| | |
| | | </content> |
| | | <orderEntry type="inheritedJdk" /> |
| | | <orderEntry type="sourceFolder" forTests="false" /> |
| | | <orderEntry type="library" name="guns-core-1.0.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: com.stylefeng:guns-core:1.0.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: com.baomidou:mybatisplus-spring-boot-starter:1.0.5" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-configuration-processor:2.0.4.RELEASE" level="project" /> |
| | |
| | | @ResponseBody |
| | | @Transactional(propagation = Propagation.REQUIRES_NEW) |
| | | public Object addDemand(@RequestBody DemandDto demandDto) throws Exception { |
| | | Integer userId1 = demandDto.getUserId(); |
| | | |
| | | TUser tUser1 = userService.selectById(userId1); |
| | | if(tUser1.getPhone()==null){ |
| | | return new ErrorTip(5008,"It is necessary to complete the information before issuing the quotation demand"); |
| | | } |
| | | |
| | | |
| | | int breakNum=0; |
| | | // 计数 |
| | | int count=0; |
| | | Integer id = demandDto.getId(); |
| | | String s1 = System.currentTimeMillis() + ToolUtil.getRandomString(5); |
| | | String s2 = System.currentTimeMillis() + ToolUtil.getRandomString(5); |
| | |
| | | }else { |
| | | List<TCompany> companies = companyService.selectList(new EntityWrapper<TCompany>().in("id", set)); |
| | | for (TCompany company : companies) { |
| | | breakNum=0; |
| | | TCompanyCalculationResp tCompanyCalculationResp = new TCompanyCalculationResp(); |
| | | ArrayList<TOrder> tOrders = new ArrayList<>(); |
| | | // 超重 价格 |
| | |
| | | } |
| | | |
| | | for (GoodsListDto goodsListDto : list1) { |
| | | if(breakNum==1){ |
| | | break; |
| | | } |
| | | ArrayList<TPrice> tPrices = new ArrayList<>(); |
| | | // 生成订单 |
| | | // TOrder tOrder = new TOrder(); |
| | |
| | | List<GoodsDto> list = goodsListDto.getList(); |
| | | ArrayList<TGoods> tGoods1 = new ArrayList<>(); |
| | | for (GoodsDto goodsDto : list) { |
| | | |
| | | // 生成订单 |
| | | TOrder tOrder = new TOrder(); |
| | | tOrder.setCity(city.getId()); |
| | | tOrder.setState(state.getId()); |
| | | tOrder.setUserId(demandDto.getUserId()); |
| | | tOrder.setAccessorial(demandDto.getAccessorial()); |
| | | tOrder.setAccessorialStr(demandDto.getAccessorialStr()); |
| | | tOrder.setPort(demandDto.getPortId()); |
| | | tOrder.setShipmentDate(demandDto.getShipmentDate()); |
| | | tOrder.setDeliveryDate(demandDto.getDeliveryDate()); |
| | | tOrder.seteZipZ(s1); |
| | | tOrder.setCreateTime(new Date()); |
| | | tOrder.setStartLat("1"); |
| | | tOrder.setStartLon("1"); |
| | | tOrder.setDeliveryStr(demandDto.getDelivery()); |
| | | tOrder.setType(demandDto.getType()); |
| | | tOrder.setZipCode(demandDto.getZipCode()); |
| | | tOrder.seteAddress(demandDto.getZipCode()); |
| | | tOrder.setWarehouse(demandDto.getWarehouse()); |
| | | // TODO 未选择17 下一步选择 |
| | | tOrder.setStatus("17"); |
| | | tOrder.setInvoiceNumber(s2); |
| | | tOrder.setCompanyId(company.getId()); |
| | | tOrder.setCreateTime(new Date()); |
| | | orderService.insert(tOrder); |
| | | tOrders.add(tOrder); |
| | | |
| | | TCompanyResp tCompanyResp = new TCompanyResp(); |
| | | if("0".equals(demandDto.getWarehouse())){ |
| | | tCompanyResp=new TCompanyResp(); |
| | | BigDecimal setValue1 = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id",ratesId).eq("set_name", demandDto.getDelivery())).getSetValue(); |
| | | tCompanyResp.setName(demandDto.getDelivery()); |
| | | tCompanyResp.setPrice(setValue1); |
| | | objects.add(tCompanyResp); |
| | | |
| | | // 基础价格 |
| | | String zipCode = demandDto.getZipCode(); |
| | | // 地址信息 |
| | | String address1 = AddressLookup.getAddress(zipCode); |
| | | |
| | | List<TCompanyBasic> tCompanyBasic = companyBasicService.selectList(new EntityWrapper<TCompanyBasic>().eq("port_id",ratesId).eq("zip_code", zipCode).eq("type", 1)); |
| | | if(tCompanyBasic.size()>0){ |
| | | tCompanyResp=new TCompanyResp(); |
| | | tCompanyResp.setPrice(tCompanyBasic.get(0).getFee()); |
| | | tCompanyResp.setName("LH+FSC"); |
| | | objects.add(tCompanyResp); |
| | | }else { |
| | | // 画圈 拿到的zipcode集合 去对比当前zipcode是否在集合中 |
| | | List<TCompanyBasic> type = companyBasicService.selectList(new EntityWrapper<TCompanyBasic>().eq("type", 2).eq("port_id",ratesId).orderBy("fee",true)); |
| | | if(type.size()>0){ |
| | | GeocodeVo geocode1 = googleMapUtil.getGeocode(zipCode); |
| | | for (TCompanyBasic companyBasic : type) { |
| | | boolean inPolygon = PointInPolygon.isInPolygon(geocode1.getLat(), geocode1.getLng(), companyBasic.getLonLat()); |
| | | if(inPolygon){ |
| | | tCompanyResp=new TCompanyResp(); |
| | | tCompanyResp.setPrice(type.get(0).getFee()); |
| | | tCompanyResp.setName("LH+FSC"); |
| | | objects.add(tCompanyResp); |
| | | break; |
| | | } |
| | | } |
| | | if(tCompanyResp==null){ |
| | | // 距离 |
| | | tCompanyResp=new TCompanyResp(); |
| | | // 1条数据 不需要zipcode |
| | | DistancematrixVo distancematrix = googleMapUtil.getDistancematrix(address, address1); |
| | | double distance = distancematrix.getDistance().doubleValue(); |
| | | BigDecimal bigDecimal = new BigDecimal(distance * 0.0006214); |
| | | List<TCompanyBasic> type1 = companyBasicService.selectList(new EntityWrapper<TCompanyBasic>().eq("type", 3).eq("port_id",ratesId).le("start",bigDecimal.doubleValue()).orderBy("start",true)); |
| | | if(type1.size()>0) { |
| | | BigDecimal multiply = type1.get(0).getFee().multiply(bigDecimal); |
| | | tCompanyResp.setPrice(multiply); |
| | | tCompanyResp.setName("LH+FSC"); |
| | | objects.add(tCompanyResp); |
| | | }else { |
| | | breakNum=1; |
| | | count++; |
| | | break; |
| | | } |
| | | } |
| | | }else { |
| | | // 距离 |
| | | tCompanyResp=new TCompanyResp(); |
| | | // 1条数据 不需要zipcode |
| | | DistancematrixVo distancematrix = googleMapUtil.getDistancematrix(address, address1); |
| | | double distance = distancematrix.getDistance().doubleValue(); |
| | | BigDecimal bigDecimal = new BigDecimal(distance * 0.0006214); |
| | | List<TCompanyBasic> type1 = companyBasicService.selectList(new EntityWrapper<TCompanyBasic>().eq("type", 3).eq("port_id",ratesId).le("start",bigDecimal.doubleValue()).orderBy("start",true)); |
| | | if(type1.size()>0) { |
| | | BigDecimal multiply = type1.get(0).getFee().multiply(bigDecimal); |
| | | tCompanyResp.setPrice(multiply); |
| | | tCompanyResp.setName("LH+FSC"); |
| | | objects.add(tCompanyResp); |
| | | }else { |
| | | breakNum=1; |
| | | count++; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | }else { |
| | | tCompanyResp=new TCompanyResp(); |
| | | TWarehouse tWarehouse = warehouseService.selectOne(new EntityWrapper<TWarehouse>().eq("company_id", company.getId()).eq("code", demandDto.getWarehouse()).eq("port_id",ratesId)); |
| | | tCompanyResp.setName(UserFeeSettingEnum.LH_FSH.getDesc()); |
| | | if(Objects.nonNull(tWarehouse)){ |
| | | tCompanyResp.setPrice(tWarehouse.getWarePrice()); |
| | | }else { |
| | | tCompanyResp.setPrice(new BigDecimal("0")); |
| | | } |
| | | objects.add(tCompanyResp); |
| | | } |
| | | |
| | | // 是否超重 |
| | | Integer weight = goodsDto.getWeight(); |
| | | long between = DateUtil.between(demandDto.getShipmentDate(), demandDto.getDeliveryDate(), DateUnit.DAY); |
| | |
| | | } |
| | | |
| | | |
| | | if("0".equals(demandDto.getWarehouse())){ |
| | | tCompanyResp=new TCompanyResp(); |
| | | BigDecimal setValue1 = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id",ratesId).eq("set_name", demandDto.getDelivery())).getSetValue(); |
| | | tCompanyResp.setName(demandDto.getDelivery()); |
| | | tCompanyResp.setPrice(setValue1); |
| | | objects.add(tCompanyResp); |
| | | |
| | | // 基础价格 |
| | | String zipCode = demandDto.getZipCode(); |
| | | // 地址信息 |
| | | String address1 = AddressLookup.getAddress(zipCode); |
| | | List<TCompanyBasic> tCompanyBasic = companyBasicService.selectList(new EntityWrapper<TCompanyBasic>().eq("port_id",ratesId).eq("zip_code", zipCode).eq("type", 1)); |
| | | if(tCompanyBasic.size()>0){ |
| | | tCompanyResp=new TCompanyResp(); |
| | | tCompanyResp.setPrice(tCompanyBasic.get(0).getFee()); |
| | | tCompanyResp.setName("LH+FSC"); |
| | | objects.add(tCompanyResp); |
| | | }else { |
| | | // 画圈 拿到的zipcode集合 去对比当前zipcode是否在集合中 |
| | | List<TCompanyBasic> type = companyBasicService.selectList(new EntityWrapper<TCompanyBasic>().eq("type", 2).eq("port_id",ratesId).orderBy("fee",true)); |
| | | if(type.size()>0){ |
| | | GeocodeVo geocode1 = googleMapUtil.getGeocode(zipCode); |
| | | for (TCompanyBasic companyBasic : type) { |
| | | boolean inPolygon = PointInPolygon.isInPolygon(geocode1.getLat(), geocode1.getLng(), companyBasic.getLonLat()); |
| | | if(inPolygon){ |
| | | tCompanyResp=new TCompanyResp(); |
| | | tCompanyResp.setPrice(type.get(0).getFee()); |
| | | tCompanyResp.setName("LH+FSC"); |
| | | objects.add(tCompanyResp); |
| | | break; |
| | | } |
| | | } |
| | | if(tCompanyResp==null){ |
| | | // 距离 |
| | | tCompanyResp=new TCompanyResp(); |
| | | // 1条数据 不需要zipcode |
| | | DistancematrixVo distancematrix = googleMapUtil.getDistancematrix(address, address1); |
| | | double distance = distancematrix.getDistance().doubleValue(); |
| | | BigDecimal bigDecimal = new BigDecimal(distance * 0.0006214); |
| | | List<TCompanyBasic> type1 = companyBasicService.selectList(new EntityWrapper<TCompanyBasic>().eq("type", 3).eq("port_id",ratesId).le("start",bigDecimal.doubleValue()).orderBy("start",true)); |
| | | if(type1.size()>0) { |
| | | BigDecimal multiply = type1.get(0).getFee().multiply(bigDecimal); |
| | | tCompanyResp.setPrice(multiply); |
| | | tCompanyResp.setName("LH+FSC"); |
| | | objects.add(tCompanyResp); |
| | | }else { |
| | | tCompanyResp.setPrice(new BigDecimal(0)); |
| | | tCompanyResp.setName("LH+FSC"); |
| | | objects.add(tCompanyResp); |
| | | } |
| | | } |
| | | }else { |
| | | // 距离 |
| | | tCompanyResp=new TCompanyResp(); |
| | | // 1条数据 不需要zipcode |
| | | DistancematrixVo distancematrix = googleMapUtil.getDistancematrix(address, address1); |
| | | double distance = distancematrix.getDistance().doubleValue(); |
| | | BigDecimal bigDecimal = new BigDecimal(distance * 0.0006214); |
| | | List<TCompanyBasic> type1 = companyBasicService.selectList(new EntityWrapper<TCompanyBasic>().eq("type", 3).eq("port_id",ratesId).le("start",bigDecimal.doubleValue()).orderBy("start",true)); |
| | | if(type1.size()>0) { |
| | | BigDecimal multiply = type1.get(0).getFee().multiply(bigDecimal); |
| | | tCompanyResp.setPrice(multiply); |
| | | tCompanyResp.setName("LH+FSC"); |
| | | objects.add(tCompanyResp); |
| | | }else { |
| | | tCompanyResp.setPrice(new BigDecimal(0)); |
| | | tCompanyResp.setName("LH+FSC"); |
| | | objects.add(tCompanyResp); |
| | | } |
| | | } |
| | | } |
| | | |
| | | }else { |
| | | tCompanyResp=new TCompanyResp(); |
| | | TWarehouse tWarehouse = warehouseService.selectOne(new EntityWrapper<TWarehouse>().eq("company_id", company.getId()).eq("code", demandDto.getWarehouse()).eq("port_id",ratesId)); |
| | | tCompanyResp.setName(UserFeeSettingEnum.LH_FSH.getDesc()); |
| | | if(Objects.nonNull(tWarehouse)){ |
| | | tCompanyResp.setPrice(tWarehouse.getWarePrice()); |
| | | }else { |
| | | tCompanyResp.setPrice(new BigDecimal("0")); |
| | | } |
| | | objects.add(tCompanyResp); |
| | | } |
| | | BigDecimal bigDecimal = objects.stream().map(e -> e.getPrice()==null?new BigDecimal(0):e.getPrice()).reduce(BigDecimal::add).get(); |
| | | // 生成订单 |
| | | TOrder tOrder = new TOrder(); |
| | | tOrder.setCity(city.getId()); |
| | | tOrder.setState(state.getId()); |
| | | tOrder.setUserId(demandDto.getUserId()); |
| | | tOrder.setAccessorial(demandDto.getAccessorial()); |
| | | tOrder.setAccessorialStr(demandDto.getAccessorialStr()); |
| | | tOrder.setPort(demandDto.getPortId()); |
| | | tOrder.setShipmentDate(demandDto.getShipmentDate()); |
| | | tOrder.setDeliveryDate(demandDto.getDeliveryDate()); |
| | | tOrder.seteZipZ(s1); |
| | | tOrder.setCreateTime(new Date()); |
| | | tOrder.setStartLat("1"); |
| | | tOrder.setStartLon("1"); |
| | | tOrder.setDeliveryStr(demandDto.getDelivery()); |
| | | tOrder.setType(demandDto.getType()); |
| | | tOrder.setZipCode(demandDto.getZipCode()); |
| | | if("0".equals(demandDto.getWarehouse())){ |
| | | tOrder.seteAddress(demandDto.getZipCode()); |
| | | }else { |
| | | TWarehouse tWarehouse = warehouseService.selectOne(new EntityWrapper<TWarehouse>().eq("company_id", company.getId()).eq("code", demandDto.getWarehouse()).eq("port_id",ratesId)); |
| | | tOrder.seteAddress(tWarehouse.getAddress()); |
| | | } |
| | | |
| | | tOrder.setWarehouse(demandDto.getWarehouse()); |
| | | tOrder.setStatus("17"); |
| | | tOrder.setInvoiceNumber(s2); |
| | | tOrder.setCompanyId(company.getId()); |
| | | tOrder.setCreateTime(new Date()); |
| | | orderService.insert(tOrder); |
| | | tOrders.add(tOrder); |
| | | tOrder.setAllTotal(bigDecimal); |
| | | orderService.updateById(tOrder); |
| | | objects.stream().forEach(e->e.setOrderId(tOrder.getId())); |
| | |
| | | }else { |
| | | String zipCode = demandDto.getZipCode(); |
| | | // GeocodeVo geocode1 = googleMapUtil.getGeocode(zipCode); |
| | | // tCompanyCalculationResp.setEndLon(String.valueOf(geocode1.getLng())); |
| | | // tCompanyCalculationResp.setEndLat(String.valueOf(geocode1.getLat())); |
| | | // tCompanyCalculationResp.setEndLon(String.valueOf(geocode1.getLng())); |
| | | tCompanyCalculationResp.setEndLat(String.valueOf(1)); |
| | | tCompanyCalculationResp.setEndLon(String.valueOf(1)); |
| | | tCompanyCalculationRespList.add(tCompanyCalculationResp); |
| | | } |
| | | |
| | | |
| | | } |
| | | if(count==companies.size()){ |
| | | return new ErrorTip(5001,"No truck company was matched to meet the demand"); |
| | | } |
| | | |
| | | } |
| | |
| | | List<TOrder> orders = orderService.selectList(new EntityWrapper<TOrder>().eq("e_zip_z", quote.getOrderId()).eq("status", 0)); |
| | | ArrayList<TGoods> goods = new ArrayList<>(); |
| | | BigDecimal bigDecimal = new BigDecimal(0); |
| | | ArrayList<TPrice> tPrices = new ArrayList<>(); |
| | | 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); |
| | | } |
| | | Map<String, BigDecimal> sumMap = tPrices.stream() |
| | | .collect(Collectors.groupingBy(TPrice::getType, Collectors.reducing(BigDecimal.ZERO, TPrice::getPrice, BigDecimal::add))); |
| | | List<PriceList> pricesList = sumMap.entrySet().stream() |
| | | .map(entry -> new PriceList(entry.getKey(), entry.getValue())) |
| | | .collect(Collectors.toList()); |
| | | Integer userId = orders.get(0).getUserId(); |
| | | TUser tUser = userService.selectById(userId); |
| | | String residueLimit = tUser.getResidueLimit(); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("money",bigDecimal); |
| | | map.put("data",goods); |
| | | map.put("residueLimit",residueLimit); |
| | | map.put("prices",pricesList); |
| | | return new SuccessTip(map); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "发布需求-第二步/修改需求",notes="发布需求-第二步/修改需求") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "time", value = "2000-01-01 - 2000-11-11", required = false, dataType = "String"), |
| | | @ApiImplicitParam(name = "name", value = "name", required = false, dataType = "String"), |
| | | @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "pageNumber", value = "pageNumber", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "int"), |
| | | }) |
| | | @GetMapping(value = "/driverList") |
| | | @ResponseBody |
| | | public Object driverList(String time, String name, int pageNumber, int pageSize) { |
| | | public Object driverList(String time, String name,int id, int pageNumber, int pageSize) { |
| | | String sTime = null; |
| | | String eTime = null; |
| | | EntityWrapper<TDriver> wrapper = new EntityWrapper<>(); |
| | | Page<TDriver> tDriverPage = new Page<>(pageNumber, pageSize); |
| | | wrapper.eq("remove", 0); |
| | | wrapper.eq("is_carriers",1); |
| | | wrapper.eq("company_id",id); |
| | | if (ToolUtil.isNotEmpty(name)) { |
| | | wrapper.like("driver_name", name).or().like("account", name); |
| | | } |
| | |
| | | Cell cell2 = row.getCell(2); |
| | | String two = null;//Driver Number |
| | | if (ToolUtil.isNotEmpty(cell2)) { |
| | | cell2.setCellType(Cell.CELL_TYPE_STRING); |
| | | two = String.valueOf(cell2.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell3 = row.getCell(3); |
| | | String three = null;//Date of Birth |
| | | if (ToolUtil.isNotEmpty(cell3)) { |
| | | cell3.setCellType(Cell.CELL_TYPE_STRING); |
| | | three = String.valueOf(cell3.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell4 = row.getCell(4); |
| | | String four = null;//Address |
| | | if (ToolUtil.isNotEmpty(cell4)) { |
| | | cell4.setCellType(Cell.CELL_TYPE_STRING); |
| | | four = String.valueOf(cell4.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell5 = row.getCell(5); |
| | | String five = null;//Driver Type |
| | | if (ToolUtil.isNotEmpty(cell5)) { |
| | | cell5.setCellType(Cell.CELL_TYPE_STRING); |
| | | five = String.valueOf(cell5.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell6 = row.getCell(6); |
| | | String six = null;//Status |
| | | if (ToolUtil.isNotEmpty(cell6)) { |
| | | cell6.setCellType(Cell.CELL_TYPE_STRING); |
| | | six = String.valueOf(cell6.getStringCellValue()).trim(); |
| | | } |
| | | |
| | | Cell cell7 = row.getCell(7); |
| | | String seven = null;//StatusRemark |
| | | if (ToolUtil.isNotEmpty(cell7)) { |
| | | cell7.setCellType(Cell.CELL_TYPE_STRING); |
| | | seven = String.valueOf(cell7.getStringCellValue()).trim(); |
| | | } |
| | | |
| | |
| | | package com.stylefeng.guns.modular.system.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.amazonaws.services.dynamodbv2.xspec.B; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stripe.exception.StripeException; |
| | | import com.stripe.model.PaymentIntent; |
| | | import com.stylefeng.guns.modular.system.model.ReceivableVo; |
| | | import com.stylefeng.guns.modular.system.model.TGoods; |
| | | import com.stylefeng.guns.modular.system.model.TOrder; |
| | | import com.stylefeng.guns.modular.system.model.TPrice; |
| | | import com.stylefeng.guns.modular.system.service.ITGoodsService; |
| | | import com.stylefeng.guns.modular.system.service.ITOrderService; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.service.impl.TQuoteServiceImpl; |
| | | import com.stylefeng.guns.modular.system.utils.PaymentProcessor; |
| | | import com.stylefeng.guns.modular.system.utils.Server; |
| | | import com.stylefeng.guns.modular.system.utils.StripePayUtils; |
| | | import com.stylefeng.guns.modular.system.utils.tips.ErrorTip; |
| | | import com.stylefeng.guns.modular.system.utils.tips.SuccessTip; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Controller |
| | | @Api(tags = "用户端-财务信息") |
| | |
| | | |
| | | @Autowired |
| | | private ITGoodsService goodsService; |
| | | |
| | | @Autowired |
| | | private ITUserService itUserService; |
| | | |
| | | @Autowired |
| | | private ITQuoteService tQuoteService; |
| | | |
| | | @Autowired |
| | | private TUserBankService userBankService; |
| | | |
| | | |
| | | @ApiOperation(value = "用户端-invocie",notes="用户端-invocie") |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "id", value = "userid", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "orderId", value = "orderId", required = true, dataType = "Long"), |
| | | @ApiImplicitParam(name = "quoteId", value = "需求id", required = false, dataType = "Long"), |
| | | @ApiImplicitParam(name = "cardId", value = "cardId", required = false, dataType = "Integer"), |
| | | @ApiImplicitParam(name = "type", value = "type 1额度支付 2全款支付", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "category", value = " 1需求支付 2所有支付", required = true, dataType = "int"), |
| | | }) |
| | | @GetMapping(value = "/payInfo") |
| | | @ResponseBody |
| | | public Object payInfo(int id,Long orderId) throws StripeException { |
| | | PaymentIntent paymentIntent = PaymentProcessor.charge("cus_NvFsNut8zDF9pc", 1L); |
| | | @Transactional(propagation = Propagation.REQUIRES_NEW) |
| | | public Object payInfo(int id, Long quoteId, Integer cardId, int type, int category) throws StripeException { |
| | | TUser tUser = itUserService.selectById(id); |
| | | |
| | | Server.aaa(); |
| | | return new SuccessTip(); |
| | | |
| | | try { |
| | | if (category == 1) { |
| | | TQuote quote = tQuoteService.selectById(quoteId); |
| | | // 找出状态为0的订单 |
| | | List<TOrder> orders = orderService.selectList(new EntityWrapper<TOrder>().eq("e_zip_z", quote.getOrderId()).eq("status", 0)); |
| | | // 总金额 |
| | | BigDecimal bigDecimal = new BigDecimal(0); |
| | | for (TOrder order : orders) { |
| | | bigDecimal = bigDecimal.add(order.getAllTotal()); |
| | | } |
| | | if (type == 1) { |
| | | // 可用额度 |
| | | BigDecimal bigDecimal1 = null; |
| | | String residueLimit = tUser.getResidueLimit(); |
| | | if (residueLimit == null) { |
| | | bigDecimal1 = new BigDecimal(residueLimit); |
| | | } else { |
| | | bigDecimal1 = new BigDecimal(residueLimit); |
| | | } |
| | | // 剩余额度 |
| | | BigDecimal subtract = bigDecimal1.subtract(bigDecimal); |
| | | tUser.setResidueLimit(subtract.toString()); |
| | | orders.forEach(e -> { |
| | | e.setStatus("2"); |
| | | e.setPayTime(new Date()); |
| | | }); |
| | | orderService.updateBatchById(orders); |
| | | itUserService.updateById(tUser); |
| | | quote.setState(4); |
| | | tQuoteService.updateById(quote); |
| | | } else { |
| | | if (tUser.getUserNumber() == null) { |
| | | return new ErrorTip(5006, "Please bind a card first"); |
| | | } |
| | | // 找出这张卡 |
| | | TUserBank tUserBank = userBankService.selectById(cardId); |
| | | String cardToken = tUserBank.getCardToken(); |
| | | // 修改默认支付卡 |
| | | StripePayUtils.updateStripeDefaultCard(tUser.getUserNumber(), cardToken); |
| | | // 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); |
| | | if (pay) { |
| | | orders.forEach(e -> { |
| | | e.setStatus("2"); |
| | | e.setPaid(e.getAllTotal()); |
| | | e.setPayTime(new Date()); |
| | | }); |
| | | orderService.updateBatchById(orders); |
| | | quote.setState(4); |
| | | tQuoteService.updateById(quote); |
| | | } |
| | | } |
| | | } else { |
| | | if (tUser.getUserNumber() == null) { |
| | | return new ErrorTip(5006, "Please bind a card first"); |
| | | } |
| | | // 找出所有未支付完成的订单 |
| | | List<TOrder> orders = orderService.getNoPayOrder(id); |
| | | HashSet<TQuote> tQuotes = new HashSet<>(); |
| | | BigDecimal all = new BigDecimal(0); |
| | | for (TOrder order : orders) { |
| | | String s = order.geteZipZ(); |
| | | TQuote quote = tQuoteService.selectOne(new EntityWrapper<TQuote>().eq("order_id", s)); |
| | | quote.setState(4); |
| | | tQuotes.add(quote); |
| | | BigDecimal allTotal = order.getAllTotal(); |
| | | BigDecimal paid = order.getPaid(); |
| | | BigDecimal subtract = allTotal.subtract(paid); |
| | | all = all.add(subtract); |
| | | } |
| | | // 找出这张卡 |
| | | TUserBank tUserBank = userBankService.selectById(cardId); |
| | | String cardToken = tUserBank.getCardToken(); |
| | | // 修改默认支付卡 |
| | | StripePayUtils.updateStripeDefaultCard(tUser.getUserNumber(), cardToken); |
| | | String method = PaymentProcessor.getMethod(tUser.getUserNumber()); |
| | | 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); |
| | | if (pay) { |
| | | orders.forEach(e -> { |
| | | e.setStatus("2"); |
| | | e.setPaid(e.getAllTotal()); |
| | | e.setPayTime(new Date()); |
| | | }); |
| | | orderService.updateBatchById(orders); |
| | | List<TQuote> collect = tQuotes.stream().collect(Collectors.toList()); |
| | | tQuoteService.updateBatchById(collect); |
| | | } |
| | | |
| | | } |
| | | return new SuccessTip(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return new ErrorTip(500, "ERROR"); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | tUser.setLogisticsContactPhone(userAddInfoDto.getLogisticsContactPhone()); |
| | | tUser.setEmail(userAddInfoDto.getEmail()); |
| | | tUser.setCompanyName(userAddInfoDto.getCompanyName()); |
| | | tUser.setBusinessLicense(userAddInfoDto.getImg()); |
| | | tUser.setHeadImg(userAddInfoDto.getImg()); |
| | | // TUserAddress tUserAddress = new TUserAddress(); |
| | | // tUserAddress.setAddress(userAddInfoDto.getAddress()); |
| | | // tUserAddress.setUserId(userAddInfoDto.getUserId()); |
| | |
| | | indexInfo.setUnpaidBills(unpaidBills); |
| | | indexInfo.setAllQuota(tUser.getReditLimit()); |
| | | indexInfo.setResidueQuota(tUser.getResidueLimit()); |
| | | indexInfo.setPaymentDay(Integer.valueOf(tUser.getPaymentDays())); |
| | | |
| | | if(type==1){ |
| | | List<IndexMonth> list = orderService.index(userId); |
| | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.modular.system.enums.FacilityCodeEnum; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.utils.TerminalInterfaceAcquisitionUtil; |
| | | import com.stylefeng.guns.modular.system.utils.tips.ErrorTip; |
| | | import com.stylefeng.guns.modular.system.utils.tips.SuccessTip; |
| | | import com.stylefeng.guns.modular.system.warpper.TerminaleDataWarpper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | return new SuccessTip(); |
| | | } |
| | | |
| | | /** |
| | | * company 订单 |
| | | * @param orderId 订单id |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "用户端-检查站可取货",notes="用户端-检查站可取货") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "orderId", value = "orderId", required = true, dataType = "Long"), |
| | | }) |
| | | @PostMapping(value = "/affirmOne") |
| | | @ResponseBody |
| | | public Object affirmOne( Long orderId) { |
| | | TOrder tOrder = orderService.selectById(orderId); |
| | | |
| | | if(tOrder.getStatus().equals("13")){ |
| | | tOrder.setStatus("14"); |
| | | }else { |
| | | return new ErrorTip(5010,"The current status cannot be modified"); |
| | | } |
| | | orderService.updateById(tOrder); |
| | | return new SuccessTip(); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "支付",notes="支付") |
| | | @ApiImplicitParams({ |
| | |
| | | orderService.updateById(tOrder); |
| | | return new SuccessTip(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "用户端-安排检查站",notes="用户端-安排检查站") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "orderId", value = "orderId", required = true, dataType = "Long"), |
| | | @ApiImplicitParam(name = "examId", value = "examId", required = true, dataType = "int"), |
| | | }) |
| | | @GetMapping(value = "/examAdd") |
| | | @ResponseBody |
| | | public Object examAdd(Long orderId,int examId) { |
| | | TOrder tOrder = orderService.selectById(orderId); |
| | | tOrder.setExamSite(examId); |
| | | orderService.updateById(tOrder); |
| | | return new SuccessTip(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "商品详情",notes="商品详情") |
| | |
| | | driverIds.add(driverIdOne); |
| | | } |
| | | List<TTransportation> tTransportations = tTransportationService.selectList(new EntityWrapper<TTransportation>().eq("order_id", orderId).in("driver_id", driverIds)); |
| | | TerminaleDataWarpper terminalStatus = TerminalInterfaceAcquisitionUtil.getTerminalStatus("WFHU5080179", FacilityCodeEnum.USLAX.getMsg()); |
| | | for (TTransportation tDriver : tTransportations) { |
| | | OrderDriverInfo orderDriverInfo = new OrderDriverInfo(); |
| | | orderDriverInfo.setId(tDriver.getId()); |
| | |
| | | orderDriverInfo.setChassiess(powerUnitsService.selectById(tDriver.getChassises())); |
| | | |
| | | // TODO 第三方 目前不知道对接那个 |
| | | orderDriverInfo.setAppointmentNumber(null); |
| | | orderDriverInfo.setAppointmentNumber(terminalStatus.getAppointmentNumber()); |
| | | |
| | | orderDriverInfos.add(orderDriverInfo); |
| | | |
| | |
| | | transportInfo.setTruckCompany(tOrder.getTruckCompany()); |
| | | transportInfo.setPickupTime(tOrder.getPickupTimeTruck()); |
| | | transportInfo.setStreetTurn(tOrder.getStreetTurn()); |
| | | |
| | | |
| | | transportInfo.setLineHold(terminalStatus.getLineHold()); |
| | | transportInfo.setCustomHold(terminalStatus.getCustomHold()); |
| | | transportInfo.setPierpass(terminalStatus.getPierpass()); |
| | | transportInfo.setCTF(terminalStatus.getCtf()); |
| | | transportInfo.setClosedArea(terminalStatus.getClosedArea()); |
| | | transportInfo.setLFD(terminalStatus.getLfd()); |
| | | |
| | | transportInfo.setList(orderDriverInfos); |
| | | Integer examSite = tOrder.getExamSite(); |
| | | if(Objects.nonNull(examSite)){ |
| | |
| | | @ResponseBody |
| | | public Object addCarriers(@RequestBody TCarriers tCarriers) { |
| | | tCarriers.setCreateTime(new Date()); |
| | | carriersService.insert(tCarriers); |
| | | return new SuccessTip(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "卡车公司-承运商详情",notes="卡车公司-承运商详情") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "int",paramType = "query"), |
| | | }) |
| | | @PostMapping(value = "/carriersInfo") |
| | | @ResponseBody |
| | | public Object carriersInfo( int id) { |
| | | TCarriers tCarriers = carriersService.selectById(id); |
| | | return new SuccessTip(tCarriers); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "卡车公司-编辑承运商",notes="卡车公司-编辑承运商") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | |
| | | return new SuccessTip(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "卡车公司-详情车架或者车头",notes="卡车公司-详情车架或者车头") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "int",paramType = "query"), |
| | | }) |
| | | @GetMapping(value = "/infoPowerUnitOrChassiss") |
| | | @ResponseBody |
| | | public Object infoPowerUnitOrChassiss( int id) { |
| | | TPowerUnits tPowerUnits = powerUnitsService.selectById(id); |
| | | |
| | | return new SuccessTip(tPowerUnits); |
| | | } |
| | | |
| | | @ApiOperation(value = "卡车公司-编辑车架或者车头",notes="卡车公司-编辑车架或者车头") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | |
| | | }) |
| | | @PostMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TUserAddress tUserAddress) { |
| | | public Object update(@RequestBody TUserAddress tUserAddress) { |
| | | tUserAddress.setUpdateTime(new Date()); |
| | | tUserAddressService.updateById(tUserAddress); |
| | | return SUCCESS_TIP; |
| | |
| | | @ApiOperation(value = "详情用户地址",notes="详情用户地址") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "tUserAddressId", value = "tUserAddressId", required = true, dataType = "Integer"), |
| | | }) |
| | | @GetMapping(value = "/detail/{tUserAddressId}") |
| | | @GetMapping(value = "/detail") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("tUserAddressId") Integer tUserAddressId) { |
| | | public Object detail( Integer tUserAddressId) { |
| | | return new SuccessTip(tUserAddressService.selectById(tUserAddressId)); |
| | | } |
| | | } |
| | |
| | | return new SuccessTip(); |
| | | } |
| | | |
| | | @ApiOperation(value = "卡车公司-场地详情", notes = "卡车公司-场地详情") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "int", paramType = "query"), |
| | | }) |
| | | @GetMapping(value = "/yardInfo") |
| | | @ResponseBody |
| | | public Object yardInfo(int id) { |
| | | TYard tYard = yardService.selectById(id); |
| | | return new SuccessTip(tYard); |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | |
| | | */ |
| | | public interface TOrderMapper extends BaseMapper<TOrder> { |
| | | |
| | | List<ReceivableVo> getReceivable(@Param("receivableVoPage") Page<ReceivableVo> receivableVoPage, @Param("name") String name, @Param("id") int id); |
| | | |
| | | |
| | | Double getTwentyDay(@Param("userId") Integer userId, @Param("time") String time, @Param("time1") String time1); |
| | |
| | | |
| | | Double getNineDay(@Param("userId") Integer userId, @Param("time3") String time3); |
| | | |
| | | List<ShouldPayVo> getPayList(@Param("receivableVoPage") Page<ShouldPayVo> receivableVoPage, @Param("name") String name); |
| | | List<ShouldPayVo> getPayList(@Param("receivableVoPage") Page<ShouldPayVo> receivableVoPage, @Param("name") String name, @Param("id") int id); |
| | | |
| | | Double getTwentyDayPay(@Param("userId") Integer userId, @Param("time") String time, @Param("time1") String time1); |
| | | |
| | | Double getNineDayPay(@Param("userId") Integer userId, @Param("time3") String time3); |
| | | |
| | | |
| | | List<ReceivablesList> listOfReceivables(@Param("receivableVoPage") Page<ReceivablesList> receivableVoPage, @Param("sTime") String sTime, @Param("eTime") String eTime, @Param("name") String name, @Param("invoicesId") Integer invoicesId, @Param("orderId") Integer orderId, @Param("state") Integer state); |
| | | List<ReceivablesList> listOfReceivables(@Param("receivableVoPage") Page<ReceivablesList> receivableVoPage, @Param("sTime") String sTime, @Param("eTime") String eTime, @Param("name") String name, @Param("invoicesId") Integer invoicesId, @Param("orderId") Integer orderId, @Param("state") Integer state, @Param("id") Integer id); |
| | | |
| | | Integer getPayStatus(@Param("orderId") Long orderId); |
| | | |
| | | List<PayList> listOfPay(@Param("receivableVoPage") Page<PayList> receivableVoPage, @Param("sTime") String sTime, @Param("eTime") String eTime, @Param("name") String name, @Param("billId") Integer billId, @Param("orderId") Integer orderId, @Param("state") Integer state); |
| | | List<PayList> listOfPay(@Param("receivableVoPage") Page<PayList> receivableVoPage, @Param("sTime") String sTime, @Param("eTime") String eTime, @Param("name") String name, @Param("billId") Integer billId, @Param("orderId") Integer orderId, @Param("state") Integer state,@Param("id") Integer id); |
| | | |
| | | Boolean agreePay(@Param("number") Long number); |
| | | |
| | |
| | | t1.describe, |
| | | t1.remark, |
| | | t1.number, |
| | | t1.price,t1.order_id orderId |
| | | t1.price,t1.order_id orderId,t1.status |
| | | FROM |
| | | t_claim t1 LEFT JOIN t_company t2 on t1.trucking_company_id = t2.id where t1.id =#{id} |
| | | </select> |
| | |
| | | left JOIN t_user t2 on t1.user_id =t2.id |
| | | LEFT JOIN t_order t3 on t1.order_id = t3.e_zip_z |
| | | LEFT JOIN t_port t4 on t3.`port` = t4.id |
| | | where T1.state != 3 |
| | | where t1.state != 3 |
| | | <if test="sTime !=null"> |
| | | and t1.create_time between #{sTime} and #{eTime} |
| | | </if> |
| | |
| | | <if test="account !=null and account !=''"> |
| | | and t2.account =#{account} |
| | | </if> |
| | | group by t1.id |
| | | </select> |
| | | <select id="queryDemandListExport" resultType="com.stylefeng.guns.modular.system.model.DemandListVo"> |
| | | select t1.id,t2.id userId,t2.company_name companyName, |
| | |
| | | |
| | | t2.name as country,t3.name as state ,t4.name as city from t_user_address t1 left join t_country t2 on(t2.id=t1.country and t2.type =1) left join t_country t3 on (t3.id=t1.state and t3.type =2) |
| | | left join t_country t4 on (t4.id=t1.city and t4.type =3) where t1.remove=0 and t1.user_id =#{userId} |
| | | |
| | | order by is_default |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | t1.invoice_number invoiceNumber, |
| | | t1.company_id companyId, |
| | | t2.NAME companyName, |
| | | t2.headImg logo, |
| | | t1.pay_time invoiceDate, |
| | | tu.company_name sCompanyName, |
| | | t1.shipment_date pickupDate, |
| | | t4.NAME portName, |
| | | t1.s_name sContactName, |
| | | t1.s_phone sContactPhone, |
| | | t1.accessorial_str chassisService, |
| | | t1.delivery_date deliveryDate, |
| | | t1.e_company_name eCompanyName, |
| | | t1.e_name eContactName, |
| | | t1.e_phone eContactPhone |
| | | t5.address userAddress, |
| | | t1.type type, |
| | | t1.delivery_date dueBy |
| | | FROM |
| | | t_order t1 |
| | | LEFT JOIN t_company t2 ON t1.company_id = t2.id |
| | | LEFT JOIN t_user tu ON t1.user_id = tu.id |
| | | LEFT JOIN t_port t4 ON t1.PORT = t4.id |
| | | left join t_user_address t5 on (t5.user_id=tu.id and t5.is_default =1) |
| | | where t1.id =#{number} |
| | | </select> |
| | | <select id="getOrderInfoOne" resultType="com.stylefeng.guns.modular.system.model.InvoicesVoOne"> |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.enums; |
| | | |
| | | /** |
| | | * <p> |
| | | * 调用容器事件历史接口的 设置编码 |
| | | * </p> |
| | | * |
| | | * @Author: lisy |
| | | * @date: 2023-05-21 23:50 |
| | | * @Description: |
| | | */ |
| | | |
| | | |
| | | public enum FacilityCodeEnum { |
| | | |
| | | ESALG("ESALG"), |
| | | NGAPP("NGAPP"), |
| | | BHKBS("BHKBS"), |
| | | SEGOT("SEGOT"), |
| | | BRITJ("BRITJ"), |
| | | MXLZC("MXLZC"), |
| | | USLAX("USLAX"), |
| | | USMIA("USMIA"), |
| | | NLMSV("NLMSV"), |
| | | LRMLW("LRMLW"), |
| | | USMOB("USMOB"), |
| | | CRPMN("CRPMN"), |
| | | NGONN("NGONN"), |
| | | USNWK("USNWK"), |
| | | MAPTM("MAPTM"), |
| | | ITVDL("ITVDL"), |
| | | ESVLC("ESVLC"), |
| | | MXPGO("MXPGO"), |
| | | ; |
| | | String msg; |
| | | |
| | | FacilityCodeEnum(String msg) { |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | } |
| | |
| | | @ApiModelProperty("卡车公司名称") |
| | | private String companyName; |
| | | |
| | | private String logo; |
| | | |
| | | @ApiModelProperty("invoice Date") |
| | | private Date invoiceDate; |
| | | |
| | |
| | | @ApiModelProperty("客户公司") |
| | | private String sCompanyName; |
| | | |
| | | @ApiModelProperty("客户地址") |
| | | private String userAddress; |
| | | |
| | | |
| | | @ApiModelProperty("发货时间") |
| | | @JsonFormat(pattern = "dd/MM/yyyy") |
| | |
| | | @ApiModelProperty("取货码头") |
| | | private String portName; |
| | | |
| | | @ApiModelProperty("发货联系人姓名") |
| | | private String sContactName; |
| | | @ApiModelProperty("1 live unload 2drop hook") |
| | | private String type; |
| | | |
| | | @ApiModelProperty("发货联系人电话") |
| | | private String sContactPhone; |
| | | |
| | | @ApiModelProperty("附加服务 逗号拼接") |
| | | private String chassisService; |
| | | |
| | | @ApiModelProperty("收货时间") |
| | | @JsonFormat(pattern = "dd/MM/yyyy") |
| | | private Date deliveryDate; |
| | | |
| | | @ApiModelProperty("客户目的地公司") |
| | | private String eCompanyName; |
| | | |
| | | @ApiModelProperty("收货联系人姓名") |
| | | private String eContactName; |
| | | @ApiModelProperty("收货联系人电话") |
| | | private String eContactPhone; |
| | | @ApiModelProperty("送柜地址") |
| | | private String eAddress; |
| | | |
| | | |
| | | @ApiModelProperty("还柜码头") |
| | | private String ePortName; |
| | | |
| | | private List<TGoodsVo> goodsVos; |
| | | |
| | |
| | | |
| | | private Integer state; |
| | | |
| | | private Integer goodsId; |
| | | |
| | | private String status; |
| | | |
| | | } |
| | |
| | | private Integer pageSize; |
| | | @ApiModelProperty("用户id 必传") |
| | | private Integer userId; |
| | | @ApiModelProperty("卡车公司id 必传") |
| | | private Integer companyId; |
| | | } |
| | |
| | | @ApiModelProperty("送柜地点") |
| | | private String destination; |
| | | |
| | | @ApiModelProperty("订单状态 0未开始 1已完成 2待取货-未出发 3待取货-已出发 4已到港口码头 5车场运输中 6在车场 7运输中 8待卸货 9已卸货 10运回车场中 11空柜订单在车场 12送检查站 13检查中 14检查站待取货 15在仓库 16取消订单 17已选择") |
| | | @ApiModelProperty("订单状态 0未开始 1已完成 2待取货-未出发 3待取货-已出发 4已到港口码头 5车场运输中 6在车场 7运输中 8待卸货 9已卸货 10运回车场中 11空柜订单在车场 12送检查站 13检查中 14检查站待取货 15在仓库 16取消订单 17已选择 18运回码头") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("是否可以提货 1是2否") |
| | | private Integer state; |
| | | |
| | | private String kg; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class PriceList { |
| | | private String type; |
| | | private BigDecimal money; |
| | | } |
| | |
| | | ) |
| | | private Long orderId; |
| | | |
| | | private Integer status; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | private Integer remove; |
| | | |
| | | public Integer getWork() { |
| | | return work; |
| | | } |
| | | |
| | | public void setWork(Integer work) { |
| | | this.work = work; |
| | | } |
| | | |
| | | private Integer work; |
| | | |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @TableName("t_company_basic") |
| | | public class TCompanyBasic { |
| | | private Integer id; |
| | | @TableField("type") |
| | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class TCompanyDto { |
| | | public class TCompanyDto { |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | |
| | | */ |
| | | private Integer status; |
| | | |
| | | private Integer work; |
| | | private List<TCompanyService> list; |
| | | } |
| | |
| | | @TableField("create_time") |
| | | private Date createTime; |
| | | |
| | | private String contactNumber; |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | * 0正常 1删除 |
| | | */ |
| | | private Integer remove; |
| | | @TableField("contact_phone") |
| | | private String contactPhone; |
| | | |
| | | public String getContactPhone() { |
| | | return contactPhone; |
| | | } |
| | | |
| | | public void setContactPhone(String contactPhone) { |
| | | this.contactPhone = contactPhone; |
| | | } |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty("country名称") |
| | |
| | | @TableField("pay_carriers_time") |
| | | private Date payCarriersTime; |
| | | |
| | | public String getNote() { |
| | | return note; |
| | | } |
| | | |
| | | public void setNote(String note) { |
| | | this.note = note; |
| | | } |
| | | |
| | | private String note; |
| | | |
| | | public Date getOrderOkTime() { |
| | | return orderOkTime; |
| | | } |
| | |
| | | this.paid = paid; |
| | | } |
| | | |
| | | @TableField("pickup_time_truck") |
| | | private Date pickupTimeTruck; |
| | | |
| | | public Integer getPayStatus() { |
| | | return payStatus; |
| | |
| | | @TableField("truck_company") |
| | | private String truckCompany; |
| | | |
| | | @TableField("admin_invoice") |
| | | private Integer adminInvoice; |
| | | @TableField("admin_bill") |
| | | private Integer adminBill; |
| | | |
| | | public Integer getAdminInvoice() { |
| | | return adminInvoice; |
| | | } |
| | | |
| | | public void setAdminInvoice(Integer adminInvoice) { |
| | | this.adminInvoice = adminInvoice; |
| | | } |
| | | |
| | | public Integer getAdminBill() { |
| | | return adminBill; |
| | | } |
| | | |
| | | public void setAdminBill(Integer adminBill) { |
| | | this.adminBill = adminBill; |
| | | } |
| | | |
| | | public Integer getCompanyInvoice() { |
| | | return companyInvoice; |
| | | } |
| | | |
| | | public void setCompanyInvoice(Integer companyInvoice) { |
| | | this.companyInvoice = companyInvoice; |
| | | } |
| | | |
| | | public Integer getCompanyBill() { |
| | | return companyBill; |
| | | } |
| | | |
| | | public void setCompanyBill(Integer companyBill) { |
| | | this.companyBill = companyBill; |
| | | } |
| | | |
| | | @TableField("company_invoice") |
| | | private Integer companyInvoice; |
| | | @TableField("company_bill") |
| | | private Integer companyBill; |
| | | |
| | | public String getTruckCompany() { |
| | | return truckCompany; |
| | | } |
| | |
| | | this.pickupTimeTruck = pickupTimeTruck; |
| | | } |
| | | |
| | | @TableField("pickup_time_truck") |
| | | private Date pickupTimeTruck; |
| | | |
| | | public Integer getStreetTurn() { |
| | | return streetTurn; |
| | |
| | | |
| | | private static final long serialVersionUID=1L; |
| | | |
| | | @TableId(value = "id", type = IdType.UUID) |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @TableField("company_id") |
| | |
| | | */ |
| | | @ApiModelProperty("1是车头 2是车架") |
| | | private Integer type; |
| | | @TableField("chassises_type") |
| | | private String chassisesType; |
| | | @TableField("chassises_number") |
| | | private String chassisesNumber; |
| | | @TableField("size") |
| | | private String size; |
| | | |
| | | |
| | | @Override |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | |
| | | |
| | | private Date dotExpiration; |
| | | |
| | | private Date insuranceExpiration; |
| | | private Date inspectionExpriation; |
| | | |
| | | private Date createTime; |
| | | |
| | | private String chassisesType; |
| | | private String chassisesNumber; |
| | | |
| | | |
| | | } |
| | |
| | | @TableField("residue_limit") |
| | | private String residueLimit; |
| | | |
| | | public String getHeadImg() { |
| | | return headImg; |
| | | } |
| | | |
| | | public void setHeadImg(String headImg) { |
| | | this.headImg = headImg; |
| | | } |
| | | |
| | | private String headImg; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | |
| | | private Integer remove; |
| | | private String type; |
| | | |
| | | |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | |
| | | @TableField(exist = false) |
| | | private String address; |
| | | |
| | | private String headImg; |
| | | |
| | | } |
| | |
| | | private BigDecimal warePrice; |
| | | @TableField("port_id") |
| | | private Integer portId; |
| | | @TableField("zipcode") |
| | | private String zipCode; |
| | | private String city; |
| | | private String state; |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | |
| | | private Date pickupTime; |
| | | |
| | | private Integer streetTurn; |
| | | |
| | | @ApiModelProperty(value = "1:YES 2:NO") |
| | | private Integer lineHold; |
| | | @ApiModelProperty(value = "1:YES 2:NO") |
| | | private Integer customHold; |
| | | @ApiModelProperty(value = "1:YES 2:NO") |
| | | private Integer pierpass; |
| | | @ApiModelProperty(value = "1:YES 2:NO") |
| | | private Integer CTF; |
| | | |
| | | private String LFD; |
| | | @ApiModelProperty(value = "1:YES 2:NO") |
| | | private Integer closedArea; |
| | | } |
| | |
| | | TCompanyResp tCompanyResp = new TCompanyResp(); |
| | | tCompanyResp.setOrderId(order.getId()); |
| | | tCompanyResp.setName(price.getType()); |
| | | tCompanyResp.setPrice(price.getPrice()); |
| | | tCompanyResp.setPrice(price.getCarPrice()); |
| | | tCompanyRespList.add(tCompanyResp); |
| | | } |
| | | BigDecimal bigDecimal = tCompanyRespList.stream().map(TCompanyResp::getPrice).reduce(BigDecimal::add).orElse(new BigDecimal(0.00)); |
| | |
| | | |
| | | @Override |
| | | public List<ShouldPayVo> getPayList(Page<ShouldPayVo> receivableVoPage, String time, String name) { |
| | | List<ShouldPayVo> list = this.baseMapper.getPayList(receivableVoPage,name); |
| | | List<ShouldPayVo> list = this.baseMapper.getPayList(receivableVoPage,name,1); |
| | | |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.setTime(new Date()); |
| | |
| | | sTime = time.split(" - ")[0]+" 00:00:01"; |
| | | eTime = time.split(" - ")[1]+" 23:59:59"; |
| | | } |
| | | List<ReceivablesList> receivablesLists = this.baseMapper.listOfReceivables(receivableVoPage, sTime, eTime, name, invoicesId, orderId, state); |
| | | List<ReceivablesList> receivablesLists = this.baseMapper.listOfReceivables(receivableVoPage, sTime, eTime, name, invoicesId, orderId, state,1); |
| | | for (ReceivablesList receivablesList : receivablesLists) { |
| | | Integer id= this.baseMapper.getPayStatus(receivablesList.getOrderId()); |
| | | if(id==null){ |
| | |
| | | sTime = time.split(" - ")[0]+" 00:00:01"; |
| | | eTime = time.split(" - ")[1]+" 23:59:59"; |
| | | } |
| | | List<PayList> list = this.baseMapper.listOfPay(receivableVoPage, sTime, eTime, name, billId, orderId, state); |
| | | List<PayList> list = this.baseMapper.listOfPay(receivableVoPage, sTime, eTime, name, billId, orderId, state,1); |
| | | return list; |
| | | } |
| | | |
| | |
| | | Integer groupId = tUser.getGroupId(); |
| | | if(groupId!=null) { |
| | | TGroup tGroup = tGroupMapper.selectById(groupId); |
| | | orderInfo.setSalesGroup(tGroup.getName()); |
| | | Integer salesId = tGroup.getSalesId(); |
| | | User user = userMapper.selectById(salesId); |
| | | orderInfo.setSales(user.getName()); |
| | | if(tGroup!=null){ |
| | | orderInfo.setSalesGroup(tGroup.getName()); |
| | | Integer salesId = tGroup.getSalesId(); |
| | | User user = userMapper.selectById(salesId); |
| | | orderInfo.setSales(user.getName()); |
| | | } |
| | | |
| | | } |
| | | // 获取码头id 获取码头地址 pickup信息 |
| | | Integer portId = tOrder.getPort(); |
| | |
| | | package com.stylefeng.guns.modular.system.utils; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.stripe.Stripe; |
| | | import com.stripe.exception.SignatureVerificationException; |
| | | import com.stripe.exception.StripeException; |
| | | import com.stripe.exception.*; |
| | | import com.stripe.model.Customer; |
| | | import com.stripe.model.PaymentIntent; |
| | | import com.stripe.model.PaymentMethod; |
| | | import com.stripe.model.PaymentMethodCollection; |
| | | import com.stripe.net.Webhook; |
| | | import com.stripe.param.CustomerCreateParams; |
| | | import com.stripe.param.PaymentIntentCreateParams; |
| | | import com.stripe.param.PaymentIntentUpdateParams; |
| | | import com.stripe.param.PaymentMethodListParams; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.logging.Logger; |
| | | |
| | | public class PaymentProcessor { |
| | | |
| | | public static String getMethod(String customer) throws StripeException { |
| | | |
| | | |
| | | PaymentMethodListParams params = |
| | | PaymentMethodListParams.builder() |
| | | .setCustomer(customer) |
| | | .setType(PaymentMethodListParams.Type.CARD) |
| | | .build(); |
| | | |
| | | PaymentMethodCollection paymentMethods = PaymentMethod.list(params); |
| | | String s = JSON.toJSONString(paymentMethods); |
| | | return s; |
| | | } |
| | | |
| | | |
| | | public static Boolean pay(String cus,String method,Long money) throws StripeException { |
| | | Stripe.apiKey = "sk_test_51Mu5D0KDN0sswRVwUNL5998QrX1VJkNrLsflVUXkEFH0cY2l9StrCc5O4c9gtzs7tLbVmeaTfyNL6pnrtw1tRClA00ZVfbNb3d"; |
| | | PaymentIntentCreateParams params = |
| | | PaymentIntentCreateParams.builder() |
| | | .setCurrency("usd") |
| | | .setAmount(money) |
| | | .setCustomer(cus) |
| | | .setPaymentMethod(method) |
| | | .setErrorOnRequiresAction(true) |
| | | .setConfirm(true) |
| | | .build(); |
| | | try { |
| | | PaymentIntent paymentIntent = PaymentIntent.create(params); |
| | | return true; |
| | | } catch (CardException err) { |
| | | // Error code will be authentication_required if authentication is needed |
| | | String paymentIntentId = err.getStripeError().getPaymentIntent().getId(); |
| | | PaymentIntent paymentIntent = PaymentIntent.retrieve(paymentIntentId); |
| | | System.out.println(paymentIntent.getId()); |
| | | return false; |
| | | }catch (RateLimitException e) { |
| | | // Too many requests made to the API too quickly |
| | | |
| | | return false; |
| | | } catch (InvalidRequestException e) { |
| | | // Invalid parameters were supplied to Stripe's API |
| | | return false; |
| | | } catch (AuthenticationException e) { |
| | | // Authentication with Stripe's API failed |
| | | // (maybe you changed API keys recently) |
| | | return false; |
| | | } catch (StripeException e) { |
| | | // Display a very generic error to the user, and maybe send |
| | | // yourself an email |
| | | return false; |
| | | } catch (Exception e) { |
| | | // Something else happened, completely unrelated to Stripe |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | // 定义 Stripe API 密钥 |
| | | private static final String STRIPE_API_KEY = "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"; |
| | | |
| | | public PaymentProcessor() { |
| | | // 初始化 Stripe 对象并设置 API 密钥 |
| | | Stripe.apiKey = STRIPE_API_KEY; |
| | | } |
| | | |
| | | /** |
| | | * 创建一个 Stripe 客户,并保存他们的信用卡信息,以备将来使用。 |
| | | * 支持多种付款方式,例如支付宝、微信等。这里只是演示如何使用信用卡进行支付。 |
| | | * |
| | | * @param email 客户电子邮件地址 |
| | | * @param cardToken 由 Stripe.js 获取的信用卡令牌 |
| | | * @return Stripe 客户对象 |
| | | * @throws StripeException 如果创建客户或付款交易时出现错误 |
| | | */ |
| | | public Customer createCustomer(String email, String cardToken) throws StripeException { |
| | | |
| | | // 构造付款交易参数 |
| | | PaymentIntentCreateParams params = PaymentIntentCreateParams.builder() |
| | | .setAmount(1000L) // 设置要收取的金额,以美分为单位(例如 $10.00 = 1000 美分) |
| | | .setCurrency("usd") // 设置货币类型:USD(美元) |
| | | .setPaymentMethod(cardToken) // 设置由 Stripe.js 获取的信用卡令牌 |
| | | .build(); |
| | | |
| | | // 创建付款交易 |
| | | PaymentIntent paymentIntent = PaymentIntent.create(params); |
| | | |
| | | // 创建一个 Stripe 客户,将他们的付款方法与 Stripe 帐户关联在一起 |
| | | Customer customer = Customer.create( |
| | | CustomerCreateParams.builder() |
| | | .setEmail(email) // 设置客户的电子邮件地址 |
| | | .setPaymentMethod(paymentIntent.getPaymentMethod()) // 将付款方法与客户端 Stripe 帐户相关联 |
| | | .build() |
| | | ); |
| | | |
| | | // 返回创建的 Stripe 客户对象 |
| | | return customer; |
| | | } |
| | | |
| | | /** |
| | | * 从一个 Stripe 客户处收取付款。 |
| | | * |
| | | * @param customerId Stripe 客户 ID |
| | | * @param amount 要收取的金额,以美分为单位 |
| | | * @return Stripe 付款交易对象 |
| | | * @throws StripeException 如果捕获到 Stripe API 返回的错误 |
| | | */ |
| | | public static PaymentIntent charge(String customerId, long amount) throws StripeException { |
| | | |
| | | // 构造付款交易参数 |
| | | PaymentIntentCreateParams params = PaymentIntentCreateParams.builder() |
| | | .setCustomer(customerId) // 使用客户 ID 作为付款目标 |
| | | .setAmount(amount) // 设置要收取的金额,以美分为单位 |
| | | .setCurrency("usd").setDescription("1").setReturnUrl("") // 设置货币类型:USD(美元) |
| | | .build(); |
| | | |
| | | // 创建付款交易 |
| | | PaymentIntent paymentIntent = PaymentIntent.create(params); |
| | | |
| | | // 确认付款 |
| | | paymentIntent.confirm(); |
| | | |
| | | // 返回创建的 Stripe 付款交易对象 |
| | | return paymentIntent; |
| | | } |
| | | // private static final String STRIPE_API_KEY = "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"; |
| | | // |
| | | // public PaymentProcessor() { |
| | | // // 初始化 Stripe 对象并设置 API 密钥 |
| | | // Stripe.apiKey = STRIPE_API_KEY; |
| | | // } |
| | | // |
| | | // /** |
| | | // * 创建一个 Stripe 客户,并保存他们的信用卡信息,以备将来使用。 |
| | | // * 支持多种付款方式,例如支付宝、微信等。这里只是演示如何使用信用卡进行支付。 |
| | | // * |
| | | // * @param email 客户电子邮件地址 |
| | | // * @param cardToken 由 Stripe.js 获取的信用卡令牌 |
| | | // * @return Stripe 客户对象 |
| | | // * @throws StripeException 如果创建客户或付款交易时出现错误 |
| | | // */ |
| | | // public Customer createCustomer(String email, String cardToken) throws StripeException { |
| | | // |
| | | // // 构造付款交易参数 |
| | | // PaymentIntentCreateParams params = PaymentIntentCreateParams.builder() |
| | | // .setAmount(1000L) // 设置要收取的金额,以美分为单位(例如 $10.00 = 1000 美分) |
| | | // .setCurrency("usd") // 设置货币类型:USD(美元) |
| | | // .setPaymentMethod(cardToken) // 设置由 Stripe.js 获取的信用卡令牌 |
| | | // .build(); |
| | | // |
| | | // // 创建付款交易 |
| | | // PaymentIntent paymentIntent = PaymentIntent.create(params); |
| | | // |
| | | // // 创建一个 Stripe 客户,将他们的付款方法与 Stripe 帐户关联在一起 |
| | | // Customer customer = Customer.create( |
| | | // CustomerCreateParams.builder() |
| | | // .setEmail(email) // 设置客户的电子邮件地址 |
| | | // .setPaymentMethod(paymentIntent.getPaymentMethod()) // 将付款方法与客户端 Stripe 帐户相关联 |
| | | // .build() |
| | | // ); |
| | | // |
| | | // // 返回创建的 Stripe 客户对象 |
| | | // return customer; |
| | | // } |
| | | // |
| | | // /** |
| | | // * 从一个 Stripe 客户处收取付款。 |
| | | // * |
| | | // * @param customerId Stripe 客户 ID |
| | | // * @param amount 要收取的金额,以美分为单位 |
| | | // * @return Stripe 付款交易对象 |
| | | // * @throws StripeException 如果捕获到 Stripe API 返回的错误 |
| | | // */ |
| | | // public static PaymentIntent charge(String customerId, long amount) throws StripeException { |
| | | // |
| | | // // 构造付款交易参数 |
| | | // PaymentIntentCreateParams params = PaymentIntentCreateParams.builder() |
| | | // .setCustomer(customerId) // 使用客户 ID 作为付款目标 |
| | | // .setAmount(amount) // 设置要收取的金额,以美分为单位 |
| | | // .setCurrency("usd").setDescription("1").setReturnUrl("") // 设置货币类型:USD(美元) |
| | | // .build(); |
| | | // |
| | | // // 创建付款交易 |
| | | // PaymentIntent paymentIntent = PaymentIntent.create(params); |
| | | // |
| | | // // 确认付款 |
| | | // paymentIntent.confirm(); |
| | | // |
| | | // // 返回创建的 Stripe 付款交易对象 |
| | | // return paymentIntent; |
| | | // } |
| | | |
| | | |
| | | } |
| | |
| | | * @param stripeCardId 银行卡stripeId |
| | | * @throws StripeException |
| | | */ |
| | | public void updateStripeDefaultCard(String stripeMemberId, String stripeCardId) throws StripeException { |
| | | public static void updateStripeDefaultCard(String stripeMemberId, String stripeCardId) throws StripeException { |
| | | Stripe.apiKey = key; |
| | | Map<String, Object> retrieveParams = new HashMap<>(); |
| | | List<String> expandList = new ArrayList<>(); |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.utils; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.fasterxml.jackson.databind.JsonNode; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.TerminaleDataWarpper; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 码头-车场-客户 运输状态 第三方接口获取数据 APM码头——Import Availability |
| | | * |
| | | * </p> |
| | | * |
| | | * @Author: lisy |
| | | * @date: 2023-05-18 16:52 |
| | | * @Description: |
| | | */ |
| | | |
| | | public class TerminalInterfaceAcquisitionUtil { |
| | | |
| | | //Sandbox Interface |
| | | private static final String url = "https://api-sandbox.apmterminals.com/import-availability"; |
| | | |
| | | //Production Interface |
| | | private static final String proUrl = "https://api.apmterminals.com/import-availability"; |
| | | private static final String auth_url = "https://api.apmterminals.com/oauth/client_credential/accesstoken"; |
| | | |
| | | private static final String KEY = "di3RgCcM9zlgb5BG1UiYSIxwYdmYUxTo"; |
| | | private static final String SECRET = "AIJczPxBeocsEjtI"; |
| | | private static String bearerToken = "5dDHq3LwPW3EYZ6rtPGK0zqWsRA5"; |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @param containerId 容器id |
| | | * @param enums 设施编码 |
| | | * @return |
| | | */ |
| | | public static TerminaleDataWarpper getTerminalStatus(String containerId,String enums){ |
| | | String us = url+ "?assetId="+containerId+"&facilityCode="+enums; |
| | | HttpResponse execute = HttpRequest.get(us).header("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36") |
| | | .header("cookie", "_ga=GA1.2.1226281326.1675309614; _gid=GA1.2.1467106222.1675309614; _ga=GA1.4.1226281326.1675309614; _gid=GA1.4.1467106222.1675309614; AWSALB=1bWqINVI+LJP87FTEXfEw1Ob1nkbr+I4baSbUGUmu5+/LdiqL9ic04Nj7F0Vz3rvharAG7a8dVe3MX6YMNEbUINVr++CCv/UBw6JeCRS0PcbRLxK7wVHb1lPT8Jl; AWSALBCORS=1bWqINVI+LJP87FTEXfEw1Ob1nkbr+I4baSbUGUmu5+/LdiqL9ic04Nj7F0Vz3rvharAG7a8dVe3MX6YMNEbUINVr++CCv/UBw6JeCRS0PcbRLxK7wVHb1lPT8Jl") |
| | | .header("path", "?assetId=" + containerId + "&facilityCode=" + enums) |
| | | .header("Authorization", "Bearer " + bearerToken) |
| | | .execute(); |
| | | String body = execute.body(); |
| | | int status = execute.getStatus(); |
| | | if (status != 200){ |
| | | getAuth(); |
| | | getTerminalStatus(containerId,enums); |
| | | } |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | JsonNode jsonArray = null; |
| | | TerminaleDataWarpper warpper = new TerminaleDataWarpper(); |
| | | try { |
| | | jsonArray = objectMapper.readTree(body); |
| | | for (JsonNode jsonNode : jsonArray) { |
| | | String appointmentDateTimeLocal = jsonNode.get("appointmentDateTimeLocal").asText(); |
| | | warpper.setLfd(appointmentDateTimeLocal); |
| | | String appointmentNumber = jsonNode.get("containerId").asText(); |
| | | warpper.setAppointmentNumber(appointmentNumber); |
| | | String containerHolds = jsonNode.get("containerHolds").asText(); |
| | | List<String> collect = new ArrayList<>(); |
| | | if (ToolUtil.isEmpty(containerHolds)){ |
| | | return warpper; |
| | | } |
| | | if (containerHolds.contains(",")){ |
| | | String[] split = containerHolds.split(","); |
| | | collect = Arrays.stream(split).collect(Collectors.toList()); |
| | | if (collect.contains("LINE")){ |
| | | warpper.setLineHold(1); |
| | | } |
| | | if (collect.contains("TMF")){ |
| | | warpper.setCustomHold(1); |
| | | } |
| | | if (collect.contains("PIER")){ |
| | | warpper.setPierpass(1); |
| | | } |
| | | if (collect.contains("CTF")){ |
| | | warpper.setCtf(1); |
| | | } |
| | | if (collect.contains("AREA")){ |
| | | warpper.setClosedArea(1); |
| | | } |
| | | }else { |
| | | if (containerHolds.equals("LINE")){ |
| | | warpper.setLineHold(1); |
| | | } |
| | | if (containerHolds.equals("TMF")){ |
| | | warpper.setCustomHold(1); |
| | | } |
| | | if (containerHolds.equals("PIER")){ |
| | | warpper.setPierpass(1); |
| | | } |
| | | if (containerHolds.equals("CTF")){ |
| | | warpper.setCtf(1); |
| | | } |
| | | if (containerHolds.equals("AREA")){ |
| | | warpper.setClosedArea(1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return warpper; |
| | | } |
| | | |
| | | |
| | | public static void getAuth(){ |
| | | String us = auth_url+ "?grant_type=client_credentials"; |
| | | String body = HttpRequest.post(us) |
| | | .form("client_id", KEY) |
| | | .form("client_id", SECRET) |
| | | .execute().body(); |
| | | JSONObject object = JSONObject.parseObject(body); |
| | | Object o = object.get("access_token"); |
| | | if (ToolUtil.isNotEmpty(o)){ |
| | | bearerToken = (String) o; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * <p> |
| | | * 订单详情——运输安排 |
| | | * </p> |
| | | * |
| | | * @Author: lisy |
| | | * @date: 2023-05-22 16:52 |
| | | * @Description: |
| | | */ |
| | | |
| | | @Data |
| | | public class TerminaleDataWarpper { |
| | | |
| | | @ApiModelProperty(value = "1:YES 2:NO") |
| | | private Integer lineHold = 2; |
| | | @ApiModelProperty(value = "1:YES 2:NO") |
| | | private Integer customHold = 2; |
| | | @ApiModelProperty(value = "1:YES 2:NO") |
| | | private Integer pierpass = 2; |
| | | @ApiModelProperty(value = "1:YES 2:NO") |
| | | private Integer ctf = 2; |
| | | |
| | | private String lfd; |
| | | @ApiModelProperty(value = "1:YES 2:NO") |
| | | private Integer closedArea = 2; |
| | | |
| | | private String appointmentNumber; |
| | | |
| | | } |