Browse Source

Merge remote-tracking branch 'origin/dev_temp' into dev_temp

master
jianjun 4 years ago
parent
commit
60d90ea9ce
  1. 7
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java
  2. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  3. 7
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/NextAreaCodeFormDTO.java
  4. 9
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  5. 2
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/ClosedIncrResultDTO.java
  6. 2
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/ProjectIncrResultDTO.java
  7. 2
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/UnClosedTotalResultDTO.java
  8. 11
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectOrgDailyDTO.java
  9. 28
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java
  10. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectOrgDailyDao.java
  11. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectQuantityOrgMonthlyDao.java
  12. 28
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java
  13. 49
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java
  14. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java
  15. 198
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java
  16. 178
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectQuantityOrgMonthlyServiceImpl.java
  17. 4
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml
  18. 72
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml
  19. 17
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectOrgDailyDao.xml
  20. 30
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectQuantityOrgMonthlyDao.xml
  21. 52
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java
  22. 11
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java
  23. 1
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentDetailResultDTO.java
  24. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java
  25. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  26. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  27. 63
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
  28. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  29. 18
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  30. 1
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectApprovalFormDTO.java
  31. 1
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java

7
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;

3
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, "请求第三方平台错误"),

7
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;
}

9
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<NextAreaCodeResultDTO> 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<NextAreaCodeResultDTO> allList = areaCodeService.queryNextLevelAreaCodeList(formDTO);
if (CollectionUtils.isNotEmpty(allList)) {

2
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;
}

2
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;
}

2
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;
}

11
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;
}
}

28
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<FactOriginProject
*/
List<ProjectIncrResultDTO> selectProjectIncr(@Param("customerId")String customerId, @Param("monthId")String monthId);
/**
* @Description 组织查询本月新增项目数
* @Param orgIds
* @Param monthId
* @author zxc
* @date 2021/4/16 上午9:21
*/
List<ProjectIncrResultDTO> selectProjectIncrByOrg(@Param("orgIds") List<String> orgIds, @Param("monthId")String monthId);
/**
* @Description 根据状态查询项目数
* @Param customerId
@ -296,6 +305,16 @@ public interface FactOriginProjectMainDailyDao extends BaseDao<FactOriginProject
*/
List<UnClosedTotalResultDTO> 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<UnClosedTotalResultDTO> selectProjectCountByOrg(@Param("orgIds") List<String> orgIds, @Param("monthId")String monthId, @Param("status") String status);
/**
* @Description 本月新增结案项目数
* @Param customerId
@ -305,6 +324,15 @@ public interface FactOriginProjectMainDailyDao extends BaseDao<FactOriginProject
*/
List<ClosedIncrResultDTO> selectClosedIncr(@Param("customerId")String customerId, @Param("monthId")String monthId);
/**
* @Description 组织本月新增结案项目数
* @Param orgIds
* @Param monthId
* @author zxc
* @date 2021/4/16 上午9:35
*/
List<ClosedIncrResultDTO> selectClosedIncrByOrg(@Param("orgIds") List<String> orgIds, @Param("monthId")String monthId);
/**
* @Description 初始化screen_project_data数据
* 如果是dateId不为空则查询前一天的数据

1
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<ScreenProjectOrgDailyE
* @date 2021/2/1 下午3:51
*/
List<ProjectOrgDailyResultDTO> selectOrgProject(@Param("agencyInfos") List<ScreenProjectOrgDailyDTO> agencyInfos, @Param("dateId") String dateId);
List<ProjectOrgDailyResultDTO> selectOrgProjectByAgency(@Param("agencyInfos") List<ScreenProjectOrgDailyDTO> agencyInfos, @Param("dateId") String dateId);
}

2
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<ScreenProjec
* @date 2021/2/2 上午11:09
*/
List<ProjectOrgMonthlyResultDTO> selectQuantityOrgMonthly(@Param("agencyInfos") List<ScreenProjectQuantityOrgMonthlyDTO> agencyInfos, @Param("monthId") String monthId);
List<ProjectOrgMonthlyResultDTO> selectQuantityOrgMonthlyByAgency(@Param("agencyInfos") List<ScreenProjectQuantityOrgMonthlyDTO> agencyInfos, @Param("monthId") String monthId);
/**
* @Description 项目(事件)数量查询本月之前的累计
@ -58,6 +59,7 @@ public interface ScreenProjectQuantityOrgMonthlyDao extends BaseDao<ScreenProjec
* @date 2021/2/2 下午3:03
*/
List<ProjectOrgMonthlyResultDTO> selectQuantityGrandOrgMonthly(@Param("agencyInfos") List<ScreenProjectQuantityOrgMonthlyDTO> agencyInfos, @Param("monthId") String monthId);
List<ProjectOrgMonthlyResultDTO> selectQuantityGrandOrgMonthlyByAgency(@Param("agencyInfos") List<ScreenProjectQuantityOrgMonthlyDTO> agencyInfos, @Param("monthId") String monthId);
}

28
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<FactOrigi
*/
List<ProjectIncrResultDTO> selectProjectIncr(String customerId, String monthId);
/**
* @Description 组织查询本月新增项目数
* @Param orgIds
* @Param monthId
* @author zxc
* @date 2021/4/16 上午9:19
*/
List<ProjectIncrResultDTO> selectProjectIncrByOrg(List<String> orgIds, String monthId);
/**
* @Description 根据状态查询项目数
* @Param customerId
@ -281,6 +290,16 @@ public interface FactOriginProjectMainDailyService extends BaseService<FactOrigi
*/
List<UnClosedTotalResultDTO> selectProjectCount(String customerId, String monthId, String status);
/**
* @Description 组织根据状态查询项目数
* @Param orgIds
* @Param monthId
* @Param status
* @author zxc
* @date 2021/4/16 上午9:24
*/
List<UnClosedTotalResultDTO> selectProjectCountByOrg(List<String> orgIds, String monthId, String status);
/**
* @Description 本月新增结案项目数
* @Param customerId
@ -290,6 +309,15 @@ public interface FactOriginProjectMainDailyService extends BaseService<FactOrigi
*/
List<ClosedIncrResultDTO> selectClosedIncr(String customerId, String monthId);
/**
* @Description 组织本月新增结案项目数
* @Param orgIds
* @Param monthId
* @author zxc
* @date 2021/4/16 上午9:33
*/
List<ClosedIncrResultDTO> selectClosedIncrByOrg(List<String> orgIds, String monthId);
/**
* @Description 初始化screen_project_data数据
* 如果是dateId不为空则查询前一天的数据

49
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<FactO
return new ArrayList<>();
}
/**
* @Description 组织查询本月新增项目数
* @Param orgIds
* @Param monthId
* @author zxc
* @date 2021/4/16 上午9:19
*/
@Override
public List<ProjectIncrResultDTO> selectProjectIncrByOrg(List<String> orgIds, String monthId) {
if (!CollectionUtils.isEmpty(orgIds) && StringUtils.isNotBlank(monthId)){
List<ProjectIncrResultDTO> projectIncrResultDTOS = baseDao.selectProjectIncrByOrg(orgIds, monthId);
return projectIncrResultDTOS;
}
return new ArrayList<>();
}
/**
* @Description 根据状态查询项目数
* @Param customerId
@ -346,6 +362,23 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl<FactO
return new ArrayList<>();
}
/**
* @Description 组织根据状态查询项目数
* @Param orgIds
* @Param monthId
* @Param status
* @author zxc
* @date 2021/4/16 上午9:24
*/
@Override
public List<UnClosedTotalResultDTO> selectProjectCountByOrg(List<String> orgIds, String monthId, String status) {
if (!CollectionUtils.isEmpty(orgIds) && StringUtils.isNotBlank(monthId)){
List<UnClosedTotalResultDTO> resultDTOS = baseDao.selectProjectCountByOrg(orgIds, monthId, status);
return resultDTOS;
}
return new ArrayList<>();
}
/**
* @Description 本月新增结案项目数
* @Param customerId
@ -362,6 +395,22 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl<FactO
return new ArrayList<>();
}
/**
* @Description 组织本月新增结案项目数
* @Param orgIds
* @Param monthId
* @author zxc
* @date 2021/4/16 上午9:33
*/
@Override
public List<ClosedIncrResultDTO> selectClosedIncrByOrg(List<String> orgIds, String monthId) {
if (!CollectionUtils.isEmpty(orgIds) && StringUtils.isNotBlank(monthId)){
List<ClosedIncrResultDTO> result = baseDao.selectClosedIncrByOrg(orgIds, monthId);
return result;
}
return new ArrayList<>();
}
/**
* @Description 初始化screen_project_data数据
* 如果是dateId不为空则查询前一天的数据

1
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());
}

198
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<ScreenProj
}
/**
* @Description 数据抽取机关-
* @Description 数据抽取机关-目前单客户和多客户处理是一样的只是查询sql不一样现在分开为了以后修改方便
* @Param customerId
* @Param dateId
* @author zxc
@ -161,15 +162,79 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl<ScreenProj
*/
@Override
public void extractionProjectOrgDaily(String customerId, String dateId) {
List<ScreenProjectOrgDailyDTO> 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<ScreenProjectOrgDailyDTO> agencyInfos = agencyDao.selectAgencyByCustomer(customerId);
if (CollectionUtils.isEmpty(agencyInfos)){
log.warn(String.format(PingYinConstants.AGENCY_INFO_IS_ZERO,customerId));
return;
}
List<ProjectOrgDailyResultDTO> 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<ScreenProjectOrgDailyDTO> 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<ScreenProjectOrgDailyDTO> 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<ScreenProj
log.info(String.format(PingYinConstants.SELECT_GRID_INFO_BY_ORG_IS_NULL,customerId));
return;
}
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());
}
});
});
// 父子客户只需处理父客户数据,暂时不管子客户
List<ScreenProjectOrgDailyDTO> parentAgencyInfos = agencyDao.selectAgencyByCustomer(customerId);
List<ScreenProjectOrgDailyDTO> 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<ScreenProjectOrgDailyDTO> disposeCreateProject(List<ScreenProjectOrgDailyDTO> agencyInfos,String dateId){
List<String> orgIds = agencyInfos.stream().map(m -> m.getOrgId()).collect(Collectors.toList());
// 查询 项目总数
List<ProjectTotalResultDTO> projectTotal = projectMainDailyService.selectProjectTotalByOrg(orgIds, dateId, null);
// 查询 项目解决数
List<ResolvedNumResultDTO> 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<ScreenProj
//查询 满意+非常满意的总次数
String[] activeCodesGood = {PingYinConstants.EVALUATE_GOOD,PingYinConstants.EVALUATE_PERFECT};
List<EvaluateTotalResultDTO> 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;
}
/**

178
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<ScreenProjectQuantityOrgMonthlyDTO> page(Map<String, Object> params) {
IPage<ScreenProjectQuantityOrgMonthlyEntity> 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<ScreenProjectOrgDailyDTO> 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<ScreenProjectOrgDailyDTO> screenProjectOrgDailyDTOS=agencyDao.selectAgencyByCustomer(customerId);
if (CollectionUtils.isEmpty(screenProjectOrgDailyDTOS)){
log.warn(String.format(PingYinConstants.AGENCY_INFO_IS_ZERO,customerId));
return;
}
List<ScreenProjectQuantityOrgMonthlyDTO> agencyInfos = ConvertUtils.sourceToTarget(screenProjectOrgDailyDTOS, ScreenProjectQuantityOrgMonthlyDTO.class);
List<ProjectOrgMonthlyResultDTO> projectOrg = baseDao.selectQuantityOrgMonthlyByAgency(agencyInfos, monthId);
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)){
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<ScreenProjectQuantityOrgMonthlyDTO> 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<ScreenProjectOrgDailyDTO> 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<ScreenProjectOrgDailyDTO> parentAgency = agencyDao.selectAgencyByCustomer(customerId);
List<ScreenProjectQuantityOrgMonthlyDTO> parentAgencyInfos = ConvertUtils.sourceToTarget(parentAgency, ScreenProjectQuantityOrgMonthlyDTO.class);
List<ScreenProjectQuantityOrgMonthlyDTO> 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<ScreenProjectQuantityOrgMonthlyDTO> agencyCreateProject(List<ScreenProjectQuantityOrgMonthlyDTO> agencyInfos, String monthId){
List<String> orgIds = agencyInfos.stream().map(m -> m.getOrgId()).collect(Collectors.toList());
// 本月新增的项目数量 转项目日期在当前月份内
List<ProjectIncrResultDTO> projectIncr = projectMainDailyService.selectProjectIncrByOrg(orgIds, monthId);
// 截止到当前月份:累计项目总数
List<ProjectTotalResultDTO> projectTotal = projectMainDailyService.selectProjectTotalByOrg(orgIds, null, monthId);
// 截止到当前月份:累计未结项目总数
List<UnClosedTotalResultDTO> projectUnClosed = projectMainDailyService.selectProjectCountByOrg(orgIds, monthId, PingYinConstants.UN_CLOSED);
// 截止到当前月份:累计已结项目
List<UnClosedTotalResultDTO> projectClosed = projectMainDailyService.selectProjectCountByOrg(orgIds, monthId, PingYinConstants.CLOSED);
// 本月新增结案项目数
List<ClosedIncrResultDTO> 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;

4
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 (

72
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml

@ -459,7 +459,7 @@
<!-- 查询项目总数 -->
<select id="selectProjectTotal" resultType="com.epmet.dto.pingyin.result.ProjectTotalResultDTO">
SELECT
GRID_ID,
GRID_ID AS orgId,
COUNT(ID) AS projectTotal
FROM fact_origin_project_main_daily
WHERE DEL_FLAG = 0
@ -477,7 +477,7 @@
<!-- 查询已解决项目数 -->
<select id="selectResolvedNum" resultType="com.epmet.dto.pingyin.result.ResolvedNumResultDTO">
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 (
<foreach collection="orgIds" item="orgId" separator=" OR ">
m.AGENCY_ID = #{orgId}
@ -639,7 +639,12 @@
AND DATE_ID <![CDATA[ <= ]]> #{dateId}
AND PROJECT_STATUS = 'closed'
AND IS_RESOLVED = 'resolved'
AND GRID_ID IS NULL
AND (
<foreach collection="orgIds" item="orgId" separator=" OR ">
AGENCY_ID = #{orgId}
</foreach>
)
AND GRID_ID = ''
GROUP BY AGENCY_ID
</select>
@ -666,4 +671,63 @@
GROUP BY ORG_ID
</select>
<!-- 组织查询本月新增项目数 -->
<select id="selectProjectIncrByOrg" resultType="com.epmet.dto.pingyin.result.ProjectIncrResultDTO">
SELECT
AGENCY_ID AS orgId,
COUNT(ID) AS projectIncr
FROM fact_origin_project_main_daily
WHERE DEL_FLAG = 0
AND (
<foreach collection="orgIds" item="orgId" separator=" OR ">
AGENCY_ID = #{orgId}
</foreach>
)
AND MONTH_ID = #{monthId}
AND GRID_ID = ''
GROUP BY AGENCY_ID
</select>
<!-- 组织根据状态查询项目数 -->
<select id="selectProjectCountByOrg" resultType="com.epmet.dto.pingyin.result.UnClosedTotalResultDTO">
SELECT
AGENCY_ID AS orgId,
COUNT(ID) AS projectCount
FROM fact_origin_project_main_daily
WHERE DEL_FLAG = 0
AND MONTH_ID <![CDATA[ <= ]]> #{monthId}
AND GRID_ID = ''
AND (
<foreach collection="orgIds" item="orgId" separator=" OR ">
AGENCY_ID = #{orgId}
</foreach>
)
<if test="status == 'unClosed' ">
AND PROJECT_STATUS != 'closed'
</if>
<if test="status == 'closed' ">
AND PROJECT_STATUS = 'closed'
</if>
GROUP BY AGENCY_ID
</select>
<!-- 组织本月新增结案项目数 -->
<select id="selectClosedIncrByOrg" resultType="com.epmet.dto.pingyin.result.ClosedIncrResultDTO">
SELECT
AGENCY_ID,
COUNT( ID ) AS closedIncr
FROM fact_origin_project_main_daily
WHERE
DEL_FLAG = '0'
AND (
<foreach collection="orgIds" item="orgId" separator=" OR ">
AGENCY_ID = #{orgId}
</foreach>
)
AND MONTH_ID = #{monthId}
AND PROJECT_STATUS = 'closed'
AND GRID_ID = ''
GROUP BY AGENCY_ID
</select>
</mapper>

17
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectOrgDailyDao.xml

@ -125,6 +125,23 @@
AND g.DATE_ID <![CDATA[ = ]]> #{dateId}
</foreach>
</select>
<select id="selectOrgProjectByAgency" resultType="com.epmet.dto.pingyin.result.ProjectOrgDailyResultDTO">
<foreach collection="agencyInfos" item="a" separator=" UNION ">
SELECT
#{a.areaCode} AS areaCode,
#{a.orgId} AS orgId,
IFNULL(SUM(PROJECT_TOTAL),0) AS projectTotal,
IFNULL(SUM(RESOLVED_NUM),0) AS resolvedNum,
IFNULL(SUM(EVALUATE_TOTAL),0) AS evaluateTotal ,
IFNULL(SUM(GOOD_TOTAL),0) AS goodTotal,
IFNULL(SUM(BAD_TOTAL),0) AS badTotal
FROM screen_project_grid_daily g
LEFT JOIN screen_customer_grid cg ON cg.GRID_ID = g.GRID_ID
WHERE g.DEL_FLAG = 0
AND cg.PARENT_AGENCY_ID = #{a.orgId}
AND g.DATE_ID <![CDATA[ = ]]> #{dateId}
</foreach>
</select>
</mapper>

30
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectQuantityOrgMonthlyDao.xml

@ -127,5 +127,35 @@
</foreach>
</select>
<select id="selectQuantityOrgMonthlyByAgency" resultType="com.epmet.dto.pingyin.result.ProjectOrgMonthlyResultDTO">
<foreach collection="agencyInfos" item="a" separator=" UNION ">
SELECT
#{a.areaCode} AS areaCode,
IFNULL(SUM(g.PROJECT_TOTAL),0) AS projectTotal,
IFNULL(SUM(g.UN_CLOSED_TOTAL),0) AS unClosedTotal,
IFNULL(SUM(g.CLOSED_TOTAL),0) AS closedTotal
FROM screen_project_quantity_grid_monthly g
LEFT JOIN screen_customer_grid cg ON cg.GRID_ID = g.GRID_ID
WHERE g.DEL_FLAG = 0
AND cg.PARENT_AGENCY_ID = #{a.orgId}
AND g.MONTH_ID <![CDATA[ = ]]> #{monthId}
</foreach>
</select>
<select id="selectQuantityGrandOrgMonthlyByAgency" resultType="com.epmet.dto.pingyin.result.ProjectOrgMonthlyResultDTO">
<foreach collection="agencyInfos" item="a" separator=" UNION ">
SELECT
#{a.areaCode} AS areaCode,
IFNULL(SUM(g.PROJECT_TOTAL),0) AS projectTotal,
IFNULL(SUM(g.UN_CLOSED_TOTAL),0) AS unClosedTotal,
IFNULL(SUM(g.CLOSED_TOTAL),0) AS closedTotal
FROM screen_project_quantity_grid_monthly g
LEFT JOIN screen_customer_grid cg ON cg.GRID_ID = g.GRID_ID
WHERE g.DEL_FLAG = 0
AND cg.PARENT_AGENCY_ID = #{a.orgId}
AND g.MONTH_ID <![CDATA[ = ]]> #{monthId}
</foreach>
</select>
</mapper>

52
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;
}

11
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;
}

1
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<DepartInStaffListResultDTO> staffList;
private String areaCode;
}

8
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<AddAgencyResultDTO> addAgencyV2(@RequestBody AddAgencyV2FormDTO formDTO) {
public Result<AddAgencyResultDTO> 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<AddAgencyResultDTO>().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);
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java

@ -225,5 +225,11 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
**/
int delByAgencyId(@Param("agencyId") String agencyId, @Param("operateUserId") String operateUserId);
List<String> selectAgencyIdsByAreaCode(String areaCode);
List<String> selectAgencyIdsByAreaCode(@Param("areaCode") String areaCode,
@Param("agencyId") String agencyId);
List<CustomerAgencyEntity> checkAgencyName(@Param("agencyName") String agencyName,
@Param("customerId") String customerId,
@Param("level") String level,
@Param("agencyId") String agencyId);
}

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java

@ -235,5 +235,5 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
**/
OrganizeTreeResultDTO organizeTree(String agencyId);
void checkAgencyName(String agencyName);
void checkAgencyName(String agencyName,String customerId,String level,String agencyId);
}

63
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<CustomerAgencyEntity> editList = new ArrayList<>();
Date date = new Date();
agencyList.forEach(agency->{
//3-1:查询当前组织的所有上级组织
List<String> 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<AgencysResultDTO>().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<String> agencyIds = customerAgencyDao.selectAgencyIdsByAreaCode(insertEntity.getAreaCode());
List<String> 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());

6
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<CustomerAgencyDao
}
@Override
public void checkAgencyName(String agencyName) {
QueryWrapper<CustomerAgencyEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(agencyName), "ORGANIZATION_NAME", agencyName);
List<CustomerAgencyEntity> entityList = baseDao.selectList(wrapper);
public void checkAgencyName(String agencyName,String customerId,String level,String agencyId) {
List<CustomerAgencyEntity> 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());
}

18
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}
<if test='agencyId != "" and agencyId != null'>
AND ca.id !=#{agencyId}
</if>
</select>
<select id="checkAgencyName" parameterType="map" resultType="com.epmet.entity.CustomerAgencyEntity">
SELECT
ca.id
FROM
customer_agency ca
WHERE
ca.DEL_FLAG = '0'
AND ca.CUSTOMER_ID = #{customerId}
AND ca.ORGANIZATION_NAME = #{agencyName}
AND ca.`LEVEL` = #{level}
<if test='agencyId != "" and agencyId != null'>
AND ca.id !=#{agencyId}
</if>
</select>
</mapper>

1
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})

1
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());

Loading…
Cancel
Save