优化生成二维码,生成桩代码
This commit is contained in:
parent
0a3d6802bc
commit
53c1af51d2
@ -1,13 +1,10 @@
|
|||||||
package com.xhpc.charging.station.controller;
|
package com.xhpc.charging.station.controller;
|
||||||
|
|
||||||
import com.xhpc.charging.station.pojo.XhpcImg;
|
import com.xhpc.charging.station.service.IXhpcChargingPileService;
|
||||||
import com.xhpc.common.core.web.controller.BaseController;
|
import com.xhpc.common.core.web.controller.BaseController;
|
||||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||||
import com.xhpc.charging.station.service.IXhpcChargingPileService;
|
|
||||||
import com.xhpc.common.domain.XhpcChargingPile;
|
import com.xhpc.common.domain.XhpcChargingPile;
|
||||||
import com.xhpc.common.domain.XhpcTerminal;
|
|
||||||
import org.apache.poi.hssf.record.DVALRecord;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -33,7 +30,6 @@ public class XhpcChargingPileController extends BaseController {
|
|||||||
* @param name 桩名称
|
* @param name 桩名称
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
//@PreAuthorize(hasPermi = "system:station:list")
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(String name, Integer type, String serialNumber, Long chargingStationId) {
|
public TableDataInfo list(String name, Integer type, String serialNumber, Long chargingStationId) {
|
||||||
|
|
||||||
|
|||||||
@ -88,4 +88,11 @@ public interface XhpcChargingPileMapper {
|
|||||||
*/
|
*/
|
||||||
int updateXhpcTerminal(@Param("chargingPileId") Long chargingPileId);
|
int updateXhpcTerminal(@Param("chargingPileId") Long chargingPileId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计改场站的终端
|
||||||
|
* @param chargingStationId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int countXhpcTerminal(@Param("chargingStationId") Long chargingStationId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package com.xhpc.charging.station.mapper;
|
package com.xhpc.charging.station.mapper;
|
||||||
|
|
||||||
import com.xhpc.charging.station.pojo.XhpcImg;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
package com.xhpc.charging.station.service;
|
package com.xhpc.charging.station.service;
|
||||||
|
|
||||||
import com.xhpc.charging.station.pojo.XhpcImg;
|
|
||||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
import com.xhpc.common.domain.XhpcChargingPile;
|
import com.xhpc.common.domain.XhpcChargingPile;
|
||||||
import com.xhpc.common.domain.XhpcTerminal;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package com.xhpc.charging.station.service;
|
package com.xhpc.charging.station.service;
|
||||||
|
|
||||||
import com.alibaba.druid.sql.visitor.functions.Char;
|
|
||||||
import com.xhpc.charging.station.mapper.XhpcChargingPileMapper;
|
import com.xhpc.charging.station.mapper.XhpcChargingPileMapper;
|
||||||
import com.xhpc.charging.station.mapper.XhpcChargingStationMapper;
|
import com.xhpc.charging.station.mapper.XhpcChargingStationMapper;
|
||||||
import com.xhpc.charging.station.mapper.XhpcImgMapper;
|
import com.xhpc.charging.station.mapper.XhpcImgMapper;
|
||||||
@ -32,14 +31,12 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private PowerPileService powerPileService;
|
private PowerPileService powerPileService;
|
||||||
|
|
||||||
//上传图片全局变量
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private Environment environment;
|
private Environment environment;
|
||||||
//上传图片Mapper
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private XhpcImgMapper xhpcImgMapper;
|
private XhpcImgMapper xhpcImgMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
XhpcChargingStationMapper xhpcChargingStationMapper;
|
private XhpcChargingStationMapper xhpcChargingStationMapper;
|
||||||
|
|
||||||
//字母集合
|
//字母集合
|
||||||
private static Map letterMap;
|
private static Map letterMap;
|
||||||
@ -75,7 +72,9 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService {
|
|||||||
if(xhpcChargingPile.getGunNumber() ==null || xhpcChargingPile.getGunNumber()>26){
|
if(xhpcChargingPile.getGunNumber() ==null || xhpcChargingPile.getGunNumber()>26){
|
||||||
return AjaxResult.error("终端数量不能大于26");
|
return AjaxResult.error("终端数量不能大于26");
|
||||||
}
|
}
|
||||||
|
if(xhpcChargingPile.getSerialNumber() ==null || xhpcChargingPile.getSerialNumber().length()!=14){
|
||||||
|
return AjaxResult.error("桩编号14");
|
||||||
|
}
|
||||||
Long chargingStationId = xhpcChargingPile.getChargingStationId();
|
Long chargingStationId = xhpcChargingPile.getChargingStationId();
|
||||||
//获取计费模型id
|
//获取计费模型id
|
||||||
Map<String, Object> stringObjectMap = xhpcChargingPileMapper.selectXhpcChargingStationById(chargingStationId);
|
Map<String, Object> stringObjectMap = xhpcChargingPileMapper.selectXhpcChargingStationById(chargingStationId);
|
||||||
@ -93,17 +92,34 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService {
|
|||||||
Long chargingPileId = xhpcChargingPile.getChargingPileId();
|
Long chargingPileId = xhpcChargingPile.getChargingPileId();
|
||||||
|
|
||||||
if (xhpcChargingPile.getGunNumber() > 0) {
|
if (xhpcChargingPile.getGunNumber() > 0) {
|
||||||
|
int number = xhpcChargingPileMapper.countXhpcTerminal(chargingStationId);
|
||||||
for (int i = 1; i <= xhpcChargingPile.getGunNumber(); i++) {
|
for (int i = 1; i <= xhpcChargingPile.getGunNumber(); i++) {
|
||||||
|
addXhpcTerminal(xhpcChargingPile.getName(), chargingStationId, rateModelId, serialNumber, chargingPileId, i,number+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//插入redis 桩的编号
|
||||||
|
HashSet<String> noSet = new HashSet<>();
|
||||||
|
noSet.add(serialNumber);
|
||||||
|
powerPileService.addPileWhitelist(chargingStationId, noSet);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addXhpcTerminal(String name, Long chargingStationId, Long rateModelId, String serialNumber, Long chargingPileId, int i, int number) {
|
||||||
|
|
||||||
XhpcTerminal xhpcTerminal = new XhpcTerminal();
|
XhpcTerminal xhpcTerminal = new XhpcTerminal();
|
||||||
xhpcTerminal.setChargingStationId(chargingStationId);
|
xhpcTerminal.setChargingStationId(chargingStationId);
|
||||||
xhpcTerminal.setChargingPileId(chargingPileId);
|
xhpcTerminal.setChargingPileId(chargingPileId);
|
||||||
xhpcTerminal.setName(xhpcChargingPile.getName() + "-" + (i));
|
xhpcTerminal.setName(name + "-" + (i));
|
||||||
|
if(i>9){
|
||||||
|
xhpcTerminal.setSerialNumber(serialNumber + i);
|
||||||
|
}else{
|
||||||
xhpcTerminal.setSerialNumber(serialNumber + "0" + i);
|
xhpcTerminal.setSerialNumber(serialNumber + "0" + i);
|
||||||
|
}
|
||||||
xhpcTerminal.setPileSerialNumber(serialNumber);
|
xhpcTerminal.setPileSerialNumber(serialNumber);
|
||||||
xhpcTerminal.setWorkStatus(2);
|
xhpcTerminal.setWorkStatus(2);
|
||||||
xhpcTerminal.setStatus(0);
|
xhpcTerminal.setStatus(0);
|
||||||
xhpcTerminal.setRateModelId(rateModelId);
|
xhpcTerminal.setRateModelId(rateModelId);
|
||||||
xhpcTerminal.setNumber(99);
|
xhpcTerminal.setNumber(number);
|
||||||
xhpcTerminalMapper.addXhpcTerminal(xhpcTerminal);
|
xhpcTerminalMapper.addXhpcTerminal(xhpcTerminal);
|
||||||
|
|
||||||
//获取场站名称:
|
//获取场站名称:
|
||||||
@ -112,16 +128,9 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService {
|
|||||||
QrImgUtils.uploadImg(xhpcTerminal, xhpcTerminal.getSerialNumber(),environment,xhpcImgMapper,chargingStationName,i,letterMap);
|
QrImgUtils.uploadImg(xhpcTerminal, xhpcTerminal.getSerialNumber(),environment,xhpcImgMapper,chargingStationName,i,letterMap);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//插入redis 桩的编号
|
|
||||||
// HashSet<String> noSet = new HashSet<>();
|
|
||||||
// noSet.add(serialNumber);
|
|
||||||
// powerPileService.addPileWhitelist(chargingStationId, noSet);
|
|
||||||
return AjaxResult.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public AjaxResult updateXhpcChargingPile(XhpcChargingPile xhpcChargingPile) {
|
public AjaxResult updateXhpcChargingPile(XhpcChargingPile xhpcChargingPile) {
|
||||||
|
|
||||||
Long chargingPileId = xhpcChargingPile.getChargingPileId();
|
Long chargingPileId = xhpcChargingPile.getChargingPileId();
|
||||||
@ -139,33 +148,19 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService {
|
|||||||
if (!xhpcChargingPile.getGunNumber().equals(xhpc.getGunNumber())) {
|
if (!xhpcChargingPile.getGunNumber().equals(xhpc.getGunNumber())) {
|
||||||
//删除之前的终端
|
//删除之前的终端
|
||||||
xhpcChargingPileMapper.updateXhpcTerminal(chargingPileId);
|
xhpcChargingPileMapper.updateXhpcTerminal(chargingPileId);
|
||||||
|
int number = xhpcChargingPileMapper.countXhpcTerminal(xhpcChargingPile.getChargingStationId());
|
||||||
String serialNumber = xhpcChargingPile.getSerialNumber();
|
String serialNumber = xhpcChargingPile.getSerialNumber();
|
||||||
Long rateModelId = xhpcChargingPile.getRateModelId();
|
Long rateModelId = xhpcChargingPile.getRateModelId();
|
||||||
Long chargingStationId = xhpcChargingPile.getChargingStationId();
|
Long chargingStationId = xhpcChargingPile.getChargingStationId();
|
||||||
if (xhpcChargingPile.getGunNumber() > 0) {
|
if (xhpcChargingPile.getGunNumber() > 0) {
|
||||||
for (int i = 1; i <= xhpcChargingPile.getGunNumber(); i++) {
|
for (int i = 1; i <= xhpcChargingPile.getGunNumber(); i++) {
|
||||||
XhpcTerminal xhpcTerminal = new XhpcTerminal();
|
addXhpcTerminal(xhpcChargingPile.getName(), chargingStationId, rateModelId, serialNumber, chargingPileId, i,number+1);
|
||||||
xhpcTerminal.setChargingStationId(chargingStationId);
|
|
||||||
xhpcTerminal.setChargingPileId(chargingPileId);
|
|
||||||
xhpcTerminal.setName(serialNumber + "-" + (i));
|
|
||||||
String num = serialNumber + "0" + i;
|
|
||||||
xhpcTerminal.setSerialNumber(num);
|
|
||||||
xhpcTerminal.setPileSerialNumber(serialNumber);
|
|
||||||
xhpcTerminal.setWorkStatus(2);
|
|
||||||
xhpcTerminal.setStatus(0);
|
|
||||||
xhpcTerminal.setRateModelId(rateModelId);
|
|
||||||
xhpcTerminalMapper.addXhpcTerminal(xhpcTerminal);
|
|
||||||
// //生成二维码图片,并上传
|
|
||||||
// QrImgUtils.uploadImg(xhpcTerminal,num,environment,xhpcImgMapper);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//插入redis 桩的编号
|
//插入redis 桩的编号
|
||||||
// HashSet<String> noSet = new HashSet<>();
|
HashSet<String> noSet = new HashSet<>();
|
||||||
// noSet.add(serialNumber);
|
noSet.add(serialNumber);
|
||||||
// powerPileService.addPileWhitelist(chargingStationId, noSet);
|
powerPileService.addPileWhitelist(chargingStationId, noSet);
|
||||||
}
|
}
|
||||||
xhpcChargingPileMapper.updaeXhpcChargingPile(xhpcChargingPile);
|
xhpcChargingPileMapper.updaeXhpcChargingPile(xhpcChargingPile);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
@ -185,8 +180,8 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public AjaxResult updateStatus(Long chargingPileId, Integer status) {
|
public AjaxResult updateStatus(Long chargingPileId, Integer status) {
|
||||||
|
|
||||||
XhpcChargingPile xhpc = xhpcChargingPileMapper.selectXhpcChargingPileById(chargingPileId);
|
XhpcChargingPile xhpc = xhpcChargingPileMapper.selectXhpcChargingPileById(chargingPileId);
|
||||||
xhpc.setStatus(status);
|
xhpc.setStatus(status);
|
||||||
xhpcChargingPileMapper.updaeXhpcChargingPile(xhpc);
|
xhpcChargingPileMapper.updaeXhpcChargingPile(xhpc);
|
||||||
@ -194,6 +189,7 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int updateXhpcChargingPileById(Long chargingPileId) {
|
public int updateXhpcChargingPileById(Long chargingPileId) {
|
||||||
|
|
||||||
XhpcChargingPile xhpc = xhpcChargingPileMapper.selectXhpcChargingPileById(chargingPileId);
|
XhpcChargingPile xhpc = xhpcChargingPileMapper.selectXhpcChargingPileById(chargingPileId);
|
||||||
|
|||||||
@ -712,6 +712,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public AjaxResult updateXhpcRateTime(XhpcChargingStationDto xhpcChargingStationDto) {
|
public AjaxResult updateXhpcRateTime(XhpcChargingStationDto xhpcChargingStationDto) {
|
||||||
//电站id不能为空
|
//电站id不能为空
|
||||||
if (xhpcChargingStationDto.getChargingStationId() == null) {
|
if (xhpcChargingStationDto.getChargingStationId() == null) {
|
||||||
|
|||||||
@ -354,4 +354,7 @@
|
|||||||
where charging_pile_id = #{chargingPileId}
|
where charging_pile_id = #{chargingPileId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<select id="countXhpcTerminal" resultType="int">
|
||||||
|
select count(id) from xhpc_charging_pile where charging_station_id = #{chargingStationId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
INSERT INTO xhpc_img(url,terminal_id) VALUES(#{imgUrl},#{terminalId})
|
INSERT INTO xhpc_img(url,terminal_id) VALUES(#{imgUrl},#{terminalId})
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<select id="selectImgUrlByTerminal_id" parameterType="int" resultType="map">
|
<select id="selectImgUrlByTerminal_id" resultType="map">
|
||||||
SELECT url,terminal_id as terminalId
|
SELECT url,terminal_id as terminalId
|
||||||
FROM xhpc_img
|
FROM xhpc_img
|
||||||
where 1=1
|
where 1=1
|
||||||
|
|||||||
@ -177,7 +177,10 @@
|
|||||||
remark,
|
remark,
|
||||||
</if>
|
</if>
|
||||||
<if test="null != rateModelId">
|
<if test="null != rateModelId">
|
||||||
rate_model_id
|
rate_model_id,
|
||||||
|
</if>
|
||||||
|
<if test="null != number">
|
||||||
|
number
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
@ -224,7 +227,10 @@
|
|||||||
#{remark},
|
#{remark},
|
||||||
</if>
|
</if>
|
||||||
<if test="null != rateModelId">
|
<if test="null != rateModelId">
|
||||||
#{rateModelId}
|
#{rateModelId},
|
||||||
|
</if>
|
||||||
|
<if test="null != number">
|
||||||
|
#{number}
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|||||||
@ -1,12 +1,5 @@
|
|||||||
package com.xhpc.test;
|
package com.xhpc.test;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import com.aliyun.oss.OSSClient;
|
|
||||||
import com.xhpc.charging.station.utils.QRCodeUtil;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.core.env.Environment;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|||||||
@ -380,4 +380,45 @@ public class CacheOrderData extends BaseData {
|
|||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
|
||||||
|
return "CacheOrderData{" +
|
||||||
|
"orderNo='" + orderNo + '\'' +
|
||||||
|
", pileNo='" + pileNo + '\'' +
|
||||||
|
", gunId='" + gunId + '\'' +
|
||||||
|
", startTime='" + startTime + '\'' +
|
||||||
|
", endTime='" + endTime + '\'' +
|
||||||
|
", t1Price=" + t1Price +
|
||||||
|
", t1PowerQuantity=" + t1PowerQuantity +
|
||||||
|
", t1LossQuantity=" + t1LossQuantity +
|
||||||
|
", t1Cost=" + t1Cost +
|
||||||
|
", t2Price=" + t2Price +
|
||||||
|
", t2PowerQuantity=" + t2PowerQuantity +
|
||||||
|
", t2LossQuantity=" + t2LossQuantity +
|
||||||
|
", t2Cost=" + t2Cost +
|
||||||
|
", t3Price=" + t3Price +
|
||||||
|
", t3PowerQuantity=" + t3PowerQuantity +
|
||||||
|
", t3LossQuantity=" + t3LossQuantity +
|
||||||
|
", t3Cost=" + t3Cost +
|
||||||
|
", t4Price=" + t4Price +
|
||||||
|
", t4PowerQuantity=" + t4PowerQuantity +
|
||||||
|
", t4LossQuantity=" + t4LossQuantity +
|
||||||
|
", t4Cost=" + t4Cost +
|
||||||
|
", electricMeterStart=" + electricMeterStart +
|
||||||
|
", electricMeterEnd=" + electricMeterEnd +
|
||||||
|
", totalPowerQuantity=" + totalPowerQuantity +
|
||||||
|
", totalLossPowerQuantity=" + totalLossPowerQuantity +
|
||||||
|
", cost=" + cost +
|
||||||
|
", vinNormal='" + vinNormal + '\'' +
|
||||||
|
", transactionFlag='" + transactionFlag + '\'' +
|
||||||
|
", transactionDatetime='" + transactionDatetime + '\'' +
|
||||||
|
", stopReason='" + stopReason + '\'' +
|
||||||
|
", cardNo='" + cardNo + '\'' +
|
||||||
|
", startSoc=" + startSoc +
|
||||||
|
", endSoc=" + endSoc +
|
||||||
|
", status=" + status +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,17 @@
|
|||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<!-- SpringCloud Alibaba Nacos -->
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import com.xhpc.common.core.web.page.TableDataInfo;
|
|||||||
import com.xhpc.order.api.XhpcChargeOrderController;
|
import com.xhpc.order.api.XhpcChargeOrderController;
|
||||||
import com.xhpc.order.service.IXhpcStopChargingOrderService;
|
import com.xhpc.order.service.IXhpcStopChargingOrderService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@ -29,7 +30,6 @@ public class XhpcStopChargingOrderController extends BaseController {
|
|||||||
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(Long userId, Long chargingStationId, Long terminalId){
|
public TableDataInfo list(Long userId, Long chargingStationId, Long terminalId){
|
||||||
|
|
||||||
startPage();
|
startPage();
|
||||||
return getDataTable(iXhpcStopChargingOrderService.list(userId, chargingStationId, terminalId));
|
return getDataTable(iXhpcStopChargingOrderService.list(userId, chargingStationId, terminalId));
|
||||||
}
|
}
|
||||||
@ -37,10 +37,11 @@ public class XhpcStopChargingOrderController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 停止充电
|
* 停止充电
|
||||||
* @param userId
|
* @param userId
|
||||||
* @param serialNumber 终端编码
|
* @param terminalSerialNumber 终端编码
|
||||||
* @param chargingOrderId 充电id
|
* @param chargingOrderId 充电id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Scheduled(cron = "0 59 23 * * ?")
|
||||||
@GetMapping("/stopUp")
|
@GetMapping("/stopUp")
|
||||||
public AjaxResult stopUp(@RequestParam Long userId, @RequestParam String terminalSerialNumber, @RequestParam Long chargingOrderId){
|
public AjaxResult stopUp(@RequestParam Long userId, @RequestParam String terminalSerialNumber, @RequestParam Long chargingOrderId){
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUnit;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.xhpc.common.api.SmsService;
|
import com.xhpc.common.api.SmsService;
|
||||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
|
import com.xhpc.common.data.redis.CacheOrderData;
|
||||||
import com.xhpc.common.data.redis.CacheRealtimeData;
|
import com.xhpc.common.data.redis.CacheRealtimeData;
|
||||||
import com.xhpc.common.redis.service.RedisService;
|
import com.xhpc.common.redis.service.RedisService;
|
||||||
import com.xhpc.order.domain.*;
|
import com.xhpc.order.domain.*;
|
||||||
@ -473,7 +474,8 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
|
|||||||
xhpcOrderRedisRecord.setLt5alerted(cacheMap.get("lt5alerted").toString());
|
xhpcOrderRedisRecord.setLt5alerted(cacheMap.get("lt5alerted").toString());
|
||||||
}
|
}
|
||||||
if(cacheMap.get("orderData") !=null){
|
if(cacheMap.get("orderData") !=null){
|
||||||
xhpcOrderRedisRecord.setOrderData(cacheMap.get("orderData").toString());
|
CacheOrderData cacheOrderData = (CacheOrderData)cacheMap.get("orderData");
|
||||||
|
xhpcOrderRedisRecord.setOrderData(cacheOrderData.toString());
|
||||||
}
|
}
|
||||||
xhpcOrderRedisRecord.setCreateTime(date);
|
xhpcOrderRedisRecord.setCreateTime(date);
|
||||||
xhpcChargeOrderService.addXhpcOrderRedisRecord(xhpcOrderRedisRecord);
|
xhpcChargeOrderService.addXhpcOrderRedisRecord(xhpcOrderRedisRecord);
|
||||||
|
|||||||
@ -23,6 +23,6 @@ spring:
|
|||||||
# 共享配置
|
# 共享配置
|
||||||
shared-configs:
|
shared-configs:
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
#logging:
|
logging:
|
||||||
# level:
|
level:
|
||||||
# com.xhpc.order.mapper: debug
|
com.xhpc.order.mapper: debug
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
package com.xhpc.order.service;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yuyang
|
||||||
|
* @date 2021/9/14 16:42
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@SpringBootTest
|
||||||
|
public class ServiceTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IXhpcChargeOrderService xhpcChargeOrderService;
|
||||||
|
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() throws Exception {
|
||||||
|
System.out.println("+++++++++++++++++初始化+++++++++++++");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test(){
|
||||||
|
Map<String, Object> orderMessage = xhpcChargeOrderService.getPromotion();
|
||||||
|
System.out.println("orderMessage :"+orderMessage.toString());
|
||||||
|
System.out.println("111111111111111111111111");
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() throws Exception {
|
||||||
|
System.out.println("释放资源,执行当前测试类的每个测试方法后执行");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -14,7 +14,8 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|||||||
public class NormalTest {
|
public class NormalTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
XhpcMessageMapper xhpcMessageMapper;
|
private XhpcMessageMapper xhpcMessageMapper;
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test02(){
|
public void test02(){
|
||||||
@ -24,15 +25,15 @@ public class NormalTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test03(){
|
public void test03(){
|
||||||
|
|
||||||
XhpcMessage xhpcMessage = new XhpcMessage();
|
// XhpcMessage xhpcMessage = new XhpcMessage();
|
||||||
xhpcMessage.setContent("hello world");
|
// xhpcMessage.setContent("hello world");
|
||||||
int result = xhpcMessageMapper.insertItemsBy(xhpcMessage);
|
// int result = xhpcMessageMapper.insertItemsBy(xhpcMessage);
|
||||||
if(result != 0){
|
// if(result != 0){
|
||||||
System.out.println("insert successfully!!");
|
// System.out.println("insert successfully!!");
|
||||||
}else {
|
// }else {
|
||||||
System.out.println("insert failed!!");
|
// System.out.println("insert failed!!");
|
||||||
}
|
// }
|
||||||
System.out.println("latch successfully!!");
|
// System.out.println("latch successfully!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user