|
@@ -4,6 +4,7 @@ import cn.hutool.core.util.BooleanUtil;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.github.yitter.idgen.YitIdHelper;
|
|
|
import com.xy.dto.DevicePartDto;
|
|
@@ -49,6 +50,18 @@ public class DevicePartServiceImpl extends ServiceImpl<DevicePartMapper, DeviceP
|
|
|
return R.ok(copy(DevicePartDto.Vo.class, list));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 检查重力配置是否开启
|
|
|
+ * @param dto
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public boolean checkWeightOpen(DevicePartDto.CheckWeightOpenDTO dto) {
|
|
|
+ DevicePart devicePart = getOne(Wrappers.lambdaQuery(DevicePart.class).eq(DevicePart::getCode, "es").eq(DevicePart::getDeviceId, dto.getDeviceId()));
|
|
|
+ String value = devicePart.getValue();
|
|
|
+ JSONObject jsonObject = JSONUtil.parseObj(value);
|
|
|
+ return BooleanUtil.isTrue(jsonObject.getBool("is"));
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation("添加或修改")
|
|
|
@PostMapping("saveOrUpdate")
|
|
|
public R saveOrUpdate(@RequestBody List<DevicePartDto.SaveOrUpdate> saveOrUpdates) {
|
|
@@ -91,4 +104,4 @@ public class DevicePartServiceImpl extends ServiceImpl<DevicePartMapper, DeviceP
|
|
|
});
|
|
|
return R.ok();
|
|
|
}
|
|
|
-}
|
|
|
+}
|