优化,统计更新
This commit is contained in:
parent
42e48d5b57
commit
27fb3bdba1
|
@ -20,4 +20,7 @@ public class DeviceTransferDTO {
|
|||
@NotNull(message = "运营区ID不能为空")
|
||||
private Long areaId;
|
||||
|
||||
@ApiModelProperty("商户ID")
|
||||
private Long mchId;
|
||||
|
||||
}
|
||||
|
|
|
@ -139,9 +139,9 @@ public interface DeviceService {
|
|||
public int clearCurrentOrderDevice(Long id, Long orderDeviceId);
|
||||
|
||||
/**
|
||||
* 划拨运营区
|
||||
* 划拨
|
||||
*/
|
||||
public int transfer(List<DeviceVO> deviceList, Long areaId);
|
||||
public int transfer(List<DeviceVO> deviceList, Long areaId, Long mchId);
|
||||
|
||||
/**
|
||||
* 获取可用车辆
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.ruoyi.bst.device.service;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.bst.device.domain.DeviceVO;
|
||||
|
||||
public interface DeviceValidator {
|
||||
|
||||
/**
|
||||
|
@ -30,7 +32,7 @@ public interface DeviceValidator {
|
|||
* 校验设备数据
|
||||
* @param id
|
||||
*/
|
||||
void validate(Long id);
|
||||
void validate(DeviceVO device);
|
||||
|
||||
/**
|
||||
* 是否可以操作设备
|
||||
|
|
|
@ -53,15 +53,14 @@ public class DeviceValidatorImpl implements DeviceValidator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void validate(Long id) {
|
||||
DeviceVO device = deviceMapper.selectDeviceById(id);
|
||||
public void validate(DeviceVO device) {
|
||||
ServiceUtil.assertion(device == null, "设备不存在");
|
||||
|
||||
// 判断设备MAC是否重复
|
||||
this.validateMac(id, device.getMac());
|
||||
this.validateMac(device.getId(), device.getMac());
|
||||
|
||||
// 判断设备SN是否重复
|
||||
this.validateSn(id, device.getSn());
|
||||
this.validateSn(device.getId(), device.getSn());
|
||||
}
|
||||
|
||||
private void validateMac(Long id, String mac) {
|
||||
|
|
|
@ -22,14 +22,11 @@ public class ReconciliationDateUtil {
|
|||
&& (data.getPayAmount() == null || data.getPayAmount().compareTo(BigDecimal.ZERO) == 0)
|
||||
&& (data.getRefundAmount() == null || data.getRefundAmount().compareTo(BigDecimal.ZERO) == 0)
|
||||
&& (data.getActualAmount() == null || data.getActualAmount().compareTo(BigDecimal.ZERO) == 0)
|
||||
&& (data.getUserBonus() == null || data.getUserBonus().compareTo(BigDecimal.ZERO) == 0)
|
||||
&& (data.getUserBonusRefund() == null || data.getUserBonusRefund().compareTo(BigDecimal.ZERO) == 0)
|
||||
&& (data.getUserActualBonus() == null || data.getUserActualBonus().compareTo(BigDecimal.ZERO) == 0)
|
||||
&& (data.getPlatformBonus() == null || data.getPlatformBonus().compareTo(BigDecimal.ZERO) == 0)
|
||||
&& (data.getPlatformBonusRefund() == null || data.getPlatformBonusRefund().compareTo(BigDecimal.ZERO) == 0)
|
||||
&& (data.getPlatformActualBonus() == null || data.getPlatformActualBonus().compareTo(BigDecimal.ZERO) == 0)
|
||||
&& (data.getTotalBonus() == null || data.getTotalBonus().compareTo(BigDecimal.ZERO) == 0)
|
||||
&& (data.getTotalBonusRefund() == null || data.getTotalBonusRefund().compareTo(BigDecimal.ZERO) == 0)
|
||||
&& (data.getDifference() == null || data.getDifference().compareTo(BigDecimal.ZERO) == 0);
|
||||
&& (data.getVipPayAmount() == null || data.getVipPayAmount().compareTo(BigDecimal.ZERO) == 0)
|
||||
&& (data.getVipRefundAmount() == null || data.getVipRefundAmount().compareTo(BigDecimal.ZERO) == 0)
|
||||
&& (data.getVipActualAmount() == null || data.getVipActualAmount().compareTo(BigDecimal.ZERO) == 0)
|
||||
&& (data.getDepositPayAmount() == null || data.getDepositPayAmount().compareTo(BigDecimal.ZERO) == 0)
|
||||
&& (data.getDepositRefundAmount() == null || data.getDepositRefundAmount().compareTo(BigDecimal.ZERO) == 0)
|
||||
&& (data.getDepositActualAmount() == null || data.getDepositActualAmount().compareTo(BigDecimal.ZERO) == 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import com.ruoyi.bst.device.domain.Device;
|
|||
import com.ruoyi.bst.device.domain.DeviceQuery;
|
||||
import com.ruoyi.bst.device.domain.DeviceVO;
|
||||
import com.ruoyi.bst.device.domain.dto.DeviceTransferDTO;
|
||||
import com.ruoyi.bst.device.service.DeviceAssembler;
|
||||
import com.ruoyi.bst.device.service.DeviceConverter;
|
||||
import com.ruoyi.bst.device.service.DeviceIotService;
|
||||
import com.ruoyi.bst.device.service.DeviceService;
|
||||
|
@ -35,6 +34,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|||
import com.ruoyi.common.core.validate.ValidGroup;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.enums.LogBizType;
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.iot.constants.IotConstants;
|
||||
import com.ruoyi.system.user.service.UserValidator;
|
||||
|
@ -66,9 +66,6 @@ public class DeviceController extends BaseController {
|
|||
@Autowired
|
||||
private DeviceIotService deviceIotService;
|
||||
|
||||
@Autowired
|
||||
private DeviceAssembler deviceAssembler;
|
||||
|
||||
/**
|
||||
* 查询设备列表
|
||||
*/
|
||||
|
@ -255,20 +252,23 @@ public class DeviceController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 划拨运营区
|
||||
* 划拨
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bst:device:transfer')")
|
||||
@Log(title = "设备划拨运营区", businessType = BusinessType.OTHER, bizIdName = "arg0", bizType = LogBizType.DEVICE)
|
||||
@Log(title = "设备划拨", businessType = BusinessType.OTHER, bizIdName = "arg0", bizType = LogBizType.DEVICE)
|
||||
@PutMapping("/transfer")
|
||||
public AjaxResult transfer(@RequestBody @Validated DeviceTransferDTO dto) {
|
||||
if (!deviceValidator.canOperate(dto.getIds())) {
|
||||
return error("您无权划拨ID为" + dto.getIds() + "的设备");
|
||||
}
|
||||
if (!areaValidator.canEdit(dto.getAreaId())) {
|
||||
return error("您无权将设备划拨到ID为" + dto.getAreaId() + "的运营区");
|
||||
if (dto.getAreaId() != null) {
|
||||
ServiceUtil.assertion(!areaValidator.canEdit(dto.getAreaId()), "您无权将设备划拨到ID为%s的运营区", dto.getAreaId());
|
||||
}
|
||||
if (dto.getMchId() != null) {
|
||||
ServiceUtil.assertion(!userValidator.canEdit(dto.getMchId()), "您无权将设备划拨到ID为%s的商户", dto.getMchId());
|
||||
}
|
||||
List<DeviceVO> deviceList = deviceService.selectDeviceByIds(dto.getIds(), true, AreaJoinPermission.DEVICE_EDIT);
|
||||
int count = deviceService.transfer(deviceList, dto.getAreaId());
|
||||
int count = deviceService.transfer(deviceList, dto.getAreaId(), dto.getMchId());
|
||||
if (count == 0) {
|
||||
return error("划拨失败");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user