TaskContractPayLogWrapper.java 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package com.wtkj.wrapper;
  2. import com.wtkj.entity.TaskContractPayLog;
  3. import com.wtkj.vo.TaskContractPayLogVO;
  4. import com.wutong.file.feign.IFileClient;
  5. import com.wutong.file.vo.FileVO;
  6. import org.springblade.core.mp.support.BaseEntityWrapper;
  7. import org.springblade.core.tool.api.R;
  8. import org.springblade.core.tool.utils.BeanUtil;
  9. import org.springblade.core.tool.utils.Func;
  10. import org.springblade.core.tool.utils.SpringUtil;
  11. import org.springblade.core.tool.utils.StringUtil;
  12. import org.springblade.system.entity.Dept;
  13. import org.springblade.system.feign.ISysClient;
  14. import org.springblade.system.user.entity.User;
  15. import org.springblade.system.user.feign.IUserClient;
  16. import java.util.ArrayList;
  17. import java.util.List;
  18. import java.util.Objects;
  19. /**
  20. * @author Blizzard
  21. * @create at 2023-10-12 15:44
  22. * @describe
  23. */
  24. public class TaskContractPayLogWrapper extends BaseEntityWrapper<TaskContractPayLog, TaskContractPayLogVO> {
  25. private static IFileClient fileClient;
  26. private static ISysClient sysClient;
  27. private static IUserClient userClient;
  28. public static TaskContractPayLogWrapper build() {
  29. fileClient = SpringUtil.getBean(IFileClient.class);
  30. sysClient = SpringUtil.getBean(ISysClient.class);
  31. userClient = SpringUtil.getBean(IUserClient.class);
  32. return new TaskContractPayLogWrapper();
  33. }
  34. @Override
  35. public TaskContractPayLogVO entityVO(TaskContractPayLog entity) {
  36. TaskContractPayLogVO vo = Objects.requireNonNull(BeanUtil.copy(entity, TaskContractPayLogVO.class));
  37. String bladeFileIds = entity.getBladeFileIds();
  38. if (StringUtil.isNotBlank(bladeFileIds)) {
  39. List<FileVO> fileVOS = new ArrayList<>();
  40. List<Long> fileIds = Func.toLongList(bladeFileIds);
  41. fileIds.forEach(fileId -> {
  42. R<FileVO> rpc = fileClient.findById(fileId);
  43. if (rpc.isSuccess()) {
  44. fileVOS.add(rpc.getData());
  45. }
  46. });
  47. vo.setFiles(fileVOS);
  48. }
  49. Long createDept = entity.getCreateDept();
  50. R<Dept> deptR = sysClient.getDept(createDept);
  51. if (deptR.isSuccess()) {
  52. vo.setCreateDeptName(deptR.getData().getDeptName());
  53. }
  54. Long createUser = entity.getCreateUser();
  55. R<User> userR = userClient.userInfoById(createUser);
  56. if (userR.isSuccess()) {
  57. vo.setCreateUserName(userR.getData().getName());
  58. }
  59. return vo;
  60. }
  61. }