| | |
| | | <name>guns-admin</name> |
| | | <description>guns 的spring boot版本</description> |
| | | |
| | | <packaging>jar</packaging> |
| | | <packaging>war</packaging> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | |
| | | <artifactId>alipay-sdk-java</artifactId> |
| | | <version>4.8.10.ALL</version> |
| | | </dependency> |
| | | <!-- oos对象存储 --> |
| | | <dependency> |
| | | <groupId>com.aliyun.oss</groupId> |
| | | <artifactId>aliyun-sdk-oss</artifactId> |
| | | <version>3.8.0</version> |
| | | <groupId>com.huaweicloud</groupId> |
| | | <artifactId>esdk-obs-java-bundle</artifactId> |
| | | <version>[3.21.11,)</version> |
| | | </dependency> |
| | | <!-- https://mvnrepository.com/artifact/com.aliyun/aliyun-java-sdk-core --> |
| | | <dependency> |
| | |
| | | <version>1.7.25</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.jsoup</groupId> |
| | | <artifactId>jsoup</artifactId> |
| | | <version>1.13.1</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>io.cellulant</groupId> |
| | | <artifactId>CheckoutEncryption</artifactId> |
| | | <version>0.0.1</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | |
| | |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil orderCharteredCar(Date travelTime, Integer carTime, Integer serverCarModelId, String modelUse, Integer peopleNumber, |
| | | String contactPerson, String contactPhone, String placeLonLat, HttpServletRequest request){ |
| | | String contactPerson, String contactPhone, String placeLonLat, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return orderCharteredCarService.orderCharteredCar(travelTime, carTime, serverCarModelId, modelUse, peopleNumber, contactPerson, contactPhone, placeLonLat, uid); |
| | | return orderCharteredCarService.orderCharteredCar(travelTime, carTime, serverCarModelId, modelUse, peopleNumber, contactPerson, contactPhone, placeLonLat, uid, language); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil orderCharteredCar(Date travelTime, Integer carTime, Integer serverCarModelId, String modelUse, Integer peopleNumber, |
| | | String contactPerson, String contactPhone, String placeLonLat, Integer uid) throws Exception; |
| | | String contactPerson, String contactPhone, String placeLonLat, Integer uid, Integer language) throws Exception; |
| | | |
| | | |
| | | |
| | |
| | | * @param uid |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil addCancle(Integer id, String reason, String remark, Integer uid) throws Exception; |
| | | ResultUtil addCancle(Integer id, String reason, String remark, Integer uid, Integer language) throws Exception; |
| | | |
| | | |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public ResultUtil orderCharteredCar(Date travelTime, Integer carTime, Integer serverCarModelId, String modelUse, Integer peopleNumber, |
| | | String contactPerson, String contactPhone, String placeLonLat, Integer uid) throws Exception { |
| | | String contactPerson, String contactPhone, String placeLonLat, Integer uid, Integer language) throws Exception { |
| | | OrderCharteredCar orderCharteredCar = new OrderCharteredCar(); |
| | | orderCharteredCar.setUserId(uid); |
| | | Company query = companyCityService.query(placeLonLat.split(",")[0], placeLonLat.split(",")[1]); |
| | | Company query = companyCityService.query1(placeLonLat.split(",")[0], placeLonLat.split(",")[1]); |
| | | if(null == query){ |
| | | return ResultUtil.error("该地点暂无企业服务"); |
| | | return ResultUtil.error(language == 1 ? "该地点暂无企业服务" : language == 2 ? "No corporate services are available at this location" : "Aucun service d’entreprise n’est disponible pour cet emplacement"); |
| | | } |
| | | orderCharteredCar.setCompanyId(query.getId()); |
| | | orderCharteredCar.setOrderNumber(this.getOrderNum()); |
| | |
| | | |
| | | |
| | | @Override |
| | | public ResultUtil addCancle(Integer id, String reason, String remark, Integer uid) throws Exception { |
| | | public ResultUtil addCancle(Integer id, String reason, String remark, Integer uid, Integer language) throws Exception { |
| | | if(ToolUtil.isNotEmpty(remark)){ |
| | | if(ToolUtil.isNotEmpty(remark)){ |
| | | List<SensitiveWords> sensitiveWords = sensitiveWordsMapper.selectList(null); |
| | |
| | | |
| | | OrderCharteredCar orderCharteredCar = this.selectById(id); |
| | | if(null == orderCharteredCar){ |
| | | return ResultUtil.error("取消订单失败,订单信息有误"); |
| | | return ResultUtil.error(language == 1 ? "取消订单失败,订单信息有误" : language == 2 ? "Cancel order failed, order information is incorrect" : "Annulation échouée, informations de commande incorrectes"); |
| | | } |
| | | if(orderCharteredCar.getState() != 1){ |
| | | return ResultUtil.error("取消订单失败,不合法的操作"); |
| | | return ResultUtil.error(language == 1 ? "取消订单失败,不合法的操作" : language == 2 ? "Cancel order failed, illegal operation" : "Annulation de la commande échouée, opération illégale"); |
| | | } |
| | | |
| | | OrderCancel orderCancel = new OrderCancel(); |
| | |
| | | @ApiImplicitParam(value = "司机id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<DriverInfoWarpper> queryDriverInfo(Integer id){ |
| | | public ResultUtil<DriverInfoWarpper> queryDriverInfo(Integer id, Integer language){ |
| | | try { |
| | | Map<String, Object> map = driverService.queryDriverInfo(id); |
| | | String name = String.valueOf(map.get("name")); |
| | | map.put("name", name.substring(0, 1) + "师傅"); |
| | | List<BaseWarpper> list = driverService.queryBusiness(id); |
| | | map.put("name", name.substring(0, 1) + (language == 1 ? "师傅" : language == 2 ? "driver" : "Le conducteur")); |
| | | List<BaseWarpper> list = driverService.queryBusiness(id, language); |
| | | map.put("list", list); |
| | | return ResultUtil.success(DriverInfoWarpper.getDriverInfoWarpper(map)); |
| | | }catch (Exception e){ |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.CallbackRequest; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.CallbackResponse; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.CheckoutRequest; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.Payments; |
| | | import com.stylefeng.guns.modular.system.warpper.*; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.model.TransactionDetails; |
| | |
| | | private IOrderCharteredCarService orderCharteredCarService; |
| | | |
| | | @Autowired |
| | | private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; |
| | | |
| | | @Autowired |
| | | private ITransactionDetailsService transactionDetailsService; |
| | | |
| | | @Autowired |
| | |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | | |
| | | |
| | | @Value("${filePath}") |
| | |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<TravelRecordWarpper>> queryMyTravelRecord(Integer pageNum, Integer size, HttpServletRequest request){ |
| | | public ResultUtil<List<TravelRecordWarpper>> queryMyTravelRecord(Integer pageNum, Integer size, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | String name = language == 1 ? "专车订单" : language == 2 ? "Private car order" : "Commande de voiture exclusive"; |
| | | pageNum = (pageNum - 1) * size; |
| | | List<Map<String, Object>> maps = orderCancelService.queryCancel(uid, 2); |
| | | for (Map<String, Object> map : maps) { |
| | | Integer orderType = Integer.valueOf(map.get("orderType").toString()); |
| | | if(1 == orderType){ |
| | | map.put("name", language == 1 ? "专车订单取消" : language == 2 ? "Private car order cancelled" : "Annulation de commande de voiture exclusive"); |
| | | } |
| | | if(4 == orderType){ |
| | | map.put("name", language == 1 ? "市内小件物流订单取消" : language == 2 ? "The small parts logistics order in the city has been cancelled" : "Annulation de commande pour la logistique de petites pièces dans la ville"); |
| | | } |
| | | } |
| | | List<Map<String, Object>> list = orderPrivateCarService.queryMyTravelRecord(uid);//专车 |
| | | // List<Map<String, Object>> list1 = orderTaxiService.queryMyTravelRecord(uid);//出租车 |
| | | // List<Map<String, Object>> list2 = orderCrossCityService.queryMyTravelRecord(uid);//跨城车 |
| | | for (Map<String, Object> map : list) { |
| | | map.put("name", name); |
| | | } |
| | | name = language == 1 ? "市内小件物流" : language == 2 ? "Small parts logistics in the city" : "Logistique de petites pièces dans la ville"; |
| | | List<Map<String, Object>> list3 = orderLogisticsService.queryMyTravelRecord(uid);//小件物流 |
| | | for (Map<String, Object> map : list3) { |
| | | map.put("name", name); |
| | | } |
| | | List<TransactionDetails> transactionDetails = transactionDetailsService.selectList(new EntityWrapper<TransactionDetails>().eq("state", 1) |
| | | .eq("type", 1).eq("userType", 1).eq("userId", uid).eq("orderType", 3).like("remark", "%跨城订单取消退款%")); |
| | | List<Map<String, Object>> list4 = new ArrayList<>(); |
| | |
| | | @ApiImplicitParam(value = "用户id", name = "uid", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "附加参数{\"key\":\"value\"}", name = "content", required = true, dataType = "string") |
| | | }) |
| | | public ResultUtil weChatPay(Integer orderId, Integer orderType, Integer type, Integer userType, Integer uid, String content){ |
| | | public ResultUtil weChatPay(Integer orderId, Integer orderType, Integer type, Integer userType, Integer uid, String content, Integer language){ |
| | | try { |
| | | return orderService.weChatPay(orderId, orderType, type, userType, uid, content); |
| | | return orderService.weChatPay(orderId, orderType, type, userType, uid, content, language); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "支付方式(1=手机支付,2=银行卡支付,3=余额)", name = "payType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "支付方式(1=线上支付,3=余额)", name = "payType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "取消单id(取消操作返回)", name = "cancleId", required = false, dataType = "int"), |
| | | @ApiImplicitParam(value = "支付端(1=用户APP端,2=司机APP端,3=用户小程序端)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil cancleOrderTaxi(Integer id, Integer orderType, Integer payType, Integer cancleId, Integer type, HttpServletRequest request){ |
| | | public ResultUtil cancleOrderTaxi(Integer id, Integer orderType, Integer payType, Integer cancleId, Integer type, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | |
| | | } |
| | | switch (orderType){ |
| | | case 1: |
| | | return orderPrivateCarService.cancleOrderPrivateCar(id, payType, cancleId, type); |
| | | case 2: |
| | | return orderTaxiService.cancleOrderTaxi(id, payType, cancleId, type); |
| | | case 3: |
| | | return orderCrossCityService.cancleOrderCrossCity(id, payType, cancleId, type); |
| | | return orderPrivateCarService.cancleOrderPrivateCar(id, payType, "user_" + uid, cancleId, type, language); |
| | | // case 2: |
| | | // return orderTaxiService.cancleOrderTaxi(id, payType, cancleId, type); |
| | | // case 3: |
| | | // return orderCrossCityService.cancleOrderCrossCity(id, payType, cancleId, type); |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/payTaxiOrder") |
| | | @ApiOperation(value = "订单完成支付订单操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiOperation(value = "订单完成支付订单操作【1.0】", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "支付方式(1=手机支付,2=银行卡支付,3=余额,4=线下支付)", name = "payType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "支付方式(1=线上支付,3=余额,4=线下支付)", name = "payType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,4=同城小件物流,5=跨城小件物流)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "优惠券id", name = "couponId", required = false, dataType = "int"), |
| | | @ApiImplicitParam(value = "支付端(1=用户APP端,2=司机APP端,3=用户小程序端)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil payTaxiOrder(Integer payType, Integer orderId, Integer orderType, Integer couponId, Integer type, HttpServletRequest request){ |
| | | public ResultUtil payTaxiOrder(Integer payType, Integer orderId, Integer orderType, Integer couponId, Integer type, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | |
| | | } |
| | | switch (orderType){ |
| | | case 1: |
| | | return orderPrivateCarService.payPrivateCarOrder(payType, orderId, couponId, type); |
| | | case 2: |
| | | return orderTaxiService.payTaxiOrder(payType, orderId, couponId, type); |
| | | case 3: |
| | | return orderCrossCityService.payCrossCityOrder(payType, orderId, couponId, type); |
| | | return orderPrivateCarService.payPrivateCarOrder(payType, "user_" + uid, orderId, couponId, type, language); |
| | | // case 2: |
| | | // return orderTaxiService.payTaxiOrder(payType, orderId, couponId, type); |
| | | // case 3: |
| | | // return orderCrossCityService.payCrossCityOrder(payType, orderId, couponId, type); |
| | | case 4: |
| | | return orderLogisticsService.payLogisticsOrder(payType, orderId, type); |
| | | case 5: |
| | | return orderLogisticsService.payLogisticsOrder(payType, orderId, type); |
| | | return orderLogisticsService.payLogisticsOrder(payType, "user_" + uid, orderId, type, language); |
| | | // case 5: |
| | | // return orderLogisticsService.payLogisticsOrder(payType, orderId, type, language); |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | |
| | | @ApiImplicitParam(value = "评价内容", name = "content", required = false, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil orderEvaluate(Integer orderId, Integer orderType, Integer fraction, String content){ |
| | | public ResultUtil orderEvaluate(Integer orderId, Integer orderType, Integer fraction, String content, Integer language){ |
| | | try { |
| | | ResultUtil resultUtil = orderEvaluateService.saveData(orderId, orderType, fraction, content); |
| | | ResultUtil resultUtil = orderEvaluateService.saveData(orderId, orderType, fraction, content, language); |
| | | if(resultUtil.getCode() == 200){ |
| | | switch (orderType){ |
| | | case 1: |
| | |
| | | @ApiImplicitParam(value = "订单类型", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil shareRedEnvelope(Integer orderId, Integer orderType){ |
| | | public ResultUtil shareRedEnvelope(Integer orderId, Integer orderType, Integer language){ |
| | | try { |
| | | switch (orderType){ |
| | | case 1: |
| | | return orderPrivateCarService.shareRedEnvelope(orderId); |
| | | return orderPrivateCarService.shareRedEnvelope(orderId, language); |
| | | case 2: |
| | | return orderTaxiService.shareRedEnvelope(orderId); |
| | | case 3: |
| | |
| | | |
| | | /** |
| | | * 取消订单微信回调 |
| | | * @param request |
| | | * @param callbackRequest |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/wxCancelOrderTaxi") |
| | | public void wxCancelOrderTaxi(HttpServletRequest request, HttpServletResponse response){ |
| | | public CallbackResponse wxCancelOrderTaxi(@RequestBody CallbackRequest callbackRequest){ |
| | | CallbackResponse callbackResponse = new CallbackResponse(); |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.weixinpayCallback(request);//icbcPayUtil.payCallback(request); |
| | | if(null != map){ |
| | | String out_trade_no = map.get("out_trade_no"); |
| | | String order_id = map.get("transaction_id"); |
| | | |
| | | /** |
| | | * 指示服务是否成功或付费的总体请求代码。。 |
| | | * 177-部分付费请求 |
| | | * 178-表明请求已全额支付 |
| | | * 179-表示请求已部分支付但已过期。 |
| | | * 129-请求已过期,未付款。 |
| | | * 180.商户拒绝请求 |
| | | * 183-商户接受请求,我们可以结算资金 |
| | | * 188-商户收到请求。 |
| | | */ |
| | | String request_status_code = callbackRequest.getRequest_status_code(); |
| | | String out_trade_no = callbackRequest.getMerchant_transaction_id(); |
| | | if("177".equals(request_status_code) || "178".equals(request_status_code)){ |
| | | Payments payments = callbackRequest.getPayments().get(0); |
| | | String order_id = payments.getPayer_transaction_id(); |
| | | if(ToolUtil.isNotEmpty(out_trade_no)){ |
| | | String[] split = out_trade_no.split("_"); |
| | | Integer id = Integer.valueOf(split[0]); |
| | | Integer type = Integer.valueOf(split[1]); |
| | | Integer type = Integer.valueOf(out_trade_no.substring(17, 18)); |
| | | Integer id = Integer.valueOf(out_trade_no.substring(18)); |
| | | switch (type){ |
| | | case 1: |
| | | orderPrivateCarService.payCancelOrderPrivateCar(id, order_id, 1); |
| | |
| | | orderCrossCityService.payCancelOrderCrossCity(id, order_id, 1); |
| | | break; |
| | | } |
| | | callbackResponse.setCheckout_request_id(order_id); |
| | | callbackResponse.setMerchant_transaction_id(out_trade_no); |
| | | callbackResponse.setStatus_code("183"); |
| | | callbackResponse.setStatus_description("Payment processed successfully"); |
| | | callbackResponse.setReceipt_number(UUIDUtil.getRandomCode(16)); |
| | | } |
| | | response.getOutputStream().print("success"); |
| | | }else{ |
| | | callbackResponse.setCheckout_request_id(UUIDUtil.getRandomCode(16)); |
| | | callbackResponse.setMerchant_transaction_id(out_trade_no); |
| | | callbackResponse.setStatus_code("180"); |
| | | callbackResponse.setStatus_description("means payment rejected."); |
| | | callbackResponse.setReceipt_number(UUIDUtil.getRandomCode(16)); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return callbackResponse; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | /** |
| | | * 完成订单微信支付回调 |
| | | * @param request |
| | | * @param |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/wxPayOrderTaxi") |
| | | public void wxPayOrderTaxi(HttpServletRequest request, HttpServletResponse response){ |
| | | public CallbackResponse wxPayOrderTaxi(@RequestBody CallbackRequest callbackRequest){ |
| | | CallbackResponse callbackResponse = new CallbackResponse(); |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.weixinpayCallback(request);//icbcPayUtil.payCallback(request); |
| | | if(null != map){ |
| | | String out_trade_no = map.get("out_trade_no"); |
| | | String order_id = map.get("transaction_id"); |
| | | /** |
| | | * 指示服务是否成功或付费的总体请求代码。。 |
| | | * 177-部分付费请求 |
| | | * 178-表明请求已全额支付 |
| | | * 179-表示请求已部分支付但已过期。 |
| | | * 129-请求已过期,未付款。 |
| | | * 180.商户拒绝请求 |
| | | * 183-商户接受请求,我们可以结算资金 |
| | | * 188-商户收到请求。 |
| | | */ |
| | | String request_status_code = callbackRequest.getRequest_status_code(); |
| | | String out_trade_no = callbackRequest.getMerchant_transaction_id(); |
| | | if("177".equals(request_status_code) || "178".equals(request_status_code)){ |
| | | Payments payments = callbackRequest.getPayments().get(0); |
| | | String order_id = payments.getPayer_transaction_id(); |
| | | if(ToolUtil.isNotEmpty(out_trade_no)){ |
| | | String[] split = out_trade_no.split("_"); |
| | | Integer id = Integer.valueOf(split[0]); |
| | | Integer type = Integer.valueOf(split[1]); |
| | | Integer type = Integer.valueOf(out_trade_no.substring(17, 18)); |
| | | Integer language = Integer.valueOf(out_trade_no.substring(18, 19)); |
| | | Integer id = Integer.valueOf(out_trade_no.substring(19)); |
| | | switch (type){ |
| | | case 1: |
| | | orderPrivateCarService.payOrderPrivateCarCallback(id, order_id, 1); |
| | | orderPrivateCarService.payOrderPrivateCarCallback(id, order_id, 1, language); |
| | | break; |
| | | case 2: |
| | | orderTaxiService.payOrderTaxiCallback(id, order_id, 1); |
| | |
| | | orderCrossCityService.payOrderCrossCityCallback(id, order_id, 1); |
| | | break; |
| | | case 4: |
| | | orderLogisticsService.payOrderLogisticsCallback(id, order_id, 1); |
| | | orderLogisticsService.payOrderLogisticsCallback(id, order_id, 1, language); |
| | | break; |
| | | case 5: |
| | | orderLogisticsService.payOrderLogisticsCallback(id, order_id, 1); |
| | | orderLogisticsService.payOrderLogisticsCallback(id, order_id, 1, language); |
| | | break; |
| | | } |
| | | response.getOutputStream().print("success"); |
| | | callbackResponse.setCheckout_request_id(order_id); |
| | | callbackResponse.setMerchant_transaction_id(out_trade_no); |
| | | callbackResponse.setStatus_code("183"); |
| | | callbackResponse.setStatus_description("Payment processed successfully"); |
| | | callbackResponse.setReceipt_number(UUIDUtil.getRandomCode(16)); |
| | | } |
| | | }else{ |
| | | callbackResponse.setCheckout_request_id(UUIDUtil.getRandomCode(16)); |
| | | callbackResponse.setMerchant_transaction_id(out_trade_no); |
| | | callbackResponse.setStatus_code("180"); |
| | | callbackResponse.setStatus_description("means payment rejected."); |
| | | callbackResponse.setReceipt_number(UUIDUtil.getRandomCode(16)); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return callbackResponse; |
| | | } |
| | | |
| | | |
| | |
| | | String[] split = out_trade_no.split("_"); |
| | | Integer id = Integer.valueOf(split[0]); |
| | | Integer type = Integer.valueOf(split[1]); |
| | | Integer language = Integer.valueOf(split[2]); |
| | | switch (type){ |
| | | case 1: |
| | | orderPrivateCarService.payOrderPrivateCarCallback(id, order_id, 2); |
| | | orderPrivateCarService.payOrderPrivateCarCallback(id, order_id, 2, language); |
| | | break; |
| | | case 2: |
| | | orderTaxiService.payOrderTaxiCallback(id, order_id, 2); |
| | |
| | | orderCrossCityService.payOrderCrossCityCallback(id, order_id, 2); |
| | | break; |
| | | case 4: |
| | | orderLogisticsService.payOrderLogisticsCallback(id, order_id, 2); |
| | | orderLogisticsService.payOrderLogisticsCallback(id, order_id, 2, language); |
| | | break; |
| | | case 5: |
| | | orderLogisticsService.payOrderLogisticsCallback(id, order_id, 2); |
| | | orderLogisticsService.payOrderLogisticsCallback(id, order_id, 2, language); |
| | | break; |
| | | } |
| | | response.setContentType("text/html;charset=UTF-8"); |
| | |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<SystemNoticeWarpper>> queryNotices(Integer type, Integer pageNum, Integer size, HttpServletRequest request){ |
| | | public ResultUtil<List<SystemNoticeWarpper>> queryNotices(Integer type, Integer pageNum, Integer size, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<Map<String, Object>> list = systemNoticeService.queryList(type, pageNum, size, uid); |
| | | List<Map<String, Object>> list = systemNoticeService.queryList(type, pageNum, size, uid, language); |
| | | return ResultUtil.success(SystemNoticeWarpper.getSystemNoticeWarpper(list)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.PayMoneyUtil; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.CallbackRequest; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.CallbackResponse; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.Payments; |
| | | import com.stylefeng.guns.modular.system.util.UUIDUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | |
| | | /** |
| | | * 微信余额充值回调函数 |
| | | * @param request |
| | | * @param callbackRequest |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/wxCancelUserBalance") |
| | | public void wxCancelUserBalance(HttpServletRequest request, HttpServletResponse response){ |
| | | public CallbackResponse wxCancelUserBalance(@RequestBody CallbackRequest callbackRequest){ |
| | | CallbackResponse callbackResponse = new CallbackResponse(); |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.weixinpayCallback(request); |
| | | String id = map.get("out_trade_no"); |
| | | String order_id = map.get("out_trade_no"); |
| | | String uid = map.get("attach"); |
| | | userInfoService.payCancelUserBalance(null, order_id, Integer.valueOf(id), 1); |
| | | //icbcPayUtil.answer(response); |
| | | |
| | | response.getOutputStream().print("success"); |
| | | /** |
| | | * 指示服务是否成功或付费的总体请求代码。。 |
| | | * 177-部分付费请求 |
| | | * 178-表明请求已全额支付 |
| | | * 179-表示请求已部分支付但已过期。 |
| | | * 129-请求已过期,未付款。 |
| | | * 180.商户拒绝请求 |
| | | * 183-商户接受请求,我们可以结算资金 |
| | | * 188-商户收到请求。 |
| | | */ |
| | | String request_status_code = callbackRequest.getRequest_status_code(); |
| | | String out_trade_no = callbackRequest.getMerchant_transaction_id(); |
| | | if("177".equals(request_status_code) || "178".equals(request_status_code)){ |
| | | Payments payments = callbackRequest.getPayments().get(0); |
| | | String order_id = payments.getPayer_transaction_id(); |
| | | if(ToolUtil.isNotEmpty(out_trade_no)){ |
| | | Integer language = Integer.valueOf(out_trade_no.substring(17, 18)); |
| | | Integer id = Integer.valueOf(out_trade_no.substring(18)); |
| | | userInfoService.payCancelUserBalance(null, order_id, Integer.valueOf(id), 1, language); |
| | | callbackResponse.setCheckout_request_id(order_id); |
| | | callbackResponse.setMerchant_transaction_id(out_trade_no); |
| | | callbackResponse.setStatus_code("183"); |
| | | callbackResponse.setStatus_description("Payment processed successfully"); |
| | | callbackResponse.setReceipt_number(UUIDUtil.getRandomCode(16)); |
| | | } |
| | | }else{ |
| | | callbackResponse.setCheckout_request_id(UUIDUtil.getRandomCode(16)); |
| | | callbackResponse.setMerchant_transaction_id(out_trade_no); |
| | | callbackResponse.setStatus_code("180"); |
| | | callbackResponse.setStatus_description("means payment rejected."); |
| | | callbackResponse.setReceipt_number(UUIDUtil.getRandomCode(16)); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return callbackResponse; |
| | | } |
| | | |
| | | |
| | |
| | | Map<String, String> map = payMoneyUtil.alipayCallback(request); |
| | | String id = map.get("out_trade_no"); |
| | | String order_id = map.get("out_trade_no"); |
| | | //String uid = map.get("attach"); |
| | | userInfoService.payCancelUserBalance(null, order_id, Integer.valueOf(id), 2); |
| | | //icbcPayUtil.answer(response); |
| | | String[] s = order_id.split("_"); |
| | | Integer language = Integer.valueOf(s[1]); |
| | | userInfoService.payCancelUserBalance(null, s[0], Integer.valueOf(id), 2, language); |
| | | response.setContentType("text/html;charset=UTF-8"); |
| | | PrintWriter out; |
| | | out = response.getWriter(); |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.nodes.Element; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.io.File; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private IReportLossService reportLossService; |
| | | |
| | | @Value("${spring.mail.template-path}") |
| | | private String templatePath; |
| | | |
| | | |
| | | |
| | |
| | | @ApiImplicitParam(value = "图片验证码", name = "kaptcha", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "场景类型(1=身份验证,2=登录确认,3=用户注册,4=修改密码)", name = "type", required = true, dataType = "String") |
| | | }) |
| | | public ResultUtil queryCaptcha(HttpServletRequest request,String phone, Integer type,String kaptcha){ |
| | | public ResultUtil queryCaptcha(HttpServletRequest request,String phone, Integer type,String kaptcha, Integer language){ |
| | | if(ToolUtil.isNotEmpty(phone)){ |
| | | try { |
| | | /* HttpSession session = request.getSession(); |
| | |
| | | String code = redisUtil.getValue(phone+"_Code"); |
| | | System.out.println("缓存中验证码为:"+code); |
| | | if (ToolUtil.isEmpty(kaptcha) || !kaptcha.equalsIgnoreCase(code)) { |
| | | return ResultUtil.error("图形验证码错误"); |
| | | return ResultUtil.error(language == 1 ? "图形验证码错误" : language == 2 ? "The graphic verification code is incorrect" : "Code de vérification graphique incorrect"); |
| | | } |
| | | return userInfoService.queryCaptcha(phone, type); |
| | | }catch (Exception e){ |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "邮箱地址", name = "email", required = true, dataType = "String") |
| | | }) |
| | | public ResultUtil sedEmail(String email){ |
| | | public ResultUtil sedEmail(String email, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(ToolUtil.isEmpty(email)){ |
| | | return ResultUtil.error("邮箱地址不能为空"); |
| | | return ResultUtil.error(language == 1 ? "邮箱不能为空" : language == 2 ? "The mailbox cannot be empty" : "L’email ne peut pas être vide"); |
| | | } |
| | | Random random = new Random(); |
| | | StringBuffer sb = new StringBuffer(); |
| | |
| | | } |
| | | String authCode = sb.toString(); |
| | | redisUtil.setStrValue(email, authCode, 5 * 60); |
| | | EmailUtil.getMimeMessage(email, "验证码", "您的验证码:<span style=\"color:red;\">" + authCode + "</span>"); |
| | | |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | String nickName = ""; |
| | | if(null != userInfo){ |
| | | nickName = userInfo.getNickName(); |
| | | } |
| | | |
| | | if(ToolUtil.isNotEmpty(email)){ |
| | | String path = templatePath + "user/mainbox.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | if(1 == language){ |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element user_chinese = document.getElementById("user_chinese"); |
| | | user_chinese.text("您好 " + nickName + ","); |
| | | Element content_chinese = document.getElementById("content_chinese"); |
| | | content_chinese.text(authCode); |
| | | } |
| | | if(2 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element user_chinese = document.getElementById("user_english"); |
| | | user_chinese.text("Hello " + nickName + ","); |
| | | Element content_chinese = document.getElementById("content_english"); |
| | | content_chinese.text(authCode); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | Element user_french = document.getElementById("user_french"); |
| | | user_french.text("Bonjour " + nickName + ","); |
| | | Element content_french = document.getElementById("content_french"); |
| | | content_french.text(authCode); |
| | | } |
| | | |
| | | EmailUtil.send(email, language == 1 ? "验证码" : language == 2 ? "Verification code" : "Code de vérification", document.html()); |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | * @param phone |
| | | * @param code |
| | | * @param registIp |
| | | * @param registAreaCode |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | |
| | | @ApiImplicitParam(value = "手机号码", name = "phone", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "短信验证码", name = "code", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "ip地址", name = "registIp", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "当前定位区县行政编号", name = "registAreaCode", required = false, dataType = "String") |
| | | @ApiImplicitParam(value = "纬度", name = "lat", required = false, dataType = "double"), |
| | | @ApiImplicitParam(value = "经度", name = "lng", required = false, dataType = "double") |
| | | }) |
| | | public ResultUtil<LoginWarpper> captchaLogin(String phone, String code, String registIp, String registAreaCode){ |
| | | public ResultUtil<LoginWarpper> captchaLogin(String phone, String code, String registIp, Double lat, Double lng, Integer language){ |
| | | try { |
| | | return userInfoService.captchaLogin(phone, code, registIp, registAreaCode,null,null,null); |
| | | return userInfoService.captchaLogin(phone, code, registIp, lat, lng,null,null,null,language); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | @ApiImplicitParam(value = "用户类型(1=用户,2=司机)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "注册类型(1=司机注册,2=用户注册)", name = "userType", required = true, dataType = "int") |
| | | }) |
| | | public ResultUtil<LoginWarpper> captchaLogin_(String phone, String code, Integer uid, Integer type, Integer userType){ |
| | | public ResultUtil<LoginWarpper> captchaLogin_(String phone, String code, Integer uid, Integer type, Integer userType, Integer language){ |
| | | try { |
| | | return userInfoService.captchaLogin(phone, code, uid, type, userType); |
| | | return userInfoService.captchaLogin(phone, code, uid, type, userType, language); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | @ApiImplicitParam(value = "手机号码", name = "phone", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "登录密码", name = "password", required = true, dataType = "String") |
| | | }) |
| | | public ResultUtil<LoginWarpper> userLogin(String phone, String password){ |
| | | public ResultUtil<LoginWarpper> userLogin(String phone, String password, Integer language){ |
| | | if(ToolUtil.isNotEmpty(phone) && ToolUtil.isNotEmpty(password)){ |
| | | try { |
| | | return userInfoService.userLogin(phone, password); |
| | | return userInfoService.userLogin(phone, password, language); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | @ApiImplicitParam(value = "验证码", name = "code", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "新密码", name = "password", required = true, dataType = "String") |
| | | }) |
| | | public ResultUtil forgetPassword(String phone, String code, String password){ |
| | | public ResultUtil forgetPassword(String phone, String code, String password, Integer language){ |
| | | if(ToolUtil.isNotEmpty(phone) && ToolUtil.isNotEmpty(code) && ToolUtil.isNotEmpty(password)){ |
| | | try { |
| | | return userInfoService.forgetPassword(phone, code, password); |
| | | return userInfoService.forgetPassword(phone, code, password, language); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | @ApiImplicitParam(value = "分享的用户id", name = "uid", required = false, dataType = "int"), |
| | | @ApiImplicitParam(value = "性别(1=男,2=女)", name = "sex", required = false, dataType = "int") |
| | | }) |
| | | public ResultUtil<LoginWarpper> wxLogin(Integer uid,String encryptedData, String iv,Integer type, String openid, String unionid, String jscode, String registIp, String registAreaCode, Integer sex, String nickName, String avatar,String loginType){ |
| | | public ResultUtil<LoginWarpper> wxLogin(Integer uid,String encryptedData, String iv,Integer type, String openid, String unionid, String jscode, String registIp, |
| | | String registAreaCode, Integer sex, String nickName, String avatar,String loginType, Integer language){ |
| | | try { |
| | | return userInfoService.wxLogin(type, openid, unionid, jscode, registIp, registAreaCode, sex, nickName, avatar,loginType,encryptedData,iv,uid); |
| | | return userInfoService.wxLogin(type, openid, unionid, jscode, registIp, registAreaCode, sex, nickName, avatar,loginType,encryptedData,iv,uid,language); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | @ApiImplicitParam(value = "FaceBook用户id", name = "id", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "FaceBook用户名称", name = "name", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "FaceBook绑定的email", name = "email", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "当前定位区县行政编号", name = "registAreaCode", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "头像", name = "avatar", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "性别(1=男,2=女)", name = "sex", required = false, dataType = "int"), |
| | | @ApiImplicitParam(value = "纬度", name = "lat", required = false, dataType = "double"), |
| | | @ApiImplicitParam(value = "经度", name = "lng", required = false, dataType = "double"), |
| | | @ApiImplicitParam(value = "分享的用户id", name = "uid", required = false, dataType = "int"), |
| | | }) |
| | | public ResultUtil facebookLogin(String id, String name, String email, String registAreaCode, Integer uid){ |
| | | public ResultUtil facebookLogin(String id, String name, String email, Double lat, Double lng, Integer uid, Integer language){ |
| | | try { |
| | | return userInfoService.facebookLogin(id, name, email, registAreaCode, uid); |
| | | return userInfoService.facebookLogin(id, name, email, lat, lng, uid, language); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | @ApiImplicitParam(value = "验证码", name = "code", required = false, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<LoginWarpper> bindingPhone(String phone, String code, HttpServletRequest request){ |
| | | public ResultUtil<LoginWarpper> bindingPhone(String phone, String code, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return userInfoService.bindingPhone(uid, phone, code); |
| | | return userInfoService.bindingPhone(uid, phone, code, language); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | @ApiImplicitParam(value = "验证码", name = "code", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<LoginWarpper> bindingEmail(Integer type, String email, String code, HttpServletRequest request){ |
| | | public ResultUtil<LoginWarpper> bindingEmail(Integer type, String email, String code, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return userInfoService.bindingEmail(uid, type, email, code); |
| | | return userInfoService.bindingEmail(uid, type, email, code, language); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | @PostMapping("/api/user/depositBalance") |
| | | @ApiOperation(value = "余额充值", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "支付方式(1=微信,2=支付宝)", name = "payType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "支付方式(1=线上支付)", name = "payType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "充值金额", name = "money", required = true, dataType = "double"), |
| | | @ApiImplicitParam(value = "支付端(1=用户APP端,2=司机APP端,3=用户小程序端)", name = "type", required = false, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil depositBalance(Integer payType, Double money, Integer type, HttpServletRequest request){ |
| | | public ResultUtil depositBalance(Integer payType, Double money, Integer type, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return userInfoService.depositBalance(payType, money, uid, type); |
| | | return userInfoService.depositBalance(payType, "user_" + uid, money, uid, type, language); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | @ApiImplicitParam(value = "新手机号", name = "phone", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil updatePhone(String code, String phone, HttpServletRequest request){ |
| | | public ResultUtil updatePhone(String code, String phone, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return userInfoService.updatePhone(code, phone, uid); |
| | | return userInfoService.updatePhone(code, phone, uid, language); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | @ApiImplicitParam(value = "新密码", name = "password", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil updatePassword(String password, HttpServletRequest request){ |
| | | public ResultUtil updatePassword(String password, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return userInfoService.updatePass(password, uid); |
| | | return userInfoService.updatePass(password, uid, language); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | @ApiImplicitParam(value = "昵称", name = "nickname", required = false, dataType = "string"), |
| | | @ApiImplicitParam(value = "性别(1=男,2=女)", name = "sex", required = false, dataType = "int"), |
| | | @ApiImplicitParam(value = "生日(2020-06-15)", name = "birthday", required = false, dataType = "string"), |
| | | @ApiImplicitParam(value = "邮箱", name = "email", required = false, dataType = "string"), |
| | | @ApiImplicitParam(value = "姓氏", name = "lastName", required = false, dataType = "string"), |
| | | @ApiImplicitParam(value = "名字", name = "firstName", required = false, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil updateInfo(String avatar, String nickname, Integer sex, Date birthday, HttpServletRequest request){ |
| | | public ResultUtil updateInfo(String avatar, String nickname, Integer sex, Date birthday, String email, String lastName, String firstName, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | userInfoService.updateInfo(avatar, nickname, sex, birthday, uid); |
| | | userInfoService.updateInfo(avatar, nickname, sex, birthday, email, lastName, firstName, uid); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<WithdrawalWarpper>> queryWithdrawal(Integer pageNum, Integer size, HttpServletRequest request){ |
| | | public ResultUtil<List<WithdrawalWarpper>> queryWithdrawal(Integer pageNum, Integer size, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<Map<String, Object>> list = withdrawalService.queryWithdrawal(uid, pageNum, size); |
| | | List<Map<String, Object>> list = withdrawalService.queryWithdrawal(uid, pageNum, size, language); |
| | | return ResultUtil.success(WithdrawalWarpper.getWithdrawalWarpper(list)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil payCrossCityOrder(Integer payType, Integer orderId, Integer couponId, Integer type)throws Exception; |
| | | ResultUtil payCrossCityOrder(Integer payType, Integer orderId, Integer couponId, Integer type, Integer language)throws Exception; |
| | | |
| | | |
| | | |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil cancleOrderCrossCity(Integer id, Integer payType, Integer cancleId, Integer type) throws Exception; |
| | | ResultUtil cancleOrderCrossCity(Integer id, Integer payType, Integer cancleId, Integer type, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil payCrossCityOrder(Integer payType, Integer orderId, Integer couponId, Integer type) throws Exception { |
| | | public ResultUtil payCrossCityOrder(Integer payType, Integer orderId, Integer couponId, Integer type, Integer language) throws Exception { |
| | | OrderCrossCity orderCrossCity = this.selectById(orderId); |
| | | if(orderCrossCity.getState() != 7){ |
| | | return ResultUtil.error("订单已完成支付,不允许重复支付", ""); |
| | | return ResultUtil.error("订单已完成支付,不允许重复支付"); |
| | | } |
| | | Integer uid = orderCrossCity.getUserId(); |
| | | Double orderMoney = orderCrossCity.getOrderMoney(); |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | ResultUtil resultUtil = ResultUtil.success(new HashMap<>()); |
| | | ResultUtil resultUtil = ResultUtil.success(); |
| | | orderCrossCity.setCouponMoney(0D);//初始化历史数据 |
| | | orderCrossCity.setCouponId(null); |
| | | |
| | |
| | | if(null != couponId){ |
| | | userCouponRecord = userCouponRecordService.selectById(couponId); |
| | | if(userCouponRecord.getCompanyId() != orderCrossCity.getCompanyId()){ |
| | | return ResultUtil.error("优惠券不能用于此订单", ""); |
| | | return ResultUtil.error("优惠券不能用于此订单"); |
| | | } |
| | | if(userCouponRecord.getState() == 2){ |
| | | return ResultUtil.error("优惠券已使用", ""); |
| | | return ResultUtil.error("优惠券已使用"); |
| | | } |
| | | if(userCouponRecord.getState() == 3){ |
| | | return ResultUtil.error("优惠券已过期", ""); |
| | | return ResultUtil.error("优惠券已过期"); |
| | | } |
| | | if(userCouponRecord.getCouponUseType() != 0 && userCouponRecord.getCouponUseType() != 3){ |
| | | return ResultUtil.error("优惠券不能用于此类型订单", ""); |
| | | return ResultUtil.error("优惠券不能用于此类型订单"); |
| | | } |
| | | if(userCouponRecord.getCouponType() == 2 && orderMoney.compareTo(userCouponRecord.getFullMoney()) < 0){ |
| | | return ResultUtil.error("优惠券不能用于此订单", ""); |
| | | return ResultUtil.error("优惠券不能用于此订单"); |
| | | } |
| | | orderMoney = orderMoney - userCouponRecord.getMoney(); |
| | | orderCrossCity.setCouponMoney(userCouponRecord.getMoney()); |
| | |
| | | paymentRecordService.saveData(1, null, null, orderId, 3, 1, orderMoney, null, 1);//添加预支付数据 |
| | | resultUtil = resultUtil; |
| | | }else{ |
| | | resultUtil = ResultUtil.error("获取支付信息失败", ""); |
| | | resultUtil = ResultUtil.error("获取支付信息失败"); |
| | | } |
| | | } |
| | | if(payType == 2){//支付宝支付 |
| | |
| | | paymentRecordService.saveData(1, null, null, orderId, 3, 2, orderMoney, null, 1);//添加预支付数据 |
| | | resultUtil = resultUtil; |
| | | }else{ |
| | | resultUtil = ResultUtil.error("获取支付信息失败", ""); |
| | | resultUtil = ResultUtil.error("获取支付信息失败"); |
| | | } |
| | | } |
| | | if(payType == 3){//余额支付 |
| | | if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){ |
| | | return ResultUtil.error("余额不足,无法完成支付", ""); |
| | | return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient account balance" : "Solde de compte insuffisant"); |
| | | } |
| | | |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | |
| | | //添加已收入明细 |
| | | Line line = lineService.selectById(orderCrossCity.getLineId()); |
| | | Double speMoney = Double.valueOf(line.getRakeRate()); |
| | | BigDecimal d = new BigDecimal(orderCrossCity.getOrderMoney()).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_EVEN);//企业收入 |
| | | BigDecimal d = new BigDecimal(orderCrossCity.getOrderMoney()).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN)));//企业收入 |
| | | BigDecimal c = new BigDecimal(orderCrossCity.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN);//司机收入 |
| | | incomeService.saveData(1, orderCrossCity.getCompanyId(), 2, orderCrossCity.getId(), 3, d.doubleValue()); |
| | | incomeService.saveData(2, orderCrossCity.getDriverId(), 2, orderCrossCity.getId(), 3, c.doubleValue()); |
| | |
| | | //添加已收入明细 |
| | | Line line = lineService.selectById(orderCrossCity.getLineId()); |
| | | Double speMoney = Double.valueOf(line.getRakeRate()); |
| | | BigDecimal d = new BigDecimal(orderCrossCity.getOrderMoney()).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_EVEN);//企业收入 |
| | | BigDecimal d = new BigDecimal(orderCrossCity.getOrderMoney()).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN)));//企业收入 |
| | | BigDecimal c = new BigDecimal(orderCrossCity.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN);//司机收入 |
| | | incomeService.saveData(1, orderCrossCity.getCompanyId(), 2, orderCrossCity.getId(), 3, d.doubleValue()); |
| | | incomeService.saveData(2, orderCrossCity.getDriverId(), 2, orderCrossCity.getId(), 3, c.doubleValue()); |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil cancleOrderCrossCity(Integer id, Integer payType, Integer cancleId, Integer type) throws Exception { |
| | | public ResultUtil cancleOrderCrossCity(Integer id, Integer payType, Integer cancleId, Integer type, Integer language) throws Exception { |
| | | OrderCrossCity orderCrossCity = this.selectById(id); |
| | | Integer uid = orderCrossCity.getUserId(); |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | |
| | | } |
| | | if(payType == 3){//余额支付 |
| | | if(userInfo.getBalance() != null && userInfo.getBalance() < query.getMoney()){ |
| | | return ResultUtil.error("余额不足,无法完成支付", ""); |
| | | return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient account balance" : "Solde de compte insuffisant"); |
| | | } |
| | | |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(query.getMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | |
| | | if(null == distance){ |
| | | System.err.println("查询距离出错了"); |
| | | }else{ |
| | | d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000)).setScale(2, BigDecimal.ROUND_HALF_EVEN).toString(); |
| | | t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60)).setScale(2, BigDecimal.ROUND_HALF_EVEN).intValue() + ""; |
| | | d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000), new MathContext(2, RoundingMode.HALF_EVEN)).toString(); |
| | | t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).intValue() + ""; |
| | | } |
| | | OrderServerWarpper orderServerWarpper = new OrderServerWarpper(); |
| | | orderServerWarpper.setOrderId(orderCrossCity.getId()); |
| | |
| | | if(null == distance){ |
| | | System.err.println("查询距离出错了"); |
| | | }else{ |
| | | d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000)).setScale(2, BigDecimal.ROUND_HALF_EVEN).toString(); |
| | | t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60)).setScale(2, BigDecimal.ROUND_HALF_EVEN).intValue() + ""; |
| | | d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000), new MathContext(2, RoundingMode.HALF_EVEN)).toString(); |
| | | t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).intValue() + ""; |
| | | } |
| | | orderServerWarpper.setReservationMileage("0"); |
| | | orderServerWarpper.setReservationTime("0"); |
| | |
| | | //定义用户所属公司 |
| | | OrderTaxi orderTaxi = new OrderTaxi(); |
| | | UserInfo userInfo1 = userInfoService.selectById(uid); |
| | | Company query = companyCityService.query(startLon, startLat); |
| | | Company query = companyCityService.query1(startLon, startLat); |
| | | if(null == query){ |
| | | return ResultUtil.error("出发点暂未开通"); |
| | | } |
| | |
| | | if(ToolUtil.isEmpty(userInfo.getPhone())){ |
| | | return ResultUtil.error("请先绑定手机号码"); |
| | | } |
| | | orderTaxi.setPassengers(userInfo.getName()); |
| | | orderTaxi.setPassengers(userInfo.getFirstName() + "." + userInfo.getLastName()); |
| | | orderTaxi.setPassengersPhone(userInfo.getPhone()); |
| | | } |
| | | orderTaxi.setState(1);//待接单 |
| | |
| | | if(ToolUtil.isEmpty(userInfo.getPhone())){ |
| | | return ResultUtil.error("请先绑定手机号码"); |
| | | } |
| | | orderPrivateCar.setPassengers(userInfo.getName()); |
| | | orderPrivateCar.setPassengers(userInfo.getFirstName() + "." + userInfo.getLastName()); |
| | | orderPrivateCar.setPassengersPhone(userInfo.getPhone()); |
| | | } |
| | | orderPrivateCar.setState(1); |
| | |
| | | if(orderType == 1){//专车 |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarMapper.selectById(orderId); |
| | | OrderPrivateCarServiceImpl.orderIds.add(orderPrivateCar.getId());//添加记录,防止调用接口重复提醒无人接单 |
| | | Company query = companyCityService.query(String.valueOf(orderPrivateCar.getStartLon()), String.valueOf(orderPrivateCar.getStartLat()));//获取起点所属分公司 |
| | | Company query = companyCityService.query1(String.valueOf(orderPrivateCar.getStartLon()), String.valueOf(orderPrivateCar.getStartLat()));//获取起点所属分公司 |
| | | List<PushOrder> querys = pushOrderService.querys(null, 1, query.getId());//获取需要推送的次数 |
| | | for(int i = 1; i <= querys.size(); i++){ |
| | | //订单被抢后的处理 |
| | |
| | | if(orderType == 2){//出租车 |
| | | OrderTaxi orderTaxi = orderTaxiMapper.selectById(orderId); |
| | | OrderTaxiServiceImpl.orderIds.add(orderTaxi.getId());//添加记录,防止调用接口重复提醒无人接单 |
| | | Company query = companyCityService.query(String.valueOf(orderTaxi.getStartLon()), String.valueOf(orderTaxi.getStartLat()));//获取起点所属分公司 |
| | | Company query = companyCityService.query1(String.valueOf(orderTaxi.getStartLon()), String.valueOf(orderTaxi.getStartLat()));//获取起点所属分公司 |
| | | List<PushOrder> querys = pushOrderService.querys(null, 2, query.getId());//获取需要推送的次数 |
| | | for(int i = 1; i <= querys.size(); i++){ |
| | | //处理订单被抢 |
| | |
| | | @ApiImplicitParam(value = "终点详细地址", name = "endAddress", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil queryLogisticsUnitPrice(Integer type, String startLonLat, String endAddress, HttpServletRequest request){ |
| | | public ResultUtil queryLogisticsUnitPrice(Integer type, String startLonLat, String endAddress, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return orderLogisticsService.queryLogisticsUnitPrice(type, startLonLat, endAddress, uid); |
| | | return orderLogisticsService.queryLogisticsUnitPrice(type, startLonLat, endAddress, uid, language); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | @ApiImplicitParam(value = "起点经纬度(103.23265,30.2312)", name = "startLonLat", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "终点详细地址", name = "endAddress", required = true, paramType = "query", dataType = "string") |
| | | }) |
| | | public ResultUtil queryPayMoney(Integer number, Integer type, String startLonLat, String endAddress){ |
| | | public ResultUtil queryPayMoney(Integer number, Integer type, String startLonLat, String endAddress, Integer language){ |
| | | try { |
| | | return orderLogisticsService.queryPayMoney(number, type, startLonLat, endAddress); |
| | | return orderLogisticsService.queryPayMoney(number, type, startLonLat, endAddress, language); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<BaseWarpper> smallLogistics(Integer type, Integer cargoType, Integer cargoNumber, String remark, String placementLon, String placementLat, String startLon, String startLat, String startAddress, |
| | | String recipient, String recipientPhone, String endAddress, Integer urgent, Double tipMoney, Date travelTime, Integer orderSource, HttpServletRequest request){ |
| | | String recipient, String recipientPhone, String endAddress, Integer urgent, Double tipMoney, Date travelTime, Integer orderSource, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return orderLogisticsService.smallLogistics(type, cargoType, cargoNumber, remark, placementLon, placementLat, startLon, startLat, startAddress, recipient, recipientPhone, endAddress, urgent, tipMoney, travelTime, orderSource, uid); |
| | | return orderLogisticsService.smallLogistics(type, cargoType, cargoNumber, remark, placementLon, placementLat, startLon, startLat, startAddress, |
| | | recipient, recipientPhone, endAddress, urgent, tipMoney, travelTime, orderSource, uid, language); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | @PostMapping("/api/orderLogistics/payOrderLogisticsSpread") |
| | | @ApiOperation(value = "小件物流补差价支付", tags = {"用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "支付方式(1=手机支付,2=银行卡支付,3=余额,4=现金)", name = "payType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "支付方式(1=线上支付,3=余额,4=现金)", name = "payType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "支付端(1=用户APP端,2=司机APP端,3=用户小程序端)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil payOrderLogisticsSpread(Integer orderId, Integer payType, Integer type, HttpServletRequest request){ |
| | | public ResultUtil payOrderLogisticsSpread(Integer orderId, Integer payType, Integer type, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | if(null == uid) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return orderLogisticsService.payLogisticsOrder_(payType, orderId, type); |
| | | return orderLogisticsService.payLogisticsOrder_(payType, "user_" + uid, orderId, type, language); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil queryLogisticsUnitPrice(Integer type, String startLonLat, String endAddress, Integer uid) throws Exception; |
| | | ResultUtil queryLogisticsUnitPrice(Integer type, String startLonLat, String endAddress, Integer uid, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil queryPayMoney(Integer number, Integer type, String startLonLat, String endAddress) throws Exception; |
| | | ResultUtil queryPayMoney(Integer number, Integer type, String startLonLat, String endAddress, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil smallLogistics(Integer type, Integer cargoType, Integer cargoNumber, String remark, String placementLon, String placementLat, String startLon, String startLat, String startAddress, |
| | | String recipient, String recipientPhone, String endAddress, Integer urgent, Double tipMoney, Date travelTime, Integer orderSource, Integer uid) throws Exception; |
| | | String recipient, String recipientPhone, String endAddress, Integer urgent, Double tipMoney, Date travelTime, Integer orderSource, Integer uid, Integer language) throws Exception; |
| | | |
| | | |
| | | |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil payLogisticsOrder(Integer payType, Integer orderId, Integer type)throws Exception; |
| | | ResultUtil payLogisticsOrder(Integer payType, String accountNumber, Integer orderId, Integer type, Integer language)throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil payLogisticsOrder_(Integer payType, Integer orderId, Integer type)throws Exception; |
| | | ResultUtil payLogisticsOrder_(Integer payType, String accountNumber, Integer orderId, Integer type, Integer language)throws Exception; |
| | | |
| | | |
| | | |
| | |
| | | * @param type 1=微信,2=支付宝 |
| | | * @throws Exception |
| | | */ |
| | | void payOrderLogisticsCallback(Integer id, String order_id, Integer type) throws Exception; |
| | | void payOrderLogisticsCallback(Integer id, String order_id, Integer type, Integer language) throws Exception; |
| | | |
| | | |
| | | |
| | |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogisticsSpread; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsSpreadService; |
| | | import com.stylefeng.guns.modular.system.dao.RegionMapper; |
| | | import com.stylefeng.guns.modular.system.dao.SensitiveWordsMapper; |
| | | import com.stylefeng.guns.modular.system.dao.SysIntegralMapper; |
| | | import com.stylefeng.guns.modular.system.dao.SystemPriceMapper; |
| | | import com.stylefeng.guns.modular.system.dao.*; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.*; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.TinggPayUtil; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.CheckoutRequest; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import com.stylefeng.guns.modular.taxi.model.PaymentRecord; |
| | | import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; |
| | | import com.stylefeng.guns.modular.taxi.service.ITransactionDetailsService; |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.nodes.Element; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | |
| | |
| | | @Autowired |
| | | private IUserCouponRecordService userCouponRecordService; |
| | | |
| | | @Resource |
| | | private CarMapper carMapper; |
| | | |
| | | @Autowired |
| | | private IOrderEvaluateService orderEvaluateService; |
| | | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath; |
| | | |
| | | @Value("${spring.mail.template-path}") |
| | | private String templatePath; |
| | | |
| | | private static List<Integer> orderIds = new ArrayList<>(); |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public ResultUtil judgingTheCity(String startLonLat, String endAddress) throws Exception { |
| | | Map<String, String> sgeocode = gdMapGeocodingUtil.geocode(startLonLat.split(",")[0], startLonLat.split(",")[1]); |
| | | String scityCode = sgeocode.get("cityCode"); |
| | | Map<String, Object> geocoding = gdMapGeocodingUtil.geocoding(endAddress); |
| | | if(Integer.valueOf(geocoding.get("status").toString()) != 0){ |
| | | return ResultUtil.error("收货地址有误,无法查询具体地址信息"); |
| | | } |
| | | List<String> list = (List<String>)geocoding.get("data"); |
| | | Map<String, String> egeocode = gdMapGeocodingUtil.geocode(list.get(0).split(",")[0], list.get(0).split(",")[1]); |
| | | String ecityCode = egeocode.get("cityCode"); |
| | | if(!scityCode.equals(ecityCode)){ |
| | | return ResultUtil.error("已超出服务范围,请重新选择跨城小件物流"); |
| | | } |
| | | // Map<String, String> sgeocode = gdMapGeocodingUtil.geocode(startLonLat.split(",")[0], startLonLat.split(",")[1]); |
| | | // String scityCode = sgeocode.get("cityCode"); |
| | | // Map<String, Object> geocoding = gdMapGeocodingUtil.geocoding(endAddress); |
| | | // if(Integer.valueOf(geocoding.get("status").toString()) != 0){ |
| | | // return ResultUtil.error("收货地址有误,无法查询具体地址信息"); |
| | | // } |
| | | // List<String> list = (List<String>)geocoding.get("data"); |
| | | // Map<String, String> egeocode = gdMapGeocodingUtil.geocode(list.get(0).split(",")[0], list.get(0).split(",")[1]); |
| | | // String ecityCode = egeocode.get("cityCode"); |
| | | // if(!scityCode.equals(ecityCode)){ |
| | | // return ResultUtil.error("已超出服务范围"); |
| | | // } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil queryLogisticsUnitPrice(Integer type, String startLonLat, String endAddress, Integer uid) throws Exception { |
| | | ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(Double.valueOf(startLonLat.split(",")[1]), Double.valueOf(startLonLat.split(",")[0])); |
| | | if(null == reverseGeocode){ |
| | | return ResultUtil.error("地理位置解析失败"); |
| | | public ResultUtil queryLogisticsUnitPrice(Integer type, String startLonLat, String endAddress, Integer uid, Integer language) throws Exception { |
| | | FindPlaceFromTextVo findplacefromtext = GoogleMapUtil.textsearch(endAddress); |
| | | if(null == findplacefromtext){ |
| | | return ResultUtil.error(language == 1 ? "收货地址有误,无法查询具体地址信息" : language == 2 ? "The delivery address is incorrect, and the specific address information cannot be queried" : "L’adresse de livraison est incorrecte, impossible de vérifier l’adresse spécifique"); |
| | | } |
| | | AddressComponentsVo[] addressComponentsVos = reverseGeocode.getAddressComponentsVos(); |
| | | String[] city = new String[addressComponentsVos.length]; |
| | | for (int i = 0; i < addressComponentsVos.length; i++) { |
| | | city[i] = addressComponentsVos[i].getLongName(); |
| | | Double lng = findplacefromtext.getLng(); |
| | | Double lat = findplacefromtext.getLat(); |
| | | ResultUtil<Map<String, Double>> price = this.getPrice1(type, startLonLat.split(",")[0], startLonLat.split(",")[1], lng.toString(), lat.toString(), language); |
| | | if(price.getCode() != 200){ |
| | | return price; |
| | | } |
| | | Company query = companyCityService.query(city); |
| | | if(null == query){ |
| | | return ResultUtil.error("预约取货点暂无企业服务"); |
| | | } |
| | | Double price1 = 0D; |
| | | Double price2 = 0D; |
| | | if(type == 4){//同城 |
| | | Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null); |
| | | if(null == query1){ |
| | | return ResultUtil.error("请先完善价格设定"); |
| | | } |
| | | String content = String.valueOf(query1.get("content")); |
| | | JSONObject jsonObject = JSON.parseObject(content); |
| | | price1 = jsonObject.getDouble("num2"); |
| | | price2 = jsonObject.getDouble("num13"); |
| | | }else{ |
| | | Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null); |
| | | if(null == query1){ |
| | | return ResultUtil.error("请先完善价格设定"); |
| | | } |
| | | String content = String.valueOf(query1.get("content")); |
| | | JSONObject jsonObject = JSON.parseObject(content); |
| | | price1 = jsonObject.getDouble("num1"); |
| | | price2 = jsonObject.getDouble("num2"); |
| | | } |
| | | int i = this.selectCount(new EntityWrapper<OrderLogistics>().eq("userId", uid).eq("isDelete", 1)); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("ordinary", price1); |
| | | map.put("precious", price2); |
| | | map.put("first", i); |
| | | return ResultUtil.success(map); |
| | | Integer i = this.selectCount(new EntityWrapper<OrderLogistics>().eq("userId", uid).eq("isDelete", 1)); |
| | | Map<String, Double> map = price.getData(); |
| | | map.put("first", i.doubleValue()); |
| | | return price; |
| | | } |
| | | |
| | | |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public ResultUtil queryPayMoney(Integer number, Integer type, String startLonLat, String endAddress) throws Exception{ |
| | | FindPlaceFromTextVo findplacefromtext = GoogleMapUtil.findplacefromtext(endAddress); |
| | | public ResultUtil queryPayMoney(Integer number, Integer type, String startLonLat, String endAddress, Integer language) throws Exception{ |
| | | FindPlaceFromTextVo findplacefromtext = GoogleMapUtil.textsearch(endAddress); |
| | | if(null == findplacefromtext){ |
| | | return ResultUtil.error("收货地址有误,无法查询具体地址信息"); |
| | | return ResultUtil.error(language == 1 ? "收货地址有误,无法查询具体地址信息" : language == 2 ? "The delivery address is incorrect, and the specific address information cannot be queried" : "L’adresse de livraison est incorrecte, impossible de vérifier l’adresse spécifique"); |
| | | } |
| | | Double lng = findplacefromtext.getLng(); |
| | | Double lat = findplacefromtext.getLat(); |
| | | ResultUtil<Map<String, Double>> price = this.getPrice1(type, startLonLat.split(",")[0], startLonLat.split(",")[1], lng.toString(), lat.toString()); |
| | | ResultUtil<Map<String, Double>> price = this.getPrice1(type, startLonLat.split(",")[0], startLonLat.split(",")[1], lng.toString(), lat.toString(), language); |
| | | if(price.getCode() == 200 && type == 5){ |
| | | Map<String, Double> data = price.getData(); |
| | | data.put("ordinary", data.get("ordinary") * number); |
| | |
| | | */ |
| | | @Override |
| | | public ResultUtil smallLogistics(Integer type, Integer cargoType, Integer cargoNumber, String remark, String placementLon, String placementLat, String startLon, String startLat, String startAddress, String recipient, |
| | | String recipientPhone, String endAddress, Integer urgent, Double tipMoney, Date travelTime, Integer orderSource, Integer uid) throws Exception { |
| | | String recipientPhone, String endAddress, Integer urgent, Double tipMoney, Date travelTime, Integer orderSource, Integer uid, Integer language) throws Exception { |
| | | startAddress = startAddress.replaceAll("& #40;", "("); |
| | | startAddress = startAddress.replaceAll("& #41;", ")"); |
| | | endAddress = endAddress.replaceAll("& #40;", "("); |
| | |
| | | OrderLogistics orderLogistics = new OrderLogistics(); |
| | | Company query = companyCityService.query1(placementLon, placementLat); |
| | | if(null == query){ |
| | | return ResultUtil.error("该地点暂无企业服务"); |
| | | return ResultUtil.error(language == 1 ? "该地点暂无企业服务" : language == 2 ? "No corporate services are available at this location" : "Aucun service d’entreprise n’est disponible pour cet emplacement"); |
| | | } |
| | | orderLogistics.setCompanyId(query.getId()); |
| | | orderLogistics.setType(type); |
| | |
| | | orderLogistics.setPlacementLat(Double.valueOf(placementLat)); |
| | | ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(Double.valueOf(placementLat), Double.valueOf(placementLon)); |
| | | if(null == reverseGeocode){ |
| | | return ResultUtil.error("解析地址出错"); |
| | | return ResultUtil.error(language == 1 ? "解析地址出错" : language == 2 ? "Resolve address error" : "Erreur dans la résolution de l’adresse"); |
| | | } |
| | | |
| | | String address = reverseGeocode.getAddress(); |
| | |
| | | orderLogistics.setStartLon(Double.valueOf(startLon)); |
| | | orderLogistics.setStartLat(Double.valueOf(startLat)); |
| | | orderLogistics.setStartAddress(startAddress); |
| | | FindPlaceFromTextVo findplacefromtext = GoogleMapUtil.findplacefromtext(endAddress); |
| | | FindPlaceFromTextVo findplacefromtext = GoogleMapUtil.textsearch(endAddress); |
| | | if(null == findplacefromtext){ |
| | | return ResultUtil.error("收货地址有误,无法查询具体地址信息"); |
| | | return ResultUtil.error(language == 1 ? "收货地址有误,无法查询具体地址信息" : language == 2 ? "The delivery address is incorrect, and the specific address information cannot be queried" : "L’adresse de livraison est incorrecte, impossible de vérifier l’adresse spécifique"); |
| | | } |
| | | Double lng = findplacefromtext.getLng(); |
| | | Double lat = findplacefromtext.getLat(); |
| | |
| | | orderLogistics.setMileage(0D); |
| | | orderLogistics.setIsReassign(1); |
| | | orderLogistics.setReassignNotice(0); |
| | | ResultUtil<Map<String, Double>> price = this.getPrice1(type, String.valueOf(startLon), String.valueOf(startLat), lng.toString(), lat.toString()); |
| | | ResultUtil<Map<String, Double>> price = this.getPrice1(type, String.valueOf(startLon), String.valueOf(startLat), lng.toString(), lat.toString(), language); |
| | | if(price.getCode() != 200){ |
| | | return price; |
| | | } |
| | |
| | | orderLogistics.setTipMoney(tipMoney); |
| | | orderLogistics.setState(7);//待支付 |
| | | orderLogistics.setInsertTime(new Date()); |
| | | orderLogistics.setTravelTime(travelTime); |
| | | orderLogistics.setTravelTime(null == travelTime ? new Date() : travelTime); |
| | | orderLogistics.setOrderSource(orderSource); |
| | | orderLogistics.setIsDelete(1); |
| | | this.insert(orderLogistics); |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, "您的"+ (type == 4 ? "同城" : "跨城") + "小件物流订单已下单成功,我们正在为您指派司机,请稍后!", orderLogistics.getUserId(), 1); |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您的市内小件物流订单已下单成功,我们正在为您指派司机,请稍后!" : |
| | | language == 2 ? "Your local small parts logistics order has been successfully placed, we are assigning you a driver, please wait!" : "Votre commande de city small pieces logistics a été passée avec succès. Nous vous assignons un chauffeur. Plus tard!", orderLogistics.getUserId(), 1); |
| | | |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | baseWarpper.setId(orderLogistics.getId()); |
| | |
| | | * @throws Exception |
| | | */ |
| | | public ResultUtil<Map<String, Double>> getPrice(Integer type, String startLon, String startLat, String endLon, String endLat) throws Exception{ |
| | | Company query = companyCityService.query(startLon, startLat); |
| | | Company query = companyCityService.query1(startLon, startLat); |
| | | if(null == query){ |
| | | return ResultUtil.error("预约取货点暂无企业服务"); |
| | | } |
| | |
| | | if(dist.compareTo(0D) >= 0 && dist.compareTo(jsonObject.getDouble("num1")) < 0){ |
| | | price1 = jsonObject.getDouble("num2"); |
| | | } |
| | | if(dist.compareTo(0D) >= 0 && dist.compareTo(jsonObject.getDouble("num12")) < 0){ |
| | | price2 = jsonObject.getDouble("num13"); |
| | | } |
| | | |
| | | if(dist.compareTo(jsonObject.getDouble("num3")) >= 0 && dist.compareTo(jsonObject.getDouble("num4")) < 0){ |
| | | price1 = jsonObject.getDouble("num5"); |
| | | } |
| | | if(dist.compareTo(jsonObject.getDouble("num14")) >= 0 && dist.compareTo(jsonObject.getDouble("num15")) < 0){ |
| | | price2 = jsonObject.getDouble("num16"); |
| | | } |
| | | |
| | | if(dist.compareTo(jsonObject.getDouble("num6")) >= 0 && dist.compareTo(jsonObject.getDouble("num7")) < 0){ |
| | | price1 = jsonObject.getDouble("num8"); |
| | | } |
| | | if(dist.compareTo(jsonObject.getDouble("num17")) >= 0 && dist.compareTo(jsonObject.getDouble("num18")) < 0){ |
| | | price2 = jsonObject.getDouble("num19"); |
| | | } |
| | | |
| | | if(dist.compareTo(jsonObject.getDouble("num9")) >= 0 && dist.compareTo(jsonObject.getDouble("num10")) < 0){ |
| | | price1 = jsonObject.getDouble("num11"); |
| | | } |
| | | if(dist.compareTo(jsonObject.getDouble("num20")) >= 0 && dist.compareTo(jsonObject.getDouble("num21")) < 0){ |
| | | price2 = jsonObject.getDouble("num22"); |
| | | } |
| | | }else{ |
| | | Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null); |
| | |
| | | |
| | | |
| | | |
| | | public ResultUtil<Map<String, Double>> getPrice1(Integer type, String startLon, String startLat, String endLon, String endLat) throws Exception{ |
| | | public ResultUtil<Map<String, Double>> getPrice1(Integer type, String startLon, String startLat, String endLon, String endLat, Integer language) throws Exception{ |
| | | Company query = companyCityService.query1(startLon, startLat); |
| | | if(null == query){ |
| | | return ResultUtil.error("预约取货点暂无企业服务"); |
| | | return ResultUtil.error(language == 1 ? "预约取货点暂无企业服务" : language == 2 ? |
| | | "There is no enterprise service at the reservation pickup point" : "Prise de rendez-vous point de collecte pas encore disponible pour les entreprises"); |
| | | } |
| | | Double price1 = 0D; |
| | | Double price2 = 0D; |
| | |
| | | Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(Double.valueOf(startLat), Double.valueOf(startLon), Double.valueOf(endLat), Double.valueOf(endLon)); |
| | | if(null == distancematrix){ |
| | | return ResultUtil.error("计算距离出错"); |
| | | return ResultUtil.error(language == 1 ? "计算距离出错" : language == 2 ? "Error in distance calculation" : "Erreur de calcul des distances"); |
| | | } |
| | | if(distancematrix.getDistance() == 0){ |
| | | return ResultUtil.error(language == 1 ? "未获取到有效的距离" : language == 2 ? "A valid distance was not obtained" : "La distance effective n’est pas acquise"); |
| | | } |
| | | String content = String.valueOf(query1.get("content")); |
| | | JSONObject jsonObject = JSON.parseObject(content); |
| | |
| | | if(dist.compareTo(0D) >= 0 && dist.compareTo(jsonObject.getDouble("num1")) < 0){ |
| | | price1 = jsonObject.getDouble("num2"); |
| | | } |
| | | if(dist.compareTo(0D) >= 0 && dist.compareTo(jsonObject.getDouble("num12")) < 0){ |
| | | price2 = jsonObject.getDouble("num13"); |
| | | } |
| | | |
| | | if(dist.compareTo(jsonObject.getDouble("num3")) >= 0 && dist.compareTo(jsonObject.getDouble("num4")) < 0){ |
| | | price1 = jsonObject.getDouble("num5"); |
| | | } |
| | | if(dist.compareTo(jsonObject.getDouble("num14")) >= 0 && dist.compareTo(jsonObject.getDouble("num15")) < 0){ |
| | | price2 = jsonObject.getDouble("num16"); |
| | | } |
| | | |
| | | if(dist.compareTo(jsonObject.getDouble("num6")) >= 0 && dist.compareTo(jsonObject.getDouble("num7")) < 0){ |
| | | price1 = jsonObject.getDouble("num8"); |
| | | } |
| | | if(dist.compareTo(jsonObject.getDouble("num17")) >= 0 && dist.compareTo(jsonObject.getDouble("num18")) < 0){ |
| | | price2 = jsonObject.getDouble("num19"); |
| | | } |
| | | |
| | | if(dist.compareTo(jsonObject.getDouble("num9")) >= 0 && dist.compareTo(jsonObject.getDouble("num10")) < 0){ |
| | | price1 = jsonObject.getDouble("num11"); |
| | | } |
| | | if(dist.compareTo(jsonObject.getDouble("num20")) >= 0 && dist.compareTo(jsonObject.getDouble("num21")) < 0){ |
| | | price2 = jsonObject.getDouble("num22"); |
| | | if(dist.compareTo(jsonObject.getDouble("num10")) > 0){ |
| | | return ResultUtil.error(language == 1 ? "超出可服务范围" : language == 2 ? "Out of service range" : "Au-delà du service disponible"); |
| | | } |
| | | }else{ |
| | | Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null); |
| | |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | integers = JSON.parseArray(vehicle).toJavaList(Integer.class); |
| | | } |
| | | Company query = companyCityService.query(String.valueOf(orderLogistics.getStartLon()), String.valueOf(orderLogistics.getStartLat()));//获取起点所属分公司 |
| | | Company query = companyCityService.query1(String.valueOf(orderLogistics.getStartLon()), String.valueOf(orderLogistics.getStartLat()));//获取起点所属分公司 |
| | | List<PushOrder> querys = pushOrderService.querys(null, 1, query.getId());//用专车的推单配置 |
| | | for(int i = 1; i <= querys.size(); i++){ |
| | | PushOrder pushOrder = pushOrderService.querys(i, 1, query.getId()).get(0); |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil payLogisticsOrder(Integer payType, Integer orderId, Integer type) throws Exception { |
| | | public ResultUtil payLogisticsOrder(Integer payType, String accountNumber, Integer orderId, Integer type, Integer language) throws Exception { |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | if(orderLogistics.getState() != 7){ |
| | | return ResultUtil.error("订单已完成支付,不允许重复支付", ""); |
| | | return ResultUtil.error("订单已完成支付,不允许重复支付"); |
| | | } |
| | | Integer uid = orderLogistics.getUserId(); |
| | | Double orderMoney = orderLogistics.getOrderMoney(); |
| | |
| | | orderMoney += null != orderLogistics.getTipMoney() ? orderLogistics.getTipMoney() : 0; |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | ResultUtil resultUtil = ResultUtil.success(new HashMap<>()); |
| | | ResultUtil resultUtil = ResultUtil.success(); |
| | | |
| | | if(payType == 1){//手机支付 |
| | | return payMoneyUtil.weixinpay("小件物流下单支付",orderId +"",orderId + "_" + orderLogistics.getType(),orderMoney+"","/base/wxPayOrderTaxi","JSAPI",userInfo.getAppletsOpenId()); |
| | | /* icbcPayUtil.placeAnOrder(orderId + "," + orderLogistics.getType(), 9, 5, uid.toString(), |
| | | "小件物流下单支付", orderMoney, callbackPath + "/base/wxPayOrderTaxi", "", |
| | | type, userInfo.getAppletsOpenId());*/ |
| | | /*if(map.get("code").equals("200")){ |
| | | paymentRecordService.saveData(1, null, null, orderId, orderLogistics.getType(), 1, orderMoney, map.get("order_id"), 1);//添加预支付数据 |
| | | resultUtil = ResultUtil.success(map.get("data")); |
| | | }else{ |
| | | resultUtil = ResultUtil.error(map.get("msg"), ""); |
| | | }*/ |
| | | if(payType == 1) {//手机支付 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String merchantTransactionId = sdf.format(new Date()) + "4" + language + orderId; |
| | | CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | checkoutRequest.setMsisdn(Long.valueOf(userInfo.getPhone())); |
| | | checkoutRequest.setCustomerEmail(userInfo.getEmail()); |
| | | checkoutRequest.setAccountNumber(accountNumber); |
| | | checkoutRequest.setCustomerFirstName(userInfo.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(userInfo.getLastName()); |
| | | checkoutRequest.setRequestAmount(orderMoney); |
| | | checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | checkoutRequest.setRequestDescription("Travel completion payment"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderTaxi"); |
| | | checkoutRequest.setPendingRedirectUrl(""); |
| | | checkoutRequest.setSuccessRedirectUrl("https://10pz685243.zicp.fun"); |
| | | checkoutRequest.setFailRedirectUrl("https://www.baidu.com"); |
| | | return TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | } |
| | | if(payType == 2){//银行卡支付 |
| | | return payMoneyUtil.alipay("小件物流下单支付","小件物流下单支付",orderId + "," + orderLogistics.getType(),orderMoney+"","/base/aliPayOrderTaxi"); |
| | | /* Map<String, String> map = icbcPayUtil.placeAnOrder(orderId + "," + orderLogistics.getType(), 10, 5, uid.toString(), "小件物流下单支付", orderMoney, callbackPath + "/base/aliPayOrderTaxi", "", type, null); |
| | | if(map.get("code").equals("200")){ |
| | | paymentRecordService.saveData(1, null, null, orderId, orderLogistics.getType(), 2, orderMoney, map.get("order_id"), 1);//添加预支付数据 |
| | | resultUtil = ResultUtil.success(map.get("data")); |
| | | }else{ |
| | | resultUtil = ResultUtil.error(map.get("msg"), ""); |
| | | }*/ |
| | | } |
| | | |
| | | if(payType == 3){//余额支付 |
| | | if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){ |
| | | return ResultUtil.error("余额不足,无法完成支付", ""); |
| | | return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient account balance" : "Solde de compte insuffisant"); |
| | | } |
| | | |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | |
| | | orderLogistics.setPayType(3); |
| | | orderLogistics.setPayMoney(orderMoney); |
| | | |
| | | |
| | | |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/receiptLogistics.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy年MM月dd日"); |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/MM/dd HH:mm"); |
| | | if(1 == language){ |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element title_chinese = document.getElementById("title_chinese"); |
| | | title_chinese.text(sdf2.format(orderLogistics.getTravelTime()) + ",您在I-GO1个订单消费GHS " + orderLogistics.getPayMoney()); |
| | | Element xcf_chinese = document.getElementById("xcf_chinese"); |
| | | xcf_chinese.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element xj_chinese = document.getElementById("xj_chinese"); |
| | | xj_chinese.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element pay_type_chinese = document.getElementById("pay_type_chinese"); |
| | | pay_type_chinese.text("余额"); |
| | | Element pay_money_chinese = document.getElementById("pay_money_chinese"); |
| | | pay_money_chinese.text("GHS " + orderLogistics.getPayMoney()); |
| | | Element pay_time_chinese = document.getElementById("pay_time_chinese"); |
| | | pay_time_chinese.text(sdf1.format(orderLogistics.getTravelTime())); |
| | | Element start_address_chinese = document.getElementById("start_address_chinese"); |
| | | start_address_chinese.text(orderLogistics.getStartAddress()); |
| | | Element end_address_chinese = document.getElementById("end_address_chinese"); |
| | | end_address_chinese.text(orderLogistics.getEndAddress()); |
| | | } |
| | | if(2 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element title_english = document.getElementById("title_english"); |
| | | title_english.text(sdf2.format(orderLogistics.getTravelTime()) + ",You spent GHS " + orderLogistics.getPayMoney() + " on the trip "); |
| | | Element xcf_english = document.getElementById("xcf_english"); |
| | | xcf_english.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element xj_english = document.getElementById("xj_english"); |
| | | xj_english.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element pay_type_english = document.getElementById("pay_type_english"); |
| | | pay_type_english.text("balance"); |
| | | Element pay_money_english = document.getElementById("pay_money_english"); |
| | | pay_money_english.text("GHS " + orderLogistics.getPayMoney()); |
| | | Element pay_time_english = document.getElementById("pay_time_english"); |
| | | pay_time_english.text(sdf1.format(orderLogistics.getTravelTime())); |
| | | Element start_address_english = document.getElementById("start_address_english"); |
| | | start_address_english.text(orderLogistics.getStartAddress()); |
| | | Element end_address_english = document.getElementById("end_address_english"); |
| | | end_address_english.text(orderLogistics.getEndAddress()); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | Element title_french = document.getElementById("title_french"); |
| | | title_french.text(sdf2.format(orderLogistics.getTravelTime()) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande i-go1 le "); |
| | | Element xcf_french = document.getElementById("xcf_french"); |
| | | xcf_french.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element xj_french = document.getElementById("xj_french"); |
| | | xj_french.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element pay_type_french = document.getElementById("pay_type_french"); |
| | | pay_type_french.text("Le solde"); |
| | | Element pay_money_french = document.getElementById("pay_money_french"); |
| | | pay_money_french.text("GHS " + orderLogistics.getPayMoney()); |
| | | Element pay_time_french = document.getElementById("pay_time_french"); |
| | | pay_time_french.text(sdf1.format(orderLogistics.getTravelTime())); |
| | | Element start_address_french = document.getElementById("start_address_french"); |
| | | start_address_french.text(orderLogistics.getStartAddress()); |
| | | Element end_address_french = document.getElementById("end_address_french"); |
| | | end_address_french.text(orderLogistics.getEndAddress()); |
| | | } |
| | | |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "市内小件物流收据" : language == 2 ? "Reset password" : "Réinitialiser le mot de passe", document.html()); |
| | | } |
| | | |
| | | // TODO: 2020/5/24 这里需要给司机和用户推送订单状态 |
| | | new Thread(new Runnable() { |
| | | @Override |
| | |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0); |
| | | } |
| | | }).start(); |
| | | |
| | | systemNoticeService.addSystemNotice(1, "您已使用余额成功完成小件物流订单支付,谢谢使用!", uid, 1); |
| | | |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已使用余额成功完成小件物流订单支付,谢谢使用!" : language == 2 |
| | | ? "You have successfully used the balance to complete the small logistics order payment, thank you for using!" |
| | | : "Vous avez utilisé le solde pour compléter avec succès le paiement de la commande logistique de petites pièces. Merci d’utiliser!", uid, 1); |
| | | this.pushOrder(orderLogistics);//推单 |
| | | } |
| | | |
| | |
| | | orderLogistics.setPayType(4); |
| | | orderLogistics.setPayMoney(orderMoney); |
| | | |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/receiptLogistics.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy年MM月dd日"); |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/MM/dd HH:mm"); |
| | | if(1 == language){ |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element title_chinese = document.getElementById("title_chinese"); |
| | | title_chinese.text(sdf2.format(orderLogistics.getTravelTime()) + ",您在I-GO1个订单消费GHS " + orderLogistics.getPayMoney()); |
| | | Element xcf_chinese = document.getElementById("xcf_chinese"); |
| | | xcf_chinese.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element xj_chinese = document.getElementById("xj_chinese"); |
| | | xj_chinese.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element pay_type_chinese = document.getElementById("pay_type_chinese"); |
| | | pay_type_chinese.text("现金"); |
| | | Element pay_money_chinese = document.getElementById("pay_money_chinese"); |
| | | pay_money_chinese.text("GHS " + orderLogistics.getPayMoney()); |
| | | Element pay_time_chinese = document.getElementById("pay_time_chinese"); |
| | | pay_time_chinese.text(sdf1.format(orderLogistics.getTravelTime())); |
| | | Element start_address_chinese = document.getElementById("start_address_chinese"); |
| | | start_address_chinese.text(orderLogistics.getStartAddress()); |
| | | Element end_address_chinese = document.getElementById("end_address_chinese"); |
| | | end_address_chinese.text(orderLogistics.getEndAddress()); |
| | | } |
| | | if(2 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element title_english = document.getElementById("title_english"); |
| | | title_english.text(sdf2.format(orderLogistics.getTravelTime()) + ",You spent GHS " + orderLogistics.getPayMoney() + " on the trip "); |
| | | Element xcf_english = document.getElementById("xcf_english"); |
| | | xcf_english.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element xj_english = document.getElementById("xj_english"); |
| | | xj_english.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element pay_type_english = document.getElementById("pay_type_english"); |
| | | pay_type_english.text("cash"); |
| | | Element pay_money_english = document.getElementById("pay_money_english"); |
| | | pay_money_english.text("GHS " + orderLogistics.getPayMoney()); |
| | | Element pay_time_english = document.getElementById("pay_time_english"); |
| | | pay_time_english.text(sdf1.format(orderLogistics.getTravelTime())); |
| | | Element start_address_english = document.getElementById("start_address_english"); |
| | | start_address_english.text(orderLogistics.getStartAddress()); |
| | | Element end_address_english = document.getElementById("end_address_english"); |
| | | end_address_english.text(orderLogistics.getEndAddress()); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | Element title_french = document.getElementById("title_french"); |
| | | title_french.text(sdf2.format(orderLogistics.getTravelTime()) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande i-go1 le "); |
| | | Element xcf_french = document.getElementById("xcf_french"); |
| | | xcf_french.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element xj_french = document.getElementById("xj_french"); |
| | | xj_french.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element pay_type_french = document.getElementById("pay_type_french"); |
| | | pay_type_french.text("espèces"); |
| | | Element pay_money_french = document.getElementById("pay_money_french"); |
| | | pay_money_french.text("GHS " + orderLogistics.getPayMoney()); |
| | | Element pay_time_french = document.getElementById("pay_time_french"); |
| | | pay_time_french.text(sdf1.format(orderLogistics.getTravelTime())); |
| | | Element start_address_french = document.getElementById("start_address_french"); |
| | | start_address_french.text(orderLogistics.getStartAddress()); |
| | | Element end_address_french = document.getElementById("end_address_french"); |
| | | end_address_french.text(orderLogistics.getEndAddress()); |
| | | } |
| | | |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "市内小件物流收据" : language == 2 ? "Reset password" : "Réinitialiser le mot de passe", document.html()); |
| | | } |
| | | |
| | | |
| | | // TODO: 2020/5/24 这里需要给司机和用户推送订单状态 |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0); |
| | | pushUtil.pushOfflinePayment(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4); |
| | | } |
| | | }).start(); |
| | | |
| | | systemNoticeService.addSystemNotice(1, "您已使用现金成功完成小件物流订单支付,谢谢使用!", uid, 1); |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已使用现金成功完成小件物流订单支付,谢谢使用!" : language == 2 |
| | | ? "You have successfully completed the payment of small logistics order with cash, thank you for using!" : |
| | | "Vous avez utilisé de l’argent pour compléter avec succès le paiement de la commande small pieces logistics. Merci d’utiliser!", uid, 1); |
| | | |
| | | this.pushOrder(orderLogistics);//推单 |
| | | } |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil payLogisticsOrder_(Integer payType, Integer orderId, Integer type) throws Exception { |
| | | public ResultUtil payLogisticsOrder_(Integer payType, String accountNumber, Integer orderId, Integer type, Integer language) throws Exception { |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | Integer uid = orderLogistics.getUserId(); |
| | | OrderLogisticsSpread orderLogisticsSpread = orderLogisticsSpreadService.selectOne(new EntityWrapper<OrderLogisticsSpread>().eq("orderLogisticsId", orderId)); |
| | | Double orderMoney = orderLogisticsSpread.getPrice(); |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | ResultUtil resultUtil = ResultUtil.success(""); |
| | | if(payType == 1){//手机支付 |
| | | return payMoneyUtil.weixinpay("小件物流下单支付",orderId +"",orderId + "_" + orderLogistics.getType(),orderMoney+"","/base/wxPayOrderTaxi","JSAPI",userInfo.getAppletsOpenId()); |
| | | } |
| | | if(payType == 2){//银行卡支付 |
| | | return payMoneyUtil.alipay("小件物流下单支付","小件物流下单支付",orderId + "," + orderLogistics.getType(),orderMoney+"","/base/aliPayOrderTaxi"); |
| | | if(payType == 1){//线上支付 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String merchantTransactionId = sdf.format(new Date()) + "4" + language + orderId; |
| | | CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | checkoutRequest.setMsisdn(Long.valueOf(userInfo.getPhone())); |
| | | checkoutRequest.setCustomerEmail(userInfo.getEmail()); |
| | | checkoutRequest.setAccountNumber(accountNumber); |
| | | checkoutRequest.setCustomerFirstName(userInfo.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(userInfo.getLastName()); |
| | | checkoutRequest.setRequestAmount(orderMoney); |
| | | checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | checkoutRequest.setRequestDescription("Travel completion payment"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderTaxi"); |
| | | checkoutRequest.setPendingRedirectUrl(""); |
| | | checkoutRequest.setSuccessRedirectUrl("https://10pz685243.zicp.fun"); |
| | | checkoutRequest.setFailRedirectUrl("https://www.baidu.com"); |
| | | return TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | |
| | | |
| | | } |
| | | if(payType == 3){//余额支付 |
| | | if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){ |
| | | return ResultUtil.error("余额不足,无法完成支付", ""); |
| | | return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient account balance" : "Solde de compte insuffisant"); |
| | | } |
| | | |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | |
| | | c = new BigDecimal(orderMoney).subtract(d); |
| | | } |
| | | if(company.getIsSpeFixedOrProportional() == 1){//比例 |
| | | d = new BigDecimal(orderMoney).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | d = new BigDecimal(orderMoney).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))); |
| | | c = new BigDecimal(orderMoney).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | |
| | | Income income = incomeService.selectOne(new EntityWrapper<Income>().eq("userType", 1).eq("objectId", orderLogistics.getCompanyId()).eq("type", 2).eq("incomeId", orderLogistics.getId()).eq("orderType", orderLogistics.getType())); |
| | | income.setMoney(income.getMoney() + d.doubleValue()); |
| | | incomeService.updateById(income); |
| | | income = incomeService.selectOne(new EntityWrapper<Income>().eq("userType", 2).eq("objectId", orderLogistics.getCompanyId()).eq("type", 2).eq("incomeId", orderLogistics.getId()).eq("orderType", orderLogistics.getType())); |
| | | income = incomeService.selectOne(new EntityWrapper<Income>().eq("userType", 2).eq("objectId", orderLogistics.getDriverId()).eq("type", 2).eq("incomeId", orderLogistics.getId()).eq("orderType", orderLogistics.getType())); |
| | | income.setMoney(income.getMoney() + c.doubleValue()); |
| | | incomeService.updateById(income); |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | |
| | | } |
| | | }).start(); |
| | | |
| | | systemNoticeService.addSystemNotice(1, "您已使用余额成功完成小件物流订单差价支付,谢谢使用!", uid, 1); |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已使用余额成功完成小件物流订单差价支付,谢谢使用!" : language == 2 |
| | | ? "You have successfully completed the price difference payment of small logistics order with the balance, thank you for using!" |
| | | : "Vous avez utilisé le solde pour compléter avec succès le paiement de la différence de prix de la commande de petites pièces logistiques. Merci d’utiliser!", uid, 1); |
| | | } |
| | | |
| | | if(payType == 4){//现金支付 |
| | | if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){ |
| | | return ResultUtil.error("余额不足,无法完成支付", ""); |
| | | } |
| | | |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | |
| | | SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId()); |
| | | userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分 |
| | | |
| | |
| | | c = new BigDecimal(orderMoney).subtract(d); |
| | | } |
| | | if(company.getIsSpeFixedOrProportional() == 1){//比例 |
| | | d = new BigDecimal(orderMoney).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | d = new BigDecimal(orderMoney).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))); |
| | | c = new BigDecimal(orderMoney).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | |
| | |
| | | } |
| | | }).start(); |
| | | |
| | | systemNoticeService.addSystemNotice(1, "您已使用现金成功完成小件物流订单差价支付,谢谢使用!", uid, 1); |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已使用现金成功完成小件物流订单差价支付,谢谢使用!" : language == 2 |
| | | ? "You have successfully completed the price difference payment of small logistics order with cash, thank you for using!" |
| | | : "Vous avez utilisé de l’argent pour compléter avec succès le paiement de la différence de prix de la commande de petites pièces logistiques. Merci d’utiliser!", uid, 1); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | @Override |
| | | public void payOrderLogisticsCallback(Integer id, String order_id, Integer type) throws Exception { |
| | | public void payOrderLogisticsCallback(Integer id, String order_id, Integer type, Integer language) throws Exception { |
| | | OrderLogistics orderLogistics = this.selectById(id); |
| | | PaymentRecord query = paymentRecordService.query(1, null, null, Integer.valueOf(id), orderLogistics.getType(), type, 1); |
| | | if(null != query){ |
| | |
| | | query.setState(2); |
| | | query.setCode(order_id); |
| | | paymentRecordService.updateById(query); |
| | | |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/receiptLogistics.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日"); |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/MM/dd HH:mm"); |
| | | if(1 == language){ |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element title_chinese = document.getElementById("title_chinese"); |
| | | title_chinese.text(sdf.format(orderLogistics.getTravelTime()) + ",您在I-GO1个订单消费GHS " + orderLogistics.getPayMoney()); |
| | | Element xcf_chinese = document.getElementById("xcf_chinese"); |
| | | xcf_chinese.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element xj_chinese = document.getElementById("xj_chinese"); |
| | | xj_chinese.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element pay_type_chinese = document.getElementById("pay_type_chinese"); |
| | | pay_type_chinese.text("余额"); |
| | | Element pay_money_chinese = document.getElementById("pay_money_chinese"); |
| | | pay_money_chinese.text("GHS " + orderLogistics.getPayMoney()); |
| | | Element pay_time_chinese = document.getElementById("pay_time_chinese"); |
| | | pay_time_chinese.text(sdf1.format(orderLogistics.getTravelTime())); |
| | | Element start_address_chinese = document.getElementById("start_address_chinese"); |
| | | start_address_chinese.text(orderLogistics.getStartAddress()); |
| | | Element end_address_chinese = document.getElementById("end_address_chinese"); |
| | | end_address_chinese.text(orderLogistics.getEndAddress()); |
| | | } |
| | | if(2 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element title_english = document.getElementById("title_english"); |
| | | title_english.text(sdf.format(orderLogistics.getTravelTime()) + ",You spent GHS " + orderLogistics.getPayMoney() + " on the trip "); |
| | | Element xcf_english = document.getElementById("xcf_english"); |
| | | xcf_english.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element xj_english = document.getElementById("xj_english"); |
| | | xj_english.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element pay_type_english = document.getElementById("pay_type_english"); |
| | | pay_type_english.text("balance"); |
| | | Element pay_money_english = document.getElementById("pay_money_english"); |
| | | pay_money_english.text("GHS " + orderLogistics.getPayMoney()); |
| | | Element pay_time_english = document.getElementById("pay_time_english"); |
| | | pay_time_english.text(sdf1.format(orderLogistics.getTravelTime())); |
| | | Element start_address_english = document.getElementById("start_address_english"); |
| | | start_address_english.text(orderLogistics.getStartAddress()); |
| | | Element end_address_english = document.getElementById("end_address_english"); |
| | | end_address_english.text(orderLogistics.getEndAddress()); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | Element title_french = document.getElementById("title_french"); |
| | | title_french.text(sdf.format(orderLogistics.getTravelTime()) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande i-go1 le "); |
| | | Element xcf_french = document.getElementById("xcf_french"); |
| | | xcf_french.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element xj_french = document.getElementById("xj_french"); |
| | | xj_french.text("GHS " + orderLogistics.getOrderMoney()); |
| | | Element pay_type_french = document.getElementById("pay_type_french"); |
| | | pay_type_french.text("Le solde"); |
| | | Element pay_money_french = document.getElementById("pay_money_french"); |
| | | pay_money_french.text("GHS " + orderLogistics.getPayMoney()); |
| | | Element pay_time_french = document.getElementById("pay_time_french"); |
| | | pay_time_french.text(sdf1.format(orderLogistics.getTravelTime())); |
| | | Element start_address_french = document.getElementById("start_address_french"); |
| | | start_address_french.text(orderLogistics.getStartAddress()); |
| | | Element end_address_french = document.getElementById("end_address_french"); |
| | | end_address_french.text(orderLogistics.getEndAddress()); |
| | | } |
| | | |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "市内小件物流收据" : language == 2 ? "Reset password" : "Réinitialiser le mot de passe", document.html()); |
| | | } |
| | | |
| | | |
| | | |
| | | // TODO: 2020/5/24 这里需要给司机和用户推送订单状态 |
| | | new Thread(new Runnable() { |
| | |
| | | c = new BigDecimal(query.getAmount()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | if(company.getIsSpeFixedOrProportional() == 1){//比例 |
| | | d = new BigDecimal(query.getAmount()).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | d = new BigDecimal(query.getAmount()).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))); |
| | | c = new BigDecimal(query.getAmount()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | Income income = incomeService.selectOne(new EntityWrapper<Income>().eq("userType", 1).eq("objectId", orderLogistics.getCompanyId()).eq("type", 2).eq("incomeId", orderLogistics.getId()).eq("orderType", orderLogistics.getType())); |
| | |
| | | }) |
| | | public ResultUtil<BaseWarpper> saveOrderPrivateCar(Integer serverCarModelId, Date travelTime, Integer orderType, Integer substitute, String placementLon, String placementLat, String startLon, String startLat, |
| | | String startAddress, String endLon, String endLat, String endAddress, String passengers, String passengersPhone, Integer orderSource, Integer driverId, |
| | | Integer type, HttpServletRequest request){ |
| | | Integer type, Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return orderPrivateCarService.saveOrderPrivateCar(serverCarModelId, travelTime, orderType, substitute, placementLon, placementLat, |
| | | startLon, startLat, startAddress, endLon, endLat, endAddress, passengers, passengersPhone, orderSource, driverId, type, uid); |
| | | startLon, startLat, startAddress, endLon, endLat, endAddress, passengers, passengersPhone, orderSource, driverId, type, uid, language); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | a.type as type, |
| | | a.state as state, |
| | | DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as insertTime, |
| | | DATE_FORMAT(a.travelTime, '%m月%d日 %H:%i') as travelTime, |
| | | DATE_FORMAT(a.travelTime, '%m-%d %H:%i') as travelTime, |
| | | DATE_FORMAT(a.travelTime, '%Y-%m-%d %H:%i:%s') as travelTime1, |
| | | DATE_FORMAT(a.arriveTime, '%Y-%m-%d %H:%i:%s') as arriveTime, |
| | | a.startLon as startLon, |
| | |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil<BaseWarpper> saveOrderPrivateCar(Integer serverCarModelId, Date travelTime, Integer reservation, Integer instead, String placementLon, String placementLat, |
| | | String startLon, String startLat, String startAddress, String endLon, String endLat, String endAddress, String name, String phone, Integer orderSource, Integer driverId, Integer type, Integer uid) throws Exception; |
| | | String startLon, String startLat, String startAddress, String endLon, String endLat, String endAddress, String name, |
| | | String phone, Integer orderSource, Integer driverId, Integer type, Integer uid, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil cancleOrderPrivateCar(Integer id, Integer payType, Integer cancleId, Integer type) throws Exception; |
| | | ResultUtil cancleOrderPrivateCar(Integer id, Integer payType, String accountNumber, Integer cancleId, Integer type, Integer language) throws Exception; |
| | | |
| | | |
| | | String getOrderNum() throws Exception; |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil payPrivateCarOrder(Integer payType, Integer orderId, Integer couponId, Integer type)throws Exception; |
| | | ResultUtil payPrivateCarOrder(Integer payType, String accountNumber, Integer orderId, Integer couponId, Integer type, Integer language)throws Exception; |
| | | |
| | | |
| | | |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil shareRedEnvelope(Integer orderId) throws Exception; |
| | | ResultUtil shareRedEnvelope(Integer orderId, Integer language) throws Exception; |
| | | |
| | | |
| | | |
| | |
| | | * @param type 1=微信,2=支付宝 |
| | | * @throws Exception |
| | | */ |
| | | void payOrderPrivateCarCallback(Integer id, String order_id, Integer type) throws Exception; |
| | | void payOrderPrivateCarCallback(Integer id, String order_id, Integer type, Integer language) throws Exception; |
| | | |
| | | |
| | | |
| | |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.crossCity.server.impl.OrderCrossCityServiceImpl; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.specialTrain.dao.OrderPrivateCarMapper; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.DistancematrixVo; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.GoogleMapUtil; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.ReverseGeocodeVo; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.TinggPayUtil; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.CheckoutRequest; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.EndPushWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.OrderInfoWarpper; |
| | |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; |
| | | import com.stylefeng.guns.modular.taxi.service.ITransactionDetailsService; |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.nodes.Element; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.HttpEntity; |
| | |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | |
| | |
| | | @Autowired |
| | | private IPaymentRecordService paymentRecordService; |
| | | |
| | | /*@Autowired |
| | | private ICBCPayUtil icbcPayUtil;*/ |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | |
| | | private IOrderPositionService orderPositionService; |
| | | |
| | | @Autowired |
| | | private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; |
| | | |
| | | @Autowired |
| | | private IOrderCrossCityService orderCrossCityService; |
| | | |
| | | @Autowired |
| | |
| | | |
| | | @Autowired |
| | | private ALiSendSms aLiSendSms; |
| | | |
| | | @Resource |
| | | private CarMapper carMapper; |
| | | |
| | | @Autowired |
| | | private IOrderEvaluateService orderEvaluateService; |
| | | |
| | | @Autowired |
| | | private IOrderLogisticsService orderLogisticsService; |
| | | |
| | | |
| | | @Value("${filePath}") |
| | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath; |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | | @Value("${spring.mail.template-path}") |
| | | private String templatePath; |
| | | |
| | | |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public synchronized ResultUtil<BaseWarpper> saveOrderPrivateCar(Integer serverCarModelId, Date travelTime, Integer reservation, Integer instead, String placementLon, String placementLat, String startLon, String startLat, |
| | | String startAddress, String endLon, String endLat, String endAddress, String name, String phone, Integer orderSource, Integer driverId, Integer type, Integer uid) throws Exception { |
| | | String startAddress, String endLon, String endLat, String endAddress, String name, String phone, Integer orderSource, Integer driverId, Integer type, Integer uid, Integer language) throws Exception { |
| | | |
| | | //如果出行时间大于当前10分钟则默认为预约单 |
| | | if(travelTime.getTime() > (System.currentTimeMillis() + 600000)){ |
| | |
| | | */ |
| | | List<OrderPrivateCar> orderPrivateCars = orderPrivateCarMapper.queryByState(uid, 1, 1, 1, 2, 3, 4, 5, 6, 11); |
| | | if(orderPrivateCars.size() > 0){ |
| | | return ResultUtil.error("有未完成的订单"); |
| | | return ResultUtil.error(language == 1 ? "有未完成的订单" : language == 2 ? "There are outstanding orders" : "Il y a des commandes en attente"); |
| | | } |
| | | List<OrderTaxi> list = orderTaxiMapper.queryByState_(uid, 1, 1, 1, 2, 3, 4, 5, 6, 11); |
| | | if(list.size() > 0){ |
| | | return ResultUtil.error("有未完成的订单"); |
| | | return ResultUtil.error(language == 1 ? "有未完成的订单" : language == 2 ? "There are outstanding orders" : "Il y a des commandes en attente"); |
| | | } |
| | | |
| | | orderPrivateCars = orderPrivateCarMapper.queryByState(uid, 2, 1, 1, 2, 3, 4, 5, 6, 11); |
| | | if(orderPrivateCars.size() > 0 && reservation == 2){ |
| | | return ResultUtil.error("有未完成的订单"); |
| | | return ResultUtil.error(language == 1 ? "有未完成的订单" : language == 2 ? "There are outstanding orders" : "Il y a des commandes en attente"); |
| | | } |
| | | |
| | | orderPrivateCars = orderPrivateCarMapper.queryByState(uid, 1, 1, 7,12); |
| | |
| | | |
| | | list = orderTaxiMapper.queryByState_(uid, 2, 1, 1, 2, 3, 4, 5, 6, 11); |
| | | if(list.size() > 0 && reservation == 2){ |
| | | return ResultUtil.error("有未完成的订单"); |
| | | return ResultUtil.error(language == 1 ? "有未完成的订单" : language == 2 ? "There are outstanding orders" : "Il y a des commandes en attente"); |
| | | } |
| | | |
| | | startAddress = startAddress.replaceAll("& #40;", "("); |
| | |
| | | endAddress = endAddress.replaceAll("& #40;", "("); |
| | | endAddress = endAddress.replaceAll("& #41;", ")"); |
| | | if((orderSource == 1 || orderSource == 3) && null == serverCarModelId){ |
| | | return ResultUtil.error("请选择服务车型"); |
| | | return ResultUtil.error(language == 1 ? "请选择服务车型" : language == 2 ? "Please select the service model" : "Veuillez sélectionner un modèle de service"); |
| | | } |
| | | |
| | | OrderPrivateCar orderPrivateCar = new OrderPrivateCar(); |
| | |
| | | if(instead == 0 || ToolUtil.isEmpty(orderPrivateCar.getPassengers())){ |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | if(ToolUtil.isEmpty(userInfo.getPhone())){ |
| | | return ResultUtil.error("请先绑定手机号码"); |
| | | return ResultUtil.error(language == 1 ? "请先绑定手机号码" : language == 2 ? "Please bind the mobile phone number first" : "Veuillez d’abord lier le numéro de téléphone mobile"); |
| | | } |
| | | orderPrivateCar.setPassengers(userInfo.getName()); |
| | | orderPrivateCar.setPassengers(userInfo.getFirstName() + "." + userInfo.getLastName()); |
| | | orderPrivateCar.setPassengersPhone(userInfo.getPhone()); |
| | | } |
| | | orderPrivateCar.setState(1); |
| | |
| | | if(orderSource == 2){//扫码下单 |
| | | Driver driver = driverService.selectById(driverId); |
| | | if(null == driver){ |
| | | return ResultUtil.error("司机信息有误,无法完成下单"); |
| | | return ResultUtil.error(language == 1 ? "司机信息有误,无法完成下单" : language == 2 ? "Incorrect driver information, unable to complete the order" : "Les informations du conducteur sont incorrectes pour compléter la commande"); |
| | | } |
| | | if(driver.getAuthState() == 1){ |
| | | return ResultUtil.error("司机信息还未完成审核,无法完成下单"); |
| | | return ResultUtil.error(language == 1 ? "司机信息还未完成审核,无法完成下单" : language == 2 ? "The driver information has not been reviewed, and the order cannot be completed" : "Les informations du conducteur n’ont pas été vérifiées et la commande n’a pas pu être finalisée"); |
| | | } |
| | | if(driver.getAuthState() == 3){ |
| | | return ResultUtil.error("司机账户已被冻结,无法提供服务"); |
| | | return ResultUtil.error(language == 1 ? "司机账户已被冻结,无法提供服务" : language == 2 ? "The driver's account has been frozen, unable to provide service" : "Le compte du conducteur a été bloqué et le service n’est pas disponible"); |
| | | } |
| | | if(driver.getAuthState() == 4){ |
| | | return ResultUtil.error("司机信息未通过审核,无法提供服务"); |
| | | return ResultUtil.error(language == 1 ? "司机信息未通过审核,无法提供服务" : language == 2 ? "Driver information has not passed the audit, unable to provide service" : "Les informations du conducteur n’ont pas été vérifiées et le service n’a pas pu être fourni"); |
| | | } |
| | | if(driver.getState() == 1){ |
| | | return ResultUtil.error("司机还未上线,无法提供服务"); |
| | | return ResultUtil.error(language == 1 ? "司机还未上线,无法提供服务" : language == 2 ? "The driver is not online and cannot provide service" : "Le chauffeur n’est pas en ligne et n’est pas en mesure d’offrir ses services"); |
| | | } |
| | | if(driver.getState() == 3){ |
| | | return ResultUtil.error("司机正在服务中,无法提供服务"); |
| | | return ResultUtil.error(language == 1 ? "司机正在服务中,无法提供服务" : language == 2 ? "The driver is in service and cannot provide service" : "Le chauffeur est en service et le service n’est pas disponible"); |
| | | } |
| | | List<DriverService> query = driverServiceService.query(driverId, 1); |
| | | if(query.size() == 0){ |
| | | return ResultUtil.error("该司机不能服务此业务"); |
| | | return ResultUtil.error(language == 1 ? "该司机不能服务此业务" : language == 2 ? "The driver cannot serve this service" : "Ce conducteur ne peut pas servir cette entreprise"); |
| | | } |
| | | |
| | | int count = this.selectCount(new EntityWrapper<OrderPrivateCar>().eq("driverId", driverId).eq("driverPay", 1).in("state", Arrays.asList(7, 8, 9)).eq("isDelete", 1)); |
| | | if(count > 0){ |
| | | return ResultUtil.error("司机未支付订单费用,无法进行接单"); |
| | | } |
| | | int count1 = orderLogisticsService.selectCount(new EntityWrapper<OrderLogistics>().eq("driverId", driverId).eq("driverPay", 1).ne("state", 10).eq("isDelete", 1)); |
| | | if(count1 > 0){ |
| | | return ResultUtil.error("司机未支付订单费用,无法进行接单"); |
| | | } |
| | | |
| | | orderPrivateCar.setDriverId(driverId); |
| | |
| | | CarService query1 = carServiceMapper.query(1, driver.getCarId()); |
| | | orderPrivateCar.setServerCarModelId(query1.getServerCarModelId()); |
| | | orderPrivateCar.setSnatchOrderTime(new Date()); |
| | | |
| | | //调用高德创建轨迹 |
| | | // String s = gdFalconUtil.selectTerminal(driver.getPhone()); |
| | | // String track = gdFalconUtil.createTrack(s); |
| | | // orderPrivateCar.setTrackId(track); |
| | | |
| | | //调用移动的小号接口 |
| | | /* Map<String, String> geocode1 = gdMapGeocodingUtil.geocode(orderPrivateCar.getStartLon().toString(), orderPrivateCar.getStartLat().toString()); |
| | | Region region = regionMapper.query(geocode1.get("districtCode"));*/ |
| | | // Map<String, String> map = chinaMobileUtil.midAxbBindSend(orderPrivateCar.getPassengersPhone(), driver.getPhone(), null); |
| | | // if(String.valueOf(map.get("code")).equals("200")){ |
| | | // orderPrivateCar.setTelX(map.get("telX")); |
| | | // orderPrivateCar.setBindId(map.get("bindId")); |
| | | // } |
| | | |
| | | driver.setState(3); |
| | | driverService.updateById(driver); |
| | |
| | | |
| | | // TODO: 2021/5/11 修改,根据后台设定的派单范围查询范围内有无司机,将单子指派给距离最近的司机(距离相同随机取),范围内没有司机再进行推单流程 |
| | | if(orderPrivateCar.getState() == 1){ |
| | | Company query = companyCityService.query(orderPrivateCar.getStartLon().toString(), orderPrivateCar.getStartLat().toString()); |
| | | Company query = companyCityService.query1(orderPrivateCar.getStartLon().toString(), orderPrivateCar.getStartLat().toString()); |
| | | if(null == query){ |
| | | return ResultUtil.error("起点暂未企业提供服务"); |
| | | return ResultUtil.error(language == 1 ? "起点暂未企业提供服务" : language == 2 ? "Starting point no enterprise to provide services" : "Point de départ pas encore disponible pour les entreprises"); |
| | | } |
| | | AssignOrder assignOrder = assignOrderService.selectOne(new EntityWrapper<AssignOrder>().eq("companyId", query.getId()).eq("type", 1)); |
| | | if(null != assignOrder){//配置了指派规则才处理 |
| | | if(null != assignOrder && assignOrder.getPeople() > 0){//配置了指派规则才处理 |
| | | //获取空闲司机 |
| | | List<Driver> drivers = driverService.queryIdleDriver(1, orderPrivateCar.getServerCarModelId(), orderPrivateCar.getStartLon(), orderPrivateCar.getStartLat(), assignOrder.getDistance(), null);//获取范围内空闲司机 |
| | | if(drivers.size() > 0){//有司机,直接指派给司机 |
| | |
| | | orderPrivateCar.setServerCarModelId(query1.getServerCarModelId()); |
| | | orderPrivateCar.setSnatchOrderTime(new Date()); |
| | | |
| | | //调用高德创建轨迹 |
| | | // String s = gdFalconUtil.selectTerminal(dr.getPhone()); |
| | | // String track = gdFalconUtil.createTrack(s); |
| | | // orderPrivateCar.setTrackId(track); |
| | | |
| | | //调用移动的小号接口 |
| | | /* Map<String, String> geocode1 = gdMapGeocodingUtil.geocode(orderPrivateCar.getStartLon().toString(), orderPrivateCar.getStartLat().toString()); |
| | | Region region = regionMapper.query(geocode1.get("districtCode"));*/ |
| | | // Map<String, String> map = chinaMobileUtil.midAxbBindSend(orderPrivateCar.getPassengersPhone(), dr.getPhone(), null); |
| | | // if(String.valueOf(map.get("code")).equals("200")){ |
| | | // orderPrivateCar.setTelX(map.get("telX")); |
| | | // orderPrivateCar.setBindId(map.get("bindId")); |
| | | // } |
| | | |
| | | dr.setState(3); |
| | | driverService.updateById(dr); |
| | | this.updateById(orderPrivateCar); |
| | |
| | | |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, "您的专车订单已下单成功,我们正在为您指派司机,请稍后!", orderPrivateCar.getUserId(), 1); |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您的专车订单已下单成功,我们正在为您指派司机,请稍后!" : |
| | | language == 2 ? "Your private car order has been successfully placed, we are assigning a driver for you, please wait!" : |
| | | "Votre commande de voiture exclusive a été passée avec succès. Nous vous assignons un chauffeur. Plus tard!", orderPrivateCar.getUserId(), 1); |
| | | |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | baseWarpper.setState(orderPrivateCar.getState()); |
| | |
| | | } |
| | | double amount = 0; |
| | | CancleOrder query = cancleOrderService.query(orderPrivateCar.getOrderType(), 1, orderPrivateCar.getCompanyId()); |
| | | if(null != orderPrivateCar.getDriverId() && orderPrivateCar.getArriveTime()!=null && |
| | | (orderPrivateCar.getArriveTime().getTime() + query.getMinuteNum() * 60 * 1000) < new Date().getTime()){//收费的情况 |
| | | if(null != orderPrivateCar.getDriverId() && orderPrivateCar.getSnatchOrderTime()!=null && |
| | | (orderPrivateCar.getSnatchOrderTime().getTime() + query.getMinuteNum() * 60 * 1000) < new Date().getTime()){//收费的情况 |
| | | if(null != query){ |
| | | amount += query.getMoney(); |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){ |
| | | //上传数据 |
| | | pushMinistryOfTransportUtil.orderCancel(orderPrivateCar.getId()); |
| | | } |
| | | } |
| | | }).start(); |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功取消出行订单,谢谢使用!" : language == 2 ? "You have successfully canceled the travel order, thank you for using" : "Vous avez annulé avec succès la commande de voyage, merci d'utiliser", orderPrivateCar.getUserId(), 1); |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil cancleOrderPrivateCar(Integer id, Integer payType, Integer cancleId, Integer type) throws Exception { |
| | | public ResultUtil cancleOrderPrivateCar(Integer id, Integer payType, String accountNumber, Integer cancleId, Integer type, Integer language) throws Exception { |
| | | OrderPrivateCar orderPrivateCar = this.selectById(id); |
| | | Integer uid = orderPrivateCar.getUserId(); |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | |
| | | |
| | | CancleOrder query = cancleOrderService.query(orderPrivateCar.getOrderType(), 1, orderPrivateCar.getCompanyId()); |
| | | if(null != query){ |
| | | if(payType == 1){//微信支付 |
| | | if(payType == 1){//线上支付 |
| | | orderCancel.setPayType(1); |
| | | orderCancelService.updateById(orderCancel); |
| | | resultUtil = payMoneyUtil.weixinpay("订单取消",id +"",id + "_1_fei",query.getMoney()+"","/base/wxCancelOrderTaxi","JSAPI",userInfo.getAppletsOpenId()); |
| | | //Map<String, String> map = icbcPayUtil.placeAnOrder(id + ",1", 9, 5, uid.toString(), "订单取消", query.getMoney(), callbackPath + "/base/wxCancelOrderTaxi", "", type, userInfo.getAppletsOpenId()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String merchantTransactionId = sdf.format(new Date()) + "1" + id; |
| | | CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | checkoutRequest.setMsisdn(Long.valueOf(userInfo.getPhone())); |
| | | checkoutRequest.setCustomerEmail(userInfo.getEmail()); |
| | | checkoutRequest.setAccountNumber(accountNumber); |
| | | checkoutRequest.setCustomerFirstName(userInfo.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(userInfo.getLastName()); |
| | | checkoutRequest.setRequestAmount(query.getMoney()); |
| | | checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | checkoutRequest.setRequestDescription("Cancel a trip"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxCancelOrderTaxi"); |
| | | checkoutRequest.setPendingRedirectUrl(""); |
| | | checkoutRequest.setSuccessRedirectUrl("https://10pz685243.zicp.fun"); |
| | | checkoutRequest.setFailRedirectUrl("https://www.baidu.com"); |
| | | resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | if(resultUtil.getCode()==200){ |
| | | paymentRecordService.saveData(1, null, null, id, 1, 1, query.getMoney(), null, 1);//添加预支付数据 |
| | | resultUtil = resultUtil; |
| | | }else{ |
| | | resultUtil = ResultUtil.error("支付失败", ""); |
| | | } |
| | | |
| | | } |
| | | if(payType == 2){//支付宝支付 |
| | | orderCancel.setPayType(2); |
| | | orderCancelService.updateById(orderCancel); |
| | | resultUtil = payMoneyUtil.alipay("订单取消","订单取消",id + "_1_fei",query.getMoney()+"","/base/aliCancelOrderTaxi"); |
| | | if(resultUtil.getCode()==200){ |
| | | paymentRecordService.saveData(1, null, null, id, 1, 2, query.getMoney(), null, 1);//添加预支付数据 |
| | | resultUtil = resultUtil; |
| | | }else{ |
| | | resultUtil = ResultUtil.error("支付失败", ""); |
| | | } |
| | | } |
| | | if(payType == 3){//余额支付 |
| | | if(userInfo.getBalance() != null && userInfo.getBalance() < query.getMoney()){ |
| | | return ResultUtil.error("余额不足,无法完成支付", ""); |
| | | return ResultUtil.error((language == 1 ? "账户余额不足" : language == 2 ? "Insufficient account balance" : "Solde de compte insuffisant"), ""); |
| | | } |
| | | |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(query.getMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | |
| | | |
| | | this.deleteTask(id);//删除定时任务 |
| | | |
| | | // new Thread(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0); |
| | | // } |
| | | // }).start(); |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, "您已使用余额成功支付取消订单费用,谢谢使用!", orderPrivateCar.getUserId(), 1); |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已使用余额成功支付取消订单费用,谢谢使用!" : language == 2 |
| | | ? "You have successfully paid the cancellation fee with the balance, thank you for using!" |
| | | : "Vous avez utilisé le solde pour payer avec succès les frais d’annulation de commande. Merci d’utiliser!", orderPrivateCar.getUserId(), 1); |
| | | } |
| | | } |
| | | return resultUtil; |
| | |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | integers = JSON.parseArray(vehicle).toJavaList(Integer.class); |
| | | } |
| | | Company query = companyCityService.query(String.valueOf(orderPrivateCar.getStartLon()), String.valueOf(orderPrivateCar.getStartLat()));//获取起点所属分公司 |
| | | Company query = companyCityService.query1(String.valueOf(orderPrivateCar.getStartLon()), String.valueOf(orderPrivateCar.getStartLat()));//获取起点所属分公司 |
| | | List<PushOrder> querys = pushOrderService.querys(null, 1, query.getId());//获取需要推送的次数 |
| | | for(int i = 1; i <= querys.size(); i++){ |
| | | PushOrder pushOrder = pushOrderService.querys(i, 1, query.getId()).get(0); |
| | |
| | | break; |
| | | } |
| | | if(i == querys.size() && state == 1){ |
| | | pushUtil.pushEndPush(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1); |
| | | orderIds.remove(orderPrivateCar.getId()); |
| | | OrderPrivateCar orderPrivateCar1 = OrderPrivateCarServiceImpl.this.selectById(orderPrivateCar.getId()); |
| | | if(orderPrivateCar1.getState() == 1){ |
| | | pushUtil.pushEndPush(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1); |
| | | orderIds.remove(orderPrivateCar.getId()); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ResultUtil payPrivateCarOrder(Integer payType, Integer orderId, Integer couponId, Integer type) throws Exception { |
| | | public ResultUtil payPrivateCarOrder(Integer payType, String accountNumber, Integer orderId, Integer couponId, Integer type, Integer language) throws Exception { |
| | | OrderPrivateCar orderPrivateCar = this.selectById(orderId); |
| | | if(orderPrivateCar.getState() == 8 || orderPrivateCar.getState() == 9){ |
| | | return ResultUtil.error("订单已完成支付,不允许重复支付", ""); |
| | | return ResultUtil.error("订单已完成支付,不允许重复支付"); |
| | | } |
| | | if(orderPrivateCar.getState() != 7){ |
| | | return ResultUtil.error("订单不在待支付状态,不允许支付", ""); |
| | | return ResultUtil.error("订单不在待支付状态,不允许支付"); |
| | | } |
| | | Integer uid = orderPrivateCar.getUserId(); |
| | | Double orderMoney = orderPrivateCar.getOrderMoney(); |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | ResultUtil resultUtil = ResultUtil.success(new HashMap<>()); |
| | | ResultUtil resultUtil = ResultUtil.success(); |
| | | orderPrivateCar.setCouponMoney(0D);//初始化历史数据 |
| | | orderPrivateCar.setCouponId(null); |
| | | |
| | |
| | | if(null != couponId){ |
| | | userCouponRecord = userCouponRecordService.selectById(couponId); |
| | | if(userCouponRecord.getCompanyId() != orderPrivateCar.getCompanyId()){ |
| | | return ResultUtil.error("优惠券不能用于此订单", ""); |
| | | return ResultUtil.error("优惠券不能用于此订单"); |
| | | } |
| | | if(userCouponRecord.getState() == 2){ |
| | | return ResultUtil.error("优惠券已使用", ""); |
| | | return ResultUtil.error("优惠券已使用"); |
| | | } |
| | | if(userCouponRecord.getState() == 3){ |
| | | return ResultUtil.error("优惠券已过期", ""); |
| | | return ResultUtil.error("优惠券已过期"); |
| | | } |
| | | if(userCouponRecord.getCouponUseType() != 0 && userCouponRecord.getCouponUseType() != 1){ |
| | | return ResultUtil.error("优惠券不能用于此类型订单", ""); |
| | | return ResultUtil.error("优惠券不能用于此类型订单"); |
| | | } |
| | | if(userCouponRecord.getCouponType() == 2 && orderMoney.compareTo(userCouponRecord.getFullMoney()) < 0){ |
| | | return ResultUtil.error("优惠券不能用于此订单", ""); |
| | | return ResultUtil.error("优惠券不能用于此订单"); |
| | | } |
| | | orderMoney = orderMoney - userCouponRecord.getMoney(); |
| | | orderPrivateCar.setCouponMoney(userCouponRecord.getMoney()); |
| | |
| | | } |
| | | |
| | | if(payType == 1){//手机支付 |
| | | //Map<String, String> map = icbcPayUtil.placeAnOrder(orderId + ",1", 9, 5, uid.toString(), "完成订单", orderMoney, callbackPath + "/base/wxPayOrderTaxi", "", type, userInfo.getAppletsOpenId()); |
| | | resultUtil = payMoneyUtil.weixinpay("完成订单",orderId +"",orderId + "_1_fei",orderMoney+"","/base/wxPayOrderTaxi","JSAPI",userInfo.getAppletsOpenId()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String merchantTransactionId = sdf.format(new Date()) + "1" + language + orderId; |
| | | // resultUtil = payMoneyUtil.weixinpay("完成订单",language.toString(),orderId + "_1_fei",orderMoney+"","/base/wxPayOrderTaxi","JSAPI",userInfo.getAppletsOpenId()); |
| | | CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | checkoutRequest.setMsisdn(Long.valueOf(userInfo.getPhone())); |
| | | checkoutRequest.setCustomerEmail(userInfo.getEmail()); |
| | | checkoutRequest.setAccountNumber(accountNumber); |
| | | checkoutRequest.setCustomerFirstName(userInfo.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(userInfo.getLastName()); |
| | | checkoutRequest.setRequestAmount(orderMoney); |
| | | checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | checkoutRequest.setRequestDescription("Travel completion payment"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderTaxi"); |
| | | checkoutRequest.setPendingRedirectUrl(""); |
| | | checkoutRequest.setSuccessRedirectUrl("https://10pz685243.zicp.fun"); |
| | | checkoutRequest.setFailRedirectUrl("https://www.baidu.com"); |
| | | resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | |
| | | if(resultUtil.getCode()==200){ |
| | | paymentRecordService.saveData(1, null, null, orderId, 1, 1, orderMoney, null, 1);//添加预支付数据 |
| | | resultUtil = resultUtil; |
| | | }else{ |
| | | resultUtil = ResultUtil.error("支付失败", ""); |
| | | resultUtil = ResultUtil.error("支付失败"); |
| | | } |
| | | |
| | | } |
| | | if(payType == 2) {//银行卡支付 |
| | | resultUtil = payMoneyUtil.alipay("完成订单","完成订单",orderId + "_1_fei",orderMoney+"","/base/aliPayOrderTaxi"); |
| | | //Map<String, String> map = icbcPayUtil.placeAnOrder(orderId + ",1", 10, 5, uid.toString(), "完成订单", orderMoney, callbackPath + "/base/aliPayOrderTaxi", "", type, null); |
| | | if (resultUtil.getCode()==200) { |
| | | paymentRecordService.saveData(1, null, null, orderId, 1, 2, orderMoney, null, 1);//添加预支付数据 |
| | | resultUtil = resultUtil; |
| | | } else { |
| | | resultUtil = ResultUtil.error("支付失败", ""); |
| | | } |
| | | } |
| | | if(payType == 3){//余额支付 |
| | | if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){ |
| | | return ResultUtil.error("余额不足,无法完成支付", ""); |
| | | return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient account balance" : "Solde de compte insuffisant"); |
| | | } |
| | | |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | |
| | | } |
| | | if(company.getIsSpeFixedOrProportional() == 1){//比例 |
| | | Double price = orderPrivateCar.getStartMoney() + orderPrivateCar.getMileageMoney() + orderPrivateCar.getWaitMoney() + orderPrivateCar.getDurationMoney() + orderPrivateCar.getLongDistanceMoney(); |
| | | d = new BigDecimal(price).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | d = new BigDecimal(price).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))); |
| | | c = new BigDecimal(orderPrivateCar.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | incomeService.saveData(1, orderPrivateCar.getCompanyId(), 2, orderPrivateCar.getId(), 1, d.doubleValue()); |
| | |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/receipt.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日"); |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/MM/dd HH:mm"); |
| | | SimpleDateFormat sdf2 = new SimpleDateFormat("HH:mm"); |
| | | Car car = carMapper.selectById(orderPrivateCar.getCarId()); |
| | | Double aDouble = 0D; |
| | | if(null != orderPrivateCar.getDriverId()){ |
| | | aDouble = orderEvaluateService.queryDriverScore(orderPrivateCar.getDriverId()); |
| | | } |
| | | Double aDouble1 = Double.valueOf(orderPrivateCar.getMileage() / 1000); |
| | | if(1 == language){ |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element title_chinese = document.getElementById("title_chinese"); |
| | | title_chinese.text(sdf.format(orderPrivateCar.getTravelTime()) + ",您在I-GO1个订单消费GHS " + orderPrivateCar.getPayMoney()); |
| | | Element xcf_chinese = document.getElementById("xcf_chinese"); |
| | | xcf_chinese.text("GHS " + orderPrivateCar.getOrderMoney()); |
| | | Element xj_chinese = document.getElementById("xj_chinese"); |
| | | xj_chinese.text("GHS " + orderPrivateCar.getOrderMoney()); |
| | | Element pay_type_chinese = document.getElementById("pay_type_chinese"); |
| | | pay_type_chinese.text("余额"); |
| | | Element pay_money_chinese = document.getElementById("pay_money_chinese"); |
| | | pay_money_chinese.text("GHS " + orderPrivateCar.getPayMoney()); |
| | | Element pay_time_chinese = document.getElementById("pay_time_chinese"); |
| | | pay_time_chinese.text(sdf1.format(orderPrivateCar.getEndServiceTime())); |
| | | Element cp_chinese = document.getElementById("cp_chinese"); |
| | | cp_chinese.text("车牌:" + car.getCarLicensePlate()); |
| | | Element pf_chinese = document.getElementById("pf_chinese"); |
| | | pf_chinese.text("司机评分:" + aDouble); |
| | | Element lc_chinese = document.getElementById("lc_chinese"); |
| | | lc_chinese.text("里程:" + aDouble1 + "公里 /" + orderPrivateCar.getDuration() + "分钟"); |
| | | Element start_time_chinese = document.getElementById("start_time_chinese"); |
| | | start_time_chinese.text(sdf2.format(orderPrivateCar.getTravelTime())); |
| | | Element start_address_chinese = document.getElementById("start_address_chinese"); |
| | | start_address_chinese.text(orderPrivateCar.getStartAddress()); |
| | | Element end_time_chinese = document.getElementById("end_time_chinese"); |
| | | end_time_chinese.text(sdf2.format(orderPrivateCar.getEndServiceTime())); |
| | | Element end_address_chinese = document.getElementById("end_address_chinese"); |
| | | end_address_chinese.text(orderPrivateCar.getEndAddress()); |
| | | } |
| | | if(2 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element title_english = document.getElementById("title_english"); |
| | | title_english.text(sdf.format(orderPrivateCar.getTravelTime()) + ",You spent GHS " + orderPrivateCar.getPayMoney() + " on the trip "); |
| | | Element xcf_english = document.getElementById("xcf_english"); |
| | | xcf_english.text("GHS " + orderPrivateCar.getOrderMoney()); |
| | | Element xj_english = document.getElementById("xj_english"); |
| | | xj_english.text("GHS " + orderPrivateCar.getOrderMoney()); |
| | | Element pay_type_english = document.getElementById("pay_type_english"); |
| | | pay_type_english.text("balance"); |
| | | Element pay_money_english = document.getElementById("pay_money_english"); |
| | | pay_money_english.text("GHS " + orderPrivateCar.getPayMoney()); |
| | | Element pay_time_english = document.getElementById("pay_time_english"); |
| | | pay_time_english.text(sdf1.format(orderPrivateCar.getEndServiceTime())); |
| | | Element cp_english = document.getElementById("cp_english"); |
| | | cp_english.text("Number Plate:" + car.getCarLicensePlate()); |
| | | Element pf_english = document.getElementById("pf_english"); |
| | | pf_english.text("Driver Rating:" + aDouble); |
| | | Element lc_english = document.getElementById("lc_english"); |
| | | lc_english.text("Mileage:" + aDouble1 + "KM / " + orderPrivateCar.getDuration() + "Minutes"); |
| | | Element start_time_english = document.getElementById("start_time_english"); |
| | | start_time_english.text(sdf2.format(orderPrivateCar.getTravelTime())); |
| | | Element start_address_english = document.getElementById("start_address_english"); |
| | | start_address_english.text(orderPrivateCar.getStartAddress()); |
| | | Element end_time_english = document.getElementById("end_time_english"); |
| | | end_time_english.text(sdf2.format(orderPrivateCar.getEndServiceTime())); |
| | | Element end_address_english = document.getElementById("end_address_english"); |
| | | end_address_english.text(orderPrivateCar.getEndAddress()); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | Element title_french = document.getElementById("title_french"); |
| | | title_french.text("Vous consommez GHS " + orderPrivateCar.getPayMoney() + " sur votre commande i-go1 le " + sdf.format(orderPrivateCar.getTravelTime())); |
| | | Element xcf_french = document.getElementById("xcf_french"); |
| | | xcf_french.text("GHS " + orderPrivateCar.getOrderMoney()); |
| | | Element xj_french = document.getElementById("xj_french"); |
| | | xj_french.text("GHS " + orderPrivateCar.getOrderMoney()); |
| | | Element pay_type_french = document.getElementById("pay_type_french"); |
| | | pay_type_french.text("Le solde"); |
| | | Element pay_money_french = document.getElementById("pay_money_french"); |
| | | pay_money_french.text("GHS " + orderPrivateCar.getPayMoney()); |
| | | Element pay_time_french = document.getElementById("pay_time_french"); |
| | | pay_time_french.text(sdf1.format(orderPrivateCar.getEndServiceTime())); |
| | | Element cp_french = document.getElementById("cp_french"); |
| | | cp_french.text("Plaque d’immatriculation:" + car.getCarLicensePlate()); |
| | | Element pf_french = document.getElementById("pf_french"); |
| | | pf_french.text("Évaluation des pilotes: " + aDouble); |
| | | Element lc_french = document.getElementById("lc_french"); |
| | | lc_french.text("Kilométrage: " + aDouble1 + "km / " + orderPrivateCar.getDuration() + "minutes"); |
| | | Element start_time_french = document.getElementById("start_time_french"); |
| | | start_time_french.text(sdf2.format(orderPrivateCar.getTravelTime())); |
| | | Element start_address_french = document.getElementById("start_address_french"); |
| | | start_address_french.text(orderPrivateCar.getStartAddress()); |
| | | Element end_time_french = document.getElementById("end_time_french"); |
| | | end_time_french.text(sdf2.format(orderPrivateCar.getEndServiceTime())); |
| | | Element end_address_french = document.getElementById("end_address_french"); |
| | | end_address_french.text(orderPrivateCar.getEndAddress()); |
| | | } |
| | | |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "专车收据" : language == 2 ? "Private car receipt" : "Reçu de voiture privée", document.html()); |
| | | } |
| | | |
| | | |
| | | |
| | | // TODO: 2020/5/24 这里需要给司机和用户推送订单状态 |
| | | new Thread(new Runnable() { |
| | |
| | | } |
| | | }).start(); |
| | | |
| | | systemNoticeService.addSystemNotice(1, "您已使用余额成功完成出行订单支付,谢谢使用!", uid, 1); |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已使用余额成功完成出行订单支付,谢谢使用!" : language == 2 |
| | | ? "You have successfully completed the payment of travel order with the balance, thank you for using!" |
| | | : "Vous avez utilisé le solde pour compléter le paiement de la commande de voyage avec succès. Merci d’utiliser!", uid, 1); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | if(company.getIsSpeFixedOrProportional() == 1){//比例 |
| | | Double price = orderPrivateCar.getStartMoney() + orderPrivateCar.getMileageMoney() + orderPrivateCar.getWaitMoney() + orderPrivateCar.getDurationMoney() + orderPrivateCar.getLongDistanceMoney(); |
| | | d = new BigDecimal(price).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | d = new BigDecimal(price).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))); |
| | | c = new BigDecimal(orderPrivateCar.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | incomeService.saveData(1, orderPrivateCar.getCompanyId(), 2, orderPrivateCar.getId(), 1, d.doubleValue()); |
| | |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/receipt.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日"); |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/MM/dd HH:mm"); |
| | | SimpleDateFormat sdf2 = new SimpleDateFormat("HH:mm"); |
| | | Car car = carMapper.selectById(orderPrivateCar.getCarId()); |
| | | Double aDouble = 0D; |
| | | if(null != orderPrivateCar.getDriverId()){ |
| | | aDouble = orderEvaluateService.queryDriverScore(orderPrivateCar.getDriverId()); |
| | | } |
| | | Double aDouble1 = Double.valueOf(orderPrivateCar.getMileage() / 1000); |
| | | if(1 == language){ |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element title_chinese = document.getElementById("title_chinese"); |
| | | title_chinese.text(sdf.format(orderPrivateCar.getTravelTime()) + ",您在I-GO1个订单消费GHS " + orderPrivateCar.getPayMoney()); |
| | | Element xcf_chinese = document.getElementById("xcf_chinese"); |
| | | xcf_chinese.text("GHS " + orderPrivateCar.getOrderMoney()); |
| | | Element xj_chinese = document.getElementById("xj_chinese"); |
| | | xj_chinese.text("GHS " + orderPrivateCar.getOrderMoney()); |
| | | Element pay_type_chinese = document.getElementById("pay_type_chinese"); |
| | | pay_type_chinese.text("现金"); |
| | | Element pay_money_chinese = document.getElementById("pay_money_chinese"); |
| | | pay_money_chinese.text("GHS " + orderPrivateCar.getPayMoney()); |
| | | Element pay_time_chinese = document.getElementById("pay_time_chinese"); |
| | | pay_time_chinese.text(sdf1.format(orderPrivateCar.getEndServiceTime())); |
| | | Element cp_chinese = document.getElementById("cp_chinese"); |
| | | cp_chinese.text("车牌:" + car.getCarLicensePlate()); |
| | | Element pf_chinese = document.getElementById("pf_chinese"); |
| | | pf_chinese.text("司机评分:" + aDouble); |
| | | Element lc_chinese = document.getElementById("lc_chinese"); |
| | | lc_chinese.text("里程:" + aDouble1 + "公里 /" + orderPrivateCar.getDuration() + "分钟"); |
| | | Element start_time_chinese = document.getElementById("start_time_chinese"); |
| | | start_time_chinese.text(sdf2.format(orderPrivateCar.getTravelTime())); |
| | | Element start_address_chinese = document.getElementById("start_address_chinese"); |
| | | start_address_chinese.text(orderPrivateCar.getStartAddress()); |
| | | Element end_time_chinese = document.getElementById("end_time_chinese"); |
| | | end_time_chinese.text(sdf2.format(orderPrivateCar.getEndServiceTime())); |
| | | Element end_address_chinese = document.getElementById("end_address_chinese"); |
| | | end_address_chinese.text(orderPrivateCar.getEndAddress()); |
| | | } |
| | | if(2 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element title_english = document.getElementById("title_english"); |
| | | title_english.text(sdf.format(orderPrivateCar.getTravelTime()) + ",You spent GHS " + orderPrivateCar.getPayMoney() + " on the trip "); |
| | | Element xcf_english = document.getElementById("xcf_english"); |
| | | xcf_english.text("GHS " + orderPrivateCar.getOrderMoney()); |
| | | Element xj_english = document.getElementById("xj_english"); |
| | | xj_english.text("GHS " + orderPrivateCar.getOrderMoney()); |
| | | Element pay_type_english = document.getElementById("pay_type_english"); |
| | | pay_type_english.text("Cash"); |
| | | Element pay_money_english = document.getElementById("pay_money_english"); |
| | | pay_money_english.text("GHS " + orderPrivateCar.getPayMoney()); |
| | | Element pay_time_english = document.getElementById("pay_time_english"); |
| | | pay_time_english.text(sdf1.format(orderPrivateCar.getEndServiceTime())); |
| | | Element cp_english = document.getElementById("cp_english"); |
| | | cp_english.text("Number Plate:" + car.getCarLicensePlate()); |
| | | Element pf_english = document.getElementById("pf_english"); |
| | | pf_english.text("Driver Rating:" + aDouble); |
| | | Element lc_english = document.getElementById("lc_english"); |
| | | lc_english.text("Mileage:" + aDouble1 + "KM / " + orderPrivateCar.getDuration() + "Minutes"); |
| | | Element start_time_english = document.getElementById("start_time_english"); |
| | | start_time_english.text(sdf2.format(orderPrivateCar.getTravelTime())); |
| | | Element start_address_english = document.getElementById("start_address_english"); |
| | | start_address_english.text(orderPrivateCar.getStartAddress()); |
| | | Element end_time_english = document.getElementById("end_time_english"); |
| | | end_time_english.text(sdf2.format(orderPrivateCar.getEndServiceTime())); |
| | | Element end_address_english = document.getElementById("end_address_english"); |
| | | end_address_english.text(orderPrivateCar.getEndAddress()); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | Element title_french = document.getElementById("title_french"); |
| | | title_french.text("Vous consommez GHS " + orderPrivateCar.getPayMoney() + " sur votre commande i-go1 le " + sdf.format(orderPrivateCar.getTravelTime())); |
| | | Element xcf_french = document.getElementById("xcf_french"); |
| | | xcf_french.text("GHS " + orderPrivateCar.getOrderMoney()); |
| | | Element xj_french = document.getElementById("xj_french"); |
| | | xj_french.text("GHS " + orderPrivateCar.getOrderMoney()); |
| | | Element pay_type_french = document.getElementById("pay_type_french"); |
| | | pay_type_french.text("espèces"); |
| | | Element pay_money_french = document.getElementById("pay_money_french"); |
| | | pay_money_french.text("GHS " + orderPrivateCar.getPayMoney()); |
| | | Element pay_time_french = document.getElementById("pay_time_french"); |
| | | pay_time_french.text(sdf1.format(orderPrivateCar.getEndServiceTime())); |
| | | Element cp_french = document.getElementById("cp_french"); |
| | | cp_french.text("Plaque d’immatriculation:" + car.getCarLicensePlate()); |
| | | Element pf_french = document.getElementById("pf_french"); |
| | | pf_french.text("Évaluation des pilotes: " + aDouble); |
| | | Element lc_french = document.getElementById("lc_french"); |
| | | lc_french.text("Kilométrage: " + aDouble1 + "km / " + orderPrivateCar.getDuration() + "minutes"); |
| | | Element start_time_french = document.getElementById("start_time_french"); |
| | | start_time_french.text(sdf2.format(orderPrivateCar.getTravelTime())); |
| | | Element start_address_french = document.getElementById("start_address_french"); |
| | | start_address_french.text(orderPrivateCar.getStartAddress()); |
| | | Element end_time_french = document.getElementById("end_time_french"); |
| | | end_time_french.text(sdf2.format(orderPrivateCar.getEndServiceTime())); |
| | | Element end_address_french = document.getElementById("end_address_french"); |
| | | end_address_french.text(orderPrivateCar.getEndAddress()); |
| | | } |
| | | |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "专车收据" : language == 2 ? "Private car receipt" : "Reçu de voiture privée", document.html()); |
| | | } |
| | | |
| | | |
| | | |
| | | // TODO: 2020/5/24 这里需要给司机和用户推送订单状态 |
| | | new Thread(new Runnable() { |
| | |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0); |
| | | pushUtil.pushOfflinePayment(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1); |
| | | } |
| | | }).start(); |
| | | |
| | | systemNoticeService.addSystemNotice(1, "您已使用现金成功完成出行订单支付,谢谢使用!", uid, 1); |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已使用现金成功完成出行订单支付,谢谢使用!" : language == 2 |
| | | ? "You have successfully completed the payment of travel order with cash, thank you for using!" |
| | | : "Vous avez utilisé de l’argent pour compléter avec succès le paiement de votre commande de voyage. Merci d’utiliser!", uid, 1); |
| | | } |
| | | |
| | | this.updateAllColumnById(orderPrivateCar); |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.operatePay(orderId); |
| | | } |
| | | } |
| | | }).start(); |
| | | return resultUtil; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public synchronized ResultUtil shareRedEnvelope(Integer orderId) throws Exception { |
| | | public synchronized ResultUtil shareRedEnvelope(Integer orderId, Integer language) throws Exception { |
| | | OrderPrivateCar orderPrivateCar = this.selectById(orderId); |
| | | UserRedPacketRecord query = userRedPacketRecordService.query_(orderPrivateCar.getUserId(), orderPrivateCar.getCompanyId(), 0, 1, null); |
| | | if(null != query){ |
| | |
| | | query.setState(1); |
| | | query.setRedPacketActivityId(id.getId()); |
| | | userRedPacketRecordService.updateById(query); |
| | | |
| | | UserInfo userInfo = userInfoService.selectById(orderPrivateCar.getUserId()); |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/redEnvelopes.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | if(1 == language){ |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element user_chinese = document.getElementById("user_chinese"); |
| | | user_chinese.text("您好 " + userInfo.getNickName() + ","); |
| | | Element time_chinese = document.getElementById("time_chinese"); |
| | | time_chinese.text("此活动有效期在" + sdf.format(query.getInsertTime()) + "至" + sdf.format(query.getEndTime()) + ",详情请查看I-GO平台"); |
| | | } |
| | | if(2 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element user_english = document.getElementById("user_english"); |
| | | user_english.text("Hello " + userInfo.getNickName() + ","); |
| | | Element time_english = document.getElementById("time_english"); |
| | | time_english.text("You could use it from" + sdf.format(query.getInsertTime()) + "to" + sdf.format(query.getEndTime()) + ",check more details on the app."); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | Element user_french = document.getElementById("user_french"); |
| | | user_french.text("Bonjour " + userInfo.getNickName() + ","); |
| | | Element time_french = document.getElementById("time_french"); |
| | | time_french.text("Cette promotion est valable du" + sdf.format(query.getInsertTime()) + "au" + sdf.format(query.getEndTime()) + ". Veuillez consulter la plateforme i-go pour plus de détails."); |
| | | } |
| | | |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "红包活动" : language == 2 ? "Red envelope activity" : "Activité de l’enveloppe rouge", document.html()); |
| | | } |
| | | |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void payOrderPrivateCarCallback(Integer id, String order_id, Integer type) throws Exception { |
| | | public void payOrderPrivateCarCallback(Integer id, String order_id, Integer type, Integer language) throws Exception { |
| | | OrderPrivateCar orderPrivateCar = this.selectById(id); |
| | | PaymentRecord query = paymentRecordService.query(1, null, null, Integer.valueOf(id), 1, type, 1); |
| | | if(null != query){ |
| | |
| | | } |
| | | if(company.getIsSpeFixedOrProportional() == 1){//比例 |
| | | Double price = orderPrivateCar.getStartMoney() + orderPrivateCar.getMileageMoney() + orderPrivateCar.getWaitMoney() + orderPrivateCar.getDurationMoney() + orderPrivateCar.getLongDistanceMoney(); |
| | | d = new BigDecimal(price).multiply(new BigDecimal(taxi).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | d = new BigDecimal(price).multiply(new BigDecimal(taxi).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))); |
| | | c = new BigDecimal(orderPrivateCar.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | incomeService.saveData(1, orderPrivateCar.getCompanyId(), 2, orderPrivateCar.getId(), 1, d.doubleValue()); |
| | |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/receipt.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日"); |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/MM/dd HH:mm"); |
| | | SimpleDateFormat sdf2 = new SimpleDateFormat("HH:mm"); |
| | | Car car = carMapper.selectById(orderPrivateCar.getCarId()); |
| | | Double aDouble = 0D; |
| | | if(null != orderPrivateCar.getDriverId()){ |
| | | aDouble = orderEvaluateService.queryDriverScore(orderPrivateCar.getDriverId()); |
| | | } |
| | | Double aDouble1 = Double.valueOf(orderPrivateCar.getMileage() / 1000); |
| | | if(1 == language){ |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element title_chinese = document.getElementById("title_chinese"); |
| | | title_chinese.text(sdf.format(orderPrivateCar.getTravelTime()) + ",您在I-GO1个订单消费GHS " + orderPrivateCar.getPayMoney()); |
| | | Element xcf_chinese = document.getElementById("xcf_chinese"); |
| | | xcf_chinese.text("GHS " + orderPrivateCar.getOrderMoney()); |
| | | Element xj_chinese = document.getElementById("xj_chinese"); |
| | | xj_chinese.text("GHS " + orderPrivateCar.getOrderMoney()); |
| | | Element pay_type_chinese = document.getElementById("pay_type_chinese"); |
| | | pay_type_chinese.text("现金"); |
| | | Element pay_money_chinese = document.getElementById("pay_money_chinese"); |
| | | pay_money_chinese.text("GHS " + orderPrivateCar.getPayMoney()); |
| | | Element pay_time_chinese = document.getElementById("pay_time_chinese"); |
| | | pay_time_chinese.text(sdf1.format(orderPrivateCar.getEndServiceTime())); |
| | | Element cp_chinese = document.getElementById("cp_chinese"); |
| | | cp_chinese.text("车牌:" + car.getCarLicensePlate()); |
| | | Element pf_chinese = document.getElementById("pf_chinese"); |
| | | pf_chinese.text("司机评分:" + aDouble); |
| | | Element lc_chinese = document.getElementById("lc_chinese"); |
| | | lc_chinese.text("里程:" + aDouble1 + "公里 /" + orderPrivateCar.getDuration() + "分钟"); |
| | | Element start_time_chinese = document.getElementById("start_time_chinese"); |
| | | start_time_chinese.text(sdf2.format(orderPrivateCar.getTravelTime())); |
| | | Element start_address_chinese = document.getElementById("start_address_chinese"); |
| | | start_address_chinese.text(orderPrivateCar.getStartAddress()); |
| | | Element end_time_chinese = document.getElementById("end_time_chinese"); |
| | | end_time_chinese.text(sdf2.format(orderPrivateCar.getEndServiceTime())); |
| | | Element end_address_chinese = document.getElementById("end_address_chinese"); |
| | | end_address_chinese.text(orderPrivateCar.getEndAddress()); |
| | | } |
| | | if(2 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element title_english = document.getElementById("title_english"); |
| | | title_english.text(sdf.format(orderPrivateCar.getTravelTime()) + ",You spent GHS " + orderPrivateCar.getPayMoney() + " on the trip "); |
| | | Element xcf_english = document.getElementById("xcf_english"); |
| | | xcf_english.text("GHS " + orderPrivateCar.getOrderMoney()); |
| | | Element xj_english = document.getElementById("xj_english"); |
| | | xj_english.text("GHS " + orderPrivateCar.getOrderMoney()); |
| | | Element pay_type_english = document.getElementById("pay_type_english"); |
| | | pay_type_english.text("Cash"); |
| | | Element pay_money_english = document.getElementById("pay_money_english"); |
| | | pay_money_english.text("GHS " + orderPrivateCar.getPayMoney()); |
| | | Element pay_time_english = document.getElementById("pay_time_english"); |
| | | pay_time_english.text(sdf1.format(orderPrivateCar.getEndServiceTime())); |
| | | Element cp_english = document.getElementById("cp_english"); |
| | | cp_english.text("Number Plate:" + car.getCarLicensePlate()); |
| | | Element pf_english = document.getElementById("pf_english"); |
| | | pf_english.text("Driver Rating:" + aDouble); |
| | | Element lc_english = document.getElementById("lc_english"); |
| | | lc_english.text("Mileage:" + aDouble1 + "KM / " + orderPrivateCar.getDuration() + "Minutes"); |
| | | Element start_time_english = document.getElementById("start_time_english"); |
| | | start_time_english.text(sdf2.format(orderPrivateCar.getTravelTime())); |
| | | Element start_address_english = document.getElementById("start_address_english"); |
| | | start_address_english.text(orderPrivateCar.getStartAddress()); |
| | | Element end_time_english = document.getElementById("end_time_english"); |
| | | end_time_english.text(sdf2.format(orderPrivateCar.getEndServiceTime())); |
| | | Element end_address_english = document.getElementById("end_address_english"); |
| | | end_address_english.text(orderPrivateCar.getEndAddress()); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | Element title_french = document.getElementById("title_french"); |
| | | title_french.text("Vous consommez GHS " + orderPrivateCar.getPayMoney() + " sur votre commande i-go1 le " + sdf.format(orderPrivateCar.getTravelTime())); |
| | | Element xcf_french = document.getElementById("xcf_french"); |
| | | xcf_french.text("GHS " + orderPrivateCar.getOrderMoney()); |
| | | Element xj_french = document.getElementById("xj_french"); |
| | | xj_french.text("GHS " + orderPrivateCar.getOrderMoney()); |
| | | Element pay_type_french = document.getElementById("pay_type_french"); |
| | | pay_type_french.text("espèces"); |
| | | Element pay_money_french = document.getElementById("pay_money_french"); |
| | | pay_money_french.text("GHS " + orderPrivateCar.getPayMoney()); |
| | | Element pay_time_french = document.getElementById("pay_time_french"); |
| | | pay_time_french.text(sdf1.format(orderPrivateCar.getEndServiceTime())); |
| | | Element cp_french = document.getElementById("cp_french"); |
| | | cp_french.text("Plaque d’immatriculation:" + car.getCarLicensePlate()); |
| | | Element pf_french = document.getElementById("pf_french"); |
| | | pf_french.text("Évaluation des pilotes: " + aDouble); |
| | | Element lc_french = document.getElementById("lc_french"); |
| | | lc_french.text("Kilométrage: " + aDouble1 + "km / " + orderPrivateCar.getDuration() + "minutes"); |
| | | Element start_time_french = document.getElementById("start_time_french"); |
| | | start_time_french.text(sdf2.format(orderPrivateCar.getTravelTime())); |
| | | Element start_address_french = document.getElementById("start_address_french"); |
| | | start_address_french.text(orderPrivateCar.getStartAddress()); |
| | | Element end_time_french = document.getElementById("end_time_french"); |
| | | end_time_french.text(sdf2.format(orderPrivateCar.getEndServiceTime())); |
| | | Element end_address_french = document.getElementById("end_address_french"); |
| | | end_address_french.text(orderPrivateCar.getEndAddress()); |
| | | } |
| | | |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "专车收据" : language == 2 ? "Private car receipt" : "Reçu de voiture privée", document.html()); |
| | | } |
| | | |
| | | |
| | | // TODO: 2020/5/24 这里需要给司机和用户推送订单状态 |
| | | new Thread(new Runnable() { |
| | | @Override |
| | |
| | | |
| | | } |
| | | String lnt = (null != value ? value.split(",")[0] : "0.0"); |
| | | String lat = (null != value ? value.split(",")[0] : "0.0"); |
| | | String lat = (null != value ? value.split(",")[1] : "0.0"); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderPrivateCar.getStartLat(), orderPrivateCar.getStartLon(), Double.valueOf(lat), Double.valueOf(lnt)); |
| | | String d = "0"; |
| | | String t = "0"; |
| | | if(null == distancematrix){ |
| | | System.err.println("查询距离出错了"); |
| | | }else if(distancematrix.getDistance() == 0){ |
| | | System.err.println("未获取到有效的距离"); |
| | | }else{ |
| | | d = new BigDecimal(distancematrix.getDistance()).divide(new BigDecimal(1000)).setScale(2, BigDecimal.ROUND_HALF_EVEN).toString(); |
| | | t = new BigDecimal(distancematrix.getDuration()).divide(new BigDecimal(60)).setScale(2, BigDecimal.ROUND_HALF_EVEN).intValue() + ""; |
| | | d = new BigDecimal(distancematrix.getDistance()).divide(new BigDecimal(1000), new MathContext(2, RoundingMode.HALF_EVEN)).toString(); |
| | | t = new BigDecimal(distancematrix.getDuration()).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).intValue() + ""; |
| | | } |
| | | OrderServerWarpper orderServerWarpper = new OrderServerWarpper(); |
| | | orderServerWarpper.setOrderId(orderPrivateCar.getId()); |
| | |
| | | distancematrix = GoogleMapUtil.getDistancematrix(Double.valueOf(lat), Double.valueOf(lnt), orderPrivateCar.getEndLat(), orderPrivateCar.getEndLon()); |
| | | if(null == distancematrix){ |
| | | System.err.println("查询距离出错了"); |
| | | }else if(distancematrix.getDistance() == 0){ |
| | | System.err.println("未获取到有效的距离"); |
| | | }else{ |
| | | d = new BigDecimal(distancematrix.getDistance()).divide(new BigDecimal(1000)).setScale(2, BigDecimal.ROUND_HALF_EVEN).toString(); |
| | | t = new BigDecimal(distancematrix.getDuration()).divide(new BigDecimal(60)).setScale(2, BigDecimal.ROUND_HALF_EVEN).intValue() + ""; |
| | | d = new BigDecimal(distancematrix.getDistance()).divide(new BigDecimal(1000), new MathContext(2, RoundingMode.HALF_EVEN)).toString(); |
| | | t = new BigDecimal(distancematrix.getDuration()).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).intValue() + ""; |
| | | } |
| | | orderServerWarpper.setReservationMileage("0"); |
| | | orderServerWarpper.setReservationTime("0"); |
| | |
| | | * @param code |
| | | * @return |
| | | */ |
| | | List<Company> query(@Param("province") String province, @Param("city") String city, @Param("code") String code); |
| | | Company query(@Param("cityIds") List<Integer> cityIds); |
| | | |
| | | |
| | | List<Company> queryList(@Param("city") String[] city, @Param("type") Integer type); |
| | |
| | | */ |
| | | List<Map<String, Object>> queryOrderEvaluate(@Param("driverId") Integer driverId, @Param("pageNum") Integer pageNum, |
| | | @Param("size") Integer size); |
| | | |
| | | |
| | | |
| | | double queryDriverScore(@Param("driverId") Integer driverId); |
| | | } |
| | |
| | | and `type` = #{type} |
| | | </if> |
| | | <if test="null != city"> |
| | | and cityId in (select id from t_city where englishName in |
| | | and cityId in (select id from t_city where chineseName in |
| | | <foreach collection="city" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | or englishName in |
| | | <foreach collection="city" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | or frenchName in |
| | | <foreach collection="city" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | |
| | | |
| | | |
| | | <select id="queryByType" resultType="java.lang.String"> |
| | | select content from t_agreement where `type` = #{type} and flag != 3 |
| | | select content from t_agreement where `type` = #{type} and flag != 3 and `language` = 1 |
| | | <if test="null != useType"> |
| | | and useType = #{useType} |
| | | </if> |
| | |
| | | insertTime as insertTime |
| | | from t_company where flag != 3 and state = 0 and id in ( |
| | | select companyId from t_company_city where state = 1 |
| | | <if test="null != province and null != city and null != code"> |
| | | and provinceCode = #{province} and cityCode = #{city} and areaCode = #{code} |
| | | <if test="null != cityIds"> |
| | | and cityId in |
| | | <foreach collection="cityIds" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != province and null != city and null == code"> |
| | | and provinceCode = #{province} and cityCode = #{city} and (areaCode = '' or areaCode is null) |
| | | </if> |
| | | <if test="null != province and null == city and null == code"> |
| | | and provinceCode = #{province} and (cityCode = '' or cityCode is null) and (areaCode = '' or areaCode is null) |
| | | </if> |
| | | ) |
| | | ) order by `type` desc limit 0, 1 |
| | | </select> |
| | | |
| | | |
| | |
| | | <result column="laveBusinessMoney" property="laveBusinessMoney" /> |
| | | <result column="laveBusinessMoney" property="laveBusinessMoney" /> |
| | | <result column="appletsOpenId" property="appletsOpenId"/> |
| | | <result column="email" property="email"/> |
| | | |
| | | |
| | | <result column="flag" property="flag"/> |
| | |
| | | |
| | | |
| | | <select id="queryIdleDriver_" resultType="Driver"> |
| | | select * from ( |
| | | select |
| | | id as id, |
| | | account as account, |
| | |
| | | ) |
| | | and id in (select driverId from t_driver_orders where `type` = #{type}) |
| | | and carId in (select carId from t_car_service where `type` = #{type} |
| | | |
| | | <if test="null != serverCarModelId"> |
| | | and serverCarModelId = #{serverCarModelId} |
| | | </if> |
| | | ) |
| | | ) as aa where aa.id not in ( |
| | | select driverId from t_order_private_car where isDelete = 1 and driverPay = 1 and state in (7, 8, 9) |
| | | union all |
| | | select driverId from t_order_logistics where isDelete = 1 and driverPay = 1 and state != 10 |
| | | ) |
| | | </select> |
| | | |
| | | |
| | |
| | | select |
| | | (money * -1) as money, |
| | | DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i') as time, |
| | | orderType, |
| | | CONCAT(if(orderType = 1, '专车', if(orderType = 2, '出租车', if(orderType = 3, '跨城', if(orderType = 4, '同城小件物流', if(orderType = 5, '跨城小件物流', '包车'))))), '订单取消') as name, |
| | | UNIX_TIMESTAMP(insertTime) as insertTime |
| | | from t_order_cancel where state = 2 and userType = 1 and money is not null and userId = #{uid} |
| | |
| | | fraction as fraction |
| | | from t_order_evaluate where driverId = #{driverId} and unix_timestamp(insertTime) < unix_timestamp(now()) - 86400 order by insertTime desc limit #{pageNum}, #{size} |
| | | </select> |
| | | |
| | | |
| | | <select id="queryDriverScore" resultType="double"> |
| | | select ifnull(max(fraction), 0) as fraction from ( |
| | | select ROUND(ifnull(sum(fraction), 0) / count(1), 1) as fraction from t_order_evaluate where driverId = #{driverId} group by driverId |
| | | ) as aa |
| | | </select> |
| | | </mapper> |
| | |
| | | <select id="queryList" resultType="map"> |
| | | select |
| | | id as id, |
| | | '系统提示' as title, |
| | | noticeType as noticeType, |
| | | `type` as `type`, |
| | | content as content, |
| | |
| | | c.couponType as ccouponType, |
| | | d.couponType as dcouponType, |
| | | e.couponType as ecouponType, |
| | | DATE_FORMAT(a.startTime, '%Y-%m-%d') as startTime, |
| | | DATE_FORMAT(a.endTime, '%Y-%m-%-d') as endTime, |
| | | a.effective as beffective, |
| | | a.effective as ceffective, |
| | | a.effective as deffective, |
| | |
| | | a.userActivityId as userActivityId, |
| | | a.couponId as couponId, |
| | | a.totalNum as totalNum, |
| | | a.startTime as startTime, |
| | | a.endTime as endTime, |
| | | DATE_FORMAT(a.startTime, '%Y-%m-%d') as startTime, |
| | | DATE_FORMAT(a.endTime, '%Y-%m-%-d') as endTime, |
| | | a.enable as enable, |
| | | a.effective as effective, |
| | | c.money as money, |
| | |
| | | a.couponId as couponId, |
| | | a.totalNum as totalNum, |
| | | a.laveNum as laveNum, |
| | | a.startTime as startTime, |
| | | a.endTime as endTime, |
| | | DATE_FORMAT(a.startTime, '%Y-%m-%d') as startTime, |
| | | DATE_FORMAT(a.endTime, '%Y-%m-%-d') as endTime, |
| | | a.`enable` as `enable`, |
| | | b.money as money, |
| | | b.fullMoney as fullMoney, |
| | |
| | | <result column="emergencyContact" property="emergencyContact"/> |
| | | <result column="emergencyContactNumber" property="emergencyContactNumber"/> |
| | | <result column="isAuth" property="isAuth"/> |
| | | <result column="name" property="name"/> |
| | | <result column="lastName" property="lastName"/> |
| | | <result column="firstName" property="firstName"/> |
| | | <result column="idCard" property="idCard"/> |
| | | <result column="idCardFront" property="idCardFront"/> |
| | | <result column="idCardReverse" property="idCardReverse"/> |
| | |
| | | avatar as avatar, |
| | | birthday as birthday, |
| | | sex as sex, |
| | | email, |
| | | emergencyContact as emergencyContact, |
| | | emergencyContactNumber as emergencyContactNumber, |
| | | isAuth as isAuth, |
| | | name as name, |
| | | lastName as lastName, |
| | | firstName as firstName, |
| | | idCard as idCard, |
| | | idCardFront as idCardFront, |
| | | idCardReverse as idCardReverse, |
| | |
| | | avatar as avatar, |
| | | birthday as birthday, |
| | | sex as sex, |
| | | email, |
| | | emergencyContact as emergencyContact, |
| | | emergencyContactNumber as emergencyContactNumber, |
| | | isAuth as isAuth, |
| | | name as name, |
| | | lastName as lastName, |
| | | firstName as firstName, |
| | | idCard as idCard, |
| | | idCardFront as idCardFront, |
| | | idCardReverse as idCardReverse, |
| | |
| | | avatar as avatar, |
| | | birthday as birthday, |
| | | sex as sex, |
| | | email, |
| | | emergencyContact as emergencyContact, |
| | | emergencyContactNumber as emergencyContactNumber, |
| | | isAuth as isAuth, |
| | | name as name, |
| | | lastName as lastName, |
| | | firstName as firstName, |
| | | idCard as idCard, |
| | | idCardFront as idCardFront, |
| | | idCardReverse as idCardReverse, |
| | |
| | | avatar as avatar, |
| | | birthday as birthday, |
| | | sex as sex, |
| | | email, |
| | | emergencyContact as emergencyContact, |
| | | emergencyContactNumber as emergencyContactNumber, |
| | | isAuth as isAuth, |
| | | name as name, |
| | | lastName as lastName, |
| | | firstName as firstName, |
| | | idCard as idCard, |
| | | idCardFront as idCardFront, |
| | | idCardReverse as idCardReverse, |
| | |
| | | a.id as id, |
| | | a.phone as phone, |
| | | a.email as email, |
| | | a.lastName as lastName, |
| | | a.firstName as firstName, |
| | | a.nickName as nickName, |
| | | a.avatar as avatar, |
| | | DATE_FORMAT(a.birthday, '%Y-%m-%d') as birthday, |
| | | a.sex as sex, |
| | | a.isAuth as isAuth, |
| | | (select state from t_verified where userId = a.id order by insertTime desc limit 0,1) as verified, |
| | | a.name as name, |
| | | a.integral as integral, |
| | | a.emergencyContact as emergencyContact, |
| | | a.emergencyContactNumber as emergencyContactNumber, |
| | |
| | | select |
| | | id as id, |
| | | userId as userId, |
| | | name as name, |
| | | lastName as lastName, |
| | | firstName as firstName, |
| | | idcode as idcode, |
| | | img1 as img1, |
| | | img2 as img2, |
| | |
| | | select |
| | | id as id, |
| | | phone as phone, |
| | | IFNULL(name,nickName) as name, |
| | | IFNULL(lastName,nickName) as name, |
| | | avatar as avatar, |
| | | DATE_FORMAT(insertTime,'%Y/%m/%d %H:%i') as insertTime |
| | | from t_user |
| | |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.Verified"> |
| | | <id column="id" property="id"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="name" property="name"/> |
| | | <result column="lastName" property="lastName"/> |
| | | <result column="firstName" property="firstName"/> |
| | | <result column="idcode" property="idcode"/> |
| | | <result column="img1" property="img1"/> |
| | | <result column="img2" property="img2"/> |
| | |
| | | @TableField("driveCard") |
| | | private String driveCard; |
| | | /** |
| | | * 驾驶证照片 |
| | | * 驾驶证照片正面 |
| | | */ |
| | | @TableField("driveCardImgUrl") |
| | | private String driveCardImgUrl; |
| | | @TableField("driveCardImgUrl1") |
| | | private String driveCardImgUrl1; |
| | | /** |
| | | * 驾驶证照片背面 |
| | | */ |
| | | @TableField("driveCardImgUrl2") |
| | | private String driveCardImgUrl2; |
| | | /** |
| | | * 准驾车型 |
| | | */ |
| | |
| | | */ |
| | | @TableField("appletsOpenId") |
| | | private String appletsOpenId; |
| | | /** |
| | | * 邮件 |
| | | */ |
| | | @TableField("email") |
| | | private String email; |
| | | |
| | | public String getAccount() { |
| | | return account; |
| | |
| | | this.driveCard = driveCard; |
| | | } |
| | | |
| | | public String getDriveCardImgUrl() { |
| | | return driveCardImgUrl; |
| | | public String getDriveCardImgUrl1() { |
| | | return driveCardImgUrl1; |
| | | } |
| | | |
| | | public void setDriveCardImgUrl(String driveCardImgUrl) { |
| | | this.driveCardImgUrl = driveCardImgUrl; |
| | | public void setDriveCardImgUrl1(String driveCardImgUrl1) { |
| | | this.driveCardImgUrl1 = driveCardImgUrl1; |
| | | } |
| | | |
| | | public String getDriveCardImgUrl2() { |
| | | return driveCardImgUrl2; |
| | | } |
| | | |
| | | public void setDriveCardImgUrl2(String driveCardImgUrl2) { |
| | | this.driveCardImgUrl2 = driveCardImgUrl2; |
| | | } |
| | | |
| | | public String getDriverType() { |
| | |
| | | this.appletsOpenId = appletsOpenId; |
| | | } |
| | | |
| | | public String getEmail() { |
| | | return email; |
| | | } |
| | | |
| | | public void setEmail(String email) { |
| | | this.email = email; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "Driver{" + |
| | |
| | | ", driverContactAddress='" + driverContactAddress + '\'' + |
| | | ", driverAge=" + driverAge + |
| | | ", driveCard='" + driveCard + '\'' + |
| | | ", driveCardImgUrl='" + driveCardImgUrl + '\'' + |
| | | ", driverType='" + driverType + '\'' + |
| | | ", getDriverLicenseDate=" + getDriverLicenseDate + |
| | | ", driverLicenseOn=" + driverLicenseOn + |
| | |
| | | @TableField("isAuth") |
| | | private Integer isAuth; |
| | | /** |
| | | * 真实姓名 |
| | | * 姓氏 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | @TableField("lastName") |
| | | private String lastName; |
| | | /** |
| | | * 名字 |
| | | */ |
| | | @TableField("firstName") |
| | | private String firstName; |
| | | /** |
| | | * 身份证号码 |
| | | */ |
| | |
| | | this.isAuth = isAuth; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | public String getLastName() { |
| | | return lastName; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | public void setLastName(String lastName) { |
| | | this.lastName = lastName; |
| | | } |
| | | |
| | | public String getFirstName() { |
| | | return firstName; |
| | | } |
| | | |
| | | public void setFirstName(String firstName) { |
| | | this.firstName = firstName; |
| | | } |
| | | |
| | | public String getIdCard() { |
| | |
| | | ", emergencyContact='" + emergencyContact + '\'' + |
| | | ", emergencyContactNumber='" + emergencyContactNumber + '\'' + |
| | | ", isAuth=" + isAuth + |
| | | ", name='" + name + '\'' + |
| | | ", idCard='" + idCard + '\'' + |
| | | ", idCardFront='" + idCardFront + '\'' + |
| | | ", idCardReverse='" + idCardReverse + '\'' + |
| | |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 认证姓名 |
| | | * 姓氏 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | @TableField("lastName") |
| | | private String lastName; |
| | | /** |
| | | * 名字 |
| | | */ |
| | | @TableField("firstName") |
| | | private String firstName; |
| | | /** |
| | | * 身份证号码 |
| | | */ |
| | |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | public String getLastName() { |
| | | return lastName; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | public void setLastName(String lastName) { |
| | | this.lastName = lastName; |
| | | } |
| | | |
| | | public String getFirstName() { |
| | | return firstName; |
| | | } |
| | | |
| | | public void setFirstName(String firstName) { |
| | | this.firstName = firstName; |
| | | } |
| | | |
| | | public String getIdcode() { |
| | |
| | | return "Verified{" + |
| | | "id=" + id + |
| | | ", userId=" + userId + |
| | | ", name='" + name + '\'' + |
| | | ", idcode='" + idcode + '\'' + |
| | | ", img1='" + img1 + '\'' + |
| | | ", img2='" + img2 + '\'' + |
| | |
| | | public interface ICompanyCityService extends IService<CompanyCity> { |
| | | |
| | | |
| | | /** |
| | | * 根据经纬度获取所属企业 |
| | | * @param lon |
| | | * @param lat |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | Company query(String lon, String lat) throws Exception; |
| | | |
| | | |
| | | Company query1(String lon, String lat) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 根据行政编号获取所有企业 |
| | | * @param code |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | Company query(String code) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<BaseWarpper> queryBusiness(Integer uid) throws Exception; |
| | | List<BaseWarpper> queryBusiness(Integer uid, Integer language) throws Exception; |
| | | } |
| | |
| | | * @param content |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil saveData(Integer orderId, Integer orderType, Integer fraction, String content) throws Exception; |
| | | ResultUtil saveData(Integer orderId, Integer orderType, Integer fraction, String content, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryOrderEvaluate(Integer driverId, Integer pageNum, Integer size) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取司机评分 |
| | | * @param driverId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | Double queryDriverScore(Integer driverId) throws Exception; |
| | | } |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil weChatPay(Integer orderId, Integer orderType, Integer type, Integer userType, Integer uid, String content) throws Exception; |
| | | ResultUtil weChatPay(Integer orderId, Integer orderType, Integer type, Integer userType, Integer uid, String content, Integer language) throws Exception; |
| | | } |
| | |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryList(Integer type, Integer pageNum, Integer size, Integer uid); |
| | | List<Map<String, Object>> queryList(Integer type, Integer pageNum, Integer size, Integer uid, Integer language); |
| | | |
| | | |
| | | /** |
| | |
| | | * @param uType 分享用户的类别1:用户,2:司机 |
| | | * @return |
| | | */ |
| | | ResultUtil<LoginWarpper> captchaLogin(String phone, String code, String registIp, String registAreaCode,Integer uid,Integer uType, Integer userType) throws Exception; |
| | | ResultUtil<LoginWarpper> captchaLogin(String phone, String code, String registIp, Double lat, Double lng,Integer uid,Integer uType, Integer userType, Integer language) throws Exception; |
| | | |
| | | |
| | | |
| | | ResultUtil<LoginWarpper> captchaLogin(String phone, String code, Integer uid, Integer type, Integer userType) throws Exception; |
| | | ResultUtil<LoginWarpper> captchaLogin(String phone, String code, Integer uid, Integer type, Integer userType, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil<LoginWarpper> userLogin(String phone, String password) throws Exception; |
| | | ResultUtil<LoginWarpper> userLogin(String phone, String password, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @param registAreaCode 当前定位区县行政编号(6位) |
| | | * @return |
| | | */ |
| | | ResultUtil<LoginWarpper> wxLogin(Integer type, String openid, String unionid, String jscode, String registIp, String registAreaCode, Integer sex, String nickName, String avatar,String loginType,String encryptedData, String iv,Integer uid) throws Exception; |
| | | ResultUtil<LoginWarpper> wxLogin(Integer type, String openid, String unionid, String jscode, String registIp, String registAreaCode, |
| | | Integer sex, String nickName, String avatar,String loginType,String encryptedData, String iv,Integer uid, Integer language) throws Exception; |
| | | ResultUtil<LoginWarpper> wxIsLogin( String jscode) throws Exception; |
| | | |
| | | |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil facebookLogin(String id, String name, String email, String registAreaCode, Integer uid) throws Exception; |
| | | ResultUtil facebookLogin(String id, String name, String email, Double lat, Double lng, Integer uid, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil forgetPassword(String phone, String code, String password) throws Exception; |
| | | ResultUtil forgetPassword(String phone, String code, String password, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil bindingPhone(Integer uid, String phone, String code) throws Exception; |
| | | ResultUtil bindingPhone(Integer uid, String phone, String code, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil bindingEmail(Integer uid, Integer type, String email, String code) throws Exception; |
| | | ResultUtil bindingEmail(Integer uid, Integer type, String email, String code, Integer language) throws Exception; |
| | | |
| | | |
| | | |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil depositBalance(Integer payType, Double money, Integer uid, Integer type) throws Exception; |
| | | ResultUtil depositBalance(Integer payType, String accountNumber, Double money, Integer uid, Integer type, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil updatePhone(String code, String phone, Integer uid) throws Exception; |
| | | ResultUtil updatePhone(String code, String phone, Integer uid, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil updatePass(String password, Integer uid) throws Exception; |
| | | ResultUtil updatePass(String password, Integer uid, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @param uid |
| | | * @throws Exception |
| | | */ |
| | | void updateInfo(String avatar, String nickname, Integer sex, Date birthday, Integer uid) throws Exception; |
| | | void updateInfo(String avatar, String nickname, Integer sex, Date birthday, String email, String lastName, String firstName, Integer uid) throws Exception; |
| | | |
| | | /** |
| | | * 获取实名认证数据 |
| | |
| | | * @param type 支付类型(1=微信,2=支付宝) |
| | | * @throws Exception |
| | | */ |
| | | void payCancelUserBalance(Integer id, String order_id, Integer paymentRecordId, Integer type) throws Exception; |
| | | void payCancelUserBalance(Integer id, String order_id, Integer paymentRecordId, Integer type, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryWithdrawal(Integer uid, Integer pageNum, Integer size) throws Exception; |
| | | List<Map<String, Object>> queryWithdrawal(Integer uid, Integer pageNum, Integer size, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.CompanyCityMapper; |
| | | import com.stylefeng.guns.modular.system.dao.CompanyMapper; |
| | | import com.stylefeng.guns.modular.system.model.City; |
| | | import com.stylefeng.guns.modular.system.model.Company; |
| | | import com.stylefeng.guns.modular.system.model.CompanyCity; |
| | | import com.stylefeng.guns.modular.system.service.ICityService; |
| | | import com.stylefeng.guns.modular.system.service.ICompanyCityService; |
| | | import com.stylefeng.guns.modular.system.util.GDMapGeocodingUtil; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.AddressComponentsVo; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | @Service |
| | |
| | | private CompanyMapper companyMapper; |
| | | |
| | | @Autowired |
| | | private GDMapGeocodingUtil gdMapGeocodingUtil; |
| | | private ICityService cityService; |
| | | |
| | | |
| | | /** |
| | | * 根据经纬度获取所属企业 |
| | | * @param lon |
| | | * @param lat |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public Company query(String lon, String lat) throws Exception { |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(String.valueOf(lon), String.valueOf(lat)); |
| | | String districtCode = geocode.get("districtCode"); |
| | | Company query = this.query(districtCode); |
| | | return query; |
| | | } |
| | | |
| | | |
| | | @Override |
| | |
| | | return null; |
| | | } |
| | | AddressComponentsVo[] addressComponentsVos = reverseGeocode.getAddressComponentsVos(); |
| | | String[] city = new String[addressComponentsVos.length]; |
| | | String[] citys = new String[addressComponentsVos.length]; |
| | | for (int i = 0; i < addressComponentsVos.length; i++) { |
| | | city[i] = addressComponentsVos[i].getLongName(); |
| | | citys[i] = addressComponentsVos[i].getLongName(); |
| | | } |
| | | Company query = this.query(city); |
| | | Company query = this.query(citys); |
| | | return query; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据行政编号获取所属企业 |
| | | * @param code |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public Company query(String code) throws Exception { |
| | | String province = code.substring(0, 2) + "0000"; |
| | | String city = code.substring(0, 4) + "00"; |
| | | List<Company> query = companyMapper.query(province, city, code); |
| | | if(query.size() == 0){ |
| | | query = companyMapper.query(province, city, null); |
| | | } |
| | | if(query.size() == 0){ |
| | | query = companyMapper.query(province, null, null); |
| | | } |
| | | for(int i = 3; i > 0; i--){ |
| | | for(Company company : query){ |
| | | if(company.getType() == i){ |
| | | return company; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Company query(String[] city) throws Exception { |
| | | List<Company> query = companyMapper.queryList(city, 3); |
| | | if(query.size() == 0){ |
| | | query = companyMapper.queryList(city, 2); |
| | | } |
| | | if(query.size() == 0){ |
| | | query = companyMapper.queryList(city, 1); |
| | | } |
| | | if(query.size() > 0){ |
| | | return query.get(0); |
| | | } |
| | | return null; |
| | | List<City> cities = cityService.selectList(new EntityWrapper<City>().in("chineseName", Arrays.asList(city)).or() |
| | | .in("englishName", Arrays.asList(city)).or().in("frenchName", Arrays.asList(city))); |
| | | List<Integer> collect = cities.stream().map(City::getId).collect(Collectors.toList()); |
| | | return companyMapper.query(collect); |
| | | } |
| | | } |
| | |
| | | import com.stylefeng.guns.modular.system.dao.SensitiveWordsMapper; |
| | | import com.stylefeng.guns.modular.system.model.Complaint; |
| | | import com.stylefeng.guns.modular.system.model.SensitiveWords; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.service.IComplaintService; |
| | | import com.stylefeng.guns.modular.system.service.ISystemNoticeService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.EmailUtil; |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.nodes.Element; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | @Value("${spring.mail.template-path}") |
| | | private String templatePath; |
| | | |
| | | |
| | | |
| | |
| | | complaint.setIsHandle(0); |
| | | this.insert(complaint); |
| | | |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/complaint.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | if(language == 1){ |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element chinese_user = document.getElementById("chinese_user"); |
| | | chinese_user.text("您好 " + userInfo.getNickName() + ","); |
| | | } |
| | | if(language == 2){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element english_user = document.getElementById("english_user"); |
| | | english_user.text("Hello " + userInfo.getNickName() + ","); |
| | | } |
| | | if(language == 3){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | Element french_user = document.getElementById("french_user"); |
| | | french_user.text("Bonjour " + userInfo.getNickName() + ","); |
| | | } |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "投诉司机" : language == 2 ? "Complain Driver" : "Se plaindre du conducteur", document.html()); |
| | | } |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您的投诉已提交成功,我们会尽快处理!" : language == 2 ? "Your complaint has been submitted successfully and we will deal with it as soon as possible" : "Votre plainte a été soumise avec succès et nous la traiterons dès que possible", uid, 1); |
| | | } |
| | | } |
| | |
| | | for(Driver driver : drivers){ |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(driver.getId())); |
| | | if(null != value){ |
| | | /*Map<String, String> distance1 = gdMapElectricFenceUtil.getDistance(lon + "," + lat, value, 0);//计算距离 |
| | | double d = Double.valueOf(distance1.get("distance")).doubleValue();*/ |
| | | // double d = GDMapGeocodingUtil.getDistance(lat,lon,Double.parseDouble(value.split(",")[1]),Double.parseDouble(value.split(",")[0])); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(lat, lon, Double.parseDouble(value.split(",")[1]), Double.parseDouble(value.split(",")[0])); |
| | | if(distancematrix.getDistance() < (distance * 1000)){ |
| | | list.add(driver); |
| | |
| | | for(Driver driver : drivers){ |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(driver.getId())); |
| | | if(null != value){ |
| | | /*Map<String, String> distance1 = gdMapElectricFenceUtil.getDistance(lon + "," + lat, value, 0);//计算距离 |
| | | double d = Double.valueOf(distance1.get("distance")).doubleValue();*/ |
| | | double d = GDMapGeocodingUtil.getDistance(lat,lon,Double.parseDouble(value.split(",")[1]),Double.parseDouble(value.split(",")[0])); |
| | | if(d < (distance * 1000)){ |
| | | list.add(driver); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(lat, lon, Double.parseDouble(value.split(",")[1]), Double.parseDouble(value.split(",")[0])); |
| | | if(null != distancematrix){ |
| | | if(distancematrix.getDistance() < (distance * 1000)){ |
| | | list.add(driver); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | return list; |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<BaseWarpper> queryBusiness(Integer uid) throws Exception { |
| | | public List<BaseWarpper> queryBusiness(Integer uid, Integer language) throws Exception { |
| | | List<DriverService> list = driverServiceMapper.queryBusiness(uid, null); |
| | | List<BaseWarpper> maps = new ArrayList<>(); |
| | | for (DriverService d : list){ |
| | |
| | | baseWarpper.setId(d.getType()); |
| | | switch (d.getType()){ |
| | | case 1: |
| | | baseWarpper.setName("专车"); |
| | | baseWarpper.setName(language == 1 ? "专车" : language == 2 ? "Private car" : "véhicules"); |
| | | break; |
| | | case 2: |
| | | baseWarpper.setName("出租车"); |
| | |
| | | baseWarpper.setName("跨城出行"); |
| | | break; |
| | | case 4: |
| | | baseWarpper.setName("同城小件物流"); |
| | | baseWarpper.setName(language == 1 ? "市内小件物流" : language == 2 ? "Small parts logistics in the city" : "Logistique de petites pièces dans la ville"); |
| | | break; |
| | | case 5: |
| | | baseWarpper.setName("跨城小件物流"); |
| | |
| | | import com.stylefeng.guns.modular.system.dao.SensitiveWordsMapper; |
| | | import com.stylefeng.guns.modular.system.model.Feedback; |
| | | import com.stylefeng.guns.modular.system.model.SensitiveWords; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.service.IFeedbackService; |
| | | import com.stylefeng.guns.modular.system.service.ISystemNoticeService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.EmailUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.nodes.Element; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | @Value("${spring.mail.template-path}") |
| | | private String templatePath; |
| | | |
| | | |
| | | |
| | |
| | | feedback.setUserId(uid); |
| | | this.insert(feedback); |
| | | |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/feedback.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | if(1 == language){ |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element user_chinese = document.getElementById("user_chinese"); |
| | | user_chinese.text("您好 " + userInfo.getNickName() + ","); |
| | | } |
| | | if(2 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element user_english = document.getElementById("user_english"); |
| | | user_english.text("Hello " + userInfo.getNickName() + ","); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | Element user_french = document.getElementById("user_french"); |
| | | user_french.text("Bonjour " + userInfo.getNickName() + ","); |
| | | } |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "反馈意见" : language == 2 ? "Feedback" : "Retour", document.html()); |
| | | } |
| | | |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您的反馈已提交成功,我们会尽快处理!" : language == 2 ? "Your feedback has been submitted successfully, we will deal with it as soon as possible" |
| | | : "Vos commentaires ont été soumis avec succès, nous les traiterons dès que possible", uid, 1); |
| | | return ResultUtil.success(); |
| | |
| | | */ |
| | | @Override |
| | | public List<BaseWarpper> queryOpenCity(Integer uid, Integer language) throws Exception { |
| | | if(null != uid){ |
| | | if(null == language && null != uid){ |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | language = userInfo.getLanguage(); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public String openCity(Double lat, Double lnt, Integer language) throws Exception { |
| | | if(null == language){ |
| | | language = 2; |
| | | } |
| | | ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(lat, lnt); |
| | | if(null == reverseGeocode){ |
| | | return ""; |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil saveData(Integer orderId, Integer orderType, Integer fraction, String content) throws Exception { |
| | | public ResultUtil saveData(Integer orderId, Integer orderType, Integer fraction, String content, Integer language) throws Exception { |
| | | if(ToolUtil.isNotEmpty(content)){ |
| | | if(null != content && content.length() > 500){ |
| | | return ResultUtil.error("评价内容过长"); |
| | | return ResultUtil.error(language == 1 ? "评价内容过长" : language == 2 ? "The evaluation is too long" : "Contenu trop long de l’évaluation"); |
| | | } |
| | | List<SensitiveWords> sensitiveWords = sensitiveWordsMapper.selectList(null); |
| | | for(SensitiveWords s : sensitiveWords){ |
| | |
| | | orderEvaluate.setUserId(uid); |
| | | this.insert(orderEvaluate); |
| | | |
| | | systemNoticeService.addSystemNotice(1, "您已成功添加订单评价,谢谢使用!", uid, 1); |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功添加订单评价,谢谢使用!" : language == 2 ? "You have successfully added the order evaluation, thank you for using!" : "Vous avez ajouté une évaluation de commande avec succès. Merci d’utiliser!", uid, 1); |
| | | return ResultUtil.success(orderEvaluate.getId()); |
| | | } |
| | | |
| | |
| | | pageNum = (pageNum - 1) * size; |
| | | return orderEvaluateMapper.queryOrderEvaluate(driverId, pageNum, size); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Double queryDriverScore(Integer driverId) throws Exception { |
| | | return this.baseMapper.queryDriverScore(driverId); |
| | | } |
| | | } |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil weChatPay(Integer orderId, Integer orderType, Integer type, Integer userType, Integer uid, String content) throws Exception { |
| | | public ResultUtil weChatPay(Integer orderId, Integer orderType, Integer type, Integer userType, Integer uid, String content, Integer language) throws Exception { |
| | | JSONObject jsonObject = JSON.parseObject(content); |
| | | switch (type){ |
| | | case 1://订单完成支付 |
| | | switch (orderType){ |
| | | case 1: |
| | | return orderPrivateCarService.payPrivateCarOrder(1, orderId, (null == jsonObject ? null : jsonObject.getIntValue("couponId")), 3); |
| | | case 2: |
| | | return orderTaxiService.payTaxiOrder(1, orderId, (null == jsonObject ? null : jsonObject.getIntValue("couponId")), 3); |
| | | case 3: |
| | | return orderCrossCityService.payCrossCityOrder(1, orderId, (null == jsonObject ? null : jsonObject.getIntValue("couponId")), 3); |
| | | case 4: |
| | | return orderLogisticsService.payLogisticsOrder(1, orderId, 3); |
| | | case 5: |
| | | return orderLogisticsService.payLogisticsOrder(1, orderId, 3); |
| | | } |
| | | // switch (orderType){ |
| | | // case 1: |
| | | // return orderPrivateCarService.payPrivateCarOrder(1, orderId, (null == jsonObject ? null : jsonObject.getIntValue("couponId")), 3, 1); |
| | | // case 2: |
| | | // return orderTaxiService.payTaxiOrder(1, orderId, (null == jsonObject ? null : jsonObject.getIntValue("couponId")), 3); |
| | | // case 3: |
| | | // return orderCrossCityService.payCrossCityOrder(1, orderId, (null == jsonObject ? null : jsonObject.getIntValue("couponId")), 3); |
| | | // case 4: |
| | | // return orderLogisticsService.payLogisticsOrder(1, orderId, 3, 1); |
| | | // case 5: |
| | | // return orderLogisticsService.payLogisticsOrder(1, orderId, 3, 1); |
| | | // } |
| | | case 2://订单取消支付 |
| | | switch (orderType){ |
| | | case 1: |
| | | return orderPrivateCarService.cancleOrderPrivateCar(orderId, 1, null == jsonObject ? null : jsonObject.getIntValue("cancelId"), 3); |
| | | // return orderPrivateCarService.cancleOrderPrivateCar(orderId, 1, null == jsonObject ? null : jsonObject.getIntValue("cancelId"), 3); |
| | | case 2: |
| | | return orderTaxiService.cancleOrderTaxi(orderId, 1, null == jsonObject ? null : jsonObject.getIntValue("cancelId"), 3); |
| | | return orderTaxiService.cancleOrderTaxi(orderId, 1, null == jsonObject ? null : jsonObject.getIntValue("cancelId"), 3, language); |
| | | case 3: |
| | | return orderCrossCityService.cancleOrderCrossCity(orderId, 1, null == jsonObject ? null : jsonObject.getIntValue("cancelId"), 3); |
| | | return orderCrossCityService.cancleOrderCrossCity(orderId, 1, null == jsonObject ? null : jsonObject.getIntValue("cancelId"), 3, language); |
| | | } |
| | | |
| | | case 3://司机端改派支付 |
| | |
| | | return ResultUtil.success(jsonObject1.getString("msg"), jsonObject1.getString("data")); |
| | | case 4://余额充值 |
| | | if(userType == 1){ |
| | | return userInfoService.depositBalance(1, jsonObject.getDoubleValue("money"), uid, 3); |
| | | // return userInfoService.depositBalance(1, jsonObject.getDoubleValue("money"), uid, 3, 1); |
| | | } |
| | | if(userType == 2){ |
| | | |
| | | } |
| | | case 5://小件物流补差价 |
| | | return orderLogisticsService.payLogisticsOrder_(1, orderId, 3); |
| | | // return orderLogisticsService.payLogisticsOrder_(1, orderId, 3); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.dao.ReportLossMapper; |
| | | import com.stylefeng.guns.modular.system.model.ReportLoss; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.service.IReportLossService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.EmailUtil; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.nodes.Element; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.io.File; |
| | | import java.util.Date; |
| | | |
| | | @Service |
| | |
| | | |
| | | @Autowired |
| | | private IOrderLogisticsService orderLogisticsService; |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | @Value("${spring.mail.template-path}") |
| | | private String templatePath; |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void addReportLoss(Integer orderType, Integer orderId, String remark, String image) throws Exception { |
| | |
| | | break; |
| | | } |
| | | this.insert(reportLoss); |
| | | |
| | | UserInfo userInfo = userInfoService.selectById(reportLoss.getUserId()); |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/reportLoss.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element english_user = document.getElementById("english_user"); |
| | | english_user.text("Hello " + userInfo.getNickName() + ","); |
| | | EmailUtil.send(userInfo.getEmail(), "Report loss of goods", document.html()); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | } |
| | |
| | | } |
| | | Double slnt = Double.valueOf(startLonLat.split(",")[0]); |
| | | Double slat = Double.valueOf(startLonLat.split(",")[1]); |
| | | Double elnt = Double.valueOf(startLonLat.split(",")[0]); |
| | | Double elat = Double.valueOf(startLonLat.split(",")[1]); |
| | | Double elnt = Double.valueOf(endLonLat.split(",")[0]); |
| | | Double elat = Double.valueOf(endLonLat.split(",")[1]); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(slat, slnt, elat, elnt); |
| | | if(null == distancematrix){ |
| | | return ResultUtil.error(language == 1 ? "获取预估距离出错" : language == 2 ? "Error getting estimated distance" : "Erreur lors de l'obtention de la distance estimée", new ArrayList<>()); |
| | | }else if(distancematrix.getDistance() == 0){ |
| | | return ResultUtil.error(language == 1 ? "未获取到有效的距离" : language == 2 ? "A valid distance was not obtained" : "La distance effective n’est pas acquise", new ArrayList<>()); |
| | | } |
| | | long distance1 = distancematrix.getDistance();//距离(米) |
| | | double distance1_ = Double.valueOf(distance1).doubleValue(); |
| | |
| | | |
| | | |
| | | //夜间服务处理逻辑 |
| | | Calendar s = Calendar.getInstance(); |
| | | s.setTime(date); |
| | | s.set(Calendar.HOUR_OF_DAY, Integer.valueOf(num16.split(" - ")[0].split(":")[0])); |
| | | s.set(Calendar.MINUTE, Integer.valueOf(num16.split(" - ")[0].split(":")[1])); |
| | | |
| | | Calendar e = Calendar.getInstance(); |
| | | e.setTime(date); |
| | | e.set(Calendar.HOUR_OF_DAY, Integer.valueOf(num16.split(" - ")[1].split(":")[0])); |
| | | e.set(Calendar.MINUTE, Integer.valueOf(num16.split(" - ")[1].split(":")[1])); |
| | | |
| | | if(date.getTime() > s.getTimeInMillis() && date.getTime() < e.getTimeInMillis()){ |
| | | if(d > num8.doubleValue()){ |
| | | yt1 = num20 * (num9 - num8); |
| | | } |
| | | if(d > num11.doubleValue()){ |
| | | yt2 = num21 * (num12 - num11); |
| | | } |
| | | if(d > num14.doubleValue()){ |
| | | yt3 = num22 * (d - num14); |
| | | } |
| | | amount = num17 + (d1 * num18) + (t1 * num19) + (wait * num7) + yt1 + yt2 + yt3; |
| | | ServerCarModelWarpper serverCarModelWarpper = ServerCarModelWarpper.getServerCarModelWarpper(map); |
| | | serverCarModelWarpper.setAmount(new BigDecimal(amount).setScale(BigDecimal.ROUND_HALF_EVEN, 2).doubleValue()); |
| | | serverCarModelWarpper.setMileage(d); |
| | | serverCarModelWarpper.setDuration(t); |
| | | data.add(serverCarModelWarpper); |
| | | continue; |
| | | } |
| | | // Calendar s = Calendar.getInstance(); |
| | | // s.setTime(date); |
| | | // s.set(Calendar.HOUR_OF_DAY, Integer.valueOf(num16.split(" - ")[0].split(":")[0])); |
| | | // s.set(Calendar.MINUTE, Integer.valueOf(num16.split(" - ")[0].split(":")[1])); |
| | | // |
| | | // Calendar e = Calendar.getInstance(); |
| | | // e.setTime(date); |
| | | // e.set(Calendar.HOUR_OF_DAY, Integer.valueOf(num16.split(" - ")[1].split(":")[0])); |
| | | // e.set(Calendar.MINUTE, Integer.valueOf(num16.split(" - ")[1].split(":")[1])); |
| | | // |
| | | // if(date.getTime() > s.getTimeInMillis() && date.getTime() < e.getTimeInMillis()){ |
| | | // if(d > num8.doubleValue()){ |
| | | // yt1 = num20 * (num9 - num8); |
| | | // } |
| | | // if(d > num11.doubleValue()){ |
| | | // yt2 = num21 * (num12 - num11); |
| | | // } |
| | | // if(d > num14.doubleValue()){ |
| | | // yt3 = num22 * (d - num14); |
| | | // } |
| | | // amount = num17 + (d1 * num18) + (t1 * num19) + (wait * num7) + yt1 + yt2 + yt3; |
| | | // ServerCarModelWarpper serverCarModelWarpper = ServerCarModelWarpper.getServerCarModelWarpper(map); |
| | | // serverCarModelWarpper.setAmount(new BigDecimal(amount).setScale(BigDecimal.ROUND_HALF_EVEN, 2).doubleValue()); |
| | | // serverCarModelWarpper.setMileage(d); |
| | | // serverCarModelWarpper.setDuration(t); |
| | | // data.add(serverCarModelWarpper); |
| | | // continue; |
| | | // } |
| | | |
| | | |
| | | //高峰时段处理逻辑 |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryList(Integer type, Integer pageNum, Integer size, Integer uid) { |
| | | public List<Map<String, Object>> queryList(Integer type, Integer pageNum, Integer size, Integer uid, Integer language) { |
| | | pageNum = (pageNum - 1) * size; |
| | | List<Map<String, Object>> list = null; |
| | | if(type == 1){//系统公告 |
| | |
| | | if(type == 2){//系统消息 |
| | | list = systemNoticeMapper.queryList(type, pageNum, size, uid); |
| | | for(Map<String, Object> map : list){ |
| | | map.put("title", language == 1 ? "系统提示" : language == 2 ? "System prompt" : "Rappel du système"); |
| | | systemNoticeMapper.readSystemNotice(Integer.valueOf(String.valueOf(map.get("id"))), uid); |
| | | } |
| | | } |
| | |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.AddressComponentsVo; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.GoogleMapUtil; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.ReverseGeocodeVo; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.TinggPayUtil; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.CheckoutRequest; |
| | | import com.stylefeng.guns.modular.system.warpper.LoginWarpper; |
| | | import com.stylefeng.guns.modular.taxi.model.PaymentRecord; |
| | | import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; |
| | |
| | | import org.apache.shiro.authc.credential.HashedCredentialsMatcher; |
| | | import org.apache.shiro.crypto.hash.Md5Hash; |
| | | import org.apache.shiro.util.ByteSource; |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.nodes.Element; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.File; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | |
| | |
| | | private ISystemNoticeService systemNoticeService; |
| | | |
| | | @Autowired |
| | | private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath; |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | | @Value("${spring.mail.template-path}") |
| | | private String templatePath; |
| | | |
| | | private String salt = "&a.s"; |
| | | |
| | |
| | | |
| | | //发送验证码短信 |
| | | redisUtil.setStrValue(phone, authCode, 5 * 60);//设置五分钟过期 |
| | | String templateCode = ""; |
| | | switch (type){ |
| | | case 1: |
| | | templateCode = "SMS_207770039";//身份验证 |
| | | break; |
| | | case 2: |
| | | templateCode = "SMS_207770039";//登录确认 |
| | | break; |
| | | case 3: |
| | | templateCode = "SMS_207770039";//用户注册 |
| | | break; |
| | | case 4: |
| | | templateCode = "SMS_207770039";//修改密码 |
| | | break; |
| | | } |
| | | /*String sData = aLiSendSms.sendSms(phone, templateCode, "{\"code\":\"" + authCode + "\"}"); |
| | | JSONObject jsonObject = JSON.parseObject(sData); |
| | | String message = jsonObject.getString("Message"); |
| | | if(!"OK".equals(message)){ |
| | | System.err.println(message); |
| | | return ResultUtil.error(message); |
| | | }*/ |
| | | SMSUtil.send_huawei_sms("b793ae3d41a049059197bfe92cf8bc83", "+" + phone, "[\"" + authCode + "\"]"); |
| | | System.out.println(sms); |
| | | } |
| | | |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ResultUtil<LoginWarpper> captchaLogin(String phone, String code, String registIp, String registAreaCode,Integer uid,Integer type, Integer userType) throws Exception { |
| | | public ResultUtil<LoginWarpper> captchaLogin(String phone, String code, String registIp, Double lat, Double lng,Integer uid,Integer type, |
| | | Integer userType, Integer language) throws Exception { |
| | | boolean b = this.checkCaptcha(phone, code); |
| | | if(!b){ |
| | | return ResultUtil.error("验证码无效"); |
| | | return ResultUtil.error(language == 1 ? "验证码无效" : language == 2 ? "Invalid captcha" : "Code de vérification invalide"); |
| | | } |
| | | |
| | | UserInfo userInfo = userInfoMapper.queryByPhone(phone); |
| | |
| | | userInfo.setState(1); |
| | | |
| | | //用户所属企业 |
| | | if(null != registAreaCode){ |
| | | Company query = companyCityService.query(registAreaCode); |
| | | if(null != lat && null != lng){ |
| | | ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(lat, lat); |
| | | AddressComponentsVo[] addressComponentsVos = reverseGeocode.getAddressComponentsVos(); |
| | | String[] citys = new String[addressComponentsVos.length]; |
| | | for (int i = 0; i < addressComponentsVos.length; i++) { |
| | | citys[i] = addressComponentsVos[i].getLongName(); |
| | | } |
| | | Company query = companyCityService.query(citys); |
| | | userInfo.setCompanyId(null != query ? query.getId() : null); |
| | | userInfo.setRegistAreaCode(registAreaCode); |
| | | userInfo.setRegistAreaCode(null); |
| | | }else{ |
| | | userInfo.setCompanyId(1); |
| | | } |
| | |
| | | |
| | | this.insert(userInfo); |
| | | |
| | | this.addCoupon(userInfo);//添加优惠券 |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/register.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | if(1 == language){ |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element user_chinese = document.getElementById("user_chinese"); |
| | | user_chinese.text("您好 " + userInfo.getNickName() + ","); |
| | | } |
| | | if(2 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element user_english = document.getElementById("user_english"); |
| | | user_english.text("Hello " + userInfo.getNickName() + ","); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | Element user_french = document.getElementById("user_french"); |
| | | user_french.text("Bonjour " + userInfo.getNickName() + ","); |
| | | } |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "注册成功" : language == 2 ? "Successful registration" : "Inscription réussie", document.html()); |
| | | } |
| | | |
| | | this.addCoupon(userInfo, language);//添加优惠券 |
| | | if(null != uid){ |
| | | if(type == 2){//司机分享 |
| | | Driver driver = driverMapper.selectById(uid); |
| | |
| | | driver.setLaveActivityMoney(bigDecimal.add(new BigDecimal(driver.getLaveActivityMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(bigDecimal.add(new BigDecimal(driver.getBalance())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverMapper.updateById(driver); |
| | | |
| | | if(ToolUtil.isNotEmpty(driver.getEmail())){ |
| | | String path1 = templatePath + "driver/index.html"; |
| | | Document document1 = Jsoup.parse(new File(path1), "UTF-8"); |
| | | if(1 == language){ |
| | | document1.getElementById("english").attr("style", "display: none;"); |
| | | document1.getElementById("french").attr("style", "display: none;"); |
| | | document1.getElementById("invite").attr("style", "display: none;"); |
| | | document1.getElementById("settle").attr("style", "display: none;"); |
| | | document1.getElementById("pass").attr("style", "display: none;"); |
| | | document1.getElementById("bill").attr("style", "display: none;"); |
| | | document1.getElementById("reward").attr("style", "display: none;"); |
| | | document1.getElementById("rewardToday").attr("style", "display: none;"); |
| | | |
| | | Element user_user = document1.getElementById("user_user"); |
| | | user_user.text("您好 " + driver.getName() + ","); |
| | | Element user_content = document1.getElementById("user_content"); |
| | | user_content.text("您已成功邀请一位用户注册I-GO,获得奖励GHS " + bigDecimal.doubleValue() + ",请查收"); |
| | | } |
| | | if(2 == language){ |
| | | document1.getElementById("chinese").attr("style", "display: none;"); |
| | | document1.getElementById("french").attr("style", "display: none;"); |
| | | document1.getElementById("invite1").attr("style", "display: none;"); |
| | | document1.getElementById("settle1").attr("style", "display: none;"); |
| | | document1.getElementById("pass1").attr("style", "display: none;"); |
| | | document1.getElementById("bill1").attr("style", "display: none;"); |
| | | document1.getElementById("reward1").attr("style", "display: none;"); |
| | | document1.getElementById("rewardToday1").attr("style", "display: none;"); |
| | | |
| | | Element user1_user = document1.getElementById("user1_user"); |
| | | user1_user.text("Hello " + driver.getName() + ","); |
| | | Element user1_content = document1.getElementById("user1_content"); |
| | | user1_content.text("You have succeeded to invite a rider to register with I-GO, so you received a GHS " + bigDecimal.doubleValue() + " bonus, please check your balance."); |
| | | } |
| | | if(3 == language){ |
| | | document1.getElementById("chinese").attr("style", "display: none;"); |
| | | document1.getElementById("english").attr("style", "display: none;"); |
| | | document1.getElementById("invite1").attr("style", "display: none;"); |
| | | document1.getElementById("settle1").attr("style", "display: none;"); |
| | | document1.getElementById("pass1").attr("style", "display: none;"); |
| | | document1.getElementById("bill1").attr("style", "display: none;"); |
| | | document1.getElementById("reward1").attr("style", "display: none;"); |
| | | document1.getElementById("rewardToday1").attr("style", "display: none;"); |
| | | |
| | | Element user2_user = document1.getElementById("user2_user"); |
| | | user2_user.text("Bonjour " + driver.getName() + ","); |
| | | Element user2_content = document1.getElementById("user2_content"); |
| | | user2_content.text("Vous avez invité avec succès un utilisateur à s’inscrire à i-go pour recevoir une récompense GHS " + bigDecimal.doubleValue() + ". Veuillez vérifier"); |
| | | } |
| | | EmailUtil.send(driver.getEmail(), language == 1 ? "邀请奖励" : language == 2 ? "invitation bonus" : "prime d'invitation", document1.html()); |
| | | } |
| | | } |
| | | if(type == 1){//用户分享 |
| | | UserInfo userInfo1 = userInfoMapper.selectById(uid); |
| | |
| | | Date date = new Date(); |
| | | for(Map<String, Object> map : query){ |
| | | Double lavePrice = Double.valueOf(map.get("lavePrice").toString()); |
| | | String startTime = map.get("startTime").toString(); |
| | | String endTime = map.get("endTime").toString(); |
| | | int num = 0; |
| | | for(int i = Integer.valueOf(String.valueOf(map.get("totalNum"))); i > 0; i--){ |
| | | //判断当前优惠券金额是否大于可发放剩余总金额 |
| | | if(Double.valueOf(String.valueOf(map.get("money"))).compareTo(lavePrice) > 0){ |
| | |
| | | userCouponRecordService.insert(userCouponRecord); |
| | | //修改剩余可发放总金额 |
| | | lavePrice -= Double.valueOf(String.valueOf(map.get("money"))); |
| | | num++; |
| | | } |
| | | UserActivityInvite uai = userActivityInviteMapper.selectById(Integer.valueOf(map.get("id").toString())); |
| | | uai.setLavePrice(new BigDecimal(lavePrice).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | userActivityInviteMapper.updateById(uai); |
| | | |
| | | if(ToolUtil.isNotEmpty(userInfo1.getEmail())){ |
| | | String path1 = templatePath + "user/coupon.html"; |
| | | Document document1 = Jsoup.parse(new File(path1), "UTF-8"); |
| | | if(language == 1){ |
| | | document1.getElementById("english").attr("style", "display: none;"); |
| | | document1.getElementById("french").attr("style", "display: none;"); |
| | | Element chinese_user = document1.getElementById("chinese_user"); |
| | | chinese_user.text("您好 " + userInfo1.getNickName() + ","); |
| | | Element chinese_number = document1.getElementById("chinese_number"); |
| | | chinese_number.text("您有" + num + "张优惠券到账"); |
| | | Element chinese_date = document1.getElementById("chinese_date"); |
| | | chinese_date.text("此活动有效期在" + startTime + "至" + endTime + ",详情请查看I-GO平台"); |
| | | } |
| | | if(language == 2){ |
| | | document1.getElementById("chinese").attr("style", "display: none;"); |
| | | document1.getElementById("french").attr("style", "display: none;"); |
| | | Element english_user = document1.getElementById("english_user"); |
| | | english_user.text("Hello " + userInfo1.getNickName() + ","); |
| | | Element english_number = document1.getElementById("english_number"); |
| | | english_number.text("You have received " + num + " coupons"); |
| | | Element english_date = document1.getElementById("english_date"); |
| | | english_date.text("You could use them from" + startTime + "to" + endTime); |
| | | } |
| | | if(language == 3){ |
| | | document1.getElementById("chinese").attr("style", "display: none;"); |
| | | document1.getElementById("english").attr("style", "display: none;"); |
| | | Element french_user = document1.getElementById("french_user"); |
| | | french_user.text("Bonjour " + userInfo1.getNickName() + ","); |
| | | Element french_number = document1.getElementById("french_number"); |
| | | french_number.text("Vous avez " + num + " coupons à recevoir"); |
| | | Element french_date = document1.getElementById("french_date"); |
| | | french_date.text("Cette promotion est valide du" + startTime + "au" + endTime); |
| | | } |
| | | EmailUtil.send(userInfo1.getEmail(), language == 1 ? "优惠券到账" : language == 2 ? "Coupon arrives" : "Le coupon arrive", document1.html()); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | UserInfo finalUserInfo = userInfo; |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){ |
| | | //上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoPassenger(finalUserInfo.getId()); |
| | | } |
| | | } |
| | | }).start(); |
| | | |
| | | } |
| | | if(userInfo.getState() == 2){ |
| | | return ResultUtil.error("账号被冻结"); |
| | |
| | | loginWarpper.setAppid(UUIDUtil.getRandomCode()); |
| | | loginWarpper.setEmergencyContact(userInfo.getEmergencyContact()); |
| | | loginWarpper.setEmergencyContactNumber(userInfo.getEmergencyContactNumber()); |
| | | loginWarpper.setEmail(userInfo.getEmail()); |
| | | |
| | | smsrecordService.saveData(1, phone, code, "短信验证码【" + code + "】已发到您的手机,验证码将在5分钟后失效,请及时登录!"); |
| | | return ResultUtil.success(loginWarpper); |
| | | } |
| | | |
| | | @Override |
| | | public synchronized ResultUtil<LoginWarpper> captchaLogin(String phone, String code, Integer uid, Integer type, Integer userType) throws Exception { |
| | | ResultUtil<LoginWarpper> resultUtil = this.captchaLogin(phone, code, null, null,uid,type,userType); |
| | | public synchronized ResultUtil<LoginWarpper> captchaLogin(String phone, String code, Integer uid, Integer type, Integer userType, Integer language) throws Exception { |
| | | ResultUtil<LoginWarpper> resultUtil = this.captchaLogin(phone, code, null, null, null,uid,type,userType,language); |
| | | |
| | | return resultUtil; |
| | | } |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil<LoginWarpper> userLogin(String phone, String password) throws Exception { |
| | | public ResultUtil<LoginWarpper> userLogin(String phone, String password, Integer language) throws Exception { |
| | | UserInfo userInfo = this.queryByPhone(phone); |
| | | if(null == userInfo){ |
| | | return ResultUtil.error("账号无效"); |
| | | return ResultUtil.error(language == 1 ? "账号无效" : language == 2 ? "Invalid account" : "Compte non valide"); |
| | | } |
| | | if(userInfo.getState() == 2){ |
| | | return ResultUtil.error("账号被冻结"); |
| | | return ResultUtil.error(language == 1 ? "账号被冻结" : language == 2 ? "Account is frozen." : "Le compte est gelé"); |
| | | } |
| | | if(!ShiroKit.md5(password, salt).equals(userInfo.getPassWord())){ |
| | | return ResultUtil.error("密码错误"); |
| | | return ResultUtil.error(language == 1 ? "密码错误" : language == 2 ? "Password error" : "Mot de passe incorrect"); |
| | | } |
| | | |
| | | //调用单点登录的逻辑 |
| | |
| | | */ |
| | | @Override |
| | | public ResultUtil<LoginWarpper> wxLogin(Integer type, String openid, String unionid, String jscode, String registIp, |
| | | String registAreaCode, Integer sex, String nickName, String avatar,String loginType,String encryptedData, String iv,Integer uid) throws Exception { |
| | | String registAreaCode, Integer sex, String nickName, String avatar,String loginType, |
| | | String encryptedData, String iv,Integer uid, Integer language) throws Exception { |
| | | UserInfo userInfo = null; |
| | | String phone=null; |
| | | if(type == 2){//小程序 |
| | |
| | | userInfo.setConsumption(0D); |
| | | userInfo.setBalance(0D); |
| | | userInfo.setState(1); |
| | | //用户所属企业 |
| | | if(null != registAreaCode){ |
| | | Company query = companyCityService.query(registAreaCode); |
| | | userInfo.setCompanyId(null != query ? query.getId() : null); |
| | | userInfo.setRegistAreaCode(registAreaCode); |
| | | } |
| | | userInfo.setCompanyId(1); |
| | | this.insert(userInfo); |
| | | |
| | | this.addCoupon(userInfo);//添加优惠券 |
| | | |
| | | UserInfo finalUserInfo = userInfo; |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){ |
| | | //上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoPassenger(finalUserInfo.getId()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/register.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | if(1 == language){ |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element user_chinese = document.getElementById("user_chinese"); |
| | | user_chinese.text("您好 " + userInfo.getNickName() + ","); |
| | | } |
| | | }).start(); |
| | | if(2 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element user_english = document.getElementById("user_english"); |
| | | user_english.text("Hello " + userInfo.getNickName() + ","); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | Element user_french = document.getElementById("user_french"); |
| | | user_french.text("Bonjour " + userInfo.getNickName() + ","); |
| | | } |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "注册成功" : language == 2 ? "Successful registration" : "Inscription réussie", document.html()); |
| | | } |
| | | |
| | | |
| | | this.addCoupon(userInfo, language);//添加优惠券 |
| | | |
| | | } |
| | | if(userInfo.getState() == 2){ |
| | | return ResultUtil.error("账号被冻结"); |
| | |
| | | loginWarpper.setToken(token); |
| | | loginWarpper.setAppid(UUIDUtil.getRandomCode()); |
| | | loginWarpper.setPhone(ToolUtil.isNotEmpty(userInfo.getPhone()) ? 2 : 1); |
| | | loginWarpper.setEmail(ToolUtil.isNotEmpty(userInfo.getEmail()) ? 2 : 1); |
| | | loginWarpper.setEmail(userInfo.getEmail()); |
| | | loginWarpper.setEmergencyContact(userInfo.getEmergencyContact()); |
| | | loginWarpper.setEmergencyContactNumber(userInfo.getEmergencyContactNumber()); |
| | | if(uid!=null){ |
| | |
| | | Date date = new Date(); |
| | | for(Map<String, Object> map : query){ |
| | | Double lavePrice = Double.valueOf(map.get("lavePrice").toString()); |
| | | String startTime = map.get("startTime").toString(); |
| | | String endTime = map.get("endTime").toString(); |
| | | int num = 0; |
| | | for(int i = Integer.valueOf(String.valueOf(map.get("totalNum"))); i > 0; i--){ |
| | | //判断当前优惠券金额是否大于可发放剩余总金额 |
| | | if(Double.valueOf(String.valueOf(map.get("money"))).compareTo(lavePrice) > 0){ |
| | |
| | | userCouponRecordService.insert(userCouponRecord); |
| | | //修改剩余可发放总金额 |
| | | lavePrice -= Double.valueOf(String.valueOf(map.get("money"))); |
| | | num++; |
| | | } |
| | | UserActivityInvite uai = userActivityInviteMapper.selectById(Integer.valueOf(map.get("id").toString())); |
| | | uai.setLavePrice(new BigDecimal(lavePrice).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | userActivityInviteMapper.updateById(uai); |
| | | |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/coupon.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | if(language == 1){ |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element chinese_user = document.getElementById("chinese_user"); |
| | | chinese_user.text("您好 " + userInfo.getNickName() + ","); |
| | | Element chinese_number = document.getElementById("chinese_number"); |
| | | chinese_number.text("您有" + num + "张优惠券到账"); |
| | | Element chinese_date = document.getElementById("chinese_date"); |
| | | chinese_date.text("此活动有效期在" + startTime + "至" + endTime + ",详情请查看I-GO平台"); |
| | | } |
| | | if(language == 2){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element english_user = document.getElementById("english_user"); |
| | | english_user.text("Hello " + userInfo.getNickName() + ","); |
| | | Element english_number = document.getElementById("english_number"); |
| | | english_number.text("You have received " + num + " coupons"); |
| | | Element english_date = document.getElementById("english_date"); |
| | | english_date.text("You could use them from" + startTime + "to" + endTime); |
| | | } |
| | | if(language == 3){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | Element french_user = document.getElementById("french_user"); |
| | | french_user.text("Bonjour " + userInfo.getNickName() + ","); |
| | | Element french_number = document.getElementById("french_number"); |
| | | french_number.text("Vous avez " + num + " coupons à recevoir"); |
| | | Element french_date = document.getElementById("french_date"); |
| | | french_date.text("Cette promotion est valide du" + startTime + "au" + endTime); |
| | | } |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "优惠券到账" : language == 2 ? "Coupon arrives" : "Le coupon arrive", document.html()); |
| | | } |
| | | } |
| | | } |
| | | return ResultUtil.success(loginWarpper); |
| | |
| | | loginWarpper.setToken(token); |
| | | loginWarpper.setAppid(UUIDUtil.getRandomCode()); |
| | | loginWarpper.setPhone(ToolUtil.isNotEmpty(userInfo.getPhone()) ? 2 : 1); |
| | | loginWarpper.setEmail(ToolUtil.isNotEmpty(userInfo.getEmail()) ? 2 : 1); |
| | | loginWarpper.setEmail(userInfo.getEmail()); |
| | | loginWarpper.setEmergencyContact(userInfo.getEmergencyContact()); |
| | | loginWarpper.setEmergencyContactNumber(userInfo.getEmergencyContactNumber()); |
| | | return ResultUtil.success(loginWarpper); |
| | |
| | | |
| | | |
| | | @Override |
| | | public ResultUtil facebookLogin(String id, String name, String email, String registAreaCode, Integer uid) throws Exception { |
| | | public ResultUtil facebookLogin(String id, String name, String email, Double lat, Double lng, Integer uid, Integer language) throws Exception { |
| | | UserInfo userInfo = this.selectOne(new EntityWrapper<UserInfo>().eq("faceBookId", id).ne("flag", 3)); |
| | | if(null == userInfo){ |
| | | userInfo = new UserInfo(); |
| | |
| | | userInfo.setuType(1); |
| | | } |
| | | //用户所属企业 |
| | | if(null != registAreaCode){ |
| | | Company query = companyCityService.query(registAreaCode); |
| | | userInfo.setCompanyId(null != query ? query.getId() : null); |
| | | userInfo.setRegistAreaCode(registAreaCode); |
| | | if(null != lat && null != lng){ |
| | | ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(lat, lng); |
| | | if(null != reverseGeocode){ |
| | | AddressComponentsVo[] addressComponentsVos = reverseGeocode.getAddressComponentsVos(); |
| | | String[] citys = new String[addressComponentsVos.length]; |
| | | for (int i = 0; i < addressComponentsVos.length; i++) { |
| | | citys[i] = addressComponentsVos[i].getLongName(); |
| | | } |
| | | Company query = companyCityService.query(citys); |
| | | userInfo.setCompanyId(null != query ? query.getId() : null); |
| | | userInfo.setRegistAreaCode(null); |
| | | } |
| | | |
| | | } |
| | | this.insert(userInfo); |
| | | |
| | | this.addCoupon(userInfo);//添加优惠券 |
| | | |
| | | UserInfo finalUserInfo = userInfo; |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){ |
| | | //上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoPassenger(finalUserInfo.getId()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/register.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | if(1 == language){ |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element user_chinese = document.getElementById("user_chinese"); |
| | | user_chinese.text("您好 " + userInfo.getNickName() + ","); |
| | | } |
| | | }).start(); |
| | | if(2 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element user_english = document.getElementById("user_english"); |
| | | user_english.text("Hello " + userInfo.getNickName() + ","); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | Element user_french = document.getElementById("user_french"); |
| | | user_french.text("Bonjour " + userInfo.getNickName() + ","); |
| | | } |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "注册成功" : language == 2 ? "Successful registration" : "Inscription réussie", document.html()); |
| | | } |
| | | |
| | | |
| | | this.addCoupon(userInfo, language);//添加优惠券 |
| | | } |
| | | |
| | | if(userInfo.getState() == 2){ |
| | |
| | | loginWarpper.setToken(token); |
| | | loginWarpper.setAppid(UUIDUtil.getRandomCode()); |
| | | loginWarpper.setPhone(ToolUtil.isNotEmpty(userInfo.getPhone()) ? 2 : 1); |
| | | loginWarpper.setEmail(ToolUtil.isNotEmpty(userInfo.getEmail()) ? 2 : 1); |
| | | loginWarpper.setEmail(userInfo.getEmail()); |
| | | loginWarpper.setEmergencyContact(userInfo.getEmergencyContact()); |
| | | loginWarpper.setEmergencyContactNumber(userInfo.getEmergencyContactNumber()); |
| | | if(uid!=null){ |
| | |
| | | Date date = new Date(); |
| | | for(Map<String, Object> map : query){ |
| | | Double lavePrice = Double.valueOf(map.get("lavePrice").toString()); |
| | | String startTime = map.get("startTime").toString(); |
| | | String endTime = map.get("endTime").toString(); |
| | | int num = 0; |
| | | for(int i = Integer.valueOf(String.valueOf(map.get("totalNum"))); i > 0; i--){ |
| | | //判断当前优惠券金额是否大于可发放剩余总金额 |
| | | if(Double.valueOf(String.valueOf(map.get("money"))).compareTo(lavePrice) > 0){ |
| | |
| | | userCouponRecordService.insert(userCouponRecord); |
| | | //修改剩余可发放总金额 |
| | | lavePrice -= Double.valueOf(String.valueOf(map.get("money"))); |
| | | num++; |
| | | } |
| | | UserActivityInvite uai = userActivityInviteMapper.selectById(Integer.valueOf(map.get("id").toString())); |
| | | uai.setLavePrice(new BigDecimal(lavePrice).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | userActivityInviteMapper.updateById(uai); |
| | | |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/coupon.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | if(language == 1){ |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element chinese_user = document.getElementById("chinese_user"); |
| | | chinese_user.text("您好 " + userInfo.getNickName() + ","); |
| | | Element chinese_number = document.getElementById("chinese_number"); |
| | | chinese_number.text("您有" + num + "张优惠券到账"); |
| | | Element chinese_date = document.getElementById("chinese_date"); |
| | | chinese_date.text("此活动有效期在" + startTime + "至" + endTime + ",详情请查看I-GO平台"); |
| | | } |
| | | if(language == 2){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element english_user = document.getElementById("english_user"); |
| | | english_user.text("Hello " + userInfo.getNickName() + ","); |
| | | Element english_number = document.getElementById("english_number"); |
| | | english_number.text("You have received " + num + " coupons"); |
| | | Element english_date = document.getElementById("english_date"); |
| | | english_date.text("You could use them from" + startTime + "to" + endTime); |
| | | } |
| | | if(language == 3){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | Element french_user = document.getElementById("french_user"); |
| | | french_user.text("Bonjour " + userInfo.getNickName() + ","); |
| | | Element french_number = document.getElementById("french_number"); |
| | | french_number.text("Vous avez " + num + " coupons à recevoir"); |
| | | Element french_date = document.getElementById("french_date"); |
| | | french_date.text("Cette promotion est valide du" + startTime + "au" + endTime); |
| | | } |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "优惠券到账" : language == 2 ? "Coupon arrives" : "Le coupon arrive", document.html()); |
| | | } |
| | | } |
| | | } |
| | | return ResultUtil.success(loginWarpper); |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil forgetPassword(String phone, String code, String password) throws Exception { |
| | | boolean b = this.checkCaptcha(phone, code); |
| | | if(!b){ |
| | | return ResultUtil.error("验证码无效"); |
| | | } |
| | | public ResultUtil forgetPassword(String phone, String code, String password, Integer language) throws Exception { |
| | | UserInfo userInfo = this.queryByPhone(phone); |
| | | if(null == userInfo){ |
| | | return ResultUtil.error("手机号码未注册"); |
| | | return ResultUtil.error(language == 1 ? "手机号码未注册" : language == 2 ? "Cell phone number is not registered" : "Numéro de téléphone portable non enregistré"); |
| | | } |
| | | boolean b = this.checkCaptcha(phone, code); |
| | | if(!b){ |
| | | b = this.checkCaptcha(userInfo.getEmail(), code); |
| | | } |
| | | if(!b){ |
| | | return ResultUtil.error(language == 1 ? "验证码无效" : language == 2 ? "Invalid captcha" : "Code de vérification invalide"); |
| | | } |
| | | if(userInfo.getState() == 2){ |
| | | return ResultUtil.error("账号已被冻结"); |
| | | return ResultUtil.error(language == 1 ? "账号已被冻结" : language == 2 ? "The account has been frozen" : "Le compte a été gelé"); |
| | | } |
| | | userInfo.setPassWord(ShiroKit.md5(password, salt)); |
| | | userInfo.setUpdateUser(userInfo.getId()); |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil bindingPhone(Integer uid, String phone, String code) throws Exception { |
| | | public ResultUtil bindingPhone(Integer uid, String phone, String code, Integer language) throws Exception { |
| | | boolean b = this.checkCaptcha(phone, code); |
| | | if(!b){ |
| | | return ResultUtil.error("验证码无效"); |
| | | return ResultUtil.error(language == 1 ? "验证码无效" : language == 2 ? "Invalid captcha" : "Code de vérification invalide"); |
| | | } |
| | | UserInfo userInfo = this.selectById(uid); |
| | | UserInfo userInfo1 = userInfoMapper.queryByPhone(phone); |
| | |
| | | loginWarpper.setToken(token); |
| | | loginWarpper.setAppid(UUIDUtil.getRandomCode()); |
| | | loginWarpper.setPhone(2); |
| | | loginWarpper.setEmail(2); |
| | | loginWarpper.setEmail(userInfo1.getEmail()); |
| | | return ResultUtil.success(loginWarpper); |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | @Override |
| | | public ResultUtil bindingEmail(Integer uid, Integer type, String email, String code) throws Exception { |
| | | public ResultUtil bindingEmail(Integer uid, Integer type, String email, String code, Integer language) throws Exception { |
| | | boolean b = this.checkCaptcha(email, code); |
| | | if(!b){ |
| | | return ResultUtil.error("验证码无效"); |
| | | return ResultUtil.error(language == 1 ? "验证码无效" : language == 2 ? "Invalid captcha" : "Code de vérification invalide"); |
| | | } |
| | | UserInfo userInfo = this.selectById(uid); |
| | | UserInfo userInfo1 = userInfoMapper.queryByEmail(email); |
| | | if(null != userInfo1){ |
| | | userInfo1.setOpenId(userInfo.getOpenId()); |
| | | userInfo1.setUnionid(userInfo.getUnionid()); |
| | | userInfo1.setAppletsOpenId(userInfo.getAppletsOpenId()); |
| | | userInfo1.setAvatar(userInfo.getAvatar()); |
| | | userInfo1.setSex(userInfo.getSex()); |
| | | userInfo1.setNickName(userInfo.getNickName()); |
| | | this.updateById(userInfo1); |
| | | |
| | | this.deleteById(userInfo.getId());//删除原有数据 |
| | | //还原之前账号领取的注册优惠券 |
| | | List<UserCouponRecord> list = userCouponRecordService.selectList(new EntityWrapper<UserCouponRecord>().eq("userId", userInfo.getId())); |
| | | for(UserCouponRecord ucr : list){ |
| | | if(ucr.getActivityType() == 1){//赠送 |
| | | |
| | | } |
| | | if(ucr.getActivityType() == 2){//注册 |
| | | UserActivityRegistered userActivityRegistered = userActivityRegisteredService.selectById(ucr.getCouponActivityId()); |
| | | userActivityRegistered.setLaveNum(userActivityRegistered.getLaveNum() + 1); |
| | | userActivityRegistered.setLavePrice(userActivityRegistered.getLavePrice() + ucr.getMoney()); |
| | | userActivityRegisteredService.updateById(userActivityRegistered); |
| | | } |
| | | if(ucr.getActivityType() == 3){//邀请 |
| | | |
| | | } |
| | | if(ucr.getActivityType() == 4){//充值 |
| | | |
| | | } |
| | | userCouponRecordService.deleteById(ucr.getId()); |
| | | } |
| | | |
| | | |
| | | //获取新的token等数据 |
| | | String token = this.getToken(userInfo1, ""); |
| | | LoginWarpper loginWarpper = new LoginWarpper(); |
| | | loginWarpper.setId(userInfo1.getId()); |
| | | loginWarpper.setToken(token); |
| | | loginWarpper.setAppid(UUIDUtil.getRandomCode()); |
| | | loginWarpper.setPhone(2); |
| | | loginWarpper.setEmail(2); |
| | | return ResultUtil.success(loginWarpper); |
| | | if(null != userInfo1 && uid.compareTo(userInfo1.getId()) != 0){ |
| | | return ResultUtil.error(language == 1 ? "邮箱已被使用" : language == 2 ? "The mailbox is in use" : "La boîte mail a déjà été utilisée"); |
| | | } |
| | | |
| | | // if(null != userInfo1){ |
| | | // userInfo1.setOpenId(userInfo.getOpenId()); |
| | | // userInfo1.setUnionid(userInfo.getUnionid()); |
| | | // userInfo1.setAppletsOpenId(userInfo.getAppletsOpenId()); |
| | | // userInfo1.setAvatar(userInfo.getAvatar()); |
| | | // userInfo1.setSex(userInfo.getSex()); |
| | | // userInfo1.setNickName(userInfo.getNickName()); |
| | | // this.updateById(userInfo1); |
| | | // |
| | | // this.deleteById(userInfo.getId());//删除原有数据 |
| | | // //还原之前账号领取的注册优惠券 |
| | | // List<UserCouponRecord> list = userCouponRecordService.selectList(new EntityWrapper<UserCouponRecord>().eq("userId", userInfo.getId())); |
| | | // for(UserCouponRecord ucr : list){ |
| | | // if(ucr.getActivityType() == 1){//赠送 |
| | | // |
| | | // } |
| | | // if(ucr.getActivityType() == 2){//注册 |
| | | // UserActivityRegistered userActivityRegistered = userActivityRegisteredService.selectById(ucr.getCouponActivityId()); |
| | | // userActivityRegistered.setLaveNum(userActivityRegistered.getLaveNum() + 1); |
| | | // userActivityRegistered.setLavePrice(userActivityRegistered.getLavePrice() + ucr.getMoney()); |
| | | // userActivityRegisteredService.updateById(userActivityRegistered); |
| | | // } |
| | | // if(ucr.getActivityType() == 3){//邀请 |
| | | // |
| | | // } |
| | | // if(ucr.getActivityType() == 4){//充值 |
| | | // |
| | | // } |
| | | // userCouponRecordService.deleteById(ucr.getId()); |
| | | // } |
| | | // |
| | | // |
| | | // //获取新的token等数据 |
| | | // String token = this.getToken(userInfo1, ""); |
| | | // LoginWarpper loginWarpper = new LoginWarpper(); |
| | | // loginWarpper.setId(userInfo1.getId()); |
| | | // loginWarpper.setToken(token); |
| | | // loginWarpper.setAppid(UUIDUtil.getRandomCode()); |
| | | // loginWarpper.setPhone(2); |
| | | // loginWarpper.setEmail(userInfo1.getEmail()); |
| | | // return ResultUtil.success(loginWarpper); |
| | | // } |
| | | |
| | | userInfo.setEmail(email); |
| | | userInfo.setUpdateTime(new Date()); |
| | | userInfo.setUpdateUser(userInfo.getId()); |
| | | this.updateById(userInfo); |
| | | if(type == 1){//注册成功后发送邮件 |
| | | EmailUtil.getMimeMessage(email, "注册账户", ""); |
| | | } |
| | | // if(type == 1){//注册成功后发送邮件 |
| | | //// EmailUtil.getMimeMessage(email, "注册账户", ""); |
| | | // } |
| | | return ResultUtil.success(new LoginWarpper()); |
| | | } |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil depositBalance(Integer payType, Double money, Integer uid, Integer type) throws Exception { |
| | | public ResultUtil depositBalance(Integer payType, String accountNumber, Double money, Integer uid, Integer type, Integer language) throws Exception { |
| | | UserInfo userInfo = userInfoMapper.selectById(uid); |
| | | if(money.compareTo(0D) <= 0){ |
| | | return ResultUtil.error("支付金额必须大于0元"); |
| | | } |
| | | if(payType == 1){//微信支付 |
| | | Integer integer = paymentRecordService.saveData(2, uid, 1, null, null, 1, money, "", 1);//添加预支付数据 |
| | | //Map<String, String> map = icbcPayUtil.placeAnOrder(integer.toString(), 9, 5, uid.toString(), "余额充值", money, callbackPath + "/base/wxCancelUserBalance", uid.toString(), type, userInfo.getAppletsOpenId()); |
| | | ResultUtil resultUtil = payMoneyUtil.weixinpay("余额充值",integer.toString(),integer.toString(),money+"","/base/wxCancelUserBalance","JSAPI",userInfo.getAppletsOpenId()); |
| | | if(resultUtil.getCode()==200){ |
| | | PaymentRecord paymentRecord = paymentRecordService.selectById(integer); |
| | | paymentRecordService.updateById(paymentRecord); |
| | | return resultUtil; |
| | | }else{ |
| | | return ResultUtil.error("获取支付信息失败", ""); |
| | | } |
| | | // ResultUtil resultUtil = payMoneyUtil.weixinpay("余额充值",language.toString(),integer.toString(),money+"","/base/wxCancelUserBalance","JSAPI",userInfo.getAppletsOpenId()); |
| | | // if(resultUtil.getCode()==200){ |
| | | // PaymentRecord paymentRecord = paymentRecordService.selectById(integer); |
| | | // paymentRecordService.updateById(paymentRecord); |
| | | // return resultUtil; |
| | | // }else{ |
| | | // return ResultUtil.error("获取支付信息失败", ""); |
| | | // } |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String merchantTransactionId = sdf.format(new Date()) + language + integer; |
| | | CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | checkoutRequest.setMsisdn(Long.valueOf(userInfo.getPhone())); |
| | | checkoutRequest.setCustomerEmail(userInfo.getEmail()); |
| | | checkoutRequest.setAccountNumber(accountNumber); |
| | | checkoutRequest.setCustomerFirstName(userInfo.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(userInfo.getLastName()); |
| | | checkoutRequest.setRequestAmount(money); |
| | | checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | checkoutRequest.setRequestDescription("Account top-up"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxCancelUserBalance"); |
| | | checkoutRequest.setPendingRedirectUrl(""); |
| | | checkoutRequest.setSuccessRedirectUrl("https://10pz685243.zicp.fun"); |
| | | checkoutRequest.setFailRedirectUrl("https://www.baidu.com"); |
| | | return TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | |
| | | |
| | | } |
| | | if(payType == 2){//支付宝支付 |
| | | Integer integer = paymentRecordService.saveData(2, uid, 1, null, null, 2, money, "", 1);//添加预支付数据 |
| | | ResultUtil resultUtil = payMoneyUtil.alipay("余额充值","余额充值",integer.toString(),money+"","/base/aliCancelUserBalance"); |
| | | if(resultUtil.getCode()==200){ |
| | | PaymentRecord paymentRecord = paymentRecordService.selectById(integer); |
| | | paymentRecordService.updateById(paymentRecord); |
| | | return resultUtil; |
| | | }else{ |
| | | return ResultUtil.error("获取支付信息失败", ""); |
| | | } |
| | | } |
| | | // if(payType == 2){//支付宝支付 |
| | | // Integer integer = paymentRecordService.saveData(2, uid, 1, null, null, 2, money, "", 1);//添加预支付数据 |
| | | // ResultUtil resultUtil = payMoneyUtil.alipay("余额充值","余额充值",integer + "_" + language,money+"","/base/aliCancelUserBalance"); |
| | | // if(resultUtil.getCode()==200){ |
| | | // PaymentRecord paymentRecord = paymentRecordService.selectById(integer); |
| | | // paymentRecordService.updateById(paymentRecord); |
| | | // return resultUtil; |
| | | // }else{ |
| | | // return ResultUtil.error("获取支付信息失败", ""); |
| | | // } |
| | | // } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil updatePhone(String code, String phone, Integer uid) throws Exception { |
| | | public ResultUtil updatePhone(String code, String phone, Integer uid, Integer language) throws Exception { |
| | | boolean b = this.checkCaptcha(phone, code); |
| | | if(!b){ |
| | | return ResultUtil.error("验证码无效"); |
| | | return ResultUtil.error(language == 1 ? "验证码无效" : language == 2 ? "Invalid captcha" : "Code de vérification invalide"); |
| | | } |
| | | UserInfo userInfo = this.selectById(uid); |
| | | UserInfo userInfo1 = userInfoMapper.queryByPhone(phone); |
| | | if(null != userInfo1){ |
| | | return ResultUtil.error("手机号已被注册"); |
| | | return ResultUtil.error(language == 1 ? "手机号已被注册" : language == 2 ? "The phone number has been registered" : "Le numéro de téléphone a été enregistré"); |
| | | } |
| | | userInfo.setPhone(phone); |
| | | this.updateById(userInfo); |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil updatePass(String password, Integer uid) throws Exception { |
| | | public ResultUtil updatePass(String password, Integer uid, Integer language) throws Exception { |
| | | UserInfo userInfo = this.selectById(uid); |
| | | userInfo.setPassWord(ShiroKit.md5(password, salt)); |
| | | this.updateById(userInfo); |
| | | //发送邮件 |
| | | EmailUtil.getMimeMessage(userInfo.getEmail(), "修改密码", ""); |
| | | |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/passwordReset.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | if(1 == language){ |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element user_chinese = document.getElementById("user_chinese"); |
| | | user_chinese.text("您好 " + userInfo.getNickName() + ","); |
| | | } |
| | | if(2 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element user_chinese = document.getElementById("user_english"); |
| | | user_chinese.text("Hello " + userInfo.getNickName() + ","); |
| | | } |
| | | if(3 == language){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | Element user_french = document.getElementById("user_french"); |
| | | user_french.text("Bonjour " + userInfo.getNickName() + ","); |
| | | } |
| | | |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "重置密码" : language == 2 ? "Reset password" : "Réinitialiser le mot de passe", document.html()); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public void updateInfo(String avatar, String nickname, Integer sex, Date birthday, Integer uid) throws Exception { |
| | | public void updateInfo(String avatar, String nickname, Integer sex, Date birthday, String email, String lastName, String firstName, Integer uid) throws Exception { |
| | | UserInfo userInfo = this.selectById(uid); |
| | | if(ToolUtil.isNotEmpty(avatar)){ |
| | | userInfo.setAvatar(avatar); |
| | |
| | | } |
| | | if(null != birthday){ |
| | | userInfo.setBirthday(birthday); |
| | | } |
| | | if(null != email){ |
| | | userInfo.setEmail(email); |
| | | } |
| | | if(null != lastName){ |
| | | userInfo.setLastName(lastName); |
| | | } |
| | | if(null != firstName){ |
| | | userInfo.setFirstName(firstName); |
| | | } |
| | | this.updateById(userInfo); |
| | | } |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public void payCancelUserBalance(Integer id, String order_id, Integer paymentRecordId, Integer type) throws Exception { |
| | | public void payCancelUserBalance(Integer id, String order_id, Integer paymentRecordId, Integer type, Integer language) throws Exception { |
| | | PaymentRecord query = paymentRecordService.selectById(paymentRecordId); |
| | | UserInfo userInfo = this.selectById(query.getUserId()); |
| | | if(null != query){ |
| | |
| | | query.setState(2); |
| | | paymentRecordService.updateById(query); |
| | | |
| | | this.addCoupon(userInfo.getId(), query.getAmount(), userInfo.getCompanyId(), query.getId());//添加优惠券 |
| | | this.addCoupon(userInfo.getId(), query.getAmount(), userInfo.getCompanyId(), query.getId(), language);//添加优惠券 |
| | | |
| | | }else{ |
| | | System.err.println("预支付数据异常(userId = " + id + ")"); |
| | |
| | | * @param companyId |
| | | * @throws Exception |
| | | */ |
| | | public synchronized void addCoupon(Integer userId, Double money, Integer companyId, Integer paymentRecordId) throws Exception{ |
| | | public synchronized void addCoupon(Integer userId, Double money, Integer companyId, Integer paymentRecordId, Integer language) throws Exception{ |
| | | List<Map<String, Object>> query = userActivityBalanceService.query(money, companyId); |
| | | List<UserCouponRecord> list = new ArrayList<>(); |
| | | for(Map<String, Object> map : query){ |
| | | //添加通用优惠券 |
| | | Double lavePrice = Double.valueOf(String.valueOf(map.get("lavePrice"))); |
| | | String startTime = map.get("startTime").toString(); |
| | | String endTime = map.get("endTime").toString(); |
| | | if(null != map.get("bcompanyId")){ |
| | | for(int i = 0; i < Integer.valueOf(String.valueOf(map.get("generalNum"))); i++){ |
| | | //判断当前发放的优惠券是否大于剩余总发放金额 |
| | |
| | | |
| | | if(list.size() > 0){ |
| | | userCouponRecordService.insertBatch(list); |
| | | |
| | | UserInfo userInfo = userInfoMapper.selectById(userId); |
| | | |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/coupon.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | if(language == 1){ |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element chinese_user = document.getElementById("chinese_user"); |
| | | chinese_user.text("您好 " + userInfo.getNickName() + ","); |
| | | Element chinese_number = document.getElementById("chinese_number"); |
| | | chinese_number.text("您有" + list.size() + "张优惠券到账"); |
| | | Element chinese_date = document.getElementById("chinese_date"); |
| | | chinese_date.text("此活动有效期在" + startTime + "至" + endTime + ",详情请查看I-GO平台"); |
| | | } |
| | | if(language == 2){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element english_user = document.getElementById("english_user"); |
| | | english_user.text("Hello " + userInfo.getNickName() + ","); |
| | | Element english_number = document.getElementById("english_number"); |
| | | english_number.text("You have received " + list.size() + " coupons"); |
| | | Element english_date = document.getElementById("english_date"); |
| | | english_date.text("You could use them from" + startTime + "to" + endTime); |
| | | } |
| | | if(language == 3){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | Element french_user = document.getElementById("french_user"); |
| | | french_user.text("Bonjour " + userInfo.getNickName() + ","); |
| | | Element french_number = document.getElementById("french_number"); |
| | | french_number.text("Vous avez " + list.size() + " coupons à recevoir"); |
| | | Element french_date = document.getElementById("french_date"); |
| | | french_date.text("Cette promotion est valide du" + startTime + "au" + endTime); |
| | | } |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "优惠券到账" : language == 2 ? "Coupon arrives" : "Le coupon arrive", document.html()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | public String getDefaultName(){ |
| | | int num = this.selectCount(new EntityWrapper<UserInfo>().ne("flag", 3)) + 1000001; |
| | | return "XW" + String.valueOf(num).substring(1); |
| | | return "IGO" + String.valueOf(num).substring(1); |
| | | } |
| | | |
| | | |
| | |
| | | * @param userInfo |
| | | * @throws Exception |
| | | */ |
| | | private synchronized void addCoupon(UserInfo userInfo) throws Exception{ |
| | | private synchronized void addCoupon(UserInfo userInfo, Integer language) throws Exception{ |
| | | //添加优惠券 |
| | | List<Map<String, Object>> list = userActivityRegisteredService.query(userInfo.getCompanyId()); |
| | | int num = 0; |
| | |
| | | if(null != map){ |
| | | Integer totalNum = Integer.valueOf(String.valueOf(map.get("totalNum"))); |
| | | Double lavePrice = Double.valueOf(String.valueOf(map.get("lavePrice"))); |
| | | String startTime = map.get("startTime").toString(); |
| | | String endTime = map.get("endTime").toString(); |
| | | for(int i = totalNum; i > 0; i--){ |
| | | //判断当前发放的优惠券是否大于剩余可发送总金额 |
| | | if(Double.valueOf(String.valueOf(map.get("money"))).compareTo(lavePrice) > 0){ |
| | |
| | | UserActivityRegistered uar = userActivityRegisteredService.selectById(Integer.valueOf(map.get("id").toString())); |
| | | uar.setLavePrice(new BigDecimal(lavePrice).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | userActivityRegisteredService.updateById(uar); |
| | | |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmail())){ |
| | | String path = templatePath + "user/coupon.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | if(language == 1){ |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element chinese_user = document.getElementById("chinese_user"); |
| | | chinese_user.text("您好 " + userInfo.getNickName() + ","); |
| | | Element chinese_number = document.getElementById("chinese_number"); |
| | | chinese_number.text("您有" + num + "张优惠券到账"); |
| | | Element chinese_date = document.getElementById("chinese_date"); |
| | | chinese_date.text("此活动有效期在" + startTime + "至" + endTime + ",详情请查看I-GO平台"); |
| | | } |
| | | if(language == 2){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | Element english_user = document.getElementById("english_user"); |
| | | english_user.text("Hello " + userInfo.getNickName() + ","); |
| | | Element english_number = document.getElementById("english_number"); |
| | | english_number.text("You have received " + num + " coupons"); |
| | | Element english_date = document.getElementById("english_date"); |
| | | english_date.text("You could use them from" + startTime + "to" + endTime); |
| | | } |
| | | if(language == 3){ |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("english").attr("style", "display: none;"); |
| | | Element french_user = document.getElementById("french_user"); |
| | | french_user.text("Bonjour " + userInfo.getNickName() + ","); |
| | | Element french_number = document.getElementById("french_number"); |
| | | french_number.text("Vous avez " + list.size() + " coupons à recevoir"); |
| | | Element french_date = document.getElementById("french_date"); |
| | | french_date.text("Cette promotion est valide du" + startTime + "au" + endTime); |
| | | } |
| | | EmailUtil.send(userInfo.getEmail(), language == 1 ? "优惠券到账" : language == 2 ? "Coupon arrives" : "Le coupon arrive", document.html()); |
| | | } |
| | | } |
| | | } |
| | | //添加系统消息 |
| | |
| | | //修改个人信息 |
| | | if(b){ |
| | | userInfo.setIsAuth(2); |
| | | userInfo.setName(verified.getName()); |
| | | userInfo.setLastName(verified.getLastName()); |
| | | userInfo.setFirstName(verified.getFirstName()); |
| | | userInfo.setIdCard(verified.getIdcode()); |
| | | userInfo.setIdCardFront(verified.getImg1()); |
| | | userInfo.setIdCardReverse(verified.getImg2()); |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryWithdrawal(Integer uid, Integer pageNum, Integer size) throws Exception { |
| | | public List<Map<String, Object>> queryWithdrawal(Integer uid, Integer pageNum, Integer size, Integer language) throws Exception { |
| | | pageNum = (pageNum - 1) * size; |
| | | return withdrawalMapper.queryWithdrawal(uid, 1, pageNum, size); |
| | | String name = language == 1 ? "银行卡提现" : language == 2 ? "Bank card withdrawal" : "Retrait par carte bancaire"; |
| | | List<Map<String, Object>> list = withdrawalMapper.queryWithdrawal(uid, 1, pageNum, size); |
| | | for (Map<String, Object> map : list) { |
| | | map.put("name", name); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 创建邮件内容 需科学上网 |
| | | * 创建邮件内容 |
| | | * |
| | | * @param sentToEmail 接收人邮箱 |
| | | * @param subject 设置邮件主题 |
| | | * @param content 内容 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static boolean getMimeMessage(String sentToEmail, String subject, String content) throws Exception { |
| | | public static boolean send(String sentToEmail, String subject, String content) throws Exception { |
| | | //1.创建一封邮件的实例对象 |
| | | Properties props = new Properties(); |
| | | //选择ssl方式 |
| | | gmailssl(props); |
| | | |
| | | final String username = "southwindservice@gmail.com";// gmail 邮箱 |
| | | final String password = "irkgrsuzxgmwrxzy";// Google应用专用密码 |
| | | final String password = "ogsntijmguisoiuk";// Google应用专用密码 |
| | | // 当做多商户的时候需要使用getInstance, 如果只是一个邮箱发送的话就用getDefaultInstance |
| | | // Session.getDefaultInstance 会将username,password保存在session会话中 |
| | | // Session.getInstance 不进行保存 |
| | |
| | | |
| | | Transport.send(msg); |
| | | return true; |
| | | } |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | boolean mimeMessage = getMimeMessage("393733352@qq.com", "测试内容", "这是一段测试内容"); |
| | | System.out.println(mimeMessage); |
| | | } |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.system.util.GoogleMap; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.maps.*; |
| | |
| | | GeoApiContext context = new GeoApiContext.Builder() |
| | | .apiKey(key) |
| | | .build(); |
| | | GeocodingResult[] results = GeocodingApi.geocode(context, address).await(); |
| | | GeocodingApiRequest request = GeocodingApi.geocode(context, address); |
| | | request.language("en"); |
| | | GeocodingResult[] results = request.await(); |
| | | GeocodeVo vo = null; |
| | | if(results.length > 0){ |
| | | Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
| | | System.out.println(gson.toJson(results[0].addressComponents)); |
| | | System.err.println(gson.toJson(results[0].addressComponents)); |
| | | |
| | | Geometry geometry = results[0].geometry; |
| | | LatLng location = geometry.location; |
| | |
| | | .apiKey(key) |
| | | .build(); |
| | | GeocodingApiRequest request = GeocodingApi.reverseGeocode(context, new LatLng(lat, lng)); |
| | | request.language("en"); |
| | | GeocodingResult[] results = request.await(); |
| | | ReverseGeocodeVo vo = null; |
| | | if(results.length > 0){ |
| | | Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
| | | System.out.println(gson.toJson(results[0].addressComponents)); |
| | | |
| | | |
| | | System.err.println(gson.toJson(results[0].addressComponents)); |
| | | vo = new ReverseGeocodeVo(); |
| | | AddressComponent[] addressComponents = results[0].addressComponents; |
| | | AddressComponentsVo[] addressComponentsVos = new AddressComponentsVo[addressComponents.length]; |
| | |
| | | .apiKey(key) |
| | | .build(); |
| | | FindPlaceFromTextRequest request = new FindPlaceFromTextRequest(context); |
| | | request.language("en"); |
| | | request.input(input); |
| | | request.inputType(FindPlaceFromTextRequest.InputType.TEXT_QUERY); |
| | | FindPlaceFromText findPlaceFromText = request.await(); |
| | | PlacesSearchResult[] candidates = findPlaceFromText.candidates; |
| | | FindPlaceFromTextVo vo = null; |
| | | System.err.println(JSON.toJSONString(candidates)); |
| | | if(candidates.length > 0){ |
| | | vo = new FindPlaceFromTextVo(); |
| | | String formattedAddress = candidates[0].formattedAddress; |
| | | String name = candidates[0].name; |
| | | Geometry geometry = candidates[0].geometry; |
| | | if(null == geometry){//没有返回结果,使用place_id继续搜索 |
| | | // [{"permanentlyClosed":false,"placeId":"ChIJy1edVzvF7zYRaOqiGTkmb6I","rating":0.0,"userRatingsTotal":0}] |
| | | String placeId = candidates[0].placeId; |
| | | |
| | | |
| | | } |
| | | LatLng location = geometry.location; |
| | | double lat = location.lat; |
| | | double lng = location.lng; |
| | |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 模糊搜索地图内容 |
| | | * @param query |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static FindPlaceFromTextVo textsearch(String query) throws Exception{ |
| | | GeoApiContext context = new GeoApiContext.Builder() |
| | | .apiKey(key) |
| | | .build(); |
| | | TextSearchRequest request = new TextSearchRequest(context); |
| | | request.language("en"); |
| | | request.query(query); |
| | | PlacesSearchResponse placesSearchResponse = request.await(); |
| | | PlacesSearchResult[] results = placesSearchResponse.results; |
| | | FindPlaceFromTextVo vo = null; |
| | | System.err.println(JSON.toJSONString(results)); |
| | | if(results.length > 0){ |
| | | vo = new FindPlaceFromTextVo(); |
| | | String formattedAddress = results[0].formattedAddress; |
| | | String name = results[0].name; |
| | | Geometry geometry = results[0].geometry; |
| | | LatLng location = geometry.location; |
| | | double lat = location.lat; |
| | | double lng = location.lng; |
| | | |
| | | vo.setName(name); |
| | | vo.setAddress(formattedAddress); |
| | | vo.setLat(lat); |
| | | vo.setLng(lng); |
| | | } |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | .apiKey(key) |
| | | .build(); |
| | | DistanceMatrixApiRequest request = DistanceMatrixApi.getDistanceMatrix(context, new String[]{origin}, new String[]{destination}); |
| | | request.language("en"); |
| | | request.mode(TravelMode.DRIVING);//出行方式(驾车) |
| | | DistanceMatrix distanceMatrix = request.await(); |
| | | Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
| | | System.out.println(gson.toJson(distanceMatrix)); |
| | | System.err.println(gson.toJson(distanceMatrix)); |
| | | context.shutdown(); |
| | | |
| | | DistanceMatrixElement elements = distanceMatrix.rows[0].elements[0]; |
| | | DistanceMatrixElementStatus status = elements.status; |
| | | DistancematrixVo vo = new DistancematrixVo(); |
| | | vo.setDistance(elements.distance.inMeters); |
| | | vo.setDuration(elements.duration.inSeconds); |
| | | if(DistanceMatrixElementStatus.OK.equals(status)){ |
| | | vo.setDistance(elements.distance.inMeters); |
| | | vo.setDuration(elements.duration.inSeconds); |
| | | }else{ |
| | | vo.setDistance(0L); |
| | | vo.setDuration(0L); |
| | | } |
| | | return vo; |
| | | } |
| | | |
| | |
| | | .apiKey(key) |
| | | .build(); |
| | | DirectionsApiRequest directions = DirectionsApi.getDirections(context, origin, destination); |
| | | directions.language("en"); |
| | | directions.mode(TravelMode.DRIVING);//出行方式(驾车) |
| | | DirectionsResult result = directions.await(); |
| | | |
| | | Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
| | | System.out.println(gson.toJson(result)); |
| | | System.err.println(gson.toJson(result)); |
| | | context.shutdown(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public static void main(String[] ages){ |
| | | try { |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | String subject = params.get("subject"); |
| | | String total_amount = params.get("total_amount"); |
| | | String trade_no = params.get("trade_no"); |
| | | String passback_params = params.get("passback_params"); |
| | | map.put("out_trade_no", out_trade_no);//商家订单号 |
| | | map.put("subject", subject); |
| | | map.put("total_amount", total_amount); |
| | |
| | | map1.put("result", result); |
| | | return map1; |
| | | }else{ |
| | | // System.err.println(map.get("err_code_des")); |
| | | System.err.println(map.get("err_code_des")); |
| | | } |
| | | }else{ |
| | | // System.err.println(map.get("return_msg")); |
| | | System.err.println(map.get("return_msg")); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | if(null == distance){ |
| | | System.err.println("查询距离出错了"); |
| | | }else{ |
| | | d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000)).setScale(2, BigDecimal.ROUND_HALF_EVEN).toString(); |
| | | t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60)).setScale(2, BigDecimal.ROUND_HALF_EVEN).intValue() + ""; |
| | | d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000), new MathContext(2, RoundingMode.HALF_EVEN)).toString(); |
| | | t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).intValue() + ""; |
| | | } |
| | | JSONObject msg = new JSONObject(); |
| | | msg.put("code", 200); |
| | |
| | | if(null == distance){ |
| | | System.err.println("查询距离出错了"); |
| | | }else{ |
| | | d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000)).setScale(2, BigDecimal.ROUND_HALF_EVEN).toString(); |
| | | t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60)).setScale(2, BigDecimal.ROUND_HALF_EVEN).intValue() + ""; |
| | | d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000), new MathContext(2, RoundingMode.HALF_EVEN)).toString(); |
| | | t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).intValue() + ""; |
| | | } |
| | | map.put("laveMileage", d);//距离终点剩余未服务的里程数 |
| | | map.put("laveTime", t);//距离终端剩余未服务的预计时间 |
| | |
| | | timer.cancel(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 线下支付数据推送 |
| | | * @param type |
| | | * @param uid |
| | | * @param orderId |
| | | * @param orderType |
| | | */ |
| | | public void pushOfflinePayment(Integer type, Integer uid, Integer orderId, Integer orderType){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("code", 200); |
| | | jsonObject.put("msg", "SUCCESS"); |
| | | jsonObject.put("method", "OFFLINE_PAYMENT"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("orderId", orderId); |
| | | map.put("orderType", orderType); |
| | | jsonObject.put("data", map); |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", jsonObject.toJSONString()); |
| | | params.add("id", String.valueOf(uid)); |
| | | params.add("type", String.valueOf(type)); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util; |
| | | |
| | | |
| | | import javax.net.ssl.*; |
| | | import java.io.*; |
| | | import java.net.URL; |
| | | import java.net.URLEncoder; |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.security.cert.CertificateException; |
| | | import java.security.cert.X509Certificate; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | public class SMSUtil { |
| | | |
| | | //无需修改,用于格式化鉴权头域,给"X-WSSE"参数赋值 |
| | | private static final String WSSE_HEADER_FORMAT = "UsernameToken Username=\"%s\",PasswordDigest=\"%s\",Nonce=\"%s\",Created=\"%s\""; |
| | | //无需修改,用于格式化鉴权头域,给"Authorization"参数赋值 |
| | | private static final String AUTH_HEADER_VALUE = "WSSE realm=\"SDP\",profile=\"UsernameToken\",type=\"Appkey\""; |
| | | |
| | | /** |
| | | * 发送短信(华为云) |
| | | * @param templateId 模板id |
| | | * @param receiver 必填,全局号码格式(包含国家码),示例:+8615123456789,多个号码之间用英文逗号分隔 |
| | | * @param templateParas 选填,使用无变量模板时请赋空值 String templateParas = "",双变量模板示例:模板内容为"您有${1}件快递请到${2}领取"时,templateParas可填写为"[\"3\",\"人民公园正门\"]" |
| | | * 模板变量,此处以单变量验证码短信为例,请客户自行生成6位验证码,并定义为字符串类型,以杜绝首位0丢失的问题(例如:002569变成了2569) |
| | | * @throws Exception |
| | | */ |
| | | public static void send_huawei_sms(String templateId, String receiver, String templateParas) throws Exception { |
| | | |
| | | //必填,请参考"开发准备"获取如下数据,替换为实际值 |
| | | String url = "https://smsapi.cn-south-1.myhuaweicloud.com:443"; //APP接入地址(在控制台"应用管理"页面获取)+接口访问URI |
| | | String appKey = "g3DW0G5Fbp3110UiGl5fkWcn799s"; //APP_Key |
| | | String appSecret = "LaT1NYvQKNkHO5KikniEueN8iTaz"; //APP_Secret |
| | | String sender = "ismsapp0000000103"; //国内短信签名通道号或国际/港澳台短信通道号 |
| | | |
| | | //条件必填,国内短信关注,当templateId指定的模板类型为通用模板时生效且必填,必须是已审核通过的,与模板类型一致的签名名称 |
| | | //国际/港澳台短信不用关注该参数 |
| | | String signature = "IGO"; //签名名称 |
| | | |
| | | //选填,短信状态报告接收地址,推荐使用域名,为空或者不填表示不接收状态报告 |
| | | String statusCallBack = ""; |
| | | |
| | | //请求Body,不携带签名名称时,signature请填null |
| | | String body = buildRequestBody(sender, receiver, templateId, templateParas, statusCallBack, signature); |
| | | if (null == body || body.isEmpty()) { |
| | | System.out.println("body is null."); |
| | | return; |
| | | } |
| | | |
| | | //请求Headers中的X-WSSE参数值 |
| | | String wsseHeader = buildWsseHeader(appKey, appSecret); |
| | | if (null == wsseHeader || wsseHeader.isEmpty()) { |
| | | System.out.println("wsse header is null."); |
| | | return; |
| | | } |
| | | |
| | | Writer out = null; |
| | | BufferedReader in = null; |
| | | StringBuffer result = new StringBuffer(); |
| | | HttpsURLConnection connection = null; |
| | | InputStream is = null; |
| | | |
| | | |
| | | HostnameVerifier hv = new HostnameVerifier() { |
| | | |
| | | @Override |
| | | public boolean verify(String hostname, SSLSession session) { |
| | | return true; |
| | | } |
| | | }; |
| | | trustAllHttpsCertificates(); |
| | | |
| | | try { |
| | | URL realUrl = new URL(url); |
| | | connection = (HttpsURLConnection) realUrl.openConnection(); |
| | | |
| | | connection.setHostnameVerifier(hv); |
| | | connection.setDoOutput(true); |
| | | connection.setDoInput(true); |
| | | connection.setUseCaches(true); |
| | | //请求方法 |
| | | connection.setRequestMethod("POST"); |
| | | //请求Headers参数 |
| | | connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); |
| | | connection.setRequestProperty("Authorization", AUTH_HEADER_VALUE); |
| | | connection.setRequestProperty("X-WSSE", wsseHeader); |
| | | |
| | | connection.connect(); |
| | | out = new OutputStreamWriter(connection.getOutputStream()); |
| | | out.write(body); //发送请求Body参数 |
| | | out.flush(); |
| | | out.close(); |
| | | |
| | | int status = connection.getResponseCode(); |
| | | if (200 == status) { //200 |
| | | is = connection.getInputStream(); |
| | | } else { //400/401 |
| | | is = connection.getErrorStream(); |
| | | } |
| | | in = new BufferedReader(new InputStreamReader(is, "UTF-8")); |
| | | String line = ""; |
| | | while ((line = in.readLine()) != null) { |
| | | result.append(line); |
| | | } |
| | | System.out.println(result.toString()); //打印响应消息实体 |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | if (null != out) { |
| | | out.close(); |
| | | } |
| | | if (null != is) { |
| | | is.close(); |
| | | } |
| | | if (null != in) { |
| | | in.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 构造请求Body体 |
| | | * @param sender |
| | | * @param receiver |
| | | * @param templateId |
| | | * @param templateParas |
| | | * @param statusCallBack |
| | | * @param signature | 签名名称,使用国内短信通用模板时填写 |
| | | * @return |
| | | */ |
| | | static String buildRequestBody(String sender, String receiver, String templateId, String templateParas, |
| | | String statusCallBack, String signature) { |
| | | if (null == sender || null == receiver || null == templateId || sender.isEmpty() || receiver.isEmpty() |
| | | || templateId.isEmpty()) { |
| | | System.out.println("buildRequestBody(): sender, receiver or templateId is null."); |
| | | return null; |
| | | } |
| | | Map<String, String> map = new HashMap<String, String>(); |
| | | |
| | | map.put("from", sender); |
| | | map.put("to", receiver); |
| | | map.put("templateId", templateId); |
| | | if (null != templateParas && !templateParas.isEmpty()) { |
| | | map.put("templateParas", templateParas); |
| | | } |
| | | if (null != statusCallBack && !statusCallBack.isEmpty()) { |
| | | map.put("statusCallback", statusCallBack); |
| | | } |
| | | if (null != signature && !signature.isEmpty()) { |
| | | map.put("signature", signature); |
| | | } |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | String temp = ""; |
| | | |
| | | for (String s : map.keySet()) { |
| | | try { |
| | | temp = URLEncoder.encode(map.get(s), "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | sb.append(s).append("=").append(temp).append("&"); |
| | | } |
| | | |
| | | return sb.deleteCharAt(sb.length()-1).toString(); |
| | | } |
| | | |
| | | /** |
| | | * 构造X-WSSE参数值 |
| | | * @param appKey |
| | | * @param appSecret |
| | | * @return |
| | | */ |
| | | static String buildWsseHeader(String appKey, String appSecret) { |
| | | if (null == appKey || null == appSecret || appKey.isEmpty() || appSecret.isEmpty()) { |
| | | System.out.println("buildWsseHeader(): appKey or appSecret is null."); |
| | | return null; |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); |
| | | String time = sdf.format(new Date()); //Created |
| | | String nonce = UUID.randomUUID().toString().replace("-", ""); //Nonce |
| | | |
| | | MessageDigest md; |
| | | byte[] passwordDigest = null; |
| | | |
| | | try { |
| | | md = MessageDigest.getInstance("SHA-256"); |
| | | md.update((nonce + time + appSecret).getBytes()); |
| | | passwordDigest = md.digest(); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | //如果JDK版本是1.8,请加载原生Base64类,并使用如下代码 |
| | | String passwordDigestBase64Str = Base64.getEncoder().encodeToString(passwordDigest); //PasswordDigest |
| | | //如果JDK版本低于1.8,请加载三方库提供Base64类,并使用如下代码 |
| | | //String passwordDigestBase64Str = Base64.encodeBase64String(passwordDigest); //PasswordDigest |
| | | //若passwordDigestBase64Str中包含换行符,请执行如下代码进行修正 |
| | | //passwordDigestBase64Str = passwordDigestBase64Str.replaceAll("[\\s*\t\n\r]", ""); |
| | | return String.format(WSSE_HEADER_FORMAT, appKey, passwordDigestBase64Str, nonce, time); |
| | | } |
| | | |
| | | /*** @throws Exception |
| | | */ |
| | | static void trustAllHttpsCertificates() throws Exception { |
| | | TrustManager[] trustAllCerts = new TrustManager[] { |
| | | new X509TrustManager() { |
| | | public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { |
| | | return; |
| | | } |
| | | public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { |
| | | return; |
| | | } |
| | | public X509Certificate[] getAcceptedIssuers() { |
| | | return null; |
| | | } |
| | | } |
| | | }; |
| | | SSLContext sc = SSLContext.getInstance("SSL"); |
| | | sc.init(null, trustAllCerts, null); |
| | | HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); |
| | | } |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.system.util.Tingg; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.util.HttpClientUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.TokenResponse; |
| | | import org.apache.http.protocol.HTTP; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.CheckoutRequest; |
| | | import io.cellulant.model.Payload; |
| | | import io.cellulant.service.CheckoutEncryption; |
| | | |
| | | import java.net.HttpURLConnection; |
| | | import java.util.Calendar; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.TimeZone; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * Tingg支付工具类 |
| | | */ |
| | | @Component |
| | | public class TinggPayUtil { |
| | | |
| | | @Autowired |
| | | private HttpClientUtil httpClientUtil; |
| | | private static String accessKey = "KxjPP444jEE7K88E7juej4PKqqzKq7qKjKj84q744q9zj4Ej4zK47uj4KKj4"; |
| | | |
| | | private static String ivKey = "qsffKsCOJJdhSBCQ"; |
| | | |
| | | private static String secretKey = "9jjz4Ex74P8ue4qK"; |
| | | |
| | | |
| | | /** |
| | | * 获取token |
| | | * 获取支付数据 |
| | | * @param checkoutRequest |
| | | * @return |
| | | */ |
| | | public TokenResponse getToken(){ |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("grant_type", "client_credentials"); |
| | | params.put("client_id", TinggConfigEnum.CLIENT_ID.getValue()); |
| | | params.put("client_secret", TinggConfigEnum.CLIENT_SECRET.getValue()); |
| | | |
| | | String s = httpClientUtil.pushHttpRequset("POST", TinggConfigEnum.TOKEN_URL.getValue(), params, null, "json"); |
| | | if(ToolUtil.isNotEmpty(s)){ |
| | | TokenResponse tokenResponse = JSON.parseObject(s, TokenResponse.class); |
| | | return tokenResponse; |
| | | public static ResultUtil checkoutRequest(CheckoutRequest checkoutRequest){ |
| | | try { |
| | | CheckoutEncryption checkoutEncrption = new CheckoutEncryption(ivKey, secretKey); |
| | | Payload payload = getPayload(checkoutRequest); |
| | | String param = checkoutEncrption.encrypt(payload); |
| | | System.out.println("Encrpted payload=" + param); |
| | | String url = "https://online.uat.tingg.africa/testing/express/checkout?encrypted_payload=" + param + "&access_key=" + accessKey; |
| | | return ResultUtil.success(url); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | public ResultUtil checkoutRequest(String phone, String email, Double amount){ |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("merchantTransactionID", "");//商家的唯一交易标识符 |
| | | params.put("currencyCode", "");//通过的金额所使用的货币 |
| | | params.put("requestAmount", amount);//客户将要支付的总金额 |
| | | params.put("countryCode", "");//商家的默认国家代码 |
| | | params.put("accountNumber", "");//交易的帐号/参考编号 |
| | | params.put("serviceCode", "");//商户的服务代码 |
| | | Calendar.getInstance(TimeZone.getTimeZone("UTC")); |
| | | params.put("dueDate", "");//事务到期日期的格式为YYYY-MM-DD HH:mm:ss。这应该是UTC时间 |
| | | params.put("requestDescription", "");//事务的叙述 |
| | | params.put("customerFirstName", "");//顾客名称 |
| | | params.put("customerLastName", "");//客户的姓氏 |
| | | params.put("MSISDN", phone);//客户的手机号码 |
| | | params.put("customerEmail", email);//客户的邮件 |
| | | params.put("paymentWebhookUrl", "");//这是结帐将使用的URL,用相关的支付细节调用商家,以便商家确认支付 |
| | | |
| | | Map<String, String> header = new HashMap<>(); |
| | | TokenResponse token = getToken(); |
| | | if(null == token || ToolUtil.isNotEmpty(token.getError())){ |
| | | System.err.println("调用支付异常,获取token凭证失败!【" + token.getError() + "-----" + token.getMessage() + "】"); |
| | | return ResultUtil.error("调用支付异常"); |
| | | } |
| | | header.put("Authorization", "Bearer " + token.getAccess_token()); |
| | | header.put("Content-Type", "application/json"); |
| | | public static Payload getPayload(CheckoutRequest checkoutRequest) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String countryCode="GHA";//收取付款的国家的3位ISO代码 |
| | | String currencyCode = "GHS";//3位ISO代码的货币,商家正在开发票。 |
| | | String serviceCode="IGOGHANA";//服务代码 |
| | | String dueDate = sdf.format(new Date(System.currentTimeMillis() + 1800000));//到期时间 |
| | | String languageCode="EN"; |
| | | String paymentOptionCode = "";//支付选项码 |
| | | |
| | | String s = httpClientUtil.pushHttpRequset("POST", TinggConfigEnum.CHECKOUT_URL.getValue(), params, header, "json"); |
| | | if(ToolUtil.isNotEmpty(s)){ |
| | | Payload payload = new Payload(checkoutRequest.getMerchantTransactionId(), checkoutRequest.getCustomerFirstName(), checkoutRequest.getCustomerLastName(), checkoutRequest.getMsisdn(), checkoutRequest.getCustomerEmail(), |
| | | checkoutRequest.getRequestAmount(), currencyCode, checkoutRequest.getAccountNumber(), serviceCode, dueDate, checkoutRequest.getRequestDescription(), |
| | | countryCode, languageCode, paymentOptionCode, checkoutRequest.getSuccessRedirectUrl(), checkoutRequest.getFailRedirectUrl(), checkoutRequest.getPendingRedirectUrl(), checkoutRequest.getCallbackUrl()); |
| | | return payload; |
| | | } |
| | | |
| | | } |
| | | |
| | | public static void main(String[] ages){ |
| | | CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | checkoutRequest.setMsisdn(233240000000L); |
| | | checkoutRequest.setCustomerEmail("393733352@qq.com"); |
| | | checkoutRequest.setAccountNumber("4111111111111111"); |
| | | checkoutRequest.setCustomerFirstName("zhibing"); |
| | | checkoutRequest.setCustomerLastName("pu"); |
| | | checkoutRequest.setRequestAmount(1.00D); |
| | | checkoutRequest.setMerchantTransactionId("123456T"); |
| | | checkoutRequest.setRequestDescription("payment test"); |
| | | checkoutRequest.setCallbackUrl("https://10pz685243.zicp.fun"); |
| | | checkoutRequest.setPendingRedirectUrl("https://10pz685243.zicp.fun"); |
| | | checkoutRequest.setSuccessRedirectUrl("https://10pz685243.zicp.fun"); |
| | | checkoutRequest.setFailRedirectUrl("https://www.baidu.com"); |
| | | ResultUtil resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | System.err.println(JSON.toJSONString(resultUtil)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.Tingg.model; |
| | | |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 支付回调 |
| | | */ |
| | | public class CallbackRequest { |
| | | /** |
| | | * Cellulant末端的唯一标识符。 |
| | | */ |
| | | private Long checkout_request_id; |
| | | /** |
| | | * 商家单号 |
| | | */ |
| | | private String merchant_transaction_id; |
| | | /** |
| | | * 支付金额 |
| | | */ |
| | | private Double request_amount; |
| | | /** |
| | | * 由商家以发票货币提出的原始请求金额 |
| | | */ |
| | | private Double original_request_amount; |
| | | /** |
| | | * 为客户支付的请求转换的货币。 |
| | | */ |
| | | private String request_currency_code; |
| | | /** |
| | | * 商家在ISO代码中提出要求的货币代码。 |
| | | */ |
| | | private String original_request_currency_code; |
| | | /** |
| | | * 支付账户。 |
| | | */ |
| | | private String account_number; |
| | | /** |
| | | * 所支付的ISO货币代码 |
| | | */ |
| | | private String currency_code; |
| | | /** |
| | | * 客户为请求支付的金额。 |
| | | */ |
| | | private Double amount_paid; |
| | | /** |
| | | * 为发起的请求添加到服务中的费用。 |
| | | */ |
| | | private Double service_charge_amount; |
| | | /** |
| | | * 提出请求的日期。 |
| | | */ |
| | | private Date request_date; |
| | | /** |
| | | * 唯一的服务代码,用于标识引发支付请求的服务。 |
| | | */ |
| | | private String service_code; |
| | | /** |
| | | * 指示服务是否成功或付费的总体请求代码。。 |
| | | * 177-部分付费请求 |
| | | * 178-表明请求已全额支付 |
| | | * 179-表示请求已部分支付但已过期。 |
| | | * 129-请求已过期,未付款。 |
| | | * 180.商户拒绝请求 |
| | | * 183-商户接受请求,我们可以结算资金 |
| | | * 188-商户收到请求。 |
| | | */ |
| | | private String request_status_code; |
| | | /** |
| | | * webhook请求返回的状态描述。 |
| | | */ |
| | | private String request_status_description; |
| | | /** |
| | | * 电话号码 |
| | | */ |
| | | private String msisdn; |
| | | /** |
| | | * 对请求成功支付的数组。 |
| | | */ |
| | | private List<Payments> payments; |
| | | /** |
| | | * 已启动但未成功授权的任何支付的数组。 |
| | | */ |
| | | private List<Payments> failed_payments; |
| | | /** |
| | | * 元数据 |
| | | */ |
| | | private String extra_data; |
| | | /** |
| | | * 国家的缩写 |
| | | */ |
| | | private String country_abbrv; |
| | | |
| | | public Long getCheckout_request_id() { |
| | | return checkout_request_id; |
| | | } |
| | | |
| | | public void setCheckout_request_id(Long checkout_request_id) { |
| | | this.checkout_request_id = checkout_request_id; |
| | | } |
| | | |
| | | public String getMerchant_transaction_id() { |
| | | return merchant_transaction_id; |
| | | } |
| | | |
| | | public void setMerchant_transaction_id(String merchant_transaction_id) { |
| | | this.merchant_transaction_id = merchant_transaction_id; |
| | | } |
| | | |
| | | public Double getRequest_amount() { |
| | | return request_amount; |
| | | } |
| | | |
| | | public void setRequest_amount(Double request_amount) { |
| | | this.request_amount = request_amount; |
| | | } |
| | | |
| | | public Double getOriginal_request_amount() { |
| | | return original_request_amount; |
| | | } |
| | | |
| | | public void setOriginal_request_amount(Double original_request_amount) { |
| | | this.original_request_amount = original_request_amount; |
| | | } |
| | | |
| | | public String getRequest_currency_code() { |
| | | return request_currency_code; |
| | | } |
| | | |
| | | public void setRequest_currency_code(String request_currency_code) { |
| | | this.request_currency_code = request_currency_code; |
| | | } |
| | | |
| | | public String getOriginal_request_currency_code() { |
| | | return original_request_currency_code; |
| | | } |
| | | |
| | | public void setOriginal_request_currency_code(String original_request_currency_code) { |
| | | this.original_request_currency_code = original_request_currency_code; |
| | | } |
| | | |
| | | public String getAccount_number() { |
| | | return account_number; |
| | | } |
| | | |
| | | public void setAccount_number(String account_number) { |
| | | this.account_number = account_number; |
| | | } |
| | | |
| | | public String getCurrency_code() { |
| | | return currency_code; |
| | | } |
| | | |
| | | public void setCurrency_code(String currency_code) { |
| | | this.currency_code = currency_code; |
| | | } |
| | | |
| | | public Double getAmount_paid() { |
| | | return amount_paid; |
| | | } |
| | | |
| | | public void setAmount_paid(Double amount_paid) { |
| | | this.amount_paid = amount_paid; |
| | | } |
| | | |
| | | public Double getService_charge_amount() { |
| | | return service_charge_amount; |
| | | } |
| | | |
| | | public void setService_charge_amount(Double service_charge_amount) { |
| | | this.service_charge_amount = service_charge_amount; |
| | | } |
| | | |
| | | public Date getRequest_date() { |
| | | return request_date; |
| | | } |
| | | |
| | | public void setRequest_date(Date request_date) { |
| | | this.request_date = request_date; |
| | | } |
| | | |
| | | public String getService_code() { |
| | | return service_code; |
| | | } |
| | | |
| | | public void setService_code(String service_code) { |
| | | this.service_code = service_code; |
| | | } |
| | | |
| | | public String getRequest_status_code() { |
| | | return request_status_code; |
| | | } |
| | | |
| | | public void setRequest_status_code(String request_status_code) { |
| | | this.request_status_code = request_status_code; |
| | | } |
| | | |
| | | public String getRequest_status_description() { |
| | | return request_status_description; |
| | | } |
| | | |
| | | public void setRequest_status_description(String request_status_description) { |
| | | this.request_status_description = request_status_description; |
| | | } |
| | | |
| | | public String getMsisdn() { |
| | | return msisdn; |
| | | } |
| | | |
| | | public void setMsisdn(String msisdn) { |
| | | this.msisdn = msisdn; |
| | | } |
| | | |
| | | public List<Payments> getPayments() { |
| | | return payments; |
| | | } |
| | | |
| | | public void setPayments(List<Payments> payments) { |
| | | this.payments = payments; |
| | | } |
| | | |
| | | public List<Payments> getFailed_payments() { |
| | | return failed_payments; |
| | | } |
| | | |
| | | public void setFailed_payments(List<Payments> failed_payments) { |
| | | this.failed_payments = failed_payments; |
| | | } |
| | | |
| | | public String getExtra_data() { |
| | | return extra_data; |
| | | } |
| | | |
| | | public void setExtra_data(String extra_data) { |
| | | this.extra_data = extra_data; |
| | | } |
| | | |
| | | public String getCountry_abbrv() { |
| | | return country_abbrv; |
| | | } |
| | | |
| | | public void setCountry_abbrv(String country_abbrv) { |
| | | this.country_abbrv = country_abbrv; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.Tingg.model; |
| | | |
| | | /** |
| | | * 支付回调后的响应 |
| | | */ |
| | | public class CallbackResponse { |
| | | /** |
| | | * 数据库中唯一的纤维素ID |
| | | */ |
| | | private String checkout_request_id; |
| | | /** |
| | | * 商家为请求提出的唯一Id |
| | | */ |
| | | private String merchant_transaction_id; |
| | | /** |
| | | * 状态码,指示请求是否成功接收、失败或接受 |
| | | */ |
| | | private String status_code; |
| | | /** |
| | | * 状态码解释。 |
| | | * 183表示成功 |
| | | * 180表示拒绝付款。 |
| | | * 188表示收到的款项。 |
| | | */ |
| | | private String status_description; |
| | | /** |
| | | * 返回的确认响应的唯一标识符。 |
| | | */ |
| | | private String receipt_number; |
| | | |
| | | public String getCheckout_request_id() { |
| | | return checkout_request_id; |
| | | } |
| | | |
| | | public void setCheckout_request_id(String checkout_request_id) { |
| | | this.checkout_request_id = checkout_request_id; |
| | | } |
| | | |
| | | public String getMerchant_transaction_id() { |
| | | return merchant_transaction_id; |
| | | } |
| | | |
| | | public void setMerchant_transaction_id(String merchant_transaction_id) { |
| | | this.merchant_transaction_id = merchant_transaction_id; |
| | | } |
| | | |
| | | public String getStatus_code() { |
| | | return status_code; |
| | | } |
| | | |
| | | public void setStatus_code(String status_code) { |
| | | this.status_code = status_code; |
| | | } |
| | | |
| | | public String getStatus_description() { |
| | | return status_description; |
| | | } |
| | | |
| | | public void setStatus_description(String status_description) { |
| | | this.status_description = status_description; |
| | | } |
| | | |
| | | public String getReceipt_number() { |
| | | return receipt_number; |
| | | } |
| | | |
| | | public void setReceipt_number(String receipt_number) { |
| | | this.receipt_number = receipt_number; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.Tingg.model; |
| | | |
| | | |
| | | public class CheckoutRequest { |
| | | /** |
| | | * 电话号码 |
| | | */ |
| | | private Long msisdn; |
| | | /** |
| | | * 邮件地址 |
| | | */ |
| | | private String customerEmail; |
| | | /** |
| | | * 支付账户 |
| | | */ |
| | | private String accountNumber; |
| | | /** |
| | | * 名 |
| | | */ |
| | | private String customerFirstName; |
| | | /** |
| | | * 姓 |
| | | */ |
| | | private String customerLastName; |
| | | /** |
| | | * 支付金额 |
| | | */ |
| | | private Double requestAmount; |
| | | /** |
| | | * 订单号 |
| | | */ |
| | | private String merchantTransactionId; |
| | | /** |
| | | * 描述 |
| | | */ |
| | | private String requestDescription; |
| | | /** |
| | | * 回调地址 |
| | | */ |
| | | private String callbackUrl; |
| | | /** |
| | | * 在客户点击回到商家后,我们将客户重定向到哪里 |
| | | */ |
| | | private String pendingRedirectUrl; |
| | | /** |
| | | * 成功付款后将客户重定向到那里 |
| | | */ |
| | | private String successRedirectUrl; |
| | | /** |
| | | * 付款超时后的重定向 |
| | | */ |
| | | private String failRedirectUrl; |
| | | |
| | | public Long getMsisdn() { |
| | | return msisdn; |
| | | } |
| | | |
| | | public void setMsisdn(Long msisdn) { |
| | | this.msisdn = msisdn; |
| | | } |
| | | |
| | | public String getCustomerEmail() { |
| | | return customerEmail; |
| | | } |
| | | |
| | | public void setCustomerEmail(String customerEmail) { |
| | | this.customerEmail = customerEmail; |
| | | } |
| | | |
| | | public String getAccountNumber() { |
| | | return accountNumber; |
| | | } |
| | | |
| | | public void setAccountNumber(String accountNumber) { |
| | | this.accountNumber = accountNumber; |
| | | } |
| | | |
| | | public String getCustomerFirstName() { |
| | | return customerFirstName; |
| | | } |
| | | |
| | | public void setCustomerFirstName(String customerFirstName) { |
| | | this.customerFirstName = customerFirstName; |
| | | } |
| | | |
| | | public String getCustomerLastName() { |
| | | return customerLastName; |
| | | } |
| | | |
| | | public void setCustomerLastName(String customerLastName) { |
| | | this.customerLastName = customerLastName; |
| | | } |
| | | |
| | | public Double getRequestAmount() { |
| | | return requestAmount; |
| | | } |
| | | |
| | | public void setRequestAmount(Double requestAmount) { |
| | | this.requestAmount = requestAmount; |
| | | } |
| | | |
| | | public String getMerchantTransactionId() { |
| | | return merchantTransactionId; |
| | | } |
| | | |
| | | public void setMerchantTransactionId(String merchantTransactionId) { |
| | | this.merchantTransactionId = merchantTransactionId; |
| | | } |
| | | |
| | | public String getRequestDescription() { |
| | | return requestDescription; |
| | | } |
| | | |
| | | public void setRequestDescription(String requestDescription) { |
| | | this.requestDescription = requestDescription; |
| | | } |
| | | |
| | | public String getCallbackUrl() { |
| | | return callbackUrl; |
| | | } |
| | | |
| | | public void setCallbackUrl(String callbackUrl) { |
| | | this.callbackUrl = callbackUrl; |
| | | } |
| | | |
| | | public String getPendingRedirectUrl() { |
| | | return pendingRedirectUrl; |
| | | } |
| | | |
| | | public void setPendingRedirectUrl(String pendingRedirectUrl) { |
| | | this.pendingRedirectUrl = pendingRedirectUrl; |
| | | } |
| | | |
| | | public String getSuccessRedirectUrl() { |
| | | return successRedirectUrl; |
| | | } |
| | | |
| | | public void setSuccessRedirectUrl(String successRedirectUrl) { |
| | | this.successRedirectUrl = successRedirectUrl; |
| | | } |
| | | |
| | | public String getFailRedirectUrl() { |
| | | return failRedirectUrl; |
| | | } |
| | | |
| | | public void setFailRedirectUrl(String failRedirectUrl) { |
| | | this.failRedirectUrl = failRedirectUrl; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.Tingg.model; |
| | | |
| | | import java.util.Date; |
| | | |
| | | public class Payments { |
| | | /** |
| | | * 付款人的客户姓名 |
| | | */ |
| | | private String customer_name; |
| | | /** |
| | | * 客户付费购买的商家推荐 |
| | | */ |
| | | private String account_number; |
| | | /** |
| | | * 独特的纤维素特性 |
| | | */ |
| | | private String cpg_transaction_id; |
| | | /** |
| | | * 所支付的ISO货币代码 |
| | | */ |
| | | private String currency_code; |
| | | /** |
| | | * 支付方式客户支付,如Airtel |
| | | */ |
| | | private String payer_client_code; |
| | | /** |
| | | * 付款选项客户名称 |
| | | */ |
| | | private String payer_client_name; |
| | | /** |
| | | * 客户支付的金额 |
| | | */ |
| | | private Double amount_paid; |
| | | /** |
| | | * 服务代码支付给 |
| | | */ |
| | | private String service_code; |
| | | /** |
| | | * 付款和收款的时间 |
| | | */ |
| | | private Date date_payment_received; |
| | | /** |
| | | * 用户付费的手机号码 |
| | | */ |
| | | private String msisdn; |
| | | /** |
| | | * 为交易生成的MNO或银行的唯一id |
| | | */ |
| | | private String payer_transaction_id; |
| | | /** |
| | | * 付款的整体状态如下表所示 |
| | | * 141 商户系统拒绝付款 |
| | | * 139 商户待付款确认 |
| | | * 140 商户接受的付款 |
| | | * 138 付款请求已启动但失败 |
| | | * 144 向商家交付但尚未确认成功的付款 |
| | | * 219 付款已上报 |
| | | */ |
| | | private String hub_overall_status; |
| | | /** |
| | | * 由MNO、银行或信用卡收款人提供的付款说明。 |
| | | */ |
| | | private String payer_narration; |
| | | |
| | | public String getCustomer_name() { |
| | | return customer_name; |
| | | } |
| | | |
| | | public void setCustomer_name(String customer_name) { |
| | | this.customer_name = customer_name; |
| | | } |
| | | |
| | | public String getAccount_number() { |
| | | return account_number; |
| | | } |
| | | |
| | | public void setAccount_number(String account_number) { |
| | | this.account_number = account_number; |
| | | } |
| | | |
| | | public String getCpg_transaction_id() { |
| | | return cpg_transaction_id; |
| | | } |
| | | |
| | | public void setCpg_transaction_id(String cpg_transaction_id) { |
| | | this.cpg_transaction_id = cpg_transaction_id; |
| | | } |
| | | |
| | | public String getCurrency_code() { |
| | | return currency_code; |
| | | } |
| | | |
| | | public void setCurrency_code(String currency_code) { |
| | | this.currency_code = currency_code; |
| | | } |
| | | |
| | | public String getPayer_client_code() { |
| | | return payer_client_code; |
| | | } |
| | | |
| | | public void setPayer_client_code(String payer_client_code) { |
| | | this.payer_client_code = payer_client_code; |
| | | } |
| | | |
| | | public String getPayer_client_name() { |
| | | return payer_client_name; |
| | | } |
| | | |
| | | public void setPayer_client_name(String payer_client_name) { |
| | | this.payer_client_name = payer_client_name; |
| | | } |
| | | |
| | | public Double getAmount_paid() { |
| | | return amount_paid; |
| | | } |
| | | |
| | | public void setAmount_paid(Double amount_paid) { |
| | | this.amount_paid = amount_paid; |
| | | } |
| | | |
| | | public String getService_code() { |
| | | return service_code; |
| | | } |
| | | |
| | | public void setService_code(String service_code) { |
| | | this.service_code = service_code; |
| | | } |
| | | |
| | | public Date getDate_payment_received() { |
| | | return date_payment_received; |
| | | } |
| | | |
| | | public void setDate_payment_received(Date date_payment_received) { |
| | | this.date_payment_received = date_payment_received; |
| | | } |
| | | |
| | | public String getMsisdn() { |
| | | return msisdn; |
| | | } |
| | | |
| | | public void setMsisdn(String msisdn) { |
| | | this.msisdn = msisdn; |
| | | } |
| | | |
| | | public String getPayer_transaction_id() { |
| | | return payer_transaction_id; |
| | | } |
| | | |
| | | public void setPayer_transaction_id(String payer_transaction_id) { |
| | | this.payer_transaction_id = payer_transaction_id; |
| | | } |
| | | |
| | | public String getHub_overall_status() { |
| | | return hub_overall_status; |
| | | } |
| | | |
| | | public void setHub_overall_status(String hub_overall_status) { |
| | | this.hub_overall_status = hub_overall_status; |
| | | } |
| | | |
| | | public String getPayer_narration() { |
| | | return payer_narration; |
| | | } |
| | | |
| | | public void setPayer_narration(String payer_narration) { |
| | | this.payer_narration = payer_narration; |
| | | } |
| | | } |
| | |
| | | @ApiModelProperty("是否有手机号码(1=否,2=是)") |
| | | private Integer phone; |
| | | @ApiModelProperty("是否有邮箱(1=否,2=是)") |
| | | private Integer email; |
| | | private String email; |
| | | @ApiModelProperty("紧急联系人") |
| | | private String emergencyContact; |
| | | @ApiModelProperty("联系人电话") |
| | |
| | | this.phone = phone; |
| | | } |
| | | |
| | | public Integer getEmail() { |
| | | public String getEmail() { |
| | | return email; |
| | | } |
| | | |
| | | public void setEmail(Integer email) { |
| | | public void setEmail(String email) { |
| | | this.email = email; |
| | | } |
| | | |
| | |
| | | package com.stylefeng.guns.modular.system.warpper; |
| | | |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | |
| | | private String phone; |
| | | @ApiModelProperty("邮箱地址") |
| | | private String email; |
| | | @ApiModelProperty("姓氏") |
| | | private String lastName; |
| | | @ApiModelProperty("名字") |
| | | private String firstName; |
| | | @ApiModelProperty("是否实名(1:否,2:是)") |
| | | private Integer isAuth; |
| | | @ApiModelProperty("实名认证状态(1=待认证,2=认证通过,3=认证失败)") |
| | |
| | | this.language = language; |
| | | } |
| | | |
| | | public String getLastName() { |
| | | return lastName; |
| | | } |
| | | |
| | | public void setLastName(String lastName) { |
| | | this.lastName = lastName; |
| | | } |
| | | |
| | | public String getFirstName() { |
| | | return firstName; |
| | | } |
| | | |
| | | public void setFirstName(String firstName) { |
| | | this.firstName = firstName; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "UserInfoWarpper{" + |
| | |
| | | userInfoWarpper.setEmergencyContactNumber(null != map.get("emergencyContactNumber") ? String.valueOf(map.get("emergencyContactNumber")) : ""); |
| | | userInfoWarpper.setBalance(null != map.get("balance") ? Double.valueOf(String.valueOf(map.get("balance"))) : 0); |
| | | userInfoWarpper.setEmail(null != map.get("email") ? String.valueOf(map.get("email")) : ""); |
| | | userInfoWarpper.setLastName(null != map.get("lastName") ? String.valueOf(map.get("lastName")) : ""); |
| | | userInfoWarpper.setFirstName(null != map.get("firstName") ? String.valueOf(map.get("firstName")) : ""); |
| | | userInfoWarpper.setLanguage(null != map.get("language") ? Integer.valueOf(String.valueOf(map.get("language"))) : 1); |
| | | } |
| | | return userInfoWarpper; |
| | |
| | | package com.stylefeng.guns.modular.system.warpper; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.stylefeng.guns.modular.system.model.Verified; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | @ApiModel("实名认证") |
| | | public class VerifiedWarpper { |
| | | @ApiModelProperty(value = "姓名", required = true, dataType = "String") |
| | | private String name; |
| | | @ApiModelProperty("姓氏") |
| | | private String lastName; |
| | | @ApiModelProperty("名字") |
| | | private String firstName; |
| | | @ApiModelProperty(value = "身份证号码", required = false, dataType = "String") |
| | | private String idcode; |
| | | @ApiModelProperty(value = "身份证正面照", required = false, dataType = "String") |
| | |
| | | @ApiModelProperty(value = "身份证背面照", required = false, dataType = "String") |
| | | private String img2; |
| | | |
| | | public String getName() { |
| | | return name; |
| | | public String getLastName() { |
| | | return lastName; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | public void setLastName(String lastName) { |
| | | this.lastName = lastName; |
| | | } |
| | | |
| | | public String getFirstName() { |
| | | return firstName; |
| | | } |
| | | |
| | | public void setFirstName(String firstName) { |
| | | this.firstName = firstName; |
| | | } |
| | | |
| | | public String getIdcode() { |
| | |
| | | @Override |
| | | public String toString() { |
| | | return "VerifiedWarpper{" + |
| | | "name='" + name + '\'' + |
| | | ", idcode='" + idcode + '\'' + |
| | | ", img1='" + img1 + '\'' + |
| | | ", img2='" + img2 + '\'' + |
| | |
| | | |
| | | public static Verified getVerified(VerifiedWarpper verifiedWarpper){ |
| | | Verified verified = new Verified(); |
| | | verified.setName(verifiedWarpper.getName()); |
| | | verified.setLastName(verifiedWarpper.getLastName()); |
| | | verified.setFirstName(verifiedWarpper.getFirstName()); |
| | | verified.setIdcode(verifiedWarpper.getIdcode()); |
| | | verified.setImg1(verifiedWarpper.getImg1()); |
| | | verified.setImg2(verifiedWarpper.getImg2()); |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil cancleOrderTaxi(Integer id, Integer payType, Integer cancleId, Integer type) throws Exception; |
| | | ResultUtil cancleOrderTaxi(Integer id, Integer payType, Integer cancleId, Integer type, Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil payTaxiOrder(Integer payType, Integer orderId, Integer couponId, Integer type)throws Exception; |
| | | ResultUtil payTaxiOrder(Integer payType, Integer orderId, Integer couponId, Integer type, Integer language)throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * 添加数据 |
| | | * @param orderId 订单id |
| | | * @param orderType 订单类型 |
| | | * @param payType 支付方式(1=微信,2=支付宝) |
| | | * @param payType 支付方式(1=线上支付) |
| | | * @param amount 支付金额 |
| | | * @param code 第三方支付单号 |
| | | * @param state 支付状态(1=待支付,2=已支付) |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | |
| | | public synchronized ResultUtil<BaseWarpper> taxiOrder(OrderTaxi orderTaxi, Integer uid) throws Exception { |
| | | //定义用户所属公司 |
| | | UserInfo userInfo1 = userInfoService.selectById(uid); |
| | | Company query = companyCityService.query(String.valueOf(orderTaxi.getStartLon()), String.valueOf(orderTaxi.getStartLat())); |
| | | Company query = companyCityService.query1(String.valueOf(orderTaxi.getStartLon()), String.valueOf(orderTaxi.getStartLat())); |
| | | if(null == query){ |
| | | return ResultUtil.error("出发点暂未开通"); |
| | | } |
| | |
| | | if(ToolUtil.isEmpty(userInfo.getPhone())){ |
| | | return ResultUtil.error("请先绑定手机号码"); |
| | | } |
| | | orderTaxi.setPassengers(userInfo.getName()); |
| | | orderTaxi.setPassengers(userInfo.getFirstName() + "." + userInfo.getLastName()); |
| | | orderTaxi.setPassengersPhone(userInfo.getPhone()); |
| | | } |
| | | orderTaxi.setState(1);//待接单 |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil cancleOrderTaxi(Integer id, Integer payType, Integer cancleId, Integer type) throws Exception { |
| | | public ResultUtil cancleOrderTaxi(Integer id, Integer payType, Integer cancleId, Integer type, Integer language) throws Exception { |
| | | OrderTaxi orderTaxi = this.selectById(id); |
| | | Integer uid = orderTaxi.getUserId(); |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | ResultUtil resultUtil = ResultUtil.success(""); |
| | | |
| | | if(null == orderTaxi){ |
| | | return ResultUtil.error("取消订单失败,订单信息有误", ""); |
| | | return ResultUtil.error((language == 1 ? "订单信息有误" : language == 2 ? "Incorrect order information" : "Informations de commande incorrectes"), ""); |
| | | } |
| | | if(orderTaxi.getState() != 12){ |
| | | return ResultUtil.error("取消订单失败,不合法的操作", ""); |
| | | return ResultUtil.error((language == 1 ? "订单取消失败" : language == 2 ? "Order cancellation failure" : "Annulation de commande échouée"), ""); |
| | | } |
| | | OrderCancel orderCancel = null; |
| | | if(null == cancleId){ |
| | |
| | | } |
| | | if(payType == 3){//余额支付 |
| | | if(userInfo.getBalance() != null && userInfo.getBalance() < query.getMoney()){ |
| | | return ResultUtil.error("余额不足,无法完成支付", ""); |
| | | return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient account balance" : "Solde de compte insuffisant"); |
| | | } |
| | | |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(query.getMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil payTaxiOrder(Integer payType, Integer orderId, Integer couponId, Integer type) throws Exception { |
| | | public ResultUtil payTaxiOrder(Integer payType, Integer orderId, Integer couponId, Integer type, Integer language) throws Exception { |
| | | OrderTaxi orderTaxi = this.selectById(orderId); |
| | | if(orderTaxi.getState() == 8 || orderTaxi.getState() == 9){ |
| | | return ResultUtil.error("订单已完成支付,不允许重复支付", ""); |
| | | return ResultUtil.error("订单已完成支付,不允许重复支付"); |
| | | } |
| | | if(orderTaxi.getState() != 7){ |
| | | return ResultUtil.error("订单不在待支付状态,不允许支付", ""); |
| | | return ResultUtil.error("订单不在待支付状态,不允许支付"); |
| | | } |
| | | Integer uid = orderTaxi.getUserId(); |
| | | Double orderMoney = orderTaxi.getOrderMoney(); |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | ResultUtil resultUtil = ResultUtil.success(new HashMap<>()); |
| | | ResultUtil resultUtil = ResultUtil.success(); |
| | | orderTaxi.setCouponMoney(0D);//初始化历史数据 |
| | | orderTaxi.setCouponId(null); |
| | | |
| | |
| | | if(null != couponId){ |
| | | userCouponRecord = userCouponRecordService.selectById(couponId); |
| | | if(userCouponRecord.getCompanyId() != orderTaxi.getCompanyId()){ |
| | | return ResultUtil.error("优惠券不能用于此订单", ""); |
| | | return ResultUtil.error("优惠券不能用于此订单"); |
| | | } |
| | | if(userCouponRecord.getState() == 2){ |
| | | return ResultUtil.error("优惠券已使用", ""); |
| | | return ResultUtil.error("优惠券已使用"); |
| | | } |
| | | if(userCouponRecord.getState() == 3){ |
| | | return ResultUtil.error("优惠券已过期", ""); |
| | | return ResultUtil.error("优惠券已过期"); |
| | | } |
| | | if(userCouponRecord.getCouponUseType() != 0 && userCouponRecord.getCouponUseType() != 2){ |
| | | return ResultUtil.error("优惠券不能用于此类型订单", ""); |
| | | return ResultUtil.error("优惠券不能用于此类型订单"); |
| | | } |
| | | if(userCouponRecord.getCouponType() == 2 && orderMoney.compareTo(userCouponRecord.getFullMoney()) < 0){ |
| | | return ResultUtil.error("优惠券不能用于此订单", ""); |
| | | return ResultUtil.error("优惠券不能用于此订单"); |
| | | } |
| | | orderMoney = orderMoney - userCouponRecord.getMoney(); |
| | | orderTaxi.setCouponMoney(userCouponRecord.getMoney()); |
| | |
| | | } |
| | | if(payType == 3){//余额支付 |
| | | if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){ |
| | | return ResultUtil.error("余额不足,无法完成支付", ""); |
| | | return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient account balance" : "Solde de compte insuffisant"); |
| | | } |
| | | |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | |
| | | c = new BigDecimal(orderTaxi.getOrderMoney()).subtract(d);//只有出行金额参与抽成,其余归属司机 |
| | | } |
| | | if(company.getIsTaxiFixedOrProportional() == 1){//比例 |
| | | d = new BigDecimal(orderTaxi.getTravelMoney()).multiply(new BigDecimal(taxi).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | d = new BigDecimal(orderTaxi.getTravelMoney()).multiply(new BigDecimal(taxi).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))); |
| | | c = new BigDecimal(orderTaxi.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | incomeService.saveData(1, orderTaxi.getCompanyId(), 2, orderTaxi.getId(), 2, d.doubleValue()); |
| | |
| | | if(null == distance){ |
| | | System.err.println("查询距离出错了"); |
| | | }else{ |
| | | d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000)).setScale(2, BigDecimal.ROUND_HALF_EVEN).toString(); |
| | | t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60)).setScale(2, BigDecimal.ROUND_HALF_EVEN).intValue() + ""; |
| | | d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000), new MathContext(2, RoundingMode.HALF_EVEN)).toString(); |
| | | t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).intValue() + ""; |
| | | } |
| | | OrderServerWarpper orderServerWarpper = new OrderServerWarpper(); |
| | | orderServerWarpper.setOrderId(orderTaxi.getId()); |
| | |
| | | if(null == distance){ |
| | | System.err.println("查询距离出错了"); |
| | | }else{ |
| | | d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000)).setScale(2, BigDecimal.ROUND_HALF_EVEN).toString(); |
| | | t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60)).setScale(2, BigDecimal.ROUND_HALF_EVEN).intValue() + ""; |
| | | d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000), new MathContext(2, RoundingMode.HALF_EVEN)).toString(); |
| | | t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).intValue() + ""; |
| | | } |
| | | orderServerWarpper.setReservationMileage("0"); |
| | | orderServerWarpper.setReservationTime("0"); |
| | |
| | | c = new BigDecimal(orderTaxi.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | if(company.getIsTaxiFixedOrProportional() == 1){//比例 |
| | | d = new BigDecimal(orderTaxi.getTravelMoney()).multiply(new BigDecimal(taxi).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | d = new BigDecimal(orderTaxi.getTravelMoney()).multiply(new BigDecimal(taxi).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))); |
| | | c = new BigDecimal(orderTaxi.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | incomeService.saveData(1, orderTaxi.getCompanyId(), 2, orderTaxi.getId(), 2, d.doubleValue()); |
| | |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | integers = JSON.parseArray(vehicle).toJavaList(Integer.class); |
| | | } |
| | | Company query = companyCityService.query(String.valueOf(orderTaxi.getStartLon()), String.valueOf(orderTaxi.getStartLat()));//获取起点所属分公司 |
| | | Company query = companyCityService.query1(String.valueOf(orderTaxi.getStartLon()), String.valueOf(orderTaxi.getStartLat()));//获取起点所属分公司 |
| | | List<PushOrder> querys = pushOrderService.querys(null, 2, query.getId());//获取需要推送的次数 |
| | | for(int i = 1; i <= querys.size(); i++){ |
| | | PushOrder pushOrder = pushOrderService.querys(i, 2, query.getId()).get(0); |
| | |
| | | application: |
| | | name: user-server |
| | | profiles: |
| | | active: @spring.active@ |
| | | # active: dev |
| | | active: produce |
| | | mvc: |
| | | static-path-pattern: /static/** |
| | | view: |
| | |
| | | |
| | | mybatis-plus: |
| | | typeAliasesPackage: com.stylefeng.guns.modular |
| | | configuration: |
| | | log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl |
| | | |
| | | log: |
| | | path: guns-logs |
| | | |
| | | eureka: |
| | | client: |
| | |
| | | |
| | | |
| | | spring: |
| | | profiles: local |
| | | datasource: |
| | | url: jdbc:mysql://127.0.0.1:3306/igotravel?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: root |
| | |
| | | |
| | | ################# 测试环境 ################### |
| | | #spring: |
| | | # profiles: local |
| | | # datasource: |
| | | # url: jdbc:mysql://127.0.0.1:3306/igotravel?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai |
| | | # username: root |
| | |
| | | |
| | | --- |
| | | |
| | | spring: |
| | | profiles: dev |
| | | datasource: |
| | | url: jdbc:mysql://127.0.0.1:3306/guns?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: root |
| | | password: root |
| | | db-name: guns #用来搜集数据库的所有表 |
| | | filters: wall,mergeStat |
| | | |
| | | --- |
| | | |
| | | spring: |
| | | profiles: test |
| | | datasource: |
| | | url: jdbc:mysql://127.0.0.1:3306/guns?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: root |
| | | password: root |
| | | filters: wall,mergeStat |
| | | |
| | | --- |
| | | |
| | | spring: |
| | | profiles: produce |
| | | datasource: |
| | | url: jdbc:mysql://127.0.0.1:3306/guns?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: root |
| | | password: root |
| | | filters: wall,mergeStat |
| | | |
| | | |
| | | --- |
| | | |
| | | wx: |
| | | grantType: authorization_code #填authorization_code |
| | |
| | | |
| | | --- |
| | | |
| | | #filePath: /usr/local/server/orderPostionFile/ #存储订单轨迹文件路径 |
| | | filePath: C:/orderPostionFile/ #存储订单轨迹文件路径 |
| | | filePath: /usr/local/server/orderPostionFile/ #存储订单轨迹文件路径 |
| | | #filePath: C:/orderPostionFile/ #存储订单轨迹文件路径 |
| | | |
| | | #支付回调地址 |
| | | #正式环境 |
| | | #callbackPath: https://okyueche.com:443/user |
| | | #测试环境 |
| | | callbackPath: http://39.108.37.243/user |
| | | callbackPath: http://182.160.16.251/user |
| | | |
| | | --- |
| | | |
| | |
| | | host: smtp.gmail.com # 配置 smtp 服务器地址 |
| | | port: 465 # smtp 服务器的端口 |
| | | username: southwindservice@gmail.com # 配置邮箱用户名(你的邮箱地址) |
| | | password: irkgrsuzxgmwrxzy # 配置申请到的授权码(刚让复制的授权码) |
| | | password: ogsntijmguisoiuk # 配置申请到的授权码(刚让复制的授权码) |
| | | default-encoding: UTF-8 # 配置邮件编码 |
| | | properties: |
| | | mail: |
| | |
| | | socketFactoryClass: javax.net.ssl.SSLSocketFactory # 配饰 SSL 加密工厂 |
| | | debug: true |
| | | from: southwindservice@gmail.com # 发送方邮件,配在yml中可方便更改 |
| | | template-path: /usr/local/nginx/html/mailbox/ |
| | | |
| | | --- |
| | | |
| | | #交通部推送数据功能开关 |
| | | pushMinistryOfTransport: false |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <configuration> |
| | | <!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,比如: 如果设置为WARN,则低于WARN的信息都不会输出 --> |
| | | <!-- scan:当此属性设置为true时,配置文档如果发生改变,将会被重新加载,默认值为true --> |
| | | <!-- scanPeriod:设置监测配置文档是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 --> |
| | | <!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 --> |
| | | <configuration scan="true" scanPeriod="10 seconds"> |
| | | <contextName>logback</contextName> |
| | | |
| | | <!--定义日志存放的位置--> |
| | | <springProperty scope="context" name="gunsLogPath" source="log.path" |
| | | defaultValue="guns-logs"/> |
| | | <!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义后,可以使“${}”来使用变量。 --> |
| | | <property name="log.path" value="/usr/local/server/logs/user"/> |
| | | |
| | | <!-- ****************************************************************************************** --> |
| | | <!-- ****************************** 本地开发只在控制台打印日志 ************************************ --> |
| | | <!-- ****************************************************************************************** --> |
| | | <springProfile name="local"> |
| | | <!--0. 日志格式和颜色渲染 --> |
| | | <!-- 彩色日志依赖的渲染类 --> |
| | | <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" /> |
| | | <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" /> |
| | | <conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" /> |
| | | <!-- 彩色日志格式 --> |
| | | <property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> |
| | | |
| | | <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
| | | <!--encoder 默认配置为PatternLayoutEncoder--> |
| | | <encoder> |
| | | <pattern>===%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger Line:%-3L - %msg%n</pattern> |
| | | <charset>utf-8</charset> |
| | | </encoder> |
| | | </appender> |
| | | <!--1. 输出到控制台--> |
| | | <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> |
| | | <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> |
| | | <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
| | | <level>debug</level> |
| | | </filter> |
| | | <encoder> |
| | | <Pattern>${CONSOLE_LOG_PATTERN}</Pattern> |
| | | <!-- 设置字符集 --> |
| | | <charset>UTF-8</charset> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | <!--2. 输出到文档--> |
| | | <!-- 2.1 level为 DEBUG 日志,时间滚动输出 --> |
| | | <appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/debug.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 日志归档 --> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录debug级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>debug</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 2.2 level为 INFO 日志,时间滚动输出 --> |
| | | <appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/info.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 每天日志归档路径以及格式 --> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录info级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>info</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 2.3 level为 WARN 日志,时间滚动输出 --> |
| | | <appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/warn.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 此处设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录warn级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>warn</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 2.4 level为 ERROR 日志,时间滚动输出 --> |
| | | <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/error.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 此处设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录ERROR级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>ERROR</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 2.5 所有 除了DEBUG级别的其它高于DEBUG的 日志,记录到一个文件 --> |
| | | <appender name="ALL_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/all.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 此处设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/all-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档记录除了DEBUG级别的其它高于DEBUG的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>DEBUG</level> |
| | | <onMatch>DENY</onMatch> |
| | | <onMismatch>ACCEPT</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- |
| | | <logger>用来设置某一个包或者具体的某一个类的日志打印级别、 |
| | | 以及指定<appender>。<logger>仅有一个name属性, |
| | | 一个可选的level和一个可选的addtivity属性。 |
| | | name:用来指定受此logger约束的某一个包或者具体的某一个类。 |
| | | level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, |
| | | 还有一个特殊值INHERITED或者同义词NULL,代表强制执行上级的级别。 |
| | | 如果未设置此属性,那么当前logger将会继承上级的级别。 |
| | | addtivity:是否向上级logger传递打印信息。默认是true。 |
| | | <logger name="org.springframework.web" level="info"/> |
| | | <logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/> |
| | | --> |
| | | |
| | | <!-- |
| | | root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性 |
| | | level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, |
| | | 不能设置为INHERITED或者同义词NULL。默认是DEBUG |
| | | 可以包含零个或多个元素,标识这个appender将会添加到这个logger。 |
| | | --> |
| | | |
| | | <!-- 4 最终的策略: |
| | | 基本策略(root级) + 根据profile在启动时, logger标签中定制化package日志级别(优先级高于上面的root级)--> |
| | | <springProfile name="dev"> |
| | | <root level="info"> |
| | | <appender-ref ref="STDOUT"/> |
| | | <appender-ref ref="CONSOLE" /> |
| | | <appender-ref ref="DEBUG_FILE" /> |
| | | <appender-ref ref="INFO_FILE" /> |
| | | <appender-ref ref="WARN_FILE" /> |
| | | <appender-ref ref="ERROR_FILE" /> |
| | | <appender-ref ref="ALL_FILE" /> |
| | | </root> |
| | | |
| | | <logger name="com.stylefeng.guns" level="debug" additivity="false"> |
| | | <appender-ref ref="STDOUT"/> |
| | | </logger> |
| | | |
| | | <logger name="com.stylefeng.guns.modular.system.dao" level="debug"/> |
| | | <logger name="business-log" level="warn"/> |
| | | </springProfile> |
| | | |
| | | <!-- ****************************************************************************************** --> |
| | | <!-- ********************** 放到服务器上不管在什么环境都只在文件记录日志 **************************** --> |
| | | <!-- ****************************************************************************************** --> |
| | | <springProfile name="!local"> |
| | | |
| | | <!-- 日志记录器,日期滚动记录 --> |
| | | <appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文件的路径及文件名 --> |
| | | <file>${gunsLogPath}/log_error.log</file> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 归档的日志文件的路径,例如今天是2013-12-21日志,当前写的日志文件路径为file节点指定,可以将此文件与file指定文件路径设置为不同路径,从而将当前日志文件或归档日志文件置不同的目录。 |
| | | 而2013-12-21的日志文件在由fileNamePattern指定。%d{yyyy-MM-dd}指定日期格式,%i指定索引 --> |
| | | <fileNamePattern>${gunsLogPath}/error/log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <!-- 除按日志记录之外,还配置了日志文件不能超过2M,若超过2M,日志文件会以索引0开始, |
| | | 命名日志文件,例如log-error-2013-12-21.0.log --> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>2MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | </rollingPolicy> |
| | | <!-- 追加方式记录日志 --> |
| | | <append>true</append> |
| | | <!-- 日志文件的格式 --> |
| | | <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
| | | <pattern>===%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger Line:%-3L - %msg%n</pattern> |
| | | <charset>utf-8</charset> |
| | | </encoder> |
| | | <!-- 此日志文件只记录error级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>error</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 日志记录器,日期滚动记录 --> |
| | | <appender name="FILE_ALL" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文件的路径及文件名 --> |
| | | <file>${gunsLogPath}/log_total.log</file> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 归档的日志文件的路径,例如今天是2013-12-21日志,当前写的日志文件路径为file节点指定,可以将此文件与file指定文件路径设置为不同路径,从而将当前日志文件或归档日志文件置不同的目录。 |
| | | 而2013-12-21的日志文件在由fileNamePattern指定。%d{yyyy-MM-dd}指定日期格式,%i指定索引 --> |
| | | <fileNamePattern>${gunsLogPath}/total/log-total-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <!-- 除按日志记录之外,还配置了日志文件不能超过2M,若超过2M,日志文件会以索引0开始, |
| | | 命名日志文件,例如log-error-2013-12-21.0.log --> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>2MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | </rollingPolicy> |
| | | <!-- 追加方式记录日志 --> |
| | | <append>true</append> |
| | | <!-- 日志文件的格式 --> |
| | | <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
| | | <pattern>===%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger Line:%-3L - %msg%n</pattern> |
| | | <charset>utf-8</charset> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | <springProfile name="fat"> |
| | | <root level="info"> |
| | | <appender-ref ref="FILE_ERROR"/> |
| | | <appender-ref ref="FILE_ALL"/> |
| | | <appender-ref ref="CONSOLE" /> |
| | | <appender-ref ref="DEBUG_FILE" /> |
| | | <appender-ref ref="INFO_FILE" /> |
| | | <appender-ref ref="WARN_FILE" /> |
| | | <appender-ref ref="ERROR_FILE" /> |
| | | <appender-ref ref="ALL_FILE" /> |
| | | </root> |
| | | |
| | | <logger name="com.stylefeng.guns.modular.system.dao" level="debug"/> |
| | | <logger name="business-log" level="warn"/> |
| | | </springProfile> |
| | | |
| | | </configuration> |
| | | <springProfile name="produce"> |
| | | <root level="warn"> |
| | | <!-- 生产环境最好不配置console写文件 --> |
| | | <appender-ref ref="DEBUG_FILE" /> |
| | | <appender-ref ref="INFO_FILE" /> |
| | | <appender-ref ref="WARN_FILE" /> |
| | | <appender-ref ref="ERROR_FILE" /> |
| | | <appender-ref ref="ALL_FILE" /> |
| | | </root> |
| | | <logger name="com.stylefeng.guns.modular.system.dao" level="debug"/> |
| | | <logger name="business-log" level="warn"/> |
| | | </springProfile> |
| | | |
| | | |
| | | </configuration> |