Browse Source

项目统计,定时任务删除逻辑修改

dev
wanggongfeng 3 years ago
parent
commit
2cd698f605
  1. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/BaseReportDao.java
  2. 21
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/BaseReportServiceImpl.java
  3. 9
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/BaseReportDao.xml

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

@ -94,6 +94,8 @@ public interface BaseReportDao {
*/
int delAgencyProject(@Param("customerId") String customerId, @Param("dateId") String dateId);
void delAgencyProjectDaily(@Param("customerId") String customerId,@Param("dateIdList")List<String> dateIdList);
/**
* @Description 批量新增组织项目数据
* @Param dataList

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

@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
/**
@ -288,10 +289,22 @@ public class BaseReportServiceImpl implements BaseReportService {
@Override
public void agencyProject(AgencyProjectFormDTO formDTO) {
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);
// 20220711修改逻辑
// int deleteNum;
// do {
// deleteNum = baseReportDao.delAgencyProject(formDTO.getDataList().get(NumConstant.ZERO).getCustomerId(), formDTO.getDataList().get(NumConstant.ZERO).getDateId());
// } while (deleteNum > NumConstant.ZERO);
List<AgencyProjectFormDTO.DataList> dataList = formDTO.getDataList();
List<String> dateIdList = new ArrayList<String>();
String customerId = dataList.get(NumConstant.ZERO).getCustomerId();
for(AgencyProjectFormDTO.DataList d : dataList){
if(!dateIdList.contains(d.getDateId())){
dateIdList.add(d.getDateId());
}
}
baseReportDao.delAgencyProjectDaily(customerId,dateIdList);
}
List<List<AgencyProjectFormDTO.DataList>> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED);
partition.forEach(p -> {

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

@ -364,6 +364,15 @@
LIMIT 1000
</delete>
<delete id="delAgencyProjectDaily">
DELETE FROM fact_agency_project_daily
WHERE customer_id = #{customerId}
AND date_id IN
<foreach collection="dateIdList" index="index" item="dateId" open="(" separator="," close=")">
#{dateId}
</foreach>
</delete>
<!-- 批量新增组织项目数据 -->
<insert id="insertAgencyProject">
INSERT INTO fact_agency_project_daily

Loading…
Cancel
Save