更新可修改已存在的数据
This commit is contained in:
parent
8beb13fe0a
commit
0c29d1fcb4
@ -103,4 +103,7 @@ public interface XhpcChargingPileMapper {
|
||||
*/
|
||||
int pileCount(@Param("chargingStationId") Long chargingStationId);
|
||||
|
||||
|
||||
|
||||
XhpcChargingPile getXhpcChargingPileBySerialNumber(@Param("serialNumber") String serialNumber);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.xhpc.charging.station.service;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.aliyun.oss.OSSClient;
|
||||
import com.aliyun.oss.model.*;
|
||||
import com.xhpc.charging.station.mapper.XhpcChargingPileMapper;
|
||||
@ -322,21 +323,21 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService {
|
||||
for (XhpcChargingPile pile : pileList) {
|
||||
try {
|
||||
// 所有表格字段数据必须非空且有效
|
||||
if("".equals(pile.getChargingStationName()) || "".equals(pile.getName())
|
||||
|| "".equals(pile.getBrandModel()) || "".equals(pile.getNationalStandard())
|
||||
if(StrUtil.hasBlank(pile.getChargingStationName()) || StrUtil.hasBlank(pile.getName())
|
||||
|| StrUtil.hasBlank(pile.getBrandModel()) || StrUtil.hasBlank(pile.getNationalStandard())
|
||||
|| pile.getPower() == null || pile.getPower()<0
|
||||
|| pile.getAuxiliaryPowerSupply() == null || pile.getAuxiliaryPowerSupply()<0
|
||||
|| pile.getInputVoltage() ==null || pile.getInputVoltage()<0
|
||||
|| pile.getMaxVoltage() ==null || pile.getMaxVoltage()<0
|
||||
|| pile.getMinVoltage() == null || pile.getMinVoltage() < 0
|
||||
|| pile.getMaxElectricCurrent() == null || pile.getMaxElectricCurrent() < 0
|
||||
|| pile.getMinElectriCurrent() == null || pile.getMinElectriCurrent() <0
|
||||
|| "".equals(pile.getSerialNumber())
|
||||
|| "".equals(pile.getTypeName())
|
||||
|| pile.getMinElectriCurrent() == null || pile.getMinElectriCurrent() < 0
|
||||
|| StrUtil.hasBlank(pile.getSerialNumber())
|
||||
|| StrUtil.hasBlank(pile.getTypeName())
|
||||
|| pile.getGunNumber() == null || pile.getGunNumber() <0
|
||||
|| "".equals(pile.getCommunicationProtocolVersion()) || "".equals(pile.getNetworkLinkType())
|
||||
|| "".equals(pile.getProductionDate()) || "".equals(pile.getManufactureName())
|
||||
|| "".equals(pile.getConnectorTypeName()) || "".equals(pile.getEquipmentTypeName())){
|
||||
|| StrUtil.hasBlank(pile.getCommunicationProtocolVersion()) || StrUtil.hasBlank(pile.getNetworkLinkType())
|
||||
|| StrUtil.hasBlank(pile.getProductionDate()) || StrUtil.hasBlank(pile.getManufactureName())
|
||||
|| StrUtil.hasBlank(pile.getConnectorTypeName())|| StrUtil.hasBlank(pile.getEquipmentTypeName())){
|
||||
failureNum ++;
|
||||
failureMsg.append("<br/>电站名称: ").append(pile.getChargingStationName()).append(" ,电桩名称: ").append(pile.getName()).append(" 导入失败; 失败原因: 必填字段为空。");
|
||||
continue;
|
||||
@ -353,7 +354,26 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService {
|
||||
continue;
|
||||
}
|
||||
pile.setChargingStationId(station.getChargingStationId());
|
||||
AjaxResult result = addXhpcChargingPile(pile);
|
||||
|
||||
String serialNumber = pile.getSerialNumber();
|
||||
XhpcChargingPile chargingPile = xhpcChargingPileMapper.getXhpcChargingPileBySerialNumber(serialNumber);
|
||||
AjaxResult result = null;
|
||||
|
||||
if(isUpdateSupport){
|
||||
if(chargingPile != null){
|
||||
pile.setChargingPileId(chargingPile.getChargingPileId());
|
||||
result = updateXhpcChargingPile(pile);
|
||||
}else {
|
||||
result = addXhpcChargingPile(pile);
|
||||
}
|
||||
} else {
|
||||
if(chargingPile != null) {
|
||||
result = AjaxResult.error("桩编号重复");
|
||||
} else {
|
||||
result = addXhpcChargingPile(pile);
|
||||
}
|
||||
}
|
||||
|
||||
if(!result.get(AjaxResult.CODE_TAG).equals(HttpStatus.SUCCESS)){
|
||||
failureNum ++;
|
||||
failureMsg.append("<br/>电站名称: ").append(pile.getChargingStationName()).append(" ,电桩名称: ").append(pile.getName()).append(" 导入失败; 失败原因: ").append(result.get(AjaxResult.MSG_TAG));
|
||||
|
||||
@ -447,4 +447,44 @@
|
||||
<select id="pileCount" resultType="java.lang.Integer">
|
||||
select count(charging_pile_id) from xhpc_charging_pile WHERE charging_station_id =#{chargingStationId} and def_flag=0
|
||||
</select>
|
||||
|
||||
<select id="getXhpcChargingPileBySerialNumber" 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 serial_number = #{serialNumber}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user