Browse Source

Merge remote-tracking branch 'origin/dev' into pre-production

pre-production
zhenghaoyu 4 days ago
parent
commit
ad51389edb
  1. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java
  2. 6
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java
  3. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSplitOrderTaskService.java
  4. 27
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java

3
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java

@ -7,6 +7,7 @@ import com.logpm.distribution.entity.DistributionSplitOrderAllTaskEntity;
import com.logpm.distribution.entity.DistributionSplitOrderTaskEntity; import com.logpm.distribution.entity.DistributionSplitOrderTaskEntity;
import com.logpm.distribution.service.IDistributionSplitOrderTaskService; import com.logpm.distribution.service.IDistributionSplitOrderTaskService;
import com.logpm.distribution.vo.DistributionSplitOrderAllTaskVO; import com.logpm.distribution.vo.DistributionSplitOrderAllTaskVO;
import com.logpm.distribution.vo.DistributionSplitOrderTaskVO;
import com.logpm.distribution.vo.SplitPackageOrderVO; import com.logpm.distribution.vo.SplitPackageOrderVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -97,7 +98,7 @@ public class DistributionSplitOrderTaskController {
} }
@GetMapping("/task-list") @GetMapping("/task-list")
public R<IPage<DistributionSplitOrderTaskEntity>> taskList(Query query, DistributionSplitTaskSearchDTO distributionSplitTaskSearchDTO) { public R<IPage<DistributionSplitOrderTaskVO>> taskList(Query query, DistributionSplitTaskSearchDTO distributionSplitTaskSearchDTO) {
return distributionSplitOrderTaskService.taskList(query, distributionSplitTaskSearchDTO); return distributionSplitOrderTaskService.taskList(query, distributionSplitTaskSearchDTO);
} }

6
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java

@ -81,6 +81,7 @@ public class DistributionStockArticleClient implements IDistributionStockArticle
String key = orderCode + warehouseId; String key = orderCode + warehouseId;
try{
Boolean exists = bladeRedis.exists(key); Boolean exists = bladeRedis.exists(key);
if(exists){ if(exists){
String idStr = bladeRedis.get(key); String idStr = bladeRedis.get(key);
@ -105,6 +106,11 @@ public class DistributionStockArticleClient implements IDistributionStockArticle
} }
} }
} }
}catch (Exception e){
log.error("#######addData: 保存订单失败",e);
return 0L;
}
} }
@Override @Override

3
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSplitOrderTaskService.java

@ -7,6 +7,7 @@ import com.logpm.distribution.dto.splitOrder.DistributionSplitTaskSearchDTO;
import com.logpm.distribution.entity.DistributionSplitOrderAllTaskEntity; import com.logpm.distribution.entity.DistributionSplitOrderAllTaskEntity;
import com.logpm.distribution.entity.DistributionSplitOrderTaskEntity; import com.logpm.distribution.entity.DistributionSplitOrderTaskEntity;
import com.logpm.distribution.vo.DistributionSplitOrderAllTaskVO; import com.logpm.distribution.vo.DistributionSplitOrderAllTaskVO;
import com.logpm.distribution.vo.DistributionSplitOrderTaskVO;
import com.logpm.distribution.vo.SplitPackageOrderVO; import com.logpm.distribution.vo.SplitPackageOrderVO;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
@ -25,7 +26,7 @@ public interface IDistributionSplitOrderTaskService extends BaseService<Distribu
* @param distributionSplitTaskSearchDTO * @param distributionSplitTaskSearchDTO
* @return * @return
*/ */
R<IPage<DistributionSplitOrderTaskEntity>> taskList(Query query, DistributionSplitTaskSearchDTO distributionSplitTaskSearchDTO); R<IPage<DistributionSplitOrderTaskVO>> taskList(Query query, DistributionSplitTaskSearchDTO distributionSplitTaskSearchDTO);
/** /**
* 拆单总任务 * 拆单总任务

27
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java

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

Loading…
Cancel
Save