diff --git a/cxxm/src/main/java/com/ruoyi/cxxm/domain/enums/ZGQK.java b/cxxm/src/main/java/com/ruoyi/cxxm/domain/enums/ZGQK.java new file mode 100644 index 00000000..3682bc1d --- /dev/null +++ b/cxxm/src/main/java/com/ruoyi/cxxm/domain/enums/ZGQK.java @@ -0,0 +1,20 @@ +package com.ruoyi.cxxm.domain.enums; + +public enum ZGQK { + // 未整改 + WZG("1"), + // 未整改到位 + WZGDW("2"), + // 已整改 + YZG("3"); + + private final String value; + + ZGQK(String value) { + this.value = value; + } + + public String getValue() { + return value; + } +} diff --git a/cxxm/src/main/java/com/ruoyi/cxxm/domain/query/StatisticsQuery.java b/cxxm/src/main/java/com/ruoyi/cxxm/domain/query/StatisticsQuery.java new file mode 100644 index 00000000..9b528c68 --- /dev/null +++ b/cxxm/src/main/java/com/ruoyi/cxxm/domain/query/StatisticsQuery.java @@ -0,0 +1,15 @@ +package com.ruoyi.cxxm.domain.query; + +import lombok.Data; + +import java.util.List; + +@Data +public class StatisticsQuery { + // 部门id + private Long deptId; + // 导入时间区间 + private List drsjQuery; + // 导入时间 + private String lineDateQuery; +} diff --git a/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/HistogramDataItem.java b/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/HistogramDataItem.java new file mode 100644 index 00000000..dc612fbc --- /dev/null +++ b/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/HistogramDataItem.java @@ -0,0 +1,30 @@ +package com.ruoyi.cxxm.domain.vo; + +import lombok.Data; + +@Data +public class HistogramDataItem { + private String deptName; + // 已下发数量 + private Integer yxf; + // 未下发数量 + private Integer wxf; + // 已巡查数量 + private Integer yxc; + // 未巡查数量 + private Integer wxc; + // 州级巡查 + private Integer zjxc; + // 县级巡查 + private Integer xjxc; + // 已整改数量 + private Integer yzg; + // 未整改到位数量 + private Integer wzgdw; + // 未整改数量 + private Integer wzg; + // 审核通过 + private Integer shtg; + // 审核不通过 + private Integer shbtg; +} diff --git a/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/LineDateItem.java b/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/LineDateItem.java new file mode 100644 index 00000000..0a96593d --- /dev/null +++ b/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/LineDateItem.java @@ -0,0 +1,13 @@ +package com.ruoyi.cxxm.domain.vo; + +import lombok.Data; + +@Data +public class LineDateItem { + private String date; + + private String deptName; + + private Integer num; + +} diff --git a/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/StatisticsVo.java b/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/StatisticsVo.java new file mode 100644 index 00000000..48c724b2 --- /dev/null +++ b/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/StatisticsVo.java @@ -0,0 +1,41 @@ +package com.ruoyi.cxxm.domain.vo; + +import lombok.Data; + +import java.util.List; + +@Data +public class StatisticsVo { + // 图斑数量 + private Integer total; + // 矿产数量 + private Integer kc; + // 土地数量 + private Integer td; + // 已下发数量 + private Integer yxf; + // 未下发数量 + private Integer wxf; + // 已巡查数量 + private Integer yxc; + // 未巡查数量 + private Integer wxc; + // 州级巡查 + private Integer zjxc; + // 县级巡查 + private Integer xjxc; + // 已整改数量 + private Integer yzg; + // 未整改到位数量 + private Integer wzgdw; + // 未整改数量 + private Integer wzg; + // 审核通过 + private Integer shtg; + // 审核不通过 + private Integer shbtg; + // 直方图数据 + private List histogramData; + // 折线图数据 + private List lineData; +} diff --git a/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/TaskCheckStatistics.java b/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/TaskCheckStatistics.java new file mode 100644 index 00000000..2e86c880 --- /dev/null +++ b/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/TaskCheckStatistics.java @@ -0,0 +1,39 @@ +package com.ruoyi.cxxm.domain.vo; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import org.apache.bcel.generic.NEW; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@Data +public class TaskCheckStatistics { + // 需巡查次数 + private int xxccs; + // 已巡查次数 + private int yxccs; + // 州级巡查次数 + private int zjxccs; + // 县级巡查次数 + private int xjxccs; + // 未整改次数 + private int wzgcs; + // 未整改到位次数 + private int wzgdwcs; + // 已整改次数 + private int yzgcs; + // 审核通过次数 + private int shtgcs; + // 审核不通过次数 + private int shbtgcs; + // 州级平均巡查频率 + private int zjxcpl; + @JsonIgnore + private List zjxcsjList = new ArrayList<>(); + // 州级平均巡查频率 + private int xjxcpl; + @JsonIgnore + private List xjxcsjList = new ArrayList<>(); +} diff --git a/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/TaskCheckSubmitVo.java b/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/TaskCheckSubmitVo.java index f5b6655f..aaefe452 100644 --- a/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/TaskCheckSubmitVo.java +++ b/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/TaskCheckSubmitVo.java @@ -15,6 +15,8 @@ public class TaskCheckSubmitVo extends TaskCheckSubmit { private List taskCheckLogs; // 图斑信息 private Tbxx tbxx; + // 图斑巡查数据统计 + private TaskCheckStatistics taskCheckStatistics; } diff --git a/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/TaskDetailVo.java b/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/TaskDetailVo.java index cf3ea9da..9b1f36d1 100644 --- a/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/TaskDetailVo.java +++ b/cxxm/src/main/java/com/ruoyi/cxxm/domain/vo/TaskDetailVo.java @@ -9,6 +9,5 @@ public class TaskDetailVo extends Task { // 图斑信息 private Tbxx tbxx; -// // 巡查提交信息 -// private TaskCheckSubmit taskCheckSubmit; + } diff --git a/cxxm/src/main/java/com/ruoyi/cxxm/mapper/StatisticsMapper.java b/cxxm/src/main/java/com/ruoyi/cxxm/mapper/StatisticsMapper.java new file mode 100644 index 00000000..008aa697 --- /dev/null +++ b/cxxm/src/main/java/com/ruoyi/cxxm/mapper/StatisticsMapper.java @@ -0,0 +1,20 @@ +package com.ruoyi.cxxm.mapper; + +import com.ruoyi.cxxm.domain.query.StatisticsQuery; +import com.ruoyi.cxxm.domain.vo.HistogramDataItem; +import com.ruoyi.cxxm.domain.vo.LineDateItem; +import com.ruoyi.cxxm.domain.vo.StatisticsVo; + +import java.util.List; + +public interface StatisticsMapper { + StatisticsVo taskXccsStatistics(StatisticsQuery statisticsQuery); + + StatisticsVo taskZgAndShStatistics(StatisticsQuery statisticsQuery); + + List histogramXccsStatistics(StatisticsQuery statisticsQuery); + + List histogramZgAndShStatistics(StatisticsQuery statisticsQuery); + + List lineStatistics(StatisticsQuery statisticsQuery); +} diff --git a/cxxm/src/main/java/com/ruoyi/cxxm/service/IStatisticsService.java b/cxxm/src/main/java/com/ruoyi/cxxm/service/IStatisticsService.java new file mode 100644 index 00000000..8b0f01bf --- /dev/null +++ b/cxxm/src/main/java/com/ruoyi/cxxm/service/IStatisticsService.java @@ -0,0 +1,17 @@ +package com.ruoyi.cxxm.service; + +import com.ruoyi.cxxm.domain.query.StatisticsQuery; +import com.ruoyi.cxxm.domain.vo.HistogramDataItem; +import com.ruoyi.cxxm.domain.vo.LineDateItem; +import com.ruoyi.cxxm.domain.vo.StatisticsVo; + +import java.util.List; + +public interface IStatisticsService { + StatisticsVo taskStatistics(StatisticsQuery statisticsQuery); + + List histogramStatistics(StatisticsQuery statisticsQuery); + + List lineStatistics(StatisticsQuery statisticsQuery); + +} diff --git a/cxxm/src/main/java/com/ruoyi/cxxm/service/ITaskCheckService.java b/cxxm/src/main/java/com/ruoyi/cxxm/service/ITaskCheckService.java index dd4cc341..948772a6 100644 --- a/cxxm/src/main/java/com/ruoyi/cxxm/service/ITaskCheckService.java +++ b/cxxm/src/main/java/com/ruoyi/cxxm/service/ITaskCheckService.java @@ -2,9 +2,11 @@ package com.ruoyi.cxxm.service; import java.io.IOException; import java.util.List; + import com.ruoyi.cxxm.domain.TaskCheck; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.cxxm.domain.dto.TaskCheckSubmit; +import com.ruoyi.cxxm.domain.vo.TaskCheckSubmitVo; import org.springframework.web.multipart.MultipartFile; /** @@ -13,10 +15,10 @@ import org.springframework.web.multipart.MultipartFile; * @author ruoyi * @date 2024-03-28 */ -public interface ITaskCheckService extends IService -{ +public interface ITaskCheckService extends IService { /** * 保存任务提交记录和文件 + * * @param taskCheckSubmit * @param files * @return @@ -24,8 +26,17 @@ public interface ITaskCheckService extends IService */ public boolean saveTaskCheckSubmitAndFiles(TaskCheckSubmit taskCheckSubmit, List files) throws IOException; + /** + * 根据taskId获取填报详情 + * + * @param taskId + * @return + */ + public TaskCheckSubmitVo getTaskCheckSubmitVo(long taskId); + /** * 上报填报记录 + * * @param tcId * @return */ @@ -33,6 +44,7 @@ public interface ITaskCheckService extends IService /** * 取消上报填报记录 + * * @param tcId * @return */ diff --git a/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/IStatisticsServiceImpl.java b/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/IStatisticsServiceImpl.java new file mode 100644 index 00000000..1d0a6498 --- /dev/null +++ b/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/IStatisticsServiceImpl.java @@ -0,0 +1,94 @@ +package com.ruoyi.cxxm.service.impl; + +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.cxxm.domain.query.StatisticsQuery; +import com.ruoyi.cxxm.domain.vo.HistogramDataItem; +import com.ruoyi.cxxm.domain.vo.LineDateItem; +import com.ruoyi.cxxm.domain.vo.StatisticsVo; +import com.ruoyi.cxxm.mapper.StatisticsMapper; +import com.ruoyi.cxxm.service.IStatisticsService; +import com.ruoyi.system.mapper.SysDeptMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.util.*; + +import static com.ruoyi.common.utils.bean.BeanUtils.getNullPropertyNames; + +@Service +public class IStatisticsServiceImpl implements IStatisticsService { + @Autowired + private StatisticsMapper statisticsMapper; + @Autowired + private SysDeptMapper deptMapper; + + @Override + public StatisticsVo taskStatistics(StatisticsQuery statisticsQuery) { + StatisticsVo statisticsVo = statisticsMapper.taskXccsStatistics(statisticsQuery); + StatisticsVo zgAndShVo = statisticsMapper.taskZgAndShStatistics(statisticsQuery); + String[] nullPropertyNames = getNullPropertyNames(zgAndShVo); + BeanUtils.copyProperties(zgAndShVo, statisticsVo, nullPropertyNames); + return statisticsVo; + } + + @Override + public List histogramStatistics(StatisticsQuery statisticsQuery) { + List histogramData = statisticsMapper.histogramXccsStatistics(statisticsQuery); + List zgAndSItems = statisticsMapper.histogramZgAndShStatistics(statisticsQuery); + + for (HistogramDataItem item : histogramData) { + for (HistogramDataItem zgAndSItem : zgAndSItems) { + if (Objects.equals(zgAndSItem.getDeptName(), item.getDeptName())) { + String[] nullPropertyNames = getNullPropertyNames(zgAndSItem); + BeanUtils.copyProperties(zgAndSItem, item, nullPropertyNames); + } + } + + } + return histogramData; + } + + + @Override + public List lineStatistics(StatisticsQuery statisticsQuery) { + List datesInMonths = null; + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); + if (statisticsQuery.getLineDateQuery() == null) { + Calendar calendar = Calendar.getInstance(); + int year = calendar.get(Calendar.YEAR); + int month = calendar.get(Calendar.MONTH) + 1; + datesInMonths = DateUtils.generateDatesInMonth(year, month); + statisticsQuery.setLineDateQuery(sdf.format(calendar.getTime())); + } else { + String lineDateQuery = statisticsQuery.getLineDateQuery(); + String[] yearAndMonth = lineDateQuery.split("-"); + datesInMonths = DateUtils.generateDatesInMonth(Integer.parseInt(yearAndMonth[0]), Integer.parseInt(yearAndMonth[1])); + } + List lineDateItems = statisticsMapper.lineStatistics(statisticsQuery); + ArrayList lineData = new ArrayList<>(); + String[] deptNames = {}; + if (deptMapper.selectNormalChildrenDeptById(statisticsQuery.getDeptId()) > 0) { + deptNames = new String[]{"楚雄市", "禄丰市", "大姚县", "姚安县", "武定县", "双柏县", "牟定县", "南华县", "永仁县", "元谋县"}; + }else{ + deptNames = new String[]{deptMapper.selectDeptById(statisticsQuery.getDeptId()).getDeptName()}; + } + for (LocalDate datesInMonth : datesInMonths) { + Map lineDataItemMap = new HashMap<>(); + lineDataItemMap.put("日期", datesInMonth.toString()); + for (String deptName : deptNames) { + lineDataItemMap.put(deptName, 0); + for (LineDateItem item : lineDateItems) { + if (datesInMonth.toString().equals(item.getDate()) && deptName.equals(item.getDeptName())) { + lineDataItemMap.put(deptName, item.getNum()); + } + } + } + lineData.add(lineDataItemMap); + } + return lineData; + } +} diff --git a/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/TaskCheckServiceImpl.java b/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/TaskCheckServiceImpl.java index 07b65e25..b7261923 100644 --- a/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/TaskCheckServiceImpl.java +++ b/cxxm/src/main/java/com/ruoyi/cxxm/service/impl/TaskCheckServiceImpl.java @@ -3,35 +3,33 @@ package com.ruoyi.cxxm.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.common.utils.file.FileUploadUtils; -import com.ruoyi.cxxm.domain.Task; -import com.ruoyi.cxxm.domain.TaskCheckImage; -import com.ruoyi.cxxm.domain.TaskCheckVideo; +import com.ruoyi.cxxm.domain.*; import com.ruoyi.cxxm.domain.dto.TaskCheckSubmit; -import com.ruoyi.cxxm.domain.enums.RoleName; -import com.ruoyi.cxxm.domain.enums.SFSB; -import com.ruoyi.cxxm.domain.enums.XCJB; +import com.ruoyi.cxxm.domain.enums.*; +import com.ruoyi.cxxm.domain.vo.TaskCheckLog; +import com.ruoyi.cxxm.domain.vo.TaskCheckStatistics; +import com.ruoyi.cxxm.domain.vo.TaskCheckSubmitVo; import com.ruoyi.cxxm.mapper.TaskCheckMapper; -import com.ruoyi.cxxm.domain.TaskCheck; import com.ruoyi.cxxm.mapper.TaskMapper; -import com.ruoyi.cxxm.service.ITaskCheckImageService; -import com.ruoyi.cxxm.service.ITaskCheckService; -import com.ruoyi.cxxm.service.ITaskCheckVideoService; -import com.ruoyi.cxxm.service.ITaskService; +import com.ruoyi.cxxm.service.*; +import lombok.Data; +import org.apache.bcel.generic.NEW; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; -import java.util.List; -import java.util.Objects; +import java.util.*; /** @@ -53,6 +51,10 @@ public class TaskCheckServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(TaskCheck::getTaskId, taskId); + queryWrapper.eq(TaskCheck::getSfsb, SFSB.YSB.getValue()); + queryWrapper.orderByDesc(TaskCheck::getId); + queryWrapper.last("limit 1"); + TaskCheck taskCheck = taskCheckService.getOne(queryWrapper); + if (taskCheck == null) { + return null; + } + BeanUtils.copyProperties(taskCheck, taskCheckSubmitVo); + // 图片 + LambdaQueryWrapper tcImagesQueryWrapper = new LambdaQueryWrapper<>(); + tcImagesQueryWrapper.eq(TaskCheckImage::getTcId, taskCheck.getId()); + List taskCheckImages = taskCheckImageService.list(tcImagesQueryWrapper); + taskCheckSubmitVo.setTaskCheckImages(taskCheckImages); + // 视频 + LambdaQueryWrapper tcVideosQueryWrapper = new LambdaQueryWrapper<>(); + tcVideosQueryWrapper.eq(TaskCheckVideo::getTcId, taskCheck.getId()); + List taskCheckVideos = taskCheckVideoService.list(tcVideosQueryWrapper); + taskCheckSubmitVo.setTaskCheckVideos(taskCheckVideos); + // 图斑信息 + Task task = taskService.getById(taskCheck.getTaskId()); + Tbxx tbxx = tbxxService.selectTbxxByTbbh(task.getTbbh()); + taskCheckSubmitVo.setTbxx(tbxx); + + // 填报记录列表 + LambdaQueryWrapper tcLogQueryWrapper = new LambdaQueryWrapper<>(); + tcLogQueryWrapper.eq(TaskCheck::getTaskId, taskId); + tcLogQueryWrapper.orderByDesc(TaskCheck::getId); + List tcList = taskCheckService.list(tcLogQueryWrapper); + List tcLogList = new ArrayList<>(); + for (TaskCheck item : tcList) { + // 跳过未上报,且非本人巡查的记录 + if (Objects.equals(item.getSfsb(), SFSB.WSB.getValue()) && !Objects.equals(item.getXcryId(), SecurityUtils.getUserId())) { + continue; + } + TaskCheckLog taskCheckLog = new TaskCheckLog(); + BeanUtils.copyProperties(item, taskCheckLog); + taskCheckLog.setTcId(item.getId()); + // 填报记录图片 + LambdaQueryWrapper tcLogImagesQueryWrapper = new LambdaQueryWrapper<>(); + tcLogImagesQueryWrapper.eq(TaskCheckImage::getTcId, item.getId()); + List tcLogImages = taskCheckImageService.list(tcLogImagesQueryWrapper); + taskCheckLog.setTaskCheckImages(tcLogImages); + // 填报记录视频 + LambdaQueryWrapper tcLogVideosQueryWrapper = new LambdaQueryWrapper<>(); + tcLogVideosQueryWrapper.eq(TaskCheckVideo::getTcId, item.getId()); + List tcLogVideos = taskCheckVideoService.list(tcLogVideosQueryWrapper); + taskCheckLog.setTaskCheckVideos(tcLogVideos); + // 填报记录审核 + LambdaQueryWrapper tcAuditQueryWrapper = new LambdaQueryWrapper<>(); + tcAuditQueryWrapper.eq(TaskCheckAudit::getTcId, item.getId()); + TaskCheckAudit taskCheckAudit = taskCheckAuditService.getOne(tcAuditQueryWrapper); + taskCheckLog.setTaskCheckAudit(taskCheckAudit); + // 统计填报数据 + taskCheckStatistics = getTaskCheckStatistics(task, item, taskCheckAudit, taskCheckStatistics); + tcLogList.add(taskCheckLog); + } + // 巡查间隔统计 + setTaskCheckStatisticsForXcpl(taskCheckStatistics); + taskCheckSubmitVo.setTaskCheckStatistics(taskCheckStatistics); + taskCheckSubmitVo.setTaskCheckLogs(tcLogList); + return taskCheckSubmitVo; + } + + private void setTaskCheckStatisticsForXcpl(TaskCheckStatistics taskCheckStatistics) { + List xjxcsjList = taskCheckStatistics.getXjxcsjList(); + List zjxcsjList = taskCheckStatistics.getZjxcsjList(); + // 县级 + if (xjxcsjList.size() >= 2) { + Collections.sort(xjxcsjList); + taskCheckStatistics.setXjxcpl(averageIntervalInDays(xjxcsjList)); + } + // 州级 + if (zjxcsjList.size() >= 2) { + Collections.sort(zjxcsjList); + taskCheckStatistics.setZjxcpl(averageIntervalInDays(zjxcsjList)); + } + } + + private int averageIntervalInDays(List dateList) { + long totalIntervalInMillis = 0; + for (int i = 1; i < dateList.size(); i++) { + Date current = dateList.get(i); + Date previous = dateList.get(i - 1); + long intervalInMillis = current.getTime() - previous.getTime(); + totalIntervalInMillis += Math.abs(intervalInMillis); + } + // 将总毫秒数转换为天数 + double totalIntervalInDays = (double) totalIntervalInMillis / (1000 * 60 * 60 * 24); + // 计算平均间隔天数 + double averageIntervalInDays = totalIntervalInDays / (dateList.size() - 1); + return (int) averageIntervalInDays; + } + + public TaskCheckStatistics getTaskCheckStatistics(Task task, TaskCheck taskCheck, TaskCheckAudit taskCheckAudit, TaskCheckStatistics taskCheckStatistics) { + // 巡查次数统计 + BeanUtils.copyProperties(task, taskCheckStatistics); + // 填报数据整改情况统计 + if (Objects.equals(taskCheck.getZgqk(), ZGQK.WZG.getValue())) { + taskCheckStatistics.setWzgcs(taskCheckStatistics.getWzgcs() + 1); + } else if (Objects.equals(taskCheck.getZgqk(), ZGQK.WZGDW.getValue())) { + taskCheckStatistics.setWzgdwcs(taskCheckStatistics.getWzgdwcs() + 1); + } else if (Objects.equals(taskCheck.getZgqk(), ZGQK.YZG.getValue())) { + taskCheckStatistics.setYzgcs(taskCheckStatistics.getYzgcs() + 1); + } + //填报数据审核情况统计 + if (Objects.nonNull(taskCheckAudit)) { + if (Objects.equals(taskCheckAudit.getShjg(), SHJG.TRUE.getValue())) { + taskCheckStatistics.setShtgcs(taskCheckStatistics.getShtgcs() + 1); + } else if (Objects.equals(taskCheckAudit.getShjg(), SHJG.FALSE.getValue())) { + taskCheckStatistics.setShbtgcs(taskCheckStatistics.getShbtgcs() + 1); + } + } + // 巡查日期间隔记录 + if (Objects.equals(taskCheck.getXcjb(), XCJB.XJ.getValue())) { + List xjxcsjList = taskCheckStatistics.getXjxcsjList(); + xjxcsjList.add(taskCheck.getXcsj()); + } else if (Objects.equals(taskCheck.getXcjb(), XCJB.ZJ.getValue())) { + List zjxcsjList = taskCheckStatistics.getZjxcsjList(); + zjxcsjList.add(taskCheck.getXcsj()); + } + return taskCheckStatistics; + } + /** * 上报填报记录 @@ -159,24 +297,17 @@ public class TaskCheckServiceImpl extends ServiceImpl= 0) { + if (Objects.nonNull(lastTaskCheck)) { task.setTcId(tcId); task.setXcsj(lastTaskCheck.getXcsj()); task.setXcryId(SecurityUtils.getUserId()); // 修改任务表巡查次数 task.setYxccs(task.getYxccs() + 1); // 已巡查次数+1 - SysUser user = SecurityUtils.getLoginUser().getUser(); - List roles = user.getRoles(); - for (SysRole role : roles) { - if (((Objects.equals(role.getRoleName(), RoleName.XJGLY.getValue())) - || Objects.equals(role.getRoleName(), RoleName.XJDCY.getValue())) - ) { - task.setZjxccs(task.getZjxccs() + 1); // 州级巡查次数+1 - } - if ((Objects.equals(role.getRoleName(), RoleName.ZJGLY.getValue())) - || Objects.equals(role.getRoleName(), RoleName.ZJDCY.getValue())) { - task.setZjxccs(task.getZjxccs() + 1); // 县级巡查次数+1 - } + if (Objects.equals(taskCheck.getXcjb(), XCJB.ZJ.getValue())) { + task.setZjxccs(task.getZjxccs() + 1); // 州级巡查次数+1 + } + if (Objects.equals(taskCheck.getXcjb(), XCJB.XJ.getValue())) { + task.setZjxccs(task.getZjxccs() + 1); // 县级巡查次数+1 } taskService.saveOrUpdate(task); } @@ -211,18 +342,11 @@ public class TaskCheckServiceImpl extends ServiceImpl roles = user.getRoles(); - for (SysRole role : roles) { - if (((Objects.equals(role.getRoleName(), RoleName.XJGLY.getValue())) - || Objects.equals(role.getRoleName(), RoleName.XJDCY.getValue())) - ) { - task.setZjxccs(task.getZjxccs() - 1); // 州级巡查次数-1 - } - if ((Objects.equals(role.getRoleName(), RoleName.ZJGLY.getValue())) - || Objects.equals(role.getRoleName(), RoleName.ZJDCY.getValue())) { - task.setZjxccs(task.getZjxccs() - 1); // 县级巡查次数-1 - } + if (Objects.equals(taskCheck.getXcjb(), XCJB.ZJ.getValue())) { + task.setZjxccs(task.getZjxccs() - 1); // 州级巡查次数-1 + } + if (Objects.equals(taskCheck.getXcjb(), XCJB.XJ.getValue())) { + task.setZjxccs(task.getZjxccs() - 1); // 县级巡查次数-1 } if (Objects.nonNull(lastTaskCheck)) { task.setTcId(lastTaskCheck.getId()); diff --git a/cxxm/src/main/resources/mapper/cxxm/StatisticsMapper.xml b/cxxm/src/main/resources/mapper/cxxm/StatisticsMapper.xml new file mode 100644 index 00000000..526fb27e --- /dev/null +++ b/cxxm/src/main/resources/mapper/cxxm/StatisticsMapper.xml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index 61ffb13d..5e1d9dbf 100644 --- a/pom.xml +++ b/pom.xml @@ -190,6 +190,12 @@ ${ruoyi.version} + + com.deepoove + poi-tl + 1.10.5 + + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cxxm/TaskCheckController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cxxm/TaskCheckController.java index ef3c7220..78db5ea5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cxxm/TaskCheckController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cxxm/TaskCheckController.java @@ -1,7 +1,13 @@ package com.ruoyi.web.controller.cxxm; import java.io.IOException; +import java.time.Instant; +import java.time.LocalDate; +import java.time.Period; +import java.time.ZoneId; +import java.time.temporal.ChronoUnit; import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.Objects; import javax.servlet.http.HttpServletResponse; @@ -11,13 +17,20 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.cxxm.domain.*; import com.ruoyi.cxxm.domain.enums.SFSB; import com.ruoyi.cxxm.domain.dto.TaskCheckSubmit; +import com.ruoyi.cxxm.domain.enums.SHJG; +import com.ruoyi.cxxm.domain.enums.XFQK; +import com.ruoyi.cxxm.domain.enums.ZGQK; +import com.ruoyi.cxxm.domain.query.TaskQuery; import com.ruoyi.cxxm.domain.vo.TaskCheckLog; +import com.ruoyi.cxxm.domain.vo.TaskCheckStatistics; import com.ruoyi.cxxm.domain.vo.TaskCheckSubmitVo; import com.ruoyi.cxxm.service.*; +import net.bytebuddy.asm.Advice; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -88,64 +101,7 @@ public class TaskCheckController extends BaseController { @PreAuthorize("@ss.hasPermi('cxxm:taskCheck:query')") @GetMapping(value = "/{taskId}") public AjaxResult getInfoByTaskId(@PathVariable("taskId") Long taskId) { - TaskCheckSubmitVo taskCheckSubmitVo = new TaskCheckSubmitVo(); - // 最后一条填报内容 - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(TaskCheck::getTaskId, taskId); - queryWrapper.eq(TaskCheck::getSfsb, SFSB.YSB.getValue()); - queryWrapper.orderByDesc(TaskCheck::getId); - queryWrapper.last("limit 1"); - TaskCheck taskCheck = taskCheckService.getOne(queryWrapper); - if (taskCheck == null) { - return AjaxResult.success(); - } - BeanUtils.copyProperties(taskCheck, taskCheckSubmitVo); - // 图片 - LambdaQueryWrapper tcImagesQueryWrapper = new LambdaQueryWrapper<>(); - tcImagesQueryWrapper.eq(TaskCheckImage::getTcId, taskCheck.getId()); - List taskCheckImages = taskCheckImageService.list(tcImagesQueryWrapper); - taskCheckSubmitVo.setTaskCheckImages(taskCheckImages); - // 视频 - LambdaQueryWrapper tcVideosQueryWrapper = new LambdaQueryWrapper<>(); - tcVideosQueryWrapper.eq(TaskCheckVideo::getTcId, taskCheck.getId()); - List taskCheckVideos = taskCheckVideoService.list(tcVideosQueryWrapper); - taskCheckSubmitVo.setTaskCheckVideos(taskCheckVideos); - // 图斑信息 - Task task = taskService.getById(taskCheck.getTaskId()); - Tbxx tbxx = tbxxService.selectTbxxByTbbh(task.getTbbh()); - taskCheckSubmitVo.setTbxx(tbxx); - // 填报记录列表 - LambdaQueryWrapper tcLogQueryWrapper = new LambdaQueryWrapper<>(); - tcLogQueryWrapper.eq(TaskCheck::getTaskId, taskId); - tcLogQueryWrapper.orderByDesc(TaskCheck::getId); - List tcList = taskCheckService.list(tcLogQueryWrapper); - List tcLogList = new ArrayList<>(); - for (TaskCheck item : tcList) { - // 跳过未上报,且非本人巡查的记录 - if (Objects.equals(item.getSfsb(), SFSB.WSB.getValue()) && !Objects.equals(item.getXcryId(), SecurityUtils.getUserId())) { - continue; - } - TaskCheckLog taskCheckLog = new TaskCheckLog(); - BeanUtils.copyProperties(item, taskCheckLog); - taskCheckLog.setTcId(item.getId()); - // 填报记录图片 - LambdaQueryWrapper tcLogImagesQueryWrapper = new LambdaQueryWrapper<>(); - tcLogImagesQueryWrapper.eq(TaskCheckImage::getTcId, item.getId()); - List tcLogImages = taskCheckImageService.list(tcLogImagesQueryWrapper); - taskCheckLog.setTaskCheckImages(tcLogImages); - // 填报记录视频 - LambdaQueryWrapper tcLogVideosQueryWrapper = new LambdaQueryWrapper<>(); - tcLogVideosQueryWrapper.eq(TaskCheckVideo::getTcId, item.getId()); - List tcLogVideos = taskCheckVideoService.list(tcLogVideosQueryWrapper); - taskCheckLog.setTaskCheckVideos(tcLogVideos); - // 填报记录审核 - LambdaQueryWrapper tcAuditQueryWrapper = new LambdaQueryWrapper<>(); - tcAuditQueryWrapper.eq(TaskCheckAudit::getTcId, item.getId()); - TaskCheckAudit taskCheckAudit = taskCheckAuditService.getOne(tcAuditQueryWrapper); - taskCheckLog.setTaskCheckAudit(taskCheckAudit); - tcLogList.add(taskCheckLog); - } - taskCheckSubmitVo.setTaskCheckLogs(tcLogList); + TaskCheckSubmitVo taskCheckSubmitVo = taskCheckService.getTaskCheckSubmitVo(taskId); return AjaxResult.success(taskCheckSubmitVo); } @@ -204,5 +160,19 @@ public class TaskCheckController extends BaseController { public AjaxResult cancelReport(@PathVariable Long tcId) { return toAjax(taskCheckService.cancelReportTaskCheckInfo(tcId)); } + + /** + * 查询本人填报记录表 + */ + @PreAuthorize("@ss.hasPermi('cxxm:taskCheck:list')") + @GetMapping("/submitted/list") + public TableDataInfo submittedList(TaskCheck taskCheck, PageDomain pageDomain) { + startPage(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(TaskCheck::getXcryId,SecurityUtils.getUserId()); + queryWrapper.eq(TaskCheck::getXcsj,taskCheck.getXcsj()); + List list = taskCheckService.list(queryWrapper); + return getDataTable(list); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cxxm/TaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cxxm/TaskController.java index da738f88..84f891ba 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cxxm/TaskController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cxxm/TaskController.java @@ -4,19 +4,24 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.util.*; import javax.servlet.http.HttpServletResponse; +import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.ruoyi.common.core.text.StrFormatter; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.cxxm.domain.Tbxx; import com.ruoyi.cxxm.domain.enums.XFQK; import com.ruoyi.cxxm.domain.query.TaskQuery; +import com.ruoyi.cxxm.domain.vo.TaskCheckSubmitVo; import com.ruoyi.cxxm.domain.vo.TaskDetailVo; import com.ruoyi.cxxm.mapper.DeptMapper; import com.ruoyi.cxxm.service.ITbxxService; @@ -280,5 +285,45 @@ public class TaskController extends BaseController { List list = taskService.list(queryWrapper); return getDataTable(list); } + +// @PreAuthorize("@ss.hasPermi('cxxm:taskCheck:query')") +// @Log(title = "任务巡查记录", businessType = BusinessType.EXPORT) +// @PostMapping("/exportWord/{taskId}") +// public void exportWordByTaskId(HttpServletResponse response, @PathVariable("taskId") Long taskId) throws UnknownHostException { +// TaskCheckSubmitVo taskCheckSubmitVo = taskCheckSubmitService.selectTaskCheckSubmitByTaskId(taskId); +// String jsonString = JSON.toJSONString(taskCheckSubmitVo); +// Map taskCheckSubmitMap = JSONObject.parseObject(jsonString, Map.class); +// String zgqk =(String) taskCheckSubmitMap.get("zgqk"); +// switch (zgqk) { +// case "0": +// taskCheckSubmitMap.put("zgqk","☑无 □未整改 □未整改到位 □已整改"); +// break; +// case "1": +// taskCheckSubmitMap.put("zgqk","□无 ☑未整改 □未整改到位 □已整改"); +// break; +// case "2": +// taskCheckSubmitMap.put("zgqk","□无 □未整改 ☑未整改到位 □已整改"); +// break; +// case "3": +// taskCheckSubmitMap.put("zgqk","□无 □未整改 □未整改到位 ☑未整改"); +// break; +// } +// Object taskCheckImages = taskCheckSubmitMap.get("taskCheckImages"); +// List taskCheckImagelist = JSONObject.parseObject(JSON.toJSONString(taskCheckImages), List.class); +// ArrayList newTaskCheckImages = new ArrayList<>(); +// for (Object item : taskCheckImagelist) { +// Map itemMap = JSONObject.parseObject(JSON.toJSONString(item), Map.class); +// String cclj = (String) itemMap.get("cclj"); +// String ip = InetAddress.getLocalHost().getHostAddress(); +// String port = environment.getProperty("server.port"); +// String full_cclj = StrFormatter.format("http://{}:{}{}", ip, port, cclj); +// itemMap.put("cclj", Pictures.ofUrl(full_cclj).size(200, 200).create()); +// newTaskCheckImages.add(itemMap); +// } +// taskCheckSubmitMap.put("taskCheckImages",newTaskCheckImages); +// List nameList = new ArrayList<>(); +// nameList.add("taskCheckImages"); +// PoiTlWordUtils.poiTlWord(taskCheckSubmitMap, nameList, "template/taskCheckExport.doc", "taskCheck", response); +// } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cxxm/TaskStatisticsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cxxm/TaskStatisticsController.java new file mode 100644 index 00000000..05c77c76 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cxxm/TaskStatisticsController.java @@ -0,0 +1,38 @@ +package com.ruoyi.web.controller.cxxm; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.cxxm.domain.query.StatisticsQuery; +import com.ruoyi.cxxm.domain.vo.HistogramDataItem; +import com.ruoyi.cxxm.domain.vo.StatisticsVo; +import com.ruoyi.cxxm.service.IStatisticsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +import static com.ruoyi.common.core.domain.AjaxResult.success; + +@RestController +@RequestMapping("/cxxm/task/statistics") +public class TaskStatisticsController { + @Autowired + private IStatisticsService statisticsService; + + /** + * 获取统计数据 + * + * @return + */ +// @PreAuthorize("@ss.hasPermi('cxxm:task:statistics')") + @GetMapping() + public AjaxResult getStatistics(StatisticsQuery statisticsQuery) { + StatisticsVo statisticsVo = statisticsService.taskStatistics(statisticsQuery); + List histogramData = statisticsService.histogramStatistics(statisticsQuery); + List lineData = statisticsService.lineStatistics(statisticsQuery); + statisticsVo.setHistogramData(histogramData); + statisticsVo.setLineData(lineData); + return success(statisticsVo); + } +} diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 110164a6..ee758bbe 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -125,16 +125,20 @@ javax.servlet javax.servlet-api - + com.baomidou mybatis-plus-boot-starter - com.github.yulichang mybatis-plus-join-boot-starter + + + com.deepoove + poi-tl + diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java index 20dbbb74..20a63bb3 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java @@ -8,16 +8,18 @@ import java.time.LocalDateTime; import java.time.LocalTime; import java.time.ZoneId; import java.time.ZonedDateTime; +import java.util.ArrayList; import java.util.Date; +import java.util.List; + import org.apache.commons.lang3.time.DateFormatUtils; /** * 时间工具类 - * + * * @author ruoyi */ -public class DateUtils extends org.apache.commons.lang3.time.DateUtils -{ +public class DateUtils extends org.apache.commons.lang3.time.DateUtils { public static String YYYY = "yyyy"; public static String YYYY_MM = "yyyy-MM"; @@ -29,63 +31,52 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; private static String[] parsePatterns = { - "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", + "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"}; /** * 获取当前Date型日期 - * + * * @return Date() 当前日期 */ - public static Date getNowDate() - { + public static Date getNowDate() { return new Date(); } /** * 获取当前日期, 默认格式为yyyy-MM-dd - * + * * @return String */ - public static String getDate() - { + public static String getDate() { return dateTimeNow(YYYY_MM_DD); } - public static final String getTime() - { + public static final String getTime() { return dateTimeNow(YYYY_MM_DD_HH_MM_SS); } - public static final String dateTimeNow() - { + public static final String dateTimeNow() { return dateTimeNow(YYYYMMDDHHMMSS); } - public static final String dateTimeNow(final String format) - { + public static final String dateTimeNow(final String format) { return parseDateToStr(format, new Date()); } - public static final String dateTime(final Date date) - { + public static final String dateTime(final Date date) { return parseDateToStr(YYYY_MM_DD, date); } - public static final String parseDateToStr(final String format, final Date date) - { + public static final String parseDateToStr(final String format, final Date date) { return new SimpleDateFormat(format).format(date); } - public static final Date dateTime(final String format, final String ts) - { - try - { + public static final Date dateTime(final String format, final String ts) { + try { return new SimpleDateFormat(format).parse(ts); - } - catch (ParseException e) - { + } catch (ParseException e) { throw new RuntimeException(e); } } @@ -93,8 +84,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils /** * 日期路径 即年/月/日 如2018/08/08 */ - public static final String datePath() - { + public static final String datePath() { Date now = new Date(); return DateFormatUtils.format(now, "yyyy/MM/dd"); } @@ -102,8 +92,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils /** * 日期路径 即年/月/日 如20180808 */ - public static final String dateTime() - { + public static final String dateTime() { Date now = new Date(); return DateFormatUtils.format(now, "yyyyMMdd"); } @@ -111,18 +100,13 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils /** * 日期型字符串转化为日期 格式 */ - public static Date parseDate(Object str) - { - if (str == null) - { + public static Date parseDate(Object str) { + if (str == null) { return null; } - try - { + try { return parseDate(str.toString(), parsePatterns); - } - catch (ParseException e) - { + } catch (ParseException e) { return null; } } @@ -130,8 +114,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils /** * 获取服务器启动时间 */ - public static Date getServerStartDate() - { + public static Date getServerStartDate() { long time = ManagementFactory.getRuntimeMXBean().getStartTime(); return new Date(time); } @@ -139,20 +122,18 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils /** * 计算相差天数 */ - public static int differentDaysByMillisecond(Date date1, Date date2) - { + public static int differentDaysByMillisecond(Date date1, Date date2) { return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24))); } /** * 计算时间差 * - * @param endDate 最后时间 + * @param endDate 最后时间 * @param startTime 开始时间 * @return 时间差(天/小时/分钟) */ - public static String timeDistance(Date endDate, Date startTime) - { + public static String timeDistance(Date endDate, Date startTime) { long nd = 1000 * 24 * 60 * 60; long nh = 1000 * 60 * 60; long nm = 1000 * 60; @@ -173,8 +154,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils /** * 增加 LocalDateTime ==> Date */ - public static Date toDate(LocalDateTime temporalAccessor) - { + public static Date toDate(LocalDateTime temporalAccessor) { ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault()); return Date.from(zdt.toInstant()); } @@ -182,10 +162,28 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils /** * 增加 LocalDate ==> Date */ - public static Date toDate(LocalDate temporalAccessor) - { + public static Date toDate(LocalDate temporalAccessor) { LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0)); ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault()); return Date.from(zdt.toInstant()); } + + /** + * 获取某个月所有的日期序列 + * + * @param year + * @param month + * @return + */ + public static List generateDatesInMonth(int year, int month) { + List dates = new ArrayList<>(); + LocalDate firstDayOfMonth = LocalDate.of(year, month, 1); + LocalDate lastDayOfMonth = firstDayOfMonth.plusMonths(1).minusDays(1); + + for (LocalDate date = firstDayOfMonth; !date.isAfter(lastDayOfMonth); date = date.plusDays(1)) { + dates.add(date); + } + + return dates; + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/BeanUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/BeanUtils.java index 51cdc2fb..a76e984c 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/BeanUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/BeanUtils.java @@ -1,8 +1,14 @@ package com.ruoyi.common.utils.bean; + +import org.springframework.beans.BeanWrapper; +import org.springframework.beans.BeanWrapperImpl; + import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -107,4 +113,17 @@ public class BeanUtils extends org.springframework.beans.BeanUtils { return m1.substring(BEAN_METHOD_PROP_INDEX).equals(m2.substring(BEAN_METHOD_PROP_INDEX)); } + + public static String[] getNullPropertyNames (Object source) { + final BeanWrapper src = new BeanWrapperImpl(source); + java.beans.PropertyDescriptor[] pds = src.getPropertyDescriptors(); + + Set emptyNames = new HashSet(); + for(java.beans.PropertyDescriptor pd : pds) { + Object srcValue = src.getPropertyValue(pd.getName()); + if (srcValue == null) emptyNames.add(pd.getName()); + } + String[] result = new String[emptyNames.size()]; + return emptyNames.toArray(result); + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java index 4652a298..2657c3b6 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java @@ -25,7 +25,7 @@ public class FileUploadUtils /** * 默认大小 50M */ - public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024; + public static final long DEFAULT_MAX_SIZE = 256 * 1024 * 1024; /** * 默认的文件名最大长度 100 diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/PoiTlWordUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/PoiTlWordUtils.java new file mode 100644 index 00000000..d9efe842 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/PoiTlWordUtils.java @@ -0,0 +1,157 @@ +package com.ruoyi.common.utils.poi; + +import com.deepoove.poi.XWPFTemplate; +import com.deepoove.poi.config.Configure; +import com.deepoove.poi.config.ConfigureBuilder; +import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy; +import com.deepoove.poi.util.PoitlIOUtils; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.core.io.ClassPathResource; + +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.List; +import java.util.Map; + + +public class PoiTlWordUtils { + + /** + * 根据文件模版生成文件保存至本地 + * + * @param map 数据集合 + * @param nameList 循环添加的数据 + * @param path 模版路径 我放到了 项目的 resources/file 下面了 + * @param filePath 生成文件保存到本地的路径及文件名称 + */ + public static void poiTlWord(Map map, List nameList, String path, String filePath) { + XWPFTemplate template; + try { + //处理文件 + template = common(path, map, nameList); + //写出文件且关闭流 + template.writeAndClose(Files.newOutputStream(Paths.get(filePath))); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + /** + * 根据word模版生成word文档并通过流的方式下载 get请求 + * + * @param map 数据集合 + * @param nameList 循环表格名称 + * @param path 模版文件路径 + * @param fileName 生成的文件名称 + * @param response response + */ + public static void poiTlWord(Map map, List nameList, String path, String fileName, HttpServletResponse response) { + OutputStream out = null; + BufferedOutputStream bos = null; + XWPFTemplate template; + String filePoiName; + try { + //处理文件 + template = common(path, map, nameList); + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setCharacterEncoding("utf-8"); + filePoiName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20"); + response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + filePoiName + ".docx"); + out = response.getOutputStream(); + bos = new BufferedOutputStream(out); + template.write(bos); + bos.flush(); + out.flush(); + PoitlIOUtils.closeQuietlyMulti(template, bos, out); + } catch (IOException e) { + throw new RuntimeException(e); + } finally { + try { + if (bos != null) { + bos.close(); + } + if (out != null) { + out.close(); + } + } catch (IOException e) { + throw new RuntimeException(e); + } + } + } + + /** + * 根据word模版生成文件 返回InputStream + * + * @param map 数据 + * @param nameList 循环数据名称集合 + * @param path 模版文件位置 + * @return InputStream + */ + public static InputStream poiTlWord(Map map, List nameList, String path) { + ByteArrayOutputStream bos = null; + XWPFTemplate template = null; + try { + //处理文件 + template = common(path, map, nameList); + bos = new ByteArrayOutputStream(); + template.write(bos); + return new ByteArrayInputStream(bos.toByteArray()); + } catch (IOException e) { + throw new RuntimeException(e); + } finally { + try { + if (bos != null) { + bos.close(); + } + if (template != null) { + template.close(); + } + } catch (IOException e) { + throw new RuntimeException(e); + } + } + } + + /** + * 公共处理模版数据 + * + * @param path 模版文件位置 + * @param map 数据 + * @param nameList 数据名字集合 + * @return 文档 + */ + private static XWPFTemplate common(String path, Map map, List nameList) { + //获取模版文件的文件流 + ClassPathResource classPathResource = new ClassPathResource(path); + XWPFTemplate template; + InputStream ins = null; + try { + ins = classPathResource.getInputStream(); + if (CollectionUtils.isNotEmpty(nameList)) { + //如果有循环添加的数据表格的话 则绑定 + LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy(); + ConfigureBuilder builder = Configure.builder(); + nameList.forEach(l -> builder.bind(l, policy)); + Configure config = builder.build(); + template = XWPFTemplate.compile(ins, config).render(map); + } else { + template = XWPFTemplate.compile(ins).render(map); + } + } catch (IOException e) { + throw new RuntimeException(e); + } finally { + try { + if (ins != null) { + ins.close(); + } + } catch (IOException e) { + throw new RuntimeException(e); + } + } + return template; + } + +} diff --git a/ruoyi-common/src/main/resources/template/taskCheckExport.doc b/ruoyi-common/src/main/resources/template/taskCheckExport.doc new file mode 100644 index 00000000..cddcdcbf Binary files /dev/null and b/ruoyi-common/src/main/resources/template/taskCheckExport.doc differ diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index a7ad53b7..a2a18baa 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -52,6 +52,7 @@ "quill": "1.3.7", "screenfull": "5.0.2", "sortablejs": "1.10.2", + "v-charts": "^1.19.0", "v-echarts": "^1.0.2", "vue": "2.6.12", "vue-count-to": "1.0.13", diff --git a/ruoyi-ui/src/api/cxxm/statistics.js b/ruoyi-ui/src/api/cxxm/statistics.js new file mode 100644 index 00000000..a363ae9a --- /dev/null +++ b/ruoyi-ui/src/api/cxxm/statistics.js @@ -0,0 +1,10 @@ +import request from '@/utils/request' + +// 获取统计数据 +export function getStatistics(query) { + return request({ + url: '/cxxm/task/statistics', + method: 'get', + params: query + }) +} diff --git a/ruoyi-ui/src/assets/icons/svg/assign.svg b/ruoyi-ui/src/assets/icons/svg/assign.svg new file mode 100644 index 00000000..59decbe9 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/assign.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/check.svg b/ruoyi-ui/src/assets/icons/svg/check.svg new file mode 100644 index 00000000..c736f042 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/check.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/distribute.svg b/ruoyi-ui/src/assets/icons/svg/distribute.svg new file mode 100644 index 00000000..f0c16003 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/distribute.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/import.svg b/ruoyi-ui/src/assets/icons/svg/import.svg new file mode 100644 index 00000000..9a6c16e9 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/import.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/statistics.svg b/ruoyi-ui/src/assets/icons/svg/statistics.svg new file mode 100644 index 00000000..b4eaa5aa --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/statistics.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/images/login-background.jpg b/ruoyi-ui/src/assets/images/login-background.jpg index 8a89eb82..88da5d56 100644 Binary files a/ruoyi-ui/src/assets/images/login-background.jpg and b/ruoyi-ui/src/assets/images/login-background.jpg differ diff --git a/ruoyi-ui/src/assets/images/profile.jpg b/ruoyi-ui/src/assets/images/profile.jpg index b3a940b2..f96d6b11 100644 Binary files a/ruoyi-ui/src/assets/images/profile.jpg and b/ruoyi-ui/src/assets/images/profile.jpg differ diff --git a/ruoyi-ui/src/assets/logo/logo.png b/ruoyi-ui/src/assets/logo/logo.png index e2637602..13f7b3a4 100644 Binary files a/ruoyi-ui/src/assets/logo/logo.png and b/ruoyi-ui/src/assets/logo/logo.png differ diff --git a/ruoyi-ui/src/main.js b/ruoyi-ui/src/main.js index ebd94b9d..cb859444 100644 --- a/ruoyi-ui/src/main.js +++ b/ruoyi-ui/src/main.js @@ -38,6 +38,8 @@ import VueMeta from 'vue-meta' // 字典数据组件 import DictData from '@/components/DictData' +import VCharts from 'v-charts' + // 全局方法挂载 Vue.prototype.getDicts = getDicts Vue.prototype.getConfigKey = getConfigKey @@ -61,6 +63,7 @@ Vue.component('ImagePreview', ImagePreview) Vue.use(directive) Vue.use(plugins) Vue.use(VueMeta) +Vue.use(VCharts) DictData.install() /** diff --git a/ruoyi-ui/src/views/cxxm/task/check/detail.vue b/ruoyi-ui/src/views/cxxm/task/check/detail.vue index 38d3adc7..d316bdce 100644 --- a/ruoyi-ui/src/views/cxxm/task/check/detail.vue +++ b/ruoyi-ui/src/views/cxxm/task/check/detail.vue @@ -6,38 +6,38 @@ - 5次 + {{form.taskCheckStatistics.xxccs}}次 - 4次 + {{form.taskCheckStatistics.yxccs}}次 - 1次 + {{form.taskCheckStatistics.zjxccs}}次 - 3次 + {{form.taskCheckStatistics.xjxccs}}次 - - 25天/次 + + {{ form.taskCheckStatistics.xjxcpl }}天/次 - 5次 + {{form.taskCheckStatistics.wzgcs}}次 - 4次 + {{form.taskCheckStatistics.wzgdwcs}}次 - 1次 + {{form.taskCheckStatistics.yzgcs}}次 - 1次 + {{form.taskCheckStatistics.shbtgcs}}次 - 1次 + {{form.taskCheckStatistics.shtgcs}}次 @@ -161,7 +161,7 @@ size="medium" plain type="success" - @click="handleCheck" + @click="handleCheckAdd" v-hasPermi="['cxxm:taskCheckAudit:add']" >审核 @@ -170,7 +170,7 @@ size="medium" plain type="info" - @click="handleCheck" + @click="handleCheckEdit" v-hasPermi="['cxxm:taskCheckAudit:edit']" >修改审核结果 @@ -291,10 +291,14 @@ export default { }); }, // 审核按钮 - handleCheck() { + handleCheckAdd() { this.title = "提交审核结果"; this.open = true; }, + handleCheckEdit() { + this.title = "修改审核结果"; + this.open = true; + }, // 提交审核 submitAuditForm() { this.auditForm.tcId = this.recordForm.tcId @@ -304,7 +308,7 @@ export default { } if (this.auditForm.id == null) { auditTaskCheck(this.auditForm).then(response => { - this.$modal.msgSuccess("审核成功"); + this.$modal.msgSuccess("提交成功"); this.open = false; this.getTaskCheckDetail(); }); diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index cb8ee7d3..657556df 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -1,983 +1,189 @@