From 224428e399b4f4d46ddf3f15b2bbf426fb922e2c Mon Sep 17 00:00:00 2001 From: fuliqi <fuliqi@qq.com> Date: 星期五, 26 四月 2024 11:12:53 +0800 Subject: [PATCH] 考核结果指标详情页面 --- ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckTemplateRule.java | 2 ycl-common/src/main/java/enumeration/general/PublishType.java | 23 ++ ycl-pojo/src/main/java/com/ycl/platform/domain/dto/CheckScoreDTO.java | 17 + ycl-server/src/main/java/com/ycl/task/CheckScore.java | 12 + ycl-pojo/src/main/java/com/ycl/platform/domain/query/CheckTemplateQuery.java | 2 ycl-pojo/src/main/java/com/ycl/platform/domain/vo/CheckScoreDetailVO.java | 13 + ycl-server/src/main/resources/mapper/zgyw/CheckTemplateRuleMapper.xml | 5 ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckTemplate.java | 2 ycl-server/src/main/java/com/ycl/platform/service/ICheckScoreService.java | 13 ycl-server/src/main/java/com/ycl/platform/mapper/CheckScoreMapper.java | 14 + ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java | 2 ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckRule.java | 4 ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckScore.java | 151 ++---------- ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml | 63 +++-- ycl-server/src/main/java/com/ycl/platform/controller/CheckScoreController.java | 114 +++++---- ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java | 157 +++++++++++-- ycl-server/src/main/java/com/ycl/system/service/impl/SysJobServiceImpl.java | 1 ycl-server/src/main/java/com/ycl/platform/service/impl/CheckTemplateServiceImpl.java | 8 18 files changed, 367 insertions(+), 236 deletions(-) diff --git a/ycl-common/src/main/java/enumeration/general/PublishType.java b/ycl-common/src/main/java/enumeration/general/PublishType.java new file mode 100644 index 0000000..f0852b0 --- /dev/null +++ b/ycl-common/src/main/java/enumeration/general/PublishType.java @@ -0,0 +1,23 @@ +package enumeration.general; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.fasterxml.jackson.annotation.JsonValue; +import lombok.Getter; + +@Getter +public enum PublishType { + + UNPUBLISHED("UNPUBLISHED", "鏈彂甯�"), + PUBLISHED("PUBLISHED", "宸插彂甯�"); + + @EnumValue // 鏍囨槑璇ュ瓧娈靛瓨鍏ユ暟鎹簱 + @JsonValue // 鏍囨槑鍦ㄨ浆JSON鏃朵娇鐢ㄨ瀛楁锛屽嵆鍝嶅簲鏃� + private final String code; + + private final String desc; + + PublishType(String code,String desc) { + this.code = code; + this.desc = desc; + } +} diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/CheckScoreDTO.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/CheckScoreDTO.java new file mode 100644 index 0000000..20cf62d --- /dev/null +++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/CheckScoreDTO.java @@ -0,0 +1,17 @@ +package com.ycl.platform.domain.dto; + +import lombok.Data; + +import java.util.Date; +import java.util.List; + +@Data +public class CheckScoreDTO { + private List<Integer> id; + private String publish; + private Date updateTime; + private Long updateUser; + + private Date createTime; + private Integer examineTag; +} diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckRule.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckRule.java index 3c2e81e..8b9540a 100644 --- a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckRule.java +++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckRule.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; @@ -16,7 +17,8 @@ * @date 2024-04-15 */ @Data -public class CheckRule extends BaseEntity +@TableName("t_check_rule") +public class CheckRule { private static final long serialVersionUID = 1L; diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckScore.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckScore.java index f544566..17b08cf 100644 --- a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckScore.java +++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckScore.java @@ -1,19 +1,24 @@ package com.ycl.platform.domain.entity; import annotation.Excel; +import com.fasterxml.jackson.annotation.JsonFormat; import com.ycl.system.entity.BaseEntity; +import lombok.Data; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; +import org.springframework.format.annotation.DateTimeFormat; import java.math.BigDecimal; +import java.util.Date; /** * 鑰冩牳绉垎鏄庣粏瀵硅薄 t_check_score * * @author ruoyi - * @date 2024-04-01 + * @date 2024-04-22 */ -public class CheckScore extends BaseEntity +@Data +public class CheckScore { private static final long serialVersionUID = 1L; @@ -24,128 +29,36 @@ @Excel(name = "鍒嗗��") private BigDecimal score; - /** 鍖哄幙 */ + /** deptid */ @Excel(name = "鍖哄幙") private Long deptId; - /** 鑰冩牳 */ - @Excel(name = "鑰冩牳") - private Long publishId; + /** 鑰冩牳妯℃澘id */ + @Excel(name = "鑰冩牳妯℃澘id") + private Integer templateId; - /** 瑙勫垯 */ - @Excel(name = "瑙勫垯") - private Long ruleId; + /** 鑰冩牳鏍囩(鐪佸巺/甯傚眬) */ + @Excel(name = "鑰冩牳鏍囩(鐪佸巺/甯傚眬)") + private Integer examineTag; - /** 鑰冩牳绫诲瀷 */ - @Excel(name = "鑰冩牳绫诲瀷") - private Long examineCategory; + /** 鑰冩牳绫诲瀷(杞﹁締/浜鸿劯/瑙嗛) */ + @Excel(name = "鑰冩牳绫诲瀷(杞﹁締/浜鸿劯/瑙嗛)") + private Integer examineCategory; + /** 淇敼鏃堕棿 */ + @Excel(name = "淇敼鏃堕棿") + private Date updateTime; - /** */ - private Long updateUser; + /** 鍒涘缓鏃堕棿 */ + @Excel(name = "鍒涘缓鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date createTime; + /** 淇敼浜� */ + @Excel(name = "淇敼浜�") + private Integer updateUser; + /** 鏄惁鍙戝竷 */ + @Excel(name = "鏄惁鍙戝竷") + private String publish; - /** */ - @Excel(name = "") - private String updateUserName; - - /** */ - @Excel(name = "") - private Long auditState; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setScore(BigDecimal score) - { - this.score = score; - } - - public BigDecimal getScore() - { - return score; - } - public void setDeptId(Long deptId) - { - this.deptId = deptId; - } - - public Long getDeptId() - { - return deptId; - } - public void setPublishId(Long publishId) - { - this.publishId = publishId; - } - - public Long getPublishId() - { - return publishId; - } - public void setRuleId(Long ruleId) - { - this.ruleId = ruleId; - } - - public Long getRuleId() - { - return ruleId; - } - public void setExamineCategory(Long examineCategory) - { - this.examineCategory = examineCategory; - } - - public Long getExamineCategory() - { - return examineCategory; - } - public void setUpdateUser(Long updateUser) - { - this.updateUser = updateUser; - } - - public Long getUpdateUser() - { - return updateUser; - } - public void setUpdateUserName(String updateUserName) - { - this.updateUserName = updateUserName; - } - - public String getUpdateUserName() - { - return updateUserName; - } - public void setAuditState(Long auditState) - { - this.auditState = auditState; - } - - public Long getAuditState() - { - return auditState; - } - - @Override - public String toString() { - return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("score", getScore()) - .append("deptId", getDeptId()) - .append("publishId", getPublishId()) - .append("ruleId", getRuleId()) - .append("examineCategory", getExamineCategory()) - .append("createTime", getCreateTime()) - .append("updateUser", getUpdateUser()) - .append("updateUserName", getUpdateUserName()) - .append("auditState", getAuditState()) - .toString(); - } + //鎶樼嚎鍥炬棩鏈熷弬鏁� + private String date; } 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 76c6bd4..1bed2e7 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 @@ -32,7 +32,7 @@ /** 璋冩暣绯绘暟 */ @Excel(name = "璋冩暣绯绘暟") - private Long adjustCoefficient; + private BigDecimal adjustCoefficient; /** 璋冩暣鏂瑰紡锛氫箻闄� */ @Excel(name = "璋冩暣鏂瑰紡锛氫箻闄�") diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckTemplateRule.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckTemplateRule.java index 01fa7de..bd641c2 100644 --- a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckTemplateRule.java +++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/CheckTemplateRule.java @@ -45,5 +45,5 @@ @TableField("weight") private BigDecimal weight; - + private String checkRuleName; } diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/query/CheckTemplateQuery.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/query/CheckTemplateQuery.java index 557758b..30e6c76 100644 --- a/ycl-pojo/src/main/java/com/ycl/platform/domain/query/CheckTemplateQuery.java +++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/query/CheckTemplateQuery.java @@ -27,7 +27,7 @@ private String templateName; /** 璋冩暣绯绘暟 */ - private Long adjustCoefficient; + private String adjustCoefficient; /** 璋冩暣鏂瑰紡锛氫箻闄� */ private String adjustWay; diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/CheckScoreDetailVO.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/CheckScoreDetailVO.java new file mode 100644 index 0000000..3814792 --- /dev/null +++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/CheckScoreDetailVO.java @@ -0,0 +1,13 @@ +package com.ycl.platform.domain.vo; + +import com.ycl.platform.domain.entity.CheckTemplateRule; +import lombok.Data; + +import java.util.List; +import java.util.Map; + +@Data +public class CheckScoreDetailVO { + private List<CheckTemplateRule> checkRuleList; + private Map<String,Object> scoreMap; +} 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 6d0667a..f001700 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 @@ -1,25 +1,25 @@ package com.ycl.platform.controller; import annotation.Log; +import com.ycl.platform.domain.dto.CheckScoreDTO; import com.ycl.platform.domain.entity.CheckScore; import com.ycl.platform.service.ICheckScoreService; 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.util.List; +import java.util.Map; /** - * 鑰冩牳绉垎鏄庣粏Controller + * 鑰冩牳绉垎Controller * * @author ruoyi - * @date 2024-04-01 + * @date 2024-04-22 */ @RestController @RequestMapping("/check/score") @@ -29,70 +29,84 @@ private ICheckScoreService checkScoreService; /** - * 鏌ヨ鑰冩牳绉垎鏄庣粏鍒楄〃 + * 鏌ヨ鑰冩牳绉垎鍗$墖鍒楄〃 */ -// @PreAuthorize("@ss.hasPermi('system:score:list')") + @PreAuthorize("@ss.hasPermi('check:score:list')") @GetMapping("/list") - public TableDataInfo list(CheckScore checkScore) + public AjaxResult list(CheckScore checkScore) + { + Map<Long, List<CheckScore>> deptMap = checkScoreService.selectCheckScoreList(checkScore); + return success(deptMap); + } + + /** + * 鍖哄幙璇︽儏鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('check:score:list')") + @GetMapping("/detail") + public TableDataInfo detail(CheckScore checkScore) { startPage(); - List<CheckScore> list = checkScoreService.selectCheckScoreList(checkScore); - return getDataTable(list); + List<CheckScore> page = checkScoreService.page(checkScore); + return getDataTable(page); } - /** - * 瀵煎嚭鑰冩牳绉垎鏄庣粏鍒楄〃 - */ - @PreAuthorize("@ss.hasPermi('system:score:export')") - @Log(title = "鑰冩牳绉垎鏄庣粏", businessType = BusinessType.EXPORT) - @PostMapping("/export") - public void export(HttpServletResponse response, CheckScore checkScore) - { - List<CheckScore> list = checkScoreService.selectCheckScoreList(checkScore); - ExcelUtil<CheckScore> util = new ExcelUtil<CheckScore>(CheckScore.class); - util.exportExcel(response, list, "鑰冩牳绉垎鏄庣粏鏁版嵁"); - } /** - * 鑾峰彇鑰冩牳绉垎鏄庣粏璇︾粏淇℃伅 + * 鑾峰彇鑰冩牳绉垎璇︾粏淇℃伅 */ -// @PreAuthorize("@ss.hasPermi('system:score:query')") - @GetMapping(value = "/{id}") + @PreAuthorize("@ss.hasPermi('check:score:query')") + @GetMapping(value = "/detail/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return success(checkScoreService.selectCheckScoreById(id)); } /** - * 鏂板鑰冩牳绉垎鏄庣粏 + * 鍙戝竷鑰冩牳绉垎 */ - @PreAuthorize("@ss.hasPermi('system:score:add')") - @Log(title = "鑰冩牳绉垎鏄庣粏", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody CheckScore checkScore) + @PreAuthorize("@ss.hasPermi('check:score:edit')") + @Log(title = "鑰冩牳绉垎", businessType = BusinessType.UPDATE) + @PutMapping("/publish") + public AjaxResult edit(@RequestBody CheckScoreDTO checkScoreDTO) { - return toAjax(checkScoreService.insertCheckScore(checkScore)); + + return toAjax(checkScoreService.publishCheckScore(checkScoreDTO)); } - /** - * 淇敼鑰冩牳绉垎鏄庣粏 - */ - @PreAuthorize("@ss.hasPermi('system:score:edit')") - @Log(title = "鑰冩牳绉垎鏄庣粏", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody CheckScore checkScore) - { - return toAjax(checkScoreService.updateCheckScore(checkScore)); - } +// /** +// * 鏂板鑰冩牳绉垎 +// */ +// @PreAuthorize("@ss.hasPermi('check:score:add')") +// @Log(title = "鑰冩牳绉垎", businessType = BusinessType.INSERT) +// @PostMapping +// public AjaxResult add(@RequestBody CheckScore checkScore) +// { +// return toAjax(checkScoreService.insertCheckScore(checkScore)); +// } - /** - * 鍒犻櫎鑰冩牳绉垎鏄庣粏 - */ - @PreAuthorize("@ss.hasPermi('system:score:remove')") - @Log(title = "鑰冩牳绉垎鏄庣粏", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(checkScoreService.deleteCheckScoreByIds(ids)); - } +// /** +// * 鍒犻櫎鑰冩牳绉垎 +// */ +// @PreAuthorize("@ss.hasPermi('check:score:remove')") +// @Log(title = "鑰冩牳绉垎", businessType = BusinessType.DELETE) +// @DeleteMapping("/{ids}") +// public AjaxResult remove(@PathVariable Long[] ids) +// { +// return toAjax(checkScoreService.deleteCheckScoreByIds(ids)); +// } + + +// /** +// * 瀵煎嚭鑰冩牳绉垎鍒楄〃 +// */ +// @PreAuthorize("@ss.hasPermi('check:score:export')") +// @Log(title = "鑰冩牳绉垎", businessType = BusinessType.EXPORT) +// @PostMapping("/export") +// public void export(HttpServletResponse response, CheckScore checkScore) +// { +// List<CheckScore> list = checkScoreService.selectCheckScoreList(checkScore); +// ExcelUtil<CheckScore> util = new ExcelUtil<CheckScore>(CheckScore.class); +// util.exportExcel(response, list, "鑰冩牳绉垎鏄庣粏鏁版嵁"); +// } } 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 54ef417..09d9ad8 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 @@ -1,17 +1,20 @@ package com.ycl.platform.mapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import annotation.AutoFill; +import com.ycl.platform.domain.dto.CheckScoreDTO; import com.ycl.platform.domain.entity.CheckScore; +import enumeration.OperationType; import java.util.List; +import java.util.Map; /** * 鑰冩牳绉垎鏄庣粏Mapper鎺ュ彛 * * @author ruoyi - * @date 2024-04-01 + * @date 2024-04-22 */ -public interface CheckScoreMapper extends BaseMapper<CheckScore> +public interface CheckScoreMapper { /** * 鏌ヨ鑰冩牳绉垎鏄庣粏 @@ -60,4 +63,9 @@ * @return 缁撴灉 */ public int deleteCheckScoreByIds(Long[] ids); + + @AutoFill(OperationType.UPDATE) + int publishCheckScore(CheckScoreDTO checkScoreDTO); + + List<Map> selectScoreIndex(String tableName,Long deptId,String date); } 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 3d48876..c5ba652 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 @@ -1,14 +1,17 @@ package com.ycl.platform.service; +import com.ycl.platform.domain.dto.CheckScoreDTO; import com.ycl.platform.domain.entity.CheckScore; +import com.ycl.platform.domain.vo.CheckScoreDetailVO; import java.util.List; +import java.util.Map; /** * 鑰冩牳绉垎鏄庣粏Service鎺ュ彛 * * @author ruoyi - * @date 2024-04-01 + * @date 2024-04-22 */ public interface ICheckScoreService { @@ -18,7 +21,7 @@ * @param id 鑰冩牳绉垎鏄庣粏涓婚敭 * @return 鑰冩牳绉垎鏄庣粏 */ - public CheckScore selectCheckScoreById(Long id); + public CheckScoreDetailVO selectCheckScoreById(Long id); /** * 鏌ヨ鑰冩牳绉垎鏄庣粏鍒楄〃 @@ -26,7 +29,7 @@ * @param checkScore 鑰冩牳绉垎鏄庣粏 * @return 鑰冩牳绉垎鏄庣粏闆嗗悎 */ - public List<CheckScore> selectCheckScoreList(CheckScore checkScore); + public Map<Long, List<CheckScore>> selectCheckScoreList(CheckScore checkScore); /** * 鏂板鑰冩牳绉垎鏄庣粏 @@ -59,4 +62,8 @@ * @return 缁撴灉 */ public int deleteCheckScoreById(Long id); + + int publishCheckScore(CheckScoreDTO checkScoreDTO); + + List<CheckScore> page(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 4f7c646..5bafbc6 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,66 +1,143 @@ package com.ycl.platform.service.impl; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ycl.platform.domain.dto.CheckScoreDTO; +import com.ycl.platform.domain.entity.CheckRule; import com.ycl.platform.domain.entity.CheckScore; +import com.ycl.platform.domain.entity.CheckTemplate; +import com.ycl.platform.domain.entity.CheckTemplateRule; +import com.ycl.platform.domain.vo.CheckScoreDetailVO; +import com.ycl.platform.mapper.CheckRuleMapper; import com.ycl.platform.mapper.CheckScoreMapper; +import com.ycl.platform.mapper.CheckTemplateMapper; +import com.ycl.platform.mapper.CheckTemplateRuleMapper; import com.ycl.platform.service.ICheckScoreService; +import com.ycl.system.entity.SysRole; +import com.ycl.utils.SecurityUtils; +import enumeration.general.PublishType; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; import utils.DateUtils; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * 鑰冩牳绉垎鏄庣粏Service涓氬姟灞傚鐞� * * @author ruoyi - * @date 2024-04-01 + * @date 2024-04-22 */ @Service -public class CheckScoreServiceImpl extends ServiceImpl<CheckScoreMapper, CheckScore> implements ICheckScoreService +@Slf4j +public class CheckScoreServiceImpl implements ICheckScoreService { @Autowired - private CheckScoreMapper checkScoreMapper; - + private CheckScoreMapper scoreMapper; + @Autowired + private CheckTemplateMapper templateMapper; + @Autowired + private CheckTemplateRuleMapper templateRuleMapper; + @Autowired + private CheckRuleMapper ruleMapper; /** - * 鏌ヨ鑰冩牳绉垎鏄庣粏 + * 鏌ヨ鑰冩牳绉垎 * - * @param id 鑰冩牳绉垎鏄庣粏涓婚敭 - * @return 鑰冩牳绉垎鏄庣粏 + * @param id 鑰冩牳绉垎涓婚敭 + * @return 鑰冩牳绉垎 */ @Override - public CheckScore selectCheckScoreById(Long id) + public CheckScoreDetailVO selectCheckScoreById(Long id) { - return checkScoreMapper.selectCheckScoreById(id); + CheckScoreDetailVO checkScoreDetailVO = new CheckScoreDetailVO(); + //鏍规嵁id璇诲彇score + CheckScore checkScore = scoreMapper.selectCheckScoreById(id); + //璇诲彇瑙勫垯浠ュ強鏉冮噸 + List<CheckTemplateRule> templateRuleList = templateRuleMapper.selectListByTemplateId(checkScore.getTemplateId()); + + //checkRules娣诲姞鑰冩牳瀵硅薄鍜岃�冩牳鏃堕棿 + List<CheckRule> checkRules = new ArrayList<>(); + CheckRule checkRule1 = new CheckRule(); + checkRule1.setRuleName("鑰冩牳鏃堕棿"); + checkRule1.setRuleIndex("create_time"); + CheckRule checkRule2 = new CheckRule(); + checkRule2.setRuleName("鑰冩牳瀵硅薄"); + checkRule2.setRuleIndex("deptId"); + //璇诲彇妯℃澘瀵瑰簲鎵�鏈夎鍒� + Map<String,Object> scoreMap = new HashMap<>(); + List<Integer> ruleIds = templateRuleList.stream().map(checkTemplateRule -> checkTemplateRule.getCheckRuleId()) + .collect(Collectors.toList()); + List<CheckRule> ruleIndex = ruleMapper.selectBatchIds(ruleIds); + +// checkRules.add(checkRule1); +// checkRules.add(checkRule2); + checkRules.addAll(ruleIndex); + //鏍规嵁examineCategory 璇诲彇涓嶅悓index琛� + Integer examineCategory = checkScore.getExamineCategory(); + String[] indexTableArr ={"t_check_index_car","t_check_index_face","t_check_index_video"}; + String tableName = indexTableArr[examineCategory]; + //TODO:鑾峰彇褰撳墠鏈堜唤 鏆傚畾 鍚庢湡鏀逛负鍓嶇浼� + LocalDate now = LocalDate.now(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM"); + String date = formatter.format(now); + List<Map> map = scoreMapper.selectScoreIndex(tableName,checkScore.getDeptId(),date); + + scoreMap.put("tableData",checkRules); + scoreMap.put("dataMap",map); + + checkScoreDetailVO.setCheckRuleList(templateRuleList); + checkScoreDetailVO.setScoreMap(scoreMap); + return checkScoreDetailVO; } + /** - * 鏌ヨ鑰冩牳绉垎鏄庣粏鍒楄〃 + * 鏌ヨ鑰冩牳绉垎鍗$墖鍒楄〃 * - * @param checkScore 鑰冩牳绉垎鏄庣粏 - * @return 鑰冩牳绉垎鏄庣粏 + * @param checkScore 鑰冩牳绉垎 + * @return 鑰冩牳绉垎 */ @Override - public List<CheckScore> selectCheckScoreList(CheckScore checkScore) + public Map<Long, List<CheckScore>> selectCheckScoreList(CheckScore checkScore) { - return checkScoreMapper.selectCheckScoreList(checkScore); - } + //TODO:鏁版嵁鏉冮檺 + //鏌ヨ鎴愮哗 + List<CheckScore> checkScores = scoreMapper.selectCheckScoreList(checkScore); + Map<Long, List<CheckScore>> deptMap = checkScores.stream().collect(Collectors.groupingBy(CheckScore::getDeptId)); + return deptMap; + } /** - * 鏂板鑰冩牳绉垎鏄庣粏 + * 鍖哄幙璇︽儏 + * + * @param checkScore 鑰冩牳绉垎 + * @return 鑰冩牳绉垎 + */ + @Override + public List<CheckScore> page(CheckScore checkScore) { + return scoreMapper.selectCheckScoreList(checkScore); + } + /** + * 鏂板鑰冩牳绉垎 * - * @param checkScore 鑰冩牳绉垎鏄庣粏 + * @param checkScore 鑰冩牳绉垎 * @return 缁撴灉 */ @Override public int insertCheckScore(CheckScore checkScore) { checkScore.setCreateTime(DateUtils.getNowDate()); - return checkScoreMapper.insertCheckScore(checkScore); + return scoreMapper.insertCheckScore(checkScore); } /** - * 淇敼鑰冩牳绉垎鏄庣粏 + * 淇敼鑰冩牳鏄庣粏 * * @param checkScore 鑰冩牳绉垎鏄庣粏 * @return 缁撴灉 @@ -68,30 +145,56 @@ @Override public int updateCheckScore(CheckScore checkScore) { - return checkScoreMapper.updateCheckScore(checkScore); + + return scoreMapper.updateCheckScore(checkScore); } /** - * 鎵归噺鍒犻櫎鑰冩牳绉垎鏄庣粏 + * 鎵归噺鍒犻櫎鑰冩牳绉垎 * - * @param ids 闇�瑕佸垹闄ょ殑鑰冩牳绉垎鏄庣粏涓婚敭 + * @param ids 闇�瑕佸垹闄ょ殑鑰冩牳绉垎涓婚敭 * @return 缁撴灉 */ @Override public int deleteCheckScoreByIds(Long[] ids) { - return checkScoreMapper.deleteCheckScoreByIds(ids); + return scoreMapper.deleteCheckScoreByIds(ids); } /** - * 鍒犻櫎鑰冩牳绉垎鏄庣粏淇℃伅 + * 鍒犻櫎鑰冩牳绉垎淇℃伅 * - * @param id 鑰冩牳绉垎鏄庣粏涓婚敭 + * @param id 鑰冩牳绉垎涓婚敭 * @return 缁撴灉 */ @Override public int deleteCheckScoreById(Long id) { - return checkScoreMapper.deleteCheckScoreById(id); + return scoreMapper.deleteCheckScoreById(id); } + /** + * 鍙戝竷鑰冩牳绉垎淇℃伅 + * + * @param checkScoreDTO 鑰冩牳绉垎 + * @return 缁撴灉 + */ + @Override + public int publishCheckScore(CheckScoreDTO checkScoreDTO) { + if(CollectionUtils.isEmpty(checkScoreDTO.getId())){ + return 0; + } + PublishType publishType = null; + try { + publishType = PublishType.valueOf(checkScoreDTO.getPublish()); + } catch (IllegalArgumentException e) { + log.error("鍙傛暟绫诲瀷涓嶅尮閰�"); + throw new IllegalArgumentException("鍙傛暟绫诲瀷涓嶅尮閰�"); + } + String code = publishType.getCode(); + checkScoreDTO.setPublish(code); + + return scoreMapper.publishCheckScore(checkScoreDTO); + } + + } diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckTemplateServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckTemplateServiceImpl.java index c7158ab..96a0be0 100644 --- a/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckTemplateServiceImpl.java +++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/CheckTemplateServiceImpl.java @@ -56,6 +56,7 @@ BeanUtils.copyProperties(checkTemplate, checkTemplateQuery); List<Integer> deptIds = JSONArray.parseArray(checkTemplate.getDeptId(), Integer.class); checkTemplateQuery.setDeptId(deptIds) + .setAdjustCoefficient(checkTemplate.getAdjustCoefficient()+"") .setAlarmScore(checkTemplate.getAlarmScore()+""); //鏌ヨ瑙勫垯鏉冮噸 List<CheckTemplateRule> templateRuleList = checkTemplateRuleMapper.selectListByTemplateId(checkTemplate.getId()); @@ -88,7 +89,8 @@ List<Integer> deptIds = JSONArray.parseArray(template.getDeptId(), Integer.class); CheckTemplateQuery checkTemplateQuery = new CheckTemplateQuery(); BeanUtils.copyProperties(template, checkTemplateQuery); - checkTemplateQuery.setDeptId(deptIds); + checkTemplateQuery.setDeptId(deptIds) + .setAdjustCoefficient(template.getAdjustCoefficient()+""); checkTemplateList.add(checkTemplateQuery); } @@ -118,6 +120,7 @@ checkTemplate.setDeptId(JSONArray.toJSONString(deptId)) .setUpdateUserName(username) .setCreateUserName(username) + .setAdjustCoefficient(new BigDecimal(checkTemplateDTO.getAdjustCoefficient()+"")) //涓嶅~鎶ヨ鍒嗘暟---->闆跺垎---->涓嶆姤璀� .setAlarmScore(new BigDecimal(checkTemplateDTO.getAlarmScore() == null? "":checkTemplateDTO.getAlarmScore())); int i = checkTemplateMapper.insertCheckTemplate(checkTemplate); @@ -167,7 +170,8 @@ checkTemplate.setUpdateUserName(SecurityUtils.getUsername()); List<Integer> deptId = checkTemplateDTO.getDeptId(); Collections.sort(deptId); - checkTemplate.setDeptId(JSONArray.toJSONString(deptId)); + checkTemplate.setDeptId(JSONArray.toJSONString(deptId)) + .setAdjustCoefficient(new BigDecimal(checkTemplateDTO.getAdjustCoefficient()+"")); int i = checkTemplateMapper.updateCheckTemplate(checkTemplate); /** t_template_rule淇敼鏉冮噸 */ //鍏堝垹闄ゅ師鏁版嵁 diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java index 47fd25b..6eca6d8 100644 --- a/ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java +++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java @@ -1,6 +1,5 @@ package com.ycl.platform.service.impl; -import com.alibaba.fastjson2.JSON; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ycl.platform.domain.dto.CarDTO; @@ -16,7 +15,6 @@ import enumeration.general.BusinessTypeEnum; import lombok.RequiredArgsConstructor; import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; diff --git a/ycl-server/src/main/java/com/ycl/system/service/impl/SysJobServiceImpl.java b/ycl-server/src/main/java/com/ycl/system/service/impl/SysJobServiceImpl.java index 07d28a5..e4cff25 100644 --- a/ycl-server/src/main/java/com/ycl/system/service/impl/SysJobServiceImpl.java +++ b/ycl-server/src/main/java/com/ycl/system/service/impl/SysJobServiceImpl.java @@ -201,7 +201,6 @@ @Transactional(rollbackFor = Exception.class) public int insertJob(SysJob job) throws SchedulerException, TaskException { - job.setStatus(ScheduleConstants.Status.PAUSE.getValue()); int rows = jobMapper.insertJob(job); if (rows > 0) { diff --git a/ycl-server/src/main/java/com/ycl/task/CheckScore.java b/ycl-server/src/main/java/com/ycl/task/CheckScore.java new file mode 100644 index 0000000..b36d47f --- /dev/null +++ b/ycl-server/src/main/java/com/ycl/task/CheckScore.java @@ -0,0 +1,12 @@ +package com.ycl.task; + +import org.springframework.stereotype.Component; + + +@Component("checkScore") +public class CheckScore { + public void check(Integer templateId){ + System.out.println("鎵ц妯℃澘---------->"+templateId); + + } +} diff --git a/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml index 5154ce6..de4ffb3 100644 --- a/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml +++ b/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml @@ -8,30 +8,34 @@ <result property="id" column="id" /> <result property="score" column="score" /> <result property="deptId" column="dept_id" /> - <result property="publishId" column="publish_id" /> - <result property="ruleId" column="rule_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="updateUserName" column="update_user_name" /> - <result property="auditState" column="audit_state" /> + <result property="publish" column="publish" /> </resultMap> <sql id="selectCheckScoreVo"> - select id, score, dept_id, publish_id, rule_id, examine_category, create_time, update_user, update_user_name, audit_state from t_check_score + select id, score, dept_id, template_id, examine_tag, examine_category, create_time,update_time,update_user, publish from t_check_score </sql> <select id="selectCheckScoreList" resultMap="CheckScoreResult"> <include refid="selectCheckScoreVo"/> - <where> + <where> + <if test="score != null "> and score = #{score}</if> <if test="deptId != null "> and dept_id = #{deptId}</if> - <if test="publishId != null "> and publish_id = #{publishId}</if> - <if test="ruleId != null "> and rule_id = #{ruleId}</if> + <if test="templateId != null "> and template_id = #{templateId}</if> + <if test="createTime != null "> and DATE(create_time) = #{createTime}</if> + <if test="date != null "> and date_format(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="publish != null and publish != ''"> and publish = #{publish}</if> </where> </select> - <select id="selectCheckScoreById" resultMap="CheckScoreResult"> + <select id="selectCheckScoreById" parameterType="Long" resultMap="CheckScoreResult"> <include refid="selectCheckScoreVo"/> where id = #{id} </select> @@ -41,51 +45,62 @@ <trim prefix="(" suffix=")" suffixOverrides=","> <if test="score != null">score,</if> <if test="deptId != null">dept_id,</if> - <if test="publishId != null">publish_id,</if> - <if test="ruleId != null">rule_id,</if> + <if test="templateId != null">template_id,</if> + <if test="examineTag != null">examine_tag,</if> <if test="examineCategory != null">examine_category,</if> <if test="createTime != null">create_time,</if> + <if test="updateTime != null">update_time,</if> <if test="updateUser != null">update_user,</if> - <if test="updateUserName != null">update_user_name,</if> - <if test="auditState != null">audit_state,</if> + <if test="publish != null">publish,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="score != null">#{score},</if> <if test="deptId != null">#{deptId},</if> - <if test="publishId != null">#{publishId},</if> - <if test="ruleId != null">#{ruleId},</if> + <if test="templateId != null">#{templateId},</if> + <if test="examineTag != null">#{examineTag},</if> <if test="examineCategory != null">#{examineCategory},</if> <if test="createTime != null">#{createTime},</if> + <if test="updateTime != null">#{updateTime},</if> <if test="updateUser != null">#{updateUser},</if> - <if test="updateUserName != null">#{updateUserName},</if> - <if test="auditState != null">#{auditState},</if> + <if test="publish != null">#{publish},</if> </trim> </insert> - <update id="updateCheckScore"> + <update id="updateCheckScore" > update t_check_score <trim prefix="SET" suffixOverrides=","> <if test="score != null">score = #{score},</if> <if test="deptId != null">dept_id = #{deptId},</if> - <if test="publishId != null">publish_id = #{publishId},</if> - <if test="ruleId != null">rule_id = #{ruleId},</if> + <if test="templateId != null">template_id = #{templateId},</if> + <if test="examineTag != null">examine_tag = #{examineTag},</if> <if test="examineCategory != null">examine_category = #{examineCategory},</if> <if test="createTime != null">create_time = #{createTime},</if> + <if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateUser != null">update_user = #{updateUser},</if> - <if test="updateUserName != null">update_user_name = #{updateUserName},</if> - <if test="auditState != null">audit_state = #{auditState},</if> + <if test="publish != null">publish = #{publish},</if> </trim> where id = #{id} </update> - <delete id="deleteCheckScoreById" > + <delete id="deleteCheckScoreById" parameterType="Long"> delete from t_check_score where id = #{id} </delete> - <delete id="deleteCheckScoreByIds" > + <delete id="deleteCheckScoreByIds" parameterType="String"> delete from t_check_score where id in <foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach> </delete> + + <update id="publishCheckScore"> + update t_check_score set publish = #{publish},update_time =#{updateTime},update_user= #{updateUser} where id in + <foreach collection="id" item="id" open="(" close=")" separator=","> + #{id} + </foreach> + </update> + + <select id="selectScoreIndex" resultType="java.util.Map"> + select * from ${tableName} where dept_id =#{deptId} and date_format(create_time,'%Y-%m') = #{date} + </select> </mapper> \ No newline at end of file diff --git a/ycl-server/src/main/resources/mapper/zgyw/CheckTemplateRuleMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/CheckTemplateRuleMapper.xml index 0a25529..e685719 100644 --- a/ycl-server/src/main/resources/mapper/zgyw/CheckTemplateRuleMapper.xml +++ b/ycl-server/src/main/resources/mapper/zgyw/CheckTemplateRuleMapper.xml @@ -67,6 +67,9 @@ delete from t_check_template_rule where check_template_id = #{templateId} </delete> <select id="selectListByTemplateId" resultType="com.ycl.platform.domain.entity.CheckTemplateRule"> - select * from t_check_template_rule where check_template_id = #{checkTemplateId} + select tctr.*,tcr.rule_name as checkRuleName from t_check_template_rule tctr + left join t_check_rule tcr on tctr.check_rule_id = tcr.id + where check_template_id = #{checkTemplateId} </select> + </mapper> \ No newline at end of file -- Gitblit v1.8.0