mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
update 高德
This commit is contained in:
@@ -135,6 +135,13 @@ public interface PileBillingTemplateMapper {
|
||||
*/
|
||||
BillingTemplateVO selectBillingTemplateByStationId(@Param("stationId") String stationId);
|
||||
|
||||
/**
|
||||
* 批量查询站点正在使用的计费模板信息
|
||||
* @param stationIdList 站点id集合
|
||||
* @return
|
||||
*/
|
||||
List<BillingTemplateVO> selectBillingTemplateByStationIdList(@Param("stationIdList") List<String> stationIdList);
|
||||
|
||||
/**
|
||||
* 通过模板id数组批量查询计费模板详情列表
|
||||
*/
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.jsowell.pile.dto.CreateOrUpdateBillingTemplateDTO;
|
||||
import com.jsowell.pile.dto.ImportBillingTemplateDTO;
|
||||
import com.jsowell.pile.vo.uniapp.BillingPriceVO;
|
||||
import com.jsowell.pile.vo.uniapp.CurrentTimePriceDetails;
|
||||
import com.jsowell.pile.vo.web.BillingDetailVO;
|
||||
import com.jsowell.pile.vo.web.BillingTemplateVO;
|
||||
import com.jsowell.pile.vo.web.EchoBillingTemplateVO;
|
||||
|
||||
@@ -105,6 +106,8 @@ public interface IPileBillingTemplateService {
|
||||
*/
|
||||
BillingTemplateVO queryUsedBillingTemplate(String stationId);
|
||||
|
||||
List<BillingPriceVO> conversionParameters(List<BillingDetailVO> billingDetailList);
|
||||
|
||||
/**
|
||||
* 查询计费价格详情
|
||||
* @param stationId 站点id
|
||||
@@ -160,4 +163,7 @@ public interface IPileBillingTemplateService {
|
||||
CurrentTimePriceDetails getCurrentTimePriceDetails(String stationId);
|
||||
|
||||
List<PileBillingDetail> queryBillingDetailById(Long id);
|
||||
|
||||
// 批量查询站点计费模板
|
||||
List<BillingTemplateVO> selectBillingTemplateByStationIdList(List<String> stationIdList);
|
||||
}
|
||||
|
||||
@@ -379,6 +379,14 @@ public class PileBillingTemplateServiceImpl implements IPileBillingTemplateServi
|
||||
return pileBillingDetails;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BillingTemplateVO> selectBillingTemplateByStationIdList(List<String> stationIdList) {
|
||||
if (CollectionUtils.isEmpty(stationIdList)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return pileBillingTemplateMapper.selectBillingTemplateByStationIdList(stationIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BillingTemplateVO> queryPublicBillingTemplateList() {
|
||||
return pileBillingTemplateMapper.queryPublicBillingTemplateList();
|
||||
@@ -455,6 +463,45 @@ public class PileBillingTemplateServiceImpl implements IPileBillingTemplateServi
|
||||
return max.orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换参数
|
||||
* @param billingDetailList
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BillingPriceVO> conversionParameters(List<BillingDetailVO> billingDetailList) {
|
||||
List<BillingPriceVO> resultList = Lists.newArrayList();
|
||||
if (org.springframework.util.CollectionUtils.isEmpty(billingDetailList)) {
|
||||
return resultList;
|
||||
}
|
||||
for (BillingDetailVO billingDetailVO : billingDetailList) {
|
||||
List<String> applyTimeList = billingDetailVO.getApplyTime();
|
||||
BigDecimal electricityPrice = billingDetailVO.getElectricityPrice();
|
||||
BigDecimal servicePrice = billingDetailVO.getServicePrice();
|
||||
for (String applyTime : applyTimeList) {
|
||||
String[] split = applyTime.split("-");
|
||||
// 开始时间
|
||||
String startTime = split[0];
|
||||
// 结束时间
|
||||
String endTime = split[1];
|
||||
// 是否当前时间
|
||||
boolean in = DateUtils.isIn(LocalTime.now(), LocalTime.parse(startTime), LocalTime.parse(endTime));
|
||||
resultList.add(
|
||||
BillingPriceVO.builder()
|
||||
.timeType(billingDetailVO.getTimeType())
|
||||
.startTime(startTime)
|
||||
.endTime(endTime)
|
||||
.electricityPrice(electricityPrice.toString())
|
||||
.servicePrice(servicePrice.toString())
|
||||
.totalPrice(electricityPrice.add(servicePrice).toString())
|
||||
.isCurrentTime(in ? Constants.ONE : Constants.ZERO)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BillingPriceVO> queryBillingPrice(String stationId) {
|
||||
// 查询站点当前计费模板 有缓存
|
||||
|
||||
@@ -19,6 +19,9 @@ import java.util.Map;
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class BillingTemplateVO {
|
||||
// 站点id
|
||||
private String stationId;
|
||||
|
||||
// 计费模板id
|
||||
private String templateId;
|
||||
|
||||
|
||||
@@ -489,4 +489,41 @@
|
||||
and t2.station_id = #{stationId,jdbcType=VARCHAR}
|
||||
order by t2.publish_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectBillingTemplateByStationIdList" resultType="com.jsowell.pile.vo.web.BillingTemplateVO">
|
||||
select
|
||||
t1.id as stationId,
|
||||
t2.id as templateId,
|
||||
t2.template_code as templateCode,
|
||||
t2.name as templateName,
|
||||
t2.remark as remark,
|
||||
t2.type as deviceType,
|
||||
t2.publish_time as publishTime,
|
||||
t3.electricity_price AS sharpElectricityPrice,
|
||||
t3.service_price AS sharpServicePrice,
|
||||
t3.apply_time AS sharpApplyDate,
|
||||
t4.electricity_price AS peakElectricityPrice,
|
||||
t4.service_price AS peakServicePrice,
|
||||
t4.apply_time AS peakApplyDate,
|
||||
t5.electricity_price AS flatElectricityPrice,
|
||||
t5.service_price AS flatServicePrice,
|
||||
t5.apply_time AS flatApplyDate,
|
||||
t6.electricity_price AS valleyElectricityPrice,
|
||||
t6.service_price AS valleyServicePrice,
|
||||
t6.apply_time AS valleyApplyDate
|
||||
from
|
||||
pile_billing_template t2
|
||||
left join pile_station_info t1 on t1.id = t2.station_id
|
||||
left JOIN pile_billing_detail t3 ON t3.template_code = t2.template_code AND t3.time_type = '1'
|
||||
left JOIN pile_billing_detail t4 ON t4.template_code = t2.template_code AND t4.time_type = '2'
|
||||
left JOIN pile_billing_detail t5 ON t5.template_code = t2.template_code AND t5.time_type = '3'
|
||||
left JOIN pile_billing_detail t6 ON t6.template_code = t2.template_code AND t6.time_type = '4'
|
||||
where
|
||||
t2.del_flag = '0'
|
||||
and t2.status = '1'
|
||||
and t2.station_id in
|
||||
<foreach collection="stationIdList" item="item" open="(" separator="," close=")">
|
||||
#{item,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user