| | |
| | | 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.ComActMicroWishOperationRecordService; |
| | | import com.panzhihua.service_community.service.ComActMicroWishService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private ComActMicroWishFeedbackMapper comActMicroWishFeedbackMapper; |
| | | @Resource |
| | | private ComActMicroWishOperationRecordMapper comActMicroWishOperationRecordMapper; |
| | | @Resource |
| | | private ComActMicroWishOperationRecordService wishOperationRecordService; |
| | | /** |
| | | * 分页查询微心愿 |
| | | * |
| | |
| | | page.setCurrent(pageNum); |
| | | IPage<ComActMicroWishVO> iPage = comActMicroWishDAO.pageMicroWish(page, 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())); |
| | | }); |
| | | iPage.setRecords(records); |
| | | } |
| | | return R.ok(iPage); |
| | | } |
| | | |
| | | @Override |
| | | public R pageMicroWishApplets(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 -> { |
| | |
| | | String feedbackPhotoPathList = comActMicroWishVO.getFeedbackPhotoPathList(); |
| | | ComActMicroWishDO comActMicroWishDO=new ComActMicroWishDO(); |
| | | comActMicroWishDO.setId(id); |
| | | Boolean isUpdate = false; |
| | | Date date = new Date(); |
| | | ComActMicroWishOperationRecordDO comActMicroWishOperationRecordDO=new ComActMicroWishOperationRecordDO(); |
| | | comActMicroWishOperationRecordDO.setCreateTime(date); |
| | |
| | | // 1 审核通过 2驳回 3分配人员 4发起活动 5反馈 |
| | | switch (type){ |
| | | case 1: |
| | | isUpdate = true; |
| | | if(!microWishDO.getStatus().equals(ComActMicroWishDO.status.dsh)){ |
| | | return R.fail("该微心愿已审核,不可重复审核"); |
| | | } |
| | |
| | | comActMicroWishDO.setStatus(7);//集心中 |
| | | comActMicroWishOperationRecordDO.setType(ComActMicroWishOperationRecordDO.type.sh); |
| | | comActMicroWishOperationRecordDO.setContent("审核通过"); |
| | | comActMicroWishOperationRecordDO.setRemark("微心愿审核通过"); |
| | | comActMicroWishOperationRecordMapper.insert(comActMicroWishOperationRecordDO); |
| | | break; |
| | | case 2: |
| | | isUpdate = true; |
| | | if(!microWishDO.getStatus().equals(ComActMicroWishDO.status.dsh)){ |
| | | return R.fail("该微心愿已审核,不可重复审核"); |
| | | } |
| | |
| | | comActMicroWishDO.setStatus(4);//驳回 |
| | | comActMicroWishOperationRecordDO.setType(ComActMicroWishOperationRecordDO.type.bh); |
| | | comActMicroWishOperationRecordDO.setContent(rejectReason); |
| | | comActMicroWishOperationRecordDO.setRemark("微心愿审核未通过"); |
| | | comActMicroWishOperationRecordMapper.insert(comActMicroWishOperationRecordDO); |
| | | break; |
| | | case 3: |
| | | isUpdate = true; |
| | | comActMicroWishDO.setDistributionAt(date); |
| | | comActMicroWishDO.setResponsibleId(responsibleId); |
| | | comActMicroWishDO.setStatus(3);//进行中 |
| | | comActMicroWishDO.setForm(1); |
| | | //添加操作记录 |
| | | comActMicroWishOperationRecordDO.setType(ComActMicroWishOperationRecordDO.type.fp); |
| | | comActMicroWishOperationRecordDO.setContent("分配心愿"); |
| | | comActMicroWishOperationRecordDO.setRemark("分配心愿"); |
| | | comActMicroWishOperationRecordDO.setUserId(responsibleId); |
| | | comActMicroWishOperationRecordMapper.insert(comActMicroWishOperationRecordDO); |
| | | break; |
| | | case 4: |
| | | isUpdate = true; |
| | | comActMicroWishDO.setDistributionAt(date); |
| | | comActMicroWishDO.setResponsibleId(responsibleId); |
| | | comActMicroWishDO.setStatus(3);//待确认 |
| | | comActMicroWishDO.setForm(2); |
| | | //添加操作记录 |
| | | comActMicroWishOperationRecordDO.setType(ComActMicroWishOperationRecordDO.type.fp); |
| | | comActMicroWishOperationRecordDO.setContent("分配心愿"); |
| | | comActMicroWishOperationRecordDO.setRemark("分配心愿"); |
| | | comActMicroWishOperationRecordDO.setUserId(responsibleId); |
| | | comActMicroWishOperationRecordMapper.insert(comActMicroWishOperationRecordDO); |
| | | break; |
| | | case 5: |
| | | if(comActMicroWishVO.getFeedback().length() > 200){ |
| | |
| | | comActMicroWishFeedbackDO.setImgUrl(feedbackPhotoPathList); |
| | | comActMicroWishFeedbackDO.setMicroId(comActMicroWishVO.getId()); |
| | | comActMicroWishFeedbackDO.setUserId(comActMicroWishVO.getUserId()); |
| | | if(comActMicroWishVO.getStatus() != null && comActMicroWishVO.getStatus().equals(ComActMicroWishDO.status.ywc)){ |
| | | comActMicroWishDO.setStatus(comActMicroWishVO.getStatus()); |
| | | if(comActMicroWishVO.getStatus() != null && comActMicroWishVO.getStatus().equals(ComActMicroWishDO.status.dqr)){ |
| | | isUpdate = true; |
| | | comActMicroWishDO.setStatus(ComActMicroWishDO.status.dqr); |
| | | comActMicroWishDO.setFinishAt(date); |
| | | comActMicroWishDO.setFinish(feedback); |
| | | comActMicroWishDO.setFinishPhotoPathList(feedbackPhotoPathList); |
| | | |
| | | //添加操作记录 |
| | | comActMicroWishOperationRecordDO.setType(ComActMicroWishOperationRecordDO.type.fk); |
| | | comActMicroWishOperationRecordDO.setContent(feedback); |
| | | comActMicroWishOperationRecordDO.setRemark("心愿已完成"); |
| | | comActMicroWishOperationRecordDO.setImgUrl(feedbackPhotoPathList); |
| | | comActMicroWishOperationRecordMapper.insert(comActMicroWishOperationRecordDO); |
| | | }else{ |
| | | //添加操作记录 |
| | | comActMicroWishOperationRecordDO.setType(ComActMicroWishOperationRecordDO.type.fk); |
| | | comActMicroWishOperationRecordDO.setContent(feedback); |
| | | comActMicroWishOperationRecordDO.setRemark("社区反馈"); |
| | | comActMicroWishOperationRecordDO.setImgUrl(feedbackPhotoPathList); |
| | | comActMicroWishOperationRecordMapper.insert(comActMicroWishOperationRecordDO); |
| | | } |
| | | // else { |
| | | // comActMicroWishDO.setStatus(3); |
| | | // } |
| | | comActMicroWishFeedbackMapper.insert(comActMicroWishFeedbackDO); |
| | | return R.ok(); |
| | | default: |
| | | break; |
| | | } |
| | | int update = comActMicroWishDAO.updateById(comActMicroWishDO); |
| | | if (update>0) { |
| | | if(isUpdate){ |
| | | int update = comActMicroWishDAO.updateById(comActMicroWishDO); |
| | | if (update>0) { |
| | | return R.ok(); |
| | | } |
| | | }else{ |
| | | return R.ok(); |
| | | } |
| | | return R.fail(); |
| | |
| | | comActMicroWishDO.setStatus(ComActMicroWishDO.status.dfp); |
| | | comActMicroWishDO.setFeedbackAt(DateUtil.date()); |
| | | comActMicroWishDAO.updateById(comActMicroWishDO); |
| | | |
| | | //完成集心添加操作记录 |
| | | wishOperationRecordService.addOperationRecord("完成集心",comActMicroWishDO.getSponsorId() |
| | | ,comActMicroWishDO.getId(),ComActMicroWishOperationRecordDO.type.jx,"用户完成集心",null); |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | return R.fail("心愿不存在"); |
| | | } |
| | | Integer status = comActMicroWishDO1.getStatus(); |
| | | if (!status.equals(ComActMicroWishDO.status.ywc)) { |
| | | return R.fail("心愿状态不是已完成状态"); |
| | | if (!status.equals(ComActMicroWishDO.status.dqr)) { |
| | | return R.fail("心愿状态不是待确认状态"); |
| | | } |
| | | ComActMicroWishDO comActMicroWishDO=new ComActMicroWishDO(); |
| | | comActMicroWishDO.setId(comActMicroWishVO.getId()); |
| | |
| | | comActMicroWishDO.setEvaluate(comActMicroWishVO.getEvaluate()); |
| | | int update = comActMicroWishDAO.updateById(comActMicroWishDO); |
| | | if (update>0) { |
| | | //用户确认心愿添加操作记录 |
| | | wishOperationRecordService.addOperationRecord(comActMicroWishVO.getEvaluate(),comActMicroWishDO1.getSponsorId() |
| | | ,comActMicroWishDO1.getId(),ComActMicroWishOperationRecordDO.type.wc,"用户已确认",null); |
| | | return R.ok(); |
| | | } |
| | | return R.fail(); |
| | |
| | | |
| | | @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(); |