| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.DesensitizedUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.google.common.base.Joiner; |
| | | import com.panzhihua.common.model.dtos.community.bigscreen.work.ScreenMicroListDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ComActMicroWishFeedbackVO; |
| | |
| | | import com.panzhihua.common.model.vos.community.ComActMicroWishVO; |
| | | import com.panzhihua.common.model.vos.community.TodoEventsVO; |
| | | import com.panzhihua.common.model.vos.community.screen.work.MicroListVO; |
| | | import com.panzhihua.common.model.vos.user.SysUserVO; |
| | | import com.panzhihua.common.utlis.SensitiveUtil; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import com.panzhihua.service_community.dao.ComActMicroWishDAO; |
| | | import com.panzhihua.service_community.dao.ComActMicroWishFeedbackMapper; |
| | | import com.panzhihua.service_community.dao.ComActMicroWishOperationRecordMapper; |
| | | import com.panzhihua.service_community.dao.ComActMicroWishUserDAO; |
| | | import com.panzhihua.service_community.entity.ComActEasyPhotoHandler; |
| | | import com.panzhihua.service_community.model.dos.ComActMicroWishDO; |
| | | import com.panzhihua.service_community.model.dos.ComActMicroWishFeedbackDO; |
| | | import com.panzhihua.service_community.model.dos.ComActMicroWishOperationRecordDO; |
| | | import com.panzhihua.service_community.model.dos.ComActMicroWishUserDO; |
| | | import com.panzhihua.service_community.service.ComActEasyPhotoHandlerService; |
| | | import com.panzhihua.service_community.service.ComActMicroWishOperationRecordService; |
| | | import com.panzhihua.service_community.service.ComActMicroWishService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | private ComActMicroWishOperationRecordMapper comActMicroWishOperationRecordMapper; |
| | | @Resource |
| | | private ComActMicroWishOperationRecordService wishOperationRecordService; |
| | | @Resource |
| | | private ComActEasyPhotoHandlerService easyPhotoHandlerService; |
| | | /** |
| | | * 分页查询微心愿 |
| | | * |
| | |
| | | } |
| | | } |
| | | comActMicroWishVO1.setSponsorPhone(SensitiveUtil.desensitizedPhoneNumber(comActMicroWishVO1.getSponsorPhone())); |
| | | //查询处理人 |
| | | comActMicroWishVO1.setResponsibleName(this.getWishHandleName(comActMicroWishVO1.getHandleId())); |
| | | }); |
| | | iPage.setRecords(records); |
| | | } |
| | |
| | | } |
| | | } |
| | | comActMicroWishVO1.setSponsorPhone(SensitiveUtil.desensitizedPhoneNumber(comActMicroWishVO1.getSponsorPhone())); |
| | | }); |
| | | iPage.setRecords(records); |
| | | } |
| | | return R.ok(iPage); |
| | | } |
| | | @Override |
| | | public R pageMicroWishAppletsDesensitize(ComActMicroWishVO comActMicroWishVO) { |
| | | Long userId = comActMicroWishVO.getResponsibleId(); |
| | | IPage<ComActMicroWishVO> iPage = comActMicroWishDAO.pageMicroWishApplets(new Page(comActMicroWishVO.getPageNum() |
| | | ,comActMicroWishVO.getPageSize()), comActMicroWishVO); |
| | | List<ComActMicroWishVO> records = iPage.getRecords(); |
| | | if (!ObjectUtils.isEmpty(records)) { |
| | | records.forEach(comActMicroWishVO1 -> { |
| | | if(userId != null){ |
| | | Long id = comActMicroWishVO1.getId(); |
| | | ComActMicroWishUserDO comActMicroWishUserDO = comActMicroWishUserDAO.selectOne(new QueryWrapper<ComActMicroWishUserDO>().lambda().eq(ComActMicroWishUserDO::getMicroWishId, id) |
| | | .eq(ComActMicroWishUserDO::getUserId, userId)); |
| | | if (ObjectUtils.isEmpty(comActMicroWishUserDO)) { |
| | | comActMicroWishVO1.setHaveGiveThumbsUp(0); |
| | | } else { |
| | | comActMicroWishVO1.setHaveGiveThumbsUp(1); |
| | | } |
| | | } |
| | | comActMicroWishVO1.setSponsorPhone(SensitiveUtil.desensitizedPhoneNumber(comActMicroWishVO1.getSponsorPhone())); |
| | | comActMicroWishVO1.setSponsorName(DesensitizedUtil.chineseName(comActMicroWishVO1.getSponsorName())); |
| | | comActMicroWishVO1.setResponsibleName(DesensitizedUtil.chineseName(comActMicroWishVO1.getResponsibleName())); |
| | | }); |
| | | iPage.setRecords(records); |
| | | } |
| | |
| | | if(!idList.isEmpty()){ |
| | | comActMicroWishVO.setIdList(idList); |
| | | } |
| | | //查询处理人 |
| | | comActMicroWishVO.setResponsibleName(this.getWishHandleName(comActMicroWishVO.getHandleId())); |
| | | return R.ok(comActMicroWishVO); |
| | | } |
| | | /** |
| | | * 心愿详情 - 脱敏 |
| | | * |
| | | * @param id 查询主键 |
| | | * @param userId 登录用户id |
| | | * @return 心愿内容 |
| | | */ |
| | | @Override |
| | | public R detailMicroWishDesensitize(Long id, Long userId) { |
| | | ComActMicroWishVO comActMicroWishVO = comActMicroWishDAO.detailMicroWish(id); |
| | | if (ObjectUtils.isEmpty(comActMicroWishVO)) { |
| | | return R.fail("微心愿不存在"); |
| | | } |
| | | Integer starNum = comActMicroWishVO.getStarNum(); |
| | | if (null==starNum) { |
| | | comActMicroWishVO.setStarNum(0); |
| | | } |
| | | if (ObjectUtils.isEmpty(comActMicroWishVO)) { |
| | | return R.fail("心愿不存在"); |
| | | } |
| | | if(userId != null){ |
| | | ComActMicroWishUserDO comActMicroWishUserDO = comActMicroWishUserDAO.selectOne(new QueryWrapper<ComActMicroWishUserDO>().lambda().eq(ComActMicroWishUserDO::getUserId, userId).eq(ComActMicroWishUserDO::getMicroWishId, id)); |
| | | if (ObjectUtils.isEmpty(comActMicroWishUserDO)) { |
| | | comActMicroWishVO.setHaveGiveThumbsUp(0); |
| | | }else { |
| | | comActMicroWishVO.setHaveGiveThumbsUp(1); |
| | | } |
| | | } |
| | | //查询反馈列表 |
| | | List<ComActMicroWishFeedbackVO> feedList=comActMicroWishFeedbackMapper.selectByWishId(id); |
| | | if(!feedList.isEmpty()){ |
| | | for (ComActMicroWishFeedbackVO comActMicroWishFeedbackVO : feedList) { |
| | | comActMicroWishFeedbackVO.setName(DesensitizedUtil.chineseName(comActMicroWishFeedbackVO.getName())); |
| | | } |
| | | comActMicroWishVO.setFeedbackVOList(feedList); |
| | | } |
| | | //查询操作记录 |
| | | List<ComActMicroWishOperationRecordVO> operationList=comActMicroWishOperationRecordMapper.getByWishId(id); |
| | | if(!operationList.isEmpty()){ |
| | | comActMicroWishVO.setOperationRecordVOList(operationList); |
| | | } |
| | | comActMicroWishVO.setSponsorPhone(SensitiveUtil.desensitizedPhoneNumber(comActMicroWishVO.getSponsorPhone())); |
| | | comActMicroWishVO.setSponsorName(DesensitizedUtil.chineseName(comActMicroWishVO.getSponsorName())); |
| | | comActMicroWishVO.setResponsibleName(DesensitizedUtil.chineseName(comActMicroWishVO.getResponsibleName())); |
| | | //查询同类型id数组 |
| | | List<Long> idList=comActMicroWishOperationRecordMapper.selectId(comActMicroWishVO); |
| | | if(!idList.isEmpty()){ |
| | | comActMicroWishVO.setIdList(idList); |
| | | } |
| | | //查询处理人 |
| | | comActMicroWishVO.setResponsibleName(DesensitizedUtil.chineseName(this.getWishHandleName(comActMicroWishVO.getHandleId()))); |
| | | return R.ok(comActMicroWishVO); |
| | | } |
| | | |
| | |
| | | comActMicroWishDO.setResponsibleId(responsibleId); |
| | | comActMicroWishDO.setStatus(3);//进行中 |
| | | comActMicroWishDO.setForm(1); |
| | | if(comActMicroWishVO.getHandleIds() != null && comActMicroWishVO.getHandleIds().size() > 0){ |
| | | comActMicroWishDO.setHandleId(Joiner.on(",").join(comActMicroWishVO.getHandleIds())); |
| | | } |
| | | //添加操作记录 |
| | | comActMicroWishOperationRecordDO.setType(ComActMicroWishOperationRecordDO.type.fp); |
| | | comActMicroWishOperationRecordDO.setContent("分配心愿"); |
| | | comActMicroWishOperationRecordDO.setRemark("分配心愿"); |
| | | comActMicroWishOperationRecordDO.setUserId(responsibleId); |
| | | comActMicroWishOperationRecordMapper.insert(comActMicroWishOperationRecordDO); |
| | | |
| | | //添加分配人员 |
| | | if(comActMicroWishVO.getHandleList() != null && comActMicroWishVO.getHandleList().size() > 0){ |
| | | comActMicroWishVO.getHandleList().forEach(handle -> { |
| | | easyPhotoHandlerService.addHandleRecord(microWishDO.getCommunityId(),handle.getUserId() |
| | | ,microWishDO.getId(),handle.getType(), ComActEasyPhotoHandler.ServiceType.WXY,comActMicroWishVO.getSponsorId()); |
| | | }); |
| | | } |
| | | break; |
| | | case 4: |
| | | isUpdate = true; |
| | |
| | | comActMicroWishDO.setResponsibleId(responsibleId); |
| | | comActMicroWishDO.setStatus(3);//待确认 |
| | | comActMicroWishDO.setForm(2); |
| | | if(comActMicroWishVO.getHandleIds() != null && comActMicroWishVO.getHandleIds().size() > 0){ |
| | | comActMicroWishDO.setHandleId(Joiner.on(",").join(comActMicroWishVO.getHandleIds())); |
| | | } |
| | | //添加操作记录 |
| | | comActMicroWishOperationRecordDO.setType(ComActMicroWishOperationRecordDO.type.fp); |
| | | comActMicroWishOperationRecordDO.setContent("分配心愿"); |
| | |
| | | |
| | | @Override |
| | | public R timedTaskActMicroWishAll() { |
| | | |
| | | //微心愿自动确认前需要添加操作记录 |
| | | List<Long> wishIds = comActMicroWishDAO.getWishAutoConfirmIds(); |
| | | wishIds.forEach(wishId -> { |
| | | //需要添加操作记录 |
| | | wishOperationRecordService.addOperationRecord("系统自动确认微心愿",null |
| | | ,wishId, ComActMicroWishOperationRecordDO.type.zd,"系统自动确认微心愿",null); |
| | | }); |
| | | int num=comActMicroWishDAO.updateStatusAutoConfirm(); |
| | | log.info("定时任务--修改待自动确认微心愿状态数量【{}】",num); |
| | | return R.ok(); |
| | |
| | | } |
| | | return R.ok(microListVOIPage); |
| | | } |
| | | |
| | | /** |
| | | * 微心愿处理人列表 |
| | | * @param communityId 社区id |
| | | * @param type 处理人类型(1.后台用户 2.党员 3.志愿者) |
| | | * @return 处理人列表 |
| | | */ |
| | | @Override |
| | | public R wishHandleListAdmin(Long communityId,Integer type){ |
| | | return R.ok(comActMicroWishDAO.getWishHandleListAdmin(type,communityId)); |
| | | } |
| | | |
| | | /** |
| | | * 拼接处理人 |
| | | * @param handleId 处理人id字符串 |
| | | * @return 处理人名称 |
| | | */ |
| | | private String getWishHandleName(String handleId){ |
| | | StringBuffer sb = new StringBuffer(); |
| | | if(StringUtils.isNotEmpty(handleId)){ |
| | | String []handleIds = handleId.split(","); |
| | | if(handleIds.length > 0){ |
| | | for (String id : handleIds) { |
| | | SysUserVO user = comActMicroWishDAO.getUserByUserId(Long.parseLong(id)); |
| | | if(user != null){ |
| | | if(user.getType().equals(SysUserVO.type.xcx)){ |
| | | if(user.getIsPartymember().equals(SysUserVO.isOk.yes)){ |
| | | sb.append(user.getName() + "(党员),"); |
| | | }else if(user.getIsVolunteer().equals(SysUserVO.isOk.yes)){ |
| | | sb.append(user.getName() + "(志愿者),"); |
| | | }else{ |
| | | sb.append(user.getName()); |
| | | } |
| | | }else if(user.getType().equals(SysUserVO.type.sqht)){ |
| | | sb.append(user.getName() + "(后台用户),"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | String result = sb.toString(); |
| | | if(result.length() > 0){ |
| | | result = result.substring(0,result.length()-1); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 社区后台分页查询微心愿 |
| | | * @param comActMicroWishVO 请求参数 |
| | | * @return 微心愿列表 |
| | | */ |
| | | @Override |
| | | public R pageMicroWishAdmin(ComActMicroWishVO comActMicroWishVO) { |
| | | Long userId = comActMicroWishVO.getResponsibleId(); |
| | | IPage<ComActMicroWishVO> iPage = comActMicroWishDAO.pageMicroWishAdmin(new Page(comActMicroWishVO.getPageNum() |
| | | ,comActMicroWishVO.getPageSize()), comActMicroWishVO); |
| | | |
| | | iPage.getRecords().forEach(comActMicroWishVO1 -> { |
| | | if(userId != null){ |
| | | Long id = comActMicroWishVO1.getId(); |
| | | ComActMicroWishUserDO comActMicroWishUserDO = comActMicroWishUserDAO.selectOne(new QueryWrapper<ComActMicroWishUserDO>().lambda().eq(ComActMicroWishUserDO::getMicroWishId, id) |
| | | .eq(ComActMicroWishUserDO::getUserId, userId)); |
| | | if (ObjectUtils.isEmpty(comActMicroWishUserDO)) { |
| | | comActMicroWishVO1.setHaveGiveThumbsUp(0); |
| | | } else { |
| | | comActMicroWishVO1.setHaveGiveThumbsUp(1); |
| | | } |
| | | } |
| | | comActMicroWishVO1.setSponsorPhone(SensitiveUtil.desensitizedPhoneNumber(comActMicroWishVO1.getSponsorPhone())); |
| | | //查询处理人 |
| | | comActMicroWishVO1.setResponsibleName(this.getWishHandleName(comActMicroWishVO1.getHandleId())); |
| | | }); |
| | | return R.ok(iPage); |
| | | } |
| | | } |