From 5a5c05be9c8fd3d7b5ce7185d885ad750644682e Mon Sep 17 00:00:00 2001 From: 龚焕茏 <2842157468@qq.com> Date: 星期三, 31 七月 2024 14:49:55 +0800 Subject: [PATCH] feat:考核详情 --- ycl-server/src/main/java/com/ycl/platform/service/ICheckScoreService.java | 8 ++++++++ ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml | 5 +++-- ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java | 13 +++++++++++-- ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java | 28 ++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 4 deletions(-) diff --git a/ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java b/ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java index bdcb0ec..4b2e20e 100644 --- a/ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java +++ b/ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java @@ -8,11 +8,9 @@ import com.ycl.system.AjaxResult; import com.ycl.system.controller.BaseController; import com.ycl.system.page.TableDataInfo; -import com.ycl.utils.poi.ExcelUtil; import enumeration.BusinessType; import jakarta.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import java.io.IOException; @@ -44,6 +42,17 @@ } /** + * 鏌ヨ鑰冩牳绉垎鎶樼嚎鍥� + */ +// @PreAuthorize("@ss.hasPermi('check:score:chart')") + @GetMapping("/chart") + public AjaxResult selectCheckScoreChart(CheckScore checkScore) + { + Map<Long, List<CheckScore>> deptMap = checkScoreService.selectCheckScoreChart(checkScore); + return success(deptMap); + } + + /** * 鍖哄幙璇︽儏鍒楄〃 */ // @PreAuthorize("@ss.hasPermi('check:score:list')") diff --git a/ycl-server/src/main/java/com/ycl/platform/service/ICheckScoreService.java b/ycl-server/src/main/java/com/ycl/platform/service/ICheckScoreService.java index 0d3f138..32112e0 100644 --- a/ycl-server/src/main/java/com/ycl/platform/service/ICheckScoreService.java +++ b/ycl-server/src/main/java/com/ycl/platform/service/ICheckScoreService.java @@ -35,6 +35,14 @@ */ public Map<Long, List<CheckScore>> selectCheckScoreList(CheckScore checkScore); + /** + * 鏌ヨ鑰冩牳绉垎鎶樼嚎鍥炬暟鎹� + * + * @param checkScore 鑰冩牳绉垎鍙傛暟 + * @return 鑰冩牳绉垎鎶樼嚎鍥� + */ + Map<Long, List<CheckScore>> selectCheckScoreChart(CheckScore checkScore); + int publishCheckScore(CheckScoreDTO checkScoreDTO); diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java index 4767a29..84cdd90 100644 --- a/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java +++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java @@ -149,6 +149,34 @@ return scoreMapper.selectCheckScoreMap(checkScore).stream().collect(Collectors.groupingBy(CheckScore::getDeptId)); } + /** + * 鏌ヨ鑰冩牳绉垎鍗$墖鍒楄〃 + * + * @param checkScore 鑰冩牳绉垎 + * @return 鑰冩牳绉垎 + */ + @Override + @DataScope(deptAlias = "d",userAlias = "u") + public Map<Long, List<CheckScore>> selectCheckScoreChart(CheckScore checkScore) + { + //鍖哄幙鍙兘鐪嬪凡鍙戝竷 + roleControl(checkScore); + + //鏌ヨ鎴愮哗 + String date = checkScore.getDate(); + if(StringUtils.isEmpty(date)){ + //濡傛灉涓虹┖鏌ユ湰鏈堢殑鏁版嵁 + Calendar now = Calendar.getInstance(); + //鍙栨槰澶� + now.add(Calendar.DATE, -1); + Date yesterday = now.getTime(); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM"); + date = simpleDateFormat.format(yesterday); + checkScore.setDate(date); + } + List<CheckScore> checkScores = scoreMapper.selectCheckScoreList(checkScore); + return checkScores.stream().collect(Collectors.groupingBy(CheckScore::getDeptId)); + } /** * 鍖哄幙璇︽儏 diff --git a/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml index 12fb02b..0efeca1 100644 --- a/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml +++ b/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml @@ -119,9 +119,10 @@ SELECT tcs.dept_id, examine_category, - AVG(score) AS score, + ROUND(AVG(score), 2) AS score, #{startDate} AS startDate, - #{endDate} AS endDate + #{endDate} AS endDate, + ANY_VALUE(tcs.create_time) AS createTime FROM t_check_score tcs LEFT JOIN sys_dept d ON tcs.dept_id = d.dept_id -- Gitblit v1.8.0