|
|
|
@ -242,13 +242,33 @@ public class ExpertController extends JeecgController<Expert, IExpertService> { |
|
|
|
|
CompExp compExp = new CompExp(); |
|
|
|
|
QueryWrapper<CompExp> queryWrapper1 = QueryGenerator.initQueryWrapper(compExp, req.getParameterMap()); |
|
|
|
|
queryWrapper1.eq("expid",model.getId()); |
|
|
|
|
|
|
|
|
|
List<CompExp> list1 = compExpService.list(queryWrapper1); |
|
|
|
|
if(list1.size()>0) { |
|
|
|
|
CompExp compExpModel=list1.get(0); |
|
|
|
|
model.setCompid(compExpModel.getCompid()); |
|
|
|
|
model.setStat(compExpModel.getStat()); |
|
|
|
|
model.setCompName(compExpModel.getCompName()); |
|
|
|
|
String Compid = ""; |
|
|
|
|
String CompName = ""; |
|
|
|
|
String Stat = ""; |
|
|
|
|
// 使用 StringBuilder 来构建字符串,比直接使用字符串连接更高效
|
|
|
|
|
StringBuilder sbCompid = new StringBuilder(); |
|
|
|
|
StringBuilder sbCompName = new StringBuilder(); |
|
|
|
|
StringBuilder sbStat = new StringBuilder(); |
|
|
|
|
for(CompExp item: list1) { |
|
|
|
|
if (sbCompid.length() > 0) { |
|
|
|
|
sbCompid.append(","); // 只在不是第一个元素时添加逗号
|
|
|
|
|
sbCompName.append(","); |
|
|
|
|
sbStat.append(","); |
|
|
|
|
} |
|
|
|
|
sbCompid.append(item.getCompid()); |
|
|
|
|
sbCompName.append(item.getCompName()); |
|
|
|
|
sbStat.append(item.getStat()); |
|
|
|
|
} |
|
|
|
|
// 将 StringBuilder 转换为 String
|
|
|
|
|
Compid = sbCompid.toString(); |
|
|
|
|
CompName = sbCompName.toString(); |
|
|
|
|
Stat = sbStat.toString(); |
|
|
|
|
// 现在 Compid, CompName 和 Stat 包含了逗号分隔的值
|
|
|
|
|
model.setCompName(CompName); |
|
|
|
|
model.setCompid(Compid); |
|
|
|
|
model.setStat(Stat); |
|
|
|
|
return Result.OK(model); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -413,65 +433,13 @@ public class ExpertController extends JeecgController<Expert, IExpertService> { |
|
|
|
|
public Result<SysUser> editcompExp(@RequestBody JSONObject jsonObject,HttpServletRequest req) { |
|
|
|
|
Result<SysUser> result = new Result<SysUser>(); |
|
|
|
|
try { |
|
|
|
|
SysUser sysUser = sysUserService.getById(jsonObject.getString("id")); |
|
|
|
|
baseCommonService.addLog("编辑用户,username: " +sysUser.getUsername() ,CommonConstant.LOG_TYPE_2, 2); |
|
|
|
|
String user_id=jsonObject.getString("id"); |
|
|
|
|
SysUser sysUser = sysUserService.getById(user_id); |
|
|
|
|
baseCommonService.addLog("编辑专家比赛,username: " +sysUser.getUsername() ,CommonConstant.LOG_TYPE_2, 2); |
|
|
|
|
if(sysUser==null) { |
|
|
|
|
result.error500("未找到对应实体"); |
|
|
|
|
}else { |
|
|
|
|
SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class); |
|
|
|
|
user.setUpdateTime(new Date()); |
|
|
|
|
//String passwordEncode = PasswordUtil.encrypt(user.getUsername(), user.getPassword(), sysUser.getSalt());
|
|
|
|
|
user.setPassword(sysUser.getPassword()); |
|
|
|
|
String roles = "1731948288626339841"; |
|
|
|
|
String departs = jsonObject.getString("selecteddeparts"); |
|
|
|
|
String expSc = jsonObject.getString("expSc"); |
|
|
|
|
String expResume = jsonObject.getString("expResume"); |
|
|
|
|
String expTitle = jsonObject.getString("expTitle"); |
|
|
|
|
String compid = jsonObject.getString("compid"); |
|
|
|
|
String compName = jsonObject.getString("compName"); |
|
|
|
|
String stat = jsonObject.getString("stat"); |
|
|
|
|
String expXw = jsonObject.getString("expXw");//学位
|
|
|
|
|
String expZc = jsonObject.getString("expZc");//职称
|
|
|
|
|
String expYjfx = jsonObject.getString("expYjfx");//研究方向
|
|
|
|
|
String expCsgz = jsonObject.getString("expCsgz");//从事工作
|
|
|
|
|
|
|
|
|
|
if(oConvertUtils.isEmpty(departs)){ |
|
|
|
|
//vue3.0前端只传递了departIds
|
|
|
|
|
departs=user.getDepartIds(); |
|
|
|
|
} |
|
|
|
|
//用户表字段org_code不能在这里设置他的值
|
|
|
|
|
user.setOrgCode(null); |
|
|
|
|
// 修改用户走一个service 保证事务
|
|
|
|
|
//获取租户ids
|
|
|
|
|
String relTenantIds = jsonObject.getString("relTenantIds"); |
|
|
|
|
sysUserService.editUser(user, roles, departs, relTenantIds); |
|
|
|
|
Expert expert = new Expert(); |
|
|
|
|
QueryWrapper<Expert> queryWrapper = QueryGenerator.initQueryWrapper(expert, req.getParameterMap()); |
|
|
|
|
queryWrapper.eq("user_id",user.getId()); |
|
|
|
|
List<Expert> listex = expertService.list(queryWrapper); |
|
|
|
|
expert = listex.get(0); |
|
|
|
|
expert.setUserId(user.getId()); |
|
|
|
|
expert.setExpImg(user.getAvatar()); |
|
|
|
|
expert.setExpSc(expSc); |
|
|
|
|
expert.setExpResume(expResume); |
|
|
|
|
expert.setExpTitle(expTitle); |
|
|
|
|
expert.setName(user.getRealname()); |
|
|
|
|
expert.setExpXw(expXw);//学位
|
|
|
|
|
expert.setExpZc(expZc);//职称
|
|
|
|
|
expert.setExpYjfx(expYjfx);//研究方向
|
|
|
|
|
expert.setExpCsgz(expCsgz);//从事工作
|
|
|
|
|
|
|
|
|
|
expertService.updateById(expert); |
|
|
|
|
CompExp compExp = new CompExp(); |
|
|
|
|
QueryWrapper<CompExp> queryWrapper1 = QueryGenerator.initQueryWrapper(compExp, req.getParameterMap()); |
|
|
|
|
queryWrapper1.eq("expid",expert.getId()); |
|
|
|
|
List<CompExp> listce = compExpService.list(queryWrapper1); |
|
|
|
|
compExp = listce.get(0); |
|
|
|
|
compExp.setCompid(compid); |
|
|
|
|
compExp.setCompName(compName); |
|
|
|
|
compExp.setExpid(expert.getId()); |
|
|
|
|
compExp.setStat(stat); |
|
|
|
|
compExpService.updateById(compExp); |
|
|
|
|
expertService.updateCompExpert(jsonObject); |
|
|
|
|
result.success("修改成功!"); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|