Browse Source

Merge branch 'dev_gridmember_fusion' into develop

# Conflicts:
#	epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java
#	epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PartyMemberLeadServiceImpl.java
#	epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
#	epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java
dev_shibei_match
sunyuchao 4 years ago
parent
commit
7b199a6fbd
  1. 1
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java
  2. 16
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactGridMemberStatisticsDailyEntity.java
  3. 13
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/FineExampleFormDTO.java
  4. 3
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java
  5. 7
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPioneerDataDao.java
  6. 1
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java
  7. 54
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PartyMemberLeadServiceImpl.java
  8. 6
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml
  9. 14
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml
  10. 116
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/crm/CustomerRelationDTO.java
  11. 16
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsDailyDTO.java
  12. 12
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadDataFormDTO.java
  13. 12
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadEventFormDTO.java
  14. 10
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StatsStaffPatrolRecordDailyDTO.java
  15. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  16. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java
  17. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsDailyEntity.java
  18. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/user/StatsStaffPatrolRecordDailyEntity.java
  19. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java
  20. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java
  21. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridMemberStatisticsDailyServiceImpl.java
  22. 44
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java
  23. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java
  24. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java
  25. 6
      epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.21__grid_member_statistics.sql
  26. 11
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerRelationDao.xml
  27. 9
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DatsStatsDao.xml
  28. 7
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml
  29. 12
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StatsStaffPatrolRecordDailyDTO.java
  30. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StatsStaffPatrolRecordDailyEntity.java
  31. 4
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.16__alter_stats_staff_patrol_record_daily.sql

1
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java

@ -7,6 +7,7 @@ import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.dto.epmetuser.form.OpenStaffDetailFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.GridMemberStatsFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.OpenStaffDetailFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.PatrolDateListFormDTO;

16
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactGridMemberStatisticsDailyEntity.java

@ -53,11 +53,21 @@ public class FactGridMemberStatisticsDailyEntity extends BaseEpmetEntity {
*/
private String yearId;
/**
* 客户ID
*/
/**
* 来源类型 external:外部internal:内部
*/
private String sourceType;
/**
* 客户Id
*/
private String customerId;
/**
* 数据来源客户Id
*/
private String sourceCustomerId;
/**
* 组织ID
*/

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

@ -3,7 +3,6 @@ package com.epmet.evaluationindex.screen.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
@ -22,4 +21,16 @@ public class FineExampleFormDTO implements Serializable {
*/
@NotBlank(message = "机关ID不能为空",groups = {FineExample.class})
private String agencyId;
/**
* 目前只有平阴在传默认赋值370124,跟随8个街道变化
*/
private String areaCode;
/**
* 当前token中的客户id
*/
@NotBlank(message = "token中的customerId不能为空",groups = {FineExample.class})
private String customerId;
}

3
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java

@ -30,7 +30,8 @@ public class PartyMemberLeadController {
* @date 2020/8/20 1:56 下午
*/
@PostMapping("fineexample")
public Result<FineExampleResultDTO> fineExample(@RequestBody FineExampleFormDTO fineExampleFormDTO){
public Result<FineExampleResultDTO> fineExample(@RequestHeader("CustomerId") String customerId,@RequestBody FineExampleFormDTO fineExampleFormDTO){
fineExampleFormDTO.setCustomerId(customerId);
ValidatorUtils.validateEntity(fineExampleFormDTO, FineExampleFormDTO.FineExample.class);
return new Result<FineExampleResultDTO>().ok(partyMemberLeadService.fineExample(fineExampleFormDTO));
}

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

@ -21,8 +21,6 @@ import com.epmet.evaluationindex.screen.dto.result.FineExampleResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 党建引领-先锋模范数据
*
@ -43,12 +41,11 @@ public interface ScreenPioneerDataDao{
/**
* @Description 根据地区码查询先锋模范
* @param areaCode
* @param customerId
* @param customerIds - 子级客户列表
* @param dataEndTime 默认是昨天yyyyMMdd
* @return com.epmet.evaluationindex.screen.dto.result.FineExampleResultDTO
* @author wangc
* @date 2021.02.24 15:39
*/
FineExampleResultDTO selectFineExampleByAreaCode(@Param("areaCode")String areaCode,@Param("customerId")String customerId,@Param("list") List<String> customerIds);
FineExampleResultDTO selectFineExampleByAreaCode(@Param("areaCode") String areaCode, @Param("dataEndTime") String dataEndTime);
}

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

@ -110,6 +110,7 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService {
}
PageHelper.startPage(NumConstant.ONE,param.getTopNum());
if (StringUtils.isNotEmpty(param.getAreaCode())){
// 目前只有平阴大屏才会传areaCode,下面的sql限制住状态为:处理中
result = screenDifficultyDataDao.selectDifficultyByAreaCode(param.getAreaCode(),param.getType());
}else {
result = screenDifficultyDataDao.selectDifficulty(param.getAgencyId(),param.getType());

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

@ -3,16 +3,13 @@ package com.epmet.datareport.service.evaluationindex.screen.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.RenException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.*;
import com.epmet.datareport.service.evaluationindex.screen.AgencyService;
import com.epmet.datareport.service.evaluationindex.screen.PartyMemberLeadService;
import com.epmet.datareport.utils.DateUtils;
import com.epmet.datareport.utils.ModuleConstant;
import com.epmet.dto.result.ScreenCustomerAgencyDTO;
import com.epmet.evaluationindex.screen.constant.ScreenConstant;
import com.epmet.evaluationindex.screen.dto.form.AgencyAndNumFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ContactMassLineChartFormDTO;
@ -62,41 +59,38 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService {
private AgencyService screenCustomerAgencyService;
/**
* @Description 1先锋模范
* @param fineExampleFormDTO
* @Description 1先锋模范
* @author zxc
* @date 2020/8/20 1:56 下午
*/
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
@Override
public FineExampleResultDTO fineExample(FineExampleFormDTO fineExampleFormDTO) {
ScreenCustomerAgencyDTO agencyInfo = customerAgencyDao.selectByAgencyId(fineExampleFormDTO.getAgencyId());
if(null == agencyInfo) throw new RenException("未找到对应的机关");
String customerId = agencyInfo.getCustomerId();
String areaCode = agencyInfo.getAreaCode();
Result<List<String>> crmResponse = operCrmOpenFeignClient.getAllSubCustomerIds(customerId);
List<String> subCustomers;
if(null == crmResponse || !crmResponse.success())
{subCustomers = null;}
else
{subCustomers = crmResponse.getData();}
FineExampleResultDTO fineExampleResultDTO;
if(CollectionUtils.isEmpty(subCustomers)) {
fineExampleResultDTO = screenPioneerDataDao.selectFineExample(fineExampleFormDTO.getAgencyId());
}else {
fineExampleResultDTO = screenPioneerDataDao.selectFineExampleByAreaCode(areaCode, customerId, subCustomers);
if (null == fineExampleResultDTO) {
return new FineExampleResultDTO();
FineExampleResultDTO fineExampleResultDTO;
if (StringUtils.isNotBlank(fineExampleFormDTO.getAreaCode())) {
//如果是平阴县的areaCode
if ("370124".equals(fineExampleFormDTO.getAreaCode())) {
String yesterDay = com.epmet.commons.tools.utils.DateUtils.getBeforeNDay(1);
// 只有平阴的需要汇聚 8个街道的数
fineExampleResultDTO = screenPioneerDataDao.selectFineExampleByAreaCode(fineExampleFormDTO.getAreaCode(), yesterDay);
} else {
// 不是平阴的话,依然按照agencyId查询
fineExampleResultDTO = screenPioneerDataDao.selectFineExample(fineExampleFormDTO.getAgencyId());
}
fineExampleResultDTO.setIssueRatio(this.getRatio(fineExampleResultDTO.getIssueRatioA()));
fineExampleResultDTO.setPublishIssueRatio(this.getRatio(fineExampleResultDTO.getPublishIssueRatioA()));
fineExampleResultDTO.setResolvedProjectRatio(this.getRatio(fineExampleResultDTO.getResolvedProjectRatioA()));
fineExampleResultDTO.setTopicRatio(this.getRatio(fineExampleResultDTO.getTopicRatioA()));
fineExampleResultDTO.setShiftProjectRatio(this.getRatio(fineExampleResultDTO.getShiftProjectRatioA()));
fineExampleResultDTO.setPlatJoinPartyRatio(this.getRatio(Double.valueOf(fineExampleResultDTO.getPlatJoinPartyRatio())));
} else {
//单客户直接按照agencyId查询
fineExampleResultDTO = screenPioneerDataDao.selectFineExample(fineExampleFormDTO.getAgencyId());
}
if (null == fineExampleResultDTO) {
return new FineExampleResultDTO();
}
fineExampleResultDTO.setIssueRatio(this.getRatio(fineExampleResultDTO.getIssueRatioA()));
fineExampleResultDTO.setPublishIssueRatio(this.getRatio(fineExampleResultDTO.getPublishIssueRatioA()));
fineExampleResultDTO.setResolvedProjectRatio(this.getRatio(fineExampleResultDTO.getResolvedProjectRatioA()));
fineExampleResultDTO.setTopicRatio(this.getRatio(fineExampleResultDTO.getTopicRatioA()));
fineExampleResultDTO.setShiftProjectRatio(this.getRatio(fineExampleResultDTO.getShiftProjectRatioA()));
fineExampleResultDTO.setPlatJoinPartyRatio(this.getRatio(Double.valueOf(fineExampleResultDTO.getPlatJoinPartyRatio())));
return fineExampleResultDTO;
}

6
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml

@ -14,7 +14,7 @@
diff.EVENT_IMG_URL AS imgUrl,
IFNULL(diff.EVENT_CATEGORY_NAME,'') AS categoryName,
diff.EVENT_RE_ORG AS handleDepts,
diff.EVENT_RE_ORG AS handleCount
diff.EVENT_HANDLED_COUNT AS handleCount
FROM
screen_difficulty_data diff
WHERE
@ -63,13 +63,15 @@
diff.EVENT_IMG_URL AS imgUrl,
IFNULL(diff.EVENT_CATEGORY_NAME,'') AS categoryName,
diff.EVENT_RE_ORG AS handleDepts,
diff.EVENT_RE_ORG AS handleCount
diff.EVENT_HANDLED_COUNT AS handleCount
FROM
screen_difficulty_data diff
left join screen_customer_grid scg
on(diff.ORG_ID=scg.GRID_ID and scg.DEL_FLAG='0')
WHERE
diff.DEL_FLAG = '0'
and diff.orgType='grid'
and diff.EVENT_STATUS_CODE in('pending','0')
AND scg.AREA_CODE like concat(#{areaCode},'%')
ORDER BY
(CASE #{type}

14
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml

@ -49,20 +49,12 @@
DATA_END_TIME as dataEndTime
FROM
screen_pioneer_data data
LEFT JOIN
screen_customer_agency agency
ON data.org_id = agency.agency_id
ON (data.org_id = agency.agency_id and agency.del_flag='0')
WHERE
data.del_flag = '0'
AND data.org_type = 'agency'
AND agency.area_code LIKE concat(#{areaCode},'%')
<if test=" null != list and list.size() > 0">
<foreach collection="list" item="subId" open="AND ( data.customer_id = #{customerId} OR " separator=" OR " close=" )">
data.customer_id = #{subId}
</foreach>
</if>
ORDER BY data.data_end_time DESC
LIMIT 1
and agency.PARENT_AREA_CODE=#{areaCode}
and data.DATA_END_TIME=#{dataEndTime}
</select>
</mapper>

116
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/crm/CustomerRelationDTO.java

@ -0,0 +1,116 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.crm;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 客户关系表(01.14 add)
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-02-03
*/
@Data
public class CustomerRelationDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户id
*/
private String customerId;
/**
* 父级客户id;如果是顶级客户此列=0
*/
private String parentCustomerId;
/**
* 当前客户的所有父级客户id,以英文冒号隔开如果是顶级客户此列=0
*/
private String pids;
/**
* 当前客户类型取值 external:外部客户internal:内部客户
*/
private String customerType;
/**
* 父级客户类型取值 external:外部客户internal:内部客户;如果是顶级客户此列=0
*/
private String parentCustomerType;
/**
* open,closed是否启用
*/
private String status;
/**
* 当前客户级别社区级community
街道:street,
区县级: district,
市级: city
省级:province
*/
private String level;
/**
* 当前客户的地区编码实际就是根组织的area_code
*/
private String areaCode;
/**
* 删除标识0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

16
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsDailyDTO.java

@ -53,11 +53,21 @@ public class FactGridMemberStatisticsDailyDTO implements Serializable {
*/
private String yearId;
/**
* 客户ID
*/
/**
* 来源类型 external:外部internal:内部
*/
private String sourceType;
/**
* 客户Id
*/
private String customerId;
/**
* 数据来源客户Id
*/
private String sourceCustomerId;
/**
* 组织ID
*/

12
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadDataFormDTO.java

@ -21,12 +21,6 @@ public class GmUploadDataFormDTO implements Serializable {
* 为true时需要删除历史数据
*/
private Boolean isFirst;
//客户Id
@NotBlank(message = "客户Id不能为空", groups = {UploadData.class})
private String customerId;
//日维度Id
@NotBlank(message = "dateId不能为空", groups = {UploadData.class})
private String dateId;
//数据集合对象
@NotEmpty(message = "数据集合对象不能为空",groups = UploadData.class)
private List<DataList> dataList;
@ -34,8 +28,12 @@ public class GmUploadDataFormDTO implements Serializable {
@Data
public static class DataList{
//客户Id 【dim_customer.id】
//来源类型 external:外部,internal:内部
private String sourceType;
//客户Id 【dim_customer.id】[接口传入的是来源数据的客户Id]
private String customerId;
//数据来源客户Id
private String parentCustomerId;
//机关Id 【dim_agency.id】
private String agencyId;
//日维度Id 【dim_date.id】

12
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadEventFormDTO.java

@ -18,12 +18,6 @@ public class GmUploadEventFormDTO implements Serializable {
private static final long serialVersionUID = -9178779369245037701L;
//为true时需要删除历史数据
private Boolean isFirst;
//客户Id
@NotBlank(message = "客户Id不能为空", groups = {UploadEvent.class})
private String customerId;
//日维度Id
@NotBlank(message = "dateId不能为空", groups = {UploadEvent.class})
private String dateId;
//数据集合对象
@NotEmpty(message = "数据集合对象不能为空",groups = UploadEvent.class)
private List<DataList> dataList;
@ -31,8 +25,12 @@ public class GmUploadEventFormDTO implements Serializable {
@Data
public static class DataList{
//客户Id 【dim_customer.id】
//来源类型 external:外部,internal:内部
private String sourceType;
//客户Id 【dim_customer.id】[接口传入的是来源数据的客户Id]
private String customerId;
//数据来源客户Id
private String parentCustomerId;
//机关Id 【dim_agency.id】
private String agencyId;
//日维度Id 【dim_date.id】

10
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StatsStaffPatrolRecordDailyDTO.java

@ -39,11 +39,21 @@ public class StatsStaffPatrolRecordDailyDTO implements Serializable {
*/
private String id;
/**
* 来源类型 external:外部internal:内部
*/
private String sourceType;
/**
* 客户Id
*/
private String customerId;
/**
* 数据来源客户Id
*/
private String sourceCustomerId;
/**
* 统计日期 关联日期dim表
*/

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

@ -945,6 +945,12 @@ public class DemoController {
return new Result();
}
@PostMapping("extractFactGridMemberDaily")
public Result extractFactGridMemberDaily(@RequestBody ExtractFactGridGovernDailyFromDTO fromDTO){
factGridMemberStatisticsDailyService.extractGridMemberStatisticsDaily(fromDTO.getCustomerId(), fromDTO.getDateId());
return new Result();
}
/**
* @return com.epmet.commons.tools.utils.Result
@ -963,12 +969,6 @@ public class DemoController {
return new Result();
}
@PostMapping("extractFactGridMemberDaily")
public Result extractFactGridMemberDaily(@RequestBody ExtractFactGridGovernDailyFromDTO fromDTO){
factGridMemberStatisticsDailyService.extractGridMemberStatisticsDaily(fromDTO.getCustomerId(), fromDTO.getDateId());
return new Result();
}
@Autowired
private CustomerAgencyService customerAgencyService;
@Autowired

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

@ -18,6 +18,7 @@
package com.epmet.dao.crm;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.crm.CustomerRelationDTO;
import com.epmet.dto.indexcal.CustomerSubInfoDTO;
import com.epmet.entity.crm.CustomerRelationEntity;
import org.apache.ibatis.annotations.Mapper;
@ -51,4 +52,11 @@ public interface CustomerRelationDao extends BaseDao<CustomerRelationEntity> {
* @date 2021/3/23 上午10:21
*/
List<CustomerRelationEntity> selectSubCustomer(@Param("customerId") String customerId);
/**
* @Description 查询客户所属父客户信息
* @author sun
*/
CustomerRelationDTO selectByCustomerId(@Param("customerId") String customerId);
}

16
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsDailyEntity.java

@ -53,11 +53,21 @@ public class FactGridMemberStatisticsDailyEntity extends BaseEpmetEntity {
*/
private String yearId;
/**
* 客户ID
*/
/**
* 来源类型 external:外部internal:内部
*/
private String sourceType;
/**
* 客户Id
*/
private String customerId;
/**
* 数据来源客户Id
*/
private String sourceCustomerId;
/**
* 组织ID
*/

16
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/user/StatsStaffPatrolRecordDailyEntity.java

@ -38,11 +38,21 @@ public class StatsStaffPatrolRecordDailyEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
/**
* 来源类型 external:外部internal:内部
*/
private String sourceType;
/**
* 客户Id
*/
private String customerId;
/**
* 数据来源客户Id
*/
private String sourceCustomerId;
/**
* 统计日期 关联日期dim表
*/

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java

@ -1,5 +1,6 @@
package com.epmet.service.crm;
import com.epmet.dto.crm.CustomerRelationDTO;
import com.epmet.entity.crm.CustomerEntity;
import java.util.Date;
@ -10,4 +11,10 @@ public interface CustomerService {
List<CustomerEntity> listValidCustomersByCreateTime(Date createTimeFrom, Date createTimeTo);
List<CustomerEntity> listValidCustomersByUpdatedTime(Date updatedTime, Date initTime);
/**
* @Description 查询客户所属父客户信息
* @author sun
*/
CustomerRelationDTO getByCustomerId(String customerId);
}

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java

@ -3,6 +3,8 @@ package com.epmet.service.crm.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.crm.CustomerDao;
import com.epmet.dao.crm.CustomerRelationDao;
import com.epmet.dto.crm.CustomerRelationDTO;
import com.epmet.entity.crm.CustomerEntity;
import com.epmet.service.crm.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
@ -17,6 +19,8 @@ public class CustomerServiceImpl implements CustomerService {
@Autowired
private CustomerDao customerDao;
@Autowired
private CustomerRelationDao customerRelationDao;
@Override
public List<CustomerEntity> listValidCustomersByCreateTime(Date createTimeFrom, Date createTimeTo) {
@ -27,4 +31,13 @@ public class CustomerServiceImpl implements CustomerService {
public List<CustomerEntity> listValidCustomersByUpdatedTime(Date startTime, Date endTime) {
return customerDao.listValidCustomersByUpdateTime(startTime, endTime);
}
/**
* @Description 查询客户所属父客户信息
* @author sun
*/
@Override
public CustomerRelationDTO getByCustomerId(String customerId) {
return customerRelationDao.selectByCustomerId(customerId);
}
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridMemberStatisticsDailyServiceImpl.java

@ -293,6 +293,8 @@ public class FactGridMemberStatisticsDailyServiceImpl extends BaseServiceImpl<Fa
entity.setProjectResponseIncr(NumConstant.ZERO);
entity.setProjectTransferCount(NumConstant.ZERO);
entity.setProjectTransferIncr(NumConstant.ZERO);
entity.setSourceType("internal");
entity.setSourceCustomerId(customerId);
return entity;
}

44
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java

@ -3,16 +3,19 @@ package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.ProjectConstant;
import com.epmet.dao.stats.DataStatsDao;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.StatsFormDTO;
import com.epmet.dto.crm.CustomerRelationDTO;
import com.epmet.dto.stats.form.GmUploadDataFormDTO;
import com.epmet.dto.stats.form.GmUploadEventFormDTO;
import com.epmet.dto.stats.user.result.UserStatisticalData;
import com.epmet.service.StatsUserService;
import com.epmet.service.crm.CustomerService;
import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService;
import com.epmet.service.stats.DimAgencyService;
import com.epmet.service.stats.DimCustomerService;
@ -26,6 +29,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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.util.Calendar;
@ -60,6 +64,8 @@ public class StatsUserServiceImpl implements StatsUserService {
private ScreenCustomerAgencyService screenCustomerAgencyService;
@Autowired
private DataStatsDao dataStatsDao;
@Autowired
private CustomerService customerService;
/**
@ -149,17 +155,19 @@ public class StatsUserServiceImpl implements StatsUserService {
* @author sun
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void gmUploadEvent(GmUploadEventFormDTO formDTO) {
//1.判断是否批量删除历史数据
if (formDTO.getIsFirst()) {
int deleteNum;
do {
deleteNum = userService.delGmUploadEvent(formDTO.getCustomerId(), formDTO.getDateId());
} while (deleteNum > NumConstant.ZERO);
}
//1.数据上报只涉及数据库部分数据,其他数据都是计算出来的,所以不存在删除历史数据,有就更新没有就新增
String customerId = formDTO.getDataList().get(0).getCustomerId();
//2.查询当前客户index库组织信息供数据封装使用
List<CustomerAgencyDTO> agencyList = screenCustomerAgencyService.getByCustomerId(formDTO.getCustomerId());
//2.数据准备
//2-1.查询当前客户index库组织信息供数据封装使用
List<CustomerAgencyDTO> agencyList = screenCustomerAgencyService.getByCustomerId(customerId);
//2-2.查询客户所属父客户信息
CustomerRelationDTO crm = customerService.getByCustomerId(customerId);
if (null == crm) {
throw new RenException(String.format("未查询到子客户所属父客户信息,子客户Id->%s", customerId));
}
//3.分批处理上传数据
List<List<GmUploadEventFormDTO.DataList>> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED);
@ -175,6 +183,8 @@ public class StatsUserServiceImpl implements StatsUserService {
}
});
if (bl.get()) {
m.setSourceType("external");
m.setParentCustomerId(crm.getParentCustomerId());
m.setGridPids(gridPids.toString());
m.setPatrolTotal(NumConstant.ZERO);
m.setTotalTime(NumConstant.ZERO);
@ -197,17 +207,25 @@ public class StatsUserServiceImpl implements StatsUserService {
* @author sun
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void gmUploadData(GmUploadDataFormDTO formDTO) {
String customerId = formDTO.getDataList().get(0).getCustomerId();
//1.判断是否批量删除历史数据
if (formDTO.getIsFirst()) {
int deleteNum;
do {
deleteNum = dataStatsDao.delGmUploadData(formDTO.getCustomerId(), formDTO.getDateId());
deleteNum = dataStatsDao.delGmUploadData(customerId, formDTO.getDataList().get(0).getDateId());
} while (deleteNum > NumConstant.ZERO);
}
//2.查询当前客户index库组织信息供数据封装使用
List<CustomerAgencyDTO> agencyList = screenCustomerAgencyService.getByCustomerId(formDTO.getCustomerId());
//2.数据准备
//2-1.查询当前客户index库组织信息供数据封装使用
List<CustomerAgencyDTO> agencyList = screenCustomerAgencyService.getByCustomerId(customerId);
//2-2.查询客户所属父客户信息
CustomerRelationDTO crm = customerService.getByCustomerId(customerId);
if (null == crm) {
throw new RenException(String.format("未查询到子客户所属父客户信息,子客户Id->%s", customerId));
}
//3.分批处理上传数据
List<List<GmUploadDataFormDTO.DataList>> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED);
@ -225,6 +243,8 @@ public class StatsUserServiceImpl implements StatsUserService {
}
});
if (bl.get()) {
m.setSourceType("external");
m.setParentCustomerId(crm.getParentCustomerId());
m.setPid(pid.toString());
m.setPids(pids.toString());
} else {

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java

@ -11,6 +11,7 @@ import com.epmet.dto.org.CustomerStaffGridDTO;
import com.epmet.dto.org.GridInfoDTO;
import com.epmet.entity.org.CustomerGridEntity;
import com.epmet.service.org.CustomerGridService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
@ -20,6 +21,9 @@ import java.util.List;
@DataSource(DataSourceConstant.GOV_ORG)
public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, CustomerGridEntity> implements CustomerGridService {
@Autowired
private CustomerGridDao customerGridDao;
@Override
public List<CustomerGridEntity> listGridsByCreateTime(Date start, Date end) {
return baseDao.listGridsByCreateTime(start, end);

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java

@ -128,7 +128,7 @@ public interface UserService {
/**
* @Description 数据上报--网格员事件总数上报--按客户Id和dateId删除历史数据
* @author sun
* @author sun [接口废弃暂无使用]
*/
int delGmUploadEvent(String customerId, String dateId);

6
epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.21__grid_member_statistics.sql

@ -39,3 +39,9 @@ ALTER TABLE `epmet_data_statistical`.`fact_grid_member_statistics_daily`
ALTER TABLE `epmet_data_statistical`.`fact_origin_project_main_daily`
ADD COLUMN `PROJECT_CREATOR` varchar(32) NULL COMMENT '项目创建人(议题转项目或立项人)' AFTER `IS_SATISFIED`;
#fact_grid_member_statistics_daily 表添加字段
ALTER TABLE `fact_grid_member_statistics_daily`
MODIFY COLUMN `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据归属客户ID【例:孔村上报数据属于平阴的】' AFTER `YEAR_ID`,
ADD COLUMN `SOURCE_TYPE` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'internal' COMMENT '来源类型 external:外部,internal:内部' AFTER `YEAR_ID`,
ADD COLUMN `SOURCE_CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '数据来源客户Id' AFTER `CUSTOMER_ID`;

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

@ -39,4 +39,15 @@
<select id="selectSubCustomer" resultType="com.epmet.entity.crm.CustomerRelationEntity">
SELECT * FROM customer_relation WHERE DEL_FLAG = 0 AND PARENT_CUSTOMER_ID = #{customerId}
</select>
<select id="selectByCustomerId" resultType="com.epmet.dto.crm.CustomerRelationDTO">
SELECT
*
FROM
customer_relation
WHERE
del_flag = '0'
AND customer_id = #{customerId}
</select>
</mapper>

9
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DatsStatsDao.xml

@ -8,7 +8,7 @@
FROM
fact_grid_member_statistics_daily
WHERE
customer_id = #{customerId}
source_customer_id = #{customerId}
AND date_id = #{dateId}
LIMIT 1000
</delete>
@ -20,7 +20,9 @@
date_id,
month_id,
year_id,
source_type,
customer_id,
source_customer_id,
agency_id,
grid_id,
pid,
@ -53,6 +55,8 @@
#{i.dateId},
#{i.monthId},
#{i.yearId},
#{i.sourceType},
#{i.parentCustomerId},
#{i.customerId},
#{i.agencyId},
#{i.gridId},
@ -82,6 +86,9 @@
</foreach>
ON DUPLICATE KEY
UPDATE
source_type = values(source_type),
customer_id = values(customer_id),
source_customer_id = values(source_customer_id),
project_count = values(project_count),
issue_to_project_count = values(issue_to_project_count),
closed_issue_count = values(closed_issue_count),

7
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml

@ -641,7 +641,9 @@
INSERT INTO stats_staff_patrol_record_daily
(
id,
source_type,
customer_id,
source_customer_id,
date_id,
week_id,
month_id,
@ -667,6 +669,8 @@
<foreach collection="list" item="i" separator=",">
(
REPLACE(UUID(), '-', ''),
#{i.sourceType},
#{i.parentCustomerId},
#{i.customerId},
#{i.dateId},
#{i.weekId},
@ -692,6 +696,9 @@
</foreach>
ON DUPLICATE KEY
UPDATE
source_type = values(source_type),
customer_id = values(customer_id),
source_customer_id = values(source_customer_id),
report_project_count = values(report_project_count),
updated_by = 'BASE_REPORT',
updated_time = NOW()

12
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StatsStaffPatrolRecordDailyDTO.java

@ -38,10 +38,20 @@ public class StatsStaffPatrolRecordDailyDTO implements Serializable {
*/
private String id;
/**
* 来源类型 external:外部internal:内部
*/
private String sourceType;
/**
* 客户Id
*/
private String customerId;
private String customerId;
/**
* 数据来源客户Id
*/
private String sourceCustomerId;
/**
* 统计日期 关联日期dim表

16
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StatsStaffPatrolRecordDailyEntity.java

@ -38,11 +38,21 @@ public class StatsStaffPatrolRecordDailyEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
/**
* 来源类型 external:外部internal:内部
*/
private String sourceType;
/**
* 客户Id
*/
private String customerId;
/**
* 数据来源客户Id
*/
private String sourceCustomerId;
/**
* 统计日期 关联日期dim表
*/

4
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.16__alter_stats_staff_patrol_record_daily.sql

@ -0,0 +1,4 @@
ALTER TABLE `stats_staff_patrol_record_daily`
ADD COLUMN `SOURCE_TYPE` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'internal' COMMENT '来源类型 external:外部,internal:内部' AFTER `ID`,
ADD COLUMN `SOURCE_CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '数据来源客户Id' AFTER `CUSTOMER_ID`;
Loading…
Cancel
Save