oms发单
This commit is contained in:
+16
@@ -1161,4 +1161,20 @@ public class UserShipperApplicationService {
|
||||
public com.mhd.common.core.domain.po.UserShipperPo getShipperSummaryData(Long userId) {
|
||||
return userShipperDomainService.getShipperSummaryData(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID查询货主信息
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 货主信息
|
||||
*/
|
||||
public UserShipperPo getShipperByUserId(Long userId) {
|
||||
// 参数校验
|
||||
if (userId == null || userId <= 0) {
|
||||
throw new IllegalArgumentException("用户ID不能为空");
|
||||
}
|
||||
|
||||
// 根据userId查询货主信息
|
||||
return userShipperDomainService.selectByUserId(userId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,4 +205,34 @@ public class UserShipperAPI extends BaseController {
|
||||
public AjaxResult<?> getShipperSummaryData(@PathVariable Long userId) {
|
||||
return AjaxResult.success(userShipperApplicationService.getShipperSummaryData(userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID查询货主信息
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 货主信息
|
||||
*/
|
||||
@ApiOperation("根据用户ID查询货主信息")
|
||||
@GetMapping("/getShipperByUserId/{userId}")
|
||||
public AjaxResult<?> getShipperByUserId(@PathVariable("userId") Long userId) {
|
||||
try {
|
||||
// 参数校验
|
||||
if (userId == null || userId <= 0) {
|
||||
return AjaxResult.error("用户ID不能为空");
|
||||
}
|
||||
|
||||
// 调用服务层方法查询货主信息
|
||||
UserShipperPo userShipperPo = userShipperApplicationService.getShipperByUserId(userId);
|
||||
|
||||
if (userShipperPo != null) {
|
||||
return AjaxResult.success(userShipperPo);
|
||||
} else {
|
||||
return AjaxResult.error("未找到对应的货主信息");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("根据用户ID查询货主信息异常,userId:{}", userId, e);
|
||||
return AjaxResult.error("查询货主信息失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user