Browse Source

拼接匹配规则预览1测试

v1.0
Yen 2 years ago
parent
commit
0b5e9e8009
  1. 2
      src/main/java/com/qs/serve/common/model/annotation/LimitSubmit.java
  2. 12
      src/main/java/com/qs/serve/modules/tbs/controller/TbsCostApplyController.java
  3. 13
      src/main/java/com/qs/serve/modules/tbs/service/TbsBudgetMatchApplication.java
  4. 6
      src/main/resources/mapper/tbs/TbsBudgetMatchMapper.xml

2
src/main/java/com/qs/serve/common/model/annotation/LimitSubmit.java

@ -15,7 +15,7 @@ public @interface LimitSubmit {
/**
* 间隔时间(ms)在世界间隔内超过执行次数视为被限制
*/
int interval() default 500;
int interval() default 1000;
/**
* 提示消息

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

@ -72,6 +72,7 @@ public class TbsCostApplyController {
private TbsBudgetApplicationService budgetApplicationService;
private SysPostUserService postUserService;
private TbsCostApplyOperationServiceImpl tbsCostApplyOperationServiceImpl;
private TbsBudgetMatchApplication tbsBudgetMatchApplication;
/**
* 作废费用申请
@ -102,8 +103,15 @@ public class TbsCostApplyController {
@GetMapping("preview")
@PreAuthorize("hasRole('tbs:costApply:query')")
public R<TbsBudgetTableVo> preview(Long id){
TbsBudgetCostResult result = budgetApplicationService.buildBudgetCostResult(id,false,true);
return R.ok(result.getTableData());
TbsCostApply costApply = tbsCostApplyService.getById(id);
TbsBudgetTableVo tableVo = null;
if(costApply.getMatchType().equals(0)){
TbsBudgetCostResult result = budgetApplicationService.buildBudgetCostResult(id,false,true);
tableVo = result.getTableData();
}else if (costApply.getMatchType().equals(1)){
tableVo = tbsBudgetMatchApplication.getMatchResult(id,true).getTableVo();
}
return R.ok(tableVo);
}
/**

13
src/main/java/com/qs/serve/modules/tbs/service/TbsBudgetMatchApplication.java

@ -54,7 +54,7 @@ public class TbsBudgetMatchApplication {
if(usableAmt==null){
usableAmt = itemBudget.getUnUsedBudgetAmount();
}
if(usableAmt.compareTo(centerGoods.getCenterGoodsAmount())<0){
if(usableAmt.compareTo(centerGoods.getCenterGoodsAmount())>=0){
usableAmt = usableAmt.subtract(centerGoods.getCenterGoodsAmount());
//扣减后存放map
usableAmountMap.put(scheduleItemBudgetId,usableAmt);
@ -124,7 +124,7 @@ public class TbsBudgetMatchApplication {
TbsBudgetTableVo.TableValue tableValue = new TbsBudgetTableVo.TableValue();
tableValue.setTopId(centerGoods.getScheduleItemBudgetId()+"");
tableValue.setLeftId(centerGoods.getCenterId()+"");
tableValue.setLeftId(centerGoods.getId()+"");
tableValue.setValue(centerGoods.getCenterGoodsAmount());
tableValueList.add(tableValue);
}
@ -145,19 +145,18 @@ public class TbsBudgetMatchApplication {
String[] goodsIds = centerGoods.getTargetLevelPathIds().split("_");
List<TbsCenterGoodsGroupDTO> groups = new ArrayList<>();
List<String> goodsIdList = Arrays.asList(goodsIds);
Collections.reverse(goodsIdList);
for (int i = 0; i < goodsIdList.size(); i++) {
if(i==0){
//brand、category、series、spu、sku
groups.add(new TbsCenterGoodsGroupDTO("sku",goodsIdList.get(i)));
groups.add(new TbsCenterGoodsGroupDTO("brand",goodsIdList.get(i)));
}else if (i==1){
groups.add(new TbsCenterGoodsGroupDTO("spu",goodsIdList.get(i)));
groups.add(new TbsCenterGoodsGroupDTO("category",goodsIdList.get(i)));
}else if (i==2){
groups.add(new TbsCenterGoodsGroupDTO("series",goodsIdList.get(i)));
}else if (i==3){
groups.add(new TbsCenterGoodsGroupDTO("category",goodsIdList.get(i)));
groups.add(new TbsCenterGoodsGroupDTO("spu",goodsIdList.get(i)));
}else {
groups.add(new TbsCenterGoodsGroupDTO("brand",goodsIdList.get(i)));
groups.add(new TbsCenterGoodsGroupDTO("sku",goodsIdList.get(i)));
break;
}
}

6
src/main/resources/mapper/tbs/TbsBudgetMatchMapper.xml

@ -42,7 +42,7 @@
left join tbs_budget tb on tsib.budget_id = tb.id
left join tbs_budget_condition tbc on tbc.budget_id = tb.id
left join
(select sum(tbg.amount) amt,tbg.schedule_item_budget_id from tbs_budget_log tbg where tbg.opt_type and tbg.del_flag = 0 GROUP BY tbg.schedule_item_budget_id) temp_tbg1
(select sum(tbg.amount) amt,tbg.schedule_item_budget_id from tbs_budget_log tbg where tbg.del_flag = 0 GROUP BY tbg.schedule_item_budget_id) temp_tbg1
on temp_tbg1.schedule_item_budget_id = tsib.id
left join
(select sum(tbg2.amount) amt,tbg2.schedule_item_budget_id from tbs_budget_log tbg2 where tbg2.opt_type in(0,2,3) and tbg2.del_flag = 0 GROUP BY tbg2.schedule_item_budget_id) temp_tbg2
@ -55,8 +55,8 @@
AND tb.center_id = #{query.centerId}
AND tb.center_type = #{query.centerType}
AND tb.budget_state = 1
AND tsib.start_date &gt;= #{query.actStartDate}
AND tsib.end_date &lt;= #{query.actEndDate}
AND tsib.start_date &lt;= #{query.actStartDate}
AND tsib.end_date &gt;= #{query.actEndDate}
AND ( tb.condition_flag =0 or
<foreach collection="query.queryGoodsGroups" item ="item" index="i" open="(" close=")" separator="or">

Loading…
Cancel
Save