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