Browse Source

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

feature/teamB_zz_wgh
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 lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/** /**
* @program: epmet-cloud * @program: epmet-cloud
@ -19,9 +17,9 @@ public class List4ApplyResultDTO implements Serializable {
private String name; private String name;
private String pid; // private String pid;
private Integer pointValue; 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 @Override
public Result<List<List4ApplyResultDTO>> list4apply(List4applyFormDTO dto) { public Result<List<List4ApplyResultDTO>> list4apply(List4applyFormDTO dto) {
List<List4ApplyResultDTO> list = baseDao.selectList4apply(dto); List<List4ApplyResultDTO> list = baseDao.selectList4apply(dto);
List<List4ApplyResultDTO> result = build(list); return new Result<List<List4ApplyResultDTO>>().ok(list);
result.removeIf(category ->CollectionUtils.isEmpty(category.getChildren()));
return new Result<List<List4ApplyResultDTO>>().ok(result);
} }
/**
* 构建树节点
*/
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 @Override
public Result<List<PointAdditiveRuleDTO>> list4tree(List4treeFormDTO dto) { 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>
<select id="selectList4apply" resultType="com.epmet.dto.result.List4ApplyResultDTO"> <select id="selectList4apply" resultType="com.epmet.dto.result.List4ApplyResultDTO">
select id, select id,
if(CATEGORY_NAME is null,RULE_NAME,CATEGORY_NAME) as name, RULE_NAME as name,
pid,
POINT_VALUE POINT_VALUE
from point_additive_rule from point_additive_rule
where DEL_FLAG='0' where DEL_FLAG='0'
@ -55,11 +54,12 @@
and APPLY_FLAG= #{applyFlag} and APPLY_FLAG= #{applyFlag}
</if> </if>
<if test="businessCode != null and businessCode != '' and businessCode == 'point_fine'.toString()"> <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>
<if test="businessCode != null and businessCode != '' and businessCode == 'point_reward'.toString()"> <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> </if>
and type='rule'
and CUSTOMER_ID=#{customerId} and CUSTOMER_ID=#{customerId}
order by UPDATED_TIME desc order by UPDATED_TIME desc
</select> </select>

Loading…
Cancel
Save