From 0a3104f4fb3e46f2e254a4b0b896b44b8256b08d Mon Sep 17 00:00:00 2001 From: wanggongfeng <1305282856@qq.com> Date: Tue, 22 Dec 2020 10:19:10 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=BB=A9=E6=95=88=E8=80=83=E6=A0=B8?= =?UTF-8?q?=E3=80=91=E6=A1=88=E4=BB=B6=E5=A4=84=E7=90=86=E6=89=93=E5=88=86?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E7=AE=A1=E7=90=86-=E7=8E=8B=E5=85=AC?= =?UTF-8?q?=E5=B3=B0-2020-12-22?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epdc-admin/epdc-admin-server/pom.xml | 2 +- .../esua/epdc/dto/KpiCaseHandlingDTO.java | 121 ++++++ .../controller/KpiCaseHandlingController.java | 116 ++++++ .../esua/epdc/dao/KpiCaseHandlingDao.java | 52 +++ .../epdc/entity/KpiCaseHandlingEntity.java | 91 +++++ .../esua/epdc/excel/KpiCaseHandlingExcel.java | 86 ++++ .../esua/epdc/feign/AdminFeignClient.java | 2 +- .../esua/epdc/redis/KpiCaseHandlingRedis.java | 47 +++ .../epdc/service/KpiCaseHandlingService.java | 124 ++++++ .../impl/KpiCaseHandlingServiceImpl.java | 378 ++++++++++++++++++ .../resources/mapper/KpiCaseHandlingDao.xml | 91 +++++ 11 files changed, 1108 insertions(+), 2 deletions(-) create mode 100644 esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/KpiCaseHandlingDTO.java create mode 100644 esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/KpiCaseHandlingController.java create mode 100644 esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/KpiCaseHandlingDao.java create mode 100644 esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/entity/KpiCaseHandlingEntity.java create mode 100644 esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/excel/KpiCaseHandlingExcel.java create mode 100644 esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/redis/KpiCaseHandlingRedis.java create mode 100644 esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/KpiCaseHandlingService.java create mode 100644 esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/KpiCaseHandlingServiceImpl.java create mode 100644 esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/KpiCaseHandlingDao.xml diff --git a/esua-epdc/epdc-admin/epdc-admin-server/pom.xml b/esua-epdc/epdc-admin/epdc-admin-server/pom.xml index accbb728c..9d2ab6d33 100644 --- a/esua-epdc/epdc-admin/epdc-admin-server/pom.xml +++ b/esua-epdc/epdc-admin/epdc-admin-server/pom.xml @@ -157,7 +157,7 @@ dev 2 - 118.190.232.100 + 114.215.125.123 9603 epdc!redis@master1405 diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/KpiCaseHandlingDTO.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/KpiCaseHandlingDTO.java new file mode 100644 index 000000000..eb14e1542 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/KpiCaseHandlingDTO.java @@ -0,0 +1,121 @@ +/** + * 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.elink.esua.epdc.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 网格化平台案件处置情况打分表 + * + * @author elink elink@elink-cn.com + * @since v1.0.0 2020-12-21 + */ +@Data +public class KpiCaseHandlingDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 部门id + */ + private String deptId; + + /** + * 部门名称 + */ + private String deptName; + + /** + * 部门类别 + */ + private String deptTypeKey; + + /** + * 年月 + */ + private String monthYear; + + /** + * 案件处置情况打分 + */ + private String caseHandling; + + /** + * 案件处置情况打分最终分数 + */ + private String caseHandlingScore; + + /** + * 上级部门id + */ + private String parentDeptIds; + + /** + * 上级部门名称 + */ + private String parentDeptNames; + + /** + * 所有部门id + */ + private String allDeptIds; + + /** + * 所有部门名称 + */ + private String allDeptNames; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 逻辑删除标识 + */ + private String delFlag; + +} diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/KpiCaseHandlingController.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/KpiCaseHandlingController.java new file mode 100644 index 000000000..94c4d87e7 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/KpiCaseHandlingController.java @@ -0,0 +1,116 @@ +/** + * 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.elink.esua.epdc.controller; + +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.commons.tools.validator.AssertUtils; +import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; +import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; +import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; +import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; +import com.elink.esua.epdc.dto.KpiCaseHandlingDTO; +import com.elink.esua.epdc.dto.KpiPublicOpinionDTO; +import com.elink.esua.epdc.excel.KpiCaseHandlingExcel; +import com.elink.esua.epdc.excel.KpiPublicOpinionExcel; +import com.elink.esua.epdc.service.KpiCaseHandlingService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 网格化平台案件处置情况打分表 + * + * @author elink elink@elink-cn.com + * @since v1.0.0 2020-12-21 + */ +@RestController +@RequestMapping("kpicasehandling") +public class KpiCaseHandlingController { + + @Autowired + private KpiCaseHandlingService kpiCaseHandlingService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ +// PageData page = kpiCaseHandlingService.page(params); + PageData page = kpiCaseHandlingService.getInfoPage(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + KpiCaseHandlingDTO data = kpiCaseHandlingService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody KpiCaseHandlingDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + kpiCaseHandlingService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody KpiCaseHandlingDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + kpiCaseHandlingService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + kpiCaseHandlingService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = kpiCaseHandlingService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, KpiCaseHandlingExcel.class); + } + + @GetMapping("exportTemplate") + public void exportTemplate(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = kpiCaseHandlingService.exportTemplate(params); + ExcelUtils.exportExcelToTarget(response, null, list, KpiCaseHandlingExcel.class); + } + + /** + * @Description: 导入治理排行管理-网格化平台案件处置情况打分 + * @Param: [file] + * @return: Result + * @Author: wanggongfeng + * @Date: 2020-12-21 + */ + @PostMapping("importManualScoreExcel") + public Result importManualScoreExcel(@RequestParam("file") MultipartFile file) { + return kpiCaseHandlingService.importManualScoreExcel(file); + } + +} diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/KpiCaseHandlingDao.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/KpiCaseHandlingDao.java new file mode 100644 index 000000000..dcdf6ab99 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/KpiCaseHandlingDao.java @@ -0,0 +1,52 @@ +/** + * 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.elink.esua.epdc.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.dto.KpiCaseHandlingDTO; +import com.elink.esua.epdc.dto.form.CheckIsScoredFormDTO; +import com.elink.esua.epdc.entity.KpiCaseHandlingEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + +/** + * 网格化平台案件处置情况打分表 + * + * @author elink elink@elink-cn.com + * @since v1.0.0 2020-12-21 + */ +@Mapper +public interface KpiCaseHandlingDao extends BaseDao { + + /** + * 条件查询 + * @param params + * @return + */ + List getInfoPage(Map params); + + /** + * 查询已打分部门提示 + * @param checkIsScoredFormDTO + * @return + */ + List getDuplicateData(CheckIsScoredFormDTO checkIsScoredFormDTO); + +} diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/entity/KpiCaseHandlingEntity.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/entity/KpiCaseHandlingEntity.java new file mode 100644 index 000000000..0c888fd95 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/entity/KpiCaseHandlingEntity.java @@ -0,0 +1,91 @@ +/** + * 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.elink.esua.epdc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 网格化平台案件处置情况打分表 + * + * @author elink elink@elink-cn.com + * @since v1.0.0 2020-12-21 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_kpi_case_handling") +public class KpiCaseHandlingEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 部门id + */ + private String deptId; + + /** + * 部门名称 + */ + private String deptName; + + /** + * 部门类别 + */ + private String deptTypeKey; + + /** + * 年月 + */ + private String monthYear; + + /** + * 案件处置情况打分 + */ + private String caseHandling; + + /** + * 案件处置情况打分最终分数 + */ + private String caseHandlingScore; + + /** + * 上级部门id + */ + private String parentDeptIds; + + /** + * 上级部门名称 + */ + private String parentDeptNames; + + /** + * 所有部门id + */ + private String allDeptIds; + + /** + * 所有部门名称 + */ + private String allDeptNames; + +} diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/excel/KpiCaseHandlingExcel.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/excel/KpiCaseHandlingExcel.java new file mode 100644 index 000000000..b593a6c30 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/excel/KpiCaseHandlingExcel.java @@ -0,0 +1,86 @@ +/** + * 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.elink.esua.epdc.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 网格化平台案件处置情况打分表 + * + * @author elink elink@elink-cn.com + * @since v1.0.0 2020-12-21 + */ +@Data +public class KpiCaseHandlingExcel { + +// @Excel(name = "主键") +// private String id; + + @Excel(name = "部门id") + private String deptId; + + @Excel(name = "部门名称") + private String deptName; + + @Excel(name = "部门类别") + private String deptTypeKey; + + @Excel(name = "年月") + private String monthYear; + + @Excel(name = "案件处置情况打分") + private String caseHandling; + +// @Excel(name = "案件处置情况打分最终分数") +// private String caseHandlingScore; + +// @Excel(name = "上级部门id") +// private String parentDeptIds; +// +// @Excel(name = "上级部门名称") +// private String parentDeptNames; +// +// @Excel(name = "所有部门id") +// private String allDeptIds; +// +// @Excel(name = "所有部门名称") +// private String allDeptNames; +// +// @Excel(name = "乐观锁") +// private Integer revision; +// +// @Excel(name = "创建人") +// private String createdBy; +// +// @Excel(name = "创建时间") +// private Date createdTime; +// +// @Excel(name = "更新人") +// private String updatedBy; +// +// @Excel(name = "更新时间") +// private Date updatedTime; +// +// @Excel(name = "逻辑删除标识") +// private String delFlag; + + +} diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/feign/AdminFeignClient.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/feign/AdminFeignClient.java index f0e8a8cf5..58d42c0d2 100644 --- a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/feign/AdminFeignClient.java +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/feign/AdminFeignClient.java @@ -27,7 +27,7 @@ import java.util.List; * @email yujintao@elink-cn.com * @date 2019/9/7 9:27 */ -@FeignClient(name = ServiceConstant.EPDC_ADMIN_SERVER, fallback = AdminFeignClientFallback.class) +@FeignClient(name = ServiceConstant.EPDC_ADMIN_SERVER, fallback = AdminFeignClientFallback.class,url = "http://127.0.0.1:9092") public interface AdminFeignClient { /** diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/redis/KpiCaseHandlingRedis.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/redis/KpiCaseHandlingRedis.java new file mode 100644 index 000000000..93665d491 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/redis/KpiCaseHandlingRedis.java @@ -0,0 +1,47 @@ +/** + * 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.elink.esua.epdc.redis; + +import com.elink.esua.epdc.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 网格化平台案件处置情况打分表 + * + * @author elink elink@elink-cn.com + * @since v1.0.0 2020-12-21 + */ +@Component +public class KpiCaseHandlingRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/KpiCaseHandlingService.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/KpiCaseHandlingService.java new file mode 100644 index 000000000..aed0adbf2 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/KpiCaseHandlingService.java @@ -0,0 +1,124 @@ +/** + * 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.elink.esua.epdc.service; + +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.KpiCaseHandlingDTO; +import com.elink.esua.epdc.entity.KpiCaseHandlingEntity; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import java.util.Map; + +/** + * 网格化平台案件处置情况打分表 + * + * @author elink elink@elink-cn.com + * @since v1.0.0 2020-12-21 + */ +public interface KpiCaseHandlingService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-12-21 + */ + PageData page(Map params); + + /** + * 分页条件查询 + * @param params + * @return + */ + PageData getInfoPage(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-12-21 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return KpiCaseHandlingDTO + * @author generator + * @date 2020-12-21 + */ + KpiCaseHandlingDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-21 + */ + void save(KpiCaseHandlingDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-21 + */ + void update(KpiCaseHandlingDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-12-21 + */ + void delete(String[] ids); + + /** + * 网格化平台案件处置情况导出模板 + * + * @param params + * @return java.util.List + * @author wanggongfeng + * @date 2020-12-21 + */ + List exportTemplate(Map params); + + /** + * 网格化平台案件处置情况打分导入 + * + * @param file + * @return Result + * @author wanggongfeng + * @date 2020-12-21 + */ + Result importManualScoreExcel(MultipartFile file); +} diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/KpiCaseHandlingServiceImpl.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/KpiCaseHandlingServiceImpl.java new file mode 100644 index 000000000..486807073 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/KpiCaseHandlingServiceImpl.java @@ -0,0 +1,378 @@ +/** + * 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.elink.esua.epdc.service.impl; + +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; +import com.elink.esua.epdc.commons.tools.constant.StrConstant; +import com.elink.esua.epdc.commons.tools.enums.YesOrNoEnum; +import com.elink.esua.epdc.commons.tools.exception.RenException; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.security.user.SecurityUser; +import com.elink.esua.epdc.commons.tools.security.user.UserDetail; +import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; +import com.elink.esua.epdc.commons.tools.constant.FieldConstant; +import com.elink.esua.epdc.commons.tools.utils.DateUtils; +import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dao.KpiCaseHandlingDao; +import com.elink.esua.epdc.dto.DeptLevelAndLeaderDTO; +import com.elink.esua.epdc.dto.KpiCaseHandlingDTO; +import com.elink.esua.epdc.dto.SysDeptDTO; +import com.elink.esua.epdc.dto.epdc.form.ExportTemplateInfoFormDTO; +import com.elink.esua.epdc.dto.epdc.result.ExportKpiResultDTO; +import com.elink.esua.epdc.dto.form.CheckIsScoredFormDTO; +import com.elink.esua.epdc.entity.KpiCaseHandlingEntity; +import com.elink.esua.epdc.excel.KpiCaseHandlingExcel; +import com.elink.esua.epdc.feign.AdminFeignClient; +import com.elink.esua.epdc.redis.KpiCaseHandlingRedis; +import com.elink.esua.epdc.service.KpiCaseHandlingService; +import com.elink.esua.epdc.utils.DeptUtils; +import com.elink.esua.epdc.utils.StreamUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 网格化平台案件处置情况打分表 + * + * @author elink elink@elink-cn.com + * @since v1.0.0 2020-12-21 + */ +@Service +public class KpiCaseHandlingServiceImpl extends BaseServiceImpl implements KpiCaseHandlingService { + + @Autowired + private KpiCaseHandlingRedis kpiCaseHandlingRedis; + + @Autowired + private AdminFeignClient adminFeignClient; + + @Autowired + private DeptUtils deptUtils; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, KpiCaseHandlingDTO.class); + } + + /** + * 条件查询 + * @param params + * @return + */ + @Override + public PageData getInfoPage(Map params) { + IPage page = getPage(params); + List list = baseDao.getInfoPage(params); + return new PageData<>(list, page.getTotal()); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, KpiCaseHandlingDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public KpiCaseHandlingDTO get(String id) { + KpiCaseHandlingEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, KpiCaseHandlingDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(KpiCaseHandlingDTO dto) { + String deptId = dto.getDeptId(); + List checkList = new ArrayList(); + checkList.add(deptId); + // 判断录入月份是否为当前月或者前一个月 + if(!dto.getMonthYear().equals(DateUtils.getLastMonth()) && !dto.getMonthYear().equals(DateUtils.getCurrentMonth())){ + throw new RenException("只能对当前月份或者上个月份进行打分,请维护后重试!"); + } + // 检测excel中是否存在已打分部门 + StringBuffer deptErrorInfo = this.getDuplicateData(checkList,dto.getMonthYear()); + if (deptErrorInfo.length() > 0) { + throw new RenException(deptErrorInfo + " 已打分, 不可重复打分!"); + } + // 查询机构类型键值 + Result result = adminFeignClient.get(Long.valueOf(deptId)); + SysDeptDTO sysDeptDTO = result.getData(); + // 设置部门类别 + dto.setDeptTypeKey(sysDeptDTO.getTypeKey()); + KpiCaseHandlingEntity entity = ConvertUtils.sourceToTarget(dto, KpiCaseHandlingEntity.class); + entity = setScore(entity); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(KpiCaseHandlingDTO dto) { + KpiCaseHandlingEntity entity = ConvertUtils.sourceToTarget(dto, KpiCaseHandlingEntity.class); + entity = setScore(entity); + updateById(entity); + } + + /** + * 根据手动打分分数计算实际分数 + * @param entity + * @return + */ + public KpiCaseHandlingEntity setScore(KpiCaseHandlingEntity entity){ + DecimalFormat df = new DecimalFormat("#.###"); + Double caseHandlingDoubleNum = Double.parseDouble(entity.getCaseHandling()); + // 100分换算成10分 + entity.setCaseHandlingScore(df.format(caseHandlingDoubleNum / 10)); + return entity; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * 获取导出模板 + * + * @param params + * @return java.util.List + * @author wanggongfeng + * @date 2020-06-15 + */ + @Override + public List exportTemplate(Map params) { + List deptIdList = SecurityUser.getUser().getDeptIdList(); //获取用户权限 + ExportTemplateInfoFormDTO exportTemplateInfoFormDTO = new ExportTemplateInfoFormDTO(); + exportTemplateInfoFormDTO.setDeptIdList(deptIdList); + exportTemplateInfoFormDTO.setDeptId(params.get("deptId") == null ? "" : params.get("deptId").toString()); + exportTemplateInfoFormDTO.setDeptTypeKey(params.get("deptTypeKey") == null ? "" : params.get("deptTypeKey").toString()); + exportTemplateInfoFormDTO.setMonthYear(params.get("monthYear") == null ? "" : params.get("monthYear").toString()); + Result> result = adminFeignClient.getExportTemplateInfo(exportTemplateInfoFormDTO); + List resultList = result.getData(); + return ConvertUtils.sourceToTarget(resultList, KpiCaseHandlingDTO.class); + } + + /** + * @Description: 导入治理排行管理-网格化平台案件处置情况打分 + * @Param: [file] + * @return: Result + * @Author: wanggongfeng + * @Date: 2020-12-21 + */ + @Override + public Result importManualScoreExcel(MultipartFile file) { + File f = StreamUtils.conversionFile(file); + try { + //判断上传文件类型 + String originalFilename = file.getOriginalFilename(); + if (!originalFilename.endsWith(StrConstant.EXCEL_SUFFIX_2003) && !originalFilename.endsWith(StrConstant.EXCEL_SUFFIX_2007)) { + return new Result().error("请选择.xls或者.xlsx格式文件"); + } + List recordList = ExcelImportUtil.importExcel(f, KpiCaseHandlingExcel.class, new ImportParams()); + if (CollUtil.isEmpty(recordList)) { + return new Result().error("导入内容不能为空"); + } + // 存储检测excel是否存在重复ID使用 + List checkList = new ArrayList(); + StringBuffer checkInfo = new StringBuffer(); + String monthYear = ""; + for(int i = 0 ; i < recordList.size() ; i++){ + KpiCaseHandlingExcel kpiCaseHandlingExcel = recordList.get(i); + + // 校验是否存在空单元格 + if(checkNullCell(kpiCaseHandlingExcel)){ + return new Result().error("导入文件中存在空单元格或模板格式不匹配,请完善表格或核对模板是否正确!"); + } + + // 校验是否存在分数范围不正确的打分 + if(checkScoreCell(kpiCaseHandlingExcel)){ + return new Result().error("存在不符合分值范围的分数!"); + } + + // 校验月份是否不一致 + if(i == 0){ + monthYear = kpiCaseHandlingExcel.getMonthYear(); + }else{ + if(!monthYear.equals(kpiCaseHandlingExcel.getMonthYear())){ + return new Result().error("导入文件中月份不一致,请修改一致后重试!"); + } + monthYear = kpiCaseHandlingExcel.getMonthYear(); + } + + // 校验ID是否存在重复 + if(checkList.contains(kpiCaseHandlingExcel.getDeptId())){ + return new Result().error(kpiCaseHandlingExcel.getDeptName() + "ID重复,请维护唯一ID后重试!"); + } + checkList.add(kpiCaseHandlingExcel.getDeptId()); + + // 拼接部门ID不在当前用户权限内的部门名称 + checkInfo.append(splicingErrorDeptName(i,kpiCaseHandlingExcel,recordList)); + } + // 判断导入月份是否为当前月或者前一个月 + if(!monthYear.equals(DateUtils.getLastMonth()) && !monthYear.equals(DateUtils.getCurrentMonth())){ + return new Result().error("只能对当前月份或者上个月份进行打分,请维护后重试!"); + } + // 校验部门ID是否存在当前用户权限内 + if (checkInfo.length() > 0) { + return new Result().error(checkInfo.append("部门ID错误,请维护后重试!").toString()); + } + // 检测excel中是否存在已打分部门 + StringBuffer deptErrorInfo = this.getDuplicateData(checkList,monthYear); + if (deptErrorInfo.length() > 0) { + return new Result().error(deptErrorInfo + " 已打分, 不可重复打分!"); + } + // 插入案件处置情况打分数据(必要时可改为批量插入) + for (KpiCaseHandlingExcel kpiCaseHandlingExcel : recordList) { + KpiCaseHandlingEntity entity = splicingEntity(kpiCaseHandlingExcel); + entity = setScore(entity); + insert(entity); + } + } catch (Exception e) { + return new Result().error("数据异常,解析excel文件失败"); + } finally { + // 删除文件 + ExcelUtils.deleteAllFilesOfDir(f); + } + return new Result(); + } + + /** + * 拼接案件处置情况打分实体 + * @param kpiCaseHandlingExcel + * @return + */ + private KpiCaseHandlingEntity splicingEntity(KpiCaseHandlingExcel kpiCaseHandlingExcel){ + KpiCaseHandlingEntity entity = ConvertUtils.sourceToTarget(kpiCaseHandlingExcel, KpiCaseHandlingEntity.class); + // 查询设置部门类别和部门名称 + String deptId = entity.getDeptId(); + Result result = adminFeignClient.get(Long.valueOf(deptId)); + SysDeptDTO sysDeptDTO = result.getData(); + entity.setDeptTypeKey(sysDeptDTO.getTypeKey()); + entity.setDeptName(sysDeptDTO.getName()); + // 查询设置上级部门信息 + DeptLevelAndLeaderDTO deptLevelInfo = deptUtils.getDeptLevelInfo(Long.valueOf(deptId), YesOrNoEnum.YES); + entity.setAllDeptIds(deptLevelInfo.getAllDeptIds()); + entity.setAllDeptNames(deptLevelInfo.getAllDeptNames()); + entity.setParentDeptIds(deptLevelInfo.getParentDeptIds()); + entity.setParentDeptNames(deptLevelInfo.getParentDeptNames()); + return entity; + } + + /** + * 校验分数是否规范 + * @param kpiCaseHandlingExcel + * @return + */ + private Boolean checkScoreCell(KpiCaseHandlingExcel kpiCaseHandlingExcel){ + // 案件处置情况分数(100分) + String caseHandling = kpiCaseHandlingExcel.getCaseHandling(); + if(ExcelUtils.checkNumber(caseHandling)){ + return true; + } + Double caseHandlingDouble = Double.parseDouble(caseHandling); + if(caseHandlingDouble < 0 || caseHandlingDouble > 100){ + return true; + } + return false; + } + + /** + * 校验是否存在空单元格 + * @param kpiCaseHandlingExcel + * @return + */ + private Boolean checkNullCell(KpiCaseHandlingExcel kpiCaseHandlingExcel){ + if(StringUtils.isBlank(kpiCaseHandlingExcel.getDeptId()) || StringUtils.isBlank(kpiCaseHandlingExcel.getDeptName()) || StringUtils.isBlank(kpiCaseHandlingExcel.getMonthYear()) + || StringUtils.isBlank(kpiCaseHandlingExcel.getCaseHandling())){ + return true; + } + return false; + } + + /** + * 拼接部门ID不在当前用户权限内的部门名称 + * @param index + * @param kpiCaseHandlingExcel + * @param recordList + * @return + */ + private String splicingErrorDeptName(int index,KpiCaseHandlingExcel kpiCaseHandlingExcel,List recordList){ + UserDetail user = SecurityUser.getUser(); + List deptIdList = user.getDeptIdList(); + if(!deptIdList.contains(Long.valueOf(kpiCaseHandlingExcel.getDeptId()))){ + if(index == (recordList.size()-1)){ + return kpiCaseHandlingExcel.getDeptName(); + }else{ + return kpiCaseHandlingExcel.getDeptName() + "、"; + } + } + return ""; + } + + /** + * 拼接已打分部门提示信息 + * @param checkList + * @return + */ + private StringBuffer getDuplicateData(List checkList ,String monthYear){ + CheckIsScoredFormDTO checkIsScoredFormDTO = new CheckIsScoredFormDTO(); + checkIsScoredFormDTO.setCheckList(checkList); + checkIsScoredFormDTO.setMonthYear(monthYear); + StringBuffer deptErrorInfo = new StringBuffer(); + List list = baseDao.getDuplicateData(checkIsScoredFormDTO); + for(int i = 0 ; i < list.size() ; i++){ + KpiCaseHandlingDTO kpiCaseHandlingDTO = list.get(i); + if(i == (list.size()-1)){ + deptErrorInfo.append(kpiCaseHandlingDTO.getDeptName()); + }else{ + deptErrorInfo.append(kpiCaseHandlingDTO.getDeptName()).append("、"); + } + } + return deptErrorInfo; + } + +} diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/KpiCaseHandlingDao.xml b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/KpiCaseHandlingDao.xml new file mode 100644 index 000000000..12c5fb69e --- /dev/null +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/KpiCaseHandlingDao.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +