diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/CsEquipmentDeliveryVO.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/CsEquipmentDeliveryVO.java index 818eaa1..0217788 100644 --- a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/CsEquipmentDeliveryVO.java +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/CsEquipmentDeliveryVO.java @@ -86,4 +86,6 @@ public class CsEquipmentDeliveryVO extends BaseEntity { @ApiModelProperty(value="装置使用状态(0:停用 1:启用)") private Integer usageStatus ; + private Integer sort; + } \ No newline at end of file diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/utils/StringUtil.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/utils/StringUtil.java new file mode 100644 index 0000000..062d71f --- /dev/null +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/utils/StringUtil.java @@ -0,0 +1,30 @@ +package com.njcn.csdevice.utils; + +import com.njcn.common.pojo.exception.BusinessException; + +import java.util.regex.Pattern; + +/** + * Description: + * Date: 2024/12/17 14:29【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +public class StringUtil { + public static void containsSpecialCharacters(String str) { + // 定义包含特殊字符的正则表达式 + String specialChars = "[<>%'%;()&+/\\\\-\\\\\\\\_|@*?#$!,.]|html"; + // 创建Pattern对象 + Pattern pattern = Pattern.compile(specialChars); + // 使用Pattern对象的matcher方法检查字符串 + if(pattern.matcher(str).find()){ + throw new BusinessException("存在特殊字符[<>\"'%;()&+//\\-———|@*_?#$!,.html]"); + } + + } + + public static void main(String[] args) { + StringUtil.containsSpecialCharacters("*"); + } +} diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/equipment/EquipmentDeliveryController.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/equipment/EquipmentDeliveryController.java index 448716e..b44f3fb 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/equipment/EquipmentDeliveryController.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/equipment/EquipmentDeliveryController.java @@ -23,6 +23,11 @@ import com.njcn.csdevice.service.IMqttUserService; import com.njcn.csdevice.utils.ExcelStyleUtil; import com.njcn.poi.excel.ExcelUtil; import com.njcn.poi.util.PoiUtil; +import com.njcn.system.api.DicDataFeignClient; +import com.njcn.system.api.DictTreeFeignClient; +import com.njcn.system.enums.DicDataTypeEnum; +import com.njcn.system.pojo.po.SysDicTreePO; +import com.njcn.system.pojo.vo.DictTreeVO; import com.njcn.web.advice.DeviceLog; import com.njcn.web.controller.BaseController; import io.swagger.annotations.*; @@ -30,6 +35,7 @@ import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.usermodel.Workbook; import org.springframework.beans.BeanUtils; +import org.springframework.util.CollectionUtils; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -37,6 +43,7 @@ import springfox.documentation.annotations.ApiIgnore; import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -62,6 +69,8 @@ public class EquipmentDeliveryController extends BaseController { private final IMqttUserService mqttUserService; private final CsDevModelRelationService csDevModelRelationService; + private final DictTreeFeignClient dictTreeFeignClient; + @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/addEquipmentDelivery") @ApiOperation("新增出厂设备") @@ -221,7 +230,13 @@ public class EquipmentDeliveryController extends BaseController { ExportParams exportParams = new ExportParams("批量导入模板(请严格按照模板标准填入数据)", "终端入网检测录入信息"); exportParams.setStyle(ExcelStyleUtil.class); Workbook workbook = ExcelExportUtil.exportExcel(exportParams, DeviceExcelTemplete.class, new ArrayList()); - ExcelUtil.selectList(workbook, 2, 2, Stream.of("直连设备","网关设备").collect(Collectors.toList()).toArray(new String[]{})); + List deviceType = dictTreeFeignClient.queryByCodeList(DicDataTypeEnum.DEVICE_TYPE.getCode()).getData(); + if(!CollectionUtils.isEmpty(deviceType)){ + List collect = deviceType.get(0).getChildren().stream().map(SysDicTreePO::getName).collect(Collectors.toList()); + ExcelUtil.selectList(workbook, 2, 2, collect.toArray(new String[]{})); + List collect2 = deviceType.get(0).getChildren().stream().map(SysDicTreePO::getChildren).flatMap(Collection::stream).map(SysDicTreePO::getName).collect(Collectors.toList()); + ExcelUtil.selectList(workbook, 3, 3, collect2.toArray(new String[]{})); + } ExcelUtil.selectList(workbook, 4, 4, Stream.of("MQTT","CLD").collect(Collectors.toList()).toArray(new String[]{})); String fileName = "设备模板.xlsx"; ExportParams exportExcel = new ExportParams("设备模板", "设备模板"); diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/mapping/WlRecordMapper.xml b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/mapping/WlRecordMapper.xml index 0546865..cd9e62c 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/mapping/WlRecordMapper.xml +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/mapping/WlRecordMapper.xml @@ -64,7 +64,7 @@ exists (select 1 from wl_record_test_data wd where wd.test_item_id = #{wlRecordPageParam.id} and wd.data_id = a.id) - order by a.start_time asc + order by a.start_time desc