|
@@ -0,0 +1,52 @@
|
|
|
+package com.chelvc.cloud.maintain.controller;
|
|
|
+
|
|
|
+import com.chelvc.cloud.maintain.copier.ScoreCopier;
|
|
|
+import com.chelvc.cloud.maintain.vo.ScoreVO;
|
|
|
+import com.chelvc.cloud.uc.api.dto.ScoreDTO;
|
|
|
+import com.chelvc.cloud.uc.api.param.ScorePagingParam;
|
|
|
+import com.chelvc.cloud.uc.api.service.ScoreService;
|
|
|
+import com.chelvc.framework.base.annotation.ResponseWrapping;
|
|
|
+import com.chelvc.framework.common.model.Pagination;
|
|
|
+import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 积分接口
|
|
|
+ *
|
|
|
+ * @author qizai
|
|
|
+ * @date 2023/9/6
|
|
|
+ */
|
|
|
+@Validated
|
|
|
+@RestController
|
|
|
+@ResponseWrapping
|
|
|
+public class ScoreController {
|
|
|
+ @DubboReference
|
|
|
+ private ScoreService scoreService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询用户积分明细分页信息
|
|
|
+ *
|
|
|
+ * @param param 查询参数
|
|
|
+ * @return 积分明细分页信息
|
|
|
+ */
|
|
|
+ @GetMapping("/score/paging")
|
|
|
+ public Pagination<ScoreVO> getCustomerScorePaging(@Valid ScorePagingParam param) {
|
|
|
+ Pagination<ScoreDTO> pagination = this.scoreService.getScorePaging(param);
|
|
|
+ List<ScoreDTO> records = pagination.getRecords();
|
|
|
+ if (CollectionUtils.isEmpty(records)) {
|
|
|
+ return Pagination.empty();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 构建积分明细信息
|
|
|
+ List<ScoreVO> scoreDetails = records.stream().map(o -> ScoreCopier.INSTANCE.copying(o))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ return pagination.convert(scoreDetails);
|
|
|
+ }
|
|
|
+}
|