16 changed files with 751 additions and 6 deletions
@ -0,0 +1,108 @@ |
|||
package com.qs.serve.modules.tbs.common.util; |
|||
|
|||
import com.qs.serve.common.util.CollectionUtil; |
|||
import com.qs.serve.common.util.SpringUtils; |
|||
import com.qs.serve.modules.goods.entity.GoodsCategory; |
|||
import com.qs.serve.modules.goods.entity.GoodsSku; |
|||
import com.qs.serve.modules.goods.entity.GoodsSpu; |
|||
import com.qs.serve.modules.goods.service.GoodsCategoryService; |
|||
import com.qs.serve.modules.goods.service.GoodsSkuService; |
|||
import com.qs.serve.modules.goods.service.GoodsSpuService; |
|||
import com.qs.serve.modules.tbs.common.TbsGoodsType; |
|||
import com.qs.serve.modules.tbs.entity.TbsBudget; |
|||
import com.qs.serve.modules.tbs.entity.TbsBudgetCondition; |
|||
|
|||
import javax.swing.*; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/8/9 |
|||
*/ |
|||
public class TbsBudgetConditionUtil { |
|||
|
|||
/** |
|||
* 建立条件数据 |
|||
* @param budgetId |
|||
* @param brandIds |
|||
* @param categoryIds |
|||
* @param seriesIds |
|||
* @param spuIds |
|||
* @param skuIds |
|||
*/ |
|||
public static List<TbsBudgetCondition> buildCondition(Long budgetId, List<Long> brandIds, List<Long> categoryIds, List<Long> seriesIds, List<Long> spuIds, List<Long> skuIds){ |
|||
GoodsSkuService goodsSkuService = SpringUtils.getBean(GoodsSkuService.class); |
|||
GoodsSpuService goodsSpuService = SpringUtils.getBean(GoodsSpuService.class); |
|||
GoodsCategoryService goodsCategoryService = SpringUtils.getBean(GoodsCategoryService.class); |
|||
|
|||
List<TbsBudgetCondition> budgetConditions = new ArrayList<>(); |
|||
if (CollectionUtil.isNotEmpty(skuIds)) { |
|||
List<GoodsSku> skuList = goodsSkuService.listByIds(skuIds); |
|||
for (GoodsSku sku : skuList) { |
|||
GoodsSpu goodsSpu = goodsSpuService.getById(sku.getSpuId()); |
|||
GoodsCategory category1 = goodsCategoryService.getById(goodsSpu.getCategoryFirst()); |
|||
GoodsCategory category2 = goodsCategoryService.getById(goodsSpu.getCategorySecond()); |
|||
GoodsCategory category3 = goodsCategoryService.getById(goodsSpu.getCategoryThird()); |
|||
TbsBudgetCondition condition = new TbsBudgetCondition(); |
|||
condition.setBudgetId(budgetId); |
|||
condition.setTargetType(TbsGoodsType.sku.name()); |
|||
condition.setTargetId(sku.getId()); |
|||
condition.setTargetCode(sku.getSkuCode()); |
|||
condition.setTargetName(sku.getSpecInfos()); |
|||
condition.setTargetLevelPathIds(category1.getId() + "_" + category2.getId() + "_" + category3.getId() + "_" + goodsSpu.getId() + "_" + sku.getId()); |
|||
condition.setTargetLevelPathNames(category1.getName() + "_" + category2.getName() + "_" + category3.getName() + "_" + goodsSpu.getName() + "_" + sku.getSpecInfos()); |
|||
budgetConditions.add(condition); |
|||
} |
|||
} |
|||
if (CollectionUtil.isNotEmpty(spuIds)) { |
|||
List<GoodsSpu> spuList = goodsSpuService.listByIds(spuIds); |
|||
for (GoodsSpu goodsSpu : spuList) { |
|||
GoodsCategory category1 = goodsCategoryService.getById(goodsSpu.getCategoryFirst()); |
|||
GoodsCategory category2 = goodsCategoryService.getById(goodsSpu.getCategorySecond()); |
|||
GoodsCategory category3 = goodsCategoryService.getById(goodsSpu.getCategoryThird()); |
|||
TbsBudgetCondition condition = new TbsBudgetCondition(); |
|||
condition.setBudgetId(budgetId); |
|||
condition.setTargetType(TbsGoodsType.spu.name()); |
|||
condition.setTargetId(goodsSpu.getId()); |
|||
condition.setTargetCode(goodsSpu.getSpuCode()); |
|||
condition.setTargetName(goodsSpu.getName()); |
|||
condition.setTargetLevelPathIds(category1.getId() + "_" + category2.getId() + "_" + category3.getId() + "_" + goodsSpu.getId()); |
|||
condition.setTargetLevelPathNames(category1.getName() + "_" + category2.getName() + "_" + category3.getName() + "_" + goodsSpu.getName()); |
|||
budgetConditions.add(condition); |
|||
} |
|||
} |
|||
budgetConditions.addAll(buildCategoryCondition(goodsCategoryService,budgetId, seriesIds, TbsGoodsType.series.name())); |
|||
budgetConditions.addAll(buildCategoryCondition(goodsCategoryService,budgetId, categoryIds, TbsGoodsType.category.name())); |
|||
budgetConditions.addAll(buildCategoryCondition(goodsCategoryService,budgetId, brandIds, TbsGoodsType.brand.name())); |
|||
return budgetConditions; |
|||
} |
|||
|
|||
/** |
|||
* 建立类目条件 |
|||
* @param goodsCategoryService |
|||
* @param budgetId |
|||
* @param categoryIds |
|||
* @param targetType |
|||
* @return |
|||
*/ |
|||
private static List<TbsBudgetCondition> buildCategoryCondition(GoodsCategoryService goodsCategoryService, Long budgetId, List<Long> categoryIds, String targetType){ |
|||
List<TbsBudgetCondition> budgetConditions = new ArrayList<>(); |
|||
if(CollectionUtil.isNotEmpty(categoryIds)){ |
|||
List<GoodsCategory> categoryList = goodsCategoryService.listByIds(categoryIds); |
|||
for (GoodsCategory category : categoryList) { |
|||
TbsBudgetCondition condition = new TbsBudgetCondition(); |
|||
condition.setBudgetId(budgetId); |
|||
condition.setTargetType(targetType); |
|||
condition.setTargetId(category.getId()); |
|||
condition.setTargetCode(category.getCode()); |
|||
condition.setTargetName(category.getName()); |
|||
condition.setTargetLevelPathIds(category.getLevelPath()); |
|||
condition.setTargetLevelPathNames(category.getLevelPathNames()); |
|||
budgetConditions.add(condition); |
|||
} |
|||
} |
|||
return budgetConditions; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,170 @@ |
|||
package com.qs.serve.modules.tbs.entity; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 预算更变记录 实体类 |
|||
* @author YenHex |
|||
* @since 2023-08-09 |
|||
*/ |
|||
@Data |
|||
@TableName("tbs_budget_change") |
|||
public class TbsBudgetChange implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 更变记录编码 */ |
|||
@Length(max = 30,message = "更变记录编码长度不能超过30字") |
|||
private String changeCode; |
|||
|
|||
/** 名称 */ |
|||
@NotBlank(message = "名称不能为空") |
|||
@Length(max = 30,message = "名称长度不能超过30字") |
|||
private String budgetTitle; |
|||
|
|||
/** 名称 */ |
|||
private String newBudgetTitle; |
|||
|
|||
/** 编码 */ |
|||
@Length(max = 30,message = "编码长度不能超过30字") |
|||
private String budgetNumber; |
|||
|
|||
/** 审批状态 */ |
|||
@NotNull(message = "审批状态不能为空") |
|||
private Integer budgetCheckState; |
|||
|
|||
/** 科目id */ |
|||
@NotNull(message = "科目id不能为空") |
|||
private Long subjectId; |
|||
|
|||
/** 科目编码 */ |
|||
@Length(max = 30,message = "科目编码长度不能超过30字") |
|||
private String subjectCode; |
|||
|
|||
/** 科目名称 */ |
|||
@Length(max = 30,message = "科目名称长度不能超过30字") |
|||
private String subjectName; |
|||
|
|||
/** 成本中心类型 */ |
|||
@NotBlank(message = "成本中心类型不能为空") |
|||
@Length(max = 20,message = "成本中心类型长度不能超过20字") |
|||
private String centerType; |
|||
|
|||
/** 成本中心id */ |
|||
@NotBlank(message = "成本中心id不能为空") |
|||
@Length(max = 32,message = "成本中心id长度不能超过32字") |
|||
private String centerId; |
|||
|
|||
/** 成本中心编码 */ |
|||
@NotBlank(message = "成本中心编码不能为空") |
|||
@Length(max = 30,message = "成本中心编码长度不能超过30字") |
|||
private String centerCode; |
|||
|
|||
/** 成本中心名称 */ |
|||
@NotBlank(message = "成本中心名称不能为空") |
|||
@Length(max = 30,message = "成本中心名称长度不能超过30字") |
|||
private String centerName; |
|||
|
|||
/** 考核期id */ |
|||
@NotNull(message = "考核期id不能为空") |
|||
private Long scheduleId; |
|||
|
|||
/** 考核期编码 */ |
|||
@NotBlank(message = "考核期编码不能为空") |
|||
@Length(max = 30,message = "考核期编码长度不能超过30字") |
|||
private String scheduleCode; |
|||
|
|||
/** 考核期名称 */ |
|||
@NotBlank(message = "考核期名称不能为空") |
|||
@Length(max = 30,message = "考核期名称长度不能超过30字") |
|||
private String scheduleName; |
|||
|
|||
/** 提交审批时间 */ |
|||
@Length(max = 0,message = "提交审批时间长度不能超过0字") |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
private LocalDateTime submitTime; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 最后更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
|
|||
public static TbsBudgetChange toNewObject(TbsBudget source){ |
|||
TbsBudgetChange budgetChange = new TbsBudgetChange(); |
|||
budgetChange.setId(source.getId()); |
|||
//budgetChange.setChangeCode(source.getChangeCode());
|
|||
//budgetChange.setBudgetTitle(source.getBudgetTitle());
|
|||
budgetChange.setBudgetNumber(source.getBudgetNumber()); |
|||
budgetChange.setBudgetCheckState(source.getBudgetCheckState()); |
|||
budgetChange.setSubjectId(source.getSubjectId()); |
|||
budgetChange.setSubjectCode(source.getSubjectCode()); |
|||
budgetChange.setSubjectName(source.getSubjectName()); |
|||
budgetChange.setCenterType(source.getCenterType()); |
|||
budgetChange.setCenterId(source.getCenterId()); |
|||
budgetChange.setCenterCode(source.getCenterCode()); |
|||
budgetChange.setCenterName(source.getCenterName()); |
|||
budgetChange.setScheduleId(source.getScheduleId()); |
|||
budgetChange.setScheduleCode(source.getScheduleCode()); |
|||
budgetChange.setScheduleName(source.getScheduleName()); |
|||
budgetChange.setSubmitTime(source.getSubmitTime()); |
|||
budgetChange.setRemark(source.getRemark()); |
|||
// budgetChange.setCreateTime(source.getCreateTime());
|
|||
// budgetChange.setUpdateTime(source.getUpdateTime());
|
|||
// budgetChange.setTenantId(source.getTenantId());
|
|||
// budgetChange.setCreateBy(source.getCreateBy());
|
|||
// budgetChange.setUpdateBy(source.getUpdateBy());
|
|||
// budgetChange.setDelFlag(source.getDelFlag());
|
|||
return budgetChange; |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,126 @@ |
|||
package com.qs.serve.modules.tbs.entity; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 预算更变记录条件 实体类 |
|||
* @author YenHex |
|||
* @since 2023-08-09 |
|||
*/ |
|||
@Data |
|||
@TableName("tbs_budget_change_condition") |
|||
public class TbsBudgetChangeCondition implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 更变记录id */ |
|||
@NotNull(message = "更变记录id不能为空") |
|||
private Long changeId; |
|||
|
|||
/** 预算id */ |
|||
@NotNull(message = "预算id不能为空") |
|||
private Long budgetId; |
|||
|
|||
/** 目标类型(brand、category、series、spu、sku) */ |
|||
@NotBlank(message = "目标类型(brand、category、series、spu、sku)不能为空") |
|||
@Length(max = 30,message = "目标类型(brand、category、series、spu、sku)长度不能超过30字") |
|||
private String targetType; |
|||
|
|||
/** 目标id */ |
|||
@NotNull(message = "目标id不能为空") |
|||
private Long targetId; |
|||
|
|||
/** 目标编码 */ |
|||
@NotBlank(message = "目标编码不能为空") |
|||
@Length(max = 100,message = "目标编码长度不能超过100字") |
|||
private String targetCode; |
|||
|
|||
/** 目标名称 */ |
|||
@NotBlank(message = "目标名称不能为空") |
|||
@Length(max = 500,message = "目标名称长度不能超过500字") |
|||
private String targetName; |
|||
|
|||
/** 目标等级路径 */ |
|||
@Length(max = 600,message = "目标等级路径长度不能超过600字") |
|||
private String targetLevelPathIds; |
|||
|
|||
/** 目标等级路径 */ |
|||
@Length(max = 1200,message = "目标等级路径长度不能超过1200字") |
|||
private String targetLevelPathNames; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 最后更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
|
|||
public static TbsBudgetChangeCondition toNewObject(TbsBudgetCondition source){ |
|||
TbsBudgetChangeCondition budgetChangeCondition = new TbsBudgetChangeCondition(); |
|||
budgetChangeCondition.setId(source.getId()); |
|||
//budgetChangeCondition.setChangeId(source.getChangeId());
|
|||
budgetChangeCondition.setBudgetId(source.getBudgetId()); |
|||
budgetChangeCondition.setTargetType(source.getTargetType()); |
|||
budgetChangeCondition.setTargetId(source.getTargetId()); |
|||
budgetChangeCondition.setTargetCode(source.getTargetCode()); |
|||
budgetChangeCondition.setTargetName(source.getTargetName()); |
|||
budgetChangeCondition.setTargetLevelPathIds(source.getTargetLevelPathIds()); |
|||
budgetChangeCondition.setTargetLevelPathNames(source.getTargetLevelPathNames()); |
|||
budgetChangeCondition.setRemark(source.getRemark()); |
|||
// budgetChangeCondition.setCreateTime(source.getCreateTime());
|
|||
// budgetChangeCondition.setUpdateTime(source.getUpdateTime());
|
|||
// budgetChangeCondition.setTenantId(source.getTenantId());
|
|||
// budgetChangeCondition.setCreateBy(source.getCreateBy());
|
|||
// budgetChangeCondition.setUpdateBy(source.getUpdateBy());
|
|||
// budgetChangeCondition.setDelFlag(source.getDelFlag());
|
|||
return budgetChangeCondition; |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,141 @@ |
|||
package com.qs.serve.modules.tbs.entity; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 考核期更变记录 实体类 |
|||
* @author YenHex |
|||
* @since 2023-08-09 |
|||
*/ |
|||
@Data |
|||
@TableName("tbs_budget_change_schedule_item") |
|||
public class TbsBudgetChangeScheduleItem implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 更变记录id */ |
|||
private Long changeId; |
|||
|
|||
/** 考核id */ |
|||
@NotNull(message = "考核id不能为空") |
|||
private Long scheduleId; |
|||
|
|||
/** 考核期项id */ |
|||
@NotNull(message = "考核期项id不能为空") |
|||
private Long scheduleItemId; |
|||
|
|||
/** 考核编码 */ |
|||
@NotBlank(message = "考核编码不能为空") |
|||
@Length(max = 30,message = "考核编码长度不能超过30字") |
|||
private String itemName; |
|||
|
|||
/** 开始时间 */ |
|||
@NotNull(message = "开始时间不能为空") |
|||
@Length(max = 0,message = "开始时间长度不能超过0字") |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
private LocalDateTime startDate; |
|||
|
|||
/** 结束时间 */ |
|||
@NotNull(message = "结束时间不能为空") |
|||
@Length(max = 0,message = "结束时间长度不能超过0字") |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
private LocalDateTime endDate; |
|||
|
|||
/** 预算id */ |
|||
@NotNull(message = "预算id不能为空") |
|||
private Long budgetId; |
|||
|
|||
/** 预算金额 */ |
|||
@NotNull(message = "预算金额不能为空") |
|||
private BigDecimal budgetAmount; |
|||
|
|||
/** 预估发货金额 */ |
|||
private BigDecimal preDispatchAmount; |
|||
|
|||
/** 新的预算金额 */ |
|||
private BigDecimal newBudgetAmount; |
|||
|
|||
/** 新的预估发货金额 */ |
|||
private BigDecimal newPreDispatchAmount; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 最后更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
|
|||
public static TbsBudgetChangeScheduleItem toNewObject(TbsBudgetChangeScheduleItem source){ |
|||
TbsBudgetChangeScheduleItem budgetChangeScheduleItem = new TbsBudgetChangeScheduleItem(); |
|||
budgetChangeScheduleItem.setId(source.getId()); |
|||
budgetChangeScheduleItem.setChangeId(source.getChangeId()); |
|||
budgetChangeScheduleItem.setScheduleId(source.getScheduleId()); |
|||
budgetChangeScheduleItem.setScheduleItemId(source.getScheduleItemId()); |
|||
budgetChangeScheduleItem.setItemName(source.getItemName()); |
|||
budgetChangeScheduleItem.setStartDate(source.getStartDate()); |
|||
budgetChangeScheduleItem.setEndDate(source.getEndDate()); |
|||
budgetChangeScheduleItem.setBudgetId(source.getBudgetId()); |
|||
budgetChangeScheduleItem.setBudgetAmount(source.getBudgetAmount()); |
|||
budgetChangeScheduleItem.setPreDispatchAmount(source.getPreDispatchAmount()); |
|||
budgetChangeScheduleItem.setNewBudgetAmount(source.getNewBudgetAmount()); |
|||
budgetChangeScheduleItem.setNewPreDispatchAmount(source.getNewPreDispatchAmount()); |
|||
budgetChangeScheduleItem.setRemark(source.getRemark()); |
|||
budgetChangeScheduleItem.setCreateTime(source.getCreateTime()); |
|||
budgetChangeScheduleItem.setUpdateTime(source.getUpdateTime()); |
|||
budgetChangeScheduleItem.setTenantId(source.getTenantId()); |
|||
budgetChangeScheduleItem.setCreateBy(source.getCreateBy()); |
|||
budgetChangeScheduleItem.setUpdateBy(source.getUpdateBy()); |
|||
budgetChangeScheduleItem.setDelFlag(source.getDelFlag()); |
|||
return budgetChangeScheduleItem; |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.tbs.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.tbs.entity.TbsBudgetChangeCondition; |
|||
|
|||
/** |
|||
* 预算更变记录条件 Mapper |
|||
* @author YenHex |
|||
* @date 2023-08-09 |
|||
*/ |
|||
public interface TbsBudgetChangeConditionMapper extends BaseMapper<TbsBudgetChangeCondition> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.tbs.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.tbs.entity.TbsBudgetChange; |
|||
|
|||
/** |
|||
* 预算更变记录 Mapper |
|||
* @author YenHex |
|||
* @date 2023-08-09 |
|||
*/ |
|||
public interface TbsBudgetChangeMapper extends BaseMapper<TbsBudgetChange> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.tbs.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.tbs.entity.TbsBudgetChangeScheduleItem; |
|||
|
|||
/** |
|||
* 考核期更变记录 Mapper |
|||
* @author YenHex |
|||
* @date 2023-08-09 |
|||
*/ |
|||
public interface TbsBudgetChangeScheduleItemMapper extends BaseMapper<TbsBudgetChangeScheduleItem> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.tbs.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.tbs.entity.TbsBudgetChangeCondition; |
|||
|
|||
/** |
|||
* 预算更变记录条件 服务接口 |
|||
* @author YenHex |
|||
* @date 2023-08-09 |
|||
*/ |
|||
public interface TbsBudgetChangeConditionService extends IService<TbsBudgetChangeCondition> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.tbs.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.tbs.entity.TbsBudgetChangeScheduleItem; |
|||
|
|||
/** |
|||
* 考核期更变记录 服务接口 |
|||
* @author YenHex |
|||
* @date 2023-08-09 |
|||
*/ |
|||
public interface TbsBudgetChangeScheduleItemService extends IService<TbsBudgetChangeScheduleItem> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,22 @@ |
|||
package com.qs.serve.modules.tbs.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.tbs.entity.TbsBudgetChange; |
|||
import com.qs.serve.modules.tbs.entity.bo.TbsBudgetUpdateAfterStartBo; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
|
|||
/** |
|||
* 预算更变记录 服务接口 |
|||
* @author YenHex |
|||
* @date 2023-08-09 |
|||
*/ |
|||
public interface TbsBudgetChangeService extends IService<TbsBudgetChange> { |
|||
|
|||
/** |
|||
* 提交修改 |
|||
* @param param |
|||
*/ |
|||
void commitApply(TbsBudgetUpdateAfterStartBo param); |
|||
|
|||
} |
|||
|
@ -0,0 +1,22 @@ |
|||
package com.qs.serve.modules.tbs.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import com.qs.serve.modules.tbs.entity.TbsBudgetChangeCondition; |
|||
import com.qs.serve.modules.tbs.service.TbsBudgetChangeConditionService; |
|||
import com.qs.serve.modules.tbs.mapper.TbsBudgetChangeConditionMapper; |
|||
|
|||
/** |
|||
* 预算更变记录条件 服务实现类 |
|||
* @author YenHex |
|||
* @since 2023-08-09 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class TbsBudgetChangeConditionServiceImpl extends ServiceImpl<TbsBudgetChangeConditionMapper,TbsBudgetChangeCondition> implements TbsBudgetChangeConditionService { |
|||
|
|||
} |
|||
|
@ -0,0 +1,22 @@ |
|||
package com.qs.serve.modules.tbs.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import com.qs.serve.modules.tbs.entity.TbsBudgetChangeScheduleItem; |
|||
import com.qs.serve.modules.tbs.service.TbsBudgetChangeScheduleItemService; |
|||
import com.qs.serve.modules.tbs.mapper.TbsBudgetChangeScheduleItemMapper; |
|||
|
|||
/** |
|||
* 考核期更变记录 服务实现类 |
|||
* @author YenHex |
|||
* @since 2023-08-09 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class TbsBudgetChangeScheduleItemServiceImpl extends ServiceImpl<TbsBudgetChangeScheduleItemMapper,TbsBudgetChangeScheduleItem> implements TbsBudgetChangeScheduleItemService { |
|||
|
|||
} |
|||
|
@ -0,0 +1,62 @@ |
|||
package com.qs.serve.modules.tbs.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.qs.serve.common.util.CodeGenUtil; |
|||
import com.qs.serve.modules.tbs.common.util.TbsBudgetConditionUtil; |
|||
import com.qs.serve.modules.tbs.entity.TbsBudget; |
|||
import com.qs.serve.modules.tbs.entity.TbsBudgetChangeCondition; |
|||
import com.qs.serve.modules.tbs.entity.TbsBudgetCondition; |
|||
import com.qs.serve.modules.tbs.entity.bo.TbsBudgetUpdateAfterStartBo; |
|||
import com.qs.serve.modules.tbs.mapper.TbsBudgetChangeConditionMapper; |
|||
import com.qs.serve.modules.tbs.mapper.TbsBudgetMapper; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import com.qs.serve.modules.tbs.entity.TbsBudgetChange; |
|||
import com.qs.serve.modules.tbs.service.TbsBudgetChangeService; |
|||
import com.qs.serve.modules.tbs.mapper.TbsBudgetChangeMapper; |
|||
|
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 预算更变记录 服务实现类 |
|||
* @author YenHex |
|||
* @since 2023-08-09 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class TbsBudgetChangeServiceImpl extends ServiceImpl<TbsBudgetChangeMapper,TbsBudgetChange> implements TbsBudgetChangeService { |
|||
|
|||
private final TbsBudgetMapper tbsBudgetMapper; |
|||
private final TbsBudgetChangeConditionMapper tbsBudgetChangeConditionMapper; |
|||
|
|||
@Override |
|||
public void commitApply(TbsBudgetUpdateAfterStartBo param) { |
|||
TbsBudget budget = tbsBudgetMapper.selectById(param.getId()); |
|||
TbsBudgetChange budgetChange = TbsBudgetChange.toNewObject(budget); |
|||
budgetChange.setChangeCode(CodeGenUtil.generate(CodeGenUtil.SourceKey.BudgetChange)); |
|||
boolean notChangeTitle = param.getBudgetCode()!=null&¶m.getBudgetCode().equals(budget.getBudgetCode()); |
|||
if(!notChangeTitle){ |
|||
budgetChange.setNewBudgetTitle(param.getBudgetCode()); |
|||
} |
|||
this.save(budgetChange); |
|||
Long changeId = budgetChange.getId(); |
|||
//设置条件
|
|||
List<TbsBudgetCondition> budgetConditionList = TbsBudgetConditionUtil.buildCondition( |
|||
budget.getId(),param.getBrandIds(),param.getCategoryIds(),param.getSeriesIds(),param.getSpuIds(),param.getSkuIds()); |
|||
List<TbsBudgetChangeCondition> changeConditionList = budgetConditionList.stream().map(cond->{ |
|||
TbsBudgetChangeCondition changeCondition = TbsBudgetChangeCondition.toNewObject(cond); |
|||
changeCondition.setChangeId(changeId); |
|||
return changeCondition; |
|||
}).collect(Collectors.toList()); |
|||
for (TbsBudgetChangeCondition changeCondition : changeConditionList) { |
|||
tbsBudgetChangeConditionMapper.insert(changeCondition); |
|||
} |
|||
//设置金额
|
|||
|
|||
} |
|||
|
|||
} |
|||
|
Loading…
Reference in new issue