diff --git a/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/controller/SysDeptController.java b/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/controller/SysDeptController.java index 0fdbbb0d5..9f58c56fe 100644 --- a/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/controller/SysDeptController.java +++ b/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/controller/SysDeptController.java @@ -199,4 +199,16 @@ public class SysDeptController { List list = sysDeptService.listUserSysDeptInfoResultDTO(formDTO); return new Result>().ok(list); } + + /*** + * 获取所有网格 kpi模块原始数据 + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author qushutong + * @date 2019/12/12 17:26 + */ + @GetMapping("listAllGridId") + @ApiOperation("获取所有下属网格ID集合") + public Result listAllGridId() { + return sysDeptService.listAllGridId(); + } } diff --git a/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/SysDeptDao.java b/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/SysDeptDao.java index b25078dda..a89edac59 100644 --- a/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/SysDeptDao.java +++ b/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/SysDeptDao.java @@ -8,6 +8,7 @@ package com.elink.esua.epdc.dao; +import com.elink.esua.epdc.commons.tools.utils.Result; import com.elink.esua.epdc.dto.CompleteDeptDTO; import com.elink.esua.epdc.dto.SysDeptDTO; import com.elink.esua.epdc.dto.SysSimpleDeptDTO; @@ -136,4 +137,15 @@ public interface SysDeptDao extends BaseDao { * @Date 2019/12/4 20:22 **/ List selectListUserSysDeptInfo(UserSysDeptInfoFormDTO formDTO); + + + + /*** + * 查询所有网格 + * @param + * @return java.util.List + * @author qushutong + * @date 2019/12/12 18:12 + */ + List selectListAllGridId(); } diff --git a/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/SysDeptService.java b/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/SysDeptService.java index 33c5b890c..a95a808fb 100644 --- a/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/SysDeptService.java +++ b/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/SysDeptService.java @@ -170,4 +170,16 @@ public interface SysDeptService extends BaseService { * @Date 2019/12/4 19:43 **/ List listUserSysDeptInfoResultDTO(UserSysDeptInfoFormDTO formDTO); + + /*** + * 获取所有网格 + * @param + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @author qushutong + * @date 2019/12/12 17:29 + */ + Result listAllGridId(); + + + } diff --git a/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/impl/SysDeptServiceImpl.java b/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/impl/SysDeptServiceImpl.java index 3f94f6c9e..152d71908 100644 --- a/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/impl/SysDeptServiceImpl.java +++ b/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/impl/SysDeptServiceImpl.java @@ -387,6 +387,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl gridIdList = baseDao.selectListAllGridId(); + + return null; + } } diff --git a/esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/SysDeptDao.xml b/esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/SysDeptDao.xml index 03fccfdc3..54100f933 100644 --- a/esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/SysDeptDao.xml +++ b/esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/SysDeptDao.xml @@ -5,7 +5,7 @@ SELECT - dis.`name` district, - dis.id districtId, - str.`name` street, - str.id streetId, - com.`name` community, - com.id communityId, - gri.`name` grid, - gri.id gridId, - gri.create_date switchedTime + dis.`name` district, + dis.id districtId, + str.`name` street, + str.id streetId, + com.`name` community, + com.id communityId, + gri.`name` grid, + gri.id gridId, + gri.create_date switchedTime FROM - sys_dept gri - LEFT JOIN sys_dept com ON gri.pid = com.id - LEFT JOIN sys_dept str ON com.pid = str.id - LEFT JOIN sys_dept dis ON str.pid = dis.id + sys_dept gri + LEFT JOIN sys_dept com ON gri.pid = com.id + LEFT JOIN sys_dept str ON com.pid = str.id + LEFT JOIN sys_dept dis ON str.pid = dis.id WHERE - gri.ID in - #{gridId} - AND gri.del_flag = '0' - AND dis.id IS NOT NULL + gri.ID in + #{gridId} + AND gri.del_flag = '0' + AND dis.id IS NOT NULL @@ -160,34 +164,43 @@ + + diff --git a/esua-epdc/epdc-gateway/pom.xml b/esua-epdc/epdc-gateway/pom.xml index f84f5cdc9..93de64088 100644 --- a/esua-epdc/epdc-gateway/pom.xml +++ b/esua-epdc/epdc-gateway/pom.xml @@ -99,12 +99,12 @@ lb://epdc-auth-server - + http://127.0.0.1:9092 lb://epdc-activiti-server - lb://epdc-api-server - + + http://127.0.0.1:9040 lb://epdc-app-server lb://epdc-heart-server diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/NewsFeignClient.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/NewsFeignClient.java index 35a3ddb84..8a84834c1 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/NewsFeignClient.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/NewsFeignClient.java @@ -18,7 +18,7 @@ import java.util.List; * @email yujintao@elink-cn.com * @date 2019/9/5 19:20 */ -@FeignClient(name = ServiceConstant.EPDC_NEWS_SERVER, fallback = NewsFeignClientFallback.class) +@FeignClient(name = ServiceConstant.EPDC_NEWS_SERVER, fallback = NewsFeignClientFallback.class,url = "http://127.0.0.1:9064") public interface NewsFeignClient { /** diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/UserFeignClient.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/UserFeignClient.java index b9854986c..84cc2094a 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/UserFeignClient.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/UserFeignClient.java @@ -22,7 +22,7 @@ import java.util.List; * @email yujintao@elink-cn.com * @date 2019/9/7 9:27 */ -@FeignClient(name = ServiceConstant.EPDC_USER_SERVER, fallback = UserFeignClientFallback.class) +@FeignClient(name = ServiceConstant.EPDC_USER_SERVER, fallback = UserFeignClientFallback.class,url = "http://localhost:9068") public interface UserFeignClient { /** diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/events/form/EventCountSqlFromDTO.java b/esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/events/form/EventCountSqlFromDTO.java new file mode 100644 index 000000000..284a14eba --- /dev/null +++ b/esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/events/form/EventCountSqlFromDTO.java @@ -0,0 +1,31 @@ +package com.elink.esua.epdc.dto.events.form; + +import lombok.Data; + +import java.util.Date; + + +/** + * @author: qushutong + * @Date: 2019/12/16 14:52 + * @Description: 查询参数 + */ +@Data +public class EventCountSqlFromDTO { + + /*** + * 网格id + */ + private Long gridId; + + /*** + * 月 季 年 0,1,2 + */ + private String type; + + /*** + * 0 是群众反应问题总数 1 群众反应问题响应数 + */ + private String responseType; + +} diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/pom.xml b/esua-epdc/epdc-module/epdc-events/epdc-events-server/pom.xml index 8fe235dd6..5d6bdc123 100644 --- a/esua-epdc/epdc-module/epdc-events/epdc-events-server/pom.xml +++ b/esua-epdc/epdc-module/epdc-events/epdc-events-server/pom.xml @@ -13,6 +13,11 @@ jar + + com.esua.epdc + epdc-kpi-client + 1.0.0 + com.esua.epdc epdc-events-client diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/controller/EpdcEventsController.java b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/controller/EpdcEventsController.java index 602383c9a..dbf02a2a3 100644 --- a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/controller/EpdcEventsController.java +++ b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/controller/EpdcEventsController.java @@ -26,6 +26,8 @@ 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.DefaultGroup; import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; +import com.elink.esua.epdc.dto.EventCountFromDTO; +import com.elink.esua.epdc.dto.KpiMetaDataDTO; import com.elink.esua.epdc.dto.events.EpdcRejectEventDetailDTO; import com.elink.esua.epdc.dto.events.EpdcRejectEventsDTO; import com.elink.esua.epdc.dto.events.EpdcEventsDTO; @@ -34,6 +36,7 @@ import com.elink.esua.epdc.dto.events.form.EpdcEventsReviewFormDTO; import com.elink.esua.epdc.modules.events.excel.EpdcEventsExcel; import com.elink.esua.epdc.modules.events.service.EpdcEventsService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; @@ -160,4 +163,16 @@ public class EpdcEventsController { return new Result(); } + /*** + * 获取各个网格事件上报总数 + * @param eventCountFromDto + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @author qushutong + * @date 2019/12/16 14:10 + */ + @PostMapping(value = "getAllCommitCount") + public Result> getAllCommitCount(@RequestBody EventCountFromDTO eventCountFromDto){ + return epdcEventsService.listEventCountByGridId(eventCountFromDto); + } + } diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/dao/EpdcEventsDao.java b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/dao/EpdcEventsDao.java index 143416b02..2a1f35e98 100644 --- a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/dao/EpdcEventsDao.java +++ b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/dao/EpdcEventsDao.java @@ -18,15 +18,15 @@ package com.elink.esua.epdc.modules.events.dao; import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; -import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.KpiMetaDataDTO; import com.elink.esua.epdc.dto.events.*; +import com.elink.esua.epdc.dto.events.form.EventCountSqlFromDTO; import com.elink.esua.epdc.dto.events.result.EventAppDetailResultDTO; import com.elink.esua.epdc.dto.issue.form.IssuePendingResponseFormDTO; import com.elink.esua.epdc.dto.issue.result.IssuePendingResponseResultDTO; import com.elink.esua.epdc.modules.events.entity.EpdcEventsEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; -import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.Map; @@ -144,5 +144,12 @@ public interface EpdcEventsDao extends BaseDao { List listIssuePendingResponse(IssuePendingResponseFormDTO formDto); - + /*** + * 查询各个网格事件总数 + * @param eventCountDtoFromDTO + * @return java.util.List + * @author qushutong + * @date 2019/12/16 14:32 + */ + KpiMetaDataDTO seliceListEventCount(EventCountSqlFromDTO eventCountDtoFromDTO); } diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/EpdcEventsService.java b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/EpdcEventsService.java index 97a789e9d..0610422f8 100644 --- a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/EpdcEventsService.java +++ b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/EpdcEventsService.java @@ -20,6 +20,8 @@ package com.elink.esua.epdc.modules.events.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.EventCountFromDTO; +import com.elink.esua.epdc.dto.KpiMetaDataDTO; import com.elink.esua.epdc.dto.events.*; import com.elink.esua.epdc.dto.events.form.EpdcEventSubmitFormDTO; import com.elink.esua.epdc.dto.events.form.EpdcEventsReviewFormDTO; @@ -207,4 +209,15 @@ public interface EpdcEventsService extends BaseService { */ Result topicToIssue(EpdcEventSubmitFormDTO dto); + + + /*** + * 群众反映问题总数 + * @param eventCountFromDto + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author qushutong + * @date 2019/12/16 14:17 + */ + Result> listEventCountByGridId(EventCountFromDTO eventCountFromDto); + } diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/impl/EpdcEventsServiceImpl.java b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/impl/EpdcEventsServiceImpl.java index 7dc0c825c..419b0881a 100644 --- a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/impl/EpdcEventsServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/impl/EpdcEventsServiceImpl.java @@ -27,11 +27,15 @@ 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.utils.LocalDateUtils; import com.elink.esua.epdc.commons.tools.utils.Result; import com.elink.esua.epdc.constant.EventIssueItemState; import com.elink.esua.epdc.constant.EventsNoticeConstant; import com.elink.esua.epdc.constant.ImageConstant; +import com.elink.esua.epdc.constant.KpiDataName; import com.elink.esua.epdc.constants.MenuCodeConstant; +import com.elink.esua.epdc.dto.EventCountFromDTO; +import com.elink.esua.epdc.dto.KpiMetaDataDTO; import com.elink.esua.epdc.dto.MenuNoticeDTO; import com.elink.esua.epdc.dto.SysDeptDTO; import com.elink.esua.epdc.dto.category.CategoryDTO; @@ -39,10 +43,12 @@ import com.elink.esua.epdc.dto.epdc.form.EpdcInformationFormDTO; import com.elink.esua.epdc.dto.events.*; import com.elink.esua.epdc.dto.events.form.EpdcEventSubmitFormDTO; import com.elink.esua.epdc.dto.events.form.EpdcEventsReviewFormDTO; +import com.elink.esua.epdc.dto.events.form.EventCountSqlFromDTO; import com.elink.esua.epdc.dto.events.result.EventAppDetailResultDTO; import com.elink.esua.epdc.dto.issue.IssueDTO; import com.elink.esua.epdc.dto.issue.form.IssuePendingResponseFormDTO; import com.elink.esua.epdc.dto.issue.result.IssuePendingResponseResultDTO; +import com.elink.esua.epdc.enums.KpiCycleEnum; import com.elink.esua.epdc.modules.async.NewsTask; import com.elink.esua.epdc.modules.category.entity.CategoryEntity; import com.elink.esua.epdc.modules.category.service.CategoryService; @@ -62,6 +68,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDate; +import java.time.YearMonth; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -173,16 +181,16 @@ public class EpdcEventsServiceImpl extends BaseServiceImpl> listIssuePendingResponse(IssuePendingResponseFormDTO formDto) { List list; - if (formDto.getDeptId() > 0){ + if (formDto.getDeptId() > 0) { list = new ArrayList<>(); list.add(formDto.getDeptId()); - }else { + } else { list = SecurityUser.getUser().getDeptIdList(); } formDto.setDeptIdList(list); @@ -468,32 +474,32 @@ public class EpdcEventsServiceImpl extends BaseServiceImpl().ok(issueDTO); } + /** - * * 初始化分类信息 * - * @params [categoryId] * @return com.elink.esua.epdc.dto.events.EventsCategoryDTO + * @params [categoryId] * @author liuchuang * @since 2019/11/29 13:51 */ private EventsCategoryDTO initCategoryInfo(String categoryId) { Long category = Long.parseLong(categoryId); EventsCategoryDTO resultDto = new EventsCategoryDTO(); - CategoryDTO cateDto =categoryService.get(category); + CategoryDTO cateDto = categoryService.get(category); resultDto.setCategoryCode(cateDto.getCategoryCode()); //获取所有父类分类标签 List cateList = categoryService.getPidListById(category); //所选分类标签为多级 - if(cateList != null && cateList.size() > 0) { + if (cateList != null && cateList.size() > 0) { // list第一个为一级分类标签 resultDto.setFirstCategoryCode(cateList.get(0).getCategoryCode()); //分类标签全称拼接:-分割 String name = ""; - for (int i = 0; i < cateList.size(); i++){ - if (i == cateList.size() -1){ + for (int i = 0; i < cateList.size(); i++) { + if (i == cateList.size() - 1) { name = name + cateList.get(i).getCategoryName(); - }else { + } else { name = name + cateList.get(i).getCategoryName() + "-"; } } @@ -508,4 +514,70 @@ public class EpdcEventsServiceImpl extends BaseServiceImpl> listEventCountByGridId(EventCountFromDTO eventCountFromDto) { + List gridList = eventCountFromDto.getGridIdList(); + //查询sql入参 + EventCountSqlFromDTO eventCountDtoFromDTO; + //结果 + KpiMetaDataDTO kpiMetaDataDto; + List kpiMetaDataDtoList = new ArrayList<>(); + //统计月 + //取本月第一天 + YearMonth now = YearMonth.now(); + LocalDate endTime = now.atDay(1); + //上个月的第一天 + LocalDate startTime = now.minusMonths(1).atDay(1); + for (Long gridId : gridList) { + eventCountDtoFromDTO = new EventCountSqlFromDTO(); + eventCountDtoFromDTO.setGridId(gridId); + eventCountDtoFromDTO.setType(NumConstant.ZERO_STR); + eventCountDtoFromDTO.setResponseType(eventCountFromDto.getResponseType()); + kpiMetaDataDto = baseDao.seliceListEventCount(eventCountDtoFromDTO); + kpiMetaDataDto.setDataCode(KpiDataName.peopleReportRespAmount); + kpiMetaDataDto.setKpiCycle(KpiCycleEnum.KPI_CYCLE_MONTH.getValue()); + kpiMetaDataDto.setStartDate(LocalDateUtils.localDateToDate(startTime)); + kpiMetaDataDto.setEndDate(LocalDateUtils.localDateToDate(endTime)); + kpiMetaDataDtoList.add(kpiMetaDataDto); + } + //按照季统计 + int nowMonth = now.getMonthValue(); + // 1,4,7,10 月份的时候统计 季度 季度第一天统计上一季度 + if (nowMonth == NumConstant.ONE || nowMonth == NumConstant.FOUR || nowMonth == NumConstant.SEVEN || nowMonth == NumConstant.TEN) { + //上个季度第一天 + LocalDate lastQuarter = now.minusMonths(3).atDay(1); + for (Long gridId : gridList) { + eventCountDtoFromDTO = new EventCountSqlFromDTO(); + eventCountDtoFromDTO.setGridId(gridId); + eventCountDtoFromDTO.setType(NumConstant.ONE_STR); + eventCountDtoFromDTO.setResponseType(eventCountFromDto.getResponseType()); + kpiMetaDataDto = baseDao.seliceListEventCount(eventCountDtoFromDTO); + kpiMetaDataDto.setDataCode(KpiDataName.peopleReportRespAmount); + kpiMetaDataDto.setKpiCycle(KpiCycleEnum.KPI_CYCLE_QUARTER.getValue()); + kpiMetaDataDto.setStartDate(LocalDateUtils.localDateToDate(lastQuarter)); + kpiMetaDataDto.setEndDate(LocalDateUtils.localDateToDate(endTime)); + kpiMetaDataDtoList.add(kpiMetaDataDto); + } + } + //按照年 + // 一月份统计去年的 + if (nowMonth == NumConstant.ONE) { + //上个季度第一天 + LocalDate lastYear = now.minusYears(1).atDay(1); + for (Long gridId : gridList) { + eventCountDtoFromDTO = new EventCountSqlFromDTO(); + eventCountDtoFromDTO.setGridId(gridId); + eventCountDtoFromDTO.setType(NumConstant.TWO_STR); + eventCountDtoFromDTO.setResponseType(eventCountFromDto.getResponseType()); + kpiMetaDataDto = baseDao.seliceListEventCount(eventCountDtoFromDTO); + kpiMetaDataDto.setDataCode(KpiDataName.peopleReportRespAmount); + kpiMetaDataDto.setKpiCycle(KpiCycleEnum.KPI_CYCLE_YEAR.getValue()); + kpiMetaDataDto.setStartDate(LocalDateUtils.localDateToDate(lastYear)); + kpiMetaDataDto.setEndDate(LocalDateUtils.localDateToDate(endTime)); + kpiMetaDataDtoList.add(kpiMetaDataDto); + } + } + return new Result>().ok(kpiMetaDataDtoList); + } } diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/events/EpdcEventsDao.xml b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/events/EpdcEventsDao.xml index 7ae04d9a1..e6c5a0324 100644 --- a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/events/EpdcEventsDao.xml +++ b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/events/EpdcEventsDao.xml @@ -58,59 +58,59 @@ @@ -310,6 +310,37 @@ order by CREATED_TIME LIMIT #{pageIndex},#{pageSize} - + + diff --git a/esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/feign/KpiFeignClient.java b/esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/feign/KpiFeignClient.java new file mode 100644 index 000000000..7d3c926a4 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/feign/KpiFeignClient.java @@ -0,0 +1,27 @@ +package com.elink.esua.epdc.feign; + +import com.elink.esua.epdc.commons.tools.utils.Result; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; + +/** + * @author: qushutong + * @Date: 2019/12/12 18:46 + * @Description: kpi模块 + */ +public interface KpiFeignClient { + + /*** + * 调用kpi模块执行获取元数据的定时任务 + * @param + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author qushutong + * @date 2019/12/12 18:55 + */ + @GetMapping(value = "kpimetadata/buildMetaData", consumes = MediaType.APPLICATION_JSON_VALUE) + Result runKpiMateData(); +} diff --git a/esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/feign/fallback/KpiFeignClientFallBack.java b/esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/feign/fallback/KpiFeignClientFallBack.java new file mode 100644 index 000000000..d16904d21 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/feign/fallback/KpiFeignClientFallBack.java @@ -0,0 +1,16 @@ +package com.elink.esua.epdc.feign.fallback; + +import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; +import com.elink.esua.epdc.commons.tools.utils.ModuleUtils; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.feign.KpiFeignClient; + +import java.util.List; + +public class KpiFeignClientFallBack implements KpiFeignClient { + + @Override + public Result runKpiMateData() { + return ModuleUtils.feignConError(ServiceConstant.EPDC_KPI_SERVER, "sendGridIdList", ""); + } +} diff --git a/esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/service/ScheduleJobKpiService.java b/esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/service/ScheduleJobKpiService.java new file mode 100644 index 000000000..31ee3c80d --- /dev/null +++ b/esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/service/ScheduleJobKpiService.java @@ -0,0 +1,18 @@ +package com.elink.esua.epdc.service; + +/** + * @author: qushutong + * @Date: 2019/12/12 16:52 + * @Description: kpi 模块查原始数据 + */ +public interface ScheduleJobKpiService { + + /*** + * 启动kpi模块获取原始数据 + * @param + * @return void + * @author qushutong + * @date 2019/12/12 16:56 + */ + void runKpi(); +} diff --git a/esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/service/impl/ScheduleJobKpiServiceImpl.java b/esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/service/impl/ScheduleJobKpiServiceImpl.java new file mode 100644 index 000000000..25ebae36f --- /dev/null +++ b/esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/service/impl/ScheduleJobKpiServiceImpl.java @@ -0,0 +1,21 @@ +package com.elink.esua.epdc.service.impl; + +import com.elink.esua.epdc.feign.KpiFeignClient; +import com.elink.esua.epdc.service.ScheduleJobKpiService; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * @author: qushutong + * @Date: 2019/12/12 16:53 + * @Description: 查询gridId + */ +public class ScheduleJobKpiServiceImpl implements ScheduleJobKpiService { + + @Autowired + private KpiFeignClient kpiFeignClient; + + @Override + public void runKpi() { + kpiFeignClient.runKpiMateData(); + } +} diff --git a/esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/task/KpiDataTask.java b/esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/task/KpiDataTask.java new file mode 100644 index 000000000..b71a2d696 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/task/KpiDataTask.java @@ -0,0 +1,18 @@ +package com.elink.esua.epdc.task; + +/** + * @author: qushutong + * @Date: 2019/12/12 16:47 + * @Description: kpi模块查询原始数据 + */ +public interface KpiDataTask { + + /*** + * kpi模块查询原始数据 + * @param params + * @return void + * @author qushutong + * @date 2019/12/12 16:48 + */ + void run(String params); +} diff --git a/esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/task/KpiDataTaskImple.java b/esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/task/KpiDataTaskImple.java new file mode 100644 index 000000000..f84b295bb --- /dev/null +++ b/esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/task/KpiDataTaskImple.java @@ -0,0 +1,28 @@ +package com.elink.esua.epdc.task; + +import com.elink.esua.epdc.service.ScheduleJobKpiService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @author: qushutong + * @Date: 2019/12/12 16:50 + * @Description: kpi + */ +@Component("kpiDataTask") +public class KpiDataTaskImple implements KpiDataTask{ + + @Autowired + private ScheduleJobKpiService scheduleJobKpiService; + /*** + * 查询所有gruidID 统计kpi原始数据 + * @param params + * @return void + * @author qushutong + * @date 2019/12/12 16:51 + */ + @Override + public void run(String params) { + scheduleJobKpiService.runKpi(); + } +} diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/constant/KpiDataName.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/constant/KpiDataName.java new file mode 100644 index 000000000..edd35060e --- /dev/null +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/constant/KpiDataName.java @@ -0,0 +1,76 @@ +package com.elink.esua.epdc.constant; + +/** + * @author: qushutong + * @Date: 2019/12/16 19:36 + * @Description: 数据项名称 + */ +public interface KpiDataName { + + /*** + * 响应网格呼叫数 + */ + String xywghjs = "xywghjs"; + + /*** + * 网格呼叫总数 + */ + String wghjzs = "wghjzs"; + + /*** + * 办结呼叫事项数 + */ + String bjhjsxs = "bjhjsxs"; + + /*** + * 呼叫总数 + */ + String hjzs = "hjzs"; + + /*** + * 问题办理满意数 + */ + String peopleHighEvaluationAmount = "people_high_evaluation_amount"; + + /*** + * 问题办理基本满意数 + */ + String peopleMediumEvaluationAmount = "people_medium_evaluation_amount"; + + /*** + * 问题办理不满意数 + */ + String peopleLowEvaluationAmount = "people_low_evaluation_amount"; + + /*** + * 评价总数 + */ + String pjzs = "pjzs"; + + /*** + * 群众反映问题响应数 + */ + String peopleReportRespAmount = "people_report_resp_amount"; + + /*** + * 群众反映问题总数 + */ + String peopleReportAmount = "people_report_amount"; + + /*** + * 群众投票满意数 + */ + String voteHighEvaluationAmount = "vote_high_evaluation_amount"; + + /*** + * 群众投票基本满意数 + */ + String voteMediumEvaluationAmount = "vote_medium_evaluation_amount"; + + /*** + * 群众投票不满意数 + */ + String voteLowEvaluationAmount = "vote_low_evaluation_amount"; + + +} diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/EventCountFromDTO.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/EventCountFromDTO.java new file mode 100644 index 000000000..8d27ad97f --- /dev/null +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/EventCountFromDTO.java @@ -0,0 +1,25 @@ +package com.elink.esua.epdc.dto; + + +import lombok.Data; + +import java.util.List; + +/** + * @author: qushutong + * @Date: 2019/12/17 10:23 + * @Description: kpi 群众反应问题数 + */ +@Data +public class EventCountFromDTO { + + /*** + * 所有网格 + */ + private List gridIdList; + + /*** + * 0 是群众反应问题总数 1 群众反应问题响应数 + */ + private String responseType; +} diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/KpiMetaDataDTO.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/KpiMetaDataDTO.java new file mode 100644 index 000000000..d95a8c314 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-client/src/main/java/com/elink/esua/epdc/dto/KpiMetaDataDTO.java @@ -0,0 +1,107 @@ +/** + * 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; + +import java.math.BigDecimal; + +/** + * 绩效考核的元数据 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-12-16 + */ +@Data +public class KpiMetaDataDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 数据项编码 + */ + private String dataCode; + + /** + * 数据项名称 + */ + private String dataName; + + /** + * 元数据值 + */ + private BigDecimal dataValue; + + /** + * 考核周期(字典值 代表月,季,年) + */ + private String kpiCycle; + + /** + * 考核周期开始日 + */ + private Date startDate; + + /** + * 考核周期结束日 + */ + private Date endDate; + + /** + * 部门ID + */ + private Long deptId; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 删除标记 + */ + private String delFlag; + +} \ 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/controller/KpiMetaDataController.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/KpiMetaDataController.java new file mode 100644 index 000000000..034c42f60 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/controller/KpiMetaDataController.java @@ -0,0 +1,106 @@ +/** + * 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.KpiMetaDataDTO; +import com.elink.esua.epdc.excel.KpiMetaDataExcel; +import com.elink.esua.epdc.service.KpiMetaDataService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 绩效考核的元数据 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-12-16 + */ +@RestController +@RequestMapping("kpimetadata") +public class KpiMetaDataController { + + @Autowired + private KpiMetaDataService kpiMetaDataService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = kpiMetaDataService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + KpiMetaDataDTO data = kpiMetaDataService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody KpiMetaDataDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + kpiMetaDataService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody KpiMetaDataDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + kpiMetaDataService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + kpiMetaDataService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = kpiMetaDataService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, KpiMetaDataExcel.class); + } + + /*** + * 构建元数据 + * @param + * @return void + * @author qushutong + * @date 2019/12/16 10:17 + */ + @GetMapping("buildMetaData") + public void buildMetaData(){ + + } + +} \ 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/dao/KpiMetaDataDao.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/KpiMetaDataDao.java new file mode 100644 index 000000000..ef6e7eb11 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/dao/KpiMetaDataDao.java @@ -0,0 +1,33 @@ +/** + * 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.entity.KpiMetaDataEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 绩效考核的元数据 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-12-16 + */ +@Mapper +public interface KpiMetaDataDao extends BaseDao { + +} \ 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/entity/KpiMetaDataEntity.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/entity/KpiMetaDataEntity.java new file mode 100644 index 000000000..0116d548a --- /dev/null +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/entity/KpiMetaDataEntity.java @@ -0,0 +1,77 @@ +/** + * 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.math.BigDecimal; +import java.util.Date; + +/** + * 绩效考核的元数据 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-12-16 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_kpi_meta_data") +public class KpiMetaDataEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 数据项编码 + */ + private String dataCode; + + /** + * 数据项名称 + */ + private String dataName; + + /** + * 元数据值 + */ + private BigDecimal dataValue; + + /** + * 考核周期(字典值 代表月,季,年) + */ + private String kpiCycle; + + /** + * 考核周期开始日 + */ + private Date startDate; + + /** + * 考核周期结束日 + */ + private Date endDate; + + /** + * 部门ID + */ + private Long deptId; + +} \ 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/excel/KpiMetaDataExcel.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/excel/KpiMetaDataExcel.java new file mode 100644 index 000000000..c1e27f67a --- /dev/null +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/excel/KpiMetaDataExcel.java @@ -0,0 +1,78 @@ +/** + * 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.math.BigDecimal; +import java.util.Date; + +/** + * 绩效考核的元数据 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-12-16 + */ +@Data +public class KpiMetaDataExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "数据项编码") + private String dataCode; + + @Excel(name = "数据项名称") + private String dataName; + + @Excel(name = "元数据值") + private BigDecimal dataValue; + + @Excel(name = "考核周期(字典值 代表月,季,年)") + private String kpiCycle; + + @Excel(name = "考核周期开始日") + private Date startDate; + + @Excel(name = "考核周期结束日") + private Date endDate; + + @Excel(name = "部门ID") + private Long deptId; + + @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; + + +} \ 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/feign/AdminFeignClient.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/feign/AdminFeignClient.java index 1c7d950a8..8642a823d 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 @@ -55,4 +55,15 @@ public interface AdminFeignClient { **/ @GetMapping("/sys/dept/{id}") Result getSysDeptDTO(@PathVariable("id") Long id); + + + /*** + * 查询所有网格 + * @param + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author qushutong + * @date 2019/12/12 17:16 + */ + @GetMapping("/sys/dept/listAllGridId") + Result> listAllGridId(); } diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/feign/EventFeignClient.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/feign/EventFeignClient.java index c061f68bd..02bcd5ce8 100644 --- a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/feign/EventFeignClient.java +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/feign/EventFeignClient.java @@ -2,12 +2,15 @@ package com.elink.esua.epdc.feign; import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.EventCountFromDTO; +import com.elink.esua.epdc.dto.KpiMetaDataDTO; import com.elink.esua.epdc.dto.category.form.CategoryInfoFormDTO; import com.elink.esua.epdc.dto.category.result.CategoryInfoResultDTO; import com.elink.esua.epdc.feign.fallback.EventFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; import java.util.List; @@ -28,4 +31,15 @@ public interface EventFeignClient { **/ @GetMapping(value = "events/category/queryCategoryInfo", consumes = MediaType.APPLICATION_JSON_VALUE) Result> queryCategoryInfo(CategoryInfoFormDTO categoryInfoFormDTO); + + /*** + * 事件提交总数(群众反应问题总数) + * @param eventCountFromDto + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author qushutong + * @date 2019/12/16 13:54 + */ + @PostMapping(value = "events/epdcevents/getAllCommitCount", consumes = MediaType.APPLICATION_JSON_VALUE) + Result> getAllCommitCount(EventCountFromDTO eventCountFromDto); + } diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/feign/fallback/AdminFeignClientFallback.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/feign/fallback/AdminFeignClientFallback.java index 5062da0bf..a9be3bfcf 100644 --- a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/feign/fallback/AdminFeignClientFallback.java +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/feign/fallback/AdminFeignClientFallback.java @@ -55,4 +55,16 @@ public class AdminFeignClientFallback implements AdminFeignClient { return ModuleUtils.feignConError(ServiceConstant.EPDC_ADMIN_SERVER, "getSysDeptDTO", id); } + /*** + * 获取所有网格 + * @param + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @author qushutong + * @date 2019/12/12 19:03 + */ + @Override + public Result> listAllGridId() { + return ModuleUtils.feignConError(ServiceConstant.EPDC_ADMIN_SERVER, "listAllGridId","1"); + } + } diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/feign/fallback/EventFeignClientFallback.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/feign/fallback/EventFeignClientFallback.java index 8c83f4f01..11c2f2279 100644 --- a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/feign/fallback/EventFeignClientFallback.java +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/feign/fallback/EventFeignClientFallback.java @@ -3,6 +3,8 @@ package com.elink.esua.epdc.feign.fallback; import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; import com.elink.esua.epdc.commons.tools.utils.ModuleUtils; import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.EventCountFromDTO; +import com.elink.esua.epdc.dto.KpiMetaDataDTO; import com.elink.esua.epdc.dto.category.form.CategoryInfoFormDTO; import com.elink.esua.epdc.dto.category.result.CategoryInfoResultDTO; import com.elink.esua.epdc.feign.EventFeignClient; @@ -22,4 +24,9 @@ public class EventFeignClientFallback implements EventFeignClient { public Result> queryCategoryInfo(CategoryInfoFormDTO categoryInfoFormDTO) { return ModuleUtils.feignConError(ServiceConstant.EPDC_EVENTS_SERVER, "queryCategoryInfo", categoryInfoFormDTO); } + + @Override + public Result> getAllCommitCount( EventCountFromDTO eventCountFromDto) { + return ModuleUtils.feignConError(ServiceConstant.EPDC_EVENTS_SERVER, "getAllCommitCount", eventCountFromDto); + } } diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/redis/KpiMetaDataRedis.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/redis/KpiMetaDataRedis.java new file mode 100644 index 000000000..0ef6cb409 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/redis/KpiMetaDataRedis.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 qu qu@elink-cn.com + * @since v1.0.0 2019-12-16 + */ +@Component +public class KpiMetaDataRedis { + @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/KpiMetaDataService.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/KpiMetaDataService.java new file mode 100644 index 000000000..466d9eb43 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/KpiMetaDataService.java @@ -0,0 +1,104 @@ +/** + * 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.dto.KpiMetaDataDTO; +import com.elink.esua.epdc.entity.KpiMetaDataEntity; + +import java.util.List; +import java.util.Map; + +/** + * 绩效考核的元数据 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-12-16 + */ +public interface KpiMetaDataService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2019-12-16 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2019-12-16 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return KpiMetaDataDTO + * @author generator + * @date 2019-12-16 + */ + KpiMetaDataDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2019-12-16 + */ + void save(KpiMetaDataDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2019-12-16 + */ + void update(KpiMetaDataDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2019-12-16 + */ + void delete(String[] ids); + + /*** + * 构建元素数据 + * @param + * @return void + * @author qushutong + * @date 2019/12/16 10:19 + */ + void createMataData(); +} \ 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/impl/KpiMetaDataServiceImpl.java b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/KpiMetaDataServiceImpl.java new file mode 100644 index 000000000..0e6f7e09e --- /dev/null +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/java/com/elink/esua/epdc/service/impl/KpiMetaDataServiceImpl.java @@ -0,0 +1,137 @@ +/** + * 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 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.NumConstant; +import com.elink.esua.epdc.commons.tools.page.PageData; +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.Result; +import com.elink.esua.epdc.dao.KpiMetaDataDao; +import com.elink.esua.epdc.dto.EventCountFromDTO; +import com.elink.esua.epdc.dto.KpiMetaDataDTO; +import com.elink.esua.epdc.entity.KpiMetaDataEntity; +import com.elink.esua.epdc.feign.AdminFeignClient; +import com.elink.esua.epdc.feign.EventFeignClient; +import com.elink.esua.epdc.redis.KpiMetaDataRedis; +import com.elink.esua.epdc.service.KpiMetaDataService; +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 java.time.Month; +import java.time.Period; +import java.time.YearMonth; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 绩效考核的元数据 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-12-16 + */ +@Service +public class KpiMetaDataServiceImpl extends BaseServiceImpl implements KpiMetaDataService { + + @Autowired + private KpiMetaDataRedis kpiMetaDataRedis; + + @Autowired + private AdminFeignClient adminFeignClient; + + @Autowired + private EventFeignClient eventFeignClient; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, KpiMetaDataDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, KpiMetaDataDTO.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 KpiMetaDataDTO get(String id) { + KpiMetaDataEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, KpiMetaDataDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(KpiMetaDataDTO dto) { + KpiMetaDataEntity entity = ConvertUtils.sourceToTarget(dto, KpiMetaDataEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(KpiMetaDataDTO dto) { + KpiMetaDataEntity entity = ConvertUtils.sourceToTarget(dto, KpiMetaDataEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public void createMataData() { + // 获取所有网格 + Result> listResult = adminFeignClient.listAllGridId(); + if (listResult == null && listResult.getData() == null) { + throw new RuntimeException("获取网格列表失败"); + } + List gridList = listResult.getData(); + EventCountFromDTO eventCountFromDto = new EventCountFromDTO(); + eventCountFromDto.setGridIdList(gridList); + // 0 查询总数 + eventCountFromDto.setResponseType(NumConstant.ZERO_STR); + //获取事件 群众反映问题总数(事件提交总数) + Result> allCommitCount = eventFeignClient.getAllCommitCount(eventCountFromDto); + List data = allCommitCount.getData(); + List mataDataEntityList = ConvertUtils.sourceToTarget(data, KpiMetaDataEntity.class); + insertBatch(mataDataEntityList); + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/KpiMetaDataDao.xml b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/KpiMetaDataDao.xml new file mode 100644 index 000000000..ef241fe8a --- /dev/null +++ b/esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/src/main/resources/mapper/KpiMetaDataDao.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/renren-cloud-generator/src/main/resources/application.yml b/renren-cloud-generator/src/main/resources/application.yml index dc0f5909f..91fe3458c 100644 --- a/renren-cloud-generator/src/main/resources/application.yml +++ b/renren-cloud-generator/src/main/resources/application.yml @@ -9,7 +9,7 @@ spring: type: com.alibaba.druid.pool.DruidDataSource #MySQL配置 driverClassName: com.mysql.jdbc.Driver - url: jdbc:mysql://47.104.224.45:3308/esua_epdc_group?useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://47.104.224.45:3308/esua_epdc_kpi?useUnicode=true&characterEncoding=UTF-8&useSSL=false username: epdc password: elink833066 #oracle配置 diff --git a/renren-cloud-generator/src/main/resources/generator.properties b/renren-cloud-generator/src/main/resources/generator.properties index 7cdad8a6b..9e9f68440 100644 --- a/renren-cloud-generator/src/main/resources/generator.properties +++ b/renren-cloud-generator/src/main/resources/generator.properties @@ -3,7 +3,7 @@ main= #\u5305\u540D package=com.elink.esua.epdc -moduleName=news +moduleName=kpi #\u4F5C\u8005 author=qu #\u7248\u672C\u53F7