feature: 功能调整

This commit is contained in:
曹鹏飞 2024-12-02 15:48:00 +08:00
parent d98099c16e
commit 9bb2b7a28f
7 changed files with 60 additions and 97 deletions

View File

@ -30,31 +30,43 @@ public class VirtualWorkingEntity extends EntityBase implements Serializable {
@ApiModelProperty(value = "工时类型")
private String name;
@TableField(value = "hourly_auxiliary_fee")
@ApiModelProperty(value = "每小时辅助费用")
private BigDecimal hourlyAuxiliaryFee;
@TableField(value = "user_num")
@ApiModelProperty(value = "本车间一线人数")
private Integer userNum;
@TableField(value = "fee_total_year")
@TableField(value = "workshop_total_fee")
@ApiModelProperty(value = "年度总费用")
private BigDecimal feeTotalYear;
private BigDecimal workshopTotalFee;
@TableField(value = "fee_equipment_depreciation")
@TableField(value = "consumables_fee")
@ApiModelProperty(value = "水电费、生产耗材费用")
private BigDecimal consumablesFee;
@TableField(value = "equipment_depreciation_fee")
@ApiModelProperty("设备折旧")
private BigDecimal feeEquipmentDepreciation;
private BigDecimal equipmentDepreciationFee;
@TableField(value = "fee_workshop_labor_cost")
@TableField(value = "workshop_labor_fee")
@ApiModelProperty("车间管理人工费")
private BigDecimal feeWorkshopLaborCost;
private BigDecimal workshopLaborFee;
@TableField(value = "fee_workshop_office")
@TableField(value = "workshop_office_fee")
@ApiModelProperty("车间办公室费用")
private BigDecimal feeWorkshopOffice;
private BigDecimal workshopOfficeFee;
@TableField(value = "fee_assistant_labor_cost_total")
@ApiModelProperty("辅助部门年度总人工")
private BigDecimal feeAssistantLaborCostTotal;
@TableField(value = "assistant_total_fee")
@ApiModelProperty("辅助部门年度总费用")
private BigDecimal assistantTotalFee;
@TableField(value = "fee_assistant")
@TableField(value = "assistant_labor_fee")
@ApiModelProperty("辅助部门人工费")
private BigDecimal assistantLaborFee;
@TableField(value = "assistant_fee")
@ApiModelProperty("辅助部门费用")
private BigDecimal feeAssistant;
private BigDecimal assistantFee;
}

View File

@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import java.io.Serializable;
import java.math.BigDecimal;
@ -19,23 +18,23 @@ import java.math.BigDecimal;
@ApiModel(value = "com-nflg-product-technology-pojo-query-MonthlyWorkingHoursConfigQuery")
public class MonthlyWorkingHoursConfigQuery implements Serializable {
@ApiModelProperty("每月理论满负荷工时")
@Min(value = 0, message = "每月理论满负荷工时必须大于等于0")
private BigDecimal monthlyWorkingHours;
@ApiModelProperty("车间一线人数")
@Min(value = 0, message = "车间一线人数必须大于等于0")
@Max(value = 10000, message = "车间一线人数必须小于等于10000")
private Integer userNum;
@ApiModelProperty("每人每日理论工时数")
@Min(value = 0, message = "每人每日理论工时数必须大于等于0")
@Max(value = 24, message = "每人每日理论工时数必须小于等于24")
private Integer dailyHours;
@ApiModelProperty("每月理论工作天数")
@Min(value = 0, message = "每月理论工作天数必须大于等于0")
@Max(value = 31, message = "每月理论工作天数必须小于等于31")
private Integer monthlyWorkingDays;
@ApiModelProperty("工时修正系数K值")
@Min(value = 0, message = "工时修正系数K值必须大于等于0")
@Max(value = 1, message = "工时修正系数K值必须小于等于1")
private BigDecimal correctionFactor;
}

View File

@ -27,31 +27,43 @@ public class VirtualWorking implements Serializable {
@NotBlank(message = "工时类型不能为空")
private String name;
@ApiModelProperty("每小时辅助费用")
@Min(value = 0, message = "每小时辅助费用必须大于等于0")
private BigDecimal hourlyAuxiliaryFee;
@ApiModelProperty("本车间一线人数")
@Positive(message = "本车间一线人数必须大于0")
private Integer userNum;
@ApiModelProperty("年度总费用")
@Min(value = 0, message = "年度总费用必须大于等于0")
private BigDecimal feeTotalYear;
private BigDecimal workshopTotalFee;
@ApiModelProperty("水电费、生产耗材费用")
@Min(value = 0, message = "水电费、生产耗材费用用必须大于等于0")
private BigDecimal consumablesFee;
@ApiModelProperty("设备折旧")
@Min(value = 0, message = "设备折旧必须大于等于0")
private BigDecimal feeEquipmentDepreciation;
private BigDecimal equipmentDepreciationFee;
@ApiModelProperty("车间管理人工费")
@Min(value = 0, message = "车间管理人工费必须大于等于0")
private BigDecimal feeWorkshopLaborCost;
private BigDecimal workshopLaborFee;
@ApiModelProperty("车间办公室费用")
@Min(value = 0, message = "车间办公室费用必须大于等于0")
private BigDecimal feeWorkshopOffice;
private BigDecimal workshopOfficeFee;
@ApiModelProperty("辅助部门年度总人工")
@Min(value = 0, message = "辅助部门年度总人工必须大于等于0")
private BigDecimal feeAssistantLaborCostTotal;
@ApiModelProperty("辅助部门年度总费用")
@Min(value = 0, message = "辅助部门年度总费用用必须大于等于0")
private BigDecimal assistantTotalFee;
@ApiModelProperty("辅助部门人工费")
@Min(value = 0, message = "辅助部门人工费必须大于等于0")
private BigDecimal assistantLaborFee;
@ApiModelProperty("辅助部门费用")
@Min(value = 0, message = "辅助部门费用必须大于等于0")
private BigDecimal feeAssistant;
private BigDecimal assistantFee;
}

View File

@ -1,8 +1,5 @@
package com.nflg.product.technology.pojo.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.nflg.product.base.core.config.BigDecimalSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -10,7 +7,6 @@ import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Objects;
@Data
@Accessors(chain = true)
@ -18,27 +14,7 @@ import java.util.Objects;
public class MonthlyWorkingHoursConfigVO implements Serializable {
@ApiModelProperty("每月理论满负荷工时")
@JsonFormat(pattern = "#.####")
@JsonSerialize(using = BigDecimalSerializer.class)
private BigDecimal monthlyWorkingHoursCost;
public BigDecimal getMonthlyWorkingHoursCost() {
if (Objects.isNull(this.getCorrectionFactor())) {
return null;
}
return this.getCorrectionFactor()
.multiply(BigDecimal.valueOf(nullToOne(this.getUserNum())))
.multiply(BigDecimal.valueOf(nullToOne(this.getDailyHours())))
.multiply(BigDecimal.valueOf(nullToOne(this.getMonthlyWorkingDays())));
}
private Integer nullToOne(Integer value) {
if (Objects.isNull(value)) {
return 1;
} else {
return value;
}
}
private BigDecimal monthlyWorkingHours;
@ApiModelProperty("车间一线人数")
private Integer userNum;

View File

@ -1,9 +1,5 @@
package com.nflg.product.technology.pojo.vo;
import cn.hutool.core.util.NumberUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.nflg.product.base.core.config.BigDecimalSerializer;
import com.nflg.product.technology.pojo.query.VirtualWorking;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -11,7 +7,6 @@ import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
@ -23,26 +18,6 @@ import java.time.LocalDateTime;
@ApiModel(value = "com-nflg-product-technology-pojo-vo-VirtualWorkingItemVO")
public class VirtualWorkingItemVO extends VirtualWorking implements Serializable {
@ApiModelProperty(value = "每小时辅助费用")
@JsonFormat(pattern = "#.####")
@JsonSerialize(using = BigDecimalSerializer.class)
private BigDecimal hourlyAuxiliaryFee;
public BigDecimal getHourlyAuxiliaryFee() {
return NumberUtil.add(getAuxiliaryMaterialsAndConsumables(), getFeeEquipmentDepreciation()
, getFeeWorkshopLaborCost(), getFeeWorkshopOffice(), getAuxiliaryDepartmentLaborCosts(), getFeeAssistant());
}
@ApiModelProperty(value = "水电及生产辅料耗材")
@JsonFormat(pattern = "#.####")
@JsonSerialize(using = BigDecimalSerializer.class)
private BigDecimal auxiliaryMaterialsAndConsumables;
@ApiModelProperty(value = "辅助部门人工费")
@JsonFormat(pattern = "#.####")
@JsonSerialize(using = BigDecimalSerializer.class)
private BigDecimal auxiliaryDepartmentLaborCosts;
@ApiModelProperty(value = "创建人")
private String createBy;

View File

@ -72,21 +72,7 @@ public class CostConfigService {
}
});
if (CollectionUtil.isNotEmpty(virtualWorkingEntities)) {
List<VirtualWorkingItemVO> virtualWorkingItemVOS = Convert.toList(VirtualWorkingItemVO.class, virtualWorkingEntities);
virtualWorkingItemVOS.forEach(vw -> {
vw.setAuxiliaryMaterialsAndConsumables(BigDecimalUtil.divide(
vw.getFeeTotalYear()
, new BigDecimal("12")
, BigDecimalUtil.nullToDefault(technologyConfigService.getUserNum(), BigDecimal.ONE)
, BigDecimalUtil.nullToDefault(technologyConfigService.getTheoreticalDailyWorkingHours(), BigDecimal.ONE)
, BigDecimalUtil.nullToDefault(technologyConfigService.getTheoreticalWorkingDaysPerMonth(), BigDecimal.ONE)
, BigDecimalUtil.nullToDefault(technologyConfigService.getCorrectionFactor(), BigDecimal.ONE)));
vw.setAuxiliaryDepartmentLaborCosts(BigDecimalUtil.divide(
vw.getFeeAssistantLaborCostTotal()
, new BigDecimal("12")
, BigDecimalUtil.nullToDefault(technologyConfigService.getMonthlyTheoreticalFullLoadWorkingHours(), BigDecimal.ONE)));
});
vo.setVirtualWorking(virtualWorkingItemVOS);
vo.setVirtualWorking(Convert.toList(VirtualWorkingItemVO.class, virtualWorkingEntities));
}
return vo;
}

View File

@ -57,13 +57,16 @@ public class VirtualWorkingService extends ServiceImpl<VirtualWorkingMapper, Vir
entity.setUpdateTime(LocalDateTime.now());
forUpdate.add(entity);
}
entity.setHourlyAuxiliaryFee(vw.getHourlyAuxiliaryFee());
entity.setUserNum(vw.getUserNum());
entity.setFeeTotalYear(vw.getFeeTotalYear());
entity.setFeeEquipmentDepreciation(vw.getFeeEquipmentDepreciation());
entity.setFeeWorkshopLaborCost(vw.getFeeWorkshopLaborCost());
entity.setFeeWorkshopOffice(vw.getFeeWorkshopOffice());
entity.setFeeAssistantLaborCostTotal(vw.getFeeAssistantLaborCostTotal());
entity.setFeeAssistant(vw.getFeeAssistant());
entity.setWorkshopTotalFee(vw.getWorkshopTotalFee());
entity.setConsumablesFee(vw.getConsumablesFee());
entity.setEquipmentDepreciationFee(vw.getEquipmentDepreciationFee());
entity.setWorkshopLaborFee(vw.getWorkshopLaborFee());
entity.setWorkshopOfficeFee(vw.getWorkshopOfficeFee());
entity.setAssistantTotalFee(vw.getAssistantTotalFee());
entity.setAssistantLaborFee(vw.getAssistantLaborFee());
entity.setAssistantFee(vw.getAssistantFee());
}
});
if (CollectionUtil.isNotEmpty(forAdd)) {