Jelajahi Sumber

8.15 个人中心基础功能相关

Mechrevo 2 tahun lalu
induk
melakukan
e45f63e747
21 mengubah file dengan 387 tambahan dan 32 penghapusan
  1. 2 1
      sp-core/sp-api/src/main/java/com/pj/api/client/level_one_server/LevelOneServerInterface.java
  2. 4 0
      sp-core/sp-api/src/main/java/com/pj/api/client/level_two_server/LevelTwoServerInterface.java
  3. 7 0
      sp-core/sp-api/src/main/java/com/pj/api/client/level_two_server/LevelTwoServerInterfaceFallback.java
  4. 9 0
      sp-core/sp-api/src/main/java/com/pj/api/client/transport/TransportInterface.java
  5. 15 0
      sp-core/sp-api/src/main/java/com/pj/api/client/transport/TransportInterfaceFallback.java
  6. 57 0
      sp-core/sp-api/src/main/java/com/pj/api/dto/EnterpriseDto.java
  7. 41 0
      sp-core/sp-api/src/main/java/com/pj/api/dto/PurchaserDto.java
  8. 10 0
      sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterprise.java
  9. 1 1
      sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseAppController.java
  10. 1 1
      sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseService.java
  11. 2 1
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_transit/TbGoodsTransitService.java
  12. 0 1
      sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrder.java
  13. 6 0
      sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/TbPurchaser.java
  14. 13 10
      sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/TbPurchaserAppController.java
  15. 8 0
      sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/TbPurchaserService.java
  16. 19 3
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserApiController.java
  17. 28 2
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserService.java
  18. 90 12
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/MethodAppUserService.java
  19. 56 0
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/vo/AppUserVo.java
  20. 10 0
      sp-service/transport-server/src/main/java/com/pj/project/tb_driver/TbDriverAppController.java
  21. 8 0
      sp-service/transport-server/src/main/java/com/pj/project/tb_driver/TbDriverService.java

+ 2 - 1
sp-core/sp-api/src/main/java/com/pj/api/client/level_one_server/LevelOneServerInterface.java

@@ -28,7 +28,7 @@ public interface LevelOneServerInterface {
 
     /** 根据ID获取一级市场商户信息 */
     @RequestMapping("/app/TbEnterprise/rpc/getEnterpriseById")
-    public EnterpriseDto getEnterpriseById(@RequestParam("enterpriseId")Long enterpriseId);
+    public EnterpriseDto getEnterpriseById(@RequestParam("id")Long enterpriseId);
 
     /** 根据商户ID和过审商品表ID查询过审商品 */
     @RequestMapping("/app/TbGoodsTransit/rpc/getGoodsTransitById")
@@ -38,6 +38,7 @@ public interface LevelOneServerInterface {
     @RequestMapping("/app/TbOrder/rpc/getOrderDtoById")
     public OrderDto getOrderDtoById(@RequestParam("orderId") Long orderId);
 
+    /** 根据当前天时间和appUserId查询订单记录 */
     @RequestMapping("/app/TbOrder/rpc/selectOrderList")
     public List<OrderDto> selectOrderList(@RequestParam("currDay") Date currDay, @RequestParam("appUserId") Long appUserId);
 

+ 4 - 0
sp-core/sp-api/src/main/java/com/pj/api/client/level_two_server/LevelTwoServerInterface.java

@@ -6,6 +6,7 @@ import com.pj.api.dto.PurchaserDto;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 
 /**
  * @Author Mechrevo
@@ -18,6 +19,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
 )
 public interface LevelTwoServerInterface {
 
+    @RequestMapping("/app/TbPurchaser/rpc/getByPurchaserId")
+    public PurchaserDto getByPurchaserId(@RequestParam("id") Long id);
+
     /** 添加国内收购商信息 */
     @RequestMapping("/TbPurchaser/purchaserDto")
     public boolean purchaserDto(@RequestBody PurchaserDto purchaserDto);

+ 7 - 0
sp-core/sp-api/src/main/java/com/pj/api/client/level_two_server/LevelTwoServerInterfaceFallback.java

@@ -20,6 +20,13 @@ public class LevelTwoServerInterfaceFallback implements FallbackFactory<LevelTwo
     public LevelTwoServerInterface create(Throwable throwable) {
         return new LevelTwoServerInterface() {
             @Override
+            public PurchaserDto getByPurchaserId(Long id) {
+                System.out.println(throwable.getMessage());
+                log.error("国内商家信息查询错误:{},错误信息是{}",id,throwable.getMessage());
+                return null;
+            }
+
+            @Override
             public boolean purchaserDto(PurchaserDto purchaserDto) {
                 System.out.println(throwable.getMessage());
                 log.error("国内商家信息添加错误:{},错误信息是{}",purchaserDto,throwable.getMessage());

+ 9 - 0
sp-core/sp-api/src/main/java/com/pj/api/client/transport/TransportInterface.java

@@ -3,6 +3,7 @@ package com.pj.api.client.transport;
 import com.pj.api.FeignInterceptor;
 import com.pj.api.consts.FeignConsts;
 import com.pj.api.dto.DriverDto;
+import com.pj.api.dto.PurchaserDto;
 import com.pj.api.dto.TbLogisticsDto;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -20,6 +21,14 @@ import org.springframework.web.bind.annotation.RequestParam;
 )
 public interface TransportInterface {
 
+    /** 根据ID查商户 */
+    @RequestMapping("rpc/getByPurchaserId")
+    public PurchaserDto getByPurchaserId(@RequestParam("id") Long id);
+
+    /** 查司机信息 - 根据id */
+    @RequestMapping("/app/TbDriver/rpc/getById")
+    public DriverDto getByDriverId(@RequestParam("id") Long id);
+
     /** 根据二级订单的ID查询物流信息 */
     @RequestMapping("/TbLogistics/rpc/selectByOrderId")
     public TbLogisticsDto selectByOrderId(@RequestParam("orderId") Long orderId);

+ 15 - 0
sp-core/sp-api/src/main/java/com/pj/api/client/transport/TransportInterfaceFallback.java

@@ -1,6 +1,7 @@
 package com.pj.api.client.transport;
 
 import com.pj.api.dto.DriverDto;
+import com.pj.api.dto.PurchaserDto;
 import com.pj.api.dto.TbLogisticsDto;
 import feign.hystrix.FallbackFactory;
 import org.slf4j.Logger;
@@ -20,6 +21,20 @@ public class TransportInterfaceFallback implements FallbackFactory<TransportInte
     public TransportInterface create(Throwable throwable) {
         return new TransportInterface() {
             @Override
+            public PurchaserDto getByPurchaserId(Long id) {
+                System.out.println(throwable.getMessage());
+                log.error("触发降级熔断机制,id为:{}",id);
+                return null;
+            }
+
+            @Override
+            public DriverDto getByDriverId(Long id) {
+                System.out.println(throwable.getMessage());
+                log.error("触发降级熔断机制,id为:{}",id);
+                return null;
+            }
+
+            @Override
             public TbLogisticsDto selectByOrderId(Long orderId) {
                 System.out.println(throwable.getMessage());
                 log.error("触发降级熔断机制,id为:{}",orderId);

+ 57 - 0
sp-core/sp-api/src/main/java/com/pj/api/dto/EnterpriseDto.java

@@ -16,6 +16,63 @@ public class EnterpriseDto {
      * 名称
      */
     private String name;
+    /**
+     * 年龄
+     */
+    private Integer age;
+    /**
+     * 性别[1=男,2=女]
+     */
+    private Integer sex;
+
+    public EnterpriseDto(String name, Integer age, Integer sex, String nationality, String type, String legalPerson, String idCard, String contact, String businessLicense, Long shopId, String shopName, String bankNo, String bankName, String bankAccount, String dutyParagraph, String addressIds, String address, String agreement, int judgeStatus, String judgeContent, Date judgeTime, Date registerTime, Date createTime, String createBy, String createName, Date updateTime, String updateBy, String updateName, Integer deleteStatus, Integer isLock) {
+        this.name = name;
+        this.age = age;
+        this.sex = sex;
+        this.nationality = nationality;
+        this.type = type;
+        this.legalPerson = legalPerson;
+        this.idCard = idCard;
+        this.contact = contact;
+        this.businessLicense = businessLicense;
+        this.shopId = shopId;
+        this.shopName = shopName;
+        this.bankNo = bankNo;
+        this.bankName = bankName;
+        this.bankAccount = bankAccount;
+        this.dutyParagraph = dutyParagraph;
+        this.addressIds = addressIds;
+        this.address = address;
+        this.agreement = agreement;
+        this.judgeStatus = judgeStatus;
+        this.judgeContent = judgeContent;
+        this.judgeTime = judgeTime;
+        this.registerTime = registerTime;
+        this.createTime = createTime;
+        this.createBy = createBy;
+        this.createName = createName;
+        this.updateTime = updateTime;
+        this.updateBy = updateBy;
+        this.updateName = updateName;
+        this.deleteStatus = deleteStatus;
+        this.isLock = isLock;
+    }
+
+    public Integer getAge() {
+        return age;
+    }
+
+    public void setAge(Integer age) {
+        this.age = age;
+    }
+
+    public Integer getSex() {
+        return sex;
+    }
+
+    public void setSex(Integer sex) {
+        this.sex = sex;
+    }
 
     /**
      * 国别

+ 41 - 0
sp-core/sp-api/src/main/java/com/pj/api/dto/PurchaserDto.java

@@ -17,6 +17,47 @@ public class PurchaserDto {
      */
     private String name;
 
+    public PurchaserDto(String name, Integer age, String legalPerson, String idCard, String contact, String businessLicense, String bankNo, String bankName, String bankAccount, String dutyParagraph, String addressIds, String address, Integer judgeStatus, String judgeContent, Date judgeTime, Date registerTime, String personId, Date createTime, String createBy, String createName, Date updateTime, String updateBy, String updateName, Integer deleteStatus, Integer isLock) {
+        this.name = name;
+        this.age = age;
+        this.legalPerson = legalPerson;
+        this.idCard = idCard;
+        this.contact = contact;
+        this.businessLicense = businessLicense;
+        this.bankNo = bankNo;
+        this.bankName = bankName;
+        this.bankAccount = bankAccount;
+        this.dutyParagraph = dutyParagraph;
+        this.addressIds = addressIds;
+        this.address = address;
+        this.judgeStatus = judgeStatus;
+        this.judgeContent = judgeContent;
+        this.judgeTime = judgeTime;
+        this.registerTime = registerTime;
+        this.personId = personId;
+        this.createTime = createTime;
+        this.createBy = createBy;
+        this.createName = createName;
+        this.updateTime = updateTime;
+        this.updateBy = updateBy;
+        this.updateName = updateName;
+        this.deleteStatus = deleteStatus;
+        this.isLock = isLock;
+    }
+
+    public Integer getAge() {
+        return age;
+    }
+
+    public void setAge(Integer age) {
+        this.age = age;
+    }
+
+    /**
+     * 年龄
+     */
+    private Integer age;
+
     /**
      * 法人
      */

+ 10 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterprise.java

@@ -129,6 +129,16 @@ public class TbEnterprise extends Model<TbEnterprise> implements Serializable {
 	private String detail;
 
 	/**
+	 * 年龄
+	 */
+	private Integer age;
+
+	/**
+	 * 性别[1=男,2=女]
+	 */
+	private Integer sex;
+
+	/**
 	 *  
 	 */
 	private String agreement;

+ 1 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseAppController.java

@@ -62,7 +62,7 @@ public class TbEnterpriseAppController {
 
 	/** 根据ID获取一级市场商户信息 */
 	@RequestMapping("rpc/getEnterpriseById")
-	public EnterpriseDto getEnterpriseById(@RequestParam("enterpriseId")Long enterpriseId){
+	public EnterpriseDto getEnterpriseById(@RequestParam("id")Long enterpriseId){
 		EnterpriseDto enterpriseById = tbEnterpriseService.getEnterpriseById(enterpriseId);
 		return enterpriseById;
 	}

+ 1 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseService.java

@@ -384,7 +384,7 @@ public class TbEnterpriseService extends ServiceImpl<TbEnterpriseMapper, TbEnter
 
 	/** 远程调用:根据ID获取一级市场商户 */
 	EnterpriseDto getEnterpriseById(Long id) {
-		TbEnterprise enterprise = super.getById(id);
+		TbEnterprise enterprise = tbEnterpriseMapper.selectById(id);
 		EnterpriseDto enterpriseDto = new EnterpriseDto();
 		BeanUtils.copyProperties(enterprise,enterpriseDto);
 		return enterpriseDto;

+ 2 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_goods_transit/TbGoodsTransitService.java

@@ -310,8 +310,9 @@ public class TbGoodsTransitService extends ServiceImpl<TbGoodsTransitMapper, TbG
 		queryWrapper.ne(TbOrder::getEnterpriseConfirm,2);
 		List<TbOrder> orderList = tbOrderMapper.selectList(queryWrapper);
 		if(orderList.size() != 0){
+			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 			TbOrder tbOrder = orderList.get(0);
-			throw new ServiceException("您在 " + tbOrder.getCreateTime() + " 已下单,请勿重复下单。");
+			throw new ServiceException("您在 " + sdf.format(tbOrder.getCreateTime()) + " 已下单,请勿重复下单。");
 		}
 		//执行采购,创建一级市场订单表 , 该方法只是设置tbOrder的属性
 		TbOrder tbOrder = methodGoodsTransitService.setTbOrderProperties(tbGoodsTransit, appLoginInfo);

+ 0 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrder.java

@@ -286,7 +286,6 @@ public class TbOrder extends Model<TbOrder> implements Serializable {
 	/**
 	 * 创建时间
 	 */
-	@JsonFormat(pattern = "yyyy-MM-dd")
 	private Date createTime;
 
 	/**

+ 6 - 0
sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/TbPurchaser.java

@@ -125,6 +125,12 @@ public class TbPurchaser extends Model<TbPurchaser> implements Serializable {
 	private Integer judgeStatus;
 
 	/**
+	 * 年龄
+	 */
+	@Excel(name = "年龄")
+	private Integer age;
+
+	/**
 	 * 审核意见
 	 */
 	@Excel(name = "审核意见")

+ 13 - 10
sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/TbPurchaserAppController.java

@@ -1,20 +1,12 @@
 package com.pj.tb_purchaser;
 
-import cn.dev33.satoken.annotation.SaCheckPermission;
-import com.pj.common.core.utils.poi.ExcelUtil;
-import com.pj.project4sp.SP;
+import com.pj.api.dto.PurchaserDto;
 import com.pj.utils.sg.AjaxJson;
-import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.multipart.MultipartFile;
 
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.List;
 
 
 /**
@@ -52,6 +44,17 @@ public class TbPurchaserAppController {
 		return AjaxJson.getSuccess("收购商认证信息已提交,管理员审核中,请耐心等待!");
 	}
 
-
+	/*------            正常业务👆👆    rpc远程调用👇👇                         -----------*/
+
+	/**
+	 * 根据ID查商户
+	 * @param id
+	 * @return
+	 */
+	@RequestMapping("rpc/getByPurchaserId")
+	public PurchaserDto getByPurchaserId(@RequestParam("id") Long id){
+		PurchaserDto byPurchaserId = tbPurchaserService.getByPurchaserId(id);
+		return byPurchaserId;
+	}
 
 }

+ 8 - 0
sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/TbPurchaserService.java

@@ -271,4 +271,12 @@ public class TbPurchaserService extends ServiceImpl<TbPurchaserMapper, TbPurchas
 		boolean save = this.save(tbPurchaser);
 		return save;
 	}
+
+	/** 远程调用方法 根据ID查询国内收购商*/
+	public PurchaserDto getByPurchaserId(Long id){
+		TbPurchaser byId = getById(id);
+		PurchaserDto purchaserDto = new PurchaserDto();
+		BeanUtils.copyProperties(byId,purchaserDto);
+		return purchaserDto;
+	}
 }

+ 19 - 3
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserApiController.java

@@ -1,7 +1,9 @@
 package com.pj.project.app_user;
 
+import com.pj.current.satoken.StpAPPUserUtil;
 import com.pj.project.app_user.dto.ForgetPasswordDto;
 import com.pj.project.app_user.dto.RegisterDto;
+import com.pj.project.app_user.vo.AppUserVo;
 import com.pj.utils.sg.AjaxJson;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
@@ -9,7 +11,7 @@ import org.springframework.web.bind.annotation.*;
 
 
 /**
- * Controller: app_user -- 移动端账号(只针对app端使用)
+ * app_user -- 移动端账号(只针对app端使用)
  *
  * @author yzs
  */
@@ -24,6 +26,20 @@ public class AppUserApiController {
     AppUserService appUserService;
 
 
+    /** 修改个人信息 */
+    @RequestMapping("update")
+    public AjaxJson update(AppUser a){
+        appUserService.update(a);
+        return AjaxJson.getSuccess();
+    }
+
+    /** 查看个人信息 */
+    @RequestMapping("getSelfInfo")
+    public AjaxJson getById(){
+        AppUserVo a = appUserService.getSelfInfo();
+        return AjaxJson.getSuccessData(a);
+    }
+
     /**
      * 用户注册
      */
@@ -73,8 +89,8 @@ public class AppUserApiController {
      * 修改密码
      */
     @RequestMapping("modifyPassword")
-    public AjaxJson modifyPassword(String olePassword,String newPassword) {
-        boolean result = appUserService.modifyPassword(olePassword, newPassword);
+    public AjaxJson modifyPassword(@RequestParam("oldPassword") String olePassword,@RequestParam("newPassword")String newPassword,@RequestParam("rePassword")String rePassword) {
+        boolean result = appUserService.modifyPassword(olePassword, newPassword,rePassword);
         if (result) return AjaxJson.getSuccess("密码修改成功!");
         return AjaxJson.getError("密码修改失败!");
     }

+ 28 - 2
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserService.java

@@ -19,6 +19,7 @@ import com.pj.enummj.DeleteStatus;
 import com.pj.enummj.IsLock;
 import com.pj.project.app_user.dto.ForgetPasswordDto;
 import com.pj.project.app_user.dto.RegisterDto;
+import com.pj.project.app_user.vo.AppUserVo;
 import com.pj.project.re_role_menu.ReRoleMenu;
 import com.pj.project.re_role_menu.ReRoleMenuMapper;
 import com.pj.retry.SmsRetryService;
@@ -92,6 +93,27 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
 		return super.getById(id);
 	}
 
+	/**
+	 * 个人中心-个人详细信息
+	 * @return
+	 */
+	AppUserVo getSelfInfo(){
+		//查询当前人
+		AppUser appUser = appUserMapper.selectById(StpAPPUserUtil.getAPPLoginInfo().getLoginId());
+		if(appUser == null)throw new ServiceException("当前用户信息异常!");
+		//获取当前组
+		//创建返回值对象
+		AppUserVo appUserVo = new AppUserVo();
+		//根据身份获取不同名称
+		appUserVo.setFk(appUser.getFkId());
+		methodAppUserService.getRoleName(appUserVo,appUser.getUserType());
+		//设置属性
+		appUserVo.setPhone(appUser.getPhone());
+		appUserVo.setName(appUser.getName());
+
+		return appUserVo;
+	}
+
 	/** 查询单个APP有效用户 */
 	public AppUserDto getUserById(Long id){
 		//查单个
@@ -316,15 +338,19 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
 	 * 修改密码
 	 * @param oldPassword 旧密码
 	 * @param newPassword 新密码
+	 * @param rePassword 确认密码
 	 * @return
 	 */
-	public boolean modifyPassword(String oldPassword,String newPassword){
+	public boolean modifyPassword(String oldPassword,String newPassword,String rePassword){
+		//对比新密码和确认密码
+		if(!newPassword.equals(rePassword))throw new ServiceException("新密码和确认密码不一致!");
+
 		//获取user
 		APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
 		AppUser appUser = appUserMapper.selectById(appLoginInfo.getLoginId());
 		if(appUser == null)throw new SecurityException("当前账户信息异常!");
 		//旧密码比对
-		boolean result = passwordEncoder.matches(appUser.getPassword(), oldPassword);
+		boolean result = passwordEncoder.matches(oldPassword,appUser.getPassword());
 		if(!result)throw new SecurityException("旧密码输入错误!");
 		//新密码进行编码
 		String password = passwordEncoder.encode(newPassword);

+ 90 - 12
sp-service/sp-admin/src/main/java/com/pj/project/app_user/MethodAppUserService.java

@@ -3,8 +3,13 @@ package com.pj.project.app_user;
 import com.pj.api.client.level_one_server.LevelOneServerInterface;
 import com.pj.api.client.level_two_server.LevelTwoServerInterface;
 import com.pj.api.client.transport.TransportInterface;
+import com.pj.api.dto.DriverDto;
+import com.pj.api.dto.EnterpriseDto;
 import com.pj.api.dto.PeopleDto;
+import com.pj.api.dto.PurchaserDto;
 import com.pj.common.core.exception.ServiceException;
+import com.pj.project.app_user.vo.AppUserVo;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -34,37 +39,110 @@ public class MethodAppUserService {
      *     (4,"司机"),
      *     (5,"国内收购商");
      */
-    public boolean insertEntity(AppUser appUser,Integer userType){
+    public AppUserVo getRoleName(AppUserVo appUser, Integer userType){
         if(userType == null || userType.toString().trim().equals(""))
-            throw new ServiceException("注册身份选择错误!");
+            throw new ServiceException("身份错误!");
+        //创建返回值对象
+        AppUserVo appUserVo = new AppUserVo();
+        BeanUtils.copyProperties(appUser,appUserVo);
         switch (userType){
             case 1:
-                people(appUser);
+                 appUserVo = setPeopleProperties(appUser);
                 break;
             case 2:
+                 appUserVo = setPeopleProperties(appUser);
                 break;
             case 3:
+                 appUserVo = setEnterprise(appUser);
                 break;
             case 4:
+                appUserVo = setDriver(appUser);
                 break;
             case 5:
+                appUserVo = setPurchaser(appUser);
                 break;
             default:
                 throw new RuntimeException("用户身份选择错误!");
         }
 
 
-        return false;
+        return appUser;
     }
 
-    public void people(AppUser appUser){
-        PeopleDto peopleDto = new PeopleDto();
-        //设置基本信息
-        peopleDto.setPhone(appUser.getPhone());
-        peopleDto.setRegisterTime(appUser.getCreateTime());
-        peopleDto.setName(appUser.getName());
-//        peopleDto.setCode();  // 边民号
-        levelOneServerInterface.peopleDto(peopleDto);
+    /**
+     * 二级市场商户
+     * @param appUser
+     * @return
+     */
+    AppUserVo setPurchaser(AppUserVo appUser){
+        //查询国内收购商
+        PurchaserDto purchaserDto = levelTwoServerInterface.getByPurchaserId(appUser.getFk());
+        if(purchaserDto == null)throw new ServiceException("二级市场商户远程调用失败!");
+        //设置基本属性
+        appUser.setRoleName("国内收购商");
+        appUser.setTradeAreaName("国内");
+        appUser.setGenderName("待填");
+        appUser.setAge(purchaserDto.getAge() + "岁");
+        appUser.setAddress(purchaserDto.getAddress());
+
+        return appUser;
     }
 
+    /**
+     * 司机
+     * @param appUser
+     * @return
+     */
+    AppUserVo setDriver(AppUserVo appUser){
+        //查询货运司机
+        DriverDto driverDto = transportInterface.getByDriverId(appUser.getFk());
+        if(driverDto == null)throw new ServiceException("司机远程调用失败!");
+        //设置基本属性
+        appUser.setRoleName("司机");
+        appUser.setTradeAreaName(driverDto.getTradeAreaName());
+        appUser.setGenderName(driverDto.getSex() == 1? "男" : "女");
+        appUser.setAge(driverDto.getAge() + "岁");
+        appUser.setAddress(driverDto.getAddress());
+        return appUser;
+    }
+
+
+    /**
+     * 商家
+     * @param appUser
+     * @return
+     */
+    AppUserVo setEnterprise(AppUserVo appUser){
+        //查询一级市场商户表
+        EnterpriseDto enterprise = levelOneServerInterface.getEnterpriseById(appUser.getFk());
+        if(enterprise == null)throw new ServiceException("一级市场商户远程调用失败!");
+        //设置基本属性
+        appUser.setRoleName("一级市场商户");
+        appUser.setTradeAreaName("待填");
+        appUser.setGenderName(enterprise.getSex() == 1? "男" : "女");
+        appUser.setAge(enterprise.getAge() + "岁");
+        appUser.setAddress(enterprise.getAddress());
+        return appUser;
+    }
+
+    /**
+     * 边民
+     * @param appUser
+     * @return
+     */
+    AppUserVo setPeopleProperties(AppUserVo appUser){
+        //查询边民表
+        PeopleDto peopleDto = levelOneServerInterface.getRpcById(appUser.getFk());
+        if(peopleDto == null)throw new ServiceException("一级市场边民远程调用失败!");
+        //设置基本属性
+        appUser.setRoleName(peopleDto.getRole() == 1? "普通边民" : "边民组组长");
+        appUser.setTradeAreaName(peopleDto.getTradeAreaName());
+        appUser.setGroupName(peopleDto.getGroupName());
+        appUser.setAge(peopleDto.getAge() + "岁");
+        appUser.setGenderName(peopleDto.getSex() == 1? "男" : "女");
+        appUser.setAddress(peopleDto.getAddress());
+        return appUser;
+    }
+
+
 }

+ 56 - 0
sp-service/sp-admin/src/main/java/com/pj/project/app_user/vo/AppUserVo.java

@@ -0,0 +1,56 @@
+package com.pj.project.app_user.vo;
+
+import lombok.Data;
+
+/**
+ * @Author Mechrevo
+ * @Date 2023 08 14 17 08
+ **/
+@Data
+public class AppUserVo {
+
+    /**
+     * 用户表主键
+     */
+    private Long fk;
+
+    /**
+     * 手机
+     */
+    private String phone;
+
+    /**
+     * 昵称
+     */
+    private String name;
+
+    /**
+     * 互市区名称
+     */
+    private String tradeAreaName;
+
+    /**
+     * 性别
+     */
+    private String genderName;
+
+    /**
+     * 年龄
+     */
+    private String age;
+
+    /**
+     * 互助组名称
+     */
+    private String groupName;
+
+    /**
+     * 角色名称
+     */
+    private String roleName;
+
+    /**
+     * 联系地址
+     */
+    private String address;
+}

+ 10 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_driver/TbDriverAppController.java

@@ -1,5 +1,6 @@
 package com.pj.project.tb_driver;
 
+import com.pj.api.dto.DriverDto;
 import com.pj.project.tb_driver.param.SucessDriverResultParam;
 import com.pj.project.tb_driver.param.FailDriverResultParam;
 import com.pj.utils.sg.AjaxJson;
@@ -59,5 +60,14 @@ public class TbDriverAppController {
 	}
 
 
+	/*--     正常业务方法 👆👆  远程调用 👇👇      --*/
+
+	/** 查司机信息 - 根据id */
+	@RequestMapping("rpc/getById")
+	public DriverDto getByDriverId(@RequestParam("id") Long id){
+		DriverDto t = tbDriverService.getByDriverId(id);
+		return t;
+	}
+
 
 }

+ 8 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_driver/TbDriverService.java

@@ -267,4 +267,12 @@ public class TbDriverService extends ServiceImpl<TbDriverMapper, TbDriver> imple
 		return save;
 	}
 
+	/** 远程调用: 根据ID查询司机信息 */
+	DriverDto getByDriverId(Long id){
+		TbDriver driver = getById(id);
+		DriverDto driverDto = new DriverDto();
+		BeanUtils.copyProperties(driver,driverDto);
+		return driverDto;
+	}
+
 }