From e4cdfe7a09e6bf431965359e319e671f1f17b24e Mon Sep 17 00:00:00 2001
From: lidongdong <1459917685@qq.com>
Date: 星期一, 03 六月 2024 11:18:40 +0800
Subject: [PATCH] 花城 议事投票评论删除 评论数不正确2
---
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/CodDataServiceImpl.java | 230 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 224 insertions(+), 6 deletions(-)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/CodDataServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/CodDataServiceImpl.java
index 97859ca..c9c6ac6 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/CodDataServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/CodDataServiceImpl.java
@@ -1,27 +1,40 @@
package com.panzhihua.service_community.service.impl;
+import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.panzhihua.common.model.vos.R;
-import com.panzhihua.service_community.model.dos.Highlist;
-import com.panzhihua.service_community.model.dos.Middlelist;
-import com.panzhihua.service_community.model.dos.ReturnData;
+import com.panzhihua.service_community.dao.*;
+import com.panzhihua.service_community.entity.ComPbCheckUnit;
+import com.panzhihua.service_community.entity.SysUser;
+import com.panzhihua.service_community.model.dos.*;
import com.panzhihua.service_community.service.CodDataService;
+import com.panzhihua.service_community.service.ComActActivityService;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
+import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
+import java.io.IOException;
+import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
+import java.time.Duration;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+import java.util.stream.Collectors;
/**
* @title: BigScreenStatisticsServiceImpl
@@ -80,6 +93,211 @@
List<Highlist> highlist=returnData.getHighlist();
List<Middlelist> middlelist=returnData.getMiddlelist();
}
+ //查社区的表
+ @Autowired
+ private ComActDAO comActDAO;
+ //单位表
+ @Autowired
+ private ComPbCheckUnitDao comPbCheckUnitDao;
+ //用户表
+ @Autowired
+ private SysUserDao sysUserDao;
+ //社区活动表
+ @Autowired
+ private ComActActivityDAO comActActivityDAO;
+ @Autowired
+ private ComActActivityService comActActivityService;
+ //活动报名表
+ @Autowired
+ private ComActActSignDAO comActActSignDAO;
+ //签到表
+ @Autowired
+ private ComActActRegistDAO comActActRegistDAO;
+
+ public static void main(String[] args) {
+ HashSet<Map<String,String>> set = new HashSet<>();
+
+ for (int i = 0; i < 10; i++) {
+ Map<String,String> map = new HashMap<>();
+ map.put("1","2");
+ set.add(map);
+ }
+ for (Map<String, String> map : set) {
+ System.out.println(map);
+ }
+
+ }
+
+ @Transactional(rollbackFor = Exception.class)
+ @Override
+ public void importData(MultipartFile file) throws IOException {
+// InputStream inputStream = file.getInputStream();
+// Workbook workbook = new XSSFWorkbook(inputStream);
+// Sheet sheet = workbook.getSheetAt(0);
+//
+// List<String> signAndRegist = new ArrayList<>();
+// //key: 活动名称 value:社区id
+// MultiValueMap<String, String> map1 = new LinkedMultiValueMap<>();
+// //key:活动名称 value: 活动开始时间
+// MultiValueMap<String, Date> dateHashMap = new LinkedMultiValueMap<>();
+//
+// List<String> list = new ArrayList<>();
+// int totalRowNum = sheet.getLastRowNum();
+// for (int i = 1; i <= totalRowNum; i++){
+// Row row = sheet.getRow(i);
+// row.getCell(2).setCellType(CellType.STRING);
+// String cellValue1 = row.getCell(2).getStringCellValue();
+// list.add(cellValue1);
+// }
+// Map<String, Long> map = list.stream().collect(Collectors.groupingBy(s -> s, Collectors.counting()));
+// for (int i = 1; i <= totalRowNum; i++) {
+// Row row = sheet.getRow(i);
+// System.out.println("第几行:" + i);
+// //党组织名称
+// row.getCell(1).setCellType(CellType.STRING);
+// String cellValue = row.getCell(1).getStringCellValue();
+// //活动名称
+// row.getCell(2).setCellType(CellType.STRING);
+// String cellValue1 = row.getCell(2).getStringCellValue();
+// //活动内容
+// row.getCell(3).setCellType(CellType.STRING);
+// String cellValue2 = row.getCell(3).getStringCellValue();
+// //活动时长
+// row.getCell(4).setCellType(CellType.STRING);
+// String cellValue3 = row.getCell(4).getStringCellValue();
+// //活动所在社区名称
+// row.getCell(5).setCellType(CellType.STRING);
+// String cellValue4 = row.getCell(5).getStringCellValue();
+// ComActDO comAct = comActDAO.queryByName(cellValue4);
+// //参加活动党员姓名
+// row.getCell(6).setCellType(CellType.STRING);
+// String cellValue6 = row.getCell(6).getStringCellValue();
+// QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
+//// wrapper.eq("community_id",comAct.getCommunityId());
+// wrapper.eq("app_id","wx118de8a734d269f0");
+// wrapper.eq("name",cellValue6);
+// wrapper.eq("status",1);
+// List<SysUser> sysUsers = sysUserDao.selectList(wrapper);
+// if(CollectionUtil.isEmpty(sysUsers)){
+// continue;
+// }
+// Long userId = sysUsers.get(0).getUserId();
+// //单位
+// row.getCell(7).setCellType(CellType.STRING);
+// String cellValue7 = row.getCell(7).getStringCellValue();
+//
+// //管理员
+// row.getCell(8).setCellType(CellType.STRING);
+// String cellValue8 = row.getCell(8).getStringCellValue();
+//
+// QueryWrapper<ComPbCheckUnit> queryWrapper = new QueryWrapper<>();
+// queryWrapper.eq("name",cellValue7);
+// queryWrapper.eq("belong_to","仁和区");
+// ComPbCheckUnit comPbCheckUnit = comPbCheckUnitDao.selectOne(queryWrapper);
+//
+// //活动发布时间
+// Date date = row.getCell(10).getDateCellValue();
+// //活动开始报名时间
+// Date date1 = row.getCell(11).getDateCellValue();
+// //活动结束报名时间
+// Date date2 = row.getCell(12).getDateCellValue();
+// //活动开始时间
+// Date date3 = row.getCell(13).getDateCellValue();
+// //活动结束时间
+// Date date4 = row.getCell(14).getDateCellValue();
+//
+// ComActActivityDO comActActivity = new ComActActivityDO();
+// comActActivity.setActivityName(cellValue1);
+// comActActivity.setActivityAddr(comAct.getAddress());
+// comActActivity.setLng(comAct.getLng());
+// comActActivity.setLat(comAct.getLat());
+// // comActActivity.setStatus();
+// comActActivity.setPublishAt(date);
+// comActActivity.setSignUpBegin(date1);
+// comActActivity.setSignUpEnd(date2);
+// comActActivity.setBeginAt(date3);
+// comActActivity.setEndAt(date4);
+// comActActivity.setAattendPeople("居民,志愿者,党员");
+// comActActivity.setParticipantMax(-1);
+// comActActivity.setActivityType("志愿服务");
+// comActActivity.setHasPrize(0);
+// comActActivity.setIsQrCode(1);
+// comActActivity.setContactName(cellValue8);
+// comActActivity.setContent(cellValue2);
+// comActActivity.setCommunityId(comAct.getCommunityId());
+// comActActivity.setCreateAt(new Date());
+// int sum = map.get(cellValue1).intValue();
+// comActActivity.setParticipantRewardWay(2);
+// comActActivity.setVolunteerRewardWay(2);
+// comActActivity.setPbRewardWay(2);
+// comActActivity.setDuration(sum * Integer.parseInt(cellValue3));
+// comActActivity.setType(3);
+// comActActivity.setPartyMemberMax(-1);
+// comActActivity.setSignOutRange(1000);
+//
+//
+// if( i == 1){
+// comActActivityService.save(comActActivity);
+// dateHashMap.add(cellValue1,date3);
+// } else {
+// if(dateHashMap.containsKey(cellValue1)){
+// List<Date> dateList = dateHashMap.get(cellValue1);
+// assert dateList != null;
+// if( !dateList.contains(date3)){
+// comActActivityService.save(comActActivity);
+// dateHashMap.add(cellValue1,date3);
+// } else {
+// QueryWrapper<ComActActivityDO> wrapper1 = new QueryWrapper<>();
+// wrapper1.eq("activity_name",cellValue1);
+// wrapper1.eq("begin_at",date3);
+// System.out.println(cellValue1);
+// System.out.println(comAct.getCommunityId());
+// System.out.println(cellValue6);
+// List<ComActActivityDO> doList = comActActivityDAO.selectList(wrapper1);
+// comActActivity.setId(doList.get(doList.size() - 1).getId());
+// }
+// } else {
+// comActActivityService.save(comActActivity);
+// dateHashMap.add(cellValue1,date3);
+// }
+// }
+//
+//
+// System.out.println(comActActivity.getId());
+//
+// if(!signAndRegist.contains(comActActivity.getId() + "-" + userId)) {
+// ComActActSignDO comActActSign = new ComActActSignDO();
+// comActActSign.setActivityId(comActActivity.getId());
+// comActActSign.setUserId(userId);
+// comActActSign.setCreateAt(date1);
+// comActActSign.setSignIdentity(2);
+// comActActSign.setStatus(1);
+// comActActSign.setCheckUnitId(comPbCheckUnit.getId());
+// comActActSignDAO.insert(comActActSign);
+//
+// ComActActRegistDO comActActRegist = new ComActActRegistDO();
+// comActActRegist.setActivityId(comActActivity.getId());
+// comActActRegist.setUserId(userId);
+// comActActRegist.setCreateAt(date3);
+// comActActRegist.setSignIdentity(2);
+// comActActRegist.setCheckUnitId(comPbCheckUnit.getId());
+// comActActRegist.setStartTime(date3);
+//
+// Calendar calendar = Calendar.getInstance();
+// calendar.setTime(date3);
+// calendar.add(Calendar.HOUR_OF_DAY, Integer.parseInt(cellValue3));
+// Date time = calendar.getTime();
+// comActActRegist.setEndTime(time);
+// comActActRegist.setPosition(comAct.getAddress());
+// comActActRegist.setTimes(1);
+// comActActRegist.setCodeId(1768091384461426690L);
+// comActActRegist.setAward(0);
+// comActActRegist.setType(2);
+// comActActRegistDAO.insert(comActActRegist);
+// }
+// signAndRegist.add(comActActivity.getId() + "-" + userId);
+// }
+ }
public static String getSHA256StrJava(String str) {
MessageDigest messageDigest;
--
Gitblit v1.7.1