|
@@ -1,13 +1,17 @@
|
|
|
package cn.fastfun.controller.api;
|
|
|
|
|
|
+import cn.fastfun.controller.dto.asset.AssetConfDto;
|
|
|
import cn.fastfun.controller.dto.asset.BaseInfoDTO;
|
|
|
import cn.fastfun.controller.dto.asset.ResponseDTO;
|
|
|
import cn.fastfun.controller.dto.asset.FigureDTO;
|
|
|
import cn.fastfun.controller.param.*;
|
|
|
+import cn.fastfun.service.AppDeviceService;
|
|
|
import cn.fastfun.service.SysExcelFieldService;
|
|
|
import cn.fastfun.service.entity.AppAssetConf;
|
|
|
+import cn.fastfun.service.entity.AppDevice;
|
|
|
import cn.fastfun.service.impl.AppAssetConfServiceImpl;
|
|
|
import cn.fastfun.service.impl.AppAssetProfitServiceImpl;
|
|
|
+import cn.fastfun.service.mapper.AppAssetConfMapper;
|
|
|
import cn.fastfun.util.IrrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -46,6 +50,12 @@ public class ApiAssetProfitController {
|
|
|
@Autowired
|
|
|
AppAssetConfServiceImpl appAssetConfService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ AppDeviceService appDeviceService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ AppAssetConfMapper appAssetConfMapper;
|
|
|
+
|
|
|
|
|
|
@ApiOperation(value = "基础信息")
|
|
|
@RequestMapping(value = "getBaseInfo", method = RequestMethod.POST)
|
|
@@ -77,6 +87,7 @@ public class ApiAssetProfitController {
|
|
|
ResponseDTO responseDTO = new ResponseDTO();
|
|
|
|
|
|
Page<AppAssetConf> appAssetConfPage = appAssetConfService.appAssetConfPageQuery(param);
|
|
|
+ responseDTO.setTotal(appAssetConfPage.getTotal());
|
|
|
if (appAssetConfPage.getTotal() > 0) {
|
|
|
appAssetConfPage.getRecords().forEach(p -> {
|
|
|
ResponseDTO.AllInfo allInfo = new ResponseDTO.AllInfo();
|
|
@@ -148,6 +159,8 @@ public class ApiAssetProfitController {
|
|
|
ResponseDTO responseDTO = new ResponseDTO();
|
|
|
|
|
|
Page<AppAssetConf> appAssetConfPage = appAssetConfService.appAssetConfPageQuery(param);
|
|
|
+ responseDTO.setTotal(appAssetConfPage.getTotal());
|
|
|
+
|
|
|
if (appAssetConfPage.getTotal() > 0) {
|
|
|
appAssetConfPage.getRecords().forEach(p -> {
|
|
|
ResponseDTO.AllInfo allInfo = new ResponseDTO.AllInfo();
|
|
@@ -193,6 +206,8 @@ public class ApiAssetProfitController {
|
|
|
ResponseDTO responseDTO = new ResponseDTO();
|
|
|
|
|
|
Page<AppAssetConf> appAssetConfPage = appAssetConfService.appAssetConfPageQuery(param);
|
|
|
+ responseDTO.setTotal(appAssetConfPage.getTotal());
|
|
|
+
|
|
|
if (appAssetConfPage.getTotal() > 0) {
|
|
|
appAssetConfPage.getRecords().forEach(p -> {
|
|
|
ResponseDTO.AllInfo allInfo = new ResponseDTO.AllInfo();
|
|
@@ -315,6 +330,8 @@ public class ApiAssetProfitController {
|
|
|
ResponseDTO responseDTO = new ResponseDTO();
|
|
|
|
|
|
Page<AppAssetConf> appAssetConfPage = appAssetConfService.appAssetConfPageQuery(param);
|
|
|
+ responseDTO.setTotal(appAssetConfPage.getTotal());
|
|
|
+
|
|
|
if (appAssetConfPage.getTotal() > 0) {
|
|
|
appAssetConfPage.getRecords().forEach(p -> {
|
|
|
ResponseDTO.AllInfo allInfo = new ResponseDTO.AllInfo();
|
|
@@ -371,6 +388,8 @@ public class ApiAssetProfitController {
|
|
|
else if (param.getTableOrder() != null && param.getTableOrder().equals(7)) {
|
|
|
ResponseDTO responseDTO = new ResponseDTO();
|
|
|
Page<AppAssetConf> appAssetConfPage = appAssetConfService.appAssetConfPageQuery(param);
|
|
|
+ responseDTO.setTotal(appAssetConfPage.getTotal());
|
|
|
+
|
|
|
if (appAssetConfPage.getTotal() > 0) {
|
|
|
appAssetConfPage.getRecords().forEach(p -> {
|
|
|
ResponseDTO.AllInfo allInfo = new ResponseDTO.AllInfo();
|
|
@@ -414,6 +433,8 @@ public class ApiAssetProfitController {
|
|
|
else if (param.getTableOrder() != null && param.getTableOrder().equals(8)) {
|
|
|
ResponseDTO responseDTO = new ResponseDTO();
|
|
|
Page<AppAssetConf> appAssetConfPage = appAssetConfService.appAssetConfPageQuery(param);
|
|
|
+ responseDTO.setTotal(appAssetConfPage.getTotal());
|
|
|
+
|
|
|
if (appAssetConfPage.getTotal() > 0) {
|
|
|
appAssetConfPage.getRecords().forEach(p -> {
|
|
|
ResponseDTO.AllInfo allInfo = new ResponseDTO.AllInfo();
|
|
@@ -661,9 +682,37 @@ public class ApiAssetProfitController {
|
|
|
return ApiDTO.ok("成功", response);
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "获取sn列表")
|
|
|
+ @PostMapping("getSn")
|
|
|
+ public ApiDTO getSn(){
|
|
|
+ List<String> sns = new ArrayList<>();
|
|
|
+ List<AppDevice> appDevices = appDeviceService.findAll();
|
|
|
+ appDevices.forEach(p->sns.add(p.getSn()));
|
|
|
+
|
|
|
+ return ApiDTO.ok(sns);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "导出认证")
|
|
|
+ @PostMapping("exportAuth")
|
|
|
+ public ApiDTO exportAuth(@RequestBody @ApiParam(name = "设备信息对象", value = "传入json格式", required = true) AssetProfitParam param){
|
|
|
+ String name;
|
|
|
+ switch (param.getTableOrder()){
|
|
|
+ case 1: name = "租赁信息";break;
|
|
|
+ case 2: name = "运维信息";break;
|
|
|
+ case 3: name = "赔偿信息";break;
|
|
|
+ case 4: name = "营销信息";break;
|
|
|
+ case 5: name = "运营信息";break;
|
|
|
+ case 6: name = "金融成本信息";break;
|
|
|
+ case 7: name = "处置信息";break;
|
|
|
+ case 8: name = "其他信息";break;
|
|
|
+ default: name=null;
|
|
|
+ }
|
|
|
+ return ApiDTO.ok(name);
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value = "导出")
|
|
|
@GetMapping("export")
|
|
|
- public void export(HttpServletResponse response, @RequestParam String sn, @RequestParam String timeStart, @RequestParam String timeEnd, @RequestParam Integer tableOrder, @RequestParam String type) throws ParseException {
|
|
|
+ public void export(HttpServletResponse response, @RequestParam String name, @RequestParam String sn, @RequestParam String timeStart, @RequestParam String timeEnd, @RequestParam Integer tableOrder, @RequestParam String type) throws ParseException {
|
|
|
|
|
|
AssetProfitParam param = new AssetProfitParam();
|
|
|
param.setSn(sn.equals("null") ? null : sn);
|
|
@@ -690,9 +739,24 @@ public class ApiAssetProfitController {
|
|
|
put("remark", p.getDescription());
|
|
|
}});
|
|
|
});
|
|
|
- sysExcelFieldService.outExcelFile(sysExcelFieldService.export("rent_info", data), response, "租赁信息.xlsx");
|
|
|
+ sysExcelFieldService.outExcelFile(sysExcelFieldService.export("rent_info", data), response, name);
|
|
|
}
|
|
|
- if (param.getTableOrder() != null && (param.getTableOrder().equals(2) || param.getTableOrder().equals(3)
|
|
|
+ // 营销信息
|
|
|
+ if (param.getTableOrder() != null && param.getTableOrder().equals(4)) {
|
|
|
+ param.setFigureOrNot(false);
|
|
|
+ ResponseDTO responseDTO = (ResponseDTO) appAssetService.getSaleInfo(param);
|
|
|
+ List<Map<String, Object>> data = new ArrayList<>();
|
|
|
+ responseDTO.getAllInfoList().forEach(p -> {
|
|
|
+ data.add(new HashMap<String, Object>() {{
|
|
|
+ put("time", p.getTime());
|
|
|
+ put("type", p.getType());
|
|
|
+ put("amount", p.getAmount());
|
|
|
+ put("remark", p.getDescription());
|
|
|
+ }});
|
|
|
+ });
|
|
|
+ sysExcelFieldService.outExcelFile(sysExcelFieldService.export("sale_info", data), response, name);
|
|
|
+ }
|
|
|
+ else if (param.getTableOrder() != null && (param.getTableOrder().equals(2) || param.getTableOrder().equals(3)
|
|
|
|| param.getTableOrder().equals(5) || param.getTableOrder().equals(6)
|
|
|
|| param.getTableOrder().equals(7) || param.getTableOrder().equals(8))) {
|
|
|
AssetPageQueryParam appAssetConf = new AssetPageQueryParam();
|
|
@@ -721,13 +785,22 @@ public class ApiAssetProfitController {
|
|
|
if (appAssetConf.getTimeEnd() != null) {
|
|
|
appAssetConfQueryWrapper.lt("time", appAssetConf.getTimeEnd());
|
|
|
}
|
|
|
+
|
|
|
Page<AppAssetConf> appAssetConfPage = appAssetConfService.page(page, appAssetConfQueryWrapper);
|
|
|
+
|
|
|
+ List<String> strings = Arrays.asList(param.getType());
|
|
|
+
|
|
|
+ List<AssetConfDto> assetConf = appAssetConfMapper.getAssetConf(param.getSn(), param.getTableOrder(),
|
|
|
+ param.getType() == null?null:Arrays.asList(param.getType()),
|
|
|
+ param.getTimeStart() == null?null:new SimpleDateFormat("yyyy-MM-dd").format(param.getTimeStart()),
|
|
|
+ param.getTimeEnd() == null?null:new SimpleDateFormat("yyyy-MM-dd").format(param.getTimeEnd()),
|
|
|
+ (param.getIndex() - 1) * param.getLength(), param.getLength());
|
|
|
List<Map<String, Object>> data = new ArrayList<>();
|
|
|
- if (appAssetConfPage.getTotal() > 0) {
|
|
|
- appAssetConfPage.getRecords().forEach(p -> {
|
|
|
+ if (assetConf.size() > 0) {
|
|
|
+ assetConf.forEach(p -> {
|
|
|
data.add(new HashMap<String, Object>() {{
|
|
|
put("time", p.getTime());
|
|
|
- put("type", p.getType());
|
|
|
+ put("type", p.getTypeText());
|
|
|
put("amount", p.getAmount());
|
|
|
put("remark", "");
|
|
|
}});
|
|
@@ -735,22 +808,23 @@ public class ApiAssetProfitController {
|
|
|
}
|
|
|
switch (param.getTableOrder()) {
|
|
|
case 2:
|
|
|
- sysExcelFieldService.outExcelFile(sysExcelFieldService.export("om_info", data), response, "运维信息.xlsx");
|
|
|
+
|
|
|
+ sysExcelFieldService.outExcelFile(sysExcelFieldService.export("om_info", data), response, name);
|
|
|
break;
|
|
|
case 3:
|
|
|
- sysExcelFieldService.outExcelFile(sysExcelFieldService.export("com_info", data), response, "赔偿信息.xlsx");
|
|
|
+ sysExcelFieldService.outExcelFile(sysExcelFieldService.export("com_info", data), response, name);
|
|
|
break;
|
|
|
case 5:
|
|
|
- sysExcelFieldService.outExcelFile(sysExcelFieldService.export("op_info", data), response, "运营信息.xlsx");
|
|
|
+ sysExcelFieldService.outExcelFile(sysExcelFieldService.export("op_info", data), response, name);
|
|
|
break;
|
|
|
case 6:
|
|
|
- sysExcelFieldService.outExcelFile(sysExcelFieldService.export("fi_info", data), response, "金融成本信息.xlsx");
|
|
|
+ sysExcelFieldService.outExcelFile(sysExcelFieldService.export("fi_info", data), response, name);
|
|
|
break;
|
|
|
case 7:
|
|
|
- sysExcelFieldService.outExcelFile(sysExcelFieldService.export("handle_info", data), response, "处置信息.xlsx");
|
|
|
+ sysExcelFieldService.outExcelFile(sysExcelFieldService.export("handle_info", data), response, name);
|
|
|
break;
|
|
|
case 8:
|
|
|
- sysExcelFieldService.outExcelFile(sysExcelFieldService.export("other_info", data), response, "其他信息.xlsx");
|
|
|
+ sysExcelFieldService.outExcelFile(sysExcelFieldService.export("other_info", data), response, name);
|
|
|
break;
|
|
|
|
|
|
default:
|