增加更新工单系统所需设备清单的定时任务
This commit is contained in:
parent
2f6129a832
commit
e23777fc93
@ -54,4 +54,6 @@ public interface XhpcChargingPileMapper {
|
||||
|
||||
|
||||
XhpcChargingPile getXhpcChargingPileBySerialNumber(@Param("serialNumber") String serialNumber);
|
||||
|
||||
List<XhpcChargingPile> selectByStationId(@Param("stationId") String stationId);
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xhpc.activity.mapper;
|
||||
|
||||
import com.xhpc.common.domain.XhpcChargingStation;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@ -28,4 +29,5 @@ public interface XhpcChargingStationMapper {
|
||||
|
||||
List<Map<String, Object>> selectBaseRateTimeListByRateId(@Param("rateId")Integer rateId);
|
||||
|
||||
List<XhpcChargingStation> selectAll();
|
||||
}
|
||||
|
||||
@ -33,4 +33,6 @@ public interface XhpcStationDeviceMapper {
|
||||
|
||||
int updateByPrimaryKey(XhpcStationDeviceDomain record);
|
||||
|
||||
XhpcStationDeviceDomain selectBySerialNumber(@Param("serialNumber")String serialNumber);
|
||||
|
||||
}
|
||||
@ -0,0 +1,132 @@
|
||||
package com.xhpc.activity.mapper;
|
||||
|
||||
import com.xhpc.common.domain.XhpcTerminal;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 终端Mapper接口
|
||||
*
|
||||
* @author yuyang
|
||||
* @date 2021-07-19
|
||||
*/
|
||||
public interface XhpcTerminalMapper {
|
||||
|
||||
|
||||
/**
|
||||
* PC端页面统计
|
||||
*
|
||||
* @param chargingStationId 电站id
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> countXhpcTerminalWorkStatus(Long chargingStationId);
|
||||
|
||||
/**
|
||||
* 终端列表
|
||||
*
|
||||
* @param serialNumber 终端编号
|
||||
* @param type 桩类型
|
||||
* @param status 0启用 1停用
|
||||
* @param workStatus 0离线 1故障 2空闲 3充电
|
||||
* @param chargingStationId
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getXhpcTerminalList(@Param("serialNumber") String serialNumber, @Param("type") Integer type, @Param("status") Integer status, @Param("workStatus") String workStatus, @Param("chargingStationId") Long chargingStationId, @Param("tenantId") String tenantId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询电站
|
||||
*
|
||||
* @param terminalId 终端id
|
||||
* @return 电站
|
||||
*/
|
||||
XhpcTerminal selectXhpcTerminalById(Long terminalId);
|
||||
|
||||
|
||||
/**
|
||||
* 修改终端
|
||||
*
|
||||
* @param xhpcTerminal 终端
|
||||
* @return 结果
|
||||
*/
|
||||
int updateXhpcTerminal(@Param("name") String name,@Param("serialNumber") String serialNumber,@Param("connectorType") Integer connectorType,@Param("status") Integer status,@Param("terminalId") Long terminalId);
|
||||
|
||||
/**
|
||||
* 添加终端
|
||||
*
|
||||
* @param xhpcTerminal 终端
|
||||
* @return 结果
|
||||
*/
|
||||
int insertXhpcTerminal(XhpcTerminal xhpcTerminal);
|
||||
|
||||
/**
|
||||
* 终端详情
|
||||
*/
|
||||
Map<String, Object> selectXhpcTerminalPileMessage(Long terminalId);
|
||||
|
||||
/**
|
||||
* 返回费率时段(设置时段)
|
||||
*/
|
||||
List<Map<String, Object>> getXhpcRateTimeTypeList(@Param("chargingStationId") Long chargingStationId, @Param("type") Integer type);
|
||||
|
||||
/**
|
||||
* 今日充电量、今日充电用户、今日充电次数
|
||||
*/
|
||||
Map<String, Object> getXhpcRateTimeOrderStatistics(@Param("chargingStationId") Long chargingStationId, @Param("terminalId")Long terminalId);
|
||||
|
||||
/**
|
||||
* 通过终端编号进入小程序开始充电页面
|
||||
*
|
||||
* @param pNum 终端编号
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getWXpNumMessage(@Param("pNum") String pNum);
|
||||
|
||||
|
||||
/**
|
||||
* 获取图片信息
|
||||
*
|
||||
* @param imgIds
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getImageList(@Param("imgIds") List<String> imgIds);
|
||||
|
||||
/**
|
||||
* 查询所有桩名称、场站名称、终端编号
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> selectPileNameAndStationNameAndTerminalNum();
|
||||
|
||||
/**
|
||||
* 查询桩名称、场站名称、终端编号
|
||||
* @param terminalSerialNumber 搜索参数:终端名称
|
||||
* @param pileName 搜索参数:桩名
|
||||
* @param stationName 搜索参数:站名
|
||||
* @return list
|
||||
*/
|
||||
List<Map<String, Object>> getXhpcPileNameAndStationNameAndTerminalNumList(@Param("terminalSerialNumber") String terminalSerialNumber, @Param("pileName") String pileName, @Param("stationName") String stationName);
|
||||
|
||||
|
||||
/**
|
||||
* 根据电站获取终端的编号
|
||||
*
|
||||
* @param chargingStationId
|
||||
* @return
|
||||
*/
|
||||
List<String> getTerminal(@Param("chargingStationId") Long chargingStationId, @Param("status") Integer status);
|
||||
|
||||
/**
|
||||
* according pileIds query xhpcTerminalList
|
||||
*
|
||||
* @author WH
|
||||
* @date 2022/2/17 11:13
|
||||
* @since version-1.0
|
||||
*/
|
||||
List<XhpcTerminal> selectXhpcTerminalIdByPileIds(ArrayList<Long> pileIds);
|
||||
|
||||
|
||||
List<XhpcTerminal> selectByPileId(@Param("pileId")String pileId);
|
||||
}
|
||||
@ -18,6 +18,12 @@ public interface XhpcWorkStationMapper {
|
||||
|
||||
int insert(XhpcWorkStationDomain record);
|
||||
|
||||
int insertBatch(@Param("domainList") List<XhpcWorkStationDomain> domainList);
|
||||
|
||||
List<XhpcWorkStationDomain> selectBySerialNumbers(@Param("serialNumbers")String serialNumbers);
|
||||
|
||||
XhpcWorkStationDomain selectBySerialNumber(@Param("serialNumber")String serialNumbers);
|
||||
|
||||
int insertSelective(XhpcWorkStationDomain record);
|
||||
|
||||
XhpcWorkStationDomain selectByPrimaryKey(Long workStationId);
|
||||
|
||||
@ -0,0 +1,93 @@
|
||||
package com.xhpc.activity.task;
|
||||
|
||||
|
||||
import com.xhpc.activity.domain.XhpcStationDeviceDomain;
|
||||
import com.xhpc.activity.domain.XhpcWorkStationDomain;
|
||||
import com.xhpc.activity.mapper.*;
|
||||
import com.xhpc.common.core.utils.bean.BeanUtils;
|
||||
import com.xhpc.common.domain.XhpcChargingPile;
|
||||
import com.xhpc.common.domain.XhpcChargingStation;
|
||||
import com.xhpc.common.domain.XhpcTerminal;
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class SyncDeviceDataTask {
|
||||
|
||||
@Resource
|
||||
XhpcWorkStationMapper stationMapper;
|
||||
@Resource
|
||||
XhpcStationDeviceMapper deviceMapper;
|
||||
|
||||
@Resource
|
||||
XhpcChargingStationMapper chargingStationMapper;
|
||||
@Resource
|
||||
XhpcChargingPileMapper chargingPileMapper;
|
||||
@Resource
|
||||
XhpcTerminalMapper terminalMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 自动同步场站设备信息
|
||||
*/
|
||||
@Scheduled(cron = "0 0 18 * * ?")
|
||||
private void autoClearDeviceMessageData(){
|
||||
List<XhpcChargingStation> chargingStationList = chargingStationMapper.selectAll();
|
||||
for (XhpcChargingStation chargingStation: chargingStationList){
|
||||
XhpcWorkStationDomain workStationDomain = stationMapper.selectBySerialNumber(chargingStation.getSerialNumber());
|
||||
if(workStationDomain == null){
|
||||
workStationDomain = new XhpcWorkStationDomain();
|
||||
BeanUtils.copyProperties(chargingStation, workStationDomain);
|
||||
workStationDomain.setWorkStationId(chargingStation.getChargingStationId());
|
||||
stationMapper.insert(workStationDomain);
|
||||
}
|
||||
List<XhpcChargingPile> chargingPileList = chargingPileMapper.selectByStationId(chargingStation.getChargingStationId().toString());
|
||||
int sort=1;
|
||||
for(XhpcChargingPile chargingPile: chargingPileList){
|
||||
XhpcStationDeviceDomain pileDeviceDomain = deviceMapper.selectBySerialNumber(chargingPile.getSerialNumber());
|
||||
if(pileDeviceDomain == null){
|
||||
pileDeviceDomain = new XhpcStationDeviceDomain();
|
||||
pileDeviceDomain.setDeviceName(chargingPile.getName() + "号桩");
|
||||
pileDeviceDomain.setDeviceType(StationDeviceEnum.PILE.getCode());
|
||||
pileDeviceDomain.setCurrentType(chargingPile.getType() == 1? "直流(快)": "交流(慢)"); ////
|
||||
pileDeviceDomain.setStationId(workStationDomain.getWorkStationId());
|
||||
pileDeviceDomain.setBrandModel(chargingPile.getBrandModel());
|
||||
pileDeviceDomain.setParentDeviceId(null);
|
||||
pileDeviceDomain.setSerialNumber(chargingPile.getSerialNumber());
|
||||
pileDeviceDomain.setSorted(sort); sort ++;
|
||||
pileDeviceDomain.setStatus(Short.parseShort(chargingPile.getStatus().toString()));
|
||||
pileDeviceDomain.setDelFlag(Short.parseShort(chargingPile.getDelFlag().toString()));
|
||||
pileDeviceDomain.setCreateBy(chargingPile.getCreateBy());
|
||||
pileDeviceDomain.setUpdateBy(chargingPile.getUpdateBy());
|
||||
deviceMapper.insert(pileDeviceDomain);
|
||||
}
|
||||
|
||||
|
||||
List<XhpcTerminal> terminalList = terminalMapper.selectByPileId(chargingPile.getChargingPileId().toString());
|
||||
for(XhpcTerminal terminal: terminalList){
|
||||
XhpcStationDeviceDomain gunDeviceDomain = deviceMapper.selectBySerialNumber(terminal.getSerialNumber());
|
||||
if(gunDeviceDomain == null){
|
||||
gunDeviceDomain = new XhpcStationDeviceDomain();
|
||||
gunDeviceDomain.setDeviceName(terminal.getName());
|
||||
gunDeviceDomain.setDeviceType(StationDeviceEnum.TERMINAL.getCode());
|
||||
gunDeviceDomain.setCurrentType(chargingPile.getType() == 1? "直流(快)": "交流(慢)"); ////
|
||||
gunDeviceDomain.setStationId(workStationDomain.getWorkStationId());
|
||||
gunDeviceDomain.setBrandModel(chargingPile.getBrandModel());
|
||||
gunDeviceDomain.setParentDeviceId(pileDeviceDomain.getDeviceId());
|
||||
gunDeviceDomain.setSerialNumber(terminal.getSerialNumber());
|
||||
gunDeviceDomain.setSorted(sort); sort ++;
|
||||
gunDeviceDomain.setStatus(Short.parseShort(terminal.getStatus().toString()));
|
||||
gunDeviceDomain.setDelFlag(Short.parseShort(terminal.getDelFlag().toString()));
|
||||
gunDeviceDomain.setCreateBy(terminal.getCreateBy());
|
||||
gunDeviceDomain.setUpdateBy(terminal.getUpdateBy());
|
||||
deviceMapper.insert(gunDeviceDomain);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -432,4 +432,46 @@
|
||||
from xhpc_charging_pile
|
||||
where serial_number = #{serialNumber}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="selectByStationId" resultType="com.xhpc.common.domain.XhpcChargingPile">
|
||||
select
|
||||
charging_pile_id,
|
||||
charging_station_id,
|
||||
name,
|
||||
national_standard,
|
||||
power,
|
||||
auxiliary_power_supply,
|
||||
input_voltage,
|
||||
max_voltage,
|
||||
min_voltage,
|
||||
max_electric_current,
|
||||
min_electric_current,
|
||||
serial_number,
|
||||
type,
|
||||
program_version,
|
||||
network_link_type,
|
||||
gun_number,
|
||||
communication_protocol_version,
|
||||
communication_operator,
|
||||
sim_card,
|
||||
rate_model_id,
|
||||
status,
|
||||
del_flag,
|
||||
create_time,
|
||||
create_by,
|
||||
update_time,
|
||||
update_by,
|
||||
remark,
|
||||
rate_model_id,
|
||||
brand_model,
|
||||
production_date productionDate,
|
||||
manufacture_name manufactureName,
|
||||
connector_type connectorType,
|
||||
current,
|
||||
equipment_type equipmentType
|
||||
from xhpc_charging_pile
|
||||
where charging_station_id = #{stationId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -62,4 +62,9 @@
|
||||
FROM xhpc_rate
|
||||
WHERE rate_model_id=#{rateId};
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectAll" resultType="com.xhpc.common.domain.XhpcChargingStation">
|
||||
select * from xhpc_charging_station
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -195,7 +195,8 @@
|
||||
from xhpc_station_device
|
||||
where device_id = #{deviceId,jdbcType=INTEGER}
|
||||
</select>
|
||||
<update id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
|
||||
<update id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
update xhpc_station_device set del_flag = 2
|
||||
where device_id = #{deviceId,jdbcType=INTEGER}
|
||||
</update>
|
||||
@ -339,4 +340,12 @@
|
||||
update_by = #{updateBy,jdbcType=VARCHAR}
|
||||
where device_id = #{deviceId,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
|
||||
<select id="selectBySerialNumber" resultType="com.xhpc.activity.domain.XhpcStationDeviceDomain">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from xhpc_station_device
|
||||
where serial_number = #{serialNumber}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -0,0 +1,410 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.activity.mapper.XhpcTerminalMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.xhpc.common.domain.XhpcTerminal">
|
||||
<result property="terminalId" column="terminal_id"/>
|
||||
<result property="chargingPileId" column="charging_pile_id"/>
|
||||
<result property="chargingStationId" column="charging_station_id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="serialNumber" column="serial_number"/>
|
||||
<result property="pileSerialNumber" column="pile_serial_number"/>
|
||||
<result property="gunStatus" column="gun_status"/>
|
||||
<result property="workStatus" column="work_status"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="rateModelId" column="rate_model_id"/>
|
||||
<result property="operatorIdEvcs" column="operator_id_evcs"/>
|
||||
<result property="connectorType" column="connector_type" />
|
||||
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectXhpcTerminalVo">
|
||||
select terminal_id,
|
||||
charging_pile_id,
|
||||
charging_station_id,
|
||||
name,
|
||||
serial_number,
|
||||
pile_serial_number,
|
||||
gun_status,
|
||||
work_status,
|
||||
status,
|
||||
del_flag,
|
||||
create_time,
|
||||
create_by,
|
||||
update_time,
|
||||
update_by,
|
||||
remark,
|
||||
connector_type
|
||||
from xhpc_terminal
|
||||
</sql>
|
||||
|
||||
<select id="countXhpcTerminalWorkStatus" resultType="map">
|
||||
select (select count(terminal_id)
|
||||
from xhpc_terminal
|
||||
where status = 0
|
||||
and del_flag = 0
|
||||
and work_status = 0
|
||||
and charging_station_id = #{chargingStationId}) offLine,
|
||||
(select count(terminal_id)
|
||||
from xhpc_terminal
|
||||
where status = 0
|
||||
and del_flag = 0
|
||||
and work_status = 1
|
||||
and charging_station_id = #{chargingStationId}) fault,
|
||||
(select count(terminal_id)
|
||||
from xhpc_terminal
|
||||
where status = 0
|
||||
and del_flag = 0
|
||||
and work_status = 2
|
||||
and charging_station_id = #{chargingStationId}) freeTime,
|
||||
(select count(terminal_id)
|
||||
from xhpc_terminal
|
||||
where status = 0
|
||||
and del_flag = 0
|
||||
and work_status = 3
|
||||
and charging_station_id = #{chargingStationId}) charge
|
||||
from xhpc_terminal LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="getXhpcTerminalList" resultType="map">
|
||||
select
|
||||
te.terminal_id as terminalId,
|
||||
te.charging_pile_id as chargingPileId,
|
||||
te.charging_station_id as chargingStationId,
|
||||
te.name as terminalName,
|
||||
ct.name as chargingStationName,
|
||||
te.pile_serial_number as pileSerialNumber,
|
||||
cp.power as power,
|
||||
te.serial_number as serialNumber,
|
||||
cp.brand_model as brandModel,
|
||||
cp.type as pileType,
|
||||
te.status as status,
|
||||
te.work_status as workStatus
|
||||
from xhpc_terminal as te
|
||||
left join xhpc_charging_station as ct on ct.charging_station_id = te.charging_station_id
|
||||
left join xhpc_charging_pile as cp on cp.charging_pile_id = te.charging_pile_id
|
||||
where te.del_flag=0
|
||||
<if test="chargingStationId !=null">
|
||||
and te.charging_station_id=#{chargingStationId}
|
||||
</if>
|
||||
<if test="serialNumber !=null and serialNumber !=''">
|
||||
and te.serial_number like CONCAT('%',#{serialNumber},'%')
|
||||
</if>
|
||||
<if test="type !=null ">
|
||||
and cp.type=#{type}
|
||||
</if>
|
||||
<if test="status !=null ">
|
||||
and cp.status=#{status}
|
||||
</if>
|
||||
<if test="workStatus !=null and workStatus !=''">
|
||||
and te.work_status=#{chargingStationId}
|
||||
</if>
|
||||
<if test="tenantId !=null and tenantId !=''">
|
||||
and te.tenant_id=#{tenantId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectXhpcTerminalById" resultMap="BaseResultMap">
|
||||
<include refid="selectXhpcTerminalVo"/>
|
||||
where terminal_id = #{terminalId}
|
||||
</select>
|
||||
|
||||
<update id="updateXhpcTerminal">
|
||||
update xhpc_terminal
|
||||
<set>
|
||||
<if test="name != null and name !=''">
|
||||
name = #{name},
|
||||
</if>
|
||||
<if test="serialNumber != null and serialNumber !=''">
|
||||
serial_number = #{serialNumber},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="connectorType != null">
|
||||
connector_type = #{connectorType},
|
||||
</if>
|
||||
</set>
|
||||
where terminal_id = #{terminalId}
|
||||
</update>
|
||||
|
||||
<insert id="insertXhpcTerminal" parameterType="com.xhpc.common.domain.XhpcTerminal" useGeneratedKeys="true"
|
||||
keyProperty="terminalId">
|
||||
insert into xhpc_terminal
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="null != chargingPileId ">
|
||||
charging_pile_id,
|
||||
</if>
|
||||
<if test="null != chargingStationId ">
|
||||
charging_station_id,
|
||||
</if>
|
||||
<if test="null != name ">
|
||||
name,
|
||||
</if>
|
||||
<if test="null != serialNumber ">
|
||||
serial_number,
|
||||
</if>
|
||||
<if test="null != pileSerialNumber ">
|
||||
pile_serial_number,
|
||||
</if>
|
||||
<if test="null != gunStatus ">
|
||||
gun_status,
|
||||
</if>
|
||||
<if test="null != workStatus ">
|
||||
work_status,
|
||||
</if>
|
||||
<if test="null != status ">
|
||||
status,
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
del_flag,
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
create_by,
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
update_by,
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
remark,
|
||||
</if>
|
||||
<if test="null != rateModelId">
|
||||
rate_model_id,
|
||||
</if>
|
||||
<if test="null != number">
|
||||
number,
|
||||
</if>
|
||||
<if test="null != operatorIdEvcs">
|
||||
operator_id_evcs,
|
||||
</if>
|
||||
<if test="null != tenantId">
|
||||
tenant_id,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="null != chargingPileId ">
|
||||
#{chargingPileId},
|
||||
</if>
|
||||
<if test="null != chargingStationId ">
|
||||
#{chargingStationId},
|
||||
</if>
|
||||
<if test="null != name ">
|
||||
#{name},
|
||||
</if>
|
||||
<if test="null != serialNumber ">
|
||||
#{serialNumber},
|
||||
</if>
|
||||
<if test="null != pileSerialNumber ">
|
||||
#{pileSerialNumber},
|
||||
</if>
|
||||
<if test="null != gunStatus ">
|
||||
#{gunStatus},
|
||||
</if>
|
||||
<if test="null != workStatus ">
|
||||
#{workStatus},
|
||||
</if>
|
||||
<if test="null != status ">
|
||||
#{status},
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
#{delFlag},
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
#{remark},
|
||||
</if>
|
||||
<if test="null != rateModelId">
|
||||
#{rateModelId},
|
||||
</if>
|
||||
<if test="null != number">
|
||||
#{number},
|
||||
</if>
|
||||
<if test="null != operatorIdEvcs">
|
||||
#{operatorIdEvcs},
|
||||
</if>
|
||||
<if test="null != tenantId">
|
||||
#{tenantId},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
<select id="selectXhpcTerminalPileMessage" resultType="map">
|
||||
select ter.terminal_id as terminalId,
|
||||
ter.charging_station_id as chargingStationId,
|
||||
ter.name as name,
|
||||
ter.serial_number as serialNumber,
|
||||
ter.gun_status as gunStatus,
|
||||
ter.work_status as workStatus,
|
||||
ter.status as status,
|
||||
ct.name as chargingStationName,
|
||||
ter.create_time as createTime,
|
||||
cp.serial_number as pileSerialNumber,
|
||||
cp.type as type,
|
||||
cp.national_standard as nationalStandard,
|
||||
cp.power as power,
|
||||
cp.auxiliary_power_supply as auxiliaryPowerSupply,
|
||||
cp.input_voltage as inputVoltage,
|
||||
cp.max_voltage as maxVoltage,
|
||||
cp.min_voltage as minVoltage,
|
||||
cp.max_electric_current as maxElectricCurrent,
|
||||
cp.min_electric_current as minElectricCurrent,
|
||||
cp.communication_operator as communicationOperator,
|
||||
cp.sim_card as simCard,
|
||||
cp.connector_type as connectorType,
|
||||
cp.brand_model as brandModel,
|
||||
db.dict_value as attribute
|
||||
from xhpc_terminal as ter
|
||||
left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
|
||||
left join xhpc_charging_station as ct on ct.charging_station_id = ter.charging_station_id
|
||||
left join xhpc_operator as op on op.operator_id = ct.operator_id
|
||||
left join xhpc_dict_biz as db on db.code='operator_attribute' and db.dict_key=op.attribute
|
||||
where ter.terminal_id = #{terminalId}
|
||||
</select>
|
||||
|
||||
<select id="getXhpcRateTimeTypeList" resultType="map">
|
||||
<if test="type ==1">
|
||||
select
|
||||
rt.start_time as startTime,
|
||||
replace(rt.end_time,'00:00:00','24:00:00') AS endTime,
|
||||
rt.rate_id as rateId,
|
||||
rt.rate_value as rateValue,
|
||||
ra.power_fee as powerFee,
|
||||
ra.service_fee as serviceFee,
|
||||
ra.name as rateName
|
||||
from xhpc_rate_time as rt
|
||||
left join xhpc_rate as ra on ra.rate_id =rt.rate_id
|
||||
where rt.charging_station_id=#{chargingStationId} and rt.del_flag =0 and rt.type=1
|
||||
</if>
|
||||
<if test="type ==2">
|
||||
select
|
||||
rt.start_time as startTime,
|
||||
replace(rt.end_time,'00:00:00','24:00:00') AS endTime,
|
||||
rt.rate_id as rateId,
|
||||
ra.power_fee as powerFee,
|
||||
ra.service_fee as serviceFee,
|
||||
ra.name as rateName
|
||||
from xhpc_rate_time as rt
|
||||
left join xhpc_rate as ra on ra.rate_id =rt.rate_id
|
||||
where rt.charging_station_id=#{chargingStationId} and rt.del_flag =0 and rt.type=2
|
||||
group by type
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getXhpcRateTimeOrderStatistics" resultType="map">
|
||||
SELECT
|
||||
sum(charging_degree) AS chargingDegreeSum,
|
||||
COUNT(charge_order_id) AS realTimeOrderIdCount,
|
||||
COUNT(DISTINCT user_id) AS userIdCount
|
||||
FROM
|
||||
xhpc_charge_order
|
||||
WHERE
|
||||
terminal_id = #{terminalId}
|
||||
and charging_station_id=#{chargingStationId}
|
||||
AND to_days(create_time) = to_days(now())
|
||||
</select>
|
||||
|
||||
<select id="getWXpNumMessage" resultType="map">
|
||||
select ter.name as terminalName,
|
||||
ter.serial_number as serialNumber,
|
||||
cp.power as power,
|
||||
cp.type as type,
|
||||
cp.max_voltage as maxVoltage,
|
||||
cp.auxiliary_power_supply as auxiliaryPowerSupply,
|
||||
ct.parking_instructions as parkingInstructions,
|
||||
ct.create_time as createTime,
|
||||
ter.charging_station_id as chargingStationId
|
||||
from xhpc_terminal as ter
|
||||
left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
|
||||
left join xhpc_charging_station as ct on ct.charging_station_id = ter.charging_station_id
|
||||
where ter.serial_number = #{pNum}
|
||||
and ter.del_flag = 0
|
||||
order by ter.number desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="getImageList" resultType="map">
|
||||
select
|
||||
img_id as imgId,
|
||||
url as url
|
||||
from xhpc_img where del_flag=0 and status=0
|
||||
<if test="imgIds !=null and imgIds.size()>0 ">
|
||||
and img_id in
|
||||
<foreach collection="imgIds" item="chargingStationId" open="(" separator="," close=")">
|
||||
#{chargingStationId}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getXhpcPileNameAndStationNameAndTerminalNumList" resultType="map">
|
||||
SELECT
|
||||
terminal.serial_number AS terminal_serial_number,
|
||||
pile.name AS pile_name,
|
||||
station.name AS station_name
|
||||
FROM
|
||||
xhpc_terminal AS terminal,
|
||||
xhpc_charging_pile AS pile,
|
||||
xhpc_charging_station AS station
|
||||
WHERE
|
||||
terminal.charging_pile_id = pile.charging_pile_id
|
||||
AND terminal.charging_station_id = station.charging_station_id
|
||||
<if test="terminalSerialNumber!=null">
|
||||
And terminal.serial_number like CONCAT('%',#{terminalSerialNumber},'%')
|
||||
</if>
|
||||
<if test="pileName!=null and pileName.size()>0">
|
||||
And terminal.serial_number like CONCAT('%',#{pileName},'%')
|
||||
</if>
|
||||
<if test="stationName!=null and stationName.size()>0">
|
||||
And terminal.serial_number like CONCAT('%',#{stationName},'%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getTerminal" resultType="String">
|
||||
select serial_number as serialNumber
|
||||
from xhpc_terminal
|
||||
where charging_station_id = #{chargingStationId}
|
||||
and status = #{status}
|
||||
and del_flag = 0
|
||||
</select>
|
||||
<select id="selectXhpcTerminalIdByPileIds" resultMap="BaseResultMap">
|
||||
<include refid="selectXhpcTerminalVo"/>
|
||||
WHERE
|
||||
charging_pile_id IN
|
||||
<foreach collection="list" separator="," item="pileId" close=")" open="(">
|
||||
#{pileId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectByPileId" resultMap="BaseResultMap">
|
||||
<include refid="selectXhpcTerminalVo"/>
|
||||
WHERE charging_pile_id = #{pileId}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -98,6 +98,7 @@
|
||||
from xhpc_work_station
|
||||
where work_station_id = #{workStationId,jdbcType=BIGINT}
|
||||
</select>
|
||||
|
||||
<update id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
update xhpc_work_station set del_flag=2
|
||||
where work_station_id = #{workStationId,jdbcType=BIGINT}
|
||||
@ -273,7 +274,8 @@
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.xhpc.activity.domain.XhpcWorkStationDomain">
|
||||
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.xhpc.activity.domain.XhpcWorkStationDomain">
|
||||
update xhpc_work_station
|
||||
<set>
|
||||
<if test="name != null">
|
||||
@ -373,4 +375,47 @@
|
||||
tenant_id = #{tenantId,jdbcType=VARCHAR}
|
||||
where work_station_id = #{workStationId,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
|
||||
<insert id="insertBatch">
|
||||
insert into xhpc_work_station (work_station_id, `name`, operator_id, `type`,
|
||||
construction_site, service_facilities, periphery_facilities,
|
||||
address, detailed_address, longitude,
|
||||
latitude, parking_instructions, serial_number,
|
||||
`status`, del_flag, create_time,
|
||||
create_by, update_time, update_by,
|
||||
remark, business_instructions, reminder_instructions,
|
||||
img_id, station_type, service_tel,
|
||||
park_nums, tenant_id)
|
||||
values
|
||||
<foreach collection="domainList" open="(" item="domain" index="index" separator="," close=")">
|
||||
(#{domain.workStationId}, #{domain.name}, #{domain.operatorId}, #{domain.type},
|
||||
#{domain.constructionSite}, #{domain.serviceFacilities}, #{domain.peripheryFacilities},
|
||||
#{domain.address}, #{domain.detailedAddress}, #{domain.longitude},
|
||||
#{domain.latitude}, #{domain.parkingInstructions}, #{domain.serialNumber},
|
||||
#{domain.status}, 0, sysdate(),
|
||||
#{domain.createBy}, sysdate(), #{domain.updateBy},
|
||||
#{domain.remark}, #{domain.businessInstructions}, #{domain.reminderInstructions},
|
||||
#{domain.imgId}, #{domain.stationType}, #{domain.serviceTel},
|
||||
#{domain.parkNums}, #{domain.tenantId})
|
||||
</foreach>
|
||||
|
||||
</insert>
|
||||
|
||||
|
||||
<select id="selectBySerialNumbers" resultType="com.xhpc.activity.domain.XhpcWorkStationDomain">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from xhpc_work_station
|
||||
where find_in_set(serial_number, #{serialNumbers})
|
||||
</select>
|
||||
|
||||
<select id="selectBySerialNumber" resultType="com.xhpc.activity.domain.XhpcWorkStationDomain">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from xhpc_work_station
|
||||
where serial_number=#{serialNumber}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user