后管sim卡页面添加字段

This commit is contained in:
Lemon
2023-06-01 10:39:48 +08:00
parent 6ccfd5f7cf
commit bc32bd8238
6 changed files with 133 additions and 9 deletions

View File

@@ -29,4 +29,9 @@ public class QuerySimInfoDTO {
* sim卡商
*/
private String simSupplier;
/**
* 站点id
*/
private Long stationId;
}

View File

@@ -2,15 +2,19 @@ package com.jsowell.pile.service.impl;
import com.alibaba.fastjson2.JSON;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.PileSimInfo;
import com.jsowell.pile.dto.QuerySimInfoDTO;
import com.jsowell.pile.mapper.PileSimInfoMapper;
import com.jsowell.pile.service.IPileSimInfoService;
import com.jsowell.pile.vo.web.SimCardInfoVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
@@ -53,7 +57,28 @@ public class PileSimInfoServiceImpl implements IPileSimInfoService {
*/
@Override
public List<SimCardInfoVO> getSimInfoList(QuerySimInfoDTO dto) {
return pileSimInfoMapper.getSimInfoList(dto);
String expiredTime = dto.getExpiredTime();
if (StringUtils.equals("1", expiredTime)) {
// 小于7天
expiredTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.addDays(new Date(), 7));
}else if (StringUtils.equals("2", expiredTime)) {
// 小于30天
expiredTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.addDays(new Date(), 30));
}
dto.setExpiredTime(expiredTime);
List<SimCardInfoVO> simInfoList = pileSimInfoMapper.getSimInfoList(dto);
if (CollectionUtils.isEmpty(simInfoList)) {
return new ArrayList<>();
}
for (SimCardInfoVO simCardInfoVO : simInfoList) {
String expireTime = simCardInfoVO.getExpireTime();
if (StringUtils.isBlank(expireTime)) {
continue;
}
String poorDays = DateUtils.getPoorDays(DateUtils.parseDate(expireTime), new Date());
simCardInfoVO.setRemainingDays(poorDays);
}
return simInfoList;
}
/**

View File

@@ -60,4 +60,19 @@ public class SimCardInfoVO {
*/
private String simSupplier;
/**
* 站点id
*/
private Long stationId;
/**
* 站点名称
*/
private String stationName;
/**
* 剩余天数
*/
private String remainingDays;
}

View File

@@ -39,6 +39,8 @@
</where>
</select>
<select id="selectPileSimInfoById" parameterType="Long" resultMap="PileSimInfoResult">
<include refid="selectPileSimInfoVo"/>
where id = #{id}
@@ -155,6 +157,8 @@
SELECT
t2.sn as pileSn,
t2.sim_id as id,
t3.id as stationId,
t3.station_name as stationName,
t1.iccid as iccId,
t1.NAME as name,
t1.sim_supplier as simSupplier,
@@ -163,7 +167,9 @@
t1.surplus_data as surplusData,
t1.expire_time as expireTime,
t1.operator
from pile_sim_info t1 left join pile_basic_info t2 on t1.id = t2.sim_id
from pile_sim_info t1
left join pile_basic_info t2 on t1.id = t2.sim_id
join pile_station_info t3 on t2.station_id = t3.id
where t1.del_flag = '0'
<if test="dto.pileSn != null and dto.pileSn != ''">
and t2.sn = #{dto.pileSn,jdbcType=VARCHAR}
@@ -175,7 +181,10 @@
and t1.iccid = #{dto.iccId,jdbcType=VARCHAR}
</if>
<if test="dto.expiredTime != null and dto.expiredTime != ''">
and t1.expire_time = #{dto.expiredTime,jdbcType=VARCHAR}
and t1.expire_time <![CDATA[ <= ]]> #{dto.expiredTime,jdbcType=VARCHAR}
</if>
<if test="dto.stationId != null and dto.stationId != ''">
and t3.id = #{dto.stationId,jdbcType=BIGINT}
</if>
</select>