|
|
@@ -1,9 +1,12 @@
|
|
|
package com.xjrsoft.module.oa.controller;
|
|
|
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
+import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
import com.xjrsoft.common.annotation.XjrLog;
|
|
|
import com.xjrsoft.common.model.result.RT;
|
|
|
import com.xjrsoft.common.page.ConventPage;
|
|
|
@@ -13,9 +16,17 @@ import com.xjrsoft.module.oa.dto.AddOfficialDocumentReceivedDto;
|
|
|
import com.xjrsoft.module.oa.dto.OfficialDocumentReceivedPageDto;
|
|
|
import com.xjrsoft.module.oa.dto.UpdateOfficialDocumentReceivedDto;
|
|
|
import com.xjrsoft.module.oa.entity.OfficialDocumentReceived;
|
|
|
+import com.xjrsoft.module.oa.entity.OfficialDocumentReceivedHandle;
|
|
|
+import com.xjrsoft.module.oa.service.IOfficialDocumentReceivedHandleService;
|
|
|
import com.xjrsoft.module.oa.service.IOfficialDocumentReceivedService;
|
|
|
import com.xjrsoft.module.oa.vo.OfficialDocumentReceivedPageVo;
|
|
|
import com.xjrsoft.module.oa.vo.OfficialDocumentReceivedVo;
|
|
|
+import com.xjrsoft.module.organization.entity.User;
|
|
|
+import com.xjrsoft.module.organization.service.IUserService;
|
|
|
+import com.xjrsoft.module.system.entity.DictionaryDetail;
|
|
|
+import com.xjrsoft.module.system.entity.DictionaryItem;
|
|
|
+import com.xjrsoft.module.system.service.IDictionarydetailService;
|
|
|
+import com.xjrsoft.module.teacher.entity.XjrUser;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
@@ -30,6 +41,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @title: 公文收文
|
|
|
@@ -43,8 +56,10 @@ import java.util.List;
|
|
|
@AllArgsConstructor
|
|
|
public class OfficialDocumentReceivedController {
|
|
|
|
|
|
-
|
|
|
+ private final IDictionarydetailService dictionarydetailService;
|
|
|
private final IOfficialDocumentReceivedService officialDocumentReceivedService;
|
|
|
+ private final IOfficialDocumentReceivedHandleService officialDocumentReceivedHandleService;
|
|
|
+ private final IUserService userService;
|
|
|
|
|
|
@GetMapping(value = "/page")
|
|
|
@ApiOperation(value = "公文收文列表(分页)")
|
|
|
@@ -70,7 +85,47 @@ public class OfficialDocumentReceivedController {
|
|
|
if (officialDocumentReceived == null) {
|
|
|
return RT.error("找不到此数据!");
|
|
|
}
|
|
|
- return RT.ok(BeanUtil.toBean(officialDocumentReceived, OfficialDocumentReceivedVo.class));
|
|
|
+ List<DictionaryDetail> dictionaryDetails = dictionarydetailService.list(
|
|
|
+ new MPJLambdaWrapper<DictionaryDetail>()
|
|
|
+ .select(DictionaryDetail::getId)
|
|
|
+ .select(DictionaryDetail.class, x -> VoToColumnUtil.fieldsToColumns(DictionaryDetail.class).contains(x.getProperty()))
|
|
|
+ .innerJoin(DictionaryItem.class, DictionaryItem::getId, DictionaryDetail::getItemId)
|
|
|
+ .eq(DictionaryItem::getCode, "received_type")
|
|
|
+ );
|
|
|
+ Map<String, String> dictionaryMaps = dictionaryDetails.stream().collect(Collectors.toMap(DictionaryDetail::getCode, DictionaryDetail::getName));
|
|
|
+ OfficialDocumentReceivedVo bean = BeanUtil.toBean(officialDocumentReceived, OfficialDocumentReceivedVo.class);
|
|
|
+ bean.setReceivedTypeCn(dictionaryMaps.get(officialDocumentReceived.getReceivedType()));
|
|
|
+
|
|
|
+ if(officialDocumentReceived.getHandleDutyUserId() != null){
|
|
|
+ User handleDutyUser = userService.getById(officialDocumentReceived.getHandleDutyUserId());
|
|
|
+ bean.setHandleDutyUserName(handleDutyUser.getName());
|
|
|
+ }
|
|
|
+
|
|
|
+ List<User> userList = userService.list(
|
|
|
+ new MPJLambdaWrapper<User>()
|
|
|
+ .select(User::getId)
|
|
|
+ .select(User.class, x -> VoToColumnUtil.fieldsToColumns(User.class).contains(x.getProperty()))
|
|
|
+ .innerJoin(OfficialDocumentReceivedHandle.class, OfficialDocumentReceivedHandle::getReceiveUserId, User::getId)
|
|
|
+ .eq(OfficialDocumentReceivedHandle::getOfficialDocumentReceivedId, officialDocumentReceived.getId())
|
|
|
+ .orderByAsc(OfficialDocumentReceivedHandle::getCreateDate)
|
|
|
+ );
|
|
|
+ if(!userList.isEmpty()){
|
|
|
+ List<String> collect = userList.stream().map(User::getName).collect(Collectors.toList());
|
|
|
+ bean.setReceiveUserNames(collect.toString().replace("[", "").replace("]", "").replace(", ", ">"));
|
|
|
+ }
|
|
|
+
|
|
|
+ long count = officialDocumentReceivedHandleService.count(
|
|
|
+ new QueryWrapper<OfficialDocumentReceivedHandle>().lambda()
|
|
|
+ .eq(OfficialDocumentReceivedHandle::getOfficialDocumentReceivedId, officialDocumentReceived.getId())
|
|
|
+ .eq(OfficialDocumentReceivedHandle::getCreateUserId, StpUtil.getLoginIdAsLong())
|
|
|
+ );
|
|
|
+ if(count > 0){
|
|
|
+ bean.setIsTransfer(1);
|
|
|
+ }else{
|
|
|
+ bean.setIsTransfer(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ return RT.ok(bean);
|
|
|
}
|
|
|
|
|
|
|