Merge remote-tracking branch 'origin/main' into main

main
rong.liu 11 months ago
commit c5cd561a66
  1. 5
      users/src/main/java/com/huoran/users/controller/HrUserAccountController.java
  2. 6
      users/src/main/java/com/huoran/users/controller/UserLoginController.java
  3. 4
      users/src/main/java/com/huoran/users/service/IHrUserAccountService.java
  4. 35
      users/src/main/java/com/huoran/users/service/impl/HrUserAccountServiceImpl.java

@ -93,9 +93,8 @@ public class HrUserAccountController {
*/ */
@PostMapping("/delUserAccounts") @PostMapping("/delUserAccounts")
@ApiOperation(value = "批量删除用户以及账号") @ApiOperation(value = "批量删除用户以及账号")
public R delUserAccounts(@RequestBody List<Integer> ids) { public R delUserAccounts(@RequestBody List<String> ids) {
int result = iHrUserAccountService.delUserAccounts(ids); return iHrUserAccountService.delUserAccounts(ids);
return result > 0 ? R.ok("删除成功!") : R.error();
} }
/** /**

@ -245,8 +245,10 @@ public class UserLoginController {
@ApiParam(name = "openId", value = "微信id", required = true) @ApiParam(name = "openId", value = "微信id", required = true)
@RequestParam String openId, @RequestParam String openId,
@ApiParam(name = "userName", value = "用户名称") @ApiParam(name = "userName", value = "用户名称")
@RequestParam String userName){ @RequestParam String userName,
return userAccountService.updateAvatars(openId,url,userName); @ApiParam(name = "platformId", value = "平台id")
@RequestParam String platformId){
return userAccountService.updateAvatars(openId,url,userName,platformId);
} }
/** /**

@ -54,7 +54,7 @@ public interface IHrUserAccountService extends IService<HrUserAccount> {
R examinePassword(ResetPwdReq resetPwdReq); R examinePassword(ResetPwdReq resetPwdReq);
int delUserAccounts(List<Integer> ids); R delUserAccounts(List<String> ids);
Integer getUserIdByAccountId(String accountId); Integer getUserIdByAccountId(String accountId);
@ -87,5 +87,5 @@ public interface IHrUserAccountService extends IService<HrUserAccount> {
UserInfoDetailsRes viewUserDetails(String openId); UserInfoDetailsRes viewUserDetails(String openId);
R updateAvatars(String openId, String url, String userName); R updateAvatars(String openId, String url, String userName,String platformId);
} }

@ -24,8 +24,7 @@ import com.huoran.users.entity.req.*;
import com.huoran.users.entity.res.*; import com.huoran.users.entity.res.*;
import com.huoran.users.entity.vo.CheckVo; import com.huoran.users.entity.vo.CheckVo;
import com.huoran.users.mapper.*; import com.huoran.users.mapper.*;
import com.huoran.users.service.IHrUserAccountService; import com.huoran.users.service.*;
import com.huoran.users.service.PlatformLoginService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactory;
@ -59,9 +58,8 @@ public class HrUserAccountServiceImpl extends ServiceImpl<HrUserAccountMapper, H
@Autowired @Autowired
private UserAuthenticationInformationMapper userAuthenticationInformationMapper; private UserAuthenticationInformationMapper userAuthenticationInformationMapper;
@Autowired @Autowired
private EnterpriseCertificationMapper enterpriseCertificationMapper; public EnterpriseCertificationService enterpriseCertificationService;
@Autowired @Autowired
private HrPersonalFileMapper hrPersonalFileMapper; private HrPersonalFileMapper hrPersonalFileMapper;
@Autowired @Autowired
@ -127,13 +125,24 @@ public class HrUserAccountServiceImpl extends ServiceImpl<HrUserAccountMapper, H
} }
@Override @Override
public int delUserAccounts(List<Integer> ids) { public R delUserAccounts(List<String> ids) {
//删除用户表 List<HrUserAccount> accountList = hrUserAccountMapper.selectList(new QueryWrapper<HrUserAccount>().in("app_open_id", ids));
boolean i = hrUserInfoMapper.delUserInfos(ids); List<Integer> userIds = accountList.stream().map(HrUserAccount::getUserId).collect(Collectors.toList());
//删除用户信息
hrUserInfoMapper.deleteBatchIds(userIds);
//删除账号表 //删除账号表
boolean n = hrUserAccountMapper.delUserAccounts(ids); int delete = hrUserAccountMapper.delete(new QueryWrapper<HrUserAccount>().in("app_open_id", ids));
return i & n == true ? 1 : 0; //删除平台全部认证信息
ids.forEach(openId -> {
QueryWrapper<UserAuthenticationInformation> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("open_id", openId);
userAuthenticationInformationMapper.delete(queryWrapper);
QueryWrapper<EnterpriseCertification> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.eq("open_id", openId);
enterpriseCertificationService.remove(queryWrapper1);
});
return delete > 0 ? R.ok("删除成功!") : R.error();
} }
@Override @Override
@ -439,10 +448,10 @@ public class HrUserAccountServiceImpl extends ServiceImpl<HrUserAccountMapper, H
} }
@Override @Override
public R updateAvatars(String openId, String url, String userName) { public R updateAvatars(String openId, String url, String userName,String platformId) {
//查询账号详情 //查询账号详情
HrUserAccount hrUserAccount = hrUserAccountMapper.selectOne(new QueryWrapper<HrUserAccount>() HrUserAccount hrUserAccount = hrUserAccountMapper.selectOne(new QueryWrapper<HrUserAccount>()
.eq("app_open_id", openId).eq("platform_id", 7)); .eq("app_open_id", openId).eq("platform_id", platformId));
//查询用户信息 //查询用户信息
HrUserInfo hrUserInfo = hrUserInfoMapper.selectByUserId(hrUserAccount.getUserId()); HrUserInfo hrUserInfo = hrUserInfoMapper.selectByUserId(hrUserAccount.getUserId());
@ -451,6 +460,8 @@ public class HrUserAccountServiceImpl extends ServiceImpl<HrUserAccountMapper, H
} }
if (StringUtils.isNotBlank(userName)){ if (StringUtils.isNotBlank(userName)){
hrUserInfo.setUserName(userName); hrUserInfo.setUserName(userName);
hrUserAccount.setAccount(userName);
hrUserAccountMapper.updateById(hrUserAccount);
} }
int update = hrUserInfoMapper.updateById(hrUserInfo); int update = hrUserInfoMapper.updateById(hrUserInfo);
return update>0 ? R.ok():R.error(); return update>0 ? R.ok():R.error();

Loading…
Cancel
Save