|
@@ -2,24 +2,27 @@ package com.zd.bottle.controller;
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import com.zd.bottle.domain.UseRecord;
|
|
import com.zd.bottle.domain.UseRecord;
|
|
|
|
|
+import com.zd.bottle.dto.UseRecordDto;
|
|
|
import com.zd.bottle.service.UseRecordService;
|
|
import com.zd.bottle.service.UseRecordService;
|
|
|
|
|
+import com.zd.bottle.vo.AirAmount;
|
|
|
import com.zd.bottle.vo.UseRecordVo;
|
|
import com.zd.bottle.vo.UseRecordVo;
|
|
|
|
|
+import com.zd.bottle.vo.WebUseRecordVo;
|
|
|
import com.zd.common.core.utils.DateUtils;
|
|
import com.zd.common.core.utils.DateUtils;
|
|
|
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;
|
|
|
import com.zd.common.log.annotation.Log;
|
|
import com.zd.common.log.annotation.Log;
|
|
|
import com.zd.common.log.enums.BusinessType;
|
|
import com.zd.common.log.enums.BusinessType;
|
|
|
|
|
+import com.zd.common.response.ResultData;
|
|
|
import com.zd.common.security.annotation.PreAuthorize;
|
|
import com.zd.common.security.annotation.PreAuthorize;
|
|
|
import com.zd.common.security.service.TokenService;
|
|
import com.zd.common.security.service.TokenService;
|
|
|
|
|
+import com.zd.system.api.domain.SysUser;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
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 org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
@@ -40,12 +43,9 @@ import java.util.List;
|
|
|
public class UseRecordController extends BaseController<UseRecord> {
|
|
public class UseRecordController extends BaseController<UseRecord> {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("MM-dd HH:mm");
|
|
SimpleDateFormat sdf = new SimpleDateFormat("MM-dd HH:mm");
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
|
|
+ @Resource
|
|
|
private UseRecordService useRecordService;
|
|
private UseRecordService useRecordService;
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private TokenService tokenService;
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 查询使用记录列表
|
|
* 查询使用记录列表
|
|
|
*/
|
|
*/
|
|
@@ -65,16 +65,16 @@ public class UseRecordController extends BaseController<UseRecord> {
|
|
|
return info;
|
|
return info;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// /**
|
|
|
|
|
-// * 信息统计查询使用记录列表
|
|
|
|
|
-// * @param storageId 库存主ID
|
|
|
|
|
-// * @return 集合对象
|
|
|
|
|
-// */
|
|
|
|
|
-// @GetMapping("/bottle/list/{storageId}")
|
|
|
|
|
-// @ApiOperation(value = "信息统计查询使用记录列表")
|
|
|
|
|
-// public List<QpUseRecordVo> bottleList(@PathVariable Long storageId) {
|
|
|
|
|
-// return qpUseRecordService.getBottleInfoByStorageId(storageId);
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 信息统计查询使用记录列表
|
|
|
|
|
+ * @param storageId 库存主ID
|
|
|
|
|
+ * @return 集合对象
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/bottle/list/{storageId}")
|
|
|
|
|
+ @ApiOperation(value = "信息统计查询使用记录列表")
|
|
|
|
|
+ public List<UseRecordVo> bottleList(@PathVariable Long storageId) {
|
|
|
|
|
+ return useRecordService.getBottleInfoByStorageId(storageId);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 导出使用记录列表
|
|
* 导出使用记录列表
|
|
@@ -98,168 +98,98 @@ public class UseRecordController extends BaseController<UseRecord> {
|
|
|
ExcelUtil<UseRecordVo> util = new ExcelUtil<>(UseRecordVo.class);
|
|
ExcelUtil<UseRecordVo> util = new ExcelUtil<>(UseRecordVo.class);
|
|
|
util.exportExcel(response, info, "使用记录数据" + DateUtils.getDate());
|
|
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);
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 管理端端获取使用记录详细信息
|
|
|
|
|
+ */
|
|
|
|
|
+ @ApiOperation(value = "管理端端获取使用记录详细信息")
|
|
|
|
|
+ @GetMapping(value = "/bottle/{id}")
|
|
|
|
|
+ public ResultData<WebUseRecordVo> getBottleInfo(@PathVariable("id") Long id) {
|
|
|
|
|
+ return ResultData.success(useRecordService.getBottleInfo(id));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 信息统计管理端端获取气瓶使用记录详细信息
|
|
|
|
|
+ */
|
|
|
|
|
+ @ApiOperation(value = "信息统计管理端端获取气瓶使用记录详细信息")
|
|
|
|
|
+ @GetMapping(value = "/bottle/record/{storageId}")
|
|
|
|
|
+ public ResultData<WebUseRecordVo> getBottleRecord(@PathVariable("storageId") Long storageId) {
|
|
|
|
|
+ return ResultData.success(useRecordService.getBottleRecord(storageId));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 出入库信息统计
|
|
|
|
|
+ */
|
|
|
|
|
+ @ApiOperation(value = "出入库信息统计")
|
|
|
|
|
+ @GetMapping(value = "/calcRepertory")
|
|
|
|
|
+ public ResultData<List<AirAmount>> calcRepertory(String airName) {
|
|
|
|
|
+ return ResultData.success(useRecordService.calcRepertory(airName));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 用气量信息统计
|
|
|
|
|
+ */
|
|
|
|
|
+ @ApiOperation(value = "用气量信息统计")
|
|
|
|
|
+ @GetMapping(value = "/calcAmount")
|
|
|
|
|
+ public ResultData<List<AirAmount>> calcAmount(String airName) {
|
|
|
|
|
+ return ResultData.success(useRecordService.calcAmount(airName));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 新增使用登记
|
|
|
|
|
+ * value 说明:
|
|
|
|
|
+ * 1:正常状态
|
|
|
|
|
+ * 2:气瓶余量接近安全值
|
|
|
|
|
+ * 3:用户没有用气资格
|
|
|
|
|
+ * 4:气瓶正在使用中
|
|
|
|
|
+ */
|
|
|
|
|
+ @ApiOperation(value = "新增使用登记")
|
|
|
|
|
+ @Log(title = "新增使用登记", businessType = BusinessType.INSERT)
|
|
|
|
|
+ @PostMapping
|
|
|
|
|
+ public ResultData<Integer> add(@RequestBody UseRecordDto recordDto) {
|
|
|
|
|
+ return ResultData.success(useRecordService.add(recordDto));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 归还登记
|
|
|
|
|
+ */
|
|
|
|
|
+ @ApiOperation(value = "归还登记")
|
|
|
|
|
+ @Log(title = "归还登记", businessType = BusinessType.UPDATE)
|
|
|
|
|
+ @PutMapping
|
|
|
|
|
+ public ResultData<Boolean> edit(@RequestBody UseRecord useRecord) {
|
|
|
|
|
+ return ResultData.result(useRecordService.updateUseRecord(useRecord));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /***
|
|
|
|
|
+ * 查询使用记录
|
|
|
|
|
+ */
|
|
|
|
|
+ @ApiOperation(value = "查询使用记录")
|
|
|
|
|
+ @GetMapping(value = "/getUseDetails")
|
|
|
|
|
+ public TableDataInfo<UseRecord> getUseDetails(UseRecord useRecord) {
|
|
|
|
|
+ startPage("create_time","descending");
|
|
|
|
|
+ List<UseRecord> records =useRecordService.getList(useRecord);
|
|
|
|
|
+ return getDataTable(records);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 当前登录人的气瓶使用记录
|
|
|
|
|
+ */
|
|
|
|
|
+ @ApiOperation(value = "当前登录人的气瓶使用记录")
|
|
|
|
|
+ @GetMapping(value = "/getUseDetailsByUserId")
|
|
|
|
|
+ public TableDataInfo<UseRecord> getUseDetailsByUserId(UseRecord useRecord) {
|
|
|
|
|
+ startPage();
|
|
|
|
|
+ List<UseRecord> list = useRecordService.getByUserId(useRecord);
|
|
|
|
|
+ return getDataTable(list);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /***
|
|
|
|
|
+ * 查询某个气瓶的使用记录汇总
|
|
|
|
|
+ */
|
|
|
|
|
+ @ApiOperation(value = "查询某个气瓶的使用记录汇总")
|
|
|
|
|
+ @GetMapping(value = "/getUseDetailsByStorageId")
|
|
|
|
|
+ public TableDataInfo<UseRecord> getUseDetailsByStorageId(UseRecord useRecord) {
|
|
|
|
|
+ startPage();
|
|
|
|
|
+ List<UseRecord> list = useRecordService.getByStorageId(useRecord.getStorageId());
|
|
|
|
|
+ return getDataTable(list);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|