添加字段 userAreaName

This commit is contained in:
秦鸿展
2026-05-28 15:49:33 +08:00
parent 54d943ea10
commit 88832114fa
3 changed files with 39 additions and 8 deletions
@@ -5057,7 +5057,7 @@ public class UserApplicationService {
* @date 2024/4/2 10:09
*/
@Transactional(rollbackFor = Exception.class)
public void addCustomer(CustomerDO customerDO){
public UserPo addCustomer(CustomerDO customerDO){
UserDO userDO = new UserDO();
BeanUtils.copyProperties(customerDO, userDO);
userDO.setUserAccount(customerDO.getUserMemberCode());
@@ -5077,7 +5077,10 @@ public class UserApplicationService {
userDO.setRoleCode(roleEntity.getRoleCode());
userDO.setRoleName(roleEntity.getRoleName());
userDO.setUserAuthStatus(1);
addUser(userDO);
UserPo userPo = addUser(userDO);
if (userPo != null && userPo.getUserId() != null) {
userDO.setUserId(userPo.getUserId());
}
if (isWT()) {
//开启仓配一体 同步托运人信息
UserShipperDO userShipperDO = new UserShipperDO();
@@ -5093,6 +5096,10 @@ public class UserApplicationService {
//保存托运人信息
userShipperDomainService.saveUserShipper(userShipperDO);
}
if (userPo == null || userPo.getUserId() == null) {
return userPo;
}
return userDomainService.selectByUserId(userPo.getUserId());
}
/**
@@ -912,8 +912,9 @@ public class UserAPI extends BaseController {
try {
CustomerDO customerDO = new CustomerDO();
BeanUtils.copyProperties(customerDTO,customerDO);
userApplicationService.addCustomer(customerDO);
return AjaxResult.success();
UserPo userPo = userApplicationService.addCustomer(customerDO);
CustomerDTO result = toCustomerDTO(userPo);
return AjaxResult.success(result);
} catch (com.mhd.common.core.exception.ServiceException e) {
e.printStackTrace();
return AjaxResult.error(500, e.getMessage());
@@ -923,6 +924,29 @@ public class UserAPI extends BaseController {
}
}
@Log(title = "用户中台管理-查询", description = "根据用户ID查询货主/供应商/客户详情", businessType = BusinessType.INQUIRE)
@ApiOperation("根据用户ID查询货主、供应商、客户详情")
@GetMapping("/getCustomerInfo/{userId}")
public AjaxResult getCustomerInfo(@PathVariable("userId") Long userId) {
UserPo userPo = userApplicationService.selectByUserId(userId);
return AjaxResult.success(toCustomerDTO(userPo));
}
private CustomerDTO toCustomerDTO(UserPo userPo) {
if (userPo == null) {
return null;
}
CustomerDTO customerDTO = new CustomerDTO();
BeanUtils.copyProperties(userPo, customerDTO);
customerDTO.setUserMemberCode(userPo.getUserMemberCode());
customerDTO.setEmergencyContactPhone(userPo.getUserPhone());
customerDTO.setEmergencyContactName(userPo.getEmergencyContactName());
customerDTO.setUserAreaName(userPo.getUserAreaName());
customerDTO.setUserAreaCountyId(userPo.getUserAreaCountyId());
customerDTO.setUserAreaAddress(userPo.getUserAreaAddress());
return customerDTO;
}
@Log(title = "修改货主、供应商、客户", description ="修改货主、供应商、客户",businessType = BusinessType.UPDATE)
@ApiOperation("修改货主、供应商、客户")
@PostMapping("/updateCustomer")
@@ -31,9 +31,9 @@
a.avatar,
a.user_status,
a.user_email,
a.user_area_county_id,
a.user_area_name,
a.user_area_address,
a.user_area_county_id AS userAreaCountyId,
a.user_area_name AS userAreaName,
a.user_area_address AS userAreaAddress,
a.user_wechat_account,
a.user_wechat_openid,
a.user_wechat_session_key,
@@ -755,7 +755,7 @@
</select>
<select id="findAllShipperInfo" resultType="com.mhd.user.interfaces.vo.QueryAllShipperInfoVo">
SELECT u.user_id, u.user_name, u.user_area_address, u.user_area_county_id, u.user_area_name ,u.user_phone,u.has_default_address,b.shipper_id,b.shipper_enterprise_name,u.DOCUMENT_PREPARER_NC_CODE,b.CUSTOMER_NC_CODE,u.organization_id AS organizationId,u.top_organization_id AS topOrganizationId,
SELECT u.user_id, u.user_name, u.user_area_address AS userAreaAddress, u.user_area_county_id AS userAreaCountyId, u.user_area_name AS userAreaName,u.user_phone,u.has_default_address,b.shipper_id,b.shipper_enterprise_name,u.DOCUMENT_PREPARER_NC_CODE,b.CUSTOMER_NC_CODE,u.organization_id AS organizationId,u.top_organization_id AS topOrganizationId,
b.settlement_currency AS settlementCurrency
FROM "USER" u
LEFT JOIN user_shipper b ON u.user_id = b.user_id