|
@@ -25,6 +25,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -49,12 +50,11 @@ public class ApiAssetProfitController {
|
|
|
AppAssetConfServiceImpl appAssetConfService;
|
|
|
|
|
|
|
|
|
-
|
|
|
@ApiOperation(value = "基础信息")
|
|
|
@RequestMapping(value = "getBaseInfo", method = RequestMethod.POST)
|
|
|
public ApiDTO getBaseInfo(@RequestBody @ApiParam(name = "设备信息对象", value = "传入json格式", required = true) AssetProfitParam param) throws Exception {
|
|
|
|
|
|
- if (!StringUtils.hasLength(param.getSn())){
|
|
|
+ if (!StringUtils.hasLength(param.getSn())) {
|
|
|
throw new ApiRuntimeException("请输入sn");
|
|
|
}
|
|
|
BaseInfoDTO baseInfo = appAssetService.getBaseInfo(param);
|
|
@@ -65,7 +65,7 @@ public class ApiAssetProfitController {
|
|
|
@RequestMapping(value = "getProfitInfo", method = RequestMethod.POST)
|
|
|
public ApiDTO getAssetProfitInfo(@RequestBody @ApiParam(name = "设备信息对象", value = "传入json格式", required = true) AssetProfitParam param) throws Exception {
|
|
|
|
|
|
- if (!StringUtils.hasLength(param.getSn())){
|
|
|
+ if (!StringUtils.hasLength(param.getSn())) {
|
|
|
throw new ApiRuntimeException("请输入sn");
|
|
|
}
|
|
|
// 租赁信息
|
|
@@ -78,6 +78,27 @@ public class ApiAssetProfitController {
|
|
|
// 运维信息
|
|
|
else if (param.getTableOrder() != null && param.getTableOrder().equals(2)) {
|
|
|
RentInfoDTO rentInfoDTO = new RentInfoDTO();
|
|
|
+
|
|
|
+ Page<AppAssetConf> appAssetConfPage = appAssetConfService.appAssetConfPageQuery(param);
|
|
|
+ if (appAssetConfPage.getTotal() > 0) {
|
|
|
+ appAssetConfPage.getRecords().forEach(p -> {
|
|
|
+ RentInfoDTO.AllInfo allInfo = new RentInfoDTO.AllInfo();
|
|
|
+ switch (p.getType()) {
|
|
|
+ case 1:
|
|
|
+ allInfo.setType("故障花费");
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ allInfo.setType("平台服务费");
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ allInfo.setDescription("");
|
|
|
+ allInfo.setAmount(p.getAmount());
|
|
|
+ allInfo.setTime(new SimpleDateFormat("yyyy-MM-dd").format(p.getTime()));
|
|
|
+ rentInfoDTO.getAllInfoList().add(allInfo);
|
|
|
+ });
|
|
|
+ }
|
|
|
QueryWrapper<AppAssetConf> queryWrapper = new QueryWrapper();
|
|
|
queryWrapper.eq("is_delete", 0);
|
|
|
queryWrapper.eq("sn", param.getSn());
|
|
@@ -116,6 +137,24 @@ public class ApiAssetProfitController {
|
|
|
// 赔偿信息
|
|
|
else if (param.getTableOrder() != null && param.getTableOrder().equals(3)) {
|
|
|
RentInfoDTO rentInfoDTO = new RentInfoDTO();
|
|
|
+
|
|
|
+ Page<AppAssetConf> appAssetConfPage = appAssetConfService.appAssetConfPageQuery(param);
|
|
|
+ if (appAssetConfPage.getTotal() > 0) {
|
|
|
+ appAssetConfPage.getRecords().forEach(p -> {
|
|
|
+ RentInfoDTO.AllInfo allInfo = new RentInfoDTO.AllInfo();
|
|
|
+ switch (p.getType()) {
|
|
|
+ case 1:
|
|
|
+ allInfo.setType("赔偿花费");
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ allInfo.setDescription("");
|
|
|
+ allInfo.setAmount(p.getAmount());
|
|
|
+ allInfo.setTime(new SimpleDateFormat("yyyy-MM-dd").format(p.getTime()));
|
|
|
+ rentInfoDTO.getAllInfoList().add(allInfo);
|
|
|
+ });
|
|
|
+ }
|
|
|
QueryWrapper<AppAssetConf> queryWrapper = new QueryWrapper();
|
|
|
queryWrapper.eq("is_delete", 0);
|
|
|
queryWrapper.eq("sn", param.getSn());
|
|
@@ -133,6 +172,33 @@ public class ApiAssetProfitController {
|
|
|
BaseInfoDTO baseInfo = (BaseInfoDTO) getBaseInfo(param).getData();
|
|
|
RentInfoDTO rentInfoDTO = new RentInfoDTO();
|
|
|
|
|
|
+ Page<AppAssetConf> appAssetConfPage = appAssetConfService.appAssetConfPageQuery(param);
|
|
|
+ if (appAssetConfPage.getTotal() > 0) {
|
|
|
+ appAssetConfPage.getRecords().forEach(p -> {
|
|
|
+ RentInfoDTO.AllInfo allInfo = new RentInfoDTO.AllInfo();
|
|
|
+ switch (p.getType()) {
|
|
|
+ case 1:
|
|
|
+ allInfo.setType("仓储费用");
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ allInfo.setType("运输费用");
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ allInfo.setType("销售费用");
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ allInfo.setType("平台费用");
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ allInfo.setDescription("");
|
|
|
+ allInfo.setAmount(p.getAmount());
|
|
|
+ allInfo.setTime(new SimpleDateFormat("yyyy-MM-dd").format(p.getTime()));
|
|
|
+ rentInfoDTO.getAllInfoList().add(allInfo);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
if (baseInfo != null) {
|
|
|
if (baseInfo.getStatus().equals(0) || baseInfo.getStatus().equals(14))
|
|
|
rentInfoDTO.setOpStorageState("未出库");
|
|
@@ -141,9 +207,9 @@ public class ApiAssetProfitController {
|
|
|
}
|
|
|
|
|
|
param.setTableOrder(1);
|
|
|
- RentInfoDTO assetProfitInfo =(RentInfoDTO) getAssetProfitInfo(param).getData();
|
|
|
- if (assetProfitInfo != null){
|
|
|
- rentInfoDTO.setOpCurrentCash(assetProfitInfo.getCash()==null?new BigDecimal(0):assetProfitInfo.getCash());
|
|
|
+ RentInfoDTO assetProfitInfo = (RentInfoDTO) getAssetProfitInfo(param).getData();
|
|
|
+ if (assetProfitInfo != null) {
|
|
|
+ rentInfoDTO.setOpCurrentCash(assetProfitInfo.getCash() == null ? new BigDecimal(0) : assetProfitInfo.getCash());
|
|
|
}
|
|
|
|
|
|
|
|
@@ -208,6 +274,28 @@ public class ApiAssetProfitController {
|
|
|
// 金融信息
|
|
|
else if (param.getTableOrder() != null && param.getTableOrder().equals(6)) {
|
|
|
RentInfoDTO rentInfoDTO = new RentInfoDTO();
|
|
|
+
|
|
|
+ Page<AppAssetConf> appAssetConfPage = appAssetConfService.appAssetConfPageQuery(param);
|
|
|
+ if (appAssetConfPage.getTotal() > 0) {
|
|
|
+ appAssetConfPage.getRecords().forEach(p -> {
|
|
|
+ RentInfoDTO.AllInfo allInfo = new RentInfoDTO.AllInfo();
|
|
|
+ switch (p.getType()) {
|
|
|
+ case 1:
|
|
|
+ allInfo.setType("金融成本已付");
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ allInfo.setType("金融成本未付");
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ allInfo.setDescription("");
|
|
|
+ allInfo.setAmount(p.getAmount());
|
|
|
+ allInfo.setTime(new SimpleDateFormat("yyyy-MM-dd").format(p.getTime()));
|
|
|
+ rentInfoDTO.getAllInfoList().add(allInfo);
|
|
|
+ });
|
|
|
+ }
|
|
|
QueryWrapper<AppAssetConf> queryWrapper = new QueryWrapper();
|
|
|
queryWrapper.eq("is_delete", 0);
|
|
|
queryWrapper.eq("sn", param.getSn());
|
|
@@ -235,6 +323,29 @@ public class ApiAssetProfitController {
|
|
|
// 处置信息
|
|
|
else if (param.getTableOrder() != null && param.getTableOrder().equals(7)) {
|
|
|
RentInfoDTO rentInfoDTO = new RentInfoDTO();
|
|
|
+ Page<AppAssetConf> appAssetConfPage = appAssetConfService.appAssetConfPageQuery(param);
|
|
|
+ if (appAssetConfPage.getTotal() > 0) {
|
|
|
+ appAssetConfPage.getRecords().forEach(p -> {
|
|
|
+ RentInfoDTO.AllInfo allInfo = new RentInfoDTO.AllInfo();
|
|
|
+ switch (p.getType()) {
|
|
|
+ case 1:
|
|
|
+ allInfo.setType("翻新金额-支");
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ allInfo.setType("处置支出");
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ allInfo.setType("处置收益");
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ allInfo.setDescription("");
|
|
|
+ allInfo.setAmount(p.getAmount());
|
|
|
+ allInfo.setTime(new SimpleDateFormat("yyyy-MM-dd").format(p.getTime()));
|
|
|
+ rentInfoDTO.getAllInfoList().add(allInfo);
|
|
|
+ });
|
|
|
+ }
|
|
|
QueryWrapper<AppAssetConf> queryWrapper = new QueryWrapper();
|
|
|
queryWrapper.eq("is_delete", 0);
|
|
|
queryWrapper.eq("sn", param.getSn());
|
|
@@ -251,6 +362,26 @@ public class ApiAssetProfitController {
|
|
|
// 其他信息
|
|
|
else if (param.getTableOrder() != null && param.getTableOrder().equals(8)) {
|
|
|
RentInfoDTO rentInfoDTO = new RentInfoDTO();
|
|
|
+ Page<AppAssetConf> appAssetConfPage = appAssetConfService.appAssetConfPageQuery(param);
|
|
|
+ if (appAssetConfPage.getTotal() > 0) {
|
|
|
+ appAssetConfPage.getRecords().forEach(p -> {
|
|
|
+ RentInfoDTO.AllInfo allInfo = new RentInfoDTO.AllInfo();
|
|
|
+ switch (p.getType()) {
|
|
|
+ case 1:
|
|
|
+ allInfo.setType("其他支出项目");
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ allInfo.setType("其他收入项目");
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ allInfo.setDescription("");
|
|
|
+ allInfo.setAmount(p.getAmount());
|
|
|
+ allInfo.setTime(new SimpleDateFormat("yyyy-MM-dd").format(p.getTime()));
|
|
|
+ rentInfoDTO.getAllInfoList().add(allInfo);
|
|
|
+ });
|
|
|
+ }
|
|
|
QueryWrapper<AppAssetConf> queryWrapper = new QueryWrapper();
|
|
|
queryWrapper.eq("is_delete", 0);
|
|
|
queryWrapper.eq("sn", param.getSn());
|
|
@@ -283,7 +414,7 @@ public class ApiAssetProfitController {
|
|
|
param.setTableOrder(1);
|
|
|
param.setFigureOrNot(false);
|
|
|
RentInfoDTO rentInfo = (RentInfoDTO) appAssetService.getRentInfo(param);
|
|
|
- if (rentInfo != null){
|
|
|
+ if (rentInfo != null) {
|
|
|
rentInfoDTO.setNetRental(rentInfo.getNetRental());
|
|
|
rentInfoDTO.setCashIn(rentInfo.getCashIn());
|
|
|
rentInfoDTO.setSecurityCash(rentInfo.getSecurityCash());
|
|
@@ -291,43 +422,43 @@ public class ApiAssetProfitController {
|
|
|
|
|
|
param.setTableOrder(7);
|
|
|
RentInfoDTO assetHandleInfo = (RentInfoDTO) getAssetProfitInfo(param).getData();
|
|
|
- if (assetHandleInfo != null){
|
|
|
+ if (assetHandleInfo != null) {
|
|
|
rentInfoDTO.setHandleProfit(assetHandleInfo.getHandleProfit());
|
|
|
}
|
|
|
|
|
|
param.setTableOrder(2);
|
|
|
RentInfoDTO assetOmInfo = (RentInfoDTO) getAssetProfitInfo(param).getData();
|
|
|
- if (assetOmInfo != null){
|
|
|
+ if (assetOmInfo != null) {
|
|
|
rentInfoDTO.setOmTotalCost(assetOmInfo.getOmTotalCost());
|
|
|
}
|
|
|
|
|
|
param.setTableOrder(3);
|
|
|
RentInfoDTO assetComInfo = (RentInfoDTO) getAssetProfitInfo(param).getData();
|
|
|
- if (assetComInfo != null){
|
|
|
+ if (assetComInfo != null) {
|
|
|
rentInfoDTO.setComTotalCost(assetComInfo.getComTotalCost());
|
|
|
}
|
|
|
|
|
|
param.setTableOrder(4);
|
|
|
RentInfoDTO assetSaleInfo = (RentInfoDTO) getAssetProfitInfo(param).getData();
|
|
|
- if (assetSaleInfo != null){
|
|
|
+ if (assetSaleInfo != null) {
|
|
|
rentInfoDTO.setSaleTotalCost(assetSaleInfo.getSaleTotalCost());
|
|
|
}
|
|
|
|
|
|
param.setTableOrder(5);
|
|
|
RentInfoDTO assetOpInfo = (RentInfoDTO) getAssetProfitInfo(param).getData();
|
|
|
- if (assetOpInfo != null){
|
|
|
+ if (assetOpInfo != null) {
|
|
|
rentInfoDTO.setOpTotalCost(assetOpInfo.getOpTotalCost());
|
|
|
}
|
|
|
|
|
|
param.setTableOrder(6);
|
|
|
RentInfoDTO assetFiInfo = (RentInfoDTO) getAssetProfitInfo(param).getData();
|
|
|
- if (assetFiInfo != null){
|
|
|
+ if (assetFiInfo != null) {
|
|
|
rentInfoDTO.setFiPaidCost(assetFiInfo.getFiPaidCost());
|
|
|
}
|
|
|
|
|
|
rentInfoDTO.setNetIncome(rentInfoDTO.getNetRental().add(rentInfoDTO.getCashIn()).add(rentInfoDTO.getSecurityCash()).add(rentInfoDTO.getHandleProfit()).add(
|
|
|
rentInfoDTO.getOmTotalCost()).add(rentInfoDTO.getComTotalCost()).add(rentInfoDTO.getSaleTotalCost()).add(rentInfoDTO.getOpTotalCost()).add(
|
|
|
- rentInfoDTO.getFiPaidCost()));
|
|
|
+ rentInfoDTO.getFiPaidCost()));
|
|
|
response = (RentInfoDTO) rentInfoDTO;
|
|
|
}
|
|
|
|
|
@@ -338,7 +469,7 @@ public class ApiAssetProfitController {
|
|
|
@RequestMapping(value = "getProfitInfoFigure", method = RequestMethod.POST)
|
|
|
public ApiDTO getAssetProfitInfoFigure(@RequestBody @ApiParam(name = "设备信息对象", value = "传入json格式", required = true) AssetProfitParam param) throws Exception {
|
|
|
|
|
|
- if (!StringUtils.hasLength(param.getSn())){
|
|
|
+ if (!StringUtils.hasLength(param.getSn())) {
|
|
|
throw new ApiRuntimeException("请输入sn");
|
|
|
}
|
|
|
// 租赁信息
|
|
@@ -358,7 +489,7 @@ public class ApiAssetProfitController {
|
|
|
@RequestMapping(value = "export", method = RequestMethod.POST)
|
|
|
public void export(@RequestBody @ApiParam(name = "设备信息对象", value = "传入json格式", required = true) AssetProfitParam param, HttpServletResponse response) {
|
|
|
|
|
|
- if (!StringUtils.hasLength(param.getSn())){
|
|
|
+ if (!StringUtils.hasLength(param.getSn())) {
|
|
|
throw new ApiRuntimeException("请输入sn");
|
|
|
}
|
|
|
try {
|
|
@@ -380,8 +511,8 @@ public class ApiAssetProfitController {
|
|
|
sysExcelFieldService.outExcelFile(sysExcelFieldService.export("rent_info", data), response, "租赁信息.xlsx");
|
|
|
}
|
|
|
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))) {
|
|
|
+ || param.getTableOrder().equals(5) || param.getTableOrder().equals(6)
|
|
|
+ || param.getTableOrder().equals(7) || param.getTableOrder().equals(8))) {
|
|
|
AssetPageQueryParam appAssetConf = new AssetPageQueryParam();
|
|
|
appAssetConf.setSn(param.getSn());
|
|
|
appAssetConf.setTableOrder(param.getTableOrder());
|
|
@@ -393,19 +524,19 @@ public class ApiAssetProfitController {
|
|
|
Page<AppAssetConf> page = new Page<>(appAssetConf.getIndex(), appAssetConf.getLength());
|
|
|
QueryWrapper<AppAssetConf> appAssetConfQueryWrapper = new QueryWrapper<>();
|
|
|
appAssetConfQueryWrapper.eq("is_delete", 0);
|
|
|
- if (StringUtils.hasLength(appAssetConf.getSn())){
|
|
|
+ if (StringUtils.hasLength(appAssetConf.getSn())) {
|
|
|
appAssetConfQueryWrapper.like("sn", appAssetConf.getSn());
|
|
|
}
|
|
|
- if (appAssetConf.getTableOrder() !=null){
|
|
|
+ if (appAssetConf.getTableOrder() != null) {
|
|
|
appAssetConfQueryWrapper.eq("table_order", appAssetConf.getTableOrder());
|
|
|
}
|
|
|
- if (appAssetConf.getType() != null){
|
|
|
+ if (appAssetConf.getType() != null) {
|
|
|
appAssetConfQueryWrapper.eq("type", appAssetConf.getType());
|
|
|
}
|
|
|
- if (appAssetConf.getTimeStart() != null){
|
|
|
+ if (appAssetConf.getTimeStart() != null) {
|
|
|
appAssetConfQueryWrapper.gt("time", appAssetConf.getTimeStart());
|
|
|
}
|
|
|
- if (appAssetConf.getTimeEnd() != null){
|
|
|
+ if (appAssetConf.getTimeEnd() != null) {
|
|
|
appAssetConfQueryWrapper.lt("time", appAssetConf.getTimeEnd());
|
|
|
}
|
|
|
Page<AppAssetConf> appAssetConfPage = appAssetConfService.page(page, appAssetConfQueryWrapper);
|
|
@@ -420,15 +551,28 @@ public class ApiAssetProfitController {
|
|
|
}});
|
|
|
});
|
|
|
}
|
|
|
- switch (param.getTableOrder()){
|
|
|
- case 2:sysExcelFieldService.outExcelFile(sysExcelFieldService.export("om_info", data), response, "运维信息.xlsx");break;
|
|
|
- case 3:sysExcelFieldService.outExcelFile(sysExcelFieldService.export("com_info", data), response, "赔偿信息.xlsx");break;
|
|
|
- case 5:sysExcelFieldService.outExcelFile(sysExcelFieldService.export("op_info", data), response, "运营信息.xlsx");break;
|
|
|
- case 6:sysExcelFieldService.outExcelFile(sysExcelFieldService.export("fi_info", data), response, "金融成本信息.xlsx");break;
|
|
|
- case 7:sysExcelFieldService.outExcelFile(sysExcelFieldService.export("handle_info", data), response, "处置信息.xlsx");break;
|
|
|
- case 8:sysExcelFieldService.outExcelFile(sysExcelFieldService.export("other_info", data), response, "其他信息.xlsx");break;
|
|
|
-
|
|
|
- default:break;
|
|
|
+ switch (param.getTableOrder()) {
|
|
|
+ case 2:
|
|
|
+ sysExcelFieldService.outExcelFile(sysExcelFieldService.export("om_info", data), response, "运维信息.xlsx");
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ sysExcelFieldService.outExcelFile(sysExcelFieldService.export("com_info", data), response, "赔偿信息.xlsx");
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ sysExcelFieldService.outExcelFile(sysExcelFieldService.export("op_info", data), response, "运营信息.xlsx");
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ sysExcelFieldService.outExcelFile(sysExcelFieldService.export("fi_info", data), response, "金融成本信息.xlsx");
|
|
|
+ break;
|
|
|
+ case 7:
|
|
|
+ sysExcelFieldService.outExcelFile(sysExcelFieldService.export("handle_info", data), response, "处置信息.xlsx");
|
|
|
+ break;
|
|
|
+ case 8:
|
|
|
+ sysExcelFieldService.outExcelFile(sysExcelFieldService.export("other_info", data), response, "其他信息.xlsx");
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
}
|