Browse Source

分类饼1

dev
yinzuomei 3 years ago
parent
commit
5a182abf8a
  1. 3
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java
  2. 7
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java
  3. 7
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProjectCategoryDictController.java
  4. 2
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProjectCategoryDictService.java
  5. 9
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java
  6. 68
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IcEventCategoryAnalysisFormDTO.java
  7. 21
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventCategoryAnalysisResDTO.java
  8. 20
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java
  9. 15
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/IcEventDao.java
  10. 13
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventService.java
  11. 37
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java
  12. 24
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml

3
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java

@ -385,4 +385,7 @@ public interface GovIssueOpenFeignClient {
*/
@PostMapping("/gov/issue/issue/audit-reset")
Result<Boolean> issueAuditReset(@RequestParam("gridId")String gridId);
@PostMapping(value = "/gov/issue/issueprojectcategorydict/first/{customerId}")
Result<List<IssueProjectCategoryDictDTO>> queryFirstCategory(@PathVariable("customerId") String customerId);
}

7
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java

@ -321,4 +321,11 @@ public class GovIssueOpenFeignClientFallBack implements GovIssueOpenFeignClient
public Result<Boolean> issueAuditReset(String gridId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "issueAuditReset", gridId);
}
@Override
public Result<List<IssueProjectCategoryDictDTO>> queryFirstCategory(String customerId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "queryFirstCategory", customerId);
}
}

7
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProjectCategoryDictController.java

@ -299,5 +299,12 @@ public class IssueProjectCategoryDictController {
return new Result<Map<String, String>>().ok(issueProjectCategoryDictService.getCategoryMap(customerId));
}
@PostMapping("first/{customerId}")
public Result<List<IssueProjectCategoryDictDTO>> queryFirstCategory(@PathVariable("customerId") String customerId) {
List<IssueProjectCategoryDictDTO> list = issueProjectCategoryDictService.queryFirstCategory(customerId);
return new Result<List<IssueProjectCategoryDictDTO>>().ok(list);
}
}

2
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProjectCategoryDictService.java

@ -231,4 +231,6 @@ public interface IssueProjectCategoryDictService extends BaseService<IssueProjec
Map<String, String> getCategoryMap(String customerId);
List<IssueProjectCategoryDictDTO> queryFirstCategory(String customerId);
}

9
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java

@ -540,4 +540,13 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl<IssuePr
}
return r.toString().substring(NumConstant.ZERO,r.length()-NumConstant.ONE);
}
@Override
public List<IssueProjectCategoryDictDTO> queryFirstCategory(String customerId) {
List<CategoryListResultDTO> list=baseDao.selectCategoryOneLevelListByCustomerId(customerId);
if(CollectionUtils.isEmpty(list)){
return new ArrayList<>();
}
return ConvertUtils.sourceToTarget(list,IssueProjectCategoryDictDTO.class);
}
}

68
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IcEventCategoryAnalysisFormDTO.java

@ -0,0 +1,68 @@
package com.epmet.dto.form;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* 社区治理可视化分析
* 事件分类分析-饼1入参
*/
@Data
public class IcEventCategoryAnalysisFormDTO {
/**
* 处理状态比例查询
*/
public interface TotalPie {
}
/**
* 要查询的组织ID
*/
@NotBlank(message = "组织ID为必填项", groups = {IcEventCategoryAnalysisFormDTO.TotalPie.class})
private String orgId;
/**
* 组织类型grid,agency
*/
@NotBlank(message = "组织类型为必填项", groups = {IcEventCategoryAnalysisFormDTO.TotalPie.class})
private String orgType;
/**
* 查询起始时间 yyyy-MM-dd
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@NotNull(message = "查询时间为必填项", groups = {IcEventCategoryAnalysisFormDTO.TotalPie.class})
private Date queryStartTime;
/**
* 查询截止时间 yyyy-MM-dd
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@NotNull(message = "查询时间为必填项", groups = {IcEventCategoryAnalysisFormDTO.TotalPie.class})
private Date queryEndTime;
/**
* 一级分类 code长度
*/
private Integer categoryOneLength;
//以下参数从token中获取
/**
* 当前登录用户
*/
private String staffId;
/**
* 当前客户id
*/
private String customerId;
}

21
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventCategoryAnalysisResDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* 社区治理可视化分析
* 事件分类分析-饼1
*/
@Data
public class IcEventCategoryAnalysisResDTO implements Serializable {
//一级分类Code
private String categoryCode;
//一级分类名称
private String categoryName;
//一级分类颜色
private String color = "";
//分类下项目总数
private Integer total = 0;
}

20
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java

@ -14,10 +14,7 @@ import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.IcEventDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.IcEventListResultDTO;
import com.epmet.dto.result.IcEventMonthlyIncrementResultDTO;
import com.epmet.dto.result.IcEventResultDTO;
import com.epmet.dto.result.ProcessStatusRatioResultDTO;
import com.epmet.dto.result.*;
import com.epmet.service.IcEventService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -153,6 +150,21 @@ public class IcEventController {
return new Result();
}
/**
* 事件分类分析-一级分类下事件数量
*
* @param formDTO
* @return
*/
@PostMapping("category-analysis/total")
public Result<List<IcEventCategoryAnalysisResDTO>> categoryAnalysisTotal(@LoginUser TokenDto tokenDto, @RequestBody IcEventCategoryAnalysisFormDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setStaffId(tokenDto.getUserId());
List<IcEventCategoryAnalysisResDTO> list = icEventService.categoryAnalysisTotal(formDTO);
return new Result<List<IcEventCategoryAnalysisResDTO>>().ok(list);
}
}

15
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/IcEventDao.java

@ -1,12 +1,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.IcEventMonthlyCountResultDTO;
import com.epmet.dto.result.IcEventMonthlyIncrementResultDTO;
import com.epmet.dto.form.IcEventCategoryAnalysisFormDTO;
import com.epmet.dto.form.IcEventListFormDTO;
import com.epmet.dto.result.IcEventCategoryAnalysisResDTO;
import com.epmet.dto.result.IcEventListResultDTO;
import com.epmet.dto.result.IcEventMonthlyCountResultDTO;
import com.epmet.dto.result.IcEventResultDTO;
import com.epmet.dto.result.ProcessStatusRatioResultDTO;
import com.epmet.entity.IcEventEntity;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
@ -16,8 +16,6 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.List;
/**
* 事件管理表
*
@ -78,4 +76,11 @@ public interface IcEventDao extends BaseDao<IcEventEntity> {
@Param("gridPids") String gridPids,
@Param("queryStartTime") Date queryStartTime,
@Param("queryEndTime") Date queryEndTime);
/**
*
* @param formDTO
* @return
*/
List<IcEventCategoryAnalysisResDTO> selectFirstCategoryTotal(IcEventCategoryAnalysisFormDTO formDTO);
}

13
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventService.java

@ -4,12 +4,10 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcEventDTO;
import com.epmet.dto.form.IcEventAddEditFormDTO;
import com.epmet.dto.form.IcEventCategoryAnalysisFormDTO;
import com.epmet.dto.form.IcEventListFormDTO;
import com.epmet.dto.form.IcEventReplyFormDTO;
import com.epmet.dto.result.IcEventListResultDTO;
import com.epmet.dto.result.IcEventMonthlyIncrementResultDTO;
import com.epmet.dto.result.IcEventResultDTO;
import com.epmet.dto.result.ProcessStatusRatioResultDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.IcEventEntity;
import java.util.Date;
@ -106,4 +104,11 @@ public interface IcEventService extends BaseService<IcEventEntity> {
* @Description 事件管理-回复
**/
void reply(IcEventReplyFormDTO formDTO);
/**
* 事件分类分析-一级分类下事件数量
* @param formDTO
* @return
*/
List<IcEventCategoryAnalysisResDTO> categoryAnalysisTotal(IcEventCategoryAnalysisFormDTO formDTO);
}

37
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java

@ -21,14 +21,11 @@ import com.epmet.commons.tools.scan.param.ImgTaskDTO;
import com.epmet.commons.tools.scan.param.TextScanParamDTO;
import com.epmet.commons.tools.scan.param.TextTaskDTO;
import com.epmet.commons.tools.scan.result.SyncScanResult;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.EpmetRequestHolder;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.ScanContentUtils;
import com.epmet.commons.tools.utils.*;
import com.epmet.dao.IcEventDao;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.IcEventDTO;
import com.epmet.dto.IssueProjectCategoryDictDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.form.demand.DemandRecId;
import com.epmet.dto.result.*;
@ -42,6 +39,7 @@ import com.epmet.resi.group.constant.TopicConstant;
import com.epmet.service.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -53,6 +51,7 @@ import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@ -61,6 +60,7 @@ import java.util.stream.Collectors;
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-05-17
*/
@Slf4j
@Service
public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntity> implements IcEventService, ResultDataResolver {
@ -581,4 +581,31 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
}
/**
* 事件分类分析-一级分类下事件数量
*
* @param formDTO
* @return
*/
@Override
public List<IcEventCategoryAnalysisResDTO> categoryAnalysisTotal(IcEventCategoryAnalysisFormDTO formDTO) {
//1.查询客户下一级分类信息
Result<List<IssueProjectCategoryDictDTO>> res = govIssueOpenFeignClient.queryFirstCategory(formDTO.getCustomerId());
if (!res.success() || CollectionUtils.isEmpty(res.getData())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "当前客户下未配置事件分类");
}
int length = res.getData().get(NumConstant.ZERO).getCategoryCode().length();
formDTO.setCategoryOneLength(length);
List<IcEventCategoryAnalysisResDTO> resList = baseDao.selectFirstCategoryTotal(formDTO);
Map<String, IcEventCategoryAnalysisResDTO> resMap = resList.stream().collect(Collectors.toMap(IcEventCategoryAnalysisResDTO::getCategoryCode, Function.identity()));
List<IcEventCategoryAnalysisResDTO> result = new ArrayList<>();
for (IssueProjectCategoryDictDTO dict : res.getData()) {
IcEventCategoryAnalysisResDTO resultDto = ConvertUtils.sourceToTarget(dict, IcEventCategoryAnalysisResDTO.class);
resultDto.setTotal(MapUtils.isNotEmpty(resMap) && resMap.containsKey(dict.getCategoryCode()) ? resMap.get(dict.getCategoryCode()).getTotal() : NumConstant.ZERO);
result.add(resultDto);
}
return result;
}
}

24
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml

@ -141,5 +141,27 @@
order by ie.latest_operated_time desc, rea.sort asc
</select>
<select id="selectFirstCategoryTotal" parameterType="com.epmet.dto.form.IcEventCategoryAnalysisFormDTO" resultType="com.epmet.dto.result.IcEventCategoryAnalysisResDTO">
SELECT LEFT
( c.CATEGORY_CODE, #{categoryOneLength} ) CATEGORY_CODE,
COUNT( DISTINCT c.IC_EVENT_ID ) total
FROM
ic_event_category c
LEFT JOIN ic_event e ON ( c.IC_EVENT_ID = e.ID AND e.DEL_FLAG = '0' )
WHERE
c.DEL_FLAG = '0'
AND c.CUSTOMER_ID = #{customerId}
and e.HAPPEN_TIME >= #{queryStartTime}
and e.HAPPEN_TIME <![CDATA[<=]]> #{queryEndTime}
<if test="orgType == 'agency'">
and e.GRID_PIDS like CONCAT(#{gridPids},'%')
</if>
<if test="orgType == 'grid'">
and e.GRID_ID=#{orgId}
</if>
GROUP BY
LEFT ( c.CATEGORY_CODE, #{categoryOneLength} )
ORDER BY
total DESC
</select>
</mapper>
Loading…
Cancel
Save