wangqiang 2 éve
szülő
commit
53e549efee

+ 26 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/luckyDraw/controller/LuckyDrawInfoController.java

@@ -6,6 +6,7 @@ import com.jeeplus.aop.logging.annotation.ApiLog;
 import com.jeeplus.common.utils.ResponseUtil;
 import com.jeeplus.test.luckyDraw.service.LuckyDrawInfoService;
 import com.jeeplus.test.luckyDraw.service.dto.LuckyDrawInfoDto;
+import com.jeeplus.test.luckyDraw.service.dto.LuckyDrawMembersDto;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.http.ResponseEntity;
@@ -13,6 +14,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author: 王强
@@ -46,6 +49,29 @@ public class LuckyDrawInfoController {
         return ResponseEntity.ok (result);
     }
 
+    @ApiLog("数据拼接")
+    @GetMapping("pjList")
+    public ResponseEntity<IPage<LuckyDrawInfoDto>> pjList(LuckyDrawInfoDto luckyDrawEventsDTO, Page<LuckyDrawInfoDto> page) throws Exception {
+        page.setSize(-1);
+        page.setCurrent(1);
+        IPage<LuckyDrawInfoDto> result = new Page<LuckyDrawInfoDto>();
+        result = drawInfoService.findList (page,luckyDrawEventsDTO);
+        List<LuckyDrawInfoDto> records = result.getRecords();
+        List<LuckyDrawInfoDto> addList = new ArrayList<>();
+        records.forEach(re ->{
+            addList.add(re);
+            re.getLuckyDrawMembersDtos().forEach(mem->{
+                LuckyDrawInfoDto l = new LuckyDrawInfoDto();
+                l.setAwardsName(mem.getName());
+                l.setNumber(mem.getOfficeName());
+                l.setPrizeName(mem.getPhone());
+                addList.add(l);
+            });
+        });
+        result.setRecords(addList);
+        return ResponseEntity.ok (result);
+    }
+
     /**
      * 抽奖
      * @param dto