|
|
@ -7,6 +7,8 @@ import java.util.Map; |
|
|
import com.chenhai.common.utils.DictUtils; |
|
|
import com.chenhai.common.utils.DictUtils; |
|
|
import com.chenhai.common.utils.StringUtils; |
|
|
import com.chenhai.common.utils.StringUtils; |
|
|
import com.chenhai.framework.web.service.TokenService; |
|
|
import com.chenhai.framework.web.service.TokenService; |
|
|
|
|
|
import com.chenhai.vet.domain.VetPersonalInfo; |
|
|
|
|
|
import com.chenhai.vet.service.IVetPersonalInfoService; |
|
|
import jakarta.servlet.http.HttpServletResponse; |
|
|
import jakarta.servlet.http.HttpServletResponse; |
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -54,6 +56,9 @@ public class MuhuUserController extends BaseController |
|
|
@Autowired |
|
|
@Autowired |
|
|
private TokenService tokenService; |
|
|
private TokenService tokenService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IVetPersonalInfoService vetPersonalInfoService; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 查询牧户用户列表 |
|
|
* 查询牧户用户列表 |
|
|
*/ |
|
|
*/ |
|
|
@ -292,6 +297,27 @@ public class MuhuUserController extends BaseController |
|
|
// 没有认证记录 |
|
|
// 没有认证记录 |
|
|
result.put("authStatus", "未认证"); |
|
|
result.put("authStatus", "未认证"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ========== 新增:查询兽医个人信息 ========== |
|
|
|
|
|
// 判断用户类型,如果是兽医(01),则查询兽医信息表 |
|
|
|
|
|
if ("01".equals(user.getUserType())) { |
|
|
|
|
|
VetPersonalInfo vetInfo = vetPersonalInfoService.selectVetPersonalInfoByUserId(userId); |
|
|
|
|
|
if (vetInfo != null) { |
|
|
|
|
|
// 只提取需要的字段 |
|
|
|
|
|
Map<String, Object> vetData = new HashMap<>(); |
|
|
|
|
|
vetData.put("specialty", vetInfo.getSpecialty()); |
|
|
|
|
|
vetData.put("workExperience", vetInfo.getWorkExperience()); |
|
|
|
|
|
vetData.put("expertType", vetInfo.getExpertType()); |
|
|
|
|
|
|
|
|
|
|
|
// 可选:如果需要其他兽医字段也可以添加 |
|
|
|
|
|
// vetData.put("title", vetInfo.getTitle()); |
|
|
|
|
|
// vetData.put("hospital", vetInfo.getHospital()); |
|
|
|
|
|
|
|
|
|
|
|
result.put("vetInfo", vetData); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
// ========== 新增结束 ========== |
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
result.put("authStatus", "未认证"); |
|
|
result.put("authStatus", "未认证"); |
|
|
} |
|
|
} |
|
|
@ -307,8 +333,33 @@ public class MuhuUserController extends BaseController |
|
|
*/ |
|
|
*/ |
|
|
@PreAuthorize("@ss.hasRole('muhu') or @ss.hasRole('vet')") |
|
|
@PreAuthorize("@ss.hasRole('muhu') or @ss.hasRole('vet')") |
|
|
@PutMapping("/saveUserAreaCode/{areaCode}") |
|
|
@PutMapping("/saveUserAreaCode/{areaCode}") |
|
|
public AjaxResult getArea(@PathVariable("areaCode") String areaCode) { |
|
|
|
|
|
Long userId = getUserId(); |
|
|
|
|
|
return toAjax(sysUserService.updateUserAreaCode(userId, areaCode)); |
|
|
|
|
|
|
|
|
public AjaxResult saveUserAreaCode(@PathVariable("areaCode") String areaCode) { |
|
|
|
|
|
try { |
|
|
|
|
|
Long userId = getUserId(); |
|
|
|
|
|
|
|
|
|
|
|
int result = sysUserService.updateUserAreaCode(userId, areaCode); |
|
|
|
|
|
|
|
|
|
|
|
if (result > 0) { |
|
|
|
|
|
// 查询更新后的用户信息 |
|
|
|
|
|
SysUser updatedUser = sysUserService.selectUserById(userId); |
|
|
|
|
|
|
|
|
|
|
|
// 更新缓存中的用户信息 |
|
|
|
|
|
LoginUser loginUser = getLoginUser(); |
|
|
|
|
|
loginUser.setUser(updatedUser); |
|
|
|
|
|
tokenService.setLoginUser(loginUser); |
|
|
|
|
|
|
|
|
|
|
|
// 返回更新后的数据 |
|
|
|
|
|
Map<String, Object> data = new HashMap<>(); |
|
|
|
|
|
data.put("userId", userId); |
|
|
|
|
|
data.put("areaCode", updatedUser.getAreaCode()); |
|
|
|
|
|
data.put("userName", updatedUser.getUserName()); |
|
|
|
|
|
|
|
|
|
|
|
return success(data); |
|
|
|
|
|
} else { |
|
|
|
|
|
return error("保存失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
return error("保存失败: " + e.getMessage()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |