Browse Source

添加预算超支表

contract
Yen 2 years ago
parent
commit
dc47d27b73
  1. 1
      src/main/java/com/qs/serve/modules/tbs/controller/TbsCostApplyController.java
  2. 66
      src/main/java/com/qs/serve/modules/tbs/controller/TbsCostUnItemController.java
  3. 205
      src/main/java/com/qs/serve/modules/tbs/entity/TbsCostUnItem.java
  4. 151
      src/main/java/com/qs/serve/modules/tbs/entity/so/TbsCostUnItemSo.java
  5. 14
      src/main/java/com/qs/serve/modules/tbs/mapper/TbsCostUnItemMapper.java
  6. 26
      src/main/java/com/qs/serve/modules/tbs/mapper/TbsScheduleItemBudgetMapper.java
  7. 38
      src/main/java/com/qs/serve/modules/tbs/service/TbsBudgetApplicationService.java
  8. 14
      src/main/java/com/qs/serve/modules/tbs/service/TbsCostUnItemService.java
  9. 3
      src/main/java/com/qs/serve/modules/tbs/service/impl/TbsBudgetLogServiceImpl.java
  10. 3
      src/main/java/com/qs/serve/modules/tbs/service/impl/TbsBudgetServiceImpl.java
  11. 7
      src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostApplyServiceImpl.java
  12. 22
      src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostUnItemServiceImpl.java

1
src/main/java/com/qs/serve/modules/tbs/controller/TbsCostApplyController.java

@ -147,6 +147,7 @@ public class TbsCostApplyController {
TbsCostApply entity = CopierUtil.copy(param,new TbsCostApply());
LambdaQueryWrapper<TbsCostApply> lqw = new LambdaQueryWrapper<>(entity);
lqw.orderByDesc(TbsCostApply::getId);
lqw.in(TbsCostApply::getUserId,userIds);
PageUtil.startPage();
List<TbsCostApply> list = tbsCostApplyService.list(lqw);
return R.byPageHelperList(list);

66
src/main/java/com/qs/serve/modules/tbs/controller/TbsCostUnItemController.java

@ -0,0 +1,66 @@
package com.qs.serve.modules.tbs.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.qs.serve.common.model.annotation.SysLog;
import com.qs.serve.common.model.dto.PageVo;
import com.qs.serve.common.model.dto.R;
import com.qs.serve.common.model.enums.BizType;
import com.qs.serve.common.model.enums.SystemModule;
import com.qs.serve.common.util.PageUtil;
import com.qs.serve.common.util.CopierUtil;
import com.qs.serve.common.util.StringUtils;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import com.qs.serve.modules.tbs.entity.so.TbsCostUnItemSo;
import com.qs.serve.modules.tbs.entity.TbsCostUnItem;
import com.qs.serve.modules.tbs.service.TbsCostUnItemService;
import javax.validation.Valid;
import java.util.List;
/**
* 预算 无预算的费用明细
* @author YenHex
* @since 2023-02-02
*/
@Slf4j
@AllArgsConstructor
@RestController
@RequestMapping("tbs/noBudgetCost")
public class TbsCostUnItemController {
private TbsCostUnItemService tbsCostUnItemService;
/**
* 翻页
* @param param
* @return
*/
@GetMapping("/page")
@PreAuthorize("hasRole('tbs:costUnItem:query')")
public R<PageVo<TbsCostUnItem>> getPage(TbsCostUnItemSo param){
TbsCostUnItem entity = CopierUtil.copy(param,new TbsCostUnItem());
LambdaQueryWrapper<TbsCostUnItem> lqw = new LambdaQueryWrapper<>(entity);
PageUtil.startPage();
List<TbsCostUnItem> list = tbsCostUnItemService.list(lqw);
return R.byPageHelperList(list);
}
/**
* ID查询
* @param id
* @return
*/
@GetMapping("/getById/{id}")
@SysLog(module = SystemModule.Budget, title = "无预算的费用明细", biz = BizType.QUERY)
@PreAuthorize("hasRole('tbs:costUnItem:query')")
public R<TbsCostUnItem> getById(@PathVariable("id") String id){
TbsCostUnItem tbsCostUnItem = tbsCostUnItemService.getById(id);
return R.ok(tbsCostUnItem);
}
}

205
src/main/java/com/qs/serve/modules/tbs/entity/TbsCostUnItem.java

@ -0,0 +1,205 @@
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-02-02
*/
@Data
@TableName("tbs_cost_un_item")
public class TbsCostUnItem implements Serializable {
private static final long serialVersionUID = 1L;
/** id */
@TableId(type = IdType.AUTO)
private Long id;
/** 成本明细编码 */
@Length(max = 30,message = "成本明细编码长度不能超过30字")
private String centerGoodsCode;
/** 费用申请id */
@NotNull(message = "费用申请id不能为空")
private Long costApplyId;
/** 活动id */
@NotNull(message = "活动id不能为空")
private Long activityId;
/** 活动编码 */
@Length(max = 30,message = "活动编码长度不能超过30字")
private String activityCode;
/** 科目id */
@NotNull(message = "科目id不能为空")
private Long subjectId;
/** 科目编码 */
@NotBlank(message = "科目编码不能为空")
@Length(max = 50,message = "科目编码长度不能超过50字")
private String subjectCode;
/** 科目名称 */
@NotBlank(message = "科目名称不能为空")
@Length(max = 50,message = "科目名称长度不能超过50字")
private String subjectName;
/** 成本中心类型 */
@NotBlank(message = "成本中心类型不能为空")
@Length(max = 50,message = "成本中心类型长度不能超过50字")
private String centerType;
/** 成本中心id */
@NotBlank(message = "成本中心id不能为空")
@Length(max = 32,message = "成本中心id长度不能超过32字")
private String centerId;
/** 成本中心编码 */
@NotBlank(message = "成本中心编码不能为空")
@Length(max = 50,message = "成本中心编码长度不能超过50字")
private String centerCode;
/** 成本中心名称 */
@NotBlank(message = "成本中心名称不能为空")
@Length(max = 50,message = "成本中心名称长度不能超过50字")
private String centerName;
/** 成本中心金额 */
@NotNull(message = "成本中心金额不能为空")
private BigDecimal centerAmount;
/** 成本中心占比 */
@NotNull(message = "成本中心占比不能为空")
private BigDecimal centerRate;
/** 费用额度 */
@NotNull(message = "费用额度不能为空")
private BigDecimal centerGoodsAmount;
/** 费用占比 */
@NotNull(message = "费用占比不能为空")
private BigDecimal centerGoodsRate;
/** 目标类型(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 = 30,message = "目标编码长度不能超过30字")
private String targetCode;
/** 目标名称 */
@NotBlank(message = "目标名称不能为空")
@Length(max = 30,message = "目标名称长度不能超过30字")
private String targetName;
/** 目标等级路径 */
@Length(max = 600,message = "目标等级路径长度不能超过600字")
private String targetLevelPathIds;
/** 目标等级路径 */
@Length(max = 600,message = "目标等级路径长度不能超过600字")
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;
/** 活动开始时间 */
@NotNull(message = "活动开始时间不能为空")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private LocalDate actStartDate;
/** 活动结束时间 */
@NotNull(message = "活动结束时间不能为空")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private LocalDate actEndDate;
/** 预算开始时间 */
@NotNull(message = "预算开始时间不能为空")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private LocalDate preStartDate;
/** 预算结束时间 */
@NotNull(message = "预算结束时间不能为空")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private LocalDate preEndDate;
/** 预计核销时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private LocalDate preCheckDate;
/** 客户id */
@NotNull(message = "客户id不能为空")
private Long supplierId;
/** 客户编码 */
@NotBlank(message = "客户编码不能为空")
@Length(max = 30,message = "客户编码长度不能超过30字")
private String supplierCode;
/** 客户名称 */
@NotBlank(message = "客户名称不能为空")
@Length(max = 30,message = "客户名称长度不能超过30字")
private String supplierName;
}

151
src/main/java/com/qs/serve/modules/tbs/entity/so/TbsCostUnItemSo.java

@ -0,0 +1,151 @@
package com.qs.serve.modules.tbs.entity.so;
import java.time.LocalDate;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
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-02-02
*/
@Data
public class TbsCostUnItemSo implements Serializable {
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 成本明细编码 */
private String centerGoodsCode;
/** 费用申请id */
private Long costApplyId;
/** 活动id */
private Long activityId;
/** 活动编码 */
private String activityCode;
/** 科目id */
private Long subjectId;
/** 科目编码 */
private String subjectCode;
/** 科目名称 */
private String subjectName;
/** 成本中心类型 */
private String centerType;
/** 成本中心id */
private String centerId;
/** 成本中心编码 */
private String centerCode;
/** 成本中心名称 */
private String centerName;
/** 成本中心金额 */
private BigDecimal centerAmount;
/** 成本中心占比 */
private BigDecimal centerRate;
/** 费用额度 */
private BigDecimal centerGoodsAmount;
/** 费用占比 */
private BigDecimal centerGoodsRate;
/** 目标类型(brand、category、series、spu、sku) */
private String targetType;
/** 目标id */
private Long targetId;
/** 目标编码 */
private String targetCode;
/** 目标名称 */
private String targetName;
/** 目标等级路径 */
private String targetLevelPathIds;
/** 目标等级路径 */
private String targetLevelPathNames;
/** 备注 */
private String remark;
/** 创建时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
/** 最后更新时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
/** 所属租户 */
@JsonIgnore
@JsonProperty
private String tenantId;
/** 创建人 */
private String createBy;
/** 更新人 */
private String updateBy;
/** 逻辑删除标记(0:显示;1:隐藏) */
@JsonIgnore
@JsonProperty
private String delFlag;
/** 活动开始时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate actStartDate;
/** 活动结束时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate actEndDate;
/** 预算开始时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate preStartDate;
/** 预算结束时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate preEndDate;
/** 预计核销时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate preCheckDate;
/** 客户id */
private Long supplierId;
/** 客户编码 */
private String supplierCode;
/** 客户名称 */
private String supplierName;
}

14
src/main/java/com/qs/serve/modules/tbs/mapper/TbsCostUnItemMapper.java

@ -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.TbsCostUnItem;
/**
* 无预算的费用明细 Mapper
* @author YenHex
* @date 2023-02-02
*/
public interface TbsCostUnItemMapper extends BaseMapper<TbsCostUnItem> {
}

26
src/main/java/com/qs/serve/modules/tbs/mapper/TbsScheduleItemBudgetMapper.java

@ -17,6 +17,7 @@ public interface TbsScheduleItemBudgetMapper extends BaseMapper<TbsScheduleItemB
/**
* 统计费用申请占用的预算金额
* @param scheduleItemBudgetId 预算考核期id
* @param applyId 费用申请id(防止驳回后提交重复扣除)
* @return
*/
@Select("SELECT sum(`tbs_budget_cost_item`.center_goods_amount) FROM `tbs_budget_cost_item` " +
@ -26,5 +27,30 @@ public interface TbsScheduleItemBudgetMapper extends BaseMapper<TbsScheduleItemB
" AND `tbs_budget_cost_item`.id = #{scheduleItemBudgetId} and `tbs_cost_apply`.id != #{applyId}")
BigDecimal totalApplyAmount(@Param("scheduleItemBudgetId") Long scheduleItemBudgetId,@Param("applyId") Long applyId);
/**
* 统计费用申请占用的预算金额
* @param budgetId 预算id
* @param scheduleItemId 考核期id
* @param applyId 费用申请id(防止驳回后提交重复扣除)
* @return
*/
@Select("SELECT " +
" sum( amount ) " +
"FROM " +
" `tbs_budget_log` " +
" LEFT JOIN " +
" `tbs_cost_apply` " +
" ON `tbs_budget_log` .cost_apply_id = tbs_cost_apply.id " +
"WHERE " +
" `tbs_budget_log`.budget_id = #{budgetId} " +
" AND `tbs_budget_log`.schedule_item_id = #{scheduleItemId} " +
" AND `tbs_cost_apply`.id != #{applyId} " +
" AND `tbs_cost_apply`.charge_state in (1,2,3) " +
" AND opt_type IN (1,4,5,6)")
BigDecimal totalCostAmount(@Param("budgetId") Long budgetId,
@Param("scheduleItemId") Long scheduleItemId,
@Param("applyId") Long applyId);
}

38
src/main/java/com/qs/serve/modules/tbs/service/TbsBudgetApplicationService.java

@ -66,15 +66,6 @@ public class TbsBudgetApplicationService {
}else {
budgetList = new ArrayList<>();
}
List<Long> budgetItemIds = budgetCostItems.stream().map(TbsBudgetCostItem::getScheduleItemBudgetId)
.distinct().collect(Collectors.toList());
List<TbsScheduleItemBudget> scheduleItemList;
if(CollectionUtil.isNotEmpty(budgetItemIds)){
scheduleItemList = tbsScheduleItemBudgetService.listByIds(budgetItemIds);
}else {
scheduleItemList = new ArrayList<>();
}
TbsBudgetTableVo tableVo = new TbsBudgetTableVo();
List<TbsBudgetTableVo.TopTheadHeader> topTheadHeaders = new ArrayList<>();
Map<Long,List<TbsBudgetCostItem>> tmpMap = budgetCostItems.stream().collect(Collectors.groupingBy(TbsBudgetCostItem::getScheduleItemBudgetId));
@ -175,11 +166,6 @@ public class TbsBudgetApplicationService {
List<Long> noBudgetActivityIds = new ArrayList<>();
//所有满足条件的考核期,用于加载历史核销费用
List<TbsScheduleItemBudget> scheduleItemList = this.loadScheduleBudgetAndSetting(activityList, budgetIds, noBudgetActivityIds);
//加载预算占用历史
List<Long> scheduleItemBudgetIds = scheduleItemList.stream().map(TbsScheduleItemBudget::getId).collect(Collectors.toList());
List<TbsBudgetCostItem> hisBudgetCostItemList = tbsBudgetCostItemService.listByScheduleItemBudgetIds(scheduleItemBudgetIds,costApplyId);
Map<Long,List<TbsBudgetCostItem>> hisCostGroupByItemBudget = hisBudgetCostItemList.stream()
.collect(Collectors.groupingBy(TbsBudgetCostItem::getScheduleItemBudgetId));
//补充添加 科目与成本中心拦截
List<TbsActivityCenterGoods> centerGoodsList = tbsActivityCenterGoodsService.listByCostApplyId(costApplyId);
List<TbsActivityCenter> activityCenterList = tbsActivityCenterService.listByCostApplyId(costApplyId);
@ -205,11 +191,17 @@ public class TbsBudgetApplicationService {
if(!budgetNoCondition){
this.handleNoBudgetActivity(throwEx, overspend, activityList, noBudgetActivityIds,activityAllowBudgetIdMap);
}
//统计所有占用预算金额
Map<Long,BigDecimal> budgetItemAmountMap = new HashMap<>(scheduleItemList.size());
//统计费用申请占用金额
Map<Long,BigDecimal> budgetItemApplyAmountMap = new HashMap<>(scheduleItemList.size());
for (TbsScheduleItemBudget itemBudget : scheduleItemList) {
BigDecimal budgetItemApplyAmount = tbsScheduleItemBudgetMapper.totalApplyAmount(itemBudget.getId(),costApplyId);
budgetItemApplyAmountMap.put(itemBudget.getId(),budgetItemApplyAmount);
BigDecimal budgetItemAmount = tbsScheduleItemBudgetMapper.totalCostAmount(itemBudget.getBudgetId(),itemBudget.getScheduleItemId(),costApplyId);
//因为结果为负数,需去相反数
budgetItemAmount = budgetItemAmount==null?BigDecimal.ZERO:budgetItemAmount.negate();
budgetItemAmountMap.put(itemBudget.getId(),budgetItemAmount);
}
//统计当前活动前置项占用预算
Map<Long,BigDecimal> counterMap = new HashMap<>();
@ -217,7 +209,7 @@ public class TbsBudgetApplicationService {
final List<TbsActivityCenterGoods> actMatchList = new ArrayList<>();
final List<TbsActivityCenterGoods> actUnMatchList = new ArrayList<>();
for (TbsActivityCenterGoods activityCostItem : centerGoodsList) {
this.matchActivityMain(activityCostItem,throwEx, overspend, activityList, hisCostGroupByItemBudget, budgetList,
this.matchActivityMain(activityCostItem,throwEx, overspend, activityList, budgetItemAmountMap, budgetList,
noConditionBudgetList, counterMap, actMatchList, actUnMatchList,activityAllowBudgetIdMap,budgetItemApplyAmountMap);
}
List<TbsBudgetCostItem> budgetMatchList = actMatchList.stream()
@ -227,7 +219,7 @@ public class TbsBudgetApplicationService {
TbsBudgetTableVo tableVo = null;
if(buildTableFlag){
//构建tableDTO
tableVo = this.buildBudgetTableVo(activityList, scheduleItemList, hisCostGroupByItemBudget, budgetList, budgetMatchList, budgetUnMatchList);
tableVo = this.buildBudgetTableVo(activityList, budgetItemAmountMap, budgetList, budgetMatchList, budgetUnMatchList);
}
TbsBudgetCostResult result = new TbsBudgetCostResult();
result.setBudgetMatchList(budgetMatchList);
@ -300,16 +292,14 @@ public class TbsBudgetApplicationService {
/**
* 建立费用预算表
* @param activityList
* @param scheduleItemList
* @param hisCostGroupByItemBudget
* @param budgetItemAmountMap
* @param budgetList
* @param budgetMatchList
* @param budgetUnMatchList
* @return
*/
private TbsBudgetTableVo buildBudgetTableVo(List<TbsActivity> activityList,
List<TbsScheduleItemBudget> scheduleItemList,
Map<Long, List<TbsBudgetCostItem>> hisCostGroupByItemBudget,
Map<Long,BigDecimal> budgetItemAmountMap,
List<TbsBudget> budgetList,
List<TbsBudgetCostItem> budgetMatchList,
List<TbsBudgetCostItem> budgetUnMatchList) {
@ -334,7 +324,7 @@ public class TbsBudgetApplicationService {
TbsBudgetTableVo.TopTheadHeader theadHeader = new TbsBudgetTableVo.TopTheadHeader();
theadHeader.setId(scheduleItemBudgetId+"");
theadHeader.setLabel(budgetCode+"("+scheduleItemName+")");
BigDecimal totalUsed = TbsBudgetCostUtil.totalHisCost(hisCostGroupByItemBudget.get(scheduleItemBudgetId));
BigDecimal totalUsed = budgetItemAmountMap.get(scheduleItemBudgetId);
theadHeader.setBudgetAmount(budgetAmount.subtract(totalUsed));
theadHeader.setTotalAmount(budgetAmount);
BigDecimal applyAmount = budgetCostItem.getScheduleItemAmountApply()==null?BigDecimal.ZERO:budgetCostItem.getScheduleItemAmountApply();
@ -400,7 +390,7 @@ public class TbsBudgetApplicationService {
* @param throwEx 预算不够时抛出异常
* @param overspend 超值标识
* @param activityList 所有活动
* @param hisCostGroupByItemBudget 历史费用组
* @param budgetItemAmountMap 统计所有占用预算金额
* @param allBudgetList 所有预算
* @param noConditionBudgetList 没有条件的预算列表
* @param counterMap 历史预算占用
@ -413,7 +403,7 @@ public class TbsBudgetApplicationService {
Boolean throwEx,
boolean overspend,
List<TbsActivity> activityList,
Map<Long, List<TbsBudgetCostItem>> hisCostGroupByItemBudget,
Map<Long,BigDecimal> budgetItemAmountMap,
final List<TbsBudget> allBudgetList,
List<TbsBudget> noConditionBudgetList,
Map<Long, BigDecimal> counterMap,
@ -463,7 +453,7 @@ public class TbsBudgetApplicationService {
boolean isMatch = false;
for (TbsScheduleItemBudget itemBudget : currentScheduleItemBudgets) {
//历史费用(含申请占用金额)
BigDecimal totalUsed = TbsBudgetCostUtil.totalHisCost(hisCostGroupByItemBudget.get(itemBudget.getId()));
BigDecimal totalUsed = budgetItemAmountMap.get(itemBudget.getId());
//当前项费用
BigDecimal budgetAmount = itemBudget.getBudgetAmount();
//前置费用

14
src/main/java/com/qs/serve/modules/tbs/service/TbsCostUnItemService.java

@ -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.TbsCostUnItem;
/**
* 无预算的费用明细 服务接口
* @author YenHex
* @date 2023-02-02
*/
public interface TbsCostUnItemService extends IService<TbsCostUnItem> {
}

3
src/main/java/com/qs/serve/modules/tbs/service/impl/TbsBudgetLogServiceImpl.java

@ -36,9 +36,6 @@ public class TbsBudgetLogServiceImpl extends ServiceImpl<TbsBudgetLogMapper,TbsB
budgetLog.setScheduleId(item.getScheduleId());
budgetLog.setScheduleItemId(item.getScheduleItemId());
budgetLog.setScheduleItemBudgetId(item.getId());
budgetLog.setScheduleOrgId(item.getScheduleId());
budgetLog.setScheduleItemOrgId(item.getScheduleItemId());
budgetLog.setScheduleItemBudgetOrgId(item.getId());
budgetLog.setItemName(item.getScheduleItemName());
budgetLog.setStartDate(item.getActStartDate().atStartOfDay());
budgetLog.setEndDate(item.getActEndDate().atStartOfDay());

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

@ -251,9 +251,6 @@ public class TbsBudgetServiceImpl extends ServiceImpl<TbsBudgetMapper,TbsBudget>
budgetLog.setScheduleId(scheduleItemBudget.getScheduleId());
budgetLog.setScheduleItemId(scheduleItemBudget.getScheduleItemId());
budgetLog.setScheduleItemBudgetId(scheduleItemBudget.getId());
budgetLog.setScheduleOrgId(scheduleItemBudget.getScheduleId());
budgetLog.setScheduleItemOrgId(scheduleItemBudget.getScheduleItemId());
budgetLog.setScheduleItemBudgetOrgId(scheduleItemBudget.getId());
budgetLog.setItemName(scheduleItemBudget.getItemName());
budgetLog.setStartDate(scheduleItemBudget.getStartDate());
budgetLog.setEndDate(scheduleItemBudget.getEndDate());

7
src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostApplyServiceImpl.java

@ -50,6 +50,7 @@ public class TbsCostApplyServiceImpl extends ServiceImpl<TbsCostApplyMapper,TbsC
private SysUserService sysUserService;
private SeeYonService seeYonService;
private TbsActivityTemplateService tbsActivityTemplateService;
private TbsCostUnItemService tbsCostUnItemService;
@Override
@Transactional(rollbackFor = Exception.class)
@ -106,6 +107,12 @@ public class TbsCostApplyServiceImpl extends ServiceImpl<TbsCostApplyMapper,TbsC
costApply = this.getById(costApply.getId());
//移除历史记录
budgetCostItemService.removeByCostApplyId(costApply.getId());
//保存无命中条件的预算
if(CollectionUtil.isNotEmpty(result.getBudgetUnMatchList())){
List<TbsCostUnItem> costUnItems = result.getBudgetUnMatchList().stream()
.map(obj-> CopierUtil.copy(obj,new TbsCostUnItem())).collect(Collectors.toList());
tbsCostUnItemService.saveBatch(costUnItems);
}
//重新保存
List<TbsBudgetCostItem> allBudgetItem = new ArrayList<>();
allBudgetItem.addAll(result.getBudgetMatchList());

22
src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostUnItemServiceImpl.java

@ -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.TbsCostUnItem;
import com.qs.serve.modules.tbs.service.TbsCostUnItemService;
import com.qs.serve.modules.tbs.mapper.TbsCostUnItemMapper;
/**
* 无预算的费用明细 服务实现类
* @author YenHex
* @since 2023-02-02
*/
@Slf4j
@Service
@AllArgsConstructor
public class TbsCostUnItemServiceImpl extends ServiceImpl<TbsCostUnItemMapper,TbsCostUnItem> implements TbsCostUnItemService {
}
Loading…
Cancel
Save