From 20cbcc4794afcab1f42b6b054251bab6af1635d9 Mon Sep 17 00:00:00 2001 From: bai <1643359946@qq.com> Date: Wed, 14 Jun 2023 08:40:52 +0800 Subject: [PATCH] =?UTF-8?q?2023=E5=B9=B46=E6=9C=8814=E6=97=A5=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/kc/qa/entity/KcEvaluation.java | 13 +- .../TingKeStatisticsController.java | 179 ++++++++++++++++++ 2 files changed, 190 insertions(+), 2 deletions(-) create mode 100644 jeecg-module-main/src/main/java/org/jeecg/modules/kc/statistics/TingKeStatisticsController.java diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/entity/KcEvaluation.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/entity/KcEvaluation.java index 4755cb88..81181485 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/entity/KcEvaluation.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/qa/entity/KcEvaluation.java @@ -318,8 +318,17 @@ public class KcEvaluation implements Serializable { /**教工号*/ @TableField(exist = false) private java.lang.String jgh; - /**状态*/ + /**状态*/ + @TableField(exist = false) + private java.lang.String zt; + @TableField(exist = false) - private java.lang.String zt; + private String dwmc; + + @TableField(exist = false) + private String xqxn; + + + } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/statistics/TingKeStatisticsController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/statistics/TingKeStatisticsController.java new file mode 100644 index 00000000..33871c64 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/statistics/TingKeStatisticsController.java @@ -0,0 +1,179 @@ +package org.jeecg.modules.kc.statistics; + +import cn.hutool.core.date.DateUnit; +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.beust.jcommander.internal.Sets; +import com.google.common.collect.Maps; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.modules.kc.grab.imports.entity.Xxhbuser; +import org.jeecg.modules.kc.grab.imports.service.IXxhbuserService; +import org.jeecg.modules.kc.kcXqxnHistory.entity.KcXqxnHistory; +import org.jeecg.modules.kc.kcXqxnHistory.service.IKcXqxnHistoryService; +import org.jeecg.modules.kc.qa.entity.KcEvaluation; +import org.jeecg.modules.kc.qa.service.IKcEvaluationService; +import org.jeecg.modules.kc.tksf.kctksfrzb.entity.KcTksfrzb; +import org.jeecg.modules.kc.tksf.kctksfrzb.service.IKcTksfrzbService; +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.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * @Description: 调查问卷-答案表 + * @Author: jeecg-boot + * @Date: 2023-04-09 + * @Version: V1.0 + */ +@Api(tags="调查问卷-答案表") +@RestController +@RequestMapping("/statistics") +@Slf4j +public class TingKeStatisticsController{ + + @Autowired + private IKcEvaluationService kcEvaluationService; + + @Autowired + private IXxhbuserService xxhbuserService; + + @Autowired + private IKcTksfrzbService kcTksfrzbService; + + @Autowired + private IKcXqxnHistoryService kcXqxnHistoryService; + + + @ApiOperation(value="调查问卷-答案表-分页列表查询", notes="调查问卷-答案表-分页列表查询") + @GetMapping(value = "/getEvaluationList") + public Result> list(KcEvaluation evaluation, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(evaluation, req.getParameterMap()); + queryWrapper.isNotNull("upuserid"); + queryWrapper.isNotNull("minkcid"); + Page page = new Page(pageNo, pageSize); + IPage pageList = kcEvaluationService.page(page, queryWrapper); + + //---------------------补数据1------------------------------------------ + Map sourceDictMap = Maps.newHashMap(); + //0:门户添加,1:老系统,2:政务大厅,3后台导入 + sourceDictMap.put(0,"门户添加"); + sourceDictMap.put(1,"老系统"); + sourceDictMap.put(2,"政务大厅"); + sourceDictMap.put(3,"后台导入"); + //---------------------补数据1------------------------------------------ + + Set tjSet = Sets.newHashSet(); + pageList.getRecords().forEach(x -> { + //补充信息 + x.setSourceName(sourceDictMap.get(x.getSource()));//数据来源 + Integer ixuserId = x.getUpuserid(); + String xuserId = String.valueOf(ixuserId); + tjSet.add(xuserId); + }); + //---------------------补数据2------------------------------------------ + //查询所在单位 + QueryWrapper szdwQw = new QueryWrapper<>(); + szdwQw.in("gh",tjSet); + List szdwList = xxhbuserService.list(szdwQw); + Map szdwMap = Maps.newHashMap(); + szdwList.forEach(x -> { + szdwMap.put(x.getGh(),x); + }); + + +// QueryWrapper kcXqxnHistoryQueryWrapper = new QueryWrapper(); + List kcXqxnHistoryList = kcXqxnHistoryService.list(); + + //查询听课身份 + QueryWrapper tksfQw = new QueryWrapper<>(); + tksfQw.in("gh",tjSet); + List tksfList = kcTksfrzbService.list(tksfQw); + Map tksfMap = Maps.newHashMap(); + tksfList.forEach(x -> { + if(tksfMap.containsKey(x.getGh())){ + //存在了,拼接职务名称,取最大的听课要求 + KcTksfrzb currentData = tksfMap.get(x.getGh()); + String currentZwmc = currentData.getZwmc(); + String currentTkyq = currentData.getTkyq(); + if(StringUtils.isNotBlank(currentTkyq)){ + int tkyq = Integer.parseInt(currentTkyq); + int xtkyq = Integer.parseInt(x.getTkyq()); + x.setZwmc(currentZwmc + "、" + x.getZwmc()); + if(tkyq > xtkyq){ + x.setTkyq(String.valueOf(tkyq)); + }else{ + x.setTkyq(String.valueOf(xtkyq)); + } + } + tksfMap.put(x.getGh(),x); + }else { + tksfMap.put(x.getGh(),x); + } + }); + //---------------------补数据2------------------------------------------ + pageList.getRecords().forEach(x -> { + Integer ixuserId = x.getUpuserid(); + String xuserId = String.valueOf(ixuserId); + if(szdwMap.containsKey(xuserId)){ + Xxhbuser currentData = szdwMap.get(xuserId); + x.setDwmc(currentData.getDwmc()); + } + if(tksfMap.containsKey(xuserId)){ + KcTksfrzb currentData = tksfMap.get(xuserId); + //tj.setJsxm(currentData.getXm()); + x.setTksf(currentData.getZwmc()); + //tj.setYskcs(currentData.getTkyq()); + } + + Date upDate = x.getUpDate(); + kcXqxnHistoryList.forEach(hx -> { + Date startTime = hx.getStartTime(); + Date endTime = hx.getEndTime(); + long betweenStartDay = DateUtil.between(startTime, upDate, DateUnit.DAY,false); + long betweenEndDay = DateUtil.between(endTime, upDate, DateUnit.DAY,false); + if(betweenStartDay >=0 && betweenEndDay <=0) { + System.out.println("在范围内"); + x.setXqxn(hx.getTitle()); + } + } ); + + }); + + return Result.OK(pageList); + } + + + public static void main(String[] args) { + Date upDate = DateUtil.parseDateTime("2023-03-13 00:00:00"); + Date startTime = DateUtil.parseDateTime("2023-05-01 00:00:00"); + Date endTime = DateUtil.parseDateTime("2023-07-01 00:00:00"); + long betweenStartDay = DateUtil.between(startTime, upDate, DateUnit.DAY,false); + long betweenEndDay = DateUtil.between(endTime, upDate, DateUnit.DAY,false); + + if(betweenStartDay >=0 && betweenEndDay <=0) { + System.out.println("在范围内"); + } + + System.out.println(betweenStartDay); + System.out.println(betweenEndDay); + + } + +}