diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/domain/ChargeParkingDiscount.java b/jsowell-pile/src/main/java/com/jsowell/pile/domain/ChargeParkingDiscount.java new file mode 100644 index 000000000..e0c7b87de --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/domain/ChargeParkingDiscount.java @@ -0,0 +1,84 @@ +package com.jsowell.pile.domain; + +import java.util.Date; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; +import lombok.experimental.SuperBuilder; + +/** + * 充电停车优惠表 + */ +@Data +@Accessors(chain = true) +@SuperBuilder +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class ChargeParkingDiscount { + /** + * 主键 + */ + private Integer id; + + /** + * 站点id + */ + private String stationId; + + /** + * 道闸平台id + */ + private Integer parkingPlatformId; + + /** + * 条件类型(1-固定电量;2-固定时长) + */ + private String conditionType; + + private String conditionValue; + + /** + * 优惠类型(1-减时间单位分钟; 2-减金额单位元) + */ + private String discountType; + + private String discountValue; + + /** + * 开始时间 + */ + private Date startTime; + + /** + * 结束时间 + */ + private Date endTime; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新人 + */ + private String updateBy; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * 删除标识(0-正常; 1-删除) + */ + private String delFlag; +} \ No newline at end of file diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ChargeParkingDiscountMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ChargeParkingDiscountMapper.java new file mode 100644 index 000000000..aaa3c3395 --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ChargeParkingDiscountMapper.java @@ -0,0 +1,26 @@ +package com.jsowell.pile.mapper; + +import com.jsowell.pile.domain.ChargeParkingDiscount; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface ChargeParkingDiscountMapper { + int deleteByPrimaryKey(Integer id); + + int insertSelective(ChargeParkingDiscount record); + + ChargeParkingDiscount selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(ChargeParkingDiscount record); + + int updateBatchSelective(List list); + + int batchInsert(@Param("list") List list); + + int insertOrUpdate(ChargeParkingDiscount record); + + int insertOrUpdateSelective(ChargeParkingDiscount record); + + ChargeParkingDiscount selectByStationId(String stationId); +} \ No newline at end of file diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/ChargeParkingDiscountService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/ChargeParkingDiscountService.java new file mode 100644 index 000000000..0f037709e --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/ChargeParkingDiscountService.java @@ -0,0 +1,35 @@ +package com.jsowell.pile.service; + +import com.jsowell.pile.domain.ChargeParkingDiscount; +import com.jsowell.pile.vo.web.ChargeParkingDiscountVO; + +import java.util.List; +public interface ChargeParkingDiscountService{ + + + int deleteByPrimaryKey(Integer id); + + int insertSelective(ChargeParkingDiscount record); + + ChargeParkingDiscount selectByPrimaryKey(Integer id); + + /** + * 根据车场ID查询车场信息 + * @param stationId + * @return + */ + ChargeParkingDiscount selectByStationId(String stationId); + + ChargeParkingDiscountVO getChargeParkingDiscount(String stationId); + + int updateByPrimaryKeySelective(ChargeParkingDiscount record); + + int updateBatchSelective(List list); + + int batchInsert(List list); + + int insertOrUpdate(ChargeParkingDiscount record); + + int insertOrUpdateSelective(ChargeParkingDiscount record); + +} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ChargeParkingDiscountServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ChargeParkingDiscountServiceImpl.java new file mode 100644 index 000000000..41e3cb8f0 --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ChargeParkingDiscountServiceImpl.java @@ -0,0 +1,85 @@ +package com.jsowell.pile.service.impl; + +import com.jsowell.common.util.DateUtils; +import com.jsowell.common.util.StringUtils; +import com.jsowell.pile.domain.ChargeParkingDiscount; +import com.jsowell.pile.mapper.ChargeParkingDiscountMapper; +import com.jsowell.pile.service.ChargeParkingDiscountService; +import com.jsowell.pile.vo.web.ChargeParkingDiscountVO; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +@Service +public class ChargeParkingDiscountServiceImpl implements ChargeParkingDiscountService{ + + @Resource + private ChargeParkingDiscountMapper chargeParkingDiscountMapper; + + @Override + public int deleteByPrimaryKey(Integer id) { + return chargeParkingDiscountMapper.deleteByPrimaryKey(id); + } + + @Override + public int insertSelective(ChargeParkingDiscount record) { + return chargeParkingDiscountMapper.insertSelective(record); + } + + @Override + public ChargeParkingDiscount selectByPrimaryKey(Integer id) { + return chargeParkingDiscountMapper.selectByPrimaryKey(id); + } + + @Override + public ChargeParkingDiscount selectByStationId(String stationId) { + return chargeParkingDiscountMapper.selectByStationId(stationId); + } + + @Override + public ChargeParkingDiscountVO getChargeParkingDiscount(String stationId) { + if (StringUtils.isBlank(stationId)) { + return null; + } + ChargeParkingDiscount chargeParkingDiscount = this.selectByStationId(stationId); + if (chargeParkingDiscount == null) { + return null; + } + // 查询该站点的停车优惠信息 + ChargeParkingDiscountVO discountVO = new ChargeParkingDiscountVO(); + discountVO.setStationId(chargeParkingDiscount.getStationId()); + discountVO.setConditionType(chargeParkingDiscount.getConditionType()); + discountVO.setConditionValue(chargeParkingDiscount.getConditionValue()); + discountVO.setDiscountType(chargeParkingDiscount.getDiscountType()); + discountVO.setDiscountValue(chargeParkingDiscount.getDiscountValue()); + discountVO.setStartTime(DateUtils.formatDateTime(chargeParkingDiscount.getStartTime())); + discountVO.setEndTime(DateUtils.formatDateTime(chargeParkingDiscount.getEndTime())); + return discountVO; + } + + @Override + public int updateByPrimaryKeySelective(ChargeParkingDiscount record) { + return chargeParkingDiscountMapper.updateByPrimaryKeySelective(record); + } + + @Override + public int updateBatchSelective(List list) { + return chargeParkingDiscountMapper.updateBatchSelective(list); + } + + @Override + public int batchInsert(List list) { + return chargeParkingDiscountMapper.batchInsert(list); + } + + @Override + public int insertOrUpdate(ChargeParkingDiscount record) { + return chargeParkingDiscountMapper.insertOrUpdate(record); + } + + @Override + public int insertOrUpdateSelective(ChargeParkingDiscount record) { + return chargeParkingDiscountMapper.insertOrUpdateSelective(record); + } + +} diff --git a/jsowell-pile/src/main/resources/mapper/pile/ChargeParkingDiscountMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/ChargeParkingDiscountMapper.xml new file mode 100644 index 000000000..a10f7fd56 --- /dev/null +++ b/jsowell-pile/src/main/resources/mapper/pile/ChargeParkingDiscountMapper.xml @@ -0,0 +1,495 @@ + + + + + + + + + + + + + + + + + + + + + + + + id, station_id, parking_platform_id, condition_type, condition_value, discount_type, + discount_value, start_time, end_time, create_by, create_time, update_by, update_time, + del_flag + + + + + delete from charge_parking_discount + where id = #{id,jdbcType=INTEGER} + + + + insert into charge_parking_discount + + + station_id, + + + parking_platform_id, + + + condition_type, + + + condition_value, + + + discount_type, + + + discount_value, + + + start_time, + + + end_time, + + + create_by, + + + create_time, + + + update_by, + + + update_time, + + + del_flag, + + + + + #{stationId,jdbcType=VARCHAR}, + + + #{parkingPlatformId,jdbcType=INTEGER}, + + + #{conditionType,jdbcType=VARCHAR}, + + + #{conditionValue,jdbcType=VARCHAR}, + + + #{discountType,jdbcType=VARCHAR}, + + + #{discountValue,jdbcType=VARCHAR}, + + + #{startTime,jdbcType=TIMESTAMP}, + + + #{endTime,jdbcType=TIMESTAMP}, + + + #{createBy,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateBy,jdbcType=VARCHAR}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + #{delFlag,jdbcType=CHAR}, + + + + + + update charge_parking_discount + + + station_id = #{stationId,jdbcType=VARCHAR}, + + + parking_platform_id = #{parkingPlatformId,jdbcType=INTEGER}, + + + condition_type = #{conditionType,jdbcType=VARCHAR}, + + + condition_value = #{conditionValue,jdbcType=VARCHAR}, + + + discount_type = #{discountType,jdbcType=VARCHAR}, + + + discount_value = #{discountValue,jdbcType=VARCHAR}, + + + start_time = #{startTime,jdbcType=TIMESTAMP}, + + + end_time = #{endTime,jdbcType=TIMESTAMP}, + + + create_by = #{createBy,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_by = #{updateBy,jdbcType=VARCHAR}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + del_flag = #{delFlag,jdbcType=CHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + + update charge_parking_discount + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.stationId,jdbcType=VARCHAR} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.parkingPlatformId,jdbcType=INTEGER} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.conditionType,jdbcType=VARCHAR} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.conditionValue,jdbcType=VARCHAR} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.discountType,jdbcType=VARCHAR} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.discountValue,jdbcType=VARCHAR} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.startTime,jdbcType=TIMESTAMP} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.endTime,jdbcType=TIMESTAMP} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=VARCHAR} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.updateBy,jdbcType=VARCHAR} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.updateTime,jdbcType=TIMESTAMP} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.delFlag,jdbcType=CHAR} + + + + + where id in + + #{item.id,jdbcType=INTEGER} + + + + + insert into charge_parking_discount + (station_id, parking_platform_id, condition_type, condition_value, discount_type, + discount_value, start_time, end_time, create_by, create_time, update_by, update_time, + del_flag) + values + + (#{item.stationId,jdbcType=VARCHAR}, #{item.parkingPlatformId,jdbcType=INTEGER}, + #{item.conditionType,jdbcType=VARCHAR}, #{item.conditionValue,jdbcType=VARCHAR}, + #{item.discountType,jdbcType=VARCHAR}, #{item.discountValue,jdbcType=VARCHAR}, + #{item.startTime,jdbcType=TIMESTAMP}, #{item.endTime,jdbcType=TIMESTAMP}, #{item.createBy,jdbcType=VARCHAR}, + #{item.createTime,jdbcType=TIMESTAMP}, #{item.updateBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP}, + #{item.delFlag,jdbcType=CHAR}) + + + + + insert into charge_parking_discount + + + id, + + station_id, + parking_platform_id, + condition_type, + condition_value, + discount_type, + discount_value, + start_time, + end_time, + create_by, + create_time, + update_by, + update_time, + del_flag, + + values + + + #{id,jdbcType=INTEGER}, + + #{stationId,jdbcType=VARCHAR}, + #{parkingPlatformId,jdbcType=INTEGER}, + #{conditionType,jdbcType=VARCHAR}, + #{conditionValue,jdbcType=VARCHAR}, + #{discountType,jdbcType=VARCHAR}, + #{discountValue,jdbcType=VARCHAR}, + #{startTime,jdbcType=TIMESTAMP}, + #{endTime,jdbcType=TIMESTAMP}, + #{createBy,jdbcType=VARCHAR}, + #{createTime,jdbcType=TIMESTAMP}, + #{updateBy,jdbcType=VARCHAR}, + #{updateTime,jdbcType=TIMESTAMP}, + #{delFlag,jdbcType=CHAR}, + + on duplicate key update + + + id = #{id,jdbcType=INTEGER}, + + station_id = #{stationId,jdbcType=VARCHAR}, + parking_platform_id = #{parkingPlatformId,jdbcType=INTEGER}, + condition_type = #{conditionType,jdbcType=VARCHAR}, + condition_value = #{conditionValue,jdbcType=VARCHAR}, + discount_type = #{discountType,jdbcType=VARCHAR}, + discount_value = #{discountValue,jdbcType=VARCHAR}, + start_time = #{startTime,jdbcType=TIMESTAMP}, + end_time = #{endTime,jdbcType=TIMESTAMP}, + create_by = #{createBy,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_by = #{updateBy,jdbcType=VARCHAR}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, + del_flag = #{delFlag,jdbcType=CHAR}, + + + + + insert into charge_parking_discount + + + id, + + + station_id, + + + parking_platform_id, + + + condition_type, + + + condition_value, + + + discount_type, + + + discount_value, + + + start_time, + + + end_time, + + + create_by, + + + create_time, + + + update_by, + + + update_time, + + + del_flag, + + + values + + + #{id,jdbcType=INTEGER}, + + + #{stationId,jdbcType=VARCHAR}, + + + #{parkingPlatformId,jdbcType=INTEGER}, + + + #{conditionType,jdbcType=VARCHAR}, + + + #{conditionValue,jdbcType=VARCHAR}, + + + #{discountType,jdbcType=VARCHAR}, + + + #{discountValue,jdbcType=VARCHAR}, + + + #{startTime,jdbcType=TIMESTAMP}, + + + #{endTime,jdbcType=TIMESTAMP}, + + + #{createBy,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateBy,jdbcType=VARCHAR}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + #{delFlag,jdbcType=CHAR}, + + + on duplicate key update + + + id = #{id,jdbcType=INTEGER}, + + + station_id = #{stationId,jdbcType=VARCHAR}, + + + parking_platform_id = #{parkingPlatformId,jdbcType=INTEGER}, + + + condition_type = #{conditionType,jdbcType=VARCHAR}, + + + condition_value = #{conditionValue,jdbcType=VARCHAR}, + + + discount_type = #{discountType,jdbcType=VARCHAR}, + + + discount_value = #{discountValue,jdbcType=VARCHAR}, + + + start_time = #{startTime,jdbcType=TIMESTAMP}, + + + end_time = #{endTime,jdbcType=TIMESTAMP}, + + + create_by = #{createBy,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_by = #{updateBy,jdbcType=VARCHAR}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + del_flag = #{delFlag,jdbcType=CHAR}, + + + + + + \ No newline at end of file diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java index f5089d7d0..41953f54a 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java @@ -93,6 +93,9 @@ public class CommonService { @Autowired private ZDLService zdlService; + @Autowired + private ChargeParkingDiscountService chargeParkingDiscountService; + @Autowired private CarCouponRecordService carCouponRecordService; @@ -687,7 +690,7 @@ public class CommonService { */ public void bindParkingCoupon(RealTimeMonitorData realTimeMonitorData, OrderBasicInfo orderBasicInfo) throws UnsupportedEncodingException { // 判断该订单的站点是否有停车优惠 - ChargeParkingDiscountVO chargeParkingDiscount = getChargeParkingDiscount(orderBasicInfo.getStationId()); + ChargeParkingDiscountVO chargeParkingDiscount = chargeParkingDiscountService.getChargeParkingDiscount(orderBasicInfo.getStationId()); if (chargeParkingDiscount == null) { return; } @@ -697,12 +700,12 @@ public class CommonService { String conditionType = chargeParkingDiscount.getConditionType(); // 如果conditionType为1判断充电度数, 如果为2判断充电时长 boolean flag = false; - if (StringUtils.equals(conditionType, "1")) { + if (StringUtils.equals(conditionType, Constants.ONE)) { if (Integer.parseInt(chargingDegree) >= Integer.parseInt(chargeParkingDiscount.getConditionValue())) { // 发券 flag = true; } - } else if (StringUtils.equals(conditionType, "2")) { + } else if (StringUtils.equals(conditionType, Constants.TWO)) { if (Integer.parseInt(sumChargingTime) >= Integer.parseInt(chargeParkingDiscount.getConditionValue())) { // 发券 flag = true; @@ -742,16 +745,13 @@ public class CommonService { // 绑定优惠券 String s = ltytService.bindCoupon(dto); // 如果s为ok, discountFlag为true - if (StringUtils.equals(s, "ok")) { - discountFlag = true; - } + discountFlag = StringUtils.equals(s, "ok"); } else if (StringUtils.equals(ParkingPlatformEnum.SHEN_ZHEN_PLATFORM.getCode(), stationInfo.getParkingId())) { // 深圳道闸 QcyunParkCouponDTO dto = QcyunParkCouponDTO.builder() .plateNumber(orderBasicInfo.getPlateNumber()) .stationId(orderBasicInfo.getStationId()) .stationName(stationInfo.getStationName()) - .parkId(stationInfo.getParkingId()) .build(); discountFlag = qcyunsService.issuanceOfParkingTickets(dto); } @@ -771,37 +771,6 @@ public class CommonService { } } - /** - * TODO 先做个临时方法返回ChargeParkingDiscountVO, 后面改为后面页面配置 - * - * @param stationId - * @return - */ - private ChargeParkingDiscountVO getChargeParkingDiscount(String stationId) { - // 查询该站点的停车优惠信息 - ChargeParkingDiscountVO discountVO = new ChargeParkingDiscountVO(); - if (StringUtils.equals(stationId, "")) { - discountVO.setStationId(stationId); - discountVO.setConditionType("2"); - discountVO.setConditionValue("10"); - discountVO.setDiscountType(""); - discountVO.setDiscountValue(""); - discountVO.setStartTime(""); - discountVO.setEndTime(""); - } else if (StringUtils.equals(stationId, "")) { - discountVO.setStationId(stationId); - discountVO.setConditionType(""); - discountVO.setConditionValue(""); - discountVO.setDiscountType(""); - discountVO.setDiscountValue(""); - discountVO.setStartTime(""); - discountVO.setEndTime(""); - } else { - discountVO = null; - } - return discountVO; - } - /** * 统一请求启动充电,目前给华为平台用 * @param dto diff --git a/jsowell-ui/src/views/pile/station/detail.vue b/jsowell-ui/src/views/pile/station/detail.vue index eda5d6af3..41652151b 100644 --- a/jsowell-ui/src/views/pile/station/detail.vue +++ b/jsowell-ui/src/views/pile/station/detail.vue @@ -191,6 +191,97 @@ + +

绑定停车平台V2(配置完成后,订单完成将自动下发优惠券)

+ 编辑参数 + + + + + + + + + + + + + + 保存 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

地锁二维码