This commit is contained in:
2023-06-21 11:23:55 +08:00
parent 8fdaf216f5
commit 69eadbe700
3 changed files with 33 additions and 3 deletions

View File

@@ -136,10 +136,15 @@ public interface PileBillingTemplateMapper {
BillingTemplateVO selectBillingTemplateByStationId(@Param("stationId") String stationId);
/**
* 通过模板id查询计费模板详情列表
* 通过模板id数组批量查询计费模板详情列表
*/
List<PileBillingDetail> queryBillingDetailByTemplateIds(@Param("templateIds") Long[] templateIds);
/**
* 通过模板id查询计费模板详情列表
*/
List<PileBillingDetail> queryBillingDetailByTemplateId(@Param("templateId") Long templateId);
/**
* 插入充电桩和计费模板关系
*/

View File

@@ -275,7 +275,8 @@ public class PileBillingTemplateServiceImpl implements IPileBillingTemplateServi
result.setType(pileBillingTemplate.getType());
// 查计费模板详情
List<PileBillingDetail> detailList = pileBillingTemplateMapper.queryBillingDetailByTemplateIds(new Long[]{id});
// List<PileBillingDetail> detailList = pileBillingTemplateMapper.queryBillingDetailByTemplateIds(new Long[]{id});
List<PileBillingDetail> detailList = queryBillingDetailById(id);
if (CollectionUtils.isNotEmpty(detailList)) {
List<BillingTimeDTO> timeArray = Lists.newArrayList();
// 取出4个时间段类型
@@ -358,12 +359,18 @@ public class PileBillingTemplateServiceImpl implements IPileBillingTemplateServi
return result;
}
/**
* 通过计费模板id查询计费模板详情
* 缓存30分账修改清缓存
* @param id
* @return
*/
@Override
public List<PileBillingDetail> queryBillingDetailById(Long id) {
String redisKey = CacheConstants.QUERY_BILLING_DETAIL_BY_ID + id;
List<PileBillingDetail> pileBillingDetails = redisCache.getCacheList(redisKey);
if (CollectionUtils.isEmpty(pileBillingDetails)) {
pileBillingDetails = pileBillingTemplateMapper.queryBillingDetailByTemplateIds(new Long[]{id});
pileBillingDetails = pileBillingTemplateMapper.queryBillingDetailByTemplateId(id);
if (CollectionUtils.isNotEmpty(pileBillingDetails)) {
redisCache.setCacheList(redisKey, pileBillingDetails);
redisCache.expire(redisKey, 30, TimeUnit.MINUTES);

View File

@@ -392,6 +392,24 @@
</foreach>
</select>
<select id="queryBillingDetailByTemplateId" resultMap="PileBillingDetailResult">
SELECT
t1.id,
t1.template_code,
t1.time_type,
t1.electricity_price,
t1.service_price,
t1.apply_time,
t1.create_by,
t1.create_time,
t1.update_by,
t1.update_time,
t1.del_flag
FROM pile_billing_detail t1
JOIN pile_billing_template t2 ON t2.template_code = t1.template_code
WHERE t2.id = #{templateId,jdbcType=BIGINT}
</select>
<insert id="insertPileBillingRelation">
insert into pile_billing_relation
(pile_sn, billing_template_code, station_id)