| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.finance.common.basic.PageDTO; |
| | | import com.finance.common.core.domain.R; |
| | | import com.finance.common.enums.ReportingStatusEnum; |
| | | import com.finance.common.utils.SecurityUtils; |
| | | import com.finance.system.domain.TbBasicData; |
| | | import com.finance.system.query.HistoryDataQuery; |
| | |
| | | String areaCode = SecurityUtils.getLoginUser().getUser().getAreaCode(); |
| | | Page<TbBasicData> page = tbBasicDataService.lambdaQuery() |
| | | .eq(TbBasicData::getDeptAreaCode, areaCode) |
| | | .eq(TbBasicData::getStatus, ReportingStatusEnum.FILLED) |
| | | // .eq(TbBasicData::getStatus, ReportingStatusEnum.FILLED) |
| | | .between(Objects.nonNull(dto.getStartTime()) && Objects.nonNull(dto.getEndTime()), |
| | | TbBasicData::getReportingTime, dto.getStartTime(), dto.getEndTime()) |
| | | .page(new Page<>(dto.getPageNum(), dto.getPageSize())); |
| | |
| | | public R<PageDTO<CurrentFieldsVO>> fieldsStatics( |
| | | @Validated @RequestBody CurrentFieldsQuery dto) { |
| | | try { |
| | | dto.setQuarter(DateUtils.getNowQuarter()); |
| | | String previousQuarter = DateUtils.getPreviousQuarter(); |
| | | previousQuarter = "2024年一季度"; |
| | | dto.setQuarter(previousQuarter); |
| | | return tbBasicDataService.fieldsStatics(dto); |
| | | } catch (Exception e) { |
| | | log.error("获取字段统计相关信息异常", e); |
| | |
| | | public R<PageDTO<ScoreCalculateVO>> scoreCalculate( |
| | | @Validated @RequestBody ScoreCalculateQuery query) { |
| | | try { |
| | | query.setQuarter(DateUtils.getNowQuarter()); |
| | | String previousQuarter = DateUtils.getPreviousQuarter(); |
| | | previousQuarter = "2024年一季度"; |
| | | query.setQuarter(previousQuarter); |
| | | return R.ok(tbBasicDataService.scoreCalculatePage(query)); |
| | | } catch (Exception e) { |
| | | log.error("获取得分计算异常", e); |
| | |
| | | @ApiImplicitParam(name = "areaName", value = "部门名称", required = false, dataType = "string", paramType = "query", dataTypeClass = String.class) |
| | | public R<ScoreCalculateDetailVO> scoreCalculateDetail( |
| | | @Validated @RequestBody ScoreCalculateDetailQuery query) { |
| | | try { |
| | | return R.ok(tbScoreService.scoreCalculateDetail(query)); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation(value = "发现问题-删除问题", notes = "发现问题") |
| | | public R<Void> delete(@RequestParam("id") Long id) { |
| | | tbQuestionService.removeById(id); |
| | | tbQuestionService.delete(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @ApiOperation("得分计算-查看详情") |
| | | public R<ScoreCalculateDetailVO> scoreCalculateDetail( |
| | | @Validated @RequestBody ScoreCalculateDetailQuery query) { |
| | | try { |
| | | return R.ok(tbScoreService.scoreCalculateDetail(query)); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.finance.web.controller.conveter.CountyFlagConverter; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.finance.common.core.domain.entity.SysUser; |
| | | import com.finance.common.enums.AreaLevelEnum; |
| | | import com.finance.common.enums.UserTypeEnum; |
| | | import com.finance.common.exception.ServiceException; |
| | | import com.finance.common.utils.BeanUtils; |
| | | import com.finance.common.utils.CollUtils; |
| | | import com.finance.common.utils.SecurityUtils; |
| | | import com.finance.common.utils.StringUtils; |
| | | import com.finance.system.service.ISysUserService; |
| | | import com.finance.web.controller.excel.DeptExcel; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | |
| | | |
| | | private void saveData() { |
| | | log.info("{}条数据,开始存储数据库!", cachedDataList.size()); |
| | | List<SysUser> sysUsers = BeanUtils.copyList(cachedDataList, SysUser.class); |
| | | sysUsers.forEach(item -> { |
| | | item.setPassword(SecurityUtils.encryptPassword(item.getPassword())); |
| | | item.setNickName(item.getAreaName()); |
| | | item.setUserType(UserTypeEnum.DEPARTMENT); |
| | | }); |
| | | sysUserService.remove(Wrappers.<SysUser>lambdaQuery() |
| | | List<SysUser> sysUsers = cachedDataList.stream().map(data -> { |
| | | SysUser sysUser = new SysUser(); |
| | | sysUser.setAreaName(data.getAreaName()); |
| | | sysUser.setAreaAlias(data.getAreaAlias()); |
| | | sysUser.setAreaCode(data.getAreaCode()); |
| | | sysUser.setAreaLevel(AreaLevelEnum.getEnumByDesc(data.getAreaLevel())); |
| | | sysUser.setCountyFlag(data.getCountyFlag()); |
| | | sysUser.setUserName(data.getUserName()); |
| | | sysUser.setNickName(data.getUserName()); |
| | | sysUser.setPersonInCharge(data.getPersonInCharge()); |
| | | sysUser.setPhoneNumber(data.getPhoneNumber()); |
| | | sysUser.setPassword(SecurityUtils.encryptPassword(data.getPassword())); |
| | | sysUser.setUserType(UserTypeEnum.DEPARTMENT); |
| | | return sysUser; |
| | | }).collect(Collectors.toList()); |
| | | List<String> areaCodeSet = sysUsers.stream().map(SysUser::getAreaCode) |
| | | .collect(Collectors.toList()); |
| | | List<SysUser> userListOrg = sysUserService.list( |
| | | Wrappers.lambdaQuery(SysUser.class).in(SysUser::getAreaCode, areaCodeSet) |
| | | .eq(SysUser::getUserType, UserTypeEnum.DEPARTMENT.getCode())); |
| | | List<String> collect = userListOrg.stream().map(SysUser::getAreaCode) |
| | | .collect(Collectors.toList()); |
| | | List<SysUser> updateUserList = null; |
| | | if (CollUtils.isNotEmpty(collect)) { |
| | | updateUserList = sysUsers.stream() |
| | | .filter(item -> collect.contains(item.getAreaCode())).collect( |
| | | Collectors.toList()); |
| | | List<SysUser> updateUsers = updateUserList.stream() |
| | | .flatMap(updUser -> userListOrg.stream() |
| | | .filter(userOrg -> userOrg.getAreaCode().equals(updUser.getAreaCode())) |
| | | .peek(userOrg -> { |
| | | userOrg.setAreaName(updUser.getAreaName()); |
| | | userOrg.setAreaAlias(updUser.getAreaAlias()); |
| | | userOrg.setUserName(updUser.getUserName()); |
| | | userOrg.setPersonInCharge(updUser.getPersonInCharge()); |
| | | userOrg.setPhoneNumber(updUser.getPhoneNumber()); |
| | | userOrg.setAreaLevel(updUser.getAreaLevel()); |
| | | userOrg.setCountyFlag(updUser.getCountyFlag()); |
| | | userOrg.setPassword(updUser.getPassword()); |
| | | userOrg.setUpdateTime(new Date()); |
| | | })) |
| | | .collect(Collectors.toList()); |
| | | sysUserService.updateBatchById(updateUsers); |
| | | } |
| | | if (CollUtils.isNotEmpty(updateUserList)) { |
| | | sysUsers.removeAll(updateUserList); |
| | | } |
| | | sysUserService.saveBatch(sysUsers); |
| | | log.info("{}条数据,导入成功!", cachedDataList.size()); |
| | | } |
| | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | |
| | | } |
| | | |
| | | public RiskAndTransferVO getRiskAndTransfer() throws Exception { |
| | | String nowQuarter = DateUtils.getNowQuarter(); |
| | | String previousQuarter = DateUtils.getPreviousQuarter(); |
| | | previousQuarter = "2024年一季度"; |
| | | RiskAndTransferVO riskAndTransferVO = new RiskAndTransferVO(); |
| | | // 查询转移支付规模总额 |
| | | List<TbBasicData> list = tbBasicDataService.lambdaQuery() |
| | | .select(TbBasicData::getTransferPaymentScale) |
| | | .eq(TbBasicData::getQuarter, nowQuarter) |
| | | .eq(TbBasicData::getQuarter, previousQuarter) |
| | | // .eq(TbBasicData::getStatus, ReportingStatusEnum.FILLED) |
| | | .list(); |
| | | Optional<Double> reduce = list.stream() |
| | |
| | | List<RiskLevelVO> riskLevelVOList = formatRiskLevel(riskLevel); |
| | | riskAndTransferVO.setRiskLevelVOList(riskLevelVOList); |
| | | RiskCountVO riskCountVO = new RiskCountVO(); |
| | | List<RiskMapVO> riskMapVOList = tbScoreService.getCurrentScoreList(nowQuarter, null); |
| | | List<RiskMapVO> riskMapVOList = tbScoreService.getCurrentScoreList(previousQuarter, null); |
| | | String[] noRiskArr = riskLevel.getNoRisk().split("-"); |
| | | String[] lowRiskArr = riskLevel.getLowRisk().split("-"); |
| | | String[] mediumRiskArr = riskLevel.getMediumRisk().split("-"); |
| | | String[] highRiskArr = riskLevel.getHighRisk().split("-"); |
| | | List<RiskMapVO> cityRiskVO = riskMapVOList.stream() |
| | | .filter(r -> r.getAreaLevel().equals(AreaLevelEnum.CITY)) |
| | | .collect(Collectors.toList()); |
| | | long noRiskCount = cityRiskVO.stream() |
| | | .filter(item -> item.getScore() >= Double.parseDouble(noRiskArr[0]) |
| | | && item.getScore() <= Double.parseDouble(noRiskArr[1])).count(); |
| | | riskCountVO.setNoRiskCount((int) noRiskCount); |
| | | long lowRiskCount = cityRiskVO.stream() |
| | | .filter(item -> item.getScore() >= Double.parseDouble(lowRiskArr[0]) |
| | | && item.getScore() <= Double.parseDouble(lowRiskArr[1])).count(); |
| | | riskCountVO.setLowRiskCount((int) lowRiskCount); |
| | | long mediumRiskCount = cityRiskVO.stream() |
| | | .filter(item -> item.getScore() >= Double.parseDouble(mediumRiskArr[0]) |
| | | && item.getScore() <= Double.parseDouble(mediumRiskArr[1])).count(); |
| | | riskCountVO.setHighRiskCount((int) mediumRiskCount); |
| | | long highRiskCount = cityRiskVO.stream() |
| | | .filter(item -> item.getScore() >= Double.parseDouble(highRiskArr[0]) |
| | | && item.getScore() <= Double.parseDouble(highRiskArr[1])).count(); |
| | | riskCountVO.setHighRiskCount((int) highRiskCount); |
| | | |
| | | for (RiskLevelVO vo : riskLevelVOList) { |
| | | /*for (RiskLevelVO vo : riskLevelVOList) { |
| | | long count = riskMapVOList.stream() |
| | | .filter(r -> r.getAreaLevel().equals(AreaLevelEnum.CITY)) |
| | | .filter(item -> item.getScore() >= vo.getMin() |
| | |
| | | } else if (vo.getRiskLevel().equals(RiskLevelEnum.L4)) { |
| | | riskCountVO.setHighRiskCount((int) count); |
| | | } |
| | | } |
| | | }*/ |
| | | // TODO |
| | | // riskCountVO.setNoRiskCount(50); |
| | | // riskCountVO.setLowRiskCount(45); |
| | |
| | | public List<RiskRankingVO> riskRanking() throws Exception { |
| | | DataScreenConfigVO riskLevel = tbDataScreenConfigService.getRiskLevel(); |
| | | List<RiskLevelVO> riskLevelVOList = formatRiskLevel(riskLevel); |
| | | List<RiskRankingVO> voList = tbScoreService.queryRiskRanking(DateUtils.getNowQuarter()); |
| | | // List<RiskRankingVO> voList = tbScoreService.queryRiskRanking( |
| | | // DateUtils.getPreviousQuarter()); |
| | | List<RiskRankingVO> voList = tbScoreService.queryRiskRanking( |
| | | "2024年一季度"); |
| | | int rank = 1; |
| | | for (RiskRankingVO riskRankingVO : voList) { |
| | | riskRankingVO.setRank(rank++); |
| | |
| | | } |
| | | |
| | | public List<QuestionVO> queryQuestions() throws Exception { |
| | | String previousQuarter = DateUtils.getPreviousQuarter(); |
| | | previousQuarter = "2024年一季度"; |
| | | List<TbQuestion> list = tbQuestionService.lambdaQuery() |
| | | .eq(TbQuestion::getQuarter, DateUtils.getNowQuarter()).list(); |
| | | .eq(TbQuestion::getQuarter, previousQuarter).list(); |
| | | return BeanUtils.copyList(list, QuestionVO.class); |
| | | } |
| | | |
| | |
| | | } |
| | | dataAnalysisVO.setRank(scoreRankVO.getRank()); |
| | | dataAnalysisVO.setScore(scoreRankVO.getScore()); |
| | | String nowQuarter = DateUtils.getNowQuarter(); |
| | | String previousQuarter = DateUtils.getPreviousQuarter(); |
| | | previousQuarter = "2024年一季度"; |
| | | // 查询问题 |
| | | List<TbQuestion> list = tbQuestionService.lambdaQuery() |
| | | .eq(TbQuestion::getQuarter, nowQuarter).eq(TbQuestion::getDeptAreaCode, areaCode) |
| | | .eq(TbQuestion::getQuarter, previousQuarter) |
| | | .eq(TbQuestion::getDeptAreaCode, areaCode) |
| | | .list(); |
| | | List<QuestionVO> questionVOS = BeanUtils.copyList(list, QuestionVO.class); |
| | | dataAnalysisVO.setQuestions(questionVOS); |
| | |
| | | DataScreenConfigVO riskLevel = tbDataScreenConfigService.getRiskLevel(); |
| | | List<RiskLevelVO> riskLevelVOList = formatRiskLevel(riskLevel); |
| | | |
| | | dataAnalysisVO.setYearScore(getYearScore(areaCode, 1)); |
| | | |
| | | dataAnalysisVO.setLastYearScore(getYearScore(areaCode, 2)); |
| | | dataAnalysisVO.setYearScore(getYearScore(areaCode, previousQuarter)); |
| | | String lastYearQuarter = DateUtils.getLastYearQuarter(previousQuarter); |
| | | dataAnalysisVO.setLastYearScore(getYearScore(areaCode, lastYearQuarter)); |
| | | // 查询风险等级 |
| | | List<RiskMapVO> currentScoreList = tbScoreService.getCurrentScoreList(nowQuarter, areaCode); |
| | | List<RiskMapVO> currentScoreList = tbScoreService.getCurrentScoreList(previousQuarter, |
| | | areaCode); |
| | | for (RiskMapVO tbDataScreenScore : currentScoreList) { |
| | | for (RiskLevelVO vo : riskLevelVOList) { |
| | | if (vo.getRiskLevel().equals(RiskLevelEnum.L1) |
| | |
| | | } |
| | | // 查询四个指标下的三级指标 |
| | | List<FieldAndScoreDataVO> voList = |
| | | tbBasicDataService.getFieldAndScoreData(areaCode, nowQuarter, 1); |
| | | tbBasicDataService.getFieldAndScoreData(areaCode, previousQuarter, 1, 2); |
| | | List<FieldAndScoreDataVO> lastYearList = |
| | | tbBasicDataService.getFieldAndScoreData(areaCode, nowQuarter, 2); |
| | | tbBasicDataService.getFieldAndScoreData(areaCode, previousQuarter, 2, 2); |
| | | // 查询四个指标下的三级指标 |
| | | List<FieldAndScoreDataVO> allDeptVoList = |
| | | tbBasicDataService.getFieldAndScoreData(null, nowQuarter, 1); |
| | | tbBasicDataService.getFieldAndScoreData(areaCode, previousQuarter, 1, 1); |
| | | // 查询形式指标得分 |
| | | dataAnalysisVO.setScoreDataList(handleDataIndicators(voList, lastYearList)); |
| | | // 查询数据指标得分 |
| | |
| | | "预算执行方面", "风险防控方面"); |
| | | for (int i = 0; i < indicatorList.size(); i++) { |
| | | ScoreRateDataVO scoreRateDataVO = new ScoreRateDataVO(); |
| | | if (CollUtils.isEmpty(voList)) { |
| | | scoreRateDataVO.setRank(0); |
| | | scoreRateDataVO.setScore(0D); |
| | | scoreRateDataVO.setSubType(SubTypeEnum.getEnumByCode(i + 1)); |
| | | scoreRateDataVO.setScoreRate(0D); |
| | | } else { |
| | | Double indicatorOne = getLevelThreeIndicators(voList, indicatorList.get(i)).stream() |
| | | .map(FieldAndScoreDataVO::getScore).reduce(Double::sum).orElse(0D); |
| | | |
| | | .map(FieldAndScoreDataVO::getScore).reduce(Double::sum) |
| | | .map(BigDecimal::valueOf) |
| | | .orElse(BigDecimal.ZERO).setScale(2, RoundingMode.HALF_UP) |
| | | .doubleValue(); |
| | | List<Double> allIndicatorsScore = getAllIndicatorsScoreByName(allDeptVoList, |
| | | indicatorList.get(i)); |
| | | scoreRateDataVO.setRank(findPositionInList(allIndicatorsScore, indicatorOne)); |
| | | allIndicatorsScore.add(indicatorOne); |
| | | allIndicatorsScore.sort(Comparator.comparing(Double::doubleValue).reversed()); |
| | | scoreRateDataVO.setRank(allIndicatorsScore.indexOf(indicatorOne) + 1); |
| | | scoreRateDataVO.setScore(indicatorOne); |
| | | scoreRateDataVO.setSubType(SubTypeEnum.getEnumByCode(i + 1)); |
| | | scoreRateDataVO.setScoreRate(BigDecimal.valueOf(indicatorOne) |
| | | .divide(BigDecimal.valueOf(voList.get(i).getLevelOneIndicatorMaxScore()), 2, |
| | | RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100L)).doubleValue()); |
| | | RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100L)) |
| | | .doubleValue()); |
| | | } |
| | | result.add(scoreRateDataVO); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public static int findPositionInList(List<Double> list, Double value) { |
| | | // Sorting the list to use binary search |
| | | Collections.sort(list); |
| | | |
| | | // Finding the index using binary search |
| | | int index = Collections.binarySearch(list, value); |
| | | |
| | | if (index < 0) { |
| | | // If the value is not found, binarySearch returns (-(insertion point) - 1) |
| | | // Convert to the insertion point by doing (-index - 1) |
| | | index = -index - 1; |
| | | } |
| | | |
| | | return index + 1; |
| | | } |
| | | |
| | | |
| | | private List<Double> getAllIndicatorsScoreByName(List<FieldAndScoreDataVO> allDeptVoList, |
| | | String indicatorName) { |
| | |
| | | Double score = getLevelThreeIndicators(collect.get(key), indicatorName).stream() |
| | | .map(FieldAndScoreDataVO::getScore).reduce(Double::sum).orElse(0D); |
| | | return score; |
| | | }).collect(Collectors.toList()); |
| | | }).sorted(Comparator.comparing(Double::intValue).reversed()).collect(Collectors.toList()); |
| | | } |
| | | |
| | | private List<ScoreDataVO> handleDataIndicators(List<FieldAndScoreDataVO> voList, |
| | |
| | | List<String> indicatorList = Lists.newArrayList("财政经济形势", "预算管理方面", |
| | | "预算执行方面", "风险防控方面"); |
| | | for (int i = 0; i < indicatorList.size(); i++) { |
| | | Double indicatorOne = getLevelThreeIndicators(voList, indicatorList.get(i)).stream() |
| | | .map(FieldAndScoreDataVO::getScore).reduce(Double::sum).orElse(0D); |
| | | ScoreDataVO scoreDataVO = new ScoreDataVO(); |
| | | if (CollUtils.isEmpty(voList)) { |
| | | scoreDataVO.setLastScore(0D); |
| | | scoreDataVO.setScore(0D); |
| | | scoreDataVO.setMaxScore(0D); |
| | | scoreDataVO.setSubType(SubTypeEnum.getEnumByCode(i + 1)); |
| | | } else { |
| | | Double indicatorOne = getLevelThreeIndicators(voList, |
| | | indicatorList.get(i)).stream() |
| | | .map(FieldAndScoreDataVO::getScore).reduce(Double::sum) |
| | | .map(BigDecimal::valueOf) |
| | | .orElse(BigDecimal.ZERO).setScale(2, RoundingMode.HALF_UP) |
| | | .doubleValue(); |
| | | Double indicatorOneLastYear = getLevelThreeIndicators(lastYearList, |
| | | indicatorList.get(i)).stream() |
| | | .map(FieldAndScoreDataVO::getScore).reduce(Double::sum).orElse(0D); |
| | | ScoreDataVO scoreDataVO = new ScoreDataVO(); |
| | | .map(FieldAndScoreDataVO::getScore).reduce(Double::sum) |
| | | .map(BigDecimal::valueOf) |
| | | .orElse(BigDecimal.ZERO).setScale(2, RoundingMode.HALF_UP).doubleValue(); |
| | | scoreDataVO.setLastScore(indicatorOneLastYear); |
| | | scoreDataVO.setScore(indicatorOne); |
| | | scoreDataVO.setMaxScore(voList.get(0).getLevelOneIndicatorMaxScore()); |
| | | scoreDataVO.setSubType(SubTypeEnum.getEnumByCode(i + 1)); |
| | | } |
| | | scoreDataVOList.add(scoreDataVO); |
| | | } |
| | | return scoreDataVOList; |
| | |
| | | }).filter(Objects::nonNull).collect(Collectors.toList()); |
| | | } |
| | | |
| | | private Double getYearScore(String areaCode, Integer yearType) { |
| | | List<RiskMapVO> thisYearScoreList = tbScoreService.getScoreByYearType(areaCode, yearType); |
| | | private Double getYearScore(String areaCode, String previousQuarter) { |
| | | List<RiskMapVO> thisYearScoreList = tbScoreService.getScoreByYearType(areaCode, |
| | | previousQuarter); |
| | | return thisYearScoreList.stream().map(RiskMapVO::getScore) |
| | | .reduce(Double::sum).orElse(0D); |
| | | .reduce(Double::sum).map(BigDecimal::valueOf).orElse(BigDecimal.ZERO) |
| | | .setScale(2, RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | |
| | | private void handleDataIndicators(String areaCode, List<ScoreDataVO> scoreDataVOList) { |
| | |
| | | |
| | | public List<DeptCalculateDetailVO> deptCalculateDetail(DeptCalculateDetailQuery query) |
| | | throws Exception { |
| | | return tbScoreService.deptCalculateDetail(query, DateUtils.getNowQuarter()); |
| | | String previousQuarter = DateUtils.getPreviousQuarter(); |
| | | previousQuarter = "2024年一季度"; |
| | | return tbScoreService.deptCalculateDetail(query, previousQuarter); |
| | | } |
| | | |
| | | public CurrentFieldsDetailVO viewRawData(String areaCode) throws Exception { |
| | | String previousQuarter = DateUtils.getPreviousQuarter(); |
| | | previousQuarter = "2024年一季度"; |
| | | Optional<TbBasicData> basicDataOptional = tbBasicDataService.lambdaQuery() |
| | | .eq(TbBasicData::getDeptAreaCode, areaCode) |
| | | .eq(TbBasicData::getStatus, ReportingStatusEnum.FILLED) |
| | | .eq(TbBasicData::getQuarter, DateUtils.getNowQuarter()).oneOpt(); |
| | | .eq(TbBasicData::getQuarter, previousQuarter).oneOpt(); |
| | | if (basicDataOptional.isPresent()) { |
| | | return tbBasicDataService.fieldsDetails(basicDataOptional.get().getId()).getData(); |
| | | } else { |
| | |
| | | |
| | | public ScoreCalculateDetailVO fieldsDetail(CalculateDetailQuery query) { |
| | | List<SysUser> countyList = getCountyList(query.getCityAreaCode()); |
| | | try { |
| | | return tbScoreService.fieldsDetail(query, countyList); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | public List<SysUser> getCountyList(String areaCode) { |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static AreaLevelEnum getEnumByDesc(String desc) { |
| | | for (AreaLevelEnum e : AreaLevelEnum.values()) { |
| | | if (e.desc.equals(desc)) { |
| | | return e; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | public enum QuestionTypeEnum { |
| | | ENUM0(1, "减税降费政策未落实情况"), |
| | | ENUM1(2, "其他重大财税政策"), |
| | | ENUM2(3, "“三保”支出保障情况"), |
| | | ENUM2(3, "三保支出保障情况"), |
| | | ENUM3(4, "盘活存量资金"), |
| | | ENUM4(5, "无预算、超预算拨款"), |
| | | ENUM5(6, "直达资金规范使用"), |
| | |
| | | public static String getNowQuarter() throws Exception { |
| | | // 当前所在季度 |
| | | Date date = new Date(); |
| | | char quarterOfYear = String.valueOf(getQuarterOfYear(date)).toCharArray()[0]; |
| | | String quarterOfYearStr = NumberChineseFormatter.numberCharToChinese(quarterOfYear, false); |
| | | // char quarterOfYear = String.valueOf(getQuarterOfYear(date)).toCharArray()[0]; |
| | | int quarterOfYear = DateUtil.quarter(date); |
| | | String quarterOfYearStr = NumberChineseFormatter.numberCharToChinese((char) quarterOfYear, |
| | | false); |
| | | LocalDate now = LocalDate.now(); |
| | | return String.format("%s年%s季度", now.getYear(), quarterOfYearStr); |
| | | } |
| | | |
| | | /** |
| | | * 获取上一季度字符串 |
| | | * |
| | | * @return 当前季度字符串 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public static String getPreviousQuarter() throws Exception { |
| | | // 当前日期 |
| | | LocalDate now = LocalDate.now(); |
| | | // 当前月份 |
| | | int currentMonth = now.getMonthValue(); |
| | | // 计算上季度的月份 |
| | | int previousQuarterMonth = currentMonth - 3; |
| | | int previousQuarterYear = now.getYear(); |
| | | |
| | | if (previousQuarterMonth <= 0) { |
| | | previousQuarterMonth += 12; |
| | | previousQuarterYear -= 1; |
| | | } |
| | | |
| | | // 计算上季度的季度数 |
| | | int previousQuarter = (previousQuarterMonth - 1) / 3 + 1; |
| | | // 将季度数转换为汉字 |
| | | String quarterOfYearStr = NumberChineseFormatter.numberCharToChinese( |
| | | (char) (previousQuarter + '0'), false); |
| | | |
| | | // 返回上季度的年份和季度 |
| | | return String.format("%s年%s季度", previousQuarterYear, quarterOfYearStr); |
| | | } |
| | | |
| | | public static Date getQuarterDate(String quarter) { |
| | |
| | | System.out.println(simpleDateFormat.format(getQuarterDate("2024年二季度"))); |
| | | System.out.println(simpleDateFormat.format(getQuarterDate("2024年三季度"))); |
| | | System.out.println(simpleDateFormat.format(getQuarterDate("2024年四季度"))); |
| | | System.out.println( |
| | | DateUtil.format(getQuarterDateEnd(getPreviousQuarter()), "yyyy-MM-dd HH:mm:ss")); |
| | | System.out.println( |
| | | DateUtil.format(getQuarterDate(getPreviousQuarter()), "yyyy-MM-dd HH:mm:ss")); |
| | | System.out.println(getLastYearQuarter("2024年一季度")); |
| | | } |
| | | |
| | | public static String getLastYearQuarter(String previousQuarter) { |
| | | // 提取年份和季度信息 |
| | | String year = previousQuarter.substring(0, 4); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); |
| | | try { |
| | | // 今年 |
| | | Date date = sdf.parse(year); |
| | | // 根据date获取去年的日期 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(date); |
| | | calendar.add(Calendar.YEAR, -1); |
| | | Date lastYear = calendar.getTime(); |
| | | return String.format("%s年%s", sdf.format(lastYear), previousQuarter.substring(5)); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | |
| | | @ApiModelProperty(value = "上报时间") |
| | | @TableField(value = "reporting_time") |
| | | private Date reportingTime; |
| | | |
| | | @ApiModelProperty(value = "完成填报时间") |
| | | @TableField(value = "finished_time") |
| | | private Date finishedTime; |
| | | |
| | | } |
| | |
| | | private String content; |
| | | |
| | | @ApiModelProperty(value = "问题类型", notes = "问题类型 1:减税降费政策未落实情况 2:其他重大财税政策 " |
| | | + "3:“三保”支出保障情况4:盘活存量资金5:无预算、超预算拨款6:直达资金规范使用7:隐形债务化解" |
| | | + "3:三保支出保障情况4:盘活存量资金5:无预算、超预算拨款6:直达资金规范使用7:隐形债务化解" |
| | | + "8:债务日常监管9:日常监管发现问题") |
| | | @NotNull(message = "问题内容不能为空") |
| | | private QuestionTypeEnum type; |
| | |
| | | import com.google.common.collect.Lists; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Map.Entry; |
| | |
| | | .eq(TbBasicData::getDeptAreaCode, areaCode).oneOpt(); |
| | | tbBasicData = tbBasicDataOpt.orElseGet(TbBasicData::new); |
| | | tbBasicData.setQuarter(quarter); |
| | | tbBasicData.setTransferPaymentScale(dataMap.get(2)); |
| | | tbBasicData.setCurrentGdp(dataMap.get(3)); |
| | | tbBasicData.setTransferPaymentScale(dataMap.get(2).replace(",", "")); |
| | | tbBasicData.setCurrentGdp(dataMap.get(3).replace(",", "")); |
| | | tbBasicData.setDeptAreaCode(areaCode); |
| | | tbBasicData.setRemark(dataMap.get(remarkIndex)); |
| | | tbBasicData.setReportingTime(DateUtils.getQuarterDate(quarter)); |
| | | tbBasicData.setStatus(ReportingStatusEnum.MISSING_DATA); |
| | | long count = dataMap.entrySet().stream() |
| | | .filter(entry -> StringUtils.isBlank(entry.getValue())).count(); |
| | | tbBasicData.setStatus( |
| | | count > 0 ? ReportingStatusEnum.MISSING_DATA : ReportingStatusEnum.FILLED); |
| | | if (count > 0) { |
| | | tbBasicData.setStatus(ReportingStatusEnum.FILLED); |
| | | tbBasicData.setFinishedTime(new Date()); |
| | | } |
| | | |
| | | tbBasicDataService.saveOrUpdate(tbBasicData); |
| | | tbBasicDataFieldService.remove(Wrappers.<TbBasicDataField>lambdaQuery() |
| | | .eq(TbBasicDataField::getBasicDataId, tbBasicData.getId())); |
| | |
| | | tbBasicDataField.setBasicDataId(tbBasicData.getId()); |
| | | tbBasicDataField.setFieldId(field.getId()); |
| | | tbBasicDataField.setFieldName(field.getFieldName()); |
| | | tbBasicDataField.setFieldValue(value); |
| | | tbBasicDataField.setFieldValue(value.replace(",", "")); |
| | | fields.add(tbBasicDataField); |
| | | } |
| | | } |
| | |
| | | List<TbBasicData> basicDataList = tbBasicDataService.lambdaQuery(). |
| | | eq(TbBasicData::getQuarter, quarter).list(); |
| | | for (Map<Integer, String> dataMap : dataMapList) { |
| | | // 查询需要填写的动态字段 |
| | | fieldList = |
| | | tbFieldService.lambdaQuery().eq(TbField::getStatus, ShowStatusEnum.SHOW).list(); |
| | | Optional<SysUser> sysUser = departmentList.stream() |
| | | .filter(dept -> dept.getAreaName().equals(dataMap.get(0))).findFirst(); |
| | | if (!sysUser.isPresent()) { |
| | |
| | | .filter(basicData -> basicData.getDeptAreaCode().equals(areaCode)).findFirst(); |
| | | tbBasicData = tbBasicDataOpt.orElseGet(TbBasicData::new); |
| | | tbBasicData.setQuarter(quarter); |
| | | tbBasicData.setTransferPaymentScale(dataMap.get(2)); |
| | | tbBasicData.setCurrentGdp(dataMap.get(3)); |
| | | tbBasicData.setTransferPaymentScale(dataMap.get(2).replace(",", "")); |
| | | tbBasicData.setCurrentGdp(dataMap.get(3).replace(",", "")); |
| | | tbBasicData.setDeptAreaCode(areaCode); |
| | | tbBasicData.setRemark(dataMap.get(remarkIndex)); |
| | | tbBasicData.setStatus(ReportingStatusEnum.MISSING_DATA); |
| | |
| | | tbBasicDataField.setBasicDataId(tbBasicData.getId()); |
| | | tbBasicDataField.setFieldId(field.getId()); |
| | | tbBasicDataField.setFieldName(field.getFieldName()); |
| | | tbBasicDataField.setFieldValue(value); |
| | | tbBasicDataField.setFieldValue( |
| | | Objects.isNull(value) ? "" : value.replace(",", "")); |
| | | fields.add(tbBasicDataField); |
| | | } |
| | | } |
| | |
| | | @Param("nowQuarter") String nowQuarter); |
| | | |
| | | List<FieldAndScoreDataVO> getFieldAndScoreData(@Param("areaCode") String areaCode, |
| | | @Param("nowQuarter") String nowQuarter, @Param("yearType") Integer yearType); |
| | | @Param("nowQuarter") String nowQuarter, @Param("yearType") Integer yearType, |
| | | @Param("isAll") Integer isAll); |
| | | } |
| | |
| | | |
| | | List<ScoreRankVO> queryTotalScoreList(); |
| | | |
| | | ScoreRankVO queryRankAndScoreByAreaCode(@Param("areaCode") String areaCode); |
| | | List<ScoreRankVO> queryRankAndScoreByAreaCode(@Param("areaCode") String areaCode, |
| | | @Param("previousQuarter") String previousQuarter); |
| | | |
| | | List<DeptCalculateDetailVO> deptCalculateDetail(@Param("query") DeptCalculateDetailQuery query, |
| | | @Param("nowQuarter") String nowQuarter); |
| | |
| | | List<RiskRankingVO> queryRiskRanking(@Param("nowQuarter") String nowQuarter); |
| | | |
| | | List<RiskMapVO> getScoreByYearType(@Param("areaCode") String areaCode, |
| | | @Param("yearType") Integer yearType); |
| | | @Param("quarter") String quarter); |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "部门区划代码") |
| | | private String areaCode; |
| | | |
| | | @ApiModelProperty(value = "季度", hidden = true) |
| | | private String previousQuarter; |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "部门名称") |
| | | private String areaName; |
| | | |
| | | @ApiModelProperty(value = "季度", hidden = true) |
| | | private String previousQuarter; |
| | | } |
| | |
| | | |
| | | void importBasicData(MultipartFile file) throws Exception; |
| | | |
| | | PageDTO<ScoreVO> pageScore(ScoreQuery query); |
| | | PageDTO<ScoreVO> pageScore(ScoreQuery query) throws Exception; |
| | | |
| | | R<CurrentFieldsDetailVO> fieldsDetails(Long id); |
| | | |
| | |
| | | |
| | | void exportDataV2(List<String> quarterList) throws IOException; |
| | | |
| | | /** |
| | | * @param areaCode |
| | | * @param nowQuarter |
| | | * @param yearType 1:今年 2:去年 |
| | | * @param isAll 是否相同市下所有区数据 1:是 2 :否 |
| | | * @return |
| | | */ |
| | | List<FieldAndScoreDataVO> getFieldAndScoreData(String areaCode, String nowQuarter, |
| | | Integer yearType); |
| | | Integer yearType, Integer isAll); |
| | | } |
| | |
| | | void editQuestion(QuestionUpdDTO dto); |
| | | |
| | | PageDTO<QuestionVO> pageQuestion(QuestionQuery dto); |
| | | |
| | | void delete(Long id); |
| | | } |
| | |
| | | |
| | | PageDTO<ScoreVO> getHistoryScore(HistoryScoreQuery query); |
| | | |
| | | ScoreCalculateDetailVO scoreCalculateDetail(ScoreCalculateDetailQuery query); |
| | | ScoreCalculateDetailVO scoreCalculateDetail(ScoreCalculateDetailQuery query) throws Exception; |
| | | |
| | | List<ScoreRankVO> queryTotalScoreList(); |
| | | |
| | | ScoreRankVO queryRankAndScoreByAreaCode(String areaCode); |
| | | ScoreRankVO queryRankAndScoreByAreaCode(String areaCode) throws Exception; |
| | | |
| | | List<DeptCalculateDetailVO> deptCalculateDetail(DeptCalculateDetailQuery query, |
| | | String nowQuarter); |
| | | |
| | | ScoreCalculateDetailVO fieldsDetail(CalculateDetailQuery query, List<SysUser> countyList); |
| | | ScoreCalculateDetailVO fieldsDetail(CalculateDetailQuery query, List<SysUser> countyList) |
| | | throws Exception; |
| | | |
| | | List<RiskMapVO> getCurrentScoreList(String nowQuarter, String areaCode); |
| | | |
| | | List<RiskRankingVO> queryRiskRanking(String nowQuarter); |
| | | |
| | | List<RiskMapVO> getScoreByYearType(String areaCode, Integer yearType); |
| | | List<RiskMapVO> getScoreByYearType(String areaCode, String quarter); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.finance.common.core.domain.entity.SysUser; |
| | | import com.finance.common.enums.BasicDataFieldEnum; |
| | | import com.finance.common.enums.CalculateTypeEnum; |
| | | import com.finance.common.enums.IndicatorItemEnum; |
| | | import com.finance.common.enums.QuestionTypeEnum; |
| | | import com.finance.common.enums.ShowStatusEnum; |
| | | import com.finance.common.enums.UserTypeEnum; |
| | | import com.finance.common.enums.ValueTypeEnum; |
| | | import com.finance.common.exception.ServiceException; |
| | | import com.finance.common.utils.CalculateUtil; |
| | |
| | | import com.finance.system.mapper.TbBasicDataMapper; |
| | | import com.finance.system.mapper.TbQuestionMapper; |
| | | import com.finance.system.service.AsyncService; |
| | | import com.finance.system.service.ISysUserService; |
| | | import com.finance.system.service.TbBasicDataCategoryService; |
| | | import com.finance.system.service.TbBasicDataConfigDetailService; |
| | | import com.finance.system.service.TbBasicDataConfigService; |
| | |
| | | private final TbBasicDataConfigDetailService tbBasicDataConfigDetailService; |
| | | private final TbBasicDataMapper tbBasicDataMapper; |
| | | private final TbQuestionMapper tbQuestionMapper; |
| | | private final ISysUserService sysUserService; |
| | | |
| | | @Async |
| | | @Override |
| | |
| | | @Override |
| | | public void calculateScoreWithFixedRules(TbBasicData tbBasicData, |
| | | List<TbBasicDataField> fields, List<TbField> fieldList) { |
| | | if (tbBasicData.getDeptAreaCode().equals("000000")) { |
| | | return; |
| | | } |
| | | SysUser sysUser = sysUserService.lambdaQuery() |
| | | .eq(SysUser::getAreaCode, tbBasicData.getDeptAreaCode()) |
| | | .eq(SysUser::getUserType, |
| | | UserTypeEnum.DEPARTMENT).oneOpt().get(); |
| | | List<BasicDataConfigVO> fixedRulesConfigList = tbBasicDataConfigService.getFixedRulesConfigList(); |
| | | // 查询四川省的基础数据 |
| | | TbBasicData provinceBasicData = tbBasicDataMapper.selectOne( |
| | | Wrappers.lambdaQuery(TbBasicData.class) |
| | | .eq(TbBasicData::getDeptAreaCode, "510000") |
| | | .eq(TbBasicData::getDeptAreaCode, "000000") |
| | | .eq(TbBasicData::getQuarter, tbBasicData.getQuarter())); |
| | | if (Objects.isNull(provinceBasicData)) { |
| | | throw new ServiceException("四川省未上传该季度基础数据,请联系管理员"); |
| | |
| | | Date quarterDate = DateUtils.getQuarterDateEnd(tbBasicData.getQuarter()); |
| | | BigDecimal month = BigDecimal.valueOf( |
| | | Double.parseDouble(DateUtil.format(quarterDate, "MM"))); |
| | | boolean res1 = false; |
| | | boolean res2 = false; |
| | | switch (Objects.requireNonNull(IndicatorItemEnum.getEnumByCode(vo.getId()))) { |
| | | case INDICATOR_ITEM1: |
| | | // 1:财政经济形势-收入占GDP比重-地方一般公共预算收入占GDP的比重; |
| | | // 获取所需字段 |
| | | deptDividendValue = getBigDecimal(deptFieldsMap, |
| | | deptDividendValue = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD2); |
| | | deptDivisorValue = BigDecimal.valueOf( |
| | | Double.parseDouble(tbBasicData.getCurrentGdp())); |
| | |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD2); |
| | | provinceDivisorValue = BigDecimal.valueOf( |
| | | Double.parseDouble(provinceBasicData.getCurrentGdp())); |
| | | res1 = validateDivisorValue(deptDivisorValue); |
| | | res2 = validateDivisorValue(provinceDivisorValue); |
| | | if (!res1 && !res2) { |
| | | score = getScore(deptDividendValue, deptDivisorValue, |
| | | provinceDividendValue, provinceDivisorValue, vo); |
| | | } else { |
| | | score = 0D; |
| | | } |
| | | |
| | | break; |
| | | case INDICATOR_ITEM2: |
| | | // 2:财政经济形势-收入执行率-地方一般公共预算收入执行进度(地方一般公共预算收入/年初预算或调整预算); |
| | | deptDividendValue = getBigDecimal(deptFieldsMap, |
| | | deptDividendValue = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD2); |
| | | deptDivisorValue = getBigDecimal(deptFieldsMap, |
| | | deptDivisorValue = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD1); |
| | | |
| | | res1 = validateDivisorValue(deptDivisorValue); |
| | | if (!res1) { |
| | | score = getScore(deptDividendValue, deptDivisorValue, month, |
| | | BigDecimal.valueOf(12D), |
| | | vo); |
| | | } else { |
| | | score = 0D; |
| | | } |
| | | break; |
| | | case INDICATOR_ITEM3: |
| | | // 3:财政经济形势-收入执行率-政府性基金预算收入执行进度(政府性基金预算收入/年初预算或调整预算) |
| | | deptDividendValue = getBigDecimal(deptFieldsMap, |
| | | deptDividendValue = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD18); |
| | | deptDivisorValue = getBigDecimal(deptFieldsMap, |
| | | deptDivisorValue = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD17); |
| | | res1 = validateDivisorValue(deptDivisorValue); |
| | | if (!res1) { |
| | | score = getScore(deptDividendValue, deptDivisorValue, month, |
| | | BigDecimal.valueOf(12D), |
| | | vo); |
| | | } else { |
| | | score = 0D; |
| | | } |
| | | break; |
| | | case INDICATOR_ITEM4: |
| | | // 4:财政经济形势-收入质量-税收收入占地方一般公共预算收入比重 |
| | | // 获取所需字段 |
| | | deptDividendValue = getBigDecimal(deptFieldsMap, |
| | | deptDividendValue = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD3); |
| | | deptDivisorValue = getBigDecimal(deptFieldsMap, |
| | | deptDivisorValue = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD2); |
| | | provinceDividendValue = getProvinceBigDecimal(provinceFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD3); |
| | | provinceDivisorValue = getProvinceBigDecimal(provinceFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD2); |
| | | res1 = validateDivisorValue(deptDivisorValue); |
| | | res2 = validateDivisorValue(provinceDivisorValue); |
| | | score = 0D; |
| | | if (!res1 && !res2) { |
| | | score = getScore(deptDividendValue, deptDivisorValue, |
| | | provinceDividendValue, provinceDivisorValue, vo); |
| | | } |
| | | |
| | | break; |
| | | case INDICATOR_ITEM5: |
| | | // 5: 财政经济形势-重大财税政策落实情况-减税降费落实情况 |
| | |
| | | break; |
| | | case INDICATOR_ITEM7: |
| | | // 7:预算管理方面-转移支付-中央转移支付占地方可用财力比重 |
| | | deptDividendValue = getBigDecimal(deptFieldsMap, |
| | | deptDividendValue = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD7); |
| | | deptDivisorValue = getBigDecimal(deptFieldsMap, |
| | | deptDivisorValue = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD13); |
| | | provinceDividendValue = getProvinceBigDecimal(provinceFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD7); |
| | | provinceDivisorValue = getProvinceBigDecimal(provinceFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD7); |
| | | res1 = validateDivisorValue(deptDivisorValue); |
| | | res2 = validateDivisorValue(provinceDivisorValue); |
| | | score = 0D; |
| | | if (!res1 && res2) { |
| | | score = getScore2(deptDividendValue, deptDivisorValue, |
| | | provinceDividendValue, provinceDivisorValue, vo); |
| | | } |
| | | break; |
| | | case INDICATOR_ITEM8: |
| | | // 8:预算管理方面-“三保”保障情况-“三保”年初预算保障情况 |
| | | BigDecimal aw = getBigDecimal(deptFieldsMap, |
| | | BigDecimal aw = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD47); |
| | | BigDecimal ap = getBigDecimal(deptFieldsMap, |
| | | BigDecimal ap = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD40); |
| | | BigDecimal az = getBigDecimal(deptFieldsMap, |
| | | BigDecimal az = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD50); |
| | | BigDecimal aq = getBigDecimal(deptFieldsMap, |
| | | BigDecimal aq = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD41); |
| | | BigDecimal bc = getBigDecimal(deptFieldsMap, |
| | | BigDecimal bc = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD53); |
| | | BigDecimal ar = getBigDecimal(deptFieldsMap, |
| | | BigDecimal ar = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD42); |
| | | boolean res = aw.compareTo(ap) < 0 || (az.compareTo(aq) < 0 || (bc.compareTo(ar) |
| | | < 0)); |
| | | score = res ? 0 : vo.getMaxScore(); |
| | | break; |
| | | case INDICATOR_ITEM9: |
| | | BigDecimal au = getBigDecimal(deptFieldsMap, |
| | | BigDecimal au = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD45); |
| | | BigDecimal r = getBigDecimal(deptFieldsMap, |
| | | BigDecimal r = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD13); |
| | | res1 = validateDivisorValue(r); |
| | | score = 0D; |
| | | if (!res1) { |
| | | BigDecimal divided = au.divide(r, 2, RoundingMode.HALF_UP); |
| | | if (divided.compareTo(BigDecimal.valueOf(0.6D)) > 0) { |
| | | BigDecimal add = BigDecimal.valueOf(0.6D).subtract(divided) |
| | |
| | | } else { |
| | | score = vo.getMaxScore(); |
| | | } |
| | | } |
| | | |
| | | break; |
| | | case INDICATOR_ITEM10: |
| | | // 10:预算管理方面-“三保”保障情况-“三保”支出保障情况 |
| | |
| | | break; |
| | | case INDICATOR_ITEM13: |
| | | // 13:预算执行方面-库款管理-库款保障水平 |
| | | BigDecimal currentData = getBigDecimal(deptFieldsMap, |
| | | BigDecimal currentData = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD35); |
| | | BigDecimal part1; |
| | | BigDecimal part2; |
| | |
| | | } else { |
| | | part1 = BigDecimal.valueOf(4D); |
| | | } |
| | | BigDecimal first = getBigDecimal(deptFieldsMap, |
| | | BigDecimal first = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD36); |
| | | BigDecimal second = getBigDecimal(deptFieldsMap, |
| | | BigDecimal second = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD37); |
| | | BigDecimal third = getBigDecimal(deptFieldsMap, |
| | | BigDecimal third = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD38); |
| | | part2 = first.compareTo(BigDecimal.valueOf(0.3D)) < 0 |
| | | || second.compareTo(BigDecimal.valueOf(0.3D)) < 0 || third.compareTo( |
| | |
| | | break; |
| | | case INDICATOR_ITEM14: |
| | | // 14:预算执行方面-预算执行情况-一般公共预算支出执行率 |
| | | deptDividendValue = getBigDecimal(deptFieldsMap, |
| | | deptDividendValue = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD15); |
| | | deptDivisorValue = getBigDecimal(deptFieldsMap, |
| | | deptDivisorValue = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD14); |
| | | score = getScoreByMonth(deptDividendValue, deptDivisorValue, month, vo); |
| | | break; |
| | | case INDICATOR_ITEM15: |
| | | // 15:预算执行方面-预算执行情况-政府性基金预算支出执行率 |
| | | deptDividendValue = getBigDecimal(deptFieldsMap, |
| | | deptDividendValue = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD23); |
| | | deptDivisorValue = getBigDecimal(deptFieldsMap, |
| | | deptDivisorValue = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD22); |
| | | res1 = validateDivisorValue(deptDivisorValue); |
| | | score = 0D; |
| | | if (!res1) { |
| | | score = getScoreByMonth(deptDividendValue, deptDivisorValue, month, vo); |
| | | } |
| | | break; |
| | | case INDICATOR_ITEM16: |
| | | // 16:预算执行方面-中央直达资金-中央直达资金支付进度 |
| | | deptDividendValue = getBigDecimal(deptFieldsMap, |
| | | deptDividendValue = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD11); |
| | | BigDecimal divided1 = month.divide(BigDecimal.valueOf(12D), 2, |
| | | RoundingMode.HALF_UP); |
| | |
| | | break; |
| | | case INDICATOR_ITEM18: |
| | | // 18:风险防控方面-暂付款管理-违规新增暂付款 |
| | | deptDividendValue = getBigDecimal(deptFieldsMap, |
| | | deptDividendValue = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD57); |
| | | score = deptDividendValue.compareTo(BigDecimal.ZERO) > 0 ? 0D |
| | | : vo.getMaxScore(); |
| | | break; |
| | | case INDICATOR_ITEM19: |
| | | // 19:风险防控方面-暂付款管理-暂付款累计余额 |
| | | BigDecimal bk = getBigDecimal(deptFieldsMap, |
| | | BigDecimal bk = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD61); |
| | | BigDecimal t = getBigDecimal(deptFieldsMap, |
| | | BigDecimal t = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD15); |
| | | BigDecimal ab = getBigDecimal(deptFieldsMap, |
| | | BigDecimal ab = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD23); |
| | | BigDecimal add = t.add(ab.divide(month.multiply( |
| | | BigDecimal.valueOf(12D).multiply(BigDecimal.valueOf(0.05D))), 2, |
| | |
| | | break; |
| | | case INDICATOR_ITEM20: |
| | | // 20:风险防控方面-暂付款管理-暂付款消化 |
| | | deptDividendValue = getBigDecimal(deptFieldsMap, |
| | | deptDividendValue = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD59); |
| | | deptDivisorValue = getBigDecimal(deptFieldsMap, |
| | | deptDivisorValue = getBigDecimal(sysUser.getAreaName(), deptFieldsMap, |
| | | BasicDataFieldEnum.BASIC_DATA_FIELD58); |
| | | res1 = validateDivisorValue(deptDivisorValue); |
| | | score = 0D; |
| | | if (!res1) { |
| | | BigDecimal d1 = deptDividendValue.divide(deptDivisorValue, 2, |
| | | RoundingMode.HALF_UP); |
| | | BigDecimal d2 = month.divide(BigDecimal.valueOf(12D), 2, |
| | |
| | | score = d1.compareTo(d2) < 0 ? d1.divide(d2, 2, RoundingMode.HALF_UP) |
| | | .multiply(BigDecimal.valueOf(vo.getMaxScore())).doubleValue() |
| | | : vo.getMaxScore(); |
| | | } |
| | | break; |
| | | case INDICATOR_ITEM21: |
| | | // 21:风险防控方面-债务管理-法定债务率 |
| | |
| | | // 23:风险防控方面-债务管理-隐性债务化解 |
| | | questionList = getQuestList(list, deptAreaCode, |
| | | QuestionTypeEnum.ENUM6); |
| | | score = CollUtils.isNotEmpty(questionList) ? vo.getMaxScore() : -3D; |
| | | score = CollUtils.isEmpty(questionList) ? vo.getMaxScore() : -3D; |
| | | break; |
| | | case INDICATOR_ITEM24: |
| | | // 24:风险防控方面-债务管理-日常监督发现问题 |
| | |
| | | } |
| | | } |
| | | |
| | | private static boolean validateDivisorValue(BigDecimal deptDivisorValue) { |
| | | if (deptDivisorValue.compareTo(BigDecimal.ZERO) == 0) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | private static List<TbQuestion> getQuestList(List<TbQuestion> list, String deptAreaCode, |
| | | QuestionTypeEnum type) { |
| | | return list.stream() |
| | |
| | | return BigDecimal.valueOf(Double.parseDouble(tbBasicDataField.getFieldValue())); |
| | | } |
| | | |
| | | private BigDecimal getBigDecimal(Map<Long, TbBasicDataField> deptFieldsMap, |
| | | private BigDecimal getBigDecimal(String areaName, Map<Long, TbBasicDataField> deptFieldsMap, |
| | | BasicDataFieldEnum key) { |
| | | TbBasicDataField tbBasicDataField = deptFieldsMap.get(key.getCode()); |
| | | if (Objects.isNull(tbBasicDataField) || StringUtils.isBlank( |
| | | tbBasicDataField.getFieldValue())) { |
| | | throw new ServiceException( |
| | | String.format("字段【%s】的数据缺失,请修改后再试", key.getDesc())); |
| | | String.format(areaName + "-" + "字段【%s】的数据缺失,请修改后再试", |
| | | key.getDesc())); |
| | | } |
| | | |
| | | return BigDecimal.valueOf( |
| | |
| | | |
| | | @Override |
| | | public void subtractScoreWithFixedRules(String deptAreaCode) throws Exception { |
| | | String nowQuarter = DateUtils.getNowQuarter(); |
| | | String previousQuarter = DateUtils.getPreviousQuarter(); |
| | | TbBasicData tbBasicData = tbBasicDataMapper.selectOne( |
| | | Wrappers.lambdaQuery(TbBasicData.class).eq(TbBasicData::getQuarter, nowQuarter) |
| | | Wrappers.lambdaQuery(TbBasicData.class).eq(TbBasicData::getQuarter, previousQuarter) |
| | | .eq(TbBasicData::getDeptAreaCode, deptAreaCode)); |
| | | if (Objects.isNull(tbBasicData)) { |
| | | return; |
| | |
| | | List<BasicDataConfigVO> fixedRulesConfigList = tbBasicDataConfigService.getSubsractRulesConfigList(); |
| | | List<TbQuestion> list = tbQuestionMapper.selectList( |
| | | Wrappers.lambdaQuery(TbQuestion.class) |
| | | .eq(TbQuestion::getQuarter, nowQuarter) |
| | | .eq(TbQuestion::getQuarter, previousQuarter) |
| | | .eq(TbQuestion::getDeptAreaCode, deptAreaCode)); |
| | | List<TbQuestion> questionList; |
| | | |
| | |
| | | LocalDate quarterStartLocalDate = instant.atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | LocalDate fifteenDaysLimit = quarterStartLocalDate.plusDays(14); |
| | | LocalDate now = LocalDate.now(); |
| | | vo.setQuarter(DateUtils.getNowQuarter()); |
| | | String previousQuarter = DateUtils.getPreviousQuarter(); |
| | | previousQuarter = "2024年一季度"; |
| | | DateUtils.getQuarterDate(previousQuarter); |
| | | vo.setQuarter(previousQuarter); |
| | | vo.setStatus(ReportingStatusEnum.UNFILLED); |
| | | // 如果当前时间不在规定范围内:季度初1-15号 TODO |
| | | // 如果当前时间不在规定范围内:季度初1-15号 |
| | | /* if (now.isBefore(quarterStartLocalDate) || now.isAfter(fifteenDaysLimit)) { |
| | | return R.ok(vo, "请于季度初1-15号上传季度数据。"); |
| | | }*/ |
| | |
| | | this.getOne( |
| | | Wrappers.<TbBasicData>lambdaQuery() |
| | | .eq(TbBasicData::getDeptAreaCode, dept.getAreaCode()) |
| | | .between(TbBasicData::getReportingTime, quarterStart, quarterEnd)); |
| | | .eq(TbBasicData::getQuarter, previousQuarter)); |
| | | if (Objects.nonNull(basicData)) { |
| | | vo.setCreateTime(basicData.getCreateTime()); |
| | | vo.setUpdateTime(basicData.getUpdateTime()); |
| | | vo.setFinishedTime(basicData.getUpdateTime()); |
| | | } |
| | | // 查询需要填写的字段 |
| | | List<TbField> list = |
| | |
| | | vo.setFields(roots); |
| | | } |
| | | if (Objects.isNull(basicData)) { |
| | | vo.setQuarter(DateUtils.getNowQuarter()); |
| | | vo.setQuarter(previousQuarter); |
| | | vo.setStatus(ReportingStatusEnum.UNFILLED); |
| | | return R.ok(vo); |
| | | } else { |
| | |
| | | if (Objects.isNull(dto) || CollUtils.isEmpty(dto.getFields())) { |
| | | return; |
| | | } |
| | | String nowQuarter = DateUtils.getNowQuarter(); |
| | | String previousQuarter = DateUtils.getPreviousQuarter(); |
| | | previousQuarter = "2024年一季度"; |
| | | // 查询需要填写的动态字段 |
| | | List<TbField> fieldList = |
| | | tbFieldService.lambdaQuery().eq(TbField::getStatus, ShowStatusEnum.SHOW).list(); |
| | |
| | | fieldList.stream().collect(Collectors.toMap(TbField::getId, e -> e)); |
| | | Optional<TbBasicData> basicDataOpt = this.lambdaQuery() |
| | | .eq(TbBasicData::getDeptAreaCode, areaCode) |
| | | .eq(TbBasicData::getQuarter, nowQuarter).oneOpt(); |
| | | .eq(TbBasicData::getQuarter, previousQuarter).oneOpt(); |
| | | TbBasicData tbBasicData = BeanUtils.copyBean(dto, TbBasicData.class); |
| | | if (basicDataOpt.isPresent()) { |
| | | tbBasicData.setId(basicDataOpt.get().getId()); |
| | |
| | | } else { |
| | | tbBasicData.setDeptAreaCode(areaCode); |
| | | tbBasicData.setStatus(ReportingStatusEnum.MISSING_DATA); |
| | | tbBasicData.setQuarter(nowQuarter); |
| | | tbBasicData.setReportingTime(DateUtils.getQuarterDate(nowQuarter)); |
| | | tbBasicData.setQuarter(previousQuarter); |
| | | tbBasicData.setReportingTime(DateUtils.getQuarterDate(previousQuarter)); |
| | | this.save(tbBasicData); |
| | | } |
| | | // 保存基础数据动态字段数据 |
| | |
| | | && StringUtils.isNotEmpty(dto.getCurrentGdp())); |
| | | if (flag) { |
| | | tbBasicData.setStatus(ReportingStatusEnum.FILLED); |
| | | tbBasicData.setFinishedTime(new Date()); |
| | | this.updateById(tbBasicData); |
| | | } |
| | | /*if (ReportingStatusEnum.FILLED.equals(tbBasicData.getStatus())) { |
| | |
| | | }*/ |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | String areaCode = loginUser.getUser().getAreaCode(); |
| | | String nowQuarter = DateUtils.getNowQuarter(); |
| | | String previousQuarter = DateUtils.getPreviousQuarter(); |
| | | previousQuarter = "2024年一季度"; |
| | | EasyExcel.read( |
| | | file.getInputStream(), |
| | | new BasicDataListener( |
| | |
| | | tbBasicDataFieldService, |
| | | tbBasicDataConfigService, |
| | | tbBasicDataConfigDetailService, |
| | | tbScoreService, tbDataScreenScoreService, nowQuarter, |
| | | tbScoreService, tbDataScreenScoreService, previousQuarter, |
| | | tbDataScreenConfigService, |
| | | asyncService)) |
| | | .sheet() |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageDTO<ScoreVO> pageScore(ScoreQuery query) { |
| | | public PageDTO<ScoreVO> pageScore(ScoreQuery query) throws Exception { |
| | | Page<ScoreVO> page = new Page<>(query.getPageNum(), query.getPageSize()); |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | String areaCode = user.getAreaCode(); |
| | | Date date = new Date(); |
| | | Date quarterStart = DateUtil.beginOfQuarter(date); |
| | | Date quarterEnd = DateUtil.endOfQuarter(date); |
| | | String previousQuarter = DateUtils.getPreviousQuarter(); |
| | | previousQuarter = "2024年一季度"; |
| | | // 查询是否有当前季度的填报记录 |
| | | TbBasicData basicData = |
| | | this.getOne( |
| | | Wrappers.<TbBasicData>lambdaQuery() |
| | | .eq(TbBasicData::getDeptAreaCode, areaCode) |
| | | .between(TbBasicData::getReportingTime, quarterStart, quarterEnd)); |
| | | .eq(TbBasicData::getQuarter, previousQuarter)); |
| | | if (Objects.isNull(basicData)) { |
| | | return PageDTO.empty(page); |
| | | } |
| | |
| | | remark.setName("备注"); |
| | | roots.add(remark); |
| | | vo.setFields(roots); |
| | | String nowQuarter = DateUtils.getNowQuarter(); |
| | | String previousQuarter = DateUtils.getPreviousQuarter(); |
| | | previousQuarter = "2024年一季度"; |
| | | // 查询上报的基础数据 |
| | | List<TbBasicData> basicDataList = |
| | | this.lambdaQuery() |
| | | .eq(TbBasicData::getQuarter, nowQuarter) |
| | | .eq(TbBasicData::getQuarter, previousQuarter) |
| | | .eq(TbBasicData::getStatus, ReportingStatusEnum.FILLED) |
| | | .list(); |
| | | if (CollUtils.isNotEmpty(basicDataList)) { |
| | |
| | | if (Objects.isNull(basicData)) { |
| | | throw new ServiceException("非法参数"); |
| | | } |
| | | String nowQuarter = DateUtils.getNowQuarter(); |
| | | this.updateById(basicData); |
| | | // 查询该基础数据的动态字端 |
| | | // 查询需要填写的动态字段 |
| | |
| | | BeanUtils.copyBean(dto, BasicDataDTO.class), |
| | | fieldMap)); |
| | | TbBasicData tbBasicData = BeanUtils.copyBean(dto, TbBasicData.class); |
| | | |
| | | tbBasicData.setQuarter(basicData.getQuarter()); |
| | | // 保存基础数据动态字段数据 |
| | | List<TbBasicDataField> tbBasicDataFields = |
| | | BeanUtils.copyList(dto.getFields(), TbBasicDataField.class); |
| | |
| | | |
| | | @Override |
| | | public List<FieldAndScoreDataVO> getFieldAndScoreData(String areaCode, String nowQuarter, |
| | | Integer yearType) { |
| | | return baseMapper.getFieldAndScoreData(areaCode, nowQuarter, yearType); |
| | | Integer yearType, Integer isAll) { |
| | | return baseMapper.getFieldAndScoreData(areaCode, nowQuarter, yearType, isAll); |
| | | } |
| | | } |
| | |
| | | import com.finance.common.exception.ServiceException; |
| | | import com.finance.common.utils.BeanUtils; |
| | | import com.finance.common.utils.CollUtils; |
| | | import com.finance.common.utils.DateUtils; |
| | | import com.finance.common.utils.EasyExcelUtil; |
| | | import com.finance.common.utils.SecurityUtils; |
| | | import com.finance.common.utils.StringUtils; |
| | |
| | | columnNo.add(String.valueOf(i)); |
| | | } |
| | | excellist.add(columnNo); |
| | | excellist.add(Lists.newArrayList(areaName, isDept ? DateUtils.getNowQuarter() : "")); |
| | | excellist.add(Lists.newArrayList(areaName, isDept ? "2024年一季度" : "")); |
| | | // excellist.add(Lists.newArrayList(areaName, isDept ? DateUtils.getPreviousQuarter() : "")); |
| | | return excellist; |
| | | } |
| | | |
| | |
| | | public void addQuestion(QuestionDTO dto) throws Exception { |
| | | TbQuestion tbQuestion = BeanUtils.copyBean(dto, TbQuestion.class); |
| | | tbQuestion.setType(dto.getType()); |
| | | tbQuestion.setQuarter(DateUtils.getNowQuarter()); |
| | | String previousQuarter = DateUtils.getPreviousQuarter(); |
| | | previousQuarter = "2024年一季度"; |
| | | tbQuestion.setQuarter(previousQuarter); |
| | | this.save(tbQuestion); |
| | | asyncService.subtractScoreWithFixedRules(dto.getDeptAreaCode()); |
| | | } |
| | |
| | | |
| | | return questionVOPageDTO; |
| | | } |
| | | |
| | | @Override |
| | | public void delete(Long id) { |
| | | TbQuestion question = this.getById(id); |
| | | try { |
| | | asyncService.subtractScoreWithFixedRules(question.getDeptAreaCode()); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | this.removeById(id); |
| | | } |
| | | } |
| | |
| | | import com.finance.common.exception.ServiceException; |
| | | import com.finance.common.utils.BeanUtils; |
| | | import com.finance.common.utils.CollUtils; |
| | | import com.finance.common.utils.DateUtils; |
| | | import com.finance.system.domain.TbBasicDataConfig; |
| | | import com.finance.system.domain.TbScore; |
| | | import com.finance.system.mapper.TbScoreMapper; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ScoreCalculateDetailVO scoreCalculateDetail(ScoreCalculateDetailQuery query) { |
| | | public ScoreCalculateDetailVO scoreCalculateDetail(ScoreCalculateDetailQuery query) |
| | | throws Exception { |
| | | // 查询计算类型 |
| | | TbBasicDataConfig config = basicDataConfigService.getById(query.getId()); |
| | | if (Objects.isNull(config)) { |
| | |
| | | vo.setTypeName(config.getTypeName()); |
| | | vo.setCalculateType(config.getCalculateType()); |
| | | Page<ScoreDetailVO> page = new Page<>(query.getPageNum(), query.getPageSize()); |
| | | |
| | | String previousQuarter = DateUtils.getPreviousQuarter(); |
| | | previousQuarter = "2024年一季度"; |
| | | query.setPreviousQuarter(previousQuarter); |
| | | Page<ScoreDetailVO> pageVO = baseMapper.scoreCalculateDetail(query, page); |
| | | vo.setTotal(pageVO.getTotal()); |
| | | vo.setPages(pageVO.getPages()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ScoreRankVO queryRankAndScoreByAreaCode(String areaCode) { |
| | | return baseMapper.queryRankAndScoreByAreaCode(areaCode); |
| | | public ScoreRankVO queryRankAndScoreByAreaCode(String areaCode) throws Exception { |
| | | String previousQuarter = DateUtils.getPreviousQuarter(); |
| | | previousQuarter = "2024年一季度"; |
| | | List<ScoreRankVO> voList = baseMapper.queryRankAndScoreByAreaCode(areaCode, |
| | | previousQuarter); |
| | | if (CollUtils.isNotEmpty(voList)) { |
| | | for (int i = 0; i < voList.size(); i++) { |
| | | if (areaCode.equals(voList.get(i).getAreaCode())) { |
| | | voList.get(i).setRank(i + 1); |
| | | return voList.get(i); |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public ScoreCalculateDetailVO fieldsDetail(CalculateDetailQuery query, |
| | | List<SysUser> countyList) { |
| | | List<SysUser> countyList) throws Exception { |
| | | // 查询计算类型 |
| | | TbBasicDataConfig config = basicDataConfigService.getById(query.getId()); |
| | | if (Objects.isNull(config)) { |
| | |
| | | vo.setTypeName(config.getTypeName()); |
| | | vo.setCalculateType(config.getCalculateType()); |
| | | Page<ScoreDetailVO> page = new Page<>(query.getPageNum(), query.getPageSize()); |
| | | String previousQuarter = DateUtils.getPreviousQuarter(); |
| | | previousQuarter = "2023年一季度"; |
| | | Page<ScoreDetailVO> pageVO = baseMapper.fieldsDetail(query, page, areaCodeList); |
| | | vo.setTotal(pageVO.getTotal()); |
| | | vo.setPages(pageVO.getPages()); |
| | |
| | | |
| | | /** |
| | | * @param areaCode 区划代码 |
| | | * @param yearType 年份类型 1=今年 2=去年 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<RiskMapVO> getScoreByYearType(String areaCode, Integer yearType) { |
| | | return baseMapper.getScoreByYearType(areaCode, yearType); |
| | | public List<RiskMapVO> getScoreByYearType(String areaCode, String quarter) { |
| | | return baseMapper.getScoreByYearType(areaCode, quarter); |
| | | } |
| | | } |
| | |
| | | import com.finance.common.enums.ReportingStatusEnum; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | |
| | | |
| | | @ApiModelProperty(value = "填报完成时间",notes = "状态为已填报才展示") |
| | | @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") |
| | | private Date updateTime; |
| | | private Date finishedTime; |
| | | |
| | | //1:未填报 2:数据缺失 3:已填报 |
| | | @ApiModelProperty(value = "字段") |
| | |
| | | private List<RiskMapVO> riskMapVOList; |
| | | @ApiModelProperty("风险等级区间") |
| | | private List<RiskLevelVO> riskLevelVOList; |
| | | @ApiModelProperty("得分") |
| | | private Double score; |
| | | } |
| | | |
| | | |
| | |
| | | <select id="getFieldAndScoreData" resultType="com.finance.system.vo.FieldAndScoreDataVO"> |
| | | SELECT tbdc.id, |
| | | tbdc.type_name, |
| | | ts.score, |
| | | ROUND(ts.score,2) AS score, |
| | | tbdc.max_score, |
| | | tbd.dept_area_code, |
| | | tbdc.basic_data_category_id AS basicDataCategoryId, |
| | |
| | | LEFT JOIN tb_basic_data_config tbdc ON ts.basic_data_config_id = tbdc.id |
| | | LEFT JOIN tb_basic_data_category tbdc2 ON tbdc2.id = tbdc.basic_data_category_id |
| | | LEFT JOIN tb_basic_data_category tbdc3 ON tbdc2.parent_id = tbdc3.id |
| | | LEFT JOIN sys_user su ON tbd.dept_area_code = su.area_code |
| | | <where> |
| | | tbd.`quarter` = #{nowQuarter} |
| | | <if test="areaCode!=null and areaCode != ''"> |
| | | tbd.`quarter` = #{nowQuarter} AND su.user_id IN (SELECT user_id FROM sys_user WHERE |
| | | area_code |
| | | LIKE CONCAT( SUBSTRING(#{areaCode}, 0, 4 ), '%' ) AND user_type = 2 AND area_level = 4) |
| | | <if test="isAll!=null and isAll == 2"> |
| | | AND tbd.dept_area_code = #{areaCode} |
| | | </if> |
| | | <if test="yearType==1"> |
| | |
| | | <if test="query.typeName !=null and query.typeName!=''"> |
| | | AND tbdc.type_name like Concat('%',#{query.typeName},'%') |
| | | </if> |
| | | <if test="query.typeName !=null and query.typeName!=''"> |
| | | <if test="query.type !=null and query.type!=''"> |
| | | AND tbdc.calculate_type = #{query.type} |
| | | </if> |
| | | |
| | |
| | | LEFT JOIN sys_user su ON tbd.dept_area_code = su.area_code |
| | | <where> |
| | | ts.basic_data_config_id = #{query.id} AND su.area_name IS NOT NULL |
| | | AND tbd.quarter = #{query.previousQuarter} |
| | | <if test="query.areaName != null and query.areaName != ''"> |
| | | AND su.area_name LIKE CONCAT('%',#{query.areaName},'%') |
| | | </if> |
| | |
| | | |
| | | </select> |
| | | <select id="queryRankAndScoreByAreaCode" resultType="com.finance.system.vo.ScoreRankVO"> |
| | | SET @rank = 0; |
| | | SELECT dept_area_code AS areaCode, |
| | | COALESCE(score, 0) AS score, |
| | | `rank` |
| | | FROM (SELECT tbc.dept_area_code, |
| | | SUM(ts.score) AS score, |
| | | (@rank := @rank + 1) AS `rank` |
| | | SELECT tbc.dept_area_code AS areaCode, |
| | | ROUND(SUM(ts.score), 2) AS score |
| | | FROM tb_score ts |
| | | LEFT JOIN tb_basic_data tbc ON ts.basic_data_id = tbc.id |
| | | LEFT JOIN tb_basic_data_config tbdc ON ts.basic_data_config_id = tbdc.id |
| | | WHERE YEAR(tbc.reporting_time) = YEAR( |
| | | LEFT JOIN sys_user su ON tbc.dept_area_code = su.area_code |
| | | <where> |
| | | tbc.quarter = #{previousQuarter} |
| | | AND YEAR(tbc.reporting_time) = YEAR( |
| | | CURDATE()) |
| | | AND su.user_id in (SELECT user_id |
| | | FROM sys_user |
| | | WHERE area_code LIKE CONCAT(SUBSTRING(#{areaCode}, 0, 4), '%') |
| | | AND user_type = 2 |
| | | AND area_level = 4) |
| | | </where> |
| | | |
| | | GROUP BY tbc.dept_area_code |
| | | ORDER BY score |
| | | DESC) AS ranked_data |
| | | WHERE dept_area_code = #{areaCode} |
| | | ORDER BY score DESC |
| | | |
| | | </select> |
| | | <select id="deptCalculateDetail" resultType="com.finance.system.vo.DeptCalculateDetailVO"> |
| | | SELECT bdc.id, |
| | |
| | | <if test="query.areaCode != null and query.areaCode != ''"> |
| | | AND su.area_code=#{query.areaCode} |
| | | </if> |
| | | <if test="query.previousQuarter != null and query.previousQuarter != ''"> |
| | | AND tbd.quarter=#{previousQuarter} |
| | | </if> |
| | | group by su.area_code |
| | | </where> |
| | | </select> |
| | | <select id="getCurrentScoreList" resultType="com.finance.system.vo.RiskMapVO"> |
| | |
| | | LEFT JOIN tb_basic_data tbd ON ts.basic_data_id = tbd.id |
| | | LEFT JOIN sys_user su ON tbd.dept_area_code = su.area_code |
| | | <where> |
| | | tbd.`quarter` = #{nowQuarter} |
| | | tbd.`quarter` = #{nowQuarter} AND su.area_level != 0 |
| | | <if test="areaCode != null and areaCode != ''"> |
| | | AND tbd.dept_area_code = #{areaCode} |
| | | </if> |
| | |
| | | AND su.area_level = '${@com.finance.common.enums.AreaLevelEnum@COUNTY.getCode()}' |
| | | </where> |
| | | GROUP BY tbd.id) rs |
| | | ORDER BY rs.score DESC |
| | | ORDER BY rs.score ASC |
| | | </select> |
| | | <select id="getScoreByYearType" resultType="com.finance.system.vo.RiskMapVO"> |
| | | SELECT * |
| | |
| | | LEFT JOIN tb_basic_data tbd ON tbd.id = ts.basic_data_id |
| | | LEFT JOIN sys_user su ON su.area_code = tbd.dept_area_code |
| | | <where> |
| | | tbd.dept_area_code = #{areaCode} |
| | | <if test="yearType!=null and yearType==1"> |
| | | AND YEAR(tbd.reporting_time) = YEAR(CURDATE()) |
| | | </if> |
| | | <if test="yearType!=null and yearType==2"> |
| | | AND YEAR(tbd.reporting_time) = YEAR(CURDATE())-1 |
| | | </if> |
| | | tbd.dept_area_code = #{areaCode} AND tbd.quarter = #{quarter} |
| | | </where> |
| | | GROUP BY tbd.id) rs |
| | | ORDER BY rs.score DESC |