禅道bug修复

This commit is contained in:
马三炮 2026-02-05 15:56:15 +08:00
parent d72ac83eeb
commit fc2df2797c
16 changed files with 105 additions and 46 deletions

View File

@ -8,6 +8,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
@ -287,14 +288,14 @@ public class WorkloadAndCarSummaryExcelExporter {
// 工作量合计
createCell(totalRow, COL_A, "合计", totalStyle);
int workloadTotal = 0;
int settlementWorkloadTotal = 0;
BigDecimal workloadTotal = BigDecimal.ZERO;
BigDecimal settlementWorkloadTotal = BigDecimal.ZERO;
for (WorkloadSummaryExcelVo vo : workloadData) {
if (vo != null && vo.getTotalAmount() != null) {
workloadTotal += vo.getTotalAmount();
workloadTotal = workloadTotal.add(vo.getTotalAmount());
}
if (vo != null && vo.getSettlementTotalAmount() != null) {
settlementWorkloadTotal += vo.getSettlementTotalAmount();
settlementWorkloadTotal = settlementWorkloadTotal.add(vo.getSettlementTotalAmount());
}
}
createCell(totalRow, COL_G, workloadTotal, totalStyle);
@ -365,6 +366,16 @@ public class WorkloadAndCarSummaryExcelExporter {
} else if (value instanceof Integer) {
cell.setCellValue((Integer) value);
}
// 扩展支持BigDecimal若VO中金额为BigDecimal类型
else if (value instanceof java.math.BigDecimal) {
cell.setCellValue(((java.math.BigDecimal) value).doubleValue());
}
// 扩展支持Long/Double按需添加
else if (value instanceof Long) {
cell.setCellValue((Long) value);
} else if (value instanceof Double) {
cell.setCellValue((Double) value);
}
cell.setCellStyle(style);
}
}

View File

@ -7,6 +7,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
@ -23,9 +24,9 @@ import java.util.List;
public class WorkloadSummaryExcelExporter {
// 列索引常量仅保留工作量相关列
private static final int COL_A = 0, COL_B = 1, COL_C = 2, COL_D = 3, COL_E = 4, COL_F = 5;
private static final int COL_A = 0, COL_B = 1, COL_C = 2, COL_D = 3, COL_E = 4, COL_F = 5, COL_G = 6, COL_H = 7;
// 标题行涉及的列范围A-F
private static final int[] TITLE_COLS = {COL_A, COL_B, COL_C, COL_D, COL_E, COL_F};
private static final int[] TITLE_COLS = {COL_A, COL_B, COL_C, COL_D, COL_E, COL_F, COL_G, COL_H};
/**
* 导出方法仅工作量表格支持单日/区间标题
@ -205,8 +206,10 @@ public class WorkloadSummaryExcelExporter {
createCell(row1, COL_B, "运检站", headerStyle);
createCell(row1, COL_C, "工作量类型", headerStyle);
createCell(row1, COL_D, "工作量", headerStyle);
createCell(row1, COL_E, "单价", headerStyle);
createCell(row1, COL_F, "合计", headerStyle);
createCell(row1, COL_E, "绩效单价", headerStyle);
createCell(row1, COL_F, "结算单价", headerStyle);
createCell(row1, COL_G, "绩效合计", headerStyle);
createCell(row1, COL_H, "结算合计", headerStyle);
}
/**
@ -225,7 +228,9 @@ public class WorkloadSummaryExcelExporter {
createCell(row, COL_C, workloadVo.getWorkloadCategoryName() == null ? "" : workloadVo.getWorkloadCategoryName(), contentStyle);
createCell(row, COL_D, workloadVo.getTotalWorkload() == null ? 0 : workloadVo.getTotalWorkload(), contentStyle);
createCell(row, COL_E, workloadVo.getUnitPrice() == null ? 0 : workloadVo.getUnitPrice(), contentStyle);
createCell(row, COL_F, workloadVo.getTotalAmount() == null ? 0 : workloadVo.getTotalAmount(), contentStyle);
createCell(row, COL_F, workloadVo.getSettlementUnitPrice() == null ? 0 : workloadVo.getSettlementUnitPrice(), contentStyle);
createCell(row, COL_G, workloadVo.getTotalAmount() == null ? 0 : workloadVo.getTotalAmount(), contentStyle);
createCell(row, COL_H, workloadVo.getSettlementTotalAmount() == null ? 0 : workloadVo.getSettlementTotalAmount(), contentStyle);
}
}
@ -237,19 +242,24 @@ public class WorkloadSummaryExcelExporter {
// 工作量合计
createCell(totalRow, COL_A, "合计", totalStyle);
int workloadTotal = 0;
BigDecimal workloadTotal = BigDecimal.ZERO;
BigDecimal settlementWorkloadTotal = BigDecimal.ZERO;
for (WorkloadSummaryExcelVo vo : workloadData) {
if (vo != null && vo.getTotalAmount() != null) {
workloadTotal += vo.getTotalAmount();
workloadTotal = workloadTotal.add(vo.getTotalAmount());
}
if (vo != null && vo.getSettlementTotalAmount() != null) {
settlementWorkloadTotal = settlementWorkloadTotal.add(vo.getSettlementTotalAmount());
}
}
createCell(totalRow, COL_F, workloadTotal, totalStyle);
createCell(totalRow, COL_G, workloadTotal, totalStyle);
createCell(totalRow, COL_H, settlementWorkloadTotal, totalStyle);
// 合计行其他单元格填充空值+样式
createCell(totalRow, COL_B, "", totalStyle);
createCell(totalRow, COL_C, "", totalStyle);
createCell(totalRow, COL_D, "", totalStyle);
createCell(totalRow, COL_E, "", totalStyle);
createCell(totalRow, COL_F, "", totalStyle);
}
/**
@ -257,9 +267,9 @@ public class WorkloadSummaryExcelExporter {
*/
private static void setMergedRegions(Sheet sheet, int totalRowNum) {
// 一级标题合并A0-F0
sheet.addMergedRegion(new CellRangeAddress(0, 0, COL_A, COL_F));
sheet.addMergedRegion(new CellRangeAddress(0, 0, COL_A, COL_H));
// 合计行合并A{totalRowNum}-E{totalRowNum}
sheet.addMergedRegion(new CellRangeAddress(totalRowNum, totalRowNum, COL_A, COL_E));
sheet.addMergedRegion(new CellRangeAddress(totalRowNum, totalRowNum, COL_A, COL_F));
}
/**

View File

@ -81,6 +81,8 @@ public class InspectionStationController extends BaseController {
return AjaxResult.error("运检站下有计划,请勿删除");
} else if (res == 4) {
return AjaxResult.error("请先删除填报人员");
} else if (res == 5) {
return AjaxResult.error("运检站下有合同,请勿删除");
} else {
return AjaxResult.error("删除失败");
}

View File

@ -33,10 +33,10 @@ public class DayPlanStatisticsVo {
private List<SubWorkNumStatistics> jjSubWorkNumStatisticsList;
/**车辆统计-运检业务*/
private List<CarNumStatistics> YJCarNumStatisticsList;
private List<CarNumStatistics> yJCarNumStatisticsList;
/**车辆统计-基建业务*/
private List<CarNumStatistics> JJCarNumStatisticsList;
private List<CarNumStatistics> jJCarNumStatisticsList;
/**工作量清单*/
private List<WorkLoad> workLoadList;

View File

@ -2,6 +2,7 @@ package com.bonus.digital.dao;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@ -170,7 +171,7 @@ public class MonthlyPlanVo {
/**
* 单价
*/
private Integer unitPrice;
private BigDecimal unitPrice;
/**
* 工作量类别
@ -185,7 +186,7 @@ public class MonthlyPlanVo {
/**
* 合计金额
*/
private Integer totalAmount;
private BigDecimal totalAmount;
private Integer totalManageCarDays;
@ -216,11 +217,11 @@ public class MonthlyPlanVo {
/**
* 结算单价
*/
private int settlementUnitPrice;
private BigDecimal settlementUnitPrice;
/**
* 结算合计
*/
private Integer settlementTotalAmount;
private BigDecimal settlementTotalAmount;
}

View File

@ -4,6 +4,8 @@ import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
import java.math.BigDecimal;
/**
* 工作量清单导出Vo数据行
* 适配模板A-F列索引0-5
@ -28,17 +30,17 @@ public class WorkloadSummaryExcelVo {
@ExcelProperty(value = "绩效单价", index = 4) // E列
@ColumnWidth(10)
private Integer unitPrice;
private BigDecimal unitPrice;
@ExcelProperty(value = "结算单价", index = 5) // G列
@ColumnWidth(10)
private Integer settlementUnitPrice;
private BigDecimal settlementUnitPrice;
@ExcelProperty(value = "绩效合计", index = 6) // F列
@ColumnWidth(12)
private Integer totalAmount;
private BigDecimal totalAmount;
@ExcelProperty(value = "结算合计", index = 7) // H列
@ColumnWidth(10)
private Integer settlementTotalAmount;
private BigDecimal settlementTotalAmount;
}

View File

@ -1,5 +1,6 @@
package com.bonus.digital.mapper;
import com.bonus.digital.dao.ContractVo;
import com.bonus.digital.dao.InspectionStationVo;
import java.util.List;
@ -28,4 +29,6 @@ public interface InspectionStationMapper {
InspectionStationVo getInspectionStationDetail(InspectionStationVo inspectionStationVo);
InspectionStationVo getInspectionStation(InspectionStationVo inspectionStationVo);
List<ContractVo> getContract(InspectionStationVo inspectionStationVo);
}

View File

@ -10,6 +10,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -120,8 +122,11 @@ public class DayPlanServiceImpl implements DayPlanService {
exportVo.setInspectionStationName(vo.getInspectionStationName()); // 运检站
exportVo.setWorkloadCategoryName(vo.getWorkloadCategoryName()); // 工作量类别
exportVo.setTotalWorkload(vo.getTotalWorkload()); // 总工作量
exportVo.setUnitPrice(vo.getUnitPrice()); // 单价
exportVo.setTotalAmount(vo.getTotalAmount()); // 合计金额
exportVo.setUnitPrice(vo.getUnitPrice().divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP)); // 绩效单价
exportVo.setTotalAmount(vo.getTotalAmount().divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP)); // 合计金额
exportVo.setSettlementUnitPrice(vo.getSettlementUnitPrice().divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP));// 结算单价
exportVo.setSettlementTotalAmount(vo.getSettlementTotalAmount().divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP));//结算合计
exportList.add(exportVo);
}

View File

@ -3,6 +3,7 @@ package com.bonus.digital.service.impl;
import com.bonus.common.core.domain.entity.SysUser;
import com.bonus.common.utils.SecurityUtils;
import com.bonus.common.utils.StringUtils;
import com.bonus.digital.dao.ContractVo;
import com.bonus.digital.dao.InspectionStationVo;
import com.bonus.digital.dao.PersonnelVo;
import com.bonus.digital.dao.PlanManagementVo;
@ -84,6 +85,11 @@ public class InspectionStationServiceImpl implements InspectionStationService {
if (StringUtils.isNotEmpty(userList)) {
return 4;
}
List<ContractVo> contractVoList = inspectionStationMapper.getContract(inspectionStationVo);
if (StringUtils.isNotEmpty(contractVoList)) {
return 5;
}
return inspectionStationMapper.delInspectionStation(inspectionStationVo);
}

View File

@ -185,7 +185,9 @@ public class MonthlyPlanServiceImpl implements MonthlyPlanService {
// 关键设置人员安排表的日期支持多个日期
List<String> arrangeDays = new ArrayList<>();
arrangeDays.add(arrangeDay);
// 若同一人员有多个安排日期合并到arrangeDays需根据实际业务调整
exportVo.setArrangeDays(arrangeDays);
plannedList.add(exportVo);
/*// 若同一人员有多个安排日期合并到arrangeDays需根据实际业务调整
Optional<ExportMonthPlanPersonVo> existVo = plannedList.stream()
.filter(v -> v.getName().equals(personnel.getName())
&& v.getInspectionStationName().equals(planVo.getInspectionStationName()))
@ -193,9 +195,8 @@ public class MonthlyPlanServiceImpl implements MonthlyPlanService {
if (existVo.isPresent()) {
existVo.get().getArrangeDays().add(arrangeDay);
} else {
exportVo.setArrangeDays(arrangeDays);
plannedList.add(exportVo);
}
}*/
}
}
}
@ -222,10 +223,10 @@ public class MonthlyPlanServiceImpl implements MonthlyPlanService {
exportVo.setInspectionStationName(vo.getInspectionStationName()); // 运检站
exportVo.setWorkloadCategoryName(vo.getWorkloadCategoryName()); // 工作量类别
exportVo.setTotalWorkload(vo.getTotalWorkload()); // 总工作量
exportVo.setUnitPrice(vo.getUnitPrice()/100); // 绩效单价
exportVo.setTotalAmount(vo.getTotalAmount()/100); // 合计金额
exportVo.setSettlementUnitPrice(vo.getSettlementUnitPrice()/100);// 结算单价
exportVo.setSettlementTotalAmount(vo.getSettlementTotalAmount()/100);//结算合计
exportVo.setUnitPrice(vo.getUnitPrice().divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP)); // 绩效单价
exportVo.setTotalAmount(vo.getTotalAmount().divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP)); // 合计金额
exportVo.setSettlementUnitPrice(vo.getSettlementUnitPrice().divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP));// 结算单价
exportVo.setSettlementTotalAmount(vo.getSettlementTotalAmount().divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP));//结算合计
exportList.add(exportVo);
}

View File

@ -97,7 +97,19 @@ public class PlanManagementServiceImpl implements PlanManagementService {
){
return "缺少必填项";
}
// 处理月份格式确保月份为两位数如2026-1 -> 2026-01
String planManagementMonth = planManagementVo.getPlanManagementMonth();
if (planManagementMonth.contains("-")) {
String[] parts = planManagementMonth.split("-");
if (parts.length == 2) {
String year = parts[0];
String month = parts[1];
// 使用padl方法补0确保月份为两位数
month = StringUtils.padl(month, 2, '0');
// 重新组合月份格式
planManagementVo.setPlanManagementMonth(year + "-" + month);
}
}
//获取运检站信息
InspectionStationVo inspectionStationVo = new InspectionStationVo();
inspectionStationVo.setInspectionStationName(planManagementVo.getInspectionStationName());

View File

@ -104,6 +104,6 @@
ts.settlement_batch,
ts.settlement_payment,
ts.settlement_tax
from tb_settlement ts where ts.contract_id = #{contractId}
from tb_settlement ts where ts.contract_id = #{contractId} and ts.is_active = '1'
</select>
</mapper>

View File

@ -197,9 +197,10 @@
tmp.inspection_station_name,
tw.workload_category_name,
IFNULL(tw.unit_price, 0) as unit_price,
IFNULL(tw.settlement_unit_price, 0) as s,
IFNULL(tw.settlement_unit_price, 0) as settlementUnitPrice,
IFNULL(SUM(tw.workload_num), 0) as total_workload,
IFNULL(SUM(tw.workload_num), 0) * IFNULL(tw.unit_price, 0) as total_amount
IFNULL(SUM(tw.workload_num), 0) * IFNULL(tw.unit_price, 0) as total_amount,
IFNULL(SUM(tw.workload_num), 0) * IFNULL(tw.settlement_unit_price, 0) as settlementTotalAmount
from tb_day_plan tdp
left join tb_monthly_plan tmp
on tmp.monthly_plan_id = tdp.monthly_plan_id

View File

@ -15,7 +15,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SUM(CASE WHEN day_plan_type = '1' THEN actual_personnel ELSE 0 END) AS maintenanceNum
FROM tb_day_plan
WHERE day_plan = #{currentDate}
AND status = '1'
AND is_active = '1'
AND day_plan_type IN ('0', '1')
GROUP BY monthly_plan_id
@ -33,7 +32,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SUM(CASE WHEN day_plan_type = '2' THEN actual_personnel ELSE 0 END) AS jjNum
FROM tb_day_plan
WHERE day_plan = #{currentDate}
AND status = '1'
AND is_active = '1'
AND day_plan_type = '2'
GROUP BY monthly_plan_id
@ -53,7 +51,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SUM(actual_assistance_personnel) AS num2
FROM tb_day_plan
WHERE day_plan = #{currentDate}
AND status = '1'
AND is_active = '1'
AND day_plan_type = '1'
GROUP BY monthly_plan_id
@ -73,7 +70,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SUM(actual_assistance_personnel) AS num2
FROM tb_day_plan
WHERE day_plan = #{currentDate}
AND status = '1'
AND is_active = '1'
AND day_plan_type = '2'
GROUP BY monthly_plan_id
@ -107,7 +103,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SUM(IF(day_plan_type = '1', IFNULL(actual_sub_car, 0), 0)) AS num6
FROM tb_day_plan
WHERE day_plan = #{currentDate}
AND status = '1'
AND is_active = '1'
AND day_plan_type IN ('0', '1')
GROUP BY monthly_plan_id
@ -134,7 +129,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SUM(IF(day_plan_type = '2', IFNULL(actual_sub_car, 0), 0)) AS num3
FROM tb_day_plan
WHERE day_plan = #{currentDate}
AND status = '1'
AND is_active = '1'
AND day_plan_type = '2'
GROUP BY monthly_plan_id
@ -161,7 +155,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM tb_day_plan tdp
INNER JOIN tb_workload tw ON tw.plan_id = tdp.day_plan_id
WHERE tdp.day_plan = #{currentDate}
AND tdp.status = '1'
AND tdp.is_active = '1'
AND tdp.day_plan_type = '1'
AND tw.data_source = '1'

View File

@ -45,4 +45,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from tb_inspection_station where category = #{category} and is_active = '1' and
inspection_station_name = #{inspectionStationName}
</select>
<select id="getContract" resultType="com.bonus.digital.dao.ContractVo">
select tc.contract_id,
tc.inspection_station_id,
tc.inspection_station_name,
tc.contract_period,
tc.contract_name,
tc.contract_code,
tc.contract_status,
tc.remark
from tb_contract tc where tc.inspection_station_id = #{inspectionStationId} and tc.is_active = '1'
</select>
</mapper>

View File

@ -77,6 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND (tpm.project_name like concat('%', #{keyWord}, '%')
or tpm.work_content like concat('%', #{keyWord}, '%'))
</if>
order by tpm.plan_management_month desc
</select>
<select id="getMonthPlanByPlanId" resultType="com.bonus.digital.dao.MonthlyPlanVo">
select tmp.monthly_plan_id,