Compare commits
2 Commits
442cd50d21
...
d6d624e705
| Author | SHA1 | Date |
|---|---|---|
|
|
d6d624e705 | |
|
|
d11c25624f |
|
|
@ -16,6 +16,7 @@ public interface BusinessConstant {
|
||||||
String DEVICE_FIRMWARE_BUCKET = "device-firmware";//设备固件桶
|
String DEVICE_FIRMWARE_BUCKET = "device-firmware";//设备固件桶
|
||||||
String SPEAKER_AUDIO_BUCKET = "speaker-audio";//喊话器音频桶
|
String SPEAKER_AUDIO_BUCKET = "speaker-audio";//喊话器音频桶
|
||||||
String GEO_MARK_BUCKET = "geo-mark";//地图标注文件桶
|
String GEO_MARK_BUCKET = "geo-mark";//地图标注文件桶
|
||||||
|
String DICT_IMAGE_BUCKET = "source-material";//字典图片桶
|
||||||
|
|
||||||
//********************************* route action *********************************//
|
//********************************* route action *********************************//
|
||||||
String DEFAULT_ACTION_TRIGGER_TYPE = "reachPoint";//默认动作触发器类型 到达航点执行
|
String DEFAULT_ACTION_TRIGGER_TYPE = "reachPoint";//默认动作触发器类型 到达航点执行
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.multictrl.common.constant;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Getter
|
||||||
|
public enum DJIImage {
|
||||||
|
DJI("DJI", "source-material/dji.png"),
|
||||||
|
DOCK1("DJI Dock1", "source-material/dock1.png"),
|
||||||
|
DOCK2("DJI Dock2", "source-material/dock2.png"),
|
||||||
|
DOCK3("DJI Dock3", "source-material/dock3.png");
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
private final String imageUrl;
|
||||||
|
|
||||||
|
//根据名称获取图片地址
|
||||||
|
public static String getImageUrlByName(String name) {
|
||||||
|
for (DJIImage djiImage : DJIImage.values()) {
|
||||||
|
if (djiImage.getName().equals(name)) {
|
||||||
|
return djiImage.getImageUrl();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -55,4 +55,15 @@ public class MinioController {
|
||||||
|
|
||||||
return new Result<String>().ok(minioService.uploadGeoMark(dockSn, file));
|
return new Result<String>().ok(minioService.uploadGeoMark(dockSn, file));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "上传字典图片")
|
||||||
|
@PostMapping("/uploadDictImage")
|
||||||
|
public Result<String> uploadDictImage(
|
||||||
|
@RequestParam("file") MultipartFile file) {
|
||||||
|
if (file.isEmpty()) {
|
||||||
|
return new Result<String>().error(ErrorCode.UPLOAD_FILE_EMPTY);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Result<String>().ok(minioService.uploadDictImage( file));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,16 @@
|
||||||
package com.multictrl.modules.business.dto;
|
package com.multictrl.modules.business.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.multictrl.common.validator.group.AddGroup;
|
import com.multictrl.common.validator.group.AddGroup;
|
||||||
import com.multictrl.common.validator.group.UpdateGroup;
|
import com.multictrl.common.validator.group.UpdateGroup;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.AssertTrue;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Null;
|
import jakarta.validation.constraints.Null;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -46,8 +49,8 @@ public class DockDTO implements Serializable {
|
||||||
@Schema(description = "机库类型")
|
@Schema(description = "机库类型")
|
||||||
private String dockType;
|
private String dockType;
|
||||||
|
|
||||||
@NotBlank(message = "{dock.model.require}", groups = {AddGroup.class, UpdateGroup.class})
|
// @NotBlank(message = "{dock.model.require}", groups = {AddGroup.class, UpdateGroup.class})
|
||||||
@JsonProperty(required = true)
|
// @JsonProperty(required = true)
|
||||||
@Schema(description = "机库型号")
|
@Schema(description = "机库型号")
|
||||||
private String dockModel;
|
private String dockModel;
|
||||||
|
|
||||||
|
|
@ -102,4 +105,15 @@ public class DockDTO implements Serializable {
|
||||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
@Schema(description = "机库模式")
|
@Schema(description = "机库模式")
|
||||||
private String dockMode;
|
private String dockMode;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
@Schema(hidden = true)
|
||||||
|
@AssertTrue(message = "机库型号不能为空", groups = {AddGroup.class, UpdateGroup.class})
|
||||||
|
public boolean isDockModelValid() {
|
||||||
|
if (!"DJI".equals(dockType)) {
|
||||||
|
return StringUtils.isNotBlank(dockModel);
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,4 +42,7 @@ public interface MinioService {
|
||||||
|
|
||||||
//上传地图标注文件
|
//上传地图标注文件
|
||||||
String uploadGeoMark(String dockSn, MultipartFile file);
|
String uploadGeoMark(String dockSn, MultipartFile file);
|
||||||
|
|
||||||
|
//上传字典图片
|
||||||
|
String uploadDictImage(MultipartFile file);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@ import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.multictrl.common.annotation.DataFilter;
|
||||||
|
import com.multictrl.common.constant.BusinessConstant;
|
||||||
|
import com.multictrl.common.constant.DJIImage;
|
||||||
import com.multictrl.common.constant.DockMode;
|
import com.multictrl.common.constant.DockMode;
|
||||||
import com.multictrl.common.page.PageData;
|
import com.multictrl.common.page.PageData;
|
||||||
import com.multictrl.common.service.impl.CrudServiceImpl;
|
import com.multictrl.common.service.impl.CrudServiceImpl;
|
||||||
|
|
@ -18,6 +21,7 @@ import com.multictrl.modules.business.entity.DockEntity;
|
||||||
import com.multictrl.modules.business.service.DJIBaseService;
|
import com.multictrl.modules.business.service.DJIBaseService;
|
||||||
import com.multictrl.modules.business.service.DockService;
|
import com.multictrl.modules.business.service.DockService;
|
||||||
import com.multictrl.modules.security.service.ShiroService;
|
import com.multictrl.modules.security.service.ShiroService;
|
||||||
|
import com.multictrl.modules.sys.service.SysDictDataService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
@ -38,6 +42,7 @@ public class DockServiceImpl extends CrudServiceImpl<DockDao, DockEntity, DockDT
|
||||||
private final DockDeviceDao dockDeviceDao;
|
private final DockDeviceDao dockDeviceDao;
|
||||||
private final DeviceDicDao deviceDicDao;
|
private final DeviceDicDao deviceDicDao;
|
||||||
private final ShiroService shiroService;
|
private final ShiroService shiroService;
|
||||||
|
private final SysDictDataService sysDictDataService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueryWrapper<DockEntity> getWrapper(Map<String, Object> params) {
|
public QueryWrapper<DockEntity> getWrapper(Map<String, Object> params) {
|
||||||
|
|
@ -75,6 +80,7 @@ public class DockServiceImpl extends CrudServiceImpl<DockDao, DockEntity, DockDT
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@DataFilter
|
||||||
public PageData<DockDTO> pageList(Map<String, Object> params) {
|
public PageData<DockDTO> pageList(Map<String, Object> params) {
|
||||||
PageData<DockDTO> page = page(params);
|
PageData<DockDTO> page = page(params);
|
||||||
for (DockDTO dockDTO : page.getList()) {
|
for (DockDTO dockDTO : page.getList()) {
|
||||||
|
|
@ -94,6 +100,10 @@ public class DockServiceImpl extends CrudServiceImpl<DockDao, DockEntity, DockDT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
String dockType = dockDTO.getDockType();
|
||||||
|
if("DJI".equals(dockType)){
|
||||||
|
// dockDTO.setImgUrl(BusinessConstant.IMAGE_PATH+ DJIImage.);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -197,6 +197,20 @@ public class MinioServiceImpl implements MinioService {
|
||||||
return BusinessConstant.GEO_MARK_BUCKET + "/" + path;
|
return BusinessConstant.GEO_MARK_BUCKET + "/" + path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String uploadDictImage(MultipartFile file) {
|
||||||
|
//文件路径
|
||||||
|
String path = DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN_COMPACT) + "." + FileNameUtil.extName(file.getOriginalFilename());
|
||||||
|
try {
|
||||||
|
uploadFile(file.getInputStream(), BusinessConstant.DICT_IMAGE_BUCKET, path);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(ExceptionUtils.getErrorStackTrace(e));
|
||||||
|
throw new RenException(ErrorCode.OSS_UPLOAD_FILE_ERROR, file.getOriginalFilename());
|
||||||
|
}
|
||||||
|
|
||||||
|
return BusinessConstant.DICT_IMAGE_BUCKET + "/" + path;
|
||||||
|
}
|
||||||
|
|
||||||
private String getMimeType(String fileName) {
|
private String getMimeType(String fileName) {
|
||||||
if (fileName == null) return "application/octet-stream";
|
if (fileName == null) return "application/octet-stream";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import lombok.AllArgsConstructor;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -32,6 +33,8 @@ import java.util.Map;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class SysDictDataController {
|
public class SysDictDataController {
|
||||||
private final SysDictDataService sysDictDataService;
|
private final SysDictDataService sysDictDataService;
|
||||||
|
private final static String DOCK_TYPE = "dockType";
|
||||||
|
private final static String DOCK_MODEL = "dockModel";
|
||||||
|
|
||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
@Operation(summary = "字典数据")
|
@Operation(summary = "字典数据")
|
||||||
|
|
@ -99,4 +102,20 @@ public class SysDictDataController {
|
||||||
return new Result<Object>();
|
return new Result<Object>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getDockType")
|
||||||
|
@Operation(summary = "获取机库类型")
|
||||||
|
public Result<List<SysDictDataDTO>> getDockType() {
|
||||||
|
List<SysDictDataDTO> list = sysDictDataService.getDictDataByType(DOCK_TYPE);
|
||||||
|
|
||||||
|
return new Result<List<SysDictDataDTO>>().ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getDockModel")
|
||||||
|
@Operation(summary = "获取机库型号")
|
||||||
|
public Result<List<SysDictDataDTO>> getDockModel() {
|
||||||
|
List<SysDictDataDTO> list = sysDictDataService.getDictDataByType(DOCK_MODEL);
|
||||||
|
|
||||||
|
return new Result<List<SysDictDataDTO>>().ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,39 +21,42 @@ import java.util.Date;
|
||||||
* @author Sdy
|
* @author Sdy
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Schema(title = "字典数据")
|
@Schema(name = "字典数据")
|
||||||
public class SysDictDataDTO implements Serializable {
|
public class SysDictDataDTO implements Serializable {
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Schema(title = "id")
|
@Schema(description = "id")
|
||||||
@Null(message = "{id.null}", groups = AddGroup.class)
|
@Null(message = "{id.null}", groups = AddGroup.class)
|
||||||
@NotNull(message = "{id.require}", groups = UpdateGroup.class)
|
@NotNull(message = "{id.require}", groups = UpdateGroup.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Schema(title = "字典类型ID")
|
@Schema(description = "字典类型ID")
|
||||||
@NotNull(message = "{sysdict.type.require}", groups = DefaultGroup.class)
|
@NotNull(message = "{sysdict.type.require}", groups = DefaultGroup.class)
|
||||||
private Long dictTypeId;
|
private Long dictTypeId;
|
||||||
|
|
||||||
@Schema(title = "字典标签")
|
@Schema(description = "字典标签")
|
||||||
@NotBlank(message = "{sysdict.label.require}", groups = DefaultGroup.class)
|
@NotBlank(message = "{sysdict.label.require}", groups = DefaultGroup.class)
|
||||||
private String dictLabel;
|
private String dictLabel;
|
||||||
|
|
||||||
@Schema(title = "字典值")
|
@Schema(description = "字典值")
|
||||||
private String dictValue;
|
private String dictValue;
|
||||||
|
|
||||||
@Schema(title = "备注")
|
@Schema(description = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
@Schema(title = "排序")
|
@Schema(description = "排序")
|
||||||
@Min(value = 0, message = "{sort.number}", groups = DefaultGroup.class)
|
@Min(value = 0, message = "{sort.number}", groups = DefaultGroup.class)
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
@Schema(title = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
private Date createDate;
|
private Date createDate;
|
||||||
|
|
||||||
@Schema(title = "更新时间")
|
@Schema(description = "更新时间")
|
||||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
private Date updateDate;
|
private Date updateDate;
|
||||||
|
|
||||||
|
@Schema(description = "图片地址")
|
||||||
|
private String imageUrl;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,4 +51,8 @@ public class SysDictDataEntity extends BaseEntity {
|
||||||
*/
|
*/
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
private Date updateDate;
|
private Date updateDate;
|
||||||
|
/**
|
||||||
|
* 图片地址
|
||||||
|
*/
|
||||||
|
private String imageUrl;
|
||||||
}
|
}
|
||||||
|
|
@ -5,6 +5,7 @@ import com.multictrl.common.service.BaseService;
|
||||||
import com.multictrl.modules.sys.dto.SysDictDataDTO;
|
import com.multictrl.modules.sys.dto.SysDictDataDTO;
|
||||||
import com.multictrl.modules.sys.entity.SysDictDataEntity;
|
import com.multictrl.modules.sys.entity.SysDictDataEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -24,4 +25,7 @@ public interface SysDictDataService extends BaseService<SysDictDataEntity> {
|
||||||
|
|
||||||
void delete(Long[] ids);
|
void delete(Long[] ids);
|
||||||
|
|
||||||
|
//获取指定类型
|
||||||
|
List<SysDictDataDTO> getDictDataByType(String type);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -2,18 +2,24 @@ package com.multictrl.modules.sys.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.multictrl.common.constant.BusinessConstant;
|
||||||
|
import com.multictrl.common.constant.DJIImage;
|
||||||
import com.multictrl.common.page.PageData;
|
import com.multictrl.common.page.PageData;
|
||||||
import com.multictrl.common.service.impl.BaseServiceImpl;
|
import com.multictrl.common.service.impl.BaseServiceImpl;
|
||||||
import com.multictrl.common.utils.ConvertUtils;
|
import com.multictrl.common.utils.ConvertUtils;
|
||||||
import com.multictrl.modules.sys.dao.SysDictDataDao;
|
import com.multictrl.modules.sys.dao.SysDictDataDao;
|
||||||
|
import com.multictrl.modules.sys.dao.SysDictTypeDao;
|
||||||
import com.multictrl.modules.sys.dto.SysDictDataDTO;
|
import com.multictrl.modules.sys.dto.SysDictDataDTO;
|
||||||
import com.multictrl.modules.sys.entity.SysDictDataEntity;
|
import com.multictrl.modules.sys.entity.SysDictDataEntity;
|
||||||
|
import com.multictrl.modules.sys.entity.SysDictTypeEntity;
|
||||||
import com.multictrl.modules.sys.service.SysDictDataService;
|
import com.multictrl.modules.sys.service.SysDictDataService;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -22,7 +28,9 @@ import java.util.Map;
|
||||||
* @author Sdy
|
* @author Sdy
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class SysDictDataServiceImpl extends BaseServiceImpl<SysDictDataDao, SysDictDataEntity> implements SysDictDataService {
|
public class SysDictDataServiceImpl extends BaseServiceImpl<SysDictDataDao, SysDictDataEntity> implements SysDictDataService {
|
||||||
|
private final SysDictTypeDao sysDictTypeDao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageData<SysDictDataDTO> page(Map<String, Object> params) {
|
public PageData<SysDictDataDTO> page(Map<String, Object> params) {
|
||||||
|
|
@ -77,4 +85,27 @@ public class SysDictDataServiceImpl extends BaseServiceImpl<SysDictDataDao, SysD
|
||||||
deleteBatchIds(Arrays.asList(ids));
|
deleteBatchIds(Arrays.asList(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysDictDataDTO> getDictDataByType(String type) {
|
||||||
|
SysDictTypeEntity typeEntity = sysDictTypeDao.selectOne(new QueryWrapper<SysDictTypeEntity>().eq("dict_type", type));
|
||||||
|
if (typeEntity != null) {
|
||||||
|
List<SysDictDataEntity> dataList = baseDao.selectList(new QueryWrapper<SysDictDataEntity>()
|
||||||
|
.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");
|
||||||
|
dictDataEntity.setImageUrl(BusinessConstant.IMAGE_PATH + imageUrl);
|
||||||
|
} else {
|
||||||
|
String imageUrl = dictDataEntity.getImageUrl();
|
||||||
|
if (StrUtil.isNotBlank(imageUrl)) {
|
||||||
|
dictDataEntity.setImageUrl(BusinessConstant.IMAGE_PATH + imageUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ConvertUtils.sourceToTarget(dataList, SysDictDataDTO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,6 +3,8 @@ package com.multictrl.modules.sys.service.impl;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.multictrl.common.exception.ErrorCode;
|
||||||
|
import com.multictrl.common.exception.RenException;
|
||||||
import com.multictrl.common.page.PageData;
|
import com.multictrl.common.page.PageData;
|
||||||
import com.multictrl.common.service.impl.BaseServiceImpl;
|
import com.multictrl.common.service.impl.BaseServiceImpl;
|
||||||
import com.multictrl.common.utils.ConvertUtils;
|
import com.multictrl.common.utils.ConvertUtils;
|
||||||
|
|
@ -13,11 +15,11 @@ import com.multictrl.modules.sys.entity.DictData;
|
||||||
import com.multictrl.modules.sys.entity.DictType;
|
import com.multictrl.modules.sys.entity.DictType;
|
||||||
import com.multictrl.modules.sys.entity.SysDictTypeEntity;
|
import com.multictrl.modules.sys.entity.SysDictTypeEntity;
|
||||||
import com.multictrl.modules.sys.service.SysDictTypeService;
|
import com.multictrl.modules.sys.service.SysDictTypeService;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -27,9 +29,13 @@ import java.util.Map;
|
||||||
* @author Sdy
|
* @author Sdy
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@AllArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class SysDictTypeServiceImpl extends BaseServiceImpl<SysDictTypeDao, SysDictTypeEntity> implements SysDictTypeService {
|
public class SysDictTypeServiceImpl extends BaseServiceImpl<SysDictTypeDao, SysDictTypeEntity> implements SysDictTypeService {
|
||||||
private final SysDictDataDao sysDictDataDao;
|
private final SysDictDataDao sysDictDataDao;
|
||||||
|
private final static List<String> DICT_TYPE_LIST = new ArrayList<>() {{
|
||||||
|
add("dockTyp");
|
||||||
|
add("dockModel");
|
||||||
|
}};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageData<SysDictTypeDTO> page(Map<String, Object> params) {
|
public PageData<SysDictTypeDTO> page(Map<String, Object> params) {
|
||||||
|
|
@ -70,6 +76,10 @@ public class SysDictTypeServiceImpl extends BaseServiceImpl<SysDictTypeDao, SysD
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void update(SysDictTypeDTO dto) {
|
public void update(SysDictTypeDTO dto) {
|
||||||
|
SysDictTypeEntity typeEntity = selectById(dto.getId());
|
||||||
|
if (DICT_TYPE_LIST.contains(typeEntity.getDictType())) {
|
||||||
|
dto.setDictType(typeEntity.getDictType());
|
||||||
|
}
|
||||||
SysDictTypeEntity entity = ConvertUtils.sourceToTarget(dto, SysDictTypeEntity.class);
|
SysDictTypeEntity entity = ConvertUtils.sourceToTarget(dto, SysDictTypeEntity.class);
|
||||||
|
|
||||||
updateById(entity);
|
updateById(entity);
|
||||||
|
|
@ -78,8 +88,21 @@ public class SysDictTypeServiceImpl extends BaseServiceImpl<SysDictTypeDao, SysD
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void delete(Long[] ids) {
|
public void delete(Long[] ids) {
|
||||||
|
List<Long> idList = new ArrayList<>();
|
||||||
|
for (Long id : ids) {
|
||||||
|
SysDictTypeEntity typeEntity = selectById(id);
|
||||||
|
if (typeEntity != null) {
|
||||||
|
String dictType = typeEntity.getDictType();
|
||||||
|
if (!DICT_TYPE_LIST.contains(dictType)) {
|
||||||
|
idList.add(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (idList.isEmpty()) {
|
||||||
|
throw new RenException(ErrorCode.DICT_NOT_DELETE, "[机库类型、机库型号]");
|
||||||
|
}
|
||||||
//删除
|
//删除
|
||||||
deleteBatchIds(Arrays.asList(ids));
|
deleteBatchIds(idList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -65,4 +65,5 @@ public interface ErrorCode {
|
||||||
int SPEAKER_NAME_EXIST = 20024;
|
int SPEAKER_NAME_EXIST = 20024;
|
||||||
int FILE_NOT_EXIST = 20025;
|
int FILE_NOT_EXIST = 20025;
|
||||||
int UAV_LIGHT_INDEX_NOT_EXIST = 20026;
|
int UAV_LIGHT_INDEX_NOT_EXIST = 20026;
|
||||||
|
int DICT_NOT_DELETE = 20027;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,3 +54,4 @@
|
||||||
20024=\u558A\u8BDD\u5668\u6A21\u7248\u540D\u79F0\u5DF2\u5B58\u5728
|
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
|
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
|
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
|
||||||
|
|
@ -2117,3 +2117,13 @@ ALTER TABLE public.bus_route
|
||||||
ADD COLUMN q20_route_id varchar(50);
|
ADD COLUMN q20_route_id varchar(50);
|
||||||
COMMENT
|
COMMENT
|
||||||
ON COLUMN "public"."bus_route"."q20_route_id" IS 'q20航线id';
|
ON COLUMN "public"."bus_route"."q20_route_id" IS 'q20航线id';
|
||||||
|
|
||||||
|
--20260529
|
||||||
|
INSERT INTO "public"."sys_dict_type" ("id", "dict_type", "dict_name", "remark", "sort", "creator", "create_date",
|
||||||
|
"updater", "update_date")
|
||||||
|
VALUES (2060252437705494529, 'dockType', '机库类型', '', 1, 1067246875800000001, '2026-05-29 14:50:33.446',
|
||||||
|
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',
|
||||||
|
1067246875800000001, '2026-05-29 14:53:44.593');
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 634 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 528 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 451 KiB |
Loading…
Reference in New Issue