Browse Source

Merge remote-tracking branch 'origin/dev_bugfix_ljj' into dev_temp

master
zxc 5 years ago
parent
commit
9d5ae5834a
  1. 4
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml
  2. 21
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/AgencyMonthCountResultDTO.java
  3. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  4. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java
  5. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java
  6. 34
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java
  7. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectProcessServiceImpl.java
  8. 21
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java
  9. 6
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml
  10. 7
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml
  11. 15
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml

4
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml

@ -21,6 +21,8 @@
DEL_FLAG = '0'
AND MONTH_ID = #{monthId}
AND ORG_ID = #{agencyId}
order by CREATED_TIME DESC
LIMIT 1
</select>
<!-- 根据地区码查询用户参与数据 -->
@ -74,4 +76,4 @@
AND ORG_ID = #{agencyId}
AND MONTH_ID <![CDATA[ >= ]]> #{monthId}*/
</select>
</mapper>
</mapper>

21
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/AgencyMonthCountResultDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto.extract.result;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/5/8 9:34 上午
* @DESC
*/
@Data
public class AgencyMonthCountResultDTO implements Serializable {
private static final long serialVersionUID = 3473299876562651080L;
private String orgId;
private Integer monthCount = NumConstant.ZERO;
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java

@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.extract.form.PartyBaseInfoFormDTO;
import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO;
import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO;
import com.epmet.dto.extract.result.AgencyMonthCountResultDTO;
import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO;
import com.epmet.dto.extract.result.OrgNameResultDTO;
import com.epmet.dto.indexcollect.form.CustomerBizOrgFormDTO;
@ -204,4 +205,12 @@ public interface ScreenCustomerAgencyDao extends BaseDao<ScreenCustomerAgencyEnt
* @date 2021/3/9 上午9:41
*/
List<ScreenProjectOrgDailyDTO> selectAgencyByParentAreaCode(@Param("areaCode") String areaCode);
/**
* @Description 根据客户ID查询客户下所有orgagencygriddept
* @Param customerId
* @author zxc
* @date 2021/5/8 9:03 上午
*/
List<AgencyMonthCountResultDTO> selectAllOrgByCustomerId(@Param("customerId")String customerId);
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java

@ -18,6 +18,7 @@
package com.epmet.dao.evaluationindex.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.extract.result.AgencyMonthCountResultDTO;
import com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenIndexDataMonthlyEntity;
import org.apache.ibatis.annotations.Mapper;
@ -81,6 +82,15 @@ public interface ScreenIndexDataMonthlyDao extends BaseDao<ScreenIndexDataMonthl
Integer selectCountIndexDataMonthly(@Param("customerId") String customerId,
@Param("yearId") String yearId);
/**
* @Description 根据orgIds查询在 screen_index_data_monthly 表里本年度有多少条记录
* @Param yearId
* @Param orgIds
* @author zxc
* @date 2021/5/8 9:37 上午
*/
List<AgencyMonthCountResultDTO> selectMonthCountByOrgId(@Param("yearId") String yearId,@Param("orgIds")List<AgencyMonthCountResultDTO> orgIds);
/**
* 批量删除月表数据
* 根据CUSTOMER_IDMONTH_IDORG_TYPE进行查询如果有数据则先进行物理删除, 一次删除1000条

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java

@ -196,7 +196,6 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService {
Map<String, GridUserCountResultDTO> userCountMap = userCountList.stream().collect(Collectors.toMap(GridUserCountResultDTO::getOrgId, o -> o));
Set<String> agencyIdSet = new HashSet<>();
if (!CollectionUtils.isEmpty(issueTotal)) {
log.error("抽取【公众参与-人均议题】,获取注册用户数为空,customerId:{}", formDTO.getCustomerId());
issueTotal.forEach(issue -> {
String agencyId = issue.getAgencyId();
agencyIdSet.add(agencyId);

34
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java

@ -17,6 +17,7 @@ import com.epmet.dao.evaluationindex.indexcal.GridScoreDao;
import com.epmet.dao.evaluationindex.indexcoll.*;
import com.epmet.dao.evaluationindex.screen.*;
import com.epmet.dto.ScreenCustomerGridDTO;
import com.epmet.dto.extract.result.AgencyMonthCountResultDTO;
import com.epmet.dto.indexcal.AgencyScoreDTO;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.dto.indexcal.DeptScoreDTO;
@ -851,8 +852,41 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
**/
private void insertIndexDataYear(String monthId, String customerId){
// 查询今年,上报了几个月的指数统计
List<AgencyMonthCountResultDTO> orgIds = screenCustomerAgencyDao.selectAllOrgByCustomerId(customerId);
if (CollectionUtils.isEmpty(orgIds)){
throw new RenException("客户下没有查到agencyId,gridId,deptId");
}
List<AgencyMonthCountResultDTO> agencyMonthCount = screenIndexDataMonthlyDao.selectMonthCountByOrgId(getYearStr(monthId), orgIds);
if (!CollectionUtils.isEmpty(agencyMonthCount)){
agencyMonthCount.forEach(a -> {
orgIds.forEach(o -> {
if (a.getOrgId().equals(o.getOrgId())){
o.setMonthCount(a.getMonthCount());
}
});
});
}
Integer monthCount = screenIndexDataMonthlyDao.selectCountIndexDataMonthly(customerId, getYearStr(monthId));
List<IndexDataMonthlyFormDTO> monthlyFormList = screenIndexDataMonthlyDao.selectListIndexDataMonthlyByYear(customerId, getYearStr(monthId), monthCount);
BigDecimal monthCountBd = new BigDecimal(monthCount);
monthlyFormList.forEach(m -> {
orgIds.forEach(o -> {
if (m.getOrgId().equals(o.getOrgId())){
BigDecimal selfCount = new BigDecimal(o.getMonthCount());
if (o.getMonthCount() == NumConstant.ZERO){
m.setIndexTotal(monthCountBd.multiply(m.getIndexTotal()));
m.setPartyDevAblity(monthCountBd.multiply(m.getPartyDevAblity()));
m.setServiceAblity(monthCountBd.multiply(m.getServiceAblity()));
m.setGovernAblity(monthCountBd.multiply(m.getGovernAblity()));
}else {
m.setIndexTotal(monthCountBd.multiply(m.getIndexTotal()).divide(selfCount));
m.setPartyDevAblity(monthCountBd.multiply(m.getPartyDevAblity()).divide(selfCount));
m.setServiceAblity(monthCountBd.multiply(m.getServiceAblity()).divide(selfCount));
m.setGovernAblity(monthCountBd.multiply(m.getGovernAblity()).divide(selfCount));
}
}
});
});
if (monthlyFormList.size() > NumConstant.ZERO){
int deleteNum;
do {

11
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectProcessServiceImpl.java

@ -21,14 +21,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.screen.ScreenProjectProcessAttachmentDao;
import com.epmet.dao.evaluationindex.screen.ScreenProjectProcessDao;
import com.epmet.dto.screen.ScreenProjectProcessAttachmentDTO;
import com.epmet.dto.screen.ScreenProjectProcessDTO;
import com.epmet.dto.screen.form.ScreenProjectProcessFormDTO;
import com.epmet.dto.screencoll.ScreenCollFormDTO;
@ -36,11 +35,11 @@ import com.epmet.entity.evaluationindex.screen.ScreenProjectProcessAttachmentEnt
import com.epmet.entity.evaluationindex.screen.ScreenProjectProcessEntity;
import com.epmet.service.evaluationindex.screen.ScreenProjectProcessAttachmentService;
import com.epmet.service.evaluationindex.screen.ScreenProjectProcessService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
@ -120,6 +119,9 @@ public class ScreenProjectProcessServiceImpl extends BaseServiceImpl<ScreenProje
@Transactional(rollbackFor = Exception.class)
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
public void collect(ScreenCollFormDTO<ScreenProjectProcessFormDTO> param) {
if (CollectionUtils.isEmpty(param.getDataList())){
return;
}
if (param.getIsFirst()) {
int affectedRows = baseDao.deleteByDateIdAndCustomerId(param.getCustomerId(), param.getDateId());
while (affectedRows > 0) {
@ -129,6 +131,9 @@ public class ScreenProjectProcessServiceImpl extends BaseServiceImpl<ScreenProje
List<String> processIdList =
param.getDataList().stream().map(ScreenProjectProcessFormDTO :: getProcessId).collect(Collectors.toList()).stream().distinct()
.collect(Collectors.toList());
if (CollectionUtils.isEmpty(processIdList)){
return;
}
//删除旧数据
baseDao.deleteByProcessIds(param.getCustomerId(), processIdList);
screenProjectProcessAttachmentDao.deleteByProcessIds(param.getCustomerId(), processIdList);

21
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java

@ -85,12 +85,19 @@ public class ScreenUserJoinServiceImpl extends BaseServiceImpl<ScreenUserJoinDao
for (int j = NumConstant.ZERO; j < lastMonthJoinList.size(); j++) {
if (list.get(i).getOrgId().equals(lastMonthJoinList.get(j).getOrgId())) {
ScreenUserJoinEntity entity = ConvertUtils.sourceToTarget(list.get(i), ScreenUserJoinEntity.class);
entity.setJoinTotalUpRate(this.calculateGrowthRateNumber(lastMonthJoinList.get(i).getJoinTotal(), list.get(j).getJoinTotal()));
entity.setJoinTotalUpFlag(this.calculateGrowthRateFlag(lastMonthJoinList.get(i).getJoinTotal(), list.get(j).getJoinTotal()));
entity.setAvgIssueUpRate(this.calculateGrowthRateNumber(lastMonthJoinList.get(i).getAvgIssue(), list.get(j).getAvgIssue()));
entity.setAvgIssueUpFlag(this.calculateGrowthRateFlag(lastMonthJoinList.get(i).getAvgIssue(), list.get(j).getAvgIssue()));
entity.setAgvgJoinUpRate(this.calculateGrowthRateNumber(lastMonthJoinList.get(i).getAvgJoin(), list.get(j).getAvgJoin()));
entity.setAgvgJoinUpFlag(this.calculateGrowthRateFlag(lastMonthJoinList.get(i).getAvgJoin(), list.get(j).getAvgJoin()));
ScreenUserJoinEntity lastJoinEntity = lastMonthJoinList.get(i);
if (lastJoinEntity == null){
lastJoinEntity = new ScreenUserJoinEntity();
lastJoinEntity.setJoinTotal(NumConstant.ZERO);
lastJoinEntity.setAvgIssue(NumConstant.ZERO_DECIMAL);
lastJoinEntity.setAvgJoin(NumConstant.ZERO_DECIMAL);
}
entity.setJoinTotalUpRate(this.calculateGrowthRateNumber(lastJoinEntity.getJoinTotal(), list.get(j).getJoinTotal()));
entity.setJoinTotalUpFlag(this.calculateGrowthRateFlag(lastJoinEntity.getJoinTotal(), list.get(j).getJoinTotal()));
entity.setAvgIssueUpRate(this.calculateGrowthRateNumber(lastJoinEntity.getAvgIssue(), list.get(j).getAvgIssue()));
entity.setAvgIssueUpFlag(this.calculateGrowthRateFlag(lastJoinEntity.getAvgIssue(), list.get(j).getAvgIssue()));
entity.setAgvgJoinUpRate(this.calculateGrowthRateNumber(lastJoinEntity.getAvgJoin(), list.get(j).getAvgJoin()));
entity.setAgvgJoinUpFlag(this.calculateGrowthRateFlag(lastJoinEntity.getAvgJoin(), list.get(j).getAvgJoin()));
curMonthJoinEntityList.add(entity);
}
}
@ -191,4 +198,4 @@ public class ScreenUserJoinServiceImpl extends BaseServiceImpl<ScreenUserJoinDao
return CompareConstant.EQ_STR;
}
}
}
}

6
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml

@ -162,16 +162,16 @@
fics.year_id AS yearId,
ROUND(AVG( fics.score ),6) AS score,
fics.customer_id AS customerId,
(SELECT AGENCY_ID FROM screen_customer_agency WHERE AREA_CODE = #{areaCode}) AS parentId
(SELECT AGENCY_ID FROM screen_customer_agency WHERE AREA_CODE = #{areaCode} AND DEL_FLAG = 0) AS parentId
FROM
fact_index_agency_score fics
WHERE
fics.del_flag = '0'
AND fics.month_id = #{monthId}
AND fics.index_code = #{indexCode}
AND fics.agency_id IN (SELECT AGENCY_ID FROM screen_customer_agency WHERE PARENT_AREA_CODE = #{areaCode})
AND fics.agency_id IN (SELECT AGENCY_ID FROM screen_customer_agency WHERE PARENT_AREA_CODE = #{areaCode} AND DEL_FLAG = 0)
GROUP BY agencyId) a
LEFT JOIN screen_customer_agency a2 ON a2.AGENCY_ID = a.parentId
LEFT JOIN screen_customer_agency a2 ON a2.AGENCY_ID = a.parentId AND a2.DEL_FLAG = 0
GROUP BY a2.AGENCY_ID
</select>

7
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml

@ -419,4 +419,11 @@
where sca.DEL_FLAG = '0'
and sca.AREA_CODE= #{areaCode}
</select>
<!-- 根据客户ID查询客户下所有org【agency,grid,dept】 -->
<select id="selectAllOrgByCustomerId" resultType="com.epmet.dto.extract.result.AgencyMonthCountResultDTO">
(SELECT AGENCY_ID AS orgId FROM screen_customer_agency WHERE DEL_FLAG = 0 AND CUSTOMER_ID = #{customerId}) UNION ALL
(SELECT GRID_ID AS orgId FROM screen_customer_grid WHERE DEL_FLAG = 0 AND CUSTOMER_ID = #{customerId}) UNION ALL
(SELECT DEPT_ID AS orgId FROM screen_customer_dept WHERE DEL_FLAG = 0 AND CUSTOMER_ID = #{customerId})
</select>
</mapper>

15
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml

@ -96,6 +96,21 @@
) monthCount
</select>
<!-- 根据orgIds查询在 screen_index_data_monthly 表里本年度有多少条记录 -->
<select id="selectMonthCountByOrgId" resultType="com.epmet.dto.extract.result.AgencyMonthCountResultDTO">
SELECT
ORG_ID,
COUNT(DISTINCT MONTH_ID) AS monthCount
FROM screen_index_data_monthly
WHERE DEL_FLAG = '0'
AND YEAR_ID = #{yearId}
AND
(<foreach collection="orgIds" item="o" separator=" OR ">
ORG_ID = #{o.orgId}
</foreach>)
GROUP BY ORG_ID
</select>
<delete id="deleteIndexDataMonthlyByOrgType">
delete from screen_index_data_monthly
where CUSTOMER_ID = #{customerId} AND MONTH_ID = #{monthId} AND ORG_TYPE = #{orgType}

Loading…
Cancel
Save