| | |
| | | package com.panzhihua.service_dangjian.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | 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.panzhihua.common.model.dtos.partybuilding.NeedProblemInventoryDTO; |
| | | import com.panzhihua.common.model.dtos.partybuilding.UserRankDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.jinhui.JinhuiExperienceActivityVO; |
| | | import com.panzhihua.common.model.vos.user.SysUserVO; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import com.panzhihua.common.utlis.WxUtil; |
| | | import com.panzhihua.common.utlis.WxXCXTempSend; |
| | | import com.panzhihua.service_dangjian.dao.NeedProblemInventoryDAO; |
| | | import com.panzhihua.service_dangjian.dao.NewStriveForDAO; |
| | | import com.panzhihua.service_dangjian.service.NeedProblemInventoryService; |
| | | import com.panzhihua.service_dangjian.service.NewStriveForService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | implements NeedProblemInventoryService |
| | | { |
| | | |
| | | @Resource |
| | | private UserService userService; |
| | | |
| | | @Override |
| | | public IPage<NeedProblemInventoryDTO> getList(int pageNum, int pageSize, String kind, String userId,String communityId) |
| | | public IPage<NeedProblemInventoryDTO> getList(int pageNum, int pageSize,String search,String classifyId,String status, |
| | | String kind, |
| | | String userId, |
| | | String userIds, |
| | | String communityId) |
| | | { |
| | | Page page = new Page<>(pageNum,pageSize); |
| | | return baseMapper.getList(page,kind,userId,communityId); |
| | | return baseMapper.getList(page, search, classifyId,status,kind,userId,userIds,communityId); |
| | | } |
| | | |
| | | @Override |
| | | public NeedProblemInventoryDTO getDetails(String id) { |
| | | return baseMapper.getDetails(id); |
| | | public IPage<NeedProblemInventoryDTO> getMyJoinList(int pageNum, int pageSize,String search,String status, |
| | | String kind, |
| | | String userIds, |
| | | String userId) { |
| | | Page page = new Page<>(pageNum,pageSize); |
| | | return baseMapper.getMyJoinList(page, search, status,kind,userIds,userId); |
| | | } |
| | | |
| | | @Override |
| | | public int addData(NeedProblemInventoryDTO item) { |
| | | return baseMapper.addData(item); |
| | | public NeedProblemInventoryDTO getDetails(String id,String userIds) { |
| | | return baseMapper.getDetails(id,userIds); |
| | | } |
| | | |
| | | @Override |
| | | public int addData(NeedProblemInventoryDTO item) |
| | | { |
| | | item.setStatus("1"); |
| | | int num=baseMapper.addData(item); |
| | | //1问题清单 2需求清单 |
| | | if(num>0) |
| | | { |
| | | List<String> openIdList=baseMapper.getOpenIdList(item.getCommunityId()); |
| | | if(openIdList==null || openIdList.size()<=0) |
| | | { |
| | | return num; |
| | | } |
| | | if(item.getKind().equals("1")) |
| | | { |
| | | WxXCXTempSend util = new WxXCXTempSend(); |
| | | try { |
| | | for (String str:openIdList) |
| | | { |
| | | WxUtil.sendLongTimeTemplate(str,util.getAccessToken(),"问题清单发布提醒",item.getTitle(),"/packageH/pages/problemDetail/problemDetail?type=1&id="+item.getId()); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return num; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WxXCXTempSend util = new WxXCXTempSend(); |
| | | try { |
| | | for (String str:openIdList) |
| | | { |
| | | WxUtil.sendLongTimeTemplate(str,util.getAccessToken(),"需求清单发布提醒",item.getTitle(),"/packageH/pages/problemDetail/problemDetail?type=2&id="+item.getId()); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return num; |
| | | } |
| | | } |
| | | } |
| | | return num; |
| | | } |
| | | |
| | | @Override |
| | |
| | | public int expurgateData(String id) { |
| | | return baseMapper.expurgateData(id); |
| | | } |
| | | |
| | | @Override |
| | | public R timedNewFightNeedProblemInventoryHandler() { |
| | | // 定时任务 |
| | | List<NeedProblemInventoryDTO> list = baseMapper.getTimeList(); |
| | | |
| | | for (NeedProblemInventoryDTO item : list) { |
| | | //当前时间 |
| | | long newTime = System.currentTimeMillis(); |
| | | //活动报名时间 |
| | | long applyStartTime = item.getClaimStartTime().getTime(); |
| | | //报名结束时间 |
| | | long applyEndTime = item.getClaimEndTime().getTime(); |
| | | //活动开始时间 |
| | | long activityStartTime = item.getNeedStartTime().getTime(); |
| | | //活动结束时间 |
| | | long activityEndTime = item.getNeedEndTime().getTime(); |
| | | |
| | | |
| | | switch (item.getStatus()) { |
| | | //待开始 |
| | | case "1": |
| | | if (newTime >= applyStartTime && newTime <= applyEndTime) { |
| | | NeedProblemInventoryDTO vo = new NeedProblemInventoryDTO(); |
| | | vo.setId(item.getId()); |
| | | vo.setStatus("1"); |
| | | baseMapper.editData(vo); |
| | | } |
| | | |
| | | if (newTime > applyEndTime && newTime < activityStartTime) { |
| | | //报名结束 |
| | | NeedProblemInventoryDTO vo = new NeedProblemInventoryDTO(); |
| | | vo.setId(item.getId()); |
| | | vo.setStatus("2"); |
| | | baseMapper.editData(vo); |
| | | } |
| | | |
| | | break; |
| | | //报名中 |
| | | case "2": |
| | | if (newTime >= activityStartTime && newTime <= activityEndTime) { |
| | | NeedProblemInventoryDTO vo = new NeedProblemInventoryDTO(); |
| | | vo.setId(item.getId()); |
| | | vo.setStatus("2"); |
| | | baseMapper.editData(vo); |
| | | } |
| | | break; |
| | | //已开始 |
| | | case "3": |
| | | if (newTime <= activityEndTime) { |
| | | NeedProblemInventoryDTO vo = new NeedProblemInventoryDTO(); |
| | | vo.setId(item.getId()); |
| | | vo.setStatus("3"); |
| | | baseMapper.editData(vo); |
| | | } |
| | | break; |
| | | } |
| | | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | } |