@Overridepublic List<RuleTypeUpdate> insertAndSelectRuleTypeUpdate(List<RuleTypeUpdate> ruleTypeUpdate) {List<RuleTypeUpdate> ruleTypeUpdates = ruleTypeUpdateMapper.selectRuleTypeUpdateList(new RuleTypeUpdate());List<RuleTypeUpdate> ruleInsertList = ruleTypeUpdate.stream().filter(item -> findRuleTypeData(item.getRuleTypeId(), ruleTypeUpdates) == -1).collect(Collectors.toList());List<RuleTypeUpdate> ruleUpdataList = ruleTypeUpdate.stream().filter(item -> findRuleTypeData(item.getRuleTypeId(), ruleTypeUpdates) > -1).collect(Collectors.toList());if (!CollectionUtils.isEmpty(ruleInsertList)) {for (RuleTypeUpdate typeUpdate : ruleInsertList) {typeUpdate.setCreateTime(DateUtils.getNowDate());ruleTypeUpdateMapper.insertRuleTypeUpdate(typeUpdate);}} else {for (RuleTypeUpdate typeUpdate : ruleUpdataList) {typeUpdate.setUpdateTime(DateUtils.getNowDate());ruleTypeUpdateMapper.updateRuleTypeIntScore(typeUpdate);}}return ruleTypeUpdates;}private int findRuleTypeData(String ruleTypeId, List<RuleTypeUpdate> ruleTypeUpdate) {int res = -1;for (int i = 0; i < ruleTypeUpdate.size(); i++) {if (ruleTypeId.equals(ruleTypeUpdate.get(i).getRuleTypeId())) {res = i;break;}}return res;}