|
@@ -0,0 +1,86 @@
|
|
|
+package com.fjhx.victoriatourist.controller.blessing.open;
|
|
|
+
|
|
|
+import com.fjhx.tenant.entity.dict.vo.DictTenantDataVo;
|
|
|
+import com.fjhx.victoriatourist.entity.blessing.dto.BlessingCoverSelectDto;
|
|
|
+import com.fjhx.victoriatourist.entity.blessing.dto.BlessingLanguageSelectDto;
|
|
|
+import com.fjhx.victoriatourist.entity.blessing.vo.BlessingCoverVo;
|
|
|
+import com.fjhx.victoriatourist.entity.blessing.vo.BlessingLanguageVo;
|
|
|
+import com.fjhx.victoriatourist.entity.blessing.vo.open.BlessingGradeVo;
|
|
|
+import com.fjhx.victoriatourist.service.blessing.BlessingCoverService;
|
|
|
+import com.fjhx.victoriatourist.service.blessing.BlessingLanguageService;
|
|
|
+import com.fjhx.victoriatourist.utils.DictUtilsByOpen;
|
|
|
+import com.ruoyi.common.core.domain.BaseSelectDto;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 祝福封面 前端控制器
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author lqh
|
|
|
+ * @since 2023-12-09
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/open/blessing")
|
|
|
+public class BlessingOpenController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private BlessingCoverService blessingCoverService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private BlessingLanguageService blessingLanguageService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 祝福语列表
|
|
|
+ */
|
|
|
+ @PostMapping("/listByLanguage")
|
|
|
+ public List<BlessingGradeVo> listByLanguage(@RequestBody BlessingLanguageSelectDto dto) {
|
|
|
+
|
|
|
+
|
|
|
+ Map<String, List<BlessingLanguageVo>> listMap = blessingLanguageService.getList(dto).stream().collect(Collectors.groupingBy(BlessingLanguageVo::getBlessingType));
|
|
|
+ List<DictTenantDataVo> dictList = DictUtilsByOpen.getDictList("blessing_type");
|
|
|
+ return dictList.stream().map(x -> {
|
|
|
+ BlessingGradeVo vo = new BlessingGradeVo();
|
|
|
+ vo.setDictTenantDataVo(x);
|
|
|
+
|
|
|
+ if (listMap.containsKey(x.getDictKey())) {
|
|
|
+ List<BlessingLanguageVo> collect = listMap.get(x.getDictKey()).stream().map(obj -> {
|
|
|
+ obj.setBlessingTypeName(x.getDictValue());
|
|
|
+ return obj;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ vo.setLanguageVoList(collect);
|
|
|
+ }else {
|
|
|
+ vo.setLanguageVoList(new ArrayList<>());
|
|
|
+ }
|
|
|
+ return vo;
|
|
|
+ }).filter(x -> !x.getLanguageVoList().isEmpty()).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 祝福封面列表
|
|
|
+ */
|
|
|
+ @PostMapping("/listByCover")
|
|
|
+ public List<BlessingGradeVo> listByCover(@RequestBody BlessingCoverSelectDto dto) {
|
|
|
+ Map<String, List<BlessingCoverVo>> listMap = blessingCoverService.getList(dto).stream().collect(Collectors.groupingBy(BlessingCoverVo::getCoverType));
|
|
|
+ List<DictTenantDataVo> dictList = DictUtilsByOpen.getDictList("cover_type");
|
|
|
+ return dictList.stream().map(x -> {
|
|
|
+ BlessingGradeVo vo = new BlessingGradeVo();
|
|
|
+ vo.setDictTenantDataVo(x);
|
|
|
+ if (listMap.containsKey(x.getDictKey())) {
|
|
|
+ vo.setCoverVoList(listMap.get(x.getDictKey()));
|
|
|
+ }else {
|
|
|
+ vo.setCoverVoList(new ArrayList<>());
|
|
|
+ }
|
|
|
+ return vo;
|
|
|
+ }).filter(x -> !x.getCoverVoList().isEmpty()).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+}
|