|
@@ -116,16 +116,14 @@ public class MercMiniDeviceController {
|
|
|
dto.setMercId(MercAuthUtils.getMercId());
|
|
|
return deviceInfoService.dataCount(dto);
|
|
|
}
|
|
|
- @PostMapping("getActiveInfo")
|
|
|
- @ApiOperation("激活设备前判断")
|
|
|
- public R getActiveInfo(@RequestBody MercMiniDeviceDto.Active active){
|
|
|
+
|
|
|
+ private R checkDeviceByMerc(DeviceInfo deviceInfo){
|
|
|
Long mercId = MercAuthUtils.getMercId();
|
|
|
//商户是否已通过审核
|
|
|
MercDto.Vo mercInfo = mercFeignService.obj(new MercDto.ListDTO().setId(mercId)).getData();
|
|
|
if (!mercInfo.getStatus().equals(String.valueOf(MercStatus.APPROVED.getCode()))) {
|
|
|
return R.fail("商户未通过审核");
|
|
|
}
|
|
|
- DeviceInfo deviceInfo = deviceInfoService.getById(active.getDeviceId());
|
|
|
//设备是否存在
|
|
|
if(!Emptys.check(deviceInfo)){
|
|
|
return R.fail("机器不存在");
|
|
@@ -138,12 +136,37 @@ public class MercMiniDeviceController {
|
|
|
if (deviceInfo.getFreezeStatus().equals(Integer.valueOf(DictSonEnum.DEVICE_FREEZE_STATUS_2.getKey()))) {
|
|
|
return R.fail("机器已冻结");
|
|
|
}
|
|
|
- if (deviceInfo.getActiveState().equals(Integer.valueOf(DictSonEnum.DEVICE_ACTIVE_STATUS_1.getKey()))) {
|
|
|
- return R.fail("机器已激活");
|
|
|
- }
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("isMerc")
|
|
|
+ @ApiOperation("判断设备是否归属商户")
|
|
|
+ public R isMerc(@RequestBody MercMiniDeviceDto.Active active){
|
|
|
+ DeviceInfo deviceInfo = deviceInfoService.getById(active.getDeviceId());
|
|
|
+ R checkR = this.checkDeviceByMerc(deviceInfo);
|
|
|
+ if (checkR.getCode() == R.Enum.SUCCESS.getCode()) {
|
|
|
+ if (!deviceInfo.getActiveState().equals(Integer.valueOf(DictSonEnum.DEVICE_ACTIVE_STATUS_1.getKey()))) {
|
|
|
+ return R.fail("机器未激活");
|
|
|
+ }
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+ return checkR;
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("getActiveInfo")
|
|
|
+ @ApiOperation("激活设备前判断")
|
|
|
+ public R getActiveInfo(@RequestBody MercMiniDeviceDto.Active active) {
|
|
|
+ DeviceInfo deviceInfo = deviceInfoService.getById(active.getDeviceId());
|
|
|
+ R checkR = this.checkDeviceByMerc(deviceInfo);
|
|
|
+ if (checkR.getCode() == R.Enum.SUCCESS.getCode()) {
|
|
|
+ if (deviceInfo.getActiveState().equals(Integer.valueOf(DictSonEnum.DEVICE_ACTIVE_STATUS_1.getKey()))) {
|
|
|
+ return R.fail("机器已激活");
|
|
|
+ }
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+ return checkR;
|
|
|
+ }
|
|
|
+
|
|
|
@PostMapping("active")
|
|
|
@ApiOperation("激活设备")
|
|
|
public R active(@RequestBody MercMiniDeviceDto.Active active) {
|
|
@@ -161,7 +184,6 @@ public class MercMiniDeviceController {
|
|
|
}else{
|
|
|
return activeInfo;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@PostMapping("modifyBusyStage")
|