| | |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.builder.SpringApplicationBuilder; |
| | | import org.springframework.boot.web.servlet.MultipartConfigFactory; |
| | | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
| | | import org.springframework.cloud.client.loadbalancer.LoadBalanced; |
| | | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; |
| | |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import javax.servlet.MultipartConfigElement; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.TimeZone; |
| | | |
| | |
| | | // protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { |
| | | // return builder.sources(GunsApplication.class); |
| | | // } |
| | | |
| | | } |
| | |
| | | }) |
| | | public ResultUtil queryTrack_(Integer orderId, Integer orderType){ |
| | | try { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | switch (orderType){ |
| | | case 1: |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("lon", orderPrivateCar.getStartLon()); |
| | | map.put("lat", orderPrivateCar.getStartLat()); |
| | | list.add(map); |
| | | map = new HashMap<>(); |
| | | map.put("lon", orderPrivateCar.getEndLon()); |
| | | map.put("lat", orderPrivateCar.getEndLat()); |
| | | list.add(map); |
| | | break; |
| | | case 4: |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | Map<String, Object> map1 = new HashMap<>(); |
| | | map1.put("lon", orderLogistics.getStartLon()); |
| | | map1.put("lat", orderLogistics.getStartLat()); |
| | | list.add(map1); |
| | | map1 = new HashMap<>(); |
| | | map1.put("lon", orderLogistics.getEndLon()); |
| | | map1.put("lat", orderLogistics.getEndLat()); |
| | | list.add(map1); |
| | | break; |
| | | } |
| | | List<Map<String, Object>> list = orderPositionService.queryTrack(orderId, orderType); |
| | | return ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | userRedPacketRecordService.updateBatchById(userRedPacketRecords); |
| | | } |
| | | orderLogistics.setRedPacketId(jsonArray.toJSONString()); |
| | | } |
| | | if(total > 0 && total.compareTo(multiply1.doubleValue()) < 0){ |
| | | }else if(total > 0 && total.compareTo(multiply1.doubleValue()) < 0){ |
| | | orderLogistics.setRedPacketMoney(total); |
| | | orderMoney = orderMoney.subtract(new BigDecimal(total)).setScale(2, RoundingMode.HALF_EVEN); |
| | | //获取红包id |
| | |
| | | userCouponRecord.setEndTime(new Date()); |
| | | userCouponRecordService.updateById(userCouponRecord); |
| | | } |
| | | if(null != orderLogistics.getRedPacketId()){ |
| | | JSONArray jsonArray = JSON.parseArray(orderLogistics.getRedPacketId()); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id1 = jsonObject.getInteger("id"); |
| | | Double money = jsonObject.getDouble("money"); |
| | | UserRedPacketRecord userRedPacketRecord = userRedPacketRecordService.selectById(id1); |
| | | userRedPacketRecord.setRemainingAmount(userRedPacketRecord.getRemainingAmount() - money); |
| | | if(0 == userRedPacketRecord.getRemainingAmount()){ |
| | | userRedPacketRecord.setState(2); |
| | | userRedPacketRecord.setEndTime(new Date()); |
| | | } |
| | | userRedPacketRecordService.updateById(userRedPacketRecord); |
| | | } |
| | | } |
| | | // if(null != orderLogistics.getRedPacketId()){ |
| | | // JSONArray jsonArray = JSON.parseArray(orderLogistics.getRedPacketId()); |
| | | // for (int i = 0; i < jsonArray.size(); i++) { |
| | | // JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | // Integer id1 = jsonObject.getInteger("id"); |
| | | // Double money = jsonObject.getDouble("money"); |
| | | // UserRedPacketRecord userRedPacketRecord = userRedPacketRecordService.selectById(id1); |
| | | // userRedPacketRecord.setRemainingAmount(userRedPacketRecord.getRemainingAmount() - money); |
| | | // if(0 == userRedPacketRecord.getRemainingAmount()){ |
| | | // userRedPacketRecord.setState(2); |
| | | // userRedPacketRecord.setEndTime(new Date()); |
| | | // } |
| | | // userRedPacketRecordService.updateById(userRedPacketRecord); |
| | | // } |
| | | // } |
| | | |
| | | //添加已收入明细 |
| | | Company company = companyService.selectById(orderLogistics.getCompanyId()); |
| | |
| | | if(orderLogistics.getState() == 10 || orderLogistics.getState() == 12){ |
| | | Car car = carService.selectById(orderLogistics.getCarId()); |
| | | //修改行程信息 |
| | | boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null); |
| | | boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, orderLogistics.getTripId(), null, null, null, null); |
| | | if(!updateTrip){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateTrip = fleetEngineUtil.updateTrip("CANCELED", car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null); |
| | | updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, orderLogistics.getTripId(), null, null, null, null); |
| | | if(updateTrip){ |
| | | break; |
| | | } |
| | |
| | | //修改行程信息 |
| | | if(orderPrivateCar.getState() == 10 || orderPrivateCar.getState() == 12){ |
| | | Car car = carService.selectById(orderPrivateCar.getCarId()); |
| | | boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", car.getVehicleId(), null, orderPrivateCar.getTripId(), null, null, null, null); |
| | | boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, orderPrivateCar.getTripId(), null, null, null, null); |
| | | if(!updateTrip){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateTrip = fleetEngineUtil.updateTrip("CANCELED", car.getVehicleId(), null, orderPrivateCar.getTripId(), null, null, null, null); |
| | | updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, orderPrivateCar.getTripId(), null, null, null, null); |
| | | if(updateTrip){ |
| | | break; |
| | | } |
| | |
| | | |
| | | |
| | | @Override |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ResultUtil payPrivateCarOrder(Integer payType, Integer bankCardId, Integer orderId, Integer couponId, Integer redDeduction, Integer type, Integer language) throws Exception { |
| | | OrderPrivateCar orderPrivateCar = this.selectById(orderId); |
| | | if(orderPrivateCar.getState() == 8 || orderPrivateCar.getState() == 9){ |
| | |
| | | if(null != redDeduction && 1 == redDeduction && null == orderPrivateCar.getRedPacketId()){ |
| | | RedEnvelopePaymentSettings redEnvelopePaymentSettings = redEnvelopePaymentSettingsService.getRedEnvelopePaymentSettings(); |
| | | if(null != redEnvelopePaymentSettings){ |
| | | Double total = userRedPacketRecordService.queryRemainingAmount(uid); |
| | | List<UserRedPacketRecord> userRedPacketRecords = userRedPacketRecordService.selectList(new EntityWrapper<UserRedPacketRecord>().eq("userId", uid) |
| | | .eq("state", 1).eq("companyId", orderPrivateCar.getCompanyId()).gt("remainingAmount", 0).orderBy("insertTime", false)); |
| | | |
| | | Double total = userRedPacketRecords.stream().mapToDouble(UserRedPacketRecord::getRemainingAmount).sum(); |
| | | BigDecimal deductionRatio = redEnvelopePaymentSettings.getDeductionRatio(); |
| | | BigDecimal multiply1 = orderMoney.multiply(deductionRatio.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_EVEN); |
| | | if(total > 0 && multiply1.doubleValue() > 0 && total.compareTo(multiply1.doubleValue()) >= 0){ |
| | |
| | | //获取红包id |
| | | JSONArray jsonArray = new JSONArray(); |
| | | for (UserRedPacketRecord userRedPacketRecord : userRedPacketRecords) { |
| | | if(multiply1.compareTo(BigDecimal.ZERO) == 0){ |
| | | break; |
| | | } |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("id", userRedPacketRecord.getId()); |
| | | BigDecimal remainingAmount = new BigDecimal(userRedPacketRecord.getRemainingAmount()); |
| | | |
| | | if(multiply1.compareTo(remainingAmount) >= 0){ |
| | | userRedPacketRecord.setRemainingAmount(0D); |
| | | userRedPacketRecord.setEndTime(new Date()); |
| | |
| | | jsonObject.put("money", multiply1.setScale(2, RoundingMode.HALF_EVEN)); |
| | | jsonArray.add(jsonObject); |
| | | multiply1 = BigDecimal.ZERO; |
| | | break; |
| | | } |
| | | } |
| | | if(userRedPacketRecords.size() > 0){ |
| | | userRedPacketRecordService.updateBatchById(userRedPacketRecords); |
| | | } |
| | | orderPrivateCar.setRedPacketId(jsonArray.toJSONString()); |
| | | } |
| | | if(total > 0 && total.compareTo(multiply1.doubleValue()) < 0){ |
| | | }else if(total > 0 && total.compareTo(multiply1.doubleValue()) < 0){ |
| | | orderPrivateCar.setRedPacketMoney(total); |
| | | orderMoney = orderMoney.subtract(new BigDecimal(total)).setScale(2, RoundingMode.HALF_EVEN); |
| | | //获取红包id |
| | |
| | | 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 != city"> |
| | | <if test="null != collect"> |
| | | and cityId in |
| | | <foreach collection="collect" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | |
| | | server: |
| | | port: 8006 |
| | | tomcat: |
| | | basedir: /home/igotechgh/app/tomcat_basedir |
| | | |
| | | guns: |
| | | swagger-open: false #是否开启swagger (true/false) |