二维码跳转、工单完成后车轮状态
This commit is contained in:
parent
e6d2977434
commit
1eca757696
@ -0,0 +1,24 @@
|
|||||||
|
package com.cdzy.operations.config;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yanglei
|
||||||
|
* @since 2025-10-15 09:36
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties(prefix = "wechat")
|
||||||
|
public class WechatConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二维码跳转路径
|
||||||
|
*/
|
||||||
|
private String qrUrl;
|
||||||
|
|
||||||
|
}
|
||||||
@ -6,11 +6,6 @@ package com.cdzy.operations.enums;
|
|||||||
*/
|
*/
|
||||||
public interface BikeUsageStatus {
|
public interface BikeUsageStatus {
|
||||||
|
|
||||||
/**
|
|
||||||
* 未投放
|
|
||||||
*/
|
|
||||||
int BIND = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 待单
|
* 待单
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -228,7 +228,7 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
|||||||
.ecuId(ecuInfo.getEcuId())
|
.ecuId(ecuInfo.getEcuId())
|
||||||
.hasHelme(bindVo.getHasHelme())
|
.hasHelme(bindVo.getHasHelme())
|
||||||
.status(BikeStatus.UN_LAUNCH)
|
.status(BikeStatus.UN_LAUNCH)
|
||||||
.usageStatus(BikeUsageStatus.BIND)
|
.usageStatus(BikeUsageStatus.WAIT)
|
||||||
.createdBy(StpUtil.getLoginIdAsLong())
|
.createdBy(StpUtil.getLoginIdAsLong())
|
||||||
.build();
|
.build();
|
||||||
if (batteryInfo != null) {
|
if (batteryInfo != null) {
|
||||||
|
|||||||
@ -41,6 +41,8 @@ import static com.cdzy.operations.model.entity.table.EbikeBikeInfoTableDef.EBIKE
|
|||||||
import static com.cdzy.operations.model.entity.table.EbikeBikeOrderTableDef.EBIKE_BIKE_ORDER;
|
import static com.cdzy.operations.model.entity.table.EbikeBikeOrderTableDef.EBIKE_BIKE_ORDER;
|
||||||
import static com.cdzy.operations.model.entity.table.EbikeBorrowBatteryRecordTableDef.EBIKE_BORROW_BATTERY_RECORD;
|
import static com.cdzy.operations.model.entity.table.EbikeBorrowBatteryRecordTableDef.EBIKE_BORROW_BATTERY_RECORD;
|
||||||
import static com.cdzy.operations.model.entity.table.EbikeEcuInfoTableDef.EBIKE_ECU_INFO;
|
import static com.cdzy.operations.model.entity.table.EbikeEcuInfoTableDef.EBIKE_ECU_INFO;
|
||||||
|
import static com.cdzy.operations.model.entity.table.EbikeOrderFileTableDef.EBIKE_ORDER_FILE;
|
||||||
|
import static com.cdzy.operations.model.entity.table.EbikeOrderPartTableDef.EBIKE_ORDER_PART;
|
||||||
import static com.cdzy.operations.model.entity.table.EbikeSiteTableDef.EBIKE_SITE;
|
import static com.cdzy.operations.model.entity.table.EbikeSiteTableDef.EBIKE_SITE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -99,6 +101,9 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
|||||||
@Resource
|
@Resource
|
||||||
private EbikeOrderFileMapper ebikeOrderFileMapper;
|
private EbikeOrderFileMapper ebikeOrderFileMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private EbikeOrderPartMapper ebikeOrderPartMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createBatterySwapOrder(String ecuSn) {
|
public void createBatterySwapOrder(String ecuSn) {
|
||||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
@ -126,7 +131,7 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
|||||||
.operatorId(bikeInfo.getOperatorId())
|
.operatorId(bikeInfo.getOperatorId())
|
||||||
.build();
|
.build();
|
||||||
this.mapper.insert(ebikeBikeOrder);
|
this.mapper.insert(ebikeBikeOrder);
|
||||||
//TODO:车辆状态
|
//换电不处理车辆状态,电量低时用户不允许开锁
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@ -159,7 +164,7 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
|||||||
List<EbikeOrderFile> list = fileUrls.stream().map(e -> EbikeOrderFile.builder().orderId(orderId).fileUrl(e).build()).toList();
|
List<EbikeOrderFile> list = fileUrls.stream().map(e -> EbikeOrderFile.builder().orderId(orderId).fileUrl(e).build()).toList();
|
||||||
orderFileMapper.insertBatch(list);
|
orderFileMapper.insertBatch(list);
|
||||||
}
|
}
|
||||||
//TODO:车辆状态
|
//巡检无需操作车辆状态,巡检确认后更改唱歌了状态为故障
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@ -259,6 +264,7 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
|||||||
orderFileMapper.insertBatch(list);
|
orderFileMapper.insertBatch(list);
|
||||||
}
|
}
|
||||||
//TODO:车辆状态
|
//TODO:车辆状态
|
||||||
|
bikeInfo.setUsageStatus(BikeUsageStatus.REPAIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@ -531,7 +537,6 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
|||||||
.select("EXTRACT(EPOCH FROM (NOW() - ebike_bike_info.latest_cycling_time)) / 3600 AS hours_since_last_cycling")
|
.select("EXTRACT(EPOCH FROM (NOW() - ebike_bike_info.latest_cycling_time)) / 3600 AS hours_since_last_cycling")
|
||||||
.where(EBIKE_BIKE_INFO.REGION_ID.eq(regionId))
|
.where(EBIKE_BIKE_INFO.REGION_ID.eq(regionId))
|
||||||
.where(EBIKE_BIKE_INFO.STATUS.eq(BikeStatus.LAUNCH))
|
.where(EBIKE_BIKE_INFO.STATUS.eq(BikeStatus.LAUNCH))
|
||||||
.where(EBIKE_BIKE_INFO.USAGE_STATUS.ne(BikeUsageStatus.BIND))
|
|
||||||
.leftJoin(EBIKE_ECU_INFO).on(EBIKE_ECU_INFO.ECU_ID.eq(EBIKE_BIKE_INFO.ECU_ID));
|
.leftJoin(EBIKE_ECU_INFO).on(EBIKE_ECU_INFO.ECU_ID.eq(EBIKE_BIKE_INFO.ECU_ID));
|
||||||
List<EbikeOrderBikeListDto> list = bikeInfoMapper.selectListByQueryAs(queryWrapper, EbikeOrderBikeListDto.class);
|
List<EbikeOrderBikeListDto> list = bikeInfoMapper.selectListByQueryAs(queryWrapper, EbikeOrderBikeListDto.class);
|
||||||
List<String> snList = list.stream().map(EbikeOrderBikeListDto::getEcuSn).toList();
|
List<String> snList = list.stream().map(EbikeOrderBikeListDto::getEcuSn).toList();
|
||||||
@ -590,6 +595,7 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
|||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
ebikeOrderFileMapper.insertBatch(list);
|
ebikeOrderFileMapper.insertBatch(list);
|
||||||
}
|
}
|
||||||
|
//TODO:车辆状态
|
||||||
updateById(bikeOrder);
|
updateById(bikeOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -613,6 +619,48 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
|||||||
} else {
|
} else {
|
||||||
bikeOrder.setReceiverId(loginId);
|
bikeOrder.setReceiverId(loginId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
queryWrapper.clear();
|
||||||
|
queryWrapper.where(EBIKE_BIKE_INFO.BIKE_CODE.eq(bikeCode));
|
||||||
|
EbikeBikeInfo bikeInfo = bikeInfoMapper.selectOneByQuery(queryWrapper);
|
||||||
|
if (bikeInfo == null) {
|
||||||
|
throw new EbikeException("车辆编号错误");
|
||||||
|
}
|
||||||
|
Boolean isFault = inspectionVo.getIsFault();
|
||||||
|
if (isFault){
|
||||||
|
queryWrapper.clear();
|
||||||
|
queryWrapper.select(EBIKE_ORDER_FILE.FILE_URL)
|
||||||
|
.where(EBIKE_ORDER_FILE.ORDER_ID.eq( bikeOrder.getOrderId()));
|
||||||
|
List<String> list = ebikeOrderFileMapper.selectListByQueryAs(queryWrapper,String.class);
|
||||||
|
|
||||||
|
queryWrapper.clear();
|
||||||
|
queryWrapper.select(EBIKE_ORDER_PART.ORDER_PART)
|
||||||
|
.where(EBIKE_ORDER_PART.ORDER_ID.eq( bikeOrder.getOrderId()));
|
||||||
|
List<Integer> parts = ebikeOrderPartMapper.selectListByQueryAs(queryWrapper, Integer.class);
|
||||||
|
|
||||||
|
EbikeBikeOrder ebikeBikeOrder = EbikeBikeOrder.builder()
|
||||||
|
.bikeCode(bikeInfo.getBikeCode())
|
||||||
|
.orderCode(snowFlakeIDKeyGenerator.nextId())
|
||||||
|
.orderType(BikeOrderType.REPAIR)
|
||||||
|
.operatorId(bikeInfo.getOperatorId())
|
||||||
|
.remarks(inspectionVo.getRemarks())
|
||||||
|
.build();
|
||||||
|
this.mapper.insert(ebikeBikeOrder);
|
||||||
|
Long orderId = ebikeBikeOrder.getOrderId();
|
||||||
|
if (parts != null && !parts.isEmpty()) {
|
||||||
|
List<EbikeOrderPart> partList = parts.stream().map(e -> EbikeOrderPart.builder().orderId(orderId).orderPart(e).build()).toList();
|
||||||
|
orderPartMapper.insertBatch(partList);
|
||||||
|
}
|
||||||
|
if (list != null && !list.isEmpty()) {
|
||||||
|
List<EbikeOrderFile> files = list.stream().map(e -> EbikeOrderFile.builder().orderId(orderId).fileUrl(e).build()).toList();
|
||||||
|
orderFileMapper.insertBatch(files);
|
||||||
|
}
|
||||||
|
//TODO:车辆状态
|
||||||
|
bikeInfo.setUsageStatus(BikeUsageStatus.REPAIR);
|
||||||
|
bikeInfoMapper.update(bikeInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bikeOrder.setHandleState(OrderHandleState.PROCESSED);
|
bikeOrder.setHandleState(OrderHandleState.PROCESSED);
|
||||||
List<String> afterInspectionFileUrls = inspectionVo.getAfterInspectionFileUrls();
|
List<String> afterInspectionFileUrls = inspectionVo.getAfterInspectionFileUrls();
|
||||||
|
|
||||||
@ -664,6 +712,12 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
|||||||
if (bikeOrder == null) {
|
if (bikeOrder == null) {
|
||||||
throw new EbikeException("该工单不存在或已作废");
|
throw new EbikeException("该工单不存在或已作废");
|
||||||
}
|
}
|
||||||
|
queryWrapper.clear();
|
||||||
|
queryWrapper.where(EBIKE_BIKE_INFO.BIKE_CODE.eq(bikeCode));
|
||||||
|
EbikeBikeInfo bikeInfo = bikeInfoMapper.selectOneByQuery(queryWrapper);
|
||||||
|
if (bikeInfo == null) {
|
||||||
|
throw new EbikeException("车辆编码错误");
|
||||||
|
}
|
||||||
Long receiverId = bikeOrder.getReceiverId();
|
Long receiverId = bikeOrder.getReceiverId();
|
||||||
long loginId = StpUtil.getLoginIdAsLong();
|
long loginId = StpUtil.getLoginIdAsLong();
|
||||||
if (receiverId != null) {
|
if (receiverId != null) {
|
||||||
@ -689,6 +743,8 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
|||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
ebikeOrderFileMapper.insertBatch(list);
|
ebikeOrderFileMapper.insertBatch(list);
|
||||||
}
|
}
|
||||||
|
bikeInfo.setUsageStatus(BikeUsageStatus.WAIT);
|
||||||
|
bikeInfoMapper.update(bikeInfo);
|
||||||
updateById(bikeOrder);
|
updateById(bikeOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.cdzy.operations.service.impl;
|
|||||||
|
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import com.cdzy.common.ex.EbikeException;
|
import com.cdzy.common.ex.EbikeException;
|
||||||
|
import com.cdzy.operations.config.WechatConfig;
|
||||||
import com.cdzy.operations.enums.BikeQrStatus;
|
import com.cdzy.operations.enums.BikeQrStatus;
|
||||||
import com.cdzy.operations.mapper.EbikeBikeQrMapper;
|
import com.cdzy.operations.mapper.EbikeBikeQrMapper;
|
||||||
import com.cdzy.operations.model.entity.EbikeBikeQr;
|
import com.cdzy.operations.model.entity.EbikeBikeQr;
|
||||||
@ -28,6 +29,9 @@ import java.util.List;
|
|||||||
@Service
|
@Service
|
||||||
public class EbikeBikeQrServiceImpl extends ServiceImpl<EbikeBikeQrMapper, EbikeBikeQr> implements EbikeBikeQrService{
|
public class EbikeBikeQrServiceImpl extends ServiceImpl<EbikeBikeQrMapper, EbikeBikeQr> implements EbikeBikeQrService{
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WechatConfig wechatConfig;
|
||||||
|
|
||||||
private static final String bikeUrl = "/bike-qr/";
|
private static final String bikeUrl = "/bike-qr/";
|
||||||
|
|
||||||
private static final String bikeSuffix = ".jpg";
|
private static final String bikeSuffix = ".jpg";
|
||||||
@ -50,7 +54,7 @@ public class EbikeBikeQrServiceImpl extends ServiceImpl<EbikeBikeQrMapper, Ebike
|
|||||||
//二维码生成
|
//二维码生成
|
||||||
String code = list.get(i);
|
String code = list.get(i);
|
||||||
//TODO:扫码进入小程序优化
|
//TODO:扫码进入小程序优化
|
||||||
ByteArrayInputStream byteArrayInputStream = QRGenUtil.generateQRCodeInputStearm("https://www.cdzhuojing.cn/qrcode?number=" + code + "&_tbScancodeApproach_=scan", code);
|
ByteArrayInputStream byteArrayInputStream = QRGenUtil.generateQRCodeInputStearm(wechatConfig.getQrUrl()+ code + "&_tbScancodeApproach_=scan", code);
|
||||||
streamList.add(byteArrayInputStream);
|
streamList.add(byteArrayInputStream);
|
||||||
names.add(bikeUrl+code +bikeSuffix);
|
names.add(bikeUrl+code +bikeSuffix);
|
||||||
EbikeBikeQr ebikeBikeQr = EbikeBikeQr.builder()
|
EbikeBikeQr ebikeBikeQr = EbikeBikeQr.builder()
|
||||||
|
|||||||
@ -109,7 +109,7 @@ minio:
|
|||||||
access-key: ZIF4HF1LXH0RTB9MZ52O # 访问密钥
|
access-key: ZIF4HF1LXH0RTB9MZ52O # 访问密钥
|
||||||
secret-key: YuFoH+VJVzQbNLRqVMo39dM5pWXCEcMvrCrtgwB0 # 私有密钥
|
secret-key: YuFoH+VJVzQbNLRqVMo39dM5pWXCEcMvrCrtgwB0 # 私有密钥
|
||||||
bucket-name: operations-objects
|
bucket-name: operations-objects
|
||||||
show-url: http://47.109.141.125:9000
|
show-url: https://www.cdzhuojing.cn/file
|
||||||
|
|
||||||
logging:
|
logging:
|
||||||
pattern:
|
pattern:
|
||||||
@ -118,3 +118,6 @@ logging:
|
|||||||
geo-coding:
|
geo-coding:
|
||||||
api-url: https://restapi.amap.com/v3/geocode
|
api-url: https://restapi.amap.com/v3/geocode
|
||||||
access-key: c9bc51e353b49acd42a560f37121929a
|
access-key: c9bc51e353b49acd42a560f37121929a
|
||||||
|
|
||||||
|
wechat:
|
||||||
|
qr-url: https://www.cdzhuojing.cn/ebike?bikeCode=
|
||||||
Loading…
x
Reference in New Issue
Block a user