资产占用月度报表
This commit is contained in:
parent
37f581eeeb
commit
c721b26c33
|
|
@ -3,6 +3,7 @@ package com.bonus.material.basic.controller;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||||
import com.bonus.common.biz.config.ListPagingUtil;
|
import com.bonus.common.biz.config.ListPagingUtil;
|
||||||
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
import com.bonus.common.core.utils.ServletUtils;
|
import com.bonus.common.core.utils.ServletUtils;
|
||||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||||
import com.bonus.common.core.web.controller.BaseController;
|
import com.bonus.common.core.web.controller.BaseController;
|
||||||
|
|
@ -737,4 +738,38 @@ public class BmReportController extends BaseController {
|
||||||
int idx = url.lastIndexOf('.');
|
int idx = url.lastIndexOf('.');
|
||||||
return (idx > 0 && idx < url.length() - 1) ? url.substring(idx) : "";
|
return (idx > 0 && idx < url.length() - 1) ? url.substring(idx) : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资产占有月度报表查询
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "资产占有月度报表查询")
|
||||||
|
@GetMapping("/getAssetReportList")
|
||||||
|
public AjaxResult getAssetReportList(AssetReportInfo bean) {
|
||||||
|
startPage();
|
||||||
|
List<AssetReportInfo> pageList = bmReportService.getAssetReportList(bean);
|
||||||
|
return AjaxResult.success(getDataTable(pageList));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出资产占有月度报表
|
||||||
|
* @param response
|
||||||
|
* @param bean
|
||||||
|
*/
|
||||||
|
@ApiOperation("导出资产占有月度报表")
|
||||||
|
@PostMapping("/exportAssetReportList")
|
||||||
|
public void exportAssetReportList(HttpServletResponse response, AssetReportInfo bean)
|
||||||
|
{
|
||||||
|
String fileName = "资产占有月度报表";
|
||||||
|
List<AssetReportInfo> list = bmReportService.getAssetReportList(bean);
|
||||||
|
// 根据list集合数,去填充序号
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
list.get(i).setSeq(i + 1);
|
||||||
|
}
|
||||||
|
ExcelUtil<AssetReportInfo> util = new ExcelUtil<>(AssetReportInfo.class);
|
||||||
|
// 获取当前年月日时分秒导出时间,用括号拼接在后面
|
||||||
|
String title = "资产占有月度报表" + "(" + "导出时间:" + DateUtils.getTime() + ")";
|
||||||
|
util.exportExcel(response, list, fileName, title);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.bonus.material.basic.domain.report;
|
||||||
|
|
||||||
|
import com.bonus.common.core.annotation.Excel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资产占用月度报表info
|
||||||
|
* @Author ma_sh
|
||||||
|
* @create 2025/11/19 9:36
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AssetReportInfo {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "序号")
|
||||||
|
@Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC, width = 5,sort = 0)
|
||||||
|
private Integer seq;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "工程id")
|
||||||
|
private String proId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "工程名称")
|
||||||
|
@Excel(name = "工程名称")
|
||||||
|
private String projectName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "投入费用")
|
||||||
|
@Excel(name = "投入费用(万元)", cellType = Excel.ColumnType.NUMERIC, align = HorizontalAlignment.RIGHT)
|
||||||
|
private BigDecimal inputCost;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "在用费用")
|
||||||
|
@Excel(name = "在用费用(万元)", cellType = Excel.ColumnType.NUMERIC, align = HorizontalAlignment.RIGHT)
|
||||||
|
private BigDecimal useCost;
|
||||||
|
}
|
||||||
|
|
@ -136,4 +136,11 @@ public interface BmReportMapper {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<LeaseOutInfo> selectPublishList(LeaseOutInfo bean);
|
List<LeaseOutInfo> selectPublishList(LeaseOutInfo bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资产占有月度报表查询
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<AssetReportInfo> getAssetReportList(AssetReportInfo bean);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,4 +123,11 @@ public interface BmReportService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<ReportQuery> getReportList(ReportQuery bean);
|
List<ReportQuery> getReportList(ReportQuery bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资产占有月度报表查询
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<AssetReportInfo> getAssetReportList(AssetReportInfo bean);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -412,4 +412,14 @@ public class BmReportServiceImpl implements BmReportService {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资产占有月度报表查询
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<AssetReportInfo> getAssetReportList(AssetReportInfo bean) {
|
||||||
|
return bmReportMapper.getAssetReportList(bean);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -758,4 +758,59 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
GROUP BY sd.dept_id,df.id,bp.pro_id,sai.type_id,LEFT(sai.start_time,10),sai.ma_id
|
GROUP BY sd.dept_id,df.id,bp.pro_id,sai.type_id,LEFT(sai.start_time,10),sai.ma_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getAssetReportList" resultType="com.bonus.material.basic.domain.report.AssetReportInfo">
|
||||||
|
SELECT
|
||||||
|
res.proId as proId,
|
||||||
|
res.proName as projectName,
|
||||||
|
ROUND(SUM(res.inMoney) / 10000, 2) as inputCost,
|
||||||
|
ROUND(SUM(res.useMoney) / 10000, 2) as useCost
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
bp.pro_id as proId,
|
||||||
|
bp.pro_name as proName,
|
||||||
|
sai.num,
|
||||||
|
mt.buy_price,
|
||||||
|
sai.num * mt.buy_price as inMoney,
|
||||||
|
0 as useMoney
|
||||||
|
FROM
|
||||||
|
slt_agreement_info sai
|
||||||
|
LEFT JOIN bm_agreement_info bai on sai.agreement_id = bai.agreement_id
|
||||||
|
LEFT JOIN bm_project bp on bai.project_id = bp.pro_id
|
||||||
|
LEFT JOIN ma_type mt on sai.type_id = mt.type_id
|
||||||
|
WHERE sai.is_slt = 0
|
||||||
|
<if test="proId != null">
|
||||||
|
AND bp.pro_id = #{proId}
|
||||||
|
</if>
|
||||||
|
<if test="projectName != null and projectName != ''">
|
||||||
|
AND bp.pro_name LIKE CONCAT('%', #{projectName}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
UNION ALL
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
bp.pro_id as proId,
|
||||||
|
bp.pro_name as proName,
|
||||||
|
sai.num,
|
||||||
|
mt.buy_price,
|
||||||
|
0 as inMoney,
|
||||||
|
IF(sai.`status` = 0, sai.num * mt.buy_price, 0) as useMoney
|
||||||
|
FROM
|
||||||
|
slt_agreement_info sai
|
||||||
|
LEFT JOIN bm_agreement_info bai on sai.agreement_id = bai.agreement_id
|
||||||
|
LEFT JOIN bm_project bp on bai.project_id = bp.pro_id
|
||||||
|
LEFT JOIN ma_type mt on sai.type_id = mt.type_id
|
||||||
|
WHERE sai.is_slt = 0 AND sai.`status` = 0 AND sai.source = 1
|
||||||
|
<if test="proId != null">
|
||||||
|
AND bp.pro_id = #{proId}
|
||||||
|
</if>
|
||||||
|
<if test="projectName != null and projectName != ''">
|
||||||
|
AND bp.pro_name LIKE CONCAT('%', #{projectName}, '%')
|
||||||
|
</if>
|
||||||
|
) as res
|
||||||
|
WHERE proId is not null
|
||||||
|
GROUP BY res.proId
|
||||||
|
ORDER BY res.inMoney DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue