123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- package com.wtkj.wrapper;
- import com.wtkj.entity.TaskContractPayLog;
- import com.wtkj.vo.TaskContractPayLogVO;
- import com.wutong.file.feign.IFileClient;
- import com.wutong.file.vo.FileVO;
- import org.springblade.core.mp.support.BaseEntityWrapper;
- import org.springblade.core.tool.api.R;
- import org.springblade.core.tool.utils.BeanUtil;
- import org.springblade.core.tool.utils.Func;
- import org.springblade.core.tool.utils.SpringUtil;
- import org.springblade.core.tool.utils.StringUtil;
- import org.springblade.system.entity.Dept;
- import org.springblade.system.feign.ISysClient;
- import org.springblade.system.user.entity.User;
- import org.springblade.system.user.feign.IUserClient;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Objects;
- /**
- * @author Blizzard
- * @create at 2023-10-12 15:44
- * @describe
- */
- public class TaskContractPayLogWrapper extends BaseEntityWrapper<TaskContractPayLog, TaskContractPayLogVO> {
- private static IFileClient fileClient;
- private static ISysClient sysClient;
- private static IUserClient userClient;
- public static TaskContractPayLogWrapper build() {
- fileClient = SpringUtil.getBean(IFileClient.class);
- sysClient = SpringUtil.getBean(ISysClient.class);
- userClient = SpringUtil.getBean(IUserClient.class);
- return new TaskContractPayLogWrapper();
- }
- @Override
- public TaskContractPayLogVO entityVO(TaskContractPayLog entity) {
- TaskContractPayLogVO vo = Objects.requireNonNull(BeanUtil.copy(entity, TaskContractPayLogVO.class));
- String bladeFileIds = entity.getBladeFileIds();
- if (StringUtil.isNotBlank(bladeFileIds)) {
- List<FileVO> fileVOS = new ArrayList<>();
- List<Long> fileIds = Func.toLongList(bladeFileIds);
- fileIds.forEach(fileId -> {
- R<FileVO> rpc = fileClient.findById(fileId);
- if (rpc.isSuccess()) {
- fileVOS.add(rpc.getData());
- }
- });
- vo.setFiles(fileVOS);
- }
- Long createDept = entity.getCreateDept();
- R<Dept> deptR = sysClient.getDept(createDept);
- if (deptR.isSuccess()) {
- vo.setCreateDeptName(deptR.getData().getDeptName());
- }
- Long createUser = entity.getCreateUser();
- R<User> userR = userClient.userInfoById(createUser);
- if (userR.isSuccess()) {
- vo.setCreateUserName(userR.getData().getName());
- }
- return vo;
- }
- }
|