Browse Source

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

dev_shibei_match
yinzuomei 5 years ago
parent
commit
6a29a921b8
  1. 20
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/AgencyInfoDTO.java
  2. 38
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankPyFormDTO.java
  3. 31
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/VoluntaryServiceTrendFormDTO.java
  4. 3
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/WorkRecordRankFormDTO.java
  5. 2
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/WorkRecordTrendFormDTO.java
  6. 30
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/VoluntaryServiceTrendDTO.java
  7. 23
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/VoluntaryServiceTrendResultDTO.java
  8. 24
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/plugins/WorkRecordController.java
  9. 12
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java
  10. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  11. 3
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerGridDao.java
  12. 16
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java
  13. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPublicPartiTotalDataDao.java
  14. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserJoinDao.java
  15. 37
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgDailyDao.java
  16. 7
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgMonthlyDao.java
  17. 3
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java
  18. 8
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java
  19. 12
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java
  20. 38
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java
  21. 37
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java
  22. 11
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/ScreenWorkRecordOrgDailyService.java
  23. 141
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java
  24. 2
      epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenCustomerWorkRecordDictDao.xml
  25. 135
      epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml
  26. 29
      epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgMonthlyDao.xml
  27. 17
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml
  28. 15
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml
  29. 35
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenGovernRankDataDao.xml
  30. 40
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml
  31. 2
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectOrgDailyDao.xml
  32. 38
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml
  33. 50
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml
  34. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  35. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java
  36. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  37. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java
  38. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerRelationService.java
  39. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerRelationServiceImpl.java
  40. 22
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java
  41. 26
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectQuantityOrgMonthlyServiceImpl.java
  42. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java
  43. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java
  44. 12
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerRelationDao.xml
  45. 13
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml
  46. 7
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml

20
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/AgencyInfoDTO.java

@ -0,0 +1,20 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 描述一下
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/27 17:52
*/
@Data
public class AgencyInfoDTO implements Serializable {
private String agencyId;
private String areaCode;
private List<String> subAgencyIds;
private List<String> subGridIds;
}

38
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankPyFormDTO.java

@ -0,0 +1,38 @@
package com.epmet.evaluationindex.screen.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 描述一下
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/28 14:29
*/
@Data
public class SubAgencyIndexRankPyFormDTO implements Serializable {
private static final long serialVersionUID = 8930332375421099186L;
/**
* 当前组织平阴大屏默认传跟组织
* */
@NotBlank(message = "agencyId不能为空")
private String agencyId;
/**
* 目前只有平阴在传默认赋值370124
* */
@NotBlank(message = "areaCode不能为空;平阴默认传:370124")
private String areaCode;
/**
* 默认查询前10条
* */
@NotNull(message = "topNum不能为空")
private Integer topNum;
@NotBlank(message = "type不能为空,街道:street;网格:grid")
private String type;
}

31
epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/VoluntaryServiceTrendFormDTO.java

@ -0,0 +1,31 @@
package com.epmet.plugins.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 7工作日志党员志愿者服务近12月趋势图
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/27 19:53
*/
@Data
public class VoluntaryServiceTrendFormDTO {
/**
* 当前组织id
*/
@NotBlank(message = "agencyId不能为空")
private String agencyId;
@NotBlank(message = "目前只有平阴在传,默认赋值:370124")
private String areaCode;
@NotBlank(message = "customerId不能为空")
private String customerId;
/**
* 截止到某月格式yyyyMM目前没有让大屏前端赋值代码默认为为上个月
*/
private String endMonthId;
}

3
epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/WorkRecordRankFormDTO.java

@ -35,4 +35,7 @@ public class WorkRecordRankFormDTO implements Serializable {
@NotBlank(message = "customerId不能为空")
private String customerId;
@NotBlank(message = "areaCode不能为空,目前只有平阴在传,默认赋值:370124")
private String areaCode;
}

2
epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/WorkRecordTrendFormDTO.java

@ -16,7 +16,7 @@ public class WorkRecordTrendFormDTO implements Serializable {
/**
* party:支部建设; union:联建共建党员志愿服务voluntaryservice
*/
@NotBlank(message = "dataType不能为空;可选值:party:支部建设; union:联建共建;党员志愿服务:voluntaryservice")
@NotBlank(message = "dataType不能为空;可选值:party:支部建设; union:联建共建")
private String dataType;
/**

30
epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/VoluntaryServiceTrendDTO.java

@ -0,0 +1,30 @@
package com.epmet.plugins.result;
import lombok.Data;
import java.io.Serializable;
/**
* 7工作日志党员志愿者服务近12月趋势图
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/28 13:41
*/
@Data
public class VoluntaryServiceTrendDTO implements Serializable {
private String monthId;
/**
* 组织次数
*/
private Integer organizeTotal;
/**
* 参与人数
*/
private Integer participateUserTotal;
/**
* 平均参与人数
*/
private Integer avgParticipateUserTotal;
}

23
epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/VoluntaryServiceTrendResultDTO.java

@ -0,0 +1,23 @@
package com.epmet.plugins.result;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* 7工作日志党员志愿者服务近12月趋势图
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/27 19:55
*/
@Data
public class VoluntaryServiceTrendResultDTO implements Serializable {
private static final long serialVersionUID = -560895826884970305L;
private List<String> xAxis=new ArrayList<>();
//组织次数:organize;参与人数:joinuser;平均参与人数:avguser
private List<Integer> organizeList=new ArrayList<>();
private List<Integer> joinUserList=new ArrayList<>();
private List<Integer> avgUserList=new ArrayList<>();
}

24
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/plugins/WorkRecordController.java

@ -3,10 +3,14 @@ package com.epmet.datareport.controller.plugins;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.plugins.ScreenWorkRecordOrgDailyService;
import com.epmet.plugins.form.VoluntaryServiceTrendFormDTO;
import com.epmet.plugins.form.WorkRecordRankFormDTO;
import com.epmet.plugins.form.WorkRecordTrendFormDTO;
import com.epmet.plugins.result.VoluntaryServiceTrendResultDTO;
import com.epmet.plugins.result.WorkRecordRankResultDTO;
import com.epmet.plugins.result.WorkRecordTrendResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -16,17 +20,16 @@ import org.springframework.web.bind.annotation.*;
* @author yinzuomei@elink-cn.com
* @date 2021/2/21 19:51
*/
@Slf4j
@RestController
@RequestMapping("screen/plugins/workrecord")
public class WorkRecordController {
@Autowired
private ScreenWorkRecordOrgDailyService screenWorkRecordOrgDailyService;
//todo 工作日志是否要添加area_code、parent_area_code、orgType;插件是否可以提供;也可以采集的时候赋值
//5、【工作日志】本机及下级排名
//NEI接口地址:https://nei.netease.com/interface/detail/?pid=57068&id=348966
//返参中的当前组织的参与人数、组织次数 直接sum所有下级的值;
//下级根据当前组织的areaCode查询下级列表,再去查询screen_work_record_org_daily
//legend来源于screen_customer_work_record_dict表 level=2,dataType=party
@PostMapping("ranklist")
public Result<WorkRecordRankResultDTO> rankList(@RequestHeader("CustomerId")String customerId, @RequestBody WorkRecordRankFormDTO formDTO){
@ -49,4 +52,21 @@ public class WorkRecordController {
ValidatorUtils.validateEntity(formDTO);
return new Result<WorkRecordTrendResultDTO>().ok(screenWorkRecordOrgDailyService.trend(formDTO));
}
/**
* @param customerId
* @param formDTO
* @author yinzuomei
* @description 7工作日志党员志愿者服务近12月趋势图
* @Date 2021/2/27 19:56
**/
@PostMapping("voluntaryservicetrend")
public Result<VoluntaryServiceTrendResultDTO> voluntaryServiceTrend(@RequestHeader("CustomerId")String customerId, @RequestBody VoluntaryServiceTrendFormDTO formDTO){
formDTO.setCustomerId(customerId);
if (StringUtils.isBlank(formDTO.getEndMonthId())) {
formDTO.setEndMonthId(com.epmet.commons.tools.utils.DateUtils.getCurrentTimeBeforeMonthId());
}
ValidatorUtils.validateEntity(formDTO);
return new Result<VoluntaryServiceTrendResultDTO>().ok(screenWorkRecordOrgDailyService.voluntaryServiceTrend(formDTO));
}
}

12
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java

@ -150,5 +150,15 @@ public class IndexController {
return new Result<List<IndexAdvanceBranchRankResultDTO>>().ok(indexService.advancedBranchRank(formDTO));
}
/**
* @param formDTO
* @author yinzuomei
* @description 8平阴大屏-下级街道or网格指数排行
* @Date 2021/2/28 14:33
**/
@PostMapping("subagencyindexrank-py")
Result<List<SubAgencyIndexRankResultDTO>> subAgencyIndexRankPy(@RequestBody SubAgencyIndexRankPyFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<List<SubAgencyIndexRankResultDTO>>().ok(indexService.subAgencyIndexRankPy(formDTO));
}
}

2
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java

@ -151,4 +151,6 @@ public interface ScreenCustomerAgencyDao {
List<GridNodeDTO> selectGridList(@Param("areaCode") String areaCode,@Param("agencyId") String agencyId);
List<String> getNextAgencyIds(@Param("areaCode")String areaCode,@Param("agencyId")String agencyId);
List<String> selectSubAgencyIds(@Param("areaCode")String areaCode,@Param("agencyId")String agencyId);
}

3
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerGridDao.java

@ -80,5 +80,6 @@ public interface ScreenCustomerGridDao {
* @date 2020/8/26 5:29 下午
*/
List<TreeResultDTO> selectGridInfo(@Param("agencyId")String agencyId);
List<String> selectSubGridIds(@Param("areaCode")String areaCode, @Param("agencyId")String agencyId);
}

16
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java

@ -103,4 +103,20 @@ public interface ScreenIndexDataMonthlyDao{
* @author sun
*/
List<PeerComparisonResultDTO> getSingleIndexRank(SubSingleIndexRankFormDTO formDTO);
/**
* @param yearId
* @param areaCode
* @Description 根据areaCode查询下级指数
* @author yinzuomei
*/
List<SubAgencyIndexRankResultDTO> selectSubStreetByAreaCode(@Param("yearId")String yearId, @Param("areaCode")String areaCode,@Param("topNum") int topNum);
/**
* @param yearId
* @param areaCode
* @Description 根据areaCode查询网格指数
* @author yinzuomei
*/
List<SubAgencyIndexRankResultDTO> selectSubGridByAreaCode(@Param("yearId")String yearId, @Param("areaCode")String areaCode,@Param("topNum") int topNum);
}

4
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPublicPartiTotalDataDao.java

@ -48,7 +48,5 @@ public interface ScreenPublicPartiTotalDataDao{
* @author wangc
* @date 2020.08.20 16:00
**/
List<PublicPartiRankResultDTO> selectPublicPartiTotalByAreaCode(@Param("areaCode") String areaCode,
@Param("customerId")String customerId,
@Param("list")List<String> subCustomers);
List<PublicPartiRankResultDTO> selectPublicPartiTotalByAreaCode(@Param("areaCode") String areaCode);
}

4
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserJoinDao.java

@ -49,9 +49,7 @@ public interface ScreenUserJoinDao {
* @author wangc
* @date 2020.08.20 15:07
**/
UserJoinIndicatorGrowthRateResultDTO selectUserJoinDataByAreaCode(@Param("areaCode") String areaCode, @Param("monthId")String monthId,
@Param("list") List<String> subCustomers,
@Param("customerId")String customerId);
UserJoinIndicatorGrowthRateResultDTO selectUserJoinDataByAreaCode(@Param("areaCode") String areaCode, @Param("monthId")String monthId);
/**

37
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgDailyDao.java

@ -19,7 +19,6 @@ package com.epmet.datareport.dao.plugins;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.datareport.entity.plugins.ScreenWorkRecordOrgDailyEntity;
import com.epmet.plugins.result.WorkRecordRankResultDTO;
import com.epmet.plugins.result.WorkRecordSubRank;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -35,23 +34,37 @@ import java.util.List;
@Mapper
public interface ScreenWorkRecordOrgDailyDao extends BaseDao<ScreenWorkRecordOrgDailyEntity> {
/**
* @param areaCode 当前组织对应的areaCode;
* @param dataType
* @param topRow
* @return com.epmet.plugins.result.WorkRecordRankResultDTO
* @author yinzuomei
* @description 5工作日志本机及下级排名
* @description 5工作日志本机及下级排名- 下级组织
* @Date 2021/2/23 23:37
**/
List<WorkRecordSubRank> selectSubList(@Param("areaCode") String areaCode,
@Param("agencyId") String agencyId,
@Param("dataType") String dataType,
@Param("topRow") Integer topRow,
List<WorkRecordSubRank> selectSubList(@Param("subAgencyIds") List<String> subAgencyIds,
@Param("dataType")String dataType,
@Param("customerId")String customerId,
@Param("dateId")String dateId);
String selectLatestDateId(String customerId);
/**
* @param subGridIds 当前组织的指数网格ids
* @author yinzuomei
* @description
* @Date 2021/2/27 19:31
**/
List<WorkRecordSubRank> selectSubGridList(@Param("subGridIds")List<String> subGridIds,
@Param("dataType")String dataType,
@Param("customerId")String customerId,
@Param("dateId")String dateId);
/**
* @param customerIds 当前客户+所有子客户 列表
* @author yinzuomei
* @description 查询最近一次上传的日期
* @Date 2021/2/27 19:31
**/
String selectLatestDateId(@Param("customerIds")List<String> customerIds);
List<WorkRecordRankResultDTO> selectCurrentAgency(@Param("areaCode") String areaCode,
@Param("dataType") String dataType,
List<WorkRecordSubRank> selectCurrentAgency(@Param("agencyId") String agencyId,
@Param("dataType")String dataType,
@Param("customerId")String customerId,
@Param("dateId")String dateId);
}

7
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgMonthlyDao.java

@ -20,8 +20,10 @@ package com.epmet.datareport.dao.plugins;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.datareport.entity.plugins.ScreenWorkRecordOrgMonthlyEntity;
import com.epmet.plugins.form.WorkRecordTrendFormDTO;
import com.epmet.plugins.result.VoluntaryServiceTrendDTO;
import com.epmet.plugins.result.WorkRecordTrendResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -39,4 +41,9 @@ public interface ScreenWorkRecordOrgMonthlyDao extends BaseDao<ScreenWorkRecordO
* @author sun
*/
List<WorkRecordTrendResultDTO.SeriesResultDTO> selectMonthList(WorkRecordTrendFormDTO formDTO);
List<VoluntaryServiceTrendDTO> selectVoluntaryServiceTrendDTO(@Param("customerId")String customerId,
@Param("orgIds") List<String> orgIds,
@Param("startMonth")String startMonth,
@Param("endMonth")String endMonth);
}

3
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java

@ -1,5 +1,6 @@
package com.epmet.datareport.service.evaluationindex.screen;
import com.epmet.dto.AgencyInfoDTO;
import com.epmet.dto.form.AddAreaCodeDictFormDTO;
import com.epmet.dto.form.AreaCodeDictFormDTO;
import com.epmet.dto.result.AreaCodeDictResultDTO;
@ -70,4 +71,6 @@ public interface AgencyService {
* @Date 2021/2/25 16:52
**/
List<String> getNextAgencyIds(String areaCode,String agencyId);
AgencyInfoDTO getAgencyInfoDTO(String areaCode, String agencyId);
}

8
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java

@ -86,4 +86,12 @@ public interface IndexService {
* @date 2020/10/22 10:58 上午
*/
List<PeerComparisonResultDTO> getSubSingleIndexRank(SubSingleIndexRankFormDTO formDTO);
/**
* @param formDTO
* @author yinzuomei
* @description 8平阴大屏-下级街道or网格指数排行
* @Date 2021/2/28 14:33
**/
List<SubAgencyIndexRankResultDTO> subAgencyIndexRankPy(SubAgencyIndexRankPyFormDTO formDTO);
}

12
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java

@ -10,6 +10,7 @@ import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerAgencyDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerGridDao;
import com.epmet.datareport.service.evaluationindex.screen.AgencyService;
import com.epmet.dto.AgencyInfoDTO;
import com.epmet.dto.form.AddAreaCodeDictFormDTO;
import com.epmet.dto.form.AreaCodeDictFormDTO;
import com.epmet.dto.result.AreaCodeDictResultDTO;
@ -310,4 +311,15 @@ public class AgencyServiceImpl implements AgencyService {
public List<String> getNextAgencyIds(String areaCode,String agencyId) {
return screenCustomerAgencyDao.getNextAgencyIds(areaCode,agencyId);
}
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@Override
public AgencyInfoDTO getAgencyInfoDTO(String areaCode, String agencyId) {
AgencyInfoDTO agencyInfoDTO=new AgencyInfoDTO();
agencyInfoDTO.setAgencyId(agencyId);
agencyInfoDTO.setAreaCode(areaCode);
agencyInfoDTO.setSubAgencyIds(screenCustomerAgencyDao.selectSubAgencyIds(areaCode,agencyId));
agencyInfoDTO.setSubGridIds(screenCustomerGridDao.selectSubGridIds(areaCode,agencyId));
return agencyInfoDTO;
}
}

38
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java

@ -143,23 +143,21 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService {
ScreenCustomerAgencyDTO agencyInfo = agencyInfo(param.getAgencyId());
Result<List<String>> crmResp = crmClient.getAllSubCustomerIds(agencyInfo.getCustomerId());
List<String> subCustomers;
if(null == crmResp || !crmResp.success()) {subCustomers = null ;}
if(null == crmResp || !crmResp.success()|| org.apache.commons.collections4.CollectionUtils.isEmpty(crmResp.getData())) {subCustomers = null ;}
else {subCustomers = crmResp.getData();}
String monthId = dateUtils.getCurrentMonthId();
UserJoinIndicatorGrowthRateResultDTO latest = CollectionUtils.isEmpty(subCustomers) ?
UserJoinIndicatorGrowthRateResultDTO latest = CollectionUtils.isEmpty(subCustomers) ||StringUtils.isBlank(agencyInfo.getAreaCode())?
screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId) :
screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId,
subCustomers,agencyInfo.getCustomerId());
screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId);
//保证获取公众参与概率数据的最大可能性
int time = NumConstant.TWELVE;
while (null == latest && time > NumConstant.ONE) {
time--;
monthId = dateUtils.getPreviousMonthIdByDest(null, monthId);
latest = CollectionUtils.isEmpty(subCustomers) ?
latest = CollectionUtils.isEmpty(subCustomers)||StringUtils.isBlank(agencyInfo.getAreaCode()) ?
screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId) :
screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId,
subCustomers,agencyInfo.getCustomerId());
screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId);
}
if (null == latest) return new PublicPartiProfileResultDTO();
@ -178,28 +176,30 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService {
* @author wangc
* @date 2020.08.20 15:32
**/
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
@Override
public List<PublicPartiRankResultDTO> publicPartiRank(AgencyAndNumFormDTO param) {
if(null == param.getTopNum()){
if (null == param.getTopNum()) {
param.setTopNum(NumConstant.TWO);
}
if(NumConstant.ZERO == param.getTopNum()){
if (NumConstant.ZERO == param.getTopNum()) {
param.setTopNum(NumConstant.MAX);
}
ScreenCustomerAgencyDTO agencyInfo = agencyInfo(param.getAgencyId()) ;
ScreenCustomerAgencyDTO agencyInfo = agencyInfo(param.getAgencyId());
List<String> subCustomers;
Result<List<String>> crmResp = crmClient.getAllSubCustomerIds(agencyInfo.getCustomerId());
if(null == crmResp || !crmResp.success()) {subCustomers = null ;}
else {subCustomers = crmResp.getData();}
PageHelper.startPage(NumConstant.ONE,param.getTopNum());
if (null == crmResp || !crmResp.success() || CollectionUtils.isEmpty(crmResp.getData())) {
subCustomers = null;
} else {
subCustomers = crmResp.getData();
}
PageHelper.startPage(NumConstant.ONE, param.getTopNum());
List<PublicPartiRankResultDTO> result =
CollectionUtils.isEmpty(subCustomers) ?
screenPublicPartiTotalDataDao.selectPublicPartiTotal(param.getAgencyId())
: screenPublicPartiTotalDataDao.selectPublicPartiTotalByAreaCode(agencyInfo.getAreaCode(),agencyInfo.getCustomerId(),
subCustomers);
if(null == result) {
CollectionUtils.isEmpty(subCustomers) || StringUtils.isBlank(agencyInfo.getAreaCode()) ?
screenPublicPartiTotalDataDao.selectPublicPartiTotal(param.getAgencyId())
: screenPublicPartiTotalDataDao.selectPublicPartiTotalByAreaCode(agencyInfo.getAreaCode());
if (null == result) {
return new ArrayList<>();
}
return result;

37
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java

@ -3,6 +3,7 @@ package com.epmet.datareport.service.evaluationindex.screen.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.enums.CommonOperateTypeEnum;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataMonthlyDao;
@ -385,4 +386,40 @@ public class IndexServiceImpl implements IndexService {
return list;
}
/**
* @param formDTO
* @author yinzuomei
* @description 8平阴大屏-下级街道or网格指数排行
* @Date 2021/2/28 14:33
**/
@Override
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
public List<SubAgencyIndexRankResultDTO> subAgencyIndexRankPy(SubAgencyIndexRankPyFormDTO formDTO) {
if (!"street".equals(formDTO.getType()) && !"grid".equals(formDTO.getType())) {
throw new RenException("type传参错误,街道:street;网格:grid");
}
LocalDate now = LocalDate.now().minusMonths(NumConstant.ONE);
String yearId = String.valueOf(now.getYear());
if("street".equals(formDTO.getType())){
List<SubAgencyIndexRankResultDTO> streetList = screenIndexDataMonthlyDao.selectSubStreetByAreaCode(yearId,formDTO.getAreaCode(),formDTO.getTopNum());
// 小数四舍五入
streetList.forEach(indexRank -> {
indexRank.setPartyDevAbility(getRound(indexRank.getPartyDevAbility()));
indexRank.setGovernAbility(getRound(indexRank.getGovernAbility()));
indexRank.setServiceAbility(getRound(indexRank.getServiceAbility()));
indexRank.setTotalIndex(getRound(indexRank.getPartyDevAbility() + indexRank.getGovernAbility() + indexRank.getServiceAbility()));
});
return streetList;
}
List<SubAgencyIndexRankResultDTO> gridList = screenIndexDataMonthlyDao.selectSubGridByAreaCode(yearId,formDTO.getAreaCode(),formDTO.getTopNum());
// 小数四舍五入
gridList.forEach(indexRank -> {
indexRank.setPartyDevAbility(getRound(indexRank.getPartyDevAbility()));
indexRank.setGovernAbility(getRound(indexRank.getGovernAbility()));
indexRank.setServiceAbility(getRound(indexRank.getServiceAbility()));
indexRank.setTotalIndex(getRound(indexRank.getPartyDevAbility() + indexRank.getGovernAbility() + indexRank.getServiceAbility()));
});
return gridList;
}
}

11
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/ScreenWorkRecordOrgDailyService.java

@ -21,8 +21,10 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.datareport.entity.plugins.ScreenWorkRecordOrgDailyEntity;
import com.epmet.plugins.ScreenWorkRecordOrgDailyDTO;
import com.epmet.plugins.form.VoluntaryServiceTrendFormDTO;
import com.epmet.plugins.form.WorkRecordRankFormDTO;
import com.epmet.plugins.form.WorkRecordTrendFormDTO;
import com.epmet.plugins.result.VoluntaryServiceTrendResultDTO;
import com.epmet.plugins.result.WorkRecordRankResultDTO;
import com.epmet.plugins.result.WorkRecordTrendResultDTO;
@ -104,4 +106,13 @@ public interface ScreenWorkRecordOrgDailyService extends BaseService<ScreenWorkR
* @author sun
*/
WorkRecordTrendResultDTO trend(WorkRecordTrendFormDTO formDTO);
/**
* @return com.epmet.plugins.result.VoluntaryServiceTrendResultDTO
* @param formDTO
* @author yinzuomei
* @description 7工作日志党员志愿者服务近12月趋势图
* @Date 2021/2/27 19:56
**/
VoluntaryServiceTrendResultDTO voluntaryServiceTrend(VoluntaryServiceTrendFormDTO formDTO);
}

141
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java

@ -17,15 +17,16 @@
package com.epmet.datareport.service.plugins.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.plugins.ScreenCustomerWorkRecordDictDao;
import com.epmet.datareport.dao.plugins.ScreenWorkRecordOrgDailyDao;
@ -34,23 +35,26 @@ import com.epmet.datareport.entity.plugins.ScreenWorkRecordOrgDailyEntity;
import com.epmet.datareport.service.evaluationindex.screen.AgencyService;
import com.epmet.datareport.service.plugins.ScreenWorkRecordOrgDailyService;
import com.epmet.datareport.utils.DateUtils;
import com.epmet.dto.result.ScreenCustomerAgencyDTO;
import com.epmet.dto.AgencyInfoDTO;
import com.epmet.evaluationindex.screen.constant.ScreenConstant;
import com.epmet.feign.OperCrmOpenFeignClient;
import com.epmet.plugins.ScreenWorkRecordOrgDailyDTO;
import com.epmet.plugins.form.VoluntaryServiceTrendFormDTO;
import com.epmet.plugins.form.WorkRecordRankFormDTO;
import com.epmet.plugins.form.WorkRecordTrendFormDTO;
import com.epmet.plugins.result.WorkRecordRankResultDTO;
import com.epmet.plugins.result.WorkRecordTrendResultDTO;
import com.epmet.plugins.result.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@ -71,7 +75,8 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl<ScreenW
private ScreenCustomerWorkRecordDictDao screenCustomerWorkRecordDictDao;
@Autowired
private ScreenWorkRecordOrgMonthlyDao screenWorkRecordOrgMonthlyDao;
@Autowired
private OperCrmOpenFeignClient operCrmOpenFeignClient;
@Override
public PageData<ScreenWorkRecordOrgDailyDTO> page(Map<String, Object> params) {
IPage<ScreenWorkRecordOrgDailyEntity> page = baseDao.selectPage(
@ -124,30 +129,54 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl<ScreenW
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
@Override
public WorkRecordRankResultDTO rankList(WorkRecordRankFormDTO formDTO) {
////todo 待完善 直属网格是否显示?
ScreenCustomerAgencyDTO agencyDTO = agencyService.queryAgencyInfo(formDTO.getAgencyId());
if (null == agencyDTO) {
throw new RenException(String.format("获取组织信息异常,agencyId:%s", formDTO.getAgencyId()));
List<String> customerIds=new ArrayList<>();
Result<List<String>> result=operCrmOpenFeignClient.getAllSubCustomerIds(formDTO.getCustomerId());
if (result.success() && CollectionUtils.isNotEmpty(result.getData())) {
customerIds.addAll(result.getData());
}
String dateId = baseDao.selectLatestDateId(formDTO.getCustomerId());
log.info(String.format("最近一次上传dateId:%s", dateId));
if (agencyDTO.getLevel().equals("community")) {
log.warn("【工作日志】本机及下级排名接口待完善");
//todo
return new WorkRecordRankResultDTO(0, 0, new ArrayList<>());
} else {
//非社区的
List<WorkRecordRankResultDTO> resultDTOList = baseDao.selectCurrentAgency(agencyDTO.getAreaCode(), formDTO.getDataType(), dateId);
if(!CollectionUtils.isEmpty(resultDTOList)){
WorkRecordRankResultDTO resultDTO=resultDTOList.get(0);
resultDTO.setSubRankList(baseDao.selectSubList(agencyDTO.getAreaCode(), agencyDTO.getAgencyId(), formDTO.getDataType(), formDTO.getTopRow(), dateId));
return resultDTO;
}
customerIds.add(formDTO.getCustomerId());
String dateId= baseDao.selectLatestDateId(customerIds);
if(StringUtils.isBlank(dateId)){
log.warn("selectLatestDateId dateId is null customerIds" + JSON.toJSONString(customerIds));
}
WorkRecordRankResultDTO returnDto = new WorkRecordRankResultDTO();
AgencyInfoDTO agencyInfoDTO = agencyService.getAgencyInfoDTO(formDTO.getAreaCode(), formDTO.getAgencyId());
//当前组织的自身的数据
List<WorkRecordSubRank> currentAgency = baseDao.selectCurrentAgency(formDTO.getAgencyId(),
formDTO.getDataType(),
formDTO.getCustomerId(),
dateId);
//下级所有组织
List<WorkRecordSubRank> subAgencyRankList = baseDao.selectSubList(
CollectionUtils.isNotEmpty(agencyInfoDTO.getSubAgencyIds()) ? agencyInfoDTO.getSubAgencyIds() : new ArrayList<>(),
formDTO.getDataType(),
formDTO.getCustomerId(),
dateId);
//直属网格
List<WorkRecordSubRank> subGridList = baseDao.selectSubGridList(
CollectionUtils.isNotEmpty(agencyInfoDTO.getSubGridIds()) ? agencyInfoDTO.getSubGridIds() : new ArrayList<>(),
formDTO.getDataType(),
formDTO.getCustomerId(),
dateId);
if (CollectionUtils.isNotEmpty(currentAgency)) {
returnDto.getSubRankList().addAll(currentAgency);
}
return new WorkRecordRankResultDTO();
returnDto.getSubRankList().addAll(subAgencyRankList);
returnDto.getSubRankList().addAll(subGridList);
int participateUserTotal = 0;
int participateTotal = 0;
for (WorkRecordSubRank subAgency : returnDto.getSubRankList()) {
participateUserTotal += subAgency.getParticipateUserTotal();
participateTotal += subAgency.getParticipateTotal();
}
returnDto.setParticipateTotal(participateTotal);
returnDto.setParticipateUserTotal(participateUserTotal);
returnDto.setSubRankList(CollectionUtils.isNotEmpty(returnDto.getSubRankList()) && returnDto.getSubRankList().size() >= formDTO.getTopRow() ?
returnDto.getSubRankList().subList(NumConstant.ZERO, formDTO.getTopRow()) : returnDto.getSubRankList());
return returnDto;
}
/**
@ -204,4 +233,64 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl<ScreenW
return resultDTO;
}
/**
* @param formDTO
* @return com.epmet.plugins.result.VoluntaryServiceTrendResultDTO
* @author yinzuomei
* @description 7工作日志党员志愿者服务近12月趋势图
* @Date 2021/2/27 19:56
**/
@Override
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
public VoluntaryServiceTrendResultDTO voluntaryServiceTrend(VoluntaryServiceTrendFormDTO formDTO) {
VoluntaryServiceTrendResultDTO resultDTO = new VoluntaryServiceTrendResultDTO();
//近12个月的monthId集合,["202002","202003","202004","202005","202006","202007","202008","202009","202010","202011","202012","202101"]
List<String> monthIdList = com.epmet.commons.tools.utils.DateUtils.getMonthIdList(formDTO.getEndMonthId(), NumConstant.ELEVEN);
// log.info(JSON.toJSONString(monthIdList));
AgencyInfoDTO agencyInfoDTO = agencyService.getAgencyInfoDTO(formDTO.getAreaCode(), formDTO.getAgencyId());
List<String> orgIds = new ArrayList<>();
orgIds.addAll(agencyInfoDTO.getSubAgencyIds());
orgIds.add(agencyInfoDTO.getAgencyId());
orgIds.addAll(agencyInfoDTO.getSubGridIds());
List<VoluntaryServiceTrendDTO> list = screenWorkRecordOrgMonthlyDao.selectVoluntaryServiceTrendDTO(formDTO.getCustomerId(),
orgIds,
monthIdList.get(NumConstant.ZERO),
monthIdList.get(NumConstant.ELEVEN));
Map<String, VoluntaryServiceTrendDTO> dtoMap = new HashMap<>();
if (!org.springframework.util.CollectionUtils.isEmpty(list)) {
dtoMap = list.stream().collect(Collectors.toMap(VoluntaryServiceTrendDTO::getMonthId, Function.identity(), (key1, key2) -> key2));
}
//要返回的横坐标:["02月","03月","04月","05月","06月","07月","08月","09月","10月","11月","12月","01月"]
List<String> xAxis = new ArrayList<>();
List<Integer> organizeList = new ArrayList<>();
List<Integer> joinUserList = new ArrayList<>();
List<Integer> avgUserList = new ArrayList<>();
for (String monthId : monthIdList) {
xAxis.add(monthId.substring(NumConstant.FOUR, NumConstant.SIX).concat(ScreenConstant.MONTH));
if (null != dtoMap.get(monthId) && null != dtoMap.get(monthId).getOrganizeTotal()) {
organizeList.add(dtoMap.get(monthId).getOrganizeTotal());
} else {
organizeList.add(NumConstant.ZERO);
}
if (null != dtoMap.get(monthId) && null != dtoMap.get(monthId).getParticipateUserTotal()) {
joinUserList.add(dtoMap.get(monthId).getParticipateUserTotal());
} else {
joinUserList.add(NumConstant.ZERO);
}
if (null != dtoMap.get(monthId) && null != dtoMap.get(monthId).getAvgParticipateUserTotal()) {
avgUserList.add(dtoMap.get(monthId).getAvgParticipateUserTotal());
} else {
avgUserList.add(NumConstant.ZERO);
}
}
resultDTO.setXAxis(xAxis);
resultDTO.setOrganizeList(organizeList);
resultDTO.setJoinUserList(joinUserList);
resultDTO.setAvgUserList(avgUserList);
return resultDTO;
}
}

2
epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenCustomerWorkRecordDictDao.xml

@ -2,7 +2,6 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.datareport.dao.plugins.ScreenCustomerWorkRecordDictDao">
<select id="selectListByDataType" resultType="java.lang.String">
SELECT
resource_label
@ -12,6 +11,7 @@
del_flag = '0'
AND customer_id = #{customerId}
AND data_type = #{dataType}
and level='2'
ORDER BY
sort ASC, resource_label DESC
</select>

135
epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml

@ -3,68 +3,121 @@
<mapper namespace="com.epmet.datareport.dao.plugins.ScreenWorkRecordOrgDailyDao">
<select id="selectLatestDateId" resultType="java.lang.String" parameterType="java.lang.String">
<select id="selectLatestDateId" resultType="java.lang.String" parameterType="map">
SELECT
max( m.DATE_ID ) AS maxDateId
FROM
screen_work_record_org_daily m
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID = #{customerId}
AND m.CUSTOMER_ID in
<foreach item="customerId" collection="customerIds" open="(" separator="," close=")">
#{customerId}
</foreach>
</select>
<!-- 按照area_code查询当前组织的下级对应的数值,不包含本级 -->
<select id="selectSubList" parameterType="map" resultType="com.epmet.plugins.result.WorkRecordSubRank">
SELECT
SELECT
sca.AGENCY_ID AS orgId,
sca.AGENCY_NAME AS `NAME`,
IFNULL( sum( temp.PARTICIPATE_USER_TOTAL ), 0 ) AS participateUserTotal,
IFNULL( sum( temp.ORGANIZE_TOTAL ), 0 ) AS participateTotal
FROM
screen_customer_agency sca
left join (
select m.* from screen_work_record_org_daily m
where m.DEL_FLAG = '0'
AND m.DATE_ID = #{dateId}
and m.TYPE_CODE in(
select dict. RESOURCE_CODE from screen_customer_work_record_dict dict
where dict.DEL_FLAG = '0'
AND dict.DATA_TYPE = #{dataType}
and dict.`LEVEL`='1'
)
)temp on(
sca.AGENCY_ID = temp.ORG_ID AND temp.DEL_FLAG = '0' AND temp.DATE_ID =#{dateId}
)
screen_customer_agency sca
left join (
select m.* from screen_work_record_org_daily m
where m.DEL_FLAG = '0'
AND m.DATE_ID = #{dateId}
and m.TYPE_CODE in(
select distinct dict.RESOURCE_CODE
from screen_customer_work_record_dict dict
where dict.DEL_FLAG = '0'
and dict.`LEVEL`='1'
AND dict.DATA_TYPE =#{dataType}
and dict.CUSTOMER_ID=#{customerId}
)
and org_id in
<foreach item="agencyId" collection="subAgencyIds" open="(" separator="," close=")">
#{agencyId}
</foreach>
)temp on(sca.AGENCY_ID = temp.ORG_ID)
WHERE
sca.DEL_FLAG = '0'
AND sca.PARENT_AREA_CODE =#{areaCode}
AND sca.AGENCY_ID != #{agencyId}
GROUP BY
sca.AGENCY_ID,
sca.AGENCY_NAME
sca.DEL_FLAG = '0'
AND sca.AGENCY_ID in
<foreach item="agencyId" collection="subAgencyIds" open="(" separator="," close=")">
#{agencyId}
</foreach>
group by sca.AGENCY_ID,sca.AGENCY_NAME
ORDER BY
participateUserTotal DESC,
participateTotal DESC
LIMIT #{topRow}
participateUserTotal DESC,
participateTotal DESC
</select>
<select id="selectCurrentAgency" parameterType="map" resultType="com.epmet.plugins.result.WorkRecordRankResultDTO">
<select id="selectSubGridList" parameterType="map" resultType="com.epmet.plugins.result.WorkRecordSubRank">
SELECT
IFNULL( sum( m.PARTICIPATE_USER_TOTAL ), 0 ) AS participateUserTotal,
IFNULL( sum( m.ORGANIZE_TOTAL ), 0 ) AS participateTotal
scg.GRID_ID AS orgId,
scg.GRID_NAME AS `NAME`,
IFNULL( sum( temp.PARTICIPATE_USER_TOTAL ), 0 ) AS participateUserTotal,
IFNULL( sum( temp.ORGANIZE_TOTAL ), 0 ) AS participateTotal
FROM
screen_customer_agency sca
inner JOIN screen_work_record_org_daily m ON ( sca.AGENCY_ID = m.ORG_ID AND m.DEL_FLAG = '0' AND m.DATE_ID = #{dateId}
)
inner JOIN screen_customer_work_record_dict dict
ON ( m.TYPE_CODE = dict.RESOURCE_CODE
and dict.`LEVEL`='1'
AND dict.DEL_FLAG = '0'
AND dict.DATA_TYPE = #{dataType}
)
screen_customer_grid scg
left join (
select m.* from screen_work_record_org_daily m
where m.DEL_FLAG = '0'
AND m.DATE_ID = #{dateId}
and m.TYPE_CODE in(
select distinct dict.RESOURCE_CODE
from screen_customer_work_record_dict dict
where dict.DEL_FLAG = '0'
and dict.`LEVEL`='1'
AND dict.DATA_TYPE =#{dataType}
and dict.CUSTOMER_ID=#{customerId}
)
and org_id in
<foreach item="gridId" collection="subGridIds" open="(" separator="," close=")">
#{gridId}
</foreach>
)temp on(scg.GRID_ID = temp.ORG_ID)
WHERE
sca.DEL_FLAG = '0'
AND sca.PARENT_AREA_CODE like concat( #{areaCode},'%')
scg.DEL_FLAG = '0'
AND scg.GRID_ID in
<foreach item="gridId" collection="subGridIds" open="(" separator="," close=")">
#{gridId}
</foreach>
group by scg.GRID_ID,scg.GRID_NAME
ORDER BY
participateUserTotal DESC,
participateTotal DESC
</select>
<select id="selectCurrentAgency" parameterType="map" resultType="com.epmet.plugins.result.WorkRecordSubRank">
SELECT
sca.AGENCY_ID AS orgId,
sca.AGENCY_NAME AS `NAME`,
IFNULL( sum( temp.PARTICIPATE_USER_TOTAL ), 0 ) AS participateUserTotal,
IFNULL( sum( temp.ORGANIZE_TOTAL ), 0 ) AS participateTotal
FROM
screen_customer_agency sca
left join (
select m.* from screen_work_record_org_daily m
where m.DEL_FLAG = '0'
AND m.DATE_ID = #{dateId}
and m.TYPE_CODE in(
select distinct dict.RESOURCE_CODE
from screen_customer_work_record_dict dict
where dict.DEL_FLAG = '0'
and dict.`LEVEL`='1'
AND dict.DATA_TYPE =#{dataType}
and dict.CUSTOMER_ID=#{customerId}
)
and org_id =#{agencyId}
)temp on(sca.AGENCY_ID = temp.ORG_ID)
WHERE
sca.DEL_FLAG = '0'
AND sca.AGENCY_ID=#{agencyId}
group by sca.AGENCY_ID,sca.AGENCY_NAME
ORDER BY
participateUserTotal DESC,
participateTotal DESC
</select>
</mapper>

29
epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgMonthlyDao.xml

@ -35,4 +35,33 @@
sw.month_id ASC
</select>
<select id="selectVoluntaryServiceTrendDTO" parameterType="map" resultType="com.epmet.plugins.result.VoluntaryServiceTrendDTO">
SELECT
m.MONTH_ID,
sum( m.ORGANIZE_TOTAL ) AS organizeTotal,
sum( m.PARTICIPATE_USER_TOTAL ) AS participateUserTotal,
sum( m.AVG_PARTICIPATE_USER_TOTAL ) AS avgParticipateUserTotal
FROM
screen_work_record_org_monthly m
WHERE m.DEL_FLAG = '0'
AND m.TYPE_CODE =(
SELECT
dict.RESOURCE_CODE
FROM
screen_customer_work_record_dict dict
WHERE
dict.DEL_FLAG = '0'
AND dict.`LEVEL` = '1'
AND dict.DATA_TYPE = 'voluntaryservice'
AND dict.CUSTOMER_ID = #{customerId}
)
AND m.ORG_ID IN
<foreach item="orgId" collection="orgIds" open="(" separator="," close=")">
#{orgId}
</foreach>
AND m.MONTH_ID &gt;= #{startMonth}
AND m.MONTH_ID &lt;= #{endMonth}
GROUP BY
m.MONTH_ID
</select>
</mapper>

17
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml

@ -302,4 +302,21 @@
</otherwise>
</choose>
</select>
<select id="selectSubAgencyIds" parameterType="map" resultType="java.lang.String">
SELECT
sca.AGENCY_ID as orgId
FROM
screen_customer_agency sca
WHERE
sca.DEL_FLAG = '0'
<choose>
<when test="areaCode != null and areaCode.trim() != ''">
AND sca.PARENT_AREA_CODE = #{areaCode}
</when>
<otherwise>
and sca.PID=#{agencyId}
</otherwise>
</choose>
</select>
</mapper>

15
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml

@ -122,4 +122,19 @@
GROUP BY scg.PARENT_AGENCY_ID
</select>
<select id="selectSubGridIds" parameterType="map" resultType="java.lang.String">
SELECT
m.GRID_ID as orgId
FROM
screen_customer_grid m
where m.DEL_FLAG = '0'
<choose>
<when test="areaCode != null and areaCode.trim() != ''">
and m.AREA_CODE=#{areaCode}
</when>
<otherwise>
m.PARENT_AGENCY_ID=#{agencyId}
</otherwise>
</choose>
</select>
</mapper>

35
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenGovernRankDataDao.xml

@ -25,28 +25,29 @@
(rankData.RESPONSE_RATIO + rankData.RESOLVED_RATIO + rankData.GOVERN_RATIO + rankData.SATISFACTION_RATIO) DESC,rankData.RESPONSE_RATIO DESC,rankData.RESOLVED_RATIO DESC,rankData.GOVERN_RATIO DESC,rankData.SATISFACTION_RATIO DESC
</select>
<!-- -->
<!-- 基层治理-治理能力榜单 多客户版,调用此sql -->
<select id="selectGovernCapacityRatioNew" resultType="com.epmet.evaluationindex.screen.dto.result.GovernCapacityResultDTO">
SELECT
rankData.ORG_NAME AS agencyName,
rankData.RESPONSE_RATIO,
rankData.RESOLVED_RATIO,
rankData.GOVERN_RATIO,
rankData.SATISFACTION_RATIO,
agency.AGENCY_NAME AS parentAgencyName
rankData.ORG_NAME AS agencyName,
rankData.RESPONSE_RATIO,
rankData.RESOLVED_RATIO,
rankData.GOVERN_RATIO,
rankData.SATISFACTION_RATIO,
pa.AGENCY_NAME AS parentAgencyName
FROM
screen_govern_rank_data rankData
LEFT JOIN screen_customer_agency agency ON rankData.PARENT_ID = agency.AGENCY_ID AND agency.DEL_FLAG = '0'
screen_govern_rank_data rankData
LEFT JOIN screen_customer_agency agency ON (rankData.org_id = agency.AGENCY_ID AND agency.DEL_FLAG = '0')
left join screen_customer_agency pa on(agency.PARENT_AREA_CODE=pa.AREA_CODE and pa.DEL_FLAG='0')
WHERE
rankData.DEL_FLAG = '0'
AND (
<foreach collection="orgIds" item="orgId" separator=" OR ">
rankData.PARENT_ID = #{orgId}
</foreach>
)
AND rankData.MONTH_ID = #{monthId}
rankData.DEL_FLAG = '0'
AND rankData.org_id in
<foreach collection="orgIds" item="orgId" open="(" close=")" separator=",">
#{orgId}
</foreach>
AND rankData.MONTH_ID =#{monthId}
ORDER BY
(rankData.RESPONSE_RATIO + rankData.RESOLVED_RATIO + rankData.GOVERN_RATIO + rankData.SATISFACTION_RATIO) DESC,rankData.RESPONSE_RATIO DESC,rankData.RESOLVED_RATIO DESC,rankData.GOVERN_RATIO DESC,rankData.SATISFACTION_RATIO DESC
(rankData.RESPONSE_RATIO + rankData.RESOLVED_RATIO + rankData.GOVERN_RATIO + rankData.SATISFACTION_RATIO) DESC,
rankData.RESPONSE_RATIO DESC,rankData.RESOLVED_RATIO DESC,rankData.GOVERN_RATIO DESC,rankData.SATISFACTION_RATIO DESC
</select>
</mapper>

40
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml

@ -282,4 +282,44 @@
ORDER BY y.index_total DESC
LIMIT #{topNum}
</select>
<select id="selectSubStreetByAreaCode" parameterType="map" resultType="com.epmet.evaluationindex.screen.dto.result.SubAgencyIndexRankResultDTO">
SELECT
sca.AGENCY_NAME AS NAME,
sy.govern_ablity AS governAbility,
sy.party_dev_ablity AS partyDevAbility,
sy.service_ablity AS serviceAbility
FROM screen_customer_agency sca
left join screen_index_data_yearly sy
on(sca.AGENCY_ID=sy.ORG_ID
and sy.DEL_FLAG='0'
and sy.ORG_TYPE != 'department'
and sy.YEAR_ID=#{yearId}
)
WHERE
sca.del_flag = '0'
AND sca.PARENT_AREA_CODE=#{areaCode}
ORDER BY index_total DESC
LIMIT #{topNum}
</select>
<select id="selectSubGridByAreaCode" parameterType="map" resultType="com.epmet.evaluationindex.screen.dto.result.SubAgencyIndexRankResultDTO">
SELECT
scg.GRID_NAME AS NAME,
sy.govern_ablity AS governAbility,
sy.party_dev_ablity AS partyDevAbility,
sy.service_ablity AS serviceAbility
FROM screen_customer_grid scg
left join screen_index_data_yearly sy
on(scg.GRID_ID=sy.ORG_ID
and sy.DEL_FLAG='0'
and sy.ORG_TYPE != 'department'
and sy.YEAR_ID=#{yearId}
)
WHERE
scg.del_flag = '0'
AND scg.AREA_CODE like CONCAT(#{areaCode},'%')
ORDER BY index_total DESC
LIMIT #{topNum}
</select>
</mapper>

2
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectOrgDailyDao.xml

@ -43,7 +43,7 @@
INNER JOIN screen_customer_agency a ON ( m.ORG_ID = a.AGENCY_ID AND a.DEL_FLAG = '0' )
WHERE
m.DEL_FLAG = '0'
AND a.AREA_CODE LIKE concat( #{areaCode}, '%')
AND a.PARENT_AREA_CODE=#{areaCode}
AND M.DATE_ID=(
select t1.DATE_ID from screen_project_org_daily t1
where t1.DEL_FLAG='0'

38
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml

@ -36,37 +36,31 @@
<!-- 查询公众参与各类总数 -->
<select id="selectPublicPartiTotalByAreaCode" resultType="com.epmet.evaluationindex.screen.dto.result.PublicPartiRankResultDTO">
SELECT
SELECT
totalData.ORG_NAME AS NAME,
totalData.REG_USER_TOTAL AS regNum,
totalData.JOIN_USER_TOTAL AS joinNum,
totalData.TOPIC_TOTAL AS topicNum,
totalData.ISSUE_TOTAL AS issueNum,
totalData.PROJECT_TOTAL AS projectNum,
agency.AGENCY_NAME AS parentAgencyName
pa.AGENCY_NAME AS parentAgencyName
FROM
screen_public_parti_total_data totalData
LEFT JOIN
screen_customer_agency agency
ON totalData.PARENT_ID = agency.AGENCY_ID
AND agency.DEL_FLAG = '0'
LEFT JOIN screen_customer_agency agency
ON (totalData.ORG_ID = agency.AGENCY_ID
AND agency.DEL_FLAG = '0')
left join screen_customer_agency pa
on(agency.PARENT_AREA_CODE=pa.AREA_CODE and pa.DEL_FLAG='0')
WHERE
totalData.DEL_FLAG = '0'
AND
agency.AREA_CODE like concat(#{areaCode},'%')
<if test=" null != list and list.size() > 0">
<foreach collection="list" item="subId" open="AND ( totalData.customer_id = #{customerId} OR " separator=" OR " close=" )">
totalData.customer_id = #{subId}
</foreach>
</if>
ORDER BY
(totalData.REG_USER_TOTAL + totalData.JOIN_USER_TOTAL + totalData.TOPIC_TOTAL + totalData.ISSUE_TOTAL + totalData.PROJECT_TOTAL) DESC,
totalData.REG_USER_TOTAL desc,
totalData.JOIN_USER_TOTAL desc,
totalData.TOPIC_TOTAL desc,
totalData.ISSUE_TOTAL desc,
totalData.PROJECT_TOTAL desc
totalData.DEL_FLAG = '0'
AND agency.PARENT_AREA_CODE=#{areaCode}
ORDER BY
(totalData.REG_USER_TOTAL + totalData.JOIN_USER_TOTAL + totalData.TOPIC_TOTAL + totalData.ISSUE_TOTAL + totalData.PROJECT_TOTAL) DESC,
totalData.REG_USER_TOTAL desc,
totalData.JOIN_USER_TOTAL desc,
totalData.TOPIC_TOTAL desc,
totalData.ISSUE_TOTAL desc,
totalData.PROJECT_TOTAL desc
</select>

50
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml

@ -26,30 +26,36 @@
<!-- 根据地区码查询用户参与数据 -->
<select id="selectUserJoinDataByAreaCode" resultType="com.epmet.evaluationindex.screen.dto.result.UserJoinIndicatorGrowthRateResultDTO">
SELECT
avg(data.JOIN_TOTAL) AS total,
ROUND( avg(data.AVG_JOIN), 1 ) AS averageJoin,
avg(data.JOIN_TOTAL_UP_RATE) AS monthIncr,
avg(data.JOIN_TOTAL_UP_FLAG) AS monthTrend,
ROUND(avg(data.AVG_ISSUE), 1) AS averageIssue,
avg(data.AVG_ISSUE_UP_RATE) AS issueCompareLatestMonth,
avg(data.AVG_ISSUE_UP_FLAG) AS issueCompareLatestTrend,
avg(data.AGVG_JOIN_UP_RATE) AS joinCompareLatestMonth,
avg(data.AGVG_JOIN_UP_FLAG) AS joinCompareLatestTrend
SELECT
avg( scj.JOIN_TOTAL ) AS total,
ROUND( avg( scj.AVG_JOIN ), 1 ) AS averageJoin,
avg( scj.JOIN_TOTAL_UP_RATE ) AS monthIncr,
(case when avg( scj.JOIN_TOTAL_UP_RATE ) &gt;0 then 'incr'
when avg( scj.JOIN_TOTAL_UP_RATE ) &lt; 0 then 'decr'
else 'eq'
end )as monthTrend,
ROUND( avg( scj.AVG_ISSUE ), 1 ) AS averageIssue,
avg( scj.AVG_ISSUE_UP_RATE ) AS issueCompareLatestMonth,
(
case when avg( scj.AVG_ISSUE_UP_RATE )&gt; 0 then 'incr'
when avg( scj.AVG_ISSUE_UP_RATE ) &lt; 0 then 'decr'
else 'eq'
end
)as issueCompareLatestTrend,
avg( scj.AGVG_JOIN_UP_RATE ) AS joinCompareLatestMonth,
(
case when avg( scj.AGVG_JOIN_UP_RATE ) &gt; 0 then 'incr'
when avg( scj.AGVG_JOIN_UP_RATE ) &lt; 0 then 'decr'
else 'eq'
end
)as joinCompareLatestTrend
FROM
screen_user_join data
LEFT JOIN
screen_customer_agency agency
ON data.org_id = agency.agency_id
screen_user_join scj
LEFT JOIN screen_customer_agency agency ON scj.org_id = agency.agency_id
WHERE
data.DEL_FLAG = '0'
AND data.area_code like concat(#{areaCode},'%')
AND data.MONTH_ID = #{monthId}
<if test=" null != list and list.size() > 0">
<foreach collection="list" item="sub" open="AND ( data.customer_id = #{customerId} or" separator=" OR " close=")">
data.customerId = #{sub}
</foreach>
</if>
scj.DEL_FLAG = '0'
AND scj.MONTH_ID = #{monthId}
AND agency.PARENT_AREA_CODE =#{areaCode}
</select>

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java

@ -790,8 +790,8 @@ public class DemoController {
@RequestParam("dateId") String dateId,
@RequestParam("monthId") String monthId) {
screenProjectGridDailyService.extractionProjectGridDaily(customerId, dateId);
screenProjectOrgDailyService.extractionProjectOrgDaily(customerId, dateId);
screenProjectQuantityGridMonthlyService.extractionProjectGridMonthly(customerId, monthId);
screenProjectOrgDailyService.extractionProjectOrgDaily(customerId, dateId);
screenProjectQuantityOrgMonthlyService.extractionProjectOrgMonthly(customerId, monthId);
return new Result();
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java

@ -23,6 +23,8 @@ import com.epmet.entity.crm.CustomerRelationEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 客户关系表(01.14 add)
*
@ -39,4 +41,6 @@ public interface CustomerRelationDao extends BaseDao<CustomerRelationEntity> {
* @Date 2021/1/21 11:27
**/
CustomerSubInfoDTO selectCustomerSubInfo(@Param("customerId")String customerId);
List<CustomerRelationEntity> selectListByPids(String customerId);
}

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

@ -192,4 +192,6 @@ public interface ScreenCustomerAgencyDao extends BaseDao<ScreenCustomerAgencyEnt
* @date 2021/2/1 下午2:03
*/
List<ScreenProjectOrgDailyDTO> selectAgencyByCustomer(@Param("customerId")String customerId);
List<ScreenProjectOrgDailyDTO> selectAgencyByAreaCode(String areaCode);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java

@ -31,4 +31,6 @@ public interface StatsCustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
* @date 2021/1/14 上午11:07
*/
List<CustomerAreaCodeResultDTO> selectCustomerAreaCodeById(@Param("customerIds") List<String> customerIds);
CustomerAgencyEntity getRootAgencyInfo(String customerId);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerRelationService.java

@ -41,4 +41,6 @@ public interface CustomerRelationService extends BaseService<CustomerRelationEnt
* @Date 2021/1/14 16:22
**/
Map<String, CustomerSubInfoDTO> getCustomerInfoMap(List<String> customerIds);
boolean haveSubCustomer(String customerId);
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerRelationServiceImpl.java

@ -73,4 +73,13 @@ public class CustomerRelationServiceImpl extends BaseServiceImpl<CustomerRelatio
}
return list.stream().collect(Collectors.toMap(CustomerSubInfoDTO::getCustomerId, customer -> customer));
}
@Override
public boolean haveSubCustomer(String customerId) {
List<CustomerRelationEntity> list=baseDao.selectListByPids(customerId);
if(null==list||list.isEmpty()){
return false;
}
return true;
}
}

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

@ -23,7 +23,6 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.DataSourceConstant;
@ -34,7 +33,10 @@ import com.epmet.dto.pingyin.result.ProjectOrgDailyResultDTO;
import com.epmet.dto.screen.ScreenProjectOrgDailyDTO;
import com.epmet.dto.screencoll.ScreenCollFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenProjectOrgDailyEntity;
import com.epmet.entity.org.CustomerAgencyEntity;
import com.epmet.service.crm.CustomerRelationService;
import com.epmet.service.evaluationindex.screen.ScreenProjectOrgDailyService;
import com.epmet.service.org.CustomerAgencyService;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils;
@ -45,6 +47,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -62,6 +65,10 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl<ScreenProj
@Autowired
private ScreenCustomerAgencyDao agencyDao;
@Autowired
private CustomerRelationService customerRelationService;
@Autowired
private CustomerAgencyService customerAgencyService;
@Override
public PageData<ScreenProjectOrgDailyDTO> page(Map<String, Object> params) {
@ -148,9 +155,18 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl<ScreenProj
*/
@Override
public void extractionProjectOrgDaily(String customerId, String dateId) {
List<ScreenProjectOrgDailyDTO> agencyInfos = agencyDao.selectAgencyByCustomer(customerId);
List<ScreenProjectOrgDailyDTO> agencyInfos = new ArrayList<>();
//如果有子客户要按照跟组织的area_code查询组织列表
if(customerRelationService.haveSubCustomer(customerId)){
//
CustomerAgencyEntity rootAgency=customerAgencyService.getRootAgencyInfo(customerId);
agencyInfos=agencyDao.selectAgencyByAreaCode(rootAgency.getAreaCode());
}else{
agencyInfos=agencyDao.selectAgencyByCustomer(customerId);
}
if (CollectionUtils.isEmpty(agencyInfos)){
throw new RenException(String.format(PingYinConstants.AGENCY_INFO_IS_ZERO,customerId));
log.warn(String.format(PingYinConstants.AGENCY_INFO_IS_ZERO,customerId));
return;
}
List<ProjectOrgDailyResultDTO> projectOrgDaily = baseDao.selectOrgProject(agencyInfos, dateId);
if (CollectionUtils.isEmpty(projectOrgDaily)){

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

@ -23,7 +23,6 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.DataSourceConstant;
@ -35,7 +34,10 @@ 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.screen.ScreenProjectQuantityOrgMonthlyService;
import com.epmet.service.org.CustomerAgencyService;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils;
@ -45,6 +47,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -62,7 +65,10 @@ public class ScreenProjectQuantityOrgMonthlyServiceImpl extends BaseServiceImpl<
@Autowired
private ScreenCustomerAgencyDao agencyDao;
@Autowired
private CustomerRelationService customerRelationService;
@Autowired
private CustomerAgencyService customerAgencyService;
@Override
public PageData<ScreenProjectQuantityOrgMonthlyDTO> page(Map<String, Object> params) {
IPage<ScreenProjectQuantityOrgMonthlyEntity> page = baseDao.selectPage(
@ -147,10 +153,20 @@ public class ScreenProjectQuantityOrgMonthlyServiceImpl extends BaseServiceImpl<
*/
@Override
public void extractionProjectOrgMonthly(String customerId, String monthId) {
List<ScreenProjectOrgDailyDTO> screenProjectOrgDailyDTOS = agencyDao.selectAgencyByCustomer(customerId);
List<ScreenProjectOrgDailyDTO> screenProjectOrgDailyDTOS = new ArrayList<>();
//如果有子客户要按照跟组织的area_code查询组织列表
if(customerRelationService.haveSubCustomer(customerId)){
//
CustomerAgencyEntity rootAgency=customerAgencyService.getRootAgencyInfo(customerId);
screenProjectOrgDailyDTOS=agencyDao.selectAgencyByAreaCode(rootAgency.getAreaCode());
}else{
screenProjectOrgDailyDTOS=agencyDao.selectAgencyByCustomer(customerId);
}
if (CollectionUtils.isEmpty(screenProjectOrgDailyDTOS)){
throw new RenException(String.format(PingYinConstants.AGENCY_INFO_IS_ZERO,customerId));
log.warn(String.format(PingYinConstants.AGENCY_INFO_IS_ZERO,customerId));
return;
}
List<ScreenProjectQuantityOrgMonthlyDTO> agencyInfos = ConvertUtils.sourceToTarget(screenProjectOrgDailyDTOS, ScreenProjectQuantityOrgMonthlyDTO.class);
List<ProjectOrgMonthlyResultDTO> projectOrg = baseDao.selectQuantityOrgMonthly(agencyInfos, monthId);
if (!CollectionUtils.isEmpty(projectOrg)){
@ -174,6 +190,7 @@ public class ScreenProjectQuantityOrgMonthlyServiceImpl extends BaseServiceImpl<
if (a.getAreaCode().equals(p.getAreaCode())){
a.setClosedIncr(p.getClosedIncr());
a.setProjectIncr(p.getProjectIncr());
a.setProjectIncr(p.getProjectIncr());
}
});
}
@ -183,6 +200,7 @@ public class ScreenProjectQuantityOrgMonthlyServiceImpl extends BaseServiceImpl<
a.setClosedTotal(p.getClosedTotal());
a.setProjectTotal(p.getProjectTotal());
a.setUnClosedTotal(p.getUnClosedTotal());
a.setProjectIncr(p.getProjectIncr());
}
});
}

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

@ -18,4 +18,6 @@ public interface CustomerAgencyService {
* @date 2021/1/14 上午11:07
*/
List<CustomerAreaCodeResultDTO> selectCustomerAreaCodeById(List<String> customerIds);
CustomerAgencyEntity getRootAgencyInfo(String customerId);
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java

@ -45,4 +45,9 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService {
}
return new ArrayList<>();
}
@Override
public CustomerAgencyEntity getRootAgencyInfo(String customerId) {
return customerAgencyDao.getRootAgencyInfo(customerId);
}
}

12
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerRelationDao.xml

@ -22,4 +22,16 @@
AND cr.`STATUS` = 'open'
AND cr.PARENT_CUSTOMER_ID =#{customerId}
</select>
<select id="selectListByPids" parameterType="java.lang.String" resultType="com.epmet.entity.crm.CustomerRelationEntity">
SELECT
*
FROM
customer_relation cr
WHERE
cr.DEL_FLAG = '0'
AND cr.PIDS LIKE CONCAT(
#{customerId},
'%')
</select>
</mapper>

13
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml

@ -377,4 +377,17 @@
WHERE DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId}
</select>
<select id="selectAgencyByAreaCode" resultType="com.epmet.dto.screen.ScreenProjectOrgDailyDTO">
SELECT
sca.CUSTOMER_ID,
sca.AGENCY_ID AS orgId,
sca.PID,
sca.PIDS,
sca.`LEVEL` AS orgType,
sca.AREA_CODE
FROM screen_customer_agency sca
WHERE DEL_FLAG = 0
and sca.AREA_CODE like CONCAT(#{areaCode},'%')
</select>
</mapper>

7
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml

@ -118,4 +118,11 @@
)
</select>
<select id="getRootAgencyInfo" resultType="com.epmet.entity.org.CustomerAgencyEntity">
select *
from customer_agency ca
where ca.del_flag='0'
and ca.pid='0'
and ca.CUSTOMER_ID=#{customerId}
</select>
</mapper>
Loading…
Cancel
Save