|
|
|
@ -42,7 +42,9 @@ import org.springblade.core.redis.lock.LockType;
|
|
|
|
|
import org.springblade.core.redis.lock.RedisLockClient; |
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.system.cache.UserCache; |
|
|
|
|
import org.springblade.system.entity.User; |
|
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
|
import org.springblade.system.feign.IUserClient; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
@ -67,7 +69,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R<IPage<DistributionSplitOrderTaskEntity>> taskList(Query query, DistributionSplitTaskSearchDTO distributionSplitTaskSearchDTO) { |
|
|
|
|
public R<IPage<DistributionSplitOrderTaskVO>> taskList(Query query, DistributionSplitTaskSearchDTO distributionSplitTaskSearchDTO) { |
|
|
|
|
LambdaQueryWrapper<DistributionSplitOrderTaskEntity> queryWrapper = Wrappers.lambdaQuery(); |
|
|
|
|
if (distributionSplitTaskSearchDTO.getSplitOrderAllTaskId() != null) { |
|
|
|
|
queryWrapper.eq(DistributionSplitOrderTaskEntity::getSplitOrderAllTaskId, distributionSplitTaskSearchDTO.getSplitOrderAllTaskId()); |
|
|
|
@ -91,24 +93,28 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
|
|
|
|
|
IPage<DistributionSplitOrderTaskEntity> page = Condition.getPage(query); |
|
|
|
|
IPage<DistributionSplitOrderTaskVO> pageRes = Condition.getPage(query); |
|
|
|
|
List<DistributionSplitOrderTaskEntity> list = list(page, queryWrapper); |
|
|
|
|
|
|
|
|
|
List<DistributionSplitOrderTaskVO> listVo = new ArrayList<>(); |
|
|
|
|
if (list != null && !list.isEmpty()) { |
|
|
|
|
Map<Long, String> userIdNameMap = getUserIdNameMap(list.stream().map(DistributionSplitOrderTaskEntity::getCreateUser).collect(Collectors.toList())); |
|
|
|
|
|
|
|
|
|
pageRes.setRecords(list.stream().map(item -> { |
|
|
|
|
listVo = list.stream().map(item -> { |
|
|
|
|
DistributionSplitOrderTaskVO distributionSplitOrderTaskVO = new DistributionSplitOrderTaskVO(); |
|
|
|
|
BeanUtil.copyProperties(item, distributionSplitOrderTaskVO); |
|
|
|
|
distributionSplitOrderTaskVO.setCreateUserName(userIdNameMap.get(item.getCreateUser())); |
|
|
|
|
return distributionSplitOrderTaskVO; |
|
|
|
|
}).collect(Collectors.toList())); |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pageRes.setRecords(listVo); |
|
|
|
|
pageRes.setPages(page.getPages()); |
|
|
|
|
pageRes.setTotal(page.getTotal()); |
|
|
|
|
|
|
|
|
|
return R.data(page); |
|
|
|
|
return R.data(pageRes); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Map<Long, String> getUserIdNameMap(List<Long> list) { |
|
|
|
|
String createUserIds = list.stream().map((d) -> d + "").collect(Collectors.joining(",")); |
|
|
|
|
List<User> users = iUserClient.userInfoByIds(AuthUtil.getTenantId(), String.join(",", createUserIds)).getData(); |
|
|
|
|
List<User> users = iUserClient.userInfoByIds(AuthUtil.getTenantId(), createUserIds).getData(); |
|
|
|
|
return users.stream().collect(Collectors.toMap(User::getId, User::getName)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -716,7 +722,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
|
|
|
|
|
@Override |
|
|
|
|
public R<String> cancelTask(Long taskId) { |
|
|
|
|
DistributionSplitOrderTaskEntity task = getById(taskId); |
|
|
|
|
if (!task.getState().equals(OrderSplitStateConstant.InProgress.getValue())) { |
|
|
|
|
if (!task.getState().equals(OrderSplitStateConstant.finish.getValue())) { |
|
|
|
|
return R.fail("任务未已完成,无法操作"); |
|
|
|
|
} |
|
|
|
|
DistributionSplitOrderAllTaskEntity allTask = distributionSplitOrderAllTaskService.getById(task.getSplitOrderAllTaskId()); |
|
|
|
@ -903,16 +909,18 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<DistributionSplitOrderAllTaskEntity> list = distributionSplitOrderAllTaskService.list(page, queryWrapper); |
|
|
|
|
|
|
|
|
|
List<DistributionSplitOrderAllTaskVO> listVo = new ArrayList<>(); |
|
|
|
|
if (list != null && !list.isEmpty()) { |
|
|
|
|
Map<Long, String> userMap = getUserIdNameMap(list.stream().map(DistributionSplitOrderAllTaskEntity::getCreateUser).collect(Collectors.toList())); |
|
|
|
|
Map<Long, Long> allTaskIdPackageNumber = getAllTaskIdPackageNumber(list.stream().map(DistributionSplitOrderAllTaskEntity::getId).collect(Collectors.toList())); |
|
|
|
|
List<DistributionSplitOrderAllTaskVO> listVo = list.stream().map(d -> { |
|
|
|
|
listVo = list.stream().map(d -> { |
|
|
|
|
DistributionSplitOrderAllTaskVO vo = new DistributionSplitOrderAllTaskVO(); |
|
|
|
|
BeanUtil.copyProperties(d, vo); |
|
|
|
|
vo.setCreateUserName(userMap.get(d.getCreateUser())); |
|
|
|
|
vo.setSplitPackageNumber(allTaskIdPackageNumber.get(d.getId())); |
|
|
|
|
return vo; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pageResult.setRecords(listVo); |
|
|
|
|
pageResult.setPages(page.getPages()); |
|
|
|
@ -949,6 +957,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
|
|
|
|
|
|
|
|
|
|
res.put("packageList", PackageOrderList.getData()); |
|
|
|
|
res.put("logList", logList); |
|
|
|
|
res.put("info", getById(taskId)); |
|
|
|
|
|
|
|
|
|
return R.data(res); |
|
|
|
|
} |
|
|
|
|