代码调整、修改设备检测人bug

This commit is contained in:
caozehui
2025-03-28 09:32:50 +08:00
parent fef01b692a
commit 48408859b1
22 changed files with 107 additions and 39 deletions

View File

@@ -62,9 +62,19 @@ public class SysTestConfigController extends BaseController {
@GetMapping("/getCurrentScene")
public HttpResult<String> getCurrentScene() {
String methodDescribe = getMethodDescribe("getCurrentScene");
LogUtil.njcnDebug(log, "{},获取当前场景", methodDescribe);
LogUtil.njcnDebug(log, "{}", methodDescribe);
String currrentScene = sysTestConfigService.getCurrrentScene();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, currrentScene, methodDescribe);
}
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("获取是否在检测时同时生成报告")
@GetMapping("/getAutoGenerate")
public HttpResult<Integer> getAutoGenerate() {
String methodDescribe = getMethodDescribe("getAutoGenerate");
LogUtil.njcnDebug(log, "{}", methodDescribe);
Integer autoGenerate = sysTestConfigService.getAutoGenerate();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, autoGenerate, methodDescribe);
}
}

View File

@@ -37,4 +37,11 @@ public interface ISysTestConfigService extends IService<SysTestConfig> {
SysTestConfig getOneConfig();
String getCurrrentScene();
/**
* 获取是否在检测时自动生成报告
*
* @return 0-否1-是
*/
Integer getAutoGenerate();
}

View File

@@ -73,4 +73,9 @@ public class SysTestConfigServiceImpl extends ServiceImpl<SysTestConfigMapper, S
}
return null;
}
@Override
public Integer getAutoGenerate() {
return getOneConfig().getAutoGenerate();
}
}

View File

@@ -17,14 +17,14 @@ public class DictDataExcel implements Serializable {
/**
* 字典数据表Id
*/
@Excel(name = "字典数据id", width = 40)
private String id;
// @Excel(name = "字典数据id", width = 40)
// private String id;
/**
* 字典类型表Id
*/
@Excel(name = "字典类型id", width = 40)
private String typeId;
// @Excel(name = "字典类型id", width = 40)
// private String typeId;
/**
* 名称

View File

@@ -1,11 +1,11 @@
package com.njcn.gather.system.dictionary.pojo.vo;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.AllArgsConstructor;
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author caozehui
@@ -15,45 +15,42 @@ import java.time.LocalDateTime;
public class DictTypeExcel implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 字典类型表Id
*/
@Excel(name = "id", width = 40)
private String id;
/**
* 名称
*/
@Excel(name = "名称", width = 20)
@Excel(name = "名称", width = 20, needMerge = true)
private String name;
/**
* 编码
*/
@Excel(name = "编码", width = 20)
@Excel(name = "编码", width = 20, needMerge = true)
private String code;
/**
* 排序
*/
@Excel(name = "排序", width = 15)
@Excel(name = "排序", width = 15, needMerge = true)
private Integer sort;
/**
* 开启等级0-不开启1-开启,默认不开启
*/
@Excel(name = "开启等级", width = 15, replace = {"开启_1", "不开启_0"})
@Excel(name = "开启等级", width = 15, replace = {"开启_1", "不开启_0"}, needMerge = true)
private Integer openLevel;
/**
* 开启描述0-不开启1-开启,默认不开启
*/
@Excel(name = "开启描述", width = 15, replace = {"开启_1", "不开启_0"})
@Excel(name = "开启描述", width = 15, replace = {"开启_1", "不开启_0"}, needMerge = true)
private Integer openDescribe;
/**
* 描述
*/
@Excel(name = "描述", width = 50)
@Excel(name = "描述", width = 50, needMerge = true)
private String remark;
@ExcelCollection(name = "字典内容")
private List<DictDataExcel> dictDataExcels;
}

View File

@@ -26,6 +26,14 @@ public interface IDictDataService extends IService<DictData> {
*/
Page<DictData> getDictDataByTypeId(DictDataParam.QueryParam queryParam);
/**
* 根据字典类型id查询该类型下所有字典数据
*
* @param typeId
* @return
*/
List<DictData> listDictDataByTypeId(String typeId);
/**
* 根据字典类型id查询字典信息
* @param typeId 字典类型id

View File

@@ -64,6 +64,11 @@ public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> i
return this.baseMapper.selectPage(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), queryWrapper);
}
@Override
public List<DictData> listDictDataByTypeId(String typeId) {
return this.lambdaQuery().eq(DictData::getTypeId, typeId).eq(DictData::getState, DataStateEnum.ENABLE.getCode()).list();
}
@Override
public List<DictData> getDictDataByTypeId(String typeId) {
return this.lambdaQuery().eq(DictData::getTypeId, typeId).eq(DictData::getState, DataStateEnum.ENABLE.getCode()).list();

View File

@@ -12,7 +12,9 @@ import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.db.mybatisplus.constant.DbConstant;
import com.njcn.gather.system.dictionary.mapper.DictTypeMapper;
import com.njcn.gather.system.dictionary.pojo.param.DictTypeParam;
import com.njcn.gather.system.dictionary.pojo.po.DictData;
import com.njcn.gather.system.dictionary.pojo.po.DictType;
import com.njcn.gather.system.dictionary.pojo.vo.DictDataExcel;
import com.njcn.gather.system.dictionary.pojo.vo.DictTypeExcel;
import com.njcn.gather.system.dictionary.service.IDictDataService;
import com.njcn.gather.system.dictionary.service.IDictTypeService;
@@ -23,6 +25,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
@@ -100,7 +103,16 @@ public class DictTypeServiceImpl extends ServiceImpl<DictTypeMapper, DictType> i
}
queryWrapper.ne("sys_dict_type.state", DataStateEnum.DELETED.getCode());
List<DictType> dictTypes = this.list(queryWrapper);
List<DictTypeExcel> dictTypeVOS = BeanUtil.copyToList(dictTypes, DictTypeExcel.class);
List<DictTypeExcel> dictTypeVOS = new ArrayList<>();
dictTypes.forEach(dictType -> {
DictTypeExcel dictTypeExcel = BeanUtil.copyProperties(dictType, DictTypeExcel.class);
List<DictData> dictDataList = dictDataService.listDictDataByTypeId(dictType.getId());
List<DictDataExcel> dictDataExcels = BeanUtil.copyToList(dictDataList, DictDataExcel.class);
dictTypeExcel.setDictDataExcels(dictDataExcels);
dictTypeVOS.add(dictTypeExcel);
});
ExcelUtil.exportExcel("字典类型导出数据.xlsx", "字典类型", DictTypeExcel.class, dictTypeVOS);
}