Commit 9ccf9251 authored by zhangfeng's avatar zhangfeng

Merge branch 'refs/heads/feature_member_score' into dev

parents e7152b1b 8b70a7be
package cn.iocoder.yudao.module.ecw.api.node;
import cn.iocoder.yudao.module.ecw.api.node.dto.NodeRespDTO;
import cn.iocoder.yudao.module.ecw.api.node.dto.NodeTreeRegionDTO;
import java.util.List;
public interface NodeApi {
List<NodeRespDTO> getNodesByCity(Long cityId,Long countryId);
List<NodeTreeRegionDTO> getNodeTreeRegion();
}
package cn.iocoder.yudao.module.ecw.api.node.dto;
import lombok.Data;
@Data
public class NodeTreeRegionDTO {
/**
* 国家id
*/
private Long countryId;
/**
* 国家中文
*/
private String countryZh;
/**
* 国家英文
*/
private String countryEn;
/**
* 城市id
*/
private Long cityId;
/**
* 城市中文
*/
private String cityZh;
/**
* 城市英文
*/
private String cityEn;
/**
* 网点id
*/
private Long nodeId;
/**
* 网点中文
*/
private String nodeZh;
/**
* 网点英文
*/
private String nodeEn;
}
......@@ -104,6 +104,12 @@ public class NodeController {
return success(NodeConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/get-node-tree-region")
@ApiOperation("获得网点树状列表")
public CommonResult<List<NodeTreeRegionSimpleVO>> getNodeTreeRegion() {
return success(nodeService.getNodeTreeRegion());
}
@GetMapping("/export-excel")
@ApiOperation("导出服务网点 Excel")
@PreAuthorize("@ss.hasPermission('ecw:node:export')")
......
package cn.iocoder.yudao.module.ecw.controller.admin.node.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
import java.util.Objects;
@Data
public class NodeTreeRegionSimpleVO {
@ApiModelProperty("国家id")
private Long id;
@ApiModelProperty("国家中文名")
private String labelZh;
@ApiModelProperty("国家英文名")
private String labelEn;
@ApiModelProperty("城市")
private List<NodeCity> children;
@Data
public static class NodeCity {
@ApiModelProperty("城市id")
private Long id;
@ApiModelProperty("城市中文名")
private String labelZh;
@ApiModelProperty("城市英文名")
private String labelEn;
@ApiModelProperty("网点")
private List<Node> children;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
NodeCity that = (NodeCity) o;
return Objects.equals(id, that.id);
}
@Override
public int hashCode() {
return Objects.hashCode(id);
}
}
@Data
public static class Node {
@ApiModelProperty("网点id")
private Long id;
@ApiModelProperty("网点中文名")
private String labelZh;
@ApiModelProperty("网点英文名")
private String labelEn;
}
}
......@@ -5,6 +5,7 @@ import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ecw.api.node.dto.NodeTreeRegionDTO;
import cn.iocoder.yudao.module.ecw.dal.dataobject.node.NodeDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
......@@ -81,4 +82,5 @@ public interface NodeMapper extends BaseMapperX<NodeDO> {
.orderByDesc(NodeDO::getId));
}
List<NodeTreeRegionDTO> getNodeTreeRegionList();
}
......@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.ecw.service.api;
import cn.iocoder.yudao.module.ecw.api.node.NodeApi;
import cn.iocoder.yudao.module.ecw.api.node.dto.NodeRespDTO;
import cn.iocoder.yudao.module.ecw.api.node.dto.NodeTreeRegionDTO;
import cn.iocoder.yudao.module.ecw.dal.dataobject.node.NodeDO;
import cn.iocoder.yudao.module.ecw.dal.mysql.node.NodeMapper;
import org.springframework.beans.BeanUtils;
......@@ -35,4 +36,9 @@ public class NodeApiImpl implements NodeApi {
}
return null;
}
@Override
public List<NodeTreeRegionDTO> getNodeTreeRegion() {
return nodeMapper.getNodeTreeRegionList();
}
}
......@@ -76,4 +76,5 @@ public interface NodeService {
*/
List<NodeDO> getNodeList(NodeExportReqVO exportReqVO);
List<NodeTreeRegionSimpleVO> getNodeTreeRegion();
}
package cn.iocoder.yudao.module.ecw.service.node;
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
import cn.iocoder.yudao.module.ecw.api.node.dto.NodeTreeRegionDTO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -86,6 +87,60 @@ public class NodeServiceImpl implements NodeService {
return nodeMapper.selectList(exportReqVO);
}
@Override
public List<NodeTreeRegionSimpleVO> getNodeTreeRegion() {
List<NodeTreeRegionDTO> nodeList = nodeMapper.getNodeTreeRegionList();
Map<Long, NodeTreeRegionSimpleVO> countryMap = new LinkedHashMap<>();
Map<Long, Map<Long, NodeTreeRegionSimpleVO.NodeCity>> cityMap = new LinkedHashMap<>();
for (NodeTreeRegionDTO dto : nodeList) {
Long countryId = dto.getCountryId();
String countryZh = dto.getCountryZh();
String countryEn = dto.getCountryEn();
Long cityId = dto.getCityId();
String cityZh = dto.getCityZh();
String cityEn = dto.getCityEn();
Long nodeId = dto.getNodeId();
String nodeZh = dto.getNodeZh();
String nodeEn = dto.getNodeEn();
// 处理国家
NodeTreeRegionSimpleVO countryVO = countryMap.computeIfAbsent(countryId, id -> {
NodeTreeRegionSimpleVO vo = new NodeTreeRegionSimpleVO();
vo.setId(id);
vo.setLabelZh(countryZh.trim());
vo.setLabelEn(countryEn);
vo.setChildren(new ArrayList<>());
return vo;
});
// 处理城市
Map<Long, NodeTreeRegionSimpleVO.NodeCity> cities = cityMap.computeIfAbsent(countryId, k -> new LinkedHashMap<>());
NodeTreeRegionSimpleVO.NodeCity cityVO = cities.computeIfAbsent(cityId, id -> {
NodeTreeRegionSimpleVO.NodeCity city = new NodeTreeRegionSimpleVO.NodeCity();
city.setId(id);
city.setLabelZh(cityZh.trim());
city.setLabelEn(cityEn);
city.setChildren(new ArrayList<>());
return city;
});
// 处理网点
NodeTreeRegionSimpleVO.Node node = new NodeTreeRegionSimpleVO.Node();
node.setId(nodeId);
node.setLabelZh(nodeZh);
node.setLabelEn(nodeEn);
cityVO.getChildren().add(node);
if (!countryVO.getChildren().contains(cityVO)) {
countryVO.getChildren().add(cityVO);
}
}
return new ArrayList<>(countryMap.values());
}
@Override
public PageResult<NodeDO> getNodePageList(NodePageReqVO pageReqVO) {
IPage<NodeDO> mpPage = MyBatisUtils.buildPage(pageReqVO);
......
......@@ -32,6 +32,26 @@
order by node.aorder desc
</select>
<select id="getNodeTreeRegionList" resultType="cn.iocoder.yudao.module.ecw.api.node.dto.NodeTreeRegionDTO">
SELECT
n.guojia AS countryId,
c.title_zh AS countryZh,
c.title_en AS countryEn,
n.shi AS cityId,
p.title_zh AS cityZh,
p.title_en AS cityEn,
n.id AS nodeId,
n.title_zh AS nodeZh,
n.title_en AS nodeEn
FROM
ecw_node n
LEFT JOIN
ecw_region c ON n.guojia = c.id
LEFT JOIN
ecw_region p ON n.shi = p.id
ORDER BY
n.guojia, n.shi, n.id;
</select>
</mapper>
......@@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.module.member.dal.dataobject.scoreRule.ScoreRuleDO;
import cn.iocoder.yudao.module.member.dal.redis.scoreRule.ScoreRuleRedisDao;
import cn.iocoder.yudao.module.member.enums.ScoreRuleStatusEnum;
import cn.iocoder.yudao.module.member.service.scoreRule.ScoreRuleService;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
......@@ -15,7 +16,7 @@ import java.util.Date;
import java.util.List;
/**
* 会员积分过期定时任务
* 积分规则过期定时任务
*/
@Component
@Slf4j
......@@ -30,6 +31,8 @@ public class ScoreRuleExpireTask implements JobHandler {
@Resource
private ScoreRuleService scoreRuleService;
@Resource
private ScoreRuleRedisDao scoreRuleRedisDao;
@Override
public String execute(String param) throws Exception {
......@@ -42,8 +45,11 @@ public class ScoreRuleExpireTask implements JobHandler {
if (CollectionUtils.isEmpty(todoList)) {
return "success";
} else {
todoList.forEach(scoreRuleDO -> scoreRuleDO.setStatus(ScoreRuleStatusEnum.EXPIRED.getValue()));
scoreRuleService.updateBatch(todoList);
todoList.forEach(scoreRuleDO -> {
scoreRuleDO.setStatus(ScoreRuleStatusEnum.EXPIRED.getValue());
scoreRuleRedisDao.deleteEnableScoreRule(scoreRuleDO.getType());
scoreRuleService.updateById(scoreRuleDO);
});
}
return "success";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment