33 changed files with 851 additions and 19 deletions
@ -0,0 +1,18 @@ |
|||||
|
package com.epmet.dto.customize; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
|
||||
|
|
||||
|
@Data |
||||
|
public class IcResiCategoryConfigDTO implements Serializable { |
||||
|
private String configId; |
||||
|
/** |
||||
|
* 列名 |
||||
|
*/ |
||||
|
private String columnName; |
||||
|
|
||||
|
private String itemLabel; |
||||
|
} |
@ -0,0 +1,32 @@ |
|||||
|
package com.epmet.dto.extract.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import org.hibernate.validator.constraints.Length; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* 数字社区-人员类别分析,按天计算,入参 |
||||
|
* 以下参数都可以为空 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class IcUserCategoryAnalysisDailyFormDTO implements Serializable { |
||||
|
public interface AddUserInternalGroup { |
||||
|
} |
||||
|
|
||||
|
private String customerId; |
||||
|
@Length(max = 8, message = "日期格式:yyyyMMdd", groups = AddUserInternalGroup.class) |
||||
|
private String dateId; |
||||
|
|
||||
|
/** |
||||
|
* 开始时间 |
||||
|
*/ |
||||
|
@Length(max = 8, message = "开始日期日期格式:yyyyMMdd", groups = AddUserInternalGroup.class) |
||||
|
private String startDate; |
||||
|
/** |
||||
|
* 结束时间 |
||||
|
*/ |
||||
|
@Length(max = 8, message = "截止日期格式:yyyyMMdd", groups = AddUserInternalGroup.class) |
||||
|
private String endDate; |
||||
|
|
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
package com.epmet.dto.user.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
@Data |
||||
|
public class OrgIcUserTotalDTO implements Serializable { |
||||
|
private String orgId; |
||||
|
private Integer total; |
||||
|
private String columnName; |
||||
|
} |
@ -0,0 +1,76 @@ |
|||||
|
package com.epmet.controller; |
||||
|
|
||||
|
|
||||
|
import com.epmet.commons.tools.constant.NumConstant; |
||||
|
import com.epmet.commons.tools.utils.DateUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.dto.extract.form.IcUserCategoryAnalysisDailyFormDTO; |
||||
|
import com.epmet.service.stats.DimCustomerService; |
||||
|
import com.epmet.service.stats.FactIcuserCategoryAnalysisDailyService; |
||||
|
import org.apache.commons.collections4.CollectionUtils; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.time.LocalDate; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Description 数字社区相关统计任务可以放这,目前只有人员类别分析 |
||||
|
* @Author yinzuomei |
||||
|
* @Date 2022/01/17 |
||||
|
* @Version 1.0 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("ic") |
||||
|
public class IcController { |
||||
|
|
||||
|
@Autowired |
||||
|
private FactIcuserCategoryAnalysisDailyService userCategoryAnalysisDailyService; |
||||
|
@Autowired |
||||
|
private DimCustomerService dimCustomerService; |
||||
|
|
||||
|
/** |
||||
|
* 数字社区-基础信息-人员类别分析-每个类别的人员总数、较上月迁入迁出人数 |
||||
|
* 说明:安调统计,截止到当前dateId的党员总数;+30:迁入党员+之前的居民在本月内变更为党员身份的;-10:在本月丢失党员身份的人+迁出的人 |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/user/category-analysis-daily") |
||||
|
public Result statUserCategoryDaily(@RequestBody IcUserCategoryAnalysisDailyFormDTO formDTO) { |
||||
|
ValidatorUtils.validateEntity(formDTO, IcUserCategoryAnalysisDailyFormDTO.AddUserInternalGroup.class); |
||||
|
List<String> customerIds = new ArrayList<>(); |
||||
|
if (StringUtils.isNotBlank(formDTO.getCustomerId())) { |
||||
|
customerIds.add(formDTO.getCustomerId()); |
||||
|
} else { |
||||
|
//未指定客户,则查询dim_customer表
|
||||
|
customerIds = dimCustomerService.selectCustomerIdPage(NumConstant.ONE, NumConstant.ONE_THOUSAND); |
||||
|
} |
||||
|
if (CollectionUtils.isNotEmpty(customerIds)) { |
||||
|
customerIds.forEach(customerId -> { |
||||
|
if (StringUtils.isNotBlank(formDTO.getStartDate()) && StringUtils.isNotBlank(formDTO.getEndDate())) { |
||||
|
//[a,b]yyyyMMdd
|
||||
|
List<String> daysBetween = DateUtils.getDaysBetween(formDTO.getStartDate(), formDTO.getEndDate()); |
||||
|
daysBetween.forEach(dateId -> { |
||||
|
//计算网格维度的数据
|
||||
|
userCategoryAnalysisDailyService.statUserCategoryGridDaily(customerId, dateId); |
||||
|
}); |
||||
|
} else if (StringUtils.isNotBlank(formDTO.getDateId())) { |
||||
|
//计算网格维度的数据
|
||||
|
userCategoryAnalysisDailyService.statUserCategoryGridDaily(customerId, formDTO.getDateId()); |
||||
|
} else { |
||||
|
//计算网格维度的数据
|
||||
|
//当前时间的前一天yyyyMMdd
|
||||
|
String dateId = LocalDate.now().minusDays(NumConstant.ONE).toString().replace("-", ""); |
||||
|
userCategoryAnalysisDailyService.statUserCategoryGridDaily(customerId, dateId); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
package com.epmet.dao.customize; |
||||
|
|
||||
|
|
||||
|
import com.epmet.dto.customize.IcResiCategoryConfigDTO; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Mapper |
||||
|
public interface IcResiCategoryStatsConfigDao { |
||||
|
|
||||
|
|
||||
|
List<IcResiCategoryConfigDTO> queryDataColumn(String customerId); |
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
package com.epmet.dao.stats; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.entity.stats.FactIcuserCategoryAnalysisDailyEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
/** |
||||
|
* 人员类别分析 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-01-17 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface FactIcuserCategoryAnalysisDailyDao extends BaseDao<FactIcuserCategoryAnalysisDailyEntity> { |
||||
|
|
||||
|
int limitDelete(@Param("customerId")String customerId, |
||||
|
@Param("dateId")String dateId, |
||||
|
@Param("orgType")String orgType); |
||||
|
} |
@ -0,0 +1,74 @@ |
|||||
|
package com.epmet.entity.stats; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* 人员类别分析 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-01-17 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("fact_icuser_category_analysis_daily") |
||||
|
public class FactIcuserCategoryAnalysisDailyEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 客户id |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 预警配置ID |
||||
|
*/ |
||||
|
private String configId; |
||||
|
/** |
||||
|
* 类别列名,对个数据太麻烦了,在这个表存一下 |
||||
|
*/ |
||||
|
private String columnName; |
||||
|
/** |
||||
|
* 当前数据是截止到XXX的:yyyyMMdd |
||||
|
*/ |
||||
|
private String dateId; |
||||
|
|
||||
|
/** |
||||
|
* 网格id或者组织id |
||||
|
*/ |
||||
|
private String orgId; |
||||
|
|
||||
|
/** |
||||
|
* grid或者agency |
||||
|
*/ |
||||
|
private String orgType; |
||||
|
|
||||
|
/** |
||||
|
* orgid的上级 |
||||
|
*/ |
||||
|
private String pid; |
||||
|
|
||||
|
/** |
||||
|
* orgid的所有上级 |
||||
|
*/ |
||||
|
private String pids; |
||||
|
|
||||
|
/** |
||||
|
* 当前类别总人数 |
||||
|
*/ |
||||
|
private Integer total; |
||||
|
|
||||
|
/** |
||||
|
* 较上月迁出 |
||||
|
*/ |
||||
|
private Integer qcIncr; |
||||
|
|
||||
|
/** |
||||
|
* 较上月迁入 |
||||
|
*/ |
||||
|
private Integer qrIncr; |
||||
|
|
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
package com.epmet.service.customize; |
||||
|
|
||||
|
|
||||
|
import com.epmet.dto.customize.IcResiCategoryConfigDTO; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 居民类别配置表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-11-04 |
||||
|
*/ |
||||
|
public interface IcResiCategoryStatsConfigService { |
||||
|
|
||||
|
/** |
||||
|
* 返回用于数据分析的列名+居民类别配置表的id |
||||
|
* @param customerId |
||||
|
* @return |
||||
|
*/ |
||||
|
List<IcResiCategoryConfigDTO> queryDataColumn(String customerId); |
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
package com.epmet.service.customize.impl; |
||||
|
|
||||
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
||||
|
import com.epmet.constant.DataSourceConstant; |
||||
|
import com.epmet.dao.customize.IcResiCategoryStatsConfigDao; |
||||
|
import com.epmet.dto.customize.IcResiCategoryConfigDTO; |
||||
|
import com.epmet.service.customize.IcResiCategoryStatsConfigService; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 居民类别配置表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-11-04 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@DataSource(DataSourceConstant.OPER_CUSTOMIZE) |
||||
|
@Service |
||||
|
public class IcResiCategoryStatsConfigServiceImpl implements IcResiCategoryStatsConfigService{ |
||||
|
|
||||
|
@Autowired |
||||
|
private IcResiCategoryStatsConfigDao baseDao; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 返回用于数据分析的列名+居民类别配置表的id |
||||
|
* |
||||
|
* @param customerId |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<IcResiCategoryConfigDTO> queryDataColumn(String customerId) { |
||||
|
return baseDao.queryDataColumn(customerId); |
||||
|
} |
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
package com.epmet.service.stats; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.BaseService; |
||||
|
import com.epmet.entity.stats.FactIcuserCategoryAnalysisDailyEntity; |
||||
|
|
||||
|
/** |
||||
|
* 人员类别分析 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-01-17 |
||||
|
*/ |
||||
|
public interface FactIcuserCategoryAnalysisDailyService extends BaseService<FactIcuserCategoryAnalysisDailyEntity> { |
||||
|
/** |
||||
|
* 数字社区-基础信息-人员类别分析-每个类别的人员总数、较上月迁入迁出人数 |
||||
|
* 网格 |
||||
|
* @param customerId |
||||
|
* @param dateId |
||||
|
*/ |
||||
|
void statUserCategoryGridDaily(String customerId, String dateId); |
||||
|
} |
@ -0,0 +1,198 @@ |
|||||
|
package com.epmet.service.stats.impl; |
||||
|
|
||||
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
||||
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.epmet.commons.tools.constant.NumConstant; |
||||
|
import com.epmet.commons.tools.enums.OrgTypeEnum; |
||||
|
import com.epmet.constant.DataSourceConstant; |
||||
|
import com.epmet.dao.stats.FactIcuserCategoryAnalysisDailyDao; |
||||
|
import com.epmet.dto.customize.IcResiCategoryConfigDTO; |
||||
|
import com.epmet.dto.user.result.OrgIcUserTotalDTO; |
||||
|
import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity; |
||||
|
import com.epmet.entity.stats.FactIcuserCategoryAnalysisDailyEntity; |
||||
|
import com.epmet.service.customize.IcResiCategoryStatsConfigService; |
||||
|
import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService; |
||||
|
import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService; |
||||
|
import com.epmet.service.stats.FactIcuserCategoryAnalysisDailyService; |
||||
|
import com.epmet.service.user.UserService; |
||||
|
import com.google.common.collect.Lists; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.commons.collections4.CollectionUtils; |
||||
|
import org.apache.commons.collections4.MapUtils; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* 人员类别分析 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-01-17 |
||||
|
*/ |
||||
|
@Service |
||||
|
@Slf4j |
||||
|
@DataSource(DataSourceConstant.STATS) |
||||
|
public class FactIcuserCategoryAnalysisDailyServiceImpl extends BaseServiceImpl<FactIcuserCategoryAnalysisDailyDao, FactIcuserCategoryAnalysisDailyEntity> implements FactIcuserCategoryAnalysisDailyService { |
||||
|
|
||||
|
@Autowired |
||||
|
private IcResiCategoryStatsConfigService icResiCategoryStatsConfigService; |
||||
|
@Autowired |
||||
|
private ScreenCustomerAgencyService agencyService; |
||||
|
@Autowired |
||||
|
private ScreenCustomerGridService gridService; |
||||
|
@Autowired |
||||
|
private UserService userService; |
||||
|
|
||||
|
/** |
||||
|
* 数字社区-基础信息-人员类别分析-每个类别的人员总数、较上月迁入迁出人数 |
||||
|
* |
||||
|
* @param customerId |
||||
|
* @param dateId |
||||
|
*/ |
||||
|
@Override |
||||
|
public void statUserCategoryGridDaily(String customerId, String dateId) { |
||||
|
//查询出所有用语数据分析的类别column_name,没有则不计算
|
||||
|
List<IcResiCategoryConfigDTO> columnList = icResiCategoryStatsConfigService.queryDataColumn(customerId); |
||||
|
if (CollectionUtils.isEmpty(columnList)) { |
||||
|
return; |
||||
|
} |
||||
|
//所有网格查询出来
|
||||
|
List<ScreenCustomerGridEntity> gridDTOList = gridService.getByCustomerId(customerId); |
||||
|
if (CollectionUtils.isEmpty(gridDTOList)) { |
||||
|
return; |
||||
|
} |
||||
|
//网格维度、组织维度初始好数据
|
||||
|
List<FactIcuserCategoryAnalysisDailyEntity> initList = constructInitValue(customerId, dateId, gridDTOList, columnList); |
||||
|
if (CollectionUtils.isEmpty(initList)) { |
||||
|
return; |
||||
|
} |
||||
|
//当这3个数都为0的时候不插入数据库了
|
||||
|
List<FactIcuserCategoryAnalysisDailyEntity> insertList = initList.stream().filter(entity -> (null != entity.getTotal() && entity.getTotal() > 0) |
||||
|
|| (null != entity.getQcIncr() && entity.getQcIncr() > 0) |
||||
|
|| (null != entity.getQrIncr() && entity.getQrIncr() > 0)).collect(Collectors.toList()); |
||||
|
//删除旧数据
|
||||
|
clearOldDatas(customerId, dateId, OrgTypeEnum.GRID.getCode()); |
||||
|
// 批量插入数据
|
||||
|
Lists.partition(insertList, NumConstant.ONE_HUNDRED).forEach(list -> { |
||||
|
insertBatch(list); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除旧数据 |
||||
|
* |
||||
|
* @param customerId |
||||
|
* @param dateId |
||||
|
* @param orgType grid、agency |
||||
|
*/ |
||||
|
private void clearOldDatas(String customerId, String dateId, String orgType) { |
||||
|
int deleteNum; |
||||
|
do { |
||||
|
//每次删除1000条
|
||||
|
deleteNum = baseDao.limitDelete(customerId, dateId, orgType); |
||||
|
} while (deleteNum != NumConstant.ZERO); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param customerId |
||||
|
* @param dateId yyyyMMdd |
||||
|
* @param gridDTOList 当前客户下所有的网格 |
||||
|
* @param columnList 所有需要分析的类别对应的ic_resi_user的列名,目前只有18类 |
||||
|
* @return |
||||
|
*/ |
||||
|
private List<FactIcuserCategoryAnalysisDailyEntity> constructInitValue(String customerId, String dateId, List<ScreenCustomerGridEntity> gridDTOList, List<IcResiCategoryConfigDTO> columnList) { |
||||
|
List<FactIcuserCategoryAnalysisDailyEntity> list = new ArrayList<>(); |
||||
|
|
||||
|
//1、total
|
||||
|
// 查询明细ic_user_change_detailed变更明细表,各个网格的各个分类的总人数
|
||||
|
Map<String, List<OrgIcUserTotalDTO>> totalMapList = userService.calGridIcUserTotal(customerId, dateId); |
||||
|
|
||||
|
String monthId = dateId.substring(NumConstant.ZERO, NumConstant.SIX); |
||||
|
String startDate = monthId.concat("01"); |
||||
|
String endDate = dateId; |
||||
|
|
||||
|
//2、迁入+30:eg:dateId:20211226, [20211201,20211226],类别sum值=1的
|
||||
|
Map<String, List<OrgIcUserTotalDTO>> qrList = userService.calGridIcUserIncr(customerId, startDate, endDate, "qr"); |
||||
|
|
||||
|
//3、迁出 -10 :eg:dateId:20211226, [20211201,20211226],类别sum值 !=1的
|
||||
|
Map<String, List<OrgIcUserTotalDTO>> qcList = userService.calGridIcUserIncr(customerId, startDate, endDate, "qc"); |
||||
|
|
||||
|
for (IcResiCategoryConfigDTO config : columnList) { |
||||
|
gridDTOList.forEach(grid -> { |
||||
|
FactIcuserCategoryAnalysisDailyEntity gridData = new FactIcuserCategoryAnalysisDailyEntity(); |
||||
|
gridData.setCustomerId(customerId); |
||||
|
gridData.setConfigId(config.getConfigId()); |
||||
|
gridData.setColumnName(config.getColumnName()); |
||||
|
gridData.setDateId(dateId); |
||||
|
gridData.setOrgId(grid.getGridId()); |
||||
|
gridData.setOrgType(OrgTypeEnum.GRID.getCode()); |
||||
|
gridData.setPid(StringUtils.isNotBlank(grid.getParentAgencyId()) ? grid.getParentAgencyId() : NumConstant.ZERO_STR); |
||||
|
gridData.setPids(grid.getAllParentIds()); |
||||
|
|
||||
|
//截止到目前累计值
|
||||
|
boolean totalZeroFlag = true; |
||||
|
if (MapUtils.isNotEmpty(totalMapList) && totalMapList.containsKey(grid.getGridId())) { |
||||
|
//当前网格下,有的类别
|
||||
|
List<OrgIcUserTotalDTO> crrentGrid = totalMapList.get(grid.getGridId()); |
||||
|
if (CollectionUtils.isNotEmpty(crrentGrid)) { |
||||
|
//各个类别对应的数
|
||||
|
Map<String, Integer> categoryTotalMap = crrentGrid.stream().collect(Collectors.toMap(OrgIcUserTotalDTO::getColumnName, OrgIcUserTotalDTO::getTotal, (key1, key2) -> key2)); |
||||
|
if (MapUtils.isNotEmpty(categoryTotalMap) && categoryTotalMap.containsKey(config.getColumnName())) { |
||||
|
totalZeroFlag = false; |
||||
|
gridData.setTotal(categoryTotalMap.get(config.getColumnName())); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
if (totalZeroFlag) { |
||||
|
gridData.setTotal(NumConstant.ZERO); |
||||
|
} |
||||
|
|
||||
|
//较上月迁入
|
||||
|
boolean incrZeroFlag = true; |
||||
|
if (MapUtils.isNotEmpty(qrList) && qrList.containsKey(grid.getGridId())) { |
||||
|
//当前网格下,有的类别
|
||||
|
List<OrgIcUserTotalDTO> crrentGrid = qrList.get(grid.getGridId()); |
||||
|
if (CollectionUtils.isNotEmpty(crrentGrid)) { |
||||
|
//各个类别对应的数
|
||||
|
Map<String, Integer> categoryTotalMap = crrentGrid.stream().collect(Collectors.toMap(OrgIcUserTotalDTO::getColumnName, OrgIcUserTotalDTO::getTotal, (key1, key2) -> key2)); |
||||
|
if (MapUtils.isNotEmpty(categoryTotalMap) && categoryTotalMap.containsKey(config.getColumnName())) { |
||||
|
incrZeroFlag = false; |
||||
|
gridData.setQrIncr(categoryTotalMap.get(config.getColumnName())); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
if (incrZeroFlag) { |
||||
|
gridData.setQrIncr(NumConstant.ZERO); |
||||
|
} |
||||
|
|
||||
|
// 较上月迁出:
|
||||
|
boolean qcZeroFlag = true; |
||||
|
if (MapUtils.isNotEmpty(qcList) && qcList.containsKey(grid.getGridId())) { |
||||
|
//当前网格下,有的类别
|
||||
|
List<OrgIcUserTotalDTO> crrentGridQc = qcList.get(grid.getGridId()); |
||||
|
if (CollectionUtils.isNotEmpty(crrentGridQc)) { |
||||
|
//各个类别对应的数
|
||||
|
Map<String, Integer> categoryTotalMap = crrentGridQc.stream().collect(Collectors.toMap(OrgIcUserTotalDTO::getColumnName, OrgIcUserTotalDTO::getTotal, (key1, key2) -> key2)); |
||||
|
if (MapUtils.isNotEmpty(categoryTotalMap) && categoryTotalMap.containsKey(config.getColumnName())) { |
||||
|
qcZeroFlag = false; |
||||
|
gridData.setQcIncr(categoryTotalMap.get(config.getColumnName())); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
if (qcZeroFlag) { |
||||
|
gridData.setQcIncr(NumConstant.ZERO); |
||||
|
} |
||||
|
|
||||
|
list.add(gridData); |
||||
|
}); |
||||
|
} |
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
|
||||
|
<mapper namespace="com.epmet.dao.customize.IcResiCategoryStatsConfigDao"> |
||||
|
|
||||
|
<select id="queryDataColumn" parameterType="java.lang.String" resultType="com.epmet.dto.customize.IcResiCategoryConfigDTO"> |
||||
|
SELECT |
||||
|
m.COLUMN_NAME as columnName, |
||||
|
c.id as configId, |
||||
|
m.LABEL as itemLabel |
||||
|
FROM |
||||
|
ic_form_item m |
||||
|
INNER JOIN ic_resi_category_stats_config c ON ( m.CUSTOMER_ID = c.CUSTOMER_ID AND m.COLUMN_NAME = c.COLUMN_NAME AND c.DEL_FLAG = '0' ) |
||||
|
WHERE |
||||
|
m.DEL_FLAG = '0' |
||||
|
AND m.DATA_ANALYSE = '1' |
||||
|
AND m.CUSTOMER_ID = #{customerId} |
||||
|
ORDER BY |
||||
|
m.SORT ASC |
||||
|
</select> |
||||
|
|
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,13 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
|
||||
|
<mapper namespace="com.epmet.dao.stats.FactIcuserCategoryAnalysisDailyDao"> |
||||
|
|
||||
|
<delete id="limitDelete" parameterType="map"> |
||||
|
delete from fact_icuser_category_analysis_daily |
||||
|
where CUSTOMER_ID = #{customerId} |
||||
|
and date_id=#{dateId} |
||||
|
and org_type=#{orgType} |
||||
|
limit 1000 |
||||
|
</delete> |
||||
|
</mapper> |
Loading…
Reference in new issue