| | |
| | | |
| | | import static java.util.stream.Collectors.toList; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | 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 io.swagger.annotations.ApiParam; |
| | | 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.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | |
| | | Object data = r.getData(); |
| | | if (!ObjectUtils.isEmpty(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)) { |
| | |
| | | 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)) { |
| | | // 通过发通知 |
| | |
| | | } |
| | | |
| | | @ApiOperation(value = "我的活动", response = ComActActivityVO.class) |
| | | @ApiImplicitParam(name = "status", value = "活动状态(4 进行中 5 已结束 6 已取消)", required = false) |
| | | @GetMapping("listactivity") |
| | | public R listActivity(@RequestParam("status") Integer status) { |
| | | 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, status); |
| | | if (R.isOk(r)) { |
| | | 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, status); |
| | | 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<>(); |
| | |
| | | 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) { |
| | |
| | | } 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 -> comActActEvaluateVOS.forEach(comActActEvaluateVO -> { |
| | | if (comActActEvaluateVO.getActivityId().equals(comActActivityVO.getId())) { |
| | | comActActivityVO.setMyRating(comActActEvaluateVO.getStarLevel()); |
| | | } |
| | | })); |
| | | 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); |
| | | } |
| | |
| | | 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(); |
| | |
| | | } |
| | | |
| | | // 判断用户是否已认证成功 |
| | | R certUser = partyBuildingService.userCertification(userId); |
| | | R certUser = partyBuildingService.userCertification(userId,communityId); |
| | | |
| | | Object certUserInfo = certUser.getData(); |
| | | AtomicBoolean userCertified = new AtomicBoolean(false); |
| | |
| | | } else { |
| | | partyBuildingMemberVO.setIdCard(loginUserInfo.getIdCard()); |
| | | partyBuildingMemberVO.setName(loginUserInfo.getName()); |
| | | partyBuildingMemberVO.setPhone(loginUserInfo.getPhone()); |
| | | } |
| | | |
| | | R r = partyBuildingService.addPartyBuildingMember(partyBuildingMemberVO); |
| | |
| | | // 党员认证查询 |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | Long userId = loginUserInfo.getUserId(); |
| | | R r = partyBuildingService.userCertification(userId); |
| | | R r = partyBuildingService.userCertification(userId,this.getCommunityId()); |
| | | |
| | | if (R.isOk(r)) { |
| | | List<PartyBuildingMemberVO> partyBuildingMemberVOList = |
| | |
| | | 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); |
| | | } |
| | | |
| | | @ApiOperation("新增投诉建议或问题留言") |
| | | @PostMapping("addFeedBack") |
| | | public R addFeedBack(@RequestBody SysUserFeedbackDTO sysUserFeedbackDTO){ |
| | | sysUserFeedbackDTO.setCommunityId(null); |
| | | return userService.addFeedback(sysUserFeedbackDTO); |
| | | } |
| | | |
| | | @ApiOperation("查看自己的投诉建议或问题留言记录") |
| | | @GetMapping("myFeedBack") |
| | | public R myFeedBack(@ApiParam("类型:1问题留言2投诉建议") @RequestParam(value = "type",required = false)Integer type,@RequestParam("propertyId")Long propertyId){ |
| | | return userService.myFeedBack(this.getLoginUserInfo().getUserId(),type,propertyId); |
| | | } |
| | | |
| | | } |