| | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.im.comm.Result; |
| | | import com.ruoyi.im.config.IpUtils; |
| | |
| | | import com.ruoyi.im.service.*; |
| | | import com.ruoyi.im.dto.RegisterDto; |
| | | import com.ruoyi.im.service.impl.InsurancePositionServiceImpl; |
| | | import com.ruoyi.im.util.SymmetricCryptoUtil; |
| | | import com.ruoyi.im.util.PayService; |
| | | import com.ruoyi.im.util.SimplePayUtil; |
| | | import com.ruoyi.im.util.UserPolicyUtils; |
| | | import com.ruoyi.im.util.ValidatorUtil; |
| | | import com.ruoyi.system.domain.*; |
| | |
| | | import com.ruoyi.system.domain.out.UserOut; |
| | | import com.ruoyi.system.domain.out.UserTeamAndPositionOut; |
| | | import com.ruoyi.system.domain.vo.UserAccountUpdateVo; |
| | | import com.ruoyi.system.mapper.SystemConfigurationMapper; |
| | | import com.ruoyi.system.service.GroupWelcomeConfigService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.system.service.IpBlacklistService; |
| | | import com.ruoyi.system.service.PaymentRecordService; |
| | | import com.ruoyi.system.service.UserAccountService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @Autowired |
| | | InsuranceFeatureService insuranceFeatureService; |
| | | |
| | | @Autowired |
| | | private SystemConfigurationMapper systemConfigurationMapper; |
| | | |
| | | @Value("${file.upload-dir}") |
| | | private String uploadDir; |
| | | |
| | | @Value("${file.upload-prefix}") |
| | | private String prefix; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | @PostMapping("/register") |
| | | public Result register(@Validated RegisterDto dto){ |
| | | try { |
| | | if(StringUtils.isEmpty(dto.getNikeName())){ |
| | | return Result.error("昵称不能为空!"); |
| | | } |
| | | // 验证手机号 |
| | | boolean isPhoneValid = ValidatorUtil.isValidPhone(dto.getAccount()); |
| | | if(!isPhoneValid){ |
| | |
| | | @PostMapping("/updateUser") |
| | | public Result updateUser(UserAccountUpdateVo vo){ |
| | | try { |
| | | UserAccount userAccount = userAccountService.getOne(new LambdaQueryWrapper<UserAccount>().eq(UserAccount::getAccount,vo.getAccountId())); |
| | | UserAccount userAccount = userAccountService.getOne(new LambdaQueryWrapper<UserAccount>().eq(UserAccount::getAccount,vo.getAccount())); |
| | | |
| | | if (StringUtils.isNotBlank(vo.getNickname())) { |
| | | userAccount.setNickname(vo.getNickname()); |
| | |
| | | public Result uploadFile(@RequestParam("file") MultipartFile file,@RequestParam("accountId") String accountId) { |
| | | try { |
| | | |
| | | SystemConfiguration systemConfiguration = systemConfigurationMapper.selectById(1); |
| | | if(ObjectUtil.isEmpty(systemConfiguration)){ |
| | | return Result.error("文件上传失败!"); |
| | | } |
| | | // 1. 验证文件类型 |
| | | String contentType = file.getContentType(); |
| | | if (contentType == null || |
| | |
| | | setPermissions(filePath.toFile(), "rw-r--r--"); |
| | | |
| | | // 5. 调用网易云信API更新头像 |
| | | fileName = prefix+"/"+fileName; |
| | | fileName = systemConfiguration.getImgUrl()+"/"+fileName; |
| | | UpdateUserBusinessDto dto = new UpdateUserBusinessDto(); |
| | | dto.setAvatar(fileName); |
| | | Map<String, Object> result = imApiServcie.updateUserAvatar(accountId,dto); |
| | |
| | | if(ObjectUtil.isEmpty(userAccount)){ |
| | | return Result.error("账号不存在!"); |
| | | } |
| | | |
| | | GroupWelcomeConfig groupWelcomeConfig = groupWelcomeConfigService.getOne(new LambdaQueryWrapper<>(GroupWelcomeConfig.class) |
| | | .eq(GroupWelcomeConfig::getConfigurationName, "IM-BASICS").last(" limit 1")); |
| | | |
| | | UserOut user = new UserOut(); |
| | | if(ObjectUtil.isNotEmpty(groupWelcomeConfig)){ |
| | | user.setCustomerServiceUrl(groupWelcomeConfig.getCustomerServiceUrl()); |
| | | user.setAboutUs(groupWelcomeConfig.getAboutUs()); |
| | | } |
| | | user.setBalance(userAccount.getBalance()); |
| | | |
| | | MedicalInsuranceAccount insuranceAccount = medicalInsuranceAccountService.getOne(new LambdaQueryWrapper<>(MedicalInsuranceAccount.class) |
| | | .eq(MedicalInsuranceAccount::getUserId, userAccount.getId()) |
| | | .eq(MedicalInsuranceAccount::getAccountStatus, MedicalInsuranceAccount.AccountStatus.ACTIVE) |
| | | ); |
| | | user.setKycStatus(userAccount.getKycStatus()); |
| | | user.setGroupPermissions(userAccount.getGroupPermissions()); |
| | | user.setAddFriend(userAccount.getAddFriend()); |
| | | if(ObjectUtil.isEmpty(insuranceAccount)){ |
| | | return Result.success(user); |
| | | } |
| | |
| | | .eq(UserAccount::getInvitationAccount, userAccount.getAccount()) |
| | | ); |
| | | UserTeamAndPositionOut userTeamAndPositionOut = new UserTeamAndPositionOut(); |
| | | |
| | | List<InsurancePosition> positions = insurancePositionService.list(); |
| | | |
| | | if(CollectionUtils.isEmpty(userAccountList)){ |
| | | userTeamAndPositionOut.setInsurancePosition(positions); |
| | | return Result.success(userTeamAndPositionOut); |
| | | } |
| | | List<Integer> idList = userAccountList.stream() |
| | |
| | | |
| | | long activeNumber = UserPolicyUtils.countActivePolicies(userPolicyList); |
| | | userTeamAndPositionOut.setInsureNumber(activeNumber); |
| | | List<InsurancePosition> positions = insurancePositionService.list(); |
| | | |
| | | positions.forEach(f->{ |
| | | if(userPolicyList.size() >= f.getNumberPeople()){ |
| | | if(activeNumber >= f.getNumberPeople()){ |
| | | userTeamAndPositionOut.setPosition(f.getPosition()); |
| | | userTeamAndPositionOut.setSalary(f.getSalary()); |
| | | } |
| | |
| | | * 产品信息列表 |
| | | */ |
| | | @GetMapping("/getProduct") |
| | | public Result getProduct() { |
| | | public Result getProduct(@RequestParam("account") String account) { |
| | | UserAccount userAccount = userAccountService.getOne(new LambdaQueryWrapper<>(UserAccount.class).eq(UserAccount::getCloudMessageAccount, account)); |
| | | if(ObjectUtil.isEmpty(userAccount)){ |
| | | return Result.error("账号不存在!"); |
| | | } |
| | | LambdaQueryWrapper<InsuranceProduct> wrapper = new LambdaQueryWrapper<>(); |
| | | // 按创建时间倒序排列 |
| | | wrapper.orderByDesc(InsuranceProduct::getCreatedAt); |
| | | List<InsuranceProduct> list = insuranceProductService.list(wrapper); |
| | | list.forEach(f->{ |
| | | long count = userPolicyService.count(new LambdaQueryWrapper<>(UserPolicy.class) |
| | | .eq(UserPolicy::getUserId, userAccount.getId()) |
| | | .eq(UserPolicy::getProductId,f.getId()) |
| | | .eq(UserPolicy::getPayStatus,2) |
| | | .ne(UserPolicy::getApprovalStatus,2) |
| | | ); |
| | | if(count > 0){ |
| | | f.setIsBuy(true); |
| | | } |
| | | List<InsuranceFeature> features = insuranceFeatureService.list(new LambdaQueryWrapper<InsuranceFeature>() |
| | | .eq(InsuranceFeature::getProductId, f.getId())); |
| | | f.setProductFeature(features); |