|
|
@@ -1,9 +1,31 @@
|
|
|
package com.zd.bottle.controller;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import com.zd.bottle.domain.UseRecord;
|
|
|
+import com.zd.bottle.service.UseRecordService;
|
|
|
+import com.zd.bottle.vo.UseRecordVo;
|
|
|
+import com.zd.common.core.utils.DateUtils;
|
|
|
+import com.zd.common.core.utils.poi.ExcelUtil;
|
|
|
+import com.zd.common.core.web.controller.BaseController;
|
|
|
+import com.zd.common.core.web.page.TableDataInfo;
|
|
|
+import com.zd.common.log.annotation.Log;
|
|
|
+import com.zd.common.log.enums.BusinessType;
|
|
|
+import com.zd.common.security.annotation.PreAuthorize;
|
|
|
+import com.zd.common.security.service.TokenService;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
-import com.zd.common.core.web.controller.BaseController;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.IOException;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
|
@@ -16,5 +38,228 @@ import com.zd.common.core.web.controller.BaseController;
|
|
|
@RestController
|
|
|
@RequestMapping("/useRecord")
|
|
|
public class UseRecordController extends BaseController<UseRecord> {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("MM-dd HH:mm");
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UseRecordService useRecordService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TokenService tokenService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询使用记录列表
|
|
|
+ */
|
|
|
+ @PreAuthorize(hasPermi = "airbottle:use:record:list")
|
|
|
+ @GetMapping("/list")
|
|
|
+ @ApiOperation(value = "查询使用记录列表")
|
|
|
+ public TableDataInfo<UseRecordVo> list(UseRecord useRecord) {
|
|
|
+ startPage("use_time","descending");
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+
|
|
|
+// /**
|
|
|
+// * 信息统计查询使用记录列表
|
|
|
+// * @param storageId 库存主ID
|
|
|
+// * @return 集合对象
|
|
|
+// */
|
|
|
+// @GetMapping("/bottle/list/{storageId}")
|
|
|
+// @ApiOperation(value = "信息统计查询使用记录列表")
|
|
|
+// public List<QpUseRecordVo> bottleList(@PathVariable Long storageId) {
|
|
|
+// return qpUseRecordService.getBottleInfoByStorageId(storageId);
|
|
|
+// }
|
|
|
|
|
|
+ /**
|
|
|
+ * 导出使用记录列表
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "导出使用记录列表")
|
|
|
+ @Log(title = "使用记录", businessType = BusinessType.EXPORT)
|
|
|
+ @PostMapping("/export")
|
|
|
+ public void export(HttpServletResponse response, UseRecord useRecord) throws IOException {
|
|
|
+ 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());
|
|
|
+ }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 小程序端获取使用记录详细信息
|
|
|
+// */
|
|
|
+// @ApiOperation(value = "小程序端获取使用记录详细信息")
|
|
|
+// @GetMapping(value = "/{id}")
|
|
|
+// public ResultData<QpUseRecordVo> getInfo(@PathVariable("id") Long id) {
|
|
|
+// return ResultData.success(qpUseRecordService.selectQpUseRecordById(id));
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 管理端端获取使用记录详细信息
|
|
|
+// */
|
|
|
+// @ApiOperation(value = "管理端端获取使用记录详细信息")
|
|
|
+// @GetMapping(value = "/bottle/{id}")
|
|
|
+// public ResultData<WebUseRecordVo> getBottleInfo(@PathVariable("id") Long id) {
|
|
|
+// return ResultData.success(qpUseRecordService.getBottleInfo(id));
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 信息统计管理端端获取气瓶使用记录详细信息
|
|
|
+// */
|
|
|
+// @ApiOperation(value = "信息统计管理端端获取气瓶使用记录详细信息")
|
|
|
+// @GetMapping(value = "/bottle/record/{storageId}")
|
|
|
+// public ResultData<WebUseRecordVo> getBottleRecord(@PathVariable("storageId") Long storageId) {
|
|
|
+// return ResultData.success(qpUseRecordService.getBottleRecord(storageId));
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 出入库信息统计
|
|
|
+// */
|
|
|
+// @ApiOperation(value = "出入库信息统计")
|
|
|
+// @GetMapping(value = "/calcRepertory")
|
|
|
+// public ResultData<List<AirAmount>> calcRepertory(String airName) {
|
|
|
+// return ResultData.success(qpUseRecordService.calcRepertory(airName));
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 用气量信息统计
|
|
|
+// */
|
|
|
+// @ApiOperation(value = "用气量信息统计")
|
|
|
+// @GetMapping(value = "/calcAmount")
|
|
|
+// public ResultData<List<AirAmount>> calcAmount(String airName) {
|
|
|
+// return ResultData.success(qpUseRecordService.calcAmount(airName));
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 气瓶申请统计
|
|
|
+// */
|
|
|
+// @ApiOperation(value = "气瓶申请统计")
|
|
|
+// @GetMapping(value = "/calcApply")
|
|
|
+// public ResultData<List<AirAmount>> calcApply(String airName) {
|
|
|
+// return ResultData.success(qpUseRecordService.calcApply(airName));
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 新增使用登记
|
|
|
+// * value 说明:
|
|
|
+// * 1:正常状态
|
|
|
+// * 2:气瓶余量接近安全值
|
|
|
+// * 3:用户没有用气资格
|
|
|
+// * 4:气瓶正在使用中
|
|
|
+// */
|
|
|
+// @ApiOperation(value = "新增使用登记")
|
|
|
+// @Log(title = "新增使用登记", businessType = BusinessType.INSERT)
|
|
|
+// @PostMapping
|
|
|
+// public ResultData<Integer> add(@RequestBody QpUseRecordDto recordDto) {
|
|
|
+// return ResultData.success(qpUseRecordService.insertQpUseRecord(recordDto));
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 归还登记
|
|
|
+// */
|
|
|
+// @ApiOperation(value = "归还登记")
|
|
|
+// @Log(title = "归还登记", businessType = BusinessType.UPDATE)
|
|
|
+// @PutMapping
|
|
|
+// public ResultData<Boolean> edit(@RequestBody QpUseRecord qpUseRecord) {
|
|
|
+// return ResultData.result(qpUseRecordService.updateQpUseRecord(qpUseRecord));
|
|
|
+// }
|
|
|
+//
|
|
|
+// /***
|
|
|
+// * 查询使用记录
|
|
|
+// */
|
|
|
+// @ApiOperation(value = "查询使用记录")
|
|
|
+// @GetMapping(value = "/getUseDetails")
|
|
|
+// public TableDataInfo<QpUseRecord> getUseDetails( QpUseRecord qpUseRecord) {
|
|
|
+// startPage();
|
|
|
+// List<QpUseRecordVo> list = qpUseRecordService.getUseDetailsList(qpUseRecord);
|
|
|
+// return getDataTable(list);
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 当前登录人 申请并入库的气瓶使用记录
|
|
|
+// */
|
|
|
+// @ApiOperation(value = "当前登录人 申请并入库的气瓶使用记录")
|
|
|
+// @GetMapping(value = "/getUseDetailsByUserId")
|
|
|
+// public TableDataInfo<QpUseRecord> getUseDetailsByUserId(QpUseRecord qpUseRecord) {
|
|
|
+// SysUser sysUser = tokenService.getLoginUser().getSysUser();
|
|
|
+// List<QpUseRecordVo> list = qpUseRecordService.getUseDetailsListByUserId(qpUseRecord);
|
|
|
+// qpUseRecord.setUserId(sysUser.getUserId());
|
|
|
+// startPage();
|
|
|
+// return getDataTable(list);
|
|
|
+// }
|
|
|
+//
|
|
|
+// /***
|
|
|
+// * 查询某个气瓶的使用记录汇总
|
|
|
+// */
|
|
|
+// @ApiOperation(value = "查询某个气瓶的使用记录汇总")
|
|
|
+// @GetMapping(value = "/getUseDetailsByStorageId")
|
|
|
+// public TableDataInfo<QpUseRecordVo> getUseDetailsByStorageId(QpUseRecordVo qpUseRecordVo) {
|
|
|
+// startPage();
|
|
|
+// List<QpUseRecordVo> list = qpUseRecordService.getUseDetailsListByStorageId(qpUseRecordVo);
|
|
|
+// return new TableDataInfo<QpUseRecordVo>().getDataTable(list);
|
|
|
+// }
|
|
|
+//
|
|
|
+// /***
|
|
|
+// * 查询使用记录-小程序端
|
|
|
+// */
|
|
|
+// @ApiOperation(value = "查询使用记录")
|
|
|
+// @GetMapping(value = "/getUseDetailsApp")
|
|
|
+// public TableDataInfo<QpUseRecord> getUseDetailsApp( QpUseRecord qpUseRecord) {
|
|
|
+// startPage();
|
|
|
+// List<QpUseRecordVo> list = qpUseRecordService.getUseDetailsList(qpUseRecord);
|
|
|
+// for (QpUseRecordVo useRecordVo:list) {
|
|
|
+// useRecordVo.setUseTimeApp(useRecordVo.getUseTime()!=null?sdf.format(useRecordVo.getUseTime()):null);
|
|
|
+// useRecordVo.setBackTimeApp(useRecordVo.getBackTime()!=null?sdf.format(useRecordVo.getBackTime()):null);
|
|
|
+// }
|
|
|
+// return getDataTable(list);
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 当前登录人 申请并入库的气瓶使用记录-小程序端
|
|
|
+// */
|
|
|
+// @ApiOperation(value = "当前登录人 申请并入库的气瓶使用记录-小程序端")
|
|
|
+// @GetMapping(value = "/getUseDetailsByUserIdApp")
|
|
|
+// public TableDataInfo<QpUseRecord> getUseDetailsByUserIdApp(QpUseRecord qpUseRecord) {
|
|
|
+// SysUser sysUser = tokenService.getLoginUser().getSysUser();
|
|
|
+// qpUseRecord.setUserId(sysUser.getUserId());
|
|
|
+// startPage();
|
|
|
+// List<QpUseRecordVo> list = qpUseRecordService.getUseDetailsListByUserId(qpUseRecord);
|
|
|
+// //时间格式化处理
|
|
|
+// for (QpUseRecordVo useRecord: list) {
|
|
|
+// useRecord.setUseTimeApp(useRecord.getUseTime()!=null?sdf.format(useRecord.getUseTime()):null);
|
|
|
+// useRecord.setBackTimeApp(useRecord.getBackTime()!=null?sdf.format(useRecord.getBackTime()):null);
|
|
|
+// }
|
|
|
+// return getDataTable(list);
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 当前登录人 申请并入库的气瓶使用记录-小程序端
|
|
|
+// */
|
|
|
+// @ApiOperation(value = "当前登录人 申请并入库的气瓶使用记录-小程序端")
|
|
|
+// @GetMapping(value = "/getUseRecordSpecsListApp")
|
|
|
+// public TableDataInfo<QpAirGoodsConfigRelationVo> getUseRecordSpecsListApp(QpAirGoodsConfigRelationVo vo) {
|
|
|
+// SysUser sysUser = tokenService.getLoginUser().getSysUser();
|
|
|
+// vo.setUserId(sysUser.getUserId());
|
|
|
+// startPage();
|
|
|
+// List<QpAirGoodsConfigRelationVo> list = qpUseRecordService.getUseRecordSpecsList(vo);
|
|
|
+// for (QpAirGoodsConfigRelationVo useRecord:list) {
|
|
|
+// useRecord.setUseTimeApp(useRecord.getUseTime()!=null?sdf.format(useRecord.getUseTime()):null);
|
|
|
+// useRecord.setBackTimeApp(useRecord.getBackTime()!=null?sdf.format(useRecord.getBackTime()):null);
|
|
|
+// }
|
|
|
+// return getDataTable(list);
|
|
|
+// }
|
|
|
}
|