| | |
| | | if (!hasCommissionSetting(tLine.getOutSetting())) { |
| | | return ResultUtil.error("请设置司机抽成"); |
| | | } |
| | | ResultUtil charterPriceResult = validateCharterPrice(tLine); |
| | | if (200 != charterPriceResult.getStatus()) { |
| | | return charterPriceResult; |
| | | } |
| | | JSONArray jsonArray1 = JSON.parseArray(shuArr); |
| | | int size1 = jsonArray1.size(); |
| | | for (int i = 0; i < size1; i++) { |
| | |
| | | if (!hasCommissionSetting(tLine.getOutSetting())) { |
| | | return ResultUtil.error("请设置司机抽成"); |
| | | } |
| | | ResultUtil charterPriceResult = validateCharterPrice(tLine); |
| | | if (200 != charterPriceResult.getStatus()) { |
| | | return charterPriceResult; |
| | | } |
| | | JSONArray jsonArray1 = JSON.parseArray(shuArr); |
| | | int size1 = jsonArray1.size(); |
| | | for (int i = 0; i < size1; i++) { |
| | |
| | | return false; |
| | | } |
| | | |
| | | private ResultUtil validateCharterPrice(TLine tLine) { |
| | | if (tLine.getCharterPrice5() == null) { |
| | | return ResultUtil.error("请填写5座包车价格"); |
| | | } |
| | | if (tLine.getCharterPrice6() == null) { |
| | | return ResultUtil.error("请填写6座包车价格"); |
| | | } |
| | | if (tLine.getCharterPrice7() == null) { |
| | | return ResultUtil.error("请填写7座包车价格"); |
| | | } |
| | | if (tLine.getCharterPrice5().compareTo(BigDecimal.ZERO) < 0 |
| | | || tLine.getCharterPrice6().compareTo(BigDecimal.ZERO) < 0 |
| | | || tLine.getCharterPrice7().compareTo(BigDecimal.ZERO) < 0) { |
| | | return ResultUtil.error("包车价格不能小于0"); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | private boolean hasCommissionRule(JSONArray rules) { |
| | | if (rules == null || rules.size() <= 0) { |
| | | return false; |
| | |
| | | } |
| | | |
| | | BigDecimal price5; |
| | | BigDecimal price6; |
| | | BigDecimal price7; |
| | | try { |
| | | price5 = new BigDecimal(jsonObject.getString("price5")); |
| | | price6 = jsonObject.getString("price6") != null ? new BigDecimal(jsonObject.getString("price6")) : BigDecimal.ZERO; |
| | | price7 = new BigDecimal(jsonObject.getString("price7")); |
| | | } catch (Exception ex) { |
| | | return ResultUtil.error("目的地价格格式不正确"); |
| | | } |
| | | if (price5.compareTo(BigDecimal.ZERO) < 0 || price7.compareTo(BigDecimal.ZERO) < 0) { |
| | | if (price5.compareTo(BigDecimal.ZERO) < 0 || price6.compareTo(BigDecimal.ZERO) < 0 || price7.compareTo(BigDecimal.ZERO) < 0) { |
| | | return ResultUtil.error("目的地价格不能小于0"); |
| | | } |
| | | |
| | |
| | | destination.setDefaultPointLon(defaultPointLon); |
| | | destination.setDefaultPointLat(defaultPointLat); |
| | | destination.setPrice5(price5); |
| | | destination.setPrice6(price6); |
| | | destination.setPrice7(price7); |
| | | Integer state = jsonObject.getInteger("state"); |
| | | destination.setState(state == null ? 1 : state); |