|  |  |  | 
|---|
|  |  |  | package com.panzhihua.applets.api; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONArray; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.panzhihua.applets.weixin.CheckService; | 
|---|
|  |  |  | import com.panzhihua.applets.model.dtos.ComPbMemberCertificationDTO; | 
|---|
|  |  |  | import com.panzhihua.common.model.dtos.user.SysUserEditTipsDTO; | 
|---|
|  |  |  | import com.panzhihua.common.model.dtos.user.SysUserFeedbackDTO; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.community.*; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.partybuilding.PartyBuildingMemberVO; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.user.*; | 
|---|
|  |  |  | import com.panzhihua.common.service.community.CommunityService; | 
|---|
|  |  |  | import com.panzhihua.common.service.partybuilding.PartyBuildingService; | 
|---|
|  |  |  | import com.panzhihua.common.service.user.UserService; | 
|---|
|  |  |  | import com.panzhihua.common.controller.BaseController; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.LoginUserInfoVO; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.R; | 
|---|
|  |  |  | import com.panzhihua.common.validated.AddGroup; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiImplicitParam; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import static java.util.stream.Collectors.toList; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  | import java.util.concurrent.atomic.AtomicBoolean; | 
|---|
|  |  |  | import java.util.stream.Collectors; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  | import javax.validation.Valid; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import cn.hutool.core.util.StrUtil; | 
|---|
|  |  |  | import com.panzhihua.applets.umf.UmfPayUtil; | 
|---|
|  |  |  | import com.panzhihua.common.constants.Constants; | 
|---|
|  |  |  | import com.panzhihua.common.constants.HttpStatus; | 
|---|
|  |  |  | import com.panzhihua.common.model.dtos.community.social.PageProjectDTO; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.community.rentHouse.WxPayOrderVO; | 
|---|
|  |  |  | import com.panzhihua.common.utlis.DateUtils; | 
|---|
|  |  |  | import org.apache.commons.lang.StringUtils; | 
|---|
|  |  |  | import org.springframework.beans.BeanUtils; | 
|---|
|  |  |  | import org.springframework.data.redis.core.StringRedisTemplate; | 
|---|
|  |  |  | import org.springframework.util.ObjectUtils; | 
|---|
|  |  |  | import org.springframework.validation.annotation.Validated; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.Comparator; | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.stream.Collectors; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONArray; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.panzhihua.applets.model.dtos.ComPbMemberCertificationDTO; | 
|---|
|  |  |  | import com.panzhihua.applets.weixin.CheckService; | 
|---|
|  |  |  | import com.panzhihua.common.constants.SecurityConstants; | 
|---|
|  |  |  | import com.panzhihua.common.constants.UserConstants; | 
|---|
|  |  |  | import com.panzhihua.common.controller.BaseController; | 
|---|
|  |  |  | import com.panzhihua.common.model.dtos.user.SysUserEditTipsDTO; | 
|---|
|  |  |  | import com.panzhihua.common.model.dtos.user.SysUserFeedbackDTO; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.LoginUserInfoVO; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.R; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.community.ComActActEvaluateVO; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.community.ComActActRegistVO; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.community.ComActActivityVO; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.community.ComActEasyPhotoVO; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.community.ComActMicroWishVO; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.community.ComActVO; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.community.ComMngStructAreaVO; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.community.ComMngStructHouseVO; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.partybuilding.PartyBuildingMemberVO; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.user.ComMngFamilyInfoVO; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.user.SysUserNoticeVO; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.user.UpdateUserArchivesVO; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.user.UserArchivesVO; | 
|---|
|  |  |  | import com.panzhihua.common.model.vos.user.UserPhoneVO; | 
|---|
|  |  |  | import com.panzhihua.common.service.community.CommunityService; | 
|---|
|  |  |  | import com.panzhihua.common.service.partybuilding.PartyBuildingService; | 
|---|
|  |  |  | import com.panzhihua.common.service.user.UserService; | 
|---|
|  |  |  | import com.panzhihua.common.validated.AddGroup; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiImplicitParam; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @program: springcloud_k8s_panzhihuazhihuishequ | 
|---|
|  |  |  | 
|---|
|  |  |  | private PartyBuildingService partyBuildingService; | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private CheckService checkService; | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private StringRedisTemplate stringRedisTemplate; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "当前登录用户信息", response = LoginUserInfoVO.class) | 
|---|
|  |  |  | @GetMapping("info") | 
|---|
|  |  |  | 
|---|
|  |  |  | if (R.isOk(r)) { | 
|---|
|  |  |  | Object data = r.getData(); | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(data)) { | 
|---|
|  |  |  | LoginUserInfoVO loginUserInfoVO = (LoginUserInfoVO) data; | 
|---|
|  |  |  | LoginUserInfoVO loginUserInfoVO = (LoginUserInfoVO)data; | 
|---|
|  |  |  | //是否保存unionid | 
|---|
|  |  |  | //                if (Objects.isNull(loginUserInfoVO.getUnionid()) || "无".equals(loginUserInfoVO.getUnionid())) { | 
|---|
|  |  |  | //                    return R.fail(HttpStatus.UNAUTHORIZED, "token过期"); | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | R r1 = communityService.detailHouse(userId); | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(loginUserInfoVO.getIdCard())){ | 
|---|
|  |  |  | //查询实名用户绑定的实有人口地址 | 
|---|
|  |  |  | R r4=communityService.selectByIdCard(loginUserInfoVO.getIdCard()); | 
|---|
|  |  |  | if(R.isOk(r4)){ | 
|---|
|  |  |  | String address= (String) r4.getData(); | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(address)){ | 
|---|
|  |  |  | loginUserInfoVO.setAddress(address); | 
|---|
|  |  |  | r.setData(loginUserInfoVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null != communityId && 0 != communityId) { | 
|---|
|  |  |  | R r2 = communityService.detailCommunity(communityId); | 
|---|
|  |  |  | if (R.isOk(r2)) { | 
|---|
|  |  |  | Object data1 = r2.getData(); | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(data1)) { | 
|---|
|  |  |  | loginUserInfoVO.setComActVO(JSONObject.parseObject(JSONObject.toJSONString(data1), ComActVO.class)); | 
|---|
|  |  |  | loginUserInfoVO | 
|---|
|  |  |  | .setComActVO(JSONObject.parseObject(JSONObject.toJSONString(data1), ComActVO.class)); | 
|---|
|  |  |  | r.setData(loginUserInfoVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | if (R.isOk(r3)) { | 
|---|
|  |  |  | Object data1 = r3.getData(); | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(data1)) { | 
|---|
|  |  |  | loginUserInfoVO.setComMngStructAreaVO(JSONObject.parseObject(JSONObject.toJSONString(data1), ComMngStructAreaVO.class)); | 
|---|
|  |  |  | loginUserInfoVO.setComMngStructAreaVO( | 
|---|
|  |  |  | JSONObject.parseObject(JSONObject.toJSONString(data1), ComMngStructAreaVO.class)); | 
|---|
|  |  |  | r.setData(loginUserInfoVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | if (R.isOk(r1)) { | 
|---|
|  |  |  | Object data1 = r1.getData(); | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(data1)) { | 
|---|
|  |  |  | loginUserInfoVO.setComMngStructHouseVOS((List<ComMngStructHouseVO>) data1); | 
|---|
|  |  |  | loginUserInfoVO.setComMngStructHouseVOS((List<ComMngStructHouseVO>)data1); | 
|---|
|  |  |  | r.setData(loginUserInfoVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | public R putUserAuthentication(@RequestBody @Validated(AddGroup.class) LoginUserInfoVO loginUserInfoVO) { | 
|---|
|  |  |  | Long userId = this.getUserId(); | 
|---|
|  |  |  | loginUserInfoVO.setUserId(userId); | 
|---|
|  |  |  | loginUserInfoVO.setCommunityId(this.getCommunityId()); | 
|---|
|  |  |  | R r = userService.putUserAuthentication(loginUserInfoVO); | 
|---|
|  |  |  | if (R.isOk(r)) { | 
|---|
|  |  |  | //通过发通知 | 
|---|
|  |  |  | // 通过发通知 | 
|---|
|  |  |  | SysUserNoticeVO sysUserNoticeVO = new SysUserNoticeVO(); | 
|---|
|  |  |  | sysUserNoticeVO.setUserId(userId); | 
|---|
|  |  |  | sysUserNoticeVO.setType(3); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (R.isOk(r1)) { | 
|---|
|  |  |  | log.info("新增实名认证未通过通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 清空缓存 | 
|---|
|  |  |  | String userRoleKey = UserConstants.LOGIN_USER_INFO + this.getLoginUserInfo().getUserId(); | 
|---|
|  |  |  | String userAppletRoleKey = SecurityConstants.ROLE_APPLETS_USER + this.getLoginUserInfo().getUserId(); | 
|---|
|  |  |  | stringRedisTemplate.delete(userRoleKey); | 
|---|
|  |  |  | stringRedisTemplate.delete(userAppletRoleKey); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | //未通过发通知 | 
|---|
|  |  |  | // 未通过发通知 | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | SysUserNoticeVO sysUserNoticeVO=new SysUserNoticeVO(); | 
|---|
|  |  |  | sysUserNoticeVO.setUserId(userId); | 
|---|
|  |  |  | sysUserNoticeVO.setType(3); | 
|---|
|  |  |  | sysUserNoticeVO.setTitle("实名制审核未通过"); | 
|---|
|  |  |  | sysUserNoticeVO.setBusinessType(6); | 
|---|
|  |  |  | sysUserNoticeVO.setBusinessContent(String.format("驳回原因:%s",r.getMsg())); | 
|---|
|  |  |  | sysUserNoticeVO.setStatus(0); | 
|---|
|  |  |  | sysUserNoticeVO.setBusinessStatus(1); | 
|---|
|  |  |  | R r1 = userService.addNotice(sysUserNoticeVO); | 
|---|
|  |  |  | if (R.isOk(r1)) { | 
|---|
|  |  |  | log.info("新增实名认证未通过通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | * SysUserNoticeVO sysUserNoticeVO=new SysUserNoticeVO(); sysUserNoticeVO.setUserId(userId); | 
|---|
|  |  |  | * sysUserNoticeVO.setType(3); sysUserNoticeVO.setTitle("实名制审核未通过"); sysUserNoticeVO.setBusinessType(6); | 
|---|
|  |  |  | * sysUserNoticeVO.setBusinessContent(String.format("驳回原因:%s",r.getMsg())); sysUserNoticeVO.setStatus(0); | 
|---|
|  |  |  | * sysUserNoticeVO.setBusinessStatus(1); R r1 = userService.addNotice(sysUserNoticeVO); if (R.isOk(r1)) { | 
|---|
|  |  |  | * log.info("新增实名认证未通过通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO)); } | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return r; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "我的活动", response = ComActActivityVO.class) | 
|---|
|  |  |  | @GetMapping("listactivity") | 
|---|
|  |  |  | public R listActivity() { | 
|---|
|  |  |  | public R listActivity(@RequestParam(value = "status", required = false) Integer status,@RequestParam(value = "type", required = false) Integer type) { | 
|---|
|  |  |  | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); | 
|---|
|  |  |  | Long userId = loginUserInfo.getUserId(); | 
|---|
|  |  |  | Long communityId = loginUserInfo.getCommunityId(); | 
|---|
|  |  |  | List<ComActActivityVO> comActActivityVOS = new ArrayList<>(); | 
|---|
|  |  |  | R r = communityService.listActivity(userId); | 
|---|
|  |  |  | if (R.isOk(r)) { | 
|---|
|  |  |  | comActActivityVOS = (List<ComActActivityVO>) r.getData(); | 
|---|
|  |  |  | R r = communityService.listActivity(userId, status,type); | 
|---|
|  |  |  | if (R.isOk(r)&&r.getData()!=null) { | 
|---|
|  |  |  | comActActivityVOS = (List<ComActActivityVO>)r.getData(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | R r1 = partyBuildingService.listActivity(userId, communityId); | 
|---|
|  |  |  | if (R.isOk(r1)) { | 
|---|
|  |  |  | List<ComActActivityVO> data = (List<ComActActivityVO>) r1.getData(); | 
|---|
|  |  |  | comActActivityVOS.addAll(data); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //        R r1 = partyBuildingService.listActivity(userId, communityId, status); | 
|---|
|  |  |  | //        if (R.isOk(r1)&&r1.getData()!=null) { | 
|---|
|  |  |  | //            List<ComActActivityVO> data = (List<ComActActivityVO>)r1.getData(); | 
|---|
|  |  |  | //            comActActivityVOS.addAll(data); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(comActActivityVOS)) { | 
|---|
|  |  |  | String s = JSONArray.toJSONString(comActActivityVOS); | 
|---|
|  |  |  | List<ComActActivityVO> comActActivityVOS1 = new ArrayList<>(); | 
|---|
|  |  |  | comActActivityVOS1 = JSONArray.parseArray(s, ComActActivityVO.class); | 
|---|
|  |  |  | List<ComActActivityVO> collect = comActActivityVOS1.stream().sorted(Comparator.comparing(ComActActivityVO::getBeginAt).reversed()).collect(Collectors.toList()); | 
|---|
|  |  |  | List<ComActActivityVO> collect = comActActivityVOS1.stream() | 
|---|
|  |  |  | .sorted(Comparator.comparing(ComActActivityVO::getBeginAt).reversed()).collect(Collectors.toList()); | 
|---|
|  |  |  | comActActivityVOS = collect; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(comActActivityVOS)) { | 
|---|
|  |  |  | List<ComActActivityVO> collect = comActActivityVOS.stream().sorted(Comparator.comparing(ComActActivityVO::getSingDate).reversed()).collect(Collectors.toList()); | 
|---|
|  |  |  | List<ComActActivityVO> collect = comActActivityVOS.stream() | 
|---|
|  |  |  | .sorted(Comparator.comparing(ComActActivityVO::getSingDate).reversed()).collect(Collectors.toList()); | 
|---|
|  |  |  | //当前用户签到记录列表 | 
|---|
|  |  |  | R r2 = communityService.listSignInActivity(userId); | 
|---|
|  |  |  | if (R.isOk(r2) && !ObjectUtils.isEmpty(r2.getData())) { | 
|---|
|  |  |  | List<ComActActRegistVO> comActActRegistVOS = JSONArray.parseArray(JSONArray.toJSONString(r2.getData()), ComActActRegistVO.class).stream() | 
|---|
|  |  |  | .sorted(Comparator.comparing(ComActActRegistVO::getCreateAt).reversed()).collect(toList()); | 
|---|
|  |  |  | collect.forEach(comActActivityVO -> { | 
|---|
|  |  |  | ArrayList<ComActActRegistVO> currentList = new ArrayList<>(); | 
|---|
|  |  |  | comActActRegistVOS.forEach(activitySignInVO -> { | 
|---|
|  |  |  | if (comActActivityVO.getId().equals(activitySignInVO.getActivityId())) { | 
|---|
|  |  |  | currentList.add(activitySignInVO); | 
|---|
|  |  |  | if(activitySignInVO.getEndTime()!=null){ | 
|---|
|  |  |  | comActActivityVO.setIsComment(1); | 
|---|
|  |  |  | if(comActActivityVO.getTimes()==null){ | 
|---|
|  |  |  | comActActivityVO.setTimes(1); | 
|---|
|  |  |  | comActActivityVO.setAward(activitySignInVO.getAward()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else { | 
|---|
|  |  |  | comActActivityVO.setTimes(comActActivityVO.getTimes()+1); | 
|---|
|  |  |  | comActActivityVO.setAward(comActActivityVO.getAward() + activitySignInVO.getAward()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | if (currentList.size() > 10) { | 
|---|
|  |  |  | comActActivityVO.setActivitySignInList(currentList.subList(0, 10)); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | comActActivityVO.setActivitySignInList(currentList); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Integer limit = comActActivityVO.getLimit(); | 
|---|
|  |  |  | if(limit != null && limit>0 &¤tList.size()>0){ | 
|---|
|  |  |  | if(limit==currentList.size()&¤tList.get(currentList.size()-1).getEndTime()!=null){ | 
|---|
|  |  |  | comActActivityVO.setIsRegist(1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //当前用户活动评分 | 
|---|
|  |  |  | R r3 = communityService.listEvaluate(userId); | 
|---|
|  |  |  | if (R.isOk(r3) && !ObjectUtils.isEmpty(r3.getData())) { | 
|---|
|  |  |  | List<ComActActEvaluateVO> comActActEvaluateVOS = JSONArray.parseArray(JSONArray.toJSONString(r3.getData()), ComActActEvaluateVO.class); | 
|---|
|  |  |  | collect.forEach(comActActivityVO -> { | 
|---|
|  |  |  | List<ComActActEvaluateVO> evaluateVOS=comActActEvaluateVOS.stream().filter(comActActEvaluateVO -> comActActEvaluateVO.getActivityId().equals(comActActivityVO.getId())).collect(toList()); | 
|---|
|  |  |  | if(comActActivityVO.getSignCount()<=evaluateVOS.size()){ | 
|---|
|  |  |  | comActActivityVO.setIsComment(0); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | comActActivityVO.setComActActEvaluateVOList(evaluateVOS); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(collect); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(comActActivityVOS); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (null == id || 0 == id) { | 
|---|
|  |  |  | return R.fail("心愿主键不能为空"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String evaluate = comActMicroWishVO.getEvaluate(); | 
|---|
|  |  |  | if (ObjectUtils.isEmpty(evaluate)) { | 
|---|
|  |  |  | return R.fail("用户评价不能为空"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Integer score = comActMicroWishVO.getScore(); | 
|---|
|  |  |  | if (null == score || 0 == score) { | 
|---|
|  |  |  | return R.fail("评分不能为空"); | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "意见反馈") | 
|---|
|  |  |  | @PostMapping("feedback") | 
|---|
|  |  |  | public R addFeedback(@RequestBody @Validated(AddGroup.class) SysUserFeedbackDTO sysUserFeedbackDTO) { | 
|---|
|  |  |  | //        微信内容审核 | 
|---|
|  |  |  | // 微信内容审核 | 
|---|
|  |  |  | String msg = sysUserFeedbackDTO.getContent(); | 
|---|
|  |  |  | if (!checkService.checkMessage(msg)) { | 
|---|
|  |  |  | return R.fail("内容违规"); | 
|---|
|  |  |  | if (StrUtil.isNotBlank(msg)) { | 
|---|
|  |  |  | String result = checkService.checkMessageBy(msg, this.getLoginUserInfo().getOpenid(),this.getAppId()); | 
|---|
|  |  |  | if (StrUtil.isNotBlank(result)) { | 
|---|
|  |  |  | return R.fail(501, "填写内容存在 " + result + " 违规信息"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); | 
|---|
|  |  |  | Long userId = loginUserInfo.getUserId(); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "党员认证") | 
|---|
|  |  |  | @PostMapping("partybuildingembercertification") | 
|---|
|  |  |  | public R partybuildingembercertification(@RequestBody @Validated(AddGroup.class) ComPbMemberCertificationDTO comPbMemberCertificationDTO) { | 
|---|
|  |  |  | //totest 党员认证 | 
|---|
|  |  |  | public R partybuildingembercertification( | 
|---|
|  |  |  | @RequestBody @Validated(AddGroup.class) ComPbMemberCertificationDTO comPbMemberCertificationDTO) { | 
|---|
|  |  |  | // 党员认证 | 
|---|
|  |  |  | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); | 
|---|
|  |  |  | Long userId = loginUserInfo.getUserId(); | 
|---|
|  |  |  | Long communityId = loginUserInfo.getCommunityId(); | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.fail("未绑定社区"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //判断用户是否已认证成功 | 
|---|
|  |  |  | R certUser = partyBuildingService.userCertification(userId); | 
|---|
|  |  |  | // 判断用户是否已认证成功 | 
|---|
|  |  |  | R certUser = partyBuildingService.userCertification(userId,communityId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Object certUserInfo = certUser.getData(); | 
|---|
|  |  |  | boolean userCertified = false; | 
|---|
|  |  |  | if (certUserInfo != null) { | 
|---|
|  |  |  | PartyBuildingMemberVO certUserVo = (PartyBuildingMemberVO) certUserInfo; | 
|---|
|  |  |  | //已认证党员身份,直接返回 | 
|---|
|  |  |  | userCertified = certUserVo.getAuditResult() == 1; | 
|---|
|  |  |  | AtomicBoolean userCertified = new AtomicBoolean(false); | 
|---|
|  |  |  | if (R.isOk(certUser) && certUserInfo != null) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | List<PartyBuildingMemberVO> partyBuildingMemberVOList = | 
|---|
|  |  |  | JSONArray.parseArray(JSONArray.toJSONString(certUser.getData()), PartyBuildingMemberVO.class); | 
|---|
|  |  |  | // 已认证党员身份,直接返回 | 
|---|
|  |  |  | if (partyBuildingMemberVOList != null && partyBuildingMemberVOList.size() > 0) { | 
|---|
|  |  |  | partyBuildingMemberVOList.forEach(vo -> { | 
|---|
|  |  |  | userCertified.set(vo.getAuditResult() == 1); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //匹配手机,验证是否进行自动确认 | 
|---|
|  |  |  | if (userCertified) { | 
|---|
|  |  |  | return R.fail("用户已完成党员认证"); | 
|---|
|  |  |  | // 匹配手机,验证是否进行自动确认 | 
|---|
|  |  |  | if (userCertified.get()) { | 
|---|
|  |  |  | return R.fail("您已审核通过,无需重复提交"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | PartyBuildingMemberVO partyBuildingMemberVO = new PartyBuildingMemberVO(); | 
|---|
|  |  |  | BeanUtils.copyProperties(comPbMemberCertificationDTO, partyBuildingMemberVO); | 
|---|
|  |  |  | partyBuildingMemberVO.setAuditResult(0); | 
|---|
|  |  |  | partyBuildingMemberVO.setCommunityId(communityId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //用户实名认证信息判断 | 
|---|
|  |  |  | // 用户实名认证信息判断 | 
|---|
|  |  |  | String idCard = loginUserInfo.getIdCard(); | 
|---|
|  |  |  | partyBuildingMemberVO.setUserId(userId); | 
|---|
|  |  |  | if (idCard == null) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | partyBuildingMemberVO.setIdCard(loginUserInfo.getIdCard()); | 
|---|
|  |  |  | partyBuildingMemberVO.setName(loginUserInfo.getName()); | 
|---|
|  |  |  | partyBuildingMemberVO.setPhone(loginUserInfo.getPhone()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | R r = partyBuildingService.addPartyBuildingMember(partyBuildingMemberVO); | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "党员认证查询") | 
|---|
|  |  |  | @GetMapping("partybuildingembercertification") | 
|---|
|  |  |  | public R partybuildingembercertification() { | 
|---|
|  |  |  | //totest 党员认证查询 | 
|---|
|  |  |  | // 党员认证查询 | 
|---|
|  |  |  | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); | 
|---|
|  |  |  | Long userId = loginUserInfo.getUserId(); | 
|---|
|  |  |  | return partyBuildingService.userCertification(userId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | R r = partyBuildingService.userCertification(userId,this.getCommunityId()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (R.isOk(r)) { | 
|---|
|  |  |  | List<PartyBuildingMemberVO> partyBuildingMemberVOList = | 
|---|
|  |  |  | JSONArray.parseArray(JSONArray.toJSONString(r.getData()), PartyBuildingMemberVO.class); | 
|---|
|  |  |  | if (partyBuildingMemberVOList != null && partyBuildingMemberVOList.size() > 0) { | 
|---|
|  |  |  | Optional<PartyBuildingMemberVO> ot = partyBuildingMemberVOList.stream() | 
|---|
|  |  |  | .filter(partyBuildingMemberVO -> partyBuildingMemberVO.getAuditResult() == 1).findFirst(); | 
|---|
|  |  |  | if (ot.isPresent()) { | 
|---|
|  |  |  | return R.ok(ot.get()); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return R.ok(partyBuildingMemberVOList.get(0)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "获取用户电子档案", response = UserArchivesVO.class) | 
|---|
|  |  |  | @PostMapping("getUserArchives") | 
|---|
|  |  |  | 
|---|
|  |  |  | userArchivesVO.setUserId(userId); | 
|---|
|  |  |  | return userService.updateUserArchives(userArchivesVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "分页查询用户报名的项目") | 
|---|
|  |  |  | @PostMapping("project") | 
|---|
|  |  |  | public R pageProjectWhichIsSignedByUser(@RequestBody @Valid PageProjectDTO pageProjectDTO) { | 
|---|
|  |  |  | pageProjectDTO.setUserId(this.getUserId()); | 
|---|
|  |  |  | return communityService.pageProjectWhichIsSignedByUser(pageProjectDTO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("获取用户") | 
|---|
|  |  |  | @GetMapping("selectAutomessageSysUserById") | 
|---|
|  |  |  | public R selectAutomessageSysUserById(@RequestParam("id")Long id){ | 
|---|
|  |  |  | return communityService.selectAutomessageSysUserById(id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|