|
@@ -23,10 +23,7 @@ import com.xy.service.be.MercFeignService;
|
|
|
import com.xy.service.common.MercLineService;
|
|
|
import com.xy.service.common.MercPlaceService;
|
|
|
import com.xy.utils.*;
|
|
|
-import com.xy.utils.enums.DeviceActiveStateEnum;
|
|
|
-import com.xy.utils.enums.DeviceAuthCodeUseStatus;
|
|
|
-import com.xy.utils.enums.DeviceNetSateType;
|
|
|
-import com.xy.utils.enums.DictSonEnum;
|
|
|
+import com.xy.utils.enums.*;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
@@ -106,6 +103,16 @@ public class MercMiniDeviceController {
|
|
|
vo.setDistrictName(CollUtil.isEmpty(districtMap) ? StrUtil.EMPTY : districtMap.get(districtId));
|
|
|
DeviceStatusDto.Vo deviceStatus = vo.getDeviceStatus();
|
|
|
vo.setNetStateName(deviceStatus == null ? StrUtil.EMPTY : DeviceNetSateType.getEnumByCode(deviceStatus.getNetState()).getDescription());
|
|
|
+
|
|
|
+ Integer deviceStateL = deviceStatus.getDeviceStateL();
|
|
|
+ Integer deviceStateR = deviceStatus.getDeviceStateR();
|
|
|
+ vo.setDeviceStateL(deviceStateL);
|
|
|
+ vo.setDeviceStateR(deviceStateR);
|
|
|
+ DeviceLockState deviceLockStateL = DeviceLockState.getEnumByCode(deviceStateL);
|
|
|
+ DeviceLockState deviceLockStateR = DeviceLockState.getEnumByCode(deviceStateR);
|
|
|
+ vo.setDeviceStateRName(deviceLockStateR == null ? "未知" : deviceLockStateR.getDescription());
|
|
|
+ vo.setDeviceStateLName(deviceLockStateL == null ? "未知" : deviceLockStateL.getDescription());
|
|
|
+
|
|
|
}
|
|
|
return R.ok(vo);
|
|
|
}
|
|
@@ -117,7 +124,7 @@ public class MercMiniDeviceController {
|
|
|
return deviceInfoService.dataCount(dto);
|
|
|
}
|
|
|
|
|
|
- private R checkDeviceByMerc(DeviceInfo deviceInfo){
|
|
|
+ private R checkDeviceByMerc(DeviceInfo deviceInfo) {
|
|
|
Long mercId = MercAuthUtils.getMercId();
|
|
|
//商户是否已通过审核
|
|
|
MercDto.Vo mercInfo = mercFeignService.obj(new MercDto.ListDTO().setId(mercId)).getData();
|
|
@@ -125,7 +132,7 @@ public class MercMiniDeviceController {
|
|
|
return R.fail("商户未通过审核");
|
|
|
}
|
|
|
//设备是否存在
|
|
|
- if(!Emptys.check(deviceInfo)){
|
|
|
+ if (!Emptys.check(deviceInfo)) {
|
|
|
return R.fail("机器不存在");
|
|
|
}
|
|
|
//机器是否已授权给该商户
|
|
@@ -141,7 +148,7 @@ public class MercMiniDeviceController {
|
|
|
|
|
|
@PostMapping("isMerc")
|
|
|
@ApiOperation("判断设备是否归属商户")
|
|
|
- public R isMerc(@RequestBody MercMiniDeviceDto.Active active){
|
|
|
+ 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()) {
|
|
@@ -171,7 +178,7 @@ public class MercMiniDeviceController {
|
|
|
@ApiOperation("激活设备")
|
|
|
public R active(@RequestBody MercMiniDeviceDto.Active active) {
|
|
|
R activeInfo = this.getActiveInfo(active);
|
|
|
- if(activeInfo.getCode() == R.Enum.SUCCESS.getCode()){
|
|
|
+ if (activeInfo.getCode() == R.Enum.SUCCESS.getCode()) {
|
|
|
//激活设备
|
|
|
DeviceInfo updateDeviceInfo = new DeviceInfo()
|
|
|
.setDeviceId(active.getDeviceId())
|
|
@@ -181,7 +188,7 @@ public class MercMiniDeviceController {
|
|
|
.setShowStatus(true);
|
|
|
deviceInfoService.updateById(updateDeviceInfo);
|
|
|
return R.ok();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return activeInfo;
|
|
|
}
|
|
|
}
|