|
@@ -1,10 +1,16 @@
|
|
|
package com.yonge.cooleshow.admin.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
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.microsvc.toolkit.common.response.template.R;
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.Employee;
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.SysUser;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.TenantUnbindHistory;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.EmployeeService;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.SysUserService;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.TenantStaffService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.TenantUnbindHistoryService;
|
|
|
import com.yonge.cooleshow.biz.dal.wrapper.TenantUnbindHistoryWrapper;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -17,6 +23,13 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import javax.jws.Oneway;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.function.Function;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
@Slf4j
|
|
|
@Validated
|
|
|
@RestController
|
|
@@ -27,12 +40,31 @@ public class TenantUnbindHistoryController {
|
|
|
@Autowired
|
|
|
private TenantUnbindHistoryService tenantUnbindHistoryService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SysUserService sysUserService;
|
|
|
+
|
|
|
@ApiOperation(value = "查询分页", notes = "机构解绑历史表- 传入 TenantUnbindHistoryWrapper.TenantUnbindHistoryQuery")
|
|
|
@PostMapping("/page")
|
|
|
- public R<PageInfo<TenantUnbindHistory>> page(@RequestBody TenantUnbindHistoryWrapper.TenantUnbindHistoryQuery query) {
|
|
|
+ public R<PageInfo<TenantUnbindHistoryWrapper.TenantUnbindHistory>> page(@RequestBody TenantUnbindHistoryWrapper.TenantUnbindHistoryQuery query) {
|
|
|
|
|
|
IPage<TenantUnbindHistory> pages = tenantUnbindHistoryService.selectPage(QueryInfo.getPage(query), query);
|
|
|
|
|
|
- return R.from(QueryInfo.pageInfo(pages));
|
|
|
+ List<TenantUnbindHistory> records = pages.getRecords();
|
|
|
+ if (records.isEmpty()) {
|
|
|
+ return R.from(QueryInfo.pageInfo(pages, new ArrayList<>()));
|
|
|
+ }
|
|
|
+ List<Long> userIds =
|
|
|
+ pages.getRecords().stream().map(TenantUnbindHistory::getVerifyUserId).distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ Map<Long, SysUser> mapByIds = sysUserService.getMapByIds(userIds);
|
|
|
+
|
|
|
+ List<TenantUnbindHistoryWrapper.TenantUnbindHistory> histories = records.stream().map(next -> {
|
|
|
+ TenantUnbindHistoryWrapper.TenantUnbindHistory tenantUnbindHistory =
|
|
|
+ JSON.parseObject(JSON.toJSONString(next), TenantUnbindHistoryWrapper.TenantUnbindHistory.class);
|
|
|
+ tenantUnbindHistory.setVerifyUserName(mapByIds.getOrDefault(next.getVerifyUserId(), new SysUser()).getRealName());
|
|
|
+ return tenantUnbindHistory;
|
|
|
+
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return R.from(QueryInfo.pageInfo(pages, histories));
|
|
|
}
|
|
|
}
|