Browse Source

修改预算

v1.0
15989082884@163.com 2 years ago
parent
commit
ba97aeddaf
  1. 9
      src/main/java/com/qs/serve/modules/tbs/controller/TbsBudgetController.java
  2. 2
      src/main/java/com/qs/serve/modules/tbs/service/TbsBudgetService.java
  3. 32
      src/main/java/com/qs/serve/modules/tbs/service/impl/TbsBudgetServiceImpl.java

9
src/main/java/com/qs/serve/modules/tbs/controller/TbsBudgetController.java

@ -348,5 +348,14 @@ public class TbsBudgetController {
tbsBudgetService.moveBudgetAmount(bo);
return R.ok();
}
@PostMapping("/updateBudgetAfterStart")
public R<?> updateBudgetAfterStart(@RequestBody @Valid TbsBudgetBo param){
if(param.getId()==null){
Assert.throwEx("预算ID不能为空!");
}
tbsBudgetService.updateBudgetAfterStart(param);
return R.ok();
}
}

2
src/main/java/com/qs/serve/modules/tbs/service/TbsBudgetService.java

@ -45,5 +45,7 @@ public interface TbsBudgetService extends IService<TbsBudget> {
void moveCenterBudgetAndCostAmount(String sourceId,String sourceType,String targetId,String targetType);
void moveBudgetAmount(TbsBudgetMoveAmountBo bo);
void updateBudgetAfterStart(TbsBudgetBo param);
}

32
src/main/java/com/qs/serve/modules/tbs/service/impl/TbsBudgetServiceImpl.java

@ -680,15 +680,15 @@ public class TbsBudgetServiceImpl extends ServiceImpl<TbsBudgetMapper,TbsBudget>
budgetConditions.addAll(buildCategoryCondition(budgetId, seriesIds, TbsGoodsType.series.name()));
budgetConditions.addAll(buildCategoryCondition(budgetId, categoryIds, TbsGoodsType.category.name()));
budgetConditions.addAll(buildCategoryCondition(budgetId, brandIds, TbsGoodsType.brand.name()));
TbsBudget tbsBudget = new TbsBudget();
tbsBudget.setId(budgetId);
if(CollectionUtil.isNotEmpty(budgetConditions)){
budgetConditionService.saveBatch(budgetConditions);
tbsBudget.setConditionFlag(1);
}else {
tbsBudget.setConditionFlag(0);
TbsBudget oriBudget = this.getById(budgetId);
if (oriBudget.getBudgetState() != 1
|| oriBudget.getConditionFlag() != 1
|| CollectionUtil.isNotEmpty(budgetConditions)) {
TbsBudget tbsBudget = new TbsBudget();
tbsBudget.setId(budgetId);
tbsBudget.setConditionFlag(CollectionUtil.isNotEmpty(budgetConditions) ? 1 : 0);
this.updateById(tbsBudget);
}
this.updateById(tbsBudget);
}
@ -932,5 +932,21 @@ public class TbsBudgetServiceImpl extends ServiceImpl<TbsBudgetMapper,TbsBudget>
budgetLogService.saveBatch(budgetLogList);
}
@Override
public void updateBudgetAfterStart(TbsBudgetBo param) {
TbsBudget budget = this.getById(param.getId());
if(budget==null){
Assert.throwEx("不存在该预算!");
}
if(!budget.getBudgetState().equals(1)){
Assert.throwEx("预算未开启,请直接编辑!");
}
budget.setBudgetCode(param.getBudgetCode());
budget.setAttachIds(param.getAttachIds());
this.updateById(budget);
buildCondition(budget.getId(),param.getBrandIds(),param.getCategoryIds(),param.getSeriesIds(),param.getSpuIds(),param.getSkuIds());
}
}

Loading…
Cancel
Save