Browse Source

Merge branch 'dev_bugfix_ljj' into dev_temp

master
zhaoqifeng 5 years ago
parent
commit
42db15105a
  1. 4
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectQuantityOrgMonthlyDao.xml
  2. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectProcessAttachmentDao.java
  3. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectProcessDao.java
  4. 66
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectProcessServiceImpl.java
  5. 21
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectQuantityOrgMonthlyServiceImpl.java
  6. 11
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectProcessAttachmentDao.xml
  7. 11
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectProcessDao.xml

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

@ -19,7 +19,7 @@
AND m.ORG_ID =#{agencyId}
AND m.MONTH_ID <= #{endMonthId}
ORDER BY
m.MONTH_ID ASC
m.MONTH_ID DESC
LIMIT 12
</select>
</mapper>
</mapper>

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectProcessAttachmentDao.java

@ -38,4 +38,6 @@ public interface ScreenProjectProcessAttachmentDao extends BaseDao<ScreenProject
void insertBatch(@Param("list")List<ScreenProjectProcessAttachmentDTO> list);
int deleteByProcessIds(@Param("customerId") String customerId, @Param("list") List<String> list);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectProcessDao.java

@ -41,4 +41,6 @@ public interface ScreenProjectProcessDao extends BaseDao<ScreenProjectProcessEnt
int countByCustomerId(@Param("customerId") String customerId);
void insertBatch(@Param("list") List<ScreenProjectProcessDTO> list);
int deleteByProcessIds(@Param("customerId") String customerId, @Param("list") List<String> list);
}

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

@ -34,6 +34,7 @@ import com.epmet.dto.screen.form.ScreenProjectProcessFormDTO;
import com.epmet.dto.screencoll.ScreenCollFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenProjectProcessAttachmentEntity;
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.ListUtils;
import org.apache.commons.lang3.StringUtils;
@ -42,9 +43,12 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
* 中央区-项目数据项目处理进展表
@ -58,6 +62,8 @@ public class ScreenProjectProcessServiceImpl extends BaseServiceImpl<ScreenProje
@Resource
private ScreenProjectProcessAttachmentDao screenProjectProcessAttachmentDao;
@Resource
private ScreenProjectProcessAttachmentService screenProjectProcessAttachmentService;
@Override
public PageData<ScreenProjectProcessDTO> page(Map<String, Object> params) {
IPage<ScreenProjectProcessEntity> page = baseDao.selectPage(
@ -120,39 +126,35 @@ public class ScreenProjectProcessServiceImpl extends BaseServiceImpl<ScreenProje
affectedRows = baseDao.deleteByDateIdAndCustomerId(param.getCustomerId(), param.getDateId());
}
}
param.getDataList().forEach(item -> {
//先删除旧数据
QueryWrapper<ScreenProjectProcessEntity> screenProjectProcessEntityQueryWrapper = new QueryWrapper<>();
screenProjectProcessEntityQueryWrapper.eq(StringUtils.isNotBlank(item.getProjectId()), "project_id", item.getProjectId())
.eq(StringUtils.isNotBlank(param.getCustomerId()), "customer_id", param.getCustomerId())
.eq(StringUtils.isNotBlank(item.getProcessId()), "process_id", item.getProcessId());
baseDao.delete(screenProjectProcessEntityQueryWrapper);
QueryWrapper<ScreenProjectProcessAttachmentEntity> screenProjectProcessAttachmentEntityQueryWrapper = new QueryWrapper<>();
screenProjectProcessAttachmentEntityQueryWrapper.eq(StringUtils.isNotBlank(item.getProjectId()), "project_id", item.getProjectId())
.eq(StringUtils.isNotBlank(param.getCustomerId()), "customer_id", param.getCustomerId())
.eq(StringUtils.isNotBlank(item.getProcessId()), "process_id", item.getProcessId());
screenProjectProcessAttachmentDao.delete(screenProjectProcessAttachmentEntityQueryWrapper);
//插入
ScreenProjectProcessEntity screenProjectProcessEntity = ConvertUtils.sourceToTarget(item, ScreenProjectProcessEntity.class);
screenProjectProcessEntity.setCustomerId(param.getCustomerId());
screenProjectProcessEntity.setDataEndTime(param.getDateId());
baseDao.insert(screenProjectProcessEntity);
List<ScreenProjectProcessAttachmentDTO> attachments = item.getAttachments();
if (!CollectionUtils.isEmpty(attachments)){
for (int i = 0; i < attachments.size(); i++) {
ScreenProjectProcessAttachmentEntity attachmentEntity = ConvertUtils.sourceToTarget(attachments.get(i), ScreenProjectProcessAttachmentEntity.class);
attachmentEntity.setCustomerId(param.getCustomerId());
attachmentEntity.setProcessId(item.getProcessId());
attachmentEntity.setProjectId(item.getProjectId());
if (attachmentEntity.getSort() == null) {
attachmentEntity.setSort(i);
}
screenProjectProcessAttachmentDao.insert(attachmentEntity);
List<String> processIdList =
param.getDataList().stream().map(ScreenProjectProcessFormDTO :: getProcessId).collect(Collectors.toList()).stream().distinct()
.collect(Collectors.toList());
//删除旧数据
baseDao.deleteByProcessIds(param.getCustomerId(), processIdList);
screenProjectProcessAttachmentDao.deleteByProcessIds(param.getCustomerId(), processIdList);
List<ScreenProjectProcessAttachmentEntity> attachmentList = new ArrayList<>();
List<ScreenProjectProcessEntity> processList = param.getDataList().stream().map(item -> {
ScreenProjectProcessEntity entity = ConvertUtils.sourceToTarget(item, ScreenProjectProcessEntity.class);
entity.setCustomerId(param.getCustomerId());
entity.setDataEndTime(param.getDateId());
AtomicInteger i = new AtomicInteger(0);
List<ScreenProjectProcessAttachmentEntity> attachments = item.getAttachments().stream().map(attachment -> {
ScreenProjectProcessAttachmentEntity attachmentEntity = ConvertUtils.sourceToTarget(attachment, ScreenProjectProcessAttachmentEntity.class);
attachmentEntity.setCustomerId(param.getCustomerId());
attachmentEntity.setProcessId(item.getProcessId());
attachmentEntity.setProjectId(item.getProjectId());
if (attachmentEntity.getSort() == null) {
attachmentEntity.setSort(i.getAndIncrement());
}
}
});
return attachmentEntity;
}).collect(Collectors.toList());
attachmentList.addAll(attachments);
return entity;
}).collect(Collectors.toList());
this.insertBatch(processList);
screenProjectProcessAttachmentService.insertBatch(attachmentList);
}

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

@ -253,38 +253,37 @@ public class ScreenProjectQuantityOrgMonthlyServiceImpl extends BaseServiceImpl<
List<ScreenProjectQuantityOrgMonthlyDTO> agencyInfos = ConvertUtils.sourceToTarget(screenProjectOrgDailyDTOS, ScreenProjectQuantityOrgMonthlyDTO.class);
List<ProjectOrgMonthlyResultDTO> projectOrg = baseDao.selectQuantityOrgMonthly(agencyInfos, monthId);
if (!CollectionUtils.isEmpty(projectOrg)){
/*if (!CollectionUtils.isEmpty(projectOrg)){
projectOrg.forEach(p -> {
p.setClosedIncr(p.getClosedIncr());
p.setProjectIncr(p.getProjectIncr());
});
}
}*/
List<ProjectOrgMonthlyResultDTO> projectGrandOrg = baseDao.selectQuantityGrandOrgMonthly(agencyInfos, monthId);
if (!CollectionUtils.isEmpty(projectGrandOrg)){
/*if (!CollectionUtils.isEmpty(projectGrandOrg)){
projectGrandOrg.forEach(p -> {
p.setClosedTotal(p.getClosedTotal());
p.setProjectTotal(p.getProjectTotal());
p.setUnClosedTotal(p.getUnClosedTotal());
});
}
}*/
agencyInfos.forEach(a -> {
a.setMonthId(monthId);
if (!CollectionUtils.isEmpty(projectOrg)){
projectOrg.forEach(p -> {
if (a.getAreaCode().equals(p.getAreaCode())){
a.setClosedIncr(null == p.getClosedIncr() ? NumConstant.ZERO : p.getClosedIncr());
a.setProjectIncr(null == p.getProjectIncr() ? NumConstant.ZERO : p.getProjectIncr());
a.setProjectIncr(null == p.getProjectIncr() ? NumConstant.ZERO : p.getProjectIncr());
a.setClosedIncr(null == p.getClosedIncr() ? a.getClosedIncr() : a.getClosedIncr() + p.getClosedIncr());
a.setProjectIncr(null == p.getProjectIncr() ? a.getProjectIncr() : a.getProjectIncr() + p.getProjectIncr());
}
});
}
if (!CollectionUtils.isEmpty(projectGrandOrg)){
projectGrandOrg.forEach(p -> {
if (a.getAreaCode().equals(p.getAreaCode())){
a.setClosedTotal(null == p.getClosedTotal() ? NumConstant.ZERO : p.getClosedTotal());
a.setProjectTotal(null == p.getProjectTotal() ? NumConstant.ZERO : p.getProjectTotal());
a.setUnClosedTotal(null == p.getUnClosedTotal() ? NumConstant.ZERO : p.getUnClosedTotal());
a.setProjectIncr(null == p.getProjectIncr() ? NumConstant.ZERO : p.getProjectIncr());
a.setClosedTotal(null == p.getClosedTotal() ? a.getClosedTotal() : a.getClosedTotal() + p.getClosedTotal());
a.setProjectTotal(null == p.getProjectTotal() ? a.getProjectTotal() : a.getProjectTotal() + p.getProjectTotal());
a.setUnClosedTotal(null == p.getUnClosedTotal() ? a.getUnClosedTotal() : a.getUnClosedTotal() + p.getUnClosedTotal());
a.setProjectIncr(null == p.getProjectIncr() ? a.getProjectIncr() : a.getProjectIncr() + p.getProjectIncr());
}
});
}

11
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectProcessAttachmentDao.xml

@ -85,4 +85,15 @@
)
</foreach>
</insert>
<delete id="deleteByProcessIds">
delete from screen_project_process_attachment
where customer_id = #{customerId}
<if test="list != null and list.size() > 0">
AND
<foreach collection="list" item="processId" separator="or" open="(" close=")">
PROCESS_ID = #{processId}
</foreach>
</if>
</delete>
</mapper>

11
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectProcessDao.xml

@ -22,6 +22,17 @@
where del_flag = '0' and customer_id = #{customerId}
</select>
<delete id="deleteByProcessIds">
delete from screen_project_process
where customer_id = #{customerId}
<if test="list != null and list.size() > 0">
AND
<foreach collection="list" item="processId" separator="or" open="(" close=")">
PROCESS_ID = #{processId}
</foreach>
</if>
</delete>
<insert id="insertBatch" parameterType="java.util.List">
INSERT INTO screen_project_process
(

Loading…
Cancel
Save