|
@@ -23,14 +23,11 @@ import lombok.SneakyThrows;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
-import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
import static com.xy.utils.Beans.copy;
|
|
@@ -133,15 +130,30 @@ public class DeviceCreateIdsServiceImpl extends ServiceImpl<DeviceCreateIdsMappe
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
- @GetMapping("exportQrCode")
|
|
|
+ @PostMapping("exportQrCode")
|
|
|
@ApiOperation("导出二维码")
|
|
|
- public void exportQrCode(@RequestParam(value = "deviceId") Long[] deviceId) {
|
|
|
- if (deviceId == null || deviceId.length == 0) {
|
|
|
- throw new CommRuntimeException("设备id不能为空");
|
|
|
+ public void exportQrCode(DeviceCreateIdsDto.ExportQrCode exportQrCode) {
|
|
|
+ List<String> list = null;
|
|
|
+ Boolean isWhere = exportQrCode.getIsWhere() == null ? false : exportQrCode.getIsWhere();
|
|
|
+ if (!isWhere) {
|
|
|
+ List<Long> deviceIds = exportQrCode.getDeviceIds();
|
|
|
+ if (Emptys.check(deviceIds)) {
|
|
|
+ for (Long aLong : deviceIds) {
|
|
|
+ list.add(aLong.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ LambdaQueryWrapper<DeviceCreateIds> lambdaQueryWrapper = new MybatisPlusQuery().eqWrapper(exportQrCode, DeviceCreateIds.class)
|
|
|
+ .ge(DeviceCreateIds::getCreateTime, exportQrCode.getBeginCreateTime())
|
|
|
+ .le(DeviceCreateIds::getCreateTime, exportQrCode.getEndCreateTime())
|
|
|
+ .ge(DeviceCreateIds::getBindTime, exportQrCode.getBeginBindTime())
|
|
|
+ .le(DeviceCreateIds::getBindTime, exportQrCode.getEndBindTime())
|
|
|
+ .build();
|
|
|
+ List<DeviceCreateIds> deviceCreateIds = list(lambdaQueryWrapper);
|
|
|
+ deviceCreateIds.forEach(deviceCreateIds1 -> list.add(String.valueOf(deviceCreateIds1.getDeviceId())));
|
|
|
}
|
|
|
- List<String> list = new ArrayList<>();
|
|
|
- for (Long aLong : deviceId) {
|
|
|
- list.add(aLong.toString());
|
|
|
+ if (!Emptys.check(list)) {
|
|
|
+ throw new CommRuntimeException("没有导出的数据");
|
|
|
}
|
|
|
QRCodeUtils.create(list, 200, 200).download(list);
|
|
|
}
|