diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenCollController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenCollController.java index daeae95dba..60042f986b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenCollController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenCollController.java @@ -294,10 +294,10 @@ public class ScreenCollController { * @Author zhangyong * @Date 09:44 2020-08-25 **/ -// @ExternalAppRequestAuth -// @PostMapping("publicpartitotaldata") -// public Result publicPartiTotalData(ExternalAppRequestParam externalAppRequestParam, @RequestBody List formDTO) { -// screenCollService.insertPublicPartiTotalData(formDTO, externalAppRequestParam.getCustomerId()); -// return new Result(); -// } + @ExternalAppRequestAuth + @PostMapping("publicpartitotaldata") + public Result publicPartiTotalData(ExternalAppRequestParam externalAppRequestParam, @RequestBody List formDTO) { + screenCollService.insertPublicPartiTotalData(formDTO, externalAppRequestParam.getCustomerId()); + return new Result(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenPublicPartiTotalDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenPublicPartiTotalDataDao.java index f703978057..a4fdc9f221 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenPublicPartiTotalDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenPublicPartiTotalDataDao.java @@ -18,10 +18,13 @@ package com.epmet.dao.screen; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.screencoll.form.PublicPartiTotalDataFormDTO; import com.epmet.entity.screen.ScreenPublicPartiTotalDataEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 公众参与-各类(话题|议题|项目|注册人数|参与人数)总数 * @@ -31,4 +34,27 @@ import org.apache.ibatis.annotations.Param; @Mapper public interface ScreenPublicPartiTotalDataDao extends BaseDao { -} \ No newline at end of file + /** + * 18、公众参与各类总数 + * 公众参与-各类(用户|党员|党群|话题|议题|项目|注册人数|参与人数)总数 + * 1) 根据CUSTOMER_ID、ORG_ID进行查询,如果有数据,则先进行物理删除 + * + * @param customerId + * @param orgIds 组织Id集合 + * @Author zhangyong + * @Date 10:52 2020-08-25 + **/ + void deletePublicPartiTotalData(@Param("customerId") String customerId, + @Param("orgIds") String[] orgIds); + + /** + * 18、公众参与各类总数 + * 2) 在批量新增 + * + * @param list + * @param customerId + * @Author zhangyong + * @Date 10:52 2020-08-25 + **/ + void batchInsertPublicPartiTotalData(@Param("list") List list, @Param("customerId")String customerId); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/ScreenCollService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/ScreenCollService.java index 33f4970deb..5ebb7d910b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/ScreenCollService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/ScreenCollService.java @@ -230,5 +230,5 @@ public interface ScreenCollService { * @Author zhangyong * @Date 09:44 2020-08-25 **/ -// void insertPublicPartiTotalData(List formDTO, String customerId); + void insertPublicPartiTotalData(List formDTO, String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/ScreenCollServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/ScreenCollServiceImpl.java index bbac660e05..83162e601a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/ScreenCollServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/ScreenCollServiceImpl.java @@ -80,6 +80,8 @@ public class ScreenCollServiceImpl implements ScreenCollService { private ScreenPioneerDataDao screenPioneerDataDao; @Autowired private ScreenIndexDataYearlyDao screenIndexDataYearlyDao; + @Autowired + private ScreenPublicPartiTotalDataDao screenPublicPartiTotalDataDao; @DataSource(value = DataSourceConstant.STATS, datasourceNameFromArg = true) @Override @@ -446,18 +448,18 @@ public class ScreenCollServiceImpl implements ScreenCollService { } } -// @DataSource(value = DataSourceConstant.STATS, datasourceNameFromArg = true) -// @Override -// @Transactional(rollbackFor = Exception.class) -// public void insertPublicPartiTotalData(List formDTO, String customerId) { -// if (null != formDTO && formDTO.size() > NumConstant.ZERO){ -// String[] orgIds = new String[formDTO.size()]; -// for (int i = NumConstant.ZERO; i < formDTO.size(); i++){ -// orgIds[i] = formDTO.get(i).getOrgId(); -// } -//// screenPioneerDataDao.deletePioneerData(customerId, orgIds); -// -//// screenPioneerDataDao.batchInsertPioneerData(formDTO, customerId); -// } -// } + @DataSource(value = DataSourceConstant.STATS, datasourceNameFromArg = true) + @Override + @Transactional(rollbackFor = Exception.class) + public void insertPublicPartiTotalData(List formDTO, String customerId) { + if (null != formDTO && formDTO.size() > NumConstant.ZERO){ + String[] orgIds = new String[formDTO.size()]; + for (int i = NumConstant.ZERO; i < formDTO.size(); i++){ + orgIds[i] = formDTO.get(i).getOrgId(); + } + screenPublicPartiTotalDataDao.deletePublicPartiTotalData(customerId, orgIds); + + screenPublicPartiTotalDataDao.batchInsertPublicPartiTotalData(formDTO, customerId); + } + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml index 5fefac34e9..c3a9200142 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml @@ -1,7 +1,7 @@ - + @@ -24,5 +24,61 @@ + + delete from screen_public_parti_total_data + where CUSTOMER_ID = #{customerId} + AND ORG_ID IN + + #{item} + + - \ No newline at end of file + + insert into screen_public_parti_total_data + ( + ID, + CUSTOMER_ID, + ORG_TYPE, + ORG_ID, + PARENT_ID, + ORG_NAME, + DATA_END_TIME, + TOPIC_TOTAL, + ISSUE_TOTAL, + PROJECT_TOTAL, + REG_USER_TOTAL, + JOIN_USER_TOTAL, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{customerId}, + #{item.orgType}, + #{item.orgId}, + #{item.parentId}, + #{item.orgName}, + #{item.dataEndTime}, + #{item.topicTotal}, + #{item.issueTotal}, + #{item.projectTotal}, + #{item.regUserTotal}, + + #{item.joinUserTotal}, + 0, + 0, + 'APP_USER', + now(), + 'APP_USER', + now() + ) + + + + +