增加全局生成二维码图片接口,使其可以直接生成指定场站下的所有终端的二维码图片
修改留言板,平台查看用户信息接口为post方式
This commit is contained in:
parent
09dc299e67
commit
dd0a478356
@ -136,8 +136,8 @@ public class XhpcChargingPileController extends BaseController {
|
|||||||
* @date 2022/2/17 10:14
|
* @date 2022/2/17 10:14
|
||||||
* @since version-1.0
|
* @since version-1.0
|
||||||
*/
|
*/
|
||||||
@PostMapping("/all/qr-code")
|
@GetMapping("/all/qr-code")
|
||||||
public AjaxResult generateQrCode(@RequestParam Long chargingStationId, @RequestParam Long pileId) {
|
public AjaxResult generateQrCode(@RequestParam Long chargingStationId, @RequestParam(required = false) Long pileId) {
|
||||||
|
|
||||||
return xhpcChargingPileService.generateQrCode(chargingStationId, pileId);
|
return xhpcChargingPileService.generateQrCode(chargingStationId, pileId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,6 +37,9 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.ArrayBlockingQueue;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static com.aliyun.oss.internal.OSSConstants.URL_ENCODING;
|
import static com.aliyun.oss.internal.OSSConstants.URL_ENCODING;
|
||||||
|
|
||||||
@ -230,7 +233,7 @@ public class XhpcChargingPileServiceImpl extends BaseService implements IXhpcCha
|
|||||||
Long chargingStationId = xhpcChargingPile.getChargingStationId();
|
Long chargingStationId = xhpcChargingPile.getChargingStationId();
|
||||||
if (xhpcChargingPile.getGunNumber() > 0) {
|
if (xhpcChargingPile.getGunNumber() > 0) {
|
||||||
// 删除阿里云上面之前可能存在的桩图片文件夹
|
// 删除阿里云上面之前可能存在的桩图片文件夹
|
||||||
clearRepetition(environment, serialNumber);
|
// clearRepetition(environment, serialNumber);
|
||||||
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, xhpcChargingPile.getConnectorType());
|
addXhpcTerminal(xhpcChargingPile.getName(), chargingStationId, rateModelId, serialNumber, chargingPileId, i, number + 1, xhpcChargingPile.getConnectorType());
|
||||||
}
|
}
|
||||||
@ -438,6 +441,7 @@ public class XhpcChargingPileServiceImpl extends BaseService implements IXhpcCha
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public AjaxResult generateQrCode(Long chargingStationId, Long pileId) {
|
public AjaxResult generateQrCode(Long chargingStationId, Long pileId) {
|
||||||
//get tenant id
|
//get tenant id
|
||||||
LoginUser loginUser = tokenService.getLoginUser();
|
LoginUser loginUser = tokenService.getLoginUser();
|
||||||
@ -445,6 +449,9 @@ public class XhpcChargingPileServiceImpl extends BaseService implements IXhpcCha
|
|||||||
String tenantId = sysUser.getTenantId();
|
String tenantId = sysUser.getTenantId();
|
||||||
//query effective pile
|
//query effective pile
|
||||||
List<XhpcChargingPile> xhpcChargingPile = xhpcChargingPileMapper.selectXhpcChargingPilesBy(chargingStationId, pileId, tenantId);
|
List<XhpcChargingPile> xhpcChargingPile = xhpcChargingPileMapper.selectXhpcChargingPilesBy(chargingStationId, pileId, tenantId);
|
||||||
|
if (xhpcChargingPile.isEmpty()) {
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
ArrayList<Long> pileIds = new ArrayList<>();
|
ArrayList<Long> pileIds = new ArrayList<>();
|
||||||
for (XhpcChargingPile chargingPile : xhpcChargingPile) {
|
for (XhpcChargingPile chargingPile : xhpcChargingPile) {
|
||||||
Long chargingPileId = chargingPile.getChargingPileId();
|
Long chargingPileId = chargingPile.getChargingPileId();
|
||||||
@ -463,17 +470,17 @@ public class XhpcChargingPileServiceImpl extends BaseService implements IXhpcCha
|
|||||||
//delete old qrcode img url data in the database
|
//delete old qrcode img url data in the database
|
||||||
List<XhpcImg> xhpcImgList = xhpcImgMapper.selectByTerminalId(terminalIds);
|
List<XhpcImg> xhpcImgList = xhpcImgMapper.selectByTerminalId(terminalIds);
|
||||||
for (XhpcImg xhpcImg : xhpcImgList) {
|
for (XhpcImg xhpcImg : xhpcImgList) {
|
||||||
|
//阿里云冗余二维码图片清理代码
|
||||||
|
//String prefix = null;
|
||||||
|
//clearRepetition(environment, prefix);
|
||||||
xhpcImgMapper.updateDelFlagByTerminalId(xhpcImg.getTerminalId());
|
xhpcImgMapper.updateDelFlagByTerminalId(xhpcImg.getTerminalId());
|
||||||
}
|
}
|
||||||
//开启多个线程,并行执行操作
|
//开启多个线程,并行执行操作
|
||||||
|
|
||||||
|
|
||||||
//删除阿里云上面之前可能存在的桩图片文件夹
|
|
||||||
//拼接桩路径,直接删除该桩下所有二维码
|
|
||||||
String prefix = null;
|
|
||||||
clearRepetition(environment, prefix);
|
|
||||||
//generate qrcode for every terminal
|
//generate qrcode for every terminal
|
||||||
|
ThreadPoolExecutor executor =
|
||||||
|
new ThreadPoolExecutor(5, 20, 200, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(5));
|
||||||
for (XhpcTerminal xhpcTerminal : xhpcTerminalList) {
|
for (XhpcTerminal xhpcTerminal : xhpcTerminalList) {
|
||||||
|
executor.execute(() -> {
|
||||||
//获取场站名称:
|
//获取场站名称:
|
||||||
String chargingStationName = xhpcChargingStationService.selectXhpcChargingStationById(xhpcTerminal.getChargingStationId()).getName();
|
String chargingStationName = xhpcChargingStationService.selectXhpcChargingStationById(xhpcTerminal.getChargingStationId()).getName();
|
||||||
//解析桩号和枪号
|
//解析桩号和枪号
|
||||||
@ -482,27 +489,21 @@ public class XhpcChargingPileServiceImpl extends BaseService implements IXhpcCha
|
|||||||
String pileNumberStr = pileAndGunNumberStr.substring(0, 2);
|
String pileNumberStr = pileAndGunNumberStr.substring(0, 2);
|
||||||
String gunNumberStr = pileAndGunNumberStr.substring(2, 4);
|
String gunNumberStr = pileAndGunNumberStr.substring(2, 4);
|
||||||
int gunNumber = Integer.parseInt(gunNumberStr);
|
int gunNumber = Integer.parseInt(gunNumberStr);
|
||||||
|
Integer pileNumber = Integer.parseInt(pileNumberStr);
|
||||||
//生成最终的完整图片,并上传
|
//生成最终的完整图片,并上传
|
||||||
/**
|
/**
|
||||||
* * @param xhpcTerminal 终端实体类 ok
|
* * @param xhpcTerminal 终端实体类
|
||||||
* * @param serialNumber 终端序列号 ok
|
* * @param serialNumber 终端序列号
|
||||||
* * @param environment nacos对象 ok
|
* * @param environment nacos对象
|
||||||
* * @param xhpcImgMapper xhpc_img表对象 ok
|
* * @param xhpcImgMapper xhpc_img表对象
|
||||||
* * @param chargingStationName 场站名称 ok
|
* * @param chargingStationName 场站名称
|
||||||
* * @param forIndex 枪号,用于拿出letterMap中的字母
|
* * @param forIndex 枪号,用于拿出letterMap中的字母
|
||||||
* * @param letterMap 字母集合
|
* * @param letterMap 字母集合
|
||||||
* * @param name 桩号(桩名称)
|
* * @param name 桩号(桩名称)
|
||||||
*/
|
*/
|
||||||
QrImgUtils.uploadImg(xhpcTerminal, xhpcTerminal.getSerialNumber(), environment, xhpcImgMapper, chargingStationName, gunNumber, letterMap, pileNumberStr);
|
QrImgUtils.uploadImg(xhpcTerminal, xhpcTerminal.getSerialNumber(), environment, xhpcImgMapper, chargingStationName, gunNumber, letterMap, pileNumber.toString());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
|
|
||||||
String str1 = "01";
|
|
||||||
Long figure = Long.valueOf(str1);
|
|
||||||
System.out.println(figure);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,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}
|
||||||
|
|
||||||
|
|
||||||
#二维码Logo图片获取位置:
|
#二维码Logo图片获取位置:
|
||||||
#imgPath: "D:\\Enterprise_Resources\\XiaoHuaMaterialImgs\\xhcd_logo.png"
|
#imgPath: "D:\\Enterprise_Resources\\XiaoHuaMaterialImgs\\xhcd_logo.png"
|
||||||
#imgPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/logo.png"
|
#imgPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/logo.png"
|
||||||
|
|||||||
@ -27,30 +27,21 @@
|
|||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="selectByTerminalId" resultType="com.xhpc.charging.station.pojo.XhpcImg">
|
<select id="selectByTerminalId" resultType="com.xhpc.charging.station.pojo.XhpcImg">
|
||||||
terminal_id
|
select
|
||||||
charging_pile_id
|
img_id id,
|
||||||
charging_station_id
|
url url,
|
||||||
name
|
status status,
|
||||||
serial_number
|
del_flag delFlag,
|
||||||
pile_serial_number
|
create_time createTime,
|
||||||
gun_status
|
create_by createBy,
|
||||||
work_status
|
update_time updateTime,
|
||||||
status
|
update_by updateBy,
|
||||||
del_flag
|
remark remark,
|
||||||
create_time
|
terminal_id terminalId
|
||||||
create_by
|
|
||||||
update_time
|
|
||||||
update_by
|
|
||||||
remark
|
|
||||||
rate_model_id
|
|
||||||
operator_id_evcs
|
|
||||||
number
|
|
||||||
connector_type
|
|
||||||
search_value
|
|
||||||
del_falg
|
|
||||||
tenant_id
|
|
||||||
from xhpc_img
|
from xhpc_img
|
||||||
where terminal_id in
|
where
|
||||||
|
del_flag = 0
|
||||||
|
and terminal_id in
|
||||||
<foreach collection="list" separator="," item="terminalId" open="(" close=")">
|
<foreach collection="list" separator="," item="terminalId" open="(" close=")">
|
||||||
#{terminalId}
|
#{terminalId}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|||||||
@ -80,8 +80,8 @@ public class XhpcMessageBoardController {
|
|||||||
* @date 2022/1/15 18:47
|
* @date 2022/1/15 18:47
|
||||||
* @since version-1.0
|
* @since version-1.0
|
||||||
*/
|
*/
|
||||||
@GetMapping("/user/message")
|
@PostMapping("/user/message")
|
||||||
public AjaxResult platformQueryMessage(UserQueryCondition userQueryCondition) {
|
public AjaxResult platformQueryMessage(@RequestBody UserQueryCondition userQueryCondition) {
|
||||||
|
|
||||||
QueryUserMassageResponse queryUserMassageResponse = xhpcMessageBoardService.platformQueryMessage(userQueryCondition);
|
QueryUserMassageResponse queryUserMassageResponse = xhpcMessageBoardService.platformQueryMessage(userQueryCondition);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user