| | |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.dsh.account.entity.TAppUser; |
| | | import com.dsh.account.entity.TUserAudit; |
| | | import com.dsh.account.feignclient.activity.model.IntegralCommodity; |
| | | import com.dsh.account.feignclient.other.SysLogClient; |
| | | import com.dsh.account.model.vo.userBenefitDetail.*; |
| | | import com.dsh.account.service.RechargeRecordsService; |
| | | import com.dsh.account.service.TAppUserService; |
| | | import com.dsh.account.service.UserAuditService; |
| | | import com.dsh.account.service.UserIntegralChangesService; |
| | | import com.dsh.account.util.PayMoneyUtil; |
| | | import com.dsh.account.util.ResultUtil; |
| | |
| | | import java.io.PrintWriter; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private TAppUserService tauService; |
| | | @Autowired |
| | | private UserAuditService userAuditService; |
| | | |
| | | @Autowired |
| | | private TokenUtil tokenUtil; |
| | |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | @Autowired |
| | | private TAppUserService appUserService; |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | }) |
| | | public ResultUtil<IndexOfUserBenefirVo> queryAppUserUser(String lon, String lat) { |
| | | try { |
| | | System.out.println("21212321312"); |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | System.out.println("33333333"+appUserId); |
| | | if (null == appUserId) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | |
| | | commodities = commodities.subList(0, 5); |
| | | } |
| | | indexOfUserBenefirVo.setCommodities(commodities); |
| | | TAppUser byId = appUserService.getById(appUserId); |
| | | if (byId.getIsVip()!=null && byId.getIsVip()==1){ |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | if (byId.getVipEndTime().getTime() > System.currentTimeMillis()) { |
| | | indexOfUserBenefirVo.setVipEndTime(simpleDateFormat.format(byId.getVipEndTime())); |
| | | } else { |
| | | indexOfUserBenefirVo.setVipEndTime(""); |
| | | } |
| | | }else{ |
| | | indexOfUserBenefirVo.setVipEndTime(""); |
| | | } |
| | | return ResultUtil.success(indexOfUserBenefirVo); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/useBenefit/getAuditById") |
| | | @ApiOperation(value = "2.0新增接口 查询审核信息", tags = {"APP-使用福利"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "id", value = "用户头像审核记录id或用户昵称审核记录id", dataType = "int", required = true), |
| | | }) |
| | | public ResultUtil<TUserAudit> getAuditById(Integer id) { |
| | | TUserAudit userAudit = userAuditService.getById(id); |
| | | if (null == userAudit){ |
| | | userAudit=new TUserAudit(); |
| | | } |
| | | return ResultUtil.success(userAudit); |
| | | } |
| | | @ResponseBody |
| | | @PostMapping("/api/useBenefit/cancelAudit") |
| | | @ApiOperation(value = "2.0新增接口 关闭头像或昵称审核记录", tags = {"APP-使用福利"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "id", value = "用户头像审核记录id或用户昵称审核记录id", dataType = "int", required = true), |
| | | }) |
| | | public ResultUtil cancelAudit(Integer id) { |
| | | userAuditService.removeById(id); |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | @ResponseBody |
| | | @PostMapping("/api/useBenefit/userDetails") |
| | | @ApiOperation(value = "用户个人信息", tags = {"APP-使用福利"}) |
| | |
| | | }) |
| | | public ResultUtil<AppUserDetailsVo> queryAppUserDetails() { |
| | | try { |
| | | System.out.println("1111111"); |
| | | AppUserDetailsVo detailsVo = new AppUserDetailsVo(); |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | System.out.println("222222"+appUserId); |
| | | if (null == appUserId) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | |
| | | |
| | | detailsVo.setMemberLifespan(format1.format(tAppUser.getVipEndTime())); |
| | | } |
| | | // 查询用户是否有待审核或已驳回的昵称头像审核记录 |
| | | TUserAudit nameAudit = userAuditService.lambdaQuery() |
| | | .eq(TUserAudit::getAppUserId, appUserId) |
| | | .eq(TUserAudit::getType, 1) |
| | | .ne(TUserAudit::getState, 2).last("limit 1").one(); |
| | | TUserAudit imageAudit = userAuditService.lambdaQuery() |
| | | .eq(TUserAudit::getAppUserId, appUserId) |
| | | .eq(TUserAudit::getType, 2) |
| | | .ne(TUserAudit::getState, 2).last("limit 1").one(); |
| | | if (nameAudit!=null){ |
| | | detailsVo.setNameAuditId(nameAudit.getId()); |
| | | if (nameAudit.getState()==1){ |
| | | detailsVo.setNameAudit(1); |
| | | }else{ |
| | | detailsVo.setNameAudit(3); |
| | | } |
| | | }else{ |
| | | detailsVo.setNameAudit(2); |
| | | } |
| | | if (imageAudit!=null){ |
| | | detailsVo.setImageAuditId(imageAudit.getId()); |
| | | if (imageAudit.getState()==1){ |
| | | detailsVo.setImageAudit(1); |
| | | }else{ |
| | | detailsVo.setImageAudit(3); |
| | | } |
| | | }else{ |
| | | detailsVo.setImageAudit(2); |
| | | } |
| | | } |
| | | return ResultUtil.success(detailsVo); |
| | | } catch (Exception e) { |
| | |
| | | } |
| | | TAppUser byId = tauService.getById(appUserId); |
| | | if (ToolUtil.isNotEmpty(userImage)) { |
| | | byId.setHeadImg(userImage); |
| | | tauService.updateById(byId); |
| | | // byId.setHeadImg(userImage); |
| | | // tauService.updateById(byId); |
| | | // 查询是否有待审核的头像 |
| | | TUserAudit userAudit = userAuditService |
| | | .lambdaQuery().eq(TUserAudit::getType, 2) |
| | | .eq(TUserAudit::getAppUserId, appUserId) |
| | | .ne(TUserAudit::getState, 2).last("limit 1").one(); |
| | | if (userAudit!=null){ |
| | | userAudit.setState(1); |
| | | userAudit.setHeadImg(userImage); |
| | | UpdateWrapper<TUserAudit> tUserAuditUpdateWrapper = new UpdateWrapper<>(); |
| | | tUserAuditUpdateWrapper.eq("id",userAudit.getId()); |
| | | tUserAuditUpdateWrapper.set("state",1); |
| | | tUserAuditUpdateWrapper.set("headImg",userImage); |
| | | tUserAuditUpdateWrapper.set("remark",null); |
| | | tUserAuditUpdateWrapper.set("auditId",null); |
| | | tUserAuditUpdateWrapper.set("auditTime",null); |
| | | userAuditService.update(tUserAuditUpdateWrapper); |
| | | }else{ |
| | | TUserAudit tUserAudit = new TUserAudit(); |
| | | tUserAudit.setAppUserId(appUserId); |
| | | tUserAudit.setHeadImg(userImage); |
| | | tUserAudit.setType(2); |
| | | tUserAudit.setInsertTime(new Date()); |
| | | userAuditService.save(tUserAudit); |
| | | |
| | | } |
| | | } else { |
| | | ResultUtil.error("头像不能为空!"); |
| | | } |
| | |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | }) |
| | | public ResultUtil<List<Goods>> pointsMallList(MallRequest request) { |
| | | System.err.println( "积分商城"+request); |
| | | return ResultUtil.success(tauService.queryAppUserIntegral(request)); |
| | | } |
| | | |