提交设备故障反馈
This commit is contained in:
parent
7960c085dd
commit
2a1a4b87d7
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.ss.abnormal.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.ss.abnormal.domain.Abnormal;
|
||||
import com.ruoyi.ss.abnormal.domain.dto.AbnormalSubmitDTO;
|
||||
|
@ -10,6 +11,8 @@ import com.ruoyi.ss.device.domain.vo.DeviceVO;
|
|||
import com.ruoyi.ss.device.mapper.DeviceMapper;
|
||||
import com.ruoyi.ss.device.service.DeviceService;
|
||||
import com.ruoyi.ss.store.service.StoreService;
|
||||
import com.ruoyi.ss.transactionBill.domain.vo.TransactionBillVO;
|
||||
import com.ruoyi.ss.transactionBill.service.TransactionBillService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -29,6 +32,9 @@ public class AbnormalConverterImpl implements AbnormalConverter {
|
|||
@Autowired
|
||||
private StoreService storeService;
|
||||
|
||||
@Autowired
|
||||
private TransactionBillService transactionBillService;
|
||||
|
||||
|
||||
@Override
|
||||
public Abnormal toPo(AbnormalSubmitDTO dto) {
|
||||
|
@ -51,6 +57,30 @@ public class AbnormalConverterImpl implements AbnormalConverter {
|
|||
po.setAddress(dto.getAddress());
|
||||
po.setStatus(AbnormalStatus.UNDO.getStatus());
|
||||
po.setCreateBy(dto.getCreateBy());
|
||||
|
||||
TransactionBillVO transactionBillVO = transactionBillService.selectSmTransactionBillByBillId(dto.getOrderId());
|
||||
if (dto.getOrderId() != null && dto.getDeviceNo() != null) {
|
||||
if (transactionBillVO == null) {
|
||||
ServiceUtil.assertion(true,"当前订单不存在");
|
||||
}
|
||||
if (!transactionBillVO.getDeviceNo().equals(dto.getDeviceNo())) {
|
||||
ServiceUtil.assertion(true,"当前设备与订单无关联");
|
||||
}
|
||||
}
|
||||
// 获取订单商户id
|
||||
if ( dto.getOrderId()!= null) {
|
||||
po.setOrderNo(transactionBillVO.getBillNo());
|
||||
if(transactionBillVO.getMchId()!=null){
|
||||
po.setStoreId(transactionBillVO.getMchId());
|
||||
}
|
||||
}
|
||||
// 获取设备商户id
|
||||
if (dto.getDeviceNo() != null) {
|
||||
Long storeId = device.getStoreId();
|
||||
if (storeId != null) {
|
||||
po.setStoreId(storeId);
|
||||
}
|
||||
}
|
||||
return po;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -245,13 +245,17 @@ public class DeviceServiceImpl implements DeviceService
|
|||
data.setUpdateTime(DateUtils.getNowDate());
|
||||
|
||||
Integer result = transactionTemplate.execute(status -> {
|
||||
// deviceMapper.selectByDeviceId(data.getDeviceNo());
|
||||
|
||||
DeviceVO deviceVO = deviceMapper.selectSmDeviceByDeviceId(data.getDeviceId());
|
||||
|
||||
// 生成SnLog记录
|
||||
SnLog snLog = new SnLog();
|
||||
snLog.setDeviceId(data.getDeviceId());
|
||||
snLog.setUserId(SecurityUtils.getUserId());
|
||||
snLog.setMac(data.getMac());
|
||||
snLog.setOldSn(deviceVO.getDeviceNo());
|
||||
snLog.setNewSn(data.getDeviceNo());
|
||||
snLog.setUpdateTime(DateUtils.getNowDate());
|
||||
|
||||
// 更新主表
|
||||
int update = deviceMapper.updateSmDevice(data);
|
||||
|
|
|
@ -53,33 +53,6 @@ public class AppAbnormalController extends BaseController {
|
|||
public AjaxResult submit(@RequestBody @Validated(ValidGroup.FrontCreate.class) AbnormalSubmitDTO data) {
|
||||
data.setUserId(getUserId());
|
||||
data.setCreateBy(getUsername());
|
||||
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 ( data.getOrderId()!= null) {
|
||||
data.setOrderNo(transactionBillVO.getBillNo());
|
||||
if(transactionBillVO.getMchId()!=null){
|
||||
data.setStoreId(transactionBillVO.getMchId());
|
||||
}
|
||||
}
|
||||
// 获取设备商户id
|
||||
if (data.getDeviceNo() != null) {
|
||||
Long storeId = deviceVO.getStoreId();
|
||||
if (storeId != null) {
|
||||
data.setStoreId(storeId);
|
||||
}
|
||||
}
|
||||
return success(abnormalService.insertAbnormal(abnormalConverter.toPo(data)));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user