|
@@ -0,0 +1,74 @@
|
|
|
+package com.yonge.cooleshow.admin.controller;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.microsvc.toolkit.common.response.paging.PageInfo;
|
|
|
+import com.microsvc.toolkit.common.response.paging.QueryInfo;
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.SysArea;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.SysAreaService;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.TenantUnbindRecordService;
|
|
|
+import com.yonge.cooleshow.biz.dal.wrapper.TenantUnbindRecordWrapper;
|
|
|
+import com.yonge.cooleshow.common.controller.BaseController;
|
|
|
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+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.Collection;
|
|
|
+import java.util.HashSet;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@Validated
|
|
|
+@RestController
|
|
|
+@RequestMapping("/tenantUnbindRecord")
|
|
|
+@Api(tags = "机构解绑申请记录")
|
|
|
+public class TenantUnbindRecordController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TenantUnbindRecordService tenantUnbindRecordService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysAreaService sysAreaService;
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询分页", notes = "机构解绑申请记录- 传入 TenantUnbindRecordVo.TenantUnbindRecordQuery")
|
|
|
+ @PostMapping("/page")
|
|
|
+ public HttpResponseResult<PageInfo<TenantUnbindRecordWrapper.TenantUnbindRecord>>
|
|
|
+ page(@RequestBody TenantUnbindRecordWrapper.TenantUnbindRecordQuery query) {
|
|
|
+ // 查询数据
|
|
|
+ IPage<TenantUnbindRecordWrapper.TenantUnbindRecord> pages =
|
|
|
+ tenantUnbindRecordService.selectPage(QueryInfo.getPage(query), query);
|
|
|
+
|
|
|
+
|
|
|
+ List<Integer> areaCodeList = pages.getRecords().stream().map(next -> {
|
|
|
+ HashSet<Integer> areaCodes = new HashSet<>();
|
|
|
+ areaCodes.add(next.getProvinceCode());
|
|
|
+ areaCodes.add(next.getCityCode());
|
|
|
+ areaCodes.add(next.getRegionCode());
|
|
|
+ return areaCodes;
|
|
|
+ }).flatMap(Collection::stream).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
+ if (!areaCodeList.isEmpty()) {
|
|
|
+ Map<Integer, String> codeNameMap = sysAreaService.lambdaQuery().in(SysArea::getCode, areaCodeList).list()
|
|
|
+ .stream().collect(Collectors.toMap(SysArea::getCode, SysArea::getName));
|
|
|
+
|
|
|
+ pages.getRecords().forEach(next -> {
|
|
|
+ next.setProvinceName(codeNameMap.getOrDefault(next.getProvinceCode(), ""));
|
|
|
+ next.setCityName(codeNameMap.getOrDefault(next.getCityCode(), ""));
|
|
|
+ next.setRegionName(codeNameMap.getOrDefault(next.getRegionCode(), ""));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return succeed(QueryInfo.pageInfo(pages, pages.getRecords()));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|