Browse Source

获取允许申请的积分类别-返回结构调整

master
Jackwang 3 years ago
parent
commit
d1e785cf35
  1. 6
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/List4ApplyResultDTO.java
  2. 28
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdditiveRuleServiceImpl.java
  3. 8
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdditiveRuleDao.xml

6
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/List4ApplyResultDTO.java

@ -3,8 +3,6 @@ package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @program: epmet-cloud
@ -19,9 +17,9 @@ public class List4ApplyResultDTO implements Serializable {
private String name;
private String pid;
// private String pid;
private Integer pointValue;
private List<List4ApplyResultDTO> children = new ArrayList<>();
// private List<List4ApplyResultDTO> children = new ArrayList<>();
}

28
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdditiveRuleServiceImpl.java

@ -194,35 +194,9 @@ public class PointAdditiveRuleServiceImpl extends BaseServiceImpl<PointAdditiveR
@Override
public Result<List<List4ApplyResultDTO>> list4apply(List4applyFormDTO dto) {
List<List4ApplyResultDTO> list = baseDao.selectList4apply(dto);
List<List4ApplyResultDTO> result = build(list);
result.removeIf(category ->CollectionUtils.isEmpty(category.getChildren()));
return new Result<List<List4ApplyResultDTO>>().ok(result);
return new Result<List<List4ApplyResultDTO>>().ok(list);
}
/**
* 构建树节点
*/
public static List<List4ApplyResultDTO> build(List<List4ApplyResultDTO> treeNodes) {
List<List4ApplyResultDTO> result = new ArrayList<>();
//list转map
Map<String, List4ApplyResultDTO> nodeMap = new LinkedHashMap<>(treeNodes.size());
for(List4ApplyResultDTO treeNode : treeNodes){
nodeMap.put(treeNode.getId(), treeNode);
}
for(List4ApplyResultDTO node : nodeMap.values()) {
List4ApplyResultDTO parent = nodeMap.get(node.getPid());
if(parent != null && !(node.getId().equals(parent.getId()))){
parent.getChildren().add(node);
continue;
}
result.add(node);
}
return result;
}
@Override
public Result<List<PointAdditiveRuleDTO>> list4tree(List4treeFormDTO dto) {

8
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdditiveRuleDao.xml

@ -45,8 +45,7 @@
</select>
<select id="selectList4apply" resultType="com.epmet.dto.result.List4ApplyResultDTO">
select id,
if(CATEGORY_NAME is null,RULE_NAME,CATEGORY_NAME) as name,
pid,
RULE_NAME as name,
POINT_VALUE
from point_additive_rule
where DEL_FLAG='0'
@ -55,11 +54,12 @@
and APPLY_FLAG= #{applyFlag}
</if>
<if test="businessCode != null and businessCode != '' and businessCode == 'point_fine'.toString()">
and (( type='rule' and POINT_VALUE &lt; 0 )or TYPE='category')
and POINT_VALUE &lt; 0
</if>
<if test="businessCode != null and businessCode != '' and businessCode == 'point_reward'.toString()">
and (( type='rule' and POINT_VALUE &gt; 0 )or TYPE='category')
and POINT_VALUE &gt; 0
</if>
and type='rule'
and CUSTOMER_ID=#{customerId}
order by UPDATED_TIME desc
</select>

Loading…
Cancel
Save