| | |
| | | import org.springframework.stereotype.Service; |
| | | import utils.DateUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 违约规则Service业务层处理 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<CalculateRuleCascaderVO> getRuleListByUnitId(Integer unitId) { |
| | | return calculateRuleMapper.getRuleListByUnitId(unitId, DateUtils.getDate()); |
| | | public List<CalculateRuleCascaderVO> getRuleListByUnitId(Integer unitId) { |
| | | List<CalculateRuleCascaderVO> ruleListByUnitId = calculateRuleMapper.getRuleListByUnitId(unitId, DateUtils.getDate()); |
| | | Map<String, List<CalculateRuleCascaderVO>> map = ruleListByUnitId.stream().collect(Collectors.groupingBy(CalculateRuleCascaderVO::getRuleName)); |
| | | List<CalculateRuleCascaderVO> result = new ArrayList<>(); |
| | | map.forEach((str,list)->{ |
| | | CalculateRuleCascaderVO vo = new CalculateRuleCascaderVO(); |
| | | vo.setValue(str); |
| | | vo.setLabel(str); |
| | | vo.setChildren(list); |
| | | result.add(vo); |
| | | }); |
| | | return result; |
| | | } |
| | | } |