22 changed files with 712 additions and 0 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,71 @@ | |||||
|  | 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; | ||||
|  | 
 | ||||
|  |     /** | ||||
|  |      * 当前数据是截止到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,153 @@ | |||||
|  | 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.CustomerGridDTO; | ||||
|  | import com.epmet.dto.customize.IcResiCategoryConfigDTO; | ||||
|  | import com.epmet.dto.user.result.OrgIcUserTotalDTO; | ||||
|  | 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 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<CustomerAgencyDTO> agencyDTOList=agencyService.getByCustomerId(customerId);
 | ||||
|  |         List<CustomerGridDTO> gridDTOList=gridService.getByCustomerId(customerId); | ||||
|  |         //网格维度、组织维度初始好数据
 | ||||
|  |         List<FactIcuserCategoryAnalysisDailyEntity> initList=constructInitValue(customerId,dateId,gridDTOList,columnList); | ||||
|  |         if(CollectionUtils.isEmpty(initList)){ | ||||
|  |             return; | ||||
|  |         } | ||||
|  |         // 批量插入数据
 | ||||
|  | 
 | ||||
|  | 
 | ||||
|  |         //删除旧数据
 | ||||
|  |         clearOldDatas(customerId,dateId,OrgTypeEnum.GRID.getCode()); | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     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<CustomerGridDTO> gridDTOList,List<IcResiCategoryConfigDTO> columnList) { | ||||
|  |         List<FactIcuserCategoryAnalysisDailyEntity> list=new ArrayList<>(); | ||||
|  |         if(CollectionUtils.isEmpty(gridDTOList)){ | ||||
|  |             //没有配置的类别,退出吧
 | ||||
|  |             return list; | ||||
|  |         } | ||||
|  | 
 | ||||
|  |         //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.calGridIcUserQr(customerId,dateId); | ||||
|  | 
 | ||||
|  |         //3、迁出 -10 :eg:dateId:20211226,  [20211201,20211226],类别sum值 !=1的
 | ||||
|  |         Map<String, List<OrgIcUserTotalDTO>> qrList=userService.calGridIcUserQr(customerId,dateId); | ||||
|  | 
 | ||||
|  |         for(IcResiCategoryConfigDTO config:columnList){ | ||||
|  |             gridDTOList.forEach(grid->{ | ||||
|  |                 FactIcuserCategoryAnalysisDailyEntity gridData=new FactIcuserCategoryAnalysisDailyEntity(); | ||||
|  |                 gridData.setCustomerId(customerId); | ||||
|  |                 gridData.setConfigId(config.getConfigId()); | ||||
|  |                 gridData.setDateId(dateId); | ||||
|  |                 gridData.setOrgId(grid.getId()); | ||||
|  |                 gridData.setOrgType(OrgTypeEnum.GRID.getCode()); | ||||
|  |                 gridData.setPid(StringUtils.isNotBlank(grid.getPid())?grid.getPid(): NumConstant.ZERO_STR); | ||||
|  |                 gridData.setPids(grid.getPids()); | ||||
|  | 
 | ||||
|  |                 boolean zeroFlag=true; | ||||
|  |                 if(MapUtils.isNotEmpty(totalMapList)&&totalMapList.containsKey(grid.getId())){ | ||||
|  |                     //当前网格下,有的类别
 | ||||
|  |                     List<OrgIcUserTotalDTO> crrentGrid=totalMapList.get(grid.getId()); | ||||
|  |                     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())){ | ||||
|  |                             zeroFlag=false; | ||||
|  |                             gridData.setTotal(categoryTotalMap.get(config.getColumnName())); | ||||
|  |                         } | ||||
|  |                     } | ||||
|  |                 } | ||||
|  |                 if(zeroFlag){ | ||||
|  |                     gridData.setTotal(NumConstant.ZERO); | ||||
|  |                 } | ||||
|  |                 gridData.setQcIncr(NumConstant.ZERO); | ||||
|  |                 gridData.setQrIncr(NumConstant.ZERO); | ||||
|  |                 list.add(gridData); | ||||
|  |             }); | ||||
|  |         } | ||||
|  |         return list; | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     public static void main(String[] args) { | ||||
|  |         String dateId="20211225"; | ||||
|  |         System.out.println(dateId.substring(0,6)); | ||||
|  |     } | ||||
|  | } | ||||
| @ -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