| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | } |
| | | if(lineShift.getId().intValue() == Integer.valueOf(map.get("id").toString()).intValue()){ |
| | | b = false; |
| | | String content = String.valueOf(map.get("content")); |
| | | JSONObject jsonObject = JSON.parseObject(content); |
| | | map.put("price", jsonObject.getString("num1")); |
| | | BigDecimal price = getDefaultDestinationPrice(map); |
| | | map.put("price", price == null ? "0" : price.toPlainString()); |
| | | data = map; |
| | | list.add(data); |
| | | } |
| | |
| | | return list; |
| | | } |
| | | |
| | | private BigDecimal getDefaultDestinationPrice(Map<String, Object> map) { |
| | | if (map == null) { |
| | | return null; |
| | | } |
| | | Integer totalSeat = map.get("totalSeat") == null ? null : Integer.valueOf(map.get("totalSeat").toString()); |
| | | BigDecimal price = totalSeat != null && totalSeat == 6 ? getBigDecimal(map.get("defaultPrice7")) : getBigDecimal(map.get("defaultPrice5")); |
| | | return price == null ? getBigDecimal(map.get("defaultPrice5")) : price; |
| | | } |
| | | |
| | | private BigDecimal getBigDecimal(Object value) { |
| | | if (value == null || ToolUtil.isEmpty(String.valueOf(value))) { |
| | | return null; |
| | | } |
| | | try { |
| | | return new BigDecimal(String.valueOf(value)); |
| | | } catch (Exception e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据司机排班数据id获取数据(剩余座位号和总座位数) |