|
@@ -4,6 +4,8 @@ import cn.fastfun.controller.dto.asset.BaseInfoDTO;
|
|
|
import cn.fastfun.controller.dto.asset.RentInfoDTO;
|
|
|
import cn.fastfun.controller.dto.asset.RentInfoFigureDTO;
|
|
|
import cn.fastfun.controller.param.*;
|
|
|
+import cn.fastfun.service.SysExcelFieldService;
|
|
|
+import cn.fastfun.service.SysService;
|
|
|
import cn.fastfun.service.impl.AppAssetProfitServiceImpl;
|
|
|
import com.bridge.dto.*;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -13,7 +15,11 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* @author Bridge AutoGen
|
|
@@ -27,12 +33,14 @@ public class ApiAssetProfitController {
|
|
|
@Autowired
|
|
|
AppAssetProfitServiceImpl appAssetService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ SysExcelFieldService sysExcelFieldService;
|
|
|
+
|
|
|
@ApiOperation(value = "基础信息")
|
|
|
@RequestMapping(value = "getBaseInfo", method = RequestMethod.POST)
|
|
|
public ApiDTO getBaseInfo(@RequestBody @ApiParam(name = "设备信息对象", value = "传入json格式", required = true) AssetProfitParam param) throws Exception {
|
|
|
|
|
|
|
|
|
-
|
|
|
BaseInfoDTO baseInfo = appAssetService.getBaseInfo(param);
|
|
|
return ApiDTO.ok("成功", baseInfo);
|
|
|
}
|
|
@@ -43,7 +51,7 @@ public class ApiAssetProfitController {
|
|
|
|
|
|
// 租赁信息
|
|
|
Object response = null;
|
|
|
- if (param.getTableOrder() != null && param.getTableOrder().equals(1)){
|
|
|
+ if (param.getTableOrder() != null && param.getTableOrder().equals(1)) {
|
|
|
param.setFigureOrNot(false);
|
|
|
Object rentInfoDTO = appAssetService.getRentInfo(param);
|
|
|
response = (RentInfoDTO) rentInfoDTO;
|
|
@@ -58,7 +66,7 @@ public class ApiAssetProfitController {
|
|
|
|
|
|
// 租赁信息
|
|
|
Object response = null;
|
|
|
- if (param.getTableOrder() != null && param.getTableOrder().equals(1)){
|
|
|
+ if (param.getTableOrder() != null && param.getTableOrder().equals(1)) {
|
|
|
param.setFigureOrNot(true);
|
|
|
param.setIndex(0);
|
|
|
param.setLength(0);
|
|
@@ -69,8 +77,33 @@ public class ApiAssetProfitController {
|
|
|
return ApiDTO.ok("成功", response);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+ @ApiOperation(value = "导出")
|
|
|
+ @RequestMapping(value = "export", method = RequestMethod.POST)
|
|
|
+ public ApiDTO export(@RequestBody @ApiParam(name = "设备信息对象", value = "传入json格式", required = true) AssetProfitParam param, HttpServletResponse response) throws Exception {
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 租赁信息
|
|
|
+
|
|
|
+ if (param.getTableOrder() != null && param.getTableOrder().equals(1)) {
|
|
|
+ param.setFigureOrNot(false);
|
|
|
+ RentInfoDTO rentInfoDTO = (RentInfoDTO) appAssetService.getRentInfo(param);
|
|
|
+ List<Map<String, Object>> data = new ArrayList<>();
|
|
|
+ rentInfoDTO.getAllInfoList().forEach(p -> {
|
|
|
+ data.add(new HashMap<String, Object>() {{
|
|
|
+ put("time", p.getTime());
|
|
|
+ put("type", p.getType());
|
|
|
+ put("amount", p.getAmount());
|
|
|
+ put("orderNo", p.getOrder());
|
|
|
+ put("remark", p.getDescription());
|
|
|
+ }});
|
|
|
+ });
|
|
|
+ sysExcelFieldService.outExcelFile(sysExcelFieldService.export("rent_info", data), response, "租赁信息.xlsx");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ return ApiDTO.error("导出失败" + e);
|
|
|
+ }
|
|
|
+ return ApiDTO.ok("成功");
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|