Browse Source

组织项目数据

dev_shibei_match
zxc 4 years ago
parent
commit
468f6adb98
  1. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/BaseReportConstant.java
  2. 20
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/BaseReportDao.java
  3. 22
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/BaseReportServiceImpl.java
  4. 75
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/BaseReportDao.xml

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/BaseReportConstant.java

@ -0,0 +1,13 @@
package com.epmet.constant;
/**
* @Author zxc
* @DateTime 2021/6/24 5:19 下午
* @DESC
*/
public interface BaseReportConstant {
String DATA_IS_NULL = "上传%s数据为空";
}

20
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/BaseReportDao.java

@ -1,5 +1,8 @@
package com.epmet.dao.stats;
import com.epmet.dto.basereport.form.AgencyProjectFormDTO;
import com.epmet.dto.basereport.form.AgencyRegUserFormDTO;
import com.epmet.dto.basereport.form.GridRegUserFormDTO;
import com.epmet.dto.basereport.form.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -84,4 +87,21 @@ public interface BaseReportDao {
* @author sun
*/
void insertBatchAgencyHotTopic(@Param("list") List<AgencyHotTopicFormDTO.DataList> dataList);
/**
* @Description 根据dateId删除客户组织项目数据
* @Param customerId
* @Param dateId
* @author zxc
* @date 2021/6/24 5:30 下午
*/
int delAgencyProject(@Param("customerId") String customerId, @Param("dateId") String dateId);
/**
* @Description 批量新增组织项目数据
* @Param dataList
* @author zxc
* @date 2021/6/25 9:14 上午
*/
void insertAgencyProject(@Param("list")List<AgencyProjectFormDTO.DataList> dataList);
}

22
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/BaseReportServiceImpl.java

@ -1,19 +1,25 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.BaseReportConstant;
import com.epmet.dao.stats.BaseReportDao;
import com.epmet.dto.basereport.form.*;
import com.epmet.service.BaseReportService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.List;
/**
* @Author sun
* @Description 部分基础数据上报
*/
@Service
@Slf4j
public class BaseReportServiceImpl implements BaseReportService {
@Autowired
@ -217,9 +223,21 @@ public class BaseReportServiceImpl implements BaseReportService {
* @author sun
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void agencyProject(AgencyProjectFormDTO formDTO) {
if (CollectionUtils.isEmpty(formDTO.getDataList())){
log.warn(String.format(BaseReportConstant.DATA_IS_NULL),"组织项目");
return;
}
if (formDTO.getIsFirst()) {
int deleteNum;
do {
deleteNum = baseReportDao.delAgencyProject(formDTO.getDataList().get(NumConstant.ZERO).getCustomerId(), formDTO.getDataList().get(NumConstant.ZERO).getDateId());
} while (deleteNum > NumConstant.ZERO);
}
List<List<AgencyProjectFormDTO.DataList>> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED);
partition.forEach(p -> {
baseReportDao.insertAgencyProject(p);
});
}
}

75
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/BaseReportDao.xml

@ -156,5 +156,80 @@
<insert id="insertBatchAgencyHotTopic">
</insert>
<!-- 根据dateId删除客户组织项目数据 -->
<delete id="delAgencyProject">
DELETE FROM fact_agency_project_daily
WHERE customer_id = #{customerId}
AND date_id = #{dateId}
LIMIT 1000
</delete>
<!-- 批量新增组织项目数据 -->
<insert id="insertAgencyProject">
INSERT INTO fact_agency_project_daily
(REPLACE(UUID(), '-', ''),
CUSTOMER_ID,
AGENCY_ID,
PARENT_ID,
DATE_ID,
WEEK_ID,
MONTH_ID,
QUARTER_ID,
YEAR_ID,
PROJECT_TOTAL,
PENDING_TOTAL,
PENDING_RATIO,
CLOSED_TOTAL,
CLOSED_RATIO,
RESOLVED_TOTAL,
RESOLVED_RATIO,
UNRESOLVED_TOTAL,
UNRESOLVED_RATIO,
PROJECT_INCR,
PENDING_INCR,
CLOSED_INCR,
RESOLVED_INCR,
UNRESOLVED_INCR,
DEL_FLAG,
REVISION,
CREATED_BY,
CREATED_TIME,
UPDATED_BY,
UPDATED_TIME)
values
<foreach collection="list" item="i" separator=",">
(
id
#{i.customerId},
#{i.agencyId},
#{i.parentId},
#{i.dateId},
#{i.weekId},
#{i.monthId},
#{i.quarterId},
#{i.yearId},
#{i.projectTotal},
#{i.pendingTotal},
#{i.pendingRatio},
#{i.closedTotal},
#{i.closedRatio},
#{i.resolvedTotal},
#{i.resolvedRatio},
#{i.unresolvedTotal},
#{i.unresolvedRatio},
#{i.projectIncr},
#{i.pendingIncr},
#{i.closedIncr},
#{i.resolvedIncr},
#{i.unresolvedIncr},
0,
0,
'BASE_REPORT',
now(),
'BASE_REPORT',
now()
)
</foreach>
</insert>
</mapper>

Loading…
Cancel
Save