From 59a49faf2e08fd13e414f455b34df18f4a59df56 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 13 Dec 2022 16:06:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=B8=80=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../indexcollect/ScreenPyHistoryScoreDTO.java | 95 ++++++++++++ .../ScreenPyHistoryScoreDetailDTO.java | 126 +++++++++++++++ .../form/HistoryScoreComputeFormDTO.java | 42 +++++ .../form/HistoryScoreFormDTO.java | 99 ++++++++++++ .../form/HistoryScoreListFormDTO.java | 47 ++++++ .../result/HistoryScoreComputeResultDTO.java | 24 +++ .../result/HistoryScoreDetailResultDTO.java | 103 +++++++++++++ .../result/HistoryScoreListResultDTO.java | 33 ++++ .../ScreenPyHistoryScoreController.java | 123 +++++++++++++++ .../indexcoll/ScreenPyHistoryScoreDao.java | 36 +++++ .../ScreenPyHistoryScoreDetailDao.java | 34 +++++ .../ScreenPyHistoryScoreDetailEntity.java | 94 ++++++++++++ .../indexcoll/ScreenPyHistoryScoreEntity.java | 64 ++++++++ .../ScreenPyHistoryScoreDetailService.java | 10 ++ .../ScreenPyHistoryScoreService.java | 30 ++++ ...ScreenPyHistoryScoreDetailServiceImpl.java | 27 ++++ .../impl/ScreenPyHistoryScoreServiceImpl.java | 143 ++++++++++++++++++ .../indexcoll/ScreenPyHistoryScoreDao.xml | 32 ++++ .../ScreenPyHistoryScoreDetailDao.xml | 18 +++ 19 files changed, 1180 insertions(+) create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/ScreenPyHistoryScoreDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/ScreenPyHistoryScoreDetailDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/HistoryScoreComputeFormDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/HistoryScoreFormDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/HistoryScoreListFormDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreComputeResultDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreDetailResultDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreListResultDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenPyHistoryScoreController.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyHistoryScoreDao.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailDao.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailEntity.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/ScreenPyHistoryScoreEntity.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/ScreenPyHistoryScoreService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyHistoryScoreDetailServiceImpl.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyHistoryScoreServiceImpl.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyHistoryScoreDao.xml create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailDao.xml diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/ScreenPyHistoryScoreDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/ScreenPyHistoryScoreDTO.java new file mode 100644 index 0000000000..55e7648c2b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/ScreenPyHistoryScoreDTO.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.indexcollect; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 平阴历史得分主表 + * + * @author generator generator@elink-cn.com + */ +@Data +public class ScreenPyHistoryScoreDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID 主键 + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * 标题 + */ + private String title; + + /** + * 起始时间 + */ + private Date startTime; + + /** + * 截止时间 + */ + private Date endTime; + + /** + * 发布时间 + */ + private Date releaseTime; + + /** + * 删除标识 0未删除;1已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/ScreenPyHistoryScoreDetailDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/ScreenPyHistoryScoreDetailDTO.java new file mode 100644 index 0000000000..b8e0cf7132 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/ScreenPyHistoryScoreDetailDTO.java @@ -0,0 +1,126 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.indexcollect; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 平阴历史得分明细表 + * + * @author generator generator@elink-cn.com + */ +@Data +public class ScreenPyHistoryScoreDetailDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID 主键 + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * screen_py_history_score.id + */ + private String historyScoreId; + + /** + * 街道组织Id + */ + private String agencyId; + + /** + * 街道名称 + */ + private String agencyName; + + /** + * 网格活跃度 + */ + private BigDecimal wghyd; + + /** + * 事件赋分 + */ + private BigDecimal sjff; + + /** + * 雪亮工程 + */ + private BigDecimal xlgc; + + /** + * 日核周调 + */ + private BigDecimal rhzt; + + /** + * 亮点工作 + */ + private BigDecimal ldgz; + + /** + * 其他工作 + */ + private BigDecimal qtgz; + + /** + * 能力得分 + */ + private BigDecimal nldf; + + /** + * 删除标识 0未删除;1已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/HistoryScoreComputeFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/HistoryScoreComputeFormDTO.java new file mode 100644 index 0000000000..b5b030e4a1 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/HistoryScoreComputeFormDTO.java @@ -0,0 +1,42 @@ +package com.epmet.dto.indexcollect.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +@Data +public class HistoryScoreComputeFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + public interface Compute extends CustomerClientShowGroup {} + + /** + * 组织Id + */ + @NotBlank(message = "组织Id不能为空", groups = Compute.class) + private String agencyId; + /** + * 计算类型 grid:网格活跃度 event:事件赋分 + */ + @NotBlank(message = "计算类型不能为空", groups = Compute.class) + private String type; + /** + * 起始时间 + */ + private Date startTime; + /** + * 截止时间 + */ + private Date endTime; + + private String customerId; + private String userId; + + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/HistoryScoreFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/HistoryScoreFormDTO.java new file mode 100644 index 0000000000..6b4964a53b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/HistoryScoreFormDTO.java @@ -0,0 +1,99 @@ +package com.epmet.dto.indexcollect.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +@Data +public class HistoryScoreFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + public interface Add extends CustomerClientShowGroup {} + public interface Edit extends CustomerClientShowGroup {} + + /** + * id + */ + @NotBlank(message = "标题不能为空", groups = Edit.class) + private String id; + + /** + * 标题 + */ + @NotBlank(message = "标题不能为空", groups = Add.class) + private String title; + + /** + * 起始时间 + */ + private Date startTime; + + /** + * 截止时间 + */ + private Date endTime; + + /** + * 截止时间 + */ + private List detailList; + + private String customerId; + private String userId; + + + @Data + public static class Detail implements Serializable { + /** + * 街道组织Id + */ + private String agencyId; + + /** + * 街道名称 + */ + private String agencyName; + + /** + * 网格活跃度 + */ + private BigDecimal wghyd; + + /** + * 事件赋分 + */ + private BigDecimal sjff; + + /** + * 雪亮工程 + */ + private BigDecimal xlgc; + + /** + * 日核周调 + */ + private BigDecimal rhzt; + + /** + * 亮点工作 + */ + private BigDecimal ldgz; + + /** + * 其他工作 + */ + private BigDecimal qtgz; + + /** + * 能力得分 + */ + private BigDecimal nldf; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/HistoryScoreListFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/HistoryScoreListFormDTO.java new file mode 100644 index 0000000000..f443bdd220 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/HistoryScoreListFormDTO.java @@ -0,0 +1,47 @@ +package com.epmet.dto.indexcollect.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class HistoryScoreListFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 标题 + */ + private String title; + + /** + * 起始时间 + */ + private Date startTime; + + /** + * 截止时间 + */ + private Date endTime; + + /** + * 当前页 + */ + private Integer pageNo = 1; + + /** + * 每页记录数 + */ + private Integer pageSize = 20; + + /** + * 是否分页【true分 false不分】 + */ + private Boolean isPage; + + private String customerId; + private String userId; + + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreComputeResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreComputeResultDTO.java new file mode 100644 index 0000000000..1295b36036 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreComputeResultDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.indexcollect.result; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class HistoryScoreComputeResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 组织Id + */ + private String agencyId; + + /** + * 分数 + */ + private BigDecimal score; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreDetailResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreDetailResultDTO.java new file mode 100644 index 0000000000..97a60160b4 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreDetailResultDTO.java @@ -0,0 +1,103 @@ +package com.epmet.dto.indexcollect.result; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +@Data +public class HistoryScoreDetailResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + public interface Add extends CustomerClientShowGroup {} + public interface Edit extends CustomerClientShowGroup {} + + /** + * id + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * 标题 + */ + private String title; + + /** + * 起始时间 + */ + private Date startTime; + + /** + * 截止时间 + */ + private Date endTime; + + /** + * 发布时间 + */ + private Date releaseTime; + + /** + * 截止时间 + */ + private List detailList; + + @Data + public static class Detail implements Serializable { + /** + * 街道组织Id + */ + private String agencyId; + + /** + * 街道名称 + */ + private String agencyName; + + /** + * 网格活跃度 + */ + private BigDecimal wghyd; + + /** + * 事件赋分 + */ + private BigDecimal sjff; + + /** + * 雪亮工程 + */ + private BigDecimal xlgc; + + /** + * 日核周调 + */ + private BigDecimal rhzt; + + /** + * 亮点工作 + */ + private BigDecimal ldgz; + + /** + * 其他工作 + */ + private BigDecimal qtgz; + + /** + * 能力得分 + */ + private BigDecimal nldf; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreListResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreListResultDTO.java new file mode 100644 index 0000000000..719c9ba594 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreListResultDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dto.indexcollect.result; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class HistoryScoreListResultDTO implements Serializable { + private static final long serialVersionUID = -4316054054019675419L; + + /** + * id + */ + private String id; + /** + * 标题 + */ + private String title; + /** + * 时间区间 + */ + private String time; + /** + * 发布者 + */ + private String createdBy; + private String createdById; + /** + * 发布时间 + */ + private String releaseTime; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenPyHistoryScoreController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenPyHistoryScoreController.java new file mode 100644 index 0000000000..80ec8ea225 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenPyHistoryScoreController.java @@ -0,0 +1,123 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.indexcollect.form.HistoryScoreComputeFormDTO; +import com.epmet.dto.indexcollect.form.HistoryScoreFormDTO; +import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO; +import com.epmet.dto.indexcollect.result.HistoryScoreComputeResultDTO; +import com.epmet.dto.indexcollect.result.HistoryScoreDetailResultDTO; +import com.epmet.dto.indexcollect.result.HistoryScoreListResultDTO; +import com.epmet.service.evaluationindex.indexcoll.ScreenPyHistoryScoreService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 平阴历史得分主表 + * + * @author generator generator@elink-cn.com + */ +@Slf4j +@RestController +@RequestMapping("screenPyHistoryScore") +public class ScreenPyHistoryScoreController { + + @Autowired + private ScreenPyHistoryScoreService screenPyHistoryScoreService; + + + @RequestMapping("list") + public Result> list(@LoginUser TokenDto tokenDto, @RequestBody HistoryScoreListFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + return new Result>().ok(screenPyHistoryScoreService.list(formDTO)); + } + + @NoRepeatSubmit + @PostMapping("add") + public Result save(@LoginUser TokenDto tokenDto, @RequestBody HistoryScoreFormDTO dto) { + ValidatorUtils.validateEntity(dto, HistoryScoreFormDTO.Add.class); + dto.setCustomerId(tokenDto.getCustomerId()); + dto.setUserId(tokenDto.getUserId()); + screenPyHistoryScoreService.save(dto); + return new Result(); + } + + @PostMapping("edit") + public Result update(@LoginUser TokenDto tokenDto, @RequestBody HistoryScoreFormDTO dto) { + ValidatorUtils.validateEntity(dto, HistoryScoreFormDTO.Edit.class); + dto.setCustomerId(tokenDto.getCustomerId()); + dto.setUserId(tokenDto.getUserId()); + screenPyHistoryScoreService.update(dto); + return new Result(); + } + + @PostMapping("deleteById") + public Result deleteById(@LoginUser TokenDto tokenDto, @RequestBody HistoryScoreFormDTO dto) { + ValidatorUtils.validateEntity(dto, HistoryScoreFormDTO.Edit.class); + dto.setCustomerId(tokenDto.getCustomerId()); + dto.setUserId(tokenDto.getUserId()); + screenPyHistoryScoreService.deleteById(dto); + return new Result(); + } + + @RequestMapping("detail") + public Result detail(@LoginUser TokenDto tokenDto, @RequestBody HistoryScoreFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, HistoryScoreFormDTO.Edit.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + return new Result().ok(screenPyHistoryScoreService.detail(formDTO)); + } + + /*@PostMapping("export") + public void export(@LoginUser TokenDto tokenDto, @RequestBody HistoryScoreListFormDTO formDTO, HttpServletResponse response) throws IOException { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + formDTO.setIsPage(false); + ExcelWriter excelWriter = null; + formDTO.setPageNo(NumConstant.ONE); + formDTO.setPageSize(NumConstant.TEN_THOUSAND); + try { + String fileName = "迁入管理" + DateUtils.format(new Date()) + ".xlsx"; + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcMoveInRecordExcel.class).build(); + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); + PageData data = null; + List list = null; + do { + data = screenPyHistoryScoreService.list(formDTO); + list = ConvertUtils.sourceToTarget(data.getList(), IcMoveInRecordExcel.class); + formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); + excelWriter.write(list, writeSheet); + } while (CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize()); + } catch (EpmetException e) { + response.reset(); + response.setCharacterEncoding("UTF-8"); + response.setHeader("content-type", "application/json; charset=UTF-8"); + PrintWriter printWriter = response.getWriter(); + Result result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), e.getMsg()); + printWriter.write(JSON.toJSONString(result)); + printWriter.close(); + } catch (Exception e) { + log.error("export exception", e); + } finally { + if (excelWriter != null) { + excelWriter.finish(); + } + } + }*/ + + @RequestMapping("computescore") + public Result computeScore(@LoginUser TokenDto tokenDto, @RequestBody HistoryScoreComputeFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, HistoryScoreComputeFormDTO.Compute.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + return new Result().ok(screenPyHistoryScoreService.computeScore(formDTO)); + } + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyHistoryScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyHistoryScoreDao.java new file mode 100644 index 0000000000..cfe869723b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyHistoryScoreDao.java @@ -0,0 +1,36 @@ +package com.epmet.dao.evaluationindex.indexcoll; /** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO; +import com.epmet.dto.indexcollect.result.HistoryScoreListResultDTO; +import com.epmet.entity.evaluationindex.indexcoll.ScreenPyHistoryScoreEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 平阴历史得分主表 + * + * @author generator generator@elink-cn.com + */ +@Mapper +public interface ScreenPyHistoryScoreDao extends BaseDao { + + List selectHistoryScoreList(HistoryScoreListFormDTO formDTO); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailDao.java new file mode 100644 index 0000000000..50823809c2 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailDao.java @@ -0,0 +1,34 @@ +package com.epmet.dao.evaluationindex.indexcoll; /** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 平阴历史得分明细表 + * + * @author generator generator@elink-cn.com + */ +@Mapper +public interface ScreenPyHistoryScoreDetailDao extends BaseDao { + + void delByHistoryScoreId(@Param("historyScoreId") String historyScoreId, @Param("userId") String userId); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailEntity.java new file mode 100644 index 0000000000..9d5b7b9851 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailEntity.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.evaluationindex.indexcoll; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 平阴历史得分明细表 + * + * @author generator generator@elink-cn.com + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("screen_py_history_score_detail") +public class ScreenPyHistoryScoreDetailEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * screen_py_history_score.id + */ + private String historyScoreId; + + /** + * 街道组织Id + */ + private String agencyId; + + /** + * 街道名称 + */ + private String agencyName; + + /** + * 网格活跃度 + */ + private BigDecimal wghyd; + + /** + * 事件赋分 + */ + private BigDecimal sjff; + + /** + * 雪亮工程 + */ + private BigDecimal xlgc; + + /** + * 日核周调 + */ + private BigDecimal rhzt; + + /** + * 亮点工作 + */ + private BigDecimal ldgz; + + /** + * 其他工作 + */ + private BigDecimal qtgz; + + /** + * 能力得分 + */ + private BigDecimal nldf; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/ScreenPyHistoryScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/ScreenPyHistoryScoreEntity.java new file mode 100644 index 0000000000..db484429cd --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/ScreenPyHistoryScoreEntity.java @@ -0,0 +1,64 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.evaluationindex.indexcoll; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 平阴历史得分主表 + * + * @author generator generator@elink-cn.com + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("screen_py_history_score") +public class ScreenPyHistoryScoreEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 标题 + */ + private String title; + + /** + * 起始时间 + */ + private Date startTime; + + /** + * 截止时间 + */ + private Date endTime; + + /** + * 发布时间 + */ + private Date releaseTime; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailService.java new file mode 100644 index 0000000000..e12ce41e1c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailService.java @@ -0,0 +1,10 @@ +package com.epmet.service.evaluationindex.indexcoll; + +/** + * 平阴历史得分明细表 + * + * @author generator generator@elink-cn.com + */ +public interface ScreenPyHistoryScoreDetailService { + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/ScreenPyHistoryScoreService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/ScreenPyHistoryScoreService.java new file mode 100644 index 0000000000..c92ba2cfaa --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/ScreenPyHistoryScoreService.java @@ -0,0 +1,30 @@ +package com.epmet.service.evaluationindex.indexcoll; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.indexcollect.form.HistoryScoreComputeFormDTO; +import com.epmet.dto.indexcollect.form.HistoryScoreFormDTO; +import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO; +import com.epmet.dto.indexcollect.result.HistoryScoreComputeResultDTO; +import com.epmet.dto.indexcollect.result.HistoryScoreDetailResultDTO; +import com.epmet.dto.indexcollect.result.HistoryScoreListResultDTO; +import com.epmet.dto.result.IcMoveInListResultDTO; + +/** + * 平阴历史得分主表 + * + * @author generator generator@elink-cn.com + */ +public interface ScreenPyHistoryScoreService { + + PageData list(HistoryScoreListFormDTO formDTO); + + void save(HistoryScoreFormDTO dto); + + void update(HistoryScoreFormDTO dto); + + void deleteById(HistoryScoreFormDTO dto); + + HistoryScoreDetailResultDTO detail(HistoryScoreFormDTO formDTO); + + HistoryScoreComputeResultDTO computeScore(HistoryScoreComputeFormDTO formDTO); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyHistoryScoreDetailServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyHistoryScoreDetailServiceImpl.java new file mode 100644 index 0000000000..ace200d468 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyHistoryScoreDetailServiceImpl.java @@ -0,0 +1,27 @@ +package com.epmet.service.evaluationindex.indexcoll.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailDao; +import com.epmet.entity.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailEntity; +import com.epmet.service.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * 平阴历史得分明细表 + * + * @author generator generator@elink-cn.com + */ +@Slf4j +@Service +@DataSource(DataSourceConstant.EVALUATION_INDEX_READ) +public class ScreenPyHistoryScoreDetailServiceImpl extends BaseServiceImpl implements ScreenPyHistoryScoreDetailService { + + @Autowired + private ScreenPyHistoryScoreDetailDao screenPyHistoryScoreDetailDao; + + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyHistoryScoreServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyHistoryScoreServiceImpl.java new file mode 100644 index 0000000000..51b81f888b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyHistoryScoreServiceImpl.java @@ -0,0 +1,143 @@ +package com.epmet.service.evaluationindex.indexcoll.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.evaluationindex.indexcoll.ScreenPyHistoryScoreDao; +import com.epmet.dao.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailDao; +import com.epmet.dto.indexcollect.ScreenPyHistoryScoreDetailDTO; +import com.epmet.dto.indexcollect.form.HistoryScoreComputeFormDTO; +import com.epmet.dto.indexcollect.form.HistoryScoreFormDTO; +import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO; +import com.epmet.dto.indexcollect.result.HistoryScoreComputeResultDTO; +import com.epmet.dto.indexcollect.result.HistoryScoreDetailResultDTO; +import com.epmet.dto.indexcollect.result.HistoryScoreListResultDTO; +import com.epmet.dto.result.IcMoveInListResultDTO; +import com.epmet.entity.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailEntity; +import com.epmet.entity.evaluationindex.indexcoll.ScreenPyHistoryScoreEntity; +import com.epmet.service.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailService; +import com.epmet.service.evaluationindex.indexcoll.ScreenPyHistoryScoreService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; + +/** + * 平阴历史得分主表 + * + * @author generator generator@elink-cn.com + */ +@Slf4j +@Service +@DataSource(DataSourceConstant.EVALUATION_INDEX_READ) +public class ScreenPyHistoryScoreServiceImpl implements ScreenPyHistoryScoreService { + + @Autowired + private ScreenPyHistoryScoreDao screenPyHistoryScoreDao; + @Autowired + private ScreenPyHistoryScoreDetailServiceImpl screenPyHistoryScoreDetailServiceImpl; + @Autowired + private ScreenPyHistoryScoreDetailDao screenPyHistoryScoreDetailDao; + + + @Override + public PageData list(HistoryScoreListFormDTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()); + List list = screenPyHistoryScoreDao.selectHistoryScoreList(formDTO); + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(HistoryScoreFormDTO formDTO) { + //1.主表新增数据 + ScreenPyHistoryScoreEntity entity = ConvertUtils.sourceToTarget(formDTO, ScreenPyHistoryScoreEntity.class); + screenPyHistoryScoreDao.insert(entity); + //2.明细表新增数据 + List list = new ArrayList<>(); + formDTO.getDetailList().forEach(dto -> { + ScreenPyHistoryScoreDetailEntity detailEntity = ConvertUtils.sourceToTarget(dto, ScreenPyHistoryScoreDetailEntity.class); + detailEntity.setCustomerId(formDTO.getCustomerId()); + detailEntity.setHistoryScoreId(entity.getId()); + list.add(detailEntity); + }); + screenPyHistoryScoreDetailServiceImpl.insertBatch(list); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(HistoryScoreFormDTO formDTO) { + ScreenPyHistoryScoreEntity entity = screenPyHistoryScoreDao.selectById(formDTO.getId()); + if (entity == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "未查到相关信息", "未查到相关信息"); + } + //1.更新主表 + ScreenPyHistoryScoreEntity newEntity = ConvertUtils.sourceToTarget(formDTO, ScreenPyHistoryScoreEntity.class); + newEntity.setId(entity.getId()); + screenPyHistoryScoreDao.updateById(newEntity); + //2.更新字表 字表先删后增 + List list = new ArrayList<>(); + formDTO.getDetailList().forEach(dto -> { + ScreenPyHistoryScoreDetailEntity detailEntity = ConvertUtils.sourceToTarget(dto, ScreenPyHistoryScoreDetailEntity.class); + detailEntity.setCustomerId(entity.getCustomerId()); + detailEntity.setHistoryScoreId(entity.getId()); + list.add(detailEntity); + }); + screenPyHistoryScoreDetailDao.delByHistoryScoreId(formDTO.getId(), formDTO.getUserId()); + screenPyHistoryScoreDetailServiceImpl.insertBatch(list); + } + + @Override + public void deleteById(HistoryScoreFormDTO formDTO) { + ScreenPyHistoryScoreEntity entity = screenPyHistoryScoreDao.selectById(formDTO.getId()); + if (entity == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "未查到相关信息", "未查到相关信息"); + } + entity.setDelFlag("1"); + screenPyHistoryScoreDao.updateById(entity); + screenPyHistoryScoreDetailDao.delByHistoryScoreId(formDTO.getId(), formDTO.getUserId()); + } + + @Override + public HistoryScoreDetailResultDTO detail(HistoryScoreFormDTO formDTO) { + HistoryScoreDetailResultDTO resultDTO = new HistoryScoreDetailResultDTO(); + //1.主表数据 + ScreenPyHistoryScoreEntity entity = screenPyHistoryScoreDao.selectById(formDTO.getId()); + if (entity == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "未查到相关信息", "未查到相关信息"); + } + resultDTO = ConvertUtils.sourceToTarget(entity, HistoryScoreDetailResultDTO.class); + //2.字表数据 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ScreenPyHistoryScoreDetailEntity::getHistoryScoreId, formDTO.getId()); + wrapper.eq(ScreenPyHistoryScoreDetailEntity::getDelFlag, "1"); + List list = screenPyHistoryScoreDetailDao.selectList(wrapper); + List detailList = ConvertUtils.sourceToTarget(list, HistoryScoreDetailResultDTO.Detail.class); + resultDTO.setDetailList(detailList); + return resultDTO; + } + + @Override + public HistoryScoreComputeResultDTO computeScore(HistoryScoreComputeFormDTO formDTO) { + HistoryScoreComputeResultDTO resultDTO = new HistoryScoreComputeResultDTO(); + if ("grid".equals(formDTO.getType())) { + //网格活跃度每周得分=(活跃网格数/本街镇网格数)x100+(正常网格数/本街镇网格数)x80 + //本街镇网格数基于本街镇基础网格总数进行计算,不包含专属网格 + + } else if ("event".equals(formDTO.getType())) { + //事件赋分每周得分=(活跃网格数/末级网格数)x100+(正常运行网格数/末级网格数)x80 + //1周内每个末级网格有五天及五天以上上传事件或开展例行工作的为活跃网格;有2天及2天以上,5天以下上传事件或开展例行工作的为正常运行网格;只有1天上传事件或开展例行工作的为僵尸网格 + } + return resultDTO; + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyHistoryScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyHistoryScoreDao.xml new file mode 100644 index 0000000000..7a79fbaa32 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyHistoryScoreDao.xml @@ -0,0 +1,32 @@ + + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailDao.xml new file mode 100644 index 0000000000..fa2d907120 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailDao.xml @@ -0,0 +1,18 @@ + + + + + + + UPDATE + screen_py_history_score_detail + SET + updated_by = #{userId}, + updated_time = NOW(), + del_flag = '1' + WHERE + history_score_id = #{historyScoreId} + AND del_flag = '0' + + +