后管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

@@ -196,6 +196,9 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
String dateToStr = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSS, new Date()); String dateToStr = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSS, new Date());
System.out.println(dateToStr); System.out.println(dateToStr);
String poorDays = getPoorDays(addDay(new Date(), -7), new Date());
System.out.println(poorDays);
} }
/** /**
@@ -207,10 +210,27 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
} }
/** /**
* 计算相差天数 * 计算相差天数(不会显示负值)
*/ */
public static int differentDaysByMillisecond(Date date1, Date date2) { public static int differentDaysByMillisecond(Date beginDate, Date endDate) {
return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24))); return Math.abs((int) ((endDate.getTime() - beginDate.getTime()) / (1000 * 3600 * 24)));
}
/**
* 计算相差天数 (会显示负值)
* @param endDate
* @param nowDate
* @return
*/
public static String getPoorDays(Date endDate, Date nowDate) {
long nd = 1000 * 24 * 60 * 60;
long diff = endDate.getTime() - nowDate.getTime();
long day = diff / nd;
StringBuilder sb = new StringBuilder();
if (day != 0) {
sb.append(day);
}
return sb.toString();
} }
/** /**

View File

@@ -29,4 +29,9 @@ public class QuerySimInfoDTO {
* sim卡商 * sim卡商
*/ */
private String simSupplier; 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.alibaba.fastjson2.JSON;
import com.jsowell.common.util.DateUtils; import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.PileSimInfo; import com.jsowell.pile.domain.PileSimInfo;
import com.jsowell.pile.dto.QuerySimInfoDTO; import com.jsowell.pile.dto.QuerySimInfoDTO;
import com.jsowell.pile.mapper.PileSimInfoMapper; import com.jsowell.pile.mapper.PileSimInfoMapper;
import com.jsowell.pile.service.IPileSimInfoService; import com.jsowell.pile.service.IPileSimInfoService;
import com.jsowell.pile.vo.web.SimCardInfoVO; import com.jsowell.pile.vo.web.SimCardInfoVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@@ -53,7 +57,28 @@ public class PileSimInfoServiceImpl implements IPileSimInfoService {
*/ */
@Override @Override
public List<SimCardInfoVO> getSimInfoList(QuerySimInfoDTO dto) { 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; private String simSupplier;
/**
* 站点id
*/
private Long stationId;
/**
* 站点名称
*/
private String stationName;
/**
* 剩余天数
*/
private String remainingDays;
} }

View File

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

View File

@@ -49,7 +49,16 @@
<!-- @keyup.enter.native="handleQuery"--> <!-- @keyup.enter.native="handleQuery"-->
<!-- />--> <!-- />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<el-form-item label="到期时间" prop="expiredTime">
<el-select v-model="queryParams.expiredTime" clearable placeholder="请选择">
<el-option
v-for="item in dict.type.sim_expired_time"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="SIM卡商" prop="simSupplier"> <el-form-item label="SIM卡商" prop="simSupplier">
<el-select v-model="queryParams.simSupplier" clearable placeholder="请选择"> <el-select v-model="queryParams.simSupplier" clearable placeholder="请选择">
<el-option <el-option
@@ -60,6 +69,23 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="站点" prop="stationId">
<el-select
v-model="queryParams.stationId"
placeholder="请选择站点"
clearable
filterable
style="width: 140px"
>
<el-option
v-for="station in stationList"
:key="station.id"
:label="station.stationName"
:value="station.id"
/>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -116,7 +142,8 @@
<!-- <el-table-column label="主键" align="center" prop="id" />--> <!-- <el-table-column label="主键" align="center" prop="id" />-->
<el-table-column label="ICCID" align="center" prop="iccId" width="180px"/> <el-table-column label="ICCID" align="center" prop="iccId" width="180px"/>
<el-table-column label="套餐名称" align="center" prop="name" /> <el-table-column label="套餐名称" align="center" prop="name" />
<el-table-column label="对应桩号" align="center" prop="pileSn" /> <el-table-column label="对应桩号" align="center" prop="pileSn" width="180px"/>
<el-table-column label="所属站点" align="center" prop="stationName" />
<el-table-column label="sim卡商" align="center" prop="simSupplier" > <el-table-column label="sim卡商" align="center" prop="simSupplier" >
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag <dict-tag
@@ -141,6 +168,13 @@
<span>{{ parseTime(scope.row.expireTime, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.expireTime, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="剩余天数" align="center" prop="remainingDays" >
<template scope="scope">
<span v-if="scope.row.remainingDays <= 7 " style="color: #bf1c1c"> {{scope.row.remainingDays}}</span>
<span v-else-if="scope.row.remainingDays <= 30 " style="color: #ffba00"> {{scope.row.remainingDays}}</span>
<span v-else-if="scope.row.remainingDays > 30 "> {{scope.row.remainingDays}}</span>
</template>
</el-table-column>
<el-table-column label="SIM卡运营商" align="center" prop="operator" > <el-table-column label="SIM卡运营商" align="center" prop="operator" >
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag <dict-tag
@@ -242,10 +276,11 @@
<script> <script>
import {listSim, getSim, delSim, addSim, updateSim, simRenew, getSimInfo} from "@/api/pile/sim"; import {listSim, getSim, delSim, addSim, updateSim, simRenew, getSimInfo} from "@/api/pile/sim";
import {listStation} from "@/api/pile/station";
export default { export default {
name: "Sim", name: "Sim",
dicts: ["sim_supplier", "sim_status", "sim_operator"], dicts: ["sim_supplier", "sim_status", "sim_operator", "sim_expired_time"],
data() { data() {
return { return {
// 遮罩层 // 遮罩层
@@ -285,6 +320,8 @@ export default {
value: '', value: '',
// 表单参数 // 表单参数
form: {}, form: {},
// 站点列表
stationList: [],
// 表单校验 // 表单校验
rules: { rules: {
}, },
@@ -293,6 +330,8 @@ export default {
}, },
created() { created() {
this.getList(); this.getList();
// 查询站点列表
this.getStationList();
}, },
methods: { methods: {
/** 查询充电桩SIM卡信息列表 */ /** 查询充电桩SIM卡信息列表 */
@@ -386,6 +425,17 @@ export default {
this.title = "修改充电桩SIM卡信息"; this.title = "修改充电桩SIM卡信息";
}); });
}, },
/** 查询充电站信息列表 */
getStationList() {
const queryStationParams = {
pageNum: 1,
pageSize: 999
};
listStation(queryStationParams).then((response) => {
console.log("订单列表页-查询站点列表", response)
this.stationList = response.rows;
});
},
// 重置 续费周期相关 // 重置 续费周期相关
resetSimRenewCycleNumber() { resetSimRenewCycleNumber() {
console.log("重置 续费周期相关"); console.log("重置 续费周期相关");