From 2d67ba59730e4eef58d79de8827a70dbe8e0db5c Mon Sep 17 00:00:00 2001 From: lidongdong <1459917685@qq.com> Date: 星期二, 14 十一月 2023 15:09:04 +0800 Subject: [PATCH] 微心愿认领 --- springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/NewStriveAppApi.java | 132 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 132 insertions(+), 0 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/NewStriveAppApi.java b/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/NewStriveAppApi.java index 239e52f..27f61ae 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/NewStriveAppApi.java +++ b/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/NewStriveAppApi.java @@ -1,13 +1,23 @@ package com.panzhihua.applets.api; +import com.alibaba.fastjson.JSONObject; import com.panzhihua.common.controller.BaseController; import com.panzhihua.common.model.dtos.partybuilding.*; import com.panzhihua.common.model.vos.R; +import com.panzhihua.common.model.vos.community.ComActMicroWishVO; +import com.panzhihua.common.model.vos.user.SysTemplateConfigVO; +import com.panzhihua.common.model.vos.user.SysUserNoticeVO; +import com.panzhihua.common.service.community.CommunityService; import com.panzhihua.common.service.partybuilding.NewStriveForFeign; +import com.panzhihua.common.service.user.UserService; +import com.panzhihua.common.utlis.DateUtils; import com.panzhihua.common.utlis.StringUtils; +import com.panzhihua.common.utlis.WxUtil; +import com.panzhihua.common.utlis.WxXCXTempSend; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -393,4 +403,126 @@ } + /******************************************************************************************************************* + * + * + * + * ****************************************************************************************************************/ + + @Resource + private UserService userService; + @Resource + private CommunityService communityService; + + @ApiOperation(value = "微心愿app一键认领") + @PutMapping("/putmicrowish") + public R putlMicroWish(@RequestBody ComActMicroWishVO comActMicroWishVO) { + Long id = comActMicroWishVO.getId(); + Long userId = this.getUserId(); + if (ObjectUtils.isEmpty(id)) { + return R.fail("心愿主键不能为空"); + } + Integer type = comActMicroWishVO.getType(); + if (ObjectUtils.isEmpty(type) || type > 5 || type < 1) { + return R.fail("操作类型不对"); + } + comActMicroWishVO.setUserId(userId); + R r = communityService.putlMicroWish(comActMicroWishVO); + if (R.isOk(r)) { + if (R.isOk(r)) { + // 1 审核通过 2驳回 3分配人员 4发起活动 5反馈 + R r1 = communityService.detailMicroWish(id, userId); + Object data = r1.getData(); + ComActMicroWishVO comActMicroWishVO1 = + JSONObject.parseObject(JSONObject.toJSONString(data), ComActMicroWishVO.class); + // 查询用户openid + R userResult = userService.getUserOpenId(comActMicroWishVO1.getSponsorId()); + if (R.isOk(r1)) { + SysUserNoticeVO sysUserNoticeVO = new SysUserNoticeVO(); + sysUserNoticeVO.setUserId(comActMicroWishVO1.getSponsorId()); + sysUserNoticeVO.setType(2); + sysUserNoticeVO.setBusinessType(3); + sysUserNoticeVO.setBusinessTitle(comActMicroWishVO1.getWishName()); + sysUserNoticeVO.setBusinessTime(comActMicroWishVO1.getExamineAt()); + sysUserNoticeVO.setBusinessId(id); + sysUserNoticeVO.setStatus(0); + if (type.intValue() == 2) { + sysUserNoticeVO.setTitle("微心愿未通过审核"); + sysUserNoticeVO + .setBusinessContent(String.format("驳回原因:%s", comActMicroWishVO1.getRejectReason())); + sysUserNoticeVO.setBusinessStatus(1); + R r2 = userService.addNotice(sysUserNoticeVO); + if (R.isOk(r2)) { + log.info("新增微心愿未通过审核通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO)); + } + if (R.isOk(userResult)) { + String openid = userResult.getData().toString(); + WxXCXTempSend util = new WxXCXTempSend(); + try { + String result = comActMicroWishVO1.getRejectReason(); + if (StringUtils.isNotEmpty(result)) { + result = result.substring(0, 4); + result += "…"; + } + R<SysTemplateConfigVO> sysTemplateConfigVO=userService.selectTemplate(this.getAreaCode(),4); + WxUtil.sendSubscribeSHZT(openid, util.getAccessToken(), "微心愿", + DateUtils.format(comActMicroWishVO1.getExamineAt(), DateUtils.ymdhms_format), + result,sysTemplateConfigVO.getData().getTemplateId()); + } catch (Exception e) { + log.error("消息推送失败,失败原因:" + e.getMessage()); + } + } + } else if (type.intValue() == 5) { + sysUserNoticeVO.setTitle("微心愿已完成"); + sysUserNoticeVO.setBusinessContent(comActMicroWishVO.getFeedback()); + sysUserNoticeVO.setBusinessStatus(2); + R r2 = userService.addNotice(sysUserNoticeVO); + if (R.isOk(r2)) { + log.info("新增微心愿已完成通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO)); + } + } else if (type.intValue() == 3) { + sysUserNoticeVO.setTitle("微心愿已分配负责人"); + sysUserNoticeVO.setBusinessContent("负责人会在近日和你联系,请保持电话畅通"); + sysUserNoticeVO.setBusinessStatus(2); + R r2 = userService.addNotice(sysUserNoticeVO); + if (R.isOk(r2)) { + log.info("新增微心愿已分配负责人通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO)); + } + } else if (type.intValue() == 4) { + sysUserNoticeVO.setTitle("微心愿发起了活动"); + sysUserNoticeVO.setBusinessContent("请关注活动页面及时参加,并邀请你的朋友一起支持我们的活动"); + sysUserNoticeVO.setBusinessStatus(2); + R r2 = userService.addNotice(sysUserNoticeVO); + if (R.isOk(r2)) { + log.info("新增微心愿发起了活动通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO)); + } + } + +// if (type.equals(1)) {// 审核通过给用户增加积分 +// communityService.addIntegralTradeAdmin( +// new AddComActIntegralUserDTO(id, AddComActIntegralUserDTO.integralType.fbwxy, +// this.getCommunityId(), comActMicroWishVO1.getSponsorId())); +// if (R.isOk(userResult)) { +// String openid = userResult.getData().toString(); +// WxXCXTempSend util = new WxXCXTempSend(); +// R<SysTemplateConfigVO> sysTemplateConfigVO=userService.selectTemplate(this.getAreaCode(),4); +// try { +// WxUtil.sendSubscribeSHZT(openid, util.getAccessToken(), "微心愿", +// DateUtils.format(comActMicroWishVO1.getExamineAt(), DateUtils.ymdhms_format), +// "审核通过",sysTemplateConfigVO.getData().getTemplateId()); +// } catch (Exception e) { +// log.error("消息推送失败,失败原因:" + e.getMessage()); +// } +// } +// } + } + } + } + return r; + } + + + + + } -- Gitblit v1.7.1