From ab744742edfd1b402dbbe326acba110db8d0b8ac Mon Sep 17 00:00:00 2001 From: fuliqi <fuliqi@qq.com> Date: 星期二, 03 九月 2024 19:49:31 +0800 Subject: [PATCH] 考核bug修复、详情页加切换 --- ycl-pojo/src/main/java/com/ycl/platform/domain/dto/CheckScoreIndexDTO.java | 1 ycl-server/src/main/resources/mapper/zgyw/CheckTemplateRuleMapper.xml | 14 +- ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckTemplate.java | 2 ycl-server/src/main/java/com/ycl/calculate/CarSnapshopDataCalculation.java | 1 ycl-server/src/main/java/com/ycl/platform/mapper/CheckScoreMapper.java | 16 ++- ycl-server/src/main/resources/application-prod.yml | 2 ycl-server/src/main/java/com/ycl/api/DH/module/LoginModule.java | 6 ycl-server/src/main/java/com/ycl/calculate/FaceSnapshotDataCalculation.java | 1 ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml | 106 +++++++++++++++----------- ycl-server/src/main/java/com/ycl/task/VideoTask.java | 3 ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java | 15 +++ ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java | 41 ++++++--- ycl-server/src/main/java/com/ycl/task/MonitorTask.java | 3 ycl-server/src/main/java/com/ycl/api/YS/YSApi.java | 2 14 files changed, 132 insertions(+), 81 deletions(-) diff --git a/ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java b/ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java index 694cf78..52cda67 100644 --- a/ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java +++ b/ycl-pojo/src/main/java/com/ycl/platform/base/CheckIndex.java @@ -27,9 +27,14 @@ public String deptName; /** 鑰冩牳鏍囩锛堢渷鍘�/甯傚眬锛� */ - @Excel(name = "鑰冩牳鏍囩", dictType = "platform_examine_tag") +// @Excel(name = "鑰冩牳鏍囩", dictType = "platform_examine_tag") @TableField("examine_tag") public Short examineTag; + + @Excel(name = "鑰冩牳鏍囩") + @TableField(exist = false) + public String examineTagStr; + @TableField(exist = false) public List<Integer> deptIds; public Long getId() { @@ -96,4 +101,12 @@ public void setDeptIds(List<Integer> deptIds) { this.deptIds = deptIds; } + + public String getExamineTagStr() { + return examineTagStr; + } + + public void setExamineTagStr(String examineTagStr) { + this.examineTagStr = examineTagStr; + } } diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/CheckScoreIndexDTO.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/CheckScoreIndexDTO.java index a3b5448..6ffad08 100644 --- a/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/CheckScoreIndexDTO.java +++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/CheckScoreIndexDTO.java @@ -10,4 +10,5 @@ private Long id; private String date; private List<String> quarter; + private Integer examineTag; } diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckTemplate.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckTemplate.java index da73ac4..2d39124 100644 --- a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckTemplate.java +++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckTemplate.java @@ -1,6 +1,7 @@ package com.ycl.platform.domain.entity; import annotation.Excel; +import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import com.ycl.system.entity.BaseEntity; import lombok.Data; @@ -19,6 +20,7 @@ */ @Data @Accessors(chain = true) +@TableName("t_check_template") public class CheckTemplate { private static final long serialVersionUID = 1L; diff --git a/ycl-server/src/main/java/com/ycl/api/DH/module/LoginModule.java b/ycl-server/src/main/java/com/ycl/api/DH/module/LoginModule.java index 86861cc..ffcae92 100644 --- a/ycl-server/src/main/java/com/ycl/api/DH/module/LoginModule.java +++ b/ycl-server/src/main/java/com/ycl/api/DH/module/LoginModule.java @@ -182,13 +182,13 @@ osdInfo.read(); NET_GBMODE_CUSTOMTITLE_INFO[] stuCustomTitle = osdInfo.stuCustomTitle; for (NET_GBMODE_CUSTOMTITLE_INFO title : stuCustomTitle) { - String position = new String(title.szPositon, StandardCharsets.UTF_8); + String position = new String(title.szPositon, StandardCharsets.UTF_8).trim(); if("LeftDown".equals(position)) { NET_TITLE_OSD_INFO[] stuOSD = title.stuOSD; for (NET_TITLE_OSD_INFO osd : stuOSD) { String osdStr = null; osdStr = new String(osd.szText, StandardCharsets.UTF_8).trim(); - log.info("TEXT锛�"+osdStr); +// log.info("TEXT锛�"+osdStr); if (!StringUtils.isEmpty(osdStr)) { osdResult.setOSD4(osdStr); } @@ -199,7 +199,7 @@ for (NET_TITLE_OSD_INFO osd : stuOSD) { String osdStr = null; osdStr = new String(osd.szText, StandardCharsets.UTF_8).trim(); - log.info("TEXT锛�"+osdStr); +// log.info("TEXT锛�"+osdStr); if (!StringUtils.isEmpty(osdStr)) { if(num ==0){ osdResult.setOSD1(osdStr); diff --git a/ycl-server/src/main/java/com/ycl/api/YS/YSApi.java b/ycl-server/src/main/java/com/ycl/api/YS/YSApi.java index a68216d..6ae2f35 100644 --- a/ycl-server/src/main/java/com/ycl/api/YS/YSApi.java +++ b/ycl-server/src/main/java/com/ycl/api/YS/YSApi.java @@ -94,9 +94,11 @@ //鐪佷唤 String name = new String(stOSDInfo.stNameOSD.szOSDText, StandardCharsets.UTF_8); osdResult.setOSD1(name); +// log.info("name"+name); int num = 0; for (NetDEVSDKLib.NETDEV_OSD_TEXT_OVERLAY_S osd : stOSDInfo.astTextOverlay) { String text = new String(osd.szOSDText, StandardCharsets.UTF_8).trim(); +// log.info("num:"+num+",texr:"+text); if (num == 0) { osdResult.setOSD2(text); } else if (num == 1) { diff --git a/ycl-server/src/main/java/com/ycl/calculate/CarSnapshopDataCalculation.java b/ycl-server/src/main/java/com/ycl/calculate/CarSnapshopDataCalculation.java index 4abbad3..3da6fba 100644 --- a/ycl-server/src/main/java/com/ycl/calculate/CarSnapshopDataCalculation.java +++ b/ycl-server/src/main/java/com/ycl/calculate/CarSnapshopDataCalculation.java @@ -166,6 +166,7 @@ noDateCount = 0; } Double deductScore = 0.1 * noDateCount; + if (stats.totalDataSum != 0) { BigDecimal avgCount = key.startsWith(ApiConstants.Province) ? cityCountAvg : countyCountAvg; Map<String, Object> viewConnectParam = new HashMap<>(); diff --git a/ycl-server/src/main/java/com/ycl/calculate/FaceSnapshotDataCalculation.java b/ycl-server/src/main/java/com/ycl/calculate/FaceSnapshotDataCalculation.java index 38ca460..d1685a6 100644 --- a/ycl-server/src/main/java/com/ycl/calculate/FaceSnapshotDataCalculation.java +++ b/ycl-server/src/main/java/com/ycl/calculate/FaceSnapshotDataCalculation.java @@ -154,6 +154,7 @@ noDateCount = 0; } Double deductScore = 0.1 * noDateCount; + log.info("鎬婚噺锛歿}",stats.totalDataSum); if (stats.totalDataSum != 0) { BigDecimal avgCount = key.startsWith(ApiConstants.Province) ? cityCountAvg : countyCountAvg; Map<String, Object> viewConnectParam = new HashMap<>(); diff --git a/ycl-server/src/main/java/com/ycl/platform/mapper/CheckScoreMapper.java b/ycl-server/src/main/java/com/ycl/platform/mapper/CheckScoreMapper.java index 42a0ce9..ed210d2 100644 --- a/ycl-server/src/main/java/com/ycl/platform/mapper/CheckScoreMapper.java +++ b/ycl-server/src/main/java/com/ycl/platform/mapper/CheckScoreMapper.java @@ -13,7 +13,7 @@ /** * 鑰冩牳绉垎鏄庣粏Mapper鎺ュ彛 - * + * * @author ruoyi * @date 2024-04-22 */ @@ -21,7 +21,7 @@ { /** * 鏌ヨ鑰冩牳绉垎鏄庣粏 - * + * * @param id 鑰冩牳绉垎鏄庣粏涓婚敭 * @return 鑰冩牳绉垎鏄庣粏 */ @@ -29,7 +29,7 @@ /** * 鏌ヨ鑰冩牳绉垎鏄庣粏鍒楄〃 - * + * * @param checkScore 鑰冩牳绉垎鏄庣粏 * @return 鑰冩牳绉垎鏄庣粏闆嗗悎 */ @@ -37,7 +37,7 @@ /** * 鏂板鑰冩牳绉垎鏄庣粏 - * + * * @param checkScore 鑰冩牳绉垎鏄庣粏 * @return 缁撴灉 */ @@ -45,7 +45,7 @@ /** * 淇敼鑰冩牳绉垎鏄庣粏 - * + * * @param checkScore 鑰冩牳绉垎鏄庣粏 * @return 缁撴灉 */ @@ -53,7 +53,7 @@ /** * 鍒犻櫎鑰冩牳绉垎鏄庣粏 - * + * * @param id 鑰冩牳绉垎鏄庣粏涓婚敭 * @return 缁撴灉 */ @@ -61,7 +61,7 @@ /** * 鎵归噺鍒犻櫎鑰冩牳绉垎鏄庣粏 - * + * * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎 * @return 缁撴灉 */ @@ -90,4 +90,6 @@ * @return 鏁版嵁 */ List<Map<String, Object>> calculate(Date startDate, Date endDate, String category); + + CheckScore getLast(CheckScore checkScore); } 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 19c36b7..1c70ede 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 @@ -1,6 +1,7 @@ package com.ycl.platform.service.impl; import annotation.DataScope; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ycl.platform.domain.dto.CheckScoreDTO; @@ -22,6 +23,7 @@ import com.ycl.utils.DateUtils; import com.ycl.utils.SecurityUtils; import com.ycl.utils.StringUtils; +import constant.CheckConstants; import enumeration.general.PublishType; import jakarta.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; @@ -77,8 +79,18 @@ CheckScoreDetailVO checkScoreDetailVO = new CheckScoreDetailVO(); //鏍规嵁id璇诲彇score CheckScore checkScore = scoreMapper.selectCheckScoreById(checkScoreId); + Integer templateId = 0; + //鏂逛究鍒囨崲鏀逛负锛氭牴鎹畇core鑰冩牳绫诲埆鍜宒to鑰冩牳鏍囩鏌ユā鏉胯鍒欏拰鏉冮噸,娉ㄦ剰鍚岀绫诲悓鏍囩鍙兘鏈変竴涓ā鏉� + QueryWrapper<CheckTemplate> wrapper = new QueryWrapper<>(); + wrapper.eq("examine_tag",checkScoreIndexDTO.getExamineTag()); + wrapper.eq("examine_category",checkScore.getExamineCategory()); + Optional<CheckTemplate> first = templateMapper.selectList(wrapper).stream().findFirst(); + if(first.isPresent()){ + CheckTemplate checkTemplate = first.get(); + templateId = checkTemplate.getId(); + } //璇诲彇瑙勫垯浠ュ強鏉冮噸 - List<CheckTemplateRule> templateRuleList = templateRuleMapper.selectListByTemplateId(checkScore.getTemplateId()); + List<CheckTemplateRule> templateRuleList = templateRuleMapper.selectListByTemplateId(templateId); List<CheckRule> checkRules = new ArrayList<>(); //璇诲彇妯℃澘瀵瑰簲鎵�鏈夎鍒� @@ -99,7 +111,7 @@ .setDate(checkScoreIndexDTO.getDate()) .setQuarter(checkScoreIndexDTO.getQuarter()); scoreIndexDTO.setParams(checkScoreIndexDTO.getParams()); - scoreIndexDTO.setExamineTag(checkScore.getExamineTag()); + scoreIndexDTO.setExamineTag(checkScoreIndexDTO.getExamineTag()); //鑾峰綋鏈堜唤 if (StringUtils.isEmpty(scoreIndexDTO.getDate()) && CollectionUtils.isEmpty(checkScoreIndexDTO.getQuarter())) { //濡傛灉鏌ヨ鏉′欢涓嶅惈鍙傛暟锛屾煡璇㈢Н鍒嗗搴斿垱寤烘椂闂� @@ -144,7 +156,7 @@ // 濡傛灉鏁版嵁涓虹┖锛屽垯鏌ヨ涔嬪墠鐨勬暟鎹� if (checkScores.isEmpty()) { - CheckScore one = new LambdaQueryChainWrapper<>(baseMapper).select(CheckScore::getCreateTime).last("order by create_time desc limit 1").one(); + CheckScore one = scoreMapper.getLast(checkScore); if (Objects.nonNull(one)) { calendar.setTime(one.getCreateTime()); getCheckScore(checkScore, calendar); @@ -244,14 +256,12 @@ @Override public void exportIndex(HttpServletResponse response, CheckScore checkScoreDTO) throws IOException { String date = checkScoreDTO.getDate(); - Integer examineTag = null; //濡傛灉璇锋眰鍙傛暟鏃堕棿涓虹┖锛屾煡杩欐潯璁板綍鐨勬椂闂� if (StringUtils.isEmpty(checkScoreDTO.getDate()) && CollectionUtils.isEmpty(checkScoreDTO.getQuarter())) { CheckScore checkScore = getById(checkScoreDTO.getId()); Date createTime = checkScore.getCreateTime(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM"); date = formatter.format(createTime); - examineTag = checkScore.getExamineTag(); } /** 瀵间笁寮爏heet */ @@ -259,28 +269,28 @@ CheckIndexCar checkIndexCar = new CheckIndexCar(); checkIndexCar.setDate(date); checkIndexCar.setQuarter(checkScoreDTO.getQuarter()); - if (examineTag != null) { - checkIndexCar.setExamineTag(Short.parseShort(examineTag + "")); - } List<CheckIndexCar> checkIndexCars = indexCarService.selectCheckIndexCarList(checkIndexCar); + for (CheckIndexCar indexCar : checkIndexCars) { + indexCar.setExamineTagStr(CheckConstants.Examine_Tag_Province.equals(indexCar.getExamineTag()) ? "鐪佸巺鑰冩牳" : "鍖哄幙鑰冩牳"); + } ExcelExp e1 = new ExcelExp("杞﹁締鑰冩牳鎸囨爣鏁版嵁", checkIndexCars, CheckIndexCar.class); //浜鸿劯 CheckIndexFace checkIndexFace = new CheckIndexFace(); checkIndexFace.setDate(date); checkIndexFace.setQuarter(checkScoreDTO.getQuarter()); - if (examineTag != null) { - checkIndexFace.setExamineTag(Short.parseShort(examineTag + "")); - } List<CheckIndexFace> checkIndexFaces = indexFaceService.selectCheckIndexFaceList(checkIndexFace); + for (CheckIndexFace indexFace : checkIndexFaces) { + indexFace.setExamineTagStr(CheckConstants.Examine_Tag_Province.equals(indexFace.getExamineTag()) ? "鐪佸巺鑰冩牳" : "鍖哄幙鑰冩牳"); + } ExcelExp e2 = new ExcelExp("浜鸿劯鑰冩牳鎸囨爣鏁版嵁", checkIndexFaces, CheckIndexFace.class); //瑙嗛 CheckIndexVideo checkIndexVideo = new CheckIndexVideo(); checkIndexVideo.setDate(date); checkIndexVideo.setQuarter(checkScoreDTO.getQuarter()); - if (examineTag != null) { - checkIndexVideo.setExamineTag(Short.parseShort(examineTag + "")); - } List<CheckIndexVideo> checkIndexVideos = indexVideoService.selectCheckIndexVideoList(checkIndexVideo); + for (CheckIndexVideo indexVideo : checkIndexVideos) { + indexVideo.setExamineTagStr(CheckConstants.Examine_Tag_Province.equals(indexVideo.getExamineTag()) ? "鐪佸巺鑰冩牳" : "鍖哄幙鑰冩牳"); + } ExcelExp e3 = new ExcelExp("瑙嗛鑰冩牳鎸囨爣鏁版嵁", checkIndexVideos, CheckIndexVideo.class); List<ExcelExp> mysheet = new ArrayList<>(); @@ -297,7 +307,8 @@ SysUser user = SecurityUtils.getLoginUser().getUser(); if (!user.isAdmin()) { for (SysRole role : roles) { - if (role.getPermissions().contains("check:score:publish")) { + //TODO锛氭湰鍦板簱淇敼 + if (role.getPermissions().contains("check:score:role:publish")) { Map<String, Object> params = checkScore.getParams(); params.put("publish", PublishType.PUBLISHED.getCode()); } diff --git a/ycl-server/src/main/java/com/ycl/task/MonitorTask.java b/ycl-server/src/main/java/com/ycl/task/MonitorTask.java index 4262d99..f7a9515 100644 --- a/ycl-server/src/main/java/com/ycl/task/MonitorTask.java +++ b/ycl-server/src/main/java/com/ycl/task/MonitorTask.java @@ -64,7 +64,8 @@ Query query = new Query(Criteria.where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday))); List<MonitorQualifyResult> oneMachineFileResults = mongoTemplate.find(query, MonitorQualifyResult.class); //mongo鍝佺墝鏁版嵁 - Query OSDQuery = new Query(Criteria.where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday))); + //TODO:娴嬭瘯鏀逛负浠婂ぉ + Query OSDQuery = new Query(Criteria.where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); Map<String, OsdCheckResult> osdMap = mongoTemplate.find(query, OsdCheckResult.class).stream().collect(Collectors.toMap(OsdCheckResult::getDeviceNo, Function.identity())); //鏁版嵁搴搈onitor琛ㄦ暟鎹� Map<String, TMonitorVO> monitorVOMap = monitorMapper.selectMonitorVOList().stream().collect(Collectors.toMap(TMonitorVO::getSerialNumber, Function.identity())); diff --git a/ycl-server/src/main/java/com/ycl/task/VideoTask.java b/ycl-server/src/main/java/com/ycl/task/VideoTask.java index 3a277bd..6443d2f 100644 --- a/ycl-server/src/main/java/com/ycl/task/VideoTask.java +++ b/ycl-server/src/main/java/com/ycl/task/VideoTask.java @@ -114,10 +114,11 @@ public void osdTask() { log.info("寮�濮嬭绠桹sd鏍囨敞銆佹椂闂村噯纭巼"); //璁$畻Osd鏍囨敞銆佹椂闂村噯纭巼 + //TODO娴嬭瘯鏀逛负浠婂ぉ Date yesterday = DateUtils.addDays(new Date(), -1); Query query = new Query(); query.addCriteria(Criteria - .where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday))); + .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); List<OsdCheckResult> results = mongoTemplate.find(query, OsdCheckResult.class); CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_OsdTime); calculator.calculate(results); diff --git a/ycl-server/src/main/resources/application-prod.yml b/ycl-server/src/main/resources/application-prod.yml index 3ed02a3..3d821a2 100644 --- a/ycl-server/src/main/resources/application-prod.yml +++ b/ycl-server/src/main/resources/application-prod.yml @@ -124,7 +124,7 @@ host: 51.92.65.49 appKey: 29555942 appSecret: t9U7tCplCyYHzQPPL7cH - + 1111: Hik12345+ DH: userName: admin password: zg@2024dx diff --git a/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml index de53afb..ef79637 100644 --- a/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml +++ b/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml @@ -1,38 +1,39 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper -PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" -"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.ycl.platform.mapper.CheckScoreMapper"> <resultMap type="com.ycl.platform.domain.entity.CheckScore" id="CheckScoreResult"> - <result property="id" column="id" /> - <result property="score" column="score" /> - <result property="deptId" column="dept_id" /> - <result property="templateId" column="template_id" /> - <result property="examineTag" column="examine_tag" /> - <result property="examineCategory" column="examine_category" /> - <result property="createTime" column="create_time" /> - <result property="updateTime" column="update_time" /> - <result property="updateUser" column="update_user" /> - <result property="publish" column="publish" /> + <result property="id" column="id"/> + <result property="score" column="score"/> + <result property="deptId" column="dept_id"/> + <result property="templateId" column="template_id"/> + <result property="examineTag" column="examine_tag"/> + <result property="examineCategory" column="examine_category"/> + <result property="createTime" column="create_time"/> + <result property="updateTime" column="update_time"/> + <result property="updateUser" column="update_user"/> + <result property="publish" column="publish"/> </resultMap> <sql id="selectCheckScoreVo"> - select id, score, tcs.dept_id, template_id, examine_tag, examine_category, tcs.create_time,tcs.update_time,tcs.update_user, publish + select id, score, tcs.dept_id, template_id, examine_tag, examine_category, + tcs.create_time,tcs.update_time,tcs.update_user, publish from t_check_score tcs left join sys_dept d on tcs.dept_id = d.dept_id </sql> <select id="selectCheckScoreList" resultMap="CheckScoreResult"> <include refid="selectCheckScoreVo"/> <where> - <if test="score != null "> and score = #{score}</if> - <if test="templateId != null "> and template_id = #{templateId}</if> - <if test="createTime != null "> and DATE(tcs.create_time) = #{createTime}</if> - <if test="date != null "> and date_format(tcs.create_time,'%Y-%m') = #{date}</if> - <if test="examineTag != null "> and examine_tag = #{examineTag}</if> - <if test="examineCategory != null "> and examine_category = #{examineCategory}</if> - <if test="params.publish != null and params.publish != ''"> and publish = #{params.publish}</if> - <if test="deptId != null "> and tcs.dept_id = #{deptId}</if> + <if test="score != null ">and score = #{score}</if> + <if test="templateId != null ">and template_id = #{templateId}</if> + <if test="createTime != null ">and DATE(tcs.create_time) = #{createTime}</if> + <if test="date != null ">and date_format(tcs.create_time,'%Y-%m') = #{date}</if> + <if test="examineTag != null ">and examine_tag = #{examineTag}</if> + <if test="examineCategory != null ">and examine_category = #{examineCategory}</if> + <if test="params.publish != null and params.publish != ''">and publish = #{params.publish}</if> + <if test="deptId != null ">and tcs.dept_id = #{deptId}</if> ${params.dataScope} </where> order by create_time desc @@ -55,7 +56,7 @@ <if test="updateTime != null">update_time,</if> <if test="updateUser != null">update_user,</if> <if test="publish != null">publish,</if> - </trim> + </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="score != null">#{score},</if> <if test="deptId != null">#{deptId},</if> @@ -66,10 +67,10 @@ <if test="updateTime != null">#{updateTime},</if> <if test="updateUser != null">#{updateUser},</if> <if test="publish != null">#{publish},</if> - </trim> + </trim> </insert> - <update id="updateCheckScore" > + <update id="updateCheckScore"> update t_check_score <trim prefix="SET" suffixOverrides=","> <if test="score != null">score = #{score},</if> @@ -120,27 +121,41 @@ </select> <insert id="saveBatch"> - insert into t_check_score (score,dept_id,template_id,examine_tag,examine_category,create_time) values <foreach collection="scoreList" separator="," item="score"> - (#{score.score},#{score.deptId},#{score.templateId},#{score.examineTag},#{score.examineCategory},#{score.createTime}) - </foreach> + insert into t_check_score (score,dept_id,template_id,examine_tag,examine_category,create_time) values + <foreach collection="scoreList" separator="," item="score"> + (#{score.score},#{score.deptId},#{score.templateId},#{score.examineTag},#{score.examineCategory},#{score.createTime}) + </foreach> </insert> <select id="selectCheckScoreMap" resultType="com.ycl.platform.domain.entity.CheckScore"> SELECT - id, - tcs.dept_id, - examine_category, - ROUND(AVG(score) OVER(PARTITION BY tcs.dept_id, examine_category), 2) AS score, - tcs.create_time AS createTime + id, + tcs.dept_id, + examine_category, + ROUND(AVG(score) OVER(PARTITION BY tcs.dept_id, examine_category), 2) AS score, + tcs.publish, + tcs.create_time AS createTime FROM - t_check_score tcs - LEFT JOIN sys_dept d ON tcs.dept_id = d.dept_id - WHERE + t_check_score tcs + LEFT JOIN sys_dept d ON tcs.dept_id = d.dept_id + <where> examine_tag = #{examineTag} - AND DATE_FORMAT(tcs.create_time, '%Y-%m') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m') AND DATE_FORMAT(#{endDate}, '%Y-%m') - GROUP BY tcs.dept_id, examine_category,examine_tag -</select> + AND DATE_FORMAT(tcs.create_time, '%Y-%m') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m') AND DATE_FORMAT(#{endDate}, '%Y-%m') + <if test="params.publish != null and params.publish != ''">and publish = #{params.publish}</if> + ${params.dataScope} + </where> + GROUP BY tcs.dept_id, tcs.examine_category, tcs.examine_tag + </select> + <select id="getLast" resultType="com.ycl.platform.domain.entity.CheckScore"> + select * from t_check_score tcs LEFT JOIN sys_dept d ON tcs.dept_id = d.dept_id + <where> + tcs.examine_tag = #{examineTag} + <if test="params.publish != null and params.publish != ''">and tcs.publish = #{params.publish}</if> + ${params.dataScope} + </where> + order by tcs.create_time desc limit 1 + </select> <select id="home" resultType="java.util.Map"> <![CDATA[ SELECT @@ -160,15 +175,16 @@ <select id="calculate" resultType="java.util.Map"> SELECT - area AS deptName, - ROUND(AVG(score)) AS score + area AS deptName, + ROUND(AVG(score)) AS score FROM - t_check_score tcs - LEFT JOIN sys_dept d ON tcs.dept_id = d.dept_id + t_check_score tcs + LEFT JOIN sys_dept d ON tcs.dept_id = d.dept_id WHERE - examine_tag = 1 - AND examine_category = #{category} - AND DATE_FORMAT(tcs.create_time, '%Y-%m') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m') AND DATE_FORMAT(#{endDate}, '%Y-%m') + examine_tag = 1 + AND examine_category = #{category} + AND DATE_FORMAT(tcs.create_time, '%Y-%m') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m') AND DATE_FORMAT(#{endDate}, + '%Y-%m') GROUP BY tcs.dept_id ORDER BY score DESC, tcs.dept_id </select> diff --git a/ycl-server/src/main/resources/mapper/zgyw/CheckTemplateRuleMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/CheckTemplateRuleMapper.xml index 8445c62..2893c43 100644 --- a/ycl-server/src/main/resources/mapper/zgyw/CheckTemplateRuleMapper.xml +++ b/ycl-server/src/main/resources/mapper/zgyw/CheckTemplateRuleMapper.xml @@ -3,7 +3,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.ycl.platform.mapper.CheckTemplateRuleMapper"> - + <resultMap type="com.ycl.platform.domain.entity.CheckTemplateRule" id="CheckTemplateRuleResult"> <result property="id" column="id" /> <result property="checkTemplateId" column="check_template_id" /> @@ -17,17 +17,17 @@ <select id="selectCheckTemplateRuleList" resultMap="CheckTemplateRuleResult"> <include refid="selectCheckTemplateRuleVo"/> - <where> + <where> <if test="checkTemplateId != null "> and check_template_id = #{checkTemplateId}</if> <if test="checkRuleId != null "> and check_rule_id = #{checkRuleId}</if> </where> </select> - + <select id="selectCheckTemplateRuleById" resultMap="CheckTemplateRuleResult"> <include refid="selectCheckTemplateRuleVo"/> where id = #{id} </select> - + <insert id="insertCheckTemplateRule" useGeneratedKeys="true" keyProperty="id"> insert into t_check_template_rule <trim prefix="(" suffix=")" suffixOverrides=","> @@ -57,7 +57,7 @@ </delete> <delete id="deleteCheckTemplateRuleByIds"> - delete from t_check_template_rule where id in + delete from t_check_template_rule where id in <foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach> @@ -69,7 +69,7 @@ <select id="selectListByTemplateId" resultType="com.ycl.platform.domain.entity.CheckTemplateRule"> select tctr.*,tcr.rule_name as checkRuleName,tcr.rule_index from t_check_template_rule tctr left join t_check_rule tcr on tctr.check_rule_id = tcr.id - where check_template_id = #{checkTemplateId} + where tctr.check_template_id = #{checkTemplateId} </select> -</mapper> \ No newline at end of file +</mapper> -- Gitblit v1.8.0