Browse Source

Merge remote-tracking branch 'origin/dev'

master
yinzuomei 4 years ago
parent
commit
ba5d610a1a
  1. 36
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/screen/ColorProjectTotalFormDTO.java
  2. 27
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/screen/StreetDetailPYFormDTO.java
  3. 48
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/ColorProjectTotalResultDTO.java
  4. 50
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/StreetDetailPYResultDTO.java
  5. 38
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PyController.java
  6. 23
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java
  7. 17
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java
  8. 17
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserTotalDataDao.java
  9. 21
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/PyService.java
  10. 10
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenProjectService.java
  11. 51
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PyServiceImpl.java
  12. 36
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java
  13. 45
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml
  14. 28
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserTotalDataDao.xml
  15. 29
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/OrgStaffDTO.java
  16. 6
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserTotalDataFormDTO.java
  17. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  18. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java
  19. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java
  20. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserTotalDataEntity.java
  21. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java
  22. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java
  23. 29
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java
  24. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java
  25. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java
  26. 4
      epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.19__add_gridMemberToalColumn.sql
  27. 4
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserTotalDataDao.xml
  28. 32
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml
  29. 25
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml

36
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/screen/ColorProjectTotalFormDTO.java

@ -0,0 +1,36 @@
package com.epmet.dto.form.screen;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/6/1 3:11 下午
* @DESC
*/
@Data
public class ColorProjectTotalFormDTO implements Serializable {
private static final long serialVersionUID = -6991770717583778665L;
public interface ColorProjectTotalForm{}
/**
* 组织id
*/
@NotBlank(message = "组织ID不能为空",groups = ColorProjectTotalForm.class)
private String agencyId;
/**
* 行政区域码平阴必填
*/
private String areaCode;
/**
* 绿灯事件查询几个月的数据
*/
private Integer monthCount = NumConstant.ONE;
}

27
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/screen/StreetDetailPYFormDTO.java

@ -0,0 +1,27 @@
package com.epmet.dto.form.screen;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/6/2 9:42 上午
* @DESC
*/
@Data
public class StreetDetailPYFormDTO implements Serializable {
private static final long serialVersionUID = -4821168326488796711L;
public interface StreetDetailPYForm{}
@NotBlank(message = "组织ID不能为空",groups = StreetDetailPYForm.class)
private String agencyId;
/**
* 行政区域编码 平阴必填
*/
private String areaCode;
}

48
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/ColorProjectTotalResultDTO.java

@ -0,0 +1,48 @@
package com.epmet.dto.result.screen;
import com.epmet.commons.tools.constant.NumConstant;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/6/1 3:15 下午
* @DESC
*/
@Data
public class ColorProjectTotalResultDTO implements Serializable {
private static final long serialVersionUID = -8211214262766797296L;
/**
* 事件总数
*/
private Integer projectTotal;
/**
* 红灯事件总数
*/
private Integer redTotal;
/**
* 黄灯事件总数
*/
private Integer yellowTotal;
/**
* 绿灯事件总数
*/
private Integer greenTotal;
@JsonIgnore
private Integer projectLevel;
public ColorProjectTotalResultDTO() {
this.projectTotal = NumConstant.ZERO;
this.redTotal = NumConstant.ZERO;
this.yellowTotal = NumConstant.ZERO;
this.greenTotal = NumConstant.ZERO;
}
}

50
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/StreetDetailPYResultDTO.java

@ -0,0 +1,50 @@
package com.epmet.dto.result.screen;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/6/2 9:43 上午
* @DESC
*/
@Data
public class StreetDetailPYResultDTO implements Serializable {
private static final long serialVersionUID = 663001974527694466L;
/**
* 组织id
*/
private String agencyId;
/**
* 组织名称
*/
private String agencyName;
/**
* 注册党员数
*/
private Integer partyMemberTotal;
/**
* 网格总数
*/
private Integer gridTotal;
/**
* 网格员数
*/
private Integer gridMemberTotal;
public StreetDetailPYResultDTO() {
this.partyMemberTotal = NumConstant.ZERO;
this.gridTotal = NumConstant.ZERO;
this.gridMemberTotal = NumConstant.ZERO;
this.agencyId = "";
this.agencyName = "";
}
}

38
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PyController.java

@ -0,0 +1,38 @@
package com.epmet.datareport.controller.screen;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.evaluationindex.screen.PyService;
import com.epmet.dto.form.screen.StreetDetailPYFormDTO;
import com.epmet.dto.result.screen.StreetDetailPYResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author zxc
* @DateTime 2021/6/2 9:40 上午
* @DESC
*/
@RestController
@RequestMapping("pyscreen")
public class PyController {
@Autowired
private PyService pyService;
/**
* @Description 街道注册党员数网格数网格员数
* @Param formDTO
* @author zxc
* @date 2021/6/2 10:07 上午
*/
@PostMapping("streetdetail-py")
public Result<StreetDetailPYResultDTO> streetDetail(@RequestBody StreetDetailPYFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, StreetDetailPYFormDTO.StreetDetailPYForm.class);
return new Result<StreetDetailPYResultDTO>().ok(pyService.streetDetail(formDTO));
}
}

23
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java

@ -5,14 +5,8 @@ import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectOrgDailyService;
import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectQuantityOrgMonthlyService;
import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectService;
import com.epmet.dto.form.screen.CategoryAnalysisFormDTO;
import com.epmet.dto.form.screen.EfficiencyAnalysisFormDTO;
import com.epmet.dto.form.screen.QueryQuantityMonthlyFormDTO;
import com.epmet.dto.form.screen.ScreenCommonFormDTO;
import com.epmet.dto.result.screen.CategoryAnalysisResultDTO;
import com.epmet.dto.result.screen.EfficiencyAnalysisResultDTO;
import com.epmet.dto.result.screen.ProjectQuantityResultDTO;
import com.epmet.dto.result.screen.QueryQuantityMonthlyResultDTO;
import com.epmet.dto.form.screen.*;
import com.epmet.dto.result.screen.*;
import com.epmet.evaluationindex.screen.dto.form.ProjectDetailFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDetailFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDistributionFormDTO;
@ -132,4 +126,17 @@ public class ScreenProjectController {
ValidatorUtils.validateEntity(formDTO, CategoryAnalysisFormDTO.CategoryAnalysis.class);
return new Result<List<CategoryAnalysisResultDTO>>().ok(screenProjectService.categoryAnalysis(customerId, formDTO));
}
/**
* @Description 红黄绿事件总数
* @Param formDTO
* @author zxc
* @date 2021/6/1 3:20 下午
*/
@PostMapping("colorprojectotal")
public Result<ColorProjectTotalResultDTO> colorProjectTotal(@RequestBody ColorProjectTotalFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, ColorProjectTotalFormDTO.ColorProjectTotalForm.class);
return new Result<ColorProjectTotalResultDTO>().ok(screenProjectService.colorProjectTotal(formDTO));
}
}

17
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java

@ -1,5 +1,6 @@
package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.dto.result.screen.ColorProjectTotalResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDetailResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDistributionResultDTO;
import org.apache.ibatis.annotations.Mapper;
@ -28,4 +29,20 @@ public interface ScreenProjectDataDao {
List<ScreenProjectDetailResultDTO.processDTO.AttachmentDTO> selectProjectProcessAttachments(@Param("processId") String processId,
@Param("projectId") String projectId,
@Param("customerId") String customerId);
/**
* @Description 根据agencyId查询事件
* @Param agencyId
* @author zxc
* @date 2021/6/1 3:48 下午
*/
List<ColorProjectTotalResultDTO> selectColorProjectByAgencyId(@Param("agencyId") String agencyId,@Param("monthCount")Integer monthCount);
/**
* @Description 根据areaCode查询事件
* @Param agencyId
* @author zxc
* @date 2021/6/1 3:48 下午
*/
List<ColorProjectTotalResultDTO> selectColorProjectByAreaCode(@Param("areaCode") String areaCode,@Param("monthCount")Integer monthCount);
}

17
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserTotalDataDao.java

@ -17,6 +17,7 @@
package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.dto.result.screen.StreetDetailPYResultDTO;
import com.epmet.evaluationindex.screen.dto.result.PartymemberPercentResultDTO;
import com.epmet.evaluationindex.screen.dto.result.TopProfileResultDTO;
import org.apache.ibatis.annotations.Mapper;
@ -60,4 +61,20 @@ public interface ScreenUserTotalDataDao {
int selectAvgIssue(@Param("agencyId")String agencyId);
PartymemberPercentResultDTO selectAgencyPartymemberPercentByIds(@Param("orgIds") List<String> orgIds);
/**
* @Description 根据组织ID查询街道详情
* @Param agencyId
* @author zxc
* @date 2021/6/2 10:38 上午
*/
StreetDetailPYResultDTO selectStreetDetailByAgencyId(@Param("agencyId")String agencyId);
/**
* @Description 根据组织编码查询街道详情
* @Param agencyId
* @author zxc
* @date 2021/6/2 10:38 上午
*/
StreetDetailPYResultDTO selectStreetDetailByAreaCode(@Param("areaCode")String areaCode);
}

21
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/PyService.java

@ -0,0 +1,21 @@
package com.epmet.datareport.service.evaluationindex.screen;
import com.epmet.dto.form.screen.StreetDetailPYFormDTO;
import com.epmet.dto.result.screen.StreetDetailPYResultDTO;
/**
* @Author zxc
* @DateTime 2021/6/2 10:05 上午
* @DESC
*/
public interface PyService {
/**
* @Description 街道注册党员数网格数网格员数
* @Param formDTO
* @author zxc
* @date 2021/6/2 10:07 上午
*/
StreetDetailPYResultDTO streetDetail(StreetDetailPYFormDTO formDTO);
}

10
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenProjectService.java

@ -2,7 +2,9 @@ package com.epmet.datareport.service.evaluationindex.screen;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.screen.CategoryAnalysisFormDTO;
import com.epmet.dto.form.screen.ColorProjectTotalFormDTO;
import com.epmet.dto.result.screen.CategoryAnalysisResultDTO;
import com.epmet.dto.result.screen.ColorProjectTotalResultDTO;
import com.epmet.evaluationindex.screen.dto.form.ProjectDetailFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDetailFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDistributionFormDTO;
@ -40,4 +42,12 @@ public interface ScreenProjectService {
List<ScreenProjectDistributionResultDTO> projectDistribution(ScreenProjectDistributionFormDTO formDTO);
Result projectDistributionDetail(ScreenProjectDetailFormDTO formDTO);
/**
* @Description 红黄绿事件总数
* @Param formDTO
* @author zxc
* @date 2021/6/1 3:20 下午
*/
ColorProjectTotalResultDTO colorProjectTotal(ColorProjectTotalFormDTO formDTO);
}

51
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PyServiceImpl.java

@ -0,0 +1,51 @@
package com.epmet.datareport.service.evaluationindex.screen.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenUserTotalDataDao;
import com.epmet.datareport.service.evaluationindex.screen.PyService;
import com.epmet.dto.form.screen.StreetDetailPYFormDTO;
import com.epmet.dto.result.screen.StreetDetailPYResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @Author zxc
* @DateTime 2021/6/2 10:05 上午
* @DESC
*/
@Slf4j
@Service
@DataSource(DataSourceConstant.EVALUATION_INDEX)
public class PyServiceImpl implements PyService {
@Autowired
private ScreenUserTotalDataDao screenUserTotalDataDao;
/**
* @Description 街道注册党员数网格数网格员数
* @Param formDTO
* @author zxc
* @date 2021/6/2 10:07 上午
*/
@Override
public StreetDetailPYResultDTO streetDetail(StreetDetailPYFormDTO formDTO) {
StreetDetailPYResultDTO result = new StreetDetailPYResultDTO();
if (StringUtils.isEmpty(formDTO.getAreaCode())){
result = screenUserTotalDataDao.selectStreetDetailByAgencyId(formDTO.getAgencyId());
}else {
StreetDetailPYResultDTO eightStreet = screenUserTotalDataDao.selectStreetDetailByAreaCode(formDTO.getAreaCode());
result = screenUserTotalDataDao.selectStreetDetailByAgencyId(formDTO.getAgencyId());
if (null == result){
throw new RenException("组织ID【"+formDTO.getAgencyId()+"】不存在于screen_customer_agency");
}
result.setGridMemberTotal(result.getGridMemberTotal() + eightStreet.getGridMemberTotal());
result.setPartyMemberTotal(result.getPartyMemberTotal() + eightStreet.getPartyMemberTotal());
result.setGridTotal(result.getGridTotal() + eightStreet.getGridTotal());
}
return result;
}
}

36
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java

@ -11,7 +11,9 @@ import com.epmet.datareport.dao.evaluationindex.screen.ScreenProjectCategoryOrgD
import com.epmet.datareport.dao.evaluationindex.screen.ScreenProjectDataDao;
import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectService;
import com.epmet.dto.form.screen.CategoryAnalysisFormDTO;
import com.epmet.dto.form.screen.ColorProjectTotalFormDTO;
import com.epmet.dto.result.screen.CategoryAnalysisResultDTO;
import com.epmet.dto.result.screen.ColorProjectTotalResultDTO;
import com.epmet.evaluationindex.screen.dto.form.ProjectDetailFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDetailFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDistributionFormDTO;
@ -28,6 +30,8 @@ import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 项目
@ -73,6 +77,7 @@ public class ScreenProjectServiceImpl implements ScreenProjectService {
/**
* @Description 中央区事件分析-项目分布
* 2021-06-03 修改查询红黄绿事件事件范围为一个月
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author liushaowen
@ -149,4 +154,35 @@ public class ScreenProjectServiceImpl implements ScreenProjectService {
}
return resultList;
}
/**
* @Description 红黄绿事件总数
* 红黄绿事件均查询1个月以内的
* 可以添加传参 monthCount查询几个月的绿色事件
* @Param formDTO
* @author zxc
* @date 2021/6/1 3:20 下午
*/
@Override
public ColorProjectTotalResultDTO colorProjectTotal(ColorProjectTotalFormDTO formDTO) {
ColorProjectTotalResultDTO result = new ColorProjectTotalResultDTO();
List<ColorProjectTotalResultDTO> list = new ArrayList<>();
if (StringUtils.isEmpty(formDTO.getAreaCode())){
list = screenProjectDataDao.selectColorProjectByAgencyId(formDTO.getAgencyId(), formDTO.getMonthCount());
}else {
List<ColorProjectTotalResultDTO> colorProjectTotal = screenProjectDataDao.selectColorProjectByAreaCode(formDTO.getAreaCode(), formDTO.getMonthCount());
if (!CollectionUtils.isEmpty(colorProjectTotal)){
list.addAll(colorProjectTotal);
}
}
// 事件级别 红色1级:已超期;黄色2级:即将超期;绿色3级:未超期
if (!CollectionUtils.isEmpty(list)){
Map<Integer, List<ColorProjectTotalResultDTO>> groupByLevel = list.stream().collect(Collectors.groupingBy(ColorProjectTotalResultDTO::getProjectLevel));
result.setRedTotal(CollectionUtils.isEmpty(groupByLevel.get(NumConstant.ONE)) ? NumConstant.ZERO : groupByLevel.get(NumConstant.ONE).size());
result.setYellowTotal(CollectionUtils.isEmpty(groupByLevel.get(NumConstant.TWO)) ? NumConstant.ZERO : groupByLevel.get(NumConstant.TWO).size());
result.setGreenTotal(CollectionUtils.isEmpty(groupByLevel.get(NumConstant.THREE)) ? NumConstant.ZERO : groupByLevel.get(NumConstant.THREE).size());
result.setProjectTotal(list.size());
}
return result;
}
}

45
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml

@ -17,6 +17,7 @@
screen_project_data
WHERE
del_flag = '0'
AND UNIX_TIMESTAMP(CREATED_TIME) >= UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL 1 MONTH))
<if test="level != null and level.trim()!=''">
and project_level = #{level}
</if>
@ -112,4 +113,48 @@
and CUSTOMER_ID= #{customerId}
order by sort asc
</select>
<!-- 根据agencyId查询事件 -->
<select id="selectColorProjectByAgencyId" resultType="com.epmet.dto.result.screen.ColorProjectTotalResultDTO">
SELECT
PROJECT_LEVEL
FROM screen_project_data
WHERE DEL_FLAG = '0'
AND PARENT_ID = #{agencyId}
AND PROJECT_LEVEL != 0
AND UNIX_TIMESTAMP(CREATED_TIME) >= UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL #{monthCount} MONTH))
</select>
<!-- 根据areaCode查询事件 -->
<select id="selectColorProjectByAreaCode" resultType="com.epmet.dto.result.screen.ColorProjectTotalResultDTO">
(SELECT pd.PROJECT_LEVEL
FROM screen_project_data pd
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = pd.ORG_ID
WHERE pd.DEL_FLAG = '0'
AND pd.ORG_TYPE = 'agency'
AND pd.PROJECT_LEVEL != 0
AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%')
AND UNIX_TIMESTAMP(pd.CREATED_TIME) >= UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL #{monthCount} MONTH))
)
UNION ALL
(SELECT pd.PROJECT_LEVEL
FROM screen_project_data pd
LEFT JOIN screen_customer_grid scg ON scg.GRID_ID = pd.ORG_ID
WHERE pd.DEL_FLAG = '0'
AND pd.ORG_TYPE = 'grid'
AND pd.PROJECT_LEVEL != 0
AND scg.AREA_CODE LIKE CONCAT(#{areaCode},'%')
AND UNIX_TIMESTAMP(pd.CREATED_TIME) >= UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL #{monthCount} MONTH))
)
UNION ALL
(SELECT pd.PROJECT_LEVEL
FROM screen_project_data pd
LEFT JOIN screen_customer_dept scd ON scd.DEPT_ID = pd.ORG_ID
WHERE pd.DEL_FLAG = '0'
AND pd.ORG_TYPE = 'department'
AND pd.PROJECT_LEVEL != 0
AND scd.AREA_CODE LIKE CONCAT(#{areaCode},'%')
AND UNIX_TIMESTAMP(pd.CREATED_TIME) >= UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL #{monthCount} MONTH))
)
</select>
</mapper>

28
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserTotalDataDao.xml

@ -82,4 +82,32 @@
ISSUE_TOTAL desc,
PROJECT_TOTAL desc
</select>
<!-- 根据组织ID查询街道详情 -->
<select id="selectStreetDetailByAgencyId" resultType="com.epmet.dto.result.screen.StreetDetailPYResultDTO">
SELECT
td.ORG_ID AS agencyId,
td.ORG_NAME AS agencyName,
IFNULL(td.PARTY_TOTAL,0) AS partyMemberTotal,
IFNULL(td.grid_member_total,0) AS gridMemberTotal,
(SELECT COUNT(ID) FROM screen_customer_grid WHERE DEL_FLAG = '0' AND PARENT_AGENCY_ID = #{agencyId}) AS gridTotal
FROM screen_customer_agency sca
LEFT JOIN screen_user_total_data td ON td.ORG_ID = sca.AGENCY_ID
WHERE td.DEL_FLAG = '0'
AND td.ORG_TYPE = 'agency'
AND sca.AGENCY_ID = #{agencyId}
</select>
<!-- 根据组织编码查询街道详情 【适用平阴】 -->
<select id="selectStreetDetailByAreaCode" resultType="com.epmet.dto.result.screen.StreetDetailPYResultDTO">
SELECT
IFNULL(SUM(td.PARTY_TOTAL),0) AS partyMemberTotal,
IFNULL(SUM(td.grid_member_total),0) AS gridMemberTotal,
(SELECT COUNT(ID) FROM screen_customer_grid WHERE DEL_FLAG = '0' AND AREA_CODE LIKE CONCAT(#{areaCode},'%')) AS gridTotal
FROM screen_user_total_data td
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = td.ORG_ID
WHERE td.DEL_FLAG = '0'
AND sca.PARENT_AREA_CODE = #{areaCode}
AND td.ORG_TYPE = 'agency'
</select>
</mapper>

29
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/OrgStaffDTO.java

@ -0,0 +1,29 @@
package com.epmet.dto.org.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 返回每个网格每个组织下工作人员的userId
*
* @author yinzuomei@elink-cn.com
* @date 2021/6/3 9:49
*/
@Data
public class OrgStaffDTO implements Serializable {
/**
* 组织id或者网格id
*/
private String orgId;
/**
* agency or grid
*/
private String orgType;
/**
* 当前组织或者当前网格下的
*/
private List<String> staffIds;
}

6
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserTotalDataFormDTO.java

@ -64,8 +64,14 @@ public class UserTotalDataFormDTO implements Serializable {
*/
private Integer projectTotal;
/**
* 06.01新增orgType=agency或者grid的时候此列赋值:当前组织或者当前网格内的网格员人数
*/
private Integer gridMemberTotal;
/**
* 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增)
*/
private String dataEndTime;
}

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java

@ -109,6 +109,8 @@ public class DemoController {
private ScreenProjectCategoryGridDailyService projectCategoryGridDailyService;
@Autowired
private FactOriginProjectCategoryDailyService originProjectCategoryDailyService;
@Autowired
private ScreenCentralZoneDataAbsorptionService screenCentralZoneDataAbsorptionService;
@GetMapping("testAlarm")
public void testAlarm() {
@ -870,4 +872,9 @@ public class DemoController {
return new Result().ok(ndddYhjfService.difficultyDataExtract(param));
}
@PostMapping("centralZoneDataHub")
public Result Test(@RequestBody ScreenCentralZoneDataFormDTO param){
screenCentralZoneDataAbsorptionService.centralZoneDataHub(param);
return new Result();
}
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java

@ -3,6 +3,7 @@ package com.epmet.dao.org;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.dto.org.result.CustomerAreaCodeResultDTO;
import com.epmet.dto.org.result.OrgStaffDTO;
import com.epmet.entity.org.CustomerAgencyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -33,4 +34,12 @@ public interface StatsCustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
List<CustomerAreaCodeResultDTO> selectCustomerAreaCodeById(@Param("customerIds") List<String> customerIds);
CustomerAgencyEntity getRootAgencyInfo(String customerId);
/**
* 获取每个组织每个网格下工作人员userId集合
*
* @param customerId
* @return com.epmet.dto.org.result.OrgStaffResultDTO
*/
List<OrgStaffDTO> selectOrgStaffIds(String customerId);
}

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java

@ -141,5 +141,13 @@ public interface UserDao {
* @date 2021.03.08 17:16
*/
List<ScreenProjectDataDTO> selectScreenProjectData(@Param("list") List<ScreenProjectDataDTO> list);
/**
* 根据工作员用户id, 返回这些人当中多少个网格员
*
* @param staffIds
* @return int
*/
int selectGridManagerTotal(@Param("customerId")String customerId,@Param("staffIds")List<String> staffIds);
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserTotalDataEntity.java

@ -95,4 +95,8 @@ public class ScreenUserTotalDataEntity extends BaseEpmetEntity {
*/
private Integer projectTotal;
/**
* 06.01新增orgType=agency或者grid的时候此列赋值:当前组织或者当前网格内的网格员人数
*/
private Integer gridMemberTotal;
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java

@ -1,6 +1,7 @@
package com.epmet.service.org;
import com.epmet.dto.org.result.CustomerAreaCodeResultDTO;
import com.epmet.dto.org.result.OrgStaffDTO;
import com.epmet.entity.org.CustomerAgencyEntity;
import java.util.Date;
@ -20,4 +21,12 @@ public interface CustomerAgencyService {
List<CustomerAreaCodeResultDTO> selectCustomerAreaCodeById(List<String> customerIds);
CustomerAgencyEntity getRootAgencyInfo(String customerId);
/**
* 获取每个组织每个网格下工作人员userId集合
*
* @param customerId
* @return com.epmet.dto.org.result.OrgStaffResultDTO
*/
List<OrgStaffDTO> queryOrgStaffIds(String customerId);
}

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java

@ -4,6 +4,7 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.org.StatsCustomerAgencyDao;
import com.epmet.dto.org.result.CustomerAreaCodeResultDTO;
import com.epmet.dto.org.result.OrgStaffDTO;
import com.epmet.entity.org.CustomerAgencyEntity;
import com.epmet.service.org.CustomerAgencyService;
import org.springframework.beans.factory.annotation.Autowired;
@ -50,4 +51,16 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService {
public CustomerAgencyEntity getRootAgencyInfo(String customerId) {
return customerAgencyDao.getRootAgencyInfo(customerId);
}
/**
* 获取每个组织每个网格下工作人员userId集合
*
* @param customerId
* @return com.epmet.dto.org.result.OrgStaffResultDTO
*/
@Override
public List<OrgStaffDTO> queryOrgStaffIds(String customerId) {
List<OrgStaffDTO> resultList=customerAgencyDao.selectOrgStaffIds(customerId);
return resultList;
}
}

29
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java

@ -4,14 +4,16 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.stats.*;
import com.epmet.dao.stats.FactAgencyProjectDailyDao;
import com.epmet.dao.stats.FactGroupGridDailyDao;
import com.epmet.dao.stats.FactIssueGridDailyDao;
import com.epmet.dao.stats.topic.FactTopicTotalGridDailyDao;
import com.epmet.dao.stats.user.FactRegUserGridDailyDao;
import com.epmet.dto.org.result.OrgStaffDTO;
import com.epmet.entity.evaluationindex.screen.ScreenUserTotalDataEntity;
import com.epmet.service.org.CustomerAgencyService;
import com.epmet.service.stats.ScreenCentralZoneDataExtractService;
import com.epmet.service.user.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -43,7 +45,10 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon
private FactIssueGridDailyDao factIssueGridDailyDao;
@Autowired
private FactAgencyProjectDailyDao factAgencyProjectDailyDao;
@Autowired
private CustomerAgencyService customerAgencyService;
@Autowired
private UserService userService;
private final String ORG_LEVEL_AGENCY = "agency";
private final String ORG_LEVEL_GRID = "grid";
@ -155,6 +160,10 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon
Map<String,Integer> projectMap = agencyProject.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getProjectTotal));
projectMap.putAll(gridProject.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getProjectTotal)));
//For:06.01新增:orgType=agency或者grid的时候,此列赋值:当前组织或者当前网格内的网格员人数
List<OrgStaffDTO> orgStaffDTOList=customerAgencyService.queryOrgStaffIds(customerId);
Map<String,Integer> gridManagerMap=userService.queryOrgGridManager(customerId,orgStaffDTOList);
result.forEach(o -> {
String orgId = o.getOrgId();
Integer count = groupMap.get(orgId);
@ -169,10 +178,14 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon
count = projectMap.get(orgId);
o.setProjectTotal(null == count ? NumConstant.ZERO : count);
o.setDataEndTime(dimId);
});
//For:06.01新增:orgType=agency或者grid的时候,此列赋值:当前组织或者当前网格内的网格员人数
if(gridManagerMap.containsKey(orgId)){
o.setGridMemberTotal(gridManagerMap.get(orgId));
}else{
o.setGridMemberTotal(NumConstant.ZERO);
}
});
return result;
}
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java

@ -2,6 +2,7 @@ package com.epmet.service.user;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.dto.extract.form.GridHeartedFormDTO;
import com.epmet.dto.org.result.OrgStaffDTO;
import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.dto.stats.user.result.UserStatisticalData;
import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity;
@ -84,4 +85,13 @@ public interface UserService {
* @date 2021.03.08 17:16
*/
List<ScreenProjectDataDTO> fillScreenProjectData(List<ScreenProjectDataDTO> list);
/**
* 返回每个组织或者每个网格下的网格员数量
*
* @param customerId
* @param orgStaffDTOList
* @return com.epmet.dto.user.OrgGridManagerTotalDTO
*/
Map<String,Integer> queryOrgGridManager(String customerId,List<OrgStaffDTO> orgStaffDTOList);
}

19
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java

@ -8,6 +8,7 @@ import com.epmet.dao.user.UserDao;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.dto.extract.form.GridHeartedFormDTO;
import com.epmet.dto.extract.result.UserPartyResultDTO;
import com.epmet.dto.org.result.OrgStaffDTO;
import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.dto.stats.user.*;
import com.epmet.dto.stats.user.result.UserStatisticalData;
@ -755,4 +756,22 @@ public class UserServiceImpl implements UserService {
return collection;
}
/**
* 返回每个组织或者每个网格下的网格员数量
*
* @param customerId
* @param orgStaffDTOList
* @return com.epmet.dto.user.OrgGridManagerTotalDTO
*/
@Override
public Map<String,Integer> queryOrgGridManager(String customerId,List<OrgStaffDTO> orgStaffDTOList) {
Map<String,Integer> resultMap=new HashMap<>();
for (OrgStaffDTO orgStaffDTO : orgStaffDTOList) {
if(org.apache.commons.collections4.CollectionUtils.isNotEmpty(orgStaffDTO.getStaffIds())){
resultMap.put(orgStaffDTO.getOrgId(),userDao.selectGridManagerTotal(customerId,orgStaffDTO.getStaffIds()));
}
}
return resultMap;
}
}

4
epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.19__add_gridMemberToalColumn.sql

@ -0,0 +1,4 @@
-- 为了平阴大屏,显示网格员数,screen_user_total_data 新增GRID_MEMBER_TOTAL
-- epmet_evaluation_index 、 epmet_data_statistical_display 库执行以下:
ALTER TABLE screen_user_total_data ADD COLUMN `GRID_MEMBER_TOTAL` INT ( 11 ) NOT NULL DEFAULT '0' COMMENT '06.01新增:orgType=agency或者grid的时候,此列赋值:当前组织或者当前网格内的网格员人数' AFTER PROJECT_TOTAL;

4
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserTotalDataDao.xml

@ -25,6 +25,7 @@
TOPIC_TOTAL,
ISSUE_TOTAL,
PROJECT_TOTAL,
GRID_MEMBER_TOTAL,
DEL_FLAG,
REVISION,
CREATED_BY,
@ -47,6 +48,7 @@
#{item.topicTotal},
#{item.issueTotal},
#{item.projectTotal},
#{item.gridMemberTotal},
0,
0,
'APP_USER',
@ -73,6 +75,7 @@
TOPIC_TOTAL,
ISSUE_TOTAL,
PROJECT_TOTAL,
GRID_MEMBER_TOTAL,
DEL_FLAG,
REVISION,
CREATED_BY,
@ -95,6 +98,7 @@
#{item.topicTotal},
#{item.issueTotal},
#{item.projectTotal},
#{item.gridMemberTotal},
0,
0,
'CRAWLER_ROBOT',

32
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml

@ -125,4 +125,36 @@
and ca.pid='0'
and ca.CUSTOMER_ID=#{customerId}
</select>
<resultMap id="OrgStaffResultDTOMap" type="com.epmet.dto.org.result.OrgStaffDTO">
<result property="orgId" column="orgId"/>
<result property="orgType" column="orgType"/>
<collection property="staffIds" ofType="java.lang.String">
<result column="staffId"/>
</collection>
</resultMap>
<select id="selectOrgStaffIds" parameterType="java.lang.String" resultMap="OrgStaffResultDTOMap">
SELECT
csg.GRID_ID AS orgId,
'grid' AS orgType,
csg.USER_ID AS staffId
FROM
customer_staff_grid csg
WHERE
csg.DEL_FLAG = '0'
AND csg.CUSTOMER_ID = #{customerId}
UNION ALL
SELECT
csa.AGENCY_ID AS orgId,
'agency' AS orgType,
csa.USER_ID AS staffId
FROM
customer_staff_agency csa
WHERE
csa.DEL_FLAG = '0'
AND csa.CUSTOMER_ID = #{customerId}
ORDER BY
orgType asc,orgId ASC
</select>
</mapper>

25
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml

@ -532,4 +532,29 @@
user_id = #{project.linkName}
</foreach>
</select>
<!-- 根据工作员用户id, 返回这些人当中多少个网格员 -->
<select id="selectGridManagerTotal" parameterType="map" resultType="int">
SELECT
count( 1 )
FROM
staff_role sr
WHERE
sr.DEL_FLAG = '0'
AND sr.CUSTOMER_ID = #{customerId}
AND sr.ROLE_ID IN (
SELECT
m.id AS roleId
FROM
gov_staff_role m
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID = #{customerId}
AND m.ROLE_KEY = 'grid_manager'
)
AND sr.STAFF_ID in
<foreach collection="staffIds" item="staffId" open="(" close=")" separator=",">
#{staffId}
</foreach>
</select>
</mapper>

Loading…
Cancel
Save