|
@ -34,6 +34,7 @@ import com.qs.serve.modules.tbs.entity.dto.TbsCostErrorBudgetDTO; |
|
|
import com.qs.serve.modules.tbs.entity.vo.TbsBudgetTableResultVo; |
|
|
import com.qs.serve.modules.tbs.entity.vo.TbsBudgetTableResultVo; |
|
|
import com.qs.serve.modules.tbs.entity.vo.TbsBudgetTableVo; |
|
|
import com.qs.serve.modules.tbs.entity.vo.TbsBudgetTableVo; |
|
|
import com.qs.serve.modules.tbs.entity.vo.TbsCostApplyVo; |
|
|
import com.qs.serve.modules.tbs.entity.vo.TbsCostApplyVo; |
|
|
|
|
|
import com.qs.serve.modules.tbs.mapper.TbsBudgetConditionMapper; |
|
|
import com.qs.serve.modules.tbs.mapper.TbsBudgetLogMapper; |
|
|
import com.qs.serve.modules.tbs.mapper.TbsBudgetLogMapper; |
|
|
import com.qs.serve.modules.tbs.mapper.TbsCostApplyMapper; |
|
|
import com.qs.serve.modules.tbs.mapper.TbsCostApplyMapper; |
|
|
import com.qs.serve.modules.tbs.service.*; |
|
|
import com.qs.serve.modules.tbs.service.*; |
|
@ -87,38 +88,87 @@ public class TbsCostApplyTestController { |
|
|
private TbsBudgetCostItemService budgetCostItemService; |
|
|
private TbsBudgetCostItemService budgetCostItemService; |
|
|
private TbsBudgetLogService budgetLogService; |
|
|
private TbsBudgetLogService budgetLogService; |
|
|
private SysTableTempMapper sysTableTempMapper; |
|
|
private SysTableTempMapper sysTableTempMapper; |
|
|
|
|
|
private TbsBudgetConditionMapper tbsBudgetConditionMapper; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 判断预算商品的条件是否匹配 |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
@GetMapping("matchGoods") |
|
|
|
|
|
public R<?> matchGoods(){ |
|
|
|
|
|
for (int i = 0; i < 1000; i++) { |
|
|
|
|
|
matchGoods1000(); |
|
|
|
|
|
} |
|
|
|
|
|
return R.ok(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("reBuildGoods") |
|
|
//@GetMapping("/overspendRebuildAll")
|
|
|
public R<?> reBuildGoods(){ |
|
|
public R<?> ss(){ |
|
|
List<Long> costIds = sysTableTempMapper.getGoodsUnMatchCostIds(); |
|
|
LambdaQueryWrapper<SysTableTemp> lqw = new LambdaQueryWrapper<>(); |
|
|
for (Long costId : costIds) { |
|
|
lqw.eq(SysTableTemp::getOptionTitle,"rebuildCost"); |
|
|
overRebuildCost(costId); |
|
|
lqw.likeRight(SysTableTemp::getResultMsg,"预算未匹配"); |
|
|
|
|
|
lqw.eq(SysTableTemp::getDealState,0); |
|
|
|
|
|
List<SysTableTemp> sysTableTempList = sysTableTempMapper.selectList(lqw); |
|
|
|
|
|
for (SysTableTemp tableTemp : sysTableTempList) { |
|
|
|
|
|
overRebuildCost(Long.parseLong(tableTemp.getTableId())); |
|
|
|
|
|
} |
|
|
} |
|
|
return R.ok(sysTableTempList.size()); |
|
|
return R.ok(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@GetMapping("/overspendRebuild") |
|
|
|
|
|
public R<?> ss2(Long costId){ |
|
|
private void matchGoods1000() { |
|
|
return overRebuildCost(costId); |
|
|
List<TbsBudgetCondition> conditionList = tbsBudgetConditionMapper.selectList(new QueryWrapper<>()); |
|
|
|
|
|
Map<Long,List<TbsBudgetCondition>> conditionListMap = conditionList.stream().collect(Collectors.groupingBy(TbsBudgetCondition::getBudgetId)); |
|
|
|
|
|
List<TbsBudgetCostItem> budgetCostItemList = sysTableTempMapper.getListByCostId(); |
|
|
|
|
|
if(budgetCostItemList.size()<1){ |
|
|
|
|
|
Assert.throwEx("匹配完成"); |
|
|
|
|
|
} |
|
|
|
|
|
List<Long> mIds = new ArrayList<>(); |
|
|
|
|
|
mIds.add(0L); |
|
|
|
|
|
List<Long> umIds = new ArrayList<>(); |
|
|
|
|
|
umIds.add(0L); |
|
|
|
|
|
for (TbsBudgetCostItem item : budgetCostItemList) { |
|
|
|
|
|
List<TbsBudgetCondition> conditions = conditionListMap.get(item.getBudgetId()); |
|
|
|
|
|
if(conditions==null||conditions.size()<1){ |
|
|
|
|
|
mIds.add(item.getId()); |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
boolean m = false; |
|
|
|
|
|
for (TbsBudgetCondition condition : conditions) { |
|
|
|
|
|
String itemLevels = item.getTargetLevelPathIds(); |
|
|
|
|
|
String conGoodsId = condition.getTargetId()+""; |
|
|
|
|
|
if(itemLevels.equals(conGoodsId) || itemLevels.contains(conGoodsId+"_")){ |
|
|
|
|
|
mIds.add(item.getId()); |
|
|
|
|
|
m = true; |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//没有匹配到预算
|
|
|
|
|
|
if(!m){ |
|
|
|
|
|
umIds.add(item.getId()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
sysTableTempMapper.updateBudgetCoistItemState(mIds,1); |
|
|
|
|
|
sysTableTempMapper.updateBudgetCoistItemState(umIds,2); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void saveTableTmp(SysTableTemp sysTableTemp){ |
|
|
public void saveTableTmp(SysTableTemp sysTableTemp){ |
|
|
sysTableTempMapper.insert(sysTableTemp); |
|
|
sysTableTempMapper.insert(sysTableTemp); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//@GetMapping("/overRebuildCost")
|
|
|
|
|
|
public R<?> overRebuildCost(Long costApplyId){ |
|
|
public R<?> overRebuildCost(Long costApplyId){ |
|
|
SysTableTemp sysTableTemp = new SysTableTemp(); |
|
|
SysTableTemp sysTableTemp = new SysTableTemp(); |
|
|
sysTableTemp.setTableName("tbs_cost_apply"); |
|
|
sysTableTemp.setTableName("tbs_cost_apply"); |
|
|
sysTableTemp.setTableId(""+costApplyId); |
|
|
sysTableTemp.setTableId(""+costApplyId); |
|
|
sysTableTemp.setOptionTitle("overRebuildCost"); |
|
|
//后缀数字 2 标识第几次批次
|
|
|
|
|
|
sysTableTemp.setOptionTitle("overRebuildCost2"); |
|
|
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<SysTableTemp> checkExist = new LambdaQueryWrapper<>(); |
|
|
|
|
|
long count = sysTableTempMapper.selectCount(checkExist.eq(SysTableTemp::getTableId,costApplyId) |
|
|
|
|
|
.eq(SysTableTemp::getOptionTitle,sysTableTemp.getOptionTitle())); |
|
|
|
|
|
if(count>0){ |
|
|
|
|
|
return R.ok(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
TbsCostApply costApply = tbsCostApplyService.getById(costApplyId); |
|
|
TbsCostApply costApply = tbsCostApplyService.getById(costApplyId); |
|
|
TbsBudgetTableResultVo resultVo = tbsBudgetMatchApplication.getMatchResult(costApplyId ,false,true); |
|
|
TbsBudgetTableResultVo resultVo = tbsBudgetMatchApplication.getMatchResult(costApplyId ,false,true); |
|
|
|
|
|
|
|
@ -258,7 +308,7 @@ public class TbsCostApplyTestController { |
|
|
|
|
|
|
|
|
// 设置remark标记防止误删,移除旧的记录
|
|
|
// 设置remark标记防止误删,移除旧的记录
|
|
|
for (TbsBudgetCostItem costItem : itemList) { |
|
|
for (TbsBudgetCostItem costItem : itemList) { |
|
|
costItem.setRemark("toDel"); |
|
|
costItem.setRemark("toDel2"); |
|
|
} |
|
|
} |
|
|
budgetCostItemService.updateBatchById(itemList); |
|
|
budgetCostItemService.updateBatchById(itemList); |
|
|
List<Long> itemIds = itemList.stream().map(TbsBudgetCostItem::getId).collect(Collectors.toList()); |
|
|
List<Long> itemIds = itemList.stream().map(TbsBudgetCostItem::getId).collect(Collectors.toList()); |
|
@ -271,7 +321,7 @@ public class TbsCostApplyTestController { |
|
|
bLqw.eq(TbsBudgetLog::getCostApplyId,costApplyId); |
|
|
bLqw.eq(TbsBudgetLog::getCostApplyId,costApplyId); |
|
|
List<TbsBudgetLog> dbbudgetLogs = budgetLogService.list(bLqw); |
|
|
List<TbsBudgetLog> dbbudgetLogs = budgetLogService.list(bLqw); |
|
|
for (TbsBudgetLog budgetLog : dbbudgetLogs) { |
|
|
for (TbsBudgetLog budgetLog : dbbudgetLogs) { |
|
|
budgetLog.setRemark("toDel"); |
|
|
budgetLog.setRemark("toDel2"); |
|
|
} |
|
|
} |
|
|
budgetLogService.updateBatchById(dbbudgetLogs); |
|
|
budgetLogService.updateBatchById(dbbudgetLogs); |
|
|
List<Long> budIds = dbbudgetLogs.stream().map(TbsBudgetLog::getId).collect(Collectors.toList()); |
|
|
List<Long> budIds = dbbudgetLogs.stream().map(TbsBudgetLog::getId).collect(Collectors.toList()); |
|
|