# Conflicts:
#	jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java
This commit is contained in:
2023-08-25 17:23:35 +08:00
5 changed files with 278 additions and 121 deletions

View File

@@ -297,7 +297,8 @@ public class PileStationInfoController extends BaseController {
logger.info("绑定停车平台 params:{}", JSON.toJSONString(dto));
RestApiResponse<?> response = null;
try {
pileStationInfoService.bindParkingPlatform(dto);
int i = pileStationInfoService.bindParkingPlatform(dto);
response = new RestApiResponse<>(i);
}catch (BusinessException e) {
logger.error("绑定停车平台 error,", e);
response = new RestApiResponse<>(e.getCode(), e.getMessage());

View File

@@ -8,7 +8,9 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.ykc.OrderStatusEnum;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.enums.ykc.YKCChargingStopReasonEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.BytesUtil;
import com.jsowell.common.util.Cp56Time2a.Cp56Time2aUtil;
import com.jsowell.common.util.DateUtils;
@@ -18,14 +20,19 @@ import com.jsowell.common.util.id.IdUtils;
import com.jsowell.netty.factory.YKCOperateFactory;
import com.jsowell.pile.domain.OrderBasicInfo;
import com.jsowell.pile.domain.ThirdPartyStationRelation;
import com.jsowell.pile.domain.ThirdpartyParkingConfig;
import com.jsowell.pile.dto.lutongyunting.BindCouponDTO;
import com.jsowell.pile.service.*;
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
import com.jsowell.pile.vo.web.PileStationVO;
import com.jsowell.thirdparty.lianlian.service.LianLianService;
import com.jsowell.thirdparty.lutongyunting.service.LTYTService;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.Objects;
@@ -74,6 +81,15 @@ public class TransactionRecordsRequestHandler extends AbstractHandler {
@Autowired
private IMemberPlateNumberRelationService memberPlateNumberRelationService;
@Autowired
private IPileStationInfoService pileStationInfoService;
@Autowired
private LTYTService ltytService;
@Autowired
private IThirdPartyParkingConfigService thirdPartyParkingConfigService;
public static void main(String[] args) {
// 获取消息体
String msg = "000000000000000000000000000000008823000000030601a08c2e0d0404170000380d0404170000000000000000000000000000000000000000000000000000000000000000400d0300ee250000ee250000c84b000000000000000000000000000000000000e0bb040000cee1040000ee250000ee250000c84b00000000000000000000000000000000000000010000380d04041745a511101970000000";
@@ -614,8 +630,8 @@ public class TransactionRecordsRequestHandler extends AbstractHandler {
log.error("结算订单发生异常", e);
}
// 联联平台 推送订单信息 notification_orderInfo
try {
// 联联平台 推送订单信息 notification_orderInfo
// 查询该站点是否推送联联平台
ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
relation.setStationId(Long.parseLong(orderBasicInfo.getStationId()));
@@ -636,5 +652,49 @@ public class TransactionRecordsRequestHandler extends AbstractHandler {
orderBasicInfoService.saveAbnormalOrder(data);
log.warn("充电桩传来的交易记录,根据交易流水号:{}查询不到订单,判定为可疑账单", transactionCode);
}
// 给车辆绑定优惠券
try {
String bindResult = bindCoupon(orderBasicInfo);
log.info("绑定优惠券 订单信息:{}, result;{}", orderBasicInfo, bindResult);
}catch (BusinessException e) {
log.error("绑定优惠券 error, code:{}, msg:{}", e.getCode(), e.getMessage());
} catch (Exception e) {
log.error("绑定优惠券 error,", e);
}
}
/**
* 绑定优惠券
* @param orderBasicInfo
* @return
* @throws UnsupportedEncodingException
*/
private String bindCoupon(OrderBasicInfo orderBasicInfo) throws UnsupportedEncodingException {
if (orderBasicInfo == null) {
return null;
}
// 如果该站点的停车场优惠券信息配置不为空,则需绑定一张优惠券
String stationId = orderBasicInfo.getStationId();
PileStationVO stationInfo = pileStationInfoService.getStationInfo(stationId);
if (StringUtils.isBlank(stationInfo.getParkingId())) {
return "该订单无需绑定优惠券";
}
ThirdpartyParkingConfig parkingInfo = thirdPartyParkingConfigService.selectByPrimaryKey(Integer.parseInt(stationInfo.getParkingId()));
if (parkingInfo == null) {
throw new BusinessException(ReturnCodeEnum.CODE_QUERY_PARKING_INFO_IS_NULL);
}
BindCouponDTO dto = BindCouponDTO.builder()
.appId(parkingInfo.getAppId())
.merchantId(parkingInfo.getParkingMerchantId())
.couponId(parkingInfo.getCouponId())
.secretKey(parkingInfo.getSecretKey())
.plateNumber(orderBasicInfo.getPlateNumber())
.plateColor(5) // 5-绿牌车
.build();
// 绑定优惠券
return ltytService.bindCoupon(dto);
}
}

View File

@@ -1,6 +1,9 @@
package com.jsowell.pile.dto.lutongyunting;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 给指定车辆绑定优惠券
@@ -9,6 +12,9 @@ import lombok.Data;
* @Date 2023/8/23 14:15
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class BindCouponDTO {
private String appId;

View File

@@ -302,6 +302,7 @@
SELECT
t1.id as id,
t1.dept_id as deptId,
t1.parking_id as parkingId,
t1.station_name as stationName,
count(t2.id) as pileNum,
t1.area_code as areaCode,

View File

@@ -2,24 +2,28 @@
<div class="app-container">
<el-tabs type="border-card" v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="订单" name="order">
<stationOrderList ref="order" :stationId="stationId"/>
<stationOrderList ref="order" :stationId="stationId" />
</el-tab-pane>
<el-tab-pane label="设备" name="pile">
<pileList ref="pile" :stationId="stationId"/>
<pileList ref="pile" :stationId="stationId" />
</el-tab-pane>
<el-tab-pane label="充电接口" name="connector">
<connectorList ref="connector" :stationId="stationId"/>
<connectorList ref="connector" :stationId="stationId" />
</el-tab-pane>
<el-tab-pane label="基本资料" name="stationInfo">
<div class="over">
<div id="map_wrap">
<MapContainer ref="map" :stationLat="stationLat" :stationLng="stationLng"/>
<MapContainer
ref="map"
:stationLat="stationLat"
:stationLng="stationLng"
/>
</div>
<div class="menu">
<site-info ref="stationInfo"/>
<site-info ref="stationInfo" />
</div>
</div>
</el-tab-pane>
@@ -28,7 +32,7 @@
<el-tab-pane label="计费模块" name="billing">
<!-- billing 文件到时引入 -->
<billing ref="billing" :stationId="stationId"/>
<billing ref="billing" :stationId="stationId" />
</el-tab-pane>
<!-- <el-tab-pane label="客户管理" name="member">-->
@@ -36,19 +40,31 @@
<!-- </el-tab-pane>-->
<el-tab-pane label="运营管理" name="operation">
<el-card style="margin-bottom:10px">
<el-card style="margin-bottom: 10px">
<h2>二维码配置</h2>
<el-form label-position="right" label-width="200px" style="margin-top:10px">
<el-form
label-position="right"
label-width="200px"
style="margin-top: 10px"
>
<el-row>
<el-col :span="12">
<el-form-item label="当前配置二维码规则:">
<el-input v-model="stationDetail.qrcodePrefix" maxlength="100px" :disabled="true"/>
<el-input
v-model="stationDetail.qrcodePrefix"
maxlength="100px"
:disabled="true"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item>
<el-button icon="el-icon-setting" size="big" @click="handleCreate"
v-has-permi="['pile:station:edit']">配置参数
<el-button
icon="el-icon-setting"
size="big"
@click="handleCreate"
v-has-permi="['pile:station:edit']"
>配置参数
</el-button>
</el-form-item>
</el-col>
@@ -58,11 +74,20 @@
<el-card>
<h2>互联互通配置</h2>
<el-button icon="el-icon-edit" size="big" @click="openEdit" v-has-permi="['pile:station:edit']">编辑参数
<el-button
icon="el-icon-edit"
size="big"
@click="openEdit"
v-has-permi="['pile:station:edit']"
>编辑参数
</el-button>
<el-form ref="stationSettingForm" :model="stationSettingInfo" label-position="right"
label-width="200px"
style="margin-top:10px">
<el-form
ref="stationSettingForm"
:model="stationSettingInfo"
label-position="right"
label-width="200px"
style="margin-top: 10px"
>
<el-row>
<el-col :span="12">
<el-form-item label="对接平台名称:" prop="type">
@@ -89,47 +114,78 @@
</el-col>
<el-col :span="12">
<el-form-item label="对接平台url地址:" prop="urlAddress">
<el-input placeholder="请输入" v-model="stationSettingInfo.urlAddress"
:disabled="true"/>
<el-input
placeholder="请输入"
v-model="stationSettingInfo.urlAddress"
:disabled="true"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="运营商ID(OperatorID):" prop="operatorId">
<el-input placeholder="请输入" v-model="stationSettingInfo.operatorId"
:disabled="true"/>
<el-input
placeholder="请输入"
v-model="stationSettingInfo.operatorId"
:disabled="true"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="运营商密钥(OperatorSecret):" prop="operatorSecret">
<el-input placeholder="请输入" v-model="stationSettingInfo.operatorSecret"
:disabled="true"/>
<el-form-item
label="运营商密钥(OperatorSecret):"
prop="operatorSecret"
>
<el-input
placeholder="请输入"
v-model="stationSettingInfo.operatorSecret"
:disabled="true"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="消息Data密钥(DataSecret):" prop="dataSecret">
<el-input placeholder="请输入" v-model="stationSettingInfo.dataSecret"
:disabled="true"/>
<el-form-item
label="消息Data密钥(DataSecret):"
prop="dataSecret"
>
<el-input
placeholder="请输入"
v-model="stationSettingInfo.dataSecret"
:disabled="true"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="签名密钥(SigSecret):" prop="signSecret">
<el-input placeholder="请输入" v-model="stationSettingInfo.signSecret"
:disabled="true"/>
<el-input
placeholder="请输入"
v-model="stationSettingInfo.signSecret"
:disabled="true"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="消息Data密钥初始化向量(DataSecretIV):" prop="dataSecretIv">
<el-input placeholder="请输入" v-model="stationSettingInfo.dataSecretIv"
:disabled="true"/>
<el-form-item
label="消息Data密钥初始化向量(DataSecretIV):"
prop="dataSecretIv"
>
<el-input
placeholder="请输入"
v-model="stationSettingInfo.dataSecretIv"
:disabled="true"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item>
<el-button size="big" @click="pushStation" v-has-permi="['pile:station:edit']">
<el-button
size="big"
@click="pushStation"
v-has-permi="['pile:station:edit']"
>
推送站点信息
</el-button>
</el-form-item>
@@ -140,13 +196,22 @@
<el-card>
<h2>绑定停车平台(配置完成后订单完成将自动下发优惠券)</h2>
<el-button icon="el-icon-edit" size="big" @click="parkingOpenEdit" v-has-permi="['pile:station:edit']">编辑参数
<el-button
icon="el-icon-edit"
size="big"
@click="parkingOpenEdit"
v-has-permi="['pile:station:edit']"
>编辑参数
</el-button>
<el-form ref="parkingForm" :model="parkingInfo" label-position="right"
label-width="200px"
style="margin-top:10px">
<el-form
ref="parkingForm"
:model="parkingInfo"
label-position="right"
label-width="200px"
style="margin-top: 10px"
>
<el-row>
<el-col :span="12">
<el-col :span="5">
<el-form-item label="停车平台名称:" prop="type">
<el-select
v-model="parkingInfo.parkingName"
@@ -167,55 +232,70 @@
<!-- <el-input placeholder="请输入" v-model="stationSettingInfo.type" :disabled="disableFlag"/>-->
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="停车场库商户id:" prop="parkingMerchantId">
<el-input placeholder="请输入" v-model="parkingInfo.parkingMerchantId"
:disabled="true"/>
<el-form-item>
<el-button
size="big"
@click="saveParkingSetting(parkingInfo.id)"
v-has-permi="['pile:station:edit']"
>
保存
</el-button>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="停车场库secretKey:" prop="secretKey">
<el-input placeholder="请输入" v-model="parkingInfo.secretKey"
:disabled="true"/>
<el-input
placeholder="请输入"
v-model="parkingInfo.secretKey"
:disabled="true"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="停车场库appId:" prop="appId">
<el-input placeholder="请输入" v-model="parkingInfo.appId"
:disabled="true"/>
<el-input
placeholder="请输入"
v-model="parkingInfo.appId"
:disabled="true"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="票券id:" prop="couponId">
<el-input placeholder="请输入" v-model="parkingInfo.couponId"
:disabled="true"/>
<el-input
placeholder="请输入"
v-model="parkingInfo.couponId"
:disabled="false"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item>
<el-button size="big" @click="saveParkingSetting(parkingInfo.id)" v-has-permi="['pile:station:edit']">
保存
</el-button>
<el-form-item label="停车场库商户id:" prop="parkingMerchantId">
<el-input
placeholder="请输入"
v-model="parkingInfo.parkingMerchantId"
:disabled="false"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card style="margin-top:10px">
<el-card style="margin-top: 10px">
<h2>地锁二维码</h2>
<el-form label-position="right" label-width="200px" style="margin-top:10px">
<el-form
label-position="right"
label-width="200px"
style="margin-top: 10px"
>
<el-row>
<el-col :span="12">
<el-form-item label="查询地锁列表二维码:"/>
<el-form-item label="查询地锁列表二维码:" />
<div>
<vue-qr
ref="Qrcode"
@@ -226,15 +306,13 @@
/>
</div>
</el-col>
</el-row>
</el-form>
</el-card>
</el-tab-pane>
<el-tab-pane label="站点白名单" name="whitelist">
<whitelist ref="whitelist" :stationId="stationId"/>
<whitelist ref="whitelist" :stationId="stationId" />
</el-tab-pane>
<el-tab-pane label="订单日报" name="orderReport">
@@ -245,7 +323,11 @@
<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-input
v-model="form.prefix"
placeholder="请输入二维码前缀"
style="width: 300px"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer" align="center">
@@ -271,10 +353,12 @@ import {
getSettingByStationId,
updateSettingByStationId,
pushStationInfo,
getSettingInfo, getParkingInfoList, bindParkingPlatform,
getSettingInfo,
getParkingInfoList,
bindParkingPlatform,
} from "@/api/pile/station";
import Whitelist from "@/views/pile/station/stationWhiteList";
import OrderReport from './orderReport.vue';
import OrderReport from "./orderReport.vue";
export default {
dicts: ["third_party_type"],
@@ -288,19 +372,19 @@ export default {
MapContainer,
stationOrderList,
stationWhiteList,
OrderReport
OrderReport,
},
data() {
return {
activeName: 'pile',
activeName: "pile",
form: {
prefix: '',
prefix: "",
},
parkingInfo: {},
parkingInfoList: [],
queryGroundLockQrCode: '',
dialogTitle: '',
qrcodePrefix: '',
queryGroundLockQrCode: "",
dialogTitle: "",
qrcodePrefix: "",
dialogFormVisible: false,
stationId: this.$route.params.id,
stationName: this.$route.params.stationName,
@@ -315,11 +399,13 @@ export default {
created() {
// console.log(this.stationId, "充电桩详情 create");
// const stationId = this.stationId;
this.queryGroundLockQrCode = 'https://api.jsowellcloud.com/app-xcx-h5/getGroundLockInfo/' + this.stationId;
this.queryGroundLockQrCode =
"https://api.jsowellcloud.com/app-xcx-h5/getGroundLockInfo/" +
this.stationId;
const stationName = this.stationName;
const title = "【" + stationName + "】站点详情";
const route = Object.assign({}, this.$route, {title: `${title}`})
this.$store.dispatch('tagsView/updateVisitedView', route);
const route = Object.assign({}, this.$route, { title: `${title}` });
this.$store.dispatch("tagsView/updateVisitedView", route);
this.getParkingList();
this.queryStationInfo();
this.getStationSettingInfo();
@@ -334,7 +420,7 @@ export default {
},
// 执行对应页面的查询数据方法
initializeData(name) {
console.log("执行对应页面的查询数据方法", name)
console.log("执行对应页面的查询数据方法", name);
if (name === "pile") {
this.$refs.pile.getPileList();
} else if (name === "connector") {
@@ -346,7 +432,7 @@ export default {
this.$refs.stationInfo.queryStationInfo();
} else if (name === "order") {
this.$refs.order.dataLoading();
} else if (name === 'orderReport') {
} else if (name === "orderReport") {
this.$refs.orderReport.getList();
}
},
@@ -355,12 +441,12 @@ export default {
getStationInfo(this.stationId).then((res) => {
// console.log(res);
this.stationDetail = res.data;
this.stationLat = res.data.stationLat
this.stationLng = res.data.stationLng
console.log(this.stationLat, this.stationLng, "父组件里面的经纬度")
console.log("res.data", res.data)
this.stationLat = res.data.stationLat;
this.stationLng = res.data.stationLng;
console.log(this.stationLat, this.stationLng, "父组件里面的经纬度");
console.log("res.data", res.data);
if (res.data.parkingId != null) {
this.getParkingInfo(parseInt(res.data.parkingId))
this.getParkingInfo(parseInt(res.data.parkingId));
}
});
console.log("queryStationInfo==", this.stationDetail);
@@ -368,49 +454,49 @@ export default {
// 查询站点互联互通配置信息
getStationSettingInfo() {
getSettingByStationId(this.stationId).then((res) => {
console.log("stationId:", this.stationId)
console.log("getSettingByStationId==", res.data === undefined)
console.log("stationId:", this.stationId);
console.log("getSettingByStationId==", res.data === undefined);
if (res.data === undefined) {
this.stationSettingInfo.thirdPartyType = "0";
} else {
this.stationSettingInfo = res.data;
}
})
});
},
// 根据对接平台类型查询配置信息
getSettingParams() {
const param = {
// stationId: this.stationId,
thirdPartyType: this.stationSettingInfo.type,
}
};
console.log("param", param);
getSettingInfo(param).then((res) => {
console.log("getSettingInfo", res)
console.log("getSettingInfo", res);
if (res.data === undefined) {
this.stationSettingInfo = [];
} else {
this.stationSettingInfo = res.data;
}
})
});
},
// 获取停车平台列表
getParkingList() {
getParkingInfoList().then((response) => {
console.info("response", response)
console.info("response", response);
this.parkingInfoList = response.obj;
})
});
},
// 通过id获取停车平台信息
getParkingInfo(parkingId) {
console.log("parkingId", parkingId)
this.parkingInfoList.forEach(item => {
console.log("parkingId", parkingId);
this.parkingInfoList.forEach((item) => {
if (parkingId === item.id) {
console.log("item", item)
console.log("item", item);
this.parkingInfo = item;
// console.log("this.parkingInfo", this.parkingInfo)
console.log("this.parkingInfo", this.parkingInfo)
}
})
});
},
// 开放编辑按钮
@@ -418,7 +504,7 @@ export default {
this.disableFlag = this.disableFlag === false;
},
parkingOpenEdit() {
this.parkingDisableFlag = this.parkingDisableFlag === false;
this.parkingDisableFlag = !this.parkingDisableFlag;
},
// 提交配置设置
@@ -431,48 +517,48 @@ export default {
dataSecret: this.stationSettingInfo.dataSecret,
signSecret: this.stationSettingInfo.signSecret,
dataSecretIv: this.stationSettingInfo.dataSecretIv,
}
};
console.log("param:", param);
this.$refs.stationSettingForm.validate((valid) => {
if (valid) {
updateSettingByStationId(param).then((response) => {
this.$modal.msgSuccess('修改成功')
this.$modal.msgSuccess("修改成功");
this.disableFlag = true;
})
});
} else {
return false
return false;
}
})
});
},
// 推送站点
pushStation() {
const param = {
stationId: this.stationId,
thirdPartyType: this.stationSettingInfo.type,
}
};
pushStationInfo(param).then((response) => {
console.log("response", response)
this.$modal.msg(response.obj)
console.log("response", response);
this.$modal.msg(response.obj);
this.disableFlag = true;
})
});
},
// 绑定站点与停车平台配置
saveParkingSetting(parkingId) {
console.log("parkingId", parkingId)
console.log("parkingId", parkingId, this.stationId);
const params = {
stationId: this.stationId,
parkingId: parkingId,
}
bindParkingPlatform(params).then(response => {
console.log("绑定站点与停车平台配置 response", response)
})
};
bindParkingPlatform(params).then((response) => {
console.log("绑定站点与停车平台配置 response", response);
});
},
// 配置参数按钮
handleCreate() {
this.dialogTitle = '配置参数';
this.dialogTitle = "配置参数";
this.form = {
prefix: '',
prefix: "",
};
this.dialogFormVisible = true;
},
@@ -480,26 +566,26 @@ export default {
submitForm(form) {
const param = {
stationId: this.stationId,
qrcodePrefix: this.form.prefix
}
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
})
this.$modal.msgSuccess("修改成功");
this.dialogFormVisible = false;
});
} else {
return false
return false;
}
})
});
},
// 取消按钮
cancel() {
this.dialogFormVisible = false
}
}
this.dialogFormVisible = false;
},
},
};
</script>
@@ -509,4 +595,7 @@ export default {
height: 400px;
// margin-left: 50%; transform: translate(-50%,0);
}
::v-deep .el-input--medium {
width: 400px;
}
</style>