Browse Source

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

pre-production
zhenghaoyu 3 days ago
parent
commit
ad51389edb
  1. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java
  2. 42
      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. 53
      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.service.IDistributionSplitOrderTaskService;
import com.logpm.distribution.vo.DistributionSplitOrderAllTaskVO;
import com.logpm.distribution.vo.DistributionSplitOrderTaskVO;
import com.logpm.distribution.vo.SplitPackageOrderVO;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
@ -97,7 +98,7 @@ public class DistributionSplitOrderTaskController {
}
@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);
}

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

@ -81,30 +81,36 @@ public class DistributionStockArticleClient implements IDistributionStockArticle
String key = orderCode + warehouseId;
Boolean exists = bladeRedis.exists(key);
if(exists){
String idStr = bladeRedis.get(key);
if("1".equals(idStr)){
return 1L;
}else{
return Long.valueOf(idStr);
}
}else{
bladeRedis.setEx(key,"1",30L);
DistributionStockArticleEntity distributionStockArticle = distributionStockArticleService.findStockArticleByOrderCodeAndWarehouseId(orderCode, warehouseId);
if(ObjectUtils.isNotEmpty(distributionStockArticle)){
bladeRedis.setEx(key,distributionStockArticle.getId().toString(),30L);
return distributionStockArticle.getId();
try{
Boolean exists = bladeRedis.exists(key);
if(exists){
String idStr = bladeRedis.get(key);
if("1".equals(idStr)){
return 1L;
}else{
return Long.valueOf(idStr);
}
}else{
boolean saveFlag = distributionStockArticleService.save(distributionStockArticleEntity);
if(saveFlag){
bladeRedis.setEx(key,"1",30L);
DistributionStockArticleEntity distributionStockArticle = distributionStockArticleService.findStockArticleByOrderCodeAndWarehouseId(orderCode, warehouseId);
if(ObjectUtils.isNotEmpty(distributionStockArticle)){
bladeRedis.setEx(key,distributionStockArticle.getId().toString(),30L);
return distributionStockArticleEntity.getId();
return distributionStockArticle.getId();
}else{
return 0L;
boolean saveFlag = distributionStockArticleService.save(distributionStockArticleEntity);
if(saveFlag){
bladeRedis.setEx(key,distributionStockArticle.getId().toString(),30L);
return distributionStockArticleEntity.getId();
}else{
return 0L;
}
}
}
}catch (Exception e){
log.error("#######addData: 保存订单失败",e);
return 0L;
}
}
@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.DistributionSplitOrderTaskEntity;
import com.logpm.distribution.vo.DistributionSplitOrderAllTaskVO;
import com.logpm.distribution.vo.DistributionSplitOrderTaskVO;
import com.logpm.distribution.vo.SplitPackageOrderVO;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
@ -25,7 +26,7 @@ public interface IDistributionSplitOrderTaskService extends BaseService<Distribu
* @param distributionSplitTaskSearchDTO
* @return
*/
R<IPage<DistributionSplitOrderTaskEntity>> taskList(Query query, DistributionSplitTaskSearchDTO distributionSplitTaskSearchDTO);
R<IPage<DistributionSplitOrderTaskVO>> taskList(Query query, DistributionSplitTaskSearchDTO distributionSplitTaskSearchDTO);
/**
* 拆单总任务

53
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.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()));
listVo = list.stream().map(item -> {
DistributionSplitOrderTaskVO distributionSplitOrderTaskVO = new DistributionSplitOrderTaskVO();
BeanUtil.copyProperties(item, distributionSplitOrderTaskVO);
distributionSplitOrderTaskVO.setCreateUserName(userIdNameMap.get(item.getCreateUser()));
return distributionSplitOrderTaskVO;
}).collect(Collectors.toList());
}
Map<Long, String> userIdNameMap = getUserIdNameMap(list.stream().map(DistributionSplitOrderTaskEntity::getCreateUser).collect(Collectors.toList()));
pageRes.setRecords(list.stream().map(item -> {
DistributionSplitOrderTaskVO distributionSplitOrderTaskVO = new DistributionSplitOrderTaskVO();
BeanUtil.copyProperties(item, distributionSplitOrderTaskVO);
distributionSplitOrderTaskVO.setCreateUserName(userIdNameMap.get(item.getCreateUser()));
return distributionSplitOrderTaskVO;
}).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);
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 -> {
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());
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()));
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);
}

Loading…
Cancel
Save