diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java index 60c16f0c01..72d2e072b4 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java @@ -164,7 +164,12 @@ public enum RequirePermissionEnum { MORE_BADGE_MANAGE_LIST("more_badge_manage_list","更多:徽章:徽章管理:列表","徽章列表"), MORE_BADGE_MANAGE_CREATE("more_badge_manage_create","更多:徽章:徽章管理:添加","添加徽章"), MORE_BADGE_MANAGE_EDIT("more_badge_manage_edit","更多:徽章:徽章管理:编辑","编辑徽章"), - MORE_BADGE_MANAGE_DELETE("more_badge_manage_delete","更多:徽章:徽章管理:删除","删除徽章"); + MORE_BADGE_MANAGE_DELETE("more_badge_manage_delete","更多:徽章:徽章管理:删除","删除徽章"), + + /** + * 项目立项 + */ + WORK_PROJECT_APPROVAL("work_project_approval","政务管理:项目立项","项目立项"); private String key; private String name; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 65a6e645e2..839d80dbd4 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -71,7 +71,8 @@ public enum EpmetErrorCode { NOT_DEL_DEPARTMENT(8206, "该部门存在工作人员,不允许删除"), NOT_DEL_AGENCY_GRID(8207, "该机关存在网格,不允许删除"), AREA_CODE_ALREADY_EXISTS(8208,"组织区划已被占用,请重新选择"), - AGENCY_NAME_ALREADY_EXISTS(8209,"您当前的组织名称已存在,请重新修改"), + AGENCY_NAME_ALREADY_EXISTS(8209,"当前组织名称已存在,请重新修改"), + SET_PARENT_AREA_CODE(8210,"请先设置上级组织区划"), REQUIRE_PERMISSION(8301, "您没有足够的操作权限"), THIRD_PLAT_REQUEST_ERROR(8302, "请求第三方平台错误"), diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/NextAreaCodeFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/NextAreaCodeFormDTO.java index ad3783df46..5bdd66cf68 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/NextAreaCodeFormDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/NextAreaCodeFormDTO.java @@ -14,8 +14,11 @@ import java.io.Serializable; @Data public class NextAreaCodeFormDTO implements Serializable { private static final long serialVersionUID = -1974456701949979946L; + public interface AddUserInternalGroup { + } + @NotBlank(message = "parentAgencyId不能为空",groups = AddUserInternalGroup.class) + private String parentAgencyId; - @NotBlank(message = "areaCode不能为空") private String areaCode; /** @@ -25,7 +28,7 @@ public class NextAreaCodeFormDTO implements Serializable { * 市级: city * 省级:province */ - @NotBlank(message = "level不能为空") + @NotBlank(message = "level不能为空",groups = AddUserInternalGroup.class) private String level; } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java index ebc8cac4b3..b09414f1bd 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java @@ -3,6 +3,7 @@ package com.epmet.dataaggre.service.govorg.impl; import com.alibaba.fastjson.JSON; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.dataaggre.constant.DataSourceConstant; import com.epmet.dataaggre.dao.govorg.CustomerAgencyDao; @@ -20,8 +21,7 @@ import com.epmet.dataaggre.service.govorg.GovOrgService; import com.epmet.dataaggre.service.opercrm.CustomerRelation; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -37,7 +37,6 @@ import java.util.List; @DataSource(DataSourceConstant.GOV_ORG) @Slf4j public class GovOrgServiceImpl implements GovOrgService { - private static final Logger logger = LoggerFactory.getLogger(GovOrgServiceImpl.class); @Autowired private CustomerAgencyDao customerAgencyDao; @@ -133,6 +132,10 @@ public class GovOrgServiceImpl implements GovOrgService { @Override public List queryNextLevelAreaCodeList(NextAreaCodeFormDTO formDTO) { + CustomerAgencyEntity parent=customerAgencyDao.selectById(formDTO.getParentAgencyId()); + if (null == parent || StringUtils.isBlank(parent.getAreaCode())) { + throw new RenException(EpmetErrorCode.SET_PARENT_AREA_CODE.getCode(),EpmetErrorCode.SET_PARENT_AREA_CODE.getMsg()); + } //全部下级 List allList = areaCodeService.queryNextLevelAreaCodeList(formDTO); if (CollectionUtils.isNotEmpty(allList)) { diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/ClosedIncrResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/ClosedIncrResultDTO.java index d1f9083b30..c253849ab5 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/ClosedIncrResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/ClosedIncrResultDTO.java @@ -16,4 +16,6 @@ public class ClosedIncrResultDTO implements Serializable { private String gridId; private Integer closedIncr; + + private String orgId; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/ProjectIncrResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/ProjectIncrResultDTO.java index 6200eb8add..8f880dcf5b 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/ProjectIncrResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/ProjectIncrResultDTO.java @@ -16,4 +16,6 @@ public class ProjectIncrResultDTO implements Serializable { private String gridId; private Integer projectIncr; + + private String orgId; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/UnClosedTotalResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/UnClosedTotalResultDTO.java index d31e85ec28..b4d001fa56 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/UnClosedTotalResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/UnClosedTotalResultDTO.java @@ -16,4 +16,6 @@ public class UnClosedTotalResultDTO implements Serializable { private String gridId; private Integer projectCount; + + private String orgId; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectOrgDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectOrgDailyDTO.java index 7b449b50fe..da3ce096ec 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectOrgDailyDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectOrgDailyDTO.java @@ -17,6 +17,7 @@ package com.epmet.dto.screen; +import com.epmet.commons.tools.constant.NumConstant; import lombok.Data; import java.io.Serializable; @@ -144,4 +145,14 @@ public class ScreenProjectOrgDailyDTO implements Serializable { */ private String areaCode; + public ScreenProjectOrgDailyDTO() { + this.projectTotal = NumConstant.ZERO; + this.resolvedNum = NumConstant.ZERO; + this.resolvedRatio = NumConstant.ZERO_DECIMAL; + this.evaluateTotal = NumConstant.ZERO; + this.goodTotal = NumConstant.ZERO; + this.badTotal = NumConstant.ZERO; + this.goodRatio = NumConstant.ZERO_DECIMAL; + this.badRatio = NumConstant.ZERO_DECIMAL; + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java index badbd6197c..82ea30952a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java @@ -286,6 +286,15 @@ public interface FactOriginProjectMainDailyDao extends BaseDao selectProjectIncr(@Param("customerId")String customerId, @Param("monthId")String monthId); + /** + * @Description 组织查询本月新增项目数 + * @Param orgIds + * @Param monthId + * @author zxc + * @date 2021/4/16 上午9:21 + */ + List selectProjectIncrByOrg(@Param("orgIds") List orgIds, @Param("monthId")String monthId); + /** * @Description 根据状态查询项目数 * @Param customerId @@ -296,6 +305,16 @@ public interface FactOriginProjectMainDailyDao extends BaseDao selectProjectCount(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("status") String status); + /** + * @Description 组织根据状态查询项目数 + * @Param orgIds + * @Param monthId + * @Param status + * @author zxc + * @date 2021/4/16 上午9:26 + */ + List selectProjectCountByOrg(@Param("orgIds") List orgIds, @Param("monthId")String monthId, @Param("status") String status); + /** * @Description 本月新增结案项目数 * @Param customerId @@ -305,6 +324,15 @@ public interface FactOriginProjectMainDailyDao extends BaseDao selectClosedIncr(@Param("customerId")String customerId, @Param("monthId")String monthId); + /** + * @Description 组织本月新增结案项目数 + * @Param orgIds + * @Param monthId + * @author zxc + * @date 2021/4/16 上午9:35 + */ + List selectClosedIncrByOrg(@Param("orgIds") List orgIds, @Param("monthId")String monthId); + /** * @Description 初始化screen_project_data数据 * 如果是dateId不为空,则查询前一天的数据 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectOrgDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectOrgDailyDao.java index 731347f2a6..cc8e1fb2a8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectOrgDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectOrgDailyDao.java @@ -47,4 +47,5 @@ public interface ScreenProjectOrgDailyDao extends BaseDao selectOrgProject(@Param("agencyInfos") List agencyInfos, @Param("dateId") String dateId); + List selectOrgProjectByAgency(@Param("agencyInfos") List agencyInfos, @Param("dateId") String dateId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectQuantityOrgMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectQuantityOrgMonthlyDao.java index a11d394821..3adec6357e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectQuantityOrgMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectQuantityOrgMonthlyDao.java @@ -49,6 +49,7 @@ public interface ScreenProjectQuantityOrgMonthlyDao extends BaseDao selectQuantityOrgMonthly(@Param("agencyInfos") List agencyInfos, @Param("monthId") String monthId); + List selectQuantityOrgMonthlyByAgency(@Param("agencyInfos") List agencyInfos, @Param("monthId") String monthId); /** * @Description 项目(事件)数量查询【本月之前的累计】 @@ -58,6 +59,7 @@ public interface ScreenProjectQuantityOrgMonthlyDao extends BaseDao selectQuantityGrandOrgMonthly(@Param("agencyInfos") List agencyInfos, @Param("monthId") String monthId); + List selectQuantityGrandOrgMonthlyByAgency(@Param("agencyInfos") List agencyInfos, @Param("monthId") String monthId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java index 7b3a3b8d61..f77a01bf4a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java @@ -271,6 +271,15 @@ public interface FactOriginProjectMainDailyService extends BaseService selectProjectIncr(String customerId, String monthId); + /** + * @Description 组织查询本月新增项目数 + * @Param orgIds + * @Param monthId + * @author zxc + * @date 2021/4/16 上午9:19 + */ + List selectProjectIncrByOrg(List orgIds, String monthId); + /** * @Description 根据状态查询项目数 * @Param customerId @@ -281,6 +290,16 @@ public interface FactOriginProjectMainDailyService extends BaseService selectProjectCount(String customerId, String monthId, String status); + /** + * @Description 组织根据状态查询项目数 + * @Param orgIds + * @Param monthId + * @Param status + * @author zxc + * @date 2021/4/16 上午9:24 + */ + List selectProjectCountByOrg(List orgIds, String monthId, String status); + /** * @Description 本月新增结案项目数 * @Param customerId @@ -290,6 +309,15 @@ public interface FactOriginProjectMainDailyService extends BaseService selectClosedIncr(String customerId, String monthId); + /** + * @Description 组织本月新增结案项目数 + * @Param orgIds + * @Param monthId + * @author zxc + * @date 2021/4/16 上午9:33 + */ + List selectClosedIncrByOrg(List orgIds, String monthId); + /** * @Description 初始化screen_project_data数据 * 如果是dateId不为空,则查询前一天的数据 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java index 643ddba8d4..cfb902162f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java @@ -329,6 +329,22 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl(); } + /** + * @Description 组织查询本月新增项目数 + * @Param orgIds + * @Param monthId + * @author zxc + * @date 2021/4/16 上午9:19 + */ + @Override + public List selectProjectIncrByOrg(List orgIds, String monthId) { + if (!CollectionUtils.isEmpty(orgIds) && StringUtils.isNotBlank(monthId)){ + List projectIncrResultDTOS = baseDao.selectProjectIncrByOrg(orgIds, monthId); + return projectIncrResultDTOS; + } + return new ArrayList<>(); + } + /** * @Description 根据状态查询项目数 * @Param customerId @@ -346,6 +362,23 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl(); } + /** + * @Description 组织根据状态查询项目数 + * @Param orgIds + * @Param monthId + * @Param status + * @author zxc + * @date 2021/4/16 上午9:24 + */ + @Override + public List selectProjectCountByOrg(List orgIds, String monthId, String status) { + if (!CollectionUtils.isEmpty(orgIds) && StringUtils.isNotBlank(monthId)){ + List resultDTOS = baseDao.selectProjectCountByOrg(orgIds, monthId, status); + return resultDTOS; + } + return new ArrayList<>(); + } + /** * @Description 本月新增结案项目数 * @Param customerId @@ -362,6 +395,22 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl(); } + /** + * @Description 组织本月新增结案项目数 + * @Param orgIds + * @Param monthId + * @author zxc + * @date 2021/4/16 上午9:33 + */ + @Override + public List selectClosedIncrByOrg(List orgIds, String monthId) { + if (!CollectionUtils.isEmpty(orgIds) && StringUtils.isNotBlank(monthId)){ + List result = baseDao.selectClosedIncrByOrg(orgIds, monthId); + return result; + } + return new ArrayList<>(); + } + /** * @Description 初始化screen_project_data数据 * 如果是dateId不为空,则查询前一天的数据 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java index 40a55d329f..c1c0002c4a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java @@ -301,6 +301,7 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr imgData.setEventImgUrl(img.getAttachmentUrl()); imgData.setSort(img.getSort()); imgDataEntities.add(imgData); + imgData.setCustomerId(param.getCustomerId()); }); log.info("projectId:{} imgs:{}", project.getId(), imgDataEntities.stream().filter(o -> o.getEventId().equals(project.getId())).count()); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java index c5818bd6fe..3a37d17a40 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java @@ -35,6 +35,7 @@ import com.epmet.dto.pingyin.result.ProjectTotalResultDTO; import com.epmet.dto.pingyin.result.ResolvedNumResultDTO; import com.epmet.dto.screen.ScreenProjectOrgDailyDTO; import com.epmet.dto.screencoll.ScreenCollFormDTO; +import com.epmet.entity.crm.CustomerRelationEntity; import com.epmet.entity.evaluationindex.screen.ScreenProjectOrgDailyEntity; import com.epmet.entity.org.CustomerAgencyEntity; import com.epmet.service.crm.CustomerRelationService; @@ -153,7 +154,7 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl agencyInfos = new ArrayList<>(); - //如果有子客户要按照跟组织的area_code查询组织列表 if(customerRelationService.haveSubCustomer(customerId)){ - // - CustomerAgencyEntity rootAgency=customerAgencyService.getRootAgencyInfo(customerId); - agencyInfos=agencyDao.selectAgencyByAreaCode(rootAgency.getAreaCode()); + // 多客户处理 + extractionProjectOrgDailyMoreCustomer(customerId,dateId); }else{ - agencyInfos=agencyDao.selectAgencyByCustomer(customerId); + // 单客户处理 + extractionProjectOrgDailyOneCustomer(customerId, dateId); } + } + + /** + * @Description 单客户处理 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/4/15 上午9:09 + */ + public void extractionProjectOrgDailyOneCustomer(String customerId, String dateId){ + List agencyInfos = agencyDao.selectAgencyByCustomer(customerId); + if (CollectionUtils.isEmpty(agencyInfos)){ + log.warn(String.format(PingYinConstants.AGENCY_INFO_IS_ZERO,customerId)); + return; + } + List projectOrgDaily = baseDao.selectOrgProjectByAgency(agencyInfos, dateId); + if (CollectionUtils.isEmpty(projectOrgDaily)){ + log.info(String.format(PingYinConstants.SELECT_GRID_INFO_BY_ORG_IS_NULL,customerId)); + return; + } + log.info(projectOrgDaily.toString()); + List createProjects = disposeCreateProject(agencyInfos, dateId); + agencyInfos.forEach(a -> { + a.setDateId(dateId); + projectOrgDaily.forEach(p -> { + if (a.getAreaCode().equals(p.getAreaCode())){ + a.setResolvedRatio(getRatio(p.getResolvedNum(),p.getProjectTotal())); + a.setBadRatio(getRatio(p.getBadTotal(),p.getEvaluateTotal())); + a.setGoodRatio(getRatio(p.getGoodTotal(),p.getEvaluateTotal())); + a.setBadTotal(p.getBadTotal()); + a.setEvaluateTotal(p.getEvaluateTotal()); + a.setGoodTotal(p.getGoodTotal()); + a.setProjectTotal(p.getProjectTotal()); + a.setResolvedNum(p.getResolvedNum()); + } + }); + }); + agencyInfos.forEach(a -> { + createProjects.forEach(p -> { + if (a.getOrgId().equals(p.getOrgId())){ + a.setBadTotal(p.getBadTotal() + a.getBadTotal()); + a.setEvaluateTotal(p.getEvaluateTotal() + a.getEvaluateTotal()); + a.setGoodTotal(p.getGoodTotal() + a.getGoodTotal()); + a.setProjectTotal(p.getProjectTotal() + a.getProjectTotal()); + a.setResolvedNum(p.getResolvedNum() + a.getResolvedNum()); + a.setResolvedRatio(getRatio(a.getResolvedNum(),a.getProjectTotal())); + a.setBadRatio(getRatio(a.getBadTotal(),a.getEvaluateTotal())); + a.setGoodRatio(getRatio(a.getGoodTotal(),a.getEvaluateTotal())); + } + }); + }); + log.info(agencyInfos.toString()); + del(customerId, dateId); + insert(agencyInfos,customerId,dateId); + } + + /** + * @Description 有子客户处理 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/4/16 上午9:15 + */ + public void extractionProjectOrgDailyMoreCustomer(String customerId, String dateId){ + CustomerAgencyEntity rootAgency=customerAgencyService.getRootAgencyInfo(customerId); + List agencyInfos = agencyDao.selectAgencyByAreaCode(rootAgency.getAreaCode()); if (CollectionUtils.isEmpty(agencyInfos)){ log.warn(String.format(PingYinConstants.AGENCY_INFO_IS_ZERO,customerId)); return; @@ -179,10 +244,54 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl { + a.setDateId(dateId); + projectOrgDaily.forEach(p -> { + if (a.getAreaCode().equals(p.getAreaCode())){ + a.setResolvedRatio(getRatio(p.getResolvedNum(),p.getProjectTotal())); + a.setBadRatio(getRatio(p.getBadTotal(),p.getEvaluateTotal())); + a.setGoodRatio(getRatio(p.getGoodTotal(),p.getEvaluateTotal())); + a.setBadTotal(p.getBadTotal()); + a.setEvaluateTotal(p.getEvaluateTotal()); + a.setGoodTotal(p.getGoodTotal()); + a.setProjectTotal(p.getProjectTotal()); + a.setResolvedNum(p.getResolvedNum()); + } + }); + }); + // 父子客户只需处理父客户数据,暂时不管子客户 + List parentAgencyInfos = agencyDao.selectAgencyByCustomer(customerId); + List createProjects = disposeCreateProject(parentAgencyInfos, dateId); + agencyInfos.forEach(a -> { + createProjects.forEach(p -> { + if (a.getOrgId().equals(p.getOrgId())){ + a.setBadTotal(p.getBadTotal() + a.getBadTotal()); + a.setEvaluateTotal(p.getEvaluateTotal() + a.getEvaluateTotal()); + a.setGoodTotal(p.getGoodTotal() + a.getGoodTotal()); + a.setProjectTotal(p.getProjectTotal() + a.getProjectTotal()); + a.setResolvedNum(p.getResolvedNum() + a.getResolvedNum()); + a.setResolvedRatio(getRatio(a.getResolvedNum(),a.getProjectTotal())); + a.setBadRatio(getRatio(a.getBadTotal(),a.getEvaluateTotal())); + a.setGoodRatio(getRatio(a.getGoodTotal(),a.getEvaluateTotal())); + } + }); + }); + log.info(agencyInfos.toString()); + del(customerId, dateId); + insert(agencyInfos,customerId,dateId); + } + + /** + * @Description 组织直接立项处理 + * @Param agencyInfos + * @Param dateId + * @author zxc + * @date 2021/4/16 上午9:15 + */ + public List disposeCreateProject(List agencyInfos,String dateId){ List orgIds = agencyInfos.stream().map(m -> m.getOrgId()).collect(Collectors.toList()); - // 查询 项目总数 List projectTotal = projectMainDailyService.selectProjectTotalByOrg(orgIds, dateId, null); - // 查询 项目解决数 List resolvedNum = projectMainDailyService.selectResolvedNumByOrg(orgIds, dateId); //查询 参与满意度评价的总次数 String[] activeCodesAll = {PingYinConstants.EVALUATE_BAD,PingYinConstants.EVALUATE_GOOD,PingYinConstants.EVALUATE_PERFECT}; @@ -190,61 +299,50 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl evaluateGood = projectMainDailyService.selectEvaluateCountByOrg(orgIds, dateId, getActiveCode(activeCodesGood)); - projectOrgDaily.forEach(p -> { - // 参与满意度评价的总次数 - if (!CollectionUtils.isEmpty(evaluateTotal)){ - evaluateTotal.forEach(e -> { - if (p.getOrgId().equals(e.getOrgId())){ - p.setEvaluateTotal(p.getEvaluateTotal() + e.getEvaluateCount()); + agencyInfos.forEach(a -> { + // 项目总数 + if (!CollectionUtils.isEmpty(projectTotal)){ + projectTotal.forEach(p -> { + if (a.getOrgId().equals(p.getOrgId())){ + a.setProjectTotal(p.getProjectTotal()); } }); } - // 满意+非常满意的总次数 - if (!CollectionUtils.isEmpty(evaluateGood)){ - evaluateGood.forEach(e -> { - if (p.getOrgId().equals(e.getOrgId())){ - p.setGoodTotal(p.getGoodTotal() + e.getEvaluateCount()); + // 未解决项目数 + if (!CollectionUtils.isEmpty(resolvedNum)){ + resolvedNum.forEach(r -> { + if (a.getOrgId().equals(r.getOrgId())){ + a.setResolvedNum(r.getResolvedNum()); } }); } - // 项目总数 - if (!CollectionUtils.isEmpty(projectTotal)) { - projectTotal.forEach(t -> { - if (p.getOrgId().equals(t.getOrgId())){ - p.setProjectTotal(p.getProjectTotal() + t.getProjectTotal()); + // 参与满意度评价的总次数 + if (!CollectionUtils.isEmpty(evaluateTotal)){ + evaluateTotal.forEach(e -> { + if (a.getOrgId().equals(e.getOrgId())){ + a.setEvaluateTotal(e.getEvaluateCount()); } }); } - // 已解决的项目总数 - if (!CollectionUtils.isEmpty(resolvedNum)){ - resolvedNum.forEach(r -> { - if (p.getOrgId().equals(r.getOrgId())){ - p.setResolvedNum(p.getResolvedNum() + r.getResolvedNum()); + + // 满意+非常满意的总次数 + if (!CollectionUtils.isEmpty(evaluateGood)){ + evaluateGood.forEach(e -> { + if (a.getOrgId().equals(e.getOrgId())){ + a.setGoodTotal(e.getEvaluateCount()); } }); } + // 解决率 + a.setResolvedRatio(getRatio(a.getResolvedNum(),a.getProjectTotal())); // 不满意总次数 - p.setBadTotal(p.getEvaluateTotal() - p.getGoodTotal()); - }); - log.info(projectOrgDaily.toString()); - agencyInfos.forEach(a -> { - a.setDateId(dateId); - projectOrgDaily.forEach(p -> { - if (a.getAreaCode().equals(p.getAreaCode())){ - a.setResolvedRatio(getRatio(p.getResolvedNum(),p.getProjectTotal())); - a.setBadRatio(getRatio(p.getBadTotal(),p.getEvaluateTotal())); - a.setGoodRatio(getRatio(p.getGoodTotal(),p.getEvaluateTotal())); - a.setBadTotal(p.getBadTotal()); - a.setEvaluateTotal(p.getEvaluateTotal()); - a.setGoodTotal(p.getGoodTotal()); - a.setProjectTotal(p.getProjectTotal()); - a.setResolvedNum(p.getResolvedNum()); - } - }); + a.setBadTotal(a.getEvaluateTotal()==NumConstant.ZERO ? NumConstant.ZERO : a.getEvaluateTotal() - a.getGoodTotal()); + // 满意率 + a.setGoodRatio(getRatio(a.getGoodTotal(),a.getEvaluateTotal())); + // 不满意率 + a.setBadRatio(getRatio(a.getBadTotal(),a.getEvaluateTotal())); }); - log.info(agencyInfos.toString()); - del(customerId, dateId); - insert(agencyInfos,customerId,dateId); + return agencyInfos; } /** diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectQuantityOrgMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectQuantityOrgMonthlyServiceImpl.java index 241e23f6e6..b03f7f65b8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectQuantityOrgMonthlyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectQuantityOrgMonthlyServiceImpl.java @@ -29,13 +29,14 @@ import com.epmet.constant.DataSourceConstant; import com.epmet.constant.PingYinConstants; import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao; import com.epmet.dao.evaluationindex.screen.ScreenProjectQuantityOrgMonthlyDao; -import com.epmet.dto.pingyin.result.ProjectOrgMonthlyResultDTO; +import com.epmet.dto.pingyin.result.*; import com.epmet.dto.screen.ScreenProjectOrgDailyDTO; import com.epmet.dto.screen.ScreenProjectQuantityOrgMonthlyDTO; import com.epmet.dto.screencoll.ScreenCollFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenProjectQuantityOrgMonthlyEntity; import com.epmet.entity.org.CustomerAgencyEntity; import com.epmet.service.crm.CustomerRelationService; +import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService; import com.epmet.service.evaluationindex.screen.ScreenProjectQuantityOrgMonthlyService; import com.epmet.service.org.CustomerAgencyService; import com.google.common.collect.Lists; @@ -51,6 +52,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 项目(事件)数量分析按组织_按月统计 @@ -69,6 +71,9 @@ public class ScreenProjectQuantityOrgMonthlyServiceImpl extends BaseServiceImpl< private CustomerRelationService customerRelationService; @Autowired private CustomerAgencyService customerAgencyService; + @Autowired + private FactOriginProjectMainDailyService projectMainDailyService; + @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -144,7 +149,7 @@ public class ScreenProjectQuantityOrgMonthlyServiceImpl extends BaseServiceImpl< } /** - * @Description 数据抽取【组织-月】 + * @Description 数据抽取【组织-月】,目前单客户和多客户处理是一样的,只是查询sql不一样,现在分开为了以后修改方便 * @Param customerId * @Param monthId * @author zxc @@ -152,14 +157,95 @@ public class ScreenProjectQuantityOrgMonthlyServiceImpl extends BaseServiceImpl< */ @Override public void extractionProjectOrgMonthly(String customerId, String monthId) { - List screenProjectOrgDailyDTOS = new ArrayList<>(); - //如果有子客户要按照跟组织的area_code查询组织列表 if(customerRelationService.haveSubCustomer(customerId)){ - CustomerAgencyEntity rootAgency=customerAgencyService.getRootAgencyInfo(customerId); - screenProjectOrgDailyDTOS=agencyDao.selectAgencyByAreaCode(rootAgency.getAreaCode()); + // 多客户处理 + extractionProjectOrgMonthlyMoreCustomer(customerId, monthId); }else{ - screenProjectOrgDailyDTOS=agencyDao.selectAgencyByCustomer(customerId); + // 单客户处理 + extractionProjectOrgMonthlyOneCustomer(customerId, monthId); } + } + + /** + * @Description 单客户处理 + * @Param customerId + * @Param monthId + * @author zxc + * @date 2021/4/15 下午2:18 + */ + public void extractionProjectOrgMonthlyOneCustomer(String customerId,String monthId){ + List screenProjectOrgDailyDTOS=agencyDao.selectAgencyByCustomer(customerId); + if (CollectionUtils.isEmpty(screenProjectOrgDailyDTOS)){ + log.warn(String.format(PingYinConstants.AGENCY_INFO_IS_ZERO,customerId)); + return; + } + + List agencyInfos = ConvertUtils.sourceToTarget(screenProjectOrgDailyDTOS, ScreenProjectQuantityOrgMonthlyDTO.class); + List projectOrg = baseDao.selectQuantityOrgMonthlyByAgency(agencyInfos, monthId); + if (!CollectionUtils.isEmpty(projectOrg)){ + projectOrg.forEach(p -> { + p.setClosedIncr(p.getClosedIncr()); + p.setProjectIncr(p.getProjectIncr()); + }); + } + List projectGrandOrg = baseDao.selectQuantityGrandOrgMonthly(agencyInfos, monthId); + 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()); + } + }); + } + 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()); + } + }); + } + }); + // 直接立项处理 + List agencyCreateProject = agencyCreateProject(agencyInfos, monthId); + agencyInfos.forEach(a -> { + agencyCreateProject.forEach(p -> { + if (a.getOrgId().equals(p.getOrgId())){ + a.setProjectIncr(a.getProjectIncr() + p.getProjectIncr()); + a.setProjectTotal(a.getProjectTotal() + p.getProjectTotal()); + a.setUnClosedTotal(a.getUnClosedTotal() + p.getUnClosedTotal()); + a.setClosedTotal(a.getClosedTotal() + p.getClosedTotal()); + a.setClosedIncr(a.getClosedIncr() + p.getClosedIncr()); + } + }); + }); + log.info(agencyInfos.toString()); + del(customerId, monthId); + insert(agencyInfos,customerId,monthId); + } + + /** + * @Description 多客户处理 + * @Param customerId + * @Param monthId + * @author zxc + * @date 2021/4/15 下午2:18 + */ + public void extractionProjectOrgMonthlyMoreCustomer(String customerId,String monthId){ + CustomerAgencyEntity rootAgency=customerAgencyService.getRootAgencyInfo(customerId); + List screenProjectOrgDailyDTOS=agencyDao.selectAgencyByAreaCode(rootAgency.getAreaCode()); if (CollectionUtils.isEmpty(screenProjectOrgDailyDTOS)){ log.warn(String.format(PingYinConstants.AGENCY_INFO_IS_ZERO,customerId)); return; @@ -203,11 +289,89 @@ public class ScreenProjectQuantityOrgMonthlyServiceImpl extends BaseServiceImpl< }); } }); + List parentAgency = agencyDao.selectAgencyByCustomer(customerId); + List parentAgencyInfos = ConvertUtils.sourceToTarget(parentAgency, ScreenProjectQuantityOrgMonthlyDTO.class); + List agencyCreateProject = agencyCreateProject(parentAgencyInfos, monthId); + agencyInfos.forEach(a -> { + agencyCreateProject.forEach(p -> { + if (a.getOrgId().equals(p.getOrgId())){ + a.setProjectIncr(a.getProjectIncr() + p.getProjectIncr()); + a.setProjectTotal(a.getProjectTotal() + p.getProjectTotal()); + a.setUnClosedTotal(a.getUnClosedTotal() + p.getUnClosedTotal()); + a.setClosedTotal(a.getClosedTotal() + p.getClosedTotal()); + a.setClosedIncr(a.getClosedIncr() + p.getClosedIncr()); + } + }); + }); log.info(agencyInfos.toString()); del(customerId, monthId); insert(agencyInfos,customerId,monthId); } + /** + * @Description 组织直接立项处理 + * @Param agencyInfos + * @Param monthId + * @author zxc + * @date 2021/4/16 上午10:03 + */ + public List agencyCreateProject(List agencyInfos, String monthId){ + List orgIds = agencyInfos.stream().map(m -> m.getOrgId()).collect(Collectors.toList()); + // 本月新增的项目数量 转项目日期在当前月份内 + List projectIncr = projectMainDailyService.selectProjectIncrByOrg(orgIds, monthId); + // 截止到当前月份:累计项目总数 + List projectTotal = projectMainDailyService.selectProjectTotalByOrg(orgIds, null, monthId); + // 截止到当前月份:累计未结项目总数 + List projectUnClosed = projectMainDailyService.selectProjectCountByOrg(orgIds, monthId, PingYinConstants.UN_CLOSED); + // 截止到当前月份:累计已结项目 + List projectClosed = projectMainDailyService.selectProjectCountByOrg(orgIds, monthId, PingYinConstants.CLOSED); + // 本月新增结案项目数 + List closedIncr = projectMainDailyService.selectClosedIncrByOrg(orgIds, monthId); + agencyInfos.forEach(a -> { + a.setMonthId(monthId); + if (!CollectionUtils.isEmpty(projectIncr)){ + projectIncr.forEach(p -> { + if (a.getOrgId().equals(p.getOrgId())){ + a.setProjectIncr(p.getProjectIncr()); + } + }); + } + // 截止到当前月份:累计项目总数 + if (!CollectionUtils.isEmpty(projectTotal)){ + projectTotal.forEach(p -> { + if (a.getOrgId().equals(p.getOrgId())){ + a.setProjectTotal(p.getProjectTotal()); + } + }); + } + // 截止到当前月份:累计未结项目总数 + if (!CollectionUtils.isEmpty(projectUnClosed)){ + projectUnClosed.forEach(p -> { + if (a.getOrgId().equals(p.getOrgId())){ + a.setUnClosedTotal(p.getProjectCount()); + } + }); + } + // 截止到当前月份:累计已结项目 + if (!CollectionUtils.isEmpty(projectClosed)){ + projectClosed.forEach(p -> { + if (a.getOrgId().equals(p.getOrgId())){ + a.setClosedTotal(p.getProjectCount()); + } + }); + } + // 本月新增结案项目数 + if (!CollectionUtils.isEmpty(closedIncr)){ + closedIncr.forEach(p -> { + if (a.getOrgId().equals(p.getOrgId())){ + a.setClosedIncr(p.getClosedIncr()); + } + }); + } + }); + return agencyInfos; + } + @Transactional(rollbackFor = Exception.class) public void del(String customerId,String monthId){ Integer flag; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml index a2aa82a555..8115c5d1ce 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml @@ -75,7 +75,7 @@ P.PIDS, COUNT(DISTINCT p.ID) AS projectTotal FROM fact_origin_project_main_daily p - LEFT JOIN fact_origin_project_category_daily c ON ( c.PROJECT_Id = p.id AND p.del_flag='0' AND p.GRID_ID IS NULL) + LEFT JOIN fact_origin_project_category_daily c ON ( c.PROJECT_Id = p.id AND p.del_flag='0' AND p.GRID_ID = '') WHERE c.DEL_FLAG = '0' AND c.CUSTOMER_ID = #{customerId} AND ( @@ -95,7 +95,7 @@ P.PIDS, COUNT(distinct p.ID) AS projectTotal FROM fact_origin_project_main_daily p - LEFT JOIN fact_origin_project_category_daily c ON ( c.PROJECT_Id = p.id AND p.del_flag='0' AND p.GRID_ID IS NULL) + LEFT JOIN fact_origin_project_category_daily c ON ( c.PROJECT_Id = p.id AND p.del_flag='0' AND p.GRID_ID = '') WHERE c.DEL_FLAG = '0' AND c.CUSTOMER_ID = #{customerId} AND ( diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml index 18635a23df..4e2d66473a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml @@ -459,7 +459,7 @@ SELECT - GRID_ID, + GRID_ID AS orgId, COUNT(ID) AS resolvedNum FROM fact_origin_project_main_daily WHERE DEL_FLAG = 0 @@ -614,7 +614,7 @@ IFNULL(COUNT(m.ID),0) AS projectTotal FROM fact_origin_project_main_daily m WHERE m.DEL_FLAG = 0 - AND m.GRID_ID IS NULL + AND m.GRID_ID = '' AND ( m.AGENCY_ID = #{orgId} @@ -639,7 +639,12 @@ AND DATE_ID #{dateId} AND PROJECT_STATUS = 'closed' AND IS_RESOLVED = 'resolved' - AND GRID_ID IS NULL + AND ( + + AGENCY_ID = #{orgId} + + ) + AND GRID_ID = '' GROUP BY AGENCY_ID @@ -666,4 +671,63 @@ GROUP BY ORG_ID + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectOrgDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectOrgDailyDao.xml index 3ec91a496a..0700977462 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectOrgDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectOrgDailyDao.xml @@ -125,6 +125,23 @@ AND g.DATE_ID #{dateId} + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectQuantityOrgMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectQuantityOrgMonthlyDao.xml index 7e0a5cee0e..17385c6462 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectQuantityOrgMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectQuantityOrgMonthlyDao.xml @@ -127,5 +127,35 @@ + + + + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java index c426bc6d41..21867756d5 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java @@ -59,28 +59,32 @@ public class AddAgencyV2FormDTO implements Serializable { @NotBlank(message = "请选择组织区划", groups = AreaCodeGroup.class) private String areaCode; - /** - * 省份 - */ - private String province; - - /** - * 城市 - */ - private String city; - - /** - * 区县 - */ - private String district; - - /** - * 街道 - */ - private String street; - - /** - * 社区 - */ - private String community; + // /** + // * 省份 + // */ + // private String province; + // + // /** + // * 城市 + // */ + // private String city; + // + // /** + // * 区县 + // */ + // private String district; + // + // /** + // * 街道 + // */ + // private String street; + // + // /** + // * 社区 + // */ + // private String community; + + //区域编码名称 + @NotBlank(message = "", groups = AreaCodeGroup.class) + private String areaName; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java index 276099576a..66984fc62e 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java @@ -17,6 +17,7 @@ package com.epmet.dto.form; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; import org.hibernate.validator.constraints.Length; @@ -33,23 +34,29 @@ import java.io.Serializable; public class EditAgencyFormDTO implements Serializable { private static final long serialVersionUID = 1L; + public interface AddUserInternalGroup { + } + + public interface DefaultUserShowGroup extends CustomerClientShowGroup { + } /** * 机关组织Id */ - @NotBlank(message = "机关组织ID不能为空") + @NotBlank(message = "机关组织ID不能为空", groups = AddUserInternalGroup.class) private String agencyId; /** * 机关组织名称 */ @NotBlank(message = "机关组织名称不能为空") - @Length(max=50,message = "机构名称不能超过50个字") + @Length(max=50,message = "机构名称不能超过50个字",groups = DefaultUserShowGroup.class) private String agencyName; /** * token中用户Id */ + @NotBlank(message = "tokenDto获取userId为空", groups = AddUserInternalGroup.class) private String userId; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentDetailResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentDetailResultDTO.java index 8d7ab9dff2..11271d8009 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentDetailResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentDetailResultDTO.java @@ -58,5 +58,6 @@ public class DepartmentDetailResultDTO implements Serializable { */ private List staffList; + private String areaCode; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java index 74e095de3e..b0ec95dfd2 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java @@ -93,13 +93,13 @@ public class AgencyController { **/ @PostMapping("addagency-v2") @RequirePermission(requirePermission = RequirePermissionEnum.ORG_SUBAGENCY_CREATE) - public Result addAgencyV2(@RequestBody AddAgencyV2FormDTO formDTO) { + public Result addAgencyV2(@LoginUser TokenDto tokenDTO,@RequestBody AddAgencyV2FormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, AddAgencyV2FormDTO.DefaultUserShowGroup.class, AddAgencyV2FormDTO.AddUserInternalGroup.class); if (formDTO.getAreaCodeSwitch().equals(CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN)) { ValidatorUtils.validateEntity(formDTO, AddAgencyV2FormDTO.AreaCodeGroup.class); } - //组织名称是否存在 - customerAgencyService.checkAgencyName(formDTO.getAgencyName()); + //当前客户下,同级组织中,组织名称不允许重复 + customerAgencyService.checkAgencyName(formDTO.getAgencyName(),tokenDTO.getCustomerId(),formDTO.getLevel(),null); return new Result().ok(agencyService.addAgencyV2(formDTO)); } @@ -127,7 +127,7 @@ public class AgencyController { @RequirePermission(requirePermission = RequirePermissionEnum.ORG_AGENCY_UPDATE) public Result editAgency(@LoginUser TokenDto tokenDTO, @RequestBody EditAgencyFormDTO formDTO) { formDTO.setUserId(tokenDTO.getUserId()); - ValidatorUtils.validateEntity(formDTO); + ValidatorUtils.validateEntity(formDTO, EditAgencyFormDTO.DefaultUserShowGroup.class, EditAgencyFormDTO.AddUserInternalGroup.class); return agencyService.editAgency(formDTO); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index f9742f72e3..bdc8814ff4 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java @@ -225,5 +225,11 @@ public interface CustomerAgencyDao extends BaseDao { **/ int delByAgencyId(@Param("agencyId") String agencyId, @Param("operateUserId") String operateUserId); - List selectAgencyIdsByAreaCode(String areaCode); + List selectAgencyIdsByAreaCode(@Param("areaCode") String areaCode, + @Param("agencyId") String agencyId); + + List checkAgencyName(@Param("agencyName") String agencyName, + @Param("customerId") String customerId, + @Param("level") String level, + @Param("agencyId") String agencyId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index 464c46c8dc..59941f1f60 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -235,5 +235,5 @@ public interface CustomerAgencyService extends BaseService **/ OrganizeTreeResultDTO organizeTree(String agencyId); - void checkAgencyName(String agencyName); + void checkAgencyName(String agencyName,String customerId,String level,String agencyId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index 155bad550c..e83b78ba77 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -51,7 +51,6 @@ import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Arrays; -import java.util.Date; import java.util.List; /** @@ -133,9 +132,12 @@ public class AgencyServiceImpl implements AgencyService { @Transactional(rollbackFor = Exception.class) public Result editAgency(EditAgencyFormDTO formDTO) { Result result = new Result(); - CustomerAgencyEntity entity = getUpdateEntity(formDTO); + CustomerAgencyEntity originalEntity = customerAgencyDao.selectById(formDTO.getAgencyId()); + //当前客户下,同级组织中,组织名称不允许重复 + customerAgencyService.checkAgencyName(formDTO.getAgencyName(),originalEntity.getCustomerId(),originalEntity.getLevel(),originalEntity.getId()); + originalEntity.setOrganizationName(formDTO.getAgencyName()); //1:更新当前组织信息 - if (customerAgencyDao.updateById(entity) < NumConstant.ONE) { + if (customerAgencyDao.updateById(originalEntity) < NumConstant.ONE) { log.error(CustomerAgencyConstant.UPDATE_EXCEPTION); throw new RenException(CustomerAgencyConstant.UPDATE_EXCEPTION); } @@ -148,7 +150,6 @@ public class AgencyServiceImpl implements AgencyService { } //3:循环组织列表,查询每一个组织的所有上级组织重新拼接所有上级名称(allParentName)字段值 List editList = new ArrayList<>(); - Date date = new Date(); agencyList.forEach(agency->{ //3-1:查询当前组织的所有上级组织 List listStr = Arrays.asList(agency.getPids().split(":")); @@ -178,12 +179,6 @@ public class AgencyServiceImpl implements AgencyService { return result; } - private CustomerAgencyEntity getUpdateEntity(EditAgencyFormDTO formDTO) { - CustomerAgencyEntity entity = customerAgencyDao.selectById(formDTO.getAgencyId()); - entity.setOrganizationName(formDTO.getAgencyName()); - return entity; - } - /** * @param formDTO * @return @@ -251,9 +246,37 @@ public class AgencyServiceImpl implements AgencyService { parentList = customerAgencyDao.selectPAgencyById(listStr); agencysResultDTO.setParentList(parentList); agencysResultDTO.setAreaCodeSwitch(customerOrgParameterService.getAreaCodeSwitch(entity.getCustomerId())); + agencysResultDTO.setAreaName(StrConstant.EPMETY_STR); + agencysResultDTO.setAreaCode(StringUtils.isNotBlank(entity.getAreaCode())?entity.getAreaCode():StrConstant.EPMETY_STR); + //查询组织区划的名称 + if (null != entity && StringUtils.isNotBlank(entity.getAreaCode())) { + switch (entity.getLevel()) { + case CustomerAgencyConstant.PROVINCE_LEVEL: + agencysResultDTO.setAreaName(null == entity.getProvince() ? StrConstant.EPMETY_STR : entity.getProvince()); + break; + case CustomerAgencyConstant.CITY_LEVEL: + agencysResultDTO.setAreaName(null == entity.getCity() ? StrConstant.EPMETY_STR : entity.getCity()); + break; + case CustomerAgencyConstant.DISTRICT: + agencysResultDTO.setAreaName(null == entity.getDistrict() ? StrConstant.EPMETY_STR : entity.getDistrict()); + break; + case CustomerAgencyConstant.STREET_LEVEL: + agencysResultDTO.setAreaName(null == entity.getStreet() ? StrConstant.EPMETY_STR : entity.getStreet()); + break; + case CustomerAgencyConstant.COMMUNITY_LEVEL: + agencysResultDTO.setAreaName(null == entity.getCommunity() ? StrConstant.EPMETY_STR : entity.getCommunity()); + break; + default: + agencysResultDTO.setAreaName(StrConstant.EPMETY_STR); + } + } return new Result().ok(agencysResultDTO); } + public static void main(String[] args) { + String m="1234"; + System.out.println(m.equals("1234") ? "yes" : "no"); + } /** * @param formDTO * @return @@ -407,7 +430,7 @@ public class AgencyServiceImpl implements AgencyService { public AddAgencyResultDTO addAgencyV2(AddAgencyV2FormDTO formDTO) { CustomerAgencyDTO parent = customerAgencyService.get(formDTO.getParentAgencyId()); if (null == parent) { - throw new RenException(String.format("添加组织失败:没有找到跟组织信息,parentAgencyId=%s", formDTO.getParentAgencyId())); + throw new RenException(String.format("添加组织失败:没有找到上级组织信息,agencyId=%s", formDTO.getParentAgencyId())); } AddAgencyResultDTO resultDTO = new AddAgencyResultDTO(); resultDTO.setAreaCodeSwitch(formDTO.getAreaCodeSwitch()); @@ -416,7 +439,7 @@ public class AgencyServiceImpl implements AgencyService { if (CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN.equals(formDTO.getAreaCodeSwitch())) { //校验areaCode是否被使用过 if (!"other".equals(formDTO.getAreaCode())) { - List agencyIds = customerAgencyDao.selectAgencyIdsByAreaCode(insertEntity.getAreaCode()); + List agencyIds = customerAgencyDao.selectAgencyIdsByAreaCode(insertEntity.getAreaCode(),null); if (CollectionUtils.isNotEmpty(agencyIds)) { //已经被占用,提示 throw new RenException(EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getCode(), EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getMsg()); @@ -437,7 +460,7 @@ public class AgencyServiceImpl implements AgencyService { customerAgencyDao.insert(insertEntity); //3:返回新组织Id resultDTO.setAgencyId(insertEntity.getId()); - resultDTO.setAreaCode(StrConstant.EPMETY_STR); + resultDTO.setAreaCode(insertEntity.getAreaCode()); return resultDTO; } @@ -460,15 +483,29 @@ public class AgencyServiceImpl implements AgencyService { { case CustomerAgencyConstant.PROVINCE_LEVEL: insertEntity.setLevel(CustomerAgencyConstant.CITY_LEVEL); + insertEntity.setProvince(parent.getProvince()); + insertEntity.setCity(formDTO.getAreaName()); break; case CustomerAgencyConstant.CITY_LEVEL: insertEntity.setLevel(CustomerAgencyConstant.DISTRICT); + insertEntity.setProvince(parent.getProvince()); + insertEntity.setCity(parent.getCity()); + insertEntity.setDistrict(formDTO.getAreaName()); break; case CustomerAgencyConstant.DISTRICT: insertEntity.setLevel(CustomerAgencyConstant.STREET_LEVEL); + insertEntity.setProvince(parent.getProvince()); + insertEntity.setCity(parent.getCity()); + insertEntity.setDistrict(parent.getDistrict()); + insertEntity.setStreet(formDTO.getAreaName()); break; case CustomerAgencyConstant.STREET_LEVEL: insertEntity.setLevel(CustomerAgencyConstant.COMMUNITY_LEVEL); + insertEntity.setProvince(parent.getProvince()); + insertEntity.setCity(parent.getCity()); + insertEntity.setDistrict(parent.getDistrict()); + insertEntity.setStreet(parent.getStreet()); + insertEntity.setCommunity(formDTO.getAreaName()); break; default: log.info("parent.getLevel()="+parent.getLevel()); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index dc81a51b47..3753412331 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -1060,10 +1060,8 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(agencyName), "ORGANIZATION_NAME", agencyName); - List entityList = baseDao.selectList(wrapper); + public void checkAgencyName(String agencyName,String customerId,String level,String agencyId) { + List entityList = baseDao.checkAgencyName(agencyName,customerId,level,agencyId); if (CollectionUtils.isNotEmpty(entityList)) { throw new RenException(EpmetErrorCode.AGENCY_NAME_ALREADY_EXISTS.getCode(), EpmetErrorCode.AGENCY_NAME_ALREADY_EXISTS.getMsg()); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index 27d446f644..ea6f94a1e8 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml @@ -408,5 +408,23 @@ WHERE ca.DEL_FLAG = '0' AND ca.AREA_CODE = #{areaCode} + + AND ca.id !=#{agencyId} + + + + \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectApprovalFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectApprovalFormDTO.java index d86d4873c1..dd2001e970 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectApprovalFormDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectApprovalFormDTO.java @@ -18,6 +18,7 @@ public class ProjectApprovalFormDTO implements Serializable { public interface ApprovalCategory{} @NotBlank(message = "项目标题不能为空",groups = {ApprovalCategory.class}) + @Length(max=20,message = "项目标题不能超过20位") private String title; @NotBlank(message = "项目背景不能为空",groups = {ApprovalCategory.class}) diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java index 199d762a85..a91cc3513b 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java @@ -351,6 +351,7 @@ public class ProjectTraceController { * @Description 项目立项 **/ @PostMapping("projectapproval") + @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PROJECT_APPROVAL) public Result projectApproval(@LoginUser TokenDto tokenDTO, @RequestBody ProjectApprovalFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO,ProjectApprovalFormDTO.ApprovalCategory.class); formDTO.setCustomerId(tokenDTO.getCustomerId());