Merge branch 'dev' into HuiFu

This commit is contained in:
2023-04-24 15:25:28 +08:00
39 changed files with 1562 additions and 281 deletions

View File

@@ -72,4 +72,14 @@ public class JumpController extends BaseController {
return response;
}
/**
* 更新接口
* http://localhost:8080/app-xcx-h5/pile/updateOrderDetail
*/
@GetMapping("updateOrderDetail")
public RestApiResponse<?> updateOrderDetail() {
orderBasicInfoService.updateElecAmount();
return new RestApiResponse<>();
}
}

View File

@@ -142,7 +142,7 @@ public class PayController extends BaseController {
public RestApiResponse<?> getPayMode(HttpServletRequest request, @RequestBody GetPayModeDTO dto) {
RestApiResponse<?> response;
try {
// dto.setMemberId(getMemberIdByAuthorization(request));
dto.setMemberId(getMemberIdByAuthorization(request));
List<PayModeVO> list = orderService.getPayMode(dto);
response = new RestApiResponse<>(ImmutableMap.of("list", list));
} catch (BusinessException e) {

View File

@@ -11,13 +11,13 @@ import com.jsowell.pile.dto.QueryConnectorListDTO;
import com.jsowell.pile.dto.QueryStationDTO;
import com.jsowell.pile.service.IPileConnectorInfoService;
import com.jsowell.pile.service.IPileStationInfoService;
import com.jsowell.pile.vo.base.StationInfoVO;
import com.jsowell.pile.vo.uniapp.PersonalPileInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* 充电桩相关接口
@@ -89,6 +89,27 @@ public class PileController extends BaseController {
return response;
}
/**
* 根据充电站id查询枪口列表
* @param request
* @param dto
* @return
*/
@PostMapping("/selectStationConnectorList")
public RestApiResponse<?> selectStationConnectorList(HttpServletRequest request, @RequestBody QueryConnectorListDTO dto) {
logger.info("查询充电枪口列表 params:{}", JSONObject.toJSONString(dto));
RestApiResponse<?> response = null;
try {
PageResponse pageResponse = pileConnectorInfoService.selectStationConnectorList(dto);
response = new RestApiResponse<>(pageResponse);
} catch (Exception e) {
logger.error("查询充电枪口列表异常", e);
response = new RestApiResponse<>(ReturnCodeEnum.CODE_GET_CONNECTOR_INFO_BY_STATION_ID_ERROR);
}
logger.info("查询充电枪口列表 result:{}", response);
return response;
}
}

View File

@@ -4,19 +4,17 @@ import com.alibaba.fastjson2.JSONObject;
import com.jsowell.common.annotation.Anonymous;
import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.response.RestApiResponse;
import com.jsowell.common.util.StringUtils;
import com.jsowell.thirdparty.dto.QueryStationInfoDTO;
import com.jsowell.pile.dto.QueryEquipmentDTO;
import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.thirdparty.domain.StationStatsInfo;
import com.jsowell.thirdparty.service.LianLianService;
import com.jsowell.thirdparty.vo.EquipmentAuthVO;
import com.jsowell.thirdparty.vo.LianLianPageResponse;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* 对接联联平台controller
@@ -55,8 +53,8 @@ public class LianLianController extends BaseController {
}
/**
* 查询充电站状态信息
* @param dto
* 联联平台查询充电站状态信息
* @param StationIDs
* @return
*/
@PostMapping("/query_station_status")
@@ -76,4 +74,44 @@ public class LianLianController extends BaseController {
logger.info("联联平台查询充电站状态信息 result:{}", response);
return response;
}
/**
* 查询统计信息
* @param dto
* @return
*/
@PostMapping("/query_station_stats")
public RestApiResponse<?> query_station_stats(@RequestBody QueryStationInfoDTO dto) {
logger.info("联联平台查询统计信息 params :{}", JSONObject.toJSONString(dto));
RestApiResponse<?> response;
try {
StationStatsInfo stationStatsInfo = lianLianService.query_station_stats(dto);
response = new RestApiResponse<>(stationStatsInfo);
} catch (Exception e) {
logger.error("联联平台查询统计信息 error", e);
response = new RestApiResponse<>(e);
}
logger.info("联联平台查询统计信息 result :{}", response);
return response;
}
/**
* 请求设备认证
* @param dto
* @return
*/
@PostMapping("/query_equip_auth")
public RestApiResponse<?> query_equip_auth(@RequestBody QueryEquipmentDTO dto) {
logger.info("联联平台请求设备认证 params :{}", JSONObject.toJSONString(dto));
RestApiResponse<?> response;
try {
EquipmentAuthVO equipmentAuthVO = lianLianService.query_equip_auth(dto);
response = new RestApiResponse<>(equipmentAuthVO);
} catch (Exception e) {
logger.error("联联平台请求设备认证 error", e);
response = new RestApiResponse<>(e);
}
logger.info("联联平台请求设备认证 result :{}", response);
return response;
}
}

View File

@@ -34,6 +34,7 @@ import com.jsowell.pile.domain.OrderBasicInfo;
import com.jsowell.pile.domain.OrderDetail;
import com.jsowell.pile.domain.OrderInvoiceRecord;
import com.jsowell.pile.domain.OrderPayRecord;
import com.jsowell.pile.domain.PileStationWhitelist;
import com.jsowell.pile.domain.WxpayCallbackRecord;
import com.jsowell.pile.dto.ApplyOrderInvoiceDTO;
import com.jsowell.pile.dto.BasicPileDTO;
@@ -57,6 +58,7 @@ import com.jsowell.pile.service.IOrderInvoiceRecordService;
import com.jsowell.pile.service.IOrderPayRecordService;
import com.jsowell.pile.service.IPileBillingTemplateService;
import com.jsowell.pile.service.IPileStationInfoService;
import com.jsowell.pile.service.IPileStationWhitelistService;
import com.jsowell.pile.service.WechatPayService;
import com.jsowell.pile.service.WxpayCallbackRecordService;
import com.jsowell.pile.transaction.dto.OrderTransactionDTO;
@@ -140,6 +142,9 @@ public class OrderService {
@Autowired
private IOrderInvoiceRecordService orderInvoiceRecordService;
@Autowired
private IPileStationWhitelistService pileStationWhitelistService;
@Autowired
private RedisCache redisCache;
@@ -408,16 +413,29 @@ public class OrderService {
orderBasicInfo.setAppointmentTime(DateUtils.parseDate(dto.getAppointmentTime(), DateUtils.YYYY_MM_DD_HH_MM_SS));
}
// 订单详情
BillingTemplateVO billingTemplate = dto.getBillingTemplate();
BigDecimal sharpElectricityPrice = billingTemplate.getSharpElectricityPrice() != null ? billingTemplate.getSharpElectricityPrice() : BigDecimal.ZERO;
BigDecimal sharpServicePrice = billingTemplate.getSharpServicePrice() != null ? billingTemplate.getSharpServicePrice() : BigDecimal.ZERO;
BigDecimal peakElectricityPrice = billingTemplate.getPeakElectricityPrice() != null ? billingTemplate.getPeakElectricityPrice() : BigDecimal.ZERO;
BigDecimal peakServicePrice = billingTemplate.getPeakServicePrice() != null ? billingTemplate.getPeakServicePrice() : BigDecimal.ZERO;
BigDecimal flatElectricityPrice = billingTemplate.getFlatElectricityPrice() != null ? billingTemplate.getFlatElectricityPrice() : BigDecimal.ZERO;
BigDecimal flatServicePrice = billingTemplate.getFlatServicePrice() != null ? billingTemplate.getFlatServicePrice() : BigDecimal.ZERO;
BigDecimal valleyElectricityPrice = billingTemplate.getValleyElectricityPrice() != null ? billingTemplate.getValleyElectricityPrice() : BigDecimal.ZERO;
BigDecimal valleyServicePrice = billingTemplate.getValleyServicePrice() != null ? billingTemplate.getValleyServicePrice() : BigDecimal.ZERO;
OrderDetail orderDetail = OrderDetail.builder()
.orderCode(orderCode)
.sharpElectricityPrice(dto.getBillingTemplate().getSharpElectricityPrice())
.sharpServicePrice(dto.getBillingTemplate().getSharpServicePrice())
.peakElectricityPrice(dto.getBillingTemplate().getPeakElectricityPrice())
.peakServicePrice(dto.getBillingTemplate().getPeakServicePrice())
.flatElectricityPrice(dto.getBillingTemplate().getFlatElectricityPrice())
.flatServicePrice(dto.getBillingTemplate().getFlatServicePrice())
.valleyElectricityPrice(dto.getBillingTemplate().getValleyElectricityPrice())
.valleyServicePrice(dto.getBillingTemplate().getValleyServicePrice())
.sharpPrice(sharpElectricityPrice.add(sharpServicePrice))
.sharpElectricityPrice(sharpElectricityPrice)
.sharpServicePrice(sharpServicePrice)
.peakPrice(peakElectricityPrice.add(peakServicePrice))
.peakElectricityPrice(peakElectricityPrice)
.peakServicePrice(peakServicePrice)
.flatPrice(flatElectricityPrice.add(flatServicePrice))
.flatElectricityPrice(flatElectricityPrice)
.flatServicePrice(flatServicePrice)
.valleyPrice(valleyElectricityPrice.add(valleyServicePrice))
.valleyElectricityPrice(valleyElectricityPrice)
.valleyServicePrice(valleyServicePrice)
.build();
OrderTransactionDTO createOrderTransactionDTO = OrderTransactionDTO.builder()
@@ -821,7 +839,7 @@ public class OrderService {
vo.setReason(orderBasicInfo.getReason());
vo.setOrderAmount(String.valueOf(orderBasicInfo.getOrderAmount()));
vo.setPayAmount(String.valueOf(orderBasicInfo.getPayAmount()));
vo.setPayMode(orderBasicInfo.getPayMode());
// 订单状态描述
String orderStatusDescribe = orderBasicInfoService.transformOrderStatusDescribe(orderStatus, orderBasicInfo.getPayStatus());
vo.setOrderStatusDescribe(orderStatusDescribe);
@@ -963,7 +981,8 @@ public class OrderService {
public List<PayModeVO> getPayMode(GetPayModeDTO dto) {
List<PayModeVO> result = Lists.newArrayList();
// 查询会员在站点是否是白名单用户
boolean flag = false;
PileStationWhitelist whitelist = pileStationWhitelistService.queryWhitelistByMemberId(dto.getStationId(), dto.getMemberId());
boolean flag = whitelist != null;
if (flag) {
result.add(
PayModeVO.builder()

View File

@@ -0,0 +1,98 @@
package com.jsowell.web.controller.pile;
import com.jsowell.common.annotation.Log;
import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.core.domain.AjaxResult;
import com.jsowell.common.core.page.TableDataInfo;
import com.jsowell.common.enums.BusinessType;
import com.jsowell.common.util.poi.ExcelUtil;
import com.jsowell.pile.domain.PileStationWhitelist;
import com.jsowell.pile.service.IPileStationWhitelistService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 站点白名单Controller
*
* @author jsowell
* @date 2023-04-20
*/
@RestController
@RequestMapping("/pile/whitelist")
public class PileStationWhitelistController extends BaseController {
@Autowired
private IPileStationWhitelistService pileStationWhitelistService;
/**
* 查询站点白名单列表
*/
@PreAuthorize("@ss.hasPermi('pile:whitelist:list')")
@GetMapping("/list")
public TableDataInfo list(PileStationWhitelist pileStationWhitelist) {
startPage();
List<PileStationWhitelist> list = pileStationWhitelistService.selectPileStationWhitelistList(pileStationWhitelist);
return getDataTable(list);
}
/**
* 导出站点白名单列表
*/
@PreAuthorize("@ss.hasPermi('pile:whitelist:export')")
@Log(title = "站点白名单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, PileStationWhitelist pileStationWhitelist) {
List<PileStationWhitelist> list = pileStationWhitelistService.selectPileStationWhitelistList(pileStationWhitelist);
ExcelUtil<PileStationWhitelist> util = new ExcelUtil<PileStationWhitelist>(PileStationWhitelist.class);
util.exportExcel(response, list, "站点白名单数据");
}
/**
* 获取站点白名单详细信息
*/
@PreAuthorize("@ss.hasPermi('pile:whitelist:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(pileStationWhitelistService.selectPileStationWhitelistById(id));
}
/**
* 新增站点白名单
*/
@PreAuthorize("@ss.hasPermi('pile:whitelist:add')")
@Log(title = "站点白名单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PileStationWhitelist pileStationWhitelist) {
return toAjax(pileStationWhitelistService.insertPileStationWhitelist(pileStationWhitelist));
}
/**
* 修改站点白名单
*/
@PreAuthorize("@ss.hasPermi('pile:whitelist:edit')")
@Log(title = "站点白名单", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PileStationWhitelist pileStationWhitelist) {
return toAjax(pileStationWhitelistService.updatePileStationWhitelist(pileStationWhitelist));
}
/**
* 删除站点白名单
*/
@PreAuthorize("@ss.hasPermi('pile:whitelist:remove')")
@Log(title = "站点白名单", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(pileStationWhitelistService.deletePileStationWhitelistByIds(ids));
}
}

View File

@@ -38,27 +38,27 @@
</appender>
<!-- netty日志单独输出 -->
<!--<appender name="netty9011" class="ch.qos.logback.core.rolling.RollingFileAppender">
<appender name="netty9011" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/netty9011.log</file>
&lt;!&ndash; 循环政策:基于时间创建日志文件 &ndash;&gt;
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
&lt;!&ndash; 日志文件名格式 &ndash;&gt;
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/netty9011.%d{yyyy-MM-dd}.log</fileNamePattern>
&lt;!&ndash; 日志最大的历史&ndash;&gt;
<!-- 日志最大的历史-->
<maxHistory>${maxHistory}</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
&lt;!&ndash; 过滤的级别 &ndash;&gt;
<!-- 过滤的级别 -->
<level>INFO</level>
&lt;!&ndash; 匹配时的操作:接收(记录) &ndash;&gt;
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
&lt;!&ndash; 不匹配时的操作:拒绝(不记录) &ndash;&gt;
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>-->
</appender>
<!-- 错误日志输出 -->
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
@@ -102,9 +102,9 @@
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" />
<!-- netty日志 additivity="false"netty日志不会输出到控制台 -->
<!--<logger name="com.jsowell.netty" level="info" additivity="true">
<logger name="com.jsowell.netty" level="info" additivity="true">
<appender-ref ref="netty9011" />
</logger>-->
</logger>
<root level="info">
<appender-ref ref="console" />

View File

@@ -154,6 +154,11 @@ public class SpringBootTestController {
@Autowired
private IPileAuthCardService pileAuthCardService;
@Test
public void testupdateElecAmount() {
orderBasicInfoService.updateElecAmount();
}
@Test
public void testSelectSomeStatusCardInfo() {
PileAuthCard pileAuthCard = pileAuthCardService.selectCardInfoByLogicCard("1111111111111111");

View File

@@ -149,7 +149,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
}
}
public static void main(String[] args) {
public static void main(String[] args) throws ParseException {
// String str = "2023-01-07 11:17:12";
// Date date = parseDate(str);
// String str1 = parseDateToStr(YYYY_MM_DD_HH_MM_SS, date);

View File

@@ -133,6 +133,10 @@ public class YKCUtils {
String s = transitionTemperature(bytes);
System.out.println(s);
byte[] bytess = new byte[]{(byte) 0x80, (byte) 0x1A, 0x06, 0x00};
String s1 = convertDecimalPoint(bytess, 5);
System.out.println(s1);
}
/**

View File

@@ -0,0 +1,98 @@
package com.jsowell.pile.domain;
import com.jsowell.common.annotation.Excel;
import com.jsowell.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 站点白名单对象 pile_station_whitelist
*
* @author jsowell
* @date 2023-04-19
*/
public class PileStationWhitelist extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private Long id;
/**
* 站点id
*/
@Excel(name = "站点id")
private String stationId;
/**
* 会员id
*/
@Excel(name = "会员id")
private String memberId;
/**
* 手机号
*/
@Excel(name = "手机号")
private String mobileNumber;
/**
* 删除标识0-正常1-删除)
*/
private String delFlag;
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setStationId(String stationId) {
this.stationId = stationId;
}
public String getStationId() {
return stationId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
public String getMemberId() {
return memberId;
}
public String getMobileNumber() {
return mobileNumber;
}
public void setMobileNumber(String mobileNumber) {
this.mobileNumber = mobileNumber;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getDelFlag() {
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.JSON_STYLE)
.append("id", getId())
.append("stationId", getStationId())
.append("memberId", getMemberId())
.append("createTime", getCreateTime())
.append("createBy", getCreateBy())
.append("updateTime", getUpdateTime())
.append("updateBy", getUpdateBy())
.append("delFlag", getDelFlag())
.toString();
}
}

View File

@@ -0,0 +1,27 @@
package com.jsowell.pile.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/**
* 联联平台请求设备认证
*
* @author JS-ZZA
* @date 2023/4/19 10:08
*/
@Data
public class QueryEquipmentDTO {
/**
* 设备认证流水号
* 格式“运营商 ID+yyyyMMddHHmmss+4 位随机数”,
* 27 字符
*/
@JsonProperty(value = "EquipAuthSeq")
private String EquipAuthSeq;
/**
* 充电设备接口编码
*/
@JsonProperty(value = "ConnectorID")
private String ConnectorID;
}

View File

@@ -1,5 +1,6 @@
package com.jsowell.thirdparty.dto;
package com.jsowell.pile.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -23,35 +24,41 @@ public class QueryStationInfoDTO {
* 格式yyyy-MM-dd HH:mm:ss可以为空如果
* 不填写则查询所有的充电站信息
*/
@JsonProperty(value = "LastQueryTime")
private String LastQueryTime;
/**
* 查询页码
* 不填写默认为 1
*/
@JsonProperty(value = "PageNo")
private Integer PageNo;
/**
* 每页数量
* 不填写默认为 10
*/
@JsonProperty(value = "PageSize")
private Integer PageSize;
/**
* 充电站 ID
*/
@JsonProperty(value = "StationID")
private String StationID;
/**
* 统计开始时间
* 格式yyyy-MM-dd
*/
@JsonProperty(value = "StartTime")
private String StartTime;
/**
* 统计结束时间
* 格式yyyy-MM-dd
*/
@JsonProperty(value = "EndTime")
private String EndTime;
}

View File

@@ -5,6 +5,8 @@ import com.jsowell.pile.domain.OrderDetail;
import com.jsowell.pile.dto.IndexQueryDTO;
import com.jsowell.pile.dto.QueryOrderDTO;
import com.jsowell.pile.dto.QueryPersonPileDTO;
import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
import com.jsowell.pile.vo.uniapp.OrderVO;
import com.jsowell.pile.vo.uniapp.PersonPileConnectorSumInfoVO;
import com.jsowell.pile.vo.uniapp.SendMessageVO;
@@ -192,4 +194,15 @@ public interface OrderBasicInfoMapper {
List<OrderBasicInfo> getAppointmentOrder(LocalDateTime dateTime);
List<OrderVO> getListByOrderCodes(@Param("orderCodes") List<String> orderCodes);
/**
* 联联平台 获取累计数据用
* @param dto
* @return
*/
List<AccumulativeInfoVO> getAccumulativeInfoForLianLian(QueryStationInfoDTO dto);
List<OrderDetail> queryElecAmountNullList();
int batchUpdateOrderDetail(@Param("list") List<OrderDetail> orderDetailList);
}

View File

@@ -0,0 +1,66 @@
package com.jsowell.pile.mapper;
import com.jsowell.pile.domain.PileStationWhitelist;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 站点白名单Mapper接口
*
* @author jsowell
* @date 2023-04-19
*/
@Repository
public interface PileStationWhitelistMapper {
/**
* 查询站点白名单
*
* @param id 站点白名单主键
* @return 站点白名单
*/
public PileStationWhitelist selectPileStationWhitelistById(Long id);
/**
* 查询站点白名单列表
*
* @param pileStationWhitelist 站点白名单
* @return 站点白名单集合
*/
public List<PileStationWhitelist> selectPileStationWhitelistList(PileStationWhitelist pileStationWhitelist);
/**
* 新增站点白名单
*
* @param pileStationWhitelist 站点白名单
* @return 结果
*/
public int insertPileStationWhitelist(PileStationWhitelist pileStationWhitelist);
/**
* 修改站点白名单
*
* @param pileStationWhitelist 站点白名单
* @return 结果
*/
public int updatePileStationWhitelist(PileStationWhitelist pileStationWhitelist);
/**
* 删除站点白名单
*
* @param id 站点白名单主键
* @return 结果
*/
public int deletePileStationWhitelistById(Long id);
/**
* 批量删除站点白名单
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deletePileStationWhitelistByIds(Long[] ids);
PileStationWhitelist queryWhitelistByMemberId(@Param("stationId") String stationId, @Param("memberId") String memberId);
}

View File

@@ -4,10 +4,8 @@ import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
import com.jsowell.pile.domain.OrderBasicInfo;
import com.jsowell.pile.domain.OrderDetail;
import com.jsowell.pile.dto.GenerateOrderDTO;
import com.jsowell.pile.dto.IndexQueryDTO;
import com.jsowell.pile.dto.QueryOrderDTO;
import com.jsowell.pile.dto.QueryPersonPileDTO;
import com.jsowell.pile.dto.*;
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
import com.jsowell.pile.vo.uniapp.OrderVO;
import com.jsowell.pile.vo.uniapp.PersonPileConnectorSumInfoVO;
import com.jsowell.pile.vo.uniapp.SendMessageVO;
@@ -27,13 +25,6 @@ import java.util.Map;
* @date 2022-09-30
*/
public interface IOrderBasicInfoService {
/**
* 查询订单
*
* @param id 订单主键
* @return 订单
*/
OrderBasicInfo selectOrderBasicInfoById(Long id);
/**
* 条件查询订单基础信息
@@ -128,6 +119,8 @@ public interface IOrderBasicInfoService {
List<OrderVO> getListByMemberIdAndOrderStatus(String memberId, List<String> orderStatusList, LocalDateTime dateTime);
void updateElecAmount();
/**
* 结算订单退款和用户余额退款调这个方法
*/
@@ -222,4 +215,11 @@ public interface IOrderBasicInfoService {
List<OrderBasicInfo> getAppointmentOrder(LocalDateTime dateTime);
Map<String, Object> generateOrderByCard(GenerateOrderDTO dto);
/**
* 联联平台 获取累计数据用
* @param dto
* @return
*/
List<AccumulativeInfoVO> getAccumulativeInfoForLianLian(QueryStationInfoDTO dto);
}

View File

@@ -132,4 +132,6 @@ public interface IPileConnectorInfoService {
List<ConnectorInfoVO> getConnectorListForLianLian(Long stationId);
List<ConnectorInfoVO> selectConnectorInfoList(String pileSn);
PageResponse selectStationConnectorList(QueryConnectorListDTO dto);
}

View File

@@ -0,0 +1,63 @@
package com.jsowell.pile.service;
import java.util.List;
import com.jsowell.pile.domain.PileStationWhitelist;
/**
* 站点白名单Service接口
*
* @author jsowell
* @date 2023-04-19
*/
public interface IPileStationWhitelistService {
/**
* 查询站点白名单
*
* @param id 站点白名单主键
* @return 站点白名单
*/
public PileStationWhitelist selectPileStationWhitelistById(Long id);
/**
* 查询站点白名单列表
*
* @param pileStationWhitelist 站点白名单
* @return 站点白名单集合
*/
public List<PileStationWhitelist> selectPileStationWhitelistList(PileStationWhitelist pileStationWhitelist);
/**
* 新增站点白名单
*
* @param pileStationWhitelist 站点白名单
* @return 结果
*/
public int insertPileStationWhitelist(PileStationWhitelist pileStationWhitelist);
/**
* 修改站点白名单
*
* @param pileStationWhitelist 站点白名单
* @return 结果
*/
public int updatePileStationWhitelist(PileStationWhitelist pileStationWhitelist);
/**
* 批量删除站点白名单
*
* @param ids 需要删除的站点白名单主键集合
* @return 结果
*/
public int deletePileStationWhitelistByIds(Long[] ids);
/**
* 删除站点白名单信息
*
* @param id 站点白名单主键
* @return 结果
*/
public int deletePileStationWhitelistById(Long id);
PileStationWhitelist queryWhitelistByMemberId(String stationId, String memberId);
}

View File

@@ -3,6 +3,8 @@ package com.jsowell.pile.service.impl;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.jsowell.common.constant.CacheConstants;
@@ -35,11 +37,7 @@ import com.jsowell.pile.domain.PileAuthCard;
import com.jsowell.pile.domain.PileBasicInfo;
import com.jsowell.pile.domain.WxpayCallbackRecord;
import com.jsowell.pile.domain.WxpayRefundCallback;
import com.jsowell.pile.dto.GenerateOrderDTO;
import com.jsowell.pile.dto.IndexQueryDTO;
import com.jsowell.pile.dto.QueryOrderDTO;
import com.jsowell.pile.dto.QueryPersonPileDTO;
import com.jsowell.pile.dto.RefundableWxPayOrderData;
import com.jsowell.pile.dto.*;
import com.jsowell.pile.mapper.OrderBasicInfoMapper;
import com.jsowell.pile.service.IMemberBasicInfoService;
import com.jsowell.pile.service.IOrderAbnormalRecordService;
@@ -55,6 +53,7 @@ import com.jsowell.pile.service.WxpayRefundCallbackService;
import com.jsowell.pile.transaction.dto.OrderTransactionDTO;
import com.jsowell.pile.transaction.service.TransactionService;
import com.jsowell.pile.vo.base.PileInfoVO;
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
import com.jsowell.pile.vo.uniapp.MemberVO;
import com.jsowell.pile.vo.uniapp.OrderVO;
import com.jsowell.pile.vo.uniapp.PersonPileConnectorSumInfoVO;
@@ -145,17 +144,6 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
@Autowired
private IPileAuthCardService pileAuthCardService;
/**
* 查询订单
*
* @param id 订单主键
* @return 订单
*/
@Override
public OrderBasicInfo selectOrderBasicInfoById(Long id) {
return orderBasicInfoMapper.selectOrderBasicInfoById(id);
}
/**
* 条件查询订单基本信息
*
@@ -608,9 +596,8 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
// 更新订单详情
try {
// 总电费金额,总服务费金额
// 总电费金额
BigDecimal totalElectricityAmount = BigDecimal.ZERO;
BigDecimal totalServiceAmount = BigDecimal.ZERO;
// 尖时段用电量
String sharpUsedElectricity = data.getSharpUsedElectricity();
@@ -697,6 +684,83 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
}
}
@Override
public void updateElecAmount() {
// 查询 elecAmount为空的订单数据
int pageNum = 1;
int pageSize = 500;
int total = 0;
int batch = 1;
while (true) {
// 分页处理
PageHelper.startPage(pageNum, pageSize);
List<OrderDetail> list = orderBasicInfoMapper.queryElecAmountNullList();
PageInfo<OrderDetail> pageInfo = new PageInfo<>(list);
if (CollectionUtils.isEmpty(pageInfo.getList())) {
break;
}
// 计算电量总金额
List<OrderDetail> orderDetailList = calculateData(pageInfo.getList());
// 更新数据库
int i = orderBasicInfoMapper.batchUpdateOrderDetail(orderDetailList);
total += i;
logger.info("updateElecAmount==第{}批次更新完成", batch);
batch += 1;
}
logger.info("updateElecAmount==共更新{}条数据", total);
}
// 计算数据
private List<OrderDetail> calculateData(List<OrderDetail> list) {
for (OrderDetail orderDetail : list) {
try {
// 总电费金额
BigDecimal totalElectricityAmount = BigDecimal.ZERO;
// 尖时段用电量
BigDecimal sharpUsedElectricity = orderDetail.getSharpUsedElectricity();
if (sharpUsedElectricity != null) {
// 计算该时段电费
BigDecimal multiply = orderDetail.getSharpElectricityPrice().multiply(sharpUsedElectricity).setScale(2,BigDecimal.ROUND_DOWN);
totalElectricityAmount = totalElectricityAmount.add(multiply);
}
// 峰时段用电量
BigDecimal peakUsedElectricity = orderDetail.getPeakUsedElectricity();
if (peakUsedElectricity != null) {
// 计算该时段电费
BigDecimal multiply = orderDetail.getPeakElectricityPrice().multiply(peakUsedElectricity).setScale(2,BigDecimal.ROUND_DOWN);
totalElectricityAmount = totalElectricityAmount.add(multiply);
}
// 平时段用电量
BigDecimal flatUsedElectricity = orderDetail.getFlatUsedElectricity();
if (flatUsedElectricity != null) {
// 计算该时段电费
BigDecimal multiply = orderDetail.getFlatElectricityPrice().multiply(flatUsedElectricity).setScale(2,BigDecimal.ROUND_DOWN);
totalElectricityAmount = totalElectricityAmount.add(multiply);
}
// 谷时段用电量
BigDecimal valleyUsedElectricity = orderDetail.getValleyUsedElectricity();
if (valleyUsedElectricity != null) {
// 计算该时段电费
BigDecimal multiply = orderDetail.getValleyElectricityPrice().multiply(valleyUsedElectricity).setScale(2,BigDecimal.ROUND_DOWN);
totalElectricityAmount = totalElectricityAmount.add(multiply);
}
orderDetail.setTotalElectricityAmount(totalElectricityAmount);
orderDetail.setTotalServiceAmount(orderDetail.getTotalOrderAmount().subtract(totalElectricityAmount));
}catch (Exception e) {
logger.info("发生异常", e);
}
}
return list;
}
/**
* 余额支付 计算需要退回的金额
*
@@ -1327,4 +1391,14 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
resultMap.put("accountBalance", totalAccountAmount);
return resultMap;
}
/**
* 联联平台 获取累计数据用
* @param dto
* @return
*/
@Override
public List<AccumulativeInfoVO> getAccumulativeInfoForLianLian(QueryStationInfoDTO dto) {
return orderBasicInfoMapper.getAccumulativeInfoForLianLian(dto);
}
}

View File

@@ -361,6 +361,16 @@ public class PileConnectorInfoServiceImpl implements IPileConnectorInfoService {
PageInfo<PileConnectorInfoVO> pageInfo = new PageInfo<>(pileConnectorInfoList);
// 查询枪口当前订单
for (PileConnectorInfoVO pileConnectorInfoVO : pageInfo.getList()) {
String pileConnectorCode = pileConnectorInfoVO.getPileConnectorCode();
pileConnectorInfoVO.setConnectorQrCodeUrl(getPileConnectorQrCodeUrl(pileConnectorCode)); // 枪口号二维码
OrderBasicInfo order = orderBasicInfoService.queryChargingByPileConnectorCode(pileConnectorCode);
if (order != null) {
pileConnectorInfoVO.setOrderCode(order.getOrderCode());
}
}
queryRealTimeData(pageInfo.getList());
// 返回结果集
@@ -423,6 +433,12 @@ public class PileConnectorInfoServiceImpl implements IPileConnectorInfoService {
return connectorInfoList;
}
@Override
public PageResponse selectStationConnectorList(QueryConnectorListDTO dto) {
PageResponse response = getUniAppConnectorInfoListByParams(dto);
return response;
}
/**
* 查询充电枪口的实时数据
*/
@@ -447,8 +463,8 @@ public class PileConnectorInfoServiceImpl implements IPileConnectorInfoService {
pileConnectorInfoVO.setChargingAmount(new BigDecimal(realTimeMonitorData.getChargingAmount()));
pileConnectorInfoVO.setChargingDegree(new BigDecimal(realTimeMonitorData.getChargingDegree()));
pileConnectorInfoVO.setGunLineTemperature(realTimeMonitorData.getGunLineTemperature()); // 枪线温度
pileConnectorInfoVO.setTimeRemaining(realTimeMonitorData.getTimeRemaining());
pileConnectorInfoVO.setChargingTime(realTimeMonitorData.getSumChargingTime());
pileConnectorInfoVO.setTimeRemaining(realTimeMonitorData.getTimeRemaining()); // 剩余时间
pileConnectorInfoVO.setChargingTime(realTimeMonitorData.getSumChargingTime()); // 已充时长
// 计算实时功率单位kw
BigDecimal instantPowerTemp = outputVoltage.multiply(outputCurrent);
BigDecimal instantPower = instantPowerTemp.divide(new BigDecimal(1000));

View File

@@ -361,6 +361,7 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
stationVO.setFastFree(fastFree);
stationVO.setSlowTotal(slowTotal);
stationVO.setSlowFree(slowFree);
stationVO.setTotalFree(fastFree + slowFree);
// 查询当前时段电费
CurrentTimePriceDetails currentTimePriceDetails = pileBillingTemplateService.getCurrentTimePriceDetails(stationVO.getStationId());

View File

@@ -0,0 +1,112 @@
package com.jsowell.pile.service.impl;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.MemberBasicInfo;
import com.jsowell.pile.domain.PileStationWhitelist;
import com.jsowell.pile.mapper.PileStationWhitelistMapper;
import com.jsowell.pile.service.IMemberBasicInfoService;
import com.jsowell.pile.service.IPileStationWhitelistService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 站点白名单Service业务层处理
*
* @author jsowell
* @date 2023-04-19
*/
@Service
public class PileStationWhitelistServiceImpl implements IPileStationWhitelistService {
@Autowired
private PileStationWhitelistMapper pileStationWhitelistMapper;
@Autowired
private IMemberBasicInfoService memberBasicInfoService;
/**
* 查询站点白名单
*
* @param id 站点白名单主键
* @return 站点白名单
*/
@Override
public PileStationWhitelist selectPileStationWhitelistById(Long id) {
return pileStationWhitelistMapper.selectPileStationWhitelistById(id);
}
/**
* 查询站点白名单列表
*
* @param pileStationWhitelist 站点白名单
* @return 站点白名单
*/
@Override
public List<PileStationWhitelist> selectPileStationWhitelistList(PileStationWhitelist pileStationWhitelist) {
return pileStationWhitelistMapper.selectPileStationWhitelistList(pileStationWhitelist);
}
/**
* 新增站点白名单
*
* @param pileStationWhitelist 站点白名单
* @return 结果
*/
@Override
public int insertPileStationWhitelist(PileStationWhitelist pileStationWhitelist) {
// pileStationWhitelist.setCreateTime(DateUtils.getNowDate());
if (StringUtils.isBlank(pileStationWhitelist.getMobileNumber())) {
return 0;
}
MemberBasicInfo info = memberBasicInfoService.selectInfoByMobileNumber(pileStationWhitelist.getMobileNumber());
if (info == null) {
return 0;
}
pileStationWhitelist.setMemberId(info.getMemberId());
return pileStationWhitelistMapper.insertPileStationWhitelist(pileStationWhitelist);
}
/**
* 修改站点白名单
*
* @param pileStationWhitelist 站点白名单
* @return 结果
*/
@Override
public int updatePileStationWhitelist(PileStationWhitelist pileStationWhitelist) {
pileStationWhitelist.setUpdateTime(DateUtils.getNowDate());
return pileStationWhitelistMapper.updatePileStationWhitelist(pileStationWhitelist);
}
/**
* 批量删除站点白名单
*
* @param ids 需要删除的站点白名单主键
* @return 结果
*/
@Override
public int deletePileStationWhitelistByIds(Long[] ids) {
return pileStationWhitelistMapper.deletePileStationWhitelistByIds(ids);
}
/**
* 删除站点白名单信息
*
* @param id 站点白名单主键
* @return 结果
*/
@Override
public int deletePileStationWhitelistById(Long id) {
return pileStationWhitelistMapper.deletePileStationWhitelistById(id);
}
@Override
public PileStationWhitelist queryWhitelistByMemberId(String stationId, String memberId) {
if (StringUtils.isBlank(stationId) || StringUtils.isBlank(memberId)) {
return null;
}
return pileStationWhitelistMapper.queryWhitelistByMemberId(stationId, memberId);
}
}

View File

@@ -50,6 +50,7 @@ public class TransactionService {
@Autowired
private MemberWalletInfoMapper memberWalletInfoMapper;
@Autowired
private IOrderBasicInfoService orderBasicInfoService;
@Autowired
@@ -160,7 +161,11 @@ public class TransactionService {
orderBasicInfoMapper.updateOrderDetail(dto.getOrderDetail());
}
// 清缓存
orderBasicInfoService.cleanCacheByOrderCode(orderCode, transactionCode);
try {
orderBasicInfoService.cleanCacheByOrderCode(orderCode, transactionCode);
} catch (Exception e) {
log.error("清缓存异常", e);
}
}
/**

View File

@@ -75,6 +75,11 @@ public class StationInfoVO {
*/
private int slowFree;
/**
* 总空闲枪口数
*/
private int totalFree;
/**
* 经度
*/

View File

@@ -0,0 +1,48 @@
package com.jsowell.pile.vo.lianlian;
import lombok.Data;
/**
* 对接联联平台 获取累计数据
*
* @author JS-ZZA
* @date 2023/4/17 14:06
*/
@Data
public class AccumulativeInfoVO {
/**
* 订单编号
*/
private String orderCode;
/**
* 枪口编号
*/
private String pileConnectorCode;
/**
* 桩编码
*/
private String pileSn;
/**
* 站点id
*/
private String stationId;
/**
* 开始时间
*/
private String startTime;
/**
* 结束时间
*/
private String endTime;
/**
* 枪口充电量
*/
private String connectorElectricity;
}

View File

@@ -58,6 +58,11 @@ public class UniAppOrderVO {
*/
private String payAmount;
/**
* 支付方式
*/
private String payMode;
/**
* 订单金额
*/

View File

@@ -102,6 +102,11 @@ public class PileConnectorInfoVO {
*/
private String chargingTime;
/**
* 剩余时间
*/
private String timeRemaining;
/**
* 电压
*/
@@ -152,8 +157,4 @@ public class PileConnectorInfoVO {
*/
private String ratedPower;
/**
* 剩余时间
*/
private String timeRemaining;
}

View File

@@ -922,4 +922,56 @@
#{orderCode,jdbcType=VARCHAR}
</foreach>
</select>
<select id="getAccumulativeInfoForLianLian" resultType="com.jsowell.pile.vo.lianlian.AccumulativeInfoVO">
SELECT
t1.order_code as orderCode,
t1.pile_connector_code as pileConnectorCode,
t1.pile_sn as pileSn,
t1.station_id as stationId,
IFNULL(t2.total_used_electricity,0.00) as connectorElectricity
FROM
order_basic_info t1
JOIN order_detail t2 ON t1.order_code = t2.order_code
WHERE
t1.del_flag = '0'
AND t1.station_id = #{stationID,jdbcType=VARCHAR}
AND t1.create_time <![CDATA[ >= ]]> #{startTime,jdbcType=VARCHAR}
AND t1.create_time <![CDATA[ <= ]]> #{endTime,jdbcType=VARCHAR}
</select>
<select id="queryElecAmountNullList" resultMap="OrderDetailResult">
select
<include refid="Detail_Base_Column_List"/>
from order_detail
where del_flag = '0'
and total_order_amount is not null
AND total_order_amount > '0.00'
and total_electricity_amount is null
</select>
<update id="batchUpdateOrderDetail">
update order_detail
<trim prefix="set" suffixOverrides=",">
<trim prefix="total_electricity_amount =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.totalElectricityAmount!=null">
when id=#{item.id} then #{item.totalElectricityAmount}
</if>
</foreach>
</trim>
<trim prefix="total_service_amount =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.totalServiceAmount!=null">
when id=#{item.id} then #{item.totalServiceAmount}
</if>
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="i" index="index" >
id=#{i.id}
</foreach>
</update>
</mapper>

View File

@@ -0,0 +1,103 @@
<?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.jsowell.pile.mapper.PileStationWhitelistMapper">
<resultMap type="com.jsowell.pile.domain.PileStationWhitelist" id="PileStationWhitelistResult">
<result property="id" column="id" />
<result property="stationId" column="station_id" />
<result property="memberId" column="member_id" />
<result property="mobileNumber" column="mobile_number" />
<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="delFlag" column="del_flag" />
</resultMap>
<sql id="Base_Column_List">
id, station_id, member_id, mobile_number, create_time, create_by, update_time, update_by, del_flag
</sql>
<sql id="selectPileStationWhitelistVo">
select
<include refid="Base_Column_List"/>
from pile_station_whitelist
</sql>
<select id="selectPileStationWhitelistList" parameterType="com.jsowell.pile.domain.PileStationWhitelist" resultMap="PileStationWhitelistResult">
<include refid="selectPileStationWhitelistVo"/>
<where>
<if test="stationId != null and stationId != ''"> and station_id = #{stationId}</if>
<if test="memberId != null and memberId != ''"> and member_id = #{memberId}</if>
<if test="mobileNumber != null and mobileNumber != ''"> and mobile_number = #{mobileNumber}</if>
</where>
</select>
<select id="selectPileStationWhitelistById" parameterType="Long" resultMap="PileStationWhitelistResult">
<include refid="selectPileStationWhitelistVo"/>
where id = #{id}
</select>
<insert id="insertPileStationWhitelist" parameterType="com.jsowell.pile.domain.PileStationWhitelist">
insert into pile_station_whitelist
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="stationId != null">station_id,</if>
<if test="memberId != null">member_id,</if>
<if test="mobileNumber != null">mobile_number,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="stationId != null">#{stationId},</if>
<if test="memberId != null">#{memberId},</if>
<if test="mobileNumber != null">#{mobileNumber},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updatePileStationWhitelist" parameterType="com.jsowell.pile.domain.PileStationWhitelist">
update pile_station_whitelist
<trim prefix="SET" suffixOverrides=",">
<if test="stationId != null">station_id = #{stationId},</if>
<if test="memberId != null">member_id = #{memberId},</if>
<if test="mobileNumber != null">mobile_number = #{mobileNumber},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where id = #{id}
</update>
<delete id="deletePileStationWhitelistById" parameterType="Long">
delete from pile_station_whitelist where id = #{id}
</delete>
<delete id="deletePileStationWhitelistByIds" parameterType="String">
delete from pile_station_whitelist where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="queryWhitelistByMemberId" resultMap="PileStationWhitelistResult">
select
<include refid="Base_Column_List"/>
from pile_station_whitelist
where del_flag = '0'
and member_id = #{memberId,jdbcType=VARCHAR}
and station_id = #{stationId,jdbcType=VARCHAR}
</select>
</mapper>

View File

@@ -1,6 +1,9 @@
package com.jsowell.thirdparty.domain;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.List;
@@ -12,6 +15,9 @@ import java.util.List;
* @date 2023/4/15 9:29
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class StationStatsInfo {
/**
* 充电站 ID

View File

@@ -1,7 +1,9 @@
package com.jsowell.thirdparty.service;
import com.jsowell.thirdparty.domain.StationInfo;
import com.jsowell.thirdparty.dto.QueryStationInfoDTO;
import com.jsowell.pile.dto.QueryEquipmentDTO;
import com.jsowell.thirdparty.domain.StationStatsInfo;
import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.thirdparty.vo.EquipmentAuthVO;
import com.jsowell.thirdparty.vo.LianLianPageResponse;
import java.util.List;
@@ -31,5 +33,18 @@ public interface LianLianService {
LianLianPageResponse query_station_status(List<String> StationIDs);
LianLianPageResponse query_station_stats(QueryStationInfoDTO dto);
/**
* 查询统计信息
* @param dto
* @return
*/
StationStatsInfo query_station_stats(QueryStationInfoDTO dto);
/**
* 请求设备认证
* @param dto
* @return
*/
EquipmentAuthVO query_equip_auth(QueryEquipmentDTO dto);
}

View File

@@ -2,8 +2,10 @@ package com.jsowell.thirdparty.service.impl;
import cn.hutool.core.util.PageUtil;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.PageUtils;
import com.jsowell.common.util.StringUtils;
@@ -11,13 +13,31 @@ import com.jsowell.pile.domain.OrderBasicInfo;
import com.jsowell.pile.domain.PileBasicInfo;
import com.jsowell.pile.domain.PileConnectorInfo;
import com.jsowell.pile.domain.PileStationInfo;
import com.jsowell.pile.service.*;
import com.jsowell.pile.dto.QueryEquipmentDTO;
import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.pile.service.IOrderBasicInfoService;
import com.jsowell.pile.service.IPileBasicInfoService;
import com.jsowell.pile.service.IPileConnectorInfoService;
import com.jsowell.pile.service.IPileMerchantInfoService;
import com.jsowell.pile.service.IPileModelInfoService;
import com.jsowell.pile.service.IPileStationInfoService;
import com.jsowell.pile.vo.base.ConnectorInfoVO;
import com.jsowell.pile.vo.base.MerchantInfoVO;
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
import com.jsowell.pile.vo.web.PileModelInfoVO;
import com.jsowell.thirdparty.domain.*;
import com.jsowell.thirdparty.dto.QueryStationInfoDTO;
import com.jsowell.thirdparty.domain.ConnectorChargeStatusInfo;
import com.jsowell.thirdparty.domain.ConnectorInfo;
import com.jsowell.thirdparty.domain.ConnectorStatsInfo;
import com.jsowell.thirdparty.domain.ConnectorStatusInfo;
import com.jsowell.thirdparty.domain.EquipmentInfo;
import com.jsowell.thirdparty.domain.EquipmentStatsInfo;
import com.jsowell.thirdparty.domain.OperatorInfo;
import com.jsowell.thirdparty.domain.StationInfo;
import com.jsowell.thirdparty.domain.StationStatsInfo;
import com.jsowell.thirdparty.domain.StationStatusInfo;
import com.jsowell.thirdparty.service.LianLianService;
import com.jsowell.thirdparty.vo.EquipmentAuthVO;
import com.jsowell.thirdparty.vo.LianLianPageResponse;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -26,7 +46,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Map;
import java.util.stream.Collectors;
@Service
@@ -205,14 +225,131 @@ public class LianLianServiceImpl implements LianLianService {
}
/**
* TODO 查询统计信息
* 查询统计信息
* @param dto
* @return
*/
@Override
public LianLianPageResponse query_station_stats(QueryStationInfoDTO dto) {
public StationStatsInfo query_station_stats(QueryStationInfoDTO dto) {
// 根据站点id 查出这段时间的充电量
List<AccumulativeInfoVO> list = orderBasicInfoService.getAccumulativeInfoForLianLian(dto);
if (CollectionUtils.isEmpty(list)) {
return StationStatsInfo.builder()
.StationID(dto.getStationID())
.StartTime(dto.getStartTime())
.EndTime(dto.getEndTime())
.StationElectricity(BigDecimal.ZERO)
.equipmentStatsInfos(Lists.newArrayList()) // 设备列表
.build();
}
// 根据充电桩编号分组 key=充电桩编号
Map<String, List<AccumulativeInfoVO>> pileMap = list.stream()
.collect(Collectors.groupingBy(AccumulativeInfoVO::getPileSn));
// 存放所有充电桩设备
List<EquipmentStatsInfo> equipmentStatsInfoList = Lists.newArrayList();
// 站点用电量
BigDecimal stationElectricity = BigDecimal.ZERO;
// 用于记录枪口用电量 在循环每个枪口的时候初始化
BigDecimal pileElec;
for (String pileSn : pileMap.keySet()) {
// 该充电桩下 所有枪口的用电数据
List<AccumulativeInfoVO> accumulativeInfoVOS = pileMap.get(pileSn);
if (CollectionUtils.isEmpty(accumulativeInfoVOS)) {
continue;
}
// 存放充电桩用电量
pileElec = BigDecimal.ZERO;
// key=枪口编号 value 该枪口的用电数据
Map<String, List<AccumulativeInfoVO>> collect = accumulativeInfoVOS.stream()
.collect(Collectors.groupingBy(AccumulativeInfoVO::getPileConnectorCode));
List<ConnectorStatsInfo> connectorStatsInfos = Lists.newArrayList();
for (Map.Entry<String, List<AccumulativeInfoVO>> entry : collect.entrySet()) {
String pileConnectorCode = entry.getKey();
List<AccumulativeInfoVO> value = entry.getValue();
// 枪口用电量求和
BigDecimal connectorElec = value.stream()
.map(AccumulativeInfoVO::getConnectorElectricity)
.map(BigDecimal::new)
.reduce(BigDecimal.ZERO, BigDecimal::add);
connectorStatsInfos.add(
ConnectorStatsInfo.builder()
.ConnectorID(pileConnectorCode)
.ConnectorElectricity(connectorElec)
.build()
);
// 充电桩电量为枪口用电量累计
pileElec = pileElec.add(connectorElec);
}
EquipmentStatsInfo build = EquipmentStatsInfo.builder()
.EquipmentID(pileSn)
.EquipmentElectricity(pileElec)
.ConnectorStatsInfos(connectorStatsInfos)
.build();
equipmentStatsInfoList.add(build);
// 所有充电桩用电量之和
stationElectricity = stationElectricity.add(pileElec);
}
return null;
StationStatsInfo stationStatsInfo = StationStatsInfo.builder()
.StationID(dto.getStationID())
.StartTime(dto.getStartTime())
.EndTime(dto.getEndTime())
.StationElectricity(stationElectricity)
.equipmentStatsInfos(equipmentStatsInfoList) // 设备列表
.build();
return stationStatsInfo;
}
/**
* 请求设备认证
* @param dto
* @return
*/
@Override
public EquipmentAuthVO query_equip_auth(QueryEquipmentDTO dto) {
EquipmentAuthVO vo = new EquipmentAuthVO();
String equipAuthSeq = dto.getEquipAuthSeq();
String pileConnectorCode = dto.getConnectorID();
// 通过运营商id + 枪口编码查询数据
String merchantId = StringUtils.substring(equipAuthSeq, 0, 9);
String pileSn = StringUtils.substring(pileConnectorCode, 0, 14);
// 能查到为成功
vo.setSuccStat(1); // 1-失败 0-成功
PileBasicInfo pileBasicInfo = pileBasicInfoService.selectPileBasicInfoBySN(pileSn);
if (pileBasicInfo == null) {
vo.setFailReason(2); // 设备检测失败
vo.setFailReasonMsg("未查到该桩的数据");
throw new BusinessException("", "");
}
if (pileBasicInfo.getMerchantId() == Long.parseLong(merchantId)) {
vo.setSuccStat(0);
// 查询当前数据
PileConnectorInfoVO connectorInfo = pileConnectorInfoService.getPileConnectorInfoByConnectorCode(pileConnectorCode);
if (StringUtils.equals(PileConnectorDataBaseStatusEnum.OCCUPIED_NOT_CHARGED.getValue(), String.valueOf(connectorInfo.getStatus()))
|| StringUtils.equals(PileConnectorDataBaseStatusEnum.OCCUPIED_CHARGING.getValue(), String.valueOf(connectorInfo.getStatus()))
|| StringUtils.equals(PileConnectorDataBaseStatusEnum.OCCUPIED_APPOINTMENT_LOCK.getValue(), String.valueOf(connectorInfo.getStatus()))
) {
vo.setFailReason(0);
} else {
vo.setFailReason(1); // 1- 此设备尚未插枪;
}
vo.setFailReasonMsg("");
}
vo.setEquipAuthSeq(equipAuthSeq);
vo.setConnectorID(pileConnectorCode);
return vo;
}
/**

View File

@@ -0,0 +1,52 @@
package com.jsowell.thirdparty.vo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 请求设备认证VO
*
* @author JS-ZZA
* @date 2023/4/19 9:57
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class EquipmentAuthVO {
/**
* 设备认证流水号
* 格式“运营商 ID+yyyyMMddHHmmss+4 位随机数”
*/
private String EquipAuthSeq;
/**
* 充电设备接口编码
*/
private String ConnectorID;
/**
* 成功状态
* 0:成功;
* 1:失败
*/
private int SuccStat;
/**
* 失败原因
* 0:无;
* 1:此设备尚未插枪;
* 2:设备检测失败:
* 399:自定义
*/
private int FailReason;
/**
* 失败原因描述
* 如果设备认证失败则必传,描述力求简单明了,用户一看即懂
*/
private String FailReasonMsg;
}

View File

@@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询站点白名单列表
export function listWhitelist(query) {
return request({
url: '/pile/whitelist/list',
method: 'get',
params: query
})
}
// 查询站点白名单详细
export function getWhitelist(id) {
return request({
url: '/pile/whitelist/' + id,
method: 'get'
})
}
// 新增站点白名单
export function addWhitelist(data) {
return request({
url: '/pile/whitelist',
method: 'post',
data: data
})
}
// 修改站点白名单
export function updateWhitelist(data) {
return request({
url: '/pile/whitelist',
method: 'put',
data: data
})
}
// 删除站点白名单
export function delWhitelist(id) {
return request({
url: '/pile/whitelist/' + id,
method: 'delete'
})
}

View File

@@ -7,6 +7,7 @@
v-model="inputObject.userInput"
placeholder="请输入你要查找的关键词"
type="text"
@keyup.enter.native="send"
></el-input>
<el-button style="width: 85px" type="primary" @click="send"
>搜索
@@ -16,17 +17,31 @@
<div id="container"></div>
</div>
<div class="img">
<el-input
placeholder="请选择图片"
style="width: 50%"
type="file"
@change="onFileChange"
ref="iptRef"
></el-input
>
<el-button style="width: 85px">上传图片</el-button>
</div>
<div>上传图片</div>
<el-upload
action="https://jsonplaceholder.typicode.com/posts/"
list-type="picture-card"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
>
<!-- :headers="headers"-->
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
<!-- <div class="img">-->
<!-- <el-input-->
<!-- placeholder="请选择图片"-->
<!-- style="width: 50%"-->
<!-- type="file"-->
<!-- @change="onFileChange"-->
<!-- ref="iptRef"-->
<!-- ></el-input-->
<!-- >-->
<!--&lt;!&ndash; <el-button style="width: 85px">上传图片</el-button>&ndash;&gt;-->
<!-- </div>-->
</div>
</template>
@@ -41,6 +56,11 @@ window._AMapSecurityConfig = {
export default {
data() {
return {
dialogImageUrl: '',
dialogVisible: false,
// headers:{
// Authorization:this.$store.state.user.token
// },
map: null,
autoOptions: {
input: "",
@@ -58,6 +78,14 @@ export default {
};
},
methods: {
handleRemove(file, fileList) {
console.log(file, fileList);
},
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
console.log(this.dialogImageUrl)
this.dialogVisible = true;
},
// 点击搜索按钮
send() {
this.searchPlaceInput = this.inputObject.userInput;
@@ -160,6 +188,7 @@ export default {
});
},
onFileChange(e) {
console.log(e,'上传图片')
// 1.获取用户选择的文件列表
const fileList = e.target.files;
console.log(fileList);

View File

@@ -1,176 +0,0 @@
<template>
<div style="width: 85%; height: 500px">
<div>
<el-input
style="width: 60%"
v-model="inputObject.userInput"
placeholder="请输入你要查找的关键词"
type="text"
></el-input>
<el-button type="primary" @click="send">搜索</el-button>
</div>
<div id="container"></div>
</div>
</template>
<script>
import AMapLoader from "@amap/amap-jsapi-loader";
import { getStation } from "@/api/pile/station.js";
import bus from "@/bus/bus";
window._AMapSecurityConfig = {
securityJsCode: "829b6b73f84682c2eb982eaa47a745b8",
};
export default {
data() {
return {
map: null,
autoOptions: {
input: "",
},
inputObject: {
userInput: "",
// inputId: "searchInput",
lnglat: "",
},
searchPlaceInput: "",
auto: null,
placeSearch: "",
stationId: this.$route.params.id,
};
},
methods: {
// 点击搜索按钮
send() {
this.searchPlaceInput = this.inputObject.userInput;
console.log("搜索值", this.searchPlaceInput);
// 向表单 site-info传值
bus.$emit("inp", this.searchPlaceInput);
},
queryStationInfo() {
getStation(this.stationId).then((response) => {
this.lat = response.data.stationLat;
this.lng = response.data.stationLng;
console.log(this.lat, this.lng);
this.initMap(this.lat, this.lng);
});
},
initMap(lat, lng) {
// console.log(lat, lng);
AMapLoader.load({
key: "61436c9c789d301a5b73853d176710cf", // 申请好的Web端开发者Key首次调用 load 时必填
version: "1.4.15", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
plugins: ["AMap.AutoComplete", "AMap.PlaceSearch", "AMap.Geocoder"], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
})
.then((AMap) => {
this.map = new AMap.Map("container", {
//设置地图容器id
viewMode: "3D", //是否为3D地图模式
zoom: 5, //初始化地图级别
center: [+lng, +lat], //初始化地图中心点位置
});
// this.map.addControl(new AMap.Geolocation());
// console.log("map", this.map);
// 设置鼠标的样式
this.map.setDefaultCursor("pointer");
// 点标记
let marker = new AMap.Marker({
position: new AMap.LngLat(+lng, +lat),
});
// 将创建的点标记添加到已有的地图实例
this.map.add(marker);
AMap.plugin("AMap.AutoComplete", function () {
auto = new AMap.AutoComplete(this.autoOptions);
//构造地点查询类
auto.on("select", this.select);
});
this.placeSearch = new AMap.PlaceSearch({
map: this.map,
});
// 逆向地理编码 -> 要正向地理编码
this.map.on("click", (e) => {
let lat = e.lnglat.lat;
let lng = e.lnglat.lng;
this.getLngLatService(lat, lng);
let lnglat = [lng, lat];
console.log("经纬度", lnglat);
bus.$emit("lnglat", lnglat);
});
})
.catch((e) => {
console.log(e);
});
},
select(e) {
this.placeSearch.search(e.poi.name); //关键字查询查询
},
//逆向地理编码服务
getLngLatService(lat, lng) {
let pos = [lng, lat];
let lnglat = new AMap.LngLat(lng, lat);
let geocoder = new AMap.Geocoder({
// city 指定进行编码查询的城市支持传入城市名、adcode 和 citycode
city: "全国",
});
//1.点击地图任意位置生成一个marker
// let marker = new AMap.Marker({
// position: new AMap.LngLat(lng, lat),
// });
// this.map.add(marker);
let address = "";
//2.将位置转化为坐标点-->地理信息
//3.根据地理信息(地址)进行搜索获取详细信息!
geocoder.getAddress(lnglat, (status, result) => {
if (status === "complete" && result.regeocode) {
address = result.regeocode.formattedAddress;
// let res = {
// pos: pos,
// address: address,
// };
console.log("res", lnglat.lng, lnglat.lat, address);
//需求:固定的窗体信息进行展示!
} else {
log.error("根据经纬度查询地址失败");
}
});
},
},
mounted() {
//DOM初始化完成进行地图初始化
this.queryStationInfo();
},
created() {
this.send();
},
watch: {
searchPlaceInput(newValue) {
if (newValue != null) {
console.log(newValue);
this.placeSearch.search(newValue);
this.map.setZoom(16, true, 1);
}
},
},
};
</script>
<style lang="scss">
#container {
padding: 0px;
margin: 0px;
width: 100%;
height: 90%;
}
// #search_container {
// height: 50%;
// width: 50%;
// display: flex;
// justify-content: baseline;
// align-items: center;
// #searchBtn {
// height: 100%;
// width: 65px;
// }
// }
</style>

View File

@@ -65,8 +65,7 @@
size="mini"
@click="clickImport"
v-has-permi = "['pile:station:edit']"
>导入</el-button
>
>导入</el-button>
</el-col>
<!--<el-col :span="1.5">
<el-button

View File

@@ -44,22 +44,24 @@
<el-button icon="el-icon-setting" size="big" @click="handleCreate" v-has-permi = "['pile:station:edit']">配置参数</el-button>
</el-form-item>
</el-form>
</el-tab-pane>
<el-dialog :title="dialogTitle" :visible.sync="dialogFormVisible">
<el-tab-pane label="站点白名单" name="whitelist">
<whitelist ref="whitelist" :stationId="stationId"/>
</el-tab-pane>
</el-tabs>
<el-dialog :title="dialogTitle" :visible.sync="dialogFormVisible">
<el-form ref="form" :model="form" @submit.native.prevent>
<el-form-item label="二维码前缀:" prop="prefix" label-width="100px">
<el-input v-model="form.prefix" placeholder="请输入二维码前缀" style="width: 300px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer" align="center">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</el-tabs>
<div slot="footer" class="dialog-footer" align="center">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
@@ -70,16 +72,20 @@ import connectorList from "./connectorList.vue";
import pileList from "./pileList.vue";
import MapContainer from "../../../components/MapContainer/MapContainer.vue";
import stationOrderList from "@/views/pile/station/stationOrderList";
import {updatePlateNumber} from "@/api/member/info";
import stationWhiteList from "@/views/pile/station/stationWhiteList";
import {getStationInfo, updateStationQRCodePrefix} from "@/api/pile/station";
import Whitelist from "@/views/pile/station/stationWhiteList";
export default {
components: {
Whitelist,
SiteInfo,
pileList,
connectorList,
Billing,
MapContainer,
stationOrderList
stationOrderList,
stationWhiteList
},
data() {
return {

View File

@@ -0,0 +1,276 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="手机号" prop="mobileNumber">
<el-input
v-model="queryParams.mobileNumber"
placeholder="请输入手机号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="会员id" prop="memberId">
<el-input
v-model="queryParams.memberId"
placeholder="请输入会员id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<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-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['pile:whitelist:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['pile:whitelist:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['pile:whitelist:remove']"
>删除</el-button>
</el-col>
<!--<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['pile:whitelist:export']"
>导出</el-button>
</el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="whitelistList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!--<el-table-column label="主键" align="center" prop="id" />-->
<!--<el-table-column label="站点id" align="center" prop="stationId" />-->
<el-table-column label="会员id" align="center" prop="memberId" />
<el-table-column label="手机号" align="center" prop="mobileNumber" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['pile:whitelist:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['pile:whitelist:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改站点白名单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<!--<el-form-item label="站点id" prop="stationId">
<el-input v-model="form.stationId" placeholder="请输入站点id" />
</el-form-item>-->
<!--<el-form-item label="会员id" prop="memberId">
<el-input v-model="form.memberId" placeholder="请输入会员id" />
</el-form-item>-->
<el-form-item label="手机号" prop="mobileNumber">
<el-input v-model="form.mobileNumber" placeholder="请输入手机号" />
</el-form-item>
<!--<el-form-item label="删除标识" prop="delFlag">
<el-input v-model="form.delFlag" placeholder="请输入删除标识" />
</el-form-item>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listWhitelist, getWhitelist, delWhitelist, addWhitelist, updateWhitelist } from "@/api/pile/whitelist";
export default {
name: "Whitelist",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 站点白名单表格数据
whitelistList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
stationId: this.$route.params.id,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
stationId: null,
memberId: null,
mobileNumber: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询站点白名单列表 */
getList() {
this.loading = true;
this.queryParams.stationId = this.stationId;
listWhitelist(this.queryParams).then(response => {
this.whitelistList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
stationId: null,
memberId: null,
mobileNumber: null,
createTime: null,
createBy: null,
updateTime: null,
updateBy: null,
delFlag: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加站点白名单";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getWhitelist(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改站点白名单";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateWhitelist(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
this.form.stationId = this.stationId;
addWhitelist(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除站点白名单编号为"' + ids + '"的数据项?').then(function() {
return delWhitelist(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('pile/whitelist/export', {
...this.queryParams
}, `whitelist_${new Date().getTime()}.xlsx`)
}
}
};
</script>