查询客户nc编码

This commit is contained in:
zhaoqing
2026-06-02 11:42:35 +08:00
parent 3c25329187
commit 047335ccbb
9 changed files with 97 additions and 3 deletions
@@ -214,4 +214,7 @@ public interface UserServiceFeign {
@RequestParam(value = "pushTime", required = false) String pushTime,
@RequestParam(value = "pushBy", required = false) Long pushBy,
@RequestParam(value = "pushByName", required = false) String pushByName);
@PostMapping("/userShipperApi/getCustomerNcCodeBatch")
AjaxResult getCustomerNcCodeBatch(@RequestBody List<Long> shipperIdList);
}
@@ -206,6 +206,11 @@ public class RemoteUserFeignFallbackFactory implements FallbackFactory<UserServi
public AjaxResult<?> updatePushStatus(Long shipperId, Integer pushStatus, String pushTime, Long pushBy, String pushByName) {
return AjaxResult.error("更新失败" + throwable.getMessage());
}
@Override
public AjaxResult getCustomerNcCodeBatch(List<Long> shipperIdList) {
return AjaxResult.error("更新失败" + throwable.getMessage());
}
};
}
}
@@ -50,6 +50,7 @@ import com.mhd.user.domain.roleAggregate.service.RoleMenuDomainService;
import com.mhd.user.domain.userAggregate.entity.*;
import com.mhd.user.domain.userAggregate.factory.UserFactory;
import com.mhd.user.domain.userAggregate.repository.mapper.UserMapper;
import com.mhd.user.domain.userAggregate.repository.mapper.UserShipperMapper;
import com.mhd.user.domain.userAggregate.repository.po.*;
import com.mhd.user.domain.userAggregate.repository.po.UserAuthInfoPo;
import com.mhd.user.domain.userAggregate.repository.po.UserAuthPo;
@@ -210,6 +211,8 @@ public class UserApplicationService {
@Qualifier("tokenService")
@Autowired
private TokenService tokenService;
@Autowired
private UserShipperMapper userShipperMapper;
/**
* @Description 查询用户列表
@@ -5325,4 +5328,8 @@ public class UserApplicationService {
BeanUtils.copyProperties(customerDO, userDO);
userDomainService.updateUser(userDO);
}
public String getCustomerNcCode(Long shipperId) {
return userShipperMapper.getCustomerNcCode(shipperId);
}
}
@@ -6,6 +6,7 @@ import com.mhd.user.domain.userAggregate.entity.UserShipperEntity;
import com.mhd.user.domain.userAggregate.repository.todo.UserShipperDO;
import com.mhd.user.domain.userAggregate.repository.po.UserShipperPo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.Date;
import java.util.List;
@@ -36,4 +37,7 @@ public interface UserShipperMapper extends BaseMapper<UserShipperEntity> {
* @return
*/
int updatePushStatus(UserShipperEntity userShipper);
@Select("select customer_nc_code from user_shipper where user_id = #{shipperId}")
String getCustomerNcCode(@Param("shipperId") Long shipperId);
}
@@ -25,8 +25,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.*;
@Api(tags = "用户中台管理-托运人管理")
@Slf4j
@@ -268,4 +267,25 @@ public class UserShipperAPI extends BaseController {
return getDataTable(list);
}
@Log(title = "托运人管理-查询", description ="查询托运人列表",businessType = BusinessType.INQUIRE)
@ApiOperation("查询托运人列表")
@GetMapping("/userShipperList2")
public TableDataInfo userShipperList2(UserShipperDTO userShipperDTO) {
//转换实体
UserShipperDO userShipperDO = userShipperAssember.toUserShipperDO(userShipperDTO);
List<UserShipperPo> list = userShipperApplicationService.userShipperList(userShipperDO);
return getDataTable(list);
}
@PostMapping("/getCustomerNcCodeBatch")
public AjaxResult getCustomerNcCodeBatch(@RequestBody List<Long> shipperIdList){
Map<Long, String> resultMap = new HashMap<>();
if (shipperIdList != null && !shipperIdList.isEmpty()) {
for (Long shipperId : shipperIdList) {
String ncCode = userApplicationService.getCustomerNcCode(shipperId);
resultMap.put(shipperId, ncCode);
}
}
return AjaxResult.success(resultMap);
}
}
@@ -449,4 +449,6 @@ public class ReservationStockInOrderPO extends BaseVOEntity {
@Excel(name = "附件url")
private String pictureUrl;
@ApiModelProperty("NC客户编码")
private String customerNcCode;
}
@@ -447,4 +447,7 @@ public class ReservationStockInOrderDO extends BaseVOEntity {
@ApiModelProperty("附件url")
@Excel(name = "附件url")
private String pictureUrl;
@ApiModelProperty("NC客户编码")
private String customerNcCode;
}
@@ -445,4 +445,8 @@ public class ReservationStockInOrderDTO extends ReservationStockInOrderBaseDTO {
@ApiModelProperty("附件url")
@Excel(name = "附件url")
private String pictureUrl;
@ApiModelProperty("NC客户编码")
private String customerNcCode;
}
@@ -56,6 +56,7 @@ import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* 入库单ApplicationService
@@ -2158,7 +2159,52 @@ public class ReservationStockInOrderApplicationService {
// }
// }
// }
return stockInOrderDomainService.queryList(stockInOrderDO);
// 查询订单列表
List<ReservationStockInOrderPO> list = stockInOrderDomainService.queryList(stockInOrderDO);
// ====== 批量查询NC客户编码 ======
Set<Long> shipperIdSet = list.stream()
.map(ReservationStockInOrderPO::getShipperId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
Map<Long, String> ncCodeMap = new HashMap<>();
if (!shipperIdSet.isEmpty()) {
try {
AjaxResult result = userServiceFeign.getCustomerNcCodeBatch(new ArrayList<>(shipperIdSet));
if (result != null && "200".equals(String.valueOf(result.get("code")))) {
Map<?, ?> dataMap = (Map<?, ?>) result.get("data");
if (dataMap != null) {
for (Map.Entry<?, ?> entry : dataMap.entrySet()) {
Long key = Long.valueOf(entry.getKey().toString());
String value = entry.getValue() != null ? entry.getValue().toString() : null;
ncCodeMap.put(key, value);
}
}
}
} catch (Exception e) {
log.error("批量查询NC客户编码失败", e);
}
}
// 前端传入的NC编码
String filterNcCode = stockInOrderDO.getCustomerNcCode();
// 设置NC编码并过滤
List<ReservationStockInOrderPO> filteredList = new ArrayList<>();
for (ReservationStockInOrderPO po : list) {
String ncCode = ncCodeMap.get(po.getShipperId());
po.setCustomerNcCode(ncCode);
// 如果前端传了NC编码判断是否一致
if (filterNcCode != null && !filterNcCode.equals(ncCode)) {
continue;
}
filteredList.add(po);
}
return filteredList;
}
}