新增 infra模块 ConfigApi借口

修改打包线、出入库数据, 编辑校验 是否为当天录入数据
This commit is contained in:
furongxin 2024-06-13 10:24:50 +08:00
parent 6de8883a50
commit 0172361fc9
11 changed files with 100 additions and 19 deletions

View File

@ -0,0 +1,23 @@
package cn.iocoder.yudao.module.infra.api.config;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.infra.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - 文件")
public interface ConfigApi {
String PREFIX = ApiConstants.PREFIX + "/config";
@GetMapping(value = "/get-value-by-key")
@Operation(summary = "根据参数键名查询参数值", description = "不可见的配置,不允许返回给前端")
@Parameter(name = "key", description = "参数键", required = true, example = "yunai.biz.username")
CommonResult<String> getConfigKey(@RequestParam("key") String key);
}

View File

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.infra.api.config;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
import cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants;
import cn.iocoder.yudao.module.infra.service.config.ConfigService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@RestController // 提供 RESTful API 接口 Feign 调用
@Validated
public class ConfigApiImpl implements ConfigApi{
@Resource
private ConfigService configService;
@Override
public CommonResult<String> getConfigKey(String key) {
ConfigDO config = configService.getConfigByKey(key);
if (config == null) {
return success(null);
}
if (!config.getVisible()) {
throw exception(ErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_VISIBLE);
}
return success(config.getValue());
}
}

View File

@ -1,10 +1,11 @@
package cn.iocoder.yudao.module.smartfactory.controller.admin.device.cameradevice.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import lombok.Data;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 设备-监控摄像头 Response VO")
@Data
@ -50,6 +51,9 @@ public class CameraDeviceRespVO {
@ExcelProperty("是否在大屏显示 0否 1是")
private Integer isShow;
@Schema(description = "排序")
private Integer sort;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;

View File

@ -2,9 +2,13 @@ package cn.iocoder.yudao.module.smartfactory.controller.admin.factorydata.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "规格明细")
@Data
@ -66,4 +70,8 @@ public class FactoryDataInfoRespVO {
@Schema(description = "出库破损数")
private Integer outDamageNum;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime createTime;
}

View File

@ -47,18 +47,9 @@ public class HikController {
@Operation(summary = "视频->云台操作")
@PermitAll
public CommonResult<String> operate(CameraOperateDTO dto) {
//判断操作权限
// Long cameraFactoryId = dto.getFactoryId();
// Long userFactoryId = SecurityUtils.getFactoryId();
// if (cameraFactoryId == null || userFactoryId == null) {
// throw new ServiceException("没有权限操控该摄像头,请联系管理员");
// }
// if (SystemConfig.getFactoryCenterId() != userFactoryId && userFactoryId.longValue() != cameraFactoryId) {
// throw new ServiceException("没有权限操控该摄像头,请联系管理员");
// }
String msg = hikService.operateCamera(dto);
return CommonResult.success(msg);
}
}

View File

@ -24,4 +24,7 @@ public class PackagePageDataRespVO {
@Schema(description = "打包线数据集", requiredMode = Schema.RequiredMode.REQUIRED)
private List<PackageDataRespVO> packageDataS;
@Schema(description = "是否可编辑 | 1可 ")
private Integer isEdit;
}

View File

@ -11,6 +11,7 @@ import org.mapstruct.factory.Mappers;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -66,6 +67,10 @@ public interface PackageDataConvert {
dataRespVO.setPackageDate(data.getKey().toString());
dataRespVO.setPackageDataS(BeanUtils.toBean(data.getValue(), PackageDataRespVO.class));
if (data.getValue().get(0).getCreateTime().equals(LocalDateTime.now())) {
dataRespVO.setIsEdit(1);
}
pageDataRespVOS.add(dataRespVO);
});
});

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.smartfactory.framework.rpc.config;
import cn.iocoder.yudao.module.infra.api.config.ConfigApi;
import cn.iocoder.yudao.module.infra.api.file.FileApi;
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
import cn.iocoder.yudao.module.system.api.dept.PostApi;
@ -14,7 +15,7 @@ import org.springframework.context.annotation.Configuration;
@Configuration(proxyBeanMethods = false)
@EnableFeignClients(clients = {FileApi.class,RoleApi.class, DeptApi.class, PostApi.class, AdminUserApi.class, SmsSendApi.class, DictDataApi.class, NotifyMessageSendApi.class,
SubscribeMessageSendApi.class
SubscribeMessageSendApi.class, ConfigApi.class
})
public class RpcConfiguration {
}

View File

@ -237,8 +237,12 @@ public class FactoryDataServiceImpl implements FactoryDataService {
info.setInNum((num + autoNum + inNum) == 0 ? null : (num + autoNum + inNum));
});
dataDetailRespVO.setItems(date.getValue());
//设置 可编辑状态
dataDetailRespVO.setIsEdit(1);
if (date.getValue().get(0).getCreateTime().equals(LocalDateTime.now())) {
//设置 可编辑状态
dataDetailRespVO.setIsEdit(1);
}
toDayData.add(dataDetailRespVO);
});

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.smartfactory.service.hik;
import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.module.infra.api.config.ConfigApi;
import cn.iocoder.yudao.module.smartfactory.constant.ArtemisApiConstant;
import cn.iocoder.yudao.module.smartfactory.controller.admin.hik.vo.CameraOperateDTO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.hik.vo.CameraReplayDTO;
@ -12,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
@ -27,6 +29,9 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.IS0_8601;
@Slf4j
public class HikServiceImpl implements HikService {
@Resource
private ConfigApi configApi;
@Override
public String getPreviewUrlsApi(String cameraCode, Integer streamType) {
final String previewUrlsApi = ArtemisApiConstant.previewUrlsApi;
@ -94,8 +99,9 @@ public class HikServiceImpl implements HikService {
put("https://", operateUrlApi);
}
};
// String speedStr = configService.selectConfigByKey(CONFIG_SPEED);
String speedStr = "";
// 获取球机 旋转速度
String speedStr = configApi.getConfigKey("sf.camera.device.speed").getCheckedData();
JSONObject body = new JSONObject();
body.set("cameraIndexCode", dto.getCameraIndexCode());

View File

@ -29,7 +29,8 @@
b.outNumId,
b.outNum,
b.outDamageNumId,
b.outDamageNum
b.outDamageNum,
a.create_time AS createTime
FROM
sf_package_data a
LEFT JOIN (
@ -99,7 +100,8 @@
MAX(CASE WHEN c.type = 2 THEN c.id END) AS outNumId,
MAX(CASE WHEN c.type = 2 THEN c.num END) AS outNum,
MAX(CASE WHEN c.type = 3 THEN c.id END) AS outDamageNumId,
MAX(CASE WHEN c.type = 3 THEN c.num END) AS outDamageNum
MAX(CASE WHEN c.type = 3 THEN c.num END) AS outDamageNum,
MAX(c.create_time) AS createTime
FROM
sf_factory_data_size AS c
WHERE