机库类型、图片展示逻辑优化
This commit is contained in:
parent
d6d624e705
commit
7081e66183
|
|
@ -84,4 +84,5 @@ public interface BusinessConstant {
|
|||
String IMAGE_PATH = "image/";
|
||||
String VIDEO_PATH = "video/";
|
||||
String VIDEO_COVER_SUFFIX = "_cover.jpeg";
|
||||
String DJI_SIGN = "DJI";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.multictrl.modules.business.dto;
|
|||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.multictrl.common.constant.BusinessConstant;
|
||||
import com.multictrl.common.validator.group.AddGroup;
|
||||
import com.multictrl.common.validator.group.UpdateGroup;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
|
@ -110,7 +111,7 @@ public class DockDTO implements Serializable {
|
|||
@Schema(hidden = true)
|
||||
@AssertTrue(message = "机库型号不能为空", groups = {AddGroup.class, UpdateGroup.class})
|
||||
public boolean isDockModelValid() {
|
||||
if (!"DJI".equals(dockType)) {
|
||||
if (!BusinessConstant.DJI_SIGN.equals(dockType)) {
|
||||
return StringUtils.isNotBlank(dockModel);
|
||||
} else {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ import com.multictrl.modules.business.entity.DockEntity;
|
|||
import com.multictrl.modules.business.service.DJIBaseService;
|
||||
import com.multictrl.modules.business.service.DockService;
|
||||
import com.multictrl.modules.security.service.ShiroService;
|
||||
import com.multictrl.modules.sys.dao.SysDictDataDao;
|
||||
import com.multictrl.modules.sys.entity.SysDictDataEntity;
|
||||
import com.multictrl.modules.sys.service.SysDictDataService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -42,7 +44,7 @@ public class DockServiceImpl extends CrudServiceImpl<DockDao, DockEntity, DockDT
|
|||
private final DockDeviceDao dockDeviceDao;
|
||||
private final DeviceDicDao deviceDicDao;
|
||||
private final ShiroService shiroService;
|
||||
private final SysDictDataService sysDictDataService;
|
||||
private final SysDictDataDao dictDataDao;
|
||||
|
||||
@Override
|
||||
public QueryWrapper<DockEntity> getWrapper(Map<String, Object> params) {
|
||||
|
|
@ -101,8 +103,19 @@ public class DockServiceImpl extends CrudServiceImpl<DockDao, DockEntity, DockDT
|
|||
}
|
||||
}
|
||||
String dockType = dockDTO.getDockType();
|
||||
if("DJI".equals(dockType)){
|
||||
// dockDTO.setImgUrl(BusinessConstant.IMAGE_PATH+ DJIImage.);
|
||||
if (BusinessConstant.DJI_SIGN.equals(dockType)) {
|
||||
DockDeviceEntity dockDevice = dockDeviceDao.selectOne(new QueryWrapper<DockDeviceEntity>().eq("sn", dockDTO.getDockSn()));
|
||||
if (dockDevice != null) {
|
||||
dockDTO.setImgUrl(BusinessConstant.IMAGE_PATH + DJIImage.getImageUrlByName(dockDevice.getDeviceName()));
|
||||
dockDTO.setDockModel(dockDevice.getDeviceName());
|
||||
}
|
||||
} else {
|
||||
String dockMode = dockDTO.getDockMode();
|
||||
List<SysDictDataEntity> list = dictDataDao.selectList(new QueryWrapper<SysDictDataEntity>()
|
||||
.eq("dict_value", dockMode).orderByAsc("create_date"));
|
||||
if (list != null) {
|
||||
dockDTO.setImgUrl(BusinessConstant.IMAGE_PATH + list.get(0).getImageUrl());
|
||||
}
|
||||
}
|
||||
}
|
||||
return page;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ import java.util.Map;
|
|||
public class SysDictDataController {
|
||||
private final SysDictDataService sysDictDataService;
|
||||
private final static String DOCK_TYPE = "dockType";
|
||||
private final static String DOCK_MODEL = "dockModel";
|
||||
|
||||
@GetMapping("page")
|
||||
@Operation(summary = "字典数据")
|
||||
|
|
@ -112,8 +111,8 @@ public class SysDictDataController {
|
|||
|
||||
@GetMapping("/getDockModel")
|
||||
@Operation(summary = "获取机库型号")
|
||||
public Result<List<SysDictDataDTO>> getDockModel() {
|
||||
List<SysDictDataDTO> list = sysDictDataService.getDictDataByType(DOCK_MODEL);
|
||||
public Result<List<SysDictDataDTO>> getDockModel(@RequestParam String dockType) {
|
||||
List<SysDictDataDTO> list = sysDictDataService.getDictDataByType(dockType);
|
||||
|
||||
return new Result<List<SysDictDataDTO>>().ok(list);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,8 +93,8 @@ public class SysDictDataServiceImpl extends BaseServiceImpl<SysDictDataDao, SysD
|
|||
.eq("dict_type_id", typeEntity.getId()).orderByAsc("sort"));
|
||||
for (SysDictDataEntity dictDataEntity : dataList) {
|
||||
String dictValue = dictDataEntity.getDictValue();
|
||||
if ("DJI".equals(dictValue)) {
|
||||
String imageUrl = DJIImage.getImageUrlByName("DJI");
|
||||
if (BusinessConstant.DJI_SIGN.equals(dictValue)) {
|
||||
String imageUrl = DJIImage.getImageUrlByName(BusinessConstant.DJI_SIGN);
|
||||
dictDataEntity.setImageUrl(BusinessConstant.IMAGE_PATH + imageUrl);
|
||||
} else {
|
||||
String imageUrl = dictDataEntity.getImageUrl();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.multictrl.modules.sys.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
|
@ -33,8 +34,8 @@ import java.util.Map;
|
|||
public class SysDictTypeServiceImpl extends BaseServiceImpl<SysDictTypeDao, SysDictTypeEntity> implements SysDictTypeService {
|
||||
private final SysDictDataDao sysDictDataDao;
|
||||
private final static List<String> DICT_TYPE_LIST = new ArrayList<>() {{
|
||||
add("dockTyp");
|
||||
add("dockModel");
|
||||
add("dockType");
|
||||
// add("dockModel");
|
||||
}};
|
||||
|
||||
@Override
|
||||
|
|
@ -68,6 +69,11 @@ public class SysDictTypeServiceImpl extends BaseServiceImpl<SysDictTypeDao, SysD
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void save(SysDictTypeDTO dto) {
|
||||
List<SysDictTypeEntity> list = baseDao.selectList(new QueryWrapper<SysDictTypeEntity>()
|
||||
.eq("dict_type", dto.getDictType()));
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
throw new RenException(ErrorCode.DICT_EXIST, dto.getDictType());
|
||||
}
|
||||
SysDictTypeEntity entity = ConvertUtils.sourceToTarget(dto, SysDictTypeEntity.class);
|
||||
|
||||
insert(entity);
|
||||
|
|
@ -80,6 +86,11 @@ public class SysDictTypeServiceImpl extends BaseServiceImpl<SysDictTypeDao, SysD
|
|||
if (DICT_TYPE_LIST.contains(typeEntity.getDictType())) {
|
||||
dto.setDictType(typeEntity.getDictType());
|
||||
}
|
||||
List<SysDictTypeEntity> list = baseDao.selectList(new QueryWrapper<SysDictTypeEntity>()
|
||||
.eq("dict_type", dto.getDictType()).ne("id", dto.getId()));
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
throw new RenException(ErrorCode.DICT_EXIST, dto.getDictType());
|
||||
}
|
||||
SysDictTypeEntity entity = ConvertUtils.sourceToTarget(dto, SysDictTypeEntity.class);
|
||||
|
||||
updateById(entity);
|
||||
|
|
@ -99,7 +110,7 @@ public class SysDictTypeServiceImpl extends BaseServiceImpl<SysDictTypeDao, SysD
|
|||
}
|
||||
}
|
||||
if (idList.isEmpty()) {
|
||||
throw new RenException(ErrorCode.DICT_NOT_DELETE, "[机库类型、机库型号]");
|
||||
throw new RenException(ErrorCode.DICT_NOT_DELETE, "[机库类型]");
|
||||
}
|
||||
//删除
|
||||
deleteBatchIds(idList);
|
||||
|
|
|
|||
|
|
@ -66,4 +66,5 @@ public interface ErrorCode {
|
|||
int FILE_NOT_EXIST = 20025;
|
||||
int UAV_LIGHT_INDEX_NOT_EXIST = 20026;
|
||||
int DICT_NOT_DELETE = 20027;
|
||||
int DICT_EXIST = 20028;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,4 +54,5 @@
|
|||
20024=\u558A\u8BDD\u5668\u6A21\u7248\u540D\u79F0\u5DF2\u5B58\u5728
|
||||
20025={0}\u6587\u4EF6\u4E0D\u5B58\u5728\uFF0C\u8BF7\u68C0\u67E5\u6587\u4EF6\u8DEF\u5F84\u662F\u5426\u6B63\u786E
|
||||
20026=\u98DE\u673A\u63A2\u7167\u706F\u8D1F\u8F7D\u4F4D\u7F6E\u672A\u83B7\u53D6\uFF0C\u8BF7\u68C0\u67E5\u98DE\u673A\u662F\u5426\u5F00\u673A
|
||||
20027={0}\u5B57\u5178\u7981\u6B62\u5220\u9664
|
||||
20027={0}\u5B57\u5178\u7981\u6B62\u5220\u9664
|
||||
20028={0}\u5B57\u5178\u5DF2\u7ECF\u5B58\u5728
|
||||
|
|
@ -809,7 +809,8 @@ CREATE TABLE "public"."sys_dict_data"
|
|||
"creator" int8,
|
||||
"create_date" timestamp(6),
|
||||
"updater" int8,
|
||||
"update_date" timestamp(6)
|
||||
"update_date" timestamp(6),
|
||||
"image_url" varchar(255) COLLATE "pg_catalog"."default"
|
||||
)
|
||||
;
|
||||
COMMENT
|
||||
|
|
@ -833,6 +834,8 @@ ON COLUMN "public"."sys_dict_data"."updater" IS '更新者';
|
|||
COMMENT
|
||||
ON COLUMN "public"."sys_dict_data"."update_date" IS '更新时间';
|
||||
COMMENT
|
||||
ON COLUMN "public"."sys_dict_data"."image_url" IS '图片地址';
|
||||
COMMENT
|
||||
ON TABLE "public"."sys_dict_data" IS '字典数据';
|
||||
|
||||
-- ----------------------------
|
||||
|
|
@ -2125,5 +2128,19 @@ VALUES (2060252437705494529, 'dockType', '机库类型', '', 1, 1067246875800000
|
|||
1067246875800000001, '2026-05-29 14:50:33.446');
|
||||
INSERT INTO "public"."sys_dict_type" ("id", "dict_type", "dict_name", "remark", "sort", "creator", "create_date",
|
||||
"updater", "update_date")
|
||||
VALUES (2060253239434121218, 'dockModel', '机库型号', '', 2, 1067246875800000001, '2026-05-29 14:53:44.593',
|
||||
VALUES (2060253239434121218, 'AROS', '阿罗斯机库', '', 2, 1067246875800000001, '2026-05-29 14:53:44.593',
|
||||
1067246875800000001, '2026-05-29 14:53:44.593');
|
||||
--20260601
|
||||
INSERT INTO "public"."sys_dict_data" ("id", "dict_type_id", "dict_label", "dict_value", "remark", "sort", "creator",
|
||||
"create_date", "updater", "update_date", "image_url")
|
||||
VALUES (2060252576792809474, 2060252437705494529, '大疆机场', 'DJI', '', 1, 1067246875800000001,
|
||||
'2026-05-29 14:51:06.607', 1067246875800000001, '2026-05-29 14:51:06.607', NULL);
|
||||
INSERT INTO "public"."sys_dict_data" ("id", "dict_type_id", "dict_label", "dict_value", "remark", "sort", "creator",
|
||||
"create_date", "updater", "update_date", "image_url")
|
||||
VALUES (2060252722469376002, 2060252437705494529, '阿罗斯', 'AROS', '', 0, 1067246875800000001,
|
||||
'2026-05-29 14:51:41.339', 1067246875800000001, '2026-05-29 14:51:41.339', 'source-material/Aros.png');
|
||||
INSERT INTO "public"."sys_dict_data" ("id", "dict_type_id", "dict_label", "dict_value", "remark", "sort", "creator",
|
||||
"create_date", "updater", "update_date", "image_url")
|
||||
VALUES (2060253516358848514, 2060253239434121218, 'Ars550', 'Ars550', '', 0, 1067246875800000001,
|
||||
'2026-05-29 14:54:50.617', 1067246875800000001, '2026-05-29 14:54:50.617', 'source-material/Ars550.png');
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 152 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 397 KiB |
Loading…
Reference in New Issue