提交设备故障反馈

This commit is contained in:
SjS 2025-04-01 09:05:28 +08:00
parent 5d9b71528b
commit 7960c085dd
2 changed files with 26 additions and 13 deletions

View File

@ -245,11 +245,7 @@ public class DeviceServiceImpl implements DeviceService
data.setUpdateTime(DateUtils.getNowDate());
Integer result = transactionTemplate.execute(status -> {
deviceMapper.selectByDeviceNo(data.getDeviceNo());
// 更新主表
int update = deviceMapper.updateSmDevice(data);
ServiceUtil.assertion(update != 1, "更新设备失败");
// deviceMapper.selectByDeviceId(data.getDeviceNo());
// 生成SnLog记录
SnLog snLog = new SnLog();
@ -257,6 +253,12 @@ public class DeviceServiceImpl implements DeviceService
snLog.setUserId(SecurityUtils.getUserId());
snLog.setMac(data.getMac());
// 更新主表
int update = deviceMapper.updateSmDevice(data);
ServiceUtil.assertion(update != 1, "更新设备失败");
// 后校验
DeviceVO vo = this.selectById(data.getDeviceId());
deviceAssembler.assembleBonusList(vo);

View File

@ -53,17 +53,28 @@ public class AppAbnormalController extends BaseController {
public AjaxResult submit(@RequestBody @Validated(ValidGroup.FrontCreate.class) AbnormalSubmitDTO data) {
data.setUserId(getUserId());
data.setCreateBy(getUsername());
TransactionBillVO vo = transactionBillService.selectSmTransactionBillByBillId(data.getOrderId());
if (vo != null) {
data.setOrderNo(vo.getBillNo());
TransactionBillVO transactionBillVO = transactionBillService.selectSmTransactionBillByBillId(data.getOrderId());
DeviceVO deviceVO = deviceService.selectByDeviceNo(data.getDeviceNo());
if (data.getOrderId() != null && data.getDeviceNo() != null) {
if (transactionBillVO == null) {
return AjaxResult.error("当前订单不存在");
}
if (deviceVO == null) {
return AjaxResult.error("当前设备不存在");
}
if (!transactionBillVO.getDeviceNo().equals(data.getDeviceNo())) {
return AjaxResult.error("当前设备与订单无关联");
}
}
// 获取订单商户id
if (vo.getMchId() != null) {
data.setStoreId(vo.getMchId());
if ( data.getOrderId()!= null) {
data.setOrderNo(transactionBillVO.getBillNo());
if(transactionBillVO.getMchId()!=null){
data.setStoreId(transactionBillVO.getMchId());
}
}
// 获取设备商户id
DeviceVO deviceVO = deviceService.selectByDeviceNo(data.getDeviceNo());
if (deviceVO != null) {
if (data.getDeviceNo() != null) {
Long storeId = deviceVO.getStoreId();
if (storeId != null) {
data.setStoreId(storeId);