mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-13 06:20:07 +08:00
新增 站点管理配置下发二维码地址
This commit is contained in:
@@ -16,11 +16,10 @@ import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.SecurityUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.id.SnUtils;
|
||||
import com.jsowell.netty.command.ykc.IssueQRCodeCommand;
|
||||
import com.jsowell.netty.service.yunkuaichong.YKCPushCommandService;
|
||||
import com.jsowell.pile.domain.*;
|
||||
import com.jsowell.pile.dto.BatchCreatePileDTO;
|
||||
import com.jsowell.pile.dto.MemberRegisterAndLoginDTO;
|
||||
import com.jsowell.pile.dto.PileMemberBindingDTO;
|
||||
import com.jsowell.pile.dto.QueryPersonPileDTO;
|
||||
import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.transaction.dto.PileTransactionDTO;
|
||||
import com.jsowell.pile.transaction.service.TransactionService;
|
||||
@@ -28,6 +27,7 @@ import com.jsowell.pile.vo.base.ConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
import com.jsowell.pile.vo.base.PileInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.*;
|
||||
import com.jsowell.pile.vo.web.PileDetailVO;
|
||||
import com.jsowell.pile.vo.web.PileStationVO;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
@@ -80,6 +80,9 @@ public class PileService {
|
||||
@Autowired
|
||||
private IOrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
@Autowired
|
||||
private YKCPushCommandService ykcPushCommandService;
|
||||
|
||||
/**
|
||||
* 查询设备信息
|
||||
*
|
||||
@@ -458,4 +461,44 @@ public class PileService {
|
||||
resultMap.put("sumUsedElectricity", String.valueOf(sumUsedElectricity));
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 后管调用,给站点下所有桩下发二维码
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
public int updateStationQRCodePrefix(QueryStationDTO dto) {
|
||||
String stationId = dto.getStationId();
|
||||
if (StringUtils.isBlank(stationId) || StringUtils.isBlank(dto.getQrcodePrefix())) {
|
||||
return 0;
|
||||
}
|
||||
// 通过站点id查询数据
|
||||
PileStationVO stationInfo = pileStationInfoService.getStationInfo(stationId);
|
||||
if (stationInfo == null) {
|
||||
return 0;
|
||||
}
|
||||
// 修改站点列表的 qrcodePrefix 字段
|
||||
PileStationInfo info = new PileStationInfo();
|
||||
info.setId(Long.parseLong(stationId));
|
||||
info.setQrcodePrefix(dto.getQrcodePrefix());
|
||||
int i = pileStationInfoService.updatePileStationInfo(info);
|
||||
if (i == 0) {
|
||||
return 0;
|
||||
}
|
||||
// 查出这个站点下的所有桩
|
||||
List<PileDetailVO> pileDetailVOS = pileBasicInfoService.selectPileListByStationIds(Lists.newArrayList(Long.parseLong(stationId)));
|
||||
List<String> pileSnList = pileDetailVOS.stream()
|
||||
.map(PileDetailVO::getPileSn)
|
||||
.collect(Collectors.toList());
|
||||
IssueQRCodeCommand command;
|
||||
for (String pileSn : pileSnList) {
|
||||
// 给桩下发二维码
|
||||
command = new IssueQRCodeCommand();
|
||||
command.setPileSn(pileSn);
|
||||
command.setQrcodePrefix(dto.getQrcodePrefix());
|
||||
ykcPushCommandService.pushIssueQRCodeCommand(command);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.jsowell.pile.dto.FastCreateStationDTO;
|
||||
import com.jsowell.pile.dto.QueryStationDTO;
|
||||
import com.jsowell.pile.service.IPileStationInfoService;
|
||||
import com.jsowell.pile.vo.web.PileStationVO;
|
||||
import com.jsowell.service.PileService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -32,6 +33,9 @@ public class PileStationInfoController extends BaseController {
|
||||
@Autowired
|
||||
private IPileStationInfoService pileStationInfoService;
|
||||
|
||||
@Autowired
|
||||
private PileService pileService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询充电站信息列表NEW
|
||||
@@ -145,4 +149,15 @@ public class PileStationInfoController extends BaseController {
|
||||
public AjaxResult selectStationListByMerchantId(@RequestBody QueryStationDTO dto) {
|
||||
return AjaxResult.success(pileStationInfoService.selectStationListByMerchantId(Long.valueOf(dto.getMerchantId())));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改站点二维码前缀
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:edit')")
|
||||
@PostMapping("/updateStationQRCodePrefix")
|
||||
public AjaxResult updateStationQRCodePrefix(@RequestBody QueryStationDTO dto) {
|
||||
return AjaxResult.success(pileService.updateStationQRCodePrefix(dto));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,5 +10,7 @@ import lombok.NoArgsConstructor;
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class IssueQRCodeCommand {
|
||||
String pileSn;
|
||||
private String pileSn;
|
||||
|
||||
private String qrcodePrefix;
|
||||
}
|
||||
|
||||
@@ -230,7 +230,12 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
||||
// 二维码前缀 如:“www.baidu.com?No=”
|
||||
// String qrCodePrefix = "https://wx.charging.shbochong.cn/prepare_charge?code=";
|
||||
// String qrCodePrefix = pileBasicInfoService.getPileQrCodeUrl(null);
|
||||
String qrCodePrefix = pileConnectorInfoService.getPileConnectorQrCodeUrl(null);
|
||||
String qrCodePrefix = "";
|
||||
if (StringUtils.isBlank(command.getQrcodePrefix())) {
|
||||
qrCodePrefix = pileConnectorInfoService.getPileConnectorQrCodeUrl(null);
|
||||
}else {
|
||||
qrCodePrefix = command.getQrcodePrefix();
|
||||
}
|
||||
byte[] qrCodePrefixByteArr = BytesUtil.str2Asc(qrCodePrefix);
|
||||
|
||||
// 二维码前缀长度 二维码前缀长度长度最大不超过200 字节
|
||||
|
||||
@@ -38,6 +38,11 @@ public class PileStationInfo extends BaseEntity {
|
||||
|
||||
private String deptId;
|
||||
|
||||
/**
|
||||
* 二维码前缀
|
||||
*/
|
||||
private String qrcodePrefix;
|
||||
|
||||
/**
|
||||
* 是否独立报桩(0-否;1-是)
|
||||
*/
|
||||
|
||||
@@ -17,6 +17,8 @@ import lombok.NoArgsConstructor;
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class QueryStationDTO extends BaseEntity {
|
||||
private String stationId;
|
||||
|
||||
/**
|
||||
* 站点名称
|
||||
*/
|
||||
@@ -61,4 +63,9 @@ public class QueryStationDTO extends BaseEntity {
|
||||
* 是否对外开放(0-否;1-是)
|
||||
*/
|
||||
private String publicFlag;
|
||||
|
||||
/**
|
||||
* 站点二维码前缀
|
||||
*/
|
||||
private String qrcodePrefix;
|
||||
}
|
||||
|
||||
@@ -92,6 +92,9 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
|
||||
vo.setId(pileStationInfo.getId().toString());
|
||||
vo.setAreaCode(pileStationInfo.getAreaCode());
|
||||
vo.setAddress(pileStationInfo.getAddress());
|
||||
if (StringUtils.isNotBlank(pileStationInfo.getQrcodePrefix())) {
|
||||
vo.setQrcodePrefix(pileStationInfo.getQrcodePrefix());
|
||||
}
|
||||
vo.setMerchantId(pileStationInfo.getMerchantId().toString());
|
||||
// vo.setMerchantName(pileStationInfo.getmer());
|
||||
vo.setMerchantAdminName(pileStationInfo.getStationAdminName());
|
||||
|
||||
@@ -44,6 +44,11 @@ public class PileStationVO {
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 二维码前缀
|
||||
*/
|
||||
private String qrcodePrefix;
|
||||
|
||||
/**
|
||||
* 充电设备数量
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<result property="merchantId" column="merchant_id" />
|
||||
<result property="stationName" column="station_name" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="qrcodePrefix" column="qrcode_prefix" />
|
||||
<result property="aloneApply" column="alone_apply" />
|
||||
<result property="accountNumber" column="account_number" />
|
||||
<result property="capacity" column="capacity" />
|
||||
@@ -56,7 +57,7 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPileStationInfoVo">
|
||||
select id,merchant_id, station_name, dept_id, alone_apply, account_number, capacity, public_parking, parking_number,
|
||||
select id,merchant_id, station_name, dept_id, qrcode_prefix, alone_apply, account_number, capacity, public_parking, parking_number,
|
||||
country_code, area_code, address, station_tel, service_tel, station_type, station_status, station_admin_name, park_nums,
|
||||
station_lng, station_lat, site_guide, construction, pictures, match_cars, park_info, park_owner,
|
||||
park_manager, open_all_day, business_hours, park_free, payment, support_order, remark, public_flag,
|
||||
@@ -71,6 +72,7 @@
|
||||
<if test="merchantId != null and merchantId != ''"> and merchant_id = #{merchantId}</if>
|
||||
<if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
|
||||
<if test="deptId != null and deptId != ''"> and dept_id = #{deptId}</if>
|
||||
<if test="qrcodePrefix != null and qrcodePrefix != ''"> and qrcode_prefix = #{qrcodePrefix}</if>
|
||||
<if test="aloneApply != null and aloneApply != ''"> and alone_apply = #{aloneApply}</if>
|
||||
<if test="accountNumber != null and accountNumber != ''"> and account_number = #{accountNumber}</if>
|
||||
<if test="capacity != null "> and capacity = #{capacity}</if>
|
||||
@@ -125,6 +127,7 @@
|
||||
<if test="merchantId != null">merchant_id,</if>
|
||||
<if test="stationName != null">station_name,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
<if test="qrcodePrefix != null">qrcode_prefix,</if>
|
||||
<if test="aloneApply != null">alone_apply,</if>
|
||||
<if test="accountNumber != null">account_number,</if>
|
||||
<if test="capacity != null">capacity,</if>
|
||||
@@ -175,6 +178,7 @@
|
||||
<if test="merchantId != null">#{merchantId},</if>
|
||||
<if test="stationName != null">#{stationName},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
<if test="qrcodePrefix != null">#{qrcodePrefix},</if>
|
||||
<if test="aloneApply != null">#{aloneApply},</if>
|
||||
<if test="accountNumber != null">#{accountNumber},</if>
|
||||
<if test="capacity != null">#{capacity},</if>
|
||||
@@ -228,6 +232,7 @@
|
||||
<if test="merchantId != null">merchant_id = #{merchantId},</if>
|
||||
<if test="stationName != null">station_name = #{stationName},</if>
|
||||
<if test="deptId != null">dept_id = #{deptId},</if>
|
||||
<if test="qrcodePrefix != null">qrcode_prefix = #{qrcodePrefix},</if>
|
||||
<if test="aloneApply != null">alone_apply = #{aloneApply},</if>
|
||||
<if test="accountNumber != null">account_number = #{accountNumber},</if>
|
||||
<if test="capacity != null">capacity = #{capacity},</if>
|
||||
@@ -290,6 +295,7 @@
|
||||
count(t2.id) as pileNum,
|
||||
t1.area_code as areaCode,
|
||||
t1.address as address,
|
||||
t1.qrcode_prefix as qrcodePrefix,
|
||||
t1.station_type as stationType,
|
||||
t1.station_status as stationStatus,
|
||||
t1.create_time as createTime,
|
||||
|
||||
@@ -72,3 +72,12 @@ export function fastCreateStation(data) {
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 下发二维码
|
||||
export function updateStationQRCodePrefix(data) {
|
||||
return request({
|
||||
url: "/pile/station/updateStationQRCodePrefix",
|
||||
method: "post",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -36,8 +36,20 @@
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="运营管理" name="operation">
|
||||
|
||||
<el-button icon="el-icon-setting" size="big" @click="handleCreate">配置参数</el-button>
|
||||
</el-tab-pane>
|
||||
|
||||
<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>
|
||||
</template>
|
||||
@@ -49,6 +61,8 @@ 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 {updateStationQRCodePrefix} from "@/api/pile/station";
|
||||
export default {
|
||||
components: {
|
||||
SiteInfo,
|
||||
@@ -61,6 +75,12 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
activeName: 'pile',
|
||||
form: {
|
||||
prefix: '',
|
||||
},
|
||||
dialogTitle: '',
|
||||
qrcodePrefix: '',
|
||||
dialogFormVisible: false,
|
||||
stationId: this.$route.params.id,
|
||||
stationName: this.$route.params.stationName,
|
||||
};
|
||||
@@ -81,7 +101,6 @@ export default {
|
||||
// console.log(tab, event);
|
||||
this.initializeData(tab.name);
|
||||
},
|
||||
|
||||
// 执行对应页面的查询数据方法
|
||||
initializeData(name) {
|
||||
console.log("执行对应页面的查询数据方法", name)
|
||||
@@ -97,6 +116,37 @@ export default {
|
||||
} else if (name === "order") {
|
||||
this.$refs.order.dataLoading();
|
||||
}
|
||||
},
|
||||
// 配置参数按钮
|
||||
handleCreate() {
|
||||
this.dialogTitle = '配置参数';
|
||||
this.form = {
|
||||
prefix: '',
|
||||
};
|
||||
this.dialogFormVisible = true;
|
||||
},
|
||||
// 配置参数提交按钮
|
||||
submitForm(form) {
|
||||
const param = {
|
||||
stationId: this.stationId,
|
||||
qrcodePrefix: this.form.prefix
|
||||
}
|
||||
console.log("form:", this.form);
|
||||
console.log("param:", param);
|
||||
this.$refs.form.validate((valid) => {
|
||||
if(valid){
|
||||
updateStationQRCodePrefix(param).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功')
|
||||
this.dialogFormVisible = false
|
||||
})
|
||||
} else{
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.dialogFormVisible = false
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user