提交 a0526637 作者: 洪东保

导出数据格式调整

父级 fd3f45f3
...@@ -133,8 +133,8 @@ public class UserServiceImpl implements UserService { ...@@ -133,8 +133,8 @@ public class UserServiceImpl implements UserService {
throw new RobotBaseException("您暂无权限"); throw new RobotBaseException("您暂无权限");
} }
} }
SysUserSync sysUserSync = sysUserSyncMapper.selectOne(new LambdaQueryWrapper<SysUserSync>().eq(SysUserSync::getUserId, userId).select(SysUserSync::getName));
return auth(userId, robotSecurityUser.getNickName(), RecordTemplateConstant.TEMPLATE_TYPE_CUSTOM); return auth(userId, sysUserSync.getName(), RecordTemplateConstant.TEMPLATE_TYPE_CUSTOM);
} }
@Override @Override
......
...@@ -36,6 +36,7 @@ import org.apache.poi.xwpf.usermodel.XWPFRun; ...@@ -36,6 +36,7 @@ import org.apache.poi.xwpf.usermodel.XWPFRun;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -101,7 +102,7 @@ public class MeetingInfoController { ...@@ -101,7 +102,7 @@ public class MeetingInfoController {
} }
@PostMapping("/detail") @PostMapping("/detail")
public R detail(@RequestBody MeetingInfoVO vo) { public R detail(@RequestBody @Validated MeetingInfoVO vo) {
RobotSecurityUser user = SecurityUtil.getUser(); RobotSecurityUser user = SecurityUtil.getUser();
MeetingInfo meetingInfo = meetingInfoService.getById(vo.getId()); MeetingInfo meetingInfo = meetingInfoService.getById(vo.getId());
BeanUtils.copyProperties(meetingInfo, vo); BeanUtils.copyProperties(meetingInfo, vo);
......
...@@ -133,14 +133,24 @@ public class EmailPushTask { ...@@ -133,14 +133,24 @@ public class EmailPushTask {
.emailPushAccess(meetingInfo.getEmailPushAccess()) .emailPushAccess(meetingInfo.getEmailPushAccess())
.build(); .build();
isSuccess = emailSender.sendEmailWithAttachment(emailPushBuilder); isSuccess = emailSender.sendEmailWithAttachment(emailPushBuilder);
if (!isSuccess) {
int currentRetryCount = retryCount.getAndIncrement();
if (currentRetryCount <= MAX_RETRY) {
// 指数退避
try {
Thread.sleep((long) Math.pow(2, currentRetryCount) * 1000);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
log.error("重试失败: {}", ie.getMessage());
}
}
}
} catch (Exception e) { } catch (Exception e) {
// 异常处理 // 异常处理
e.printStackTrace(); e.printStackTrace();
log.error("push email error: {}", e.getMessage()); log.error("push email error: {}", e.getMessage());
int currentRetryCount = retryCount.getAndIncrement(); int currentRetryCount = retryCount.getAndIncrement();
if (currentRetryCount > MAX_RETRY) { if (currentRetryCount <= MAX_RETRY) {
log.error("达到最大重试次数:meetingId {}", meetingId);
}else{
// 指数退避 // 指数退避
try { try {
Thread.sleep((long) Math.pow(2, currentRetryCount) * 1000); Thread.sleep((long) Math.pow(2, currentRetryCount) * 1000);
...@@ -151,6 +161,9 @@ public class EmailPushTask { ...@@ -151,6 +161,9 @@ public class EmailPushTask {
} }
} }
} }
if (retryCount.get() > MAX_RETRY) {
log.error("达到最大重试次数:meetingId {}", meetingId);
}
if (isSuccess != null) { if (isSuccess != null) {
meetingInfoMapper.update(meetingInfo, meetingInfoMapper.update(meetingInfo,
new LambdaUpdateWrapper<MeetingInfo>() new LambdaUpdateWrapper<MeetingInfo>()
......
...@@ -16,7 +16,6 @@ import java.util.List; ...@@ -16,7 +16,6 @@ import java.util.List;
@Mapper @Mapper
public interface MeetingRecordTemplateMapper extends BaseMapper<MeetingRecordTemplate> { public interface MeetingRecordTemplateMapper extends BaseMapper<MeetingRecordTemplate> {
List<MeetingRecordTemplate> getAuthorizedSystemTemplate();
/** /**
* 查询授权的模板-会议类型维度 * 查询授权的模板-会议类型维度
......
...@@ -332,7 +332,25 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti ...@@ -332,7 +332,25 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti
@Override @Override
public void exportRecordTemplateUsingInfo(String searchValue, Date createTimeStart, Date createTimeEnd, HttpServletResponse response) { public void exportRecordTemplateUsingInfo(String searchValue, Date createTimeStart, Date createTimeEnd, HttpServletResponse response) {
List<Map<String, String>> statistics = statistics(searchValue, createTimeStart, createTimeEnd, false); List<Map<String, String>> statistics = statistics(searchValue, createTimeStart, createTimeEnd, false);
if (statistics.isEmpty()) { List<Map<String, String>> list = new ArrayList<>(statistics.size());
for (Map<String, String> map : statistics) {
Map<String, String> temp = new LinkedHashMap<>();
String host = map.get("deptName");
host = host.replace("/中集集团/", "");
String[] split = host.split("/");
temp.put("level1", split[0]);
temp.put("level2", split.length>=2?split[1]:"");
temp.put("level3", split.length>=3?split[2]:"");
temp.put("level4", split.length>=4?split[3]:"");
temp.put("level5", split.length>=5?split[4]:"");
map.remove("deptId");
map.remove("deptName");
temp.putAll(map);
list.add(temp);
}
if (list.isEmpty()) {
List<String> dateList = DateUtil.rangeToList(createTimeStart, createTimeEnd, DateField.DAY_OF_YEAR).stream() List<String> dateList = DateUtil.rangeToList(createTimeStart, createTimeEnd, DateField.DAY_OF_YEAR).stream()
.map(date -> DateUtil.format(date, "yyyy-MM-dd")) .map(date -> DateUtil.format(date, "yyyy-MM-dd"))
.collect(Collectors.toList()); .collect(Collectors.toList());
...@@ -342,18 +360,26 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti ...@@ -342,18 +360,26 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti
map.put("工号", ""); map.put("工号", "");
dateList.forEach(date -> map.put(date, "")); dateList.forEach(date -> map.put(date, ""));
map.put("总计", ""); map.put("总计", "");
statistics.add(map); list.add(map);
} }
int column = statistics.get(0).keySet().size(); int column = list.get(0).keySet().size();
List<Map<String, String>> finalStatistics = new ArrayList<>(); List<Map<String, String>> finalStatistics = new ArrayList<>();
for (Map<String, String> statistic : statistics) { for (Map<String, String> statistic : list) {
Map<String, String> newStatistic = new LinkedHashMap<>(); Map<String, String> newStatistic = new LinkedHashMap<>();
Set<Map.Entry<String, String>> entriedSet = statistic.entrySet(); Set<Map.Entry<String, String>> entriedSet = statistic.entrySet();
for (Map.Entry<String, String> entry : entriedSet) { for (Map.Entry<String, String> entry : entriedSet) {
String key = entry.getKey(); String key = entry.getKey();
String value = entry.getValue(); String value = entry.getValue();
if ("deptName".equals(key)) { if ("level1".equals(key)) {
newStatistic.put("部门", value); newStatistic.put("板块", value);
} else if ("level2".equals(key)) {
newStatistic.put("二级", value);
} else if ("level3".equals(key)) {
newStatistic.put("三级", value);
} else if ("level4".equals(key)) {
newStatistic.put("四级", value);
} else if ("level5".equals(key)) {
newStatistic.put("五级", value);
} else if ("name".equals(key)) { } else if ("name".equals(key)) {
newStatistic.put("姓名", value); newStatistic.put("姓名", value);
} else if ("userId".equals(key)) { } else if ("userId".equals(key)) {
...@@ -705,10 +731,25 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti ...@@ -705,10 +731,25 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti
@Override @Override
public boolean statisticsEmail(String title, Date startTime, Date endTime, OutputStream outputStream, Map<String, String> DEPT_MAP) { public boolean statisticsEmail(String title, Date startTime, Date endTime, OutputStream outputStream, Map<String, String> DEPT_MAP) {
List<Map<String, Object>> mapList = statisticsEmail(startTime, endTime, DEPT_MAP); List<Map<String, Object>> mapList = statisticsEmail(startTime, endTime, DEPT_MAP);
List<Map<String, Object>> list = new ArrayList<>();
for (Map<String, Object> map : mapList) {
Map<String, Object> temp = new LinkedHashMap<>();
String host = map.get("host").toString();
host = host.replace("/中集集团/", "");
String[] split = host.split("/");
temp.put("level1", split[0]);
temp.put("level2", split.length>=2?split[1]:"");
temp.put("level3", split.length>=3?split[2]:"");
map.remove("host");
temp.putAll(map);
list.add(temp);
}
// 导出 // 导出
ExcelWriter writer = ExcelUtil.getWriter(true); ExcelWriter writer = ExcelUtil.getWriter(true);
try { try {
writer.addHeaderAlias("host", "部门"); writer.addHeaderAlias("level1", "模块");
writer.addHeaderAlias("level2", "二级");
writer.addHeaderAlias("level3", "三级");
writer.addHeaderAlias("totalNum", "总会议"); writer.addHeaderAlias("totalNum", "总会议");
writer.addHeaderAlias("avaliableNum", "有效会议"); writer.addHeaderAlias("avaliableNum", "有效会议");
writer.addHeaderAlias("emptyNum", "没有转录文件"); writer.addHeaderAlias("emptyNum", "没有转录文件");
...@@ -721,7 +762,7 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti ...@@ -721,7 +762,7 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti
// 合并单元格后的标题行,使用默认标题样式 // 合并单元格后的标题行,使用默认标题样式
writer.merge(writer.getHeaderAlias().size() - 1, title); writer.merge(writer.getHeaderAlias().size() - 1, title);
// 一次性写出内容,使用默认样式,强制输出标题 // 一次性写出内容,使用默认样式,强制输出标题
writer.write(mapList, true); writer.write(list, true);
writer.flush(outputStream); writer.flush(outputStream);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -302,6 +302,7 @@ public class MeetingRecordTemplateServiceImpl extends ServiceImpl<MeetingRecordT ...@@ -302,6 +302,7 @@ public class MeetingRecordTemplateServiceImpl extends ServiceImpl<MeetingRecordT
recordTemplate.setUpdateUser(userId); recordTemplate.setUpdateUser(userId);
recordTemplate.setCreateUserName(loginUser.getUsername()); recordTemplate.setCreateUserName(loginUser.getUsername());
recordTemplate.setUpdateUserName(loginUser.getUsername()); recordTemplate.setUpdateUserName(loginUser.getUsername());
recordTemplate.setEnable(true);
baseMapper.insert(recordTemplate); baseMapper.insert(recordTemplate);
return recordTemplate.getId(); return recordTemplate.getId();
// 没有保存到启用表中,默认是不启用的。 // 没有保存到启用表中,默认是不启用的。
......
...@@ -200,7 +200,11 @@ public class UserAccessRecordServiceImpl extends ServiceImpl<UserAccessRecordMap ...@@ -200,7 +200,11 @@ public class UserAccessRecordServiceImpl extends ServiceImpl<UserAccessRecordMap
List<List<String>> rows = new ArrayList<>(); List<List<String>> rows = new ArrayList<>();
for (Map<String, String> statistic : statistics) { for (Map<String, String> statistic : statistics) {
List<String> row = CollUtil.newArrayList(statistic.get("deptName"), statistic.get("userId"), statistic.get("name")); String deptPath = statistic.get("deptName");
deptPath = deptPath.replace("/中集集团/", "");
String[] split = deptPath.split("/");
List<String> row = CollUtil.newArrayList(split[0], split.length>=2?split[1]:"", split.length>=3?split[2]:"", split.length>=4?split[3]:"", split.length>=5?split[4]:"",
statistic.get("userId"), statistic.get("name"));
List<String> validSortedValues = getValidSortedValues(statistic); List<String> validSortedValues = getValidSortedValues(statistic);
row.addAll(validSortedValues); row.addAll(validSortedValues);
row.add(statistic.get("sum")); row.add(statistic.get("sum"));
...@@ -213,7 +217,7 @@ public class UserAccessRecordServiceImpl extends ServiceImpl<UserAccessRecordMap ...@@ -213,7 +217,7 @@ public class UserAccessRecordServiceImpl extends ServiceImpl<UserAccessRecordMap
headFont.setFontHeightInPoints((short) 10); headFont.setFontHeightInPoints((short) 10);
headCellStyle.setFont(headFont); headCellStyle.setFont(headFont);
List<String> head = CollUtil.newArrayList("所属部门", "工号", "姓名"); List<String> head = CollUtil.newArrayList("版块", "二级", "三级", "四级", "五级", "姓名", "工号");
head.addAll(dateList); head.addAll(dateList);
head.add("总计"); head.add("总计");
writer.writeHeadRow(head); writer.writeHeadRow(head);
......
...@@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.JsonFormat; ...@@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime; import java.time.LocalDateTime;
/** /**
...@@ -24,6 +26,7 @@ public class MeetingInfoVO { ...@@ -24,6 +26,7 @@ public class MeetingInfoVO {
/** /**
* 主键id * 主键id
*/ */
@NotNull
private Integer id; private Integer id;
/** /**
* 会议主题 * 会议主题
......
...@@ -4,9 +4,6 @@ ...@@ -4,9 +4,6 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cmeeting.mapper.primary.MeetingRecordTemplateMapper"> <mapper namespace="com.cmeeting.mapper.primary.MeetingRecordTemplateMapper">
<select id="getAuthorizedSystemTemplate" resultType="com.cmeeting.pojo.MeetingRecordTemplate">
</select>
<sql id="templateColumnSql"> <sql id="templateColumnSql">
meet_type.id as meeting_type_id, meet_type.id as meeting_type_id,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论