|
@@ -10,6 +10,7 @@ import com.zd.bottle.vo.WebUseRecordVo;
|
|
|
import com.zd.common.core.domain.per.PerFun;
|
|
import com.zd.common.core.domain.per.PerFun;
|
|
|
import com.zd.common.core.domain.per.PerPrefix;
|
|
import com.zd.common.core.domain.per.PerPrefix;
|
|
|
import com.zd.common.core.utils.DateUtils;
|
|
import com.zd.common.core.utils.DateUtils;
|
|
|
|
|
+import com.zd.common.core.utils.SecurityUtils;
|
|
|
import com.zd.common.core.utils.poi.ExcelUtil;
|
|
import com.zd.common.core.utils.poi.ExcelUtil;
|
|
|
import com.zd.common.core.web.controller.BaseController;
|
|
import com.zd.common.core.web.controller.BaseController;
|
|
|
import com.zd.common.core.web.page.TableDataInfo;
|
|
import com.zd.common.core.web.page.TableDataInfo;
|
|
@@ -19,6 +20,7 @@ import com.zd.common.response.ResultData;
|
|
|
import com.zd.common.security.annotation.PreAuthorize;
|
|
import com.zd.common.security.annotation.PreAuthorize;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
+import org.apache.hadoop.security.SecurityUtil;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
@@ -46,13 +48,34 @@ public class UseRecordController extends BaseController<UseRecord> {
|
|
|
private UseRecordService useRecordService;
|
|
private UseRecordService useRecordService;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 查询使用记录列表
|
|
|
|
|
|
|
+ * 查询使用记录列表(学生端)
|
|
|
*/
|
|
*/
|
|
|
@PreAuthorize(hasPermi = PerPrefix.BOTTLE_USERECORD + PerFun.LIST)
|
|
@PreAuthorize(hasPermi = PerPrefix.BOTTLE_USERECORD + PerFun.LIST)
|
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
|
@ApiOperation(value = "查询使用记录列表")
|
|
@ApiOperation(value = "查询使用记录列表")
|
|
|
public TableDataInfo<UseRecordVo> list(UseRecord useRecord) {
|
|
public TableDataInfo<UseRecordVo> list(UseRecord useRecord) {
|
|
|
startPage("use_time","descending");
|
|
startPage("use_time","descending");
|
|
|
|
|
+ useRecord.setUserId(SecurityUtils.getUserId());
|
|
|
|
|
+ List<UseRecord> records =useRecordService.getList(useRecord);
|
|
|
|
|
+ TableDataInfo<UseRecord> dataTable = getDataTable(records);
|
|
|
|
|
+ TableDataInfo<UseRecordVo> info = new TableDataInfo<>();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(records)) {
|
|
|
|
|
+ BeanUtils.copyProperties(dataTable, info);
|
|
|
|
|
+ List<UseRecordVo> recordVos = useRecordService.getListVo(records);
|
|
|
|
|
+ info.setRows(recordVos);
|
|
|
|
|
+ }
|
|
|
|
|
+ return info;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询使用记录列表(管理端)
|
|
|
|
|
+ */
|
|
|
|
|
+ @PreAuthorize(hasPermi = PerPrefix.BOTTLE_USERECORDADMIN + PerFun.LIST)
|
|
|
|
|
+ @GetMapping("/listByAdmin")
|
|
|
|
|
+ @ApiOperation(value = "查询使用记录列表")
|
|
|
|
|
+ public TableDataInfo<UseRecordVo> listByAdmin(UseRecord useRecord) {
|
|
|
|
|
+ startPage("use_time","descending");
|
|
|
List<UseRecord> records =useRecordService.getList(useRecord);
|
|
List<UseRecord> records =useRecordService.getList(useRecord);
|
|
|
TableDataInfo<UseRecord> dataTable = getDataTable(records);
|
|
TableDataInfo<UseRecord> dataTable = getDataTable(records);
|
|
|
TableDataInfo<UseRecordVo> info = new TableDataInfo<>();
|
|
TableDataInfo<UseRecordVo> info = new TableDataInfo<>();
|
|
@@ -76,13 +99,39 @@ public class UseRecordController extends BaseController<UseRecord> {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 导出使用记录列表
|
|
|
|
|
|
|
+ * 导出使用记录列表(学生端)
|
|
|
*/
|
|
*/
|
|
|
@PreAuthorize(hasPermi = PerPrefix.BOTTLE_USERECORD + PerFun.EXPORT)
|
|
@PreAuthorize(hasPermi = PerPrefix.BOTTLE_USERECORD + PerFun.EXPORT)
|
|
|
@ApiOperation(value = "导出使用记录列表")
|
|
@ApiOperation(value = "导出使用记录列表")
|
|
|
@Log(title = "使用记录", businessType = BusinessType.EXPORT)
|
|
@Log(title = "使用记录", businessType = BusinessType.EXPORT)
|
|
|
@PostMapping("/export")
|
|
@PostMapping("/export")
|
|
|
public void export(HttpServletResponse response, UseRecord useRecord) throws IOException {
|
|
public void export(HttpServletResponse response, UseRecord useRecord) throws IOException {
|
|
|
|
|
+ useRecord.setUserId(SecurityUtils.getUserId());
|
|
|
|
|
+ List<UseRecord> records =useRecordService.getList(useRecord);
|
|
|
|
|
+ List<UseRecordVo> info = new ArrayList<>();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(records)) {
|
|
|
|
|
+ info = useRecordService.getListVo(records);
|
|
|
|
|
+ info.forEach(i-> {
|
|
|
|
|
+ BigDecimal afterUse = i.getAfterUse();
|
|
|
|
|
+ i.setBeforeUseValue(i.getBeforeUse().stripTrailingZeros().toPlainString()+"MPa");
|
|
|
|
|
+ if (afterUse!=null){
|
|
|
|
|
+ i.setAfterUseValue(afterUse.stripTrailingZeros().toPlainString()+"MPa");
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ ExcelUtil<UseRecordVo> util = new ExcelUtil<>(UseRecordVo.class);
|
|
|
|
|
+ util.exportExcel(response, info, "使用记录数据" + DateUtils.getDate());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 导出使用记录列表(管理端)
|
|
|
|
|
+ */
|
|
|
|
|
+ @PreAuthorize(hasPermi = PerPrefix.BOTTLE_USERECORDADMIN + PerFun.EXPORT)
|
|
|
|
|
+ @ApiOperation(value = "导出使用记录列表")
|
|
|
|
|
+ @Log(title = "使用记录", businessType = BusinessType.EXPORT)
|
|
|
|
|
+ @PostMapping("/exportByAdmin")
|
|
|
|
|
+ public void exportByAdmin(HttpServletResponse response, UseRecord useRecord) throws IOException {
|
|
|
List<UseRecord> records =useRecordService.getList(useRecord);
|
|
List<UseRecord> records =useRecordService.getList(useRecord);
|
|
|
List<UseRecordVo> info = new ArrayList<>();
|
|
List<UseRecordVo> info = new ArrayList<>();
|
|
|
if (CollUtil.isNotEmpty(records)) {
|
|
if (CollUtil.isNotEmpty(records)) {
|
|
@@ -100,7 +149,7 @@ public class UseRecordController extends BaseController<UseRecord> {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 管理端端获取使用记录详细信息
|
|
|
|
|
|
|
+ * 管理端端获取使用记录详细信息(学生端)
|
|
|
*/
|
|
*/
|
|
|
@PreAuthorize(hasPermi = PerPrefix.BOTTLE_USERECORD + PerFun.QUERY)
|
|
@PreAuthorize(hasPermi = PerPrefix.BOTTLE_USERECORD + PerFun.QUERY)
|
|
|
@ApiOperation(value = "管理端端获取使用记录详细信息")
|
|
@ApiOperation(value = "管理端端获取使用记录详细信息")
|
|
@@ -110,6 +159,16 @@ public class UseRecordController extends BaseController<UseRecord> {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * 管理端端获取使用记录详细信息(管理端)
|
|
|
|
|
+ */
|
|
|
|
|
+ @PreAuthorize(hasPermi = PerPrefix.BOTTLE_USERECORDADMIN + PerFun.QUERY)
|
|
|
|
|
+ @ApiOperation(value = "管理端端获取使用记录详细信息")
|
|
|
|
|
+ @GetMapping(value = "/bottleByAdmin/{id}")
|
|
|
|
|
+ public ResultData<WebUseRecordVo> getBottleInfoByAdmin(@PathVariable("id") Long id) {
|
|
|
|
|
+ return ResultData.success(useRecordService.getBottleInfo(id));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* 信息统计管理端端获取气瓶使用记录详细信息
|
|
* 信息统计管理端端获取气瓶使用记录详细信息
|
|
|
*/
|
|
*/
|
|
|
@ApiOperation(value = "信息统计管理端端获取气瓶使用记录详细信息")
|
|
@ApiOperation(value = "信息统计管理端端获取气瓶使用记录详细信息")
|
|
@@ -173,12 +232,27 @@ public class UseRecordController extends BaseController<UseRecord> {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/***
|
|
/***
|
|
|
- * 查询使用记录
|
|
|
|
|
|
|
+ * 查询使用记录(学生端)
|
|
|
*/
|
|
*/
|
|
|
|
|
+ @PreAuthorize(hasPermi = PerPrefix.BOTTLE_USERECORD + PerFun.LISTDETAIL)
|
|
|
@ApiOperation(value = "查询使用记录")
|
|
@ApiOperation(value = "查询使用记录")
|
|
|
@GetMapping(value = "/getUseDetails")
|
|
@GetMapping(value = "/getUseDetails")
|
|
|
public TableDataInfo<UseRecord> getUseDetails(UseRecord useRecord) {
|
|
public TableDataInfo<UseRecord> getUseDetails(UseRecord useRecord) {
|
|
|
startPage("create_time","descending");
|
|
startPage("create_time","descending");
|
|
|
|
|
+ useRecord.setUserId(SecurityUtils.getUserId());
|
|
|
|
|
+ List<UseRecord> records =useRecordService.getList(useRecord);
|
|
|
|
|
+ return getDataTable(records);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /***
|
|
|
|
|
+ * 查询使用记录(管理端)
|
|
|
|
|
+ */
|
|
|
|
|
+ @PreAuthorize(hasPermi = PerPrefix.BOTTLE_USERECORDADMIN + PerFun.LISTDETAIL)
|
|
|
|
|
+ @ApiOperation(value = "查询使用记录")
|
|
|
|
|
+ @GetMapping(value = "/getUseDetailsByAdmin")
|
|
|
|
|
+ public TableDataInfo<UseRecord> getUseDetailsByAdmin(UseRecord useRecord) {
|
|
|
|
|
+ startPage("create_time","descending");
|
|
|
List<UseRecord> records =useRecordService.getList(useRecord);
|
|
List<UseRecord> records =useRecordService.getList(useRecord);
|
|
|
return getDataTable(records);
|
|
return getDataTable(records);
|
|
|
}
|
|
}
|